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

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


// EXPORTS
__webpack_require__.d(__webpack_exports__, {
  "default": function() { return /* binding */ color_mixColor; }
});

;// CONCATENATED MODULE: external "tinycolor2"
var external_tinycolor2_namespaceObject = require("tinycolor2");
var external_tinycolor2_default = /*#__PURE__*/__webpack_require__.n(external_tinycolor2_namespaceObject);
;// CONCATENATED MODULE: ./src/common/_utils/style/color/mixColor.js


const mixColor = (primaryColor, minColor, weight) => {
  primaryColor = external_tinycolor2_default()(primaryColor).toHexString();
  weight = Math.max(Math.min(Number(weight), 1), 0);
  let r1 = parseInt(primaryColor.substring(1, 3), 16);
  let g1 = parseInt(primaryColor.substring(3, 5), 16);
  let b1 = parseInt(primaryColor.substring(5, 7), 16);
  let r2 = parseInt(minColor.substring(1, 3), 16);
  let g2 = parseInt(minColor.substring(3, 5), 16);
  let b2 = parseInt(minColor.substring(5, 7), 16);
  let r = Math.round(r1 * (1 - weight) + r2 * weight);
  let g = Math.round(g1 * (1 - weight) + g2 * weight);
  let b = Math.round(b1 * (1 - weight) + b2 * weight);
  r = ("0" + (r || 0).toString(16)).slice(-2);
  g = ("0" + (g || 0).toString(16)).slice(-2);
  b = ("0" + (b || 0).toString(16)).slice(-2);
  return "#" + r + g + b;
};

/* harmony default export */ var color_mixColor = (mixColor);

/***/ }),

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

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

/***/ })

/******/ 	});
/************************************************************************/
/******/ 	// 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__, {
  "dealWithTheme": function() { return /* binding */ dealWithTheme; },
  "getPrimarySerialColors": function() { return /* binding */ getPrimarySerialColors; },
  "getRootStyleSelector": function() { return /* binding */ getRootStyleSelector; },
  "toStyleVariable": function() { return /* binding */ toStyleVariable; }
});

// EXTERNAL MODULE: ./src/common/_utils/style/color/mixColor.js + 1 modules
var mixColor = __webpack_require__(5293);
// EXTERNAL MODULE: external "@zpc_npm/vue-iclient-leaflet/_utils/style/theme/theme.json"
var theme_json_ = __webpack_require__(3570);
var theme_json_default = /*#__PURE__*/__webpack_require__.n(theme_json_);
;// CONCATENATED MODULE: external "css-vars-ponyfill"
var external_css_vars_ponyfill_namespaceObject = require("css-vars-ponyfill");
var external_css_vars_ponyfill_default = /*#__PURE__*/__webpack_require__.n(external_css_vars_ponyfill_namespaceObject);
;// CONCATENATED MODULE: ./src/common/_utils/style/color/serialColors.js



const defaultTheme = (theme_json_default()) && (theme_json_default())[0];
const $green = "#67c23a";
const $glod = "#e6a23c";
const $red = "#f56c6c";
const $grey = "#909399";
const $primary = "#409eff";
const $mixWhite = "#ffffff";
const $mixBlack = "#000000";
const elPrimaryColor = $primary;
const isBrowser = typeof window !== "undefined";
const isNativeSupport = isBrowser && window.CSS && window.CSS.supports && window.CSS.supports("(--a: 0)"); // 生成系列主题色

function getPrimarySerialColors(nextThemeInfo) {
  const series = [];
  const nextThemeStyle = nextThemeInfo;
  let prevPrimaryColor;

  if (nextThemeStyle && nextThemeStyle.primaryColor) {
    prevPrimaryColor = nextThemeStyle.primaryColor;
  }

  const acceptColor = prevPrimaryColor || elPrimaryColor;

  if (nextThemeStyle.style === "dark") {
    for (let i = 1; i < 10; i += 1) {
      series.push((0,mixColor["default"])(acceptColor, $mixBlack, i * 0.08));
    }
  } else {
    for (let i = 1; i < 10; i += 1) {
      series.push((0,mixColor["default"])(acceptColor, $mixWhite, i * 0.1));
    }
  }

  return series;
}
function dealWithTheme(nextThemeStyle) {
  const currentThemeStyle = nextThemeStyle.style || "light";
  const currentTheme = theme_json_default().find(item => item.label === currentThemeStyle); // 合并 defaultTheme 是因为可能其他 theme 没有完整的参数，如 disableColor

  const serialColorsReplacer = getPrimarySerialColors(Object.assign({
    primaryColor: currentTheme && currentTheme.primaryColor
  }, nextThemeStyle));
  const themeStyleData = Object.assign({}, defaultTheme, currentTheme, nextThemeStyle);
  const nextThemeData = {
    themeStyle: themeStyleData,
    primarySerialColors: serialColorsReplacer
  };
  setRootStyle(nextThemeData);
  return nextThemeData;
}
function toStyleVariable(variable) {
  return `--kq-${variable.replace(/[A-Z]/g, "-$&").toLowerCase()}`;
}
function getRootStyleSelector(themeStyle) {
  return themeStyle.styleConfig?.className && isNativeSupport ? `.${themeStyle.styleConfig.className}` : ":root";
}

function setRootStyle(themeData) {
  const {
    themeStyle,
    primarySerialColors
  } = themeData;
  const primaryColor = themeStyle.primaryColor;
  const variables = {
    "color-scheme": `${themeStyle.style}`,
    "--kq-color-primary": `${primaryColor} !important`,
    "--kq-bg-color-overlay": `${themeStyle.bgColor} !important`,
    "--kq-bg-color": `${themeStyle.bgColor} !important`,
    "--kq-text-color-regular": `${themeStyle.textColor} !important`,
    "--kq-fill-color-blank": `${themeStyle.bgColor} !important`,
    // "--kq-text-color-primary": `${themeStyle.textColor} !important`,
    "--kq-sub-bg-color": `${themeStyle.subBgColor} !important`,
    "--kq-fill-color-light": `${themeStyle.subBgColor} !important`,
    "--kq-map-bg-color": `rgb(221,221,221)`
  };

  if (themeStyle.style === "dark") {
    variables["--kq-header-bg-color"] = `${themeStyle.bgColor} !important`;
    variables["--kq-header-border-color"] = `${themeStyle.borderColor} !important`;
    variables["--kq-map-bg-color"] = `#000`;
    document.querySelector("html").setAttribute("class", "dark");
  } else {
    variables["--kq-header-bg-color"] = `${primaryColor} !important`;
    variables["--kq-header-border-color"] = `${themeStyle.bgColor} !important`;
  }

  primarySerialColors.forEach((color, index) => {
    const varKey = `--kq-color-primary-light-${index + 1}`;
    variables[varKey] = `${color} !important`;
  });
  variables["--kq-color-primary-dark-2"] = `${(0,mixColor["default"])(primaryColor, $mixBlack, 0.1)} !important`;
  const rootStyleSelector = getRootStyleSelector(themeStyle);
  const elStyleId = themeStyle.styleConfig?.id || "kq-component-style";
  const rootStyle = `${rootStyleSelector} ${JSON.stringify(variables, null, 2).replace(/(:.+),/g, "$1;").replace(/"/g, "")}`;
  let elStyleTag = document.getElementById(elStyleId);

  if (!elStyleTag) {
    elStyleTag = document.createElement("style");
    elStyleTag.setAttribute("id", elStyleId);
    elStyleTag.setAttribute("type", "text/css");
    document.head.insertBefore(elStyleTag, document.head.lastChild);
  }

  const defaultInclude = "style#kq-component-style, link[href*=vue-iclient-mapboxgl]";
  const options = {
    include: themeStyle.styleConfig?.include || defaultInclude,
    silent: true,
    onlyLegacy: true,
    variables: {},
    watch: false
  };

  if (!isNativeSupport) {
    options.onlyLegacy = false;
    options.watch = true;
    options.variables = variables;
  }

  external_css_vars_ponyfill_default()(options);
  elStyleTag.innerHTML = rootStyle;
}
}();
module.exports = __webpack_exports__;
/******/ })()
;