react-server-dom-webpack 18.3.0-next-6ddcbd4f9-20230209 → 18.3.0-next-4a4ef2706-20230212

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.
@@ -31,11 +31,11 @@
31
31
  }
32
32
 
33
33
  // eslint-disable-next-line no-unused-vars
34
- function resolveClientReference(bundlerConfig, moduleData) {
34
+ function resolveClientReference(bundlerConfig, metadata) {
35
35
  if (bundlerConfig) {
36
- var resolvedModuleData = bundlerConfig[moduleData.id][moduleData.name];
36
+ var resolvedModuleData = bundlerConfig[metadata.id][metadata.name];
37
37
 
38
- if (moduleData.async) {
38
+ if (metadata.async) {
39
39
  return {
40
40
  id: resolvedModuleData.id,
41
41
  chunks: resolvedModuleData.chunks,
@@ -47,7 +47,7 @@
47
47
  }
48
48
  }
49
49
 
50
- return moduleData;
50
+ return metadata;
51
51
  } // The chunk cache contains all the chunks we've preloaded so far.
52
52
  // If they're still pending they're a thenable. This map also exists
53
53
  // in Webpack but unfortunately it's not exposed so we have to
@@ -61,8 +61,8 @@
61
61
  // This function doesn't suspend.
62
62
 
63
63
 
64
- function preloadModule(moduleData) {
65
- var chunks = moduleData.chunks;
64
+ function preloadModule(metadata) {
65
+ var chunks = metadata.chunks;
66
66
  var promises = [];
67
67
 
68
68
  for (var i = 0; i < chunks.length; i++) {
@@ -82,8 +82,8 @@
82
82
  }
83
83
  }
84
84
 
85
- if (moduleData.async) {
86
- var existingPromise = asyncModuleCache.get(moduleData.id);
85
+ if (metadata.async) {
86
+ var existingPromise = asyncModuleCache.get(metadata.id);
87
87
 
88
88
  if (existingPromise) {
89
89
  if (existingPromise.status === 'fulfilled') {
@@ -93,7 +93,7 @@
93
93
  return existingPromise;
94
94
  } else {
95
95
  var modulePromise = Promise.all(promises).then(function () {
96
- return __webpack_require__(moduleData.id);
96
+ return __webpack_require__(metadata.id);
97
97
  });
98
98
  modulePromise.then(function (value) {
99
99
  var fulfilledThenable = modulePromise;
@@ -104,7 +104,7 @@
104
104
  rejectedThenable.status = 'rejected';
105
105
  rejectedThenable.reason = reason;
106
106
  });
107
- asyncModuleCache.set(moduleData.id, modulePromise);
107
+ asyncModuleCache.set(metadata.id, modulePromise);
108
108
  return modulePromise;
109
109
  }
110
110
  } else if (promises.length > 0) {
@@ -115,13 +115,13 @@
115
115
  } // Actually require the module or suspend if it's not yet ready.
116
116
  // Increase priority if necessary.
117
117
 
118
- function requireModule(moduleData) {
118
+ function requireModule(metadata) {
119
119
  var moduleExports;
120
120
 
121
- if (moduleData.async) {
121
+ if (metadata.async) {
122
122
  // We assume that preloadModule has been called before, which
123
123
  // should have added something to the module cache.
124
- var promise = asyncModuleCache.get(moduleData.id);
124
+ var promise = asyncModuleCache.get(metadata.id);
125
125
 
126
126
  if (promise.status === 'fulfilled') {
127
127
  moduleExports = promise.value;
@@ -129,22 +129,22 @@
129
129
  throw promise.reason;
130
130
  }
131
131
  } else {
132
- moduleExports = __webpack_require__(moduleData.id);
132
+ moduleExports = __webpack_require__(metadata.id);
133
133
  }
134
134
 
135
- if (moduleData.name === '*') {
135
+ if (metadata.name === '*') {
136
136
  // This is a placeholder value that represents that the caller imported this
137
137
  // as a CommonJS module as is.
138
138
  return moduleExports;
139
139
  }
140
140
 
141
- if (moduleData.name === '') {
141
+ if (metadata.name === '') {
142
142
  // This is a placeholder value that represents that the caller accessed the
143
143
  // default property of this if it was an ESM interop module.
144
144
  return moduleExports.__esModule ? moduleExports.default : moduleExports;
145
145
  }
146
146
 
147
- return moduleExports[moduleData.name];
147
+ return moduleExports[metadata.name];
148
148
  }
149
149
 
150
150
  // ATTENTION
@@ -536,6 +536,29 @@
536
536
  };
537
537
  }
538
538
 
539
+ function createServerReferenceProxy(response, metaData) {
540
+ var callServer = response._callServer;
541
+
542
+ var proxy = function () {
543
+ // $FlowFixMe[method-unbinding]
544
+ var args = Array.prototype.slice.call(arguments);
545
+ var p = metaData.bound;
546
+
547
+ if (p.status === INITIALIZED) {
548
+ var bound = p.value;
549
+ return callServer(metaData, bound.concat(args));
550
+ } // Since this is a fake Promise whose .then doesn't chain, we have to wrap it.
551
+ // TODO: Remove the wrapper once that's fixed.
552
+
553
+
554
+ return Promise.resolve(p).then(function (bound) {
555
+ return callServer(metaData, bound.concat(args));
556
+ });
557
+ };
558
+
559
+ return proxy;
560
+ }
561
+
539
562
  function parseModelString(response, parentObject, key, value) {
540
563
  if (value[0] === '$') {
541
564
  if (value === '$') {
@@ -572,18 +595,20 @@
572
595
 
573
596
  case 'S':
574
597
  {
598
+ // Symbol
575
599
  return Symbol.for(value.substring(2));
576
600
  }
577
601
 
578
602
  case 'P':
579
603
  {
604
+ // Server Context Provider
580
605
  return getOrCreateServerContext(value.substring(2)).Provider;
581
606
  }
582
607
 
583
- default:
608
+ case 'F':
584
609
  {
585
- // We assume that anything else is a reference ID.
586
- var _id2 = parseInt(value.substring(1), 16);
610
+ // Server Reference
611
+ var _id2 = parseInt(value.substring(2), 16);
587
612
 
588
613
  var _chunk2 = getChunk(response, _id2);
589
614
 
@@ -591,27 +616,54 @@
591
616
  case RESOLVED_MODEL:
592
617
  initializeModelChunk(_chunk2);
593
618
  break;
619
+ } // The status might have changed after initialization.
620
+
621
+
622
+ switch (_chunk2.status) {
623
+ case INITIALIZED:
624
+ {
625
+ var metadata = _chunk2.value;
626
+ return createServerReferenceProxy(response, metadata);
627
+ }
628
+ // We always encode it first in the stream so it won't be pending.
629
+
630
+ default:
631
+ throw _chunk2.reason;
632
+ }
633
+ }
634
+
635
+ default:
636
+ {
637
+ // We assume that anything else is a reference ID.
638
+ var _id3 = parseInt(value.substring(1), 16);
639
+
640
+ var _chunk3 = getChunk(response, _id3);
641
+
642
+ switch (_chunk3.status) {
643
+ case RESOLVED_MODEL:
644
+ initializeModelChunk(_chunk3);
645
+ break;
594
646
 
595
647
  case RESOLVED_MODULE:
596
- initializeModuleChunk(_chunk2);
648
+ initializeModuleChunk(_chunk3);
597
649
  break;
598
650
  } // The status might have changed after initialization.
599
651
 
600
652
 
601
- switch (_chunk2.status) {
653
+ switch (_chunk3.status) {
602
654
  case INITIALIZED:
603
- return _chunk2.value;
655
+ return _chunk3.value;
604
656
 
605
657
  case PENDING:
606
658
  case BLOCKED:
607
659
  var parentChunk = initializingChunk;
608
660
 
609
- _chunk2.then(createModelResolver(parentChunk, parentObject, key), createModelReject(parentChunk));
661
+ _chunk3.then(createModelResolver(parentChunk, parentObject, key), createModelReject(parentChunk));
610
662
 
611
663
  return null;
612
664
 
613
665
  default:
614
- throw _chunk2.reason;
666
+ throw _chunk3.reason;
615
667
  }
616
668
  }
617
669
  }
@@ -630,10 +682,16 @@
630
682
 
631
683
  return value;
632
684
  }
633
- function createResponse(bundlerConfig) {
685
+
686
+ function missingCall() {
687
+ throw new Error('Trying to call a function from "use server" but the callServer option ' + 'was not implemented in your router runtime.');
688
+ }
689
+
690
+ function createResponse(bundlerConfig, callServer) {
634
691
  var chunks = new Map();
635
692
  var response = {
636
693
  _bundlerConfig: bundlerConfig,
694
+ _callServer: callServer !== undefined ? callServer : missingCall,
637
695
  _chunks: chunks
638
696
  };
639
697
  return response;
@@ -651,12 +709,12 @@
651
709
  function resolveModule(response, id, model) {
652
710
  var chunks = response._chunks;
653
711
  var chunk = chunks.get(id);
654
- var moduleMetaData = parseModel(response, model);
655
- var moduleReference = resolveClientReference(response._bundlerConfig, moduleMetaData); // TODO: Add an option to encode modules that are lazy loaded.
712
+ var clientReferenceMetadata = parseModel(response, model);
713
+ var clientReference = resolveClientReference(response._bundlerConfig, clientReferenceMetadata); // TODO: Add an option to encode modules that are lazy loaded.
656
714
  // For now we preload all modules as early as possible since it's likely
657
715
  // that we'll need them.
658
716
 
659
- var promise = preloadModule(moduleReference);
717
+ var promise = preloadModule(clientReference);
660
718
 
661
719
  if (promise) {
662
720
  var blockedChunk;
@@ -674,17 +732,17 @@
674
732
  }
675
733
 
676
734
  promise.then(function () {
677
- return resolveModuleChunk(blockedChunk, moduleReference);
735
+ return resolveModuleChunk(blockedChunk, clientReference);
678
736
  }, function (error) {
679
737
  return triggerErrorOnChunk(blockedChunk, error);
680
738
  });
681
739
  } else {
682
740
  if (!chunk) {
683
- chunks.set(id, createResolvedModuleChunk(response, moduleReference));
741
+ chunks.set(id, createResolvedModuleChunk(response, clientReference));
684
742
  } else {
685
743
  // This can't actually happen because we don't have any forward
686
744
  // references to modules.
687
- resolveModuleChunk(chunk, moduleReference);
745
+ resolveModuleChunk(chunk, clientReference);
688
746
  }
689
747
  }
690
748
  }
@@ -796,11 +854,11 @@
796
854
  };
797
855
  }
798
856
 
799
- function createResponse$1(bundlerConfig) {
857
+ function createResponse$1(bundlerConfig, callServer) {
800
858
  // NOTE: CHECK THE COMPILER OUTPUT EACH TIME YOU CHANGE THIS.
801
859
  // It should be inlined to one object literal but minor changes can break it.
802
860
  var stringDecoder = createStringDecoder() ;
803
- var response = createResponse(bundlerConfig);
861
+ var response = createResponse(bundlerConfig, callServer);
804
862
  response._partialRow = '';
805
863
 
806
864
  {
@@ -837,13 +895,13 @@
837
895
  }
838
896
 
839
897
  function createFromReadableStream(stream, options) {
840
- var response = createResponse$1(options && options.moduleMap ? options.moduleMap : null);
898
+ var response = createResponse$1(options && options.moduleMap ? options.moduleMap : null, options && options.callServer ? options.callServer : undefined);
841
899
  startReadingFromStream(response, stream);
842
900
  return getRoot(response);
843
901
  }
844
902
 
845
903
  function createFromFetch(promiseForResponse, options) {
846
- var response = createResponse$1(options && options.moduleMap ? options.moduleMap : null);
904
+ var response = createResponse$1(options && options.moduleMap ? options.moduleMap : null, options && options.callServer ? options.callServer : undefined);
847
905
  promiseForResponse.then(function (r) {
848
906
  startReadingFromStream(response, r.body);
849
907
  }, function (e) {
@@ -853,7 +911,7 @@
853
911
  }
854
912
 
855
913
  function createFromXHR(request, options) {
856
- var response = createResponse$1(options && options.moduleMap ? options.moduleMap : null);
914
+ var response = createResponse$1(options && options.moduleMap ? options.moduleMap : null, options && options.callServer ? options.callServer : undefined);
857
915
  var processedLength = 0;
858
916
 
859
917
  function progress(e) {
@@ -7,17 +7,18 @@
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
9
  */
10
- (function(){'use strict';(function(l,n){"object"===typeof exports&&"undefined"!==typeof module?n(exports,require("react")):"function"===typeof define&&define.amd?define(["exports","react"],n):(l=l||self,n(l.ReactServerDOMClient={},l.React))})(this,function(l,n){function H(a,b){return a?(a=a[b.id][b.name],b.async?{id:a.id,chunks:a.chunks,name:a.name,async:!0}:a):b}function I(){}function J(a){for(var b=a.chunks,c=[],d=0;d<b.length;d++){var e=b[d],f=q.get(e);if(void 0===f){f=__webpack_chunk_load__(e);c.push(f);
11
- var h=q.set.bind(q,e,null);f.then(h,I);q.set(e,f)}else null!==f&&c.push(f)}if(a.async){if(b=y.get(a.id))return"fulfilled"===b.status?null:b;var k=Promise.all(c).then(function(){return __webpack_require__(a.id)});k.then(function(a){k.status="fulfilled";k.value=a},function(a){k.status="rejected";k.reason=a});y.set(a.id,k);return k}return 0<c.length?Promise.all(c):null}function m(a,b,c,d){this.status=a;this.value=b;this.reason=c;this._response=d}function K(a){switch(a.status){case "resolved_model":r(a);
10
+ (function(){'use strict';(function(l,p){"object"===typeof exports&&"undefined"!==typeof module?p(exports,require("react")):"function"===typeof define&&define.amd?define(["exports","react"],p):(l=l||self,p(l.ReactServerDOMClient={},l.React))})(this,function(l,p){function H(a,b){return a?(a=a[b.id][b.name],b.async?{id:a.id,chunks:a.chunks,name:a.name,async:!0}:a):b}function I(){}function J(a){for(var b=a.chunks,c=[],d=0;d<b.length;d++){var e=b[d],f=r.get(e);if(void 0===f){f=__webpack_chunk_load__(e);c.push(f);
11
+ var h=r.set.bind(r,e,null);f.then(h,I);r.set(e,f)}else null!==f&&c.push(f)}if(a.async){if(b=y.get(a.id))return"fulfilled"===b.status?null:b;var k=Promise.all(c).then(function(){return __webpack_require__(a.id)});k.then(function(a){k.status="fulfilled";k.value=a},function(a){k.status="rejected";k.reason=a});y.set(a.id,k);return k}return 0<c.length?Promise.all(c):null}function m(a,b,c,d){this.status=a;this.value=b;this.reason=c;this._response=d}function K(a){switch(a.status){case "resolved_model":q(a);
12
12
  break;case "resolved_module":t(a)}switch(a.status){case "fulfilled":return a.value;case "pending":case "blocked":throw a;default:throw a.reason;}}function u(a,b){for(var c=0;c<a.length;c++)(0,a[c])(b)}function C(a,b,c){switch(a.status){case "fulfilled":u(b,a.value);break;case "pending":case "blocked":a.value=b;a.reason=c;break;case "rejected":c&&u(c,a.reason)}}function v(a,b){if("pending"===a.status||"blocked"===a.status){var c=a.reason;a.status="rejected";a.reason=b;null!==c&&u(c,b)}}function D(a,
13
- b){if("pending"===a.status||"blocked"===a.status){var c=a.value,d=a.reason;a.status="resolved_module";a.value=b;null!==c&&(t(a),C(a,c,d))}}function r(a){var b=w,c=g;w=a;g=null;try{var d=JSON.parse(a.value,a._response._fromJSON);null!==g&&0<g.deps?(g.value=d,a.status="blocked",a.value=null,a.reason=null):(a.status="fulfilled",a.value=d)}catch(e){a.status="rejected",a.reason=e}finally{w=b,g=c}}function t(a){try{var b=a.value;if(b.async){var c=y.get(b.id);if("fulfilled"===c.status)var d=c.value;else throw c.reason;
14
- }else d=__webpack_require__(b.id);var e="*"===b.name?d:""===b.name?d.__esModule?d.default:d:d[b.name];a.status="fulfilled";a.value=e}catch(f){a.status="rejected",a.reason=f}}function x(a,b){a._chunks.forEach(function(a){"pending"===a.status&&v(a,b)})}function p(a,b){var c=a._chunks,d=c.get(b);d||(d=new m("pending",null,null,a),c.set(b,d));return d}function L(a,b,c){if(g){var d=g;d.deps++}else d=g={deps:1,value:null};return function(e){b[c]=e;d.deps--;0===d.deps&&"blocked"===a.status&&(e=a.value,a.status=
15
- "fulfilled",a.value=d.value,null!==e&&u(e,d.value))}}function M(a){return function(b){return v(a,b)}}function N(a,b,c,d){if("$"===d[0]){if("$"===d)return z;switch(d[1]){case "$":return d.substring(1);case "L":return b=parseInt(d.substring(2),16),a=p(a,b),{$$typeof:O,_payload:a,_init:K};case "@":return b=parseInt(d.substring(2),16),p(a,b);case "S":return Symbol.for(d.substring(2));case "P":return a=d.substring(2),A[a]||(A[a]=n.createServerContext(a,P)),A[a].Provider;default:d=parseInt(d.substring(1),
16
- 16);a=p(a,d);switch(a.status){case "resolved_model":r(a);break;case "resolved_module":t(a)}switch(a.status){case "fulfilled":return a.value;case "pending":case "blocked":return d=w,a.then(L(d,b,c),M(d)),null;default:throw a.reason;}}}return d}function Q(a,b,c){var d=a._chunks,e=d.get(b);c=JSON.parse(c,a._fromJSON);var f=H(a._bundlerConfig,c);if(c=J(f)){if(e){var h=e;h.status="blocked"}else h=new m("blocked",null,null,a),d.set(b,h);c.then(function(){return D(h,f)},function(a){return v(h,a)})}else e?
17
- D(e,f):d.set(b,new m("resolved_module",f,null,a))}function E(a){x(a,Error("Connection closed."))}function F(a,b){if(""!==b){var c=b.indexOf(":",0),d=parseInt(b.substring(0,c),16);switch(b[c+1]){case "I":Q(a,d,b.substring(c+2));break;case "E":c=JSON.parse(b.substring(c+2)).digest;b=Error("An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.");
18
- b.stack="Error: "+b.message;b.digest=c;c=a._chunks;var e=c.get(d);e?v(e,b):c.set(d,new m("rejected",null,b,a));break;default:b=b.substring(c+1),e=a._chunks,(c=e.get(d))?"pending"===c.status&&(a=c.value,d=c.reason,c.status="resolved_model",c.value=b,null!==a&&(r(c),C(c,a,d))):e.set(d,new m("resolved_model",b,null,a))}}}function R(a){return function(b,c){return"string"===typeof c?N(a,this,b,c):"object"===typeof c&&null!==c?(b=c[0]===z?{$$typeof:z,type:c[1],key:c[2],ref:null,props:c[3],_owner:null}:
19
- c,b):c}}function B(a){var b=new TextDecoder,c=new Map;a={_bundlerConfig:a,_chunks:c,_partialRow:"",_stringDecoder:b};a._fromJSON=R(a);return a}function G(a,b){function c(b){var h=b.value;if(b.done)E(a);else{b=h;h=a._stringDecoder;for(var k=b.indexOf(10);-1<k;){var f=a._partialRow;var g=b.subarray(0,k);g=h.decode(g);F(a,f+g);a._partialRow="";b=b.subarray(k+1);k=b.indexOf(10)}a._partialRow+=h.decode(b,S);return e.read().then(c).catch(d)}}function d(b){x(a,b)}var e=b.getReader();e.read().then(c).catch(d)}
20
- var S={stream:!0},q=new Map,y=new Map,z=Symbol.for("react.element"),O=Symbol.for("react.lazy"),P=Symbol.for("react.default_value"),A=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ContextRegistry;m.prototype=Object.create(Promise.prototype);m.prototype.then=function(a,b){switch(this.status){case "resolved_model":r(this);break;case "resolved_module":t(this)}switch(this.status){case "fulfilled":a(this.value);break;case "pending":case "blocked":a&&(null===this.value&&(this.value=[]),this.value.push(a));
21
- b&&(null===this.reason&&(this.reason=[]),this.reason.push(b));break;default:b(this.reason)}};var w=null,g=null;l.createFromFetch=function(a,b){var c=B(b&&b.moduleMap?b.moduleMap:null);a.then(function(a){G(c,a.body)},function(a){x(c,a)});return p(c,0)};l.createFromReadableStream=function(a,b){b=B(b&&b.moduleMap?b.moduleMap:null);G(b,a);return p(b,0)};l.createFromXHR=function(a,b){function c(b){b=a.responseText;for(var c=f,d=b.indexOf("\n",c);-1<d;)c=e._partialRow+b.substring(c,d),F(e,c),e._partialRow=
22
- "",c=d+1,d=b.indexOf("\n",c);e._partialRow+=b.substring(c);f=b.length}function d(a){x(e,new TypeError("Network error"))}var e=B(b&&b.moduleMap?b.moduleMap:null),f=0;a.addEventListener("progress",c);a.addEventListener("load",function(a){c();E(e)});a.addEventListener("error",d);a.addEventListener("abort",d);a.addEventListener("timeout",d);return p(e,0)}});
13
+ b){if("pending"===a.status||"blocked"===a.status){var c=a.value,d=a.reason;a.status="resolved_module";a.value=b;null!==c&&(t(a),C(a,c,d))}}function q(a){var b=w,c=g;w=a;g=null;try{var d=JSON.parse(a.value,a._response._fromJSON);null!==g&&0<g.deps?(g.value=d,a.status="blocked",a.value=null,a.reason=null):(a.status="fulfilled",a.value=d)}catch(e){a.status="rejected",a.reason=e}finally{w=b,g=c}}function t(a){try{var b=a.value;if(b.async){var c=y.get(b.id);if("fulfilled"===c.status)var d=c.value;else throw c.reason;
14
+ }else d=__webpack_require__(b.id);var e="*"===b.name?d:""===b.name?d.__esModule?d.default:d:d[b.name];a.status="fulfilled";a.value=e}catch(f){a.status="rejected",a.reason=f}}function x(a,b){a._chunks.forEach(function(a){"pending"===a.status&&v(a,b)})}function n(a,b){var c=a._chunks,d=c.get(b);d||(d=new m("pending",null,null,a),c.set(b,d));return d}function L(a,b,c){if(g){var d=g;d.deps++}else d=g={deps:1,value:null};return function(e){b[c]=e;d.deps--;0===d.deps&&"blocked"===a.status&&(e=a.value,a.status=
15
+ "fulfilled",a.value=d.value,null!==e&&u(e,d.value))}}function M(a){return function(b){return v(a,b)}}function N(a,b){var c=a._callServer;return function(){var a=Array.prototype.slice.call(arguments),e=b.bound;return"fulfilled"===e.status?c(b,e.value.concat(a)):Promise.resolve(e).then(function(d){return c(b,d.concat(a))})}}function O(a,b,c,d){if("$"===d[0]){if("$"===d)return z;switch(d[1]){case "$":return d.substring(1);case "L":return b=parseInt(d.substring(2),16),a=n(a,b),{$$typeof:P,_payload:a,
16
+ _init:K};case "@":return b=parseInt(d.substring(2),16),n(a,b);case "S":return Symbol.for(d.substring(2));case "P":return a=d.substring(2),A[a]||(A[a]=p.createServerContext(a,Q)),A[a].Provider;case "F":b=parseInt(d.substring(2),16);b=n(a,b);switch(b.status){case "resolved_model":q(b)}switch(b.status){case "fulfilled":return N(a,b.value);default:throw b.reason;}default:d=parseInt(d.substring(1),16);a=n(a,d);switch(a.status){case "resolved_model":q(a);break;case "resolved_module":t(a)}switch(a.status){case "fulfilled":return a.value;
17
+ case "pending":case "blocked":return d=w,a.then(L(d,b,c),M(d)),null;default:throw a.reason;}}}return d}function R(){throw Error('Trying to call a function from "use server" but the callServer option was not implemented in your router runtime.');}function S(a,b,c){var d=a._chunks,e=d.get(b);c=JSON.parse(c,a._fromJSON);var f=H(a._bundlerConfig,c);if(c=J(f)){if(e){var h=e;h.status="blocked"}else h=new m("blocked",null,null,a),d.set(b,h);c.then(function(){return D(h,f)},function(a){return v(h,a)})}else e?
18
+ D(e,f):d.set(b,new m("resolved_module",f,null,a))}function E(a){x(a,Error("Connection closed."))}function F(a,b){if(""!==b){var c=b.indexOf(":",0),d=parseInt(b.substring(0,c),16);switch(b[c+1]){case "I":S(a,d,b.substring(c+2));break;case "E":c=JSON.parse(b.substring(c+2)).digest;b=Error("An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.");
19
+ b.stack="Error: "+b.message;b.digest=c;c=a._chunks;var e=c.get(d);e?v(e,b):c.set(d,new m("rejected",null,b,a));break;default:b=b.substring(c+1),e=a._chunks,(c=e.get(d))?"pending"===c.status&&(a=c.value,d=c.reason,c.status="resolved_model",c.value=b,null!==a&&(q(c),C(c,a,d))):e.set(d,new m("resolved_model",b,null,a))}}}function T(a){return function(b,c){return"string"===typeof c?O(a,this,b,c):"object"===typeof c&&null!==c?(b=c[0]===z?{$$typeof:z,type:c[1],key:c[2],ref:null,props:c[3],_owner:null}:
20
+ c,b):c}}function B(a,b){var c=new TextDecoder,d=new Map;a={_bundlerConfig:a,_callServer:void 0!==b?b:R,_chunks:d,_partialRow:"",_stringDecoder:c};a._fromJSON=T(a);return a}function G(a,b){function c(b){var h=b.value;if(b.done)E(a);else{b=h;h=a._stringDecoder;for(var k=b.indexOf(10);-1<k;){var f=a._partialRow;var g=b.subarray(0,k);g=h.decode(g);F(a,f+g);a._partialRow="";b=b.subarray(k+1);k=b.indexOf(10)}a._partialRow+=h.decode(b,U);return e.read().then(c).catch(d)}}function d(b){x(a,b)}var e=b.getReader();
21
+ e.read().then(c).catch(d)}var U={stream:!0},r=new Map,y=new Map,z=Symbol.for("react.element"),P=Symbol.for("react.lazy"),Q=Symbol.for("react.default_value"),A=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ContextRegistry;m.prototype=Object.create(Promise.prototype);m.prototype.then=function(a,b){switch(this.status){case "resolved_model":q(this);break;case "resolved_module":t(this)}switch(this.status){case "fulfilled":a(this.value);break;case "pending":case "blocked":a&&(null===this.value&&
22
+ (this.value=[]),this.value.push(a));b&&(null===this.reason&&(this.reason=[]),this.reason.push(b));break;default:b(this.reason)}};var w=null,g=null;l.createFromFetch=function(a,b){var c=B(b&&b.moduleMap?b.moduleMap:null,b&&b.callServer?b.callServer:void 0);a.then(function(a){G(c,a.body)},function(a){x(c,a)});return n(c,0)};l.createFromReadableStream=function(a,b){b=B(b&&b.moduleMap?b.moduleMap:null,b&&b.callServer?b.callServer:void 0);G(b,a);return n(b,0)};l.createFromXHR=function(a,b){function c(b){b=
23
+ a.responseText;for(var c=f,d=b.indexOf("\n",c);-1<d;)c=e._partialRow+b.substring(c,d),F(e,c),e._partialRow="",c=d+1,d=b.indexOf("\n",c);e._partialRow+=b.substring(c);f=b.length}function d(a){x(e,new TypeError("Network error"))}var e=B(b&&b.moduleMap?b.moduleMap:null,b&&b.callServer?b.callServer:void 0),f=0;a.addEventListener("progress",c);a.addEventListener("load",function(a){c();E(e)});a.addEventListener("error",d);a.addEventListener("abort",d);a.addEventListener("timeout",d);return n(e,0)}});
23
24
  })();
@@ -196,21 +196,25 @@
196
196
  var row = id.toString(16) + ':' + json + '\n';
197
197
  return stringToChunk(row);
198
198
  }
199
- function processModuleChunk(request, id, moduleMetaData) {
200
- var json = stringify(moduleMetaData);
199
+ function processImportChunk(request, id, clientReferenceMetadata) {
200
+ var json = stringify(clientReferenceMetadata);
201
201
  var row = serializeRowHeader('I', id) + json + '\n';
202
202
  return stringToChunk(row);
203
203
  }
204
204
 
205
205
  // eslint-disable-next-line no-unused-vars
206
206
  var CLIENT_REFERENCE_TAG = Symbol.for('react.client.reference');
207
+ var SERVER_REFERENCE_TAG = Symbol.for('react.server.reference');
207
208
  function getClientReferenceKey(reference) {
208
209
  return reference.filepath + '#' + reference.name + (reference.async ? '#async' : '');
209
210
  }
210
211
  function isClientReference(reference) {
211
212
  return reference.$$typeof === CLIENT_REFERENCE_TAG;
212
213
  }
213
- function resolveModuleMetaData(config, clientReference) {
214
+ function isServerReference(reference) {
215
+ return reference.$$typeof === SERVER_REFERENCE_TAG;
216
+ }
217
+ function resolveClientReferenceMetadata(config, clientReference) {
214
218
  var resolvedModuleData = config[clientReference.filepath][clientReference.name];
215
219
 
216
220
  if (clientReference.async) {
@@ -224,6 +228,13 @@
224
228
  return resolvedModuleData;
225
229
  }
226
230
  }
231
+ function resolveServerReferenceMetadata(config, serverReference) {
232
+ return {
233
+ id: serverReference.$$filepath,
234
+ name: serverReference.$$name,
235
+ bound: Promise.resolve(serverReference.$$bound)
236
+ };
237
+ }
227
238
 
228
239
  // ATTENTION
229
240
  // When adding new symbols to this file,
@@ -548,7 +559,7 @@
548
559
  // Run `yarn generate-inline-fizz-runtime` to generate.
549
560
  var clientRenderBoundary = '$RX=function(b,c,d,e){var a=document.getElementById(b);a&&(b=a.previousSibling,b.data="$!",a=a.dataset,c&&(a.dgst=c),d&&(a.msg=d),e&&(a.stck=e),b._reactRetry&&b._reactRetry())};';
550
561
  var completeBoundary = '$RC=function(b,c,e){c=document.getElementById(c);c.parentNode.removeChild(c);var a=document.getElementById(b);if(a){b=a.previousSibling;if(e)b.data="$!",a.setAttribute("data-dgst",e);else{e=b.parentNode;a=b.nextSibling;var f=0;do{if(a&&8===a.nodeType){var d=a.data;if("/$"===d)if(0===f)break;else f--;else"$"!==d&&"$?"!==d&&"$!"!==d||f++}d=a.nextSibling;e.removeChild(a);a=d}while(a);for(;c.firstChild;)e.insertBefore(c.firstChild,a);b.data="$"}b._reactRetry&&b._reactRetry()}};';
551
- var completeBoundaryWithStyles = '$RM=new Map;\n$RR=function(p,q,v){function r(l){this.s=l}for(var t=$RC,u=$RM,m=new Map,n=document,g,e,f=n.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;e=f[d++];)m.set(e.dataset.precedence,g=e);e=0;f=[];for(var c,h,b,a;c=v[e++];){var k=0;h=c[k++];if(b=u.get(h))"l"!==b.s&&f.push(b);else{a=n.createElement("link");a.href=h;a.rel="stylesheet";for(a.dataset.precedence=d=c[k++];b=c[k++];)a.setAttribute(b,c[k++]);b=a._p=new Promise(function(l,w){a.onload=l;a.onerror=w});b.then(r.bind(b,\n"l"),r.bind(b,"e"));u.set(h,b);f.push(b);c=m.get(d)||g;c===g&&(g=a);m.set(d,a);c?c.parentNode.insertBefore(a,c.nextSibling):(d=n.head,d.insertBefore(a,d.firstChild))}}Promise.all(f).then(t.bind(null,p,q,""),t.bind(null,p,q,"Resource failed to load"))};';
562
+ var completeBoundaryWithStyles = '$RM=new Map;\n$RR=function(p,q,w){function r(l){this.s=l}for(var t=$RC,m=$RM,u=new Map,n=new Map,g=document,h,e,f=g.querySelectorAll("template[data-precedence]"),c=0;e=f[c++];){for(var b=e.content.firstChild;b;b=b.nextSibling)u.set(b.getAttribute("data-href"),b);e.parentNode.removeChild(e)}f=g.querySelectorAll("link[data-precedence],style[data-precedence]");for(c=0;e=f[c++];)m.set(e.getAttribute("STYLE"===e.nodeName?"data-href":"href"),e),n.set(e.dataset.precedence,h=e);e=0;f=[];for(var d,\nv,a;d=w[e++];){var k=0;b=d[k++];if(!(a=m.get(b))){if(a=u.get(b))c=a.getAttribute("data-precedence");else{a=g.createElement("link");a.href=b;a.rel="stylesheet";for(a.dataset.precedence=c=d[k++];v=d[k++];)a.setAttribute(v,d[k++]);d=a._p=new Promise(function(l,x){a.onload=l;a.onerror=x});d.then(r.bind(d,"l"),r.bind(d,"e"))}m.set(b,a);b=n.get(c)||h;b===h&&(h=a);n.set(c,a);b?b.parentNode.insertBefore(a,b.nextSibling):(c=g.head,c.insertBefore(a,c.firstChild))}d=a._p;c=a.getAttribute("media");!d||"l"===\nd.s||c&&!matchMedia(c).matches||f.push(d)}Promise.all(f).then(t.bind(null,p,q,""),t.bind(null,p,q,"Resource failed to load"))};';
552
563
  var completeSegment = '$RS=function(a,b){a=document.getElementById(a);b=document.getElementById(b);for(a.parentNode.removeChild(a);a.firstChild;)b.parentNode.insertBefore(a.firstChild,b);b.parentNode.removeChild(b)};';
553
564
 
554
565
  var ReactDOMSharedInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
@@ -629,10 +640,10 @@
629
640
  var completeSegmentScriptEnd = stringToPrecomputedChunk('")</script>');
630
641
  var completeSegmentData1 = stringToPrecomputedChunk('<template data-rsi="" data-sid="');
631
642
  var completeSegmentData2 = stringToPrecomputedChunk('" data-pid="');
632
- var completeBoundaryScript1Full = stringToPrecomputedChunk(completeBoundary + ';$RC("');
643
+ var completeBoundaryScript1Full = stringToPrecomputedChunk(completeBoundary + '$RC("');
633
644
  var completeBoundaryScript1Partial = stringToPrecomputedChunk('$RC("');
634
- var completeBoundaryWithStylesScript1FullBoth = stringToPrecomputedChunk(completeBoundary + ';' + completeBoundaryWithStyles + ';$RR("');
635
- var completeBoundaryWithStylesScript1FullPartial = stringToPrecomputedChunk(completeBoundaryWithStyles + ';$RR("');
645
+ var completeBoundaryWithStylesScript1FullBoth = stringToPrecomputedChunk(completeBoundary + completeBoundaryWithStyles + '$RR("');
646
+ var completeBoundaryWithStylesScript1FullPartial = stringToPrecomputedChunk(completeBoundaryWithStyles + '$RR("');
636
647
  var completeBoundaryWithStylesScript1Partial = stringToPrecomputedChunk('$RR("');
637
648
  var completeBoundaryScript2 = stringToPrecomputedChunk('","');
638
649
  var completeBoundaryScript3a = stringToPrecomputedChunk('",');
@@ -652,6 +663,8 @@
652
663
  var clientRenderData3 = stringToPrecomputedChunk('" data-msg="');
653
664
  var clientRenderData4 = stringToPrecomputedChunk('" data-stck="');
654
665
 
666
+ var styleTagTemplateOpen = stringToPrecomputedChunk('<template data-precedence="">');
667
+ var styleTagTemplateClose = stringToPrecomputedChunk('</template>'); // Tracks whether we wrote any late style tags. We use this to determine
655
668
  var precedencePlaceholderStart = stringToPrecomputedChunk('<style data-precedence="');
656
669
  var precedencePlaceholderEnd = stringToPrecomputedChunk('"></style>');
657
670
 
@@ -1178,11 +1191,12 @@
1178
1191
  pendingChunks: 0,
1179
1192
  abortableTasks: abortSet,
1180
1193
  pingedTasks: pingedTasks,
1181
- completedModuleChunks: [],
1194
+ completedImportChunks: [],
1182
1195
  completedJSONChunks: [],
1183
1196
  completedErrorChunks: [],
1184
1197
  writtenSymbols: new Map(),
1185
- writtenModules: new Map(),
1198
+ writtenClientReferences: new Map(),
1199
+ writtenServerReferences: new Map(),
1186
1200
  writtenProviders: new Map(),
1187
1201
  identifierPrefix: identifierPrefix || '',
1188
1202
  identifierCount: 1,
@@ -1493,6 +1507,10 @@
1493
1507
  return '$@' + id.toString(16);
1494
1508
  }
1495
1509
 
1510
+ function serializeServerReferenceID(id) {
1511
+ return '$F' + id.toString(16);
1512
+ }
1513
+
1496
1514
  function serializeSymbolReference(name) {
1497
1515
  return '$S' + name;
1498
1516
  }
@@ -1501,10 +1519,10 @@
1501
1519
  return '$P' + name;
1502
1520
  }
1503
1521
 
1504
- function serializeClientReference(request, parent, key, moduleReference) {
1505
- var moduleKey = getClientReferenceKey(moduleReference);
1506
- var writtenModules = request.writtenModules;
1507
- var existingId = writtenModules.get(moduleKey);
1522
+ function serializeClientReference(request, parent, key, clientReference) {
1523
+ var clientReferenceKey = getClientReferenceKey(clientReference);
1524
+ var writtenClientReferences = request.writtenClientReferences;
1525
+ var existingId = writtenClientReferences.get(clientReferenceKey);
1508
1526
 
1509
1527
  if (existingId !== undefined) {
1510
1528
  if (parent[0] === REACT_ELEMENT_TYPE && key === '1') {
@@ -1520,11 +1538,11 @@
1520
1538
  }
1521
1539
 
1522
1540
  try {
1523
- var moduleMetaData = resolveModuleMetaData(request.bundlerConfig, moduleReference);
1541
+ var clientReferenceMetadata = resolveClientReferenceMetadata(request.bundlerConfig, clientReference);
1524
1542
  request.pendingChunks++;
1525
- var moduleId = request.nextChunkId++;
1526
- emitModuleChunk(request, moduleId, moduleMetaData);
1527
- writtenModules.set(moduleKey, moduleId);
1543
+ var importId = request.nextChunkId++;
1544
+ emitImportChunk(request, importId, clientReferenceMetadata);
1545
+ writtenClientReferences.set(clientReferenceKey, importId);
1528
1546
 
1529
1547
  if (parent[0] === REACT_ELEMENT_TYPE && key === '1') {
1530
1548
  // If we're encoding the "type" of an element, we can refer
@@ -1532,10 +1550,10 @@
1532
1550
  // knows how to deal with lazy values. This lets us suspend
1533
1551
  // on this component rather than its parent until the code has
1534
1552
  // loaded.
1535
- return serializeLazyID(moduleId);
1553
+ return serializeLazyID(importId);
1536
1554
  }
1537
1555
 
1538
- return serializeByValueID(moduleId);
1556
+ return serializeByValueID(importId);
1539
1557
  } catch (x) {
1540
1558
  request.pendingChunks++;
1541
1559
  var errorId = request.nextChunkId++;
@@ -1553,6 +1571,24 @@
1553
1571
  }
1554
1572
  }
1555
1573
 
1574
+ function serializeServerReference(request, parent, key, serverReference) {
1575
+ var writtenServerReferences = request.writtenServerReferences;
1576
+ var existingId = writtenServerReferences.get(serverReference);
1577
+
1578
+ if (existingId !== undefined) {
1579
+ return serializeServerReferenceID(existingId);
1580
+ }
1581
+
1582
+ var serverReferenceMetadata = resolveServerReferenceMetadata(request.bundlerConfig, serverReference);
1583
+ request.pendingChunks++;
1584
+ var metadataId = request.nextChunkId++; // We assume that this object doesn't suspend.
1585
+
1586
+ var processedChunk = processModelChunk(request, metadataId, serverReferenceMetadata);
1587
+ request.completedJSONChunks.push(processedChunk);
1588
+ writtenServerReferences.set(serverReference, metadataId);
1589
+ return serializeServerReferenceID(metadataId);
1590
+ }
1591
+
1556
1592
  function escapeStringValue(value) {
1557
1593
  if (value[0] === '$') {
1558
1594
  // We need to escape $ or @ prefixed strings since we use those to encode
@@ -1981,7 +2017,7 @@
1981
2017
 
1982
2018
  if (typeof value === 'object') {
1983
2019
  if (isClientReference(value)) {
1984
- return serializeClientReference(request, parent, key, value);
2020
+ return serializeClientReference(request, parent, key, value); // $FlowFixMe[method-unbinding]
1985
2021
  } else if (typeof value.then === 'function') {
1986
2022
  // We assume that any object with a .then property is a "Thenable" type,
1987
2023
  // or a Promise type. Either of which can be represented by a Promise.
@@ -2045,10 +2081,14 @@
2045
2081
  return serializeClientReference(request, parent, key, value);
2046
2082
  }
2047
2083
 
2084
+ if (isServerReference(value)) {
2085
+ return serializeServerReference(request, parent, key, value);
2086
+ }
2087
+
2048
2088
  if (/^on[A-Z]/.test(key)) {
2049
2089
  throw new Error('Event handlers cannot be passed to Client Component props.' + describeObjectForErrorMessage(parent, key) + '\nIf you need interactivity, consider converting part of this to a Client Component.');
2050
2090
  } else {
2051
- throw new Error('Functions cannot be passed directly to Client Components ' + "because they're not serializable." + describeObjectForErrorMessage(parent, key));
2091
+ throw new Error('Functions cannot be passed directly to Client Components ' + 'unless you explicitly expose it by marking it with "use server".' + describeObjectForErrorMessage(parent, key));
2052
2092
  }
2053
2093
  }
2054
2094
 
@@ -2140,15 +2180,15 @@
2140
2180
  request.completedErrorChunks.push(processedChunk);
2141
2181
  }
2142
2182
 
2143
- function emitModuleChunk(request, id, moduleMetaData) {
2144
- var processedChunk = processModuleChunk(request, id, moduleMetaData);
2145
- request.completedModuleChunks.push(processedChunk);
2183
+ function emitImportChunk(request, id, clientReferenceMetadata) {
2184
+ var processedChunk = processImportChunk(request, id, clientReferenceMetadata);
2185
+ request.completedImportChunks.push(processedChunk);
2146
2186
  }
2147
2187
 
2148
2188
  function emitSymbolChunk(request, id, name) {
2149
2189
  var symbolReference = serializeSymbolReference(name);
2150
2190
  var processedChunk = processReferenceChunk(request, id, symbolReference);
2151
- request.completedModuleChunks.push(processedChunk);
2191
+ request.completedImportChunks.push(processedChunk);
2152
2192
  }
2153
2193
 
2154
2194
  function emitProviderChunk(request, id, contextName) {
@@ -2271,12 +2311,12 @@
2271
2311
  try {
2272
2312
  // We emit module chunks first in the stream so that
2273
2313
  // they can be preloaded as early as possible.
2274
- var moduleChunks = request.completedModuleChunks;
2314
+ var importsChunks = request.completedImportChunks;
2275
2315
  var i = 0;
2276
2316
 
2277
- for (; i < moduleChunks.length; i++) {
2317
+ for (; i < importsChunks.length; i++) {
2278
2318
  request.pendingChunks--;
2279
- var chunk = moduleChunks[i];
2319
+ var chunk = importsChunks[i];
2280
2320
  var keepWriting = writeChunkAndReturn(destination, chunk);
2281
2321
 
2282
2322
  if (!keepWriting) {
@@ -2286,7 +2326,7 @@
2286
2326
  }
2287
2327
  }
2288
2328
 
2289
- moduleChunks.splice(0, i); // Next comes model data.
2329
+ importsChunks.splice(0, i); // Next comes model data.
2290
2330
 
2291
2331
  var jsonChunks = request.completedJSONChunks;
2292
2332
  i = 0;