"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.a = exports.always = always;
exports.c = exports.css = css;
exports.m = exports.maybe = maybe;
exports.t = exports.toggle = toggle;
function css() {}
function always() {
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
    args[_key] = arguments[_key];
  }
  return chainify(this, args.join(" "));
}
function maybe(className, enabled) {
  if (!isString(className)) {
    throw new Error("kremling maybe() must be called with a string className and a boolean expression");
  }
  return chainify(this, enabled ? className : "");
}
function toggle(className1, className2, enabled) {
  if (!isString(className1) || !isString(className2)) {
    throw new Error("kremling toggle() must be called with 2 string classNames and a boolean expression");
  }
  return chainify(this, enabled ? className1 : className2);
}
function isString(str) {
  return typeof str === "string" || str instanceof String;
}
function chainify(previousString, newString) {
  var existing = previousString instanceof String ? previousString.toString() : "";
  var str = new String([existing, newString].join(" ").trim());
  str.css = css.bind(str);
  str.c = str.css;
  str.always = always.bind(str);
  str.a = str.always;
  str.maybe = maybe.bind(str);
  str.m = str.maybe;
  str.toggle = toggle.bind(str);
  str.t = str.toggle;
  return str;
}
//# sourceMappingURL=classname-helpers.js.map