@texonom/nreact 1.6.5 → 1.6.7

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