/******/ (function() { // webpackBootstrap
/******/ 	"use strict";
/******/ 	var __webpack_modules__ = ({

/***/ 403:
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": function() { return /* binding */ Mitt; }
/* harmony export */ });
/* harmony import */ var _Users_zpc_Documents_KQGEOSpace_KQGISClientForVue_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8270);
/* harmony import */ var _common_utils_util__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2107);
/* harmony import */ var _common_utils_util__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_common_utils_util__WEBPACK_IMPORTED_MODULE_0__);


/**
 * 向外暴露的默认函数
 * @param 入参为 EventHandlerMap
 * @returns 返回一个对象，对象包含属性 all，方法 on，off，emit
 */

class Mitt {
  /*
      此处实参可传一个EventHandlerMap对象，实现多个 mitt 的合并。例如：
      const m1 = mitt();
      m1.on('hi', () => { console.log('Hi, I am belongs to m1.'); });
      const m2 = mitt(m1.all);
      m2.emit('hi') // Hi, I am belongs to m1.
      m2.on('hello', () => { console.log('Hello, I am belongs to m2.'); });
      m1.emit('hello'); // Hello, I am belongs to m2.
      m1.all === m2.all // true
    */
  constructor(all) {
    (0,_Users_zpc_Documents_KQGEOSpace_KQGISClientForVue_node_modules_babel_runtime_helpers_esm_defineProperty_js__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(this, "all", null);

    this.all = all || new Map();
  }
  /**
   * 注册一个命名的事件处理
   * @param type 事件名，官方表示事件名如是 *，用来标记为通用事件，调用任何事件，都会触发命名为 * 的事件
   * @param handler 事件处理函数
   */


  on(type, handler) {
    // 根据type去查找事件
    const handlers = this.all.get(type);

    if (handlers) {
      for (let i = 0; i < handlers.length; i++) {
        // 防止重复监听 事件执行的方法相同时 不添加
        if (handlers[i] === handler) {
          return;
        }
      }

      handlers.push(handler);
    } else {
      this.all.set(type, [handler]);
    }
  }
  /**
   * 只执行一次 就会被移除
   * @param type
   * @param fn
   */


  once(type, fn) {
    const handler = (0,_common_utils_util__WEBPACK_IMPORTED_MODULE_0__.bind)(function () {
      this.off(type, fn);
      this.off(type, handler);
    }, this); // 添加执行事件和移除执行事件的监听

    this.on(type, fn);
    this.on(type, handler);
  }
  /**
   * 移除指定的事件处理
   * @param type 事件名，和第二个参数一起用来移除指定的事件，
   * @param handler 事件处理函数
   */


  off(type, handler) {
    if (!type) {
      this.all.clear();
      return;
    } // 根据type去查找事件


    const handlers = this.all.get(type); // 如果找到则进行删除操作

    if (handlers) {
      // 这里用了个骚操作，其实就是找到了，则删除(多个相同的只会删除找到的第一个)，没找到则不会对原数组有任何影响
      handlers.splice(handlers.indexOf(handler) >>> 0, 1);
    }
  }
  /**
   * 触发所有 type 事件，如果有type为 * 的事件，则最后会执行。
   * @param type 事件名
   * @param evt 传递给处理函数的参数
   */


  fire(type, evt) {
    // 找到type的事件循环执行
    (this.all.get(type) || []).slice().map(handler => {
      handler(evt);
    }); // 然后找到所有为*的事件，循环执行

    (this.all.get("*") || []).slice().map(handler => {
      handler(type, evt);
    });
  }

}

/***/ }),

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

module.exports = require("@zpc_npm/vue-iclient-leaflet");

/***/ }),

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

module.exports = require("@zpc_npm/vue-iclient-leaflet/_types/global-event");

/***/ }),

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

module.exports = require("@zpc_npm/vue-iclient-leaflet/_utils/gis-utils");

/***/ }),

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

module.exports = require("@zpc_npm/vue-iclient-leaflet/_utils/util");

/***/ }),

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

module.exports = require("@zpc_npm/vue-iclient-leaflet/init.js");

/***/ }),

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

module.exports = require("vue");

/***/ }),

/***/ 8270:
/***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": function() { return /* binding */ _defineProperty; }
/* harmony export */ });
function _defineProperty(obj, key, value) {
  if (key in obj) {
    Object.defineProperty(obj, key, {
      value: value,
      enumerable: true,
      configurable: true,
      writable: true
    });
  } else {
    obj[key] = value;
  }

  return obj;
}

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// 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__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
!function() {
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);

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

// EXTERNAL MODULE: external {"root":"Vue","commonjs":"vue","commonjs2":"vue","amd":"vue"}
var external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_ = __webpack_require__(637);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = __webpack_require__(8270);
// EXTERNAL MODULE: ./src/common/_utils/mitt.js
var mitt = __webpack_require__(403);
// EXTERNAL MODULE: external "@zpc_npm/vue-iclient-leaflet/_utils/gis-utils"
var gis_utils_ = __webpack_require__(257);
;// CONCATENATED MODULE: ./src/common/locate/LocateViewModel.js



class LocateViewModel extends mitt/* default */.Z {
  // 存储生成的point layer
  constructor(mapTarget) {
    super();

    (0,defineProperty/* default */.Z)(this, "_props", null);

    (0,defineProperty/* default */.Z)(this, "_locationPoint", null);

    this._props = {
      mapTarget
    };
  }
  /**
   * 定位生成point layer，并返回
   */


  setLocationPoint(coordinate, drawStyle) {
    if (this._locationPoint) {
      this.clearLocationPoint(this._locationPoint);
    }

    gis_utils_.mapDrawUtils.setLocationPoint(this._props.mapTarget, coordinate, drawStyle, _point => {
      this._locationPoint = _point;
    });
  } // 清除定位point layer


  clearLocationPoint() {
    if (this._locationPoint) {
      gis_utils_.mapLayerUtils.removeLayer(this._props.mapTarget, this._locationPoint);
    }

    this.off();
  }

}
// EXTERNAL MODULE: external "@zpc_npm/vue-iclient-leaflet/_utils/util"
var util_ = __webpack_require__(2107);
// EXTERNAL MODULE: external "@zpc_npm/vue-iclient-leaflet"
var vue_iclient_leaflet_ = __webpack_require__(7025);
// EXTERNAL MODULE: external "@zpc_npm/vue-iclient-leaflet/_types/global-event"
var global_event_ = __webpack_require__(4481);
var global_event_default = /*#__PURE__*/__webpack_require__.n(global_event_);
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/dist/index.js??ruleSet[0]!./src/common/locate/Locate.vue?vue&type=script&setup=true&lang=js

const _hoisted_1 = {
  class: "btn-box"
};

const _hoisted_2 = /*#__PURE__*/(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createTextVNode)("定位");

const _hoisted_3 = /*#__PURE__*/(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createTextVNode)("重置");






const __default__ = {
  name: "KqLocate"
};
/* harmony default export */ var Locatevue_type_script_setup_true_lang_js = (/*#__PURE__*/Object.assign(__default__, {
  props: {
    mapTarget: {
      type: String,
      default: null
    },
    showShadow: {
      type: Boolean,
      default: false
    },

    /**
     * 例："center","topLeft","topRight","bottomLeft","bottomRight", "topCenter", "bottomCenter" {top:'16px',left:'16px'}, {top:16,left:16}
     */
    position: [String, Object]
  },

  setup(__props) {
    const props = __props;
    let labels = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.reactive)({
      x: "经度",
      y: "纬度",
      z: "高度",
      xmax: 180,
      xmin: -180,
      ymax: 90,
      ymin: -90
    }); // 校验经纬度

    let rules = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.reactive)({
      x: [{
        required: true,
        message: "请输入经度",
        trigger: "blur"
      }, {
        min: labels.xmin,
        max: labels.xmax,
        message: "请输入正确范围的经度",
        trigger: "blur"
      }],
      y: [{
        required: true,
        message: "请输入经度",
        trigger: "blur"
      }, {
        min: labels.ymin,
        max: labels.ymax,
        message: "请输入正确范围的纬度",
        trigger: "blur"
      }],
      z: [{
        required: true,
        message: "请输入高度",
        trigger: "blur"
      }]
    }); // 逻辑类

    let viewModel = null; // 组件容器

    let box_ref = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(null); // 坐标点

    let coordinate = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.reactive)({
      x: null,
      y: null,
      z: null
    });
    let mapType = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(null);
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.onMounted)(() => {
      (0,util_.updatePosition)(box_ref.value, props);
      viewModel = new LocateViewModel(props.mapTarget);
      mapType.value = global_event_default().getMapTypeByMapTarget();
    });
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.onBeforeUnmount)(() => {
      reset();
      viewModel = null;
    });
    /*
     * 定位方法
     */

    let location = (x, y, z) => {
      const _x = x || coordinate.x;

      const _y = y || coordinate.y;

      const _z = z || coordinate.z;

      if ((!_x || !_y) && mapType.value === "leaflet" || (!_x || !_y || !_z) && mapType.value === "cesium") {
        (0,vue_iclient_leaflet_.KqMessage)({
          message: "坐标信息有误！",
          type: "error"
        });
        return false;
      }

      viewModel.setLocationPoint([_x, _y, _z]);
    };
    /*
     * 重置方法
     */


    let reset = () => {
      viewModel.clearLocationPoint();
      coordinate.x = null;
      coordinate.y = null;
      coordinate.z = null;
    };

    return (_ctx, _cache) => {
      const _component_kq_input_number = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveComponent)("kq-input-number");

      const _component_kq_form_item = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveComponent)("kq-form-item");

      const _component_kq_form = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveComponent)("kq-form");

      const _component_kq_button = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveComponent)("kq-button");

      return (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.openBlock)(), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementBlock)("section", {
        class: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.normalizeClass)(["kq-scale-location", __props.showShadow ? 'shadow' : null]),
        ref_key: "box_ref",
        ref: box_ref
      }, [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_form, {
        model: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(coordinate),
        "label-width": "54px",
        rules: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(rules)
      }, {
        default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_form_item, {
          label: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(labels).x
        }, {
          default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_input_number, {
            modelValue: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(coordinate).x,
            "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(coordinate).x = $event),
            max: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(labels).xmax,
            min: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(labels).xmin
          }, null, 8
          /* PROPS */
          , ["modelValue", "max", "min"])]),
          _: 1
          /* STABLE */

        }, 8
        /* PROPS */
        , ["label"]), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_form_item, {
          label: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(labels).y
        }, {
          default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_input_number, {
            modelValue: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(coordinate).y,
            "onUpdate:modelValue": _cache[1] || (_cache[1] = $event => (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(coordinate).y = $event),
            max: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(labels).ymax,
            min: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(labels).ymin
          }, null, 8
          /* PROPS */
          , ["modelValue", "max", "min"])]),
          _: 1
          /* STABLE */

        }, 8
        /* PROPS */
        , ["label"]), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(mapType) === 'cesium' ? ((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.openBlock)(), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createBlock)(_component_kq_form_item, {
          key: 0,
          label: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(labels).z
        }, {
          default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_input_number, {
            modelValue: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(coordinate).z,
            "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(coordinate).z = $event),
            max: 999
          }, null, 8
          /* PROPS */
          , ["modelValue"])]),
          _: 1
          /* STABLE */

        }, 8
        /* PROPS */
        , ["label"])) : (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createCommentVNode)("v-if", true)]),
        _: 1
        /* STABLE */

      }, 8
      /* PROPS */
      , ["model", "rules"]), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementVNode)("div", _hoisted_1, [(0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_button, {
        type: "primary",
        onClick: _cache[3] || (_cache[3] = () => {
          (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(location)();
        })
      }, {
        default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [_hoisted_2]),
        _: 1
        /* STABLE */

      }), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createVNode)(_component_kq_button, {
        onClick: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(reset)
      }, {
        default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [_hoisted_3]),
        _: 1
        /* STABLE */

      }, 8
      /* PROPS */
      , ["onClick"])])], 2
      /* CLASS */
      );
    };
  }

}));
;// CONCATENATED MODULE: ./src/common/locate/Locate.vue?vue&type=script&setup=true&lang=js
 
;// CONCATENATED MODULE: ./src/common/locate/Locate.vue



const __exports__ = Locatevue_type_script_setup_true_lang_js;

/* harmony default export */ var Locate = (__exports__);
// EXTERNAL MODULE: external "@zpc_npm/vue-iclient-leaflet/init.js"
var init_js_ = __webpack_require__(1396);
var init_js_default = /*#__PURE__*/__webpack_require__.n(init_js_);
;// CONCATENATED MODULE: ./src/common/locate/index.js




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


}();
module.exports = __webpack_exports__;
/******/ })()
;