@next-core/brick-kit 2.129.2 → 2.131.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { parsePath, createBrowserHistory, locationsAreEqual, createPath } from 'history';
2
2
  import _objectSpread from '@babel/runtime/helpers/objectSpread2';
3
3
  import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
4
- import _asyncToGenerator$4 from '@babel/runtime/helpers/asyncToGenerator';
4
+ import _asyncToGenerator$3 from '@babel/runtime/helpers/asyncToGenerator';
5
5
  import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
6
6
  import React, { useState, useEffect, useRef, forwardRef, useImperativeHandle, useMemo, useContext, createContext, useReducer, useCallback } from 'react';
7
- import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, matchPath, scanAppGetMenuInAny, asyncProcessBrick, scanInstalledAppsInStoryboard, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
7
+ import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, transformAndInject, transform, trackContext, trackState, scanPermissionActionsInStoryboard, precookFunction, cook, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedState, trackUsedContext, shouldAllowRecursiveEvaluations, preevaluate, inject, deepFreeze, createProviderClass, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, prefetchScript, scanBricksInBrickConf, scanProcessorsInAny, loadScript, matchPath, scanAppGetMenuInAny, asyncProcessBrick, scanInstalledAppsInStoryboard, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
8
8
  import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, isEmpty, sortBy, merge, isObject as isObject$1, pick, orderBy, omit, findLastIndex, noop, isString } from 'lodash';
9
9
  import { http, HttpResponseError, HttpFetchError } from '@next-core/brick-http';
10
10
  import moment from 'moment';
@@ -38,7 +38,7 @@ class BaseBar {
38
38
  bootstrap(brick, options) {
39
39
  var _this = this;
40
40
 
41
- return _asyncToGenerator$4(function* () {
41
+ return _asyncToGenerator$3(function* () {
42
42
  // Ignore if the brick is not changed.
43
43
  if (_this.brick === brick) {
44
44
  return;
@@ -445,7 +445,7 @@ function getCssPropertyValue(name) {
445
445
  return ((_window$getComputedSt = window.getComputedStyle(el)) === null || _window$getComputedSt === void 0 ? void 0 : _window$getComputedSt.getPropertyValue(name)) || "";
446
446
  }
447
447
 
448
- function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
448
+ function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
449
449
  try {
450
450
  var info = gen[key](arg);
451
451
  var value = info.value;
@@ -461,7 +461,7 @@ function asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, key, arg) {
461
461
  }
462
462
  }
463
463
 
464
- function _asyncToGenerator$3(fn) {
464
+ function _asyncToGenerator$2(fn) {
465
465
  return function () {
466
466
  var self = this,
467
467
  args = arguments;
@@ -469,11 +469,11 @@ function _asyncToGenerator$3(fn) {
469
469
  var gen = fn.apply(self, args);
470
470
 
471
471
  function _next(value) {
472
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "next", value);
472
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
473
473
  }
474
474
 
475
475
  function _throw(err) {
476
- asyncGeneratorStep$3(gen, resolve, reject, _next, _throw, "throw", err);
476
+ asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
477
477
  }
478
478
 
479
479
  _next(undefined);
@@ -536,7 +536,7 @@ function _objectSpread2(target) {
536
536
 
537
537
 
538
538
  var InstanceApi_getDetail = /*#__PURE__*/function () {
539
- var _ref = _asyncToGenerator$3(function* (objectId, instanceId, params, options) {
539
+ var _ref = _asyncToGenerator$2(function* (objectId, instanceId, params, options) {
540
540
  return (
541
541
  /**! @contract easyops.api.cmdb.instance.GetDetail */
542
542
  (yield http.get("api/gateway/cmdb.instance.GetDetail/object/".concat(objectId, "/instance/").concat(instanceId), _objectSpread2(_objectSpread2({}, options), {}, {
@@ -556,7 +556,7 @@ var InstanceApi_getDetail = /*#__PURE__*/function () {
556
556
 
557
557
 
558
558
  var InstanceApi_postSearch = /*#__PURE__*/function () {
559
- var _ref = _asyncToGenerator$3(function* (objectId, data, options) {
559
+ var _ref = _asyncToGenerator$2(function* (objectId, data, options) {
560
560
  return (
561
561
  /**! @contract easyops.api.cmdb.instance.PostSearch */
562
562
  (yield http.post("api/gateway/cmdb.instance.PostSearch/object/".concat(objectId, "/instance/_search"), data, options)).data
@@ -1333,41 +1333,26 @@ function i18nText(data) {
1333
1333
  }
1334
1334
  }
1335
1335
 
1336
- function asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, key, arg) {
1337
- try {
1338
- var info = gen[key](arg);
1339
- var value = info.value;
1340
- } catch (error) {
1341
- reject(error);
1342
- return;
1343
- }
1344
-
1345
- if (info.done) {
1346
- resolve(value);
1347
- } else {
1348
- Promise.resolve(value).then(_next, _throw);
1349
- }
1350
- }
1351
-
1352
- function _asyncToGenerator$2(fn) {
1353
- return function () {
1354
- var self = this,
1355
- args = arguments;
1356
- return new Promise(function (resolve, reject) {
1357
- var gen = fn.apply(self, args);
1336
+ /**
1337
+ * @description 获取微应用的i18n数据
1338
+ * @endpoint GET /api/v1/micro-app/i18n
1339
+ */
1358
1340
 
1359
- function _next(value) {
1360
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "next", value);
1361
- }
1362
1341
 
1363
- function _throw(err) {
1364
- asyncGeneratorStep$2(gen, resolve, reject, _next, _throw, "throw", err);
1365
- }
1342
+ var InstalledMicroAppApi_getI18NData = /*#__PURE__*/function () {
1343
+ var _ref = _asyncToGenerator$3(function* (params, options) {
1344
+ return (
1345
+ /**! @contract easyops.api.micro_app.installed_micro_app.GetI18NData@1.0.0 */
1346
+ (yield http.get("api/gateway/micro_app.installed_micro_app.GetI18NData/api/v1/micro-app/i18n", _objectSpread(_objectSpread({}, options), {}, {
1347
+ params
1348
+ }))).data
1349
+ );
1350
+ });
1366
1351
 
1367
- _next(undefined);
1368
- });
1352
+ return function InstalledMicroAppApi_getI18NData(_x, _x2) {
1353
+ return _ref.apply(this, arguments);
1369
1354
  };
1370
- }
1355
+ }();
1371
1356
  /**
1372
1357
  * @description 查询模型关联小产品列表
1373
1358
  * @endpoint LIST /api/micro_app/v1/object_micro_app
@@ -1375,9 +1360,9 @@ function _asyncToGenerator$2(fn) {
1375
1360
 
1376
1361
 
1377
1362
  var ObjectMicroAppApi_getObjectMicroAppList = /*#__PURE__*/function () {
1378
- var _ref = _asyncToGenerator$2(function* (options) {
1363
+ var _ref = _asyncToGenerator$3(function* (options) {
1379
1364
  return (
1380
- /**! @contract easyops.api.micro_app.object_micro_app.GetObjectMicroAppList */
1365
+ /**! @contract easyops.api.micro_app.object_micro_app.GetObjectMicroAppList@1.0.0 */
1381
1366
  (yield http.get("api/gateway/micro_app.object_micro_app.GetObjectMicroAppList/api/micro_app/v1/object_micro_app", options)).data
1382
1367
  );
1383
1368
  });
@@ -1393,9 +1378,9 @@ var ObjectMicroAppApi_getObjectMicroAppList = /*#__PURE__*/function () {
1393
1378
 
1394
1379
 
1395
1380
  var PermissionApi_validatePermissions = /*#__PURE__*/function () {
1396
- var _ref = _asyncToGenerator$2(function* (data, options) {
1381
+ var _ref = _asyncToGenerator$3(function* (data, options) {
1397
1382
  return (
1398
- /**! @contract easyops.api.micro_app.permission.ValidatePermissions */
1383
+ /**! @contract easyops.api.micro_app.permission.ValidatePermissions@1.0.0 */
1399
1384
  (yield http.post("api/gateway/micro_app.permission.ValidatePermissions/api/micro_app/v1/permission/validate", data, options)).data
1400
1385
  );
1401
1386
  });
@@ -1461,7 +1446,7 @@ function preCheckPermissions(_x) {
1461
1446
  }
1462
1447
 
1463
1448
  function _preCheckPermissions() {
1464
- _preCheckPermissions = _asyncToGenerator$4(function* (storyboard) {
1449
+ _preCheckPermissions = _asyncToGenerator$3(function* (storyboard) {
1465
1450
  var usedActions = scanPermissionActionsInStoryboard(storyboard);
1466
1451
  yield validatePermissions(usedActions);
1467
1452
  });
@@ -1479,7 +1464,7 @@ function validatePermissions(_x2) {
1479
1464
  */
1480
1465
 
1481
1466
  function _validatePermissions() {
1482
- _validatePermissions = _asyncToGenerator$4(function* (usedActions) {
1467
+ _validatePermissions = _asyncToGenerator$3(function* (usedActions) {
1483
1468
  // Do not request known actions.
1484
1469
  var actions = difference(usedActions, Array.from(permissionMap.keys()));
1485
1470
 
@@ -1580,6 +1565,44 @@ function getDynamicReadOnlyProxy(_ref) {
1580
1565
  });
1581
1566
  }
1582
1567
 
1568
+ var misc;
1569
+ function getRuntimeMisc() {
1570
+ if (!misc) {
1571
+ misc = {
1572
+ isInIframe: false,
1573
+ isInIframeOfSameSite: false,
1574
+ isInIframeOfNext: false,
1575
+ isInIframeOfVisualBuilder: false,
1576
+ isInIframeOfLegacyConsole: false
1577
+ };
1578
+
1579
+ if (window !== window.parent) {
1580
+ misc.isInIframe = true;
1581
+
1582
+ try {
1583
+ // Handle:
1584
+ // - Previewing in visual builder by iframe.
1585
+ // - Nesting next in next.
1586
+ // - Nesting console in next.
1587
+ if (window.origin === window.parent.origin) {
1588
+ misc.isInIframeOfSameSite = true;
1589
+ var selfIsNext = getBasePath() === "/next/";
1590
+ var parentPathname = window.parent.location.pathname;
1591
+ var parentIsNext = parentPathname.startsWith("/next/");
1592
+ misc.isInIframeOfNext = (Number(selfIsNext) ^ Number(parentIsNext)) === 0;
1593
+ misc.isInIframeOfVisualBuilder = parentPathname.startsWith("".concat(parentIsNext ? "/next" : "", "/visual-builder/"));
1594
+ misc.isInIframeOfLegacyConsole = selfIsNext && !parentIsNext;
1595
+ }
1596
+ } catch (e) {// do nothing
1597
+ }
1598
+ }
1599
+
1600
+ Object.freeze(misc);
1601
+ }
1602
+
1603
+ return misc;
1604
+ }
1605
+
1583
1606
  // `GeneralGlobals` are globals which are page-state-agnostic,
1584
1607
  // thus they can be used both in storyboard expressions and functions.
1585
1608
  function getGeneralGlobals(attemptToVisitGlobals, options) {
@@ -1632,6 +1655,9 @@ function getIndividualGlobal(variableName, _ref) {
1632
1655
  getCssPropertyValue: collectCoverage ? () => "" : getCssPropertyValue
1633
1656
  };
1634
1657
 
1658
+ case "RUNTIME_MISC":
1659
+ return collectCoverage ? fakeRuntimeMisc() : getRuntimeMisc();
1660
+
1635
1661
  case "console":
1636
1662
  return isStoryboardFunction ? getReadOnlyProxy(console) : undefined;
1637
1663
 
@@ -1667,6 +1693,16 @@ function fakeCheckPermissions() {
1667
1693
  return true;
1668
1694
  }
1669
1695
 
1696
+ function fakeRuntimeMisc() {
1697
+ return {
1698
+ isInIframe: false,
1699
+ isInIframeOfSameSite: false,
1700
+ isInIframeOfNext: false,
1701
+ isInIframeOfVisualBuilder: false,
1702
+ isInIframeOfLegacyConsole: false
1703
+ };
1704
+ }
1705
+
1670
1706
  /** @internal */
1671
1707
 
1672
1708
  /** @internal */
@@ -2005,7 +2041,7 @@ class StoryboardContextWrapper {
2005
2041
  }
2006
2042
 
2007
2043
  updateValue(name, value, method) {
2008
- var _item$eventTarget;
2044
+ var _item$eventTarget2;
2009
2045
 
2010
2046
  if (!this.data.has(name)) {
2011
2047
  if (this.tplContextId) {
@@ -2029,6 +2065,22 @@ class StoryboardContextWrapper {
2029
2065
  return;
2030
2066
  }
2031
2067
 
2068
+ if (method === "refresh") {
2069
+ if (!item.refresh) {
2070
+ throw new Error("You can not refresh the storyboard context \"".concat(name, "\" which has no resolve."));
2071
+ }
2072
+
2073
+ item.refresh().then(val => {
2074
+ var _item$eventTarget;
2075
+
2076
+ item.value = val;
2077
+ (_item$eventTarget = item.eventTarget) === null || _item$eventTarget === void 0 ? void 0 : _item$eventTarget.dispatchEvent(new CustomEvent(this.tplContextId ? "state.change" : "context.change", {
2078
+ detail: item.value
2079
+ }));
2080
+ }, handleHttpError);
2081
+ return;
2082
+ }
2083
+
2032
2084
  if (method === "replace") {
2033
2085
  item.value = value;
2034
2086
  } else {
@@ -2041,7 +2093,7 @@ class StoryboardContextWrapper {
2041
2093
  }
2042
2094
  }
2043
2095
 
2044
- (_item$eventTarget = item.eventTarget) === null || _item$eventTarget === void 0 ? void 0 : _item$eventTarget.dispatchEvent(new CustomEvent(this.tplContextId ? "state.change" : "context.change", {
2096
+ (_item$eventTarget2 = item.eventTarget) === null || _item$eventTarget2 === void 0 ? void 0 : _item$eventTarget2.dispatchEvent(new CustomEvent(this.tplContextId ? "state.change" : "context.change", {
2045
2097
  detail: item.value
2046
2098
  }));
2047
2099
  }
@@ -2049,7 +2101,7 @@ class StoryboardContextWrapper {
2049
2101
  define(contextConfs, coreContext, brick) {
2050
2102
  var _this = this;
2051
2103
 
2052
- return _asyncToGenerator$4(function* () {
2104
+ return _asyncToGenerator$3(function* () {
2053
2105
  if (Array.isArray(contextConfs)) {
2054
2106
  var {
2055
2107
  mergedContext,
@@ -2090,7 +2142,7 @@ function resolveStoryboardContext(_x, _x2, _x3, _x4) {
2090
2142
  }
2091
2143
 
2092
2144
  function _resolveStoryboardContext() {
2093
- _resolveStoryboardContext = _asyncToGenerator$4(function* (contextConf, coreContext, storyboardContextWrapper, brick) {
2145
+ _resolveStoryboardContext = _asyncToGenerator$3(function* (contextConf, coreContext, storyboardContextWrapper, brick) {
2094
2146
  if (contextConf.property) {
2095
2147
  if (storyboardContextWrapper.tplContextId) {
2096
2148
  throw new Error("Setting `property` is not allowed in template scoped context");
@@ -2117,35 +2169,70 @@ function resolveNormalStoryboardContext(_x5, _x6, _x7, _x8) {
2117
2169
  }
2118
2170
 
2119
2171
  function _resolveNormalStoryboardContext() {
2120
- _resolveNormalStoryboardContext = _asyncToGenerator$4(function* (contextConf, mergedContext, storyboardContextWrapper, brick) {
2172
+ _resolveNormalStoryboardContext = _asyncToGenerator$3(function* (contextConf, mergedContext, storyboardContextWrapper, brick) {
2121
2173
  if (!looseCheckIf(contextConf, mergedContext)) {
2122
2174
  return false;
2123
2175
  }
2124
2176
 
2125
- var isResolve = false;
2126
- var value = getDefinedTemplateState(!!storyboardContextWrapper.tplContextId, contextConf, brick);
2177
+ var isTemplateState = !!storyboardContextWrapper.tplContextId;
2178
+ var value = getDefinedTemplateState(isTemplateState, contextConf, brick);
2179
+ var refresh = null;
2180
+ var isLazyResolve = false;
2127
2181
 
2128
2182
  if (value === undefined) {
2129
2183
  if (contextConf.resolve) {
2130
2184
  if (looseCheckIf(contextConf.resolve, mergedContext)) {
2131
- isResolve = true;
2132
- var valueConf = {};
2133
- yield _internalApiGetResolver().resolveOne("reference", _objectSpread({
2134
- transform: "value",
2135
- transformMapArray: false
2136
- }, contextConf.resolve), valueConf, null, mergedContext);
2137
- value = valueConf.value;
2185
+ refresh = /*#__PURE__*/function () {
2186
+ var _ref = _asyncToGenerator$3(function* () {
2187
+ var valueConf = {};
2188
+ yield _internalApiGetResolver().resolveOne("reference", _objectSpread({
2189
+ transform: "value",
2190
+ transformMapArray: false
2191
+ }, contextConf.resolve), valueConf, null, mergedContext);
2192
+ return valueConf.value;
2193
+ });
2194
+
2195
+ return function refresh() {
2196
+ return _ref.apply(this, arguments);
2197
+ };
2198
+ }();
2199
+
2200
+ isLazyResolve = contextConf.resolve.lazy;
2201
+
2202
+ if (!isLazyResolve) {
2203
+ value = yield refresh();
2204
+ }
2138
2205
  } else if (!hasOwnProperty(contextConf, "value")) {
2139
2206
  return false;
2140
2207
  }
2141
2208
  }
2142
2209
 
2143
- if (!isResolve && contextConf.value !== undefined) {
2210
+ if ((!refresh || isLazyResolve) && contextConf.value !== undefined) {
2211
+ // If the context has no resolve, just use its `value`.
2212
+ // Or if the resolve is ignored or lazy, use its `value` as a fallback.
2144
2213
  value = computeRealValue(contextConf.value, mergedContext, true);
2145
2214
  }
2215
+
2216
+ if (contextConf.track) {
2217
+ // Track its dependencies and auto update when each of them changed.
2218
+ var deps = (isTemplateState ? trackUsedState : trackUsedContext)(refresh ? contextConf.resolve : contextConf.value);
2219
+
2220
+ for (var dep of deps) {
2221
+ var _eventTarget;
2222
+
2223
+ var ctx = storyboardContextWrapper.get().get(dep);
2224
+ ctx === null || ctx === void 0 ? void 0 : (_eventTarget = ctx.eventTarget) === null || _eventTarget === void 0 ? void 0 : _eventTarget.addEventListener(isTemplateState ? "state.change" : "context.change", () => {
2225
+ if (refresh) {
2226
+ storyboardContextWrapper.updateValue(contextConf.name, undefined, "refresh");
2227
+ } else {
2228
+ storyboardContextWrapper.updateValue(contextConf.name, computeRealValue(contextConf.value, mergedContext, true), "replace");
2229
+ }
2230
+ });
2231
+ }
2232
+ }
2146
2233
  }
2147
2234
 
2148
- resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick);
2235
+ resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick, refresh);
2149
2236
  return true;
2150
2237
  });
2151
2238
  return _resolveNormalStoryboardContext.apply(this, arguments);
@@ -2176,12 +2263,13 @@ function getDefinedTemplateState(isTemplateState, contextConf, brick) {
2176
2263
  }
2177
2264
  }
2178
2265
 
2179
- function resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick) {
2266
+ function resolveFreeVariableValue(value, contextConf, mergedContext, storyboardContextWrapper, brick, refresh) {
2180
2267
  var newContext = {
2181
2268
  type: "free-variable",
2182
2269
  value,
2183
2270
  // This is required for tracking context, even if no `onChange` is specified.
2184
- eventTarget: new EventTarget$1()
2271
+ eventTarget: new EventTarget$1(),
2272
+ refresh
2185
2273
  };
2186
2274
 
2187
2275
  if (contextConf.onChange) {
@@ -2978,7 +3066,8 @@ function getNextInternalOptions(internalOptions, isArray, key) {
2978
3066
  }
2979
3067
 
2980
3068
  var _excluded$6 = ["children"],
2981
- _excluded2$2 = ["items", "app"];
3069
+ _excluded2$2 = ["children"],
3070
+ _excluded3 = ["items", "app"];
2982
3071
  var symbolAppId = Symbol("appId");
2983
3072
  // Caching menu requests to avoid flicker.
2984
3073
  var menuCache = new Map();
@@ -2989,7 +3078,7 @@ function constructMenu(_x, _x2, _x3) {
2989
3078
  }
2990
3079
 
2991
3080
  function _constructMenu() {
2992
- _constructMenu = _asyncToGenerator$4(function* (menuBar, context, kernel) {
3081
+ _constructMenu = _asyncToGenerator$3(function* (menuBar, context, kernel) {
2993
3082
  var hasSubMenu = !!menuBar.subMenuId;
2994
3083
 
2995
3084
  if (menuBar.menuId) {
@@ -3019,7 +3108,7 @@ function preConstructMenus(_x4, _x5, _x6) {
3019
3108
  }
3020
3109
 
3021
3110
  function _preConstructMenus() {
3022
- _preConstructMenus = _asyncToGenerator$4(function* (menus, context, kernel) {
3111
+ _preConstructMenus = _asyncToGenerator$3(function* (menus, context, kernel) {
3023
3112
  var data = yield Promise.all(menus.map(menuId => processMenu(menuId, context, kernel, undefined, true)));
3024
3113
  data.forEach((item, index) => processMenuCache.set(menus[index], item));
3025
3114
  });
@@ -3032,7 +3121,7 @@ function fetchMenuById(_x7, _x8, _x9) {
3032
3121
  }
3033
3122
 
3034
3123
  function _fetchMenuById() {
3035
- _fetchMenuById = _asyncToGenerator$4(function* (menuId, kernel, isPreFetch) {
3124
+ _fetchMenuById = _asyncToGenerator$3(function* (menuId, kernel, isPreFetch) {
3036
3125
  if (menuCache.has(menuId)) {
3037
3126
  return menuCache.get(menuId);
3038
3127
  }
@@ -3138,7 +3227,7 @@ function loadDynamicMenuItems(_x10) {
3138
3227
  }
3139
3228
 
3140
3229
  function _loadDynamicMenuItems() {
3141
- _loadDynamicMenuItems = _asyncToGenerator$4(function* (menu) {
3230
+ _loadDynamicMenuItems = _asyncToGenerator$3(function* (menu) {
3142
3231
  if (menu.dynamicItems && menu.itemsResolve) {
3143
3232
  var itemsConf = {};
3144
3233
  yield _internalApiGetResolver().resolveOne("reference", _objectSpread({
@@ -3156,16 +3245,19 @@ function processMenu(_x11, _x12, _x13, _x14, _x15) {
3156
3245
  }
3157
3246
 
3158
3247
  function _processMenu() {
3159
- _processMenu = _asyncToGenerator$4(function* (menuId, context, kernel, hasSubMenu, isPreFetch) {
3248
+ _processMenu = _asyncToGenerator$3(function* (menuId, context, kernel, hasSubMenu, isPreFetch) {
3160
3249
  var _yield$fetchMenuById = yield fetchMenuById(menuId, kernel, isPreFetch),
3161
3250
  {
3162
3251
  items,
3163
3252
  app
3164
3253
  } = _yield$fetchMenuById,
3165
- restMenuData = _objectWithoutProperties(_yield$fetchMenuById, _excluded2$2);
3254
+ restMenuData = _objectWithoutProperties(_yield$fetchMenuById, _excluded3);
3166
3255
 
3167
- var menuData = _objectSpread(_objectSpread({}, yield computeRealValueWithOverrideApp(restMenuData, app[0].appId, context, kernel)), {}, {
3168
- items: yield computeMenuItemsWithOverrideApp(items, context, kernel)
3256
+ var appIds = collectOverrideApps(items, app[0].appId, context.app.id);
3257
+ yield kernel.fulfilStoryboardI18n(appIds);
3258
+
3259
+ var menuData = _objectSpread(_objectSpread({}, computeRealValueWithOverrideApp(restMenuData, app[0].appId, context, kernel)), {}, {
3260
+ items: computeMenuItemsWithOverrideApp(items, context, kernel)
3169
3261
  });
3170
3262
 
3171
3263
  return {
@@ -3197,31 +3289,53 @@ function _processMenu() {
3197
3289
  return _processMenu.apply(this, arguments);
3198
3290
  }
3199
3291
 
3200
- function computeMenuItemsWithOverrideApp(items, context, kernel) {
3201
- return Promise.all(items.map( /*#__PURE__*/function () {
3202
- var _ref2 = _asyncToGenerator$4(function* (_ref) {
3292
+ function collectOverrideApps(items, rootAppId, contextAppId) {
3293
+ var appIds = new Set();
3294
+
3295
+ if (rootAppId !== contextAppId) {
3296
+ appIds.add(rootAppId);
3297
+ }
3298
+
3299
+ function collect(items) {
3300
+ for (var _ref of items) {
3203
3301
  var {
3204
3302
  children
3205
3303
  } = _ref,
3206
3304
  rest = _objectWithoutProperties(_ref, _excluded$6);
3207
3305
 
3208
- return _objectSpread(_objectSpread({}, yield computeRealValueWithOverrideApp(rest, rest[symbolAppId], context, kernel)), {}, {
3209
- children: children && (yield computeMenuItemsWithOverrideApp(children, context, kernel))
3210
- });
3211
- });
3306
+ var overrideAppId = rest[symbolAppId];
3212
3307
 
3213
- return function (_x16) {
3214
- return _ref2.apply(this, arguments);
3215
- };
3216
- }()));
3308
+ if (overrideAppId !== contextAppId && !appIds.has(overrideAppId) && requireOverrideApp(rest)) {
3309
+ appIds.add(overrideAppId);
3310
+ }
3311
+
3312
+ children && collect(children);
3313
+ }
3314
+ }
3315
+
3316
+ collect(items);
3317
+ return [...appIds];
3318
+ }
3319
+
3320
+ function computeMenuItemsWithOverrideApp(items, context, kernel) {
3321
+ return items.map(_ref2 => {
3322
+ var {
3323
+ children
3324
+ } = _ref2,
3325
+ rest = _objectWithoutProperties(_ref2, _excluded2$2);
3326
+
3327
+ return _objectSpread(_objectSpread({}, computeRealValueWithOverrideApp(rest, rest[symbolAppId], context, kernel)), {}, {
3328
+ children: children && computeMenuItemsWithOverrideApp(children, context, kernel)
3329
+ });
3330
+ });
3217
3331
  }
3218
3332
 
3219
- function processMenuTitle(_x17) {
3333
+ function processMenuTitle(_x16) {
3220
3334
  return _processMenuTitle.apply(this, arguments);
3221
3335
  }
3222
3336
 
3223
3337
  function _processMenuTitle() {
3224
- _processMenuTitle = _asyncToGenerator$4(function* (menuData) {
3338
+ _processMenuTitle = _asyncToGenerator$3(function* (menuData) {
3225
3339
  if (menuData.title || isEmpty(menuData.titleDataSource)) {
3226
3340
  return menuData.title;
3227
3341
  }
@@ -3311,37 +3425,29 @@ function requireOverrideApp(data) {
3311
3425
  return false;
3312
3426
  }
3313
3427
 
3314
- function computeRealValueWithOverrideApp(_x18, _x19, _x20, _x21) {
3315
- return _computeRealValueWithOverrideApp.apply(this, arguments);
3316
- }
3317
-
3318
- function _computeRealValueWithOverrideApp() {
3319
- _computeRealValueWithOverrideApp = _asyncToGenerator$4(function* (data, overrideAppId, context, kernel) {
3320
- var newContext = context;
3428
+ function computeRealValueWithOverrideApp(data, overrideAppId, context, kernel) {
3429
+ var newContext = context;
3321
3430
 
3322
- if (overrideAppId !== context.app.id && requireOverrideApp(data)) {
3323
- var storyboard = kernel.bootstrapData.storyboards.find(story => story.app.id === overrideAppId);
3431
+ if (overrideAppId !== context.app.id && requireOverrideApp(data)) {
3432
+ var storyboard = kernel.bootstrapData.storyboards.find(story => story.app.id === overrideAppId);
3324
3433
 
3325
- if (storyboard) {
3326
- yield kernel.fulfilStoryboard(storyboard);
3327
- newContext = _objectSpread(_objectSpread({}, context), {}, {
3328
- overrideApp: storyboard.app
3329
- });
3330
- }
3434
+ if (storyboard) {
3435
+ newContext = _objectSpread(_objectSpread({}, context), {}, {
3436
+ overrideApp: storyboard.app
3437
+ });
3331
3438
  }
3439
+ }
3332
3440
 
3333
- return computeRealValue(data, newContext, true, {
3334
- ignoreSymbols: true
3335
- });
3441
+ return computeRealValue(data, newContext, true, {
3442
+ ignoreSymbols: true
3336
3443
  });
3337
- return _computeRealValueWithOverrideApp.apply(this, arguments);
3338
3444
  }
3339
3445
 
3340
3446
  var lazyBrickRegistry = new Map();
3341
3447
  var requestsMap = new WeakMap();
3342
3448
  function registerLazyBricks(bricks, factory) {
3343
3449
  var factoryWrapper = /*#__PURE__*/function () {
3344
- var _ref = _asyncToGenerator$4(function* () {
3450
+ var _ref = _asyncToGenerator$3(function* () {
3345
3451
  try {
3346
3452
  window.dispatchEvent(new CustomEvent("request.start"));
3347
3453
  yield factory();
@@ -3368,7 +3474,7 @@ function loadLazyBricks(_x) {
3368
3474
  }
3369
3475
 
3370
3476
  function _loadLazyBricks() {
3371
- _loadLazyBricks = _asyncToGenerator$4(function* (bricks) {
3477
+ _loadLazyBricks = _asyncToGenerator$3(function* (bricks) {
3372
3478
  var requests = new Set();
3373
3479
 
3374
3480
  for (var brick of bricks) {
@@ -3489,7 +3595,7 @@ class Runtime {
3489
3595
  }
3490
3596
 
3491
3597
  bootstrap(mountPoints) {
3492
- return _asyncToGenerator$4(function* () {
3598
+ return _asyncToGenerator$3(function* () {
3493
3599
  if (kernel !== undefined) {
3494
3600
  throw new Error("Cannot bootstrap more than once.");
3495
3601
  }
@@ -5777,7 +5883,7 @@ function startPoll(task, _ref, _ref2) {
5777
5883
  }
5778
5884
 
5779
5885
  function _poll() {
5780
- _poll = _asyncToGenerator$4(function* () {
5886
+ _poll = _asyncToGenerator$3(function* () {
5781
5887
  timeoutIdList.delete(currentTimeoutId);
5782
5888
  var shouldStop;
5783
5889
 
@@ -5856,7 +5962,7 @@ function clearPollTimeout() {
5856
5962
 
5857
5963
 
5858
5964
  var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
5859
- var _ref = _asyncToGenerator$4(function* (options) {
5965
+ var _ref = _asyncToGenerator$3(function* (options) {
5860
5966
  return (
5861
5967
  /**! @contract easyops.api.api_gateway.bootstrap_standalone.RuntimeStandalone@1.0.1 */
5862
5968
  (yield http.get("api/v1/runtime_standalone", options)).data
@@ -5874,7 +5980,7 @@ var BootstrapStandaloneApi_runtimeStandalone = /*#__PURE__*/function () {
5874
5980
 
5875
5981
 
5876
5982
  var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
5877
- var _ref = _asyncToGenerator$4(function* (params, options) {
5983
+ var _ref = _asyncToGenerator$3(function* (params, options) {
5878
5984
  return (
5879
5985
  /**! @contract easyops.api.api_gateway.bootstrap_v2.BootstrapV2@1.0.0 */
5880
5986
  (yield http.get("api/auth/v2/bootstrap", _objectSpread(_objectSpread({}, options), {}, {
@@ -5894,7 +6000,7 @@ var BootstrapV2Api_bootstrapV2 = /*#__PURE__*/function () {
5894
6000
 
5895
6001
 
5896
6002
  var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5897
- var _ref = _asyncToGenerator$4(function* (appId, params, options) {
6003
+ var _ref = _asyncToGenerator$3(function* (appId, params, options) {
5898
6004
  return (
5899
6005
  /**! @contract easyops.api.api_gateway.bootstrap_v2.GetAppStoryboardV2@1.0.0 */
5900
6006
  (yield http.get("api/auth/v2/bootstrap/".concat(appId), _objectSpread(_objectSpread({}, options), {}, {
@@ -5914,7 +6020,7 @@ var BootstrapV2Api_getAppStoryboardV2 = /*#__PURE__*/function () {
5914
6020
 
5915
6021
 
5916
6022
  var ContractApi_searchSingleContract = /*#__PURE__*/function () {
5917
- var _ref = _asyncToGenerator$4(function* (data, options) {
6023
+ var _ref = _asyncToGenerator$3(function* (data, options) {
5918
6024
  return (
5919
6025
  /**! @contract easyops.api.api_gateway.contract.SearchSingleContract@1.0.0 */
5920
6026
  (yield http.post("api/contract/single_search", data, options)).data
@@ -5947,7 +6053,7 @@ function getArgsOfCustomApi(_x, _x2) {
5947
6053
  }
5948
6054
 
5949
6055
  function _getArgsOfCustomApi() {
5950
- _getArgsOfCustomApi = _asyncToGenerator$4(function* (provider, originalArgs) {
6056
+ _getArgsOfCustomApi = _asyncToGenerator$3(function* (provider, originalArgs) {
5951
6057
  if (!isCustomApiProvider(provider)) {
5952
6058
  return originalArgs;
5953
6059
  }
@@ -6063,7 +6169,7 @@ function _fetchFlowApiDefinition(_x3) {
6063
6169
  }
6064
6170
 
6065
6171
  function _fetchFlowApiDefinition2() {
6066
- _fetchFlowApiDefinition2 = _asyncToGenerator$4(function* (provider) {
6172
+ _fetchFlowApiDefinition2 = _asyncToGenerator$3(function* (provider) {
6067
6173
  var [namespaceName, nameWithVersion] = provider.split("@");
6068
6174
  var [name, version] = nameWithVersion.split(":");
6069
6175
  var contract;
@@ -6234,10 +6340,12 @@ function listenerFactory(handler, context, runtimeBrick) {
6234
6340
 
6235
6341
  case "context.assign":
6236
6342
  case "context.replace":
6343
+ case "context.refresh":
6237
6344
  return builtinContextListenerFactory(method, handler.args, handler, context);
6238
6345
 
6239
6346
  case "state.update":
6240
- return builtinStateListenerFactory(handler.args, handler, context);
6347
+ case "state.refresh":
6348
+ return builtinStateListenerFactory(method, handler.args, handler, context);
6241
6349
 
6242
6350
  case "tpl.dispatchEvent":
6243
6351
  return builtinTplDispatchEventFactory(handler.args, handler, context);
@@ -6320,7 +6428,7 @@ function listenerFactory(handler, context, runtimeBrick) {
6320
6428
 
6321
6429
  function usingProviderFactory(handler, context, runtimeBrick) {
6322
6430
  return /*#__PURE__*/function () {
6323
- var _ref2 = _asyncToGenerator$4(function* (event) {
6431
+ var _ref2 = _asyncToGenerator$3(function* (event) {
6324
6432
  if (!looseCheckIf(handler, _objectSpread(_objectSpread({}, context), {}, {
6325
6433
  event
6326
6434
  }))) {
@@ -6381,7 +6489,7 @@ function builtinContextListenerFactory(method, args, ifContainer, context) {
6381
6489
  };
6382
6490
  }
6383
6491
 
6384
- function builtinStateListenerFactory(args, ifContainer, context) {
6492
+ function builtinStateListenerFactory(method, args, ifContainer, context) {
6385
6493
  return function (event) {
6386
6494
  if (!looseCheckIf(ifContainer, _objectSpread(_objectSpread({}, context), {}, {
6387
6495
  event
@@ -6391,7 +6499,7 @@ function builtinStateListenerFactory(args, ifContainer, context) {
6391
6499
 
6392
6500
  var tplContext = getTplContext(context.tplContextId);
6393
6501
  var [name, value] = argsFactory(args, context, event);
6394
- tplContext.state.updateValue(name, value, "replace");
6502
+ tplContext.state.updateValue(name, value, method === "refresh" ? method : "replace");
6395
6503
  };
6396
6504
  }
6397
6505
 
@@ -6597,7 +6705,7 @@ function brickCallback(_x2, _x3, _x4, _x5, _x6, _x7, _x8) {
6597
6705
  }
6598
6706
 
6599
6707
  function _brickCallback() {
6600
- _brickCallback = _asyncToGenerator$4(function* (target, handler, method, context, runtimeBrick, event, options) {
6708
+ _brickCallback = _asyncToGenerator$3(function* (target, handler, method, context, runtimeBrick, event, options) {
6601
6709
  var _handler$callback, _poll;
6602
6710
 
6603
6711
  if (typeof target[method] !== "function") {
@@ -6610,7 +6718,7 @@ function _brickCallback() {
6610
6718
  }
6611
6719
 
6612
6720
  var task = /*#__PURE__*/function () {
6613
- var _ref3 = _asyncToGenerator$4(function* () {
6721
+ var _ref3 = _asyncToGenerator$3(function* () {
6614
6722
  var computedArgs = argsFactory(handler.args, context, event, options);
6615
6723
 
6616
6724
  if (isUseProviderHandler(handler)) {
@@ -6966,7 +7074,7 @@ var UserAdminApi_searchAllUsersInfo = /*#__PURE__*/function () {
6966
7074
 
6967
7075
 
6968
7076
  var RuntimeApi_runtimeMicroAppStandalone = /*#__PURE__*/function () {
6969
- var _ref = _asyncToGenerator$4(function* (appId, options) {
7077
+ var _ref = _asyncToGenerator$3(function* (appId, options) {
6970
7078
  return (
6971
7079
  /**! @contract easyops.api.micro_app_standalone.runtime.RuntimeMicroAppStandalone@1.0.1 */
6972
7080
  (yield http.get("api/gateway/micro_app_standalone.runtime.RuntimeMicroAppStandalone/api/v1/micro_app_standalone/runtime/".concat(appId), options)).data
@@ -6984,7 +7092,7 @@ var RuntimeApi_runtimeMicroAppStandalone = /*#__PURE__*/function () {
6984
7092
 
6985
7093
 
6986
7094
  var RuntimeApi_searchMicroAppStandalone = /*#__PURE__*/function () {
6987
- var _ref = _asyncToGenerator$4(function* (data, options) {
7095
+ var _ref = _asyncToGenerator$3(function* (data, options) {
6988
7096
  return (
6989
7097
  /**! @contract easyops.api.micro_app_standalone.runtime.SearchMicroAppStandalone@1.0.1 */
6990
7098
  (yield http.post("api/gateway/micro_app_standalone.runtime.SearchMicroAppStandalone/api/v1/micro_app_standalone/search", data, options)).data
@@ -7134,7 +7242,7 @@ function CustomApi(_x) {
7134
7242
  }
7135
7243
 
7136
7244
  function _CustomApi() {
7137
- _CustomApi = _asyncToGenerator$4(function* (_ref2) {
7245
+ _CustomApi = _asyncToGenerator$3(function* (_ref2) {
7138
7246
  var {
7139
7247
  url,
7140
7248
  method = "GET",
@@ -7195,7 +7303,7 @@ function standaloneBootstrap() {
7195
7303
  }
7196
7304
 
7197
7305
  function _standaloneBootstrap() {
7198
- _standaloneBootstrap = _asyncToGenerator$4(function* () {
7306
+ _standaloneBootstrap = _asyncToGenerator$3(function* () {
7199
7307
  var [bootstrapResult, confString, runtimeData] = yield Promise.all([http.get(window.BOOTSTRAP_FILE), http.get("".concat(window.APP_ROOT, "conf.yaml"), {
7200
7308
  responseType: "text"
7201
7309
  }), yield BootstrapStandaloneApi_runtimeStandalone().catch(function (error) {
@@ -8258,7 +8366,7 @@ function asyncExpandCustomTemplate(_x, _x2, _x3) {
8258
8366
  }
8259
8367
 
8260
8368
  function _asyncExpandCustomTemplate() {
8261
- _asyncExpandCustomTemplate = _asyncToGenerator$4(function* (brickConf, proxyBrick, context) {
8369
+ _asyncExpandCustomTemplate = _asyncToGenerator$3(function* (brickConf, proxyBrick, context) {
8262
8370
  var tplContext = new CustomTemplateContext(proxyBrick);
8263
8371
  var template = customTemplateRegistry.get(brickConf.brick);
8264
8372
 
@@ -8759,7 +8867,7 @@ class Kernel {
8759
8867
  _defineProperty$1(this, "loadMagicBrickConfigStarted", false);
8760
8868
 
8761
8869
  _defineProperty$1(this, "_loadDepsOfStoryboard", /*#__PURE__*/function () {
8762
- var _ref = _asyncToGenerator$4(function* (storyboard) {
8870
+ var _ref = _asyncToGenerator$3(function* (storyboard) {
8763
8871
  var {
8764
8872
  brickPackages,
8765
8873
  templatePackages
@@ -8794,7 +8902,7 @@ class Kernel {
8794
8902
  }());
8795
8903
 
8796
8904
  _defineProperty$1(this, "_loadDynamicBricks", /*#__PURE__*/function () {
8797
- var _ref2 = _asyncToGenerator$4(function* (bricks, processors) {
8905
+ var _ref2 = _asyncToGenerator$3(function* (bricks, processors) {
8798
8906
  var filteredBricks = bricks.filter( // Only try to load undefined custom elements.
8799
8907
  item => !customElements.get(item)); // Try to load deps for dynamic added bricks.
8800
8908
 
@@ -8816,7 +8924,7 @@ class Kernel {
8816
8924
  }());
8817
8925
 
8818
8926
  _defineProperty$1(this, "_loadEditorBricks", /*#__PURE__*/function () {
8819
- var _ref3 = _asyncToGenerator$4(function* (editorBricks) {
8927
+ var _ref3 = _asyncToGenerator$3(function* (editorBricks) {
8820
8928
  var {
8821
8929
  dll,
8822
8930
  deps
@@ -8837,7 +8945,7 @@ class Kernel {
8837
8945
  bootstrap(mountPoints) {
8838
8946
  var _this2 = this;
8839
8947
 
8840
- return _asyncToGenerator$4(function* () {
8948
+ return _asyncToGenerator$3(function* () {
8841
8949
  var _this2$bootstrapData$, _this2$bootstrapData$2;
8842
8950
 
8843
8951
  listenDevtoolsEagerly();
@@ -8872,7 +8980,7 @@ class Kernel {
8872
8980
  layoutBootstrap(layout) {
8873
8981
  var _this3 = this;
8874
8982
 
8875
- return _asyncToGenerator$4(function* () {
8983
+ return _asyncToGenerator$3(function* () {
8876
8984
  var supportedLayouts = ["console", "business"];
8877
8985
 
8878
8986
  if (!supportedLayouts.includes(layout)) {
@@ -8924,7 +9032,7 @@ class Kernel {
8924
9032
  }
8925
9033
 
8926
9034
  loadCheckLogin() {
8927
- return _asyncToGenerator$4(function* () {
9035
+ return _asyncToGenerator$3(function* () {
8928
9036
  if (!window.NO_AUTH_GUARD) {
8929
9037
  var auth = yield checkLogin();
8930
9038
 
@@ -8938,7 +9046,7 @@ class Kernel {
8938
9046
  loadMicroApps(params, interceptorParams) {
8939
9047
  var _this4 = this;
8940
9048
 
8941
- return _asyncToGenerator$4(function* () {
9049
+ return _asyncToGenerator$3(function* () {
8942
9050
  var data = yield window.STANDALONE_MICRO_APPS ? standaloneBootstrap() : BootstrapV2Api_bootstrapV2(_objectSpread({
8943
9051
  appFields: "defaultConfig,userConfig,locales,name,homepage,id,currentVersion,installStatus,internal,status,icons",
8944
9052
  ignoreTemplateFields: "templates",
@@ -8969,7 +9077,7 @@ class Kernel {
8969
9077
  fulfilStoryboard(storyboard) {
8970
9078
  var _this5 = this;
8971
9079
 
8972
- return _asyncToGenerator$4(function* () {
9080
+ return _asyncToGenerator$3(function* () {
8973
9081
  if (storyboard.$$fulfilled) {
8974
9082
  return;
8975
9083
  }
@@ -8985,10 +9093,11 @@ class Kernel {
8985
9093
  doFulfilStoryboard(storyboard) {
8986
9094
  var _this6 = this;
8987
9095
 
8988
- return _asyncToGenerator$4(function* () {
9096
+ return _asyncToGenerator$3(function* () {
8989
9097
  if (window.STANDALONE_MICRO_APPS) {
8990
9098
  Object.assign(storyboard, {
8991
- $$fulfilled: true
9099
+ $$fulfilled: true,
9100
+ $$fulfilling: null
8992
9101
  });
8993
9102
 
8994
9103
  if (!window.NO_AUTH_GUARD) {
@@ -9021,7 +9130,8 @@ class Kernel {
9021
9130
  routes,
9022
9131
  meta,
9023
9132
  app: _objectSpread(_objectSpread({}, storyboard.app), app),
9024
- $$fulfilled: true
9133
+ $$fulfilled: true,
9134
+ $$fulfilling: null
9025
9135
  });
9026
9136
  }
9027
9137
 
@@ -9030,9 +9140,12 @@ class Kernel {
9030
9140
  }
9031
9141
 
9032
9142
  postProcessStoryboard(storyboard) {
9033
- var _storyboard$meta;
9034
-
9035
9143
  storyboard.app.$$routeAliasMap = scanRouteAliasInStoryboard(storyboard);
9144
+ this.postProcessStoryboardI18n(storyboard);
9145
+ }
9146
+
9147
+ postProcessStoryboardI18n(storyboard) {
9148
+ var _storyboard$meta;
9036
9149
 
9037
9150
  if ((_storyboard$meta = storyboard.meta) !== null && _storyboard$meta !== void 0 && _storyboard$meta.i18n) {
9038
9151
  // Prefix to avoid conflict between brick package's i18n namespace.
@@ -9045,10 +9158,70 @@ class Kernel {
9045
9158
  }
9046
9159
  }
9047
9160
 
9161
+ fulfilStoryboardI18n(appIds) {
9162
+ var _this7 = this;
9163
+
9164
+ return _asyncToGenerator$3(function* () {
9165
+ // Ignore already fulfilled apps.
9166
+ var filteredStoryboards = appIds.map(appId => _this7.bootstrapData.storyboards.find(story => story.app.id === appId)).filter(story => story && !story.$$fulfilled && !story.$$i18nFulfilled);
9167
+
9168
+ if (window.STANDALONE_MICRO_APPS) {
9169
+ // Fallback to fullfil whole storyboard for standalone micro-apps.
9170
+ yield Promise.all(filteredStoryboards.map(story => _this7.fulfilStoryboard(story)));
9171
+ return;
9172
+ } // Do not fulfil i18n if the app is doing a whole fulfilling.
9173
+
9174
+
9175
+ var fulfilling = [];
9176
+ var filteredAppIds = [];
9177
+
9178
+ for (var story of filteredStoryboards) {
9179
+ if (story.$$fulfilling) {
9180
+ fulfilling.push(story.$$fulfilling);
9181
+ } else {
9182
+ filteredAppIds.push(story.app.id);
9183
+ }
9184
+ }
9185
+
9186
+ if (filteredAppIds.length === 0) {
9187
+ // Still wait for these whole fulfilling.
9188
+ yield Promise.all(fulfilling);
9189
+ return;
9190
+ }
9191
+
9192
+ var [{
9193
+ i18nInfo
9194
+ }] = yield Promise.all([InstalledMicroAppApi_getI18NData({
9195
+ appIds: filteredAppIds.join(",")
9196
+ }), // Still wait for these whole fulfilling.
9197
+ ...fulfilling]);
9198
+
9199
+ var _loop = function (appId, i18n) {
9200
+ var storyboard = _this7.bootstrapData.storyboards.find(story => story.app.id === appId);
9201
+
9202
+ Object.assign(storyboard, {
9203
+ meta: _objectSpread(_objectSpread({}, storyboard.meta), {}, {
9204
+ i18n: i18n
9205
+ }),
9206
+ $$i18nFulfilled: true
9207
+ });
9208
+
9209
+ _this7.postProcessStoryboardI18n(storyboard);
9210
+ };
9211
+
9212
+ for (var {
9213
+ appId,
9214
+ i18n
9215
+ } of i18nInfo) {
9216
+ _loop(appId, i18n);
9217
+ }
9218
+ })();
9219
+ }
9220
+
9048
9221
  _dev_only_updateStoryboard(appId, storyboardPatch) {
9049
9222
  var storyboard = this.bootstrapData.storyboards.find(item => item.app.id === appId);
9050
9223
  Object.assign(storyboard, _objectSpread(_objectSpread({}, storyboardPatch), {}, {
9051
- $$fulfilling: Promise.resolve(),
9224
+ $$fulfilling: null,
9052
9225
  $$fulfilled: true,
9053
9226
  $$registerCustomTemplateProcessed: false,
9054
9227
  $$depsProcessed: false
@@ -9171,9 +9344,9 @@ class Kernel {
9171
9344
 
9172
9345
  gracefullyLoadDeps(fn) {
9173
9346
  var _arguments = arguments,
9174
- _this7 = this;
9347
+ _this8 = this;
9175
9348
 
9176
- return _asyncToGenerator$4(function* () {
9349
+ return _asyncToGenerator$3(function* () {
9177
9350
  for (var _len = _arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
9178
9351
  args[_key - 1] = _arguments[_key];
9179
9352
  }
@@ -9185,7 +9358,7 @@ class Kernel {
9185
9358
  // The scripts maybe stale when a user stays in page while upgrades been applied.
9186
9359
  // So we force reloading again automatically.
9187
9360
  // NOTE: reload only once to avoid a infinite loop.
9188
- yield _this7.reloadMicroApps();
9361
+ yield _this8.reloadMicroApps();
9189
9362
  yield fn(...args);
9190
9363
  } else {
9191
9364
  throw e;
@@ -9234,15 +9407,15 @@ class Kernel {
9234
9407
  }
9235
9408
 
9236
9409
  loadDynamicBricksInBrickConf(brickConf) {
9237
- var _this8 = this;
9410
+ var _this9 = this;
9238
9411
 
9239
- return _asyncToGenerator$4(function* () {
9412
+ return _asyncToGenerator$3(function* () {
9240
9413
  // Notice: `brickConf` contains runtime data,
9241
9414
  // which may contains recursive ref,
9242
9415
  // which could cause stack overflow while traversing.
9243
9416
  var bricks = scanBricksInBrickConf(brickConf);
9244
9417
  var processors = scanProcessorsInAny(brickConf);
9245
- yield _this8.loadDynamicBricks(bricks, processors);
9418
+ yield _this9.loadDynamicBricks(bricks, processors);
9246
9419
  })();
9247
9420
  }
9248
9421
 
@@ -9314,7 +9487,7 @@ class Kernel {
9314
9487
  }
9315
9488
 
9316
9489
  loadUsers() {
9317
- return _asyncToGenerator$4(function* () {
9490
+ return _asyncToGenerator$3(function* () {
9318
9491
  var allUserMap = new Map();
9319
9492
 
9320
9493
  try {
@@ -9351,15 +9524,15 @@ class Kernel {
9351
9524
  }
9352
9525
 
9353
9526
  getMicroAppApiOrchestrationMapAsync() {
9354
- var _this9 = this;
9527
+ var _this10 = this;
9355
9528
 
9356
- return _asyncToGenerator$4(function* () {
9357
- return yield _this9.allMicroAppApiOrchestrationPromise;
9529
+ return _asyncToGenerator$3(function* () {
9530
+ return yield _this10.allMicroAppApiOrchestrationPromise;
9358
9531
  })();
9359
9532
  }
9360
9533
 
9361
9534
  loadMicroAppApiOrchestration(usedCustomApis) {
9362
- return _asyncToGenerator$4(function* () {
9535
+ return _asyncToGenerator$3(function* () {
9363
9536
  var allMicroAppApiOrchestrationMap = new Map();
9364
9537
  var legacyCustomApis = usedCustomApis.filter(item => !item.name.includes(":"));
9365
9538
 
@@ -9401,7 +9574,7 @@ class Kernel {
9401
9574
  }
9402
9575
 
9403
9576
  loadMagicBrickConfig() {
9404
- return _asyncToGenerator$4(function* () {
9577
+ return _asyncToGenerator$3(function* () {
9405
9578
  var allMagicBrickConfigMap = new Map();
9406
9579
 
9407
9580
  try {
@@ -9431,7 +9604,7 @@ class Kernel {
9431
9604
  }
9432
9605
 
9433
9606
  loadRelatedApps() {
9434
- return _asyncToGenerator$4(function* () {
9607
+ return _asyncToGenerator$3(function* () {
9435
9608
  var relatedApps = [];
9436
9609
 
9437
9610
  try {
@@ -9446,14 +9619,14 @@ class Kernel {
9446
9619
  }
9447
9620
 
9448
9621
  getRelatedAppsAsync(appId) {
9449
- var _this10 = this;
9622
+ var _this11 = this;
9450
9623
 
9451
- return _asyncToGenerator$4(function* () {
9624
+ return _asyncToGenerator$3(function* () {
9452
9625
  if (!appId) {
9453
9626
  return [];
9454
9627
  }
9455
9628
 
9456
- var allRelatedApps = yield _this10.allRelatedAppsPromise;
9629
+ var allRelatedApps = yield _this11.allRelatedAppsPromise;
9457
9630
  var thisApp = allRelatedApps.find(item => item.microAppId === appId);
9458
9631
 
9459
9632
  if (!thisApp) {
@@ -9465,38 +9638,38 @@ class Kernel {
9465
9638
  }
9466
9639
 
9467
9640
  updateWorkspaceStack() {
9468
- var _this11 = this;
9641
+ var _this12 = this;
9469
9642
 
9470
- return _asyncToGenerator$4(function* () {
9471
- if (_this11.currentApp && _this11.currentApp.id) {
9643
+ return _asyncToGenerator$3(function* () {
9644
+ if (_this12.currentApp && _this12.currentApp.id) {
9472
9645
  var workspace = {
9473
- appId: _this11.currentApp.id,
9474
- appName: _this11.currentApp.name,
9475
- appLocaleName: _this11.currentApp.localeName,
9476
- url: _this11.currentUrl
9646
+ appId: _this12.currentApp.id,
9647
+ appName: _this12.currentApp.name,
9648
+ appLocaleName: _this12.currentApp.localeName,
9649
+ url: _this12.currentUrl
9477
9650
  };
9478
9651
 
9479
- if (_this11.workspaceStack.length > 0) {
9480
- var previousWorkspace = _this11.workspaceStack[_this11.workspaceStack.length - 1];
9652
+ if (_this12.workspaceStack.length > 0) {
9653
+ var previousWorkspace = _this12.workspaceStack[_this12.workspaceStack.length - 1];
9481
9654
 
9482
- var _relatedApps = yield _this11.getRelatedAppsAsync(previousWorkspace.appId);
9655
+ var _relatedApps = yield _this12.getRelatedAppsAsync(previousWorkspace.appId);
9483
9656
 
9484
- if (_relatedApps.some(item => item.microAppId === _this11.currentApp.id)) {
9657
+ if (_relatedApps.some(item => item.microAppId === _this12.currentApp.id)) {
9485
9658
  Object.assign(previousWorkspace, workspace);
9486
9659
  return;
9487
9660
  }
9488
9661
  }
9489
9662
 
9490
- var relatedApps = yield _this11.getRelatedAppsAsync(_this11.currentApp.id);
9663
+ var relatedApps = yield _this12.getRelatedAppsAsync(_this12.currentApp.id);
9491
9664
 
9492
9665
  if (relatedApps.length > 0) {
9493
- _this11.workspaceStack.push(workspace);
9666
+ _this12.workspaceStack.push(workspace);
9494
9667
 
9495
9668
  return;
9496
9669
  }
9497
9670
  }
9498
9671
 
9499
- _this11.workspaceStack = [];
9672
+ _this12.workspaceStack = [];
9500
9673
  })();
9501
9674
  }
9502
9675
 
@@ -9543,22 +9716,22 @@ class Kernel {
9543
9716
  }
9544
9717
 
9545
9718
  getProviderBrick(provider) {
9546
- var _this12 = this;
9719
+ var _this13 = this;
9547
9720
 
9548
- return _asyncToGenerator$4(function* () {
9721
+ return _asyncToGenerator$3(function* () {
9549
9722
  if (isCustomApiProvider(provider)) {
9550
9723
  provider = CUSTOM_API_PROVIDER;
9551
9724
  }
9552
9725
 
9553
- if (_this12.providerRepository.has(provider)) {
9554
- return _this12.providerRepository.get(provider);
9726
+ if (_this13.providerRepository.has(provider)) {
9727
+ return _this13.providerRepository.get(provider);
9555
9728
  }
9556
9729
 
9557
9730
  if (provider === CUSTOM_API_PROVIDER && !customElements.get(provider)) {
9558
9731
  registerCustomApi();
9559
9732
  }
9560
9733
 
9561
- yield _this12.loadDynamicBricks([provider]);
9734
+ yield _this13.loadDynamicBricks([provider]);
9562
9735
 
9563
9736
  if (!customElements.get(provider)) {
9564
9737
  throw new Error("Provider not defined: \"".concat(provider, "\"."));
@@ -9566,7 +9739,7 @@ class Kernel {
9566
9739
 
9567
9740
  var brick = document.createElement(provider);
9568
9741
 
9569
- _this12.providerRepository.set(provider, brick);
9742
+ _this13.providerRepository.set(provider, brick);
9570
9743
 
9571
9744
  return brick;
9572
9745
  })();
@@ -9580,7 +9753,7 @@ function loadScriptOfDll(_x5) {
9580
9753
  }
9581
9754
 
9582
9755
  function _loadScriptOfDll() {
9583
- _loadScriptOfDll = _asyncToGenerator$4(function* (dlls) {
9756
+ _loadScriptOfDll = _asyncToGenerator$3(function* (dlls) {
9584
9757
  if (dlls.some(dll => dll.startsWith("dll-of-editor-bricks-helper."))) {
9585
9758
  var dllPath = window.DLL_PATH || {};
9586
9759
  yield loadScript(dllPath["react-dnd"], window.CORE_ROOT);
@@ -9738,44 +9911,6 @@ function isRouteConfOfRoutes(conf) {
9738
9911
  return conf.type === "routes";
9739
9912
  }
9740
9913
 
9741
- var misc;
9742
- function getRuntimeMisc() {
9743
- if (!misc) {
9744
- misc = {
9745
- isInIframe: false,
9746
- isInIframeOfSameSite: false,
9747
- isInIframeOfNext: false,
9748
- isInIframeOfVisualBuilder: false,
9749
- isInIframeOfLegacyConsole: false
9750
- };
9751
-
9752
- if (window !== window.parent) {
9753
- misc.isInIframe = true;
9754
-
9755
- try {
9756
- // Handle:
9757
- // - Previewing in visual builder by iframe.
9758
- // - Nesting next in next.
9759
- // - Nesting console in next.
9760
- if (window.origin === window.parent.origin) {
9761
- misc.isInIframeOfSameSite = true;
9762
- var selfIsNext = getBasePath() === "/next/";
9763
- var parentPathname = window.parent.location.pathname;
9764
- var parentIsNext = parentPathname.startsWith("/next/");
9765
- misc.isInIframeOfNext = (Number(selfIsNext) ^ Number(parentIsNext)) === 0;
9766
- misc.isInIframeOfVisualBuilder = parentPathname.startsWith("".concat(parentIsNext ? "/next" : "", "/visual-builder/"));
9767
- misc.isInIframeOfLegacyConsole = selfIsNext && !parentIsNext;
9768
- }
9769
- } catch (e) {// do nothing
9770
- }
9771
- }
9772
-
9773
- Object.freeze(misc);
9774
- }
9775
-
9776
- return misc;
9777
- }
9778
-
9779
9914
  function getSubStoryboardByRoute(storyboard, matcher) {
9780
9915
  function getSubRoutes(routes) {
9781
9916
  return matcher(routes).map(getSubRoute);
@@ -10366,7 +10501,7 @@ class LocationContext {
10366
10501
  mountRoutes(routes, slotId, mountRoutesResult) {
10367
10502
  var _this = this;
10368
10503
 
10369
- return _asyncToGenerator$4(function* () {
10504
+ return _asyncToGenerator$3(function* () {
10370
10505
  var matched = _this.matchRoutes(routes, _this.kernel.nextApp);
10371
10506
 
10372
10507
  var redirect;
@@ -10451,7 +10586,7 @@ class LocationContext {
10451
10586
  mountMenu(menuConf, match, mountRoutesResult) {
10452
10587
  var _this2 = this;
10453
10588
 
10454
- return _asyncToGenerator$4(function* () {
10589
+ return _asyncToGenerator$3(function* () {
10455
10590
  if (menuConf === false) {
10456
10591
  // `route.menu` 设置为 `false` 表示不显示顶栏和侧栏。
10457
10592
  mountRoutesResult.flags.barsHidden = true;
@@ -10541,7 +10676,7 @@ class LocationContext {
10541
10676
  mountProviders(providers, match, slotId, mountRoutesResult) {
10542
10677
  var _this3 = this;
10543
10678
 
10544
- return _asyncToGenerator$4(function* () {
10679
+ return _asyncToGenerator$3(function* () {
10545
10680
  if (Array.isArray(providers)) {
10546
10681
  for (var providerConf of providers) {
10547
10682
  yield _this3.mountBrick(_objectSpread(_objectSpread({}, typeof providerConf === "string" ? {
@@ -10558,7 +10693,7 @@ class LocationContext {
10558
10693
  mountBricks(bricks, match, slotId, mountRoutesResult, tplStack) {
10559
10694
  var _this4 = this;
10560
10695
 
10561
- return _asyncToGenerator$4(function* () {
10696
+ return _asyncToGenerator$3(function* () {
10562
10697
  for (var brickConf of bricks) {
10563
10698
  try {
10564
10699
  yield _this4.mountBrick(brickConf, match, slotId, mountRoutesResult, tplStack === null || tplStack === void 0 ? void 0 : tplStack.slice());
@@ -10592,7 +10727,7 @@ class LocationContext {
10592
10727
  checkResolvableIf(ifContainer, context) {
10593
10728
  var _this5 = this;
10594
10729
 
10595
- return _asyncToGenerator$4(function* () {
10730
+ return _asyncToGenerator$3(function* () {
10596
10731
  if (isObject(ifContainer.if)) {
10597
10732
  var ifChecked = computeRealValue(ifContainer.if, context, true);
10598
10733
  var ifConf = {};
@@ -10605,7 +10740,7 @@ class LocationContext {
10605
10740
  }
10606
10741
 
10607
10742
  preCheckPermissions(container, context) {
10608
- return _asyncToGenerator$4(function* () {
10743
+ return _asyncToGenerator$3(function* () {
10609
10744
  if (isLoggedIn() && !getAuth().isAdmin && container.permissionsPreCheck && Array.isArray(container.permissionsPreCheck)) {
10610
10745
  var usedActions = computeRealValue(container.permissionsPreCheck, context, true);
10611
10746
  yield validatePermissions(usedActions);
@@ -10617,7 +10752,7 @@ class LocationContext {
10617
10752
  var _arguments = arguments,
10618
10753
  _this6 = this;
10619
10754
 
10620
- return _asyncToGenerator$4(function* () {
10755
+ return _asyncToGenerator$3(function* () {
10621
10756
  var _this6$kernel$nextApp, _brickConf$lifeCycle, _brick$lifeCycle;
10622
10757
 
10623
10758
  var tplStack = _arguments.length > 4 && _arguments[4] !== undefined ? _arguments[4] : [];
@@ -10721,7 +10856,7 @@ class LocationContext {
10721
10856
  if (expandedBrickConf.exports) {
10722
10857
  for (var [prop, ctxName] of Object.entries(expandedBrickConf.exports)) {
10723
10858
  if (typeof ctxName === "string" && ctxName.startsWith("CTX.")) {
10724
- _this6.storyboardContextWrapper.set(ctxName.substr(4), {
10859
+ _this6.storyboardContextWrapper.set(ctxName.substring(4), {
10725
10860
  type: "brick-property",
10726
10861
  brick,
10727
10862
  prop
@@ -10955,7 +11090,7 @@ class LocationContext {
10955
11090
  preFetchMenu(data) {
10956
11091
  var _this7 = this;
10957
11092
 
10958
- return _asyncToGenerator$4(function* () {
11093
+ return _asyncToGenerator$3(function* () {
10959
11094
  var useMenus = scanAppGetMenuInAny(data);
10960
11095
 
10961
11096
  if (useMenus.length) {
@@ -11054,7 +11189,7 @@ function makeProviderRefreshable(providerBrick) {
11054
11189
  // },
11055
11190
  $refresh: {
11056
11191
  value: function () {
11057
- var _ref = _asyncToGenerator$4(function* () {
11192
+ var _ref = _asyncToGenerator$3(function* () {
11058
11193
  var {
11059
11194
  ignoreErrors,
11060
11195
  throwErrors,
@@ -11069,7 +11204,7 @@ function makeProviderRefreshable(providerBrick) {
11069
11204
 
11070
11205
  try {
11071
11206
  yield Promise.all(this.$$dependents.map( /*#__PURE__*/function () {
11072
- var _ref3 = _asyncToGenerator$4(function* (_ref2) {
11207
+ var _ref3 = _asyncToGenerator$3(function* (_ref2) {
11073
11208
  var {
11074
11209
  brick,
11075
11210
  method,
@@ -11105,7 +11240,7 @@ function makeProviderRefreshable(providerBrick) {
11105
11240
  }
11106
11241
 
11107
11242
  function _fetchData() {
11108
- _fetchData = _asyncToGenerator$4(function* () {
11243
+ _fetchData = _asyncToGenerator$3(function* () {
11109
11244
  var value = yield promise;
11110
11245
  data = field === null || field === undefined ? value : get(value, field); // The fetched data and its inner objects should never be *injected* again.
11111
11246
 
@@ -11201,7 +11336,7 @@ class Resolver {
11201
11336
  resolve(brickConf, brick, context) {
11202
11337
  var _this = this;
11203
11338
 
11204
- return _asyncToGenerator$4(function* () {
11339
+ return _asyncToGenerator$3(function* () {
11205
11340
  var _brickConf$lifeCycle$, _brickConf$lifeCycle;
11206
11341
 
11207
11342
  var useResolves = ((_brickConf$lifeCycle$ = (_brickConf$lifeCycle = brickConf.lifeCycle) === null || _brickConf$lifeCycle === void 0 ? void 0 : _brickConf$lifeCycle.useResolves) !== null && _brickConf$lifeCycle$ !== void 0 ? _brickConf$lifeCycle$ : []).filter(r => {
@@ -11222,7 +11357,7 @@ class Resolver {
11222
11357
  resolveOne(type, resolveConf, conf, brick, context) {
11223
11358
  var _this2 = this;
11224
11359
 
11225
- return _asyncToGenerator$4(function* () {
11360
+ return _asyncToGenerator$3(function* () {
11226
11361
  var brickConf = conf;
11227
11362
  var propsReference = conf;
11228
11363
  var actualResolveConf;
@@ -11300,20 +11435,34 @@ class Resolver {
11300
11435
  }
11301
11436
  }
11302
11437
 
11303
- var cacheKey = JSON.stringify({
11304
- provider,
11305
- useProvider,
11306
- method,
11307
- args
11308
- });
11438
+ var actualArgs = args ? ref ? args // `args` are already computed for `defineResolves`
11439
+ : context ? computeRealValue(args, context, true) : args : providerBrick.args || [];
11440
+ var cacheKey;
11441
+
11442
+ try {
11443
+ // `actualArgs` may contain circular references, which makes
11444
+ // JSON stringify failed, thus we fallback to original args.
11445
+ cacheKey = JSON.stringify({
11446
+ provider,
11447
+ useProvider,
11448
+ method,
11449
+ actualArgs
11450
+ });
11451
+ } catch (e) {
11452
+ cacheKey = JSON.stringify({
11453
+ provider,
11454
+ useProvider,
11455
+ method,
11456
+ args
11457
+ });
11458
+ }
11459
+
11309
11460
  var promise;
11310
11461
 
11311
11462
  if (_this2.cache.has(cacheKey)) {
11312
11463
  promise = _this2.cache.get(cacheKey);
11313
11464
  } else {
11314
- var actualArgs = args ? ref ? args // `args` are already computed for `defineResolves`
11315
- : context ? computeRealValue(args, context, true) : args : providerBrick.args || [];
11316
- promise = _asyncToGenerator$4(function* () {
11465
+ promise = _asyncToGenerator$3(function* () {
11317
11466
  if (useProvider) {
11318
11467
  actualArgs = yield getArgsOfCustomApi(useProvider, actualArgs);
11319
11468
  }
@@ -11346,7 +11495,7 @@ class Resolver {
11346
11495
  }
11347
11496
 
11348
11497
  function _fetchData() {
11349
- _fetchData = _asyncToGenerator$4(function* () {
11498
+ _fetchData = _asyncToGenerator$3(function* () {
11350
11499
  var value = yield promise;
11351
11500
  data = field === null || field === undefined ? value : get(value, field); // The fetched data and its inner objects should never be *injected* again.
11352
11501
 
@@ -11387,7 +11536,7 @@ class Resolver {
11387
11536
 
11388
11537
  var _loop = function (providerBrick, interval) {
11389
11538
  var request = /*#__PURE__*/function () {
11390
- var _ref2 = _asyncToGenerator$4(function* () {
11539
+ var _ref2 = _asyncToGenerator$3(function* () {
11391
11540
  yield providerBrick.$refresh({
11392
11541
  ignoreErrors: interval.ignoreErrors,
11393
11542
  throwErrors: true,
@@ -11504,7 +11653,7 @@ function preFetchStandaloneInstalledApps(_x) {
11504
11653
  }
11505
11654
 
11506
11655
  function _preFetchStandaloneInstalledApps() {
11507
- _preFetchStandaloneInstalledApps = _asyncToGenerator$4(function* (storyboard) {
11656
+ _preFetchStandaloneInstalledApps = _asyncToGenerator$3(function* (storyboard) {
11508
11657
  var saIds = scanInstalledAppsInStoryboard(storyboard);
11509
11658
  yield fetchStandaloneApps(saIds);
11510
11659
  });
@@ -11516,7 +11665,7 @@ function fetchStandaloneApps(_x2) {
11516
11665
  }
11517
11666
 
11518
11667
  function _fetchStandaloneApps() {
11519
- _fetchStandaloneApps = _asyncToGenerator$4(function* (saIds) {
11668
+ _fetchStandaloneApps = _asyncToGenerator$3(function* (saIds) {
11520
11669
  // ignore apps which are already searched
11521
11670
  var searchIds = difference(saIds, Array.from(appIdSet));
11522
11671
 
@@ -11671,14 +11820,14 @@ class Router {
11671
11820
  bootstrap() {
11672
11821
  var _this = this;
11673
11822
 
11674
- return _asyncToGenerator$4(function* () {
11823
+ return _asyncToGenerator$3(function* () {
11675
11824
  var history = getHistory();
11676
11825
  _this.prevLocation = history.location;
11677
11826
 
11678
11827
  _this.locationChangeNotify("", history.location.pathname);
11679
11828
 
11680
11829
  history.listen( /*#__PURE__*/function () {
11681
- var _ref = _asyncToGenerator$4(function* (location, action) {
11830
+ var _ref = _asyncToGenerator$3(function* (location, action) {
11682
11831
  var _this$prevLocation$st, _location$state;
11683
11832
 
11684
11833
  var ignoreRendering = false;
@@ -11740,7 +11889,7 @@ class Router {
11740
11889
  queuedRender(location) {
11741
11890
  var _this2 = this;
11742
11891
 
11743
- return _asyncToGenerator$4(function* () {
11892
+ return _asyncToGenerator$3(function* () {
11744
11893
  _this2.rendering = true;
11745
11894
 
11746
11895
  try {
@@ -11760,7 +11909,7 @@ class Router {
11760
11909
  render(location) {
11761
11910
  var _this3 = this;
11762
11911
 
11763
- return _asyncToGenerator$4(function* () {
11912
+ return _asyncToGenerator$3(function* () {
11764
11913
  var _apiAnalyzer$getInsta, _getLocalAppsTheme;
11765
11914
 
11766
11915
  _this3.state = "initial";
@@ -12521,7 +12670,7 @@ var SingleBrickAsComponent = /*#__PURE__*/React.memo(function SingleBrickAsCompo
12521
12670
 
12522
12671
  return true;
12523
12672
  }, [useBrick, data]);
12524
- var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$4(function* () {
12673
+ var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$3(function* () {
12525
12674
  if (!isBrickAvailable) {
12526
12675
  return null;
12527
12676
  } // If the router state is initial, ignore rendering the sub-brick.
@@ -12561,7 +12710,7 @@ var SingleBrickAsComponent = /*#__PURE__*/React.memo(function SingleBrickAsCompo
12561
12710
  return brick;
12562
12711
  }), [useBrick, data, isBrickAvailable]);
12563
12712
  var innerRefCallback = React.useCallback( /*#__PURE__*/function () {
12564
- var _ref4 = _asyncToGenerator$4(function* (element) {
12713
+ var _ref4 = _asyncToGenerator$3(function* (element) {
12565
12714
  immediatelyRefCallback === null || immediatelyRefCallback === void 0 ? void 0 : immediatelyRefCallback(element);
12566
12715
 
12567
12716
  if (element) {
@@ -12723,7 +12872,7 @@ var ForwardRefSingleBrickAsComponent = /*#__PURE__*/React.memo( /*#__PURE__*/for
12723
12872
  useImperativeHandle(ref, () => {
12724
12873
  return brickRef.current;
12725
12874
  });
12726
- var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$4(function* () {
12875
+ var runtimeBrick = React.useMemo( /*#__PURE__*/_asyncToGenerator$3(function* () {
12727
12876
  if (!isBrickAvailable) {
12728
12877
  return null;
12729
12878
  } // If the router state is initial, ignore rendering the sub-brick.
@@ -12763,7 +12912,7 @@ var ForwardRefSingleBrickAsComponent = /*#__PURE__*/React.memo( /*#__PURE__*/for
12763
12912
  return brick;
12764
12913
  }), [useBrick, data, isBrickAvailable]);
12765
12914
  var innerRefCallback = React.useCallback( /*#__PURE__*/function () {
12766
- var _ref10 = _asyncToGenerator$4(function* (element) {
12915
+ var _ref10 = _asyncToGenerator$3(function* (element) {
12767
12916
  brickRef.current = element;
12768
12917
 
12769
12918
  if (element) {
@@ -14421,7 +14570,7 @@ function fetchProviderArgs(_x, _x2) {
14421
14570
  }
14422
14571
 
14423
14572
  function _fetchProviderArgs() {
14424
- _fetchProviderArgs = _asyncToGenerator$4(function* (provider, args) {
14573
+ _fetchProviderArgs = _asyncToGenerator$3(function* (provider, args) {
14425
14574
  for (var _len = arguments.length, originalArgs = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
14426
14575
  originalArgs[_key - 2] = arguments[_key];
14427
14576
  }
@@ -14445,7 +14594,7 @@ function fetch(_x) {
14445
14594
  }
14446
14595
 
14447
14596
  function _fetch() {
14448
- _fetch = _asyncToGenerator$4(function* (provider) {
14597
+ _fetch = _asyncToGenerator$3(function* (provider) {
14449
14598
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
14450
14599
  args[_key - 1] = arguments[_key];
14451
14600
  }
@@ -14459,7 +14608,7 @@ function _fetch() {
14459
14608
  if (cache.has(cacheKey)) {
14460
14609
  promise = cache.get(cacheKey);
14461
14610
  } else {
14462
- promise = _asyncToGenerator$4(function* () {
14611
+ promise = _asyncToGenerator$3(function* () {
14463
14612
  if (!isCustomApiProvider(provider)) {
14464
14613
  var providerBrick = yield _internalApiGetProviderBrick(provider);
14465
14614
  var providerTagName = providerBrick.tagName.toLowerCase();
@@ -14506,7 +14655,7 @@ function useProvider() {
14506
14655
  var data = useRef(defaults.data);
14507
14656
  var forceUpdate = useReducer(() => ({}), [])[1];
14508
14657
  var doFetch = useCallback( /*#__PURE__*/function () {
14509
- var _ref = _asyncToGenerator$4(function* (provider) {
14658
+ var _ref = _asyncToGenerator$3(function* (provider) {
14510
14659
  try {
14511
14660
  error.current = undefined;
14512
14661
  if (!suspense) setLoading(true);
@@ -14532,7 +14681,7 @@ function useProvider() {
14532
14681
  };
14533
14682
  }(), [provider, customOptions, dependencies, requestInit, suspense, transform, defaults.data, onError]);
14534
14683
  var makeFetch = useCallback( /*#__PURE__*/function () {
14535
- var _ref2 = _asyncToGenerator$4(function* (providerOrBody, args) {
14684
+ var _ref2 = _asyncToGenerator$3(function* (providerOrBody, args) {
14536
14685
  var providerStr = provider;
14537
14686
  var providerArgs = [];
14538
14687
 
@@ -14549,7 +14698,7 @@ function useProvider() {
14549
14698
  var actualArgs = yield fetchProviderArgs(providerStr, providerArgs, requestInit.options);
14550
14699
 
14551
14700
  if (suspense) {
14552
- return _asyncToGenerator$4(function* () {
14701
+ return _asyncToGenerator$3(function* () {
14553
14702
  suspender.current = doFetch(providerStr, ...actualArgs).then(newData => {
14554
14703
  suspenseStatus.current = "success";
14555
14704
  return newData;