const _exactRecordNames = new Set(["asset.assignees", "asset.clone", "asset.deadlines", "asset.duration", "asset.dynamicProperties?", "asset.embedding", "asset.icon", "asset.locations", "asset.media", "asset.tags", "asset.title", "asset.types", "asset.http", "storage.locations?", "storage.zones?", "nxt.status?", "media.subtitles", "media.subtitles?", "media.transcribe", "media.transcribe?", "media.fonts?", "media.consolidate", "stream-helper", "mediamtx", "asset-daemon", "asset-daemon:user-notify.state", "asset-daemon:validate.state", "deepstream-replicator.stats?"]);
const _domainNames = new Set([":asset.title?", ":asset.rawTypes?", ":asset.types?", ":asset.assignees?", ":asset.refs?", ":asset.tags?", ":asset.fileRefs?", ":asset.created?", ":asset.modified?", ":asset.status?", ":asset.icon?", ":asset.deadlines?", ":asset.publish?", ":asset.published?", ":asset.duration?", ":asset.locations?", ":asset.controllers?", ":asset.embedding?", ":asset.media?", ":asset.presence?", ":asset.comments?", ":asset.record?", ":auth", ":bundle", ":bundle.revisions", ":calendarevent", ":clone", ":comment-reaction", ":comment-read-mark", ":comment", ":comment.reactions?", ":comment.replies?", ":comment.readMarks?", ":condition", ":connection", ":connection.methods?", ":connection.stats?", ":contact", ":deepstream.replicate", ":design?", ":device", ":device.status?", ":edit", ":template", ":event", ":event._template?", ":event.overlay?", ":event.template?", ":event.duration?", ":event.children?", ":event.props?", ":event.stats?", ":event.status?", ":event.schedule?", ":event.readDuration?", ":event.readRate?", ":external", ":external.publish?", ":external.harvested?", ":external.stats?", ":file", ":file.replicate", ":file.restrictions", ":file.stats?", ":file.methods?", ":folder.items", ":gallery", ":general.title", ":general.tags", ":general.created", ":general.scheduled", ":general.poster", ":general.status", ":general.description", ":general._asset", ":general._embedding", ":harvest", ":harvest.status?", ":ingestclip", ":ingestschedule", ":ingestschedule.stats?", ":media.source", ":media.placeholder", ":media.consolidate", ":media.consolidate?", ":media.renders?", ":media.transcriptChanges", ":media.font", ":media.restrictions?", ":media.probe?", ":media.updateSubtitles?", ":media.updateGraphics?", ":media.revisions", ":monitor.stats?", ":note", ":panel", ":permission?", ":permission", ":pipeline-preset", ":pipeline", ":pipeline.items", ":planning", ":planning.assignees", ":planning.deadline", ":prompter", ":publish", ":publish.stats?", ":publish.methods?", ":publish.accepts?", ":published", ":render-preset", ":render-profile", ":render.stats?", ":render.query?", ":render.result?", ":render.schedulers?", ":revs?", ":role", ":role.users?", ":role.tags", ":schema", ":script", ":script?", ":script.revisions?", ":script.revision", ":script.revision?", ":script.content?", ":script.text?", ":script.children", ":search", ":search?", ":search.conditions", ":search.visibleColumnKeys", ":settings", ":settings.node", ":shotbox", ":storage", ":storage.stats", ":storage-zone", ":story.editor", ":storyboard", ":storyboard.pipelines", ":storyboard.descendants?", ":storyboard.ancestors?", ":stream", ":stream.stats?", ":stream.controls?", ":stream.ingest", ":stream.ingest.stats?", ":stream-ingest.inputs?", ":subtitle-style", ":subtitle", ":_user-notification-status", ":user-notification", ":user-notification.readAt", ":user", ":user.latestSeenNotification", ":user.receivedNotifications?", ":user.unseenNotifications?", ":username?"]);
export const exactRecordNames = _exactRecordNames;
export const domainNames = _domainNames;
export function isEmptyRecord(data) {
    return typeof data === "object" && data !== null && Object.keys(data).length === 0;
}
export function isNonEmptyRecord(data) {
    return typeof data === "object" && data !== null && Object.keys(data).length > 0;
}
export function parseRecordName(name) {
    if (_exactRecordNames.has(stripParams(name))) {
        return {
            type: "exact",
            exact: stripParams(name),
        };
    }
    if (name.startsWith("[]")) {
        return { type: "domain-rows" };
    }
    const colonIndex = name.lastIndexOf(":");
    if (colonIndex === -1) {
        throw new Error(`Unknown record name: ${name}`);
    }
    if (colonIndex === 0) {
        return { type: "domain-rows" };
    }
    // TODO: actual lookup for domains
    return {
        type: "domain",
        domain: stripParams(name.slice(colonIndex)),
        exact: stripParams(name),
    };
}
function stripParams(input) {
    const paramIndex = input.indexOf("?");
    return paramIndex === -1 ? input : input.slice(0, paramIndex + 1);
}
