@next-bricks/vb-experiment 1.3.16 → 1.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bricks.json +1 -1
- package/dist/chunks/1469.1099f419.js +2 -0
- package/dist/chunks/1469.1099f419.js.map +1 -0
- package/dist/chunks/{2857.bfd7ab6b.js → 2857.da8e603e.js} +2 -2
- package/dist/chunks/2857.da8e603e.js.map +1 -0
- package/dist/chunks/7131.ed1c7310.js +2 -0
- package/dist/chunks/7131.ed1c7310.js.map +1 -0
- package/dist/chunks/app-playground.57f8b0b2.js +2 -0
- package/dist/chunks/app-playground.57f8b0b2.js.map +1 -0
- package/dist/chunks/{main.5eb0373c.js → main.0ecb65a5.js} +2 -2
- package/dist/chunks/{main.5eb0373c.js.map → main.0ecb65a5.js.map} +1 -1
- package/dist/chunks/tsx-playground.afd56710.js +2 -0
- package/dist/chunks/tsx-playground.afd56710.js.map +1 -0
- package/dist/{index.b762a597.js → index.ab859801.js} +2 -2
- package/dist/{index.b762a597.js.map → index.ab859801.js.map} +1 -1
- package/dist/manifest.json +13 -0
- package/dist/types.json +27 -0
- package/dist-types/tsx-playground/index.d.ts +7 -0
- package/package.json +2 -2
- package/dist/chunks/1469.083be8f8.js +0 -2
- package/dist/chunks/1469.083be8f8.js.map +0 -1
- package/dist/chunks/2857.bfd7ab6b.js.map +0 -1
- package/dist/chunks/4154.371b28c0.js +0 -2
- package/dist/chunks/4154.371b28c0.js.map +0 -1
- package/dist/chunks/app-playground.0745e311.js +0 -2
- package/dist/chunks/app-playground.0745e311.js.map +0 -1
- package/dist/chunks/tsx-playground.edb19559.js +0 -2
- package/dist/chunks/tsx-playground.edb19559.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunks/1469.083be8f8.js","mappings":"mYA8RAA,eAAeC,EACbC,GAEiB,IADjB,WAAEC,EAAU,KAAEC,GAAO,EAAI,WAAEC,GAA6BC,UAAAC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I,GAAM,CAAEnK,KAAM,WAAW,WAAA+S,IAAAlH,EAAAA,EAAAA,GAAApB,GAAAsI,GAAA,CAAAA,EAAAjH,KAAAC,EAAAA,EAAAA,GAAAtB,GAAAsI,EAAAjH,KAAA,GAAAkH,GAAApI,GAAAtF,KAAA2N,EAAAA,EAAAA,GAAAD,KARAlI,EAAAA,mBAAgB6H,I,kEEjFxCoE,E,MAA0B,GAA4B,KAE1DA,EAAwB5S,KAAK,CAAC6S,EAAOvU,GAAI,oJACyC,KAElFsU,EAAwBzN,OAAS,CAChC,UAAa,sBACb,OAAU,mBACV,QAAW,qBAEZ,S,kECVIyN,E,MAA0B,GAA4B,KAE1DA,EAAwB5S,KAAK,CAAC6S,EAAOvU,GAAI,0QAC+H,KAExK,QAAesU,EAAwBE,U,kECLnCF,E,MAA0B,GAA4B,KAE1DA,EAAwB5S,KAAK,CAAC6S,EAAOvU,GAAI,wJAC6C,KAEtFsU,EAAwBzN,OAAS,CAChC,UAAa,sBACb,OAAU,mBACV,QAAW,qBAEZ,S","sources":["webpack:///./src/data-providers/export-as-source-files.ts","webpack:///./src/data-providers/export-widgets.ts","webpack:///../../../src/helpers/index.ts","webpack:///../../src/withBox.ts","webpack:///./src/tsx-playground/styles.module.css?e933","webpack:///./src/tsx-playground/index.tsx","webpack:///./src/tsx-playground/createPortal.ts","webpack:///../../../src/modules/convertView.ts","webpack:///./src/app-preview/index.tsx","webpack:///./src/app-playground/styles.module.css?1659","webpack:///./src/app-playground/index.tsx","webpack:///../../../src/modules/convertApp.ts","webpack:///./src/app-playground/styles.module.css","webpack:///./src/app-preview/styles.shadow.css","webpack:///./src/tsx-playground/styles.module.css"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-non-null-assertion */\nimport type { Storyboard, MicroApp, StoryboardMeta } from \"@next-core/types\";\nimport { createProviderClass } from \"@next-core/utils/general\";\nimport JSZip from \"jszip\";\nimport { saveAs } from \"file-saver\";\nimport { format } from \"prettier/standalone\";\nimport * as prettierPluginBabel from \"prettier/plugins/babel\";\nimport * as prettierPluginEstree from \"prettier/plugins/estree\";\nimport { transform } from \"@babel/standalone\";\nimport {\n ExtractState,\n extractRoutes,\n extractTemplates,\n} from \"./utils/extract.js\";\nimport {\n SourceFileOrFolder,\n buildFileStructure,\n} from \"./utils/buildFileStructure.js\";\nimport { generate } from \"./utils/generators/generate.js\";\nimport srcResourcesIndexJs from \"./raws/src/resources/index.js.txt\";\nimport srcIndexJs from \"./raws/src/index.js.txt\";\nimport editorConfig from \"./raws/.editorconfig.txt\";\nimport gitIgnore from \"./raws/.gitignore.txt\";\nimport declarationsDTs from \"./raws/declarations.d.ts.txt\";\nimport devConfigMjs from \"./raws/dev.config.mjs.txt\";\nimport jsconfigJson from \"./raws/jsconfig.json.txt\";\nimport nextJsxConfigJs from \"./raws/next-jsx.config.js.txt\";\nimport packageJson from \"./raws/package.json.txt\";\nimport readmeMd from \"./raws/README.md.txt\";\nimport { JS_RESERVED_WORDS } from \"./utils/constants.js\";\nimport TransformStoryboardFunction from \"./utils/plugins/storyboard-function.js\";\nimport SmartImports from \"./utils/plugins/smart-imports.js\";\n\nexport interface StoryboardAssemblyResult {\n storyboard: Storyboard;\n\n projectDetail: {\n appId: string;\n name: string;\n appSetting: Pick<\n MicroApp,\n \"homepage\" | \"theme\" | \"locales\" | \"noAuthGuard\"\n > & {\n layoutType?: string;\n defaultConfig?: string;\n icon?: string;\n };\n brickNextVersion?: number;\n };\n}\n\nexport async function exportAsSourceFiles({\n projectDetail,\n storyboard,\n}: StoryboardAssemblyResult): Promise<void> {\n const zip = new JSZip();\n const project = zip.folder(\"project\")!;\n const src = project.folder(\"src\")!;\n\n const extractState: ExtractState = {\n extracts: [],\n namePool: new Map(),\n };\n const extractedRoutes = extractRoutes(storyboard.routes, [], extractState);\n\n const app: MicroApp & { layoutType?: string } = {\n id: projectDetail.appId,\n name: projectDetail.name,\n homepage: projectDetail.appSetting.homepage,\n layoutType: projectDetail.appSetting.layoutType,\n theme: projectDetail.appSetting.theme,\n noAuthGuard: projectDetail.appSetting.noAuthGuard,\n locales: projectDetail.appSetting.locales,\n defaultConfig: JSON.parse(projectDetail.appSetting.defaultConfig || \"{}\"),\n menuIcon: JSON.parse(projectDetail.appSetting.icon || \"null\"),\n standaloneMode: true,\n };\n src.file(\n \"app.js\",\n await formatJs(`export default ${JSON.stringify(app, null, 2)};`)\n );\n\n const meta = (storyboard.meta ?? {}) as StoryboardMeta & {\n workflows?: unknown;\n userGroups?: unknown;\n };\n const customTemplates = meta.customTemplates ?? [];\n const functions = meta.functions ?? [];\n const menus = meta.menus ?? [];\n const contracts = meta.contracts ?? [];\n const i18n = meta.i18n ?? {};\n delete meta.customTemplates;\n delete meta.functions;\n delete meta.menus;\n delete meta.contracts;\n delete meta.i18n;\n delete meta.workflows;\n delete meta.mocks;\n delete meta.userGroups;\n\n const extractedTemplates = extractTemplates(\n customTemplates,\n [\"components\"],\n extractState\n );\n extractState.extracts.push({\n name: \"index\",\n path: [\"components\"],\n node: extractedTemplates,\n nodeType: \"others\",\n });\n\n const fileStructure = buildFileStructure(extractState.extracts);\n\n src.file(\"index.js\", srcIndexJs);\n\n src.file(\n \"routes.jsx\",\n await formatJs(generate(extractedRoutes, \"routes\", [\"routes.jsx\"]))\n );\n\n const resources = src.folder(\"resources\")!;\n\n // Functions\n const fnDir = resources.folder(\"functions\")!;\n const fnNames: string[] = [];\n const fnImports: string[] = [];\n for (const fn of functions) {\n if (fn.name === \"index\") {\n throw new Error('Unexpected function name: \"index\"');\n }\n\n // Prepend with `export default` for functions\n const inferredImports = new Set<string>();\n let { code } = transform(fn.source, {\n filename: `expr.${fn.typescript ? \"ts\" : \"js\"}`,\n plugins: [\n ...(fn.typescript ? [\"syntax-typescript\"] : []),\n TransformStoryboardFunction,\n [\n SmartImports,\n {\n imports: inferredImports,\n },\n ],\n ],\n }) as { code: string };\n const hasFN = inferredImports.has(\"FN\");\n if (hasFN) {\n inferredImports.delete(\"FN\");\n }\n const importStrings: string[] = [];\n if (inferredImports.size > 0) {\n importStrings.push(\n `import { ${[...inferredImports].join(\", \")} } from \"next-jsx/runtime\";`\n );\n }\n if (hasFN) {\n importStrings.push(`import FN from \"./index.js\";`);\n }\n if (importStrings.length > 0) {\n code = `${importStrings.join(\"\\n\")}\\n\\n${code}`;\n }\n\n fnDir.file(`${fn.name}.${fn.typescript ? \"ts\" : \"js\"}`, code);\n fnImports.push(`import ${fn.name} from \"./${fn.name}.js\";`);\n fnNames.push(fn.name);\n }\n fnDir.file(\n \"index.js\",\n await formatJs(\n `${fnImports.join(\"\\n\")}\\n\\nconst FN = { ${fnNames.join(\n \",\"\n )} };\\n\\nexport default FN;`\n )\n );\n\n // Menus\n const menusDir = resources.folder(\"menus\")!;\n const menuNames: string[] = [];\n const menuImports: string[] = [];\n for (const menu of menus) {\n cleanMenu(menu);\n if (menu.menuId === \"index\") {\n throw new Error('Unexpected menu id: \"index\"');\n }\n const filename = `${menu.menuId}.js`;\n menusDir.file(\n filename,\n await formatJs(generate(menu, \"menu\", [\"resources\", \"menus\", filename]))\n );\n let name = menu.menuId.replace(/^\\d+|[^\\w]+/g, \"_\");\n if (JS_RESERVED_WORDS.has(name)) {\n name = `${name}__2`;\n }\n menuImports.push(`import ${name} from \"./${filename}\";`);\n menuNames.push(name);\n }\n menusDir.file(\n \"index.js\",\n await formatJs(\n `${menuImports.join(\"\\n\")}\\n\\nexport default [${menuNames.join(\",\")}]`\n )\n );\n\n // Contracts\n const contractsDir = resources.folder(\"contracts\")!;\n const contractImports: string[] = [];\n const contractNames = new Set<string>();\n for (const contract of contracts) {\n const baseName = contract.name.replace(/^\\d+|[^\\w]+/g, \"_\");\n let counter = 2;\n let varName = baseName;\n while (\n contractNames.has(varName) ||\n JS_RESERVED_WORDS.has(varName) ||\n varName === \"index\"\n ) {\n varName = `${baseName}_${counter++}`;\n }\n contractNames.add(varName);\n\n contractsDir.file(\n `${varName}.js`,\n await formatJs(`export default ${JSON.stringify(contract)};`)\n );\n contractImports.push(`import ${varName} from \"./${varName}.js\";`);\n }\n contractsDir.file(\n \"index.js\",\n await formatJs(\n `${contractImports.join(\"\\n\")}\\n\\nexport default [${[\n ...contractNames,\n ].join(\",\")}]`\n )\n );\n\n resources\n .folder(\"i18n\")!\n .file(\n \"index.js\",\n await formatJs(`export default ${JSON.stringify(i18n)};`)\n );\n resources.file(\n \"meta.js\",\n await formatJs(`export default ${JSON.stringify(meta, null, 2)};`)\n );\n resources.file(\"index.js\", srcResourcesIndexJs);\n\n await generateByFileStructure(fileStructure, src, []);\n\n const appDir = project\n .folder(\"mock-micro-apps\")!\n .folder(projectDetail.appId)!;\n appDir.file(\".gitignore\", \"*\\n!.gitignore\");\n\n project.file(\".editorconfig\", editorConfig);\n project.file(\".gitignore\", gitIgnore);\n project.file(\"dev.config.mjs\", devConfigMjs);\n project.file(\"declarations.d.ts\", declarationsDTs);\n project.file(\"jsconfig.json\", jsconfigJson);\n project.file(\n \"next-jsx.config.js\",\n nextJsxConfigJs.replaceAll(\"__APP_ID__\", projectDetail.appId)\n );\n project.file(\n \"package.json\",\n packageJson.replaceAll(\"__APP_ID__\", projectDetail.appId)\n );\n project.file(\n \"README.md\",\n readmeMd\n .replaceAll(\"__PROJECT_NAME__\", projectDetail.name)\n .replaceAll(\"__PROJECT_HOMEPAGE__\", projectDetail.appSetting.homepage)\n );\n\n const blob = await zip.generateAsync({ type: \"blob\" });\n saveAs(blob, \"project.zip\");\n}\n\ninterface FormatJsOptions {\n typescript?: boolean;\n semi?: boolean;\n printWidth?: number;\n}\n\nasync function formatJs(\n source: string,\n { typescript, semi = true, printWidth }: FormatJsOptions = {}\n): Promise<string> {\n return await format(source, {\n parser: typescript ? \"babel-ts\" : \"babel\",\n plugins: [prettierPluginBabel, prettierPluginEstree as any],\n semi,\n printWidth,\n trailingComma: \"es5\",\n });\n}\n\nasync function generateByFileStructure(\n items: SourceFileOrFolder[],\n folder: JSZip,\n path: string[]\n) {\n for (const item of items) {\n const childPath = [...path, item.name];\n if (item.type === \"folder\") {\n const childFolder = folder.folder(item.name)!;\n await generateByFileStructure(item.items, childFolder, childPath);\n } else {\n folder.file(\n `${item.name}.js${\n item.nodeType === \"routes\" ||\n item.nodeType === \"bricks\" ||\n item.nodeType === \"template\"\n ? \"x\"\n : \"\"\n }`,\n await formatJs(generate(item.node, item.nodeType, childPath))\n );\n }\n }\n}\n\nfunction cleanMenu(menu: Record<string, any>) {\n for (const [key, value] of Object.entries(menu)) {\n switch (key) {\n case \"items\":\n if (Array.isArray(value)) {\n for (const item of value) {\n cleanMenuItem(item);\n }\n }\n break;\n case \"type\":\n if (value === \"main\") {\n delete menu[key];\n }\n break;\n case \"if\":\n break;\n case \"i18n\":\n if (Object.keys(value).length === 0) {\n delete menu[key];\n }\n break;\n default:\n if (value === null || value === false) {\n delete menu[key];\n }\n }\n }\n}\n\nfunction cleanMenuItem(menuItem: Record<string, any>) {\n for (const [key, value] of Object.entries(menuItem)) {\n switch (key) {\n case \"children\":\n if (Array.isArray(value) && value.length > 0) {\n cleanMenuItem(value);\n }\n break;\n case \"if\":\n break;\n case \"activeExcludes\":\n case \"activeIncludes\":\n if (Array.isArray(value) && value.length === 0) {\n delete menuItem[key];\n }\n break;\n default:\n if (value === null || value === false) {\n delete menuItem[key];\n }\n }\n }\n}\n\ncustomElements.define(\n \"vb-experiment.export-as-source-files\",\n createProviderClass(exportAsSourceFiles)\n);\n","import { createProviderClass } from \"@next-core/utils/general\";\nimport JSZip from \"jszip\";\nimport { saveAs } from \"file-saver\";\n\ninterface ExportWidgetsParams {\n name: string;\n files: FileInfo[];\n}\n\ninterface FileInfo {\n path: string;\n content: string;\n}\n\nexport async function exportWidgets({\n name,\n files,\n}: ExportWidgetsParams): Promise<void> {\n const fs = new Map<string, JSZip>();\n const zip = new JSZip();\n const widgets = zip.folder(\"widgets\")!;\n const project = widgets.folder(name)!;\n\n for (const { path, content } of files) {\n const segments = path.split(\"/\");\n const filename = segments.pop()!;\n let handle = project;\n let i = 1;\n for (const segment of segments) {\n const current = segments.slice(0, i).join(\"/\");\n const found = fs.get(current);\n if (found) {\n handle = found;\n } else {\n handle = handle.folder(segment)!;\n fs.set(current, handle);\n }\n i++;\n }\n handle.file(filename, content);\n }\n\n const blob = await zip.generateAsync({ type: \"blob\" });\n saveAs(blob, `${name}.zip`);\n}\n\ncustomElements.define(\n \"vb-experiment.export-widgets\",\n createProviderClass(exportWidgets)\n);\n","import mergeTexts from \"../../../src/helpers/mergeTexts.ts?raw\";\nimport getLatestMetricValue from \"../../../src/helpers/getLatestMetricValue.ts?raw\";\nimport extractList from \"../../../src/helpers/extractList.ts?raw\";\nimport groupMetricData from \"../../../src/helpers/groupMetricData.ts?raw\";\nimport getMetricDisplayNames from \"../../../src/helpers/getMetricDisplayNames.ts?raw\";\n\nlet helperFunctions: Map<string, string> | undefined;\n\nexport function getHelperFunctions() {\n if (!helperFunctions) {\n helperFunctions = new Map([\n [\"_helper_mergeTexts\", fixFunctionSource(mergeTexts)],\n [\"_helper_getLatestMetricValue\", fixFunctionSource(getLatestMetricValue)],\n [\"_helper_extractList\", fixFunctionSource(extractList)],\n [\"_helper_groupMetricData\", fixFunctionSource(groupMetricData)],\n [\n \"_helper_getMetricDisplayNames\",\n fixFunctionSource(getMetricDisplayNames),\n ],\n ]);\n }\n return helperFunctions;\n}\n\nfunction fixFunctionSource(source: string): string {\n return source.replace(/^export /m, \"\").replace(/^import [^\\n]+\\n/gm, \"\");\n}\n","import { BrickConf } from \"@next-core/types\";\nimport type { ConvertOptions } from \"./interfaces.js\";\n\nexport function withBox(\n children: BrickConf[] | undefined,\n options: ConvertOptions\n): BrickConf {\n return {\n brick: \"div\",\n properties: {\n style: options.expanded\n ? {\n background: \"rgba(255, 255, 255, 0.9)\",\n backdropFilter: \"blur(10px)\",\n borderRadius: \"16px\",\n padding: \"24px\",\n }\n : {\n background: \"var(--elevo-component-background)\",\n backdropFilter: \"var(--elevo-component-backdrop-filter)\",\n borderRadius: \"var(--elevo-border-radius)\",\n padding: \"16px\",\n },\n },\n children,\n };\n}\n","\n import API from \"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./styles.module.css\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\noptions.insert = insertFn.bind(null, \"head\");\noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./styles.module.css\";\n export default content && content.locals ? content.locals : undefined;\n","import React, {\n Suspense,\n useCallback,\n useDeferredValue,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { createDecorators, type EventEmitter } from \"@next-core/element\";\nimport { httpErrorToString, unstable_createRoot } from \"@next-core/runtime\";\nimport { ReactNextElement } from \"@next-core/react-element\";\nimport { asyncWrapBrick } from \"@next-core/react-runtime\";\nimport { uniqueId } from \"lodash\";\nimport type {\n CodeEditor,\n CodeEditorProps,\n ExtraLib,\n ExtraMarker,\n} from \"@next-bricks/vs/code-editor\";\nimport nextTsxDefinition from \"@next-shared/tsx-parser/lib/next-tsx.d.ts?raw\";\nimport componentsDefinition from \"@next-shared/tsx-converter/lib/components.d.ts?raw\";\nimport { convertView, type ConvertResult } from \"@next-shared/tsx-converter\";\nimport type { ParsedApp } from \"@next-shared/tsx-parser\";\nimport \"@next-core/theme\";\nimport styles from \"./styles.module.css\";\nimport { getRemoteTsxParserWorker } from \"./workers/tsxParser.js\";\nimport { createPortal } from \"./createPortal.js\";\n\ninterface CodeEditorEvents {\n \"code.change\": CustomEvent<string>;\n}\n\ninterface CodeEditorMapEvents {\n onCodeChange: \"code.change\";\n}\n\nconst AsyncWrappedCodeEditor = React.lazy(async () => ({\n default: await asyncWrapBrick<\n CodeEditor,\n CodeEditorProps,\n CodeEditorEvents,\n CodeEditorMapEvents\n >(\"vs.code-editor\", {\n onCodeChange: \"code.change\",\n }),\n}));\n\nconst BUILTIN_LIBS: ExtraLib[] = [\n {\n filePath: \"/node_modules/next-tsx/components.d.ts\",\n content: componentsDefinition.replaceAll(\"export interface\", \"interface\"),\n },\n {\n filePath: \"/node_modules/next-tsx/package.json\",\n content: JSON.stringify({\n name: \"next-tsx\",\n types: \"./index.d.ts\",\n }),\n },\n {\n filePath: \"/node_modules/next-tsx/index.d.ts\",\n content: nextTsxDefinition,\n },\n];\n\nconst { defineElement, property, event } = createDecorators();\n\nexport interface TsxPlaygroundProps {\n source?: string;\n extraLibs?: ExtraLib[];\n}\n\n/**\n * 构件 `vb-experiment.tsx-playground`\n */\nexport\n@defineElement(\"vb-experiment.tsx-playground\", {\n // Monaco editor does not work well with shadow DOM\n shadowOptions: false,\n})\nclass TsxPlayground extends ReactNextElement implements TsxPlaygroundProps {\n /** 仅初始有效 */\n @property({ attribute: false })\n accessor source: string | undefined;\n\n @property({ attribute: false })\n accessor extraLibs: ExtraLib[] | undefined;\n\n @event({ type: \"change\" })\n accessor #change!: EventEmitter<string>;\n\n #handleChange = (value: string) => {\n this.#change?.emit(value);\n };\n\n render() {\n return (\n <TsxPlaygroundComponent\n source={this.source}\n extraLibs={this.extraLibs}\n onChange={this.#handleChange}\n />\n );\n }\n}\n\ninterface TsxPlaygroundComponentProps extends TsxPlaygroundProps {\n onChange: (value: string) => void;\n}\n\nfunction convertSeverity(\n severity: \"notice\" | \"warning\" | \"error\" | \"fatal\"\n): \"Hint\" | \"Info\" | \"Warning\" | \"Error\" {\n switch (severity) {\n case \"notice\":\n return \"Hint\";\n case \"warning\":\n return \"Warning\";\n case \"error\":\n return \"Error\";\n case \"fatal\":\n return \"Error\";\n }\n return severity;\n}\n\nfunction TsxPlaygroundComponent({\n source,\n extraLibs,\n onChange,\n}: TsxPlaygroundComponentProps) {\n const [code, setCode] = useState(source ?? \"\");\n const deferredCode = useDeferredValue(code);\n const [markers, setMarkers] = useState<ExtraMarker[] | undefined>();\n const [view, setView] = useState<ParsedApp | undefined>();\n\n const allLibs = useMemo(\n () => [...BUILTIN_LIBS, ...(extraLibs ?? [])],\n [extraLibs]\n );\n\n const handleCodeChange = useCallback(\n (e: CustomEvent<string>) => {\n setCode(e.detail);\n onChange(e.detail);\n },\n [onChange]\n );\n useEffect(() => {\n let ignore = false;\n (async function run() {\n const worker = await getRemoteTsxParserWorker();\n if (ignore) {\n return;\n }\n const result = await worker.parseView(deferredCode);\n if (ignore) {\n return;\n }\n setView(result);\n const withNodeErrors = result.errors.filter((err) => !!err.node);\n if (withNodeErrors.length > 0) {\n setMarkers(\n withNodeErrors.map((error) => ({\n message: error.message,\n severity: convertSeverity(error.severity),\n startLineNumber: error.node!.loc!.start.line,\n startColumn: error.node!.loc!.start.column + 1,\n endLineNumber: error.node!.loc!.end.line,\n endColumn: error.node!.loc!.end.column + 1,\n }))\n );\n } else {\n setMarkers(undefined);\n }\n if (ignore) {\n return;\n }\n })();\n return () => {\n ignore = true;\n };\n }, [deferredCode]);\n\n const rootId = useMemo(() => uniqueId(), []);\n const ref = useRef<HTMLDivElement>(null);\n const rootRef = useRef<Awaited<\n ReturnType<typeof unstable_createRoot>\n > | null>(null);\n\n useEffect(() => {\n const container = ref.current;\n if (!container) {\n return;\n }\n const portal = createPortal(rootId);\n const root = unstable_createRoot(container, {\n portal,\n supportsUseChildren: true,\n } as any);\n rootRef.current = root;\n\n return () => {\n root.unmount();\n portal.remove();\n rootRef.current = null;\n };\n }, [rootId]);\n\n // const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n let ignore = false;\n (async () => {\n if (!view) {\n return;\n }\n // setLoading(true);\n let convertedView: ConvertResult | undefined;\n try {\n convertedView = await convertView(view, { rootId, expanded: true });\n if (ignore) {\n return;\n }\n const { brick, context, functions, templates } = convertedView ?? {};\n await rootRef.current?.render(brick ?? [], {\n context,\n functions,\n templates,\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Failed to render view:\", error);\n rootRef.current?.render({\n brick: customElements.get(\"easyops-default-error\")\n ? \"easyops-default-error\"\n : \"div\",\n properties: {\n errorTitle: \"解析失败\",\n dataset: {\n errorBoundary: \"\",\n },\n style: {\n color: \"var(--color-error)\",\n },\n },\n children: [\n {\n brick: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n },\n },\n ],\n });\n }\n // if (!ignore) {\n // setLoading(false);\n // }\n })();\n\n return () => {\n ignore = true;\n };\n }, [rootId, view]);\n\n return (\n <div className={styles.container}>\n <div className={styles.editor}>\n <Suspense fallback=\"Loading...\">\n <AsyncWrappedCodeEditor\n value={source}\n onCodeChange={handleCodeChange}\n language=\"typescript\"\n uri=\"file:///view.tsx\"\n automaticLayout=\"fit-container\"\n theme=\"tm-vs-dark\"\n extraLibs={allLibs}\n extraMarkers={markers}\n data-override-theme=\"dark-v2\"\n />\n </Suspense>\n </div>\n <div className={styles.preview}>\n <div data-root-id={rootId} ref={ref} />\n </div>\n </div>\n );\n}\n","export function createPortal(rootId: string) {\n const portal = document.createElement(\"div\");\n portal.dataset.rootId = rootId;\n portal.style.position = \"absolute\";\n portal.style.width = portal.style.height = \"0\";\n document.body.append(portal);\n return portal;\n}\n","import type {\n BrickConfInTemplate,\n CustomTemplate,\n StoryboardFunction,\n} from \"@next-core/types\";\nimport type { ParsedApp } from \"@next-shared/tsx-parser\";\nimport convertModule, {\n type ConvertedPartOfComponent,\n} from \"./convertModule.js\";\nimport type {\n ConvertState,\n ConvertOptions,\n ConvertResult,\n} from \"../interfaces.js\";\nimport { getHelperFunctions } from \"../helpers/index.js\";\nimport { getViewTplName } from \"./getTplName.js\";\nimport { withBox } from \"../withBox.js\";\n\nexport async function convertView(\n view: ParsedApp,\n options: ConvertOptions\n): Promise<ConvertResult> {\n const { entry } = view;\n if (!entry) {\n throw new Error(\"No entry module found in the view.\");\n }\n\n const state: ConvertState = {\n usedHelpers: new Set(),\n app: view,\n };\n const convertedEntry = await convertModule(entry, state, options);\n\n const { defaultExport, internals, namedExports } = convertedEntry;\n\n if (!defaultExport) {\n throw new Error(\"No view found in the entry module.\");\n }\n\n const functions: StoryboardFunction[] = [];\n const templates: CustomTemplate[] = [];\n\n for (const part of [...internals, ...namedExports.values()]) {\n if (part.type === \"function\") {\n functions.push(part.function);\n } else if (part.type === \"template\") {\n templates.push({\n name: getViewTplName(part.name!, options.rootId),\n bricks: part.bricks as BrickConfInTemplate[],\n state: part.context,\n });\n }\n }\n\n const helpers = Array.from(state.usedHelpers).map<StoryboardFunction>(\n (name) => {\n const source = getHelperFunctions().get(name);\n if (!source) {\n throw new Error(`Helper function ${name} not found`);\n }\n return {\n name,\n source,\n typescript: true,\n };\n }\n );\n\n const { title, bricks, context } = defaultExport as ConvertedPartOfComponent;\n\n const needBox = bricks.every((brick) =>\n [\"eo-form\", \"eo-descriptions\", \"eo-button\"].includes(brick.brick)\n );\n\n return {\n title,\n brick: {\n brick: \"eo-content-layout\",\n children: needBox ? [withBox(bricks, options)] : bricks,\n },\n context: [\n ...context,\n ...(options.withContexts\n ? Object.entries(options.withContexts).map(([name, value]) => ({\n name,\n value,\n }))\n : []),\n ],\n functions: [...functions, ...helpers],\n templates,\n };\n}\n","import React, { useCallback, useEffect, useRef, useState } from \"react\";\nimport { createDecorators } from \"@next-core/element\";\nimport { ReactNextElement } from \"@next-core/react-element\";\nimport { __secret_internals, getBasePath } from \"@next-core/runtime\";\nimport type { BootstrapData, MicroApp, Storyboard } from \"@next-core/types\";\nimport \"@next-core/theme\";\nimport styleText from \"./styles.shadow.css\";\n\nconst { defineElement, property } = createDecorators();\n\nexport interface AppPreviewProps {\n storyboard?: Storyboard;\n}\n\n/**\n * 构件 `vb-experiment.app-preview`\n */\nexport\n@defineElement(\"vb-experiment.app-preview\", {\n styleTexts: [styleText],\n})\nclass AppPreview extends ReactNextElement {\n @property({ attribute: false })\n accessor storyboard: Storyboard | undefined;\n\n render() {\n return <AppPreviewComponent storyboard={this.storyboard} />;\n }\n}\n\ninterface PreviewWindow extends Window {\n _preview_only_appPreviewer?: AppPreviewer;\n}\n\ninterface AppPreviewer {\n setup(data: BootstrapData, url: string): Promise<void>;\n update(appId: string, storyboard: Partial<Storyboard>): void;\n reload(): void;\n push(url: string): void;\n replace(url: string): void;\n goBack(): void;\n goForward(): void;\n}\n\nfunction AppPreviewComponent({ storyboard }: AppPreviewProps) {\n const iframeRef = useRef<HTMLIFrameElement>(null);\n const [appPreviewer, setAppPreviewer] = useState<AppPreviewer | null>(null);\n\n const handleIframeLoad = useCallback(() => {\n const check = () => {\n const previewer = (iframeRef.current?.contentWindow as PreviewWindow)\n ?._preview_only_appPreviewer;\n if (previewer) {\n setAppPreviewer(previewer);\n } else {\n setTimeout(check, 100);\n }\n };\n check();\n }, []);\n\n const setupRef = useRef<Promise<void> | null>(null);\n\n useEffect(() => {\n if (!appPreviewer || !storyboard) {\n return;\n }\n\n const app: MicroApp = {\n id: \"lab-app-preview\",\n name: \"Lab: App Preview\",\n homepage: \"/lab-app-preview\",\n };\n\n if (setupRef.current) {\n let ignore = false;\n setupRef.current.then(() => {\n if (ignore) {\n return;\n }\n appPreviewer.update(app.id, { ...storyboard, app });\n appPreviewer.reload();\n });\n return () => {\n ignore = true;\n };\n } else {\n setupRef.current = appPreviewer.setup(\n {\n brickPackages: (__secret_internals as any).getBrickPackages(),\n storyboards: [\n {\n ...storyboard,\n app,\n },\n ],\n },\n app.homepage\n );\n }\n }, [appPreviewer, storyboard]);\n\n return (\n <div className=\"container\">\n <iframe\n ref={iframeRef}\n src={`${getBasePath()}lab/?_experimental_app_preview_=1`}\n loading=\"lazy\"\n onLoad={handleIframeLoad}\n />\n </div>\n );\n}\n","\n import API from \"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./styles.module.css\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\noptions.insert = insertFn.bind(null, \"head\");\noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../../../node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[3].use[1]!../../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[3].use[2]!./styles.module.css\";\n export default content && content.locals ? content.locals : undefined;\n","import React, {\n Suspense,\n useCallback,\n useDeferredValue,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { createDecorators, type EventEmitter } from \"@next-core/element\";\nimport { ReactNextElement, wrapBrick } from \"@next-core/react-element\";\nimport { asyncWrapBrick } from \"@next-core/react-runtime\";\nimport type { Storyboard } from \"@next-core/types\";\nimport { uniqueId } from \"lodash\";\nimport type {\n CodeEditor,\n CodeEditorProps,\n ExtraLib,\n ExtraMarker,\n} from \"@next-bricks/vs/code-editor\";\nimport nextTsxDefinition from \"@next-shared/tsx-parser/lib/next-tsx.d.ts?raw\";\nimport componentsDefinition from \"@next-shared/tsx-converter/lib/components.d.ts?raw\";\nimport { convertApp, type ConvertedApp } from \"@next-shared/tsx-converter\";\nimport type { ParsedApp } from \"@next-shared/tsx-parser\";\nimport \"@next-core/theme\";\nimport styles from \"./styles.module.css\";\nimport { getRemoteTsxParserWorker } from \"../tsx-playground/workers/tsxParser.js\";\nimport type { AppPreview, AppPreviewProps } from \"../app-preview/index.js\";\n\ninterface CodeEditorEvents {\n \"code.change\": CustomEvent<string>;\n}\n\ninterface CodeEditorMapEvents {\n onCodeChange: \"code.change\";\n}\n\nconst AsyncWrappedCodeEditor = React.lazy(async () => ({\n default: await asyncWrapBrick<\n CodeEditor,\n CodeEditorProps,\n CodeEditorEvents,\n CodeEditorMapEvents\n >(\"vs.code-editor\", {\n onCodeChange: \"code.change\",\n }),\n}));\n\nconst WrappedAppPreview = wrapBrick<AppPreview, AppPreviewProps>(\n \"vb-experiment.app-preview\"\n);\n\nconst BUILTIN_LIBS: ExtraLib[] = [\n {\n filePath: \"/node_modules/next-tsx/components.d.ts\",\n content: componentsDefinition.replaceAll(\"export interface\", \"interface\"),\n },\n {\n filePath: \"/node_modules/next-tsx/package.json\",\n content: JSON.stringify({\n name: \"next-tsx\",\n types: \"./index.d.ts\",\n }),\n },\n {\n filePath: \"/node_modules/next-tsx/index.d.ts\",\n content: nextTsxDefinition,\n },\n];\n\nconst { defineElement, property, event } = createDecorators();\n\nexport interface AppPlaygroundProps {\n source?: string;\n extraLibs?: ExtraLib[];\n}\n\n/**\n * 构件 `vb-experiment.app-playground`\n */\nexport\n@defineElement(\"vb-experiment.app-playground\", {\n // Monaco editor does not work well with shadow DOM\n shadowOptions: false,\n})\nclass AppPlayground extends ReactNextElement implements AppPlaygroundProps {\n /** 仅初始有效 */\n @property({ attribute: false })\n accessor source: string | undefined;\n\n @property({ attribute: false })\n accessor extraLibs: ExtraLib[] | undefined;\n\n @event({ type: \"change\" })\n accessor #change!: EventEmitter<string>;\n\n #handleChange = (value: string) => {\n this.#change?.emit(value);\n };\n\n render() {\n return (\n <AppPlaygroundComponent\n source={this.source}\n extraLibs={this.extraLibs}\n onChange={this.#handleChange}\n />\n );\n }\n}\n\ninterface AppPlaygroundComponentProps extends AppPlaygroundProps {\n onChange: (value: string) => void;\n}\n\nfunction convertSeverity(\n severity: \"notice\" | \"warning\" | \"error\" | \"fatal\"\n): \"Hint\" | \"Info\" | \"Warning\" | \"Error\" {\n switch (severity) {\n case \"notice\":\n return \"Hint\";\n case \"warning\":\n return \"Warning\";\n case \"error\":\n return \"Error\";\n case \"fatal\":\n return \"Error\";\n }\n return severity;\n}\n\nfunction AppPlaygroundComponent({\n source,\n extraLibs,\n onChange,\n}: AppPlaygroundComponentProps) {\n const [code, setCode] = useState(source ?? \"\");\n const deferredCode = useDeferredValue(code);\n const [markers, setMarkers] = useState<ExtraMarker[] | undefined>();\n const [view, setView] = useState<ParsedApp | undefined>();\n\n const allLibs = useMemo(\n () => [...BUILTIN_LIBS, ...(extraLibs ?? [])],\n [extraLibs]\n );\n\n const handleCodeChange = useCallback(\n (e: CustomEvent<string>) => {\n setCode(e.detail);\n onChange(e.detail);\n },\n [onChange]\n );\n useEffect(() => {\n let ignore = false;\n (async function run() {\n const worker = await getRemoteTsxParserWorker();\n if (ignore) {\n return;\n }\n const result = await worker.parseApp([\n {\n filePath: \"index.tsx\",\n content: deferredCode,\n },\n ]);\n if (ignore) {\n return;\n }\n setView(result);\n const withNodeErrors = result.errors.filter((err) => !!err.node);\n if (withNodeErrors.length > 0) {\n setMarkers(\n withNodeErrors.map((error) => ({\n message: error.message,\n severity: convertSeverity(error.severity),\n startLineNumber: error.node!.loc!.start.line,\n startColumn: error.node!.loc!.start.column + 1,\n endLineNumber: error.node!.loc!.end.line,\n endColumn: error.node!.loc!.end.column + 1,\n }))\n );\n } else {\n setMarkers(undefined);\n }\n if (ignore) {\n return;\n }\n })();\n return () => {\n ignore = true;\n };\n }, [deferredCode]);\n\n const rootId = useMemo(() => uniqueId(), []);\n\n // const [loading, setLoading] = useState(true);\n\n const [storyboard, setStoryboard] = useState<Storyboard | undefined>();\n\n useEffect(() => {\n let ignore = false;\n (async () => {\n if (!view) {\n return;\n }\n // setLoading(true);\n let convertedApp: ConvertedApp | undefined;\n try {\n convertedApp = await convertApp(view, { rootId, expanded: true });\n if (ignore) {\n return;\n }\n setStoryboard(convertedApp as Partial<Storyboard> as Storyboard);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Failed to render app:\", error);\n }\n // if (!ignore) {\n // setLoading(false);\n // }\n })();\n\n return () => {\n ignore = true;\n };\n }, [rootId, view]);\n\n return (\n <div className={styles.container}>\n <div className={styles.editor}>\n <Suspense fallback=\"Loading...\">\n <AsyncWrappedCodeEditor\n value={source}\n onCodeChange={handleCodeChange}\n language=\"typescript\"\n uri=\"file:///view.tsx\"\n automaticLayout=\"fit-container\"\n theme=\"tm-vs-dark\"\n extraLibs={allLibs}\n extraMarkers={markers}\n data-override-theme=\"dark-v2\"\n />\n </Suspense>\n </div>\n <div className={styles.preview}>\n <WrappedAppPreview storyboard={storyboard} />\n </div>\n </div>\n );\n}\n","import type {\n BrickConfInTemplate,\n CustomTemplate,\n RouteConf,\n StoryboardFunction,\n} from \"@next-core/types\";\nimport {\n MODULE_SOURCE,\n type ParsedApp,\n type ComponentChild,\n type ComponentReference,\n isOfficialComponent,\n} from \"@next-shared/tsx-parser\";\nimport convertModule, {\n type ConvertedModule,\n type ConvertedPart,\n} from \"./convertModule.js\";\nimport type {\n ConvertState,\n ConvertOptions,\n ConvertedApp,\n} from \"../interfaces.js\";\nimport { getAppTplName } from \"./getTplName.js\";\n\nexport async function convertApp(\n app: ParsedApp,\n options: ConvertOptions\n): Promise<ConvertedApp> {\n const { entry } = app;\n if (!entry) {\n throw new Error(\"No entry module found in the app.\");\n }\n\n const render = entry.render;\n if (!render) {\n throw new Error(\"No render call found in the entry module.\");\n }\n\n const { children } = render;\n\n if (children.length !== 1) {\n throw new Error(\n `Expects exactly one root component in the render call, but got ${children.length}.`\n );\n }\n\n const routesComponent = children[0];\n if (!isOfficialComponent(routesComponent, \"Routes\")) {\n throw new Error(\n `The root component must be <Routes> from \"${MODULE_SOURCE}\".`\n );\n }\n\n let convertedEntry: ConvertedModule;\n const convertedModules = new Map<string, ConvertedModule>();\n\n const state: ConvertState = {\n usedHelpers: new Set(),\n app,\n };\n\n const functions: StoryboardFunction[] = [];\n const templates: CustomTemplate[] = [];\n\n await Promise.all(\n Array.from(app.modules).map(async ([filePath, mod]) => {\n if (mod) {\n const converted = await convertModule(mod, state, options);\n convertedModules.set(filePath, converted);\n if (mod === entry) {\n convertedEntry = converted;\n }\n for (const part of [\n ...converted.internals,\n ...converted.namedExports.values(),\n ]) {\n if (part.type === \"function\") {\n functions.push(part.function);\n } else if (part.type === \"template\") {\n templates.push({\n name: getAppTplName(part.name!),\n bricks: part.bricks as BrickConfInTemplate[],\n state: part.context,\n });\n }\n }\n }\n })\n );\n\n const routes: RouteConf[] =\n routesComponent.children?.map((child) => {\n if (!isOfficialComponent(child, \"Route\")) {\n throw new Error(\n `All children of <Routes> must be <Route> from \"${MODULE_SOURCE}\".`\n );\n }\n const { path, component } = child.properties;\n\n if (typeof path !== \"string\" || !path.startsWith(\"/\")) {\n throw new Error(\n `The \"path\" property of <Route> must be a string starting with \"/\".`\n );\n }\n\n if (!component) {\n throw new Error(`The \"component\" property of <Route> is required.`);\n }\n\n const { reference } = component as ComponentChild & {\n reference: ComponentReference;\n };\n let page: ConvertedPart | null | undefined;\n if (reference.type === \"local\") {\n const parts = [\n ...convertedEntry.internals,\n ...convertedEntry.namedExports.values(),\n ];\n page = parts.find(\n (p) => p.type !== \"function\" && p.name && p.name === reference.name\n );\n } else {\n const mod = convertedModules.get(reference.importSource!);\n if (!mod) {\n throw new Error(\n `Cannot find the module \"${reference.importSource}\" imported by the route \"${path}\".`\n );\n }\n page = reference.name\n ? mod.namedExports.get(reference.name)\n : mod.defaultExport;\n }\n\n if (!page) {\n throw new Error(\n `Cannot find the component \"${reference.name}\" used in the route \"${path}\".`\n );\n }\n if (page.type !== \"page\") {\n throw new Error(\n `The component \"${reference.name}\" used in the route \"${path}\" must be a page component.`\n );\n }\n\n return {\n path: `\\${APP.homepage}${path === \"/\" ? \"\" : path}`,\n bricks: page.bricks,\n context: page.context,\n };\n }) ?? [];\n\n return {\n routes,\n meta: {\n functions,\n templates,\n },\n };\n}\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.container--AW813tLb{display:flex;height:100%}.editor--B5m74LRR,\n.preview--THWZoCIv{flex:1;min-width:0}.preview--THWZoCIv{padding:0;height:100%}`, \"\"]);\n// Exports\n___CSS_LOADER_EXPORT___.locals = {\n\t\"container\": `container--AW813tLb`,\n\t\"editor\": `editor--B5m74LRR`,\n\t\"preview\": `preview--THWZoCIv`\n};\nexport default ___CSS_LOADER_EXPORT___;\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `:host{display:block;height:100%}:host([hidden]){display:none}*{box-sizing:border-box}.container,\niframe{width:100%;height:100%;border-radius:4px}iframe{display:block;border:none;margin:0;padding:0;transform-origin:0% 0%;-webkit-user-select:none;user-select:none}`, \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___.toString();\n","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, `.container--M22i1CYq{display:flex;height:100%}.editor--kF8SUoBP,\n.preview--gu5OlS2X{flex:1;min-width:0}.preview--gu5OlS2X{padding:1em;overflow:auto}`, \"\"]);\n// Exports\n___CSS_LOADER_EXPORT___.locals = {\n\t\"container\": `container--M22i1CYq`,\n\t\"editor\": `editor--kF8SUoBP`,\n\t\"preview\": `preview--gu5OlS2X`\n};\nexport default ___CSS_LOADER_EXPORT___;\n"],"names":["async","formatJs","source","typescript","semi","printWidth","arguments","length","undefined","format","parser","plugins","prettierPluginBabel","prettierPluginEstree","trailingComma","generateByFileStructure","items","folder","path","item","childPath","name","type","childFolder","file","nodeType","generate","node","cleanMenu","menu","key","value","Object","entries","Array","isArray","cleanMenuItem","keys","menuItem","customElements","define","createProviderClass","_ref","_storyboard$meta","_meta$customTemplates","_meta$functions","_meta$menus","_meta$contracts","_meta$i18n","projectDetail","storyboard","zip","JSZip","project","src","extractState","extracts","namePool","Map","extractedRoutes","extractRoutes","routes","app","id","appId","homepage","appSetting","layoutType","theme","noAuthGuard","locales","defaultConfig","JSON","parse","menuIcon","icon","standaloneMode","stringify","meta","customTemplates","functions","menus","contracts","i18n","workflows","mocks","userGroups","extractedTemplates","extractTemplates","push","fileStructure","buildFileStructure","srcIndexJs","resources","fnDir","fnNames","fnImports","fn","Error","inferredImports","Set","code","transform","filename","TransformStoryboardFunction","SmartImports","imports","hasFN","has","delete","importStrings","size","join","menusDir","menuNames","menuImports","menuId","replace","JS_RESERVED_WORDS","contractsDir","contractImports","contractNames","contract","baseName","counter","varName","add","srcResourcesIndexJs","editorConfig","gitIgnore","devConfigMjs","declarationsDTs","jsconfigJson","nextJsxConfigJs","replaceAll","packageJson","readmeMd","blob","generateAsync","saveAs","files","fs","content","segments","split","pop","handle","i","segment","current","slice","found","get","set","helperFunctions","fixFunctionSource","withBox","children","options","brick","properties","style","expanded","background","backdropFilter","borderRadius","padding","styleTagTransform","setAttributes","insert","domAPI","insertStyleElement","locals","AsyncWrappedCodeEditor","React","default","asyncWrapBrick","onCodeChange","BUILTIN_LIBS","filePath","componentsDefinition","types","nextTsxDefinition","defineElement","property","event","createDecorators","_TsxPlayground","_A","WeakMap","_B","_C","_TsxPlayground_brand","WeakSet","_handleChange","TsxPlayground","ReactNextElement","constructor","_classPrivateMethodInitSpec","_classPrivateFieldInitSpec","_init_source","_init_extra_source","_init_extraLibs","_init_extra_extraLibs","_init_change","_init_extra_change","_classPrivateGetter2","_classPrivateGetter","this","_get_change","emit","_classPrivateFieldGet","v","_classPrivateFieldSet","extraLibs","render","TsxPlaygroundComponent","onChange","convertSeverity","severity","setCode","useState","deferredCode","useDeferredValue","markers","setMarkers","view","setView","allLibs","useMemo","handleCodeChange","useCallback","e","detail","useEffect","ignore","worker","getRemoteTsxParserWorker","result","parseView","withNodeErrors","errors","filter","err","map","error","message","startLineNumber","loc","start","line","startColumn","column","endLineNumber","end","endColumn","rootId","uniqueId","ref","useRef","rootRef","container","portal","document","createElement","dataset","position","width","height","body","append","createPortal","root","unstable_createRoot","supportsUseChildren","unmount","remove","convertedView","_rootRef$current","entry","state","usedHelpers","convertedEntry","convertModule","defaultExport","internals","namedExports","templates","part","values","function","getViewTplName","bricks","context","helpers","from","title","every","includes","withContexts","convertView","_rootRef$current2","console","errorTitle","errorBoundary","color","textContent","httpErrorToString","className","styles","editor","Suspense","fallback","language","uri","automaticLayout","extraMarkers","preview","_TsxPlayground2","_set_change","c","_initClass","_applyDecs","shadowOptions","attribute","o","_","_checkInRHS","_AppPreview","AppPreview","_init_storyboard","_init_extra_storyboard","AppPreviewComponent","iframeRef","appPreviewer","setAppPreviewer","handleIframeLoad","check","_iframeRef$current","previewer","contentWindow","_preview_only_appPreviewer","setTimeout","setupRef","then","update","reload","setup","brickPackages","__secret_internals","getBrickPackages","storyboards","getBasePath","loading","onLoad","_AppPreview2","styleTexts","styleText","WrappedAppPreview","wrapBrick","_AppPlayground","_AppPlayground_brand","AppPlayground","AppPlaygroundComponent","parseApp","setStoryboard","convertedApp","_routesComponent$chil","_routesComponent$chil2","routesComponent","isOfficialComponent","MODULE_SOURCE","convertedModules","Promise","all","modules","mod","converted","getAppTplName","child","component","startsWith","reference","page","find","p","importSource","convertApp","_AppPlayground2","___CSS_LOADER_EXPORT___","module","toString"],"sourceRoot":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"chunks/2857.bfd7ab6b.js","mappings":"mLAaA,IAAIA,EAEAC,EAEG,SAASC,IAOd,OANKF,IACHA,EAAsB,WACpB,MAAMG,GAASC,EAAAA,EAAAA,KAQdH,IACHA,EAAS,IAAII,OAAO,IAAIC,IAAI,qBAEvBL,IAVH,aAAa,IAAIE,CAClB,EAHqB,IAKjBH,CACT,C,2kMCsDA,MAAMO,EAAwB,UACxBC,EAAwB,QAEvB,SAASC,EAAmBC,GACjC,GAAqB,iBAAVA,EACT,OAAO,EAET,MAAMC,EAAUD,EAAME,OACtB,OACEL,EAAsBM,KAAKF,IAAYH,EAAsBK,KAAKF,EAEtE,CAEO,SAASG,EAAuBC,GACrC,OACGA,EAAMC,WACmB,aAAzBD,EAAMC,UAAUC,MACfF,EAAMC,UAAUE,eAAiBC,EAAAA,CAEvC,CAEO,SAASC,EAAoBL,EAAuBM,GACzD,OACEP,EAAuBC,KACtBA,EAAMC,UAAYD,EAAMC,UAAUK,OAASA,EAAON,EAAMM,OAASA,EAEtE,C,kCCzGO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AW1J,SACpB,aAAjByJ,EAAQE,KACVH,EAAQpN,KAAKhG,EAAkBqT,EAAQpT,WAEtB,UAAjBoT,EAAQE,MACS,aAAjBF,EAAQE,MACS,UAAjBF,EAAQE,MAERH,EAAQpN,KAAK,CACX9G,KAAMmU,EAAQpN,GAAG/G,KACjBX,MAAO8U,EAAQG,aACf1R,OAAyB,UAAjBuR,EAAQE,KAChB3R,OAAO,IAKb,IAAIqH,EACJ,GAAkB,SAAd8I,EAAKjT,KAAiB,KAAA6I,EACxB,MAAM8L,EAAyB,QAArB9L,EAAGH,EAAUyB,gBAAQ,IAAAtB,OAAA,EAAlBA,EAAoB+D,MAAM9M,IACrCK,EAAAA,EAAAA,IAAoBL,EAAO,UAEzB6U,IACFxK,EAAWwK,EAAKxK,SAEpB,MACEA,EAAWzB,EAAUyB,SAGvB,MAAMyK,EAAiB,QAARR,EAAAjK,SAAQ,IAAAiK,GAARA,EAAUvP,cAEbiF,QAAQC,IACZI,EAAS5G,KAAKzD,GACZ2I,EAAiB3I,EAAO6I,EAAKC,EAAOzF,EAAS8P,EAAKjT,UAGtD+T,OACF,GAEJ,MAAO,CACL/T,KAAMiT,EAAKjT,KACX4U,SACAN,UACAlU,KAAkB,QAAdiU,EAAE3L,EAAUvB,UAAE,IAAAkN,OAAA,EAAZA,EAAcjU,KACpB4K,MAAOiI,EAAKjI,MAEhB,C","sources":["webpack:///./src/tsx-playground/workers/tsxParser.ts","webpack:///../../../src/modules/validations.ts","webpack:///../../../src/modules/constants.ts","webpack:///../../../src/modules/getTplName.ts","webpack:///../../../src/modules/convertDataSource.ts","webpack:///../../src/convertEvents.ts","webpack:///../../src/expressions.ts","webpack:///../../src/deepReplaceVariables.ts","webpack:///../../src/convertTable.ts","webpack:///../../src/convertDashboard.ts","webpack:///../../src/convertComponent.ts","webpack:///../../src/convertList.ts","webpack:///../../src/convertDescriptions.ts","webpack:///../../src/convertCard.ts","webpack:///../../src/convertButton.ts","webpack:///../../src/convertForm.ts","webpack:///../../src/convertToolbar.ts","webpack:///../../src/convertModal.ts","webpack:///../../src/convertText.ts","webpack:///../../src/convertLink.ts","webpack:///../../src/convertOutput.ts","webpack:///../../src/convertTag.ts","webpack:///../../src/convertAvatar.ts","webpack:///../../src/convertAvatarGroup.ts","webpack:///../../src/convertCodeBlock.ts","webpack:///../../src/convertFormItem.ts","webpack:///../../src/convertForEach.ts","webpack:///../../src/convertIf.ts","webpack:///../../../src/modules/convertModule.ts"],"sourcesContent":["// istanbul ignore file\nimport type {\n ParsedApp,\n ParseOptions,\n SourceFile,\n} from \"@next-shared/tsx-parser\";\nimport { wrap } from \"comlink\";\n\nexport interface RemoteTsxParserWorker {\n parseView(source: string, options?: ParseOptions): Promise<ParsedApp>;\n parseApp(files: SourceFile[]): Promise<ParsedApp>;\n}\n\nlet remoteWorkerPromise: Promise<RemoteTsxParserWorker> | undefined;\n\nlet worker: Worker | undefined;\n\nexport function getRemoteTsxParserWorker() {\n if (!remoteWorkerPromise) {\n remoteWorkerPromise = (async () => {\n const Remote = wrap<{ new (): RemoteTsxParserWorker }>(getWorker());\n return await new Remote();\n })();\n }\n return remoteWorkerPromise;\n}\n\nfunction getWorker() {\n if (!worker) {\n worker = new Worker(new URL(\"./tsxParser.worker.ts\", import.meta.url));\n }\n return worker;\n}\n","import type { NodePath } from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\nimport type { ComponentChild, ParsedModule } from \"./interfaces.js\";\nimport { MODULE_SOURCE } from \"./constants.js\";\n\nexport function validateFunction(\n fn: t.FunctionDeclaration | t.FunctionExpression | t.ArrowFunctionExpression,\n state: ParsedModule\n): boolean {\n if (fn.async || fn.generator) {\n state.errors.push({\n message: `Function cannot be async or generator`,\n node: fn,\n severity: \"error\",\n });\n return false;\n }\n\n return true;\n}\n\nexport function validateGlobalApi(\n id: NodePath<t.Identifier | t.JSXIdentifier>,\n api: string\n): boolean {\n const ref = id.referencesImport(MODULE_SOURCE, api);\n if (ref) {\n return true;\n }\n return id.node.name === api && !id.scope.getBinding(id.node.name);\n}\n\nexport function validateEmbeddedExpression(\n expr: t.Expression,\n state: ParsedModule | null\n): boolean {\n let invalidNode: t.Node | null = null;\n\n t.traverse(expr, {\n enter(node, parent) {\n if (\n !invalidNode &&\n (t.isFunctionExpression(node) ||\n t.isStatement(node) ||\n t.isAwaitExpression(node) ||\n t.isYieldExpression(node) ||\n t.isJSX(node) ||\n (t.isArrowFunctionExpression(node) &&\n (node.async ||\n node.generator ||\n t.isBlockStatement(node.body) ||\n t.isObjectProperty(parent[parent.length - 1]?.node))))\n ) {\n invalidNode = node;\n }\n },\n });\n\n if (invalidNode) {\n state?.errors.push({\n message: `Unsupported expression type: ${(invalidNode as t.Node).type}`,\n node: invalidNode,\n severity: \"error\",\n });\n return false;\n }\n\n return true;\n}\n\nexport function isNilPath(path: NodePath<t.Node>) {\n return (\n path.isNullLiteral() ||\n (path.isIdentifier() &&\n path.node.name === \"undefined\" &&\n path.scope.getBinding(\"undefined\") === undefined)\n );\n}\n\nconst EXPRESSION_PREFIX_REG = /^<%=?\\s/;\nconst EXPRESSION_SUFFIX_REG = /\\s%>$/;\n\nexport function isExpressionString(value: unknown): value is string {\n if (typeof value !== \"string\") {\n return false;\n }\n const trimmed = value.trim();\n return (\n EXPRESSION_PREFIX_REG.test(trimmed) && EXPRESSION_SUFFIX_REG.test(trimmed)\n );\n}\n\nexport function isAnyOfficialComponent(child: ComponentChild) {\n return (\n !child.reference ||\n (child.reference.type === \"imported\" &&\n child.reference.importSource === MODULE_SOURCE)\n );\n}\n\nexport function isOfficialComponent(child: ComponentChild, name: string) {\n return (\n isAnyOfficialComponent(child) &&\n (child.reference ? child.reference.name === name : child.name === name)\n );\n}\n","export const MODULE_SOURCE = \"next-tsx\";\n\nexport const CALL_API_LIST = [\"callApi\", \"callHttp\", \"callTool\"] as const;\n","let counter = 0;\nconst tplNameMap = new Map<string, string>();\n\nexport function getViewTplName(name: string, rootId: string) {\n return `${getViewTplNamePrefixByRootId(rootId)}${getViewTplNameSuffix(name)}`;\n}\n\nexport function getAppTplName(name: string) {\n return `tpl-${getViewTplNameSuffix(name)}`;\n}\n\nfunction getViewTplNamePrefixByRootId(rootId: string) {\n if (!tplNameMap.has(rootId)) {\n tplNameMap.set(rootId, `isolated-tpl-${counter++}`);\n }\n return tplNameMap.get(rootId)!;\n}\n\nfunction getViewTplNameSuffix(name: string) {\n return name.replace(/([A-Z])/g, \"-$1\").toLowerCase();\n}\n","import type { ContextConf } from \"@next-core/types\";\nimport { isObject } from \"@next-core/utils/general\";\nimport type { DataSource } from \"@next-shared/tsx-parser\";\n\nexport function convertDataSource(resource: DataSource): ContextConf {\n const {\n name,\n http,\n api,\n params,\n tool,\n transform,\n rejectTransform,\n config,\n scope,\n } = resource;\n const hasEnabled =\n config && Object.prototype.hasOwnProperty.call(config, \"enabled\");\n\n return {\n name: name,\n resolve: {\n ...(http\n ? {\n useProvider: \"basic.http-request\",\n args: [api, params],\n }\n : tool\n ? {\n useProvider: \"ai-portal.call-tool\",\n args: [tool, params],\n }\n : {\n useProvider: `${api}:*`,\n params: params as Record<string, unknown> | undefined,\n // TODO: remove the temporary workaround below\n ...(api === \"easyops.api.data_exchange.olap@Query\" &&\n isObject(params)\n ? {\n params: {\n ...params,\n translate: [\"#showKey\"],\n limit: undefined,\n limitBy: undefined,\n order: undefined,\n displayName: true,\n },\n }\n : null),\n }),\n ...(transform ? { transform: { value: transform } } : null),\n ...(rejectTransform\n ? { onReject: { transform: { value: rejectTransform } } }\n : null),\n ...(hasEnabled\n ? {\n if: config.enabled as string | boolean,\n }\n : null),\n },\n track: true,\n ...(hasEnabled\n ? {\n value: config.fallback,\n }\n : null),\n ...(scope === \"template\" ? { expose: false } : null),\n };\n}\n","import type { BrickEventHandler, BrickEventsMap } from \"@next-core/types\";\nimport type { Component, EventHandler } from \"@next-shared/tsx-parser\";\nimport type { ConvertOptions } from \"./interfaces.js\";\n\nexport function convertEvents(component: Component, options: ConvertOptions) {\n const events: BrickEventsMap = {};\n for (const [event, handler] of Object.entries(component.events ?? {})) {\n switch (component.name) {\n case \"Table\":\n switch (event) {\n case \"select\": {\n const action = convertEventHandlers(handler, options);\n if (action) {\n events[\"row.select.v2\"] = action;\n }\n break;\n }\n case \"sort\": {\n const action = convertEventHandlers(handler, options);\n if (action) {\n events[\"sort.change\"] = action;\n }\n break;\n }\n case \"paginate\": {\n const action = convertEventHandlers(handler, options);\n if (action) {\n events[\"page.change\"] = action;\n }\n break;\n }\n }\n break;\n case \"Button\":\n if (event === \"click\") {\n const action = convertEventHandlers(handler, options);\n if (action) {\n events.click = action;\n }\n }\n break;\n case \"Search\":\n if (event === \"search\") {\n const action = convertEventHandlers(handler, options);\n if (action) {\n events.search = action;\n }\n }\n break;\n case \"Select\":\n if (event === \"change\") {\n const action = convertEventHandlers(handler, options);\n if (action) {\n events[\"change.v2\"] = action;\n }\n }\n break;\n default: {\n const action = convertEventHandlers(handler, options);\n if (action) {\n events[event] = action;\n }\n }\n }\n }\n return Object.keys(events).length > 0 ? events : undefined;\n}\n\nfunction convertEventHandlers(\n handler: EventHandler | EventHandler[] | null,\n options: ConvertOptions\n): BrickEventHandler[] | undefined {\n if (!handler) {\n return;\n }\n const list = (Array.isArray(handler) ? handler : [handler])\n .map((hdl) => convertEventHandler(hdl, options))\n .filter(Boolean) as BrickEventHandler[];\n return list.length > 0 ? list : undefined;\n}\n\nfunction convertEventHandler(\n handler: EventHandler,\n options: ConvertOptions\n): BrickEventHandler | undefined {\n switch (handler?.action) {\n case \"update_variable\":\n return {\n action:\n handler.payload.scope === \"template\"\n ? \"state.update\"\n : \"context.replace\",\n args: [handler.payload.name, handler.payload.value],\n };\n case \"refresh_data_source\":\n return {\n action:\n handler.payload.scope === \"template\"\n ? \"state.refresh\"\n : \"context.refresh\",\n args: [handler.payload.name],\n };\n case \"call_api\": {\n const { api, http, tool, params } = handler.payload;\n\n const success = handler.callback?.success\n ? convertEventHandlers(\n handler.callback.success as EventHandler | EventHandler[],\n options\n )\n : undefined;\n\n return {\n ...(http\n ? {\n useProvider: \"basic.http-request\",\n args: [api, params],\n }\n : tool\n ? {\n useProvider: \"ai-portal.call-tool\",\n args: [tool, params],\n }\n : {\n useProvider: `${api}:*`,\n params,\n }),\n callback: {\n ...(success && { success }),\n error: {\n action: \"handleHttpError\",\n },\n },\n };\n }\n case \"call_ref\":\n return {\n ...(handler.payload.scope === \"template\"\n ? {\n targetRef: handler.payload.ref,\n }\n : {\n target: `[data-root-id=\"${options.rootId}\"] [data-ref=\"${handler.payload.ref}\"]`,\n }),\n method: handler.payload.method,\n args: handler.payload.args,\n };\n case \"update_query\":\n return {\n action:\n handler.payload.method === \"replace\"\n ? \"history.replaceQuery\"\n : \"history.pushQuery\",\n args: handler.payload.args,\n };\n case \"show_message\":\n return {\n action: `message.${handler.payload.type}` as \"message.info\",\n args: [handler.payload.content],\n };\n case \"dispatch_event\":\n return {\n action: \"tpl.dispatchEvent\",\n args: [handler.payload.type, { detail: handler.payload.detail }],\n };\n case \"conditional\":\n return {\n if: handler.payload.test,\n then: convertEventHandlers(handler.payload.consequent, options) ?? [],\n else: convertEventHandlers(handler.payload.alternate, options),\n };\n }\n}\n","import { strictCollectMemberUsage } from \"@next-core/utils/storyboard\";\n\nconst EXPRESSION_PREFIX_REG = /^<%=?\\s/;\nconst EXPRESSION_SUFFIX_REG = /\\s%>$/;\n\n/**\n * @param value The trimmed string content\n * @returns if the value is a valid expression\n */\nfunction isExpression(value: string) {\n return EXPRESSION_PREFIX_REG.test(value) && EXPRESSION_SUFFIX_REG.test(value);\n}\n\nexport function parseDataSource(data: string | object):\n | {\n isString: false;\n embedded?: undefined;\n expression?: undefined;\n usedContexts?: undefined;\n }\n | {\n isString: true;\n embedded: string;\n expression: string;\n usedContexts: Set<string>;\n } {\n if (typeof data !== \"string\") {\n return {\n isString: false,\n };\n }\n\n let expression: string;\n const expr = data.trim();\n if (isExpression(expr)) {\n expression = expr\n .replace(EXPRESSION_PREFIX_REG, \"\")\n .replace(EXPRESSION_SUFFIX_REG, \"\")\n .trim();\n } else {\n // eslint-disable-next-line no-console\n console.warn(\"Invalid expression:\", JSON.stringify(data));\n expression = \"null\";\n }\n\n const usedContexts = strictCollectMemberUsage(data, \"CTX\");\n\n return {\n isString: true,\n embedded: data,\n expression,\n usedContexts,\n };\n}\n","import type * as t from \"@babel/types\";\nimport { preevaluate, type PreevaluateResult } from \"@next-core/cook\";\nimport { isExpressionString } from \"@next-shared/tsx-parser\";\n\nexport function deepReplaceVariables<T>(\n value: T,\n patterns: Map<string, string> | undefined\n): T {\n if (!patterns?.size) {\n return value;\n }\n\n if (Array.isArray(value)) {\n return value.map((item) =>\n deepReplaceVariables(item, patterns)\n ) as unknown as T;\n }\n\n if (typeof value === \"object\" && value !== null) {\n return Object.fromEntries(\n Object.entries(value).map(([k, v]) => [\n k,\n deepReplaceVariables(v, patterns),\n ])\n ) as T;\n }\n\n if (typeof value === \"string\" && isExpressionString(value)) {\n return replaceVariables(value, patterns) as unknown as T;\n }\n\n return value;\n}\n\ninterface Replacement {\n id: t.Identifier;\n shorthand?: boolean;\n}\n\nexport function replaceVariables(\n expr: string,\n patterns: Map<string, string> | undefined\n): string {\n if (!patterns?.size) {\n return expr;\n }\n const keywords = [...patterns.keys()];\n if (keywords.some((k) => expr.includes(k))) {\n const replacements: Replacement[] = [];\n let result: PreevaluateResult | undefined;\n try {\n result = preevaluate(expr, {\n withParent: true,\n hooks: {\n beforeVisitGlobal(node, path) {\n if (patterns.has(node.name)) {\n const p = path![path!.length - 1]?.node;\n let shorthand: boolean | undefined;\n if (p && p.type === \"Property\" && !p.computed && p.shorthand) {\n shorthand = true;\n }\n replacements.push({ id: node, shorthand });\n }\n },\n },\n });\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Parse expression failed:\", error);\n }\n if (replacements.length > 0 && result) {\n const { prefix, source, suffix } = result;\n const chunks: string[] = [];\n let prevStart = 0;\n for (let i = 0; i < replacements.length; i++) {\n const { id, shorthand } = replacements[i];\n const { name, start, end } = id;\n chunks.push(\n source.substring(prevStart, start!),\n `${shorthand ? `${name}: ` : \"\"}${patterns.get(name)}`\n );\n prevStart = end!;\n }\n chunks.push(source.substring(prevStart));\n return `${prefix}${chunks.join(\"\")}${suffix}`;\n }\n }\n return expr;\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type {\n ComponentChild,\n ParsedModule,\n RenderUseBrick,\n} from \"@next-shared/tsx-parser\";\nimport type { TableColumn, TableProps } from \"../lib/components.js\";\nimport type { ConvertState, ConvertOptions } from \"./interfaces.js\";\n// import { lowLevelConvertToStoryboard } from \"./raw-data-generate/convert.js\";\nimport { parseDataSource } from \"./expressions.js\";\n// import { getPreGeneratedAttrViews } from \"./getPreGeneratedAttrViews.js\";\n// import { findObjectIdByUsedDataContexts } from \"./findObjectIdByUsedDataContexts.js\";\nimport { convertComponent } from \"./convertComponent.js\";\nimport { deepReplaceVariables } from \"./deepReplaceVariables.js\";\n\nconst columnUseBrickParams = [\"cellData\", \"rowData\"];\n\nexport default async function convertTable(\n component: ComponentChild,\n mod: ParsedModule,\n state: ConvertState,\n options: ConvertOptions,\n scope: \"page\" | \"view\" | \"template\"\n): Promise<BrickConf> {\n const { properties } = component;\n const { dataSource, size, columns, rowKey, pagination, ...restProps } =\n properties as Omit<TableProps<object>, \"dataSource\" | \"columns\"> & {\n dataSource: string | object;\n size?: \"small\" | \"medium\" | \"large\";\n pagination?: boolean;\n columns:\n | string\n | Array<\n Omit<TableColumn<object>, \"render\"> & {\n render?: RenderUseBrick;\n }\n >;\n };\n\n const parsedDataSource = parseDataSource(dataSource);\n\n // const objectId = findObjectIdByUsedDataContexts(\n // parsedDataSource.usedContexts,\n // view.dataSources,\n // view.variables\n // );\n\n // const attrViews = objectId\n // ? await getPreGeneratedAttrViews(objectId)\n // : undefined;\n\n const configuredColumns = new Map<string, BrickConf>();\n\n // if (attrViews?.size && Array.isArray(columns)) {\n // for (const column of columns) {\n // if (column.render || typeof column.dataIndex !== \"string\") {\n // continue;\n // }\n // const candidate = attrViews.get(column.dataIndex);\n // if (candidate) {\n // const brick = lowLevelConvertToStoryboard(candidate, \".cellData\");\n // if (brick) {\n // brick.slot = `[${column.dataIndex}]`;\n // configuredColumns.set(column.dataIndex, brick);\n // }\n // }\n // }\n // }\n\n const convertedColumns = Array.isArray(columns)\n ? await Promise.all(\n columns.map(async ({ render, ...column }) => {\n if (render) {\n const patterns = new Map<string, string>();\n for (\n let i = 0;\n i < render.params.length && i < columnUseBrickParams.length;\n i++\n ) {\n patterns.set(render.params[i], `DATA.${columnUseBrickParams[i]}`);\n }\n\n const useBrick = (\n await Promise.all(\n render.children.map((child) =>\n convertComponent(child, mod, state, options, scope)\n )\n )\n ).flatMap((child) => deepReplaceVariables(child, patterns));\n\n return {\n ...column,\n useBrick: useBrick.map((item) =>\n item.brick.startsWith(\":\")\n ? {\n brick: \"div\",\n children: [item],\n }\n : item\n ),\n };\n }\n return typeof column.dataIndex === \"string\" &&\n configuredColumns.has(column.dataIndex)\n ? {\n ...column,\n useChildren: `[${column.dataIndex}]`,\n }\n : column;\n })\n )\n : columns;\n\n return {\n brick: \"eo-next-table\",\n properties: {\n dataSource: parsedDataSource.isString\n ? parsedDataSource.embedded\n : dataSource,\n ...restProps,\n rowKey: rowKey ?? (Array.isArray(columns) ? columns[0]?.key : undefined),\n columns: convertedColumns,\n themeVariant: \"elevo\",\n scrollConfig: {\n x: \"max-content\",\n },\n ...(options.expanded\n ? {\n bordered: true,\n pagination,\n size: \"large\",\n }\n : {\n size: \"middle\",\n pagination: false,\n }),\n },\n children:\n configuredColumns.size > 0 ? Array.from(configuredColumns.values()) : [],\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component, ParsedModule } from \"@next-shared/tsx-parser\";\nimport type { DashboardProps, DashboardWidget } from \"../lib/components.js\";\nimport { parseDataSource } from \"./expressions.js\";\n// import { findObjectIdByUsedDataContexts } from \"./findObjectIdByUsedDataContexts.js\";\nimport {\n /* getPreGeneratedMetricGroups, */ type MetricWithGroup,\n} from \"./getPreGeneratedMetricGroups.js\";\nimport type { ConvertState, ConvertOptions } from \"./interfaces.js\";\n\nconst COLORS = [\n \"#336EF4\",\n \"#45CAFF\",\n \"#41CDCF\",\n \"#8146F3\",\n \"#F8A075\",\n \"#94E65E\",\n \"#57689C\",\n \"#C285EF\",\n \"#FAC60B\",\n \"#E4551F\",\n \"#8984FF\",\n \"#2540FF\",\n \"#08BF33\",\n \"#F7811C\",\n \"#AC7CFF\",\n \"#1BA5DC\",\n \"#E89716\",\n \"#76A6F5\",\n \"#4F69FF\",\n];\n\ninterface MergedWidget extends DashboardWidget {\n relevantMetrics?: string[];\n counterMetric?: string;\n groupTitle?: string;\n size?: \"small\" | \"medium\" | \"large\";\n}\n\nexport default async function convertDashboard(\n { properties }: Component,\n mod: ParsedModule,\n state: ConvertState,\n options: ConvertOptions\n): Promise<BrickConf> {\n const {\n dataSource,\n groupField: _groupField,\n widgets,\n } = properties as Omit<DashboardProps, \"dataSource\"> & {\n dataSource: string | object;\n };\n\n state.usedHelpers.add(\"_helper_getLatestMetricValue\");\n state.usedHelpers.add(\"_helper_extractList\");\n state.usedHelpers.add(\"_helper_groupMetricData\");\n state.usedHelpers.add(\"_helper_getMetricDisplayNames\");\n\n const groupField = _groupField ? \"#showKey\" : undefined;\n\n const { isString, expression /* , usedContexts */ } =\n parseDataSource(dataSource);\n\n const chartData = isString\n ? `<%= FN._helper_extractList((${expression})) %>`\n : dataSource;\n\n if (options.expanded) {\n let mergedWidgets = widgets as MergedWidget[];\n // const objectId = findObjectIdByUsedDataContexts(\n // usedContexts,\n // view.dataSources,\n // view.variables\n // );\n // const metricGroups = objectId\n // ? await getPreGeneratedMetricGroups(objectId)\n // : [];\n const metricGroups: MetricWithGroup[] = [];\n\n if (metricGroups.length > 0) {\n mergedWidgets = [];\n const mergedMetrics = new Set<string>();\n const metricIds = new Set(widgets.map((w) => w.metric.id));\n for (const widget of widgets) {\n if (mergedMetrics.has(widget.metric.id)) {\n continue; // Skip already merged metrics\n }\n const mergedWidget = { ...widget } as MergedWidget;\n mergedWidgets.push(mergedWidget);\n const group = metricGroups.find((g) =>\n g.metrics.includes(widget.metric.id)\n );\n if (group) {\n const relevantMetrics = group.metrics.filter((m) => metricIds.has(m));\n if (relevantMetrics.length > 1) {\n mergedWidget.relevantMetrics = relevantMetrics;\n mergedWidget.counterMetric = group.counter;\n mergedWidget.groupTitle = group.group;\n for (const metricId of relevantMetrics) {\n mergedMetrics.add(metricId);\n metricIds.delete(metricId);\n }\n }\n }\n }\n }\n\n let colorCursor = 0;\n\n return {\n brick: \"div\",\n properties: {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fit, minmax(500px, 1fr))\",\n gap: \"16px\",\n },\n dataset: {\n component: \"dashboard\",\n },\n },\n children: mergedWidgets.map((widget) => {\n const { title, /* type, */ metric, size, precision } = widget;\n const colorCount =\n widget.relevantMetrics?.length ?? (groupField ? 2 : 1);\n const colors = Array.from(\n { length: colorCount },\n (_, i) => COLORS[(colorCursor + i) % COLORS.length]\n );\n colorCursor += colorCount;\n const unit = metric.unit === \"load\" ? \"\" : metric.unit;\n const chart = {\n brick: \"chart-v2.time-series-chart\",\n properties: {\n data: chartData,\n xField: \"time\",\n ...(widget.relevantMetrics\n ? {\n // yFields: widget.relevantMetrics,\n yFields: `<% FN._helper_getMetricDisplayNames((${expression}).displayNameList, ${JSON.stringify(\n widget.relevantMetrics\n )}) %>`,\n }\n : {\n // yField: metric.id,\n yField: `<% FN._helper_getMetricDisplayNames((${expression}).displayNameList, [${JSON.stringify(\n metric.id\n )}])[0] %>`,\n }),\n ...(widget.counterMetric\n ? {\n forceAbsoluteNumbers: true,\n series: {\n [widget.counterMetric]: {\n isNegative: true,\n },\n },\n }\n : null),\n height: size === \"large\" ? 230 : 200,\n timeFormat: \"HH:mm\",\n ...(widget.relevantMetrics || groupField\n ? null\n : {\n areaOptions: {\n style: {\n fill: `l(90) 0:${colors[0]} 1:#ffffff`,\n },\n },\n }),\n axis: {\n yAxis: {\n unit,\n precision,\n ...(widget.counterMetric\n ? null\n : unit === \"percent(1)\"\n ? { min: 0, max: 1 }\n : unit === \"percent(100)\" || unit === \"%\"\n ? { min: 0, max: 100 }\n : { min: 0 }),\n shape: \"smooth\",\n },\n },\n groupField,\n areaShape: \"smooth\",\n legends: !!(widget.relevantMetrics || groupField),\n colors: colors,\n tooltip: {\n marker: {\n fill: colors[0],\n stroke: \"#fff\",\n lineWidth: 2,\n shadowColor: colors[0],\n shadowBlur: 8,\n shadowOffsetX: 0,\n shadowOffsetY: 4,\n },\n domStyles: {\n \"g2-tooltip\": {\n background: [\n `radial-gradient( farthest-corner at -20px 150px, ${colors[0]} 0%, rgba(238,238,238,0) 60%)`,\n \"linear-gradient( 180deg, rgba(255,255,255,0.5) 0%, rgba(255,255,255,0.8) 100%)\",\n ].join(\", \"),\n boxShadow: `0px 4px 8px 0px ${convertHexColorToRGBA(colors[0], 0.08)}`,\n borderRadius: \"8px\",\n border: \"1px solid rgba(255,255,255,1)\",\n backdropFilter: \"blur(3px)\",\n },\n },\n },\n },\n };\n return {\n brick: \"div\",\n properties: {\n style: {\n background: \"rgba(255,255,255,0.8)\",\n boxShadow: \"0px 2px 4px 0px rgba(0,0,0,0.06)\",\n borderRadius: \"8px\",\n padding: \"16px 20px 20px\",\n },\n },\n children: [\n {\n brick: \"div\",\n properties: {\n style: {\n fontSize: \"16px\",\n fontWeight: \"500\",\n marginBottom: \"20px\",\n },\n textContent: widget.groupTitle || title || metric.id,\n },\n },\n chart,\n ],\n };\n }),\n };\n }\n\n if (groupField) {\n return {\n brick: \"div\",\n properties: {\n style: {\n display: \"flex\",\n flexDirection: \"column\",\n gap: \"8px\",\n },\n },\n children: [\n {\n brick: \":forEach\",\n dataSource: `<%= FN._helper_groupMetricData(FN._helper_extractList((${expression})), ${JSON.stringify(groupField)}) %>`,\n children: [\n {\n brick: \"div\",\n properties: {\n textContent: \"<% `${ITEM.group}:` %>\",\n style: {\n fontWeight: \"500\",\n },\n },\n },\n {\n brick: \"div\",\n properties: {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fill, minmax(200px, 1fr))\",\n gap: \"10px\",\n marginBottom: \"8px\",\n },\n dataset: {\n component: \"dashboard\",\n },\n },\n children: widgets.map((widget, i) => {\n const { title, /* type, */ metric, precision } = widget;\n return {\n brick: \"ai-portal.stat-with-mini-chart\",\n properties: {\n size: \"small\",\n label: title || metric.id,\n data: \"<% ITEM.list %>\",\n xField: \"time\",\n yField: metric.id,\n lineColor: COLORS[i % COLORS.length],\n showArea: true,\n ...(metric.unit === \"percent(1)\"\n ? { min: 0, max: 1 }\n : metric.unit === \"percent(100)\" || metric.unit === \"%\"\n ? { min: 0, max: 100 }\n : { min: 0 }),\n value: `<%= FN._helper_getLatestMetricValue(ITEM.list, ${JSON.stringify(\n {\n metric,\n precision,\n }\n )}) %>`,\n },\n };\n }),\n },\n ],\n },\n ],\n };\n }\n\n return {\n brick: \"div\",\n properties: {\n style: {\n display: \"grid\",\n gridTemplateColumns: \"repeat(auto-fill, minmax(200px, 1fr))\",\n gap: \"10px\",\n },\n dataset: {\n component: \"dashboard\",\n },\n },\n children: widgets.map((widget, i) => {\n const { title, /* type, */ metric, precision } = widget;\n return {\n brick: \"ai-portal.stat-with-mini-chart\",\n properties: {\n size: \"small\",\n label: title || metric.id,\n data: chartData,\n xField: \"time\",\n yField: metric.id,\n lineColor: COLORS[i % COLORS.length],\n showArea: true,\n ...(metric.unit === \"percent(1)\"\n ? { min: 0, max: 1 }\n : metric.unit === \"percent(100)\" || metric.unit === \"%\"\n ? { min: 0, max: 100 }\n : { min: 0 }),\n value: `<%= FN._helper_getLatestMetricValue((${\n isString\n ? `FN._helper_extractList((${expression}))`\n : JSON.stringify(dataSource ?? null)\n }), ${JSON.stringify({\n metric,\n precision,\n })}) %>`,\n },\n };\n }),\n };\n}\n\nfunction convertHexColorToRGBA(color: string, alpha: number): string {\n const hex = color.slice(1);\n const bigint = parseInt(hex, 16);\n const r = (bigint >> 16) & 255;\n const g = (bigint >> 8) & 255;\n const b = bigint & 255;\n return `rgba(${r}, ${g}, ${b}, ${alpha})`;\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport {\n isAnyOfficialComponent,\n type ComponentChild,\n type ModulePart,\n type ParsedModule,\n} from \"@next-shared/tsx-parser\";\nimport type { ConvertState, ConvertOptions } from \"./interfaces.js\";\nimport { convertEvents } from \"./convertEvents.js\";\nimport convertList from \"./convertList.js\";\nimport convertTable from \"./convertTable.js\";\nimport convertDescriptions from \"./convertDescriptions.js\";\nimport convertDashboard from \"./convertDashboard.js\";\nimport convertButton from \"./convertButton.js\";\nimport convertForm from \"./convertForm.js\";\nimport convertFormItem from \"./convertFormItem.js\";\nimport convertModal from \"./convertModal.js\";\nimport convertToolbar from \"./convertToolbar.js\";\nimport convertText from \"./convertText.js\";\nimport convertCard from \"./convertCard.js\";\nimport convertForEach from \"./convertForEach.js\";\nimport convertIf from \"./convertIf.js\";\nimport convertOutput from \"./convertOutput.js\";\nimport convertLink from \"./convertLink.js\";\nimport convertTag from \"./convertTag.js\";\nimport convertAvatar from \"./convertAvatar.js\";\nimport convertAvatarGroup from \"./convertAvatarGroup.js\";\nimport convertCodeBlock from \"./convertCodeBlock.js\";\nimport { getAppTplName, getViewTplName } from \"./modules/getTplName.js\";\n\nexport async function convertComponent(\n component: ComponentChild,\n mod: ParsedModule,\n state: ConvertState,\n options: ConvertOptions,\n scope: \"page\" | \"view\" | \"template\"\n): Promise<BrickConf | BrickConf[]> {\n let brick: BrickConf | null = null;\n\n if (isAnyOfficialComponent(component)) {\n const componentName = component.reference\n ? component.reference.name\n : component.name;\n switch (componentName) {\n case \"List\":\n brick = await convertList(component);\n break;\n case \"Table\":\n brick = await convertTable(component, mod, state, options, scope);\n break;\n case \"Descriptions\":\n brick = await convertDescriptions(\n component,\n mod,\n state,\n options,\n scope\n );\n break;\n case \"Card\":\n brick = await convertCard(component);\n break;\n case \"Dashboard\":\n brick = await convertDashboard(component, mod, state, options);\n break;\n case \"Button\":\n brick = await convertButton(component);\n break;\n case \"Form\":\n brick = await convertForm(component);\n break;\n case \"Toolbar\":\n brick = await convertToolbar(component);\n break;\n case \"Modal\":\n brick = await convertModal(component);\n break;\n case \"Plaintext\":\n brick = await convertText(component);\n break;\n case \"Link\":\n brick = await convertLink(component, mod, state);\n break;\n case \"Output\":\n brick = await convertOutput(component);\n break;\n case \"Tag\":\n brick = await convertTag(component);\n break;\n case \"Avatar\":\n brick = await convertAvatar(component);\n break;\n case \"AvatarGroup\":\n brick = await convertAvatarGroup(component);\n break;\n case \"CodeBlock\":\n brick = await convertCodeBlock(component);\n break;\n case \"Search\":\n case \"Input\":\n case \"NumberInput\":\n case \"Textarea\":\n case \"Select\":\n case \"Radio\":\n case \"Checkbox\":\n case \"Switch\":\n case \"DatePicker\":\n case \"TimePicker\":\n brick = await convertFormItem(\n component,\n convertComponentName(component.name)\n );\n break;\n case \"ForEach\":\n brick = await convertForEach(component);\n break;\n case \"If\":\n brick = await convertIf(component);\n break;\n default:\n if (\n state.app.appType === \"app\" &&\n component.name.toLowerCase() === component.name\n ) {\n // Assume it's a native HTML element\n brick = {\n brick: component.name,\n properties: component.properties,\n };\n } else {\n // eslint-disable-next-line no-console\n console.error(\"Unknown component:\", component.name);\n }\n }\n } else {\n const { type, importSource, name } = component.reference!;\n let refPart: ModulePart | null | undefined;\n if (type === \"imported\") {\n const imported = state.app.modules.get(importSource!);\n refPart = name\n ? imported?.namedExports.get(name)\n : imported?.defaultExport;\n } else {\n const parts = [...mod.internals, ...mod.namedExports.values()];\n refPart = parts.find(\n (part) => part.type === \"template\" && part.component.id?.name === name\n );\n }\n if (refPart?.type === \"template\") {\n const tplName = refPart.component.id!.name;\n brick = {\n brick:\n state.app.appType === \"app\"\n ? getAppTplName(tplName)\n : getViewTplName(tplName, options.rootId),\n properties: component.properties,\n };\n } else {\n // eslint-disable-next-line no-console\n console.error(\n `Cannot find the component \"${component.reference!.name}\".`\n );\n }\n }\n\n if (!brick) {\n return [];\n }\n\n if (component.ref) {\n if (scope === \"template\") {\n (brick as { ref?: string }).ref = component.ref;\n } else {\n brick.properties ??= {};\n brick.properties.dataset ??= {};\n (brick.properties.dataset as Record<string, string>).ref = component.ref;\n }\n }\n\n if (component.slot) {\n brick.slot = component.slot;\n }\n\n brick.events = convertEvents(component, options);\n\n if (component.children?.length) {\n brick.children = (\n await Promise.all(\n component.children.map((child) =>\n convertComponent(child, mod, state, options, scope)\n )\n )\n ).flat();\n\n if (\n (component.name === \"Card\" || component.name === \"Modal\") &&\n brick.children.length > 0\n ) {\n brick.children = [\n {\n brick: \"eo-content-layout\",\n children: brick.children,\n },\n ];\n }\n }\n\n return brick;\n}\n\nfunction convertComponentName(name: string) {\n return name.includes(\"-\")\n ? name\n : `eo${name.replace(/([A-Z])/g, \"-$1\").toLowerCase()}`;\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\nimport type { ListProps } from \"../lib/components.js\";\nimport { parseDataSource } from \"./expressions.js\";\n\nexport default function convertList({ properties }: Component): BrickConf {\n const props = properties as Omit<ListProps, \"dataSource\"> & {\n dataSource: string | object;\n };\n\n const { dataSource, fields, variant } = props;\n\n const parsedDataSource = parseDataSource(dataSource);\n\n return {\n brick: \"eo-list\",\n properties: {\n variant,\n dataSource: parsedDataSource.isString\n ? parsedDataSource.embedded\n : dataSource,\n fields,\n themeVariant: \"elevo\",\n },\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type {\n Component,\n ParsedModule,\n RenderUseBrick,\n} from \"@next-shared/tsx-parser\";\nimport type { DescriptionsProps } from \"../lib/components.js\";\n// import { convertToStoryboard } from \"./raw-data-generate/convert.js\";\n// import { getPreGeneratedAttrViews } from \"./getPreGeneratedAttrViews.js\";\nimport { parseDataSource } from \"./expressions.js\";\n// import { findObjectIdByUsedDataContexts } from \"./findObjectIdByUsedDataContexts.js\";\nimport { convertComponent } from \"./convertComponent.js\";\nimport { deepReplaceVariables } from \"./deepReplaceVariables.js\";\nimport type { ConvertState, ConvertOptions } from \"./interfaces.js\";\n\ninterface DescriptionItem {\n label: string;\n text?: string;\n field?: string;\n render?: RenderUseBrick;\n}\n\nexport default async function convertDescriptions(\n { properties }: Component,\n mod: ParsedModule,\n state: ConvertState,\n options: ConvertOptions,\n scope: \"page\" | \"view\" | \"template\"\n): Promise<BrickConf> {\n const { dataSource, title, list, columns, ...restProps } =\n properties as Partial<DescriptionsProps<object>> as Omit<\n DescriptionsProps<object>,\n \"list\"\n > & {\n dataSource: string | object;\n list: DescriptionItem[] | string;\n columns?: number;\n };\n\n const parsedDataSource = parseDataSource(dataSource);\n\n // const objectId = findObjectIdByUsedDataContexts(\n // parsedDataSource.usedContexts,\n // view.dataSources,\n // view.variables\n // );\n\n // const attrViews = objectId\n // ? await getPreGeneratedAttrViews(objectId)\n // : undefined;\n\n const configuredItems = new Map<string, BrickConf>();\n\n // if (attrViews?.size && Array.isArray(list)) {\n // for (const item of list) {\n // if (item.render) {\n // continue;\n // }\n // if (item.field) {\n // const candidate = attrViews.get(item.field);\n // if (candidate) {\n // const brick = convertToStoryboard(candidate, item.field);\n // if (brick) {\n // brick.slot = `[${item.field}]`;\n // configuredItems.set(item.field, brick);\n // }\n // }\n // }\n // }\n // }\n\n const convertedList = Array.isArray(list)\n ? await Promise.all(\n list.map(async ({ render, ...item }) => {\n if (render) {\n const patterns = new Map<string, string>();\n if (render.params.length > 0) {\n patterns.set(render.params[0], \"DATA\");\n }\n\n const useBrick = (\n await Promise.all(\n render.children.map((child) =>\n convertComponent(child, mod, state, options, scope)\n )\n )\n ).flatMap((child) => deepReplaceVariables(child, patterns));\n\n return {\n label: item.label,\n useBrick,\n };\n }\n const brick = item.field\n ? configuredItems.get(item.field)\n : undefined;\n return brick\n ? {\n label: item.label,\n useChildren: `[${item.field}]`,\n }\n : item;\n })\n )\n : list;\n\n return {\n brick: \"eo-descriptions\",\n properties: {\n ...restProps,\n dataSource: parsedDataSource.isString\n ? parsedDataSource.embedded\n : dataSource,\n // descriptionTitle: title,\n list: convertedList,\n ...(columns == null\n ? {\n column: options.expanded ? 3 : 1,\n templateColumns: \"repeat(auto-fill,minmax(360px,1fr))\",\n }\n : {\n column: columns,\n }),\n // showCard: !options.expanded,\n themeVariant: \"elevo\",\n },\n children:\n configuredItems.size > 0 ? Array.from(configuredItems.values()) : [],\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\nimport type { CardProps } from \"../lib/components.js\";\n\nexport default function convertCard(component: Component): BrickConf {\n const { properties } = component;\n const { title, textContent } = properties as CardProps & {\n textContent?: string;\n };\n return {\n brick: \"eo-card\",\n properties: {\n themeVariant: \"elevo\",\n cardTitle: title,\n background: \"#fff\",\n outline: \"background\",\n ...(textContent ? { textContent } : null),\n },\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\nimport type { ButtonProps } from \"../lib/components.js\";\n\nexport default function convertButton(component: Component): BrickConf {\n const { properties } = component;\n const props = properties as ButtonProps & {\n textContent?: string;\n };\n return {\n brick: \"eo-button\",\n properties: {\n ...props,\n themeVariant: \"elevo\",\n },\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\nimport type { FormProps } from \"../lib/components.js\";\n\nexport default function convertForm(component: Component): BrickConf {\n const { properties } = component;\n const { values } = (properties ?? {}) as FormProps<object>;\n\n return {\n brick: \"eo-form\",\n properties: {\n values: values ?? {},\n themeVariant: \"elevo\",\n },\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\n\nexport default function convertToolbar(_component: Component): BrickConf {\n return {\n brick: \"eo-flex-layout\",\n properties: {\n gap: \"0.5em\",\n alignItems: \"center\",\n },\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\nimport type { ModalProps } from \"../lib/components.js\";\n\nexport default function convertModal(component: Component): BrickConf {\n const { properties } = component;\n const { title, confirmText, cancelText, ...restProps } =\n properties as Partial<ModalProps> & {\n textContent?: string;\n };\n return {\n brick: \"eo-modal\",\n portal: true,\n properties: {\n themeVariant: \"elevo\",\n modalTitle: title,\n confirmText: confirmText,\n cancelText: cancelText,\n keyboard: true,\n ...restProps,\n },\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\n\nexport default function convertText(component: Component): BrickConf {\n const { properties } = component;\n const props = properties as {\n textContent?: string;\n };\n return {\n brick: \"span\",\n properties: {\n ...props,\n },\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component, ParsedModule } from \"@next-shared/tsx-parser\";\nimport type { LinkProps } from \"../lib/components.js\";\nimport type { ConvertState } from \"./interfaces.js\";\n\nexport default function convertLink(\n component: Component,\n mod: ParsedModule,\n state: ConvertState\n): BrickConf {\n const { properties } = component;\n const props = properties as LinkProps & {\n textContent?: string;\n };\n return {\n brick: \"eo-link\",\n properties: {\n ...props,\n inApp: state.app.appType === \"app\",\n themeVariant: \"elevo\",\n },\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\n\nexport default function convertOutput(component: Component): BrickConf {\n const { properties } = component;\n const { style, ...restProps } = properties as {\n textContent?: string;\n style?: Record<string, any>;\n };\n\n return {\n brick: \"pre\",\n properties: {\n style: {\n background: \"hsl(230, 1%, 98%)\",\n color: \"hsl(230, 8%, 24%)\",\n fontFamily:\n '\"Fira Code\", \"Fira Mono\", Menlo, Consolas, \"DejaVu Sans Mono\", monospace',\n direction: \"ltr\",\n textAlign: \"left\",\n whiteSpace: \"pre\",\n wordSpacing: \"normal\",\n wordBreak: \"normal\",\n lineHeight: \"1.5\",\n tabSize: \"2\",\n hyphens: \"none\",\n fontSize: \"13px\",\n\n padding: \"1em\",\n // margin: \"0.5em 0\",\n margin: \"0\",\n overflowX: \"auto\",\n borderRadius: \"9px\",\n ...style,\n },\n ...restProps,\n },\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\nimport type { TagProps } from \"../lib/components.js\";\n\nexport default function convertTag(component: Component): BrickConf {\n const { properties } = component;\n const props = properties as TagProps & {\n textContent?: string;\n };\n return {\n brick: \"eo-tag\",\n properties: {\n ...props,\n themeVariant: \"elevo\",\n },\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\nimport type { AvatarProps } from \"../lib/components.js\";\n\nexport default function convertAvatar(component: Component): BrickConf {\n const { properties } = component;\n const props = properties as AvatarProps;\n return {\n brick: \"eo-avatar\",\n properties: {\n ...props,\n themeVariant: \"elevo\",\n },\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\nimport type { AvatarGroupProps } from \"../lib/components.js\";\n\nexport default function convertAvatarGroup(component: Component): BrickConf {\n const { properties } = component;\n const props = properties as AvatarGroupProps;\n return {\n brick: \"eo-avatar-group\",\n properties: {\n ...props,\n themeVariant: \"elevo\",\n },\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\nimport type { CodeBlockProps } from \"../lib/components.js\";\n\nexport default function convertCodeBlock(component: Component): BrickConf {\n const { properties } = component;\n const props = properties as Partial<CodeBlockProps>;\n return {\n brick: \"eo-code-block\",\n properties: {\n ...props,\n themeVariant: \"elevo\",\n },\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\n\nexport default function convertFormItem(\n component: Component,\n type: string\n): BrickConf {\n const { properties } = component;\n\n let brick = type;\n let props: Record<string, unknown> = {\n ...properties,\n themeVariant: \"elevo\",\n };\n\n switch (brick) {\n case \"eo-search\":\n props = {\n ...props,\n trim: true,\n };\n break;\n case \"eo-number-input\":\n brick = \"eo-input\";\n props = {\n type: \"number\",\n ...props,\n };\n break;\n }\n\n return {\n brick,\n properties: props,\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\n\nexport default function convertForEach(component: Component): BrickConf {\n const { properties } = component;\n const { dataSource } = properties as {\n dataSource?: unknown;\n };\n return {\n brick: \":forEach\",\n dataSource,\n };\n}\n","import type { BrickConf } from \"@next-core/types\";\nimport type { Component } from \"@next-shared/tsx-parser\";\n\nexport default function convertIf(component: Component): BrickConf {\n const { properties } = component;\n const { dataSource } = properties as {\n dataSource?: unknown;\n };\n return {\n brick: \":if\",\n dataSource,\n };\n}\n","import type { BrickConf, ContextConf } from \"@next-core/types\";\nimport {\n isOfficialComponent,\n type ComponentChild,\n type ModulePart,\n type ModulePartOfFunction,\n type ParsedModule,\n} from \"@next-shared/tsx-parser\";\nimport { convertDataSource } from \"./convertDataSource.js\";\nimport { convertComponent } from \"../convertComponent.js\";\nimport type { ConvertState, ConvertOptions } from \"../interfaces.js\";\n\nexport interface ConvertedModule {\n sourceModule: ParsedModule;\n defaultExport: ConvertedPart | null;\n namedExports: Map<string, ConvertedPart>;\n internals: ConvertedPart[];\n}\n\nexport type ConvertedPart = ConvertedPartOfComponent | ModulePartOfFunction;\n\nexport interface ConvertedPartOfComponent {\n type: \"page\" | \"view\" | \"template\";\n bricks: BrickConf[];\n context: ContextConf[];\n name?: string;\n title?: string;\n}\n\nexport default async function convertModule(\n mod: ParsedModule,\n state: ConvertState,\n options: ConvertOptions\n): Promise<ConvertedModule> {\n if (mod.usedHelpers.size > 0) {\n for (const helper of mod.usedHelpers) {\n state.usedHelpers.add(helper);\n }\n }\n\n const [defaultExport, namedExports, internals] = await Promise.all([\n mod.defaultExport\n ? parseModulePart(mod.defaultExport, mod, state, options)\n : null,\n Promise.all(\n Array.from(mod.namedExports.entries()).map(\n async ([name, part]) =>\n [name, await parseModulePart(part, mod, state, options)] as [\n string,\n ConvertedPart,\n ]\n )\n ).then((entries) => new Map(entries)),\n Promise.all(\n mod.internals.map((part) => parseModulePart(part, mod, state, options))\n ),\n ]);\n\n return {\n sourceModule: mod,\n defaultExport,\n namedExports,\n internals,\n };\n}\n\nasync function parseModulePart(\n part: ModulePart,\n mod: ParsedModule,\n state: ConvertState,\n options: ConvertOptions\n): Promise<ConvertedPart> {\n if (part.type === \"function\") {\n return part;\n }\n\n const context: ContextConf[] = [];\n\n const { component } = part;\n\n for (const binding of component.bindingMap.values()) {\n if (binding.kind === \"resource\") {\n context.push(convertDataSource(binding.resource!));\n } else if (\n binding.kind === \"state\" ||\n binding.kind === \"constant\" ||\n binding.kind === \"param\"\n ) {\n context.push({\n name: binding.id.name,\n value: binding.initialValue,\n expose: binding.kind === \"param\",\n track: true,\n });\n }\n }\n\n let children: ComponentChild[] | undefined;\n if (part.type === \"view\") {\n const view = component.children?.find((child) =>\n isOfficialComponent(child, \"View\")\n );\n if (view) {\n children = view.children;\n }\n } else {\n children = component.children;\n }\n\n const bricks = children?.length\n ? (\n await Promise.all(\n children.map((child) =>\n convertComponent(child, mod, state, options, part.type)\n )\n )\n ).flat()\n : [];\n\n return {\n type: part.type,\n bricks,\n context,\n name: component.id?.name,\n title: part.title,\n };\n}\n"],"names":["remoteWorkerPromise","worker","getRemoteTsxParserWorker","Remote","wrap","Worker","URL","EXPRESSION_PREFIX_REG","EXPRESSION_SUFFIX_REG","isExpressionString","value","trimmed","trim","test","isAnyOfficialComponent","child","reference","type","importSource","MODULE_SOURCE","isOfficialComponent","name","counter","tplNameMap","Map","getViewTplName","rootId","has","set","get","getViewTplNamePrefixByRootId","getViewTplNameSuffix","getAppTplName","replace","toLowerCase","convertDataSource","resource","http","api","params","tool","transform","rejectTransform","config","scope","hasEnabled","Object","prototype","hasOwnProperty","call","resolve","useProvider","args","isObject","translate","limit","undefined","limitBy","order","displayName","onReject","if","enabled","track","fallback","expose","convertEventHandlers","handler","options","list","Array","isArray","map","hdl","_convertEventHandlers","action","payload","_handler$callback","success","callback","error","targetRef","ref","target","method","content","detail","then","consequent","else","alternate","convertEventHandler","filter","Boolean","length","parseDataSource","data","isString","expression","expr","console","warn","JSON","stringify","embedded","usedContexts","strictCollectMemberUsage","deepReplaceVariables","patterns","size","item","fromEntries","entries","_ref","k","v","keys","some","includes","replacements","result","preevaluate","withParent","hooks","beforeVisitGlobal","node","path","_ref2","p","shorthand","computed","push","id","prefix","source","suffix","chunks","prevStart","i","start","end","substring","join","replaceVariables","columnUseBrickParams","COLORS","convertHexColorToRGBA","color","alpha","hex","slice","bigint","parseInt","async","convertComponent","component","mod","state","_component$children","brick","properties","props","dataSource","fields","variant","parsedDataSource","themeVariant","convertList","_columns$","columns","rowKey","pagination","restProps","configuredColumns","convertedColumns","Promise","all","render","column","useBrick","children","flatMap","startsWith","dataIndex","useChildren","key","scrollConfig","x","expanded","bordered","from","values","convertTable","title","configuredItems","convertedList","label","field","templateColumns","convertDescriptions","textContent","cardTitle","background","outline","convertCard","groupField","_groupField","widgets","usedHelpers","add","chartData","mergedWidgets","metricGroups","mergedMetrics","Set","metricIds","w","metric","widget","mergedWidget","group","find","g","metrics","relevantMetrics","m","counterMetric","groupTitle","metricId","delete","colorCursor","style","display","gridTemplateColumns","gap","dataset","_widget$relevantMetri","_widget$relevantMetri2","precision","colorCount","colors","_","unit","chart","xField","yFields","yField","forceAbsoluteNumbers","series","isNegative","height","timeFormat","areaOptions","fill","axis","yAxis","min","max","shape","areaShape","legends","tooltip","marker","stroke","lineWidth","shadowColor","shadowBlur","shadowOffsetX","shadowOffsetY","domStyles","boxShadow","borderRadius","border","backdropFilter","padding","fontSize","fontWeight","marginBottom","flexDirection","lineColor","showArea","convertDashboard","convertButton","convertForm","alignItems","confirmText","cancelText","portal","modalTitle","keyboard","convertModal","convertText","inApp","app","appType","convertLink","fontFamily","direction","textAlign","whiteSpace","wordSpacing","wordBreak","lineHeight","tabSize","hyphens","margin","overflowX","convertOutput","convertTag","convertAvatar","convertAvatarGroup","convertCodeBlock","convertFormItem","convertForEach","convertIf","_refPart","refPart","imported","modules","namedExports","defaultExport","internals","part","_part$component$id","tplName","_brick","_brick$properties","_brick$properties2","_brick$properties2$da","slot","events","event","_component$events","click","search","convertEvents","flat","convertModule","helper","parseModulePart","sourceModule","_children","_component$id","context","binding","bindingMap","kind","initialValue","view","bricks"],"sourceRoot":""}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
(()=>{"use strict";var e,n,t,r,o,s,i,a,d,l,p,u,c,f,m,g,h,y,v,x={4154:(e,n,t)=>{var r=t(580),o=t(8135),s=t(4);const i="next-tsx",a=["callApi","callHttp","callTool"];function d(e,n){return!e.async&&!e.generator||(n.errors.push({message:"Function cannot be async or generator",node:e,severity:"error"}),!1)}function l(e,n){return!!e.referencesImport(i,n)||e.node.name===n&&!e.scope.getBinding(e.node.name)}function p(e,n){let t=null;return o.traverse(e,{enter(e,n){var r;!t&&(o.isFunctionExpression(e)||o.isStatement(e)||o.isAwaitExpression(e)||o.isYieldExpression(e)||o.isJSX(e)||o.isArrowFunctionExpression(e)&&(e.async||e.generator||o.isBlockStatement(e.body)||o.isObjectProperty(null===(r=n[n.length-1])||void 0===r?void 0:r.node)))&&(t=e)}}),!t||(null==n||n.errors.push({message:`Unsupported expression type: ${t.type}`,node:t,severity:"error"}),!1)}function u(e){return e.isNullLiteral()||e.isIdentifier()&&"undefined"===e.node.name&&void 0===e.scope.getBinding("undefined")}const c=/^<%=?\s/,f=/\s%>$/;function m(e){if("string"!=typeof e)return!1;const n=e.trim();return c.test(n)&&f.test(n)}function g(e,n,t,r){var o;const s=[],i={TSTypeAnnotation(e){s.push({type:"annotation",start:e.node.start,end:e.node.end}),e.skip()},TSTypeParameterInstantiation(e){s.push({type:"annotation",start:e.node.start,end:e.node.end}),e.skip()},TSAsExpression(e){s.push({type:"annotation",start:e.node.expression.end,end:e.node.end}),e.skip()},Identifier(e){var r,o,i,a,d,l;if(!e.isReferencedIdentifier())return;const p=e.parentPath.isObjectProperty()&&e.parentPath.node.shorthand,u=e.node.name,c=e.scope.getBindingIdentifier(u);if(c){var f,m;let l;switch(c){case null===(r=t.eventBinding)||void 0===r?void 0:r.id:l=null!==(o=t.eventBinding)&&void 0!==o&&o.isCallback?"EVENT.detail":"EVENT";break;case null===(i=t.forEachBinding)||void 0===i?void 0:i.item:l="ITEM";break;case null===(a=t.forEachBinding)||void 0===a?void 0:a.index:l="INDEX";break;case null===(d=t.dataBinding)||void 0===d?void 0:d.id:l="DATA"}if(l)return void s.push({type:"id",start:e.node.start,end:e.node.end,replacement:l,shorthand:p?u:void 0});const g=null===(f=t.component)||void 0===f?void 0:f.bindingMap.get(c);g?"state"===g.kind||"resource"===g.kind||"constant"===g.kind||"param"===g.kind||"query"===g.kind?s.push({type:"id",start:e.node.start,end:e.node.end,replacement:"query"===g.kind?"QUERY":`${"template"===t.component.type?"STATE":"CTX"}.${c.name}`,shorthand:p?u:void 0}):n.errors.push({message:`Invalid usage of ${g.kind} variable "${c.name}"`,node:e.node,severity:"error"}):null!==(m=t.functionBindings)&&void 0!==m&&m.has(c)&&s.push({type:"id",start:e.node.start,end:e.node.end,replacement:`FN.${u}`,shorthand:p?u:void 0})}else null!==(l=t.contextBindings)&&void 0!==l&&l.includes(u)&&s.push({type:"id",start:e.node.start,end:e.node.end,replacement:`CTX.${u}`,shorthand:p?u:void 0})}};e.isIdentifier()&&i.Identifier(e),e.traverse(i),s.sort(((e,n)=>e.start-n.start));const a=[];let d=e.node.start;for(const e of s)a.push(n.source.substring(d,e.start),"annotation"===e.type?"":`${e.shorthand?`${e.shorthand}:`:""}${e.replacement}`),d=e.end;a.push(n.source.substring(d,e.node.end));const l=a.join("");return r?l:`<%${null!==(o=t.modifier)&&void 0!==o?o:""} ${l} %>`}const h=Symbol("ambiguous");function y(e,n,t){if(e.isTSAsExpression())return y(e.get("expression"),n,t);if(e.isObjectExpression())return function(e,n,t){const r=e.get("properties");if(r.some((e=>e.isSpreadElement()||e.isObjectProperty()&&(e.node.computed||e.node.shorthand)))&&p(e.node,n))return t.ambiguous?h:g(e,n,t);const o={};for(const e of r){if(!e.isObjectProperty()){n.errors.push({message:`Unsupported property type: ${e.type}`,node:e.node,severity:"error"});continue}if(e.node.computed||e.node.shorthand){n.errors.push({message:"Unsupported computed or shorthand object property",node:e.node.key,severity:"error"});continue}const r=e.get("key");let s;if(r.isIdentifier())s=r.node.name;else{if(!r.isStringLiteral()){n.errors.push({message:`Unsupported object key type: ${r.node.type}`,node:r.node,severity:"error"});continue}s=r.node.value}o[s]=y(e.get("value"),n,t)}return o}(e,n,t);if(e.isArrayExpression())return function(e,n,t){const r=e.get("elements");if(r.some((e=>!e||e.isSpreadElement()))&&p(e.node,n))return t.ambiguous?h:g(e,n,t);const o=[];for(const s of r)s.node?s.isSpreadElement()?n.errors.push({message:"Spread elements are not supported in array",node:s.node,severity:"error"}):o.push(y(s,n,t)):n.errors.push({message:"Array elements cannot be empty",node:e.node,severity:"error"});return o}(e,n,t);if(e.isStringLiteral()||e.isNumericLiteral()||e.isBooleanLiteral())return e.node.value;if(e.isNullLiteral())return null;if(!e.isIdentifier()||"undefined"!==e.node.name||void 0!==e.scope.getBinding("undefined")){if(t.allowUseBrick&&e.isArrowFunctionExpression()){const r=e.get("body");if(r.isBlockStatement())return n.errors.push({message:"Block statements are not supported in render callback",node:r.node,severity:"error"}),null;const o=[];for(const t of e.get("params")){if(!t.isIdentifier())return n.errors.push({message:`Unsupported parameter type: ${t.type}`,node:t.node,severity:"error"}),null;o.push(t.node.name)}return{params:o,children:P(r,n,t)}}return e.isExpression()?p(e.node,n)?t.ambiguous?h:g(e,n,t):null:(n.errors.push({message:`Unsupported value type: ${e.node.type}`,node:e.node,severity:"error"}),null)}}function v(e,n,t){let r=!1;return o.traverse(e.node,{enter(e,n){var t;let s;r||o.isStringLiteral(e)||o.isNumericLiteral(e)||o.isBooleanLiteral(e)||o.isNullLiteral(e)||o.isObjectExpression(e)||o.isArrayExpression(e)||o.isObjectProperty(e)||o.isIdentifier(e)&&(s=null===(t=n[n.length-1])||void 0===t?void 0:t.node,1)&&(s&&o.isObjectProperty(s)?!s.computed&&!s.shorthand:"undefined"===e.name)||(r=!0)}}),r&&p(e.node,null)?g(e,n,t):y(e,n,t)}const x={callApi:[2,3],callHttp:[1,2],callTool:[2,3]};function b(e,n,t){if(!e.isCallExpression()&&!e.isOptionalCallExpression())return n.errors.push({message:`Await expression must be a call expression, received ${e.node.type}`,node:e.node,severity:"error"}),null;const r=e.get("callee");let o;if(!r.isIdentifier())return n.errors.push({message:`Await expression must call an identifier, received ${r.type}`,node:r.node,severity:"error"}),null;for(const e of a)if(l(r,e)){o=e;break}if(!o)return n.errors.push({message:`Await expression must call "callApi", "callHttp" or "callTool", received "${r.node.name}"`,node:r.node,severity:"error"}),null;const s=x[o],i=e.get("arguments"),d=i.length<s[0];if((d||!s.includes(i.length))&&(n.errors.push({message:`"${o}()" expects ${s.join(" or ")} arguments, but got ${i.length}`,node:e.node,severity:d?"error":"warning"}),d))return null;let p;const c=i[0];if("callHttp"===o){const e=y(c,n,t);if("string"!=typeof e)return n.errors.push({message:`"${o}()" expects a string value as the first argument, but got ${typeof e}`,node:c.node,severity:"error"}),null;p={api:e,http:!0}}else if("callApi"===o){if(!c.isStringLiteral())return n.errors.push({message:`"${o}()" expects a string literal as the first argument, but got ${c.type}`,node:c.node,severity:"error"}),null;p={api:c.node.value}}else{const e=y(c,n,t);if("string"!=typeof e)return n.errors.push({message:`"${o}()" expects a string value as the first argument, but got ${typeof e}`,node:c.node,severity:"error"}),null;const r=i[1],s=y(r,n,t);if("string"!=typeof s)return n.errors.push({message:`"${o}()" expects a string value as the second argument, but got ${typeof s}`,node:r.node,severity:"error"}),null;const a=i[2];let d;a&&(d=y(a,n,t)),p={api:o,tool:{conversationId:e,stepId:s},params:d}}if("callApi"===o||"callHttp"===o){const e=i[1];if(e&&!u(e)){e.isObjectExpression()||n.errors.push({message:`Data source "params" prefers an object literal, but got ${e.type}`,node:e.node,severity:"notice"});const r=y(e,n,t);m(r)||"object"==typeof r&&null!==r?p.params=r:n.errors.push({message:"API params expects an object or expression, but got "+typeof r,node:e.node,severity:"error"})}}if("callApi"===o){const e=i[2];if(e&&!u(e))if(e.isObjectExpression()){const t=e.get("properties");for(const e of t){if(!e.isObjectProperty()){n.errors.push({message:`"callApi()" third param "meta" expects object properties, but got ${e.type}`,node:e.node,severity:"error"});continue}const t=e.get("key");if(!t.isIdentifier()){n.errors.push({message:`"callApi()" third param "meta" property key must be an identifier, but got ${t.type}`,node:t.node,severity:"error"});continue}if("objectId"!==t.node.name){n.errors.push({message:`"callApi()" third param "meta" property key must be "objectId", but got "${t.node.name}"`,node:t.node,severity:"error"});continue}const r=e.get("value");if(!u(r)){if(!r.isStringLiteral()){n.errors.push({message:`"callApi()" third param "meta" property "${t.node.name}" expects a string literal, but got ${r.type}`,node:r.node,severity:"error"});continue}p.objectId=r.node.value}}}else n.errors.push({message:`"callApi()" third param "meta" expects an object literal, but got ${e.type}`,node:e.node,severity:"error"})}return p}function $(e,n,t,r){if(!e.isArrowFunctionExpression())return n.errors.push({message:`Event handler must be an arrow function expression, but got ${e.type}`,node:e.node,severity:"error"}),null;const o=e.get("params");if(o.length>1)return n.errors.push({message:`Event handler arrow function must have at most one parameter, but got ${o.length}`,node:e.node,severity:"error"}),null;const s=o[0],i={...t,modifier:void 0,eventBinding:void 0};if(s){if(!s.isIdentifier())return n.errors.push({message:`Event handler arrow function parameter must be an identifier, but got ${s.type}`,node:s.node,severity:"error"}),null;i.eventBinding={id:s.node,isCallback:r}}const a=E(e.get("body"),n,i);return a?[].concat(a):null}function E(e,n,t){if(e.isBlockStatement())return e.get("body").flatMap((e=>E(e,n,t))).filter((e=>null!==e));if(e.isIfStatement())return{action:"conditional",payload:{test:y(e.get("test"),n,t),consequent:E(e.get("consequent"),n,t),alternate:e.node.alternate?E(e.get("alternate"),n,t):null}};if(e.isExpressionStatement())return E(e.get("expression"),n,t);if(e.isCallExpression()||e.isOptionalCallExpression()){const i=e.get("callee"),d=e.get("arguments");if(i.isIdentifier()){if(l(i,"showMessage"))return 1!==d.length?(n.errors.push({message:`"showMessage()" expects exactly 1 argument, but got ${d.length}`,node:e.node,severity:"error"}),null):{action:"show_message",payload:y(d[0],n,t)};if(l(i,"pushQuery"))return 1!==d.length&&2!==d.length?(n.errors.push({message:`"pushQuery()" expects 1 or 2 arguments, but got ${d.length}`,node:e.node,severity:"error"}),null):{action:"update_query",payload:{method:"push",args:d.map((e=>y(e,n,t)))}};for(const r of a)if(l(i,r)){const r=b(e,n,t);return r?(n.contracts.add(r.api),{action:"call_api",payload:r}):null}const o=i.scope.getBindingIdentifier(i.node.name);let s;var r;return o&&(s=null===(r=t.component)||void 0===r?void 0:r.bindingMap.get(o)),s?"setState"===s.kind?{action:"update_variable",payload:{name:s.id.name,value:void 0===d[0]?void 0:y(d[0],n,{...t,modifier:void 0})}}:(n.errors.push({message:`"${i.node.name}" is not callable`,node:i.node,severity:"error"}),null):(n.errors.push({message:`Function "${i.node.name}" is not defined`,node:i.node,severity:"error"}),null)}if(i.isMemberExpression()||i.isOptionalMemberExpression()){if(i.node.computed)return n.errors.push({message:"Event handler call expression with computed member expression is not supported",node:i.node,severity:"error"}),null;const e=i.get("object");if(e.isMemberExpression()||e.isOptionalMemberExpression()){const r=e.get("property");if(!e.node.computed&&r.isIdentifier()&&"current"===r.node.name){const r=e.get("object");if(r.isIdentifier()){var o;const e=r.scope.getBindingIdentifier(r.node.name);let a;var s;if(e&&(a=null===(s=t.component)||void 0===s?void 0:s.bindingMap.get(e)),!a)return n.errors.push({message:`Variable "${r.node.name}" is not defined`,node:r.node,severity:"error"}),null;if("ref"!==a.kind)return n.errors.push({message:`Variable "${r.node.name}" is not a ref, but a ${a.kind}`,node:r.node,severity:"error"}),null;const l=i.get("property");return l.isIdentifier()?{action:"call_ref",payload:{ref:a.id.name,method:l.node.name,args:d.map((e=>y(e,n,t))),scope:"template"===(null===(o=t.component)||void 0===o?void 0:o.type)?"template":"global"}}:(n.errors.push({message:"Event handler call expression with non-identifier property is not supported",node:l.node,severity:"error"}),null)}}}if(!e.isCallExpression())return n.errors.push({message:`Member expression in event handler expects a call expression as object, but got ${e.type}`,node:e.node,severity:"error"}),null;const r=e.get("callee");if(!r.isIdentifier())return n.errors.push({message:`Member expression in event handler expects an identifier as callee, but got ${r.type}`,node:r.node,severity:"error"}),null;const p=i.get("property");if(!p.isIdentifier())return n.errors.push({message:`Member expression in event handler expects an identifier as property, but got ${p.type}`,node:p.node,severity:"error"}),null;let u;for(const e of a)if(l(r,e)){u=e;break}if(u){if("then"!==p.node.name)return n.errors.push({message:`"${u}()" expects "then" as its method, but got ${p.node.name}`,node:p.node,severity:"error"}),null;if(1!==d.length)return n.errors.push({message:`"${u}().then()" expects exactly 1 argument, but got ${d.length}`,node:p.node,severity:"error"}),null;const r=b(e,n,t);if(!r)return null;n.contracts.add(r.api);const o=$(d[0],n,t,!0);return{action:"call_api",payload:r,callback:o?{success:o}:void 0}}return n.errors.push({message:`Unsupported action in event handler: ${r.node.name}`,node:r.node,severity:"error"}),null}}return n.errors.push({message:"Unsupported event handler",node:e.node,severity:"error"}),null}function S(e,n,t){var r;if(!e.isReferencedIdentifier())return null;const o=e.node.name,s=e.scope.getBinding(o);if(!s)return null;if(null!==(r=t.componentBindings)&&void 0!==r&&r.has(s.identifier))return{type:"local",name:o};if("module"===s.kind){if(s.path.isImportSpecifier()&&s.path.parentPath.isImportDeclaration()){const e=s.path.get("imported");if(!e.isIdentifier())return n.errors.push({message:`Unsupported import specifier type: ${e.type}`,node:e.node,severity:"error"}),null;const t=s.path.parentPath.get("source");return{type:"imported",name:e.node.name,importSource:t.node.value}}if(s.path.isImportDefaultSpecifier()&&s.path.parentPath.isImportDeclaration())return{type:"imported",importSource:s.path.parentPath.get("source").node.value}}return n.errors.push({message:`Unsupported component binding for "${o}"`,node:s.identifier,severity:"error"}),null}function w(e,n,t){var r,o;if(!e.isJSXExpressionContainer())return void n.errors.push({message:`The "ref" attribute in component expects a JSXExpressionContainer, but got ${null===(r=e.node)||void 0===r?void 0:r.type}`,node:null!==(o=e.node)&&void 0!==o?o:e.parent,severity:"error"});const s=e.get("expression");if(!s.isIdentifier())return void n.errors.push({message:`The "ref" attribute in component expects an identifier, but got ${s.node.type}`,node:s.node,severity:"error"});const i=s.node.name,a=s.scope.getBindingIdentifier(i);let d;var l;if(a&&(d=null===(l=t.component)||void 0===l?void 0:l.bindingMap.get(a)),d){if("ref"===d.kind)return d.id.name;n.errors.push({message:`The variable "${i}" is not a ref, but a ${d.kind}`,node:e.node,severity:"error"})}else n.errors.push({message:`The ref "${i}" is not defined`,node:e.node,severity:"error"})}function I(e){return e.slice(2).replace(/([a-z])([A-Z])/g,"$1.$2").toLowerCase()}function k(e,n,t){if(e.isJSXFragment())return e.get("children").flatMap((e=>k(e,n,t)));if(e.isJSXText())return e.node.value.trim()?{type:"text",text:e.node.value}:null;if(e.isJSXExpressionContainer())return k(e.get("expression"),n,t);if(e.isJSXEmptyExpression())return null;if(e.isJSXElement())return function(e,n,t){const r=e.get("openingElement"),s=r.get("name");if(!s.isJSXIdentifier())return n.errors.push({message:`Unsupported JSX element name type: ${s.type}`,node:s.node,severity:"error"}),null;if(l(s,"Fragment")){for(const e of r.node.attributes)o.isJSXAttribute(e)&&o.isJSXIdentifier(e.name)&&"key"===e.name.name||n.errors.push({message:"Invalid attribute for Fragment",node:e,severity:"error"});return e.get("children").flatMap((e=>k(e,n,t)))}const i=S(s,n,t),a={};let d,p;const u=l(s,"Route");for(const e of r.get("attributes")){if(e.isJSXSpreadAttribute()){n.errors.push({message:"Spread attributes are not supported in component",node:e.node,severity:"error"});continue}const r=e.get("name");if(!r.isJSXIdentifier()){n.errors.push({message:`Expected JSXIdentifier, but got ${r.node.type}`,node:r.node,severity:"error"});continue}const o=r.node.name;if("key"===o)continue;const s=e.get("value");if(u)if("component"===o){if(!s.isJSXExpressionContainer()){var c,f;n.errors.push({message:`The "component" attribute in Route expects a JSXExpressionContainer, but got ${null===(c=s.node)||void 0===c?void 0:c.type}`,node:null!==(f=s.node)&&void 0!==f?f:s.parent,severity:"error"});continue}const e=s.get("expression");if(!e.isIdentifier()){n.errors.push({message:`The "component" attribute in Route expects an identifier, but got ${e.node.type}`,node:e.node,severity:"error"});continue}const r=S(e,n,t);if(!r){n.errors.push({message:`The component "${e.node.name}" is not defined`,node:e.node,severity:"error"});continue}a.component={name:e.node.name,reference:r}}else if("path"===o){if(!s.isStringLiteral()){var m,g;n.errors.push({message:`The "path" attribute in Route expects a string literal, but got ${null===(m=s.node)||void 0===m?void 0:m.type}`,node:null!==(g=s.node)&&void 0!==g?g:s.parent,severity:"error"});continue}a.path=s.node.value}else n.errors.push({message:`Unsupported attribute "${o}" in Route`,node:r.node,severity:"error"});else if("ref"!==o)if(/^on[A-Z]/.test(o)){if(!s.isJSXExpressionContainer()){var h,y;n.errors.push({message:`Event handler "${o}" expects a JSXExpressionContainer, but got ${null===(h=s.node)||void 0===h?void 0:h.type}`,node:null!==(y=s.node)&&void 0!==y?y:s.parent,severity:"error"});continue}const e=s.get("expression");if(e.isJSXEmptyExpression()){n.errors.push({message:"Empty expression in events is not allowed",node:e.node,severity:"warning"});continue}let r=null;if(e.isIdentifier()){const n=e.scope.getBindingIdentifier(e.node.name);if(n){var x;const e=null===(x=t.component)||void 0===x?void 0:x.bindingMap.get(n);e&&"eventHandler"===e.kind&&(r=[{action:"dispatch_event",payload:{type:I(e.id.name),detail:"<% EVENT.detail %>"}}])}}r||(r=$(e,n,t)),r&&(null!=d||(d={}),d[I(o)]=r)}else if(null==s.node)a[o]=!0;else if(s.isStringLiteral())a[o]=s.node.value;else if(s.isJSXExpressionContainer()){const e=s.get("expression");e.isJSXEmptyExpression()?n.errors.push({message:`Empty expression in JSX attribute "${o}" is not allowed`,node:e.node,severity:"warning"}):a[o]=v(e,n,{...t,allowUseBrick:!0,modifier:"="})}else n.errors.push({message:`Unsupported attribute value type in component: ${s.node.type}`,node:s.node,severity:"error"});else p=w(s,n,t)}const{textContent:b,children:E}=j(e.get("children"),n,t);return b&&(a.textContent=b),{type:"component",component:{name:s.node.name,reference:i,properties:a,ref:p,events:d,children:E}}}(e,n,t);if(e.isCallExpression()){const r=e.get("callee");if(r.isMemberExpression()||r.isOptionalMemberExpression()){const o=r.get("property");if(o.isIdentifier()&&"map"===o.node.name){const o=e.get("arguments");if(o.length>0){const e=o[0];if(e.isArrowFunctionExpression()){const o=e.get("body");if(o.isExpression()&&T(o.node)){const o=r.get("object");if(!p(o.node,n))return null;const s=e.get("params");if(s.length>2)return n.errors.push({message:`Array map function with JSX elements must have at most two parameters, but got ${s.length}`,node:s[2].node,severity:"error"}),null;const i=s.find((e=>!e.isIdentifier()));if(i)return n.errors.push({message:`Array map function with JSX elements must have identifier parameters, but got ${i.type}`,node:i.node,severity:"error"}),null;const a={...t,forEachBinding:void 0};if(s.length>0){const[e,n]=s;a.forEachBinding={item:e.node,index:null==n?void 0:n.node}}return{type:"component",component:{name:"ForEach",properties:{dataSource:v(o,n,{...t,modifier:"="})},children:P(e.get("body"),n,a)}}}}}}}}else if(e.isConditionalExpression()){const r=e.get("test"),o=e.get("consequent"),s=e.get("alternate");if(T(o.node)||T(s.node))return p(r.node,n)?{type:"component",component:{name:"If",properties:{dataSource:v(r,n,{...t,modifier:"="})},children:[...P(o,n,t),...P(s,n,t).map((e=>({...e,slot:"else"})))]}}:null}else if(e.isLogicalExpression()){const r=e.get("left"),o=e.get("right"),s=e.node.operator;if(("&&"===s||"||"===s)&&T(o.node)){if(!p(r.node,n))return null;const e=P(o,n,t);return{type:"component",component:{name:"If",properties:{dataSource:v(r,n,{...t,modifier:"="})},children:"&&"===s?e:e.map((e=>({...e,slot:"else"})))}}}}return e.isExpression()?p(e.node,n)?{type:"expression",expression:e}:null:(n.errors.push({message:`Unsupported node type in JSX children: ${e.type}`,node:e.node,severity:"error"}),null)}function T(e){let n=!1;return o.traverse(e,{enter(e){n||!o.isJSXElement(e)&&!o.isJSXFragment(e)||(n=!0)}}),n}function j(e,n,t){let r=e.flatMap((e=>k(e,n,t))),o=r.every((e=>"text"===(null==e?void 0:e.type)));if(!o){let e=null;const n=[];for(const t of r){if(null===t);else if("text"===t.type||"expression"===t.type){var s,i,a;if("text"===(null===(s=e)||void 0===s?void 0:s.type)||"expression"===(null===(i=e)||void 0===i?void 0:i.type)){e={type:"merged",children:[e,t]},n.splice(n.length-1,1,e);continue}if("merged"===(null===(a=e)||void 0===a?void 0:a.type)){e.children.push(t);continue}}e=t,n.push(t)}r=n,o=r.every((e=>"text"===(null==e?void 0:e.type)||"merged"===(null==e?void 0:e.type)&&e.children.every((e=>"text"===e.type))))}return o?{textContent:r.flatMap((e=>"text"===e.type?e.text:e.children.map((e=>e.text)))).join("").trim()}:r.every((e=>!!e&&"component"!==e.type))?{textContent:A(r.flatMap((e=>"merged"===e.type?e.children:e)),n,t)}:{children:r.filter((e=>!!e)).map((e=>"component"===e.type?e.component:{name:"Plaintext",properties:{textContent:"text"===e.type?e.text:"expression"===e.type?g(e.expression,n,{...t,modifier:"="}):A(e.children,n,t)}}))}}function A(e,n,t){return n.usedHelpers.add("_helper_mergeTexts"),`<%= FN._helper_mergeTexts(${e.map((e=>"text"===e.type?JSON.stringify(e):`{type:"expression",value:(${g(e.expression,n,t,!0)})}`)).join(", ")}) %>`}function P(e,n,t){const{textContent:r,children:o}=j([e],n,t);return null!=o?o:[{name:"Plaintext",properties:{textContent:r}}]}function C(e){var n,t;const r=null===(n=e.children)||void 0===n?void 0:n.find((e=>{return t="View",function(e){return!e.reference||"imported"===e.reference.type&&e.reference.importSource===i}(n=e)&&(n.reference?n.reference.name===t:n.name===t);var n,t})),o=null==r||null===(t=r.properties)||void 0===t?void 0:t.title;if("string"==typeof o&&!m(o))return o}const B=s.default;function O(e,n,t,r,o,s,i){const a=b(e,n,t);if(!a)return null;n.contracts.add(a.api);const d={name:r,config:o,...a};if(s){var l;if(s.length>("catch"===i?1:2))return n.errors.push({message:`".${i}()" expects no more than 2 arguments, but got ${s.length}`,node:null===(l=s[1])||void 0===l?void 0:l.node,severity:"error"}),null;if(s.length>0){const e=X(s[0],n,t);e&&(d["catch"===i?"rejectTransform":"transform"]=e)}if("catch"!==i&&s.length>1){const e=X(s[1],n,t);e&&(d.rejectTransform=e)}}return d}function X(e,n,t){if(!e.isArrowFunctionExpression())return n.errors.push({message:`".then()" callback expects an arrow function, but got ${e.type}`,node:e.node,severity:"error"}),null;const r=e.get("body");if(!r.isExpression())return n.errors.push({message:`".then()" callback function body expects an expression, but got ${r.type}`,node:r.node,severity:"error"}),null;const o=e.get("params");var s,i;if(o.length>1)return n.errors.push({message:`".then()" callback function expects exactly 0 or 1 parameter, but got ${o.length}`,node:null!==(s=null===(i=o[1])||void 0===i?void 0:i.node)&&void 0!==s?s:e,severity:"error"}),null;const a={...t,dataBinding:void 0},d=o[0];if(o.length>0){if(!d.isIdentifier())return n.errors.push({message:`".then()" callback function parameter expects an identifier, but got ${d.type}`,node:d.node,severity:"error"}),null;a.dataBinding={id:d.node}}return g(r,n,a)}function J(e,n,t,r){const o=e.get("id");if(!o.isArrayPattern())return null;const s=o.get("elements");if(1!==s.length&&2!==s.length)return null;const i=s[0];if(!i.isIdentifier())return null;if(1!==n.length&&2!==n.length)return null;const a=n[0];if(!a.isArrowFunctionExpression())return null;if(!d(a.node,t))return null;const l=a.get("body");if(l.isBlockStatement())return null;if(!l.isCallExpression())return null;const p=l.get("callee");if(!p.isIdentifier()&&!p.isMemberExpression())return null;const u=n[1];let c;if(u){if(!u.isObjectExpression())return t.errors.push({message:`"useResource()" second argument must be an object expression, but got ${u.type}`,node:u.node,severity:"error"}),null;for(const e of u.get("properties")){if(!e.isObjectProperty())return t.errors.push({message:`Unsupported property type in "useResource()" second argument: ${e.type}`,node:e.node,severity:"error"}),null;const n=e.get("key");if(!n.isIdentifier())return t.errors.push({message:`"useResource()" second argument property key must be an identifier, but got ${n.type}`,node:n.node,severity:"error"}),null;if(e.node.computed)return t.errors.push({message:'"useResource()" second argument property key cannot be computed',node:n.node,severity:"error"}),null;if("enabled"!==n.node.name&&"fallback"!==n.node.name)return t.errors.push({message:`"useResource()" second argument property key must be "enabled" or "fallback", but got "${n.node.name}"`,node:n.node,severity:"error"}),null;null!=c||(c={}),c[n.node.name]=y(e.get("value"),t,r)}}let f=null;if(p.isMemberExpression()){const e=p.get("property");if(!e.isIdentifier()||p.node.computed||"then"!==e.node.name&&"catch"!==e.node.name)return t.errors.push({message:"Unexpected awaited expression",node:e.node,severity:"error"}),null;f=O(p.get("object"),t,r,i.node.name,c,l.get("arguments"),e.node.name)}else f=O(l,t,r,i.node.name,c);return f?{id:i.node,kind:"resource",resource:f}:null}function M(e,n,t,r){if(!d(e.node,n))return null;const o=new Map,s={bindingMap:o,type:t,id:e.node.id},i={...r,component:s},a=e.get("params");if("template"===t){if(a.length>1)return n.errors.push({message:`Component function can only have zero or one parameter, received ${a.length}`,node:e.node,severity:"error"}),null;if(a.length>0){const e=a[0];if(!e.isObjectPattern())return n.errors.push({message:`Component function parameter must be an object pattern, received ${e.type}`,node:e.node,severity:"error"}),null;for(const t of e.get("properties")){if(t.isRestElement())return n.errors.push({message:"Component function parameter rest element is not allowed",node:t.node,severity:"error"}),null;const e=t.node;if(e.computed||!e.shorthand)return n.errors.push({message:"Component function parameter properties must be shorthand and not computed",node:t.node,severity:"error"}),null;const r=t.get("key"),s=t.get("value");if(!r.isIdentifier())return n.errors.push({message:`Component function parameter property key must be an identifier, received ${r.type}`,node:r.node,severity:"error"}),null;const a=r.node.name;if(/^on[A-Z]/.test(a)){if(!s.isIdentifier())return n.errors.push({message:`Event handler parameter "${a}" must be an identifier, received ${s.type}`,node:s.node,severity:"error"}),null;o.set(s.node,{id:s.node,kind:"eventHandler"})}else{let e,t;if(s.isAssignmentPattern()){const r=s.get("left");r.isIdentifier()&&(e=r.node,t=y(s.get("right"),n,i))}else s.isIdentifier()&&(e=s.node);if(!e){n.errors.push({message:`Component function parameter property value must be an identifier or assignment pattern, received ${s.type}`,node:s.node,severity:"error"});continue}const r={id:e,kind:"param",initialValue:t};o.set(e,r)}}}}else if(a.length>0)return n.errors.push({message:`Page function cannot have parameters, received ${a.length}`,node:a[0].node,severity:"error"}),null;const p=e.get("body").get("body");for(const e of p)if(e.isVariableDeclaration()){if("const"!==e.node.kind){n.errors.push({message:`Only "const" variable declaration is allowed, received "${e.node.kind}"`,node:e.node,severity:"error"});continue}for(const t of e.get("declarations")){const e=t.get("init");if(e.isCallExpression()){const r=e.get("callee");if(r.isIdentifier()){const s=e.get("arguments");if(l(r,"useState")){const e=t.get("id");if(!e.isArrayPattern())continue;const r=e.get("elements");if(2!==r.length){n.errors.push({message:`useState() destructuring must have exactly two elements, received ${r.length}`,node:e.node,severity:"error"});continue}const a=r[0],d=r[1];if(!a.isIdentifier()||!d.isIdentifier()){n.errors.push({message:`useState() destructuring must have identifiers as elements, received ${r.map((e=>e.type)).join(", ")}`,node:e.node,severity:"error"});continue}const l={id:a.node,kind:"state"};o.set(a.node,l),o.set(d.node,{id:a.node,kind:"setState"}),s.length>0&&(l.initialValue=y(s[0],n,i)),s.length>1&&n.errors.push({message:`useState() only accepts at most one argument, received ${s.length}`,node:s[1].node,severity:"warning"});continue}if(l(r,"useResource")){const e=J(t,s,n,i);e&&o.set(e.id,e);continue}if(l(r,"useRef")){const e=t.get("id");if(!e.isIdentifier()){n.errors.push({message:`useRef() must be assigned to an identifier, received ${e.type}`,node:e.node,severity:"error"});continue}s.length>1&&n.errors.push({message:`useRef() only accepts at most one argument, received ${s.length}`,node:s[1].node,severity:"warning"});const r=s[0];r&&!r.isNullLiteral()&&n.errors.push({message:`useRef() first argument must be null, received ${r.type}`,node:r.node,severity:"warning"}),o.set(e.node,{id:e.node,kind:"ref"});continue}if(l(r,"useQuery")){const e=t.get("id");if(!e.isIdentifier()){n.errors.push({message:`useQuery() must be assigned to an identifier, received ${e.type}`,node:e.node,severity:"error"});continue}s.length>0&&n.errors.push({message:`useQuery() does not accept any arguments, received ${s.length}`,node:s[0].node,severity:"warning"}),o.set(e.node,{id:e.node,kind:"query"});continue}}}const r=t.get("id");if(!r.isIdentifier()){n.errors.push({message:`Expect an identifier as the variable name, received ${r.type}`,node:r.node,severity:"error"});continue}const s={id:r.node,kind:"constant"};o.set(r.node,s),e.node&&(s.initialValue=y(e,n,i))}}else if(e.isReturnStatement()){const t=e.get("argument");if(!t.isJSXElement()&&!t.isJSXFragment()){n.errors.push({message:`Expect JSX element or fragment as the return value, received ${t.type}`,node:t.node,severity:"error"});continue}s.children=P(t,n,i)}else e.isTSInterfaceDeclaration()||e.isTSTypeAliasDeclaration()||n.errors.push({message:`Unsupported top level statement type: ${e.type}`,node:e.node,severity:"error"});return s}function D(e,n,t){if(!d(e.node,n))return null;const r=[];e.traverse({Identifier(n){if(!n.isReferencedIdentifier())return;const o=n.parentPath.isObjectProperty()&&n.parentPath.node.shorthand,s=n.scope.getBindingIdentifier(n.node.name);var i;s&&s!==e.node.id&&null!==(i=t.functionBindings)&&void 0!==i&&i.has(s)&&r.push({type:"id",start:n.node.start,end:n.node.end,replacement:`FN.${s.name}`,shorthand:o?n.node.name:void 0})}}),r.sort(((e,n)=>e.start-n.start));const o=[];let s=e.node.start;for(const e of r)o.push(n.source.substring(s,e.start),`${e.shorthand?`${e.shorthand}:`:""}${e.replacement}`),s=e.end;return o.push(n.source.substring(s,e.node.end)),{name:e.node.id.name,source:o.join(""),typescript:!0}}const U=[".js",".jsx",".ts",".tsx"];function F(e,n,t){if(e.startsWith("/"))return R(e.slice(1),t);const r=n.substring(0,n.lastIndexOf("/")),o=r?r.split("/"):[],s=e.split("/");for(const e of s)"."!==e&&(".."===e?o.length>0&&o.pop():o.push(e));return R(o.join("/"),t)}function R(e,n){if(n.some((n=>n.filePath===e)))return e;for(const t of U)if(n.some((n=>n.filePath===`${e}${t}`)))return`${e}${t}`;return e}const N=s.default;var L=function(e){return e.TopLevelStatement="top level statement",e.NamedExportDeclaration="named export declaration",e.DefaultExportDeclaration="default export declaration",e}(L||{});function _(e){return e.name[0]>="A"&&e.name[0]<="Z"}function V(e,n,t,o){var s;const i=n.files.find((n=>n.filePath===e));if(!i)throw new Error(`File not found: ${e}`);if(n.modules.has(e))return;n.modules.set(e,null),t||(t=(0,r.parse)(i.content,{plugins:["jsx","typescript"],sourceType:"module",errorRecovery:!0}));const a=!n.entry,d=a?"entry":i.filePath.startsWith("Pages/")?"page":i.filePath.startsWith("Components/")?"template":"unknown",p={source:i.content,filePath:e,moduleType:d,defaultExport:null,namedExports:new Map,internals:[],errors:[],contracts:new Set,usedHelpers:new Set};if(null!==(s=t.errors)&&void 0!==s&&s.length)for(const e of t.errors)p.errors.push({message:`${e.code}: ${e.reasonCode}`,node:null,severity:"error"});a&&(n.entry=p),n.modules.set(e,p),function(e,n,t,r){const o=new Set,s=new Set,i={functionBindings:o,componentBindings:s,contextBindings:null==r?void 0:r.withContexts};N(t,{Program(t){const a=t.get("body"),d=[];let p=null,u=null;const c=[],f=(t,r)=>{if(t.isFunctionDeclaration()){const i=t.node.id;if(i&&(_(i)?s.add(i):o.add(i)),r===L.DefaultExportDeclaration)return void("app"===n.appType&&"entry"===e.moduleType?e.errors.push({message:"The entry module in an app cannot have a default export declaration.",node:t.node,severity:"error"}):p=t);if(!i)return void e.errors.push({message:"Function declaration must have a name",node:t.node,severity:"error"});r===L.NamedExportDeclaration?d.push({func:t,exported:!0}):d.push({func:t})}else if(t.isExportDefaultDeclaration()){const e=t.get("declaration");f(e,L.DefaultExportDeclaration)}else if(t.isExportNamedDeclaration()){const e=t.get("declaration");f(e,L.NamedExportDeclaration)}else if(t.isImportDeclaration()){const e=t.node.source.value;(e.startsWith(".")||e.startsWith("/"))&&c.push(e)}else t.isTSInterfaceDeclaration||t.isTSTypeAliasDeclaration()||e.errors.push({message:`Unsupported ${r} type: ${t.type}`,node:t.node,severity:"error"})};for(const t of a){if("app"===n.appType&&e===n.entry&&t.isExpressionStatement()){const n=t.get("expression");if(n.isCallExpression()){const t=n.get("callee");if(t.isIdentifier()&&l(t,"render")){const t=n.get("arguments");if(1!==t.length){e.errors.push({message:`render() expects exactly one argument, received: ${t.length}`,node:n.node,severity:"error"});continue}u=t[0];continue}}}f(t,L.TopLevelStatement)}for(const t of c)V(F(t,e.filePath,n.files),n,void 0,r);for(const{func:t,exported:r}of d){const o=t.node.id;if(_(o)){const s="app"===n.appType&&"entry"===e.moduleType?"page":"template",a=M(t,e,s,i);if(a){const n={type:s,component:a};r?e.namedExports.set(o.name,n):e.internals.push(n)}}else{const n=D(t,e,i);if(n){const t={type:"function",function:n};r?e.namedExports.set(o.name,t):e.internals.push(t)}}}if(p){const n="entry"===e.moduleType?"view":"page"===e.moduleType?"page":"template",t=M(p,e,n,i);t&&(e.defaultExport={type:n,component:t,..."view"===n?{title:C(t)}:{}})}if(u){const n=P(u,e,i);e.render={type:"render",children:n}}t.stop()}})}(p,n,t,o)}(0,t(7695).p)(class{parseView(e,n){return function(e,n){const t={appType:"view",modules:new Map,files:[{filePath:"View.tsx",content:e}],errors:[]};let s;try{s=(0,r.parse)(e,{plugins:["jsx","typescript"],sourceType:"module",errorRecovery:!0})}catch(e){return t.errors.push({message:`Failed to parse TSX: ${e}`,node:null,severity:"fatal"}),t}for(const e of s.program.body)if(o.isExportDefaultDeclaration(e)){if(o.isFunctionDeclaration(e.declaration))return V("View.tsx",t,s,n),t;break}return function(e,n,t,r){var o;const s=[];if(null!==(o=t.errors)&&void 0!==o&&o.length)for(const e of t.errors)s.push({message:`${e.code}: ${e.reasonCode}`,node:null,severity:"error"});const i=new Map,a={type:"view",bindingMap:i},d={component:a,contextBindings:null==r?void 0:r.withContexts},l={source:n.files.find((n=>n.filePath===e)).content,filePath:e,moduleType:"entry",defaultExport:{type:"view",component:a},internals:[],namedExports:new Map,errors:s,contracts:new Set,usedHelpers:new Set};B(t,{Program(e){const n=e.get("body");let t=!1;for(const e of n)if(e.isVariableDeclaration()){if(t){s.push({message:"Unexpected variable declaration after export",node:e.node,severity:"error"});continue}if("const"!==e.node.kind){s.push({message:`Only "const" variable declaration is allowed, received: ${e.node.kind}`,node:e.node,severity:"error"});continue}for(const n of e.get("declarations")){const e=n.get("id");if(!e.isIdentifier()){s.push({message:`Unsupported variable declaration pattern, expected: Identifier, received: ${e.type}`,node:e.node,severity:"error"});continue}const t={id:e.node,kind:"constant"},r=n.get("init");r.node&&(t.initialValue=y(r,l,d)),i.set(e.node,t)}}else if(e.isExportDefaultDeclaration()){t=!0;const n=e.get("declaration");n.isJSXElement()?a.children=P(n,l,d):s.push({message:`Default export must be a JSX element, received: ${n.type}`,node:e.node,severity:"error"});break}e.stop()}}),l.defaultExport.title=C(a),n.entry=l}("View.tsx",t,s,n),t}(e,n)}parseApp(e){return function(e){const n={appType:"app",modules:new Map,files:e,errors:[]};return V("index.tsx",n),n}(e)}})}},b={};function $(e){var n=b[e];if(void 0!==n)return n.exports;var t=b[e]={exports:{}};return x[e].call(t.exports,t,t.exports,$),t.exports}$.m=x,$.c=b,$.x=()=>{var e=$.O(void 0,[8135,3735,580],(()=>$(4154)));return $.O(e)},e=[],$.O=(n,t,r,o)=>{if(!t){var s=1/0;for(l=0;l<e.length;l++){for(var[t,r,o]=e[l],i=!0,a=0;a<t.length;a++)(!1&o||s>=o)&&Object.keys($.O).every((e=>$.O[e](t[a])))?t.splice(a--,1):(i=!1,o<s&&(s=o));if(i){e.splice(l--,1);var d=r();void 0!==d&&(n=d)}}return n}o=o||0;for(var l=e.length;l>0&&e[l-1][2]>o;l--)e[l]=e[l-1];e[l]=[t,r,o]},$.d=(e,n)=>{for(var t in n)$.o(n,t)&&!$.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:n[t]})},$.f={},$.e=e=>Promise.all(Object.keys($.f).reduce(((n,t)=>($.f[t](e,n),n)),[])),$.u=e=>"chunks/"+e+"."+{3735:"6be3dc55",6773:"87d0ae93",8135:"e17b904e"}[e]+".js",$.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),$.o=(e,n)=>Object.prototype.hasOwnProperty.call(e,n),(()=>{$.S={};var e={},n={};$.I=(t,r)=>{r||(r=[]);var o=n[t];if(o||(o=n[t]={}),!(r.indexOf(o)>=0)){if(r.push(o),e[t])return e[t];$.o($.S,t)||($.S[t]={}),$.S[t];var s=[];return e[t]=s.length?Promise.all(s).then((()=>e[t]=1)):1}}})(),(()=>{var e;$.g.importScripts&&(e=$.g.location+"");var n=$.g.document;if(!e&&n&&(n.currentScript&&"SCRIPT"===n.currentScript.tagName.toUpperCase()&&(e=n.currentScript.src),!e)){var t=n.getElementsByTagName("script");if(t.length)for(var r=t.length-1;r>-1&&(!e||!/^http(s?):/.test(e));)e=t[r--].src}if(!e)throw new Error("Automatic publicPath is not supported in this browser");e=e.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),$.p=e+"../"})(),n=e=>{var n=e=>e.split(".").map((e=>+e==e?+e:e)),t=/^([^-+]+)?(?:-([^+]+))?(?:\+(.+))?$/.exec(e),r=t[1]?n(t[1]):[];return t[2]&&(r.length++,r.push.apply(r,n(t[2]))),t[3]&&(r.push([]),r.push.apply(r,n(t[3]))),r},t=(e,t)=>{e=n(e),t=n(t);for(var r=0;;){if(r>=e.length)return r<t.length&&"u"!=(typeof t[r])[0];var o=e[r],s=(typeof o)[0];if(r>=t.length)return"u"==s;var i=t[r],a=(typeof i)[0];if(s!=a)return"o"==s&&"n"==a||"s"==a||"u"==s;if("o"!=s&&"u"!=s&&o!=i)return o<i;r++}},r=e=>{var n=e[0],t="";if(1===e.length)return"*";if(n+.5){t+=0==n?">=":-1==n?"<":1==n?"^":2==n?"~":n>0?"=":"!=";for(var o=1,s=1;s<e.length;s++)o--,t+="u"==(typeof(a=e[s]))[0]?"-":(o>0?".":"")+(o=2,a);return t}var i=[];for(s=1;s<e.length;s++){var a=e[s];i.push(0===a?"not("+d()+")":1===a?"("+d()+" || "+d()+")":2===a?i.pop()+" "+i.pop():r(a))}return d();function d(){return i.pop().replace(/^\((.+)\)$/,"$1")}},o=(e,t)=>{if(0 in e){t=n(t);var r=e[0],s=r<0;s&&(r=-r-1);for(var i=0,a=1,d=!0;;a++,i++){var l,p,u=a<e.length?(typeof e[a])[0]:"";if(i>=t.length||"o"==(p=(typeof(l=t[i]))[0]))return!d||("u"==u?a>r&&!s:""==u!=s);if("u"==p){if(!d||"u"!=u)return!1}else if(d)if(u==p)if(a<=r){if(l!=e[a])return!1}else{if(s?l>e[a]:l<e[a])return!1;l!=e[a]&&(d=!1)}else if("s"!=u&&"n"!=u){if(s||a<=r)return!1;d=!1,a--}else{if(a<=r||p<u!=s)return!1;d=!1}else"s"!=u&&"n"!=u&&(d=!1,a--)}}var c=[],f=c.pop.bind(c);for(i=1;i<e.length;i++){var m=e[i];c.push(1==m?f()|f():2==m?f()&f():m?o(m,t):!f())}return!!f()},s=(e,n)=>e&&$.o(e,n),i=e=>(e.loaded=1,e.get()),a=e=>Object.keys(e).reduce(((n,t)=>(e[t].eager&&(n[t]=e[t]),n)),{}),d=(e,n,r)=>{var o=r?a(e[n]):e[n];return Object.keys(o).reduce(((e,n)=>!e||!o[e].loaded&&t(e,n)?n:e),0)},l=(e,n,t,o)=>"Unsatisfied version "+t+" from "+(t&&e[n][t].from)+" of shared singleton module "+n+" (required "+r(o)+")",p=e=>{throw new Error(e)},u=e=>{"undefined"!=typeof console&&console.warn&&console.warn(e)},c=(e,n,t)=>t?t():((e,n)=>p("Shared module "+n+" doesn't exist in shared scope "+e))(e,n),f=(e=>function(n,t,r,o,s){var i=$.I(n);return i&&i.then&&!r?i.then(e.bind(e,n,$.S[n],t,!1,o,s)):e(n,$.S[n],t,r,o,s)})(((e,n,t,r,a,p)=>{if(!s(n,t))return c(e,t,p);var f=d(n,t,r);return o(a,f)||u(l(n,t,f,a)),i(n[t][f])})),m={},g={580:()=>f("default","@babel/parser",!1,[0],(()=>$.e(6773).then((()=>()=>$(6773)))))},h={580:[580]},y={},$.f.consumes=(e,n)=>{$.o(h,e)&&h[e].forEach((e=>{if($.o(m,e))return n.push(m[e]);if(!y[e]){var t=n=>{m[e]=0,$.m[e]=t=>{delete $.c[e],t.exports=n()}};y[e]=!0;var r=n=>{delete m[e],$.m[e]=t=>{throw delete $.c[e],n}};try{var o=g[e]();o.then?n.push(m[e]=o.then(t).catch(r)):t(o)}catch(e){r(e)}}}))},(()=>{var e={4154:1};$.f.i=(n,t)=>{e[n]||580!=n&&importScripts($.p+$.u(n))};var n=globalThis.webpackChunk_next_bricks_vb_experiment=globalThis.webpackChunk_next_bricks_vb_experiment||[],t=n.push.bind(n);n.push=n=>{var[r,o,s]=n;for(var i in o)$.o(o,i)&&($.m[i]=o[i]);for(s&&s($);r.length;)e[r.pop()]=1;t(n)}})(),v=$.x,$.x=()=>Promise.all([8135,3735,580].map($.e,$)).then(v),$.x()})();
|
|
2
|
-
//# sourceMappingURL=4154.371b28c0.js.map
|