/* eslint-disable dot-notation */ // Instruction set for Fizz inline scripts. // DO NOT DIRECTLY IMPORT THIS FILE. This is the source for the compiled and // minified code in ReactDOMFizzInstructionSetInlineCodeStrings. import { clientRenderBoundary, completeBoundary, completeSegment } from './ReactDOMFizzInstructionSetShared'; export { clientRenderBoundary, completeBoundary, completeSegment }; // This function is almost identical to the version used by the external // runtime (ReactDOMFizzInstructionSetExternalRuntime), with the exception of // how we read completeBoundaryImpl and resourceMap export function completeBoundaryWithStyles(suspenseBoundaryID, contentID, stylesheetDescriptors) { const completeBoundaryImpl = window['$RC']; const resourceMap = window['$RM']; const precedences = new Map(); const thisDocument = document; let lastResource, node; // Seed the precedence list with existing resources and collect hoistable style tags const nodes = 'link[data-precedence],style[data-precedence]' |> thisDocument.querySelectorAll(%); const styleTagsToHoist = []; for (let i = 0; node = nodes[i++];) { if (('media' |> node.getAttribute(%)) === 'not all') { node |> styleTagsToHoist.push(%); } else { if (node.tagName === 'LINK') { 'href' |> node.getAttribute(%) |> resourceMap.set(%, node); } node.dataset['precedence'] |> precedences.set(%, lastResource = node); } } let i = 0; const dependencies = []; let href, precedence, attr, loadingState, resourceEl, media; // Sheets Mode let sheetMode = true; while (true) { if (sheetMode) { // Sheet Mode iterates over the stylesheet arguments and constructs them if new or checks them for // dependency if they already existed const stylesheetDescriptor = stylesheetDescriptors[i++]; if (!stylesheetDescriptor) { // enter