@next-core/runtime 1.22.5 → 1.22.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_auth","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_CustomProcessors","_CustomTemplates","_fetchByProvider","_getBasePath","_getPageInfo","_handleHttpError","_history","_createRoot","_Runtime","__secret_internals","_interopRequireWildcard","_test_only","_themeAndMode","_checkIf","_WidgetFunctions","_WidgetI18n","_StoryboardFunctionRegistry","_matchPath","_Notification","_Dialog"],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"./auth.js\";\nexport * from \"./CustomProcessors.js\";\nexport * from \"./CustomTemplates.js\";\nexport * from \"./fetchByProvider.js\";\nexport * from \"./getBasePath.js\";\nexport * from \"./getPageInfo.js\";\nexport * from \"./handleHttpError.js\";\nexport * from \"./history.js\";\nexport * from \"./createRoot.js\";\nexport {\n createRuntime,\n getRuntime,\n type RuntimeOptions,\n type RuntimeHooks,\n type RuntimeHooksMenuHelpers,\n type ImagesFactory,\n} from \"./internal/Runtime.js\";\nimport * as __secret_internals from \"./internal/secret_internals.js\";\nexport { __secret_internals };\nexport { __test_only } from \"./internal/test_only.js\";\nexport {\n getCssPropertyValue,\n getCurrentTheme,\n getCurrentMode,\n batchSetAppsLocalTheme,\n applyTheme,\n} from \"./themeAndMode.js\";\nexport {\n checkIfOfComputed,\n checkIfByTransform,\n} from \"./internal/compute/checkIf.js\";\nexport { registerWidgetFunctions } from \"./internal/compute/WidgetFunctions.js\";\nexport { registerWidgetI18n } from \"./internal/compute/WidgetI18n.js\";\nexport { StoryboardFunctionRegistryFactory } from \"./StoryboardFunctionRegistry.js\";\nexport { matchPath } from \"./internal/matchPath.js\";\nexport { Notification, type NotificationOptions } from \"./Notification.js\";\nexport { Dialog, type DialogOptions } from \"./Dialog.js\";\n"],"mappings":";;;;;;;;;;;;;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,QAAA,CAAAf,GAAA;IAAA;EAAA;AAAA;AACA,IAAAgB,WAAA,GAAApB,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAkB,WAAA,EAAAjB,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAgB,WAAA,CAAAhB,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAQ,WAAA,CAAAhB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAiB,QAAA,GAAArB,OAAA;AAQA,IAAAsB,kBAAA,GAAAC,uBAAA,CAAAvB,OAAA;AAAqES,OAAA,CAAAa,kBAAA,GAAAA,kBAAA;AAErE,IAAAE,UAAA,GAAAxB,OAAA;AACA,IAAAyB,aAAA,GAAAzB,OAAA;AAOA,IAAA0B,QAAA,GAAA1B,OAAA;AAIA,IAAA2B,gBAAA,GAAA3B,OAAA;AACA,IAAA4B,WAAA,GAAA5B,OAAA;AACA,IAAA6B,2BAAA,GAAA7B,OAAA;AACA,IAAA8B,UAAA,GAAA9B,OAAA;AACA,IAAA+B,aAAA,GAAA/B,OAAA;AACA,IAAAgC,OAAA,GAAAhC,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_auth","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_CustomProcessors","_CustomTemplates","_fetchByProvider","_getBasePath","_getPageInfo","_handleHttpError","_history","_createRoot","_Runtime","__secret_internals","_interopRequireWildcard","_test_only","_themeAndMode","_checkIf","_WidgetFunctions","_WidgetI18n","_StoryboardFunctionRegistry","_matchPath","_Notification","_Dialog"],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"./auth.js\";\nexport * from \"./CustomProcessors.js\";\nexport * from \"./CustomTemplates.js\";\nexport * from \"./fetchByProvider.js\";\nexport * from \"./getBasePath.js\";\nexport * from \"./getPageInfo.js\";\nexport * from \"./handleHttpError.js\";\nexport * from \"./history.js\";\nexport * from \"./createRoot.js\";\nexport {\n createRuntime,\n getRuntime,\n type RuntimeOptions,\n type RuntimeHooks,\n type RuntimeHooksMenuHelpers,\n type ImagesFactory,\n type PageViewInfo,\n} from \"./internal/Runtime.js\";\nimport * as __secret_internals from \"./internal/secret_internals.js\";\nexport { __secret_internals };\nexport { __test_only } from \"./internal/test_only.js\";\nexport {\n getCssPropertyValue,\n getCurrentTheme,\n getCurrentMode,\n batchSetAppsLocalTheme,\n applyTheme,\n} from \"./themeAndMode.js\";\nexport {\n checkIfOfComputed,\n checkIfByTransform,\n} from \"./internal/compute/checkIf.js\";\nexport { registerWidgetFunctions } from \"./internal/compute/WidgetFunctions.js\";\nexport { registerWidgetI18n } from \"./internal/compute/WidgetI18n.js\";\nexport { StoryboardFunctionRegistryFactory } from \"./StoryboardFunctionRegistry.js\";\nexport { matchPath } from \"./internal/matchPath.js\";\nexport { Notification, type NotificationOptions } from \"./Notification.js\";\nexport { Dialog, type DialogOptions } from \"./Dialog.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAA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IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAQ,WAAA,CAAAhB,GAAA;IAAA;EAAA;AAAA;AACA,IAAAiB,QAAA,GAAArB,OAAA;AASA,IAAAsB,kBAAA,GAAAC,uBAAA,CAAAvB,OAAA;AAAqES,OAAA,CAAAa,kBAAA,GAAAA,kBAAA;AAErE,IAAAE,UAAA,GAAAxB,OAAA;AACA,IAAAyB,aAAA,GAAAzB,OAAA;AAOA,IAAA0B,QAAA,GAAA1B,OAAA;AAIA,IAAA2B,gBAAA,GAAA3B,OAAA;AACA,IAAA4B,WAAA,GAAA5B,OAAA;AACA,IAAA6B,2BAAA,GAAA7B,OAAA;AACA,IAAA8B,UAAA,GAAA9B,OAAA;AACA,IAAA+B,aAAA,GAAA/B,OAAA;AACA,IAAAgC,OAAA,GAAAhC,OAAA"}
@@ -47,6 +47,7 @@ async function renderRoutes(returnNode, routes, _runtimeContext, rendererContext
47
47
  {
48
48
  var _hooks$checkPermissio;
49
49
  const route = output.route = matched.route;
50
+ output.path = matched.match.path;
50
51
  const runtimeContext = {
51
52
  ..._runtimeContext,
52
53
  match: matched.match
@@ -1 +1 @@
1
- {"version":3,"file":"Renderer.js","names":["_loader","require","_cook","_general","_storyboard","_lodash","_checkIf","_computeRealProperties","_resolveData","_computeRealValue","_listenOnTrackingContext","_matchRoutes","_constants","_expandCustomTemplate","_utils","_CustomTemplates","_Runtime","_enums","_getTracks","_isStrictMode","_constants2","_expandFormRenderer","_evaluate","_matchStoryboard","_bindListeners","renderRoutes","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","slotId","isIncremental","matched","matchRoutes","output","getEmptyRenderOutput","unauthenticated","_hooks$checkPermissio","route","runtimeContext","match","ctxStore","disposeDataInRoutes","routePath","concat","define","context","undefined","pendingPermissionsPreCheck","push","hooks","checkPermissions","preCheckPermissionsForBrickOrRoute","value","asyncComputeRealValue","preLoadBricks","Array","isArray","blockingList","loadBricksImperatively","getBrickPackages","type","redirectTo","redirect","resolved","resolveData","transform","console","error","Error","path","menuRequest","loadMenu","menu","menuRequests","newOutput","mergeRenderOutput","renderBricks","bricks","tag","RenderTag","BRICK","memoizeMenuRequests","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","_hooks$checkPermissio2","_runtimeContext$app","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","symbolForTplStateStoreId","formStateStoreId","symbolForFormStateStoreId","hasOwnProperty","symbolForTPlExternalForEachItem","forEachItem","forEachIndex","symbolForTPlExternalForEachIndex","length","strict","isStrictMode","warnAboutStrictMode","asyncCheckBrickIf","brickName","startsWith","_brickConf$lifeCycle","ensureValidControlBrick","lowerLevelRenderControlNode","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","renderControlNode","_rawOutput$node","rawOutput","PLACEHOLDER","return","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","getTracks","renderId","listener","currentRenderId","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","reControlledOutput","scopedStores","postAsyncRender","listenerFactory","CustomEvent","detail","rerender","reRender","store","mountAsyncData","debouncedListener","debounce","contextName","onChange","tplStateStore","getTplStateStore","registerArbitraryLifeCycle","test","customTemplates","get","catchLoad","unknownBricks","tplTagName","getTagNameOfCustomTemplate","app","id","_tplStack$get","tplCount","set","includes","customElements","FORM_RENDERER","FormRendererElement","HTMLElement","$$typeof","enqueueStableLoadBricks","formData","confProps","_brickConf$properties","properties","trackingContextList","asyncPropertyEntries","asyncComputeRealPropertyEntries","computedPropsFromHost","symbolForAsyncComputedPropsFromHost","isScript","props","constructAsyncProperties","src","rel","href","_window$PUBLIC_ROOT","prefix","window","PUBLIC_ROOT","attrs","loadScript","loadStyle","events","portal","iid","ref","usedProcessors","strictCollectMemberUsage","size","loadProcessorsImperatively","join","loadProperties","listenOnTrackingContext","registerBrickLifeCycle","expandedBrickConf","expandCustomTemplate","expandFormRenderer","childRuntimeContext","loadChildren","routeSlotIndexes","Set","entries","childSlotId","slotConf","flags","add","performIncrementalRender","location","homepage","pathname","matchHomepage","every","matchRoute","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequests","result","reCatch","childrenOutput","has","child","isTrackAll","isPreEvaluated","getPreEvaluatedRaw","rows","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","flushStableLoadBricks","waitForAll","menuConf","warn","rest","last","sibling","assign","originalSlots","newSlots","process","env","NODE_ENV","_child$slot","promise","name","unknownPolicy","catch","e"],"sources":["../../../src/internal/Renderer.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n ContextConf,\n MenuConf,\n RouteConf,\n SlotConfOfBricks,\n SlotsConf,\n StaticMenuConf,\n} from \"@next-core/types\";\nimport {\n enqueueStableLoadBricks,\n flushStableLoadBricks,\n loadBricksImperatively,\n loadProcessorsImperatively,\n loadScript,\n loadStyle,\n} from \"@next-core/loader\";\nimport { isTrackAll } from \"@next-core/cook\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { strictCollectMemberUsage } from \"@next-core/utils/storyboard\";\nimport { debounce } from \"lodash\";\nimport { asyncCheckBrickIf } from \"./compute/checkIf.js\";\nimport {\n asyncComputeRealPropertyEntries,\n constructAsyncProperties,\n} from \"./compute/computeRealProperties.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport {\n TrackingContextItem,\n listenOnTrackingContext,\n} from \"./compute/listenOnTrackingContext.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport { matchRoute, matchRoutes } from \"./matchRoutes.js\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTplStateStoreId,\n} from \"./CustomTemplates/constants.js\";\nimport { expandCustomTemplate } from \"./CustomTemplates/expandCustomTemplate.js\";\nimport type {\n RenderBrick,\n RenderChildNode,\n RenderReturnNode,\n RuntimeBrickConfWithSymbols,\n RuntimeContext,\n} from \"./interfaces.js\";\nimport {\n getTagNameOfCustomTemplate,\n getTplStateStore,\n} from \"./CustomTemplates/utils.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport type { NextHistoryState } from \"./historyExtended.js\";\nimport { getBrickPackages, hooks } from \"./Runtime.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { getTracks } from \"./compute/getTracks.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport {\n FORM_RENDERER,\n RuntimeBrickConfOfFormSymbols,\n symbolForFormStateStoreId,\n} from \"./FormRenderer/constants.js\";\nimport { expandFormRenderer } from \"./FormRenderer/expandFormRenderer.js\";\nimport { isPreEvaluated } from \"./compute/evaluate.js\";\nimport { getPreEvaluatedRaw } from \"./compute/evaluate.js\";\nimport { RuntimeBrickConfOfTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { matchHomepage } from \"./matchStoryboard.js\";\nimport type { DataStore, DataStoreType } from \"./data/DataStore.js\";\nimport { listenerFactory } from \"./bindListeners.js\";\n\nexport interface RenderOutput {\n node?: RenderChildNode;\n unauthenticated?: boolean;\n redirect?: {\n path: string;\n state?: NextHistoryState;\n };\n route?: RouteConf;\n blockingList: (Promise<unknown> | undefined)[];\n menuRequests: Promise<StaticMenuConf>[];\n hasTrackingControls?: boolean;\n}\n\nexport async function renderRoutes(\n returnNode: RenderReturnNode,\n routes: RouteConf[],\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId?: string,\n isIncremental?: boolean\n): Promise<RenderOutput> {\n const matched = await matchRoutes(routes, _runtimeContext);\n const output = getEmptyRenderOutput();\n switch (matched) {\n case \"missed\":\n break;\n case \"unauthenticated\":\n output.unauthenticated = true;\n break;\n default: {\n const route = (output.route = matched.route);\n const runtimeContext = {\n ..._runtimeContext,\n match: matched.match,\n };\n if (isIncremental) {\n runtimeContext.ctxStore.disposeDataInRoutes(routes);\n }\n const routePath = parentRoutes.concat(route);\n runtimeContext.ctxStore.define(\n route.context,\n runtimeContext,\n undefined,\n routePath\n );\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n route,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n // Currently, this is only used for brick size-checking: these bricks\n // will be loaded before page rendering, but they will NOT be rendered.\n const { preLoadBricks } = route as { preLoadBricks?: string[] };\n if (Array.isArray(preLoadBricks)) {\n output.blockingList.push(\n loadBricksImperatively(preLoadBricks, getBrickPackages())\n );\n }\n\n if (route.type === \"redirect\") {\n let redirectTo: unknown;\n if (typeof route.redirect === \"string\") {\n redirectTo = await asyncComputeRealValue(\n route.redirect,\n runtimeContext\n );\n } else {\n const resolved = (await resolveData(\n {\n transform: \"redirect\",\n ...route.redirect,\n },\n runtimeContext\n )) as { redirect?: unknown };\n redirectTo = resolved.redirect;\n }\n if (typeof redirectTo !== \"string\") {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected redirect result:\", redirectTo);\n throw new Error(\n `Unexpected type of redirect result: ${typeof redirectTo}`\n );\n }\n output.redirect = { path: redirectTo };\n } else {\n const menuRequest = loadMenu(route.menu, runtimeContext);\n if (menuRequest) {\n output.menuRequests.push(menuRequest);\n }\n\n if (route.type === \"routes\") {\n const newOutput = await renderRoutes(\n returnNode,\n route.routes,\n runtimeContext,\n rendererContext,\n routePath,\n slotId\n );\n mergeRenderOutput(output, newOutput);\n } else {\n const newOutput = await renderBricks(\n returnNode,\n route.bricks,\n runtimeContext,\n rendererContext,\n routePath,\n slotId\n );\n mergeRenderOutput(output, newOutput);\n }\n\n if (returnNode.tag === RenderTag.BRICK) {\n rendererContext.memoizeMenuRequests(route, output.menuRequests);\n }\n }\n }\n }\n\n return output;\n}\n\nexport async function renderBricks(\n returnNode: RenderReturnNode,\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId?: string,\n tplStack?: Map<string, number>,\n keyPath?: number[]\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n const kPath = keyPath ?? [];\n // 多个构件并行异步转换,但转换的结果按原顺序串行合并。\n const rendered = await Promise.all(\n bricks.map((brickConf, index) =>\n renderBrick(\n returnNode,\n brickConf,\n runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n kPath.concat(index),\n tplStack && new Map(tplStack)\n )\n )\n );\n\n rendered.forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n kPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport async function renderBrick(\n returnNode: RenderReturnNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId?: string,\n keyPath: number[] = [],\n tplStack = new Map<string, number>()\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n if (!brickConf.brick) {\n if ((brickConf as { template?: string }).template) {\n // eslint-disable-next-line no-console\n console.error(\"Legacy templates are dropped in v3:\", brickConf);\n } else {\n // eslint-disable-next-line no-console\n console.error(\"Invalid brick:\", brickConf);\n }\n return output;\n }\n\n // Translate `if: \"<%= ... %>\"` to `brick: \":if\", dataSource: \"<%= ... %>\"`.\n // In other words, translate tracking if expressions to tracking control nodes of `:if`.\n const { if: brickIf, permissionsPreCheck, ...restBrickConf } = brickConf;\n if (isGeneralizedTrackAll(brickIf)) {\n return renderBrick(\n returnNode,\n {\n brick: \":if\",\n dataSource: brickIf,\n // `permissionsPreCheck` maybe required before computing `if`.\n permissionsPreCheck,\n slots: {\n \"\": {\n type: \"bricks\",\n bricks: [restBrickConf],\n },\n },\n // These symbols have to be copied to the new brick conf.\n ...Object.getOwnPropertySymbols(brickConf).reduce(\n (acc, symbol) => ({\n ...acc,\n [symbol]: (brickConf as any)[symbol],\n }),\n {} as RuntimeBrickConfOfTplSymbols & RuntimeBrickConfOfFormSymbols\n ),\n },\n _runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n keyPath,\n tplStack\n );\n }\n\n const tplStateStoreId = brickConf[symbolForTplStateStoreId];\n const formStateStoreId = brickConf[symbolForFormStateStoreId];\n const runtimeContext = {\n ..._runtimeContext,\n tplStateStoreId,\n formStateStoreId,\n };\n\n if (hasOwnProperty(brickConf, symbolForTPlExternalForEachItem)) {\n // The external bricks of a template should restore their `forEachItem` and\n // `forEachIndex` from their host.\n runtimeContext.forEachItem = brickConf[symbolForTPlExternalForEachItem];\n runtimeContext.forEachIndex = brickConf[symbolForTPlExternalForEachIndex];\n }\n\n const { context } = brickConf as { context?: ContextConf[] };\n // istanbul ignore next\n if (Array.isArray(context) && context.length > 0) {\n const strict = isStrictMode(runtimeContext);\n warnAboutStrictMode(\n strict,\n \"Defining context on bricks\",\n \"check your brick:\",\n brickConf\n );\n if (!strict) {\n runtimeContext.ctxStore.define(context, runtimeContext);\n }\n }\n\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n brickConf,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n if (!(await asyncCheckBrickIf(brickConf, runtimeContext))) {\n return output;\n }\n\n const brickName = brickConf.brick;\n if (brickName.startsWith(\":\")) {\n ensureValidControlBrick(brickName);\n\n const { dataSource } = brickConf;\n\n const lowerLevelRenderControlNode = async (\n runtimeContext: RuntimeContext\n ) => {\n // First, compute the `dataSource`\n const computedDataSource = await asyncComputeRealValue(\n dataSource,\n runtimeContext\n );\n\n // Then, get the matched slot.\n const slot =\n brickName === \":forEach\"\n ? \"\"\n : brickName === \":switch\"\n ? String(computedDataSource)\n : computedDataSource\n ? \"\"\n : \"else\";\n\n // Don't forget to transpile children to slots.\n const slots = childrenToSlots(brickConf.children, brickConf.slots);\n\n // Then, get the bricks in that matched slot.\n const bricks =\n slots &&\n hasOwnProperty(slots, slot) &&\n (slots[slot] as SlotConfOfBricks)?.bricks;\n\n if (!Array.isArray(bricks)) {\n return getEmptyRenderOutput();\n }\n\n switch (brickName) {\n case \":forEach\": {\n if (!Array.isArray(computedDataSource)) {\n return getEmptyRenderOutput();\n }\n return renderForEach(\n returnNode,\n computedDataSource,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n tplStack,\n keyPath\n );\n }\n case \":if\":\n case \":switch\": {\n return renderBricks(\n returnNode,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n tplStack,\n keyPath\n );\n }\n }\n };\n\n const renderControlNode = async (runtimeContext: RuntimeContext) => {\n const rawOutput = await lowerLevelRenderControlNode(runtimeContext);\n rawOutput.node ??= {\n tag: RenderTag.PLACEHOLDER,\n return: returnNode,\n };\n return rawOutput;\n };\n\n const controlledOutput = await renderControlNode(runtimeContext);\n const { onMount, onUnmount } = brickConf.lifeCycle ?? {};\n\n const { contextNames, stateNames } = getTracks(dataSource);\n if (contextNames || stateNames) {\n controlledOutput.hasTrackingControls = true;\n let renderId = 0;\n const listener = async () => {\n const currentRenderId = ++renderId;\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext(runtimeContext);\n\n const reControlledOutput =\n await renderControlNode(scopedRuntimeContext);\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n await postAsyncRender(\n reControlledOutput,\n scopedRuntimeContext,\n scopedStores\n );\n\n // Ignore stale renders\n if (renderId === currentRenderId) {\n if (onUnmount) {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: true } }));\n }\n\n rendererContext.reRender(\n slotId,\n keyPath,\n reControlledOutput.node,\n returnNode\n );\n\n if (onMount) {\n listenerFactory(\n onMount,\n scopedRuntimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: true } }));\n }\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n };\n const debouncedListener = debounce(listener);\n if (contextNames) {\n for (const contextName of contextNames) {\n runtimeContext.ctxStore.onChange(contextName, debouncedListener);\n }\n }\n if (stateNames) {\n for (const contextName of stateNames) {\n const tplStateStore = getTplStateStore(\n runtimeContext,\n \"STATE\",\n `: \"${dataSource}\"`\n );\n tplStateStore.onChange(contextName, debouncedListener);\n }\n }\n }\n\n if (onMount) {\n rendererContext.registerArbitraryLifeCycle(\"onMount\", () => {\n listenerFactory(\n onMount,\n runtimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: false } }));\n });\n }\n\n if (onUnmount) {\n rendererContext.registerArbitraryLifeCycle(\"onUnmount\", () => {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: false } }));\n });\n }\n\n return controlledOutput;\n }\n\n // Widgets need to be defined before rendering.\n if (/\\.tpl-/.test(brickName) && !customTemplates.get(brickName)) {\n await catchLoad(\n loadBricksImperatively([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n );\n }\n\n const tplTagName = getTagNameOfCustomTemplate(\n brickName,\n runtimeContext.app?.id\n );\n\n if (tplTagName) {\n const tplCount = tplStack.get(tplTagName) ?? 0;\n if (tplCount >= 10) {\n throw new Error(\n `Maximum custom template stack overflowed: \"${tplTagName}\"`\n );\n }\n tplStack.set(tplTagName, tplCount + 1);\n } else if (brickName.includes(\"-\") && !customElements.get(brickName)) {\n if (brickName === FORM_RENDERER) {\n customElements.define(\n FORM_RENDERER,\n class FormRendererElement extends HTMLElement {\n get $$typeof(): string {\n return \"form-renderer\";\n }\n }\n );\n } else {\n output.blockingList.push(\n catchLoad(\n enqueueStableLoadBricks([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n )\n );\n }\n }\n\n let formData: unknown;\n let confProps: Record<string, unknown> | undefined;\n if (brickName === FORM_RENDERER) {\n ({ formData, ...confProps } = brickConf.properties ?? {});\n } else {\n confProps = brickConf.properties;\n }\n\n const trackingContextList: TrackingContextItem[] = [];\n const asyncPropertyEntries = asyncComputeRealPropertyEntries(\n confProps,\n runtimeContext,\n trackingContextList\n );\n\n const computedPropsFromHost = brickConf[symbolForAsyncComputedPropsFromHost];\n if (computedPropsFromHost) {\n asyncPropertyEntries.push(...computedPropsFromHost);\n }\n\n const isScript = brickName === \"script\";\n if (isScript || brickName === \"link\") {\n const props = await constructAsyncProperties(asyncPropertyEntries);\n if (isScript ? props.src : props.rel === \"stylesheet\" && props.href) {\n const prefix = window.PUBLIC_ROOT ?? \"\";\n if (isScript) {\n const { src, ...attrs } = props;\n await catchLoad(\n loadScript(src as string, prefix, attrs),\n \"script\",\n src as string,\n \"silent\"\n );\n } else {\n const { href, ...attrs } = props;\n await catchLoad(\n loadStyle(href as string, prefix, attrs),\n \"stylesheet\",\n href as string,\n \"silent\"\n );\n }\n return output;\n }\n }\n\n const brick: RenderBrick = {\n tag: RenderTag.BRICK,\n type: tplTagName || brickName,\n return: returnNode,\n slotId,\n events: brickConf.events,\n runtimeContext,\n portal: brickConf.portal,\n iid: brickConf.iid,\n ref: (brickConf as BrickConfInTemplate).ref,\n };\n\n output.node = brick;\n\n // 在最终挂载前,先加载所有可能用到的 processors。\n const usedProcessors = strictCollectMemberUsage(\n [brickConf.events, brickConf.lifeCycle],\n \"PROCESSORS\",\n 2\n );\n if (usedProcessors.size > 0) {\n output.blockingList.push(\n catchLoad(\n loadProcessorsImperatively(usedProcessors, getBrickPackages()),\n \"processors\",\n [...usedProcessors].join(\", \"),\n rendererContext.unknownBricks\n )\n );\n }\n\n // 加载构件属性和加载子构件等任务,可以并行。\n const blockingList: Promise<unknown>[] = [];\n\n const loadProperties = async () => {\n brick.properties = await constructAsyncProperties(asyncPropertyEntries);\n listenOnTrackingContext(brick, trackingContextList);\n };\n blockingList.push(loadProperties());\n\n rendererContext.registerBrickLifeCycle(brick, brickConf.lifeCycle);\n\n let expandedBrickConf = brickConf;\n if (tplTagName) {\n expandedBrickConf = expandCustomTemplate(\n tplTagName,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n } else if (brickName === FORM_RENDERER) {\n expandedBrickConf = expandFormRenderer(\n formData,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n }\n\n if (expandedBrickConf.portal) {\n // A portal brick has no slotId.\n brick.slotId = undefined;\n }\n\n let childRuntimeContext: RuntimeContext;\n if (tplTagName) {\n // There is a boundary for `forEachItem` between template internals and externals.\n childRuntimeContext = {\n ...runtimeContext,\n };\n delete childRuntimeContext.forEachItem;\n delete childRuntimeContext.forEachIndex;\n } else {\n childRuntimeContext = runtimeContext;\n }\n\n const loadChildren = async () => {\n const slots = childrenToSlots(\n expandedBrickConf.children,\n expandedBrickConf.slots\n );\n if (!slots) {\n return;\n }\n const routeSlotIndexes = new Set<number>();\n const rendered = await Promise.all(\n Object.entries(slots).map(([childSlotId, slotConf], index) => {\n if (slotConf.type !== \"routes\") {\n return renderBricks(\n brick,\n (slotConf as SlotConfOfBricks).bricks,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n childSlotId,\n tplStack\n );\n }\n\n if (runtimeContext.flags[\"incremental-sub-route-rendering\"]) {\n routeSlotIndexes.add(index);\n rendererContext.performIncrementalRender(async (location) => {\n const { homepage } = childRuntimeContext.app;\n const { pathname } = location;\n // Ignore if any one of homepage and parent routes not matched.\n if (\n !matchHomepage(homepage, pathname) ||\n !parentRoutes.every((route) =>\n matchRoute(route, homepage, pathname)\n )\n ) {\n return false;\n }\n\n const [\n scopedRuntimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n ] = createScopedRuntimeContext({\n ...childRuntimeContext,\n location,\n query: new URLSearchParams(location.search),\n });\n\n let failed = false;\n let incrementalOutput: RenderOutput;\n let scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n incrementalOutput = await renderRoutes(\n brick,\n slotConf.routes,\n scopedRuntimeContext,\n rendererContext,\n parentRoutes,\n childSlotId,\n true\n );\n\n // If all sub-routes are missed, ignore incremental rendering\n if (!incrementalOutput.route) {\n return false;\n }\n\n // Bailout if redirect or unauthenticated is set\n if (rendererContext.reBailout(incrementalOutput)) {\n return true;\n }\n\n scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n await postAsyncRender(incrementalOutput, scopedRuntimeContext, [\n scopedRuntimeContext.ctxStore,\n ...scopedStores,\n ]);\n\n await rendererContext.reMergeMenuRequests(\n slotConf.routes,\n incrementalOutput.route,\n incrementalOutput.menuRequests\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Incremental sub-router failed:\", error);\n\n const result = rendererContext.reCatch(error, brick);\n if (!result) {\n return true;\n }\n ({ failed, output: incrementalOutput } = result);\n\n // Assert: no errors will be throw\n await rendererContext.reMergeMenuRequests(\n slotConf.routes,\n incrementalOutput.route,\n incrementalOutput.menuRequests\n );\n }\n\n rendererContext.reRender(\n childSlotId,\n [],\n incrementalOutput.node,\n brick\n );\n\n if (!failed) {\n scopedRuntimeContext.ctxStore.mountAsyncData(\n incrementalOutput.route\n );\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n\n return true;\n });\n }\n\n return renderRoutes(\n brick,\n slotConf.routes,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n childSlotId\n );\n })\n );\n\n const childrenOutput: RenderOutput = {\n ...output,\n node: undefined,\n blockingList: [],\n menuRequests: [],\n };\n rendered.forEach((item, index) => {\n if (routeSlotIndexes.has(index)) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(slotId, [], item.node, brick);\n }\n mergeRenderOutput(childrenOutput, item);\n });\n if (childrenOutput.node) {\n brick.child = childrenOutput.node;\n }\n mergeRenderOutput(output, {\n ...childrenOutput,\n node: undefined,\n });\n };\n blockingList.push(loadChildren());\n\n await Promise.all(blockingList);\n\n return output;\n}\n\nfunction isGeneralizedTrackAll(brickIf: unknown): boolean {\n return typeof brickIf === \"string\"\n ? isTrackAll(brickIf)\n : isPreEvaluated(brickIf) &&\n // istanbul ignore next: covered by e2e tests\n isTrackAll(getPreEvaluatedRaw(brickIf));\n}\n\ntype ValidControlBrick = \":forEach\" | \":if\" | \":switch\";\n\nfunction ensureValidControlBrick(\n brick: string\n): asserts brick is ValidControlBrick {\n if (brick !== \":forEach\" && brick !== \":if\" && brick !== \":switch\") {\n throw new Error(`Unknown storyboard control node: \"${brick}\"`);\n }\n}\n\nasync function renderForEach(\n returnNode: RenderReturnNode,\n dataSource: unknown[],\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId: string | undefined,\n tplStack: Map<string, number>,\n keyPath: number[]\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n const rows = dataSource.length;\n const rendered = await Promise.all(\n dataSource.map((item, i) =>\n Promise.all(\n bricks.map((brickConf, j) =>\n renderBrick(\n returnNode,\n brickConf,\n {\n ...runtimeContext,\n forEachItem: item,\n forEachIndex: i,\n },\n rendererContext,\n parentRoutes,\n slotId,\n keyPath.concat(i * rows + j),\n tplStack && new Map(tplStack)\n )\n )\n )\n )\n );\n\n // 多层构件并行异步转换,但转换的结果按原顺序串行合并。\n rendered.flat().forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n keyPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport function getDataStores(runtimeContext: RuntimeContext) {\n return [\n runtimeContext.ctxStore,\n ...runtimeContext.tplStateStoreMap.values(),\n ...runtimeContext.formStateStoreMap.values(),\n ];\n}\n\nexport function postAsyncRender(\n output: RenderOutput,\n runtimeContext: RuntimeContext,\n stores: DataStore<DataStoreType>[]\n) {\n flushStableLoadBricks();\n\n return Promise.all([\n ...output.blockingList,\n ...stores.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\n ]);\n}\n\nexport function createScopedRuntimeContext(\n runtimeContext: RuntimeContext\n): [\n scopedRuntimeContext: RuntimeContext,\n tplStateStoreScope: DataStore<\"STATE\">[],\n formStateStoreScope: DataStore<\"FORM_STATE\">[],\n] {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const formStateStoreScope: DataStore<\"FORM_STATE\">[] = [];\n const scopedRuntimeContext: RuntimeContext = {\n ...runtimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n };\n return [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope];\n}\n\nfunction loadMenu(\n menuConf: MenuConf | undefined,\n runtimeContext: RuntimeContext\n) {\n if (!menuConf) {\n return;\n }\n\n // istanbul ignore next\n if ((menuConf as { type?: \"brick\" }).type === \"brick\") {\n // eslint-disable-next-line no-console\n console.error(\"Set menu with brick is dropped in v3:\", menuConf);\n throw new Error(\"Set menu with brick is dropped in v3\");\n }\n\n // istanbul ignore next\n if (menuConf.type === \"resolve\") {\n // eslint-disable-next-line no-console\n console.warn(\"Set menu with resolve is not supported in v3 yet:\", menuConf);\n return;\n }\n\n return asyncComputeRealValue(\n menuConf,\n runtimeContext\n ) as Promise<StaticMenuConf>;\n}\n\nfunction mergeRenderOutput(\n output: RenderOutput,\n newOutput: RenderOutput\n): void {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { blockingList, node, menuRequests, hasTrackingControls, ...rest } =\n newOutput;\n output.blockingList.push(...blockingList);\n output.menuRequests.push(...menuRequests);\n\n if (node) {\n if (output.node) {\n let last = output.node;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = node;\n } else {\n output.node = node;\n }\n }\n\n Object.assign(output, rest);\n}\n\nfunction getEmptyRenderOutput(): RenderOutput {\n return {\n blockingList: [],\n menuRequests: [],\n };\n}\n\nexport function childrenToSlots(\n children: BrickConf[] | undefined,\n originalSlots: SlotsConf | undefined\n) {\n let newSlots = originalSlots;\n // istanbul ignore next\n if (\n process.env.NODE_ENV === \"development\" &&\n children &&\n !Array.isArray(children)\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Specified brick children but not array:\",\n `<${typeof children}>`,\n children\n );\n }\n if (Array.isArray(children) && !newSlots) {\n newSlots = {};\n for (const child of children) {\n const slot = child.slot ?? \"\";\n if (!hasOwnProperty(newSlots, slot)) {\n newSlots[slot] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n (newSlots[slot] as SlotConfOfBricks).bricks.push(child);\n }\n }\n return newSlots;\n}\n\nfunction catchLoad(\n promise: Promise<unknown>,\n type: \"brick\" | \"processors\" | \"script\" | \"stylesheet\",\n name: string,\n unknownPolicy: RendererContext[\"unknownBricks\"]\n) {\n return unknownPolicy === \"silent\"\n ? promise.catch((e) => {\n // eslint-disable-next-line no-console\n console.error(`Load ${type} \"${name}\" failed:`, e);\n })\n : promise;\n}\n"],"mappings":";;;;;;;;;;;;AAUA,IAAAA,OAAA,GAAAC,OAAA;AAQA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAN,OAAA;AAIA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,wBAAA,GAAAT,OAAA;AAKA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AAMA,IAAAY,qBAAA,GAAAZ,OAAA;AAQA,IAAAa,MAAA,GAAAb,OAAA;AAIA,IAAAc,gBAAA,GAAAd,OAAA;AAEA,IAAAe,QAAA,GAAAf,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OAAA;AACA,IAAAiB,UAAA,GAAAjB,OAAA;AACA,IAAAkB,aAAA,GAAAlB,OAAA;AACA,IAAAmB,WAAA,GAAAnB,OAAA;AAKA,IAAAoB,mBAAA,GAAApB,O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AsB1D,MAAM,CAAC7B,IAAI,CAACmN,KAAK,CAAC;IACzD;EACF;EACA,OAAOsB,QAAQ;AACjB;AAEA,SAAStG,SAASA,CAChB2G,OAAyB,EACzBlO,IAAsD,EACtDmO,IAAY,EACZC,aAA+C,EAC/C;EACA,OAAOA,aAAa,KAAK,QAAQ,GAC7BF,OAAO,CAACG,KAAK,CAAEC,CAAC,IAAK;IACnB;IACAhO,OAAO,CAACC,KAAK,CAAE,QAAOP,IAAK,KAAImO,IAAK,WAAU,EAAEG,CAAC,CAAC;EACpD,CAAC,CAAC,GACFJ,OAAO;AACb"}
1
+ {"version":3,"file":"Renderer.js","names":["_loader","require","_cook","_general","_storyboard","_lodash","_checkIf","_computeRealProperties","_resolveData","_computeRealValue","_listenOnTrackingContext","_matchRoutes","_constants","_expandCustomTemplate","_utils","_CustomTemplates","_Runtime","_enums","_getTracks","_isStrictMode","_constants2","_expandFormRenderer","_evaluate","_matchStoryboard","_bindListeners","renderRoutes","returnNode","routes","_runtimeContext","rendererContext","parentRoutes","slotId","isIncremental","matched","matchRoutes","output","getEmptyRenderOutput","unauthenticated","_hooks$checkPermissio","route","path","match","runtimeContext","ctxStore","disposeDataInRoutes","routePath","concat","define","context","undefined","pendingPermissionsPreCheck","push","hooks","checkPermissions","preCheckPermissionsForBrickOrRoute","value","asyncComputeRealValue","preLoadBricks","Array","isArray","blockingList","loadBricksImperatively","getBrickPackages","type","redirectTo","redirect","resolved","resolveData","transform","console","error","Error","menuRequest","loadMenu","menu","menuRequests","newOutput","mergeRenderOutput","renderBricks","bricks","tag","RenderTag","BRICK","memoizeMenuRequests","tplStack","keyPath","kPath","rendered","Promise","all","map","brickConf","index","renderBrick","Map","forEach","item","hasTrackingControls","memoize","node","_hooks$checkPermissio2","_runtimeContext$app","brick","template","if","brickIf","permissionsPreCheck","restBrickConf","isGeneralizedTrackAll","dataSource","slots","Object","getOwnPropertySymbols","reduce","acc","symbol","tplStateStoreId","symbolForTplStateStoreId","formStateStoreId","symbolForFormStateStoreId","hasOwnProperty","symbolForTPlExternalForEachItem","forEachItem","forEachIndex","symbolForTPlExternalForEachIndex","length","strict","isStrictMode","warnAboutStrictMode","asyncCheckBrickIf","brickName","startsWith","_brickConf$lifeCycle","ensureValidControlBrick","lowerLevelRenderControlNode","_slots$slot","computedDataSource","slot","String","childrenToSlots","children","renderForEach","renderControlNode","_rawOutput$node","rawOutput","PLACEHOLDER","return","controlledOutput","onMount","onUnmount","lifeCycle","contextNames","stateNames","getTracks","renderId","listener","currentRenderId","scopedRuntimeContext","tplStateStoreScope","formStateStoreScope","createScopedRuntimeContext","reControlledOutput","scopedStores","postAsyncRender","listenerFactory","CustomEvent","detail","rerender","reRender","store","mountAsyncData","debouncedListener","debounce","contextName","onChange","tplStateStore","getTplStateStore","registerArbitraryLifeCycle","test","customTemplates","get","catchLoad","unknownBricks","tplTagName","getTagNameOfCustomTemplate","app","id","_tplStack$get","tplCount","set","includes","customElements","FORM_RENDERER","FormRendererElement","HTMLElement","$$typeof","enqueueStableLoadBricks","formData","confProps","_brickConf$properties","properties","trackingContextList","asyncPropertyEntries","asyncComputeRealPropertyEntries","computedPropsFromHost","symbolForAsyncComputedPropsFromHost","isScript","props","constructAsyncProperties","src","rel","href","_window$PUBLIC_ROOT","prefix","window","PUBLIC_ROOT","attrs","loadScript","loadStyle","events","portal","iid","ref","usedProcessors","strictCollectMemberUsage","size","loadProcessorsImperatively","join","loadProperties","listenOnTrackingContext","registerBrickLifeCycle","expandedBrickConf","expandCustomTemplate","expandFormRenderer","childRuntimeContext","loadChildren","routeSlotIndexes","Set","entries","childSlotId","slotConf","flags","add","performIncrementalRender","location","homepage","pathname","matchHomepage","every","matchRoute","query","URLSearchParams","search","failed","incrementalOutput","reBailout","reMergeMenuRequests","result","reCatch","childrenOutput","has","child","isTrackAll","isPreEvaluated","getPreEvaluatedRaw","rows","i","j","flat","getDataStores","tplStateStoreMap","values","formStateStoreMap","stores","flushStableLoadBricks","waitForAll","menuConf","warn","rest","last","sibling","assign","originalSlots","newSlots","process","env","NODE_ENV","_child$slot","promise","name","unknownPolicy","catch","e"],"sources":["../../../src/internal/Renderer.ts"],"sourcesContent":["import type {\n BrickConf,\n BrickConfInTemplate,\n ContextConf,\n MenuConf,\n RouteConf,\n SlotConfOfBricks,\n SlotsConf,\n StaticMenuConf,\n} from \"@next-core/types\";\nimport {\n enqueueStableLoadBricks,\n flushStableLoadBricks,\n loadBricksImperatively,\n loadProcessorsImperatively,\n loadScript,\n loadStyle,\n} from \"@next-core/loader\";\nimport { isTrackAll } from \"@next-core/cook\";\nimport { hasOwnProperty } from \"@next-core/utils/general\";\nimport { strictCollectMemberUsage } from \"@next-core/utils/storyboard\";\nimport { debounce } from \"lodash\";\nimport { asyncCheckBrickIf } from \"./compute/checkIf.js\";\nimport {\n asyncComputeRealPropertyEntries,\n constructAsyncProperties,\n} from \"./compute/computeRealProperties.js\";\nimport { resolveData } from \"./data/resolveData.js\";\nimport { asyncComputeRealValue } from \"./compute/computeRealValue.js\";\nimport {\n TrackingContextItem,\n listenOnTrackingContext,\n} from \"./compute/listenOnTrackingContext.js\";\nimport { RendererContext } from \"./RendererContext.js\";\nimport { matchRoute, matchRoutes } from \"./matchRoutes.js\";\nimport {\n symbolForAsyncComputedPropsFromHost,\n symbolForTPlExternalForEachIndex,\n symbolForTPlExternalForEachItem,\n symbolForTplStateStoreId,\n} from \"./CustomTemplates/constants.js\";\nimport { expandCustomTemplate } from \"./CustomTemplates/expandCustomTemplate.js\";\nimport type {\n RenderBrick,\n RenderChildNode,\n RenderReturnNode,\n RuntimeBrickConfWithSymbols,\n RuntimeContext,\n} from \"./interfaces.js\";\nimport {\n getTagNameOfCustomTemplate,\n getTplStateStore,\n} from \"./CustomTemplates/utils.js\";\nimport { customTemplates } from \"../CustomTemplates.js\";\nimport type { NextHistoryState } from \"./historyExtended.js\";\nimport { getBrickPackages, hooks } from \"./Runtime.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { getTracks } from \"./compute/getTracks.js\";\nimport { isStrictMode, warnAboutStrictMode } from \"../isStrictMode.js\";\nimport {\n FORM_RENDERER,\n RuntimeBrickConfOfFormSymbols,\n symbolForFormStateStoreId,\n} from \"./FormRenderer/constants.js\";\nimport { expandFormRenderer } from \"./FormRenderer/expandFormRenderer.js\";\nimport { isPreEvaluated } from \"./compute/evaluate.js\";\nimport { getPreEvaluatedRaw } from \"./compute/evaluate.js\";\nimport { RuntimeBrickConfOfTplSymbols } from \"./CustomTemplates/constants.js\";\nimport { matchHomepage } from \"./matchStoryboard.js\";\nimport type { DataStore, DataStoreType } from \"./data/DataStore.js\";\nimport { listenerFactory } from \"./bindListeners.js\";\n\nexport interface RenderOutput {\n node?: RenderChildNode;\n unauthenticated?: boolean;\n redirect?: {\n path: string;\n state?: NextHistoryState;\n };\n route?: RouteConf;\n path?: string;\n blockingList: (Promise<unknown> | undefined)[];\n menuRequests: Promise<StaticMenuConf>[];\n hasTrackingControls?: boolean;\n}\n\nexport async function renderRoutes(\n returnNode: RenderReturnNode,\n routes: RouteConf[],\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId?: string,\n isIncremental?: boolean\n): Promise<RenderOutput> {\n const matched = await matchRoutes(routes, _runtimeContext);\n const output = getEmptyRenderOutput();\n switch (matched) {\n case \"missed\":\n break;\n case \"unauthenticated\":\n output.unauthenticated = true;\n break;\n default: {\n const route = (output.route = matched.route);\n output.path = matched.match.path;\n const runtimeContext = {\n ..._runtimeContext,\n match: matched.match,\n };\n if (isIncremental) {\n runtimeContext.ctxStore.disposeDataInRoutes(routes);\n }\n const routePath = parentRoutes.concat(route);\n runtimeContext.ctxStore.define(\n route.context,\n runtimeContext,\n undefined,\n routePath\n );\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n route,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n // Currently, this is only used for brick size-checking: these bricks\n // will be loaded before page rendering, but they will NOT be rendered.\n const { preLoadBricks } = route as { preLoadBricks?: string[] };\n if (Array.isArray(preLoadBricks)) {\n output.blockingList.push(\n loadBricksImperatively(preLoadBricks, getBrickPackages())\n );\n }\n\n if (route.type === \"redirect\") {\n let redirectTo: unknown;\n if (typeof route.redirect === \"string\") {\n redirectTo = await asyncComputeRealValue(\n route.redirect,\n runtimeContext\n );\n } else {\n const resolved = (await resolveData(\n {\n transform: \"redirect\",\n ...route.redirect,\n },\n runtimeContext\n )) as { redirect?: unknown };\n redirectTo = resolved.redirect;\n }\n if (typeof redirectTo !== \"string\") {\n // eslint-disable-next-line no-console\n console.error(\"Unexpected redirect result:\", redirectTo);\n throw new Error(\n `Unexpected type of redirect result: ${typeof redirectTo}`\n );\n }\n output.redirect = { path: redirectTo };\n } else {\n const menuRequest = loadMenu(route.menu, runtimeContext);\n if (menuRequest) {\n output.menuRequests.push(menuRequest);\n }\n\n if (route.type === \"routes\") {\n const newOutput = await renderRoutes(\n returnNode,\n route.routes,\n runtimeContext,\n rendererContext,\n routePath,\n slotId\n );\n mergeRenderOutput(output, newOutput);\n } else {\n const newOutput = await renderBricks(\n returnNode,\n route.bricks,\n runtimeContext,\n rendererContext,\n routePath,\n slotId\n );\n mergeRenderOutput(output, newOutput);\n }\n\n if (returnNode.tag === RenderTag.BRICK) {\n rendererContext.memoizeMenuRequests(route, output.menuRequests);\n }\n }\n }\n }\n\n return output;\n}\n\nexport async function renderBricks(\n returnNode: RenderReturnNode,\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId?: string,\n tplStack?: Map<string, number>,\n keyPath?: number[]\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n const kPath = keyPath ?? [];\n // 多个构件并行异步转换,但转换的结果按原顺序串行合并。\n const rendered = await Promise.all(\n bricks.map((brickConf, index) =>\n renderBrick(\n returnNode,\n brickConf,\n runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n kPath.concat(index),\n tplStack && new Map(tplStack)\n )\n )\n );\n\n rendered.forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n kPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport async function renderBrick(\n returnNode: RenderReturnNode,\n brickConf: RuntimeBrickConfWithSymbols,\n _runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId?: string,\n keyPath: number[] = [],\n tplStack = new Map<string, number>()\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n if (!brickConf.brick) {\n if ((brickConf as { template?: string }).template) {\n // eslint-disable-next-line no-console\n console.error(\"Legacy templates are dropped in v3:\", brickConf);\n } else {\n // eslint-disable-next-line no-console\n console.error(\"Invalid brick:\", brickConf);\n }\n return output;\n }\n\n // Translate `if: \"<%= ... %>\"` to `brick: \":if\", dataSource: \"<%= ... %>\"`.\n // In other words, translate tracking if expressions to tracking control nodes of `:if`.\n const { if: brickIf, permissionsPreCheck, ...restBrickConf } = brickConf;\n if (isGeneralizedTrackAll(brickIf)) {\n return renderBrick(\n returnNode,\n {\n brick: \":if\",\n dataSource: brickIf,\n // `permissionsPreCheck` maybe required before computing `if`.\n permissionsPreCheck,\n slots: {\n \"\": {\n type: \"bricks\",\n bricks: [restBrickConf],\n },\n },\n // These symbols have to be copied to the new brick conf.\n ...Object.getOwnPropertySymbols(brickConf).reduce(\n (acc, symbol) => ({\n ...acc,\n [symbol]: (brickConf as any)[symbol],\n }),\n {} as RuntimeBrickConfOfTplSymbols & RuntimeBrickConfOfFormSymbols\n ),\n },\n _runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n keyPath,\n tplStack\n );\n }\n\n const tplStateStoreId = brickConf[symbolForTplStateStoreId];\n const formStateStoreId = brickConf[symbolForFormStateStoreId];\n const runtimeContext = {\n ..._runtimeContext,\n tplStateStoreId,\n formStateStoreId,\n };\n\n if (hasOwnProperty(brickConf, symbolForTPlExternalForEachItem)) {\n // The external bricks of a template should restore their `forEachItem` and\n // `forEachIndex` from their host.\n runtimeContext.forEachItem = brickConf[symbolForTPlExternalForEachItem];\n runtimeContext.forEachIndex = brickConf[symbolForTPlExternalForEachIndex];\n }\n\n const { context } = brickConf as { context?: ContextConf[] };\n // istanbul ignore next\n if (Array.isArray(context) && context.length > 0) {\n const strict = isStrictMode(runtimeContext);\n warnAboutStrictMode(\n strict,\n \"Defining context on bricks\",\n \"check your brick:\",\n brickConf\n );\n if (!strict) {\n runtimeContext.ctxStore.define(context, runtimeContext);\n }\n }\n\n runtimeContext.pendingPermissionsPreCheck.push(\n hooks?.checkPermissions?.preCheckPermissionsForBrickOrRoute(\n brickConf,\n (value) => asyncComputeRealValue(value, runtimeContext)\n )\n );\n\n if (!(await asyncCheckBrickIf(brickConf, runtimeContext))) {\n return output;\n }\n\n const brickName = brickConf.brick;\n if (brickName.startsWith(\":\")) {\n ensureValidControlBrick(brickName);\n\n const { dataSource } = brickConf;\n\n const lowerLevelRenderControlNode = async (\n runtimeContext: RuntimeContext\n ) => {\n // First, compute the `dataSource`\n const computedDataSource = await asyncComputeRealValue(\n dataSource,\n runtimeContext\n );\n\n // Then, get the matched slot.\n const slot =\n brickName === \":forEach\"\n ? \"\"\n : brickName === \":switch\"\n ? String(computedDataSource)\n : computedDataSource\n ? \"\"\n : \"else\";\n\n // Don't forget to transpile children to slots.\n const slots = childrenToSlots(brickConf.children, brickConf.slots);\n\n // Then, get the bricks in that matched slot.\n const bricks =\n slots &&\n hasOwnProperty(slots, slot) &&\n (slots[slot] as SlotConfOfBricks)?.bricks;\n\n if (!Array.isArray(bricks)) {\n return getEmptyRenderOutput();\n }\n\n switch (brickName) {\n case \":forEach\": {\n if (!Array.isArray(computedDataSource)) {\n return getEmptyRenderOutput();\n }\n return renderForEach(\n returnNode,\n computedDataSource,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n tplStack,\n keyPath\n );\n }\n case \":if\":\n case \":switch\": {\n return renderBricks(\n returnNode,\n bricks,\n runtimeContext,\n rendererContext,\n parentRoutes,\n slotId,\n tplStack,\n keyPath\n );\n }\n }\n };\n\n const renderControlNode = async (runtimeContext: RuntimeContext) => {\n const rawOutput = await lowerLevelRenderControlNode(runtimeContext);\n rawOutput.node ??= {\n tag: RenderTag.PLACEHOLDER,\n return: returnNode,\n };\n return rawOutput;\n };\n\n const controlledOutput = await renderControlNode(runtimeContext);\n const { onMount, onUnmount } = brickConf.lifeCycle ?? {};\n\n const { contextNames, stateNames } = getTracks(dataSource);\n if (contextNames || stateNames) {\n controlledOutput.hasTrackingControls = true;\n let renderId = 0;\n const listener = async () => {\n const currentRenderId = ++renderId;\n const [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope] =\n createScopedRuntimeContext(runtimeContext);\n\n const reControlledOutput =\n await renderControlNode(scopedRuntimeContext);\n\n const scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n await postAsyncRender(\n reControlledOutput,\n scopedRuntimeContext,\n scopedStores\n );\n\n // Ignore stale renders\n if (renderId === currentRenderId) {\n if (onUnmount) {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: true } }));\n }\n\n rendererContext.reRender(\n slotId,\n keyPath,\n reControlledOutput.node,\n returnNode\n );\n\n if (onMount) {\n listenerFactory(\n onMount,\n scopedRuntimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: true } }));\n }\n\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n };\n const debouncedListener = debounce(listener);\n if (contextNames) {\n for (const contextName of contextNames) {\n runtimeContext.ctxStore.onChange(contextName, debouncedListener);\n }\n }\n if (stateNames) {\n for (const contextName of stateNames) {\n const tplStateStore = getTplStateStore(\n runtimeContext,\n \"STATE\",\n `: \"${dataSource}\"`\n );\n tplStateStore.onChange(contextName, debouncedListener);\n }\n }\n }\n\n if (onMount) {\n rendererContext.registerArbitraryLifeCycle(\"onMount\", () => {\n listenerFactory(\n onMount,\n runtimeContext\n )(new CustomEvent(\"mount\", { detail: { rerender: false } }));\n });\n }\n\n if (onUnmount) {\n rendererContext.registerArbitraryLifeCycle(\"onUnmount\", () => {\n listenerFactory(\n onUnmount,\n runtimeContext\n )(new CustomEvent(\"unmount\", { detail: { rerender: false } }));\n });\n }\n\n return controlledOutput;\n }\n\n // Widgets need to be defined before rendering.\n if (/\\.tpl-/.test(brickName) && !customTemplates.get(brickName)) {\n await catchLoad(\n loadBricksImperatively([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n );\n }\n\n const tplTagName = getTagNameOfCustomTemplate(\n brickName,\n runtimeContext.app?.id\n );\n\n if (tplTagName) {\n const tplCount = tplStack.get(tplTagName) ?? 0;\n if (tplCount >= 10) {\n throw new Error(\n `Maximum custom template stack overflowed: \"${tplTagName}\"`\n );\n }\n tplStack.set(tplTagName, tplCount + 1);\n } else if (brickName.includes(\"-\") && !customElements.get(brickName)) {\n if (brickName === FORM_RENDERER) {\n customElements.define(\n FORM_RENDERER,\n class FormRendererElement extends HTMLElement {\n get $$typeof(): string {\n return \"form-renderer\";\n }\n }\n );\n } else {\n output.blockingList.push(\n catchLoad(\n enqueueStableLoadBricks([brickName], getBrickPackages()),\n \"brick\",\n brickName,\n rendererContext.unknownBricks\n )\n );\n }\n }\n\n let formData: unknown;\n let confProps: Record<string, unknown> | undefined;\n if (brickName === FORM_RENDERER) {\n ({ formData, ...confProps } = brickConf.properties ?? {});\n } else {\n confProps = brickConf.properties;\n }\n\n const trackingContextList: TrackingContextItem[] = [];\n const asyncPropertyEntries = asyncComputeRealPropertyEntries(\n confProps,\n runtimeContext,\n trackingContextList\n );\n\n const computedPropsFromHost = brickConf[symbolForAsyncComputedPropsFromHost];\n if (computedPropsFromHost) {\n asyncPropertyEntries.push(...computedPropsFromHost);\n }\n\n const isScript = brickName === \"script\";\n if (isScript || brickName === \"link\") {\n const props = await constructAsyncProperties(asyncPropertyEntries);\n if (isScript ? props.src : props.rel === \"stylesheet\" && props.href) {\n const prefix = window.PUBLIC_ROOT ?? \"\";\n if (isScript) {\n const { src, ...attrs } = props;\n await catchLoad(\n loadScript(src as string, prefix, attrs),\n \"script\",\n src as string,\n \"silent\"\n );\n } else {\n const { href, ...attrs } = props;\n await catchLoad(\n loadStyle(href as string, prefix, attrs),\n \"stylesheet\",\n href as string,\n \"silent\"\n );\n }\n return output;\n }\n }\n\n const brick: RenderBrick = {\n tag: RenderTag.BRICK,\n type: tplTagName || brickName,\n return: returnNode,\n slotId,\n events: brickConf.events,\n runtimeContext,\n portal: brickConf.portal,\n iid: brickConf.iid,\n ref: (brickConf as BrickConfInTemplate).ref,\n };\n\n output.node = brick;\n\n // 在最终挂载前,先加载所有可能用到的 processors。\n const usedProcessors = strictCollectMemberUsage(\n [brickConf.events, brickConf.lifeCycle],\n \"PROCESSORS\",\n 2\n );\n if (usedProcessors.size > 0) {\n output.blockingList.push(\n catchLoad(\n loadProcessorsImperatively(usedProcessors, getBrickPackages()),\n \"processors\",\n [...usedProcessors].join(\", \"),\n rendererContext.unknownBricks\n )\n );\n }\n\n // 加载构件属性和加载子构件等任务,可以并行。\n const blockingList: Promise<unknown>[] = [];\n\n const loadProperties = async () => {\n brick.properties = await constructAsyncProperties(asyncPropertyEntries);\n listenOnTrackingContext(brick, trackingContextList);\n };\n blockingList.push(loadProperties());\n\n rendererContext.registerBrickLifeCycle(brick, brickConf.lifeCycle);\n\n let expandedBrickConf = brickConf;\n if (tplTagName) {\n expandedBrickConf = expandCustomTemplate(\n tplTagName,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n } else if (brickName === FORM_RENDERER) {\n expandedBrickConf = expandFormRenderer(\n formData,\n brickConf,\n brick,\n asyncPropertyEntries,\n rendererContext\n );\n }\n\n if (expandedBrickConf.portal) {\n // A portal brick has no slotId.\n brick.slotId = undefined;\n }\n\n let childRuntimeContext: RuntimeContext;\n if (tplTagName) {\n // There is a boundary for `forEachItem` between template internals and externals.\n childRuntimeContext = {\n ...runtimeContext,\n };\n delete childRuntimeContext.forEachItem;\n delete childRuntimeContext.forEachIndex;\n } else {\n childRuntimeContext = runtimeContext;\n }\n\n const loadChildren = async () => {\n const slots = childrenToSlots(\n expandedBrickConf.children,\n expandedBrickConf.slots\n );\n if (!slots) {\n return;\n }\n const routeSlotIndexes = new Set<number>();\n const rendered = await Promise.all(\n Object.entries(slots).map(([childSlotId, slotConf], index) => {\n if (slotConf.type !== \"routes\") {\n return renderBricks(\n brick,\n (slotConf as SlotConfOfBricks).bricks,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n childSlotId,\n tplStack\n );\n }\n\n if (runtimeContext.flags[\"incremental-sub-route-rendering\"]) {\n routeSlotIndexes.add(index);\n rendererContext.performIncrementalRender(async (location) => {\n const { homepage } = childRuntimeContext.app;\n const { pathname } = location;\n // Ignore if any one of homepage and parent routes not matched.\n if (\n !matchHomepage(homepage, pathname) ||\n !parentRoutes.every((route) =>\n matchRoute(route, homepage, pathname)\n )\n ) {\n return false;\n }\n\n const [\n scopedRuntimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n ] = createScopedRuntimeContext({\n ...childRuntimeContext,\n location,\n query: new URLSearchParams(location.search),\n });\n\n let failed = false;\n let incrementalOutput: RenderOutput;\n let scopedStores: DataStore<\"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n incrementalOutput = await renderRoutes(\n brick,\n slotConf.routes,\n scopedRuntimeContext,\n rendererContext,\n parentRoutes,\n childSlotId,\n true\n );\n\n // If all sub-routes are missed, ignore incremental rendering\n if (!incrementalOutput.route) {\n return false;\n }\n\n // Bailout if redirect or unauthenticated is set\n if (rendererContext.reBailout(incrementalOutput)) {\n return true;\n }\n\n scopedStores = [...tplStateStoreScope, ...formStateStoreScope];\n await postAsyncRender(incrementalOutput, scopedRuntimeContext, [\n scopedRuntimeContext.ctxStore,\n ...scopedStores,\n ]);\n\n await rendererContext.reMergeMenuRequests(\n slotConf.routes,\n incrementalOutput.route,\n incrementalOutput.menuRequests\n );\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Incremental sub-router failed:\", error);\n\n const result = rendererContext.reCatch(error, brick);\n if (!result) {\n return true;\n }\n ({ failed, output: incrementalOutput } = result);\n\n // Assert: no errors will be throw\n await rendererContext.reMergeMenuRequests(\n slotConf.routes,\n incrementalOutput.route,\n incrementalOutput.menuRequests\n );\n }\n\n rendererContext.reRender(\n childSlotId,\n [],\n incrementalOutput.node,\n brick\n );\n\n if (!failed) {\n scopedRuntimeContext.ctxStore.mountAsyncData(\n incrementalOutput.route\n );\n for (const store of scopedStores) {\n store.mountAsyncData();\n }\n }\n\n return true;\n });\n }\n\n return renderRoutes(\n brick,\n slotConf.routes,\n childRuntimeContext,\n rendererContext,\n parentRoutes,\n childSlotId\n );\n })\n );\n\n const childrenOutput: RenderOutput = {\n ...output,\n node: undefined,\n blockingList: [],\n menuRequests: [],\n };\n rendered.forEach((item, index) => {\n if (routeSlotIndexes.has(index)) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(slotId, [], item.node, brick);\n }\n mergeRenderOutput(childrenOutput, item);\n });\n if (childrenOutput.node) {\n brick.child = childrenOutput.node;\n }\n mergeRenderOutput(output, {\n ...childrenOutput,\n node: undefined,\n });\n };\n blockingList.push(loadChildren());\n\n await Promise.all(blockingList);\n\n return output;\n}\n\nfunction isGeneralizedTrackAll(brickIf: unknown): boolean {\n return typeof brickIf === \"string\"\n ? isTrackAll(brickIf)\n : isPreEvaluated(brickIf) &&\n // istanbul ignore next: covered by e2e tests\n isTrackAll(getPreEvaluatedRaw(brickIf));\n}\n\ntype ValidControlBrick = \":forEach\" | \":if\" | \":switch\";\n\nfunction ensureValidControlBrick(\n brick: string\n): asserts brick is ValidControlBrick {\n if (brick !== \":forEach\" && brick !== \":if\" && brick !== \":switch\") {\n throw new Error(`Unknown storyboard control node: \"${brick}\"`);\n }\n}\n\nasync function renderForEach(\n returnNode: RenderReturnNode,\n dataSource: unknown[],\n bricks: BrickConf[],\n runtimeContext: RuntimeContext,\n rendererContext: RendererContext,\n parentRoutes: RouteConf[],\n slotId: string | undefined,\n tplStack: Map<string, number>,\n keyPath: number[]\n): Promise<RenderOutput> {\n const output = getEmptyRenderOutput();\n\n const rows = dataSource.length;\n const rendered = await Promise.all(\n dataSource.map((item, i) =>\n Promise.all(\n bricks.map((brickConf, j) =>\n renderBrick(\n returnNode,\n brickConf,\n {\n ...runtimeContext,\n forEachItem: item,\n forEachIndex: i,\n },\n rendererContext,\n parentRoutes,\n slotId,\n keyPath.concat(i * rows + j),\n tplStack && new Map(tplStack)\n )\n )\n )\n )\n );\n\n // 多层构件并行异步转换,但转换的结果按原顺序串行合并。\n rendered.flat().forEach((item, index) => {\n if (item.hasTrackingControls) {\n // Memoize a render node before it's been merged.\n rendererContext.memoize(\n slotId,\n keyPath.concat(index),\n item.node,\n returnNode\n );\n }\n mergeRenderOutput(output, item);\n });\n\n return output;\n}\n\nexport function getDataStores(runtimeContext: RuntimeContext) {\n return [\n runtimeContext.ctxStore,\n ...runtimeContext.tplStateStoreMap.values(),\n ...runtimeContext.formStateStoreMap.values(),\n ];\n}\n\nexport function postAsyncRender(\n output: RenderOutput,\n runtimeContext: RuntimeContext,\n stores: DataStore<DataStoreType>[]\n) {\n flushStableLoadBricks();\n\n return Promise.all([\n ...output.blockingList,\n ...stores.map((store) => store.waitForAll()),\n ...runtimeContext.pendingPermissionsPreCheck,\n ]);\n}\n\nexport function createScopedRuntimeContext(\n runtimeContext: RuntimeContext\n): [\n scopedRuntimeContext: RuntimeContext,\n tplStateStoreScope: DataStore<\"STATE\">[],\n formStateStoreScope: DataStore<\"FORM_STATE\">[],\n] {\n const tplStateStoreScope: DataStore<\"STATE\">[] = [];\n const formStateStoreScope: DataStore<\"FORM_STATE\">[] = [];\n const scopedRuntimeContext: RuntimeContext = {\n ...runtimeContext,\n tplStateStoreScope,\n formStateStoreScope,\n };\n return [scopedRuntimeContext, tplStateStoreScope, formStateStoreScope];\n}\n\nfunction loadMenu(\n menuConf: MenuConf | undefined,\n runtimeContext: RuntimeContext\n) {\n if (!menuConf) {\n return;\n }\n\n // istanbul ignore next\n if ((menuConf as { type?: \"brick\" }).type === \"brick\") {\n // eslint-disable-next-line no-console\n console.error(\"Set menu with brick is dropped in v3:\", menuConf);\n throw new Error(\"Set menu with brick is dropped in v3\");\n }\n\n // istanbul ignore next\n if (menuConf.type === \"resolve\") {\n // eslint-disable-next-line no-console\n console.warn(\"Set menu with resolve is not supported in v3 yet:\", menuConf);\n return;\n }\n\n return asyncComputeRealValue(\n menuConf,\n runtimeContext\n ) as Promise<StaticMenuConf>;\n}\n\nfunction mergeRenderOutput(\n output: RenderOutput,\n newOutput: RenderOutput\n): void {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { blockingList, node, menuRequests, hasTrackingControls, ...rest } =\n newOutput;\n output.blockingList.push(...blockingList);\n output.menuRequests.push(...menuRequests);\n\n if (node) {\n if (output.node) {\n let last = output.node;\n while (last.sibling) {\n last = last.sibling;\n }\n last.sibling = node;\n } else {\n output.node = node;\n }\n }\n\n Object.assign(output, rest);\n}\n\nfunction getEmptyRenderOutput(): RenderOutput {\n return {\n blockingList: [],\n menuRequests: [],\n };\n}\n\nexport function childrenToSlots(\n children: BrickConf[] | undefined,\n originalSlots: SlotsConf | undefined\n) {\n let newSlots = originalSlots;\n // istanbul ignore next\n if (\n process.env.NODE_ENV === \"development\" &&\n children &&\n !Array.isArray(children)\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n \"Specified brick children but not array:\",\n `<${typeof children}>`,\n children\n );\n }\n if (Array.isArray(children) && !newSlots) {\n newSlots = {};\n for (const child of children) {\n const slot = child.slot ?? \"\";\n if (!hasOwnProperty(newSlots, slot)) {\n newSlots[slot] = {\n type: \"bricks\",\n bricks: [],\n };\n }\n (newSlots[slot] as SlotConfOfBricks).bricks.push(child);\n }\n }\n return newSlots;\n}\n\nfunction catchLoad(\n promise: Promise<unknown>,\n type: \"brick\" | \"processors\" | \"script\" | \"stylesheet\",\n name: string,\n unknownPolicy: RendererContext[\"unknownBricks\"]\n) {\n return unknownPolicy === \"silent\"\n ? promise.catch((e) => {\n // eslint-disable-next-line no-console\n console.error(`Load ${type} \"${name}\" failed:`, e);\n })\n : promise;\n}\n"],"mappings":";;;;;;;;;;;;AAUA,IAAAA,OAAA,GAAAC,OAAA;AAQA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AACA,IAAAM,sBAAA,GAAAN,OAAA;AAIA,IAAAO,YAAA,GAAAP,OAAA;AACA,IAAAQ,iBAAA,GAAAR,OAAA;AACA,IAAAS,wBAAA,GAAAT,OAAA;AAKA,IAAAU,YAAA,GAAAV,OAAA;AACA,IAAAW,UAAA,GAAAX,OAAA;AAMA,IAAAY,qBAAA,GAAAZ,OAAA;AAQA,IAAAa,MAAA,GAAAb,OAAA;AAIA,IAAAc,gBAAA,GAAAd,OAAA;AAEA,IAAAe,QAAA,GAAAf,OAAA;AACA,IAAAgB,MAAA,GAAAhB,OAAA;AACA,IAAAiB,UAAA,GAAAjB,OAAA;AACA,IAAAkB,aAAA,GAAAlB,OAAA;AACA,IAAAmB,WAAA,GAAAnB,OAAA;AAKA,IAAAoB,mBAAA,GAAApB,OAAA;AACA,IAAAqB,SAAA,GAAArB,OAAA;AAGA,IAAAsB,gBAAA,GAAAtB,OAAA;AAEA,IAAAuB,cAAA,GAAAvB,OAAA;AAgBO,eAAewB,YAAYA,CAChCC,UAA4B,EAC5BC,MAAmB,EACnBC,eAA+B,EAC/BC,eAAgC,EAChCC,YAAyB,EACzBC,MAAe,EACfC,aAAuB,EACA;EACvB,MAAMC,OAAO,GAAG,MAAM,IAAAC,wBAAW,EAACP,MAAM,EAAEC,eAAe,CA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AEC,CAAC,IAAK;IACnB;IACA/N,OAAO,CAACC,KAAK,CAAE,QAAOP,IAAK,KAAIkO,IAAK,WAAU,EAAEG,CAAC,CAAC;EACpD,CAAC,CAAC,GACFJ,OAAO;AACb"}
@@ -251,14 +251,16 @@ async function _queuedRender2(location) {
251
251
  }
252
252
  }
253
253
  async function _render2(location) {
254
- var _hooks$flowApi, _classPrivateFieldGet6;
254
+ var _hooks$flowApi, _hooks$pageView, _classPrivateFieldGet6;
255
255
  (0, _classPrivateFieldSet2.default)(this, _renderId, (0, _lodash.uniqueId)("render-id-1"));
256
256
  (0, _markAsComputed.resetAllComputedMarks)();
257
257
  (0, _resolveData.clearResolveCache)();
258
258
  _Runtime.hooks === null || _Runtime.hooks === void 0 || (_hooks$flowApi = _Runtime.hooks.flowApi) === null || _hooks$flowApi === void 0 || _hooks$flowApi.clearCollectWidgetContract();
259
259
  const history = (0, _history3.getHistory)();
260
260
  history.unblock();
261
- const renderStartTime = performance.now();
261
+
262
+ // const renderStartTime = performance.now();
263
+ const finishPageView = _Runtime.hooks === null || _Runtime.hooks === void 0 || (_hooks$pageView = _Runtime.hooks.pageView) === null || _hooks$pageView === void 0 ? void 0 : _hooks$pageView.create();
262
264
  const storyboard = (0, _matchStoryboard.matchStoryboard)((0, _classPrivateFieldGet7.default)(this, _storyboards), location.pathname);
263
265
  const previousApp = (_classPrivateFieldGet6 = (0, _classPrivateFieldGet7.default)(this, _runtimeContext)) === null || _classPrivateFieldGet6 === void 0 ? void 0 : _classPrivateFieldGet6.app;
264
266
  if (storyboard !== null && storyboard !== void 0 && storyboard.app) {
@@ -275,6 +277,9 @@ async function _render2(location) {
275
277
  const flags = (0, _Runtime.getRuntime)().getFeatureFlags();
276
278
  const prevRendererContext = (0, _classPrivateFieldGet7.default)(this, _rendererContext);
277
279
  const redirectTo = (to, state) => {
280
+ finishPageView === null || finishPageView === void 0 || finishPageView({
281
+ status: "redirected"
282
+ });
278
283
  (0, _classPrivateFieldGet7.default)(this, _rendererContextTrashCan).add(prevRendererContext);
279
284
  (0, _classPrivateMethodGet2.default)(this, _safeRedirect, _safeRedirect2).call(this, to, state, location);
280
285
  };
@@ -444,13 +449,16 @@ async function _render2(location) {
444
449
  for (const store of stores) {
445
450
  store.mountAsyncData();
446
451
  }
452
+ finishPageView === null || finishPageView === void 0 || finishPageView({
453
+ status: "ok",
454
+ path: output.path,
455
+ pageTitle: document.title
456
+ });
457
+ } else {
458
+ finishPageView === null || finishPageView === void 0 || finishPageView({
459
+ status: "failed"
460
+ });
447
461
  }
448
- const renderTime = performance.now() - renderStartTime;
449
- window.dispatchEvent(new CustomEvent("route.render", {
450
- detail: {
451
- renderTime
452
- }
453
- }));
454
462
  return;
455
463
  }
456
464
  } else if (!window.NO_AUTH_GUARD && _Runtime.hooks !== null && _Runtime.hooks !== void 0 && _Runtime.hooks.auth && !_Runtime.hooks.auth.isLoggedIn()) {
@@ -477,6 +485,9 @@ async function _render2(location) {
477
485
 
478
486
  // Scroll to top after each rendering.
479
487
  window.scrollTo(0, 0);
488
+ finishPageView === null || finishPageView === void 0 || finishPageView({
489
+ status: "not-found"
490
+ });
480
491
  }
481
492
  function mergeMenuConfs(menuConfs) {
482
493
  const navConfig = {
@@ -1 +1 @@
1
- {"version":3,"file":"Router.js","names":["_history2","require","_http","_lodash","_history3","_Renderer","_DataStore","_resolveData","_mount","_matchStoryboard","_StoryboardFunctions","_RendererContext","_themeAndMode","_Runtime","_getPageInfo","_markAsComputed","_handleHttpError","_abortController","_registerCustomTemplates","_fulfilStoryboard","_enums","_insertPreviewRoutes","_storyboards","WeakMap","_rendering","_prevLocation","_nextLocation","_runtimeContext","_rendererContext","_rendererContextTrashCan","_redirectCount","_renderId","_currentApp","_previousApp","_navConfig","_getBlockMessageBeforePageLave","WeakSet","_safeRedirect","_queuedRender","_render","Router","constructor","storyboards","_classPrivateMethodInitSpec2","default","_classPrivateFieldInitSpec2","writable","value","Set","_classPrivateFieldSet2","history","getHistory","window","addEventListener","event","message","_classPrivateMethodGet2","_getBlockMessageBeforePageLave2","call","preventDefault","returnValue","block","location","action","getRenderId","_classPrivateFieldGet7","getRuntimeContext","getRecentApps","currentApp","previousApp","getNavConfig","bootstrap","initAbortController","renderId","listen","_classPrivateFieldGet2","_location$state","_classPrivateFieldGet4","currentRenderId","ignoreRendering","omittedLocationProps","hash","undefined","state","key","notify","locationsAreEqual","_classPrivateFieldGet3","didPerformIncrementalRender","abortPendingRequest","dispatchPageLeave","storyboard","matchStoryboard","pathname","isOutsideApp","reload","_queuedRender2","catch","handleHttpError","exports","detail","_classPrivateFieldGet5","previousMessage","getBlockMessage","dispatchBeforePageLeave","unblock","_safeRedirect2","to","from","_this$redirectCount","_this$redirectCount2","search","process","env","NODE_ENV","console","error","Error","replace","_render2","nextLocation","_hooks$flowApi","_classPrivateFieldGet6","uniqueId","resetAllComputedMarks","clearResolveCache","hooks","flowApi","clearCollectWidgetContract","renderStartTime","performance","now","app","fulfilStoryboard","appChanged","id","flags","getRuntime","getFeatureFlags","prevRendererContext","redirectTo","add","redirectToLogin","main","document","querySelector","portal","renderRoot","tag","RenderTag","ROOT","container","createPortal","cleanUpPreviousRender","_hooks$messageDispatc","unmountTree","item","dispatchOnUnmount","dispose","clear","messageDispatcher","reset","dispatchEvent","CustomEvent","setTheme","getLocalAppsTheme","theme","setMode","_hooks$checkInstalled","_hooks$auth","_hooks$checkPermissio","_storyboard$meta","_hooks$flowApi2","_storyboard$meta2","checkInstalledApps","preCheckInstalledApps","appId","_internalApiGetAppInBootstrapData","routeHelper","bailout","output","unauthenticated","redirect","path","mergeMenus","menuRequests","menuConfs","Promise","all","mergeMenuConfs","returnNode","isUnauthenticatedError","NO_AUTH_GUARD","HttpAbortError","noAuthGuardLoginPath","getMiscSettings","failed","node","BRICK","type","properties","textContent","httpErrorToString","runtimeContext","return","blockingList","rendererContext","RendererContext","query","URLSearchParams","sys","auth","getAuth","getPageInfo","settings","brand","getBrandSettings","ctxStore","DataStore","pendingPermissionsPreCheck","checkPermissions","preCheckPermissions","tplStateStoreMap","Map","formStateStoreMap","registerCustomTemplates","registerStoryboardFunctions","meta","functions","collectContract","contracts","stores","renderRoutes","insertPreviewRoutes","routes","getDataStores","postAsyncRender","setInitialMenuRequests","result","child","route","dispatchBeforePageLoad","applyTheme","applyMode","mountTree","scrollTo","dispatchPageLoad","dispatchAnchorLoad","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","renderTime","isLoggedIn","navConfig","breadcrumb","menuConf","overwrite","items","push"],"sources":["../../../src/internal/Router.ts"],"sourcesContent":["import { Action, locationsAreEqual } from \"history\";\nimport type {\n BreadcrumbItemConf,\n MicroApp,\n StaticMenuConf,\n Storyboard,\n} from \"@next-core/types\";\nimport { HttpAbortError } from \"@next-core/http\";\nimport { uniqueId } from \"lodash\";\nimport { NextHistoryState, NextLocation, getHistory } from \"../history.js\";\nimport {\n RenderOutput,\n getDataStores,\n postAsyncRender,\n renderRoutes,\n} from \"./Renderer.js\";\nimport { DataStore } from \"./data/DataStore.js\";\nimport { clearResolveCache } from \"./data/resolveData.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { isOutsideApp, matchStoryboard } from \"./matchStoryboard.js\";\nimport { registerStoryboardFunctions } from \"./compute/StoryboardFunctions.js\";\nimport { RendererContext, RouteHelper } from \"./RendererContext.js\";\nimport {\n applyMode,\n applyTheme,\n getLocalAppsTheme,\n setMode,\n setTheme,\n} from \"../themeAndMode.js\";\nimport {\n _internalApiGetAppInBootstrapData,\n getRuntime,\n hooks,\n} from \"./Runtime.js\";\nimport { getPageInfo } from \"../getPageInfo.js\";\nimport type { RenderBrick, RenderRoot, RuntimeContext } from \"./interfaces.js\";\nimport { resetAllComputedMarks } from \"./compute/markAsComputed.js\";\nimport {\n handleHttpError,\n httpErrorToString,\n isUnauthenticatedError,\n} from \"../handleHttpError.js\";\nimport { abortPendingRequest, initAbortController } from \"./abortController.js\";\nimport { registerCustomTemplates } from \"./registerCustomTemplates.js\";\nimport { fulfilStoryboard } from \"./fulfilStoryboard.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { insertPreviewRoutes } from \"./insertPreviewRoutes.js\";\n\nexport class Router {\n readonly #storyboards: Storyboard[];\n #rendering = false;\n #prevLocation!: NextLocation;\n #nextLocation?: NextLocation;\n #runtimeContext?: RuntimeContext;\n #rendererContext?: RendererContext;\n #rendererContextTrashCan = new Set<RendererContext | undefined>();\n #redirectCount = 0;\n #renderId?: string;\n #currentApp?: MicroApp;\n #previousApp?: MicroApp;\n #navConfig?: {\n breadcrumb?: BreadcrumbItemConf[];\n };\n\n constructor(storyboards: Storyboard[]) {\n this.#storyboards = storyboards;\n\n const history = getHistory();\n window.addEventListener(\"beforeunload\", (event) => {\n const message = this.#getBlockMessageBeforePageLave({});\n // See examples in https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload\n if (message) {\n // Cancel the event\n // If you prevent default behavior in Mozilla Firefox prompt will always be shown\n event.preventDefault();\n // Chrome requires returnValue to be set\n event.returnValue = \"\";\n } else {\n // the absence of a returnValue property on the event will guarantee the browser unload happens\n delete event.returnValue;\n }\n });\n\n history.block((location, action) =>\n this.#getBlockMessageBeforePageLave({ location, action })\n );\n }\n\n getRenderId() {\n return this.#renderId;\n }\n\n getRuntimeContext() {\n return this.#runtimeContext;\n }\n\n getRecentApps() {\n return {\n currentApp: this.#currentApp,\n previousApp: this.#previousApp,\n };\n }\n\n getNavConfig() {\n return this.#navConfig;\n }\n\n #getBlockMessageBeforePageLave(detail: {\n location?: NextLocation;\n action?: Action;\n }): string | undefined {\n const history = getHistory();\n const previousMessage = history.getBlockMessage();\n this.#rendererContext?.dispatchBeforePageLeave(detail);\n const message = history.getBlockMessage();\n if (!previousMessage && message) {\n // Auto unblock only if new block was introduced by `onBeforePageLeave`.\n history.unblock();\n }\n return message;\n }\n\n #safeRedirect(\n to: string,\n state: NextHistoryState | undefined,\n from: NextLocation\n ): void {\n if (this.#redirectCount++ > 10) {\n const message = `Infinite redirect detected: from \"${from.pathname}${from.search}${from.hash}\" to \"${to}\"`;\n // istanbul ignore else: error cannot be caught in test\n if (process.env.NODE_ENV === \"test\") {\n // eslint-disable-next-line no-console\n console.error(message);\n return;\n } else {\n throw new Error(message);\n }\n }\n getHistory().replace(to, state);\n }\n\n bootstrap() {\n initAbortController();\n const history = getHistory();\n this.#prevLocation = history.location;\n let renderId = 0;\n history.listen(async (location, action) => {\n const currentRenderId = ++renderId;\n let ignoreRendering: boolean | undefined;\n const omittedLocationProps: Partial<NextLocation> = {\n hash: undefined,\n state: undefined,\n };\n // Omit the \"key\" when checking whether locations are equal in certain situations.\n if (\n // When current location is triggered by browser action of hash link.\n location.key === undefined ||\n // When current location is triggered by browser action of non-push-or-replace,\n // such as goBack or goForward,\n (action === \"POP\" &&\n // and the previous location was triggered by hash link,\n (this.#prevLocation.key === undefined ||\n // or the previous location specified notify false.\n this.#prevLocation.state?.notify === false))\n ) {\n omittedLocationProps.key = undefined;\n }\n if (\n locationsAreEqual(\n { ...this.#prevLocation, ...omittedLocationProps },\n { ...location, ...omittedLocationProps }\n ) ||\n (action !== \"POP\" && location.state?.notify === false)\n ) {\n // Ignore rendering if location not changed except hash, state and optional key.\n // Ignore rendering if notify is `false`.\n ignoreRendering = true;\n }\n\n if (!ignoreRendering) {\n ignoreRendering =\n await this.#rendererContext?.didPerformIncrementalRender(location);\n }\n\n // Ignore stale renders\n if (renderId !== currentRenderId) {\n return;\n }\n\n if (ignoreRendering) {\n this.#prevLocation = location;\n return;\n }\n\n abortPendingRequest();\n this.#prevLocation = location;\n this.#rendererContext?.dispatchPageLeave();\n\n if (action === \"POP\") {\n const storyboard = matchStoryboard(\n this.#storyboards,\n location.pathname\n );\n // When a browser action of goBack or goForward is performing,\n // force reload when the target page is a page of an outside app.\n if (isOutsideApp(storyboard)) {\n window.location.reload();\n return;\n }\n }\n\n if (this.#rendering) {\n this.#nextLocation = location;\n } else {\n // devtoolsHookEmit(\"locationChange\");\n this.#queuedRender(location).catch(handleHttpError);\n }\n });\n return this.#queuedRender(history.location);\n }\n\n async #queuedRender(location: NextLocation): Promise<void> {\n this.#rendering = true;\n try {\n await this.#render(location);\n } finally {\n this.#rendering = false;\n if (this.#nextLocation) {\n const nextLocation = this.#nextLocation;\n this.#nextLocation = undefined;\n await this.#queuedRender(nextLocation);\n }\n }\n }\n\n async #render(location: NextLocation): Promise<void> {\n this.#renderId = uniqueId(\"render-id-1\");\n\n resetAllComputedMarks();\n clearResolveCache();\n hooks?.flowApi?.clearCollectWidgetContract();\n\n const history = getHistory();\n history.unblock();\n\n const renderStartTime = performance.now();\n\n const storyboard = matchStoryboard(this.#storyboards, location.pathname);\n\n const previousApp = this.#runtimeContext?.app;\n if (storyboard?.app) {\n await fulfilStoryboard(storyboard);\n }\n const currentApp = (this.#currentApp = storyboard?.app);\n\n // Storyboard maybe re-assigned, e.g. when open launchpad.\n const appChanged =\n previousApp && currentApp\n ? previousApp.id !== currentApp.id\n : previousApp !== currentApp;\n\n // TODO: handle favicon\n\n // Set `Router::#currentApp` before calling `getFeatureFlags()`\n const flags = getRuntime().getFeatureFlags();\n const prevRendererContext = this.#rendererContext;\n\n const redirectTo = (to: string, state?: NextHistoryState): void => {\n this.#rendererContextTrashCan.add(prevRendererContext);\n this.#safeRedirect(to, state, location);\n };\n\n const redirectToLogin = (): void => {\n const to = flags[\"sso-enabled\"] ? \"/sso-auth/login\" : \"/auth/login\";\n redirectTo(to, { from: location });\n };\n\n const main = document.querySelector(\"#main-mount-point\") as HTMLElement;\n const portal = document.querySelector(\"#portal-mount-point\") as HTMLElement;\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n container: main,\n createPortal: portal,\n };\n\n const cleanUpPreviousRender = (): void => {\n unmountTree(main);\n unmountTree(portal);\n\n // Note: redirects can lead to multiple trash renderer contexts.\n this.#rendererContextTrashCan.add(prevRendererContext);\n for (const item of this.#rendererContextTrashCan) {\n if (item) {\n item.dispatchOnUnmount();\n item.dispose();\n }\n }\n this.#rendererContextTrashCan.clear();\n hooks?.messageDispatcher?.reset();\n\n if (appChanged) {\n this.#previousApp = previousApp;\n window.dispatchEvent(\n new CustomEvent(\"app.change\", {\n detail: {\n previousApp,\n currentApp,\n },\n })\n );\n }\n };\n\n setTheme(\n (currentApp &&\n (getLocalAppsTheme()[currentApp.id] || currentApp.theme)) ||\n \"light\"\n );\n setMode(\"default\");\n\n if (currentApp) {\n hooks?.checkInstalledApps?.preCheckInstalledApps(\n storyboard,\n (appId) => !!_internalApiGetAppInBootstrapData(appId)\n );\n\n const routeHelper: RouteHelper = {\n bailout: (output) => {\n if (output.unauthenticated) {\n redirectToLogin();\n return true;\n }\n if (output.redirect) {\n redirectTo(output.redirect.path, output.redirect.state);\n return true;\n }\n // Reset redirect count if no redirect is set.\n this.#redirectCount = 0;\n },\n mergeMenus: async (menuRequests) => {\n const menuConfs = await Promise.all(menuRequests);\n this.#navConfig = mergeMenuConfs(menuConfs);\n },\n catch: (error, returnNode) => {\n if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {\n redirectToLogin();\n return;\n } else if (error instanceof HttpAbortError) {\n this.#rendererContextTrashCan.add(prevRendererContext);\n return;\n } else {\n const noAuthGuardLoginPath =\n getRuntime().getMiscSettings().noAuthGuardLoginPath;\n if (isUnauthenticatedError(error) && noAuthGuardLoginPath) {\n redirectTo(noAuthGuardLoginPath as string, { from: location });\n return;\n }\n return {\n failed: true,\n output: {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n menuRequests: [],\n },\n };\n }\n },\n };\n\n const rendererContext = (this.#rendererContext = new RendererContext(\n \"page\",\n { routeHelper }\n ));\n\n const runtimeContext: RuntimeContext = (this.#runtimeContext = {\n app: currentApp,\n location,\n query: new URLSearchParams(location.search),\n flags,\n sys: {\n ...hooks?.auth?.getAuth(),\n ...getPageInfo(),\n settings: {\n brand: getRuntime().getBrandSettings(),\n },\n },\n ctxStore: new DataStore(\"CTX\", undefined, rendererContext),\n pendingPermissionsPreCheck: [\n hooks?.checkPermissions?.preCheckPermissions(storyboard),\n ],\n tplStateStoreMap: new Map<string, DataStore<\"STATE\">>(),\n formStateStoreMap: new Map<string, DataStore<\"FORM_STATE\">>(),\n });\n\n this.#navConfig = undefined;\n\n registerCustomTemplates(storyboard);\n registerStoryboardFunctions(storyboard.meta?.functions, currentApp);\n hooks?.flowApi?.collectContract(storyboard.meta?.contracts);\n\n let failed = false;\n let output: RenderOutput;\n let stores: DataStore<\"CTX\" | \"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n output = await renderRoutes(\n renderRoot,\n insertPreviewRoutes(storyboard.routes),\n runtimeContext,\n rendererContext,\n []\n );\n if (routeHelper.bailout(output)) {\n return;\n }\n\n stores = getDataStores(runtimeContext);\n\n await postAsyncRender(output, runtimeContext, stores);\n\n await routeHelper.mergeMenus(output.menuRequests);\n rendererContext.setInitialMenuRequests(output.menuRequests);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Router failed:\", error);\n\n const result = routeHelper.catch(error, renderRoot);\n if (!result) {\n return;\n }\n ({ failed, output } = result);\n }\n renderRoot.child = output.node;\n\n cleanUpPreviousRender();\n\n if ((output.route && output.route.type !== \"routes\") || failed) {\n if (!failed) {\n // There is a window to set theme and mode by `lifeCycle.onBeforePageLoad`.\n rendererContext.dispatchBeforePageLoad();\n }\n applyTheme();\n applyMode();\n\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n // See https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md\n window.scrollTo(0, 0);\n\n if (!failed) {\n rendererContext.dispatchPageLoad();\n rendererContext.dispatchAnchorLoad();\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of stores) {\n store.mountAsyncData();\n }\n }\n\n const renderTime = performance.now() - renderStartTime;\n window.dispatchEvent(\n new CustomEvent(\"route.render\", {\n detail: {\n renderTime,\n },\n })\n );\n\n return;\n }\n } else if (\n !window.NO_AUTH_GUARD &&\n hooks?.auth &&\n !hooks.auth.isLoggedIn()\n ) {\n // Todo(steve): refine after api-gateway supports fetching storyboards before logged in.\n // Redirect to login if no storyboard is matched.\n redirectToLogin();\n return;\n } else {\n cleanUpPreviousRender();\n }\n\n applyTheme();\n applyMode();\n\n const node: RenderBrick = {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: \"Page not found\",\n },\n runtimeContext: null!,\n return: renderRoot,\n };\n renderRoot.child = node;\n\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n window.scrollTo(0, 0);\n }\n}\n\nfunction mergeMenuConfs(menuConfs: StaticMenuConf[]) {\n const navConfig = {\n breadcrumb: [] as BreadcrumbItemConf[],\n };\n for (const menuConf of menuConfs) {\n const { breadcrumb } = menuConf;\n if (breadcrumb) {\n if (breadcrumb.overwrite) {\n navConfig.breadcrumb = breadcrumb.items;\n } else {\n navConfig.breadcrumb.push(...breadcrumb.items);\n }\n }\n }\n return navConfig;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAMA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA;AACA,IAAAS,oBAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAOA,IAAAY,QAAA,GAAAZ,OAAA;AAKA,IAAAa,YAAA,GAAAb,OAAA;AAEA,IAAAc,eAAA,GAAAd,OA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AACC,UAAU,CAACI,IAAI,CAAC,GAAGJ,UAAU,CAACG,KAAK,CAAC;MAChD;IACF;EACF;EACA,OAAOJ,SAAS;AAClB"}
1
+ {"version":3,"file":"Router.js","names":["_history2","require","_http","_lodash","_history3","_Renderer","_DataStore","_resolveData","_mount","_matchStoryboard","_StoryboardFunctions","_RendererContext","_themeAndMode","_Runtime","_getPageInfo","_markAsComputed","_handleHttpError","_abortController","_registerCustomTemplates","_fulfilStoryboard","_enums","_insertPreviewRoutes","_storyboards","WeakMap","_rendering","_prevLocation","_nextLocation","_runtimeContext","_rendererContext","_rendererContextTrashCan","_redirectCount","_renderId","_currentApp","_previousApp","_navConfig","_getBlockMessageBeforePageLave","WeakSet","_safeRedirect","_queuedRender","_render","Router","constructor","storyboards","_classPrivateMethodInitSpec2","default","_classPrivateFieldInitSpec2","writable","value","Set","_classPrivateFieldSet2","history","getHistory","window","addEventListener","event","message","_classPrivateMethodGet2","_getBlockMessageBeforePageLave2","call","preventDefault","returnValue","block","location","action","getRenderId","_classPrivateFieldGet7","getRuntimeContext","getRecentApps","currentApp","previousApp","getNavConfig","bootstrap","initAbortController","renderId","listen","_classPrivateFieldGet2","_location$state","_classPrivateFieldGet4","currentRenderId","ignoreRendering","omittedLocationProps","hash","undefined","state","key","notify","locationsAreEqual","_classPrivateFieldGet3","didPerformIncrementalRender","abortPendingRequest","dispatchPageLeave","storyboard","matchStoryboard","pathname","isOutsideApp","reload","_queuedRender2","catch","handleHttpError","exports","detail","_classPrivateFieldGet5","previousMessage","getBlockMessage","dispatchBeforePageLeave","unblock","_safeRedirect2","to","from","_this$redirectCount","_this$redirectCount2","search","process","env","NODE_ENV","console","error","Error","replace","_render2","nextLocation","_hooks$flowApi","_hooks$pageView","_classPrivateFieldGet6","uniqueId","resetAllComputedMarks","clearResolveCache","hooks","flowApi","clearCollectWidgetContract","finishPageView","pageView","create","app","fulfilStoryboard","appChanged","id","flags","getRuntime","getFeatureFlags","prevRendererContext","redirectTo","status","add","redirectToLogin","main","document","querySelector","portal","renderRoot","tag","RenderTag","ROOT","container","createPortal","cleanUpPreviousRender","_hooks$messageDispatc","unmountTree","item","dispatchOnUnmount","dispose","clear","messageDispatcher","reset","dispatchEvent","CustomEvent","setTheme","getLocalAppsTheme","theme","setMode","_hooks$checkInstalled","_hooks$auth","_hooks$checkPermissio","_storyboard$meta","_hooks$flowApi2","_storyboard$meta2","checkInstalledApps","preCheckInstalledApps","appId","_internalApiGetAppInBootstrapData","routeHelper","bailout","output","unauthenticated","redirect","path","mergeMenus","menuRequests","menuConfs","Promise","all","mergeMenuConfs","returnNode","isUnauthenticatedError","NO_AUTH_GUARD","HttpAbortError","noAuthGuardLoginPath","getMiscSettings","failed","node","BRICK","type","properties","textContent","httpErrorToString","runtimeContext","return","blockingList","rendererContext","RendererContext","query","URLSearchParams","sys","auth","getAuth","getPageInfo","settings","brand","getBrandSettings","ctxStore","DataStore","pendingPermissionsPreCheck","checkPermissions","preCheckPermissions","tplStateStoreMap","Map","formStateStoreMap","registerCustomTemplates","registerStoryboardFunctions","meta","functions","collectContract","contracts","stores","renderRoutes","insertPreviewRoutes","routes","getDataStores","postAsyncRender","setInitialMenuRequests","result","child","route","dispatchBeforePageLoad","applyTheme","applyMode","mountTree","scrollTo","dispatchPageLoad","dispatchAnchorLoad","dispatchOnMount","initializeScrollIntoView","initializeMediaChange","initializeMessageDispatcher","store","mountAsyncData","pageTitle","title","isLoggedIn","navConfig","breadcrumb","menuConf","overwrite","items","push"],"sources":["../../../src/internal/Router.ts"],"sourcesContent":["import { Action, locationsAreEqual } from \"history\";\nimport type {\n BreadcrumbItemConf,\n MicroApp,\n StaticMenuConf,\n Storyboard,\n} from \"@next-core/types\";\nimport { HttpAbortError } from \"@next-core/http\";\nimport { uniqueId } from \"lodash\";\nimport { NextHistoryState, NextLocation, getHistory } from \"../history.js\";\nimport {\n RenderOutput,\n getDataStores,\n postAsyncRender,\n renderRoutes,\n} from \"./Renderer.js\";\nimport { DataStore } from \"./data/DataStore.js\";\nimport { clearResolveCache } from \"./data/resolveData.js\";\nimport { mountTree, unmountTree } from \"./mount.js\";\nimport { isOutsideApp, matchStoryboard } from \"./matchStoryboard.js\";\nimport { registerStoryboardFunctions } from \"./compute/StoryboardFunctions.js\";\nimport { RendererContext, RouteHelper } from \"./RendererContext.js\";\nimport {\n applyMode,\n applyTheme,\n getLocalAppsTheme,\n setMode,\n setTheme,\n} from \"../themeAndMode.js\";\nimport {\n _internalApiGetAppInBootstrapData,\n getRuntime,\n hooks,\n} from \"./Runtime.js\";\nimport { getPageInfo } from \"../getPageInfo.js\";\nimport type { RenderBrick, RenderRoot, RuntimeContext } from \"./interfaces.js\";\nimport { resetAllComputedMarks } from \"./compute/markAsComputed.js\";\nimport {\n handleHttpError,\n httpErrorToString,\n isUnauthenticatedError,\n} from \"../handleHttpError.js\";\nimport { abortPendingRequest, initAbortController } from \"./abortController.js\";\nimport { registerCustomTemplates } from \"./registerCustomTemplates.js\";\nimport { fulfilStoryboard } from \"./fulfilStoryboard.js\";\nimport { RenderTag } from \"./enums.js\";\nimport { insertPreviewRoutes } from \"./insertPreviewRoutes.js\";\n\nexport class Router {\n readonly #storyboards: Storyboard[];\n #rendering = false;\n #prevLocation!: NextLocation;\n #nextLocation?: NextLocation;\n #runtimeContext?: RuntimeContext;\n #rendererContext?: RendererContext;\n #rendererContextTrashCan = new Set<RendererContext | undefined>();\n #redirectCount = 0;\n #renderId?: string;\n #currentApp?: MicroApp;\n #previousApp?: MicroApp;\n #navConfig?: {\n breadcrumb?: BreadcrumbItemConf[];\n };\n\n constructor(storyboards: Storyboard[]) {\n this.#storyboards = storyboards;\n\n const history = getHistory();\n window.addEventListener(\"beforeunload\", (event) => {\n const message = this.#getBlockMessageBeforePageLave({});\n // See examples in https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload\n if (message) {\n // Cancel the event\n // If you prevent default behavior in Mozilla Firefox prompt will always be shown\n event.preventDefault();\n // Chrome requires returnValue to be set\n event.returnValue = \"\";\n } else {\n // the absence of a returnValue property on the event will guarantee the browser unload happens\n delete event.returnValue;\n }\n });\n\n history.block((location, action) =>\n this.#getBlockMessageBeforePageLave({ location, action })\n );\n }\n\n getRenderId() {\n return this.#renderId;\n }\n\n getRuntimeContext() {\n return this.#runtimeContext;\n }\n\n getRecentApps() {\n return {\n currentApp: this.#currentApp,\n previousApp: this.#previousApp,\n };\n }\n\n getNavConfig() {\n return this.#navConfig;\n }\n\n #getBlockMessageBeforePageLave(detail: {\n location?: NextLocation;\n action?: Action;\n }): string | undefined {\n const history = getHistory();\n const previousMessage = history.getBlockMessage();\n this.#rendererContext?.dispatchBeforePageLeave(detail);\n const message = history.getBlockMessage();\n if (!previousMessage && message) {\n // Auto unblock only if new block was introduced by `onBeforePageLeave`.\n history.unblock();\n }\n return message;\n }\n\n #safeRedirect(\n to: string,\n state: NextHistoryState | undefined,\n from: NextLocation\n ): void {\n if (this.#redirectCount++ > 10) {\n const message = `Infinite redirect detected: from \"${from.pathname}${from.search}${from.hash}\" to \"${to}\"`;\n // istanbul ignore else: error cannot be caught in test\n if (process.env.NODE_ENV === \"test\") {\n // eslint-disable-next-line no-console\n console.error(message);\n return;\n } else {\n throw new Error(message);\n }\n }\n getHistory().replace(to, state);\n }\n\n bootstrap() {\n initAbortController();\n const history = getHistory();\n this.#prevLocation = history.location;\n let renderId = 0;\n history.listen(async (location, action) => {\n const currentRenderId = ++renderId;\n let ignoreRendering: boolean | undefined;\n const omittedLocationProps: Partial<NextLocation> = {\n hash: undefined,\n state: undefined,\n };\n // Omit the \"key\" when checking whether locations are equal in certain situations.\n if (\n // When current location is triggered by browser action of hash link.\n location.key === undefined ||\n // When current location is triggered by browser action of non-push-or-replace,\n // such as goBack or goForward,\n (action === \"POP\" &&\n // and the previous location was triggered by hash link,\n (this.#prevLocation.key === undefined ||\n // or the previous location specified notify false.\n this.#prevLocation.state?.notify === false))\n ) {\n omittedLocationProps.key = undefined;\n }\n if (\n locationsAreEqual(\n { ...this.#prevLocation, ...omittedLocationProps },\n { ...location, ...omittedLocationProps }\n ) ||\n (action !== \"POP\" && location.state?.notify === false)\n ) {\n // Ignore rendering if location not changed except hash, state and optional key.\n // Ignore rendering if notify is `false`.\n ignoreRendering = true;\n }\n\n if (!ignoreRendering) {\n ignoreRendering =\n await this.#rendererContext?.didPerformIncrementalRender(location);\n }\n\n // Ignore stale renders\n if (renderId !== currentRenderId) {\n return;\n }\n\n if (ignoreRendering) {\n this.#prevLocation = location;\n return;\n }\n\n abortPendingRequest();\n this.#prevLocation = location;\n this.#rendererContext?.dispatchPageLeave();\n\n if (action === \"POP\") {\n const storyboard = matchStoryboard(\n this.#storyboards,\n location.pathname\n );\n // When a browser action of goBack or goForward is performing,\n // force reload when the target page is a page of an outside app.\n if (isOutsideApp(storyboard)) {\n window.location.reload();\n return;\n }\n }\n\n if (this.#rendering) {\n this.#nextLocation = location;\n } else {\n // devtoolsHookEmit(\"locationChange\");\n this.#queuedRender(location).catch(handleHttpError);\n }\n });\n return this.#queuedRender(history.location);\n }\n\n async #queuedRender(location: NextLocation): Promise<void> {\n this.#rendering = true;\n try {\n await this.#render(location);\n } finally {\n this.#rendering = false;\n if (this.#nextLocation) {\n const nextLocation = this.#nextLocation;\n this.#nextLocation = undefined;\n await this.#queuedRender(nextLocation);\n }\n }\n }\n\n async #render(location: NextLocation): Promise<void> {\n this.#renderId = uniqueId(\"render-id-1\");\n\n resetAllComputedMarks();\n clearResolveCache();\n hooks?.flowApi?.clearCollectWidgetContract();\n\n const history = getHistory();\n history.unblock();\n\n // const renderStartTime = performance.now();\n const finishPageView = hooks?.pageView?.create();\n\n const storyboard = matchStoryboard(this.#storyboards, location.pathname);\n\n const previousApp = this.#runtimeContext?.app;\n if (storyboard?.app) {\n await fulfilStoryboard(storyboard);\n }\n const currentApp = (this.#currentApp = storyboard?.app);\n\n // Storyboard maybe re-assigned, e.g. when open launchpad.\n const appChanged =\n previousApp && currentApp\n ? previousApp.id !== currentApp.id\n : previousApp !== currentApp;\n\n // TODO: handle favicon\n\n // Set `Router::#currentApp` before calling `getFeatureFlags()`\n const flags = getRuntime().getFeatureFlags();\n const prevRendererContext = this.#rendererContext;\n\n const redirectTo = (to: string, state?: NextHistoryState): void => {\n finishPageView?.({\n status: \"redirected\",\n });\n this.#rendererContextTrashCan.add(prevRendererContext);\n this.#safeRedirect(to, state, location);\n };\n\n const redirectToLogin = (): void => {\n const to = flags[\"sso-enabled\"] ? \"/sso-auth/login\" : \"/auth/login\";\n redirectTo(to, { from: location });\n };\n\n const main = document.querySelector(\"#main-mount-point\") as HTMLElement;\n const portal = document.querySelector(\"#portal-mount-point\") as HTMLElement;\n\n const renderRoot: RenderRoot = {\n tag: RenderTag.ROOT,\n container: main,\n createPortal: portal,\n };\n\n const cleanUpPreviousRender = (): void => {\n unmountTree(main);\n unmountTree(portal);\n\n // Note: redirects can lead to multiple trash renderer contexts.\n this.#rendererContextTrashCan.add(prevRendererContext);\n for (const item of this.#rendererContextTrashCan) {\n if (item) {\n item.dispatchOnUnmount();\n item.dispose();\n }\n }\n this.#rendererContextTrashCan.clear();\n hooks?.messageDispatcher?.reset();\n\n if (appChanged) {\n this.#previousApp = previousApp;\n window.dispatchEvent(\n new CustomEvent(\"app.change\", {\n detail: {\n previousApp,\n currentApp,\n },\n })\n );\n }\n };\n\n setTheme(\n (currentApp &&\n (getLocalAppsTheme()[currentApp.id] || currentApp.theme)) ||\n \"light\"\n );\n setMode(\"default\");\n\n if (currentApp) {\n hooks?.checkInstalledApps?.preCheckInstalledApps(\n storyboard,\n (appId) => !!_internalApiGetAppInBootstrapData(appId)\n );\n\n const routeHelper: RouteHelper = {\n bailout: (output) => {\n if (output.unauthenticated) {\n redirectToLogin();\n return true;\n }\n if (output.redirect) {\n redirectTo(output.redirect.path, output.redirect.state);\n return true;\n }\n // Reset redirect count if no redirect is set.\n this.#redirectCount = 0;\n },\n mergeMenus: async (menuRequests) => {\n const menuConfs = await Promise.all(menuRequests);\n this.#navConfig = mergeMenuConfs(menuConfs);\n },\n catch: (error, returnNode) => {\n if (isUnauthenticatedError(error) && !window.NO_AUTH_GUARD) {\n redirectToLogin();\n return;\n } else if (error instanceof HttpAbortError) {\n this.#rendererContextTrashCan.add(prevRendererContext);\n return;\n } else {\n const noAuthGuardLoginPath =\n getRuntime().getMiscSettings().noAuthGuardLoginPath;\n if (isUnauthenticatedError(error) && noAuthGuardLoginPath) {\n redirectTo(noAuthGuardLoginPath as string, { from: location });\n return;\n }\n return {\n failed: true,\n output: {\n node: {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: httpErrorToString(error),\n },\n runtimeContext: null!,\n return: returnNode,\n },\n blockingList: [],\n menuRequests: [],\n },\n };\n }\n },\n };\n\n const rendererContext = (this.#rendererContext = new RendererContext(\n \"page\",\n { routeHelper }\n ));\n\n const runtimeContext: RuntimeContext = (this.#runtimeContext = {\n app: currentApp,\n location,\n query: new URLSearchParams(location.search),\n flags,\n sys: {\n ...hooks?.auth?.getAuth(),\n ...getPageInfo(),\n settings: {\n brand: getRuntime().getBrandSettings(),\n },\n },\n ctxStore: new DataStore(\"CTX\", undefined, rendererContext),\n pendingPermissionsPreCheck: [\n hooks?.checkPermissions?.preCheckPermissions(storyboard),\n ],\n tplStateStoreMap: new Map<string, DataStore<\"STATE\">>(),\n formStateStoreMap: new Map<string, DataStore<\"FORM_STATE\">>(),\n });\n\n this.#navConfig = undefined;\n\n registerCustomTemplates(storyboard);\n registerStoryboardFunctions(storyboard.meta?.functions, currentApp);\n hooks?.flowApi?.collectContract(storyboard.meta?.contracts);\n\n let failed = false;\n let output: RenderOutput;\n let stores: DataStore<\"CTX\" | \"STATE\" | \"FORM_STATE\">[] = [];\n\n try {\n output = await renderRoutes(\n renderRoot,\n insertPreviewRoutes(storyboard.routes),\n runtimeContext,\n rendererContext,\n []\n );\n if (routeHelper.bailout(output)) {\n return;\n }\n\n stores = getDataStores(runtimeContext);\n\n await postAsyncRender(output, runtimeContext, stores);\n\n await routeHelper.mergeMenus(output.menuRequests);\n rendererContext.setInitialMenuRequests(output.menuRequests);\n } catch (error) {\n // eslint-disable-next-line no-console\n console.error(\"Router failed:\", error);\n\n const result = routeHelper.catch(error, renderRoot);\n if (!result) {\n return;\n }\n ({ failed, output } = result);\n }\n renderRoot.child = output.node;\n\n cleanUpPreviousRender();\n\n if ((output.route && output.route.type !== \"routes\") || failed) {\n if (!failed) {\n // There is a window to set theme and mode by `lifeCycle.onBeforePageLoad`.\n rendererContext.dispatchBeforePageLoad();\n }\n applyTheme();\n applyMode();\n\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n // See https://github.com/ReactTraining/react-router/blob/master/packages/react-router-dom/docs/guides/scroll-restoration.md\n window.scrollTo(0, 0);\n\n if (!failed) {\n rendererContext.dispatchPageLoad();\n rendererContext.dispatchAnchorLoad();\n rendererContext.dispatchOnMount();\n rendererContext.initializeScrollIntoView();\n rendererContext.initializeMediaChange();\n rendererContext.initializeMessageDispatcher();\n\n for (const store of stores) {\n store.mountAsyncData();\n }\n\n finishPageView?.({\n status: \"ok\",\n path: output.path,\n pageTitle: document.title,\n });\n } else {\n finishPageView?.({ status: \"failed\" });\n }\n\n return;\n }\n } else if (\n !window.NO_AUTH_GUARD &&\n hooks?.auth &&\n !hooks.auth.isLoggedIn()\n ) {\n // Todo(steve): refine after api-gateway supports fetching storyboards before logged in.\n // Redirect to login if no storyboard is matched.\n redirectToLogin();\n return;\n } else {\n cleanUpPreviousRender();\n }\n\n applyTheme();\n applyMode();\n\n const node: RenderBrick = {\n tag: RenderTag.BRICK,\n type: \"div\",\n properties: {\n textContent: \"Page not found\",\n },\n runtimeContext: null!,\n return: renderRoot,\n };\n renderRoot.child = node;\n\n mountTree(renderRoot);\n\n // Scroll to top after each rendering.\n window.scrollTo(0, 0);\n finishPageView?.({ status: \"not-found\" });\n }\n}\n\nfunction mergeMenuConfs(menuConfs: StaticMenuConf[]) {\n const navConfig = {\n breadcrumb: [] as BreadcrumbItemConf[],\n };\n for (const menuConf of menuConfs) {\n const { breadcrumb } = menuConf;\n if (breadcrumb) {\n if (breadcrumb.overwrite) {\n navConfig.breadcrumb = breadcrumb.items;\n } else {\n navConfig.breadcrumb.push(...breadcrumb.items);\n }\n }\n }\n return navConfig;\n}\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAOA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AAMA,IAAAK,UAAA,GAAAL,OAAA;AACA,IAAAM,YAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,gBAAA,GAAAR,OAAA;AACA,IAAAS,oBAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,aAAA,GAAAX,OAAA;AAOA,IAAAY,QAAA,GAAAZ,OAAA;AAKA,IAAAa,YAAA,GAAAb,OAAA;AAEA,IAAAc,eAAA,GAAAd,OAAA;AACA,IAAAe,gBAAA,GAAAf,OAAA;AAKA,IAAAgB,gBAAA,GAAAhB,OAAA;AACA,IAAAiB,wBAAA,GAAAjB,OAAA;AACA,IAAAkB,iBAAA,GAAAlB,OAAA;AACA,IAAAmB,MAAA,GAAAnB,OAAA;AACA,IAAAoB,oBAAA,GAAApB,OAAA;AAA+D,IAAAqB,YAAA,oBAAAC,OAAA;AAAA,IAAAC,UAAA,oBAAAD,OAAA;AAAA,IAAAE,aAAA,oBAAAF,OAAA;AAAA,IAAAG,aAAA,oBAAAH,OAAA;AAAA,IAAAI,eAAA,oBAAAJ,OAAA;AAAA,IAAAK,gBAAA,oBAAAL,OAAA;AAAA,IAAAM,wBAAA,oBAAAN,OAAA;AAAA,IAAAO,cAAA,oBAAAP,OAAA;AAAA,IAAAQ,SAAA,oBAAAR,OAAA;AAAA,IAAAS,WAAA,oBAAAT,OAAA;AAAA,IAAAU,YA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