export const playtestQueryParam = 'playtest';
/** Must align to Devvit CLI. */
export const playtestURI = 'ws://localhost:5678';
/**
 * @arg app App name (slug). Do not derive from `location`.
 * @ret true if the current URL supports playtests.
 */
export function isPlaytest(app) {
    const playtest = getPlaytestFilter();
    return playtest === '' || playtest === app;
}
export function getPlaytestFilter() {
    if (!globalThis.location)
        return;
    // to-do: consolidate with devvit-global.ts by moving devvit-global to
    // runtime-lite since ui-renderer depends on runtime-lite and runtime-lite has
    // web client-only components like BrowserLiteClient.
    const url = new URL(location.href);
    return url.searchParams.get(playtestQueryParam) ?? undefined;
}
