Variable UNICODE_TABLES_PHPConst
UNICODE_TABLES_PHP: "\n// no eval(): every name here is ours, so nothing collides with an internal function and\n// tests/node/php-fragments.spec.ts can lint the body\n\nuse Symfony\\Polyfill\\Mbstring\\Mbstring;\n\nif (!function_exists('cfw_mb_unicode_data')) {\n\t/**\n\t * The table, or an empty one.\n\t *\n\t * An empty table is not a failure mode, it is the polyfill unchanged: every lookup misses,\n\t * cfw_mb_patch returns its input and both generated patterns come back null, so a site with\n\t * no driver pack answers exactly what it answered before the table existed.\n\t *\n\t * @return array<string, mixed>\n\t * The case, width and lead-byte tables keyed by name.\n\t */\n\tfunction cfw_mb_unicode_data()\n\t{\n\t\tstatic $d = null;\n\t\tif ($d === null) {\n\t\t\t// the harness in scripts/measure/ points this at the sibling checkout; the edge\n\t\t\t// leaves it undefined and takes the mounted path\n\t\t\t$path = defined('CFW_UNICODE_TABLES')\n\t\t\t\t? CFW_UNICODE_TABLES\n\t\t\t\t: '/drupal/modules/custom/drupflare/src/unicode-tables.php';\n\t\t\t$d = is_file($path) ? require $path : null;\n\t\t\tif (!is_array($d)) {\n\t\t\t\t$empty = ['lower' => '', 'upper' => '', 'title' => '', 'fold' => ''];\n\t\t\t\t$d = [\n\t\t\t\t\t'lower' => [],\n\t\t\t\t\t'upper' => [],\n\t\t\t\t\t'title' => [],\n\t\t\t\t\t'fold' => [],\n\t\t\t\t\t'leads' => $empty,\n\t\t\t\t\t'wide' => [],\n\t\t\t\t\t'titleExtra' => [],\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\t\treturn $d;\n\t}\n\n\t/**\n\t * Pre-maps the codepoints the polyfill would answer wrongly, so its own pass then sees a\n\t * character it already agrees with.\n\t *\n\t * Pre and not post: the polyfill's wrong answer is ambiguous -- three characters share one\n\t * stale uppercase -- so a table keyed on its OUTPUT cannot recover the input it came from.\n\t * strpbrk first, because a string carrying none of the keys' lead bytes cannot need the strtr.\n\t *\n\t * @param string $s\n\t * Well-formed UTF-8.\n\t * @param string $which\n\t * lower or upper.\n\t *\n\t * @return string\n\t */\n\tfunction cfw_mb_patch($s, $which)\n\t{\n\t\t$d = cfw_mb_unicode_data();\n\t\tif ($d['leads'][$which] === '' || strpbrk($s, $d['leads'][$which]) === false) {\n\t\t\treturn $s;\n\t\t}\n\t\treturn strtr($s, $d[$which]);\n\t}\n\n\t/**\n\t * The titlecase of a word-initial character, or null where the polyfill is already right.\n\t *\n\t * @param string $ch\n\t * One character.\n\t */\n\tfunction cfw_mb_title_char($ch): ?string\n\t{\n\t\t$d = cfw_mb_unicode_data();\n\t\treturn $d['title'][$ch] ?? null;\n\t}\n\n\t/**\n\t * A length-PRESERVING fold, which is what the case-insensitive searches need.\n\t *\n\t * The polyfill lowercases first, and one codepoint lowercases to two (U+0130 gives i plus a\n\t * combining dot), so every index past it shifts and mb_stripos answers an offset into a\n\t * string the caller never passed.\n\t *\n\t * @param string $s\n\t * Well-formed UTF-8.\n\t *\n\t * @return string\n\t */\n\tfunction cfw_mb_fold_safe($s)\n\t{\n\t\t$d = cfw_mb_unicode_data();\n\t\tif ($d['leads']['fold'] === '' || strpbrk($s, $d['leads']['fold']) === false) {\n\t\t\treturn $s;\n\t\t}\n\t\treturn strtr($s, $d['fold']);\n\t}\n\n\t/**\n\t * East asian width from mbstring's table; null when the pack is absent.\n\t */\n\tfunction cfw_mb_wide_regexp(): ?string\n\t{\n\t\tstatic $re = false;\n\t\tif ($re === false) {\n\t\t\t$w = cfw_mb_unicode_data()['wide'];\n\t\t\t$re = $w === [] ? null : '/[' . implode('', $w) . ']/u';\n\t\t}\n\t\treturn $re;\n\t}\n\n\t/**\n\t * @param string $s\n\t * Well-formed UTF-8.\n\t * @param string $re\n\t * The pattern from cfw_mb_wide_regexp().\n\t */\n\tfunction cfw_mb_width($s, $re): int\n\t{\n\t\t$stripped = preg_replace($re, '', $s, -1, $wide);\n\t\treturn ($wide << 1) + Mbstring::mb_strlen((string) $stripped, 'UTF-8');\n\t}\n\n\t/**\n\t * The class body spliced into the word pattern, empty when the pack is absent.\n\t */\n\tfunction cfw_mb_title_extra(): string\n\t{\n\t\treturn implode('', cfw_mb_unicode_data()['titleExtra']);\n\t}\n}\n"