@superblocksteam/library 2.0.59-next.0 → 2.0.59-next.10

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,7 +1,7 @@
1
1
  import { t as getTracer } from "./utils-AzBGeVXo.js";
2
- import { getQueryParams, pathStringToArray, toMobXPatch } from "@superblocksteam/library-shared";
2
+ import { NO_SELECT_ATTRIBUTE, SELECTOR_ID_ATTRIBUTE, SOURCE_ID_ATTRIBUTE, URL_PARAMS, getQueryParams, pathStringToArray, toMobXPatch } from "@superblocksteam/library-shared";
3
3
  import * as React$1 from "react";
4
- import React, { createContext, isValidElement, useCallback, useContext, useSyncExternalStore } from "react";
4
+ import React, { Component, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useSyncExternalStore } from "react";
5
5
  import { action, entries, isComputedProp, isObservableArray, isObservableMap, isObservableObject, makeAutoObservable, makeObservable, observable, observe, reaction, toJS, values } from "mobx";
6
6
  import { matchRoutes } from "react-router";
7
7
  import { pick, throttle } from "lodash";
@@ -9,11 +9,13 @@ import { ApiResponseType, OrchestratorViewMode, SUPERBLOCKS_AUTHORIZATION_HEADER
9
9
  import { NotificationPosition } from "@superblocksteam/library-shared/types";
10
10
  import isString from "lodash/isString";
11
11
  import { toast } from "sonner";
12
- import styled from "styled-components";
12
+ import styled, { keyframes } from "styled-components";
13
13
  import { jsx, jsxs } from "react/jsx-runtime";
14
14
  import { ROOT_CONTEXT, context, propagation, trace } from "@opentelemetry/api";
15
15
  import diff from "microdiff";
16
16
  import { InputType, PropsCategory } from "@superblocksteam/library-shared/props";
17
+ import { Observer } from "mobx-react-lite";
18
+ import polyfill from "@oddbird/css-anchor-positioning/fn";
17
19
 
18
20
  //#region src/lib/internal-details/is-edit-mode.ts
19
21
  const getIsEditMode = () => {
@@ -398,11 +400,13 @@ var SuperblocksEditorBridge = class SuperblocksEditorBridge {
398
400
  editStore.ai.addTargetedSelector(selectorId);
399
401
  return;
400
402
  }
403
+ const label = editStore.runtimeTrackingStore.getComponent(selectorId)?.displayName;
401
404
  this.sendImmediate({
402
405
  type: "ai-updates",
403
406
  payload: {
404
407
  type: "add-component-to-context",
405
- component: sourceId
408
+ component: sourceId,
409
+ label
406
410
  }
407
411
  });
408
412
  }
@@ -929,6 +933,9 @@ var SuperblocksAppContext = class {
929
933
  ...context$2
930
934
  };
931
935
  }
936
+ getGlobal() {
937
+ return this.context;
938
+ }
932
939
  };
933
940
  const context$1 = new SuperblocksAppContext();
934
941
  const SuperblocksContext = createContext(context$1);
@@ -947,39 +954,35 @@ function useSuperblocksContext() {
947
954
  }
948
955
  function useSuperblocksUser() {
949
956
  const context$2 = useSuperblocksContext();
950
- return useSyncExternalStore((onStoreChange) => {
957
+ const user = useSyncExternalStore((onStoreChange) => {
951
958
  return reaction(() => context$2.user, onStoreChange);
952
- }, () => {
953
- return context$2.user;
954
- }, () => {
955
- return context$2.user;
956
- });
959
+ }, () => context$2.user, () => context$2.user);
960
+ return useMemo(() => toJS(user), [user]);
957
961
  }
958
962
  function useSuperblocksGroups() {
959
963
  const context$2 = useSuperblocksContext();
960
- return useSyncExternalStore((onStoreChange) => {
964
+ const groups = useSyncExternalStore((onStoreChange) => {
961
965
  return reaction(() => context$2.groups, onStoreChange);
962
- }, () => {
963
- return context$2.groups;
964
- }, () => {
965
- return context$2.groups;
966
- });
966
+ }, () => context$2.groups, () => context$2.groups);
967
+ return useMemo(() => toJS(groups), [groups]);
967
968
  }
968
969
  function useSuperblocksProfiles() {
969
970
  const context$2 = useSuperblocksContext();
971
+ const profiles = useSyncExternalStore((onStoreChange) => {
972
+ return reaction(() => context$2.profiles, onStoreChange);
973
+ }, () => context$2.profiles, () => context$2.profiles);
970
974
  return {
971
- profiles: useSyncExternalStore((onStoreChange) => {
972
- return reaction(() => context$2.profiles, onStoreChange);
973
- }, () => {
974
- return context$2.profiles;
975
- }, () => {
976
- return context$2.profiles;
977
- }),
975
+ profiles: useMemo(() => toJS(profiles), [profiles]),
978
976
  setProfile: useCallback((profileName) => {
979
977
  context$2.setProfile(profileName);
980
978
  }, [context$2])
981
979
  };
982
980
  }
981
+ function getAppMode() {
982
+ const appMode = new URL(window.location.href).searchParams.get(URL_PARAMS.appMode);
983
+ if (!appMode) console.warn("No app mode found in URL");
984
+ return appMode;
985
+ }
983
986
 
984
987
  //#endregion
985
988
  //#region src/lib/internal-details/lib/resolve-id-singleton.ts
@@ -1026,6 +1029,69 @@ function rejectById(id, payload) {
1026
1029
  }
1027
1030
  }
1028
1031
 
1032
+ //#endregion
1033
+ //#region src/lib/internal-details/lib/features/api-hmr-tracker.ts
1034
+ var ApiHmrTracker = class ApiHmrTracker {
1035
+ static CLEAR_REF_DELAY = 18e4;
1036
+ reloadCount = 0;
1037
+ propagatedReloadCount = 0;
1038
+ seenHashes = /* @__PURE__ */ new Set();
1039
+ lastResultByHash = {};
1040
+ clearRefAfterDelay(value) {
1041
+ clearTimeout(value.clearTimer);
1042
+ value.clearTimer = setTimeout(() => {
1043
+ value.clearTimer = void 0;
1044
+ delete value.hardRef;
1045
+ }, ApiHmrTracker.CLEAR_REF_DELAY);
1046
+ }
1047
+ getAndRefreshResult(callHash) {
1048
+ const lastResult = this.lastResultByHash[callHash];
1049
+ if (!lastResult) return null;
1050
+ const result = lastResult.hardRef ?? lastResult.weakRef.deref();
1051
+ if (result) {
1052
+ this.clearRefAfterDelay(lastResult);
1053
+ return result;
1054
+ }
1055
+ return null;
1056
+ }
1057
+ shouldSkipRun(callHash) {
1058
+ if (!this.seenHashes.has(callHash)) {
1059
+ this.seenHashes.add(callHash);
1060
+ return false;
1061
+ }
1062
+ if (!this.getAndRefreshResult(callHash)) return false;
1063
+ return this.propagatedReloadCount !== this.reloadCount;
1064
+ }
1065
+ getCachedResult(callHash) {
1066
+ return this.getAndRefreshResult(callHash);
1067
+ }
1068
+ setResult(callHash, result) {
1069
+ this.lastResultByHash[callHash] = {
1070
+ weakRef: new WeakRef(result),
1071
+ hardRef: result
1072
+ };
1073
+ this.clearRefAfterDelay(this.lastResultByHash[callHash]);
1074
+ }
1075
+ incReloadCount() {
1076
+ this.reloadCount++;
1077
+ }
1078
+ mountLikeTimer = null;
1079
+ reportJSXActivity() {
1080
+ const reloadCount = this.reloadCount;
1081
+ if (this.mountLikeTimer) clearTimeout(this.mountLikeTimer);
1082
+ this.mountLikeTimer = setTimeout(() => {
1083
+ requestIdleCallback(() => {
1084
+ this.propagatedReloadCount = Math.max(this.propagatedReloadCount, reloadCount);
1085
+ });
1086
+ }, 0);
1087
+ }
1088
+ };
1089
+ const tracker = new ApiHmrTracker();
1090
+ if (import.meta.hot) import.meta.hot.on("vite:beforeUpdate", () => {
1091
+ tracker.incReloadCount();
1092
+ });
1093
+ var api_hmr_tracker_default = tracker;
1094
+
1029
1095
  //#endregion
1030
1096
  //#region src/lib/tracing/context-utils.ts
1031
1097
  function getContextFromTraceHeaders(traceHeaders) {
@@ -1400,7 +1466,7 @@ var ApiManager = class {
1400
1466
  error: void 0
1401
1467
  };
1402
1468
  }
1403
- const result = await this.executeApiInternal({
1469
+ const result = await this.executeApi({
1404
1470
  apiId: context$2.apiId,
1405
1471
  apiName: context$2.apiName,
1406
1472
  path: context$2.path,
@@ -1414,12 +1480,24 @@ var ApiManager = class {
1414
1480
  error: result.error
1415
1481
  };
1416
1482
  }
1417
- @action async runApiByPath({ path, inputs, callId, callback, isTestRun }) {
1483
+ @action async runApiByPath({ path, inputs, callId, callback, isTestRun, injectedCallerId }) {
1484
+ console.log("[api-store.runApiByPath] Called with:", {
1485
+ path,
1486
+ inputs,
1487
+ callId,
1488
+ isTestRun,
1489
+ hasCallback: !!callback
1490
+ });
1418
1491
  await this.awaitInitApiIfNeeded();
1419
1492
  const apiName = path.match(/^\/apis\/([^/]+)\/api\.yaml$/)?.[1];
1420
- if (!apiName) throw new Error(`Invalid path: ${path}`);
1493
+ if (!apiName) {
1494
+ console.error("[api-store.runApiByPath] Invalid path:", path);
1495
+ throw new Error(`Invalid path: ${path}`);
1496
+ }
1497
+ console.log("[api-store.runApiByPath] Extracted apiName:", apiName);
1421
1498
  editorBridge.setApiStarted(apiName);
1422
- const result = await this.executeApiInternal({
1499
+ console.log("[api-store.runApiByPath] Executing API internally...");
1500
+ const result = await this.executeApi({
1423
1501
  apiId: apiName,
1424
1502
  apiName,
1425
1503
  path,
@@ -1427,14 +1505,38 @@ var ApiManager = class {
1427
1505
  options: inputs ?? {},
1428
1506
  callId,
1429
1507
  isTestRun,
1430
- callback
1508
+ callback,
1509
+ injectedCallerId
1431
1510
  });
1511
+ console.log("[api-store.runApiByPath] Execution complete, calling setApiResponse for:", apiName);
1432
1512
  editorBridge.setApiResponse(apiName, result.parsedResult);
1433
1513
  return {
1434
1514
  data: result.data,
1435
1515
  error: result.error
1436
1516
  };
1437
1517
  }
1518
+ getHMRCallHash(params) {
1519
+ return `${params.injectedCallerId ?? ""}-${params.apiId}`;
1520
+ }
1521
+ getCachedHMRExecution(params) {
1522
+ if (params.callId) return null;
1523
+ const hmrCallHash = this.getHMRCallHash(params);
1524
+ if (api_hmr_tracker_default.shouldSkipRun(hmrCallHash)) {
1525
+ const result = api_hmr_tracker_default.getCachedResult(hmrCallHash);
1526
+ if (result) return result;
1527
+ }
1528
+ return null;
1529
+ }
1530
+ async executeApi(params) {
1531
+ if (isEditMode()) {
1532
+ const cachedResult = this.getCachedHMRExecution(params);
1533
+ if (cachedResult) return cachedResult;
1534
+ const result = await this.executeApiInternal(params);
1535
+ api_hmr_tracker_default.setResult(this.getHMRCallHash(params), result);
1536
+ return result;
1537
+ }
1538
+ return this.executeApiInternal(params);
1539
+ }
1438
1540
  async executeApiInternal({ apiId, apiName, path, inputs, options, callId: providedCallId, callback, isTestRun }) {
1439
1541
  const executionStartTime = Date.now();
1440
1542
  const callId = providedCallId ?? `${apiId}-${executionStartTime}-${Math.random().toString(36).substr(2, 9)}`;
@@ -3054,6 +3156,180 @@ function FixWithClarkButton({ identifier, error, onClick }) {
3054
3156
  });
3055
3157
  }
3056
3158
 
3159
+ //#endregion
3160
+ //#region src/lib/internal-details/css-constants.ts
3161
+ const CSS_CLASSES = {
3162
+ SUSPENSE_FALLBACK: "sb-suspense-fallback",
3163
+ ANCHOR_NAME: "sb-anchor-name"
3164
+ };
3165
+
3166
+ //#endregion
3167
+ //#region src/lib/internal-details/lib/suspense/suspense-fallback.tsx
3168
+ const shimmerAnimation = keyframes`
3169
+ 0% {
3170
+ background-position: -200px 0;
3171
+ }
3172
+ 100% {
3173
+ background-position: calc(200px + 100%) 0;
3174
+ }
3175
+ `;
3176
+ const ShimmerDiv = styled.div`
3177
+ min-height: 12px;
3178
+ min-width: 12px;
3179
+ background-color: ${(props) => props.$backgroundColor};
3180
+ border-radius: ${(props) => props.$borderRadius};
3181
+ position: relative;
3182
+ overflow: hidden;
3183
+ background: linear-gradient(
3184
+ 90deg,
3185
+ ${(props) => props.$backgroundColor} 25%,
3186
+ ${(props) => props.$shimmerHighlight} 50%,
3187
+ ${(props) => props.$backgroundColor} 75%
3188
+ );
3189
+ background-size: max(100%, 200px) 100%;
3190
+ animation: ${shimmerAnimation} 5s infinite linear;
3191
+ `;
3192
+ /**
3193
+ * Default fallback component displayed while components are suspended.
3194
+ */
3195
+ function SuspenseFallback({ style, className, noBorderRadius }) {
3196
+ const backgroundColor = "#f8f9fa";
3197
+ const shimmerHighlight = "#ffffff";
3198
+ const borderRadius = noBorderRadius ? "0px" : "4px";
3199
+ const classes = useMemo(() => [CSS_CLASSES.ANCHOR_NAME, className].filter(Boolean).join(" "), [className]);
3200
+ return /* @__PURE__ */ jsx(ShimmerDiv, {
3201
+ $backgroundColor: backgroundColor,
3202
+ $shimmerHighlight: shimmerHighlight,
3203
+ $borderRadius: borderRadius,
3204
+ style: style?.(),
3205
+ className: classes,
3206
+ "data-test": "suspense-fallback"
3207
+ });
3208
+ }
3209
+
3210
+ //#endregion
3211
+ //#region src/lib/user-facing/component-base/error-boundary.tsx
3212
+ const ErrorBoundaryContainer = styled.div`
3213
+ background: white;
3214
+ padding: 10px;
3215
+ display: flex;
3216
+ flex-direction: column;
3217
+ gap: 8px;
3218
+ border: 1px solid ${colors.GREY_100};
3219
+ border-left: 3px solid ${colors.RED_500};
3220
+ border-radius: 4px;
3221
+ width: 100%;
3222
+ color: ${colors.GREY_700};
3223
+ `;
3224
+ const ErrorDetailsContainer = styled.div`
3225
+ display: flex;
3226
+ flex-direction: column;
3227
+ gap: 8px;
3228
+ `;
3229
+ const ErrorActionsContainer = styled.div`
3230
+ display: flex;
3231
+ justify-content: flex-end;
3232
+ align-items: center;
3233
+ gap: 8px;
3234
+ `;
3235
+ var ErrorBoundary = class extends Component {
3236
+ state = {
3237
+ id: generateId(),
3238
+ hasError: false
3239
+ };
3240
+ disposeAutoReset;
3241
+ static getDerivedStateFromError(e) {
3242
+ const error = e instanceof Error ? e : new Error(typeof e === "object" && e !== null ? JSON.stringify(e) : String(e));
3243
+ return {
3244
+ id: generateId(),
3245
+ hasError: true,
3246
+ error
3247
+ };
3248
+ }
3249
+ componentDidCatch(error, errorInfo) {
3250
+ console.error("Uncaught error:", error, errorInfo);
3251
+ if (isEditMode()) root_store_default.editStore?.ai.handleRuntimeError({
3252
+ id: this.state.id,
3253
+ error: String(error),
3254
+ errorInfo,
3255
+ identifier: this.props.identifier
3256
+ });
3257
+ }
3258
+ reset = () => {
3259
+ if (isEditMode()) root_store_default.editStore?.ai.clearRuntimeError(this.state.id);
3260
+ this.setState({
3261
+ hasError: false,
3262
+ error: void 0
3263
+ });
3264
+ };
3265
+ componentWillUnmount() {
3266
+ if (this.state.hasError && isEditMode()) root_store_default.editStore?.ai.clearRuntimeError(this.state.id);
3267
+ this.disposeAutoReset?.();
3268
+ }
3269
+ handleFixWithClarkInitiated = () => {
3270
+ const ai = root_store_default.editStore?.ai;
3271
+ if (!ai) return;
3272
+ this.disposeAutoReset?.();
3273
+ this.disposeAutoReset = void 0;
3274
+ let sawStart = ai.getIsEditing();
3275
+ this.disposeAutoReset = reaction(() => ai.getIsEditing(), (isEditing) => {
3276
+ if (!sawStart && isEditing) sawStart = true;
3277
+ if (sawStart && !isEditing) {
3278
+ this.reset();
3279
+ this.disposeAutoReset?.();
3280
+ this.disposeAutoReset = void 0;
3281
+ }
3282
+ }, {
3283
+ fireImmediately: true,
3284
+ name: "error-boundary-ai-auto-reset"
3285
+ });
3286
+ };
3287
+ handleFixWithAi() {
3288
+ const { identifier } = this.props;
3289
+ if (identifier) editorBridge.addComponentToAiContext(identifier.sourceId, identifier.selectorId);
3290
+ let prompt = `Fix this error: `;
3291
+ if (this.state.error?.stack) {
3292
+ const lines = this.state.error.stack.split("\n");
3293
+ const nodeModulesIndex = lines.findIndex((line) => line.includes("node_modules"));
3294
+ const relevantLines = nodeModulesIndex > -1 ? lines.slice(0, nodeModulesIndex) : lines;
3295
+ prompt += relevantLines.slice(0, 5).join("\n");
3296
+ } else prompt += this.state.error?.toString();
3297
+ editorBridge.aiGenerate(prompt);
3298
+ }
3299
+ render() {
3300
+ if (this.state.hasError) return /* @__PURE__ */ jsx(Observer, { children: () => {
3301
+ if (root_store_default.editStore?.ai.getIsEditing() ?? false) return /* @__PURE__ */ jsx(SuspenseFallback, {});
3302
+ return /* @__PURE__ */ jsxs(ErrorBoundaryContainer, { children: [/* @__PURE__ */ jsxs(ErrorDetailsContainer, { children: [/* @__PURE__ */ jsx("h3", { children: this.props.header || "Something went wrong." }), /* @__PURE__ */ jsxs("details", {
3303
+ style: { fontSize: "0.8em" },
3304
+ children: [/* @__PURE__ */ jsx("summary", {
3305
+ style: { paddingLeft: "0.25rem" },
3306
+ children: "Error details"
3307
+ }), /* @__PURE__ */ jsx("div", {
3308
+ style: {
3309
+ marginTop: "0.5rem",
3310
+ maxWidth: "100%",
3311
+ overflowX: "auto",
3312
+ scrollbarWidth: "thin"
3313
+ },
3314
+ children: /* @__PURE__ */ jsx("pre", {
3315
+ style: { color: "gray" },
3316
+ children: /* @__PURE__ */ jsx("code", { children: this.state.error?.stack ? this.state.error.stack : this.state.error?.toString() })
3317
+ })
3318
+ })]
3319
+ })] }), /* @__PURE__ */ jsxs(ErrorActionsContainer, { children: [isEditMode() && /* @__PURE__ */ jsx(FixWithClarkButton, {
3320
+ onClick: this.handleFixWithClarkInitiated,
3321
+ error: this.state.error,
3322
+ identifier: this.props.identifier
3323
+ }), /* @__PURE__ */ jsx(SecondaryButton, {
3324
+ onClick: this.reset,
3325
+ children: "Try again"
3326
+ })] })] });
3327
+ } });
3328
+ return this.props.children;
3329
+ }
3330
+ };
3331
+ var error_boundary_default = ErrorBoundary;
3332
+
3057
3333
  //#endregion
3058
3334
  //#region src/lib/utils/widget-wrapper-naming.ts
3059
3335
  const getWidgetAnchorName = (selectorId) => {
@@ -3064,5 +3340,110 @@ const getWidgetRectAnchorName = (selectorId) => {
3064
3340
  };
3065
3341
 
3066
3342
  //#endregion
3067
- export { useSuperblocksUser as A, generateId as C, useSuperblocksContext as D, SuperblocksContextProvider as E, iframeMessageHandler as F, isEmbeddedBySuperblocksFirstParty as I, isEditMode as L, colors as M, editorBridge as N, useSuperblocksGroups as O, getEditStore as P, startEditorSync as S, resolveById as T, createManagedPropsList as _, ActionsContainer as a, Section as b, ErrorDetails as c, ErrorStack as d, ErrorSummary as f, root_store_default as g, StyledClarkIcon as h, ai_stars_default as i, sendNotification as j, useSuperblocksProfiles as k, ErrorIconContainer as l, SecondaryButton as m, getWidgetRectAnchorName as n, ErrorContainer as o, ErrorTitle as p, FixWithClarkButton as r, ErrorContent as s, getWidgetAnchorName as t, ErrorMessage as u, Prop as v, rejectById as w, createPropertiesPanelDefinition as x, PropsCategory as y };
3068
- //# sourceMappingURL=widget-wrapper-naming-DxFT8zmk.js.map
3343
+ //#region src/edit-mode/edit-wrapper.tsx
3344
+ if (typeof window !== "undefined" && typeof document.documentElement !== "undefined" && !("anchorName" in document.documentElement.style)) polyfill();
3345
+ const createAnchorNameStyle = (props) => {
3346
+ return { "--anchor-name": getWidgetAnchorName(props.selectorId) };
3347
+ };
3348
+
3349
+ //#endregion
3350
+ //#region src/edit-mode/instance-tracker.ts
3351
+ /**
3352
+ * Tracks and recycles instance numbers for each sourceId to generate stable, unique selector IDs.
3353
+ * When components unmount, their instance numbers are released and can be reused.
3354
+ */
3355
+ var InstanceTracker = class {
3356
+ sourceIdToUsedInstances = /* @__PURE__ */ new Map();
3357
+ getNextAvailableInstance(sourceId) {
3358
+ const usedInstances = this.sourceIdToUsedInstances.get(sourceId) ?? /* @__PURE__ */ new Set();
3359
+ let instance = 0;
3360
+ while (usedInstances.has(instance)) instance++;
3361
+ usedInstances.add(instance);
3362
+ this.sourceIdToUsedInstances.set(sourceId, usedInstances);
3363
+ return instance;
3364
+ }
3365
+ releaseInstance(sourceId, instance) {
3366
+ const usedInstances = this.sourceIdToUsedInstances.get(sourceId);
3367
+ if (usedInstances) {
3368
+ usedInstances.delete(instance);
3369
+ if (usedInstances.size === 0) this.sourceIdToUsedInstances.delete(sourceId);
3370
+ }
3371
+ }
3372
+ };
3373
+ const instanceTracker = new InstanceTracker();
3374
+
3375
+ //#endregion
3376
+ //#region src/edit-mode/jsx-wrapper.tsx
3377
+ const JSXContext = React.createContext({
3378
+ selectorId: "S-<unknown>",
3379
+ sourceId: "SB-<unknown>"
3380
+ });
3381
+ const makeWrappedComponent = (type) => {
3382
+ const isTag = typeof type === "string";
3383
+ const isRegisteredSbComponent = root_store_default.componentRegistry.hasComponent(type);
3384
+ const Component$1 = React.forwardRef((props, ref) => {
3385
+ const { selectorId: parentSelectorId } = useJSXContext();
3386
+ const sourceId = props[SOURCE_ID_ATTRIBUTE];
3387
+ const noSelect = props[NO_SELECT_ATTRIBUTE];
3388
+ const instanceNumberRef = useRef();
3389
+ const selectorId = useRef("S-<unknown>");
3390
+ if (selectorId.current === "S-<unknown>") {
3391
+ instanceNumberRef.current = instanceTracker.getNextAvailableInstance(sourceId);
3392
+ selectorId.current = `S-x-${sourceId}-${instanceNumberRef.current}`;
3393
+ }
3394
+ useEffect(() => {
3395
+ root_store_default.editStore?.runtimeTrackingStore.registerComponent(selectorId.current, {
3396
+ sourceId,
3397
+ type,
3398
+ parentSelectorId,
3399
+ isSbComponent: isRegisteredSbComponent,
3400
+ isHtmlElement: isTag,
3401
+ noSelect
3402
+ });
3403
+ return () => {
3404
+ root_store_default.editStore?.runtimeTrackingStore.unregisterComponent(selectorId.current);
3405
+ if (instanceNumberRef.current !== void 0) instanceTracker.releaseInstance(sourceId, instanceNumberRef.current);
3406
+ };
3407
+ }, []);
3408
+ useEffect(() => {
3409
+ root_store_default.editStore?.runtimeTrackingStore.updatePropsForComponent(selectorId.current, props);
3410
+ }, [props]);
3411
+ const jsxContext = useMemo(() => ({
3412
+ selectorId: selectorId.current,
3413
+ sourceId
3414
+ }), [sourceId]);
3415
+ const selectorProps = { [SELECTOR_ID_ATTRIBUTE]: selectorId.current };
3416
+ if (parentSelectorId) selectorProps["data-sb-parent-selector-id"] = parentSelectorId;
3417
+ const style = useMemo(() => {
3418
+ return {
3419
+ ...props.style,
3420
+ ...createAnchorNameStyle({ selectorId: selectorId.current })
3421
+ };
3422
+ }, [props.style]);
3423
+ const element = React.createElement(type, {
3424
+ ref,
3425
+ ...props,
3426
+ ...selectorProps,
3427
+ className: ["sb-anchor-name", props.className].filter(Boolean).join(" "),
3428
+ style
3429
+ });
3430
+ if (!root_store_default.editStore?.isInitialized) return element;
3431
+ return /* @__PURE__ */ jsx(JSXContext.Provider, {
3432
+ value: jsxContext,
3433
+ children: /* @__PURE__ */ jsx(error_boundary_default, { children: element })
3434
+ });
3435
+ });
3436
+ try {
3437
+ Component$1.displayName = typeof type === "string" ? type : type.displayName || type.name || "Component";
3438
+ } catch (e) {
3439
+ console.error("Error setting displayName", e);
3440
+ }
3441
+ return Component$1;
3442
+ };
3443
+ const useJSXContext = () => {
3444
+ return React.useContext(JSXContext);
3445
+ };
3446
+
3447
+ //#endregion
3448
+ export { SuperblocksContextProvider as A, iframeMessageHandler as B, startEditorSync as C, api_hmr_tracker_default as D, getContextFromTraceHeaders as E, useSuperblocksUser as F, isEditMode as H, sendNotification as I, colors as L, useSuperblocksContext as M, useSuperblocksGroups as N, rejectById as O, useSuperblocksProfiles as P, editorBridge as R, createPropertiesPanelDefinition as S, createIframeSpan as T, isEmbeddedBySuperblocksFirstParty as V, root_store_default as _, FixWithClarkButton as a, PropsCategory as b, ErrorContent as c, ErrorMessage as d, ErrorStack as f, StyledClarkIcon as g, SecondaryButton as h, getWidgetRectAnchorName as i, getAppMode as j, resolveById as k, ErrorDetails as l, ErrorTitle as m, useJSXContext as n, ActionsContainer as o, ErrorSummary as p, getWidgetAnchorName as r, ErrorContainer as s, makeWrappedComponent as t, ErrorIconContainer as u, createManagedPropsList as v, generateId as w, Section as x, Prop as y, getEditStore as z };
3449
+ //# sourceMappingURL=jsx-wrapper-BaEUS0A1.js.map