@caring-dev/react-notion-x 7.8.3 → 7.8.5

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.
package/build/index.js CHANGED
@@ -175,15 +175,13 @@ var require_lodash = __commonJS({
175
175
  }
176
176
  });
177
177
 
178
- // src/components/header.tsx
179
- import { getPageBreadcrumbs } from "notion-utils";
180
- import React15 from "react";
181
- import { useHotkeys } from "react-hotkeys-hook";
178
+ // src/components/button.tsx
179
+ import React16 from "react";
182
180
 
183
181
  // src/context.tsx
184
182
  import "notion-types";
185
183
  import { defaultMapImageUrl, defaultMapPageUrl } from "notion-utils";
186
- import React10 from "react";
184
+ import React15 from "react";
187
185
 
188
186
  // src/components/asset-wrapper.tsx
189
187
  import "notion-types";
@@ -191,26 +189,27 @@ import { parsePageId as parsePageId2 } from "notion-utils";
191
189
 
192
190
  // src/utils.ts
193
191
  import "notion-types";
192
+ import { getBlockValue } from "notion-utils";
194
193
  import { formatDate, formatNotionDateTime, isUrl } from "notion-utils";
195
194
  var cs = (...classes) => classes.filter((a) => !!a).join(" ");
196
195
  var groupBlockContent = (blockMap) => {
197
- var _a, _b, _c, _d;
196
+ var _a, _b;
198
197
  const output = [];
199
198
  let lastType;
200
199
  let index = -1;
201
200
  for (const id of Object.keys(blockMap)) {
202
- const blockValue = (_a = blockMap[id]) == null ? void 0 : _a.value;
201
+ const blockValue = getBlockValue(blockMap[id]);
203
202
  if (blockValue) {
204
203
  if (blockValue.content)
205
204
  for (const blockId of blockValue.content) {
206
- const blockType = (_c = (_b = blockMap[blockId]) == null ? void 0 : _b.value) == null ? void 0 : _c.type;
205
+ const blockType = (_a = getBlockValue(blockMap[blockId])) == null ? void 0 : _a.type;
207
206
  if (blockType && blockType !== lastType) {
208
207
  index++;
209
208
  lastType = blockType;
210
209
  output[index] = [];
211
210
  }
212
211
  if (index > -1) {
213
- (_d = output[index]) == null ? void 0 : _d.push(blockId);
212
+ (_b = output[index]) == null ? void 0 : _b.push(blockId);
214
213
  }
215
214
  }
216
215
  }
@@ -226,17 +225,17 @@ var getListNumber = (blockId, blockMap) => {
226
225
  return;
227
226
  }
228
227
  const groupIndex = group.indexOf(blockId) + 1;
229
- const startIndex = (_b = (_a = blockMap[blockId]) == null ? void 0 : _a.value.format) == null ? void 0 : _b.list_start_index;
230
- return ((_c = blockMap[blockId]) == null ? void 0 : _c.value.type) === "numbered_list" ? startIndex != null ? startIndex : groupIndex : groupIndex;
228
+ const startIndex = (_b = (_a = getBlockValue(blockMap[blockId])) == null ? void 0 : _a.format) == null ? void 0 : _b.list_start_index;
229
+ return ((_c = getBlockValue(blockMap[blockId])) == null ? void 0 : _c.type) === "numbered_list" ? startIndex != null ? startIndex : groupIndex : groupIndex;
231
230
  };
232
231
  var getListNestingLevel = (blockId, blockMap) => {
233
- var _a, _b, _c;
232
+ var _a;
234
233
  let level = 0;
235
234
  let currentBlockId = blockId;
236
235
  while (true) {
237
- const parentId = (_b = (_a = blockMap[currentBlockId]) == null ? void 0 : _a.value) == null ? void 0 : _b.parent_id;
236
+ const parentId = (_a = getBlockValue(blockMap[currentBlockId])) == null ? void 0 : _a.parent_id;
238
237
  if (!parentId) break;
239
- const parentBlock = (_c = blockMap[parentId]) == null ? void 0 : _c.value;
238
+ const parentBlock = getBlockValue(blockMap[parentId]);
240
239
  if (!parentBlock) break;
241
240
  if (parentBlock.type === "numbered_list") {
242
241
  level++;
@@ -1017,7 +1016,7 @@ function Asset({
1017
1016
 
1018
1017
  // src/components/text.tsx
1019
1018
  import "notion-types";
1020
- import { parsePageId } from "notion-utils";
1019
+ import { getBlockValue as getBlockValue2, parsePageId } from "notion-utils";
1021
1020
  import React8 from "react";
1022
1021
 
1023
1022
  // src/components/eoi.tsx
@@ -1390,11 +1389,10 @@ function Text({
1390
1389
  }
1391
1390
  const formatted = decorations.reduce(
1392
1391
  (element, decorator) => {
1393
- var _a, _b, _c, _d, _e;
1394
1392
  switch (decorator[0]) {
1395
1393
  case "p": {
1396
1394
  const blockId = decorator[1];
1397
- const linkedBlock = (_a = recordMap.block[blockId]) == null ? void 0 : _a.value;
1395
+ const linkedBlock = getBlockValue2(recordMap.block[blockId]);
1398
1396
  if (!linkedBlock) {
1399
1397
  console.log('"p" missing block', blockId);
1400
1398
  return null;
@@ -1413,7 +1411,7 @@ function Text({
1413
1411
  const id = decorator[1][1];
1414
1412
  switch (linkType) {
1415
1413
  case "u": {
1416
- const user = (_b = recordMap.notion_user[id]) == null ? void 0 : _b.value;
1414
+ const user = getBlockValue2(recordMap.notion_user[id]);
1417
1415
  if (!user) {
1418
1416
  console.log('"\u2023" missing user', id);
1419
1417
  return null;
@@ -1431,7 +1429,7 @@ function Text({
1431
1429
  );
1432
1430
  }
1433
1431
  default: {
1434
- const linkedBlock = (_c = recordMap.block[id]) == null ? void 0 : _c.value;
1432
+ const linkedBlock = getBlockValue2(recordMap.block[id]);
1435
1433
  if (!linkedBlock) {
1436
1434
  console.log('"\u2023" missing block', linkType, id);
1437
1435
  return null;
@@ -1514,7 +1512,7 @@ function Text({
1514
1512
  }
1515
1513
  case "u": {
1516
1514
  const userId = decorator[1];
1517
- const user = (_d = recordMap.notion_user[userId]) == null ? void 0 : _d.value;
1515
+ const user = getBlockValue2(recordMap.notion_user[userId]);
1518
1516
  if (!user) {
1519
1517
  console.log("missing user", userId);
1520
1518
  return null;
@@ -1530,7 +1528,13 @@ function Text({
1530
1528
  }
1531
1529
  case "eoi": {
1532
1530
  const blockId = decorator[1];
1533
- const externalObjectInstance = (_e = recordMap.block[blockId]) == null ? void 0 : _e.value;
1531
+ const externalObjectInstance = getBlockValue2(
1532
+ recordMap.block[blockId]
1533
+ );
1534
+ if (!externalObjectInstance) {
1535
+ console.log('"eoi" missing block', blockId);
1536
+ return null;
1537
+ }
1534
1538
  return /* @__PURE__ */ jsx13(EOI, { block: externalObjectInstance, inline: true });
1535
1539
  }
1536
1540
  case "si":
@@ -1635,271 +1639,39 @@ function Checkbox({
1635
1639
  return /* @__PURE__ */ jsx16("span", { className: "notion-property notion-property-checkbox", children: content });
1636
1640
  }
1637
1641
 
1638
- // src/next.tsx
1639
- import React9 from "react";
1640
- import isEqual from "react-fast-compare";
1641
- import { jsx as jsx17 } from "react/jsx-runtime";
1642
- var wrapNextImage = (NextImage) => {
1643
- return React9.memo(function ReactNotionXNextImage({
1644
- src,
1645
- alt,
1646
- width,
1647
- height,
1648
- className,
1649
- fill,
1650
- ...rest
1651
- }) {
1652
- if (fill === "undefined") {
1653
- fill = !(width && height);
1654
- }
1655
- return /* @__PURE__ */ jsx17(
1656
- NextImage,
1657
- {
1658
- className,
1659
- src,
1660
- alt,
1661
- width: !fill && width && height ? width : void 0,
1662
- height: !fill && width && height ? height : void 0,
1663
- fill,
1664
- ...rest
1665
- }
1666
- );
1667
- }, isEqual);
1668
- };
1669
- var wrapNextLegacyImage = (NextLegacyImage) => {
1670
- return React9.memo(function ReactNotionXNextLegacyImage({
1671
- src,
1672
- alt,
1673
- width,
1674
- height,
1675
- className,
1676
- style,
1677
- layout,
1678
- ...rest
1679
- }) {
1680
- if (!layout) {
1681
- layout = width && height ? "intrinsic" : "fill";
1682
- }
1683
- return /* @__PURE__ */ jsx17(
1684
- NextLegacyImage,
1685
- {
1686
- className,
1687
- src,
1688
- alt,
1689
- width: layout === "intrinsic" && width,
1690
- height: layout === "intrinsic" && height,
1691
- objectFit: style == null ? void 0 : style.objectFit,
1692
- objectPosition: style == null ? void 0 : style.objectPosition,
1693
- layout,
1694
- ...rest
1695
- }
1696
- );
1697
- }, isEqual);
1698
- };
1699
- function wrapNextLink(NextLink) {
1700
- return ({
1701
- href,
1702
- as,
1703
- passHref,
1704
- prefetch,
1705
- replace,
1706
- scroll,
1707
- shallow,
1708
- locale,
1709
- ...linkProps
1710
- }) => {
1711
- return /* @__PURE__ */ jsx17(
1712
- NextLink,
1713
- {
1714
- href,
1715
- as,
1716
- passHref,
1717
- prefetch,
1718
- replace,
1719
- scroll,
1720
- shallow,
1721
- locale,
1722
- legacyBehavior: true,
1723
- children: /* @__PURE__ */ jsx17("a", { ...linkProps })
1724
- }
1725
- );
1726
- };
1727
- }
1728
-
1729
- // src/context.tsx
1730
- import { jsx as jsx18 } from "react/jsx-runtime";
1731
- function DefaultLink(props) {
1732
- return /* @__PURE__ */ jsx18("a", { target: "_blank", rel: "noopener noreferrer", ...props });
1733
- }
1734
- var DefaultLinkMemo = React10.memo(DefaultLink);
1735
- function DefaultPageLink(props) {
1736
- return /* @__PURE__ */ jsx18("a", { ...props });
1737
- }
1738
- var DefaultPageLinkMemo = React10.memo(DefaultPageLink);
1739
- function DefaultEmbed(props) {
1740
- return /* @__PURE__ */ jsx18(AssetWrapper, { ...props });
1741
- }
1742
- var DefaultHeader = Header;
1743
- function dummyLink({ href, rel, target, title, ...rest }) {
1744
- return /* @__PURE__ */ jsx18("span", { ...rest });
1745
- }
1746
- var dummyComponent = (name) => () => {
1747
- console.warn(
1748
- `Warning: using empty component "${name}" (you should override this in NotionRenderer.components)`
1749
- );
1750
- return null;
1751
- };
1752
- var dummyOverrideFn = (_, defaultValueFn) => defaultValueFn();
1753
- var defaultComponents = {
1754
- Image: null,
1755
- // disable custom images by default
1756
- Link: DefaultLinkMemo,
1757
- PageLink: DefaultPageLinkMemo,
1758
- Checkbox,
1759
- Callout: void 0,
1760
- // use the built-in callout rendering by default
1761
- Code: dummyComponent("Code"),
1762
- Equation: dummyComponent("Equation"),
1763
- Collection: dummyComponent("Collection"),
1764
- Property: void 0,
1765
- // use the built-in property rendering by default
1766
- propertyTextValue: dummyOverrideFn,
1767
- propertySelectValue: dummyOverrideFn,
1768
- propertyRelationValue: dummyOverrideFn,
1769
- propertyFormulaValue: dummyOverrideFn,
1770
- propertyTitleValue: dummyOverrideFn,
1771
- propertyPersonValue: dummyOverrideFn,
1772
- propertyFileValue: dummyOverrideFn,
1773
- propertyCheckboxValue: dummyOverrideFn,
1774
- propertyUrlValue: dummyOverrideFn,
1775
- propertyEmailValue: dummyOverrideFn,
1776
- propertyPhoneNumberValue: dummyOverrideFn,
1777
- propertyNumberValue: dummyOverrideFn,
1778
- propertyLastEditedTimeValue: dummyOverrideFn,
1779
- propertyCreatedTimeValue: dummyOverrideFn,
1780
- propertyDateValue: dummyOverrideFn,
1781
- propertyAutoIncrementIdValue: dummyOverrideFn,
1782
- Pdf: dummyComponent("Pdf"),
1783
- Tweet: dummyComponent("Tweet"),
1784
- Modal: dummyComponent("Modal"),
1785
- Header: DefaultHeader,
1786
- Embed: DefaultEmbed
1787
- };
1788
- var defaultNotionContext = {
1789
- recordMap: {
1790
- block: {},
1791
- collection: {},
1792
- collection_view: {},
1793
- collection_query: {},
1794
- notion_user: {},
1795
- signed_urls: {}
1796
- },
1797
- components: defaultComponents,
1798
- mapPageUrl: defaultMapPageUrl(),
1799
- mapImageUrl: defaultMapImageUrl,
1800
- searchNotion: void 0,
1801
- isShowingSearch: false,
1802
- onHideSearch: void 0,
1803
- fullPage: false,
1804
- darkMode: false,
1805
- previewImages: false,
1806
- forceCustomImages: false,
1807
- showCollectionViewDropdown: true,
1808
- linkTableTitleProperties: true,
1809
- isLinkCollectionToUrlProperty: false,
1810
- showTableOfContents: false,
1811
- minTableOfContentsItems: 3,
1812
- defaultPageIcon: null,
1813
- defaultPageCover: null,
1814
- defaultPageCoverPosition: 0.5,
1815
- zoom: null
1816
- };
1817
- var ctx = React10.createContext(defaultNotionContext);
1818
- function NotionContextProvider({
1819
- components: themeComponents = {},
1820
- children,
1821
- mapPageUrl,
1822
- mapImageUrl,
1823
- rootPageId,
1824
- ...rest
1825
- }) {
1826
- for (const key of Object.keys(rest)) {
1827
- if (rest[key] === void 0) {
1828
- delete rest[key];
1829
- }
1830
- }
1831
- const wrappedThemeComponents = React10.useMemo(
1832
- () => ({
1833
- ...themeComponents
1834
- }),
1835
- [themeComponents]
1836
- );
1837
- if (wrappedThemeComponents.nextImage && wrappedThemeComponents.nextLegacyImage) {
1838
- console.warn(
1839
- "You should not pass both nextImage and nextLegacyImage. Only nextImage component will be used."
1840
- );
1841
- wrappedThemeComponents.Image = wrapNextImage(themeComponents.nextImage);
1842
- } else if (wrappedThemeComponents.nextImage) {
1843
- wrappedThemeComponents.Image = wrapNextImage(themeComponents.nextImage);
1844
- } else if (wrappedThemeComponents.nextLegacyImage) {
1845
- wrappedThemeComponents.Image = wrapNextLegacyImage(
1846
- themeComponents.nextLegacyImage
1847
- );
1848
- }
1849
- if (wrappedThemeComponents.nextLink) {
1850
- wrappedThemeComponents.nextLink = wrapNextLink(themeComponents.nextLink);
1851
- }
1852
- for (const key of Object.keys(wrappedThemeComponents)) {
1853
- if (!wrappedThemeComponents[key]) {
1854
- delete wrappedThemeComponents[key];
1855
- }
1856
- }
1857
- const value = React10.useMemo(
1858
- () => ({
1859
- ...defaultNotionContext,
1860
- ...rest,
1861
- rootPageId,
1862
- mapPageUrl: mapPageUrl != null ? mapPageUrl : defaultMapPageUrl(rootPageId),
1863
- mapImageUrl: mapImageUrl != null ? mapImageUrl : defaultMapImageUrl,
1864
- components: { ...defaultComponents, ...wrappedThemeComponents }
1865
- }),
1866
- [mapImageUrl, mapPageUrl, wrappedThemeComponents, rootPageId, rest]
1867
- );
1868
- return /* @__PURE__ */ jsx18(ctx.Provider, { value, children });
1869
- }
1870
- var NotionContextConsumer = ctx.Consumer;
1871
- var useNotionContext = () => {
1872
- return React10.useContext(ctx);
1873
- };
1642
+ // src/components/header.tsx
1643
+ import { getPageBreadcrumbs } from "notion-utils";
1644
+ import React13 from "react";
1645
+ import { useHotkeys } from "react-hotkeys-hook";
1874
1646
 
1875
1647
  // src/icons/search-icon.tsx
1876
1648
  import "react";
1877
- import { jsx as jsx19 } from "react/jsx-runtime";
1649
+ import { jsx as jsx17 } from "react/jsx-runtime";
1878
1650
  function SearchIcon(props) {
1879
1651
  const { className, ...rest } = props;
1880
- return /* @__PURE__ */ jsx19("svg", { className: cs("notion-icon", className), viewBox: "0 0 17 17", ...rest, children: /* @__PURE__ */ jsx19("path", { d: "M6.78027 13.6729C8.24805 13.6729 9.60156 13.1982 10.709 12.4072L14.875 16.5732C15.0684 16.7666 15.3232 16.8633 15.5957 16.8633C16.167 16.8633 16.5713 16.4238 16.5713 15.8613C16.5713 15.5977 16.4834 15.3516 16.29 15.1582L12.1504 11.0098C13.0205 9.86719 13.5391 8.45215 13.5391 6.91406C13.5391 3.19629 10.498 0.155273 6.78027 0.155273C3.0625 0.155273 0.0214844 3.19629 0.0214844 6.91406C0.0214844 10.6318 3.0625 13.6729 6.78027 13.6729ZM6.78027 12.2139C3.87988 12.2139 1.48047 9.81445 1.48047 6.91406C1.48047 4.01367 3.87988 1.61426 6.78027 1.61426C9.68066 1.61426 12.0801 4.01367 12.0801 6.91406C12.0801 9.81445 9.68066 12.2139 6.78027 12.2139Z" }) });
1652
+ return /* @__PURE__ */ jsx17("svg", { className: cs("notion-icon", className), viewBox: "0 0 17 17", ...rest, children: /* @__PURE__ */ jsx17("path", { d: "M6.78027 13.6729C8.24805 13.6729 9.60156 13.1982 10.709 12.4072L14.875 16.5732C15.0684 16.7666 15.3232 16.8633 15.5957 16.8633C16.167 16.8633 16.5713 16.4238 16.5713 15.8613C16.5713 15.5977 16.4834 15.3516 16.29 15.1582L12.1504 11.0098C13.0205 9.86719 13.5391 8.45215 13.5391 6.91406C13.5391 3.19629 10.498 0.155273 6.78027 0.155273C3.0625 0.155273 0.0214844 3.19629 0.0214844 6.91406C0.0214844 10.6318 3.0625 13.6729 6.78027 13.6729ZM6.78027 12.2139C3.87988 12.2139 1.48047 9.81445 1.48047 6.91406C1.48047 4.01367 3.87988 1.61426 6.78027 1.61426C9.68066 1.61426 12.0801 4.01367 12.0801 6.91406C12.0801 9.81445 9.68066 12.2139 6.78027 12.2139Z" }) });
1881
1653
  }
1882
1654
 
1883
1655
  // src/components/search-dialog.tsx
1884
1656
  var import_lodash = __toESM(require_lodash(), 1);
1885
1657
  import { getBlockParentPage, getBlockTitle as getBlockTitle3 } from "notion-utils";
1886
- import React14 from "react";
1658
+ import React12 from "react";
1887
1659
 
1888
1660
  // src/icons/clear-icon.tsx
1889
1661
  import "react";
1890
- import { jsx as jsx20 } from "react/jsx-runtime";
1662
+ import { jsx as jsx18 } from "react/jsx-runtime";
1891
1663
  function ClearIcon(props) {
1892
1664
  const { className, ...rest } = props;
1893
- return /* @__PURE__ */ jsx20("svg", { className: cs("notion-icon", className), ...rest, viewBox: "0 0 30 30", children: /* @__PURE__ */ jsx20("path", { d: "M15,0C6.716,0,0,6.716,0,15s6.716,15,15,15s15-6.716,15-15S23.284,0,15,0z M22,20.6L20.6,22L15,16.4L9.4,22L8,20.6l5.6-5.6 L8,9.4L9.4,8l5.6,5.6L20.6,8L22,9.4L16.4,15L22,20.6z" }) });
1665
+ return /* @__PURE__ */ jsx18("svg", { className: cs("notion-icon", className), ...rest, viewBox: "0 0 30 30", children: /* @__PURE__ */ jsx18("path", { d: "M15,0C6.716,0,0,6.716,0,15s6.716,15,15,15s15-6.716,15-15S23.284,0,15,0z M22,20.6L20.6,22L15,16.4L9.4,22L8,20.6l5.6-5.6 L8,9.4L9.4,8l5.6,5.6L20.6,8L22,9.4L16.4,15L22,20.6z" }) });
1894
1666
  }
1895
1667
 
1896
1668
  // src/icons/loading-icon.tsx
1897
1669
  import "react";
1898
- import { jsx as jsx21, jsxs as jsxs8 } from "react/jsx-runtime";
1670
+ import { jsx as jsx19, jsxs as jsxs8 } from "react/jsx-runtime";
1899
1671
  function LoadingIcon(props) {
1900
1672
  const { className, ...rest } = props;
1901
1673
  return /* @__PURE__ */ jsxs8("svg", { className: cs("notion-icon", className), ...rest, viewBox: "0 0 24 24", children: [
1902
- /* @__PURE__ */ jsx21("defs", { children: /* @__PURE__ */ jsxs8(
1674
+ /* @__PURE__ */ jsx19("defs", { children: /* @__PURE__ */ jsxs8(
1903
1675
  "linearGradient",
1904
1676
  {
1905
1677
  x1: "28.1542969%",
@@ -1908,8 +1680,8 @@ function LoadingIcon(props) {
1908
1680
  y2: "17.7832031%",
1909
1681
  id: "linearGradient-1",
1910
1682
  children: [
1911
- /* @__PURE__ */ jsx21("stop", { stopColor: "rgba(164, 164, 164, 1)", offset: "0%" }),
1912
- /* @__PURE__ */ jsx21(
1683
+ /* @__PURE__ */ jsx19("stop", { stopColor: "rgba(164, 164, 164, 1)", offset: "0%" }),
1684
+ /* @__PURE__ */ jsx19(
1913
1685
  "stop",
1914
1686
  {
1915
1687
  stopColor: "rgba(164, 164, 164, 0)",
@@ -1920,8 +1692,8 @@ function LoadingIcon(props) {
1920
1692
  ]
1921
1693
  }
1922
1694
  ) }),
1923
- /* @__PURE__ */ jsx21("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", children: /* @__PURE__ */ jsx21("g", { transform: "translate(-236.000000, -286.000000)", children: /* @__PURE__ */ jsxs8("g", { transform: "translate(238.000000, 286.000000)", children: [
1924
- /* @__PURE__ */ jsx21(
1695
+ /* @__PURE__ */ jsx19("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", children: /* @__PURE__ */ jsx19("g", { transform: "translate(-236.000000, -286.000000)", children: /* @__PURE__ */ jsxs8("g", { transform: "translate(238.000000, 286.000000)", children: [
1696
+ /* @__PURE__ */ jsx19(
1925
1697
  "circle",
1926
1698
  {
1927
1699
  id: "Oval-2",
@@ -1932,7 +1704,7 @@ function LoadingIcon(props) {
1932
1704
  r: "10"
1933
1705
  }
1934
1706
  ),
1935
- /* @__PURE__ */ jsx21(
1707
+ /* @__PURE__ */ jsx19(
1936
1708
  "path",
1937
1709
  {
1938
1710
  d: "M10,2 C4.4771525,2 0,6.4771525 0,12",
@@ -1941,7 +1713,7 @@ function LoadingIcon(props) {
1941
1713
  strokeWidth: "4"
1942
1714
  }
1943
1715
  ),
1944
- /* @__PURE__ */ jsx21(
1716
+ /* @__PURE__ */ jsx19(
1945
1717
  "rect",
1946
1718
  {
1947
1719
  id: "Rectangle-1",
@@ -1958,8 +1730,8 @@ function LoadingIcon(props) {
1958
1730
  }
1959
1731
 
1960
1732
  // src/components/search-dialog.tsx
1961
- import { Fragment as Fragment4, jsx as jsx22, jsxs as jsxs9 } from "react/jsx-runtime";
1962
- var SearchDialog = class extends React14.Component {
1733
+ import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs9 } from "react/jsx-runtime";
1734
+ var SearchDialog = class extends React12.Component {
1963
1735
  constructor(props) {
1964
1736
  super(props);
1965
1737
  __publicField(this, "state", {
@@ -2045,7 +1817,7 @@ var SearchDialog = class extends React14.Component {
2045
1817
  this.setState({ isLoading: false, searchResult, searchError });
2046
1818
  }
2047
1819
  });
2048
- this._inputRef = React14.createRef();
1820
+ this._inputRef = React12.createRef();
2049
1821
  }
2050
1822
  componentDidMount() {
2051
1823
  this._search = (0, import_lodash.default)(this._searchImpl.bind(this), 1e3);
@@ -2055,9 +1827,9 @@ var SearchDialog = class extends React14.Component {
2055
1827
  const { isOpen, onClose } = this.props;
2056
1828
  const { isLoading, query, searchResult, searchError } = this.state;
2057
1829
  const hasQuery = !!query.trim();
2058
- return /* @__PURE__ */ jsx22(NotionContextConsumer, { children: (ctx2) => {
1830
+ return /* @__PURE__ */ jsx20(NotionContextConsumer, { children: (ctx2) => {
2059
1831
  const { components, defaultPageIcon, mapPageUrl } = ctx2;
2060
- return /* @__PURE__ */ jsx22(
1832
+ return /* @__PURE__ */ jsx20(
2061
1833
  components.Modal,
2062
1834
  {
2063
1835
  isOpen,
@@ -2068,8 +1840,8 @@ var SearchDialog = class extends React14.Component {
2068
1840
  onAfterOpen: this._onAfterOpen,
2069
1841
  children: /* @__PURE__ */ jsxs9("div", { className: "quickFindMenu", children: [
2070
1842
  /* @__PURE__ */ jsxs9("div", { className: "searchBar", children: [
2071
- /* @__PURE__ */ jsx22("div", { className: "inlineIcon", children: isLoading ? /* @__PURE__ */ jsx22(LoadingIcon, { className: "loadingIcon" }) : /* @__PURE__ */ jsx22(SearchIcon, {}) }),
2072
- /* @__PURE__ */ jsx22(
1843
+ /* @__PURE__ */ jsx20("div", { className: "inlineIcon", children: isLoading ? /* @__PURE__ */ jsx20(LoadingIcon, { className: "loadingIcon" }) : /* @__PURE__ */ jsx20(SearchIcon, {}) }),
1844
+ /* @__PURE__ */ jsx20(
2073
1845
  "input",
2074
1846
  {
2075
1847
  className: "searchInput",
@@ -2079,23 +1851,23 @@ var SearchDialog = class extends React14.Component {
2079
1851
  onChange: this._onChangeQuery
2080
1852
  }
2081
1853
  ),
2082
- query && /* @__PURE__ */ jsx22(
1854
+ query && /* @__PURE__ */ jsx20(
2083
1855
  "div",
2084
1856
  {
2085
1857
  role: "button",
2086
1858
  className: "clearButton",
2087
1859
  onClick: this._onClearQuery,
2088
- children: /* @__PURE__ */ jsx22(ClearIcon, { className: "clearIcon" })
1860
+ children: /* @__PURE__ */ jsx20(ClearIcon, { className: "clearIcon" })
2089
1861
  }
2090
1862
  )
2091
1863
  ] }),
2092
- hasQuery && searchResult && /* @__PURE__ */ jsx22(Fragment4, { children: searchResult.results.length ? /* @__PURE__ */ jsxs9(
1864
+ hasQuery && searchResult && /* @__PURE__ */ jsx20(Fragment4, { children: searchResult.results.length ? /* @__PURE__ */ jsxs9(
2093
1865
  NotionContextProvider,
2094
1866
  {
2095
1867
  ...ctx2,
2096
1868
  recordMap: searchResult.recordMap,
2097
1869
  children: [
2098
- /* @__PURE__ */ jsx22("div", { className: "resultsPane", children: searchResult.results.map((result) => {
1870
+ /* @__PURE__ */ jsx20("div", { className: "resultsPane", children: searchResult.results.map((result) => {
2099
1871
  var _a;
2100
1872
  return /* @__PURE__ */ jsxs9(
2101
1873
  components.PageLink,
@@ -2107,14 +1879,14 @@ var SearchDialog = class extends React14.Component {
2107
1879
  searchResult.recordMap
2108
1880
  ),
2109
1881
  children: [
2110
- /* @__PURE__ */ jsx22(
1882
+ /* @__PURE__ */ jsx20(
2111
1883
  PageTitle,
2112
1884
  {
2113
1885
  block: result.page,
2114
1886
  defaultIcon: defaultPageIcon
2115
1887
  }
2116
1888
  ),
2117
- ((_a = result.highlight) == null ? void 0 : _a.html) && /* @__PURE__ */ jsx22(
1889
+ ((_a = result.highlight) == null ? void 0 : _a.html) && /* @__PURE__ */ jsx20(
2118
1890
  "div",
2119
1891
  {
2120
1892
  className: "notion-search-result-highlight",
@@ -2128,17 +1900,17 @@ var SearchDialog = class extends React14.Component {
2128
1900
  result.id
2129
1901
  );
2130
1902
  }) }),
2131
- /* @__PURE__ */ jsx22("footer", { className: "resultsFooter", children: /* @__PURE__ */ jsxs9("div", { children: [
2132
- /* @__PURE__ */ jsx22("span", { className: "resultsCount", children: searchResult.total }),
1903
+ /* @__PURE__ */ jsx20("footer", { className: "resultsFooter", children: /* @__PURE__ */ jsxs9("div", { children: [
1904
+ /* @__PURE__ */ jsx20("span", { className: "resultsCount", children: searchResult.total }),
2133
1905
  searchResult.total === 1 ? " result" : " results"
2134
1906
  ] }) })
2135
1907
  ]
2136
1908
  }
2137
1909
  ) : /* @__PURE__ */ jsxs9("div", { className: "noResultsPane", children: [
2138
- /* @__PURE__ */ jsx22("div", { className: "noResults", children: "No results" }),
2139
- /* @__PURE__ */ jsx22("div", { className: "noResultsDetail", children: "Try different search terms" })
1910
+ /* @__PURE__ */ jsx20("div", { className: "noResults", children: "No results" }),
1911
+ /* @__PURE__ */ jsx20("div", { className: "noResultsDetail", children: "Try different search terms" })
2140
1912
  ] }) }),
2141
- hasQuery && !searchResult && searchError && /* @__PURE__ */ jsx22("div", { className: "noResultsPane", children: /* @__PURE__ */ jsx22("div", { className: "noResults", children: "Search error" }) })
1913
+ hasQuery && !searchResult && searchError && /* @__PURE__ */ jsx20("div", { className: "noResultsPane", children: /* @__PURE__ */ jsx20("div", { className: "noResults", children: "Search error" }) })
2142
1914
  ] })
2143
1915
  }
2144
1916
  );
@@ -2147,13 +1919,13 @@ var SearchDialog = class extends React14.Component {
2147
1919
  };
2148
1920
 
2149
1921
  // src/components/header.tsx
2150
- import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs10 } from "react/jsx-runtime";
1922
+ import { Fragment as Fragment5, jsx as jsx21, jsxs as jsxs10 } from "react/jsx-runtime";
2151
1923
  function Header({
2152
1924
  block
2153
1925
  }) {
2154
- return /* @__PURE__ */ jsx23("header", { className: "notion-header", children: /* @__PURE__ */ jsxs10("div", { className: "notion-nav-header", children: [
2155
- /* @__PURE__ */ jsx23(Breadcrumbs, { block }),
2156
- /* @__PURE__ */ jsx23(Search, { block })
1926
+ return /* @__PURE__ */ jsx21("header", { className: "notion-header", children: /* @__PURE__ */ jsxs10("div", { className: "notion-nav-header", children: [
1927
+ /* @__PURE__ */ jsx21(Breadcrumbs, { block }),
1928
+ /* @__PURE__ */ jsx21(Search, { block })
2157
1929
  ] }) });
2158
1930
  }
2159
1931
  function Breadcrumbs({
@@ -2161,14 +1933,14 @@ function Breadcrumbs({
2161
1933
  rootOnly = false
2162
1934
  }) {
2163
1935
  const { recordMap, mapPageUrl, components } = useNotionContext();
2164
- const breadcrumbs = React15.useMemo(() => {
1936
+ const breadcrumbs = React13.useMemo(() => {
2165
1937
  const tempBreadcrumbs = getPageBreadcrumbs(recordMap, block.id);
2166
1938
  if (rootOnly) {
2167
1939
  return [tempBreadcrumbs == null ? void 0 : tempBreadcrumbs[0]].filter(Boolean);
2168
1940
  }
2169
1941
  return tempBreadcrumbs;
2170
1942
  }, [recordMap, block.id, rootOnly]);
2171
- return /* @__PURE__ */ jsx23("div", { className: "breadcrumbs", children: breadcrumbs == null ? void 0 : breadcrumbs.map((breadcrumb, index) => {
1943
+ return /* @__PURE__ */ jsx21("div", { className: "breadcrumbs", children: breadcrumbs == null ? void 0 : breadcrumbs.map((breadcrumb, index) => {
2172
1944
  if (!breadcrumb) {
2173
1945
  return null;
2174
1946
  }
@@ -2177,23 +1949,23 @@ function Breadcrumbs({
2177
1949
  pageLink: components.PageLink
2178
1950
  };
2179
1951
  if (breadcrumb.active) {
2180
- componentMap.pageLink = (props) => /* @__PURE__ */ jsx23("div", { ...props });
1952
+ componentMap.pageLink = (props) => /* @__PURE__ */ jsx21("div", { ...props });
2181
1953
  } else {
2182
1954
  pageLinkProps.href = mapPageUrl(breadcrumb.pageId);
2183
1955
  }
2184
- return /* @__PURE__ */ jsxs10(React15.Fragment, { children: [
1956
+ return /* @__PURE__ */ jsxs10(React13.Fragment, { children: [
2185
1957
  /* @__PURE__ */ jsxs10(
2186
1958
  componentMap.pageLink,
2187
1959
  {
2188
1960
  className: cs("breadcrumb", breadcrumb.active && "active"),
2189
1961
  ...pageLinkProps,
2190
1962
  children: [
2191
- breadcrumb.icon && /* @__PURE__ */ jsx23(PageIcon, { className: "icon", block: breadcrumb.block }),
2192
- breadcrumb.title && /* @__PURE__ */ jsx23("span", { className: "title", children: breadcrumb.title })
1963
+ breadcrumb.icon && /* @__PURE__ */ jsx21(PageIcon, { className: "icon", block: breadcrumb.block }),
1964
+ breadcrumb.title && /* @__PURE__ */ jsx21("span", { className: "title", children: breadcrumb.title })
2193
1965
  ]
2194
1966
  }
2195
1967
  ),
2196
- index < breadcrumbs.length - 1 && /* @__PURE__ */ jsx23("span", { className: "spacer", children: "/" })
1968
+ index < breadcrumbs.length - 1 && /* @__PURE__ */ jsx21("span", { className: "spacer", children: "/" })
2197
1969
  ] }, breadcrumb.pageId);
2198
1970
  }) }, "breadcrumbs");
2199
1971
  }
@@ -2204,14 +1976,14 @@ function Search({
2204
1976
  }) {
2205
1977
  const { searchNotion, rootPageId, isShowingSearch, onHideSearch } = useNotionContext();
2206
1978
  const onSearchNotion = search || searchNotion;
2207
- const [isSearchOpen, setIsSearchOpen] = React15.useState(isShowingSearch);
2208
- React15.useEffect(() => {
1979
+ const [isSearchOpen, setIsSearchOpen] = React13.useState(isShowingSearch);
1980
+ React13.useEffect(() => {
2209
1981
  setIsSearchOpen(isShowingSearch);
2210
1982
  }, [isShowingSearch]);
2211
- const onOpenSearch = React15.useCallback(() => {
1983
+ const onOpenSearch = React13.useCallback(() => {
2212
1984
  setIsSearchOpen(true);
2213
1985
  }, []);
2214
- const onCloseSearch = React15.useCallback(() => {
1986
+ const onCloseSearch = React13.useCallback(() => {
2215
1987
  setIsSearchOpen(false);
2216
1988
  if (onHideSearch) {
2217
1989
  onHideSearch();
@@ -2236,12 +2008,12 @@ function Search({
2236
2008
  className: cs("breadcrumb", "button", "notion-search-button"),
2237
2009
  onClick: onOpenSearch,
2238
2010
  children: [
2239
- /* @__PURE__ */ jsx23(SearchIcon, { className: "searchIcon" }),
2240
- title && /* @__PURE__ */ jsx23("span", { className: "title", children: title })
2011
+ /* @__PURE__ */ jsx21(SearchIcon, { className: "searchIcon" }),
2012
+ title && /* @__PURE__ */ jsx21("span", { className: "title", children: title })
2241
2013
  ]
2242
2014
  }
2243
2015
  ),
2244
- isSearchOpen && hasSearch && /* @__PURE__ */ jsx23(
2016
+ isSearchOpen && hasSearch && /* @__PURE__ */ jsx21(
2245
2017
  SearchDialog,
2246
2018
  {
2247
2019
  isOpen: isSearchOpen,
@@ -2253,30 +2025,499 @@ function Search({
2253
2025
  ] });
2254
2026
  }
2255
2027
 
2256
- // src/renderer.tsx
2257
- import mediumZoom from "@fisch0920/medium-zoom";
2258
- import "notion-types";
2259
- import * as React20 from "react";
2260
-
2261
- // src/block.tsx
2262
- import {
2263
- getBlockCollectionId,
2264
- getBlockIcon as getBlockIcon2,
2265
- getBlockParentPage as getBlockParentPage2,
2266
- getPageTableOfContents,
2267
- getTextContent as getTextContent2,
2268
- uuidToId as uuidToId2
2269
- } from "notion-utils";
2270
- import React19 from "react";
2271
-
2272
- // src/components/audio.tsx
2273
- import "notion-types";
2274
- import { jsx as jsx24 } from "react/jsx-runtime";
2275
- function Audio({
2276
- block,
2277
- className
2278
- }) {
2279
- var _a, _b, _c;
2028
+ // src/next.tsx
2029
+ import React14 from "react";
2030
+ import isEqual from "react-fast-compare";
2031
+ import { jsx as jsx22 } from "react/jsx-runtime";
2032
+ var wrapNextImage = (NextImage) => {
2033
+ return React14.memo(function ReactNotionXNextImage({
2034
+ src,
2035
+ alt,
2036
+ width,
2037
+ height,
2038
+ className,
2039
+ fill,
2040
+ ...rest
2041
+ }) {
2042
+ if (fill === "undefined") {
2043
+ fill = !(width && height);
2044
+ }
2045
+ return /* @__PURE__ */ jsx22(
2046
+ NextImage,
2047
+ {
2048
+ className,
2049
+ src,
2050
+ alt,
2051
+ width: !fill && width && height ? width : void 0,
2052
+ height: !fill && width && height ? height : void 0,
2053
+ fill,
2054
+ ...rest
2055
+ }
2056
+ );
2057
+ }, isEqual);
2058
+ };
2059
+ var wrapNextLegacyImage = (NextLegacyImage) => {
2060
+ return React14.memo(function ReactNotionXNextLegacyImage({
2061
+ src,
2062
+ alt,
2063
+ width,
2064
+ height,
2065
+ className,
2066
+ style,
2067
+ layout,
2068
+ ...rest
2069
+ }) {
2070
+ if (!layout) {
2071
+ layout = width && height ? "intrinsic" : "fill";
2072
+ }
2073
+ return /* @__PURE__ */ jsx22(
2074
+ NextLegacyImage,
2075
+ {
2076
+ className,
2077
+ src,
2078
+ alt,
2079
+ width: layout === "intrinsic" && width,
2080
+ height: layout === "intrinsic" && height,
2081
+ objectFit: style == null ? void 0 : style.objectFit,
2082
+ objectPosition: style == null ? void 0 : style.objectPosition,
2083
+ layout,
2084
+ ...rest
2085
+ }
2086
+ );
2087
+ }, isEqual);
2088
+ };
2089
+ function wrapNextLink(NextLink) {
2090
+ return ({
2091
+ href,
2092
+ as,
2093
+ passHref,
2094
+ prefetch,
2095
+ replace,
2096
+ scroll,
2097
+ shallow,
2098
+ locale,
2099
+ ...linkProps
2100
+ }) => {
2101
+ return /* @__PURE__ */ jsx22(
2102
+ NextLink,
2103
+ {
2104
+ href,
2105
+ as,
2106
+ passHref,
2107
+ prefetch,
2108
+ replace,
2109
+ scroll,
2110
+ shallow,
2111
+ locale,
2112
+ legacyBehavior: true,
2113
+ children: /* @__PURE__ */ jsx22("a", { ...linkProps })
2114
+ }
2115
+ );
2116
+ };
2117
+ }
2118
+
2119
+ // src/context.tsx
2120
+ import { jsx as jsx23 } from "react/jsx-runtime";
2121
+ function DefaultLink(props) {
2122
+ return /* @__PURE__ */ jsx23("a", { target: "_blank", rel: "noopener noreferrer", ...props });
2123
+ }
2124
+ var DefaultLinkMemo = React15.memo(DefaultLink);
2125
+ function DefaultPageLink(props) {
2126
+ return /* @__PURE__ */ jsx23("a", { ...props });
2127
+ }
2128
+ var DefaultPageLinkMemo = React15.memo(DefaultPageLink);
2129
+ function DefaultEmbed(props) {
2130
+ return /* @__PURE__ */ jsx23(AssetWrapper, { ...props });
2131
+ }
2132
+ var DefaultHeader = Header;
2133
+ function dummyLink({ href, rel, target, title, ...rest }) {
2134
+ return /* @__PURE__ */ jsx23("span", { ...rest });
2135
+ }
2136
+ var dummyComponent = (name) => () => {
2137
+ console.warn(
2138
+ `Warning: using empty component "${name}" (you should override this in NotionRenderer.components)`
2139
+ );
2140
+ return null;
2141
+ };
2142
+ var dummyOverrideFn = (_, defaultValueFn) => defaultValueFn();
2143
+ var defaultComponents = {
2144
+ Image: null,
2145
+ // disable custom images by default
2146
+ Link: DefaultLinkMemo,
2147
+ PageLink: DefaultPageLinkMemo,
2148
+ Checkbox,
2149
+ Callout: void 0,
2150
+ // use the built-in callout rendering by default
2151
+ Button: void 0,
2152
+ // use the built-in button rendering by default
2153
+ Code: dummyComponent("Code"),
2154
+ Equation: dummyComponent("Equation"),
2155
+ Collection: dummyComponent("Collection"),
2156
+ Property: void 0,
2157
+ // use the built-in property rendering by default
2158
+ propertyTextValue: dummyOverrideFn,
2159
+ propertySelectValue: dummyOverrideFn,
2160
+ propertyRelationValue: dummyOverrideFn,
2161
+ propertyFormulaValue: dummyOverrideFn,
2162
+ propertyTitleValue: dummyOverrideFn,
2163
+ propertyPersonValue: dummyOverrideFn,
2164
+ propertyFileValue: dummyOverrideFn,
2165
+ propertyCheckboxValue: dummyOverrideFn,
2166
+ propertyUrlValue: dummyOverrideFn,
2167
+ propertyEmailValue: dummyOverrideFn,
2168
+ propertyPhoneNumberValue: dummyOverrideFn,
2169
+ propertyNumberValue: dummyOverrideFn,
2170
+ propertyLastEditedTimeValue: dummyOverrideFn,
2171
+ propertyCreatedTimeValue: dummyOverrideFn,
2172
+ propertyDateValue: dummyOverrideFn,
2173
+ propertyAutoIncrementIdValue: dummyOverrideFn,
2174
+ Pdf: dummyComponent("Pdf"),
2175
+ Tweet: dummyComponent("Tweet"),
2176
+ Modal: dummyComponent("Modal"),
2177
+ Header: DefaultHeader,
2178
+ Embed: DefaultEmbed
2179
+ };
2180
+ var defaultNotionContext = {
2181
+ recordMap: {
2182
+ block: {},
2183
+ collection: {},
2184
+ collection_view: {},
2185
+ collection_query: {},
2186
+ notion_user: {},
2187
+ signed_urls: {}
2188
+ },
2189
+ components: defaultComponents,
2190
+ mapPageUrl: defaultMapPageUrl(),
2191
+ mapImageUrl: defaultMapImageUrl,
2192
+ searchNotion: void 0,
2193
+ isShowingSearch: false,
2194
+ onHideSearch: void 0,
2195
+ fullPage: false,
2196
+ darkMode: false,
2197
+ previewImages: false,
2198
+ forceCustomImages: false,
2199
+ showCollectionViewDropdown: true,
2200
+ linkTableTitleProperties: true,
2201
+ isLinkCollectionToUrlProperty: false,
2202
+ showTableOfContents: false,
2203
+ minTableOfContentsItems: 3,
2204
+ defaultPageIcon: null,
2205
+ defaultPageCover: null,
2206
+ defaultPageCoverPosition: 0.5,
2207
+ zoom: null
2208
+ };
2209
+ var ctx = React15.createContext(defaultNotionContext);
2210
+ function NotionContextProvider({
2211
+ components: themeComponents = {},
2212
+ children,
2213
+ mapPageUrl,
2214
+ mapImageUrl,
2215
+ rootPageId,
2216
+ ...rest
2217
+ }) {
2218
+ for (const key of Object.keys(rest)) {
2219
+ if (rest[key] === void 0) {
2220
+ delete rest[key];
2221
+ }
2222
+ }
2223
+ const wrappedThemeComponents = React15.useMemo(
2224
+ () => ({
2225
+ ...themeComponents
2226
+ }),
2227
+ [themeComponents]
2228
+ );
2229
+ if (wrappedThemeComponents.nextImage && wrappedThemeComponents.nextLegacyImage) {
2230
+ console.warn(
2231
+ "You should not pass both nextImage and nextLegacyImage. Only nextImage component will be used."
2232
+ );
2233
+ wrappedThemeComponents.Image = wrapNextImage(themeComponents.nextImage);
2234
+ } else if (wrappedThemeComponents.nextImage) {
2235
+ wrappedThemeComponents.Image = wrapNextImage(themeComponents.nextImage);
2236
+ } else if (wrappedThemeComponents.nextLegacyImage) {
2237
+ wrappedThemeComponents.Image = wrapNextLegacyImage(
2238
+ themeComponents.nextLegacyImage
2239
+ );
2240
+ }
2241
+ if (wrappedThemeComponents.nextLink) {
2242
+ wrappedThemeComponents.nextLink = wrapNextLink(themeComponents.nextLink);
2243
+ }
2244
+ for (const key of Object.keys(wrappedThemeComponents)) {
2245
+ if (!wrappedThemeComponents[key]) {
2246
+ delete wrappedThemeComponents[key];
2247
+ }
2248
+ }
2249
+ const value = React15.useMemo(
2250
+ () => ({
2251
+ ...defaultNotionContext,
2252
+ ...rest,
2253
+ rootPageId,
2254
+ mapPageUrl: mapPageUrl != null ? mapPageUrl : defaultMapPageUrl(rootPageId),
2255
+ mapImageUrl: mapImageUrl != null ? mapImageUrl : defaultMapImageUrl,
2256
+ components: { ...defaultComponents, ...wrappedThemeComponents }
2257
+ }),
2258
+ [mapImageUrl, mapPageUrl, wrappedThemeComponents, rootPageId, rest]
2259
+ );
2260
+ return /* @__PURE__ */ jsx23(ctx.Provider, { value, children });
2261
+ }
2262
+ var NotionContextConsumer = ctx.Consumer;
2263
+ var useNotionContext = () => {
2264
+ return React15.useContext(ctx);
2265
+ };
2266
+
2267
+ // src/components/button.tsx
2268
+ import { jsx as jsx24 } from "react/jsx-runtime";
2269
+ function Button({
2270
+ block,
2271
+ blockId,
2272
+ className
2273
+ }) {
2274
+ var _a, _b, _c, _d, _e, _f;
2275
+ const { recordMap, mapPageUrl } = useNotionContext();
2276
+ const [isSuccess, setIsSuccess] = React16.useState(false);
2277
+ const [isLoading, setIsLoading] = React16.useState(false);
2278
+ if (!block || block.type !== "button") {
2279
+ console.warn("Invalid button block:", { block });
2280
+ return null;
2281
+ }
2282
+ const automationId = (_a = block.format) == null ? void 0 : _a.automation_id;
2283
+ const blockColor = ((_b = block.format) == null ? void 0 : _b.block_color) || "default";
2284
+ const title = (_c = block.properties) == null ? void 0 : _c.title;
2285
+ if (!automationId) {
2286
+ return /* @__PURE__ */ jsx24("div", { className: cs("notion-button-block", blockId), children: /* @__PURE__ */ jsx24(
2287
+ "button",
2288
+ {
2289
+ type: "button",
2290
+ className: cs("notion-button", `notion-${blockColor}`, className),
2291
+ children: title ? /* @__PURE__ */ jsx24(Text, { value: title, block }) : "Button"
2292
+ }
2293
+ ) });
2294
+ }
2295
+ const automation = (_e = (_d = recordMap.automation) == null ? void 0 : _d[automationId]) == null ? void 0 : _e.value;
2296
+ if (!automation) {
2297
+ const buttonText2 = title ? getTextContent2(title) : "Button";
2298
+ return /* @__PURE__ */ jsx24("div", { className: cs("notion-button-block", blockId), children: /* @__PURE__ */ jsx24(
2299
+ "button",
2300
+ {
2301
+ type: "button",
2302
+ className: cs("notion-button", `notion-${blockColor}`, className),
2303
+ children: buttonText2
2304
+ }
2305
+ ) });
2306
+ }
2307
+ const buttonText = ((_f = automation.properties) == null ? void 0 : _f.name) || (title ? getTextContent2(title) : "Button");
2308
+ const handleClick = async (e) => {
2309
+ e.preventDefault();
2310
+ if (isLoading) return;
2311
+ setIsSuccess(false);
2312
+ setIsLoading(true);
2313
+ try {
2314
+ await executeAction();
2315
+ } finally {
2316
+ setIsLoading(false);
2317
+ }
2318
+ };
2319
+ const executeAction = async () => {
2320
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g, _h, _i, _j, _k;
2321
+ const firstActionId = (_a2 = automation.action_ids) == null ? void 0 : _a2[0];
2322
+ if (!firstActionId) {
2323
+ console.warn("No actions defined for automation:", automationId);
2324
+ return;
2325
+ }
2326
+ const actionData = (_c2 = (_b2 = recordMap.automation_action) == null ? void 0 : _b2[firstActionId]) == null ? void 0 : _c2.value;
2327
+ if (!actionData) {
2328
+ console.warn("No action data found for ID:", firstActionId);
2329
+ return;
2330
+ }
2331
+ switch (actionData.type) {
2332
+ case "open_page": {
2333
+ const target = (_d2 = actionData.config) == null ? void 0 : _d2.target;
2334
+ if ((target == null ? void 0 : target.type) === "url" && target.url) {
2335
+ window.open(target.url, "_blank", "noopener,noreferrer");
2336
+ } else if ((target == null ? void 0 : target.type) === "page" && target.pageId) {
2337
+ const pageUrl = mapPageUrl(target.pageId);
2338
+ if (pageUrl) {
2339
+ window.location.href = pageUrl;
2340
+ }
2341
+ }
2342
+ break;
2343
+ }
2344
+ case "send_webhook":
2345
+ case "http_request": {
2346
+ const webhookUrl = (_f2 = (_e2 = actionData.config) == null ? void 0 : _e2.url) == null ? void 0 : _f2.trim();
2347
+ if (webhookUrl) {
2348
+ try {
2349
+ if (typeof window !== "undefined" && "/api/webhook-proxy") {
2350
+ const pageBlockId = Object.keys(recordMap.block || {}).find(
2351
+ (id) => {
2352
+ var _a3;
2353
+ const b = (_a3 = recordMap.block[id]) == null ? void 0 : _a3.value;
2354
+ return b && "type" in b && b.type === "page";
2355
+ }
2356
+ );
2357
+ const pageBlock = pageBlockId ? (_g = recordMap.block[pageBlockId]) == null ? void 0 : _g.value : null;
2358
+ if (!pageBlock) {
2359
+ console.warn("No page block found for webhook payload");
2360
+ return;
2361
+ }
2362
+ const payload = {
2363
+ source: {
2364
+ type: "automation",
2365
+ automation_id: automationId,
2366
+ action_id: actionData.id,
2367
+ event_id: crypto.randomUUID(),
2368
+ user_id: pageBlock.created_by_id || "unknown",
2369
+ attempt: 1
2370
+ },
2371
+ data: {
2372
+ object: "page",
2373
+ id: pageBlock.id,
2374
+ created_time: new Date(pageBlock.created_time).toISOString(),
2375
+ last_edited_time: new Date(
2376
+ pageBlock.last_edited_time
2377
+ ).toISOString(),
2378
+ created_by: {
2379
+ object: "user",
2380
+ id: pageBlock.created_by_id || "unknown"
2381
+ },
2382
+ last_edited_by: {
2383
+ object: "user",
2384
+ id: pageBlock.last_edited_by_id || "unknown"
2385
+ },
2386
+ cover: ((_h = pageBlock.format) == null ? void 0 : _h.page_cover) ? {
2387
+ type: "external",
2388
+ external: {
2389
+ url: pageBlock.format.page_cover.startsWith("/") ? `https://www.notion.so${pageBlock.format.page_cover}` : pageBlock.format.page_cover
2390
+ }
2391
+ } : null,
2392
+ icon: ((_i = pageBlock.format) == null ? void 0 : _i.page_icon) ? {
2393
+ type: "external",
2394
+ external: { url: pageBlock.format.page_icon }
2395
+ } : null,
2396
+ parent: {
2397
+ type: "workspace",
2398
+ workspace: true
2399
+ },
2400
+ archived: !pageBlock.alive,
2401
+ in_trash: false,
2402
+ is_locked: false,
2403
+ properties: {
2404
+ title: {
2405
+ id: "title",
2406
+ type: "title",
2407
+ title: ((_j = pageBlock.properties) == null ? void 0 : _j.title) ? pageBlock.properties.title.map((t) => {
2408
+ const text = typeof t === "string" ? t : t[0] || "";
2409
+ return {
2410
+ type: "text",
2411
+ text: { content: text, link: null },
2412
+ annotations: {
2413
+ bold: false,
2414
+ italic: false,
2415
+ strikethrough: false,
2416
+ underline: false,
2417
+ code: false,
2418
+ color: "default"
2419
+ },
2420
+ plain_text: text,
2421
+ href: null
2422
+ };
2423
+ }) : []
2424
+ }
2425
+ },
2426
+ url: `https://www.notion.so/${pageBlock.id}`,
2427
+ public_url: window.location.href,
2428
+ request_id: crypto.randomUUID()
2429
+ }
2430
+ };
2431
+ const headers = {
2432
+ "Content-Type": "application/json"
2433
+ };
2434
+ if ((_k = actionData.config) == null ? void 0 : _k.customHeaders) {
2435
+ for (const header of actionData.config.customHeaders) {
2436
+ headers[header.key] = header.value;
2437
+ }
2438
+ }
2439
+ console.log("Sending webhook:", {
2440
+ url: webhookUrl,
2441
+ payload,
2442
+ headers
2443
+ });
2444
+ const response = await fetch("/api/webhook-proxy", {
2445
+ method: "POST",
2446
+ headers: {
2447
+ "Content-Type": "application/json"
2448
+ },
2449
+ body: JSON.stringify({ url: webhookUrl, payload, headers })
2450
+ });
2451
+ const result = await response.json();
2452
+ if (!response.ok || !result.success) {
2453
+ console.error("Webhook request failed:", result);
2454
+ } else {
2455
+ console.log("Webhook sent successfully:", result);
2456
+ setIsSuccess(true);
2457
+ setTimeout(() => setIsSuccess(false), 2e3);
2458
+ }
2459
+ } else {
2460
+ console.warn(
2461
+ "Webhook functionality requires /api/webhook-proxy endpoint"
2462
+ );
2463
+ }
2464
+ } catch (err) {
2465
+ console.error("Error sending webhook:", err);
2466
+ }
2467
+ }
2468
+ break;
2469
+ }
2470
+ default:
2471
+ console.warn("Unsupported action type:", actionData.type);
2472
+ }
2473
+ };
2474
+ return /* @__PURE__ */ jsx24("div", { className: cs("notion-button-block", blockId), children: /* @__PURE__ */ jsx24(
2475
+ "button",
2476
+ {
2477
+ type: "button",
2478
+ className: cs(
2479
+ "notion-button",
2480
+ `notion-${blockColor}`,
2481
+ isSuccess ? "notion-success" : "",
2482
+ className
2483
+ ),
2484
+ onClick: handleClick,
2485
+ title: buttonText,
2486
+ disabled: isLoading,
2487
+ children: buttonText
2488
+ }
2489
+ ) });
2490
+ }
2491
+ function getTextContent2(text) {
2492
+ return text.map((t) => typeof t === "string" ? t : t[0] || "").join("");
2493
+ }
2494
+
2495
+ // src/renderer.tsx
2496
+ import mediumZoom from "@fisch0920/medium-zoom";
2497
+ import "notion-types";
2498
+ import { getBlockValue as getBlockValue4 } from "notion-utils";
2499
+ import * as React21 from "react";
2500
+
2501
+ // src/block.tsx
2502
+ import {
2503
+ getBlockCollectionId,
2504
+ getBlockIcon as getBlockIcon2,
2505
+ getBlockParentPage as getBlockParentPage2,
2506
+ getBlockValue as getBlockValue3,
2507
+ getPageTableOfContents,
2508
+ getTextContent as getTextContent3,
2509
+ uuidToId as uuidToId2
2510
+ } from "notion-utils";
2511
+ import React20 from "react";
2512
+
2513
+ // src/components/audio.tsx
2514
+ import "notion-types";
2515
+ import { jsx as jsx25 } from "react/jsx-runtime";
2516
+ function Audio({
2517
+ block,
2518
+ className
2519
+ }) {
2520
+ var _a, _b, _c;
2280
2521
  const { recordMap } = useNotionContext();
2281
2522
  let source = recordMap.signed_urls[block.id] || ((_c = (_b = (_a = block.properties) == null ? void 0 : _a.source) == null ? void 0 : _b[0]) == null ? void 0 : _c[0]);
2282
2523
  if (!source) {
@@ -2287,7 +2528,7 @@ function Audio({
2287
2528
  url.searchParams.set("spaceId", block.space_id);
2288
2529
  source = url.toString();
2289
2530
  }
2290
- return /* @__PURE__ */ jsx24("div", { className: cs("notion-audio", className), children: /* @__PURE__ */ jsx24("audio", { controls: true, preload: "none", src: source }) });
2531
+ return /* @__PURE__ */ jsx25("div", { className: cs("notion-audio", className), children: /* @__PURE__ */ jsx25("audio", { controls: true, preload: "none", src: source }) });
2291
2532
  }
2292
2533
 
2293
2534
  // src/components/file.tsx
@@ -2295,14 +2536,14 @@ import "notion-types";
2295
2536
 
2296
2537
  // src/icons/file-icon.tsx
2297
2538
  import "react";
2298
- import { jsx as jsx25 } from "react/jsx-runtime";
2539
+ import { jsx as jsx26 } from "react/jsx-runtime";
2299
2540
  function FileIcon(props) {
2300
2541
  const { className, ...rest } = props;
2301
- return /* @__PURE__ */ jsx25("svg", { className, ...rest, viewBox: "0 0 30 30", children: /* @__PURE__ */ jsx25("path", { d: "M22,8v12c0,3.866-3.134,7-7,7s-7-3.134-7-7V8c0-2.762,2.238-5,5-5s5,2.238,5,5v12c0,1.657-1.343,3-3,3s-3-1.343-3-3V8h-2v12c0,2.762,2.238,5,5,5s5-2.238,5-5V8c0-3.866-3.134-7-7-7S6,4.134,6,8v12c0,4.971,4.029,9,9,9s9-4.029,9-9V8H22z" }) });
2542
+ return /* @__PURE__ */ jsx26("svg", { className, ...rest, viewBox: "0 0 30 30", children: /* @__PURE__ */ jsx26("path", { d: "M22,8v12c0,3.866-3.134,7-7,7s-7-3.134-7-7V8c0-2.762,2.238-5,5-5s5,2.238,5,5v12c0,1.657-1.343,3-3,3s-3-1.343-3-3V8h-2v12c0,2.762,2.238,5,5,5s5-2.238,5-5V8c0-3.866-3.134-7-7-7S6,4.134,6,8v12c0,4.971,4.029,9,9,9s9-4.029,9-9V8H22z" }) });
2302
2543
  }
2303
2544
 
2304
2545
  // src/components/file.tsx
2305
- import { jsx as jsx26, jsxs as jsxs11 } from "react/jsx-runtime";
2546
+ import { jsx as jsx27, jsxs as jsxs11 } from "react/jsx-runtime";
2306
2547
  function File({
2307
2548
  block,
2308
2549
  className
@@ -2318,7 +2559,7 @@ function File({
2318
2559
  url.searchParams.set("spaceId", block.space_id);
2319
2560
  source = url.toString();
2320
2561
  }
2321
- return /* @__PURE__ */ jsx26("div", { className: cs("notion-file", className), children: /* @__PURE__ */ jsxs11(
2562
+ return /* @__PURE__ */ jsx27("div", { className: cs("notion-file", className), children: /* @__PURE__ */ jsxs11(
2322
2563
  components.Link,
2323
2564
  {
2324
2565
  className: "notion-file-link",
@@ -2326,10 +2567,10 @@ function File({
2326
2567
  target: "_blank",
2327
2568
  rel: "noopener noreferrer",
2328
2569
  children: [
2329
- /* @__PURE__ */ jsx26(FileIcon, { className: "notion-file-icon" }),
2570
+ /* @__PURE__ */ jsx27(FileIcon, { className: "notion-file-icon" }),
2330
2571
  /* @__PURE__ */ jsxs11("div", { className: "notion-file-info", children: [
2331
- /* @__PURE__ */ jsx26("div", { className: "notion-file-title", children: /* @__PURE__ */ jsx26(Text, { value: ((_d = block.properties) == null ? void 0 : _d.title) || [["File"]], block }) }),
2332
- ((_e = block.properties) == null ? void 0 : _e.size) && /* @__PURE__ */ jsx26("div", { className: "notion-file-size", children: /* @__PURE__ */ jsx26(Text, { value: block.properties.size, block }) })
2572
+ /* @__PURE__ */ jsx27("div", { className: "notion-file-title", children: /* @__PURE__ */ jsx27(Text, { value: ((_d = block.properties) == null ? void 0 : _d.title) || [["File"]], block }) }),
2573
+ ((_e = block.properties) == null ? void 0 : _e.size) && /* @__PURE__ */ jsx27("div", { className: "notion-file-size", children: /* @__PURE__ */ jsx27(Text, { value: block.properties.size, block }) })
2333
2574
  ] })
2334
2575
  ]
2335
2576
  }
@@ -2338,7 +2579,7 @@ function File({
2338
2579
 
2339
2580
  // src/components/google-drive.tsx
2340
2581
  import "notion-types";
2341
- import { jsx as jsx27, jsxs as jsxs12 } from "react/jsx-runtime";
2582
+ import { jsx as jsx28, jsxs as jsxs12 } from "react/jsx-runtime";
2342
2583
  function GoogleDrive({
2343
2584
  block,
2344
2585
  className
@@ -2353,7 +2594,7 @@ function GoogleDrive({
2353
2594
  domain = url.hostname;
2354
2595
  } catch (e) {
2355
2596
  }
2356
- return /* @__PURE__ */ jsx27("div", { className: cs("notion-google-drive", className), children: /* @__PURE__ */ jsxs12(
2597
+ return /* @__PURE__ */ jsx28("div", { className: cs("notion-google-drive", className), children: /* @__PURE__ */ jsxs12(
2357
2598
  components.Link,
2358
2599
  {
2359
2600
  className: "notion-google-drive-link",
@@ -2361,7 +2602,7 @@ function GoogleDrive({
2361
2602
  target: "_blank",
2362
2603
  rel: "noopener noreferrer",
2363
2604
  children: [
2364
- /* @__PURE__ */ jsx27("div", { className: "notion-google-drive-preview", children: /* @__PURE__ */ jsx27(
2605
+ /* @__PURE__ */ jsx28("div", { className: "notion-google-drive-preview", children: /* @__PURE__ */ jsx28(
2365
2606
  GracefulImage,
2366
2607
  {
2367
2608
  src: mapImageUrl(properties.thumbnail, block),
@@ -2370,9 +2611,9 @@ function GoogleDrive({
2370
2611
  }
2371
2612
  ) }),
2372
2613
  /* @__PURE__ */ jsxs12("div", { className: "notion-google-drive-body", children: [
2373
- properties.title && /* @__PURE__ */ jsx27("div", { className: "notion-google-drive-body-title", children: properties.title }),
2614
+ properties.title && /* @__PURE__ */ jsx28("div", { className: "notion-google-drive-body-title", children: properties.title }),
2374
2615
  properties.icon && domain && /* @__PURE__ */ jsxs12("div", { className: "notion-google-drive-body-source", children: [
2375
- properties.icon && /* @__PURE__ */ jsx27(
2616
+ properties.icon && /* @__PURE__ */ jsx28(
2376
2617
  "div",
2377
2618
  {
2378
2619
  className: "notion-google-drive-body-source-icon",
@@ -2381,7 +2622,7 @@ function GoogleDrive({
2381
2622
  }
2382
2623
  }
2383
2624
  ),
2384
- domain && /* @__PURE__ */ jsx27("div", { className: "notion-google-drive-body-source-domain", children: domain })
2625
+ domain && /* @__PURE__ */ jsx28("div", { className: "notion-google-drive-body-source-domain", children: domain })
2385
2626
  ] })
2386
2627
  ] })
2387
2628
  ]
@@ -2392,8 +2633,8 @@ function GoogleDrive({
2392
2633
  // src/components/page-aside.tsx
2393
2634
  var import_lodash2 = __toESM(require_lodash(), 1);
2394
2635
  import { uuidToId } from "notion-utils";
2395
- import React17 from "react";
2396
- import { jsx as jsx28, jsxs as jsxs13 } from "react/jsx-runtime";
2636
+ import React18 from "react";
2637
+ import { jsx as jsx29, jsxs as jsxs13 } from "react/jsx-runtime";
2397
2638
  function PageAside({
2398
2639
  toc,
2399
2640
  activeSection,
@@ -2404,7 +2645,7 @@ function PageAside({
2404
2645
  className
2405
2646
  }) {
2406
2647
  const throttleMs = 100;
2407
- const actionSectionScrollSpy = React17.useMemo(
2648
+ const actionSectionScrollSpy = React18.useMemo(
2408
2649
  () => (0, import_lodash2.default)(() => {
2409
2650
  const sections = document.getElementsByClassName("notion-h");
2410
2651
  let prevBBox = null;
@@ -2432,7 +2673,7 @@ function PageAside({
2432
2673
  setActiveSection
2433
2674
  ]
2434
2675
  );
2435
- React17.useEffect(() => {
2676
+ React18.useEffect(() => {
2436
2677
  if (!hasToc) {
2437
2678
  return;
2438
2679
  }
@@ -2447,10 +2688,10 @@ function PageAside({
2447
2688
  }
2448
2689
  return /* @__PURE__ */ jsxs13("aside", { className: cs("notion-aside", className), children: [
2449
2690
  hasToc && /* @__PURE__ */ jsxs13("div", { className: "notion-aside-table-of-contents", children: [
2450
- /* @__PURE__ */ jsx28("div", { className: "notion-aside-table-of-contents-header", children: "Table of Contents" }),
2451
- /* @__PURE__ */ jsx28("nav", { className: "notion-table-of-contents", children: toc.map((tocItem) => {
2691
+ /* @__PURE__ */ jsx29("div", { className: "notion-aside-table-of-contents-header", children: "Table of Contents" }),
2692
+ /* @__PURE__ */ jsx29("nav", { className: "notion-table-of-contents", children: toc.map((tocItem) => {
2452
2693
  const id = uuidToId(tocItem.id);
2453
- return /* @__PURE__ */ jsx28(
2694
+ return /* @__PURE__ */ jsx29(
2454
2695
  "a",
2455
2696
  {
2456
2697
  href: `#${id}`,
@@ -2459,7 +2700,7 @@ function PageAside({
2459
2700
  `notion-table-of-contents-item-indent-level-${tocItem.indentLevel}`,
2460
2701
  activeSection === id && "notion-table-of-contents-active-item"
2461
2702
  ),
2462
- children: /* @__PURE__ */ jsx28(
2703
+ children: /* @__PURE__ */ jsx29(
2463
2704
  "span",
2464
2705
  {
2465
2706
  className: "notion-table-of-contents-item-body",
@@ -2481,7 +2722,7 @@ function PageAside({
2481
2722
 
2482
2723
  // src/components/sync-pointer-block.tsx
2483
2724
  import "notion-types";
2484
- import { jsx as jsx29 } from "react/jsx-runtime";
2725
+ import { jsx as jsx30 } from "react/jsx-runtime";
2485
2726
  function SyncPointerBlock({
2486
2727
  block,
2487
2728
  level
@@ -2498,7 +2739,7 @@ function SyncPointerBlock({
2498
2739
  if (!referencePointerId) {
2499
2740
  return null;
2500
2741
  }
2501
- return /* @__PURE__ */ jsx29(
2742
+ return /* @__PURE__ */ jsx30(
2502
2743
  NotionBlockRenderer,
2503
2744
  {
2504
2745
  level,
@@ -2510,10 +2751,10 @@ function SyncPointerBlock({
2510
2751
 
2511
2752
  // src/icons/link-icon.tsx
2512
2753
  import "react";
2513
- import { jsx as jsx30 } from "react/jsx-runtime";
2754
+ import { jsx as jsx31 } from "react/jsx-runtime";
2514
2755
  function LinkIcon(props) {
2515
2756
  const { className, ...rest } = props;
2516
- return /* @__PURE__ */ jsx30(
2757
+ return /* @__PURE__ */ jsx31(
2517
2758
  "svg",
2518
2759
  {
2519
2760
  className,
@@ -2521,7 +2762,7 @@ function LinkIcon(props) {
2521
2762
  viewBox: "0 0 16 16",
2522
2763
  width: "16",
2523
2764
  height: "16",
2524
- children: /* @__PURE__ */ jsx30(
2765
+ children: /* @__PURE__ */ jsx31(
2525
2766
  "path",
2526
2767
  {
2527
2768
  fillRule: "evenodd",
@@ -2533,11 +2774,11 @@ function LinkIcon(props) {
2533
2774
  }
2534
2775
 
2535
2776
  // src/block.tsx
2536
- import { Fragment as Fragment6, jsx as jsx31, jsxs as jsxs14 } from "react/jsx-runtime";
2777
+ import { Fragment as Fragment6, jsx as jsx32, jsxs as jsxs14 } from "react/jsx-runtime";
2537
2778
  var tocIndentLevelCache = {};
2538
2779
  var pageCoverStyleCache = {};
2539
2780
  function Block(props) {
2540
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T;
2781
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O;
2541
2782
  const ctx2 = useNotionContext();
2542
2783
  const {
2543
2784
  components,
@@ -2552,7 +2793,7 @@ function Block(props) {
2552
2793
  defaultPageCover,
2553
2794
  defaultPageCoverPosition
2554
2795
  } = ctx2;
2555
- const [activeSection, setActiveSection] = React19.useState(null);
2796
+ const [activeSection, setActiveSection] = React20.useState(null);
2556
2797
  const {
2557
2798
  block,
2558
2799
  children,
@@ -2591,7 +2832,9 @@ function Block(props) {
2591
2832
  } = block.format || {};
2592
2833
  if (fullPage) {
2593
2834
  const properties = block.type === "page" ? block.properties : {
2594
- title: (_b = (_a = recordMap.collection[getBlockCollectionId(block, recordMap)]) == null ? void 0 : _a.value) == null ? void 0 : _b.name
2835
+ title: (_a = getBlockValue3(
2836
+ recordMap.collection[getBlockCollectionId(block, recordMap)]
2837
+ )) == null ? void 0 : _a.name
2595
2838
  };
2596
2839
  const coverPosition = (1 - (page_cover_position || 0.5)) * 100;
2597
2840
  const pageCoverObjectPosition = `center ${coverPosition}%`;
@@ -2601,7 +2844,7 @@ function Block(props) {
2601
2844
  objectPosition: pageCoverObjectPosition
2602
2845
  };
2603
2846
  }
2604
- const pageIcon = (_c = getBlockIcon2(block, recordMap)) != null ? _c : defaultPageIcon;
2847
+ const pageIcon = (_b = getBlockIcon2(block, recordMap)) != null ? _b : defaultPageIcon;
2605
2848
  const isPageIconUrl = pageIcon && isUrl(pageIcon);
2606
2849
  const toc = getPageTableOfContents(
2607
2850
  block,
@@ -2621,16 +2864,16 @@ function Block(props) {
2621
2864
  className
2622
2865
  ),
2623
2866
  children: [
2624
- /* @__PURE__ */ jsx31("div", { className: "notion-viewport" }),
2867
+ /* @__PURE__ */ jsx32("div", { className: "notion-viewport" }),
2625
2868
  /* @__PURE__ */ jsxs14("div", { className: "notion-frame", children: [
2626
- !disableHeader && /* @__PURE__ */ jsx31(components.Header, { block }),
2869
+ !disableHeader && /* @__PURE__ */ jsx32(components.Header, { block }),
2627
2870
  header,
2628
2871
  /* @__PURE__ */ jsxs14("div", { className: "notion-page-scroller", children: [
2629
- hasPageCover && (pageCover != null ? pageCover : /* @__PURE__ */ jsx31("div", { className: "notion-page-cover-wrapper", children: /* @__PURE__ */ jsx31(
2872
+ hasPageCover && (pageCover != null ? pageCover : /* @__PURE__ */ jsx32("div", { className: "notion-page-cover-wrapper", children: /* @__PURE__ */ jsx32(
2630
2873
  LazyImage,
2631
2874
  {
2632
2875
  src: mapImageUrl(page_cover, block),
2633
- alt: getTextContent2(properties == null ? void 0 : properties.title),
2876
+ alt: getTextContent3(properties == null ? void 0 : properties.title),
2634
2877
  priority: true,
2635
2878
  className: "notion-page-cover",
2636
2879
  style: pageCoverStyle
@@ -2650,7 +2893,7 @@ function Block(props) {
2650
2893
  bodyClassName
2651
2894
  ),
2652
2895
  children: [
2653
- page_icon && /* @__PURE__ */ jsx31(
2896
+ page_icon && /* @__PURE__ */ jsx32(
2654
2897
  PageIcon,
2655
2898
  {
2656
2899
  block,
@@ -2659,8 +2902,8 @@ function Block(props) {
2659
2902
  }
2660
2903
  ),
2661
2904
  pageHeader,
2662
- /* @__PURE__ */ jsx31("h1", { className: "notion-title", children: pageTitle != null ? pageTitle : /* @__PURE__ */ jsx31(Text, { value: properties == null ? void 0 : properties.title, block }) }),
2663
- (block.type === "collection_view_page" || block.type === "page" && block.parent_table === "collection") && /* @__PURE__ */ jsx31(components.Collection, { block, ctx: ctx2 }),
2905
+ /* @__PURE__ */ jsx32("h1", { className: "notion-title", children: pageTitle != null ? pageTitle : /* @__PURE__ */ jsx32(Text, { value: properties == null ? void 0 : properties.title, block }) }),
2906
+ (block.type === "collection_view_page" || block.type === "page" && block.parent_table === "collection") && /* @__PURE__ */ jsx32(components.Collection, { block, ctx: ctx2 }),
2664
2907
  block.type !== "collection_view_page" && /* @__PURE__ */ jsxs14(
2665
2908
  "div",
2666
2909
  {
@@ -2670,8 +2913,8 @@ function Block(props) {
2670
2913
  hasToc && "notion-page-content-has-toc"
2671
2914
  ),
2672
2915
  children: [
2673
- /* @__PURE__ */ jsx31("article", { className: "notion-page-content-inner", children }),
2674
- hasAside && /* @__PURE__ */ jsx31(
2916
+ /* @__PURE__ */ jsx32("article", { className: "notion-page-content-inner", children }),
2917
+ hasAside && /* @__PURE__ */ jsx32(
2675
2918
  PageAside,
2676
2919
  {
2677
2920
  toc,
@@ -2710,9 +2953,9 @@ function Block(props) {
2710
2953
  bodyClassName
2711
2954
  ),
2712
2955
  children: [
2713
- /* @__PURE__ */ jsx31("div", { className: "notion-viewport" }),
2956
+ /* @__PURE__ */ jsx32("div", { className: "notion-viewport" }),
2714
2957
  pageHeader,
2715
- (block.type === "collection_view_page" || block.type === "page" && block.parent_table === "collection") && /* @__PURE__ */ jsx31(components.Collection, { block, ctx: ctx2 }),
2958
+ (block.type === "collection_view_page" || block.type === "page" && block.parent_table === "collection") && /* @__PURE__ */ jsx32(components.Collection, { block, ctx: ctx2 }),
2716
2959
  block.type !== "collection_view_page" && children,
2717
2960
  pageFooter
2718
2961
  ]
@@ -2720,8 +2963,8 @@ function Block(props) {
2720
2963
  );
2721
2964
  }
2722
2965
  } else {
2723
- const blockColor = (_d = block.format) == null ? void 0 : _d.block_color;
2724
- return /* @__PURE__ */ jsx31(
2966
+ const blockColor = (_c = block.format) == null ? void 0 : _c.block_color;
2967
+ return /* @__PURE__ */ jsx32(
2725
2968
  components.PageLink,
2726
2969
  {
2727
2970
  className: cs(
@@ -2730,7 +2973,7 @@ function Block(props) {
2730
2973
  blockId
2731
2974
  ),
2732
2975
  href: mapPageUrl(block.id),
2733
- children: /* @__PURE__ */ jsx31(PageTitle, { block })
2976
+ children: /* @__PURE__ */ jsx32(PageTitle, { block })
2734
2977
  }
2735
2978
  );
2736
2979
  }
@@ -2740,9 +2983,9 @@ function Block(props) {
2740
2983
  // fallthrough
2741
2984
  case "sub_sub_header": {
2742
2985
  if (!block.properties) return null;
2743
- const blockColor = (_e = block.format) == null ? void 0 : _e.block_color;
2986
+ const blockColor = (_d = block.format) == null ? void 0 : _d.block_color;
2744
2987
  const id = uuidToId2(block.id);
2745
- const title = getTextContent2(block.properties.title) || `Notion Header ${id}`;
2988
+ const title = getTextContent3(block.properties.title) || `Notion Header ${id}`;
2746
2989
  let indentLevel = tocIndentLevelCache[block.id];
2747
2990
  let indentLevelClass;
2748
2991
  if (indentLevel === void 0) {
@@ -2771,34 +3014,34 @@ function Block(props) {
2771
3014
  blockId
2772
3015
  );
2773
3016
  const innerHeader = /* @__PURE__ */ jsxs14("span", { children: [
2774
- /* @__PURE__ */ jsx31("div", { id, className: "notion-header-anchor" }),
2775
- !((_f = block.format) == null ? void 0 : _f.toggleable) && /* @__PURE__ */ jsx31("a", { className: "notion-hash-link", href: `#${id}`, title, children: /* @__PURE__ */ jsx31(LinkIcon, {}) }),
2776
- /* @__PURE__ */ jsx31("span", { className: "notion-h-title", children: /* @__PURE__ */ jsx31(Text, { value: block.properties.title, block }) })
3017
+ /* @__PURE__ */ jsx32("div", { id, className: "notion-header-anchor" }),
3018
+ !((_e = block.format) == null ? void 0 : _e.toggleable) && /* @__PURE__ */ jsx32("a", { className: "notion-hash-link", href: `#${id}`, title, children: /* @__PURE__ */ jsx32(LinkIcon, {}) }),
3019
+ /* @__PURE__ */ jsx32("span", { className: "notion-h-title", children: /* @__PURE__ */ jsx32(Text, { value: block.properties.title, block }) })
2777
3020
  ] });
2778
3021
  let headerBlock = null;
2779
3022
  if (isH1) {
2780
- headerBlock = /* @__PURE__ */ jsx31("h2", { className: classNameStr, "data-id": id, children: innerHeader });
3023
+ headerBlock = /* @__PURE__ */ jsx32("h2", { className: classNameStr, "data-id": id, children: innerHeader });
2781
3024
  } else if (isH2) {
2782
- headerBlock = /* @__PURE__ */ jsx31("h3", { className: classNameStr, "data-id": id, children: innerHeader });
3025
+ headerBlock = /* @__PURE__ */ jsx32("h3", { className: classNameStr, "data-id": id, children: innerHeader });
2783
3026
  } else {
2784
- headerBlock = /* @__PURE__ */ jsx31("h4", { className: classNameStr, "data-id": id, children: innerHeader });
3027
+ headerBlock = /* @__PURE__ */ jsx32("h4", { className: classNameStr, "data-id": id, children: innerHeader });
2785
3028
  }
2786
- if ((_g = block.format) == null ? void 0 : _g.toggleable) {
3029
+ if ((_f = block.format) == null ? void 0 : _f.toggleable) {
2787
3030
  return /* @__PURE__ */ jsxs14("details", { className: cs("notion-toggle", blockId), children: [
2788
- /* @__PURE__ */ jsx31("summary", { children: headerBlock }),
2789
- /* @__PURE__ */ jsx31("div", { children })
3031
+ /* @__PURE__ */ jsx32("summary", { children: headerBlock }),
3032
+ /* @__PURE__ */ jsx32("div", { children })
2790
3033
  ] });
2791
3034
  } else {
2792
3035
  return headerBlock;
2793
3036
  }
2794
3037
  }
2795
3038
  case "divider":
2796
- return /* @__PURE__ */ jsx31("hr", { className: cs("notion-hr", blockId) });
3039
+ return /* @__PURE__ */ jsx32("hr", { className: cs("notion-hr", blockId) });
2797
3040
  case "text": {
2798
- if (!block.properties && !((_h = block.content) == null ? void 0 : _h.length)) {
2799
- return /* @__PURE__ */ jsx31("div", { className: cs("notion-blank", blockId), children: "\xA0" });
3041
+ if (!block.properties && !((_g = block.content) == null ? void 0 : _g.length)) {
3042
+ return /* @__PURE__ */ jsx32("div", { className: cs("notion-blank", blockId), children: "\xA0" });
2800
3043
  }
2801
- const blockColor = (_i = block.format) == null ? void 0 : _i.block_color;
3044
+ const blockColor = (_h = block.format) == null ? void 0 : _h.block_color;
2802
3045
  return /* @__PURE__ */ jsxs14(
2803
3046
  "div",
2804
3047
  {
@@ -2808,8 +3051,8 @@ function Block(props) {
2808
3051
  blockId
2809
3052
  ),
2810
3053
  children: [
2811
- ((_j = block.properties) == null ? void 0 : _j.title) && /* @__PURE__ */ jsx31(Text, { value: block.properties.title, block }),
2812
- children && /* @__PURE__ */ jsx31("div", { className: "notion-text-children", children })
3054
+ ((_i = block.properties) == null ? void 0 : _i.title) && /* @__PURE__ */ jsx32(Text, { value: block.properties.title, block }),
3055
+ children && /* @__PURE__ */ jsx32("div", { className: "notion-text-children", children })
2813
3056
  ]
2814
3057
  }
2815
3058
  );
@@ -2817,7 +3060,7 @@ function Block(props) {
2817
3060
  case "bulleted_list":
2818
3061
  // fallthrough
2819
3062
  case "numbered_list": {
2820
- const wrapList = (content, start2) => block.type === "bulleted_list" ? /* @__PURE__ */ jsx31("ul", { className: cs("notion-list", "notion-list-disc", blockId), children: content }) : /* @__PURE__ */ jsx31(
3063
+ const wrapList = (content, start2) => block.type === "bulleted_list" ? /* @__PURE__ */ jsx32("ul", { className: cs("notion-list", "notion-list-disc", blockId), children: content }) : /* @__PURE__ */ jsx32(
2821
3064
  "ol",
2822
3065
  {
2823
3066
  start: start2,
@@ -2831,20 +3074,20 @@ function Block(props) {
2831
3074
  }
2832
3075
  );
2833
3076
  let output = null;
2834
- const isTopLevel = block.type !== ((_l = (_k = recordMap.block[block.parent_id]) == null ? void 0 : _k.value) == null ? void 0 : _l.type);
3077
+ const isTopLevel = block.type !== ((_j = getBlockValue3(recordMap.block[block.parent_id])) == null ? void 0 : _j.type);
2835
3078
  const start = getListNumber(block.id, recordMap.block);
2836
3079
  if (block.content) {
2837
- const listItem = block.properties ? /* @__PURE__ */ jsx31("li", { children: /* @__PURE__ */ jsx31(Text, { value: block.properties.title, block }) }) : null;
3080
+ const listItem = block.properties ? /* @__PURE__ */ jsx32("li", { children: /* @__PURE__ */ jsx32(Text, { value: block.properties.title, block }) }) : null;
2838
3081
  if (block.type === "bulleted_list") {
2839
3082
  output = /* @__PURE__ */ jsxs14(Fragment6, { children: [
2840
3083
  listItem,
2841
- /* @__PURE__ */ jsx31("ul", { className: cs("notion-list", "notion-list-disc", blockId), children })
3084
+ /* @__PURE__ */ jsx32("ul", { className: cs("notion-list", "notion-list-disc", blockId), children })
2842
3085
  ] });
2843
3086
  } else {
2844
3087
  const nestingLevel = getListNestingLevel(block.id, recordMap.block);
2845
3088
  output = /* @__PURE__ */ jsxs14(Fragment6, { children: [
2846
3089
  listItem,
2847
- /* @__PURE__ */ jsx31(
3090
+ /* @__PURE__ */ jsx32(
2848
3091
  "ol",
2849
3092
  {
2850
3093
  className: cs("notion-list", "notion-list-numbered", blockId),
@@ -2857,12 +3100,12 @@ function Block(props) {
2857
3100
  ] });
2858
3101
  }
2859
3102
  } else {
2860
- output = block.properties ? /* @__PURE__ */ jsx31("li", { children: /* @__PURE__ */ jsx31(Text, { value: block.properties.title, block }) }) : null;
3103
+ output = block.properties ? /* @__PURE__ */ jsx32("li", { children: /* @__PURE__ */ jsx32(Text, { value: block.properties.title, block }) }) : null;
2861
3104
  }
2862
3105
  return isTopLevel ? wrapList(output, start) : output;
2863
3106
  }
2864
3107
  case "embed":
2865
- return /* @__PURE__ */ jsx31(components.Embed, { blockId, block });
3108
+ return /* @__PURE__ */ jsx32(components.Embed, { blockId, block });
2866
3109
  case "replit":
2867
3110
  // fallthrough
2868
3111
  case "tweet":
@@ -2884,15 +3127,15 @@ function Block(props) {
2884
3127
  case "gist":
2885
3128
  // fallthrough
2886
3129
  case "video":
2887
- return /* @__PURE__ */ jsx31(AssetWrapper, { blockId, block });
3130
+ return /* @__PURE__ */ jsx32(AssetWrapper, { blockId, block });
2888
3131
  case "drive": {
2889
- const properties = (_m = block.format) == null ? void 0 : _m.drive_properties;
3132
+ const properties = (_k = block.format) == null ? void 0 : _k.drive_properties;
2890
3133
  if (!properties) {
2891
- if ((_n = block.format) == null ? void 0 : _n.display_source) {
2892
- return /* @__PURE__ */ jsx31(AssetWrapper, { blockId, block });
3134
+ if ((_l = block.format) == null ? void 0 : _l.display_source) {
3135
+ return /* @__PURE__ */ jsx32(AssetWrapper, { blockId, block });
2893
3136
  }
2894
3137
  }
2895
- return /* @__PURE__ */ jsx31(
3138
+ return /* @__PURE__ */ jsx32(
2896
3139
  GoogleDrive,
2897
3140
  {
2898
3141
  block,
@@ -2901,11 +3144,11 @@ function Block(props) {
2901
3144
  );
2902
3145
  }
2903
3146
  case "audio":
2904
- return /* @__PURE__ */ jsx31(Audio, { block, className: blockId });
3147
+ return /* @__PURE__ */ jsx32(Audio, { block, className: blockId });
2905
3148
  case "file":
2906
- return /* @__PURE__ */ jsx31(File, { block, className: blockId });
3149
+ return /* @__PURE__ */ jsx32(File, { block, className: blockId });
2907
3150
  case "equation":
2908
- return /* @__PURE__ */ jsx31(
3151
+ return /* @__PURE__ */ jsx32(
2909
3152
  components.Equation,
2910
3153
  {
2911
3154
  block,
@@ -2914,24 +3157,24 @@ function Block(props) {
2914
3157
  }
2915
3158
  );
2916
3159
  case "code":
2917
- return /* @__PURE__ */ jsx31(components.Code, { block });
3160
+ return /* @__PURE__ */ jsx32(components.Code, { block });
2918
3161
  case "column_list":
2919
- return /* @__PURE__ */ jsx31("div", { className: cs("notion-row", blockId), children });
3162
+ return /* @__PURE__ */ jsx32("div", { className: cs("notion-row", blockId), children });
2920
3163
  case "column": {
2921
3164
  const spacerWidth = `min(32px, 4vw)`;
2922
- const ratio = ((_o = block.format) == null ? void 0 : _o.column_ratio) || 0.5;
2923
- const parent = (_p = recordMap.block[block.parent_id]) == null ? void 0 : _p.value;
2924
- const columns = ((_q = parent == null ? void 0 : parent.content) == null ? void 0 : _q.length) || Math.max(2, Math.ceil(1 / ratio));
3165
+ const ratio = ((_m = block.format) == null ? void 0 : _m.column_ratio) || 0.5;
3166
+ const parent = getBlockValue3(recordMap.block[block.parent_id]);
3167
+ const columns = ((_n = parent == null ? void 0 : parent.content) == null ? void 0 : _n.length) || Math.max(2, Math.ceil(1 / ratio));
2925
3168
  const width = `calc((100% - (${columns - 1} * ${spacerWidth})) * ${ratio})`;
2926
3169
  const style = { width };
2927
3170
  return /* @__PURE__ */ jsxs14(Fragment6, { children: [
2928
- /* @__PURE__ */ jsx31("div", { className: cs("notion-column", blockId), style, children }),
2929
- /* @__PURE__ */ jsx31("div", { className: "notion-spacer" })
3171
+ /* @__PURE__ */ jsx32("div", { className: cs("notion-column", blockId), style, children }),
3172
+ /* @__PURE__ */ jsx32("div", { className: "notion-spacer" })
2930
3173
  ] });
2931
3174
  }
2932
3175
  case "quote": {
2933
3176
  if (!block.properties) return null;
2934
- const blockColor = (_r = block.format) == null ? void 0 : _r.block_color;
3177
+ const blockColor = (_o = block.format) == null ? void 0 : _o.block_color;
2935
3178
  return /* @__PURE__ */ jsxs14(
2936
3179
  "blockquote",
2937
3180
  {
@@ -2941,30 +3184,30 @@ function Block(props) {
2941
3184
  blockId
2942
3185
  ),
2943
3186
  children: [
2944
- /* @__PURE__ */ jsx31("div", { children: /* @__PURE__ */ jsx31(Text, { value: block.properties.title, block }) }),
3187
+ /* @__PURE__ */ jsx32("div", { children: /* @__PURE__ */ jsx32(Text, { value: block.properties.title, block }) }),
2945
3188
  children
2946
3189
  ]
2947
3190
  }
2948
3191
  );
2949
3192
  }
2950
3193
  case "collection_view":
2951
- return /* @__PURE__ */ jsx31(components.Collection, { block, className: blockId, ctx: ctx2 });
3194
+ return /* @__PURE__ */ jsx32(components.Collection, { block, className: blockId, ctx: ctx2 });
2952
3195
  case "callout":
2953
3196
  if (components.Callout) {
2954
- return /* @__PURE__ */ jsx31(components.Callout, { block, className: blockId });
3197
+ return /* @__PURE__ */ jsx32(components.Callout, { block, className: blockId });
2955
3198
  } else {
2956
3199
  return /* @__PURE__ */ jsxs14(
2957
3200
  "div",
2958
3201
  {
2959
3202
  className: cs(
2960
3203
  "notion-callout",
2961
- ((_s = block.format) == null ? void 0 : _s.block_color) && `notion-${(_t = block.format) == null ? void 0 : _t.block_color}_co`,
3204
+ ((_p = block.format) == null ? void 0 : _p.block_color) && `notion-${(_q = block.format) == null ? void 0 : _q.block_color}_co`,
2962
3205
  blockId
2963
3206
  ),
2964
3207
  children: [
2965
- /* @__PURE__ */ jsx31(PageIcon, { block, hideDefaultIcon: true }),
3208
+ /* @__PURE__ */ jsx32(PageIcon, { block, hideDefaultIcon: true }),
2966
3209
  /* @__PURE__ */ jsxs14("div", { className: "notion-callout-text", children: [
2967
- /* @__PURE__ */ jsx31(Text, { value: (_u = block.properties) == null ? void 0 : _u.title, block }),
3210
+ /* @__PURE__ */ jsx32(Text, { value: (_r = block.properties) == null ? void 0 : _r.title, block }),
2968
3211
  children
2969
3212
  ] })
2970
3213
  ]
@@ -2974,10 +3217,10 @@ function Block(props) {
2974
3217
  case "bookmark": {
2975
3218
  if (!block.properties) return null;
2976
3219
  const link = block.properties.link;
2977
- if (!link || !((_v = link[0]) == null ? void 0 : _v[0])) return null;
2978
- let title = getTextContent2(block.properties.title);
3220
+ if (!link || !((_s = link[0]) == null ? void 0 : _s[0])) return null;
3221
+ let title = getTextContent3(block.properties.title);
2979
3222
  if (!title) {
2980
- title = getTextContent2(link);
3223
+ title = getTextContent3(link);
2981
3224
  }
2982
3225
  if (title) {
2983
3226
  if (title.startsWith("http")) {
@@ -2988,37 +3231,37 @@ function Block(props) {
2988
3231
  }
2989
3232
  }
2990
3233
  }
2991
- return /* @__PURE__ */ jsx31("div", { className: "notion-row", children: /* @__PURE__ */ jsxs14(
3234
+ return /* @__PURE__ */ jsx32("div", { className: "notion-row", children: /* @__PURE__ */ jsxs14(
2992
3235
  components.Link,
2993
3236
  {
2994
3237
  target: "_blank",
2995
3238
  rel: "noopener noreferrer",
2996
3239
  className: cs(
2997
3240
  "notion-bookmark",
2998
- ((_w = block.format) == null ? void 0 : _w.block_color) && `notion-${block.format.block_color}`,
3241
+ ((_t = block.format) == null ? void 0 : _t.block_color) && `notion-${block.format.block_color}`,
2999
3242
  blockId
3000
3243
  ),
3001
3244
  href: link[0][0],
3002
3245
  children: [
3003
3246
  /* @__PURE__ */ jsxs14("div", { children: [
3004
- title && /* @__PURE__ */ jsx31("div", { className: "notion-bookmark-title", children: /* @__PURE__ */ jsx31(Text, { value: [[title]], block }) }),
3005
- ((_x = block.properties) == null ? void 0 : _x.description) && /* @__PURE__ */ jsx31("div", { className: "notion-bookmark-description", children: /* @__PURE__ */ jsx31(Text, { value: (_y = block.properties) == null ? void 0 : _y.description, block }) }),
3247
+ title && /* @__PURE__ */ jsx32("div", { className: "notion-bookmark-title", children: /* @__PURE__ */ jsx32(Text, { value: [[title]], block }) }),
3248
+ ((_u = block.properties) == null ? void 0 : _u.description) && /* @__PURE__ */ jsx32("div", { className: "notion-bookmark-description", children: /* @__PURE__ */ jsx32(Text, { value: (_v = block.properties) == null ? void 0 : _v.description, block }) }),
3006
3249
  /* @__PURE__ */ jsxs14("div", { className: "notion-bookmark-link", children: [
3007
- ((_z = block.format) == null ? void 0 : _z.bookmark_icon) && /* @__PURE__ */ jsx31("div", { className: "notion-bookmark-link-icon", children: /* @__PURE__ */ jsx31(
3250
+ ((_w = block.format) == null ? void 0 : _w.bookmark_icon) && /* @__PURE__ */ jsx32("div", { className: "notion-bookmark-link-icon", children: /* @__PURE__ */ jsx32(
3008
3251
  LazyImage,
3009
3252
  {
3010
- src: mapImageUrl((_A = block.format) == null ? void 0 : _A.bookmark_icon, block),
3253
+ src: mapImageUrl((_x = block.format) == null ? void 0 : _x.bookmark_icon, block),
3011
3254
  alt: title
3012
3255
  }
3013
3256
  ) }),
3014
- /* @__PURE__ */ jsx31("div", { className: "notion-bookmark-link-text", children: /* @__PURE__ */ jsx31(Text, { value: link, block }) })
3257
+ /* @__PURE__ */ jsx32("div", { className: "notion-bookmark-link-text", children: /* @__PURE__ */ jsx32(Text, { value: link, block }) })
3015
3258
  ] })
3016
3259
  ] }),
3017
- ((_B = block.format) == null ? void 0 : _B.bookmark_cover) && /* @__PURE__ */ jsx31("div", { className: "notion-bookmark-image", children: /* @__PURE__ */ jsx31(
3260
+ ((_y = block.format) == null ? void 0 : _y.bookmark_cover) && /* @__PURE__ */ jsx32("div", { className: "notion-bookmark-image", children: /* @__PURE__ */ jsx32(
3018
3261
  LazyImage,
3019
3262
  {
3020
- src: mapImageUrl((_C = block.format) == null ? void 0 : _C.bookmark_cover, block),
3021
- alt: getTextContent2((_D = block.properties) == null ? void 0 : _D.title),
3263
+ src: mapImageUrl((_z = block.format) == null ? void 0 : _z.bookmark_cover, block),
3264
+ alt: getTextContent3((_A = block.properties) == null ? void 0 : _A.title),
3022
3265
  style: {
3023
3266
  objectFit: "cover"
3024
3267
  }
@@ -3030,15 +3273,26 @@ function Block(props) {
3030
3273
  }
3031
3274
  case "toggle":
3032
3275
  return /* @__PURE__ */ jsxs14("details", { className: cs("notion-toggle", blockId), children: [
3033
- /* @__PURE__ */ jsx31("summary", { children: /* @__PURE__ */ jsx31(Text, { value: (_E = block.properties) == null ? void 0 : _E.title, block }) }),
3034
- /* @__PURE__ */ jsx31("div", { children })
3276
+ /* @__PURE__ */ jsx32("summary", { children: /* @__PURE__ */ jsx32(Text, { value: (_B = block.properties) == null ? void 0 : _B.title, block }) }),
3277
+ /* @__PURE__ */ jsx32("div", { children })
3035
3278
  ] });
3279
+ case "button": {
3280
+ const ButtonComponent = components.Button || Button;
3281
+ return /* @__PURE__ */ jsx32(
3282
+ ButtonComponent,
3283
+ {
3284
+ blockId,
3285
+ block,
3286
+ className: blockId
3287
+ }
3288
+ );
3289
+ }
3036
3290
  case "table_of_contents": {
3037
3291
  const page = getBlockParentPage2(block, recordMap);
3038
3292
  if (!page) return null;
3039
3293
  const toc = getPageTableOfContents(page, recordMap);
3040
- const blockColor = (_F = block.format) == null ? void 0 : _F.block_color;
3041
- return /* @__PURE__ */ jsx31(
3294
+ const blockColor = (_C = block.format) == null ? void 0 : _C.block_color;
3295
+ return /* @__PURE__ */ jsx32(
3042
3296
  "div",
3043
3297
  {
3044
3298
  className: cs(
@@ -3046,12 +3300,12 @@ function Block(props) {
3046
3300
  blockColor && `notion-${blockColor}`,
3047
3301
  blockId
3048
3302
  ),
3049
- children: toc.map((tocItem) => /* @__PURE__ */ jsx31(
3303
+ children: toc.map((tocItem) => /* @__PURE__ */ jsx32(
3050
3304
  "a",
3051
3305
  {
3052
3306
  href: `#${uuidToId2(tocItem.id)}`,
3053
3307
  className: "notion-table-of-contents-item",
3054
- children: /* @__PURE__ */ jsx31(
3308
+ children: /* @__PURE__ */ jsx32(
3055
3309
  "span",
3056
3310
  {
3057
3311
  className: "notion-table-of-contents-item-body",
@@ -3069,58 +3323,63 @@ function Block(props) {
3069
3323
  );
3070
3324
  }
3071
3325
  case "to_do": {
3072
- const isChecked = ((_I = (_H = (_G = block.properties) == null ? void 0 : _G.checked) == null ? void 0 : _H[0]) == null ? void 0 : _I[0]) === "Yes";
3326
+ const isChecked = ((_F = (_E = (_D = block.properties) == null ? void 0 : _D.checked) == null ? void 0 : _E[0]) == null ? void 0 : _F[0]) === "Yes";
3073
3327
  return /* @__PURE__ */ jsxs14("div", { className: cs("notion-to-do", blockId), children: [
3074
3328
  /* @__PURE__ */ jsxs14("div", { className: "notion-to-do-item", children: [
3075
- /* @__PURE__ */ jsx31(components.Checkbox, { blockId, isChecked }),
3076
- /* @__PURE__ */ jsx31(
3329
+ /* @__PURE__ */ jsx32(components.Checkbox, { blockId, isChecked }),
3330
+ /* @__PURE__ */ jsx32(
3077
3331
  "div",
3078
3332
  {
3079
3333
  className: cs(
3080
3334
  "notion-to-do-body",
3081
3335
  isChecked && `notion-to-do-checked`
3082
3336
  ),
3083
- children: /* @__PURE__ */ jsx31(Text, { value: (_J = block.properties) == null ? void 0 : _J.title, block })
3337
+ children: /* @__PURE__ */ jsx32(Text, { value: (_G = block.properties) == null ? void 0 : _G.title, block })
3084
3338
  }
3085
3339
  )
3086
3340
  ] }),
3087
- /* @__PURE__ */ jsx31("div", { className: "notion-to-do-children", children })
3341
+ /* @__PURE__ */ jsx32("div", { className: "notion-to-do-children", children })
3088
3342
  ] });
3089
3343
  }
3090
3344
  case "transclusion_container":
3091
- return /* @__PURE__ */ jsx31("div", { className: cs("notion-sync-block", blockId), children });
3345
+ return /* @__PURE__ */ jsx32("div", { className: cs("notion-sync-block", blockId), children });
3092
3346
  case "transclusion_reference":
3093
- return /* @__PURE__ */ jsx31(SyncPointerBlock, { ...props, level: level + 1 });
3347
+ return /* @__PURE__ */ jsx32(SyncPointerBlock, { ...props, level: level + 1 });
3094
3348
  case "alias": {
3095
- const blockPointerId = (_L = (_K = block == null ? void 0 : block.format) == null ? void 0 : _K.alias_pointer) == null ? void 0 : _L.id;
3096
- const linkedBlock = (_M = recordMap.block[blockPointerId]) == null ? void 0 : _M.value;
3349
+ const blockPointerId = (_I = (_H = block == null ? void 0 : block.format) == null ? void 0 : _H.alias_pointer) == null ? void 0 : _I.id;
3350
+ const linkedBlock = getBlockValue3(recordMap.block[blockPointerId]);
3097
3351
  if (!linkedBlock) {
3098
3352
  console.log('"alias" missing block', blockPointerId);
3099
3353
  return null;
3100
3354
  }
3101
- return /* @__PURE__ */ jsx31(
3355
+ return /* @__PURE__ */ jsx32(
3102
3356
  components.PageLink,
3103
3357
  {
3104
3358
  className: cs("notion-page-link", blockPointerId),
3105
3359
  href: mapPageUrl(blockPointerId),
3106
- children: /* @__PURE__ */ jsx31(PageTitle, { block: linkedBlock })
3360
+ children: /* @__PURE__ */ jsx32(PageTitle, { block: linkedBlock })
3107
3361
  }
3108
3362
  );
3109
3363
  }
3110
3364
  case "table":
3111
- return /* @__PURE__ */ jsx31("table", { className: cs("notion-simple-table", blockId), children: /* @__PURE__ */ jsx31("tbody", { children }) });
3365
+ return /* @__PURE__ */ jsx32("table", { className: cs("notion-simple-table", blockId), children: /* @__PURE__ */ jsx32("tbody", { children }) });
3112
3366
  case "table_row": {
3113
- const tableBlock = (_N = recordMap.block[block.parent_id]) == null ? void 0 : _N.value;
3114
- const order = (_O = tableBlock.format) == null ? void 0 : _O.table_block_column_order;
3115
- const formatMap = (_P = tableBlock.format) == null ? void 0 : _P.table_block_column_format;
3116
- const backgroundColor = (_Q = block.format) == null ? void 0 : _Q.block_color;
3117
- const hasRowHeader = ((_R = tableBlock.format) == null ? void 0 : _R.table_block_column_header) === true;
3118
- const hasColumnHeader = ((_S = tableBlock.format) == null ? void 0 : _S.table_block_row_header) === true;
3119
- const isHeaderRow = hasRowHeader && ((_T = tableBlock.content) == null ? void 0 : _T[0]) === block.id;
3367
+ const tableBlock = getBlockValue3(
3368
+ recordMap.block[block.parent_id]
3369
+ );
3370
+ if (!tableBlock) {
3371
+ return null;
3372
+ }
3373
+ const order = (_J = tableBlock.format) == null ? void 0 : _J.table_block_column_order;
3374
+ const formatMap = (_K = tableBlock.format) == null ? void 0 : _K.table_block_column_format;
3375
+ const backgroundColor = (_L = block.format) == null ? void 0 : _L.block_color;
3376
+ const hasRowHeader = ((_M = tableBlock.format) == null ? void 0 : _M.table_block_column_header) === true;
3377
+ const hasColumnHeader = ((_N = tableBlock.format) == null ? void 0 : _N.table_block_row_header) === true;
3378
+ const isHeaderRow = hasRowHeader && ((_O = tableBlock.content) == null ? void 0 : _O[0]) === block.id;
3120
3379
  if (!tableBlock || !order) {
3121
3380
  return null;
3122
3381
  }
3123
- return /* @__PURE__ */ jsx31(
3382
+ return /* @__PURE__ */ jsx32(
3124
3383
  "tr",
3125
3384
  {
3126
3385
  className: cs(
@@ -3133,7 +3392,7 @@ function Block(props) {
3133
3392
  var _a2, _b2, _c2;
3134
3393
  const color = (_a2 = formatMap == null ? void 0 : formatMap[column]) == null ? void 0 : _a2.color;
3135
3394
  const isHeaderColumn = hasColumnHeader && columnIndex === 0;
3136
- return /* @__PURE__ */ jsx31(
3395
+ return /* @__PURE__ */ jsx32(
3137
3396
  "td",
3138
3397
  {
3139
3398
  className: cs(
@@ -3143,7 +3402,7 @@ function Block(props) {
3143
3402
  style: {
3144
3403
  width: ((_b2 = formatMap == null ? void 0 : formatMap[column]) == null ? void 0 : _b2.width) || 120
3145
3404
  },
3146
- children: /* @__PURE__ */ jsx31("div", { className: "notion-simple-table-cell", children: /* @__PURE__ */ jsx31(
3405
+ children: /* @__PURE__ */ jsx32("div", { className: "notion-simple-table-cell", children: /* @__PURE__ */ jsx32(
3147
3406
  Text,
3148
3407
  {
3149
3408
  value: ((_c2 = block.properties) == null ? void 0 : _c2[column]) || [["\u3164"]],
@@ -3158,7 +3417,7 @@ function Block(props) {
3158
3417
  );
3159
3418
  }
3160
3419
  case "external_object_instance":
3161
- return /* @__PURE__ */ jsx31(EOI, { block, className: blockId });
3420
+ return /* @__PURE__ */ jsx32(EOI, { block, className: blockId });
3162
3421
  default:
3163
3422
  if (true) {
3164
3423
  console.log(
@@ -3166,12 +3425,12 @@ function Block(props) {
3166
3425
  JSON.stringify(block, null, 2)
3167
3426
  );
3168
3427
  }
3169
- return /* @__PURE__ */ jsx31("div", {});
3428
+ return /* @__PURE__ */ jsx32("div", {});
3170
3429
  }
3171
3430
  }
3172
3431
 
3173
3432
  // src/renderer.tsx
3174
- import { jsx as jsx32 } from "react/jsx-runtime";
3433
+ import { jsx as jsx33 } from "react/jsx-runtime";
3175
3434
  function NotionRenderer({
3176
3435
  components,
3177
3436
  recordMap,
@@ -3197,7 +3456,7 @@ function NotionRenderer({
3197
3456
  defaultPageCoverPosition,
3198
3457
  ...rest
3199
3458
  }) {
3200
- const zoom = React20.useMemo(
3459
+ const zoom = React21.useMemo(
3201
3460
  () => !!globalThis.window && mediumZoom({
3202
3461
  background: "rgba(0, 0, 0, 0.8)",
3203
3462
  minZoomScale: 2,
@@ -3205,7 +3464,7 @@ function NotionRenderer({
3205
3464
  }),
3206
3465
  []
3207
3466
  );
3208
- return /* @__PURE__ */ jsx32(
3467
+ return /* @__PURE__ */ jsx33(
3209
3468
  NotionContextProvider,
3210
3469
  {
3211
3470
  components,
@@ -3230,7 +3489,7 @@ function NotionRenderer({
3230
3489
  defaultPageCover,
3231
3490
  defaultPageCoverPosition,
3232
3491
  zoom: isImageZoomable ? zoom : null,
3233
- children: /* @__PURE__ */ jsx32(NotionBlockRenderer, { ...rest })
3492
+ children: /* @__PURE__ */ jsx33(NotionBlockRenderer, { ...rest })
3234
3493
  }
3235
3494
  );
3236
3495
  }
@@ -3239,17 +3498,17 @@ function NotionBlockRenderer({
3239
3498
  blockId,
3240
3499
  ...props
3241
3500
  }) {
3242
- var _a, _b;
3501
+ var _a;
3243
3502
  const { recordMap } = useNotionContext();
3244
3503
  const id = blockId || Object.keys(recordMap.block)[0];
3245
- const block = (_a = recordMap.block[id]) == null ? void 0 : _a.value;
3504
+ const block = getBlockValue4(recordMap.block[id]);
3246
3505
  if (!block) {
3247
3506
  if (true) {
3248
3507
  console.warn("missing block", blockId);
3249
3508
  }
3250
3509
  return null;
3251
3510
  }
3252
- return /* @__PURE__ */ jsx32(Block, { level, block, ...props, children: (_b = block == null ? void 0 : block.content) == null ? void 0 : _b.map((contentBlockId) => /* @__PURE__ */ jsx32(
3511
+ return /* @__PURE__ */ jsx33(Block, { level, block, ...props, children: (_a = block == null ? void 0 : block.content) == null ? void 0 : _a.map((contentBlockId) => /* @__PURE__ */ jsx33(
3253
3512
  NotionBlockRenderer,
3254
3513
  {
3255
3514
  blockId: contentBlockId,
@@ -3277,6 +3536,7 @@ function getMediumZoomMargin() {
3277
3536
  }
3278
3537
  export {
3279
3538
  Breadcrumbs,
3539
+ Button,
3280
3540
  Header,
3281
3541
  NotionContextConsumer,
3282
3542
  NotionContextProvider,