next
Version:
The React Framework
36 lines (35 loc) • 11.7 kB
JavaScript
/**
* @license React
* react-server-dom-webpack-client.node.unbundled.production.min.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
;var n=require("util"),p=require("react-dom"),q=require("react"),t={stream:!0};function u(a,b){var c=a[b.id];if(a=c[b.name])c=a.name;else{a=c["*"];if(!a)throw Error('Could not find the module "'+b.id+'" in the React SSR Manifest. This is probably a bug in the React Server Components bundler.');c=b.name}return{specifier:a.specifier,name:c,async:b.async}}var v=new Map;
function z(a){var b=v.get(a.specifier);if(b)return"fulfilled"===b.status?null:b;var c=import(a.specifier);a.async&&(c=c.then(function(d){return d.default}));c.then(function(d){var e=c;e.status="fulfilled";e.value=d},function(d){var e=c;e.status="rejected";e.reason=d});v.set(a.specifier,c);return c}var A=p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher,B=Symbol.for("react.element"),C=Symbol.for("react.lazy"),D=Symbol.for("react.default_value"),E=Symbol.iterator;
function F(a){if(null===a||"object"!==typeof a)return null;a=E&&a[E]||a["@@iterator"];return"function"===typeof a?a:null}var aa=Array.isArray,G=new WeakMap;function ba(a){return Number.isFinite(a)?0===a&&-Infinity===1/a?"$-0":a:Infinity===a?"$Infinity":-Infinity===a?"$-Infinity":"$NaN"}
function ca(a,b,c,d){function e(k,g){if(null===g)return null;if("object"===typeof g){if("function"===typeof g.then){null===l&&(l=new FormData);h++;var w=f++;g.then(function(r){r=JSON.stringify(r,e);var x=l;x.append(b+w,r);h--;0===h&&c(x)},function(r){d(r)});return"$@"+w.toString(16)}if(g instanceof FormData){null===l&&(l=new FormData);var m=l;k=f++;var y=b+k+"_";g.forEach(function(r,x){m.append(y+x,r)});return"$K"+k.toString(16)}return g instanceof Map?(g=JSON.stringify(Array.from(g),e),null===l&&
(l=new FormData),k=f++,l.append(b+k,g),"$Q"+k.toString(16)):g instanceof Set?(g=JSON.stringify(Array.from(g),e),null===l&&(l=new FormData),k=f++,l.append(b+k,g),"$W"+k.toString(16)):!aa(g)&&F(g)?Array.from(g):g}if("string"===typeof g){if("Z"===g[g.length-1]&&this[k]instanceof Date)return"$D"+g;g="$"===g[0]?"$"+g:g;return g}if("boolean"===typeof g)return g;if("number"===typeof g)return ba(g);if("undefined"===typeof g)return"$undefined";if("function"===typeof g){g=G.get(g);if(void 0!==g)return g=JSON.stringify(g,
e),null===l&&(l=new FormData),k=f++,l.set(b+k,g),"$F"+k.toString(16);throw Error("Client Functions cannot be passed directly to Server Functions. Only Functions passed from the Server can be passed back again.");}if("symbol"===typeof g){k=g.description;if(Symbol.for(k)!==g)throw Error("Only global symbols received from Symbol.for(...) can be passed to Server Functions. The symbol Symbol.for("+(g.description+") cannot be found among global symbols."));return"$S"+k}if("bigint"===typeof g)return"$n"+
g.toString(10);throw Error("Type "+typeof g+" is not supported as an argument to a Server Function.");}var f=1,h=0,l=null;a=JSON.stringify(a,e);null===l?c(a):(l.set(b+"0",a),0===h&&c(l))}var H=new WeakMap;function da(a){var b,c,d=new Promise(function(e,f){b=e;c=f});ca(a,"",function(e){if("string"===typeof e){var f=new FormData;f.append("0",e);e=f}d.status="fulfilled";d.value=e;b(e)},function(e){d.status="rejected";d.reason=e;c(e)});return d}
function I(a){var b=G.get(this);if(!b)throw Error("Tried to encode a Server Action from a different instance than the encoder is from. This is a bug in React.");var c=null;if(null!==b.bound){c=H.get(b);c||(c=da(b),H.set(b,c));if("rejected"===c.status)throw c.reason;if("fulfilled"!==c.status)throw c;b=c.value;var d=new FormData;b.forEach(function(e,f){d.append("$ACTION_"+a+":"+f,e)});c=d;b="$ACTION_REF_"+a}else b="$ACTION_ID_"+b.id;return{name:b,method:"POST",encType:"multipart/form-data",data:c}}
function ea(a,b){function c(){var d=Array.prototype.slice.call(arguments);return b(a,d)}c.$$FORM_ACTION=I;G.set(c,{id:a,bound:null});return c}var J=q.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ContextRegistry;function K(a,b,c,d){this.status=a;this.value=b;this.reason=c;this._response=d}K.prototype=Object.create(Promise.prototype);
K.prototype.then=function(a,b){switch(this.status){case "resolved_model":L(this);break;case "resolved_module":M(this)}switch(this.status){case "fulfilled":a(this.value);break;case "pending":case "blocked":a&&(null===this.value&&(this.value=[]),this.value.push(a));b&&(null===this.reason&&(this.reason=[]),this.reason.push(b));break;default:b(this.reason)}};
function fa(a){switch(a.status){case "resolved_model":L(a);break;case "resolved_module":M(a)}switch(a.status){case "fulfilled":return a.value;case "pending":case "blocked":throw a;default:throw a.reason;}}function N(a,b){for(var c=0;c<a.length;c++)(0,a[c])(b)}function O(a,b,c){switch(a.status){case "fulfilled":N(b,a.value);break;case "pending":case "blocked":a.value=b;a.reason=c;break;case "rejected":c&&N(c,a.reason)}}
function P(a,b){if("pending"===a.status||"blocked"===a.status){var c=a.reason;a.status="rejected";a.reason=b;null!==c&&N(c,b)}}function Q(a,b){if("pending"===a.status||"blocked"===a.status){var c=a.value,d=a.reason;a.status="resolved_module";a.value=b;null!==c&&(M(a),O(a,c,d))}}var R=null,S=null;
function L(a){var b=R,c=S;R=a;S=null;try{var d=JSON.parse(a.value,a._response._fromJSON);null!==S&&0<S.deps?(S.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{R=b,S=c}}function M(a){try{var b=a.value,c=v.get(b.specifier);if("fulfilled"===c.status)var d=c.value;else throw c.reason;var e="*"===b.name?d:""===b.name?d.default:d[b.name];a.status="fulfilled";a.value=e}catch(f){a.status="rejected",a.reason=f}}
function T(a,b){a._chunks.forEach(function(c){"pending"===c.status&&P(c,b)})}function U(a,b){var c=a._chunks,d=c.get(b);d||(d=new K("pending",null,null,a),c.set(b,d));return d}function ha(a,b,c){if(S){var d=S;d.deps++}else d=S={deps:1,value:null};return function(e){b[c]=e;d.deps--;0===d.deps&&"blocked"===a.status&&(e=a.value,a.status="fulfilled",a.value=d.value,null!==e&&N(e,d.value))}}function ia(a){return function(b){return P(a,b)}}
function ja(a,b){function c(){var e=Array.prototype.slice.call(arguments),f=b.bound;return f?"fulfilled"===f.status?d(b.id,f.value.concat(e)):Promise.resolve(f).then(function(h){return d(b.id,h.concat(e))}):d(b.id,e)}var d=a._callServer;c.$$FORM_ACTION=I;G.set(c,b);return c}function V(a,b){a=U(a,b);switch(a.status){case "resolved_model":L(a)}switch(a.status){case "fulfilled":return a.value;default:throw a.reason;}}
function ka(a,b,c,d){if("$"===d[0]){if("$"===d)return B;switch(d[1]){case "$":return d.slice(1);case "L":return b=parseInt(d.slice(2),16),a=U(a,b),{$$typeof:C,_payload:a,_init:fa};case "@":return b=parseInt(d.slice(2),16),U(a,b);case "S":return Symbol.for(d.slice(2));case "P":return a=d.slice(2),J[a]||(J[a]=q.createServerContext(a,D)),J[a].Provider;case "F":return b=parseInt(d.slice(2),16),b=V(a,b),ja(a,b);case "Q":return b=parseInt(d.slice(2),16),a=V(a,b),new Map(a);case "W":return b=parseInt(d.slice(2),
16),a=V(a,b),new Set(a);case "I":return Infinity;case "-":return"$-0"===d?-0:-Infinity;case "N":return NaN;case "u":return;case "D":return new Date(Date.parse(d.slice(2)));case "n":return BigInt(d.slice(2));default:d=parseInt(d.slice(1),16);a=U(a,d);switch(a.status){case "resolved_model":L(a);break;case "resolved_module":M(a)}switch(a.status){case "fulfilled":return a.value;case "pending":case "blocked":return d=R,a.then(ha(d,b,c),ia(d)),null;default:throw a.reason;}}}return d}
function la(){throw Error('Trying to call a function from "use server" but the callServer option was not implemented in your router runtime.');}function ma(a,b){var c=new Map;a={_bundlerConfig:a,_callServer:void 0!==b?b:la,_chunks:c,_stringDecoder:new n.TextDecoder,_fromJSON:null,_rowState:0,_rowID:0,_rowTag:0,_rowLength:0,_buffer:[]};a._fromJSON=na(a);return a}function W(a,b,c){a._chunks.set(b,new K("fulfilled",c,null,a))}
function oa(a,b,c){var d=a._chunks,e=d.get(b);c=JSON.parse(c,a._fromJSON);var f=u(a._bundlerConfig,c);if(c=z(f)){if(e){var h=e;h.status="blocked"}else h=new K("blocked",null,null,a),d.set(b,h);c.then(function(){return Q(h,f)},function(l){return P(h,l)})}else e?Q(e,f):d.set(b,new K("resolved_module",f,null,a))}function X(a,b){for(var c=a.length,d=b.length,e=0;e<c;e++)d+=a[e].byteLength;d=new Uint8Array(d);for(var f=e=0;f<c;f++){var h=a[f];d.set(h,e);e+=h.byteLength}d.set(b,e);return d}
function Y(a,b,c,d,e,f){c=0===c.length&&0===d.byteOffset%f?d:X(c,d);e=new e(c.buffer,c.byteOffset,c.byteLength/f);W(a,b,e)}
function pa(a,b,c,d,e){switch(c){case 65:W(a,b,X(d,e).buffer);return;case 67:Y(a,b,d,e,Int8Array,1);return;case 99:W(a,b,0===d.length?e:X(d,e));return;case 85:Y(a,b,d,e,Uint8ClampedArray,1);return;case 83:Y(a,b,d,e,Int16Array,2);return;case 115:Y(a,b,d,e,Uint16Array,2);return;case 76:Y(a,b,d,e,Int32Array,4);return;case 108:Y(a,b,d,e,Uint32Array,4);return;case 70:Y(a,b,d,e,Float32Array,4);return;case 68:Y(a,b,d,e,Float64Array,8);return;case 78:Y(a,b,d,e,BigInt64Array,8);return;case 109:Y(a,b,d,e,BigUint64Array,
8);return;case 86:Y(a,b,d,e,DataView,1);return}for(var f=a._stringDecoder,h="",l=0;l<d.length;l++)h+=f.decode(d[l],t);h+=f.decode(e);switch(c){case 73:oa(a,b,h);break;case 72:b=h[0];h=h.slice(1);a=JSON.parse(h,a._fromJSON);if(h=A.current){if("string"===typeof a)c=a;else{c=a[0];var k=a[1]}switch(b){case "D":h.prefetchDNS(c,k);break;case "C":h.preconnect(c,k);break;case "L":h.preload(c,k);break;case "I":h.preinit(c,k)}}break;case 69:h=JSON.parse(h).digest;k=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.");
k.stack="Error: "+k.message;k.digest=h;h=a._chunks;(c=h.get(b))?P(c,k):h.set(b,new K("rejected",null,k,a));break;case 84:a._chunks.set(b,new K("fulfilled",h,null,a));break;default:k=h,c=a._chunks,(h=c.get(b))?"pending"===h.status&&(a=h.value,b=h.reason,h.status="resolved_model",h.value=k,null!==a&&(L(h),O(h,a,b))):c.set(b,new K("resolved_model",k,null,a))}}
function na(a){return function(b,c){return"string"===typeof c?ka(a,this,b,c):"object"===typeof c&&null!==c?(b=c[0]===B?{$$typeof:B,type:c[1],key:c[2],ref:null,props:c[3],_owner:null}:c,b):c}}function Z(){throw Error("Server Functions cannot be called during initial render. This would create a fetch waterfall. Try to use a Server Component to pass data to Client Components instead.");}
exports.createFromNodeStream=function(a,b){var c=ma(b,Z);a.on("data",function(d){for(var e=0,f=c._rowState,h=c._rowID,l=c._rowTag,k=c._rowLength,g=c._buffer,w=d.length;e<w;){var m=-1;switch(f){case 0:m=d[e++];58===m?f=1:h=h<<4|(96<m?m-87:m-48);continue;case 1:f=d[e];84===f||65===f||67===f||99===f||85===f||83===f||115===f||76===f||108===f||70===f||68===f||78===f||109===f||86===f?(l=f,f=2,e++):64<f&&91>f?(l=f,f=3,e++):(l=0,f=3);continue;case 2:m=d[e++];44===m?f=4:k=k<<4|(96<m?m-87:m-48);continue;case 3:m=
d.indexOf(10,e);break;case 4:m=e+k,m>d.length&&(m=-1)}var y=d.byteOffset+e;if(-1<m)k=new Uint8Array(d.buffer,y,m-e),pa(c,h,l,g,k),e=m,3===f&&e++,k=h=l=f=0,g.length=0;else{d=new Uint8Array(d.buffer,y,d.byteLength-e);g.push(d);k-=d.byteLength;break}}c._rowState=f;c._rowID=h;c._rowTag=l;c._rowLength=k});a.on("error",function(d){T(c,d)});a.on("end",function(){T(c,Error("Connection closed."))});return U(c,0)};exports.createServerReference=function(a){return ea(a,Z)};