@texonom/nreact 1.6.2 → 1.6.4

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.
Files changed (33) hide show
  1. package/build/asset-wrapper-BjCXzGmC.js +1056 -0
  2. package/build/asset-wrapper-BjCXzGmC.js.map +1 -0
  3. package/build/block.d.ts.map +1 -1
  4. package/build/collection-column-title-Bw3sXBSk.js +113 -0
  5. package/build/collection-column-title-Bw3sXBSk.js.map +1 -0
  6. package/build/components/editable-text.d.ts +18 -0
  7. package/build/components/editable-text.d.ts.map +1 -0
  8. package/build/components/editable-text.test.d.ts +2 -0
  9. package/build/components/editable-text.test.d.ts.map +1 -0
  10. package/build/context.d.ts +4 -0
  11. package/build/context.d.ts.map +1 -1
  12. package/build/index.js +596 -689
  13. package/build/index.js.map +1 -1
  14. package/build/renderer.d.ts +2 -0
  15. package/build/renderer.d.ts.map +1 -1
  16. package/build/rolldown-runtime-CEFd7nDs.js +30 -0
  17. package/build/third-party/code.js +559 -196
  18. package/build/third-party/code.js.map +1 -1
  19. package/build/third-party/collection.js +2690 -3432
  20. package/build/third-party/collection.js.map +1 -1
  21. package/build/third-party/equation.js +27 -43
  22. package/build/third-party/equation.js.map +1 -1
  23. package/build/third-party/modal.js +1355 -1615
  24. package/build/third-party/modal.js.map +1 -1
  25. package/license +21 -0
  26. package/package.json +16 -13
  27. package/src/styles.css +16 -0
  28. package/build/_commonjsHelpers-ByYUsBRP.js +0 -34
  29. package/build/_commonjsHelpers-ByYUsBRP.js.map +0 -1
  30. package/build/asset-wrapper-CVJvW06J.js +0 -984
  31. package/build/asset-wrapper-CVJvW06J.js.map +0 -1
  32. package/build/collection-column-title-l4hmVo49.js +0 -99
  33. package/build/collection-column-title-l4hmVo49.js.map +0 -1
@@ -0,0 +1,1056 @@
1
+ import { n as e, o as t, t as n } from "./rolldown-runtime-CEFd7nDs.js";
2
+ import r from "react";
3
+ import { defaultMapImageUrl as i, defaultMapPageUrl as a, formatDate as o, formatNotionDateTime as s, getBlockIcon as c, getBlockParentPage as l, getBlockTitle as u, getPageBreadcrumbs as d, getTextContent as f, isUrl as p, normalizeUrl as m, parsePageId as h } from "@texonom/nutils";
4
+ import { useHotkeys as g } from "react-hotkeys-hook";
5
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
6
+ function _(e) {
7
+ "@babel/helpers - typeof";
8
+ return _ = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(e) {
9
+ return typeof e;
10
+ } : function(e) {
11
+ return e && typeof Symbol == "function" && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
12
+ }, _(e);
13
+ }
14
+ //#endregion
15
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
16
+ function v(e, t) {
17
+ if (_(e) != "object" || !e) return e;
18
+ var n = e[Symbol.toPrimitive];
19
+ if (n !== void 0) {
20
+ var r = n.call(e, t || "default");
21
+ if (_(r) != "object") return r;
22
+ throw TypeError("@@toPrimitive must return a primitive value.");
23
+ }
24
+ return (t === "string" ? String : Number)(e);
25
+ }
26
+ //#endregion
27
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
28
+ function y(e) {
29
+ var t = v(e, "string");
30
+ return _(t) == "symbol" ? t : t + "";
31
+ }
32
+ //#endregion
33
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
34
+ function b(e, t, n) {
35
+ return (t = y(t)) in e ? Object.defineProperty(e, t, {
36
+ value: n,
37
+ enumerable: !0,
38
+ configurable: !0,
39
+ writable: !0
40
+ }) : e[t] = n, e;
41
+ }
42
+ //#endregion
43
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/objectSpread2.js
44
+ function x(e, t) {
45
+ var n = Object.keys(e);
46
+ if (Object.getOwnPropertySymbols) {
47
+ var r = Object.getOwnPropertySymbols(e);
48
+ t && (r = r.filter(function(t) {
49
+ return Object.getOwnPropertyDescriptor(e, t).enumerable;
50
+ })), n.push.apply(n, r);
51
+ }
52
+ return n;
53
+ }
54
+ function S(e) {
55
+ for (var t = 1; t < arguments.length; t++) {
56
+ var n = arguments[t] == null ? {} : arguments[t];
57
+ t % 2 ? x(Object(n), !0).forEach(function(t) {
58
+ b(e, t, n[t]);
59
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : x(Object(n)).forEach(function(t) {
60
+ Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
61
+ });
62
+ }
63
+ return e;
64
+ }
65
+ //#endregion
66
+ //#region src/icons/check.tsx
67
+ function C(e) {
68
+ return /* @__PURE__ */ r.createElement("svg", S({ viewBox: "0 0 14 14" }, e), /* @__PURE__ */ r.createElement("path", { d: "M5.5 12L14 3.5 12.5 2l-7 7-4-4.003L0 6.499z" }));
69
+ }
70
+ //#endregion
71
+ //#region src/components/checkbox.tsx
72
+ var w = ({ isChecked: e }) => {
73
+ let t = null;
74
+ return t = e ? /* @__PURE__ */ r.createElement("div", { className: "notion-property-checkbox-checked" }, /* @__PURE__ */ r.createElement(C, null)) : /* @__PURE__ */ r.createElement("div", { className: "notion-property-checkbox-unchecked" }), /* @__PURE__ */ r.createElement("span", { className: "notion-property notion-property-checkbox" }, t);
75
+ };
76
+ //#endregion
77
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/objectWithoutPropertiesLoose.js
78
+ function T(e, t) {
79
+ if (e == null) return {};
80
+ var n = {};
81
+ for (var r in e) if ({}.hasOwnProperty.call(e, r)) {
82
+ if (t.includes(r)) continue;
83
+ n[r] = e[r];
84
+ }
85
+ return n;
86
+ }
87
+ //#endregion
88
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/objectWithoutProperties.js
89
+ function E(e, t) {
90
+ if (e == null) return {};
91
+ var n, r, i = T(e, t);
92
+ if (Object.getOwnPropertySymbols) {
93
+ var a = Object.getOwnPropertySymbols(e);
94
+ for (r = 0; r < a.length; r++) n = a[r], t.includes(n) || {}.propertyIsEnumerable.call(e, n) && (i[n] = e[n]);
95
+ }
96
+ return i;
97
+ }
98
+ //#endregion
99
+ //#region src/icons/search-icon.tsx
100
+ var ee = ["className"], D = (e) => {
101
+ let { className: t } = e, n = E(e, ee);
102
+ return /* @__PURE__ */ r.createElement("svg", S({
103
+ className: `notion-icon ${t || ""}`,
104
+ viewBox: "0 0 17 17"
105
+ }, n), /* @__PURE__ */ r.createElement("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" }));
106
+ }, te = ["className"], ne = (e) => {
107
+ let { className: t } = e, n = E(e, te);
108
+ return /* @__PURE__ */ r.createElement("svg", S(S({ className: t }, n), {}, {
109
+ viewBox: "0 0 30 30",
110
+ width: "16"
111
+ }), /* @__PURE__ */ r.createElement("path", { d: "M16,1H4v28h22V11L16,1z M16,3.828L23.172,11H16V3.828z M24,27H6V3h8v10h10V27z M8,17h14v-2H8V17z M8,21h14v-2H8V21z M8,25h14v-2H8V25z" }));
112
+ }, re = (e) => {
113
+ let t = [], n, r = -1;
114
+ return Object.keys(e).forEach((i) => {
115
+ var a, o;
116
+ let s = (a = e[i]) == null ? void 0 : a.value;
117
+ s && ((o = s.content) == null || o.forEach((i) => {
118
+ var a;
119
+ let o = (a = e[i]) == null || (a = a.value) == null ? void 0 : a.type;
120
+ o && o !== n && (r++, n = o, t[r] = []), r > -1 && t[r].push(i);
121
+ })), n = void 0;
122
+ }), t;
123
+ }, ie = (e, t) => {
124
+ let n = re(t).find((t) => t.includes(e));
125
+ if (n) return n.indexOf(e) + 1;
126
+ }, O = (e) => e.includes("#") ? e.replace(/^.+(#.+)$/, "$1") : "", ae = typeof window < "u", oe = /* @__PURE__ */ new Set([
127
+ "youtu.be",
128
+ "youtube.com",
129
+ "www.youtube.com",
130
+ "youtube-nocookie.com",
131
+ "www.youtube-nocookie.com"
132
+ ]), k = (e) => {
133
+ try {
134
+ let { hostname: t } = new URL(e);
135
+ if (!oe.has(t)) return null;
136
+ let n = e.match(/^.*(youtu\.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/i);
137
+ if (n && n[2].length == 11) return n[2];
138
+ } catch (e) {}
139
+ return null;
140
+ }, se = [
141
+ "src",
142
+ "alt",
143
+ "className",
144
+ "style",
145
+ "zoomable",
146
+ "priority",
147
+ "height",
148
+ "onError"
149
+ ], A = (e) => {
150
+ var t, n, i;
151
+ let { src: a, alt: o, className: s, style: c, zoomable: l = !1, priority: u = !1, height: d, onError: f } = e, p = E(e, se), { recordMap: h, zoom: g, previewImages: _, forceCustomImages: v, components: y } = Q(), b = r.useRef(g ? g.clone() : null), x = _ ? (t = h == null || (n = h.preview_images) == null ? void 0 : n[a]) == null ? h == null || (i = h.preview_images) == null ? void 0 : i[m(a)] : t : null, C = r.useCallback((e) => {
152
+ l && (e.target.src || e.target.srcset) && b.current && b.current.attach(e.target);
153
+ }, [b, l]), w = r.useCallback((e) => {
154
+ b.current && e && b.current.attach(e);
155
+ }, [b]), T = r.useMemo(() => l ? w : void 0, [l, w]);
156
+ return x && y.Image ? /* @__PURE__ */ r.createElement(y.Image, {
157
+ src: a,
158
+ alt: o,
159
+ style: c,
160
+ className: s,
161
+ width: x.originalWidth,
162
+ height: x.originalHeight,
163
+ blurDataURL: x.dataURIBase64,
164
+ placeholder: "blur",
165
+ priority: u,
166
+ onLoad: C
167
+ }) : y.Image && v ? /* @__PURE__ */ r.createElement(y.Image, {
168
+ src: a,
169
+ alt: o,
170
+ className: s,
171
+ style: c,
172
+ width: null,
173
+ height: d || null,
174
+ priority: u,
175
+ onLoad: C
176
+ }) : /* @__PURE__ */ r.createElement("img", S({
177
+ className: s,
178
+ style: c,
179
+ src: a,
180
+ alt: o,
181
+ ref: T,
182
+ loading: "lazy",
183
+ decoding: "async",
184
+ onError: f
185
+ }, p));
186
+ }, ce = (e) => e.type === "page" || e.type === "callout" || e.type === "collection_view" || e.type === "collection_view_page", j = ({ block: e, className: t, inline: n = !0, hideDefaultIcon: i = !1, defaultIcon: a }) => {
187
+ let { mapImageUrl: o, recordMap: s, darkMode: l } = Q(), d = !1, f = null;
188
+ if (ce(e)) {
189
+ var m;
190
+ let n = ((m = c(e, s)) == null ? void 0 : m.trim()) || a, h = u(e, s);
191
+ if (n && p(n)) {
192
+ let i = o(n, e);
193
+ d = !0, f = /* @__PURE__ */ r.createElement(A, {
194
+ src: i,
195
+ alt: h || "page icon",
196
+ className: `${t || ""} notion-page-icon`
197
+ });
198
+ } else if (n && n.startsWith("/icons/")) {
199
+ let e = "https://www.notion.so" + n + "?mode=" + (l ? "dark" : "light");
200
+ f = /* @__PURE__ */ r.createElement(A, {
201
+ src: e,
202
+ alt: h || "page icon",
203
+ className: `${t || ""} notion-page-icon`
204
+ });
205
+ } else n ? (d = !1, f = /* @__PURE__ */ r.createElement("span", {
206
+ className: `${t || ""} notion-page-icon`,
207
+ role: "img",
208
+ "aria-label": n
209
+ }, n)) : i || (d = !0, f = /* @__PURE__ */ r.createElement(ne, {
210
+ className: `${t || ""} notion-page-icon`,
211
+ alt: h || "page icon"
212
+ }));
213
+ }
214
+ return f ? /* @__PURE__ */ r.createElement("div", { className: `
215
+ ${n ? "notion-page-icon-inline" : "notion-page-icon-hero"}
216
+ ${d ? "notion-page-icon-image" : "notion-page-icon-span"}
217
+ ` }, f) : null;
218
+ }, M = r.memo(j), le = ["className"], ue = (e) => {
219
+ let { className: t } = e, n = E(e, le);
220
+ return /* @__PURE__ */ r.createElement("svg", S(S({ className: `notion-icon ${t || ""}` }, n), {}, { viewBox: "0 0 30 30" }), /* @__PURE__ */ r.createElement("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" }));
221
+ }, de = ["className"], fe = (e) => {
222
+ let { className: t } = e, n = E(e, de);
223
+ return /* @__PURE__ */ r.createElement("svg", S(S({ className: `notion-icon ${t || ""}` }, n), {}, { viewBox: "0 0 24 24" }), /* @__PURE__ */ r.createElement("defs", null, /* @__PURE__ */ r.createElement("linearGradient", {
224
+ x1: "28.1542969%",
225
+ y1: "63.7402344%",
226
+ x2: "74.6289062%",
227
+ y2: "17.7832031%",
228
+ id: "linearGradient-1"
229
+ }, /* @__PURE__ */ r.createElement("stop", {
230
+ stopColor: "rgba(164, 164, 164, 1)",
231
+ offset: "0%"
232
+ }), /* @__PURE__ */ r.createElement("stop", {
233
+ stopColor: "rgba(164, 164, 164, 0)",
234
+ stopOpacity: "0",
235
+ offset: "100%"
236
+ }))), /* @__PURE__ */ r.createElement("g", {
237
+ id: "Page-1",
238
+ stroke: "none",
239
+ strokeWidth: "1",
240
+ fill: "none"
241
+ }, /* @__PURE__ */ r.createElement("g", { transform: "translate(-236.000000, -286.000000)" }, /* @__PURE__ */ r.createElement("g", { transform: "translate(238.000000, 286.000000)" }, /* @__PURE__ */ r.createElement("circle", {
242
+ id: "Oval-2",
243
+ stroke: "url(#linearGradient-1)",
244
+ strokeWidth: "4",
245
+ cx: "10",
246
+ cy: "12",
247
+ r: "10"
248
+ }), /* @__PURE__ */ r.createElement("path", {
249
+ d: "M10,2 C4.4771525,2 0,6.4771525 0,12",
250
+ id: "Oval-2",
251
+ stroke: "rgba(164, 164, 164, 1)",
252
+ strokeWidth: "4"
253
+ }), /* @__PURE__ */ r.createElement("rect", {
254
+ id: "Rectangle-1",
255
+ fill: "rgba(164, 164, 164, 1)",
256
+ x: "8",
257
+ y: "0",
258
+ width: "4",
259
+ height: "4",
260
+ rx: "8"
261
+ })))));
262
+ };
263
+ //#endregion
264
+ //#region src/icons/type-github.tsx
265
+ function pe(e) {
266
+ return /* @__PURE__ */ r.createElement("svg", S({ viewBox: "0 0 260 260" }, e), /* @__PURE__ */ r.createElement("g", null, /* @__PURE__ */ r.createElement("path", {
267
+ 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",
268
+ fill: "#161614"
269
+ })));
270
+ }
271
+ //#endregion
272
+ //#region src/components/eoi.tsx
273
+ var N = ({ block: e, inline: t, className: n }) => {
274
+ var i, a, o;
275
+ let { components: c } = Q(), { original_url: l, attributes: u, domain: d } = (e == null ? void 0 : e.format) || {};
276
+ if (!l || !u) return null;
277
+ let f = (i = u.find((e) => e.id === "title")) == null ? void 0 : i.values[0], p = (a = u.find((e) => e.id === "owner")) == null ? void 0 : a.values[0], m = (o = u.find((e) => e.id === "updated_at")) == null ? void 0 : o.values[0], h = m ? s(m) : null, g;
278
+ switch (d) {
279
+ case "github.com":
280
+ if (g = /* @__PURE__ */ r.createElement(pe, null), p) {
281
+ let e = p.split("/");
282
+ p = e[e.length - 1];
283
+ }
284
+ break;
285
+ default: return process.env.NODE_ENV !== "production" && console.debug(`Unsupported external_object_instance domain "${d}"`, JSON.stringify(e, null, 2)), null;
286
+ }
287
+ return /* @__PURE__ */ r.createElement(c.Link, {
288
+ target: "_blank",
289
+ rel: "noopener noreferrer",
290
+ href: l,
291
+ className: `notion-external ${t ? "notion-external-mention" : "notion-external-block notion-row"} ${n || ""}`
292
+ }, g && /* @__PURE__ */ r.createElement("div", { className: "notion-external-image" }, g), /* @__PURE__ */ r.createElement("div", { className: "notion-external-description" }, /* @__PURE__ */ r.createElement("div", { className: "notion-external-title" }, f), (p || h) && /* @__PURE__ */ r.createElement("div", { className: "notion-external-subtitle" }, p && /* @__PURE__ */ r.createElement("span", null, p), p && h && /* @__PURE__ */ r.createElement("span", null, " • "), h && /* @__PURE__ */ r.createElement("span", null, "Updated ", h))));
293
+ }, P = (e) => /* @__PURE__ */ r.createElement("img", S({ loading: "lazy" }, e)), F = ({ value: e, block: t, linkProps: n, linkProtocol: i }) => {
294
+ let { components: a, recordMap: s, mapPageUrl: c, mapImageUrl: l, rootDomain: u } = Q();
295
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, e == null ? void 0 : e.map((e, d) => {
296
+ let [f, p] = e;
297
+ if (!p) return f === "," ? /* @__PURE__ */ r.createElement("span", {
298
+ key: d,
299
+ style: { padding: "0.5em" }
300
+ }) : /* @__PURE__ */ r.createElement(r.Fragment, { key: d }, f);
301
+ let m = p.reduce((e, d) => {
302
+ switch (d[0]) {
303
+ case "p": {
304
+ var f;
305
+ let e = d[1], t = (f = s.block[e]) == null ? void 0 : f.value;
306
+ return t ? /* @__PURE__ */ r.createElement(a.PageLink, {
307
+ className: "notion-link",
308
+ href: c(e)
309
+ }, /* @__PURE__ */ r.createElement(L, { block: t })) : (console.debug("\"p\" missing block", e), null);
310
+ }
311
+ case "‣": {
312
+ let e = d[1][0], i = d[1][1];
313
+ switch (e) {
314
+ case "u": {
315
+ var p;
316
+ let e = (p = s.notion_user[i]) == null ? void 0 : p.value;
317
+ if (!e) return console.debug("\"‣\" missing user", i), null;
318
+ let o = [e.given_name, e.family_name].filter(Boolean).join(" "), c = e.email;
319
+ return /* @__PURE__ */ r.createElement(a.Link, S({
320
+ className: "notion-link",
321
+ href: `mailto:${c}`
322
+ }, n), /* @__PURE__ */ r.createElement(P, {
323
+ className: "notion-user",
324
+ src: l(e.profile_photo, t),
325
+ alt: o,
326
+ style: {
327
+ display: "inline",
328
+ marginRight: "0.3em",
329
+ marginBottom: "0.3em"
330
+ }
331
+ }), o);
332
+ }
333
+ default: {
334
+ var m;
335
+ let t = (m = s.block[i]) == null ? void 0 : m.value;
336
+ return t ? /* @__PURE__ */ r.createElement(a.PageLink, S(S({
337
+ className: "notion-link",
338
+ href: c(i)
339
+ }, n), {}, {
340
+ target: "_blank",
341
+ rel: "noopener noreferrer"
342
+ }), /* @__PURE__ */ r.createElement(L, { block: t })) : (console.debug("\"‣\" missing block", e, i), null);
343
+ }
344
+ }
345
+ }
346
+ case "h": return /* @__PURE__ */ r.createElement("span", { className: `notion-${d[1]}` }, e);
347
+ case "c": return /* @__PURE__ */ r.createElement("code", { className: "notion-inline-code" }, e);
348
+ case "b": return /* @__PURE__ */ r.createElement("b", null, e);
349
+ case "i": return /* @__PURE__ */ r.createElement("em", null, e);
350
+ case "s": return /* @__PURE__ */ r.createElement("s", null, e);
351
+ case "_": return /* @__PURE__ */ r.createElement("span", { className: "notion-inline-underscore" }, e);
352
+ case "e": return /* @__PURE__ */ r.createElement(a.Equation, {
353
+ math: d[1],
354
+ inline: !0
355
+ });
356
+ case "m": return e;
357
+ case "a": {
358
+ let t = d[1], o = t.substring(1), s = h(o, { uuid: !0 });
359
+ if ((t[0] === "/" || t.includes(u)) && s) {
360
+ let i = t.includes(u) ? t : `${c(s)}${O(t)}`;
361
+ return /* @__PURE__ */ r.createElement(a.PageLink, S({
362
+ className: "notion-link",
363
+ href: i
364
+ }, n), e);
365
+ }
366
+ return /* @__PURE__ */ r.createElement(a.Link, S({
367
+ className: "notion-link",
368
+ href: i ? `${i}:${d[1]}` : d[1]
369
+ }, n), e);
370
+ }
371
+ case "d": {
372
+ let t = d[1], n = t == null ? void 0 : t.type;
373
+ if (n === "date") {
374
+ let e = t.start_date;
375
+ return o(e);
376
+ }
377
+ if (n === "daterange") {
378
+ let e = t.start_date, n = t.end_date;
379
+ return `${o(e)} → ${o(n)}`;
380
+ }
381
+ return e;
382
+ }
383
+ case "u": {
384
+ var g;
385
+ let e = d[1], i = (g = s.notion_user[e]) == null ? void 0 : g.value;
386
+ if (!i) return console.debug("missing user", e), null;
387
+ let o = i.name, c = i.email;
388
+ return /* @__PURE__ */ r.createElement(a.Link, S({
389
+ className: "notion-link",
390
+ href: `mailto:${c}`
391
+ }, n), /* @__PURE__ */ r.createElement(P, {
392
+ className: "notion-user",
393
+ src: l(i.profile_photo, t),
394
+ alt: o,
395
+ style: {
396
+ display: "inline",
397
+ marginRight: "0.3em",
398
+ marginBottom: "0.3em"
399
+ }
400
+ }), o);
401
+ }
402
+ case "eoi": {
403
+ var _;
404
+ let e = d[1], t = (_ = s.block[e]) == null ? void 0 : _.value;
405
+ return /* @__PURE__ */ r.createElement(N, {
406
+ block: t,
407
+ inline: !0
408
+ });
409
+ }
410
+ default: return process.env.NODE_ENV !== "production" && console.debug("unsupported text format", d), e;
411
+ }
412
+ }, /* @__PURE__ */ r.createElement(r.Fragment, null, f));
413
+ return /* @__PURE__ */ r.createElement(r.Fragment, { key: d }, m);
414
+ }));
415
+ }, me = [
416
+ "block",
417
+ "className",
418
+ "defaultIcon"
419
+ ], I = (e) => {
420
+ var t, n;
421
+ let { block: i, className: a, defaultIcon: o } = e, s = E(e, me), { recordMap: c } = Q();
422
+ if (!i) return null;
423
+ if (i.type === "collection_view_page" || i.type === "collection_view") {
424
+ let e = u(i, c);
425
+ if (!e) return null;
426
+ let t = [[e]];
427
+ return /* @__PURE__ */ r.createElement("span", S({ className: `notion-page-title ${a || ""}` }, s), /* @__PURE__ */ r.createElement(M, {
428
+ block: i,
429
+ defaultIcon: o,
430
+ className: "notion-page-title-icon"
431
+ }), /* @__PURE__ */ r.createElement("span", { className: "notion-page-title-text" }, /* @__PURE__ */ r.createElement(F, {
432
+ value: t,
433
+ block: i
434
+ })));
435
+ }
436
+ return (t = i.properties) != null && t.title ? /* @__PURE__ */ r.createElement("span", S({ className: `notion-page-title ${a || ""}` }, s), /* @__PURE__ */ r.createElement(M, {
437
+ block: i,
438
+ defaultIcon: o,
439
+ className: "notion-page-title-icon"
440
+ }), /* @__PURE__ */ r.createElement("span", { className: "notion-page-title-text" }, /* @__PURE__ */ r.createElement(F, {
441
+ value: (n = i.properties) == null ? void 0 : n.title,
442
+ block: i
443
+ }))) : null;
444
+ }, L = r.memo(I);
445
+ //#endregion
446
+ //#region \0@oxc-project+runtime@0.153.0/helpers/esm/asyncToGenerator.js
447
+ function R(e, t, n, r, i, a, o) {
448
+ try {
449
+ var s = e[a](o), c = s.value;
450
+ } catch (e) {
451
+ n(e);
452
+ return;
453
+ }
454
+ s.done ? t(c) : Promise.resolve(c).then(r, i);
455
+ }
456
+ function z(e) {
457
+ return function() {
458
+ var t = this, n = arguments;
459
+ return new Promise(function(r, i) {
460
+ var a = e.apply(t, n);
461
+ function o(e) {
462
+ R(a, r, i, o, s, "next", e);
463
+ }
464
+ function s(e) {
465
+ R(a, r, i, o, s, "throw", e);
466
+ }
467
+ o(void 0);
468
+ });
469
+ };
470
+ }
471
+ var B = e((() => {}));
472
+ //#endregion
473
+ //#region src/components/search-dialog.tsx
474
+ B();
475
+ var he = (e, t) => {
476
+ let n;
477
+ return (...r) => {
478
+ n && clearTimeout(n), n = setTimeout(() => e(...r), t);
479
+ };
480
+ }, V = class extends r.Component {
481
+ constructor(e) {
482
+ var t;
483
+ super(e), t = this, this.state = {
484
+ isLoading: !1,
485
+ query: "",
486
+ searchResult: null,
487
+ searchError: null
488
+ }, this._onAfterOpen = () => {
489
+ this._inputRef.current && this._inputRef.current.focus();
490
+ }, this._onChangeQuery = (e) => {
491
+ let t = e.target.value;
492
+ if (this.setState({ query: t }), t.trim()) this._search();
493
+ else {
494
+ this.setState({
495
+ isLoading: !1,
496
+ searchResult: null,
497
+ searchError: null
498
+ });
499
+ return;
500
+ }
501
+ }, this._onClearQuery = () => {
502
+ this._onChangeQuery({ target: { value: "" } });
503
+ }, this._warmupSearch = z(function* () {
504
+ let { searchNotion: e, rootBlockId: n, rootSpaceId: r } = t.props;
505
+ yield e({
506
+ query: "",
507
+ spaceId: r,
508
+ filters: {
509
+ ancestors: [n],
510
+ isDeletedOnly: !1,
511
+ excludeTemplates: !0,
512
+ navigableBlockContentOnly: !0,
513
+ requireEditPermissions: !1
514
+ }
515
+ });
516
+ }), this._searchImpl = z(function* () {
517
+ let { searchNotion: e, rootBlockId: n, rootSpaceId: r } = t.props, { query: i } = t.state;
518
+ if (!i.trim()) {
519
+ t.setState({
520
+ isLoading: !1,
521
+ searchResult: null,
522
+ searchError: null
523
+ });
524
+ return;
525
+ }
526
+ t.setState({ isLoading: !0 });
527
+ let a = yield e({
528
+ query: i,
529
+ spaceId: r,
530
+ filters: {
531
+ ancestors: [n],
532
+ isDeletedOnly: !1,
533
+ excludeTemplates: !0,
534
+ navigableBlockContentOnly: !0,
535
+ requireEditPermissions: !1
536
+ }
537
+ });
538
+ console.debug("search", i, a);
539
+ let o = null, s = null;
540
+ if (a.error || a.errorId) s = a;
541
+ else {
542
+ o = S({}, a);
543
+ let e = o.results.map((e) => {
544
+ var t, n;
545
+ let r = (t = o.recordMap.block[e.id]) == null ? void 0 : t.value;
546
+ if (!r) return;
547
+ let i = u(r, o.recordMap);
548
+ if (i && (e.title = i, e.block = r, e.recordMap = o.recordMap, e.page = l(r, o.recordMap, { inclusive: !0 }) || r, e.page.id)) return (n = e.highlight) != null && n.text && (e.highlight.html = e.highlight.text.replace(/<gzkNfoUU>/gi, "<b>").replace(/<\/gzkNfoUU>/gi, "</b>")), e;
549
+ }).filter(Boolean).reduce((e, t) => S(S({}, e), {}, { [t.page.id]: t }), {});
550
+ o.results = Object.values(e);
551
+ }
552
+ t.state.query === i && t.setState({
553
+ isLoading: !1,
554
+ searchResult: o,
555
+ searchError: s
556
+ });
557
+ }), this._inputRef = r.createRef();
558
+ }
559
+ componentDidMount() {
560
+ this._search = he(this._searchImpl.bind(this), 500), this._warmupSearch();
561
+ }
562
+ render() {
563
+ let { isOpen: e, onClose: t } = this.props, { isLoading: n, query: i, searchResult: a, searchError: o } = this.state, s = !!i.trim();
564
+ return /* @__PURE__ */ r.createElement(Z, null, (c) => {
565
+ let { components: l, defaultPageIcon: u, mapPageUrl: d } = c;
566
+ return /* @__PURE__ */ r.createElement(l.Modal, {
567
+ isOpen: e,
568
+ contentLabel: "Search",
569
+ className: "notion-search",
570
+ overlayClassName: "notion-search-overlay",
571
+ onRequestClose: t,
572
+ onAfterOpen: this._onAfterOpen
573
+ }, /* @__PURE__ */ r.createElement("div", { className: "quickFindMenu" }, /* @__PURE__ */ r.createElement("div", { className: "searchBar" }, /* @__PURE__ */ r.createElement("div", { className: "inlineIcon" }, n ? /* @__PURE__ */ r.createElement(fe, { className: "loadingIcon" }) : /* @__PURE__ */ r.createElement(D, null)), /* @__PURE__ */ r.createElement("input", {
574
+ className: "searchInput",
575
+ placeholder: "Search",
576
+ value: i,
577
+ ref: this._inputRef,
578
+ onInput: this._onChangeQuery
579
+ }), i && /* @__PURE__ */ r.createElement("div", {
580
+ role: "button",
581
+ className: "clearButton",
582
+ onClick: this._onClearQuery
583
+ }, /* @__PURE__ */ r.createElement(ue, { className: "clearIcon" }))), s && a && /* @__PURE__ */ r.createElement(r.Fragment, null, a.results.length ? /* @__PURE__ */ r.createElement(X, S(S({}, c), {}, { recordMap: a.recordMap }), /* @__PURE__ */ r.createElement("div", { className: "resultsPane" }, a.results.map((e) => {
584
+ var t;
585
+ return /* @__PURE__ */ r.createElement(l.PageLink, {
586
+ key: e.id,
587
+ className: "result notion-page-link",
588
+ href: d(e.page.id, a.recordMap)
589
+ }, /* @__PURE__ */ r.createElement(L, {
590
+ block: e.page,
591
+ defaultIcon: u
592
+ }), ((t = e.highlight) == null ? void 0 : t.html) && /* @__PURE__ */ r.createElement("div", {
593
+ className: "notion-search-result-highlight",
594
+ dangerouslySetInnerHTML: { __html: e.highlight.html }
595
+ }));
596
+ })), /* @__PURE__ */ r.createElement("footer", { className: "resultsFooter" }, /* @__PURE__ */ r.createElement("div", null, /* @__PURE__ */ r.createElement("span", { className: "resultsCount" }, a.total), a.total === 1 ? " result" : " results"))) : /* @__PURE__ */ r.createElement("div", { className: "noResultsPane" }, /* @__PURE__ */ r.createElement("div", { className: "noResults" }, "No results"), /* @__PURE__ */ r.createElement("div", { className: "noResultsDetail" }, "Try different search terms"))), s && !a && o && /* @__PURE__ */ r.createElement("div", { className: "noResultsPane" }, /* @__PURE__ */ r.createElement("div", { className: "noResults" }, "Search error"))));
597
+ });
598
+ }
599
+ }, H = ({ block: e }) => /* @__PURE__ */ r.createElement("header", { className: "notion-header" }, /* @__PURE__ */ r.createElement("div", { className: "notion-nav-header" }, /* @__PURE__ */ r.createElement(U, { block: e }), /* @__PURE__ */ r.createElement(W, { block: e }))), U = ({ block: e, rootOnly: t = !1 }) => {
600
+ let { recordMap: n, mapPageUrl: i, components: a } = Q(), o = r.useMemo(() => {
601
+ let r = d(n, e.id);
602
+ return t ? [r[0]].filter(Boolean) : r;
603
+ }, [
604
+ n,
605
+ e.id,
606
+ t
607
+ ]);
608
+ return /* @__PURE__ */ r.createElement("div", {
609
+ className: "breadcrumbs",
610
+ key: "breadcrumbs"
611
+ }, o.map((e, t) => {
612
+ if (!e) return null;
613
+ let n = {}, s = { pageLink: a.PageLink };
614
+ return e.active ? s.pageLink = (e) => /* @__PURE__ */ r.createElement("div", e) : n.href = i(e.pageId), /* @__PURE__ */ r.createElement(r.Fragment, { key: e.pageId }, /* @__PURE__ */ r.createElement(s.pageLink, S({ className: `breadcrumb ${e.active && "active"}` }, n), e.icon && /* @__PURE__ */ r.createElement(M, {
615
+ className: "icon",
616
+ block: e.block
617
+ }), e.title && /* @__PURE__ */ r.createElement("span", { className: "title" }, e.title)), t < o.length - 1 && /* @__PURE__ */ r.createElement("span", { className: "spacer" }, "/"));
618
+ }));
619
+ }, W = ({ block: e, search: t, title: n = "Search" }) => {
620
+ let { searchNotion: i, rootPageId: a, isShowingSearch: o, onHideSearch: s, rootSpaceId: c } = Q(), l = t || i, [u, d] = r.useState(o);
621
+ r.useEffect(() => {
622
+ d(o);
623
+ }, [o]);
624
+ let f = r.useCallback(() => {
625
+ d(!0);
626
+ }, []), p = r.useCallback(() => {
627
+ d(!1), s && s();
628
+ }, [s]);
629
+ g("cmd+p", (e) => {
630
+ f(), e.preventDefault(), e.stopPropagation();
631
+ }), g("cmd+k", (e) => {
632
+ f(), e.preventDefault(), e.stopPropagation();
633
+ });
634
+ let m = !!l;
635
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, m && /* @__PURE__ */ r.createElement("div", {
636
+ role: "button",
637
+ className: "breadcrumb button notion-search-button",
638
+ onClick: f
639
+ }, /* @__PURE__ */ r.createElement(D, { className: "searchIcon" }), n && /* @__PURE__ */ r.createElement("span", { className: "title" }, n)), u && m && /* @__PURE__ */ r.createElement(V, {
640
+ isOpen: u,
641
+ rootBlockId: a || (e == null ? void 0 : e.id),
642
+ rootSpaceId: c,
643
+ onClose: p,
644
+ searchNotion: l
645
+ }));
646
+ }, ge = /* @__PURE__ */ t((/* @__PURE__ */ n(((e, t) => {
647
+ var n = typeof Element < "u", r = typeof Map == "function", i = typeof Set == "function", a = typeof ArrayBuffer == "function" && !!ArrayBuffer.isView;
648
+ function o(e, t) {
649
+ if (e === t) return !0;
650
+ if (e && t && typeof e == "object" && typeof t == "object") {
651
+ if (e.constructor !== t.constructor) return !1;
652
+ var s, c, l;
653
+ if (Array.isArray(e)) {
654
+ if (s = e.length, s != t.length) return !1;
655
+ for (c = s; c-- !== 0;) if (!o(e[c], t[c])) return !1;
656
+ return !0;
657
+ }
658
+ var u;
659
+ if (r && e instanceof Map && t instanceof Map) {
660
+ if (e.size !== t.size) return !1;
661
+ for (u = e.entries(); !(c = u.next()).done;) if (!t.has(c.value[0])) return !1;
662
+ for (u = e.entries(); !(c = u.next()).done;) if (!o(c.value[1], t.get(c.value[0]))) return !1;
663
+ return !0;
664
+ }
665
+ if (i && e instanceof Set && t instanceof Set) {
666
+ if (e.size !== t.size) return !1;
667
+ for (u = e.entries(); !(c = u.next()).done;) if (!t.has(c.value[0])) return !1;
668
+ return !0;
669
+ }
670
+ if (a && ArrayBuffer.isView(e) && ArrayBuffer.isView(t)) {
671
+ if (s = e.length, s != t.length) return !1;
672
+ for (c = s; c-- !== 0;) if (e[c] !== t[c]) return !1;
673
+ return !0;
674
+ }
675
+ if (e.constructor === RegExp) return e.source === t.source && e.flags === t.flags;
676
+ if (e.valueOf !== Object.prototype.valueOf && typeof e.valueOf == "function" && typeof t.valueOf == "function") return e.valueOf() === t.valueOf();
677
+ if (e.toString !== Object.prototype.toString && typeof e.toString == "function" && typeof t.toString == "function") return e.toString() === t.toString();
678
+ if (l = Object.keys(e), s = l.length, s !== Object.keys(t).length) return !1;
679
+ for (c = s; c-- !== 0;) if (!Object.prototype.hasOwnProperty.call(t, l[c])) return !1;
680
+ if (n && e instanceof Element) return !1;
681
+ for (c = s; c-- !== 0;) if ((l[c] !== "_owner" && l[c] !== "__v" && l[c] !== "__o" || !e.$$typeof) && !o(e[l[c]], t[l[c]])) return !1;
682
+ return !0;
683
+ }
684
+ return e !== e && t !== t;
685
+ }
686
+ t.exports = function(e, t) {
687
+ try {
688
+ return o(e, t);
689
+ } catch (e) {
690
+ if ((e.message || "").match(/stack|recursion/i)) return console.warn("react-fast-compare cannot handle circular refs"), !1;
691
+ throw e;
692
+ }
693
+ };
694
+ })))(), 1), _e = [
695
+ "src",
696
+ "alt",
697
+ "width",
698
+ "height",
699
+ "className",
700
+ "style",
701
+ "layout"
702
+ ], ve = [
703
+ "href",
704
+ "as",
705
+ "passHref",
706
+ "prefetch",
707
+ "replace",
708
+ "scroll",
709
+ "shallow",
710
+ "locale",
711
+ "className",
712
+ "style"
713
+ ], ye = (e) => r.memo(function(t) {
714
+ let { src: n, alt: i, width: a, height: o, className: s, style: c, layout: l } = t, u = E(t, _e);
715
+ return l || (l = a && o ? "intrinsic" : "fill"), /* @__PURE__ */ r.createElement(e, S({
716
+ className: s,
717
+ src: n,
718
+ alt: i,
719
+ width: l === "intrinsic" && a,
720
+ height: l === "intrinsic" && o,
721
+ objectFit: c == null ? void 0 : c.objectFit,
722
+ objectPosition: c == null ? void 0 : c.objectPosition,
723
+ layout: l
724
+ }, u));
725
+ }, ge.default), be = (e) => function(t) {
726
+ let { href: n, as: i, passHref: a, prefetch: o, replace: s, scroll: c, shallow: l, locale: u, className: d, style: f } = t, p = E(t, ve);
727
+ return /* @__PURE__ */ r.createElement(e, S({
728
+ href: n,
729
+ as: i,
730
+ prefetch: o,
731
+ replace: s,
732
+ scroll: c,
733
+ shallow: l,
734
+ locale: u,
735
+ className: d,
736
+ style: f
737
+ }, p));
738
+ }, xe = ["href"], Se = [
739
+ "href",
740
+ "rel",
741
+ "target",
742
+ "title"
743
+ ], Ce = [
744
+ "components",
745
+ "children",
746
+ "mapPageUrl",
747
+ "mapImageUrl",
748
+ "rootPageId",
749
+ "rootSpaceId"
750
+ ], we = r.memo((e) => /* @__PURE__ */ r.createElement("a", S({
751
+ target: "_blank",
752
+ rel: "noopener noreferrer"
753
+ }, e))), Te = r.memo((e) => {
754
+ let { href: t } = e, n = E(e, xe), { recordMap: i, rootSpaceId: a } = Q(), o = t;
755
+ if (typeof t == "string" && a) {
756
+ let e = h(t);
757
+ if (e) {
758
+ var s;
759
+ let t = i == null || (s = i.block) == null || (s = s[e]) == null ? void 0 : s.value;
760
+ (!t || t.space_id !== a) && (o = `https://notion.so/${e.replace(/-/g, "")}`);
761
+ }
762
+ }
763
+ return /* @__PURE__ */ r.createElement("a", S({ href: o }, n));
764
+ }), Ee = (e) => /* @__PURE__ */ r.createElement($, e), De = H, Oe = (e) => {
765
+ let { href: t, rel: n, target: i, title: a } = e, o = E(e, Se);
766
+ return /* @__PURE__ */ r.createElement("span", o);
767
+ }, G = (e) => () => (console.warn(`Warning: using empty component "${e}" (you should override this in NotionRenderer.components)`), null), K = (e, t) => t(), q = {
768
+ Image: null,
769
+ Link: we,
770
+ PageLink: Te,
771
+ Checkbox: w,
772
+ Callout: void 0,
773
+ Code: G("Code"),
774
+ Equation: G("Equation"),
775
+ Collection: G("Collection"),
776
+ Property: void 0,
777
+ propertyTextValue: K,
778
+ propertySelectValue: K,
779
+ propertyRelationValue: K,
780
+ propertyFormulaValue: K,
781
+ propertyTitleValue: K,
782
+ propertyPersonValue: K,
783
+ propertyFileValue: K,
784
+ propertyCheckboxValue: K,
785
+ propertyUrlValue: K,
786
+ propertyEmailValue: K,
787
+ propertyPhoneNumberValue: K,
788
+ propertyNumberValue: K,
789
+ propertyLastEditedTimeValue: K,
790
+ propertyCreatedTimeValue: K,
791
+ propertyDateValue: K,
792
+ Pdf: G("Pdf"),
793
+ Tweet: G("Tweet"),
794
+ Modal: G("Modal"),
795
+ Header: De,
796
+ Embed: Ee
797
+ }, J = {
798
+ recordMap: {
799
+ block: {},
800
+ collection: {},
801
+ collection_view: {},
802
+ collection_query: {},
803
+ notion_user: {},
804
+ signed_urls: {}
805
+ },
806
+ components: q,
807
+ mapPageUrl: a(),
808
+ mapImageUrl: i,
809
+ searchNotion: null,
810
+ isShowingSearch: !1,
811
+ onHideSearch: null,
812
+ fullPage: !1,
813
+ darkMode: !1,
814
+ previewImages: !1,
815
+ forceCustomImages: !1,
816
+ showCollectionViewDropdown: !0,
817
+ linkTableTitleProperties: !0,
818
+ isLinkCollectionToUrlProperty: !1,
819
+ showTableOfContents: !1,
820
+ minTableOfContentsItems: 3,
821
+ defaultPageIcon: null,
822
+ defaultPageCover: null,
823
+ defaultPageCoverPosition: .5,
824
+ zoom: null,
825
+ editable: !1
826
+ }, Y = r.createContext(J), X = (e) => {
827
+ let { components: t = {}, children: n, mapPageUrl: o, mapImageUrl: s, rootPageId: c, rootSpaceId: l } = e, u = E(e, Ce);
828
+ for (let e of Object.keys(u)) u[e] === void 0 && delete u[e];
829
+ let d = r.useMemo(() => {
830
+ let e = S({}, t);
831
+ if (e.nextImage && (e.Image = ye(e.nextImage)), e.nextLink) {
832
+ let t = be(e.nextLink);
833
+ e.nextLink = t, e.PageLink || (e.PageLink = t), e.Link || (e.Link = t);
834
+ }
835
+ for (let t of Object.keys(e)) e[t] || delete e[t];
836
+ return e;
837
+ }, [t]), f = r.useMemo(() => S(S(S({}, J), u), {}, {
838
+ rootPageId: c,
839
+ rootSpaceId: l,
840
+ mapPageUrl: o == null ? a(c) : o,
841
+ mapImageUrl: s == null ? i : s,
842
+ components: S(S({}, q), d)
843
+ }), [
844
+ s,
845
+ o,
846
+ d,
847
+ c,
848
+ l,
849
+ u
850
+ ]);
851
+ return /* @__PURE__ */ r.createElement(Y.Provider, { value: f }, n);
852
+ }, Z = Y.Consumer, Q = () => r.useContext(Y), ke = (e) => Object.keys(e).map((t) => `${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`).join("&"), Ae = ({ id: e, defaultPlay: t = !1, mute: n = !1, lazyImage: i = !1, iframeTitle: a = "YouTube video", alt: o = "Video preview", params: s = {}, adLinksPreconnect: c = !0, style: l, className: u }) => {
853
+ let d = n || t ? "1" : "0", f = r.useMemo(() => ke(S({
854
+ autoplay: "1",
855
+ mute: d
856
+ }, s)), [d, s]), p = `https://i.ytimg.com/vi/${e}/hqdefault.jpg`, m = "https://www.youtube-nocookie.com", h = `${m}/embed/${e}?${f}`, [g, _] = r.useState(!1), [v, y] = r.useState(t), [b, x] = r.useState(!1), C = r.useCallback(() => {
857
+ g || _(!0);
858
+ }, [g]), w = r.useCallback(() => {
859
+ v || y(!0);
860
+ }, [v]), T = r.useCallback(() => {
861
+ x(!0);
862
+ }, []);
863
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("link", {
864
+ rel: "preload",
865
+ href: p,
866
+ as: "image"
867
+ }), g && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("link", {
868
+ rel: "preconnect",
869
+ href: m
870
+ }), /* @__PURE__ */ r.createElement("link", {
871
+ rel: "preconnect",
872
+ href: "https://www.google.com"
873
+ })), g && c && /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("link", {
874
+ rel: "preconnect",
875
+ href: "https://static.doubleclick.net"
876
+ }), /* @__PURE__ */ r.createElement("link", {
877
+ rel: "preconnect",
878
+ href: "https://googleads.g.doubleclick.net"
879
+ })), /* @__PURE__ */ r.createElement("div", {
880
+ onClick: w,
881
+ onPointerOver: C,
882
+ className: `notion-yt-lite
883
+ ${b && "notion-yt-loaded"}
884
+ ${v && "notion-yt-initialized"}
885
+ ${u || ""}`,
886
+ style: l
887
+ }, /* @__PURE__ */ r.createElement("img", {
888
+ src: p,
889
+ className: "notion-yt-thumbnail",
890
+ loading: i ? "lazy" : void 0,
891
+ alt: o
892
+ }), /* @__PURE__ */ r.createElement("div", { className: "notion-yt-playbtn" }), v && /* @__PURE__ */ r.createElement("iframe", {
893
+ width: "560",
894
+ height: "315",
895
+ frameBorder: "0",
896
+ allow: "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture",
897
+ allowFullScreen: !0,
898
+ title: a,
899
+ src: h,
900
+ onLoad: T
901
+ })));
902
+ }, je = typeof window > "u", Me = [
903
+ "video",
904
+ "image",
905
+ "embed",
906
+ "figma",
907
+ "typeform",
908
+ "excalidraw",
909
+ "maps",
910
+ "tweet",
911
+ "pdf",
912
+ "gist",
913
+ "codepen",
914
+ "drive"
915
+ ], Ne = ({ block: e, zoomable: t = !0, children: n }) => {
916
+ var i, a;
917
+ let { recordMap: o, mapImageUrl: s, components: c } = Q();
918
+ if (!e || !Me.includes(e.type)) return null;
919
+ let l = {
920
+ position: "relative",
921
+ display: "flex",
922
+ justifyContent: "center",
923
+ alignSelf: "center",
924
+ width: "100%",
925
+ maxWidth: "100%",
926
+ flexDirection: "column"
927
+ }, u = {};
928
+ if (e.format) {
929
+ let { block_aspect_ratio: t, block_height: n, block_width: r, block_full_width: i, block_page_width: a, block_preserve_scale: o } = e.format;
930
+ if (i || a) l.width = i ? "100vw" : "100%", e.type === "video" ? n ? l.height = n : t ? l.paddingBottom = `${t * 100}%` : o && (l.objectFit = "contain") : t && e.type !== "image" ? l.paddingBottom = `${t * 100}%` : n ? l.height = n : o && (e.type === "image" ? l.height = "100%" : (l.paddingBottom = "75%", l.minHeight = 100));
931
+ else {
932
+ var d;
933
+ switch ((d = e.format) == null ? void 0 : d.block_alignment) {
934
+ case "center":
935
+ l.alignSelf = "center";
936
+ break;
937
+ case "left":
938
+ l.alignSelf = "start";
939
+ break;
940
+ case "right": l.alignSelf = "end";
941
+ }
942
+ r && (l.width = r), o && e.type !== "image" ? (l.paddingBottom = "50%", l.minHeight = 100) : n && e.type !== "image" && (l.height = n);
943
+ }
944
+ e.type === "image" ? u.objectFit = "cover" : o && (u.objectFit = "contain");
945
+ }
946
+ let p = ((i = o.signed_urls) == null ? void 0 : i[e.id]) || ((a = e.properties) == null || (a = a.source) == null || (a = a[0]) == null ? void 0 : a[0]), m = null;
947
+ if (!p) return null;
948
+ if (e.type === "tweet") {
949
+ let e = p;
950
+ if (!e) return null;
951
+ let t = e.split("?")[0].split("/").pop();
952
+ if (!t) return null;
953
+ m = /* @__PURE__ */ r.createElement("div", { style: S(S({}, u), {}, {
954
+ maxWidth: 420,
955
+ width: "100%",
956
+ marginLeft: "auto",
957
+ marginRight: "auto"
958
+ }) }, /* @__PURE__ */ r.createElement(c.Tweet, { id: t }));
959
+ } else if (e.type === "pdf") l.overflow = "auto", l.background = "rgb(226, 226, 226)", l.display = "block", l.padding || (l.padding = "8px 16px"), je || (m = /* @__PURE__ */ r.createElement(c.Pdf, { file: p }));
960
+ else if (e.type === "embed" || e.type === "video" || e.type === "figma" || e.type === "typeform" || e.type === "gist" || e.type === "maps" || e.type === "excalidraw" || e.type === "codepen" || e.type === "drive") {
961
+ if (e.type === "video" && p && p.indexOf("youtube") < 0 && p.indexOf("youtu.be") < 0 && p.indexOf("vimeo") < 0 && p.indexOf("wistia") < 0 && p.indexOf("loom") < 0 && p.indexOf("videoask") < 0 && p.indexOf("getcloudapp") < 0) l.paddingBottom = void 0, m = /* @__PURE__ */ r.createElement("video", {
962
+ playsInline: !0,
963
+ controls: !0,
964
+ preload: "metadata",
965
+ style: u,
966
+ src: p,
967
+ title: e.type
968
+ });
969
+ else {
970
+ var h;
971
+ let t = ((h = e.format) == null ? void 0 : h.display_source) || p;
972
+ if (t) {
973
+ let n = e.type === "video" ? k(t) : null;
974
+ n ? m = /* @__PURE__ */ r.createElement(Ae, {
975
+ id: n,
976
+ style: u,
977
+ className: "notion-asset-object-fit"
978
+ }) : e.type === "gist" ? (t.endsWith(".pibb") || (t = `${t}.pibb`), u.width = "100%", l.paddingBottom = "50%", m = /* @__PURE__ */ r.createElement("iframe", {
979
+ style: u,
980
+ className: "notion-asset-object-fit",
981
+ src: t,
982
+ title: "GitHub Gist",
983
+ frameBorder: "0",
984
+ loading: "lazy",
985
+ scrolling: "auto"
986
+ })) : m = /* @__PURE__ */ r.createElement("iframe", {
987
+ className: "notion-asset-object-fit",
988
+ style: u,
989
+ src: t,
990
+ title: `iframe ${e.type}`,
991
+ frameBorder: "0",
992
+ allowFullScreen: !0,
993
+ loading: "lazy",
994
+ scrolling: "auto"
995
+ });
996
+ }
997
+ }
998
+ } else if (e.type === "image") {
999
+ var g, _;
1000
+ p.includes("file.notion.so") && (p = (g = e.properties) == null || (g = g.source) == null || (g = g[0]) == null ? void 0 : g[0]);
1001
+ let n = s(p, e), i = f((_ = e.properties) == null ? void 0 : _.caption) || "notion image";
1002
+ m = /* @__PURE__ */ r.createElement(A, {
1003
+ src: n,
1004
+ alt: i,
1005
+ zoomable: t,
1006
+ height: l.height,
1007
+ style: u
1008
+ });
1009
+ }
1010
+ return /* @__PURE__ */ r.createElement(r.Fragment, null, /* @__PURE__ */ r.createElement("div", { style: l }, m, e.type === "image" && n), e.type !== "image" && n);
1011
+ }, Pe = { width: "100%" }, $ = ({ blockId: e, block: t }) => {
1012
+ var n, i;
1013
+ let a = t, { components: o, mapPageUrl: s, rootDomain: c, zoom: l } = Q(), u = !1;
1014
+ if (t.type === "image") {
1015
+ var d;
1016
+ let e = a == null || (d = a.properties) == null || (d = d.caption) == null || (d = d[0]) == null ? void 0 : d[0];
1017
+ if (e) {
1018
+ let t = h(e, { uuid: !0 });
1019
+ (e.charAt(0) === "/" && t || Fe(e)) && (u = !0);
1020
+ }
1021
+ }
1022
+ let f = /* @__PURE__ */ r.createElement("figure", { className: `notion-asset-wrapper
1023
+ notion-asset-wrapper-${t.type}
1024
+ ${(n = a.format) != null && n.block_full_width ? "notion-asset-wrapper-full" : ""}
1025
+ ${e}` }, /* @__PURE__ */ r.createElement(Ne, {
1026
+ block: a,
1027
+ zoomable: l && !u
1028
+ }, (a == null || (i = a.properties) == null ? void 0 : i.caption) && !u && /* @__PURE__ */ r.createElement("figcaption", { className: "notion-asset-caption" }, /* @__PURE__ */ r.createElement(F, {
1029
+ value: a.properties.caption,
1030
+ block: t
1031
+ }))));
1032
+ if (u) {
1033
+ var p;
1034
+ let e = a == null || (p = a.properties) == null ? void 0 : p.caption[0][0], t = h(e, { uuid: !0 }), n = e.charAt(0) === "/" && t, i = Ie(e);
1035
+ return /* @__PURE__ */ r.createElement(o.PageLink, {
1036
+ style: Pe,
1037
+ href: n ? s(t) : e,
1038
+ target: i && i !== c && !e.startsWith("/") ? "blank_" : null
1039
+ }, f);
1040
+ }
1041
+ return f;
1042
+ };
1043
+ function Fe(e) {
1044
+ return !!(/* @__PURE__ */ RegExp("^(https?:\\/\\/)?((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|((\\d{1,3}\\.){3}\\d{1,3}))(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*(\\?[;&a-z\\d%_.~+=-]*)?(\\#[-a-z\\d_]*)?$", "i")).test(e);
1045
+ }
1046
+ function Ie(e) {
1047
+ try {
1048
+ return new URL(e).hostname;
1049
+ } catch (e) {
1050
+ return "";
1051
+ }
1052
+ }
1053
+ //#endregion
1054
+ export { w as A, s as C, ae as D, k as E, p as O, o as S, ie as T, P as _, X as a, j as b, U as c, V as d, z as f, F as g, I as h, Z as i, S as j, E as k, H as l, L as m, Ne as n, Oe as o, B as p, Ae as r, Q as s, $ as t, W as u, N as v, O as w, A as x, M as y };
1055
+
1056
+ //# sourceMappingURL=asset-wrapper-BjCXzGmC.js.map