
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements.  See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership.  The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License.  You may obtain a copy of the License at
*
*   http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied.  See the License for the
* specific language governing permissions and limitations
* under the License.
*/


/**
 * AUTO-GENERATED FILE. DO NOT MODIFY.
 */

var xCrossMapping = {
  huge: function () {
    return {
      w: 61,
      h: 65
    };
  },
  large: function () {
    return {
      w: 46,
      h: 39
    };
  },
  normal: function () {
    return {
      w: 31,
      h: 27
    };
  },
  small: function () {
    return {
      w: 25,
      h: 21
    };
  },
  tiny: function () {
    return {
      w: 20,
      h: 17
    };
  },
  auto: function (width) {
    return {
      w: width * 0.7,
      h: width * 0.7
    };
  }
};
var shapeXCrossMapping = {
  huge: function () {
    return {
      w: 61,
      h: 65
    };
  },
  large: function () {
    return {
      w: 46,
      h: 39
    };
  },
  normal: function () {
    return {
      w: 27,
      h: 27
    };
  },
  small: function () {
    return {
      w: 18,
      h: 18
    };
  },
  tiny: function () {
    return {
      w: 11,
      h: 11
    };
  },
  auto: function (width) {
    return {
      w: width * 0.7,
      h: width * 0.7
    };
  }
};
var lCrossMapping = {
  huge: function () {
    return {
      w: 60,
      h: 50
    };
  },
  large: function () {
    return {
      w: 46,
      h: 38
    };
  },
  normal: function () {
    return {
      w: 30,
      h: 26
    };
  },
  small: function () {
    return {
      w: 24,
      h: 20
    };
  },
  tiny: function () {
    return {
      w: 18,
      h: 16
    };
  },
  auto: function (width) {
    return {
      w: width * 0.7,
      h: width * 0.7
    };
  }
};
var shapeLCrossMapping = {
  huge: function () {
    return {
      w: 60,
      h: 50
    };
  },
  large: function () {
    return {
      w: 46,
      h: 38
    };
  },
  normal: function () {
    return {
      w: 30,
      h: 26
    };
  },
  small: function () {
    return {
      w: 18,
      h: 18
    };
  },
  tiny: function () {
    return {
      w: 11,
      h: 11
    };
  },
  auto: function (width) {
    return {
      w: width * 0.7,
      h: width * 0.7
    };
  }
};
var triangleMapping = {
  huge: function () {
    return {
      w: 63,
      h: 51
    };
  },
  large: function () {
    return {
      w: 47,
      h: 39
    };
  },
  normal: function () {
    return {
      w: 33,
      h: 26
    };
  },
  small: function () {
    return {
      w: 27,
      h: 21
    };
  },
  tiny: function () {
    return {
      w: 21,
      h: 16
    };
  },
  auto: function (width) {
    // const w = Math.max(Math.floor(width * 0.8), 1)
    return {
      w: width,
      h: Math.max(width - 6, 1)
    };
  }
};
var shapeTriangleMapping = {
  huge: function () {
    return {
      w: 63,
      h: 51
    };
  },
  large: function () {
    return {
      w: 47,
      h: 39
    };
  },
  normal: function () {
    return {
      w: 33,
      h: 26
    };
  },
  small: function () {
    return {
      w: 18,
      h: 18
    };
  },
  tiny: function () {
    return {
      w: 11,
      h: 11
    };
  },
  auto: function (width) {
    // const w = Math.max(Math.floor(width * 0.8), 1)
    return {
      w: width,
      h: Math.max(width - 6, 1)
    };
  }
};
var flagMapping = {
  huge: function () {
    return {
      w: 61,
      h: 57
    };
  },
  large: function () {
    return {
      w: 47,
      h: 43
    };
  },
  normal: function () {
    return {
      w: 31,
      h: 29
    };
  },
  small: function () {
    return {
      w: 25,
      h: 24
    };
  },
  tiny: function () {
    return {
      w: 19,
      h: 18
    };
  },
  auto: function (width) {
    // const w = Math.max(Math.floor(width * 0.8), 1)
    return {
      w: width,
      h: Math.max(width - 2, 1)
    };
  }
};
var shapeFlagMapping = {
  huge: function () {
    return {
      w: 61,
      h: 57
    };
  },
  large: function () {
    return {
      w: 47,
      h: 43
    };
  },
  normal: function () {
    return {
      w: 31,
      h: 29
    };
  },
  small: function () {
    return {
      w: 18,
      h: 19
    };
  },
  tiny: function () {
    return {
      w: 11,
      h: 10
    };
  },
  auto: function (width) {
    // const w = Math.max(Math.floor(width * 0.8), 1)
    return {
      w: width,
      h: Math.max(width - 2, 1)
    };
  }
};
var circleMapping = {
  huge: function () {
    return {
      w: 61,
      h: 61
    };
  },
  large: function () {
    return {
      w: 47,
      h: 47
    };
  },
  normal: function () {
    return {
      w: 31,
      h: 31
    };
  },
  small: function () {
    return {
      w: 25,
      h: 25
    };
  },
  tiny: function () {
    return {
      w: 19,
      h: 19
    };
  },
  auto: function (width) {
    return {
      w: width,
      h: width
    };
  }
};
var shapeCircleMapping = {
  huge: function () {
    return {
      w: 61,
      h: 61
    };
  },
  large: function () {
    return {
      w: 47,
      h: 47
    };
  },
  normal: function () {
    return {
      w: 31,
      h: 31
    };
  },
  small: function () {
    return {
      w: 18,
      h: 18
    };
  },
  tiny: function () {
    return {
      w: 11,
      h: 11
    };
  },
  auto: function (width) {
    return {
      w: width,
      h: width
    };
  }
};
var labelMapping = {
  huge: function () {
    return {
      w: 33,
      h: 28,
      shape: {
        triangleWidth: 16
      }
    };
  },
  large: function () {
    return {
      w: 25,
      h: 21,
      shape: {
        triangleWidth: 12
      }
    };
  },
  normal: function () {
    return {
      w: 17,
      h: 14,
      shape: {
        triangleWidth: 8
      }
    };
  },
  small: function () {
    return {
      w: 13,
      h: 11,
      shape: {
        triangleWidth: 6
      }
    };
  },
  tiny: function () {
    return {
      w: 11,
      h: 9,
      shape: {
        triangleWidth: 5
      }
    };
  },
  auto: function (width) {
    return {
      w: width,
      h: width - 2,
      shape: {
        triangleWidth: Math.min(Math.max(width / 2, 4), 16)
      }
    };
  }
};
var labelAngleMapping = {
  huge: function () {
    return {
      w: 33,
      h: 28,
      shape: {
        offsetY: 22,
        offsetX: 22,
        offsetWidth: 11
      }
    };
  },
  large: function () {
    return {
      w: 25,
      h: 21,
      shape: {
        offsetY: 18,
        offsetX: 18,
        offsetWidth: 9
      }
    };
  },
  normal: function () {
    return {
      w: 17,
      h: 14,
      shape: {
        offsetY: 12,
        offsetX: 12,
        offsetWidth: 6
      }
    };
  },
  small: function () {
    return {
      w: 13,
      h: 11,
      shape: {
        offsetY: 8,
        offsetX: 8,
        offsetWidth: 4
      }
    };
  },
  tiny: function () {
    return {
      w: 11,
      h: 9,
      shape: {
        offsetY: 8,
        offsetX: 8,
        offsetWidth: 4
      }
    };
  },
  auto: function (width) {
    var w = Math.min(Math.max(width / 2, 8), 22);
    return {
      w: width,
      h: width - 2,
      shape: {
        offsetY: w,
        offsetX: w,
        offsetWidth: Math.min(w / 2, 11)
      }
    };
  }
};
var rectMapping = {
  huge: function () {
    return {
      w: 51,
      h: 51
    };
  },
  large: function () {
    return {
      w: 39,
      h: 39
    };
  },
  normal: function () {
    return {
      w: 27,
      h: 27
    };
  },
  small: function () {
    return {
      w: 21,
      h: 21
    };
  },
  tiny: function () {
    return {
      w: 17,
      h: 17
    };
  },
  auto: function (width) {
    return {
      w: width * 0.7,
      h: width * 0.7
    };
  }
};
var shapeRectMapping = {
  huge: function () {
    return {
      w: 51,
      h: 51
    };
  },
  large: function () {
    return {
      w: 39,
      h: 39
    };
  },
  normal: function () {
    return {
      w: 27,
      h: 27
    };
  },
  small: function () {
    return {
      w: 18,
      h: 18
    };
  },
  tiny: function () {
    return {
      w: 11,
      h: 11
    };
  },
  auto: function (width) {
    return {
      w: width * 0.7,
      h: width * 0.7
    };
  }
};
var getArrowShape = function (width, height, baseW) {
  var w = width * 0.6;
  // const baseW = 54;
  var rectHeight = Math.max(Math.floor((baseW - w) / 3), 0);
  return {
    w: w,
    h: height,
    shape: {
      triangleWidth: Math.floor(w / 10 * 3),
      triangleHeight: height - rectHeight
    }
  };
};
var arrowMapping = {
  huge: function (width) {
    return getArrowShape(width, 51, 114);
  },
  large: function (width) {
    return getArrowShape(width, 39, 82);
  },
  normal: function (width) {
    return getArrowShape(width, 28, 54);
  },
  small: function (width) {
    return getArrowShape(width, 21, 34);
  },
  tiny: function (width) {
    return getArrowShape(width, 17, 18);
  },
  auto: function (width) {
    var w = width * 0.6;
    return {
      w: w,
      h: w,
      shape: {
        triangleWidth: Math.floor(w / 10 * 3),
        triangleHeight: w / 2
      }
    };
  }
};
var symbolSizeMapping = {
  xCross: xCrossMapping,
  lCross: lCrossMapping,
  triangle: triangleMapping,
  triangleDown: triangleMapping,
  flag: flagMapping,
  circle: circleMapping,
  labelUp: labelMapping,
  labelDown: labelMapping,
  labelLeft: labelMapping,
  labelRight: labelMapping,
  labelLowerLeft: labelAngleMapping,
  labelLowerRight: labelAngleMapping,
  labelUpperLeft: labelAngleMapping,
  labelUpperRight: labelAngleMapping,
  rect: rectMapping,
  diamond: rectMapping,
  arrowUp: arrowMapping,
  arrowDown: arrowMapping
};
var plotShapeSymbolSizeMapping = {
  xCross: shapeXCrossMapping,
  lCross: shapeLCrossMapping,
  triangle: shapeTriangleMapping,
  triangleDown: shapeTriangleMapping,
  flag: shapeFlagMapping,
  circle: shapeCircleMapping,
  rect: shapeRectMapping,
  diamond: shapeRectMapping,
  arrowUp: arrowMapping,
  arrowDown: arrowMapping,
  labelUp: labelMapping,
  labelDown: labelMapping,
  labelLeft: labelMapping,
  labelRight: labelMapping,
  labelLowerLeft: labelAngleMapping,
  labelLowerRight: labelAngleMapping,
  labelUpperLeft: labelAngleMapping,
  labelUpperRight: labelAngleMapping
};
function getSymbolSize(type, size, width, isShape) {
  var _a;
  if (isShape === void 0) {
    isShape = false;
  }
  var fn = (_a = (isShape ? plotShapeSymbolSizeMapping : symbolSizeMapping)[type]) === null || _a === void 0 ? void 0 : _a[size];
  return fn ? fn(width) : {
    w: 1,
    h: 1
  };
}
var labelFontSizeMapping = {
  huge: 22,
  large: 18,
  normal: 14,
  small: 10,
  tiny: 8
};
function getSymbolLabelFontSize(size, width) {
  var _a;
  if (typeof size === 'number') {
    return size;
  }
  if (size === 'auto' && width) {
    return Math.max(8, width / 2);
  }
  return (_a = labelFontSizeMapping[size]) !== null && _a !== void 0 ? _a : 12;
}
export { getSymbolSize, getSymbolLabelFontSize };