UNPKG

next

Version:

The React Framework

35 lines (34 loc) • 10.3 kB
/** * @license React * react-server-dom-webpack-client.browser.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. */ 'use strict';var r=require("react-dom"),t=require("react"),u={stream:!0};function v(a,b){if(a){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{id:a.id,chunks:a.chunks,name:c,async:!!b.async}}return b}var w=new Map; function x(a){var b=globalThis.__next_require__(a);if("function"!==typeof b.then||"fulfilled"===b.status)return null;b.then(function(c){b.status="fulfilled";b.value=c},function(c){b.status="rejected";b.reason=c});return b}function y(){} function z(a){for(var b=a.chunks,c=[],d=0;d<b.length;d++){var l=b[d],h=w.get(l);if(void 0===h){h=globalThis.__next_chunk_load__(l);c.push(h);var n=w.set.bind(w,l,null);h.then(n,y);w.set(l,h)}else null!==h&&c.push(h)}return a.async?0===c.length?x(a.id):Promise.all(c).then(function(){return x(a.id)}):0<c.length?Promise.all(c):null}var A=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Dispatcher,B=Symbol.for("react.element"),C=Symbol.for("react.lazy"),E=Symbol.for("react.default_value"),F=Symbol.iterator; function G(a){if(null===a||"object"!==typeof a)return null;a=F&&a[F]||a["@@iterator"];return"function"===typeof a?a:null}var I=Array.isArray,J=new WeakMap;function aa(a){return Number.isFinite(a)?0===a&&-Infinity===1/a?"$-0":a:Infinity===a?"$Infinity":-Infinity===a?"$-Infinity":"$NaN"} function ba(a,b,c,d){function l(k,e){if(null===e)return null;if("object"===typeof e){if("function"===typeof e.then){null===f&&(f=new FormData);n++;var g=h++;e.then(function(p){p=JSON.stringify(p,l);var q=f;q.append(b+g,p);n--;0===n&&c(q)},function(p){d(p)});return"$@"+g.toString(16)}if(e instanceof FormData){null===f&&(f=new FormData);var m=f;k=h++;var D=b+k+"_";e.forEach(function(p,q){m.append(D+q,p)});return"$K"+k.toString(16)}return e instanceof Map?(e=JSON.stringify(Array.from(e),l),null===f&& (f=new FormData),k=h++,f.append(b+k,e),"$Q"+k.toString(16)):e instanceof Set?(e=JSON.stringify(Array.from(e),l),null===f&&(f=new FormData),k=h++,f.append(b+k,e),"$W"+k.toString(16)):!I(e)&&G(e)?Array.from(e):e}if("string"===typeof e){if("Z"===e[e.length-1]&&this[k]instanceof Date)return"$D"+e;e="$"===e[0]?"$"+e:e;return e}if("boolean"===typeof e)return e;if("number"===typeof e)return aa(e);if("undefined"===typeof e)return"$undefined";if("function"===typeof e){e=J.get(e);if(void 0!==e)return e=JSON.stringify(e, l),null===f&&(f=new FormData),k=h++,f.set(b+k,e),"$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 e){k=e.description;if(Symbol.for(k)!==e)throw Error("Only global symbols received from Symbol.for(...) can be passed to Server Functions. The symbol Symbol.for("+(e.description+") cannot be found among global symbols."));return"$S"+k}if("bigint"===typeof e)return"$n"+ e.toString(10);throw Error("Type "+typeof e+" is not supported as an argument to a Server Function.");}var h=1,n=0,f=null;a=JSON.stringify(a,l);null===f?c(a):(f.set(b+"0",a),0===n&&c(f))}var K=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ContextRegistry;function L(a,b,c,d){this.status=a;this.value=b;this.reason=c;this._response=d}L.prototype=Object.create(Promise.prototype); L.prototype.then=function(a,b){switch(this.status){case "resolved_model":M(this);break;case "resolved_module":N(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 ca(a){switch(a.status){case "resolved_model":M(a);break;case "resolved_module":N(a)}switch(a.status){case "fulfilled":return a.value;case "pending":case "blocked":throw a;default:throw a.reason;}}function O(a,b){for(var c=0;c<a.length;c++)(0,a[c])(b)}function Q(a,b,c){switch(a.status){case "fulfilled":O(b,a.value);break;case "pending":case "blocked":a.value=b;a.reason=c;break;case "rejected":c&&O(c,a.reason)}} function R(a,b){if("pending"===a.status||"blocked"===a.status){var c=a.reason;a.status="rejected";a.reason=b;null!==c&&O(c,b)}}function S(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&&(N(a),Q(a,c,d))}}var T=null,U=null; function M(a){var b=T,c=U;T=a;U=null;try{var d=JSON.parse(a.value,a._response._fromJSON);null!==U&&0<U.deps?(U.value=d,a.status="blocked",a.value=null,a.reason=null):(a.status="fulfilled",a.value=d)}catch(l){a.status="rejected",a.reason=l}finally{T=b,U=c}} function N(a){try{var b=a.value,c=globalThis.__next_require__(b.id);if(b.async&&"function"===typeof c.then)if("fulfilled"===c.status)c=c.value;else throw c.reason;var d="*"===b.name?c:""===b.name?c.__esModule?c.default:c:c[b.name];a.status="fulfilled";a.value=d}catch(l){a.status="rejected",a.reason=l}}function V(a,b){a._chunks.forEach(function(c){"pending"===c.status&&R(c,b)})}function W(a,b){var c=a._chunks,d=c.get(b);d||(d=new L("pending",null,null,a),c.set(b,d));return d} function da(a,b,c){if(U){var d=U;d.deps++}else d=U={deps:1,value:null};return function(l){b[c]=l;d.deps--;0===d.deps&&"blocked"===a.status&&(l=a.value,a.status="fulfilled",a.value=d.value,null!==l&&O(l,d.value))}}function ea(a){return function(b){return R(a,b)}} function fa(a,b){function c(){var l=Array.prototype.slice.call(arguments),h=b.bound;return h?"fulfilled"===h.status?d(b.id,h.value.concat(l)):Promise.resolve(h).then(function(n){return d(b.id,n.concat(l))}):d(b.id,l)}var d=a._callServer;J.set(c,b);return c}function X(a,b){a=W(a,b);switch(a.status){case "resolved_model":M(a)}switch(a.status){case "fulfilled":return a.value;default:throw a.reason;}} function ha(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=W(a,b),{$$typeof:C,_payload:a,_init:ca};case "@":return b=parseInt(d.slice(2),16),W(a,b);case "S":return Symbol.for(d.slice(2));case "P":return a=d.slice(2),K[a]||(K[a]=t.createServerContext(a,E)),K[a].Provider;case "F":return b=parseInt(d.slice(2),16),b=X(a,b),fa(a,b);case "Q":return b=parseInt(d.slice(2),16),a=X(a,b),new Map(a);case "W":return b=parseInt(d.slice(2), 16),a=X(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=W(a,d);switch(a.status){case "resolved_model":M(a);break;case "resolved_module":N(a)}switch(a.status){case "fulfilled":return a.value;case "pending":case "blocked":return d=T,a.then(da(d,b,c),ea(d)),null;default:throw a.reason;}}}return d} function ia(){throw Error('Trying to call a function from "use server" but the callServer option was not implemented in your router runtime.');}function Y(a,b){var c=new Map;a={_bundlerConfig:a,_callServer:void 0!==b?b:ia,_chunks:c,_stringDecoder:new TextDecoder,_fromJSON:null,_rowState:0,_rowID:0,_rowTag:0,_rowLength:0,_buffer:[]};a._fromJSON=ja(a);return a} function ka(a,b,c){var d=a._chunks,l=d.get(b);c=JSON.parse(c,a._fromJSON);var h=v(a._bundlerConfig,c);if(c=z(h)){if(l){var n=l;n.status="blocked"}else n=new L("blocked",null,null,a),d.set(b,n);c.then(function(){return S(n,h)},function(f){return R(n,f)})}else l?S(l,h):d.set(b,new L("resolved_module",h,null,a))} function ja(a){return function(b,c){return"string"===typeof c?ha(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(a,b){function c(h){var n=h.value;if(h.done)V(a,Error("Connection closed."));else{var f=0,k=a._rowState,e=a._rowID,g=a._rowTag,m=a._rowLength;h=a._buffer;for(var D=n.length;f<D;){var p=-1;switch(k){case 0:p=n[f++];58===p?k=1:e=e<<4|(96<p?p-87:p-48);continue;case 1:k=n[f];84===k?(g=k,k=2,f++):64<k&&91>k?(g=k,k=3,f++):(g=0,k=3);continue;case 2:p=n[f++];44===p?k=4:m=m<<4|(96<p?p-87:p-48);continue;case 3:p=n.indexOf(10,f);break;case 4:p=f+m,p>n.length&&(p=-1)}var q=n.byteOffset+f;if(-1<p){f= new Uint8Array(n.buffer,q,p-f);m=a;q=g;var P=m._stringDecoder;g="";for(var H=0;H<h.length;H++)g+=P.decode(h[H],u);g+=P.decode(f);switch(q){case 73:ka(m,e,g);break;case 72:e=g[0];g=g.slice(1);m=JSON.parse(g,m._fromJSON);g=void 0;if(q=A.current)switch("string"===typeof m?f=m:(f=m[0],g=m[1]),e){case "D":q.prefetchDNS(f,g);break;case "C":q.preconnect(f,g);break;case "L":q.preload(f,g);break;case "I":q.preinit(f,g)}break;case 69:g=JSON.parse(g);f=g.digest;g=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."); g.stack="Error: "+g.message;g.digest=f;f=m._chunks;(q=f.get(e))?R(q,g):f.set(e,new L("rejected",null,g,m));break;case 84:m._chunks.set(e,new L("fulfilled",g,null,m));break;default:f=m._chunks,(q=f.get(e))?(m=q,e=g,"pending"===m.status&&(g=m.value,f=m.reason,m.status="resolved_model",m.value=e,null!==g&&(M(m),Q(m,g,f)))):f.set(e,new L("resolved_model",g,null,m))}f=p;3===k&&f++;m=e=g=k=0;h.length=0}else{n=new Uint8Array(n.buffer,q,n.byteLength-f);h.push(n);m-=n.byteLength;break}}a._rowState=k;a._rowID= e;a._rowTag=g;a._rowLength=m;return l.read().then(c).catch(d)}}function d(h){V(a,h)}var l=b.getReader();l.read().then(c).catch(d)}exports.createFromFetch=function(a,b){var c=Y(null,b&&b.callServer?b.callServer:void 0);a.then(function(d){Z(c,d.body)},function(d){V(c,d)});return W(c,0)};exports.createFromReadableStream=function(a,b){b=Y(null,b&&b.callServer?b.callServer:void 0);Z(b,a);return W(b,0)}; exports.createServerReference=function(a,b){function c(){var d=Array.prototype.slice.call(arguments);return b(a,d)}J.set(c,{id:a,bound:null});return c};exports.encodeReply=function(a){return new Promise(function(b,c){ba(a,"",b,c)})};