(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory(require("vue"), require("@kq_npm/client_common_vue/_utils/util"), require("@kq_npm/client_common_vue/_utils/gis-utils"), require("@kq_npm/client_common_vue/init.js"));
	else if(typeof define === 'function' && define.amd)
		define(["vue", "@kq_npm/client_common_vue/_utils/util", "@kq_npm/client_common_vue/_utils/gis-utils", "@kq_npm/client_common_vue/init.js"], factory);
	else {
		var a = typeof exports === 'object' ? factory(require("vue"), require("@kq_npm/client_common_vue/_utils/util"), require("@kq_npm/client_common_vue/_utils/gis-utils"), require("@kq_npm/client_common_vue/init.js")) : factory(root["Vue"], root["@kq_npm/client_common_vue/_utils/util"], root["@kq_npm/client_common_vue/_utils/gis-utils"], root["@kq_npm/client_common_vue/init.js"]);
		for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
	}
})(this, function(__WEBPACK_EXTERNAL_MODULE__154__, __WEBPACK_EXTERNAL_MODULE__2975__, __WEBPACK_EXTERNAL_MODULE__64__, __WEBPACK_EXTERNAL_MODULE__455__) {
return /******/ (function() { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ({

/***/ 8224:
/***/ (function(module) {

module.exports = require("core-js/modules/esnext.iterator.map.js");

/***/ }),

/***/ 890:
/***/ (function(module) {

module.exports = require("vue-i18n/dist/vue-i18n.cjs");

/***/ }),

/***/ 64:
/***/ (function(module) {

module.exports = __WEBPACK_EXTERNAL_MODULE__64__;

/***/ }),

/***/ 2975:
/***/ (function(module) {

module.exports = __WEBPACK_EXTERNAL_MODULE__2975__;

/***/ }),

/***/ 455:
/***/ (function(module) {

module.exports = __WEBPACK_EXTERNAL_MODULE__455__;

/***/ }),

/***/ 154:
/***/ (function(module) {

module.exports = __WEBPACK_EXTERNAL_MODULE__154__;

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// The module cache
/******/ 	var __webpack_module_cache__ = {};
/******/ 	
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/ 		// Check if module is in cache
/******/ 		var cachedModule = __webpack_module_cache__[moduleId];
/******/ 		if (cachedModule !== undefined) {
/******/ 			return cachedModule.exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = __webpack_module_cache__[moduleId] = {
/******/ 			// no module.id needed
/******/ 			// no module.loaded needed
/******/ 			exports: {}
/******/ 		};
/******/ 	
/******/ 		// Execute the module function
/******/ 		__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/ 	
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/ 	
/************************************************************************/
/******/ 	/* webpack/runtime/compat get default export */
/******/ 	!function() {
/******/ 		// getDefaultExport function for compatibility with non-harmony modules
/******/ 		__webpack_require__.n = function(module) {
/******/ 			var getter = module && module.__esModule ?
/******/ 				function() { return module['default']; } :
/******/ 				function() { return module; };
/******/ 			__webpack_require__.d(getter, { a: getter });
/******/ 			return getter;
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/define property getters */
/******/ 	!function() {
/******/ 		// define getter functions for harmony exports
/******/ 		__webpack_require__.d = function(exports, definition) {
/******/ 			for(var key in definition) {
/******/ 				if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ 					Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ 				}
/******/ 			}
/******/ 		};
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/hasOwnProperty shorthand */
/******/ 	!function() {
/******/ 		__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
/******/ 	}();
/******/ 	
/******/ 	/* webpack/runtime/make namespace object */
/******/ 	!function() {
/******/ 		// define __esModule on exports
/******/ 		__webpack_require__.r = function(exports) {
/******/ 			if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 				Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 			}
/******/ 			Object.defineProperty(exports, '__esModule', { value: true });
/******/ 		};
/******/ 	}();
/******/ 	
/************************************************************************/
var __webpack_exports__ = {};
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  StatusBarViewModel: function() { return /* reexport */ StatusBarViewModel; },
  "default": function() { return /* reexport */ StatusBar; }
});

// EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(154);
// EXTERNAL MODULE: external "core-js/modules/esnext.iterator.map.js"
var esnext_iterator_map_js_ = __webpack_require__(8224);
// EXTERNAL MODULE: external "@kq_npm/client_common_vue/_utils/util"
var util_ = __webpack_require__(2975);
// EXTERNAL MODULE: external "@kq_npm/client_common_vue/_utils/gis-utils"
var gis_utils_ = __webpack_require__(64);
;// CONCATENATED MODULE: ./src/leaflet/statusbar/StatusBarViewModel.js

/*
 * Copyright (C) 2019 KQ GEO Technologies Co., Ltd.
 * All rights reserved.
 */
/**
 * Author: ZL
 * Date: 2022.8.4
 * Description: 状态栏组件的逻辑类。
 */



//import globalEvent from "@/common/_types/global-event";

class StatusBarViewModel extends window.L.Evented {
  /**
   * @param {string} mapTarget 绑定地图的div的id
   * @param {string} position 组件位置
   * @param {string} mode String
   * @event setLevel 监听级别的事件
   * @event setXY 监听坐标的事件
   */
  constructor(mapTarget, position, mode) {
    super();

    /**
     * 操作地图对象
     * @type {MapViewViewModel}
     * @private
     */
    this._webMap = null;

    /**
     * 外部参数
     * @type {{position: (string), mapTarget: string}}
     * @private
     */
    this._props = {
      mapTarget,
      position,
      mode
    };

    //事件绑定this
    this._onMousemove = this._onMousemove.bind(this);
    this._onZoomend = this._onZoomend.bind(this);
  }
  init() {
    this._registerEvents();
  }

  /**
   * 注册事件
   * @private
   */
  _registerEvents() {
    const self = this;
    gis_utils_.utils.getWebMap(this._props.mapTarget, webmap => {
      self._webMap = webmap;
      if (this._webMap.map) {
        self._setDefaultData();
      }
    });

    // 地图被重新创建后 底图需要重新刷新数据
    // globalEvent.on("create-new-map", () => {
    //   if (this._webMap && this._webMap.map) {
    //     this._webMap.map.off("mousemove", this._onMousemove);
    //
    //     this._webMap.map.off("zoomend", this._onZoomend);
    //   }
    //
    //   utils.getWebMap(this._mapTarget, webmap => {
    //     self._webMap = webmap;
    //
    //     if (this._webMap.map) {
    //       self._setDefaultData();
    //     }
    //   });
    // });
  }

  /**
   * 绑定地图移动、缩放事件，获取坐标、比例尺
   * @private
   */
  _setDefaultData() {
    // 鼠标移动事件
    this._webMap.map.on("mousemove", this._onMousemove);

    // 鼠标缩放事件
    this._webMap.map.on("zoomend", this._onZoomend);
    let center = this._webMap.map.getCenter();
    this.epsg = this._webMap.map.options.crs.code;
    this._getMapType();
    this._setXY(center);
    this._setLevel();
    this.fire("setEpsg", {
      ig: this._isGeographical
    });
  }

  /**
   * 地图鼠标移动函数
   * @param e
   * @private
   */
  _onMousemove(e) {
    this._setXY(e.latlng);
  }

  /**
   * 地图级别变化函数
   * @param e
   * @private
   */
  _onZoomend(e) {
    this._setLevel();
  }

  /**
   * 设置坐标
   * @param {L.latlng} point
   * @fires event:setXY
   * @private
   */
  _setXY(point) {
    let latFixed, lngFixed, type;

    // 经纬度使用度分秒格式，平面坐标使用保留两位的数字
    if (!this._isGeographical) {
      let firstProjection = new window.proj4.Proj("EPSG:4326");
      let secondProjection = new window.proj4.Proj(this.epsg);
      let result = window.proj4.transform(firstProjection, secondProjection, [point.lng, point.lat]);
      latFixed = result.y.toFixed(3);
      lngFixed = result.x.toFixed(3);
      type = "projection";
    } else {
      if (this._props.mode !== "1") {
        latFixed = (0,util_.convertXY)(point.lat);
        lngFixed = (0,util_.convertXY)(point.lng);
      } else {
        latFixed = point.lat.toFixed(6);
        lngFixed = point.lng.toFixed(6);
      }
      type = "geographic";
    }
    this.fire("setXY", {
      lng: lngFixed,
      lat: latFixed,
      srcType: type
    });
  }

  /**
   * 设置级别
   * @fires event:setLevel
   * @private
   */
  _setLevel() {
    const value = this._webMap.map.getZoom() + this._webMap.zoomOffset;
    this.fire("setLevel", {
      level: value
    });
  }
  _getMapType() {
    if (this.epsg === "EPSG:4490" || this.epsg === "EPSG:4326" || this.epsg === "EPSG:4610") {
      this._isGeographical = true;
    } else {
      this._isGeographical = false;
    }
  }

  /**
   * 销毁
   */
  destroy() {
    // 删除所有事件监听
    this.off();
    if (this._webMap && this._webMap.map) {
      this._webMap.map.off("mousemove", this._onMousemove);
      this._webMap.map.off("zoomend", this._onZoomend);
    }
  }
}
// EXTERNAL MODULE: external "vue-i18n/dist/vue-i18n.cjs"
var vue_i18n_cjs_ = __webpack_require__(890);
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/dist/index.js??ruleSet[0]!./src/leaflet/statusbar/StatusBar.vue?vue&type=script&setup=true&lang=js

const _hoisted_1 = {
  class: "status-bar"
};
const _hoisted_2 = {
  class: "panel-item"
};
const _hoisted_3 = {
  class: "textPanel"
};
const _hoisted_4 = {
  class: "pane-item"
};



const __default__ = {
  name: "Kq2dStatusBar"
};
/* harmony default export */ var StatusBarvue_type_script_setup_true_lang_js = (/*@__PURE__*/Object.assign(__default__, {
  props: {
    // 每个地图相关组件的必须参数 非必传 指定组件绑定的map对象的div的id
    mapTarget: String,
    // bottomCenter | bottomLeft | bottomRight
    position: {
      type: String,
      default: "bottomCenter"
    },
    mode: {
      type: String,
      default: "1"
    }
  },
  setup(__props, {
    expose: __expose
  }) {
    const props = __props;

    // 国际化
    let {
      t
    } = (0,vue_i18n_cjs_.useI18n)();
    let viewModel = null;
    let lngText = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)("");
    let latText = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)("");
    let lng = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)("");
    let lat = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)("");
    let level = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)("");
    let direction = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)("vertical");
    let isGeographical = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(false);
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.watch)(() => props.mapTarget, (newVal, oldVal) => {
      if (viewModel) {
        viewModel.destroy();
      }
      initViewModel();
      setPosition();
    });
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.watch)(() => props.position, (newVal, oldVal) => {
      setPosition();
    });
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.onMounted)(() => {
      initViewModel();
      setPosition();
    });
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.onBeforeUnmount)(() => {
      viewModel.destroy();
      viewModel = null;
    });

    // 抛出方法 外部调用
    __expose({
      refresh
    });
    function initViewModel() {
      viewModel = new StatusBarViewModel(props.mapTarget, props.position, props.mode);
      // 逻辑类监听数据设置事件
      viewModel.on("setXY", _data => {
        lng.value = _data.lng;
        lat.value = _data.lat;
        if (_data.srcType === "geographic") {
          lngText.value = t("leaflet.statusBarLng") + "：";
          latText.value = t("leaflet.statusBarLat") + "：";
        } else {
          lngText.value = "X：";
          latText.value = "Y：";
        }
      });
      viewModel.on("setLevel", _data => {
        if (props.position && props.position === "bottomCenter") {
          level.value += "丨";
        }
        level.value = t("leaflet.statusBarLevelName") + "：" + _data.level;
      });
      viewModel.on("setEpsg", v => {
        isGeographical.value = v.ig;
      });
      viewModel.init();
    }
    function refresh() {
      if (viewModel) {
        viewModel.destroy();
      }
      initViewModel();
      setPosition();
    }

    /**
     * 组件位置设置
     */
    function setPosition() {
      // position的值只有居中时“bottom-center”，才是横排
      let _status_bar_dom = document.querySelector(".status-bar");
      if (_status_bar_dom) {
        if (props.position && props.position === "bottomCenter") {
          direction.value = "horizontal";
          _status_bar_dom.style.textAlign = "center";
          _status_bar_dom.style.width = "100%";
          _status_bar_dom.style.right = "unset";
        } else if (props.position && props.position === "bottomRight") {
          _status_bar_dom.style.left = "unset";
          _status_bar_dom.style.right = "16px";
          _status_bar_dom.style.textAlign = "unset";
        } else if (props.position && props.position === "bottomLeft") {
          _status_bar_dom.style.left = "16px";
          _status_bar_dom.style.right = "unset";
          _status_bar_dom.style.textAlign = "unset";
        }
      }
    }
    return (_ctx, _cache) => {
      const _component_kq_space = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveComponent)("kq-space");
      return (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.openBlock)(), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementBlock)("div", _hoisted_1, [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_space, {
        direction: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(direction),
        alignment: "start",
        size: 16
      }, {
        default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("div", _hoisted_2, [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("span", _hoisted_3, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(lngText)), 1 /* TEXT */), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("span", {
          class: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.normalizeClass)(['jd', props.mode === '2' && (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(isGeographical) !== false ? 'w-jd' : ''])
        }, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(lng)), 3 /* TEXT, CLASS */)]), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("div", _hoisted_4, [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("span", null, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(latText)), 1 /* TEXT */), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("span", {
          class: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.normalizeClass)(['wd', props.mode === '2' && (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(isGeographical) !== false ? 'w-wd' : ''])
        }, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(lat)), 3 /* TEXT, CLASS */)]), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("div", null, [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("span", null, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.toDisplayString)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(level)), 1 /* TEXT */)])]),
        _: 1 /* STABLE */
      }, 8 /* PROPS */, ["direction"])]);
    };
  }
}));
;// CONCATENATED MODULE: ./src/leaflet/statusbar/StatusBar.vue?vue&type=script&setup=true&lang=js
 
;// CONCATENATED MODULE: ./src/leaflet/statusbar/StatusBar.vue



const __exports__ = StatusBarvue_type_script_setup_true_lang_js;

/* harmony default export */ var StatusBar = (__exports__);
// EXTERNAL MODULE: external "@kq_npm/client_common_vue/init.js"
var init_js_ = __webpack_require__(455);
var init_js_default = /*#__PURE__*/__webpack_require__.n(init_js_);
;// CONCATENATED MODULE: ./src/leaflet/statusbar/index.js
/*
 * Copyright (C) 2019 KQ GEO Technologies Co., Ltd.
 * All rights reserved.
 */



StatusBar.install = (Vue, opts) => {
  init_js_default()(Vue, opts);
  Vue.component(StatusBar.name, StatusBar);
};

/******/ 	return __webpack_exports__;
/******/ })()
;
});