<?php // Generated by CuyZ\Valinor\Cache\FileSystemCache
return fn (array $transformers, CuyZ\Valinor\Normalizer\Transformer\Transformer $delegate) => new class ($transformers, $delegate) implements CuyZ\Valinor\Normalizer\Transformer\Transformer {
    private array $transformers;

    private CuyZ\Valinor\Normalizer\Transformer\Transformer $delegate;

    public function __construct(array $transformers, CuyZ\Valinor\Normalizer\Transformer\Transformer $delegate)
    {
        $this->transformers = $transformers;
        $this->delegate = $delegate;
    }

    public function transform(mixed $value): mixed
    {
        $references = new WeakMap();
        return $this->transform_iterable_string_3be84d23fb1096447c64fce6e12d003c($value, $references);
    }

    private function transform_string_a745897c0704318aa48e8aa8d29ba050aa7eda39(mixed $value, WeakMap $references): mixed
    {
        $next = fn () => $value;
        if (\is_string($value)) {
            $next = fn () => $this->transformers[0]($value, $next);
        }
        return $next();
    }

    private function transform_mixed(mixed $value, WeakMap $references): mixed
    {
        if (\is_bool($value)) {
            return $this->transform_bool_3494e1ad6e91e19ca64e1721b4704117a79a89b4($value, $references);
        }
        if (\is_float($value)) {
            return $this->transform_float_f955a18c8f02bd0e5051c1b81dca3f2e79c2e742($value, $references);
        }
        if (\is_int($value)) {
            return $this->transform_int_7d969c7b7ba92fad2e4f0f0020f349a7577c7f13($value, $references);
        }
        if (\is_string($value)) {
            return $this->transform_string_a745897c0704318aa48e8aa8d29ba050aa7eda39($value, $references);
        }
        if ($value === NULL) {
            return NULL;
        }
        if ($value instanceof UnitEnum) {
            return $value instanceof BackedEnum ? $value->value : $value->name;
        }
        if ($value instanceof DateTime) {
            return $value->format('Y-m-d\\TH:i:s.uP');
        }
        if ($value instanceof DateTimeZone) {
            return $value->getName();
        }
        if (\is_iterable($value) && ! $value instanceof Generator) {
            return $this->transform_iterable_mixed_070660c7e72aa3e14a93c1039279afb6($value, $references);
        }
        return $this->delegate->transform($value);
    }

    private function transform_bool_3494e1ad6e91e19ca64e1721b4704117a79a89b4(mixed $value, WeakMap $references): mixed
    {
        $next = fn () => $value;
        if (\is_bool($value)) {
            $next = fn () => $this->transformers[3]($value, $next);
        }
        return $next();
    }

    private function transform_float_f955a18c8f02bd0e5051c1b81dca3f2e79c2e742(mixed $value, WeakMap $references): mixed
    {
        $next = fn () => $value;
        if (\is_float($value)) {
            $next = fn () => $this->transformers[2]($value, $next);
        }
        return $next();
    }

    private function transform_int_7d969c7b7ba92fad2e4f0f0020f349a7577c7f13(mixed $value, WeakMap $references): mixed
    {
        $next = fn () => $value;
        if (\is_int($value)) {
            $next = fn () => $this->transformers[1]($value, $next);
        }
        return $next();
    }

    private function transform_iterable_mixed_070660c7e72aa3e14a93c1039279afb6(iterable $value, WeakMap $references): iterable
    {
        if (\is_array($value)) {
            return \array_map(fn (mixed $item) => $this->transform_mixed($item, $references), $value);
        }
        return (function () use ($value, $references) {
            foreach ($value as $key => $item) {
                yield $key => $this->transform_mixed($item, $references);
            }
        })();
    }

    private function transform_unsure_string_3be84d23fb1096447c64fce6e12d003c(mixed $value, WeakMap $references): mixed
    {
        if (! (\is_string($value))) {
            return $this->transform_mixed($value, $references);
        }
        return $this->transform_string_a745897c0704318aa48e8aa8d29ba050aa7eda39($value, $references);
    }

    private function transform_iterable_string_3be84d23fb1096447c64fce6e12d003c(iterable $value, WeakMap $references): iterable
    {
        if (\is_array($value)) {
            return \array_map(fn (mixed $item) => $this->transform_unsure_string_3be84d23fb1096447c64fce6e12d003c($item, $references), $value);
        }
        return (function () use ($value, $references) {
            foreach ($value as $key => $item) {
                yield $key => $this->transform_unsure_string_3be84d23fb1096447c64fce6e12d003c($item, $references);
            }
        })();
    }
};
