@maily-to/render 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["meta: MetaDescriptors","meta","props: MetaDescriptor","meta: MetaDescriptor","maily: Maily","content: string | JSONContent","node: JSONContent","antialiased: CSSProperties","headings: Record<AllowedHeadings, CSSProperties>","logoSizes: Record<AllowedLogoSizes, string>","DEFAULT_META_TAGS: MetaDescriptors","DEFAULT_HTML_PROPS: HtmlProps","DEFAULT_RENDER_OPTIONS: RenderOptions","DEFAULT_THEME","content: JSONContent","preview?: string | JSONContent","theme: Partial<ThemeOptions>","formatter: VariableFormatter","variable: string","value: string","values: Record<string, string>","link: string","key: string","value: PayloadValue","values: Record<string, PayloadValue>","pixel?: string","shouldReplace: boolean","meta: MetaDescriptors","meta","props: HtmlProps","href: string","node: JSONContent","options: RenderOptions","nodeOptions: NodeOptions","fontOptions: FontProps","bodyStyles: CSSProperties","options?: NodeOptions","options: NodeOptions","_: MarkType","text: JSX.Element","mark: MarkType","fallback?: string","_: JSONContent","__?: NodeOptions","radius: string | undefined","content: JSONContent","config?: MailyConfig & RenderOptions"],"sources":["../../../node_modules/.pnpm/@antfu+utils@9.2.0/node_modules/@antfu/utils/dist/index.mjs","../src/utils.ts","../src/meta.tsx","../../shared/dist/index.mjs","../src/preheader.ts","../src/maily.tsx","../src/render.ts"],"sourcesContent":["function clamp(n, min, max) {\n return Math.min(max, Math.max(min, n));\n}\nfunction sum(...args) {\n return flattenArrayable(args).reduce((a, b) => a + b, 0);\n}\nfunction lerp(min, max, t) {\n const interpolation = clamp(t, 0, 1);\n return min + (max - min) * interpolation;\n}\nfunction remap(n, inMin, inMax, outMin, outMax) {\n const interpolation = (n - inMin) / (inMax - inMin);\n return lerp(outMin, outMax, interpolation);\n}\n\nfunction toArray(array) {\n array = array ?? [];\n return Array.isArray(array) ? array : [array];\n}\nfunction flattenArrayable(array) {\n return toArray(array).flat(1);\n}\nfunction mergeArrayable(...args) {\n return args.flatMap((i) => toArray(i));\n}\nfunction partition(array, ...filters) {\n const result = Array.from({ length: filters.length + 1 }).fill(null).map(() => []);\n array.forEach((e, idx, arr) => {\n let i = 0;\n for (const filter of filters) {\n if (filter(e, idx, arr)) {\n result[i].push(e);\n return;\n }\n i += 1;\n }\n result[i].push(e);\n });\n return result;\n}\nfunction uniq(array) {\n return Array.from(new Set(array));\n}\nfunction uniqueBy(array, equalFn) {\n return array.reduce((acc, cur) => {\n const index = acc.findIndex((item) => equalFn(cur, item));\n if (index === -1)\n acc.push(cur);\n return acc;\n }, []);\n}\nfunction last(array) {\n return at(array, -1);\n}\nfunction remove(array, value) {\n if (!array)\n return false;\n const index = array.indexOf(value);\n if (index >= 0) {\n array.splice(index, 1);\n return true;\n }\n return false;\n}\nfunction at(array, index) {\n const len = array.length;\n if (!len)\n return void 0;\n if (index < 0)\n index += len;\n return array[index];\n}\nfunction range(...args) {\n let start, stop, step;\n if (args.length === 1) {\n start = 0;\n step = 1;\n [stop] = args;\n } else {\n [start, stop, step = 1] = args;\n }\n const arr = [];\n let current = start;\n while (current < stop) {\n arr.push(current);\n current += step || 1;\n }\n return arr;\n}\nfunction move(arr, from, to) {\n arr.splice(to, 0, arr.splice(from, 1)[0]);\n return arr;\n}\nfunction clampArrayRange(n, arr) {\n return clamp(n, 0, arr.length - 1);\n}\nfunction sample(arr, quantity) {\n return Array.from({ length: quantity }, (_) => arr[Math.round(Math.random() * (arr.length - 1))]);\n}\nfunction shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n return array;\n}\nfunction filterInPlace(array, predicate) {\n for (let i = array.length; i--; i >= 0) {\n if (!predicate(array[i], i, array))\n array.splice(i, 1);\n }\n return array;\n}\n\nfunction assert(condition, message) {\n if (!condition)\n throw new Error(message);\n}\nconst toString = (v) => Object.prototype.toString.call(v);\nfunction getTypeName(v) {\n if (v === null)\n return \"null\";\n const type = toString(v).slice(8, -1).toLowerCase();\n return typeof v === \"object\" || typeof v === \"function\" ? type : typeof v;\n}\nfunction noop() {\n}\n\nfunction isDeepEqual(value1, value2) {\n const type1 = getTypeName(value1);\n const type2 = getTypeName(value2);\n if (type1 !== type2)\n return false;\n if (type1 === \"array\") {\n if (value1.length !== value2.length)\n return false;\n return value1.every((item, i) => {\n return isDeepEqual(item, value2[i]);\n });\n }\n if (type1 === \"object\") {\n const keyArr = Object.keys(value1);\n if (keyArr.length !== Object.keys(value2).length)\n return false;\n return keyArr.every((key) => {\n return isDeepEqual(value1[key], value2[key]);\n });\n }\n return Object.is(value1, value2);\n}\n\nfunction batchInvoke(functions) {\n functions.forEach((fn) => fn && fn());\n}\nfunction invoke(fn) {\n return fn();\n}\nfunction tap(value, callback) {\n callback(value);\n return value;\n}\n\nfunction notNullish(v) {\n return v != null;\n}\nfunction noNull(v) {\n return v !== null;\n}\nfunction notUndefined(v) {\n return v !== void 0;\n}\nfunction isTruthy(v) {\n return Boolean(v);\n}\n\nconst isDef = (val) => typeof val !== \"undefined\";\nconst isBoolean = (val) => typeof val === \"boolean\";\nconst isFunction = (val) => typeof val === \"function\";\nconst isNumber = (val) => typeof val === \"number\";\nconst isString = (val) => typeof val === \"string\";\nconst isObject = (val) => toString(val) === \"[object Object]\";\nconst isUndefined = (val) => toString(val) === \"[object Undefined]\";\nconst isNull = (val) => toString(val) === \"[object Null]\";\nconst isRegExp = (val) => toString(val) === \"[object RegExp]\";\nconst isDate = (val) => toString(val) === \"[object Date]\";\nfunction isPrimitive(val) {\n return !val || Object(val) !== val;\n}\nconst isWindow = (val) => typeof window !== \"undefined\" && toString(val) === \"[object Window]\";\nconst isBrowser = typeof window !== \"undefined\";\n\nfunction slash(str) {\n return str.replace(/\\\\/g, \"/\");\n}\nfunction ensurePrefix(prefix, str) {\n if (!str.startsWith(prefix))\n return prefix + str;\n return str;\n}\nfunction ensureSuffix(suffix, str) {\n if (!str.endsWith(suffix))\n return str + suffix;\n return str;\n}\nfunction template(str, ...args) {\n const [firstArg, fallback] = args;\n if (isObject(firstArg)) {\n const vars = firstArg;\n return str.replace(/\\{(\\w+)\\}/g, (_, key) => vars[key] || ((typeof fallback === \"function\" ? fallback(key) : fallback) ?? key));\n } else {\n return str.replace(/\\{(\\d+)\\}/g, (_, key) => {\n const index = Number(key);\n if (Number.isNaN(index))\n return key;\n return args[index];\n });\n }\n}\nconst urlAlphabet = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\nfunction randomStr(size = 16, dict = urlAlphabet) {\n let id = \"\";\n let i = size;\n const len = dict.length;\n while (i--)\n id += dict[Math.random() * len | 0];\n return id;\n}\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1).toLowerCase();\n}\nconst _reFullWs = /^\\s*$/;\nfunction unindent(str) {\n const lines = (typeof str === \"string\" ? str : str[0]).split(\"\\n\");\n const whitespaceLines = lines.map((line) => _reFullWs.test(line));\n const commonIndent = lines.reduce((min, line, idx) => {\n if (whitespaceLines[idx])\n return min;\n const indent = line.match(/^\\s*/)?.[0].length;\n return indent === void 0 ? min : Math.min(min, indent);\n }, Number.POSITIVE_INFINITY);\n let emptyLinesHead = 0;\n while (emptyLinesHead < lines.length && whitespaceLines[emptyLinesHead])\n emptyLinesHead++;\n let emptyLinesTail = 0;\n while (emptyLinesTail < lines.length && whitespaceLines[lines.length - emptyLinesTail - 1])\n emptyLinesTail++;\n return lines.slice(emptyLinesHead, lines.length - emptyLinesTail).map((line) => line.slice(commonIndent)).join(\"\\n\");\n}\n\nfunction objectMap(obj, fn) {\n return Object.fromEntries(\n Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish)\n );\n}\nfunction isKeyOf(obj, k) {\n return k in obj;\n}\nfunction objectKeys(obj) {\n return Object.keys(obj);\n}\nfunction objectEntries(obj) {\n return Object.entries(obj);\n}\nfunction deepMerge(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n if (isMergableObject(target[key])) {\n deepMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMerge(target, ...sources);\n}\nfunction deepMergeWithArray(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (Array.isArray(target) && Array.isArray(source))\n target.push(...source);\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (Array.isArray(source[key])) {\n if (!target[key])\n target[key] = [];\n deepMergeWithArray(target[key], source[key]);\n } else if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n deepMergeWithArray(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMergeWithArray(target, ...sources);\n}\nfunction isMergableObject(item) {\n return isObject(item) && !Array.isArray(item);\n}\nfunction objectPick(obj, keys, omitUndefined = false) {\n return keys.reduce((n, k) => {\n if (k in obj) {\n if (!omitUndefined || obj[k] !== void 0)\n n[k] = obj[k];\n }\n return n;\n }, {});\n}\nfunction clearUndefined(obj) {\n Object.keys(obj).forEach((key) => obj[key] === void 0 ? delete obj[key] : {});\n return obj;\n}\nfunction hasOwnProperty(obj, v) {\n if (obj == null)\n return false;\n return Object.prototype.hasOwnProperty.call(obj, v);\n}\nconst _objectIdMap = /* @__PURE__ */ new WeakMap();\nfunction objectId(obj) {\n if (isPrimitive(obj))\n return obj;\n if (!_objectIdMap.has(obj)) {\n _objectIdMap.set(obj, randomStr());\n }\n return _objectIdMap.get(obj);\n}\n\n/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nclass Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tpeek() {\n\t\tif (!this.#head) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.#head.value;\n\n\t\t// TODO: Node.js 18.\n\t\t// return this.#head?.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n\nfunction pLimit(concurrency) {\n\tvalidateConcurrency(concurrency);\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst resumeNext = () => {\n\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t\t// Since `pendingCount` has been decreased by one, increase `activeCount` by one.\n\t\t\tactiveCount++;\n\t\t}\n\t};\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tresumeNext();\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, arguments_) => {\n\t\t// Queue `internalResolve` instead of the `run` function\n\t\t// to preserve asynchronous context.\n\t\tnew Promise(internalResolve => {\n\t\t\tqueue.enqueue(internalResolve);\n\t\t}).then(\n\t\t\trun.bind(undefined, function_, resolve, arguments_),\n\t\t);\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// after the `internalResolve` function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency) {\n\t\t\t\tresumeNext();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise(resolve => {\n\t\tenqueue(function_, resolve, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t\tconcurrency: {\n\t\t\tget: () => concurrency,\n\n\t\t\tset(newConcurrency) {\n\t\t\t\tvalidateConcurrency(newConcurrency);\n\t\t\t\tconcurrency = newConcurrency;\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t// eslint-disable-next-line no-unmodified-loop-condition\n\t\t\t\t\twhile (activeCount < concurrency && queue.size > 0) {\n\t\t\t\t\t\tresumeNext();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nfunction validateConcurrency(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n}\n\nconst VOID = Symbol(\"p-void\");\nclass PInstance extends Promise {\n constructor(items = [], options) {\n super(() => {\n });\n this.items = items;\n this.options = options;\n }\n promises = /* @__PURE__ */ new Set();\n get promise() {\n let batch;\n const items = [...Array.from(this.items), ...Array.from(this.promises)];\n if (this.options?.concurrency) {\n const limit = pLimit(this.options.concurrency);\n batch = Promise.all(items.map((p2) => limit(() => p2)));\n } else {\n batch = Promise.all(items);\n }\n return batch.then((l) => l.filter((i) => i !== VOID));\n }\n add(...args) {\n args.forEach((i) => {\n this.promises.add(i);\n });\n }\n map(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n if (v === VOID)\n return VOID;\n return fn(v, idx);\n }),\n this.options\n );\n }\n filter(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n const r = await fn(v, idx);\n if (!r)\n return VOID;\n return v;\n }),\n this.options\n );\n }\n forEach(fn) {\n return this.map(fn).then();\n }\n reduce(fn, initialValue) {\n return this.promise.then((array) => array.reduce(fn, initialValue));\n }\n clear() {\n this.promises.clear();\n }\n then(onfulfilled, onrejected) {\n return this.promise.then(onfulfilled, onrejected);\n }\n catch(fn) {\n return this.promise.catch(fn);\n }\n finally(fn) {\n return this.promise.finally(fn);\n }\n}\nfunction p(items, options) {\n return new PInstance(items, options);\n}\n\nfunction createSingletonPromise(fn) {\n let _promise;\n function wrapper() {\n if (!_promise)\n _promise = fn();\n return _promise;\n }\n wrapper.reset = async () => {\n const _prev = _promise;\n _promise = void 0;\n if (_prev)\n await _prev;\n };\n return wrapper;\n}\nfunction sleep(ms, callback) {\n return new Promise(\n (resolve) => setTimeout(async () => {\n await callback?.();\n resolve();\n }, ms)\n );\n}\nfunction createPromiseLock() {\n const locks = [];\n return {\n async run(fn) {\n const p = fn();\n locks.push(p);\n try {\n return await p;\n } finally {\n remove(locks, p);\n }\n },\n async wait() {\n await Promise.allSettled(locks);\n },\n isWaiting() {\n return Boolean(locks.length);\n },\n clear() {\n locks.length = 0;\n }\n };\n}\nfunction createControlledPromise() {\n let resolve, reject;\n const promise = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n promise.resolve = resolve;\n promise.reject = reject;\n return promise;\n}\n\nconst timestamp = () => +Date.now();\n\n/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)\n * are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,\n * as-is, to `callback` when the throttled-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds\n * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed\n * one final time after the last throttled-function call. (After the throttled-function has not been called for\n * `delay` milliseconds, the internal counter is reset).\n * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback\n * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that\n * callback will never executed if both noLeading = true and noTrailing = true.\n * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is\n * false (at end), schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nfunction throttle$1 (delay, callback, options) {\n var _ref = options || {},\n _ref$noTrailing = _ref.noTrailing,\n noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,\n _ref$noLeading = _ref.noLeading,\n noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,\n _ref$debounceMode = _ref.debounceMode,\n debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;\n /*\n * After wrapper has stopped being called, this timeout ensures that\n * `callback` is executed at the proper times in `throttle` and `end`\n * debounce modes.\n */\n\n\n var timeoutID;\n var cancelled = false; // Keep track of the last time `callback` was executed.\n\n var lastExec = 0; // Function to clear existing timeout\n\n function clearExistingTimeout() {\n if (timeoutID) {\n clearTimeout(timeoutID);\n }\n } // Function to cancel next exec\n\n\n function cancel(options) {\n var _ref2 = options || {},\n _ref2$upcomingOnly = _ref2.upcomingOnly,\n upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;\n\n clearExistingTimeout();\n cancelled = !upcomingOnly;\n }\n /*\n * The `wrapper` function encapsulates all of the throttling / debouncing\n * functionality and when executed will limit the rate at which `callback`\n * is executed.\n */\n\n\n function wrapper() {\n for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n arguments_[_key] = arguments[_key];\n }\n\n var self = this;\n var elapsed = Date.now() - lastExec;\n\n if (cancelled) {\n return;\n } // Execute `callback` and update the `lastExec` timestamp.\n\n\n function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }\n /*\n * If `debounceMode` is true (at begin) this is used to clear the flag\n * to allow future `callback` executions.\n */\n\n\n function clear() {\n timeoutID = undefined;\n }\n\n if (!noLeading && debounceMode && !timeoutID) {\n /*\n * Since `wrapper` is being called for the first time and\n * `debounceMode` is true (at begin), execute `callback`\n * and noLeading != true.\n */\n exec();\n }\n\n clearExistingTimeout();\n\n if (debounceMode === undefined && elapsed > delay) {\n if (noLeading) {\n /*\n * In throttle mode with noLeading, if `delay` time has\n * been exceeded, update `lastExec` and schedule `callback`\n * to execute after `delay` ms.\n */\n lastExec = Date.now();\n\n if (!noTrailing) {\n timeoutID = setTimeout(debounceMode ? clear : exec, delay);\n }\n } else {\n /*\n * In throttle mode without noLeading, if `delay` time has been exceeded, execute\n * `callback`.\n */\n exec();\n }\n } else if (noTrailing !== true) {\n /*\n * In trailing throttle mode, since `delay` time has not been\n * exceeded, schedule `callback` to execute `delay` ms after most\n * recent execution.\n *\n * If `debounceMode` is true (at begin), schedule `clear` to execute\n * after `delay` ms.\n *\n * If `debounceMode` is false (at end), schedule `callback` to\n * execute after `delay` ms.\n */\n timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n }\n }\n\n wrapper.cancel = cancel; // Return the wrapper function.\n\n return wrapper;\n}\n\n/* eslint-disable no-undefined */\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n *\n * @returns {Function} A new, debounced function.\n */\n\nfunction debounce$1 (delay, callback, options) {\n var _ref = options || {},\n _ref$atBegin = _ref.atBegin,\n atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;\n\n return throttle$1(delay, callback, {\n debounceMode: atBegin !== false\n });\n}\n\nfunction throttle(...args) {\n return throttle$1(...args);\n}\nfunction debounce(...args) {\n return debounce$1(...args);\n}\n\nexport { assert, at, batchInvoke, capitalize, clamp, clampArrayRange, clearUndefined, createControlledPromise, createPromiseLock, createSingletonPromise, debounce, deepMerge, deepMergeWithArray, ensurePrefix, ensureSuffix, filterInPlace, flattenArrayable, getTypeName, hasOwnProperty, invoke, isBoolean, isBrowser, isDate, isDeepEqual, isDef, isFunction, isKeyOf, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isTruthy, isUndefined, isWindow, last, lerp, mergeArrayable, move, noNull, noop, notNullish, notUndefined, objectEntries, objectId, objectKeys, objectMap, objectPick, p, partition, randomStr, range, remap, remove, sample, shuffle, slash, sleep, sum, tap, template, throttle, timestamp, toArray, toString, unindent, uniq, uniqueBy };\n","export function generateKey() {\n // Length of 6 is enough to avoid collisions\n // for react keys\n return Math.random().toString(36).substr(2, 6);\n}\n","export type MetaDescriptor =\n | {\n charSet: 'utf-8';\n }\n | {\n title: string;\n }\n | {\n name: string;\n content: string;\n }\n | {\n property: string;\n content: string;\n }\n | {\n httpEquiv: string;\n content: string;\n }\n | {\n tagName: 'meta' | 'link';\n [attribute: string]: string;\n }\n | {\n [name: string]: string;\n };\n\nexport type MetaDescriptors = MetaDescriptor[];\n\nexport function meta(meta: MetaDescriptors) {\n return (\n meta\n // only filter unique meta tags\n // so that we don't have duplicate meta tags\n .filter((meta, index, self) => {\n const meta_hash = hash(meta);\n return (\n index ===\n self.findIndex((t) => {\n return hash(t) === meta_hash;\n })\n );\n })\n .map(process)\n .filter(Boolean) as JSX.Element[]\n );\n}\n\nfunction process(props: MetaDescriptor) {\n if ('tagName' in props) {\n const { tagName, ...attributes } = props;\n const Comp = tagName;\n return <Comp key={JSON.stringify(attributes)} {...attributes} />;\n }\n\n if ('title' in props) {\n return <title>{props.title}</title>;\n }\n\n if ('charSet' in props) {\n return <meta charSet={props.charSet} />;\n }\n\n return <meta key={JSON.stringify(props)} {...props} />;\n}\n\n/**\n * hash the meta object to string\n * so that we can filter out duplicates\n * for that we have to sort the object keys\n * and then stringify it and hash it\n */\nfunction hash(meta: MetaDescriptor) {\n const sortedMeta = Object.keys(meta)\n .sort()\n .reduce((acc, key) => {\n const _key = key as keyof MetaDescriptor;\n acc[_key] = meta[_key];\n return acc;\n }, {} as MetaDescriptor);\n\n return JSON.stringify(sortedMeta);\n}\n","//#region src/theme.ts\nconst allowedFallbackFonts = [\n\t\"Arial\",\n\t\"Helvetica\",\n\t\"Verdana\",\n\t\"Georgia\",\n\t\"Times New Roman\",\n\t\"serif\",\n\t\"sans-serif\",\n\t\"monospace\",\n\t\"cursive\",\n\t\"fantasy\"\n];\nconst allowedFontFormats = [\n\t\"woff\",\n\t\"woff2\",\n\t\"truetype\",\n\t\"opentype\",\n\t\"embedded-opentype\",\n\t\"svg\"\n];\nconst DEFAULT_FONT = {\n\tfallbackFontFamily: \"sans-serif\",\n\tfontFamily: \"Inter\",\n\twebFont: {\n\t\turl: \"https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19\",\n\t\tformat: \"woff2\"\n\t}\n};\nconst DEFAULT_LINK_TEXT_COLOR = \"#111827\";\nconst DEFAULT_RENDERER_THEME = {\n\tcolors: {\n\t\theading: \"#111827\",\n\t\tparagraph: \"#374151\",\n\t\thorizontal: \"#EAEAEA\",\n\t\tfooter: \"#64748B\",\n\t\tblockquoteBorder: \"#D1D5DB\",\n\t\tcodeBackground: \"#EFEFEF\",\n\t\tcodeText: \"#111827\",\n\t\tlinkCardTitle: \"#111827\",\n\t\tlinkCardDescription: \"#6B7280\",\n\t\tlinkCardBadgeText: \"#111827\",\n\t\tlinkCardBadgeBackground: \"#FEF08A\",\n\t\tlinkCardSubTitle: \"#6B7280\"\n\t},\n\tfontSize: {\n\t\tparagraph: {\n\t\t\tsize: \"15px\",\n\t\t\tlineHeight: \"26.25px\"\n\t\t},\n\t\tfooter: {\n\t\t\tsize: \"14px\",\n\t\t\tlineHeight: \"24px\"\n\t\t}\n\t},\n\tcontainer: {\n\t\tbackgroundColor: \"#ffffff\",\n\t\tmaxWidth: \"600px\",\n\t\tminWidth: \"300px\",\n\t\tpaddingTop: \"0.5rem\",\n\t\tpaddingRight: \"0.5rem\",\n\t\tpaddingBottom: \"0.5rem\",\n\t\tpaddingLeft: \"0.5rem\",\n\t\tborderRadius: \"0px\",\n\t\tborderWidth: \"0px\",\n\t\tborderColor: \"transparent\"\n\t},\n\tbody: {\n\t\tbackgroundColor: \"#ffffff\",\n\t\tpaddingTop: \"0px\",\n\t\tpaddingRight: \"0px\",\n\t\tpaddingBottom: \"0px\",\n\t\tpaddingLeft: \"0px\"\n\t},\n\tbutton: {\n\t\tbackgroundColor: \"#000000\",\n\t\tcolor: \"#ffffff\",\n\t\tpaddingTop: \"10px\",\n\t\tpaddingRight: \"32px\",\n\t\tpaddingBottom: \"10px\",\n\t\tpaddingLeft: \"32px\"\n\t},\n\tlink: { color: DEFAULT_LINK_TEXT_COLOR },\n\tfont: DEFAULT_FONT\n};\nconst DEFAULT_EDITOR_THEME = {\n\tcontainer: {\n\t\tbackgroundColor: \"#ffffff\",\n\t\tmaxWidth: \"600px\",\n\t\tminWidth: \"300px\",\n\t\tpaddingTop: \"8px\",\n\t\tpaddingRight: \"8px\",\n\t\tpaddingBottom: \"8px\",\n\t\tpaddingLeft: \"8px\",\n\t\tborderRadius: \"0px\",\n\t\tborderWidth: \"0px\",\n\t\tborderColor: \"transparent\"\n\t},\n\tbody: {\n\t\tbackgroundColor: \"#ffffff\",\n\t\tpaddingTop: \"0px\",\n\t\tpaddingRight: \"0px\",\n\t\tpaddingBottom: \"0px\",\n\t\tpaddingLeft: \"0px\"\n\t},\n\tbutton: {\n\t\tbackgroundColor: \"#000000\",\n\t\tcolor: \"#ffffff\",\n\t\tpaddingTop: \"10px\",\n\t\tpaddingRight: \"32px\",\n\t\tpaddingBottom: \"10px\",\n\t\tpaddingLeft: \"32px\"\n\t},\n\tlink: { color: DEFAULT_LINK_TEXT_COLOR },\n\tfont: DEFAULT_FONT\n};\n\n//#endregion\n//#region src/css-variables.ts\n/**\n* if the value is undefined, it will return an empty object\n* so that we don't override the default value\n* @param name - The name of the CSS variable\n* @param value - The value of the CSS variable\n* @returns The CSS variable value\n*/\nfunction getVariableValue(name, value) {\n\tif (value === void 0 || value === null || value === \"\") return {};\n\treturn { [name]: value };\n}\n/**\n* Get the CSS variables for the theme\n* @param theme - The theme\n* @returns The CSS variables\n* @example\n* ```ts\n* const theme = {\n* body: {\n* backgroundColor: 'red',\n* },\n* };\n*\n* const cssVariables = getCssVariables(theme);\n*\n* console.log(cssVariables);\n* // { '--mly-body-background-color': 'red' }\n*/\nfunction getMailyCssVariables(theme) {\n\tconst font = theme.font || DEFAULT_FONT;\n\treturn {\n\t\t...getVariableValue(\"--mly-body-background-color\", theme.body?.backgroundColor),\n\t\t...getVariableValue(\"--mly-body-padding-top\", theme.body?.paddingTop),\n\t\t...getVariableValue(\"--mly-body-padding-right\", theme.body?.paddingRight),\n\t\t...getVariableValue(\"--mly-body-padding-bottom\", theme.body?.paddingBottom),\n\t\t...getVariableValue(\"--mly-body-padding-left\", theme.body?.paddingLeft),\n\t\t...getVariableValue(\"--mly-container-background-color\", theme.container?.backgroundColor),\n\t\t...getVariableValue(\"--mly-container-max-width\", theme.container?.maxWidth),\n\t\t...getVariableValue(\"--mly-container-min-width\", theme.container?.minWidth),\n\t\t...getVariableValue(\"--mly-container-padding-top\", theme.container?.paddingTop),\n\t\t...getVariableValue(\"--mly-container-padding-right\", theme.container?.paddingRight),\n\t\t...getVariableValue(\"--mly-container-padding-bottom\", theme.container?.paddingBottom),\n\t\t...getVariableValue(\"--mly-container-padding-left\", theme.container?.paddingLeft),\n\t\t...getVariableValue(\"--mly-container-border-radius\", theme.container?.borderRadius),\n\t\t...getVariableValue(\"--mly-container-border-width\", theme.container?.borderWidth),\n\t\t...getVariableValue(\"--mly-container-border-color\", theme.container?.borderColor),\n\t\t...getVariableValue(\"--mly-button-background-color\", theme.button?.backgroundColor),\n\t\t...getVariableValue(\"--mly-button-text-color\", theme.button?.color),\n\t\t...getVariableValue(\"--mly-button-padding-top\", theme.button?.paddingTop),\n\t\t...getVariableValue(\"--mly-button-padding-right\", theme.button?.paddingRight),\n\t\t...getVariableValue(\"--mly-button-padding-bottom\", theme.button?.paddingBottom),\n\t\t...getVariableValue(\"--mly-button-padding-left\", theme.button?.paddingLeft),\n\t\t...getVariableValue(\"--mly-link-color\", theme.link?.color),\n\t\t...getVariableValue(\"--mly-font-family\", font.fontFamily),\n\t\t...getVariableValue(\"--mly-font-fallback-family\", font.fallbackFontFamily),\n\t\t\"--mly-font\": `var(--mly-font-family), var(--mly-font-fallback-family)`\n\t};\n}\n\n//#endregion\n//#region src/font.ts\nfunction loadFont(font) {\n\tconst style = fontStyle(font);\n\tconst styleElement = document.createElement(\"style\");\n\tstyleElement.textContent = style;\n\tdocument.head.appendChild(styleElement);\n}\nfunction fontStyle(font) {\n\tconst { fontFamily, fallbackFontFamily, webFont } = font;\n\tconst src = webFont ? `src: url(${webFont.url}) format('${webFont.format}');` : \"\";\n\tconst style = `\n @font-face {\n font-family: '${fontFamily}';\n font-style: normal;\n font-weight: 400;\n mso-font-alt: '${fallbackFontFamily}';\n ${src}\n }`;\n\treturn style;\n}\n\n//#endregion\nexport { DEFAULT_EDITOR_THEME, DEFAULT_FONT, DEFAULT_LINK_TEXT_COLOR, DEFAULT_RENDERER_THEME, allowedFallbackFonts, allowedFontFormats, fontStyle, getMailyCssVariables, getVariableValue, loadFont };\n//# sourceMappingURL=index.mjs.map","import { JSONContent } from '@tiptap/core';\nimport { Maily } from './maily';\n\nexport class Preheader {\n constructor(private readonly maily: Maily) {}\n\n render(content: string | JSONContent): string {\n if (typeof content === 'string') {\n return content;\n }\n\n return this.renderNode(content);\n }\n\n private renderNode(node: JSONContent): string {\n const type = node.type || '';\n switch (type) {\n case 'doc':\n return this.doc(node);\n case 'paragraph':\n return this.paragraph(node);\n case 'text':\n return this.text(node);\n case 'variable':\n return this.variable(node);\n default:\n // it's fine to ignore unknown nodes\n // because we don't want to break the rendering process\n return '';\n }\n }\n\n private doc(node: JSONContent): string {\n const children = node.content || [];\n if (children.length === 0) {\n return '';\n }\n\n return children.map((child) => this.renderNode(child)).join('');\n }\n\n private paragraph(node: JSONContent): string {\n const children = node.content || [];\n if (children.length === 0) {\n return '';\n }\n\n return children.map((child) => this.renderNode(child)).join('');\n }\n\n private text(node: JSONContent): string {\n return node.text || '';\n }\n\n private variable(node: JSONContent): string {\n const { id: variable, fallback } = node.attrs || {};\n return this.maily.getVariableValue(variable, fallback);\n }\n}\n","import { Fragment, type CSSProperties } from 'react';\nimport {\n Text,\n Html,\n Head,\n Body,\n Font,\n Container,\n Link,\n Heading,\n Hr,\n Button,\n Img,\n Preview,\n Row,\n Column,\n Section,\n HtmlProps,\n} from '@react-email/components';\nimport { renderAsync as reactEmailRenderAsync } from '@react-email/render';\nimport type { JSONContent } from '@tiptap/core';\nimport { deepMerge } from '@antfu/utils';\nimport { generateKey } from './utils';\nimport type { MetaDescriptors } from './meta';\nimport { meta } from './meta';\nimport { parse } from 'node-html-parser';\nimport juice from 'juice';\nimport type {\n FontProps,\n RendererThemeOptions as ThemeOptions,\n} from '@maily-to/shared';\nimport {\n DEFAULT_RENDERER_THEME as DEFAULT_THEME,\n DEFAULT_FONT,\n DEFAULT_LINK_TEXT_COLOR,\n} from '@maily-to/shared';\nimport { Preheader } from './preheader';\n\ninterface NodeOptions {\n parent?: JSONContent;\n prev?: JSONContent;\n next?: JSONContent;\n\n payloadValue?: PayloadValue;\n}\n\nexport interface MarkType {\n [key: string]: any;\n type: string;\n attrs?: Record<string, any> | undefined;\n}\n\nconst antialiased: CSSProperties = {\n WebkitFontSmoothing: 'antialiased',\n MozOsxFontSmoothing: 'grayscale',\n};\n\nconst allowedHeadings = ['h1', 'h2', 'h3'] as const;\ntype AllowedHeadings = (typeof allowedHeadings)[number];\n\nconst headings: Record<AllowedHeadings, CSSProperties> = {\n h1: {\n fontSize: '36px',\n lineHeight: '40px',\n fontWeight: 800,\n },\n h2: {\n fontSize: '30px',\n lineHeight: '36px',\n fontWeight: 700,\n },\n h3: {\n fontSize: '24px',\n lineHeight: '38px',\n fontWeight: 600,\n },\n};\n\nconst allowedLogoSizes = ['sm', 'md', 'lg'] as const;\ntype AllowedLogoSizes = (typeof allowedLogoSizes)[number];\n\nconst logoSizes: Record<AllowedLogoSizes, string> = {\n sm: '40px',\n md: '48px',\n lg: '64px',\n};\n\nexport interface MailyConfig {\n /**\n * The preview text is the snippet of text that is pulled into the inbox\n * preview of an email client, usually right after the subject line.\n *\n * Default: `undefined`\n */\n preview?: string | JSONContent;\n /**\n * The theme object allows you to customize the colors and font sizes of the\n * rendered email.\n *\n * Default:\n * ```js\n * {\n * colors: {\n * heading: '#111827',\n * paragraph: '#374151',\n * horizontal: '#EAEAEA',\n * footer: '#64748B',\n * },\n * fontSize: {\n * paragraph: '15px',\n * footer: {\n * size: '14px',\n * lineHeight: '24px',\n * },\n * },\n * }\n * ```\n *\n * @example\n * ```js\n * const maily = new Maily(content, {\n * theme: {\n * colors: {\n * heading: '#111827',\n * },\n * fontSize: {\n * footer: {\n * size: '14px',\n * lineHeight: '24px',\n * },\n * },\n * },\n * });\n * ```\n */\n theme?: Partial<ThemeOptions>;\n}\n\nconst CODE_FONT_FAMILY =\n 'SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace';\nexport const DEFAULT_SECTION_BACKGROUND_COLOR = '#ffffff';\nexport const DEFAULT_SECTION_ALIGN = 'left';\nexport const DEFAULT_SECTION_BORDER_WIDTH = 1;\nexport const DEFAULT_SECTION_BORDER_COLOR = '#000000';\n\nexport const DEFAULT_SECTION_MARGIN_TOP = 0;\nexport const DEFAULT_SECTION_MARGIN_RIGHT = 0;\nexport const DEFAULT_SECTION_MARGIN_BOTTOM = 0;\nexport const DEFAULT_SECTION_MARGIN_LEFT = 0;\n\nexport const DEFAULT_SECTION_PADDING_TOP = 5;\nexport const DEFAULT_SECTION_PADDING_RIGHT = 5;\nexport const DEFAULT_SECTION_PADDING_BOTTOM = 5;\nexport const DEFAULT_SECTION_PADDING_LEFT = 5;\n\nexport const DEFAULT_COLUMNS_WIDTH = '100%';\nexport const DEFAULT_COLUMNS_GAP = 8;\n\nexport const DEFAULT_COLUMN_BACKGROUND_COLOR = 'transparent';\nexport const DEFAULT_COLUMN_BORDER_RADIUS = 0;\nexport const DEFAULT_COLUMN_BORDER_WIDTH = 0;\nexport const DEFAULT_COLUMN_BORDER_COLOR = 'transparent';\n\nexport const DEFAULT_COLUMN_PADDING_TOP = 0;\nexport const DEFAULT_COLUMN_PADDING_RIGHT = 0;\nexport const DEFAULT_COLUMN_PADDING_BOTTOM = 0;\nexport const DEFAULT_COLUMN_PADDING_LEFT = 0;\n\nexport const DEFAULT_INLINE_IMAGE_HEIGHT = 20;\nexport const DEFAULT_INLINE_IMAGE_WIDTH = 20;\n\nexport const LINK_PROTOCOL_REGEX = /https?:\\/\\//;\n\nexport const DEFAULT_META_TAGS: MetaDescriptors = [\n {\n name: 'viewport',\n content: 'width=device-width',\n },\n {\n httpEquiv: 'X-UA-Compatible',\n content: 'IE=edge',\n },\n {\n name: 'x-apple-disable-message-reformatting',\n },\n {\n // http://www.html-5.com/metatags/format-detection-meta-tag.html\n // It will prevent iOS from automatically detecting possible phone numbers in a block of text\n name: 'format-detection',\n content: 'telephone=no,address=no,email=no,date=no,url=no',\n },\n {\n name: 'color-scheme',\n content: 'light',\n },\n {\n name: 'supported-color-schemes',\n content: 'light',\n },\n];\n\nexport const DEFAULT_HTML_PROPS: HtmlProps = {\n lang: 'en',\n dir: 'ltr',\n};\n\nconst DEFAULT_RENDER_OPTIONS: RenderOptions = {\n pretty: false,\n plainText: false,\n};\n\nexport interface RenderOptions {\n /**\n * The options object allows you to customize the output of the rendered\n * email.\n * - `pretty` - If `true`, the output will be formatted with indentation and\n * line breaks.\n * - `plainText` - If `true`, the output will be plain text instead of HTML.\n * This is useful for testing purposes.\n *\n * Default: `pretty` - `false`, `plainText` - `false`\n */\n pretty?: boolean;\n plainText?: boolean;\n}\n\nexport type VariableFormatter = (options: {\n variable: string;\n fallback?: string;\n}) => string;\nexport type VariableValues = Map<string, string>;\nexport type LinkValues = Map<string, string>;\n\nexport type PayloadValue = Record<string, any> | boolean;\nexport type PayloadValues = Map<string, PayloadValue>;\n\nexport class Maily {\n readonly preheader = new Preheader(this);\n\n private readonly content: JSONContent;\n private config: MailyConfig = {\n theme: DEFAULT_THEME,\n };\n\n private variableFormatter: VariableFormatter = ({ variable, fallback }) => {\n return fallback\n ? `{{${variable},fallback=${fallback}}}`\n : `{{${variable}}}`;\n };\n\n private shouldReplaceVariableValues = false;\n private variableValues: VariableValues = new Map();\n private linkValues: LinkValues = new Map();\n private openTrackingPixel: string | undefined;\n private payloadValues: PayloadValues = new Map();\n private marksOrder = ['underline', 'bold', 'italic', 'textStyle', 'link'];\n private meta: MetaDescriptors = DEFAULT_META_TAGS;\n private htmlProps: HtmlProps = DEFAULT_HTML_PROPS;\n\n constructor(content: JSONContent = { type: 'doc', content: [] }) {\n this.content = content;\n }\n\n setPreviewText(preview?: string | JSONContent) {\n this.config.preview = preview;\n }\n\n setTheme(theme: Partial<ThemeOptions>) {\n this.config.theme = deepMerge(\n this.config.theme || DEFAULT_THEME,\n theme\n ) as ThemeOptions;\n }\n\n setVariableFormatter(formatter: VariableFormatter) {\n this.variableFormatter = formatter;\n }\n\n /**\n * `setVariableValue` will set the variable value.\n * It will also set `shouldReplaceVariableValues` to `true`.\n *\n * @param variable - The variable name\n * @param value - The variable value\n */\n setVariableValue(variable: string, value: string) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n this.variableValues.set(variable, value);\n }\n\n /**\n * `setVariableValues` will set the variable values.\n * It will also set `shouldReplaceVariableValues` to `true`.\n *\n * @param values - The variable values\n *\n * @example\n * ```js\n * const maily = new Maily(content);\n * maily.setVariableValues({\n * name: 'John Doe',\n * email: 'john@doe.com',\n * });\n * ```\n */\n setVariableValues(values: Record<string, string>) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n Object.entries(values).forEach(([variable, value]) => {\n this.setVariableValue(variable, value);\n });\n }\n\n setLinkValue(link: string, value: string) {\n this.linkValues.set(link, value);\n }\n\n setLinkValues(values: Record<string, string>) {\n Object.entries(values).forEach(([link, value]) => {\n this.setLinkValue(link, value);\n });\n }\n\n setPayloadValue(key: string, value: PayloadValue) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n this.payloadValues.set(key, value);\n }\n\n setPayloadValues(values: Record<string, PayloadValue>) {\n Object.entries(values).forEach(([key, value]) => {\n this.setPayloadValue(key, value);\n });\n }\n\n /**\n * `setOpenTrackingPixel` will set the open tracking pixel.\n *\n * @param pixel - The open tracking pixel\n */\n setOpenTrackingPixel(pixel?: string) {\n this.openTrackingPixel = pixel;\n }\n\n /**\n * `setShouldReplaceVariableValues` will determine whether to replace the\n * variable values or not. Otherwise, it will just return the formatted variable.\n *\n * Default: `false`\n */\n setShouldReplaceVariableValues(shouldReplace: boolean) {\n this.shouldReplaceVariableValues = shouldReplace;\n }\n\n /**\n * `setMetaTags` will add the meta tags.\n *\n * @param meta - The meta tags\n */\n setMetaTags(meta: MetaDescriptors) {\n this.meta.push(...meta);\n }\n\n /**\n * `setHtmlProps` will set the HTML props.\n *\n * @param props - The HTML props\n */\n setHtmlProps(props: HtmlProps) {\n this.htmlProps = {\n ...this.htmlProps,\n ...props,\n };\n }\n\n getAllLinks() {\n const nodes = this.content.content || [];\n const links = new Set<string>();\n\n const isValidLink = (href: string) => {\n return (\n href &&\n this.isValidUrl(href) &&\n !href.startsWith('#') &&\n !href.startsWith('mailto:') &&\n !href.startsWith('tel:') &&\n typeof href === 'string'\n );\n };\n\n const extractLinksFromNode = (node: JSONContent) => {\n if (node.type === 'button') {\n const originalLink = node.attrs?.url;\n if (isValidLink(originalLink) && originalLink) {\n links.add(originalLink);\n }\n } else if (node.content) {\n node.content.forEach((childNode) => {\n if (childNode.marks) {\n childNode.marks.forEach((mark) => {\n const originalLink = mark.attrs?.href;\n if (mark.type === 'link' && isValidLink(originalLink)) {\n links.add(originalLink);\n }\n });\n }\n if (childNode.content) {\n extractLinksFromNode(childNode);\n }\n });\n }\n };\n\n nodes.forEach((childNode) => {\n extractLinksFromNode(childNode);\n });\n\n return links;\n }\n\n private isValidUrl(href: string) {\n try {\n const _ = new URL(href);\n return true;\n } catch (err) {\n return false;\n }\n }\n\n async render(\n options: RenderOptions = DEFAULT_RENDER_OPTIONS\n ): Promise<string> {\n const markup = this.markup();\n\n return reactEmailRenderAsync(markup, options);\n }\n\n /**\n * `children` will return the children of the content.\n * this is useful for rendering the content in a custom component.\n *\n * @returns The children of the content as JSX elements\n */\n children() {\n const nodes = this.content.content || [];\n const jsxNodes = nodes.map((node, index) => {\n const nodeOptions: NodeOptions = {\n prev: nodes[index - 1],\n next: nodes[index + 1],\n parent: node,\n };\n\n const component = this.renderNode(node, nodeOptions);\n if (!component) {\n return null;\n }\n\n return <Fragment key={generateKey()}>{component}</Fragment>;\n });\n\n return jsxNodes;\n }\n\n /**\n * `markup` will render the JSON content into React Email markup.\n * and return the raw React Tree.\n */\n markup() {\n const jsxNodes = this.children();\n\n const { preview } = this.config;\n const tags = meta(this.meta);\n const htmlProps = this.htmlProps;\n const containerStyles = this.config.theme?.container;\n const fontOptions: FontProps = {\n ...(this.config.theme?.font || DEFAULT_FONT),\n fontStyle: 'normal',\n fontWeight: 400,\n };\n\n const bodyStyles: CSSProperties = {\n margin: '0px',\n ...this.config.theme?.body,\n };\n\n const preheader = preview ? this.preheader.render(preview) : null;\n\n const markup = (\n <Html {...htmlProps}>\n <Head>\n <Font {...fontOptions} />\n\n <style\n dangerouslySetInnerHTML={{\n __html: `blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}`,\n }}\n />\n {tags}\n </Head>\n <Body style={bodyStyles}>\n {preheader ? <Preview>{preheader}</Preview> : null}\n <Container\n style={{\n width: '100%',\n marginLeft: 'auto',\n marginRight: 'auto',\n borderStyle: 'solid',\n ...containerStyles,\n }}\n >\n {jsxNodes}\n </Container>\n {this.openTrackingPixel ? (\n <Img\n alt=\"\"\n src={this.openTrackingPixel}\n style={{\n display: 'none',\n width: '1px',\n height: '1px',\n }}\n />\n ) : null}\n </Body>\n </Html>\n );\n\n return markup;\n }\n\n private getMarginOverrideConditions(\n node: JSONContent,\n options?: NodeOptions\n ) {\n const { parent, prev, next } = options || {};\n\n const isNextSpacer = next?.type === 'spacer';\n const isPrevSpacer = prev?.type === 'spacer';\n\n const isParentListItem = parent?.type === 'listItem';\n\n const isLastSectionElement = parent?.type === 'section' && !next;\n const isFirstSectionElement = parent?.type === 'section' && !prev;\n\n const isLastColumnElement = parent?.type === 'column' && !next;\n const isFirstColumnElement = parent?.type === 'column' && !prev;\n\n const isFirstRepeatElement = parent?.type === 'repeat' && !prev;\n const isLastRepeatElement = parent?.type === 'repeat' && !next;\n\n const isFirstShowElement = parent?.type === 'show' && !prev;\n const isLastShowElement = parent?.type === 'show' && !next;\n\n return {\n isNextSpacer,\n isPrevSpacer,\n isLastSectionElement,\n isFirstSectionElement,\n isParentListItem,\n isLastColumnElement,\n isFirstColumnElement,\n isFirstRepeatElement,\n isLastRepeatElement,\n isFirstShowElement,\n isLastShowElement,\n\n shouldRemoveTopMargin:\n isPrevSpacer ||\n isFirstSectionElement ||\n isFirstColumnElement ||\n isFirstRepeatElement ||\n isFirstShowElement,\n shouldRemoveBottomMargin:\n isNextSpacer ||\n isLastSectionElement ||\n isLastColumnElement ||\n isLastRepeatElement ||\n isLastShowElement,\n };\n }\n\n // `getMappedContent` will call corresponding node type\n // and return text content\n private getMappedContent(\n node: JSONContent,\n options?: NodeOptions\n ): JSX.Element[] {\n const allNodes = node.content || [];\n return allNodes\n .map((childNode, index) => {\n const component = this.renderNode(childNode, {\n ...options,\n next: allNodes[index + 1],\n prev: allNodes[index - 1],\n });\n if (!component) {\n return null;\n }\n\n return <Fragment key={generateKey()}>{component}</Fragment>;\n })\n .filter((n) => n !== null) as JSX.Element[];\n }\n\n // `renderNode` will call the method of the corresponding node type\n private renderNode(\n node: JSONContent,\n options: NodeOptions = {}\n ): JSX.Element | null {\n const type = node.type || '';\n\n if (type in this) {\n // @ts-expect-error - `this` is not assignable to type 'never'\n return this[type]?.(node, options) as JSX.Element;\n }\n\n throw new Error(`Node type \"${type}\" is not supported.`);\n }\n\n // `renderMark` will call the method of the corresponding mark type\n private renderMark(node: JSONContent, options?: NodeOptions): JSX.Element {\n // It will wrap the text with the corresponding mark type\n const text = node?.text || <>&nbsp;</>;\n let marks = node?.marks || [];\n // sort the marks by uderline, bold, italic, textStyle, link\n // so that the text will be wrapped in the correct order\n marks.sort((a, b) => {\n return this.marksOrder.indexOf(a.type) - this.marksOrder.indexOf(b.type);\n });\n\n return marks.reduce(\n (acc, mark) => {\n const type = mark.type;\n if (type in this) {\n // @ts-expect-error - `this` is not assignable to type 'never'\n return this[type]?.(mark, acc) as JSX.Element;\n }\n\n throw new Error(`Mark type \"${type}\" is not supported.`);\n },\n <>{text}</>\n );\n }\n\n private paragraph(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const alignment = attrs?.textAlign || 'left';\n const { isParentListItem, shouldRemoveBottomMargin } =\n this.getMarginOverrideConditions(node, options);\n\n const show = this.shouldShow(node, options);\n if (!show) {\n return <></>;\n }\n\n const marginBottom = isParentListItem || shouldRemoveBottomMargin ? 0 : 20;\n\n return (\n <Text\n style={{\n ...(alignment !== 'left' ? { textAlign: alignment } : {}),\n ...antialiased,\n fontSize: this.config.theme?.fontSize?.paragraph?.size,\n lineHeight: this.config.theme?.fontSize?.paragraph?.lineHeight,\n color: this.config.theme?.colors?.paragraph,\n margin: `0 0 ${marginBottom}px 0`,\n }}\n >\n {node.content ? (\n this.getMappedContent(node, {\n ...options,\n parent: node,\n })\n ) : (\n <>&nbsp;</>\n )}\n </Text>\n );\n }\n\n private text(node: JSONContent, options?: NodeOptions): JSX.Element {\n if (node.marks) {\n return this.renderMark(node, options);\n }\n\n const text = node.text;\n // if it's all empty, return an invisible space length\n // of the text so that it doesn't look empty for inline-images\n const spaces = text?.match(/\\s/g);\n if (spaces && spaces.length === text?.length) {\n return (\n <>\n {spaces.map((_, index) => (\n <Fragment key={index}>&nbsp;</Fragment>\n ))}\n </>\n );\n }\n\n return text ? <>{text}</> : <>&nbsp;</>;\n }\n\n private bold(_: MarkType, text: JSX.Element): JSX.Element {\n return <strong>{text}</strong>;\n }\n\n private italic(_: MarkType, text: JSX.Element): JSX.Element {\n return <em>{text}</em>;\n }\n\n private underline(_: MarkType, text: JSX.Element): JSX.Element {\n return <u>{text}</u>;\n }\n\n private strike(_: MarkType, text: JSX.Element): JSX.Element {\n return <s style={{ textDecoration: 'line-through' }}>{text}</s>;\n }\n\n private textStyle(mark: MarkType, text: JSX.Element): JSX.Element {\n const { attrs } = mark;\n const { color = this.config.theme?.colors?.paragraph } = attrs || {};\n\n return (\n <span\n style={{\n color,\n }}\n >\n {text}\n </span>\n );\n }\n\n private link(\n mark: MarkType,\n text: JSX.Element,\n options?: NodeOptions\n ): JSX.Element {\n const { attrs } = mark;\n\n const linkTheme = this.config.theme?.link;\n\n let href = attrs?.href || '#';\n const target = attrs?.target || '_blank';\n const rel = attrs?.rel || 'noopener noreferrer nofollow';\n const isUrlVariable = attrs?.isUrlVariable ?? false;\n\n if (isUrlVariable) {\n const linkWithoutProtocol = this.removeLinkProtocol(href);\n href = this.variableUrlValue(linkWithoutProtocol, options);\n } else {\n href = this.linkValues.get(href) || href;\n }\n\n return (\n <Link\n href={href}\n rel={rel}\n style={{\n fontWeight: 500,\n textDecoration: 'none',\n color: linkTheme?.color || DEFAULT_LINK_TEXT_COLOR,\n }}\n target={target}\n >\n {text}\n </Link>\n );\n }\n\n private removeLinkProtocol(href: string) {\n return href.replace(LINK_PROTOCOL_REGEX, '');\n }\n\n private variableUrlValue(href: string, options?: NodeOptions) {\n const { payloadValue } = options || {};\n const linkWithoutProtocol = this.removeLinkProtocol(href);\n\n if (!this.shouldReplaceVariableValues) {\n return this.variableFormatter({\n variable: linkWithoutProtocol,\n });\n }\n\n return (\n (typeof payloadValue === 'object'\n ? payloadValue[linkWithoutProtocol]\n : payloadValue) ??\n this.variableValues.get(linkWithoutProtocol) ??\n href\n );\n }\n\n private heading(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const level = `h${Number(attrs?.level) || 1}`;\n const alignment = attrs?.textAlign || 'left';\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n const { fontSize, lineHeight, fontWeight } =\n headings[level as AllowedHeadings];\n\n const show = this.shouldShow(node, options);\n if (!show) {\n return <></>;\n }\n\n return (\n <Heading\n // @ts-expect-error - `this` is not assignable to type 'never'\n as={level}\n style={{\n textAlign: alignment,\n color: this.config.theme?.colors?.heading,\n fontSize,\n lineHeight,\n fontWeight,\n }}\n mb={shouldRemoveBottomMargin ? 0 : 12}\n mt={0}\n mx={0}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Heading>\n );\n }\n\n private variable(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { payloadValue } = options || {};\n const { id: variable, fallback } = node.attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow || !variable) {\n return <></>;\n }\n\n const formattedVariable = this.getVariableValue(\n variable,\n fallback,\n options\n );\n\n if (node?.marks) {\n return this.renderMark(\n {\n text: formattedVariable,\n marks: node.marks,\n },\n options\n );\n }\n\n return <>{formattedVariable}</>;\n }\n\n getVariableValue(variable: string, fallback?: string, options?: NodeOptions) {\n const { payloadValue } = options || {};\n\n let formattedVariable = this.variableFormatter({\n variable,\n fallback,\n });\n\n // If `shouldReplaceVariableValues` is true, replace the variable values\n // Otherwise, just return the formatted variable\n if (this.shouldReplaceVariableValues) {\n formattedVariable =\n (typeof payloadValue === 'object'\n ? payloadValue[variable]\n : payloadValue) ??\n this.variableValues.get(variable) ??\n fallback ??\n formattedVariable;\n }\n\n return formattedVariable;\n }\n\n private horizontalRule(_: JSONContent, __?: NodeOptions): JSX.Element {\n return (\n <Hr\n style={{\n marginTop: '32px',\n marginBottom: '32px',\n }}\n />\n );\n }\n\n private orderedList(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Container\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0' : '20px',\n }}\n >\n <ol\n style={{\n paddingLeft: '26px',\n listStyleType: 'decimal',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </ol>\n </Container>\n );\n }\n\n private bulletList(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { parent, next } = options || {};\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n {\n parent,\n next,\n }\n );\n\n return (\n <Container\n style={{\n maxWidth: '100%',\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0' : '20px',\n }}\n >\n <ul\n style={{\n paddingLeft: '26px',\n listStyleType: 'disc',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </ul>\n </Container>\n );\n }\n\n private listItem(node: JSONContent, options?: NodeOptions): JSX.Element {\n return (\n <li\n style={{\n marginBottom: '8px',\n marginTop: '8px',\n paddingLeft: '6px',\n ...antialiased,\n }}\n >\n {this.getMappedContent(node, { ...options, parent: node })}\n </li>\n );\n }\n\n private button(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const buttonTheme = this.config.theme?.button;\n\n let {\n text: _text,\n isTextVariable,\n url,\n isUrlVariable,\n variant,\n buttonColor: _buttonColor,\n textColor: _textColor,\n borderRadius,\n // @TODO: Update the attribute to `textAlign`\n alignment = 'left',\n\n paddingTop: _paddingTop,\n paddingRight: _paddingRight,\n paddingBottom: _paddingBottom,\n paddingLeft: _paddingLeft,\n } = attrs || {};\n\n const buttonColor = _buttonColor || buttonTheme?.backgroundColor;\n const textColor = _textColor || buttonTheme?.color;\n\n let paddingTop =\n parseInt(String(_paddingTop || buttonTheme?.paddingTop)) || 0;\n const paddingRight =\n parseInt(String(_paddingRight || buttonTheme?.paddingRight)) || 0;\n let paddingBottom =\n parseInt(String(_paddingBottom || buttonTheme?.paddingBottom)) || 0;\n const paddingLeft =\n parseInt(String(_paddingLeft || buttonTheme?.paddingLeft)) || 0;\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n let radius: string | undefined = '0px';\n if (borderRadius === 'round') {\n radius = '9999px';\n } else if (borderRadius === 'smooth') {\n radius = '6px';\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const href = isUrlVariable\n ? this.variableUrlValue(url, options)\n : this.linkValues.get(url) || url;\n const text = isTextVariable ? this.variableUrlValue(_text, options) : _text;\n\n paddingTop += 2;\n paddingBottom += 2;\n\n return (\n <Container\n style={{\n textAlign: alignment,\n maxWidth: '100%',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n >\n <Button\n href={href}\n style={{\n color: String(textColor),\n backgroundColor:\n variant === 'filled' ? String(buttonColor) : 'transparent',\n borderColor: String(buttonColor),\n borderWidth: '2px',\n borderStyle: 'solid',\n textDecoration: 'none',\n fontSize: '14px',\n fontWeight: 500,\n borderRadius: radius,\n padding: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,\n }}\n >\n {text}\n </Button>\n </Container>\n );\n }\n\n private spacer(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { height } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n return (\n <Container\n style={{\n height: `${height}px`,\n }}\n />\n );\n }\n\n private hardBreak(_: JSONContent, __?: NodeOptions): JSX.Element {\n return <br />;\n }\n\n private logo(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n let {\n src,\n isSrcVariable,\n alt,\n title,\n size,\n // @TODO: Update the attribute to `textAlign`\n alignment = 'left',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n src = isSrcVariable ? this.variableUrlValue(src, options) : src;\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Row\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '32px',\n }}\n >\n <Column align={alignment}>\n <Img\n alt={alt || title || 'Logo'}\n src={src}\n style={{\n width: logoSizes[size as AllowedLogoSizes] || size,\n height: logoSizes[size as AllowedLogoSizes] || size,\n }}\n title={title || alt || 'Logo'}\n />\n </Column>\n </Row>\n );\n }\n\n private image(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n let {\n src,\n isSrcVariable,\n alt,\n title,\n width = 'auto',\n height = 'auto',\n alignment = 'center',\n externalLink = '',\n isExternalLinkVariable,\n borderRadius = 0,\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n src = isSrcVariable ? this.variableUrlValue(src, options) : src;\n externalLink = isExternalLinkVariable\n ? this.variableUrlValue(externalLink, options)\n : externalLink;\n\n // Handle width value\n const imageWidth = width === 'auto' ? 'auto' : Number(width);\n const widthStyle = imageWidth === 'auto' ? 'auto' : `${imageWidth}px`;\n\n // Handle height value\n const imageHeight = height === 'auto' ? 'auto' : Number(height);\n const heightStyle = imageHeight === 'auto' ? 'auto' : `${imageHeight}px`;\n\n const mainImage = (\n <Img\n alt={alt || title || 'Image'}\n src={src}\n style={{\n width: widthStyle, // Use the calculated width\n height: heightStyle, // Use the calculated height\n maxWidth: '100%', // Ensure image doesn't overflow container\n outline: 'none',\n border: 'none',\n textDecoration: 'none',\n display: 'block', // Prevent unwanted spacing\n borderRadius,\n }}\n title={title || alt || 'Image'}\n />\n );\n\n return (\n <Row\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '32px',\n }}\n >\n <Column align={alignment}>\n {externalLink ? (\n <a\n href={externalLink}\n rel=\"noopener noreferrer\"\n style={{\n display: 'block',\n maxWidth: '100%',\n textDecoration: 'none',\n }}\n target=\"_blank\"\n >\n {mainImage}\n </a>\n ) : (\n mainImage\n )}\n </Column>\n </Row>\n );\n }\n\n private footer(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { textAlign = 'left' } = attrs || {};\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Text\n style={{\n fontSize: this.config.theme?.fontSize?.footer?.size,\n lineHeight: this.config.theme?.fontSize?.footer?.lineHeight,\n color: this.config.theme?.colors?.footer,\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n textAlign,\n ...antialiased,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Text>\n );\n }\n\n private blockquote(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { isPrevSpacer, shouldRemoveBottomMargin } =\n this.getMarginOverrideConditions(node, options);\n\n return (\n <blockquote\n style={{\n borderLeftWidth: '4px',\n borderLeftStyle: 'solid',\n borderLeftColor: this.config.theme?.colors?.blockquoteBorder,\n paddingLeft: '16px',\n marginLeft: '0px',\n marginRight: '0px',\n marginTop: isPrevSpacer ? '0px' : '20px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </blockquote>\n );\n }\n private code(_: MarkType, text: JSX.Element): JSX.Element {\n return (\n <code\n style={{\n backgroundColor: this.config.theme?.colors?.codeBackground,\n color: this.config.theme?.colors?.codeText,\n padding: '2px 4px',\n borderRadius: '6px',\n fontFamily: CODE_FONT_FAMILY,\n fontWeight: 400,\n letterSpacing: 0,\n }}\n >\n {text}\n </code>\n );\n }\n private linkCard(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const { title, description, link, linkTitle, image, badgeText, subTitle } =\n attrs || {};\n const href =\n this.linkValues.get(link) || this.variableValues.get(link) || link || '#';\n\n return (\n <a\n href={href}\n rel=\"noopener noreferrer\"\n style={{\n border: '1px solid #eaeaea',\n borderRadius: '10px',\n textDecoration: 'none',\n color: 'inherit',\n display: 'block',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n target=\"_blank\"\n >\n {image ? (\n <Row\n style={{\n marginBottom: '6px',\n }}\n >\n <Column\n style={{\n width: '100%',\n height: '100%',\n }}\n >\n <Img\n alt={title || 'Link Card'}\n src={image}\n style={{\n borderRadius: '10px 10px 0 0',\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n }}\n title={title || 'Link Card'}\n />\n </Column>\n </Row>\n ) : null}\n\n <Row\n style={{\n padding: '15px',\n marginTop: 0,\n marginBottom: 0,\n }}\n >\n <Column\n style={{\n verticalAlign: 'top',\n }}\n >\n <Row\n align={undefined}\n style={{\n marginBottom: '8px',\n marginTop: '0px',\n }}\n width=\"auto\"\n >\n <Column>\n <Text\n style={{\n fontSize: '18px',\n fontWeight: 600,\n color: this.config.theme?.colors?.linkCardTitle,\n margin: '0px',\n ...antialiased,\n }}\n >\n {title}\n </Text>\n </Column>\n {badgeText || subTitle ? (\n <Column\n style={{\n paddingLeft: '6px',\n verticalAlign: 'middle',\n }}\n >\n {badgeText ? (\n <span\n style={{\n fontWeight: 600,\n color: this.config.theme?.colors?.linkCardBadgeText,\n padding: '4px 8px',\n borderRadius: '8px',\n backgroundColor:\n this.config.theme?.colors?.linkCardBadgeBackground,\n fontSize: '12px',\n lineHeight: '12px',\n }}\n >\n {badgeText}\n </span>\n ) : null}{' '}\n {subTitle && !badgeText ? (\n <span\n style={{\n fontWeight: 'normal',\n color: this.config.theme?.colors?.linkCardSubTitle,\n fontSize: '12px',\n lineHeight: '12px',\n }}\n >\n {subTitle}\n </span>\n ) : null}\n </Column>\n ) : null}\n </Row>\n <Text\n style={{\n fontSize: '16px',\n color: this.config.theme?.colors?.linkCardDescription,\n marginTop: '0px',\n marginBottom: '0px',\n ...antialiased,\n }}\n >\n {description}{' '}\n {linkTitle ? (\n <a\n href={href}\n rel=\"noopener noreferrer\"\n style={{\n color: this.config.theme?.colors?.linkCardTitle,\n fontSize: '14px',\n fontWeight: 600,\n textDecoration: 'underline',\n }}\n >\n {linkTitle}\n </a>\n ) : null}\n </Text>\n </Column>\n </Row>\n </a>\n );\n }\n\n private section(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n borderRadius = 0,\n backgroundColor = DEFAULT_SECTION_BACKGROUND_COLOR,\n align = DEFAULT_SECTION_ALIGN,\n borderWidth = DEFAULT_SECTION_BORDER_WIDTH,\n borderColor = DEFAULT_SECTION_BORDER_COLOR,\n\n marginTop = DEFAULT_SECTION_MARGIN_TOP,\n marginRight = DEFAULT_SECTION_MARGIN_RIGHT,\n marginBottom = DEFAULT_SECTION_MARGIN_BOTTOM,\n marginLeft = DEFAULT_SECTION_MARGIN_LEFT,\n\n paddingTop = DEFAULT_SECTION_PADDING_TOP,\n paddingRight = DEFAULT_SECTION_PADDING_RIGHT,\n paddingBottom = DEFAULT_SECTION_PADDING_BOTTOM,\n paddingLeft = DEFAULT_SECTION_PADDING_LEFT,\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n return (\n <Row\n style={{\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n }}\n >\n <Column\n align={align}\n style={{\n borderColor,\n borderWidth,\n borderStyle: 'solid',\n backgroundColor,\n borderRadius,\n\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Column>\n </Row>\n );\n }\n\n private columns(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const [newNode, totalWidth] = this.adjustColumnsContent(node);\n\n return (\n <Row\n width={`${totalWidth}%`}\n style={{\n margin: 0,\n padding: 0,\n width: `${totalWidth}%`,\n }}\n className=\"tab-row-full\"\n >\n {this.getMappedContent(newNode, {\n ...options,\n parent: newNode,\n })}\n </Row>\n );\n }\n\n private adjustColumnsContent(node: JSONContent): [JSONContent, number] {\n const { content = [] } = node;\n const totalWidth = 100;\n const columnsWithWidth = content.filter(\n (c) => c.type === 'column' && Boolean(Number(c.attrs?.width || 0))\n );\n const autoWidthColumns = content.filter(\n (c) =>\n c.type === 'column' && (c.attrs?.width === 'auto' || !c.attrs?.width)\n );\n\n const totalWidthUsed = columnsWithWidth.reduce(\n (acc, c) => acc + Number(c.attrs?.width),\n 0\n );\n\n const remainingWidth = totalWidth - totalWidthUsed;\n const measuredWidth = Math.round(remainingWidth / autoWidthColumns.length);\n\n const columnCount = content.filter((c) => c.type === 'column').length;\n const gap = node.attrs?.gap ?? DEFAULT_COLUMNS_GAP;\n\n return [\n {\n ...node,\n content: content.map((c, index) => {\n const isAutoWidthColumn =\n c.type === 'column' &&\n (c.attrs?.width === 'auto' || !c.attrs?.width);\n const isFirstColumn = index === 0;\n const isMiddleColumn = index > 0 && index < columnCount - 1;\n const isLastColumn = index === content.length - 1;\n\n let paddingLeft = 0;\n let paddingRight = 0;\n\n // For 2 columns, apply a simple gap logic\n if (columnCount < 3) {\n paddingLeft = isFirstColumn ? 0 : gap / 2;\n paddingRight = isLastColumn ? 0 : gap / 2;\n } else {\n // For more than 2 columns, apply more gap in the first and last columns\n // and less gap in the middle columns to make it look more balanced\n // because the first and last columns have more space to fill\n const leftAndRightPadding = (gap / 2) * 1.5;\n const middleColumnPadding = leftAndRightPadding / 2;\n\n paddingLeft = isFirstColumn\n ? 0\n : isMiddleColumn\n ? middleColumnPadding\n : leftAndRightPadding;\n paddingRight = isLastColumn\n ? 0\n : isMiddleColumn\n ? middleColumnPadding\n : leftAndRightPadding;\n }\n\n paddingLeft = Math.round(paddingLeft * 100) / 100;\n paddingRight = Math.round(paddingRight * 100) / 100;\n\n return {\n ...c,\n attrs: {\n ...c.attrs,\n width: isAutoWidthColumn ? measuredWidth : c.attrs?.width,\n\n isFirstColumn,\n isLastColumn,\n index,\n\n paddingLeft,\n paddingRight,\n },\n };\n }),\n },\n autoWidthColumns.length === 0\n ? Math.min(totalWidth, totalWidthUsed)\n : totalWidth,\n ];\n }\n\n private column(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n width,\n verticalAlign = 'top',\n paddingLeft = 0,\n paddingRight = 0,\n } = attrs || {};\n\n return (\n <Column\n width={`${Number(width)}%`}\n style={{\n width: `${Number(width)}%`,\n margin: 0,\n verticalAlign,\n }}\n className=\"tab-col-full\"\n >\n <Section\n style={{\n margin: 0,\n paddingLeft,\n paddingRight,\n }}\n className=\"tab-pad\"\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Section>\n </Column>\n );\n }\n\n private repeat(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { each = '' } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n let { payloadValue } = options || {};\n payloadValue = typeof payloadValue === 'object' ? payloadValue : {};\n\n const values = this.payloadValues.get(each) ?? payloadValue[each] ?? [];\n if (!Array.isArray(values)) {\n throw new Error(`Payload value for each \"${each}\" is not an array`);\n }\n\n return (\n <>\n {values.map((value) => {\n return (\n <Fragment key={generateKey()}>\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n payloadValue: value,\n })}\n </Fragment>\n );\n })}\n </>\n );\n }\n\n /**\n * @deprecated\n * This for node is an alias for the repeat node\n * we will remove this in the future\n * @param node\n * @param options\n * @returns JSX.Element\n */\n private for(node: JSONContent, options?: NodeOptions): JSX.Element {\n return this.repeat(node, options);\n }\n\n private shouldShow(node: JSONContent, options?: NodeOptions): boolean {\n const showIfKey = node?.attrs?.showIfKey ?? '';\n if (!showIfKey) {\n return true;\n }\n\n let { payloadValue } = options || {};\n payloadValue = typeof payloadValue === 'object' ? payloadValue : {};\n return !!(this.payloadValues.get(showIfKey) ?? payloadValue[showIfKey]);\n }\n\n htmlCodeBlock(node: JSONContent, options?: NodeOptions): JSX.Element {\n const show = this.shouldShow(node, options);\n if (!show) {\n return <></>;\n }\n\n // the text can be a proper html code block\n // or only the body of the html\n // so we need to wrap it in a proper html tag\n const text =\n node.content?.reduce((acc, n) => {\n if (n?.type === 'text') {\n return acc + n?.text;\n } else if (n?.type === 'variable') {\n const value = this.getVariableValue(\n n?.attrs?.id,\n n?.attrs?.fallback,\n options\n );\n return acc + value;\n }\n\n return acc;\n }, '') || '';\n\n // we will inline the css in the html\n // so that it can be rendered properly\n const inlineCssHtml = juice(text);\n const doc = parse(inlineCssHtml);\n const head = doc?.querySelector('head');\n head?.remove();\n const html = doc.toString();\n\n return (\n <table\n align=\"left\"\n width=\"100%\"\n border={0}\n cellPadding=\"0\"\n cellSpacing=\"0\"\n role=\"presentation\"\n >\n <tbody>\n <tr style={{ width: '100%' }}>\n <td\n style={{ width: '100%' }}\n dangerouslySetInnerHTML={{\n __html: html,\n }}\n />\n </tr>\n </tbody>\n </table>\n );\n }\n\n private inlineImage(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n let {\n src,\n isSrcVariable,\n alt = '',\n title = '',\n height = DEFAULT_INLINE_IMAGE_HEIGHT,\n width = DEFAULT_INLINE_IMAGE_WIDTH,\n externalLink = '',\n isExternalLinkVariable,\n } = attrs || {};\n\n src = isSrcVariable ? this.variableUrlValue(src, options) : src;\n externalLink = isExternalLinkVariable\n ? this.variableUrlValue(externalLink, options)\n : externalLink;\n\n const image = (\n <img\n src={src}\n alt={alt}\n title={title}\n width={width}\n height={height}\n style={{\n display: 'inline',\n verticalAlign: 'middle',\n width: `${width}px`,\n height: `${height}px`,\n outline: 'none',\n border: 'none',\n textDecoration: 'none',\n }}\n />\n );\n\n if (!externalLink) {\n return image;\n }\n\n return (\n <a\n href={externalLink}\n rel=\"noopener noreferrer\"\n style={{\n display: 'inline',\n textDecoration: 'none',\n }}\n target=\"_blank\"\n >\n {image}\n </a>\n );\n }\n}\n","import type { JSONContent } from '@tiptap/core';\nimport { Maily } from './maily';\nimport type { MailyConfig, RenderOptions } from './maily';\n\nexport async function render(\n content: JSONContent,\n config?: MailyConfig & RenderOptions\n): Promise<string> {\n const { theme, preview, ...rest } = config || {};\n\n const maily = new Maily(content);\n maily.setPreviewText(preview);\n maily.setTheme(theme || {});\n\n return maily.render(rest);\n}\n"],"x_google_ignoreList":[0],"mappings":"0ZAoLA,MA9DM,EAAW,AAAC,GAAM,OAAO,UAAU,SAAS,KAAK,EAAE,CA8DnD,EAAW,AAAC,GAAQ,EAAS,EAAI,GAAK,kBA6E5C,SAAS,EAAW,EAAK,CACvB,MAAO,QAAO,KAAK,EAAI,AACxB,CAID,SAAS,EAAU,EAAQ,GAAG,EAAS,CACrC,IAAK,EAAQ,OACX,OAAO,EACT,IAAM,EAAS,EAAQ,OAAO,CAoB9B,OAnBI,QAAgB,GACX,GACL,EAAiB,EAAO,EAAI,EAAiB,EAAO,EACtD,EAAW,EAAO,CAAC,QAAQ,AAAC,GAAQ,CAC9B,IAAQ,aAAe,IAAQ,eAAiB,IAAQ,cAExD,EAAiB,EAAO,GAAK,EAC1B,EAAO,KACV,EAAO,GAAO,CAAE,GACd,EAAiB,EAAO,GAAK,CAC/B,EAAU,EAAO,GAAM,EAAO,GAAK,CAEnC,EAAO,GAAO,EAAO,IAGvB,EAAO,GAAO,EAAO,GAExB,EAAC,CAEG,EAAU,EAAQ,GAAG,EAAQ,CACrC,CA4BD,SAAS,EAAiB,EAAM,CAC9B,MAAO,GAAS,EAAK,GAAK,MAAM,QAAQ,EAAK,AAC9C,CA4MD,MAAM,GAAO,OAAO,SAAS,CCzgB7B,SAAgB,GAAc,CAG5B,MAAO,MAAK,QAAQ,CAAC,SAAS,GAAG,CAAC,OAAO,EAAG,EAAE,AAC/C,CCyBD,SAAgB,EAAK2B,EAAuB,CAC1C,MACE,GAGG,OAAO,CAACC,EAA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AAG,EACd,CACF,MACA,gBACA,MAAM,GACN,QAAQ,GACR,SAAS,EACT,QAAQ,EACR,eAAe,GACf,yBACD,CAAG,GAAS,CAAE,EAGf,AADA,EAAM,EAAgB,KAAK,iBAAiB,EAAK,EAAQ,CAAG,EAC5D,EAAe,EACX,KAAK,iBAAiB,EAAc,EAAQ,CAC5C,EAEJ,IAAM,EACJ,EAAC,MAAA,CACM,MACA,MACE,QACA,QACC,SACR,MAAO,CACL,QAAS,SACT,cAAe,SACf,OAAQ,EAAE,EAAM,IAChB,QAAS,EAAE,EAAO,IAClB,QAAS,OACT,OAAQ,OACR,eAAgB,MACjB,GACD,CAOJ,OAJK,EAKH,EAAC,IAAA,CACC,KAAM,EACN,IAAI,sBACJ,MAAO,CACL,QAAS,SACT,eAAgB,MACjB,EACD,OAAO,kBAEN,GACC,CAdG,CAgBV,CACF,ECxxDD,eAAsB,GACpBS,EACAC,EACiB,CAGjB,GAFM,CAAE,QAAO,UAAS,GAAG,EAAM,CAAG,GAAU,CAAE,EAE1C,EAAQ,IAAI,GAAM,GAIxB,MAHA,GAAM,eAAe,EAAQ,CAC7B,EAAM,SAAS,GAAS,CAAE,EAAC,CAEpB,EAAM,OAAO,EAAK,AAC1B"}
1
+ {"version":3,"file":"index.mjs","names":["meta: MetaDescriptors","meta","props: MetaDescriptor","meta: MetaDescriptor","maily: Maily","content: string | JSONContent","node: JSONContent","antialiased: CSSProperties","headings: Record<AllowedHeadings, CSSProperties>","logoSizes: Record<AllowedLogoSizes, string>","DEFAULT_META_TAGS: MetaDescriptors","DEFAULT_HTML_PROPS: HtmlProps","DEFAULT_RENDER_OPTIONS: RenderOptions","DEFAULT_THEME","content: JSONContent","preview?: string | JSONContent","theme: Partial<ThemeOptions>","formatter: VariableFormatter","variable: string","value: string","values: Record<string, string>","link: string","key: string","value: PayloadValue","values: Record<string, PayloadValue>","pixel?: string","shouldReplace: boolean","meta: MetaDescriptors","meta","props: HtmlProps","href: string","node: JSONContent","options: RenderOptions","nodeOptions: NodeOptions","fontOptions: FontProps","bodyStyles: CSSProperties","options?: NodeOptions","options: NodeOptions","_: MarkType","text: JSX.Element","mark: MarkType","fallback?: string","_: JSONContent","__?: NodeOptions","radius: string | undefined","content: JSONContent","config?: MailyConfig & RenderOptions"],"sources":["../../../node_modules/.pnpm/@antfu+utils@9.2.0/node_modules/@antfu/utils/dist/index.mjs","../src/utils.ts","../src/meta.tsx","../../shared/dist/index.mjs","../src/preheader.ts","../src/maily.tsx","../src/render.ts"],"sourcesContent":["function clamp(n, min, max) {\n return Math.min(max, Math.max(min, n));\n}\nfunction sum(...args) {\n return flattenArrayable(args).reduce((a, b) => a + b, 0);\n}\nfunction lerp(min, max, t) {\n const interpolation = clamp(t, 0, 1);\n return min + (max - min) * interpolation;\n}\nfunction remap(n, inMin, inMax, outMin, outMax) {\n const interpolation = (n - inMin) / (inMax - inMin);\n return lerp(outMin, outMax, interpolation);\n}\n\nfunction toArray(array) {\n array = array ?? [];\n return Array.isArray(array) ? array : [array];\n}\nfunction flattenArrayable(array) {\n return toArray(array).flat(1);\n}\nfunction mergeArrayable(...args) {\n return args.flatMap((i) => toArray(i));\n}\nfunction partition(array, ...filters) {\n const result = Array.from({ length: filters.length + 1 }).fill(null).map(() => []);\n array.forEach((e, idx, arr) => {\n let i = 0;\n for (const filter of filters) {\n if (filter(e, idx, arr)) {\n result[i].push(e);\n return;\n }\n i += 1;\n }\n result[i].push(e);\n });\n return result;\n}\nfunction uniq(array) {\n return Array.from(new Set(array));\n}\nfunction uniqueBy(array, equalFn) {\n return array.reduce((acc, cur) => {\n const index = acc.findIndex((item) => equalFn(cur, item));\n if (index === -1)\n acc.push(cur);\n return acc;\n }, []);\n}\nfunction last(array) {\n return at(array, -1);\n}\nfunction remove(array, value) {\n if (!array)\n return false;\n const index = array.indexOf(value);\n if (index >= 0) {\n array.splice(index, 1);\n return true;\n }\n return false;\n}\nfunction at(array, index) {\n const len = array.length;\n if (!len)\n return void 0;\n if (index < 0)\n index += len;\n return array[index];\n}\nfunction range(...args) {\n let start, stop, step;\n if (args.length === 1) {\n start = 0;\n step = 1;\n [stop] = args;\n } else {\n [start, stop, step = 1] = args;\n }\n const arr = [];\n let current = start;\n while (current < stop) {\n arr.push(current);\n current += step || 1;\n }\n return arr;\n}\nfunction move(arr, from, to) {\n arr.splice(to, 0, arr.splice(from, 1)[0]);\n return arr;\n}\nfunction clampArrayRange(n, arr) {\n return clamp(n, 0, arr.length - 1);\n}\nfunction sample(arr, quantity) {\n return Array.from({ length: quantity }, (_) => arr[Math.round(Math.random() * (arr.length - 1))]);\n}\nfunction shuffle(array) {\n for (let i = array.length - 1; i > 0; i--) {\n const j = Math.floor(Math.random() * (i + 1));\n [array[i], array[j]] = [array[j], array[i]];\n }\n return array;\n}\nfunction filterInPlace(array, predicate) {\n for (let i = array.length; i--; i >= 0) {\n if (!predicate(array[i], i, array))\n array.splice(i, 1);\n }\n return array;\n}\n\nfunction assert(condition, message) {\n if (!condition)\n throw new Error(message);\n}\nconst toString = (v) => Object.prototype.toString.call(v);\nfunction getTypeName(v) {\n if (v === null)\n return \"null\";\n const type = toString(v).slice(8, -1).toLowerCase();\n return typeof v === \"object\" || typeof v === \"function\" ? type : typeof v;\n}\nfunction noop() {\n}\n\nfunction isDeepEqual(value1, value2) {\n const type1 = getTypeName(value1);\n const type2 = getTypeName(value2);\n if (type1 !== type2)\n return false;\n if (type1 === \"array\") {\n if (value1.length !== value2.length)\n return false;\n return value1.every((item, i) => {\n return isDeepEqual(item, value2[i]);\n });\n }\n if (type1 === \"object\") {\n const keyArr = Object.keys(value1);\n if (keyArr.length !== Object.keys(value2).length)\n return false;\n return keyArr.every((key) => {\n return isDeepEqual(value1[key], value2[key]);\n });\n }\n return Object.is(value1, value2);\n}\n\nfunction batchInvoke(functions) {\n functions.forEach((fn) => fn && fn());\n}\nfunction invoke(fn) {\n return fn();\n}\nfunction tap(value, callback) {\n callback(value);\n return value;\n}\n\nfunction notNullish(v) {\n return v != null;\n}\nfunction noNull(v) {\n return v !== null;\n}\nfunction notUndefined(v) {\n return v !== void 0;\n}\nfunction isTruthy(v) {\n return Boolean(v);\n}\n\nconst isDef = (val) => typeof val !== \"undefined\";\nconst isBoolean = (val) => typeof val === \"boolean\";\nconst isFunction = (val) => typeof val === \"function\";\nconst isNumber = (val) => typeof val === \"number\";\nconst isString = (val) => typeof val === \"string\";\nconst isObject = (val) => toString(val) === \"[object Object]\";\nconst isUndefined = (val) => toString(val) === \"[object Undefined]\";\nconst isNull = (val) => toString(val) === \"[object Null]\";\nconst isRegExp = (val) => toString(val) === \"[object RegExp]\";\nconst isDate = (val) => toString(val) === \"[object Date]\";\nfunction isPrimitive(val) {\n return !val || Object(val) !== val;\n}\nconst isWindow = (val) => typeof window !== \"undefined\" && toString(val) === \"[object Window]\";\nconst isBrowser = typeof window !== \"undefined\";\n\nfunction slash(str) {\n return str.replace(/\\\\/g, \"/\");\n}\nfunction ensurePrefix(prefix, str) {\n if (!str.startsWith(prefix))\n return prefix + str;\n return str;\n}\nfunction ensureSuffix(suffix, str) {\n if (!str.endsWith(suffix))\n return str + suffix;\n return str;\n}\nfunction template(str, ...args) {\n const [firstArg, fallback] = args;\n if (isObject(firstArg)) {\n const vars = firstArg;\n return str.replace(/\\{(\\w+)\\}/g, (_, key) => vars[key] || ((typeof fallback === \"function\" ? fallback(key) : fallback) ?? key));\n } else {\n return str.replace(/\\{(\\d+)\\}/g, (_, key) => {\n const index = Number(key);\n if (Number.isNaN(index))\n return key;\n return args[index];\n });\n }\n}\nconst urlAlphabet = \"useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict\";\nfunction randomStr(size = 16, dict = urlAlphabet) {\n let id = \"\";\n let i = size;\n const len = dict.length;\n while (i--)\n id += dict[Math.random() * len | 0];\n return id;\n}\nfunction capitalize(str) {\n return str[0].toUpperCase() + str.slice(1).toLowerCase();\n}\nconst _reFullWs = /^\\s*$/;\nfunction unindent(str) {\n const lines = (typeof str === \"string\" ? str : str[0]).split(\"\\n\");\n const whitespaceLines = lines.map((line) => _reFullWs.test(line));\n const commonIndent = lines.reduce((min, line, idx) => {\n if (whitespaceLines[idx])\n return min;\n const indent = line.match(/^\\s*/)?.[0].length;\n return indent === void 0 ? min : Math.min(min, indent);\n }, Number.POSITIVE_INFINITY);\n let emptyLinesHead = 0;\n while (emptyLinesHead < lines.length && whitespaceLines[emptyLinesHead])\n emptyLinesHead++;\n let emptyLinesTail = 0;\n while (emptyLinesTail < lines.length && whitespaceLines[lines.length - emptyLinesTail - 1])\n emptyLinesTail++;\n return lines.slice(emptyLinesHead, lines.length - emptyLinesTail).map((line) => line.slice(commonIndent)).join(\"\\n\");\n}\n\nfunction objectMap(obj, fn) {\n return Object.fromEntries(\n Object.entries(obj).map(([k, v]) => fn(k, v)).filter(notNullish)\n );\n}\nfunction isKeyOf(obj, k) {\n return k in obj;\n}\nfunction objectKeys(obj) {\n return Object.keys(obj);\n}\nfunction objectEntries(obj) {\n return Object.entries(obj);\n}\nfunction deepMerge(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n if (isMergableObject(target[key])) {\n deepMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMerge(target, ...sources);\n}\nfunction deepMergeWithArray(target, ...sources) {\n if (!sources.length)\n return target;\n const source = sources.shift();\n if (source === void 0)\n return target;\n if (Array.isArray(target) && Array.isArray(source))\n target.push(...source);\n if (isMergableObject(target) && isMergableObject(source)) {\n objectKeys(source).forEach((key) => {\n if (key === \"__proto__\" || key === \"constructor\" || key === \"prototype\")\n return;\n if (Array.isArray(source[key])) {\n if (!target[key])\n target[key] = [];\n deepMergeWithArray(target[key], source[key]);\n } else if (isMergableObject(source[key])) {\n if (!target[key])\n target[key] = {};\n deepMergeWithArray(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n });\n }\n return deepMergeWithArray(target, ...sources);\n}\nfunction isMergableObject(item) {\n return isObject(item) && !Array.isArray(item);\n}\nfunction objectPick(obj, keys, omitUndefined = false) {\n return keys.reduce((n, k) => {\n if (k in obj) {\n if (!omitUndefined || obj[k] !== void 0)\n n[k] = obj[k];\n }\n return n;\n }, {});\n}\nfunction clearUndefined(obj) {\n Object.keys(obj).forEach((key) => obj[key] === void 0 ? delete obj[key] : {});\n return obj;\n}\nfunction hasOwnProperty(obj, v) {\n if (obj == null)\n return false;\n return Object.prototype.hasOwnProperty.call(obj, v);\n}\nconst _objectIdMap = /* @__PURE__ */ new WeakMap();\nfunction objectId(obj) {\n if (isPrimitive(obj))\n return obj;\n if (!_objectIdMap.has(obj)) {\n _objectIdMap.set(obj, randomStr());\n }\n return _objectIdMap.get(obj);\n}\n\n/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nclass Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tpeek() {\n\t\tif (!this.#head) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.#head.value;\n\n\t\t// TODO: Node.js 18.\n\t\t// return this.#head?.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n}\n\nfunction pLimit(concurrency) {\n\tvalidateConcurrency(concurrency);\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst resumeNext = () => {\n\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t\t// Since `pendingCount` has been decreased by one, increase `activeCount` by one.\n\t\t\tactiveCount++;\n\t\t}\n\t};\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tresumeNext();\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, arguments_) => {\n\t\t// Queue `internalResolve` instead of the `run` function\n\t\t// to preserve asynchronous context.\n\t\tnew Promise(internalResolve => {\n\t\t\tqueue.enqueue(internalResolve);\n\t\t}).then(\n\t\t\trun.bind(undefined, function_, resolve, arguments_),\n\t\t);\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// after the `internalResolve` function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency) {\n\t\t\t\tresumeNext();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise(resolve => {\n\t\tenqueue(function_, resolve, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t\tconcurrency: {\n\t\t\tget: () => concurrency,\n\n\t\t\tset(newConcurrency) {\n\t\t\t\tvalidateConcurrency(newConcurrency);\n\t\t\t\tconcurrency = newConcurrency;\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t// eslint-disable-next-line no-unmodified-loop-condition\n\t\t\t\t\twhile (activeCount < concurrency && queue.size > 0) {\n\t\t\t\t\t\tresumeNext();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nfunction validateConcurrency(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n}\n\nconst VOID = Symbol(\"p-void\");\nclass PInstance extends Promise {\n constructor(items = [], options) {\n super(() => {\n });\n this.items = items;\n this.options = options;\n }\n promises = /* @__PURE__ */ new Set();\n get promise() {\n let batch;\n const items = [...Array.from(this.items), ...Array.from(this.promises)];\n if (this.options?.concurrency) {\n const limit = pLimit(this.options.concurrency);\n batch = Promise.all(items.map((p2) => limit(() => p2)));\n } else {\n batch = Promise.all(items);\n }\n return batch.then((l) => l.filter((i) => i !== VOID));\n }\n add(...args) {\n args.forEach((i) => {\n this.promises.add(i);\n });\n }\n map(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n if (v === VOID)\n return VOID;\n return fn(v, idx);\n }),\n this.options\n );\n }\n filter(fn) {\n return new PInstance(\n Array.from(this.items).map(async (i, idx) => {\n const v = await i;\n const r = await fn(v, idx);\n if (!r)\n return VOID;\n return v;\n }),\n this.options\n );\n }\n forEach(fn) {\n return this.map(fn).then();\n }\n reduce(fn, initialValue) {\n return this.promise.then((array) => array.reduce(fn, initialValue));\n }\n clear() {\n this.promises.clear();\n }\n then(onfulfilled, onrejected) {\n return this.promise.then(onfulfilled, onrejected);\n }\n catch(fn) {\n return this.promise.catch(fn);\n }\n finally(fn) {\n return this.promise.finally(fn);\n }\n}\nfunction p(items, options) {\n return new PInstance(items, options);\n}\n\nfunction createSingletonPromise(fn) {\n let _promise;\n function wrapper() {\n if (!_promise)\n _promise = fn();\n return _promise;\n }\n wrapper.reset = async () => {\n const _prev = _promise;\n _promise = void 0;\n if (_prev)\n await _prev;\n };\n return wrapper;\n}\nfunction sleep(ms, callback) {\n return new Promise(\n (resolve) => setTimeout(async () => {\n await callback?.();\n resolve();\n }, ms)\n );\n}\nfunction createPromiseLock() {\n const locks = [];\n return {\n async run(fn) {\n const p = fn();\n locks.push(p);\n try {\n return await p;\n } finally {\n remove(locks, p);\n }\n },\n async wait() {\n await Promise.allSettled(locks);\n },\n isWaiting() {\n return Boolean(locks.length);\n },\n clear() {\n locks.length = 0;\n }\n };\n}\nfunction createControlledPromise() {\n let resolve, reject;\n const promise = new Promise((_resolve, _reject) => {\n resolve = _resolve;\n reject = _reject;\n });\n promise.resolve = resolve;\n promise.reject = reject;\n return promise;\n}\n\nconst timestamp = () => +Date.now();\n\n/* eslint-disable no-undefined,no-param-reassign,no-shadow */\n\n/**\n * Throttle execution of a function. Especially useful for rate limiting\n * execution of handlers on events like resize and scroll.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher)\n * are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through,\n * as-is, to `callback` when the throttled-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.noTrailing] - Optional, defaults to false. If noTrailing is true, callback will only execute every `delay` milliseconds\n * while the throttled-function is being called. If noTrailing is false or unspecified, callback will be executed\n * one final time after the last throttled-function call. (After the throttled-function has not been called for\n * `delay` milliseconds, the internal counter is reset).\n * @param {boolean} [options.noLeading] - Optional, defaults to false. If noLeading is false, the first throttled-function call will execute callback\n * immediately. If noLeading is true, the first the callback execution will be skipped. It should be noted that\n * callback will never executed if both noLeading = true and noTrailing = true.\n * @param {boolean} [options.debounceMode] - If `debounceMode` is true (at begin), schedule `clear` to execute after `delay` ms. If `debounceMode` is\n * false (at end), schedule `callback` to execute after `delay` ms.\n *\n * @returns {Function} A new, throttled, function.\n */\nfunction throttle$1 (delay, callback, options) {\n var _ref = options || {},\n _ref$noTrailing = _ref.noTrailing,\n noTrailing = _ref$noTrailing === void 0 ? false : _ref$noTrailing,\n _ref$noLeading = _ref.noLeading,\n noLeading = _ref$noLeading === void 0 ? false : _ref$noLeading,\n _ref$debounceMode = _ref.debounceMode,\n debounceMode = _ref$debounceMode === void 0 ? undefined : _ref$debounceMode;\n /*\n * After wrapper has stopped being called, this timeout ensures that\n * `callback` is executed at the proper times in `throttle` and `end`\n * debounce modes.\n */\n\n\n var timeoutID;\n var cancelled = false; // Keep track of the last time `callback` was executed.\n\n var lastExec = 0; // Function to clear existing timeout\n\n function clearExistingTimeout() {\n if (timeoutID) {\n clearTimeout(timeoutID);\n }\n } // Function to cancel next exec\n\n\n function cancel(options) {\n var _ref2 = options || {},\n _ref2$upcomingOnly = _ref2.upcomingOnly,\n upcomingOnly = _ref2$upcomingOnly === void 0 ? false : _ref2$upcomingOnly;\n\n clearExistingTimeout();\n cancelled = !upcomingOnly;\n }\n /*\n * The `wrapper` function encapsulates all of the throttling / debouncing\n * functionality and when executed will limit the rate at which `callback`\n * is executed.\n */\n\n\n function wrapper() {\n for (var _len = arguments.length, arguments_ = new Array(_len), _key = 0; _key < _len; _key++) {\n arguments_[_key] = arguments[_key];\n }\n\n var self = this;\n var elapsed = Date.now() - lastExec;\n\n if (cancelled) {\n return;\n } // Execute `callback` and update the `lastExec` timestamp.\n\n\n function exec() {\n lastExec = Date.now();\n callback.apply(self, arguments_);\n }\n /*\n * If `debounceMode` is true (at begin) this is used to clear the flag\n * to allow future `callback` executions.\n */\n\n\n function clear() {\n timeoutID = undefined;\n }\n\n if (!noLeading && debounceMode && !timeoutID) {\n /*\n * Since `wrapper` is being called for the first time and\n * `debounceMode` is true (at begin), execute `callback`\n * and noLeading != true.\n */\n exec();\n }\n\n clearExistingTimeout();\n\n if (debounceMode === undefined && elapsed > delay) {\n if (noLeading) {\n /*\n * In throttle mode with noLeading, if `delay` time has\n * been exceeded, update `lastExec` and schedule `callback`\n * to execute after `delay` ms.\n */\n lastExec = Date.now();\n\n if (!noTrailing) {\n timeoutID = setTimeout(debounceMode ? clear : exec, delay);\n }\n } else {\n /*\n * In throttle mode without noLeading, if `delay` time has been exceeded, execute\n * `callback`.\n */\n exec();\n }\n } else if (noTrailing !== true) {\n /*\n * In trailing throttle mode, since `delay` time has not been\n * exceeded, schedule `callback` to execute `delay` ms after most\n * recent execution.\n *\n * If `debounceMode` is true (at begin), schedule `clear` to execute\n * after `delay` ms.\n *\n * If `debounceMode` is false (at end), schedule `callback` to\n * execute after `delay` ms.\n */\n timeoutID = setTimeout(debounceMode ? clear : exec, debounceMode === undefined ? delay - elapsed : delay);\n }\n }\n\n wrapper.cancel = cancel; // Return the wrapper function.\n\n return wrapper;\n}\n\n/* eslint-disable no-undefined */\n/**\n * Debounce execution of a function. Debouncing, unlike throttling,\n * guarantees that a function is only executed a single time, either at the\n * very beginning of a series of calls, or at the very end.\n *\n * @param {number} delay - A zero-or-greater delay in milliseconds. For event callbacks, values around 100 or 250 (or even higher) are most useful.\n * @param {Function} callback - A function to be executed after delay milliseconds. The `this` context and all arguments are passed through, as-is,\n * to `callback` when the debounced-function is executed.\n * @param {object} [options] - An object to configure options.\n * @param {boolean} [options.atBegin] - Optional, defaults to false. If atBegin is false or unspecified, callback will only be executed `delay` milliseconds\n * after the last debounced-function call. If atBegin is true, callback will be executed only at the first debounced-function call.\n * (After the throttled-function has not been called for `delay` milliseconds, the internal counter is reset).\n *\n * @returns {Function} A new, debounced function.\n */\n\nfunction debounce$1 (delay, callback, options) {\n var _ref = options || {},\n _ref$atBegin = _ref.atBegin,\n atBegin = _ref$atBegin === void 0 ? false : _ref$atBegin;\n\n return throttle$1(delay, callback, {\n debounceMode: atBegin !== false\n });\n}\n\nfunction throttle(...args) {\n return throttle$1(...args);\n}\nfunction debounce(...args) {\n return debounce$1(...args);\n}\n\nexport { assert, at, batchInvoke, capitalize, clamp, clampArrayRange, clearUndefined, createControlledPromise, createPromiseLock, createSingletonPromise, debounce, deepMerge, deepMergeWithArray, ensurePrefix, ensureSuffix, filterInPlace, flattenArrayable, getTypeName, hasOwnProperty, invoke, isBoolean, isBrowser, isDate, isDeepEqual, isDef, isFunction, isKeyOf, isNull, isNumber, isObject, isPrimitive, isRegExp, isString, isTruthy, isUndefined, isWindow, last, lerp, mergeArrayable, move, noNull, noop, notNullish, notUndefined, objectEntries, objectId, objectKeys, objectMap, objectPick, p, partition, randomStr, range, remap, remove, sample, shuffle, slash, sleep, sum, tap, template, throttle, timestamp, toArray, toString, unindent, uniq, uniqueBy };\n","export function generateKey() {\n // Length of 6 is enough to avoid collisions\n // for react keys\n return Math.random().toString(36).substr(2, 6);\n}\n","export type MetaDescriptor =\n | {\n charSet: 'utf-8';\n }\n | {\n title: string;\n }\n | {\n name: string;\n content: string;\n }\n | {\n property: string;\n content: string;\n }\n | {\n httpEquiv: string;\n content: string;\n }\n | {\n tagName: 'meta' | 'link';\n [attribute: string]: string;\n }\n | {\n [name: string]: string;\n };\n\nexport type MetaDescriptors = MetaDescriptor[];\n\nexport function meta(meta: MetaDescriptors) {\n return (\n meta\n // only filter unique meta tags\n // so that we don't have duplicate meta tags\n .filter((meta, index, self) => {\n const meta_hash = hash(meta);\n return (\n index ===\n self.findIndex((t) => {\n return hash(t) === meta_hash;\n })\n );\n })\n .map(process)\n .filter(Boolean) as JSX.Element[]\n );\n}\n\nfunction process(props: MetaDescriptor) {\n if ('tagName' in props) {\n const { tagName, ...attributes } = props;\n const Comp = tagName;\n return <Comp key={JSON.stringify(attributes)} {...attributes} />;\n }\n\n if ('title' in props) {\n return <title>{props.title}</title>;\n }\n\n if ('charSet' in props) {\n return <meta charSet={props.charSet} />;\n }\n\n return <meta key={JSON.stringify(props)} {...props} />;\n}\n\n/**\n * hash the meta object to string\n * so that we can filter out duplicates\n * for that we have to sort the object keys\n * and then stringify it and hash it\n */\nfunction hash(meta: MetaDescriptor) {\n const sortedMeta = Object.keys(meta)\n .sort()\n .reduce((acc, key) => {\n const _key = key as keyof MetaDescriptor;\n acc[_key] = meta[_key];\n return acc;\n }, {} as MetaDescriptor);\n\n return JSON.stringify(sortedMeta);\n}\n","//#region src/theme.ts\nconst allowedFallbackFonts = [\n\t\"Arial\",\n\t\"Helvetica\",\n\t\"Verdana\",\n\t\"Georgia\",\n\t\"Times New Roman\",\n\t\"serif\",\n\t\"sans-serif\",\n\t\"monospace\",\n\t\"cursive\",\n\t\"fantasy\"\n];\nconst allowedFontFormats = [\n\t\"woff\",\n\t\"woff2\",\n\t\"truetype\",\n\t\"opentype\",\n\t\"embedded-opentype\",\n\t\"svg\"\n];\nconst DEFAULT_FONT = {\n\tfallbackFontFamily: \"sans-serif\",\n\tfontFamily: \"Inter\",\n\twebFont: {\n\t\turl: \"https://rsms.me/inter/font-files/Inter-Regular.woff2?v=3.19\",\n\t\tformat: \"woff2\"\n\t}\n};\nconst DEFAULT_LINK_TEXT_COLOR = \"#111827\";\nconst DEFAULT_RENDERER_THEME = {\n\tcolors: {\n\t\theading: \"#111827\",\n\t\tparagraph: \"#374151\",\n\t\thorizontal: \"#EAEAEA\",\n\t\tfooter: \"#64748B\",\n\t\tblockquoteBorder: \"#D1D5DB\",\n\t\tcodeBackground: \"#EFEFEF\",\n\t\tcodeText: \"#111827\",\n\t\tlinkCardTitle: \"#111827\",\n\t\tlinkCardDescription: \"#6B7280\",\n\t\tlinkCardBadgeText: \"#111827\",\n\t\tlinkCardBadgeBackground: \"#FEF08A\",\n\t\tlinkCardSubTitle: \"#6B7280\"\n\t},\n\tfontSize: {\n\t\tparagraph: {\n\t\t\tsize: \"15px\",\n\t\t\tlineHeight: \"26.25px\"\n\t\t},\n\t\tfooter: {\n\t\t\tsize: \"14px\",\n\t\t\tlineHeight: \"24px\"\n\t\t}\n\t},\n\tcontainer: {\n\t\tbackgroundColor: \"#ffffff\",\n\t\tmaxWidth: \"600px\",\n\t\tminWidth: \"300px\",\n\t\tpaddingTop: \"0.5rem\",\n\t\tpaddingRight: \"0.5rem\",\n\t\tpaddingBottom: \"0.5rem\",\n\t\tpaddingLeft: \"0.5rem\",\n\t\tborderRadius: \"0px\",\n\t\tborderWidth: \"0px\",\n\t\tborderColor: \"transparent\"\n\t},\n\tbody: {\n\t\tbackgroundColor: \"#ffffff\",\n\t\tpaddingTop: \"0px\",\n\t\tpaddingRight: \"0px\",\n\t\tpaddingBottom: \"0px\",\n\t\tpaddingLeft: \"0px\"\n\t},\n\tbutton: {\n\t\tbackgroundColor: \"#000000\",\n\t\tcolor: \"#ffffff\",\n\t\tpaddingTop: \"10px\",\n\t\tpaddingRight: \"32px\",\n\t\tpaddingBottom: \"10px\",\n\t\tpaddingLeft: \"32px\"\n\t},\n\tlink: { color: DEFAULT_LINK_TEXT_COLOR },\n\tfont: DEFAULT_FONT\n};\nconst DEFAULT_EDITOR_THEME = {\n\tcontainer: {\n\t\tbackgroundColor: \"#ffffff\",\n\t\tmaxWidth: \"600px\",\n\t\tminWidth: \"300px\",\n\t\tpaddingTop: \"8px\",\n\t\tpaddingRight: \"8px\",\n\t\tpaddingBottom: \"8px\",\n\t\tpaddingLeft: \"8px\",\n\t\tborderRadius: \"0px\",\n\t\tborderWidth: \"0px\",\n\t\tborderColor: \"transparent\"\n\t},\n\tbody: {\n\t\tbackgroundColor: \"#ffffff\",\n\t\tpaddingTop: \"0px\",\n\t\tpaddingRight: \"0px\",\n\t\tpaddingBottom: \"0px\",\n\t\tpaddingLeft: \"0px\"\n\t},\n\tbutton: {\n\t\tbackgroundColor: \"#000000\",\n\t\tcolor: \"#ffffff\",\n\t\tpaddingTop: \"10px\",\n\t\tpaddingRight: \"32px\",\n\t\tpaddingBottom: \"10px\",\n\t\tpaddingLeft: \"32px\"\n\t},\n\tlink: { color: DEFAULT_LINK_TEXT_COLOR },\n\tfont: DEFAULT_FONT\n};\n\n//#endregion\n//#region src/css-variables.ts\n/**\n* if the value is undefined, it will return an empty object\n* so that we don't override the default value\n* @param name - The name of the CSS variable\n* @param value - The value of the CSS variable\n* @returns The CSS variable value\n*/\nfunction getVariableValue(name, value) {\n\tif (value === void 0 || value === null || value === \"\") return {};\n\treturn { [name]: value };\n}\n/**\n* Get the CSS variables for the theme\n* @param theme - The theme\n* @returns The CSS variables\n* @example\n* ```ts\n* const theme = {\n* body: {\n* backgroundColor: 'red',\n* },\n* };\n*\n* const cssVariables = getCssVariables(theme);\n*\n* console.log(cssVariables);\n* // { '--mly-body-background-color': 'red' }\n*/\nfunction getMailyCssVariables(theme) {\n\tconst font = theme.font || DEFAULT_FONT;\n\treturn {\n\t\t...getVariableValue(\"--mly-body-background-color\", theme.body?.backgroundColor),\n\t\t...getVariableValue(\"--mly-body-padding-top\", theme.body?.paddingTop),\n\t\t...getVariableValue(\"--mly-body-padding-right\", theme.body?.paddingRight),\n\t\t...getVariableValue(\"--mly-body-padding-bottom\", theme.body?.paddingBottom),\n\t\t...getVariableValue(\"--mly-body-padding-left\", theme.body?.paddingLeft),\n\t\t...getVariableValue(\"--mly-container-background-color\", theme.container?.backgroundColor),\n\t\t...getVariableValue(\"--mly-container-max-width\", theme.container?.maxWidth),\n\t\t...getVariableValue(\"--mly-container-min-width\", theme.container?.minWidth),\n\t\t...getVariableValue(\"--mly-container-padding-top\", theme.container?.paddingTop),\n\t\t...getVariableValue(\"--mly-container-padding-right\", theme.container?.paddingRight),\n\t\t...getVariableValue(\"--mly-container-padding-bottom\", theme.container?.paddingBottom),\n\t\t...getVariableValue(\"--mly-container-padding-left\", theme.container?.paddingLeft),\n\t\t...getVariableValue(\"--mly-container-border-radius\", theme.container?.borderRadius),\n\t\t...getVariableValue(\"--mly-container-border-width\", theme.container?.borderWidth),\n\t\t...getVariableValue(\"--mly-container-border-color\", theme.container?.borderColor),\n\t\t...getVariableValue(\"--mly-button-background-color\", theme.button?.backgroundColor),\n\t\t...getVariableValue(\"--mly-button-text-color\", theme.button?.color),\n\t\t...getVariableValue(\"--mly-button-padding-top\", theme.button?.paddingTop),\n\t\t...getVariableValue(\"--mly-button-padding-right\", theme.button?.paddingRight),\n\t\t...getVariableValue(\"--mly-button-padding-bottom\", theme.button?.paddingBottom),\n\t\t...getVariableValue(\"--mly-button-padding-left\", theme.button?.paddingLeft),\n\t\t...getVariableValue(\"--mly-link-color\", theme.link?.color),\n\t\t...getVariableValue(\"--mly-font-family\", font.fontFamily),\n\t\t...getVariableValue(\"--mly-font-fallback-family\", font.fallbackFontFamily),\n\t\t\"--mly-font\": `var(--mly-font-family), var(--mly-font-fallback-family)`\n\t};\n}\n\n//#endregion\n//#region src/font.ts\nfunction loadFont(font) {\n\tconst style = fontStyle(font);\n\tconst styleElement = document.createElement(\"style\");\n\tstyleElement.textContent = style;\n\tdocument.head.appendChild(styleElement);\n}\nfunction fontStyle(font) {\n\tconst { fontFamily, fallbackFontFamily, webFont } = font;\n\tconst src = webFont ? `src: url(${webFont.url}) format('${webFont.format}');` : \"\";\n\tconst style = `\n @font-face {\n font-family: '${fontFamily}';\n font-style: normal;\n font-weight: 400;\n mso-font-alt: '${fallbackFontFamily}';\n ${src}\n }`;\n\treturn style;\n}\n\n//#endregion\nexport { DEFAULT_EDITOR_THEME, DEFAULT_FONT, DEFAULT_LINK_TEXT_COLOR, DEFAULT_RENDERER_THEME, allowedFallbackFonts, allowedFontFormats, fontStyle, getMailyCssVariables, getVariableValue, loadFont };\n//# sourceMappingURL=index.mjs.map","import { JSONContent } from '@tiptap/core';\nimport { Maily } from './maily';\n\nexport class Preheader {\n constructor(private readonly maily: Maily) {}\n\n render(content: string | JSONContent): string {\n if (typeof content === 'string') {\n return content;\n }\n\n return this.renderNode(content);\n }\n\n private renderNode(node: JSONContent): string {\n const type = node.type || '';\n switch (type) {\n case 'doc':\n return this.doc(node);\n case 'paragraph':\n return this.paragraph(node);\n case 'text':\n return this.text(node);\n case 'variable':\n return this.variable(node);\n default:\n // it's fine to ignore unknown nodes\n // because we don't want to break the rendering process\n return '';\n }\n }\n\n private doc(node: JSONContent): string {\n const children = node.content || [];\n if (children.length === 0) {\n return '';\n }\n\n return children.map((child) => this.renderNode(child)).join('');\n }\n\n private paragraph(node: JSONContent): string {\n const children = node.content || [];\n if (children.length === 0) {\n return '';\n }\n\n return children.map((child) => this.renderNode(child)).join('');\n }\n\n private text(node: JSONContent): string {\n return node.text || '';\n }\n\n private variable(node: JSONContent): string {\n const { id: variable, fallback } = node.attrs || {};\n return this.maily.getVariableValue(variable, fallback);\n }\n}\n","import { Fragment, type CSSProperties } from 'react';\nimport {\n Text,\n Html,\n Head,\n Body,\n Font,\n Container,\n Link,\n Heading,\n Hr,\n Button,\n Img,\n Preview,\n Row,\n Column,\n Section,\n HtmlProps,\n} from '@react-email/components';\nimport { renderAsync as reactEmailRenderAsync } from '@react-email/render';\nimport type { JSONContent } from '@tiptap/core';\nimport { deepMerge } from '@antfu/utils';\nimport { generateKey } from './utils';\nimport type { MetaDescriptors } from './meta';\nimport { meta } from './meta';\nimport { parse } from 'node-html-parser';\nimport juice from 'juice';\nimport type {\n FontProps,\n RendererThemeOptions as ThemeOptions,\n} from '@maily-to/shared';\nimport {\n DEFAULT_RENDERER_THEME as DEFAULT_THEME,\n DEFAULT_FONT,\n DEFAULT_LINK_TEXT_COLOR,\n} from '@maily-to/shared';\nimport { Preheader } from './preheader';\n\ninterface NodeOptions {\n parent?: JSONContent;\n prev?: JSONContent;\n next?: JSONContent;\n\n payloadValue?: PayloadValue;\n}\n\nexport interface MarkType {\n [key: string]: any;\n type: string;\n attrs?: Record<string, any> | undefined;\n}\n\nconst antialiased: CSSProperties = {\n WebkitFontSmoothing: 'antialiased',\n MozOsxFontSmoothing: 'grayscale',\n};\n\nconst allowedHeadings = ['h1', 'h2', 'h3'] as const;\ntype AllowedHeadings = (typeof allowedHeadings)[number];\n\nconst headings: Record<AllowedHeadings, CSSProperties> = {\n h1: {\n fontSize: '36px',\n lineHeight: '40px',\n fontWeight: 800,\n },\n h2: {\n fontSize: '30px',\n lineHeight: '36px',\n fontWeight: 700,\n },\n h3: {\n fontSize: '24px',\n lineHeight: '38px',\n fontWeight: 600,\n },\n};\n\nconst allowedLogoSizes = ['sm', 'md', 'lg'] as const;\ntype AllowedLogoSizes = (typeof allowedLogoSizes)[number];\n\nconst logoSizes: Record<AllowedLogoSizes, string> = {\n sm: '40px',\n md: '48px',\n lg: '64px',\n};\n\nexport interface MailyConfig {\n /**\n * The preview text is the snippet of text that is pulled into the inbox\n * preview of an email client, usually right after the subject line.\n *\n * Default: `undefined`\n */\n preview?: string | JSONContent;\n /**\n * The theme object allows you to customize the colors and font sizes of the\n * rendered email.\n *\n * Default:\n * ```js\n * {\n * colors: {\n * heading: '#111827',\n * paragraph: '#374151',\n * horizontal: '#EAEAEA',\n * footer: '#64748B',\n * },\n * fontSize: {\n * paragraph: '15px',\n * footer: {\n * size: '14px',\n * lineHeight: '24px',\n * },\n * },\n * }\n * ```\n *\n * @example\n * ```js\n * const maily = new Maily(content, {\n * theme: {\n * colors: {\n * heading: '#111827',\n * },\n * fontSize: {\n * footer: {\n * size: '14px',\n * lineHeight: '24px',\n * },\n * },\n * },\n * });\n * ```\n */\n theme?: Partial<ThemeOptions>;\n}\n\nconst CODE_FONT_FAMILY =\n 'SFMono-Regular, Menlo, Monaco, Consolas, \"Liberation Mono\", \"Courier New\", monospace';\nexport const DEFAULT_SECTION_BACKGROUND_COLOR = '#ffffff';\nexport const DEFAULT_SECTION_ALIGN = 'left';\nexport const DEFAULT_SECTION_BORDER_WIDTH = 1;\nexport const DEFAULT_SECTION_BORDER_COLOR = '#000000';\n\nexport const DEFAULT_SECTION_MARGIN_TOP = 0;\nexport const DEFAULT_SECTION_MARGIN_RIGHT = 0;\nexport const DEFAULT_SECTION_MARGIN_BOTTOM = 0;\nexport const DEFAULT_SECTION_MARGIN_LEFT = 0;\n\nexport const DEFAULT_SECTION_PADDING_TOP = 5;\nexport const DEFAULT_SECTION_PADDING_RIGHT = 5;\nexport const DEFAULT_SECTION_PADDING_BOTTOM = 5;\nexport const DEFAULT_SECTION_PADDING_LEFT = 5;\n\nexport const DEFAULT_COLUMNS_WIDTH = '100%';\nexport const DEFAULT_COLUMNS_GAP = 8;\n\nexport const DEFAULT_COLUMN_BACKGROUND_COLOR = 'transparent';\nexport const DEFAULT_COLUMN_BORDER_RADIUS = 0;\nexport const DEFAULT_COLUMN_BORDER_WIDTH = 0;\nexport const DEFAULT_COLUMN_BORDER_COLOR = 'transparent';\n\nexport const DEFAULT_COLUMN_PADDING_TOP = 0;\nexport const DEFAULT_COLUMN_PADDING_RIGHT = 0;\nexport const DEFAULT_COLUMN_PADDING_BOTTOM = 0;\nexport const DEFAULT_COLUMN_PADDING_LEFT = 0;\n\nexport const DEFAULT_INLINE_IMAGE_HEIGHT = 20;\nexport const DEFAULT_INLINE_IMAGE_WIDTH = 20;\n\nexport const LINK_PROTOCOL_REGEX = /https?:\\/\\//;\n\nexport const DEFAULT_META_TAGS: MetaDescriptors = [\n {\n name: 'viewport',\n content: 'width=device-width',\n },\n {\n httpEquiv: 'X-UA-Compatible',\n content: 'IE=edge',\n },\n {\n name: 'x-apple-disable-message-reformatting',\n },\n {\n // http://www.html-5.com/metatags/format-detection-meta-tag.html\n // It will prevent iOS from automatically detecting possible phone numbers in a block of text\n name: 'format-detection',\n content: 'telephone=no,address=no,email=no,date=no,url=no',\n },\n {\n name: 'color-scheme',\n content: 'light',\n },\n {\n name: 'supported-color-schemes',\n content: 'light',\n },\n];\n\nexport const DEFAULT_HTML_PROPS: HtmlProps = {\n lang: 'en',\n dir: 'ltr',\n};\n\nconst DEFAULT_RENDER_OPTIONS: RenderOptions = {\n pretty: false,\n plainText: false,\n};\n\nexport interface RenderOptions {\n /**\n * The options object allows you to customize the output of the rendered\n * email.\n * - `pretty` - If `true`, the output will be formatted with indentation and\n * line breaks.\n * - `plainText` - If `true`, the output will be plain text instead of HTML.\n * This is useful for testing purposes.\n *\n * Default: `pretty` - `false`, `plainText` - `false`\n */\n pretty?: boolean;\n plainText?: boolean;\n}\n\nexport type VariableFormatter = (options: {\n variable: string;\n fallback?: string;\n}) => string;\nexport type VariableValues = Map<string, string>;\nexport type LinkValues = Map<string, string>;\n\nexport type PayloadValue = Record<string, any> | boolean;\nexport type PayloadValues = Map<string, PayloadValue>;\n\nexport class Maily {\n readonly preheader = new Preheader(this);\n\n private readonly content: JSONContent;\n private config: MailyConfig = {\n theme: DEFAULT_THEME,\n };\n\n private variableFormatter: VariableFormatter = ({ variable, fallback }) => {\n return fallback\n ? `{{${variable},fallback=${fallback}}}`\n : `{{${variable}}}`;\n };\n\n private shouldReplaceVariableValues = false;\n private variableValues: VariableValues = new Map();\n private linkValues: LinkValues = new Map();\n private openTrackingPixel: string | undefined;\n private payloadValues: PayloadValues = new Map();\n private marksOrder = ['underline', 'bold', 'italic', 'textStyle', 'link'];\n private meta: MetaDescriptors = DEFAULT_META_TAGS;\n private htmlProps: HtmlProps = DEFAULT_HTML_PROPS;\n\n constructor(content: JSONContent = { type: 'doc', content: [] }) {\n this.content = content;\n }\n\n setPreviewText(preview?: string | JSONContent) {\n this.config.preview = preview;\n }\n\n setTheme(theme: Partial<ThemeOptions>) {\n this.config.theme = deepMerge(\n this.config.theme || DEFAULT_THEME,\n theme\n ) as ThemeOptions;\n }\n\n setVariableFormatter(formatter: VariableFormatter) {\n this.variableFormatter = formatter;\n }\n\n /**\n * `setVariableValue` will set the variable value.\n * It will also set `shouldReplaceVariableValues` to `true`.\n *\n * @param variable - The variable name\n * @param value - The variable value\n */\n setVariableValue(variable: string, value: string) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n this.variableValues.set(variable, value);\n }\n\n /**\n * `setVariableValues` will set the variable values.\n * It will also set `shouldReplaceVariableValues` to `true`.\n *\n * @param values - The variable values\n *\n * @example\n * ```js\n * const maily = new Maily(content);\n * maily.setVariableValues({\n * name: 'John Doe',\n * email: 'john@doe.com',\n * });\n * ```\n */\n setVariableValues(values: Record<string, string>) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n Object.entries(values).forEach(([variable, value]) => {\n this.setVariableValue(variable, value);\n });\n }\n\n setLinkValue(link: string, value: string) {\n this.linkValues.set(link, value);\n }\n\n setLinkValues(values: Record<string, string>) {\n Object.entries(values).forEach(([link, value]) => {\n this.setLinkValue(link, value);\n });\n }\n\n setPayloadValue(key: string, value: PayloadValue) {\n if (!this.shouldReplaceVariableValues) {\n this.shouldReplaceVariableValues = true;\n }\n\n this.payloadValues.set(key, value);\n }\n\n setPayloadValues(values: Record<string, PayloadValue>) {\n Object.entries(values).forEach(([key, value]) => {\n this.setPayloadValue(key, value);\n });\n }\n\n /**\n * `setOpenTrackingPixel` will set the open tracking pixel.\n *\n * @param pixel - The open tracking pixel\n */\n setOpenTrackingPixel(pixel?: string) {\n this.openTrackingPixel = pixel;\n }\n\n /**\n * `setShouldReplaceVariableValues` will determine whether to replace the\n * variable values or not. Otherwise, it will just return the formatted variable.\n *\n * Default: `false`\n */\n setShouldReplaceVariableValues(shouldReplace: boolean) {\n this.shouldReplaceVariableValues = shouldReplace;\n }\n\n /**\n * `setMetaTags` will add the meta tags.\n *\n * @param meta - The meta tags\n */\n setMetaTags(meta: MetaDescriptors) {\n this.meta.push(...meta);\n }\n\n /**\n * `setHtmlProps` will set the HTML props.\n *\n * @param props - The HTML props\n */\n setHtmlProps(props: HtmlProps) {\n this.htmlProps = {\n ...this.htmlProps,\n ...props,\n };\n }\n\n getAllLinks() {\n const nodes = this.content.content || [];\n const links = new Set<string>();\n\n const isValidLink = (href: string) => {\n return (\n href &&\n this.isValidUrl(href) &&\n !href.startsWith('#') &&\n !href.startsWith('mailto:') &&\n !href.startsWith('tel:') &&\n typeof href === 'string'\n );\n };\n\n const extractLinksFromNode = (node: JSONContent) => {\n if (node.type === 'button') {\n const originalLink = node.attrs?.url;\n if (isValidLink(originalLink) && originalLink) {\n links.add(originalLink);\n }\n } else if (node.content) {\n node.content.forEach((childNode) => {\n if (childNode.marks) {\n childNode.marks.forEach((mark) => {\n const originalLink = mark.attrs?.href;\n if (mark.type === 'link' && isValidLink(originalLink)) {\n links.add(originalLink);\n }\n });\n }\n if (childNode.content) {\n extractLinksFromNode(childNode);\n }\n });\n }\n };\n\n nodes.forEach((childNode) => {\n extractLinksFromNode(childNode);\n });\n\n return links;\n }\n\n private isValidUrl(href: string) {\n try {\n const _ = new URL(href);\n return true;\n } catch (err) {\n return false;\n }\n }\n\n async render(\n options: RenderOptions = DEFAULT_RENDER_OPTIONS\n ): Promise<string> {\n const markup = this.markup();\n\n return reactEmailRenderAsync(markup, options);\n }\n\n /**\n * `children` will return the children of the content.\n * this is useful for rendering the content in a custom component.\n *\n * @returns The children of the content as JSX elements\n */\n children() {\n const nodes = this.content.content || [];\n const jsxNodes = nodes.map((node, index) => {\n const nodeOptions: NodeOptions = {\n prev: nodes[index - 1],\n next: nodes[index + 1],\n parent: node,\n };\n\n const component = this.renderNode(node, nodeOptions);\n if (!component) {\n return null;\n }\n\n return <Fragment key={generateKey()}>{component}</Fragment>;\n });\n\n return jsxNodes;\n }\n\n /**\n * `markup` will render the JSON content into React Email markup.\n * and return the raw React Tree.\n */\n markup() {\n const jsxNodes = this.children();\n\n const { preview } = this.config;\n const tags = meta(this.meta);\n const htmlProps = this.htmlProps;\n const containerStyles = this.config.theme?.container;\n const fontOptions: FontProps = {\n ...(this.config.theme?.font || DEFAULT_FONT),\n fontStyle: 'normal',\n fontWeight: 400,\n };\n\n const bodyStyles: CSSProperties = {\n margin: '0px',\n ...this.config.theme?.body,\n };\n\n const preheader = preview ? this.preheader.render(preview) : null;\n\n const markup = (\n <Html {...htmlProps}>\n <Head>\n <Font {...fontOptions} />\n\n <style\n dangerouslySetInnerHTML={{\n __html: /* css */ `blockquote,h1,h2,h3,img,li,ol,p,ul{margin-top:0;margin-bottom:0}@media only screen and (max-width:425px){.tab-row-full{width:100%!important}.tab-col-full{display:block!important;width:100%!important}.tab-pad{padding:0!important}}`,\n }}\n />\n {tags}\n </Head>\n <Body style={bodyStyles}>\n {preheader ? <Preview>{preheader}</Preview> : null}\n <Container\n style={{\n width: '100%',\n marginLeft: 'auto',\n marginRight: 'auto',\n borderStyle: 'solid',\n ...containerStyles,\n }}\n >\n {jsxNodes}\n </Container>\n {this.openTrackingPixel ? (\n <Img\n alt=\"\"\n src={this.openTrackingPixel}\n style={{\n display: 'none',\n width: '1px',\n height: '1px',\n }}\n />\n ) : null}\n </Body>\n </Html>\n );\n\n return markup;\n }\n\n private getMarginOverrideConditions(\n node: JSONContent,\n options?: NodeOptions\n ) {\n const { parent, prev, next } = options || {};\n\n const isNextSpacer = next?.type === 'spacer';\n const isPrevSpacer = prev?.type === 'spacer';\n\n const isParentListItem = parent?.type === 'listItem';\n\n const isLastSectionElement = parent?.type === 'section' && !next;\n const isFirstSectionElement = parent?.type === 'section' && !prev;\n\n const isLastColumnElement = parent?.type === 'column' && !next;\n const isFirstColumnElement = parent?.type === 'column' && !prev;\n\n const isFirstRepeatElement = parent?.type === 'repeat' && !prev;\n const isLastRepeatElement = parent?.type === 'repeat' && !next;\n\n const isFirstShowElement = parent?.type === 'show' && !prev;\n const isLastShowElement = parent?.type === 'show' && !next;\n\n return {\n isNextSpacer,\n isPrevSpacer,\n isLastSectionElement,\n isFirstSectionElement,\n isParentListItem,\n isLastColumnElement,\n isFirstColumnElement,\n isFirstRepeatElement,\n isLastRepeatElement,\n isFirstShowElement,\n isLastShowElement,\n\n shouldRemoveTopMargin:\n isPrevSpacer ||\n isFirstSectionElement ||\n isFirstColumnElement ||\n isFirstRepeatElement ||\n isFirstShowElement,\n shouldRemoveBottomMargin:\n isNextSpacer ||\n isLastSectionElement ||\n isLastColumnElement ||\n isLastRepeatElement ||\n isLastShowElement,\n };\n }\n\n // `getMappedContent` will call corresponding node type\n // and return text content\n private getMappedContent(\n node: JSONContent,\n options?: NodeOptions\n ): JSX.Element[] {\n const allNodes = node.content || [];\n return allNodes\n .map((childNode, index) => {\n const component = this.renderNode(childNode, {\n ...options,\n next: allNodes[index + 1],\n prev: allNodes[index - 1],\n });\n if (!component) {\n return null;\n }\n\n return <Fragment key={generateKey()}>{component}</Fragment>;\n })\n .filter((n) => n !== null) as JSX.Element[];\n }\n\n // `renderNode` will call the method of the corresponding node type\n private renderNode(\n node: JSONContent,\n options: NodeOptions = {}\n ): JSX.Element | null {\n const type = node.type || '';\n\n if (type in this) {\n // @ts-expect-error - `this` is not assignable to type 'never'\n return this[type]?.(node, options) as JSX.Element;\n }\n\n throw new Error(`Node type \"${type}\" is not supported.`);\n }\n\n // `renderMark` will call the method of the corresponding mark type\n private renderMark(node: JSONContent, options?: NodeOptions): JSX.Element {\n // It will wrap the text with the corresponding mark type\n const text = node?.text || <>&nbsp;</>;\n let marks = node?.marks || [];\n // sort the marks by uderline, bold, italic, textStyle, link\n // so that the text will be wrapped in the correct order\n marks.sort((a, b) => {\n return this.marksOrder.indexOf(a.type) - this.marksOrder.indexOf(b.type);\n });\n\n return marks.reduce(\n (acc, mark) => {\n const type = mark.type;\n if (type in this) {\n // @ts-expect-error - `this` is not assignable to type 'never'\n return this[type]?.(mark, acc) as JSX.Element;\n }\n\n throw new Error(`Mark type \"${type}\" is not supported.`);\n },\n <>{text}</>\n );\n }\n\n private paragraph(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const alignment = attrs?.textAlign || 'left';\n const textDirection = attrs?.textDirection || 'ltr';\n const { isParentListItem, shouldRemoveBottomMargin } =\n this.getMarginOverrideConditions(node, options);\n\n const show = this.shouldShow(node, options);\n if (!show) {\n return <></>;\n }\n\n const marginBottom = isParentListItem || shouldRemoveBottomMargin ? 0 : 20;\n\n return (\n <Text\n style={{\n ...(alignment !== 'left' ? { textAlign: alignment } : {}),\n ...(textDirection !== 'ltr' ? { direction: textDirection } : {}),\n ...antialiased,\n fontSize: this.config.theme?.fontSize?.paragraph?.size,\n lineHeight: this.config.theme?.fontSize?.paragraph?.lineHeight,\n color: this.config.theme?.colors?.paragraph,\n margin: `0 0 ${marginBottom}px 0`,\n }}\n >\n {node.content ? (\n this.getMappedContent(node, {\n ...options,\n parent: node,\n })\n ) : (\n <>&nbsp;</>\n )}\n </Text>\n );\n }\n\n private text(node: JSONContent, options?: NodeOptions): JSX.Element {\n if (node.marks) {\n return this.renderMark(node, options);\n }\n\n const text = node.text;\n // if it's all empty, return an invisible space length\n // of the text so that it doesn't look empty for inline-images\n const spaces = text?.match(/\\s/g);\n if (spaces && spaces.length === text?.length) {\n return (\n <>\n {spaces.map((_, index) => (\n <Fragment key={index}>&nbsp;</Fragment>\n ))}\n </>\n );\n }\n\n return text ? <>{text}</> : <>&nbsp;</>;\n }\n\n private bold(_: MarkType, text: JSX.Element): JSX.Element {\n return <strong>{text}</strong>;\n }\n\n private italic(_: MarkType, text: JSX.Element): JSX.Element {\n return <em>{text}</em>;\n }\n\n private underline(_: MarkType, text: JSX.Element): JSX.Element {\n return <u>{text}</u>;\n }\n\n private strike(_: MarkType, text: JSX.Element): JSX.Element {\n return <s style={{ textDecoration: 'line-through' }}>{text}</s>;\n }\n\n private textStyle(mark: MarkType, text: JSX.Element): JSX.Element {\n const { attrs } = mark;\n const { color = this.config.theme?.colors?.paragraph } = attrs || {};\n\n return (\n <span\n style={{\n color,\n }}\n >\n {text}\n </span>\n );\n }\n\n private link(\n mark: MarkType,\n text: JSX.Element,\n options?: NodeOptions\n ): JSX.Element {\n const { attrs } = mark;\n\n const linkTheme = this.config.theme?.link;\n\n let href = attrs?.href || '#';\n const target = attrs?.target || '_blank';\n const rel = attrs?.rel || 'noopener noreferrer nofollow';\n const isUrlVariable = attrs?.isUrlVariable ?? false;\n\n if (isUrlVariable) {\n const linkWithoutProtocol = this.removeLinkProtocol(href);\n href = this.variableUrlValue(linkWithoutProtocol, options);\n } else {\n href = this.linkValues.get(href) || href;\n }\n\n return (\n <Link\n href={href}\n rel={rel}\n style={{\n fontWeight: 500,\n textDecoration: 'none',\n color: linkTheme?.color || DEFAULT_LINK_TEXT_COLOR,\n }}\n target={target}\n >\n {text}\n </Link>\n );\n }\n\n private removeLinkProtocol(href: string) {\n return href.replace(LINK_PROTOCOL_REGEX, '');\n }\n\n private variableUrlValue(href: string, options?: NodeOptions) {\n const { payloadValue } = options || {};\n const linkWithoutProtocol = this.removeLinkProtocol(href);\n\n if (!this.shouldReplaceVariableValues) {\n return this.variableFormatter({\n variable: linkWithoutProtocol,\n });\n }\n\n return (\n (typeof payloadValue === 'object'\n ? payloadValue[linkWithoutProtocol]\n : payloadValue) ??\n this.variableValues.get(linkWithoutProtocol) ??\n href\n );\n }\n\n private heading(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const level = `h${Number(attrs?.level) || 1}`;\n const textDirection = attrs?.textDirection || 'ltr';\n const isRtl = textDirection === 'rtl';\n const defaultAlignment = isRtl ? 'right' : 'left';\n const alignment = attrs?.textAlign || defaultAlignment;\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n const { fontSize, lineHeight, fontWeight } =\n headings[level as AllowedHeadings];\n\n const show = this.shouldShow(node, options);\n if (!show) {\n return <></>;\n }\n\n return (\n <Heading\n // @ts-expect-error - `this` is not assignable to type 'never'\n as={level}\n style={{\n ...(alignment !== 'left' ? { textAlign: alignment } : {}),\n ...(isRtl ? { direction: textDirection } : {}),\n color: this.config.theme?.colors?.heading,\n fontSize,\n lineHeight,\n fontWeight,\n }}\n mb={shouldRemoveBottomMargin ? 0 : 12}\n mt={0}\n mx={0}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Heading>\n );\n }\n\n private variable(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { payloadValue } = options || {};\n const { id: variable, fallback } = node.attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow || !variable) {\n return <></>;\n }\n\n const formattedVariable = this.getVariableValue(\n variable,\n fallback,\n options\n );\n\n if (node?.marks) {\n return this.renderMark(\n {\n text: formattedVariable,\n marks: node.marks,\n },\n options\n );\n }\n\n return <>{formattedVariable}</>;\n }\n\n getVariableValue(variable: string, fallback?: string, options?: NodeOptions) {\n const { payloadValue } = options || {};\n\n let formattedVariable = this.variableFormatter({\n variable,\n fallback,\n });\n\n // If `shouldReplaceVariableValues` is true, replace the variable values\n // Otherwise, just return the formatted variable\n if (this.shouldReplaceVariableValues) {\n formattedVariable =\n (typeof payloadValue === 'object'\n ? payloadValue[variable]\n : payloadValue) ??\n this.variableValues.get(variable) ??\n fallback ??\n formattedVariable;\n }\n\n return formattedVariable;\n }\n\n private horizontalRule(_: JSONContent, __?: NodeOptions): JSX.Element {\n return (\n <Hr\n style={{\n marginTop: '32px',\n marginBottom: '32px',\n }}\n />\n );\n }\n\n private orderedList(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Container\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0' : '20px',\n }}\n >\n <ol\n style={{\n paddingLeft: '26px',\n listStyleType: 'decimal',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </ol>\n </Container>\n );\n }\n\n private bulletList(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { parent, next } = options || {};\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n {\n parent,\n next,\n }\n );\n\n return (\n <Container\n style={{\n maxWidth: '100%',\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0' : '20px',\n }}\n >\n <ul\n style={{\n paddingLeft: '26px',\n listStyleType: 'disc',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </ul>\n </Container>\n );\n }\n\n private listItem(node: JSONContent, options?: NodeOptions): JSX.Element {\n return (\n <li\n style={{\n marginBottom: '8px',\n marginTop: '8px',\n paddingLeft: '6px',\n ...antialiased,\n }}\n >\n {this.getMappedContent(node, { ...options, parent: node })}\n </li>\n );\n }\n\n private button(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const buttonTheme = this.config.theme?.button;\n\n let {\n text: _text,\n isTextVariable,\n url,\n isUrlVariable,\n variant,\n buttonColor: _buttonColor,\n textColor: _textColor,\n borderRadius,\n // @TODO: Update the attribute to `textAlign`\n alignment = 'left',\n\n paddingTop: _paddingTop,\n paddingRight: _paddingRight,\n paddingBottom: _paddingBottom,\n paddingLeft: _paddingLeft,\n } = attrs || {};\n\n const buttonColor = _buttonColor || buttonTheme?.backgroundColor;\n const textColor = _textColor || buttonTheme?.color;\n\n let paddingTop =\n parseInt(String(_paddingTop || buttonTheme?.paddingTop)) || 0;\n const paddingRight =\n parseInt(String(_paddingRight || buttonTheme?.paddingRight)) || 0;\n let paddingBottom =\n parseInt(String(_paddingBottom || buttonTheme?.paddingBottom)) || 0;\n const paddingLeft =\n parseInt(String(_paddingLeft || buttonTheme?.paddingLeft)) || 0;\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n let radius: string | undefined = '0px';\n if (borderRadius === 'round') {\n radius = '9999px';\n } else if (borderRadius === 'smooth') {\n radius = '6px';\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const href = isUrlVariable\n ? this.variableUrlValue(url, options)\n : this.linkValues.get(url) || url;\n const text = isTextVariable ? this.variableUrlValue(_text, options) : _text;\n\n paddingTop += 2;\n paddingBottom += 2;\n\n return (\n <Container\n style={{\n textAlign: alignment,\n maxWidth: '100%',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n >\n <Button\n href={href}\n style={{\n color: String(textColor),\n backgroundColor:\n variant === 'filled' ? String(buttonColor) : 'transparent',\n borderColor: String(buttonColor),\n borderWidth: '2px',\n borderStyle: 'solid',\n textDecoration: 'none',\n fontSize: '14px',\n fontWeight: 500,\n borderRadius: radius,\n padding: `${paddingTop}px ${paddingRight}px ${paddingBottom}px ${paddingLeft}px`,\n }}\n >\n {text}\n </Button>\n </Container>\n );\n }\n\n private spacer(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { height } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n return (\n <Container\n style={{\n height: `${height}px`,\n }}\n />\n );\n }\n\n private hardBreak(_: JSONContent, __?: NodeOptions): JSX.Element {\n return <br />;\n }\n\n private logo(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n let {\n src,\n isSrcVariable,\n alt,\n title,\n size,\n // @TODO: Update the attribute to `textAlign`\n alignment = 'left',\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n src = isSrcVariable ? this.variableUrlValue(src, options) : src;\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Row\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '32px',\n }}\n >\n <Column align={alignment}>\n <Img\n alt={alt || title || 'Logo'}\n src={src}\n style={{\n width: logoSizes[size as AllowedLogoSizes] || size,\n height: logoSizes[size as AllowedLogoSizes] || size,\n }}\n title={title || alt || 'Logo'}\n />\n </Column>\n </Row>\n );\n }\n\n private image(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n let {\n src,\n isSrcVariable,\n alt,\n title,\n width = 'auto',\n height = 'auto',\n alignment = 'center',\n externalLink = '',\n isExternalLinkVariable,\n borderRadius = 0,\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n src = isSrcVariable ? this.variableUrlValue(src, options) : src;\n externalLink = isExternalLinkVariable\n ? this.variableUrlValue(externalLink, options)\n : externalLink;\n\n // Handle width value\n const imageWidth = width === 'auto' ? 'auto' : Number(width);\n const widthStyle = imageWidth === 'auto' ? 'auto' : `${imageWidth}px`;\n\n // Handle height value\n const imageHeight = height === 'auto' ? 'auto' : Number(height);\n const heightStyle = imageHeight === 'auto' ? 'auto' : `${imageHeight}px`;\n\n const mainImage = (\n <Img\n alt={alt || title || 'Image'}\n src={src}\n style={{\n width: widthStyle, // Use the calculated width\n height: heightStyle, // Use the calculated height\n maxWidth: '100%', // Ensure image doesn't overflow container\n outline: 'none',\n border: 'none',\n textDecoration: 'none',\n display: 'block', // Prevent unwanted spacing\n borderRadius,\n }}\n title={title || alt || 'Image'}\n />\n );\n\n return (\n <Row\n style={{\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '32px',\n }}\n >\n <Column align={alignment}>\n {externalLink ? (\n <a\n href={externalLink}\n rel=\"noopener noreferrer\"\n style={{\n display: 'block',\n maxWidth: '100%',\n textDecoration: 'none',\n }}\n target=\"_blank\"\n >\n {mainImage}\n </a>\n ) : (\n mainImage\n )}\n </Column>\n </Row>\n );\n }\n\n private footer(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { textAlign = 'left', textDirection = 'ltr' } = attrs || {};\n\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n return (\n <Text\n style={{\n fontSize: this.config.theme?.fontSize?.footer?.size,\n lineHeight: this.config.theme?.fontSize?.footer?.lineHeight,\n color: this.config.theme?.colors?.footer,\n marginTop: '0px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n textAlign,\n ...(textDirection !== 'ltr' ? { direction: textDirection } : {}),\n ...antialiased,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Text>\n );\n }\n\n private blockquote(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { isPrevSpacer, shouldRemoveBottomMargin } =\n this.getMarginOverrideConditions(node, options);\n\n return (\n <blockquote\n style={{\n borderLeftWidth: '4px',\n borderLeftStyle: 'solid',\n borderLeftColor: this.config.theme?.colors?.blockquoteBorder,\n paddingLeft: '16px',\n marginLeft: '0px',\n marginRight: '0px',\n marginTop: isPrevSpacer ? '0px' : '20px',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </blockquote>\n );\n }\n private code(_: MarkType, text: JSX.Element): JSX.Element {\n return (\n <code\n style={{\n backgroundColor: this.config.theme?.colors?.codeBackground,\n color: this.config.theme?.colors?.codeText,\n padding: '2px 4px',\n borderRadius: '6px',\n fontFamily: CODE_FONT_FAMILY,\n fontWeight: 400,\n letterSpacing: 0,\n }}\n >\n {text}\n </code>\n );\n }\n private linkCard(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { shouldRemoveBottomMargin } = this.getMarginOverrideConditions(\n node,\n options\n );\n\n const { title, description, link, linkTitle, image, badgeText, subTitle } =\n attrs || {};\n const href =\n this.linkValues.get(link) || this.variableValues.get(link) || link || '#';\n\n return (\n <a\n href={href}\n rel=\"noopener noreferrer\"\n style={{\n border: '1px solid #eaeaea',\n borderRadius: '10px',\n textDecoration: 'none',\n color: 'inherit',\n display: 'block',\n marginBottom: shouldRemoveBottomMargin ? '0px' : '20px',\n }}\n target=\"_blank\"\n >\n {image ? (\n <Row\n style={{\n marginBottom: '6px',\n }}\n >\n <Column\n style={{\n width: '100%',\n height: '100%',\n }}\n >\n <Img\n alt={title || 'Link Card'}\n src={image}\n style={{\n borderRadius: '10px 10px 0 0',\n width: '100%',\n height: '100%',\n objectFit: 'cover',\n }}\n title={title || 'Link Card'}\n />\n </Column>\n </Row>\n ) : null}\n\n <Row\n style={{\n padding: '15px',\n marginTop: 0,\n marginBottom: 0,\n }}\n >\n <Column\n style={{\n verticalAlign: 'top',\n }}\n >\n <Row\n align={undefined}\n style={{\n marginBottom: '8px',\n marginTop: '0px',\n }}\n width=\"auto\"\n >\n <Column>\n <Text\n style={{\n fontSize: '18px',\n fontWeight: 600,\n color: this.config.theme?.colors?.linkCardTitle,\n margin: '0px',\n ...antialiased,\n }}\n >\n {title}\n </Text>\n </Column>\n {badgeText || subTitle ? (\n <Column\n style={{\n paddingLeft: '6px',\n verticalAlign: 'middle',\n }}\n >\n {badgeText ? (\n <span\n style={{\n fontWeight: 600,\n color: this.config.theme?.colors?.linkCardBadgeText,\n padding: '4px 8px',\n borderRadius: '8px',\n backgroundColor:\n this.config.theme?.colors?.linkCardBadgeBackground,\n fontSize: '12px',\n lineHeight: '12px',\n }}\n >\n {badgeText}\n </span>\n ) : null}{' '}\n {subTitle && !badgeText ? (\n <span\n style={{\n fontWeight: 'normal',\n color: this.config.theme?.colors?.linkCardSubTitle,\n fontSize: '12px',\n lineHeight: '12px',\n }}\n >\n {subTitle}\n </span>\n ) : null}\n </Column>\n ) : null}\n </Row>\n <Text\n style={{\n fontSize: '16px',\n color: this.config.theme?.colors?.linkCardDescription,\n marginTop: '0px',\n marginBottom: '0px',\n ...antialiased,\n }}\n >\n {description}{' '}\n {linkTitle ? (\n <a\n href={href}\n rel=\"noopener noreferrer\"\n style={{\n color: this.config.theme?.colors?.linkCardTitle,\n fontSize: '14px',\n fontWeight: 600,\n textDecoration: 'underline',\n }}\n >\n {linkTitle}\n </a>\n ) : null}\n </Text>\n </Column>\n </Row>\n </a>\n );\n }\n\n private section(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n borderRadius = 0,\n backgroundColor = DEFAULT_SECTION_BACKGROUND_COLOR,\n align = DEFAULT_SECTION_ALIGN,\n borderWidth = DEFAULT_SECTION_BORDER_WIDTH,\n borderColor = DEFAULT_SECTION_BORDER_COLOR,\n\n marginTop = DEFAULT_SECTION_MARGIN_TOP,\n marginRight = DEFAULT_SECTION_MARGIN_RIGHT,\n marginBottom = DEFAULT_SECTION_MARGIN_BOTTOM,\n marginLeft = DEFAULT_SECTION_MARGIN_LEFT,\n\n paddingTop = DEFAULT_SECTION_PADDING_TOP,\n paddingRight = DEFAULT_SECTION_PADDING_RIGHT,\n paddingBottom = DEFAULT_SECTION_PADDING_BOTTOM,\n paddingLeft = DEFAULT_SECTION_PADDING_LEFT,\n } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n return (\n <Row\n style={{\n marginTop,\n marginRight,\n marginBottom,\n marginLeft,\n }}\n >\n <Column\n align={align}\n style={{\n borderColor,\n borderWidth,\n borderStyle: 'solid',\n backgroundColor,\n borderRadius,\n\n paddingTop,\n paddingRight,\n paddingBottom,\n paddingLeft,\n }}\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Column>\n </Row>\n );\n }\n\n private columns(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n const [newNode, totalWidth] = this.adjustColumnsContent(node);\n\n return (\n <Row\n width={`${totalWidth}%`}\n style={{\n margin: 0,\n padding: 0,\n width: `${totalWidth}%`,\n }}\n className=\"tab-row-full\"\n >\n {this.getMappedContent(newNode, {\n ...options,\n parent: newNode,\n })}\n </Row>\n );\n }\n\n private adjustColumnsContent(node: JSONContent): [JSONContent, number] {\n const { content = [] } = node;\n const totalWidth = 100;\n const columnsWithWidth = content.filter(\n (c) => c.type === 'column' && Boolean(Number(c.attrs?.width || 0))\n );\n const autoWidthColumns = content.filter(\n (c) =>\n c.type === 'column' && (c.attrs?.width === 'auto' || !c.attrs?.width)\n );\n\n const totalWidthUsed = columnsWithWidth.reduce(\n (acc, c) => acc + Number(c.attrs?.width),\n 0\n );\n\n const remainingWidth = totalWidth - totalWidthUsed;\n const measuredWidth = Math.round(remainingWidth / autoWidthColumns.length);\n\n const columnCount = content.filter((c) => c.type === 'column').length;\n const gap = node.attrs?.gap ?? DEFAULT_COLUMNS_GAP;\n\n return [\n {\n ...node,\n content: content.map((c, index) => {\n const isAutoWidthColumn =\n c.type === 'column' &&\n (c.attrs?.width === 'auto' || !c.attrs?.width);\n const isFirstColumn = index === 0;\n const isMiddleColumn = index > 0 && index < columnCount - 1;\n const isLastColumn = index === content.length - 1;\n\n let paddingLeft = 0;\n let paddingRight = 0;\n\n // For 2 columns, apply a simple gap logic\n if (columnCount < 3) {\n paddingLeft = isFirstColumn ? 0 : gap / 2;\n paddingRight = isLastColumn ? 0 : gap / 2;\n } else {\n // For more than 2 columns, apply more gap in the first and last columns\n // and less gap in the middle columns to make it look more balanced\n // because the first and last columns have more space to fill\n const leftAndRightPadding = (gap / 2) * 1.5;\n const middleColumnPadding = leftAndRightPadding / 2;\n\n paddingLeft = isFirstColumn\n ? 0\n : isMiddleColumn\n ? middleColumnPadding\n : leftAndRightPadding;\n paddingRight = isLastColumn\n ? 0\n : isMiddleColumn\n ? middleColumnPadding\n : leftAndRightPadding;\n }\n\n paddingLeft = Math.round(paddingLeft * 100) / 100;\n paddingRight = Math.round(paddingRight * 100) / 100;\n\n return {\n ...c,\n attrs: {\n ...c.attrs,\n width: isAutoWidthColumn ? measuredWidth : c.attrs?.width,\n\n isFirstColumn,\n isLastColumn,\n index,\n\n paddingLeft,\n paddingRight,\n },\n };\n }),\n },\n autoWidthColumns.length === 0\n ? Math.min(totalWidth, totalWidthUsed)\n : totalWidth,\n ];\n }\n\n private column(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const {\n width,\n verticalAlign = 'top',\n paddingLeft = 0,\n paddingRight = 0,\n } = attrs || {};\n\n return (\n <Column\n width={`${Number(width)}%`}\n style={{\n width: `${Number(width)}%`,\n margin: 0,\n verticalAlign,\n }}\n className=\"tab-col-full\"\n >\n <Section\n style={{\n margin: 0,\n paddingLeft,\n paddingRight,\n }}\n className=\"tab-pad\"\n >\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n })}\n </Section>\n </Column>\n );\n }\n\n private repeat(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n const { each = '' } = attrs || {};\n\n const shouldShow = this.shouldShow(node, options);\n if (!shouldShow) {\n return <></>;\n }\n\n let { payloadValue } = options || {};\n payloadValue = typeof payloadValue === 'object' ? payloadValue : {};\n\n const values = this.payloadValues.get(each) ?? payloadValue[each] ?? [];\n if (!Array.isArray(values)) {\n throw new Error(`Payload value for each \"${each}\" is not an array`);\n }\n\n return (\n <>\n {values.map((value) => {\n return (\n <Fragment key={generateKey()}>\n {this.getMappedContent(node, {\n ...options,\n parent: node,\n payloadValue: value,\n })}\n </Fragment>\n );\n })}\n </>\n );\n }\n\n /**\n * @deprecated\n * This for node is an alias for the repeat node\n * we will remove this in the future\n * @param node\n * @param options\n * @returns JSX.Element\n */\n private for(node: JSONContent, options?: NodeOptions): JSX.Element {\n return this.repeat(node, options);\n }\n\n private shouldShow(node: JSONContent, options?: NodeOptions): boolean {\n const showIfKey = node?.attrs?.showIfKey ?? '';\n if (!showIfKey) {\n return true;\n }\n\n let { payloadValue } = options || {};\n payloadValue = typeof payloadValue === 'object' ? payloadValue : {};\n return !!(this.payloadValues.get(showIfKey) ?? payloadValue[showIfKey]);\n }\n\n htmlCodeBlock(node: JSONContent, options?: NodeOptions): JSX.Element {\n const show = this.shouldShow(node, options);\n if (!show) {\n return <></>;\n }\n\n // the text can be a proper html code block\n // or only the body of the html\n // so we need to wrap it in a proper html tag\n const text =\n node.content?.reduce((acc, n) => {\n if (n?.type === 'text') {\n return acc + n?.text;\n } else if (n?.type === 'variable') {\n const value = this.getVariableValue(\n n?.attrs?.id,\n n?.attrs?.fallback,\n options\n );\n return acc + value;\n }\n\n return acc;\n }, '') || '';\n\n // we will inline the css in the html\n // so that it can be rendered properly\n const inlineCssHtml = juice(text);\n const doc = parse(inlineCssHtml);\n const head = doc?.querySelector('head');\n head?.remove();\n const html = doc.toString();\n\n return (\n <table\n align=\"left\"\n width=\"100%\"\n border={0}\n cellPadding=\"0\"\n cellSpacing=\"0\"\n role=\"presentation\"\n >\n <tbody>\n <tr style={{ width: '100%' }}>\n <td\n style={{ width: '100%' }}\n dangerouslySetInnerHTML={{\n __html: html,\n }}\n />\n </tr>\n </tbody>\n </table>\n );\n }\n\n private inlineImage(node: JSONContent, options?: NodeOptions): JSX.Element {\n const { attrs } = node;\n let {\n src,\n isSrcVariable,\n alt = '',\n title = '',\n height = DEFAULT_INLINE_IMAGE_HEIGHT,\n width = DEFAULT_INLINE_IMAGE_WIDTH,\n externalLink = '',\n isExternalLinkVariable,\n } = attrs || {};\n\n src = isSrcVariable ? this.variableUrlValue(src, options) : src;\n externalLink = isExternalLinkVariable\n ? this.variableUrlValue(externalLink, options)\n : externalLink;\n\n const image = (\n <img\n src={src}\n alt={alt}\n title={title}\n width={width}\n height={height}\n style={{\n display: 'inline',\n verticalAlign: 'middle',\n width: `${width}px`,\n height: `${height}px`,\n outline: 'none',\n border: 'none',\n textDecoration: 'none',\n }}\n />\n );\n\n if (!externalLink) {\n return image;\n }\n\n return (\n <a\n href={externalLink}\n rel=\"noopener noreferrer\"\n style={{\n display: 'inline',\n textDecoration: 'none',\n }}\n target=\"_blank\"\n >\n {image}\n </a>\n );\n }\n}\n","import type { JSONContent } from '@tiptap/core';\nimport { Maily } from './maily';\nimport type { MailyConfig, RenderOptions } from './maily';\n\nexport async function render(\n content: JSONContent,\n config?: MailyConfig & RenderOptions\n): Promise<string> {\n const { theme, preview, ...rest } = config || {};\n\n const maily = new Maily(content);\n maily.setPreviewText(preview);\n maily.setTheme(theme || {});\n\n return maily.render(rest);\n}\n"],"x_google_ignoreList":[0],"mappings":"0ZAoLA,MA9DM,EA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CAAG,EACd,CACF,MACA,gBACA,MAAM,GACN,QAAQ,GACR,SAAS,EACT,QAAQ,EACR,eAAe,GACf,yBACD,CAAG,GAAS,CAAE,EAGf,AADA,EAAM,EAAgB,KAAK,iBAAiB,EAAK,EAAQ,CAAG,EAC5D,EAAe,EACX,KAAK,iBAAiB,EAAc,EAAQ,CAC5C,EAEJ,IAAM,EACJ,EAAC,MAAA,CACM,MACA,MACE,QACA,QACC,SACR,MAAO,CACL,QAAS,SACT,cAAe,SACf,OAAQ,EAAE,EAAM,IAChB,QAAS,EAAE,EAAO,IAClB,QAAS,OACT,OAAQ,OACR,eAAgB,MACjB,GACD,CAOJ,OAJK,EAKH,EAAC,IAAA,CACC,KAAM,EACN,IAAI,sBACJ,MAAO,CACL,QAAS,SACT,eAAgB,MACjB,EACD,OAAO,kBAEN,GACC,CAdG,CAgBV,CACF,EC/xDD,eAAsB,GACpBS,EACAC,EACiB,CAGjB,GAFM,CAAE,QAAO,UAAS,GAAG,EAAM,CAAG,GAAU,CAAE,EAE1C,EAAQ,IAAI,GAAM,GAIxB,MAHA,GAAM,eAAe,EAAQ,CAC7B,EAAM,SAAS,GAAS,CAAE,EAAC,CAEpB,EAAM,OAAO,EAAK,AAC1B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maily-to/render",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "private": false,
5
5
  "description": "A transformer that converts Maily content into HTML email templates.",
6
6
  "sideEffects": false,
@@ -22,6 +22,15 @@
22
22
  }
23
23
  }
24
24
  },
25
+ "scripts": {
26
+ "dev": "tsdown --watch",
27
+ "clean": "rm -rf dist",
28
+ "build": "tsdown",
29
+ "lint": "eslint .",
30
+ "lint:fix": "eslint . --fix",
31
+ "test:watch": "vitest",
32
+ "test": "vitest run"
33
+ },
25
34
  "repository": {
26
35
  "type": "git",
27
36
  "url": "git+https://github.com/arikchakma/maily.to.git",
@@ -39,11 +48,11 @@
39
48
  "devDependencies": {
40
49
  "@antfu/utils": "^9.2.0",
41
50
  "@babel/preset-react": "^7.27.1",
51
+ "@maily-to/shared": "workspace:*",
42
52
  "@tiptap/core": "^2.11.5",
43
53
  "@types/react": "^19.1.10",
44
- "typescript": "^5.9.2",
45
- "@maily-to/shared": "0.0.2",
46
- "tsconfig": "0.0.0"
54
+ "tsconfig": "workspace:*",
55
+ "typescript": "^5.9.2"
47
56
  },
48
57
  "dependencies": {
49
58
  "@react-email/components": "^0.5.1",
@@ -56,14 +65,5 @@
56
65
  },
57
66
  "publishConfig": {
58
67
  "access": "public"
59
- },
60
- "scripts": {
61
- "dev": "tsdown --watch",
62
- "clean": "rm -rf dist",
63
- "build": "tsdown",
64
- "lint": "eslint .",
65
- "lint:fix": "eslint . --fix",
66
- "test:watch": "vitest",
67
- "test": "vitest run"
68
68
  }
69
- }
69
+ }