"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.loadStyle = loadStyle;
exports.styleFormat = styleFormat;
var _amapVector = _interopRequireDefault(require("./amap.vector.json"));
var _amapSatellite = _interopRequireDefault(require("./amap.satellite.json"));
var _types = require("../../types");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const styleMap = {
  [_types.StyleIDs.AmapVector]: _amapVector.default,
  [_types.StyleIDs.AmapSatellite]: _amapSatellite.default,
  [_types.StyleIDs.MapboxVector]: 'mapbox://styles/mapbox/streets-v11',
  [_types.StyleIDs.MapboxSatellite]: 'mapbox://styles/mapbox/satellite-v9'
};
function loadStyle(styleId) {
  if (typeof styleId === 'string') {
    const style = styleMap[styleId];
    if (style) {
      return style;
    }
    // 自定义mapbox://xxx格式底图
    return styleId;
  }
  return styleId;
}

/**
 * 样式解析
 */
function styleFormat(style) {
  const styleContent = loadStyle(style);
  let styleURL, styleJSON;
  if (typeof styleContent === 'object') {
    styleJSON = JSON.stringify(styleContent);
  } else {
    styleURL = styleContent;
  }
  return {
    styleURL,
    styleJSON
  };
}
//# sourceMappingURL=index.js.map