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

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

module.exports = require("xe-utils");

/***/ }),

/***/ 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__, {
  "FilterDetailViewModel": function() { return /* reexport */ FilterDetailViewModel; },
  "default": function() { return /* reexport */ FilterDetail; }
});

// 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: external "xe-utils"
var external_xe_utils_ = __webpack_require__(6869);
var external_xe_utils_default = /*#__PURE__*/__webpack_require__.n(external_xe_utils_);
// EXTERNAL MODULE: external "@zpc_npm/vue-iclient-leaflet/_utils/util"
var util_ = __webpack_require__(2107);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = __webpack_require__(8270);
// EXTERNAL MODULE: external "@zpc_npm/vue-iclient-leaflet/_utils/gis-utils"
var gis_utils_ = __webpack_require__(257);
;// CONCATENATED MODULE: ./src/leaflet/filterdetail/FilterDetailViewModel.js


class FilterDetailViewModel extends L.Evented {
  constructor(mapTarget) {
    super();

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

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

    this._props = {
      mapTarget
    }; // 事件绑定this;

    this._loadedAsync = this._loadedAsync.bind(this);
    this._loadedSync = this._loadedSync.bind(this);
    this._updateLayerData = this._updateLayerData.bind(this);
    this.setLayerData = this.setLayerData.bind(this);

    this._registerEvents();
  }

  _registerEvents() {
    // 监听地图初始化完成事件
    // 异步
    gis_utils_.mapViewUtils.bindViewEvents("mounted", this._loadedAsync, this._props.mapTarget);
    gis_utils_.mapViewUtils.bindViewEvents("resetLayerDatas", this._updateLayerData, this._props.mapTarget); // 同步

    gis_utils_.utils.getWebMap(this._props.mapTarget, this._loadedSync);
  } // 图层监听事件


  _loadedAsync(e) {
    // 如果图层变化事件是自己触发的 则不继续执行 避免死循环
    if (e.eventTarget && e.eventTarget === this) {
      return;
    }

    this.webMap = e.target;
    this.setLayerData();
  }

  _loadedSync(e) {
    this.webMap = e;
    this.setLayerData();
  } // 设置图层树


  setLayerData() {
    let maplayers = gis_utils_.mapLayerUtils.getLayerCheckedList(this._props.mapTarget);

    if (maplayers && maplayers.length > 0) {
      this.fire("setData", {
        maplayers
      });
      return {
        maplayers
      };
    }
  } // 更新图层树


  _updateLayerData() {
    let maplayers = gis_utils_.mapLayerUtils.getLayerCheckedList(this._props.mapTarget);
    this.fire("updateData", {
      maplayers
    });
  }

  destroy() {
    this.off();
  }

}
;// CONCATENATED MODULE: ./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/dist/index.js??ruleSet[0]!./src/leaflet/filterdetail/FilterDetail.vue?vue&type=script&setup=true&lang=js





const __default__ = {
  name: "Kq2dFilterDetail"
};
/* harmony default export */ var FilterDetailvue_type_script_setup_true_lang_js = (/*#__PURE__*/Object.assign(__default__, {
  props: {
    // 每个地图相关组件的必须参数 非必传 指定组件绑定的map对象的div的id
    mapTarget: String,
    // 是否显示阴影
    showShadow: {
      type: Boolean,
      default: false
    },

    /**
     * 例："center","topLeft","topRight","bottomLeft","bottomRight", "topCenter", "bottomCenter" {top:'16px',left:'16px'}, {top:16,left:16}
     */
    position: [String, Object],
    // 放大镜的半径，以像素为单位
    radius: {
      type: Number,
      default: 100
    },
    // 主地图缩放和放大镜之间的缩放级别偏移
    zoomOffset: {
      type: Number,
      default: 3
    },
    // 如果不同于-1，则定义始终在放大镜中使用的固定缩放级别，忽略主地图缩放和zoomOffet值。
    fixedZoom: {
      type: Number,
      default: -1
    },
    // 如果true，放大镜将停留在地图上的同一位置，而不是跟随鼠标光标。
    fixedPosition: {
      type: Boolean,
      default: false
    },
    latLng: {
      type: Array,
      default: null
    }
  },

  setup(__props, {
    expose
  }) {
    const props = __props; //  图层数据源

    let layers = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.reactive)({
      data: []
    }); // 默认值

    let defaultSelected = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(""); // 逻辑类

    let viewModel = null; // 组件容器

    let box_ref = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.ref)(null); // 选择的图层

    let selectedLayer = null; // 生成的滤镜图层

    let magnifyingGlassLayer = null;
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.onMounted)(() => {
      (0,util_.updatePosition)(box_ref.value, props);
      viewModel = new FilterDetailViewModel(props.mapTarget); // 获取图层树数据

      const maplayersData = viewModel.setLayerData();

      if (maplayersData && maplayersData.maplayers && maplayersData.maplayers.length) {
        setLayer(maplayersData.maplayers);
      } else {
        viewModel.on("setData", _data => {
          setLayer(_data.maplayers);
        });
      } // 更新图层数据


      viewModel.on("updateData", _data => {
        layers.data = _data.maplayers;

        if (selectedLayer) {
          var result = external_xe_utils_default().find(layers.data, item => item.guid === selectedLayer.guid);

          if (!result) {
            resetFilterLayer();
            selectedLayer = null;
            defaultSelected.value = null;
          }
        }
      });
    });
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.onBeforeUnmount)(() => {
      clear();
      viewModel = null;
    });

    const onChangeSelect = val => {
      selectedLayer = external_xe_utils_default().find(layers.data, item => item.guid === val);
      filter(selectedLayer);
    };

    const setLayer = maplayers => {
      layers.data = maplayers;

      if (maplayers.length === 0) {
        defaultSelected.value = "";
        return;
      }
    };

    const start = layer => {
      if (!layer) {
        if (!selectedLayer) {
          layer = layers.data[0];
        } else {
          layer = selectedLayer;
        }
      }

      defaultSelected.value = layer.guid;
      selectedLayer = layer;
      filter(selectedLayer);
    };
    /**
     * 清除滤镜
     */


    const clear = () => {
      resetFilterLayer();
      viewModel.destroy();
      selectedLayer = null;
      defaultSelected.value = null;
    };
    /**
     * 生成滤镜
     */


    const filter = layer => {
      resetFilterLayer();
      const {
        radius,
        zoomOffset,
        fixedZoom,
        fixedPosition,
        latLng
      } = props;
      const result = viewModel.webMap.createFilter({
        layers: [layer],
        radius,
        zoomOffset,
        fixedZoom,
        fixedPosition,
        latLng: latLng ? latLng : null
      });
      magnifyingGlassLayer = result.magnifyingGlassLayer;
    };
    /**
     * 重置滤镜图层
     */


    const resetFilterLayer = () => {
      if (magnifyingGlassLayer) {
        viewModel.webMap.clearFilter(magnifyingGlassLayer);
        magnifyingGlassLayer = null;
      }
    };

    expose({
      start,
      clear
    });
    return (_ctx, _cache) => {
      const _component_kq_option = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveComponent)("kq-option");

      const _component_kq_select = (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.resolveComponent)("kq-select");

      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");

      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-2d-filter-detail", __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, {
        "label-width": "84px",
        "label-position": "left"
      }, {
        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: "请选择图层"
        }, {
          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_select, {
            modelValue: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(defaultSelected),
            "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.isRef)(defaultSelected) ? defaultSelected.value = $event : defaultSelected = $event),
            onChange: onChangeSelect,
            placeholder: "请选择..."
          }, {
            default: (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.withCtx)(() => [((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.openBlock)(true), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createElementBlock)(external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.Fragment, null, (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.renderList)((0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.unref)(layers).data, item => {
              return (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.openBlock)(), (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.createBlock)(_component_kq_option, {
                label: item.name,
                value: item.guid,
                key: item.guid
              }, null, 8
              /* PROPS */
              , ["label", "value"]);
            }), 128
            /* KEYED_FRAGMENT */
            ))]),
            _: 1
            /* STABLE */

          }, 8
          /* PROPS */
          , ["modelValue"])]),
          _: 1
          /* STABLE */

        })]),
        _: 1
        /* STABLE */

      })], 2
      /* CLASS */
      );
    };
  }

}));
;// CONCATENATED MODULE: ./src/leaflet/filterdetail/FilterDetail.vue?vue&type=script&setup=true&lang=js
 
;// CONCATENATED MODULE: ./src/leaflet/filterdetail/FilterDetail.vue



const __exports__ = FilterDetailvue_type_script_setup_true_lang_js;

/* harmony default export */ var FilterDetail = (__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/leaflet/filterdetail/index.js




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


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