@function each-negative-margin($spacer-config) {
  @each $key, $spacer in $spacer-config {
    $spacer-config: map.set($spacer-config, $key, -$spacer);
  }
  @return $spacer-config;
}

$utilities: map-merge(
  $utilities,
  (
    "inset": (
      property: top bottom left right,
      class: inset,
      variants: inset,
      values:
        map-merge(
          $spacer-config,
          (
            "0": 0px,
            "auto": auto,
          )
        ),
    ),
    "negative-inset": (
      property: top bottom left right,
      class: -inset,
      variants: inset,
      values:
        each-negative-margin(
          map-merge(
            $spacer-config,
            (
              "0": 0px,
              "auto": auto,
            )
          )
        ),
    ),
    "inset-x": (
      property: left right,
      class: inset-x,
      variants: inset,
      values:
        map-merge(
          $spacer-config,
          (
            "0": 0px,
            "auto": auto,
          )
        ),
    ),
    "negative-inset-x": (
      property: left right,
      class: -inset-x,
      variants: inset,
      values:
        each-negative-margin(
          map-merge(
            $spacer-config,
            (
              "0": 0px,
              "auto": auto,
            )
          )
        ),
    ),
    "inset-y": (
      property: top bottom,
      class: inset-y,
      variants: inset,
      values:
        map-merge(
          $spacer-config,
          (
            "0": 0px,
            "auto": auto,
          )
        ),
    ),
    "negative-inset-y": (
      property: top bottom,
      class: -inset-y,
      variants: inset,
      values:
        each-negative-margin(
          map-merge(
            $spacer-config,
            (
              "0": 0px,
              "auto": auto,
            )
          )
        ),
    ),
  )
);
