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

// 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/roller/RollerViewModel.js


class RollerViewModel 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
    });
  }
  /**
   * 生成卷帘
   * @param {Object} layer - 选中需要卷帘的图层，不传时会清除卷帘
   */


  initRoller(layer) {
    this.webMap.initRoller(layer);
  }

  destroy() {
    this.off();
  }

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





const __default__ = {
  name: "Kq2dRoller"
};
/* harmony default export */ var Rollervue_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]
  },

  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;
    (0,external_root_Vue_commonjs_vue_commonjs2_vue_amd_vue_.onMounted)(() => {
      (0,util_.updatePosition)(box_ref.value, props);
      viewModel = new RollerViewModel(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) {
            resetRoller();
          }
        }
      });
    });
    (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);
      viewModel.initRoller(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;
      viewModel.initRoller(selectedLayer);
    }; // 清除卷帘


    const clear = () => {
      resetRoller();
      viewModel.destroy();
    }; // 重置卷帘


    const resetRoller = () => {
      viewModel.initRoller();
      selectedLayer = null;
      defaultSelected.value = 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-roller", __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/roller/Roller.vue?vue&type=script&setup=true&lang=js
 
;// CONCATENATED MODULE: ./src/leaflet/roller/Roller.vue



const __exports__ = Rollervue_type_script_setup_true_lang_js;

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




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


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