@caring-dev/react-notion-x 7.8.4 → 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.
@@ -175,8 +175,38 @@ var require_lodash = __commonJS({
175
175
  }
176
176
  });
177
177
 
178
+ // ../../node_modules/.pnpm/@matejmazur+react-katex@3.1.3_katex@0.16.21_react@19.1.0/node_modules/@matejmazur/react-katex/dist/react-katex.m.js
179
+ import r, { memo as e, useState as n, useEffect as t } from "react";
180
+ import o from "katex";
181
+ function a() {
182
+ return (a = Object.assign || function(r2) {
183
+ for (var e2 = 1; e2 < arguments.length; e2++) {
184
+ var n2 = arguments[e2];
185
+ for (var t2 in n2) Object.prototype.hasOwnProperty.call(n2, t2) && (r2[t2] = n2[t2]);
186
+ }
187
+ return r2;
188
+ }).apply(this, arguments);
189
+ }
190
+ var i = e(function(e2) {
191
+ var i2 = e2.children, l = e2.math, s = e2.block, c = e2.errorColor, f = e2.renderError, m = e2.settings, u = e2.as, h = function(r2, e3) {
192
+ if (null == r2) return {};
193
+ var n2, t2, o2 = {}, a2 = Object.keys(r2);
194
+ for (t2 = 0; t2 < a2.length; t2++) e3.indexOf(n2 = a2[t2]) >= 0 || (o2[n2] = r2[n2]);
195
+ return o2;
196
+ }(e2, ["children", "math", "block", "errorColor", "renderError", "settings", "as"]), d = u || (s ? "div" : "span"), p = null != i2 ? i2 : l, g = n({ innerHtml: "" }), E = g[0], v = g[1];
197
+ return t(function() {
198
+ try {
199
+ var r2 = o.renderToString(p, a({ displayMode: !!s, errorColor: c, throwOnError: !!f }, m));
200
+ v({ innerHtml: r2 });
201
+ } catch (r3) {
202
+ if (!(r3 instanceof o.ParseError || r3 instanceof TypeError)) throw r3;
203
+ v(f ? { errorElement: f(r3) } : { innerHtml: r3.message });
204
+ }
205
+ }, [s, p, c, f, m]), "errorElement" in E ? E.errorElement : r.createElement(d, Object.assign({}, h, { dangerouslySetInnerHTML: { __html: E.innerHtml } }));
206
+ });
207
+ var react_katex_m_default = i;
208
+
178
209
  // src/third-party/equation.tsx
179
- import Katex from "@matejmazur/react-katex";
180
210
  import "notion-types";
181
211
  import { getBlockTitle as getBlockTitle4 } from "notion-utils";
182
212
 
@@ -189,18 +219,11 @@ import React15 from "react";
189
219
  import "notion-types";
190
220
  import { parsePageId as parsePageId2 } from "notion-utils";
191
221
 
192
- // src/components/header.tsx
193
- import { getPageBreadcrumbs } from "notion-utils";
194
- import React12 from "react";
195
- import { useHotkeys } from "react-hotkeys-hook";
196
-
197
- // src/icons/search-icon.tsx
198
- import "react";
199
-
200
222
  // src/utils.ts
201
223
  import "notion-types";
224
+ import { getBlockValue } from "notion-utils";
202
225
  import { formatDate, formatNotionDateTime, isUrl } from "notion-utils";
203
- var cs = (...classes) => classes.filter((a) => !!a).join(" ");
226
+ var cs = (...classes) => classes.filter((a2) => !!a2).join(" ");
204
227
  var getHashFragmentValue = (url) => {
205
228
  return url.includes("#") ? url.replace(/^.+(#.+)$/, "$1") : "";
206
229
  };
@@ -224,7 +247,7 @@ var getYoutubeId = (url) => {
224
247
  if (match && ((_a = match[2]) == null ? void 0 : _a.length) === 11) {
225
248
  return match[2];
226
249
  }
227
- } catch (e) {
250
+ } catch (e2) {
228
251
  }
229
252
  return null;
230
253
  };
@@ -236,40 +259,250 @@ var getUrlParams = (url) => {
236
259
  result[key] = value;
237
260
  }
238
261
  return result;
239
- } catch (e) {
262
+ } catch (e2) {
240
263
  }
241
264
  return;
242
265
  };
243
266
 
244
- // src/icons/search-icon.tsx
267
+ // src/components/text.tsx
268
+ import "notion-types";
269
+ import { getBlockValue as getBlockValue2, parsePageId } from "notion-utils";
270
+ import React7 from "react";
271
+
272
+ // src/components/eoi.tsx
273
+ import "notion-types";
274
+
275
+ // src/icons/type-github.tsx
245
276
  import { jsx } from "react/jsx-runtime";
246
- function SearchIcon(props) {
247
- const { className, ...rest } = props;
248
- return /* @__PURE__ */ jsx("svg", { className: cs("notion-icon", className), viewBox: "0 0 17 17", ...rest, children: /* @__PURE__ */ jsx("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" }) });
277
+ function SvgTypeGitHub(props) {
278
+ return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 260 260", ...props, children: /* @__PURE__ */ jsx("g", { children: /* @__PURE__ */ jsx(
279
+ "path",
280
+ {
281
+ d: "M128.00106,0 C57.3172926,0 0,57.3066942 0,128.00106 C0,184.555281 36.6761997,232.535542 87.534937,249.460899 C93.9320223,250.645779 96.280588,246.684165 96.280588,243.303333 C96.280588,240.251045 96.1618878,230.167899 96.106777,219.472176 C60.4967585,227.215235 52.9826207,204.369712 52.9826207,204.369712 C47.1599584,189.574598 38.770408,185.640538 38.770408,185.640538 C27.1568785,177.696113 39.6458206,177.859325 39.6458206,177.859325 C52.4993419,178.762293 59.267365,191.04987 59.267365,191.04987 C70.6837675,210.618423 89.2115753,204.961093 96.5158685,201.690482 C97.6647155,193.417512 100.981959,187.77078 104.642583,184.574357 C76.211799,181.33766 46.324819,170.362144 46.324819,121.315702 C46.324819,107.340889 51.3250588,95.9223682 59.5132437,86.9583937 C58.1842268,83.7344152 53.8029229,70.715562 60.7532354,53.0843636 C60.7532354,53.0843636 71.5019501,49.6441813 95.9626412,66.2049595 C106.172967,63.368876 117.123047,61.9465949 128.00106,61.8978432 C138.879073,61.9465949 149.837632,63.368876 160.067033,66.2049595 C184.49805,49.6441813 195.231926,53.0843636 195.231926,53.0843636 C202.199197,70.715562 197.815773,83.7344152 196.486756,86.9583937 C204.694018,95.9223682 209.660343,107.340889 209.660343,121.315702 C209.660343,170.478725 179.716133,181.303747 151.213281,184.472614 C155.80443,188.444828 159.895342,196.234518 159.895342,208.176593 C159.895342,225.303317 159.746968,239.087361 159.746968,243.303333 C159.746968,246.709601 162.05102,250.70089 168.53925,249.443941 C219.370432,232.499507 256,184.536204 256,128.00106 C256,57.3066942 198.691187,0 128.00106,0 Z M47.9405593,182.340212 C47.6586465,182.976105 46.6581745,183.166873 45.7467277,182.730227 C44.8183235,182.312656 44.2968914,181.445722 44.5978808,180.80771 C44.8734344,180.152739 45.876026,179.97045 46.8023103,180.409216 C47.7328342,180.826786 48.2627451,181.702199 47.9405593,182.340212 Z M54.2367892,187.958254 C53.6263318,188.524199 52.4329723,188.261363 51.6232682,187.366874 C50.7860088,186.474504 50.6291553,185.281144 51.2480912,184.70672 C51.8776254,184.140775 53.0349512,184.405731 53.8743302,185.298101 C54.7115892,186.201069 54.8748019,187.38595 54.2367892,187.958254 Z M58.5562413,195.146347 C57.7719732,195.691096 56.4895886,195.180261 55.6968417,194.042013 C54.9125733,192.903764 54.9125733,191.538713 55.713799,190.991845 C56.5086651,190.444977 57.7719732,190.936735 58.5753181,192.066505 C59.3574669,193.22383 59.3574669,194.58888 58.5562413,195.146347 Z M65.8613592,203.471174 C65.1597571,204.244846 63.6654083,204.03712 62.5716717,202.981538 C61.4524999,201.94927 61.1409122,200.484596 61.8446341,199.710926 C62.5547146,198.935137 64.0575422,199.15346 65.1597571,200.200564 C66.2704506,201.230712 66.6095936,202.705984 65.8613592,203.471174 Z M75.3025151,206.281542 C74.9930474,207.284134 73.553809,207.739857 72.1039724,207.313809 C70.6562556,206.875043 69.7087748,205.700761 70.0012857,204.687571 C70.302275,203.678621 71.7478721,203.20382 73.2083069,203.659543 C74.6539041,204.09619 75.6035048,205.261994 75.3025151,206.281542 Z M86.046947,207.473627 C86.0829806,208.529209 84.8535871,209.404622 83.3316829,209.4237 C81.8013,209.457614 80.563428,208.603398 80.5464708,207.564772 C80.5464708,206.498591 81.7483088,205.631657 83.2786917,205.606221 C84.8005962,205.576546 86.046947,206.424403 86.046947,207.473627 Z M96.6021471,207.069023 C96.7844366,208.099171 95.7267341,209.156872 94.215428,209.438785 C92.7295577,209.710099 91.3539086,209.074206 91.1652603,208.052538 C90.9808515,206.996955 92.0576306,205.939253 93.5413813,205.66582 C95.054807,205.402984 96.4092596,206.021919 96.6021471,207.069023 Z",
282
+ fill: "#161614"
283
+ }
284
+ ) }) });
285
+ }
286
+ var type_github_default = SvgTypeGitHub;
287
+
288
+ // src/components/mention-preview-card.tsx
289
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
290
+ function capitalizeFirstLetter(str) {
291
+ if (!str) return "";
292
+ return str.charAt(0).toUpperCase() + str.slice(1);
293
+ }
294
+ function MentionPreviewCard({
295
+ owner,
296
+ lastUpdated,
297
+ externalImage,
298
+ title,
299
+ domain
300
+ }) {
301
+ return /* @__PURE__ */ jsxs("div", { className: "notion-external-subtitle", children: [
302
+ externalImage && /* @__PURE__ */ jsxs("div", { className: "notion-preview-card-domain-warp", children: [
303
+ /* @__PURE__ */ jsx2("div", { className: "notion-preview-card-logo", children: externalImage }),
304
+ /* @__PURE__ */ jsx2("div", { className: "notion-preview-card-domain", children: capitalizeFirstLetter(domain.split(".")[0]) })
305
+ ] }),
306
+ /* @__PURE__ */ jsx2("div", { className: "notion-preview-card-title", children: title }),
307
+ owner && /* @__PURE__ */ jsxs("div", { className: "notion-external-subtitle-item", children: [
308
+ /* @__PURE__ */ jsx2("div", { className: "notion-external-subtitle-item-name", children: "Owner" }),
309
+ /* @__PURE__ */ jsx2("span", { className: "notion-external-subtitle-item-desc", children: owner })
310
+ ] }),
311
+ lastUpdated && /* @__PURE__ */ jsxs("div", { className: "notion-external-subtitle-item", children: [
312
+ /* @__PURE__ */ jsx2("div", { className: "notion-external-subtitle-item-name", children: "Updated" }),
313
+ /* @__PURE__ */ jsx2("span", { className: "notion-external-subtitle-item-desc", children: lastUpdated })
314
+ ] }),
315
+ domain === "github.com" && /* @__PURE__ */ jsxs("div", { className: "notion-preview-card-github-shields", children: [
316
+ /* @__PURE__ */ jsx2(
317
+ "img",
318
+ {
319
+ src: `https://img.shields.io/github/stars/${owner}/${title}?logo=github`,
320
+ alt: ""
321
+ }
322
+ ),
323
+ /* @__PURE__ */ jsx2(
324
+ "img",
325
+ {
326
+ src: `https://img.shields.io/github/last-commit/${owner}/${title}`,
327
+ alt: ""
328
+ }
329
+ )
330
+ ] })
331
+ ] });
332
+ }
333
+
334
+ // src/components/eoi.tsx
335
+ import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
336
+ function EOI({
337
+ block,
338
+ inline,
339
+ className
340
+ }) {
341
+ var _a, _b, _c;
342
+ const { components } = useNotionContext();
343
+ const { original_url, attributes, domain } = (block == null ? void 0 : block.format) || {};
344
+ if (!original_url || !attributes) {
345
+ return null;
346
+ }
347
+ const title = (_a = attributes.find((attr) => attr.id === "title")) == null ? void 0 : _a.values[0];
348
+ let owner = (_b = attributes.find((attr) => attr.id === "owner")) == null ? void 0 : _b.values[0];
349
+ const lastUpdatedAt = (_c = attributes.find((attr) => attr.id === "updated_at")) == null ? void 0 : _c.values[0];
350
+ const lastUpdated = lastUpdatedAt ? formatNotionDateTime(lastUpdatedAt) : null;
351
+ let externalImage;
352
+ switch (domain) {
353
+ case "github.com":
354
+ externalImage = /* @__PURE__ */ jsx3(type_github_default, {});
355
+ if (owner) {
356
+ const parts = owner.split("/");
357
+ owner = parts.at(-1);
358
+ }
359
+ break;
360
+ default:
361
+ if (true) {
362
+ console.log(
363
+ `Unsupported external_object_instance domain "${domain}"`,
364
+ JSON.stringify(block, null, 2)
365
+ );
366
+ }
367
+ return null;
368
+ }
369
+ return /* @__PURE__ */ jsxs2(
370
+ components.Link,
371
+ {
372
+ target: "_blank",
373
+ rel: "noopener noreferrer",
374
+ href: original_url,
375
+ className: cs(
376
+ "notion-external",
377
+ inline ? "notion-external-mention" : "notion-external-block notion-row",
378
+ className
379
+ ),
380
+ children: [
381
+ externalImage && /* @__PURE__ */ jsx3("div", { className: "notion-external-image", children: externalImage }),
382
+ /* @__PURE__ */ jsxs2("div", { className: "notion-external-description", children: [
383
+ /* @__PURE__ */ jsx3("div", { className: "notion-external-title", children: title }),
384
+ !inline && owner ? /* @__PURE__ */ jsxs2("div", { className: "notion-external-block-desc", children: [
385
+ owner,
386
+ lastUpdated && /* @__PURE__ */ jsx3("span", { children: " \u2022 " }),
387
+ lastUpdated && `Updated ${lastUpdated}`
388
+ ] }) : null,
389
+ inline && (owner || lastUpdated) && /* @__PURE__ */ jsx3(
390
+ MentionPreviewCard,
391
+ {
392
+ title,
393
+ owner,
394
+ lastUpdated,
395
+ domain,
396
+ externalImage
397
+ }
398
+ )
399
+ ] })
400
+ ]
401
+ }
402
+ );
403
+ }
404
+
405
+ // src/components/graceful-image.tsx
406
+ import "react";
407
+ import { Img } from "react-image";
408
+ import { jsx as jsx4 } from "react/jsx-runtime";
409
+ function GracefulImage(props) {
410
+ if (isBrowser) {
411
+ return /* @__PURE__ */ jsx4(Img, { ...props });
412
+ } else {
413
+ return /* @__PURE__ */ jsx4("img", { ...props });
414
+ }
415
+ }
416
+
417
+ // src/components/link-mention.tsx
418
+ import "react";
419
+ import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
420
+ function LinkMention({ metadata }) {
421
+ return /* @__PURE__ */ jsxs3("span", { className: "notion-link-mention", children: [
422
+ /* @__PURE__ */ jsx5(LinkMentionInline, { metadata }),
423
+ /* @__PURE__ */ jsx5(LinkMentionPreview, { metadata })
424
+ ] });
425
+ }
426
+ function LinkMentionInline({ metadata }) {
427
+ return /* @__PURE__ */ jsxs3(
428
+ "a",
429
+ {
430
+ href: metadata.href,
431
+ target: "_blank",
432
+ rel: "noopener noreferrer",
433
+ className: "notion-link-mention-link",
434
+ children: [
435
+ /* @__PURE__ */ jsx5(
436
+ "img",
437
+ {
438
+ className: "notion-link-mention-icon",
439
+ src: metadata.icon_url,
440
+ alt: metadata.link_provider
441
+ }
442
+ ),
443
+ metadata.link_provider && /* @__PURE__ */ jsx5("span", { className: "notion-link-mention-provider", children: metadata.link_provider }),
444
+ /* @__PURE__ */ jsx5("span", { className: "notion-link-mention-title", children: metadata.title })
445
+ ]
446
+ }
447
+ );
448
+ }
449
+ function LinkMentionPreview({ metadata }) {
450
+ return /* @__PURE__ */ jsx5("div", { className: "notion-link-mention-preview", children: /* @__PURE__ */ jsxs3("article", { className: "notion-link-mention-card", children: [
451
+ /* @__PURE__ */ jsx5(
452
+ "img",
453
+ {
454
+ className: "notion-link-mention-preview-thumbnail",
455
+ src: metadata.thumbnail_url,
456
+ alt: metadata.title,
457
+ referrerPolicy: "same-origin"
458
+ }
459
+ ),
460
+ /* @__PURE__ */ jsxs3("div", { className: "notion-link-mention-preview-content", children: [
461
+ /* @__PURE__ */ jsx5("p", { className: "notion-link-mention-preview-title", children: metadata.title }),
462
+ /* @__PURE__ */ jsx5("p", { className: "notion-link-mention-preview-description", children: metadata.description }),
463
+ /* @__PURE__ */ jsxs3("div", { className: "notion-link-mention-preview-footer", children: [
464
+ /* @__PURE__ */ jsx5(
465
+ "img",
466
+ {
467
+ className: "notion-link-mention-preview-icon",
468
+ src: metadata.icon_url,
469
+ alt: metadata.link_provider,
470
+ referrerPolicy: "same-origin"
471
+ }
472
+ ),
473
+ /* @__PURE__ */ jsx5("span", { className: "notion-link-mention-preview-provider", children: metadata.link_provider })
474
+ ] })
475
+ ] })
476
+ ] }) });
249
477
  }
250
478
 
479
+ // src/components/page-title.tsx
480
+ import "notion-types";
481
+ import { getBlockTitle as getBlockTitle2 } from "notion-utils";
482
+ import React6 from "react";
483
+
251
484
  // src/components/page-icon.tsx
252
485
  import "notion-types";
253
486
  import { getBlockIcon, getBlockTitle } from "notion-utils";
254
- import React4 from "react";
487
+ import React5 from "react";
255
488
 
256
489
  // src/icons/default-page-icon.tsx
257
490
  import "react";
258
- import { jsx as jsx2 } from "react/jsx-runtime";
491
+ import { jsx as jsx6 } from "react/jsx-runtime";
259
492
  function DefaultPageIcon(props) {
260
493
  const { className, ...rest } = props;
261
- return /* @__PURE__ */ jsx2("svg", { className, ...rest, viewBox: "0 0 30 30", width: "16", children: /* @__PURE__ */ jsx2("path", { d: "M16,1H4v28h22V11L16,1z M16,3.828L23.172,11H16V3.828z M24,27H6V3h8v10h10V27z M8,17h14v-2H8V17z M8,21h14v-2H8V21z M8,25h14v-2H8V25z" }) });
494
+ return /* @__PURE__ */ jsx6("svg", { className, ...rest, viewBox: "0 0 30 30", width: "16", children: /* @__PURE__ */ jsx6("path", { d: "M16,1H4v28h22V11L16,1z M16,3.828L23.172,11H16V3.828z M24,27H6V3h8v10h10V27z M8,17h14v-2H8V17z M8,21h14v-2H8V21z M8,25h14v-2H8V25z" }) });
262
495
  }
263
496
 
264
497
  // src/components/lazy-image.tsx
265
498
  import { normalizeUrl } from "notion-utils";
266
- import React3 from "react";
499
+ import React4 from "react";
267
500
 
268
501
  // src/components/lazy-image-full.tsx
269
502
  import { Component } from "react";
270
503
  import { InView } from "react-intersection-observer";
271
504
  import { ofType, unionize } from "unionize";
272
- import { jsx as jsx3 } from "react/jsx-runtime";
505
+ import { jsx as jsx7 } from "react/jsx-runtime";
273
506
  var LazyImageFullState = unionize({
274
507
  NotAsked: {},
275
508
  Buffering: {},
@@ -372,7 +605,7 @@ var _LazyImageFull = class _LazyImageFull extends Component {
372
605
  // Loading the image succeeded, simple
373
606
  LoadSuccess: () => ({ nextState: LazyImageFullState.LoadSuccess() }),
374
607
  //@ts-expect-error No need for changing structure
375
- LoadError: (e) => ({ nextState: new LazyImageFullState.LoadError(e) })
608
+ LoadError: (e2) => ({ nextState: new LazyImageFullState.LoadError(e2) })
376
609
  });
377
610
  }
378
611
  update(action) {
@@ -410,7 +643,7 @@ var _LazyImageFull = class _LazyImageFull extends Component {
410
643
  imageProps
411
644
  });
412
645
  } else {
413
- return /* @__PURE__ */ jsx3(
646
+ return /* @__PURE__ */ jsx7(
414
647
  InView,
415
648
  {
416
649
  rootMargin: "50px 0px",
@@ -469,7 +702,7 @@ var makeCancelable = (promise) => {
469
702
  };
470
703
 
471
704
  // src/components/lazy-image.tsx
472
- import { jsx as jsx4, jsxs } from "react/jsx-runtime";
705
+ import { jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
473
706
  function LazyImage({
474
707
  src,
475
708
  alt,
@@ -482,20 +715,20 @@ function LazyImage({
482
715
  }) {
483
716
  var _a, _b, _c;
484
717
  const { recordMap, zoom, previewImages, forceCustomImages, components } = useNotionContext();
485
- const zoomRef = React3.useRef(zoom ? zoom.clone() : null);
718
+ const zoomRef = React4.useRef(zoom ? zoom.clone() : null);
486
719
  const previewImage = previewImages ? (_c = (_a = recordMap == null ? void 0 : recordMap.preview_images) == null ? void 0 : _a[src]) != null ? _c : (_b = recordMap == null ? void 0 : recordMap.preview_images) == null ? void 0 : _b[normalizeUrl(src)] : null;
487
- const onLoad = React3.useCallback(
488
- (e) => {
489
- if (zoomable && (e.target.src || e.target.srcset)) {
720
+ const onLoad = React4.useCallback(
721
+ (e2) => {
722
+ if (zoomable && (e2.target.src || e2.target.srcset)) {
490
723
  if (zoomRef.current) {
491
724
  ;
492
- zoomRef.current.attach(e.target);
725
+ zoomRef.current.attach(e2.target);
493
726
  }
494
727
  }
495
728
  },
496
729
  [zoomRef, zoomable]
497
730
  );
498
- const attachZoom = React3.useCallback(
731
+ const attachZoom = React4.useCallback(
499
732
  (image) => {
500
733
  if (zoomRef.current && image) {
501
734
  ;
@@ -504,14 +737,14 @@ function LazyImage({
504
737
  },
505
738
  [zoomRef]
506
739
  );
507
- const attachZoomRef = React3.useMemo(
740
+ const attachZoomRef = React4.useMemo(
508
741
  () => zoomable ? attachZoom : void 0,
509
742
  [zoomable, attachZoom]
510
743
  );
511
744
  if (previewImage) {
512
745
  const aspectRatio = previewImage.originalHeight / previewImage.originalWidth;
513
746
  if (components.Image) {
514
- return /* @__PURE__ */ jsx4(
747
+ return /* @__PURE__ */ jsx8(
515
748
  components.Image,
516
749
  {
517
750
  src,
@@ -527,7 +760,7 @@ function LazyImage({
527
760
  }
528
761
  );
529
762
  }
530
- return /* @__PURE__ */ jsx4(LazyImageFull, { src, ...rest, experimentalDecode: true, children: ({ imageState, ref }) => {
763
+ return /* @__PURE__ */ jsx8(LazyImageFull, { src, ...rest, experimentalDecode: true, children: ({ imageState, ref }) => {
531
764
  const isLoaded = imageState === "LoadSuccess" /* LoadSuccess */;
532
765
  const wrapperStyle = {
533
766
  width: "100%"
@@ -539,7 +772,7 @@ function LazyImage({
539
772
  imgStyle.position = "absolute";
540
773
  wrapperStyle.paddingBottom = `${aspectRatio * 100}%`;
541
774
  }
542
- return /* @__PURE__ */ jsxs(
775
+ return /* @__PURE__ */ jsxs4(
543
776
  "div",
544
777
  {
545
778
  className: cs(
@@ -549,7 +782,7 @@ function LazyImage({
549
782
  ),
550
783
  style: wrapperStyle,
551
784
  children: [
552
- /* @__PURE__ */ jsx4(
785
+ /* @__PURE__ */ jsx8(
553
786
  "img",
554
787
  {
555
788
  className: "lazy-image-preview",
@@ -560,7 +793,7 @@ function LazyImage({
560
793
  decoding: "async"
561
794
  }
562
795
  ),
563
- /* @__PURE__ */ jsx4(
796
+ /* @__PURE__ */ jsx8(
564
797
  "img",
565
798
  {
566
799
  className: "lazy-image-real",
@@ -583,7 +816,7 @@ function LazyImage({
583
816
  } });
584
817
  } else {
585
818
  if (components.Image && forceCustomImages) {
586
- return /* @__PURE__ */ jsx4(
819
+ return /* @__PURE__ */ jsx8(
587
820
  components.Image,
588
821
  {
589
822
  src,
@@ -597,7 +830,7 @@ function LazyImage({
597
830
  }
598
831
  );
599
832
  }
600
- return /* @__PURE__ */ jsx4(
833
+ return /* @__PURE__ */ jsx8(
601
834
  "img",
602
835
  {
603
836
  className,
@@ -614,7 +847,7 @@ function LazyImage({
614
847
  }
615
848
 
616
849
  // src/components/page-icon.tsx
617
- import { jsx as jsx5 } from "react/jsx-runtime";
850
+ import { jsx as jsx9 } from "react/jsx-runtime";
618
851
  var isIconBlock = (value) => {
619
852
  return value.type === "page" || value.type === "callout" || value.type === "collection_view" || value.type === "collection_view_page";
620
853
  };
@@ -635,7 +868,7 @@ function PageIconImpl({
635
868
  if (icon && isUrl(icon)) {
636
869
  const url = mapImageUrl(icon, block);
637
870
  isImage = true;
638
- content = /* @__PURE__ */ jsx5(
871
+ content = /* @__PURE__ */ jsx9(
639
872
  LazyImage,
640
873
  {
641
874
  src: url,
@@ -645,7 +878,7 @@ function PageIconImpl({
645
878
  );
646
879
  } else if (icon && icon.startsWith("/icons/")) {
647
880
  const url = "https://www.notion.so" + icon + "?mode=" + (darkMode ? "dark" : "light");
648
- content = /* @__PURE__ */ jsx5(
881
+ content = /* @__PURE__ */ jsx9(
649
882
  LazyImage,
650
883
  {
651
884
  src: url,
@@ -656,7 +889,7 @@ function PageIconImpl({
656
889
  } else if (!icon) {
657
890
  if (!hideDefaultIcon) {
658
891
  isImage = true;
659
- content = /* @__PURE__ */ jsx5(
892
+ content = /* @__PURE__ */ jsx9(
660
893
  DefaultPageIcon,
661
894
  {
662
895
  className: cs(className, "notion-page-icon"),
@@ -666,7 +899,7 @@ function PageIconImpl({
666
899
  }
667
900
  } else {
668
901
  isImage = false;
669
- content = /* @__PURE__ */ jsx5(
902
+ content = /* @__PURE__ */ jsx9(
670
903
  "span",
671
904
  {
672
905
  className: cs(className, "notion-page-icon"),
@@ -680,7 +913,7 @@ function PageIconImpl({
680
913
  if (!content) {
681
914
  return null;
682
915
  }
683
- return /* @__PURE__ */ jsx5(
916
+ return /* @__PURE__ */ jsx9(
684
917
  "div",
685
918
  {
686
919
  className: cs(
@@ -691,304 +924,56 @@ function PageIconImpl({
691
924
  }
692
925
  );
693
926
  }
694
- var PageIcon = React4.memo(PageIconImpl);
695
-
696
- // src/components/search-dialog.tsx
697
- var import_lodash = __toESM(require_lodash(), 1);
698
- import { getBlockParentPage, getBlockTitle as getBlockTitle3 } from "notion-utils";
699
- import React11 from "react";
700
-
701
- // src/icons/clear-icon.tsx
702
- import "react";
703
- import { jsx as jsx6 } from "react/jsx-runtime";
704
- function ClearIcon(props) {
705
- const { className, ...rest } = props;
706
- return /* @__PURE__ */ jsx6("svg", { className: cs("notion-icon", className), ...rest, viewBox: "0 0 30 30", children: /* @__PURE__ */ jsx6("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" }) });
707
- }
927
+ var PageIcon = React5.memo(PageIconImpl);
708
928
 
709
- // src/icons/loading-icon.tsx
710
- import "react";
711
- import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
712
- function LoadingIcon(props) {
713
- const { className, ...rest } = props;
714
- return /* @__PURE__ */ jsxs2("svg", { className: cs("notion-icon", className), ...rest, viewBox: "0 0 24 24", children: [
715
- /* @__PURE__ */ jsx7("defs", { children: /* @__PURE__ */ jsxs2(
716
- "linearGradient",
717
- {
718
- x1: "28.1542969%",
719
- y1: "63.7402344%",
720
- x2: "74.6289062%",
721
- y2: "17.7832031%",
722
- id: "linearGradient-1",
723
- children: [
724
- /* @__PURE__ */ jsx7("stop", { stopColor: "rgba(164, 164, 164, 1)", offset: "0%" }),
725
- /* @__PURE__ */ jsx7(
726
- "stop",
727
- {
728
- stopColor: "rgba(164, 164, 164, 0)",
729
- stopOpacity: "0",
730
- offset: "100%"
731
- }
732
- )
733
- ]
734
- }
735
- ) }),
736
- /* @__PURE__ */ jsx7("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", children: /* @__PURE__ */ jsx7("g", { transform: "translate(-236.000000, -286.000000)", children: /* @__PURE__ */ jsxs2("g", { transform: "translate(238.000000, 286.000000)", children: [
737
- /* @__PURE__ */ jsx7(
738
- "circle",
739
- {
740
- id: "Oval-2",
741
- stroke: "url(#linearGradient-1)",
742
- strokeWidth: "4",
743
- cx: "10",
744
- cy: "12",
745
- r: "10"
746
- }
747
- ),
748
- /* @__PURE__ */ jsx7(
749
- "path",
929
+ // src/components/page-title.tsx
930
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
931
+ function PageTitleImpl({
932
+ block,
933
+ className,
934
+ defaultIcon,
935
+ ...rest
936
+ }) {
937
+ var _a, _b;
938
+ const { recordMap } = useNotionContext();
939
+ if (!block) return null;
940
+ if (block.type === "collection_view_page" || block.type === "collection_view") {
941
+ const title = getBlockTitle2(block, recordMap);
942
+ if (!title) {
943
+ return null;
944
+ }
945
+ const titleDecoration = [[title]];
946
+ return /* @__PURE__ */ jsxs5("span", { className: cs("notion-page-title", className), ...rest, children: [
947
+ /* @__PURE__ */ jsx10(
948
+ PageIcon,
750
949
  {
751
- d: "M10,2 C4.4771525,2 0,6.4771525 0,12",
752
- id: "Oval-2",
753
- stroke: "rgba(164, 164, 164, 1)",
754
- strokeWidth: "4"
950
+ block,
951
+ defaultIcon,
952
+ className: "notion-page-title-icon"
755
953
  }
756
954
  ),
757
- /* @__PURE__ */ jsx7(
758
- "rect",
759
- {
760
- id: "Rectangle-1",
761
- fill: "rgba(164, 164, 164, 1)",
762
- x: "8",
763
- y: "0",
764
- width: "4",
765
- height: "4",
766
- rx: "8"
767
- }
768
- )
769
- ] }) }) })
770
- ] });
771
- }
772
-
773
- // src/components/page-title.tsx
774
- import "notion-types";
775
- import { getBlockTitle as getBlockTitle2 } from "notion-utils";
776
- import React10 from "react";
777
-
778
- // src/components/text.tsx
779
- import "notion-types";
780
- import { parsePageId } from "notion-utils";
781
- import React9 from "react";
782
-
783
- // src/components/eoi.tsx
784
- import "notion-types";
785
-
786
- // src/icons/type-github.tsx
787
- import { jsx as jsx8 } from "react/jsx-runtime";
788
- function SvgTypeGitHub(props) {
789
- return /* @__PURE__ */ jsx8("svg", { viewBox: "0 0 260 260", ...props, children: /* @__PURE__ */ jsx8("g", { children: /* @__PURE__ */ jsx8(
790
- "path",
791
- {
792
- d: "M128.00106,0 C57.3172926,0 0,57.3066942 0,128.00106 C0,184.555281 36.6761997,232.535542 87.534937,249.460899 C93.9320223,250.645779 96.280588,246.684165 96.280588,243.303333 C96.280588,240.251045 96.1618878,230.167899 96.106777,219.472176 C60.4967585,227.215235 52.9826207,204.369712 52.9826207,204.369712 C47.1599584,189.574598 38.770408,185.640538 38.770408,185.640538 C27.1568785,177.696113 39.6458206,177.859325 39.6458206,177.859325 C52.4993419,178.762293 59.267365,191.04987 59.267365,191.04987 C70.6837675,210.618423 89.2115753,204.961093 96.5158685,201.690482 C97.6647155,193.417512 100.981959,187.77078 104.642583,184.574357 C76.211799,181.33766 46.324819,170.362144 46.324819,121.315702 C46.324819,107.340889 51.3250588,95.9223682 59.5132437,86.9583937 C58.1842268,83.7344152 53.8029229,70.715562 60.7532354,53.0843636 C60.7532354,53.0843636 71.5019501,49.6441813 95.9626412,66.2049595 C106.172967,63.368876 117.123047,61.9465949 128.00106,61.8978432 C138.879073,61.9465949 149.837632,63.368876 160.067033,66.2049595 C184.49805,49.6441813 195.231926,53.0843636 195.231926,53.0843636 C202.199197,70.715562 197.815773,83.7344152 196.486756,86.9583937 C204.694018,95.9223682 209.660343,107.340889 209.660343,121.315702 C209.660343,170.478725 179.716133,181.303747 151.213281,184.472614 C155.80443,188.444828 159.895342,196.234518 159.895342,208.176593 C159.895342,225.303317 159.746968,239.087361 159.746968,243.303333 C159.746968,246.709601 162.05102,250.70089 168.53925,249.443941 C219.370432,232.499507 256,184.536204 256,128.00106 C256,57.3066942 198.691187,0 128.00106,0 Z M47.9405593,182.340212 C47.6586465,182.976105 46.6581745,183.166873 45.7467277,182.730227 C44.8183235,182.312656 44.2968914,181.445722 44.5978808,180.80771 C44.8734344,180.152739 45.876026,179.97045 46.8023103,180.409216 C47.7328342,180.826786 48.2627451,181.702199 47.9405593,182.340212 Z M54.2367892,187.958254 C53.6263318,188.524199 52.4329723,188.261363 51.6232682,187.366874 C50.7860088,186.474504 50.6291553,185.281144 51.2480912,184.70672 C51.8776254,184.140775 53.0349512,184.405731 53.8743302,185.298101 C54.7115892,186.201069 54.8748019,187.38595 54.2367892,187.958254 Z M58.5562413,195.146347 C57.7719732,195.691096 56.4895886,195.180261 55.6968417,194.042013 C54.9125733,192.903764 54.9125733,191.538713 55.713799,190.991845 C56.5086651,190.444977 57.7719732,190.936735 58.5753181,192.066505 C59.3574669,193.22383 59.3574669,194.58888 58.5562413,195.146347 Z M65.8613592,203.471174 C65.1597571,204.244846 63.6654083,204.03712 62.5716717,202.981538 C61.4524999,201.94927 61.1409122,200.484596 61.8446341,199.710926 C62.5547146,198.935137 64.0575422,199.15346 65.1597571,200.200564 C66.2704506,201.230712 66.6095936,202.705984 65.8613592,203.471174 Z M75.3025151,206.281542 C74.9930474,207.284134 73.553809,207.739857 72.1039724,207.313809 C70.6562556,206.875043 69.7087748,205.700761 70.0012857,204.687571 C70.302275,203.678621 71.7478721,203.20382 73.2083069,203.659543 C74.6539041,204.09619 75.6035048,205.261994 75.3025151,206.281542 Z M86.046947,207.473627 C86.0829806,208.529209 84.8535871,209.404622 83.3316829,209.4237 C81.8013,209.457614 80.563428,208.603398 80.5464708,207.564772 C80.5464708,206.498591 81.7483088,205.631657 83.2786917,205.606221 C84.8005962,205.576546 86.046947,206.424403 86.046947,207.473627 Z M96.6021471,207.069023 C96.7844366,208.099171 95.7267341,209.156872 94.215428,209.438785 C92.7295577,209.710099 91.3539086,209.074206 91.1652603,208.052538 C90.9808515,206.996955 92.0576306,205.939253 93.5413813,205.66582 C95.054807,205.402984 96.4092596,206.021919 96.6021471,207.069023 Z",
793
- fill: "#161614"
794
- }
795
- ) }) });
796
- }
797
- var type_github_default = SvgTypeGitHub;
798
-
799
- // src/components/mention-preview-card.tsx
800
- import { jsx as jsx9, jsxs as jsxs3 } from "react/jsx-runtime";
801
- function capitalizeFirstLetter(str) {
802
- if (!str) return "";
803
- return str.charAt(0).toUpperCase() + str.slice(1);
804
- }
805
- function MentionPreviewCard({
806
- owner,
807
- lastUpdated,
808
- externalImage,
809
- title,
810
- domain
811
- }) {
812
- return /* @__PURE__ */ jsxs3("div", { className: "notion-external-subtitle", children: [
813
- externalImage && /* @__PURE__ */ jsxs3("div", { className: "notion-preview-card-domain-warp", children: [
814
- /* @__PURE__ */ jsx9("div", { className: "notion-preview-card-logo", children: externalImage }),
815
- /* @__PURE__ */ jsx9("div", { className: "notion-preview-card-domain", children: capitalizeFirstLetter(domain.split(".")[0]) })
816
- ] }),
817
- /* @__PURE__ */ jsx9("div", { className: "notion-preview-card-title", children: title }),
818
- owner && /* @__PURE__ */ jsxs3("div", { className: "notion-external-subtitle-item", children: [
819
- /* @__PURE__ */ jsx9("div", { className: "notion-external-subtitle-item-name", children: "Owner" }),
820
- /* @__PURE__ */ jsx9("span", { className: "notion-external-subtitle-item-desc", children: owner })
821
- ] }),
822
- lastUpdated && /* @__PURE__ */ jsxs3("div", { className: "notion-external-subtitle-item", children: [
823
- /* @__PURE__ */ jsx9("div", { className: "notion-external-subtitle-item-name", children: "Updated" }),
824
- /* @__PURE__ */ jsx9("span", { className: "notion-external-subtitle-item-desc", children: lastUpdated })
825
- ] }),
826
- domain === "github.com" && /* @__PURE__ */ jsxs3("div", { className: "notion-preview-card-github-shields", children: [
827
- /* @__PURE__ */ jsx9(
828
- "img",
829
- {
830
- src: `https://img.shields.io/github/stars/${owner}/${title}?logo=github`,
831
- alt: ""
832
- }
833
- ),
834
- /* @__PURE__ */ jsx9(
835
- "img",
836
- {
837
- src: `https://img.shields.io/github/last-commit/${owner}/${title}`,
838
- alt: ""
839
- }
840
- )
841
- ] })
842
- ] });
843
- }
844
-
845
- // src/components/eoi.tsx
846
- import { jsx as jsx10, jsxs as jsxs4 } from "react/jsx-runtime";
847
- function EOI({
848
- block,
849
- inline,
850
- className
851
- }) {
852
- var _a, _b, _c;
853
- const { components } = useNotionContext();
854
- const { original_url, attributes, domain } = (block == null ? void 0 : block.format) || {};
855
- if (!original_url || !attributes) {
856
- return null;
857
- }
858
- const title = (_a = attributes.find((attr) => attr.id === "title")) == null ? void 0 : _a.values[0];
859
- let owner = (_b = attributes.find((attr) => attr.id === "owner")) == null ? void 0 : _b.values[0];
860
- const lastUpdatedAt = (_c = attributes.find((attr) => attr.id === "updated_at")) == null ? void 0 : _c.values[0];
861
- const lastUpdated = lastUpdatedAt ? formatNotionDateTime(lastUpdatedAt) : null;
862
- let externalImage;
863
- switch (domain) {
864
- case "github.com":
865
- externalImage = /* @__PURE__ */ jsx10(type_github_default, {});
866
- if (owner) {
867
- const parts = owner.split("/");
868
- owner = parts.at(-1);
869
- }
870
- break;
871
- default:
872
- if (true) {
873
- console.log(
874
- `Unsupported external_object_instance domain "${domain}"`,
875
- JSON.stringify(block, null, 2)
876
- );
877
- }
878
- return null;
955
+ /* @__PURE__ */ jsx10("span", { className: "notion-page-title-text", children: /* @__PURE__ */ jsx10(Text, { value: titleDecoration, block }) })
956
+ ] });
879
957
  }
880
- return /* @__PURE__ */ jsxs4(
881
- components.Link,
882
- {
883
- target: "_blank",
884
- rel: "noopener noreferrer",
885
- href: original_url,
886
- className: cs(
887
- "notion-external",
888
- inline ? "notion-external-mention" : "notion-external-block notion-row",
889
- className
890
- ),
891
- children: [
892
- externalImage && /* @__PURE__ */ jsx10("div", { className: "notion-external-image", children: externalImage }),
893
- /* @__PURE__ */ jsxs4("div", { className: "notion-external-description", children: [
894
- /* @__PURE__ */ jsx10("div", { className: "notion-external-title", children: title }),
895
- !inline && owner ? /* @__PURE__ */ jsxs4("div", { className: "notion-external-block-desc", children: [
896
- owner,
897
- lastUpdated && /* @__PURE__ */ jsx10("span", { children: " \u2022 " }),
898
- lastUpdated && `Updated ${lastUpdated}`
899
- ] }) : null,
900
- inline && (owner || lastUpdated) && /* @__PURE__ */ jsx10(
901
- MentionPreviewCard,
902
- {
903
- title,
904
- owner,
905
- lastUpdated,
906
- domain,
907
- externalImage
908
- }
909
- )
910
- ] })
911
- ]
912
- }
913
- );
914
- }
915
-
916
- // src/components/graceful-image.tsx
917
- import "react";
918
- import { Img } from "react-image";
919
- import { jsx as jsx11 } from "react/jsx-runtime";
920
- function GracefulImage(props) {
921
- if (isBrowser) {
922
- return /* @__PURE__ */ jsx11(Img, { ...props });
923
- } else {
924
- return /* @__PURE__ */ jsx11("img", { ...props });
958
+ if (!((_a = block.properties) == null ? void 0 : _a.title)) {
959
+ return null;
925
960
  }
926
- }
927
-
928
- // src/components/link-mention.tsx
929
- import "react";
930
- import { jsx as jsx12, jsxs as jsxs5 } from "react/jsx-runtime";
931
- function LinkMention({ metadata }) {
932
- return /* @__PURE__ */ jsxs5("span", { className: "notion-link-mention", children: [
933
- /* @__PURE__ */ jsx12(LinkMentionInline, { metadata }),
934
- /* @__PURE__ */ jsx12(LinkMentionPreview, { metadata })
935
- ] });
936
- }
937
- function LinkMentionInline({ metadata }) {
938
- return /* @__PURE__ */ jsxs5(
939
- "a",
940
- {
941
- href: metadata.href,
942
- target: "_blank",
943
- rel: "noopener noreferrer",
944
- className: "notion-link-mention-link",
945
- children: [
946
- /* @__PURE__ */ jsx12(
947
- "img",
948
- {
949
- className: "notion-link-mention-icon",
950
- src: metadata.icon_url,
951
- alt: metadata.link_provider
952
- }
953
- ),
954
- metadata.link_provider && /* @__PURE__ */ jsx12("span", { className: "notion-link-mention-provider", children: metadata.link_provider }),
955
- /* @__PURE__ */ jsx12("span", { className: "notion-link-mention-title", children: metadata.title })
956
- ]
957
- }
958
- );
959
- }
960
- function LinkMentionPreview({ metadata }) {
961
- return /* @__PURE__ */ jsx12("div", { className: "notion-link-mention-preview", children: /* @__PURE__ */ jsxs5("article", { className: "notion-link-mention-card", children: [
962
- /* @__PURE__ */ jsx12(
963
- "img",
961
+ return /* @__PURE__ */ jsxs5("span", { className: cs("notion-page-title", className), ...rest, children: [
962
+ /* @__PURE__ */ jsx10(
963
+ PageIcon,
964
964
  {
965
- className: "notion-link-mention-preview-thumbnail",
966
- src: metadata.thumbnail_url,
967
- alt: metadata.title,
968
- referrerPolicy: "same-origin"
965
+ block,
966
+ defaultIcon,
967
+ className: "notion-page-title-icon"
969
968
  }
970
969
  ),
971
- /* @__PURE__ */ jsxs5("div", { className: "notion-link-mention-preview-content", children: [
972
- /* @__PURE__ */ jsx12("p", { className: "notion-link-mention-preview-title", children: metadata.title }),
973
- /* @__PURE__ */ jsx12("p", { className: "notion-link-mention-preview-description", children: metadata.description }),
974
- /* @__PURE__ */ jsxs5("div", { className: "notion-link-mention-preview-footer", children: [
975
- /* @__PURE__ */ jsx12(
976
- "img",
977
- {
978
- className: "notion-link-mention-preview-icon",
979
- src: metadata.icon_url,
980
- alt: metadata.link_provider,
981
- referrerPolicy: "same-origin"
982
- }
983
- ),
984
- /* @__PURE__ */ jsx12("span", { className: "notion-link-mention-preview-provider", children: metadata.link_provider })
985
- ] })
986
- ] })
987
- ] }) });
970
+ /* @__PURE__ */ jsx10("span", { className: "notion-page-title-text", children: /* @__PURE__ */ jsx10(Text, { value: (_b = block.properties) == null ? void 0 : _b.title, block }) })
971
+ ] });
988
972
  }
973
+ var PageTitle = React6.memo(PageTitleImpl);
989
974
 
990
975
  // src/components/text.tsx
991
- import { Fragment, jsx as jsx13 } from "react/jsx-runtime";
976
+ import { Fragment, jsx as jsx11 } from "react/jsx-runtime";
992
977
  function Text({
993
978
  value,
994
979
  block,
@@ -996,31 +981,30 @@ function Text({
996
981
  linkProtocol
997
982
  }) {
998
983
  const { components, recordMap, mapPageUrl, mapImageUrl, rootDomain } = useNotionContext();
999
- return /* @__PURE__ */ jsx13(React9.Fragment, { children: value == null ? void 0 : value.map(([text, decorations], index) => {
984
+ return /* @__PURE__ */ jsx11(React7.Fragment, { children: value == null ? void 0 : value.map(([text, decorations], index) => {
1000
985
  if (!decorations) {
1001
986
  if (text === ",") {
1002
- return /* @__PURE__ */ jsx13("span", { style: { padding: "0.5em" } }, index);
987
+ return /* @__PURE__ */ jsx11("span", { style: { padding: "0.5em" } }, index);
1003
988
  } else {
1004
- return /* @__PURE__ */ jsx13(React9.Fragment, { children: text }, index);
989
+ return /* @__PURE__ */ jsx11(React7.Fragment, { children: text }, index);
1005
990
  }
1006
991
  }
1007
992
  const formatted = decorations.reduce(
1008
993
  (element, decorator) => {
1009
- var _a, _b, _c, _d, _e;
1010
994
  switch (decorator[0]) {
1011
995
  case "p": {
1012
996
  const blockId = decorator[1];
1013
- const linkedBlock = (_a = recordMap.block[blockId]) == null ? void 0 : _a.value;
997
+ const linkedBlock = getBlockValue2(recordMap.block[blockId]);
1014
998
  if (!linkedBlock) {
1015
999
  console.log('"p" missing block', blockId);
1016
1000
  return null;
1017
1001
  }
1018
- return /* @__PURE__ */ jsx13(
1002
+ return /* @__PURE__ */ jsx11(
1019
1003
  components.PageLink,
1020
1004
  {
1021
1005
  className: "notion-link",
1022
1006
  href: mapPageUrl(blockId),
1023
- children: /* @__PURE__ */ jsx13(PageTitle, { block: linkedBlock })
1007
+ children: /* @__PURE__ */ jsx11(PageTitle, { block: linkedBlock })
1024
1008
  }
1025
1009
  );
1026
1010
  }
@@ -1029,7 +1013,7 @@ function Text({
1029
1013
  const id = decorator[1][1];
1030
1014
  switch (linkType) {
1031
1015
  case "u": {
1032
- const user = (_b = recordMap.notion_user[id]) == null ? void 0 : _b.value;
1016
+ const user = getBlockValue2(recordMap.notion_user[id]);
1033
1017
  if (!user) {
1034
1018
  console.log('"\u2023" missing user', id);
1035
1019
  return null;
@@ -1037,7 +1021,7 @@ function Text({
1037
1021
  const src = mapImageUrl(user.profile_photo, block);
1038
1022
  if (!src) return null;
1039
1023
  const name = [user.given_name, user.family_name].filter(Boolean).join(" ");
1040
- return /* @__PURE__ */ jsx13(
1024
+ return /* @__PURE__ */ jsx11(
1041
1025
  GracefulImage,
1042
1026
  {
1043
1027
  className: "notion-user",
@@ -1047,12 +1031,12 @@ function Text({
1047
1031
  );
1048
1032
  }
1049
1033
  default: {
1050
- const linkedBlock = (_c = recordMap.block[id]) == null ? void 0 : _c.value;
1034
+ const linkedBlock = getBlockValue2(recordMap.block[id]);
1051
1035
  if (!linkedBlock) {
1052
1036
  console.log('"\u2023" missing block', linkType, id);
1053
1037
  return null;
1054
1038
  }
1055
- return /* @__PURE__ */ jsx13(
1039
+ return /* @__PURE__ */ jsx11(
1056
1040
  components.PageLink,
1057
1041
  {
1058
1042
  className: "notion-link",
@@ -1060,26 +1044,26 @@ function Text({
1060
1044
  ...linkProps,
1061
1045
  target: "_blank",
1062
1046
  rel: "noopener noreferrer",
1063
- children: /* @__PURE__ */ jsx13(PageTitle, { block: linkedBlock })
1047
+ children: /* @__PURE__ */ jsx11(PageTitle, { block: linkedBlock })
1064
1048
  }
1065
1049
  );
1066
1050
  }
1067
1051
  }
1068
1052
  }
1069
1053
  case "h":
1070
- return /* @__PURE__ */ jsx13("span", { className: `notion-${decorator[1]}`, children: element });
1054
+ return /* @__PURE__ */ jsx11("span", { className: `notion-${decorator[1]}`, children: element });
1071
1055
  case "c":
1072
- return /* @__PURE__ */ jsx13("code", { className: "notion-inline-code", children: element });
1056
+ return /* @__PURE__ */ jsx11("code", { className: "notion-inline-code", children: element });
1073
1057
  case "b":
1074
- return /* @__PURE__ */ jsx13("b", { children: element });
1058
+ return /* @__PURE__ */ jsx11("b", { children: element });
1075
1059
  case "i":
1076
- return /* @__PURE__ */ jsx13("em", { children: element });
1060
+ return /* @__PURE__ */ jsx11("em", { children: element });
1077
1061
  case "s":
1078
- return /* @__PURE__ */ jsx13("s", { children: element });
1062
+ return /* @__PURE__ */ jsx11("s", { children: element });
1079
1063
  case "_":
1080
- return /* @__PURE__ */ jsx13("span", { className: "notion-inline-underscore", children: element });
1064
+ return /* @__PURE__ */ jsx11("span", { className: "notion-inline-underscore", children: element });
1081
1065
  case "e":
1082
- return /* @__PURE__ */ jsx13(components.Equation, { math: decorator[1], inline: true });
1066
+ return /* @__PURE__ */ jsx11(components.Equation, { math: decorator[1], inline: true });
1083
1067
  case "m":
1084
1068
  return element;
1085
1069
  //still need to return the base element
@@ -1089,7 +1073,7 @@ function Text({
1089
1073
  const id = parsePageId(pathname, { uuid: true });
1090
1074
  if (rootDomain && v.includes(rootDomain) || id && v[0] === "/") {
1091
1075
  const href = rootDomain && v.includes(rootDomain) ? v : `${mapPageUrl(id)}${getHashFragmentValue(v)}`;
1092
- return /* @__PURE__ */ jsx13(
1076
+ return /* @__PURE__ */ jsx11(
1093
1077
  components.PageLink,
1094
1078
  {
1095
1079
  className: "notion-link",
@@ -1099,7 +1083,7 @@ function Text({
1099
1083
  }
1100
1084
  );
1101
1085
  } else {
1102
- return /* @__PURE__ */ jsx13(
1086
+ return /* @__PURE__ */ jsx11(
1103
1087
  components.Link,
1104
1088
  {
1105
1089
  className: "notion-link",
@@ -1130,7 +1114,7 @@ function Text({
1130
1114
  }
1131
1115
  case "u": {
1132
1116
  const userId = decorator[1];
1133
- const user = (_d = recordMap.notion_user[userId]) == null ? void 0 : _d.value;
1117
+ const user = getBlockValue2(recordMap.notion_user[userId]);
1134
1118
  if (!user) {
1135
1119
  console.log("missing user", userId);
1136
1120
  return null;
@@ -1138,16 +1122,22 @@ function Text({
1138
1122
  const src = mapImageUrl(user.profile_photo, block);
1139
1123
  if (!src) return null;
1140
1124
  const name = [user.given_name, user.family_name].filter(Boolean).join(" ");
1141
- return /* @__PURE__ */ jsx13(GracefulImage, { className: "notion-user", src, alt: name });
1125
+ return /* @__PURE__ */ jsx11(GracefulImage, { className: "notion-user", src, alt: name });
1142
1126
  }
1143
1127
  case "lm": {
1144
1128
  const metadata = decorator[1];
1145
- return /* @__PURE__ */ jsx13(LinkMention, { metadata });
1129
+ return /* @__PURE__ */ jsx11(LinkMention, { metadata });
1146
1130
  }
1147
1131
  case "eoi": {
1148
1132
  const blockId = decorator[1];
1149
- const externalObjectInstance = (_e = recordMap.block[blockId]) == null ? void 0 : _e.value;
1150
- return /* @__PURE__ */ jsx13(EOI, { block: externalObjectInstance, inline: true });
1133
+ const externalObjectInstance = getBlockValue2(
1134
+ recordMap.block[blockId]
1135
+ );
1136
+ if (!externalObjectInstance) {
1137
+ console.log('"eoi" missing block', blockId);
1138
+ return null;
1139
+ }
1140
+ return /* @__PURE__ */ jsx11(EOI, { block: externalObjectInstance, inline: true });
1151
1141
  }
1152
1142
  case "si":
1153
1143
  return null;
@@ -1158,57 +1148,101 @@ function Text({
1158
1148
  return element;
1159
1149
  }
1160
1150
  },
1161
- /* @__PURE__ */ jsx13(Fragment, { children: text })
1151
+ /* @__PURE__ */ jsx11(Fragment, { children: text })
1162
1152
  );
1163
- return /* @__PURE__ */ jsx13(React9.Fragment, { children: formatted }, index);
1153
+ return /* @__PURE__ */ jsx11(React7.Fragment, { children: formatted }, index);
1164
1154
  }) });
1165
1155
  }
1166
1156
 
1167
- // src/components/page-title.tsx
1157
+ // src/components/header.tsx
1158
+ import { getPageBreadcrumbs } from "notion-utils";
1159
+ import React12 from "react";
1160
+ import { useHotkeys } from "react-hotkeys-hook";
1161
+
1162
+ // src/icons/search-icon.tsx
1163
+ import "react";
1164
+ import { jsx as jsx12 } from "react/jsx-runtime";
1165
+ function SearchIcon(props) {
1166
+ const { className, ...rest } = props;
1167
+ return /* @__PURE__ */ jsx12("svg", { className: cs("notion-icon", className), viewBox: "0 0 17 17", ...rest, children: /* @__PURE__ */ jsx12("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" }) });
1168
+ }
1169
+
1170
+ // src/components/search-dialog.tsx
1171
+ var import_lodash = __toESM(require_lodash(), 1);
1172
+ import { getBlockParentPage, getBlockTitle as getBlockTitle3 } from "notion-utils";
1173
+ import React11 from "react";
1174
+
1175
+ // src/icons/clear-icon.tsx
1176
+ import "react";
1177
+ import { jsx as jsx13 } from "react/jsx-runtime";
1178
+ function ClearIcon(props) {
1179
+ const { className, ...rest } = props;
1180
+ return /* @__PURE__ */ jsx13("svg", { className: cs("notion-icon", className), ...rest, viewBox: "0 0 30 30", children: /* @__PURE__ */ jsx13("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" }) });
1181
+ }
1182
+
1183
+ // src/icons/loading-icon.tsx
1184
+ import "react";
1168
1185
  import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
1169
- function PageTitleImpl({
1170
- block,
1171
- className,
1172
- defaultIcon,
1173
- ...rest
1174
- }) {
1175
- var _a, _b;
1176
- const { recordMap } = useNotionContext();
1177
- if (!block) return null;
1178
- if (block.type === "collection_view_page" || block.type === "collection_view") {
1179
- const title = getBlockTitle2(block, recordMap);
1180
- if (!title) {
1181
- return null;
1182
- }
1183
- const titleDecoration = [[title]];
1184
- return /* @__PURE__ */ jsxs6("span", { className: cs("notion-page-title", className), ...rest, children: [
1186
+ function LoadingIcon(props) {
1187
+ const { className, ...rest } = props;
1188
+ return /* @__PURE__ */ jsxs6("svg", { className: cs("notion-icon", className), ...rest, viewBox: "0 0 24 24", children: [
1189
+ /* @__PURE__ */ jsx14("defs", { children: /* @__PURE__ */ jsxs6(
1190
+ "linearGradient",
1191
+ {
1192
+ x1: "28.1542969%",
1193
+ y1: "63.7402344%",
1194
+ x2: "74.6289062%",
1195
+ y2: "17.7832031%",
1196
+ id: "linearGradient-1",
1197
+ children: [
1198
+ /* @__PURE__ */ jsx14("stop", { stopColor: "rgba(164, 164, 164, 1)", offset: "0%" }),
1199
+ /* @__PURE__ */ jsx14(
1200
+ "stop",
1201
+ {
1202
+ stopColor: "rgba(164, 164, 164, 0)",
1203
+ stopOpacity: "0",
1204
+ offset: "100%"
1205
+ }
1206
+ )
1207
+ ]
1208
+ }
1209
+ ) }),
1210
+ /* @__PURE__ */ jsx14("g", { id: "Page-1", stroke: "none", strokeWidth: "1", fill: "none", children: /* @__PURE__ */ jsx14("g", { transform: "translate(-236.000000, -286.000000)", children: /* @__PURE__ */ jsxs6("g", { transform: "translate(238.000000, 286.000000)", children: [
1185
1211
  /* @__PURE__ */ jsx14(
1186
- PageIcon,
1212
+ "circle",
1187
1213
  {
1188
- block,
1189
- defaultIcon,
1190
- className: "notion-page-title-icon"
1214
+ id: "Oval-2",
1215
+ stroke: "url(#linearGradient-1)",
1216
+ strokeWidth: "4",
1217
+ cx: "10",
1218
+ cy: "12",
1219
+ r: "10"
1191
1220
  }
1192
1221
  ),
1193
- /* @__PURE__ */ jsx14("span", { className: "notion-page-title-text", children: /* @__PURE__ */ jsx14(Text, { value: titleDecoration, block }) })
1194
- ] });
1195
- }
1196
- if (!((_a = block.properties) == null ? void 0 : _a.title)) {
1197
- return null;
1198
- }
1199
- return /* @__PURE__ */ jsxs6("span", { className: cs("notion-page-title", className), ...rest, children: [
1200
- /* @__PURE__ */ jsx14(
1201
- PageIcon,
1202
- {
1203
- block,
1204
- defaultIcon,
1205
- className: "notion-page-title-icon"
1206
- }
1207
- ),
1208
- /* @__PURE__ */ jsx14("span", { className: "notion-page-title-text", children: /* @__PURE__ */ jsx14(Text, { value: (_b = block.properties) == null ? void 0 : _b.title, block }) })
1222
+ /* @__PURE__ */ jsx14(
1223
+ "path",
1224
+ {
1225
+ d: "M10,2 C4.4771525,2 0,6.4771525 0,12",
1226
+ id: "Oval-2",
1227
+ stroke: "rgba(164, 164, 164, 1)",
1228
+ strokeWidth: "4"
1229
+ }
1230
+ ),
1231
+ /* @__PURE__ */ jsx14(
1232
+ "rect",
1233
+ {
1234
+ id: "Rectangle-1",
1235
+ fill: "rgba(164, 164, 164, 1)",
1236
+ x: "8",
1237
+ y: "0",
1238
+ width: "4",
1239
+ height: "4",
1240
+ rx: "8"
1241
+ }
1242
+ )
1243
+ ] }) }) })
1209
1244
  ] });
1210
1245
  }
1211
- var PageTitle = React10.memo(PageTitleImpl);
1212
1246
 
1213
1247
  // src/components/search-dialog.tsx
1214
1248
  import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
@@ -1228,8 +1262,8 @@ var SearchDialog = class extends React11.Component {
1228
1262
  this._inputRef.current.focus();
1229
1263
  }
1230
1264
  });
1231
- __publicField(this, "_onChangeQuery", (e) => {
1232
- const query = e.target.value;
1265
+ __publicField(this, "_onChangeQuery", (e2) => {
1266
+ const query = e2.target.value;
1233
1267
  this.setState({ query });
1234
1268
  if (!query.trim()) {
1235
1269
  this.setState({ isLoading: false, searchResult: null, searchError: null });
@@ -1938,7 +1972,7 @@ function extractHostname(url) {
1938
1972
  try {
1939
1973
  const hostname = new URL(url).hostname;
1940
1974
  return hostname;
1941
- } catch (e) {
1975
+ } catch (e2) {
1942
1976
  return "";
1943
1977
  }
1944
1978
  }
@@ -2084,6 +2118,8 @@ var defaultComponents = {
2084
2118
  Checkbox,
2085
2119
  Callout: void 0,
2086
2120
  // use the built-in callout rendering by default
2121
+ Button: void 0,
2122
+ // use the built-in button rendering by default
2087
2123
  Code: dummyComponent("Code"),
2088
2124
  Equation: dummyComponent("Equation"),
2089
2125
  Collection: dummyComponent("Collection"),
@@ -2224,7 +2260,7 @@ function Equation({
2224
2260
  inline ? "notion-equation-inline" : "notion-equation-block",
2225
2261
  className
2226
2262
  ),
2227
- children: inline ? /* @__PURE__ */ jsx24(Katex, { math, settings: katexSettings, ...rest }) : /* @__PURE__ */ jsx24(Katex, { math, settings: katexSettings, ...rest, block: true })
2263
+ children: inline ? /* @__PURE__ */ jsx24(react_katex_m_default, { math, settings: katexSettings, ...rest }) : /* @__PURE__ */ jsx24(react_katex_m_default, { math, settings: katexSettings, ...rest, block: true })
2228
2264
  }
2229
2265
  );
2230
2266
  }