// Module ID: 13227 // Function ID: 101838 // Name: isMatched // Dependencies: [13228, 1257, 13229] // Module 13227 (isMatched) const require = arg1; const dependencyMap = arg6; function isMatched(region, str) { const parts = str.split("-"); const first = parts[0]; if (parts[2]) { if ("$" === arr[0]) { const slice = arr.slice; if ("!" !== arr[1]) { let arr2 = arg2[slice(arr, 1)]; } else { arr2 = arg2[slice(arr, 2)]; } const mapped = arr2.map((arg0) => { let tmp = outer1_0(outer1_1[2]).regions[arg0]; if (!tmp) { const items = [arg0]; tmp = items; } return tmp; }); const reduced = mapped.reduce((items, items) => { const obj = outer1_0(outer1_1[1]); return obj.__spreadArray(outer1_0(outer1_1[1]).__spreadArray([], items, true), items, true); }, []); let str4 = region.region; if (!str4) { str4 = ""; } let tmp4 = reduced.indexOf(str4) > -1 === tmp6; } if (tmp4) { let tmp7 = !region.script; if (!tmp7) { tmp7 = "*" === tmp3 || tmp3 === region.script; const tmp8 = "*" === tmp3 || tmp3 === region.script; } tmp4 = tmp7; } if (tmp4) { let tmp9 = !region.language; if (!tmp9) { tmp9 = "*" === first || first === region.language; const tmp10 = "*" === first || first === region.language; } tmp4 = tmp9; } return tmp4; } tmp4 = !region.region; if (!tmp4) { tmp4 = "*" === arr || arr === region.region; const tmp5 = "*" === arr || arr === region.region; } } function serializeLSR(arg0) { const items = [, , ]; ({ language: arr[0], script: arr[1], region: arr[2] } = arg0); const found = items.filter(Boolean); return found.join("-"); } function findMatchingDistanceForLSR(arg0, arg1, matches) { let tmp; matches = matches.matches; let num = 0; if (0 < matches.length) { while (true) { tmp = matches[num]; let tmp2 = isMatched; let tmp3 = isMatched(arg0, tmp.desired, matches.matchVariables); if (tmp3) { let tmp4 = isMatched; tmp3 = isMatched(arg1, tmp.supported, matches.matchVariables); } let tmp5 = tmp.oneway || tmp3; if (!tmp5) { let tmp6 = isMatched; let tmp7 = isMatched(arg0, tmp.supported, matches.matchVariables); if (tmp7) { let tmp8 = isMatched; tmp7 = isMatched(arg1, tmp.desired, matches.matchVariables); } tmp3 = tmp7; } if (tmp3) { break; } else { num = num + 1; } } const result = 10 * tmp.distance; const paradigmLocales = matches.paradigmLocales; const paradigmLocales1 = matches.paradigmLocales; let diff = result; if (tmp12 !== paradigmLocales1.indexOf(serializeLSR(arg1)) > -1) { diff = result - 1; } return diff; } const error = new Error("No matching distance found"); throw error; } function findMatchingDistance(arg0, arg1) { let locale = new Intl.Locale(arg0); const maximizeResult = locale.maximize(); const locale1 = new Intl.Locale(arg1); const maximizeResult1 = locale1.maximize(); let obj = { language: maximizeResult.language, script: tmp3, region: tmp4 }; obj = { language: maximizeResult1.language, script: tmp5, region: tmp6 }; const tmp7 = (function processData() { if (!outer1_2) { let first = outer1_0(outer1_1[0]).data.supplemental.languageMatching["written-new"][0]; let paradigmLocales; if (null !== first) { if (undefined !== first) { paradigmLocales = first.paradigmLocales; } } let parts; if (null !== paradigmLocales) { if (undefined !== paradigmLocales) { parts = paradigmLocales._locales.split(" "); const str = paradigmLocales._locales; } } const prop = outer1_0(outer1_1[0]).data.supplemental.languageMatching["written-new"]; let substr = prop.slice(1, 5); const prop1 = outer1_0(outer1_1[0]).data.supplemental.languageMatching["written-new"]; const substr1 = prop1.slice(5); const obj = { matches: substr1.map((arg0) => { const first = Object.keys(arg0)[0]; return { supported: first, desired: arg0[first]._desired, distance: +arg0[first]._distance, oneway: "true" === arg0[first].oneway }; }, {}), matchVariables: substr.reduce((arg0, arg1) => { const first = Object.keys(arg1)[0]; const substr = first.slice(1); arg0[substr] = arg1[first]._value.split("+"); return arg0; }, {}) }; const obj2 = outer1_0(outer1_1[1]); const obj3 = outer1_0(outer1_1[1]); obj.paradigmLocales = obj2.__spreadArray(outer1_0(outer1_1[1]).__spreadArray([], parts, true), parts.map((str) => { const locale = new Intl.Locale(str.replace(/_/g, "-")); return locale.maximize().toString(); }), true); outer1_2 = obj; const __spreadArrayResult = outer1_0(outer1_1[1]).__spreadArray([], parts, true); } return outer1_2; })(); let num = 0; if (obj.language !== obj.language) { const obj1 = { language: maximizeResult.language, script: "", region: "" }; let obj2 = { language: maximizeResult1.language, script: "", region: "" }; num = findMatchingDistanceForLSR(obj1, obj2, tmp7); } let sum = num; if (obj.script !== obj.script) { let obj3 = { language: maximizeResult.language, script: obj.script, region: "" }; const obj4 = { language: maximizeResult1.language, script: obj.script, region: "" }; sum = num + findMatchingDistanceForLSR(obj3, obj4, tmp7); } let sum1 = sum; if (obj.region !== obj.region) { sum1 = sum + findMatchingDistanceForLSR(obj, obj, tmp7); } return sum1; } arg5.UNICODE_EXTENSION_SEQUENCE_REGEX = undefined; arg5.invariant = function invariant(arg0, arg1, arg2) { let _Error = arg2; if (undefined === arg2) { _Error = Error; } if (!arg0) { const prototype = _Error.prototype; _Error = new _Error(arg1); throw _Error; } }; arg5.findMatchingDistance = findMatchingDistance; arg5.findBestMatch = function findBestMatch(arr) { let tmp = arg2; let closure_0 = arg1; if (undefined === arg2) { tmp = c3; } const Infinity = Infinity; const obj = { matchedDesiredLocale: "", distances: {} }; let item = arr.forEach((arg0, arg1) => { let closure_0 = arg0; let closure_1 = arg1; if (!obj.distances[arg0]) { obj.distances[arg0] = {}; } const item = closure_0.forEach((matchedSupportedLocale) => { const sum = outer2_7(closure_0, matchedSupportedLocale) + 40 * closure_1; outer1_2.distances[closure_0][matchedSupportedLocale] = sum; if (sum < closure_1) { closure_1 = sum; outer1_2.matchedDesiredLocale = closure_0; outer1_2.matchedSupportedLocale = matchedSupportedLocale; } }); }); if (Infinity >= tmp) { obj.matchedDesiredLocale = undefined; obj.matchedSupportedLocale = undefined; } return obj; }; arg5.UNICODE_EXTENSION_SEQUENCE_REGEX = /-u(?:-[0-9a-z]{2,8})+/gi; let c3 = 838;