esp-js-react 9.0.0-beta.3 → 9.0.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.
@@ -1,317 +1,6 @@
1
- import * as require$$0 from "react";
2
- import require$$0__default, { createContext, useCallback, useContext, useMemo } from "react";
1
+ import * as React from "react";
2
+ import React__default, { createContext, useContext, useCallback, useMemo } from "react";
3
3
  import { DefaultStoreAddress, Logger, utils } from "esp-js";
4
- var jsxRuntime = { exports: {} };
5
- var reactJsxRuntime_production = {};
6
- /**
7
- * @license React
8
- * react-jsx-runtime.production.js
9
- *
10
- * Copyright (c) Meta Platforms, Inc. and affiliates.
11
- *
12
- * This source code is licensed under the MIT license found in the
13
- * LICENSE file in the root directory of this source tree.
14
- */
15
- var hasRequiredReactJsxRuntime_production;
16
- function requireReactJsxRuntime_production() {
17
- if (hasRequiredReactJsxRuntime_production) return reactJsxRuntime_production;
18
- hasRequiredReactJsxRuntime_production = 1;
19
- var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment");
20
- function jsxProd(type, config, maybeKey) {
21
- var key = null;
22
- void 0 !== maybeKey && (key = "" + maybeKey);
23
- void 0 !== config.key && (key = "" + config.key);
24
- if ("key" in config) {
25
- maybeKey = {};
26
- for (var propName in config)
27
- "key" !== propName && (maybeKey[propName] = config[propName]);
28
- } else maybeKey = config;
29
- config = maybeKey.ref;
30
- return {
31
- $$typeof: REACT_ELEMENT_TYPE,
32
- type,
33
- key,
34
- ref: void 0 !== config ? config : null,
35
- props: maybeKey
36
- };
37
- }
38
- reactJsxRuntime_production.Fragment = REACT_FRAGMENT_TYPE;
39
- reactJsxRuntime_production.jsx = jsxProd;
40
- reactJsxRuntime_production.jsxs = jsxProd;
41
- return reactJsxRuntime_production;
42
- }
43
- var reactJsxRuntime_development = {};
44
- /**
45
- * @license React
46
- * react-jsx-runtime.development.js
47
- *
48
- * Copyright (c) Meta Platforms, Inc. and affiliates.
49
- *
50
- * This source code is licensed under the MIT license found in the
51
- * LICENSE file in the root directory of this source tree.
52
- */
53
- var hasRequiredReactJsxRuntime_development;
54
- function requireReactJsxRuntime_development() {
55
- if (hasRequiredReactJsxRuntime_development) return reactJsxRuntime_development;
56
- hasRequiredReactJsxRuntime_development = 1;
57
- "production" !== process.env.NODE_ENV && function() {
58
- function getComponentNameFromType(type) {
59
- if (null == type) return null;
60
- if ("function" === typeof type)
61
- return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
62
- if ("string" === typeof type) return type;
63
- switch (type) {
64
- case REACT_FRAGMENT_TYPE:
65
- return "Fragment";
66
- case REACT_PROFILER_TYPE:
67
- return "Profiler";
68
- case REACT_STRICT_MODE_TYPE:
69
- return "StrictMode";
70
- case REACT_SUSPENSE_TYPE:
71
- return "Suspense";
72
- case REACT_SUSPENSE_LIST_TYPE:
73
- return "SuspenseList";
74
- case REACT_ACTIVITY_TYPE:
75
- return "Activity";
76
- }
77
- if ("object" === typeof type)
78
- switch ("number" === typeof type.tag && console.error(
79
- "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
80
- ), type.$$typeof) {
81
- case REACT_PORTAL_TYPE:
82
- return "Portal";
83
- case REACT_CONTEXT_TYPE:
84
- return type.displayName || "Context";
85
- case REACT_CONSUMER_TYPE:
86
- return (type._context.displayName || "Context") + ".Consumer";
87
- case REACT_FORWARD_REF_TYPE:
88
- var innerType = type.render;
89
- type = type.displayName;
90
- type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
91
- return type;
92
- case REACT_MEMO_TYPE:
93
- return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
94
- case REACT_LAZY_TYPE:
95
- innerType = type._payload;
96
- type = type._init;
97
- try {
98
- return getComponentNameFromType(type(innerType));
99
- } catch (x) {
100
- }
101
- }
102
- return null;
103
- }
104
- function testStringCoercion(value) {
105
- return "" + value;
106
- }
107
- function checkKeyStringCoercion(value) {
108
- try {
109
- testStringCoercion(value);
110
- var JSCompiler_inline_result = false;
111
- } catch (e) {
112
- JSCompiler_inline_result = true;
113
- }
114
- if (JSCompiler_inline_result) {
115
- JSCompiler_inline_result = console;
116
- var JSCompiler_temp_const = JSCompiler_inline_result.error;
117
- var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
118
- JSCompiler_temp_const.call(
119
- JSCompiler_inline_result,
120
- "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
121
- JSCompiler_inline_result$jscomp$0
122
- );
123
- return testStringCoercion(value);
124
- }
125
- }
126
- function getTaskName(type) {
127
- if (type === REACT_FRAGMENT_TYPE) return "<>";
128
- if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE)
129
- return "<...>";
130
- try {
131
- var name = getComponentNameFromType(type);
132
- return name ? "<" + name + ">" : "<...>";
133
- } catch (x) {
134
- return "<...>";
135
- }
136
- }
137
- function getOwner() {
138
- var dispatcher = ReactSharedInternals.A;
139
- return null === dispatcher ? null : dispatcher.getOwner();
140
- }
141
- function UnknownOwner() {
142
- return Error("react-stack-top-frame");
143
- }
144
- function hasValidKey(config) {
145
- if (hasOwnProperty.call(config, "key")) {
146
- var getter = Object.getOwnPropertyDescriptor(config, "key").get;
147
- if (getter && getter.isReactWarning) return false;
148
- }
149
- return void 0 !== config.key;
150
- }
151
- function defineKeyPropWarningGetter(props, displayName) {
152
- function warnAboutAccessingKey() {
153
- specialPropKeyWarningShown || (specialPropKeyWarningShown = true, console.error(
154
- "%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
155
- displayName
156
- ));
157
- }
158
- warnAboutAccessingKey.isReactWarning = true;
159
- Object.defineProperty(props, "key", {
160
- get: warnAboutAccessingKey,
161
- configurable: true
162
- });
163
- }
164
- function elementRefGetterWithDeprecationWarning() {
165
- var componentName = getComponentNameFromType(this.type);
166
- didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = true, console.error(
167
- "Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
168
- ));
169
- componentName = this.props.ref;
170
- return void 0 !== componentName ? componentName : null;
171
- }
172
- function ReactElement(type, key, props, owner, debugStack, debugTask) {
173
- var refProp = props.ref;
174
- type = {
175
- $$typeof: REACT_ELEMENT_TYPE,
176
- type,
177
- key,
178
- props,
179
- _owner: owner
180
- };
181
- null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
182
- enumerable: false,
183
- get: elementRefGetterWithDeprecationWarning
184
- }) : Object.defineProperty(type, "ref", { enumerable: false, value: null });
185
- type._store = {};
186
- Object.defineProperty(type._store, "validated", {
187
- configurable: false,
188
- enumerable: false,
189
- writable: true,
190
- value: 0
191
- });
192
- Object.defineProperty(type, "_debugInfo", {
193
- configurable: false,
194
- enumerable: false,
195
- writable: true,
196
- value: null
197
- });
198
- Object.defineProperty(type, "_debugStack", {
199
- configurable: false,
200
- enumerable: false,
201
- writable: true,
202
- value: debugStack
203
- });
204
- Object.defineProperty(type, "_debugTask", {
205
- configurable: false,
206
- enumerable: false,
207
- writable: true,
208
- value: debugTask
209
- });
210
- Object.freeze && (Object.freeze(type.props), Object.freeze(type));
211
- return type;
212
- }
213
- function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
214
- var children = config.children;
215
- if (void 0 !== children)
216
- if (isStaticChildren)
217
- if (isArrayImpl(children)) {
218
- for (isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++)
219
- validateChildKeys(children[isStaticChildren]);
220
- Object.freeze && Object.freeze(children);
221
- } else
222
- console.error(
223
- "React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
224
- );
225
- else validateChildKeys(children);
226
- if (hasOwnProperty.call(config, "key")) {
227
- children = getComponentNameFromType(type);
228
- var keys = Object.keys(config).filter(function(k) {
229
- return "key" !== k;
230
- });
231
- isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
232
- didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error(
233
- 'A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',
234
- isStaticChildren,
235
- children,
236
- keys,
237
- children
238
- ), didWarnAboutKeySpread[children + isStaticChildren] = true);
239
- }
240
- children = null;
241
- void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
242
- hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
243
- if ("key" in config) {
244
- maybeKey = {};
245
- for (var propName in config)
246
- "key" !== propName && (maybeKey[propName] = config[propName]);
247
- } else maybeKey = config;
248
- children && defineKeyPropWarningGetter(
249
- maybeKey,
250
- "function" === typeof type ? type.displayName || type.name || "Unknown" : type
251
- );
252
- return ReactElement(
253
- type,
254
- children,
255
- maybeKey,
256
- getOwner(),
257
- debugStack,
258
- debugTask
259
- );
260
- }
261
- function validateChildKeys(node) {
262
- isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
263
- }
264
- function isValidElement(object) {
265
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
266
- }
267
- var React = require$$0__default, REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
268
- return null;
269
- };
270
- React = {
271
- react_stack_bottom_frame: function(callStackForError) {
272
- return callStackForError();
273
- }
274
- };
275
- var specialPropKeyWarningShown;
276
- var didWarnAboutElementRef = {};
277
- var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(
278
- React,
279
- UnknownOwner
280
- )();
281
- var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
282
- var didWarnAboutKeySpread = {};
283
- reactJsxRuntime_development.Fragment = REACT_FRAGMENT_TYPE;
284
- reactJsxRuntime_development.jsx = function(type, config, maybeKey) {
285
- var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
286
- return jsxDEVImpl(
287
- type,
288
- config,
289
- maybeKey,
290
- false,
291
- trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
292
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
293
- );
294
- };
295
- reactJsxRuntime_development.jsxs = function(type, config, maybeKey) {
296
- var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
297
- return jsxDEVImpl(
298
- type,
299
- config,
300
- maybeKey,
301
- true,
302
- trackActualOwner ? Error("react-stack-top-frame") : unknownOwnerDebugStack,
303
- trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask
304
- );
305
- };
306
- }();
307
- return reactJsxRuntime_development;
308
- }
309
- if (process.env.NODE_ENV === "production") {
310
- jsxRuntime.exports = requireReactJsxRuntime_production();
311
- } else {
312
- jsxRuntime.exports = requireReactJsxRuntime_development();
313
- }
314
- var jsxRuntimeExports = jsxRuntime.exports;
315
4
  const EventBusContext = createContext(null);
316
5
  const useEventBus = () => {
317
6
  return useContext(EventBusContext);
@@ -332,7 +21,7 @@ const EspEventBusContextProvider = ({ children, bus }) => {
332
21
  let busFromContext = useEventBus();
333
22
  bus = bus || busFromContext;
334
23
  const publishEvent = useCallback(createPublishEvent(bus), [bus]);
335
- return /* @__PURE__ */ jsxRuntimeExports.jsx(EventBusContext.Provider, { value: bus, children: /* @__PURE__ */ jsxRuntimeExports.jsx(PublishEventContext.Provider, { value: publishEvent, children }) });
24
+ return /* @__PURE__ */ React.createElement(EventBusContext.Provider, { value: bus }, /* @__PURE__ */ React.createElement(PublishEventContext.Provider, { value: publishEvent }, children));
336
25
  };
337
26
  const GetStoreIdContext = createContext(null);
338
27
  const useGetStoreId = () => useContext(GetStoreIdContext);
@@ -368,7 +57,7 @@ const EspStoreContextProvider = ({ storeId, children, model }) => {
368
57
  storeId = storeId || storeIdFromContext;
369
58
  const publishStoreEvent = useCallback(createPublishStoreEvent(bus, storeId), [bus, storeId]);
370
59
  const publishStoreEventWithEntityKey = useCallback(createPublishStoreEventWithEntityKey(bus, storeId), [bus, storeId]);
371
- return /* @__PURE__ */ jsxRuntimeExports.jsx(GetStoreIdContext.Provider, { value: storeId, children: /* @__PURE__ */ jsxRuntimeExports.jsx(PublishStoreEventContext.Provider, { value: publishStoreEvent, children: /* @__PURE__ */ jsxRuntimeExports.jsx(PublishStoreEventWithEntityKeyContext.Provider, { value: publishStoreEventWithEntityKey, children: /* @__PURE__ */ jsxRuntimeExports.jsx(GetStoreModelContext.Provider, { value: model, children }) }) }) });
60
+ return /* @__PURE__ */ React.createElement(GetStoreIdContext.Provider, { value: storeId }, /* @__PURE__ */ React.createElement(PublishStoreEventContext.Provider, { value: publishStoreEvent }, /* @__PURE__ */ React.createElement(PublishStoreEventWithEntityKeyContext.Provider, { value: publishStoreEventWithEntityKey }, /* @__PURE__ */ React.createElement(GetStoreModelContext.Provider, { value: model }, children))));
372
61
  };
373
62
  var withSelector = { exports: {} };
374
63
  var useSyncExternalStoreWithSelector_production = {};
@@ -385,11 +74,11 @@ var hasRequiredUseSyncExternalStoreWithSelector_production;
385
74
  function requireUseSyncExternalStoreWithSelector_production() {
386
75
  if (hasRequiredUseSyncExternalStoreWithSelector_production) return useSyncExternalStoreWithSelector_production;
387
76
  hasRequiredUseSyncExternalStoreWithSelector_production = 1;
388
- var React = require$$0__default;
77
+ var React2 = React__default;
389
78
  function is(x, y) {
390
79
  return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
391
80
  }
392
- var objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = React.useSyncExternalStore, useRef = React.useRef, useEffect = React.useEffect, useMemo2 = React.useMemo, useDebugValue = React.useDebugValue;
81
+ var objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = React2.useSyncExternalStore, useRef = React2.useRef, useEffect = React2.useEffect, useMemo2 = React2.useMemo, useDebugValue = React2.useDebugValue;
393
82
  useSyncExternalStoreWithSelector_production.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
394
83
  var instRef = useRef(null);
395
84
  if (null === instRef.current) {
@@ -462,7 +151,7 @@ function requireUseSyncExternalStoreWithSelector_development() {
462
151
  return x === y && (0 !== x || 1 / x === 1 / y) || x !== x && y !== y;
463
152
  }
464
153
  "undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ && "function" === typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());
465
- var React = require$$0__default, objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = React.useSyncExternalStore, useRef = React.useRef, useEffect = React.useEffect, useMemo2 = React.useMemo, useDebugValue = React.useDebugValue;
154
+ var React2 = React__default, objectIs = "function" === typeof Object.is ? Object.is : is, useSyncExternalStore = React2.useSyncExternalStore, useRef = React2.useRef, useEffect = React2.useEffect, useMemo2 = React2.useMemo, useDebugValue = React2.useDebugValue;
466
155
  useSyncExternalStoreWithSelector_development.useSyncExternalStoreWithSelector = function(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) {
467
156
  var instRef = useRef(null);
468
157
  if (null === instRef.current) {
@@ -665,26 +354,26 @@ const ConnectableComponent = ({
665
354
  return null;
666
355
  }
667
356
  let childProps = getChildProps(bus, storeId, rest, model, mapStoreModelToProps, publishEventProps);
668
- let viewElement = view ? require$$0.createElement(view, childProps) : null;
669
- return /* @__PURE__ */ jsxRuntimeExports.jsx(EspStoreContextProvider, { storeId, model, bus, ...childProps, children: viewElement });
357
+ let viewElement = view ? React.createElement(view, childProps) : null;
358
+ return /* @__PURE__ */ React.createElement(EspStoreContextProvider, { storeId, model, bus, ...childProps }, viewElement);
670
359
  };
671
- const EspModulesContext = require$$0.createContext([]);
360
+ const EspModulesContext = React.createContext([]);
672
361
  const RegionView = ({ regionName }) => {
673
362
  const modules = useContext(EspModulesContext);
674
363
  const bindings = useMemo(
675
364
  () => modules.flatMap((m) => m.viewBindings).filter((b) => b.region === regionName),
676
365
  [modules, regionName]
677
366
  );
678
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: bindings.map((binding, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(
367
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, bindings.map((binding, index) => /* @__PURE__ */ React.createElement(
679
368
  ConnectableComponent,
680
369
  {
370
+ key: `${binding.storeId}:${index}`,
681
371
  storeId: binding.storeId,
682
372
  view: binding.viewComponent
683
- },
684
- `${binding.storeId}:${index}`
685
- )) });
373
+ }
374
+ )));
686
375
  };
687
- const EspApp = ({ app, children }) => /* @__PURE__ */ jsxRuntimeExports.jsx(EspEventBusContextProvider, { bus: app.eventBus, children: /* @__PURE__ */ jsxRuntimeExports.jsx(EspModulesContext.Provider, { value: app.modules, children }) });
376
+ const EspApp = ({ app, children }) => /* @__PURE__ */ React.createElement(EspEventBusContextProvider, { bus: app.eventBus }, /* @__PURE__ */ React.createElement(EspModulesContext.Provider, { value: app.modules }, children));
688
377
  export {
689
378
  ConnectableComponent,
690
379
  EspApp,
@@ -1 +1 @@
1
- {"version":3,"file":"esp-react.esm.mjs","sources":["../../../node_modules/react/cjs/react-jsx-runtime.production.js","../../../node_modules/react/cjs/react-jsx-runtime.development.js","../../../node_modules/react/jsx-runtime.js","../src/espEventBusContextProvider.tsx","../src/espStoreContextProvider.tsx","../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js","../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js","../../../node_modules/use-sync-external-store/with-selector.js","../src/useSyncStoreModelWithSelector.ts","../src/connectableComponent.tsx","../src/espModulesContext.ts","../src/regionView.tsx","../src/espApp.tsx"],"sourcesContent":["/**\n * @license React\n * react-jsx-runtime.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\");\nfunction jsxProd(type, config, maybeKey) {\n var key = null;\n void 0 !== maybeKey && (key = \"\" + maybeKey);\n void 0 !== config.key && (key = \"\" + config.key);\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n config = maybeKey.ref;\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n ref: void 0 !== config ? config : null,\n props: maybeKey\n };\n}\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.jsx = jsxProd;\nexports.jsxs = jsxProd;\n","/**\n * @license React\n * react-jsx-runtime.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (\n (\"number\" === typeof type.tag &&\n console.error(\n \"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue.\"\n ),\n type.$$typeof)\n ) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return type.displayName || \"Context\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n }\n function testStringCoercion(value) {\n return \"\" + value;\n }\n function checkKeyStringCoercion(value) {\n try {\n testStringCoercion(value);\n var JSCompiler_inline_result = !1;\n } catch (e) {\n JSCompiler_inline_result = !0;\n }\n if (JSCompiler_inline_result) {\n JSCompiler_inline_result = console;\n var JSCompiler_temp_const = JSCompiler_inline_result.error;\n var JSCompiler_inline_result$jscomp$0 =\n (\"function\" === typeof Symbol &&\n Symbol.toStringTag &&\n value[Symbol.toStringTag]) ||\n value.constructor.name ||\n \"Object\";\n JSCompiler_temp_const.call(\n JSCompiler_inline_result,\n \"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.\",\n JSCompiler_inline_result$jscomp$0\n );\n return testStringCoercion(value);\n }\n }\n function getTaskName(type) {\n if (type === REACT_FRAGMENT_TYPE) return \"<>\";\n if (\n \"object\" === typeof type &&\n null !== type &&\n type.$$typeof === REACT_LAZY_TYPE\n )\n return \"<...>\";\n try {\n var name = getComponentNameFromType(type);\n return name ? \"<\" + name + \">\" : \"<...>\";\n } catch (x) {\n return \"<...>\";\n }\n }\n function getOwner() {\n var dispatcher = ReactSharedInternals.A;\n return null === dispatcher ? null : dispatcher.getOwner();\n }\n function UnknownOwner() {\n return Error(\"react-stack-top-frame\");\n }\n function hasValidKey(config) {\n if (hasOwnProperty.call(config, \"key\")) {\n var getter = Object.getOwnPropertyDescriptor(config, \"key\").get;\n if (getter && getter.isReactWarning) return !1;\n }\n return void 0 !== config.key;\n }\n function defineKeyPropWarningGetter(props, displayName) {\n function warnAboutAccessingKey() {\n specialPropKeyWarningShown ||\n ((specialPropKeyWarningShown = !0),\n console.error(\n \"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)\",\n displayName\n ));\n }\n warnAboutAccessingKey.isReactWarning = !0;\n Object.defineProperty(props, \"key\", {\n get: warnAboutAccessingKey,\n configurable: !0\n });\n }\n function elementRefGetterWithDeprecationWarning() {\n var componentName = getComponentNameFromType(this.type);\n didWarnAboutElementRef[componentName] ||\n ((didWarnAboutElementRef[componentName] = !0),\n console.error(\n \"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.\"\n ));\n componentName = this.props.ref;\n return void 0 !== componentName ? componentName : null;\n }\n function ReactElement(type, key, props, owner, debugStack, debugTask) {\n var refProp = props.ref;\n type = {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n props: props,\n _owner: owner\n };\n null !== (void 0 !== refProp ? refProp : null)\n ? Object.defineProperty(type, \"ref\", {\n enumerable: !1,\n get: elementRefGetterWithDeprecationWarning\n })\n : Object.defineProperty(type, \"ref\", { enumerable: !1, value: null });\n type._store = {};\n Object.defineProperty(type._store, \"validated\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: 0\n });\n Object.defineProperty(type, \"_debugInfo\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: null\n });\n Object.defineProperty(type, \"_debugStack\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugStack\n });\n Object.defineProperty(type, \"_debugTask\", {\n configurable: !1,\n enumerable: !1,\n writable: !0,\n value: debugTask\n });\n Object.freeze && (Object.freeze(type.props), Object.freeze(type));\n return type;\n }\n function jsxDEVImpl(\n type,\n config,\n maybeKey,\n isStaticChildren,\n debugStack,\n debugTask\n ) {\n var children = config.children;\n if (void 0 !== children)\n if (isStaticChildren)\n if (isArrayImpl(children)) {\n for (\n isStaticChildren = 0;\n isStaticChildren < children.length;\n isStaticChildren++\n )\n validateChildKeys(children[isStaticChildren]);\n Object.freeze && Object.freeze(children);\n } else\n console.error(\n \"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.\"\n );\n else validateChildKeys(children);\n if (hasOwnProperty.call(config, \"key\")) {\n children = getComponentNameFromType(type);\n var keys = Object.keys(config).filter(function (k) {\n return \"key\" !== k;\n });\n isStaticChildren =\n 0 < keys.length\n ? \"{key: someKey, \" + keys.join(\": ..., \") + \": ...}\"\n : \"{key: someKey}\";\n didWarnAboutKeySpread[children + isStaticChildren] ||\n ((keys =\n 0 < keys.length ? \"{\" + keys.join(\": ..., \") + \": ...}\" : \"{}\"),\n console.error(\n 'A props object containing a \"key\" prop is being spread into JSX:\\n let props = %s;\\n <%s {...props} />\\nReact keys must be passed directly to JSX without using spread:\\n let props = %s;\\n <%s key={someKey} {...props} />',\n isStaticChildren,\n children,\n keys,\n children\n ),\n (didWarnAboutKeySpread[children + isStaticChildren] = !0));\n }\n children = null;\n void 0 !== maybeKey &&\n (checkKeyStringCoercion(maybeKey), (children = \"\" + maybeKey));\n hasValidKey(config) &&\n (checkKeyStringCoercion(config.key), (children = \"\" + config.key));\n if (\"key\" in config) {\n maybeKey = {};\n for (var propName in config)\n \"key\" !== propName && (maybeKey[propName] = config[propName]);\n } else maybeKey = config;\n children &&\n defineKeyPropWarningGetter(\n maybeKey,\n \"function\" === typeof type\n ? type.displayName || type.name || \"Unknown\"\n : type\n );\n return ReactElement(\n type,\n children,\n maybeKey,\n getOwner(),\n debugStack,\n debugTask\n );\n }\n function validateChildKeys(node) {\n isValidElement(node)\n ? node._store && (node._store.validated = 1)\n : \"object\" === typeof node &&\n null !== node &&\n node.$$typeof === REACT_LAZY_TYPE &&\n (\"fulfilled\" === node._payload.status\n ? isValidElement(node._payload.value) &&\n node._payload.value._store &&\n (node._payload.value._store.validated = 1)\n : node._store && (node._store.validated = 1));\n }\n function isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n }\n var React = require(\"react\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\"),\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n hasOwnProperty = Object.prototype.hasOwnProperty,\n isArrayImpl = Array.isArray,\n createTask = console.createTask\n ? console.createTask\n : function () {\n return null;\n };\n React = {\n react_stack_bottom_frame: function (callStackForError) {\n return callStackForError();\n }\n };\n var specialPropKeyWarningShown;\n var didWarnAboutElementRef = {};\n var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(\n React,\n UnknownOwner\n )();\n var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));\n var didWarnAboutKeySpread = {};\n exports.Fragment = REACT_FRAGMENT_TYPE;\n exports.jsx = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !1,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n exports.jsxs = function (type, config, maybeKey) {\n var trackActualOwner =\n 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;\n return jsxDEVImpl(\n type,\n config,\n maybeKey,\n !0,\n trackActualOwner\n ? Error(\"react-stack-top-frame\")\n : unknownOwnerDebugStack,\n trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask\n );\n };\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n","// notice_start\n/*\n * Copyright 2015 Dev Shop Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// notice_end\n\nimport {StoreAddress, EventBus} from 'esp-js';\nimport {PropsWithChildren, createContext, useContext, useCallback} from 'react';\n\nexport const EventBusContext = createContext<EventBus>(null);\n\n/**\n * Get the esp EventBus from context.\n *\n * To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node:\n *\n * <EspEventBusContextProvider bus={bus}>\n * <YourComponents />\n * </EspEventBusContextProvider>\n */\nexport const useEventBus = () => {\n return useContext(EventBusContext);\n};\n\nexport type PublishEventDelegate = {(storeIdOrStoreAddress: string | StoreAddress, eventType: string, event: any): void; (eventData: { address: string | StoreAddress, eventType: string, event: any }): void; };\nconst createPublishEvent = (bus: EventBus) => {\n function publishEvent(storeIdOrStoreAddress: string | StoreAddress, eventType: string, event: any): void;\n function publishEvent(eventData: { address: string | StoreAddress, eventType: string, event: any }): void;\n function publishEvent(...args: any[]): void {\n if (args.length === 1) {\n bus.publishEvent(args[0].address, args[0].eventType, args[0].event);\n } else {\n bus.publishEvent(args[0], args[1], args[2]);\n }\n }\n return publishEvent;\n};\nexport const PublishEventContext = createContext<PublishEventDelegate>(null);\n\n/**\n * Returns a function which can be used to publish an event.\n *\n * To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node:\n *\n * <EspEventBusContextProvider bus={bus}>\n * <YourComponents />\n * </EspEventBusContextProvider>\n */\nexport const usePublishEvent = () => useContext(PublishEventContext);\n\nexport type EspEventBusContextProviderProps = PropsWithChildren<{ bus: EventBus; }>;\n\n/**\n * Used to set the bus on the EventBusContext making it available to components down the tree via the useEventBus() hook.\n *\n * Also sets up the usePublishEvent() hook so nested components can publish to the bus.\n */\nexport const EspEventBusContextProvider = ({children, bus}: EspEventBusContextProviderProps) => {\n // EventBus may have been set by a higher level version of this component, so we try and get it from context if it's not set by props.\n let busFromContext = useEventBus();\n bus = bus || busFromContext;\n const publishEvent: PublishEventDelegate = useCallback(createPublishEvent(bus), [bus]);\n return (\n <EventBusContext.Provider value={bus}>\n <PublishEventContext.Provider value={publishEvent}>\n {children}\n </PublishEventContext.Provider>\n </EventBusContext.Provider>\n );\n};","import {DefaultStoreAddress, EventBus} from 'esp-js';\nimport {useContext, useCallback, createContext, PropsWithChildren} from 'react';\nimport {useEventBus} from './espEventBusContextProvider';\n\nexport const GetStoreIdContext = createContext<string>(null);\n/**\n * Returns a function to get the ID of the store connected at a higher point in the V-DOM.\n *\n * To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.\n */\nexport const useGetStoreId = () => useContext(GetStoreIdContext);\n\nexport const GetStoreModelContext = createContext<object>(null);\n/**\n * Returns the current model (frozen snapshot) of the store connected at a higher point in the V-DOM.\n *\n * To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.\n */\nexport const useGetStoreModel = <TModel,>() => useContext(GetStoreModelContext) as TModel;\n\nexport type PublishStoreEventDelegate = { (eventType: string, event: any): void; (eventData: {eventType: string, event: any}): void; };\nconst createPublishStoreEvent = (bus: EventBus, storeId: string) => {\n function publishStoreEvent(eventType: string, event: any): void;\n function publishStoreEvent(eventData: {eventType: string, event: any}): void;\n function publishStoreEvent(...args: any[]) {\n if (args.length === 1) {\n bus.publishEvent(storeId, args[0].eventType, args[0].event);\n } else {\n bus.publishEvent(storeId, args[0], args[1]);\n }\n }\n return publishStoreEvent;\n};\nexport const PublishStoreEventContext = createContext<PublishStoreEventDelegate>(null);\n\n/**\n * Returns a function which can be used to publish an event to the store connected at a higher point in the V-DOM.\n *\n * Effectively, this is a version of usePublishEvent() which closes over the relevant storeId.\n *\n * To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.\n */\nexport const usePublishStoreEvent = () => useContext(PublishStoreEventContext);\n\nexport type PublishStoreEventWithEntityKeyDelegate = {(entityKey: string, eventType: string, event: any): void; (eventData: {entityKey: string, eventType: string, event: any}): void; };\nconst createPublishStoreEventWithEntityKey = (bus: EventBus, storeId: string) => {\n function publishStoreEventWithEntityKey(entityKey: string, eventType: string, event: any): void;\n function publishStoreEventWithEntityKey(eventData: {entityKey: string, eventType: string, event: any}): void;\n function publishStoreEventWithEntityKey(...args: any[]) {\n if (args.length === 1) {\n bus.publishEvent(new DefaultStoreAddress(storeId, args[0].entityKey), args[0].eventType, args[0].event);\n } else {\n bus.publishEvent(new DefaultStoreAddress(storeId, args[0]), args[1], args[2]);\n }\n }\n return publishStoreEventWithEntityKey;\n};\nexport const PublishStoreEventWithEntityKeyContext = createContext<PublishStoreEventWithEntityKeyDelegate>(null);\n/**\n * Returns a function which can be used to publish an event to the store connected at a higher point in the V-DOM, allows an entityKey to be specified.\n *\n * Effectively, this is a version of usePublishEvent() which closes over the storeId.\n *\n * To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.\n */\nexport const usePublishStoreEventWithEntityKey = () => useContext(PublishStoreEventWithEntityKeyContext);\n\nexport interface EspStoreContextProviderProps {\n storeId: string;\n model?: any;\n}\n\n/**\n * Sets up various ESP context so ESP hooks are available below this point in the V-DOM\n *\n * To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node.\n * @param storeId\n * @param children\n * @param model\n * @constructor\n */\nexport const EspStoreContextProvider = ({storeId, children, model}: PropsWithChildren<EspStoreContextProviderProps>) => {\n const bus = useEventBus();\n // storeId may have been set by a higher level version of this component, so we try and get it from context if it's not set by props.\n let storeIdFromContext = useGetStoreId();\n storeId = storeId || storeIdFromContext;\n const publishStoreEvent: PublishStoreEventDelegate = useCallback(createPublishStoreEvent(bus, storeId), [bus, storeId]);\n const publishStoreEventWithEntityKey: PublishStoreEventWithEntityKeyDelegate = useCallback(createPublishStoreEventWithEntityKey(bus, storeId), [bus, storeId]);\n return (\n <GetStoreIdContext.Provider value={storeId}>\n <PublishStoreEventContext.Provider value={publishStoreEvent}>\n <PublishStoreEventWithEntityKeyContext.Provider value={publishStoreEventWithEntityKey}>\n <GetStoreModelContext.Provider value={model}>\n {children}\n </GetStoreModelContext.Provider>\n </PublishStoreEventWithEntityKeyContext.Provider>\n </PublishStoreEventContext.Provider>\n </GetStoreIdContext.Provider>\n );\n};\n","/**\n * @license React\n * use-sync-external-store-with-selector.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = React.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\nexports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n};\n","/**\n * @license React\n * use-sync-external-store-with-selector.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n }\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n var React = require(\"react\"),\n objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = React.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\n exports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n ) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot))\n return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n };\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/use-sync-external-store-with-selector.production.js');\n} else {\n module.exports = require('./cjs/use-sync-external-store-with-selector.development.js');\n}\n","import {useMemo} from 'react';\nimport {useSyncExternalStoreWithSelector} from 'use-sync-external-store/with-selector';\nimport {Logger, EventBus, utils} from 'esp-js';\nimport {useEventBus} from './espEventBusContextProvider';\nimport {useGetStoreId} from './espStoreContextProvider';\n\nexport type SyncStoreModelWithSelectorEqualityFn<T> = (last: T, next: T) => boolean;\n\nexport const logger = Logger.create('useSyncStoreModelWithSelector');\n\n/**\n * Options affecting the subscription of the model to the EventBus.\n *\n * Use syncStoreModelWithSelectorOptions() to create an instance of this type with sensible defaults.\n *\n * @param storeId - the storeId of the store to be observed via the esp EventBus.\n * @param equalityFn - Equality function which will be applied against TSelected, defaults to instance equality (a === b).\n */\nexport type SyncStoreModelWithSelectorOptions<TSelected> = {\n storeId?: string,\n equalityFn: SyncStoreModelWithSelectorEqualityFn<TSelected>\n};\n\n/**\n * Convenience API to build SyncStoreModelWithSelectorOptions<TSelected>, has sensible defaulting.\n */\nexport interface SyncStoreModelWithSelectorOptionsBuilder<TSelected> extends SyncStoreModelWithSelectorOptions<TSelected> {\n /**\n * Sets the store ID\n * @param storeId - default if unset: undefined\n */\n setStoreId(storeId: string): this;\n\n /**\n * Equality function used when comparing the last TSelected with the next.\n * @param fn - default if unset: obj instance equality (e.g. a===b)\n */\n setEqualityFn(fn: (a: TSelected, b: TSelected) => boolean): this;\n}\n\n/**\n * Convenience API to create SyncStoreModelWithSelectorOptions\n */\nexport const syncStoreModelWithSelectorOptions = <TSelected>() => {\n let storeId = undefined;\n let equalityFn: SyncStoreModelWithSelectorEqualityFn<TSelected> = (a: TSelected, b: TSelected) => a === b;\n return {\n get storeId() {\n return storeId;\n },\n setStoreId(value: string) {\n storeId = value;\n return this;\n },\n get equalityFn() {\n return equalityFn;\n },\n setEqualityFn(value: SyncStoreModelWithSelectorEqualityFn<TSelected>) {\n equalityFn = value;\n return this;\n }\n } as SyncStoreModelWithSelectorOptionsBuilder<TSelected>;\n};\n\nconst checkArguments = (selector: (model: any) => any, options: SyncStoreModelWithSelectorOptions<any> ) => {\n if (!utils.isFunction(selector)) {\n throw new Error('You must pass a selector function to useSyncStoreModelWithSelector');\n }\n if (!utils.isObject(options)) {\n throw new Error('You must provide options when using useSyncStoreModelWithSelector');\n }\n if (!utils.isFunction(options.equalityFn)) {\n throw new Error('You must provide an equalityFn when using useSyncStoreModelWithSelector');\n }\n};\n\n/**\n * A hook which returns model state from the esp EventBus.\n *\n * This hooks wih observe updates and re-render the component if the model changes.\n *\n * To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node, and optionally EspStoreContextProvider.\n *\n * If the store isn't registered yet, the hook returns null and picks up the model once the store is registered.\n *\n * @param selector - a function to select a selection of the model. It does not need to be memoized: the latest selector is used on each render, and the equalityFn (if any) decides whether a new selection re-renders.\n * @param options\n */\nexport const useSyncStoreModelWithSelector = <TModel, TSelected>(\n selector: (model: TModel) => TSelected,\n options: SyncStoreModelWithSelectorOptions<TSelected> = syncStoreModelWithSelectorOptions<TSelected>()\n): TSelected => {\n checkArguments(selector, options);\n const bus = useEventBus();\n const storeIdFromContext = useGetStoreId();\n const storeId = options?.storeId || storeIdFromContext;\n const equalityFn = options?.equalityFn;\n const dependencies = useMemo(\n () => {\n // Subscribe even if the store isn't registered yet: getStoreModelObservable() supports stores registered later,\n // and emits the model when the store is added.\n const canSubscribe = bus && utils.isString(storeId);\n if (canSubscribe) {\n return createSubscriptionState(bus, storeId);\n }\n return createNoopSubscriptionState();\n },\n [bus, storeId]\n );\n // Wrap the caller's selector on every render so a selector that closes over props/state is never stale.\n // useSyncExternalStoreWithSelector re-runs it when it changes and applies the equalityFn to the result.\n const wrappedSelector = (snapshot: TModel) => snapshot ? selector(snapshot) : null;\n\n // Docs on useSyncExternalStore https://github.com/reactwg/react-18/discussions/86\n // Redux's usage of this: https://github.com/reduxjs/react-redux/blob/master/src/hooks/useSelector.ts\n // Code: https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreWithSelector.js\n return useSyncExternalStoreWithSelector(\n dependencies.subscribe,\n dependencies.getSnapshot,\n undefined,\n wrappedSelector,\n equalityFn,\n );\n};\n\nconst createSubscriptionState = <TModel>(\n bus: EventBus,\n storeId: string,\n) => {\n // Because of how useSyncExternalStore works, there is an implicit dependency between the subscribe and getSnapshot functions.\n // When the subscription receives the new state from the EventBus, it can't pass this directly onto getSnapshot,\n // React calls that when it deems it needs to.\n // Given that, we need to cache the state which getSnapshot will return.\n //\n // Note: the bus subscription is created inside the `subscribe` callback (not here at factory time).\n // This is important for correctness with React StrictMode: StrictMode intentionally unmounts and remounts\n // components to surface side-effect bugs. When the cleanup returned by `subscribe` is called, it disposes\n // the bus subscription and clears `currentModel`. Because the `dependencies` object created by useMemo is\n // reused across the remount (deps haven't changed), any bus subscription created eagerly at useMemo time\n // would already be disposed on remount, leaving `currentModel` permanently null.\n //\n // useSyncExternalStore guarantees that `getSnapshot` is called before `subscribe`, so we initialise\n // `currentModel` lazily from `bus.getStoreModel()` inside `getSnapshot` when it is still null.\n let currentModel: TModel;\n return {\n subscribe: (stateChanged: () => void) => {\n // Subscribe to future model updates from the EventBus.\n // This is called by React when the component mounts (and remounts after StrictMode teardown).\n const modelSubscriptionDisposable = bus\n .getStoreModelObservable<TModel>(storeId)\n .subscribe(\n (m: TModel) => {\n // The model is a frozen immutable snapshot produced by immer after each dispatch cycle.\n // immer only creates a new reference when something changed, so the same reference means no change.\n // This also covers the replay of the current model when we subscribe, which getSnapshot() already returned.\n if (m === currentModel) {\n return;\n }\n currentModel = m;\n stateChanged();\n }\n );\n return () => {\n currentModel = null;\n modelSubscriptionDisposable.dispose();\n };\n },\n // React expects getSnapshot to be pure and stable between renders unless the store has changed.\n // We seed currentModel from bus.getStoreModel() on first call (before subscribe has been called),\n // then keep it up-to-date via the subscription callback above.\n // getStoreModel() throws for a store that's been observed but not registered yet, so check first; until then the snapshot is null.\n getSnapshot: () => {\n if (currentModel == null && bus.isStoreRegistered(storeId)) {\n currentModel = bus.getStoreModel<TModel>(storeId);\n }\n return currentModel;\n },\n };\n};\n\nconst createNoopSubscriptionState = () => ({\n subscribe: () => {\n return () => {};\n },\n getSnapshot: (): null => null,\n});\n","import * as React from 'react';\nimport {useEventBus} from './espEventBusContextProvider';\nimport {useMemo} from 'react';\nimport {EventBus} from 'esp-js';\nimport {EspStoreContextProvider, useGetStoreId} from './espStoreContextProvider';\nimport {syncStoreModelWithSelectorOptions, useSyncStoreModelWithSelector} from './useSyncStoreModelWithSelector';\n\nexport type CreatePublishEventProps<TPublishEventProps> = (publishModelEvent: (eventType: string, event: any) => void) => TPublishEventProps;\n\nexport type MapStoreModelToProps<TModel, TModelMappedToProps, TPublishEventProps = {}> = (model: TModel, publishEventProps: TPublishEventProps) => TModelMappedToProps;\n\nexport interface ConnectableComponentProps<TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}> {\n storeId?: string;\n view?: React.ComponentType<any>;\n createPublishEventProps?: CreatePublishEventProps<TPublishEventProps>;\n mapStoreModelToProps?: MapStoreModelToProps<TModel, TModelMappedToProps, TPublishEventProps>;\n [key: string]: any; // ...rest props, including the result of mapPublish and mapPublish if 'connect' was used\n}\n\nexport interface ConnectableComponentChildProps<TModel = object> {\n storeId: string;\n model: TModel;\n bus: EventBus;\n [key: string]: any; // ...rest props\n}\n\nconst getChildProps = <TModel, TModelMappedToProps, TPublishEventProps>(\n bus: EventBus,\n storeId: string,\n restProps: object,\n model: TModel,\n mapStoreModelToProps: MapStoreModelToProps<TModel, TModelMappedToProps, TPublishEventProps>,\n publishEventProps: TPublishEventProps\n): ConnectableComponentChildProps<TModel> => {\n let childProps = {\n storeId,\n bus: bus,\n ...restProps,\n ...publishEventProps,\n model\n };\n if (mapStoreModelToProps) {\n childProps = {\n ...childProps,\n ...(mapStoreModelToProps(model, publishEventProps) as TModelMappedToProps)\n };\n }\n return childProps;\n};\n\nexport const ConnectableComponent = <TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}>(\n {\n storeId,\n mapStoreModelToProps,\n createPublishEventProps,\n view,\n ...rest\n }: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>\n) => {\n const bus = useEventBus();\n // Note: we always need to render the hooks else react will complain about a different count.\n let storeIdFromContext = useGetStoreId();\n storeId = storeId || storeIdFromContext;\n // createPublishEventProps is captured once per bus/storeId (not re-run when the prop changes),\n // so callers can pass an inline function and still get stable publish props.\n const publishEventProps: TPublishEventProps = useMemo(\n () => {\n if (createPublishEventProps) {\n const publishModelEvent = (eventType: string, event: any) => {\n bus.publishEvent(storeId, eventType, event);\n };\n return createPublishEventProps(publishModelEvent);\n }\n return {} as TPublishEventProps;\n },\n [bus, storeId]\n );\n const model = useSyncStoreModelWithSelector<TModel, TModel>(\n m => m,\n syncStoreModelWithSelectorOptions()\n .setStoreId(storeId)\n );\n if (model == null) {\n return null;\n }\n let childProps = getChildProps(bus, storeId, rest, model, mapStoreModelToProps, publishEventProps);\n let viewElement = view ? React.createElement(view, childProps) : null;\n return (\n <EspStoreContextProvider storeId={storeId} model={model} bus={bus} {...childProps}>\n {viewElement}\n </EspStoreContextProvider>\n );\n};\n","import * as React from 'react';\nimport type { Module } from 'esp-js-ui';\n\nexport const EspModulesContext = React.createContext<ReadonlyArray<Module>>([]);\n","import * as React from 'react';\nimport {useContext, useMemo} from 'react';\nimport { ConnectableComponent } from './connectableComponent';\nimport { EspModulesContext } from './espModulesContext';\n\nexport interface RegionViewProps {\n regionName: string;\n}\n\n/**\n * Renders all view bindings registered for a given region across all loaded modules.\n *\n * Each module declares views with a region token (ModuleBuilder.withView in esp-js-ui).\n * RegionView reads EspModulesContext (populated by EspApp), finds all bindings\n * matching regionName, and mounts a ConnectableComponent for each.\n *\n * Example:\n * const AppRoot = () => (\n * <div>\n * <RegionView regionName='main' />\n * <RegionView regionName='sidebar' />\n * </div>\n * );\n */\nexport const RegionView = ({ regionName }: RegionViewProps) => {\n const modules = useContext(EspModulesContext);\n const bindings = useMemo(\n () => modules\n .flatMap(m => m.viewBindings)\n .filter(b => b.region === regionName),\n [modules, regionName]\n );\n return (\n <>\n {bindings.map((binding, index) => (\n <ConnectableComponent\n // storeId alone isn't unique: a region can hold several views over the same store.\n // Bindings are fixed once the modules are built, so the index is a stable key.\n key={`${binding.storeId}:${index}`}\n storeId={binding.storeId}\n view={binding.viewComponent}\n />\n ))}\n </>\n );\n};\n","import * as React from 'react';\nimport type { App } from 'esp-js-ui';\nimport { EspEventBusContextProvider } from './espEventBusContextProvider';\nimport { EspModulesContext } from './espModulesContext';\n\nexport interface EspAppProps {\n app: App;\n children: React.ReactNode;\n}\n\n/**\n * Wraps an application root with the ESP context providers.\n *\n * Provides the EventBus (via EspEventBusContextProvider) and the loaded\n * modules list (via EspModulesContext) so that RegionView and any\n * esp-js-react hooks work without additional setup in the root component.\n *\n * Multiple EspApp instances can be mounted independently in the same DOM\n * for multi-app scenarios.\n *\n * Example:\n * await app.start();\n * ReactDOM.createRoot(document.getElementById('root')).render(\n * <EspApp app={app}>\n * <AppShell />\n * </EspApp>\n * );\n */\nexport const EspApp = ({ app, children }: EspAppProps) => (\n <EspEventBusContextProvider bus={app.eventBus}>\n <EspModulesContext.Provider value={app.modules}>\n {children}\n </EspModulesContext.Provider>\n </EspEventBusContextProvider>\n);\n"],"names":["require$$0","jsxRuntimeModule","require$$1","jsx","useMemo","withSelectorModule","useSyncExternalStoreWithSelector","React","Fragment"],"mappings":";;;;;;;;;;;;;;;;;;AAWA,MAAI,qBAAqB,OAAO,IAAI,4BAA4B,GAC9D,sBAAsB,OAAO,IAAI,gBAAgB;AACnD,WAAS,QAAQ,MAAM,QAAQ,UAAU;AACvC,QAAI,MAAM;AACV,eAAW,aAAa,MAAM,KAAK;AACnC,eAAW,OAAO,QAAQ,MAAM,KAAK,OAAO;AAC5C,QAAI,SAAS,QAAQ;AACnB,iBAAW,CAAA;AACX,eAAS,YAAY;AACnB,kBAAU,aAAa,SAAS,QAAQ,IAAI,OAAO,QAAQ;AAAA,IACjE,MAAS,YAAW;AAClB,aAAS,SAAS;AAClB,WAAO;AAAA,MACL,UAAU;AAAA,MACV;AAAA,MACA;AAAA,MACA,KAAK,WAAW,SAAS,S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EAAE,KAAK,SAAA,4CACzB,4BAAA,EAA2B,KAAK,IAAI,UACjC,UAAAA,kCAAAA,IAAC,kBAAkB,UAAlB,EAA2B,OAAO,IAAI,SAClC,UACL,EAAA,CACJ;","x_google_ignoreList":[0,1,2,5,6,7]}
1
+ {"version":3,"file":"esp-react.esm.mjs","sources":["../src/espEventBusContextProvider.tsx","../src/espStoreContextProvider.tsx","../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.production.js","../../../node_modules/use-sync-external-store/cjs/use-sync-external-store-with-selector.development.js","../../../node_modules/use-sync-external-store/with-selector.js","../src/useSyncStoreModelWithSelector.ts","../src/connectableComponent.tsx","../src/espModulesContext.ts","../src/regionView.tsx","../src/espApp.tsx"],"sourcesContent":["// notice_start\n/*\n * Copyright 2015 Dev Shop Limited\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// notice_end\n\nimport {StoreAddress, EventBus} from 'esp-js';\nimport * as React from 'react';\nimport {PropsWithChildren, createContext, useContext, useCallback} from 'react';\n\nexport const EventBusContext = createContext<EventBus>(null);\n\n/**\n * Get the esp EventBus from context.\n *\n * To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node:\n *\n * <EspEventBusContextProvider bus={bus}>\n * <YourComponents />\n * </EspEventBusContextProvider>\n */\nexport const useEventBus = () => {\n return useContext(EventBusContext);\n};\n\nexport type PublishEventDelegate = {(storeIdOrStoreAddress: string | StoreAddress, eventType: string, event: any): void; (eventData: { address: string | StoreAddress, eventType: string, event: any }): void; };\nconst createPublishEvent = (bus: EventBus) => {\n function publishEvent(storeIdOrStoreAddress: string | StoreAddress, eventType: string, event: any): void;\n function publishEvent(eventData: { address: string | StoreAddress, eventType: string, event: any }): void;\n function publishEvent(...args: any[]): void {\n if (args.length === 1) {\n bus.publishEvent(args[0].address, args[0].eventType, args[0].event);\n } else {\n bus.publishEvent(args[0], args[1], args[2]);\n }\n }\n return publishEvent;\n};\nexport const PublishEventContext = createContext<PublishEventDelegate>(null);\n\n/**\n * Returns a function which can be used to publish an event.\n *\n * To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node:\n *\n * <EspEventBusContextProvider bus={bus}>\n * <YourComponents />\n * </EspEventBusContextProvider>\n */\nexport const usePublishEvent = () => useContext(PublishEventContext);\n\nexport type EspEventBusContextProviderProps = PropsWithChildren<{ bus: EventBus; }>;\n\n/**\n * Used to set the bus on the EventBusContext making it available to components down the tree via the useEventBus() hook.\n *\n * Also sets up the usePublishEvent() hook so nested components can publish to the bus.\n */\nexport const EspEventBusContextProvider = ({children, bus}: EspEventBusContextProviderProps) => {\n // EventBus may have been set by a higher level version of this component, so we try and get it from context if it's not set by props.\n let busFromContext = useEventBus();\n bus = bus || busFromContext;\n const publishEvent: PublishEventDelegate = useCallback(createPublishEvent(bus), [bus]);\n return (\n <EventBusContext.Provider value={bus}>\n <PublishEventContext.Provider value={publishEvent}>\n {children}\n </PublishEventContext.Provider>\n </EventBusContext.Provider>\n );\n};","import {DefaultStoreAddress, EventBus} from 'esp-js';\nimport * as React from 'react';\nimport {useContext, useCallback, createContext, PropsWithChildren} from 'react';\nimport {useEventBus} from './espEventBusContextProvider';\n\nexport const GetStoreIdContext = createContext<string>(null);\n/**\n * Returns a function to get the ID of the store connected at a higher point in the V-DOM.\n *\n * To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.\n */\nexport const useGetStoreId = () => useContext(GetStoreIdContext);\n\nexport const GetStoreModelContext = createContext<object>(null);\n/**\n * Returns the current model (frozen snapshot) of the store connected at a higher point in the V-DOM.\n *\n * To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.\n */\nexport const useGetStoreModel = <TModel,>() => useContext(GetStoreModelContext) as TModel;\n\nexport type PublishStoreEventDelegate = { (eventType: string, event: any): void; (eventData: {eventType: string, event: any}): void; };\nconst createPublishStoreEvent = (bus: EventBus, storeId: string) => {\n function publishStoreEvent(eventType: string, event: any): void;\n function publishStoreEvent(eventData: {eventType: string, event: any}): void;\n function publishStoreEvent(...args: any[]) {\n if (args.length === 1) {\n bus.publishEvent(storeId, args[0].eventType, args[0].event);\n } else {\n bus.publishEvent(storeId, args[0], args[1]);\n }\n }\n return publishStoreEvent;\n};\nexport const PublishStoreEventContext = createContext<PublishStoreEventDelegate>(null);\n\n/**\n * Returns a function which can be used to publish an event to the store connected at a higher point in the V-DOM.\n *\n * Effectively, this is a version of usePublishEvent() which closes over the relevant storeId.\n *\n * To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.\n */\nexport const usePublishStoreEvent = () => useContext(PublishStoreEventContext);\n\nexport type PublishStoreEventWithEntityKeyDelegate = {(entityKey: string, eventType: string, event: any): void; (eventData: {entityKey: string, eventType: string, event: any}): void; };\nconst createPublishStoreEventWithEntityKey = (bus: EventBus, storeId: string) => {\n function publishStoreEventWithEntityKey(entityKey: string, eventType: string, event: any): void;\n function publishStoreEventWithEntityKey(eventData: {entityKey: string, eventType: string, event: any}): void;\n function publishStoreEventWithEntityKey(...args: any[]) {\n if (args.length === 1) {\n bus.publishEvent(new DefaultStoreAddress(storeId, args[0].entityKey), args[0].eventType, args[0].event);\n } else {\n bus.publishEvent(new DefaultStoreAddress(storeId, args[0]), args[1], args[2]);\n }\n }\n return publishStoreEventWithEntityKey;\n};\nexport const PublishStoreEventWithEntityKeyContext = createContext<PublishStoreEventWithEntityKeyDelegate>(null);\n/**\n * Returns a function which can be used to publish an event to the store connected at a higher point in the V-DOM, allows an entityKey to be specified.\n *\n * Effectively, this is a version of usePublishEvent() which closes over the storeId.\n *\n * To use this, please ensure your V-DOM has the EspStoreContextProvider at a higher node.\n */\nexport const usePublishStoreEventWithEntityKey = () => useContext(PublishStoreEventWithEntityKeyContext);\n\nexport interface EspStoreContextProviderProps {\n storeId: string;\n model?: any;\n}\n\n/**\n * Sets up various ESP context so ESP hooks are available below this point in the V-DOM\n *\n * To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node.\n * @param storeId\n * @param children\n * @param model\n * @constructor\n */\nexport const EspStoreContextProvider = ({storeId, children, model}: PropsWithChildren<EspStoreContextProviderProps>) => {\n const bus = useEventBus();\n // storeId may have been set by a higher level version of this component, so we try and get it from context if it's not set by props.\n let storeIdFromContext = useGetStoreId();\n storeId = storeId || storeIdFromContext;\n const publishStoreEvent: PublishStoreEventDelegate = useCallback(createPublishStoreEvent(bus, storeId), [bus, storeId]);\n const publishStoreEventWithEntityKey: PublishStoreEventWithEntityKeyDelegate = useCallback(createPublishStoreEventWithEntityKey(bus, storeId), [bus, storeId]);\n return (\n <GetStoreIdContext.Provider value={storeId}>\n <PublishStoreEventContext.Provider value={publishStoreEvent}>\n <PublishStoreEventWithEntityKeyContext.Provider value={publishStoreEventWithEntityKey}>\n <GetStoreModelContext.Provider value={model}>\n {children}\n </GetStoreModelContext.Provider>\n </PublishStoreEventWithEntityKeyContext.Provider>\n </PublishStoreEventContext.Provider>\n </GetStoreIdContext.Provider>\n );\n};\n","/**\n * @license React\n * use-sync-external-store-with-selector.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = React.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\nexports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot)) return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n};\n","/**\n * @license React\n * use-sync-external-store-with-selector.development.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\n\"production\" !== process.env.NODE_ENV &&\n (function () {\n function is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n }\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());\n var React = require(\"react\"),\n objectIs = \"function\" === typeof Object.is ? Object.is : is,\n useSyncExternalStore = React.useSyncExternalStore,\n useRef = React.useRef,\n useEffect = React.useEffect,\n useMemo = React.useMemo,\n useDebugValue = React.useDebugValue;\n exports.useSyncExternalStoreWithSelector = function (\n subscribe,\n getSnapshot,\n getServerSnapshot,\n selector,\n isEqual\n ) {\n var instRef = useRef(null);\n if (null === instRef.current) {\n var inst = { hasValue: !1, value: null };\n instRef.current = inst;\n } else inst = instRef.current;\n instRef = useMemo(\n function () {\n function memoizedSelector(nextSnapshot) {\n if (!hasMemo) {\n hasMemo = !0;\n memoizedSnapshot = nextSnapshot;\n nextSnapshot = selector(nextSnapshot);\n if (void 0 !== isEqual && inst.hasValue) {\n var currentSelection = inst.value;\n if (isEqual(currentSelection, nextSnapshot))\n return (memoizedSelection = currentSelection);\n }\n return (memoizedSelection = nextSnapshot);\n }\n currentSelection = memoizedSelection;\n if (objectIs(memoizedSnapshot, nextSnapshot))\n return currentSelection;\n var nextSelection = selector(nextSnapshot);\n if (void 0 !== isEqual && isEqual(currentSelection, nextSelection))\n return (memoizedSnapshot = nextSnapshot), currentSelection;\n memoizedSnapshot = nextSnapshot;\n return (memoizedSelection = nextSelection);\n }\n var hasMemo = !1,\n memoizedSnapshot,\n memoizedSelection,\n maybeGetServerSnapshot =\n void 0 === getServerSnapshot ? null : getServerSnapshot;\n return [\n function () {\n return memoizedSelector(getSnapshot());\n },\n null === maybeGetServerSnapshot\n ? void 0\n : function () {\n return memoizedSelector(maybeGetServerSnapshot());\n }\n ];\n },\n [getSnapshot, getServerSnapshot, selector, isEqual]\n );\n var value = useSyncExternalStore(subscribe, instRef[0], instRef[1]);\n useEffect(\n function () {\n inst.hasValue = !0;\n inst.value = value;\n },\n [value]\n );\n useDebugValue(value);\n return value;\n };\n \"undefined\" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ &&\n \"function\" ===\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop &&\n __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error());\n })();\n","'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/use-sync-external-store-with-selector.production.js');\n} else {\n module.exports = require('./cjs/use-sync-external-store-with-selector.development.js');\n}\n","import {useMemo} from 'react';\nimport {useSyncExternalStoreWithSelector} from 'use-sync-external-store/with-selector';\nimport {Logger, EventBus, utils} from 'esp-js';\nimport {useEventBus} from './espEventBusContextProvider';\nimport {useGetStoreId} from './espStoreContextProvider';\n\nexport type SyncStoreModelWithSelectorEqualityFn<T> = (last: T, next: T) => boolean;\n\nexport const logger = Logger.create('useSyncStoreModelWithSelector');\n\n/**\n * Options affecting the subscription of the model to the EventBus.\n *\n * Use syncStoreModelWithSelectorOptions() to create an instance of this type with sensible defaults.\n *\n * @param storeId - the storeId of the store to be observed via the esp EventBus.\n * @param equalityFn - Equality function which will be applied against TSelected, defaults to instance equality (a === b).\n */\nexport type SyncStoreModelWithSelectorOptions<TSelected> = {\n storeId?: string,\n equalityFn: SyncStoreModelWithSelectorEqualityFn<TSelected>\n};\n\n/**\n * Convenience API to build SyncStoreModelWithSelectorOptions<TSelected>, has sensible defaulting.\n */\nexport interface SyncStoreModelWithSelectorOptionsBuilder<TSelected> extends SyncStoreModelWithSelectorOptions<TSelected> {\n /**\n * Sets the store ID\n * @param storeId - default if unset: undefined\n */\n setStoreId(storeId: string): this;\n\n /**\n * Equality function used when comparing the last TSelected with the next.\n * @param fn - default if unset: obj instance equality (e.g. a===b)\n */\n setEqualityFn(fn: (a: TSelected, b: TSelected) => boolean): this;\n}\n\n/**\n * Convenience API to create SyncStoreModelWithSelectorOptions\n */\nexport const syncStoreModelWithSelectorOptions = <TSelected>() => {\n let storeId = undefined;\n let equalityFn: SyncStoreModelWithSelectorEqualityFn<TSelected> = (a: TSelected, b: TSelected) => a === b;\n return {\n get storeId() {\n return storeId;\n },\n setStoreId(value: string) {\n storeId = value;\n return this;\n },\n get equalityFn() {\n return equalityFn;\n },\n setEqualityFn(value: SyncStoreModelWithSelectorEqualityFn<TSelected>) {\n equalityFn = value;\n return this;\n }\n } as SyncStoreModelWithSelectorOptionsBuilder<TSelected>;\n};\n\nconst checkArguments = (selector: (model: any) => any, options: SyncStoreModelWithSelectorOptions<any> ) => {\n if (!utils.isFunction(selector)) {\n throw new Error('You must pass a selector function to useSyncStoreModelWithSelector');\n }\n if (!utils.isObject(options)) {\n throw new Error('You must provide options when using useSyncStoreModelWithSelector');\n }\n if (!utils.isFunction(options.equalityFn)) {\n throw new Error('You must provide an equalityFn when using useSyncStoreModelWithSelector');\n }\n};\n\n/**\n * A hook which returns model state from the esp EventBus.\n *\n * This hooks wih observe updates and re-render the component if the model changes.\n *\n * To use this, please ensure your V-DOM has the EspEventBusContextProvider at a higher node, and optionally EspStoreContextProvider.\n *\n * If the store isn't registered yet, the hook returns null and picks up the model once the store is registered.\n *\n * @param selector - a function to select a selection of the model. It does not need to be memoized: the latest selector is used on each render, and the equalityFn (if any) decides whether a new selection re-renders.\n * @param options\n */\nexport const useSyncStoreModelWithSelector = <TModel, TSelected>(\n selector: (model: TModel) => TSelected,\n options: SyncStoreModelWithSelectorOptions<TSelected> = syncStoreModelWithSelectorOptions<TSelected>()\n): TSelected => {\n checkArguments(selector, options);\n const bus = useEventBus();\n const storeIdFromContext = useGetStoreId();\n const storeId = options?.storeId || storeIdFromContext;\n const equalityFn = options?.equalityFn;\n const dependencies = useMemo(\n () => {\n // Subscribe even if the store isn't registered yet: getStoreModelObservable() supports stores registered later,\n // and emits the model when the store is added.\n const canSubscribe = bus && utils.isString(storeId);\n if (canSubscribe) {\n return createSubscriptionState(bus, storeId);\n }\n return createNoopSubscriptionState();\n },\n [bus, storeId]\n );\n // Wrap the caller's selector on every render so a selector that closes over props/state is never stale.\n // useSyncExternalStoreWithSelector re-runs it when it changes and applies the equalityFn to the result.\n const wrappedSelector = (snapshot: TModel) => snapshot ? selector(snapshot) : null;\n\n // Docs on useSyncExternalStore https://github.com/reactwg/react-18/discussions/86\n // Redux's usage of this: https://github.com/reduxjs/react-redux/blob/master/src/hooks/useSelector.ts\n // Code: https://github.com/facebook/react/blob/main/packages/use-sync-external-store/src/useSyncExternalStoreWithSelector.js\n return useSyncExternalStoreWithSelector(\n dependencies.subscribe,\n dependencies.getSnapshot,\n undefined,\n wrappedSelector,\n equalityFn,\n );\n};\n\nconst createSubscriptionState = <TModel>(\n bus: EventBus,\n storeId: string,\n) => {\n // Because of how useSyncExternalStore works, there is an implicit dependency between the subscribe and getSnapshot functions.\n // When the subscription receives the new state from the EventBus, it can't pass this directly onto getSnapshot,\n // React calls that when it deems it needs to.\n // Given that, we need to cache the state which getSnapshot will return.\n //\n // Note: the bus subscription is created inside the `subscribe` callback (not here at factory time).\n // This is important for correctness with React StrictMode: StrictMode intentionally unmounts and remounts\n // components to surface side-effect bugs. When the cleanup returned by `subscribe` is called, it disposes\n // the bus subscription and clears `currentModel`. Because the `dependencies` object created by useMemo is\n // reused across the remount (deps haven't changed), any bus subscription created eagerly at useMemo time\n // would already be disposed on remount, leaving `currentModel` permanently null.\n //\n // useSyncExternalStore guarantees that `getSnapshot` is called before `subscribe`, so we initialise\n // `currentModel` lazily from `bus.getStoreModel()` inside `getSnapshot` when it is still null.\n let currentModel: TModel;\n return {\n subscribe: (stateChanged: () => void) => {\n // Subscribe to future model updates from the EventBus.\n // This is called by React when the component mounts (and remounts after StrictMode teardown).\n const modelSubscriptionDisposable = bus\n .getStoreModelObservable<TModel>(storeId)\n .subscribe(\n (m: TModel) => {\n // The model is a frozen immutable snapshot produced by immer after each dispatch cycle.\n // immer only creates a new reference when something changed, so the same reference means no change.\n // This also covers the replay of the current model when we subscribe, which getSnapshot() already returned.\n if (m === currentModel) {\n return;\n }\n currentModel = m;\n stateChanged();\n }\n );\n return () => {\n currentModel = null;\n modelSubscriptionDisposable.dispose();\n };\n },\n // React expects getSnapshot to be pure and stable between renders unless the store has changed.\n // We seed currentModel from bus.getStoreModel() on first call (before subscribe has been called),\n // then keep it up-to-date via the subscription callback above.\n // getStoreModel() throws for a store that's been observed but not registered yet, so check first; until then the snapshot is null.\n getSnapshot: () => {\n if (currentModel == null && bus.isStoreRegistered(storeId)) {\n currentModel = bus.getStoreModel<TModel>(storeId);\n }\n return currentModel;\n },\n };\n};\n\nconst createNoopSubscriptionState = () => ({\n subscribe: () => {\n return () => {};\n },\n getSnapshot: (): null => null,\n});\n","import * as React from 'react';\nimport {useEventBus} from './espEventBusContextProvider';\nimport {useMemo} from 'react';\nimport {EventBus} from 'esp-js';\nimport {EspStoreContextProvider, useGetStoreId} from './espStoreContextProvider';\nimport {syncStoreModelWithSelectorOptions, useSyncStoreModelWithSelector} from './useSyncStoreModelWithSelector';\n\nexport type CreatePublishEventProps<TPublishEventProps> = (publishModelEvent: (eventType: string, event: any) => void) => TPublishEventProps;\n\nexport type MapStoreModelToProps<TModel, TModelMappedToProps, TPublishEventProps = {}> = (model: TModel, publishEventProps: TPublishEventProps) => TModelMappedToProps;\n\nexport interface ConnectableComponentProps<TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}> {\n storeId?: string;\n view?: React.ComponentType<any>;\n createPublishEventProps?: CreatePublishEventProps<TPublishEventProps>;\n mapStoreModelToProps?: MapStoreModelToProps<TModel, TModelMappedToProps, TPublishEventProps>;\n [key: string]: any; // ...rest props, including the result of mapPublish and mapPublish if 'connect' was used\n}\n\nexport interface ConnectableComponentChildProps<TModel = object> {\n storeId: string;\n model: TModel;\n bus: EventBus;\n [key: string]: any; // ...rest props\n}\n\nconst getChildProps = <TModel, TModelMappedToProps, TPublishEventProps>(\n bus: EventBus,\n storeId: string,\n restProps: object,\n model: TModel,\n mapStoreModelToProps: MapStoreModelToProps<TModel, TModelMappedToProps, TPublishEventProps>,\n publishEventProps: TPublishEventProps\n): ConnectableComponentChildProps<TModel> => {\n let childProps = {\n storeId,\n bus: bus,\n ...restProps,\n ...publishEventProps,\n model\n };\n if (mapStoreModelToProps) {\n childProps = {\n ...childProps,\n ...(mapStoreModelToProps(model, publishEventProps) as TModelMappedToProps)\n };\n }\n return childProps;\n};\n\nexport const ConnectableComponent = <TModel = {}, TPublishEventProps = {}, TModelMappedToProps = {}>(\n {\n storeId,\n mapStoreModelToProps,\n createPublishEventProps,\n view,\n ...rest\n }: ConnectableComponentProps<TModel, TPublishEventProps, TModelMappedToProps>\n) => {\n const bus = useEventBus();\n // Note: we always need to render the hooks else react will complain about a different count.\n let storeIdFromContext = useGetStoreId();\n storeId = storeId || storeIdFromContext;\n // createPublishEventProps is captured once per bus/storeId (not re-run when the prop changes),\n // so callers can pass an inline function and still get stable publish props.\n const publishEventProps: TPublishEventProps = useMemo(\n () => {\n if (createPublishEventProps) {\n const publishModelEvent = (eventType: string, event: any) => {\n bus.publishEvent(storeId, eventType, event);\n };\n return createPublishEventProps(publishModelEvent);\n }\n return {} as TPublishEventProps;\n },\n [bus, storeId]\n );\n const model = useSyncStoreModelWithSelector<TModel, TModel>(\n m => m,\n syncStoreModelWithSelectorOptions()\n .setStoreId(storeId)\n );\n if (model == null) {\n return null;\n }\n let childProps = getChildProps(bus, storeId, rest, model, mapStoreModelToProps, publishEventProps);\n let viewElement = view ? React.createElement(view, childProps) : null;\n return (\n <EspStoreContextProvider storeId={storeId} model={model} bus={bus} {...childProps}>\n {viewElement}\n </EspStoreContextProvider>\n );\n};\n","import * as React from 'react';\nimport type { Module } from 'esp-js-ui';\n\nexport const EspModulesContext = React.createContext<ReadonlyArray<Module>>([]);\n","import * as React from 'react';\nimport {useContext, useMemo} from 'react';\nimport { ConnectableComponent } from './connectableComponent';\nimport { EspModulesContext } from './espModulesContext';\n\nexport interface RegionViewProps {\n regionName: string;\n}\n\n/**\n * Renders all view bindings registered for a given region across all loaded modules.\n *\n * Each module declares views with a region token (ModuleBuilder.withView in esp-js-ui).\n * RegionView reads EspModulesContext (populated by EspApp), finds all bindings\n * matching regionName, and mounts a ConnectableComponent for each.\n *\n * Example:\n * const AppRoot = () => (\n * <div>\n * <RegionView regionName='main' />\n * <RegionView regionName='sidebar' />\n * </div>\n * );\n */\nexport const RegionView = ({ regionName }: RegionViewProps) => {\n const modules = useContext(EspModulesContext);\n const bindings = useMemo(\n () => modules\n .flatMap(m => m.viewBindings)\n .filter(b => b.region === regionName),\n [modules, regionName]\n );\n return (\n <>\n {bindings.map((binding, index) => (\n <ConnectableComponent\n // storeId alone isn't unique: a region can hold several views over the same store.\n // Bindings are fixed once the modules are built, so the index is a stable key.\n key={`${binding.storeId}:${index}`}\n storeId={binding.storeId}\n view={binding.viewComponent}\n />\n ))}\n </>\n );\n};\n","import * as React from 'react';\nimport type { App } from 'esp-js-ui';\nimport { EspEventBusContextProvider } from './espEventBusContextProvider';\nimport { EspModulesContext } from './espModulesContext';\n\nexport interface EspAppProps {\n app: App;\n children: React.ReactNode;\n}\n\n/**\n * Wraps an application root with the ESP context providers.\n *\n * Provides the EventBus (via EspEventBusContextProvider) and the loaded\n * modules list (via EspModulesContext) so that RegionView and any\n * esp-js-react hooks work without additional setup in the root component.\n *\n * Multiple EspApp instances can be mounted independently in the same DOM\n * for multi-app scenarios.\n *\n * Example:\n * await app.start();\n * ReactDOM.createRoot(document.getElementById('root')).render(\n * <EspApp app={app}>\n * <AppShell />\n * </EspApp>\n * );\n */\nexport const EspApp = ({ app, children }: EspAppProps) => (\n <EspEventBusContextProvider bus={app.eventBus}>\n <EspModulesContext.Provider value={app.modules}>\n {children}\n </EspModulesContext.Provider>\n </EspEventBusContextProvider>\n);\n"],"names":["React","require$$0","useMemo","withSelectorModule","require$$1","useSyncExternalStoreWithSelector"],"mappings":";;;AAsBO,MAAM,kBAAkB,cAAwB,IAAI;AAWpD,MAAM,cAAc,MAAM;AAC7B,SAAO,WAAW,eAAe;AACrC;AAGA,MAAM,qBAAqB,CAAC,QAAkB;AAG1C,WAAS,gBAAgB,MAAmB;AACxC,QAAI,KAAK,WAAW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