decord/source/13680_UnicodeExtensionComponents.js

72 lines
2.1 KiB
JavaScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 13680
// Function ID: 13681
2026-07-20 16:05:17 +00:00
// Name: UnicodeExtensionComponents
2026-08-24 06:08:38 +00:00
// Dependencies: [13675]
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
// Module 13680 (UnicodeExtensionComponents)
2026-07-23 10:11:24 +00:00
const require = arg1;
const dependencyMap = arg6;
2026-07-20 16:05:17 +00:00
arg5.UnicodeExtensionComponents = function UnicodeExtensionComponents(str) {
2026-07-23 10:11:24 +00:00
let obj;
2026-08-24 06:08:38 +00:00
obj(13675).invariant(str === str.toLowerCase(), "Expected extension to be lowercase");
2026-07-20 16:05:17 +00:00
let num = 3;
2026-08-24 06:08:38 +00:00
obj(13675).invariant("-u-" === str.slice(0, 3), "Expected extension to be a Unicode locale extension");
2026-07-20 16:05:17 +00:00
const attributes = [];
const keywords = [];
if (3 < str.length) {
while (true) {
let index = str.indexOf("-", num);
let tmp4 = num;
2026-07-29 08:29:29 +00:00
let tmp5 = iter;
let tmp6 = -1 === index ? length - num : index - num;
let substr = str.slice(num, num + tmp6);
let tmp8 = obj;
let tmp9 = dependencyMap;
2026-08-24 06:08:38 +00:00
let invariantResult2 = obj(13675).invariant(tmp6 >= 2, "Expected a subtag to have at least 2 characters");
2026-07-20 16:05:17 +00:00
if (undefined === iter) {
2026-07-29 08:29:29 +00:00
if (2 !== tmp6) {
let tmp13 = iter;
2026-07-20 16:05:17 +00:00
if (-1 === attributes.indexOf(substr)) {
let arr = attributes.push(substr);
2026-07-29 08:29:29 +00:00
tmp13 = iter;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
num = num + (tmp6 + 1);
iter = tmp13;
2026-07-20 16:05:17 +00:00
if (num >= length) {
break;
}
}
}
2026-07-29 08:29:29 +00:00
if (2 === tmp6) {
obj = { key: null, value: "" };
obj[0] = substr;
tmp13 = obj;
2026-07-20 16:05:17 +00:00
if (undefined === keywords.find((key) => {
key = undefined;
if (null != obj) {
key = obj.key;
}
return key.key === key;
})) {
arr = keywords.push(obj);
2026-07-29 08:29:29 +00:00
tmp13 = obj;
2026-07-20 16:05:17 +00:00
}
} else {
let value;
if (null != iter) {
value = iter.value;
}
if ("" === value) {
iter.value = substr;
2026-07-29 08:29:29 +00:00
tmp13 = iter;
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
let invariantResult3 = tmp8(13675).invariant(undefined !== iter, "Expected keyword to be defined");
2026-07-29 08:29:29 +00:00
iter.value = `${iter.value}-${tmp7}`;
tmp13 = iter;
2026-07-20 16:05:17 +00:00
}
}
}
}
return { attributes, keywords };
};