/**
 * Copyright © Volker Schukai and all contributing authors, 2025. All rights reserved.
 * Node module: @schukai/monster
 *
 * This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
 * The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
 *
 * For those who do not wish to adhere to the AGPLv3, a commercial license is available.
 * Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
 * For more information about purchasing a commercial license, please contact Volker Schukai.
 */

import { addAttributeToken } from "../../../dom/attributes.mjs";
import { ATTRIBUTE_ERRORMESSAGE } from "../../../dom/constants.mjs";

export { FileManagerStyleSheet };

/**
 * @private
 * @type {CSSStyleSheet}
 */
const FileManagerStyleSheet = new CSSStyleSheet();

try {
	FileManagerStyleSheet.insertRule(
		`
@layer filemanager {
:host{box-sizing:border-box;display:block;height:100%;height:-webkit-fill-available;height:fill-available;height:-moz-available;height:stretch;min-height:320px}
[data-monster-role=control]{box-sizing:border-box;display:flex;flex-direction:column;gap:var(--monster-space-4);height:100%}
[data-monster-role=toolbar]{align-items:center;display:flex;gap:var(--monster-space-4);justify-content:space-between}
[data-monster-role=actions]{display:flex;gap:var(--monster-space-3);justify-content:flex-end}
[data-monster-role=title]{font-weight:700}
monster-split-panel{flex:1;min-height:300px}
monster-split-panel::part(control){height:100%}
monster-split-panel::part(endPanel){overflow:hidden}
[data-monster-role=nav-panel],[data-monster-role=editor-panel]{height:100%}
[data-monster-role=nav-panel]{display:flex;flex-direction:column;min-height:0}
[data-monster-role=editor-panel]{display:flex;flex-direction:column;gap:var(--monster-space-3);min-height:0;overflow:hidden;position:relative}
[data-monster-role=tabs-container]{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}
monster-tabs{flex:1;min-height:0;height:100%}
[data-monster-role=empty]{align-items:center;display:flex;inset:0;justify-content:center;padding:var(--monster-space-4);position:absolute;text-align:center}
[data-monster-role=tab-content]{display:flex;flex-direction:column;flex:1;height:100%;min-height:0;overflow:auto}
[data-monster-role=tab-content]:not(.active){display:none}
[data-monster-role=editor]{flex:1;font-family:var(--monster-font-family-monospace);height:100%;min-height:0;overflow:auto;resize:none;width:100%}
}
`,
		0,
	);
} catch (e) {
	addAttributeToken(
		document.getRootNode().querySelector("html"),
		ATTRIBUTE_ERRORMESSAGE,
		e + "",
	);
}
