"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const isCssVariable = require("./dist-es-render-dom-utils-is-css-variable.cjs");
const getAsType = require("./dist-es-render-dom-value-types-get-as-type.cjs");
const number = require("./dist-es-render-dom-value-types-number.cjs");
const buildTransform = require("./dist-es-render-html-utils-build-transform.cjs");
const keysTransform = require("./dist-es-render-html-utils-keys-transform.cjs");
function buildHTMLStyles(state, latestValues, transformTemplate) {
  const { style, vars, transformOrigin } = state;
  let hasTransform = false;
  let hasTransformOrigin = false;
  for (const key in latestValues) {
    const value = latestValues[key];
    if (keysTransform.transformProps.has(key)) {
      hasTransform = true;
      continue;
    } else if (isCssVariable.isCSSVariableName(key)) {
      vars[key] = value;
      continue;
    } else {
      const valueAsType = getAsType.getValueAsType(value, number.numberValueTypes[key]);
      if (key.startsWith("origin")) {
        hasTransformOrigin = true;
        transformOrigin[key] = valueAsType;
      } else {
        style[key] = valueAsType;
      }
    }
  }
  if (!latestValues.transform) {
    if (hasTransform || transformTemplate) {
      style.transform = buildTransform.buildTransform(latestValues, state.transform, transformTemplate);
    } else if (style.transform) {
      style.transform = "none";
    }
  }
  if (hasTransformOrigin) {
    const { originX = "50%", originY = "50%", originZ = 0 } = transformOrigin;
    style.transformOrigin = `${originX} ${originY} ${originZ}`;
  }
}
exports.buildHTMLStyles = buildHTMLStyles;
//# sourceMappingURL=dist-es-render-html-utils-build-styles.cjs.map
