From 97d64cef6b48fad3aba8e1dd588908b3b3b36b30 Mon Sep 17 00:00:00 2001 From: zhangxiao Date: Mon, 28 Feb 2022 10:45:48 +0800 Subject: [PATCH 01/42] =?UTF-8?q?=E5=A2=9E=E5=8A=A0onUninstall?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I7a8fd74eb5d5e78594f36cc6fdc178c7c4f45566 Signed-off-by: zhangxiao72 --- compiler/components/form_component.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/components/form_component.json b/compiler/components/form_component.json index 5532c7f5a..ea5f1bf0f 100644 --- a/compiler/components/form_component.json +++ b/compiler/components/form_component.json @@ -3,6 +3,6 @@ "atomic": true, "attrs": [ "size", "moduleName", "dimension", "allowUpdate", "visibility", - "onAcquired", "onError", "onRouter" + "onAcquired", "onError", "onRouter", "onUninstall" ] } \ No newline at end of file -- Gitee From a6caa8f1c5dd5283fd3ef95778d6a59f42a24f77 Mon Sep 17 00:00:00 2001 From: njupthan Date: Tue, 1 Mar 2022 13:29:57 +0800 Subject: [PATCH 02/42] Test framework related functions added Signed-off-by: njupthan --- compiler/main.js | 20 +++++++++++++++++++- compiler/src/result_process.ts | 2 +- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/compiler/main.js b/compiler/main.js index aa25d1a8b..311209c57 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -34,7 +34,8 @@ const staticPreviewPage = process.env.aceStaticPreview; const abilityConfig = { abilityType: process.env.abilityType || 'page', abilityEntryFile: null, - projectAbilityPath: [] + projectAbilityPath: [], + testRunnerFile: [] }; const projectConfig = {}; const resources = { @@ -65,6 +66,7 @@ function loadEntryObj(projectConfig) { if (process.env.aceModuleJsonPath) { setAbilityPages(projectConfig) } + setTestRunnerFile(projectConfig); if(staticPreviewPage) { projectConfig.entryObj['./' + staticPreviewPage] = projectConfig.projectPath + path.sep + staticPreviewPage + '.ets?entry'; @@ -160,6 +162,22 @@ function setAbilityFile(projectConfig, abilityPages) { }); } +function setTestRunnerFile(projectConfig) { + const index =projectConfig.projectPath.split(path.sep).join('/').lastIndexOf('\/'); + const testRunnerPath = path.resolve(projectConfig.projectPath.substring(0,index + 1), "TestRunner"); + if (fs.existsSync(testRunnerPath)) { + const testRunnerFiles = []; + readFile(testRunnerPath, testRunnerFiles); + testRunnerFiles.forEach((item) => { + if (/\.(ts|js)$/.test(item)) { + const relativePath = path.relative(testRunnerPath, item).replace(/\.(ts|js)$/, ''); + projectConfig.entryObj["../" + relativePath] = item; + abilityConfig.testRunnerFile.push(item); + } + }) + } +} + function readAbilityEntrance(moduleJson) { let abilityPages = []; if (moduleJson.module) { diff --git a/compiler/src/result_process.ts b/compiler/src/result_process.ts index fb0269ad4..8e80ed3f6 100644 --- a/compiler/src/result_process.ts +++ b/compiler/src/result_process.ts @@ -59,7 +59,7 @@ module.exports = function resultProcess(source: string, map: any): void { resetLog(); } } - if ([abilityConfig.abilityEntryFile].concat(abilityConfig.projectAbilityPath).includes(this.resourcePath)) { + if ([abilityConfig.abilityEntryFile].concat(abilityConfig.projectAbilityPath).concat(abilityConfig.testRunnerFile).includes(this.resourcePath)) { source = source.replace(/exports\.default/, 'globalThis.exports.default'); } -- Gitee From b72ca7169a62de1ac362b3619c8d28528a7416c9 Mon Sep 17 00:00:00 2001 From: laibo102 Date: Tue, 1 Mar 2022 14:20:40 +0800 Subject: [PATCH 03/42] laibo2@huawei.com Signed-off-by: laibo102 Change-Id: Ibe0f41d61dc80662f37c8c96e7f8e2ecf1704a89 --- compiler/src/process_component_build.ts | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index 12582c352..d8db918fd 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -623,14 +623,13 @@ function processDragStartBuilder(node: ts.CallExpression): ts.CallExpression { for (let i = 0; i < node.arguments[0].body.statements.length; i++) { // @ts-ignore let statement: ts.Statement = node.arguments[0].body.statements[i]; - checkStatement(statement); - newStatements.push(statement); - node = ts.factory.updateCallExpression(node, node.expression, node.typeArguments, [ts.factory.updateArrowFunction( - // @ts-ignore - node.arguments[0], undefined, undefined, node.arguments[0].parameters, node.arguments[0].type, - // @ts-ignore - node.arguments[0].equalsGreaterThanToken, ts.factory.updateBlock(node.arguments[0].body, newStatements))]); + newStatements.push(checkStatement(statement)); } + node = ts.factory.updateCallExpression(node, node.expression, node.typeArguments, [ts.factory.updateArrowFunction( + // @ts-ignore + node.arguments[0], undefined, undefined, node.arguments[0].parameters, node.arguments[0].type, + // @ts-ignore + node.arguments[0].equalsGreaterThanToken, ts.factory.updateBlock(node.arguments[0].body, newStatements))]); } return node; } @@ -640,7 +639,7 @@ function isNodeFunction(node: ts.CallExpression): boolean { ts.isBlock(node.arguments[0].body); } -function checkStatement(statement: ts.Statement): void { +function checkStatement(statement: ts.Statement): ts.Statement { if (ts.isReturnStatement(statement)) { if (ts.isObjectLiteralExpression(statement.expression)) { const newProperties: ts.ObjectLiteralElementLike[] = []; @@ -649,10 +648,12 @@ function checkStatement(statement: ts.Statement): void { checkProperty(property); newProperties.push(property); } - statement = ts.factory.createReturnStatement(ts.factory.createObjectLiteralExpression(newProperties)); + return ts.factory.createReturnStatement(ts.factory.createObjectLiteralExpression(newProperties)); } else { - statement = ts.factory.updateReturnStatement(statement, parseBuilderNode(statement.expression)); + return ts.factory.updateReturnStatement(statement, parseBuilderNode(statement.expression)); } + } else { + return statement; } } -- Gitee From 7b0a6e2ca13f0b6259f05c38cf4f55ec36ebaa41 Mon Sep 17 00:00:00 2001 From: njupthan Date: Wed, 2 Mar 2022 11:25:16 +0800 Subject: [PATCH 04/42] update code Signed-off-by: njupthan --- compiler/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/main.js b/compiler/main.js index 311209c57..69e1232e3 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -171,7 +171,7 @@ function setTestRunnerFile(projectConfig) { testRunnerFiles.forEach((item) => { if (/\.(ts|js)$/.test(item)) { const relativePath = path.relative(testRunnerPath, item).replace(/\.(ts|js)$/, ''); - projectConfig.entryObj["../" + relativePath] = item; + projectConfig.entryObj["../TestRunner/" + relativePath] = item; abilityConfig.testRunnerFile.push(item); } }) -- Gitee From 93af825c777c71984e095582e861a0225eac100e Mon Sep 17 00:00:00 2001 From: hufeng Date: Wed, 2 Mar 2022 14:26:33 +0800 Subject: [PATCH 05/42] remove '-r' from compiler's option Signed-off-by: hufeng Change-Id: I35f0570727ca03a2dcff2519713acaf62fe91a62 --- compiler/src/gen_abc_plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/src/gen_abc_plugin.ts b/compiler/src/gen_abc_plugin.ts index 4a30556d9..b07844faa 100644 --- a/compiler/src/gen_abc_plugin.ts +++ b/compiler/src/gen_abc_plugin.ts @@ -87,9 +87,9 @@ function mkDir(path_: string): void { } function js2abcFirst(inputPath: string): void { - let param: string = '-r'; + let param: string = ''; if (isDebug) { - param += ' --debug'; + param += '--debug'; } let js2abc: string = path.join(arkDir, 'build', 'src', 'index.js'); -- Gitee From 22cf9c89120693ca575cad1edbee3901210421bf Mon Sep 17 00:00:00 2001 From: lizhouze Date: Tue, 1 Mar 2022 11:01:23 +0800 Subject: [PATCH 06/42] lizhouze@huawei.com Signed-off-by: lizhouze --- compiler/main.js | 14 ++++++++++++++ compiler/package-lock.json | 30 ++++++++++++++++++++++++++++++ compiler/package.json | 5 +++-- compiler/src/compile_info.ts | 32 ++++++++++++++++++++------------ compiler/webpack.config.js | 1 + 5 files changed, 68 insertions(+), 14 deletions(-) diff --git a/compiler/main.js b/compiler/main.js index aa25d1a8b..9762056fa 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -15,6 +15,7 @@ const fs = require('fs'); const path = require('path'); +const md5 = require('md5'); const { readFile } = require('./lib/utils'); const { WORKERS_DIR } = require('./lib/pre_define'); @@ -54,6 +55,8 @@ function initProjectConfig(projectConfig) { projectConfig.aceModuleJsonPath = projectConfig.aceModuleJsonPath || process.env.aceModuleJsonPath; projectConfig.aceSuperVisualPath = projectConfig.aceSuperVisualPath || process.env.aceSuperVisualPath + projectConfig.hashProjectPath = projectConfig.hashProjectPath || + hashProjectPath(projectConfig.projectPath) } function loadEntryObj(projectConfig) { @@ -243,6 +246,17 @@ function processResourceArr(resourceArr, resourceMap, filePath) { } } +function hashProjectPath(projectPath) { + const ASSCIIStart = 65; + const ASSCIIEnd = 90; + const deviation = 1; + process.env.hashProjectPath = + String.fromCharCode(Math.floor(Math.random() * (ASSCIIEnd - ASSCIIStart + deviation) + ASSCIIStart)) + + md5(projectPath).substring(9, 16) + + String.fromCharCode(Math.floor(Math.random() * (ASSCIIEnd - ASSCIIStart + deviation) + ASSCIIStart)); + return process.env.hashProjectPath; +} + exports.projectConfig = projectConfig; exports.loadEntryObj = loadEntryObj; exports.readAppResource = readAppResource; diff --git a/compiler/package-lock.json b/compiler/package-lock.json index 5940092f4..66c7d41b7 100644 --- a/compiler/package-lock.json +++ b/compiler/package-lock.json @@ -1925,6 +1925,11 @@ "supports-color": "^7.1.0" } }, + "charenc": { + "version": "0.0.2", + "resolved": "https://registry.npmmirror.com/charenc/-/charenc-0.0.2.tgz", + "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==" + }, "check-error": { "version": "1.0.2", "resolved": "https://registry.nlark.com/check-error/download/check-error-1.0.2.tgz", @@ -2101,6 +2106,11 @@ "which": "^2.0.1" } }, + "crypt": { + "version": "0.0.2", + "resolved": "https://registry.npmmirror.com/crypt/-/crypt-0.0.2.tgz", + "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==" + }, "date-format": { "version": "3.0.0", "resolved": "https://registry.nlark.com/date-format/download/date-format-3.0.0.tgz", @@ -2732,6 +2742,11 @@ "resolved": "https://registry.npmmirror.com/ignore/download/ignore-5.2.0.tgz", "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==" }, + "ignore-loader": { + "version": "0.1.2", + "resolved": "https://registry.npmmirror.com/ignore-loader/-/ignore-loader-0.1.2.tgz", + "integrity": "sha512-yOJQEKrNwoYqrWLS4DcnzM7SEQhRKis5mB+LdKKh4cPmGYlLPR0ozRzHV5jmEk2IxptqJNQA5Cc0gw8Fj12bXA==" + }, "import-fresh": { "version": "3.3.0", "resolved": "https://registry.npm.taobao.org/import-fresh/download/import-fresh-3.3.0.tgz?cache=0&sync_timestamp=1608469520474&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fimport-fresh%2Fdownload%2Fimport-fresh-3.3.0.tgz", @@ -2793,6 +2808,11 @@ "binary-extensions": "^2.0.0" } }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmmirror.com/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, "is-core-module": { "version": "2.8.0", "resolved": "https://registry.npmmirror.com/is-core-module/download/is-core-module-2.8.0.tgz?cache=0&sync_timestamp=1634236702465&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fis-core-module%2Fdownload%2Fis-core-module-2.8.0.tgz", @@ -3063,6 +3083,16 @@ "integrity": "sha1-LrLjfqm2fEiR9oShOUeZr0hM96I=", "dev": true }, + "md5": { + "version": "2.3.0", + "resolved": "https://registry.npmmirror.com/md5/-/md5-2.3.0.tgz", + "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", + "requires": { + "charenc": "0.0.2", + "crypt": "0.0.2", + "is-buffer": "~1.1.6" + } + }, "memory-fs": { "version": "0.5.0", "resolved": "https://registry.nlark.com/memory-fs/download/memory-fs-0.5.0.tgz", diff --git a/compiler/package.json b/compiler/package.json index 0efc498ec..cf6c7141f 100644 --- a/compiler/package.json +++ b/compiler/package.json @@ -30,9 +30,9 @@ "eslint": "^7.16.0", "mocha": "^8.2.1", "mocha-context": "^0.1.5", + "pegjs": "^0.10.0", "ts-node": "^9.1.1", - "uglify-js": "^3.13.0", - "pegjs": "^0.10.0" + "uglify-js": "^3.13.0" }, "dependencies": { "clean-webpack-plugin": "^3.0.0", @@ -40,6 +40,7 @@ "deccjsunit": "^1.0.6", "ignore-loader": "^0.1.2", "log4js": "^6.3.0", + "md5": "^2.3.0", "ts-loader": "^8.0.12", "typescript": "^4.1.3", "webpack": "^5.48.0", diff --git a/compiler/src/compile_info.ts b/compiler/src/compile_info.ts index c279652a0..6e5fdb4f1 100644 --- a/compiler/src/compile_info.ts +++ b/compiler/src/compile_info.ts @@ -52,13 +52,6 @@ configure({ export const logger = getLogger('ETS'); export const props: string[] = []; -const GLOBAL_COMMON_MODULE_CACHE: string = ` -globalThis["__common_module_cache__"] = globalThis["__common_module_cache__"] || {}; -globalThis["webpackChunkcompilier"].forEach((item)=> { - Object.keys(item[1]).forEach((element) => { - globalThis["__common_module_cache__"][element] = null; - }) -});`; interface Info { message?: string; @@ -82,6 +75,7 @@ export class ResultStates { private modulePaths: Set = new Set([]); public apply(compiler: Compiler): void { + compiler.hooks.compilation.tap('SourcemapFixer', compilation => { compilation.hooks.afterProcessAssets.tap('SourcemapFixer', assets => { Reflect.ownKeys(assets).forEach(key => { @@ -116,6 +110,15 @@ export class ResultStates { stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS }, (assets) => { + const GLOBAL_COMMON_MODULE_CACHE = ` + globalThis["__common_module_cache__${projectConfig.hashProjectPath}"] =` + + ` globalThis["__common_module_cache__${projectConfig.hashProjectPath}"] || {}; + globalThis["webpackChunk${projectConfig.hashProjectPath}"].forEach((item)=> { + Object.keys(item[1]).forEach((element) => { + globalThis["__common_module_cache__${projectConfig.hashProjectPath}"][element] = null; + }) + });` + if (assets['commons.js']) { assets['commons.js'] = new CachedSource( new ConcatSource(assets['commons.js'], GLOBAL_COMMON_MODULE_CACHE)); @@ -129,13 +132,18 @@ export class ResultStates { compiler.hooks.compilation.tap('Require', compilation => { JavascriptModulesPlugin.getCompilationHooks(compilation).renderRequire.tap('renderRequire', (source) => { - return `var commonCachedModule = globalThis["__common_module_cache__"] ? ` + - `globalThis["__common_module_cache__"][moduleId]: null;\n` + + return `var commonCachedModule = globalThis` + + `["__common_module_cache__${projectConfig.hashProjectPath}"] ? ` + + `globalThis["__common_module_cache__${projectConfig.hashProjectPath}"]` + + `[moduleId]: null;\n` + `if (commonCachedModule) { return commonCachedModule.exports; }\n` + source.replace('// Execute the module function', - `if (globalThis["__common_module_cache__"] && moduleId.indexOf("?name=") < 0 && ` + - `Object.keys(globalThis["__common_module_cache__"]).indexOf(moduleId) >= 0) {\n` + - ` globalThis["__common_module_cache__"][moduleId] = module;\n}`); + `if (globalThis["__common_module_cache__${projectConfig.hashProjectPath}"]` + + ` && moduleId.indexOf("?name=") < 0 && ` + + `Object.keys(globalThis["__common_module_cache__${projectConfig.hashProjectPath}"])` + + `.indexOf(moduleId) >= 0) {\n` + + ` globalThis["__common_module_cache__${projectConfig.hashProjectPath}"]` + + `[moduleId] = module;\n}`); }); }); diff --git a/compiler/webpack.config.js b/compiler/webpack.config.js index 56cdbd953..21c956937 100644 --- a/compiler/webpack.config.js +++ b/compiler/webpack.config.js @@ -266,5 +266,6 @@ module.exports = (env, argv) => { if (appResourcePath) { readAppResource(resources, appResourcePath); } + config.output.library = projectConfig.hashProjectPath; return config; } \ No newline at end of file -- Gitee From ad7a9ddf2eaca40d374b2f88041dc28a8bc9da18 Mon Sep 17 00:00:00 2001 From: laibo102 Date: Thu, 3 Mar 2022 11:00:38 +0800 Subject: [PATCH 07/42] laibo2@huawei.com Signed-off-by: laibo102 Change-Id: Ia02086d8274bf38a39a1bb90213cfcc7bdf16603 --- compiler/main.js | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/compiler/main.js b/compiler/main.js index 9762056fa..7481d0ec3 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -57,6 +57,7 @@ function initProjectConfig(projectConfig) { process.env.aceSuperVisualPath projectConfig.hashProjectPath = projectConfig.hashProjectPath || hashProjectPath(projectConfig.projectPath) + projectConfig.aceWorkerPath = projectConfig.aceWorkerPath || process.env.aceWorkerPath; } function loadEntryObj(projectConfig) { @@ -190,17 +191,41 @@ function setEntrance(abilityConfig, abilityPages) { } function loadWorker(projectConfig) { - const workerPath = path.resolve(projectConfig.projectPath, WORKERS_DIR); - if (fs.existsSync(workerPath)) { - const workerFiles = []; - readFile(workerPath, workerFiles); - workerFiles.forEach((item) => { - if (/\.(ts|js)$/.test(item)) { - const relativePath = path.relative(workerPath, item).replace(/\.(ts|js)$/, ''); - projectConfig.entryObj[`./${WORKERS_DIR}/` + relativePath] = item; + if (validateWorkOption()) { + const workerConfig = JSON.parse(fs.readFileSync(projectConfig.aceWorkPath).toString()); + workerConfig.workers.forEach(worker => { + const relativePath = path.ralative(projectConfig.projectPath, worker); + if (filterWorker(relativePath)) { + projectConfig.entryObj[relativePath.replace(/\.(ts|js)$/,'')] = worker; } }) + } else { + const workerPath = path.resolve(projectConfig.projectPath, WORKERS_DIR); + if (fs.existsSync(workerPath)) { + const workerFiles = []; + readFile(workerPath, workerFiles); + workerFiles.forEach((item) => { + if (/\.(ts|js)$/.test(item)) { + const relativePath = path.relative(workerPath, item).replace(/\.(ts|js)$/, ''); + projectConfig.entryObj[`./${WORKERS_DIR}/` + relativePath] = item; + } + }) + } + } +} + +function validateWorkOption() { + if (projectConfig.aceWorkPath && fs.existsSync(projectConfig.aceWorkPath)) { + const workerConfig = JSON.parse(fs.readFileSync(projectConfig.aceWorkPath).toString()); + if(workerConfig.workers) { + return true; + } } + return false; +} + +function filterWorker(workerPath) { + return /\.(ts|js)$/.test(workerPath) && !/^\.\./.test(workerPath); } ;(function initSystemResource() { -- Gitee From a6a9f0a35a5176ff76b73cf34214d52d139d2fab Mon Sep 17 00:00:00 2001 From: lixingchi1 Date: Thu, 3 Mar 2022 14:54:31 +0800 Subject: [PATCH 08/42] add the web userAgent. Signed-off-by: lixingchi1 --- compiler/components/web.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/components/web.json b/compiler/components/web.json index 4cb5105b8..be881ee05 100644 --- a/compiler/components/web.json +++ b/compiler/components/web.json @@ -7,6 +7,6 @@ "onPageEnd", "onPageBegin", "onProgressChange", "onTitleReceive", "onGeolocationHide", "onGeolocationShow", "onRequestSelected", "javaScriptAccess", "fileAccess", "onAlert", "onBeforeUnload", "onlineImageAccess", "domStorageAccess", "imageAccess", "mixedMode", "zoomAccess", "geolocationAccess", "javaScriptProxy", - "onConfirm", "onConsole", "onErrorReceive", "onHttpErrorReceive", "onDownloadStart" + "userAgent", "onConfirm", "onConsole", "onErrorReceive", "onHttpErrorReceive", "onDownloadStart" ] } \ No newline at end of file -- Gitee From 29e47dbcff64cc7ed37f7e5ca4c76b9c59fa3d85 Mon Sep 17 00:00:00 2001 From: laibo102 Date: Thu, 3 Mar 2022 16:57:19 +0800 Subject: [PATCH 09/42] laibo2@huawei.com Signed-off-by: laibo102 Change-Id: I6c4712fe088438c73a223b89cc8c59aae9a426ce --- compiler/main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/main.js b/compiler/main.js index 7481d0ec3..3d81c251e 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -57,7 +57,7 @@ function initProjectConfig(projectConfig) { process.env.aceSuperVisualPath projectConfig.hashProjectPath = projectConfig.hashProjectPath || hashProjectPath(projectConfig.projectPath) - projectConfig.aceWorkerPath = projectConfig.aceWorkerPath || process.env.aceWorkerPath; + projectConfig.aceBuildJson = projectConfig.aceBuildJson || process.env.aceBuildJson; } function loadEntryObj(projectConfig) { @@ -192,7 +192,7 @@ function setEntrance(abilityConfig, abilityPages) { function loadWorker(projectConfig) { if (validateWorkOption()) { - const workerConfig = JSON.parse(fs.readFileSync(projectConfig.aceWorkPath).toString()); + const workerConfig = JSON.parse(fs.readFileSync(projectConfig.aceBuildJson).toString()); workerConfig.workers.forEach(worker => { const relativePath = path.ralative(projectConfig.projectPath, worker); if (filterWorker(relativePath)) { @@ -215,8 +215,8 @@ function loadWorker(projectConfig) { } function validateWorkOption() { - if (projectConfig.aceWorkPath && fs.existsSync(projectConfig.aceWorkPath)) { - const workerConfig = JSON.parse(fs.readFileSync(projectConfig.aceWorkPath).toString()); + if (projectConfig.aceBuildJson && fs.existsSync(projectConfig.aceBuildJson)) { + const workerConfig = JSON.parse(fs.readFileSync(projectConfig.aceBuildJson).toString()); if(workerConfig.workers) { return true; } -- Gitee From 5ba08fa71e22648c60dbe16546f6b87c6a37ab99 Mon Sep 17 00:00:00 2001 From: lizhouze Date: Thu, 3 Mar 2022 09:45:58 +0800 Subject: [PATCH 10/42] lizhouze@huawei.com Signed-off-by: lizhouze --- compiler/codegen/codegen_ets.js | 2 +- compiler/src/pre_define.ts | 3 + compiler/src/pre_process.ts | 223 +++++++++++++++++++++++++++----- compiler/src/utils.ts | 4 +- 4 files changed, 200 insertions(+), 32 deletions(-) diff --git a/compiler/codegen/codegen_ets.js b/compiler/codegen/codegen_ets.js index bd20d1f9b..ae799e831 100644 --- a/compiler/codegen/codegen_ets.js +++ b/compiler/codegen/codegen_ets.js @@ -13,4 +13,4 @@ * limitations under the License. */ -(()=>{"use strict";var e={904:(e,t)=>{var r;let n;Object.defineProperty(t,"__esModule",{value:!0}),t.setDomain=t.getDomain=t.Domain=void 0,function(e){e[e.FA=0]="FA",e[e.FORM=1]="FORM",e[e.ETS=2]="ETS"}(r||(r={})),t.Domain=r,t.setDomain=e=>{n=e},t.getDomain=()=>null!=n?n:r.ETS},784:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.errorMap=void 0,t.errorMap=new Map([["fileError","Visual file is damaged"],["versionError","Version number of visual file does not match"],["modelError","Visual model in visual file is damaged"],["codegenError","Codegen hml and css failed"]])},117:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNode=void 0,t.ASTNode=class{accept(e){return e.visit(this)}}},862:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Cache=void 0,t.Cache=class{constructor(e,t=0){this.value="",this.indent=t,this.flag=!0,this.INDENT=e}indentOn(){this.flag=!0}indentOff(){this.flag=!1}incIndent(){this.indent++}decIndent(){this.indent--}checkIndent(){return this.indent<0}getIndents(){if(this.flag){let e="";for(let t=0;t{Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=void 0;const n=r(117);class o extends n.ASTNode{constructor(e,t,r,n){super(),this.tagName=e,this.params=t,this.content=r,this.properties=n}setParams(e){this.params=e}}t.Tag=o},623:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNodeGenerator=void 0;const n=r(519),o=r(51);class i{constructor(e){this.cache=e}visit(e){e instanceof n.Tag&&this.genTag(e)}static getMethodGen(e){return void 0===i.instance?i.instance=new i(e):i.instance.setCache(e),i.instance}setCache(e){this.cache=e}genParams(e){if("string"==typeof e)this.cache.concat(e);else if(e.size>0){this.cache.concat(o.TokenClass.LBRA,o.TokenClass.SPACE);let t=0;e.forEach(((r,n)=>{this.cache.concat(n,o.TokenClass.COLON,o.TokenClass.SPACE,r),t++,t{this.cache.concat(n,o.TokenClass.COLON,o.TokenClass.SPACE,r),t++,t{e.accept(this),this.cache.indentOff(),this.cache.concat(o.TokenClass.NEW_LINE),this.cache.indentOn()})),this.cache.decIndent(),this.cache.indentOn()),this.cache.indentOn(),this.cache.concat(o.TokenClass.RBRA)),null!==e.properties&&(null!==e.content&&0!==e.content.length||this.cache.incIndent(),e.properties.forEach(((e,t)=>{this.cache.concat(o.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.concat(o.TokenClass.PROPERTY_START,t,o.TokenClass.TAG_START),this.cache.indentOff(),"string"==typeof e?this.cache.concat(e,o.TokenClass.TAG_END):this.genObjectProperty(e)})),null!==e.content&&0!==e.content.length||this.cache.decIndent())}}t.ASTNodeGenerator=i,i.instance=void 0},413:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ETSBridge=void 0;const n=r(519),o=r(973);t.ETSBridge=class{constructor(){this.errors=0}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}visit(e){const t=new Map;let r=null;const i=new Map,s=new n.Tag(e.type,t,r,i);if(o.parseVisualModel(e,s),e.children.length>0){r=[];for(const t of e.children)r.push(t.accept(this))}return s.content=r,s}}},459:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.genETS=void 0;const n=r(623),o=r(862);t.genETS=function(e){const t=n.ASTNodeGenerator.getMethodGen(new o.Cache(" ",2));return e.accept(t),t.cache.toString()}},435:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StringWriter=void 0;const n=r(459);t.StringWriter=class{genETS(e){return n.genETS(e)}}},51:(e,t)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenClass=void 0,(r=t.TokenClass||(t.TokenClass={}))[r.IDENTIFIER=0]="IDENTIFIER",r[r.STRING_LITERAL=1]="STRING_LITERAL",r[r.NUMBER=2]="NUMBER",r[r.CHARACTER=3]="CHARACTER",r[r.EOF=4]="EOF",r[r.INVALID=5]="INVALID",r.EMPTY_DATA="empty",r.ASSIGN="=",r.INDENT=" ",r.NEW_LINE="\n",r.CARRIAGE_RETURN="\r",r.SPACE=" ",r.LQUOTE="'",r.RQUOTE="'",r.TAG_START="(",r.TAG_END=")",r.EMPTY_TAG_END="/>",r.END_TAG_START="{function r(e){return(...t)=>t.lengtht.property.has(e))),o=r(((e,t,r)=>r.type===e&&r.property.has(t))),i=r(((e,t,r)=>{const n=t.property.get(e);void 0!==n&&r.properties.set(f(e),"'"+n+"'")}));function s(e){return void 0===e||""===e}const a=r(((e,t,r)=>{const n=t.property.get(e);s(n)||r.properties.set(f(e),n)})),c=r(((e,t,r)=>{const n=t.property.get(e);s(n)||r.properties.set(f(e),n)})),l=r(((e,t,r,n)=>{const o=r.property.get(e);s(o)||n.properties.set(f(e),y(t,o))})),p=r(((e,t,r)=>{const n=t.property.get(e);void 0!==n&&r.params instanceof Map&&r.params.set(f(e),"'"+n+"'")})),d=r(((e,t,r)=>{const n=t.property.get(e);!s(n)&&r.params instanceof Map&&r.params.set(f(e),n)})),h=r(((e,t,r,n)=>{const o=r.property.get(e);!s(o)&&n.params instanceof Map&&n.params.set(f(e),y(t,o))})),u=r(((e,t,r)=>{let n=t.property.get(e);s(n)||(n=m(n),r.properties.set(f(e),n))}));function g([e,...t]){return(null==e?void 0:e.toUpperCase())+t.join("")}function f(e){const t=e.split("-");let r=t[0];for(let e=1;e{const o=r.property.get(e);if(s(o)||!(n.params instanceof Map))return;let i=y(t,o);"flex-start"===o?i=t+"Start":"flex-end"===o&&(i=t+"End"),n.params.set(f(e),i)})),E=[[n("width"),i("width")],[n("height"),i("height")],[function(e){return e.property.has("constraint-size-min-width")||e.property.has("constraint-size-max-width")||e.property.has("constraint-size-min-height")||e.property.has("constraint-size-min-height")},function(e,t){const r=new Map,n=e.property.get("constraint-size-min-width"),o=e.property.get("constraint-size-max-width"),i=e.property.get("constraint-size-min-height"),s=e.property.get("constraint-size-max-height");v("minWidth",n,r),v("maxWidth",o,r),v("minHeight",i,r),v("maxHeight",s,r),r.size>0&&t.properties.set("constraintSize",r)}],[n("align"),l("align","Alignment.")],[n("direction"),l("direction","Direction.")],[function(e){return e.property.has("left")||e.property.has("top")},function(e,t){const r=e.property.get("position"),n=e.property.get("left"),o=e.property.get("top");s(n)&&s(o)||t.properties.set("absolute"===r?"position":"offset",new Map([["x","'"+(null!=n?n:"0")+"'"],["y","'"+(null!=o?o:"0")+"'"]]))}],[n("aspect-ratio"),a("aspect-ratio")],[n("display-priority"),a("display-priority")],[n("flex-basis"),i("flex-basis")],[n("flex-grow"),a("flex-grow")],[n("flex-shrink"),a("flex-shrink")],[n("align-self"),l("align-self","ItemAlign.")],[n("border-style"),l("border-style","BorderStyle.")],[n("border-width"),i("border-width")],[n("border-color"),u("border-color")],[n("border-radius"),i("border-radius")],[n("background-color"),u("background-color")],[n("opacity"),a("opacity")],[n("visibility"),l("visibility","Visibility.")],[n("enabled"),c("enabled")],[n("font-color"),u("font-color")],[n("font-size"),i("font-size")],[n("font-style"),l("font-style","FontStyle.")],[n("font-weight"),function(e,t){const r=e.property.get("font-weight");s(r)||t.properties.set("fontWeight",["lighter","normal","regular","medium","bold","bolder"].includes(r)?y("FontWeight.",r):r)}],[n("font-family"),i("font-family")],[function(e){return e.property.has("margin")||e.property.has("margin-left")||e.property.has("margin-top")||e.property.has("margin-right")||e.property.has("margin-bottom")},function(e,t){var r,n,o,i;const s=new Map,a=e.property.get("margin"),c=null!==(r=e.property.get("margin-top"))&&void 0!==r?r:a,l=null!==(n=e.property.get("margin-bottom"))&&void 0!==n?n:a,p=null!==(o=e.property.get("margin-left"))&&void 0!==o?o:a,d=null!==(i=e.property.get("margin-right"))&&void 0!==i?i:a;v("top",c,s),v("bottom",l,s),v("left",p,s),v("right",d,s),s.size>0&&t.properties.set("margin",s)}],[function(e){return e.property.has("padding")||e.property.has("padding-left")||e.property.has("padding-top")||e.property.has("padding-right")||e.property.has("padding-bottom")},function(e,t){var r,n,o,i;const s=new Map,a=e.property.get("padding"),c=null!==(r=e.property.get("padding-top"))&&void 0!==r?r:a,l=null!==(n=e.property.get("padding-bottom"))&&void 0!==n?n:a,p=null!==(o=e.property.get("padding-left"))&&void 0!==o?o:a,d=null!==(i=e.property.get("padding-right"))&&void 0!==i?i:a;v("top",c,s),v("bottom",l,s),v("left",p,s),v("right",d,s),s.size>0&&t.properties.set("padding",s)}],[o("button","label"),function(e,t){const r=e.property.get("label");"string"==typeof r&&t.setParams("'"+r+"'")}],[o("button","type"),l("type","ButtonType.")],[o("button","state-effect"),c("state-effect")],[o("divider","vertical"),c("vertical")],[o("divider","color"),u("color")],[o("divider","stroke-width"),i("stroke-width")],[o("divider","line-cap"),l("line-cap","LineCapStyle.")],[o("image","src"),function(e,t){const r=e.property.get("src");"string"==typeof r&&t.setParams(function(e){return null===e.match(/\$(r|rawfile)\('(.*)'\)$/)?"'"+e+"'":e}(r))}],[o("image","alt"),i("alt")],[o("image","object-fit"),l("object-fit","ImageFit.")],[o("image","object-repeat"),l("object-repeat","ImageRepeat.")],[o("image","interpolation"),l("interpolation","ImageInterpolation.")],[o("image","render-mode"),l("render-mode","ImageRenderMode.")],[function(e){return e.property.has("source-size-width")||e.property.has("source-size-height")},function(e,t){let r=e.property.get("source-size-width"),n=e.property.get("source-size-height");if(s(r)&&s(n))return;r="0"===r||s(r)?"0":r.substring(0,r.length-2),n="0"===n||s(n)?"0":n.substring(0,n.length-2);const o=new Map([["width",r],["height",n]]);t.properties.set("sourceSize",o)}],[function(e){return"progress"===e.type&&(e.property.has("value")||e.property.has("total")||e.property.has("style"))},function(e,t){var r;t.params instanceof Map&&t.params.set("value",null!==(r=e.property.get("value"))&&void 0!==r?r:"0")}],[o("progress","total"),d("total")],[o("progress","style"),h("style","ProgressStyle.")],[o("progress","color"),u("color")],[o("slider","value"),d("value")],[o("slider","min"),d("min")],[o("slider","max"),d("max")],[o("slider","step"),d("step")],[o("slider","style"),h("style","SliderStyle.")],[o("slider","block-color"),u("block-color")],[o("slider","track-color"),u("track-color")],[o("slider","selected-color"),u("selected-color")],[o("slider","show-steps"),c("show-steps")],[o("slider","show-tips"),c("show-tips")],[o("text","content"),function(e,t){const r=e.property.get("content");"string"==typeof r&&t.setParams("`"+r+"`")}],[o("text","text-align"),l("text-align","TextAlign.")],[o("text","text-overflow"),function(e,t){const r=e.property.get("text-overflow");s(r)||t.properties.set("textOverflow",new Map([["overflow","TextOverflow."+g(r)]]))}],[o("text","max-lines"),a("max-lines")],[o("text","line-height"),i("line-height")],[function(e){return"text"===e.type&&(e.property.has("decoration-type")||e.property.has("decoration-color"))},function(e,t){const r=e.property.get("decoration-type"),n=e.property.get("decoration-color");if(s(r)&&s(n))return;const o=new Map([["type",s(r)?"TextDecorationType.None":"TextDecorationType."+g(r)]]);t.properties.set("decoration",o),s(n)||o.set("color",m(n))}],[o("text","baseline-offset"),i("baseline-offset")],[o("text","text-case"),l("text-case","TextCase.")],[o("column","space"),p("space")],[o("column","align-items-column"),function(e,t){const r=e.property.get("align-items-column");if(s(r))return;let n=y("HorizontalAlign.",r);"flex-start"===r?n="HorizontalAlign.Start":"flex-end"===r&&(n="HorizontalAlign.End"),t.properties.set("alignItems",n)}],[o("row","space"),p("space")],[o("row","align-items-row"),function(e,t){const r=e.property.get("align-items-row");if(s(r))return;let n=y("VerticalAlign.",r);"flex-start"===r?n="VerticalAlign.Top":"flex-end"===r&&(n="VerticalAlign.Bottom"),t.properties.set("alignItems",n)}],[o("flex","flex-direction"),function(e,t){const r=e.property.get("flex-direction");!s(r)&&t.params instanceof Map&&t.params.set("direction",y("FlexDirection.",r))}],[o("flex","wrap"),function(e,t){const r=e.property.get("wrap");if(s(r)||!(t.params instanceof Map))return;let n=y("FlexWrap.",r);"nowrap"===r&&(n="FlexWrap.NoWrap"),t.params.set("wrap",n)}],[o("flex","justify-content"),T("justify-content","FlexAlign.")],[o("flex","align-items-flex"),function(e,t){const r=e.property.get("align-items-flex");if(s(r)||!(t.params instanceof Map))return;let n=y("ItemAlign.",r);"flex-start"===r?n="ItemAlign.Start":"flex-end"===r&&(n="ItemAlign.End"),t.params.set("alignItems",n)}],[o("flex","align-content"),T("align-content","FlexAlign.")],[o("list","space"),d("space")],[o("list","initial-index"),d("initial-index")],[o("list","list-direction"),l("list-direction","Axis.")],[function(e){return"list"===e.type&&(e.property.has("divider-stroke-width")||e.property.has("divider-color")||e.property.has("divider-start-margin")||e.property.has("divider-end-margin"))},function(e,t){const r=e.property.get("divider-stroke-width"),n=new Map([["strokeWidth","'"+(null!=r?r:"0")+"'"]]),o=e.property.get("divider-color"),i=e.property.get("divider-start-margin"),a=e.property.get("divider-end-margin");s(o)||n.set("color",m(o)),s(i)||n.set("startMargin","'"+i+"'"),s(a)||n.set("endMargin","'"+a+"'"),t.properties.set("divider",n)}],[o("list","edit-mode"),c("edit-mode")],[o("list","edge-effect"),l("edge-effect","EdgeEffect.")],[o("list","chain-animation"),c("chain-animation")],[o("list-item","sticky"),l("sticky","Sticky.")],[o("list-item","editable"),c("editable")],[o("swiper","index"),a("index")],[o("swiper","auto-play"),c("auto-play")],[o("swiper","interval"),a("interval")],[o("swiper","indicator"),c("indicator")],[o("swiper","loop"),c("loop")],[o("swiper","duration"),a("duration")],[o("swiper","vertical"),c("vertical")],[o("swiper","item-space"),i("item-space")]]},945:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FormAction=t.FormModel=void 0,t.FormModel=class{constructor(){this.data=new Map,this.actions=new Map}},t.FormAction=class{constructor(e,t,r){this.action=e,this.params=t,this.want=r}}},891:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.setInstance=t.getInstance=void 0;const n=r(933),o=r(945),i=r(904),s={document:{VisualVersion:"12",type:"ETS"},visualModel:new n.VisualModel({type:"div",id:"wrapper"}),formData:new o.FormModel};t.getInstance=function(){return s},t.setInstance=function(e){for(const t in s)Object.prototype.hasOwnProperty.call(e,t)&&(s[t]=e[t]);const t=s.document.type;i.setDomain("ETS"===t?i.Domain.ETS:"FORM"===t?i.Domain.FORM:i.Domain.FA)}},977:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.reviver=t.replacer=t.deserialize=t.serialize=void 0;const n=r(933),o=r(891);function i(e,t){if(t instanceof Map)return{dataType:"Map",value:Object.fromEntries(t.entries())};if(t instanceof Set)return{dataType:"Set",value:Array.from(t.entries())};if(t instanceof n.VisualModel){const e=new n.VisualModel({type:"none"}),r={};for(const n in e)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return{dataType:"VisualModel",value:r}}return t}function s(e,t){if("object"==typeof t&&null!=t){if("Map"===t.dataType)return new Map(Object.entries(t.value));if("Set"===t.dataType)return new Set(t.value);if("VisualModel"===t.dataType){const e=new n.VisualModel({type:""});Object.assign(e,t.value),t=e}}return t}t.serialize=function(e,t){return JSON.stringify(null!=t?t:o.getInstance(),i,4)},t.deserialize=function(e){const t=JSON.parse(e,s);o.setInstance(t)},t.replacer=i,t.reviver=s},933:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VisualModel=void 0;const r="-visual";t.VisualModel=class{constructor(e){if(this.mediaProperty=void 0,this.property=void 0!==e.property?e.property:new Map,this.children=void 0!==e.children?e.children:[],"wrapper"===e.type)return this.id="wrapper",void(this.type="div");e.type.endsWith(r)&&(e.type=e.type.substring(0,e.type.length-r.length)),this.id=void 0!==e.id?e.id:"",this.type=e.type}accept(e){return e.visit(this)}}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}var n={};(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0});const t=r(784),o=r(891),i=r(977),s=r(413),a=r(435);e.genETS=function(e){const r={ets:"",errorType:"",errorMessage:""};!function(e,t){try{i.deserialize(e);const r=o.getInstance().document.VisualVersion,n=/^([1-9]+[0-9]*)$/;if(void 0===r)t.errorType="versionError";else{const e=r.match(n);(null===e||parseInt(e[1])>12)&&(t.errorType="versionError")}}catch(e){t.errorType="fileError"}}(e,r);try{const e=function(e){let t="";const r=new s.ETSBridge,n=e.accept(r),o=(new a.StringWriter).genETS(n);return t=r.getErrorCount()>0?"error":o,t}(o.getInstance().visualModel);"error"===e&&(r.errorType="codegenError"),r.ets=e}catch(e){r.errorType="modelError"}return""!==r.errorType&&(r.errorMessage=t.errorMap.get(r.errorType),r.ets=""),r}})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); \ No newline at end of file +(()=>{var e={486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",c=32,u=128,l=1/0,f=9007199254740991,p=NaN,d=4294967295,h=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",c],["partialRight",64],["rearg",256]],g="[object Arguments]",y="[object Array]",m="[object Boolean]",v="[object Date]",_="[object Error]",T="[object Function]",w="[object GeneratorFunction]",b="[object Map]",E="[object Number]",C="[object Object]",P="[object Promise]",S="[object RegExp]",k="[object Set]",A="[object String]",M="[object Symbol]",x="[object WeakMap]",I="[object ArrayBuffer]",N="[object DataView]",O="[object Float32Array]",R="[object Float64Array]",z="[object Int8Array]",D="[object Int16Array]",j="[object Int32Array]",W="[object Uint8Array]",L="[object Uint8ClampedArray]",F="[object Uint16Array]",V="[object Uint32Array]",B=/\b__p \+= '';/g,U=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,Q=/[&<>"']/g,q=RegExp(G.source),H=RegExp(Q.source),Y=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,ce=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,de=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,ge=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,me=/^(?:0|[1-9]\d*)$/,ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,Te=/['\n\r\u2028\u2029\\]/g,we="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",be="a-z\\xdf-\\xf6\\xf8-\\xff",Ee="A-Z\\xc0-\\xd6\\xd8-\\xde",Ce="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Pe="["+Ce+"]",Se="["+we+"]",ke="\\d+",Ae="["+be+"]",Me="[^\\ud800-\\udfff"+Ce+ke+"\\u2700-\\u27bf"+be+Ee+"]",xe="\\ud83c[\\udffb-\\udfff]",Ie="[^\\ud800-\\udfff]",Ne="(?:\\ud83c[\\udde6-\\uddff]){2}",Oe="[\\ud800-\\udbff][\\udc00-\\udfff]",Re="["+Ee+"]",ze="(?:"+Ae+"|"+Me+")",De="(?:"+Re+"|"+Me+")",je="(?:['’](?:d|ll|m|re|s|t|ve))?",We="(?:['’](?:D|LL|M|RE|S|T|VE))?",Le="(?:"+Se+"|"+xe+")?",Fe="[\\ufe0e\\ufe0f]?",Ve=Fe+Le+"(?:\\u200d(?:"+[Ie,Ne,Oe].join("|")+")"+Fe+Le+")*",Be="(?:"+["[\\u2700-\\u27bf]",Ne,Oe].join("|")+")"+Ve,Ue="(?:"+[Ie+Se+"?",Se,Ne,Oe,"[\\ud800-\\udfff]"].join("|")+")",$e=RegExp("['’]","g"),Ge=RegExp(Se,"g"),Qe=RegExp(xe+"(?="+xe+")|"+Ue+Ve,"g"),qe=RegExp([Re+"?"+Ae+"+"+je+"(?="+[Pe,Re,"$"].join("|")+")",De+"+"+We+"(?="+[Pe,Re+ze,"$"].join("|")+")",Re+"?"+ze+"+"+je,Re+"+"+We,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ke,Be].join("|"),"g"),He=RegExp("[\\u200d\\ud800-\\udfff"+we+"\\ufe0e\\ufe0f]"),Ye=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ke=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Je=-1,Ze={};Ze[O]=Ze[R]=Ze[z]=Ze[D]=Ze[j]=Ze[W]=Ze[L]=Ze[F]=Ze[V]=!0,Ze[g]=Ze[y]=Ze[I]=Ze[m]=Ze[N]=Ze[v]=Ze[_]=Ze[T]=Ze[b]=Ze[E]=Ze[C]=Ze[S]=Ze[k]=Ze[A]=Ze[x]=!1;var Xe={};Xe[g]=Xe[y]=Xe[I]=Xe[N]=Xe[m]=Xe[v]=Xe[O]=Xe[R]=Xe[z]=Xe[D]=Xe[j]=Xe[b]=Xe[E]=Xe[C]=Xe[S]=Xe[k]=Xe[A]=Xe[M]=Xe[W]=Xe[L]=Xe[F]=Xe[V]=!0,Xe[_]=Xe[T]=Xe[x]=!1;var et={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},tt=parseFloat,nt=parseInt,rt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,it="object"==typeof self&&self&&self.Object===Object&&self,ot=rt||it||Function("return this")(),at=t&&!t.nodeType&&t,st=at&&e&&!e.nodeType&&e,ct=st&&st.exports===at,ut=ct&&rt.process,lt=function(){try{return st&&st.require&&st.require("util").types||ut&&ut.binding&&ut.binding("util")}catch(e){}}(),ft=lt&<.isArrayBuffer,pt=lt&<.isDate,dt=lt&<.isMap,ht=lt&<.isRegExp,gt=lt&<.isSet,yt=lt&<.isTypedArray;function mt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function vt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function qt(e,t){for(var n=e.length;n--&&Ot(t,e[n],0)>-1;);return n}function Ht(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Yt=Wt({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Kt=Wt({"&":"&","<":"<",">":">",'"':""","'":"'"});function Jt(e){return"\\"+et[e]}function Zt(e){return He.test(e)}function Xt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function en(e,t){return function(n){return e(t(n))}}function tn(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),un=function e(t){var n,r=(t=null==t?ot:un.defaults(ot.Object(),t,un.pick(ot,Ke))).Array,ie=t.Date,we=t.Error,be=t.Function,Ee=t.Math,Ce=t.Object,Pe=t.RegExp,Se=t.String,ke=t.TypeError,Ae=r.prototype,Me=be.prototype,xe=Ce.prototype,Ie=t["__core-js_shared__"],Ne=Me.toString,Oe=xe.hasOwnProperty,Re=0,ze=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",De=xe.toString,je=Ne.call(Ce),We=ot._,Le=Pe("^"+Ne.call(Oe).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Fe=ct?t.Buffer:i,Ve=t.Symbol,Be=t.Uint8Array,Ue=Fe?Fe.allocUnsafe:i,Qe=en(Ce.getPrototypeOf,Ce),He=Ce.create,et=xe.propertyIsEnumerable,rt=Ae.splice,it=Ve?Ve.isConcatSpreadable:i,at=Ve?Ve.iterator:i,st=Ve?Ve.toStringTag:i,ut=function(){try{var e=uo(Ce,"defineProperty");return e({},"",{}),e}catch(e){}}(),lt=t.clearTimeout!==ot.clearTimeout&&t.clearTimeout,xt=ie&&ie.now!==ot.Date.now&&ie.now,Wt=t.setTimeout!==ot.setTimeout&&t.setTimeout,ln=Ee.ceil,fn=Ee.floor,pn=Ce.getOwnPropertySymbols,dn=Fe?Fe.isBuffer:i,hn=t.isFinite,gn=Ae.join,yn=en(Ce.keys,Ce),mn=Ee.max,vn=Ee.min,_n=ie.now,Tn=t.parseInt,wn=Ee.random,bn=Ae.reverse,En=uo(t,"DataView"),Cn=uo(t,"Map"),Pn=uo(t,"Promise"),Sn=uo(t,"Set"),kn=uo(t,"WeakMap"),An=uo(Ce,"create"),Mn=kn&&new kn,xn={},In=Lo(En),Nn=Lo(Cn),On=Lo(Pn),Rn=Lo(Sn),zn=Lo(kn),Dn=Ve?Ve.prototype:i,jn=Dn?Dn.valueOf:i,Wn=Dn?Dn.toString:i;function Ln(e){if(ns(e)&&!Ga(e)&&!(e instanceof Un)){if(e instanceof Bn)return e;if(Oe.call(e,"__wrapped__"))return Fo(e)}return new Bn(e)}var Fn=function(){function e(){}return function(t){if(!ts(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Vn(){}function Bn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function $n(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function sr(e,t,n,r,o,a){var s,c=1&t,u=2&t,l=4&t;if(n&&(s=o?n(e,r,o,a):n(e)),s!==i)return s;if(!ts(e))return e;var f=Ga(e);if(f){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Oe.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!c)return ki(e,s)}else{var p=po(e),d=p==T||p==w;if(Ya(e))return wi(e,c);if(p==C||p==g||d&&!o){if(s=u||d?{}:go(e),!c)return u?function(e,t){return Ai(e,fo(e),t)}(e,function(e,t){return e&&Ai(t,Os(t),e)}(s,e)):function(e,t){return Ai(e,lo(e),t)}(e,rr(s,e))}else{if(!Xe[p])return o?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case I:return bi(e);case m:case v:return new i(+e);case N:return function(e,t){var n=t?bi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case O:case R:case z:case D:case j:case W:case L:case F:case V:return Ei(e,n);case b:case k:return new i;case E:case A:return new i(e);case S:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case M:return r=e,jn?Ce(jn.call(r)):{}}}(e,p,c)}}a||(a=new Hn);var h=a.get(e);if(h)return h;a.set(e,s),ss(e)?e.forEach((function(r){s.add(sr(r,t,n,r,e,a))})):rs(e)&&e.forEach((function(r,i){s.set(i,sr(r,t,n,i,e,a))}));var y=f?i:(l?u?no:to:u?Os:Ns)(e);return _t(y||e,(function(r,i){y&&(r=e[i=r]),er(s,i,sr(r,t,n,i,e,a))})),s}function cr(e,t,n){var r=n.length;if(null==e)return!r;for(e=Ce(e);r--;){var o=n[r],a=t[o],s=e[o];if(s===i&&!(o in e)||!a(s))return!1}return!0}function ur(e,t,n){if("function"!=typeof e)throw new ke(o);return xo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Et,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;n&&(t=Pt(t,Ut(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Gt,a=!1,t=new qn(t));e:for(;++i-1},Gn.prototype.set=function(e,t){var n=this.__data__,r=tr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Qn.prototype.clear=function(){this.size=0,this.__data__={hash:new $n,map:new(Cn||Gn),string:new $n}},Qn.prototype.delete=function(e){var t=so(this,e).delete(e);return this.size-=t?1:0,t},Qn.prototype.get=function(e){return so(this,e).get(e)},Qn.prototype.has=function(e){return so(this,e).has(e)},Qn.prototype.set=function(e,t){var n=so(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},qn.prototype.add=qn.prototype.push=function(e){return this.__data__.set(e,a),this},qn.prototype.has=function(e){return this.__data__.has(e)},Hn.prototype.clear=function(){this.__data__=new Gn,this.size=0},Hn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Hn.prototype.get=function(e){return this.__data__.get(e)},Hn.prototype.has=function(e){return this.__data__.has(e)},Hn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Gn){var r=n.__data__;if(!Cn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Qn(r)}return n.set(e,t),this.size=n.size,this};var fr=Ii(_r),pr=Ii(Tr,!0);function dr(e,t){var n=!0;return fr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(s)?t>1?yr(s,t-1,n,r,i):St(i,s):r||(i[i.length]=s)}return i}var mr=Ni(),vr=Ni(!0);function _r(e,t){return e&&mr(e,t,Ns)}function Tr(e,t){return e&&vr(e,t,Ns)}function wr(e,t){return bt(t,(function(t){return Za(e[t])}))}function br(e,t){for(var n=0,r=(t=mi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Oe.call(e,t)}function kr(e,t){return null!=e&&t in Ce(e)}function Ar(e,t,n){for(var o=n?Ct:Et,a=e[0].length,s=e.length,c=s,u=r(s),l=1/0,f=[];c--;){var p=e[c];c&&t&&(p=Pt(p,Ut(t))),l=vn(p.length,l),u[c]=!n&&(t||a>=120&&p.length>=120)?new qn(c&&p):i}p=e[0];var d=-1,h=u[0];e:for(;++d=s?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)s!==e&&rt.call(s,c,1),rt.call(e,c,1);return e}function Gr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;mo(i)?rt.call(e,i,1):ui(e,i)}}return e}function Qr(e,t){return e+fn(wn()*(t-e+1))}function qr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=fn(t/2))&&(e+=e)}while(t);return n}function Hr(e,t){return Io(Po(e,t,ic),e+"")}function Yr(e){return Kn(Vs(e))}function Kr(e,t){var n=Vs(e);return Ro(n,ar(t,0,n.length))}function Jr(e,t,n,r){if(!ts(e))return e;for(var o=-1,a=(t=mi(t,e)).length,s=a-1,c=e;null!=c&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!us(a)&&(n?a<=t:a=200){var u=t?null:qi(e);if(u)return nn(u);a=!1,i=Gt,c=new qn}else c=t?[]:s;e:for(;++r=r?e:ti(e,t,n)}var Ti=lt||function(e){return ot.clearTimeout(e)};function wi(e,t){if(t)return e.slice();var n=e.length,r=Ue?Ue(n):new e.constructor(n);return e.copy(r),r}function bi(e){var t=new e.constructor(e.byteLength);return new Be(t).set(new Be(e)),t}function Ei(e,t){var n=t?bi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ci(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=us(e),s=t!==i,c=null===t,u=t==t,l=us(t);if(!c&&!l&&!a&&e>t||a&&s&&u&&!c&&!l||r&&s&&u||!n&&u||!o)return 1;if(!r&&!a&&!l&&e1?n[o-1]:i,s=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,s&&vo(n[0],n[1],s)&&(a=o<3?i:a,o=1),t=Ce(t);++r-1?o[a?t[s]:s]:i}}function ji(e){return eo((function(t){var n=t.length,r=n,a=Bn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new ke(o);if(a&&!c&&"wrapper"==io(s))var c=new Bn([],!0)}for(r=c?r:n;++r1&&_.reverse(),d&&fc))return!1;var l=a.get(e),f=a.get(t);if(l&&f)return l==t&&f==e;var p=-1,d=!0,h=2&n?new qn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return _t(h,(function(n){var r="_."+n[0];t&n[1]&&!Et(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(se):[]}(r),n)))}function Oo(e){var t=0,n=0;return function(){var r=_n(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Ro(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,aa(e,n)}));function da(e){var t=Ln(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var ga=eo((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return or(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&mo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:i}),new Bn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ya=Mi((function(e,t,n){Oe.call(e,n)?++e[n]:ir(e,n,1)})),ma=Di($o),va=Di(Go);function _a(e,t){return(Ga(e)?_t:fr)(e,ao(t,3))}function Ta(e,t){return(Ga(e)?Tt:pr)(e,ao(t,3))}var wa=Mi((function(e,t,n){Oe.call(e,n)?e[n].push(t):ir(e,n,[t])})),ba=Hr((function(e,t,n){var i=-1,o="function"==typeof t,a=qa(e)?r(e.length):[];return fr(e,(function(e){a[++i]=o?mt(t,e,n):Mr(e,t,n)})),a})),Ea=Mi((function(e,t,n){ir(e,n,t)}));function Ca(e,t){return(Ga(e)?Pt:jr)(e,ao(t,3))}var Pa=Mi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Sa=Hr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&vo(e,t[0],t[1])?t=[]:n>2&&vo(t[0],t[1],t[2])&&(t=[t[0]]),Br(e,yr(t,1),[])})),ka=xt||function(){return ot.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,Yi(e,u,i,i,i,i,t)}function Ma(e,t){var n;if("function"!=typeof t)throw new ke(o);return e=gs(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var xa=Hr((function(e,t,n){var r=1;if(n.length){var i=tn(n,oo(xa));r|=c}return Yi(e,r,t,n,i)})),Ia=Hr((function(e,t,n){var r=3;if(n.length){var i=tn(n,oo(Ia));r|=c}return Yi(t,r,e,n,i)}));function Na(e,t,n){var r,a,s,c,u,l,f=0,p=!1,d=!1,h=!0;if("function"!=typeof e)throw new ke(o);function g(t){var n=r,o=a;return r=a=i,f=t,c=e.apply(o,n)}function y(e){return f=e,u=xo(v,t),p?g(e):c}function m(e){var n=e-l;return l===i||n>=t||n<0||d&&e-f>=s}function v(){var e=ka();if(m(e))return _(e);u=xo(v,function(e){var n=t-(e-l);return d?vn(n,s-(e-f)):n}(e))}function _(e){return u=i,h&&r?g(e):(r=a=i,c)}function T(){var e=ka(),n=m(e);if(r=arguments,a=this,l=e,n){if(u===i)return y(l);if(d)return Ti(u),u=xo(v,t),g(l)}return u===i&&(u=xo(v,t)),c}return t=ms(t)||0,ts(n)&&(p=!!n.leading,s=(d="maxWait"in n)?mn(ms(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),T.cancel=function(){u!==i&&Ti(u),f=0,r=l=a=u=i},T.flush=function(){return u===i?c:_(ka())},T}var Oa=Hr((function(e,t){return ur(e,1,t)})),Ra=Hr((function(e,t,n){return ur(e,ms(t)||0,n)}));function za(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ke(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(za.Cache||Qn),n}function Da(e){if("function"!=typeof e)throw new ke(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}za.Cache=Qn;var ja=vi((function(e,t){var n=(t=1==t.length&&Ga(t[0])?Pt(t[0],Ut(ao())):Pt(yr(t,1),Ut(ao()))).length;return Hr((function(r){for(var i=-1,o=vn(r.length,n);++i=t})),$a=xr(function(){return arguments}())?xr:function(e){return ns(e)&&Oe.call(e,"callee")&&!et.call(e,"callee")},Ga=r.isArray,Qa=ft?Ut(ft):function(e){return ns(e)&&Cr(e)==I};function qa(e){return null!=e&&es(e.length)&&!Za(e)}function Ha(e){return ns(e)&&qa(e)}var Ya=dn||mc,Ka=pt?Ut(pt):function(e){return ns(e)&&Cr(e)==v};function Ja(e){if(!ns(e))return!1;var t=Cr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!os(e)}function Za(e){if(!ts(e))return!1;var t=Cr(e);return t==T||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xa(e){return"number"==typeof e&&e==gs(e)}function es(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ns(e){return null!=e&&"object"==typeof e}var rs=dt?Ut(dt):function(e){return ns(e)&&po(e)==b};function is(e){return"number"==typeof e||ns(e)&&Cr(e)==E}function os(e){if(!ns(e)||Cr(e)!=C)return!1;var t=Qe(e);if(null===t)return!0;var n=Oe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ne.call(n)==je}var as=ht?Ut(ht):function(e){return ns(e)&&Cr(e)==S},ss=gt?Ut(gt):function(e){return ns(e)&&po(e)==k};function cs(e){return"string"==typeof e||!Ga(e)&&ns(e)&&Cr(e)==A}function us(e){return"symbol"==typeof e||ns(e)&&Cr(e)==M}var ls=yt?Ut(yt):function(e){return ns(e)&&es(e.length)&&!!Ze[Cr(e)]},fs=$i(Dr),ps=$i((function(e,t){return e<=t}));function ds(e){if(!e)return[];if(qa(e))return cs(e)?an(e):ki(e);if(at&&e[at])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[at]());var t=po(e);return(t==b?Xt:t==k?nn:Vs)(e)}function hs(e){return e?(e=ms(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function gs(e){var t=hs(e),n=t%1;return t==t?n?t-n:t:0}function ys(e){return e?ar(gs(e),0,d):0}function ms(e){if("number"==typeof e)return e;if(us(e))return p;if(ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Bt(e);var n=he.test(e);return n||ye.test(e)?nt(e.slice(2),n?2:8):de.test(e)?p:+e}function vs(e){return Ai(e,Os(e))}function _s(e){return null==e?"":si(e)}var Ts=xi((function(e,t){if(bo(t)||qa(t))Ai(t,Ns(t),e);else for(var n in t)Oe.call(t,n)&&er(e,n,t[n])})),ws=xi((function(e,t){Ai(t,Os(t),e)})),bs=xi((function(e,t,n,r){Ai(t,Os(t),e,r)})),Es=xi((function(e,t,n,r){Ai(t,Ns(t),e,r)})),Cs=eo(or),Ps=Hr((function(e,t){e=Ce(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&vo(t[0],t[1],o)&&(r=1);++n1),t})),Ai(e,no(e),n),r&&(n=sr(n,7,Zi));for(var i=t.length;i--;)ui(n,t[i]);return n})),js=eo((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return As(e,n)}))}(e,t)}));function Ws(e,t){if(null==e)return{};var n=Pt(no(e),(function(e){return[e]}));return t=ao(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Ls=Hi(Ns),Fs=Hi(Os);function Vs(e){return null==e?[]:$t(e,Ns(e))}var Bs=Ri((function(e,t,n){return t=t.toLowerCase(),e+(n?Us(t):t)}));function Us(e){return Js(_s(e).toLowerCase())}function $s(e){return(e=_s(e))&&e.replace(ve,Yt).replace(Ge,"")}var Gs=Ri((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Qs=Ri((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),qs=Oi("toLowerCase"),Hs=Ri((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ys=Ri((function(e,t,n){return e+(n?" ":"")+Js(t)})),Ks=Ri((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Js=Oi("toUpperCase");function Zs(e,t,n){return e=_s(e),(t=n?i:t)===i?function(e){return Ye.test(e)}(e)?function(e){return e.match(qe)||[]}(e):function(e){return e.match(ce)||[]}(e):e.match(t)||[]}var Xs=Hr((function(e,t){try{return mt(e,i,t)}catch(e){return Ja(e)?e:new we(e)}})),ec=eo((function(e,t){return _t(t,(function(t){t=Wo(t),ir(e,t,xa(e[t],e))})),e}));function tc(e){return function(){return e}}var nc=ji(),rc=ji(!0);function ic(e){return e}function oc(e){return Rr("function"==typeof e?e:sr(e,1))}var ac=Hr((function(e,t){return function(n){return Mr(n,e,t)}})),sc=Hr((function(e,t){return function(n){return Mr(e,n,t)}}));function cc(e,t,n){var r=Ns(t),i=wr(t,r);null!=n||ts(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=wr(t,Ns(t)));var o=!(ts(n)&&"chain"in n&&!n.chain),a=Za(e);return _t(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=ki(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,St([this.value()],arguments))})})),e}function uc(){}var lc=Vi(Pt),fc=Vi(wt),pc=Vi(Mt);function dc(e){return _o(e)?jt(Wo(e)):function(e){return function(t){return br(t,e)}}(e)}var hc=Ui(),gc=Ui(!0);function yc(){return[]}function mc(){return!1}var vc,_c=Fi((function(e,t){return e+t}),0),Tc=Qi("ceil"),wc=Fi((function(e,t){return e/t}),1),bc=Qi("floor"),Ec=Fi((function(e,t){return e*t}),1),Cc=Qi("round"),Pc=Fi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new ke(o);return e=gs(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=Ts,Ln.assignIn=ws,Ln.assignInWith=bs,Ln.assignWith=Es,Ln.at=Cs,Ln.before=Ma,Ln.bind=xa,Ln.bindAll=ec,Ln.bindKey=Ia,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ga(e)?e:[e]},Ln.chain=da,Ln.chunk=function(e,t,n){t=(n?vo(e,t,n):t===i)?1:mn(gs(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,s=0,c=r(ln(o/t));ao?0:o+n),(r=r===i||r>o?o:gs(r))<0&&(r+=o),r=n>r?0:ys(r);n>>0)?(e=_s(e))&&("string"==typeof t||null!=t&&!as(t))&&!(t=si(t))&&Zt(e)?_i(an(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new ke(o);return t=null==t?0:mn(gs(t),0),Hr((function(n){var r=n[t],i=_i(n,0,t);return r&&St(i,r),mt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ti(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ti(e,0,(t=n||t===i?1:gs(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ti(e,(t=r-(t=n||t===i?1:gs(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?fi(e,ao(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?fi(e,ao(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new ke(o);return ts(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Na(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=ha,Ln.toArray=ds,Ln.toPairs=Ls,Ln.toPairsIn=Fs,Ln.toPath=function(e){return Ga(e)?Pt(e,Wo):us(e)?[e]:ki(jo(_s(e)))},Ln.toPlainObject=vs,Ln.transform=function(e,t,n){var r=Ga(e),i=r||Ya(e)||ls(e);if(t=ao(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:ts(e)&&Za(o)?Fn(Qe(e)):{}}return(i?_t:_r)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=na,Ln.unionBy=ra,Ln.unionWith=ia,Ln.uniq=function(e){return e&&e.length?ci(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ci(e,ao(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ci(e,i,t):[]},Ln.unset=function(e,t){return null==e||ui(e,t)},Ln.unzip=oa,Ln.unzipWith=aa,Ln.update=function(e,t,n){return null==e?e:li(e,t,yi(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,yi(n),r)},Ln.values=Vs,Ln.valuesIn=function(e){return null==e?[]:$t(e,Os(e))},Ln.without=sa,Ln.words=Zs,Ln.wrap=function(e,t){return Wa(yi(t),e)},Ln.xor=ca,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=fa,Ln.zipObject=function(e,t){return hi(e||[],t||[],er)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Jr)},Ln.zipWith=pa,Ln.entries=Ls,Ln.entriesIn=Fs,Ln.extend=ws,Ln.extendWith=bs,cc(Ln,Ln),Ln.add=_c,Ln.attempt=Xs,Ln.camelCase=Bs,Ln.capitalize=Us,Ln.ceil=Tc,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=ms(n))==n?n:0),t!==i&&(t=(t=ms(t))==t?t:0),ar(ms(e),t,n)},Ln.clone=function(e){return sr(e,4)},Ln.cloneDeep=function(e){return sr(e,5)},Ln.cloneDeepWith=function(e,t){return sr(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return sr(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||cr(e,t,Ns(t))},Ln.deburr=$s,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=wc,Ln.endsWith=function(e,t,n){e=_s(e),t=si(t);var r=e.length,o=n=n===i?r:ar(gs(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=Va,Ln.escape=function(e){return(e=_s(e))&&H.test(e)?e.replace(Q,Kt):e},Ln.escapeRegExp=function(e){return(e=_s(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Ga(e)?wt:dr;return n&&vo(e,t,n)&&(t=i),r(e,ao(t,3))},Ln.find=ma,Ln.findIndex=$o,Ln.findKey=function(e,t){return It(e,ao(t,3),_r)},Ln.findLast=va,Ln.findLastIndex=Go,Ln.findLastKey=function(e,t){return It(e,ao(t,3),Tr)},Ln.floor=bc,Ln.forEach=_a,Ln.forEachRight=Ta,Ln.forIn=function(e,t){return null==e?e:mr(e,ao(t,3),Os)},Ln.forInRight=function(e,t){return null==e?e:vr(e,ao(t,3),Os)},Ln.forOwn=function(e,t){return e&&_r(e,ao(t,3))},Ln.forOwnRight=function(e,t){return e&&Tr(e,ao(t,3))},Ln.get=ks,Ln.gt=Ba,Ln.gte=Ua,Ln.has=function(e,t){return null!=e&&ho(e,t,Sr)},Ln.hasIn=As,Ln.head=qo,Ln.identity=ic,Ln.includes=function(e,t,n,r){e=qa(e)?e:Vs(e),n=n&&!r?gs(n):0;var i=e.length;return n<0&&(n=mn(i+n,0)),cs(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Ot(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:gs(n);return i<0&&(i=mn(r+i,0)),Ot(e,t,i)},Ln.inRange=function(e,t,n){return t=hs(t),n===i?(n=t,t=0):n=hs(n),function(e,t,n){return e>=vn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ss,Ln.isString=cs,Ln.isSymbol=us,Ln.isTypedArray=ls,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return ns(e)&&po(e)==x},Ln.isWeakSet=function(e){return ns(e)&&"[object WeakSet]"==Cr(e)},Ln.join=function(e,t){return null==e?"":gn.call(e,t)},Ln.kebabCase=Gs,Ln.last=Jo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=gs(n))<0?mn(r+o,0):vn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Nt(e,zt,o,!0)},Ln.lowerCase=Qs,Ln.lowerFirst=qs,Ln.lt=fs,Ln.lte=ps,Ln.max=function(e){return e&&e.length?hr(e,ic,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,ao(t,2),Pr):i},Ln.mean=function(e){return Dt(e,ic)},Ln.meanBy=function(e,t){return Dt(e,ao(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ic,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,ao(t,2),Dr):i},Ln.stubArray=yc,Ln.stubFalse=mc,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=Ec,Ln.nth=function(e,t){return e&&e.length?Vr(e,gs(t)):i},Ln.noConflict=function(){return ot._===this&&(ot._=We),this},Ln.noop=uc,Ln.now=ka,Ln.pad=function(e,t,n){e=_s(e);var r=(t=gs(t))?on(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Bi(fn(i),n)+e+Bi(ln(i),n)},Ln.padEnd=function(e,t,n){e=_s(e);var r=(t=gs(t))?on(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=wn();return vn(e+o*(t-e+tt("1e-"+((o+"").length-1))),t)}return Qr(e,t)},Ln.reduce=function(e,t,n){var r=Ga(e)?kt:Lt,i=arguments.length<3;return r(e,ao(t,4),n,i,fr)},Ln.reduceRight=function(e,t,n){var r=Ga(e)?At:Lt,i=arguments.length<3;return r(e,ao(t,4),n,i,pr)},Ln.repeat=function(e,t,n){return t=(n?vo(e,t,n):t===i)?1:gs(t),qr(_s(e),t)},Ln.replace=function(){var e=arguments,t=_s(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=mi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=d,r=vn(e,d);t=ao(t),e-=d;for(var i=Vt(r,t);++n=a)return e;var c=n-on(r);if(c<1)return r;var u=s?_i(s,0,c).join(""):e.slice(0,c);if(o===i)return u+r;if(s&&(c+=u.length-c),as(o)){if(e.slice(c).search(o)){var l,f=u;for(o.global||(o=Pe(o.source,_s(pe.exec(o))+"g")),o.lastIndex=0;l=o.exec(f);)var p=l.index;u=u.slice(0,p===i?c:p)}}else if(e.indexOf(si(o),c)!=c){var d=u.lastIndexOf(o);d>-1&&(u=u.slice(0,d))}return u+r},Ln.unescape=function(e){return(e=_s(e))&&q.test(e)?e.replace(G,cn):e},Ln.uniqueId=function(e){var t=++Re;return _s(e)+t},Ln.upperCase=Ks,Ln.upperFirst=Js,Ln.each=_a,Ln.eachRight=Ta,Ln.first=qo,cc(Ln,(vc={},_r(Ln,(function(e,t){Oe.call(Ln.prototype,t)||(vc[t]=e)})),vc),{chain:!1}),Ln.VERSION="4.17.21",_t(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),_t(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:mn(gs(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=vn(n,r.__takeCount__):r.__views__.push({size:vn(n,d),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),_t(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ao(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),_t(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),_t(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ic)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Hr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Mr(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Da(ao(e)))},Un.prototype.slice=function(e,t){e=gs(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=gs(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(d)},_r(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,c=t instanceof Un,u=s[0],l=c||Ga(t),f=function(e){var t=o.apply(Ln,St([e],s));return r&&p?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var p=this.__chain__,d=!!this.__actions__.length,h=a&&!p,g=c&&!d;if(!a&&l){t=g?t:new Un(this);var y=e.apply(t,s);return y.__actions__.push({func:ha,args:[f],thisArg:i}),new Bn(y,p)}return h&&g?e.apply(this,s):(y=this.thru(f),h?r?y.value()[0]:y.value():y)})})),_t(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ae[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Ga(i)?i:[],e)}return this[n]((function(n){return t.apply(Ga(n)?n:[],e)}))}})),_r(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Oe.call(xn,r)||(xn[r]=[]),xn[r].push({name:t,func:n})}})),xn[Wi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=ki(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ki(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ki(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ga(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Vn;){var r=Fo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:ha,args:[ta],thisArg:i}),new Bn(t,this.__chain__)}return this.thru(ta)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return pi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,at&&(Ln.prototype[at]=function(){return this}),Ln}();ot._=un,(r=function(){return un}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},904:(e,t)=>{"use strict";var n;let r;Object.defineProperty(t,"__esModule",{value:!0}),t.setDomain=t.getDomain=t.Domain=void 0,function(e){e[e.FA=0]="FA",e[e.FORM=1]="FORM",e[e.ETS=2]="ETS"}(n||(n={})),t.Domain=n,t.setDomain=e=>{r=e},t.getDomain=()=>null!=r?r:n.FA},784:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.errorMap=void 0,t.errorMap=new Map([["fileError","Visual file is damaged"],["versionError","Version number of visual file does not match"],["modelError","Visual model in visual file is damaged"],["codegenError","Codegen visual file failed"]])},117:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNode=void 0,t.ASTNode=class{accept(e){return e.visit(this)}}},862:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Cache=void 0,t.Cache=class{constructor(e,t=0){this.value="",this.indent=t,this.flag=!0,this.INDENT=e}indentOn(){this.flag=!0}indentOff(){this.flag=!1}incIndent(){this.indent++}decIndent(){this.indent--}checkIndent(){return this.indent<0}getIndents(){if(this.flag){let e="";for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=void 0;const r=n(117);class i extends r.ASTNode{constructor(e,t,n,r,i){super(),this.defaultValue=new Map,this.mediaParams=new Map,this.mediaProperties=new Map,this.mediaKeyProperty=new Map,this.tagName=e,this.params=t,this.content=n,this.properties=r,this.forEachObj=i,this.ifBoolean=null}setMediaParams(e){this.mediaParams=e}setParams(e){this.params=e}setIfBoolean(e){this.ifBoolean=e}setTagName(e){this.tagName=e}setForEachObj(e){this.forEachObj=e}setMediaProperty(e,t){t.forEach(((t,n)=>{var r;this.mediaKeyProperty.has(n)||this.mediaKeyProperty.set(n,new Map),null===(r=this.mediaKeyProperty.get(n))||void 0===r||r.set(e,t)}))}setDefaultValue(e,t,n="undefined"){this.defaultValue.set(e,[n,t])}}t.Tag=i},623:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNodeGenerator=void 0;const r=n(519),i=n(862),o=n(51),a=n(294);class s{constructor(e){this.cache=e,this.etsImport=new i.Cache(" ",1),this.etsVariable=new i.Cache(" ",1),this.etsFunction=new i.Cache(" ",1),this.aboutToAppear=new i.Cache(" ",2),this.needMediaQuery=!0}visit(e){e instanceof r.Tag&&(this.needMediaQuery&&this.genMediaQuery(e),this.genTag(e))}static getMethodGen(e){return void 0===s.instance?s.instance=new s(e):s.instance.setCache(e),s.instance}setCache(e){this.cache=e,this.etsImport=new i.Cache(" ",1),this.etsVariable=new i.Cache(" ",1),this.etsFunction=new i.Cache(" ",1),this.aboutToAppear=new i.Cache(" ",2),this.needMediaQuery=!0}genParams(e){if("string"==typeof e)this.cache.concat(e);else if(e.size>0){this.cache.concat(o.TokenClass.LBRA,o.TokenClass.SPACE);let t=0;e.forEach(((n,r)=>{this.cache.concat(r,o.TokenClass.COLON,o.TokenClass.SPACE,n),t++,t{this.cache.concat(r,o.TokenClass.COLON,o.TokenClass.SPACE,n),t++,t{e.accept(this),this.cache.indentOff(),this.cache.concat(o.TokenClass.NEW_LINE),this.cache.indentOn()})),this.cache.decIndent(),this.cache.indentOn()),this.cache.indentOn(),this.cache.concat(o.TokenClass.RBRA)),(null!==e.properties||null!==e.mediaProperties)&&(null!==e.content&&0!==e.content.length||this.cache.incIndent(),this.getProperties(e).forEach(((e,t)=>{this.cache.concat(o.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.concat(o.TokenClass.PROPERTY_START,t,o.TokenClass.TAG_START),this.cache.indentOff(),"string"==typeof e?this.cache.concat(e,o.TokenClass.TAG_END):this.genObjectProperty(e)})),null!==e.content&&0!==e.content.length||this.cache.decIndent()),this.genEnd(e)}genStart(e){this.genIfStart(e),this.genForTagStart(e)}genEnd(e){this.genForTagEnd(e),this.genIfEnd(e)}genForTagStart(e){var t;if(void 0!==(null===(t=e.forEachObj)||void 0===t?void 0:t.for)){const t="item",n="idx";this.cache.concat("ForEach",o.TokenClass.TAG_START,e.forEachObj.for.toString(),o.TokenClass.COMMA,o.TokenClass.NEW_LINE),this.cache.concat(o.TokenClass.TAG_START,t,o.TokenClass.COLON," any",o.TokenClass.COMMA," ",n,o.TokenClass.COLON," number",o.TokenClass.TAG_END," => ",o.TokenClass.LBRA,o.TokenClass.NEW_LINE)}}genForTagEnd(e){null!==e.forEachObj&&(this.cache.concat(o.TokenClass.RBRA),void 0!==e.forEachObj.key&&null!==e.forEachObj.key&&(this.cache.concat(o.TokenClass.COMMA,o.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.concat(e.forEachObj.key.toString()),this.cache.indentOff()),this.cache.concat(o.TokenClass.TAG_END))}genIfStart(e){null!==e.ifBoolean&&(this.cache.concat("if",o.TokenClass.SPACE,o.TokenClass.TAG_START,e.ifBoolean.toString(),o.TokenClass.TAG_END,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),this.cache.incIndent())}genIfEnd(e){null!==e.ifBoolean&&(this.cache.indentOn(),this.cache.decIndent(),this.cache.concat(o.TokenClass.NEW_LINE),this.cache.concat(o.TokenClass.RBRA),this.cache.indentOff())}genMediaQuery(e){const t=new Map,n=new Map;if(this.collectMediaQueryMap(e,t),this.collectDefaultValueMap(e,n),0===t.size&&0===n.size)return;const r=(0,a.getUniqueName)("mediaQuery"),s=(0,a.getUniqueName)("initForMediaQuery"),c=(0,a.getUniqueName)("mediaQueryCb"),u=(0,a.getUniqueName)("saveMediaQueryResult"),l=(0,a.getUniqueName)("updateForMediaQuery"),f=new i.Cache(o.TokenClass.INDENT,1),p=new i.Cache(o.TokenClass.INDENT,1),d=new i.Cache(o.TokenClass.INDENT,1),h=new i.Cache(o.TokenClass.INDENT,1),g=new i.Cache(o.TokenClass.INDENT,1),y=new i.Cache(o.TokenClass.INDENT,1),m=new i.Cache(o.TokenClass.INDENT,1),v=new i.Cache(o.TokenClass.INDENT,2);this.genVariableDeclare(n,f),this.genMediaQueryCb(c,p),this.genMediaQueryListener(t,d,h),this.genInitFuc(s,n,g),this.genMediaQueryCbFnc(u,l,t,y),this.genUpdateFnc(l,s,t,m),this.genAboutToAppear(c,u,t,v),this.etsImport.indentOff(),this.aboutToAppear.indentOff(),this.etsVariable.indentOff(),this.etsFunction.indentOff(),this.etsImport.indentOff(),this.etsImport.concat("import ",r," from '@ohos.mediaquery'"),this.aboutToAppear.concat(v.toString()),this.etsVariable.concat(f.toString(),p.toString(),d.toString(),h.toString()),this.etsFunction.concat(y.toString(),o.TokenClass.NEW_LINE,g.toString(),o.TokenClass.NEW_LINE,m.toString()),this.etsImport.indentOn(),this.aboutToAppear.indentOn(),this.etsVariable.indentOn(),this.etsFunction.indentOn(),this.needMediaQuery=!1}genVariableDeclare(e,t){e.forEach(((e,n)=>{t.concat(o.TokenClass.DECORATOR_STATE,o.TokenClass.SPACE,n.slice(5),o.TokenClass.COLON,o.TokenClass.SPACE,e[1],o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,o.TokenClass.UNDEFINED,o.TokenClass.NEW_LINE)}))}genMediaQueryCb(e,t){t.concat(e,o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,o.TokenClass.NULL,o.TokenClass.NEW_LINE)}genMediaQueryListener(e,t,n){const r=(0,a.getUniqueName)("mediaQuery");e.forEach(((e,i)=>{const s=(0,a.getUniqueName)(this.getMediaQueryVariableName(i));t.concat(s,o.TokenClass.COLON,o.TokenClass.SPACE,o.TokenClass.BOOLEAN,o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,o.TokenClass.FALSE,o.TokenClass.NEW_LINE),n.concat(`listener_${s}`,o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,r,o.TokenClass.PROPERTY_START,"matchMediaSync",o.TokenClass.TAG_START,`'${i}'`,o.TokenClass.TAG_END,o.TokenClass.NEW_LINE)}))}genInitFuc(e,t,n){n.concat(e,o.TokenClass.TAG_START,o.TokenClass.TAG_END,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),n.indentOn(),n.incIndent(),t.forEach(((e,t)=>{n.concat(t,o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,e[0],o.TokenClass.NEW_LINE)})),n.decIndent(),n.concat(o.TokenClass.RBRA,o.TokenClass.NEW_LINE)}genMediaQueryCbFnc(e,t,n,r){const i=Array.from(n.entries());r.concat(e,o.TokenClass.TAG_START,"mediaQueryResult",o.TokenClass.TAG_END,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),r.incIndent(),r.concat(o.TokenClass.SWITCH,o.TokenClass.SPACE,o.TokenClass.TAG_START,"mediaQueryResult.media",o.TokenClass.TAG_END,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),r.incIndent();for(let e=0;e{const n=(0,a.getUniqueName)(this.getMediaQueryVariableName(t));r.concat(o.TokenClass.IF,o.TokenClass.SPACE,o.TokenClass.TAG_START,o.TokenClass.THIS,o.TokenClass.PROPERTY_START,n,o.TokenClass.TAG_END,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),r.incIndent(),e.forEach(((e,t)=>{r.concat(t,o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,e,o.TokenClass.NEW_LINE)})),r.decIndent(),r.concat(o.TokenClass.RBRA,o.TokenClass.NEW_LINE)})),r.decIndent(),r.concat(o.TokenClass.RBRA,o.TokenClass.NEW_LINE)}genAboutToAppear(e,t,n,r){let i=1;r.concat(o.TokenClass.THIS,o.TokenClass.PROPERTY_START,e,o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,o.TokenClass.THIS,o.TokenClass.PROPERTY_START,`${t}.bind(this)`,o.TokenClass.NEW_LINE),n.forEach(((t,s)=>{const c=`listener_${(0,a.getUniqueName)(this.getMediaQueryVariableName(s))}`;r.indentOn(),r.concat(o.TokenClass.THIS,o.TokenClass.PROPERTY_START,c,o.TokenClass.PROPERTY_START,`on('change', this.${e})`),i0?e.mediaParams:e.params}getProperties(e){const t=new Map;return e.properties.forEach(((e,n)=>{t.set(n,e)})),e.mediaProperties.forEach(((e,n)=>{t.set(n,e)})),t}collectDefaultValueMap(e,t){void 0!==e.defaultValue&&e.defaultValue.forEach(((e,n)=>{t.set(n,e)})),null!==e.content&&0!==e.content.length&&e.content.forEach((e=>{this.collectDefaultValueMap(e,t)}))}collectMediaQueryMap(e,t){void 0!==e.mediaKeyProperty&&e.mediaKeyProperty.forEach(((e,n)=>{var r;const i=null!==(r=t.get(n))&&void 0!==r?r:new Map;e.forEach(((e,t)=>{i.set(t,e)})),t.set(n,i)})),null!==e.content&&0!==e.content.length&&e.content.forEach((e=>{this.collectMediaQueryMap(e,t)}))}getMediaQueryVariableName(e){const t="device-type: ",n="orientation: ",r=e.substring(e.indexOf(t),e.length),i=r.substring(t.length,r.indexOf(")")),o=e.substring(e.indexOf(n),e.length),a=o.substring(n.length,o.indexOf(")"));return`${i}${a.slice(0,1).toUpperCase()+a.slice(1).toLowerCase()}`}}t.ASTNodeGenerator=s,s.instance=void 0},413:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ETSBridge=void 0;const r=n(519),i=n(973),o=n(497);t.ETSBridge=class{constructor(){this.errors=0}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}visit(e){const t=new Map;let n=null;const a=new Map,s=new r.Tag(e.type,t,n,a,null);if((0,i.parseVisualModel)(e,s),(0,o.parseMediaVisualModel)(e,s),e.children.length>0){n=[];for(const t of e.children)n.push(t.accept(this))}return s.content=n,s}}},459:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.genETS=void 0;const r=n(623),i=n(862);t.genETS=function(e){const t=r.ASTNodeGenerator.getMethodGen(new i.Cache(" ",2));return e.accept(t),{build:t.cache.toString(),etsImport:t.etsImport.toString(),etsVariable:t.etsVariable.toString(),etsFunction:t.etsFunction.toString(),aboutToAppear:t.aboutToAppear.toString()}}},435:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringWriter=void 0;const r=n(459);t.StringWriter=class{genETS(e){return(0,r.genETS)(e)}}},51:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenClass=void 0,(n=t.TokenClass||(t.TokenClass={}))[n.IDENTIFIER=0]="IDENTIFIER",n[n.STRING_LITERAL=1]="STRING_LITERAL",n[n.NUMBER=2]="NUMBER",n[n.CHARACTER=3]="CHARACTER",n[n.EOF=4]="EOF",n[n.INVALID=5]="INVALID",n.EMPTY_DATA="empty",n.ASSIGN="=",n.INDENT=" ",n.NEW_LINE="\n",n.CARRIAGE_RETURN="\r",n.SPACE=" ",n.LQUOTE="'",n.RQUOTE="'",n.TAG_START="(",n.TAG_END=")",n.EMPTY_TAG_END="/>",n.END_TAG_START="{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMediaProperty=t.parseMediaVisualModel=void 0;const r=n(294),i=n(973),o=(0,i.curry)(((e,t)=>t.hasMediaProperty(e))),a=(0,i.curry)(((e,t,n)=>n.type===e&&n.hasMediaProperty(t)));function s(e,t,n){const r=t.get(n);return void 0!==r&&r.has(e)}function c(e){return`'${e}'`}function u(e){return isNaN(Number(e))?(0,i.getEtsEnumValue)("FontWeight.",e):e}function l(e){let t=(0,i.getEtsEnumValue)("FlexAlign.",e);return"flex-start"===e?t="FlexAlign.Start":"flex-end"===e&&(t="FlexAlign.End"),t}function f(e){return"TextOverflow."+(0,i.firstUpperCase)(e)}function p(e,t,n){var r,o;const a=new Map,s=null!==(r=e.mediaProperty)&&void 0!==r?r:new Map,c=null!==(o=e.dynamicMediaProperty)&&void 0!==o?o:new Map;return s.forEach(((e,r)=>{let o=e.get(t);const s=e.get(n);(0,i.isEmptyOrUndefined)(o)&&(0,i.isEmptyOrUndefined)(s)||(o="0"===o||(0,i.isEmptyOrUndefined)(o)?"0":o.substring(0,o.length-2),a.set(r,o))})),c.forEach(((e,n)=>{const r=e.get(t);(0,i.isEmptyOrUndefined)(r)||a.set(n,r)})),a}function d(e,t){const n=e.get("left"),r=e.get("top"),o=t.get("left"),a=t.get("top");let s="undefined",c="undefined";return(0,i.isEmptyOrUndefined)(n)&&(0,i.isEmptyOrUndefined)(r)||(s=`'${null!=n?n:0}'`,c=`'${null!=r?r:0}'`),(0,i.isEmptyOrUndefined)(o)&&(0,i.isEmptyOrUndefined)(a)||(s=null!=o?o:s,c=null!=a?a:c),{leftValue:s,topValue:c}}function h(e,t){e.forEach(((e,n)=>{"undefined"!==e&&t.set(n,"undefined")}))}function g(e,t){var n,r;const i=new Map,o=t.split("-")[0];return(null!==(n=e.mediaProperty)&&void 0!==n?n:new Map).forEach(((n,r)=>{var a,s,u,l;const f=n.get(o),p=null===(s=null===(a=e.dynamicMediaProperty)||void 0===a?void 0:a.get(r))||void 0===s?void 0:s.get(o),d=null!==(l=null!==(u=n.get(t))&&void 0!==u?u:p)&&void 0!==l?l:f;void 0!==d&&i.set(r,c(d))})),(null!==(r=e.dynamicMediaProperty)&&void 0!==r?r:new Map).forEach(((e,n)=>{var r;const a=e.get(o),s=null!==(r=e.get(t))&&void 0!==r?r:a;void 0!==s&&i.set(n,s)})),i}function y(e,t,n){var r,o;const a=new Map;return(null!==(r=e.mediaProperty)&&void 0!==r?r:new Map).forEach(((e,r)=>{let o=e.get(t);(0,i.isEmptyOrUndefined)(o)||("function"==typeof n&&(o=n(o)),(0,i.isEmptyOrUndefined)(o)||a.set(r,o))})),(null!==(o=e.dynamicMediaProperty)&&void 0!==o?o:new Map).forEach(((e,n)=>{let r=e.get(t);void 0===r||"content"!==t&&"label"!==t||(r=""===r?"''":(0,i.getContentName)(r)),(0,i.isEmptyOrUndefined)(r)||a.set(n,r)})),a}function m(e,t){const n=`this.${(0,i.getEtsPropName)(e)}${(0,i.firstUpperCase)((0,i.getEtsPropName)(t))}`;return`${n}_${(0,r.getUniqueId)(n)}`}function v(e,t,n){const r=e.property.get(t),o=e.dynamicProperty.get(t);let a="undefined";return(0,i.isEmptyOrUndefined)(r)||(a="function"==typeof n?n(r):r,a=(0,i.isEmptyOrUndefined)(a)?"undefined":a),(0,i.isEmptyOrUndefined)(o)||(a=o),a}const _=(0,i.curry)(((e,t,n)=>{const r=y(t,e,c);if(0===r.size)return;const o=v(t,e,c),a=m(t.id,e);n.setDefaultValue(a,"string",o),n.setMediaProperty(a,r),n.mediaProperties.set((0,i.getEtsPropName)(e),a)})),T=(0,i.curry)(((e,t,n)=>{const r=y(t,e);if(0===r.size)return;const o=v(t,e),a=m(t.id,e);n.setDefaultValue(a,"number",o),n.setMediaProperty(a,r),n.mediaProperties.set((0,i.getEtsPropName)(e),a)})),w=(0,i.curry)(((e,t,n)=>{const r=y(t,e);if(0===r.size)return;const o=v(t,e),a=m(t.id,e);n.setDefaultValue(a,"boolean",o),n.setMediaProperty(a,r),n.mediaProperties.set((0,i.getEtsPropName)(e),a)})),b=(0,i.curry)(((e,t,n,r)=>{const o=y(n,e,(0,i.curry)(i.getEtsEnumValue)(t));if(0===o.size)return;const a=v(n,e,(0,i.curry)(i.getEtsEnumValue)(t)),s=m(n.id,e);r.setDefaultValue(s,t.replace(".",""),a),r.setMediaProperty(s,o),r.mediaProperties.set((0,i.getEtsPropName)(e),s)})),E=(0,i.curry)(((e,t,n)=>{const r=y(t,e,c);if(!(n.mediaParams instanceof Map)||0===r.size)return;const o=v(t,e,c),a=m(t.id,e);n.setDefaultValue(a,"string",o),n.setMediaProperty(a,r),n.mediaParams.set((0,i.getEtsPropName)(e),a)})),C=(0,i.curry)(((e,t,n)=>{const r=y(t,e);if(!(n.mediaParams instanceof Map)||0===r.size)return;const o=v(t,e),a=m(t.id,e);n.setDefaultValue(a,"number",o),n.setMediaProperty(a,r),n.mediaParams.set((0,i.getEtsPropName)(e),a)})),P=(0,i.curry)(((e,t,n,r)=>{const o=y(n,e,(0,i.curry)(i.getEtsEnumValue)(t));if(!(r.mediaParams instanceof Map)||0===o.size)return;const a=v(n,e,(0,i.curry)(i.getEtsEnumValue)(t)),s=m(n.id,e);r.setDefaultValue(s,t.replace(".",""),a),r.setMediaProperty(s,o),r.mediaParams.set((0,i.getEtsPropName)(e),s)})),S=(0,i.curry)(((e,t,n)=>{const r=y(t,e,i.dealWithColor);if(0===r.size)return;const o=v(t,e,i.dealWithColor),a=m(t.id,e);n.setDefaultValue(a,"Color | string",o),n.setMediaProperty(a,r),n.mediaProperties.set((0,i.getEtsPropName)(e),a)}));function k(e,t,n,r=!1){(0,i.isEmptyOrUndefined)(t)||n.set(e,r?t:`'${t}'`)}t.parseMediaVisualModel=function(e,t){!function(e,t){var n;const r=null!==(n=e.dynamicProperty.get("for"))&&void 0!==n?n:"[1]",i=y(e,"for");if(0===i.size)return;const o=m(e.id,"for"),a={for:o,key:e.dynamicProperty.get("keyGenerator")};t.setDefaultValue(o,"any[]",r),t.setMediaProperty(o,i),t.setForEachObj(a)}(e,t),function(e,t){const n=y(e,"if");if(0===n.size)return;const r=v(e,"if"),i=m(e.id,"if");t.setDefaultValue(i,"boolean",r),t.setMediaProperty(i,n),t.setIfBoolean(i)}(e,t);for(const n of N)("boolean"==typeof n[0]||n[0](e))&&n[1](e,t)};const A=(0,i.curry)(((e,t,n)=>{const r=new Map,o=t.property.get(e),a=t.dynamicProperty.get(e),s=null!=a?a:o,u=["top","bottom","left","right"];let l=0;for(const o of u){const a=`${e}-${o}`,u=t.property.get(a),f=t.dynamicProperty.get(a),p=g(t,a);let d=(0,i.isEmptyOrUndefined)(s)?"undefined":c(s);if((0,i.isEmptyOrUndefined)(u)||(d=c(u)),(0,i.isEmptyOrUndefined)(f)||(d=f),p.size>0){const e=m(t.id,a);n.setDefaultValue(e,"string",d),n.setMediaProperty(e,p),k(o,e,r,!0),l++}else k(o,d,r,!0)}l>0&&n.mediaProperties.set(e,r)})),M=(0,i.curry)(((e,t,n,r)=>{const o=y(n,e,l);if(!(r.mediaParams instanceof Map)||0===o.size)return;const a=v(n,e,l),s=m(n.id,e);r.setDefaultValue(s,t.replace(".",""),a),r.setMediaProperty(s,o),r.mediaParams.set((0,i.getEtsPropName)(e),s)})),x=(0,i.curry)(((e,t)=>t.type===e));t.isMediaProperty=function(e,t){return!s(e,I,"common")&&!s(e,I,t)&&!s(e,I,"events")};const I=new Map([["common",new Set(["keyGenerator"])],["events",new Set([...i.events])]]),N=[...[[o("width"),_("width")],[o("height"),_("height")],[function(e){return e.hasMediaProperty("constraint-size-min-width")||e.hasMediaProperty("constraint-size-max-width")||e.hasMediaProperty("constraint-size-min-height")||e.hasMediaProperty("constraint-size-min-height")},function(e,t){const n=new Map,r=["min-width","max-width","min-height","max-height"];for(const o of r){const r=`constraint-size-${o}`,a=y(e,r,c),s=v(e,r,c);if(a.size>0){const c=m(e.id,r);t.setDefaultValue(c,"string",s),t.setMediaProperty(c,a),k((0,i.getEtsPropName)(o),c,n,!0)}}n.size>0&&t.mediaProperties.set("constraintSize",n)}],[o("align"),b("align","Alignment.")],[o("direction"),b("direction","Direction.")],[function(e){return e.hasMediaProperty("left")||e.hasMediaProperty("top")},function(e,t){var n;const r=null!==(n=e.property.get("position"))&&void 0!==n?n:"relative",{leftValue:i,topValue:o}=d(e.property,e.dynamicProperty),{mediaPositionLeft:a,mediaPositionTop:s,mediaOffsetLeft:c,mediaOffsetTop:u}=function(e){var t,n;const r=new Map,i=new Map,o=new Map,a=new Map,s=null!==(t=e.mediaProperty)&&void 0!==t?t:new Map,c=null!==(n=e.dynamicMediaProperty)&&void 0!==n?n:new Map,u=new Set;for(const[e]of s)u.add(e);for(const[e]of c)u.add(e);return u.forEach((t=>{var n,s,c,u;const l=null!==(s=null===(n=e.mediaProperty)||void 0===n?void 0:n.get(t))&&void 0!==s?s:new Map,f=null!==(u=null===(c=e.dynamicMediaProperty)||void 0===c?void 0:c.get(t))&&void 0!==u?u:new Map,p=l.get("position"),{leftValue:h,topValue:g}=d(l,f);"absolute"===p?("undefined"!==h&&r.set(t,h),"undefined"!==g&&i.set(t,g)):("undefined"!==h&&o.set(t,h),"undefined"!==g&&a.set(t,g))})),{mediaPositionLeft:r,mediaPositionTop:i,mediaOffsetLeft:o,mediaOffsetTop:a}}(e),l=a.size>0||s.size>0||"absolute"===r,f=c.size>0||u.size>0||"relative"===r,p=m(e.id,"positionLeft"),g=m(e.id,"positionTop"),y=m(e.id,"offsetLeft"),v=m(e.id,"offsetTop");if(0!==a.size||0!==s.size||0!==u.size||0!==c.size){if(l&&f&&(h(a,c),h(c,a),h(s,u),h(u,s)),l){const e="absolute"===r?i:"undefined",n="absolute"===r?o:"undefined";t.setDefaultValue(p,"string",e),t.setDefaultValue(g,"string",n),t.setMediaProperty(p,a),t.setMediaProperty(g,s),t.mediaProperties.set("position",new Map([["x",p],["y",g]]))}if(f){const e="relative"===r?i:"undefined",n="relative"===r?o:"undefined";t.setDefaultValue(y,"string",e),t.setDefaultValue(v,"string",n),t.setMediaProperty(y,c),t.setMediaProperty(v,u),t.mediaProperties.set("offset",new Map([["x",y],["y",v]]))}}}],[o("aspect-ratio"),T("aspect-ratio")],[o("display-priority"),T("display-priority")],[o("flex-basis"),_("flex-basis")],[o("flex-grow"),T("flex-grow")],[o("flex-shrink"),T("flex-shrink")],[o("align-self"),function(e,t){const n=y(e,"align-self",i.dealWithAlignSelf);if(0===n.size)return;const r=v(e,"align-self",i.dealWithAlignSelf),o=m(e.id,"align-self");t.setDefaultValue(o,"ItemAlign",r),t.setMediaProperty(o,n),t.mediaProperties.set("alignSelf",o)}],[o("border-style"),b("border-style","BorderStyle.")],[o("border-width"),_("border-width")],[o("border-color"),S("border-color")],[o("border-radius"),_("border-radius")],[o("background-color"),S("background-color")],[function(e){return e.hasMediaProperty("background-image-src")||e.hasMediaProperty("background-image-repeat")},function(e,t){const n=e.property.get("background-image-src"),r=e.property.get("background-image-repeat"),o=e.dynamicProperty.get("background-image-src"),a=e.dynamicProperty.get("background-image-repeat"),s=y(e,"background-image-src",i.dealWithSrc),c=y(e,"background-image-repeat",i.dealWithBackgroundRepeat);if(0===s.size&&0===c.size)return;let u=(0,i.dealWithSrc)(null!=n?n:"");if((0,i.isEmptyOrUndefined)(o)||(u=o),s.size>0){const n=m(e.id,"background-image-src");t.setDefaultValue(n,"string",u),t.setMediaProperty(n,s),u=n}let l="undefined";if(!(0,i.isEmptyOrUndefined)(r)){const e=(0,i.dealWithBackgroundRepeat)(r);null!=e&&""!==e&&(l=e)}if((0,i.isEmptyOrUndefined)(a)||(l=a),c.size>0){const n=m(e.id,"background-image-repeat");t.setDefaultValue(n,"string",l),t.setMediaProperty(n,c),l=n}t.mediaProperties.set("backgroundImage",u+", "+l)}],[o("background-image-size"),function(e,t){const n=y(e,"background-image-size",i.dealWithBackgroundImageSize);if(0===n.size)return;const r=v(e,"background-image-size",i.dealWithBackgroundImageSize),o=m(e.id,"background-image-size");t.setDefaultValue(o,"{ width?: string | number, height?: string | number } | ImageSize",r),t.setMediaProperty(o,n),t.mediaProperties.set("backgroundImageSize",o)}],[o("background-image-position"),function(e,t){const n=y(e,"background-image-position",i.dealWithBackgroundImagePosition);if(0===n.size)return;const r=v(e,"background-image-position",i.dealWithBackgroundImagePosition),o=m(e.id,"background-image-position");t.setDefaultValue(o,"{ x?: number | string, y?: number | string } | Alignment",r),t.setMediaProperty(o,n),t.mediaProperties.set("backgroundImagePosition",o)}],[o("opacity"),T("opacity")],[o("visibility"),b("visibility","Visibility.")],[o("enabled"),w("enabled")],[o("font-color"),S("font-color")],[o("font-size"),_("font-size")],[o("font-style"),b("font-style","FontStyle.")],[o("font-weight"),function(e,t){const n=y(e,"font-weight",i.dealWithFontWeight);if(0===n.size)return;const r=v(e,"font-weight",i.dealWithFontWeight),o=m(e.id,"font-weight");t.setDefaultValue(o,"FontWeight | string",r),t.setMediaProperty(o,n),t.mediaProperties.set("fontWeight",o)}],[o("font-family"),_("font-family")],[function(e){return e.hasMediaProperty("margin")||e.hasMediaProperty("margin-left")||e.hasMediaProperty("margin-top")||e.hasMediaProperty("margin-right")||e.hasMediaProperty("margin-bottom")},A("margin")],[function(e){return e.hasMediaProperty("padding")||e.hasMediaProperty("padding-left")||e.hasMediaProperty("padding-top")||e.hasMediaProperty("padding-right")||e.hasMediaProperty("padding-bottom")},A("padding")]],[a("button","label"),function(e,t){const n=e.property.get("label"),r=e.dynamicProperty.get("label"),o=y(e,"label",(e=>`\`${e}\``));if(0===o.size)return;let a="undefined";(0,i.isEmptyOrUndefined)(n)||(a=`\`${n}\``),(0,i.isEmptyOrUndefined)(r)||(a=(0,i.getContentName)(a));const s=m(e.id,"label");t.setDefaultValue(s,"string",a),t.setMediaProperty(s,o),t.setMediaParams(s)}],[a("button","type"),b("type","ButtonType.")],[a("button","state-effect"),w("state-effect")],[a("divider","vertical"),w("vertical")],[a("divider","color"),S("color")],[a("divider","stroke-width"),_("stroke-width")],[a("divider","line-cap"),b("line-cap","LineCapStyle.")],[x("image"),function(e,t){var n;const r=null!==(n=e.property.get("src"))&&void 0!==n?n:"",o=e.dynamicProperty.get("src"),a=y(e,"src",c);if(0===a.size)return;let s=(0,i.dealWithSrc)(r);(0,i.isEmptyOrUndefined)(o)||(s=o);const u=m(e.id,"src");t.setDefaultValue(u,"string",s),t.setMediaProperty(u,a),t.setMediaParams(u)}],[a("image","alt"),_("alt")],[a("image","object-fit"),b("object-fit","ImageFit.")],[a("image","object-repeat"),b("object-repeat","ImageRepeat.")],[a("image","interpolation"),b("interpolation","ImageInterpolation.")],[a("image","render-mode"),b("render-mode","ImageRenderMode.")],[function(e){return e.hasMediaProperty("source-size-width")||e.hasMediaProperty("source-size-height")},function(e,t){let n=e.property.get("source-size-width"),r=e.property.get("source-size-height");const o=e.dynamicProperty.get("source-size-width"),a=e.dynamicProperty.get("source-size-height"),s=p(e,"source-size-width","source-size-height"),c=p(e,"source-size-height","source-size-width");if(0===s.size)return;n="0"===n||(0,i.isEmptyOrUndefined)(n)?"0":n.substring(0,n.length-2),r="0"===r||(0,i.isEmptyOrUndefined)(r)?"0":r.substring(0,r.length-2),(0,i.isEmptyOrUndefined)(o)||(n=o),(0,i.isEmptyOrUndefined)(a)||(r=a);const u=m(e.id,"source-size-width"),l=m(e.id,"source-size-height");t.setDefaultValue(u,"number",n),t.setDefaultValue(l,"number",r),t.setMediaProperty(u,s),t.setMediaProperty(l,c);const f=new Map([["width",u],["height",l]]);t.mediaProperties.set("sourceSize",f)}],[function(e){return"progress"===e.type&&(e.hasMediaProperty("value")||e.hasMediaProperty("total")||e.hasMediaProperty("style"))},function(e,t){const n=e.property.get("value"),r=e.dynamicProperty.get("value"),o=y(e,"value");if(!(t.mediaParams instanceof Map)||0===o.size)return;let a=null!=n?n:"0";(0,i.isEmptyOrUndefined)(r)||(a=r);const s=m(e.id,"value");t.setDefaultValue(s,"number",a),t.setMediaProperty(s,o),t.mediaParams.set("value",s)}],[a("progress","total"),C("total")],[a("progress","style"),P("style","ProgressStyle.")],[a("progress","color"),S("color")],[a("slider","value"),C("value")],[a("slider","min"),C("min")],[a("slider","max"),C("max")],[a("slider","step"),C("step")],[a("slider","style"),P("style","SliderStyle.")],[a("slider","block-color"),S("block-color")],[a("slider","track-color"),S("track-color")],[a("slider","selected-color"),S("selected-color")],[a("slider","show-steps"),w("show-steps")],[a("slider","show-tips"),w("show-tips")],[a("text","content"),function(e,t){const n=e.property.get("content"),r=e.dynamicProperty.get("content"),o=y(e,"content",(e=>`\`${e}\``));if(0===o.size)return;let a="''";(0,i.isEmptyOrUndefined)(n)||(a=`\`${n}\``),(0,i.isEmptyOrUndefined)(r)||(a=(0,i.getContentName)(r));const s=m(e.id,"content");t.setDefaultValue(s,"string",a),t.setMediaProperty(s,o),t.setMediaParams(s)}],[a("text","text-align"),b("text-align","TextAlign.")],[a("text","text-overflow"),function(e,t){const n=y(e,"text-overflow",f);if(0===n.size)return;const r=v(e,"text-overflow",f),i=m(e.id,"text-overflow");t.setDefaultValue(i,"TextOverflow",r),t.setMediaProperty(i,n),t.mediaProperties.set("textOverflow",new Map([["overflow",i]]))}],[a("text","max-lines"),T("max-lines")],[a("text","line-height"),_("line-height")],[function(e){return"text"===e.type&&(e.hasMediaProperty("decoration-type")||e.hasMediaProperty("decoration-color"))},function(e,t){const n=y(e,"decoration-type",(0,i.curry)(i.getEtsEnumValue)("TextDecorationType.")),r=y(e,"decoration-color",i.dealWithColor);if(0===n.size&&0===r.size)return;let o=v(e,"decoration-type",(0,i.curry)(i.getEtsEnumValue)("TextDecorationType.")),a=v(e,"decoration-color",i.dealWithColor);if(n.size>0){const r=m(e.id,"decoration-type");t.setDefaultValue(r,"TextDecorationType",o),t.setMediaProperty(r,n),o=r}if(r.size>0){const n=m(e.id,"decoration-color");t.setDefaultValue(n,"Color | string",a),t.setMediaProperty(n,r),a=n}const s=new Map([["type",o]]);t.mediaProperties.set("decoration",s),"undefined"!==a&&s.set("color",a)}],[a("text","baseline-offset"),_("baseline-offset")],[a("text","text-case"),b("text-case","TextCase.")],[a("column","space"),E("space")],[a("column","align-items-column"),function(e,t){const n=y(e,"align-items-column",i.dealWithColumnAlignItems);if(0===n.size)return;const r=v(e,"align-items-column",i.dealWithColumnAlignItems),o=m(e.id,"align-items-column");t.setDefaultValue(o,"HorizontalAlign",r),t.setMediaProperty(o,n),t.mediaProperties.set("alignItems",o)}],[a("row","space"),E("space")],[a("row","align-items-row"),function(e,t){const n=y(e,"align-items-row",i.dealWithRowAlignItems);if(0===n.size)return;const r=v(e,"align-items-row",i.dealWithRowAlignItems),o=m(e.id,"align-items-row");t.setDefaultValue(o,"VerticalAlign",r),t.setMediaProperty(o,n),t.mediaProperties.set("alignItems",o)}],[a("flex","flex-direction"),function(e,t){const n=y(e,"flex-direction",(0,i.curry)(i.getEtsEnumValue)("FlexDirection."));if(!(t.mediaParams instanceof Map)||0===n.size)return;const r=v(e,"flex-direction",(0,i.curry)(i.getEtsEnumValue)("FlexDirection.")),o=m(e.id,"flex-direction");t.setDefaultValue(o,"FlexDirection",r),t.setMediaProperty(o,n),t.mediaParams.set("direction",o)}],[a("flex","wrap"),function(e,t){const n=y(e,"wrap",i.dealWithWrap);if(!(t.mediaParams instanceof Map)||0===n.size)return;const r=v(e,"wrap",i.dealWithWrap),o=m(e.id,"wrap");t.setDefaultValue(o,"FlexWrap",r),t.setMediaProperty(o,n),t.mediaParams.set("wrap",o)}],[a("flex","justify-content"),M("justify-content","FlexAlign.")],[a("flex","align-items-flex"),function(e,t){const n=y(e,"align-items-flex",i.dealWithFlexAlignItems);if(!(t.mediaParams instanceof Map)||0===n.size)return;const r=v(e,"align-items-flex",i.dealWithFlexAlignItems),o=m(e.id,"align-items-flex");t.setDefaultValue(o,"ItemAlign",r),t.setMediaProperty(o,n),t.mediaParams.set("alignItems",o)}],[a("flex","align-content"),M("align-content","FlexAlign.")],[a("list","space-list"),function(e,t){const n=y(e,"space-list");if(!(t.mediaParams instanceof Map)||0===n.size)return;const r=v(e,"space-list"),i=m(e.id,"space-list");t.setDefaultValue(i,"number",r),t.setMediaProperty(i,n),t.mediaParams.set("space",i)}],[a("list","initial-index"),C("initial-index")],[a("list","list-direction"),b("list-direction","Axis.")],[function(e){return"list"===e.type&&(e.hasMediaProperty("divider-stroke-width")||e.hasMediaProperty("divider-color")||e.hasMediaProperty("divider-start-margin")||e.hasMediaProperty("divider-end-margin"))},function(e,t){const n=[["divider-stroke-width",c],["divider-color",i.dealWithColor],["divider-start-margin",c],["divider-end-margin",c]];let r=0;const o=new Map;for(const[a,s]of n){const n=y(e,a,s),c=(0,i.getEtsPropName)(a.replace("divider-",""));let u=v(e,a,s);if("undefined"===u&&"divider-stroke-width"===a&&(u="0"),n.size>0){const i=m(e.id,a);t.setDefaultValue(i,"string",u),t.setMediaProperty(i,n),u=i,r++}o.set(c,u)}r>0&&t.mediaProperties.set("divider",o)}],[a("list","edit-mode"),w("edit-mode")],[a("list","edge-effect"),b("edge-effect","EdgeEffect.")],[a("list","chain-animation"),w("chain-animation")],[a("list-item","sticky"),b("sticky","Sticky.")],[a("list-item","editable"),w("editable")],[a("swiper","index"),T("index")],[a("swiper","auto-play"),w("auto-play")],[a("swiper","interval"),T("interval")],[a("swiper","indicator"),w("indicator")],[a("swiper","loop"),w("loop")],[a("swiper","duration"),T("duration")],[a("swiper","vertical"),w("vertical")],[a("swiper","item-space"),_("item-space")],[a("swiper","cached-count"),T("cached-count")],[a("swiper","disable-swipe"),w("disable-swipe")],[a("text-input","placeholder"),E("placeholder")],[a("text-input","textInput-type"),function(e,t){const n=y(e,"textInput-type",(0,i.curry)(i.getEtsEnumValue)("InputType."));if(0===n.size)return;const r=v(e,"textInput-type",(0,i.curry)(i.getEtsEnumValue)("InputType.")),o=m(e.id,"textInput-type");t.setDefaultValue(o,"InputType",r),t.setMediaProperty(o,n),t.mediaProperties.set("type",o)}],[a("text-input","placeholderColor"),S("placeholderColor")],[function(e){return"text-input"===e.type&&(e.hasMediaProperty("placeholderFont-size")||e.hasMediaProperty("placeholderFont-weight")||e.hasMediaProperty("placeholderFont-family")||e.hasMediaProperty("placeholderFont-style"))},function(e,t){const n=[["size","string | number",c],["weight","number | FontWeight",u],["family","string",c],["style","FontStyle",(0,i.curry)(i.getEtsEnumValue)("FontStyle.")]];let r=0;const o=new Map;for(const[i,a,s]of n){const n=`placeholderFont-${i}`,c=y(e,n,s);let u=v(e,n,s);if(c.size>0){const i=m(e.id,n);t.setDefaultValue(i,a,u),t.setMediaProperty(i,c),u=i,r++}o.set(i,u)}r>0&&t.mediaProperties.set("placeholderFont",o)}],[a("text-input","enterKeyType"),b("enterKeyType","EnterKeyType.")],[a("text-input","caretColor"),S("caretColor")],[a("text-input","maxLength"),T("maxLength")]]},973:(e,t)=>{"use strict";function n(e){return(...t)=>t.lengtht.property.has(e)||t.dynamicProperty.has(e))),i=n(((e,t,n)=>n.type===e&&(n.property.has(t)||n.dynamicProperty.has(t))));function o(e,t,n){const r=t.dynamicProperty.get(e);return void 0!==r&&""!==r.trim()&&(n.properties.set(m(e),r),!0)}const a=n(((e,t,n)=>{if(o(e,t,n))return;const r=t.property.get(e);void 0!==r&&n.properties.set(m(e),`'${r}'`)}));function s(e){return void 0===e||""===e}t.isEmptyOrUndefined=s;const c=n(((e,t,n)=>{if(o(e,t,n))return;const r=t.property.get(e);s(r)||n.properties.set(m(e),r)})),u=n(((e,t,n)=>{if(o(e,t,n))return;const r=t.property.get(e);s(r)||n.properties.set(m(e),r)})),l=n(((e,t,n,r)=>{if(o(e,n,r))return;const i=n.property.get(e);s(i)||r.properties.set(m(e),v(t,i))}));function f(e,t,n){const r=t.dynamicProperty.get(e);return void 0!==r&&""!==r.trim()&&n.params instanceof Map&&(n.params.set(m(e),r),!0)}const p=n(((e,t,n)=>{if(f(e,t,n))return;const r=t.property.get(e);void 0!==r&&n.params instanceof Map&&n.params.set(m(e),`'${r}'`)})),d=n(((e,t,n)=>{if(f(e,t,n))return;const r=t.property.get(e);!s(r)&&n.params instanceof Map&&n.params.set(m(e),r)})),h=n(((e,t,n,r)=>{if(f(e,n,r))return;const i=n.property.get(e);!s(i)&&r.params instanceof Map&&r.params.set(m(e),v(t,i))})),g=n(((e,t,n)=>{if(o(e,t,n))return;let r=t.property.get(e);s(r)||(r=_(r),n.properties.set(m(e),r))}));function y([e,...t]){return(null==e?void 0:e.toUpperCase())+t.join("")}function m(e){const t=e.split("-");let n=t[0];for(let e=1;ee[0].toUpperCase()+e.slice(1))).join(""));const r=void 0!==e.dynamicProperty.get("for")?{for:e.dynamicProperty.get("for"),key:e.dynamicProperty.get("keyGenerator")}:null;n.setForEachObj(r);const i=void 0!==e.dynamicProperty.get("if")?e.dynamicProperty.get("if"):e.property.get("if");void 0===i?n.setIfBoolean(null):n.setIfBoolean(i);for(const t of N)("boolean"==typeof t[0]||t[0](e))&&t[1](e,n);!function(e,n){for(let r of t.events){const t=e.property.get(r);"onDisappear"===r&&(r="onDisAppear"),void 0!==t&&""!==t&&n.properties.set(r,t)}}(e,n)},t.events=["onClick","onTouch","onAppear","onDisappear","onKeyEvent","onAreaChange","onItemDelete","onScrollIndex","onItemDragEnter","onItemDragMove","onItemDragLeave","onItemDragStart","onItemDrop","onComplete","onError","onFinish","onChange","onSubmit","onEditChanged"],t.firstUpperCase=y,t.getEtsPropName=m,t.getEtsEnumValue=v,t.dealWithColor=_;const w=n(((e,t,n,r)=>{if(!(r.params instanceof Map))return;const i=n.dynamicProperty.get(e);if(!s(i))return void r.params.set(m(e),i);const o=n.property.get(e);if(s(o))return;let a=v(t,o);"flex-start"===o?a=t+"Start":"flex-end"===o&&(a=t+"End"),r.params.set(m(e),a)})),b=n(((e,t)=>t.type===e));function E(e){return null===e.match(/\$(r|rawfile)\('(.*)'\)$/)?`'${e}'`:e}function C(e){let t=v("ItemAlign.",e);return"flex-start"===e?t="ItemAlign.Start":"flex-end"===e&&(t="ItemAlign.End"),t}function P(e){let t=v("ItemAlign.",e);return"flex-start"===e?t="ItemAlign.Start":"flex-end"===e&&(t="ItemAlign.End"),t}function S(e){let t=v("FlexWrap.",e);return"nowrap"===e&&(t="FlexWrap.NoWrap"),t}function k(e){let t=v("VerticalAlign.",e);return"flex-start"===e?t="VerticalAlign.Top":"flex-end"===e&&(t="VerticalAlign.Bottom"),t}function A(e){let t=v("HorizontalAlign.",e);return"flex-start"===e?t="HorizontalAlign.Start":"flex-end"===e&&(t="HorizontalAlign.End"),t}function M(e){return["lighter","normal","regular","medium","bold","bolder"].includes(e)?v("FontWeight.",e):e}function x(e){const t=new Map([["repeat-x","X"],["repeat-y","Y"],["repeat","XY"],["no-repeat","NoRepeat"]]).get(e);if(null!=t&&""!==t)return v("ImageRepeat.",t)}function I(e){return e.startsWith("$r(")?e:`\`\${${e}}\``}t.dealWithSrc=E,t.dealWithAlignSelf=C,t.dealWithFlexAlignItems=P,t.dealWithWrap=S,t.dealWithRowAlignItems=k,t.dealWithColumnAlignItems=A,t.dealWithFontWeight=M,t.dealWithBackgroundImagePosition=function(e){if(new Set(["TopStart","Top","TopEnd","Start","Center","End","BottomStart","Bottom","BottomEnd"]).has(e))return"Alignment."+e;const t=e.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%)) +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$/);return null!==t?`{ x: '${t[1]}', y: '${t[4]}' }`:void 0},t.dealWithBackgroundImageSize=function(e){if(new Set(["Cover","Contain","Auto"]).has(e))return v("ImageSize.",e);const t=e.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%))( *$| +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$)/);return null!==t?void 0!==t[5]?`{ width: '${t[1]}', height: '${t[5]}' }`:`{ width: '${t[1]}' }`:void 0},t.dealWithBackgroundRepeat=x,t.getContentName=I;const N=[[r("width"),a("width")],[r("height"),a("height")],[function(e){return e.hasProperty("constraint-size-min-width")||e.hasProperty("constraint-size-max-width")||e.hasProperty("constraint-size-min-height")||e.hasProperty("constraint-size-max-height")},function(e,t){const n=new Map,r=e.getProperty("constraint-size-min-width"),i=e.getProperty("constraint-size-max-width"),o=e.getProperty("constraint-size-min-height"),a=e.getProperty("constraint-size-max-height");T("minWidth",r,n,e.dynamicProperty.has("constraint-size-min-width")),T("maxWidth",i,n,e.dynamicProperty.has("constraint-size-max-width")),T("minHeight",o,n,e.dynamicProperty.has("constraint-size-min-height")),T("maxHeight",a,n,e.dynamicProperty.has("constraint-size-max-height")),n.size>0&&t.properties.set("constraintSize",n)}],[r("align"),l("align","Alignment.")],[r("direction"),l("direction","Direction.")],[function(e){return e.hasProperty("left")||e.hasProperty("top")},function(e,t){const n="absolute"===e.property.get("position")?"position":"offset",r=e.property.get("left"),i=e.property.get("top"),o=e.dynamicProperty.get("left"),a=e.dynamicProperty.get("top");if(s(o)&&s(a)&&s(r)&&s(i))return;const c=new Map([["x",`'${null!=r?r:"0"}'`],["y",`'${null!=i?i:"0"}'`]]);s(o)||c.set("x",o),s(a)||c.set("y",a),t.properties.set(n,c)}],[r("aspect-ratio"),c("aspect-ratio")],[r("display-priority"),c("display-priority")],[r("flex-basis"),a("flex-basis")],[r("flex-grow"),c("flex-grow")],[r("flex-shrink"),c("flex-shrink")],[r("align-self"),function(e,t){const n=e.dynamicProperty.get("align-self");if(!s(n))return void t.properties.set("alignSelf",n);const r=e.property.get("align-self");if(s(r))return;const i=C(r);t.properties.set("alignSelf",i)}],[r("border-style"),l("border-style","BorderStyle.")],[r("border-width"),a("border-width")],[r("border-color"),g("border-color")],[r("border-radius"),a("border-radius")],[r("background-color"),g("background-color")],[function(e){return e.hasProperty("background-image-src")||e.hasProperty("background-image-repeat")},function(e,t){const n=e.getProperty("background-image-src"),r=e.getProperty("background-image-repeat");if(s(n)&&s(r))return;let i=E(null!=n?n:"");if(!s(r)){const e=x(r);null!=e&&""!==e&&(i=i+", "+e)}t.properties.set("backgroundImage",i)}],[r("background-image-size"),function(e,t){const n=e.getProperty("background-image-size");if(s(n))return;if(new Set(["Cover","Contain","Auto"]).has(n))return void t.properties.set("backgroundImageSize",v("ImageSize.",n));const r=n.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%))( *$| +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$)/);null!==r&&(void 0!==r[5]?t.properties.set("backgroundImageSize",new Map([["width",`'${r[1]}'`],["height",`'${r[5]}'`]])):t.properties.set("backgroundImageSize",new Map([["width",`'${r[1]}'`]])))}],[r("background-image-position"),function(e,t){const n=e.getProperty("background-image-position");if(s(n))return;if(new Set(["TopStart","Top","TopEnd","Start","Center","End","BottomStart","Bottom","BottomEnd"]).has(n))return void t.properties.set("backgroundImagePosition","Alignment."+n);const r=n.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%)) +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$/);null!==r&&t.properties.set("backgroundImagePosition",new Map([["x",`'${r[1]}'`],["y",`'${r[4]}'`]]))}],[r("opacity"),c("opacity")],[r("visibility"),l("visibility","Visibility.")],[r("enabled"),u("enabled")],[r("font-color"),g("font-color")],[r("font-size"),a("font-size")],[r("font-style"),l("font-style","FontStyle.")],[r("font-weight"),function(e,t){const n=e.getProperty("font-weight");if(s(n))return;const r=M(n);t.properties.set("fontWeight",r)}],[r("font-family"),a("font-family")],[function(e){return e.hasProperty("margin")||e.hasProperty("margin-left")||e.hasProperty("margin-top")||e.hasProperty("margin-right")||e.hasProperty("margin-bottom")},function(e,t){var n,r,i,o;const a=new Map,s=e.getProperty("margin"),c=null!==(n=e.getProperty("margin-top"))&&void 0!==n?n:s,u=null!==(r=e.getProperty("margin-bottom"))&&void 0!==r?r:s,l=null!==(i=e.getProperty("margin-left"))&&void 0!==i?i:s,f=null!==(o=e.getProperty("margin-right"))&&void 0!==o?o:s,p=e.property.has("margin-top"),d=e.property.has("margin-bottom"),h=e.property.has("margin-left"),g=e.property.has("margin-right"),y=e.dynamicProperty.has("margin"),m=e.dynamicProperty.has("margin-top"),v=e.dynamicProperty.has("margin-bottom"),_=e.dynamicProperty.has("margin-left"),w=e.dynamicProperty.has("margin-right");T("top",c,a,m||!p&&y),T("bottom",u,a,v||!d&&y),T("left",l,a,_||!h&&y),T("right",f,a,w||!g&&y),a.size>0&&t.properties.set("margin",a)}],[function(e){return e.hasProperty("padding")||e.hasProperty("padding-left")||e.hasProperty("padding-top")||e.hasProperty("padding-right")||e.hasProperty("padding-bottom")},function(e,t){var n,r,i,o;const a=new Map,s=e.getProperty("padding"),c=null!==(n=e.getProperty("padding-top"))&&void 0!==n?n:s,u=null!==(r=e.getProperty("padding-bottom"))&&void 0!==r?r:s,l=null!==(i=e.getProperty("padding-left"))&&void 0!==i?i:s,f=null!==(o=e.getProperty("padding-right"))&&void 0!==o?o:s,p=e.property.has("padding-top"),d=e.property.has("padding-bottom"),h=e.property.has("padding-left"),g=e.property.has("padding-right"),y=e.dynamicProperty.has("padding"),m=e.dynamicProperty.has("padding-top"),v=e.dynamicProperty.has("padding-bottom"),_=e.dynamicProperty.has("padding-left"),w=e.dynamicProperty.has("padding-right");T("top",c,a,m||!p&&y),T("bottom",u,a,v||!d&&y),T("left",l,a,_||!h&&y),T("right",f,a,w||!g&&y),a.size>0&&t.properties.set("padding",a)}],[i("button","label"),function(e,t){const n=e.dynamicProperty.get("label");if(!s(n))return void t.setParams(I(n));const r=e.property.get("label");"string"==typeof r&&t.setParams(`\`${r}\``)}],[i("button","type"),l("type","ButtonType.")],[i("button","state-effect"),u("state-effect")],[i("divider","vertical"),u("vertical")],[i("divider","color"),g("color")],[i("divider","stroke-width"),a("stroke-width")],[i("divider","line-cap"),l("line-cap","LineCapStyle.")],[b("image"),function(e,t){var n;const r=e.dynamicProperty.get("src");if(!s(r))return void t.setParams(r);const i=null!==(n=e.property.get("src"))&&void 0!==n?n:"";t.setParams(E(i))}],[i("image","alt"),a("alt")],[i("image","object-fit"),l("object-fit","ImageFit.")],[i("image","object-repeat"),l("object-repeat","ImageRepeat.")],[i("image","interpolation"),l("interpolation","ImageInterpolation.")],[i("image","render-mode"),l("render-mode","ImageRenderMode.")],[function(e){return e.hasProperty("source-size-width")||e.hasProperty("source-size-height")},function(e,t){let n=e.getProperty("source-size-width"),r=e.getProperty("source-size-height");if(s(n)&&s(r))return;const i=e.dynamicProperty.has("source-size-width"),o=e.dynamicProperty.has("source-size-height");n="0"===n||s(n)?"0":i?n:n.substring(0,n.length-2),r="0"===r||s(r)?"0":o?r:r.substring(0,r.length-2);const a=new Map([["width",n],["height",r]]);t.properties.set("sourceSize",a)}],[function(e){return"progress"===e.type&&(e.hasProperty("value")||e.hasProperty("total")||e.hasProperty("style"))},function(e,t){var n;f("value",e,t)||t.params instanceof Map&&t.params.set("value",null!==(n=e.getProperty("value"))&&void 0!==n?n:"0")}],[i("progress","total"),d("total")],[i("progress","style"),h("style","ProgressStyle.")],[i("progress","color"),g("color")],[i("slider","value"),d("value")],[i("slider","min"),d("min")],[i("slider","max"),d("max")],[i("slider","step"),d("step")],[i("slider","style"),h("style","SliderStyle.")],[i("slider","block-color"),g("block-color")],[i("slider","track-color"),g("track-color")],[i("slider","selected-color"),g("selected-color")],[i("slider","show-steps"),u("show-steps")],[i("slider","show-tips"),u("show-tips")],[i("text","content"),function(e,t){const n=e.property.get("content"),r=e.dynamicProperty.get("content");s(r)?"string"==typeof n&&t.setParams(`\`${n}\``):t.setParams(I(r))}],[i("text","text-align"),l("text-align","TextAlign.")],[i("text","text-overflow"),function(e,t){const n=e.dynamicProperty.get("text-overflow");if(!s(n))return void t.properties.set("textOverflow",new Map([["overflow",n]]));const r=e.property.get("text-overflow");s(r)||t.properties.set("textOverflow",new Map([["overflow","TextOverflow."+y(r)]]))}],[i("text","max-lines"),c("max-lines")],[i("text","line-height"),a("line-height")],[function(e){return"text"===e.type&&(e.hasProperty("decoration-type")||e.hasProperty("decoration-color"))},function(e,t){const n=e.property.get("decoration-type"),r=e.dynamicProperty.get("decoration-type"),i=e.property.get("decoration-color"),o=e.dynamicProperty.get("decoration-color");if(s(n)&&s(i)&&s(r)&&s(o))return;const a=new Map;s(r)?a.set("type",s(n)?"TextDecorationType.None":v("TextDecorationType.",n)):a.set("type",r),t.properties.set("decoration",a),s(o)?s(i)||a.set("color",_(i)):a.set("color",o)}],[i("text","baseline-offset"),a("baseline-offset")],[i("text","text-case"),l("text-case","TextCase.")],[i("column","space"),p("space")],[i("column","align-items-column"),function(e,t){const n=e.dynamicProperty.get("align-items-column");if(!s(n))return void t.properties.set("alignItems",n);const r=e.property.get("align-items-column");if(s(r))return;const i=A(r);t.properties.set("alignItems",i)}],[i("row","space"),p("space")],[i("row","align-items-row"),function(e,t){const n=e.dynamicProperty.get("align-items-row");if(!s(n))return void t.properties.set("alignItems",n);const r=e.property.get("align-items-row");if(s(r))return;const i=k(r);t.properties.set("alignItems",i)}],[i("flex","flex-direction"),function(e,t){if(!(t.params instanceof Map))return;const n=e.dynamicProperty.get("flex-direction");if(!s(n))return void t.params.set("direction",n);const r=e.property.get("flex-direction");s(r)||t.params.set("direction",v("FlexDirection.",r))}],[i("flex","wrap"),function(e,t){if(!(t.params instanceof Map))return;const n=e.dynamicProperty.get("wrap");if(!s(n))return void t.params.set("wrap",n);const r=e.property.get("wrap");if(s(r))return;const i=S(r);t.params.set("wrap",i)}],[i("flex","justify-content"),w("justify-content","FlexAlign.")],[i("flex","align-items-flex"),function(e,t){if(!(t.params instanceof Map))return;const n=e.dynamicProperty.get("align-items-flex");if(!s(n))return void t.params.set("alignItems",n);const r=e.property.get("align-items-flex");if(s(r))return;const i=P(r);t.params.set("alignItems",i)}],[i("flex","align-content"),w("align-content","FlexAlign.")],[i("list","space-list"),function(e,t){const n=e.dynamicProperty.get("space-list");if(void 0!==n&&""!==n.trim()&&t.params instanceof Map)return void t.params.set("space",n);const r=e.getProperty("space-list");!s(r)&&t.params instanceof Map&&t.params.set("space",r)}],[i("list","initial-index"),d("initial-index")],[i("list","list-direction"),l("list-direction","Axis.")],[function(e){return"list"===e.type&&(e.hasProperty("divider-stroke-width")||e.hasProperty("divider-color")||e.hasProperty("divider-start-margin")||e.hasProperty("divider-end-margin"))},function(e,t){const n=e.property.get("divider-stroke-width"),r=e.dynamicProperty.get("divider-stroke-width"),i=new Map([["strokeWidth",`'${null!=n?n:"0"}'`]]);s(r)||i.set("strokeWidth",r);const o=e.property.get("divider-color"),a=e.dynamicProperty.get("divider-color"),c=e.property.get("divider-start-margin"),u=e.dynamicProperty.get("divider-start-margin"),l=e.property.get("divider-end-margin"),f=e.dynamicProperty.get("divider-end-margin");s(a)?s(o)||i.set("color",_(o)):i.set("color",a),s(u)?s(c)||i.set("startMargin",`'${c}'`):i.set("startMargin",u),s(f)?s(l)||i.set("endMargin",`'${l}'`):i.set("endMargin",f),t.properties.set("divider",i)}],[i("list","edit-mode"),u("edit-mode")],[i("list","edge-effect"),l("edge-effect","EdgeEffect.")],[i("list","chain-animation"),u("chain-animation")],[i("list-item","sticky"),l("sticky","Sticky.")],[i("list-item","editable"),u("editable")],[i("swiper","index"),c("index")],[i("swiper","auto-play"),u("auto-play")],[i("swiper","interval"),c("interval")],[i("swiper","indicator"),u("indicator")],[i("swiper","loop"),u("loop")],[i("swiper","duration"),c("duration")],[i("swiper","vertical"),u("vertical")],[i("swiper","item-space"),a("item-space")],[i("swiper","cached-count"),c("cached-count")],[i("swiper","disable-swipe"),u("disable-swipe")],[i("text-input","placeholder"),p("placeholder")],[i("text-input","textInput-type"),function(e,t){const n=e.dynamicProperty.get("textInput-type");if(!s(n))return void t.properties.set("type",n);const r=e.property.get("textInput-type");s(r)||t.properties.set("type","InputType."+r)}],[i("text-input","placeholderColor"),g("placeholderColor")],[function(e){return"text-input"===e.type&&(e.hasProperty("placeholderFont-size")||e.hasProperty("placeholderFont-weight")||e.hasProperty("placeholderFont-family")||e.hasProperty("placeholderFont-style"))},function(e,t){const n=e.property.get("placeholderFont-size"),r=e.dynamicProperty.get("placeholderFont-size"),i=e.property.get("placeholderFont-weight"),o=e.dynamicProperty.get("placeholderFont-weight"),a=e.property.get("placeholderFont-family"),c=e.dynamicProperty.get("placeholderFont-family"),u=e.property.get("placeholderFont-style"),l=e.dynamicProperty.get("placeholderFont-style"),f=new Map;s(r)?f.set("size",s(n)?30:parseInt(n)):f.set("size",r),s(o)?s(i)?f.set("weight",400):f.set("weight",isNaN(Number(i))?v("FontWeight.",i):i):f.set("weight",o),s(c)?f.set("family",s(a)?"'sans-serif'":`'${a}'`):f.set("family",c),s(l)?f.set("style",s(u)?"FontStyle.Normal":v("FontStyle.",u)):f.set("style",l),t.properties.set("placeholderFont",f)}],[i("text-input","enterKeyType"),l("enterKeyType","EnterKeyType.")],[i("text-input","caretColor"),g("caretColor")],[i("text-input","maxLength"),c("maxLength")]]},243:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Style=t.Tag=void 0;const r=n(117);class i extends r.ASTNode{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.content=n}}t.Tag=i;class o extends r.ASTNode{constructor(e,t,n,r){super(),this.mediaQuery=void 0,this.kind=e,this.name=t,this.content=n,this.mediaQuery=r}}t.Style=o},573:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNodeGenerator=void 0;const r=n(243),i=n(334);class o{constructor(e){this.cache=e}visit(e){e instanceof r.Tag?this.genTag(e):e instanceof r.Style&&this.genStyle(e)}static getMethodGen(e){return void 0===o.instance?o.instance=new o(e):o.instance.setCache(e),o.instance}setCache(e){this.cache=e}genTag(e){if(this.cache.concat(i.TokenClass.TAG_START,e.tagName),this.cache.indentOff(),e.attributes.forEach(((e,t)=>{let n="";for(const t of e)n+='"'===t?""":"\n"===t?" ":t;this.cache.concat(i.TokenClass.SPACE,t,i.TokenClass.ASSIGN,i.TokenClass.LQUOTE,n,i.TokenClass.RQUOTE)})),null===e.content)this.cache.concat(i.TokenClass.EMPTY_TAG_END);else{if(this.cache.concat(i.TokenClass.TAG_END),"string"==typeof e.content){let t="";for(const n of e.content)t+="<"===n?"<":n;this.cache.concat(t)}else 0!==e.content.length&&(this.cache.concat(i.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent(),e.content.forEach((e=>{e.accept(this),this.cache.indentOff(),this.cache.concat(i.TokenClass.NEW_LINE),this.cache.indentOn()})),this.cache.decIndent(),this.cache.indentOn());this.cache.concat(i.TokenClass.END_TAG_START,e.tagName,i.TokenClass.TAG_END)}}genStyle(e){void 0!==e.mediaQuery&&(this.cache.concat("@media"),this.cache.indentOff(),this.cache.concat(i.TokenClass.SPACE,e.mediaQuery,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent()),"IDStyle"===e.kind&&(this.cache.concat(i.TokenClass.ID_STYLE_START),this.cache.indentOff()),this.cache.concat(e.name,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent(),e.content.forEach(((e,t)=>{this.cache.concat(t,i.TokenClass.COLON,i.TokenClass.SPACE,e,i.TokenClass.SEMICOLON,i.TokenClass.NEW_LINE)})),this.cache.decIndent(),this.cache.concat(i.TokenClass.RBRA,i.TokenClass.NEW_LINE),void 0!==e.mediaQuery&&(this.cache.decIndent(),this.cache.concat(i.TokenClass.RBRA,i.TokenClass.NEW_LINE)),this.cache.concat(i.TokenClass.NEW_LINE)}}t.ASTNodeGenerator=o,o.instance=void 0},844:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CSSBridge=t.HMLBridge=void 0;const r=n(243),i=n(571);t.HMLBridge=class{constructor(){this.errors=0}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}visit(e){const t=new Map([["id",e.id]]);let n="";for(let[r,o]of e.property)(0,i.isAttribute)(r,e.type)?("string"!=typeof o&&(o=JSON.stringify(o)),t.set(r,o)):(0,i.isContent)(r)&&(n=o);if(e.children.length>0){n=[];for(const t of e.children)n.push(t.accept(this))}const o=new r.Tag(e.type,t,n);return"wrapper"===t.get("id")?new r.Tag("div",new Map,[o]):o}},t.CSSBridge=class{constructor(){this.errors=0,this.styles=[]}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}genIDStyle(e){var t;const n=t=>{const n=new Map;for(const[r,o]of t)(0,i.isStyle)(r,e.type)&&n.set(r,o);return n},o=n(e.property);o.size>0&&this.styles.push(new r.Style("IDStyle",e.id,o)),(null!==(t=e.mediaProperty)&&void 0!==t?t:new Map).forEach(((t,i)=>{const o=n(t);o.size>0&&this.styles.push(new r.Style("IDStyle",e.id,o,i))}));for(const t of e.children)t.accept(this)}visit(e){return this.genIDStyle(e),this.styles}}},55:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.genFACSS=t.genFAHML=void 0;const r=n(573),i=n(862);t.genFAHML=function(e){const t=r.ASTNodeGenerator.getMethodGen(new i.Cache(" "));return e.accept(t),t.cache.toString()},t.genFACSS=function(e){const t=r.ASTNodeGenerator.getMethodGen(new i.Cache(" "));return e.forEach((e=>{e.accept(t)})),t.cache.toString()}},571:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEvent=t.isData=t.isUnknown=t.isContent=t.isAttribute=t.isStyle=t.styleMap=void 0;const r=n(904),i=["width","height","min-width","min-height","max-width","max-height","padding","padding-start","padding-end","padding-top","padding-right","padding-bottom","padding-left","margin","margin-start","margin-end","margin-top","margin-right","margin-bottom","margin-left","border-width","border-style","border-color","border-radius","border-top-width","border-top-style","border-top-color","border-top-left-radius","border-right-width","border-right-style","border-right-color","border-top-right-radius","border-bottom-width","border-bottom-style","border-bottom-color","border-bottom-right-radius","border-left-width","border-left-style","border-left-color","border-bottom-left-radius","background-color","background","background-image","background-size","background-position","background-repeat","display","opacity","visibility","flex","flex-grow","flex-shrink","flex-basis","position","display","top","right","bottom","left","display-index","flex-weight","aspect-ratio"],o=["font-size","font-family","font-style","font-weight"],a=["text-align","line-height","text-decoration","letter-spacing","max-lines","text-overflow","allow-scale","min-font-size","max-font-size","font-size-step","prefer-font-sizes","color",...o],s=["allow-scale","text-decoration","color",...o],c=["text-color","allow-scale","icon-width","icon-height","radius",...o],u=["texton-color","textoff-color","text-padding","allow-scale",...o],l=["column-height","text-color","allow-scale","letter-spacing","text-decoration","line-height","opacity",...o],f=["text-color","allow-scale","letter-spacing",...o];t.styleMap=new Map([["common",new Set([...i])],["div",new Set(["flex-direction","overflow","flex-wrap","justify-content","align-items","align-content","grid-template-columns","grid-template-rows","grid-row-start","grid-row-end","grid-column-start","grid-column-end","grid-gap","grid-columns-gap","grid-rows-gap"])],["text",new Set([...a])],["image",new Set(["object-fit","match-text-direction","fit-original-size"])],["span",new Set([...s])],["input",new Set(["font-size","font-family","font-weight","color","placeholder-color","allow-scale"])],["button",new Set([...c])],["switch",new Set([...u])],["refresh",new Set(["progress-color"])],["divider",new Set(["stroke-width","line-cap","color"])],["chart",new Set(["stroke-width","radius","start-angle","total-angle","center-x","center-y","colors","weights"])],["picker",new Set([...l])],["picker-view",new Set(["color","font-size","selected-color","selected-font-size","focus-color","focus-font-size","disappear-color","disappear-font-size","font-family"])],["slider",new Set(["color","selected-color","block-color"])],["swiper",new Set(["indicator-color","indicator-selected-color","indicator-size","indicator-top","indicator-right","indicator-bottom","indicator-left"])],["list",new Set(["flex-direction","columns","item-extent","fade-color"])],["list-item",new Set(["column-span"])],["progress",new Set(["color","stroke-width","background-color","secondary-color","scale-width","scale-number","start-angle","total-angle","center-x","center-y","radius"])],["select",new Set(["font-family"])],["menu",new Set([...f])],["option",new Set(["color","font-family","allow-scale","font-size","font-weight","text-decoration"])],["video",new Set(["object-fit"])],["clock",new Set(["font-family"])]]);const p=new Map([["common",new Set(["id","ref","disabled","focusable","data","if","for"])],["image",new Set(["src","alt"])],["button",new Set(["type","value","icon","waiting"])],["refresh",new Set(["offset","refreshing","type","lasttime","friction"])],["input",new Set(["type","checked","name","value","placeholder","maxlength","enterkeytype","headericon"])],["switch",new Set(["checked","showtext","texton","textoff"])],["option",new Set(["value","selected","icon"])],["chart",new Set(["type","percent","datasets","options"])],["picker",new Set(["type","range","selected","start","end","lunar","lunarSwitch","columns","hours","containSecond","value","vibrate"])],["picker-view",new Set(["type","range","selected","start","end","lunar","lunarSwitch","columns","hours","containSecond","indicatorprefix","indicatorsuffix","vibrate"])],["slider",new Set(["min","max","step","showtips","showsteps","mode","value"])],["divider",new Set(["vertical"])],["list",new Set(["scrollpage","cachedcount","scrollbar","scrolleffect","shapemode","indexer","itemscale","itemcenter","updateeffect","scrollvibrate","initialindex","initialoffset"])],["list-item",new Set(["type","primary","section","sticky","stickyradius","clickeffect"])],["swiper",new Set(["index","autoplay","interval","indicator","digital","indicatordisabled","loop","duration","vertical"])],["progress",new Set(["type","percent","secondarypercent","clockwise"])],["menu",new Set(["target","title","type"])],["clock",new Set(["clockconfig","showdigit","hourswest"])],["badge",new Set(["placement","count","visible","maxcount","config","label"])],["video",new Set(["muted","src","autoplay","poster","controls","loop","starttime","direction","speed"])],["tabs",new Set(["index","vertical"])],["tab-bar",new Set(["mode"])],["tab-content",new Set(["scrollable"])]]),d=new Map([["common",new Set(["ontouchstart","ontouchmove","ontouchcancel","ontouchend","onclick","onlongpress","onfocus","onblur","onkey","onswipe"])],["image",new Set(["oncomplete","onerror"])],["input",new Set(["onchange","onenterkeyclick"])],["select",new Set(["onchange"])],["refresh",new Set(["onrefresh","onpulldown"])],["swiper",new Set(["onchange","onrotation"])],["list",new Set(["onindexerchange","onscroll","onscrollbottom","onscrolltop","onscrollend","onscrolltouchup","onrequestitem"])],["list-item",new Set(["onsticky"])],["menu",new Set(["onselected","oncancel"])],["picker",new Set(["oncolumnchange","onchange","oncancel"])],["picker-view",new Set(["oncolumnchange","onchange"])],["video",new Set(["onprepared","onstart","onpause","onfinish","onerror","onseeking","onseeked","ontimeupdate","onfullscreenchange","onstop"])],["tabs",new Set(["onchange"])],["switch",new Set(["onchange"])],["dialog",new Set(["oncancel"])]]),h=new Map([["common",new Set(["onClick","onTouch","onAppear","onDisappear","onKeyEvent","onAreaChange"])],["image",new Set(["onComplete","onError","onFinish"])],["swiper",new Set(["onChange"])],["list",new Set(["onItemDelete","onScrollIndex","onItemDragEnter","onItemDragMove","onItemDragLeave","onItemDragStart","onItemDrop"])],["text-input",new Set(["onChange","onSubmit","onEditChanged"])]]);function g(e,t,n){const r=t.get(n);return void 0!==r&&r.has(e)}function y(e,n){return g(e,t.styleMap,"common")||g(e,t.styleMap,n)}function m(e,t){return(0,r.getDomain)()===r.Domain.ETS?g(e,h,"common")||g(e,h,t):v(e,t)||_(e,t)}function v(e,t){return g(e,p,"common")||g(e,p,t)}function _(e,t){return g(e,d,"common")||g(e,d,t)}t.isStyle=y,t.isAttribute=m,t.isContent=function(e){return"content"===e},t.isUnknown=function(e,t){return!y(e,t)&&!m(e,t)},t.isData=v,t.isEvent=_},334:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenClass=void 0,(n=t.TokenClass||(t.TokenClass={}))[n.IDENTIFIER=0]="IDENTIFIER",n[n.STRING_LITERAL=1]="STRING_LITERAL",n[n.NUMBER=2]="NUMBER",n[n.CHARACTER=3]="CHARACTER",n[n.EOF=4]="EOF",n[n.INVALID=5]="INVALID",n.EMPTY_DATA="empty",n.ASSIGN="=",n.NEW_LINE="\n",n.CARRIAGE_RETURN="\r",n.INDENT=" ",n.SPACE=" ",n.LQUOTE='"',n.RQUOTE='"',n.TAG_START="<",n.TAG_END=">",n.EMPTY_TAG_END="/>",n.END_TAG_START="{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TagTypeMap=void 0,t.TagTypeMap=new Map([["button","TextContent"],["span","TextContent"],["divider","TextContent"],["picker","TextContent"],["option","TextContent"],["clock","TextContent"],["image","Base"],["input","Base"],["chart","Base"],["slider","Base"],["progress","Base"],["text","Text"],["div","Container"],["list","Container"],["list-item","Container"],["list-item-group","Container"],["refresh","Container"],["dialog","Container"],["stack","Container"],["menu","Container"],["select","Container"],["tabs","Container"],["tab-bar","Container"],["tab-content","Container"]])},294:(e,t)=>{"use strict";function n(e){const t=function(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");let n="";for(let t=0;t=4&&(n=n.substr(n.length/2-2,4)),n}Object.defineProperty(t,"__esModule",{value:!0}),t.getUniqueName=t.getUniqueId=t.removeFromArray=t.getDataName=void 0,t.getDataName=function(e){if("string"==typeof e&&e.startsWith("{{")&&e.endsWith("}}"))return e.substring(2,e.length-2)},t.removeFromArray=function(e,t){const n=[...e];return t.forEach((e=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)})),n},t.getUniqueId=n,t.getUniqueName=function(e){return`${e}_${n(e)}`}},207:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formManager=void 0;const r=n(891),i=n(945);t.formManager={removeData(e){this.getFormModel().data.delete(e)},addData(e){e instanceof Map?e.forEach(((e,t)=>{this.getFormModel().data.set(t,e)})):Object.keys(e).forEach((t=>{this.getFormModel().data.set(t,e[t])}))},updateAllData(e){this.getFormModel().data.clear(),this.addData(e)},addAction(e,t,n,r){const o=new Map;void 0!==n&&Object.keys(n).forEach((e=>{o.set(e,n[e])}));const a=new Map;void 0!==r&&Object.keys(r).forEach((e=>{a.set(e,r[e])})),this.getFormModel().actions.set(e,new i.FormAction(t,o,a))},updateAllActions(e){this.getFormModel().actions.clear(),e.forEach(((e,t)=>{const n=void 0===e.params?e.params:this.objectToMap(e.params),r=void 0===e.want?e.want:this.objectToMap(e.want),o=new i.FormAction(e.actionType,n,r);this.getFormModel().actions.set(t,o)}))},removeAction(e){this.getFormModel().actions.delete(e)},addActionParams(e,t){var n,r;const o=null!==(n=this.getFormModel().actions.get(e))&&void 0!==n?n:new i.FormAction(e),a=null!==(r=o.params)&&void 0!==r?r:new Map;Object.keys(t).forEach((e=>{a.set(e,t[e])})),o.params=a},removeActionParam(e,t){var n;const r=this.getFormModel().actions.get(e);null===(n=null==r?void 0:r.params)||void 0===n||n.delete(t)},getFormModel:()=>(0,r.getInstance)().formData,codegenToJson:function(){const e=(0,r.getInstance)().formData,t=this.mapToObject(e.data),n={actions:{},data:{}};return n.data=t,e.actions.forEach(((e,t)=>{n.actions[t]={},n.actions[t].action=e.action,e.params instanceof Map&&e.params.size>0&&(n.actions[t].params=this.mapToObject(e.params)),e.want instanceof Map&&e.want.size>0&&(n.actions[t].want=this.mapToObject(e.want))})),JSON.stringify(n,null,4)},clear(){(0,r.getInstance)().formData.data.clear(),(0,r.getInstance)().formData.actions.clear()},mapToObject:e=>void 0===e?{}:Array.from(e.entries()).reduce(((e,[t,n])=>Object.assign(Object.assign({},e),{[t]:n})),{}),objectToMap(e){const t=new Map;return Object.keys(e).forEach(((n,r)=>{t.set(n,e[n])})),t}}},945:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FormAction=t.FormModel=void 0,t.FormModel=class{constructor(){this.data=new Map,this.actions=new Map}},t.FormAction=class{constructor(e,t,n){this.action=e,this.params=t,this.want=n}}},509:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeForVersion1=t.rootToVisualContent=t.visualToRootContent=t.serializeForVersion1=void 0;const r=n(891),i=n(933),o=n(571),a=n(282),s=n(945),c=n(977),u=new Map;function l(e){u.set("textMap",new Map);const t=f(null!=e?e:(0,r.getInstance)().visualModel);return JSON.stringify({VisualVersion:"1",content:JSON.stringify(t),extraData:JSON.stringify(h(u))})}function f(e){const t=Array.from(e.property).filter((t=>(0,o.isAttribute)(t[0],e.type)));t.push(["id",e.id]);const n=Array.from(e.property).filter((t=>(0,o.isStyle)(t[0],e.type)));let r=a.TagTypeMap.get(e.type);void 0===r&&(r="Base");let i=e.property.has("content")?e.property.get("content"):[];if(e.children.length>0){if("string"==typeof i){const t=u.get("textMap");t instanceof Map&&t.set(e.id,i)}i=e.children.map((e=>f(e)))}return{id:e.id,tagName:e.type,attributes:t,idStyle:n,type:r,content:i}}function p(e,t){let n;if(t instanceof Map){const r=t.get("textMap");r instanceof Map&&(n=r.get(e.id))}const r=new i.VisualModel({id:e.id,type:e.tagName,property:new Map([...e.attributes,...e.idStyle])});return"string"==typeof n&&r.property.set("content",n),r.property.delete("id"),"string"==typeof e.content&&r.property.set("content",e.content),Array.isArray(e.content)&&(r.children=e.content.map((e=>p(e,t)))),r}function d(e){if(e instanceof Array&&e.length>0&&"$$map"===e[0]){e.shift();const t=new Map;for(const[n,r]of e)t.set(n,d(r));return t}return e}function h(e){if(e instanceof Map){const t=["$$map"];for(const[n,r]of e)t.push([n,h(r)]);return t}return e}t.serializeForVersion1=l,t.visualToRootContent=function(e){try{return l(JSON.parse(e,c.reviver).visualModel)}catch(e){console.error("convert visual model to root model failed")}return e},t.rootToVisualContent=function(e){const t=JSON.parse(e),n=JSON.parse(t.content);let r='["$$map",["textMap",["$$map"]]]';"string"==typeof t.extraData&&(r=JSON.parse(t.extraData));const i=p(n,d(r));return i.property.has("flex-direction")||i.property.set("flex-direction","column"),JSON.stringify({document:{VisualVersion:"12",type:"FA"},visualModel:i,formData:new s.FormModel},c.replacer)},t.deserializeForVersion1=function(e){try{const t=JSON.parse(e),n=JSON.parse(t.content);let i='["$$map",["textMap",["$$map"]]]';"string"==typeof t.extraData&&(i=JSON.parse(t.extraData)),(0,r.getInstance)().visualModel=p(n,d(i)),(0,r.getInstance)().visualModel.property.has("flex-direction")||(0,r.getInstance)().visualModel.property.set("flex-direction","column")}catch(e){console.error("convert error")}}},891:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setInstance=t.getInstance=void 0;const r=n(933),i=n(945),o=n(904),a={document:{VisualVersion:"12",type:"FA"},visualModel:new r.VisualModel({type:"div",id:"wrapper"}),formData:new i.FormModel};t.getInstance=function(){return a},t.setInstance=function(e){for(const t in a)Object.prototype.hasOwnProperty.call(e,t)&&(a[t]=e[t]);const t=a.document.type;(0,o.setDomain)("ETS"===t?o.Domain.ETS:"FORM"===t?o.Domain.FORM:o.Domain.FA)}},977:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reviver=t.replacer=t.deserialize=t.serialize=void 0;const r=n(933),i=n(891),o=n(509);function a(e,t){if(t instanceof Map)return{dataType:"Map",value:Object.fromEntries(t.entries())};if(t instanceof Set)return{dataType:"Set",value:Array.from(t.entries())};if(t instanceof r.VisualModel){const e=new r.VisualModel({type:"none"}),n={};for(const r in e)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return{dataType:"VisualModel",value:n}}return t}function s(e,t){if("object"==typeof t&&null!=t){if("Map"===t.dataType)return new Map(Object.entries(t.value));if("Set"===t.dataType)return new Set(t.value);if("VisualModel"===t.dataType){const e=new r.VisualModel({type:""});Object.assign(e,t.value),t=e}}return t}t.serialize=function(e,t){return 1===e?(0,o.serializeForVersion1)(t):JSON.stringify(null!=t?t:(0,i.getInstance)(),a,4)},t.deserialize=function(e){if("1"===JSON.parse(e).VisualVersion)return(0,o.deserializeForVersion1)(e);const t=JSON.parse(e,s);(0,i.setInstance)(t)},t.replacer=a,t.reviver=s},933:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VisualModel=void 0;const n="-visual";t.VisualModel=class{constructor(e){if(this.mediaProperty=void 0,this.dynamicMediaProperty=void 0,this.property=void 0!==e.property?e.property:new Map,this.dynamicProperty=void 0!==e.dynamicProperty?e.dynamicProperty:new Map,this.children=void 0!==e.children?e.children:[],"wrapper"===e.type)return this.id="wrapper",void(this.type="div");e.type.endsWith(n)&&(e.type=e.type.substring(0,e.type.length-n.length)),this.id=void 0!==e.id?e.id:"",this.type=e.type}getProperty(e){const t=this.dynamicProperty.get(e);return void 0!==t&&""!==t?t:this.property.get(e)}hasMediaProperty(e){if(void 0!==this.mediaProperty)for(const[,t]of this.mediaProperty)if(null==t?void 0:t.has(e))return!0;if(void 0!==this.dynamicMediaProperty)for(const[,t]of this.dynamicMediaProperty)if(null==t?void 0:t.has(e))return!0;return!1}hasProperty(e){return this.dynamicProperty.has(e)||this.property.has(e)}accept(e){return e.visit(this)}}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";var e=r;Object.defineProperty(e,"__esModule",{value:!0});const t=n(784),i=n(891),o=n(977),a=n(844),s=n(55),c=n(207),u=n(413),l=n(435),f=n(486),p={build:"",etsImport:"",etsVariable:"",etsFunction:"",aboutToAppear:""};function d(e,n){var r;try{(0,o.deserialize)(e);const t=(0,i.getInstance)().document.VisualVersion,r=/^([1-9]+[0-9]*)$/;if(void 0===t)n.errorType="versionError";else{const e=t.match(r);(null===e||parseInt(e[1])>12)&&(n.errorType="versionError")}}catch(e){n.errorType="fileError"}""!==n.errorType&&(n.errorMessage=null!==(r=t.errorMap.get(n.errorType))&&void 0!==r?r:"Codegen visual file failed")}e.genHmlAndCss=function(e){const n={hmlCss:{hml:"",css:"",json:""},errorType:"",errorMessage:""};if(d(e,n),""!==n.errorType)return n.hmlCss.hml="",n.hmlCss.css="",n;try{const e=function(e){const t={hml:"",css:"",json:""},n=new a.HMLBridge,r=e.accept(n),i=(0,s.genFAHML)(r);t.hml=n.getErrorCount()>0?"error":i;const o=new a.CSSBridge,c=e.accept(o),u=(0,s.genFACSS)(c);return t.css=o.getErrorCount()>0?"error":u,t}((0,i.getInstance)().visualModel);"error"!==e.hml&&"error"!==e.css||(n.errorType="codegenError"),n.hmlCss=e,"FORM"===(0,i.getInstance)().document.type&&(n.hmlCss.json=c.formManager.codegenToJson())}catch(e){n.errorType="modelError"}return""!==n.errorType&&(n.errorMessage=t.errorMap.get(n.errorType),n.hmlCss.hml="",n.hmlCss.css=""),n},e.genETS=function(e){var n;const r={ets:(0,f.cloneDeep)(p),errorType:"",errorMessage:""};if(d(e,r),""!==r.errorType)return r.ets=(0,f.cloneDeep)(p),r;try{const e=function(e){const t=new u.ETSBridge,n=e.accept(t),r=(new l.StringWriter).genETS(n);return t.getErrorCount()>0?"error":r}((0,i.getInstance)().visualModel);"error"===e&&(r.errorType="codegenError"),r.ets=e}catch(e){r.errorType="modelError"}return""!==r.errorType&&(r.errorMessage=null!==(n=t.errorMap.get(r.errorType))&&void 0!==n?n:"Codegen visual file failed",r.ets=(0,f.cloneDeep)(p)),r}})();var i=exports;for(var o in r)i[o]=r[o];r.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})(); \ No newline at end of file diff --git a/compiler/src/pre_define.ts b/compiler/src/pre_define.ts index 2acba6229..6935aeac1 100644 --- a/compiler/src/pre_define.ts +++ b/compiler/src/pre_define.ts @@ -199,3 +199,6 @@ export const $$_NEW_VALUE: string = 'newValue'; export const INTERFACE_NAME_SUFFIX:string = '_Params'; export const OBSERVED_PROPERTY_ABSTRACT:string = 'ObservedPropertyAbstract'; + +export const SUPERVISUAL: string = './supervisual'; +export const SUPERVISUAL_SOURCEMAP_EXT: string = '.visual.js.map'; diff --git a/compiler/src/pre_process.ts b/compiler/src/pre_process.ts index bab5b8c24..9f8eeeb16 100644 --- a/compiler/src/pre_process.ts +++ b/compiler/src/pre_process.ts @@ -15,6 +15,8 @@ import ts from 'typescript'; import fs from 'fs'; +import path from 'path'; +import { SourceMapGenerator } from 'source-map'; import { ReplaceResult, @@ -26,12 +28,20 @@ import { import { LogType, LogInfo, - emitLogInfo + emitLogInfo, + mkDir } from './utils'; -import { BUILD_ON } from './pre_define'; +import { + BUILD_ON, + SUPERVISUAL, + SUPERVISUAL_SOURCEMAP_EXT +} from './pre_define'; import { projectConfig } from '../main.js'; import { genETS } from '../codegen/codegen_ets.js'; +const visualMap: Map = new Map(); +const slotMap: Map = new Map(); + function preProcess(source: string): string { process.env.compiler = BUILD_ON; if (/\.ets$/.test(this.resourcePath)) { @@ -39,7 +49,7 @@ function preProcess(source: string): string { let newContent: string = result.content; const log: LogInfo[] = result.log.concat(validateUISyntax(source, newContent, this.resourcePath, this.resourceQuery)); - newContent = parseVisual(this.resourcePath, newContent, log); + newContent = parseVisual(this.resourcePath, this.resourceQuery, newContent, log, source); if (log.length) { emitLogInfo(this, log); } @@ -49,28 +59,48 @@ function preProcess(source: string): string { } } -function parseVisual(resourcePath: string, content: string, log: LogInfo[]): string { - if (componentCollection.entryComponent && projectConfig.aceSuperVisualPath) { - const sourceFile: ts.SourceFile = ts.createSourceFile(resourcePath, content, - ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); - if (sourceFile.statements) { - sourceFile.statements.forEach(statement => { - content = parseStatement(statement, content, log, resourcePath); - }); - } +function parseVisual(resourcePath: string, resourceQuery: string, content: string, + log: LogInfo[], source: string): string { + if (!componentCollection.entryComponent || !projectConfig.aceSuperVisualPath) { + return content; } - return content; + const visualPath: string = findVisualFile(resourcePath); + if (!visualPath || !fs.existsSync(visualPath)) { + return content; + } + const visualContent: any = getVisualContent(visualPath, log); + if (!visualContent) { + return content; + } + visualMap.clear(); + slotMap.clear(); + const sourceFile: ts.SourceFile = ts.createSourceFile(resourcePath, content, + ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + let newContent: string = content; + if (sourceFile.statements) { + sourceFile.statements.forEach(statement => { + newContent = parseStatement(statement, newContent, log, visualContent); + }); + } + const result: ReplaceResult = sourceReplace(newContent, resourcePath); + newContent = result.content; + const resultLog: LogInfo[] = result.log.concat(validateUISyntax(source, newContent, + resourcePath, resourceQuery)); + log.concat(resultLog); + if (!log.length) { + generateSourceMapForNewAndOriEtsFile(resourcePath, source); + } + return newContent; } function parseStatement(statement: ts.Statement, content: string, log: LogInfo[], - resourcePath: string): string { + visualContent: any): string { if (statement.kind === ts.SyntaxKind.ClassDeclaration && statement.name && statement.name.getText() === componentCollection.entryComponent) { - const visualPath: string = findVisualFile(resourcePath); - if (visualPath && fs.existsSync(visualPath) && statement.members) { + if (statement.members) { statement.members.forEach(member => { if (member.kind && member.kind === ts.SyntaxKind.MethodDeclaration) { - content = parseMember(member, content, log, visualPath); + content = parseMember(statement, member, content, log, visualContent); } }); } @@ -78,16 +108,13 @@ function parseStatement(statement: ts.Statement, content: string, log: LogInfo[] return content; } -function parseMember(member: ts.MethodDeclaration, content: string, log: LogInfo[], - visualPath: string): string { +function parseMember(statement: ts.Statement, member: ts.MethodDeclaration, content: string, + log: LogInfo[], visualContent: any): string { + let newContent: string = content; if (member.name && member.name.getText() === 'build') { - const buildBody: string = content.substring(member.pos, member.end); + const buildBody: string = member.getText(); if (buildBody.replace(/\ +/g, '').replace(/[\r\n]/g, '') === 'build(){}') { - const visualContent: string = getVisualContent(visualPath, log, member.pos); - if (visualContent) { - content = content.replace(buildBody, '\nbuild() {\n' + - visualContent + '}\n'); - } + newContent = insertVisualCode(statement, member, visualContent, newContent); } else { log.push({ type: LogType.ERROR, @@ -97,7 +124,146 @@ function parseMember(member: ts.MethodDeclaration, content: string, log: LogInfo }); } } - return content; + return newContent; +} + +function insertVisualCode(statement: ts.Statement, member: ts.MethodDeclaration, + visualContent: any, content: string): string { + let newContent: string = content; + newContent = insertImport(visualContent, newContent); + newContent = insertVarAndFunc(member, visualContent, newContent, content); + newContent = insertBuild(member, visualContent, newContent, content); + newContent = insertAboutToAppear(statement, member, visualContent, newContent, content); + return newContent; +} + +function insertImport(visualContent: any, content: string): string { + if (!visualContent.etsImport) { + return content; + } + const mediaQueryImport: string = visualContent.etsImport + '\n'; + const newContent: string = mediaQueryImport + content; + slotMap.set(0, mediaQueryImport.length); + visualMap.set(0, mediaQueryImport.split('\n').length - 1); + return newContent; +} + +function insertVarAndFunc(build: ts.MethodDeclaration, visualContent: any, + content: string, oriContent: string): string { + const visualVarAndFunc: string = (visualContent.etsVariable ?? '') + + (visualContent.etsFunction ?? ''); + return visualVarAndFunc ? insertVisualCodeBeforePos(build, '\n' + visualVarAndFunc, content, + oriContent) : content; +} + +function insertBuild(build: ts.MethodDeclaration, visualContent: any, content: string, + oriContent: string): string { + return visualContent.build ? insertVisualCodeAfterPos(build.body, + '\n' + visualContent.build + '\n', content, oriContent) : content; +} + +function insertAboutToAppear(statement: ts.Statement, build: ts.MethodDeclaration, + visualContent: any, content: string, oriContent: string): string { + if (!visualContent.aboutToAppear) { + return content; + } + for (const member of statement.members) { + const hasAboutToAppear: boolean = member.kind && member.kind === ts.SyntaxKind.MethodDeclaration + && member.name && member.name.getText() === 'aboutToAppear'; + if (hasAboutToAppear) { + return insertVisualCodeAfterPos(member.body, '\n' + visualContent.aboutToAppear, content, + oriContent); + } + } + + const aboutToAppearFunc: string = '\n aboutToAppear() {\n' + visualContent.aboutToAppear + + ' }\n'; + return insertVisualCodeBeforePos(build, aboutToAppearFunc, content, oriContent); +} + +function insertVisualCodeAfterPos(member: ts.Block, visualContent: string, content: string, + oriContent: string): string { + const contentBeforePos: string = oriContent.substring(0, member.getStart() + 1); + const originEtsFileLineNumber: number = contentBeforePos.split('\n').length; + const visualLines: number = visualContent.split('\n').length - 1; + const insertedLineNumbers: number = visualMap.get(originEtsFileLineNumber); + visualMap.set(originEtsFileLineNumber, insertedLineNumbers ? insertedLineNumbers + visualLines : + visualLines); + + let newPos: number = member.getStart() + 1; + for (const [key, value] of slotMap) { + if (member.getStart() >= key) { + newPos += value; + } + } + + const newContent: string = content.substring(0, newPos) + visualContent + + content.substring(newPos); + slotMap.set(member.getStart(), visualContent.length); + return newContent; +} + +function insertVisualCodeBeforePos(member: ts.MethodDeclaration, visualContent: string, + content: string, oriContent: string): string { + const contentBeforePos: string = oriContent.substring(0, member.pos); + const originEtsFileLineNumber: number = contentBeforePos.split('\n').length; + const visualLines: number = visualContent.split('\n').length - 1; + const insertedLineNumbers: number = visualMap.get(originEtsFileLineNumber); + visualMap.set(originEtsFileLineNumber, insertedLineNumbers ? insertedLineNumbers + visualLines : + visualLines); + let newPos: number = member.pos; + for (const [key, value] of slotMap) { + if (member.pos >= key) { + newPos += value; + } + } + const newContent: string = content.substring(0, newPos) + visualContent + + content.substring(newPos); + slotMap.set(member.pos, visualContent.length); + return newContent; +} + +function generateSourceMapForNewAndOriEtsFile(resourcePath: string, content: string) { + if (!process.env.cachePath) { + return; + } + const sourcemap: SourceMapGenerator = new SourceMapGenerator({ + file: resourcePath + }); + const lines: Array = content.split('\n'); + const originEtsFileLines: number = lines.length; + for (let l: number = 1; l <= originEtsFileLines; l++) { + let newEtsFileLineNumber: number = l; + for (const [originEtsFileLineNumber, visualLines] of visualMap) { + if (l > originEtsFileLineNumber) { + newEtsFileLineNumber += visualLines; + } + } + sourcemap.addMapping({ + generated: { + line: newEtsFileLineNumber, + column: 0 + }, + source: resourcePath, + original: { + line: l, + column: 0 + } + }); + } + const visualMapName: string = path.parse(resourcePath).name + SUPERVISUAL_SOURCEMAP_EXT; + const visualDirPath: string = path.parse(resourcePath).dir; + const etsDirPath: string = path.parse(projectConfig.projectPath).dir; + const visualMapDirPath: string = path.resolve(process.env.cachePath, SUPERVISUAL + + visualDirPath.replace(etsDirPath, '')); + if (!(fs.existsSync(visualMapDirPath) && fs.statSync(visualMapDirPath).isDirectory())) { + mkDir(visualMapDirPath); + } + fs.writeFile(path.resolve(visualMapDirPath, visualMapName), sourcemap.toString(), (err) => { + if (err) { + return console.error('ERROR: Failed to write visual.js.map'); + } + }); } function findVisualFile(filePath: string): string { @@ -106,13 +272,12 @@ function findVisualFile(filePath: string): string { return visualPath; } -function getVisualContent(visualPath: string, log: LogInfo[], pos: number): string { +function getVisualContent(visualPath: string, log: LogInfo[]): any { const parseContent: any = genETS(fs.readFileSync(visualPath, 'utf-8')); if (parseContent && parseContent.errorType && parseContent.errorType !== '') { log.push({ type: LogType.ERROR, - message: parseContent.message, - pos: pos + message: parseContent.message }); } return parseContent ? parseContent.ets : null; diff --git a/compiler/src/utils.ts b/compiler/src/utils.ts index c7a7700bb..7f083c399 100644 --- a/compiler/src/utils.ts +++ b/compiler/src/utils.ts @@ -199,10 +199,10 @@ function copyFile(inputFile: string, outputFile: string): void { } } -function mkDir(path_: string): void { +export function mkDir(path_: string): void { const parent: string = path.join(path_, '..'); if (!(fs.existsSync(parent) && !fs.statSync(parent).isFile())) { mkDir(parent); } fs.mkdirSync(path_); -} +} -- Gitee From 34449f2c728a558957e5befa11dfd9c703cbc08a Mon Sep 17 00:00:00 2001 From: c00513733 Date: Mon, 28 Feb 2022 13:02:34 +0800 Subject: [PATCH 11/42] Generate abc by multi threads Signed-off-by: c00513733 --- compiler/src/gen_abc.ts | 44 +++++++++++++++ compiler/src/gen_abc_plugin.ts | 97 +++++++++++++++++++++++----------- 2 files changed, 110 insertions(+), 31 deletions(-) create mode 100644 compiler/src/gen_abc.ts diff --git a/compiler/src/gen_abc.ts b/compiler/src/gen_abc.ts new file mode 100644 index 000000000..dd923af2f --- /dev/null +++ b/compiler/src/gen_abc.ts @@ -0,0 +1,44 @@ +import * as process from 'child_process'; +import * as fs from 'fs'; +import { logger } from './compile_info'; + +const {workerData, threadId} = require('worker_threads'); + +interface File { + path: string, + size: number +} +const red: string = '\u001b[31m'; +const reset: string = '\u001b[39m'; + +function js2abcByWorkers(inputPaths: File[], cmd: string): Promise { + for (let i = 0; i < inputPaths.length; ++i) { + let input = inputPaths[i].path; + let singleCmd = `${cmd} "${input}"`; + logger.debug("gen abc cmd is: ", singleCmd); + try { + process.execSync(singleCmd); + } catch (e) { + logger.error(red, `ETS:ERROR Failed to convert file ${input} to abc `, reset); + return; + } + + if (fs.existsSync(input)) { + fs.unlinkSync(input); + } + + const abcFile: string = input.replace(/\.js$/, '.abc'); + if (fs.existsSync(abcFile)) { + const abcFileNew: string = abcFile.replace(/_.abc$/, '.abc'); + fs.renameSync(abcFile, abcFileNew); + } else { + logger.error(red, `ETS:ERROR ${abcFile} is lost`, reset); + } + } +} + +logger.debug("worker data is: ", JSON.stringify(workerData)); +if (JSON.stringify(workerData) !== 'null') { + logger.debug("==>worker #", threadId, "started!"); + js2abcByWorkers(workerData.input, workerData.cmd); +} diff --git a/compiler/src/gen_abc_plugin.ts b/compiler/src/gen_abc_plugin.ts index b07844faa..1565e11c3 100644 --- a/compiler/src/gen_abc_plugin.ts +++ b/compiler/src/gen_abc_plugin.ts @@ -13,14 +13,14 @@ * limitations under the License. */ -import * as process from 'child_process'; import * as fs from 'fs'; - import * as path from 'path'; import Compiler from 'webpack/lib/Compiler'; import { logger } from './compile_info'; +const {Worker, isMainThread} = require('worker_threads'); const firstFileEXT: string = '_.js'; +const genAbcScript = 'gen_abc.js'; let output: string; let isWin: boolean = false; let isMac: boolean = false; @@ -28,6 +28,12 @@ let isDebug: boolean = false; let arkDir: string; let nodeJs: string; +interface File { + path: string, + size: number +} +let intermediateJsBundle: Array = []; + const red: string = '\u001b[31m'; const reset: string = '\u001b[39m'; @@ -54,7 +60,7 @@ export class GenAbcPlugin { compiler.hooks.emit.tap('GenAbcPlugin', (compilation) => { Object.keys(compilation.assets).forEach(key => { - // choice *.js + // choose *.js if (output && path.extname(key) === '.js') { const newContent: string = compilation.assets[key].source(); const keyPath: string = key.replace(/\.js$/, firstFileEXT); @@ -62,6 +68,34 @@ export class GenAbcPlugin { } }); }); + + compiler.hooks.afterEmit.tap('GenAbcPluginMultiThread', () => { + let param: string = ''; + if (isDebug) { + param += ' --debug'; + } + + if (isMainThread) { + let js2abc: string = path.join(arkDir, 'build', 'src', 'index.js'); + if (isWin) { + js2abc = path.join(arkDir, 'build-win', 'src', 'index.js'); + } else if (isMac) { + js2abc = path.join(arkDir, 'build-mac', 'src', 'index.js'); + } + let maxWorkerNumber = 3; + let splitedBundles = splitJsBundlesBySize(intermediateJsBundle, maxWorkerNumber); + let workerNumber = maxWorkerNumber < splitedBundles.length ? maxWorkerNumber : splitedBundles.length; + let cmdPrefix: string = `${nodeJs} --expose-gc "${js2abc}" ${param} `; + let workers = []; + for (let i = 0; i < workerNumber; ++i) { + workers.push(new Worker(path.resolve(__dirname, genAbcScript), + {workerData: {input: splitedBundles[i], cmd: cmdPrefix} })); + workers[i].on('exit', () => { + logger.debug("worker ", i, "finished!"); + }); + } + } + }); } } @@ -72,7 +106,8 @@ function writeFileSync(inputString: string, output: string, jsBundleFile: string } fs.writeFileSync(output, inputString); if (fs.existsSync(output)) { - js2abcFirst(output); + let fileSize = fs.statSync(output).size; + intermediateJsBundle.push({path: output, size: fileSize}); } else { logger.error(red, `ETS:ERROR Failed to convert file ${jsBundleFile} to bin. ${output} is lost`, reset); } @@ -86,37 +121,37 @@ function mkDir(path_: string): void { fs.mkdirSync(path_); } -function js2abcFirst(inputPath: string): void { - let param: string = ''; - if (isDebug) { - param += '--debug'; - } - - let js2abc: string = path.join(arkDir, 'build', 'src', 'index.js'); - if (isWin) { - js2abc = path.join(arkDir, 'build-win', 'src', 'index.js'); - } else if (isMac) { - js2abc = path.join(arkDir, 'build-mac', 'src', 'index.js'); - } - - const cmd: string = `${nodeJs} --expose-gc "${js2abc}" "${inputPath}" ${param}`; +function getSmallestSizeGroup(groupSize: Map) { + let groupSizeArray = Array.from(groupSize); + groupSizeArray.sort(function(g1, g2) { + return g1[1] - g2[1]; // sort by value + }); + return groupSizeArray[0][0]; // return key +} - try { - process.execSync(cmd); - } catch (e) { - logger.error(red, `ETS:ERROR Failed to convert file ${inputPath} to abc `, reset); - return; +function splitJsBundlesBySize(bundleArray: Array, groupNumber: number){ + let result = []; + if (bundleArray.length < groupNumber) { + result.push(bundleArray); + return result; } - if (fs.existsSync(inputPath)) { - fs.unlinkSync(inputPath); + bundleArray.sort(function(f1: File, f2: File) { + return f2.size - f1.size; + }); + let groupFileSize = new Map(); + for (let i = 0; i < groupNumber; ++i) { + result.push([]); + groupFileSize.set(i, 0); } - const abcFile: string = inputPath.replace(/\.js$/, '.abc'); - if (fs.existsSync(abcFile)) { - const abcFileNew: string = abcFile.replace(/_.abc$/, '.abc'); - fs.renameSync(abcFile, abcFileNew); - } else { - logger.error(red, `ETS:ERROR ${abcFile} is lost`, reset); + let index = 0; + while(index < bundleArray.length) { + let smallestGroup = getSmallestSizeGroup(groupFileSize); + result[smallestGroup].push(bundleArray[index]); + let sizeUpdate = groupFileSize.get(smallestGroup) + bundleArray[index].size; + groupFileSize.set(smallestGroup, sizeUpdate); + index++; } + return result; } -- Gitee From 00ede3b21de1681fc417d4ca5fcf73801dc0712b Mon Sep 17 00:00:00 2001 From: laibo102 Date: Fri, 4 Mar 2022 14:57:10 +0800 Subject: [PATCH 12/42] laibo2@huawei.com Signed-off-by: laibo102 Change-Id: I4d39a374bc83ade722ffcdfd85828ed4bee869e0 --- compiler/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/main.js b/compiler/main.js index 3d81c251e..722448b7a 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -194,7 +194,7 @@ function loadWorker(projectConfig) { if (validateWorkOption()) { const workerConfig = JSON.parse(fs.readFileSync(projectConfig.aceBuildJson).toString()); workerConfig.workers.forEach(worker => { - const relativePath = path.ralative(projectConfig.projectPath, worker); + const relativePath = path.relative(projectConfig.projectPath, worker); if (filterWorker(relativePath)) { projectConfig.entryObj[relativePath.replace(/\.(ts|js)$/,'')] = worker; } -- Gitee From d2c3ed4f6e8229d3a4aa940843abd5f93f5292ec Mon Sep 17 00:00:00 2001 From: laibo102 Date: Fri, 4 Mar 2022 16:48:56 +0800 Subject: [PATCH 13/42] laibo2@huawei.com Signed-off-by: laibo102 Change-Id: I9b424fa92c444ae77f6485d978a04eb1c7b9913c --- compiler/main.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compiler/main.js b/compiler/main.js index 722448b7a..2ca5730ae 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -194,6 +194,9 @@ function loadWorker(projectConfig) { if (validateWorkOption()) { const workerConfig = JSON.parse(fs.readFileSync(projectConfig.aceBuildJson).toString()); workerConfig.workers.forEach(worker => { + if (!/\.(ts|js)$/.test(worker)) { + worker += '.ts' + } const relativePath = path.relative(projectConfig.projectPath, worker); if (filterWorker(relativePath)) { projectConfig.entryObj[relativePath.replace(/\.(ts|js)$/,'')] = worker; -- Gitee From ec1d6554a05ce2737cb791ff9d39020b7a8fe9f9 Mon Sep 17 00:00:00 2001 From: laibo102 Date: Fri, 4 Mar 2022 18:21:45 +0800 Subject: [PATCH 14/42] laibo2@huawei.com Signed-off-by: laibo102 Change-Id: Ied216f3587c317cac80fb4b31d9cbed50d645102 --- compiler/main.js | 2 +- compiler/src/compile_info.ts | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/compiler/main.js b/compiler/main.js index 2ca5730ae..372ce24f6 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -195,7 +195,7 @@ function loadWorker(projectConfig) { const workerConfig = JSON.parse(fs.readFileSync(projectConfig.aceBuildJson).toString()); workerConfig.workers.forEach(worker => { if (!/\.(ts|js)$/.test(worker)) { - worker += '.ts' + worker += '.ts'; } const relativePath = path.relative(projectConfig.projectPath, worker); if (filterWorker(relativePath)) { diff --git a/compiler/src/compile_info.ts b/compiler/src/compile_info.ts index 6e5fdb4f1..4312b7f40 100644 --- a/compiler/src/compile_info.ts +++ b/compiler/src/compile_info.ts @@ -75,7 +75,6 @@ export class ResultStates { private modulePaths: Set = new Set([]); public apply(compiler: Compiler): void { - compiler.hooks.compilation.tap('SourcemapFixer', compilation => { compilation.hooks.afterProcessAssets.tap('SourcemapFixer', assets => { Reflect.ownKeys(assets).forEach(key => { @@ -110,14 +109,14 @@ export class ResultStates { stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS }, (assets) => { - const GLOBAL_COMMON_MODULE_CACHE = ` + const GLOBAL_COMMON_MODULE_CACHE = ` globalThis["__common_module_cache__${projectConfig.hashProjectPath}"] =` + ` globalThis["__common_module_cache__${projectConfig.hashProjectPath}"] || {}; globalThis["webpackChunk${projectConfig.hashProjectPath}"].forEach((item)=> { Object.keys(item[1]).forEach((element) => { globalThis["__common_module_cache__${projectConfig.hashProjectPath}"][element] = null; }) - });` + });`; if (assets['commons.js']) { assets['commons.js'] = new CachedSource( -- Gitee From 39d6de9a3d19ab10a5fa147498ccd83d4505117a Mon Sep 17 00:00:00 2001 From: njupthan Date: Fri, 4 Mar 2022 15:42:36 +0000 Subject: [PATCH 15/42] main.js modification Signed-off-by: njupthan --- compiler/main.js | 48 ++++++++++++++++++++++++++++++++++-------------- 1 file changed, 34 insertions(+), 14 deletions(-) diff --git a/compiler/main.js b/compiler/main.js index 69e1232e3..013c2bdae 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -62,11 +62,13 @@ function loadEntryObj(projectConfig) { initProjectConfig(projectConfig); if (process.env.aceManifestPath) { setEntryFile(projectConfig); + setFaTestRunnerFile(projectConfig); } if (process.env.aceModuleJsonPath) { setAbilityPages(projectConfig) + setStageTestRunnerFile(projectConfig); } - setTestRunnerFile(projectConfig); + if(staticPreviewPage) { projectConfig.entryObj['./' + staticPreviewPage] = projectConfig.projectPath + path.sep + staticPreviewPage + '.ets?entry'; @@ -149,35 +151,53 @@ function setAbilityPages(projectConfig) { } } -function setAbilityFile(projectConfig, abilityPages) { - abilityPages.forEach(abilityPath => { - if (abilityPath && fs.existsSync(path.resolve(projectConfig.projectPath, '../', abilityPath))) { - const projectAbilityPath = path.resolve(projectConfig.projectPath, '../', abilityPath); - const entryPageKey = abilityPath.replace(/^\.\/ets\//, './').replace(/\.ts$/, ''); - abilityConfig.projectAbilityPath.push(projectAbilityPath); - if (fs.existsSync(projectAbilityPath)) { - projectConfig.entryObj[entryPageKey] = projectAbilityPath + '?entry'; +function setFaTestRunnerFile(projectConfig) { + const index =projectConfig.projectPath.split(path.sep).join('/').lastIndexOf('\/'); + const testRunnerPath = path.resolve(projectConfig.projectPath.substring(0,index + 1), "TestRunner"); + if (fs.existsSync(testRunnerPath)) { + const testRunnerFiles = []; + readFile(testRunnerPath, testRunnerFiles); + testRunnerFiles.forEach((item) => { + if (/\.(ts|js)$/.test(item)) { + const relativePath = path.relative(testRunnerPath, item).replace(/\.(ts|js)$/, ''); + projectConfig.entryObj["../TestRunner/" + relativePath] = item; + abilityConfig.testRunnerFile.push(item); } - } - }); + }) + } } -function setTestRunnerFile(projectConfig) { +function setStageTestRunnerFile(projectConfig) { const index =projectConfig.projectPath.split(path.sep).join('/').lastIndexOf('\/'); - const testRunnerPath = path.resolve(projectConfig.projectPath.substring(0,index + 1), "TestRunner"); + const testRunnerPath = path.resolve(projectConfig.projectPath, "TestRunner"); if (fs.existsSync(testRunnerPath)) { const testRunnerFiles = []; readFile(testRunnerPath, testRunnerFiles); testRunnerFiles.forEach((item) => { if (/\.(ts|js)$/.test(item)) { const relativePath = path.relative(testRunnerPath, item).replace(/\.(ts|js)$/, ''); - projectConfig.entryObj["../TestRunner/" + relativePath] = item; + projectConfig.entryObj["./TestRunner/" + relativePath] = item; abilityConfig.testRunnerFile.push(item); + //throw Error('testRunnerPath: ' + item).message; + } }) } } +function setAbilityFile(projectConfig, abilityPages) { + abilityPages.forEach(abilityPath => { + if (abilityPath && fs.existsSync(path.resolve(projectConfig.projectPath, '../', abilityPath))) { + const projectAbilityPath = path.resolve(projectConfig.projectPath, '../', abilityPath); + const entryPageKey = abilityPath.replace(/^\.\/ets\//, './').replace(/\.ts$/, ''); + abilityConfig.projectAbilityPath.push(projectAbilityPath); + if (fs.existsSync(projectAbilityPath)) { + projectConfig.entryObj[entryPageKey] = projectAbilityPath + '?entry'; + } + } + }); +} + function readAbilityEntrance(moduleJson) { let abilityPages = []; if (moduleJson.module) { -- Gitee From c7e95cea675ff70b17576a4cb4046f70e9d6dcc3 Mon Sep 17 00:00:00 2001 From: njupthan Date: Fri, 4 Mar 2022 16:10:46 +0000 Subject: [PATCH 16/42] Fix codex Signed-off-by: njupthan --- compiler/main.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/compiler/main.js b/compiler/main.js index 013c2bdae..a6ecac25d 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -178,8 +178,6 @@ function setStageTestRunnerFile(projectConfig) { const relativePath = path.relative(testRunnerPath, item).replace(/\.(ts|js)$/, ''); projectConfig.entryObj["./TestRunner/" + relativePath] = item; abilityConfig.testRunnerFile.push(item); - //throw Error('testRunnerPath: ' + item).message; - } }) } -- Gitee From f43de76b8a08d7a42df3cc48a4642725960a00bd Mon Sep 17 00:00:00 2001 From: houhaoyu Date: Sun, 6 Mar 2022 16:17:25 +0800 Subject: [PATCH 17/42] houhaoyu@huawei.com fix @Preview bug Signed-off-by: houhaoyu Change-Id: I32807fab6bc96ee2d735f6fd985852f952f8d0e9 --- compiler/src/process_component_class.ts | 2 +- compiler/src/validate_ui_syntax.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/src/process_component_class.ts b/compiler/src/process_component_class.ts index 38f0c8ef8..9de77666a 100644 --- a/compiler/src/process_component_class.ts +++ b/compiler/src/process_component_class.ts @@ -99,7 +99,7 @@ function checkPreview(node: ts.ClassDeclaration) { let hasPreview: boolean = false; if (node && node.decorators) { for (let i = 0; i < node.decorators.length; i++) { - const name: string = node.decorators[i].getText().replace(/\((.|\n)*\)/, '').trim(); + const name: string = node.decorators[i].getText().replace(/\([^\(\)]*\)/, '').trim(); if (name === COMPONENT_DECORATOR_PREVIEW) { hasPreview = true; break; diff --git a/compiler/src/validate_ui_syntax.ts b/compiler/src/validate_ui_syntax.ts index 5dd4474de..7efd1f804 100644 --- a/compiler/src/validate_ui_syntax.ts +++ b/compiler/src/validate_ui_syntax.ts @@ -271,7 +271,7 @@ function checkDecorators(node: ts.MissingDeclaration | ts.ExportAssignment, resu let hasComponentDecorator: boolean = false; const componentName: string = component.getText(); node.decorators.forEach((element) => { - const name: string = element.getText().replace(/\((.|\n)*\)/, '').trim(); + const name: string = element.getText().replace(/\([^\(\)]*\)/, '').trim(); if (INNER_COMPONENT_DECORATORS.has(name)) { componentCollection.customComponents.add(componentName); switch (name) { -- Gitee From 7a1ca4ad5e0fa98412896e06e8c5b110865b6079 Mon Sep 17 00:00:00 2001 From: houhaoyu Date: Sun, 6 Mar 2022 18:49:45 +0800 Subject: [PATCH 18/42] houhaoyu@huawei.com fix error attr style not warning Signed-off-by: houhaoyu Change-Id: I39579700ec622e9af19c97c6e673cc69cc3dcb97 --- compiler/src/process_component_build.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index d8db918fd..a3039e11e 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -522,6 +522,13 @@ export function bindComponentAttr(node: ts.ExpressionStatement, identifierNode: let temp: any = node.expression; const statements: ts.Statement[] = []; const lastStatement: AnimationInfo = { statement: null, kind: false }; + if (ts.isPropertyAccessExpression(temp)) { + log.push({ + type: LogType.ERROR, + message: `'${node.getText()}' does not meet UI component syntax.`, + pos: node.getStart() + }); + } while (temp && ts.isCallExpression(temp) && temp.expression) { if (temp.expression && (validatePropertyAccessExpressionWithCustomBuilder(temp.expression) || validateIdentifierWithCustomBuilder(temp.expression))) { -- Gitee From 38752e52e5b106b91e98b0f0a760043ceb6ecfe9 Mon Sep 17 00:00:00 2001 From: houhaoyu Date: Mon, 7 Mar 2022 09:44:33 +0800 Subject: [PATCH 19/42] houhaoyu@huawei.com fix debugline Signed-off-by: houhaoyu Change-Id: I3d1af6f4d781199c55c3bdb64a3085f34c48601a --- compiler/server/build_pipe_server.js | 33 ++++++++++++++++++++--- compiler/src/process_component_build.ts | 36 ++++++++++++++++++++++--- 2 files changed, 62 insertions(+), 7 deletions(-) diff --git a/compiler/server/build_pipe_server.js b/compiler/server/build_pipe_server.js index 4d3e8a63b..fbc9c398c 100644 --- a/compiler/server/build_pipe_server.js +++ b/compiler/server/build_pipe_server.js @@ -22,6 +22,12 @@ const WebSocketServer = WebSocket.Server; let pluginSocket = ''; +let supplement = { + isAcceleratePreview: false, + line: 0, + column: 0 +} + const pluginCommandChannelMessageHandlers = { 'compileComponent': handlePluginCompileComponent, 'default': () => {} @@ -50,14 +56,35 @@ function handlePluginCommand(jsonData) { function handlePluginCompileComponent(jsonData) { const receivedMsg = jsonData; - const sourceNode = ts.createSourceFile - ('preview.ts', receivedMsg.data.script, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + const sourceNode = ts.createSourceFile('preview.ts', receivedMsg.data.script, + ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); const previewStatements = []; - processComponentChild(sourceNode, previewStatements, []); + const log = []; + supplement = { + isAcceleratePreview: true, + line: parseInt(JSON.parse(receivedMsg.data.offset).line), + column: parseInt(JSON.parse(receivedMsg.data.offset).column) + } + processComponentChild(sourceNode, previewStatements, log, supplement); + supplement.isAcceleratePreview = false; const newSource = ts.factory.updateSourceFile(sourceNode, previewStatements); const printer = ts.createPrinter({ newLine: ts.NewLineKind.LineFeed }); const result = printer.printNode(ts.EmitHint.Unspecified, newSource, newSource); receivedMsg.data.script = ts.transpileModule(result, {}).outputText; + if (receivedMsg.data.offset) { + for (let i = 0; i < log.length; i++) { + let line = parseInt(newSource.getLineAndCharacterOfPosition(log[i].pos).line); + let column = parseInt(newSource.getLineAndCharacterOfPosition(log[i].pos).character); + if (line === 0) { + log[i].line = parseInt(JSON.parse(receivedMsg.data.offset).line); + log[i].column = parseInt(JSON.parse(receivedMsg.data.offset).column) + column; + } else { + log[i].line = parseInt(JSON.parse(receivedMsg.data.offset).line) + line; + log[i].column = column; + } + } + } + receivedMsg.data.log = log; if (pluginSocket.readyState === WebSocket.OPEN){ responseToPlugin(receivedMsg); } diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index d8db918fd..97e90585a 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -162,8 +162,23 @@ function validateRootNode(node: ts.MethodDeclaration, log: LogInfo[]): boolean { return isValid; } +interface supplementType { + isAcceleratePreview: boolean, + line: number, + column: number +} + +let newsupplement: supplementType = { + isAcceleratePreview: false, + line: 0, + column: 0 +}; + export function processComponentChild(node: ts.Block | ts.SourceFile, newStatements: ts.Statement[], - log: LogInfo[]): void { + log: LogInfo[], supplement: supplementType = {isAcceleratePreview: false, line: 0, column: 0}): void { + if (supplement.isAcceleratePreview) { + newsupplement = supplement; + } if (node.statements.length) { node.statements.forEach((item, index, array) => { if (ts.isExpressionStatement(item)) { @@ -256,9 +271,22 @@ function processInnerComponent(node: ts.ExpressionStatement, index: number, arr: transformLog.sourceFile.getLineAndCharacterOfPosition(getRealNodePos(node)); const projectPath: string = projectConfig.projectPath; const curFileName: string = transformLog.sourceFile.fileName.replace(/.ts$/, ''); + let line: number = 1; + let col: number = 1; + if (newsupplement.isAcceleratePreview) { + if (posOfNode.line === 0) { + col = newsupplement.column; + } + line = newsupplement.line; + } + newsupplement = { + isAcceleratePreview: false, + line: 0, + column: 0 + }; const debugInfo: string = `${path.relative(projectPath, curFileName).replace(/\\+/g, '/')}` + - `(${posOfNode.line + 1}:${posOfNode.character + 1})`; + `(${posOfNode.line + line}:${posOfNode.character + col})`; const debugNode: ts.ExpressionStatement = ts.factory.createExpressionStatement( createFunction(ts.factory.createIdentifier(getName(node)), ts.factory.createIdentifier(COMPONENT_DEBUGLINE_FUNCTION), @@ -622,7 +650,7 @@ function processDragStartBuilder(node: ts.CallExpression): ts.CallExpression { // @ts-ignore for (let i = 0; i < node.arguments[0].body.statements.length; i++) { // @ts-ignore - let statement: ts.Statement = node.arguments[0].body.statements[i]; + const statement: ts.Statement = node.arguments[0].body.statements[i]; newStatements.push(checkStatement(statement)); } node = ts.factory.updateCallExpression(node, node.expression, node.typeArguments, [ts.factory.updateArrowFunction( @@ -644,7 +672,7 @@ function checkStatement(statement: ts.Statement): ts.Statement { if (ts.isObjectLiteralExpression(statement.expression)) { const newProperties: ts.ObjectLiteralElementLike[] = []; for (let j = 0; j < statement.expression.properties.length; j++) { - let property: ts.ObjectLiteralElementLike = statement.expression.properties[j]; + const property: ts.ObjectLiteralElementLike = statement.expression.properties[j]; checkProperty(property); newProperties.push(property); } -- Gitee From 1e3e3ab511a24b3f45d01c1a257877286bd34f61 Mon Sep 17 00:00:00 2001 From: laibo102 Date: Wed, 9 Mar 2022 16:31:40 +0800 Subject: [PATCH 20/42] =?UTF-8?q?=E6=B7=BB=E5=8A=A0webpack=E5=AF=B9?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E3=80=81=E5=AA=92=E4=BD=93=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=9A=84=E6=89=93=E5=8C=85=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: laibo102 Change-Id: I03ea41d013b7a437dd94f07276b18ea8c16ec8c7 --- compiler/package-lock.json | 21 +++++++++++++++++++++ compiler/package.json | 4 +++- compiler/tsconfig.json | 2 +- compiler/webpack.config.js | 6 ++++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/compiler/package-lock.json b/compiler/package-lock.json index 66c7d41b7..95823b3b1 100644 --- a/compiler/package-lock.json +++ b/compiler/package-lock.json @@ -2517,6 +2517,16 @@ "flat-cache": "^3.0.4" } }, + "file-loader": { + "version": "6.2.0", + "resolved": "https://registry.npmmirror.com/file-loader/-/file-loader-6.2.0.tgz", + "integrity": "sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw==", + "dev": true, + "requires": { + "loader-utils": "^2.0.0", + "schema-utils": "^3.0.0" + } + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.nlark.com/fill-range/download/fill-range-7.0.1.tgz", @@ -4124,6 +4134,17 @@ "punycode": "^2.1.0" } }, + "url-loader": { + "version": "4.1.1", + "resolved": "https://registry.npmmirror.com/url-loader/-/url-loader-4.1.1.tgz", + "integrity": "sha512-3BTV812+AVHHOJQO8O5MkWgZ5aosP7GnROJwvzLS9hWDj00lZ6Z0wNak423Lp9PBZN05N+Jk/N5Si8jRAlGyWA==", + "dev": true, + "requires": { + "loader-utils": "^2.0.0", + "mime-types": "^2.1.27", + "schema-utils": "^3.0.0" + } + }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npm.taobao.org/util-deprecate/download/util-deprecate-1.0.2.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Futil-deprecate%2Fdownload%2Futil-deprecate-1.0.2.tgz", diff --git a/compiler/package.json b/compiler/package.json index cf6c7141f..019beb32b 100644 --- a/compiler/package.json +++ b/compiler/package.json @@ -28,11 +28,13 @@ "@typescript-eslint/parser": "^4.11.0", "chai": "^4.2.0", "eslint": "^7.16.0", + "file-loader": "^6.2.0", "mocha": "^8.2.1", "mocha-context": "^0.1.5", "pegjs": "^0.10.0", "ts-node": "^9.1.1", - "uglify-js": "^3.13.0" + "uglify-js": "^3.13.0", + "url-loader": "^4.1.1" }, "dependencies": { "clean-webpack-plugin": "^3.0.0", diff --git a/compiler/tsconfig.json b/compiler/tsconfig.json index 822f29fa5..1664725da 100644 --- a/compiler/tsconfig.json +++ b/compiler/tsconfig.json @@ -14,7 +14,7 @@ "sourceMap": true, "module": "commonjs", "target": "es2017", - "types": [], + "types": ["node"], "typeRoots": [], "lib": [ "es2020" diff --git a/compiler/webpack.config.js b/compiler/webpack.config.js index 94a1ed29f..efafdcbd7 100644 --- a/compiler/webpack.config.js +++ b/compiler/webpack.config.js @@ -56,6 +56,12 @@ function initConfig(config) { mode: 'development', module: { rules: [ + { + test:/\.(jpg|png|gif|jpeg|mp3|mp4)$/, + use:{ + loader:'url-loader' + } + }, { test: /\.d\.ts/, loader: 'ignore-loader' -- Gitee From 9734afb60e148f95dd8ed76ab4746ccccac5329c Mon Sep 17 00:00:00 2001 From: laibo102 Date: Thu, 10 Mar 2022 15:28:18 +0800 Subject: [PATCH 21/42] update:BUILD.gn Signed-off-by: laibo102 Change-Id: I3d59cc6c4a324e23d4bf86c3c2cf21978275eb51 --- BUILD.gn | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/BUILD.gn b/BUILD.gn index 2fb8d0eb9..c8aab5db3 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -14,6 +14,7 @@ import("//build/ohos.gni") import("//build/ohos/ace/ace.gni") import("//foundation/ace/ace_engine/ace_config.gni") +import("//interface/sdk-js/interface_config.gni") ets_loader_lib_dir = get_label_info(":build_ets_loader_library", "target_out_dir") + "/lib" @@ -270,8 +271,25 @@ ohos_copy("ets_loader_ark_codegen") { outputs = [ target_out_dir + "/ets_loader_ark/codegen" ] } +ohos_copy("ohos_declaration_ets_ark") { + deps = [ "//interface/sdk-js:ohos_declaration_ets" ] + + sources = [ root_out_dir + "/ohos_declaration/ohos_declaration_ets" ] + + outputs = [ target_out_dir + "/../api" ] +} + +ohos_copy("common_api_ark") { + sources = common_api_src + deps = [ ":ohos_declaration_ets_ark" ] + outputs = + [ target_out_dir + "/../../developtools/api/{{source_file_part}}" ] + module_install_name = "" +} + ohos_copy("ets_loader_node_modules") { deps = [ + ":common_api_ark", ":ets_loader_ark", ":ets_loader_ark_codegen", ":ets_loader_ark_components", -- Gitee From 2d66f24dc7143653e7a0240c89e2314fcac66598 Mon Sep 17 00:00:00 2001 From: lizhouze Date: Fri, 11 Mar 2022 11:11:17 +0800 Subject: [PATCH 22/42] lizhouze@huawei.com Signed-off-by: lizhouze --- compiler/codegen/codegen_ets.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/codegen/codegen_ets.js b/compiler/codegen/codegen_ets.js index ae799e831..0c4867ad0 100644 --- a/compiler/codegen/codegen_ets.js +++ b/compiler/codegen/codegen_ets.js @@ -13,4 +13,4 @@ * limitations under the License. */ -(()=>{var e={486:function(e,t,n){var r;e=n.nmd(e),function(){var i,o="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",c=32,u=128,l=1/0,f=9007199254740991,p=NaN,d=4294967295,h=[["ary",u],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",c],["partialRight",64],["rearg",256]],g="[object Arguments]",y="[object Array]",m="[object Boolean]",v="[object Date]",_="[object Error]",T="[object Function]",w="[object GeneratorFunction]",b="[object Map]",E="[object Number]",C="[object Object]",P="[object Promise]",S="[object RegExp]",k="[object Set]",A="[object String]",M="[object Symbol]",x="[object WeakMap]",I="[object ArrayBuffer]",N="[object DataView]",O="[object Float32Array]",R="[object Float64Array]",z="[object Int8Array]",D="[object Int16Array]",j="[object Int32Array]",W="[object Uint8Array]",L="[object Uint8ClampedArray]",F="[object Uint16Array]",V="[object Uint32Array]",B=/\b__p \+= '';/g,U=/\b(__p \+=) '' \+/g,$=/(__e\(.*?\)|\b__t\)) \+\n'';/g,G=/&(?:amp|lt|gt|quot|#39);/g,Q=/[&<>"']/g,q=RegExp(G.source),H=RegExp(Q.source),Y=/<%-([\s\S]+?)%>/g,K=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,Z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,X=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,ne=RegExp(te.source),re=/^\s+/,ie=/\s/,oe=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,ce=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ue=/[()=,{}\[\]\/\s]/,le=/\\(\\)?/g,fe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,pe=/\w*$/,de=/^[-+]0x[0-9a-f]+$/i,he=/^0b[01]+$/i,ge=/^\[object .+?Constructor\]$/,ye=/^0o[0-7]+$/i,me=/^(?:0|[1-9]\d*)$/,ve=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_e=/($^)/,Te=/['\n\r\u2028\u2029\\]/g,we="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",be="a-z\\xdf-\\xf6\\xf8-\\xff",Ee="A-Z\\xc0-\\xd6\\xd8-\\xde",Ce="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Pe="["+Ce+"]",Se="["+we+"]",ke="\\d+",Ae="["+be+"]",Me="[^\\ud800-\\udfff"+Ce+ke+"\\u2700-\\u27bf"+be+Ee+"]",xe="\\ud83c[\\udffb-\\udfff]",Ie="[^\\ud800-\\udfff]",Ne="(?:\\ud83c[\\udde6-\\uddff]){2}",Oe="[\\ud800-\\udbff][\\udc00-\\udfff]",Re="["+Ee+"]",ze="(?:"+Ae+"|"+Me+")",De="(?:"+Re+"|"+Me+")",je="(?:['’](?:d|ll|m|re|s|t|ve))?",We="(?:['’](?:D|LL|M|RE|S|T|VE))?",Le="(?:"+Se+"|"+xe+")?",Fe="[\\ufe0e\\ufe0f]?",Ve=Fe+Le+"(?:\\u200d(?:"+[Ie,Ne,Oe].join("|")+")"+Fe+Le+")*",Be="(?:"+["[\\u2700-\\u27bf]",Ne,Oe].join("|")+")"+Ve,Ue="(?:"+[Ie+Se+"?",Se,Ne,Oe,"[\\ud800-\\udfff]"].join("|")+")",$e=RegExp("['’]","g"),Ge=RegExp(Se,"g"),Qe=RegExp(xe+"(?="+xe+")|"+Ue+Ve,"g"),qe=RegExp([Re+"?"+Ae+"+"+je+"(?="+[Pe,Re,"$"].join("|")+")",De+"+"+We+"(?="+[Pe,Re+ze,"$"].join("|")+")",Re+"?"+ze+"+"+je,Re+"+"+We,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",ke,Be].join("|"),"g"),He=RegExp("[\\u200d\\ud800-\\udfff"+we+"\\ufe0e\\ufe0f]"),Ye=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Ke=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Je=-1,Ze={};Ze[O]=Ze[R]=Ze[z]=Ze[D]=Ze[j]=Ze[W]=Ze[L]=Ze[F]=Ze[V]=!0,Ze[g]=Ze[y]=Ze[I]=Ze[m]=Ze[N]=Ze[v]=Ze[_]=Ze[T]=Ze[b]=Ze[E]=Ze[C]=Ze[S]=Ze[k]=Ze[A]=Ze[x]=!1;var Xe={};Xe[g]=Xe[y]=Xe[I]=Xe[N]=Xe[m]=Xe[v]=Xe[O]=Xe[R]=Xe[z]=Xe[D]=Xe[j]=Xe[b]=Xe[E]=Xe[C]=Xe[S]=Xe[k]=Xe[A]=Xe[M]=Xe[W]=Xe[L]=Xe[F]=Xe[V]=!0,Xe[_]=Xe[T]=Xe[x]=!1;var et={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},tt=parseFloat,nt=parseInt,rt="object"==typeof n.g&&n.g&&n.g.Object===Object&&n.g,it="object"==typeof self&&self&&self.Object===Object&&self,ot=rt||it||Function("return this")(),at=t&&!t.nodeType&&t,st=at&&e&&!e.nodeType&&e,ct=st&&st.exports===at,ut=ct&&rt.process,lt=function(){try{return st&&st.require&&st.require("util").types||ut&&ut.binding&&ut.binding("util")}catch(e){}}(),ft=lt&<.isArrayBuffer,pt=lt&<.isDate,dt=lt&<.isMap,ht=lt&<.isRegExp,gt=lt&<.isSet,yt=lt&<.isTypedArray;function mt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function vt(e,t,n,r){for(var i=-1,o=null==e?0:e.length;++i-1}function Ct(e,t,n){for(var r=-1,i=null==e?0:e.length;++r-1;);return n}function qt(e,t){for(var n=e.length;n--&&Ot(t,e[n],0)>-1;);return n}function Ht(e,t){for(var n=e.length,r=0;n--;)e[n]===t&&++r;return r}var Yt=Wt({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Kt=Wt({"&":"&","<":"<",">":">",'"':""","'":"'"});function Jt(e){return"\\"+et[e]}function Zt(e){return He.test(e)}function Xt(e){var t=-1,n=Array(e.size);return e.forEach((function(e,r){n[++t]=[r,e]})),n}function en(e,t){return function(n){return e(t(n))}}function tn(e,t){for(var n=-1,r=e.length,i=0,o=[];++n",""":'"',"'":"'"}),un=function e(t){var n,r=(t=null==t?ot:un.defaults(ot.Object(),t,un.pick(ot,Ke))).Array,ie=t.Date,we=t.Error,be=t.Function,Ee=t.Math,Ce=t.Object,Pe=t.RegExp,Se=t.String,ke=t.TypeError,Ae=r.prototype,Me=be.prototype,xe=Ce.prototype,Ie=t["__core-js_shared__"],Ne=Me.toString,Oe=xe.hasOwnProperty,Re=0,ze=(n=/[^.]+$/.exec(Ie&&Ie.keys&&Ie.keys.IE_PROTO||""))?"Symbol(src)_1."+n:"",De=xe.toString,je=Ne.call(Ce),We=ot._,Le=Pe("^"+Ne.call(Oe).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Fe=ct?t.Buffer:i,Ve=t.Symbol,Be=t.Uint8Array,Ue=Fe?Fe.allocUnsafe:i,Qe=en(Ce.getPrototypeOf,Ce),He=Ce.create,et=xe.propertyIsEnumerable,rt=Ae.splice,it=Ve?Ve.isConcatSpreadable:i,at=Ve?Ve.iterator:i,st=Ve?Ve.toStringTag:i,ut=function(){try{var e=uo(Ce,"defineProperty");return e({},"",{}),e}catch(e){}}(),lt=t.clearTimeout!==ot.clearTimeout&&t.clearTimeout,xt=ie&&ie.now!==ot.Date.now&&ie.now,Wt=t.setTimeout!==ot.setTimeout&&t.setTimeout,ln=Ee.ceil,fn=Ee.floor,pn=Ce.getOwnPropertySymbols,dn=Fe?Fe.isBuffer:i,hn=t.isFinite,gn=Ae.join,yn=en(Ce.keys,Ce),mn=Ee.max,vn=Ee.min,_n=ie.now,Tn=t.parseInt,wn=Ee.random,bn=Ae.reverse,En=uo(t,"DataView"),Cn=uo(t,"Map"),Pn=uo(t,"Promise"),Sn=uo(t,"Set"),kn=uo(t,"WeakMap"),An=uo(Ce,"create"),Mn=kn&&new kn,xn={},In=Lo(En),Nn=Lo(Cn),On=Lo(Pn),Rn=Lo(Sn),zn=Lo(kn),Dn=Ve?Ve.prototype:i,jn=Dn?Dn.valueOf:i,Wn=Dn?Dn.toString:i;function Ln(e){if(ns(e)&&!Ga(e)&&!(e instanceof Un)){if(e instanceof Bn)return e;if(Oe.call(e,"__wrapped__"))return Fo(e)}return new Bn(e)}var Fn=function(){function e(){}return function(t){if(!ts(t))return{};if(He)return He(t);e.prototype=t;var n=new e;return e.prototype=i,n}}();function Vn(){}function Bn(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=i}function Un(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function $n(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function sr(e,t,n,r,o,a){var s,c=1&t,u=2&t,l=4&t;if(n&&(s=o?n(e,r,o,a):n(e)),s!==i)return s;if(!ts(e))return e;var f=Ga(e);if(f){if(s=function(e){var t=e.length,n=new e.constructor(t);return t&&"string"==typeof e[0]&&Oe.call(e,"index")&&(n.index=e.index,n.input=e.input),n}(e),!c)return ki(e,s)}else{var p=po(e),d=p==T||p==w;if(Ya(e))return wi(e,c);if(p==C||p==g||d&&!o){if(s=u||d?{}:go(e),!c)return u?function(e,t){return Ai(e,fo(e),t)}(e,function(e,t){return e&&Ai(t,Os(t),e)}(s,e)):function(e,t){return Ai(e,lo(e),t)}(e,rr(s,e))}else{if(!Xe[p])return o?e:{};s=function(e,t,n){var r,i=e.constructor;switch(t){case I:return bi(e);case m:case v:return new i(+e);case N:return function(e,t){var n=t?bi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.byteLength)}(e,n);case O:case R:case z:case D:case j:case W:case L:case F:case V:return Ei(e,n);case b:case k:return new i;case E:case A:return new i(e);case S:return function(e){var t=new e.constructor(e.source,pe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case M:return r=e,jn?Ce(jn.call(r)):{}}}(e,p,c)}}a||(a=new Hn);var h=a.get(e);if(h)return h;a.set(e,s),ss(e)?e.forEach((function(r){s.add(sr(r,t,n,r,e,a))})):rs(e)&&e.forEach((function(r,i){s.set(i,sr(r,t,n,i,e,a))}));var y=f?i:(l?u?no:to:u?Os:Ns)(e);return _t(y||e,(function(r,i){y&&(r=e[i=r]),er(s,i,sr(r,t,n,i,e,a))})),s}function cr(e,t,n){var r=n.length;if(null==e)return!r;for(e=Ce(e);r--;){var o=n[r],a=t[o],s=e[o];if(s===i&&!(o in e)||!a(s))return!1}return!0}function ur(e,t,n){if("function"!=typeof e)throw new ke(o);return xo((function(){e.apply(i,n)}),t)}function lr(e,t,n,r){var i=-1,o=Et,a=!0,s=e.length,c=[],u=t.length;if(!s)return c;n&&(t=Pt(t,Ut(n))),r?(o=Ct,a=!1):t.length>=200&&(o=Gt,a=!1,t=new qn(t));e:for(;++i-1},Gn.prototype.set=function(e,t){var n=this.__data__,r=tr(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this},Qn.prototype.clear=function(){this.size=0,this.__data__={hash:new $n,map:new(Cn||Gn),string:new $n}},Qn.prototype.delete=function(e){var t=so(this,e).delete(e);return this.size-=t?1:0,t},Qn.prototype.get=function(e){return so(this,e).get(e)},Qn.prototype.has=function(e){return so(this,e).has(e)},Qn.prototype.set=function(e,t){var n=so(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this},qn.prototype.add=qn.prototype.push=function(e){return this.__data__.set(e,a),this},qn.prototype.has=function(e){return this.__data__.has(e)},Hn.prototype.clear=function(){this.__data__=new Gn,this.size=0},Hn.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Hn.prototype.get=function(e){return this.__data__.get(e)},Hn.prototype.has=function(e){return this.__data__.has(e)},Hn.prototype.set=function(e,t){var n=this.__data__;if(n instanceof Gn){var r=n.__data__;if(!Cn||r.length<199)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new Qn(r)}return n.set(e,t),this.size=n.size,this};var fr=Ii(_r),pr=Ii(Tr,!0);function dr(e,t){var n=!0;return fr(e,(function(e,r,i){return n=!!t(e,r,i)})),n}function hr(e,t,n){for(var r=-1,o=e.length;++r0&&n(s)?t>1?yr(s,t-1,n,r,i):St(i,s):r||(i[i.length]=s)}return i}var mr=Ni(),vr=Ni(!0);function _r(e,t){return e&&mr(e,t,Ns)}function Tr(e,t){return e&&vr(e,t,Ns)}function wr(e,t){return bt(t,(function(t){return Za(e[t])}))}function br(e,t){for(var n=0,r=(t=mi(t,e)).length;null!=e&&nt}function Sr(e,t){return null!=e&&Oe.call(e,t)}function kr(e,t){return null!=e&&t in Ce(e)}function Ar(e,t,n){for(var o=n?Ct:Et,a=e[0].length,s=e.length,c=s,u=r(s),l=1/0,f=[];c--;){var p=e[c];c&&t&&(p=Pt(p,Ut(t))),l=vn(p.length,l),u[c]=!n&&(t||a>=120&&p.length>=120)?new qn(c&&p):i}p=e[0];var d=-1,h=u[0];e:for(;++d=s?c:c*("desc"==n[r]?-1:1)}return e.index-t.index}(e,t,n)}));r--;)e[r]=e[r].value;return e}(i)}function Ur(e,t,n){for(var r=-1,i=t.length,o={};++r-1;)s!==e&&rt.call(s,c,1),rt.call(e,c,1);return e}function Gr(e,t){for(var n=e?t.length:0,r=n-1;n--;){var i=t[n];if(n==r||i!==o){var o=i;mo(i)?rt.call(e,i,1):ui(e,i)}}return e}function Qr(e,t){return e+fn(wn()*(t-e+1))}function qr(e,t){var n="";if(!e||t<1||t>f)return n;do{t%2&&(n+=e),(t=fn(t/2))&&(e+=e)}while(t);return n}function Hr(e,t){return Io(Po(e,t,ic),e+"")}function Yr(e){return Kn(Vs(e))}function Kr(e,t){var n=Vs(e);return Ro(n,ar(t,0,n.length))}function Jr(e,t,n,r){if(!ts(e))return e;for(var o=-1,a=(t=mi(t,e)).length,s=a-1,c=e;null!=c&&++oo?0:o+t),(n=n>o?o:n)<0&&(n+=o),o=t>n?0:n-t>>>0,t>>>=0;for(var a=r(o);++i>>1,a=e[o];null!==a&&!us(a)&&(n?a<=t:a=200){var u=t?null:qi(e);if(u)return nn(u);a=!1,i=Gt,c=new qn}else c=t?[]:s;e:for(;++r=r?e:ti(e,t,n)}var Ti=lt||function(e){return ot.clearTimeout(e)};function wi(e,t){if(t)return e.slice();var n=e.length,r=Ue?Ue(n):new e.constructor(n);return e.copy(r),r}function bi(e){var t=new e.constructor(e.byteLength);return new Be(t).set(new Be(e)),t}function Ei(e,t){var n=t?bi(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}function Ci(e,t){if(e!==t){var n=e!==i,r=null===e,o=e==e,a=us(e),s=t!==i,c=null===t,u=t==t,l=us(t);if(!c&&!l&&!a&&e>t||a&&s&&u&&!c&&!l||r&&s&&u||!n&&u||!o)return 1;if(!r&&!a&&!l&&e1?n[o-1]:i,s=o>2?n[2]:i;for(a=e.length>3&&"function"==typeof a?(o--,a):i,s&&vo(n[0],n[1],s)&&(a=o<3?i:a,o=1),t=Ce(t);++r-1?o[a?t[s]:s]:i}}function ji(e){return eo((function(t){var n=t.length,r=n,a=Bn.prototype.thru;for(e&&t.reverse();r--;){var s=t[r];if("function"!=typeof s)throw new ke(o);if(a&&!c&&"wrapper"==io(s))var c=new Bn([],!0)}for(r=c?r:n;++r1&&_.reverse(),d&&fc))return!1;var l=a.get(e),f=a.get(t);if(l&&f)return l==t&&f==e;var p=-1,d=!0,h=2&n?new qn:i;for(a.set(e,t),a.set(t,e);++p-1&&e%1==0&&e1?"& ":"")+t[r],t=t.join(n>2?", ":" "),e.replace(oe,"{\n/* [wrapped with "+t+"] */\n")}(r,function(e,t){return _t(h,(function(n){var r="_."+n[0];t&n[1]&&!Et(e,r)&&e.push(r)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(se):[]}(r),n)))}function Oo(e){var t=0,n=0;return function(){var r=_n(),o=16-(r-n);if(n=r,o>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(i,arguments)}}function Ro(e,t){var n=-1,r=e.length,o=r-1;for(t=t===i?r:t;++n1?e[t-1]:i;return n="function"==typeof n?(e.pop(),n):i,aa(e,n)}));function da(e){var t=Ln(e);return t.__chain__=!0,t}function ha(e,t){return t(e)}var ga=eo((function(e){var t=e.length,n=t?e[0]:0,r=this.__wrapped__,o=function(t){return or(t,e)};return!(t>1||this.__actions__.length)&&r instanceof Un&&mo(n)?((r=r.slice(n,+n+(t?1:0))).__actions__.push({func:ha,args:[o],thisArg:i}),new Bn(r,this.__chain__).thru((function(e){return t&&!e.length&&e.push(i),e}))):this.thru(o)})),ya=Mi((function(e,t,n){Oe.call(e,n)?++e[n]:ir(e,n,1)})),ma=Di($o),va=Di(Go);function _a(e,t){return(Ga(e)?_t:fr)(e,ao(t,3))}function Ta(e,t){return(Ga(e)?Tt:pr)(e,ao(t,3))}var wa=Mi((function(e,t,n){Oe.call(e,n)?e[n].push(t):ir(e,n,[t])})),ba=Hr((function(e,t,n){var i=-1,o="function"==typeof t,a=qa(e)?r(e.length):[];return fr(e,(function(e){a[++i]=o?mt(t,e,n):Mr(e,t,n)})),a})),Ea=Mi((function(e,t,n){ir(e,n,t)}));function Ca(e,t){return(Ga(e)?Pt:jr)(e,ao(t,3))}var Pa=Mi((function(e,t,n){e[n?0:1].push(t)}),(function(){return[[],[]]})),Sa=Hr((function(e,t){if(null==e)return[];var n=t.length;return n>1&&vo(e,t[0],t[1])?t=[]:n>2&&vo(t[0],t[1],t[2])&&(t=[t[0]]),Br(e,yr(t,1),[])})),ka=xt||function(){return ot.Date.now()};function Aa(e,t,n){return t=n?i:t,t=e&&null==t?e.length:t,Yi(e,u,i,i,i,i,t)}function Ma(e,t){var n;if("function"!=typeof t)throw new ke(o);return e=gs(e),function(){return--e>0&&(n=t.apply(this,arguments)),e<=1&&(t=i),n}}var xa=Hr((function(e,t,n){var r=1;if(n.length){var i=tn(n,oo(xa));r|=c}return Yi(e,r,t,n,i)})),Ia=Hr((function(e,t,n){var r=3;if(n.length){var i=tn(n,oo(Ia));r|=c}return Yi(t,r,e,n,i)}));function Na(e,t,n){var r,a,s,c,u,l,f=0,p=!1,d=!1,h=!0;if("function"!=typeof e)throw new ke(o);function g(t){var n=r,o=a;return r=a=i,f=t,c=e.apply(o,n)}function y(e){return f=e,u=xo(v,t),p?g(e):c}function m(e){var n=e-l;return l===i||n>=t||n<0||d&&e-f>=s}function v(){var e=ka();if(m(e))return _(e);u=xo(v,function(e){var n=t-(e-l);return d?vn(n,s-(e-f)):n}(e))}function _(e){return u=i,h&&r?g(e):(r=a=i,c)}function T(){var e=ka(),n=m(e);if(r=arguments,a=this,l=e,n){if(u===i)return y(l);if(d)return Ti(u),u=xo(v,t),g(l)}return u===i&&(u=xo(v,t)),c}return t=ms(t)||0,ts(n)&&(p=!!n.leading,s=(d="maxWait"in n)?mn(ms(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),T.cancel=function(){u!==i&&Ti(u),f=0,r=l=a=u=i},T.flush=function(){return u===i?c:_(ka())},T}var Oa=Hr((function(e,t){return ur(e,1,t)})),Ra=Hr((function(e,t,n){return ur(e,ms(t)||0,n)}));function za(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new ke(o);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=e.apply(this,r);return n.cache=o.set(i,a)||o,a};return n.cache=new(za.Cache||Qn),n}function Da(e){if("function"!=typeof e)throw new ke(o);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}za.Cache=Qn;var ja=vi((function(e,t){var n=(t=1==t.length&&Ga(t[0])?Pt(t[0],Ut(ao())):Pt(yr(t,1),Ut(ao()))).length;return Hr((function(r){for(var i=-1,o=vn(r.length,n);++i=t})),$a=xr(function(){return arguments}())?xr:function(e){return ns(e)&&Oe.call(e,"callee")&&!et.call(e,"callee")},Ga=r.isArray,Qa=ft?Ut(ft):function(e){return ns(e)&&Cr(e)==I};function qa(e){return null!=e&&es(e.length)&&!Za(e)}function Ha(e){return ns(e)&&qa(e)}var Ya=dn||mc,Ka=pt?Ut(pt):function(e){return ns(e)&&Cr(e)==v};function Ja(e){if(!ns(e))return!1;var t=Cr(e);return t==_||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!os(e)}function Za(e){if(!ts(e))return!1;var t=Cr(e);return t==T||t==w||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Xa(e){return"number"==typeof e&&e==gs(e)}function es(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=f}function ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function ns(e){return null!=e&&"object"==typeof e}var rs=dt?Ut(dt):function(e){return ns(e)&&po(e)==b};function is(e){return"number"==typeof e||ns(e)&&Cr(e)==E}function os(e){if(!ns(e)||Cr(e)!=C)return!1;var t=Qe(e);if(null===t)return!0;var n=Oe.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&Ne.call(n)==je}var as=ht?Ut(ht):function(e){return ns(e)&&Cr(e)==S},ss=gt?Ut(gt):function(e){return ns(e)&&po(e)==k};function cs(e){return"string"==typeof e||!Ga(e)&&ns(e)&&Cr(e)==A}function us(e){return"symbol"==typeof e||ns(e)&&Cr(e)==M}var ls=yt?Ut(yt):function(e){return ns(e)&&es(e.length)&&!!Ze[Cr(e)]},fs=$i(Dr),ps=$i((function(e,t){return e<=t}));function ds(e){if(!e)return[];if(qa(e))return cs(e)?an(e):ki(e);if(at&&e[at])return function(e){for(var t,n=[];!(t=e.next()).done;)n.push(t.value);return n}(e[at]());var t=po(e);return(t==b?Xt:t==k?nn:Vs)(e)}function hs(e){return e?(e=ms(e))===l||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function gs(e){var t=hs(e),n=t%1;return t==t?n?t-n:t:0}function ys(e){return e?ar(gs(e),0,d):0}function ms(e){if("number"==typeof e)return e;if(us(e))return p;if(ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=Bt(e);var n=he.test(e);return n||ye.test(e)?nt(e.slice(2),n?2:8):de.test(e)?p:+e}function vs(e){return Ai(e,Os(e))}function _s(e){return null==e?"":si(e)}var Ts=xi((function(e,t){if(bo(t)||qa(t))Ai(t,Ns(t),e);else for(var n in t)Oe.call(t,n)&&er(e,n,t[n])})),ws=xi((function(e,t){Ai(t,Os(t),e)})),bs=xi((function(e,t,n,r){Ai(t,Os(t),e,r)})),Es=xi((function(e,t,n,r){Ai(t,Ns(t),e,r)})),Cs=eo(or),Ps=Hr((function(e,t){e=Ce(e);var n=-1,r=t.length,o=r>2?t[2]:i;for(o&&vo(t[0],t[1],o)&&(r=1);++n1),t})),Ai(e,no(e),n),r&&(n=sr(n,7,Zi));for(var i=t.length;i--;)ui(n,t[i]);return n})),js=eo((function(e,t){return null==e?{}:function(e,t){return Ur(e,t,(function(t,n){return As(e,n)}))}(e,t)}));function Ws(e,t){if(null==e)return{};var n=Pt(no(e),(function(e){return[e]}));return t=ao(t),Ur(e,n,(function(e,n){return t(e,n[0])}))}var Ls=Hi(Ns),Fs=Hi(Os);function Vs(e){return null==e?[]:$t(e,Ns(e))}var Bs=Ri((function(e,t,n){return t=t.toLowerCase(),e+(n?Us(t):t)}));function Us(e){return Js(_s(e).toLowerCase())}function $s(e){return(e=_s(e))&&e.replace(ve,Yt).replace(Ge,"")}var Gs=Ri((function(e,t,n){return e+(n?"-":"")+t.toLowerCase()})),Qs=Ri((function(e,t,n){return e+(n?" ":"")+t.toLowerCase()})),qs=Oi("toLowerCase"),Hs=Ri((function(e,t,n){return e+(n?"_":"")+t.toLowerCase()})),Ys=Ri((function(e,t,n){return e+(n?" ":"")+Js(t)})),Ks=Ri((function(e,t,n){return e+(n?" ":"")+t.toUpperCase()})),Js=Oi("toUpperCase");function Zs(e,t,n){return e=_s(e),(t=n?i:t)===i?function(e){return Ye.test(e)}(e)?function(e){return e.match(qe)||[]}(e):function(e){return e.match(ce)||[]}(e):e.match(t)||[]}var Xs=Hr((function(e,t){try{return mt(e,i,t)}catch(e){return Ja(e)?e:new we(e)}})),ec=eo((function(e,t){return _t(t,(function(t){t=Wo(t),ir(e,t,xa(e[t],e))})),e}));function tc(e){return function(){return e}}var nc=ji(),rc=ji(!0);function ic(e){return e}function oc(e){return Rr("function"==typeof e?e:sr(e,1))}var ac=Hr((function(e,t){return function(n){return Mr(n,e,t)}})),sc=Hr((function(e,t){return function(n){return Mr(e,n,t)}}));function cc(e,t,n){var r=Ns(t),i=wr(t,r);null!=n||ts(t)&&(i.length||!r.length)||(n=t,t=e,e=this,i=wr(t,Ns(t)));var o=!(ts(n)&&"chain"in n&&!n.chain),a=Za(e);return _t(i,(function(n){var r=t[n];e[n]=r,a&&(e.prototype[n]=function(){var t=this.__chain__;if(o||t){var n=e(this.__wrapped__),i=n.__actions__=ki(this.__actions__);return i.push({func:r,args:arguments,thisArg:e}),n.__chain__=t,n}return r.apply(e,St([this.value()],arguments))})})),e}function uc(){}var lc=Vi(Pt),fc=Vi(wt),pc=Vi(Mt);function dc(e){return _o(e)?jt(Wo(e)):function(e){return function(t){return br(t,e)}}(e)}var hc=Ui(),gc=Ui(!0);function yc(){return[]}function mc(){return!1}var vc,_c=Fi((function(e,t){return e+t}),0),Tc=Qi("ceil"),wc=Fi((function(e,t){return e/t}),1),bc=Qi("floor"),Ec=Fi((function(e,t){return e*t}),1),Cc=Qi("round"),Pc=Fi((function(e,t){return e-t}),0);return Ln.after=function(e,t){if("function"!=typeof t)throw new ke(o);return e=gs(e),function(){if(--e<1)return t.apply(this,arguments)}},Ln.ary=Aa,Ln.assign=Ts,Ln.assignIn=ws,Ln.assignInWith=bs,Ln.assignWith=Es,Ln.at=Cs,Ln.before=Ma,Ln.bind=xa,Ln.bindAll=ec,Ln.bindKey=Ia,Ln.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return Ga(e)?e:[e]},Ln.chain=da,Ln.chunk=function(e,t,n){t=(n?vo(e,t,n):t===i)?1:mn(gs(t),0);var o=null==e?0:e.length;if(!o||t<1)return[];for(var a=0,s=0,c=r(ln(o/t));ao?0:o+n),(r=r===i||r>o?o:gs(r))<0&&(r+=o),r=n>r?0:ys(r);n>>0)?(e=_s(e))&&("string"==typeof t||null!=t&&!as(t))&&!(t=si(t))&&Zt(e)?_i(an(e),0,n):e.split(t,n):[]},Ln.spread=function(e,t){if("function"!=typeof e)throw new ke(o);return t=null==t?0:mn(gs(t),0),Hr((function(n){var r=n[t],i=_i(n,0,t);return r&&St(i,r),mt(e,this,i)}))},Ln.tail=function(e){var t=null==e?0:e.length;return t?ti(e,1,t):[]},Ln.take=function(e,t,n){return e&&e.length?ti(e,0,(t=n||t===i?1:gs(t))<0?0:t):[]},Ln.takeRight=function(e,t,n){var r=null==e?0:e.length;return r?ti(e,(t=r-(t=n||t===i?1:gs(t)))<0?0:t,r):[]},Ln.takeRightWhile=function(e,t){return e&&e.length?fi(e,ao(t,3),!1,!0):[]},Ln.takeWhile=function(e,t){return e&&e.length?fi(e,ao(t,3)):[]},Ln.tap=function(e,t){return t(e),e},Ln.throttle=function(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new ke(o);return ts(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),Na(e,t,{leading:r,maxWait:t,trailing:i})},Ln.thru=ha,Ln.toArray=ds,Ln.toPairs=Ls,Ln.toPairsIn=Fs,Ln.toPath=function(e){return Ga(e)?Pt(e,Wo):us(e)?[e]:ki(jo(_s(e)))},Ln.toPlainObject=vs,Ln.transform=function(e,t,n){var r=Ga(e),i=r||Ya(e)||ls(e);if(t=ao(t,4),null==n){var o=e&&e.constructor;n=i?r?new o:[]:ts(e)&&Za(o)?Fn(Qe(e)):{}}return(i?_t:_r)(e,(function(e,r,i){return t(n,e,r,i)})),n},Ln.unary=function(e){return Aa(e,1)},Ln.union=na,Ln.unionBy=ra,Ln.unionWith=ia,Ln.uniq=function(e){return e&&e.length?ci(e):[]},Ln.uniqBy=function(e,t){return e&&e.length?ci(e,ao(t,2)):[]},Ln.uniqWith=function(e,t){return t="function"==typeof t?t:i,e&&e.length?ci(e,i,t):[]},Ln.unset=function(e,t){return null==e||ui(e,t)},Ln.unzip=oa,Ln.unzipWith=aa,Ln.update=function(e,t,n){return null==e?e:li(e,t,yi(n))},Ln.updateWith=function(e,t,n,r){return r="function"==typeof r?r:i,null==e?e:li(e,t,yi(n),r)},Ln.values=Vs,Ln.valuesIn=function(e){return null==e?[]:$t(e,Os(e))},Ln.without=sa,Ln.words=Zs,Ln.wrap=function(e,t){return Wa(yi(t),e)},Ln.xor=ca,Ln.xorBy=ua,Ln.xorWith=la,Ln.zip=fa,Ln.zipObject=function(e,t){return hi(e||[],t||[],er)},Ln.zipObjectDeep=function(e,t){return hi(e||[],t||[],Jr)},Ln.zipWith=pa,Ln.entries=Ls,Ln.entriesIn=Fs,Ln.extend=ws,Ln.extendWith=bs,cc(Ln,Ln),Ln.add=_c,Ln.attempt=Xs,Ln.camelCase=Bs,Ln.capitalize=Us,Ln.ceil=Tc,Ln.clamp=function(e,t,n){return n===i&&(n=t,t=i),n!==i&&(n=(n=ms(n))==n?n:0),t!==i&&(t=(t=ms(t))==t?t:0),ar(ms(e),t,n)},Ln.clone=function(e){return sr(e,4)},Ln.cloneDeep=function(e){return sr(e,5)},Ln.cloneDeepWith=function(e,t){return sr(e,5,t="function"==typeof t?t:i)},Ln.cloneWith=function(e,t){return sr(e,4,t="function"==typeof t?t:i)},Ln.conformsTo=function(e,t){return null==t||cr(e,t,Ns(t))},Ln.deburr=$s,Ln.defaultTo=function(e,t){return null==e||e!=e?t:e},Ln.divide=wc,Ln.endsWith=function(e,t,n){e=_s(e),t=si(t);var r=e.length,o=n=n===i?r:ar(gs(n),0,r);return(n-=t.length)>=0&&e.slice(n,o)==t},Ln.eq=Va,Ln.escape=function(e){return(e=_s(e))&&H.test(e)?e.replace(Q,Kt):e},Ln.escapeRegExp=function(e){return(e=_s(e))&&ne.test(e)?e.replace(te,"\\$&"):e},Ln.every=function(e,t,n){var r=Ga(e)?wt:dr;return n&&vo(e,t,n)&&(t=i),r(e,ao(t,3))},Ln.find=ma,Ln.findIndex=$o,Ln.findKey=function(e,t){return It(e,ao(t,3),_r)},Ln.findLast=va,Ln.findLastIndex=Go,Ln.findLastKey=function(e,t){return It(e,ao(t,3),Tr)},Ln.floor=bc,Ln.forEach=_a,Ln.forEachRight=Ta,Ln.forIn=function(e,t){return null==e?e:mr(e,ao(t,3),Os)},Ln.forInRight=function(e,t){return null==e?e:vr(e,ao(t,3),Os)},Ln.forOwn=function(e,t){return e&&_r(e,ao(t,3))},Ln.forOwnRight=function(e,t){return e&&Tr(e,ao(t,3))},Ln.get=ks,Ln.gt=Ba,Ln.gte=Ua,Ln.has=function(e,t){return null!=e&&ho(e,t,Sr)},Ln.hasIn=As,Ln.head=qo,Ln.identity=ic,Ln.includes=function(e,t,n,r){e=qa(e)?e:Vs(e),n=n&&!r?gs(n):0;var i=e.length;return n<0&&(n=mn(i+n,0)),cs(e)?n<=i&&e.indexOf(t,n)>-1:!!i&&Ot(e,t,n)>-1},Ln.indexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var i=null==n?0:gs(n);return i<0&&(i=mn(r+i,0)),Ot(e,t,i)},Ln.inRange=function(e,t,n){return t=hs(t),n===i?(n=t,t=0):n=hs(n),function(e,t,n){return e>=vn(t,n)&&e=-9007199254740991&&e<=f},Ln.isSet=ss,Ln.isString=cs,Ln.isSymbol=us,Ln.isTypedArray=ls,Ln.isUndefined=function(e){return e===i},Ln.isWeakMap=function(e){return ns(e)&&po(e)==x},Ln.isWeakSet=function(e){return ns(e)&&"[object WeakSet]"==Cr(e)},Ln.join=function(e,t){return null==e?"":gn.call(e,t)},Ln.kebabCase=Gs,Ln.last=Jo,Ln.lastIndexOf=function(e,t,n){var r=null==e?0:e.length;if(!r)return-1;var o=r;return n!==i&&(o=(o=gs(n))<0?mn(r+o,0):vn(o,r-1)),t==t?function(e,t,n){for(var r=n+1;r--;)if(e[r]===t)return r;return r}(e,t,o):Nt(e,zt,o,!0)},Ln.lowerCase=Qs,Ln.lowerFirst=qs,Ln.lt=fs,Ln.lte=ps,Ln.max=function(e){return e&&e.length?hr(e,ic,Pr):i},Ln.maxBy=function(e,t){return e&&e.length?hr(e,ao(t,2),Pr):i},Ln.mean=function(e){return Dt(e,ic)},Ln.meanBy=function(e,t){return Dt(e,ao(t,2))},Ln.min=function(e){return e&&e.length?hr(e,ic,Dr):i},Ln.minBy=function(e,t){return e&&e.length?hr(e,ao(t,2),Dr):i},Ln.stubArray=yc,Ln.stubFalse=mc,Ln.stubObject=function(){return{}},Ln.stubString=function(){return""},Ln.stubTrue=function(){return!0},Ln.multiply=Ec,Ln.nth=function(e,t){return e&&e.length?Vr(e,gs(t)):i},Ln.noConflict=function(){return ot._===this&&(ot._=We),this},Ln.noop=uc,Ln.now=ka,Ln.pad=function(e,t,n){e=_s(e);var r=(t=gs(t))?on(e):0;if(!t||r>=t)return e;var i=(t-r)/2;return Bi(fn(i),n)+e+Bi(ln(i),n)},Ln.padEnd=function(e,t,n){e=_s(e);var r=(t=gs(t))?on(e):0;return t&&rt){var r=e;e=t,t=r}if(n||e%1||t%1){var o=wn();return vn(e+o*(t-e+tt("1e-"+((o+"").length-1))),t)}return Qr(e,t)},Ln.reduce=function(e,t,n){var r=Ga(e)?kt:Lt,i=arguments.length<3;return r(e,ao(t,4),n,i,fr)},Ln.reduceRight=function(e,t,n){var r=Ga(e)?At:Lt,i=arguments.length<3;return r(e,ao(t,4),n,i,pr)},Ln.repeat=function(e,t,n){return t=(n?vo(e,t,n):t===i)?1:gs(t),qr(_s(e),t)},Ln.replace=function(){var e=arguments,t=_s(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ln.result=function(e,t,n){var r=-1,o=(t=mi(t,e)).length;for(o||(o=1,e=i);++rf)return[];var n=d,r=vn(e,d);t=ao(t),e-=d;for(var i=Vt(r,t);++n=a)return e;var c=n-on(r);if(c<1)return r;var u=s?_i(s,0,c).join(""):e.slice(0,c);if(o===i)return u+r;if(s&&(c+=u.length-c),as(o)){if(e.slice(c).search(o)){var l,f=u;for(o.global||(o=Pe(o.source,_s(pe.exec(o))+"g")),o.lastIndex=0;l=o.exec(f);)var p=l.index;u=u.slice(0,p===i?c:p)}}else if(e.indexOf(si(o),c)!=c){var d=u.lastIndexOf(o);d>-1&&(u=u.slice(0,d))}return u+r},Ln.unescape=function(e){return(e=_s(e))&&q.test(e)?e.replace(G,cn):e},Ln.uniqueId=function(e){var t=++Re;return _s(e)+t},Ln.upperCase=Ks,Ln.upperFirst=Js,Ln.each=_a,Ln.eachRight=Ta,Ln.first=qo,cc(Ln,(vc={},_r(Ln,(function(e,t){Oe.call(Ln.prototype,t)||(vc[t]=e)})),vc),{chain:!1}),Ln.VERSION="4.17.21",_t(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ln[e].placeholder=Ln})),_t(["drop","take"],(function(e,t){Un.prototype[e]=function(n){n=n===i?1:mn(gs(n),0);var r=this.__filtered__&&!t?new Un(this):this.clone();return r.__filtered__?r.__takeCount__=vn(n,r.__takeCount__):r.__views__.push({size:vn(n,d),type:e+(r.__dir__<0?"Right":"")}),r},Un.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),_t(["filter","map","takeWhile"],(function(e,t){var n=t+1,r=1==n||3==n;Un.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:ao(e,3),type:n}),t.__filtered__=t.__filtered__||r,t}})),_t(["head","last"],(function(e,t){var n="take"+(t?"Right":"");Un.prototype[e]=function(){return this[n](1).value()[0]}})),_t(["initial","tail"],(function(e,t){var n="drop"+(t?"":"Right");Un.prototype[e]=function(){return this.__filtered__?new Un(this):this[n](1)}})),Un.prototype.compact=function(){return this.filter(ic)},Un.prototype.find=function(e){return this.filter(e).head()},Un.prototype.findLast=function(e){return this.reverse().find(e)},Un.prototype.invokeMap=Hr((function(e,t){return"function"==typeof e?new Un(this):this.map((function(n){return Mr(n,e,t)}))})),Un.prototype.reject=function(e){return this.filter(Da(ao(e)))},Un.prototype.slice=function(e,t){e=gs(e);var n=this;return n.__filtered__&&(e>0||t<0)?new Un(n):(e<0?n=n.takeRight(-e):e&&(n=n.drop(e)),t!==i&&(n=(t=gs(t))<0?n.dropRight(-t):n.take(t-e)),n)},Un.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},Un.prototype.toArray=function(){return this.take(d)},_r(Un.prototype,(function(e,t){var n=/^(?:filter|find|map|reject)|While$/.test(t),r=/^(?:head|last)$/.test(t),o=Ln[r?"take"+("last"==t?"Right":""):t],a=r||/^find/.test(t);o&&(Ln.prototype[t]=function(){var t=this.__wrapped__,s=r?[1]:arguments,c=t instanceof Un,u=s[0],l=c||Ga(t),f=function(e){var t=o.apply(Ln,St([e],s));return r&&p?t[0]:t};l&&n&&"function"==typeof u&&1!=u.length&&(c=l=!1);var p=this.__chain__,d=!!this.__actions__.length,h=a&&!p,g=c&&!d;if(!a&&l){t=g?t:new Un(this);var y=e.apply(t,s);return y.__actions__.push({func:ha,args:[f],thisArg:i}),new Bn(y,p)}return h&&g?e.apply(this,s):(y=this.thru(f),h?r?y.value()[0]:y.value():y)})})),_t(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Ae[e],n=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",r=/^(?:pop|shift)$/.test(e);Ln.prototype[e]=function(){var e=arguments;if(r&&!this.__chain__){var i=this.value();return t.apply(Ga(i)?i:[],e)}return this[n]((function(n){return t.apply(Ga(n)?n:[],e)}))}})),_r(Un.prototype,(function(e,t){var n=Ln[t];if(n){var r=n.name+"";Oe.call(xn,r)||(xn[r]=[]),xn[r].push({name:t,func:n})}})),xn[Wi(i,2).name]=[{name:"wrapper",func:i}],Un.prototype.clone=function(){var e=new Un(this.__wrapped__);return e.__actions__=ki(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=ki(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=ki(this.__views__),e},Un.prototype.reverse=function(){if(this.__filtered__){var e=new Un(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},Un.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,n=Ga(e),r=t<0,i=n?e.length:0,o=function(e,t,n){for(var r=-1,i=n.length;++r=this.__values__.length;return{done:e,value:e?i:this.__values__[this.__index__++]}},Ln.prototype.plant=function(e){for(var t,n=this;n instanceof Vn;){var r=Fo(n);r.__index__=0,r.__values__=i,t?o.__wrapped__=r:t=r;var o=r;n=n.__wrapped__}return o.__wrapped__=e,t},Ln.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof Un){var t=e;return this.__actions__.length&&(t=new Un(this)),(t=t.reverse()).__actions__.push({func:ha,args:[ta],thisArg:i}),new Bn(t,this.__chain__)}return this.thru(ta)},Ln.prototype.toJSON=Ln.prototype.valueOf=Ln.prototype.value=function(){return pi(this.__wrapped__,this.__actions__)},Ln.prototype.first=Ln.prototype.head,at&&(Ln.prototype[at]=function(){return this}),Ln}();ot._=un,(r=function(){return un}.call(t,n,t,e))===i||(e.exports=r)}.call(this)},904:(e,t)=>{"use strict";var n;let r;Object.defineProperty(t,"__esModule",{value:!0}),t.setDomain=t.getDomain=t.Domain=void 0,function(e){e[e.FA=0]="FA",e[e.FORM=1]="FORM",e[e.ETS=2]="ETS"}(n||(n={})),t.Domain=n,t.setDomain=e=>{r=e},t.getDomain=()=>null!=r?r:n.FA},784:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.errorMap=void 0,t.errorMap=new Map([["fileError","Visual file is damaged"],["versionError","Version number of visual file does not match"],["modelError","Visual model in visual file is damaged"],["codegenError","Codegen visual file failed"]])},117:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNode=void 0,t.ASTNode=class{accept(e){return e.visit(this)}}},862:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Cache=void 0,t.Cache=class{constructor(e,t=0){this.value="",this.indent=t,this.flag=!0,this.INDENT=e}indentOn(){this.flag=!0}indentOff(){this.flag=!1}incIndent(){this.indent++}decIndent(){this.indent--}checkIndent(){return this.indent<0}getIndents(){if(this.flag){let e="";for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=void 0;const r=n(117);class i extends r.ASTNode{constructor(e,t,n,r,i){super(),this.defaultValue=new Map,this.mediaParams=new Map,this.mediaProperties=new Map,this.mediaKeyProperty=new Map,this.tagName=e,this.params=t,this.content=n,this.properties=r,this.forEachObj=i,this.ifBoolean=null}setMediaParams(e){this.mediaParams=e}setParams(e){this.params=e}setIfBoolean(e){this.ifBoolean=e}setTagName(e){this.tagName=e}setForEachObj(e){this.forEachObj=e}setMediaProperty(e,t){t.forEach(((t,n)=>{var r;this.mediaKeyProperty.has(n)||this.mediaKeyProperty.set(n,new Map),null===(r=this.mediaKeyProperty.get(n))||void 0===r||r.set(e,t)}))}setDefaultValue(e,t,n="undefined"){this.defaultValue.set(e,[n,t])}}t.Tag=i},623:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNodeGenerator=void 0;const r=n(519),i=n(862),o=n(51),a=n(294);class s{constructor(e){this.cache=e,this.etsImport=new i.Cache(" ",1),this.etsVariable=new i.Cache(" ",1),this.etsFunction=new i.Cache(" ",1),this.aboutToAppear=new i.Cache(" ",2),this.needMediaQuery=!0}visit(e){e instanceof r.Tag&&(this.needMediaQuery&&this.genMediaQuery(e),this.genTag(e))}static getMethodGen(e){return void 0===s.instance?s.instance=new s(e):s.instance.setCache(e),s.instance}setCache(e){this.cache=e,this.etsImport=new i.Cache(" ",1),this.etsVariable=new i.Cache(" ",1),this.etsFunction=new i.Cache(" ",1),this.aboutToAppear=new i.Cache(" ",2),this.needMediaQuery=!0}genParams(e){if("string"==typeof e)this.cache.concat(e);else if(e.size>0){this.cache.concat(o.TokenClass.LBRA,o.TokenClass.SPACE);let t=0;e.forEach(((n,r)=>{this.cache.concat(r,o.TokenClass.COLON,o.TokenClass.SPACE,n),t++,t{this.cache.concat(r,o.TokenClass.COLON,o.TokenClass.SPACE,n),t++,t{e.accept(this),this.cache.indentOff(),this.cache.concat(o.TokenClass.NEW_LINE),this.cache.indentOn()})),this.cache.decIndent(),this.cache.indentOn()),this.cache.indentOn(),this.cache.concat(o.TokenClass.RBRA)),(null!==e.properties||null!==e.mediaProperties)&&(null!==e.content&&0!==e.content.length||this.cache.incIndent(),this.getProperties(e).forEach(((e,t)=>{this.cache.concat(o.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.concat(o.TokenClass.PROPERTY_START,t,o.TokenClass.TAG_START),this.cache.indentOff(),"string"==typeof e?this.cache.concat(e,o.TokenClass.TAG_END):this.genObjectProperty(e)})),null!==e.content&&0!==e.content.length||this.cache.decIndent()),this.genEnd(e)}genStart(e){this.genIfStart(e),this.genForTagStart(e)}genEnd(e){this.genForTagEnd(e),this.genIfEnd(e)}genForTagStart(e){var t;if(void 0!==(null===(t=e.forEachObj)||void 0===t?void 0:t.for)){const t="item",n="idx";this.cache.concat("ForEach",o.TokenClass.TAG_START,e.forEachObj.for.toString(),o.TokenClass.COMMA,o.TokenClass.NEW_LINE),this.cache.concat(o.TokenClass.TAG_START,t,o.TokenClass.COLON," any",o.TokenClass.COMMA," ",n,o.TokenClass.COLON," number",o.TokenClass.TAG_END," => ",o.TokenClass.LBRA,o.TokenClass.NEW_LINE)}}genForTagEnd(e){null!==e.forEachObj&&(this.cache.concat(o.TokenClass.RBRA),void 0!==e.forEachObj.key&&null!==e.forEachObj.key&&(this.cache.concat(o.TokenClass.COMMA,o.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.concat(e.forEachObj.key.toString()),this.cache.indentOff()),this.cache.concat(o.TokenClass.TAG_END))}genIfStart(e){null!==e.ifBoolean&&(this.cache.concat("if",o.TokenClass.SPACE,o.TokenClass.TAG_START,e.ifBoolean.toString(),o.TokenClass.TAG_END,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),this.cache.incIndent())}genIfEnd(e){null!==e.ifBoolean&&(this.cache.indentOn(),this.cache.decIndent(),this.cache.concat(o.TokenClass.NEW_LINE),this.cache.concat(o.TokenClass.RBRA),this.cache.indentOff())}genMediaQuery(e){const t=new Map,n=new Map;if(this.collectMediaQueryMap(e,t),this.collectDefaultValueMap(e,n),0===t.size&&0===n.size)return;const r=(0,a.getUniqueName)("mediaQuery"),s=(0,a.getUniqueName)("initForMediaQuery"),c=(0,a.getUniqueName)("mediaQueryCb"),u=(0,a.getUniqueName)("saveMediaQueryResult"),l=(0,a.getUniqueName)("updateForMediaQuery"),f=new i.Cache(o.TokenClass.INDENT,1),p=new i.Cache(o.TokenClass.INDENT,1),d=new i.Cache(o.TokenClass.INDENT,1),h=new i.Cache(o.TokenClass.INDENT,1),g=new i.Cache(o.TokenClass.INDENT,1),y=new i.Cache(o.TokenClass.INDENT,1),m=new i.Cache(o.TokenClass.INDENT,1),v=new i.Cache(o.TokenClass.INDENT,2);this.genVariableDeclare(n,f),this.genMediaQueryCb(c,p),this.genMediaQueryListener(t,d,h),this.genInitFuc(s,n,g),this.genMediaQueryCbFnc(u,l,t,y),this.genUpdateFnc(l,s,t,m),this.genAboutToAppear(c,u,t,v),this.etsImport.indentOff(),this.aboutToAppear.indentOff(),this.etsVariable.indentOff(),this.etsFunction.indentOff(),this.etsImport.indentOff(),this.etsImport.concat("import ",r," from '@ohos.mediaquery'"),this.aboutToAppear.concat(v.toString()),this.etsVariable.concat(f.toString(),p.toString(),d.toString(),h.toString()),this.etsFunction.concat(y.toString(),o.TokenClass.NEW_LINE,g.toString(),o.TokenClass.NEW_LINE,m.toString()),this.etsImport.indentOn(),this.aboutToAppear.indentOn(),this.etsVariable.indentOn(),this.etsFunction.indentOn(),this.needMediaQuery=!1}genVariableDeclare(e,t){e.forEach(((e,n)=>{t.concat(o.TokenClass.DECORATOR_STATE,o.TokenClass.SPACE,n.slice(5),o.TokenClass.COLON,o.TokenClass.SPACE,e[1],o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,o.TokenClass.UNDEFINED,o.TokenClass.NEW_LINE)}))}genMediaQueryCb(e,t){t.concat(e,o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,o.TokenClass.NULL,o.TokenClass.NEW_LINE)}genMediaQueryListener(e,t,n){const r=(0,a.getUniqueName)("mediaQuery");e.forEach(((e,i)=>{const s=(0,a.getUniqueName)(this.getMediaQueryVariableName(i));t.concat(s,o.TokenClass.COLON,o.TokenClass.SPACE,o.TokenClass.BOOLEAN,o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,o.TokenClass.FALSE,o.TokenClass.NEW_LINE),n.concat(`listener_${s}`,o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,r,o.TokenClass.PROPERTY_START,"matchMediaSync",o.TokenClass.TAG_START,`'${i}'`,o.TokenClass.TAG_END,o.TokenClass.NEW_LINE)}))}genInitFuc(e,t,n){n.concat(e,o.TokenClass.TAG_START,o.TokenClass.TAG_END,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),n.indentOn(),n.incIndent(),t.forEach(((e,t)=>{n.concat(t,o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,e[0],o.TokenClass.NEW_LINE)})),n.decIndent(),n.concat(o.TokenClass.RBRA,o.TokenClass.NEW_LINE)}genMediaQueryCbFnc(e,t,n,r){const i=Array.from(n.entries());r.concat(e,o.TokenClass.TAG_START,"mediaQueryResult",o.TokenClass.TAG_END,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),r.incIndent(),r.concat(o.TokenClass.SWITCH,o.TokenClass.SPACE,o.TokenClass.TAG_START,"mediaQueryResult.media",o.TokenClass.TAG_END,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),r.incIndent();for(let e=0;e{const n=(0,a.getUniqueName)(this.getMediaQueryVariableName(t));r.concat(o.TokenClass.IF,o.TokenClass.SPACE,o.TokenClass.TAG_START,o.TokenClass.THIS,o.TokenClass.PROPERTY_START,n,o.TokenClass.TAG_END,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),r.incIndent(),e.forEach(((e,t)=>{r.concat(t,o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,e,o.TokenClass.NEW_LINE)})),r.decIndent(),r.concat(o.TokenClass.RBRA,o.TokenClass.NEW_LINE)})),r.decIndent(),r.concat(o.TokenClass.RBRA,o.TokenClass.NEW_LINE)}genAboutToAppear(e,t,n,r){let i=1;r.concat(o.TokenClass.THIS,o.TokenClass.PROPERTY_START,e,o.TokenClass.SPACE,o.TokenClass.ASSIGN,o.TokenClass.SPACE,o.TokenClass.THIS,o.TokenClass.PROPERTY_START,`${t}.bind(this)`,o.TokenClass.NEW_LINE),n.forEach(((t,s)=>{const c=`listener_${(0,a.getUniqueName)(this.getMediaQueryVariableName(s))}`;r.indentOn(),r.concat(o.TokenClass.THIS,o.TokenClass.PROPERTY_START,c,o.TokenClass.PROPERTY_START,`on('change', this.${e})`),i0?e.mediaParams:e.params}getProperties(e){const t=new Map;return e.properties.forEach(((e,n)=>{t.set(n,e)})),e.mediaProperties.forEach(((e,n)=>{t.set(n,e)})),t}collectDefaultValueMap(e,t){void 0!==e.defaultValue&&e.defaultValue.forEach(((e,n)=>{t.set(n,e)})),null!==e.content&&0!==e.content.length&&e.content.forEach((e=>{this.collectDefaultValueMap(e,t)}))}collectMediaQueryMap(e,t){void 0!==e.mediaKeyProperty&&e.mediaKeyProperty.forEach(((e,n)=>{var r;const i=null!==(r=t.get(n))&&void 0!==r?r:new Map;e.forEach(((e,t)=>{i.set(t,e)})),t.set(n,i)})),null!==e.content&&0!==e.content.length&&e.content.forEach((e=>{this.collectMediaQueryMap(e,t)}))}getMediaQueryVariableName(e){const t="device-type: ",n="orientation: ",r=e.substring(e.indexOf(t),e.length),i=r.substring(t.length,r.indexOf(")")),o=e.substring(e.indexOf(n),e.length),a=o.substring(n.length,o.indexOf(")"));return`${i}${a.slice(0,1).toUpperCase()+a.slice(1).toLowerCase()}`}}t.ASTNodeGenerator=s,s.instance=void 0},413:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ETSBridge=void 0;const r=n(519),i=n(973),o=n(497);t.ETSBridge=class{constructor(){this.errors=0}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}visit(e){const t=new Map;let n=null;const a=new Map,s=new r.Tag(e.type,t,n,a,null);if((0,i.parseVisualModel)(e,s),(0,o.parseMediaVisualModel)(e,s),e.children.length>0){n=[];for(const t of e.children)n.push(t.accept(this))}return s.content=n,s}}},459:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.genETS=void 0;const r=n(623),i=n(862);t.genETS=function(e){const t=r.ASTNodeGenerator.getMethodGen(new i.Cache(" ",2));return e.accept(t),{build:t.cache.toString(),etsImport:t.etsImport.toString(),etsVariable:t.etsVariable.toString(),etsFunction:t.etsFunction.toString(),aboutToAppear:t.aboutToAppear.toString()}}},435:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringWriter=void 0;const r=n(459);t.StringWriter=class{genETS(e){return(0,r.genETS)(e)}}},51:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenClass=void 0,(n=t.TokenClass||(t.TokenClass={}))[n.IDENTIFIER=0]="IDENTIFIER",n[n.STRING_LITERAL=1]="STRING_LITERAL",n[n.NUMBER=2]="NUMBER",n[n.CHARACTER=3]="CHARACTER",n[n.EOF=4]="EOF",n[n.INVALID=5]="INVALID",n.EMPTY_DATA="empty",n.ASSIGN="=",n.INDENT=" ",n.NEW_LINE="\n",n.CARRIAGE_RETURN="\r",n.SPACE=" ",n.LQUOTE="'",n.RQUOTE="'",n.TAG_START="(",n.TAG_END=")",n.EMPTY_TAG_END="/>",n.END_TAG_START="{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMediaProperty=t.parseMediaVisualModel=void 0;const r=n(294),i=n(973),o=(0,i.curry)(((e,t)=>t.hasMediaProperty(e))),a=(0,i.curry)(((e,t,n)=>n.type===e&&n.hasMediaProperty(t)));function s(e,t,n){const r=t.get(n);return void 0!==r&&r.has(e)}function c(e){return`'${e}'`}function u(e){return isNaN(Number(e))?(0,i.getEtsEnumValue)("FontWeight.",e):e}function l(e){let t=(0,i.getEtsEnumValue)("FlexAlign.",e);return"flex-start"===e?t="FlexAlign.Start":"flex-end"===e&&(t="FlexAlign.End"),t}function f(e){return"TextOverflow."+(0,i.firstUpperCase)(e)}function p(e,t,n){var r,o;const a=new Map,s=null!==(r=e.mediaProperty)&&void 0!==r?r:new Map,c=null!==(o=e.dynamicMediaProperty)&&void 0!==o?o:new Map;return s.forEach(((e,r)=>{let o=e.get(t);const s=e.get(n);(0,i.isEmptyOrUndefined)(o)&&(0,i.isEmptyOrUndefined)(s)||(o="0"===o||(0,i.isEmptyOrUndefined)(o)?"0":o.substring(0,o.length-2),a.set(r,o))})),c.forEach(((e,n)=>{const r=e.get(t);(0,i.isEmptyOrUndefined)(r)||a.set(n,r)})),a}function d(e,t){const n=e.get("left"),r=e.get("top"),o=t.get("left"),a=t.get("top");let s="undefined",c="undefined";return(0,i.isEmptyOrUndefined)(n)&&(0,i.isEmptyOrUndefined)(r)||(s=`'${null!=n?n:0}'`,c=`'${null!=r?r:0}'`),(0,i.isEmptyOrUndefined)(o)&&(0,i.isEmptyOrUndefined)(a)||(s=null!=o?o:s,c=null!=a?a:c),{leftValue:s,topValue:c}}function h(e,t){e.forEach(((e,n)=>{"undefined"!==e&&t.set(n,"undefined")}))}function g(e,t){var n,r;const i=new Map,o=t.split("-")[0];return(null!==(n=e.mediaProperty)&&void 0!==n?n:new Map).forEach(((n,r)=>{var a,s,u,l;const f=n.get(o),p=null===(s=null===(a=e.dynamicMediaProperty)||void 0===a?void 0:a.get(r))||void 0===s?void 0:s.get(o),d=null!==(l=null!==(u=n.get(t))&&void 0!==u?u:p)&&void 0!==l?l:f;void 0!==d&&i.set(r,c(d))})),(null!==(r=e.dynamicMediaProperty)&&void 0!==r?r:new Map).forEach(((e,n)=>{var r;const a=e.get(o),s=null!==(r=e.get(t))&&void 0!==r?r:a;void 0!==s&&i.set(n,s)})),i}function y(e,t,n){var r,o;const a=new Map;return(null!==(r=e.mediaProperty)&&void 0!==r?r:new Map).forEach(((e,r)=>{let o=e.get(t);(0,i.isEmptyOrUndefined)(o)||("function"==typeof n&&(o=n(o)),(0,i.isEmptyOrUndefined)(o)||a.set(r,o))})),(null!==(o=e.dynamicMediaProperty)&&void 0!==o?o:new Map).forEach(((e,n)=>{let r=e.get(t);void 0===r||"content"!==t&&"label"!==t||(r=""===r?"''":(0,i.getContentName)(r)),(0,i.isEmptyOrUndefined)(r)||a.set(n,r)})),a}function m(e,t){const n=`this.${(0,i.getEtsPropName)(e)}${(0,i.firstUpperCase)((0,i.getEtsPropName)(t))}`;return`${n}_${(0,r.getUniqueId)(n)}`}function v(e,t,n){const r=e.property.get(t),o=e.dynamicProperty.get(t);let a="undefined";return(0,i.isEmptyOrUndefined)(r)||(a="function"==typeof n?n(r):r,a=(0,i.isEmptyOrUndefined)(a)?"undefined":a),(0,i.isEmptyOrUndefined)(o)||(a=o),a}const _=(0,i.curry)(((e,t,n)=>{const r=y(t,e,c);if(0===r.size)return;const o=v(t,e,c),a=m(t.id,e);n.setDefaultValue(a,"string",o),n.setMediaProperty(a,r),n.mediaProperties.set((0,i.getEtsPropName)(e),a)})),T=(0,i.curry)(((e,t,n)=>{const r=y(t,e);if(0===r.size)return;const o=v(t,e),a=m(t.id,e);n.setDefaultValue(a,"number",o),n.setMediaProperty(a,r),n.mediaProperties.set((0,i.getEtsPropName)(e),a)})),w=(0,i.curry)(((e,t,n)=>{const r=y(t,e);if(0===r.size)return;const o=v(t,e),a=m(t.id,e);n.setDefaultValue(a,"boolean",o),n.setMediaProperty(a,r),n.mediaProperties.set((0,i.getEtsPropName)(e),a)})),b=(0,i.curry)(((e,t,n,r)=>{const o=y(n,e,(0,i.curry)(i.getEtsEnumValue)(t));if(0===o.size)return;const a=v(n,e,(0,i.curry)(i.getEtsEnumValue)(t)),s=m(n.id,e);r.setDefaultValue(s,t.replace(".",""),a),r.setMediaProperty(s,o),r.mediaProperties.set((0,i.getEtsPropName)(e),s)})),E=(0,i.curry)(((e,t,n)=>{const r=y(t,e,c);if(!(n.mediaParams instanceof Map)||0===r.size)return;const o=v(t,e,c),a=m(t.id,e);n.setDefaultValue(a,"string",o),n.setMediaProperty(a,r),n.mediaParams.set((0,i.getEtsPropName)(e),a)})),C=(0,i.curry)(((e,t,n)=>{const r=y(t,e);if(!(n.mediaParams instanceof Map)||0===r.size)return;const o=v(t,e),a=m(t.id,e);n.setDefaultValue(a,"number",o),n.setMediaProperty(a,r),n.mediaParams.set((0,i.getEtsPropName)(e),a)})),P=(0,i.curry)(((e,t,n,r)=>{const o=y(n,e,(0,i.curry)(i.getEtsEnumValue)(t));if(!(r.mediaParams instanceof Map)||0===o.size)return;const a=v(n,e,(0,i.curry)(i.getEtsEnumValue)(t)),s=m(n.id,e);r.setDefaultValue(s,t.replace(".",""),a),r.setMediaProperty(s,o),r.mediaParams.set((0,i.getEtsPropName)(e),s)})),S=(0,i.curry)(((e,t,n)=>{const r=y(t,e,i.dealWithColor);if(0===r.size)return;const o=v(t,e,i.dealWithColor),a=m(t.id,e);n.setDefaultValue(a,"Color | string",o),n.setMediaProperty(a,r),n.mediaProperties.set((0,i.getEtsPropName)(e),a)}));function k(e,t,n,r=!1){(0,i.isEmptyOrUndefined)(t)||n.set(e,r?t:`'${t}'`)}t.parseMediaVisualModel=function(e,t){!function(e,t){var n;const r=null!==(n=e.dynamicProperty.get("for"))&&void 0!==n?n:"[1]",i=y(e,"for");if(0===i.size)return;const o=m(e.id,"for"),a={for:o,key:e.dynamicProperty.get("keyGenerator")};t.setDefaultValue(o,"any[]",r),t.setMediaProperty(o,i),t.setForEachObj(a)}(e,t),function(e,t){const n=y(e,"if");if(0===n.size)return;const r=v(e,"if"),i=m(e.id,"if");t.setDefaultValue(i,"boolean",r),t.setMediaProperty(i,n),t.setIfBoolean(i)}(e,t);for(const n of N)("boolean"==typeof n[0]||n[0](e))&&n[1](e,t)};const A=(0,i.curry)(((e,t,n)=>{const r=new Map,o=t.property.get(e),a=t.dynamicProperty.get(e),s=null!=a?a:o,u=["top","bottom","left","right"];let l=0;for(const o of u){const a=`${e}-${o}`,u=t.property.get(a),f=t.dynamicProperty.get(a),p=g(t,a);let d=(0,i.isEmptyOrUndefined)(s)?"undefined":c(s);if((0,i.isEmptyOrUndefined)(u)||(d=c(u)),(0,i.isEmptyOrUndefined)(f)||(d=f),p.size>0){const e=m(t.id,a);n.setDefaultValue(e,"string",d),n.setMediaProperty(e,p),k(o,e,r,!0),l++}else k(o,d,r,!0)}l>0&&n.mediaProperties.set(e,r)})),M=(0,i.curry)(((e,t,n,r)=>{const o=y(n,e,l);if(!(r.mediaParams instanceof Map)||0===o.size)return;const a=v(n,e,l),s=m(n.id,e);r.setDefaultValue(s,t.replace(".",""),a),r.setMediaProperty(s,o),r.mediaParams.set((0,i.getEtsPropName)(e),s)})),x=(0,i.curry)(((e,t)=>t.type===e));t.isMediaProperty=function(e,t){return!s(e,I,"common")&&!s(e,I,t)&&!s(e,I,"events")};const I=new Map([["common",new Set(["keyGenerator"])],["events",new Set([...i.events])]]),N=[...[[o("width"),_("width")],[o("height"),_("height")],[function(e){return e.hasMediaProperty("constraint-size-min-width")||e.hasMediaProperty("constraint-size-max-width")||e.hasMediaProperty("constraint-size-min-height")||e.hasMediaProperty("constraint-size-min-height")},function(e,t){const n=new Map,r=["min-width","max-width","min-height","max-height"];for(const o of r){const r=`constraint-size-${o}`,a=y(e,r,c),s=v(e,r,c);if(a.size>0){const c=m(e.id,r);t.setDefaultValue(c,"string",s),t.setMediaProperty(c,a),k((0,i.getEtsPropName)(o),c,n,!0)}}n.size>0&&t.mediaProperties.set("constraintSize",n)}],[o("align"),b("align","Alignment.")],[o("direction"),b("direction","Direction.")],[function(e){return e.hasMediaProperty("left")||e.hasMediaProperty("top")},function(e,t){var n;const r=null!==(n=e.property.get("position"))&&void 0!==n?n:"relative",{leftValue:i,topValue:o}=d(e.property,e.dynamicProperty),{mediaPositionLeft:a,mediaPositionTop:s,mediaOffsetLeft:c,mediaOffsetTop:u}=function(e){var t,n;const r=new Map,i=new Map,o=new Map,a=new Map,s=null!==(t=e.mediaProperty)&&void 0!==t?t:new Map,c=null!==(n=e.dynamicMediaProperty)&&void 0!==n?n:new Map,u=new Set;for(const[e]of s)u.add(e);for(const[e]of c)u.add(e);return u.forEach((t=>{var n,s,c,u;const l=null!==(s=null===(n=e.mediaProperty)||void 0===n?void 0:n.get(t))&&void 0!==s?s:new Map,f=null!==(u=null===(c=e.dynamicMediaProperty)||void 0===c?void 0:c.get(t))&&void 0!==u?u:new Map,p=l.get("position"),{leftValue:h,topValue:g}=d(l,f);"absolute"===p?("undefined"!==h&&r.set(t,h),"undefined"!==g&&i.set(t,g)):("undefined"!==h&&o.set(t,h),"undefined"!==g&&a.set(t,g))})),{mediaPositionLeft:r,mediaPositionTop:i,mediaOffsetLeft:o,mediaOffsetTop:a}}(e),l=a.size>0||s.size>0||"absolute"===r,f=c.size>0||u.size>0||"relative"===r,p=m(e.id,"positionLeft"),g=m(e.id,"positionTop"),y=m(e.id,"offsetLeft"),v=m(e.id,"offsetTop");if(0!==a.size||0!==s.size||0!==u.size||0!==c.size){if(l&&f&&(h(a,c),h(c,a),h(s,u),h(u,s)),l){const e="absolute"===r?i:"undefined",n="absolute"===r?o:"undefined";t.setDefaultValue(p,"string",e),t.setDefaultValue(g,"string",n),t.setMediaProperty(p,a),t.setMediaProperty(g,s),t.mediaProperties.set("position",new Map([["x",p],["y",g]]))}if(f){const e="relative"===r?i:"undefined",n="relative"===r?o:"undefined";t.setDefaultValue(y,"string",e),t.setDefaultValue(v,"string",n),t.setMediaProperty(y,c),t.setMediaProperty(v,u),t.mediaProperties.set("offset",new Map([["x",y],["y",v]]))}}}],[o("aspect-ratio"),T("aspect-ratio")],[o("display-priority"),T("display-priority")],[o("flex-basis"),_("flex-basis")],[o("flex-grow"),T("flex-grow")],[o("flex-shrink"),T("flex-shrink")],[o("align-self"),function(e,t){const n=y(e,"align-self",i.dealWithAlignSelf);if(0===n.size)return;const r=v(e,"align-self",i.dealWithAlignSelf),o=m(e.id,"align-self");t.setDefaultValue(o,"ItemAlign",r),t.setMediaProperty(o,n),t.mediaProperties.set("alignSelf",o)}],[o("border-style"),b("border-style","BorderStyle.")],[o("border-width"),_("border-width")],[o("border-color"),S("border-color")],[o("border-radius"),_("border-radius")],[o("background-color"),S("background-color")],[function(e){return e.hasMediaProperty("background-image-src")||e.hasMediaProperty("background-image-repeat")},function(e,t){const n=e.property.get("background-image-src"),r=e.property.get("background-image-repeat"),o=e.dynamicProperty.get("background-image-src"),a=e.dynamicProperty.get("background-image-repeat"),s=y(e,"background-image-src",i.dealWithSrc),c=y(e,"background-image-repeat",i.dealWithBackgroundRepeat);if(0===s.size&&0===c.size)return;let u=(0,i.dealWithSrc)(null!=n?n:"");if((0,i.isEmptyOrUndefined)(o)||(u=o),s.size>0){const n=m(e.id,"background-image-src");t.setDefaultValue(n,"string",u),t.setMediaProperty(n,s),u=n}let l="undefined";if(!(0,i.isEmptyOrUndefined)(r)){const e=(0,i.dealWithBackgroundRepeat)(r);null!=e&&""!==e&&(l=e)}if((0,i.isEmptyOrUndefined)(a)||(l=a),c.size>0){const n=m(e.id,"background-image-repeat");t.setDefaultValue(n,"string",l),t.setMediaProperty(n,c),l=n}t.mediaProperties.set("backgroundImage",u+", "+l)}],[o("background-image-size"),function(e,t){const n=y(e,"background-image-size",i.dealWithBackgroundImageSize);if(0===n.size)return;const r=v(e,"background-image-size",i.dealWithBackgroundImageSize),o=m(e.id,"background-image-size");t.setDefaultValue(o,"{ width?: string | number, height?: string | number } | ImageSize",r),t.setMediaProperty(o,n),t.mediaProperties.set("backgroundImageSize",o)}],[o("background-image-position"),function(e,t){const n=y(e,"background-image-position",i.dealWithBackgroundImagePosition);if(0===n.size)return;const r=v(e,"background-image-position",i.dealWithBackgroundImagePosition),o=m(e.id,"background-image-position");t.setDefaultValue(o,"{ x?: number | string, y?: number | string } | Alignment",r),t.setMediaProperty(o,n),t.mediaProperties.set("backgroundImagePosition",o)}],[o("opacity"),T("opacity")],[o("visibility"),b("visibility","Visibility.")],[o("enabled"),w("enabled")],[o("font-color"),S("font-color")],[o("font-size"),_("font-size")],[o("font-style"),b("font-style","FontStyle.")],[o("font-weight"),function(e,t){const n=y(e,"font-weight",i.dealWithFontWeight);if(0===n.size)return;const r=v(e,"font-weight",i.dealWithFontWeight),o=m(e.id,"font-weight");t.setDefaultValue(o,"FontWeight | string",r),t.setMediaProperty(o,n),t.mediaProperties.set("fontWeight",o)}],[o("font-family"),_("font-family")],[function(e){return e.hasMediaProperty("margin")||e.hasMediaProperty("margin-left")||e.hasMediaProperty("margin-top")||e.hasMediaProperty("margin-right")||e.hasMediaProperty("margin-bottom")},A("margin")],[function(e){return e.hasMediaProperty("padding")||e.hasMediaProperty("padding-left")||e.hasMediaProperty("padding-top")||e.hasMediaProperty("padding-right")||e.hasMediaProperty("padding-bottom")},A("padding")]],[a("button","label"),function(e,t){const n=e.property.get("label"),r=e.dynamicProperty.get("label"),o=y(e,"label",(e=>`\`${e}\``));if(0===o.size)return;let a="undefined";(0,i.isEmptyOrUndefined)(n)||(a=`\`${n}\``),(0,i.isEmptyOrUndefined)(r)||(a=(0,i.getContentName)(a));const s=m(e.id,"label");t.setDefaultValue(s,"string",a),t.setMediaProperty(s,o),t.setMediaParams(s)}],[a("button","type"),b("type","ButtonType.")],[a("button","state-effect"),w("state-effect")],[a("divider","vertical"),w("vertical")],[a("divider","color"),S("color")],[a("divider","stroke-width"),_("stroke-width")],[a("divider","line-cap"),b("line-cap","LineCapStyle.")],[x("image"),function(e,t){var n;const r=null!==(n=e.property.get("src"))&&void 0!==n?n:"",o=e.dynamicProperty.get("src"),a=y(e,"src",c);if(0===a.size)return;let s=(0,i.dealWithSrc)(r);(0,i.isEmptyOrUndefined)(o)||(s=o);const u=m(e.id,"src");t.setDefaultValue(u,"string",s),t.setMediaProperty(u,a),t.setMediaParams(u)}],[a("image","alt"),_("alt")],[a("image","object-fit"),b("object-fit","ImageFit.")],[a("image","object-repeat"),b("object-repeat","ImageRepeat.")],[a("image","interpolation"),b("interpolation","ImageInterpolation.")],[a("image","render-mode"),b("render-mode","ImageRenderMode.")],[function(e){return e.hasMediaProperty("source-size-width")||e.hasMediaProperty("source-size-height")},function(e,t){let n=e.property.get("source-size-width"),r=e.property.get("source-size-height");const o=e.dynamicProperty.get("source-size-width"),a=e.dynamicProperty.get("source-size-height"),s=p(e,"source-size-width","source-size-height"),c=p(e,"source-size-height","source-size-width");if(0===s.size)return;n="0"===n||(0,i.isEmptyOrUndefined)(n)?"0":n.substring(0,n.length-2),r="0"===r||(0,i.isEmptyOrUndefined)(r)?"0":r.substring(0,r.length-2),(0,i.isEmptyOrUndefined)(o)||(n=o),(0,i.isEmptyOrUndefined)(a)||(r=a);const u=m(e.id,"source-size-width"),l=m(e.id,"source-size-height");t.setDefaultValue(u,"number",n),t.setDefaultValue(l,"number",r),t.setMediaProperty(u,s),t.setMediaProperty(l,c);const f=new Map([["width",u],["height",l]]);t.mediaProperties.set("sourceSize",f)}],[function(e){return"progress"===e.type&&(e.hasMediaProperty("value")||e.hasMediaProperty("total")||e.hasMediaProperty("style"))},function(e,t){const n=e.property.get("value"),r=e.dynamicProperty.get("value"),o=y(e,"value");if(!(t.mediaParams instanceof Map)||0===o.size)return;let a=null!=n?n:"0";(0,i.isEmptyOrUndefined)(r)||(a=r);const s=m(e.id,"value");t.setDefaultValue(s,"number",a),t.setMediaProperty(s,o),t.mediaParams.set("value",s)}],[a("progress","total"),C("total")],[a("progress","style"),P("style","ProgressStyle.")],[a("progress","color"),S("color")],[a("slider","value"),C("value")],[a("slider","min"),C("min")],[a("slider","max"),C("max")],[a("slider","step"),C("step")],[a("slider","style"),P("style","SliderStyle.")],[a("slider","block-color"),S("block-color")],[a("slider","track-color"),S("track-color")],[a("slider","selected-color"),S("selected-color")],[a("slider","show-steps"),w("show-steps")],[a("slider","show-tips"),w("show-tips")],[a("text","content"),function(e,t){const n=e.property.get("content"),r=e.dynamicProperty.get("content"),o=y(e,"content",(e=>`\`${e}\``));if(0===o.size)return;let a="''";(0,i.isEmptyOrUndefined)(n)||(a=`\`${n}\``),(0,i.isEmptyOrUndefined)(r)||(a=(0,i.getContentName)(r));const s=m(e.id,"content");t.setDefaultValue(s,"string",a),t.setMediaProperty(s,o),t.setMediaParams(s)}],[a("text","text-align"),b("text-align","TextAlign.")],[a("text","text-overflow"),function(e,t){const n=y(e,"text-overflow",f);if(0===n.size)return;const r=v(e,"text-overflow",f),i=m(e.id,"text-overflow");t.setDefaultValue(i,"TextOverflow",r),t.setMediaProperty(i,n),t.mediaProperties.set("textOverflow",new Map([["overflow",i]]))}],[a("text","max-lines"),T("max-lines")],[a("text","line-height"),_("line-height")],[function(e){return"text"===e.type&&(e.hasMediaProperty("decoration-type")||e.hasMediaProperty("decoration-color"))},function(e,t){const n=y(e,"decoration-type",(0,i.curry)(i.getEtsEnumValue)("TextDecorationType.")),r=y(e,"decoration-color",i.dealWithColor);if(0===n.size&&0===r.size)return;let o=v(e,"decoration-type",(0,i.curry)(i.getEtsEnumValue)("TextDecorationType.")),a=v(e,"decoration-color",i.dealWithColor);if(n.size>0){const r=m(e.id,"decoration-type");t.setDefaultValue(r,"TextDecorationType",o),t.setMediaProperty(r,n),o=r}if(r.size>0){const n=m(e.id,"decoration-color");t.setDefaultValue(n,"Color | string",a),t.setMediaProperty(n,r),a=n}const s=new Map([["type",o]]);t.mediaProperties.set("decoration",s),"undefined"!==a&&s.set("color",a)}],[a("text","baseline-offset"),_("baseline-offset")],[a("text","text-case"),b("text-case","TextCase.")],[a("column","space"),E("space")],[a("column","align-items-column"),function(e,t){const n=y(e,"align-items-column",i.dealWithColumnAlignItems);if(0===n.size)return;const r=v(e,"align-items-column",i.dealWithColumnAlignItems),o=m(e.id,"align-items-column");t.setDefaultValue(o,"HorizontalAlign",r),t.setMediaProperty(o,n),t.mediaProperties.set("alignItems",o)}],[a("row","space"),E("space")],[a("row","align-items-row"),function(e,t){const n=y(e,"align-items-row",i.dealWithRowAlignItems);if(0===n.size)return;const r=v(e,"align-items-row",i.dealWithRowAlignItems),o=m(e.id,"align-items-row");t.setDefaultValue(o,"VerticalAlign",r),t.setMediaProperty(o,n),t.mediaProperties.set("alignItems",o)}],[a("flex","flex-direction"),function(e,t){const n=y(e,"flex-direction",(0,i.curry)(i.getEtsEnumValue)("FlexDirection."));if(!(t.mediaParams instanceof Map)||0===n.size)return;const r=v(e,"flex-direction",(0,i.curry)(i.getEtsEnumValue)("FlexDirection.")),o=m(e.id,"flex-direction");t.setDefaultValue(o,"FlexDirection",r),t.setMediaProperty(o,n),t.mediaParams.set("direction",o)}],[a("flex","wrap"),function(e,t){const n=y(e,"wrap",i.dealWithWrap);if(!(t.mediaParams instanceof Map)||0===n.size)return;const r=v(e,"wrap",i.dealWithWrap),o=m(e.id,"wrap");t.setDefaultValue(o,"FlexWrap",r),t.setMediaProperty(o,n),t.mediaParams.set("wrap",o)}],[a("flex","justify-content"),M("justify-content","FlexAlign.")],[a("flex","align-items-flex"),function(e,t){const n=y(e,"align-items-flex",i.dealWithFlexAlignItems);if(!(t.mediaParams instanceof Map)||0===n.size)return;const r=v(e,"align-items-flex",i.dealWithFlexAlignItems),o=m(e.id,"align-items-flex");t.setDefaultValue(o,"ItemAlign",r),t.setMediaProperty(o,n),t.mediaParams.set("alignItems",o)}],[a("flex","align-content"),M("align-content","FlexAlign.")],[a("list","space-list"),function(e,t){const n=y(e,"space-list");if(!(t.mediaParams instanceof Map)||0===n.size)return;const r=v(e,"space-list"),i=m(e.id,"space-list");t.setDefaultValue(i,"number",r),t.setMediaProperty(i,n),t.mediaParams.set("space",i)}],[a("list","initial-index"),C("initial-index")],[a("list","list-direction"),b("list-direction","Axis.")],[function(e){return"list"===e.type&&(e.hasMediaProperty("divider-stroke-width")||e.hasMediaProperty("divider-color")||e.hasMediaProperty("divider-start-margin")||e.hasMediaProperty("divider-end-margin"))},function(e,t){const n=[["divider-stroke-width",c],["divider-color",i.dealWithColor],["divider-start-margin",c],["divider-end-margin",c]];let r=0;const o=new Map;for(const[a,s]of n){const n=y(e,a,s),c=(0,i.getEtsPropName)(a.replace("divider-",""));let u=v(e,a,s);if("undefined"===u&&"divider-stroke-width"===a&&(u="0"),n.size>0){const i=m(e.id,a);t.setDefaultValue(i,"string",u),t.setMediaProperty(i,n),u=i,r++}o.set(c,u)}r>0&&t.mediaProperties.set("divider",o)}],[a("list","edit-mode"),w("edit-mode")],[a("list","edge-effect"),b("edge-effect","EdgeEffect.")],[a("list","chain-animation"),w("chain-animation")],[a("list-item","sticky"),b("sticky","Sticky.")],[a("list-item","editable"),w("editable")],[a("swiper","index"),T("index")],[a("swiper","auto-play"),w("auto-play")],[a("swiper","interval"),T("interval")],[a("swiper","indicator"),w("indicator")],[a("swiper","loop"),w("loop")],[a("swiper","duration"),T("duration")],[a("swiper","vertical"),w("vertical")],[a("swiper","item-space"),_("item-space")],[a("swiper","cached-count"),T("cached-count")],[a("swiper","disable-swipe"),w("disable-swipe")],[a("text-input","placeholder"),E("placeholder")],[a("text-input","textInput-type"),function(e,t){const n=y(e,"textInput-type",(0,i.curry)(i.getEtsEnumValue)("InputType."));if(0===n.size)return;const r=v(e,"textInput-type",(0,i.curry)(i.getEtsEnumValue)("InputType.")),o=m(e.id,"textInput-type");t.setDefaultValue(o,"InputType",r),t.setMediaProperty(o,n),t.mediaProperties.set("type",o)}],[a("text-input","placeholderColor"),S("placeholderColor")],[function(e){return"text-input"===e.type&&(e.hasMediaProperty("placeholderFont-size")||e.hasMediaProperty("placeholderFont-weight")||e.hasMediaProperty("placeholderFont-family")||e.hasMediaProperty("placeholderFont-style"))},function(e,t){const n=[["size","string | number",c],["weight","number | FontWeight",u],["family","string",c],["style","FontStyle",(0,i.curry)(i.getEtsEnumValue)("FontStyle.")]];let r=0;const o=new Map;for(const[i,a,s]of n){const n=`placeholderFont-${i}`,c=y(e,n,s);let u=v(e,n,s);if(c.size>0){const i=m(e.id,n);t.setDefaultValue(i,a,u),t.setMediaProperty(i,c),u=i,r++}o.set(i,u)}r>0&&t.mediaProperties.set("placeholderFont",o)}],[a("text-input","enterKeyType"),b("enterKeyType","EnterKeyType.")],[a("text-input","caretColor"),S("caretColor")],[a("text-input","maxLength"),T("maxLength")]]},973:(e,t)=>{"use strict";function n(e){return(...t)=>t.lengtht.property.has(e)||t.dynamicProperty.has(e))),i=n(((e,t,n)=>n.type===e&&(n.property.has(t)||n.dynamicProperty.has(t))));function o(e,t,n){const r=t.dynamicProperty.get(e);return void 0!==r&&""!==r.trim()&&(n.properties.set(m(e),r),!0)}const a=n(((e,t,n)=>{if(o(e,t,n))return;const r=t.property.get(e);void 0!==r&&n.properties.set(m(e),`'${r}'`)}));function s(e){return void 0===e||""===e}t.isEmptyOrUndefined=s;const c=n(((e,t,n)=>{if(o(e,t,n))return;const r=t.property.get(e);s(r)||n.properties.set(m(e),r)})),u=n(((e,t,n)=>{if(o(e,t,n))return;const r=t.property.get(e);s(r)||n.properties.set(m(e),r)})),l=n(((e,t,n,r)=>{if(o(e,n,r))return;const i=n.property.get(e);s(i)||r.properties.set(m(e),v(t,i))}));function f(e,t,n){const r=t.dynamicProperty.get(e);return void 0!==r&&""!==r.trim()&&n.params instanceof Map&&(n.params.set(m(e),r),!0)}const p=n(((e,t,n)=>{if(f(e,t,n))return;const r=t.property.get(e);void 0!==r&&n.params instanceof Map&&n.params.set(m(e),`'${r}'`)})),d=n(((e,t,n)=>{if(f(e,t,n))return;const r=t.property.get(e);!s(r)&&n.params instanceof Map&&n.params.set(m(e),r)})),h=n(((e,t,n,r)=>{if(f(e,n,r))return;const i=n.property.get(e);!s(i)&&r.params instanceof Map&&r.params.set(m(e),v(t,i))})),g=n(((e,t,n)=>{if(o(e,t,n))return;let r=t.property.get(e);s(r)||(r=_(r),n.properties.set(m(e),r))}));function y([e,...t]){return(null==e?void 0:e.toUpperCase())+t.join("")}function m(e){const t=e.split("-");let n=t[0];for(let e=1;ee[0].toUpperCase()+e.slice(1))).join(""));const r=void 0!==e.dynamicProperty.get("for")?{for:e.dynamicProperty.get("for"),key:e.dynamicProperty.get("keyGenerator")}:null;n.setForEachObj(r);const i=void 0!==e.dynamicProperty.get("if")?e.dynamicProperty.get("if"):e.property.get("if");void 0===i?n.setIfBoolean(null):n.setIfBoolean(i);for(const t of N)("boolean"==typeof t[0]||t[0](e))&&t[1](e,n);!function(e,n){for(let r of t.events){const t=e.property.get(r);"onDisappear"===r&&(r="onDisAppear"),void 0!==t&&""!==t&&n.properties.set(r,t)}}(e,n)},t.events=["onClick","onTouch","onAppear","onDisappear","onKeyEvent","onAreaChange","onItemDelete","onScrollIndex","onItemDragEnter","onItemDragMove","onItemDragLeave","onItemDragStart","onItemDrop","onComplete","onError","onFinish","onChange","onSubmit","onEditChanged"],t.firstUpperCase=y,t.getEtsPropName=m,t.getEtsEnumValue=v,t.dealWithColor=_;const w=n(((e,t,n,r)=>{if(!(r.params instanceof Map))return;const i=n.dynamicProperty.get(e);if(!s(i))return void r.params.set(m(e),i);const o=n.property.get(e);if(s(o))return;let a=v(t,o);"flex-start"===o?a=t+"Start":"flex-end"===o&&(a=t+"End"),r.params.set(m(e),a)})),b=n(((e,t)=>t.type===e));function E(e){return null===e.match(/\$(r|rawfile)\('(.*)'\)$/)?`'${e}'`:e}function C(e){let t=v("ItemAlign.",e);return"flex-start"===e?t="ItemAlign.Start":"flex-end"===e&&(t="ItemAlign.End"),t}function P(e){let t=v("ItemAlign.",e);return"flex-start"===e?t="ItemAlign.Start":"flex-end"===e&&(t="ItemAlign.End"),t}function S(e){let t=v("FlexWrap.",e);return"nowrap"===e&&(t="FlexWrap.NoWrap"),t}function k(e){let t=v("VerticalAlign.",e);return"flex-start"===e?t="VerticalAlign.Top":"flex-end"===e&&(t="VerticalAlign.Bottom"),t}function A(e){let t=v("HorizontalAlign.",e);return"flex-start"===e?t="HorizontalAlign.Start":"flex-end"===e&&(t="HorizontalAlign.End"),t}function M(e){return["lighter","normal","regular","medium","bold","bolder"].includes(e)?v("FontWeight.",e):e}function x(e){const t=new Map([["repeat-x","X"],["repeat-y","Y"],["repeat","XY"],["no-repeat","NoRepeat"]]).get(e);if(null!=t&&""!==t)return v("ImageRepeat.",t)}function I(e){return e.startsWith("$r(")?e:`\`\${${e}}\``}t.dealWithSrc=E,t.dealWithAlignSelf=C,t.dealWithFlexAlignItems=P,t.dealWithWrap=S,t.dealWithRowAlignItems=k,t.dealWithColumnAlignItems=A,t.dealWithFontWeight=M,t.dealWithBackgroundImagePosition=function(e){if(new Set(["TopStart","Top","TopEnd","Start","Center","End","BottomStart","Bottom","BottomEnd"]).has(e))return"Alignment."+e;const t=e.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%)) +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$/);return null!==t?`{ x: '${t[1]}', y: '${t[4]}' }`:void 0},t.dealWithBackgroundImageSize=function(e){if(new Set(["Cover","Contain","Auto"]).has(e))return v("ImageSize.",e);const t=e.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%))( *$| +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$)/);return null!==t?void 0!==t[5]?`{ width: '${t[1]}', height: '${t[5]}' }`:`{ width: '${t[1]}' }`:void 0},t.dealWithBackgroundRepeat=x,t.getContentName=I;const N=[[r("width"),a("width")],[r("height"),a("height")],[function(e){return e.hasProperty("constraint-size-min-width")||e.hasProperty("constraint-size-max-width")||e.hasProperty("constraint-size-min-height")||e.hasProperty("constraint-size-max-height")},function(e,t){const n=new Map,r=e.getProperty("constraint-size-min-width"),i=e.getProperty("constraint-size-max-width"),o=e.getProperty("constraint-size-min-height"),a=e.getProperty("constraint-size-max-height");T("minWidth",r,n,e.dynamicProperty.has("constraint-size-min-width")),T("maxWidth",i,n,e.dynamicProperty.has("constraint-size-max-width")),T("minHeight",o,n,e.dynamicProperty.has("constraint-size-min-height")),T("maxHeight",a,n,e.dynamicProperty.has("constraint-size-max-height")),n.size>0&&t.properties.set("constraintSize",n)}],[r("align"),l("align","Alignment.")],[r("direction"),l("direction","Direction.")],[function(e){return e.hasProperty("left")||e.hasProperty("top")},function(e,t){const n="absolute"===e.property.get("position")?"position":"offset",r=e.property.get("left"),i=e.property.get("top"),o=e.dynamicProperty.get("left"),a=e.dynamicProperty.get("top");if(s(o)&&s(a)&&s(r)&&s(i))return;const c=new Map([["x",`'${null!=r?r:"0"}'`],["y",`'${null!=i?i:"0"}'`]]);s(o)||c.set("x",o),s(a)||c.set("y",a),t.properties.set(n,c)}],[r("aspect-ratio"),c("aspect-ratio")],[r("display-priority"),c("display-priority")],[r("flex-basis"),a("flex-basis")],[r("flex-grow"),c("flex-grow")],[r("flex-shrink"),c("flex-shrink")],[r("align-self"),function(e,t){const n=e.dynamicProperty.get("align-self");if(!s(n))return void t.properties.set("alignSelf",n);const r=e.property.get("align-self");if(s(r))return;const i=C(r);t.properties.set("alignSelf",i)}],[r("border-style"),l("border-style","BorderStyle.")],[r("border-width"),a("border-width")],[r("border-color"),g("border-color")],[r("border-radius"),a("border-radius")],[r("background-color"),g("background-color")],[function(e){return e.hasProperty("background-image-src")||e.hasProperty("background-image-repeat")},function(e,t){const n=e.getProperty("background-image-src"),r=e.getProperty("background-image-repeat");if(s(n)&&s(r))return;let i=E(null!=n?n:"");if(!s(r)){const e=x(r);null!=e&&""!==e&&(i=i+", "+e)}t.properties.set("backgroundImage",i)}],[r("background-image-size"),function(e,t){const n=e.getProperty("background-image-size");if(s(n))return;if(new Set(["Cover","Contain","Auto"]).has(n))return void t.properties.set("backgroundImageSize",v("ImageSize.",n));const r=n.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%))( *$| +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$)/);null!==r&&(void 0!==r[5]?t.properties.set("backgroundImageSize",new Map([["width",`'${r[1]}'`],["height",`'${r[5]}'`]])):t.properties.set("backgroundImageSize",new Map([["width",`'${r[1]}'`]])))}],[r("background-image-position"),function(e,t){const n=e.getProperty("background-image-position");if(s(n))return;if(new Set(["TopStart","Top","TopEnd","Start","Center","End","BottomStart","Bottom","BottomEnd"]).has(n))return void t.properties.set("backgroundImagePosition","Alignment."+n);const r=n.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%)) +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$/);null!==r&&t.properties.set("backgroundImagePosition",new Map([["x",`'${r[1]}'`],["y",`'${r[4]}'`]]))}],[r("opacity"),c("opacity")],[r("visibility"),l("visibility","Visibility.")],[r("enabled"),u("enabled")],[r("font-color"),g("font-color")],[r("font-size"),a("font-size")],[r("font-style"),l("font-style","FontStyle.")],[r("font-weight"),function(e,t){const n=e.getProperty("font-weight");if(s(n))return;const r=M(n);t.properties.set("fontWeight",r)}],[r("font-family"),a("font-family")],[function(e){return e.hasProperty("margin")||e.hasProperty("margin-left")||e.hasProperty("margin-top")||e.hasProperty("margin-right")||e.hasProperty("margin-bottom")},function(e,t){var n,r,i,o;const a=new Map,s=e.getProperty("margin"),c=null!==(n=e.getProperty("margin-top"))&&void 0!==n?n:s,u=null!==(r=e.getProperty("margin-bottom"))&&void 0!==r?r:s,l=null!==(i=e.getProperty("margin-left"))&&void 0!==i?i:s,f=null!==(o=e.getProperty("margin-right"))&&void 0!==o?o:s,p=e.property.has("margin-top"),d=e.property.has("margin-bottom"),h=e.property.has("margin-left"),g=e.property.has("margin-right"),y=e.dynamicProperty.has("margin"),m=e.dynamicProperty.has("margin-top"),v=e.dynamicProperty.has("margin-bottom"),_=e.dynamicProperty.has("margin-left"),w=e.dynamicProperty.has("margin-right");T("top",c,a,m||!p&&y),T("bottom",u,a,v||!d&&y),T("left",l,a,_||!h&&y),T("right",f,a,w||!g&&y),a.size>0&&t.properties.set("margin",a)}],[function(e){return e.hasProperty("padding")||e.hasProperty("padding-left")||e.hasProperty("padding-top")||e.hasProperty("padding-right")||e.hasProperty("padding-bottom")},function(e,t){var n,r,i,o;const a=new Map,s=e.getProperty("padding"),c=null!==(n=e.getProperty("padding-top"))&&void 0!==n?n:s,u=null!==(r=e.getProperty("padding-bottom"))&&void 0!==r?r:s,l=null!==(i=e.getProperty("padding-left"))&&void 0!==i?i:s,f=null!==(o=e.getProperty("padding-right"))&&void 0!==o?o:s,p=e.property.has("padding-top"),d=e.property.has("padding-bottom"),h=e.property.has("padding-left"),g=e.property.has("padding-right"),y=e.dynamicProperty.has("padding"),m=e.dynamicProperty.has("padding-top"),v=e.dynamicProperty.has("padding-bottom"),_=e.dynamicProperty.has("padding-left"),w=e.dynamicProperty.has("padding-right");T("top",c,a,m||!p&&y),T("bottom",u,a,v||!d&&y),T("left",l,a,_||!h&&y),T("right",f,a,w||!g&&y),a.size>0&&t.properties.set("padding",a)}],[i("button","label"),function(e,t){const n=e.dynamicProperty.get("label");if(!s(n))return void t.setParams(I(n));const r=e.property.get("label");"string"==typeof r&&t.setParams(`\`${r}\``)}],[i("button","type"),l("type","ButtonType.")],[i("button","state-effect"),u("state-effect")],[i("divider","vertical"),u("vertical")],[i("divider","color"),g("color")],[i("divider","stroke-width"),a("stroke-width")],[i("divider","line-cap"),l("line-cap","LineCapStyle.")],[b("image"),function(e,t){var n;const r=e.dynamicProperty.get("src");if(!s(r))return void t.setParams(r);const i=null!==(n=e.property.get("src"))&&void 0!==n?n:"";t.setParams(E(i))}],[i("image","alt"),a("alt")],[i("image","object-fit"),l("object-fit","ImageFit.")],[i("image","object-repeat"),l("object-repeat","ImageRepeat.")],[i("image","interpolation"),l("interpolation","ImageInterpolation.")],[i("image","render-mode"),l("render-mode","ImageRenderMode.")],[function(e){return e.hasProperty("source-size-width")||e.hasProperty("source-size-height")},function(e,t){let n=e.getProperty("source-size-width"),r=e.getProperty("source-size-height");if(s(n)&&s(r))return;const i=e.dynamicProperty.has("source-size-width"),o=e.dynamicProperty.has("source-size-height");n="0"===n||s(n)?"0":i?n:n.substring(0,n.length-2),r="0"===r||s(r)?"0":o?r:r.substring(0,r.length-2);const a=new Map([["width",n],["height",r]]);t.properties.set("sourceSize",a)}],[function(e){return"progress"===e.type&&(e.hasProperty("value")||e.hasProperty("total")||e.hasProperty("style"))},function(e,t){var n;f("value",e,t)||t.params instanceof Map&&t.params.set("value",null!==(n=e.getProperty("value"))&&void 0!==n?n:"0")}],[i("progress","total"),d("total")],[i("progress","style"),h("style","ProgressStyle.")],[i("progress","color"),g("color")],[i("slider","value"),d("value")],[i("slider","min"),d("min")],[i("slider","max"),d("max")],[i("slider","step"),d("step")],[i("slider","style"),h("style","SliderStyle.")],[i("slider","block-color"),g("block-color")],[i("slider","track-color"),g("track-color")],[i("slider","selected-color"),g("selected-color")],[i("slider","show-steps"),u("show-steps")],[i("slider","show-tips"),u("show-tips")],[i("text","content"),function(e,t){const n=e.property.get("content"),r=e.dynamicProperty.get("content");s(r)?"string"==typeof n&&t.setParams(`\`${n}\``):t.setParams(I(r))}],[i("text","text-align"),l("text-align","TextAlign.")],[i("text","text-overflow"),function(e,t){const n=e.dynamicProperty.get("text-overflow");if(!s(n))return void t.properties.set("textOverflow",new Map([["overflow",n]]));const r=e.property.get("text-overflow");s(r)||t.properties.set("textOverflow",new Map([["overflow","TextOverflow."+y(r)]]))}],[i("text","max-lines"),c("max-lines")],[i("text","line-height"),a("line-height")],[function(e){return"text"===e.type&&(e.hasProperty("decoration-type")||e.hasProperty("decoration-color"))},function(e,t){const n=e.property.get("decoration-type"),r=e.dynamicProperty.get("decoration-type"),i=e.property.get("decoration-color"),o=e.dynamicProperty.get("decoration-color");if(s(n)&&s(i)&&s(r)&&s(o))return;const a=new Map;s(r)?a.set("type",s(n)?"TextDecorationType.None":v("TextDecorationType.",n)):a.set("type",r),t.properties.set("decoration",a),s(o)?s(i)||a.set("color",_(i)):a.set("color",o)}],[i("text","baseline-offset"),a("baseline-offset")],[i("text","text-case"),l("text-case","TextCase.")],[i("column","space"),p("space")],[i("column","align-items-column"),function(e,t){const n=e.dynamicProperty.get("align-items-column");if(!s(n))return void t.properties.set("alignItems",n);const r=e.property.get("align-items-column");if(s(r))return;const i=A(r);t.properties.set("alignItems",i)}],[i("row","space"),p("space")],[i("row","align-items-row"),function(e,t){const n=e.dynamicProperty.get("align-items-row");if(!s(n))return void t.properties.set("alignItems",n);const r=e.property.get("align-items-row");if(s(r))return;const i=k(r);t.properties.set("alignItems",i)}],[i("flex","flex-direction"),function(e,t){if(!(t.params instanceof Map))return;const n=e.dynamicProperty.get("flex-direction");if(!s(n))return void t.params.set("direction",n);const r=e.property.get("flex-direction");s(r)||t.params.set("direction",v("FlexDirection.",r))}],[i("flex","wrap"),function(e,t){if(!(t.params instanceof Map))return;const n=e.dynamicProperty.get("wrap");if(!s(n))return void t.params.set("wrap",n);const r=e.property.get("wrap");if(s(r))return;const i=S(r);t.params.set("wrap",i)}],[i("flex","justify-content"),w("justify-content","FlexAlign.")],[i("flex","align-items-flex"),function(e,t){if(!(t.params instanceof Map))return;const n=e.dynamicProperty.get("align-items-flex");if(!s(n))return void t.params.set("alignItems",n);const r=e.property.get("align-items-flex");if(s(r))return;const i=P(r);t.params.set("alignItems",i)}],[i("flex","align-content"),w("align-content","FlexAlign.")],[i("list","space-list"),function(e,t){const n=e.dynamicProperty.get("space-list");if(void 0!==n&&""!==n.trim()&&t.params instanceof Map)return void t.params.set("space",n);const r=e.getProperty("space-list");!s(r)&&t.params instanceof Map&&t.params.set("space",r)}],[i("list","initial-index"),d("initial-index")],[i("list","list-direction"),l("list-direction","Axis.")],[function(e){return"list"===e.type&&(e.hasProperty("divider-stroke-width")||e.hasProperty("divider-color")||e.hasProperty("divider-start-margin")||e.hasProperty("divider-end-margin"))},function(e,t){const n=e.property.get("divider-stroke-width"),r=e.dynamicProperty.get("divider-stroke-width"),i=new Map([["strokeWidth",`'${null!=n?n:"0"}'`]]);s(r)||i.set("strokeWidth",r);const o=e.property.get("divider-color"),a=e.dynamicProperty.get("divider-color"),c=e.property.get("divider-start-margin"),u=e.dynamicProperty.get("divider-start-margin"),l=e.property.get("divider-end-margin"),f=e.dynamicProperty.get("divider-end-margin");s(a)?s(o)||i.set("color",_(o)):i.set("color",a),s(u)?s(c)||i.set("startMargin",`'${c}'`):i.set("startMargin",u),s(f)?s(l)||i.set("endMargin",`'${l}'`):i.set("endMargin",f),t.properties.set("divider",i)}],[i("list","edit-mode"),u("edit-mode")],[i("list","edge-effect"),l("edge-effect","EdgeEffect.")],[i("list","chain-animation"),u("chain-animation")],[i("list-item","sticky"),l("sticky","Sticky.")],[i("list-item","editable"),u("editable")],[i("swiper","index"),c("index")],[i("swiper","auto-play"),u("auto-play")],[i("swiper","interval"),c("interval")],[i("swiper","indicator"),u("indicator")],[i("swiper","loop"),u("loop")],[i("swiper","duration"),c("duration")],[i("swiper","vertical"),u("vertical")],[i("swiper","item-space"),a("item-space")],[i("swiper","cached-count"),c("cached-count")],[i("swiper","disable-swipe"),u("disable-swipe")],[i("text-input","placeholder"),p("placeholder")],[i("text-input","textInput-type"),function(e,t){const n=e.dynamicProperty.get("textInput-type");if(!s(n))return void t.properties.set("type",n);const r=e.property.get("textInput-type");s(r)||t.properties.set("type","InputType."+r)}],[i("text-input","placeholderColor"),g("placeholderColor")],[function(e){return"text-input"===e.type&&(e.hasProperty("placeholderFont-size")||e.hasProperty("placeholderFont-weight")||e.hasProperty("placeholderFont-family")||e.hasProperty("placeholderFont-style"))},function(e,t){const n=e.property.get("placeholderFont-size"),r=e.dynamicProperty.get("placeholderFont-size"),i=e.property.get("placeholderFont-weight"),o=e.dynamicProperty.get("placeholderFont-weight"),a=e.property.get("placeholderFont-family"),c=e.dynamicProperty.get("placeholderFont-family"),u=e.property.get("placeholderFont-style"),l=e.dynamicProperty.get("placeholderFont-style"),f=new Map;s(r)?f.set("size",s(n)?30:parseInt(n)):f.set("size",r),s(o)?s(i)?f.set("weight",400):f.set("weight",isNaN(Number(i))?v("FontWeight.",i):i):f.set("weight",o),s(c)?f.set("family",s(a)?"'sans-serif'":`'${a}'`):f.set("family",c),s(l)?f.set("style",s(u)?"FontStyle.Normal":v("FontStyle.",u)):f.set("style",l),t.properties.set("placeholderFont",f)}],[i("text-input","enterKeyType"),l("enterKeyType","EnterKeyType.")],[i("text-input","caretColor"),g("caretColor")],[i("text-input","maxLength"),c("maxLength")]]},243:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Style=t.Tag=void 0;const r=n(117);class i extends r.ASTNode{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.content=n}}t.Tag=i;class o extends r.ASTNode{constructor(e,t,n,r){super(),this.mediaQuery=void 0,this.kind=e,this.name=t,this.content=n,this.mediaQuery=r}}t.Style=o},573:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNodeGenerator=void 0;const r=n(243),i=n(334);class o{constructor(e){this.cache=e}visit(e){e instanceof r.Tag?this.genTag(e):e instanceof r.Style&&this.genStyle(e)}static getMethodGen(e){return void 0===o.instance?o.instance=new o(e):o.instance.setCache(e),o.instance}setCache(e){this.cache=e}genTag(e){if(this.cache.concat(i.TokenClass.TAG_START,e.tagName),this.cache.indentOff(),e.attributes.forEach(((e,t)=>{let n="";for(const t of e)n+='"'===t?""":"\n"===t?" ":t;this.cache.concat(i.TokenClass.SPACE,t,i.TokenClass.ASSIGN,i.TokenClass.LQUOTE,n,i.TokenClass.RQUOTE)})),null===e.content)this.cache.concat(i.TokenClass.EMPTY_TAG_END);else{if(this.cache.concat(i.TokenClass.TAG_END),"string"==typeof e.content){let t="";for(const n of e.content)t+="<"===n?"<":n;this.cache.concat(t)}else 0!==e.content.length&&(this.cache.concat(i.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent(),e.content.forEach((e=>{e.accept(this),this.cache.indentOff(),this.cache.concat(i.TokenClass.NEW_LINE),this.cache.indentOn()})),this.cache.decIndent(),this.cache.indentOn());this.cache.concat(i.TokenClass.END_TAG_START,e.tagName,i.TokenClass.TAG_END)}}genStyle(e){void 0!==e.mediaQuery&&(this.cache.concat("@media"),this.cache.indentOff(),this.cache.concat(i.TokenClass.SPACE,e.mediaQuery,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent()),"IDStyle"===e.kind&&(this.cache.concat(i.TokenClass.ID_STYLE_START),this.cache.indentOff()),this.cache.concat(e.name,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent(),e.content.forEach(((e,t)=>{this.cache.concat(t,i.TokenClass.COLON,i.TokenClass.SPACE,e,i.TokenClass.SEMICOLON,i.TokenClass.NEW_LINE)})),this.cache.decIndent(),this.cache.concat(i.TokenClass.RBRA,i.TokenClass.NEW_LINE),void 0!==e.mediaQuery&&(this.cache.decIndent(),this.cache.concat(i.TokenClass.RBRA,i.TokenClass.NEW_LINE)),this.cache.concat(i.TokenClass.NEW_LINE)}}t.ASTNodeGenerator=o,o.instance=void 0},844:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CSSBridge=t.HMLBridge=void 0;const r=n(243),i=n(571);t.HMLBridge=class{constructor(){this.errors=0}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}visit(e){const t=new Map([["id",e.id]]);let n="";for(let[r,o]of e.property)(0,i.isAttribute)(r,e.type)?("string"!=typeof o&&(o=JSON.stringify(o)),t.set(r,o)):(0,i.isContent)(r)&&(n=o);if(e.children.length>0){n=[];for(const t of e.children)n.push(t.accept(this))}const o=new r.Tag(e.type,t,n);return"wrapper"===t.get("id")?new r.Tag("div",new Map,[o]):o}},t.CSSBridge=class{constructor(){this.errors=0,this.styles=[]}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}genIDStyle(e){var t;const n=t=>{const n=new Map;for(const[r,o]of t)(0,i.isStyle)(r,e.type)&&n.set(r,o);return n},o=n(e.property);o.size>0&&this.styles.push(new r.Style("IDStyle",e.id,o)),(null!==(t=e.mediaProperty)&&void 0!==t?t:new Map).forEach(((t,i)=>{const o=n(t);o.size>0&&this.styles.push(new r.Style("IDStyle",e.id,o,i))}));for(const t of e.children)t.accept(this)}visit(e){return this.genIDStyle(e),this.styles}}},55:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.genFACSS=t.genFAHML=void 0;const r=n(573),i=n(862);t.genFAHML=function(e){const t=r.ASTNodeGenerator.getMethodGen(new i.Cache(" "));return e.accept(t),t.cache.toString()},t.genFACSS=function(e){const t=r.ASTNodeGenerator.getMethodGen(new i.Cache(" "));return e.forEach((e=>{e.accept(t)})),t.cache.toString()}},571:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEvent=t.isData=t.isUnknown=t.isContent=t.isAttribute=t.isStyle=t.styleMap=void 0;const r=n(904),i=["width","height","min-width","min-height","max-width","max-height","padding","padding-start","padding-end","padding-top","padding-right","padding-bottom","padding-left","margin","margin-start","margin-end","margin-top","margin-right","margin-bottom","margin-left","border-width","border-style","border-color","border-radius","border-top-width","border-top-style","border-top-color","border-top-left-radius","border-right-width","border-right-style","border-right-color","border-top-right-radius","border-bottom-width","border-bottom-style","border-bottom-color","border-bottom-right-radius","border-left-width","border-left-style","border-left-color","border-bottom-left-radius","background-color","background","background-image","background-size","background-position","background-repeat","display","opacity","visibility","flex","flex-grow","flex-shrink","flex-basis","position","display","top","right","bottom","left","display-index","flex-weight","aspect-ratio"],o=["font-size","font-family","font-style","font-weight"],a=["text-align","line-height","text-decoration","letter-spacing","max-lines","text-overflow","allow-scale","min-font-size","max-font-size","font-size-step","prefer-font-sizes","color",...o],s=["allow-scale","text-decoration","color",...o],c=["text-color","allow-scale","icon-width","icon-height","radius",...o],u=["texton-color","textoff-color","text-padding","allow-scale",...o],l=["column-height","text-color","allow-scale","letter-spacing","text-decoration","line-height","opacity",...o],f=["text-color","allow-scale","letter-spacing",...o];t.styleMap=new Map([["common",new Set([...i])],["div",new Set(["flex-direction","overflow","flex-wrap","justify-content","align-items","align-content","grid-template-columns","grid-template-rows","grid-row-start","grid-row-end","grid-column-start","grid-column-end","grid-gap","grid-columns-gap","grid-rows-gap"])],["text",new Set([...a])],["image",new Set(["object-fit","match-text-direction","fit-original-size"])],["span",new Set([...s])],["input",new Set(["font-size","font-family","font-weight","color","placeholder-color","allow-scale"])],["button",new Set([...c])],["switch",new Set([...u])],["refresh",new Set(["progress-color"])],["divider",new Set(["stroke-width","line-cap","color"])],["chart",new Set(["stroke-width","radius","start-angle","total-angle","center-x","center-y","colors","weights"])],["picker",new Set([...l])],["picker-view",new Set(["color","font-size","selected-color","selected-font-size","focus-color","focus-font-size","disappear-color","disappear-font-size","font-family"])],["slider",new Set(["color","selected-color","block-color"])],["swiper",new Set(["indicator-color","indicator-selected-color","indicator-size","indicator-top","indicator-right","indicator-bottom","indicator-left"])],["list",new Set(["flex-direction","columns","item-extent","fade-color"])],["list-item",new Set(["column-span"])],["progress",new Set(["color","stroke-width","background-color","secondary-color","scale-width","scale-number","start-angle","total-angle","center-x","center-y","radius"])],["select",new Set(["font-family"])],["menu",new Set([...f])],["option",new Set(["color","font-family","allow-scale","font-size","font-weight","text-decoration"])],["video",new Set(["object-fit"])],["clock",new Set(["font-family"])]]);const p=new Map([["common",new Set(["id","ref","disabled","focusable","data","if","for"])],["image",new Set(["src","alt"])],["button",new Set(["type","value","icon","waiting"])],["refresh",new Set(["offset","refreshing","type","lasttime","friction"])],["input",new Set(["type","checked","name","value","placeholder","maxlength","enterkeytype","headericon"])],["switch",new Set(["checked","showtext","texton","textoff"])],["option",new Set(["value","selected","icon"])],["chart",new Set(["type","percent","datasets","options"])],["picker",new Set(["type","range","selected","start","end","lunar","lunarSwitch","columns","hours","containSecond","value","vibrate"])],["picker-view",new Set(["type","range","selected","start","end","lunar","lunarSwitch","columns","hours","containSecond","indicatorprefix","indicatorsuffix","vibrate"])],["slider",new Set(["min","max","step","showtips","showsteps","mode","value"])],["divider",new Set(["vertical"])],["list",new Set(["scrollpage","cachedcount","scrollbar","scrolleffect","shapemode","indexer","itemscale","itemcenter","updateeffect","scrollvibrate","initialindex","initialoffset"])],["list-item",new Set(["type","primary","section","sticky","stickyradius","clickeffect"])],["swiper",new Set(["index","autoplay","interval","indicator","digital","indicatordisabled","loop","duration","vertical"])],["progress",new Set(["type","percent","secondarypercent","clockwise"])],["menu",new Set(["target","title","type"])],["clock",new Set(["clockconfig","showdigit","hourswest"])],["badge",new Set(["placement","count","visible","maxcount","config","label"])],["video",new Set(["muted","src","autoplay","poster","controls","loop","starttime","direction","speed"])],["tabs",new Set(["index","vertical"])],["tab-bar",new Set(["mode"])],["tab-content",new Set(["scrollable"])]]),d=new Map([["common",new Set(["ontouchstart","ontouchmove","ontouchcancel","ontouchend","onclick","onlongpress","onfocus","onblur","onkey","onswipe"])],["image",new Set(["oncomplete","onerror"])],["input",new Set(["onchange","onenterkeyclick"])],["select",new Set(["onchange"])],["refresh",new Set(["onrefresh","onpulldown"])],["swiper",new Set(["onchange","onrotation"])],["list",new Set(["onindexerchange","onscroll","onscrollbottom","onscrolltop","onscrollend","onscrolltouchup","onrequestitem"])],["list-item",new Set(["onsticky"])],["menu",new Set(["onselected","oncancel"])],["picker",new Set(["oncolumnchange","onchange","oncancel"])],["picker-view",new Set(["oncolumnchange","onchange"])],["video",new Set(["onprepared","onstart","onpause","onfinish","onerror","onseeking","onseeked","ontimeupdate","onfullscreenchange","onstop"])],["tabs",new Set(["onchange"])],["switch",new Set(["onchange"])],["dialog",new Set(["oncancel"])]]),h=new Map([["common",new Set(["onClick","onTouch","onAppear","onDisappear","onKeyEvent","onAreaChange"])],["image",new Set(["onComplete","onError","onFinish"])],["swiper",new Set(["onChange"])],["list",new Set(["onItemDelete","onScrollIndex","onItemDragEnter","onItemDragMove","onItemDragLeave","onItemDragStart","onItemDrop"])],["text-input",new Set(["onChange","onSubmit","onEditChanged"])]]);function g(e,t,n){const r=t.get(n);return void 0!==r&&r.has(e)}function y(e,n){return g(e,t.styleMap,"common")||g(e,t.styleMap,n)}function m(e,t){return(0,r.getDomain)()===r.Domain.ETS?g(e,h,"common")||g(e,h,t):v(e,t)||_(e,t)}function v(e,t){return g(e,p,"common")||g(e,p,t)}function _(e,t){return g(e,d,"common")||g(e,d,t)}t.isStyle=y,t.isAttribute=m,t.isContent=function(e){return"content"===e},t.isUnknown=function(e,t){return!y(e,t)&&!m(e,t)},t.isData=v,t.isEvent=_},334:(e,t)=>{"use strict";var n;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenClass=void 0,(n=t.TokenClass||(t.TokenClass={}))[n.IDENTIFIER=0]="IDENTIFIER",n[n.STRING_LITERAL=1]="STRING_LITERAL",n[n.NUMBER=2]="NUMBER",n[n.CHARACTER=3]="CHARACTER",n[n.EOF=4]="EOF",n[n.INVALID=5]="INVALID",n.EMPTY_DATA="empty",n.ASSIGN="=",n.NEW_LINE="\n",n.CARRIAGE_RETURN="\r",n.INDENT=" ",n.SPACE=" ",n.LQUOTE='"',n.RQUOTE='"',n.TAG_START="<",n.TAG_END=">",n.EMPTY_TAG_END="/>",n.END_TAG_START="{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TagTypeMap=void 0,t.TagTypeMap=new Map([["button","TextContent"],["span","TextContent"],["divider","TextContent"],["picker","TextContent"],["option","TextContent"],["clock","TextContent"],["image","Base"],["input","Base"],["chart","Base"],["slider","Base"],["progress","Base"],["text","Text"],["div","Container"],["list","Container"],["list-item","Container"],["list-item-group","Container"],["refresh","Container"],["dialog","Container"],["stack","Container"],["menu","Container"],["select","Container"],["tabs","Container"],["tab-bar","Container"],["tab-content","Container"]])},294:(e,t)=>{"use strict";function n(e){const t=function(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");let n="";for(let t=0;t=4&&(n=n.substr(n.length/2-2,4)),n}Object.defineProperty(t,"__esModule",{value:!0}),t.getUniqueName=t.getUniqueId=t.removeFromArray=t.getDataName=void 0,t.getDataName=function(e){if("string"==typeof e&&e.startsWith("{{")&&e.endsWith("}}"))return e.substring(2,e.length-2)},t.removeFromArray=function(e,t){const n=[...e];return t.forEach((e=>{const t=n.indexOf(e);-1!==t&&n.splice(t,1)})),n},t.getUniqueId=n,t.getUniqueName=function(e){return`${e}_${n(e)}`}},207:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formManager=void 0;const r=n(891),i=n(945);t.formManager={removeData(e){this.getFormModel().data.delete(e)},addData(e){e instanceof Map?e.forEach(((e,t)=>{this.getFormModel().data.set(t,e)})):Object.keys(e).forEach((t=>{this.getFormModel().data.set(t,e[t])}))},updateAllData(e){this.getFormModel().data.clear(),this.addData(e)},addAction(e,t,n,r){const o=new Map;void 0!==n&&Object.keys(n).forEach((e=>{o.set(e,n[e])}));const a=new Map;void 0!==r&&Object.keys(r).forEach((e=>{a.set(e,r[e])})),this.getFormModel().actions.set(e,new i.FormAction(t,o,a))},updateAllActions(e){this.getFormModel().actions.clear(),e.forEach(((e,t)=>{const n=void 0===e.params?e.params:this.objectToMap(e.params),r=void 0===e.want?e.want:this.objectToMap(e.want),o=new i.FormAction(e.actionType,n,r);this.getFormModel().actions.set(t,o)}))},removeAction(e){this.getFormModel().actions.delete(e)},addActionParams(e,t){var n,r;const o=null!==(n=this.getFormModel().actions.get(e))&&void 0!==n?n:new i.FormAction(e),a=null!==(r=o.params)&&void 0!==r?r:new Map;Object.keys(t).forEach((e=>{a.set(e,t[e])})),o.params=a},removeActionParam(e,t){var n;const r=this.getFormModel().actions.get(e);null===(n=null==r?void 0:r.params)||void 0===n||n.delete(t)},getFormModel:()=>(0,r.getInstance)().formData,codegenToJson:function(){const e=(0,r.getInstance)().formData,t=this.mapToObject(e.data),n={actions:{},data:{}};return n.data=t,e.actions.forEach(((e,t)=>{n.actions[t]={},n.actions[t].action=e.action,e.params instanceof Map&&e.params.size>0&&(n.actions[t].params=this.mapToObject(e.params)),e.want instanceof Map&&e.want.size>0&&(n.actions[t].want=this.mapToObject(e.want))})),JSON.stringify(n,null,4)},clear(){(0,r.getInstance)().formData.data.clear(),(0,r.getInstance)().formData.actions.clear()},mapToObject:e=>void 0===e?{}:Array.from(e.entries()).reduce(((e,[t,n])=>Object.assign(Object.assign({},e),{[t]:n})),{}),objectToMap(e){const t=new Map;return Object.keys(e).forEach(((n,r)=>{t.set(n,e[n])})),t}}},945:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FormAction=t.FormModel=void 0,t.FormModel=class{constructor(){this.data=new Map,this.actions=new Map}},t.FormAction=class{constructor(e,t,n){this.action=e,this.params=t,this.want=n}}},509:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeForVersion1=t.rootToVisualContent=t.visualToRootContent=t.serializeForVersion1=void 0;const r=n(891),i=n(933),o=n(571),a=n(282),s=n(945),c=n(977),u=new Map;function l(e){u.set("textMap",new Map);const t=f(null!=e?e:(0,r.getInstance)().visualModel);return JSON.stringify({VisualVersion:"1",content:JSON.stringify(t),extraData:JSON.stringify(h(u))})}function f(e){const t=Array.from(e.property).filter((t=>(0,o.isAttribute)(t[0],e.type)));t.push(["id",e.id]);const n=Array.from(e.property).filter((t=>(0,o.isStyle)(t[0],e.type)));let r=a.TagTypeMap.get(e.type);void 0===r&&(r="Base");let i=e.property.has("content")?e.property.get("content"):[];if(e.children.length>0){if("string"==typeof i){const t=u.get("textMap");t instanceof Map&&t.set(e.id,i)}i=e.children.map((e=>f(e)))}return{id:e.id,tagName:e.type,attributes:t,idStyle:n,type:r,content:i}}function p(e,t){let n;if(t instanceof Map){const r=t.get("textMap");r instanceof Map&&(n=r.get(e.id))}const r=new i.VisualModel({id:e.id,type:e.tagName,property:new Map([...e.attributes,...e.idStyle])});return"string"==typeof n&&r.property.set("content",n),r.property.delete("id"),"string"==typeof e.content&&r.property.set("content",e.content),Array.isArray(e.content)&&(r.children=e.content.map((e=>p(e,t)))),r}function d(e){if(e instanceof Array&&e.length>0&&"$$map"===e[0]){e.shift();const t=new Map;for(const[n,r]of e)t.set(n,d(r));return t}return e}function h(e){if(e instanceof Map){const t=["$$map"];for(const[n,r]of e)t.push([n,h(r)]);return t}return e}t.serializeForVersion1=l,t.visualToRootContent=function(e){try{return l(JSON.parse(e,c.reviver).visualModel)}catch(e){console.error("convert visual model to root model failed")}return e},t.rootToVisualContent=function(e){const t=JSON.parse(e),n=JSON.parse(t.content);let r='["$$map",["textMap",["$$map"]]]';"string"==typeof t.extraData&&(r=JSON.parse(t.extraData));const i=p(n,d(r));return i.property.has("flex-direction")||i.property.set("flex-direction","column"),JSON.stringify({document:{VisualVersion:"12",type:"FA"},visualModel:i,formData:new s.FormModel},c.replacer)},t.deserializeForVersion1=function(e){try{const t=JSON.parse(e),n=JSON.parse(t.content);let i='["$$map",["textMap",["$$map"]]]';"string"==typeof t.extraData&&(i=JSON.parse(t.extraData)),(0,r.getInstance)().visualModel=p(n,d(i)),(0,r.getInstance)().visualModel.property.has("flex-direction")||(0,r.getInstance)().visualModel.property.set("flex-direction","column")}catch(e){console.error("convert error")}}},891:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setInstance=t.getInstance=void 0;const r=n(933),i=n(945),o=n(904),a={document:{VisualVersion:"12",type:"FA"},visualModel:new r.VisualModel({type:"div",id:"wrapper"}),formData:new i.FormModel};t.getInstance=function(){return a},t.setInstance=function(e){for(const t in a)Object.prototype.hasOwnProperty.call(e,t)&&(a[t]=e[t]);const t=a.document.type;(0,o.setDomain)("ETS"===t?o.Domain.ETS:"FORM"===t?o.Domain.FORM:o.Domain.FA)}},977:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reviver=t.replacer=t.deserialize=t.serialize=void 0;const r=n(933),i=n(891),o=n(509);function a(e,t){if(t instanceof Map)return{dataType:"Map",value:Object.fromEntries(t.entries())};if(t instanceof Set)return{dataType:"Set",value:Array.from(t.entries())};if(t instanceof r.VisualModel){const e=new r.VisualModel({type:"none"}),n={};for(const r in e)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=t[r]);return{dataType:"VisualModel",value:n}}return t}function s(e,t){if("object"==typeof t&&null!=t){if("Map"===t.dataType)return new Map(Object.entries(t.value));if("Set"===t.dataType)return new Set(t.value);if("VisualModel"===t.dataType){const e=new r.VisualModel({type:""});Object.assign(e,t.value),t=e}}return t}t.serialize=function(e,t){return 1===e?(0,o.serializeForVersion1)(t):JSON.stringify(null!=t?t:(0,i.getInstance)(),a,4)},t.deserialize=function(e){if("1"===JSON.parse(e).VisualVersion)return(0,o.deserializeForVersion1)(e);const t=JSON.parse(e,s);(0,i.setInstance)(t)},t.replacer=a,t.reviver=s},933:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VisualModel=void 0;const n="-visual";t.VisualModel=class{constructor(e){if(this.mediaProperty=void 0,this.dynamicMediaProperty=void 0,this.property=void 0!==e.property?e.property:new Map,this.dynamicProperty=void 0!==e.dynamicProperty?e.dynamicProperty:new Map,this.children=void 0!==e.children?e.children:[],"wrapper"===e.type)return this.id="wrapper",void(this.type="div");e.type.endsWith(n)&&(e.type=e.type.substring(0,e.type.length-n.length)),this.id=void 0!==e.id?e.id:"",this.type=e.type}getProperty(e){const t=this.dynamicProperty.get(e);return void 0!==t&&""!==t?t:this.property.get(e)}hasMediaProperty(e){if(void 0!==this.mediaProperty)for(const[,t]of this.mediaProperty)if(null==t?void 0:t.has(e))return!0;if(void 0!==this.dynamicMediaProperty)for(const[,t]of this.dynamicMediaProperty)if(null==t?void 0:t.has(e))return!0;return!1}hasProperty(e){return this.dynamicProperty.has(e)||this.property.has(e)}accept(e){return e.visit(this)}}}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var o=t[r]={id:r,loaded:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.loaded=!0,o.exports}n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var r={};(()=>{"use strict";var e=r;Object.defineProperty(e,"__esModule",{value:!0});const t=n(784),i=n(891),o=n(977),a=n(844),s=n(55),c=n(207),u=n(413),l=n(435),f=n(486),p={build:"",etsImport:"",etsVariable:"",etsFunction:"",aboutToAppear:""};function d(e,n){var r;try{(0,o.deserialize)(e);const t=(0,i.getInstance)().document.VisualVersion,r=/^([1-9]+[0-9]*)$/;if(void 0===t)n.errorType="versionError";else{const e=t.match(r);(null===e||parseInt(e[1])>12)&&(n.errorType="versionError")}}catch(e){n.errorType="fileError"}""!==n.errorType&&(n.errorMessage=null!==(r=t.errorMap.get(n.errorType))&&void 0!==r?r:"Codegen visual file failed")}e.genHmlAndCss=function(e){const n={hmlCss:{hml:"",css:"",json:""},errorType:"",errorMessage:""};if(d(e,n),""!==n.errorType)return n.hmlCss.hml="",n.hmlCss.css="",n;try{const e=function(e){const t={hml:"",css:"",json:""},n=new a.HMLBridge,r=e.accept(n),i=(0,s.genFAHML)(r);t.hml=n.getErrorCount()>0?"error":i;const o=new a.CSSBridge,c=e.accept(o),u=(0,s.genFACSS)(c);return t.css=o.getErrorCount()>0?"error":u,t}((0,i.getInstance)().visualModel);"error"!==e.hml&&"error"!==e.css||(n.errorType="codegenError"),n.hmlCss=e,"FORM"===(0,i.getInstance)().document.type&&(n.hmlCss.json=c.formManager.codegenToJson())}catch(e){n.errorType="modelError"}return""!==n.errorType&&(n.errorMessage=t.errorMap.get(n.errorType),n.hmlCss.hml="",n.hmlCss.css=""),n},e.genETS=function(e){var n;const r={ets:(0,f.cloneDeep)(p),errorType:"",errorMessage:""};if(d(e,r),""!==r.errorType)return r.ets=(0,f.cloneDeep)(p),r;try{const e=function(e){const t=new u.ETSBridge,n=e.accept(t),r=(new l.StringWriter).genETS(n);return t.getErrorCount()>0?"error":r}((0,i.getInstance)().visualModel);"error"===e&&(r.errorType="codegenError"),r.ets=e}catch(e){r.errorType="modelError"}return""!==r.errorType&&(r.errorMessage=null!==(n=t.errorMap.get(r.errorType))&&void 0!==n?n:"Codegen visual file failed",r.ets=(0,f.cloneDeep)(p)),r}})();var i=exports;for(var o in r)i[o]=r[o];r.__esModule&&Object.defineProperty(i,"__esModule",{value:!0})})(); \ No newline at end of file +(()=>{var e={486:function(e,t,r){var n;e=r.nmd(e),function(){var o,i="Expected a function",a="__lodash_hash_undefined__",s="__lodash_placeholder__",c=32,l=128,u=1/0,p=9007199254740991,f=NaN,d=4294967295,y=[["ary",l],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",c],["partialRight",64],["rearg",256]],h="[object Arguments]",m="[object Array]",g="[object Boolean]",E="[object Date]",v="[object Error]",T="[object Function]",S="[object GeneratorFunction]",_="[object Map]",N="[object Number]",A="[object Object]",C="[object Promise]",w="[object RegExp]",b="[object Set]",R="[object String]",I="[object Symbol]",O="[object WeakMap]",P="[object ArrayBuffer]",M="[object DataView]",x="[object Float32Array]",L="[object Float64Array]",k="[object Int8Array]",F="[object Int16Array]",D="[object Int32Array]",U="[object Uint8Array]",G="[object Uint8ClampedArray]",B="[object Uint16Array]",z="[object Uint32Array]",j=/\b__p \+= '';/g,V=/\b(__p \+=) '' \+/g,W=/(__e\(.*?\)|\b__t\)) \+\n'';/g,$=/&(?:amp|lt|gt|quot|#39);/g,H=/[&<>"']/g,Y=RegExp($.source),q=RegExp(H.source),Q=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,J=/<%=([\s\S]+?)%>/g,K=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,ee=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,te=/[\\^$.*+?()[\]{}|]/g,re=RegExp(te.source),ne=/^\s+/,oe=/\s/,ie=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,ae=/\{\n\/\* \[wrapped with (.+)\] \*/,se=/,? & /,ce=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,le=/[()=,{}\[\]\/\s]/,ue=/\\(\\)?/g,pe=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,fe=/\w*$/,de=/^[-+]0x[0-9a-f]+$/i,ye=/^0b[01]+$/i,he=/^\[object .+?Constructor\]$/,me=/^0o[0-7]+$/i,ge=/^(?:0|[1-9]\d*)$/,Ee=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,ve=/($^)/,Te=/['\n\r\u2028\u2029\\]/g,Se="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",_e="a-z\\xdf-\\xf6\\xf8-\\xff",Ne="A-Z\\xc0-\\xd6\\xd8-\\xde",Ae="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Ce="["+Ae+"]",we="["+Se+"]",be="\\d+",Re="["+_e+"]",Ie="[^\\ud800-\\udfff"+Ae+be+"\\u2700-\\u27bf"+_e+Ne+"]",Oe="\\ud83c[\\udffb-\\udfff]",Pe="[^\\ud800-\\udfff]",Me="(?:\\ud83c[\\udde6-\\uddff]){2}",xe="[\\ud800-\\udbff][\\udc00-\\udfff]",Le="["+Ne+"]",ke="(?:"+Re+"|"+Ie+")",Fe="(?:"+Le+"|"+Ie+")",De="(?:['’](?:d|ll|m|re|s|t|ve))?",Ue="(?:['’](?:D|LL|M|RE|S|T|VE))?",Ge="(?:"+we+"|"+Oe+")?",Be="[\\ufe0e\\ufe0f]?",ze=Be+Ge+"(?:\\u200d(?:"+[Pe,Me,xe].join("|")+")"+Be+Ge+")*",je="(?:"+["[\\u2700-\\u27bf]",Me,xe].join("|")+")"+ze,Ve="(?:"+[Pe+we+"?",we,Me,xe,"[\\ud800-\\udfff]"].join("|")+")",We=RegExp("['’]","g"),$e=RegExp(we,"g"),He=RegExp(Oe+"(?="+Oe+")|"+Ve+ze,"g"),Ye=RegExp([Le+"?"+Re+"+"+De+"(?="+[Ce,Le,"$"].join("|")+")",Fe+"+"+Ue+"(?="+[Ce,Le+ke,"$"].join("|")+")",Le+"?"+ke+"+"+De,Le+"+"+Ue,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",be,je].join("|"),"g"),qe=RegExp("[\\u200d\\ud800-\\udfff"+Se+"\\ufe0e\\ufe0f]"),Qe=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Xe=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Je=-1,Ke={};Ke[x]=Ke[L]=Ke[k]=Ke[F]=Ke[D]=Ke[U]=Ke[G]=Ke[B]=Ke[z]=!0,Ke[h]=Ke[m]=Ke[P]=Ke[g]=Ke[M]=Ke[E]=Ke[v]=Ke[T]=Ke[_]=Ke[N]=Ke[A]=Ke[w]=Ke[b]=Ke[R]=Ke[O]=!1;var Ze={};Ze[h]=Ze[m]=Ze[P]=Ze[M]=Ze[g]=Ze[E]=Ze[x]=Ze[L]=Ze[k]=Ze[F]=Ze[D]=Ze[_]=Ze[N]=Ze[A]=Ze[w]=Ze[b]=Ze[R]=Ze[I]=Ze[U]=Ze[G]=Ze[B]=Ze[z]=!0,Ze[v]=Ze[T]=Ze[O]=!1;var et={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},tt=parseFloat,rt=parseInt,nt="object"==typeof r.g&&r.g&&r.g.Object===Object&&r.g,ot="object"==typeof self&&self&&self.Object===Object&&self,it=nt||ot||Function("return this")(),at=t&&!t.nodeType&&t,st=at&&e&&!e.nodeType&&e,ct=st&&st.exports===at,lt=ct&&nt.process,ut=function(){try{return st&&st.require&&st.require("util").types||lt&<.binding&<.binding("util")}catch(e){}}(),pt=ut&&ut.isArrayBuffer,ft=ut&&ut.isDate,dt=ut&&ut.isMap,yt=ut&&ut.isRegExp,ht=ut&&ut.isSet,mt=ut&&ut.isTypedArray;function gt(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}function Et(e,t,r,n){for(var o=-1,i=null==e?0:e.length;++o-1}function At(e,t,r){for(var n=-1,o=null==e?0:e.length;++n-1;);return r}function Yt(e,t){for(var r=e.length;r--&&xt(t,e[r],0)>-1;);return r}function qt(e,t){for(var r=e.length,n=0;r--;)e[r]===t&&++n;return n}var Qt=Ut({À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"}),Xt=Ut({"&":"&","<":"<",">":">",'"':""","'":"'"});function Jt(e){return"\\"+et[e]}function Kt(e){return qe.test(e)}function Zt(e){var t=-1,r=Array(e.size);return e.forEach((function(e,n){r[++t]=[n,e]})),r}function er(e,t){return function(r){return e(t(r))}}function tr(e,t){for(var r=-1,n=e.length,o=0,i=[];++r",""":'"',"'":"'"}),cr=function e(t){var r,n=(t=null==t?it:cr.defaults(it.Object(),t,cr.pick(it,Xe))).Array,oe=t.Date,Se=t.Error,_e=t.Function,Ne=t.Math,Ae=t.Object,Ce=t.RegExp,we=t.String,be=t.TypeError,Re=n.prototype,Ie=_e.prototype,Oe=Ae.prototype,Pe=t["__core-js_shared__"],Me=Ie.toString,xe=Oe.hasOwnProperty,Le=0,ke=(r=/[^.]+$/.exec(Pe&&Pe.keys&&Pe.keys.IE_PROTO||""))?"Symbol(src)_1."+r:"",Fe=Oe.toString,De=Me.call(Ae),Ue=it._,Ge=Ce("^"+Me.call(xe).replace(te,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Be=ct?t.Buffer:o,ze=t.Symbol,je=t.Uint8Array,Ve=Be?Be.allocUnsafe:o,He=er(Ae.getPrototypeOf,Ae),qe=Ae.create,et=Oe.propertyIsEnumerable,nt=Re.splice,ot=ze?ze.isConcatSpreadable:o,at=ze?ze.iterator:o,st=ze?ze.toStringTag:o,lt=function(){try{var e=ui(Ae,"defineProperty");return e({},"",{}),e}catch(e){}}(),ut=t.clearTimeout!==it.clearTimeout&&t.clearTimeout,Ot=oe&&oe.now!==it.Date.now&&oe.now,Ut=t.setTimeout!==it.setTimeout&&t.setTimeout,lr=Ne.ceil,ur=Ne.floor,pr=Ae.getOwnPropertySymbols,fr=Be?Be.isBuffer:o,dr=t.isFinite,yr=Re.join,hr=er(Ae.keys,Ae),mr=Ne.max,gr=Ne.min,Er=oe.now,vr=t.parseInt,Tr=Ne.random,Sr=Re.reverse,_r=ui(t,"DataView"),Nr=ui(t,"Map"),Ar=ui(t,"Promise"),Cr=ui(t,"Set"),wr=ui(t,"WeakMap"),br=ui(Ae,"create"),Rr=wr&&new wr,Ir={},Or=Gi(_r),Pr=Gi(Nr),Mr=Gi(Ar),xr=Gi(Cr),Lr=Gi(wr),kr=ze?ze.prototype:o,Fr=kr?kr.valueOf:o,Dr=kr?kr.toString:o;function Ur(e){if(rs(e)&&!$a(e)&&!(e instanceof jr)){if(e instanceof zr)return e;if(xe.call(e,"__wrapped__"))return Bi(e)}return new zr(e)}var Gr=function(){function e(){}return function(t){if(!ts(t))return{};if(qe)return qe(t);e.prototype=t;var r=new e;return e.prototype=o,r}}();function Br(){}function zr(e,t){this.__wrapped__=e,this.__actions__=[],this.__chain__=!!t,this.__index__=0,this.__values__=o}function jr(e){this.__wrapped__=e,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=d,this.__views__=[]}function Vr(e){var t=-1,r=null==e?0:e.length;for(this.clear();++t=t?e:t)),e}function sn(e,t,r,n,i,a){var s,c=1&t,l=2&t,u=4&t;if(r&&(s=i?r(e,n,i,a):r(e)),s!==o)return s;if(!ts(e))return e;var p=$a(e);if(p){if(s=function(e){var t=e.length,r=new e.constructor(t);return t&&"string"==typeof e[0]&&xe.call(e,"index")&&(r.index=e.index,r.input=e.input),r}(e),!c)return Ro(e,s)}else{var f=di(e),d=f==T||f==S;if(Qa(e))return _o(e,c);if(f==A||f==h||d&&!i){if(s=l||d?{}:hi(e),!c)return l?function(e,t){return Io(e,fi(e),t)}(e,function(e,t){return e&&Io(t,xs(t),e)}(s,e)):function(e,t){return Io(e,pi(e),t)}(e,rn(s,e))}else{if(!Ze[f])return i?e:{};s=function(e,t,r){var n,o=e.constructor;switch(t){case P:return No(e);case g:case E:return new o(+e);case M:return function(e,t){var r=t?No(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.byteLength)}(e,r);case x:case L:case k:case F:case D:case U:case G:case B:case z:return Ao(e,r);case _:case b:return new o;case N:case R:return new o(e);case w:return function(e){var t=new e.constructor(e.source,fe.exec(e));return t.lastIndex=e.lastIndex,t}(e);case I:return n=e,Fr?Ae(Fr.call(n)):{}}}(e,f,c)}}a||(a=new Yr);var y=a.get(e);if(y)return y;a.set(e,s),ss(e)?e.forEach((function(n){s.add(sn(n,t,r,n,e,a))})):ns(e)&&e.forEach((function(n,o){s.set(o,sn(n,t,r,o,e,a))}));var m=p?o:(u?l?ni:ri:l?xs:Ms)(e);return vt(m||e,(function(n,o){m&&(n=e[o=n]),Zr(s,o,sn(n,t,r,o,e,a))})),s}function cn(e,t,r){var n=r.length;if(null==e)return!n;for(e=Ae(e);n--;){var i=r[n],a=t[i],s=e[i];if(s===o&&!(i in e)||!a(s))return!1}return!0}function ln(e,t,r){if("function"!=typeof e)throw new be(i);return Oi((function(){e.apply(o,r)}),t)}function un(e,t,r,n){var o=-1,i=Nt,a=!0,s=e.length,c=[],l=t.length;if(!s)return c;r&&(t=Ct(t,Vt(r))),n?(i=At,a=!1):t.length>=200&&(i=$t,a=!1,t=new Hr(t));e:for(;++o-1},Wr.prototype.set=function(e,t){var r=this.__data__,n=en(r,e);return n<0?(++this.size,r.push([e,t])):r[n][1]=t,this},$r.prototype.clear=function(){this.size=0,this.__data__={hash:new Vr,map:new(Nr||Wr),string:new Vr}},$r.prototype.delete=function(e){var t=ci(this,e).delete(e);return this.size-=t?1:0,t},$r.prototype.get=function(e){return ci(this,e).get(e)},$r.prototype.has=function(e){return ci(this,e).has(e)},$r.prototype.set=function(e,t){var r=ci(this,e),n=r.size;return r.set(e,t),this.size+=r.size==n?0:1,this},Hr.prototype.add=Hr.prototype.push=function(e){return this.__data__.set(e,a),this},Hr.prototype.has=function(e){return this.__data__.has(e)},Yr.prototype.clear=function(){this.__data__=new Wr,this.size=0},Yr.prototype.delete=function(e){var t=this.__data__,r=t.delete(e);return this.size=t.size,r},Yr.prototype.get=function(e){return this.__data__.get(e)},Yr.prototype.has=function(e){return this.__data__.has(e)},Yr.prototype.set=function(e,t){var r=this.__data__;if(r instanceof Wr){var n=r.__data__;if(!Nr||n.length<199)return n.push([e,t]),this.size=++r.size,this;r=this.__data__=new $r(n)}return r.set(e,t),this.size=r.size,this};var pn=Mo(vn),fn=Mo(Tn,!0);function dn(e,t){var r=!0;return pn(e,(function(e,n,o){return r=!!t(e,n,o)})),r}function yn(e,t,r){for(var n=-1,i=e.length;++n0&&r(s)?t>1?mn(s,t-1,r,n,o):wt(o,s):n||(o[o.length]=s)}return o}var gn=xo(),En=xo(!0);function vn(e,t){return e&&gn(e,t,Ms)}function Tn(e,t){return e&&En(e,t,Ms)}function Sn(e,t){return _t(t,(function(t){return Ka(e[t])}))}function _n(e,t){for(var r=0,n=(t=Eo(t,e)).length;null!=e&&rt}function wn(e,t){return null!=e&&xe.call(e,t)}function bn(e,t){return null!=e&&t in Ae(e)}function Rn(e,t,r){for(var i=r?At:Nt,a=e[0].length,s=e.length,c=s,l=n(s),u=1/0,p=[];c--;){var f=e[c];c&&t&&(f=Ct(f,Vt(t))),u=gr(f.length,u),l[c]=!r&&(t||a>=120&&f.length>=120)?new Hr(c&&f):o}f=e[0];var d=-1,y=l[0];e:for(;++d=s?c:c*("desc"==r[n]?-1:1)}return e.index-t.index}(e,t,r)}));n--;)e[n]=e[n].value;return e}(o)}function Vn(e,t,r){for(var n=-1,o=t.length,i={};++n-1;)s!==e&&nt.call(s,c,1),nt.call(e,c,1);return e}function $n(e,t){for(var r=e?t.length:0,n=r-1;r--;){var o=t[r];if(r==n||o!==i){var i=o;gi(o)?nt.call(e,o,1):lo(e,o)}}return e}function Hn(e,t){return e+ur(Tr()*(t-e+1))}function Yn(e,t){var r="";if(!e||t<1||t>p)return r;do{t%2&&(r+=e),(t=ur(t/2))&&(e+=e)}while(t);return r}function qn(e,t){return Pi(Ci(e,t,oc),e+"")}function Qn(e){return Qr(zs(e))}function Xn(e,t){var r=zs(e);return Li(r,an(t,0,r.length))}function Jn(e,t,r,n){if(!ts(e))return e;for(var i=-1,a=(t=Eo(t,e)).length,s=a-1,c=e;null!=c&&++ii?0:i+t),(r=r>i?i:r)<0&&(r+=i),i=t>r?0:r-t>>>0,t>>>=0;for(var a=n(i);++o>>1,a=e[i];null!==a&&!ls(a)&&(r?a<=t:a=200){var l=t?null:qo(e);if(l)return rr(l);a=!1,o=$t,c=new Hr}else c=t?[]:s;e:for(;++n=n?e:to(e,t,r)}var So=ut||function(e){return it.clearTimeout(e)};function _o(e,t){if(t)return e.slice();var r=e.length,n=Ve?Ve(r):new e.constructor(r);return e.copy(n),n}function No(e){var t=new e.constructor(e.byteLength);return new je(t).set(new je(e)),t}function Ao(e,t){var r=t?No(e.buffer):e.buffer;return new e.constructor(r,e.byteOffset,e.length)}function Co(e,t){if(e!==t){var r=e!==o,n=null===e,i=e==e,a=ls(e),s=t!==o,c=null===t,l=t==t,u=ls(t);if(!c&&!u&&!a&&e>t||a&&s&&l&&!c&&!u||n&&s&&l||!r&&l||!i)return 1;if(!n&&!a&&!u&&e1?r[i-1]:o,s=i>2?r[2]:o;for(a=e.length>3&&"function"==typeof a?(i--,a):o,s&&Ei(r[0],r[1],s)&&(a=i<3?o:a,i=1),t=Ae(t);++n-1?i[a?t[s]:s]:o}}function Uo(e){return ti((function(t){var r=t.length,n=r,a=zr.prototype.thru;for(e&&t.reverse();n--;){var s=t[n];if("function"!=typeof s)throw new be(i);if(a&&!c&&"wrapper"==ii(s))var c=new zr([],!0)}for(n=c?n:r;++n1&&v.reverse(),d&&pc))return!1;var u=a.get(e),p=a.get(t);if(u&&p)return u==t&&p==e;var f=-1,d=!0,y=2&r?new Hr:o;for(a.set(e,t),a.set(t,e);++f-1&&e%1==0&&e1?"& ":"")+t[n],t=t.join(r>2?", ":" "),e.replace(ie,"{\n/* [wrapped with "+t+"] */\n")}(n,function(e,t){return vt(y,(function(r){var n="_."+r[0];t&r[1]&&!Nt(e,n)&&e.push(n)})),e.sort()}(function(e){var t=e.match(ae);return t?t[1].split(se):[]}(n),r)))}function xi(e){var t=0,r=0;return function(){var n=Er(),i=16-(n-r);if(r=n,i>0){if(++t>=800)return arguments[0]}else t=0;return e.apply(o,arguments)}}function Li(e,t){var r=-1,n=e.length,i=n-1;for(t=t===o?n:t;++r1?e[t-1]:o;return r="function"==typeof r?(e.pop(),r):o,aa(e,r)}));function da(e){var t=Ur(e);return t.__chain__=!0,t}function ya(e,t){return t(e)}var ha=ti((function(e){var t=e.length,r=t?e[0]:0,n=this.__wrapped__,i=function(t){return on(t,e)};return!(t>1||this.__actions__.length)&&n instanceof jr&&gi(r)?((n=n.slice(r,+r+(t?1:0))).__actions__.push({func:ya,args:[i],thisArg:o}),new zr(n,this.__chain__).thru((function(e){return t&&!e.length&&e.push(o),e}))):this.thru(i)})),ma=Oo((function(e,t,r){xe.call(e,r)?++e[r]:nn(e,r,1)})),ga=Do(Wi),Ea=Do($i);function va(e,t){return($a(e)?vt:pn)(e,si(t,3))}function Ta(e,t){return($a(e)?Tt:fn)(e,si(t,3))}var Sa=Oo((function(e,t,r){xe.call(e,r)?e[r].push(t):nn(e,r,[t])})),_a=qn((function(e,t,r){var o=-1,i="function"==typeof t,a=Ya(e)?n(e.length):[];return pn(e,(function(e){a[++o]=i?gt(t,e,r):In(e,t,r)})),a})),Na=Oo((function(e,t,r){nn(e,r,t)}));function Aa(e,t){return($a(e)?Ct:Dn)(e,si(t,3))}var Ca=Oo((function(e,t,r){e[r?0:1].push(t)}),(function(){return[[],[]]})),wa=qn((function(e,t){if(null==e)return[];var r=t.length;return r>1&&Ei(e,t[0],t[1])?t=[]:r>2&&Ei(t[0],t[1],t[2])&&(t=[t[0]]),jn(e,mn(t,1),[])})),ba=Ot||function(){return it.Date.now()};function Ra(e,t,r){return t=r?o:t,t=e&&null==t?e.length:t,Xo(e,l,o,o,o,o,t)}function Ia(e,t){var r;if("function"!=typeof t)throw new be(i);return e=hs(e),function(){return--e>0&&(r=t.apply(this,arguments)),e<=1&&(t=o),r}}var Oa=qn((function(e,t,r){var n=1;if(r.length){var o=tr(r,ai(Oa));n|=c}return Xo(e,n,t,r,o)})),Pa=qn((function(e,t,r){var n=3;if(r.length){var o=tr(r,ai(Pa));n|=c}return Xo(t,n,e,r,o)}));function Ma(e,t,r){var n,a,s,c,l,u,p=0,f=!1,d=!1,y=!0;if("function"!=typeof e)throw new be(i);function h(t){var r=n,i=a;return n=a=o,p=t,c=e.apply(i,r)}function m(e){return p=e,l=Oi(E,t),f?h(e):c}function g(e){var r=e-u;return u===o||r>=t||r<0||d&&e-p>=s}function E(){var e=ba();if(g(e))return v(e);l=Oi(E,function(e){var r=t-(e-u);return d?gr(r,s-(e-p)):r}(e))}function v(e){return l=o,y&&n?h(e):(n=a=o,c)}function T(){var e=ba(),r=g(e);if(n=arguments,a=this,u=e,r){if(l===o)return m(u);if(d)return So(l),l=Oi(E,t),h(u)}return l===o&&(l=Oi(E,t)),c}return t=gs(t)||0,ts(r)&&(f=!!r.leading,s=(d="maxWait"in r)?mr(gs(r.maxWait)||0,t):s,y="trailing"in r?!!r.trailing:y),T.cancel=function(){l!==o&&So(l),p=0,n=u=a=l=o},T.flush=function(){return l===o?c:v(ba())},T}var xa=qn((function(e,t){return ln(e,1,t)})),La=qn((function(e,t,r){return ln(e,gs(t)||0,r)}));function ka(e,t){if("function"!=typeof e||null!=t&&"function"!=typeof t)throw new be(i);var r=function(){var n=arguments,o=t?t.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=e.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(ka.Cache||$r),r}function Fa(e){if("function"!=typeof e)throw new be(i);return function(){var t=arguments;switch(t.length){case 0:return!e.call(this);case 1:return!e.call(this,t[0]);case 2:return!e.call(this,t[0],t[1]);case 3:return!e.call(this,t[0],t[1],t[2])}return!e.apply(this,t)}}ka.Cache=$r;var Da=vo((function(e,t){var r=(t=1==t.length&&$a(t[0])?Ct(t[0],Vt(si())):Ct(mn(t,1),Vt(si()))).length;return qn((function(n){for(var o=-1,i=gr(n.length,r);++o=t})),Wa=On(function(){return arguments}())?On:function(e){return rs(e)&&xe.call(e,"callee")&&!et.call(e,"callee")},$a=n.isArray,Ha=pt?Vt(pt):function(e){return rs(e)&&An(e)==P};function Ya(e){return null!=e&&es(e.length)&&!Ka(e)}function qa(e){return rs(e)&&Ya(e)}var Qa=fr||gc,Xa=ft?Vt(ft):function(e){return rs(e)&&An(e)==E};function Ja(e){if(!rs(e))return!1;var t=An(e);return t==v||"[object DOMException]"==t||"string"==typeof e.message&&"string"==typeof e.name&&!is(e)}function Ka(e){if(!ts(e))return!1;var t=An(e);return t==T||t==S||"[object AsyncFunction]"==t||"[object Proxy]"==t}function Za(e){return"number"==typeof e&&e==hs(e)}function es(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=p}function ts(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function rs(e){return null!=e&&"object"==typeof e}var ns=dt?Vt(dt):function(e){return rs(e)&&di(e)==_};function os(e){return"number"==typeof e||rs(e)&&An(e)==N}function is(e){if(!rs(e)||An(e)!=A)return!1;var t=He(e);if(null===t)return!0;var r=xe.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&Me.call(r)==De}var as=yt?Vt(yt):function(e){return rs(e)&&An(e)==w},ss=ht?Vt(ht):function(e){return rs(e)&&di(e)==b};function cs(e){return"string"==typeof e||!$a(e)&&rs(e)&&An(e)==R}function ls(e){return"symbol"==typeof e||rs(e)&&An(e)==I}var us=mt?Vt(mt):function(e){return rs(e)&&es(e.length)&&!!Ke[An(e)]},ps=$o(Fn),fs=$o((function(e,t){return e<=t}));function ds(e){if(!e)return[];if(Ya(e))return cs(e)?ir(e):Ro(e);if(at&&e[at])return function(e){for(var t,r=[];!(t=e.next()).done;)r.push(t.value);return r}(e[at]());var t=di(e);return(t==_?Zt:t==b?rr:zs)(e)}function ys(e){return e?(e=gs(e))===u||e===-1/0?17976931348623157e292*(e<0?-1:1):e==e?e:0:0===e?e:0}function hs(e){var t=ys(e),r=t%1;return t==t?r?t-r:t:0}function ms(e){return e?an(hs(e),0,d):0}function gs(e){if("number"==typeof e)return e;if(ls(e))return f;if(ts(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=ts(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=jt(e);var r=ye.test(e);return r||me.test(e)?rt(e.slice(2),r?2:8):de.test(e)?f:+e}function Es(e){return Io(e,xs(e))}function vs(e){return null==e?"":so(e)}var Ts=Po((function(e,t){if(_i(t)||Ya(t))Io(t,Ms(t),e);else for(var r in t)xe.call(t,r)&&Zr(e,r,t[r])})),Ss=Po((function(e,t){Io(t,xs(t),e)})),_s=Po((function(e,t,r,n){Io(t,xs(t),e,n)})),Ns=Po((function(e,t,r,n){Io(t,Ms(t),e,n)})),As=ti(on),Cs=qn((function(e,t){e=Ae(e);var r=-1,n=t.length,i=n>2?t[2]:o;for(i&&Ei(t[0],t[1],i)&&(n=1);++r1),t})),Io(e,ni(e),r),n&&(r=sn(r,7,Zo));for(var o=t.length;o--;)lo(r,t[o]);return r})),Ds=ti((function(e,t){return null==e?{}:function(e,t){return Vn(e,t,(function(t,r){return Rs(e,r)}))}(e,t)}));function Us(e,t){if(null==e)return{};var r=Ct(ni(e),(function(e){return[e]}));return t=si(t),Vn(e,r,(function(e,r){return t(e,r[0])}))}var Gs=Qo(Ms),Bs=Qo(xs);function zs(e){return null==e?[]:Wt(e,Ms(e))}var js=ko((function(e,t,r){return t=t.toLowerCase(),e+(r?Vs(t):t)}));function Vs(e){return Js(vs(e).toLowerCase())}function Ws(e){return(e=vs(e))&&e.replace(Ee,Qt).replace($e,"")}var $s=ko((function(e,t,r){return e+(r?"-":"")+t.toLowerCase()})),Hs=ko((function(e,t,r){return e+(r?" ":"")+t.toLowerCase()})),Ys=Lo("toLowerCase"),qs=ko((function(e,t,r){return e+(r?"_":"")+t.toLowerCase()})),Qs=ko((function(e,t,r){return e+(r?" ":"")+Js(t)})),Xs=ko((function(e,t,r){return e+(r?" ":"")+t.toUpperCase()})),Js=Lo("toUpperCase");function Ks(e,t,r){return e=vs(e),(t=r?o:t)===o?function(e){return Qe.test(e)}(e)?function(e){return e.match(Ye)||[]}(e):function(e){return e.match(ce)||[]}(e):e.match(t)||[]}var Zs=qn((function(e,t){try{return gt(e,o,t)}catch(e){return Ja(e)?e:new Se(e)}})),ec=ti((function(e,t){return vt(t,(function(t){t=Ui(t),nn(e,t,Oa(e[t],e))})),e}));function tc(e){return function(){return e}}var rc=Uo(),nc=Uo(!0);function oc(e){return e}function ic(e){return Ln("function"==typeof e?e:sn(e,1))}var ac=qn((function(e,t){return function(r){return In(r,e,t)}})),sc=qn((function(e,t){return function(r){return In(e,r,t)}}));function cc(e,t,r){var n=Ms(t),o=Sn(t,n);null!=r||ts(t)&&(o.length||!n.length)||(r=t,t=e,e=this,o=Sn(t,Ms(t)));var i=!(ts(r)&&"chain"in r&&!r.chain),a=Ka(e);return vt(o,(function(r){var n=t[r];e[r]=n,a&&(e.prototype[r]=function(){var t=this.__chain__;if(i||t){var r=e(this.__wrapped__),o=r.__actions__=Ro(this.__actions__);return o.push({func:n,args:arguments,thisArg:e}),r.__chain__=t,r}return n.apply(e,wt([this.value()],arguments))})})),e}function lc(){}var uc=jo(Ct),pc=jo(St),fc=jo(It);function dc(e){return vi(e)?Dt(Ui(e)):function(e){return function(t){return _n(t,e)}}(e)}var yc=Wo(),hc=Wo(!0);function mc(){return[]}function gc(){return!1}var Ec,vc=zo((function(e,t){return e+t}),0),Tc=Yo("ceil"),Sc=zo((function(e,t){return e/t}),1),_c=Yo("floor"),Nc=zo((function(e,t){return e*t}),1),Ac=Yo("round"),Cc=zo((function(e,t){return e-t}),0);return Ur.after=function(e,t){if("function"!=typeof t)throw new be(i);return e=hs(e),function(){if(--e<1)return t.apply(this,arguments)}},Ur.ary=Ra,Ur.assign=Ts,Ur.assignIn=Ss,Ur.assignInWith=_s,Ur.assignWith=Ns,Ur.at=As,Ur.before=Ia,Ur.bind=Oa,Ur.bindAll=ec,Ur.bindKey=Pa,Ur.castArray=function(){if(!arguments.length)return[];var e=arguments[0];return $a(e)?e:[e]},Ur.chain=da,Ur.chunk=function(e,t,r){t=(r?Ei(e,t,r):t===o)?1:mr(hs(t),0);var i=null==e?0:e.length;if(!i||t<1)return[];for(var a=0,s=0,c=n(lr(i/t));ai?0:i+r),(n=n===o||n>i?i:hs(n))<0&&(n+=i),n=r>n?0:ms(n);r>>0)?(e=vs(e))&&("string"==typeof t||null!=t&&!as(t))&&!(t=so(t))&&Kt(e)?To(ir(e),0,r):e.split(t,r):[]},Ur.spread=function(e,t){if("function"!=typeof e)throw new be(i);return t=null==t?0:mr(hs(t),0),qn((function(r){var n=r[t],o=To(r,0,t);return n&&wt(o,n),gt(e,this,o)}))},Ur.tail=function(e){var t=null==e?0:e.length;return t?to(e,1,t):[]},Ur.take=function(e,t,r){return e&&e.length?to(e,0,(t=r||t===o?1:hs(t))<0?0:t):[]},Ur.takeRight=function(e,t,r){var n=null==e?0:e.length;return n?to(e,(t=n-(t=r||t===o?1:hs(t)))<0?0:t,n):[]},Ur.takeRightWhile=function(e,t){return e&&e.length?po(e,si(t,3),!1,!0):[]},Ur.takeWhile=function(e,t){return e&&e.length?po(e,si(t,3)):[]},Ur.tap=function(e,t){return t(e),e},Ur.throttle=function(e,t,r){var n=!0,o=!0;if("function"!=typeof e)throw new be(i);return ts(r)&&(n="leading"in r?!!r.leading:n,o="trailing"in r?!!r.trailing:o),Ma(e,t,{leading:n,maxWait:t,trailing:o})},Ur.thru=ya,Ur.toArray=ds,Ur.toPairs=Gs,Ur.toPairsIn=Bs,Ur.toPath=function(e){return $a(e)?Ct(e,Ui):ls(e)?[e]:Ro(Di(vs(e)))},Ur.toPlainObject=Es,Ur.transform=function(e,t,r){var n=$a(e),o=n||Qa(e)||us(e);if(t=si(t,4),null==r){var i=e&&e.constructor;r=o?n?new i:[]:ts(e)&&Ka(i)?Gr(He(e)):{}}return(o?vt:vn)(e,(function(e,n,o){return t(r,e,n,o)})),r},Ur.unary=function(e){return Ra(e,1)},Ur.union=ra,Ur.unionBy=na,Ur.unionWith=oa,Ur.uniq=function(e){return e&&e.length?co(e):[]},Ur.uniqBy=function(e,t){return e&&e.length?co(e,si(t,2)):[]},Ur.uniqWith=function(e,t){return t="function"==typeof t?t:o,e&&e.length?co(e,o,t):[]},Ur.unset=function(e,t){return null==e||lo(e,t)},Ur.unzip=ia,Ur.unzipWith=aa,Ur.update=function(e,t,r){return null==e?e:uo(e,t,go(r))},Ur.updateWith=function(e,t,r,n){return n="function"==typeof n?n:o,null==e?e:uo(e,t,go(r),n)},Ur.values=zs,Ur.valuesIn=function(e){return null==e?[]:Wt(e,xs(e))},Ur.without=sa,Ur.words=Ks,Ur.wrap=function(e,t){return Ua(go(t),e)},Ur.xor=ca,Ur.xorBy=la,Ur.xorWith=ua,Ur.zip=pa,Ur.zipObject=function(e,t){return ho(e||[],t||[],Zr)},Ur.zipObjectDeep=function(e,t){return ho(e||[],t||[],Jn)},Ur.zipWith=fa,Ur.entries=Gs,Ur.entriesIn=Bs,Ur.extend=Ss,Ur.extendWith=_s,cc(Ur,Ur),Ur.add=vc,Ur.attempt=Zs,Ur.camelCase=js,Ur.capitalize=Vs,Ur.ceil=Tc,Ur.clamp=function(e,t,r){return r===o&&(r=t,t=o),r!==o&&(r=(r=gs(r))==r?r:0),t!==o&&(t=(t=gs(t))==t?t:0),an(gs(e),t,r)},Ur.clone=function(e){return sn(e,4)},Ur.cloneDeep=function(e){return sn(e,5)},Ur.cloneDeepWith=function(e,t){return sn(e,5,t="function"==typeof t?t:o)},Ur.cloneWith=function(e,t){return sn(e,4,t="function"==typeof t?t:o)},Ur.conformsTo=function(e,t){return null==t||cn(e,t,Ms(t))},Ur.deburr=Ws,Ur.defaultTo=function(e,t){return null==e||e!=e?t:e},Ur.divide=Sc,Ur.endsWith=function(e,t,r){e=vs(e),t=so(t);var n=e.length,i=r=r===o?n:an(hs(r),0,n);return(r-=t.length)>=0&&e.slice(r,i)==t},Ur.eq=za,Ur.escape=function(e){return(e=vs(e))&&q.test(e)?e.replace(H,Xt):e},Ur.escapeRegExp=function(e){return(e=vs(e))&&re.test(e)?e.replace(te,"\\$&"):e},Ur.every=function(e,t,r){var n=$a(e)?St:dn;return r&&Ei(e,t,r)&&(t=o),n(e,si(t,3))},Ur.find=ga,Ur.findIndex=Wi,Ur.findKey=function(e,t){return Pt(e,si(t,3),vn)},Ur.findLast=Ea,Ur.findLastIndex=$i,Ur.findLastKey=function(e,t){return Pt(e,si(t,3),Tn)},Ur.floor=_c,Ur.forEach=va,Ur.forEachRight=Ta,Ur.forIn=function(e,t){return null==e?e:gn(e,si(t,3),xs)},Ur.forInRight=function(e,t){return null==e?e:En(e,si(t,3),xs)},Ur.forOwn=function(e,t){return e&&vn(e,si(t,3))},Ur.forOwnRight=function(e,t){return e&&Tn(e,si(t,3))},Ur.get=bs,Ur.gt=ja,Ur.gte=Va,Ur.has=function(e,t){return null!=e&&yi(e,t,wn)},Ur.hasIn=Rs,Ur.head=Yi,Ur.identity=oc,Ur.includes=function(e,t,r,n){e=Ya(e)?e:zs(e),r=r&&!n?hs(r):0;var o=e.length;return r<0&&(r=mr(o+r,0)),cs(e)?r<=o&&e.indexOf(t,r)>-1:!!o&&xt(e,t,r)>-1},Ur.indexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var o=null==r?0:hs(r);return o<0&&(o=mr(n+o,0)),xt(e,t,o)},Ur.inRange=function(e,t,r){return t=ys(t),r===o?(r=t,t=0):r=ys(r),function(e,t,r){return e>=gr(t,r)&&e=-9007199254740991&&e<=p},Ur.isSet=ss,Ur.isString=cs,Ur.isSymbol=ls,Ur.isTypedArray=us,Ur.isUndefined=function(e){return e===o},Ur.isWeakMap=function(e){return rs(e)&&di(e)==O},Ur.isWeakSet=function(e){return rs(e)&&"[object WeakSet]"==An(e)},Ur.join=function(e,t){return null==e?"":yr.call(e,t)},Ur.kebabCase=$s,Ur.last=Ji,Ur.lastIndexOf=function(e,t,r){var n=null==e?0:e.length;if(!n)return-1;var i=n;return r!==o&&(i=(i=hs(r))<0?mr(n+i,0):gr(i,n-1)),t==t?function(e,t,r){for(var n=r+1;n--;)if(e[n]===t)return n;return n}(e,t,i):Mt(e,kt,i,!0)},Ur.lowerCase=Hs,Ur.lowerFirst=Ys,Ur.lt=ps,Ur.lte=fs,Ur.max=function(e){return e&&e.length?yn(e,oc,Cn):o},Ur.maxBy=function(e,t){return e&&e.length?yn(e,si(t,2),Cn):o},Ur.mean=function(e){return Ft(e,oc)},Ur.meanBy=function(e,t){return Ft(e,si(t,2))},Ur.min=function(e){return e&&e.length?yn(e,oc,Fn):o},Ur.minBy=function(e,t){return e&&e.length?yn(e,si(t,2),Fn):o},Ur.stubArray=mc,Ur.stubFalse=gc,Ur.stubObject=function(){return{}},Ur.stubString=function(){return""},Ur.stubTrue=function(){return!0},Ur.multiply=Nc,Ur.nth=function(e,t){return e&&e.length?zn(e,hs(t)):o},Ur.noConflict=function(){return it._===this&&(it._=Ue),this},Ur.noop=lc,Ur.now=ba,Ur.pad=function(e,t,r){e=vs(e);var n=(t=hs(t))?or(e):0;if(!t||n>=t)return e;var o=(t-n)/2;return Vo(ur(o),r)+e+Vo(lr(o),r)},Ur.padEnd=function(e,t,r){e=vs(e);var n=(t=hs(t))?or(e):0;return t&&nt){var n=e;e=t,t=n}if(r||e%1||t%1){var i=Tr();return gr(e+i*(t-e+tt("1e-"+((i+"").length-1))),t)}return Hn(e,t)},Ur.reduce=function(e,t,r){var n=$a(e)?bt:Gt,o=arguments.length<3;return n(e,si(t,4),r,o,pn)},Ur.reduceRight=function(e,t,r){var n=$a(e)?Rt:Gt,o=arguments.length<3;return n(e,si(t,4),r,o,fn)},Ur.repeat=function(e,t,r){return t=(r?Ei(e,t,r):t===o)?1:hs(t),Yn(vs(e),t)},Ur.replace=function(){var e=arguments,t=vs(e[0]);return e.length<3?t:t.replace(e[1],e[2])},Ur.result=function(e,t,r){var n=-1,i=(t=Eo(t,e)).length;for(i||(i=1,e=o);++np)return[];var r=d,n=gr(e,d);t=si(t),e-=d;for(var o=zt(n,t);++r=a)return e;var c=r-or(n);if(c<1)return n;var l=s?To(s,0,c).join(""):e.slice(0,c);if(i===o)return l+n;if(s&&(c+=l.length-c),as(i)){if(e.slice(c).search(i)){var u,p=l;for(i.global||(i=Ce(i.source,vs(fe.exec(i))+"g")),i.lastIndex=0;u=i.exec(p);)var f=u.index;l=l.slice(0,f===o?c:f)}}else if(e.indexOf(so(i),c)!=c){var d=l.lastIndexOf(i);d>-1&&(l=l.slice(0,d))}return l+n},Ur.unescape=function(e){return(e=vs(e))&&Y.test(e)?e.replace($,sr):e},Ur.uniqueId=function(e){var t=++Le;return vs(e)+t},Ur.upperCase=Xs,Ur.upperFirst=Js,Ur.each=va,Ur.eachRight=Ta,Ur.first=Yi,cc(Ur,(Ec={},vn(Ur,(function(e,t){xe.call(Ur.prototype,t)||(Ec[t]=e)})),Ec),{chain:!1}),Ur.VERSION="4.17.21",vt(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(e){Ur[e].placeholder=Ur})),vt(["drop","take"],(function(e,t){jr.prototype[e]=function(r){r=r===o?1:mr(hs(r),0);var n=this.__filtered__&&!t?new jr(this):this.clone();return n.__filtered__?n.__takeCount__=gr(r,n.__takeCount__):n.__views__.push({size:gr(r,d),type:e+(n.__dir__<0?"Right":"")}),n},jr.prototype[e+"Right"]=function(t){return this.reverse()[e](t).reverse()}})),vt(["filter","map","takeWhile"],(function(e,t){var r=t+1,n=1==r||3==r;jr.prototype[e]=function(e){var t=this.clone();return t.__iteratees__.push({iteratee:si(e,3),type:r}),t.__filtered__=t.__filtered__||n,t}})),vt(["head","last"],(function(e,t){var r="take"+(t?"Right":"");jr.prototype[e]=function(){return this[r](1).value()[0]}})),vt(["initial","tail"],(function(e,t){var r="drop"+(t?"":"Right");jr.prototype[e]=function(){return this.__filtered__?new jr(this):this[r](1)}})),jr.prototype.compact=function(){return this.filter(oc)},jr.prototype.find=function(e){return this.filter(e).head()},jr.prototype.findLast=function(e){return this.reverse().find(e)},jr.prototype.invokeMap=qn((function(e,t){return"function"==typeof e?new jr(this):this.map((function(r){return In(r,e,t)}))})),jr.prototype.reject=function(e){return this.filter(Fa(si(e)))},jr.prototype.slice=function(e,t){e=hs(e);var r=this;return r.__filtered__&&(e>0||t<0)?new jr(r):(e<0?r=r.takeRight(-e):e&&(r=r.drop(e)),t!==o&&(r=(t=hs(t))<0?r.dropRight(-t):r.take(t-e)),r)},jr.prototype.takeRightWhile=function(e){return this.reverse().takeWhile(e).reverse()},jr.prototype.toArray=function(){return this.take(d)},vn(jr.prototype,(function(e,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),n=/^(?:head|last)$/.test(t),i=Ur[n?"take"+("last"==t?"Right":""):t],a=n||/^find/.test(t);i&&(Ur.prototype[t]=function(){var t=this.__wrapped__,s=n?[1]:arguments,c=t instanceof jr,l=s[0],u=c||$a(t),p=function(e){var t=i.apply(Ur,wt([e],s));return n&&f?t[0]:t};u&&r&&"function"==typeof l&&1!=l.length&&(c=u=!1);var f=this.__chain__,d=!!this.__actions__.length,y=a&&!f,h=c&&!d;if(!a&&u){t=h?t:new jr(this);var m=e.apply(t,s);return m.__actions__.push({func:ya,args:[p],thisArg:o}),new zr(m,f)}return y&&h?e.apply(this,s):(m=this.thru(p),y?n?m.value()[0]:m.value():m)})})),vt(["pop","push","shift","sort","splice","unshift"],(function(e){var t=Re[e],r=/^(?:push|sort|unshift)$/.test(e)?"tap":"thru",n=/^(?:pop|shift)$/.test(e);Ur.prototype[e]=function(){var e=arguments;if(n&&!this.__chain__){var o=this.value();return t.apply($a(o)?o:[],e)}return this[r]((function(r){return t.apply($a(r)?r:[],e)}))}})),vn(jr.prototype,(function(e,t){var r=Ur[t];if(r){var n=r.name+"";xe.call(Ir,n)||(Ir[n]=[]),Ir[n].push({name:t,func:r})}})),Ir[Go(o,2).name]=[{name:"wrapper",func:o}],jr.prototype.clone=function(){var e=new jr(this.__wrapped__);return e.__actions__=Ro(this.__actions__),e.__dir__=this.__dir__,e.__filtered__=this.__filtered__,e.__iteratees__=Ro(this.__iteratees__),e.__takeCount__=this.__takeCount__,e.__views__=Ro(this.__views__),e},jr.prototype.reverse=function(){if(this.__filtered__){var e=new jr(this);e.__dir__=-1,e.__filtered__=!0}else(e=this.clone()).__dir__*=-1;return e},jr.prototype.value=function(){var e=this.__wrapped__.value(),t=this.__dir__,r=$a(e),n=t<0,o=r?e.length:0,i=function(e,t,r){for(var n=-1,o=r.length;++n=this.__values__.length;return{done:e,value:e?o:this.__values__[this.__index__++]}},Ur.prototype.plant=function(e){for(var t,r=this;r instanceof Br;){var n=Bi(r);n.__index__=0,n.__values__=o,t?i.__wrapped__=n:t=n;var i=n;r=r.__wrapped__}return i.__wrapped__=e,t},Ur.prototype.reverse=function(){var e=this.__wrapped__;if(e instanceof jr){var t=e;return this.__actions__.length&&(t=new jr(this)),(t=t.reverse()).__actions__.push({func:ya,args:[ta],thisArg:o}),new zr(t,this.__chain__)}return this.thru(ta)},Ur.prototype.toJSON=Ur.prototype.valueOf=Ur.prototype.value=function(){return fo(this.__wrapped__,this.__actions__)},Ur.prototype.first=Ur.prototype.head,at&&(Ur.prototype[at]=function(){return this}),Ur}();it._=cr,(n=function(){return cr}.call(t,r,t,e))===o||(e.exports=n)}.call(this)},904:(e,t)=>{"use strict";var r;let n;Object.defineProperty(t,"__esModule",{value:!0}),t.setDomain=t.getDomain=t.Domain=void 0,function(e){e[e.FA=0]="FA",e[e.FORM=1]="FORM",e[e.ETS=2]="ETS"}(r||(r={})),t.Domain=r,t.setDomain=e=>{n=e},t.getDomain=()=>null!=n?n:r.FA},784:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.errorMap=void 0,t.errorMap=new Map([["fileError","Visual file is damaged"],["versionError","Version number of visual file does not match"],["modelError","Visual model in visual file is damaged"],["codegenError","Codegen visual file failed"]])},117:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNode=void 0,t.ASTNode=class{accept(e){return e.visit(this)}}},862:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Cache=void 0,t.Cache=class{constructor(e,t=0){this.value="",this.indent=t,this.flag=!0,this.INDENT=e}indentOn(){this.flag=!0}indentOff(){this.flag=!1}incIndent(){this.indent++}decIndent(){this.indent--}checkIndent(){return this.indent<0}getIndents(){if(this.flag){let e="";for(let t=0;t{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Tag=void 0;const n=r(117);class o extends n.ASTNode{constructor(e,t,r,n,o){super(),this.defaultValue=new Map,this.mediaParams=new Map,this.mediaProperties=new Map,this.mediaKeyProperty=new Map,this.tagName=e,this.params=t,this.content=r,this.properties=n,this.forEachObj=o,this.ifBoolean=null}setMediaParams(e){this.mediaParams=e}setParams(e){this.params=e}setIfBoolean(e){this.ifBoolean=e}setTagName(e){this.tagName=e}setForEachObj(e){this.forEachObj=e}setMediaProperty(e,t){t.forEach(((t,r)=>{var n;this.mediaKeyProperty.has(r)||this.mediaKeyProperty.set(r,new Map),null===(n=this.mediaKeyProperty.get(r))||void 0===n||n.set(e,t)}))}setDefaultValue(e,t,r="undefined"){this.defaultValue.set(e,[r,t])}}t.Tag=o},623:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNodeGenerator=void 0;const n=r(519),o=r(862),i=r(51),a=r(294);class s{constructor(e){this.cache=e,this.etsImport=new o.Cache(" ",1),this.etsVariable=new o.Cache(" ",1),this.etsFunction=new o.Cache(" ",1),this.aboutToAppear=new o.Cache(" ",2),this.needMediaQuery=!0}visit(e){e instanceof n.Tag&&(this.needMediaQuery&&this.genMediaQuery(e),this.genTag(e))}static getMethodGen(e){return void 0===s.instance?s.instance=new s(e):s.instance.setCache(e),s.instance}setCache(e){this.cache=e,this.etsImport=new o.Cache(" ",1),this.etsVariable=new o.Cache(" ",1),this.etsFunction=new o.Cache(" ",1),this.aboutToAppear=new o.Cache(" ",2),this.needMediaQuery=!0}genParams(e){if("string"==typeof e)this.cache.concat(e);else if(e.size>0){this.cache.concat(i.TokenClass.LBRA,i.TokenClass.SPACE);let t=0;e.forEach(((r,n)=>{this.cache.concat(n,i.TokenClass.COLON,i.TokenClass.SPACE,r),t++,t{this.cache.concat(n,i.TokenClass.COLON,i.TokenClass.SPACE,r),t++,t{e.accept(this),this.cache.indentOff(),this.cache.concat(i.TokenClass.NEW_LINE),this.cache.indentOn()})),this.cache.decIndent(),this.cache.indentOn()),this.cache.indentOn(),this.cache.concat(i.TokenClass.RBRA)),(null!==e.properties||null!==e.mediaProperties)&&(null!==e.content&&0!==e.content.length||this.cache.incIndent(),this.getProperties(e).forEach(((e,t)=>{this.cache.concat(i.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.concat(i.TokenClass.PROPERTY_START,t,i.TokenClass.TAG_START),this.cache.indentOff(),"string"==typeof e?this.cache.concat(e,i.TokenClass.TAG_END):this.genObjectProperty(e)})),null!==e.content&&0!==e.content.length||this.cache.decIndent()),this.genEnd(e)}genStart(e){this.genIfStart(e),this.genForTagStart(e)}genEnd(e){this.genForTagEnd(e),this.genIfEnd(e)}genForTagStart(e){var t;void 0!==(null===(t=e.forEachObj)||void 0===t?void 0:t.for)&&(this.cache.concat("ForEach",i.TokenClass.TAG_START,e.forEachObj.for.toString(),i.TokenClass.COMMA,i.TokenClass.NEW_LINE),this.cache.concat(i.TokenClass.TAG_START,e.forEachObj.item,i.TokenClass.COLON," any",i.TokenClass.COMMA," ",e.forEachObj.idx,i.TokenClass.COLON," number",i.TokenClass.TAG_END," => ",i.TokenClass.LBRA,i.TokenClass.NEW_LINE))}genForTagEnd(e){null!==e.forEachObj&&(this.cache.concat(i.TokenClass.RBRA),void 0!==e.forEachObj.key&&""!==e.forEachObj.key&&(this.cache.concat(i.TokenClass.COMMA,i.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.concat(i.TokenClass.TAG_START,e.forEachObj.item,i.TokenClass.COLON," any",i.TokenClass.COMMA," ",e.forEachObj.idx,i.TokenClass.COLON," number",i.TokenClass.TAG_END," => ",i.TokenClass.LBRA,i.TokenClass.NEW_LINE),this.cache.concat("return ",e.forEachObj.key.toString(),i.TokenClass.TAG_START,e.forEachObj.item,i.TokenClass.COMMA," ",e.forEachObj.idx,i.TokenClass.TAG_END,i.TokenClass.RBRA),this.cache.indentOff()),this.cache.concat(i.TokenClass.TAG_END))}genIfStart(e){null!==e.ifBoolean&&(this.cache.concat("if",i.TokenClass.SPACE,i.TokenClass.TAG_START,e.ifBoolean.toString(),i.TokenClass.TAG_END,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),this.cache.incIndent())}genIfEnd(e){null!==e.ifBoolean&&(this.cache.indentOn(),this.cache.decIndent(),this.cache.concat(i.TokenClass.NEW_LINE),this.cache.concat(i.TokenClass.RBRA),this.cache.indentOff())}genMediaQuery(e){const t=new Map,r=new Map;if(this.collectMediaQueryMap(e,t),this.collectDefaultValueMap(e,r),0===t.size&&0===r.size)return;const n=(0,a.getUniqueName)("mediaQuery"),s=(0,a.getUniqueName)("initForMediaQuery"),c=(0,a.getUniqueName)("mediaQueryCb"),l=(0,a.getUniqueName)("saveMediaQueryResult"),u=(0,a.getUniqueName)("updateForMediaQuery"),p=new o.Cache(i.TokenClass.INDENT,1),f=new o.Cache(i.TokenClass.INDENT,1),d=new o.Cache(i.TokenClass.INDENT,1),y=new o.Cache(i.TokenClass.INDENT,1),h=new o.Cache(i.TokenClass.INDENT,1),m=new o.Cache(i.TokenClass.INDENT,1),g=new o.Cache(i.TokenClass.INDENT,1),E=new o.Cache(i.TokenClass.INDENT,2);this.genVariableDeclare(r,p),this.genMediaQueryCb(c,f),this.genMediaQueryListener(t,d,y),this.genInitFuc(s,r,h),this.genMediaQueryCbFnc(l,u,t,m),this.genUpdateFnc(u,s,t,g),this.genAboutToAppear(c,l,t,E),this.etsImport.indentOff(),this.aboutToAppear.indentOff(),this.etsVariable.indentOff(),this.etsFunction.indentOff(),this.etsImport.indentOff(),this.etsImport.concat("import ",n," from '@ohos.mediaquery'"),this.aboutToAppear.concat(E.toString()),this.etsVariable.concat(p.toString(),f.toString(),d.toString(),y.toString()),this.etsFunction.concat(m.toString(),i.TokenClass.NEW_LINE,h.toString(),i.TokenClass.NEW_LINE,g.toString()),this.etsImport.indentOn(),this.aboutToAppear.indentOn(),this.etsVariable.indentOn(),this.etsFunction.indentOn(),this.needMediaQuery=!1}genVariableDeclare(e,t){e.forEach(((e,r)=>{t.concat(i.TokenClass.DECORATOR_STATE,i.TokenClass.SPACE,r.slice(5),i.TokenClass.COLON,i.TokenClass.SPACE,e[1],i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,i.TokenClass.UNDEFINED,i.TokenClass.NEW_LINE)}))}genMediaQueryCb(e,t){t.concat(e,i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,i.TokenClass.NULL,i.TokenClass.NEW_LINE)}genMediaQueryListener(e,t,r){const n=(0,a.getUniqueName)("mediaQuery");e.forEach(((e,o)=>{const s=(0,a.getUniqueName)(this.getMediaQueryVariableName(o));t.concat(s,i.TokenClass.COLON,i.TokenClass.SPACE,i.TokenClass.BOOLEAN,i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,i.TokenClass.FALSE,i.TokenClass.NEW_LINE),r.concat(`listener_${s}`,i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,n,i.TokenClass.PROPERTY_START,"matchMediaSync",i.TokenClass.TAG_START,`'${o}'`,i.TokenClass.TAG_END,i.TokenClass.NEW_LINE)}))}genInitFuc(e,t,r){r.concat(e,i.TokenClass.TAG_START,i.TokenClass.TAG_END,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),r.indentOn(),r.incIndent(),t.forEach(((e,t)=>{r.concat(t,i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,e[0],i.TokenClass.NEW_LINE)})),r.decIndent(),r.concat(i.TokenClass.RBRA,i.TokenClass.NEW_LINE)}genMediaQueryCbFnc(e,t,r,n){const o=Array.from(r.entries());n.concat(e,i.TokenClass.TAG_START,"mediaQueryResult",i.TokenClass.TAG_END,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),n.incIndent(),n.concat(i.TokenClass.SWITCH,i.TokenClass.SPACE,i.TokenClass.TAG_START,"mediaQueryResult.media",i.TokenClass.TAG_END,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),n.incIndent();for(let e=0;e{const r=(0,a.getUniqueName)(this.getMediaQueryVariableName(t));n.concat(i.TokenClass.IF,i.TokenClass.SPACE,i.TokenClass.TAG_START,i.TokenClass.THIS,i.TokenClass.PROPERTY_START,r,i.TokenClass.TAG_END,i.TokenClass.SPACE,i.TokenClass.LBRA,i.TokenClass.NEW_LINE),n.incIndent(),e.forEach(((e,t)=>{n.concat(t,i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,e,i.TokenClass.NEW_LINE)})),n.decIndent(),n.concat(i.TokenClass.RBRA,i.TokenClass.NEW_LINE)})),n.decIndent(),n.concat(i.TokenClass.RBRA,i.TokenClass.NEW_LINE)}genAboutToAppear(e,t,r,n){let o=1;n.concat(i.TokenClass.THIS,i.TokenClass.PROPERTY_START,e,i.TokenClass.SPACE,i.TokenClass.ASSIGN,i.TokenClass.SPACE,i.TokenClass.THIS,i.TokenClass.PROPERTY_START,`${t}.bind(this)`,i.TokenClass.NEW_LINE),r.forEach(((t,s)=>{const c=`listener_${(0,a.getUniqueName)(this.getMediaQueryVariableName(s))}`;n.indentOn(),n.concat(i.TokenClass.THIS,i.TokenClass.PROPERTY_START,c,i.TokenClass.PROPERTY_START,`on('change', this.${e})`),o0?e.mediaParams:e.params}getProperties(e){const t=new Map;return e.properties.forEach(((e,r)=>{t.set(r,e)})),e.mediaProperties.forEach(((e,r)=>{t.set(r,e)})),t}collectDefaultValueMap(e,t){void 0!==e.defaultValue&&e.defaultValue.forEach(((e,r)=>{t.set(r,e)})),null!==e.content&&0!==e.content.length&&e.content.forEach((e=>{this.collectDefaultValueMap(e,t)}))}collectMediaQueryMap(e,t){void 0!==e.mediaKeyProperty&&e.mediaKeyProperty.forEach(((e,r)=>{var n;const o=null!==(n=t.get(r))&&void 0!==n?n:new Map;e.forEach(((e,t)=>{o.set(t,e)})),t.set(r,o)})),null!==e.content&&0!==e.content.length&&e.content.forEach((e=>{this.collectMediaQueryMap(e,t)}))}getMediaQueryVariableName(e){const t="device-type: ",r="orientation: ",n=e.substring(e.indexOf(t),e.length),o=n.substring(t.length,n.indexOf(")")),i=e.substring(e.indexOf(r),e.length),a=i.substring(r.length,i.indexOf(")"));return`${o}${a.slice(0,1).toUpperCase()+a.slice(1).toLowerCase()}`}}t.ASTNodeGenerator=s,s.instance=void 0},413:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ETSBridge=void 0;const n=r(519),o=r(973),i=r(497);t.ETSBridge=class{constructor(){this.errors=0}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}visit(e){const t=new Map;let r=null;const a=new Map,s=new n.Tag(e.type,t,r,a,null);if((0,o.parseVisualModel)(e,s),(0,i.parseMediaVisualModel)(e,s),e.children.length>0){r=[];for(const t of e.children)r.push(t.accept(this))}return s.content=r,s}}},459:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.genETS=void 0;const n=r(623),o=r(862);t.genETS=function(e){const t=n.ASTNodeGenerator.getMethodGen(new o.Cache(" ",2));return e.accept(t),{build:t.cache.toString(),etsImport:t.etsImport.toString(),etsVariable:t.etsVariable.toString(),etsFunction:t.etsFunction.toString(),aboutToAppear:t.aboutToAppear.toString()}}},435:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.StringWriter=void 0;const n=r(459);t.StringWriter=class{genETS(e){return(0,n.genETS)(e)}}},51:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenClass=void 0,(r=t.TokenClass||(t.TokenClass={}))[r.IDENTIFIER=0]="IDENTIFIER",r[r.STRING_LITERAL=1]="STRING_LITERAL",r[r.NUMBER=2]="NUMBER",r[r.CHARACTER=3]="CHARACTER",r[r.EOF=4]="EOF",r[r.INVALID=5]="INVALID",r.EMPTY_DATA="empty",r.ASSIGN="=",r.INDENT=" ",r.NEW_LINE="\n",r.CARRIAGE_RETURN="\r",r.SPACE=" ",r.LQUOTE="'",r.RQUOTE="'",r.TAG_START="(",r.TAG_END=")",r.EMPTY_TAG_END="/>",r.END_TAG_START="{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isMediaProperty=t.parseMediaVisualModel=void 0;const n=r(294),o=r(973),i=r(290),a=(0,o.curry)(((e,t)=>t.hasMediaProperty(e))),s=(0,o.curry)(((e,t,r)=>r.type===e&&r.hasMediaProperty(t)));function c(e){const t=e+"-visual",r=i.etsPropertyList;let n="";for(const e of r)void 0!==e.propertySet.properties&&(n=l(t,e.propertySet.properties)),e.propertySet.property===t&&(n=e.propertySet.etsType);return function(e=""){const t=new Map([["ETSBoolean","boolean"],["ETSNumber","number"],["ETSString","string"],["Rfloat","Resource"],["Rstring","Resource"],["Rcolor","Resource"],["Rmedia","Resource"],["Rrawfile","Resource"],["ETSArray","any[]"]]),r=new Array;return e.split("|").forEach((e=>{const n=t.get(e);"Resource"!==n&&r.push(null!=n?n:e)})),r.join(" | ")}(n)}function l(e,t){for(const r of t)if(r.property===e)return r.etsType;return""}function u(e,t,r){const n=t.get(r);return void 0!==n&&n.has(e)}function p(e){return`'${e}'`}function f(e){return isNaN(Number(e))?(0,o.getEtsEnumValue)("FontWeight.",e):e}function d(e){let t=(0,o.getEtsEnumValue)("FlexAlign.",e);return"flex-start"===e?t="FlexAlign.Start":"flex-end"===e&&(t="FlexAlign.End"),t}function y(e){return"TextOverflow."+(0,o.firstUpperCase)(e)}function h(e,t,r){var n,i;const a=new Map,s=null!==(n=e.mediaProperty)&&void 0!==n?n:new Map,c=null!==(i=e.dynamicMediaProperty)&&void 0!==i?i:new Map;return s.forEach(((e,n)=>{let i=e.get(t);const s=e.get(r);(0,o.isEmptyOrUndefined)(i)&&(0,o.isEmptyOrUndefined)(s)||(i="0"===i||(0,o.isEmptyOrUndefined)(i)?"0":i.substring(0,i.length-2),a.set(n,i))})),c.forEach(((e,r)=>{const n=e.get(t);(0,o.isEmptyOrUndefined)(n)||a.set(r,n)})),a}function m(e,t){const r=e.get("left"),n=e.get("top"),i=t.get("left"),a=t.get("top");let s="undefined",c="undefined";return(0,o.isEmptyOrUndefined)(r)&&(0,o.isEmptyOrUndefined)(n)||(s=`'${null!=r?r:0}'`,c=`'${null!=n?n:0}'`),(0,o.isEmptyOrUndefined)(i)&&(0,o.isEmptyOrUndefined)(a)||(s=null!=i?i:s,c=null!=a?a:c),{leftValue:s,topValue:c}}function g(e,t){e.forEach(((e,r)=>{"undefined"!==e&&t.set(r,"undefined")}))}function E(e,t){var r,n;const o=new Map,i=t.split("-")[0];return(null!==(r=e.mediaProperty)&&void 0!==r?r:new Map).forEach(((r,n)=>{var a,s,c,l;const u=r.get(i),f=null===(s=null===(a=e.dynamicMediaProperty)||void 0===a?void 0:a.get(n))||void 0===s?void 0:s.get(i),d=null!==(l=null!==(c=r.get(t))&&void 0!==c?c:f)&&void 0!==l?l:u;void 0!==d&&o.set(n,p(d))})),(null!==(n=e.dynamicMediaProperty)&&void 0!==n?n:new Map).forEach(((e,r)=>{var n;const a=e.get(i),s=null!==(n=e.get(t))&&void 0!==n?n:a;void 0!==s&&o.set(r,s)})),o}function v(e,t,r){var n,i;const a=new Map;return(null!==(n=e.mediaProperty)&&void 0!==n?n:new Map).forEach(((e,n)=>{let i=e.get(t);(0,o.isEmptyOrUndefined)(i)||("function"==typeof r&&(i=r(i)),(0,o.isEmptyOrUndefined)(i)||a.set(n,i))})),(null!==(i=e.dynamicMediaProperty)&&void 0!==i?i:new Map).forEach(((e,r)=>{let n=e.get(t);void 0===n||"content"!==t&&"label"!==t||(n=(0,o.getContentName)(n)),(0,o.isEmptyOrUndefined)(n)||a.set(r,n)})),a}function T(e,t){const r=`this.${(0,o.getEtsPropName)(e)}${(0,o.firstUpperCase)((0,o.getEtsPropName)(t))}`;return`${r}_${(0,n.getUniqueId)(r)}`}function S(e,t,r){var n;const i=e.property.get(t),a=e.dynamicProperty.get(t);let s=null!==(n=new Map([["if","true"],["auto-play","false"],["interval","3000"]]).get(t))&&void 0!==n?n:"undefined";return(0,o.isEmptyOrUndefined)(i)||(s="function"==typeof r?r(i):i,s=(0,o.isEmptyOrUndefined)(s)?"undefined":s),(0,o.isEmptyOrUndefined)(a)||(s=a),s}const _=(0,o.curry)(((e,t,r)=>{const n=v(t,e,p);if(0===n.size)return;const i=S(t,e,p),a=T(t.id,e);r.setDefaultValue(a,c(e),i),r.setMediaProperty(a,n),r.mediaProperties.set((0,o.getEtsPropName)(e),a)})),N=(0,o.curry)(((e,t,r)=>{const n=v(t,e);if(0===n.size)return;const i=S(t,e),a=T(t.id,e);r.setDefaultValue(a,c(e),i),r.setMediaProperty(a,n),r.mediaProperties.set((0,o.getEtsPropName)(e),a)})),A=(0,o.curry)(((e,t,r)=>{const n=v(t,e);if(0===n.size)return;const i=S(t,e),a=T(t.id,e);r.setDefaultValue(a,c(e),i),r.setMediaProperty(a,n),r.mediaProperties.set((0,o.getEtsPropName)(e),a)})),C=(0,o.curry)(((e,t,r,n)=>{const i=v(r,e,(0,o.curry)(o.getEtsEnumValue)(t));if(0===i.size)return;const a=S(r,e,(0,o.curry)(o.getEtsEnumValue)(t)),s=T(r.id,e);n.setDefaultValue(s,c(e),a),n.setMediaProperty(s,i),n.mediaProperties.set((0,o.getEtsPropName)(e),s)})),w=(0,o.curry)(((e,t,r)=>{const n=v(t,e,p);if(!(r.mediaParams instanceof Map)||0===n.size)return;const i=S(t,e,p),a=T(t.id,e);r.setDefaultValue(a,c(e),i),r.setMediaProperty(a,n),r.mediaParams.set((0,o.getEtsPropName)(e),a)})),b=(0,o.curry)(((e,t,r)=>{const n=v(t,e);if(!(r.mediaParams instanceof Map)||0===n.size)return;const i=S(t,e),a=T(t.id,e);r.setDefaultValue(a,c(e),i),r.setMediaProperty(a,n),r.mediaParams.set((0,o.getEtsPropName)(e),a)})),R=(0,o.curry)(((e,t,r,n)=>{const i=v(r,e,(0,o.curry)(o.getEtsEnumValue)(t));if(!(n.mediaParams instanceof Map)||0===i.size)return;const a=S(r,e,(0,o.curry)(o.getEtsEnumValue)(t)),s=T(r.id,e);n.setDefaultValue(s,c(e),a),n.setMediaProperty(s,i),n.mediaParams.set((0,o.getEtsPropName)(e),s)})),I=(0,o.curry)(((e,t,r)=>{const n=v(t,e,o.dealWithColor);if(0===n.size)return;const i=S(t,e,o.dealWithColor),a=T(t.id,e);r.setDefaultValue(a,c(e),i),r.setMediaProperty(a,n),r.mediaProperties.set((0,o.getEtsPropName)(e),a)}));function O(e,t,r,n=!1){(0,o.isEmptyOrUndefined)(t)||r.set(e,n?t:`'${t}'`)}t.parseMediaVisualModel=function(e,t){!function(e,t){var r,n,o;const i=null!==(r=e.dynamicProperty.get("for"))&&void 0!==r?r:"[1]",a=null!==(n=e.property.get("item"))&&void 0!==n?n:"item",s=null!==(o=e.property.get("idx"))&&void 0!==o?o:"idx",l=e.dynamicProperty.get("keyGenerator"),u=v(e,"for");if(0===u.size)return;const p=T(e.id,"for"),f={for:p,key:l,item:a,idx:s};t.setDefaultValue(p,c("for"),i),t.setMediaProperty(p,u),t.setForEachObj(f)}(e,t),function(e,t){const r=v(e,"if");if(0===r.size)return;const n=S(e,"if"),o=T(e.id,"if");t.setDefaultValue(o,c("if"),n),t.setMediaProperty(o,r),t.setIfBoolean(o)}(e,t);for(const r of k)("boolean"==typeof r[0]||r[0](e))&&r[1](e,t)};const P=(0,o.curry)(((e,t,r)=>{const n=new Map,i=t.property.get(e),a=t.dynamicProperty.get(e),s=null!=a?a:i,l=["top","bottom","left","right"];let u=0;for(const i of l){const a=`${e}-${i}`,l=t.property.get(a),f=t.dynamicProperty.get(a),d=E(t,a);let y=(0,o.isEmptyOrUndefined)(s)?"undefined":p(s);if((0,o.isEmptyOrUndefined)(l)||(y=p(l)),(0,o.isEmptyOrUndefined)(f)||(y=f),d.size>0){const e=T(t.id,a);r.setDefaultValue(e,c(a),y),r.setMediaProperty(e,d),O(i,e,n,!0),u++}else O(i,y,n,!0)}u>0&&r.mediaProperties.set(e,n)})),M=(0,o.curry)(((e,t,r,n)=>{const i=v(r,e,d);if(!(n.mediaParams instanceof Map)||0===i.size)return;const a=S(r,e,d),s=T(r.id,e);n.setDefaultValue(s,c(e),a),n.setMediaProperty(s,i),n.mediaParams.set((0,o.getEtsPropName)(e),s)})),x=(0,o.curry)(((e,t)=>t.type===e));t.isMediaProperty=function(e,t){return!u(e,L,"common")&&!u(e,L,t)&&!u(e,L,"events")};const L=new Map([["common",new Set(["keyGenerator","item","idx"])],["events",new Set([...o.events])]]),k=[...[[a("width"),_("width")],[a("height"),_("height")],[function(e){return e.hasMediaProperty("constraint-size-min-width")||e.hasMediaProperty("constraint-size-max-width")||e.hasMediaProperty("constraint-size-min-height")||e.hasMediaProperty("constraint-size-min-height")},function(e,t){const r=new Map,n=["min-width","max-width","min-height","max-height"];for(const i of n){const n=`constraint-size-${i}`,a=v(e,n,p),s=S(e,n,p);if(a.size>0){const l=T(e.id,n);t.setDefaultValue(l,c(n),s),t.setMediaProperty(l,a),O((0,o.getEtsPropName)(i),l,r,!0)}}r.size>0&&t.mediaProperties.set("constraintSize",r)}],[a("align"),C("align","Alignment.")],[a("direction"),C("direction","Direction.")],[function(e){return e.hasMediaProperty("left")||e.hasMediaProperty("top")},function(e,t){var r;const n=null!==(r=e.property.get("position"))&&void 0!==r?r:"relative",{leftValue:o,topValue:i}=m(e.property,e.dynamicProperty),{mediaPositionLeft:a,mediaPositionTop:s,mediaOffsetLeft:l,mediaOffsetTop:u}=function(e){var t,r;const n=new Map,o=new Map,i=new Map,a=new Map,s=null!==(t=e.mediaProperty)&&void 0!==t?t:new Map,c=null!==(r=e.dynamicMediaProperty)&&void 0!==r?r:new Map,l=new Set;for(const[e]of s)l.add(e);for(const[e]of c)l.add(e);return l.forEach((t=>{var r,s,c,l;const u=null!==(s=null===(r=e.mediaProperty)||void 0===r?void 0:r.get(t))&&void 0!==s?s:new Map,p=null!==(l=null===(c=e.dynamicMediaProperty)||void 0===c?void 0:c.get(t))&&void 0!==l?l:new Map,f=u.get("position"),{leftValue:d,topValue:y}=m(u,p);"absolute"===f?("undefined"!==d&&n.set(t,d),"undefined"!==y&&o.set(t,y)):("undefined"!==d&&i.set(t,d),"undefined"!==y&&a.set(t,y))})),{mediaPositionLeft:n,mediaPositionTop:o,mediaOffsetLeft:i,mediaOffsetTop:a}}(e),p=a.size>0||s.size>0||"absolute"===n,f=l.size>0||u.size>0||"relative"===n,d=T(e.id,"positionLeft"),y=T(e.id,"positionTop"),h=T(e.id,"offsetLeft"),E=T(e.id,"offsetTop");if(0!==a.size||0!==s.size||0!==u.size||0!==l.size){if(p&&f&&(g(a,l),g(l,a),g(s,u),g(u,s)),p){const e="absolute"===n?o:"undefined",r="absolute"===n?i:"undefined";t.setDefaultValue(d,c("left"),e),t.setDefaultValue(y,c("top"),r),t.setMediaProperty(d,a),t.setMediaProperty(y,s),t.mediaProperties.set("position",new Map([["x",d],["y",y]]))}if(f){const e="relative"===n?o:"undefined",r="relative"===n?i:"undefined";t.setDefaultValue(h,c("left"),e),t.setDefaultValue(E,c("top"),r),t.setMediaProperty(h,l),t.setMediaProperty(E,u),t.mediaProperties.set("offset",new Map([["x",h],["y",E]]))}}}],[a("aspect-ratio"),N("aspect-ratio")],[a("display-priority"),N("display-priority")],[a("flex-basis"),_("flex-basis")],[a("flex-grow"),N("flex-grow")],[a("flex-shrink"),N("flex-shrink")],[a("align-self"),function(e,t){const r=v(e,"align-self",o.dealWithAlignSelf);if(0===r.size)return;const n=S(e,"align-self",o.dealWithAlignSelf),i=T(e.id,"align-self");t.setDefaultValue(i,c("align-self"),n),t.setMediaProperty(i,r),t.mediaProperties.set("alignSelf",i)}],[a("border-style"),C("border-style","BorderStyle.")],[a("border-width"),_("border-width")],[a("border-color"),I("border-color")],[a("border-radius"),_("border-radius")],[a("background-color"),I("background-color")],[function(e){return e.hasMediaProperty("background-image-src")||e.hasMediaProperty("background-image-repeat")},function(e,t){const r=e.property.get("background-image-src"),n=e.property.get("background-image-repeat"),i=e.dynamicProperty.get("background-image-src"),a=e.dynamicProperty.get("background-image-repeat"),s=v(e,"background-image-src",o.dealWithSrc),l=v(e,"background-image-repeat",o.dealWithBackgroundRepeat);if(0===s.size&&0===l.size)return;let u=(0,o.dealWithSrc)(null!=r?r:"");if((0,o.isEmptyOrUndefined)(i)||(u=i),s.size>0){const r=T(e.id,"background-image-src");t.setDefaultValue(r,c("background-image-src"),u),t.setMediaProperty(r,s),u=r}let p="undefined";if(!(0,o.isEmptyOrUndefined)(n)){const e=(0,o.dealWithBackgroundRepeat)(n);null!=e&&""!==e&&(p=e)}if((0,o.isEmptyOrUndefined)(a)||(p=a),l.size>0){const r=T(e.id,"background-image-repeat");t.setDefaultValue(r,c("background-image-repeat"),p),t.setMediaProperty(r,l),p=r}t.mediaProperties.set("backgroundImage",u+", "+p)}],[a("background-image-size"),function(e,t){const r=v(e,"background-image-size",o.dealWithBackgroundImageSize);if(0===r.size)return;const n=S(e,"background-image-size",o.dealWithBackgroundImageSize),i=T(e.id,"background-image-size");t.setDefaultValue(i,"{ width?: string | number, height?: string | number } | ImageSize",n),t.setMediaProperty(i,r),t.mediaProperties.set("backgroundImageSize",i)}],[a("background-image-position"),function(e,t){const r=v(e,"background-image-position",o.dealWithBackgroundImagePosition);if(0===r.size)return;const n=S(e,"background-image-position",o.dealWithBackgroundImagePosition),i=T(e.id,"background-image-position");t.setDefaultValue(i,"{ x?: number | string, y?: number | string } | Alignment",n),t.setMediaProperty(i,r),t.mediaProperties.set("backgroundImagePosition",i)}],[a("opacity"),N("opacity")],[a("visibility"),C("visibility","Visibility.")],[a("enabled"),A("enabled")],[a("font-color"),I("font-color")],[a("font-size"),_("font-size")],[a("font-style"),C("font-style","FontStyle.")],[a("font-weight"),function(e,t){const r=v(e,"font-weight",o.dealWithFontWeight);if(0===r.size)return;const n=S(e,"font-weight",o.dealWithFontWeight),i=T(e.id,"font-weight");t.setDefaultValue(i,c("font-weight"),n),t.setMediaProperty(i,r),t.mediaProperties.set("fontWeight",i)}],[a("font-family"),_("font-family")],[function(e){return e.hasMediaProperty("margin")||e.hasMediaProperty("margin-left")||e.hasMediaProperty("margin-top")||e.hasMediaProperty("margin-right")||e.hasMediaProperty("margin-bottom")},P("margin")],[function(e){return e.hasMediaProperty("padding")||e.hasMediaProperty("padding-left")||e.hasMediaProperty("padding-top")||e.hasMediaProperty("padding-right")||e.hasMediaProperty("padding-bottom")},P("padding")]],[s("button","label"),function(e,t){const r=e.property.get("label"),n=e.dynamicProperty.get("label"),i=v(e,"label",(e=>`\`${e}\``));if(0===i.size)return;let a="''";(0,o.isEmptyOrUndefined)(r)||(a=`\`${r}\``),(0,o.isEmptyOrUndefined)(n)||(a=(0,o.getContentName)(n));const s=T(e.id,"label");t.setDefaultValue(s,c("label"),a),t.setMediaProperty(s,i),t.setMediaParams(s)}],[s("button","type"),C("type","ButtonType.")],[s("button","state-effect"),A("state-effect")],[s("divider","vertical"),A("vertical")],[s("divider","color"),I("color")],[s("divider","stroke-width"),_("stroke-width")],[s("divider","line-cap"),C("line-cap","LineCapStyle.")],[x("image"),function(e,t){var r;const n=null!==(r=e.property.get("src"))&&void 0!==r?r:"",i=e.dynamicProperty.get("src"),a=v(e,"src",p);if(0===a.size)return;let s=(0,o.dealWithSrc)(n);(0,o.isEmptyOrUndefined)(i)||(s=i);const l=T(e.id,"src");t.setDefaultValue(l,c("src"),s),t.setMediaProperty(l,a),t.setMediaParams(l)}],[s("image","alt"),_("alt")],[s("image","object-fit"),C("object-fit","ImageFit.")],[s("image","object-repeat"),C("object-repeat","ImageRepeat.")],[s("image","interpolation"),C("interpolation","ImageInterpolation.")],[s("image","render-mode"),C("render-mode","ImageRenderMode.")],[function(e){return e.hasMediaProperty("source-size-width")||e.hasMediaProperty("source-size-height")},function(e,t){let r=e.property.get("source-size-width"),n=e.property.get("source-size-height");const i=e.dynamicProperty.get("source-size-width"),a=e.dynamicProperty.get("source-size-height"),s=h(e,"source-size-width","source-size-height"),l=h(e,"source-size-height","source-size-width");if(0===s.size)return;r="0"===r||(0,o.isEmptyOrUndefined)(r)?"0":r.substring(0,r.length-2),n="0"===n||(0,o.isEmptyOrUndefined)(n)?"0":n.substring(0,n.length-2),(0,o.isEmptyOrUndefined)(i)||(r=i),(0,o.isEmptyOrUndefined)(a)||(n=a);const u=T(e.id,"source-size-width"),p=T(e.id,"source-size-height");t.setDefaultValue(u,c("source-size-width"),r),t.setDefaultValue(p,c("source-size-height"),n),t.setMediaProperty(u,s),t.setMediaProperty(p,l);const f=new Map([["width",u],["height",p]]);t.mediaProperties.set("sourceSize",f)}],[function(e){return"progress"===e.type&&(e.hasMediaProperty("value")||e.hasMediaProperty("total")||e.hasMediaProperty("style"))},function(e,t){const r=e.property.get("value"),n=e.dynamicProperty.get("value"),i=v(e,"value");if(!(t.mediaParams instanceof Map)||0===i.size)return;let a=null!=r?r:"0";(0,o.isEmptyOrUndefined)(n)||(a=n);const s=T(e.id,"value");t.setDefaultValue(s,c("value"),a),t.setMediaProperty(s,i),t.mediaParams.set("value",s)}],[s("progress","total"),b("total")],[s("progress","style"),R("style","ProgressStyle.")],[s("progress","color"),I("color")],[s("slider","value"),b("value")],[s("slider","min"),b("min")],[s("slider","max"),b("max")],[s("slider","step"),b("step")],[s("slider","style"),R("style","SliderStyle.")],[s("slider","block-color"),I("block-color")],[s("slider","track-color"),I("track-color")],[s("slider","selected-color"),I("selected-color")],[s("slider","show-steps"),A("show-steps")],[s("slider","show-tips"),A("show-tips")],[s("text","content"),function(e,t){const r=e.property.get("content"),n=e.dynamicProperty.get("content"),i=v(e,"content",(e=>`\`${e}\``));if(0===i.size)return;let a="''";(0,o.isEmptyOrUndefined)(r)||(a=`\`${r}\``),(0,o.isEmptyOrUndefined)(n)||(a=(0,o.getContentName)(n));const s=T(e.id,"content");t.setDefaultValue(s,c("content"),a),t.setMediaProperty(s,i),t.setMediaParams(s)}],[s("text","text-align"),C("text-align","TextAlign.")],[s("text","text-overflow"),function(e,t){const r=v(e,"text-overflow",y);if(0===r.size)return;const n=S(e,"text-overflow",y),o=T(e.id,"text-overflow");t.setDefaultValue(o,c("text-overflow"),n),t.setMediaProperty(o,r),t.mediaProperties.set("textOverflow",new Map([["overflow",o]]))}],[s("text","max-lines"),N("max-lines")],[s("text","line-height"),_("line-height")],[function(e){return"text"===e.type&&(e.hasMediaProperty("decoration-type")||e.hasMediaProperty("decoration-color"))},function(e,t){const r=v(e,"decoration-type",(0,o.curry)(o.getEtsEnumValue)("TextDecorationType.")),n=v(e,"decoration-color",o.dealWithColor);if(0===r.size&&0===n.size)return;let i=S(e,"decoration-type",(0,o.curry)(o.getEtsEnumValue)("TextDecorationType.")),a=S(e,"decoration-color",o.dealWithColor);if(r.size>0){const n=T(e.id,"decoration-type");t.setDefaultValue(n,c("decoration-type"),i),t.setMediaProperty(n,r),i=n}if(n.size>0){const r=T(e.id,"decoration-color");t.setDefaultValue(r,c("decoration-color"),a),t.setMediaProperty(r,n),a=r}const s=new Map([["type",i]]);t.mediaProperties.set("decoration",s),"undefined"!==a&&s.set("color",a)}],[s("text","baseline-offset"),_("baseline-offset")],[s("text","text-case"),C("text-case","TextCase.")],[s("column","space"),w("space")],[s("column","align-items-column"),function(e,t){const r=v(e,"align-items-column",o.dealWithColumnAlignItems);if(0===r.size)return;const n=S(e,"align-items-column",o.dealWithColumnAlignItems),i=T(e.id,"align-items-column");t.setDefaultValue(i,c("align-items-column"),n),t.setMediaProperty(i,r),t.mediaProperties.set("alignItems",i)}],[s("row","space"),w("space")],[s("row","align-items-row"),function(e,t){const r=v(e,"align-items-row",o.dealWithRowAlignItems);if(0===r.size)return;const n=S(e,"align-items-row",o.dealWithRowAlignItems),i=T(e.id,"align-items-row");t.setDefaultValue(i,c("align-items-row"),n),t.setMediaProperty(i,r),t.mediaProperties.set("alignItems",i)}],[s("flex","flex-direction"),function(e,t){const r=v(e,"flex-direction",(0,o.curry)(o.getEtsEnumValue)("FlexDirection."));if(!(t.mediaParams instanceof Map)||0===r.size)return;const n=S(e,"flex-direction",(0,o.curry)(o.getEtsEnumValue)("FlexDirection.")),i=T(e.id,"flex-direction");t.setDefaultValue(i,c("flex-direction"),n),t.setMediaProperty(i,r),t.mediaParams.set("direction",i)}],[s("flex","wrap"),function(e,t){const r=v(e,"wrap",o.dealWithWrap);if(!(t.mediaParams instanceof Map)||0===r.size)return;const n=S(e,"wrap",o.dealWithWrap),i=T(e.id,"wrap");t.setDefaultValue(i,c("wrap"),n),t.setMediaProperty(i,r),t.mediaParams.set("wrap",i)}],[s("flex","justify-content"),M("justify-content","FlexAlign.")],[s("flex","align-items-flex"),function(e,t){const r=v(e,"align-items-flex",o.dealWithFlexAlignItems);if(!(t.mediaParams instanceof Map)||0===r.size)return;const n=S(e,"align-items-flex",o.dealWithFlexAlignItems),i=T(e.id,"align-items-flex");t.setDefaultValue(i,c("align-items-flex"),n),t.setMediaProperty(i,r),t.mediaParams.set("alignItems",i)}],[s("flex","align-content"),M("align-content","FlexAlign.")],[s("list","space-list"),function(e,t){const r=v(e,"space-list");if(!(t.mediaParams instanceof Map)||0===r.size)return;const n=S(e,"space-list"),o=T(e.id,"space-list");t.setDefaultValue(o,c("space-list"),n),t.setMediaProperty(o,r),t.mediaParams.set("space",o)}],[s("list","initial-index"),b("initial-index")],[s("list","list-direction"),C("list-direction","Axis.")],[function(e){return"list"===e.type&&(e.hasMediaProperty("divider-stroke-width")||e.hasMediaProperty("divider-color")||e.hasMediaProperty("divider-start-margin")||e.hasMediaProperty("divider-end-margin"))},function(e,t){const r=[["divider-stroke-width",p],["divider-color",o.dealWithColor],["divider-start-margin",p],["divider-end-margin",p]];let n=0;const i=new Map;for(const[a,s]of r){const r=v(e,a,s),l=(0,o.getEtsPropName)(a.replace("divider-",""));let u=S(e,a,s);if("undefined"===u&&"divider-stroke-width"===a&&(u="0"),r.size>0){const o=T(e.id,a);t.setDefaultValue(o,c(a),u),t.setMediaProperty(o,r),u=o,n++}i.set(l,u)}n>0&&t.mediaProperties.set("divider",i)}],[s("list","edit-mode"),A("edit-mode")],[s("list","edge-effect"),C("edge-effect","EdgeEffect.")],[s("list","chain-animation"),A("chain-animation")],[s("list-item","sticky"),C("sticky","Sticky.")],[s("list-item","editable"),A("editable")],[s("swiper","index"),N("index")],[s("swiper","auto-play"),A("auto-play")],[s("swiper","interval"),N("interval")],[s("swiper","indicator"),A("indicator")],[s("swiper","loop"),A("loop")],[s("swiper","duration"),N("duration")],[s("swiper","vertical"),A("vertical")],[s("swiper","item-space"),_("item-space")],[s("swiper","cached-count"),N("cached-count")],[s("swiper","disable-swipe"),A("disable-swipe")],[s("text-input","placeholder"),w("placeholder")],[s("text-input","textInput-type"),function(e,t){const r=v(e,"textInput-type",(0,o.curry)(o.getEtsEnumValue)("InputType."));if(0===r.size)return;const n=S(e,"textInput-type",(0,o.curry)(o.getEtsEnumValue)("InputType.")),i=T(e.id,"textInput-type");t.setDefaultValue(i,c("textInput-type"),n),t.setMediaProperty(i,r),t.mediaProperties.set("type",i)}],[s("text-input","placeholderColor"),I("placeholderColor")],[function(e){return"text-input"===e.type&&(e.hasMediaProperty("placeholderFont-size")||e.hasMediaProperty("placeholderFont-weight")||e.hasMediaProperty("placeholderFont-family")||e.hasMediaProperty("placeholderFont-style"))},function(e,t){const r=[["size",p],["weight",f],["family",p],["style",(0,o.curry)(o.getEtsEnumValue)("FontStyle.")]];let n=0;const i=new Map;for(const[o,a]of r){const r=`placeholderFont-${o}`,s=v(e,r,a);let l=S(e,r,a);if(s.size>0){const o=T(e.id,r);t.setDefaultValue(o,c(r),l),t.setMediaProperty(o,s),l=o,n++}i.set(o,l)}n>0&&t.mediaProperties.set("placeholderFont",i)}],[s("text-input","enterKeyType"),C("enterKeyType","EnterKeyType.")],[s("text-input","caretColor"),I("caretColor")],[s("text-input","maxLength"),N("maxLength")]]},973:(e,t)=>{"use strict";function r(e){return(...t)=>t.lengtht.property.has(e)||t.dynamicProperty.has(e))),o=r(((e,t,r)=>r.type===e&&(r.property.has(t)||r.dynamicProperty.has(t))));function i(e,t,r){const n=t.dynamicProperty.get(e);return void 0!==n&&""!==n.trim()&&(r.properties.set(g(e),n),!0)}const a=r(((e,t,r)=>{if(i(e,t,r))return;const n=t.property.get(e);void 0!==n&&r.properties.set(g(e),`'${n}'`)}));function s(e){return void 0===e||""===e}t.isEmptyOrUndefined=s;const c=r(((e,t,r)=>{if(i(e,t,r))return;const n=t.property.get(e);s(n)||r.properties.set(g(e),n)})),l=r(((e,t,r)=>{if(i(e,t,r))return;const n=t.property.get(e);s(n)||r.properties.set(g(e),n)})),u=r(((e,t,r,n)=>{if(i(e,r,n))return;const o=r.property.get(e);s(o)||n.properties.set(g(e),E(t,o))}));function p(e,t,r){const n=t.dynamicProperty.get(e);return void 0!==n&&""!==n.trim()&&r.params instanceof Map&&(r.params.set(g(e),n),!0)}const f=r(((e,t,r)=>{if(p(e,t,r))return;const n=t.property.get(e);void 0!==n&&r.params instanceof Map&&r.params.set(g(e),`'${n}'`)})),d=r(((e,t,r)=>{if(p(e,t,r))return;const n=t.property.get(e);!s(n)&&r.params instanceof Map&&r.params.set(g(e),n)})),y=r(((e,t,r,n)=>{if(p(e,r,n))return;const o=r.property.get(e);!s(o)&&n.params instanceof Map&&n.params.set(g(e),E(t,o))})),h=r(((e,t,r)=>{if(i(e,t,r))return;let n=t.property.get(e);s(n)||(n=v(n),r.properties.set(g(e),n))}));function m([e,...t]){return(null==e?void 0:e.toUpperCase())+t.join("")}function g(e){const t=e.split("-");let r=t[0];for(let e=1;ee[0].toUpperCase()+e.slice(1))).join(""));const n=function(e){var t,r;const n=e.dynamicProperty.get("for"),o=e.dynamicProperty.get("keyGenerator"),i=null!==(t=e.property.get("item"))&&void 0!==t?t:"item",a=null!==(r=e.property.get("idx"))&&void 0!==r?r:"idx";return void 0!==e.dynamicProperty.get("for")?{for:n,key:o,item:i,idx:a}:null}(e);r.setForEachObj(n);const o=void 0!==e.dynamicProperty.get("if")?e.dynamicProperty.get("if"):e.property.get("if");void 0===o?r.setIfBoolean(null):r.setIfBoolean(o);for(const t of M)("boolean"==typeof t[0]||t[0](e))&&t[1](e,r);!function(e,r){for(let n of t.events){const t=e.property.get(n);"onDisappear"===n&&(n="onDisAppear"),void 0!==t&&""!==t&&r.properties.set(n,t)}}(e,r)},t.events=["onClick","onTouch","onAppear","onDisappear","onKeyEvent","onAreaChange","onItemDelete","onScrollIndex","onItemDragEnter","onItemDragMove","onItemDragLeave","onItemDragStart","onItemDrop","onComplete","onError","onFinish","onChange","onSubmit","onEditChanged"],t.firstUpperCase=m,t.getEtsPropName=g,t.getEtsEnumValue=E,t.dealWithColor=v;const S=r(((e,t,r,n)=>{if(!(n.params instanceof Map))return;const o=r.dynamicProperty.get(e);if(!s(o))return void n.params.set(g(e),o);const i=r.property.get(e);if(s(i))return;let a=E(t,i);"flex-start"===i?a=t+"Start":"flex-end"===i&&(a=t+"End"),n.params.set(g(e),a)})),_=r(((e,t)=>t.type===e));function N(e){return null===e.match(/\$(r|rawfile)\('(.*)'\)$/)?`'${e}'`:e}function A(e){let t=E("ItemAlign.",e);return"flex-start"===e?t="ItemAlign.Start":"flex-end"===e&&(t="ItemAlign.End"),t}function C(e){let t=E("ItemAlign.",e);return"flex-start"===e?t="ItemAlign.Start":"flex-end"===e&&(t="ItemAlign.End"),t}function w(e){let t=E("FlexWrap.",e);return"nowrap"===e&&(t="FlexWrap.NoWrap"),t}function b(e){let t=E("VerticalAlign.",e);return"flex-start"===e?t="VerticalAlign.Top":"flex-end"===e&&(t="VerticalAlign.Bottom"),t}function R(e){let t=E("HorizontalAlign.",e);return"flex-start"===e?t="HorizontalAlign.Start":"flex-end"===e&&(t="HorizontalAlign.End"),t}function I(e){return["lighter","normal","regular","medium","bold","bolder"].includes(e)?E("FontWeight.",e):e}function O(e){const t=new Map([["repeat-x","X"],["repeat-y","Y"],["repeat","XY"],["no-repeat","NoRepeat"]]).get(e);if(null!=t&&""!==t)return E("ImageRepeat.",t)}function P(e){return e.startsWith("$r(")?e:`\`\${${e}}\``}t.dealWithSrc=N,t.dealWithAlignSelf=A,t.dealWithFlexAlignItems=C,t.dealWithWrap=w,t.dealWithRowAlignItems=b,t.dealWithColumnAlignItems=R,t.dealWithFontWeight=I,t.dealWithBackgroundImagePosition=function(e){if(new Set(["TopStart","Top","TopEnd","Start","Center","End","BottomStart","Bottom","BottomEnd"]).has(e))return"Alignment."+e;const t=e.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%)) +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$/);return null!==t?`{ x: '${t[1]}', y: '${t[4]}' }`:void 0},t.dealWithBackgroundImageSize=function(e){if(new Set(["Cover","Contain","Auto"]).has(e))return E("ImageSize.",e);const t=e.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%))( *$| +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$)/);return null!==t?void 0!==t[5]?`{ width: '${t[1]}', height: '${t[5]}' }`:`{ width: '${t[1]}' }`:void 0},t.dealWithBackgroundRepeat=O,t.getContentName=P;const M=[[n("width"),a("width")],[n("height"),a("height")],[function(e){return e.hasProperty("constraint-size-min-width")||e.hasProperty("constraint-size-max-width")||e.hasProperty("constraint-size-min-height")||e.hasProperty("constraint-size-max-height")},function(e,t){const r=new Map,n=e.getProperty("constraint-size-min-width"),o=e.getProperty("constraint-size-max-width"),i=e.getProperty("constraint-size-min-height"),a=e.getProperty("constraint-size-max-height");T("minWidth",n,r,e.dynamicProperty.has("constraint-size-min-width")),T("maxWidth",o,r,e.dynamicProperty.has("constraint-size-max-width")),T("minHeight",i,r,e.dynamicProperty.has("constraint-size-min-height")),T("maxHeight",a,r,e.dynamicProperty.has("constraint-size-max-height")),r.size>0&&t.properties.set("constraintSize",r)}],[n("align"),u("align","Alignment.")],[n("direction"),u("direction","Direction.")],[function(e){return e.hasProperty("left")||e.hasProperty("top")},function(e,t){const r="absolute"===e.property.get("position")?"position":"offset",n=e.property.get("left"),o=e.property.get("top"),i=e.dynamicProperty.get("left"),a=e.dynamicProperty.get("top");if(s(i)&&s(a)&&s(n)&&s(o))return;const c=new Map([["x",`'${null!=n?n:"0"}'`],["y",`'${null!=o?o:"0"}'`]]);s(i)||c.set("x",i),s(a)||c.set("y",a),t.properties.set(r,c)}],[n("aspect-ratio"),c("aspect-ratio")],[n("display-priority"),c("display-priority")],[n("flex-basis"),a("flex-basis")],[n("flex-grow"),c("flex-grow")],[n("flex-shrink"),c("flex-shrink")],[n("align-self"),function(e,t){const r=e.dynamicProperty.get("align-self");if(!s(r))return void t.properties.set("alignSelf",r);const n=e.property.get("align-self");if(s(n))return;const o=A(n);t.properties.set("alignSelf",o)}],[n("border-style"),u("border-style","BorderStyle.")],[n("border-width"),a("border-width")],[n("border-color"),h("border-color")],[n("border-radius"),a("border-radius")],[n("background-color"),h("background-color")],[function(e){return e.hasProperty("background-image-src")||e.hasProperty("background-image-repeat")},function(e,t){const r=e.getProperty("background-image-src"),n=e.getProperty("background-image-repeat");if(s(r)&&s(n))return;let o=N(null!=r?r:"");if(!s(n)){const e=O(n);null!=e&&""!==e&&(o=o+", "+e)}t.properties.set("backgroundImage",o)}],[n("background-image-size"),function(e,t){const r=e.getProperty("background-image-size");if(s(r))return;if(new Set(["Cover","Contain","Auto"]).has(r))return void t.properties.set("backgroundImageSize",E("ImageSize.",r));const n=r.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%))( *$| +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$)/);null!==n&&(void 0!==n[5]?t.properties.set("backgroundImageSize",new Map([["width",`'${n[1]}'`],["height",`'${n[5]}'`]])):t.properties.set("backgroundImageSize",new Map([["width",`'${n[1]}'`]])))}],[n("background-image-position"),function(e,t){const r=e.getProperty("background-image-position");if(s(r))return;if(new Set(["TopStart","Top","TopEnd","Start","Center","End","BottomStart","Bottom","BottomEnd"]).has(r))return void t.properties.set("backgroundImagePosition","Alignment."+r);const n=r.match(/^ *((0|[1-9][0-9]*)(px|vp|lpx|%)) +((0|[1-9][0-9]*)(px|vp|lpx|%)) *$/);null!==n&&t.properties.set("backgroundImagePosition",new Map([["x",`'${n[1]}'`],["y",`'${n[4]}'`]]))}],[n("opacity"),c("opacity")],[n("visibility"),u("visibility","Visibility.")],[n("enabled"),l("enabled")],[n("font-color"),h("font-color")],[n("font-size"),a("font-size")],[n("font-style"),u("font-style","FontStyle.")],[n("font-weight"),function(e,t){const r=e.getProperty("font-weight");if(s(r))return;const n=I(r);t.properties.set("fontWeight",n)}],[n("font-family"),a("font-family")],[function(e){return e.hasProperty("margin")||e.hasProperty("margin-left")||e.hasProperty("margin-top")||e.hasProperty("margin-right")||e.hasProperty("margin-bottom")},function(e,t){var r,n,o,i;const a=new Map,s=e.getProperty("margin"),c=null!==(r=e.getProperty("margin-top"))&&void 0!==r?r:s,l=null!==(n=e.getProperty("margin-bottom"))&&void 0!==n?n:s,u=null!==(o=e.getProperty("margin-left"))&&void 0!==o?o:s,p=null!==(i=e.getProperty("margin-right"))&&void 0!==i?i:s,f=e.property.has("margin-top"),d=e.property.has("margin-bottom"),y=e.property.has("margin-left"),h=e.property.has("margin-right"),m=e.dynamicProperty.has("margin"),g=e.dynamicProperty.has("margin-top"),E=e.dynamicProperty.has("margin-bottom"),v=e.dynamicProperty.has("margin-left"),S=e.dynamicProperty.has("margin-right");T("top",c,a,g||!f&&m),T("bottom",l,a,E||!d&&m),T("left",u,a,v||!y&&m),T("right",p,a,S||!h&&m),a.size>0&&t.properties.set("margin",a)}],[function(e){return e.hasProperty("padding")||e.hasProperty("padding-left")||e.hasProperty("padding-top")||e.hasProperty("padding-right")||e.hasProperty("padding-bottom")},function(e,t){var r,n,o,i;const a=new Map,s=e.getProperty("padding"),c=null!==(r=e.getProperty("padding-top"))&&void 0!==r?r:s,l=null!==(n=e.getProperty("padding-bottom"))&&void 0!==n?n:s,u=null!==(o=e.getProperty("padding-left"))&&void 0!==o?o:s,p=null!==(i=e.getProperty("padding-right"))&&void 0!==i?i:s,f=e.property.has("padding-top"),d=e.property.has("padding-bottom"),y=e.property.has("padding-left"),h=e.property.has("padding-right"),m=e.dynamicProperty.has("padding"),g=e.dynamicProperty.has("padding-top"),E=e.dynamicProperty.has("padding-bottom"),v=e.dynamicProperty.has("padding-left"),S=e.dynamicProperty.has("padding-right");T("top",c,a,g||!f&&m),T("bottom",l,a,E||!d&&m),T("left",u,a,v||!y&&m),T("right",p,a,S||!h&&m),a.size>0&&t.properties.set("padding",a)}],[o("button","label"),function(e,t){const r=e.dynamicProperty.get("label");if(!s(r))return void t.setParams(P(r));const n=e.property.get("label");"string"==typeof n&&t.setParams(`\`${n}\``)}],[o("button","type"),u("type","ButtonType.")],[o("button","state-effect"),l("state-effect")],[o("divider","vertical"),l("vertical")],[o("divider","color"),h("color")],[o("divider","stroke-width"),a("stroke-width")],[o("divider","line-cap"),u("line-cap","LineCapStyle.")],[_("image"),function(e,t){var r;const n=e.dynamicProperty.get("src");if(!s(n))return void t.setParams(n);const o=null!==(r=e.property.get("src"))&&void 0!==r?r:"";t.setParams(N(o))}],[o("image","alt"),a("alt")],[o("image","object-fit"),u("object-fit","ImageFit.")],[o("image","object-repeat"),u("object-repeat","ImageRepeat.")],[o("image","interpolation"),u("interpolation","ImageInterpolation.")],[o("image","render-mode"),u("render-mode","ImageRenderMode.")],[function(e){return e.hasProperty("source-size-width")||e.hasProperty("source-size-height")},function(e,t){let r=e.getProperty("source-size-width"),n=e.getProperty("source-size-height");if(s(r)&&s(n))return;const o=e.dynamicProperty.has("source-size-width"),i=e.dynamicProperty.has("source-size-height");r="0"===r||s(r)?"0":o?r:r.substring(0,r.length-2),n="0"===n||s(n)?"0":i?n:n.substring(0,n.length-2);const a=new Map([["width",r],["height",n]]);t.properties.set("sourceSize",a)}],[function(e){return"progress"===e.type&&(e.hasProperty("value")||e.hasProperty("total")||e.hasProperty("style"))},function(e,t){var r;p("value",e,t)||t.params instanceof Map&&t.params.set("value",null!==(r=e.getProperty("value"))&&void 0!==r?r:"0")}],[o("progress","total"),d("total")],[o("progress","style"),y("style","ProgressStyle.")],[o("progress","color"),h("color")],[o("slider","value"),d("value")],[o("slider","min"),d("min")],[o("slider","max"),d("max")],[o("slider","step"),d("step")],[o("slider","style"),y("style","SliderStyle.")],[o("slider","block-color"),h("block-color")],[o("slider","track-color"),h("track-color")],[o("slider","selected-color"),h("selected-color")],[o("slider","show-steps"),l("show-steps")],[o("slider","show-tips"),l("show-tips")],[o("text","content"),function(e,t){const r=e.property.get("content"),n=e.dynamicProperty.get("content");s(n)?"string"==typeof r&&t.setParams(`\`${r}\``):t.setParams(P(n))}],[o("text","text-align"),u("text-align","TextAlign.")],[o("text","text-overflow"),function(e,t){const r=e.dynamicProperty.get("text-overflow");if(!s(r))return void t.properties.set("textOverflow",new Map([["overflow",r]]));const n=e.property.get("text-overflow");s(n)||t.properties.set("textOverflow",new Map([["overflow","TextOverflow."+m(n)]]))}],[o("text","max-lines"),c("max-lines")],[o("text","line-height"),a("line-height")],[function(e){return"text"===e.type&&(e.hasProperty("decoration-type")||e.hasProperty("decoration-color"))},function(e,t){const r=e.property.get("decoration-type"),n=e.dynamicProperty.get("decoration-type"),o=e.property.get("decoration-color"),i=e.dynamicProperty.get("decoration-color");if(s(r)&&s(o)&&s(n)&&s(i))return;const a=new Map;s(n)?a.set("type",s(r)?"TextDecorationType.None":E("TextDecorationType.",r)):a.set("type",n),t.properties.set("decoration",a),s(i)?s(o)||a.set("color",v(o)):a.set("color",i)}],[o("text","baseline-offset"),a("baseline-offset")],[o("text","text-case"),u("text-case","TextCase.")],[o("column","space"),f("space")],[o("column","align-items-column"),function(e,t){const r=e.dynamicProperty.get("align-items-column");if(!s(r))return void t.properties.set("alignItems",r);const n=e.property.get("align-items-column");if(s(n))return;const o=R(n);t.properties.set("alignItems",o)}],[o("row","space"),f("space")],[o("row","align-items-row"),function(e,t){const r=e.dynamicProperty.get("align-items-row");if(!s(r))return void t.properties.set("alignItems",r);const n=e.property.get("align-items-row");if(s(n))return;const o=b(n);t.properties.set("alignItems",o)}],[o("flex","flex-direction"),function(e,t){if(!(t.params instanceof Map))return;const r=e.dynamicProperty.get("flex-direction");if(!s(r))return void t.params.set("direction",r);const n=e.property.get("flex-direction");s(n)||t.params.set("direction",E("FlexDirection.",n))}],[o("flex","wrap"),function(e,t){if(!(t.params instanceof Map))return;const r=e.dynamicProperty.get("wrap");if(!s(r))return void t.params.set("wrap",r);const n=e.property.get("wrap");if(s(n))return;const o=w(n);t.params.set("wrap",o)}],[o("flex","justify-content"),S("justify-content","FlexAlign.")],[o("flex","align-items-flex"),function(e,t){if(!(t.params instanceof Map))return;const r=e.dynamicProperty.get("align-items-flex");if(!s(r))return void t.params.set("alignItems",r);const n=e.property.get("align-items-flex");if(s(n))return;const o=C(n);t.params.set("alignItems",o)}],[o("flex","align-content"),S("align-content","FlexAlign.")],[o("list","space-list"),function(e,t){const r=e.dynamicProperty.get("space-list");if(void 0!==r&&""!==r.trim()&&t.params instanceof Map)return void t.params.set("space",r);const n=e.getProperty("space-list");!s(n)&&t.params instanceof Map&&t.params.set("space",n)}],[o("list","initial-index"),d("initial-index")],[o("list","list-direction"),u("list-direction","Axis.")],[function(e){return"list"===e.type&&(e.hasProperty("divider-stroke-width")||e.hasProperty("divider-color")||e.hasProperty("divider-start-margin")||e.hasProperty("divider-end-margin"))},function(e,t){const r=e.property.get("divider-stroke-width"),n=e.dynamicProperty.get("divider-stroke-width"),o=new Map([["strokeWidth",`'${null!=r?r:"0"}'`]]);s(n)||o.set("strokeWidth",n);const i=e.property.get("divider-color"),a=e.dynamicProperty.get("divider-color"),c=e.property.get("divider-start-margin"),l=e.dynamicProperty.get("divider-start-margin"),u=e.property.get("divider-end-margin"),p=e.dynamicProperty.get("divider-end-margin");s(a)?s(i)||o.set("color",v(i)):o.set("color",a),s(l)?s(c)||o.set("startMargin",`'${c}'`):o.set("startMargin",l),s(p)?s(u)||o.set("endMargin",`'${u}'`):o.set("endMargin",p),t.properties.set("divider",o)}],[o("list","edit-mode"),l("edit-mode")],[o("list","edge-effect"),u("edge-effect","EdgeEffect.")],[o("list","chain-animation"),l("chain-animation")],[o("list-item","sticky"),u("sticky","Sticky.")],[o("list-item","editable"),l("editable")],[o("swiper","index"),c("index")],[o("swiper","auto-play"),l("auto-play")],[o("swiper","interval"),c("interval")],[o("swiper","indicator"),l("indicator")],[o("swiper","loop"),l("loop")],[o("swiper","duration"),c("duration")],[o("swiper","vertical"),l("vertical")],[o("swiper","item-space"),a("item-space")],[o("swiper","cached-count"),c("cached-count")],[o("swiper","disable-swipe"),l("disable-swipe")],[o("text-input","placeholder"),f("placeholder")],[o("text-input","textInput-type"),function(e,t){const r=e.dynamicProperty.get("textInput-type");if(!s(r))return void t.properties.set("type",r);const n=e.property.get("textInput-type");s(n)||t.properties.set("type","InputType."+n)}],[o("text-input","placeholderColor"),h("placeholderColor")],[function(e){return"text-input"===e.type&&(e.hasProperty("placeholderFont-size")||e.hasProperty("placeholderFont-weight")||e.hasProperty("placeholderFont-family")||e.hasProperty("placeholderFont-style"))},function(e,t){const r=e.property.get("placeholderFont-size"),n=e.dynamicProperty.get("placeholderFont-size"),o=e.property.get("placeholderFont-weight"),i=e.dynamicProperty.get("placeholderFont-weight"),a=e.property.get("placeholderFont-family"),c=e.dynamicProperty.get("placeholderFont-family"),l=e.property.get("placeholderFont-style"),u=e.dynamicProperty.get("placeholderFont-style"),p=new Map;s(n)?p.set("size",s(r)?30:parseInt(r)):p.set("size",n),s(i)?s(o)?p.set("weight",400):p.set("weight",isNaN(Number(o))?E("FontWeight.",o):o):p.set("weight",i),s(c)?p.set("family",s(a)?"'sans-serif'":`'${a}'`):p.set("family",c),s(u)?p.set("style",s(l)?"FontStyle.Normal":E("FontStyle.",l)):p.set("style",u),t.properties.set("placeholderFont",p)}],[o("text-input","enterKeyType"),u("enterKeyType","EnterKeyType.")],[o("text-input","caretColor"),h("caretColor")],[o("text-input","maxLength"),c("maxLength")]]},243:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Style=t.Tag=void 0;const n=r(117);class o extends n.ASTNode{constructor(e,t,r){super(),this.tagName=e,this.attributes=t,this.content=r}}t.Tag=o;class i extends n.ASTNode{constructor(e,t,r,n){super(),this.mediaQuery=void 0,this.kind=e,this.name=t,this.content=r,this.mediaQuery=n}}t.Style=i},573:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ASTNodeGenerator=void 0;const n=r(243),o=r(334);class i{constructor(e){this.cache=e}visit(e){e instanceof n.Tag?this.genTag(e):e instanceof n.Style&&this.genStyle(e)}static getMethodGen(e){return void 0===i.instance?i.instance=new i(e):i.instance.setCache(e),i.instance}setCache(e){this.cache=e}genTag(e){if(this.cache.concat(o.TokenClass.TAG_START,e.tagName),this.cache.indentOff(),e.attributes.forEach(((e,t)=>{let r="";for(const t of e)r+='"'===t?""":"\n"===t?" ":t;this.cache.concat(o.TokenClass.SPACE,t,o.TokenClass.ASSIGN,o.TokenClass.LQUOTE,r,o.TokenClass.RQUOTE)})),null===e.content)this.cache.concat(o.TokenClass.EMPTY_TAG_END);else{if(this.cache.concat(o.TokenClass.TAG_END),"string"==typeof e.content){let t="";for(const r of e.content)t+="<"===r?"<":r;this.cache.concat(t)}else 0!==e.content.length&&(this.cache.concat(o.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent(),e.content.forEach((e=>{e.accept(this),this.cache.indentOff(),this.cache.concat(o.TokenClass.NEW_LINE),this.cache.indentOn()})),this.cache.decIndent(),this.cache.indentOn());this.cache.concat(o.TokenClass.END_TAG_START,e.tagName,o.TokenClass.TAG_END)}}genStyle(e){void 0!==e.mediaQuery&&(this.cache.concat("@media"),this.cache.indentOff(),this.cache.concat(o.TokenClass.SPACE,e.mediaQuery,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent()),"IDStyle"===e.kind&&(this.cache.concat(o.TokenClass.ID_STYLE_START),this.cache.indentOff()),this.cache.concat(e.name,o.TokenClass.SPACE,o.TokenClass.LBRA,o.TokenClass.NEW_LINE),this.cache.indentOn(),this.cache.incIndent(),e.content.forEach(((e,t)=>{this.cache.concat(t,o.TokenClass.COLON,o.TokenClass.SPACE,e,o.TokenClass.SEMICOLON,o.TokenClass.NEW_LINE)})),this.cache.decIndent(),this.cache.concat(o.TokenClass.RBRA,o.TokenClass.NEW_LINE),void 0!==e.mediaQuery&&(this.cache.decIndent(),this.cache.concat(o.TokenClass.RBRA,o.TokenClass.NEW_LINE)),this.cache.concat(o.TokenClass.NEW_LINE)}}t.ASTNodeGenerator=i,i.instance=void 0},844:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CSSBridge=t.HMLBridge=void 0;const n=r(243),o=r(571);t.HMLBridge=class{constructor(){this.errors=0}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}visit(e){const t=new Map([["id",e.id]]);let r="";for(let[n,i]of e.property)(0,o.isAttribute)(n,e.type)?("string"!=typeof i&&(i=JSON.stringify(i)),t.set(n,i)):(0,o.isContent)(n)&&(r=i);if(e.children.length>0){r=[];for(const t of e.children)r.push(t.accept(this))}const i=new n.Tag(e.type,t,r);return"wrapper"===t.get("id")?new n.Tag("div",new Map,[i]):i}},t.CSSBridge=class{constructor(){this.errors=0,this.styles=[]}error(e){console.error("Code generating error: "+e),this.errors+=1}getErrorCount(){return this.errors}genIDStyle(e){var t;const r=t=>{const r=new Map;for(const[n,i]of t)(0,o.isStyle)(n,e.type)&&r.set(n,i);return r},i=r(e.property);i.size>0&&this.styles.push(new n.Style("IDStyle",e.id,i)),(null!==(t=e.mediaProperty)&&void 0!==t?t:new Map).forEach(((t,o)=>{const i=r(t);i.size>0&&this.styles.push(new n.Style("IDStyle",e.id,i,o))}));for(const t of e.children)t.accept(this)}visit(e){return this.genIDStyle(e),this.styles}}},55:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.genFACSS=t.genFAHML=void 0;const n=r(573),o=r(862);t.genFAHML=function(e){const t=n.ASTNodeGenerator.getMethodGen(new o.Cache(" "));return e.accept(t),t.cache.toString()},t.genFACSS=function(e){const t=n.ASTNodeGenerator.getMethodGen(new o.Cache(" "));return e.forEach((e=>{e.accept(t)})),t.cache.toString()}},571:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isEvent=t.isData=t.isUnknown=t.isContent=t.isAttribute=t.isStyle=t.styleMap=void 0;const n=r(904),o=["width","height","min-width","min-height","max-width","max-height","padding","padding-start","padding-end","padding-top","padding-right","padding-bottom","padding-left","margin","margin-start","margin-end","margin-top","margin-right","margin-bottom","margin-left","border-width","border-style","border-color","border-radius","border-top-width","border-top-style","border-top-color","border-top-left-radius","border-right-width","border-right-style","border-right-color","border-top-right-radius","border-bottom-width","border-bottom-style","border-bottom-color","border-bottom-right-radius","border-left-width","border-left-style","border-left-color","border-bottom-left-radius","background-color","background","background-image","background-size","background-position","background-repeat","display","opacity","visibility","flex","flex-grow","flex-shrink","flex-basis","position","display","top","right","bottom","left","display-index","flex-weight","aspect-ratio"],i=["font-size","font-family","font-style","font-weight"],a=["text-align","line-height","text-decoration","letter-spacing","max-lines","text-overflow","allow-scale","min-font-size","max-font-size","font-size-step","prefer-font-sizes","color",...i],s=["allow-scale","text-decoration","color",...i],c=["text-color","allow-scale","icon-width","icon-height","radius",...i],l=["texton-color","textoff-color","text-padding","allow-scale",...i],u=["column-height","text-color","allow-scale","letter-spacing","text-decoration","line-height","opacity",...i],p=["text-color","allow-scale","letter-spacing",...i];t.styleMap=new Map([["common",new Set([...o])],["div",new Set(["flex-direction","overflow","flex-wrap","justify-content","align-items","align-content","grid-template-columns","grid-template-rows","grid-row-start","grid-row-end","grid-column-start","grid-column-end","grid-gap","grid-columns-gap","grid-rows-gap"])],["text",new Set([...a])],["image",new Set(["object-fit","match-text-direction","fit-original-size"])],["span",new Set([...s])],["input",new Set(["font-size","font-family","font-weight","color","placeholder-color","allow-scale"])],["button",new Set([...c])],["switch",new Set([...l])],["refresh",new Set(["progress-color"])],["divider",new Set(["stroke-width","line-cap","color"])],["chart",new Set(["stroke-width","radius","start-angle","total-angle","center-x","center-y","colors","weights"])],["picker",new Set([...u])],["picker-view",new Set(["color","font-size","selected-color","selected-font-size","focus-color","focus-font-size","disappear-color","disappear-font-size","font-family"])],["slider",new Set(["color","selected-color","block-color"])],["swiper",new Set(["indicator-color","indicator-selected-color","indicator-size","indicator-top","indicator-right","indicator-bottom","indicator-left"])],["list",new Set(["flex-direction","columns","item-extent","fade-color"])],["list-item",new Set(["column-span"])],["progress",new Set(["color","stroke-width","background-color","secondary-color","scale-width","scale-number","start-angle","total-angle","center-x","center-y","radius"])],["select",new Set(["font-family"])],["menu",new Set([...p])],["option",new Set(["color","font-family","allow-scale","font-size","font-weight","text-decoration"])],["video",new Set(["object-fit"])],["clock",new Set(["font-family"])]]);const f=new Map([["common",new Set(["id","ref","disabled","focusable","data","if","for"])],["image",new Set(["src","alt"])],["button",new Set(["type","value","icon","waiting"])],["refresh",new Set(["offset","refreshing","type","lasttime","friction"])],["input",new Set(["type","checked","name","value","placeholder","maxlength","enterkeytype","headericon"])],["switch",new Set(["checked","showtext","texton","textoff"])],["option",new Set(["value","selected","icon"])],["chart",new Set(["type","percent","datasets","options"])],["picker",new Set(["type","range","selected","start","end","lunar","lunarSwitch","columns","hours","containSecond","value","vibrate"])],["picker-view",new Set(["type","range","selected","start","end","lunar","lunarSwitch","columns","hours","containSecond","indicatorprefix","indicatorsuffix","vibrate"])],["slider",new Set(["min","max","step","showtips","showsteps","mode","value"])],["divider",new Set(["vertical"])],["list",new Set(["scrollpage","cachedcount","scrollbar","scrolleffect","shapemode","indexer","itemscale","itemcenter","updateeffect","scrollvibrate","initialindex","initialoffset"])],["list-item",new Set(["type","primary","section","sticky","stickyradius","clickeffect"])],["swiper",new Set(["index","autoplay","interval","indicator","digital","indicatordisabled","loop","duration","vertical"])],["progress",new Set(["type","percent","secondarypercent","clockwise"])],["menu",new Set(["target","title","type"])],["clock",new Set(["clockconfig","showdigit","hourswest"])],["badge",new Set(["placement","count","visible","maxcount","config","label"])],["video",new Set(["muted","src","autoplay","poster","controls","loop","starttime","direction","speed"])],["tabs",new Set(["index","vertical"])],["tab-bar",new Set(["mode"])],["tab-content",new Set(["scrollable"])]]),d=new Map([["common",new Set(["ontouchstart","ontouchmove","ontouchcancel","ontouchend","onclick","onlongpress","onfocus","onblur","onkey","onswipe"])],["image",new Set(["oncomplete","onerror"])],["input",new Set(["onchange","onenterkeyclick"])],["select",new Set(["onchange"])],["refresh",new Set(["onrefresh","onpulldown"])],["swiper",new Set(["onchange","onrotation"])],["list",new Set(["onindexerchange","onscroll","onscrollbottom","onscrolltop","onscrollend","onscrolltouchup","onrequestitem"])],["list-item",new Set(["onsticky"])],["menu",new Set(["onselected","oncancel"])],["picker",new Set(["oncolumnchange","onchange","oncancel"])],["picker-view",new Set(["oncolumnchange","onchange"])],["video",new Set(["onprepared","onstart","onpause","onfinish","onerror","onseeking","onseeked","ontimeupdate","onfullscreenchange","onstop"])],["tabs",new Set(["onchange"])],["switch",new Set(["onchange"])],["dialog",new Set(["oncancel"])]]),y=new Map([["common",new Set(["onClick","onTouch","onAppear","onDisappear","onKeyEvent","onAreaChange"])],["image",new Set(["onComplete","onError","onFinish"])],["swiper",new Set(["onChange"])],["list",new Set(["onItemDelete","onScrollIndex","onItemDragEnter","onItemDragMove","onItemDragLeave","onItemDragStart","onItemDrop"])],["text-input",new Set(["onChange","onSubmit","onEditChanged"])]]);function h(e,t,r){const n=t.get(r);return void 0!==n&&n.has(e)}function m(e,r){return h(e,t.styleMap,"common")||h(e,t.styleMap,r)}function g(e,t){return(0,n.getDomain)()===n.Domain.ETS?h(e,y,"common")||h(e,y,t):E(e,t)||v(e,t)}function E(e,t){return h(e,f,"common")||h(e,f,t)}function v(e,t){return h(e,d,"common")||h(e,d,t)}t.isStyle=m,t.isAttribute=g,t.isContent=function(e){return"content"===e},t.isUnknown=function(e,t){return!m(e,t)&&!g(e,t)},t.isData=E,t.isEvent=v},334:(e,t)=>{"use strict";var r;Object.defineProperty(t,"__esModule",{value:!0}),t.TokenClass=void 0,(r=t.TokenClass||(t.TokenClass={}))[r.IDENTIFIER=0]="IDENTIFIER",r[r.STRING_LITERAL=1]="STRING_LITERAL",r[r.NUMBER=2]="NUMBER",r[r.CHARACTER=3]="CHARACTER",r[r.EOF=4]="EOF",r[r.INVALID=5]="INVALID",r.EMPTY_DATA="empty",r.ASSIGN="=",r.NEW_LINE="\n",r.CARRIAGE_RETURN="\r",r.INDENT=" ",r.SPACE=" ",r.LQUOTE='"',r.RQUOTE='"',r.TAG_START="<",r.TAG_END=">",r.EMPTY_TAG_END="/>",r.END_TAG_START="{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.etsPropertyList=void 0;const n=r(958),o=r(513),i=["vp","px","%","lpx"],a=[{propertySector:o.Sector.FEATURE,propertySet:{name:"FontSize",property:"font-size-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:["fp","px","lpx"]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"FontStyle",property:"font-style-visual",type:o.TypeName.SELECT,etsType:o.EtsType.FONT_STYLE,list:[o.CLEAN_VALUE_NODE,{name:"Normal",value:"normal"},{name:"Italic",value:"italic"}],defaults:"normal"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"FontColor",property:"font-color-visual",type:o.TypeName.COLOR,etsType:o.EtsType.COMB_COLOR}},{propertySector:o.Sector.FEATURE,propertySet:{name:"FontWeight",property:"font-weight-visual",type:o.TypeName.SELECT,etsType:`${o.EtsType.FONT_WEIGHT}|${o.EtsType.NUMBER}`,list:[o.CLEAN_VALUE_NODE,{name:"Normal",value:"normal"},{name:"Lighter",value:"lighter"},{name:"Regular",value:"regular"},{name:"Medium",value:"medium"},{name:"Bold",value:"bold"},{name:"Bolder",value:"bolder"},{value:"100"},{value:"200"},{value:"300"},{value:"400"},{value:"500"},{value:"600"},{value:"700"},{value:"800"},{value:"900"}],defaults:"normal"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"TextAlign",property:"text-align-visual",type:o.TypeName.SELECT,etsType:o.EtsType.TEXT_ALIGN,list:[o.CLEAN_VALUE_NODE,{name:"Start",value:"start"},{name:"Center",value:"center"},{name:"End",value:"end"}],defaults:"start"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"LineHeight",property:"line-height-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:["fp","px","lpx"]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"TextOverflow",property:"text-overflow-visual",type:o.TypeName.SELECT,etsType:o.EtsType.TEXT_OVERFLOW,list:[o.CLEAN_VALUE_NODE,{name:"Clip",value:"clip"},{name:"Ellipsis",value:"ellipsis"},{name:"None",value:"none"}],defaults:"clip"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"BaselineOffset",property:"baseline-offset-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:["fp","px","lpx"]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"DecorationType",property:"decoration-type-visual",type:o.TypeName.SELECT,etsType:o.EtsType.TEXT_DECORATION_TYPE,list:[o.CLEAN_VALUE_NODE,{name:"Underline",value:"underline"},{name:"LineThrough",value:"line-through"},{name:"Overline",value:"overline"},{name:"None",value:"none"}],defaults:"none"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"DecorationColor",property:"decoration-color-visual",type:o.TypeName.COLOR,etsType:o.EtsType.COMB_COLOR}},{propertySector:o.Sector.FEATURE,propertySet:{name:"TextCase",property:"text-case-visual",type:o.TypeName.SELECT,etsType:o.EtsType.TEXT_CASE,list:[o.CLEAN_VALUE_NODE,{value:"Normal"},{value:"LowerCase"},{value:"UpperCase"}],defaults:"Normal"}},{propertySector:o.Sector.GENERAL,propertySet:{name:"ForEach",property:"for-visual",type:o.TypeName.BASE,etsType:o.EtsType.ARRAY,defaults:""}},{propertySector:o.Sector.GENERAL,propertySet:{name:"KeyGenerator",property:"keyGenerator-visual",type:o.TypeName.BASE,etsType:"Event",defaults:""}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Item",property:"item-visual",type:o.TypeName.BASE,info:"Variable Name for Item of ForEach Array"}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Idx",property:"idx-visual",type:o.TypeName.BASE,info:"Variable Name for Index of Corresponding Item In ForEach Array"}}],s=[{propertySector:o.Sector.FEATURE,propertySet:{name:"Placeholder",property:"placeholder-visual",type:o.TypeName.BASE,etsType:o.EtsType.COMB_CONTENT,defaults:""}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Type",property:"textInput-type-visual",type:o.TypeName.SELECT,etsType:o.EtsType.INPUT_TYPE,list:[o.CLEAN_VALUE_NODE,{value:"Normal"},{value:"Password"},{value:"Email"},{value:"Number"}],defaults:"Normal"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"PlaceholderColor",property:"placeholderColor-visual",type:o.TypeName.COLOR,etsType:o.EtsType.COMB_COLOR}},{propertySector:o.Sector.FEATURE,propertySet:{name:"PlaceholderFontSize",property:"placeholderFont-size-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_LENGTH,units:["fp"]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"PlaceholderFontWeight",property:"placeholderFont-weight-visual",type:o.TypeName.SELECT,etsType:`${o.EtsType.FONT_WEIGHT}|${o.EtsType.NUMBER}`,list:[o.CLEAN_VALUE_NODE,{value:"Normal"},{value:"Lighter"},{value:"Regular"},{value:"Medium"},{value:"Bold"},{value:"Bolder"},{value:"100"},{value:"200"},{value:"300"},{value:"400"},{value:"500"},{value:"600"},{value:"700"},{value:"800"},{value:"900"}],defaults:"400"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"PlaceholderFontFamily",property:"placeholderFont-family-visual",type:o.TypeName.BASE,etsType:o.EtsType.STRING,defaults:""}},{propertySector:o.Sector.FEATURE,propertySet:{name:"PlaceholderFontStyle",property:"placeholderFont-style-visual",type:o.TypeName.SELECT,etsType:o.EtsType.FONT_STYLE,list:[o.CLEAN_VALUE_NODE,{value:"Normal"},{value:"Italic"}],defaults:"Normal"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"EnterKeyType",property:"enterKeyType-visual",type:o.TypeName.SELECT,etsType:o.EtsType.ENTER_KEY_TYPE,list:[o.CLEAN_VALUE_NODE,{value:"Go"},{value:"Search"},{value:"Send"},{value:"Next"},{value:"Done"}],defaults:"Done"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"CaretColor",property:"caretColor-visual",type:o.TypeName.COLOR,etsType:o.EtsType.COMB_COLOR}},{propertySector:o.Sector.FEATURE,propertySet:{name:"MaxLength",property:"maxLength-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.NUMBER}}],c={type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:["vp","px","lpx"],placeholder:"0vp"},l=[{propertySector:o.Sector.GENERAL,propertySet:{name:"Width",property:"width-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Height",property:"height-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.GENERAL,propertySet:{name:"MinWidth",property:"constraint-size-min-width-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.GENERAL,propertySet:{name:"MinHeight",property:"constraint-size-min-height-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.GENERAL,propertySet:{name:"MaxWidth",property:"constraint-size-max-width-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.GENERAL,propertySet:{name:"MaxHeight",property:"constraint-size-max-height-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"Margin",property:"margin-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"Padding",property:"padding-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"MarginTop",property:"margin-top-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"MarginRight",property:"margin-right-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"MarginBottom",property:"margin-bottom-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"MarginLeft",property:"margin-left-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"PaddingTop",property:"padding-top-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"PaddingRight",property:"padding-right-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"PaddingBottom",property:"padding-bottom-visual"},c)},{propertySector:o.Sector.DIMENSION,propertySet:Object.assign({name:"PaddingLeft",property:"padding-left-visual"},c)}],u={type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i},p={type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_LENGTH,units:i},f=[{propertySector:o.Sector.DIMENSION,propertySet:{name:"Border",property:"border-visual",type:o.TypeName.COMPOSITE,detached:1,properties:[Object.assign({name:"Width",property:"border-width-visual"},u),Object.assign({name:"Style",property:"border-style-visual"},o.commonParamsForBorder),{name:"Color",property:"border-color-visual",type:o.TypeName.COLOR,etsType:o.EtsType.COMB_COLOR},Object.assign({name:"Radius",property:"border-radius-visual"},p)]}}],d=[{propertySector:o.Sector.FEATURE,propertySet:Object.assign({name:"Vertical",property:"vertical-visual"},o.commonParamsForJudge)},{propertySector:o.Sector.FEATURE,propertySet:{name:"LineCap",property:"line-cap-visual",type:o.TypeName.SELECT,etsType:o.EtsType.LINE_CAP_STYLE,defaults:"butt",list:[o.CLEAN_VALUE_NODE,{name:"Butt",value:"butt"},{name:"Round",value:"round"},{name:"Square",value:"square"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"StrokeWidth",property:"stroke-width-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_LENGTH,units:i}}],y=[{propertySector:o.Sector.FEATURE,propertySet:{name:"InitialIndex",property:"initial-index-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.NUMBER}},{propertySector:o.Sector.FEATURE,propertySet:{name:"ListDirection",property:"list-direction-visual",type:o.TypeName.SELECT,etsType:o.EtsType.AXIS,list:[o.CLEAN_VALUE_NODE,{name:"Vertical",value:"vertical"},{name:"Horizontal",value:"horizontal"}],defaults:"vertical"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Color",property:"divider-color-visual",type:o.TypeName.COLOR,etsType:o.EtsType.COMB_COLOR}},{propertySector:o.Sector.FEATURE,propertySet:{name:"StrokeWidth",property:"divider-stroke-width-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_LENGTH,units:i}},{propertySector:o.Sector.FEATURE,propertySet:{name:"StartMargin",property:"divider-start-margin-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.FEATURE,propertySet:{name:"EndMargin",property:"divider-end-margin-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,units:i}},{propertySector:o.Sector.FEATURE,propertySet:{name:"EditMode",property:"edit-mode-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BOOLEAN,list:[o.CLEAN_VALUE_NODE,{name:"true",value:"true"},{name:"false",value:"false"}],defaults:"false"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"EdgeEffect",property:"edge-effect-visual",type:o.TypeName.SELECT,etsType:o.EtsType.EDGE_EFFECT,list:[o.CLEAN_VALUE_NODE,{name:"Spring",value:"spring"},{name:"None",value:"none"}],defaults:"spring"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"ChainAnimation",property:"chain-animation-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BOOLEAN,list:[o.CLEAN_VALUE_NODE,{name:"true",value:"true"},{name:"false",value:"false"}],defaults:"false"}}],h=[{propertySector:o.Sector.FEATURE,propertySet:{name:"Sticky",property:"sticky-visual",type:o.TypeName.SELECT,etsType:o.EtsType.STICKY,list:[o.CLEAN_VALUE_NODE,{name:"None",value:"none"},{name:"Normal",value:"normal"}],defaults:"none"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Editable",property:"editable-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BOOLEAN,list:[o.CLEAN_VALUE_NODE,{name:"true",value:"true"},{name:"false",value:"false"}],defaults:"false"}}],m=[{propertySector:o.Sector.GENERAL,propertySet:{name:"BackgroundImageSrc",property:"background-image-src-visual",type:o.TypeName.BASE,etsType:o.EtsType.STRING}},{propertySector:o.Sector.GENERAL,propertySet:{name:"BackgroundImageRepeat",property:"background-image-repeat-visual",type:o.TypeName.SELECT,etsType:o.EtsType.IMAGE_REPERT,list:[o.CLEAN_VALUE_NODE,{name:"X",value:"repeat-x"},{name:"Y",value:"repeat-y"},{name:"XY",value:"repeat"},{name:"NoRepeat",value:"no-repeat"}]}},{propertySector:o.Sector.GENERAL,propertySet:{name:"BackgroundImageSize",property:"background-image-size-visual",type:o.TypeName.DATA_SELECT_INPUT,etsType:`${o.EtsType.IMAGE_SIZE}|${o.EtsType.STRING}`,list:[o.CLEAN_VALUE_NODE,{name:"Cover",value:"cover"},{name:"Contain",value:"contain"},{name:"Auto",value:"auto"}],defaults:"Auto"}},{propertySector:o.Sector.GENERAL,propertySet:{name:"BackgroundImagePosition",property:"background-image-position-visual",type:o.TypeName.DATA_SELECT_INPUT,etsType:`${o.EtsType.ALIGNMENT}|${o.EtsType.STRING}`,list:[o.CLEAN_VALUE_NODE,{name:"TopStart",value:"top left"},{name:"Top",value:"top center"},{name:"TopEnd",value:"top right"},{name:"Start",value:"center left"},{name:"Center",value:"center center"},{name:"End",value:"center right"},{name:"BottomStart",value:"bottom left"},{name:"Bottom",value:"bottom center"},{name:"BottomEnd",value:"bottom right"}],defaults:"0 0"}}],g=[{propertySector:o.Sector.GENERAL,propertySet:{name:"Location",property:"position-visual",type:o.TypeName.SELECT,defaults:"offset",list:[o.CLEAN_VALUE_NODE,{name:"offset",value:"relative"},{name:"position",value:"absolute"}]}},{propertySector:o.Sector.GENERAL,propertySet:{name:"X",property:"left-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,defaults:0,units:["vp","px","lpx"]}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Y",property:"top-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_R_LENGTH,defaults:0,units:["vp","px","lpx"]}}],E=[{propertySector:o.Sector.FLEX,propertySet:{name:"FlexBasis",property:"flex-basis-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_LENGTH,units:i,defaults:"auto",fixedValues:["auto"],info:"The initial main size of a flex item. It sets the size of the content box otherwise set with box-sizing."}},{propertySector:o.Sector.FLEX,propertySet:{name:"AlignSelf",property:"align-self-visual",type:o.TypeName.SELECT,etsType:o.EtsType.ITEM_ALIGN,defaults:"auto",list:[o.CLEAN_VALUE_NODE,{name:"Auto",value:"auto"},{name:"Start",value:"flex-start"},{name:"Center",value:"center"},{name:"End",value:"flex-end"},{name:"Stretch",value:"stretch"},{name:"Baseline",value:"baseline"}],info:"The alignment of items on the Cross Axis."}},{propertySector:o.Sector.FLEX,propertySet:{name:"Direction",property:"flex-direction-visual",type:o.TypeName.SELECT,etsType:o.EtsType.FLEX_DIRECTION,defaults:"row",list:[o.CLEAN_VALUE_NODE,{name:"Row",value:"row"},{name:"RowReverse",value:"row-reverse"},{name:"Column",value:"column"},{name:"ColumnReverse",value:"column-reverse"}],info:"The direction of flex."}},{propertySector:o.Sector.FLEX,propertySet:{name:"Wrap",property:"wrap-visual",type:o.TypeName.SELECT,etsType:o.EtsType.FLEX_WRAP,defaults:"nowrap",list:[o.CLEAN_VALUE_NODE,{name:"NoWrap",value:"nowrap"},{name:"Wrap",value:"wrap"},{name:"WrapReverse",value:"wrap-reverse"}],info:"Whether flex items are forced onto one line or multiple lines."}},{propertySector:o.Sector.FLEX,propertySet:{name:"JustifyContent",property:"justify-content-visual",type:o.TypeName.SELECT,etsType:o.EtsType.FLEX_ALIGN,defaults:"flex-start",list:[o.CLEAN_VALUE_NODE,{name:"Start",value:"flex-start"},{name:"Center",value:"center"},{name:"End",value:"flex-end"},{name:"SpaceBetween",value:"space-between"},{name:"SpaceAround",value:"space-around"},{name:"SpaceEvenly",value:"space-evenly"}],info:"Allocate the space between and around the elements along the main axis of the flexible container"}},{propertySector:o.Sector.FLEX,propertySet:{name:"AlignItems",property:"align-items-flex-visual",type:o.TypeName.SELECT,etsType:o.EtsType.ITEM_ALIGN,defaults:"stretch",list:[o.CLEAN_VALUE_NODE,{name:"Auto",value:"auto"},{name:"Start",value:"flex-start"},{name:"Center",value:"center"},{name:"End",value:"flex-end"},{name:"Stretch",value:"stretch"},{name:"Baseline",value:"baseline"}],info:"The alignment of items on the Cross Axis."}},{propertySector:o.Sector.FLEX,propertySet:{name:"AlignContent",property:"align-content-visual",type:o.TypeName.SELECT,etsType:o.EtsType.FLEX_ALIGN,defaults:"flex-start",list:[o.CLEAN_VALUE_NODE,{name:"Start",value:"flex-start"},{name:"Center",value:"center"},{name:"End",value:"flex-end"},{name:"SpaceBetween",value:"space-between"},{name:"SpaceAround",value:"space-around"},{name:"SpaceEvenly",value:"space-evenly"}],info:"Set the distribution of space between and around content items along a flexbox's cross-axis or a grid's block axis."}}],v=[{propertySector:o.Sector.FEATURE,propertySet:Object.assign({name:"AutoPlay",property:"auto-play-visual"},o.commonParamsForJudge)},{propertySector:o.Sector.FEATURE,propertySet:{name:"Interval",property:"interval-visual",type:o.TypeName.BASE,etsType:o.EtsType.NUMBER,defaults:3e3}},{propertySector:o.Sector.FEATURE,propertySet:Object.assign(Object.assign({name:"Loop",property:"loop-visual"},o.commonParamsForJudge),{defaults:!0})},{propertySector:o.Sector.FEATURE,propertySet:{name:"Duration",property:"duration-visual",type:o.TypeName.BASE,etsType:o.EtsType.NUMBER,defaults:400}},{propertySector:o.Sector.FEATURE,propertySet:{name:"ItemSpace",property:"item-space-visual",type:o.TypeName.BASE,etsType:o.EtsType.COMB_LENGTH,defaults:"0"}},{propertySector:o.Sector.FEATURE,propertySet:{name:"CachedCount",property:"cached-count-visual",type:o.TypeName.BASE,etsType:o.EtsType.NUMBER,defaults:1}},{propertySector:o.Sector.FEATURE,propertySet:Object.assign({name:"DisableSwipe",property:"disable-swipe-visual"},o.commonParamsForJudge)},{propertySector:o.Sector.FEATURE,propertySet:{name:"Index",property:"index-visual",type:o.TypeName.BASE,etsType:o.EtsType.NUMBER,defaults:0}},{propertySector:o.Sector.FEATURE,propertySet:Object.assign(Object.assign({name:"Indicator",property:"indicator-visual"},o.commonParamsForJudge),{defaults:!0})}];t.etsPropertyList=[...f,...l,...a,...s,...d,...g,...y,...h,...E,...v,...n.commonPropertyList,...m,{propertySector:o.Sector.ATOMIC,propertySet:{name:"DisplayPriority",property:"display-priority-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.NUMBER}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Visibility",property:"visibility-visual",type:o.TypeName.SELECT,etsType:o.EtsType.VISIBILITY,defaults:"Visibility.None",list:[o.CLEAN_VALUE_NODE,{name:"Visible",value:"visible"},{name:"Hidden",value:"hidden"},{name:"None",value:"none"}]}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Enabled",property:"enabled-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BOOLEAN,defaults:"true",list:[{value:"true"},{value:"false"}]}},{propertySector:o.Sector.GENERAL,propertySet:{name:"Align",property:"align-visual",type:o.TypeName.SELECT,etsType:o.EtsType.ALIGNMENT,defaults:"center",list:[o.CLEAN_VALUE_NODE,{name:"TopStart",value:"top-start"},{name:"Top",value:"top"},{name:"TopEnd",value:"top-end"},{name:"Start",value:"start"},{name:"Center",value:"center"},{name:"End",value:"end"},{name:"BottomStart",value:"bottom-start"},{name:"Bottom",value:"bottom"},{name:"BottomEnd",value:"bottom-end"}]}},{propertySector:o.Sector.GENERAL,propertySet:{name:"If",property:"if-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BOOLEAN,defaults:"",list:[{name:"true",value:"true"},{name:"false",value:"false"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Space",property:"space-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.COMB_LENGTH,units:["vp","px","lpx"],requires:{"display-visual":["flex","cleanValue"]},info:"Space between any two adjacent child components."}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Space",property:"space-list-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.NUMBER,requires:{"display-visual":["flex","cleanValue"]},info:"Space between any two adjacent child components."}},{propertySector:o.Sector.FEATURE,propertySet:{name:"AlignItems",property:"align-items-row-visual",type:o.TypeName.SELECT,etsType:o.EtsType.VERTICAL_ALIGN,defaults:"center",requires:{"display-visual":["flex","cleanValue"]},list:[o.CLEAN_VALUE_NODE,{value:"flex-start",name:"top",etsEnumValue:"Top"},{value:"flex-end",name:"bottom",etsEnumValue:"End"},{value:"center",name:"center",etsEnumValue:"Center"}],info:"Alignment mode of child components in the vertical direction."}},{propertySector:o.Sector.FEATURE,propertySet:{name:"AlignItems",property:"align-items-column-visual",type:o.TypeName.SELECT,etsType:o.EtsType.HORIZONTAL_ALIGN,defaults:"center",requires:{"display-visual":["flex","cleanValue"]},list:[o.CLEAN_VALUE_NODE,{value:"flex-start",name:"start",etsEnumValue:"Start"},{value:"flex-end",name:"end",etsEnumValue:"End"},{value:"center",name:"center",etsEnumValue:"Center"}],info:"Alignment mode of child components in the horizontal direction."}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Src",property:"src-visual",type:o.TypeName.BASE,etsType:o.EtsType.COMB_SRC}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Alt",property:"alt-visual",type:o.TypeName.BASE,etsType:o.EtsType.COMB_CONTENT}},{propertySector:o.Sector.FEATURE,propertySet:{name:"RenderMode",property:"render-mode-visual",type:o.TypeName.SELECT,etsType:o.EtsType.IMAGE_RENDER_MODE,defaults:"original",list:[o.CLEAN_VALUE_NODE,{name:"Original",value:"original"},{name:"Template",value:"template"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"ObjectRepeat",property:"object-repeat-visual",type:o.TypeName.SELECT,etsType:o.EtsType.IMAGE_REPERT,defaults:"NoRepeat",list:[o.CLEAN_VALUE_NODE,{name:"X",value:"X"},{name:"Y",value:"Y"},{name:"XY",value:"XY"},{name:"NoRepeat",value:"no-repeat"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"ObjectFit",property:"object-fit-visual",type:o.TypeName.SELECT,etsType:o.EtsType.IMAGE_FIT,defaults:"cover",list:[o.CLEAN_VALUE_NODE,{name:"Cover",value:"cover"},{name:"Contain",value:"contain"},{name:"Fill",value:"fill"},{name:"None",value:"none"},{name:"ScaleDown",value:"scale-down"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"InterPolation",property:"interpolation-visual",type:o.TypeName.SELECT,etsType:o.EtsType.IMAGE_INTERPOLATION,defaults:"none",list:[o.CLEAN_VALUE_NODE,{name:"None",value:"none"},{name:"High",value:"high"},{name:"Medium",value:"medium"},{name:"Low",value:"low"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"SourceSizeWidth",property:"source-size-width-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.NUMBER,units:["px"]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"SourceSizeHeight",property:"source-size-height-visual",type:o.TypeName.INTEGER,etsType:o.EtsType.NUMBER,units:["px"]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Type",property:"type-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BUTTON_TYPE,defaults:"capsule",list:[{name:"Normal",value:"normal"},{name:"Capsule",value:"capsule"},{name:"Circle",value:"circle"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"StateEffect",property:"state-effect-visual",type:o.TypeName.SELECT,etsType:o.EtsType.BOOLEAN,defaults:"true",list:[{name:"true",value:"true"},{name:"false",value:"false"}]}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Content",property:"content-visual",type:o.TypeName.ADJUSTABLE,etsType:o.EtsType.COMB_CONTENT}},{propertySector:o.Sector.FEATURE,propertySet:{name:"Label",property:"label-visual",type:o.TypeName.ADJUSTABLE,etsType:o.EtsType.COMB_CONTENT}}]},958:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.commonPropertyList=void 0;const n=r(513);t.commonPropertyList=[{propertySector:n.Sector.GENERAL,propertySet:{name:"BackgroundColor",property:"background-color-visual",type:n.TypeName.COLOR,etsType:n.EtsType.COMB_COLOR}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Display",property:"display-visual",type:n.TypeName.SELECT,defaults:"flex",list:[n.CLEAN_VALUE_NODE,{value:"flex"},{value:"none"}]}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Opacity",property:"opacity-visual",type:n.TypeName.SLIDER,etsType:n.EtsType.NUMBER,defaults:"1",step:.01,max:1,min:0}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Overflow",property:"overflow-visual",type:n.TypeName.SELECT,defaults:"visible",list:[n.CLEAN_VALUE_NODE,{value:"visible"},{value:"hidden"},{value:"scroll"}]}},{propertySector:n.Sector.FLEX,propertySet:{name:"FlexGrow",property:"flex-grow-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER,defaults:"0",requiresParent:{display:["flex","cleanValue"]},info:"The flex grow factor of a flex item's main size"}},{propertySector:n.Sector.FLEX,propertySet:{name:"FlexShrink",property:"flex-shrink-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER,defaults:"1",requiresParent:{display:["flex","cleanValue"]},info:"The flex shrink factor of a flex item. If the size of all flex items is larger than the flex container, items will shrink"}},{propertySector:n.Sector.FLEX,propertySet:{name:"Columns",property:"columns-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER,defaults:1,info:"The column number of flex."}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Header Logo",property:"headerLogo-visual",type:n.TypeName.BASE,defaults:""}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Title",property:"title-visual",type:n.TypeName.BASE,defaults:""}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Status",property:"status-visual",type:n.TypeName.BASE,defaults:""}},{propertySector:n.Sector.GENERAL,propertySet:{name:"Logo",property:"logo-visual",type:n.TypeName.BASE,defaults:""}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Color",property:"color-visual",type:n.TypeName.COLOR,etsType:n.EtsType.COMB_COLOR}},{propertySector:n.Sector.FEATURE,propertySet:{name:"FontFamily",property:"font-family-visual",type:n.TypeName.BASE,etsType:n.EtsType.STRING,defaults:"sans-serif"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"MaxLines",property:"max-lines-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER}},{propertySector:n.Sector.FEATURE,propertySet:{name:"TextColor",property:"text-color-visual",type:n.TypeName.COLOR,defaults:"rgba(0,0,0,0.9)"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"FocusColor",property:"focus-color-visual",type:n.TypeName.COLOR}},{propertySector:n.Sector.FEATURE,propertySet:{name:"DisappearColor",property:"disappear-color-visual",type:n.TypeName.COLOR}},{propertySector:n.Sector.FEATURE,propertySet:{name:"IndicatorColor",property:"indicator-color-visual",type:n.TypeName.COLOR}},{propertySector:n.Sector.FEATURE,propertySet:{name:"IndicatorSelectedColor",property:"indicator-selected-color-visual",type:n.TypeName.COLOR,defaults:"#ff007dff"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"IndicatorSize",property:"indicator-size-visual",type:n.TypeName.INTEGER,units:["px"]}},{propertySector:n.Sector.FEATURE,propertySet:Object.assign({name:"IndicatorTop",property:"indicator-top-visual"},n.commonParamsForIndicator)},{propertySector:n.Sector.FEATURE,propertySet:Object.assign({name:"IndicatorRight",property:"indicator-right-visual"},n.commonParamsForIndicator)},{propertySector:n.Sector.FEATURE,propertySet:Object.assign({name:"IndicatorBottom",property:"indicator-bottom-visual"},n.commonParamsForIndicator)},{propertySector:n.Sector.FEATURE,propertySet:Object.assign({name:"IndicatorLeft",property:"indicator-left-visual"},n.commonParamsForIndicator)},{propertySector:n.Sector.FEATURE,propertySet:{name:"AllowScale",property:"allow-scale-visual",type:n.TypeName.SELECT,defaults:"true",list:[n.CLEAN_VALUE_NODE,{value:"true"},{value:"false"}]}},{propertySector:n.Sector.GRID,propertySet:{name:"GridRowStart",property:"grid-row-start-visual",type:n.TypeName.INTEGER,requiresParent:{display:["grid"]},info:"The start position of its row in the grid area."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridColumnStart",property:"grid-column-start-visual",type:n.TypeName.INTEGER,requiresParent:{display:["grid"]},info:"The start position of its column in the grid area."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridRowEnd",property:"grid-row-end-visual",type:n.TypeName.INTEGER,requiresParent:{display:["grid"]},info:"The end position of its row in the grid area."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridColumnEnd",property:"grid-column-end-visual",type:n.TypeName.INTEGER,requiresParent:{display:["grid"]},info:"The end position of its column in the grid area."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridTemplateRows",property:"grid-template-rows-visual",type:n.TypeName.BASE,defaults:"1fr",requires:{"display-visual":["grid"]},info:"The number of items in the grid rows."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridTemplateColumns",property:"grid-template-columns-visual",type:n.TypeName.BASE,defaults:"1fr",requires:{"display-visual":["grid"]},info:"The number of items in the grid columns."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridRowsGap",property:"grid-rows-gap-visual",type:n.TypeName.INTEGER,defaults:"0px",units:["px"],requires:{"display-visual":["grid"]},info:"The size of the gap between an element's grid rows."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridColumnsGap",property:"grid-columns-gap-visual",type:n.TypeName.INTEGER,defaults:"0px",units:["px"],requires:{"display-visual":["grid"]},info:"The size of the gap between an element's columns."}},{propertySector:n.Sector.GRID,propertySet:{name:"GridGap",property:"grid-gap-visual",type:n.TypeName.INTEGER,units:["px"],requires:{"display-visual":["grid"]},info:"The gaps between rows and columns. It is a shorthand for row-gap and column-gap."}},{propertySector:n.Sector.FEATURE,propertySet:Object.assign({name:"MatchTextDirection",property:"match-text-direction-visual"},n.commonParamsForJudge)},{propertySector:n.Sector.FEATURE,propertySet:Object.assign({name:"FitOriginalSize",property:"fit-original-size-visual"},n.commonParamsForJudge)},{propertySector:n.Sector.FEATURE,propertySet:{name:"IconWidth",property:"icon-width-visual",type:n.TypeName.INTEGER,units:["px"]}},{propertySector:n.Sector.FEATURE,propertySet:{name:"IconHeight",property:"icon-height-visual",type:n.TypeName.INTEGER,units:["px"]}},{propertySector:n.Sector.FEATURE,propertySet:{name:"TextonColor",property:"texton-color-visual",type:n.TypeName.COLOR,defaults:"#000000"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"TextoffColor",property:"textoff-color-visual",type:n.TypeName.COLOR,defaults:"#000000"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"TextPadding",property:"text-padding-visual",type:n.TypeName.INTEGER,defaults:0,units:["px"]}},{propertySector:n.Sector.FEATURE,propertySet:{name:"SelectedColor",property:"selected-color-visual",type:n.TypeName.COLOR,defaults:"rgba(0,125,255,1)"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"BlockColor",property:"block-color-visual",type:n.TypeName.COLOR,defaults:"#ffffff"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Radius",property:"radius-visual",type:n.TypeName.INTEGER,units:["px"]}},{propertySector:n.Sector.FEATURE,propertySet:{name:"StartAngle",property:"start-angle-visual",type:n.TypeName.INTEGER,defaults:240}},{propertySector:n.Sector.FEATURE,propertySet:{name:"TotalAngle",property:"total-angle-visual",type:n.TypeName.INTEGER,defaults:240}},{propertySector:n.Sector.FEATURE,propertySet:{name:"CenterX",property:"center-x-visual",type:n.TypeName.INTEGER}},{propertySector:n.Sector.FEATURE,propertySet:{name:"CenterY",property:"center-y-visual",type:n.TypeName.INTEGER}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Colors",property:"colors-visual",type:n.TypeName.BASE}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Weights",property:"weights-visual",type:n.TypeName.BASE}},{propertySector:n.Sector.FEATURE,propertySet:{name:"PlaceHolderColor",property:"placeholder-color-visual",type:n.TypeName.COLOR,defaults:"gray"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"ProgressColor",property:"progress-color-visual",type:n.TypeName.COLOR,etsType:n.EtsType.COMB_COLOR,defaults:"black"}},{propertySector:n.Sector.FEATURE,propertySet:{name:"ItemExtent",property:"item-extent-visual",type:n.TypeName.INTEGER,units:["px","%"]}},{propertySector:n.Sector.FEATURE,propertySet:{name:"FadeColor",property:"fade-color-visual",type:n.TypeName.COLOR,defaults:"grey"}},{propertySector:n.Sector.FLEX,propertySet:{name:"ColumnSpan",property:"column-span-visual",type:n.TypeName.INTEGER,defaults:1,min:1,info:"The number of span."}},{propertySector:n.Sector.ATOMIC,propertySet:{name:"FlexWeight",property:"flex-weight-visual",type:n.TypeName.INTEGER}},{propertySector:n.Sector.ATOMIC,propertySet:{name:"AspectRatio",property:"aspect-ratio-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER}},{propertySector:n.Sector.FEATURE,propertySet:{name:"SecondaryColor",property:"secondary-color-visual",type:n.TypeName.COLOR,requires:{type:["horizontal","ring","scale-ring"]}}},{propertySector:n.Sector.FEATURE,propertySet:{name:"ScaleWidth",property:"scale-width-visual",type:n.TypeName.INTEGER,requires:{type:["ring","scale-ring"]}}},{propertySector:n.Sector.FEATURE,propertySet:{name:"ScaleNumber",property:"scale-number-visual",type:n.TypeName.INTEGER,defaults:120,requires:{type:["ring","scale-ring"]}}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Value",property:"value-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER,defaults:0}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Total",property:"total-visual",type:n.TypeName.INTEGER,etsType:n.EtsType.NUMBER,defaults:100}},{propertySector:n.Sector.FEATURE,propertySet:{name:"Style",property:"style-visual",type:n.TypeName.SELECT,etsType:n.EtsType.PROGRESS_STYLE,defaults:"Linear",list:[{value:"Linear"}]}}]},513:(e,t)=>{"use strict";var r,n,o;Object.defineProperty(t,"__esModule",{value:!0}),t.EtsType=t.commonParamsForBorderRadius=t.commonParamsForIndicator=t.commonParamsForInteger=t.commonParamsForJudge=t.commonParamsForBorder=t.CLEAN_VALUE_NODE=t.TypeName=t.Sector=void 0,function(e){e.GENERAL="general",e.DIMENSION="dimension",e.FEATURE="feature",e.FLEX="flex",e.GRID="grid",e.ATOMIC="atomic"}(r||(r={})),t.Sector=r,function(e){e.BASE="base",e.INTEGER="integer",e.SELECT="select",e.COLOR="color",e.COMPOSITE="composite",e.SLIDER="slider",e.DATA_SELECT_INPUT="dataSelectInput",e.ADJUSTABLE="adjustable"}(n||(n={})),t.TypeName=n,function(e){e.ARRAY="ETSArray",e.BOOLEAN="ETSBoolean",e.NUMBER="ETSNumber",e.OBJECT="ETSObject",e.STRING="ETSString",e.R_FLOAT="Rfloat",e.R_STRING="Rstring",e.R_COLOR="Rcolor",e.R_MEDIA="Rmedia",e.R_RAWFILE="Rrawfile",e.ALIGNMENT="Alignment",e.AXIS="Axis",e.BORDER_STYLE="BorderStyle",e.BUTTON_TYPE="ButtonType",e.COLOR="Color",e.DIRECTION="Direction",e.EDGE_EFFECT="EdgeEffect",e.ENTER_KEY_TYPE="EnterKeyType",e.FLEX_ALIGN="FlexAlign",e.FLEX_DIRECTION="FlexDirection",e.FLEX_WRAP="FlexWrap",e.FONT_STYLE="FontStyle",e.FONT_WEIGHT="FontWeight",e.HORIZONTAL_ALIGN="HorizontalAlign",e.IMAGE_FIT="ImageFit",e.IMAGE_INTERPOLATION="ImageInterpolation",e.IMAGE_RENDER_MODE="ImageRenderMode",e.IMAGE_REPERT="ImageRepeat",e.IMAGE_SIZE="ImageSize",e.INPUT_TYPE="InputType",e.ITEM_ALIGN="ItemAlign",e.LINE_CAP_STYLE="LineCapStyle",e.PROGRESS_STYLE="ProgressStyle",e.STICKY="Sticky",e.TEXT_ALIGN="TextAlign",e.TEXT_OVERFLOW="TextOverflow",e.TEXT_DECORATION_TYPE="TextDecorationType",e.TEXT_CASE="TextCase",e.VERTICAL_ALIGN="VerticalAlign",e.VISIBILITY="Visibility",e.COMB_COLOR="ETSString|ETSNumber|Color|Rcolor",e.COMB_LENGTH="ETSString|ETSNumber",e.COMB_R_LENGTH="ETSString|ETSNumber|Rfloat",e.COMB_CONTENT="ETSString|Rstring",e.COMB_SRC="ETSString|Rmedia|Rrawfile"}(o||(o={})),t.EtsType=o;const i={value:"cleanValue",name:"---Clean Value---"};t.CLEAN_VALUE_NODE=i;const a={type:n.SELECT,etsType:o.BORDER_STYLE,list:[i,{value:"dotted"},{value:"dashed"},{value:"solid"}]};t.commonParamsForBorder=a;const s={type:n.SELECT,etsType:o.BOOLEAN,defaults:"false",list:[i,{value:"true"},{value:"false"}]};t.commonParamsForJudge=s;const c={type:n.INTEGER,units:["px"],placeholder:"0px"};t.commonParamsForInteger=c;const l={type:n.INTEGER,units:["px","%"]};t.commonParamsForIndicator=l;const u={type:n.INTEGER,units:["px"]};t.commonParamsForBorderRadius=u},282:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TagTypeMap=void 0,t.TagTypeMap=new Map([["button","TextContent"],["span","TextContent"],["divider","TextContent"],["picker","TextContent"],["option","TextContent"],["clock","TextContent"],["image","Base"],["input","Base"],["chart","Base"],["slider","Base"],["progress","Base"],["text","Text"],["div","Container"],["list","Container"],["list-item","Container"],["list-item-group","Container"],["refresh","Container"],["dialog","Container"],["stack","Container"],["menu","Container"],["select","Container"],["tabs","Container"],["tab-bar","Container"],["tab-content","Container"]])},294:(e,t)=>{"use strict";function r(e){const t=function(e){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");let r="";for(let t=0;t=4&&(r=r.substr(r.length/2-2,4)),r}Object.defineProperty(t,"__esModule",{value:!0}),t.getUniqueName=t.getUniqueId=t.removeFromArray=t.getDataName=void 0,t.getDataName=function(e){if("string"==typeof e&&e.startsWith("{{")&&e.endsWith("}}"))return e.substring(2,e.length-2)},t.removeFromArray=function(e,t){const r=[...e];return t.forEach((e=>{const t=r.indexOf(e);-1!==t&&r.splice(t,1)})),r},t.getUniqueId=r,t.getUniqueName=function(e){return`${e}_${r(e)}`}},207:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.formManager=void 0;const n=r(891),o=r(945);t.formManager={removeData(e){this.getFormModel().data.delete(e)},addData(e){e instanceof Map?e.forEach(((e,t)=>{this.getFormModel().data.set(t,e)})):Object.keys(e).forEach((t=>{this.getFormModel().data.set(t,e[t])}))},updateAllData(e){this.getFormModel().data.clear(),this.addData(e)},addAction(e,t,r,n){const i=new Map;void 0!==r&&Object.keys(r).forEach((e=>{i.set(e,r[e])}));const a=new Map;void 0!==n&&Object.keys(n).forEach((e=>{a.set(e,n[e])})),this.getFormModel().actions.set(e,new o.FormAction(t,i,a))},updateAllActions(e){this.getFormModel().actions.clear(),e.forEach(((e,t)=>{const r=void 0===e.params?e.params:this.objectToMap(e.params),n=void 0===e.want?e.want:this.objectToMap(e.want),i=new o.FormAction(e.actionType,r,n);this.getFormModel().actions.set(t,i)}))},removeAction(e){this.getFormModel().actions.delete(e)},addActionParams(e,t){var r,n;const i=null!==(r=this.getFormModel().actions.get(e))&&void 0!==r?r:new o.FormAction(e),a=null!==(n=i.params)&&void 0!==n?n:new Map;Object.keys(t).forEach((e=>{a.set(e,t[e])})),i.params=a},removeActionParam(e,t){var r;const n=this.getFormModel().actions.get(e);null===(r=null==n?void 0:n.params)||void 0===r||r.delete(t)},getFormModel:()=>(0,n.getInstance)().formData,codegenToJson:function(){const e=(0,n.getInstance)().formData,t=this.mapToObject(e.data),r={actions:{},data:{}};return r.data=t,e.actions.forEach(((e,t)=>{r.actions[t]={},r.actions[t].action=e.action,e.params instanceof Map&&e.params.size>0&&(r.actions[t].params=this.mapToObject(e.params)),e.want instanceof Map&&e.want.size>0&&(r.actions[t].want=this.mapToObject(e.want))})),JSON.stringify(r,null,4)},clear(){(0,n.getInstance)().formData.data.clear(),(0,n.getInstance)().formData.actions.clear()},mapToObject:e=>void 0===e?{}:Array.from(e.entries()).reduce(((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r})),{}),objectToMap(e){const t=new Map;return Object.keys(e).forEach(((r,n)=>{t.set(r,e[r])})),t}}},945:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FormAction=t.FormModel=void 0,t.FormModel=class{constructor(){this.data=new Map,this.actions=new Map}},t.FormAction=class{constructor(e,t,r){this.action=e,this.params=t,this.want=r}}},509:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeForVersion1=t.rootToVisualContent=t.visualToRootContent=t.serializeForVersion1=void 0;const n=r(891),o=r(933),i=r(571),a=r(282),s=r(945),c=r(977),l=new Map;function u(e){l.set("textMap",new Map);const t=p(null!=e?e:(0,n.getInstance)().visualModel);return JSON.stringify({VisualVersion:"1",content:JSON.stringify(t),extraData:JSON.stringify(y(l))})}function p(e){const t=Array.from(e.property).filter((t=>(0,i.isAttribute)(t[0],e.type)));t.push(["id",e.id]);const r=Array.from(e.property).filter((t=>(0,i.isStyle)(t[0],e.type)));let n=a.TagTypeMap.get(e.type);void 0===n&&(n="Base");let o=e.property.has("content")?e.property.get("content"):[];if(e.children.length>0){if("string"==typeof o){const t=l.get("textMap");t instanceof Map&&t.set(e.id,o)}o=e.children.map((e=>p(e)))}return{id:e.id,tagName:e.type,attributes:t,idStyle:r,type:n,content:o}}function f(e,t){let r;if(t instanceof Map){const n=t.get("textMap");n instanceof Map&&(r=n.get(e.id))}const n=new o.VisualModel({id:e.id,type:e.tagName,property:new Map([...e.attributes,...e.idStyle])});return"string"==typeof r&&n.property.set("content",r),n.property.delete("id"),"string"==typeof e.content&&n.property.set("content",e.content),Array.isArray(e.content)&&(n.children=e.content.map((e=>f(e,t)))),n}function d(e){if(e instanceof Array&&e.length>0&&"$$map"===e[0]){e.shift();const t=new Map;for(const[r,n]of e)t.set(r,d(n));return t}return e}function y(e){if(e instanceof Map){const t=["$$map"];for(const[r,n]of e)t.push([r,y(n)]);return t}return e}t.serializeForVersion1=u,t.visualToRootContent=function(e){try{return u(JSON.parse(e,c.reviver).visualModel)}catch(e){console.error("convert visual model to root model failed")}return e},t.rootToVisualContent=function(e){const t=JSON.parse(e),r=JSON.parse(t.content);let n='["$$map",["textMap",["$$map"]]]';"string"==typeof t.extraData&&(n=JSON.parse(t.extraData));const o=f(r,d(n));return o.property.has("flex-direction")||o.property.set("flex-direction","column"),JSON.stringify({document:{VisualVersion:"12",type:"FA"},visualModel:o,formData:new s.FormModel},c.replacer)},t.deserializeForVersion1=function(e){try{const t=JSON.parse(e),r=JSON.parse(t.content);let o='["$$map",["textMap",["$$map"]]]';"string"==typeof t.extraData&&(o=JSON.parse(t.extraData)),(0,n.getInstance)().visualModel=f(r,d(o)),(0,n.getInstance)().visualModel.property.has("flex-direction")||(0,n.getInstance)().visualModel.property.set("flex-direction","column")}catch(e){console.error("convert error")}}},891:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setInstance=t.getInstance=void 0;const n=r(933),o=r(945),i=r(904),a={document:{VisualVersion:"12",type:"FA"},visualModel:new n.VisualModel({type:"div",id:"wrapper"}),formData:new o.FormModel};t.getInstance=function(){return a},t.setInstance=function(e){for(const t in a)Object.prototype.hasOwnProperty.call(e,t)&&(a[t]=e[t]);const t=a.document.type;(0,i.setDomain)("ETS"===t?i.Domain.ETS:"FORM"===t?i.Domain.FORM:i.Domain.FA)}},977:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.reviver=t.replacer=t.deserialize=t.serialize=void 0;const n=r(933),o=r(891),i=r(509);function a(e,t){if(t instanceof Map)return{dataType:"Map",value:Object.fromEntries(t.entries())};if(t instanceof Set)return{dataType:"Set",value:Array.from(t.entries())};if(t instanceof n.VisualModel){const e=new n.VisualModel({type:"none"}),r={};for(const n in e)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n]);return{dataType:"VisualModel",value:r}}return t}function s(e,t){if("object"==typeof t&&null!=t){if("Map"===t.dataType)return new Map(Object.entries(t.value));if("Set"===t.dataType)return new Set(t.value);if("VisualModel"===t.dataType){const e=new n.VisualModel({type:""});Object.assign(e,t.value),t=e}}return t}t.serialize=function(e,t){return 1===e?(0,i.serializeForVersion1)(t):JSON.stringify(null!=t?t:(0,o.getInstance)(),a,4)},t.deserialize=function(e){if("1"===JSON.parse(e).VisualVersion)return(0,i.deserializeForVersion1)(e);const t=JSON.parse(e,s);(0,o.setInstance)(t)},t.replacer=a,t.reviver=s},933:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.VisualModel=void 0;const r="-visual";t.VisualModel=class{constructor(e){if(this.mediaProperty=void 0,this.dynamicMediaProperty=void 0,this.property=void 0!==e.property?e.property:new Map,this.dynamicProperty=void 0!==e.dynamicProperty?e.dynamicProperty:new Map,this.children=void 0!==e.children?e.children:[],"wrapper"===e.type)return this.id="wrapper",void(this.type="div");e.type.endsWith(r)&&(e.type=e.type.substring(0,e.type.length-r.length)),this.id=void 0!==e.id?e.id:"",this.type=e.type}getProperty(e){const t=this.dynamicProperty.get(e);return void 0!==t&&""!==t?t:this.property.get(e)}hasMediaProperty(e){if(void 0!==this.mediaProperty)for(const[,t]of this.mediaProperty)if(null==t?void 0:t.has(e))return!0;if(void 0!==this.dynamicMediaProperty)for(const[,t]of this.dynamicMediaProperty)if(null==t?void 0:t.has(e))return!0;return!1}hasProperty(e){return this.dynamicProperty.has(e)||this.property.has(e)}accept(e){return e.visit(this)}}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={id:n,loaded:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.loaded=!0,i.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e);var n={};(()=>{"use strict";var e=n;Object.defineProperty(e,"__esModule",{value:!0});const t=r(784),o=r(891),i=r(977),a=r(844),s=r(55),c=r(207),l=r(413),u=r(435),p=r(486),f={build:"",etsImport:"",etsVariable:"",etsFunction:"",aboutToAppear:""};function d(e,r){var n;try{(0,i.deserialize)(e);const t=(0,o.getInstance)().document.VisualVersion,n=/^([1-9]+[0-9]*)$/;if(void 0===t)r.errorType="versionError";else{const e=t.match(n);(null===e||parseInt(e[1])>12)&&(r.errorType="versionError")}}catch(e){r.errorType="fileError"}""!==r.errorType&&(r.errorMessage=null!==(n=t.errorMap.get(r.errorType))&&void 0!==n?n:"Codegen visual file failed")}e.genHmlAndCss=function(e){const r={hmlCss:{hml:"",css:"",json:""},errorType:"",errorMessage:""};if(d(e,r),""!==r.errorType)return r.hmlCss.hml="",r.hmlCss.css="",r;try{const e=function(e){const t={hml:"",css:"",json:""},r=new a.HMLBridge,n=e.accept(r),o=(0,s.genFAHML)(n);t.hml=r.getErrorCount()>0?"error":o;const i=new a.CSSBridge,c=e.accept(i),l=(0,s.genFACSS)(c);return t.css=i.getErrorCount()>0?"error":l,t}((0,o.getInstance)().visualModel);"error"!==e.hml&&"error"!==e.css||(r.errorType="codegenError"),r.hmlCss=e,"FORM"===(0,o.getInstance)().document.type&&(r.hmlCss.json=c.formManager.codegenToJson())}catch(e){r.errorType="modelError"}return""!==r.errorType&&(r.errorMessage=t.errorMap.get(r.errorType),r.hmlCss.hml="",r.hmlCss.css=""),r},e.genETS=function(e){var r;const n={ets:(0,p.cloneDeep)(f),errorType:"",errorMessage:""};if(d(e,n),""!==n.errorType)return n.ets=(0,p.cloneDeep)(f),n;try{const e=function(e){const t=new l.ETSBridge,r=e.accept(t),n=(new u.StringWriter).genETS(r);return t.getErrorCount()>0?"error":n}((0,o.getInstance)().visualModel);"error"===e&&(n.errorType="codegenError"),n.ets=e}catch(e){n.errorType="modelError"}return""!==n.errorType&&(n.errorMessage=null!==(r=t.errorMap.get(n.errorType))&&void 0!==r?r:"Codegen visual file failed",n.ets=(0,p.cloneDeep)(f)),n}})();var o=exports;for(var i in n)o[i]=n[i];n.__esModule&&Object.defineProperty(o,"__esModule",{value:!0})})(); -- Gitee From 7ef79e8b793edec6ab260d3edbf582ce46c124eb Mon Sep 17 00:00:00 2001 From: laibo102 Date: Fri, 11 Mar 2022 12:03:20 +0800 Subject: [PATCH 23/42] update: BUILD.gn Signed-off-by: laibo102 Change-Id: Ic4f52a5e360957c62c82cadd0c8c207419f94990 --- BUILD.gn | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index c8aab5db3..e081fdbec 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -282,8 +282,7 @@ ohos_copy("ohos_declaration_ets_ark") { ohos_copy("common_api_ark") { sources = common_api_src deps = [ ":ohos_declaration_ets_ark" ] - outputs = - [ target_out_dir + "/../../developtools/api/{{source_file_part}}" ] + outputs = [ target_out_dir + "/../../developtools/api/{{source_file_part}}" ] module_install_name = "" } -- Gitee From 86ecd3b3e3ee5c3d4a6c9f2a7f8b7372eed586e5 Mon Sep 17 00:00:00 2001 From: lihong Date: Thu, 3 Mar 2022 11:42:23 +0800 Subject: [PATCH 24/42] lihong67@huawei.com optimize ets-loader. Signed-off-by: lihong Change-Id: I9392d2044df4ae051d11b50aa410c8d542c103f0 --- BUILD.gn | 12 +- compiler/babel.config.js | 2 +- compiler/build_declarations_file.js | 2 - compiler/deps/ohos-typescript-4.2.3-r2.tgz | 1 + compiler/package-lock.json | 5 +- compiler/package.json | 2 +- compiler/src/compile_info.ts | 86 +-- compiler/src/component_map.ts | 4 +- compiler/src/ets_checker.ts | 208 +++++++ compiler/src/pre_define.ts | 6 + compiler/src/pre_process.ts | 4 +- compiler/src/process_component_build.ts | 194 +++---- compiler/src/process_component_class.ts | 10 +- compiler/src/process_component_constructor.ts | 62 +- compiler/src/process_custom_component.ts | 3 + compiler/src/process_import.ts | 2 +- compiler/src/process_ui_syntax.ts | 217 ++----- compiler/src/result_process.ts | 2 +- compiler/src/utils.ts | 6 +- compiler/src/validate_ui_syntax.ts | 132 +---- compiler/test/test.js | 11 +- compiler/test/ut/component/customComponent.ts | 6 +- compiler/test/ut/struct/struct_02.ts | 14 +- compiler/tsconfig.json | 539 ++++++++++++++++++ compiler/webpack.config.js | 5 +- 25 files changed, 1046 insertions(+), 489 deletions(-) create mode 120000 compiler/deps/ohos-typescript-4.2.3-r2.tgz create mode 100644 compiler/src/ets_checker.ts diff --git a/BUILD.gn b/BUILD.gn index 2fb8d0eb9..74b3fd07a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -143,8 +143,18 @@ ets_loader_sources = [ "compiler/webpack.config.js", ] +ohos_copy("copy_deps") { + sources = + [ "//third_party/typescript/build_package/ohos-typescript-4.2.3-r2.tgz" ] + outputs = [ target_out_dir + "/ets_loader/deps/{{source_file_part}}" ] + license_file = "//third_party/typescript/LICENSE" +} + ohos_copy("ets_loader") { - deps = [ ":build_ets_loader_library" ] + deps = [ + ":build_ets_loader_library", + ":copy_deps", + ] sources = ets_loader_sources deps += [ ":build_ets_sysResource" ] sources += [ ets_sysResource ] diff --git a/compiler/babel.config.js b/compiler/babel.config.js index 1c8aa7051..ed99ab39a 100644 --- a/compiler/babel.config.js +++ b/compiler/babel.config.js @@ -16,7 +16,7 @@ module.exports = function(api) { api.cache(true); - const presets = ['@babel/preset-env', '@babel/typescript']; + const presets = ['@babel/typescript']; const plugins = [ '@babel/plugin-transform-modules-commonjs', '@babel/plugin-proposal-class-properties', diff --git a/compiler/build_declarations_file.js b/compiler/build_declarations_file.js index 41d982b4f..c878c971d 100644 --- a/compiler/build_declarations_file.js +++ b/compiler/build_declarations_file.js @@ -61,8 +61,6 @@ function generateTargetFile(filePath, output) { const fileName = path.resolve(output, path.basename(item)); if (item === globalTsFile) { content = license + '\n\n' + processsFile(content, fileName, true); - } else if (path.resolve(item) !== middleTsFile) { - content = license + '\n\n' + processsFile(content, fileName, false); } fs.writeFile(fileName, content, err => { if (err) { diff --git a/compiler/deps/ohos-typescript-4.2.3-r2.tgz b/compiler/deps/ohos-typescript-4.2.3-r2.tgz new file mode 120000 index 000000000..03a9d71c8 --- /dev/null +++ b/compiler/deps/ohos-typescript-4.2.3-r2.tgz @@ -0,0 +1 @@ +../../../../third_party/typescript/build_package/ohos-typescript-4.2.3-r2.tgz \ No newline at end of file diff --git a/compiler/package-lock.json b/compiler/package-lock.json index 66c7d41b7..d228e0e9d 100644 --- a/compiler/package-lock.json +++ b/compiler/package-lock.json @@ -4073,9 +4073,8 @@ "dev": true }, "typescript": { - "version": "4.5.4", - "resolved": "https://registry.npmmirror.com/typescript/download/typescript-4.5.4.tgz", - "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==" + "version": "file:deps/ohos-typescript-4.2.3-r2.tgz", + "integrity": "sha512-a94p5mnxZMe9sJebu6gw2ixGaVGuKo7H3fU+Vd+VrogYbRrrCphlrJ2nlZnpm9r0TYe4HwHrmGkeyeJW63XUSA==" }, "uglify-js": { "version": "3.14.5", diff --git a/compiler/package.json b/compiler/package.json index cf6c7141f..a3ac31ace 100644 --- a/compiler/package.json +++ b/compiler/package.json @@ -42,7 +42,7 @@ "log4js": "^6.3.0", "md5": "^2.3.0", "ts-loader": "^8.0.12", - "typescript": "^4.1.3", + "typescript": "file:./deps/ohos-typescript-4.2.3-r2.tgz", "webpack": "^5.48.0", "webpack-cli": "^4.2.0", "ws": "^8.3.0" diff --git a/compiler/src/compile_info.ts b/compiler/src/compile_info.ts index 4312b7f40..a086d8a40 100644 --- a/compiler/src/compile_info.ts +++ b/compiler/src/compile_info.ts @@ -13,6 +13,7 @@ * limitations under the License. */ +import * as ts from 'typescript'; import Stats from 'webpack/lib/Stats'; import Compiler from 'webpack/lib/Compiler'; import Compilation from 'webpack/lib/Compilation'; @@ -27,23 +28,18 @@ import fs from 'fs'; import CachedSource from 'webpack-sources/lib/CachedSource'; import ConcatSource from 'webpack-sources/lib/ConcatSource'; -import { - BUILDIN_STYLE_NAMES, - EXTEND_ATTRIBUTE, - STYLES_ATTRIBUTE -} from './component_map'; import { transformLog } from './process_ui_syntax'; -import { - dollarCollection, - componentCollection, - moduleCollection -} from './validate_ui_syntax'; -import { decoratorParamSet } from './process_component_member'; -import { appComponentCollection } from './process_component_build'; +import { moduleCollection } from './validate_ui_syntax'; import { projectConfig } from '../main'; import { circularFile } from './utils'; import { MODULE_SHARE_PATH, BUILD_SHARE_PATH } from './pre_define'; -import { COMMON_ATTRS } from './component_map'; +import { + createLanguageService, + dollarCollection, + appComponentCollection, + decoratorParamsCollection, + extendCollection +} from './ets_checker'; configure({ appenders: { 'ETS': {type: 'stderr', layout: {type: 'messagePassThrough'}}}, @@ -78,7 +74,7 @@ export class ResultStates { compiler.hooks.compilation.tap('SourcemapFixer', compilation => { compilation.hooks.afterProcessAssets.tap('SourcemapFixer', assets => { Reflect.ownKeys(assets).forEach(key => { - if (/\.map$/.test(key.toString())) { + if (/\.map$/.test(key.toString()) && assets[key]._value) { assets[key]._value = assets[key]._value.toString().replace('.ets?entry', '.ets'); } }); @@ -146,17 +142,45 @@ export class ResultStates { }); }); + compiler.hooks.run.tapPromise('CheckSyntax', async(compiler) => { + const rootFileNames: string[] = []; + Object.values(projectConfig.entryObj).forEach((fileName: string) => { + rootFileNames.push(fileName.replace('?entry', '')); + }); + const languageService: ts.LanguageService = createLanguageService(rootFileNames); + const rootProgram: ts.Program = languageService.getProgram(); + props.push(...dollarCollection, ...decoratorParamsCollection, ...extendCollection); + let allDiagnostics: ts.Diagnostic[] = rootProgram + .getSyntacticDiagnostics() + .concat(rootProgram.getSemanticDiagnostics()) + .concat(rootProgram.getDeclarationDiagnostics()); + allDiagnostics = allDiagnostics.filter((item) => { + return this.validateError(ts.flattenDiagnosticMessageText(item.messageText, '\n')); + }); + this.mErrorCount += allDiagnostics.length; + allDiagnostics.forEach((diagnostic: ts.Diagnostic) => { + const message: string = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n'); + if (diagnostic.file) { + const { line, character }: ts.LineAndCharacter = + diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start!); + logger.error(this.red, + `ETS:ERROR File: ${diagnostic.file.fileName}:${line + 1}:${character + 1}\n ${message}\n`); + } else { + logger.error(this.red, `ETS:ERROR: ${message}`); + } + }); + }); + compiler.hooks.done.tap('Result States', (stats: Stats) => { this.mStats = stats; this.warningCount = 0; this.noteCount = 0; if (this.mStats.compilation.errors) { - this.mErrorCount = this.mStats.compilation.errors.length; + this.mErrorCount += this.mStats.compilation.errors.length; } if (this.mStats.compilation.warnings) { this.mWarningCount = this.mStats.compilation.warnings.length; } - props.push(...dollarCollection, ...decoratorParamSet, ...BUILDIN_STYLE_NAMES); this.printResult(); }); @@ -261,41 +285,25 @@ export class ResultStates { } private validateError(message: string): boolean { const propInfoReg: RegExp = /Cannot find name\s*'(\$?\$?[_a-zA-Z0-9]+)'/; - const componentNameReg: RegExp = /'typeof\s*(\$?[_a-zA-Z0-9]+)' is not callable/; - const stateInfoReg: RegExp = /Property\s*'(\$[_a-zA-Z0-9]+)' does not exist on type/; - const extendInfoReg: RegExp = - /Property\s*'([_a-zA-Z0-9]+)' does not exist on type\s*'([_a-zA-Z0-9]+)(Attribute|Interface)'\./; - if (this.matchMessage(message, props.concat([...STYLES_ATTRIBUTE]), propInfoReg) || - this.matchMessage(message, [...componentCollection.customComponents], componentNameReg) || - this.matchMessage(message, props, stateInfoReg) || - this.matchMessage(message, EXTEND_ATTRIBUTE, extendInfoReg, true) || - this.matchMessage(message, [...STYLES_ATTRIBUTE, ...COMMON_ATTRS], extendInfoReg)) { + const stateInfoReg: RegExp = /Property\s*'(\$?[_a-zA-Z0-9]+)' does not exist on type/; + if (this.matchMessage(message, props, propInfoReg) || + this.matchMessage(message, props, stateInfoReg)) { return false; } return true; } - private matchMessage(message: string, nameArr: any, reg: RegExp, - validateComponent: boolean = false): boolean { + private matchMessage(message: string, nameArr: any, reg: RegExp): boolean { if (reg.test(message)) { const match: string[] = message.match(reg); - if (validateComponent) { - if (match[1] && match[2] && nameArr.has(match[2])) { - const attributeArray: string[] = [...nameArr.get(match[2])].map(item => item.attribute); - if (attributeArray.includes(match[1])) { - return true; - } - } - } else { - if (match[1] && nameArr.includes(match[1])) { - return true; - } + if (match[1] && nameArr.includes(match[1])) { + return true; } } return false; } private filterModuleError(message: string): string { if (/You may need an additional loader/.test(message) && transformLog && transformLog.sourceFile) { - const fileName: string = transformLog.sourceFile.fileName.replace(/.ts$/, ''); + const fileName: string = transformLog.sourceFile.fileName; const errorInfos: string[] = message.split('You may need an additional loader to handle the result of these loaders.'); if (errorInfos && errorInfos.length > 1 && errorInfos[1]) { message = `ERROR in ${fileName}\n The following syntax is incorrect.${errorInfos[1]}`; diff --git a/compiler/src/component_map.ts b/compiler/src/component_map.ts index 615a675f9..c7fe3d1b0 100644 --- a/compiler/src/component_map.ts +++ b/compiler/src/component_map.ts @@ -75,13 +75,13 @@ export interface ExtendParamterInterfance { attribute: string, parameterCount: number } -export const EXTEND_ATTRIBUTE: Map> = new Map(); +export const EXTEND_ATTRIBUTE: Map> = new Map(); export const STYLES_ATTRIBUTE: Set = new Set(); export const INTERFACE_NODE_SET: Set = new Set(); export const JS_BIND_COMPONENTS: Set = new Set([ - ...GESTURE_TYPE_NAMES, 'Gesture', + 'ForEach', 'LazyForEach', ...GESTURE_TYPE_NAMES, 'Gesture', 'PanGestureOption', 'CustomDialogController', 'Storage', 'Scroller', 'SwiperController', 'TabsController', 'CalendarController', 'AbilityController', 'VideoController', 'WebController', 'XComponentController', 'CanvasRenderingContext2D', 'CanvasGradient', 'ImageBitmap', 'ImageData', diff --git a/compiler/src/ets_checker.ts b/compiler/src/ets_checker.ts new file mode 100644 index 000000000..cab0eead8 --- /dev/null +++ b/compiler/src/ets_checker.ts @@ -0,0 +1,208 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import fs from 'fs'; +import path from 'path'; +import * as ts from 'typescript'; + +import { projectConfig } from '../main'; +import { + processSystemApi, + preprocessExtend +} from './validate_ui_syntax'; +import { + INNER_COMPONENT_MEMBER_DECORATORS, + COMPONENT_IF, + COMPONENT_DECORATORS_PARAMS +} from './pre_define'; +import { JS_BIND_COMPONENTS } from './component_map'; + +function readDeaclareFiles(): string[] { + const declarationsFileNames: string[] = []; + fs.readdirSync(path.resolve(__dirname, '../declarations')) + .forEach((fileName: string) => { + if (/\.d\.ts$/.test(fileName)) { + declarationsFileNames.push(path.resolve(__dirname, '../declarations', fileName)); + } + }); + return declarationsFileNames; +} + +export function createLanguageService(rootFileNames: string[]): ts.LanguageService { + const compilerOptions: ts.CompilerOptions = ts.readConfigFile( + path.resolve(__dirname, '../tsconfig.json'), ts.sys.readFile).config.compilerOptions; + Object.assign(compilerOptions, { + 'moduleResolution': ts.ModuleResolutionKind.NodeJs, + 'target': ts.ScriptTarget.ES2017, + 'baseUrl': path.resolve(projectConfig.projectPath), + 'paths': { + '*': [ + '*', + '../../../../../*' + ] + }, + 'lib': [ + 'lib.es2020.d.ts' + ] + }); + const files: ts.MapLike<{ version: number }> = {}; + const servicesHost: ts.LanguageServiceHost = { + getScriptFileNames: () => [...rootFileNames, ...readDeaclareFiles()], + getScriptVersion: fileName => + files[fileName] && files[fileName].version.toString(), + getScriptSnapshot: fileName => { + if (!fs.existsSync(fileName)) { + return undefined; + } + if (/(? process.cwd(), + getCompilationSettings: () => compilerOptions, + getDefaultLibFileName: options => ts.getDefaultLibFilePath(options), + fileExists: ts.sys.fileExists, + readFile: ts.sys.readFile, + readDirectory: ts.sys.readDirectory, + resolveModuleNames(moduleNames: string[], containingFile: string): ts.ResolvedModuleFull[] { + const resolvedModules: ts.ResolvedModuleFull[] = []; + for (const moduleName of moduleNames) { + const result = ts.resolveModuleName(moduleName, containingFile, compilerOptions, { + fileExists(fileName: string): boolean { + return ts.sys.fileExists(fileName); + }, + readFile(fileName: string): string | undefined { + return ts.sys.readFile(fileName); + } + }); + if (result.resolvedModule) { + resolvedModules.push(result.resolvedModule); + } else if (/^@(system|ohos)/.test(moduleName.trim())) { + const modulePath: string = path.resolve(__dirname, '../../../api', moduleName + '.d.ts'); + if (ts.sys.fileExists(modulePath)) { + resolvedModules.push(getResolveModule(modulePath, '.d.ts')); + } + } else if (/\.ets$/.test(moduleName)) { + const modulePath: string = path.resolve(path.dirname(containingFile), moduleName); + if (ts.sys.fileExists(modulePath)) { + resolvedModules.push(getResolveModule(modulePath, '.ets')); + } + } else if (/\.ts$/.test(moduleName)) { + const modulePath: string = path.resolve(path.dirname(containingFile), moduleName); + if (ts.sys.fileExists(modulePath)) { + resolvedModules.push(getResolveModule(modulePath, '.ts')); + } + } + } + if (moduleNames.length !== resolvedModules.length) { + const length: number = moduleNames.length - resolvedModules.length; + for (let i = 0; i < length; i++) { + resolvedModules.push(null); + } + } + return resolvedModules; + }, + directoryExists: ts.sys.directoryExists, + getDirectories: ts.sys.getDirectories + }; + return ts.createLanguageService(servicesHost, ts.createDocumentRegistry()); +} + +function getResolveModule(modulePath: string, type): ts.ResolvedModuleFull { + return { + resolvedFileName: modulePath, + isExternalLibraryImport: false, + extension: type + }; +} + +export const dollarCollection: Set = new Set(); +export const appComponentCollection: Set = new Set(); +export const decoratorParamsCollection: Set = new Set(); +export const extendCollection: Set = new Set(); + +function checkUISyntax(source: string, fileName: string): void { + if (/\.ets$/.test(fileName)) { + if (path.basename(fileName) !== 'app.ets') { + const sourceFile: ts.SourceFile = ts.createSourceFile(fileName, source, + ts.ScriptTarget.Latest, true, ts.ScriptKind.ETS); + collectComponents(sourceFile); + parseAllNode(sourceFile, sourceFile); + } + } +} + +function collectComponents(node: ts.SourceFile): void { + // @ts-ignore + if (node.identifiers && node.identifiers.size) { + // @ts-ignore + for (const key of node.identifiers.keys()) { + if (JS_BIND_COMPONENTS.has(key)) { + appComponentCollection.add(key); + } + } + } +} + +function parseAllNode(node: ts.Node, sourceFileNode: ts.SourceFile): void { + if (ts.isStructDeclaration(node)) { + if (node.members) { + node.members.forEach(item => { + if (ts.isPropertyDeclaration(item) && ts.isIdentifier(item.name)) { + const propertyName: string = item.name.getText(); + if (item.decorators && item.decorators.length) { + for (let i = 0; i < item.decorators.length; i++) { + const decoratorName: string = item.decorators[i].getText().replace(/\(.*\)$/, '').trim(); + if (INNER_COMPONENT_MEMBER_DECORATORS.has(decoratorName)) { + dollarCollection.add('$' + propertyName); + } + if (isDecoratorCollection(item.decorators[i], decoratorName)) { + decoratorParamsCollection.add(item.decorators[i].expression.arguments[0].getText()); + } + } + } + } + }); + } + } + if (ts.isIfStatement(node)) { + appComponentCollection.add(COMPONENT_IF); + } + node.getChildren().forEach((item: ts.Node) => parseAllNode(item, sourceFileNode)); +} + +function isDecoratorCollection(item: ts.Decorator, decoratorName: string): boolean { + return COMPONENT_DECORATORS_PARAMS.has(decoratorName) && + // @ts-ignore + item.expression.arguments && item.expression.arguments.length && + // @ts-ignore + ts.isIdentifier(item.expression.arguments[0]); +} + +function processDraw(source: string): string { + const reg: RegExp = /new\s+\b(Circle|Ellipse|Rect|Path)\b/g; + return source.replace(reg, (item:string, item1: string) => { + return '\xa0'.repeat(item.length - item1.length) + item1; + }); +} + +function processContent(source: string): string { + source = processSystemApi(source); + source = preprocessExtend(source, extendCollection); + source = processDraw(source); + return source; +} diff --git a/compiler/src/pre_define.ts b/compiler/src/pre_define.ts index 6935aeac1..ff3a07212 100644 --- a/compiler/src/pre_define.ts +++ b/compiler/src/pre_define.ts @@ -38,6 +38,9 @@ export const COMPONENT_OBJECT_LINK_DECORATOR: string = '@ObjectLink'; export const COMPONENT_WATCH_DECORATOR: string = '@Watch'; export const COMPONENT_BUILDERPARAM_DECORATOR: string = '@BuilderParam'; +export const COMPONENT_DECORATORS_PARAMS: Set = new Set([COMPONENT_CONSUME_DECORATOR, + COMPONENT_STORAGE_PROP_DECORATOR, COMPONENT_STORAGE_LINK_DECORATOR, COMPONENT_PROVIDE_DECORATOR, + COMPONENT_WATCH_DECORATOR]); export const INNER_COMPONENT_DECORATORS: Set = new Set([COMPONENT_DECORATOR_ENTRY, COMPONENT_DECORATOR_PREVIEW, COMPONENT_DECORATOR_COMPONENT, COMPONENT_DECORATOR_CUSTOM_DIALOG]); export const INNER_COMPONENT_MEMBER_DECORATORS: Set = new Set([COMPONENT_STATE_DECORATOR, @@ -49,6 +52,7 @@ export const COMPONENT_OBSERVED_DECORATOR: string = '@Observed'; export const COMPONENT_BUILDER_DECORATOR: string = '@Builder'; export const COMPONENT_EXTEND_DECORATOR: string = '@Extend'; export const COMPONENT_STYLES_DECORATOR: string = '@Styles'; +export const CHECK_COMPONENT_EXTEND_DECORATOR: string = 'Extend'; export const OBSERVED_PROPERTY_SIMPLE: string = 'ObservedPropertySimple'; export const OBSERVED_PROPERTY_OBJECT: string = 'ObservedPropertyObject'; @@ -202,3 +206,5 @@ export const OBSERVED_PROPERTY_ABSTRACT:string = 'ObservedPropertyAbstract'; export const SUPERVISUAL: string = './supervisual'; export const SUPERVISUAL_SOURCEMAP_EXT: string = '.visual.js.map'; + +export const INSTANCE: string = 'Instance'; diff --git a/compiler/src/pre_process.ts b/compiler/src/pre_process.ts index 9f8eeeb16..5d501cabe 100644 --- a/compiler/src/pre_process.ts +++ b/compiler/src/pre_process.ts @@ -150,8 +150,8 @@ function insertImport(visualContent: any, content: string): string { function insertVarAndFunc(build: ts.MethodDeclaration, visualContent: any, content: string, oriContent: string): string { - const visualVarAndFunc: string = (visualContent.etsVariable ?? '') + - (visualContent.etsFunction ?? ''); + const visualVarAndFunc: string = (visualContent.etsVariable ? visualContent.etsVariable : '') + + (visualContent.etsFunction ? visualContent.etsFunction : ''); return visualVarAndFunc ? insertVisualCodeBeforePos(build, '\n' + visualVarAndFunc, content, oriContent) : content; } diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index d07fe1a5d..278968a94 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -88,8 +88,6 @@ import { projectConfig } from '../main'; import { transformLog, contextGlobal } from './process_ui_syntax'; import { props } from './compile_info'; -export const appComponentCollection: Set = new Set(); - export function processComponentBuild(node: ts.MethodDeclaration, log: LogInfo[]): ts.MethodDeclaration { let newNode: ts.MethodDeclaration; @@ -130,27 +128,15 @@ export function processComponentBlock(node: ts.Block, isLazy: boolean, log: LogI function validateRootNode(node: ts.MethodDeclaration, log: LogInfo[]): boolean { let isValid: boolean = false; - if (node.body.statements.length < 4) { - switch (node.body.statements.length) { - case 1: - if (validateFirstNode(node.body.statements[0])) { - isValid = true; - } - break; - case 2: - if (validateFirstNode(node.body.statements[0]) && - validateBlockNode(node.body.statements[1])) { - isValid = true; - } - break; - case 3: - if (validateFirstNode(node.body.statements[0]) && - validateBlockNode(node.body.statements[1]) && - validateSecondNode(node.body.statements[2])) { - isValid = true; - } - break; + if (node.body.statements.length === 1) { + const statement: ts.Node = node.body.statements[0]; + if (ts.isIfStatement(statement) || ts.isExpressionStatement(statement) && statement.expression && + (ts.isEtsComponentExpression(statement.expression) || ts.isCallExpression(statement.expression)) && + validateEtsComponentNode(statement.expression)) { + isValid = true; } + } else { + isValid = false; } if (!isValid) { log.push({ @@ -174,6 +160,19 @@ let newsupplement: supplementType = { column: 0 }; +function validateEtsComponentNode(node: ts.CallExpression | ts.EtsComponentExpression) { + let childNode: ts.Node = node; + while (ts.isCallExpression(childNode) && childNode.expression && + ts.isPropertyAccessExpression(childNode.expression) && childNode.expression.expression) { + childNode = childNode.expression.expression; + } + if (ts.isEtsComponentExpression(childNode)) { + return true; + } else { + return false; + } +} + export function processComponentChild(node: ts.Block | ts.SourceFile, newStatements: ts.Statement[], log: LogInfo[], supplement: supplementType = {isAcceleratePreview: false, line: 0, column: 0}): void { if (supplement.isAcceleratePreview) { @@ -189,9 +188,9 @@ export function processComponentChild(node: ts.Block | ts.SourceFile, newStateme newStatements, log, name); break; case ComponentType.customComponent: - if (index + 1 < array.length && ts.isBlock(array[index + 1])) { - if (processExpressionStatementChange(item, array[index + 1] as ts.Block, log)) { - item = processExpressionStatementChange(item, array[index + 1] as ts.Block, log); + if (item.expression && ts.isEtsComponentExpression(item.expression) && item.expression.body) { + if (processExpressionStatementChange(item, item.expression.body, log)) { + item = processExpressionStatementChange(item, item.expression.body, log); } } processCustomComponent(item as ts.ExpressionStatement, newStatements, log); @@ -205,7 +204,6 @@ export function processComponentChild(node: ts.Block | ts.SourceFile, newStateme break; } } else if (ts.isIfStatement(item)) { - appComponentCollection.add(COMPONENT_IF); processIfStatement(item, newStatements, log); } else if (!ts.isBlock(item)) { log.push({ @@ -262,6 +260,28 @@ function processBlockToExpression(node: ts.ExpressionStatement, nextNode: ts.Blo return node; } +type EtsComponentResult = { + etsComponentNode: ts.EtsComponentExpression; + hasAttr: boolean; +} +function parseEtsComponentExpression(node: ts.ExpressionStatement): EtsComponentResult { + let etsComponentNode: ts.EtsComponentExpression; + let hasAttr: boolean = false; + let temp: any = node.expression; + while (temp) { + if (ts.isCallExpression(temp) && temp.expression && + ts.isPropertyAccessExpression(temp.expression)) { + hasAttr = true; + } + if (ts.isEtsComponentExpression(temp)) { + etsComponentNode = temp; + break; + } + temp = temp.expression; + } + return { etsComponentNode: etsComponentNode, hasAttr: hasAttr }; +} + function processInnerComponent(node: ts.ExpressionStatement, index: number, arr: ts.Statement[], newStatements: ts.Statement[], log: LogInfo[], name: string): void { const res: CreateResult = createComponent(node, COMPONENT_CREATE_FUNCTION); @@ -293,7 +313,8 @@ function processInnerComponent(node: ts.ExpressionStatement, index: number, arr: ts.factory.createNodeArray([ts.factory.createStringLiteral(debugInfo)]))); newStatements.push(debugNode); } - if (index + 1 < arr.length && ts.isBlock(arr[index + 1])) { + const etsComponentResult: EtsComponentResult = parseEtsComponentExpression(node); + if (etsComponentResult.etsComponentNode.body && ts.isBlock(etsComponentResult.etsComponentNode.body)) { if (res.isButton) { if (projectConfig.isPreview) { newStatements.splice(-2, 1, createComponent(node, COMPONENT_CREATE_CHILD_FUNCTION).newNode); @@ -301,11 +322,10 @@ function processInnerComponent(node: ts.ExpressionStatement, index: number, arr: newStatements.splice(-1, 1, createComponent(node, COMPONENT_CREATE_CHILD_FUNCTION).newNode); } } - if (index + 2 < arr.length && ts.isExpressionStatement(arr[index + 2]) && - isAttributeNode(arr[index + 2] as ts.ExpressionStatement)) { - bindComponentAttr(arr[index + 2] as ts.ExpressionStatement, res.identifierNode, newStatements, log); + if (etsComponentResult.hasAttr) { + bindComponentAttr(node, res.identifierNode, newStatements, log); } - processComponentChild(arr[index + 1] as ts.Block, newStatements, log); + processComponentChild(etsComponentResult.etsComponentNode.body, newStatements, log); } else { bindComponentAttr(node, res.identifierNode, newStatements, log); } @@ -516,7 +536,8 @@ function createComponent(node: ts.ExpressionStatement, type: string): CreateResu while (temp && !ts.isIdentifier(temp) && temp.expression) { temp = temp.expression; } - if (temp && temp.parent && ts.isCallExpression(temp.parent) && ts.isIdentifier(temp)) { + if (temp && temp.parent && (ts.isCallExpression(temp.parent) || + ts.isEtsComponentExpression(temp.parent)) && ts.isIdentifier(temp)) { if (temp.getText() === COMPONENT_BUTTON && type !== COMPONENT_POP_FUNCTION) { res.isButton = true; identifierNode = type === COMPONENT_CREATE_CHILD_FUNCTION @@ -837,7 +858,6 @@ function addComponentAttr(temp: any, node: ts.Identifier, lastStatement: any, parseGesture(temp, propName, statements, log); lastStatement.kind = true; } else if (isExtendFunctionNode(identifierNode, propName)) { - validateExtendParameterCount(temp, identifierNode, propName, log); statements.push(ts.factory.createExpressionStatement(ts.factory.createCallExpression( ts.factory.createIdentifier(`__${identifierNode.escapedText.toString()}__${propName}`), undefined, temp.arguments))); @@ -873,18 +893,36 @@ function addComponentAttr(temp: any, node: ts.Identifier, lastStatement: any, if (!COMMON_ATTRS.has(propName)) { validateStateStyleSyntax(temp, log); } - if (isGlobalStyles) { - for (let i = 0; i < temp.arguments.length; i++) { - temp.arguments[i] = traverseStylesAttr(temp.arguments[i]); - } - } } + temp = loopEtsComponent(temp, isStylesAttr, isGlobalStyles); statements.push(ts.factory.createExpressionStatement( createFunction(identifierNode, node, temp.arguments))); lastStatement.kind = true; } } +function loopEtsComponent(temp: any, isStylesAttr: boolean, isGlobalStyles: boolean): ts.Node { + temp.arguments.forEach((item: ts.Node, index: number) => { + if (isStylesAttr && isGlobalStyles) { + temp.arguments[index] = traverseStylesAttr(item); + } + if (ts.isNewExpression(item) && item.expression && ts.isEtsComponentExpression( + item.expression)) { + temp.arguments[index] = ts.factory.updateNewExpression(item, item.expression.expression, + undefined, item.expression.arguments); + } else if (ts.isEtsComponentExpression(item)) { + temp.arguments[index] = ts.factory.createCallExpression(item.expression, + undefined, item.arguments); + } else if ((ts.isCallExpression(item) || ts.isNewExpression(item)) && item.expression && + ts.isPropertyAccessExpression(item.expression) && item.expression.expression && + ts.isEtsComponentExpression(item.expression.expression)) { + temp.arguments[index].expression.expression = ts.factory.createCallExpression( + item.expression.expression.expression, undefined, item.expression.expression.arguments); + } + }); + return temp; +} + function classifyArgumentsNum(args: any, argumentsArr: ts.Expression[], propName: string, identifierNode: ts.Identifier): void { if (propName === BIND_POPUP && args.length === 2) { @@ -967,7 +1005,7 @@ function traverseStateStylesAttr(temp: any, statements: ts.Statement[], function isExtendFunctionNode(identifierNode: ts.Identifier, propName: string): boolean { if (identifierNode && EXTEND_ATTRIBUTE.has(identifierNode.escapedText.toString())) { const attributeArray: string[] = - [...EXTEND_ATTRIBUTE.get(identifierNode.escapedText.toString())].map(item => item.attribute); + [...EXTEND_ATTRIBUTE.get(identifierNode.escapedText.toString())]; if (attributeArray.includes(propName)) { return true; } @@ -1053,7 +1091,8 @@ export function getName(node: ts.ExpressionStatement): string { let temp: any = node.expression; let name: string; while (temp) { - if (ts.isIdentifier(temp) && temp.parent && ts.isCallExpression(temp.parent)) { + if (ts.isIdentifier(temp) && temp.parent && (ts.isCallExpression(temp.parent) || + ts.isEtsComponentExpression(temp.parent))) { name = temp.escapedText.toString(); break; } else if (ts.isPropertyAccessExpression(temp) && temp.name && ts.isIdentifier(temp.name) && @@ -1079,46 +1118,6 @@ export function isAttributeNode(node: ts.ExpressionStatement): boolean { return BUILDIN_STYLE_NAMES.has(name); } -function validateFirstNode(node: ts.Statement): boolean { - const isEntryComponent: boolean = - componentCollection.entryComponent === componentCollection.currentClassName; - if (isEntryComponent && validateEntryComponent(node) || - !isEntryComponent && validateCustomComponent(node)) { - return true; - } - return false; -} - -function validateEntryComponent(node: ts.Statement): boolean { - if (ts.isExpressionStatement(node) && BUILDIN_CONTAINER_COMPONENT.has(getName(node))) { - return true; - } - return false; -} - -function validateCustomComponent(node: ts.Statement): boolean { - if (ts.isIfStatement(node) || - ts.isExpressionStatement(node) && (INNER_COMPONENT_NAMES.has(getName(node)) || - componentCollection.customComponents.has(getName(node)))) { - return true; - } - return false; -} - -function validateBlockNode(node: ts.Statement): boolean { - if (ts.isBlock(node)) { - return true; - } - return false; -} - -function validateSecondNode(node: ts.Statement): boolean { - if (ts.isExpressionStatement(node) && isAttributeNode(node)) { - return true; - } - return false; -} - enum ComponentType { innerComponent, customComponent, @@ -1127,14 +1126,29 @@ enum ComponentType { builderParamMethod } +function isEtsComponent(node: ts.ExpressionStatement): boolean { + let isEtsComponent: boolean = false; + let temp: any = node.expression; + while (temp) { + if (ts.isEtsComponentExpression(temp)) { + isEtsComponent = true; + } + temp = temp.expression; + } + return isEtsComponent; +} + function getComponentType(node: ts.ExpressionStatement, log: LogInfo[], name: string): ComponentType { - if (INNER_COMPONENT_NAMES.has(name)) { - return ComponentType.innerComponent; + if (isEtsComponent(node)) { + if (componentCollection.customComponents.has(name)) { + return ComponentType.customComponent; + } else { + return ComponentType.innerComponent; + } } else if (componentCollection.customComponents.has(name)) { return ComponentType.customComponent; } else if (name === COMPONENT_FOREACH || name === COMPONENT_LAZYFOREACH) { - appComponentCollection.add(name); return ComponentType.forEachComponent; } else if (CUSTOM_BUILDER_METHOD.has(name)) { return ComponentType.customBuilderMethod; @@ -1151,20 +1165,6 @@ function getComponentType(node: ts.ExpressionStatement, log: LogInfo[], return null; } -function validateExtendParameterCount(temp: any, identifierNode: ts.Identifier, propName: string, - log: LogInfo[]): void { - const parameterCount: number = - [...EXTEND_ATTRIBUTE.get(identifierNode.escapedText.toString())].filter(item => - item.attribute === propName)[0].parameterCount; - if (temp.arguments && temp.arguments.length !== parameterCount) { - log.push({ - type: LogType.ERROR, - message: `The '${propName}' is expected ${parameterCount} arguments, but got ${temp.arguments.length}.`, - pos: temp.getStart() - }); - } -} - export function validateStateStyleSyntax(temp: any, log: LogInfo[]): void { log.push({ type: LogType.ERROR, diff --git a/compiler/src/process_component_class.ts b/compiler/src/process_component_class.ts index 9de77666a..dc177f35b 100644 --- a/compiler/src/process_component_class.ts +++ b/compiler/src/process_component_class.ts @@ -31,8 +31,6 @@ import { OBSERVED_PROPERTY_SIMPLE, COMPONENT_BUILD_FUNCTION, BASE_COMPONENT_NAME, - ATTRIBUTE_ANIMATETO, - GLOBAL_CONTEXT, CREATE_CONSTRUCTOR_PARAMS, COMPONENT_CONSTRUCTOR_UPDATE_PARAMS, COMPONENT_CONSTRUCTOR_DELETE_PARAMS, @@ -86,12 +84,12 @@ import { hasDecorator } from './utils'; -export function processComponentClass(node: ts.ClassDeclaration, context: ts.TransformationContext, +export function processComponentClass(node: ts.StructDeclaration, context: ts.TransformationContext, log: LogInfo[], program: ts.Program): ts.ClassDeclaration { validateInheritClass(node, log); const memberNode: ts.ClassElement[] = processMembers(node.members, node.name, context, log, program, checkPreview(node)); - return ts.factory.updateClassDeclaration(node, undefined, node.modifiers, node.name, + return ts.factory.createClassDeclaration(undefined, node.modifiers, node.name, node.typeParameters, updateHeritageClauses(node), memberNode); } @@ -335,7 +333,7 @@ function getGeometryReaderFunctionBlock(node: ts.ArrowFunction | ts.FunctionExpr return processComponentBlock(blockNode, false, log); } -function updateHeritageClauses(node: ts.ClassDeclaration): ts.NodeArray { +function updateHeritageClauses(node: ts.StructDeclaration): ts.NodeArray { const result:ts.HeritageClause[] = []; const heritageClause:ts.HeritageClause = ts.factory.createHeritageClause( ts.SyntaxKind.ExtendsKeyword, @@ -482,7 +480,7 @@ function validateBuildMethodCount(buildCount: BuildCount, parentComponentName: t } } -function validateInheritClass(node: ts.ClassDeclaration, log: LogInfo[]): void { +function validateInheritClass(node: ts.StructDeclaration, log: LogInfo[]): void { if (node.heritageClauses) { log.push({ type: LogType.ERROR, diff --git a/compiler/src/process_component_constructor.ts b/compiler/src/process_component_constructor.ts index 36f56baa3..d75c50cf8 100644 --- a/compiler/src/process_component_constructor.ts +++ b/compiler/src/process_component_constructor.ts @@ -20,9 +20,7 @@ import { COMPONENT_CONSTRUCTOR_PARENT, COMPONENT_CONSTRUCTOR_PARAMS, COMPONENT_CONSTRUCTOR_UPDATE_PARAMS, - COMPONENT_WATCH_FUNCTION, - BASE_COMPONENT_NAME, - INTERFACE_NAME_SUFFIX + COMPONENT_WATCH_FUNCTION } from './pre_define'; export function getInitConstructor(members: ts.NodeArray): ts.ConstructorDeclaration { @@ -32,12 +30,11 @@ export function getInitConstructor(members: ts.NodeArray): ts.Construct if (ctorNode) { ctorNode = updateConstructor(ctorNode, [], [], true); } - return ctorNode; + return initConstructorParams(ctorNode); } export function updateConstructor(ctorNode: ts.ConstructorDeclaration, - para: ts.ParameterDeclaration[], addStatements: ts.Statement[], - isSuper: boolean = false, isAdd: boolean = false, parentComponentName?: ts.Identifier): + para: ts.ParameterDeclaration[], addStatements: ts.Statement[], isSuper: boolean = false): ts.ConstructorDeclaration { let modifyPara: ts.ParameterDeclaration[]; if (para && para.length) { @@ -58,46 +55,29 @@ export function updateConstructor(ctorNode: ts.ConstructorDeclaration, } } if (ctorNode) { - let ctorPara: ts.ParameterDeclaration[] | ts.NodeArray = - modifyPara || ctorNode.parameters; - if (isAdd) { - ctorPara = addParamsType(ctorNode, modifyPara, parentComponentName); - } ctorNode = ts.factory.updateConstructorDeclaration(ctorNode, ctorNode.decorators, - ctorNode.modifiers, ctorPara, ts.factory.createBlock(modifyBody || ctorNode.body.statements, true)); + ctorNode.modifiers, modifyPara || ctorNode.parameters, + ts.factory.createBlock(modifyBody || ctorNode.body.statements, true)); } return ctorNode; } -function addParamsType(ctorNode: ts.ConstructorDeclaration, modifyPara: ts.ParameterDeclaration[], - parentComponentName: ts.Identifier): ts.ParameterDeclaration[] { - const tsPara: ts.ParameterDeclaration[] | ts.NodeArray = - modifyPara || ctorNode.parameters; - const newTSPara: ts.ParameterDeclaration[] = []; - tsPara.forEach((item) => { - let parameter: ts.ParameterDeclaration = item; - switch (item.getText()) { - case COMPONENT_CONSTRUCTOR_ID + '?': - parameter = ts.factory.updateParameterDeclaration(item, item.decorators, item.modifiers, - item.dotDotDotToken, item.name, item.questionToken, - ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), item.initializer); - break; - case COMPONENT_CONSTRUCTOR_PARENT + '?': - parameter = ts.factory.createParameterDeclaration(item.decorators, item.modifiers, - item.dotDotDotToken, item.name, item.questionToken, - ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(BASE_COMPONENT_NAME), undefined), - item.initializer); - break; - case COMPONENT_CONSTRUCTOR_PARAMS + '?': - parameter = ts.factory.updateParameterDeclaration(item, item.decorators, item.modifiers, - item.dotDotDotToken, item.name, item.questionToken, - ts.factory.createTypeReferenceNode(ts.factory.createIdentifier( - parentComponentName.getText() + INTERFACE_NAME_SUFFIX), undefined), item.initializer); - break; - } - newTSPara.push(parameter); +function initConstructorParams(node: ts.ConstructorDeclaration): ts.ConstructorDeclaration { + const paramNames: string[] = [COMPONENT_CONSTRUCTOR_ID, COMPONENT_CONSTRUCTOR_PARENT, + COMPONENT_CONSTRUCTOR_PARAMS]; + const newParameters: ts.ParameterDeclaration[] = Array.from(node.parameters); + if (newParameters.length !== 0) { + // @ts-ignore + newParameters.splice(0, newParameters.length); + } + paramNames.forEach((paramName: string) => { + // @ts-ignore + newParameters.push(ts.factory.createParameterDeclaration(undefined, undefined, undefined, + ts.factory.createIdentifier(paramName), undefined, undefined, undefined)); }); - return newTSPara; + + return ts.factory.updateConstructorDeclaration(node, undefined, node.modifiers, newParameters, + node.body); } export function addConstructor(ctorNode: any, watchMap: Map, @@ -129,5 +109,5 @@ export function addConstructor(ctorNode: any, watchMap: Map, ts.factory.createThis(), ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UPDATE_PARAMS)), undefined, [ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS)])); return updateConstructor(updateConstructor(ctorNode, [], [callSuperStatement], true), [], - [updateWithValueParamsStatement, ...watchStatements], false, true, parentComponentName); + [updateWithValueParamsStatement, ...watchStatements], false); } diff --git a/compiler/src/process_custom_component.ts b/compiler/src/process_custom_component.ts index 34ca61d68..50109765b 100644 --- a/compiler/src/process_custom_component.ts +++ b/compiler/src/process_custom_component.ts @@ -178,6 +178,9 @@ function getCustomComponentName(newNode: ts.NewExpression): string { } function getCollectionSet(name: string, collection: Map>): Set { + if (!collection) { + return new Set([]); + } return collection.get(name) || new Set([]); } diff --git a/compiler/src/process_import.ts b/compiler/src/process_import.ts index eb5bb1ceb..6327b5c16 100644 --- a/compiler/src/process_import.ts +++ b/compiler/src/process_import.ts @@ -89,7 +89,7 @@ export default function processImport(node: ts.ImportDeclaration | ts.ImportEqua fs.readFileSync(fileResolvePath, { encoding: 'utf-8' }).replace( new RegExp('\\b' + STRUCT + '\\b.+\\{', 'g'), item => { return item.replace(new RegExp('\\b' + STRUCT + '\\b', 'g'), `${CLASS} `); - })), fileResolvePath, log); + }))); const sourceFile: ts.SourceFile = ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); visitAllNode(sourceFile, defaultName, asName, path.dirname(fileResolvePath), log); diff --git a/compiler/src/process_ui_syntax.ts b/compiler/src/process_ui_syntax.ts index e3221796c..7a4825d35 100644 --- a/compiler/src/process_ui_syntax.ts +++ b/compiler/src/process_ui_syntax.ts @@ -23,7 +23,6 @@ import { PAGE_ENTRY_FUNCTION_NAME, COMPONENT_CONSTRUCTOR_UNDEFINED, BUILD_ON, - COMPONENT_BUILD_FUNCTION, COMPONENT_BUILDER_DECORATOR, COMPONENT_EXTEND_DECORATOR, COMPONENT_STYLES_DECORATOR, @@ -35,7 +34,9 @@ import { RESOURCE_NAME_PARAMS, RESOURCE_RAWFILE, ATTRIBUTE_ANIMATETO, - GLOBAL_CONTEXT + GLOBAL_CONTEXT, + CHECK_COMPONENT_EXTEND_DECORATOR, + INSTANCE } from './pre_define'; import { componentInfo, @@ -45,18 +46,13 @@ import { FileLog } from './utils'; import { - getName, - isAttributeNode, processComponentBlock, - bindComponentAttr, - appComponentCollection + bindComponentAttr } from './process_component_build'; import { - BUILDIN_CONTAINER_COMPONENT, BUILDIN_STYLE_NAMES, CUSTOM_BUILDER_METHOD, EXTEND_ATTRIBUTE, - JS_BIND_COMPONENTS, INNER_STYLE_FUNCTION, GLOBAL_STYLE_FUNCTION, INTERFACE_NODE_SET @@ -73,20 +69,18 @@ export function processUISyntax(program: ts.Program, ut = false): Function { return (node: ts.SourceFile) => { pagesDir = path.resolve(path.dirname(node.fileName)); if (process.env.compiler === BUILD_ON) { - if (!ut && (path.basename(node.fileName) === 'app.ets.ts' || !/\.ets\.ts$/.test(node.fileName))) { + if (!ut && (path.basename(node.fileName) === 'app.ets' || /\.ts$/.test(node.fileName))) { node = ts.visitEachChild(node, processResourceNode, context); return node; } - collectComponents(node); transformLog.sourceFile = node; - validateSourceFileNode(node); node = createEntryNode(node, context); node = ts.visitEachChild(node, processAllNodes, context); GLOBAL_STYLE_FUNCTION.forEach((block, styleName) => { BUILDIN_STYLE_NAMES.delete(styleName); }); GLOBAL_STYLE_FUNCTION.clear(); - const statements: ts.NodeArray = node.statements; + const statements: ts.Statement[] = Array.from(node.statements); INTERFACE_NODE_SET.forEach(item => { statements.unshift(item); }); @@ -100,8 +94,7 @@ export function processUISyntax(program: ts.Program, ut = false): Function { function processAllNodes(node: ts.Node): ts.Node { if (ts.isImportDeclaration(node) || ts.isImportEqualsDeclaration(node)) { processImport(node, pagesDir, transformLog.errors); - } else if (ts.isClassDeclaration(node) && node.name && - componentCollection.customComponents.has(node.name.getText())) { + } else if (ts.isStructDeclaration(node)) { componentCollection.currentClassName = node.name.getText(); node = processComponentClass(node, context, transformLog.errors, program); componentCollection.currentClassName = null; @@ -144,35 +137,9 @@ export function processUISyntax(program: ts.Program, ut = false): Function { } return ts.visitEachChild(node, processResourceNode, context); } - function validateSourceFileNode(node: ts.SourceFile): void { - if (program) { - node = ts.visitEachChild(node, validateAllNodes, context); - } - } - function validateAllNodes(node: ts.Node): ts.Node { - if (ts.isMethodDeclaration(node) && node.name && - node.name.getText() === COMPONENT_BUILD_FUNCTION && node.body && ts.isBlock(node.body)) { - const typeChecker: ts.TypeChecker = program.getTypeChecker(); - validateBody(node.body, typeChecker); - return node; - } - return ts.visitEachChild(node, validateAllNodes, context); - } }; } -function collectComponents(node: ts.SourceFile): void { - // @ts-ignore - if (node.identifiers && node.identifiers.size) { - // @ts-ignore - for (const key of node.identifiers.keys()) { - if (JS_BIND_COMPONENTS.has(key)) { - appComponentCollection.add(key); - } - } - } -} - function isResource(node: ts.Node): boolean { return ts.isCallExpression(node) && ts.isIdentifier(node.expression) && (node.expression.escapedText.toString() === RESOURCE || @@ -285,29 +252,51 @@ function processAnimateTo(node: ts.CallExpression): ts.CallExpression { function processExtend(node: ts.FunctionDeclaration, log: LogInfo[]): ts.FunctionDeclaration { const componentName: string = isExtendFunction(node); - if (componentName) { + if (componentName && node.body && node.body.statements.length) { const statementArray: ts.Statement[] = []; - bindComponentAttr(node.body.statements[0] as ts.ExpressionStatement, + const attrSet: ts.CallExpression = node.body.statements[0].expression; + const changeCompName: ts.ExpressionStatement = ts.factory.createExpressionStatement(processExtendBody(attrSet)); + bindComponentAttr(changeCompName as ts.ExpressionStatement, ts.factory.createIdentifier(componentName), statementArray, log); + let extendFunctionName: string; + if (node.name.getText().startsWith('__' + componentName + '__')) { + extendFunctionName = node.name.getText(); + } else { + extendFunctionName = '__' + componentName + '__' + node.name.getText(); + collectExtend(EXTEND_ATTRIBUTE, componentName, node.name.escapedText.toString()); + } return ts.factory.updateFunctionDeclaration(node, undefined, node.modifiers, node.asteriskToken, - node.name, node.typeParameters, node.parameters, node.type, - ts.factory.updateBlock(node.body, statementArray)); + ts.factory.createIdentifier(extendFunctionName), node.typeParameters, + node.parameters, node.type, ts.factory.updateBlock(node.body, statementArray)); + } +} + +function processExtendBody(node: ts.Node): ts.Expression { + switch (node.kind) { + case ts.SyntaxKind.CallExpression: + return ts.factory.createCallExpression(processExtendBody(node.expression), undefined, node.arguments); + case ts.SyntaxKind.PropertyAccessExpression: + return ts.factory.createPropertyAccessExpression(processExtendBody(node.expression), node.name); + case ts.SyntaxKind.Identifier: + return ts.factory.createIdentifier(node.escapedText.toString().replace(INSTANCE, '')); + } +} + +export function collectExtend(collectionSet: Map>, component: string, attribute: string): void { + if (collectionSet.has(component)) { + collectionSet.get(component).add(attribute); + } else { + collectionSet.set(component, new Set([attribute])); } } function isExtendFunction(node: ts.FunctionDeclaration): string { - if (ts.isBlock(node.body) && node.body.statements && node.body.statements.length === 1 && - ts.isExpressionStatement(node.body.statements[0]) && - // @ts-ignore - ts.isCallExpression(node.body.statements[0].expression) && ts.isIdentifier(node.name)) { - const nameArray: string[] = node.name.getText().split('__'); - if (nameArray.length === 3 && !nameArray[0] && EXTEND_ATTRIBUTE.has(nameArray[1])) { - const attributeArray: string[] = - [...EXTEND_ATTRIBUTE.get(nameArray[1])].map(item => item.attribute); - if (attributeArray.includes(nameArray[2])) { - return nameArray[1]; - } - } + if (node.decorators && node.decorators[0].expression && + node.decorators[0].expression.expression.escapedText.toString() === CHECK_COMPONENT_EXTEND_DECORATOR && + node.decorators[0].expression.arguments) { + return node.decorators[0].expression.arguments[0].escapedText.toString(); + } else { + return null; } } @@ -325,122 +314,6 @@ function createEntryNode(node: ts.SourceFile, context: ts.TransformationContext) } } -function validateBody(node: ts.Block, typeChecker: ts.TypeChecker): void { - if (node.statements.length) { - node.statements.forEach((item, index, arr) => { - if (ts.isBlock(item)) { - validateBody(item, typeChecker); - } - if (index + 2 < arr.length && ts.isExpressionStatement(item) && - isAttributeBlockNode(item, arr as ts.Statement[], index) && - ts.isCallExpression(item.expression) && ts.isIdentifier(item.expression.expression)) { - const componentName: string = item.expression.expression.getText(); - const type: ts.Type = typeChecker.getTypeAtLocation(item.expression); - let temp: any = arr[index + 2]; - let name: string; - while (temp) { - if (ts.isCallExpression(temp)) { - if (ts.isPropertyAccessExpression(temp.expression)) { - const pos: number = temp.expression.name.getStart(); - name = temp.expression.name.getText(); - validateSymbol(isPropertyExist(typeChecker, pos, type, name, componentName), - temp.arguments, pos, typeChecker); - } else if (ts.isIdentifier(temp.expression)) { - const pos: number = temp.expression.getStart(); - name = temp.expression.getText(); - validateSymbol(isPropertyExist(typeChecker, pos, type, name, componentName), - temp.arguments, pos, typeChecker); - break; - } - } - temp = temp.expression; - } - } - }); - } -} - -function validateSymbol(type: ts.Symbol, args: ts.NodeArray, - argPos: number, typeChecker: ts.TypeChecker): void { - // @ts-ignore - if (type && type.valueDeclaration.parameters) { - // @ts-ignore - const parameters: ts.ParameterDeclaration[] = type.valueDeclaration.parameters; - const maxLength: number = parameters.length; - const minLength: number = getMinLength(parameters); - if (args.length < minLength || args.length > maxLength) { - let message:string; - if (maxLength !== minLength) { - message = `TS2554: Expected ${minLength}-${maxLength} arguments, but got ${args.length}.`; - } else { - message = `TS2554: Expected ${maxLength} arguments, but got ${args.length}.`; - } - transformLog.errors.push({ - type: LogType.ERROR, - message: message, - pos: argPos - }); - } else { - for (let i = 0; i < parameters.length; i++) { - validatePropertyType(parameters[i], args[i], typeChecker); - } - } - } -} - -function getMinLength(parameters: ts.ParameterDeclaration[]): number { - let length: number = parameters.length; - parameters.forEach((item: ts.ParameterDeclaration) => { - if (item.questionToken !== undefined) { - length--; - } - }); - return length; -} - -function isPropertyExist(typeChecker: ts.TypeChecker, pos: number, type: ts.Type, - propertyName: string, componentName: string): ts.Symbol { - const symbol: ts.Symbol = typeChecker.getPropertyOfType(type, propertyName); - if (symbol) { - return symbol; - } else { - transformLog.errors.push({ - type: LogType.ERROR, - message: `TS2339: Property '${propertyName}' does not exist on type '${componentName}Attribute'.`, - pos: pos - }); - } - return null; -} - -function validatePropertyType(param: ts.ParameterDeclaration, arg: ts.Expression, - typeChecker: ts.TypeChecker): void { - const argLocalType: ts.Type = typeChecker.getTypeAtLocation(arg); - const paramLocalType: ts.Type = typeChecker.getTypeAtLocation(param.type); - const argType: ts.Type = typeChecker.getBaseTypeOfLiteralType(typeChecker.getTypeAtLocation(arg)); - // @ts-ignore - const intrinsicName: string = argType.intrinsicName; - const argTypeName: string = intrinsicName || typeChecker.typeToString(argLocalType); - // @ts-ignore - if (!typeChecker.isTypeAssignableTo(argLocalType, paramLocalType)) { - generateArgumentLog(arg, argTypeName, typeChecker.typeToString(paramLocalType)); - } -} - -function generateArgumentLog(arg: ts.Expression, argTypeName: string, paramTypeName: string): void { - transformLog.errors.push({ - type: LogType.ERROR, - message: `TS2345: Argument of type '${argTypeName}' is not assignable to parameter of type '${paramTypeName}'.`, - pos: arg.getStart() - }); -} - -function isAttributeBlockNode(node: ts.ExpressionStatement, arr: ts.Statement[], index: number): boolean { - const attributeNode: ts.Node = arr[index + 2]; - return BUILDIN_CONTAINER_COMPONENT.has(getName(node)) && ts.isBlock(arr[index + 1]) - && ts.isExpressionStatement(attributeNode) && isAttributeNode(attributeNode); -} - function createEntryFunction(name: string, context: ts.TransformationContext) : ts.ExpressionStatement { return context.factory.createExpressionStatement(context.factory.createCallExpression( diff --git a/compiler/src/result_process.ts b/compiler/src/result_process.ts index 8e80ed3f6..fe96bf2a0 100644 --- a/compiler/src/result_process.ts +++ b/compiler/src/result_process.ts @@ -52,7 +52,7 @@ module.exports = function resultProcess(source: string, map: any): void { item.line = undefined; item.column = undefined; } - item.fileName = sourceFile.fileName.replace(/.ts$/, ''); + item.fileName = sourceFile.fileName; return item; }); emitLogInfo(this, logInfos); diff --git a/compiler/src/utils.ts b/compiler/src/utils.ts index 7f083c399..59e5b9b66 100644 --- a/compiler/src/utils.ts +++ b/compiler/src/utils.ts @@ -112,11 +112,11 @@ class ComponentInfo { export const componentInfo: ComponentInfo = new ComponentInfo(); -export function hasDecorator(node: ts.MethodDeclaration | ts.FunctionDeclaration | ts.ClassDeclaration, - decortorName: string): boolean { +export function hasDecorator(node: ts.MethodDeclaration | ts.FunctionDeclaration | + ts.StructDeclaration | ts.ClassDeclaration, decortorName: string): boolean { if (node.decorators && node.decorators.length) { for (let i = 0; i < node.decorators.length; i++) { - if (node.decorators[i].getText() === decortorName) { + if (node.decorators[i].getText().replace(/\(.*\)$/, '').trim() === decortorName) { return true; } } diff --git a/compiler/src/validate_ui_syntax.ts b/compiler/src/validate_ui_syntax.ts index 7efd1f804..f47383a0a 100644 --- a/compiler/src/validate_ui_syntax.ts +++ b/compiler/src/validate_ui_syntax.ts @@ -22,8 +22,6 @@ import { COMPONENT_DECORATOR_PREVIEW, COMPONENT_DECORATOR_COMPONENT, COMPONENT_DECORATOR_CUSTOM_DIALOG, - STRUCT, - CLASS, NATIVE_MODULE, SYSTEM_PLUGIN, OHOS_PLUGIN, @@ -38,9 +36,6 @@ import { COMPONENT_PROVIDE_DECORATOR, COMPONENT_CONSUME_DECORATOR, COMPONENT_OBJECT_LINK_DECORATOR, - COMPONENT_CONSTRUCTOR_ID, - COMPONENT_CONSTRUCTOR_PARENT, - COMPONENT_CONSTRUCTOR_PARAMS, COMPONENT_OBSERVED_DECORATOR, STYLES, VALIDATE_MODULE, @@ -65,7 +60,7 @@ import { hasDecorator } from './utils'; import { projectConfig } from '../main'; -const parser = require('../syntax_parser/dist/exclude_comment.js'); +import { collectExtend } from './process_ui_syntax'; export interface ComponentCollection { entryComponent: string; @@ -137,7 +132,7 @@ function checkComponentDecorator(source: string, filePath: string, fileQuery: string): LogInfo[] | null { const log: LogInfo[] = []; const sourceFile: ts.SourceFile = ts.createSourceFile(filePath, source, - ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + ts.ScriptTarget.Latest, true, ts.ScriptKind.ETS); if (sourceFile && sourceFile.statements && sourceFile.statements.length) { const result: DecoratorResult = { entryCount: 0, @@ -151,26 +146,17 @@ function checkComponentDecorator(source: string, filePath: string, if (ts.isEnumDeclaration(item) && item.name) { enumCollection.add(item.name.getText()); } - if (isStruct(item)) { - if (index + 1 < arr.length && ts.isExpressionStatement(arr[index + 1]) && - // @ts-ignore - arr[index + 1].expression && ts.isIdentifier(arr[index + 1].expression)) { - if (ts.isExportAssignment(item) && hasComponentDecorator(item)) { - checkDecorators(item, result, arr[index + 1] as ts.ExpressionStatement, log, sourceFile); - } else if (index > 0 && hasComponentDecorator(arr[index - 1])) { - checkDecorators(arr[index - 1] as ts.MissingDeclaration, result, - arr[index + 1] as ts.ExpressionStatement, log, sourceFile); + if (ts.isStructDeclaration(item)) { + if (item.name && ts.isIdentifier(item.name)) { + if (item.decorators && item.decorators.length) { + checkDecorators(item.decorators, result, item.name, log, sourceFile); } else { - // @ts-ignore - const pos: number = item.expression.getStart(); const message: string = `A struct should use decorator '@Component'.`; - addLog(LogType.WARN, message, pos, log, sourceFile); + addLog(LogType.WARN, message, item.getStart(), log, sourceFile); } } else { - // @ts-ignore - const pos: number = item.expression.getStart(); const message: string = `A struct must have a name.`; - addLog(LogType.ERROR, message, pos, log, sourceFile); + addLog(LogType.ERROR, message, item.getStart(), log, sourceFile); } } if (ts.isMissingDeclaration(item)) { @@ -245,32 +231,16 @@ export function isCustomDialogClass(node: ts.Node): boolean { return false; } -function isStruct(node: ts.Node): boolean { - if ((ts.isExpressionStatement(node) || ts.isExportAssignment(node)) && - node.expression && ts.isIdentifier(node.expression) && node.expression.getText() === STRUCT) { - return true; - } - return false; -} - -function hasComponentDecorator(node: ts.Node): boolean { - if ((ts.isMissingDeclaration(node) || ts.isExportAssignment(node)) && - node.decorators && node.decorators.length) { - return true; - } - return false; -} - interface DecoratorResult { entryCount: number; previewCount: number; } -function checkDecorators(node: ts.MissingDeclaration | ts.ExportAssignment, result: DecoratorResult, - component: ts.ExpressionStatement, log: LogInfo[], sourceFile: ts.SourceFile): void { +function checkDecorators(decorators: ts.NodeArray, result: DecoratorResult, + component: ts.Identifier, log: LogInfo[], sourceFile: ts.SourceFile): void { let hasComponentDecorator: boolean = false; const componentName: string = component.getText(); - node.decorators.forEach((element) => { + decorators.forEach((element) => { const name: string = element.getText().replace(/\([^\(\)]*\)/, '').trim(); if (INNER_COMPONENT_DECORATORS.has(name)) { componentCollection.customComponents.add(componentName); @@ -316,14 +286,14 @@ function checkDecorators(node: ts.MissingDeclaration | ts.ExportAssignment, resu function checkUISyntax(filePath: string, allComponentNames: Set, content: string, log: LogInfo[]): void { const sourceFile: ts.SourceFile = ts.createSourceFile(filePath, content, - ts.ScriptTarget.Latest, true, ts.ScriptKind.TS); + ts.ScriptTarget.Latest, true, ts.ScriptKind.ETS); visitAllNode(sourceFile, sourceFile, allComponentNames, log); } function visitAllNode(node: ts.Node, sourceFileNode: ts.SourceFile, allComponentNames: Set, log: LogInfo[]) { checkAllNode(node, allComponentNames, sourceFileNode, log); - if (ts.isClassDeclaration(node) && node.name && ts.isIdentifier(node.name)) { + if (ts.isStructDeclaration(node) && node.name && ts.isIdentifier(node.name)) { collectComponentProps(node); } if (ts.isMethodDeclaration(node) && hasDecorator(node, COMPONENT_BUILDER_DECORATOR)) { @@ -335,7 +305,7 @@ function visitAllNode(node: ts.Node, sourceFileNode: ts.SourceFile, allComponent function checkAllNode(node: ts.Node, allComponentNames: Set, sourceFileNode: ts.SourceFile, log: LogInfo[]): void { if (ts.isExpressionStatement(node) && node.expression && ts.isIdentifier(node.expression) && - allComponentNames.has(node.expression.escapedText.toString())) { + allComponentNames.has(node.expression.escapedText.toString())) { const pos: number = node.expression.getStart(); const message: string = `The component name must be followed by parentheses, like '${node.expression.getText()}()'.`; @@ -629,7 +599,7 @@ function isNonspecificChildIfStatement(node: ts.Node, specificChildSet: Set = new Set(); const states: Set = new Set(); const links: Set = new Set(); @@ -663,7 +633,7 @@ export function getComponentSet(node: ts.ClassDeclaration): IComponentSet { }; } -function traversalComponentProps(node: ts.ClassDeclaration, propertys: Set, +function traversalComponentProps(node: ts.StructDeclaration, propertys: Set, regulars: Set, states: Set, links: Set, props: Set, storageProps: Set, storageLinks: Set, provides: Set, consumes: Set, objectLinks: Set): void { @@ -736,14 +706,7 @@ export interface ReplaceResult { export function sourceReplace(source: string, sourcePath: string): ReplaceResult { let content: string = source; const log: LogInfo[] = []; - // replace struct->class - content = content.replace( - new RegExp('\\b' + STRUCT + '\\b.+\\{', 'g'), item => { - item = item.replace(new RegExp('\\b' + STRUCT + '\\b', 'g'), `${CLASS} `); - return `${item} constructor(${COMPONENT_CONSTRUCTOR_ID}?, ${COMPONENT_CONSTRUCTOR_PARENT}?, ${COMPONENT_CONSTRUCTOR_PARAMS}?) {}`; - }); - - content = preprocessExtend(content, sourcePath, log); + content = preprocessExtend(content); // process @system. content = processSystemApi(content); @@ -753,57 +716,16 @@ export function sourceReplace(source: string, sourcePath: string): ReplaceResult }; } -export function preprocessExtend(content: string, sourcePath: string, log: LogInfo[]): string { - let syntaxCheckContent: string; - let result: any; - try { - result = parser.parse(content); - syntaxCheckContent = result.content; - for (let i = 0; i < result.collect_extend.component.length; i++) { - collectExtend( - result.collect_extend.component[i], - result.collect_extend.functionName[i], - result.collect_extend.parameters[i] - ); +export function preprocessExtend(content: string, extendCollection?: Set): string { + const REG_EXTEND: RegExp = /@Extend(\s+)([^\.\s]+)\.([^\(]+)\(/gm; + return content.replace(REG_EXTEND, (item, item1, item2, item3) => { + collectExtend(EXTEND_ATTRIBUTE, item2, '__' + item2 + '__' + item3); + collectExtend(EXTEND_ATTRIBUTE, item2, item3); + if (extendCollection) { + extendCollection.add(item3); } - } catch (err) { - result = err; - log.push({ - type: LogType.ERROR, - message: parser.SyntaxError.buildMessage(err.expected, err.found), - line: err.location.start.line, - column: err.location.start.column, - fileName: sourcePath - }); - syntaxCheckContent = content; - } - if (result.error_otherParsers) { - for (let i = 0; i < result.error_otherParsers.length; i++) { - log.push({ - type: LogType.ERROR, - message: result.error_otherParsers[i].errMessage, - line: result.error_otherParsers[i].errPosition.line, - column: result.error_otherParsers[i].errPosition.column, - fileName: sourcePath - }); - } - } - return syntaxCheckContent; -} - -function collectExtend(component: string, attribute: string, parameter: string): void { - let parameterCount: number; - if (parameter) { - parameterCount = parameter.split(',').length; - } else { - parameterCount = 0; - } - BUILDIN_STYLE_NAMES.add(attribute); - if (EXTEND_ATTRIBUTE.has(component)) { - EXTEND_ATTRIBUTE.get(component).add({ attribute, parameterCount }); - } else { - EXTEND_ATTRIBUTE.set(component, new Set([{ attribute, parameterCount }])); - } + return `@Extend(${item2})${item1}function __${item2}__${item3}(`; + }); } export function processSystemApi(content: string, isProcessWhiteList: boolean = false): string { diff --git a/compiler/test/test.js b/compiler/test/test.js index 0a6506aa0..99f5e2417 100644 --- a/compiler/test/test.js +++ b/compiler/test/test.js @@ -38,11 +38,14 @@ function expectActual(name, filePath) { process.env.compiler = BUILD_ON; const afterProcess = sourceReplace(source); validateUISyntax(source, afterProcess.content, `${name}.ts`); + const compilerOptions = ts.readConfigFile( + path.resolve(__dirname, '../tsconfig.json'), ts.sys.readFile).config.compilerOptions; + Object.assign(compilerOptions, { + "sourceMap": false, + }); const result = ts.transpileModule(afterProcess.content, { - compilerOptions: { - "target": ts.ScriptTarget.ES2017 - }, - fileName: `${name}.ts`, + compilerOptions: compilerOptions, + fileName: `${name}.ets`, transformers: { before: [processUISyntax(null, true)] } }); componentInfo.id = 0; diff --git a/compiler/test/ut/component/customComponent.ts b/compiler/test/ut/component/customComponent.ts index bdf19913b..2ffe6bd36 100644 --- a/compiler/test/ut/component/customComponent.ts +++ b/compiler/test/ut/component/customComponent.ts @@ -25,8 +25,7 @@ struct Parent { Row() { Child({ stateProperty: this.regularToState, propProperty: this.stateToProp, - regularProperty: this.regularToRegular, - linkProperty: this.$stateToLink + regularProperty: this.regularToRegular, linkProperty: this.__stateToLink }) } } @@ -91,8 +90,7 @@ exports.expectResult = if (earlierCreatedChild_2 == undefined) { View.create(new Child("2", this, { stateProperty: this.regularToState, propProperty: this.stateToProp, - regularProperty: this.regularToRegular, - linkProperty: this.__stateToLink + regularProperty: this.regularToRegular, linkProperty: this.__stateToLink })); } else { diff --git a/compiler/test/ut/struct/struct_02.ts b/compiler/test/ut/struct/struct_02.ts index 175a1085d..2ddd86ac9 100644 --- a/compiler/test/ut/struct/struct_02.ts +++ b/compiler/test/ut/struct/struct_02.ts @@ -20,9 +20,17 @@ struct MyComponent { }` exports.expectResult = -`class MyComponent { - constructor(compilerAssignedUniqueChildId, parent, params) { } - build() { +`class MyComponent extends View { + constructor(compilerAssignedUniqueChildId, parent, params) { + super(compilerAssignedUniqueChildId, parent); + this.updateWithValueParams(params); + } + updateWithValueParams(params) { + } + aboutToBeDeleted() { + SubscriberManager.Get().delete(this.id()); + } + render() { } } ` diff --git a/compiler/tsconfig.json b/compiler/tsconfig.json index 822f29fa5..b53c39d76 100644 --- a/compiler/tsconfig.json +++ b/compiler/tsconfig.json @@ -1,6 +1,544 @@ { "compileOnSave": false, "compilerOptions": { + "ets": { + "render": { + "method": ["build", "pageTransition"], + "decorator": "Builder" + }, + "components": [ + "AbilityComponent", + "AlphabetIndexer", + "Animator", + "Badge", + "Blank", + "Button", + "Calendar", + "Camera", + "Canvas", + "Checkbox", + "CheckboxGroup", + "Circle", + "ColorPicker", + "ColorPickerDialog", + "Column", + "ColumnSplit", + "Counter", + "DataPanel", + "DatePicker", + "Divider", + "Ellipse", + "Flex", + "FormComponent", + "FrictionMotion", + "Gauge", + "GeometryView", + "Grid", + "GridItem", + "GridContainer", + "Hyperlink", + "Image", + "ImageAnimator", + "Line", + "List", + "ListItem", + "LoadingProgress", + "Marquee", + "Menu", + "Navigation", + "Navigator", + "Option", + "PageTransitionEnter", + "PageTransitionExit", + "Panel", + "Path", + "PatternLock", + "Piece", + "PluginComponent", + "Polygon", + "Polyline", + "Progress", + "QRCode", + "Radio", + "Rating", + "Rect", + "Refresh", + "Row", + "RowSplit", + "RichText", + "Scroll", + "ScrollBar", + "ScrollMotion", + "Search", + "Section", + "Select", + "Shape", + "Sheet", + "SideBarContainer", + "Slider", + "Span", + "Stack", + "Stepper", + "StepperItem", + "Swiper", + "TabContent", + "Tabs", + "Text", + "TextPicker", + "TextClock", + "TextArea", + "TextInput", + "TextTimer", + "Toggle", + "Video", + "Web", + "XComponent" + ], + "extend": { + "decorator": "Extend", + "components": [ + { + "name": "AbilityComponent", + "type": "AbilityComponentAttribute", + "instance": "AbilityComponentInstance" + }, + { + "name": "AlphabetIndexer", + "type": "AlphabetIndexerAttribute", + "instance": "AlphabetIndexerInstance" + }, + { + "name": "Animator", + "type": "AnimatorAttribute", + "instance": "AnimatorInstance" + }, + { + "name": "Badge", + "type": "BadgeAttribute", + "instance": "BadgeInstance" + }, + { + "name": "Blank", + "type": "BlankAttribute", + "instance": "BlankInstance" + }, + { + "name": "Button", + "type": "ButtonAttribute", + "instance": "ButtonInstance" + }, + { + "name": "Calendar", + "type": "CalendarAttribute", + "instance": "CalendarInstance" + }, + { + "name": "Camera", + "type": "CameraAttribute", + "instance": "CameraInstance" + }, + { + "name": "Canvas", + "type": "CanvasAttribute", + "instance": "CanvasInstance" + }, + { + "name": "Checkbox", + "type": "CheckboxAttribute", + "instance": "CheckboxInstance" + }, + { + "name": "CheckboxGroup", + "type": "CheckboxGroupAttribute", + "instance": "CheckboxGroupInstance" + }, + { + "name": "Circle", + "type": "CircleAttribute", + "instance": "CircleInstance" + }, + { + "name": "ColorPicker", + "type": "ColorPickerAttribute", + "instance": "ColorPickerInstance" + }, + { + "name": "ColorPickerDialog", + "type": "ColorPickerDialogAttribute", + "instance": "ColorPickerDialogInstance" + }, + { + "name": "Column", + "type": "ColumnAttribute", + "instance": "ColumnInstance" + }, + { + "name": "ColumnSplit", + "type": "ColumnSplitAttribute", + "instance": "ColumnSplitInstance" + }, + { + "name": "Counter", + "type": "CounterAttribute", + "instance": "CounterInstance" + }, + { + "name": "DataPanel", + "type": "DataPanelAttribute", + "instance": "DataPanelInstance" + }, + { + "name": "DatePicker", + "type": "DatePickerAttribute", + "instance": "DatePickerInstance" + }, + { + "name": "Divider", + "type": "DividerAttribute", + "instance": "DividerInstance" + }, + { + "name": "Ellipse", + "type": "EllipseAttribute", + "instance": "EllipseInstance" + }, + { + "name": "Flex", + "type": "FlexAttribute", + "instance": "FlexInstance" + }, + { + "name": "FormComponent", + "type": "FormComponentAttribute", + "instance": "FormComponentInstance" + }, + { + "name": "FrictionMotion", + "type": "FrictionMotionAttribute", + "instance": "FrictionMotionInstance" + }, + { + "name": "Gauge", + "type": "GaugeAttribute", + "instance": "GaugeInstance" + }, + { + "name": "GeometryView", + "type": "GeometryViewAttribute", + "instance": "GeometryViewInstance" + }, + { + "name": "Grid", + "type": "GridAttribute", + "instance": "GridInstance" + }, + { + "name": "GridItem", + "type": "GridItemAttribute", + "instance": "GridItemInstance" + }, + { + "name": "GridContainer", + "type": "GridContainerAttribute", + "instance": "GridContainerInstance" + }, + { + "name": "Hyperlink", + "type": "HyperlinkAttribute", + "instance": "HyperlinkInstance" + }, + { + "name": "Image", + "type": "ImageAttribute", + "instance": "ImageInstance" + }, + { + "name": "ImageAnimator", + "type": "ImageAnimatorAttribute", + "instance": "ImageAnimatorInstance" + }, + { + "name": "Line", + "type": "LineAttribute", + "instance": "LineInstance" + }, + { + "name": "List", + "type": "ListAttribute", + "instance": "ListInstance" + }, + { + "name": "ListItem", + "type": "ListItemAttribute", + "instance": "ListItemInstance" + }, + { + "name": "LoadingProgress", + "type": "LoadingProgressAttribute", + "instance": "LoadingProgressInstance" + }, + { + "name": "Marquee", + "type": "MarqueeAttribute", + "instance": "MarqueeInstance" + }, + { + "name": "Menu", + "type": "MenuAttribute", + "instance": "MenuInstance" + }, + { + "name": "Navigation", + "type": "NavigationAttribute", + "instance": "NavigationInstance" + }, + { + "name": "Navigator", + "type": "NavigatorAttribute", + "instance": "NavigatorInstance" + }, + { + "name": "Option", + "type": "OptionAttribute", + "instance": "OptionInstance" + }, + { + "name": "PageTransitionEnter", + "type": "PageTransitionEnterAttribute", + "instance": "PageTransitionEnterInstance" + }, + { + "name": "PageTransitionExit", + "type": "PageTransitionExitAttribute", + "instance": "PageTransitionExitInstance" + }, + { + "name": "Panel", + "type": "PanelAttribute", + "instance": "PanelInstance" + }, + { + "name": "Path", + "type": "PathAttribute", + "instance": "PathInstance" + }, + { + "name": "PatternLock", + "type": "PatternLockAttribute", + "instance": "PatternLockInstance" + }, + { + "name": "Piece", + "type": "PieceAttribute", + "instance": "PieceInstance" + }, + { + "name": "PluginComponent", + "type": "PluginComponentAttribute", + "instance": "PluginComponentInstance" + }, + { + "name": "Polygon", + "type": "PolygonAttribute", + "instance": "PolygonInstance" + }, + { + "name": "Polyline", + "type": "PolylineAttribute", + "instance": "PolylineInstance" + }, + { + "name": "Progress", + "type": "ProgressAttribute", + "instance": "ProgressInstance" + }, + { + "name": "QRCode", + "type": "QRCodeAttribute", + "instance": "QRCodeInstance" + }, + { + "name": "Radio", + "type": "RadioAttribute", + "instance": "RadioInstance" + }, + { + "name": "Rating", + "type": "RatingAttribute", + "instance": "RatingInstance" + }, + { + "name": "Rect", + "type": "RectAttribute", + "instance": "RectInstance" + }, + { + "name": "Refresh", + "type": "RefreshAttribute", + "instance": "RefreshInstance" + }, + { + "name": "Row", + "type": "RowAttribute", + "instance": "RowInstance" + }, + { + "name": "RowSplit", + "type": "RowSplitAttribute", + "instance": "RowSplitInstance" + }, + { + "name": "RichText", + "type": "RichTextAttribute", + "instance": "RichTextInstance" + }, + { + "name": "Scroll", + "type": "ScrollAttribute", + "instance": "ScrollInstance" + }, + { + "name": "ScrollBar", + "type": "ScrollBarAttribute", + "instance": "ScrollBarInstance" + }, + { + "name": "ScrollMotion", + "type": "ScrollMotionAttribute", + "instance": "ScrollMotionInstance" + }, + { + "name": "Search", + "type": "SearchAttribute", + "instance": "SearchInstance" + }, + { + "name": "Section", + "type": "SectionAttribute", + "instance": "SectionInstance" + }, + { + "name": "Select", + "type": "SelectAttribute", + "instance": "SelectInstance" + }, + { + "name": "Shape", + "type": "ShapeAttribute", + "instance": "ShapeInstance" + }, + { + "name": "Sheet", + "type": "SheetAttribute", + "instance": "SheetInstance" + }, + { + "name": "SideBarContainer", + "type": "SideBarContainerAttribute", + "instance": "SideBarContainerInstance" + }, + { + "name": "Slider", + "type": "SliderAttribute", + "instance": "SliderInstance" + }, + { + "name": "Span", + "type": "SpanAttribute", + "instance": "SpanInstance" + }, + { + "name": "Stack", + "type": "StackAttribute", + "instance": "StackInstance" + }, + { + "name": "Stepper", + "type": "StepperAttribute", + "instance": "StepperInstance" + }, + { + "name": "StepperItem", + "type": "StepperItemAttribute", + "instance": "StepperItemInstance" + }, + { + "name": "Swiper", + "type": "SwiperAttribute", + "instance": "SwiperInstance" + }, + { + "name": "TabContent", + "type": "TabContentAttribute", + "instance": "TabContentInstance" + }, + { + "name": "Tabs", + "type": "TabsAttribute", + "instance": "TabsInstance" + }, + { + "name": "Text", + "type": "TextAttribute", + "instance": "TextInstance" + }, + { + "name": "TextPicker", + "type": "TextPickerAttribute", + "instance": "TextPickerInstance" + }, + { + "name": "TextClock", + "type": "TextClockAttribute", + "instance": "TextClockInstance" + }, + { + "name": "TextArea", + "type": "TextAreaAttribute", + "instance": "TextAreaInstance" + }, + { + "name": "TextInput", + "type": "TextInputAttribute", + "instance": "TextInputInstance" + }, + { + "name": "TextTimer", + "type": "TextTimerAttribute", + "instance": "TextTimerInstance" + }, + { + "name": "Toggle", + "type": "ToggleAttribute", + "instance": "ToggleInstance" + }, + { + "name": "Video", + "type": "VideoAttribute", + "instance": "VideoInstance" + }, + { + "name": "Web", + "type": "WebAttribute", + "instance": "WebInstance" + }, + { + "name": "XComponent", + "type": "XComponentAttribute", + "instance": "XComponentInstance" + }, + ] + }, + "styles": { + "decorator": "Styles", + "component": { + "name": "Common", + "type": "T", + "instance": "CommonInstance" + }, + "property": "stateStyles" + }, + }, "allowJs": true, "allowSyntheticDefaultImports": true, "esModuleInterop": true, @@ -11,6 +549,7 @@ "experimentalDecorators": true, "moduleResolution": "node", "resolveJsonModule": true, + "skipLibCheck": true, "sourceMap": true, "module": "commonjs", "target": "es2017", diff --git a/compiler/webpack.config.js b/compiler/webpack.config.js index 94a1ed29f..405325fc7 100644 --- a/compiler/webpack.config.js +++ b/compiler/webpack.config.js @@ -40,6 +40,9 @@ function initConfig(config) { const projectPath = path.resolve(projectConfig.projectPath); Object.assign(config, { entry: projectConfig.entryObj, + cache: { + type: "filesystem" + }, watch: watchMode, watchOptions: { aggregateTimeout: 10, @@ -67,8 +70,8 @@ function initConfig(config) { { loader: 'ts-loader', options: { - appendTsSuffixTo: [/\.ets$/], onlyCompileBundledFiles: true, + transpileOnly: true, configFile: path.resolve(__dirname, 'tsconfig.json'), getCustomTransformers(program) { return { -- Gitee From 6e7fb30427dc0dd6792b0abdfed0a9b2397f99f8 Mon Sep 17 00:00:00 2001 From: yaoyuchi Date: Sat, 12 Mar 2022 17:57:42 +0800 Subject: [PATCH 25/42] add TimePicker Signed-off-by: yaoyuchi --- compiler/components/timePicker.json | 4 ++++ compiler/src/component_map.ts | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 compiler/components/timePicker.json diff --git a/compiler/components/timePicker.json b/compiler/components/timePicker.json new file mode 100644 index 000000000..e03ec3f6f --- /dev/null +++ b/compiler/components/timePicker.json @@ -0,0 +1,4 @@ +{ + "name": "TimePicker", + "attrs": ["onChange", "useMilitaryTime"] +} \ No newline at end of file diff --git a/compiler/src/component_map.ts b/compiler/src/component_map.ts index c7fe3d1b0..8d8360848 100644 --- a/compiler/src/component_map.ts +++ b/compiler/src/component_map.ts @@ -86,7 +86,8 @@ export const JS_BIND_COMPONENTS: Set = new Set([ 'TabsController', 'CalendarController', 'AbilityController', 'VideoController', 'WebController', 'XComponentController', 'CanvasRenderingContext2D', 'CanvasGradient', 'ImageBitmap', 'ImageData', 'Path2D', 'RenderingContextSettings', 'OffscreenCanvasRenderingContext2D', 'DatePickerDialog', - 'TextPickerDialog', 'AlertDialog', 'ContextMenu', 'ActionSheet', 'PatternLockController' + 'TextPickerDialog', 'AlertDialog', 'ContextMenu', 'ActionSheet', 'PatternLockController', + 'TimePickerDialog' ]); export const NEEDPOP_COMPONENT: Set = new Set(['Blank', 'Search']); -- Gitee From cefd0ff5c3edeaebfe4eeb42ac2c11dd42590eb6 Mon Sep 17 00:00:00 2001 From: laibo102 Date: Sun, 13 Mar 2022 09:47:26 +0800 Subject: [PATCH 26/42] =?UTF-8?q?fixbug:=20tsconfig=20=E4=B8=AD=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E2=80=98node=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: laibo102 Change-Id: I545cd785003f8aa5a6e316110ea9292f0b39d5dc --- compiler/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/tsconfig.json b/compiler/tsconfig.json index 1664725da..822f29fa5 100644 --- a/compiler/tsconfig.json +++ b/compiler/tsconfig.json @@ -14,7 +14,7 @@ "sourceMap": true, "module": "commonjs", "target": "es2017", - "types": ["node"], + "types": [], "typeRoots": [], "lib": [ "es2020" -- Gitee From 4c2fb42f648e93ed047bcd823e3561b66fb2dbc2 Mon Sep 17 00:00:00 2001 From: yangbo <1442420648@qq.com> Date: Sun, 13 Mar 2022 16:51:12 +0800 Subject: [PATCH 27/42] yangbo198@huawei.com Signed-off-by: yangbo <1442420648@qq.com> Change-Id: Icb7c53ca27b6b17a79d9eea3254b7eef296bd353 --- compiler/main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/main.js b/compiler/main.js index 8b7fbca3b..96d251baf 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -90,9 +90,10 @@ function loadEntryObj(projectConfig) { if (manifest.pages) { const pages = manifest.pages; pages.forEach((element) => { - const fileName = projectConfig.projectPath + path.sep + element + '.ets'; + const sourcePath = element.replace(/^\.\/ets\//, ''); + const fileName = projectConfig.projectPath + path.sep + sourcePath + '.ets'; if (fs.existsSync(fileName)) { - projectConfig.entryObj['./' + element] = fileName + '?entry'; + projectConfig.entryObj['./' + sourcePath] = fileName + '?entry'; } else { throw Error(`\u001b[31m ERROR: page '${fileName}' does not exist. \u001b[39m`).message; } -- Gitee From 55efa61dffea6b8ce5678fb242873b8a5a8d996c Mon Sep 17 00:00:00 2001 From: laibo102 Date: Sun, 13 Mar 2022 17:14:33 +0800 Subject: [PATCH 28/42] add: .svg Signed-off-by: laibo102 Change-Id: I421880ec8b7e2e607fae5f90b2d384fdcb4a2e59 --- compiler/webpack.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/webpack.config.js b/compiler/webpack.config.js index efafdcbd7..c1abf7541 100644 --- a/compiler/webpack.config.js +++ b/compiler/webpack.config.js @@ -57,7 +57,7 @@ function initConfig(config) { module: { rules: [ { - test:/\.(jpg|png|gif|jpeg|mp3|mp4)$/, + test:/\.(jpg|png|gif|jpeg|mp3|mp4|svg)$/, use:{ loader:'url-loader' } -- Gitee From 7a37093198867cf390d151f12757ac2046df2ab3 Mon Sep 17 00:00:00 2001 From: houhaoyu Date: Sun, 13 Mar 2022 18:16:02 +0800 Subject: [PATCH 29/42] houhaoyu@huawei.com ignore module error Signed-off-by: houhaoyu Change-Id: Id97e6c2e7a0aafbde07d0683f7ba4a54b835b2bf --- compiler/src/compile_info.ts | 12 ++++++++++-- compiler/src/ets_checker.ts | 1 + compiler/src/pre_define.ts | 2 +- compiler/src/validate_ui_syntax.ts | 4 ++++ 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/compiler/src/compile_info.ts b/compiler/src/compile_info.ts index a086d8a40..50cf43f1d 100644 --- a/compiler/src/compile_info.ts +++ b/compiler/src/compile_info.ts @@ -38,7 +38,8 @@ import { dollarCollection, appComponentCollection, decoratorParamsCollection, - extendCollection + extendCollection, + importModuleCollection } from './ets_checker'; configure({ @@ -286,13 +287,20 @@ export class ResultStates { private validateError(message: string): boolean { const propInfoReg: RegExp = /Cannot find name\s*'(\$?\$?[_a-zA-Z0-9]+)'/; const stateInfoReg: RegExp = /Property\s*'(\$?[_a-zA-Z0-9]+)' does not exist on type/; + const importInfoReg: RegExp = /Cannot find namespace\s*'([_a-zA-Z0-9]+)'\./; if (this.matchMessage(message, props, propInfoReg) || - this.matchMessage(message, props, stateInfoReg)) { + this.matchMessage(message, props, stateInfoReg) || + this.matchMessage(message, [...importModuleCollection], importInfoReg)) { return false; } return true; } private matchMessage(message: string, nameArr: any, reg: RegExp): boolean { + importModuleCollection.forEach(item => { + if (message.includes(item)) { + return true; + } + }) if (reg.test(message)) { const match: string[] = message.match(reg); if (match[1] && nameArr.includes(match[1])) { diff --git a/compiler/src/ets_checker.ts b/compiler/src/ets_checker.ts index cab0eead8..21f32f5bf 100644 --- a/compiler/src/ets_checker.ts +++ b/compiler/src/ets_checker.ts @@ -134,6 +134,7 @@ export const dollarCollection: Set = new Set(); export const appComponentCollection: Set = new Set(); export const decoratorParamsCollection: Set = new Set(); export const extendCollection: Set = new Set(); +export const importModuleCollection: Set = new Set(); function checkUISyntax(source: string, fileName: string): void { if (/\.ets$/.test(fileName)) { diff --git a/compiler/src/pre_define.ts b/compiler/src/pre_define.ts index ff3a07212..d746eedd0 100644 --- a/compiler/src/pre_define.ts +++ b/compiler/src/pre_define.ts @@ -17,7 +17,7 @@ import path from 'path'; export const NATIVE_MODULE: Set = new Set( ['system.app', 'ohos.app', 'system.router', 'system.curves', 'ohos.curves', 'system.matrix4', 'ohos.matrix4']); -export const VALIDATE_MODULE: string[] = ['application', 'util', 'screen']; +export const VALIDATE_MODULE: string[] = ['application', 'util', 'screen', 'mediaquery']; export const SYSTEM_PLUGIN: string = 'system'; export const OHOS_PLUGIN: string = 'ohos'; diff --git a/compiler/src/validate_ui_syntax.ts b/compiler/src/validate_ui_syntax.ts index f47383a0a..882859c5f 100644 --- a/compiler/src/validate_ui_syntax.ts +++ b/compiler/src/validate_ui_syntax.ts @@ -61,6 +61,7 @@ import { } from './utils'; import { projectConfig } from '../main'; import { collectExtend } from './process_ui_syntax'; +import { importModuleCollection } from "./ets_checker"; export interface ComponentCollection { entryComponent: string; @@ -748,6 +749,9 @@ export function processSystemApi(content: string, isProcessWhiteList: boolean = let moduleType: string = item2 || item5; let systemKey: string = item3 || item6; let systemValue: string = item1 || item4; + if (!VALIDATE_MODULE.includes(systemValue)){ + importModuleCollection.add(systemValue); + } if (!isProcessWhiteList && validateWhiteListModule(moduleType, systemKey)) { return item; } else if (isProcessWhiteList) { -- Gitee From 9668bfc2c201a9b57b7dd9cb68c8463df75b7c03 Mon Sep 17 00:00:00 2001 From: houhaoyu Date: Sun, 13 Mar 2022 18:52:04 +0800 Subject: [PATCH 30/42] houhaoyu@huawei.com fix constructor with ts type Signed-off-by: houhaoyu Change-Id: I7f31c0a5102b40fbae74b39ac0afb5dc90760e7e --- compiler/src/process_component_constructor.ts | 46 +++++++++++++++++-- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/compiler/src/process_component_constructor.ts b/compiler/src/process_component_constructor.ts index d75c50cf8..9555249a2 100644 --- a/compiler/src/process_component_constructor.ts +++ b/compiler/src/process_component_constructor.ts @@ -20,7 +20,9 @@ import { COMPONENT_CONSTRUCTOR_PARENT, COMPONENT_CONSTRUCTOR_PARAMS, COMPONENT_CONSTRUCTOR_UPDATE_PARAMS, - COMPONENT_WATCH_FUNCTION + COMPONENT_WATCH_FUNCTION, + BASE_COMPONENT_NAME, + INTERFACE_NAME_SUFFIX } from './pre_define'; export function getInitConstructor(members: ts.NodeArray): ts.ConstructorDeclaration { @@ -34,7 +36,7 @@ export function getInitConstructor(members: ts.NodeArray): ts.Construct } export function updateConstructor(ctorNode: ts.ConstructorDeclaration, - para: ts.ParameterDeclaration[], addStatements: ts.Statement[], isSuper: boolean = false): + para: ts.ParameterDeclaration[], addStatements: ts.Statement[], isSuper: boolean = false, isAdd: boolean = false, parentComponentName?: ts.Identifier): ts.ConstructorDeclaration { let modifyPara: ts.ParameterDeclaration[]; if (para && para.length) { @@ -55,8 +57,13 @@ export function updateConstructor(ctorNode: ts.ConstructorDeclaration, } } if (ctorNode) { + let ctorPara: ts.ParameterDeclaration[] | ts.NodeArray = + modifyPara || ctorNode.parameters; + if (isAdd) { + ctorPara = addParamsType(ctorNode, modifyPara, parentComponentName); + } ctorNode = ts.factory.updateConstructorDeclaration(ctorNode, ctorNode.decorators, - ctorNode.modifiers, modifyPara || ctorNode.parameters, + ctorNode.modifiers, ctorPara, ts.factory.createBlock(modifyBody || ctorNode.body.statements, true)); } return ctorNode; @@ -80,6 +87,37 @@ function initConstructorParams(node: ts.ConstructorDeclaration): ts.ConstructorD node.body); } +function addParamsType(ctorNode: ts.ConstructorDeclaration, modifyPara: ts.ParameterDeclaration[], + parentComponentName: ts.Identifier): ts.ParameterDeclaration[] { + const tsPara: ts.ParameterDeclaration[] | ts.NodeArray = + modifyPara || ctorNode.parameters; + const newTSPara: ts.ParameterDeclaration[] = []; + tsPara.forEach((item) => { + let parameter: ts.ParameterDeclaration = item; + switch (item.name.escapedText) { + case COMPONENT_CONSTRUCTOR_ID: + parameter = ts.factory.updateParameterDeclaration(item, item.decorators, item.modifiers, + item.dotDotDotToken, item.name, item.questionToken, + ts.factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword), item.initializer); + break; + case COMPONENT_CONSTRUCTOR_PARENT: + parameter = ts.factory.createParameterDeclaration(item.decorators, item.modifiers, + item.dotDotDotToken, item.name, item.questionToken, + ts.factory.createTypeReferenceNode(ts.factory.createIdentifier(BASE_COMPONENT_NAME), undefined), + item.initializer); + break; + case COMPONENT_CONSTRUCTOR_PARAMS: + parameter = ts.factory.updateParameterDeclaration(item, item.decorators, item.modifiers, + item.dotDotDotToken, item.name, item.questionToken, + ts.factory.createTypeReferenceNode(ts.factory.createIdentifier( + parentComponentName.getText() + INTERFACE_NAME_SUFFIX), undefined), item.initializer); + break; + } + newTSPara.push(parameter); + }) + return newTSPara; +} + export function addConstructor(ctorNode: any, watchMap: Map, parentComponentName: ts.Identifier): ts.ConstructorDeclaration { const watchStatements: ts.ExpressionStatement[] = []; @@ -109,5 +147,5 @@ export function addConstructor(ctorNode: any, watchMap: Map, ts.factory.createThis(), ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UPDATE_PARAMS)), undefined, [ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_PARAMS)])); return updateConstructor(updateConstructor(ctorNode, [], [callSuperStatement], true), [], - [updateWithValueParamsStatement, ...watchStatements], false); + [updateWithValueParamsStatement, ...watchStatements], false, true, parentComponentName); } -- Gitee From 45e6833c86f8b5df1a3ec901388684bf86009971 Mon Sep 17 00:00:00 2001 From: laibo102 Date: Sun, 13 Mar 2022 20:07:20 +0800 Subject: [PATCH 31/42] fix:customeDialog Signed-off-by: laibo102 Change-Id: I66962dfb49e8a83cb6451e577cefad0600243cff --- compiler/src/process_component_member.ts | 126 +++++++++++------------ compiler/src/process_ui_syntax.ts | 80 +++++++++++++- 2 files changed, 142 insertions(+), 64 deletions(-) diff --git a/compiler/src/process_component_member.ts b/compiler/src/process_component_member.ts index 77ddab7d4..86c2e22fe 100644 --- a/compiler/src/process_component_member.ts +++ b/compiler/src/process_component_member.ts @@ -48,8 +48,8 @@ import { SET_CONTROLLER_METHOD, SET_CONTROLLER_CTR, SET_CONTROLLER_CTR_TYPE, - JS_DIALOG, - CUSTOM_DIALOG_CONTROLLER_BUILDER, + // JS_DIALOG, + // CUSTOM_DIALOG_CONTROLLER_BUILDER, BASE_COMPONENT_NAME, COMPONENT_CREATE_FUNCTION, COMPONENT_BUILDERPARAM_DECORATOR @@ -464,7 +464,7 @@ function createUpdateParamsWithSet(name: ts.Identifier): ts.ExpressionStatement function updateNormalProperty(node: ts.PropertyDeclaration, name: ts.Identifier, log: LogInfo[], context: ts.TransformationContext): ts.ExpressionStatement { const init: ts.Expression = - ts.visitNode(processCustomDialogController(node, log), visitDialogController); + ts.visitNode(node.initializer, visitDialogController); function visitDialogController(node: ts.Node): ts.Node { if (isProperty(node)) { node = createReference(node as ts.PropertyAssignment); @@ -477,58 +477,58 @@ function updateNormalProperty(node: ts.PropertyDeclaration, name: ts.Identifier, ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UNDEFINED))); } -function processCustomDialogController(node: ts.PropertyDeclaration, - log: LogInfo[]): ts.Expression { - if (node.initializer && ts.isNewExpression(node.initializer) && - ts.isIdentifier(node.initializer.expression) && - node.initializer.expression.getText() === SET_CONTROLLER_CTR_TYPE) { - return createCustomDialogController(node, node.initializer, log); - } - return node.initializer; -} - -function createCustomDialogController(parent: ts.PropertyDeclaration, node: ts.NewExpression, - log: LogInfo[]): ts.NewExpression { - if (node.arguments && node.arguments.length === 1 && - ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0].properties) { - const newproperties: ts.ObjectLiteralElementLike[] = node.arguments[0].properties.map((item) => { - if (isCustomDialogControllerPropertyAssignment(item, log)) { - item = processCustomDialogControllerPropertyAssignment(parent, item as ts.PropertyAssignment); - } - return item; - }); - return ts.factory.createNewExpression(node.expression, node.typeArguments, - [ts.factory.createObjectLiteralExpression(newproperties, true), ts.factory.createThis()]); - } -} - -function isCustomDialogControllerPropertyAssignment(node: ts.ObjectLiteralElementLike, - log: LogInfo[]): boolean { - if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && - node.name.getText() === CUSTOM_DIALOG_CONTROLLER_BUILDER) { - if (ts.isCallExpression(node.initializer) && ts.isIdentifier(node.initializer.expression) && - componentCollection.customDialogs.has(node.initializer.expression.getText())) { - return true; - } else { - validateCustomDialogControllerBuilderInit(node, log); - } - } -} - -function processCustomDialogControllerPropertyAssignment(parent: ts.PropertyDeclaration, - node: ts.PropertyAssignment): ts.PropertyAssignment { - if (ts.isCallExpression(node.initializer)) { - return ts.factory.updatePropertyAssignment(node, node.name, - processCustomDialogControllerBuilder(parent, node.initializer)); - } -} - -function processCustomDialogControllerBuilder(parent: ts.PropertyDeclaration, - node: ts.CallExpression): ts.ArrowFunction { - const newExp: ts.Expression = createCustomComponentNewExpression(node); - const jsDialog: ts.Identifier = ts.factory.createIdentifier(JS_DIALOG); - return createCustomComponentBuilderArrowFunction(parent, jsDialog, newExp); -} +// function processCustomDialogController(node: ts.PropertyDeclaration, +// log: LogInfo[]): ts.Expression { +// if (node.initializer && ts.isNewExpression(node.initializer) && +// ts.isIdentifier(node.initializer.expression) && +// node.initializer.expression.getText() === SET_CONTROLLER_CTR_TYPE) { +// return createCustomDialogController(node, node.initializer, log); +// } +// return node.initializer; +// } + +// function createCustomDialogController(parent: ts.PropertyDeclaration, node: ts.NewExpression, +// log: LogInfo[]): ts.NewExpression { +// if (node.arguments && node.arguments.length === 1 && +// ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0].properties) { +// const newproperties: ts.ObjectLiteralElementLike[] = node.arguments[0].properties.map((item) => { +// if (isCustomDialogControllerPropertyAssignment(item, log)) { +// item = processCustomDialogControllerPropertyAssignment(parent, item as ts.PropertyAssignment); +// } +// return item; +// }); +// return ts.factory.createNewExpression(node.expression, node.typeArguments, +// [ts.factory.createObjectLiteralExpression(newproperties, true), ts.factory.createThis()]); +// } +// } + +// function isCustomDialogControllerPropertyAssignment(node: ts.ObjectLiteralElementLike, +// log: LogInfo[]): boolean { +// if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && +// node.name.getText() === CUSTOM_DIALOG_CONTROLLER_BUILDER) { +// if (ts.isCallExpression(node.initializer) && ts.isIdentifier(node.initializer.expression) && +// componentCollection.customDialogs.has(node.initializer.expression.getText())) { +// return true; +// } else { +// validateCustomDialogControllerBuilderInit(node, log); +// } +// } +// } + +// function processCustomDialogControllerPropertyAssignment(parent: ts.PropertyDeclaration, +// node: ts.PropertyAssignment): ts.PropertyAssignment { +// if (ts.isCallExpression(node.initializer)) { +// return ts.factory.updatePropertyAssignment(node, node.name, +// processCustomDialogControllerBuilder(parent, node.initializer)); +// } +// } + +// function processCustomDialogControllerBuilder(parent: ts.PropertyDeclaration, +// node: ts.CallExpression): ts.ArrowFunction { +// const newExp: ts.Expression = createCustomComponentNewExpression(node); +// const jsDialog: ts.Identifier = ts.factory.createIdentifier(JS_DIALOG); +// return createCustomComponentBuilderArrowFunction(parent, jsDialog, newExp); +// } function updateObservedProperty(item: ts.PropertyDeclaration, name: ts.Identifier, type: ts.TypeNode, program: ts.Program): ts.ExpressionStatement { @@ -934,11 +934,11 @@ function validateWatchParam(type: LogType, pos: number, log: LogInfo[]): void { }); } -function validateCustomDialogControllerBuilderInit(node: ts.ObjectLiteralElementLike, - log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: 'The builder should be initialized with a @CustomDialog Component.', - pos: node.getStart() - }); -} +// function validateCustomDialogControllerBuilderInit(node: ts.ObjectLiteralElementLike, +// log: LogInfo[]): void { +// log.push({ +// type: LogType.ERROR, +// message: 'The builder should be initialized with a @CustomDialog Component.', +// pos: node.getStart() +// }); +// } diff --git a/compiler/src/process_ui_syntax.ts b/compiler/src/process_ui_syntax.ts index 7a4825d35..e09cef543 100644 --- a/compiler/src/process_ui_syntax.ts +++ b/compiler/src/process_ui_syntax.ts @@ -36,7 +36,11 @@ import { ATTRIBUTE_ANIMATETO, GLOBAL_CONTEXT, CHECK_COMPONENT_EXTEND_DECORATOR, - INSTANCE + INSTANCE, + SET_CONTROLLER_CTR_TYPE, + SET_CONTROLLER_METHOD, + JS_DIALOG, + CUSTOM_DIALOG_CONTROLLER_BUILDER } from './pre_define'; import { componentInfo, @@ -58,6 +62,7 @@ import { INTERFACE_NODE_SET } from './component_map'; import { resources } from '../main'; +import { createCustomComponentNewExpression, createViewCreate } from './process_component_member'; export const transformLog: FileLog = new FileLog(); export let contextGlobal: ts.TransformationContext; @@ -128,6 +133,8 @@ export function processUISyntax(program: ts.Program, ut = false): Function { node = processWorker(node as ts.NewExpression); } else if (isAnimateTo(node)) { node = processAnimateTo(node as ts.CallExpression); + } else if (isCustomDialogController(node)) { + node = createCustomDialogController(node.parent, node, transformLog.errors); } return ts.visitEachChild(node, processAllNodes, context); } @@ -140,6 +147,77 @@ export function processUISyntax(program: ts.Program, ut = false): Function { }; } +function isCustomDialogController(node: ts.PropertyDeclaration) { + return node.parent && ts.isNewExpression(node) && ts.isIdentifier(node.expression) && + node.expression.getText() === SET_CONTROLLER_CTR_TYPE; +} + +function createCustomDialogController(parent: ts.PropertyDeclaration, node: ts.NewExpression, + log: LogInfo[]): ts.NewExpression { + if (node.arguments && node.arguments.length === 1 && + ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0].properties) { + const newproperties: ts.ObjectLiteralElementLike[] = node.arguments[0].properties.map((item) => { + if (isCustomDialogControllerPropertyAssignment(item, log)) { + item = processCustomDialogControllerPropertyAssignment(parent, item as ts.PropertyAssignment); + } + return item; + }); + return ts.factory.createNewExpression(node.expression, node.typeArguments, + [ts.factory.createObjectLiteralExpression(newproperties, true), ts.factory.createThis()]); + } +} + +function isCustomDialogControllerPropertyAssignment(node: ts.ObjectLiteralElementLike, + log: LogInfo[]): boolean { + if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && + node.name.getText() === CUSTOM_DIALOG_CONTROLLER_BUILDER) { + if (ts.isCallExpression(node.initializer) && ts.isIdentifier(node.initializer.expression) && + componentCollection.customDialogs.has(node.initializer.expression.getText())) { + return true; + } else { + validateCustomDialogControllerBuilderInit(node, log); + } + } +} + +function validateCustomDialogControllerBuilderInit(node: ts.ObjectLiteralElementLike, + log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: 'The builder should be initialized with a @CustomDialog Component.', + pos: node.getStart() + }); +} + +function processCustomDialogControllerPropertyAssignment(parent: ts.PropertyDeclaration, + node: ts.PropertyAssignment): ts.PropertyAssignment { + if (ts.isCallExpression(node.initializer)) { + return ts.factory.updatePropertyAssignment(node, node.name, + processCustomDialogControllerBuilder(parent, node.initializer)); + } +} + +function processCustomDialogControllerBuilder(parent: ts.PropertyDeclaration, + node: ts.CallExpression): ts.ArrowFunction { + const newExp: ts.Expression = createCustomComponentNewExpression(node); + const jsDialog: ts.Identifier = ts.factory.createIdentifier(JS_DIALOG); + return createCustomComponentBuilderArrowFunction(parent, jsDialog, newExp); +} + +function createCustomComponentBuilderArrowFunction(parent: ts.PropertyDeclaration, + jsDialog: ts.Identifier, newExp: ts.Expression): ts.ArrowFunction { + return ts.factory.createArrowFunction(undefined, undefined, [], undefined, + ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), ts.factory.createBlock([ + ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList( + [ts.factory.createVariableDeclaration(jsDialog, undefined, undefined, newExp)], + ts.NodeFlags.Let)), ts.factory.createExpressionStatement(ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression(jsDialog, + ts.factory.createIdentifier(SET_CONTROLLER_METHOD)), undefined, + [ts.factory.createPropertyAccessExpression(ts.factory.createThis(), + parent.name as ts.Identifier)])), ts.factory.createExpressionStatement( + createViewCreate(jsDialog))], true)); +} + function isResource(node: ts.Node): boolean { return ts.isCallExpression(node) && ts.isIdentifier(node.expression) && (node.expression.escapedText.toString() === RESOURCE || -- Gitee From 42102bddc541cd1dc54a9865a81cfe38e3538d76 Mon Sep 17 00:00:00 2001 From: laibo102 Date: Sun, 13 Mar 2022 20:10:13 +0800 Subject: [PATCH 32/42] update Signed-off-by: laibo102 Change-Id: I1f89b80c2bfe5cb09ac061453a186fd413b54fee --- compiler/src/process_component_member.ts | 55 ------------------------ 1 file changed, 55 deletions(-) diff --git a/compiler/src/process_component_member.ts b/compiler/src/process_component_member.ts index 86c2e22fe..0a87f2bd2 100644 --- a/compiler/src/process_component_member.ts +++ b/compiler/src/process_component_member.ts @@ -48,8 +48,6 @@ import { SET_CONTROLLER_METHOD, SET_CONTROLLER_CTR, SET_CONTROLLER_CTR_TYPE, - // JS_DIALOG, - // CUSTOM_DIALOG_CONTROLLER_BUILDER, BASE_COMPONENT_NAME, COMPONENT_CREATE_FUNCTION, COMPONENT_BUILDERPARAM_DECORATOR @@ -477,59 +475,6 @@ function updateNormalProperty(node: ts.PropertyDeclaration, name: ts.Identifier, ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UNDEFINED))); } -// function processCustomDialogController(node: ts.PropertyDeclaration, -// log: LogInfo[]): ts.Expression { -// if (node.initializer && ts.isNewExpression(node.initializer) && -// ts.isIdentifier(node.initializer.expression) && -// node.initializer.expression.getText() === SET_CONTROLLER_CTR_TYPE) { -// return createCustomDialogController(node, node.initializer, log); -// } -// return node.initializer; -// } - -// function createCustomDialogController(parent: ts.PropertyDeclaration, node: ts.NewExpression, -// log: LogInfo[]): ts.NewExpression { -// if (node.arguments && node.arguments.length === 1 && -// ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0].properties) { -// const newproperties: ts.ObjectLiteralElementLike[] = node.arguments[0].properties.map((item) => { -// if (isCustomDialogControllerPropertyAssignment(item, log)) { -// item = processCustomDialogControllerPropertyAssignment(parent, item as ts.PropertyAssignment); -// } -// return item; -// }); -// return ts.factory.createNewExpression(node.expression, node.typeArguments, -// [ts.factory.createObjectLiteralExpression(newproperties, true), ts.factory.createThis()]); -// } -// } - -// function isCustomDialogControllerPropertyAssignment(node: ts.ObjectLiteralElementLike, -// log: LogInfo[]): boolean { -// if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && -// node.name.getText() === CUSTOM_DIALOG_CONTROLLER_BUILDER) { -// if (ts.isCallExpression(node.initializer) && ts.isIdentifier(node.initializer.expression) && -// componentCollection.customDialogs.has(node.initializer.expression.getText())) { -// return true; -// } else { -// validateCustomDialogControllerBuilderInit(node, log); -// } -// } -// } - -// function processCustomDialogControllerPropertyAssignment(parent: ts.PropertyDeclaration, -// node: ts.PropertyAssignment): ts.PropertyAssignment { -// if (ts.isCallExpression(node.initializer)) { -// return ts.factory.updatePropertyAssignment(node, node.name, -// processCustomDialogControllerBuilder(parent, node.initializer)); -// } -// } - -// function processCustomDialogControllerBuilder(parent: ts.PropertyDeclaration, -// node: ts.CallExpression): ts.ArrowFunction { -// const newExp: ts.Expression = createCustomComponentNewExpression(node); -// const jsDialog: ts.Identifier = ts.factory.createIdentifier(JS_DIALOG); -// return createCustomComponentBuilderArrowFunction(parent, jsDialog, newExp); -// } - function updateObservedProperty(item: ts.PropertyDeclaration, name: ts.Identifier, type: ts.TypeNode, program: ts.Program): ts.ExpressionStatement { return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( -- Gitee From 641cc228026e81e1c43fa30375c10292872034c9 Mon Sep 17 00:00:00 2001 From: laibo102 Date: Sun, 13 Mar 2022 20:13:20 +0800 Subject: [PATCH 33/42] ups=date' Signed-off-by: laibo102 Change-Id: I8fe709059131b3b86916c2a2522ac1cf019522fd --- compiler/src/process_component_member.ts | 8 -------- 1 file changed, 8 deletions(-) diff --git a/compiler/src/process_component_member.ts b/compiler/src/process_component_member.ts index 0a87f2bd2..9de044526 100644 --- a/compiler/src/process_component_member.ts +++ b/compiler/src/process_component_member.ts @@ -879,11 +879,3 @@ function validateWatchParam(type: LogType, pos: number, log: LogInfo[]): void { }); } -// function validateCustomDialogControllerBuilderInit(node: ts.ObjectLiteralElementLike, -// log: LogInfo[]): void { -// log.push({ -// type: LogType.ERROR, -// message: 'The builder should be initialized with a @CustomDialog Component.', -// pos: node.getStart() -// }); -// } -- Gitee From a9ad1cc3cb888a598e948b2d96897ff48fedda16 Mon Sep 17 00:00:00 2001 From: yangbo <1442420648@qq.com> Date: Mon, 14 Mar 2022 07:29:43 +0800 Subject: [PATCH 34/42] yangbo198@huawei.com Signed-off-by: yangbo <1442420648@qq.com> Change-Id: I2877c7dbefa8acb6a807e08aade915cf65761f0b --- compiler/src/process_component_member.ts | 66 +------------------ compiler/src/process_ui_syntax.ts | 80 +++++++++++++++++++++++- 2 files changed, 80 insertions(+), 66 deletions(-) diff --git a/compiler/src/process_component_member.ts b/compiler/src/process_component_member.ts index 77ddab7d4..fa3906cf6 100644 --- a/compiler/src/process_component_member.ts +++ b/compiler/src/process_component_member.ts @@ -48,8 +48,6 @@ import { SET_CONTROLLER_METHOD, SET_CONTROLLER_CTR, SET_CONTROLLER_CTR_TYPE, - JS_DIALOG, - CUSTOM_DIALOG_CONTROLLER_BUILDER, BASE_COMPONENT_NAME, COMPONENT_CREATE_FUNCTION, COMPONENT_BUILDERPARAM_DECORATOR @@ -464,7 +462,7 @@ function createUpdateParamsWithSet(name: ts.Identifier): ts.ExpressionStatement function updateNormalProperty(node: ts.PropertyDeclaration, name: ts.Identifier, log: LogInfo[], context: ts.TransformationContext): ts.ExpressionStatement { const init: ts.Expression = - ts.visitNode(processCustomDialogController(node, log), visitDialogController); + ts.visitNode(node.initializer, visitDialogController); function visitDialogController(node: ts.Node): ts.Node { if (isProperty(node)) { node = createReference(node as ts.PropertyAssignment); @@ -477,59 +475,6 @@ function updateNormalProperty(node: ts.PropertyDeclaration, name: ts.Identifier, ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UNDEFINED))); } -function processCustomDialogController(node: ts.PropertyDeclaration, - log: LogInfo[]): ts.Expression { - if (node.initializer && ts.isNewExpression(node.initializer) && - ts.isIdentifier(node.initializer.expression) && - node.initializer.expression.getText() === SET_CONTROLLER_CTR_TYPE) { - return createCustomDialogController(node, node.initializer, log); - } - return node.initializer; -} - -function createCustomDialogController(parent: ts.PropertyDeclaration, node: ts.NewExpression, - log: LogInfo[]): ts.NewExpression { - if (node.arguments && node.arguments.length === 1 && - ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0].properties) { - const newproperties: ts.ObjectLiteralElementLike[] = node.arguments[0].properties.map((item) => { - if (isCustomDialogControllerPropertyAssignment(item, log)) { - item = processCustomDialogControllerPropertyAssignment(parent, item as ts.PropertyAssignment); - } - return item; - }); - return ts.factory.createNewExpression(node.expression, node.typeArguments, - [ts.factory.createObjectLiteralExpression(newproperties, true), ts.factory.createThis()]); - } -} - -function isCustomDialogControllerPropertyAssignment(node: ts.ObjectLiteralElementLike, - log: LogInfo[]): boolean { - if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && - node.name.getText() === CUSTOM_DIALOG_CONTROLLER_BUILDER) { - if (ts.isCallExpression(node.initializer) && ts.isIdentifier(node.initializer.expression) && - componentCollection.customDialogs.has(node.initializer.expression.getText())) { - return true; - } else { - validateCustomDialogControllerBuilderInit(node, log); - } - } -} - -function processCustomDialogControllerPropertyAssignment(parent: ts.PropertyDeclaration, - node: ts.PropertyAssignment): ts.PropertyAssignment { - if (ts.isCallExpression(node.initializer)) { - return ts.factory.updatePropertyAssignment(node, node.name, - processCustomDialogControllerBuilder(parent, node.initializer)); - } -} - -function processCustomDialogControllerBuilder(parent: ts.PropertyDeclaration, - node: ts.CallExpression): ts.ArrowFunction { - const newExp: ts.Expression = createCustomComponentNewExpression(node); - const jsDialog: ts.Identifier = ts.factory.createIdentifier(JS_DIALOG); - return createCustomComponentBuilderArrowFunction(parent, jsDialog, newExp); -} - function updateObservedProperty(item: ts.PropertyDeclaration, name: ts.Identifier, type: ts.TypeNode, program: ts.Program): ts.ExpressionStatement { return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( @@ -933,12 +878,3 @@ function validateWatchParam(type: LogType, pos: number, log: LogInfo[]): void { pos: pos }); } - -function validateCustomDialogControllerBuilderInit(node: ts.ObjectLiteralElementLike, - log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: 'The builder should be initialized with a @CustomDialog Component.', - pos: node.getStart() - }); -} diff --git a/compiler/src/process_ui_syntax.ts b/compiler/src/process_ui_syntax.ts index 7a4825d35..e09cef543 100644 --- a/compiler/src/process_ui_syntax.ts +++ b/compiler/src/process_ui_syntax.ts @@ -36,7 +36,11 @@ import { ATTRIBUTE_ANIMATETO, GLOBAL_CONTEXT, CHECK_COMPONENT_EXTEND_DECORATOR, - INSTANCE + INSTANCE, + SET_CONTROLLER_CTR_TYPE, + SET_CONTROLLER_METHOD, + JS_DIALOG, + CUSTOM_DIALOG_CONTROLLER_BUILDER } from './pre_define'; import { componentInfo, @@ -58,6 +62,7 @@ import { INTERFACE_NODE_SET } from './component_map'; import { resources } from '../main'; +import { createCustomComponentNewExpression, createViewCreate } from './process_component_member'; export const transformLog: FileLog = new FileLog(); export let contextGlobal: ts.TransformationContext; @@ -128,6 +133,8 @@ export function processUISyntax(program: ts.Program, ut = false): Function { node = processWorker(node as ts.NewExpression); } else if (isAnimateTo(node)) { node = processAnimateTo(node as ts.CallExpression); + } else if (isCustomDialogController(node)) { + node = createCustomDialogController(node.parent, node, transformLog.errors); } return ts.visitEachChild(node, processAllNodes, context); } @@ -140,6 +147,77 @@ export function processUISyntax(program: ts.Program, ut = false): Function { }; } +function isCustomDialogController(node: ts.PropertyDeclaration) { + return node.parent && ts.isNewExpression(node) && ts.isIdentifier(node.expression) && + node.expression.getText() === SET_CONTROLLER_CTR_TYPE; +} + +function createCustomDialogController(parent: ts.PropertyDeclaration, node: ts.NewExpression, + log: LogInfo[]): ts.NewExpression { + if (node.arguments && node.arguments.length === 1 && + ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0].properties) { + const newproperties: ts.ObjectLiteralElementLike[] = node.arguments[0].properties.map((item) => { + if (isCustomDialogControllerPropertyAssignment(item, log)) { + item = processCustomDialogControllerPropertyAssignment(parent, item as ts.PropertyAssignment); + } + return item; + }); + return ts.factory.createNewExpression(node.expression, node.typeArguments, + [ts.factory.createObjectLiteralExpression(newproperties, true), ts.factory.createThis()]); + } +} + +function isCustomDialogControllerPropertyAssignment(node: ts.ObjectLiteralElementLike, + log: LogInfo[]): boolean { + if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && + node.name.getText() === CUSTOM_DIALOG_CONTROLLER_BUILDER) { + if (ts.isCallExpression(node.initializer) && ts.isIdentifier(node.initializer.expression) && + componentCollection.customDialogs.has(node.initializer.expression.getText())) { + return true; + } else { + validateCustomDialogControllerBuilderInit(node, log); + } + } +} + +function validateCustomDialogControllerBuilderInit(node: ts.ObjectLiteralElementLike, + log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: 'The builder should be initialized with a @CustomDialog Component.', + pos: node.getStart() + }); +} + +function processCustomDialogControllerPropertyAssignment(parent: ts.PropertyDeclaration, + node: ts.PropertyAssignment): ts.PropertyAssignment { + if (ts.isCallExpression(node.initializer)) { + return ts.factory.updatePropertyAssignment(node, node.name, + processCustomDialogControllerBuilder(parent, node.initializer)); + } +} + +function processCustomDialogControllerBuilder(parent: ts.PropertyDeclaration, + node: ts.CallExpression): ts.ArrowFunction { + const newExp: ts.Expression = createCustomComponentNewExpression(node); + const jsDialog: ts.Identifier = ts.factory.createIdentifier(JS_DIALOG); + return createCustomComponentBuilderArrowFunction(parent, jsDialog, newExp); +} + +function createCustomComponentBuilderArrowFunction(parent: ts.PropertyDeclaration, + jsDialog: ts.Identifier, newExp: ts.Expression): ts.ArrowFunction { + return ts.factory.createArrowFunction(undefined, undefined, [], undefined, + ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), ts.factory.createBlock([ + ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList( + [ts.factory.createVariableDeclaration(jsDialog, undefined, undefined, newExp)], + ts.NodeFlags.Let)), ts.factory.createExpressionStatement(ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression(jsDialog, + ts.factory.createIdentifier(SET_CONTROLLER_METHOD)), undefined, + [ts.factory.createPropertyAccessExpression(ts.factory.createThis(), + parent.name as ts.Identifier)])), ts.factory.createExpressionStatement( + createViewCreate(jsDialog))], true)); +} + function isResource(node: ts.Node): boolean { return ts.isCallExpression(node) && ts.isIdentifier(node.expression) && (node.expression.escapedText.toString() === RESOURCE || -- Gitee From 362c6508e4fc830056b1c68dba48c7298f88d864 Mon Sep 17 00:00:00 2001 From: yangbo <1442420648@qq.com> Date: Mon, 14 Mar 2022 08:49:13 +0800 Subject: [PATCH 35/42] yangbo198@huawei.com Signed-off-by: yangbo <1442420648@qq.com> Change-Id: I237621850afca397784506b9bf20c9ce50e8e5c6 --- compiler/src/process_component_member.ts | 66 ++++++++++++++++++- compiler/src/process_ui_syntax.ts | 80 +----------------------- 2 files changed, 66 insertions(+), 80 deletions(-) diff --git a/compiler/src/process_component_member.ts b/compiler/src/process_component_member.ts index fa3906cf6..77ddab7d4 100644 --- a/compiler/src/process_component_member.ts +++ b/compiler/src/process_component_member.ts @@ -48,6 +48,8 @@ import { SET_CONTROLLER_METHOD, SET_CONTROLLER_CTR, SET_CONTROLLER_CTR_TYPE, + JS_DIALOG, + CUSTOM_DIALOG_CONTROLLER_BUILDER, BASE_COMPONENT_NAME, COMPONENT_CREATE_FUNCTION, COMPONENT_BUILDERPARAM_DECORATOR @@ -462,7 +464,7 @@ function createUpdateParamsWithSet(name: ts.Identifier): ts.ExpressionStatement function updateNormalProperty(node: ts.PropertyDeclaration, name: ts.Identifier, log: LogInfo[], context: ts.TransformationContext): ts.ExpressionStatement { const init: ts.Expression = - ts.visitNode(node.initializer, visitDialogController); + ts.visitNode(processCustomDialogController(node, log), visitDialogController); function visitDialogController(node: ts.Node): ts.Node { if (isProperty(node)) { node = createReference(node as ts.PropertyAssignment); @@ -475,6 +477,59 @@ function updateNormalProperty(node: ts.PropertyDeclaration, name: ts.Identifier, ts.factory.createIdentifier(COMPONENT_CONSTRUCTOR_UNDEFINED))); } +function processCustomDialogController(node: ts.PropertyDeclaration, + log: LogInfo[]): ts.Expression { + if (node.initializer && ts.isNewExpression(node.initializer) && + ts.isIdentifier(node.initializer.expression) && + node.initializer.expression.getText() === SET_CONTROLLER_CTR_TYPE) { + return createCustomDialogController(node, node.initializer, log); + } + return node.initializer; +} + +function createCustomDialogController(parent: ts.PropertyDeclaration, node: ts.NewExpression, + log: LogInfo[]): ts.NewExpression { + if (node.arguments && node.arguments.length === 1 && + ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0].properties) { + const newproperties: ts.ObjectLiteralElementLike[] = node.arguments[0].properties.map((item) => { + if (isCustomDialogControllerPropertyAssignment(item, log)) { + item = processCustomDialogControllerPropertyAssignment(parent, item as ts.PropertyAssignment); + } + return item; + }); + return ts.factory.createNewExpression(node.expression, node.typeArguments, + [ts.factory.createObjectLiteralExpression(newproperties, true), ts.factory.createThis()]); + } +} + +function isCustomDialogControllerPropertyAssignment(node: ts.ObjectLiteralElementLike, + log: LogInfo[]): boolean { + if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && + node.name.getText() === CUSTOM_DIALOG_CONTROLLER_BUILDER) { + if (ts.isCallExpression(node.initializer) && ts.isIdentifier(node.initializer.expression) && + componentCollection.customDialogs.has(node.initializer.expression.getText())) { + return true; + } else { + validateCustomDialogControllerBuilderInit(node, log); + } + } +} + +function processCustomDialogControllerPropertyAssignment(parent: ts.PropertyDeclaration, + node: ts.PropertyAssignment): ts.PropertyAssignment { + if (ts.isCallExpression(node.initializer)) { + return ts.factory.updatePropertyAssignment(node, node.name, + processCustomDialogControllerBuilder(parent, node.initializer)); + } +} + +function processCustomDialogControllerBuilder(parent: ts.PropertyDeclaration, + node: ts.CallExpression): ts.ArrowFunction { + const newExp: ts.Expression = createCustomComponentNewExpression(node); + const jsDialog: ts.Identifier = ts.factory.createIdentifier(JS_DIALOG); + return createCustomComponentBuilderArrowFunction(parent, jsDialog, newExp); +} + function updateObservedProperty(item: ts.PropertyDeclaration, name: ts.Identifier, type: ts.TypeNode, program: ts.Program): ts.ExpressionStatement { return ts.factory.createExpressionStatement(ts.factory.createBinaryExpression( @@ -878,3 +933,12 @@ function validateWatchParam(type: LogType, pos: number, log: LogInfo[]): void { pos: pos }); } + +function validateCustomDialogControllerBuilderInit(node: ts.ObjectLiteralElementLike, + log: LogInfo[]): void { + log.push({ + type: LogType.ERROR, + message: 'The builder should be initialized with a @CustomDialog Component.', + pos: node.getStart() + }); +} diff --git a/compiler/src/process_ui_syntax.ts b/compiler/src/process_ui_syntax.ts index e09cef543..7a4825d35 100644 --- a/compiler/src/process_ui_syntax.ts +++ b/compiler/src/process_ui_syntax.ts @@ -36,11 +36,7 @@ import { ATTRIBUTE_ANIMATETO, GLOBAL_CONTEXT, CHECK_COMPONENT_EXTEND_DECORATOR, - INSTANCE, - SET_CONTROLLER_CTR_TYPE, - SET_CONTROLLER_METHOD, - JS_DIALOG, - CUSTOM_DIALOG_CONTROLLER_BUILDER + INSTANCE } from './pre_define'; import { componentInfo, @@ -62,7 +58,6 @@ import { INTERFACE_NODE_SET } from './component_map'; import { resources } from '../main'; -import { createCustomComponentNewExpression, createViewCreate } from './process_component_member'; export const transformLog: FileLog = new FileLog(); export let contextGlobal: ts.TransformationContext; @@ -133,8 +128,6 @@ export function processUISyntax(program: ts.Program, ut = false): Function { node = processWorker(node as ts.NewExpression); } else if (isAnimateTo(node)) { node = processAnimateTo(node as ts.CallExpression); - } else if (isCustomDialogController(node)) { - node = createCustomDialogController(node.parent, node, transformLog.errors); } return ts.visitEachChild(node, processAllNodes, context); } @@ -147,77 +140,6 @@ export function processUISyntax(program: ts.Program, ut = false): Function { }; } -function isCustomDialogController(node: ts.PropertyDeclaration) { - return node.parent && ts.isNewExpression(node) && ts.isIdentifier(node.expression) && - node.expression.getText() === SET_CONTROLLER_CTR_TYPE; -} - -function createCustomDialogController(parent: ts.PropertyDeclaration, node: ts.NewExpression, - log: LogInfo[]): ts.NewExpression { - if (node.arguments && node.arguments.length === 1 && - ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0].properties) { - const newproperties: ts.ObjectLiteralElementLike[] = node.arguments[0].properties.map((item) => { - if (isCustomDialogControllerPropertyAssignment(item, log)) { - item = processCustomDialogControllerPropertyAssignment(parent, item as ts.PropertyAssignment); - } - return item; - }); - return ts.factory.createNewExpression(node.expression, node.typeArguments, - [ts.factory.createObjectLiteralExpression(newproperties, true), ts.factory.createThis()]); - } -} - -function isCustomDialogControllerPropertyAssignment(node: ts.ObjectLiteralElementLike, - log: LogInfo[]): boolean { - if (ts.isPropertyAssignment(node) && ts.isIdentifier(node.name) && - node.name.getText() === CUSTOM_DIALOG_CONTROLLER_BUILDER) { - if (ts.isCallExpression(node.initializer) && ts.isIdentifier(node.initializer.expression) && - componentCollection.customDialogs.has(node.initializer.expression.getText())) { - return true; - } else { - validateCustomDialogControllerBuilderInit(node, log); - } - } -} - -function validateCustomDialogControllerBuilderInit(node: ts.ObjectLiteralElementLike, - log: LogInfo[]): void { - log.push({ - type: LogType.ERROR, - message: 'The builder should be initialized with a @CustomDialog Component.', - pos: node.getStart() - }); -} - -function processCustomDialogControllerPropertyAssignment(parent: ts.PropertyDeclaration, - node: ts.PropertyAssignment): ts.PropertyAssignment { - if (ts.isCallExpression(node.initializer)) { - return ts.factory.updatePropertyAssignment(node, node.name, - processCustomDialogControllerBuilder(parent, node.initializer)); - } -} - -function processCustomDialogControllerBuilder(parent: ts.PropertyDeclaration, - node: ts.CallExpression): ts.ArrowFunction { - const newExp: ts.Expression = createCustomComponentNewExpression(node); - const jsDialog: ts.Identifier = ts.factory.createIdentifier(JS_DIALOG); - return createCustomComponentBuilderArrowFunction(parent, jsDialog, newExp); -} - -function createCustomComponentBuilderArrowFunction(parent: ts.PropertyDeclaration, - jsDialog: ts.Identifier, newExp: ts.Expression): ts.ArrowFunction { - return ts.factory.createArrowFunction(undefined, undefined, [], undefined, - ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), ts.factory.createBlock([ - ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList( - [ts.factory.createVariableDeclaration(jsDialog, undefined, undefined, newExp)], - ts.NodeFlags.Let)), ts.factory.createExpressionStatement(ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(jsDialog, - ts.factory.createIdentifier(SET_CONTROLLER_METHOD)), undefined, - [ts.factory.createPropertyAccessExpression(ts.factory.createThis(), - parent.name as ts.Identifier)])), ts.factory.createExpressionStatement( - createViewCreate(jsDialog))], true)); -} - function isResource(node: ts.Node): boolean { return ts.isCallExpression(node) && ts.isIdentifier(node.expression) && (node.expression.escapedText.toString() === RESOURCE || -- Gitee From faf8aba14b6f4e4fd9ec7e461ae092a4f01f8488 Mon Sep 17 00:00:00 2001 From: puyajun Date: Sun, 13 Mar 2022 19:23:02 +0800 Subject: [PATCH 36/42] puyajun@huawei.com Signed-off-by: puyajun Change-Id: I64fc083fb66eadf015c2eb7b29cabc0649313c3c --- compiler/src/gen_abc.ts | 10 +++---- compiler/src/gen_abc_plugin.ts | 34 +++++++++++------------ compiler/src/process_component_build.ts | 36 +++++++++++++------------ compiler/tsconfig.json | 12 --------- 4 files changed, 41 insertions(+), 51 deletions(-) diff --git a/compiler/src/gen_abc.ts b/compiler/src/gen_abc.ts index dd923af2f..8bcd6ff33 100644 --- a/compiler/src/gen_abc.ts +++ b/compiler/src/gen_abc.ts @@ -13,9 +13,9 @@ const reset: string = '\u001b[39m'; function js2abcByWorkers(inputPaths: File[], cmd: string): Promise { for (let i = 0; i < inputPaths.length; ++i) { - let input = inputPaths[i].path; - let singleCmd = `${cmd} "${input}"`; - logger.debug("gen abc cmd is: ", singleCmd); + const input = inputPaths[i].path; + const singleCmd = `${cmd} "${input}"`; + logger.debug('gen abc cmd is: ', singleCmd); try { process.execSync(singleCmd); } catch (e) { @@ -37,8 +37,8 @@ function js2abcByWorkers(inputPaths: File[], cmd: string): Promise { } } -logger.debug("worker data is: ", JSON.stringify(workerData)); +logger.debug('worker data is: ', JSON.stringify(workerData)); if (JSON.stringify(workerData) !== 'null') { - logger.debug("==>worker #", threadId, "started!"); + logger.debug('==>worker #', threadId, 'started!'); js2abcByWorkers(workerData.input, workerData.cmd); } diff --git a/compiler/src/gen_abc_plugin.ts b/compiler/src/gen_abc_plugin.ts index 1565e11c3..3de104e3e 100644 --- a/compiler/src/gen_abc_plugin.ts +++ b/compiler/src/gen_abc_plugin.ts @@ -32,7 +32,7 @@ interface File { path: string, size: number } -let intermediateJsBundle: Array = []; +const intermediateJsBundle: Array = []; const red: string = '\u001b[31m'; const reset: string = '\u001b[39m'; @@ -78,20 +78,20 @@ export class GenAbcPlugin { if (isMainThread) { let js2abc: string = path.join(arkDir, 'build', 'src', 'index.js'); if (isWin) { - js2abc = path.join(arkDir, 'build-win', 'src', 'index.js'); + js2abc = path.join(arkDir, 'build-win', 'src', 'index.js'); } else if (isMac) { js2abc = path.join(arkDir, 'build-mac', 'src', 'index.js'); } - let maxWorkerNumber = 3; - let splitedBundles = splitJsBundlesBySize(intermediateJsBundle, maxWorkerNumber); - let workerNumber = maxWorkerNumber < splitedBundles.length ? maxWorkerNumber : splitedBundles.length; - let cmdPrefix: string = `${nodeJs} --expose-gc "${js2abc}" ${param} `; - let workers = []; + const maxWorkerNumber = 3; + const splitedBundles = splitJsBundlesBySize(intermediateJsBundle, maxWorkerNumber); + const workerNumber = maxWorkerNumber < splitedBundles.length ? maxWorkerNumber : splitedBundles.length; + const cmdPrefix: string = `${nodeJs} --expose-gc "${js2abc}" ${param} `; + const workers = []; for (let i = 0; i < workerNumber; ++i) { workers.push(new Worker(path.resolve(__dirname, genAbcScript), - {workerData: {input: splitedBundles[i], cmd: cmdPrefix} })); + {workerData: {input: splitedBundles[i], cmd: cmdPrefix} })); workers[i].on('exit', () => { - logger.debug("worker ", i, "finished!"); + logger.debug('worker ', i, 'finished!'); }); } } @@ -106,7 +106,7 @@ function writeFileSync(inputString: string, output: string, jsBundleFile: string } fs.writeFileSync(output, inputString); if (fs.existsSync(output)) { - let fileSize = fs.statSync(output).size; + const fileSize = fs.statSync(output).size; intermediateJsBundle.push({path: output, size: fileSize}); } else { logger.error(red, `ETS:ERROR Failed to convert file ${jsBundleFile} to bin. ${output} is lost`, reset); @@ -122,15 +122,15 @@ function mkDir(path_: string): void { } function getSmallestSizeGroup(groupSize: Map) { - let groupSizeArray = Array.from(groupSize); + const groupSizeArray = Array.from(groupSize); groupSizeArray.sort(function(g1, g2) { return g1[1] - g2[1]; // sort by value }); return groupSizeArray[0][0]; // return key } -function splitJsBundlesBySize(bundleArray: Array, groupNumber: number){ - let result = []; +function splitJsBundlesBySize(bundleArray: Array, groupNumber: number) { + const result = []; if (bundleArray.length < groupNumber) { result.push(bundleArray); return result; @@ -139,17 +139,17 @@ function splitJsBundlesBySize(bundleArray: Array, groupNumber: number){ bundleArray.sort(function(f1: File, f2: File) { return f2.size - f1.size; }); - let groupFileSize = new Map(); + const groupFileSize = new Map(); for (let i = 0; i < groupNumber; ++i) { result.push([]); groupFileSize.set(i, 0); } let index = 0; - while(index < bundleArray.length) { - let smallestGroup = getSmallestSizeGroup(groupFileSize); + while (index < bundleArray.length) { + const smallestGroup = getSmallestSizeGroup(groupFileSize); result[smallestGroup].push(bundleArray[index]); - let sizeUpdate = groupFileSize.get(smallestGroup) + bundleArray[index].size; + const sizeUpdate = groupFileSize.get(smallestGroup) + bundleArray[index].size; groupFileSize.set(smallestGroup, sizeUpdate); index++; } diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index 278968a94..6831aa253 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -894,33 +894,35 @@ function addComponentAttr(temp: any, node: ts.Identifier, lastStatement: any, validateStateStyleSyntax(temp, log); } } - temp = loopEtsComponent(temp, isStylesAttr, isGlobalStyles); + temp = loopEtscomponent(temp, isStylesAttr, isGlobalStyles); statements.push(ts.factory.createExpressionStatement( createFunction(identifierNode, node, temp.arguments))); lastStatement.kind = true; } } -function loopEtsComponent(temp: any, isStylesAttr: boolean, isGlobalStyles: boolean): ts.Node { - temp.arguments.forEach((item: ts.Node, index: number) => { +function loopEtscomponent(node: any, isStylesAttr: boolean, isGlobalStyles: boolean): ts.Node { + node.arguments.forEach((item: ts.Node, index: number) => { if (isStylesAttr && isGlobalStyles) { - temp.arguments[index] = traverseStylesAttr(item); + node.arguments[index] = traverseStylesAttr(item); } - if (ts.isNewExpression(item) && item.expression && ts.isEtsComponentExpression( - item.expression)) { - temp.arguments[index] = ts.factory.updateNewExpression(item, item.expression.expression, - undefined, item.expression.arguments); - } else if (ts.isEtsComponentExpression(item)) { - temp.arguments[index] = ts.factory.createCallExpression(item.expression, - undefined, item.arguments); - } else if ((ts.isCallExpression(item) || ts.isNewExpression(item)) && item.expression && - ts.isPropertyAccessExpression(item.expression) && item.expression.expression && - ts.isEtsComponentExpression(item.expression.expression)) { - temp.arguments[index].expression.expression = ts.factory.createCallExpression( - item.expression.expression.expression, undefined, item.expression.expression.arguments); + if (ts.isEtsComponentExpression(item)) { + node.arguments[index] = ts.factory.createCallExpression( + item.expression, undefined, item.arguments); + } else if (ts.isCallExpression(item) || ts.isNewExpression(item)) { + node.arguments[index] = ts.visitEachChild(item, + changeEtsComponentKind, contextGlobal); } }); - return temp; + return node; +} + +function changeEtsComponentKind(node: ts.Node): ts.Node { + if (ts.isEtsComponentExpression(node)) { + node.kind = 204; + return node; + } + return ts.visitEachChild(node, changeEtsComponentKind, contextGlobal); } function classifyArgumentsNum(args: any, argumentsArr: ts.Expression[], propName: string, diff --git a/compiler/tsconfig.json b/compiler/tsconfig.json index b53c39d76..4204e142a 100644 --- a/compiler/tsconfig.json +++ b/compiler/tsconfig.json @@ -30,7 +30,6 @@ "Ellipse", "Flex", "FormComponent", - "FrictionMotion", "Gauge", "GeometryView", "Grid", @@ -68,7 +67,6 @@ "RichText", "Scroll", "ScrollBar", - "ScrollMotion", "Search", "Section", "Select", @@ -212,11 +210,6 @@ "type": "FormComponentAttribute", "instance": "FormComponentInstance" }, - { - "name": "FrictionMotion", - "type": "FrictionMotionAttribute", - "instance": "FrictionMotionInstance" - }, { "name": "Gauge", "type": "GaugeAttribute", @@ -402,11 +395,6 @@ "type": "ScrollBarAttribute", "instance": "ScrollBarInstance" }, - { - "name": "ScrollMotion", - "type": "ScrollMotionAttribute", - "instance": "ScrollMotionInstance" - }, { "name": "Search", "type": "SearchAttribute", -- Gitee From c0304139a15b2e31c65bfc24c7534bb09ecf43ed Mon Sep 17 00:00:00 2001 From: laibo102 Date: Mon, 14 Mar 2022 11:37:14 +0800 Subject: [PATCH 37/42] fixbug Signed-off-by: laibo102 Change-Id: I6d4923fc0dbfc6f746498256be3f77926959264a --- compiler/src/process_ui_syntax.ts | 57 +++++++++++++++++++++++-------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/compiler/src/process_ui_syntax.ts b/compiler/src/process_ui_syntax.ts index e09cef543..6269820fb 100644 --- a/compiler/src/process_ui_syntax.ts +++ b/compiler/src/process_ui_syntax.ts @@ -147,12 +147,12 @@ export function processUISyntax(program: ts.Program, ut = false): Function { }; } -function isCustomDialogController(node: ts.PropertyDeclaration) { +function isCustomDialogController(node: ts.Expression) { return node.parent && ts.isNewExpression(node) && ts.isIdentifier(node.expression) && node.expression.getText() === SET_CONTROLLER_CTR_TYPE; } -function createCustomDialogController(parent: ts.PropertyDeclaration, node: ts.NewExpression, +function createCustomDialogController(parent: ts.Expression, node: ts.NewExpression, log: LogInfo[]): ts.NewExpression { if (node.arguments && node.arguments.length === 1 && ts.isObjectLiteralExpression(node.arguments[0]) && node.arguments[0].properties) { @@ -189,7 +189,7 @@ function validateCustomDialogControllerBuilderInit(node: ts.ObjectLiteralElement }); } -function processCustomDialogControllerPropertyAssignment(parent: ts.PropertyDeclaration, +function processCustomDialogControllerPropertyAssignment(parent: ts.Expression, node: ts.PropertyAssignment): ts.PropertyAssignment { if (ts.isCallExpression(node.initializer)) { return ts.factory.updatePropertyAssignment(node, node.name, @@ -197,25 +197,52 @@ function processCustomDialogControllerPropertyAssignment(parent: ts.PropertyDecl } } -function processCustomDialogControllerBuilder(parent: ts.PropertyDeclaration, +function processCustomDialogControllerBuilder(parent: ts.Expression, node: ts.CallExpression): ts.ArrowFunction { const newExp: ts.Expression = createCustomComponentNewExpression(node); const jsDialog: ts.Identifier = ts.factory.createIdentifier(JS_DIALOG); return createCustomComponentBuilderArrowFunction(parent, jsDialog, newExp); } -function createCustomComponentBuilderArrowFunction(parent: ts.PropertyDeclaration, +function createCustomComponentBuilderArrowFunction(parent: ts.Expression, jsDialog: ts.Identifier, newExp: ts.Expression): ts.ArrowFunction { - return ts.factory.createArrowFunction(undefined, undefined, [], undefined, - ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), ts.factory.createBlock([ - ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList( - [ts.factory.createVariableDeclaration(jsDialog, undefined, undefined, newExp)], - ts.NodeFlags.Let)), ts.factory.createExpressionStatement(ts.factory.createCallExpression( - ts.factory.createPropertyAccessExpression(jsDialog, - ts.factory.createIdentifier(SET_CONTROLLER_METHOD)), undefined, - [ts.factory.createPropertyAccessExpression(ts.factory.createThis(), - parent.name as ts.Identifier)])), ts.factory.createExpressionStatement( - createViewCreate(jsDialog))], true)); + let mountNodde: ts.PropertyAccessExpression; + if (ts.isBinaryExpression(parent)) { + mountNodde = parent.left; + } else if (ts.isVariableDeclaration(parent) || ts.isPropertyDeclaration(parent)) { + mountNodde = ts.factory.createPropertyAccessExpression(ts.factory.createThis(), + parent.name as ts.Identifier); + } + return ts.factory.createArrowFunction( + undefined, + undefined, + [], + undefined, + ts.factory.createToken(ts.SyntaxKind.EqualsGreaterThanToken), + ts.factory.createBlock( + [ + ts.factory.createVariableStatement( + undefined, + ts.factory.createVariableDeclarationList( + [ts.factory.createVariableDeclaration(jsDialog, undefined, undefined, newExp)], + ts.NodeFlags.Let + ) + ), + ts.factory.createExpressionStatement( + ts.factory.createCallExpression( + ts.factory.createPropertyAccessExpression( + jsDialog, + ts.factory.createIdentifier(SET_CONTROLLER_METHOD) + ), + undefined, + [mountNodde] + ) + ), + ts.factory.createExpressionStatement(createViewCreate(jsDialog)) + ], + true + ) + ); } function isResource(node: ts.Node): boolean { -- Gitee From 168b5cb68b2902982de79957372d50a082bd778b Mon Sep 17 00:00:00 2001 From: c00513733 Date: Sun, 13 Mar 2022 11:40:44 +0800 Subject: [PATCH 38/42] Replace worker by cluster to gen abc multi-threading Signed-off-by: c00513733 --- compiler/src/gen_abc.ts | 42 +++++++++++------ compiler/src/gen_abc_plugin.ts | 82 ++++++++++++++++++++++------------ 2 files changed, 81 insertions(+), 43 deletions(-) diff --git a/compiler/src/gen_abc.ts b/compiler/src/gen_abc.ts index 8bcd6ff33..8d20e07a5 100644 --- a/compiler/src/gen_abc.ts +++ b/compiler/src/gen_abc.ts @@ -1,23 +1,35 @@ -import * as process from 'child_process'; +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import * as childProcess from 'child_process'; +import * as process from 'process'; import * as fs from 'fs'; +import cluster from 'cluster'; import { logger } from './compile_info'; -const {workerData, threadId} = require('worker_threads'); - -interface File { - path: string, - size: number -} const red: string = '\u001b[31m'; const reset: string = '\u001b[39m'; -function js2abcByWorkers(inputPaths: File[], cmd: string): Promise { +function js2abcByWorkers(jsonInput: string, cmd: string): Promise { + const inputPaths = JSON.parse(jsonInput); for (let i = 0; i < inputPaths.length; ++i) { const input = inputPaths[i].path; const singleCmd = `${cmd} "${input}"`; - logger.debug('gen abc cmd is: ', singleCmd); + logger.debug("gen abc cmd is: ", singleCmd, " ,file size is:", inputPaths[i].size, " byte"); try { - process.execSync(singleCmd); + childProcess.execSync(singleCmd); } catch (e) { logger.error(red, `ETS:ERROR Failed to convert file ${input} to abc `, reset); return; @@ -37,8 +49,10 @@ function js2abcByWorkers(inputPaths: File[], cmd: string): Promise { } } -logger.debug('worker data is: ', JSON.stringify(workerData)); -if (JSON.stringify(workerData) !== 'null') { - logger.debug('==>worker #', threadId, 'started!'); - js2abcByWorkers(workerData.input, workerData.cmd); +logger.debug("worker data is: ", JSON.stringify(process.env)); +logger.debug("gen_abc isWorker is: ", cluster.isWorker); +if (cluster.isWorker && process.env["inputs"] !== undefined && process.env["cmd"] !== undefined) { + logger.debug("==>worker #", cluster.worker.id, "started!"); + js2abcByWorkers(process.env["inputs"], process.env["cmd"]); + process.exit(); } diff --git a/compiler/src/gen_abc_plugin.ts b/compiler/src/gen_abc_plugin.ts index 3de104e3e..eac73f7de 100644 --- a/compiler/src/gen_abc_plugin.ts +++ b/compiler/src/gen_abc_plugin.ts @@ -15,10 +15,11 @@ import * as fs from 'fs'; import * as path from 'path'; +import cluster from 'cluster'; +import * as process from 'process'; import Compiler from 'webpack/lib/Compiler'; import { logger } from './compile_info'; -const {Worker, isMainThread} = require('worker_threads'); const firstFileEXT: string = '_.js'; const genAbcScript = 'gen_abc.js'; let output: string; @@ -70,31 +71,7 @@ export class GenAbcPlugin { }); compiler.hooks.afterEmit.tap('GenAbcPluginMultiThread', () => { - let param: string = ''; - if (isDebug) { - param += ' --debug'; - } - - if (isMainThread) { - let js2abc: string = path.join(arkDir, 'build', 'src', 'index.js'); - if (isWin) { - js2abc = path.join(arkDir, 'build-win', 'src', 'index.js'); - } else if (isMac) { - js2abc = path.join(arkDir, 'build-mac', 'src', 'index.js'); - } - const maxWorkerNumber = 3; - const splitedBundles = splitJsBundlesBySize(intermediateJsBundle, maxWorkerNumber); - const workerNumber = maxWorkerNumber < splitedBundles.length ? maxWorkerNumber : splitedBundles.length; - const cmdPrefix: string = `${nodeJs} --expose-gc "${js2abc}" ${param} `; - const workers = []; - for (let i = 0; i < workerNumber; ++i) { - workers.push(new Worker(path.resolve(__dirname, genAbcScript), - {workerData: {input: splitedBundles[i], cmd: cmdPrefix} })); - workers[i].on('exit', () => { - logger.debug('worker ', i, 'finished!'); - }); - } - } + invokeWorkersToGenAbc(); }); } } @@ -124,13 +101,13 @@ function mkDir(path_: string): void { function getSmallestSizeGroup(groupSize: Map) { const groupSizeArray = Array.from(groupSize); groupSizeArray.sort(function(g1, g2) { - return g1[1] - g2[1]; // sort by value + return g1[1] - g2[1]; // sort by size }); - return groupSizeArray[0][0]; // return key + return groupSizeArray[0][0]; } function splitJsBundlesBySize(bundleArray: Array, groupNumber: number) { - const result = []; + let result = []; if (bundleArray.length < groupNumber) { result.push(bundleArray); return result; @@ -155,3 +132,50 @@ function splitJsBundlesBySize(bundleArray: Array, groupNumber: number) { } return result; } + +function invokeWorkersToGenAbc() { + let param: string = ''; + if (isDebug) { + param += ' --debug'; + } + + let js2abc: string = path.join(arkDir, 'build', 'src', 'index.js'); + if (isWin) { + js2abc = path.join(arkDir, 'build-win', 'src', 'index.js'); + } else if (isMac) { + js2abc = path.join(arkDir, 'build-mac', 'src', 'index.js'); + } + + const maxWorkerNumber = 3; + const splitedBundles = splitJsBundlesBySize(intermediateJsBundle, maxWorkerNumber); + const workerNumber = maxWorkerNumber < splitedBundles.length ? maxWorkerNumber : splitedBundles.length; + const cmdPrefix: string = `${nodeJs} --expose-gc "${js2abc}" ${param} `; + + const clusterNewApiVersion = 16; + const currentNodeVersion = parseInt(process.version.split('.')[0]); + const useNewApi = currentNodeVersion >= clusterNewApiVersion ? true : false; + + if ((useNewApi && cluster.isPrimary) || (!useNewApi && cluster.isMaster)) { + if (useNewApi) { + cluster.setupPrimary({ + exec: path.resolve(__dirname, genAbcScript) + }); + } else { + cluster.setupMaster({ + exec: path.resolve(__dirname, genAbcScript) + }); + } + + for (let i = 0; i < workerNumber; ++i) { + let workerData = { + "inputs": JSON.stringify(splitedBundles[i]), + "cmd": cmdPrefix + } + cluster.fork(workerData); + } + + cluster.on('exit', (worker, code, signal) => { + logger.debug(`worker ${worker.process.pid} finished`); + }); + } +} -- Gitee From 955de5936adfa08703012ea4c150977d4c9da819 Mon Sep 17 00:00:00 2001 From: lihong Date: Mon, 14 Mar 2022 12:49:26 +0800 Subject: [PATCH 39/42] lihong67@huawei.com update typescript. Signed-off-by: lihong Change-Id: Ib8118662d30e06a0201af7d2984ba1113a8254c2 --- compiler/package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/package-lock.json b/compiler/package-lock.json index d228e0e9d..acf264bb3 100644 --- a/compiler/package-lock.json +++ b/compiler/package-lock.json @@ -4074,7 +4074,7 @@ }, "typescript": { "version": "file:deps/ohos-typescript-4.2.3-r2.tgz", - "integrity": "sha512-a94p5mnxZMe9sJebu6gw2ixGaVGuKo7H3fU+Vd+VrogYbRrrCphlrJ2nlZnpm9r0TYe4HwHrmGkeyeJW63XUSA==" + "integrity": "sha512-L04mzKpHHkcCGLxuB9Rfy7cdzFGIh1xdV3r4cyfhP6vwcHnlUHvqkO8mUpA/1urYk0wpxlH5P1eK2219Kil2lA==" }, "uglify-js": { "version": "3.14.5", -- Gitee From a9e32928439716c710ca317a56e6baaedabeae0e Mon Sep 17 00:00:00 2001 From: laibo102 Date: Mon, 14 Mar 2022 14:22:19 +0800 Subject: [PATCH 40/42] update: aceCompileMode Signed-off-by: laibo102 Change-Id: I42b9749eb23e25ed0be64cb54291d18430a8ceaa --- compiler/main.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/main.js b/compiler/main.js index 96d251baf..8a3415f33 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -32,6 +32,7 @@ configure({ const logger = getLogger('ETS'); const staticPreviewPage = process.env.aceStaticPreview; +const aceCompileMode = process.env.aceCompileMode || 'page'; const abilityConfig = { abilityType: process.env.abilityType || 'page', abilityEntryFile: null, @@ -64,7 +65,7 @@ function initProjectConfig(projectConfig) { function loadEntryObj(projectConfig) { let manifest = {}; initProjectConfig(projectConfig); - if (process.env.aceManifestPath) { + if (process.env.aceManifestPath && aceCompileMode === 'page') { setEntryFile(projectConfig); setFaTestRunnerFile(projectConfig); } @@ -141,7 +142,7 @@ function setEntryFile(projectConfig) { const entryFileRealPath = entryFileName + extendFile; const entryFilePath = path.resolve(projectConfig.projectPath, entryFileRealPath); abilityConfig.abilityEntryFile = entryFilePath; - if (!fs.existsSync(entryFilePath)) { + if (!fs.existsSync(entryFilePath) && aceCompileMode === 'page') { throw Error(`\u001b[31m ERROR: missing ${entryFilePath}. \u001b[39m`).message; } projectConfig.entryObj[`./${entryFileName}`] = entryFilePath + '?entry'; -- Gitee From dfa246cc23d84bb0ab8e3c614ca38c3a6b6fd908 Mon Sep 17 00:00:00 2001 From: leid_1021 Date: Mon, 14 Mar 2022 20:24:17 +0800 Subject: [PATCH 41/42] leidan.lei@huawei.com Signed-off-by: leid_1021 --- compiler/package-lock.json | 5 +++++ compiler/package.json | 1 + 2 files changed, 6 insertions(+) diff --git a/compiler/package-lock.json b/compiler/package-lock.json index 702985e4a..69d55091d 100644 --- a/compiler/package-lock.json +++ b/compiler/package-lock.json @@ -2135,6 +2135,11 @@ "resolved": "https://registry.npmmirror.com/deccjsunit/download/deccjsunit-1.0.6.tgz", "integrity": "sha512-ksRmhEFv+zayXuwwM3P3/PqizbTXfK8g5nmWfhOgRjmlH8DAE5C3U/cs3e6g6YtvXq5vS6YVS5T/CECZMd7Apg==" }, + "hypium": { + "version": "1.0.0", + "resolved": "https://registry.npmmirror.com/hypium/download/hypium-1.0.0.tgz", + "integrity": "sha512-nl+RQVv2AU/5FvFRhsXyWO5wh+2huhdqRZ3bszBWZzW+kpNI3AT4ydvVRYIfaQbYwV4UlX/rSc7BtFjLAezhow==" + }, "deep-eql": { "version": "3.0.1", "resolved": "https://registry.nlark.com/deep-eql/download/deep-eql-3.0.1.tgz", diff --git a/compiler/package.json b/compiler/package.json index 184471308..0a1f4afdf 100644 --- a/compiler/package.json +++ b/compiler/package.json @@ -40,6 +40,7 @@ "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^8.1.0", "deccjsunit": "^1.0.6", + "hypium":"^1.0.0", "ignore-loader": "^0.1.2", "log4js": "^6.3.0", "md5": "^2.3.0", -- Gitee From b21e2a9bde65b66c1160010c5c2a23211c0bdfff Mon Sep 17 00:00:00 2001 From: leid_1021 Date: Mon, 14 Mar 2022 20:29:53 +0800 Subject: [PATCH 42/42] leidan.lei@huawei.com Signed-off-by: leid_1021 --- BUILD.gn | 17 ----- compiler/components/form_component.json | 2 +- compiler/main.js | 19 +---- compiler/package-lock.json | 32 +-------- compiler/package.json | 5 +- compiler/src/compile_info.ts | 31 ++++---- compiler/src/component_map.ts | 3 +- compiler/src/gen_abc.ts | 46 +++++------- compiler/src/gen_abc_plugin.ts | 96 ++++++++++--------------- compiler/src/process_component_build.ts | 36 +++++----- compiler/tsconfig.json | 12 ++++ compiler/webpack.config.js | 1 - 12 files changed, 100 insertions(+), 200 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index e1893c741..74b3fd07a 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -14,7 +14,6 @@ import("//build/ohos.gni") import("//build/ohos/ace/ace.gni") import("//foundation/ace/ace_engine/ace_config.gni") -import("//interface/sdk-js/interface_config.gni") ets_loader_lib_dir = get_label_info(":build_ets_loader_library", "target_out_dir") + "/lib" @@ -281,24 +280,8 @@ ohos_copy("ets_loader_ark_codegen") { outputs = [ target_out_dir + "/ets_loader_ark/codegen" ] } -ohos_copy("ohos_declaration_ets_ark") { - deps = [ "//interface/sdk-js:ohos_declaration_ets" ] - - sources = [ root_out_dir + "/ohos_declaration/ohos_declaration_ets" ] - - outputs = [ target_out_dir + "/../api" ] -} - -ohos_copy("common_api_ark") { - sources = common_api_src - deps = [ ":ohos_declaration_ets_ark" ] - outputs = [ target_out_dir + "/../../developtools/api/{{source_file_part}}" ] - module_install_name = "" -} - ohos_copy("ets_loader_node_modules") { deps = [ - ":common_api_ark", ":ets_loader_ark", ":ets_loader_ark_codegen", ":ets_loader_ark_components", diff --git a/compiler/components/form_component.json b/compiler/components/form_component.json index ea5f1bf0f..5532c7f5a 100644 --- a/compiler/components/form_component.json +++ b/compiler/components/form_component.json @@ -3,6 +3,6 @@ "atomic": true, "attrs": [ "size", "moduleName", "dimension", "allowUpdate", "visibility", - "onAcquired", "onError", "onRouter", "onUninstall" + "onAcquired", "onError", "onRouter" ] } \ No newline at end of file diff --git a/compiler/main.js b/compiler/main.js index 8a3415f33..d56551b3b 100644 --- a/compiler/main.js +++ b/compiler/main.js @@ -15,7 +15,6 @@ const fs = require('fs'); const path = require('path'); -const md5 = require('md5'); const { readFile } = require('./lib/utils'); const { WORKERS_DIR } = require('./lib/pre_define'); @@ -57,8 +56,6 @@ function initProjectConfig(projectConfig) { projectConfig.aceModuleJsonPath = projectConfig.aceModuleJsonPath || process.env.aceModuleJsonPath; projectConfig.aceSuperVisualPath = projectConfig.aceSuperVisualPath || process.env.aceSuperVisualPath - projectConfig.hashProjectPath = projectConfig.hashProjectPath || - hashProjectPath(projectConfig.projectPath) projectConfig.aceBuildJson = projectConfig.aceBuildJson || process.env.aceBuildJson; } @@ -91,10 +88,9 @@ function loadEntryObj(projectConfig) { if (manifest.pages) { const pages = manifest.pages; pages.forEach((element) => { - const sourcePath = element.replace(/^\.\/ets\//, ''); - const fileName = projectConfig.projectPath + path.sep + sourcePath + '.ets'; + const fileName = projectConfig.projectPath + path.sep + element + '.ets'; if (fs.existsSync(fileName)) { - projectConfig.entryObj['./' + sourcePath] = fileName + '?entry'; + projectConfig.entryObj['./' + element] = fileName + '?entry'; } else { throw Error(`\u001b[31m ERROR: page '${fileName}' does not exist. \u001b[39m`).message; } @@ -312,17 +308,6 @@ function processResourceArr(resourceArr, resourceMap, filePath) { } } -function hashProjectPath(projectPath) { - const ASSCIIStart = 65; - const ASSCIIEnd = 90; - const deviation = 1; - process.env.hashProjectPath = - String.fromCharCode(Math.floor(Math.random() * (ASSCIIEnd - ASSCIIStart + deviation) + ASSCIIStart)) + - md5(projectPath).substring(9, 16) + - String.fromCharCode(Math.floor(Math.random() * (ASSCIIEnd - ASSCIIStart + deviation) + ASSCIIStart)); - return process.env.hashProjectPath; -} - exports.projectConfig = projectConfig; exports.loadEntryObj = loadEntryObj; exports.readAppResource = readAppResource; diff --git a/compiler/package-lock.json b/compiler/package-lock.json index 69d55091d..9011e5422 100644 --- a/compiler/package-lock.json +++ b/compiler/package-lock.json @@ -1925,11 +1925,6 @@ "supports-color": "^7.1.0" } }, - "charenc": { - "version": "0.0.2", - "resolved": "https://registry.npmmirror.com/charenc/-/charenc-0.0.2.tgz", - "integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==" - }, "check-error": { "version": "1.0.2", "resolved": "https://registry.nlark.com/check-error/download/check-error-1.0.2.tgz", @@ -2106,11 +2101,6 @@ "which": "^2.0.1" } }, - "crypt": { - "version": "0.0.2", - "resolved": "https://registry.npmmirror.com/crypt/-/crypt-0.0.2.tgz", - "integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==" - }, "date-format": { "version": "3.0.0", "resolved": "https://registry.nlark.com/date-format/download/date-format-3.0.0.tgz", @@ -2757,11 +2747,6 @@ "resolved": "https://registry.npmmirror.com/ignore/download/ignore-5.2.0.tgz", "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==" }, - "ignore-loader": { - "version": "0.1.2", - "resolved": "https://registry.npmmirror.com/ignore-loader/-/ignore-loader-0.1.2.tgz", - "integrity": "sha512-yOJQEKrNwoYqrWLS4DcnzM7SEQhRKis5mB+LdKKh4cPmGYlLPR0ozRzHV5jmEk2IxptqJNQA5Cc0gw8Fj12bXA==" - }, "import-fresh": { "version": "3.3.0", "resolved": "https://registry.npm.taobao.org/import-fresh/download/import-fresh-3.3.0.tgz?cache=0&sync_timestamp=1608469520474&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fimport-fresh%2Fdownload%2Fimport-fresh-3.3.0.tgz", @@ -2823,11 +2808,6 @@ "binary-extensions": "^2.0.0" } }, - "is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmmirror.com/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" - }, "is-core-module": { "version": "2.8.0", "resolved": "https://registry.npmmirror.com/is-core-module/download/is-core-module-2.8.0.tgz?cache=0&sync_timestamp=1634236702465&other_urls=https%3A%2F%2Fregistry.npmmirror.com%2Fis-core-module%2Fdownload%2Fis-core-module-2.8.0.tgz", @@ -3098,16 +3078,6 @@ "integrity": "sha1-LrLjfqm2fEiR9oShOUeZr0hM96I=", "dev": true }, - "md5": { - "version": "2.3.0", - "resolved": "https://registry.npmmirror.com/md5/-/md5-2.3.0.tgz", - "integrity": "sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==", - "requires": { - "charenc": "0.0.2", - "crypt": "0.0.2", - "is-buffer": "~1.1.6" - } - }, "memory-fs": { "version": "0.5.0", "resolved": "https://registry.nlark.com/memory-fs/download/memory-fs-0.5.0.tgz", @@ -4089,7 +4059,7 @@ }, "typescript": { "version": "file:deps/ohos-typescript-4.2.3-r2.tgz", - "integrity": "sha512-L04mzKpHHkcCGLxuB9Rfy7cdzFGIh1xdV3r4cyfhP6vwcHnlUHvqkO8mUpA/1urYk0wpxlH5P1eK2219Kil2lA==" + "integrity": "sha512-a94p5mnxZMe9sJebu6gw2ixGaVGuKo7H3fU+Vd+VrogYbRrrCphlrJ2nlZnpm9r0TYe4HwHrmGkeyeJW63XUSA==" }, "uglify-js": { "version": "3.14.5", diff --git a/compiler/package.json b/compiler/package.json index 0a1f4afdf..2788dad4a 100644 --- a/compiler/package.json +++ b/compiler/package.json @@ -31,19 +31,18 @@ "file-loader": "^6.2.0", "mocha": "^8.2.1", "mocha-context": "^0.1.5", - "pegjs": "^0.10.0", "ts-node": "^9.1.1", "uglify-js": "^3.13.0", + "pegjs": "^0.10.0", "url-loader": "^4.1.1" }, "dependencies": { "clean-webpack-plugin": "^3.0.0", "copy-webpack-plugin": "^8.1.0", "deccjsunit": "^1.0.6", - "hypium":"^1.0.0", + "hypium":"^1.0.0", "ignore-loader": "^0.1.2", "log4js": "^6.3.0", - "md5": "^2.3.0", "ts-loader": "^8.0.12", "typescript": "file:./deps/ohos-typescript-4.2.3-r2.tgz", "webpack": "^5.48.0", diff --git a/compiler/src/compile_info.ts b/compiler/src/compile_info.ts index 50cf43f1d..a7dd78afc 100644 --- a/compiler/src/compile_info.ts +++ b/compiler/src/compile_info.ts @@ -49,6 +49,13 @@ configure({ export const logger = getLogger('ETS'); export const props: string[] = []; +const GLOBAL_COMMON_MODULE_CACHE: string = ` +globalThis["__common_module_cache__"] = globalThis["__common_module_cache__"] || {}; +globalThis["webpackChunkcompilier"].forEach((item)=> { + Object.keys(item[1]).forEach((element) => { + globalThis["__common_module_cache__"][element] = null; + }) +});`; interface Info { message?: string; @@ -106,15 +113,6 @@ export class ResultStates { stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS }, (assets) => { - const GLOBAL_COMMON_MODULE_CACHE = ` - globalThis["__common_module_cache__${projectConfig.hashProjectPath}"] =` + - ` globalThis["__common_module_cache__${projectConfig.hashProjectPath}"] || {}; - globalThis["webpackChunk${projectConfig.hashProjectPath}"].forEach((item)=> { - Object.keys(item[1]).forEach((element) => { - globalThis["__common_module_cache__${projectConfig.hashProjectPath}"][element] = null; - }) - });`; - if (assets['commons.js']) { assets['commons.js'] = new CachedSource( new ConcatSource(assets['commons.js'], GLOBAL_COMMON_MODULE_CACHE)); @@ -128,18 +126,13 @@ export class ResultStates { compiler.hooks.compilation.tap('Require', compilation => { JavascriptModulesPlugin.getCompilationHooks(compilation).renderRequire.tap('renderRequire', (source) => { - return `var commonCachedModule = globalThis` + - `["__common_module_cache__${projectConfig.hashProjectPath}"] ? ` + - `globalThis["__common_module_cache__${projectConfig.hashProjectPath}"]` + - `[moduleId]: null;\n` + + return `var commonCachedModule = globalThis["__common_module_cache__"] ? ` + + `globalThis["__common_module_cache__"][moduleId]: null;\n` + `if (commonCachedModule) { return commonCachedModule.exports; }\n` + source.replace('// Execute the module function', - `if (globalThis["__common_module_cache__${projectConfig.hashProjectPath}"]` + - ` && moduleId.indexOf("?name=") < 0 && ` + - `Object.keys(globalThis["__common_module_cache__${projectConfig.hashProjectPath}"])` + - `.indexOf(moduleId) >= 0) {\n` + - ` globalThis["__common_module_cache__${projectConfig.hashProjectPath}"]` + - `[moduleId] = module;\n}`); + `if (globalThis["__common_module_cache__"] && moduleId.indexOf("?name=") < 0 && ` + + `Object.keys(globalThis["__common_module_cache__"]).indexOf(moduleId) >= 0) {\n` + + ` globalThis["__common_module_cache__"][moduleId] = module;\n}`); }); }); diff --git a/compiler/src/component_map.ts b/compiler/src/component_map.ts index 8d8360848..c7fe3d1b0 100644 --- a/compiler/src/component_map.ts +++ b/compiler/src/component_map.ts @@ -86,8 +86,7 @@ export const JS_BIND_COMPONENTS: Set = new Set([ 'TabsController', 'CalendarController', 'AbilityController', 'VideoController', 'WebController', 'XComponentController', 'CanvasRenderingContext2D', 'CanvasGradient', 'ImageBitmap', 'ImageData', 'Path2D', 'RenderingContextSettings', 'OffscreenCanvasRenderingContext2D', 'DatePickerDialog', - 'TextPickerDialog', 'AlertDialog', 'ContextMenu', 'ActionSheet', 'PatternLockController', - 'TimePickerDialog' + 'TextPickerDialog', 'AlertDialog', 'ContextMenu', 'ActionSheet', 'PatternLockController' ]); export const NEEDPOP_COMPONENT: Set = new Set(['Blank', 'Search']); diff --git a/compiler/src/gen_abc.ts b/compiler/src/gen_abc.ts index 8d20e07a5..dd923af2f 100644 --- a/compiler/src/gen_abc.ts +++ b/compiler/src/gen_abc.ts @@ -1,35 +1,23 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import * as childProcess from 'child_process'; -import * as process from 'process'; +import * as process from 'child_process'; import * as fs from 'fs'; -import cluster from 'cluster'; import { logger } from './compile_info'; +const {workerData, threadId} = require('worker_threads'); + +interface File { + path: string, + size: number +} const red: string = '\u001b[31m'; const reset: string = '\u001b[39m'; -function js2abcByWorkers(jsonInput: string, cmd: string): Promise { - const inputPaths = JSON.parse(jsonInput); +function js2abcByWorkers(inputPaths: File[], cmd: string): Promise { for (let i = 0; i < inputPaths.length; ++i) { - const input = inputPaths[i].path; - const singleCmd = `${cmd} "${input}"`; - logger.debug("gen abc cmd is: ", singleCmd, " ,file size is:", inputPaths[i].size, " byte"); + let input = inputPaths[i].path; + let singleCmd = `${cmd} "${input}"`; + logger.debug("gen abc cmd is: ", singleCmd); try { - childProcess.execSync(singleCmd); + process.execSync(singleCmd); } catch (e) { logger.error(red, `ETS:ERROR Failed to convert file ${input} to abc `, reset); return; @@ -49,10 +37,8 @@ function js2abcByWorkers(jsonInput: string, cmd: string): Promise { } } -logger.debug("worker data is: ", JSON.stringify(process.env)); -logger.debug("gen_abc isWorker is: ", cluster.isWorker); -if (cluster.isWorker && process.env["inputs"] !== undefined && process.env["cmd"] !== undefined) { - logger.debug("==>worker #", cluster.worker.id, "started!"); - js2abcByWorkers(process.env["inputs"], process.env["cmd"]); - process.exit(); +logger.debug("worker data is: ", JSON.stringify(workerData)); +if (JSON.stringify(workerData) !== 'null') { + logger.debug("==>worker #", threadId, "started!"); + js2abcByWorkers(workerData.input, workerData.cmd); } diff --git a/compiler/src/gen_abc_plugin.ts b/compiler/src/gen_abc_plugin.ts index eac73f7de..1565e11c3 100644 --- a/compiler/src/gen_abc_plugin.ts +++ b/compiler/src/gen_abc_plugin.ts @@ -15,11 +15,10 @@ import * as fs from 'fs'; import * as path from 'path'; -import cluster from 'cluster'; -import * as process from 'process'; import Compiler from 'webpack/lib/Compiler'; import { logger } from './compile_info'; +const {Worker, isMainThread} = require('worker_threads'); const firstFileEXT: string = '_.js'; const genAbcScript = 'gen_abc.js'; let output: string; @@ -33,7 +32,7 @@ interface File { path: string, size: number } -const intermediateJsBundle: Array = []; +let intermediateJsBundle: Array = []; const red: string = '\u001b[31m'; const reset: string = '\u001b[39m'; @@ -71,7 +70,31 @@ export class GenAbcPlugin { }); compiler.hooks.afterEmit.tap('GenAbcPluginMultiThread', () => { - invokeWorkersToGenAbc(); + let param: string = ''; + if (isDebug) { + param += ' --debug'; + } + + if (isMainThread) { + let js2abc: string = path.join(arkDir, 'build', 'src', 'index.js'); + if (isWin) { + js2abc = path.join(arkDir, 'build-win', 'src', 'index.js'); + } else if (isMac) { + js2abc = path.join(arkDir, 'build-mac', 'src', 'index.js'); + } + let maxWorkerNumber = 3; + let splitedBundles = splitJsBundlesBySize(intermediateJsBundle, maxWorkerNumber); + let workerNumber = maxWorkerNumber < splitedBundles.length ? maxWorkerNumber : splitedBundles.length; + let cmdPrefix: string = `${nodeJs} --expose-gc "${js2abc}" ${param} `; + let workers = []; + for (let i = 0; i < workerNumber; ++i) { + workers.push(new Worker(path.resolve(__dirname, genAbcScript), + {workerData: {input: splitedBundles[i], cmd: cmdPrefix} })); + workers[i].on('exit', () => { + logger.debug("worker ", i, "finished!"); + }); + } + } }); } } @@ -83,7 +106,7 @@ function writeFileSync(inputString: string, output: string, jsBundleFile: string } fs.writeFileSync(output, inputString); if (fs.existsSync(output)) { - const fileSize = fs.statSync(output).size; + let fileSize = fs.statSync(output).size; intermediateJsBundle.push({path: output, size: fileSize}); } else { logger.error(red, `ETS:ERROR Failed to convert file ${jsBundleFile} to bin. ${output} is lost`, reset); @@ -99,14 +122,14 @@ function mkDir(path_: string): void { } function getSmallestSizeGroup(groupSize: Map) { - const groupSizeArray = Array.from(groupSize); + let groupSizeArray = Array.from(groupSize); groupSizeArray.sort(function(g1, g2) { - return g1[1] - g2[1]; // sort by size + return g1[1] - g2[1]; // sort by value }); - return groupSizeArray[0][0]; + return groupSizeArray[0][0]; // return key } -function splitJsBundlesBySize(bundleArray: Array, groupNumber: number) { +function splitJsBundlesBySize(bundleArray: Array, groupNumber: number){ let result = []; if (bundleArray.length < groupNumber) { result.push(bundleArray); @@ -116,66 +139,19 @@ function splitJsBundlesBySize(bundleArray: Array, groupNumber: number) { bundleArray.sort(function(f1: File, f2: File) { return f2.size - f1.size; }); - const groupFileSize = new Map(); + let groupFileSize = new Map(); for (let i = 0; i < groupNumber; ++i) { result.push([]); groupFileSize.set(i, 0); } let index = 0; - while (index < bundleArray.length) { - const smallestGroup = getSmallestSizeGroup(groupFileSize); + while(index < bundleArray.length) { + let smallestGroup = getSmallestSizeGroup(groupFileSize); result[smallestGroup].push(bundleArray[index]); - const sizeUpdate = groupFileSize.get(smallestGroup) + bundleArray[index].size; + let sizeUpdate = groupFileSize.get(smallestGroup) + bundleArray[index].size; groupFileSize.set(smallestGroup, sizeUpdate); index++; } return result; } - -function invokeWorkersToGenAbc() { - let param: string = ''; - if (isDebug) { - param += ' --debug'; - } - - let js2abc: string = path.join(arkDir, 'build', 'src', 'index.js'); - if (isWin) { - js2abc = path.join(arkDir, 'build-win', 'src', 'index.js'); - } else if (isMac) { - js2abc = path.join(arkDir, 'build-mac', 'src', 'index.js'); - } - - const maxWorkerNumber = 3; - const splitedBundles = splitJsBundlesBySize(intermediateJsBundle, maxWorkerNumber); - const workerNumber = maxWorkerNumber < splitedBundles.length ? maxWorkerNumber : splitedBundles.length; - const cmdPrefix: string = `${nodeJs} --expose-gc "${js2abc}" ${param} `; - - const clusterNewApiVersion = 16; - const currentNodeVersion = parseInt(process.version.split('.')[0]); - const useNewApi = currentNodeVersion >= clusterNewApiVersion ? true : false; - - if ((useNewApi && cluster.isPrimary) || (!useNewApi && cluster.isMaster)) { - if (useNewApi) { - cluster.setupPrimary({ - exec: path.resolve(__dirname, genAbcScript) - }); - } else { - cluster.setupMaster({ - exec: path.resolve(__dirname, genAbcScript) - }); - } - - for (let i = 0; i < workerNumber; ++i) { - let workerData = { - "inputs": JSON.stringify(splitedBundles[i]), - "cmd": cmdPrefix - } - cluster.fork(workerData); - } - - cluster.on('exit', (worker, code, signal) => { - logger.debug(`worker ${worker.process.pid} finished`); - }); - } -} diff --git a/compiler/src/process_component_build.ts b/compiler/src/process_component_build.ts index 6831aa253..278968a94 100644 --- a/compiler/src/process_component_build.ts +++ b/compiler/src/process_component_build.ts @@ -894,35 +894,33 @@ function addComponentAttr(temp: any, node: ts.Identifier, lastStatement: any, validateStateStyleSyntax(temp, log); } } - temp = loopEtscomponent(temp, isStylesAttr, isGlobalStyles); + temp = loopEtsComponent(temp, isStylesAttr, isGlobalStyles); statements.push(ts.factory.createExpressionStatement( createFunction(identifierNode, node, temp.arguments))); lastStatement.kind = true; } } -function loopEtscomponent(node: any, isStylesAttr: boolean, isGlobalStyles: boolean): ts.Node { - node.arguments.forEach((item: ts.Node, index: number) => { +function loopEtsComponent(temp: any, isStylesAttr: boolean, isGlobalStyles: boolean): ts.Node { + temp.arguments.forEach((item: ts.Node, index: number) => { if (isStylesAttr && isGlobalStyles) { - node.arguments[index] = traverseStylesAttr(item); + temp.arguments[index] = traverseStylesAttr(item); } - if (ts.isEtsComponentExpression(item)) { - node.arguments[index] = ts.factory.createCallExpression( - item.expression, undefined, item.arguments); - } else if (ts.isCallExpression(item) || ts.isNewExpression(item)) { - node.arguments[index] = ts.visitEachChild(item, - changeEtsComponentKind, contextGlobal); + if (ts.isNewExpression(item) && item.expression && ts.isEtsComponentExpression( + item.expression)) { + temp.arguments[index] = ts.factory.updateNewExpression(item, item.expression.expression, + undefined, item.expression.arguments); + } else if (ts.isEtsComponentExpression(item)) { + temp.arguments[index] = ts.factory.createCallExpression(item.expression, + undefined, item.arguments); + } else if ((ts.isCallExpression(item) || ts.isNewExpression(item)) && item.expression && + ts.isPropertyAccessExpression(item.expression) && item.expression.expression && + ts.isEtsComponentExpression(item.expression.expression)) { + temp.arguments[index].expression.expression = ts.factory.createCallExpression( + item.expression.expression.expression, undefined, item.expression.expression.arguments); } }); - return node; -} - -function changeEtsComponentKind(node: ts.Node): ts.Node { - if (ts.isEtsComponentExpression(node)) { - node.kind = 204; - return node; - } - return ts.visitEachChild(node, changeEtsComponentKind, contextGlobal); + return temp; } function classifyArgumentsNum(args: any, argumentsArr: ts.Expression[], propName: string, diff --git a/compiler/tsconfig.json b/compiler/tsconfig.json index 4204e142a..b53c39d76 100644 --- a/compiler/tsconfig.json +++ b/compiler/tsconfig.json @@ -30,6 +30,7 @@ "Ellipse", "Flex", "FormComponent", + "FrictionMotion", "Gauge", "GeometryView", "Grid", @@ -67,6 +68,7 @@ "RichText", "Scroll", "ScrollBar", + "ScrollMotion", "Search", "Section", "Select", @@ -210,6 +212,11 @@ "type": "FormComponentAttribute", "instance": "FormComponentInstance" }, + { + "name": "FrictionMotion", + "type": "FrictionMotionAttribute", + "instance": "FrictionMotionInstance" + }, { "name": "Gauge", "type": "GaugeAttribute", @@ -395,6 +402,11 @@ "type": "ScrollBarAttribute", "instance": "ScrollBarInstance" }, + { + "name": "ScrollMotion", + "type": "ScrollMotionAttribute", + "instance": "ScrollMotionInstance" + }, { "name": "Search", "type": "SearchAttribute", diff --git a/compiler/webpack.config.js b/compiler/webpack.config.js index 9e5dca025..10efa7a0f 100644 --- a/compiler/webpack.config.js +++ b/compiler/webpack.config.js @@ -281,6 +281,5 @@ module.exports = (env, argv) => { if (appResourcePath) { readAppResource(resources, appResourcePath); } - config.output.library = projectConfig.hashProjectPath; return config; } \ No newline at end of file -- Gitee