@rectify-dev/core 2.1.0 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -190,6 +190,48 @@ var listenToNativeEvent = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((domEventName
190
190
  // ../rectify-dom-binding/src/clients/RectifyDomProperties.ts
191
191
  var isEvent = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((k) => k.startsWith("on"), "isEvent");
192
192
  var isProperty = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((k) => k !== "children" && k !== "ref" && !isEvent(k), "isProperty");
193
+ var SVG_NS = "http://www.w3.org/2000/svg";
194
+ var SVG_CAMEL_ATTRS = /* @__PURE__ */ new Set([
195
+ "viewBox",
196
+ "preserveAspectRatio",
197
+ "gradientTransform",
198
+ "gradientUnits",
199
+ "patternTransform",
200
+ "patternUnits",
201
+ "patternContentUnits",
202
+ "clipPathUnits",
203
+ "markerUnits",
204
+ "markerWidth",
205
+ "markerHeight",
206
+ "refX",
207
+ "refY",
208
+ "textLength",
209
+ "startOffset",
210
+ "baseFrequency",
211
+ "numOctaves",
212
+ "stdDeviation",
213
+ "filterUnits",
214
+ "primitiveUnits",
215
+ "tableValues",
216
+ "kernelMatrix",
217
+ "kernelUnitLength",
218
+ "targetX",
219
+ "targetY",
220
+ "xChannelSelector",
221
+ "yChannelSelector",
222
+ "diffuseConstant",
223
+ "surfaceScale",
224
+ "specularConstant",
225
+ "specularExponent",
226
+ "limitingConeAngle",
227
+ "pointsAtX",
228
+ "pointsAtY",
229
+ "pointsAtZ",
230
+ "repeatX",
231
+ "repeatY"
232
+ ]);
233
+ var camelToKebab = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((s) => s.replace(/[A-Z]/g, (m) => "-" + m.toLowerCase()), "camelToKebab");
234
+ var svgAttrName = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((k) => SVG_CAMEL_ATTRS.has(k) ? k : camelToKebab(k), "svgAttrName");
193
235
  var unitlessProperties = /* @__PURE__ */ new Set([
194
236
  "zIndex",
195
237
  "opacity",
@@ -212,14 +254,16 @@ function convertStyleObjectToString(styleObj) {
212
254
  chunkAJJIEZ7G_cjs.__name(convertStyleObjectToString, "convertStyleObjectToString");
213
255
  var applyPropsToDom = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((node, prevProps = {}, nextProps = {}) => {
214
256
  const element = node;
257
+ const isSvg = element.namespaceURI === SVG_NS;
215
258
  const eventNode = getEventHandlerListeners(element) || /* @__PURE__ */ new Map();
216
259
  for (const k in prevProps) {
217
260
  if (isEvent(k) && !(k in nextProps)) {
218
261
  eventNode.delete(k);
219
262
  }
220
263
  if (isProperty(k) && !(k in nextProps)) {
264
+ const attrName = isSvg ? svgAttrName(k) : k;
221
265
  element[k] = "";
222
- element.removeAttribute(k);
266
+ element.removeAttribute(attrName);
223
267
  }
224
268
  }
225
269
  for (const k in nextProps) {
@@ -229,13 +273,22 @@ var applyPropsToDom = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((node, prevProps
229
273
  eventNode.set(k, nextProps[k]);
230
274
  }
231
275
  } else if (k === "style") {
232
- element.setAttribute("style", convertStyleObjectToString(nextProps[k]));
276
+ if (typeof nextProps[k] === "string") {
277
+ element.setAttribute("style", nextProps[k]);
278
+ } else {
279
+ element.setAttribute("style", convertStyleObjectToString(nextProps[k]));
280
+ }
233
281
  } else {
234
282
  const v = nextProps[k];
235
- if (k === "className") element.setAttribute("class", v ?? "");
236
- else if (v === false || v === null || v === void 0)
237
- element.removeAttribute(k);
238
- else element.setAttribute(k, String(v));
283
+ if (k === "className") {
284
+ element.setAttribute("class", v ?? "");
285
+ } else if (v === false || v === null || v === void 0) {
286
+ const attrName = isSvg ? svgAttrName(k) : k;
287
+ element.removeAttribute(attrName);
288
+ } else {
289
+ const attrName = isSvg ? svgAttrName(k) : k;
290
+ element.setAttribute(attrName, String(v));
291
+ }
239
292
  }
240
293
  }
241
294
  setEventHandlerListeners(element, eventNode);
@@ -259,12 +312,16 @@ var IdleLane = 16;
259
312
 
260
313
  // ../rectify-reconciler/src/RectifyFiberWorkTags.ts
261
314
  var FunctionComponent = /* @__PURE__ */ Symbol.for("rectify.function_component");
315
+ var ClassComponent = /* @__PURE__ */ Symbol.for("rectify.class_component");
262
316
  var HostComponent = /* @__PURE__ */ Symbol.for("rectify.host_component");
263
317
  var HostText = /* @__PURE__ */ Symbol.for("rectify.host_text");
264
318
  var HostRoot = /* @__PURE__ */ Symbol.for("rectify.host_root");
265
319
  var FragmentComponent = /* @__PURE__ */ Symbol.for("rectify.fragment_component");
266
320
  var ContextProvider = /* @__PURE__ */ Symbol.for("rectify.context_provider");
267
321
  var MemoComponent = /* @__PURE__ */ Symbol.for("rectify.memo_component");
322
+ var LazyComponent = /* @__PURE__ */ Symbol.for("rectify.lazy_component");
323
+ var SuspenseComponent = /* @__PURE__ */ Symbol.for("rectify.suspense_component");
324
+ var PortalComponent = /* @__PURE__ */ Symbol.for("rectify.portal_component");
268
325
  var addFlagToFiber = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber, flag) => {
269
326
  if (hasFlagOnFiber(fiber, flag)) return;
270
327
  fiber.flags |= flag;
@@ -279,6 +336,8 @@ var hasFlagOnFiber = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber, flag) => {
279
336
  }, "hasFlagOnFiber");
280
337
  var getFiberTagFromElement = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((element) => {
281
338
  switch (element.$$typeof) {
339
+ case shared.RECTIFY_PORTAL_TYPE:
340
+ return PortalComponent;
282
341
  case shared.RECTIFY_ELEMENT_TYPE:
283
342
  if (shared.isFunction(element.type) && element.type?._context === element.type) {
284
343
  return ContextProvider;
@@ -286,6 +345,15 @@ var getFiberTagFromElement = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((element)
286
345
  if (shared.isFunction(element.type) && element.type?._isMemo === true) {
287
346
  return MemoComponent;
288
347
  }
348
+ if (element.type?._isSuspense === true) {
349
+ return SuspenseComponent;
350
+ }
351
+ if (element.type?._isLazy === true) {
352
+ return LazyComponent;
353
+ }
354
+ if (element.type?._isClassComponent === true) {
355
+ return ClassComponent;
356
+ }
289
357
  return shared.isFunction(element.type) ? FunctionComponent : HostComponent;
290
358
  case shared.RECTIFY_TEXT_TYPE:
291
359
  return HostText;
@@ -295,12 +363,53 @@ var getFiberTagFromElement = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((element)
295
363
  return null;
296
364
  }
297
365
  }, "getFiberTagFromElement");
366
+ var SVG_TAGS = /* @__PURE__ */ new Set([
367
+ "svg",
368
+ "circle",
369
+ "ellipse",
370
+ "line",
371
+ "path",
372
+ "polygon",
373
+ "polyline",
374
+ "rect",
375
+ "g",
376
+ "defs",
377
+ "use",
378
+ "symbol",
379
+ "clipPath",
380
+ "mask",
381
+ "pattern",
382
+ "linearGradient",
383
+ "radialGradient",
384
+ "stop",
385
+ "marker",
386
+ "image",
387
+ "text",
388
+ "tspan",
389
+ "textPath",
390
+ "foreignObject",
391
+ "animate",
392
+ "animateMotion",
393
+ "animateTransform",
394
+ "feBlend",
395
+ "feColorMatrix",
396
+ "feComposite",
397
+ "feGaussianBlur",
398
+ "feOffset",
399
+ "feMerge",
400
+ "feMergeNode",
401
+ "feTurbulence",
402
+ "feFlood"
403
+ ]);
404
+ var SVG_NS2 = "http://www.w3.org/2000/svg";
298
405
  var createDomElementFromFiber = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
299
406
  switch (fiber.workTag) {
300
407
  case HostText:
301
408
  return document.createTextNode(fiber.pendingProps);
302
- default:
303
- return document.createElement(fiber.type);
409
+ default: {
410
+ const tag = fiber.type;
411
+ return SVG_TAGS.has(tag) ? document.createElementNS(SVG_NS2, tag) : document.createElement(tag);
412
+ }
304
413
  }
305
414
  }, "createDomElementFromFiber");
306
415
  var getParentDom = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
@@ -310,6 +419,7 @@ var getParentDom = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
310
419
  while (p) {
311
420
  if (p.workTag === HostComponent) return p.stateNode;
312
421
  if (p.workTag === HostRoot) return p.stateNode;
422
+ if (p.workTag === PortalComponent) return p.stateNode;
313
423
  p = p.return;
314
424
  }
315
425
  throw new Error("No parent DOM found.");
@@ -330,8 +440,10 @@ chunkAJJIEZ7G_cjs.__name(findFirstHostNode, "findFirstHostNode");
330
440
  function getHostSibling(fiber) {
331
441
  let sibling = fiber.sibling;
332
442
  while (sibling) {
333
- const node = findFirstHostNode(sibling);
334
- if (node) return node;
443
+ if (!(sibling.flags & PlacementFlag)) {
444
+ const node = findFirstHostNode(sibling);
445
+ if (node) return node;
446
+ }
335
447
  sibling = sibling.sibling;
336
448
  }
337
449
  return null;
@@ -362,6 +474,7 @@ var createFiber = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((workTag, pendingProp
362
474
  sibling: null,
363
475
  return: null,
364
476
  stateNode: null,
477
+ classInstance: null,
365
478
  deletions: null,
366
479
  alternate: null,
367
480
  lanes: NoLanes,
@@ -396,6 +509,7 @@ var createWorkInProgress = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((current, pe
396
509
  }
397
510
  wip.memoizedProps = current.memoizedProps;
398
511
  wip.memoizedState = current.memoizedState;
512
+ wip.classInstance = current.classInstance;
399
513
  wip.refCleanup = current.refCleanup;
400
514
  wip.return = current.return;
401
515
  wip.child = current.child;
@@ -422,6 +536,88 @@ var getScheduledFiberRoot = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
422
536
  return instance.fiberRoot;
423
537
  }, "getScheduledFiberRoot");
424
538
 
539
+ // ../rectify-reconciler/src/RectifyFiberScheduler.ts
540
+ var FRAME_BUDGET_MS = 5;
541
+ var frameStart = 0;
542
+ var shouldYield = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => performance.now() - frameStart > FRAME_BUDGET_MS, "shouldYield");
543
+ var doWork = null;
544
+ var setWorkCallback = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((cb) => {
545
+ doWork = cb;
546
+ }, "setWorkCallback");
547
+ var resumeCursor = null;
548
+ var setResumeCursor = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
549
+ resumeCursor = fiber;
550
+ }, "setResumeCursor");
551
+ var getResumeCursor = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => resumeCursor, "getResumeCursor");
552
+ var clearResumeCursor = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
553
+ resumeCursor = null;
554
+ }, "clearResumeCursor");
555
+ var pendingLanes = NoLanes;
556
+ var scheduleRenderLane = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((lane) => {
557
+ pendingLanes |= lane;
558
+ if (lane & (SyncLane | InputLane)) {
559
+ scheduleMicrotask();
560
+ } else if (lane & DefaultLane) {
561
+ scheduleMessageTask();
562
+ } else if (lane & TransitionLane) {
563
+ scheduleTimeout();
564
+ } else if (lane & IdleLane) {
565
+ scheduleIdle();
566
+ }
567
+ }, "scheduleRenderLane");
568
+ var flush = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((mask) => {
569
+ const lanes = pendingLanes & mask;
570
+ if (!lanes) return;
571
+ pendingLanes &= ~lanes;
572
+ frameStart = performance.now();
573
+ doWork?.(lanes);
574
+ }, "flush");
575
+ var MICROTASK_MASK = SyncLane | InputLane;
576
+ var microtaskScheduled = false;
577
+ var scheduleMicrotask = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
578
+ if (microtaskScheduled) return;
579
+ microtaskScheduled = true;
580
+ queueMicrotask(() => {
581
+ microtaskScheduled = false;
582
+ flush(MICROTASK_MASK);
583
+ });
584
+ }, "scheduleMicrotask");
585
+ var DEFAULT_MASK = DefaultLane;
586
+ var mc = new MessageChannel();
587
+ var mcScheduled = false;
588
+ mc.port1.onmessage = () => {
589
+ mcScheduled = false;
590
+ flush(DEFAULT_MASK);
591
+ };
592
+ var scheduleMessageTask = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
593
+ if (mcScheduled) return;
594
+ mcScheduled = true;
595
+ mc.port2.postMessage(null);
596
+ }, "scheduleMessageTask");
597
+ var TRANSITION_MASK = TransitionLane;
598
+ var timeoutHandle = null;
599
+ var scheduleTimeout = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
600
+ if (timeoutHandle !== null) return;
601
+ timeoutHandle = setTimeout(() => {
602
+ timeoutHandle = null;
603
+ flush(TRANSITION_MASK);
604
+ }, 0);
605
+ }, "scheduleTimeout");
606
+ var IDLE_MASK = IdleLane;
607
+ var idleHandle = null;
608
+ var scheduleIdle = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
609
+ if (idleHandle !== null) return;
610
+ const run = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
611
+ idleHandle = null;
612
+ flush(IDLE_MASK);
613
+ }, "run");
614
+ if (typeof requestIdleCallback !== "undefined") {
615
+ idleHandle = requestIdleCallback(run, { timeout: 300 });
616
+ } else {
617
+ idleHandle = setTimeout(run, 300);
618
+ }
619
+ }, "scheduleIdle");
620
+
425
621
  // ../rectify-hook/src/RectifyHookRenderingFiber.ts
426
622
  var instance2 = {
427
623
  fiberRendering: null,
@@ -467,10 +663,10 @@ var prepareToUseHooks = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
467
663
  var finishUsingHooks = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
468
664
  setFiberRendering(null);
469
665
  }, "finishUsingHooks");
470
- var withHooks = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip, Component) => {
666
+ var withHooks = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip, Component2) => {
471
667
  const NewComponent = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((props) => {
472
668
  prepareToUseHooks(wip);
473
- const result = Component(props);
669
+ const result = Component2(props);
474
670
  finishUsingHooks();
475
671
  return result;
476
672
  }, "NewComponent");
@@ -773,6 +969,30 @@ function clearContextSubscriptions(fiber) {
773
969
  }
774
970
  chunkAJJIEZ7G_cjs.__name(clearContextSubscriptions, "clearContextSubscriptions");
775
971
 
972
+ // ../rectify-hook/src/RectifyHookUseId.ts
973
+ var _idCounter = 0;
974
+ var generateId = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => `_r${(_idCounter++).toString(36)}_`, "generateId");
975
+ var useId = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
976
+ const fiber = getFiberRendering();
977
+ if (!fiber) {
978
+ throw new Error("useId must be used within a function component.");
979
+ }
980
+ const hookIndex = getHookIndex();
981
+ nextHookIndex();
982
+ const { hook, prevHook } = getHookSlot(fiber, hookIndex);
983
+ if (!hook) {
984
+ const newHook = {
985
+ memoizedState: generateId(),
986
+ queue: null,
987
+ next: null
988
+ };
989
+ attachHook(fiber, newHook, prevHook);
990
+ return newHook.memoizedState;
991
+ }
992
+ return hook.memoizedState;
993
+ }, "useId");
994
+ var RectifyHookUseId_default = useId;
995
+
776
996
  // ../rectify-reconciler/src/RectifyFiberRenderPriority.ts
777
997
  var currentEventPriority = DefaultLane;
778
998
  var setCurrentEventPriority = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((lane) => {
@@ -787,156 +1007,228 @@ var setCurrentRenderingLanes = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((lanes)
787
1007
  currentRenderingLanes = lanes;
788
1008
  }, "setCurrentRenderingLanes");
789
1009
  var getCurrentLanePriority = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => currentRenderingLanes, "getCurrentLanePriority");
790
-
791
- // ../rectify-reconciler/src/RectifyFiberScheduler.ts
792
- var FRAME_BUDGET_MS = 5;
793
- var frameStart = 0;
794
- var shouldYield = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => performance.now() - frameStart > FRAME_BUDGET_MS, "shouldYield");
795
- var doWork = null;
796
- var setWorkCallback = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((cb) => {
797
- doWork = cb;
798
- }, "setWorkCallback");
799
- var resumeCursor = null;
800
- var setResumeCursor = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
801
- resumeCursor = fiber;
802
- }, "setResumeCursor");
803
- var getResumeCursor = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => resumeCursor, "getResumeCursor");
804
- var clearResumeCursor = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
805
- resumeCursor = null;
806
- }, "clearResumeCursor");
807
- var pendingLanes = NoLanes;
808
- var scheduleRenderLane = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((lane) => {
809
- pendingLanes |= lane;
810
- if (lane & (SyncLane | InputLane)) {
811
- scheduleMicrotask();
812
- } else if (lane & DefaultLane) {
813
- scheduleMessageTask();
814
- } else if (lane & TransitionLane) {
815
- scheduleTimeout();
816
- } else if (lane & IdleLane) {
817
- scheduleIdle();
818
- }
819
- }, "scheduleRenderLane");
820
- var flush = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((mask) => {
821
- const lanes = pendingLanes & mask;
822
- if (!lanes) return;
823
- pendingLanes &= ~lanes;
824
- frameStart = performance.now();
825
- doWork?.(lanes);
826
- }, "flush");
827
- var MICROTASK_MASK = SyncLane | InputLane;
828
- var microtaskScheduled = false;
829
- var scheduleMicrotask = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
830
- if (microtaskScheduled) return;
831
- microtaskScheduled = true;
832
- queueMicrotask(() => {
833
- microtaskScheduled = false;
834
- flush(MICROTASK_MASK);
835
- });
836
- }, "scheduleMicrotask");
837
- var DEFAULT_MASK = DefaultLane;
838
- var mc = new MessageChannel();
839
- var mcScheduled = false;
840
- mc.port1.onmessage = () => {
841
- mcScheduled = false;
842
- flush(DEFAULT_MASK);
843
- };
844
- var scheduleMessageTask = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
845
- if (mcScheduled) return;
846
- mcScheduled = true;
847
- mc.port2.postMessage(null);
848
- }, "scheduleMessageTask");
849
- var TRANSITION_MASK = TransitionLane;
850
- var timeoutHandle = null;
851
- var scheduleTimeout = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
852
- if (timeoutHandle !== null) return;
853
- timeoutHandle = setTimeout(() => {
854
- timeoutHandle = null;
855
- flush(TRANSITION_MASK);
856
- }, 0);
857
- }, "scheduleTimeout");
858
- var IDLE_MASK = IdleLane;
859
- var idleHandle = null;
860
- var scheduleIdle = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
861
- if (idleHandle !== null) return;
862
- const run = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
863
- idleHandle = null;
864
- flush(IDLE_MASK);
865
- }, "run");
866
- if (typeof requestIdleCallback !== "undefined") {
867
- idleHandle = requestIdleCallback(run, { timeout: 300 });
868
- } else {
869
- idleHandle = setTimeout(run, 300);
870
- }
871
- }, "scheduleIdle");
872
-
873
- // ../rectify-reconciler/src/RectifyFiberWorkLoop.ts
874
- var swapCurrentForWip = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((current, wip) => {
875
- const parent = wip.return;
876
- if (!parent) return;
877
- if (parent.child === current) {
878
- parent.child = wip;
879
- return;
1010
+ var reuseOrCreate = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((oldFiber, element, wip) => {
1011
+ const newFiber = createWorkInProgress(oldFiber, element.props);
1012
+ if (hasPropsChanged(oldFiber.memoizedProps, element.props)) {
1013
+ addFlagToFiber(newFiber, UpdateFlag);
880
1014
  }
881
- let prevSibling = parent.child;
882
- while (prevSibling && prevSibling.sibling !== current) {
883
- prevSibling = prevSibling.sibling;
1015
+ if ((oldFiber.memoizedProps?.ref ?? null) !== (element.props?.ref ?? null)) {
1016
+ addFlagToFiber(newFiber, RefFlag);
884
1017
  }
885
- if (prevSibling) prevSibling.sibling = wip;
886
- }, "swapCurrentForWip");
887
- var workLoop = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wipRoot) => {
888
- let workInProgress = wipRoot;
889
- while (workInProgress) {
890
- const next = beginWork(workInProgress);
891
- if (next) {
892
- workInProgress = next;
1018
+ newFiber.return = wip;
1019
+ return newFiber;
1020
+ }, "reuseOrCreate");
1021
+ var createAndPlace = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((element, wip) => {
1022
+ const newFiber = createFiberFromRectifyElement(element);
1023
+ newFiber.type = element.type;
1024
+ addFlagToFiber(newFiber, PlacementFlag);
1025
+ newFiber.return = wip;
1026
+ return newFiber;
1027
+ }, "createAndPlace");
1028
+ var appendFiber = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber, prev, index, wip) => {
1029
+ fiber.index = index;
1030
+ if (!prev) wip.child = fiber;
1031
+ else prev.sibling = fiber;
1032
+ return fiber;
1033
+ }, "appendFiber");
1034
+ var buildOldFiberStructures = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((firstRemaining) => {
1035
+ const keyedMap = /* @__PURE__ */ new Map();
1036
+ const unkeyedByType = /* @__PURE__ */ new Map();
1037
+ let fiber = firstRemaining;
1038
+ while (fiber) {
1039
+ if (fiber.key !== null && fiber.key !== void 0) {
1040
+ keyedMap.set(fiber.key, fiber);
893
1041
  } else {
894
- workInProgress = completeUnitOfWork(workInProgress, wipRoot);
1042
+ const pool = unkeyedByType.get(fiber.type);
1043
+ if (pool) pool.push(fiber);
1044
+ else unkeyedByType.set(fiber.type, [fiber]);
895
1045
  }
1046
+ fiber = fiber.sibling;
896
1047
  }
897
- }, "workLoop");
898
- var workLoopConcurrent = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wipRoot) => {
899
- let workInProgress = getResumeCursor() ?? wipRoot;
900
- clearResumeCursor();
901
- while (workInProgress && !shouldYield()) {
902
- const next = beginWork(workInProgress);
903
- if (next) {
904
- workInProgress = next;
1048
+ return { keyedMap, unkeyedByType };
1049
+ }, "buildOldFiberStructures");
1050
+ var reconcileSequential = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((state, firstOldFiber) => {
1051
+ let oldFiber = firstOldFiber;
1052
+ for (let i = 0; i < state.newElements.length; i++) {
1053
+ const element = state.newElements[i];
1054
+ const { key: elementKey = null, type: elementType } = element;
1055
+ if (!oldFiber) return { stoppedAt: i, oldFiber: null };
1056
+ if (oldFiber.key !== elementKey) return { stoppedAt: i, oldFiber };
1057
+ if (oldFiber.type === elementType) {
1058
+ state.prev = appendFiber(
1059
+ reuseOrCreate(oldFiber, element, state.wip),
1060
+ state.prev,
1061
+ state.index++,
1062
+ state.wip
1063
+ );
1064
+ } else if (elementKey !== null) {
1065
+ addFlagToFiber(oldFiber, DeletionFlag);
1066
+ state.deletions.push(oldFiber);
1067
+ state.prev = appendFiber(
1068
+ createAndPlace(element, state.wip),
1069
+ state.prev,
1070
+ state.index++,
1071
+ state.wip
1072
+ );
905
1073
  } else {
906
- workInProgress = completeUnitOfWork(workInProgress, wipRoot);
1074
+ return { stoppedAt: i, oldFiber };
907
1075
  }
1076
+ oldFiber = oldFiber.sibling;
908
1077
  }
909
- if (workInProgress !== null) {
910
- setResumeCursor(workInProgress);
911
- return false;
912
- }
913
- return true;
914
- }, "workLoopConcurrent");
915
- var workLoopOnFiberLanes = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wipRoot, renderLanes) => {
916
- if (wipRoot.lanes & renderLanes) {
917
- const wip = createWorkInProgress(wipRoot, wipRoot.pendingProps);
918
- swapCurrentForWip(wipRoot, wip);
919
- const isSync = !!(renderLanes & (SyncLane | InputLane));
920
- let completed;
921
- if (isSync) {
922
- workLoop(wip);
923
- completed = true;
924
- } else {
925
- completed = workLoopConcurrent(wip);
1078
+ return { stoppedAt: state.newElements.length, oldFiber };
1079
+ }, "reconcileSequential");
1080
+ var reconcileKeyed = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((state, startAt, remainingOldFiber) => {
1081
+ const { keyedMap, unkeyedByType } = buildOldFiberStructures(remainingOldFiber);
1082
+ let lastPlacedIndex = 0;
1083
+ for (let i = startAt; i < state.newElements.length; i++) {
1084
+ const element = state.newElements[i];
1085
+ const { key: elementKey = null, type: elementType } = element;
1086
+ let matched = null;
1087
+ if (elementKey !== null) {
1088
+ const candidate = keyedMap.get(elementKey) ?? null;
1089
+ if (candidate && candidate.type === elementType) {
1090
+ keyedMap.delete(elementKey);
1091
+ matched = candidate;
1092
+ }
1093
+ } else {
1094
+ const pool = unkeyedByType.get(elementType);
1095
+ if (pool?.length) matched = pool.shift();
1096
+ }
1097
+ if (matched) {
1098
+ const newFiber = reuseOrCreate(matched, element, state.wip);
1099
+ if (matched.index < lastPlacedIndex) {
1100
+ addFlagToFiber(newFiber, MoveFlag);
1101
+ } else {
1102
+ lastPlacedIndex = matched.index;
1103
+ }
1104
+ state.prev = appendFiber(newFiber, state.prev, state.index++, state.wip);
1105
+ } else {
1106
+ state.prev = appendFiber(
1107
+ createAndPlace(element, state.wip),
1108
+ state.prev,
1109
+ state.index++,
1110
+ state.wip
1111
+ );
926
1112
  }
927
- if (completed) bubbleFlagsToRoot(wip);
928
- return completed;
929
1113
  }
930
- if (wipRoot.childLanes & renderLanes) {
931
- let child = wipRoot.child;
932
- while (child) {
933
- const done = workLoopOnFiberLanes(child, renderLanes);
934
- if (!done) return false;
935
- child = child.sibling;
1114
+ for (const orphan of keyedMap.values()) {
1115
+ addFlagToFiber(orphan, DeletionFlag);
1116
+ state.deletions.push(orphan);
1117
+ }
1118
+ for (const pool of unkeyedByType.values()) {
1119
+ for (const orphan of pool) {
1120
+ addFlagToFiber(orphan, DeletionFlag);
1121
+ state.deletions.push(orphan);
936
1122
  }
937
1123
  }
938
- return true;
939
- }, "workLoopOnFiberLanes");
1124
+ }, "reconcileKeyed");
1125
+ var toChildArray = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((children) => {
1126
+ if (children == null || typeof children === "boolean") return [];
1127
+ if (shared.isArray(children)) return children;
1128
+ return [children];
1129
+ }, "toChildArray");
1130
+ var reconcileChildren = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip, children) => {
1131
+ const newElements = toChildArray(children).map(shared.createElementFromRectifyNode).filter(shared.isValidRectifyElement);
1132
+ const state = {
1133
+ wip,
1134
+ newElements,
1135
+ deletions: [],
1136
+ prev: null,
1137
+ index: 0
1138
+ };
1139
+ const firstOldFiber = wip.alternate?.child ?? null;
1140
+ const { stoppedAt, oldFiber } = reconcileSequential(state, firstOldFiber);
1141
+ if (stoppedAt < newElements.length) {
1142
+ reconcileKeyed(state, stoppedAt, oldFiber);
1143
+ } else {
1144
+ let leftover = oldFiber;
1145
+ while (leftover) {
1146
+ addFlagToFiber(leftover, DeletionFlag);
1147
+ state.deletions.push(leftover);
1148
+ leftover = leftover.sibling;
1149
+ }
1150
+ }
1151
+ if (state.prev) state.prev.sibling = null;
1152
+ if (state.deletions.length) wip.deletions = state.deletions;
1153
+ }, "reconcileChildren");
1154
+
1155
+ // ../rectify-reconciler/src/RectifyFiberConcurrentUpdate.ts
1156
+ var instance3 = {
1157
+ head: null,
1158
+ tail: null
1159
+ };
1160
+ var enqueueUpdate = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((update) => {
1161
+ update.next = null;
1162
+ if (instance3.tail === null) {
1163
+ instance3.head = update;
1164
+ instance3.tail = update;
1165
+ return;
1166
+ }
1167
+ instance3.tail.next = update;
1168
+ instance3.tail = update;
1169
+ }, "enqueueUpdate");
1170
+ var dequeueUpdate = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
1171
+ const first = instance3.head;
1172
+ if (first === null) {
1173
+ return null;
1174
+ }
1175
+ instance3.head = first.next;
1176
+ if (instance3.head === null) {
1177
+ instance3.tail = null;
1178
+ }
1179
+ first.next = null;
1180
+ return first;
1181
+ }, "dequeueUpdate");
1182
+ var hasUpdate = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => instance3.head !== null, "hasUpdate");
1183
+
1184
+ // ../rectify-reconciler/src/RectifyFiberSuspense.ts
1185
+ var suspendedBoundaries = /* @__PURE__ */ new WeakSet();
1186
+ var stableFiber = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => fiber.alternate ?? fiber, "stableFiber");
1187
+ var isSuspendedBoundary = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => suspendedBoundaries.has(stableFiber(fiber)), "isSuspendedBoundary");
1188
+ var findNearestSuspenseBoundary = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
1189
+ let current = fiber.return;
1190
+ while (current) {
1191
+ if (current.workTag === SuspenseComponent) return current;
1192
+ current = current.return;
1193
+ }
1194
+ return null;
1195
+ }, "findNearestSuspenseBoundary");
1196
+ var handleSuspendedWork = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((boundary, thenable) => {
1197
+ const stable = stableFiber(boundary);
1198
+ if (suspendedBoundaries.has(stable)) return;
1199
+ suspendedBoundaries.add(stable);
1200
+ boundary.child = null;
1201
+ boundary.deletions = null;
1202
+ thenable.then(
1203
+ () => {
1204
+ suspendedBoundaries.delete(stable);
1205
+ enqueueUpdate({ lanes: DefaultLane, fiber: stable, next: null });
1206
+ scheduleRenderLane(DefaultLane);
1207
+ },
1208
+ () => {
1209
+ suspendedBoundaries.delete(stable);
1210
+ }
1211
+ );
1212
+ }, "handleSuspendedWork");
1213
+ var isThenable = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((value) => value !== null && typeof value === "object" && typeof value.then === "function", "isThenable");
1214
+
1215
+ // ../rectify-reconciler/src/RectifyFiberBeginWork.ts
1216
+ var hasNoPendingWork = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => !(wip.lanes & getCurrentLanePriority()), "hasNoPendingWork");
1217
+ var isUpdate = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => wip.alternate !== null, "isUpdate");
1218
+ var flushStateQueue = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((currentState, props, queue) => {
1219
+ let state = currentState;
1220
+ for (const update of queue) {
1221
+ const partial = typeof update === "function" ? update(state, props) : update;
1222
+ state = { ...state, ...partial };
1223
+ }
1224
+ return state;
1225
+ }, "flushStateQueue");
1226
+ var renderFunctionComponent = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip, Component2) => {
1227
+ const ComponentWithHooks = withHooks(wip, Component2);
1228
+ const children = ComponentWithHooks(wip.pendingProps);
1229
+ reconcileChildren(wip, children);
1230
+ }, "renderFunctionComponent");
1231
+ var getProviderContext = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => wip.type._context, "getProviderContext");
940
1232
  var cloneChildFibers = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
941
1233
  const currentChild = wip.alternate?.child ?? null;
942
1234
  if (!currentChild) {
@@ -959,14 +1251,6 @@ var cloneChildFibers = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
959
1251
  if (prevNewChild) prevNewChild.sibling = null;
960
1252
  return wip.child;
961
1253
  }, "cloneChildFibers");
962
- var hasNoPendingWork = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => !(wip.lanes & getCurrentLanePriority()), "hasNoPendingWork");
963
- var isUpdate = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => wip.alternate !== null, "isUpdate");
964
- var renderFunctionComponent = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip, Component) => {
965
- const ComponentWithHooks = withHooks(wip, Component);
966
- const children = ComponentWithHooks(wip.pendingProps);
967
- reconcileChildren(wip, children);
968
- }, "renderFunctionComponent");
969
- var getProviderContext = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => wip.type._context, "getProviderContext");
970
1254
  var beginWork = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
971
1255
  switch (wip.workTag) {
972
1256
  case MemoComponent: {
@@ -981,12 +1265,12 @@ var beginWork = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
981
1265
  break;
982
1266
  }
983
1267
  case FunctionComponent: {
984
- const Component = wip.type;
985
- if (!shared.isFunction(Component)) break;
1268
+ const Component2 = wip.type;
1269
+ if (!shared.isFunction(Component2)) break;
986
1270
  if (isUpdate(wip) && hasNoPendingWork(wip) && shared.shallowEqual(wip.memoizedProps, wip.pendingProps)) {
987
1271
  return cloneChildFibers(wip);
988
1272
  }
989
- renderFunctionComponent(wip, Component);
1273
+ renderFunctionComponent(wip, Component2);
990
1274
  break;
991
1275
  }
992
1276
  case FragmentComponent:
@@ -1009,33 +1293,85 @@ var beginWork = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
1009
1293
  }
1010
1294
  break;
1011
1295
  }
1012
- }
1013
- return wip.child;
1014
- }, "beginWork");
1015
- var completeUnitOfWork = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((unit, stopAt) => {
1016
- let completed = unit;
1017
- while (completed) {
1018
- bubbleProperties(completed);
1019
- if (completed === stopAt) {
1020
- return null;
1296
+ case SuspenseComponent: {
1297
+ const children = isSuspendedBoundary(wip) ? wip.pendingProps?.fallback : wip.pendingProps?.children;
1298
+ reconcileChildren(wip, children);
1299
+ break;
1021
1300
  }
1022
- if (completed.sibling) {
1023
- return completed.sibling;
1301
+ case ClassComponent: {
1302
+ const Ctor = wip.type;
1303
+ const isMount = !wip.classInstance;
1304
+ if (isMount) {
1305
+ const instance4 = new Ctor(wip.pendingProps);
1306
+ instance4._fiber = wip;
1307
+ wip.classInstance = instance4;
1308
+ if (instance4._pendingStateQueue?.length) {
1309
+ instance4.state = flushStateQueue(
1310
+ instance4.state,
1311
+ instance4.props,
1312
+ instance4._pendingStateQueue
1313
+ );
1314
+ instance4._pendingStateQueue = [];
1315
+ }
1316
+ } else {
1317
+ const instance4 = wip.classInstance;
1318
+ if (hasNoPendingWork(wip) && !instance4._pendingStateQueue?.length && shared.shallowEqual(instance4.props, wip.pendingProps)) {
1319
+ return cloneChildFibers(wip);
1320
+ }
1321
+ instance4._prevProps = instance4.props;
1322
+ instance4._prevState = { ...instance4.state };
1323
+ if (instance4._pendingStateQueue?.length) {
1324
+ instance4.state = flushStateQueue(
1325
+ instance4.state,
1326
+ wip.pendingProps,
1327
+ instance4._pendingStateQueue
1328
+ );
1329
+ instance4._pendingStateQueue = [];
1330
+ }
1331
+ instance4.props = wip.pendingProps;
1332
+ instance4._fiber = wip;
1333
+ if (isUpdate(wip) && typeof instance4.shouldComponentUpdate === "function" && !instance4.shouldComponentUpdate(wip.pendingProps, instance4.state)) {
1334
+ return cloneChildFibers(wip);
1335
+ }
1336
+ }
1337
+ const children = wip.classInstance.render();
1338
+ reconcileChildren(wip, children);
1339
+ break;
1340
+ }
1341
+ case LazyComponent: {
1342
+ const lazy2 = wip.type;
1343
+ if (lazy2._status === "resolved") {
1344
+ renderFunctionComponent(wip, lazy2._result);
1345
+ break;
1346
+ }
1347
+ if (lazy2._status === "rejected") {
1348
+ throw lazy2._result;
1349
+ }
1350
+ if (lazy2._status === "uninitialized") {
1351
+ lazy2._status = "pending";
1352
+ lazy2._promise = lazy2._factory().then(
1353
+ (module) => {
1354
+ lazy2._status = "resolved";
1355
+ lazy2._result = module?.default ?? module;
1356
+ },
1357
+ (error) => {
1358
+ lazy2._status = "rejected";
1359
+ lazy2._result = error;
1360
+ }
1361
+ );
1362
+ }
1363
+ throw lazy2._promise;
1364
+ }
1365
+ case PortalComponent: {
1366
+ wip.stateNode = wip.pendingProps.containerInfo;
1367
+ reconcileChildren(wip, wip.pendingProps.children);
1368
+ break;
1024
1369
  }
1025
- completed = completed.return;
1026
- }
1027
- return null;
1028
- }, "completeUnitOfWork");
1029
- var bubbleFlagsToRoot = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
1030
- let current = wip;
1031
- let parent = current.return;
1032
- while (parent) {
1033
- parent.subtreeFlags |= current.flags | current.subtreeFlags;
1034
- parent.childLanes |= current.lanes | current.childLanes;
1035
- current = parent;
1036
- parent = parent.return;
1037
1370
  }
1038
- }, "bubbleFlagsToRoot");
1371
+ return wip.child;
1372
+ }, "beginWork");
1373
+
1374
+ // ../rectify-reconciler/src/RectifyFiberCompleteWork.ts
1039
1375
  var bubbleProperties = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
1040
1376
  wip.lanes &= ~getCurrentLanePriority();
1041
1377
  let subtreeFlags = NoFlags;
@@ -1050,140 +1386,109 @@ var bubbleProperties = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
1050
1386
  wip.subtreeFlags = subtreeFlags;
1051
1387
  wip.childLanes = childLanes;
1052
1388
  }, "bubbleProperties");
1053
- var reuseOrCreate = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((oldFiber, element, wip) => {
1054
- const newFiber = createWorkInProgress(oldFiber, element.props);
1055
- if (hasPropsChanged(oldFiber.memoizedProps, element.props)) {
1056
- addFlagToFiber(newFiber, UpdateFlag);
1389
+ var bubbleFlagsToRoot = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
1390
+ let current = wip;
1391
+ let parent = current.return;
1392
+ while (parent) {
1393
+ parent.subtreeFlags |= current.flags | current.subtreeFlags;
1394
+ parent.childLanes |= current.lanes | current.childLanes;
1395
+ current = parent;
1396
+ parent = parent.return;
1057
1397
  }
1058
- if ((oldFiber.memoizedProps?.ref ?? null) !== (element.props?.ref ?? null)) {
1059
- addFlagToFiber(newFiber, RefFlag);
1398
+ }, "bubbleFlagsToRoot");
1399
+ var completeUnitOfWork = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((unit, stopAt) => {
1400
+ let completed = unit;
1401
+ while (completed) {
1402
+ bubbleProperties(completed);
1403
+ if (completed === stopAt) return null;
1404
+ if (completed.sibling) return completed.sibling;
1405
+ completed = completed.return;
1060
1406
  }
1061
- newFiber.return = wip;
1062
- return newFiber;
1063
- }, "reuseOrCreate");
1064
- var createAndPlace = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((element, wip) => {
1065
- const newFiber = createFiberFromRectifyElement(element);
1066
- newFiber.type = element.type;
1067
- addFlagToFiber(newFiber, PlacementFlag);
1068
- newFiber.return = wip;
1069
- return newFiber;
1070
- }, "createAndPlace");
1071
- var appendFiber = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber, prev, index, wip) => {
1072
- fiber.index = index;
1073
- if (!prev) wip.child = fiber;
1074
- else prev.sibling = fiber;
1075
- return fiber;
1076
- }, "appendFiber");
1077
- var buildOldFiberMap = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((firstRemaining, startIndex) => {
1078
- const map = /* @__PURE__ */ new Map();
1079
- let fiber = firstRemaining;
1080
- let i = startIndex;
1081
- while (fiber) {
1082
- map.set(fiber.key ?? i, fiber);
1083
- fiber = fiber.sibling;
1084
- i++;
1407
+ return null;
1408
+ }, "completeUnitOfWork");
1409
+
1410
+ // ../rectify-reconciler/src/RectifyFiberWorkLoop.ts
1411
+ var swapCurrentForWip = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((current, wip) => {
1412
+ const parent = wip.return;
1413
+ if (!parent) return;
1414
+ if (parent.child === current) {
1415
+ parent.child = wip;
1416
+ return;
1085
1417
  }
1086
- return map;
1087
- }, "buildOldFiberMap");
1088
- var reconcileSequential = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((state, firstOldFiber) => {
1089
- let oldFiber = firstOldFiber;
1090
- let i = 0;
1091
- for (; i < state.newElements.length; i++) {
1092
- const element = state.newElements[i];
1093
- const { key: elementKey = null, type: elementType } = element;
1094
- if (!oldFiber) break;
1095
- if (oldFiber.key !== elementKey) break;
1096
- if (oldFiber.type === elementType) {
1097
- state.prev = appendFiber(reuseOrCreate(oldFiber, element, state.wip), state.prev, state.index++, state.wip);
1098
- } else {
1099
- addFlagToFiber(oldFiber, DeletionFlag);
1100
- state.deletions.push(oldFiber);
1101
- state.prev = appendFiber(createAndPlace(element, state.wip), state.prev, state.index++, state.wip);
1102
- }
1103
- oldFiber = oldFiber.sibling;
1418
+ let prevSibling = parent.child;
1419
+ while (prevSibling && prevSibling.sibling !== current) {
1420
+ prevSibling = prevSibling.sibling;
1104
1421
  }
1105
- return { stoppedAt: i, oldFiber };
1106
- }, "reconcileSequential");
1107
- var reconcileKeyed = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((state, startAt, remainingOldFiber) => {
1108
- const oldFiberMap = buildOldFiberMap(remainingOldFiber, startAt);
1109
- let lastPlacedIndex = 0;
1110
- for (let i = startAt; i < state.newElements.length; i++) {
1111
- const element = state.newElements[i];
1112
- const { key: elementKey = null, type: elementType } = element;
1113
- const mapKey = elementKey ?? i;
1114
- const matched = oldFiberMap.get(mapKey) ?? null;
1115
- if (matched && matched.type === elementType) {
1116
- oldFiberMap.delete(mapKey);
1117
- const newFiber = reuseOrCreate(matched, element, state.wip);
1118
- if (matched.index < lastPlacedIndex) {
1119
- addFlagToFiber(newFiber, MoveFlag);
1120
- } else {
1121
- lastPlacedIndex = matched.index;
1422
+ if (prevSibling) prevSibling.sibling = wip;
1423
+ }, "swapCurrentForWip");
1424
+ var workLoop = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wipRoot) => {
1425
+ let workInProgress = wipRoot;
1426
+ while (workInProgress) {
1427
+ try {
1428
+ const next = beginWork(workInProgress);
1429
+ workInProgress = next ?? completeUnitOfWork(workInProgress, wipRoot);
1430
+ } catch (thrown) {
1431
+ if (isThenable(thrown) && workInProgress) {
1432
+ const boundary = findNearestSuspenseBoundary(workInProgress);
1433
+ if (boundary) {
1434
+ handleSuspendedWork(boundary, thrown);
1435
+ workInProgress = boundary;
1436
+ continue;
1437
+ }
1122
1438
  }
1123
- state.prev = appendFiber(newFiber, state.prev, state.index++, state.wip);
1124
- } else {
1125
- state.prev = appendFiber(createAndPlace(element, state.wip), state.prev, state.index++, state.wip);
1439
+ throw thrown;
1126
1440
  }
1127
1441
  }
1128
- for (const orphan of oldFiberMap.values()) {
1129
- addFlagToFiber(orphan, DeletionFlag);
1130
- state.deletions.push(orphan);
1131
- }
1132
- }, "reconcileKeyed");
1133
- var toChildArray = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((children) => {
1134
- if (children == null || typeof children === "boolean") return [];
1135
- if (shared.isArray(children)) return children;
1136
- return [children];
1137
- }, "toChildArray");
1138
- var reconcileChildren = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip, children) => {
1139
- const newElements = toChildArray(children).map(shared.createElementFromRectifyNode).filter(shared.isValidRectifyElement);
1140
- const state = { wip, newElements, deletions: [], prev: null, index: 0 };
1141
- const firstOldFiber = wip.alternate?.child ?? null;
1142
- const { stoppedAt, oldFiber } = reconcileSequential(state, firstOldFiber);
1143
- if (stoppedAt < newElements.length) {
1144
- reconcileKeyed(state, stoppedAt, oldFiber);
1145
- } else {
1146
- let leftover = oldFiber;
1147
- while (leftover) {
1148
- addFlagToFiber(leftover, DeletionFlag);
1149
- state.deletions.push(leftover);
1150
- leftover = leftover.sibling;
1442
+ }, "workLoop");
1443
+ var workLoopConcurrent = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wipRoot) => {
1444
+ let workInProgress = getResumeCursor() ?? wipRoot;
1445
+ clearResumeCursor();
1446
+ while (workInProgress && !shouldYield()) {
1447
+ try {
1448
+ const next = beginWork(workInProgress);
1449
+ workInProgress = next ?? completeUnitOfWork(workInProgress, wipRoot);
1450
+ } catch (thrown) {
1451
+ if (isThenable(thrown) && workInProgress) {
1452
+ const boundary = findNearestSuspenseBoundary(workInProgress);
1453
+ if (boundary) {
1454
+ handleSuspendedWork(boundary, thrown);
1455
+ workInProgress = boundary;
1456
+ continue;
1457
+ }
1458
+ }
1459
+ throw thrown;
1151
1460
  }
1152
1461
  }
1153
- if (state.prev) state.prev.sibling = null;
1154
- if (state.deletions.length) wip.deletions = state.deletions;
1155
- }, "reconcileChildren");
1156
-
1157
- // ../rectify-reconciler/src/RectifyFiberCommitWork.ts
1158
- var MutationMask = PlacementFlag | UpdateFlag | MoveFlag | RefFlag;
1159
- var commitWork = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((finishedWork) => {
1160
- if (finishedWork.deletions?.length) {
1161
- finishedWork.deletions.forEach(removeHostTree);
1162
- finishedWork.deletions = null;
1462
+ if (workInProgress !== null) {
1463
+ setResumeCursor(workInProgress);
1464
+ return false;
1163
1465
  }
1164
- if (finishedWork.flags & MutationMask) {
1165
- commitMutation(finishedWork);
1166
- syncMemoizedProps(finishedWork);
1466
+ return true;
1467
+ }, "workLoopConcurrent");
1468
+ var workLoopOnFiberLanes = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wipRoot, renderLanes) => {
1469
+ if (wipRoot.lanes & renderLanes) {
1470
+ const wip = createWorkInProgress(wipRoot, wipRoot.pendingProps);
1471
+ swapCurrentForWip(wipRoot, wip);
1472
+ const isSync = !!(renderLanes & (SyncLane | InputLane));
1473
+ const completed = isSync ? (workLoop(wip), true) : workLoopConcurrent(wip);
1474
+ if (completed) bubbleFlagsToRoot(wip);
1475
+ return completed;
1167
1476
  }
1168
- if (finishedWork.subtreeFlags & MutationMask) {
1169
- let child = finishedWork.child;
1477
+ if (wipRoot.childLanes & renderLanes) {
1478
+ let child = wipRoot.child;
1170
1479
  while (child) {
1171
- commitWork(child);
1480
+ if (!workLoopOnFiberLanes(child, renderLanes)) return false;
1172
1481
  child = child.sibling;
1173
1482
  }
1174
1483
  }
1175
- finishedWork.flags = NoFlags;
1176
- finishedWork.subtreeFlags = NoFlags;
1177
- }, "commitWork");
1178
- var syncMemoizedProps = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
1179
- wip.memoizedProps = wip.pendingProps;
1180
- }, "syncMemoizedProps");
1484
+ return true;
1485
+ }, "workLoopOnFiberLanes");
1181
1486
  var attachRef = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
1182
1487
  const ref = wip.pendingProps?.ref;
1183
1488
  if (!ref) return;
1184
- if (typeof ref === "function") {
1489
+ if (shared.isFunction(ref)) {
1185
1490
  const cleanup = ref(wip.stateNode);
1186
- wip.refCleanup = typeof cleanup === "function" ? cleanup : null;
1491
+ wip.refCleanup = shared.isFunction(cleanup) ? cleanup : null;
1187
1492
  } else if (typeof ref === "object" && "current" in ref) {
1188
1493
  ref.current = wip.stateNode;
1189
1494
  }
@@ -1202,27 +1507,30 @@ var detachRef = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
1202
1507
  ref.current = null;
1203
1508
  }
1204
1509
  }, "detachRef");
1510
+
1511
+ // ../rectify-reconciler/src/RectifyFiberCommitPlacement.ts
1205
1512
  var insertIntoParent = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip, node) => {
1206
1513
  const parentDom = getParentDom(wip);
1207
- const before = getHostSibling(wip) ?? (wip.return ? getHostSibling(wip.return) : null);
1208
- if (before) parentDom.insertBefore(node, before);
1209
- else parentDom.appendChild(node);
1514
+ let cursor = wip;
1515
+ while (cursor) {
1516
+ const before = getHostSibling(cursor);
1517
+ if (before) {
1518
+ parentDom.insertBefore(node, before);
1519
+ return;
1520
+ }
1521
+ const parent = cursor.return;
1522
+ if (!parent || parent.workTag === HostComponent || parent.workTag === HostRoot) break;
1523
+ cursor = parent;
1524
+ }
1525
+ parentDom.appendChild(node);
1210
1526
  }, "insertIntoParent");
1211
1527
  var placeNode = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip, node) => {
1212
1528
  insertIntoParent(wip, node);
1213
1529
  precacheFiberNode(wip, node);
1214
1530
  attachRef(wip);
1215
1531
  }, "placeNode");
1216
- var commitMutation = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((childFiber) => {
1217
- switch (childFiber.workTag) {
1218
- case HostComponent:
1219
- commitMutationHostComponent(childFiber);
1220
- break;
1221
- case HostText:
1222
- commitMutationHostText(childFiber);
1223
- break;
1224
- }
1225
- }, "commitMutation");
1532
+
1533
+ // ../rectify-reconciler/src/RectifyFiberCommitMutation.ts
1226
1534
  var commitMutationHostComponent = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
1227
1535
  if (!wip.stateNode) {
1228
1536
  const node = createDomElementFromFiber(wip);
@@ -1273,7 +1581,22 @@ var commitMutationHostText = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((wip) => {
1273
1581
  removeFlagFromFiber(wip, UpdateFlag);
1274
1582
  }
1275
1583
  }, "commitMutationHostText");
1584
+ var commitMutation = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
1585
+ switch (fiber.workTag) {
1586
+ case HostComponent:
1587
+ commitMutationHostComponent(fiber);
1588
+ break;
1589
+ case HostText:
1590
+ commitMutationHostText(fiber);
1591
+ break;
1592
+ }
1593
+ }, "commitMutation");
1594
+
1595
+ // ../rectify-reconciler/src/RectifyFiberCommitRemoval.ts
1276
1596
  var removeHostTree = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
1597
+ if (fiber.workTag === ClassComponent) {
1598
+ fiber.classInstance?.componentWillUnmount?.();
1599
+ }
1277
1600
  if (fiber.memoizedState) {
1278
1601
  runEffectCleanups(fiber);
1279
1602
  }
@@ -1289,96 +1612,48 @@ var removeHostTree = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
1289
1612
  }
1290
1613
  }, "removeHostTree");
1291
1614
 
1292
- // ../rectify-reconciler/src/RectifyFiberConcurrentUpdate.ts
1293
- var instance3 = {
1294
- head: null,
1295
- tail: null
1296
- };
1297
- var enqueueUpdate = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((update) => {
1298
- update.next = null;
1299
- if (instance3.tail === null) {
1300
- instance3.head = update;
1301
- instance3.tail = update;
1302
- return;
1303
- }
1304
- instance3.tail.next = update;
1305
- instance3.tail = update;
1306
- }, "enqueueUpdate");
1307
- var dequeueUpdate = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
1308
- const first = instance3.head;
1309
- if (first === null) {
1310
- return null;
1311
- }
1312
- instance3.head = first.next;
1313
- if (instance3.head === null) {
1314
- instance3.tail = null;
1615
+ // ../rectify-reconciler/src/RectifyFiberCommitWork.ts
1616
+ var MutationMask = PlacementFlag | UpdateFlag | MoveFlag | RefFlag;
1617
+ var commitWork = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((finishedWork) => {
1618
+ if (finishedWork.deletions?.length) {
1619
+ finishedWork.deletions.forEach(removeHostTree);
1620
+ finishedWork.deletions = null;
1315
1621
  }
1316
- first.next = null;
1317
- return first;
1318
- }, "dequeueUpdate");
1319
- var hasUpdate = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => instance3.head !== null, "hasUpdate");
1320
-
1321
- // ../rectify-reconciler/src/RectifyFiberReconciler.ts
1322
- injectEventPriorityCallbacks(
1323
- setCurrentEventPriority,
1324
- resetCurrentEventPriority
1325
- );
1326
- var isFlushingLayoutEffects = false;
1327
- var performWork = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((lanes) => {
1328
- const fiberRoot = getScheduledFiberRoot();
1329
- if (!fiberRoot) return;
1330
- if (!getResumeCursor()) flushPendingUpdates();
1331
- setCurrentRenderingLanes(lanes);
1332
- const completed = workLoopOnFiberLanes(fiberRoot.root, lanes);
1333
- if (!completed) {
1334
- scheduleRenderLane(lanes);
1335
- return;
1622
+ if (finishedWork.flags & MutationMask) {
1623
+ commitMutation(finishedWork);
1624
+ finishedWork.memoizedProps = finishedWork.pendingProps;
1336
1625
  }
1337
- clearResumeCursor();
1338
- commitWork(fiberRoot.root);
1339
- markContainerAsRoot(fiberRoot.root, fiberRoot.containerDom);
1340
- flushLayoutPhase(fiberRoot);
1341
- schedulePassiveEffects();
1342
- }, "performWork");
1343
- setWorkCallback(performWork);
1344
- var onScheduleRerender = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
1345
- const lane = isFlushingLayoutEffects ? SyncLane : requestUpdateLane();
1346
- enqueueUpdate({ lanes: lane, fiber, next: null });
1347
- if (!isFlushingLayoutEffects) {
1348
- scheduleRenderLane(lane);
1626
+ if (finishedWork.subtreeFlags & MutationMask) {
1627
+ let child = finishedWork.child;
1628
+ while (child) {
1629
+ commitWork(child);
1630
+ child = child.sibling;
1631
+ }
1349
1632
  }
1350
- }, "onScheduleRerender");
1351
- var onMarkFiberDirty = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
1352
- const lane = getCurrentLanePriority();
1353
- fiber.lanes |= lane;
1354
- const wip = fiber.alternate;
1355
- if (!wip) return;
1356
- wip.lanes |= lane;
1357
- let parent = wip.return;
1358
- while (parent) {
1359
- if ((parent.childLanes & lane) === lane) break;
1360
- parent.childLanes |= lane;
1361
- parent = parent.return;
1633
+ if (finishedWork.workTag === ClassComponent && finishedWork.classInstance) {
1634
+ const instance4 = finishedWork.classInstance;
1635
+ const isMount = finishedWork.alternate === null;
1636
+ if (isMount) {
1637
+ instance4.componentDidMount?.();
1638
+ } else if (instance4._prevState !== void 0) {
1639
+ instance4.componentDidUpdate?.(
1640
+ instance4._prevProps,
1641
+ instance4._prevState
1642
+ );
1643
+ instance4._prevProps = void 0;
1644
+ instance4._prevState = void 0;
1645
+ }
1362
1646
  }
1363
- }, "onMarkFiberDirty");
1364
- setScheduleRerender(onScheduleRerender);
1365
- setMarkFiberDirty(onMarkFiberDirty);
1366
- var createContainer = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((container) => {
1367
- return createHostRootFiber(container);
1368
- }, "createContainer");
1369
- var updateContainer = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((children, fiberRoot) => {
1370
- fiberRoot.children = children;
1371
- setScheduledFiberRoot(fiberRoot);
1372
- const wipRoot = createWorkInProgress(fiberRoot.root, { children });
1373
- setCurrentRenderingLanes(SyncLane);
1374
- workLoop(wipRoot);
1375
- commitWork(wipRoot);
1376
- fiberRoot.root = wipRoot;
1377
- markContainerAsRoot(wipRoot, fiberRoot.containerDom);
1378
- setScheduledFiberRoot(fiberRoot);
1379
- flushLayoutPhase(fiberRoot);
1380
- schedulePassiveEffects();
1381
- }, "updateContainer");
1647
+ finishedWork.flags = NoFlags;
1648
+ finishedWork.subtreeFlags = NoFlags;
1649
+ }, "commitWork");
1650
+
1651
+ // ../rectify-reconciler/src/RectifyFiberFlushPhase.ts
1652
+ var _isFlushingLayoutEffects = false;
1653
+ var getIsFlushingLayoutEffects = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => _isFlushingLayoutEffects, "getIsFlushingLayoutEffects");
1654
+ var setIsFlushingLayoutEffects = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((value) => {
1655
+ _isFlushingLayoutEffects = value;
1656
+ }, "setIsFlushingLayoutEffects");
1382
1657
  var passiveChannel = new MessageChannel();
1383
1658
  var schedulePassiveEffects = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
1384
1659
  passiveChannel.port1.onmessage = () => {
@@ -1389,10 +1664,10 @@ var schedulePassiveEffects = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(() => {
1389
1664
  }, "schedulePassiveEffects");
1390
1665
  var flushLayoutPhase = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiberRoot) => {
1391
1666
  while (true) {
1392
- isFlushingLayoutEffects = true;
1667
+ setIsFlushingLayoutEffects(true);
1393
1668
  flushLayoutEffectCleanups();
1394
1669
  flushLayoutEffects();
1395
- isFlushingLayoutEffects = false;
1670
+ setIsFlushingLayoutEffects(false);
1396
1671
  if (!hasUpdate()) break;
1397
1672
  flushPendingUpdates();
1398
1673
  setCurrentRenderingLanes(SyncLane);
@@ -1423,6 +1698,71 @@ var propagateLaneToAncestors = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((updateQ
1423
1698
  }
1424
1699
  }, "propagateLaneToAncestors");
1425
1700
 
1701
+ // ../rectify-reconciler/src/RectifyFiberHookBridge.ts
1702
+ var onScheduleRerender = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
1703
+ const lane = getIsFlushingLayoutEffects() ? SyncLane : requestUpdateLane();
1704
+ enqueueUpdate({ lanes: lane, fiber, next: null });
1705
+ if (!getIsFlushingLayoutEffects()) {
1706
+ scheduleRenderLane(lane);
1707
+ }
1708
+ }, "onScheduleRerender");
1709
+ var onMarkFiberDirty = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((fiber) => {
1710
+ const lane = getCurrentLanePriority();
1711
+ fiber.lanes |= lane;
1712
+ const wip = fiber.alternate;
1713
+ if (!wip) return;
1714
+ wip.lanes |= lane;
1715
+ let parent = wip.return;
1716
+ while (parent) {
1717
+ if ((parent.childLanes & lane) === lane) break;
1718
+ parent.childLanes |= lane;
1719
+ parent = parent.return;
1720
+ }
1721
+ }, "onMarkFiberDirty");
1722
+ setScheduleRerender(onScheduleRerender);
1723
+ setMarkFiberDirty(onMarkFiberDirty);
1724
+
1725
+ // ../rectify-reconciler/src/RectifyFiberBootstrap.ts
1726
+ injectEventPriorityCallbacks(
1727
+ setCurrentEventPriority,
1728
+ resetCurrentEventPriority
1729
+ );
1730
+ var performWork = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((lanes) => {
1731
+ const fiberRoot = getScheduledFiberRoot();
1732
+ if (!fiberRoot) return;
1733
+ if (!getResumeCursor()) flushPendingUpdates();
1734
+ setCurrentRenderingLanes(lanes);
1735
+ const completed = workLoopOnFiberLanes(fiberRoot.root, lanes);
1736
+ if (!completed) {
1737
+ scheduleRenderLane(lanes);
1738
+ return;
1739
+ }
1740
+ clearResumeCursor();
1741
+ commitWork(fiberRoot.root);
1742
+ markContainerAsRoot(fiberRoot.root, fiberRoot.containerDom);
1743
+ flushLayoutPhase(fiberRoot);
1744
+ schedulePassiveEffects();
1745
+ }, "performWork");
1746
+ setWorkCallback(performWork);
1747
+
1748
+ // ../rectify-reconciler/src/RectifyFiberReconciler.ts
1749
+ var createContainer = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((container) => {
1750
+ return createHostRootFiber(container);
1751
+ }, "createContainer");
1752
+ var updateContainer = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((children, fiberRoot) => {
1753
+ fiberRoot.children = children;
1754
+ setScheduledFiberRoot(fiberRoot);
1755
+ const wipRoot = createWorkInProgress(fiberRoot.root, { children });
1756
+ setCurrentRenderingLanes(SyncLane);
1757
+ workLoop(wipRoot);
1758
+ commitWork(wipRoot);
1759
+ fiberRoot.root = wipRoot;
1760
+ markContainerAsRoot(wipRoot, fiberRoot.containerDom);
1761
+ setScheduledFiberRoot(fiberRoot);
1762
+ flushLayoutPhase(fiberRoot);
1763
+ schedulePassiveEffects();
1764
+ }, "updateContainer");
1765
+
1426
1766
  // ../rectify-dom/src/RectifyDomRoot.ts
1427
1767
  var createRoot = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((container) => {
1428
1768
  const hostRoot = createContainer(container);
@@ -1437,17 +1777,94 @@ var createRoot = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((container) => {
1437
1777
  }, "unmount")
1438
1778
  };
1439
1779
  }, "createRoot");
1780
+ var createPortal = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((children, container, key = null) => {
1781
+ listenToAllEventSupported(container);
1782
+ return {
1783
+ $$typeof: shared.RECTIFY_PORTAL_TYPE,
1784
+ type: null,
1785
+ key,
1786
+ props: {
1787
+ children,
1788
+ containerInfo: container
1789
+ }
1790
+ };
1791
+ }, "createPortal");
1440
1792
 
1441
1793
  // src/RectifyMemo.ts
1442
- function memo(Component, compare) {
1794
+ function memo(Component2, compare) {
1443
1795
  const wrapper = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name(((_props) => null), "wrapper");
1444
1796
  wrapper._isMemo = true;
1445
- wrapper._render = Component;
1797
+ wrapper._render = Component2;
1446
1798
  wrapper._compare = compare ?? null;
1447
1799
  return wrapper;
1448
1800
  }
1449
1801
  chunkAJJIEZ7G_cjs.__name(memo, "memo");
1450
1802
 
1803
+ // src/RectifyLazy.ts
1804
+ var lazy = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((factory) => {
1805
+ const stub = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((() => null), "stub");
1806
+ return Object.assign(stub, {
1807
+ _isLazy: true,
1808
+ _status: "uninitialized",
1809
+ _result: null,
1810
+ _promise: null,
1811
+ _factory: factory
1812
+ });
1813
+ }, "lazy");
1814
+
1815
+ // src/RectifySuspense.ts
1816
+ var Suspense = /* @__PURE__ */ chunkAJJIEZ7G_cjs.__name((_props) => null, "Suspense");
1817
+ Suspense._isSuspense = true;
1818
+
1819
+ // src/RectifyComponent.ts
1820
+ var _Component = class _Component {
1821
+ constructor(props) {
1822
+ this.state = {};
1823
+ /**
1824
+ * @internal Set by the reconciler when the instance is created so
1825
+ * `setState` can enqueue a re-render on the correct fiber.
1826
+ */
1827
+ this._fiber = null;
1828
+ /**
1829
+ * @internal Snapshots taken by the reconciler in beginWork before each
1830
+ * update render so that `componentDidUpdate` receives the correct prev values.
1831
+ * Cleared after `componentDidUpdate` is called.
1832
+ */
1833
+ this._prevProps = void 0;
1834
+ this._prevState = void 0;
1835
+ /**
1836
+ * @internal Queue of pending setState updates, flushed by the reconciler
1837
+ * during beginWork so that prevState snapshots can be taken first.
1838
+ */
1839
+ this._pendingStateQueue = [];
1840
+ this.props = props;
1841
+ }
1842
+ // ---------------------------------------------------------------------------
1843
+ // Core API
1844
+ // ---------------------------------------------------------------------------
1845
+ /**
1846
+ * Merges `partialState` into the current state and schedules a re-render.
1847
+ * Accepts either a plain partial state object or an updater function.
1848
+ */
1849
+ setState(partialState) {
1850
+ this._pendingStateQueue.push(partialState);
1851
+ if (this._fiber) {
1852
+ scheduleRerender(this._fiber);
1853
+ }
1854
+ }
1855
+ /**
1856
+ * Must be implemented by every class component.
1857
+ * Returns the subtree to render.
1858
+ */
1859
+ render() {
1860
+ return null;
1861
+ }
1862
+ };
1863
+ chunkAJJIEZ7G_cjs.__name(_Component, "Component");
1864
+ /** Marks this as a class component for the reconciler. */
1865
+ _Component._isClassComponent = true;
1866
+ var Component = _Component;
1867
+
1451
1868
  Object.defineProperty(exports, "Fragment", {
1452
1869
  enumerable: true,
1453
1870
  get: function () { return chunkAJJIEZ7G_cjs.Fragment; }
@@ -1456,13 +1873,18 @@ Object.defineProperty(exports, "jsx", {
1456
1873
  enumerable: true,
1457
1874
  get: function () { return chunkAJJIEZ7G_cjs.jsx; }
1458
1875
  });
1876
+ exports.Component = Component;
1877
+ exports.Suspense = Suspense;
1459
1878
  exports.SyntheticEvent = SyntheticEvent_default;
1460
1879
  exports.createContext = createContext;
1880
+ exports.createPortal = createPortal;
1461
1881
  exports.createRoot = createRoot;
1882
+ exports.lazy = lazy;
1462
1883
  exports.memo = memo;
1463
1884
  exports.useCallback = RectifyHookUseCallback_default;
1464
1885
  exports.useContext = useContext;
1465
1886
  exports.useEffect = RectifyHookUseEffect_default;
1887
+ exports.useId = RectifyHookUseId_default;
1466
1888
  exports.useLayoutEffect = RectifyHookUseLayoutEffect_default;
1467
1889
  exports.useMemo = RectifyHookUseMemo_default;
1468
1890
  exports.useReducer = RectifyHookUseReducer_default;