import { z as e } from "zod";
e.object({
  /** The path to news page. */
  news: e.string().default("/news"),
  /** The path to the store page. */
  store: e.string().default("/store"),
  /** The path to the account page. */
  account: e.string().default("/account"),
  /** The path to the order page. */
  orders: e.string().default("/orders"),
  /** The path to the error pages. */
  error: e.string().default("/error"),
  /** The path to the twitch pages. */
  twitchDrops: e.string().default("/twitch-drops"),
  /** The Path to Legal Pages */
  legal: e.string().default("/new-legal")
});
const d = e.object({ index: e.string(), detail: e.string() }), b = e.object({
  index: e.string(),
  displayNameHistory: e.string(),
  passwordHistory: e.string(),
  emailHistory: e.string()
}), f = e.object({
  index: e.string(),
  games: e.string(),
  keys: e.string(),
  optionboxes: e.string()
}), w = e.object({
  index: e.string(),
  detail: e.string()
});
e.object({
  home: e.string(),
  game: d,
  news: e.object({
    index: e.string(),
    detail: e.string(),
    search: e.string(),
    categories: e.string(),
    admin: e.object({
      articles: e.object({
        index: e.string(),
        create: e.string(),
        edit: e.string()
      }),
      featuredArticles: e.string(),
      categories: e.object({
        index: e.string(),
        create: e.string(),
        edit: e.string()
      })
    })
  }),
  support: e.object({
    index: e.string(),
    topic: e.object({
      index: e.string()
    }),
    article: e.object({
      index: e.string()
    }),
    manage: e.object({
      article: e.object({
        index: e.string(),
        create: e.string(),
        edit: e.string()
      }),
      topic: e.object({
        index: e.string(),
        create: e.string(),
        edit: e.string()
      })
    })
  }),
  linkAccount: e.string(),
  linkAccountOneTimeCode: e.string(),
  verifyUser: e.string(),
  accountDeletionSuccess: e.string(),
  paymentSuccessCallback: e.string(),
  store: e.object({
    index: e.string(),
    apps: d,
    dlcs: d,
    bundles: d,
    ingameitems: d,
    codes: d,
    optionboxes: d
  }),
  // The orders don't have `index` route so we're not using `StoreRouteObject`.
  orders: e.object({
    detail: e.string()
  }),
  account: e.object({
    index: e.string(),
    overview: e.string(),
    profile: e.string(),
    accountHistory: b,
    paymentMethods: e.string(),
    changeEmail: e.string(),
    changePassword: e.string(),
    linkedAccounts: e.string(),
    purchasedItems: f,
    orderHistory: w,
    redeemCode: e.string(),
    notificationPreferences: e.string(),
    legalAgreements: e.string(),
    personalData: e.string(),
    accountDeletion: e.string()
  }),
  twitchDrops: e.object({
    index: e.string(),
    claim: e.string()
  }),
  legal: e.object({
    index: e.string(),
    withId: e.string()
  }),
  error: e.object({
    index: e.string(),
    err400: e.string(),
    err401: e.string(),
    err404: e.string(),
    err500: e.string(),
    network: e.string(),
    sessionExpired: e.string(),
    invalidSSOAuthCode: e.string(),
    alreadyAuthenticated: e.string()
  })
});
class j {
}
j.createWidgetRoutes = (r) => {
  const i = r.store || "/store", c = "/game", n = "/support", t = r.account || "/account", a = r.orders || "/orders", s = r.error || "/error", o = r.news || "/news", g = r.twitchDrops || "/twitch-drops", m = "/link-account", p = "/account/activate", $ = "/verify-user", l = r.legal || "/new-legal", x = "/account-deletion-success", h = "/callback/order/success", y = {
    home: "/",
    game: {
      index: c,
      detail: `${c}/:gameId`
    },
    news: {
      index: o,
      detail: `${o}/:slug`,
      search: `${o}/search`,
      categories: `${o}/categories/:slug`,
      admin: {
        articles: {
          index: `${o}/admin/articles`,
          create: `${o}/admin/articles/create`,
          edit: `${o}/admin/articles/edit/:newsId`
        },
        featuredArticles: `${o}/admin/featured-articles`,
        categories: {
          index: `${o}/admin/categories`,
          create: `${o}/admin/categories/create`,
          edit: `${o}/admin/categories/edit/:categoryId`
        }
      }
    },
    support: {
      index: n,
      topic: {
        index: `${n}/topic/:slug`
      },
      article: {
        index: `${n}/article/:slug`
      },
      manage: {
        article: {
          index: `${n}/manage/article`,
          create: `${n}/manage/article/create`,
          edit: `${n}/manage/article/:slug`
        },
        topic: {
          index: `${n}/manage/topic`,
          create: `${n}/manage/topic/create`,
          edit: `${n}/manage/topic/:slug`
        }
      }
    },
    linkAccount: m,
    linkAccountOneTimeCode: p,
    verifyUser: $,
    accountDeletionSuccess: x,
    paymentSuccessCallback: h,
    store: {
      index: i,
      apps: {
        index: `${i}/apps`,
        detail: `${i}/apps/:itemId`
      },
      dlcs: {
        index: `${i}/dlcs`,
        detail: `${i}/dlcs/:itemId`
      },
      bundles: {
        index: `${i}/bundles`,
        detail: `${i}/bundles/:itemId`
      },
      ingameitems: {
        index: `${i}/in-game-items`,
        detail: `${i}/in-game-items/:itemId`
      },
      codes: {
        index: `${i}/codes`,
        detail: `${i}/codes/:itemId`
      },
      optionboxes: {
        index: `${i}/optionboxes`,
        detail: `${i}/optionboxes/:itemId`
      }
    },
    orders: {
      detail: `${a}/:orderNo`
    },
    account: {
      index: t,
      overview: `${t}/overview`,
      profile: `${t}/profile`,
      accountHistory: {
        index: `${t}/account-history`,
        displayNameHistory: `${t}/account-history/display-name`,
        passwordHistory: `${t}/account-history/password`,
        emailHistory: `${t}/account-history/email-address`
      },
      paymentMethods: `${t}/payment-methods`,
      changeEmail: `${t}/change-email`,
      changePassword: `${t}/change-password`,
      linkedAccounts: `${t}/linked-accounts`,
      purchasedItems: {
        index: `${t}/purchased-items`,
        games: `${t}/purchased-items/games`,
        keys: `${t}/purchased-items/keys`,
        optionboxes: `${t}/purchased-items/optionboxes`
      },
      orderHistory: {
        index: `${t}/order-history`,
        detail: `${t}/order-history/:orderNo`
      },
      redeemCode: `${t}/redeem-code`,
      notificationPreferences: `${t}/notification-preferences`,
      legalAgreements: `${t}/legal-agreements`,
      personalData: `${t}/personal-data`,
      accountDeletion: `${t}/account-deletion`
    },
    twitchDrops: {
      index: g,
      claim: `${g}/claim`
    },
    legal: {
      index: l,
      withId: `${l}/:localizedPolicyId`
    },
    error: {
      index: s,
      err400: `${s}/400`,
      err401: `${s}/401`,
      err404: `${s}/404`,
      err500: `${s}/500`,
      network: `${s}/network-error`,
      sessionExpired: `${s}/login-session-expired`,
      invalidSSOAuthCode: `${s}/invalid-sso-auth-code`,
      alreadyAuthenticated: `${s}/already-authenticated`
    }
  };
  return u(y);
};
function u(r) {
  const i = {};
  for (const c in r) {
    const n = r[c];
    if (typeof n == "string") {
      i[c] = I(n);
      continue;
    }
    const t = e.record(e.any()).safeParse(n);
    if (t.success) {
      const a = u(t.data);
      i[c] = a;
    }
  }
  return i;
}
function I(r) {
  return {
    link: r,
    makePath: ({
      params: i,
      state: c,
      query: n
    }) => {
      const t = n ? `?${new URLSearchParams(n).toString()}` : "";
      let a = r;
      if (i)
        for (const s in i)
          a = a.replace(`:${s}`, `${i[s]}`);
      return c ? { hash: "", key: "", pathname: a, search: t, state: c } : `${a}${t}`;
    }
  };
}
export {
  j as RouteUtils
};
