import { d as defineDataProperty } from "../define-data-property/index.js";
import { h as hasPropertyDescriptors_1 } from "../has-property-descriptors/index.js";
import { f as functionsHaveNames_1 } from "../functions-have-names/index.js";
import { t as type } from "../es-errors/type.js";
var define = defineDataProperty;
var hasDescriptors = hasPropertyDescriptors_1();
var functionsHaveConfigurableNames = functionsHaveNames_1.functionsHaveConfigurableNames();
var $TypeError = type;
var setFunctionName = function setFunctionName2(fn, name) {
  if (typeof fn !== "function") {
    throw new $TypeError("`fn` is not a function");
  }
  var loose = arguments.length > 2 && !!arguments[2];
  if (!loose || functionsHaveConfigurableNames) {
    if (hasDescriptors) {
      define(
        /** @type {Parameters<define>[0]} */
        fn,
        "name",
        name,
        true,
        true
      );
    } else {
      define(
        /** @type {Parameters<define>[0]} */
        fn,
        "name",
        name
      );
    }
  }
  return fn;
};
export {
  setFunctionName as s
};
//# sourceMappingURL=index.js.map
