var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);

// src/util/news.ts
var news_exports = {};
__export(news_exports, {
  filterNews: () => filterNews,
  localizedNewsSchema: () => localizedNewsSchema,
  newsListSchema: () => newsListSchema,
  newsSchema: () => newsSchema
});
module.exports = __toCommonJS(news_exports);
var import_zod = require("zod");

// src/localization/util.ts
var languages = ["en", "de"];
var languagesLocalNames = {
  en: "English",
  de: "Deutsch"
};
var DEFAULT_LANGUAGE = "en";
var LanguageUtil = {
  languages,
  DEFAULT_LANGUAGE,
  languagesLocalNames
};

// src/util/news.ts
var newsSchema = import_zod.z.object({
  title: import_zod.z.string(),
  description: import_zod.z.string(),
  date: import_zod.z.string(),
  image: import_zod.z.string().url().optional(),
  externalResource: import_zod.z.string().url().optional(),
  keys: import_zod.z.array(import_zod.z.string())
}).transform((obj) => {
  let description = [obj.description];
  if (obj.image) {
    description = [new URL(obj.image), ...description];
  }
  return {
    title: obj.title,
    date: new Date(obj.date),
    description,
    externalResource: obj.externalResource ? new URL(obj.externalResource) : void 0,
    keys: obj.keys
  };
});
var newsListSchema = import_zod.z.array(newsSchema);
var localizedNewsSchema = import_zod.z.record(import_zod.z.enum(LanguageUtil.languages), newsListSchema);
var filterNews = (localizedNews, requiredKeys) => {
  return localizedNews.filter((news) => requiredKeys.every((value) => news.keys.includes(value)));
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  filterNews,
  localizedNewsSchema,
  newsListSchema,
  newsSchema
});
//# sourceMappingURL=news.js.map