1import { DiffuseElement } from "@common/element.js";
2
3import "@components/configurator/input/element.js";
4import "@components/input/opensubsonic/element.js";
5import "@components/input/s3/element.js";
6
7/**
8 * @import {RenderArg} from "@common/element.d.ts"
9 * @import {InputActions, InputElement} from "@components/input/types.d.ts"
10 */
11
12////////////////////////////////////////////
13// ELEMENT
14////////////////////////////////////////////
15
16class InputOrchestrator extends DiffuseElement {
17 static NAME = "diffuse/orchestrator/input";
18 static WORKER_URL = "components/configurator/input/worker.js";
19
20 /**
21 * @returns {InputElement}
22 */
23 get input() {
24 /** @type {InputElement | null} */
25 const input = this.querySelector("dc-input");
26
27 if (!input) throw new Error("Input orchestrator did not render yet.");
28 return input;
29 }
30
31 // PROXY INPUT ACTIONS
32
33 consult = /** @type {InputActions["consult"]} */ (...args) =>
34 this.input.consult(...args);
35
36 detach = /** @type {InputActions["detach"]} */ (...args) =>
37 this.input.detach(...args);
38
39 groupConsult = /** @type {InputActions["groupConsult"]} */ (...args) =>
40 this.input.groupConsult(...args);
41
42 list = /** @type {InputActions["list"]} */ (...args) =>
43 this.input.list(...args);
44
45 resolve = /** @type {InputActions["resolve"]} */ (...args) =>
46 this.input.resolve(...args);
47
48 // PROXY OTHER FUNCTIONS
49
50 /** @override */
51 dependencies() {
52 return this.input.dependencies();
53 }
54
55 // RENDER
56
57 /**
58 * @param {RenderArg} _
59 */
60 render({ html }) {
61 return html`
62 <dc-input>
63 <di-opensubsonic></di-opensubsonic>
64 <di-s3></di-s3>
65 </dc-input>
66 `;
67 }
68}
69
70export default InputOrchestrator;
71
72////////////////////////////////////////////
73// REGISTER
74////////////////////////////////////////////
75
76export const CLASS = InputOrchestrator;
77export const NAME = "do-input";
78
79customElements.define(NAME, CLASS);