const PATH = ['globalOptions', 'name:audioGroups', 'options', 'groups'];
const MASTER_GROUP = 'master';
export const audioSource = {
    fields: [
        {
            name: 'src',
            type: 'file',
            extensions: ['mp3', 'wav', 'ogg'],
        },
        {
            name: 'volume',
            type: 'range',
            min: 0,
            max: 1,
            step: 0.01,
        },
        {
            name: 'looped',
            type: 'boolean',
        },
        {
            name: 'autoplay',
            type: 'boolean',
        },
        {
            name: 'group',
            type: 'select',
            options: (getState) => {
                var _a;
                return [
                    MASTER_GROUP,
                    ...((_a = getState(PATH)) !== null && _a !== void 0 ? _a : []).map((group) => group.name),
                ];
            },
        },
    ],
    getInitialState: () => ({
        src: '',
        volume: 1,
        looped: false,
        autoplay: false,
        group: MASTER_GROUP,
    }),
};
