"use strict";
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);
var to_plain_text_sync_exports = {};
__export(to_plain_text_sync_exports, {
  toPlainTextSync: () => toPlainTextSync
});
module.exports = __toCommonJS(to_plain_text_sync_exports);
var import_convert_nodes = require("./convert-nodes.js");
var import_to_plain_text_base = require("./to-plain-text-base.js");
const toPlainTextSync = (content, options = {}) => {
  const gen = (0, import_to_plain_text_base.toPlainTextBase)(content, options.delimiter, options.addLinksToText);
  let next = gen.next();
  while (!next.done) {
    switch (next.value.command) {
      case "getImageUrl": {
        const url = options.urlShortener ? options.urlShortener?.(next.value.data) : next.value.data;
        next = gen.next(url);
        break;
      }
      case "getVideoUrl": {
        const url = options.getVideoUrl ? options.getVideoUrl(next.value.data) : (0, import_convert_nodes.getDefaultVideoUrl)(next.value.data);
        next = gen.next(url);
        break;
      }
      case "getVideoEmbeddedUrl": {
        const url = options.getVideoEmbeddedUrl ? options.getVideoEmbeddedUrl(next.value.data) : next.value.data;
        next = gen.next(url);
        break;
      }
      case "getAudioUrl": {
        const url = options.getAudioUrl ? options.getAudioUrl(next.value.data) : (0, import_convert_nodes.getDefaultAudioUrl)(next.value.data);
        next = gen.next(url);
        break;
      }
      case "getGifUrl": {
        const url = options.getGifUrl ? options.getGifUrl(next.value.data) : next.value.data;
        next = gen.next(url);
        break;
      }
      default:
        return "";
    }
  }
  return next.value;
};
//# sourceMappingURL=to-plain-text-sync.js.map
