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C,EAA6E,QAA7E,EAA8G,kBAAA,GAAoC,CAAC,KAAD,EAAQ,KAAR,EAAe,MAAf,CAAlJ,EAAwK;AAC7K,QAAM,aAAa,GAAkB,EAArC;;AACA,OAAK,MAAM,IAAX,IAAmB,CAAC,SAAD,EAAY,MAAZ,CAAnB,EAAwC;AACtC,SAAK,MAAM,GAAX,IAAkB,kBAAlB,EAAsC;AACpC,MAAA,aAAa,CAAC,IAAd,CAAmB,GAAG,IAAI,IAAI,GAAG,EAAjC;AACA,MAAA,aAAa,CAAC,IAAd,CAAmB,GAAG,IAAI,CAAC,WAAL,EAAkB,IAAI,GAAG,EAA/C;AACA,MAAA,aAAa,CAAC,IAAd,CAAmB,GAAG,IAAI,IAAI,GAAG,CAAC,WAAJ,EAAiB,EAA/C;AACA,MAAA,aAAa,CAAC,IAAd,CAAmB,GAAG,IAAI,CAAC,WAAL,EAAkB,IAAI,GAAG,CAAC,WAAJ,EAAiB,EAA7D;AACD;AACF;;AAED,SAAO,MAAM,QAAQ,CAAC,WAAT,CAAqB,MAArB,EAA6B,GAAG,aAAhC,CAAb;AACD;;AAEM,eAAe,eAAf,CAA+B,QAA/B,EAA8D;AACnE,SAAO,gBAAgB,CAAC,CAAC,MAAM,QAAQ,CAAC,YAAhB,EACrB,MADqB,CACd,EAAE,IAAG;AACX,UAAM,IAAI,GAAG,EAAE,CAAC,WAAH,EAAb;AACA,WAAO,CAAC,IAAI,CAAC,UAAL,CAAgB,UAAhB,KAA+B,IAAI,CAAC,UAAL,CAAgB,OAAhB,CAAhC,MAA8D,IAAI,CAAC,QAAL,CAAc,MAAd,KAAyB,IAAI,CAAC,QAAL,CAAc,MAAd,CAAvF,CAAP;AACD,GAJqB,CAAD,EAIjB,QAJiB,CAAvB;AAKD,C","sourcesContent":["import * as path from \"path\"\nimport { langIdToName, toLangWithRegion } from \"./langs\"\nimport { PlatformPackager } from \"../platformPackager\"\n\nexport function getLicenseAssets(fileNames: Array<string>, packager: PlatformPackager<any>) {\n return fileNames.sort((a, b) => {\n const aW = a.includes(\"_en\") ? 0 : 100\n const bW = b.includes(\"_en\") ? 0 : 100\n return aW === bW ? a.localeCompare(b) : aW - bW\n })\n .map(file => {\n let lang = file.match(/_([^.]+)\\./)![1]\n let langWithRegion\n if (lang.includes(\"_\")) {\n langWithRegion = lang\n lang = langWithRegion.substring(0, lang.indexOf(\"_\"))\n }\n else {\n lang = lang.toLowerCase()\n langWithRegion = toLangWithRegion(lang)\n }\n return {file: path.join(packager.buildResourcesDir, file), lang, langWithRegion, langName: (langIdToName as any)[lang]}\n })\n}\n\nexport async function getNotLocalizedLicenseFile(custom: string | null | undefined, packager: PlatformPackager<any>, supportedExtension: Array<string> = [\"rtf\", \"txt\", \"html\"]): Promise<string | null> {\n const possibleFiles: Array<string> = []\n for (const name of [\"license\", \"eula\"]) {\n for (const ext of supportedExtension) {\n possibleFiles.push(`${name}.${ext}`)\n possibleFiles.push(`${name.toUpperCase()}.${ext}`)\n possibleFiles.push(`${name}.${ext.toUpperCase()}`)\n possibleFiles.push(`${name.toUpperCase()}.${ext.toUpperCase()}`)\n }\n }\n\n return await packager.getResource(custom, ...possibleFiles)\n}\n\nexport async function getLicenseFiles(packager: PlatformPackager<any>): Promise<Array<LicenseFile>> {\n return getLicenseAssets((await packager.resourceList)\n .filter(it => {\n const name = it.toLowerCase()\n return (name.startsWith(\"license_\") || name.startsWith(\"eula_\")) && (name.endsWith(\".rtf\") || name.endsWith(\".txt\"))\n }), packager)\n}\n\nexport interface LicenseFile {\n file: string\n lang: string\n langWithRegion: string\n langName: string\n}"],"sourceRoot":""}
|