/* * Extracted from browser-delivered Turbopack chunk: 2a4e4dccbc3fdacb.bc4b655d5c.js * Module id: 616777 * For reading/searching only; this factory depends on the original Turbopack runtime. */ const moduleFactory = (e) => { "use strict"; e.i(23741); var t = e.i(358379), n = e.i(111558), r = e.i(536379), i = e.i(462214), o = e.i(673654); let { getOwnPropertyNames: s, getOwnPropertySymbols: l } = Object, { hasOwnProperty: a } = Object.prototype; function d(e, t) { return function (n, r, i) { return e(n, r, i) && t(n, r, i); }; } function c(e) { return function (t, n, r) { if (!t || !n || "object" != typeof t || "object" != typeof n) return e(t, n, r); let { cache: i } = r, o = i.get(t), s = i.get(n); if (o && s) return o === n && s === t; i.set(t, n), i.set(n, t); let l = e(t, n, r); return i.delete(t), i.delete(n), l; }; } function h(e) { return s(e).concat(l(e)); } let p = Object.hasOwn || ((e, t) => a.call(e, t)); function u(e, t) { return e === t || (!e && !t && e != e && t != t); } let { getOwnPropertyDescriptor: f, keys: m } = Object; function g(e, t) { return ( e.byteLength === t.byteLength && E(new Uint8Array(e), new Uint8Array(t)) ); } function y(e, t, n) { let r = e.length; if (t.length !== r) return !1; for (; r-- > 0; ) if (!n.equals(e[r], t[r], r, r, e, t, n)) return !1; return !0; } function b(e, t) { return ( e.byteLength === t.byteLength && E( new Uint8Array(e.buffer, e.byteOffset, e.byteLength), new Uint8Array(t.buffer, t.byteOffset, t.byteLength), ) ); } function k(e, t) { return u(e.getTime(), t.getTime()); } function v(e, t) { return ( e.name === t.name && e.message === t.message && e.cause === t.cause && e.stack === t.stack ); } function w(e, t) { return e === t; } function S(e, t, n) { let r, i, o = e.size; if (o !== t.size) return !1; if (!o) return !0; let s = Array(o), l = e.entries(), a = 0; for (; (r = l.next()) && !r.done; ) { let o = t.entries(), l = !1, d = 0; for (; (i = o.next()) && !i.done; ) { if (s[d]) { d++; continue; } let o = r.value, c = i.value; if ( n.equals(o[0], c[0], a, d, e, t, n) && n.equals(o[1], c[1], o[0], c[0], e, t, n) ) { l = s[d] = !0; break; } d++; } if (!l) return !1; a++; } return !0; } function x(e, t, n) { let r = m(e), i = r.length; if (m(t).length !== i) return !1; for (; i-- > 0; ) if (!A(e, t, n, r[i])) return !1; return !0; } function M(e, t, n) { let r, i, o, s = h(e), l = s.length; if (h(t).length !== l) return !1; for (; l-- > 0; ) if ( !A(e, t, n, (r = s[l])) || ((i = f(e, r)), (o = f(t, r)), (i || o) && (!i || !o || i.configurable !== o.configurable || i.enumerable !== o.enumerable || i.writable !== o.writable)) ) return !1; return !0; } function C(e, t) { return u(e.valueOf(), t.valueOf()); } function T(e, t) { return e.source === t.source && e.flags === t.flags; } function N(e, t, n) { let r, i, o = e.size; if (o !== t.size) return !1; if (!o) return !0; let s = Array(o), l = e.values(); for (; (r = l.next()) && !r.done; ) { let o = t.values(), l = !1, a = 0; for (; (i = o.next()) && !i.done; ) { if (!s[a] && n.equals(r.value, i.value, r.value, i.value, e, t, n)) { l = s[a] = !0; break; } a++; } if (!l) return !1; } return !0; } function E(e, t) { let n = e.byteLength; if (t.byteLength !== n || e.byteOffset !== t.byteOffset) return !1; for (; n-- > 0; ) if (e[n] !== t[n]) return !1; return !0; } function O(e, t) { return ( e.hostname === t.hostname && e.pathname === t.pathname && e.protocol === t.protocol && e.port === t.port && e.hash === t.hash && e.username === t.username && e.password === t.password ); } function A(e, t, n, r) { return ( (("_owner" === r || "__o" === r || "__v" === r) && (!!e.$$typeof || !!t.$$typeof)) || (p(t, r) && n.equals(e[r], t[r], r, r, e, t, n)) ); } let D = { "[object Int8Array]": !0, "[object Uint8Array]": !0, "[object Uint8ClampedArray]": !0, "[object Int16Array]": !0, "[object Uint16Array]": !0, "[object Int32Array]": !0, "[object Uint32Array]": !0, "[object Float16Array]": !0, "[object Float32Array]": !0, "[object Float64Array]": !0, "[object BigInt64Array]": !0, "[object BigUint64Array]": !0, }, R = Object.prototype.toString, I = P(); function P(e = {}) { let { circular: t = !1, createInternalComparator: n, createState: r, strict: i = !1, } = e, o = (function ({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n, areDatesEqual: r, areErrorsEqual: i, areFunctionsEqual: o, areMapsEqual: s, areNumbersEqual: l, areObjectsEqual: a, arePrimitiveWrappersEqual: d, areRegExpsEqual: c, areSetsEqual: h, areTypedArraysEqual: p, areUrlsEqual: u, unknownTagComparators: f, }) { return function (m, g, y) { if (m === g) return !0; if (null == m || null == g) return !1; let b = typeof m; if (b !== typeof g) return !1; if ("object" !== b) return "number" === b ? l(m, g, y) : "function" === b && o(m, g, y); let k = m.constructor; if (k !== g.constructor) return !1; if (k === Object) return a(m, g, y); if (Array.isArray(m)) return t(m, g, y); if (k === Date) return r(m, g, y); if (k === RegExp) return c(m, g, y); if (k === Map) return s(m, g, y); if (k === Set) return h(m, g, y); let v = R.call(m); if ("[object Date]" === v) return r(m, g, y); if ("[object RegExp]" === v) return c(m, g, y); if ("[object Map]" === v) return s(m, g, y); if ("[object Set]" === v) return h(m, g, y); if ("[object Object]" === v) return ( "function" != typeof m.then && "function" != typeof g.then && a(m, g, y) ); if ("[object URL]" === v) return u(m, g, y); if ("[object Error]" === v) return i(m, g, y); if ("[object Arguments]" === v) return a(m, g, y); if (D[v]) return p(m, g, y); if ("[object ArrayBuffer]" === v) return e(m, g, y); if ("[object DataView]" === v) return n(m, g, y); if ( "[object Boolean]" === v || "[object Number]" === v || "[object String]" === v ) return d(m, g, y); if (f) { let e = f[v]; if (!e) { let t = null != m ? m[Symbol.toStringTag] : void 0; t && (e = f[t]); } if (e) return e(m, g, y); } return !1; }; })( (function ({ circular: e, createCustomConfig: t, strict: n }) { let r = { areArrayBuffersEqual: g, areArraysEqual: n ? M : y, areDataViewsEqual: b, areDatesEqual: k, areErrorsEqual: v, areFunctionsEqual: w, areMapsEqual: n ? d(S, M) : S, areNumbersEqual: u, areObjectsEqual: n ? M : x, arePrimitiveWrappersEqual: C, areRegExpsEqual: T, areSetsEqual: n ? d(N, M) : N, areTypedArraysEqual: n ? d(E, M) : E, areUrlsEqual: O, unknownTagComparators: void 0, }; if ((t && (r = Object.assign({}, r, t(r))), e)) { let e = c(r.areArraysEqual), t = c(r.areMapsEqual), n = c(r.areObjectsEqual), i = c(r.areSetsEqual); r = Object.assign({}, r, { areArraysEqual: e, areMapsEqual: t, areObjectsEqual: n, areSetsEqual: i, }); } return r; })(e), ), s = n ? n(o) : function (e, t, n, r, i, s, l) { return o(e, t, l); }; return (function ({ circular: e, comparator: t, createState: n, equals: r, strict: i, }) { if (n) return function (o, s) { let { cache: l = e ? new WeakMap() : void 0, meta: a } = n(); return t(o, s, { cache: l, equals: r, meta: a, strict: i }); }; if (e) return function (e, n) { return t(e, n, { cache: new WeakMap(), equals: r, meta: void 0, strict: i, }); }; let o = { cache: void 0, equals: r, meta: void 0, strict: i }; return function (e, n) { return t(e, n, o); }; })({ circular: t, comparator: o, createState: r, equals: s, strict: i }); } P({ strict: !0 }), P({ circular: !0 }), P({ circular: !0, strict: !0 }), P({ createInternalComparator: () => u }), P({ strict: !0, createInternalComparator: () => u }), P({ circular: !0, createInternalComparator: () => u }), P({ circular: !0, createInternalComparator: () => u, strict: !0 }); var L = e.i(670986), z = ({ contentComponent: e }) => { let t = (0, r.useSyncExternalStore)( e.subscribe, e.getSnapshot, e.getServerSnapshot, ); return (0, i.jsx)(i.Fragment, { children: Object.values(t) }); }, B = class extends t.default.Component { constructor(e) { var n; super(e), (this.editorContentRef = t.default.createRef()), (this.initialized = !1), (this.state = { hasContentComponentInitialized: !!(null == (n = e.editor) ? void 0 : n.contentComponent), }); } componentDidMount() { this.init(); } componentDidUpdate() { this.init(); } init() { var e; let t = this.props.editor; if ( t && !t.isDestroyed && (null == (e = t.view.dom) ? void 0 : e.parentNode) ) { let e, r; if (t.contentComponent) return; let i = this.editorContentRef.current; i.append(...t.view.dom.parentNode.childNodes), t.setOptions({ element: i }), (e = new Set()), (r = {}), (t.contentComponent = { subscribe: (t) => ( e.add(t), () => { e.delete(t); } ), getSnapshot: () => r, getServerSnapshot: () => r, setRenderer(t, i) { (r = { ...r, [t]: n.default.createPortal(i.reactElement, i.element, t), }), e.forEach((e) => e()); }, removeRenderer(t) { let n = { ...r }; delete n[t], (r = n), e.forEach((e) => e()); }, }), this.state.hasContentComponentInitialized || (this.unsubscribeToContentComponent = t.contentComponent.subscribe(() => { this.setState((e) => e.hasContentComponentInitialized ? e : { hasContentComponentInitialized: !0 }, ), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent(); })), t.createNodeViews(), (this.initialized = !0); } } componentWillUnmount() { var e; let t = this.props.editor; if (t) { (this.initialized = !1), t.isDestroyed || t.view.setProps({ nodeViews: {} }), this.unsubscribeToContentComponent && this.unsubscribeToContentComponent(), (t.contentComponent = null); try { if (!(null == (e = t.view.dom) ? void 0 : e.parentNode)) return; let n = document.createElement("div"); n.append(...t.view.dom.parentNode.childNodes), t.setOptions({ element: n }); } catch {} } } render() { let { editor: e, innerRef: t, ...n } = this.props; return (0, i.jsxs)(i.Fragment, { children: [ (0, i.jsx)("div", { ref: ( (...e) => (t) => { e.forEach((e) => { "function" == typeof e ? e(t) : e && (e.current = t); }); } )(t, this.editorContentRef), ...n, }), (null == e ? void 0 : e.contentComponent) && (0, i.jsx)(z, { contentComponent: e.contentComponent }), ], }); } }, $ = (0, t.forwardRef)((e, n) => { let r = t.default.useMemo( () => Math.floor(0xffffffff * Math.random()).toString(), [e.editor], ); return t.default.createElement(B, { key: r, innerRef: n, ...e }); }), j = t.default.memo($), F = "u" > typeof window ? t.useLayoutEffect : t.useEffect, V = class { constructor(e) { (this.transactionNumber = 0), (this.lastTransactionNumber = 0), (this.subscribers = new Set()), (this.editor = e), (this.lastSnapshot = { editor: e, transactionNumber: 0 }), (this.getSnapshot = this.getSnapshot.bind(this)), (this.getServerSnapshot = this.getServerSnapshot.bind(this)), (this.watch = this.watch.bind(this)), (this.subscribe = this.subscribe.bind(this)); } getSnapshot() { return ( this.transactionNumber === this.lastTransactionNumber || ((this.lastTransactionNumber = this.transactionNumber), (this.lastSnapshot = { editor: this.editor, transactionNumber: this.transactionNumber, })), this.lastSnapshot ); } getServerSnapshot() { return { editor: null, transactionNumber: 0 }; } subscribe(e) { return ( this.subscribers.add(e), () => { this.subscribers.delete(e); } ); } watch(e) { if (((this.editor = e), this.editor)) { let e = () => { (this.transactionNumber += 1), this.subscribers.forEach((e) => e()); }, t = this.editor; return ( t.on("transaction", e), () => { t.off("transaction", e); } ); } } }; function H(e) { var n; let [r] = (0, t.useState)(() => new V(e.editor)), i = (0, L.useSyncExternalStoreWithSelector)( r.subscribe, r.getSnapshot, r.getServerSnapshot, e.selector, null != (n = e.equalityFn) ? n : I, ); return ( F(() => r.watch(e.editor), [e.editor, r]), (0, t.useDebugValue)(i), i ); } var W = "u" < typeof window, _ = W || !!("u" > typeof window && window.next), q = class e { constructor(e) { (this.editor = null), (this.subscriptions = new Set()), (this.isComponentMounted = !1), (this.previousDeps = null), (this.instanceId = ""), (this.options = e), (this.subscriptions = new Set()), this.setEditor(this.getInitialEditor()), this.scheduleDestroy(), (this.getEditor = this.getEditor.bind(this)), (this.getServerSnapshot = this.getServerSnapshot.bind(this)), (this.subscribe = this.subscribe.bind(this)), (this.refreshEditorInstance = this.refreshEditorInstance.bind(this)), (this.scheduleDestroy = this.scheduleDestroy.bind(this)), (this.onRender = this.onRender.bind(this)), (this.createEditor = this.createEditor.bind(this)); } setEditor(e) { (this.editor = e), (this.instanceId = Math.random().toString(36).slice(2, 9)), this.subscriptions.forEach((e) => e()); } getInitialEditor() { return void 0 === this.options.current.immediatelyRender ? W || _ ? null : this.createEditor() : (this.options.current.immediatelyRender, this.options.current.immediatelyRender) ? this.createEditor() : null; } createEditor() { let e = { ...this.options.current, onBeforeCreate: (...e) => { var t, n; return null == (n = (t = this.options.current).onBeforeCreate) ? void 0 : n.call(t, ...e); }, onBlur: (...e) => { var t, n; return null == (n = (t = this.options.current).onBlur) ? void 0 : n.call(t, ...e); }, onCreate: (...e) => { var t, n; return null == (n = (t = this.options.current).onCreate) ? void 0 : n.call(t, ...e); }, onDestroy: (...e) => { var t, n; return null == (n = (t = this.options.current).onDestroy) ? void 0 : n.call(t, ...e); }, onFocus: (...e) => { var t, n; return null == (n = (t = this.options.current).onFocus) ? void 0 : n.call(t, ...e); }, onSelectionUpdate: (...e) => { var t, n; return null == (n = (t = this.options.current).onSelectionUpdate) ? void 0 : n.call(t, ...e); }, onTransaction: (...e) => { var t, n; return null == (n = (t = this.options.current).onTransaction) ? void 0 : n.call(t, ...e); }, onUpdate: (...e) => { var t, n; return null == (n = (t = this.options.current).onUpdate) ? void 0 : n.call(t, ...e); }, onContentError: (...e) => { var t, n; return null == (n = (t = this.options.current).onContentError) ? void 0 : n.call(t, ...e); }, onDrop: (...e) => { var t, n; return null == (n = (t = this.options.current).onDrop) ? void 0 : n.call(t, ...e); }, onPaste: (...e) => { var t, n; return null == (n = (t = this.options.current).onPaste) ? void 0 : n.call(t, ...e); }, onDelete: (...e) => { var t, n; return null == (n = (t = this.options.current).onDelete) ? void 0 : n.call(t, ...e); }, }; return new o.Editor(e); } getEditor() { return this.editor; } getServerSnapshot() { return null; } subscribe(e) { return ( this.subscriptions.add(e), () => { this.subscriptions.delete(e); } ); } static compareOptions(e, t) { return Object.keys(e).every( (n) => !![ "onCreate", "onBeforeCreate", "onDestroy", "onUpdate", "onTransaction", "onFocus", "onBlur", "onSelectionUpdate", "onContentError", "onDrop", "onPaste", ].includes(n) || ("extensions" === n && e.extensions && t.extensions ? e.extensions.length === t.extensions.length && e.extensions.every((e, n) => { var r; return e === (null == (r = t.extensions) ? void 0 : r[n]); }) : e[n] === t[n]), ); } onRender(t) { return () => ( (this.isComponentMounted = !0), clearTimeout(this.scheduledDestructionTimeout), this.editor && !this.editor.isDestroyed && 0 === t.length ? e.compareOptions(this.options.current, this.editor.options) || this.editor.setOptions({ ...this.options.current, editable: this.editor.isEditable, }) : this.refreshEditorInstance(t), () => { (this.isComponentMounted = !1), this.scheduleDestroy(); } ); } refreshEditorInstance(e) { if (this.editor && !this.editor.isDestroyed) { if (null === this.previousDeps) { this.previousDeps = e; return; } if ( this.previousDeps.length === e.length && this.previousDeps.every((t, n) => t === e[n]) ) return; } this.editor && !this.editor.isDestroyed && this.editor.destroy(), this.setEditor(this.createEditor()), (this.previousDeps = e); } scheduleDestroy() { let e = this.instanceId, t = this.editor; this.scheduledDestructionTimeout = setTimeout(() => { if (this.isComponentMounted && this.instanceId === e) { t && t.setOptions(this.options.current); return; } t && !t.isDestroyed && (t.destroy(), this.instanceId === e && this.setEditor(null)); }, 1); } }; function K(e = {}, n = []) { let i = (0, t.useRef)(e); i.current = e; let [o] = (0, t.useState)(() => new q(i)), s = (0, r.useSyncExternalStore)( o.subscribe, o.getEditor, o.getServerSnapshot, ); return ( (0, t.useDebugValue)(s), (0, t.useEffect)(o.onRender(n)), H({ editor: s, selector: ({ transactionNumber: t }) => !1 === e.shouldRerenderOnTransaction || void 0 === e.shouldRerenderOnTransaction ? null : e.immediatelyRender && 0 === t ? 0 : t + 1, }), s ); } var U = (0, t.createContext)({ editor: null }); U.Consumer; var J = (0, t.createContext)({ onDragStart: () => {}, nodeViewContentChildren: void 0, nodeViewContentRef: () => {}, }), G = t.default.forwardRef((e, n) => { let { onDragStart: r } = (0, t.useContext)(J), o = e.as || "div"; return (0, i.jsx)(o, { ...e, ref: n, "data-node-view-wrapper": "", onDragStart: r, style: { whiteSpace: "normal", ...e.style }, }); }); function Y(e) { return !!( "function" == typeof e && e.prototype && e.prototype.isReactComponent ); } function Q(e) { return !!( "object" == typeof e && e.$$typeof && ("Symbol(react.forward_ref)" === e.$$typeof.toString() || "react.forward_ref" === e.$$typeof.description) ); } var X = class { constructor( e, { editor: t, props: r = {}, as: i = "div", className: o = "" }, ) { (this.ref = null), (this.destroyed = !1), (this.id = Math.floor(0xffffffff * Math.random()).toString()), (this.component = e), (this.editor = t), (this.props = r), (this.element = document.createElement(i)), this.element.classList.add("react-renderer"), o && this.element.classList.add(...o.split(" ")), this.editor.isInitialized ? (0, n.flushSync)(() => { this.render(); }) : queueMicrotask(() => { this.destroyed || this.render(); }); } render() { var e; if (this.destroyed) return; let n = this.component, r = this.props, o = this.editor, s = (function () { try { if (t.version) return parseInt(t.version.split(".")[0], 10) >= 19; } catch {} return !1; })(), l = (function (e) { if (Y(e) || Q(e)) return !0; if ( "object" == typeof e && e.$$typeof && ("Symbol(react.memo)" === e.$$typeof.toString() || "react.memo" === e.$$typeof.description) ) { let t = e.type; if (t) return Y(t) || Q(t); } return !1; })(n), a = { ...r }; a.ref && !(s || l) && delete a.ref, !a.ref && (s || l) && (a.ref = (e) => { this.ref = e; }), (this.reactElement = (0, i.jsx)(n, { ...a })), null == (e = null == o ? void 0 : o.contentComponent) || e.setRenderer(this.id, this); } updateProps(e = {}) { this.destroyed || ((this.props = { ...this.props, ...e }), this.render()); } destroy() { var e; this.destroyed = !0; let t = this.editor; null == (e = null == t ? void 0 : t.contentComponent) || e.removeRenderer(this.id); try { this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element); } catch {} } updateAttributes(e) { Object.keys(e).forEach((t) => { this.element.setAttribute(t, e[t]); }); } }; t.default.createContext({ markViewContentRef: () => {} }), o.MarkView; var Z = class extends o.NodeView { constructor(e, t, n) { if ( (super(e, t, n), (this.selectionRafId = null), (this.cachedExtensionWithSyncedStorage = null), !this.node.isLeaf) ) { this.options.contentDOMElementTag ? (this.contentDOMElement = document.createElement( this.options.contentDOMElementTag, )) : (this.contentDOMElement = document.createElement( this.node.isInline ? "span" : "div", )), (this.contentDOMElement.dataset.nodeViewContentReact = ""), (this.contentDOMElement.dataset.nodeViewWrapper = ""), (this.contentDOMElement.style.whiteSpace = "inherit"); const e = this.dom.querySelector("[data-node-view-content]"); if (!e) return; e.appendChild(this.contentDOMElement); } } get extensionWithSyncedStorage() { if (!this.cachedExtensionWithSyncedStorage) { let e = this.editor, t = this.extension; this.cachedExtensionWithSyncedStorage = new Proxy(t, { get(n, r, i) { var o; return "storage" === r ? null != (o = e.storage[t.name]) ? o : {} : Reflect.get(n, r, i); }, }); } return this.cachedExtensionWithSyncedStorage; } mount() { let e = { editor: this.editor, node: this.node, decorations: this.decorations, innerDecorations: this.innerDecorations, view: this.view, selected: !1, extension: this.extensionWithSyncedStorage, HTMLAttributes: this.HTMLAttributes, getPos: () => this.getPos(), updateAttributes: (e = {}) => this.updateAttributes(e), deleteNode: () => this.deleteNode(), ref: (0, t.createRef)(), }; if (!this.component.displayName) { let e; this.component.displayName = (e = this.extension.name).charAt(0).toUpperCase() + e.substring(1); } let n = { onDragStart: this.onDragStart.bind(this), nodeViewContentRef: (e) => { e && this.contentDOMElement && e.firstChild !== this.contentDOMElement && (e.hasAttribute("data-node-view-wrapper") && e.removeAttribute("data-node-view-wrapper"), e.appendChild(this.contentDOMElement)); }, }, r = this.component, o = (0, t.memo)((e) => (0, i.jsx)(J.Provider, { value: n, children: (0, t.createElement)(r, e), }), ); o.displayName = "ReactNodeView"; let s = this.node.isInline ? "span" : "div"; this.options.as && (s = this.options.as); let { className: l = "" } = this.options; (this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)), (this.renderer = new X(o, { editor: this.editor, props: e, as: s, className: `node-${this.node.type.name} ${l}`.trim(), })), this.editor.on("selectionUpdate", this.handleSelectionUpdate), this.updateElementAttributes(); } get dom() { var e; if ( this.renderer.element.firstElementChild && !(null == (e = this.renderer.element.firstElementChild) ? void 0 : e.hasAttribute("data-node-view-wrapper")) ) throw Error( "Please use the NodeViewWrapper component for your node view.", ); return this.renderer.element; } get contentDOM() { return this.node.isLeaf ? null : this.contentDOMElement; } handleSelectionUpdate() { this.selectionRafId && (cancelAnimationFrame(this.selectionRafId), (this.selectionRafId = null)), (this.selectionRafId = requestAnimationFrame(() => { this.selectionRafId = null; let { from: e, to: t } = this.editor.state.selection, n = this.getPos(); if ("number" == typeof n) if (e <= n && t >= n + this.node.nodeSize) { if (this.renderer.props.selected) return; this.selectNode(); } else { if (!this.renderer.props.selected) return; this.deselectNode(); } })); } update(e, t, n) { let r = (e) => { this.renderer.updateProps(e), "function" == typeof this.options.attrs && this.updateElementAttributes(); }; if (e.type !== this.node.type) return !1; if ("function" == typeof this.options.update) { let i = this.node, o = this.decorations, s = this.innerDecorations; return ( (this.node = e), (this.decorations = t), (this.innerDecorations = n), this.options.update({ oldNode: i, oldDecorations: o, newNode: e, newDecorations: t, oldInnerDecorations: s, innerDecorations: n, updateProps: () => r({ node: e, decorations: t, innerDecorations: n, extension: this.extensionWithSyncedStorage, }), }) ); } return ( (e === this.node && this.decorations === t && this.innerDecorations === n) || ((this.node = e), (this.decorations = t), (this.innerDecorations = n), r({ node: e, decorations: t, innerDecorations: n, extension: this.extensionWithSyncedStorage, }), !0) ); } selectNode() { this.renderer.updateProps({ selected: !0 }), this.renderer.element.classList.add("ProseMirror-selectednode"); } deselectNode() { this.renderer.updateProps({ selected: !1 }), this.renderer.element.classList.remove("ProseMirror-selectednode"); } destroy() { this.renderer.destroy(), this.editor.off("selectionUpdate", this.handleSelectionUpdate), (this.contentDOMElement = null), this.selectionRafId && (cancelAnimationFrame(this.selectionRafId), (this.selectionRafId = null)); } updateElementAttributes() { if (this.options.attrs) { let e = {}; if ("function" == typeof this.options.attrs) { let t = this.editor.extensionManager.attributes, n = (0, o.getRenderedAttributes)(this.node, t); e = this.options.attrs({ node: this.node, HTMLAttributes: n }); } else e = this.options.attrs; this.renderer.updateAttributes(e); } } }; function ee(e, t) { return (n) => (n.editor.contentComponent ? new Z(e, n, t) : {}); } var et = (0, t.createContext)({ get editor() { throw Error("useTiptap must be used within a provider"); }, }); function en({ editor: e, instance: n, children: r }) { let o = null != e ? e : n; if (!o) throw Error( "Tiptap: An editor instance is required. Pass a non-null `editor` prop.", ); let s = (0, t.useMemo)(() => ({ editor: o }), [o]), l = (0, t.useMemo)(() => ({ editor: o }), [o]); return (0, i.jsx)(U.Provider, { value: l, children: (0, i.jsx)(et.Provider, { value: s, children: r }), }); } function er({ ...e }) { let { editor: n } = (0, t.useContext)(et); return (0, i.jsx)(j, { editor: n, ...e }); } (et.displayName = "TiptapContext"), (en.displayName = "Tiptap"), (er.displayName = "Tiptap.Content"), Object.assign(en, { Content: er }), e.s( [ "EditorContent", () => j, "NodeViewWrapper", () => G, "ReactNodeViewRenderer", () => ee, "ReactRenderer", () => X, "useEditor", () => K, "useEditorState", () => H, ], 616777, ); }; export default moduleFactory;