import{Runtime as e}from"../root/root.js";import{ThemeSupport as s}from"../theme_support/theme_support.js";const t=new Map;function o(){return document.documentElement.classList.contains("-theme-with-dark-background")||window.matchMedia("prefers-color-scheme: dark").matches}const c=["ui/checkboxTextLabel.css","ui/closeButton.css","ui/confirmDialog.css","ui/dialog.css","ui/dropTarget.css","ui/emptyWidget.css","ui/filter.css","ui/glassPane.css","ui/infobar.css","ui/inlineButton.css","ui/inspectorCommon.css","ui/inspectorStyle.css","ui/inspectorSyntaxHighlight.css","ui/inspectorSyntaxHighlightDark.css","ui/inspectorViewTabbedPane.css","ui/listWidget.css","ui/popover.css","ui/progressIndicator.css","ui/radioButton.css","ui/remoteDebuggingTerminatedScreen.css","ui/reportView.css","ui/rootView.css","ui/searchableView.css","ui/slider.css","ui/smallBubble.css","ui/segmentedButton.css","ui/softContextMenu.css","ui/softDropDown.css","ui/softDropDownButton.css","ui/splitWidget.css","ui/toolbar.css","ui/suggestBox.css","ui/tabbedPane.css","ui/targetCrashedScreen.css","ui/textButton.css","ui/textPrompt.css","ui/tooltip.css","ui/treeoutline.css","ui/viewContainers.css","elements/layoutPane.css","components/imagePreview.css","components/jsUtils.css","persistence/editFileSystemView.css","persistence/workspaceSettingsTab.css","console_counters/errorWarningCounter.css","mobile_throttling/throttlingSettingsTab.css","emulation/deviceModeToolbar.css","emulation/deviceModeView.css","emulation/devicesSettingsTab.css","emulation/inspectedPagePlaceholder.css","emulation/locationsSettingsTab.css","emulation/mediaQueryInspector.css","emulation/sensors.css","inline_editor/colorSwatch.css","inspector_main/nodeIcon.css","inspector_main/renderingOptions.css","data_grid/dataGrid.css","help/releaseNote.css","object_ui/customPreviewComponent.css","object_ui/objectPopover.css","object_ui/objectPropertiesSection.css","object_ui/objectValue.css","console/consoleContextSelector.css","console/consolePinPane.css","console/consolePrompt.css","console/consoleSidebar.css","console/consoleView.css","cm/codemirror.css","text_editor/autocompleteTooltip.css","text_editor/cmdevtools.css"];var i=Object.freeze({__proto__:null,getStyleSheets:function(o,{patchThemeSupport:c=!1}={}){const i=t.get(o);if(i&&i.patchThemeSupport===c)return i.sheets;const n=e.cachedResources.get(o)||"";if(!n)throw new Error(o+" not preloaded.");const r=new CSSStyleSheet;r.replaceSync(n);const u=s.instance().themeStyleSheet(o,n);if(!c||!u)return t.set(o,{patchThemeSupport:c,sheets:[r]}),[r];const a=new CSSStyleSheet;return a.replaceSync(u+"\n"+e.Runtime.resolveSourceURL(o+".theme")),t.set(o,{patchThemeSupport:c,sheets:[r,a]}),[r,a]},DARK_MODE_CLASS:".component-in-dark-mode",isInDarkMode:o,applyDarkModeClassIfNeeded:function(){return o()?".component-in-dark-mode".slice(1):""},CSS_RESOURCES_TO_LOAD_INTO_RUNTIME:c});var n=Object.freeze({__proto__:null,setup:async function(){const s=c.map(s=>fetch("/"+s).then(e=>e.text()).then(t=>{e.cachedResources.set(s,t)}));return Promise.all(s)}});export{n as ComponentServerSetup,i as GetStylesheet};
