1;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="3bea6fd2-cd9a-6ffb-04f0-bd83d6eb2ec0")}catch(e){}}(); 2(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,909653,e=>{"use strict";var t=e.i(380447),n=e.i(552979);e.s(["ConditionalLink",0,function(e){let{children:r,interactive:i=!0,href:o,as:s,scroll:l,...a}=e;return i?(0,t.jsx)(n.default,{href:e.href,as:e.as,scroll:e.scroll,...a,children:e.children}):(0,t.jsx)("span",{...a,children:r})}])},898136,864458,e=>{"use strict";var t=e.i(380447),n=e.i(79745),r=e.i(98301),i=e.i(699721),o=e.i(313890),s=e.i(743133),l=e.i(582512);function a({className:e,caption:n,icon:r,keyName:o,keyIcon:s}){return(0,t.jsxs)("tr",{className:(0,l.cn)("h-12",e),children:[(0,t.jsxs)("td",{children:[r&&(0,t.jsx)(i.FontAwesomeIcon,{className:"pr-1",icon:r}),n]}),(0,t.jsx)("td",{children:(0,t.jsxs)("span",{className:"ml-auto flex h-8 w-8 items-center justify-center rounded-lg border border-solid border-gray-3 bg-gray-6 font-semibold",children:[o,s&&(0,t.jsx)(i.FontAwesomeIcon,{icon:s})]})})]})}e.s(["HotkeysDialog",0,function({onClose:e}){let{isLoggedIn:i,user:l}=(0,s.useAuth)();return(0,t.jsxs)(o.Dialog,{className:"p-6",handleToggleDialog:e,children:[(0,t.jsx)("h2",{className:"pb-4 text-title-2",children:"Keyboard shortcuts"}),(0,t.jsx)("table",{className:"w-full",children:(0,t.jsxs)("tbody",{children:[i&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a,{className:"[&_svg]:text-yellow",keyName:"a",icon:r.faSparkles,caption:"Appreciate"}),l?.is_member&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(a,{keyName:"b",icon:r.faBookmark,caption:"Bookmark"}),(0,t.jsx)(a,{keyName:"c",caption:"Comment"}),(0,t.jsx)(a,{keyName:"e",caption:"Edit description"})]})]}),(0,t.jsx)(a,{keyName:"f",caption:"View in full screen"}),(0,t.jsx)(a,{keyName:"p",caption:"View profile"}),(0,t.jsx)(a,{keyIcon:n.faArrowRight,caption:"Next photo"}),(0,t.jsx)(a,{keyIcon:n.faArrowLeft,caption:"Previous photo"})]})})]})}],898136);var c=e.i(404478),d=e.i(138400),h=e.i(313312),u=e.i(489739),p=e.i(911554),f=e.i(465105),m=e.i(760997),g=e.i(884545),y=e.i(999161),x=e.i(553938);e.i(718227);var v=function(e,t){return(v=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},b=function(){return(b=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},w=("function"==typeof SuppressedError&&SuppressedError,"kvfysmfp"),k="ufhsfnkm",S=".".concat(w,"{overflow:hidden;touch-action:none}.").concat(k,"{transform-origin: 0 0}"),C="u"<typeof window,M=function(){return!C&&("ontouchstart"in window||navigator.maxTouchPoints>0)},O=function(e){var t=e.x,n=e.y,r=e.scale;return"scale3d(".concat(r,",").concat(r,", 1) translate3d(").concat(t,"px, ").concat(n,"px, 0)")},T=Math.min,N=Math.max;function E(e){var t=e.containerDimension,n=e.childDimension,r=e.padding,i=e.centerContained,o=n-t;return o+2*r<=0&&i?[o/2,o/2]:[T(o+r,0)-r,N(0,o+r)]}var _=function(e,t){return t?"".concat(e," ").concat(t):e},D=Math.abs,A=Math.min,j=Math.sqrt,R="u"<typeof window,I=!R&&/(Mac)/i.test(navigator.platform),P=function(e){return"drag"===e},z=function(e){return"zoom"===e},$=function(e){e.stopPropagation(),e.preventDefault()},F=function(e,t){var n=e.x-t.x,r=e.y-t.y;return j(n*n+r*r)},B=function(e,t){var n=F(e[0],e[1]);return F(t[0],t[1])/n},V=function(e){return-Math.cos(e*Math.PI)/2+.5},L=function(e){return{x:e.pageX,y:e.pageY}},q=function(e){return Array.from(e).map(L)},W=function(e,t){return e+t},U=function(e,t,n){return n<e?e:n>t?t:n},H=function(e){return!(e.ctrlKey||e.metaKey)},J=function(e){if(e){var t=e.offsetWidth,n=e.offsetHeight;if(t&&n)return{width:t,height:n};var r=getComputedStyle(e),i=parseFloat(r.width),o=parseFloat(r.height);if(o&&i)return{width:i,height:o}}return{width:0,height:0}},K=function(){},Z={x:0,y:0},G=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=n}function n(){var t=null!==e&&e.apply(this,arguments)||this;return t._prevDragMovePoint=null,t._containerObserver=null,t._fingers=0,t._firstMove=!0,t._initialOffset=b({},Z),t._interaction=null,t._isDoubleTap=!1,t._isOffsetsSet=!1,t._lastDragPosition=null,t._lastScale=1,t._lastTouchStart=0,t._lastZoomCenter=null,t._listenMouseMove=!1,t._nthZoom=0,t._offset=b({},Z),t._startOffset=b({},Z),t._startTouches=null,t._updatePlaned=!1,t._wheelTimeOut=null,t._zoomFactor=1,t._initialZoomFactor=1,t._draggingPoint=b({}
2,Z),t._ignoreNextClick=!1,t._containerRef=(0,y.createRef)(),t._handleClick=function(e){t._ignoreNextClick&&(t._ignoreNextClick=!1,e.stopPropagation())},t._onResize=function(){var e;(null==(e=t._containerRef)?void 0:e.current)&&(t._updateInitialZoomFactor(),t._setupOffsets(),t._update())},t._handlerOnTouchEnd=t._handlerIfEnable(function(e){t._fingers=e.touches.length,t.props.shouldCancelHandledTouchEndEvents&&(z(t._interaction)||P(t._interaction)&&(t._startOffset.x!==t._offset.x||t._startOffset.y!==t._offset.y))&&$(e),P(t._interaction)&&!t._enoughToDrag()&&t._handleClick(e),t._updateInteraction(e)}),t._handlerOnTouchStart=t._handlerIfEnable(function(e){t._firstMove=!0,t._fingers=e.touches.length,t._detectDoubleTap(e)}),t._handlerOnTouchMove=t._handlerIfEnable(function(e){t._isDoubleTap||(t._collectInertia(e),t._firstMove?(t._updateInteraction(e),t._interaction&&$(e),t._startOffset=b({},t._offset),t._startTouches=q(e.touches)):(z(t._interaction)?t._startTouches&&2===t._startTouches.length&&2===e.touches.length&&t._handleZoom(e,B(t._startTouches,q(e.touches))):P(t._interaction)&&t._handleDrag(e),t._interaction&&($(e),t._update())),t._firstMove=!1)}),t._handlerWheel=function(e){if(!t.props.shouldInterceptWheel(e)){$(e);var n=e.pageX,r=e.pageY,i=e.deltaY,o=e.deltaMode,s=1;(I&&e.ctrlKey||1===o)&&(s=15);var l=t._getOffsetByFirstTouch({touches:[{pageX:n,pageY:r}]}),a=i*s;t._stopAnimation(),t._scaleTo(t._zoomFactor-a/t.props.wheelScaleFactor,l),t._update(),clearTimeout(t._wheelTimeOut),t._wheelTimeOut=setTimeout(function(){return t._sanitize()},100)}},t._handlers=t.props.isTouch()?[["touchstart",t._handlerOnTouchStart],["touchend",t._handlerOnTouchEnd],["touchmove",t._handlerOnTouchMove]]:[["mousemove",t.simulate(t._handlerOnTouchMove),t.props._document],["mouseup",t.simulate(t._handlerOnTouchEnd),t.props._document],["mousedown",t.simulate(t._handlerOnTouchStart)],["click",t._handleClick],["wheel",t._handlerWheel]],t}return v(n,e),n.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t),n.prototype._handleDragStart=function(e){this._ignoreNextClick=!0,this.props.onDragStart(),this._stopAnimation(),this._resetInertia(),this._lastDragPosition=null,this._hasInteraction=!0,this._draggingPoint=this._offset,this._handleDrag(e)},n.prototype._handleDrag=function(e){var t=this._getOffsetByFirstTouch(e);this._enoughToDrag()?this._drag(t,this._lastDragPosition):this._virtualDrag(t,this._lastDragPosition),this._offset=this._sanitizeOffset(this._offset),this._lastDragPosition=t},n.prototype._resetInertia=function(){this._velocity=null,this._prevDragMovePoint=null},n.prototype._realizeInertia=function(){var e=this,t=this.props,n=t.inertiaFriction;if(t.inertia&&this._velocity){var r=this._velocity,i=r.x,o=r.y;(i||o)&&(this._stopAnimation(),this._resetInertia(),this._animate(function(){if(i*=n,o*=n,!i&&!o)return e._stopAnimation();var t,r=b({},e._offset);if(e._addOffset({x:i,y:o}),e._offset=e._sanitizeOffset(e._offset),t=e._offset,r.x===t.x&&r.y===t.y)return e._stopAnimation();e._update({isAnimation:!0})},{duration:9999}))}},n.prototype._collectInertia=function(e){var t=e.touches;if(this.props.inertia){var n=q(t)[0],r=this._prevDragMovePoint;r&&(this._velocity={x:r.x-n.x,y:r.y-n.y}),this._prevDragMovePoint=n}},n.prototype._handleDragEnd=function(){this.props.onDragEnd(),this._end(),this._realizeInertia()},n.prototype._handleZoomStart=function(){this.props.onZoomStart(),this._stopAnimation(),this._lastScale=1,this._nthZoom=0,this._lastZoomCenter=null,this._hasInteraction=!0},n.prototype._handleZoom=function(e,t){var n,r={x:(n=this._getOffsetTouches(e)).map(function(e){return e.x}).reduce(W,0)/n.length,y:n.map(function(e){return e.y}).reduce(W,0)/n.length},i=t/this._lastScale;this._lastScale=t,this._nthZoom+=1,this._nthZoom>3&&(this._scale(i,r),this._drag(r,this._lastZoomCenter),this.props.enforceBoundsDuringZoom&&(this._offset=this._sanitizeOffset(this._offset))),this._lastZoomCenter=r},n.prototype._handleZoomEnd=function(){this.props.onZoomEnd(),this._end()},n.prototype._handleDoubleTap=function(e){var t=this;if(!this._hasInteraction&&0!==this.props.tapZoomFactor){var n=this.props.doubleTapZoomOutOnMaxScale&&this._zoomFactor===this.props.maxZoom||this.props.doubleTapToggleZoom&&this._zoomFactor>1;this.props.onDoubleTap(),this._ignoreNextClick=!0;var r=this._zoomFactor+this.props.tapZoomFactor,i=this._zoomFactor,o=this._getOffsetByFirstTouch(e);this._isDoubleTap=!0,i>r&&(o=this._getCurrentZoomCenter()),n?this._zoomOutAnimation():this._animate(function(e){t._scaleTo(i+e*(r-i),o)})}},n.prototype._computeInitialOffset=function(){var e=this._getContainerRect(),t=this._getChildSize(),n=t.
2width,r=t.height,i=-D(n*this._getInitialZoomFactor()-e.width)/2,o=-D(r*this._getInitialZoomFactor()-e.height)/2;this._initialOffset={x:i,y:o}},n.prototype._resetOffset=function(){this._offset=b({},this._initialOffset)},n.prototype._setupOffsets=function(){this.props.setOffsetsOnce&&this._isOffsetsSet||(this._isOffsetsSet=!0,this._computeInitialOffset(),this._resetOffset())},n.prototype._sanitizeOffset=function(e){var t=this._getContainerRect(),n=this._getChildSize(),r=n.width,i=n.height,o=r*this._getInitialZoomFactor()*this._zoomFactor,s=i*this._getInitialZoomFactor()*this._zoomFactor,l=E({containerDimension:t.width,childDimension:o,padding:this.props.horizontalPadding,centerContained:this.props.centerContained}),a=l[0],c=l[1],d=E({containerDimension:t.height,childDimension:s,padding:this.props.verticalPadding,centerContained:this.props.centerContained}),h=d[0],u=d[1];return{x:U(a,c,e.x),y:U(h,u,e.y)}},n.prototype.alignCenter=function(e){var t=this,n=b({duration:250,animated:!0},e),r=n.x,i=n.y,o=n.scale,s=n.animated,l=n.duration,a=r*this._initialZoomFactor,c=i*this._initialZoomFactor,d=this._zoomFactor,h=b({},this._offset),u=this._getContainerRect(),p={x:u.width/2,y:u.height/2};if(this._zoomFactor=1,this._offset={x:-(p.x-a),y:-(p.y-c)},this._scaleTo(o,p),this._stopAnimation(),!s)return this._update();var f=this._zoomFactor-d,m={x:this._offset.x-h.x,y:this._offset.y-h.y};this._zoomFactor=d,this._offset=b({},h),this._animate(function(e){var n=h.x+m.x*e,r=h.y+m.y*e;t._zoomFactor=d+f*e,t._offset=t._sanitizeOffset({x:n,y:r}),t._update()},{callback:function(){return t._sanitize()},duration:l})},n.prototype.scaleTo=function(e){var t=this,n=b({duration:250,animated:!0},e),r=n.x,i=n.y,o=n.scale,s=n.animated,l=n.duration,a=this._zoomFactor,c=b({},this._offset);if(this._zoomFactor=1,this._offset={x:0,y:0},this._scaleTo(o,{x:r,y:i}),this._stopAnimation(),!s)return this._update();var d=this._zoomFactor-a,h={x:this._offset.x-c.x,y:this._offset.y-c.y};this._zoomFactor=a,this._offset=b({},c),this._animate(function(e){var n=c.x+h.x*e,r=c.y+h.y*e;t._zoomFactor=a+d*e,t._offset={x:n,y:r},t._update()},{callback:function(){return t._sanitize()},duration:l})},n.prototype._scaleTo=function(e,t){this._scale(e/this._zoomFactor,t),this._offset=this._sanitizeOffset(this._offset)},n.prototype._scale=function(e,t){e=this._scaleZoomFactor(e),this._addOffset({x:(e-1)*(t.x+this._offset.x),y:(e-1)*(t.y+this._offset.y)}),this.props.onZoomUpdate()},n.prototype._scaleZoomFactor=function(e){var t=this._zoomFactor;return this._zoomFactor*=e,this._zoomFactor=U(this.props.minZoom,this.props.maxZoom,this._zoomFactor),this._zoomFactor/t},n.prototype._canDrag=function(){var e;return this.props.draggableUnZoomed||!((e=this._zoomFactor)>.99&&e<1.01)},n.prototype._drag=function(e,t){if(t){var n=-(e.y-t.y),r=-(e.x-t.x);this.props.lockDragAxis?D(r)>D(n)?this._addOffset({x:r,y:0}):this._addOffset({y:n,x:0}):this._addOffset({x:r,y:n}),this.props.onDragUpdate()}},n.prototype._virtualDrag=function(e,t){if(t){var n=-(e.y-t.y),r=-(e.x-t.x);this._draggingPoint={x:r+this._draggingPoint.x,y:n+this._draggingPoint.y}}},n.prototype._addOffset=function(e){var t=this._offset,n=t.x,r=t.y;this._offset={x:n+e.x,y:r+e.y}},n.prototype._sanitize=function(){this._zoomFactor<this.props.zoomOutFactor?(this._resetInertia(),this._zoomOutAnimation()):this._isInsaneOffset()&&this._sanitizeOffsetAnimation()},n.prototype._isInsaneOffset=function(){var e=this._offset,t=this._sanitizeOffset(e);return t.x!==e.x||t.y!==e.y},n.prototype._sanitizeOffsetAnimation=function(){var e=this,t=this._sanitizeOffset(this._offset),n=b({},this._offset);this._animate(function(r){e._offset={x:n.x+r*(t.x-n.x),y:n.y+r*(t.y-n.y)},e._update()})},n.prototype._zoomOutAnimation=function(){var e=this;if(1!==this._zoomFactor){var t=this._zoomFactor,n=this._getCurrentZoomCenter();this._animate(function(r){e._scaleTo(t+r*(1-t),n)})}},n.prototype._getInitialZoomFactor=function(){return this._initialZoomFactor},n.prototype._getCurrentZoomCenter=function(){var e=this._offset,t=e.x,n=e.y,r=t-this._initialOffset.x,i=n-this._initialOffset.y;return{x:-1*t-r/(1/this._zoomFactor-1),y:-1*n-i/(1/this._zoomFactor-1)}},n.prototype._getOffsetByFirstTouch=function(e){return this._getOffsetTouches(e)[0]},n.prototype._getOffsetTouches=function(e){var t=this.props._document,n=t.documentElement,r=t.body,i=this._getContainerRect(),o=i.top,s=i.left,l=n.scrollTop||r.scrollTop,a=n.scrollLeft||r.scrollLeft,c=o+l,d=s+a;return q(e.touches).map(function(e){return{x:e.x-d,y:e.y-c}})},n.prototype._animate=function(e,t){var n=this,r=new Date().getTime(),i=b({timeFn:V,callback:function(){},duration:this.props.animationDuration},t),o=i.timeFn,s=i.callback,l=i.duration,a=function(){if(n._inAnimation){var t=new Date().getTime()-r,i=t/l;t>=l?(e(1),n._stopAnimation(),s(),n._update()):(e(i=o(i)),n._update({isAnimation:!0}),requestAnimationFrame(a))}};this._inAnimation=!0,requestAnimationFrame(a)},n.prototype._stopAnimation=function(){this._inAnimation=!1},n.prototype._end=function(){this._hasInteraction=!1,this._sanitize(),this._update()},n.prototype._getContainerRect=function(){return this._containerRef.current.getBoundingClientRect()},n.prototype._getChildSize=function(){var e=this._containerRef.current;return J(null==e?void 0:e.firstElementChild)},n.prototype._updateInitialZoomFactor=function(){var e=this._getContainerRect(),t=this._getChildSize(),n=e.width/t.width,r=e.height/t.height;this._initialZoomFactor=A(n,r)},n.prototype._bindEvents=function(){var e=this,t=this._containerRef.current;window.ResizeObserver?(this._containerObserver=new ResizeObserver(this._onResize),this._containerObserver.observe(t)):window.addEventListener("resize",this._onResize),this._handlers.forEac
2h(function(e){var n=e[0],r=e[1];(e[2]||t).addEventListener(n,r,!0)}),Array.from(t.querySelectorAll("img")).forEach(function(t){return t.addEventListener("load",e._onResize)})},n.prototype._unSubscribe=function(){var e=this,t=this._containerRef.current;this._containerObserver&&(this._containerObserver.disconnect(),this._containerObserver=null),window.removeEventListener("resize",this._onResize),this._handlers.forEach(function(e){var n=e[0],r=e[1];(e[2]||t).removeEventListener(n,r,!0)}),Array.from(t.querySelectorAll("img")).forEach(function(t){return t.removeEventListener("load",e._onResize)})},n.prototype._update=function(e){var t=this;if(!this._updatePlaned){var n=function(){var e=t._getInitialZoomFactor()*t._zoomFactor,n=-t._offset.x/e,r=-t._offset.y/e;t.props.onUpdate({scale:e,x:n,y:r})};if(null==e?void 0:e.isAnimation)return n();this._updatePlaned=!0,requestAnimationFrame(function(){t._updatePlaned=!1,n()})}},n.prototype._handlerIfEnable=function(e){var t=this;return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];t.props.enabled&&e.apply(void 0,n)}},n.prototype._setInteraction=function(e,t){var n=this._interaction;n!==e&&(n&&!e&&(z(n)?this._handleZoomEnd():P(n)&&this._handleDragEnd()),z(e)?this._handleZoomStart():P(e)&&this._handleDragStart(t)),this._interaction=e},n.prototype._distanceBetweenNumbers=function(e,t){return e>t?e-t:t-e},n.prototype._enoughToDrag=function(){return!!(this._distanceBetweenNumbers(this._startOffset.x,this._draggingPoint.x)>5||this._distanceBetweenNumbers(this._startOffset.y,this._draggingPoint.y)>5)},n.prototype._updateInteraction=function(e){var t=this._fingers;return 2===t?this._setInteraction("zoom",e):1===t&&this._canDrag()?this._setInteraction("drag",e):void this._setInteraction(null,e)},n.prototype._detectDoubleTap=function(e){var t=new Date().getTime();this._fingers>1&&(this._lastTouchStart=0),t-this._lastTouchStart<300?($(e),this._handleDoubleTap(e),z(this._interaction)?this._handleZoomEnd():P(this._interaction)&&this._handleDragEnd()):this._isDoubleTap=!1,1===this._fingers&&(this._lastTouchStart=t)},n.prototype.simulate=function(e){var t=this;return function(n){var r=n.pageX,i=n.pageY,o=n.type,s="mouseup"===o;"mousedown"===o&&(n.preventDefault(),t._listenMouseMove=!0),t._listenMouseMove&&(n.touches=s?[]:[{pageX:r,pageY:i}],e(n)),s&&(t._listenMouseMove=!1)}},n.prototype.componentDidMount=function(){this._bindEvents(),this._update()},n.prototype.componentWillUnmount=function(){this._stopAnimation(),this._unSubscribe()},n.prototype.render=function(){var e=this.props,t=e.children,n=e.containerProps,r=e.nonce,i=y.Children.only(t),o=n||{};return y.default.createElement(y.default.Fragment,null,y.default.createElement("style",{nonce:r},S),y.default.createElement("div",b({},o,{ref:this._containerRef,className:_(w,o.className)}),(0,y.cloneElement)(i,{className:_(k,i.props.className)})))},n.defaultProps={animationDuration:250,draggableUnZoomed:!0,enforceBoundsDuringZoom:!1,centerContained:!1,enabled:!0,inertia:!0,inertiaFriction:.96,horizontalPadding:0,isTouch:M,lockDragAxis:!1,maxZoom:5,minZoom:.5,onDoubleTap:K,onDragEnd:K,onDragStart:K,onDragUpdate:K,onZoomEnd:K,onZoomStart:K,onZoomUpdate:K,setOffsetsOnce:!1,shouldInterceptWheel:H,shouldCancelHandledTouchEndEvents:!1,tapZoomFactor:1,verticalPadding:0,wheelScaleFactor:1500,zoomOutFactor:1.3,doubleTapZoomOutOnMaxScale:!1,doubleTapToggleZoom:!1,_document:R?null:window.document},n}(y.Component),Y=e.i(714608);function X(e){return null!=e&&e.complete&&e.naturalWidth>0}let Q=({open:e,post:n,onClose:r})=>{let[o,s]=(0,y.useState)(!1),[a,c]=(0,y.useState)(!1),m=(0,y.useRef)(null),g=(0,y.useRef)(null),x=(0,y.useRef)(null),v=`${n.id}-${n.image3072x3072}`,b=(0,y.useCallback)(({x:e,y:t,scale:n})=>{let{current:r}=m;if(r){let i=O({x:e,y:t,scale:n});r.style.setProperty("transform",i)}},[]),w=(0,y.useCallback)(()=>{s(!0)},[]),k=(0,y.useCallback)(()=>{c(!0)},[]);return(0,y.useEffect)(()=>{if(!e){s(!1),c(!1);return}s(!1),c(!1),X(g.current)&&s(!0)},[e,v]),(0,y.useEffect)(()=>{e&&o&&X(x.current)&&c(!0)},[o,e,v]),(0,t.jsxs)(u.Modal.Container,{open:e,showClose:!1,animate:!1,className:"inset-0 flex h-dvh w-full translate-x-0 translate-y-0 bg-black [&>div]:h-full [&>div]:w-full",onClose:r,children:[(0,t.jsx)(G,{onUpdate:b,doubleTapZoomOutOnMaxScale:!0,doubleTapToggleZoom:!0,enforceBoundsDuringZoom:!0,centerContained:!0,children:(0,t.jsxs)("div",{ref:m,className:"relative flex h-full w-full items-center justify-center",children:[(0,t.jsx)(f.ThumbHash,{hash:n.thumb_hash,className:"absolute inset-0 size-full"}),!a&&(0,t.jsx)("div",{className:"absolute top-0 right-0 bottom-0 left-0 flex items-center justify-center bg-black/60",children:(0,t.jsx)(h.LoadingSpinner,{size:"medium"})}),(0,t.jsx)("img",{ref:g,src:n.image1024x1024,alt:"",fetchPriority:"high",onLoad:w,onError:w,
2className:"relative max-h-full max-w-full object-contain"}),o&&(0,t.jsx)("img",{ref:x,src:n.image3072x3072,alt:"",decoding:"async",fetchPriority:"low",onLoad:k,onError:k,className:(0,l.cn)("absolute inset-0 m-auto max-h-full max-w-full object-contain transition-opacity duration-300 motion-reduce:transition-none",a?"opacity-100":"opacity-0")}),(0,t.jsx)("div",{className:"absolute top-0 right-0 bottom-0 left-0"})]})}),(0,t.jsx)(p.NavigationButton,{className:"absolute top-6-safe right-6 z-modal",onClick:r,children:(0,t.jsx)(i.FontAwesomeIcon,{icon:d.faXmark})})]})};e.s(["ImageContainer",0,function({className:e,post:n,willHydrate:o}){let[a,h]=(0,y.useState)(!1),[u,v]=(0,y.useState)(!1),[b,w]=(0,y.useState)(!1),k=(0,y.useRef)(null),S=(0,y.useRef)(null),{fullscreenRef:C,enterFullscreen:M,exitFullscreen:O,fullscreenActive:T}=(0,m.useFullScreen)(),[N,E]=(0,y.useState)(!1),{user:_}=(0,s.useAuth)(),D=(0,Y.useIsPWA)(),A=`${n.id}-${n.image1024x1024}`,j=(0,f.useThumbHashEnabled)()&&!!n.thumb_hash;(0,x.useHotkeys)("f",e=>{"f"==e.key&&(T?O():M())},{useKey:!0},[T]);let R=(0,y.useCallback)(()=>{v(!0)},[]),I=(0,y.useCallback)(()=>{w(!0)},[]);return(0,y.useEffect)(()=>{v(!1),w(!1),X(k.current)&&v(!0)},[A]),(0,y.useEffect)(()=>{u&&X(S.current)&&w(!0)},[u,A]),(0,y.useEffect)(()=>{o&&!a&&h(!0)},[o,a]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Q,{open:N,post:n,onClose:()=>E(!1)}),(0,t.jsxs)("div",{ref:C,className:(0,l.cn)("relative flex",e),style:j?void 0:{backgroundColor:`#${n.prominent_color}`},children:[(0,t.jsx)(f.ThumbHash,{hash:n.thumb_hash,className:"absolute inset-0 size-full"}),(0,t.jsxs)("div",{className:"relative flex flex-auto",children:[(0,t.jsxs)("div",{className:(0,l.cn)("relative flex grow bg-secondary/75 transition-[background-color] duration-500 ease-in-out",{"bg-black":T}),children:[(0,t.jsx)("img",{ref:k,src:n.image1024x1024,alt:"",width:n.width,height:n.height,fetchPriority:"high",onLoad:R,onError:R,className:"relative h-full w-full object-contain [image-orientation:none]"}),u&&(0,t.jsx)("img",{ref:S,src:n.image2048x2048,srcSet:`${n.image1024x1024} 1024w, ${n.image2048x2048} 2048w, ${n.image3072x3072} 3072w`,sizes:"(min-width: 1280px) calc(100vw - 380px), (min-width: 1024px) calc(100vw - 340px), 100vw",alt:"",width:n.width,height:n.height,decoding:"async",fetchPriority:"low",onLoad:I,onError:I,className:(0,l.cn)("absolute inset-0 h-full w-full object-contain transition-opacity duration-300 [image-orientation:none] motion-reduce:transition-none",b?"opacity-100":"opacity-0")}),!b&&(0,t.jsx)(g.motion.span,{initial:{opacity:0}
2,animate:{opacity:1},transition:{delay:.5,duration:.5},className:(0,l.cn)("absolute right-2 bottom-2",{"text-white":T}),children:(0,t.jsx)(i.FontAwesomeIcon,{icon:c.faSpinnerThird,spin:!0})}),_?.username===n.user.username&&(!n.is_hidden||n.is_pinned)&&(0,t.jsxs)("span",{className:(0,l.cn)("pointer-events-none absolute top-0 right-0 bottom-0 left-0 flex items-start justify-end gap-2 p-4 text-primary md:gap-4.5 md:p-9.5 md:text-xl",{hidden:T}),children:[n.is_hidden&&(0,t.jsx)(i.FontAwesomeIcon,{icon:r.faEyeSlash}),n.is_pinned&&(0,t.jsx)(i.FontAwesomeIcon,{icon:r.faThumbTack})]})]}),(0,t.jsx)("div",{className:"absolute top-0 right-0 bottom-0 left-0",onClick:()=>{window.matchMedia(Y.COARSE_POINTER_MEDIA_QUERY).matches&&E(!0)}})]},`image-container-wrapper-${A}`),(!o||!!a)&&!D&&(0,t.jsx)(p.NavigationButton,{className:(0,l.cn)("z-20 hidden lg:absolute lg:top-6 lg:right-6 lg:block",{"border-[#1c1c1e] bg-[#1c1c1e]/90 text-white hover:border-[#2c2c2e] hover:bg-[#1c1c1e]":T}),onClick:()=>T?O():M(),children:(0,t.jsx)(i.FontAwesomeIcon,{icon:T?d.faArrowDownLeftAndArrowUpRightToCenter:d.faArrowUpRightAndArrowDownLeftFromCenter})})]})]})}],864458)},808193,e=>{"use strict";var t=e.i(380447),n=e.i(138400),r=e.i(699721),i=e.i(512429),o=e.i(536625),s=e.i(743133),l=e.i(552979),a=e.i(582512);e.s(["JoinBanner",0,function({className:e,hideButton:c=!1}){let{isLoggedIn:d,isLoadingInitial:h}=(0,s.useAuth)();return h||d?null:(0,t.jsxs)("footer",{className:(0,a.cn)("flex h-18 items-center justify-between bg-secondary px-4 py-0",e),children:[(0,t.jsxs)(l.default,{href:"/",className:"flex shrink-0 flex-col gap-0.5",children:[(0,t.jsx)(o.Glyph,{size:18,variant:"wordmark",className:"ml-0.5"}),(0,t.jsx)("span",{className:"pl-0.5 text-footnote text-gray-1",children:"Photography Community"})]}),!c&&(0,t.jsxs)(i.Button,{element:"link",href:"/signup/choose-plan",variant:"tertiary",size:"small",className:"w-auto gap-1 px-3",children:[(0,t.jsx)(r.FontAwesomeIcon,{icon:n.faCircleArrowUp,className:"text-headline"}),(0,t.jsx)("span",{className:"whitespace-nowrap",children:"Sign Up"})]})]})}])},56311,135790,701831,1883,713687,e=>{"use strict";var t=e.i(380447),n=e.i(98301),r=e.i(699721),i=e.i(743133),o=e.i(999161),s=e.i(642862),l=e.i(984138),a=e.i(313312),c=e.i(489739),d=e.i(790931),h=e.i(791803),u=e.i(99338),p=e.i(552979),f=e.i(647174);function m({open:e,onClick:i,comment:o,post:g}){let{paginatedData:y,error:x,setSize:v,isReachingEnd:b,isRefreshing:w,mutate:k}=(0,h.useCursorPagination)(e?o&&`/api/v2/comments/${o.id}/appreciations`||g&&`/api/v2/post/${g.friendly_id}/appreciations`||"":null,50,u.cursorGetter,[]);return(0,t.jsxs)(c.Modal.Container,{open:e,onClose:i,className:"flex flex-col overflow-hidden rounded-t-2xl bg-secondary md:max-h-[90%] md:w-[95%] md:max-w-md md:rounded-2xl",variant:"withSheetSupport",children:[(0,t.jsx)(c.Modal.TitleBar,{children:(0,t.jsxs)(c.Modal.Title,{onClose:i,children:[(0,t.jsx)(r.FontAwesomeIcon,{icon:n.faSparkles,className:"mr-1 text-yellow"})," Appreciations"]})}),x?(0,t.jsx)(l.LoadingError,{className:"mt-6 mb-10",title:"Failed to load appreciations",mutate:k}):(0,t.jsx)("div",{className:"flex flex-col overflow-x-hidden overflow-y-auto p-6",children:(0,t.jsx)(s.InfiniteScroll,{offset:-1e3,loadingIndicator:(0,t.jsx)(a.LoadingSpinner,{className:"mt-6 mb-2 h-auto w-auto",size:"small"}),setSize:v,isReachingEnd:b,isValidating:w,children:y?.map(e=>(0,t.jsxs)("div",{className:"mt-6 flex items-center [&:first-child]:mt-0",children:[(0,t.jsx)(p.default,{href:`${(0,f.getOriginFromRequest)()}/${e.user.username}`,className:"mr-4 h-14 shrink-0 overflow-hidden",children:(0,t.jsx)("img",{className:"h-14 w-14 rounded-full",src:e.user.profile192x192,alt:""})}),(0,t.jsx)(p.default,{href:`/${e.user.username}`,className:"overflow-hidden font-semibold text-ellipsis whitespace-nowrap no-underline",children:e.user.name}),(0,t.jsx)(d.TimeAgo,{className:"ml-2 shrink-0 text-footnote text-gray-2",date:e.created_at})]},e.id))})})]})}e.s(["AppreciationsModal",0,m],135790),e.s(["Appreciations",0,function({post:e}){let{user:s,isLoggedIn:l}=(0,i.useAuth)(),[a,c]=(0,o.useState)(!1),d=l&&e.user.username===s?.username&&e.has_appreciations,h=(0,o.useCallback)(()=>
vendor: 4,530 bytes, line 2
2c(!a),[a]);return l&&d?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(m,{open:a,onClick:h,post:e}),(0,t.jsxs)("button",{onClick:h,className:"pointer-events-auto flex cursor-pointer flex-row items-center justify-between border-t border-solid border-gray-6 p-4 outline-hidden select-none",children:[(0,t.jsx)(r.FontAwesomeIcon,{className:"mr-3 w-9 text-yellow",icon:n.faSparkles}),(0,t.jsx)("span",{className:"grow text-left",children:"Appreciations"})]})]}):null}],56311);var g=e.i(138400);function y(e){this.content=e}function x(e){return e>=56320&&e<57344}function v(e){return e>=55296&&e<56320}y.prototype={constructor:y,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return -1},get:function(e){var t=this.find(e);return -1==t?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,i=r.find(e),o=r.content.slice();return -1==i?o.push(n||e,t):(o[i+1]=t,n&&(o[i]=n)),new y(o)},remove:function(e){var t=this.find(e);if(-1==t)return this;var n=this.content.slice();return n.splice(t,2),new y(n)},addToStart:function(e,t){return new y([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new y(n)},addBefore:function(e,t,n){var r=this.remove(t),i=r.content.slice(),o=r.find(e);return i.splice(-1==o?i.length:o,0,t,n),new y(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=y.from(e)).size?new y(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=y.from(e)).size?new y(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=y.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},y.from=function(e){if(e instanceof y)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new y(t)};class b{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,i){for(let o=0,s=0;s<t;o++){let l=this.content[o],a=s+l.nodeSize;if(a>e&&!1!==n(l,r+s,i||null,o)&&l.content.size){let i=s+1;l.nodesBetween(Math.max(0,e-i),Math.min(l.content.size,t-i),n,r+i)}s=a}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let i="",o=!0;return this.nodesBetween(e,t,(s,l)=>{let a=s.isText?s.text.slice(Math.max(e,l)-l,t-l):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&a||s.isTextblock)&&n&&(o?o=!1:i+=n),i+=a},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new b(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let i=0,o=0;o<t;i++){let s=this.content[i],l=o+s.nodeSize;l>e&&((o<e||l>t)&&(s=s.isText?s.cut(Math.max(0,e-o),Math.min(s.text.length,t-o)):s.cut(Math.max(0,e-o-1),Math.min(s.content.size,t-o-1))),n.push(s),r+=s.nodeSize),o=l}return new b(n,r)}cutByIndex(e,t){return e==t?b.empty:0==e&&t==this.content.length?this:new b(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new b(r,i)}addToStart(e){return new b([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new b(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return function e(t,n,r){for(let i=0;;i++){if(i==t.childCount||i==n.childCount)return t.childCount==n.childCount?null:r;let o=t.child(i),s=n.child(i);if(o==s){r+=o.nodeSize;continue}if(!o.sameMarkup(s))return r;if(o.isText&&o.text!=s.text){let e=o.text,t=s.text,n=0;for(;e[n]==t[n];
2n++)r++;return n&&n<e.length&&n<t.length&&v(e.charCodeAt(n-1))&&x(e.charCodeAt(n))&&r--,r}if(o.content.size||s.content.size){let t=e(o.content,s.content,r+1);if(null!=t)return t}r+=o.nodeSize}}(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return function e(t,n,r,i){for(let o=t.childCount,s=n.childCount;;){if(0==o||0==s)return o==s?null:{a:r,b:i};let l=t.child(--o),a=n.child(--s),c=l.nodeSize;if(l==a){r-=c,i-=c;continue}if(!l.sameMarkup(a))return{a:r,b:i};if(l.isText&&l.text!=a.text){let e=l.text,t=a.text,n=e.length,o=t.length;for(;n>0&&o>0&&e[n-1]==t[o-1];)n--,o--,r--,i--;return n&&o&&n<e.length&&v(e.charCodeAt(n-1))&&x(e.charCodeAt(n))&&(r++,i++),{a:r,b:i}}if(l.content.size||a.content.size){let t=e(l.content,a.content,r-1,i-1);if(t)return t}r-=c,i-=c}}(this,e,t,n)}findIndex(e){if(0==e)return k(0,e);if(e==this.size)return k(this.content.length,e);if(e>this.size||e<0)throw RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e){if(r==e)return k(t+1,r);
2return k(t,n)}n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return b.empty;if(!Array.isArray(t))throw RangeError("Invalid input for Fragment.fromJSON");return b.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return b.empty;let t,n=0;for(let r=0;r<e.length;r++){let i=e[r];n+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new b(t||e,n)}static from(e){if(!e)return b.empty;if(e instanceof b)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new b([e],e.nodeSize);throw RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}b.empty=new b([],0);let w={index:0,offset:0};function k(e,t){return w.index=e,w.offset=t,w}function S(e,t){if(e===t)return!0;if(!(e&&"object"==typeof e)||!(t&&"object"==typeof t))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!S(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!S(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class C{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!n&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(i)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&S(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return C.none;if(e instanceof C)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}C.none=[];class M extends Error{}class O{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=function e(t,n,r,i,o,s){let{index:l,offset:a}=t.findIndex(n),c=t.maybeChild(l);if(a==n||c.isText)return s&&i<=0&&o<=0&&!s.canReplace(l,l,r)?null:t.cut(0,n).append(r).append(t.cut(n));let d=e(c.content,n-a-1,r,0==l?i-1:0,l==t.childCount-1?o-1:0,c);return d&&t.replaceChild(l,c.copy(d))}(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new O(n,this.openStart,this.openEnd)}removeBetween(e,t){return new O(function e(t,n,r){let{index:i,offset:o}=t.findIndex(n),s=t.maybeChild(i),{index:l,offset:a}=t.findIndex(r);if(o==n||s.isText){if(a!=r&&!t.child(l).isText)throw RangeError("Removing non-flat range");return t.cut(0,n).append(t.cut(r))}if(i!=l)throw RangeError("Removing non-flat range");return t.replaceChild(i,s.copy(e(s.content,n-o-1,r-o-1)))}(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return O.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw RangeError("Invalid input for Slice.fromJSON");return new O(b.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new O(e,n,r)}}function T(e,t){if(!t.type.compatibleContent(e.type))throw new M("Cannot join "+t.type.name+" onto "+e.type.n
vendor: 4,756 bytes, line 2
2ame)}function N(e,t,n){let r=e.node(n);return T(r,t.node(n)),r}function E(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function _(e,t,n,r){let i=(t||e).node(n),o=0,s=t?t.index(n):i.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(E(e.nodeAfter,r),o++));for(let e=o;e<s;e++)E(i.child(e),r);t&&t.depth==n&&t.textOffset&&E(t.nodeBefore,r)}function D(e,t){if(!e.type.validContent(t))throw new M("Invalid content for node "+e.type.name);return e.copy(t)}function A(e,t,n){let r=[];return _(null,e,n,r),e.depth>n&&E(D(N(e,t,n+1),A(e,t,n+1)),r),_(t,null,n,r),new b(r)}O.empty=new O(b.empty,0,0);class j{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return C.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let i=n.marks;for(var o=0;o<i.length;o++)!1!==i[o].type.spec.inclusive||r&&i[o].isInSet(r.marks)||(i=i[o--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<n.length;i++)!1!==n[i].type.spec.inclusive||r&&n[i].isInSet(r.marks)||(n=n[i--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new z(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw RangeError("Position "+t+" out of range");let n=[],r=0,i=t;for(let t=e;;){let{index:e,offset:o}=t.content.findIndex(i),s=i-o;if(n.push(t,e,r+o),!s||(t=t.child(e)).isText)break;i=s-1,r+=o+1}return new j(t,n,i)}static resolveCached(e,t){let n=P.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else P.set(e,n=new R);let r=n.elts[n.i]=j.resolve(e,t);return n.i=(n.i+1)%I,r}}class R{constructor(){this.elts=[],this.i=0}}let I=12,P=new WeakMap;class z{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}let $=Object.create(null);class F{constructor(e,t,n,r=C.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||b.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}
2textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&S(this.attrs,t||e.defaultAttrs||$)&&C.sameSet(this.marks,n||C.none)}copy(e=null){return e==this.content?this:new F(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new F(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return O.empty;let r=this.resolve(e),i=this.resolve(t),o=n?0:r.sharedDepth(t),s=r.start(o);return new O(r.node(o).content.cut(r.pos-s,i.pos-s),r.depth-o,i.depth-o)}replace(e,t,n){var r=this.resolve(e),i=this.resolve(t);if(n.openStart>r.depth)throw new M("Inserted content deeper than insertion position");if(r.depth-n.openStart!=i.depth-n.openEnd)throw new M("Inconsistent open depths");return function e(t,n,r,i){let o=t.index(i),s=t.node(i);if(o==n.index(i)&&i<t.depth-r.openStart){let l=e(t,n,r,i+1);return s.copy(s.content.replaceChild(o,l))}if(!r.content.size)return D(s,A(t,n,i));if(r.openStart||r.openEnd||t.depth!=i||n.depth!=i){let{start:e,end:o}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(b.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(r,t);return D(s,function e(t,n,r,i,o){let s=t.depth>o&&N(t,n,o+1),l=i.depth>o&&N(r,i,o+1),a=[];return _(null,t,o,a),s&&l&&n.index(o)==r.index(o)?(T(s,l),E(D(s,e(t,n,r,i,o+1)),a)):(s&&E(D(s,A(t,n,o+1)),a),_(n,r,o,a),l&&E(D(l,A(r,i,o+1)),a)),_(i,null,o,a),new b(a)}(t,e,o,n,i))}{let e=t.parent,i=e.content;return D(e,i.cut(0,t.parentOffset).append(r.content).append(i.cut(n.parentOffset)))}}(r,i,n,0)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(!(t=t.maybeChild(n)))return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return j.resolveCached(this,e)}resolveNoCache(e){return j.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),V(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=b.empty,r=0,i=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,r,i),s=o&&o.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<i;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(n),o=i&&i.matchFragment(this.content,t);return!!o&&o.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=C.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!C.sameSet(e,this.marks))throw RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>
2e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){let n;if(!t)throw RangeError("Invalid input for Node.fromJSON");if(t.marks){if(!Array.isArray(t.marks))throw RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=b.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,n);return i.type.checkAttrs(i.attrs),i}}F.prototype.text=void 0;class B extends F{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):V(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new B(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new B(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function V(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class L{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){var n;let r,i=new q(e,t);if(null==i.next)return L.empty;let o=function e(t){let n=[];do n.push(function(t){let n=[];do n.push(function(t){let n=function(t){if(t.eat("(")){let n=e(t);return t.eat(")")||t.err("Missing closing paren"),n}if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=(function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let e in n){let r=n[e];r.isInGroup(t)&&i.push(r)}return 0==i.length&&e.err("No node type or group '"+t+"' found"),i})(t,t.next).map(e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e}));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}}(t);for(;;)if(t.eat("+"))n={type:"plus",expr:n};else if(t.eat("*"))n={type:"star",expr:n};else if(t.eat("?"))n={type:"opt",expr:n};else if(t.eat("{"))n=function(e,t){let n=W(e),r=n;return e.eat(",")&&(r="}"!=e.next?W(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}(t,n);else break;return n}(t));while(t.next&&")"!=t.next&&"|"!=t.next)return 1==n.length?n[0]:{type:"seq",exprs:n}}(t));while(t.eat("|"))return 1==n.length?n[0]:{type:"choice",exprs:n}}(i);i.next&&i.err("Unexpected trailing text");let s=(n=function(e){let t=[[]];return i(function e(t,o){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,o)),[]);if("seq"==t.type)for(let r=0;;r++){let s=e(t.exprs[r],o);if(r==t.exprs.length-1)return s;i(s,o=n())}else if("star"==t.type){let s=n();return r(o,s),i(e(t.expr,s),s),[r(s)]}else if("plus"==t.type){let s=n();return i(e(t.expr,o),s),i(e(t.expr,s),s),[r(s)]}else if("opt"==t.type)return[r(o)].concat(e(t.expr,o));else if("range"==t.type){let s=o;for(let r=0;r<t.min;r++){let r=n();i(e(t.expr,s),r),s=r}if(-1==t.max)i(e(t.expr,s),s);else for(let o=t.min;o<t.max;o++){let o=n();r(s,o),i(e(t.expr,s),o),s=o}return[r(s)]}else if("name"==t.type)return[r(o,void 0,t.value)];else throw Error("Unknown expr type")}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let i={term:r,to:n};return t[e].push(i),i}function i(e,t){e.forEach(e=>e.to=t)}}(o),r=Object.create(null),function e(t){let i=[];t.forEach(e=>{n[e].forEach(({term:e,to:t})=>{let r;if(e){for(let t=0;t<i.length;t++)i[t][0]==e&&(r=i[t][1]);H(n,t).forEach(t=>{r||i.push([e,r=[]]),-1==r.indexOf(t)&&r.push(t)})}})});let o=r[t.join(",")]=new L(t.indexOf(n.length-1)>-1);for(let t=0;t<i.length;t++){let n=i[t][1].sort(U);o.next.push({type:i[t][0],next:r[n.join(",")]||e(n)})}return o}(H(n,0)));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],i=!e.validEnd,o=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];o.push(n.name),i&&!(n.isText||n.hasRequiredAttrs())&&(i=!1),-1==r.indexOf(s)&&r.push(s)}i&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(s,i),s}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}
vendor: 4,607 bytes, line 2
2matchFragment(e,t=0,n=e.childCount){let r=this;for(let i=t;r&&i<n;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function i(o,s){let l=o.matchFragment(e,n);if(l&&(!t||l.validEnd))return b.from(s.map(e=>e.createAndFill()));for(let e=0;e<o.next.length;e++){let{type:t,next:n}=o.next[e];if(!(t.isText||t.hasRequiredAttrs())&&-1==r.indexOf(n)){r.push(n);let e=i(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),i=r.match;if(i.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<i.next.length;e++){let{type:o,next:s}=i.next[e];o.isLeaf||o.hasRequiredAttrs()||o.name in t||r.type&&!s.validEnd||(n.push({match:o.contentMatch,type:o,via:r}),t[o.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return!function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}L.empty=new L(!0);class q{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw SyntaxError(e+" (in content expression '"+this.string+"')")}}function W(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function U(e,t){return t-e}function H(e,t){let n=[];return function t(r){let i=e[r];if(1==i.length&&!i[0].term)return t(i[0].to);n.push(r);for(let e=0;e<i.length;e++){let{term:r,to:o}=i[e];r||-1!=n.indexOf(o)||t(o)}}(t),n.sort(U)}function J(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function K(e,t){let n=Object.create(null);for(let r in e){let i=t&&t[r];if(void 0===i){let t=e[r];if(t.hasDefault)i=t.default;else throw RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function Z(e,t,n,r){for(let i in t)if(!(i in e))throw RangeError(`Unsupported attribute ${i} for ${n} of type ${r}`);for(let n in e)e[n].validate&&e[n].validate(t[n])}function G(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new X(e,r,t[r]);return n}class Y{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=G(e,n.attrs),this.defaultAttrs=J(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==L.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:K(this.attrs,e)}create(e=null,t,n){if(this.isText)throw Error("NodeType.create can't construct text nodes");return new F(this,this.computeAttrs(e),b.from(t),C.setFrom(n))}createChecked(e=null,t,n){return t=b.from(t),this.checkContent(t),new F(this,this.computeAttrs(e),t,C.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=b.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(b.empty,!0);return i?new F(this,e,t.append(i),C.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);
2if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Z(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){let t;if(null==this.markSet)return e;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:C.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new Y(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw RangeError("The text node type should not have attributes");return n}}class X{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let i=null===n?"null":typeof n;if(0>r.indexOf(i))throw RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Q{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=G(e,r.attrs),this.excluded=null;let i=J(this.attrs);this.instance=i?new C(this,i):null}create(e=null){return!e&&this.instance?this.instance:new C(this,K(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,i)=>n[e]=new Q(e,r++,t,i)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Z(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class ee{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=y.from(e.nodes),t.marks=y.from(e.marks||{}),this.nodes=Y.compile(this.spec.nodes,this),this.marks=Q.compile(this.spec.marks,this);let n=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],r=t.spec.content||"",i=t.spec.marks;if(t.contentMatch=n[r]||(n[r]=L.parse(r,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==i?null:i?et(this,i.split(" ")):""!=i&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:et(this,n.split(" "))}this.nodeFromJSON=e=>F.fromJSON(this,e),this.markFromJSON=e=>C.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else if(e instanceof Y){if(e.schema!=this)throw RangeError("Node type from different schema used ("+e.name+")")}else throw RangeError("Invalid node type: "+e);return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new B(n,n.defaultAttrs,e,C.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw RangeError("Unknown node type: "+e);return t}}function et(e,t){let n=[];for(let r=0;r<t.length;r++){let i=t[r],o=e.marks[i],s=o;if(o)n.push(o);else for(let t in e.marks){let r=e.marks[t];("_"==i||r.spec.group&&r.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=r)}if(!s)throw SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class en{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];
2t.forEach(e=>{if(null!=e.tag)this.tags.push(e);else if(null!=e.style){let t=/[^=]*/.exec(e.style)[0];0>n.indexOf(t)&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new ea(this,t,!1);return n.addAll(e,C.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new ea(this,t,!0);return n.addAll(e,C.none,t.from,t.to),O.maxOpen(n.finish())}matchTag(e,t,n){for(let o=n?this.tags.indexOf(n)+1:0;o<this.tags.length;o++){var r,i;let n=this.tags[o];if(r=e,i=n.tag,(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,i)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let r=this.styles[i],o=r.style;if(0==o.indexOf(e)&&(!r.context||n.matchesContext(r.context))&&(!(o.length>e.length)||61==o.charCodeAt(e.length)&&o.slice(e.length+1)==t)){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=ec(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=ec(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new en(e,en.schemaRules(e)))}}let er={address:!0,article:!0,aside:!0,blockquote:!0,body:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},ei={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},eo={ol:!0,ul:!0};
2function es(e,t,n){return null!=t?!!t|2*("full"===t):e&&"pre"==e.whitespace?3:-5&n}class el{constructor(e,t,n,r,i,o){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=o,this.content=[],this.activeMarks=C.none,this.match=i||(4&o?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(b.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let t=this.type.contentMatch,n;return(n=t.findWrapping(e.type))?(this.match=t,n):null}}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e=this.content[this.content.length-1],t;e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))&&(e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=e.withText(e.text.slice(0,e.text.length-t[0].length)))}let t=b.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(b.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!er.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ea{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,o=es(null,t.preserveWhitespace,0)|4*!!n;i=r?new el(r.type,r.attrs,C.none,!0,t.topMatch||r.type.contentMatch,o):n?new el(null,null,C.none,!0,null,o):new el(e.schema.topNodeType,null,C.none,!0,null,o),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,i=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:o}=this.parser;if("full"===i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(i)if("full"===i)n=n.replace(/\r\n?/g,"\n");else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(o.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(o.text(e[n]),t,!/\S/.test(e[n]));n=""}else n=n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let t=r.content[r.content.length-1],i=e.previousSibling;(!t||i&&"BR"==i.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,i=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),s;eo.hasOwnProperty(o)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&eo.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(s=this.parser.matchTag(e,this,n));e:if(l?l.ignore:ei.hasOwnProperty(o))this.findInside(e),this.ignoreFallback(e,t);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let n,r=this.needsBlock;if(er.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),n=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let s=l&&l.skip?t:this.readStyles(e,t);s&&this.addAll(e,s),n&&this.sync(i),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,l,n,!1===l.consuming?s:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],i=n.getPropertyValue(r);if(i)for(let e;;){let n=this.parser.matchStyle(r,i,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1===n.consuming)e=n;else break}}return t}addElementByRule(e,t,n,r){let i,o;
vendor: 4,111 bytes, line 2
2if(t.node)if((o=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(o.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(o,t.attrs||null,n,t.preserveWhitespace);e&&(i=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}i&&this.sync(s)&&this.open--}addAll(e,t,n,r){let i=n||0;for(let o=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];o!=s;o=o.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(o,t);this.findAtPoint(e,i)}findPlace(e,t,n){let r,i;for(let t=this.open,o=0;t>=0;t--){let s=this.nodes[t],l=s.findWrapping(e);if(l&&(!r||r.length>l.length+o)&&(r=l,i=s,!l.length))break;if(s.solid){if(n)break;o+=2}}if(!r)return null;this.sync(i);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=C.none;for(let i of r.concat(e.marks))(t.type?t.type.allowsMarkType(i.type):ed(i.type,e.type))&&(n=i.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let i=this.findPlace(e.create(t),n,!1);return i&&(i=this.enterInner(e,t,n,!0,r)),i}enterInner(e,t,n,r=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let s=es(e,i,o.options);4&o.options&&0==o.content.length&&(s|=4);let l=C.none;return n=n.filter(t=>(o.type?!o.type.allowsMarkType(t.type):!ed(t.type,e))||(l=t.addToSet(l),!1)),this.nodes.push(new el(e,t,l,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--)if(this.nodes[t]==e)return this.open=t,!0;else this.localPreserveWS&&(this.nodes[t].options|=1);return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),i=-(n?n.depth+1:0)+ +!r,o=(e,s)=>{for(;e>=0;e--){let l=t[e];if(""==l){if(e==t.length-1||0==e)continue;for(;s>=i;s--)if(o(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!e||e.name!=l&&!e.isInGroup(l))return!1;s--}}return!0};return o(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];
2if(t.isTextblock&&t.defaultAttrs)return t}}}function ec(e){let t={};for(let n in e)t[n]=e[n];return t}function ed(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let o=[],s=e=>{o.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:i}=e.edge(n);if(r==t||0>o.indexOf(i)&&s(i))return!0}};if(s(i.contentMatch))return!0}}class eh{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=ep(t).createDocumentFragment());let r=n,i=[];return e.forEach(e=>{if(i.length||e.marks.length){let n=0,o=0;for(;n<i.length&&o<e.marks.length;){let t=e.marks[o];if(!this.marks[t.type.name]){o++;continue}if(!t.eq(i[n][0])||!1===t.type.spec.spanning)break;n++,o++}for(;n<i.length;)r=i.pop()[1];for(;o<e.marks.length;){let n=e.marks[o++],s=this.serializeMark(n,e.isInline,t);s&&(i.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){if(e.isText)return ep(t).createTextNode(e.text);let{dom:n,contentDOM:r}=em(ep(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&em(ep(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return"string"==typeof t?{dom:e.createTextNode(t)}:em(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new eh(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=eu(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return eu(e.marks)}}function eu(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function ep(e){return e.document||window.document}let ef=new WeakMap;function em(e,t,n,r){let i,o,s;if(1==t.nodeType)return{dom:t};if(t.dom&&1==t.dom.nodeType)return t;let l=t[0],a;if("string"!=typeof l)throw RangeError("Invalid array passed to renderSpec");if(r&&(void 0===(o=ef.get(r))&&ef.set(r,(s=null,!function e(t){if(t&&"object"==typeof t)if(Array.isArray(t))if("string"==typeof t[0])s||(s=[]),s.push(t);else for(let n=0;n<t.length;n++)e(t[n]);else for(let n in t)e(t[n])}(r),o=s)),a=o)&&a.indexOf(t)>-1)throw RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let c=l.indexOf(" ");c>0&&(n=l.slice(0,c),l=l.slice(c+1));let d=n?e.createElementNS(n,l):e.createElement(l),h=t[1],u=1;if(h&&"object"==typeof h&&null==h.nodeType&&!Array.isArray(h)){for(let e in u=2,h)if(null!=h[e]){let t=e.indexOf(" ");t>0?d.setAttributeNS(e.slice(0,t),e.slice(t+1),h[e]):"style"==e&&d.style?d.style.cssText=h[e]:d.setAttribute(e,h[e])}}for(let o=u;o<t.length;o++){let s=t[o];if(0===s){if(o<t.length-1||o>u)throw RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}if("string"==typeof s)d.appendChild(e.createTextNode(s));else{let{dom:t,contentDOM:o}=em(e,s,n,r);if(d.appendChild(t),o){if(i)throw RangeError("Multiple content holes");i=o}}}return{dom:d,contentDOM:i}}class eg{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class ey{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&ey.empty)return ey.empty}recover(e){let t=0,n=65535&e;if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+(e-(65535&e))/65536}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let l=this.ranges[s]-(this.inverted?r:0);if(l>e)break;let a=this.ranges[s+i],c=this.ranges[s+o],d=l+a;if(e<=d){let i=a?e==l?-1:e==d?1:t:t,o=l+r+(i<0?0:c);if(n)return o;
vendor: 4,152 bytes, line 2
2let h=e==(t<0?l:d)?null:s/3+(e-l)*65536,u=e==l?2:e==d?1:4;return(t<0?e!=l:e!=d)&&(u|=8),new eg(o,u,h)}r+=c-a}return n?e+r:new eg(e+r,0,null)}touches(e,t){let n=0,r=65535&t,i=this.inverted?2:1,o=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let l=this.ranges[t+i];if(e<=s+l&&t==3*r)return!0;n+=this.ranges[t+o]-l}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let o=this.ranges[r],s=o-(this.inverted?i:0),l=o+(this.inverted?0:i),a=this.ranges[r+t],c=this.ranges[r+n];e(s,s+a,l,l+c),i+=c-a}}invert(){return new ey(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?ey.empty:new ey(e<0?[0,-e,0]:[0,0,e])}}ey.empty=new ey([]);class ex{constructor(e,t,n=0,r=e?e.length:0){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new ex(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new ex;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let i=this._maps[n].mapResult(e,t);if(null!=i.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new eg(e,r,null)}}let ev=Object.create(null);class eb{getMap(){return ey.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw RangeError("Invalid input for Step.fromJSON");let n=ev[t.stepType];if(!n)throw RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in ev)throw RangeError("Duplicate use of step JSON ID "+e);return ev[e]=t,t.prototype.jsonID=e,t}}class ew{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ew(e,null)}static fail(e){return new ew(null,e)}static fromReplace(e,t,n,r){try{return ew.ok(e.replace(t,n,r))}catch(e){if(e instanceof M)return ew.fail(e.message);throw e}}}function ek(e,t,n){let r=[];for(let i=0;i<e.childCount;i++){let o=e.child(i);o.content.size&&(o=o.copy(ek(o.content,t,o))),o.isInline&&(o=t(o,n,i)),r.push(o)}return b.fromArray(r)}class eS extends eb{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),i=new O(ek(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return ew.fromReplace(e,this.from,this.to,i)}invert(){return new eC(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new eS(t.pos,n.pos,this.mark)}merge(e){return e instanceof eS&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new eS(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for AddMarkStep.fromJSON");return new eS(t.from,t.to,e.markFromJSON(t.mark))}}eb.jsonID("addMark",eS);class eC extends eb{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}
vendor: 21,611 bytes, line 2
2apply(e){let t=e.slice(this.from,this.to),n=new O(ek(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return ew.fromReplace(e,this.from,this.to,n)}invert(){return new eS(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new eC(t.pos,n.pos,this.mark)}merge(e){return e instanceof eC&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new eC(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for RemoveMarkStep.fromJSON");return new eC(t.from,t.to,e.markFromJSON(t.mark))}}eb.jsonID("removeMark",eC);class eM extends eb{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ew.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ew.fromReplace(e,this.pos,this.pos+1,new O(b.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new eM(this.pos,t.marks[n]);return new eM(this.pos,this.mark)}}return new eO(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new eM(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new eM(t.pos,e.markFromJSON(t.mark))}}eb.jsonID("addNodeMark",eM);class eO extends eb{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ew.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ew.fromReplace(e,this.pos,this.pos+1,new O(b.from(n),0,+!t.isLeaf))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new eM(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new eO(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new eO(t.pos,e.markFromJSON(t.mark))}}eb.jsonID("removeNodeMark",eO);class eT extends eb{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&eE(e,this.from,this.to)?ew.fail("Structure replace would overwrite content"):ew.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ey([this.from,this.to-this.from,this.slice.size])}invert(e){return new eT(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&eT.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new eT(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof eT)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart)if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;else{let t=this.slice.size+e.slice.size==0?O.empty:new O(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new eT(e.from,this.to,t,this.structure)}{let t=this.slice.size+e.slice.size==0?O.empty:new O(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new eT(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw RangeError("Invalid input for ReplaceStep.fromJSON");return new eT(t.from,t.to,O.fromJSON(e,t.slice),!!t.structure)}}eT.MAP_BIAS=1,eb.jsonID("replace",eT);class eN extends eb{constructor(e,t,n,r,i,o,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=i,this.insert=o,this.structure=s}apply(e){if(this.structure&&(eE(e,this.from,this.gapFrom)||eE(e,this.gapTo,this.to)))return ew.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ew.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?ew.fromReplace(e,this.from,this.to,n):ew.fail("Content does not fit in gap")}getMap(){return new ey([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new eN(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||i>n.pos?null:new eN(t.pos,n.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new eN(t.from,t.to,t.gapFrom,t.gapTo,O.fromJSON(e,t.slice),t.insert,!!t.structure)}}function eE(e,t,n){let r=e.resolve(t),i=n-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let e=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,i--}}return!1}function e_(e,t,n,r=n.contentMatch,i=!0){let o=e.doc.nodeAt(t),s=[],l=t+1;for(let t=0;t<o.childCount;t++){let a=o.child(t),c=l+a.nodeSize,d=r.matchType(a.type);if(d){r=d;for(let t=0;t<a.marks.length;t++)n.allowsMarkType(a.marks[t].type)||e.step(new eC(l,c,a.marks[t]));if(i&&a.isText&&"pre"!=n.whitespace){let e,t=/\r?\n|\r/g,r;for(;e=t.exec(a.text);)r||(r=new O(b.from(n.schema.text(" ",n.allowedMarks(a.marks))),0,0)),s.push(new eT(l+e.index,l+e.index+e[0].length,r))}}else s.push(new eT(l,c,O.empty));l=c}if(!r.validEnd){let t=r.fillBefore(b.empty,!0);e.replace(l,l,new O(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function eD(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,i=0;;--n){let o=e.$from.node(n),s=e.$from.index(n)+r,l=e.$to.indexAfter(n)-i;if(n<e.depth&&o.canReplace(s,l,t))return n;if(0==n||o.type.spec.isolating||!((0==s||o.canReplace(s,o.childCount))&&(l==o.childCount||o.canReplace(0,l))))break;s&&(r=1),l<o.childCount&&(i=1)}return null}function eA(e,t,n=null,r=e){let i=function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return n.canReplaceWith(r,i,s)?o:null}(e,t),o=i&&function(e,t){let{parent:n,startIndex:r,endIndex:i}=e,o=n.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;l&&e<i;e++)l=l.matchType(n.child(e).type);return l&&l.validEnd?s:null}(r,t);return o?i.map(ej).concat({type:t,attrs:n}).concat(o.map(ej)):null}function ej(e){return{type:e,attrs:null}}function eR(e,t,n,r){t.forEach((i,o)=>{if(i.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(i.text);){let i=e.mapping.slice(r).map(n+1+o+s.index);e.replaceWith(i,i+1,t.type.schema.linebreakReplacement.create())}}})}function eI(e,t,n,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let i=e.mapping.slice(r).map(n+1+o);e.replaceWith(i,i+1,t.type.schema.text("\n"))}})}function eP(e,t,n=1,r){let i=e.resolve(t),o=i.depth-n,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let e=i.depth-1,t=n-2;e>o;e--,t--){let n=i.node(e),o=i.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(o,n.childCount),l=r&&r[t+1];l&&(s=s.replaceChild(0,l.type.create(l.attrs)));let a=r&&r[t]||n;if(!n.canReplace(o+1,n.childCount)||!a.type.validContent(s))return!1}let l=i.indexAfter(o),a=r&&r[0];return i.node(o).canReplaceWith(l,l,a?a.type:i.node(o+1).type)}function ez(e,t){let n=e.resolve(t),r=n.index();return e$(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function e$(e,t){return!!(e&&t&&!e.isLeaf&&function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),s=o.type==r?e.type.schema.nodes.text:o.type;if(!(n=n.matchType(s))||!e.type.allowsMarks(o.marks))return!1}return n.validEnd}(e,t))}function eF(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let i,o,s=r.index(e);if(e==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(e+1),s++,o=r.node(e).maybeChild(s)):(i=r.node(e).maybeChild(s-1),o=r.node(e+1)),i&&!i.isTextblock&&e$(i,o)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function eB(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let i=n.content;for(let e=0;e<n.openStart;e++)i=i.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,o=r.index(t)+ +(n>0),s=r.node(t),l=!1;if(1==e)l=s.canReplace(o,o,i);else{let e=s.contentMatchAt(o).findWrapping(i.firstChild.type);l=e&&s.canReplaceWith(o,o,e[0])}if(l)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function eV(e,t,n=t,r=O.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),o=e.resolve(n);return eL(i,o,r)?new eT(t,n,r):new eq(i,o,r).fit()}function eL(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}eb.jsonID("replaceAround",eN);class eq{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=b.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=b.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let i=this.placed,o=n.depth,s=r.depth;for(;o&&s&&1==i.childCount;)i=i.firstChild.content,o--,s--;let l=new O(i,o,s);return e>-1?new eN(n.pos,e,this.$to.pos,this.$to.end(),l,t):l.size||n.pos!=this.$to.pos?new eT(n.pos,r.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=n){e=n;break}t=i.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e=null,r=(n?(e=eH(this.unplaced.content,n-1).firstChild).content:this.unplaced.content).firstChild;for(let i=this.depth;i>=0;i--){let{type:o,match:s}=this.frontier[i],l,a=null;if(1==t&&(r?s.matchType(r.type)||(a=s.fillBefore(b.from(r),!1)):e&&o.compatibleContent(e.type)))return{sliceDepth:n,frontierDepth:i,parent:e,inject:a};if(2==t&&r&&(l=s.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:i,parent:e,wrap:l};if(e&&s.matchType(e.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=eH(e,t);return!!r.childCount&&!r.firstChild.isLeaf&&(this.unplaced=new O(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=eH(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new O(eW(e,t-1,1),t-1,i?t-1:n)}else this.unplaced=new O(eW(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let e=0;e<i.length;e++)this.openFrontierNode(i[e]);let o=this.unplaced,s=n?n.content:o.content,l=o.openStart-e,a=0,c=[],{match:d,type:h}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)c.push(r.child(e));d=d.matchFragment(r)}let u=s.size+e-(o.content.size-o.openEnd);for(;a<s.childCount;){let e=s.child(a),t=d.matchType(e.type);if(!t)break;(++a>1||0==l||e.content.size)&&(d=t,c.push(function e(t,n,r){if(n<=0)return t;let i=t.content;return n>1&&(i=i.replaceChild(0,e(i.firstChild,n-1,1==i.childCount?r-1:0))),n>0&&(i=t.type.contentMatch.fillBefore(i).append(i),r<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(b.empty,!0)))),t.copy(i)}(e.mark(h.allowedMarks(e.marks)),1==a?l:0,a==s.childCount?u:-1)))}let p=a==s.childCount;p||(u=-1),this.placed=eU(this.placed,t,b.from(c)),this.frontier[t].match=d,p&&u<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<u;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=p?0==e?O.empty:new O(eW(o.content,e-1,1),e-1,u<0?o.openEnd:e-1):new O(eW(o.content,e,a),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return -1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!eJ(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return -1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){t:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=eJ(e,t,r,n,i);if(o){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],i=eJ(e,n,r,t,!0);if(!i||i.childCount)continue t}return{depth:t,fit:o,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=eU(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=eU(this.placed,this.depth,b.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(b.empty,!0);e.childCount&&(this.placed=eU(this.placed,this.frontier.length,e))}}function eW(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(eW(e.firstChild.content,t-1,n)))}function eU(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(eU(e.lastChild.content,t-1,n)))}function eH(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function eJ(e,t,n,r,i){let o=e.node(t),s=i?e.indexAfter(t):e.index(t);if(s==o.childCount&&!n.compatibleContent(o.type))return null;let l=r.fillBefore(o.content,!0,s);return l&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,o.content,s)?l:null}function eK(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let r=e.start(i);if(r<e.pos-(e.depth-i)||t.end(i)>t.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(r==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==r-1)&&n.push(i)}return n}class eZ extends eb{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return ew.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return ew.fromReplace(e,this.pos,this.pos+1,new O(b.from(r),0,+!t.isLeaf))}getMap(){return ey.empty}invert(e){return new eZ(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new eZ(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw RangeError("Invalid input for AttrStep.fromJSON");return new eZ(t.pos,t.attr,t.value)}}eb.jsonID("attr",eZ);class eG extends eb{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return ew.ok(n)}getMap(){return ey.empty}invert(e){return new eG(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw RangeError("Invalid input for DocAttrStep.fromJSON");return new eG(t.attr,t.value)}}eb.jsonID("docAttr",eG);let eY=class extends Error{};(eY=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n}).prototype=Object.create(Error.prototype),eY.prototype.constructor=eY,eY.prototype.name="TransformError";class eX{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ex}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new eY(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,i,o)=>{e=Math.min(e,i),t=Math.max(t,o)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=O.empty){let r=eV(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new O(b.from(n),0,0))}delete(e,t){return this.replace(e,t,O.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return!function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let i=e.doc.resolve(t),o=e.doc.resolve(n);if(eL(i,o,r))return e.step(new eT(t,n,r));let s=eK(i,o);0==s[s.length-1]&&s.pop();let l=-(i.depth+1);s.unshift(l);for(let e=i.depth,t=i.pos-1;e>0;e--,t--){let n=i.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?l=e:i.before(e)==t&&s.splice(1,0,-e)}let a=s.indexOf(l),c=[],d=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){var h;let t=c[e],n=(h=t.type).spec.defining||h.spec.definingForContent;if(n&&!t.sameMarkup(i.node(Math.abs(l)-1)))d=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let l=(t+d+1)%(r.openStart+1),h=c[l];if(h)for(let t=0;t<s.length;t++){let c=s[(t+a)%s.length],d=!0;c<0&&(d=!1,c=-c);let u=i.node(c-1),p=i.index(c-1);if(u.canReplaceWith(p,p,h.type,h.marks))return e.replace(i.before(c),d?o.after(c):n,new O(function e(t,n,r,i,o){if(n<r){let o=t.firstChild;t=t.replaceChild(0,o.copy(e(o.content,n+1,r,i,o)))}if(n>i){let e=o.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(b.empty,!0))}return t}(r.content,0,r.openStart,l),l,r.openEnd))}}let u=e.steps.length;for(let l=s.length-1;l>=0&&(e.replace(t,n,r),!(e.steps.length>u));l--){let e=s[l];e<0||(t=i.before(e),n=o.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){var r=e,i=t;if(!n.isInline&&r==i&&this.doc.resolve(r).parent.content.size){let e=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)break}return null}(this.doc,r,n.type);null!=e&&(r=i=e)}return this.replaceRange(r,i,new O(b.from(n),0,0)),this}deleteRange(e,t){return!function(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&0==r.parentOffset&&0==i.parentOffset){let o=r.sharedDepth(n),s=!1;for(let e=r.depth;e>o;e--)r.node(e).type.spec.isolating&&(s=!0);for(let e=i.depth;e>o;e--)i.node(e).type.spec.isolating&&(s=!0);if(!s){for(let e=r.depth;e>0&&t==r.start(e);e--)t=r.before(e);for(let e=i.depth;e>0&&n==i.start(e);e--)n=i.before(e);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let o=eK(r,i);for(let t=0;t<o.length;t++){let n=o[t],s=t==o.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),i.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),i.indexAfter(n-1))))return e.delete(r.before(n),i.after(n))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return!function(e,t,n){let{$from:r,$to:i,depth:o}=t,s=r.before(o+1),l=i.after(o+1),a=s,c=l,d=b.empty,h=0;for(let e=o,t=!1;e>n;e--)t||r.index(e)>
20?(t=!0,d=b.from(r.node(e).copy(d)),h++):a--;let u=b.empty,p=0;for(let e=o,t=!1;e>n;e--)t||i.after(e+1)<i.end(e)?(t=!0,u=b.from(i.node(e).copy(u)),p++):c++;e.step(new eN(a,c,s,l,new O(d.append(u),h,p),d.size-h,!0))}(this,e,t),this}join(e,t=1){return!function(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,o=e.doc.resolve(t-n),s=o.node().type;if(i&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(i);e&&!t?r=!1:!e&&t&&(r=!0)}let l=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);eI(e,r.node(),r.before(),l)}s.inlineContent&&e_(e,t+n-1,s,o.node().contentMatchAt(o.index()),null==r);let a=e.mapping.slice(l),c=a.map(t-n);if(e.step(new eT(c,a.map(t+n,-1),O.empty,!0)),!0===r){let t=e.doc.resolve(c);eR(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return!function(e,t,n){let r=b.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=b.from(n[e].type.create(n[e].attrs,r))}let i=t.start,o=t.end;e.step(new eN(i,o,i,o,new O(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){var i=this;if(!n.isTextblock)throw RangeError("Type given to setBlockType should be a textblock");let o=i.steps.length;return i.doc.nodesBetween(e,t,(e,t)=>{var s,l,a;let c,d,h="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(n,h)&&(s=i.doc,l=i.mapping.slice(o).map(t),a=n,d=(c=s.resolve(l)).index(),c.parent.canReplaceWith(d,d+1,a))){let r=null;if(n.schema.linebreakReplacement){let e="pre"==n.whitespace,t=!!n.contentMatch.matchType(n.schema.linebreakReplacement);e&&!t?r=!1:!e&&t&&(r=!0)}!1===r&&eI(i,e,t,o),e_(i,i.mapping.slice(o).map(t,1),n,void 0,null===r);let s=i.mapping.slice(o),l=s.map(t,1),a=s.map(t+e.nodeSize,1);return i.step(new eN(l,a,l+1,a-1,new O(b.from(n.create(h,null,e.marks)),0,0),1,!0)),!0===r&&eR(i,e,t,o),!1}}),this}setNodeMarkup(e,t,n=null,r){return!function(e,t,n,r,i){let o=e.doc.nodeAt(t);if(!o)throw RangeError("No node at given position");n||(n=o.type);let s=n.create(r,null,i||o.marks);if(o.isLeaf)return e.replaceWith(t,t+o.nodeSize,s);if(!n.validContent(o.content))throw RangeError("Invalid content for node type "+n.name);e.step(new eN(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new O(b.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new eZ(e,t,n)),this}setDocAttribute(e,t){return this.step(new eG(e,t)),this}addNodeMark(e,t){return this.step(new eM(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw RangeError("No node at position "+e);if(t instanceof C)t.isInSet(n.marks)&&this.step(new eO(e,t));else{let r=n.marks,i,o=[];for(;i=t.isInSet(r);)o.push(new eO(e,i)),r=i.removeFromSet(r);for(let e=o.length-1;e>=0;e--)this.step(o[e])}return this}split(e,t=1,n){return!function(e,t,n=1,r){let i=e.doc.resolve(t),o=b.empty,s=b.empty;for(let e=i.depth,t=i.depth-n,l=n-1;e>t;e--,l--){o=b.from(i.node(e).copy(o));let t=r&&r[l];s=b.from(t?t.type.create(t.attrs,s):i.node(e).copy(s))}e.step(new eT(t,t,new O(o.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){var r;let i,o,s,l;return r=this,s=[],l=[],r.doc.nodesBetween(e,t,(r,a,c)=>{if(!r.isInline)return;let d=r.marks;if(!n.isInSet(d)&&c.type.allowsMarkType(n.type)){let c=Math.max(a,e),h=Math.min(a+r.nodeSize,t),u=n.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(u)||(i&&i.to==c&&i.mark.eq(d[e])?i.to=h:s.push(i=new eC(c,h,d[e])));o&&o.to==c?o.to=h:l.push(o=new eS(c,h,n))}}),s.forEach(e=>r.step(e)),l.forEach(e=>r.step(e)),this}removeMark(e,t,n){var r;let i,o;return r=this,i=[],o=0,r.doc.nodesBetween(e,t,(r,s)=>{if(!r.isInline)return;o++;let l=null;if(n instanceof Q){let e=r.marks,t;for(;t=n.isInSet(e);)(l||(l=[])).push(t),e=t.removeFromSet(e)}else n?n.isInSet(r.marks)&&(l=[n]):l=r.marks;if(l&&l.length){let n=Math.min(s+r.nodeSize,t);for(let t=0;t<l.length;t++){let r=l[t],a;for(let e=0;e<i.length;e++){let t=i[e];t.step==o-1&&r.eq(i[e].style)&&(a=t)}a?(a.to=n,a.step=o):i.push({style:r,from:Math.max(s,e),to:n,step:o})}}}
vendor: 7,888 bytes, line 2
2),i.forEach(e=>r.step(new eC(e.from,e.to,e.style))),this}clearIncompatible(e,t,n){return e_(this,e,t,n),this}}let eQ=Object.create(null);class e0{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new e1(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=O.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let i=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:l,$to:a}=o[s],c=e.mapping.slice(i);e.replaceRange(c.map(l.pos),c.map(a.pos),s?O.empty:t),0==s&&tt(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:o,$to:s}=r[i],l=e.mapping.slice(n),a=l.map(o.pos),c=l.map(s.pos);i?e.deleteRange(a,c):(e.replaceRangeWith(a,c,t),tt(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new e5(e):te(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let i=t<0?te(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):te(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new e6(e.node(0))}static atStart(e){return te(e,e,0,0,1)||new e6(e)}static atEnd(e){return te(e,e,e.content.size,e.childCount,-1)||new e6(e)}static fromJSON(e,t){if(!t||!t.type)throw RangeError("Invalid input for Selection.fromJSON");let n=eQ[t.type];if(!n)throw RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in eQ)throw RangeError("Duplicate use of selection JSON ID "+e);return eQ[e]=t,t.prototype.jsonID=e,t}getBookmark(){return e5.between(this.$anchor,this.$head).getBookmark()}}e0.prototype.visible=!0;class e1{constructor(e,t){this.$from=e,this.$to=t}}let e2=!1;function e3(e){e2||e.parent.inlineContent||(e2=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class e5 extends e0{constructor(e,t=e){e3(e),e3(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return e0.near(n);let r=e.resolve(t.map(this.anchor));return new e5(r.parent.inlineContent?r:n,n)}replace(e,t=O.empty){if(super.replace(e,t),t==O.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof e5&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new e4(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw RangeError("Invalid input for TextSelection.fromJSON");return new e5(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if((!n||r)&&(n=r>=0?1:-1),!t.parent.inlineContent){let e=e0.findFrom(t,n,!0)||e0.findFrom(t,-n,!0);if(!e)return e0.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r?e=t:(e=(e0.findFrom(e,-n,!0)||e0.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0&&(e=t)),new e5(e,t)}}e0.jsonID("text",e5);class e4{constructor(e,t){this.anchor=e,this.head=t}map(e){return new e4(e.map(this.anchor),e.map(this.head))}resolve(e){return e5.between(e.resolve(this.anchor),e.resolve(this.head))}}class e9 extends e0{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return n?e0.near(i):new e9(i)}content(){return new O(b.from(this.node),0,0)}eq(e){return e instanceof e9&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new e8(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw RangeError("Invalid input for NodeSelection.fromJSON");return new e9(e.resolve(t.anchor))}static create(e,t){return new e9(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}e9.prototype.visible=!1,e0.jsonID("node",e9);class e8{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new e4(n,n):new e8(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&e9.isSelectable(n)?new e9(t):e0.near(t)}}class e6 extends e0{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=O.empty){if(t==O.empty){e.delete(0,e.doc.content.size);let t=e0.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new e6(e)}map(e){return new e6(e)}eq(e){return e instanceof e6}getBookmark(){return e7}}e0.jsonID("all",e6);let e7={map(){return this},resolve:e=>new e6(e)};function te(e,t,n,r,i,o=!1){if(t.inlineContent)return e5.create(e,n);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let r=t.child(s);if(r.isAtom){if(!o&&e9.isSelectable(r))return e9.create(e,n-(i<0?r.nodeSize:0))}else{let t=te(e,r,n+i,i<0?r.childCount:0,i,o);if(t)return t}n+=r.nodeSize*i}return null}function tt(e,t,n){let r,i=e.steps.length-1;if(i<t)return;let o=e.steps[i];(o instanceof eT||o instanceof eN)&&(e.mapping.maps[i].forEach((e,t,n,i)=>{null==r&&(r=i)}),e.setSelection(e0.near(e.doc.resolve(r),n)))}class tn extends eX{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(1|this.updated)&-3,this.storedMarks=null,this}get selectionSet(){return(1&this.updated)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=2,this}ensureMarks(e){return C.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(e,t){super.addStep(e,t),this.updated=-3&this.updated,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||C.none))),n.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,n){let r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(null==n&&(n=t),!e)return this.deleteRange(t,n);let i=this.storedMarks;if(!i){let e=this.doc.resolve(t);i=n==t?e.marks():e.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,i)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(e0.near(this.selection.$to)),this}}setMeta(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}getMeta(e){return this.meta["string"==typeof e?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function tr(e,t){return t&&e?e.bind(t):e}
2class ti{constructor(e,t,n){this.name=e,this.init=tr(t.init,n),this.apply=tr(t.apply,n)}}let to=[new ti("doc",{init:e=>e.doc||e.schema.topNodeType.createAndFill(),apply:e=>e.doc}),new ti("selection",{init:(e,t)=>e.selection||e0.atStart(t.doc),apply:e=>e.selection}),new ti("storedMarks",{init:e=>e.storedMarks||null,apply:(e,t,n,r)=>r.selection.$cursor?e.storedMarks:null}),new ti("scrollToSelection",{init:()=>0,apply:(e,t)=>e.scrolledIntoView?t+1:t})];class ts{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=to.slice(),t&&t.forEach(e=>{if(this.pluginsByKey[e.key])throw RangeError("Adding different instances of a keyed plugin ("+e.key+")");this.plugins.push(e),this.pluginsByKey[e.key]=e,e.spec.state&&this.fields.push(new ti(e.key,e.spec.state,e))})}}class tl{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let n=0;n<this.config.plugins.length;n++)if(n!=t){let t=this.config.plugins[n];if(t.spec.filterTransaction&&!t.spec.filterTransaction.call(t,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],n=this.applyInner(e),r=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let s=this.config.plugins[o];if(s.spec.appendTransaction){let l=r?r[o].n:0,a=r?r[o].state:this,c=l<t.length&&s.spec.appendTransaction.call(s,l?t.slice(l):t,a,n);if(c&&n.filterTransaction(c,o)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(let e=0;e<this.config.plugins.length;e++)r.push(e<o?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),i=!0}r&&(r[o]={state:n,n:t.length})}}if(!i)return{state:n,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw RangeError("Applying a mismatched transaction");let t=new tl(this.config),n=this.config.fields;for(let r=0;r<n.length;r++){let i=n[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new tn(this)}static create(e){let t=new ts(e.doc?e.doc.type.schema:e.schema,e.plugins),n=new tl(t);for(let r=0;r<t.fields.length;r++)n[t.fields[r].name]=t.fields[r].init(e,n);return n}reconfigure(e){let t=new ts(this.schema,e.plugins),n=t.fields,r=new tl(t);for(let t=0;t<n.length;t++){let i=n[t].name;r[i]=this.hasOwnProperty(i)?this[i]:n[t].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(e=>e.toJSON())),e&&"object"==typeof e)for(let n in e){if("doc"==n||"selection"==n)throw RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[n],i=r.spec.state;i&&i.toJSON&&(t[n]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,n){if(!t)throw RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw RangeError("Required config field 'schema' missing");let r=new ts(e.schema,e.plugins),i=new tl(r);return r.fields.forEach(r=>{if("doc"==r.name)i.doc=F.fromJSON(e.schema,t.doc);else if("selection"==r.name)i.selection=e0.fromJSON(i.doc,t.selection);else if("storedMarks"==r.name)t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(n)for(let o in n){let s=n[o],l=s.spec.state;if(s.key==r.name&&l&&l.fromJSON&&Object.prototype.hasOwnProperty.call(t,o)){i[r.name]=l.fromJSON.call(s,e,t[o],i);return}}i[r.name]=r.init(e,i)}}),i}}class ta{constructor(e){this.spec=e,this.props={},e.props&&function e(t,n,r){for(let i in t){let o=t[i];o instanceof Function?o=o.bind(n):"handleDOMEvents"==i&&(o=e(o,n,{})),r[i]=o}return r}(e.props,this,this.props),this.key=e.key?e.key.key:td("plugin")}getState(e){return e[this.key]}}let tc=Object.create(null);function td(e){return e in tc?e+"$"+ ++tc[e]:(tc[e]=0,e+"$")}class th{constructor(e="key"){this.key=td(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}let tu=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function tp(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("backward",e):!(n.parentOffset>0))?n:null}let tf=(e,t,n)=>{let r=tp(e,n);if(!r)return!1;let i=tx(r);if(!i){let n=r.blockRange(),i=n&&eD(n);return null!=i&&(t&&t(e.tr.lift(n,i).scrollIntoView()),!0)}let o=i.nodeBefore;if(tN(e,i,t,-1))return!0;
2if(0==r.parent.content.size&&(tg(o,"end")||e9.isSelectable(o)))for(let n=r.depth;;n--){let s=eV(e.doc,r.before(n),r.after(n),O.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(tg(o,"end")?e0.findFrom(n.doc.resolve(n.mapping.map(i.pos,-1)),-1):e9.create(n.doc,i.pos-o.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0)};function tm(e,t,n){let r=t.nodeBefore,i=t.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let o=t.nodeAfter,s=t.pos+1;for(;!o.isTextblock;s++){if(o.type.spec.isolating)return!1;let e=o.firstChild;if(!e)return!1;o=e}let l=eV(e.doc,i,s,O.empty);if(!l||l.from!=i||l instanceof eT&&l.slice.size>=s-i)return!1;if(n){let t=e.tr.step(l);t.setSelection(e5.create(t.doc,i)),n(t.scrollIntoView())}return!0}function tg(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)break}return!1}let ty=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;o=tx(r)}let s=o&&o.nodeBefore;return!!s&&!!e9.isSelectable(s)&&(t&&t(e.tr.setSelection(e9.create(e.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function tx(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function tv(e,t){let{$cursor:n}=e.selection;return n&&(t?t.endOfTextblock("forward",e):!(n.parentOffset<n.parent.content.size))?n:null}let tb=(e,t,n)=>{let r=tv(e,n);if(!r)return!1;let i=tk(r);if(!i)return!1;let o=i.nodeAfter;if(tN(e,i,t,1))return!0;if(0==r.parent.content.size&&(tg(o,"start")||e9.isSelectable(o))){let n=eV(e.doc,r.before(),r.after(),O.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(tg(o,"start")?e0.findFrom(r.doc.resolve(r.mapping.map(i.pos)),1):e9.create(r.doc,r.mapping.map(i.pos))),t(r.scrollIntoView())}return!0}}return!!o.isAtom&&i.depth==r.depth-1&&(t&&t(e.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0)},tw=(e,t,n)=>{let{$head:r,empty:i}=e.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;o=tk(r)}let s=o&&o.nodeAfter;return!!s&&!!e9.isSelectable(s)&&(t&&t(e.tr.setSelection(e9.create(e.doc,o.pos)).scrollIntoView()),!0)};function tk(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}let tS=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!!n.parent.type.spec.code&&!!n.sameParent(r)&&(t&&t(e.tr.insertText("\n").scrollIntoView()),!0)};function tC(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}let tM=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),s=tC(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let r=n.after(),i=e.tr.replaceWith(r,r,s.createAndFill());i.setSelection(e0.near(i.doc.resolve(r),1)),t(i.scrollIntoView())}return!0},tO=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof e6||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=tC(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let n=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,s=e.tr.insert(n,o.createAndFill());s.setSelection(e5.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},tT=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(eP(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),i=r&&eD(r);return null!=i&&(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function tN(e,t,n,r){let i,o,s,l=t.nodeBefore,a=t.nodeAfter,c,d,h=l.type.spec.isolating||a.type.spec.isolating;if(!h&&(i=t.nodeBefore,o=t.nodeAfter,s=t.index(),i&&o&&i.type.compatibleContent(o.type)&&(!i.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-i.nodeSize,t.pos).scrollIntoView()),!0):!!t.parent.canReplace(s,s+1)&&!!(o.isTextblock||ez(e.doc,t.pos))&&(n&&n(e.tr.join(t.pos).scrollIntoView()),!0))))return!0;let u=!h&&t.parent.canReplace(t.index(),t.index()+1);if(u&&(c=(d=l.contentMatchAt(l.childCount)).findWrapping(a.type))&&d.matchType(c[0]||a.type).validEnd){if(n){let r=t.pos+a.nodeSize,i=b.empty;for(let e=c.length-1;e>=0;e--)i=b.from(c[e].create(null,i));i=b.from(l.copy(i));let o=e.tr.step(new eN(t.pos-1,r,t.pos,r,new O(i,1,0),c.length,!0)),s=o.doc.resolve(r+2*c.length);s.nodeAfter&&s.nodeAfter.type==l.type&&ez(o.doc,s.pos)&&o.join(s.pos),n(o.scrollIntoView())}return!0}let p=a.type.spec.isolating||r>0&&h?null:e0.findFrom(t,1),f=p&&p.$from.blockRange(p.$to),m=f&&eD(f);if(null!=m&&m>=t.depth)return n&&n(e.tr.lift(f,m).scrollIntoView()),!0;if(u&&tg(a,"start",!0)&&tg(l,"end")){let r=l,i=[];for(;i.push(r),!r.isTextblock;)r=r.lastChild;let o=a,s=1;for(;!o.isTextblock;o=o.firstChild)s++;if(r.canReplace(r.childCount,r.childCount,o.content)){if(n){let r=b.empty;for(let e=i.length-1;e>=0;e--)r=b.from(i[e].copy(r));n(e.tr.step(new eN(t.pos-i.length,t.pos+a.nodeSize,t.pos+s,t.pos+a.nodeSize-s,new O(r,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function tE(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return!!i.node(o).isTextblock&&(n&&n(t.tr.setSelection(e5.create(t.doc,e<0?i.start(o):i.end(o)))),!0)}}let t_=tE(-1),tD=tE(1);function tA(e,t=null){return function(n,r){let i=!1;for(let r=0;r<n.selection.ranges.length&&!i;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(o,s,(r,o)=>{if(i)return!1;if(!(!r.isTextblock||r.hasMarkup(e,t)))if(r.type==e)i=!0;else{let t=n.doc.resolve(o),r=t.index();i=t.parent.canReplaceWith(r,r+1,e)}})}if(!i)return!1;if(r){let i=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:o},$to:{pos:s}}=n.selection.ranges[r];i.setBlockType(o,s,e,t)}r(i.scrollIntoView())}return!0}}function tj(...e){return function(t,n,r){for(let i=0;i<e.length;i++)if(e[i](t,n,r))return!0;return!1}}let tR=tj(tu,tf,ty),tI=tj(tu,tb,tw),tP={Enter:tj(tS,tO,tT,(e,t)=>{if(e.selection instanceof e9&&e.selection.node.isBlock){let{$from:n}=e.selection;return!!n.parentOffset&&!!eP(e.doc,n.pos)&&(t&&t(e.tr.split(n.pos).scrollIntoView()),!0)}if(!e.selection.$from.depth)return!1;let n=e.tr;!e.selection.empty&&(e.selection instanceof e5||e.selection instanceof e6)&&n.deleteSelection();let{$from:r}=n.selection,i=n.steps.length,o=[],s,l,a=!1,c=!1;for(let e=r.depth;;e--){if(r.node(e).isBlock){let t;a=r.end(e)==r.pos+(r.depth-e),c=r.start(e)==r.pos-(r.depth-e),l=tC(r.node(e-1).contentMatchAt(r.indexAfter(e-1)));o.unshift(t||(a&&l?{type:l}:null)),s=e;break}if(1==e)return!1;o.unshift(null)}let d=r.pos,h=eP(n.doc,d,o.length,o);if(h||(o[0]=l?{type:l}:null,h=eP(n.doc,d,o.length,o)),!h)return!1;if(n.split(d,o.length,o),!a&&c&&r.node(s).type!=l){let e=n.mapping.slice(i),t=e.map(r.before(s)),o=n.doc.resolve(t);l&&r.node(s-1).canReplaceWith(o.index(),o.index()+1,l)&&n.setNodeMarkup(e.map(r.before(s)),l)}return t&&t(n.scrollIntoView()),!0}),"Mod-Enter":tM,Backspace:tR,"Mod-Backspace":tR,"Shift-Backspace":tR,Delete:tI,"Mod-Delete":tI,"Mod-a":(e,t)=>
2(t&&t(e.tr.setSelection(new e6(e.doc))),!0)},tz={"Ctrl-h":tP.Backspace,"Alt-Backspace":tP["Mod-Backspace"],"Ctrl-d":tP.Delete,"Ctrl-Alt-Backspace":tP["Mod-Delete"],"Alt-Delete":tP["Mod-Delete"],"Alt-d":tP["Mod-Delete"],"Ctrl-a":t_,"Ctrl-e":tD};for(let e in tP)tz[e]=tP[e];"u">typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"u">typeof os&&os.platform&&os.platform();let t$=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},tF=function(e){let t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},tB=null,tV=function(e,t,n){let r=tB||(tB=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},tL=function(){tB=null},tq=function(e,t,n,r){return n&&(tU(e,t,n,r,-1)||tU(e,t,n,r,1))},tW=/^(img|br|input|textarea|hr)$/i;function tU(e,t,n,r,i){for(var o;;){if(e==n&&t==r)return!0;if(t==(i<0?0:tH(e))){let n=e.parentNode;if(!n||1!=n.nodeType||tJ(e)||tW.test(e.nodeName)||"false"==e.contentEditable)return!1;t=t$(e)+(i<0?0:1),e=n}else{if(1!=e.nodeType)return!1;let n=e.childNodes[t+(i<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable)if(null==(o=n.pmViewDesc)||!o.ignoreForSelection)return!1;else t+=i;else e=n,t=i<0?tH(e):0}}}function tH(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function tJ(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}let tK=function(e){return e.focusNode&&tq(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function tZ(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}let tG="u">typeof navigator?navigator:null,tY="u">typeof document?document:null,tX=tG&&tG.userAgent||"",tQ=/Edge\/(\d+)/.exec(tX),t0=/MSIE \d/.exec(tX),t1=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(tX),t2=!!(t0||t1||tQ),t3=t0?document.documentMode:t1?+t1[1]:tQ?+tQ[1]:0,t5=!t2&&/gecko\/(\d+)/i.test(tX);t5&&(/Firefox\/(\d+)/.exec(tX)||[0,0])[1];let t4=!t2&&/Chrome\/(\d+)/.exec(tX),t9=!!t4,t8=t4?+t4[1]:0,t6=!t2&&!!tG&&/Apple Computer/.test(tG.vendor),t7=t6&&(/Mobile\/\w+/.test(tX)||!!tG&&tG.maxTouchPoints>2),ne=t7||!!tG&&/Mac/.test(tG.platform),nt=!!tG&&/Win/.test(tG.platform),nn=/Android \d/.test(tX),nr=!!tY&&"webkitFontSmoothing"in tY.documentElement.style,ni=nr?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function no(e,t){return"number"==typeof e?e:e[t]}function ns(e,t,n){if(!nh(t)&&0==t.left)return;let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let s=n||e.dom;s;){if(1!=s.nodeType){s=tF(s);continue}let e=s,n=e==o.body,l=n?function(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}(o):function(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}(e),a=0,c=0;if(t.top<l.top+no(r,"top")?c=-(l.top-t.top+no(i,"top")):t.bottom>l.bottom-no(r,"bottom")&&(c=t.bottom-t.top>l.bottom-l.top?t.top+no(i,"top")-l.top:t.bottom-l.bottom+no(i,"bottom")),t.left<l.left+no(r,"left")?a=-(l.left-t.left+no(i,"left")):t.right>l.right-no(r,"right")&&(a=t.right-l.right+no(i,"right")),a||c)if(n)o.defaultView.scrollBy(a,c);else{let n=e.scrollLeft,r=e.scrollTop;c&&(e.scrollTop+=c),a&&(e.scrollLeft+=a);let i=e.scrollLeft-n,o=e.scrollTop-r;t={left:t.left-i,top:t.top-o,right:t.right-i,bottom:t.bottom-o}}let d=n?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(d))break;s="absolute"==d?s.offsetParent:tF(s)}}function nl(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=tF(r));return t}function na(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:i,left:o}=e[n];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}let nc=null;
2function nd(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function nh(e){return e.top<e.bottom||e.left<e.right}function nu(e,t){let n=e.getClientRects();if(n.length){let e=n[t<0?0:n.length-1];if(nh(e))return e}return Array.prototype.find.call(n,nh)||e.getBoundingClientRect()}let np=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function nf(e,t,n){let{node:r,offset:i,atom:o}=e.docView.domFromPos(t,n<0?-1:1),s=nr||t5;if(3==r.nodeType)if(s&&(np.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let e=nu(tV(r,i,i),n);if(t5&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let t=nu(tV(r,i-1,i-1),-1);if(t.top==e.top){let n=nu(tV(r,i,i+1),-1);if(n.top!=e.top)return nm(n,n.left<t.left)}}return e}else{let e=i,t=i,o=n<0?1:-1;return n<0&&!i?(t++,o=-1):n>=0&&i==r.nodeValue.length?(e--,o=1):n<0?e--:t++,nm(nu(tV(r,e,t),o),o<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(null==o&&i&&(n<0||i==tH(r))){let e=r.childNodes[i-1];if(1==e.nodeType)return ng(e.getBoundingClientRect(),!1)}if(null==o&&i<tH(r)){let e=r.childNodes[i];if(1==e.nodeType)return ng(e.getBoundingClientRect(),!0)}return ng(r.getBoundingClientRect(),n>=0)}if(null==o&&i&&(n<0||i==tH(r))){let e=r.childNodes[i-1],t=3==e.nodeType?tV(e,tH(e)-!s):1!=e.nodeType||"BR"==e.nodeName&&e.nextSibling?null:e;if(t)return nm(nu(t,1),!1)}if(null==o&&i<tH(r)){let e=r.childNodes[i];for(;e.pmViewDesc&&e.pmViewDesc.ignoreForCoords;)e=e.nextSibling;let t=e?3==e.nodeType?tV(e,0,+!s):1==e.nodeType?e:null:null;if(t)return nm(nu(t,-1),!0)}return nm(nu(3==r.nodeType?tV(r):r,-n),n>=0)}function nm(e,t){if(0==e.width)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function ng(e,t){if(0==e.height)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function ny(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}let nx=/[\u0590-\u08ac]/,nv=null,nb=null,nw=!1;class nk{constructor(e,t,n,r){this.parent=e,this.children=t,this.dom=n,this.contentDOM=r,this.dirty=0,n.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,n){return!1}matchesHack(e){return!1}parseRule(e){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,n=this.posAtStart;;t++){let r=this.children[t];if(r==e)return n;n+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,n){let r;if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode))if(n<0){let n,r;if(e==this.contentDOM)n=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.previousSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.previousSibling;return n?this.posBeforeChild(r)+r.size:this.posAtStart}else{let n,r;if(e==this.contentDOM)n=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;n=e.nextSibling}for(;n&&!((r=n.pmViewDesc)&&r.parent==this);)n=n.nextSibling;return n?this.posBeforeChild(r):this.posAtEnd}if(e==this.dom&&this.contentDOM)r=t>t$(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!1;break}if(t.previousSibling)break}if(null==r&&t==e.childNodes.length)for(let t=e;;t=t.parentNode){if(t==this.dom){r=!0;break}if(t.nextSibling)break}}return(null==r?n>0:r)?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let n=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),o;if(i&&(!t||i.node))if(!n||!(o=i.nodeDOM)||(1==o.nodeType?o.contains(1==e.nodeType?e:e.parentNode):o==e))return i;else n=!1}}getDesc(e){let t=e.pmViewDesc;for(let e=t;e;e=e.parent)if(e==this)return t}posFromDOM(e,t,n){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,n)}return -1}descAt(e){for(let t=0,n=0;t<this.children.length;t++){let r=this.children[t],i=n+r.size;if(n==e&&i!=n){for(;!r.border&&r.children.length;)for(let e=0;e<r.children.length;e++){let t=r.children[e];if(t.size){r=t;break}}return r}if(e<i)return r.descAt(e-n-r.border);n=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let n=0,r=0;for(let t=0;n<this.children.length;n++){let i=this.children[n],o=t+i.size;if(o>
2e||i instanceof nE){r=e-t;break}t=o}if(r)return this.children[n].domFromPos(r-this.children[n].border,t);for(let e;n&&!(e=this.children[n-1]).size&&e instanceof nS&&e.side>=0;n--);if(t<=0){let e,r=!0;for(;(e=n?this.children[n-1]:null)&&e.dom.parentNode!=this.contentDOM;n--,r=!1);return e&&t&&r&&!e.border&&!e.domAtom?e.domFromPos(e.size,t):{node:this.contentDOM,offset:e?t$(e.dom)+1:0}}{let e,r=!0;for(;(e=n<this.children.length?this.children[n]:null)&&e.dom.parentNode!=this.contentDOM;n++,r=!1);return e&&r&&!e.border&&!e.domAtom?e.domFromPos(0,t):{node:this.contentDOM,offset:e?t$(e.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,n=0){if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let o=n,s=0;;s++){let n=this.children[s],l=o+n.size;if(-1==r&&e<=l){let i=o+n.border;if(e>=i&&t<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(e,t,i);e=o;for(let t=s;t>0;t--){let n=this.children[t-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){r=t$(n.dom)+1;break}e-=n.size}-1==r&&(r=0)}if(r>-1&&(l>t||s==this.children.length-1)){t=l;for(let e=s+1;e<this.children.length;e++){let n=this.children[e];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(-1)){i=t$(n.dom);break}t+=n.size}-1==i&&(i=this.contentDOM.childNodes.length);break}o=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:n}=this.domFromPos(e,0);if(1!=t.nodeType||n==t.childNodes.length)throw RangeError("No node after pos "+e);return t.childNodes[n]}setSelection(e,t,n,r=!1){let i=Math.min(e,t),o=Math.max(e,t);for(let s=0,l=0;s<this.children.length;s++){let a=this.children[s],c=l+a.size;if(i>l&&o<c)return a.setSelection(e-l-a.border,t-l-a.border,n,r);l=c}let s=this.domFromPos(e,e?-1:1),l=t==e?s:this.domFromPos(t,t?-1:1),a=n.root.getSelection(),c=n.domSelectionRange(),d=!1;if((t5||t6)&&e==t){let{node:e,offset:t}=s;if(3==e.nodeType){if((d=!!(t&&"\n"==e.nodeValue[t-1]))&&t==e.nodeValue.length)for(let t=e,n;t;t=t.parentNode){if(n=t.nextSibling){"BR"==n.nodeName&&(s=l={node:n.parentNode,offset:t$(n)+1});break}let e=t.pmViewDesc;if(e&&e.node&&e.node.isBlock)break}}else{let n=e.childNodes[t-1];d=n&&("BR"==n.nodeName||"false"==n.contentEditable)}}if(t5&&c.focusNode&&c.focusNode!=l.node&&1==c.focusNode.nodeType){let e=c.focusNode.childNodes[c.focusOffset];e&&"false"==e.contentEditable&&(r=!0)}if(!(r||d&&t6)&&tq(s.node,s.offset,c.anchorNode,c.anchorOffset)&&tq(l.node,l.offset,c.focusNode,c.focusOffset))return;let h=!1;if((a.extend||e==t)&&!(d&&t5)){a.collapse(s.node,s.offset);try{e!=t&&a.extend(l.node,l.offset),h=!0}catch(e){}}if(!h){if(e>t){let e=s;s=l,l=e}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(s.node,s.offset),a.removeAllRanges(),a.addRange(n)}}ignoreMutation(e){return!this.contentDOM&&"selection"!=e.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let n=0,r=0;r<this.children.length;r++){let i=this.children[r],o=n+i.size;if(n==o?e<=o&&t>=n:e<o&&t>n){let r=n+i.border,s=o-i.border;if(e>=r&&t<=s){this.dirty=e==n||t==o?2:1,e==r&&t==s&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=3:i.markDirty(e-r,t-r);return}i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=o}this.dirty=2}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class nS extends nk{constructor(e,t,n,r){let i,o=t.type.toDOM;if("function"==typeof o&&(o=o(n,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:r)),!t.type.spec.raw){if(1!=o.nodeType){let e=document.createElement("span");e.appendChild(o),o=e}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(e,[],o,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return 0==this.dirty&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return!!t&&t(e)}ignoreMutation(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class nC extends nk{constructor(e,t,n,r){super(e,[],t,null),this.textDOM=n,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}class nM extends nk{constructor(e,t,n,r,i){super(e,[],n,r),this.mark=t,this.spec=i}
vendor: 5,203 bytes, line 2
2static create(e,t,n,r){let i=r.nodeViews[t.type.name],o=i&&i(t,r,n);return o&&o.dom||(o=eh.renderSpec(document,t.type.spec.toDOM(t,n),null,t.attrs)),new nM(e,t,o.dom,o.contentDOM||o.dom,o)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return 3!=this.dirty&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),0!=this.dirty){let e=this.parent;for(;!e.node;)e=e.parent;e.dirty<this.dirty&&(e.dirty=this.dirty),this.dirty=0}}slice(e,t,n){let r=nM.create(this.parent,this.mark,!0,n),i=this.children,o=this.size;t<o&&(i=nB(i,t,o,n)),e>0&&(i=nB(i,0,e,n));for(let e=0;e<i.length;e++)i[e].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class nO extends nk{constructor(e,t,n,r,i,o,s){super(e,[],i,o),this.node=t,this.outerDeco=n,this.innerDeco=r,this.nodeDOM=s}static create(e,t,n,r,i,o){let s=i.nodeViews[t.type.name],l,a=s&&s(t,i,()=>l?l.parent?l.parent.posBeforeChild(l):void 0:o,n,r),c=a&&a.dom,d=a&&a.contentDOM;if(t.isText)if(c){if(3!=c.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else c=document.createTextNode(t.text);else if(!c){let e=eh.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);({dom:c,contentDOM:d}=e)}d||t.isText||"BR"==c.nodeName||(c.hasAttribute("contenteditable")||(c.contentEditable="false"),t.type.spec.draggable&&(c.draggable=!0));let h=c;return(c=nI(c,n,t),a)?l=new n_(e,t,n,r,c,d||null,h,a):t.isText?new nN(e,t,n,r,c,h):new nO(e,t,n,r,c,d||null,h)}parseRule(e){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}if(!t.contentElement){let n=e&&e.find(t=>1==t.nodeType&&0>e.indexOf(t.parentNode)&&this.dom.contains(t));n?t.contentElement=n:t.getContent=()=>b.empty}}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(e,t,n){return 0==this.dirty&&e.eq(this.node)&&nP(t,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(e,t){let n=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,o=i&&i.pos>-1?i:null,s=i&&i.pos<0,l=new n$(this,o&&o.node,e);(function(e,t,n,r){let i=t.locals(e),o=0;if(0==i.length){for(let n=0;n<e.childCount;n++){let s=e.child(n);r(s,i,t.forChild(o,s),n),o+=s.nodeSize}return}let s=0,l=[],a=null;for(let c=0;;){let d,h,u,p;for(;s<i.length&&i[s].to==o;){let e=i[s++];e.widget&&(d?(h||(h=[d])).push(e):d=e)}if(d)if(h){h.sort(nF);for(let e=0;e<h.length;e++)n(h[e],c,!!a)}else n(d,c,!!a);if(a)p=-1,u=a,a=null;else if(c<e.childCount)p=c,u=e.child(c++);else break;for(let e=0;e<l.length;e++)l[e].to<=o&&l.splice(e--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)l.push(i[s++]);let f=o+u.nodeSize;if(u.isText){let e=f;s<i.length&&i[s].from<e&&(e=i[s].from);for(let t=0;t<l.length;t++)l[t].to<e&&(e=l[t].to);e<f&&(a=u.cut(e-o),u=u.cut(0,e-o),f=e,p=-1)}else for(;s<i.length&&i[s].to<f;)s++;let m=u.isInline&&!u.isLeaf?l.filter(e=>!e.inline):l.slice();r(u,m,t.forChild(o,u),p),o=f}})(this.node,this.innerDeco,(t,i,o)=>{t.spec.marks?l.syncToMarks(t.spec.marks,n,e,i):t.type.side>=0&&!o&&l.syncToMarks(i==this.node.childCount?C.none:this.node.child(i).marks,n,e,i),l.placeWidget(t,e,r)},(t,o,a,c)=>{let d;l.syncToMarks(t.marks,n,e,c),l.findNodeMatch(t,o,a,c)||s&&e.state.selection.from>r&&e.state.selection.to<r+t.nodeSize&&(d=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(t,o,a,d,e)||l.updateNextNode(t,o,a,e,c,r)||l.addNode(t,o,a,e,r),r+=t.nodeSize}),l.syncToMarks([],n,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(o&&this.protectLocalComposition(e,o),function e(t,n,r){let i=t.firstChild,o=!1;for(let s=0;s<n.length;s++){let l=n[s],a=l.dom;if(a.parentNode==t){for(;a!=i;)i=nz(i),o=!0;i=i.nextSibling}else o=!0,t.insertBefore(a,i);if(l instanceof nM){let n=i?i.previousSibling:t.lastChild;e(l.contentDOM,l.children,r),i=n?n.nextSibling:t.firstChild}}for(;i;)i=nz(i),o=!0;o&&r.trackWrites==t&&(r.trackWrites=null)}(this.contentDOM,this.children,e),t7&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}localCompositionInfo(e,t){let{from:n,to:r}=e.state.selection;if(!(e.state.selection instanceof e5)||n<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(!this.node.inlineContent)return{node:i,pos:-1,text:""};{let e=i.nodeValue,o=function(e,t,n,r){for(let i=0,o=0;i<e.childCount&&o<=r;){let s=e.child(i++),l=o;if(o+=s.nodeSize,!s.isText)continue;let a=s.text;for(;i<e.childCount;){let t=e.child(i++);if(o+=t.nodeSize,!t.isText)break;a+=t.text}
2if(o>=n){if(o>=r&&a.slice(r-t.length-l,r-l)==t)return r-t.length;let e=l<r?a.lastIndexOf(t,r-l-1):-1;if(e>=0&&e+t.length+l>=n)return l+e;if(n==r&&a.length>=r+t.length-l&&a.slice(r-l,r-l+t.length)==t)return r}}return -1}(this.node.content,e,n-t,r-t);return o<0?null:{node:i,pos:o,text:e}}}protectLocalComposition(e,{node:t,pos:n,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new nC(this,i,t,r);e.input.compositionNodes.push(o),this.children=nB(this.children,n,n+r.length,e,o)}update(e,t,n,r){return 3!=this.dirty&&!!e.sameMarkup(this.node)&&(this.updateInner(e,t,n,r),!0)}updateInner(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}updateOuterDeco(e){if(nP(e,this.outerDeco))return;let t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=nR(this.dom,this.nodeDOM,nj(this.outerDeco,this.node,t),nj(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function nT(e,t,n,r,i){nI(r,t,e);let o=new nO(void 0,e,t,n,r,r,r);return o.contentDOM&&o.updateChildren(i,0),o}class nN extends nO{constructor(e,t,n,r,i,o){super(e,t,n,r,i,null,o)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,n,r){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!e.sameMarkup(this.node)&&(this.updateOuterDeco(t),(0!=this.dirty||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,n){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,n)}ignoreMutation(e){return"characterData"!=e.type&&"selection"!=e.type}slice(e,t,n){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new nN(this.parent,r,this.outerDeco,this.innerDeco,i,i)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(0==e||t==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(e){return this.node.text==e}}class nE extends nk{parseRule(){return{ignore:!0}}matchesHack(e){return 0==this.dirty&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class n_ extends nO{constructor(e,t,n,r,i,o,s,l){super(e,t,n,r,i,o,s),this.spec=l}update(e,t,n,r){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,n);return i&&this.updateInner(e,t,n,r),i}return(!!this.contentDOM||!!e.isLeaf)&&super.update(e,t,n,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,n,r){this.spec.setSelection?this.spec.setSelection(e,t,n.root):super.setSelection(e,t,n,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}let nD=function(e){e&&(this.nodeName=e)};nD.prototype=Object.create(null);let nA=[new nD];function nj(e,t,n){if(0==e.length)return nA;let r=n?nA[0]:new nD,i=[r];for(let o=0;o<e.length;o++){let s=e[o].type.attrs;if(s)for(let e in s.nodeName&&i.push(r=new nD(s.nodeName)),s){let o=s[e];null!=o&&(n&&1==i.length&&i.push(r=new nD(t.isInline?"span":"div")),"class"==e?r.class=(r.class?r.class+" ":"")+o:"style"==e?r.style=(r.style?r.style+";":"")+o:"nodeName"!=e&&(r[e]=o))}}return i}function nR(e,t,n,r){if(n==nA&&r==nA)return t;let i=t;for(let t=0;t<r.length;t++){let o=r[t],s=n[t];if(t){let t;s&&s.nodeName==o.nodeName&&i!=e&&(t=i.parentNode)&&t.nodeName.toLowerCase()==o.nodeName||((t=document.createElement(o.nodeName)).pmIsDeco=!0,t.appendChild(i),s=nA[0]),i=t}!function(e,t,n){for(let r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(let r in n)"class"!=r&&"style"!=r&&"nodeName"!=r&&n[r]!=t[r]&&e.setAttribute(r,n[r]);
2if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let t=0;t<r.length;t++)-1==i.indexOf(r[t])&&e.classList.remove(r[t]);for(let t=0;t<i.length;t++)-1==r.indexOf(i[t])&&e.classList.add(i[t]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let n=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=n.exec(t.style);)e.style.removeProperty(r[1])}n.style&&(e.style.cssText+=n.style)}}(i,s||nA[0],o)}return i}function nI(e,t,n){return nR(e,e,nA,nj(t,n,1!=e.nodeType))}function nP(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function nz(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class n${constructor(e,t,n){this.lock=t,this.view=n,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=function(e,t){let n=t,r=n.children.length,i=e.childCount,o=new Map,s=[];n:for(;i>0;){let l;for(;;)if(r){let e=n.children[r-1];if(e instanceof nM)n=e,r=e.children.length;else{l=e,r--;break}}else if(n==t)break n;else r=n.parent.children.indexOf(n),n=n.parent;let a=l.node;if(a){if(a!=e.child(i-1))break;--i,o.set(l,i),s.push(l)}}return{index:i,matched:o,matches:s.reverse()}}(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,n,r){let i=0,o=this.stack.length>>1,s=Math.min(o,e.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&!1!==e[i].type.spec.spanning;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let i=-1,s=this.top.children.length;r<this.preMatch.index&&(s=Math.min(this.index+3,s));for(let t=this.index;t<s;t++){let n=this.top.children[t];if(n.matchesMark(e[o])&&!this.isLocked(n.dom)){i=t;break}}if(i<0&&this.index<this.top.children.length){let t=this.top.children[this.index];t instanceof nM&&3!=t.dirty&&t.mark.type==e[o].type&&t.spec.update&&!this.isLocked(t.dom)&&t.spec.update(e[o])&&(t.mark=e[o],i=this.index,this.changed=!0)}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let r=nM.create(this.top,e[o],t,n);this.top.children.splice(this.index,0,r),this.top=r,this.changed=!0}this.index=0,o++}}findNodeMatch(e,t,n,r){let i=-1,o;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(let r=this.index,o=Math.min(this.top.children.length,r+5);r<o;r++){let o=this.top.children[r];if(o.matchesNode(e,t,n)&&!this.preMatch.matched.has(o)){i=r;break}}return!(i<0)&&(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,n,r,i){let o=this.top.children[r];return 3==o.dirty&&o.dom==o.contentDOM&&(o.dirty=2),!!o.update(e,t,n,i)&&(this.destroyBetween(this.index,r),this.index++,!0)}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return -1;if(t==this.top.contentDOM){let t=e.pmViewDesc;if(t){for(let e=this.index;e<this.top.children.length;e++)if(this.top.children[e]==t)return e}return -1}e=t}}updateNextNode(e,t,n,r,i,o){for(let s=this.index;s<this.top.children.length;s++){let l=this.top.children[s];if(l instanceof nO){let a=this.preMatch.matched.get(l);if(null!=a&&a!=i)return!1;let c=l.dom,d,h=this.isLocked(c)&&!(e.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==e.text&&3!=l.dirty&&nP(t,l.outerDeco));if(!h&&l.update(e,t,n,r))return this.destroyBetween(this.index,s),l.dom!=c&&(this.changed=!0),this.index++,!0;if(!h&&(d=this.recreateWrapper(l,e,t,n,r,o)))return this.destroyBetween(this.index,s),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=2,d.updateChildren(r,o+1),d.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,n,r,i,o){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!nP(n,e.outerDeco)||!r.eq(e.innerDeco))return null;let s=nO.create(this.top,t,n,r,i,o);if(s.contentDOM)for(let t of(s.children=e.children,e.children=[],s.children))t.parent=s;return e.destroy(),s}addNode(e,t,n,r,i){let o=nO.create(this.top,e,t,n,r,i);o.contentDOM&&o.updateChildren(r,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(e,t,n){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let r=new nS(this.top,e,t,n);this.top.children.splice(this.index++,0,r),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof nM;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof nN)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((t6||t9)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");let r=new nE(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}
2isLocked(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}function nF(e,t){return e.type.side-t.type.side}function nB(e,t,n,r,i){let o=[];for(let s=0,l=0;s<e.length;s++){let a=e[s],c=l,d=l+=a.size;c>=n||d<=t?o.push(a):(c<t&&o.push(a.slice(0,t-c,r)),i&&(o.push(i),i=void 0),d>n&&o.push(a.slice(n-c,a.size,r)))}return o}function nV(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),o=i&&0==i.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=r.resolve(s),a,c;if(tK(n)){for(a=s;i&&!i.node;)i=i.parent;let e=i.node;if(i&&e.isAtom&&e9.isSelectable(e)&&i.parent&&!(e.isInline&&function(e,t,n){for(let r=0==t,i=t==tH(e);r||i;){if(e==n)return!0;let t=t$(e);if(!(e=e.parentNode))return!1;r=r&&0==t,i=i&&t==tH(e)}}(n.focusNode,n.focusOffset,i.dom))){let e=i.posBefore;c=new e9(s==e?l:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,i=s;for(let r=0;r<n.rangeCount;r++){let o=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(o.startContainer,o.startOffset,1)),i=Math.max(i,e.docView.posFromDOM(o.endContainer,o.endOffset,-1))}if(t<0)return null;[a,s]=i==e.state.selection.anchor?[i,t]:[t,i],l=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);if(!c){let n="pointer"==t||e.state.selection.head<l.pos&&!o?1:-1;c=nG(e,d,l,n)}return c}function nL(e){return e.editable?e.hasFocus():nX(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function nq(e,t=!1){let n=e.state.selection;if(nK(e,n),!nL(e))return;let r=e.input.mouseDown;if(!t&&t9&&r){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&tq(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset)&&r.delaySelUpdate())return void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,t$(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&t2&&t3<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{var i;let r,o,s,l,{anchor:a,head:c}=n,d,h;nW&&!(n instanceof e5)&&(n.$from.parent.inlineContent||(d=nU(e,n.from)),n.empty||n.$from.parent.inlineContent||(h=nU(e,n.to))),e.docView.setSelection(a,c,e,t),nW&&(d&&nJ(d),h&&nJ(h)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((r=(i=e).dom.ownerDocument).removeEventListener("selectionchange",i.input.hideSelectionGuard),s=(o=i.domSelectionRange()).anchorNode,l=o.anchorOffset,r.addEventListener("selectionchange",i.input.hideSelectionGuard=()=>{(o.anchorNode!=s||o.anchorOffset!=l)&&(r.removeEventListener("selectionchange",i.input.hideSelectionGuard),setTimeout(()=>{(!nL(i)||i.state.selection.visible)&&i.dom.classList.remove("ProseMirror-hideselection")},20))})))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}let nW=t6||t9&&t8<63;function nU(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(t6&&i&&"false"==i.contentEditable)return nH(i);if((!i||"false"==i.contentEditable)&&(!o||"false"==o.contentEditable)){if(i)return nH(i);else if(o)return nH(o)}}function nH(e){return e.contentEditable="true",t6&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function nJ(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function nK(e,t){if(t instanceof e9){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(nZ(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else nZ(e)}function nZ(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function nG(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||e5.between(t,n,r)}function nY(e){return(!e.editable||!!e.hasFocus())&&nX(e)}function nX(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focu
2sNode.parentNode:t.focusNode))}catch(e){return!1}}function nQ(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return o&&e0.findFrom(o,t)}function n0(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function n1(e,t,n){let r=e.state.selection;if(r instanceof e5){if(n.indexOf("s")>-1){let{$head:n}=r,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=e.state.doc.resolve(n.pos+i.nodeSize*(t<0?-1:1));return n0(e,new e5(r.$anchor,o))}else if(!r.empty)return!1;else if(e.endOfTextblock(t>0?"forward":"backward")){let n=nQ(e.state,t);return!!n&&n instanceof e9&&n0(e,n)}else if(!(ne&&n.indexOf("m")>-1)){let n=r.$head,i=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter,o;if(!i||i.isText)return!1;let s=t<0?n.pos-i.nodeSize:n.pos;return!!(i.isAtom||(o=e.docView.descAt(s))&&!o.contentDOM)&&(e9.isSelectable(i)?n0(e,new e9(t<0?e.state.doc.resolve(n.pos-i.nodeSize):n)):!!nr&&n0(e,new e5(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}else{if(r instanceof e9&&r.node.isInline)return n0(e,new e5(t>0?r.$to:r.$from));let n=nQ(e.state,t);return!!n&&n0(e,n)}}function n2(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function n3(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function n5(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,o,s=!1;for(t5&&1==n.nodeType&&r<n2(n)&&n3(n.childNodes[r],-1)&&(s=!0);;)if(r>0)if(1!=n.nodeType)break;else{let e=n.childNodes[r-1];if(n3(e,-1))i=n,o=--r;else if(3==e.nodeType)r=(n=e).nodeValue.length;else break}else if(n4(n))break;else{let t=n.previousSibling;for(;t&&n3(t,-1);)i=n.parentNode,o=t$(t),t=t.previousSibling;if(t)r=n2(n=t);else{if((n=n.parentNode)==e.dom)break;r=0}}s?n9(e,n,r):i&&n9(e,i,o)}(e):function(e){let t,n,r=e.domSelectionRange(),i=r.focusNode,o=r.focusOffset;if(!i)return;let s=n2(i);for(;;)if(o<s){if(1!=i.nodeType)break;if(n3(i.childNodes[o],1))t=i,n=++o;else break}else if(n4(i))break;else{let r=i.nextSibling;for(;r&&n3(r,1);)t=r.parentNode,n=t$(r)+1,r=r.nextSibling;if(r)o=0,s=n2(i=r);else{if((i=i.parentNode)==e.dom)break;o=s=0}}t&&n9(e,t,n)}(e)}function n4(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function n9(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!tJ(e);)t=t$(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!tJ(e);)t=t$(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(tK(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:i}=e;setTimeout(()=>{e.state==i&&nq(e)},50)}function n8(e,t){let n=e.state.doc.resolve(t);if(!(t9||nt)&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),i=(n.top+n.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function n6(e,t,n){let r=e.state.selection;if(r instanceof e5&&!r.empty||n.indexOf("s")>-1||ne&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=nQ(e.state,t);if(n&&n instanceof e9)return n0(e,n)}if(!i.parent.inlineContent){let n=t<0?i:o,s=r instanceof e6?e0.near(n,t):e0.findFrom(n,t);return!!s&&n0(e,s)}return!1}function n7(e,t){if(!(e.state.selection instanceof e5))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let r=e.state.tr;return t<0?r.delete(n.pos-o.nodeSize,n.pos):r.delete(n.pos,n.pos+o.nodeSize),e.dispatch(r),!0}return!1}function re(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function rt(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&1==r.childCount&&1==r.firstChild.childCount;){i--,o--;let e=r.firstChild;
2n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||eh.fromSchema(e.state.schema),l=ra(),a=l.createElement("div");a.appendChild(s.serializeFragment(r,{document:l}));let c=a.firstChild,d,h=0;for(;c&&1==c.nodeType&&(d=rl[c.nodeName.toLowerCase()]);){for(let e=d.length-1;e>=0;e--){let t=l.createElement(d[e]);for(;a.firstChild;)t.appendChild(a.firstChild);a.appendChild(t),h++}c=a.firstChild}return c&&1==c.nodeType&&c.setAttribute("data-pm-slice",`${i} ${o}${h?` -${h}`:""} ${JSON.stringify(n)}`),{dom:a,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function rn(e,t,n,r,i){let o,s,l=i.parent.type.spec.code;if(!n&&!t)return null;let a=!!t&&(r||l||!n);if(a){if(e.someProp("transformPastedText",n=>{t=n(t,l||r,e)}),l)return s=new O(b.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,i,r,e));if(n)s=n;else{let n=i.marks(),{schema:r}=e.state,s=eh.fromSchema(r);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=o.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),o=function(e){var t;let n,r=/^(\s*<meta [^>]*>)*/.exec(e);r&&(e=e.slice(r[0].length));let i=ra(),o=i.body,s=/<([a-z][^>\s]+)/i.exec(e),l;if((l=s&&rl[s[1].toLowerCase()])&&(e=l.map(e=>"<"+e+">").join("")+e+l.map(e=>"</"+e+">").reverse().join("")),o.innerHTML=(t=e,(n=window.trustedTypes)?(rc||(rc=n.defaultPolicy||n.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),rc.createHTML(t)):t),l)for(let e=0;e<l.length;e++)o=o.querySelector(l[e])||o;for(let e=0;e<i.styleSheets.length;e++){let t=i.styleSheets[e];for(let e=0;e<t.rules.length;e++){let n=t.rules[e];if(n instanceof CSSStyleRule){let e=o.querySelectorAll(n.selectorText);for(let t=0;t<e.length;t++)e[t].style.cssText+=n.style.cssText}}}return o}(n),nr&&function(e){let t=e.querySelectorAll(t9?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&"Â "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(o);let c=o&&o.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let e=+d[3];e>0;e--){let e=o.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;o=e}if(s||(s=(e.someProp("clipboardParser")||e.someProp("domParser")||en.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(a||d),context:i,ruleFromNode:e=>"BR"!=e.nodeName||e.nextSibling||!e.parentNode||rr.test(e.parentNode.nodeName)?null:{ignore:!0}})),d)s=function(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch(t){return e}let{content:i,openStart:o,openEnd:s}=e;for(let e=r.length-2;e>=0;e-=2){let t=n.nodes[r[e]];if(!t||t.hasRequiredAttrs())break;i=b.from(t.create(r[e+1],i)),o++,s++}return new O(i,o,s)}(rs(s,+d[1],+d[2]),d[4]);else if((s=O.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.index(n)),i,o=[];if(e.forEach(e=>{if(!o)return;let t=r.findWrapping(e.type),n;if(!t)return o=null;if(n=o.length&&i.length&&function e(t,n,r,i,o){if(o<t.length&&o<n.length&&t[o]==n[o]){let s=e(t,n,r,i.lastChild,o+1);if(s)return i.copy(i.content.replaceChild(i.childCount-1,s));if(i.contentMatchAt(i.childCount).matchType(o==t.length-1?r.type:t[o+1]))return i.copy(i.content.append(b.from(ri(r,t,o+1))))}}(t,i,e,o[o.length-1],0))o[o.length-1]=n;else{o.length&&(o[o.length-1]=function e(t,n){if(0==n)return t;let r=t.content.replaceChild(t.childCount-1,e(t.lastChild,n-1)),i=t.contentMatchAt(t.childCount).fillBefore(b.empty,!0);return t.copy(r.append(i))}(o[o.length-1],i.length));let n=ri(e,t);o.push(n),r=r.matchType(n.type),i=t}}),o)return b.from(o)}return e}(s.content,i),!0)).openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=rs(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,a)}),s}let rr=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function ri(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,b.from(e));return e}
2function ro(e,t,n,r,i,o){let s=t<0?e.firstChild:e.lastChild,l=s.content;return e.childCount>1&&(o=0),i<r-1&&(l=ro(l,t,n,r,i+1,o)),i>=n&&(l=t<0?s.contentMatchAt(0).fillBefore(l,o<=i).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(b.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(l))}function rs(e,t,n){return t<e.openStart&&(e=new O(ro(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new O(ro(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}let rl={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};function ra(){return document.implementation.createHTMLDocument("title")}let rc=null,rd={},rh={},ru={touchstart:!0,touchmove:!0};class rp{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function rf(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function rm(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=t=>rg(e,t))})}function rg(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function ry(e){return{left:e.clientX,top:e.clientY}}function rx(e,t,n,r,i){if(-1==r)return!1;let o=e.state.doc.resolve(r);for(let r=o.depth+1;r>0;r--)if(e.someProp(t,t=>r>o.depth?t(e,n,o.nodeAfter,o.before(r),i,!0):t(e,n,o.node(r),o.before(r),i,!1)))return!0;return!1}function rv(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function rb(e,t,n){let r=e.state.doc;if(-1==t)return r.inlineContent?e5.create(r,0,r.content.size):null;let i=r.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e),o=i.before(e);if(t.inlineContent)return e5.create(r,o+1,o+1+t.content.size);if(n&&e9.isSelectable(t))return e9.create(r,o)}return null}rh.keydown=(e,t)=>{if((e.input.shiftKey=16==t.keyCode||t.shiftKey,!rM(e))&&(e.input.lastKeyCode=t.keyCode,e.input.lastKeyCodeTime=Date.now(),!nn||!t9||13!=t.keyCode))if(229!=t.keyCode&&e.domObserver.forceFlush(),!t7||13!=t.keyCode||t.ctrlKey||t.altKey||t.metaKey)e.someProp("handleKeyDown",n=>n(e,t))||function(e,t){let n,r=t.keyCode,i=(n="",t.ctrlKey&&(n+="c"),t.metaKey&&(n+="m"),t.altKey&&(n+="a"),t.shiftKey&&(n+="s"),n);if(8==r||ne&&72==r&&"c"==i)return n7(e,-1)||n5(e,-1);if(46==r&&!t.shiftKey||ne&&68==r&&"c"==i)return n7(e,1)||n5(e,1);if(13==r||27==r)return!0;if(37==r||ne&&66==r&&"c"==i){let t=37==r?"ltr"==n8(e,e.state.selection.from)?-1:1:-1;return n1(e,t,i)||n5(e,t)}if(39==r||ne&&70==r&&"c"==i){let t=39==r?"ltr"==n8(e,e.state.selection.from)?1:-1:1;return n1(e,t,i)||n5(e,t)}else if(38==r||ne&&80==r&&"c"==i)return n6(e,-1,i)||n5(e,-1);else if(40==r||ne&&78==r&&"c"==i)return function(e){if(!t6||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;re(e,n,"true"),setTimeout(()=>re(e,n,"false"),20)}return!1}(e)||n6(e,1,i)||n5(e,1);else if(i==(ne?"m":"c")&&(66==r||73==r||89==r||90==r))return!0;return!1}(e,t)?t.preventDefault():rf(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,tZ(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},rh.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},rh.keypress=(e,t)=>{if(rM(e)||!t.charCode||t.ctrlKey&&!t.altKey||ne&&t.metaKey)return;if(e.someProp("handleKeyPress",n=>n(e,t)))return void t.preventDefault();let n=e.state.selection;if(!(n instanceof e5)||!n.$from.sameParent(n.$to)){let r=String.fromCharCode(t.charCode),i=()=>e.state.tr.insertText(r).scrollIntoView();/[\r\n]/.test(r)||e.someProp("handleTextInput",t=>t(e,n.$from.pos,n.$to.pos,r,i))||e.dispatch(i()),t.preventDefault()}};let rw=ne?"metaKey":"ctrlKey";rd.mousedown=(e,t)=>{var n;let r,i;e.input.shiftKey=t.shiftKey;let o=rE(e),s=Date.now(),l="singleClick";
2s-e.input.lastClick.time<500&&(r=(n=e.input.lastClick).x-t.clientX)*r+(i=n.y-t.clientY)*i<100&&!t[rw]&&e.input.lastClick.button==t.button&&("singleClick"==e.input.lastClick.type?l="doubleClick":"doubleClick"==e.input.lastClick.type&&(l="tripleClick")),e.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:l,button:t.button},e.input.mouseDown&&e.input.mouseDown.done();let a=e.posAtCoords(ry(t));a&&("singleClick"==l?e.input.mouseDown=new rS(e,a,t,!!o):("doubleClick"==l?function(e,t,n,r){return rx(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}:function(e,t,n,r){return rx(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=rb(e,t,!0),i=e.state.doc;return!!r&&(rv(e,r,"pointer"),r instanceof e5&&i.eq(e.state.doc)&&(e.input.mouseDown=new rC(e,r)),!0)}(e,n,r)})(e,a.pos,a.inside,t)?t.preventDefault():rf(e,"pointer"))};class rk{constructor(e){this.view=e,this.mightDrag=null,e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(e){this.done()}move(e){0==e.buttons&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}}class rS extends rk{constructor(e,t,n,r){let i,o;if(super(e),this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.startDoc=e.state.doc,this.selectNode=!!n[rw],this.allowDefault=n.shiftKey,t.inside>-1)i=e.state.doc.nodeAt(t.inside),o=t.inside;else{let n=e.state.doc.resolve(t.pos);i=n.parent,o=n.depth?n.before():0}const s=r?null:n.target,l=s?e.docView.nearestDesc(s,!0):null;this.target=l&&1==l.nodeDOM.nodeType?l.nodeDOM:null;let{selection:a}=e.state;0==n.button&&(i.type.spec.draggable&&!1!==i.type.spec.selectable||a instanceof e9&&a.from<=o&&a.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&t5&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),rf(e,"pointer")}done(){super.done(),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>{this.view.isDestroyed||nq(this.view)})}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;if(this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ry(e))),this.updateAllowDefault(e),this.allowDefault||!t)rf(this.view,"pointer");else{var n,r,i,o;(n=this.view,r=t.pos,i=t.inside,o=this.selectNode,rx(n,"handleClickOn",r,i,e)||n.someProp("handleClick",t=>t(n,r,e))||(o?function(e,t){if(-1==t)return!1;let n=e.state.selection,r,i;n instanceof e9&&(r=n.node);let o=e.state.doc.resolve(t);for(let e=o.depth+1;e>0;e--){let t=e>o.depth?o.nodeAfter:o.node(e);if(e9.isSelectable(t)){i=r&&n.$from.depth>0&&e>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?o.before(n.$from.depth):o.before(e);break}}return null!=i&&(rv(e,e9.create(e.state.doc,i),"pointer"),!0)}(n,i):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&e9.isSelectable(r))&&(rv(e,new e9(n),"pointer"),!0)}(n,i)))?e.preventDefault():0==e.button&&(this.flushed||t6&&this.mightDrag&&!this.mightDrag.node.isAtom||t9&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to)))?(rv(this.view,e0.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):rf(this.view,"pointer")}}move(e){this.updateAllowDefault(e),rf(this.view,"pointer"),super.move(e)}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return!!this.allowDefault&&(this.delayedSelectionSync=!0,!0)}}class rC extends rk{constructor(e,t){super(e),this.startSelection=t,this.startDoc=e.state.doc}move(e){if(0==e.buttons||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc))return void this.done();e.preventDefault(),rf(this.view,"pointer");let t=this.view.posAtCoords(ry(e)),n=t&&rb(this.view,t.inside,!1);if(!n)return;let{doc:r}=this.view.state,i=this.startSelection,[o,s]=n.from<i.from?[i.to,n.from]:[i.from,n.to];rv(this.view,e5.create(r,o,s),"pointer")}}function rM(e,t){return!!e.composing||!!(t6&&500>Math.abs(Date.now()-e.input.compositionEndedAt))&&(e.input.compositionEndedAt=-2e8,!0)}rd.touchstart=e=>{e.input.lastTouch=Date.now(),rE(e),rf(e,"pointer")},rd.touchmove=e=>{e.input.lastTouch=Date.now(),rf(e,"pointer")},rd.contextmenu=e=>rE(e);let rO=nn?5e3:-1;function rT(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>rE(e),t))}function rN(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function rE(e,t=!1){if(!nn||!(e.domObserver.flushingSoon>
2=0)){if(e.domObserver.forceFlush(),rN(e),t||e.docView&&e.docView.dirty){let n=nV(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}rh.compositionstart=rh.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof e5&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||t9&&nt&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),rE(e,!0),e.markCursor=null;else if(rE(e,!t.selection.empty),t5&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}rT(e,rO)},rh.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,rT(e,20))};let r_=t2&&t3<15||t7&&ni<604;function rD(e,t,n,r,i){let o=rn(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,i,o||O.empty)))return!0;if(!o)return!1;let s=0==o.openStart&&0==o.openEnd&&1==o.content.childCount?o.content.firstChild:null,l=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(o);return e.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function rA(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}rd.copy=rh.cut=(e,t)=>{let n=e.state.selection,r="cut"==t.type;if(n.empty)return;let i=r_?null:t.clipboardData,{dom:o,text:s}=rt(e,n.content());i?(t.preventDefault(),i.clearData(),i.setData("text/html",o.innerHTML),i.setData("text/plain",s)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,o),r&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},rh.paste=(e,t)=>{if(e.composing&&!nn)return;let n=r_?null:t.clipboardData,r=e.input.shiftKey&&45!=e.input.lastKeyCode;n&&rD(e,rA(n),n.getData("text/html"),r,t)?t.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?rD(e,r.value,null,i,t):rD(e,r.textContent,r.innerHTML,i,t)},50)}(e,t)};class rj{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}let rR=ne?"altKey":"ctrlKey";function rI(e,t){let n;return e.someProp("dragCopies",e=>{n=n||e(t)}),null!=n?!n:!t[rR]}for(let e in rd.dragstart=(e,t)=>{let n,r=e.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let i=e.state.selection,o=i.empty?null:e.posAtCoords(ry(t));if(o&&o.pos>=i.from&&o.pos<=(i instanceof e9?i.to-1:i.to));else if(r&&r.mightDrag)n=e9.create(e.state.doc,r.mightDrag.pos);else if(t.target&&1==t.target.nodeType){let r=e.docView.nearestDesc(t.target,!0);r&&r.node.type.spec.draggable&&r!=e.docView&&(n=e9.create(e.state.doc,r.posBefore))}let s=(n||e.state.selection).content(),{dom:l,text:a,slice:c}=rt(e,s);t.dataTransfer.files.length&&t9&&!(t8>120)||t.dataTransfer.clearData(),t.dataTransfer.setData(r_?"Text":"text/html",l.innerHTML),t.dataTransfer.effectAllowed="copyMove",r_||t.dataTransfer.setData("text/plain",a),e.dragging=new rj(c,rI(e,t),n)},rd.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},rh.dragover=rh.dragenter=(e,t)=>t.preventDefault(),rh.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(ry(t));if(!r)return;let i=e.state.doc.resolve(r.pos),o=n&&n.slice;o?e.someProp("transformPasted",t=>{o=t(o,e,!1)}):o=rn(e,rA(t.dataTransfer),r_?null:t.dataTransfer.getData("text/html"),!1,i);let s=!!(n&&rI(e,t));if(e.someProp("handleDrop",n=>n(e,t,o||O.empty,s)))return t.preventDefault();if(!o)return;t.preventDefault();let l=o?eB(e.state.doc,i.pos,o):i.pos;null==l&&(l=i.pos);let a=e.state.tr;if(s){let{node:e}=n;e?e.replace(a):a.deleteSelection()}let c=a.mapping.map(l),d=0==o.openStart&&0==o.openEnd&&1==o.content.childCount,h=a.doc;
vendor: 4,230 bytes, line 2
2if(d?a.replaceRangeWith(c,c,o.content.firstChild):a.replaceRange(c,c,o),a.doc.eq(h))return;let u=a.doc.resolve(c);if(d&&e9.isSelectable(o.content.firstChild)&&u.nodeAfter&&u.nodeAfter.sameMarkup(o.content.firstChild))a.setSelection(new e9(u));else{let t=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((e,n,r,i)=>t=i),a.setSelection(nG(e,u,a.doc.resolve(t)))}e.focus(),e.dispatch(a.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},rd.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&nq(e)},20))},rd.blur=(e,t)=>{e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),t.relatedTarget&&e.dom.contains(t.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},rd.beforeinput=(e,t)=>{if(nn&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,tZ(8,"Backspace")))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}},rh)rd[e]=rh[e];function rP(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class rz{constructor(e,t){this.toDOM=e,this.spec=t||rL,this.side=this.spec.side||0}map(e,t,n,r){let{pos:i,deleted:o}=e.mapResult(t.from+r,this.side<0?-1:1);return o?null:new rB(i-n,i-n,this)}valid(){return!0}eq(e){return this==e||e instanceof rz&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&rP(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class r${constructor(e,t){this.attrs=e,this.spec=t||rL}map(e,t,n,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,o=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return i>=o?null:new rB(i,o,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof r$&&rP(this.attrs,e.attrs)&&rP(this.spec,e.spec)}static is(e){return e.type instanceof r$}destroy(){}}class rF{constructor(e,t){this.attrs=e,this.spec=t||rL}map(e,t,n,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let o=e.mapResult(t.to+r,-1);return o.deleted||o.pos<=i.pos?null:new rB(i.pos-n,o.pos-n,this)}valid(e,t){let{index:n,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(n)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof rF&&rP(this.attrs,e.attrs)&&rP(this.spec,e.spec)}destroy(){}}class rB{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new rB(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new rB(e,e,new rz(t,n))}static inline(e,t,n,r){return new rB(e,t,new r$(n,r))}static node(e,t,n,r){return new rB(e,t,new rF(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof r$}get widget(){return this.type instanceof rz}}let rV=[],rL={};class rq{constructor(e,t){this.local=e.length?e:rV,this.children=t.length?t:rV}static create(e,t){return t.length?rZ(t,e,0,rL):rW}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,i){for(let o=0;o<this.local.length;o++){let s=this.local[o];s.from<=t&&s.to>=e&&(!i||i(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<t&&this.children[o+1]>e){let s=this.children[o]+1;this.children[o+2].findInner(e-s,t-s,n,r+s,i)}}map(e,t,n){return this==rW||0==e.maps.length?this:this.mapInner(e,t,0,0,n||rL)}mapInner(e,t,n,r,i){let o;for(let s=0;s<this.local.length;s++){let l=this.local[s].map(e,n,r);l&&l.type.valid(t,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,i,o,s){let l=e.slice();for(let e=0,t=o;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,i,o)=>{let s=o-i-(n-e);for(let i=0;i<l.length;i+=3){let o=l[i+1];if(o<0||e>o+t-r)continue;let a=l[i]+t-r;n>=a?l[i+1]=e<=a?-2:-1:e>=t&&s&&(l[i]+=s,l[i+1]+=s)}
vendor: 4,146 bytes, line 2
2r+=s}),t=n.maps[e].map(t,-1)}let a=!1;for(let t=0;t<l.length;t+=3)if(l[t+1]<0){if(-2==l[t+1]){a=!0,l[t+1]=-1;continue}let c=n.map(e[t]+o),d=c-i;if(d<0||d>=r.content.size){a=!0;continue}let h=n.map(e[t+1]+o,-1)-i,{index:u,offset:p}=r.content.findIndex(d),f=r.maybeChild(u);if(f&&p==d&&p+f.nodeSize==h){let r=l[t+2].mapInner(n,f,c+1,e[t]+o+1,s);r!=rW?(l[t]=d,l[t+1]=h,l[t+2]=r):(l[t+1]=-2,a=!0)}else a=!0}if(a){let a=rZ(function(e,t,n,r,i,o,s){for(let l=0;l<e.length;l+=3)-1==e[l+1]&&function e(t,o){for(let e=0;e<t.local.length;e++){let l=t.local[e].map(r,i,o);l?n.push(l):s.onRemove&&s.onRemove(t.local[e].spec)}for(let n=0;n<t.children.length;n+=3)e(t.children[n+2],t.children[n]+o+1)}(e[l+2],t[l]+o+1);return n}(l,e,t,n,i,o,s),r,0,s);t=a.local;for(let e=0;e<l.length;e+=3)l[e+1]<0&&(l.splice(e,3),e-=3);for(let e=0,t=0;e<a.children.length;e+=3){let n=a.children[e];for(;t<l.length&&l[t]<n;)t+=3;l.splice(t,0,a.children[e],a.children[e+1],a.children[e+2])}}return new rq(t.sort(rG),l)}(this.children,o||[],e,t,n,r,i):o?new rq(o.sort(rG),rV):rW}add(e,t){return t.length?this==rW?rq.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,i=0;e.forEach((e,o)=>{let s=o+n,l;if(l=rJ(t,e,s)){for(r||(r=this.children.slice());i<r.length&&r[i]<o;)i+=3;r[i]==o?r[i+2]=r[i+2].addInner(e,l,s+1):r.splice(i,0,o,o+e.nodeSize,rZ(l,e,s+1,rL)),i+=3}});let o=rH(i?rK(t):t,-n);for(let t=0;t<o.length;t++)o[t].type.valid(e,o[t])||o.splice(t--,1);return new rq(o.length?this.local.concat(o).sort(rG):this.local,r||this.children)}remove(e){return 0==e.length||this==rW?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let i,o=n[r]+t,s=n[r+1]+t;for(let t=0,n;t<e.length;t++)(n=e[t])&&n.from>o&&n.to<s&&(e[t]=null,(i||(i=[])).push(n));if(!i)continue;n==this.children&&(n=this.children.slice());let l=n[r+2].removeInner(i,o+1);l!=rW?n[r+2]=l:(n.splice(r,3),r-=3)}if(r.length){for(let n=0,i;n<e.length;n++)if(i=e[n])for(let e=0;e<r.length;e++)r[e].eq(i,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1))}return n==this.children&&r==this.local?this:r.length||n.length?new rq(r,n):rW}forChild(e,t){let n,r;if(this==rW)return this;if(t.isLeaf)return rq.empty;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let i=e+1,o=i+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<o&&t.to>i&&t.type instanceof r$){let e=Math.max(i,t.from)-i,n=Math.min(o,t.to)-i;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new rq(r.sort(rG),rV);return n?new rU([e,n]):e}return n||rW}eq(e){if(this==e)return!0;if(!(e instanceof rq)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return rY(this.localsInner(e))}localsInner(e){if(this==rW)return rV;if(e.inlineContent||!this.local.some(r$.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof r$||t.push(this.local[e]);return t}forEachSet(e){e(this)}}rq.empty=new rq([],[]),rq.removeOverlap=rY;let rW=rq.empty;class rU{constructor(e){this.members=e}map(e,t){let n=this.members.map(n=>n.map(e,t,rL));return rU.from(n)}forChild(e,t){if(t.isLeaf)return rq.empty;let n=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=rW&&(i instanceof rU?n=n.concat(i.members):n.push(i))}return rU.from(n)}eq(e){if(!(e instanceof rU)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<i.length;e++)t.push(i[e])}else t=i}return t?rY(n?t:t.sort(rG)):rV}static from(e){switch(e.length){case 0:return rW;case 1:return e[0];default:return new rU(e.every(e=>e instanceof rq)?e:e.reduce((e,t)=>
vendor: 5,307 bytes, line 2
2e.concat(t instanceof rq?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function rH(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let i=e[r];n.push(new rB(i.from+t,i.to+t,i.type))}return n}function rJ(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,i=null;for(let t=0,o;t<e.length;t++)(o=e[t])&&o.from>n&&o.to<r&&((i||(i=[])).push(o),e[t]=null);return i}function rK(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function rZ(e,t,n,r){let i=[],o=!1;t.forEach((t,s)=>{let l=rJ(e,t,s+n);if(l){o=!0;let e=rZ(l,t,n+s+1,r);e!=rW&&i.push(s,s+t.nodeSize,e)}});let s=rH(o?rK(e):e,-n).sort(rG);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||i.length?new rq(s,i):rW}function rG(e,t){return e.from-t.from||e.to-t.to}function rY(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let i=n+1;i<t.length;i++){let o=t[i];if(o.from==r.from){o.to!=r.to&&(t==e&&(t=e.slice()),t[i]=o.copy(o.from,r.to),rX(t,i+1,o.copy(r.to,o.to)));continue}o.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,o.from),rX(t,i,r.copy(o.from,r.to)));break}}return t}function rX(e,t,n){for(;t<e.length&&rG(n,e[t])>0;)t++;e.splice(t,0,n)}function rQ(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=rW&&t.push(r)}),e.cursorWrapper&&t.push(rq.create(e.state.doc,[e.cursorWrapper.deco])),rU.from(t)}let r0={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},r1=t2&&t3<=11;class r2{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class r3{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new r2,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(t=>{for(let e=0;e<t.length;e++)this.queue.push(t[e]);t2&&t3<=11&&t.some(e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():t6&&e.composing&&t.some(e=>"childList"==e.type&&"TR"==e.target.nodeName)?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),r1&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,r0)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(nY(this.view)){if(this.suppressingSelectionUpdates)return nq(this.view);if(t2&&t3<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&tq(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,n;for(let n=e.focusNode;n;n=tF(n))t.add(n);for(let r=e.anchorNode;r;r=tF(r))if(t.has(r)){n=r;break}let r=n&&this.view.docView.nearestDesc(n);if(r&&r.ignoreMutation({type:"selection",target:3==n.nodeType?n.parentNode:n}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){var e;let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&nY(t)&&!this.ignoreSelectionChange(r),o=-1,s=-1,l=!1,a=[];if(t.editable)for(let e=0;e<n.length;e++){let t=this.registerMutation(n[e],a);t&&(o=o<0?t.from:Math.min(t.from,o),s=s<0?t.to:Math.max(t.to,s),t.typeOver&&(l=!0))}if(a.some(e=>"BR"==e.nodeName)&&(8==t.input.lastKeyCode||46==t.input.lastKeyCode||t9&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&n.some(e=>
2"childList"==e.type&&e.removedNodes.length))){for(let e of a)if("BR"==e.nodeName&&e.parentNode){let t=e.nextSibling;for(;t&&1==t.nodeType;){if("false"==t.contentEditable){e.parentNode.removeChild(e);break}t=t.firstChild}}}else if(t5&&a.length){let e=a.filter(e=>"BR"==e.nodeName);if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let r of e){let e=r.parentNode;e&&"LI"==e.nodeName&&(!n||function(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let t=e.docView.nearestDesc(n,!0);if(t&&t.node.isBlock)return n}return null}(t,n)!=e)&&r.remove()}}}let c=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&tK(r)&&(c=nV(t))&&c.eq(e0.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,nq(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,s),e=t,!r5.has(e)&&(r5.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))&&(e.requiresGeckoHackNode=t5,r4||(console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),r4=!0))),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,function(e,t){var n;let{focusNode:r,focusOffset:i}=e.domSelectionRange();for(let o of t)if((null==(n=o.parentNode)?void 0:n.nodeName)=="TR"){let t=o.nextSibling;for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.nextSibling;if(t){let n=t;for(;;){let e=n.firstChild;if(!e||1!=e.nodeType||"false"==e.contentEditable||/^(BR|IMG)$/.test(e.nodeName))break;n=e}n.insertBefore(o,n.firstChild),r==o&&e.domSelection().collapse(o,i)}else o.parentNode.removeChild(o)}}(t,a)),this.handleDOMChange(o,s,l,a),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||nq(t),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style"))||!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(let n=0;n<e.addedNodes.length;n++){let r=e.addedNodes[n];t.push(r),3==r.nodeType&&(this.lastChangedTextNode=r)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};let r=e.previousSibling,i=e.nextSibling;if(t2&&t3<=11&&e.addedNodes.length)for(let t=0;t<e.addedNodes.length;t++){let{previousSibling:n,nextSibling:o}=e.addedNodes[t];(!n||0>Array.prototype.indexOf.call(e.addedNodes,n))&&(r=n),(!o||0>Array.prototype.indexOf.call(e.addedNodes,o))&&(i=o)}let o=r&&r.parentNode==e.target?t$(r)+1:0,s=n.localPosFromDOM(e.target,o,-1),l=i&&i.parentNode==e.target?t$(i):e.target.childNodes.length;return{from:s,to:n.localPosFromDOM(e.target,l,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let r5=new WeakMap,r4=!1;function r9(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,o=t.endOffset,s=e.domAtPos(e.state.selection.anchor);return tq(s.node,s.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}let r8=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function r6(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:nG(e,t.resolve(n.anchor),t.resolve(n.head))}function r7(e,t,n){let r=e.depth,i=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let t=e.node(r).maybeChild(e.indexAfter(r));for(;t&&!t.isLeaf;)t=t.firstChild,i++}return i}class ie{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new rp,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(is),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):"function"==typeof e?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=ii(this),ir(this),this.nodeViews=io(this),this.docView=nT(this.state.doc,it(this),rQ(this),this.dom,this),this.domObserver=new r3(this,(e,t,n,r)=>(function(e,t,n,r,i){let o,s,l,a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let t=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,n=nV(e,t);
2if(n&&!e.state.selection.eq(n)){if(t9&&nn&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",t=>t(e,tZ(13,"Enter"))))return;let r=e.state.tr.setSelection(n);"pointer"==t?r.setMeta("pointer",!0):"key"==t&&r.scrollIntoView(),a&&r.setMeta("composition",a),e.dispatch(r)}return}let c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);let h=e.state.selection,u=function(e,t,n,r){let i,o,{node:s,fromOffset:l,toOffset:a,from:c,to:d}=e.docView.parseRange(t,n),h=e.domSelectionRange(),u=h.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(o=[{node:u,offset:h.anchorOffset}],tK(h)||o.push({node:h.focusNode,offset:h.focusOffset})),t9&&8===e.input.lastKeyCode)for(let e=a;e>l;e--){let t=s.childNodes[e-1],n=t.pmViewDesc;if("BR"==t.nodeName&&!n){a=e;break}if(!n||n.size)break}let p=e.state.doc,f=e.someProp("domParser")||en.fromSchema(e.state.schema),m=p.resolve(c),g=null,y=f.parse(s,{topNode:m.parent,topMatch:m.parent.contentMatchAt(m.index()),topOpen:!0,from:l,to:a,preserveWhitespace:"pre"!=m.parent.type.whitespace||"full",findPositions:o,ruleFromNode:(i=r,e=>{let t=e.pmViewDesc;if(t)return t.parseRule(i);if("BR"==e.nodeName&&e.parentNode){if(t6&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(e.parentNode.lastChild==e||t6&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}),context:m});if(o&&null!=o[0].pos){let e=o[0].pos,t=o[1]&&o[1].pos;null==t&&(t=e),g={anchor:e+c,head:t+c}}return{doc:y,sel:g,from:c,to:d}}(e,t,n,i),p=e.state.doc,f=p.slice(u.from,u.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(o=e.state.selection.to,s="end"):(o=e.state.selection.from,s="start"),e.input.lastKeyCode=null;let m=function(e,t,n,r,i){let o=e.findDiffStart(t,n),s=n+e.size,l=n+t.size;if(null==o)return null;let{a:a,b:c}=e.findDiffEnd(t,s,l);if("end"==i){let e=Math.max(0,o-Math.min(a,c));r-=a+e-o}if(a<o&&s<l){let e=r<=o&&r>=a?o-r:0;o-=e,c=o+(c-a),a=o}else if(c<o){let e=r<=o&&r>=c?o-r:0;o-=e,a=o+(a-c),c=o}return{start:o,endA:a,endB:c}}(f.content,u.doc.content,u.from,o,s);if(m&&e.input.domChangeCount++,(t7&&e.input.lastIOSEnter>Date.now()-225||nn)&&i.some(e=>1==e.nodeType&&!r8.test(e.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",t=>t(e,tZ(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&h instanceof e5&&!h.empty&&h.$head.sameParent(h.$anchor)&&!e.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:h.from,endA:h.to,endB:h.to};else{if(u.sel){let t=r6(e,e.state.doc,u.sel);if(t&&!t.eq(e.state.selection)){let n=e.state.tr.setSelection(t);a&&n.setMeta("composition",a),e.dispatch(n)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof e5&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=u.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),t2&&t3<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&" Â "==u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),x=p.resolve(m.start),v=g.sameParent(y)&&g.parent.inlineContent&&x.end()>=m.endA;if((t7&&e.input.lastIOSEnter>Date.now()-225&&(!v||i.some(e=>"DIV"==e.nodeName||"P"==e.nodeName))||!v&&g.pos<u.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(u.doc.textBetween(g.pos,y.pos,"","")))&&e.someProp("handleKeyDown",t=>t(e,tZ(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&function(e,t,n,r,i){if(n-t<=i.pos-r.pos||r7(r,!0,!1)<i.pos)return!1;let o=e.resolve(t);if(!r.parent.isTextblock){let e=o.nodeAfter;return null!=e&&n==t+e.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=e.resolve(r7(o,!0,!0));return!(!s.parent.isTextblock||s.pos>n||r7(s,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(s.parent.content)}(p,m.start,m.endA,g,y)&&e.someProp("handleKeyDown",t=>
vendor: 5,135 bytes, line 2
2t(e,tZ(8,"Backspace")))){nn&&t9&&e.domObserver.suppressSelectionUpdates();return}t9&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),nn&&!v&&g.start()!=y.start()&&0==y.parentOffset&&g.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{e.someProp("handleKeyDown",function(t){return t(e,tZ(13,"Enter"))})},20));let w=m.start,k=m.endA,S=t=>{let n=t||e.state.tr.replace(w,k,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let t=r6(e,n.doc,u.sel);t&&!(t9&&e.composing&&t.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(t.head==w||t.head==n.mapping.map(k)-1)||t2&&t.empty&&t.head==w)&&n.setSelection(t)}return a&&n.setMeta("composition",a),n.scrollIntoView()};if(v)if(g.pos==y.pos){t2&&t3<=11&&0==g.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>nq(e),20));let t=S(e.state.tr.delete(w,k)),n=p.resolve(m.start).marksAcross(p.resolve(m.endA));n&&t.ensureMarks(n),e.dispatch(t)}else if(m.endA==m.endB&&(l=function(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,o=r,s,l,a;for(let e=0;e<r.length;e++)i=r[e].removeFromSet(i);for(let e=0;e<n.length;e++)o=n[e].removeFromSet(o);if(1==i.length&&0==o.length)l=i[0],s="add",a=e=>e.mark(l.addToSet(e.marks));else{if(0!=i.length||1!=o.length)return null;l=o[0],s="remove",a=e=>e.mark(l.removeFromSet(e.marks))}let c=[];for(let e=0;e<t.childCount;e++)c.push(a(t.child(e)));if(b.from(c).eq(e))return{mark:l,type:s}}(g.parent.content.cut(g.parentOffset,y.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let t=S(e.state.tr);"add"==l.type?t.addMark(w,k,l.mark):t.removeMark(w,k,l.mark),e.dispatch(t)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-!y.textOffset){let t=g.parent.textBetween(g.parentOffset,y.parentOffset),n=()=>S(e.state.tr.insertText(t,w,k));e.someProp("handleTextInput",r=>r(e,w,k,t,n))||e.dispatch(n())}else e.dispatch(S());else e.dispatch(S())})(this,e,t,n,r)),this.domObserver.start(),function(e){for(let t in rd){let n=rd[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=t=>{!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,t)||rg(e,t)||!e.editable&&t.type in rh||n(e,t)},ru[t]?{passive:!0}:void 0)}t6&&e.dom.addEventListener("input",()=>null),rm(e)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;for(let t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&rm(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(is),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let e in this._props)t[e]=this._props[e];for(let n in t.state=this.state,e)t[n]=e[n];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var n,r,i;let o=this.state,s=!1,l=!1;e.storedMarks&&this.composing&&(rN(this),l=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=t.plugins;if(a||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let e=io(this);(function(e,t){let n=0,r=0;for(let r in e){if(e[r]!=t[r])return!0;n++}for(let e in t)r++;return n!=r})(e,this.nodeViews)&&(this.nodeViews=e,s=!0)}(a||t.handleDOMEvents!=this._props.handleDOMEvents)&&rm(this),this.editable=ii(this),ir(this);let c=rQ(this),d=it(this),h=o.plugins==e.plugins||o.doc.eq(e.doc)?e.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",u=s||!this.docView.matchesNode(e.doc,d,c);(u||!e.selection.eq(o.selection))&&(l=!0);let p="preserve"==h&&l&&null==this.dom.style.overflowAnchor&&function(e){let t,n,r=e.dom.getBoundingClientRect(),i=Math.max(0,r.top);for(let o=(r.left+r.right)/2,s=i+1;s<Math.min(innerHeight,r.bottom);s+=5){let r=e.root.elementFromPoint(o,s);if(!r||r==e.dom||!e.dom.contains(r))continue;let l=r.getBoundingClientRect();if(l.top>=i-20){t=r,n=l.top;break}}return{refDOM:t,refTop:n,stack:nl(e.dom)}}(this);if(l){let t,n,l;this.domObserver.stop();let a=u&&(t2||t9)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&(r=o.selection,i=e.selection,l=Math.min(r.$anchor.sharedDepth(r.head),i.$anchor.sharedDepth(i.head)),r.$anchor.start(l)!=i.$anchor.start(l));if(u){let t=t9?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=tH(e=e.childNodes[t-1])}else{if(!e.parentNode||tJ(e))return null;t=t$(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||tJ(e))return null;t=t$(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);
2if(n&&r&&n!=r){let t=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!t||!t.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let e=n.pmViewDesc;if(!(!e||!e.isText(n.nodeValue)))return r}}return n||r}(this)),(s||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=nT(e.doc,d,c,this.dom,this)),!t||this.trackWrites&&this.dom.contains(this.trackWrites)||(a=!0)}let h=this.input.mouseDown;a||!(h&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(t=this.docView.domFromPos(this.state.selection.anchor,0),n=this.domSelectionRange(),tq(t.node,t.offset,n.anchorNode,n.anchorOffset))&&h.delaySelUpdate())?nq(this,a):(nK(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),(null==(n=this.dragging)?void 0:n.node)&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),"reset"==h?this.dom.scrollTop=0:"to selection"==h?this.scrollToSelection():p&&function({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;na(n,0==r?0:r-t)}(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(e&&this.dom.contains(1==e.nodeType?e:e.parentNode))if(this.someProp("handleScrollToSelection",e=>e(this)));else if(this.state.selection instanceof e9){let t=this.docView.domAfterPos(this.state.selection.from);1==t.nodeType&&ns(this,t.getBoundingClientRect(),e)}else ns(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let t=0;t<this.pluginViews.length;t++){let n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let t=this.directPlugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let t=this.state.plugins[e];t.spec.view&&this.pluginViews.push(t.spec.view(this))}}}updateDraggedNode(e,t){let n=e.node,r=-1;if(n.from<this.state.doc.content.size&&this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{let e=n.from+(this.state.doc.content.size-t.doc.content.size);(e>0&&e<this.state.doc.content.size&&this.state.doc.nodeAt(e))==n.node&&(r=e)}this.dragging=new rj(e.slice,e.move,r<0?void 0:e9.create(this.state.doc,r))}someProp(e,t){let n=this._props&&this._props[e],r;if(null!=n&&(r=t?t(n):n))return r;for(let n=0;n<this.directPlugins.length;n++){let i=this.directPlugins[n].props[e];if(null!=i&&(r=t?t(i):i))return r}let i=this.state.plugins;if(i)for(let n=0;n<i.length;n++){let o=i[n].props[e];if(null!=o&&(r=t?t(o):o))return r}}hasFocus(){if(t2){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(nc)return e.focus(nc);let t=nl(e);e.focus(null==nc?{get preventScroll(){return nc={preventScroll:!0},!0}}:void 0),nc||(nc=!1,na(t,0))}(this.dom),nq(this),this.domObserver.start()}get root(){let e=this._root;if(null==e){for(let e=this.dom.parentNode;e;e=e.parentNode)if(9==e.nodeType||11==e.nodeType&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return e||document}updateRoot(){this._root=null}posAtCoords(e){return function(e,t){var n;let r,i,o=e.dom.ownerDocument,s,l=0,a=function(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(tH(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(tH(r.startContainer),r.startOffset)}}}(o,t.left,t.top);a&&({node:s,offset:l}=a);let c=(e.root.elementFromPoint?e.root:o).elementFromPoint(t.left,t.top);if(!c||!e.dom.contains(1!=c.nodeType?c.parentNode:c)){let n=e.dom.getBoundingClientRect();if(!nd(t,n)||!(c=function e(t,n,r){let i=t.childNodes.length;if(i&&r.top<r.bottom)for(let o=Math.max(0,Math.min(i-1,Math.floor(i*(n.top-r.top)/(r.bottom-r.top))-2)),s=o;;){let r=t.childNodes[s];if(1==r.nodeType){let t=r.getClientRects();for(let i=0;i<t.length;i++){let o=t[i];if(nd(n,o))return e(r,n,o)}}if((s=(s+1)%i)==o)break}return t}(e.dom,t,n)))return null}if(t6)for(let e=c;s&&e;e=tF(e))e.draggable&&(s=void 0);if(c=(r=(n=c).parentNode)&&/^li$/i.test(r.nodeName)&&t.left<n.getBoundingClientRect().left?r:n,s){let n;if(t5&&1==s.nodeType&&(l=Math.min(l,s.childNodes.length))<s.childNodes.length){let e=s.childNodes[l],n;"IMG"==e.nodeName&&(n=e.getBoundingClientRect()).right<=t.left&&n.bottom>t.top&&l++}nr&&l&&1==s.nodeType&&1==(n=s.childNodes[l-1]).nodeType&&"false"==n.contentEditable&&n.getBoundingClientRect().top>=t.top&&l--,s==e.dom&&l==s.childNodes.length-1&&1==s.lastChild.nodeType&&t.top>
2s.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(0==l||1!=s.nodeType||"BR"!=s.childNodes[l-1].nodeName)&&(i=function(e,t,n,r){let i=-1;for(let n=t,o=!1;n!=e.dom;){let t=e.docView.nearestDesc(n,!0),s;if(!t)return null;if(1==t.dom.nodeType&&(t.node.isBlock&&t.parent||!t.contentDOM)&&((s=t.dom.getBoundingClientRect()).width||s.height)&&(t.node.isBlock&&t.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(t.dom.nodeName)&&(!o&&s.left>r.left||s.top>r.top?i=t.posBefore:(!o&&s.right<r.left||s.bottom<r.top)&&(i=t.posAfter),o=!0),!t.contentDOM&&i<0&&!t.node.isText))return(t.node.isBlock?r.top<(s.top+s.bottom)/2:r.left<(s.left+s.right)/2)?t.posBefore:t.posAfter;n=t.dom.parentNode}return i>-1?i:e.docView.posFromDOM(t,n,-1)}(e,s,l,t))}null==i&&(i=function(e,t,n){let{node:r,offset:i}=function e(t,n){let r,i,o,s=2e8,l,a=0,c=n.top,d=n.top;for(let e=t.firstChild,h=0;e;e=e.nextSibling,h++){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=tV(e).getClientRects()}for(let u=0;u<t.length;u++){let p=t[u];if(p.top<=c&&p.bottom>=d){c=Math.max(p.bottom,c),d=Math.min(p.top,d);let t=p.left>n.left?p.left-n.left:p.right<n.left?n.left-p.right:0;if(t<s){o=e,s=t,l=t&&3==o.nodeType?{left:p.right<n.left?p.right:p.left,top:n.top}:n,1==e.nodeType&&t&&(a=h+ +(n.left>=(p.left+p.right)/2));continue}}else p.top>n.top&&!r&&p.left<=n.left&&p.right>=n.left&&(r=e,i={left:Math.max(p.left,Math.min(p.right,n.left)),top:p.top});!o&&(n.left>=p.right&&n.top>=p.top||n.left>=p.left&&n.top>=p.bottom)&&(a=h+1)}}return(!o&&r&&(o=r,l=i,s=0),o&&3==o.nodeType)?function(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(e,o+1),r.setStart(e,o);let n=nu(r,1);if(n.top!=n.bottom&&nd(t,n)){i={node:e,offset:o+ +(t.left>=(n.left+n.right)/2)};break}}return r.detach(),i||{node:e,offset:0}}(o,l):!o||s&&1==o.nodeType?{node:t,offset:a}:e(o,l)}(t,n),o=-1;if(1==r.nodeType&&!r.firstChild){let e=r.getBoundingClientRect();o=e.left!=e.right&&n.left>(e.left+e.right)/2?1:-1}return e.docView.posFromDOM(r,i,o)}(e,c,t));let d=e.docView.nearestDesc(c,!0);return{pos:i,inside:d?d.posAtStart-d.border:-1}}(this,e)}coordsAtPos(e,t=1){return nf(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,n=-1){let r=this.docView.posFromDOM(e,t,n);if(null==r)throw RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return function(e,t,n){let r,i;return nv==t&&nb==n?nw:(nv=t,nb=n,nw="up"==n||"down"==n?(r=t.selection,i="up"==n?r.$from:r.$to,ny(e,t,()=>{let{node:t}=e.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=e.docView.nearestDesc(t,!0);if(!n)break;if(n.node.isBlock){t=n.contentDOM||n.dom;break}t=n.dom.parentNode}let r=nf(e,i.pos,1);for(let e=t.firstChild;e;e=e.nextSibling){let t;if(1==e.nodeType)t=e.getClientRects();else{if(3!=e.nodeType)continue;t=tV(e,0,e.nodeValue.length).getClientRects()}for(let e=0;e<t.length;e++){let i=t[e];if(i.bottom>i.top+1&&("up"==n?r.top-i.top>(i.bottom-r.top)*2:i.bottom-r.bottom>(r.bottom-i.top)*2))return!1}}return!0})):function(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=i==r.parent.content.size,s=e.domSelection();return s?nx.test(r.parent.textContent)&&s.modify?ny(e,t,()=>{let{focusNode:t,focusOffset:i,anchorNode:o,anchorOffset:l}=e.domSelectionRange(),a=s.caretBidiLevel;s.modify("move",n,"character");let c=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:d,focusOffset:h}=e.domSelectionRange(),u=d&&!c.contains(1==d.nodeType?d:d.parentNode)||t==d&&i==h;try{s.collapse(o,l),t&&(t!=o||i!=l)&&s.extend&&s.extend(t,i)}catch(e){}return null!=a&&(s.caretBidiLevel=a),u}):"left"==n||"backward"==n?!i:o:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}pasteHTML(e,t){return rD(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return rD(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return rt(this,e)}destroy(){if(this.docView){for(let e in this.input.mouseDown&&this.input.mouseDown.done(),this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(e,this.input.eventHandlers[e]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],rQ(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,tL()}}get isDestroyed(){return null==this.docView}dispatchEvent(e){!rg(this,e)&&rd[e.type]&&(this.editable||!(e.type in rh))&&rd[e.type](this,e)}domSelectionRange(){let e=this.domSelection();return e?t6&&11===this.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){let n;if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return r9(e,n)}function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?r9(e,n):null}
2(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function it(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if("function"==typeof n&&(n=n(e.state)),n)for(let e in n)"class"==e?t.class+=" "+n[e]:"style"==e?t.style=(t.style?t.style+";":"")+n[e]:t[e]||"contenteditable"==e||"nodeName"==e||(t[e]=String(n[e]))}),t.translate||(t.translate="no"),[rB.node(0,e.state.doc.content.size,t)]}function ir(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:rB.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function ii(e){return!e.someProp("editable",t=>!1===t(e.state))}function io(e){let t=Object.create(null);function n(e){for(let n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function is(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}ie.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};for(var il={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ia={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},ic="u">typeof navigator&&/Mac/.test(navigator.platform),id="u">typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),ih=0;ih<10;ih++)il[48+ih]=il[96+ih]=String(ih);for(var ih=1;ih<=24;ih++)il[ih+111]="F"+ih;for(var ih=65;ih<=90;ih++)il[ih]=String.fromCharCode(ih+32),ia[ih]=String.fromCharCode(ih);for(var iu in il)ia.hasOwnProperty(iu)||(ia[iu]=il[iu]);let ip="u">typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),im="u">typeof navigator&&/Win/.test(navigator.platform);function ig(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function iy(e){let t=function(e){let t=Object.create(null);for(let n in e)t[function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"==s&&(s=" ");for(let e=0;e<o.length-1;e++){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))ip?i=!0:n=!0;else throw Error("Unrecognized modifier name: "+s)}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),i&&(s="Meta-"+s),r&&(s="Shift-"+s),s}(n)]=e[n];return t}(e);return function(e,n){var r;let i=("Esc"==(r=!(ic&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||id&&n.shiftKey&&n.key&&1==n.key.length||"Unidentified"==n.key)&&n.key||(n.shiftKey?ia:il)[n.keyCode]||n.key||"Unidentified")&&(r="Escape"),"Del"==r&&(r="Delete"),"Left"==r&&(r="ArrowLeft"),"Up"==r&&(r="ArrowUp"),"Right"==r&&(r="ArrowRight"),"Down"==r&&(r="ArrowDown"),r),o,s=t[ig(i,n)];if(s&&s(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){let r=t[ig(i,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(im&&n.ctrlKey&&n.altKey)&&(o=il[n.keyCode])&&o!=i){let r=t[ig(o,n)];if(r&&r(e.state,e.dispatch,e))return!0}}return!1}}var ix=Object.defineProperty,iv=(e,t)=>{for(var n in t)ix(e,n,{get:t[n],enumerable:!0})};function ib(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var iw=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(o);return i.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s=[],l=!!e,a=e||i.tr,c=()=>(l||!t||a.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(a),s.every(e=>!0===e)),d={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(a,t),i=n(...e)(r);return s.push(i),d}])),run:c};return d}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:o}=r,s={tr:e,editor:r,view:o,state:ib({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},ik={};iv(ik,{blur:()=>iS,clearContent:()=>iC,clearNodes:()=>iM,command:()=>iO,createParagraphNear:()=>iT,cut:()=>iN,deleteCurrentNode:()=>iE,deleteNode:()=>iD,deleteRange:()=>iA,deleteSelection:()=>iR,enter:()=>iI,exitCode:()=>iP,extendMarkRange:()=>iq,first:()=>iW,focus:()=>iG,forEach:()=>iY,insertContent:()=>iX,insertContentAt:()=>i3,insertDefaultBlock:()=>i4,joinBackward:()=>i6,joinDown:()=>i8,joinForward:()=>i7,joinItemBackward:()=>
2oe,joinItemForward:()=>ot,joinTextblockBackward:()=>on,joinTextblockForward:()=>or,joinUp:()=>i9,keyboardShortcut:()=>oo,lift:()=>oa,liftEmptyBlock:()=>oc,liftListItem:()=>od,newlineInCode:()=>oh,resetAttributes:()=>of,scrollIntoView:()=>om,selectAll:()=>og,selectNodeBackward:()=>oy,selectNodeForward:()=>ox,selectParentNode:()=>ov,selectTextblockEnd:()=>ob,selectTextblockStart:()=>ow,setContent:()=>oS,setMark:()=>oQ,setMeta:()=>o0,setNode:()=>o1,setNodeSelection:()=>o2,setTextDirection:()=>o3,setTextSelection:()=>o5,sinkListItem:()=>o4,splitBlock:()=>o8,splitListItem:()=>o6,toggleList:()=>sn,toggleMark:()=>sr,toggleNode:()=>si,toggleWrap:()=>so,undoInputRule:()=>ss,unsetAllMarks:()=>sl,unsetMark:()=>sa,unsetTextDirection:()=>sc,updateAttributes:()=>sd,wrapIn:()=>sh,wrapInList:()=>su});var iS=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),iC=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),iM=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return!n||(i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,o=r.resolve(i.map(n)),s=r.resolve(i.map(n+e.nodeSize)),l=o.blockRange(s);if(!l)return;let a=eD(l);if(e.type.isTextblock){let{defaultType:e}=o.parent.contentMatchAt(o.index());t.setNodeMarkup(l.start,e)}(a||0===a)&&t.lift(l,a)})}),!0)},iO=e=>t=>e(t),iT=()=>({state:e,dispatch:t})=>tO(e,t),iN=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,o=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let s=r.mapping.map(t);return r.insert(s,o.content),r.setSelection(new e5(r.doc.resolve(Math.max(s-1,0)))),!0},iE=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;n-=1)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function i_(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var iD=e=>({tr:t,state:n,dispatch:r})=>{let i=i_(e,n.schema),o=t.selection.$anchor;for(let e=o.depth;e>0;e-=1)if(o.node(e).type===i){if(r){let n=o.before(e),r=o.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},iA=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},ij=(e,t,n)=>{var r;return!e.parent.isInline||"left"===n&&e.pos>e.start()||"right"===n&&e.pos<e.end()?e.pos:(r=t.nodes[e.parent.type.name].spec).content&&/^text(\*|\+)/.test(r.content)?"left"===n?e.start()-1:e.end()+1:e.pos},iR=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{var r;let o=n.mapping.slice(i),s=n.doc.resolve(o.map(t.$from.pos)),l=n.doc.resolve(o.map(t.$to.pos)),{from:a,to:c}={from:ij(s,r=e.schema,"left"),to:ij(l,r,"right")};n.deleteRange(a,c)}),n.selection.empty||n.setSelection(e5.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},iI=()=>({commands:e})=>e.keyboardShortcut("Enter"),iP=()=>({state:e,dispatch:t})=>tM(e,t);function iz(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function i$(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:iz(t[r])?t[r].test(e[r]):t[r]===e[r])}function iF(e,t,n={}){return e.find(e=>e.type===t&&i$(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function iB(e,t,n={}){return!!iF(e,t,n)}function iV(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!iF([...r.node.marks],t,n))return;let i=r.index,o=e.start()+r.offset,s=i+1,l=o+r.node.nodeSize;for(;i>0&&iB([...e.parent.child(i-1).marks],t,n);)i-=1,o-=e.parent.child(i).nodeSize;for(;s<e.parent.childCount&&iB([...e.parent.child(s).marks],t,n);)l+=e.parent.child(s).nodeSize,s+=1;return{from:o,to:l}}function iL(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var iq=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=iL(e,r.schema),{doc:s,selection:l}=n,{$from:a,from:c,to:d}=l;if(i){let e=iV(a,o,t);if(e&&e.from<=c&&e.to>=d){let t=e5.create(s,e.from,e.to);n.setSelection(t)}}return!0},iW=e=>t=>{let n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function iU(e){return e instanceof e5}function iH(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function iJ(e,t=null){if(!t)return null;let n=e0.atStart(e),r=e0.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;let i=n.from,o=r.to;return"all"===t?e5.create(e,iH(0,i,o),iH(e.content.size,i,o)):e5.create(e,iH(t,i,o),iH(t,i,o))}function iK(){return["Android"].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function iZ(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var iG=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};let s=()=>{(iZ()||iK())&&r.dom.focus(),"u">typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!iZ()&&!iK()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{!n.isDestroyed&&(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(o&&null===e&&!iU(n.state.selection))return s(),!0;let l=iJ(i.doc,e)||n.state.selection,a=n.state.selection.eq(l);return o&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},iY=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),iX=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),iQ=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&iQ(r)}return e};function i0(e){if("u"<typeof window)throw Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`<body>${e}</body>`;return iQ(new window.DOMParser().parseFromString(t,"text/html").body)}function i1(e,t,n){if(e instanceof F||e instanceof b)return e;n={slice:!0,parseOptions:{},...n};let r="object"==typeof e&&null!==e,i="string"==typeof e;if(r)try{if(Array.isArray(e)&&e.length>0)return b.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),i1("",t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i="",o=new ee({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,i="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?en.fromSchema(o).parseSlice(i0(e),n.parseOptions):en.fromSchema(o).parse(i0(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error("[tiptap error]: Invalid HTML content",{cause:Error(`Invalid element found: ${i}`)})}let r=en.fromSchema(t);return n.slice?r.parseSlice(i0(e),n.parseOptions).content:r.parse(i0(e),n.parseOptions)}return i1("",t,n)}function i2(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof eT||i instanceof eN))return;let o=e.mapping.maps[r],s=0;o.forEach((e,t,n,r)=>{0===s&&(s=r)}),e.setSelection(e0.near(e.doc.resolve(s),n))}var i3=(e,t,n)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){let i,l;n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a=e=>
2{o.emit("contentError",{editor:o,error:e,disableCollaboration:()=>{"collaboration"in o.storage&&"object"==typeof o.storage.collaboration&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{i1(t,o.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(e){a(e)}try{i=i1(t,o.schema,{parseOptions:c,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:o.options.enableContentCheck})}catch(e){return a(e),!1}let{from:d,to:h}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},u=!0,p=!0;if((!("type"in i)?i:[i]).forEach(e=>{e.check(),u=!!u&&e.isText&&0===e.marks.length,p=!!p&&e.isBlock}),d===h&&p){let{parent:e}=r.doc.resolve(d);!e.isTextblock||e.type.spec.code||e.childCount||(d-=1,h+=1)}if(u){if(Array.isArray(t))l=t.map(e=>e.text||"").join("");else if(t instanceof b){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),l=e}else l="object"==typeof t&&t&&t.text?t.text:t;r.insertText(l,d,h)}else{l=i;let e=r.doc.resolve(d),t=e.node(),n=0===e.parentOffset,o=t.isText||t.isTextblock,s=t.content.size>0;n&&o&&s&&p&&(d=Math.max(0,d-1)),r.replaceWith(d,h,l)}n.updateSelection&&i2(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:l}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:l})}return!0};function i5(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var i4=(e={})=>({tr:t,dispatch:n,editor:r})=>{let i,o,{pos:s,attrs:l,content:a,updateSelection:c=!0}=e,d=i5((i="number"==typeof s?t.doc.resolve(s):s||t.selection.$from).parent.contentMatchAt(i.index()));if(!d)return!1;let h=Object.keys(d.spec.attrs||{}),u=l?Object.fromEntries(Object.entries(l).filter(([e])=>h.includes(e))):{};if(a){let e=i1(a,r.schema);o=d.createAndFill(u,e)}else o=d.createAndFill(u);return!!o&&(n&&(t.insert(i.pos,o),c&&i2(t,t.steps.length-1,-1)),!0)},i9=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r=n instanceof e9,i;if(r){if(n.node.isTextblock||!ez(e.doc,n.from))return!1;i=n.from}else if(null==(i=eF(e.doc,n.from,-1)))return!1;if(t){let n=e.tr.join(i);r&&n.setSelection(e9.create(n.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(n.scrollIntoView())}return!0})(e,t),i8=()=>({state:e,dispatch:t})=>((e,t)=>{let n=e.selection,r;if(n instanceof e9){if(n.node.isTextblock||!ez(e.doc,n.to))return!1;r=n.to}else if(null==(r=eF(e.doc,n.to,1)))return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0})(e,t),i6=()=>({state:e,dispatch:t})=>tf(e,t),i7=()=>({state:e,dispatch:t})=>tb(e,t),oe=()=>({state:e,dispatch:t,tr:n})=>{try{let r=eF(e.doc,e.selection.$from.pos,-1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},ot=()=>({state:e,dispatch:t,tr:n})=>{try{let r=eF(e.doc,e.selection.$from.pos,1);if(null==r)return!1;return n.join(r,2),t&&t(n),!0}catch{return!1}},on=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=tp(e,n);if(!r)return!1;let i=tx(r);return!!i&&tm(e,i,t)})(e,t),or=()=>({state:e,dispatch:t})=>((e,t,n)=>{let r=tv(e,n);if(!r)return!1;let i=tk(r);return!!i&&tm(e,i,t)})(e,t);function oi(){return"u">typeof navigator&&/Mac/.test(navigator.platform)}var oo=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let o=(function(e){let t,n,r,i,o=e.split(/-(?!$)/),s=o[o.length-1];"Space"===s&&(s=" ");for(let e=0;e<o.length-1;e+=1){let s=o[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else if(/^mod$/i.test(s))iZ()||oi()?i=!0:n=!0;else throw Error(`Unrecognized modifier name: ${s}`)}return t&&(s=`Alt-${s}`),n&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),r&&(s=`Shift-${s}`),s})(e).split(/-(?!$)/),s=o.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),l=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),a=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,l))});
2return null==a||a.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function ol(e,t,n={}){let{from:r,to:i,empty:o}=e.selection,s=t?i_(t,e.schema):null,l=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),o=Math.min(i,t+e.nodeSize);l.push({node:e,from:n,to:o})});let a=i-r,c=l.filter(e=>!s||s.name===e.node.type.name).filter(e=>i$(e.node.attrs,n,{strict:!1}));return o?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=a}var oa=(e,t={})=>({state:n,dispatch:r})=>{let i=i_(e,n.schema);return!!ol(n,i,t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),o=i&&eD(i);return null!=o&&(t&&t(e.tr.lift(i,o).scrollIntoView()),!0)})(n,r)},oc=()=>({state:e,dispatch:t})=>tT(e,t),od=e=>({state:t,dispatch:n})=>{var r;return(r=i_(e,t.schema),function(e,t){let{$from:n,$to:i}=e.selection,o=n.blockRange(i,e=>e.childCount>0&&e.firstChild.type==r);return!!o&&(!t||(n.node(o.depth-1).type==r?function(e,t,n,r){let i=e.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new eN(o-1,s,o,s,new O(b.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new z(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));let l=eD(r);if(null==l)return!1;i.lift(r,l);let a=i.doc.resolve(i.mapping.map(o,-1)-1);return ez(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),t(i.scrollIntoView()),!0}(e,t,r,o):function(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,o=n.startIndex;t>o;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let o=r.doc.resolve(n.start),s=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,a=n.endIndex==i.childCount,c=o.node(-1),d=o.index(-1);if(!c.canReplace(d+ +!l,d+1,s.content.append(a?b.empty:b.from(i))))return!1;let h=o.pos,u=h+s.nodeSize;return r.step(new eN(h-!!l,u+ +!!a,h+1,u-1,new O((l?b.empty:b.from(i.copy(b.empty))).append(a?b.empty:b.from(i.copy(b.empty))),+!l,+!a),+!l)),t(r.scrollIntoView()),!0}(e,t,o)))})(t,n)},oh=()=>({state:e,dispatch:t})=>tS(e,t);function ou(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function op(e,t){let n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var of=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=ou("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(o=i_(e,r.schema)),"mark"===l&&(s=iL(e,r.schema));let a=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{o&&o===e.type&&(a=!0,i&&n.setNodeMarkup(r,void 0,op(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(o=>{s===o.type&&(a=!0,i&&n.addMark(r,r+e.nodeSize,s.create(op(o.attrs,t))))})})}),a},om=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),og=()=>({tr:e,dispatch:t})=>{if(t){let t=new e6(e.doc);e.setSelection(t)}return!0},oy=()=>({state:e,dispatch:t})=>ty(e,t),ox=()=>({state:e,dispatch:t})=>tw(e,t),ov=()=>({state:e,dispatch:t})=>((e,t)=>{let{$from:n,to:r}=e.selection,i,o=n.sharedDepth(r);return 0!=o&&(i=n.before(o),t&&t(e.tr.setSelection(e9.create(e.doc,i))),!0)})(e,t),ob=()=>({state:e,dispatch:t})=>tD(e,t),ow=()=>({state:e,dispatch:t})=>t_(e,t);function ok(e,t,n={},r={}){return i1(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var oS=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:s,commands:l})=>{let{doc:a}=o;if("full"!==r.preserveWhitespace){let l=ok(e,i.schema,r,{errorOnInvalidContent:null!=t?t:i.options.enableContentCheck});return s&&o.replaceWith(0,a.content.size,l).setMeta("preventUpdate",!n),!0}return s&&o.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:a.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:i.options.enableContentCheck})};function oC(e,t){let n=iL(t,e.schema),{from:r,to:i,empty:o}=e.selection,s=[];o?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{s.push(...e.marks)});let l=s.find(e=>e.type.name===n.name);return l?{...l.attrs}:{}}function oM(e){return t=>(function(e,t){for(let n=e.depth;n>0;n-=1){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}})(t.$from,e)}function oO(e,t,n){return void 0===e.config[t]&&e.parent?oO(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?oO(e.parent,t,n):null}):e.config[t]}function oT(e){return e.map(e=>{let t={name:e.name,options:e.options,storage:e.storage},n=oO(e,"addExtensions",t);return n?[e,...oT(n())]:e}).flat(10)}
2function oN(e,t){let n=eh.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function oE(e){return"function"==typeof e}function o_(e,t,...n){return oE(e)?t?e.bind(t)(...n):e(...n):e}function oD(e){let t=e.filter(e=>"extension"===e.type);return{baseExtensions:t,nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function oA(e){let t=[],{nodeExtensions:n,markExtensions:r}=oD(e),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),l=r.map(e=>e.name),a=[...s,...l];return e.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage,extensions:i},r=oO(e,"addGlobalAttributes",n);r&&r().forEach(e=>{(Array.isArray(e.types)?e.types:"*"===e.types?a:"nodes"===e.types?s:"marks"===e.types?l:[]).forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...o,...r}})})})})}
2),i.forEach(e=>{let n={name:e.name,options:e.options,storage:e.storage},r=oO(e,"addAttributes",n);r&&Object.entries(r()).forEach(([n,r])=>{let i={...o,...r};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&(null==i?void 0:i.default)===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function oj(e){let t=[],n=function(e){let t=[],n="",r=!1,i=!1,o=0,s=e.length;for(let l=0;l<s;l+=1){let s=e[l];if("'"===s&&!i){r=!r,n+=s;continue}if('"'===s&&!r){i=!i,n+=s;continue}if(!r&&!i){if("("===s){o+=1,n+=s;continue}if(")"===s&&o>0){o-=1,n+=s;continue}if(";"===s&&0===o){t.push(n),n="";continue}}n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(":");if(-1===i)continue;let o=r.slice(0,i).trim(),s=r.slice(i+1).trim();o&&s&&t.push([o,s])}return t}function oR(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(!n[e]){n[e]=t;return}if("class"===e){let r=t?String(t).split(" "):[],i=n[e]?n[e].split(" "):[],o=r.filter(e=>!i.includes(e));n[e]=[...i,...o].join(" ")}else if("style"===e){let r=new Map([...oj(n[e]),...oj(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t}),n},{})}function oI(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>oR(e,t),{})}function oP(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;let i=t.reduce((e,t)=>{var r;let i=t.attribute.parseHTML?t.attribute.parseHTML(n):"string"!=typeof(r=n.getAttribute(t.name))?r:r.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(r):"true"===r||"false"!==r&&r;return null==i?e:{...e,[t.name]:i}},{});return{...r,...i}}}}function oz(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>!("attrs"===e&&function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function o$(e){var t,n;let r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function oF(e){return e.sort((e,t)=>{let n=oO(e,"priority")||100,r=oO(t,"priority")||100;return n>r?-1:+(n<r)})}function oB(e){var t;let n=oF(oT(e)),r=Array.from(new Set((t=n.map(e=>e.name)).filter((e,n)=>t.indexOf(e)!==n)));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),n}function oV(e,t,n){let{from:r,to:i}=t,{blockSeparator:o="\n\n",textSerializers:s={}}=n||{},l="";return e.nodesBetween(r,i,(e,n,a,c)=>{var d;e.isBlock&&n>r&&(l+=o);let h=null==s?void 0:s[e.type.name];if(h)return a&&(l+=h({node:e,pos:n,parent:a,index:c,range:t})),!1;e.isText&&(l+=null==(d=null==e?void 0:e.text)?void 0:d.slice(Math.max(r,n)-n,i-n))}),l}function oL(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function oq(e){let t,{mapping:n,steps:r}=e,i=[];return n.maps.forEach((e,t)=>{let o=[];if(e.ranges.length)e.forEach((e,t)=>{o.push({from:e,to:t})});else{let{from:e,to:n}=r[t];if(void 0===e||void 0===n)return;o.push({from:e,to:n})}o.forEach(({from:e,to:r})=>{let o=n.slice(t).map(e,-1),s=n.slice(t).map(r),l=n.invert().map(o,-1),a=n.invert().map(s);i.push({oldRange:{from:l,to:a},newRange:{from:o,to:s}})})}),1===(t=function(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(i)).length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function oW(e,t){return t.nodes[e]||t.marks[e]||null}function oU(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function oH(e,t,n={}){let{empty:r,ranges:i}=e.selection,o=t?iL(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>
2!o||o.name===e.type.name).find(e=>i$(e.attrs,n,{strict:!1}));let s=0,l=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(o&&e.inlineContent&&!e.type.allowsMarkType(o))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s+=a-n,l.push(...e.marks.map(e=>({mark:e,from:n,to:a})))})}),0===s)return!1;let a=l.filter(e=>!o||o.name===e.mark.type.name).filter(e=>i$(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=l.filter(e=>!o||e.mark.type!==o&&e.mark.type.excludes(o)).reduce((e,t)=>e+t.to-t.from,0);return(a>0?a+c:a)>=s}function oJ(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function oK(e,t){let{nodeExtensions:n}=oD(t),r=n.find(t=>t.name===e);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=o_(oO(r,"group",i));return"string"==typeof o&&o.split(" ").includes("list")}function oZ(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return!/\S/.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(oZ(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}var oG=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function oY(e,t){let n=t.mapping.mapResult(e.position);return{position:new oG(n.pos),mapResult:n}}function oX(e){return new oG(e)}var oQ=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:o}=n,{empty:s,ranges:l}=o,a=iL(e,r.schema);if(i)if(s){let e=oC(r,a);n.addStoredMark(a.create({...e,...t}))}else l.forEach(e=>{let i=e.$from.pos,o=e.$to.pos;r.doc.nodesBetween(i,o,(e,r)=>{let s=Math.max(r,i),l=Math.min(r+e.nodeSize,o);e.marks.find(e=>e.type===a)?e.marks.forEach(e=>{a===e.type&&n.addMark(s,l,a.create({...e.attrs,...t}))}):n.addMark(s,l,a.create(t))})});return function(e,t,n){var r;let{selection:i}=t,o=null;
2if(iU(i)&&(o=i.$cursor),o){let t=null!=(r=e.storedMarks)?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:s}=i;return s.some(({$from:t,$to:r})=>{let i=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),o=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&o}return!i}),i})}(r,n,a)},o0=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),o1=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let o,s=i_(e,n.schema);return(n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),s.isTextblock)?i().command(({commands:e})=>!!tA(s,{...o,...t})(n)||e.clearNodes()).command(({state:e})=>tA(s,{...o,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},o2=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=iH(e,0,n.content.size),i=e9.create(n,r);t.setSelection(i)}return!0},o3=(e,t)=>({tr:n,state:r,dispatch:i})=>{let o,s,{selection:l}=r;return"number"==typeof t?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=l.from,s=l.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},o5=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}="number"==typeof e?{from:e,to:e}:e,o=e5.atStart(n).from,s=e5.atEnd(n).to,l=iH(r,o,s),a=iH(i,o,s),c=e5.create(n,l,a);t.setSelection(c)}return!0},o4=e=>({state:t,dispatch:n})=>{var r;return(r=i_(e,t.schema),function(e,t){let{$from:n,$to:i}=e.selection,o=n.blockRange(i,e=>e.childCount>0&&e.firstChild.type==r);if(!o)return!1;let s=o.startIndex;if(0==s)return!1;let l=o.parent,a=l.child(s-1);if(a.type!=r)return!1;if(t){let n=a.lastChild&&a.lastChild.type==l.type,i=b.from(n?r.create():null),s=new O(b.from(r.create(null,b.from(l.type.create(null,i)))),n?3:1,0),c=o.start,d=o.end;t(e.tr.step(new eN(c-(n?3:1),d,c,d,s,1,!0)).scrollIntoView())}return!0})(t,n)};function o9(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var o8=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:o,doc:s}=t,{$from:l,$to:a}=o,c=oU(i.extensionManager.attributes,l.node().type.name,l.node().attrs);if(o instanceof e9&&o.node.isBlock)return!!l.parentOffset&&!!eP(s,l.pos)&&(r&&(e&&o9(n,i.extensionManager.splittableMarks),t.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;let d=a.parentOffset===a.parent.content.size,h=0===l.depth?void 0:i5(l.node(-1).contentMatchAt(l.indexAfter(-1))),u=d&&h?[{type:h,attrs:c}]:void 0,p=eP(t.doc,t.mapping.map(l.pos),1,u);if(!u&&!p&&eP(t.doc,t.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(p=!0,u=h?[{type:h,attrs:c}]:void 0),r){if(p&&(o instanceof e5&&t.deleteSelection(),t.split(t.mapping.map(l.pos),1,u),h&&!d&&!l.parentOffset&&l.parent.type!==h)){let e=t.mapping.map(l.before()),n=t.doc.resolve(e);l.node(-1).canReplaceWith(n.index(),n.index()+1,h)&&t.setNodeMarkup(t.mapping.map(l.before()),h)}e&&o9(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return p},o6=(e,t={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var s;let l=i_(e,r.schema),{$from:a,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(c))return!1;let h=a.node(-1);if(h.type!==l)return!1;let u=o.extensionManager.attributes;if(0===a.parent.content.size&&a.node(-1).childCount===a.indexAfter(-1)){if(2===a.depth||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let e=b.empty,r=a.index(-1)?1:a.index(-2)?2:3;for(let t=a.depth-r;t>=a.depth-3;t-=1)e=b.from(a.node(t).copy(e));let i=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,o={...oU(u,a.node().type.name,a.node().attrs),...t},c=(null==(s=l.contentMatch.defaultType)?void 0:s.createAndFill(o))||void 0;e=e.append(b.from(l.createAndFill(null,c)||void 0));let d=a.before(a.depth-(r-1));n.replace(d,a.after(-i),new O(e,4-r,0));let h=-1;n.doc.nodesBetween(d,n.doc.content.size,(e,t)=>{if(h>-1)return!1;e.isTextblock&&0===e.content.size&&(h=t+1)}),h>
2-1&&n.setSelection(e5.near(n.doc.resolve(h))),n.scrollIntoView()}return!0}let p=c.pos===a.end()?h.contentMatchAt(0).defaultType:null,f={...oU(u,h.type.name,h.attrs),...t},m={...oU(u,a.node().type.name,a.node().attrs),...t};n.delete(a.pos,c.pos);let g=p?[{type:l,attrs:f},{type:p,attrs:m}]:[{type:l,attrs:f}];if(!eP(n.doc,a.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:s}=o.extensionManager,l=t||e.$to.parentOffset&&e.$from.marks();if(n.split(a.pos,2,g).scrollIntoView(),!l||!i)return!0;let c=l.filter(e=>s.includes(e.type.name));n.ensureMarks(c)}return!0};function o7(e){return e&&"1"!==e?e:null}var se=(e,t)=>{var n,r;let i=oM(e=>e.type===t)(e.selection);if(!i)return!0;let o=e.doc.resolve(Math.max(0,i.pos-1)).before(i.depth);if(void 0===o)return!0;let s=e.doc.nodeAt(o);return!(i.node.type===(null==s?void 0:s.type)&&ez(e.doc,i.pos))||(n=i.node.attrs.type,r=null==s?void 0:s.attrs.type,o7(n)!==o7(r)||(e.join(i.pos),!0))},st=(e,t)=>{var n,r;let i=oM(e=>e.type===t)(e.selection);if(!i)return!0;let o=e.doc.resolve(i.start).after(i.depth);if(void 0===o)return!0;let s=e.doc.nodeAt(o);return!(i.node.type===(null==s?void 0:s.type)&&ez(e.doc,o))||(n=i.node.attrs.type,r=null==s?void 0:s.attrs.type,o7(n)!==o7(r)||(e.join(o),!0))},sn=(e,t,n,r={})=>({editor:i,tr:o,state:s,dispatch:l,chain:a,commands:c,can:d})=>{let{extensions:h,splittableMarks:u}=i.extensionManager,p=i_(e,s.schema),f=i_(t,s.schema),{selection:m,storedMarks:g}=s,{$from:y,$to:x}=m,v=y.blockRange(x),b=g||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;let w=oM(e=>oK(e.type.name,h))(m),k=0===m.from&&m.to===s.doc.content.size,S=s.doc.content.content,C=1===S.length?S[0]:null,M=k&&C&&oK(C.type.name,h)?{node:C,pos:0,depth:0}:null,O=null!=w?w:M,T=!!w&&v.depth>=1&&v.depth-w.depth<=1,N=!!M;if((T||N)&&O){if(O.node.type===p)return k&&N?a().command(({tr:e,dispatch:t})=>{let n=function(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return e5.between(r,i)}(e);return!!n&&(e.setSelection(n),t&&t(e),!0)}).liftListItem(f).run():c.liftListItem(f);if(oK(O.node.type.name,h)&&p.validContent(O.node.content))return a().command(()=>(o.setNodeMarkup(O.pos,p),!0)).command(()=>se(o,p)).command(()=>st(o,p)).run()}return n&&b&&l?a().command(()=>{let e=d().wrapInList(p,r),t=b.filter(e=>u.includes(e.type.name));return o.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(p,r).command(()=>se(o,p)).command(()=>st(o,p)).run():a().command(()=>!!d().wrapInList(p,r)||c.clearNodes()).wrapInList(p,r).command(()=>se(o,p)).command(()=>st(o,p)).run()},sr=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=n,s=iL(e,r.schema);return oH(r,s,t)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,t)},si=(e,t,n={})=>({state:r,commands:i})=>{let o,s=i_(e,r.schema),l=i_(t,r.schema),a=ol(r,s,n);return(r.selection.$anchor.sameParent(r.selection.$head)&&(o=r.selection.$anchor.parent.attrs),a)?i.setNode(l,o):i.setNode(s,{...o,...n})},so=(e,t={})=>({state:n,commands:r})=>{let i=i_(e,n.schema);return ol(n,i,t)?r.lift(i):r.wrapIn(i,t)},ss=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i,o=n[r];if(o.spec.isInputRules&&(i=o.getState(e))){if(t){let t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){let n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},sl=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:o}=t,{empty:s,ranges:l}=o;if(s)return!0;let{nonClearableMarks:a}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!a.includes(e.name));l.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},sa=(e,t={})=>({tr:n,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=t,{selection:l}=n,a=iL(e,r.schema),{$from:c,empty:d,ranges:h}=l;if(!i)return!0;if(d&&s){let{from:e,to:t}=l,r=null==(o=c.marks().find(e=>e.type===a))?void 0:o.attrs,i=iV(c,a,r);i&&(e=i.from,t=i.to),n.removeMark(e,t,a)}else h.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,a)});return n.removeStoredMark(a),!0},sc=e=>({tr:t,state:n,dispatch:r})=>{let i,o,{selection:s}=n;return"number"==typeof e?(i=e,o=e):e&&"from"in e&&"to"in e?(i=e.from,o=e.to):(i=s.from,o=s.to),r&&t.doc.nodesBetween(i,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},sd=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let o=null,s=null,l=ou("string"==typeof e?e:e.name,r.schema);if(!l)return!1;"node"===l&&(o=i_(e,r.schema)),"mark"===l&&(s=iL(e,r.schema));let a=!1;
2return n.selection.ranges.forEach(e=>{let l,c,d,h,u=e.$from.pos,p=e.$to.pos;n.selection.empty?r.doc.nodesBetween(u,p,(e,t)=>{o&&o===e.type&&(a=!0,d=Math.max(t,u),h=Math.min(t+e.nodeSize,p),l=t,c=e)}):r.doc.nodesBetween(u,p,(e,r)=>{r<u&&o&&o===e.type&&(a=!0,d=Math.max(r,u),h=Math.min(r+e.nodeSize,p),l=r,c=e),r>=u&&r<=p&&(o&&o===e.type&&(a=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(o=>{if(s===o.type&&(a=!0,i)){let i=Math.max(r,u),l=Math.min(r+e.nodeSize,p);n.addMark(i,l,s.create({...o.attrs,...t}))}}))}),c&&(void 0!==l&&i&&n.setNodeMarkup(l,void 0,{...c.attrs,...t}),s&&c.marks.length&&c.marks.forEach(e=>{s===e.type&&i&&n.addMark(d,h,s.create({...e.attrs,...t}))}))}),a},sh=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o),l=s&&eA(s,e,t);return!!l&&(r&&r(n.tr.wrap(s,l).scrollIntoView()),!0)}})(i_(e,n.schema),t)(n,r),su=(e,t={})=>({state:n,dispatch:r})=>(function(e,t=null){return function(n,r){let{$from:i,$to:o}=n.selection,s=i.blockRange(o);if(!s)return!1;let l=r?n.tr:null;return!!function(e,t,n,r=null){let i=!1,o=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=s.resolve(t.start-2);o=new z(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new z(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let l=eA(o,n,r,t);return!!l&&(e&&function(e,t,n,r,i){let o=b.empty;for(let e=n.length-1;e>=0;e--)o=b.from(n[e].type.create(n[e].attrs,o));e.step(new eN(t.start-2*!!r,t.end,t.start,t.end,new O(o,0,0),n.length,!0));let s=0;for(let e=0;e<n.length;e++)n[e].type==i&&(s=e+1);let l=n.length-s,a=t.start+n.length-2*!!r,c=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&eP(e.doc,a,l)&&(e.split(a,l),a+=2*l),a+=c.child(n).nodeSize}(e,t,l,i,n),!0)}(l,s,e,t)&&(r&&r(l.scrollIntoView()),!0)}})(i_(e,n.schema),t)(n,r),sp=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}};function sf(e){return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function sm(e){if(!(null==e?void 0:e.trim()))return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([\w-]+)/g);i&&(t.class=i.map(e=>e.trim().slice(1)).join(" "));let o=r.match(/(?:^|\s)#([\w-]+)/);o&&(t.id=o[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var i;let o=n[parseInt((null==(i=r.match(/__QUOTED_(\d+)__/))?void 0:i[1])||"0",10)];o&&(t[e]=o.slice(1,-1))});let s=r.replace(/(?:^|\s)\.([\w-]+)/g,"").replace(/(?:^|\s)#([\w-]+)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return s&&s.split(/\s+/).filter(Boolean).forEach(e=>
2{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function sg(e){if(!e||0===Object.keys(e).length)return"";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function sy(e){let{nodeName:t,name:n,parseAttributes:r=sm,serializeAttributes:i=sg,defaultAttributes:o={},requiredAttributes:s=[],allowedAttributes:l}=e,a=n||t;return{parseMarkdown:(e,n)=>{let r={...o,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${a}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,i){let o=RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),l=e.match(o);if(!l)return;let c=r(l[1]||"");if(!s.find(e=>!(e in c)))return{type:t,raw:l[0],attributes:c}}},renderMarkdown:e=>{let t=i((e=>{if(!l)return e;let t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),n=t?` {${t}}`:"";return`:::${a}${n} :::`}}}function sx(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=sm,serializeAttributes:o=sg,defaultAttributes:s={},content:l="block",allowedAttributes:a}=e,c=n||t;return{parseMarkdown:(e,n)=>{let i;if(r){let t=r(e);i="string"==typeof t?[{type:"text",text:t}]:t}else i="block"===l?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);let o={...s,...e.attributes};return n.createNode(t,o,i)},markdownTokenizer:{name:t,level:"block",start(e){var t;let n=RegExp(`^:::${c}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var o;let s=RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),a=e.match(s);if(!a)return;let[d,h=""]=a,u=i(h),p=1,f=d.length,m="",g=/^:::([\w-]*)(\s.*)?/gm,y=e.slice(f);for(g.lastIndex=0;;){let n=g.exec(y);if(null===n)break;let i=n.index,s=n[1];if(null==(o=n[2])||!o.endsWith(":::")){if(s)p+=1;else if(0==(p-=1)){let o=y.slice(0,i);m=o.trim();let s=e.slice(0,f+i+n[0].length),a=[];if(m)if("block"===l)for((a=r.blockTokens(o)).forEach(e=>{e.text&&(!e.tokens||0===e.tokens.length)&&(e.tokens=r.inlineTokens(e.text))});a.length>0;){let e=a[a.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;a.pop()}else a=r.inlineTokens(m);return{type:t,raw:s,attributes:u,content:m,tokens:a}}}}}},renderMarkdown:(e,t)=>{let n=o((e=>{if(!a)return e;let t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{})),r=n?` {${n}}`:"",i=t.renderChildren(e.content||[],"\n\n");return`:::${c}${r} 3 4${i} 5 6:::`}}}function sv(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;null!==r;){let[,i,o,s]=r;t[i]=o||s,r=n.exec(e)}return t}function sb(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function sw(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=sv,serializeAttributes:o=sb,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=e,c=n||t,d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{let i={...s,...e.attributes};if(l)return n.createNode(t,i);let o=r?r(e):e.content||"";return o?n.createNode(t,i,[n.createTextNode(o)]):n.createNode(t,i,[])},markdownTokenizer:{name:t,level:"inline",start(e){let t=l?RegExp(`\\[${d}\\s*[^\\]]*\\]`):RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){let o=l?RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),s=e.match(o);if(!s)return;let a="",c="";if(l){let[,e]=s;c=e}else{let[,e,t]=s;c=e,a=t||""}let h=i(c.trim());return{type:t,raw:s[0],content:a.trim(),attributes:h}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));let n=o((e=>{if(!a)return e;let t={};return a.forEach(n=>{let r="string"==typeof n?n:n.name,i="string"==typeof n?void 0:n.skipIfDefault;if(r in e){let n=e[r];if(void 0!==i&&n===i)return;t[r]=n}}),t})(e.attrs||{})),i=n?` ${n}`:"";return l?`[${c}${i}]`:`[${c}${i}]${t}[/${c}]`}}}function sk(e,t,n){var r,i,o,s;let l=e.split("\n"),a=[],c="",d=0,h=t.baseIndentSize||2;for(;d<l.length;){let e,u=l[d],p=u.match(t.itemPattern);if(!p)if(a.length>0)break;else{if(""!==u.trim())return;d+=1,c=`${c}${u} 7`;continue}let f=t.extractItemData(p),{indentLevel:m,mainContent:g}=f;c=`${c}${u} 8`;let y=[g];for(d+=1;d<l.length;){let e=l[d];if(""===e.trim()){let t=l.slice(d+1).findIndex(e=>""!==e.trim());if(-1===t)break;
8if(((null==(i=null==(r=l[d+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:i.length)||0)>m){y.push(e),c=`${c}${e} 9`,d+=1;continue}break}if(((null==(s=null==(o=e.match(/^(\s*)/))?void 0:o[1])?void 0:s.length)||0)>m)y.push(e),c=`${c}${e} 10`,d+=1;else break}let x=y.slice(1);if(x.length>0){let r=x.map(e=>e.slice(m+h)).join("\n");r.trim()&&(e=t.customNestedParser?t.customNestedParser(r):n.blockTokens(r))}let v=t.createToken(f,e);a.push(v)}if(0!==a.length)return{items:a,raw:c}}function sS(e,t,n,r){if(!e||!Array.isArray(e.content))return"";let i="function"==typeof n?n(r):n,[o,...s]=e.content,l=t.renderChildren([o]),a=`${i}${l}`;return s&&s.length>0&&s.forEach((e,n)=>{var r,i;let o=null!=(i=null==(r=t.renderChild)?void 0:r.call(t,e,n+1))?i:t.renderChildren([e]);if(null!=o){let n=o.split("\n").map(e=>e?t.indent(e):t.indent("")).join("\n");a+="paragraph"===e.type?` 11 12${n}`:` 13${n}`}}),a}function sC(e){var t;let{editor:n,from:r,to:i,text:o,rules:s,plugin:l}=e,{view:a}=n;if(a.composing)return!1;let c=a.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let d=!1,h=((e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,o)=>{var s,l;let a=(null==(l=(s=e.type.spec).toText)?void 0:l.call(s,{node:e,pos:t,parent:i,index:o}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?a:a.slice(0,Math.max(0,r-t))}),n})(c)+o;return s.forEach(e=>{if(d)return;let t=((e,t)=>{if(iz(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(h,e.find);if(!t)return;let s=t[0].length-o.length;if(s>0){let e=c.parentOffset-s;if(e<0||c.parent.textBetween(e,c.parentOffset)!==t[0].slice(0,s))return}let u=a.state.tr,p=ib({state:a.state,transaction:u}),f={from:r-(t[0].length-o.length),to:i}
13,{commands:m,chain:g,can:y}=new iw({editor:n,state:p});null!==e.handler({state:p,range:f,match:t,commands:m,chain:g,can:y})&&u.steps.length&&(e.undoable&&u.setMeta(l,{transform:u,from:r,to:i,text:o}),a.dispatch(u),d=!0)}),d}iv({},{createAtomBlockMarkdownSpec:()=>sy,createBlockMarkdownSpec:()=>sx,createInlineMarkdownSpec:()=>sw,parseAttributes:()=>sm,parseIndentedBlocks:()=>sk,renderNestedMarkdownContent:()=>sS,serializeAttributes:()=>sg});var sM=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...o_(oO(this,"addOptions",{name:this.name}))}}get storage(){return{...o_(oO(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>(function e(t,n){let r={...t};return sf(t)&&sf(n)&&Object.keys(n).forEach(i=>{sf(n[i])&&sf(t[i])?r[i]=e(t[i],n[i]):r[i]=n[i]}),r})(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},sO=class e extends sM{constructor(){super(...arguments),this.type="mark"}static create(t={}){return new e("function"==typeof t?t():t)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;let o=i.find(e=>(null==e?void 0:e.type.name)===t.name);return o&&n.removeStoredMark(o),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},sT=null,sN=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=oB(e),this.schema=function(e,t){var n;let r=oA(e),{nodeExtensions:i,markExtensions:o}=oD(e),s=null==(n=i.find(e=>oO(e,"topNode")))?void 0:n.name;return new ee({topNode:s,nodes:Object.fromEntries(i.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=oz({...e.reduce((e,t)=>{let r=oO(t,"extendNodeSchema",o);return{...e,...r?r(n):{}}},{}),content:o_(oO(n,"content",o)),marks:o_(oO(n,"marks",o)),group:o_(oO(n,"group",o)),inline:o_(oO(n,"inline",o)),atom:o_(oO(n,"atom",o)),selectable:o_(oO(n,"selectable",o)),draggable:o_(oO(n,"draggable",o)),code:o_(oO(n,"code",o)),whitespace:o_(oO(n,"whitespace",o)),linebreakReplacement:o_(oO(n,"linebreakReplacement",o)),defining:o_(oO(n,"defining",o)),isolating:o_(oO(n,"isolating",o)),attrs:Object.fromEntries(i.map(o$))}),l=o_(oO(n,"parseHTML",o));l&&(s.parseDOM=l.map(e=>oP(e,i)));let a=oO(n,"renderHTML",o);a&&(s.toDOM=e=>a({node:e,HTMLAttributes:oI(e,i)}));let c=oO(n,"renderText",o);return c&&(s.toText=c),[n.name,s]})),marks:Object.fromEntries(o.map(n=>{let i=r.filter(e=>e.type===n.name),o={name:n.name,options:n.options,storage:n.storage,editor:t},s=oz({...e.reduce((e,t)=>{let r=oO(t,"extendMarkSchema",o);return{...e,...r?r(n):{}}},{}),inclusive:o_(oO(n,"inclusive",o)),excludes:o_(oO(n,"excludes",o)),group:o_(oO(n,"group",o)),spanning:o_(oO(n,"spanning",o)),code:o_(oO(n,"code",o)),attrs:Object.fromEntries(i.map(o$))}),l=o_(oO(n,"parseHTML",o));l&&(s.parseDOM=l.map(e=>oP(e,i)));let a=oO(n,"renderHTML",o);return a&&(s.toDOM=e=>a({mark:e,HTMLAttributes:oI(e,i)})),[n.name,s]}))})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:oW(t.name,this.schema)},r=oO(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this;return oF([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:oW(t.name,this.schema)},r=[],i=oO(t,"addKeyboardShortcuts",n),o={};if("mark"===t.type&&oO(t,"exitable",n)&&(o.ArrowRight=()=>sO.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));o={...o,...t}}let s=new ta({props:{handleKeyDown:iy(o)}});r.push(s);let l=oO(t,"addInputRules",n);if(oJ(t,e.options.enableInputRules)&&l){let t=l();if(t&&t.length){let n=function(e){let{editor:t,rules:n}=e,r=new ta({state:{init:()=>null,apply(e,i,o){let s=e.getMeta(r);if(s)return s;let l=e.getMeta("applyInputRules");return l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=oN(b.from(e),o.schema));let{from:i}=l,s=i+e.length;sC({editor:t,from:i,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput:(e,i,o,s)=>sC({editor:t,from:i,to:o,text:s,rules:n,plugin:r}),handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&sC({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if("Enter"!==i.key)return!1;let{$cursor:o}=e.state.selection;return!!o&&sC({editor:t,from:o.pos,to:o.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let a=oO(t,"addPasteRules",n);if(oJ(t,e.options.enablePasteRules)&&a){let t=a();if(t&&t.length){let n=function(e){let t,{editor:n,rules:r}=e,i=null,o=!1,s=!1,l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}let a=({state:e,from:r,to:i,rule:o,pasteEvt:s})=>{let a=e.tr;if(function(e){let{editor:t,state:n,from:r,to:i,rule:o,pasteEvent:s,dropEvent:l}=e,{commands:a,chain:c,can:d}=new iw({editor:t,state:n}),h=[];return n.doc.nodesBetween(r,i,(e,t)=>{var u,p,f,m,g;if((null==(p=null==(u=e.type)?void 0:u.spec)?void 0:p.code)||!(e.isText||e.isTextblock||e.isInline))return;let y=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,x=Math.max(r,t),v=Math.min(i,t+y);x>=v||((e,t,n)=>{if(iz(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(x-t,v-t,void 0,""),o.find,s).forEac
13h(e=>{if(void 0===e.index)return;let t=x+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},u=o.handler({state:n,range:i,match:e,commands:a,chain:c,can:d,pasteEvent:s,dropEvent:l});h.push(u)})}),h.every(e=>null!==e)}({editor:n,state:ib({state:e,transaction:a}),from:Math.max(r-1,0),to:i.b-1,rule:o,pasteEvent:s,dropEvent:t})&&a.steps.length){try{t="u">typeof DragEvent?new DragEvent("drop"):null}catch{t=null}return l="u">typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return r.map(e=>new ta({view(e){let t=t=>{var r;(i=(null==(r=e.dom.parentElement)?void 0:r.contains(t.target))?e.dom.parentElement:null)&&(sT=n)},r=()=>{sT&&(sT=null)};return window.addEventListener("dragstart",t),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",t),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,n)=>{if(s=i===e.dom.parentElement,t=n,!s){let e=sT;(null==e?void 0:e.isEditable)&&setTimeout(()=>{let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;let r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return l=t,o=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{let i=t[0],c="paste"===i.getMeta("uiEvent")&&!o,d="drop"===i.getMeta("uiEvent")&&!s,h=i.getMeta("applyPasteRules"),u=!!h;if(!c&&!d&&!u)return;if(u){var p,f;let t,{text:n}=h;"string"==typeof n||(n=oN(b.from(n),r.schema));let{from:i}=h,o=i+n.length;return a({rule:e,state:r,from:i,to:{b:o},pasteEvt:(p=n,null==(f=(t=new ClipboardEvent("paste",{clipboardData:new DataTransfer})).clipboardData)||f.setData("text/html",p),t)})}let m=n.doc.content.findDiffStart(r.doc.content),g=n.doc.content.findDiffEnd(r.doc.content);if("number"==typeof m&&g&&m!==g.b)return a({rule:e,state:r,from:m,to:g,pasteEvt:l})}}))}({editor:e,rules:t});r.push(...n)}}let c=oO(t,"addProseMirrorPlugins",n);if(c){let e=c();r.push(...e)}return r})}get attributes(){return oA(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=oD(this.extensions);return Object.fromEntries(t.filter(e=>!!oO(e,"addNodeView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:i_(t.name,this.schema)},i=oO(t,"addNodeView",r);if(!i)return[];let o=i();return o?[t.name,(r,i,s,l,a)=>{let c=oI(r,n);return o({node:r,view:i,getPos:s,decorations:l,innerDecorations:a,editor:e,extension:t,HTMLAttributes:c})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return oF([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:oW(n.name,this.schema)},i=oO(n,"dispatchTransaction",r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return oF([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:oW(n.name,this.schema)},i=oO(n,"transformPastedHTML",r);return i?(t,n)=>{let o=e(t,n);return i.call(r,o)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=oD(this.extensions);return Object.fromEntries(t.filter(e=>!!oO(e,"addMarkView")).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:iL(t.name,this.schema)},i=oO(t,"addMarkView",r);return i?[t.name,(r,o,s)=>{let l=oI(r,n);return i()({mark:r,view:o,inline:s,editor:e,extension:t,HTMLAttributes:l,updateAttributes:t=>{!function(e,t,n={}){let{state:r}=t,{doc:i,tr:o}=r;i.descendants((t,r)=>{let i=o.mapping.map(r),s=o.mapping.map(r)+t.nodeSize,l=null;if(t.marks.forEach(t=>{if(t!==e)return!1;l=t}),!l)return;let a=!1;if(Object.keys(n).forEach(e=>{n[e]!==l.attrs[e]&&(a=!0)}),a){let t=e.type.create({...e.attrs,...n});o.removeMark(i,s,e.type),o.addMark(i,s,t)}}),o.docChanged&&t.view.dispatch(o)}(r,e,t)}})}]:[]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>
13[e.name,e.storage])),e.forEach(e=>{var t,n;let r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:oW(e.name,this.schema)};"mark"===e.type&&((null==(t=o_(oO(e,"keepOnSplit",r)))||t)&&this.splittableMarks.push(e.name),null==(n=o_(oO(e,"clearable",r)))||n||this.nonClearableMarks.push(e.name));let i=oO(e,"onBeforeCreate",r),o=oO(e,"onCreate",r),s=oO(e,"onUpdate",r),l=oO(e,"onSelectionUpdate",r),a=oO(e,"onTransaction",r),c=oO(e,"onFocus",r),d=oO(e,"onBlur",r),h=oO(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),h&&this.editor.on("destroy",h)})}};sN.resolve=oB,sN.sort=oF,sN.flatten=oT,iv({},{ClipboardTextSerializer:()=>s_,Commands:()=>sD,Delete:()=>sA,Drop:()=>sj,Editable:()=>sR,FocusEvents:()=>sP,Keymap:()=>sz,Paste:()=>s$,Tabindex:()=>sF,TextDirection:()=>sB,focusEventsPluginKey:()=>sI});var sE=class e extends sM{constructor(){super(...arguments),this.type="extension"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},s_=sE.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new ta({key:new th("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,o=oL(n),{blockSeparator:s}=this.options,l={...void 0!==s?{blockSeparator:s}:{},textSerializers:o};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>oV(r,{from:e.pos,to:t.pos},l)).join(null!=s?s:"\n\n")}}})]}}),sD=sE.create({name:"commands",addCommands:()=>({...ik})}),sA=sE.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,i;let o=()=>{var n,r,i,o,s,l;let a;if(null!=(o=null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:i.call(r,e))?o:e.getMeta("y-sync$"))return;let c=(s=e.before,l=[e,...t],a=new eX(s),l.forEach(e=>{e.steps.forEach(e=>{a.step(e)})}),a);
13oq(c).forEach(t=>{c.mapping.mapResult(t.oldRange.from).deletedAfter&&c.mapping.mapResult(t.oldRange.to).deletedBefore&&c.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let i=r+n.nodeSize-2,o=t.oldRange.from<=r&&i<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:i,newFrom:c.mapping.map(r),newTo:c.mapping.map(i),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:c})})});let d=c.mapping;c.steps.forEach((t,n)=>{var r,i;if(t instanceof eC){let o=d.slice(n).map(t.from,-1),s=d.slice(n).map(t.to),l=d.invert().map(o,-1),a=d.invert().map(s),h=o>0&&(null==(r=c.doc.nodeAt(o-1))?void 0:r.marks.some(e=>e.eq(t.mark))),u=null==(i=c.doc.nodeAt(s))?void 0:i.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:l,to:a},newRange:{from:o,to:s},partial:!!(u||h),editor:this.editor,transaction:e,combinedTransform:c})}})};null==(i=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||i?setTimeout(o,0):o()}}),sj=sE.create({name:"drop",addProseMirrorPlugins(){return[new ta({key:new th("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),sR=sE.create({name:"editable",addProseMirrorPlugins(){return[new ta({key:new th("editable"),props:{editable:()=>this.editor.options.editable}})]}}),sI=new th("focusEvents"),sP=sE.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new ta({key:sI,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),sz=sE.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:o}=n,{pos:s,parent:l}=o,a=o.parent.isTextblock&&s>0?t.doc.resolve(s-1):o,c=a.parent.type.spec.isolating,d=o.pos-o.parentOffset,h=c&&1===a.parent.childCount?d===o.pos:e0.atStart(r).from===s;return!!i&&!!l.type.isTextblock&&!l.textContent.length&&!!h&&(!h||"paragraph"!==o.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return iZ()||oi()?i:r},addProseMirrorPlugins(){return[new ta({key:new th("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta("preventClearDocument"));if(!r||i)return;let{empty:o,from:s,to:l}=t.selection,a=e0.atStart(t.doc).from,c=e0.atEnd(t.doc).to;if(o||s!==a||l!==c||!oZ(n.doc))return;let d=n.tr,h=ib({state:n,transaction:d}),{commands:u}=new iw({editor:this.editor,state:h});if(u.clearNodes(),d.steps.length)return d}})]}}),s$=sE.create({name:"paste",addProseMirrorPlugins(){return[new ta({key:new th("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),sF=sE.create({name:"tabindex",addOptions:()=>({value:void 0}),addProseMirrorPlugins(){return[new ta({key:new th("tabindex"),props:{attributes:()=>{var e;return this.editor.isEditable||void 0!==this.options.value?{tabindex:null!=(e=this.options.value)?e:"0"}:{}}}})]}}),sB=sE.create({name:"textDirection",addOptions:()=>({direction:void 0}),addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=oD(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute("dir");return t&&("ltr"===t||"rtl"===t||"auto"===t)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new ta({key:new th("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),sV=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}
13get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(0===this.depth)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1);return new e(this.resolvedPos.doc.resolve(t),this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,s=n.isInline,l=this.pos+r+ +!o;if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;let a=this.resolvedPos.doc.resolve(l);if(!i&&!s&&a.depth<=this.depth)return;let c=new e(a,this.editor,i,i||s?n:null);i&&(c.actualDepth=this.depth+1),t.push(c)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;let i=Object.keys(t);return this.children.forEach(o=>{n&&r.length>0||(o.node.type.name===e&&i.every(e=>t[e]===o.node.attrs[e])&&r.push(o),n&&r.length>0||(r=r.concat(o.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},sL=`.ProseMirror { 14 position: relative; 15} 16 17.ProseMirror { 18 word-wrap: break-word; 19 white-space: pre-wrap; 20 white-space: break-spaces; 21 -webkit-font-variant-ligatures: none; 22 font-variant-ligatures: none; 23 font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */ 24} 25 26.ProseMirror [contenteditable="false"] { 27 white-space: normal; 28} 29 30.ProseMirror [contenteditable="false"] [contenteditable="true"] { 31 white-space: pre-wrap; 32} 33 34.ProseMirror pre { 35 white-space: pre-wrap; 36} 37 38img.ProseMirror-separator { 39 display: inline !important; 40 border: none !important; 41 margin: 0 !important; 42 width: 0 !important; 43 height: 0 !important; 44} 45 46.ProseMirror-gapcursor { 47 display: none; 48 pointer-events: none; 49 position: absolute; 50 margin: 0; 51} 52 53.ProseMirror-gapcursor:after { 54 content: ""; 55 display: block; 56 position: absolute; 57 top: -2px; 58 width: 20px; 59 border-top: 1px solid black; 60 animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite; 61} 62 63@keyframes ProseMirror-cursor-blink { 64 to { 65 visibility: hidden; 66 } 67} 68 69.ProseMirror-hideselection *::selection { 70 background: transparent; 71} 72 73.ProseMirror-hideselection *::-moz-selection { 74 background: transparent; 75} 76 77.ProseMirror-hideselection * { 78 caret-color: transparent; 79} 80 81.ProseMirror-focused .ProseMirror-gapcursor { 82 display: block; 83}`,sq=class extends sp{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"u">typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:oY,createMappablePosition:oX},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit
83("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc();if(!this.editorState){const e=iJ(t,this.options.autofocus);this.editorState=tl.create({doc:t,schema:this.schema,selection:e||void 0})}this.options.element&&this.mount(this.options.element)}mount(e){if("u"<typeof document)throw Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){let e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"u">typeof document&&(this.css=function(e,t){let n=document.querySelector("style[data-tiptap-style]");if(null!==n)return n;let r=document.createElement("style");return t&&r.setAttribute("nonce",t),r.setAttribute("data-tiptap-style",""),r.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(r),r}(sL,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=oE(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t,n,r;let i=[...this.options.enableCoreExtensions?[sR,s_.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),sD,sP,sz,sF.configure({value:null==(r=null==(n=this.options.coreExtensionOptions)?void 0:n.tabindex)?void 0:r.value}),sj,s$,sA,sB.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new sN(i,this)}createCommandManager(){this.commandManager=new iw({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=ok(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;let e=ok(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=tl.create({doc:e,schema:this.schema,selection:iJ(e,this.options.autofocus)||void 0}
83),this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),this.editorState.doc}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,o=t.transformPastedHTML,s=this.extensionManager.transformPastedHTML(o);this.editorView=new ie(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:i,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let l=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(l),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)});return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let s=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),l=null==s?void 0:s.getMeta("focus"),a=null==s?void 0:s.getMeta("blur");l&&this.emit("focus",{editor:this,event:l.event,transaction:s}),a&&this.emit("blur",{editor:this,event:a.event,transaction:s}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||o.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){var t;let n;return t=this.state,"node"===(n=ou("string"==typeof e?e:e.name,t.schema))?function(e,t){let n=i_(t,e.schema),{from:r,to:i}=e.selection,o=[];e.doc.nodesBetween(r,i,e=>{o.push(e)});let s=o.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(t,e):"mark"===n?oC(t,e):{}}isActive(e,t){let n="string"==typeof e?e:null,r="string"==typeof e?t:e;return function(e,t,n={}){if(!t)return ol(e,null,n)||oH(e,null,n);let r=ou(t,e.schema);return"node"===r?ol(e,t,n):"mark"===r&&oH(e,t,n)}(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return oN(this.state.doc.content,this.schema)}getText(e){var t,n;let r,{blockSeparator:i="\n\n",textSerializers:o={}}=e||{};return t=this.state.doc,n={blockSeparator:i,textSerializers:{...oL(this.schema),...o}},r={from:0,to:t.content.size},oV(t,r,n)}get isEmpty(){return oZ(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new sV(t,this,!1,n)}get $doc(){return this.$pos(0)}},sW=class e extends sM{constructor(){super(...arguments),this.type="node"}static create(t={}){return new e("function"==typeof t?t():t)}configure(e){return super.configure(e)}extend(e){let t="function"==typeof e?e():e;return super.extend(t)}},sU=sW.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),sH=sW.create({name:"hardBreak",markdownTokenName:"br",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:e}){return["br",oR(this.options.HTMLAttributes,e)]},renderText:()=>"\n",renderMarkdown:()=>` 84`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>
84e.exitCode(),()=>e.command(()=>{let{selection:e,storedMarks:i}=n;if(e.$from.parent.type.spec.isolating)return!1;let{keepMarks:o}=this.options,{splittableMarks:s}=r.extensionManager,l=i||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&l&&o){let t=l.filter(e=>s.includes(e.type.name));e.ensureMarks(t)}return!0}).scrollIntoView().run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),sJ=" ",sK=sW.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:e}){return["p",oR(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{let n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);let r=t.parseInline(n);return 1===n.length&&"text"===n[0].type&&(n[0].raw===sJ||n[0].text===sJ||"Â "===n[0].raw||"Â "===n[0].text)&&1===r.length&&"text"===r[0].type&&(r[0].text===sJ||"Â "===r[0].text)?t.createNode("paragraph",void 0,[]):t.createNode("paragraph",void 0,r)},renderMarkdown:(e,t,n)=>{var r,i;if(!e)return"";let o=Array.isArray(e.content)?e.content:[];if(0===o.length){let e=Array.isArray(null==(r=null==n?void 0:n.previousNode)?void 0:r.content)?n.previousNode.content:[];return(null==(i=null==n?void 0:n.previousNode)?void 0:i.type)==="paragraph"&&0===e.length?sJ:""}return t.renderChildren(o)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),sZ=sW.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""});class sG{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.lastDragEvent=null,this.width=null!=(n=t.width)?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){if(null!=this.cursorPos&&t.doc!=e.state.doc)if(this.lastDragEvent){let e=this.computeTarget(this.lastDragEvent);e==this.cursorPos?this.updateOverlay():this.setCursor(e)}else this.updateOverlay()}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t,n=this.editorView.state.doc.resolve(this.cursorPos),r=!n.parent.inlineContent,i,o=this.editorView.dom,s=o.getBoundingClientRect(),l=s.width/o.offsetWidth,a=s.height/o.offsetHeight;if(r){let e=n.nodeBefore,t=n.nodeAfter;if(e||t){let n=this.editorView.nodeDOM(this.cursorPos-(e?e.nodeSize:0));if(n){let r=n.getBoundingClientRect(),o=e?r.bottom:r.top;e&&t&&(o=(o+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let s=this.width/2*a;i={left:r.left,right:r.right,top:o-s,bottom:o+s}}}}if(!i){let e=this.editorView.coordsAtPos(this.cursorPos),t=this.width/2*l;i={left:e.left-t,right:e.left+t,top:e.top,bottom:e.bottom}}let c=this.editorView.dom.offsetParent;if(!this.element&&(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",r),this.element.classList.toggle("prosemirror-dropcursor-inline",!r),c&&(c!=document.body||"static"!=getComputedStyle(c).position)){let n=c.getBoundingClientRect(),r=n.width/c.offsetWidth,i=n.height/c.offsetHeight;e=n.left-c.scrollLeft*r,t=n.top-c.scrollTop*i}else e=-pageXOffset,t=-pageYOffset;this.element.style.left=(i.left-e)/l+"px",this.element.style.top=(i.top-t)/a+"px",this.element.style.width=(i.right-i.left)/l+"px",this.element.style.height=(i.bottom-i.top)/a+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}computeTarget(e){let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,i="function"==typeof r?r(this.editorView,t,e):r;if(!t||i)return null;let o=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=eB(this.editorView.state.doc,o,this.editorView.dragging.slice);null!=e&&(o=e)}return o}dragover(e){if(!this.editorView.editable)return;this.lastDragEvent=e;let t=this.computeTarget(e);null!=t&&(this.setCursor(t),this.scheduleRemoval(5e3))}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class sY extends e0{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return sY.valid(n)?new sY(n):e0.near(n)}content(){return O.empty}eq(e){return e instanceof sY&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw RangeError("Invalid input for GapCursor.fromJSON");return new sY(e.resolve(t.pos))}getBookmark(){return new sX(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0==n){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||sQ(e.type))return!0;
84if(e.inlineContent)return!1}}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||sQ(e.type))return!0;if(e.inlineContent)return!1}}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){r:for(;;){if(!n&&sY.valid(e))return e;let r=e.pos,i=null;for(let n=e.depth;;n--){let o=e.node(n);if(t>0?e.indexAfter(n)<o.childCount:e.index(n)>0){i=o.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(sY.valid(s))return s}for(;;){let o=t>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!e9.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),n=!1;continue r}break}i=o,r+=t;let s=e.doc.resolve(r);if(sY.valid(s))return s}return null}}}sY.prototype.visible=!1,sY.findFrom=sY.findGapCursorFrom,e0.jsonID("gapcursor",sY);class sX{constructor(e){this.pos=e}map(e){return new sX(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return sY.valid(t)?new sY(t):e0.near(t)}}function sQ(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}let s0=iy({ArrowLeft:s1("horiz",-1),ArrowRight:s1("horiz",1),ArrowUp:s1("vert",-1),ArrowDown:s1("vert",1)});function s1(e,t){let n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,i){let o=e.selection,s=t>0?o.$to:o.$from,l=o.empty;if(o instanceof e5){if(!i.endOfTextblock(n)||0==s.depth)return!1;l=!1,s=e.doc.resolve(t>0?s.after():s.before())}let a=sY.findGapCursorFrom(s,t,l);return!!a&&(r&&r(e.tr.setSelection(new sY(a))),!0)}}function s2(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!sY.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&e9.isSelectable(e.state.doc.nodeAt(i.inside)))&&(e.dispatch(e.state.tr.setSelection(new sY(r))),!0)}function s3(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof sY))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=b.empty;for(let e=r.length-1;e>=0;e--)i=b.from(r[e].createAndFill(null,i));let o=e.state.tr.replace(n.pos,n.pos,new O(i,0,0));return o.setSelection(e5.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function s5(e){if(!(e.selection instanceof sY))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",rq.create(e.doc,[rB.widget(e.selection.head,t,{key:"gapcursor"})])}var s4=function(){};s4.prototype.append=function(e){return e.length?(e=s4.from(e),!this.length&&e||e.length<200&&this.leafAppend(e)||this.length<200&&e.leafPrepend(this)||this.appendInner(e)):this},s4.prototype.prepend=function(e){return e.length?s4.from(e).append(this):this},s4.prototype.appendInner=function(e){return new s8(this,e)},s4.prototype.slice=function(e,t){return(void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t)?s4.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},s4.prototype.get=function(e){if(!(e<0)&&!(e>=this.length))return this.getInner(e)},s4.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},s4.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},s4.from=function(e){return e instanceof s4?e:e&&e.length?new s9(e):s4.empty};var s9=function(e){function t(t){e.call(this),this.values=t}t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var i=t;i<n;i++)if(!1===e(this.values[i],r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var i=t-1;i>=n;i--)if(!1===e(this.values[i],r+i))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=200)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=200)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(s4);s4.empty=new s9([]);var s8=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return t.__proto__=e,t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var i=this.left.length;if(t<i&&!1===this.left.forEachInner(e,t,Math.min(n,i),r)||n>i&&!1===this.right.forEachInner(e,Math.max(t-i,0),Math.min(this.length,n)-i,r+i))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){var i=this.left.length;if(t>i&&!1===this.right.forEachInvertedInner(e,t-i,Math.max(n,i)-i,r+i)||n<i&&!1===this.left.forEachInvertedInner(e,Math.min(t,i),n,r))return!1},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(s4);class s6{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){let n,r,i,o;if(0==this.eventCount)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}t&&(r=(n=this.remapping(s,this.items.length)).maps.length);let l=e.tr,a=[],c=[];
84return this.items.forEach((e,t)=>{if(!e.step){n||(r=(n=this.remapping(s,t+1)).maps.length),r--,c.push(e);return}if(n){c.push(new s7(e.map));let t=e.step.map(n.slice(r)),i;t&&l.maybeStep(t).doc&&(i=l.mapping.maps[l.mapping.maps.length-1],a.push(new s7(i,void 0,void 0,a.length+c.length))),r--,i&&n.appendMap(i,r)}else l.maybeStep(e.step);if(e.selection)return i=n?e.selection.map(n.slice(r)):e.selection,o=new s6(this.items.slice(0,s).append(c.reverse().concat(a)),this.eventCount-1),!1},this.items.length,0),{remaining:o,transform:l,selection:i}}addTransform(e,t,n,r){var i,o;let s,l=[],a=this.eventCount,c=this.items,d=!r&&c.length?c.get(c.length-1):null;for(let n=0;n<e.steps.length;n++){let i=e.steps[n].invert(e.docs[n]),o=new s7(e.mapping.maps[n],i,t),s;(s=d&&d.merge(o))&&(o=s,n?l.pop():c=c.slice(0,c.length-1)),l.push(o),t&&(a++,t=void 0),r||(d=o)}let h=a-n.depth;return h>lt&&(i=c,o=h,i.forEach((e,t)=>{if(e.selection&&0==o--)return s=t,!1}),c=i.slice(s),a-=h),new s6(c.append(l),a)}remapping(e,t){let n=new ex;return this.items.forEach((t,r)=>{let i=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,i)},e,t),n}addMaps(e){return 0==this.eventCount?this:new s6(this.items.append(e.map(e=>new s7(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),i=e.mapping,o=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let l=t;this.items.forEach(t=>{let r=i.getMirror(--l);if(null==r)return;o=Math.min(o,r);let a=i.maps[r];if(t.step){let o=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(i.slice(l+1,r));c&&s++,n.push(new s7(a,o,c))}else n.push(new s7(a))},r);let a=[];for(let e=t;e<o;e++)a.push(new s7(i.maps[e]));let c=new s6(this.items.slice(0,r).append(a).append(n),s);return c.emptyItemCount()>500&&(c=c.compress(this.items.length-n.length)),c}emptyItemCount(){let e=0;return this.items.forEach(t=>{!t.step&&e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],i=0;return this.items.forEach((o,s)=>{if(s>=e)r.push(o),o.selection&&i++;else if(o.step){let e=o.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let l=o.selection&&o.selection.map(t.slice(n));l&&i++;let a=new s7(s.invert(),e,l),c,d=r.length-1;(c=r.length&&r[d].merge(a))?r[d]=c:r.push(a)}}else o.map&&n--},this.items.length,0),new s6(s4.from(r.reverse()),i)}}s6.empty=new s6(s4.empty,0);class s7{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new s7(t.getMap().invert(),t,this.selection)}}}class le{constructor(e,t,n,r,i){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=i}}let lt=20;function ln(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,i)=>t.push(r,i));return t}function lr(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let i=t.map(e[r],1),o=t.map(e[r+1],-1);i<=o&&n.push(i,o)}return n}let li=!1,lo=null;function ls(e){let t=e.plugins;if(lo!=t){li=!1,lo=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){li=!0;break}}return li}let ll=new th("history"),la=new th("closeHistory");function lc(e,t){return(n,r)=>{let i=ll.getState(n);if(!i||0==(e?i.undone:i.done).eventCount)return!1;if(r){let o=function(e,t,n){let r=ls(t),i=ll.get(t).spec.config,o=(n?e.undone:e.done).popEvent(t,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),l=(n?e.done:e.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),a=new le(n?l:o.remaining,n?o.remaining:l,null,0,-1);return o.transform.setSelection(s).setMeta(ll,{redo:n,historyState:a})}(i,n,e);o&&r(t?o.scrollIntoView():o)}return!0}}let ld=lc(!1,!0),lh=lc(!0,!0);lc(!1,!1),lc(!0,!1),sE.create({name:"characterCount",addOptions:()=>({limit:null,autoTrim:!0,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}),addStorage:()=>({characters:()=>0,words:()=>0}),onBeforeCreate(){this.storage.characters=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){let e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{let t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new ta({key:new th("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;let i=this.options.limit,o=this.options.autoTrim;if(null==i||0===i||!1===o){e=!0;return}let s=this.storage.characters({node:r.doc});if(s>i){console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);let t=r.tr.deleteRange(0,s-i);return e=!0,t}e=!0},filterTransaction:(e,t)=>{let n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;let r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=n||r>n&&i>n&&i<=r)return!0;
84if(r>n&&i>n&&i>r||!e.getMeta("paste"))return!1;let o=e.selection.$head.pos;return e.deleteRange(o-(i-n),o),!(this.storage.characters({node:e.doc})>n)}})]}}),sE.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[function(e={}){return new ta({view:t=>new sG(t,e)})}(this.options)]}}),sE.create({name:"focus",addOptions:()=>({className:"has-focus",mode:"all"}),addProseMirrorPlugins(){return[new ta({key:new th("focus"),props:{decorations:({doc:e,selection:t})=>{let{isEditable:n,isFocused:r}=this.editor,{anchor:i}=t,o=[];if(!n||!r)return rq.create(e,[]);let s=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(!e.isText){if(!(i>=t&&i<=t+e.nodeSize-1))return!1;s+=1}});let l=0;return e.descendants((e,t)=>!e.isText&&!!(i>=t&&i<=t+e.nodeSize-1)&&((l+=1,"deepest"===this.options.mode&&s-l>0||"shallowest"===this.options.mode&&l>1)?"deepest"===this.options.mode:void o.push(rB.node(t,t+e.nodeSize,{class:this.options.className})))),rq.create(e,o)}}})]}}),sE.create({name:"gapCursor",addProseMirrorPlugins:()=>[new ta({props:{decorations:s5,createSelectionBetween:(e,t,n)=>t.pos==n.pos&&sY.valid(n)?new sY(n):null,handleClick:s2,handleKeyDown:s0,handleDOMEvents:{beforeinput
84:s3}}})],extendNodeSchema(e){var t;let n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:null!=(t=o_(oO(e,"allowGapCursor",n)))?t:null}}});var lu="placeholder",lp=new th("tiptap__placeholder");function lf(e){let{editor:t,placeholder:n,dataAttribute:r,pos:i,node:o,isEmptyDoc:s,hasAnchor:l,classes:{emptyNode:a,emptyEditor:c}}=e,d=[a];return s&&d.push(c),rB.node(i,i+o.nodeSize,{class:d.join(" "),[r]:"function"==typeof n?n({editor:t,node:o,pos:i,hasAnchor:l}):n})}function lm(e,t){return"function"==typeof e?e(t):e}function lg({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:o,to:s}){let{anchor:l}=i,a=[],c=e.isEmpty;return r.nodesBetween(o,s,(r,i)=>{let o=l>=i&&l<=i+r.nodeSize,s=!r.isLeaf&&oZ(r);return r.type.isTextblock&&(o||!t.showOnlyCurrent)&&s&&a.push(lf({editor:e,isEmptyDoc:c,dataAttribute:n,hasAnchor:o,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:lm(t.emptyNodeClass,{editor:e,node:r,pos:i,hasAnchor:o})},node:r,pos:i})),t.includeChildren}),a}function ly({editor:e,options:t,dataAttribute:n,doc:r,selection:i}){if(!(e.isEditable||!t.showOnlyWhenEditable))return null;let{anchor:o}=i,s=[],l=e.isEmpty;if(t.showOnlyCurrent&&!t.includeChildren){let i=r.resolve(o),a=i.depth>0?i.node(1):i.nodeAfter,c=i.depth>0?i.before(1):o;if(a&&a.type.isTextblock&&oZ(a)){let r=o>=c&&o<=c+a.nodeSize;s.push(lf({editor:e,isEmptyDoc:l,dataAttribute:n,hasAnchor:r,placeholder:t.placeholder,classes:{emptyEditor:t.emptyEditorClass,emptyNode:lm(t.emptyNodeClass,{editor:e,node:a,pos:c,hasAnchor:r})},node:a,pos:c}))}}else s.push(...lg({editor:e,options:t,dataAttribute:n,doc:r,selection:i,from:0,to:r.content.size}));return rq.create(r,s)}function lx(e,t){var n;let r=e.resolve(t);if(0===r.depth){let e=null!=(n=r.nodeAfter)?n:r.nodeBefore;if(!e)return{from:t,to:t};let i=r.nodeAfter?t:t-e.nodeSize;return{from:i,to:i+e.nodeSize}}let i=r.before(1);return{from:i,to:i+r.node(1).nodeSize}}function lv(e,t){return{from:Math.max(0,t.from-1),to:Math.min(e.content.size,t.to-1)}}var lb=sE.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:lu,placeholder:"Write something â¦",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[function({editor:e,options:t}){let n=t.dataAttribute?`data-${t.dataAttribute.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${lu}`,r=t.showOnlyCurrent&&!t.includeChildren;return new ta({key:lp,...r?{}:{state:function({editor:e,options:t,dataAttribute:n}){return{init(r,i){let o=ly({editor:e,options:t,dataAttribute:n,doc:i.doc,selection:i.selection});return null!=o?o:rq.empty},apply:(r,i,o,s)=>r.docChanged||r.selectionSet?function({decorations:e,ranges:t,editor:n,options:r,dataAttribute:i,doc:o,selection:s}){let l=e;for(let e of t){let{from:t,to:a}=function(e,t,n){let r=Math.max(0,Math.min(e,n.content.size)),i=Math.max(r,Math.min(t,n.content.size));return{from:r,to:i}}(e.from,e.to,o),c=l.find(t,a).filter(e=>e.from>=t&&e.to<=a);c.length&&(l=l.remove(c));let d=lg({editor:n,options:r,dataAttribute:i,doc:o,selection:s,from:t,to:a});d.length&&(l=l.add(o,d))}return l}({decorations:i.map(r.mapping,r.doc),ranges:function(e,t,n){let r=[];if(e.docChanged)for(let t of oq(e))r.push(...function(e,t){var n,r;let i,o=(n=t.from,r=t.to,i=[],e.forEach((e,t)=>{let o=t+e.nodeSize,s=o+1;t+1<r&&s>n&&i.push({from:t,to:o})}),i);return o.push(lv(e,lx(e,t.from))),t.to>t.from?o.push(lv(e,lx(e,Math.min(t.to,e.content.size+1)-1))):t.from<e.content.size+1&&o.push(lv(e,lx(e,Math.min(t.from+1,e.content.size)))),o}(n.doc,t.newRange));return e.selectionSet&&(r.push(lv(n.doc,lx(n.doc,e.mapping.map(t.selection.anchor)))),r.push(lv(n.doc,lx(n.doc,n.selection.anchor)))),function(e){if(0===e.length)return[];let t=[...e].sort((e,t)=>e.from-t.from),n=[{...t[0]}];for(let e=1;e<t.length;e+=1){let r=n[n.length-1],i=t[e];i.from<=r.to?r.to=Math.max(r.to,i.to):n.push({...i})}return n}(r)}(r,o,s),editor:e,options:t,dataAttribute:n,doc:s.doc,selection:s.selection}):i}}({editor:e,options:t,dataAttribute:n})},props:{decorations:r?({doc:r,selection:i})=>ly({editor:e,options:t,dataAttribute:n,doc:r,selection:i}):n=>{var r;return t.showOnlyWhenEditable&&!e.isEditable?rq.empty:null!=(r=lp.getState(n))?r:rq.empty}}})}({editor:this.editor,options:this.options})]}});function lw(e,t){return!e.selection.empty&&!(e.selection instanceof e9)&&t.isEditable}function lk({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}sE.create({name:"selection",addOptions:()=>({className:"selection"}),addProseMirrorPlugins(){let{editor:e,options:t}=this;return[new ta({key:new th("selection"),props:{decorations:n=>!lw(n,e)||e.isFocused||e.view.dragging?null:rq.create(n.doc,[rB.inl
84ine(n.selection.from,n.selection.to,{class:t.className})]),handleDOMEvents:{blur(t){var n;return!!lw(t.state,e)&&(null==(n=window.getSelection())||n.removeAllRanges(),!1)},focus:t=>!!lw(t.state,e)&&(requestAnimationFrame(()=>{!e.isDestroyed&&t.hasFocus()&&t.focus()}),!1)}}})]}}),sE.create({name:"trailingNode",addOptions:()=>({node:void 0,notAfter:[]}),addProseMirrorPlugins(){var e;let t=new th(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new ta({key:t,appendTransaction:(e,r,i)=>{let{doc:o,tr:s,schema:l}=i,a=t.getState(i),c=o.content.size,d=l.nodes[n];if(!e.some(e=>e.getMeta("skipTrailingNode"))&&a)return s.insert(c,d.create())},state:{init:(e,t)=>!lk({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>!e.docChanged||e.getMeta("__uniqueIDTransaction")?t:!lk({node:e.doc.lastChild,types:r})}})]}});var lS=sE.create({name:"undoRedo",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:e,dispatch:t})=>ld(e,t),redo:()=>({state:e,dispatch:t})=>lh(e,t)}),addProseMirrorPlugins(){return[function(e={}){return new ta({key:ll,state:{init:()=>new le(s6.empty,s6.empty,null,0,-1),apply:(t,n,r)=>(function(e,t,n,r){let i=n.getMeta(ll),o;if(i)return i.historyState;n.getMeta(la)&&(e=new le(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(ll))if(s.getMeta(ll).redo)return new le(e.done.addTransform(n,void 0,r,ls(t)),e.undone,ln(n.mapping.maps),e.prevTime,e.prevComposition);else return new le(e.done,e.undone.addTransform(n,void 0,r,ls(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))if(o=n.getMeta("rebased"))return new le(e.done.rebased(n,o),e.undone.rebased(n,o),lr(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);else return new le(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),lr(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let i=n.getMeta("composition"),o=0==e.prevTime||!s&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let i=0;i<t.length;i+=2)e<=t[i+1]&&r>=t[i]&&(n=!0)}),n}(n,e.prevRanges)),l=s?lr(e.prevRanges,n.mapping):ln(n.mapping.maps);return new le(e.done.addTransform(n,o?t.selection.getBookmark():void 0,r,ls(t)),s6.empty,l,n.time,null==i?e.prevComposition:i)}})(n,r,t,e)},config:e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?ld:"historyRedo"==n?lh:null;return!!r&&!!e.editable&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Ñ":()=>this.editor.commands.undo(),"Shift-Mod-Ñ":()=>this.editor.commands.redo()}}});e.i(718227);var lC=o,lM=e.i(783164),lO=e.i(477526);let{getOwnPropertyNames:lT,getOwnPropertySymbols:lN}=Object,{hasOwnProperty:lE}=Object.prototype;function l_(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function lD(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 lA(e){return lT(e).concat(lN(e))}let lj=Object.hasOwn||((e,t)=>lE.call(e,t));function lR(e,t){return e===t||!e&&!t&&e!=e&&t!=t}let{getOwnPropertyDescriptor:lI,keys:lP}=Object;function lz(e,t){return e.byteLength===t.byteLength&&lZ(new Uint8Array(e),new Uint8Array(t))}function l$(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 lF(e,t){return e.byteLength===t.byteLength&&lZ(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function lB(e,t){return lR(e.getTime(),t.getTime())}function lV(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function lL(e,t){return e===t}function lq(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;
84){let o=t.entries(),l=!1,c=0;for(;(i=o.next())&&!i.done;){if(s[c]){c++;continue}let o=r.value,d=i.value;if(n.equals(o[0],d[0],a,c,e,t,n)&&n.equals(o[1],d[1],o[0],d[0],e,t,n)){l=s[c]=!0;break}c++}if(!l)return!1;a++}return!0}function lW(e,t,n){let r=lP(e),i=r.length;if(lP(t).length!==i)return!1;for(;i-- >0;)if(!lY(e,t,n,r[i]))return!1;return!0}function lU(e,t,n){let r,i,o,s=lA(e),l=s.length;if(lA(t).length!==l)return!1;for(;l-- >0;)if(!lY(e,t,n,r=s[l])||(i=lI(e,r),o=lI(t,r),(i||o)&&(!i||!o||i.configurable!==o.configurable||i.enumerable!==o.enumerable||i.writable!==o.writable)))return!1;return!0}function lH(e,t){return lR(e.valueOf(),t.valueOf())}function lJ(e,t){return e.source===t.source&&e.flags===t.flags}function lK(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 lZ(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 lG(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 lY(e,t,n,r){return("_owner"===r||"__o"===r||"__v"===r)&&(!!e.$$typeof||!!t.$$typeof)||lj(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}let lX={"[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},lQ=Object.prototype.toString,l0=l1();function l1(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:c,areRegExpsEqual:d,areSetsEqual:h,areTypedArraysEqual:u,areUrlsEqual:p,unknownTagComparators:f}){return function(m,g,y){if(m===g)return!0;if(null==m||null==g)return!1;let x=typeof m;if(x!==typeof g)return!1;if("object"!==x)return"number"===x?l(m,g,y):"function"===x&&o(m,g,y);let v=m.constructor;if(v!==g.constructor)return!1;if(v===Object)return a(m,g,y);if(Array.isArray(m))return t(m,g,y);if(v===Date)return r(m,g,y);if(v===RegExp)return d(m,g,y);if(v===Map)return s(m,g,y);if(v===Set)return h(m,g,y);let b=lQ.call(m);if("[object Date]"===b)return r(m,g,y);if("[object RegExp]"===b)return d(m,g,y);if("[object Map]"===b)return s(m,g,y);if("[object Set]"===b)return h(m,g,y);if("[object Object]"===b)return"function"!=typeof m.then&&"function"!=typeof g.then&&a(m,g,y);if("[object URL]"===b)return p(m,g,y);if("[object Error]"===b)return i(m,g,y);if("[object Arguments]"===b)return a(m,g,y);if(lX[b])return u(m,g,y);if("[object ArrayBuffer]"===b)return e(m,g,y);if("[object DataView]"===b)return n(m,g,y);if("[object Boolean]"===b||"[object Number]"===b||"[object String]"===b)return c(m,g,y);if(f){let e=f[b];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:lz,areArraysEqual:n?lU:l$,areDataViewsEqual:lF,areDatesEqual:lB,areErrorsEqual:lV,areFunctionsEqual:lL,areMapsEqual:n?l_(lq,lU):lq,areNumbersEqual:lR,areObjectsEqual:n?lU:lW,arePrimitiveWrappersEqual:lH,areRegExpsEqual:lJ,areSetsEqual:n?l_(lK,lU):lK,areTypedArraysEqual:n?l_(lZ,lU):lZ,areUrlsEqual:lG,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=lD(r.areArraysEqual),t=lD(r.areMapsEqual),n=lD(r.areObjectsEqual),i=lD(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})};
84if(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})}l1({strict:!0}),l1({circular:!0}),l1({circular:!0,strict:!0}),l1({createInternalComparator:()=>lR}),l1({strict:!0,createInternalComparator:()=>lR}),l1({circular:!0,createInternalComparator:()=>lR}),l1({circular:!0,createInternalComparator:()=>lR,strict:!0});var l2=e.i(970414),l3=({contentComponent:e})=>{let n=(0,lO.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,t.jsx)(t.Fragment,{children:Object.values(n)})},l5=class extends lC.default.Component{constructor(e){super(e),this.editorContentRef=lC.default.createRef()}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,n,r,i;if(t.contentComponent)return;let o=this.editorContentRef.current;o.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:o}),e=new Set,n={},r=!1,i=()=>{!r&&e.size&&(r=!0,queueMicrotask(()=>{r=!1,e.forEach(e=>e())}))},t.contentComponent={subscribe:t=>(e.add(t),()=>{e.delete(t)}),getSnapshot:()=>n,getServerSnapshot:()=>n,setRenderer(e,t){n={...n,[e]:lM.default.createPortal(t.reactElement,t.element,e)},i()},removeRenderer(e){let t={...n};delete t[e],n=t,i()}},t.createNodeViews(),t.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var e;let t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),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:n,...r}=this.props;return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{ref:((...e)=>t=>{e.forEach(e=>{"function"==typeof e?e(t):e&&(e.current=t)})})(n,this.editorContentRef),...r}),(null==e?void 0:e.contentComponent)&&(0,t.jsx)(l3,{contentComponent:e.contentComponent})]})}},l4=(0,lC.forwardRef)((e,t)=>{let n=lC.default.useMemo(()=>Math.floor(0xffffffff*Math.random()).toString(),[e.editor]);return lC.default.createElement(l5,{key:n,innerRef:t,...e})}),l9=lC.default.memo(l4),l8="u">typeof window?lC.useLayoutEffect:lC.useEffect,l6=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,t=t=>{((null==t?void 0:t.transaction)===void 0||t.transaction!==e)&&(e=null==t?void 0:t.transaction,this.transactionNumber+=1,this.subscribers.forEach(e=>e()))},n=this.editor;return n.on("transaction",t),n.on("update",t),()=>{n.off("transaction",t),n.off("update",t)}}}},l7="u"<typeof window,ae=l7||!!("u">typeof window&&window.next),at=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
84=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=null==e||e;return l7?t=!1:ae&&void 0===e&&(t=!1),t?this.createEditor():null}createEditor(){return new sq({...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)},onMount:(...e)=>{var t,n;return null==(n=(t=this.options.current).onMount)?void 0:n.call(t,...e)},onUnmount:(...e)=>{var t,n;return null==(n=(t=this.options.current).onUnmount)?void 0:n.call(t,...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)}},an=(0,lC.createContext)({editor:null});an.Consumer;var ar=(0,lC.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});lC.default.forwardRef((e,n)=>{let{onDragStart:r}=(0,lC.useContext)(ar),i=e.as||"div";return(0,t.jsx)(i,{...e,ref:n,"data-node-view-wrapper":"",onDragStart:r,style:{whiteSpace:"normal",...e.style}})}),lC.default.createContext({markViewContentRef:()=>{}});var ai=(0,lC.createContext)({get editor(){throw Error("useTiptap must be used within a <Tiptap> provider")}});function ao({children:e,...n}){let r="editor"in n?n.editor:n.instance;if(!r)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,lC.useMemo)(()=>({editor:r}),[r]),o=(0,lC.useMemo)(()=>({editor:r}),[r]);return(0,t.jsx)(an.Provider,{value:o,children:(0,t.jsx)(ai.Provider,{value:i,children:e})})}function as({...e}){let{editor:n}=(0,lC.useContext)(ai);return(0,t.jsx)(l9,{editor:n,...e})}ai.displayName="TiptapContext",ao.displayName="Tiptap",as.displayName="Tiptap.Content",Object.assign(ao,{Content:as});var al=e.i(356636),aa=e.i(586191),ac=e.i(553938),ad=e.i(582512);function ah(e){return e&&e.trim()?{type:"doc",content:e.split("\n").map(e=>{let t=function(e){let t,n=[],r=/\[(.+?)\]\(glassphoto:\/\/user\?id=(.+?)\)/g,i=0;for(;null!==(t=r.exec(e));){if(t.index>i){let r=e.slice(i,t.index);r&&n.push({type:"text",text:r})}let r=t[1],o=t[2];n.push({type:"mention",attrs:{id:o,label:r,username:null},content:[{type:"text",text:r}]}),i=t.index+t[0].length}if(i<e.length){let t=e.slice(i);t&&n.push({type:"text",text:t})}return n}(e);return{type:"paragraph",content:t.length>0?t:void 0}})}:{type:"doc",content:[{type:"paragraph"}]}}var au=e.i(595466);function ap(e){var t;let{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:s,$position:l}=e,a=r&&!i,c=n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),d=RegExp(`\\s${c}$`),h=s?"^":"",u=i?"":c,p=a?RegExp(`${h}${c}.*?(?=\\s${u}|$)`,"gm"):RegExp(`${h}(?:^)?${c}[^\\s${u}]*`,"gm"),f=(null==(t=l.nodeBefore)?void 0:t.isText)&&l.nodeBefore.text;if(!f)return null;let m=l.pos-f.length,g=Array.from(f.matchAll(p)).pop();if(!g||void 0===g.input||void 0===g.index)return null;let y=g.input.slice(Math.max(0,g.index-1),g.index),x=RegExp(`^[${null==o?void 0:o.join("")}\0]?$`).test(y);if(null!==o&&!x)return null;let v=m+g.index,b=v+g[0].length;return(a&&d.test(f.slice(b-1,b+1))&&(g[0]+=" ",b+=1),v<l.pos&&b>=l.pos)?{range:{from:v,to:b},query:g[0].slice(n.length),text:g[0]}:null}var af=new th("suggestion"),am=function({pluginKey:e=af,editor:t,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:c="",decorationEmptyClass:d="is-empty",command:h=()=>null,items:u=()=>[],minQueryLength:p=0,debounce:f=0,initialItems:m,placement:g="bottom-start",offset:y={},container:x,flip:v=!0,floatingUi:b,dismissOnOutsideClick:w=!0,render:k=()=>({}),allow:S=()=>!0,findSuggestionMatch:C=ap,shouldShow:M,shouldResetDismissed:O}){let T=null==k?void 0:k(),N=r&&!i,E=(n,r)=>(function(e,t,n,r){if(!n)return()=>
84{let t=e.state.selection.$anchor.pos,{top:n,right:r,bottom:i,left:o}=e.view.coordsAtPos(t);try{return new DOMRect(o,n,r-o,i-n)}catch{return null}};return()=>{let n=r.getState(e.state),i=null==n?void 0:n.decorationId,o=t.dom.querySelector(`[data-decoration-id="${i}"]`);return(null==o?void 0:o.getBoundingClientRect())||null}})(t,n,r,e),_=t=>(function({view:e,pluginKeyRef:t}){let n=e.state.tr.setMeta(t,{exit:!0});e.dispatch(n)})({view:t,pluginKeyRef:e});return new ta({key:e,view:()=>(function({editor:e,pluginKey:t,items:n,renderer:r,minQueryLength:i,debounce:o,initialItems:s,placement:l,offset:a,container:c,flip:d,floatingUi:h,dismissOnOutsideClick:u,command:p,clientRectFor:f,dispatchExit:m}){let g,y=function({editor:e,items:t}){let n=null,r=null,i=null,o=()=>{null==n||n.abort(),null!==r&&(clearTimeout(r),r=null),null==i||i(),i=null,n=null},s=async(s,l)=>{o();let a=n=new AbortController;if(l>0&&await new Promise(e=>{i=e,r=setTimeout(()=>{r=null;let e=i;i=null,null==e||e()},l)}),n!==a||a.signal.aborted)return{status:"aborted"};try{let r=await t({editor:e,query:s,signal:a.signal});if(n!==a||a.signal.aborted)return{status:"aborted"};return{status:"resolved",items:r}}catch{if(n!==a||a.signal.aborted)return{status:"aborted"};return{status:"error"}}};return{abort:o,fetch:s}}({editor:e,items:n}),x=function({placement:e,offset:t,flip:n,floatingUi:r}){var i,o,s,l;let a=[(0,au.offset)({mainAxis:null!=(i=t.mainAxis)?i:4,crossAxis:null!=(o=t.crossAxis)?o:0})];return n&&a.push((0,au.flip)()),(null==(s=null==r?void 0:r.middleware)?void 0:s.length)&&a.push(...r.middleware),{placement:e,strategy:null!=(l=null==r?void 0:r.strategy)?l:"absolute",middleware:a}}({placement:l,offset:a,flip:d,floatingUi:h});function v(e,t){var n,i,o;switch(e){case"started":null==(n=null==r?void 0:r.onStart)||n.call(r,t);break;case"updated":null==(i=null==r?void 0:r.onUpdate)||i.call(r,t);break;case"stopped":null==(o=null==r?void 0:r.onExit)||o.call(r,t)}}return{update:async(n,h)=>{var b,w,k,S;let C=t.getState(h),M=t.getState(n.state);if(!C||!M)return;let O=null,T=C.query!==M.query,N=C.text!==M.text,E=C.range.from!==M.range.from||C.range.to!==M.range.to;if(!C.active&&M.active)O="started";else if(C.active&&!M.active)O="stopped";else{if(!M.active||!T&&!N&&!E)return;O="updated"}let _="stopped"===O?C:M,D=n.dom.querySelector(`[data-decoration-id="${_.decorationId}"]`),A=f(n,D),j=0===i||!!_.query&&_.query.length>=i,R=("started"===O||"updated"===O)&&j;if(g={editor:e,range:_.range,query:_.query||"",text:_.text||"",items:null!=s?s:[],command:t=>p({editor:e,range:_.range,props:t}),decorationNode:D,clientRect:A,loading:R,placement:l,offset:{mainAxis:null!=(b=a.mainAxis)?b:4,crossAxis:null!=(w=a.crossAxis)?w:0},container:c,flip:d,floatingUi:x,mount:function({getReferenceRect:e,contextElement:t,config:n,container:r,dismissOnOutsideClick:i,dismiss:o}){return(s,l={})=>{let a,c={getBoundingClientRect:()=>{var t;return null!=(t=e())?t:new DOMRect},contextElement:t},d=!1,h=!s.isConnected;h&&(function(e){if(e instanceof HTMLElement)return e;if("string"==typeof e)try{let t=document.querySelector(e);if(t)return t}catch{}return document.body})(r).appendChild(s),l.onPosition||(s.style.visibility="hidden",s.style.width="max-content");let u=(0,au.autoUpdate)(c,s,()=>{(0,au.computePosition)(c,s,{placement:n.placement,strategy:n.strategy,middleware:n.middleware}).then(({x:e,y:t,placement:n,strategy:r})=>{l.onPosition?l.onPosition({x:e,y:t,placement:n,strategy:r}):(Object.assign(s.style,{position:r,left:`${e}px`,top:`${t}px`}),d||(d=!0,s.style.visibility=""))})},l.autoUpdate);return i&&(a=e=>{let n=e.target;!(n instanceof Node)||s.contains(n)||t.contains(n)||o()},document.addEventListener("pointerdown",a,!0)),()=>{u(),a&&document.removeEventListener("pointerdown",a,!0),h&&s.remove()}}}({getReferenceRect:A,contextElement:n.dom,config:x,container:c,dismissOnOutsideClick:u,dismiss:()=>m(e.view)})},"started"===O&&(null==(k=null==r?void 0:r.onBeforeStart)||k.call(r,g)),"updated"===O&&(null==(S=null==r?void 0:r.onBeforeUpdate)||S.call(r,g)),"started"===O&&v(O,g),"started"===O||"updated"===O)if(R){v(O="updated",g={...g,items:null!=s?s:[],loading:!0});let e=await y.fetch(_.query||"",o);if("aborted"===e.status)return;let r=t.getState(n.state);if(!(null==r?void 0:r.active))return void y.abort();g="resolved"===e.status?{...g,items:e.items,loading:!1}:{...g,loading:!1}}else y.abort(),g={...g,items:null!=s?s:[],loading:!1};if("stopped"===O){y.abort(),v(O,g),g=void 0;return}"updated"===O&&v(O,g)},destroy:()=>{var e;y.abort(),g&&(null==(e=null==r?void 0:r.onExit)||e.call(r,g))}}})({editor:t,pluginKey:e,items:u,renderer:T,minQueryLength:p,debounce:f,initialItems:m,placement:g,offset:y,container:x,flip:v,floatingUi:b,dismissOnOutsideClick:w,command:h,clientRectFor:E,dispatchExit:_}),state:function({editor:e,char:t,effectiveAllowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:o,findSuggestionMatch:s,allow:l,shouldShow:a,shouldKeepDismissed:c,pluginKey:d}){return{init:()=>({active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}),apply(h,u,p,f){let{isEditable:m}=e,{composing:g}=e.view,{selection:y}=h,{empty:x,from:v}=y,b={...u},w=h.getMeta(d);if(w&&w.exit)return b.active=!1,b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null,b.dismissedRange=u.active?{...u.range}:u.dismissedRange,b;if(b.composing=g,h.docChanged&&null!==b.dismissedRange&&(b.dismissedRange={from:h.mapping.map(b.dismissedRange.from),to:h.mapping.map(b.dismissedRange.to)}),m&&(x||e.view.composing)){(v<u.range.from||v>u.range.to)&&!g&&!u.composing&&(b.active=!1);let d=s({char:t,allowSpaces:n,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:o,$position:y.$from}),p=`id_${Math.floor(0xffffffff*Math.random())}`;d&&l({editor:e,state:f,range:d.range,isActive:u.active})&&(!a||a({editor:e,range:d.range,query:d.query,text:d.text,transaction:h}
84))?(null===b.dismissedRange||c({match:d,dismissedRange:b.dismissedRange,state:f,transaction:h})||(b.dismissedRange=null),null===b.dismissedRange?(b.active=!0,b.decorationId=u.decorationId||p,b.range=d.range,b.query=d.query,b.text=d.text):b.active=!1):(d||(b.dismissedRange=null),b.active=!1)}else b.active=!1;return b.active||(b.decorationId=null,b.range={from:0,to:0},b.query=null,b.text=null),b}}}({editor:t,char:n,effectiveAllowSpaces:N,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:s,findSuggestionMatch:C,allow:S,shouldShow:M,shouldKeepDismissed:function(e){return function({match:e,dismissedRange:t,state:n,transaction:r,editor:i,shouldResetDismissed:o,effectiveAllowSpaces:s}){return(null==o?!void 0:!o({editor:i,state:n,range:t,match:e,transaction:r,allowSpaces:s}))&&(s?e.range.from===t.from:e.range.from===t.from&&!(r.docChanged&&r.steps.some(e=>{let t=e.slice;if(!(null==t?void 0:t.content))return!1;let n=t.content.textBetween(0,t.content.size,"\n");return/\s/.test(n)})))}({...e,editor:t,shouldResetDismissed:O,effectiveAllowSpaces:N})},pluginKey:e}),props:function({pluginKey:e,decorationTag:t,decorationClass:n,decorationContent:r,decorationEmptyClass:i,renderer:o,dispatchExit:s}){return{handleKeyDown(t,n){var r,i;let l=e.getState(t.state);return!!l.active&&("Escape"===n.key||"Esc"===n.key?(null==(r=null==o?void 0:o.onKeyDown)||r.call(o,{view:t,event:n,range:l.range}),s(t),!0):(null==(i=null==o?void 0:o.onKeyDown)?void 0:i.call(o,{view:t,event:n,range:l.range}))||!1)},decorations(o){let{active:s,range:l,decorationId:a,query:c}=e.getState(o);if(!s)return null;let d=!(null==c?void 0:c.length),h=[n];return d&&h.push(i),rq.create(o.doc,[rB.inline(l.from,l.to,{nodeName:t,class:h.join(" "),"data-decoration-id":a||void 0,"data-decoration-content":r})])}}}({pluginKey:e,decorationTag:l,decorationClass:a,decorationContent:c,decorationEmptyClass:d,renderer:T,dispatchExit:_})})};let ag=sW.create({name:"mention",group:"inline",inline:!0,atom:!1,content:"text*",selectable:!0,draggable:!1,addOptions(){return{HTMLAttributes:{},suggestion:{char:"@",allowSpaces:!0,command:({editor:e,range:t,props:n})=>{e.chain().focus().deleteRange(t).insertContent({type:this.name,attrs:n,content:[{type:"text",text:n.label}]}).insertContent(" ").run()}}}},addAttributes:()=>({id:{default:null,parseHTML:e=>e.getAttribute("data-id"),renderHTML:e=>({"data-id":e.id})},label:{default:null,parseHTML:e=>e.getAttribute("data-label"),renderHTML:e=>({"data-label":e.label})},username:{default:null,parseHTML:e=>e.getAttribute("data-username"),renderHTML:e=>({"data-username":e.username})}}),parseHTML(){return[{tag:`a[data-type="${this.name}"]`}]},renderHTML({node:e,HTMLAttributes:t}){let n=t["data-username"]||e.attrs.username||"";return["a",oR({"data-type":this.name,href:`/${n}`,target:"_blank",class:"mention font-semibold no-underline"},this.options.HTMLAttributes,t),0]},renderText:({node:e})=>e.textContent||e.attrs.label||"",addKeyboardShortcuts(){return{Backspace:({editor:e})=>{let{state:t}=e,{selection:n}=t,{$from:r,empty:i}=n;if(!i)return!1;let o=!1,s=-1,l=0;for(let e=r.depth;e>=0;e--){let t=r.node(e);if(t?.type.name===this.name){o=!0,s=r.before(e),l=t.nodeSize;break}}if(!o)return!1;let a=r.parent.textContent;if(!a||""===a.trim())return e.chain().deleteRange({from:s,to:s+l}).run(),!0;let c=r.parent.textBetween(0,r.parentOffset," "),d=r.parent.textBetween(r.parentOffset,r.parent.content.size," ");if(!c)return e.chain().deleteRange({from:s,to:s+l}).run(),!0;let h=c.slice(-1),u=d.slice(0,1);if(" "!==h&&""!==u&&" "!==u){let t=c.lastIndexOf(" "),n=-1===t?0:t+1,i=d.indexOf(" "),o=-1===i?d.length:i,a=r.pos-(c.length-n),h=r.pos+o;return(c.slice(0,n>0?n-1:0)+d.slice(o)).trim()?e.chain().deleteRange({from:t>0?a-1:a,to:h}).run():e.chain().deleteRange({from:s,to:s+l}).run(),!0}let p=c.trimEnd(),f=c.length-p.length;if(f>0){let t=r.pos-f,n=r.pos;return e.chain().deleteRange({from:t,to:n}).run(),!0}let m=p.lastIndexOf(" ");if(-1===m)return e.chain().deleteRange({from:s,to:s+l}).run(),!0;let g=r.pos-(p.length-m),y=r.pos;return g<y&&(e.chain().deleteRange({from:g,to:y}).run(),!0)}}},addProseMirrorPlugins(){let e=this.name;return[am({editor:this.editor,...this.options.suggestion}),new ta({key:new th("mentionTextInput"),props:{handleTextInput:(t,n,r,i)=>{let{state:o}=t,{$from:s}=o.selection,l=!1,a=-1,c=null,d=-1;for(let t=s.depth;t>=0;t--){let n=s.node(t);
84if(n?.type.name===e){l=!0,a=s.before(t),c=n,d=t;break}}if(!l||!c)return!1;let h=c.textContent,u=n-s.start(d);if(u<=0||u>=h.length)return!1;let p=h.slice(0,u),f=p+i+h.slice(u+(r-n)),m=a+c.nodeSize,g=o.tr;g.delete(a,m),g.insertText(f,a);let y=a+p.length+i.length;return g.setSelection(e5.create(g.doc,y)),t.dispatch(g),!0}}})]}});function ay({items:e,selectedIndex:n,onSelect:r,onHover:i}){return 0===e.length?null:(0,t.jsx)("div",{className:"max-h-[min(16rem,40dvh)] min-h-0 touch-pan-y overflow-y-auto overscroll-none border-t border-gray-6 lg:mt-24 lg:max-h-full",children:e.map((e,o)=>(0,t.jsxs)("button",{type:"button",className:(0,ad.cn)("flex w-full cursor-pointer items-center gap-3 bg-secondary px-4 py-3 text-left active:bg-gray-5",{"bg-gray-6":o===n}),onClick:()=>r(e),onMouseEnter:()=>i(o),children:[(0,t.jsx)("div",{className:"h-9 w-9",children:(0,t.jsx)("img",{className:"h-9 w-9 rounded-full",src:e.avatar,alt:""})}),(0,t.jsxs)("div",{className:"flex flex-col justify-center",children:[(0,t.jsx)("strong",{className:"font-semibold",children:e.label}),(0,t.jsx)("span",{className:"text-footnote text-gray-1",children:e.username})]})]},e.id))})}let ax=e=>{let t=[],n=e=>{"mention"===e.type&&"string"==typeof e.attrs?.id&&t.push({id:e.attrs.id,label:"string"==typeof e.attrs.label?e.attrs.label:"",username:"string"==typeof e.attrs.username?e.attrs.username:null}),e.content?.forEach(n)};return n(e),t};e.s(["CommentInput",0,function({onSubmit:e,onUpdate:n,handleReplyFunc:s,handleEditFunc:l}){let{user:c}=(0,i.useAuth)(),[d,h]=(0,o.useState)(void 0),[p,f]=(0,o.useState)(void 0),[m,y]=(0,o.useState)(!1),[x,v]=(0,o.useState)(!1),b=(0,o.useRef)(null),w=(0,o.useRef)(null),{open:k}=(0,al.useSubscribeModal)(),[S,C]=(0,o.useState)([]),[M,O]=(0,o.useState)(!1),[T,N]=(0,o.useState)(""),[E,_]=(0,o.useState)(!1),[D,A]=(0,o.useState)(0),j=(0,aa.useDebounce)(T,500),R=(0,o.useRef)(null);(0,ac.useHotkeys)("c",e=>{!c?.is_member||e.metaKey||e.ctrlKey||(e.preventDefault(),B?.commands.focus())},{useKey:!0}),(0,o.useEffect)(()=>{let e=async()=>{if(!j){C([]),O(!1);return}let e=(await (0,u.getter)(`/api/v3/search/users?query=${j}&limit=20`)).map(e=>({id:e.id,label:e.name,avatar:e.profile192x192,username:e.username}));O(!1),C(e)};
84""!==j?e():(C([]),O(!1))},[j]);let I=(0,o.useRef)(void 0),P=(0,o.useRef)(E),z=(0,o.useRef)(S),$=(0,o.useRef)(D);P.current=E,z.current=S,$.current=D;let F=sE.create({name:"submitOnEnter",addKeyboardShortcuts:()=>({Enter:({editor:e})=>(!P.current||!(z.current.length>0))&&(I.current?.(),!0),"Shift-Enter":({editor:e})=>!!e.state.doc.textBetween(0,e.state.selection.from,"\n","\n").endsWith("\n\n")||(e.chain().setHardBreak().scrollIntoView().run(),!0)})}),B=function(e={},t=[]){let n=(0,lC.useRef)(e);n.current=e;let[r]=(0,lC.useState)(()=>new at(n)),i=(0,lO.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,lC.useDebugValue)(i),(0,lC.useEffect)(r.onRender(t)),!function(e){var t;let[n]=(0,lC.useState)(()=>new l6(e.editor)),r=(0,l2.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,null!=(t=e.equalityFn)?t:l0);l8(()=>n.watch(e.editor),[e.editor,n]),(0,lC.useDebugValue)(r)}({editor:i,selector:({transactionNumber:t})=>!1===e.shouldRerenderOnTransaction||void 0===e.shouldRerenderOnTransaction?null:e.immediatelyRender&&0===t?0:t+1}),i}({extensions:[sU,sH,sK,sZ,lS,lb.configure({placeholder:"Commentâ¦",emptyEditorClass:"is-editor-empty"}),ag.configure({HTMLAttributes:{class:"mention"},suggestion:{char:"@",allowSpaces:!0,items:({query:e})=>(e!==T&&(N(e),O(!0)),S),render:()=>({onStart:e=>{R.current=t=>{e.command(t)},_(!0),A(0)},onUpdate:e=>{R.current=t=>{e.command(t)},A(0)},onKeyDown:({event:e})=>{let t=z.current,n=$.current;if("ArrowUp"===e.key)return A(e=>(e+t.length-1)%Math.max(t.length,1)),!0;if("ArrowDown"===e.key)return A(e=>(e+1)%Math.max(t.length,1)),!0;if("Enter"===e.key||"Tab"===e.key){if(t.length>0&&R.current){let e=t[n];e&&(R.current({id:e.id,label:e.label,username:e.username}),_(!1),N(""))}return!0}return"Escape"===e.key&&(_(!1),N(""),!0)},onExit:()=>{R.current=null,_(!1),N(""),C([])}})}}),F],editable:c?.is_member??!1,immediatelyRender:!1,editorProps:{attributes:{class:"outline-hidden"},handlePaste:(e,t)=>
84{let n=t.clipboardData?.getData("text/plain");if(!n)return!1;t.preventDefault();let r=n.replace(/\r\n?/g,"\n").replace(/\n{3,}/g,"\n\n").split("\n"),i=[];return r.forEach((e,t)=>{e&&i.push({type:"text",text:e}),t<r.length-1&&i.push({type:"hardBreak"})}),B?.chain().focus().insertContent(i).scrollIntoView().run(),!0}},onUpdate:({editor:e})=>{v(e.getText().trim().length>0)}}),V=(0,o.useCallback)(async()=>{if(!B||m||!B.getText().trim())return;v(!1),y(!0),B.setEditable(!1);let t=(e=>{if(!e)return"";let t=e.getJSON(),n=e=>{if("text"===e.type)return e.text||"";if("mention"===e.type){let t=e.attrs,r=e.content,i=r?.map(n).join("")||t.label;return`[${i}](glassphoto://user?id=${t.id})`}if("hardBreak"===e.type)return"\n";if("paragraph"===e.type){let t=e.content;return t?.map(n).join("")||""}if("doc"===e.type){let t=e.content;return t?.map(n).join("\n")||""}return""};return n(t)})(B);try{p?(await n(p.id,t,p.parent_id||void 0),f(void 0)):(await e(t,d),h(void 0)),B.commands.clearContent()}finally{v(!1),y(!1),B.setEditable(!0)}},[B,e,n,d,p,m]);I.current=V,(0,o.useEffect)(()=>{s.current=(e,t)=>{B&&B.isEditable&&e&&(f(void 0),h(t||e),b.current?.scrollIntoView({behavior:"smooth"}),(async()=>{let t=c?.id,n=new Set,r=[],i=e=>{!e.id||e.id===t||n.has(e.id)||(n.add(e.id),r.push(e))};ax(B.getJSON()).forEach(i),i({id:e.user.id,label:e.user.name,username:e.user.username});try{let t=await (0,u.getter)(`/api/v1/comments/${e.id}`);ax(ah(t.body)).forEach(i)}catch{}let o=B.chain().focus("end").clearContent();r.forEach(e=>{o=o.insertContent({type:"mention",attrs:e,content:[{type:"text",text:e.label}]}).insertContent(" ")}),o.run(),B.commands.focus("end")})())}},[s,B,c?.id]),(0,o.useEffect)(()=>{l.current=e=>{B&&B.isEditable&&e&&(h(void 0),f(e),b.current?.scrollIntoView({behavior:"smooth"}),(async()=>{try{let t=await (0,u.getter)(`/api/v1/comments/${e.id}`),n=ah(t.body);B.chain().focus().setContent(n).run(),B.commands.focus("end")}catch{let t=ah(e.body);B.chain().focus().setContent(t).run(),B.commands.focus("end")}})())}},[l,B]);let L=c?.is_member;return((0,o.useEffect)(()=>{B&&B.setEditable(L??!1)},[B,L]),c)?(0,t.jsxs)("div",{className:(0,ad.cn)("pointer-events-none [&>*]:pointer-events-auto","flex flex-col justify-end","mb-24 border-b border-solid border-gray-6","md:mb-0 md:border-b-0","lg:absolute lg:h-screen lg:w-full lg:overflow-hidden"),ref:b,children:[E&&T&&(0,t.jsx)("div",{ref:w,className:(0,ad.cn)("bg-gray-6/70 backdrop-blur-xs backdrop-saturate-180","lg:h-full lg:overflow-hidden","lg:flex lg:flex-col lg:justify-end"),children:M?(0,t.jsx)(a.LoadingSpinner,{size:"small",className:"h-auto justify-end py-8 lg:mt-24"}):(0,t.jsx)(ay,{items:S,selectedIndex:D,onSelect:e=>{R.current&&(R.current({id:e.id,label:e.label,username:e.username}),_(!1),N(""))},onHover:A})}),(d||p)&&(0,t.jsxs)("div",{className:"flex items-center justify-between gap-3 bg-secondary px-4 py-2 text-footnote font-semibold text-gray-1",children:[(0,t.jsx)("span",{children:p?"Editing comment":`Replying to ${d?.user.name}`}),(0,t.jsx)("button",{onClick:()=>{p?(f(void 0),B?.commands.clearContent()):h(void 0)},children:(0,t.jsx)(r.FontAwesomeIcon,{icon:g.faXmark})})]}),(0,t.jsxs)("div",{className:"flex border-t border-solid border-gray-6 bg-secondary p-4",children:[(0,t.jsx)("img",{className:"h-9 w-9 shrink-0 rounded-full",src:c?.profile192x192,alt:""}),(0,t.jsx)("div",{className:(0,ad.cn)("mx-4 my-2 block max-h-21 w-full cursor-text resize-none overflow-x-hidden overflow-y-auto border-none p-0 text-primary shadow-none outline-hidden","[&_.is-editor-empty:first-child::before]:pointer-events-none [&_.is-editor-empty:first-child::before]:float-left [&_.is-editor-empty:first-child::before]:h-0 [&_.is-editor-empty:first-child::before]:text-gray-3 [&_.is-editor-empty:first-child::before]:content-[attr(data-placeholder)]",{"text-gray-2":!c?.is_member||m}),onClick:()=>{c?.is_member?B?.commands.focus():k("comment")},children:(0,t.jsx)(l9,{editor:B})}),(0,t.jsx)("button",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-yellow text-black disabled:bg-gray-1 disabled:text-secondary",onClick:()=>void V(),disabled:!x,children:m?(0,t.jsx)(a.LoadingSpinner,{size:"small"}):(0,t.jsx)(r.FontAwesomeIcon,{icon:g.faArrowUp})})]}),(0,t.jsxs)("span",{className:"hidden border-t border-solid border-gray-6 px-4 py-2 text-right text-footnote text-gray-2 md:block",children:[(0,t.jsx)("strong",{className:"semibold text-gray-1",children:"shift + return"})," for a new line"]})]}):null}],701831);var av=e.i(368938);let ab=(0,ad.cn)("pointer-events-auto mt-0.5 ml-2 inline-block rounded-sm px-1.5 py-0 align-top text-[11px] leading-4 font-semibold capitalize select-none");function aw({className:e,onClick:n,disabled:r,children:i}){return r?(0,t.jsx)("span",{className:(0,ad.cn)(ab,e),children:i}):(0,t.jsx)("button",{className:(0,ad.cn)(ab,e),onClick:n,children:i})}function ak({className:e,disabled:n}){let{user:r,isLoggedIn:s}=(0,i.useAuth)(),l=(0,av.useRouter)(),{open:a}=(0,al.useSubscribeModal)(),c=(0,o.useCallback)(e=>{e.stopPropagation(),e.preventDefault(),s?a(void 0,"patron",!0):(sessionStorage.setItem("plan","patron"),l.push("/signup/choose-plan"))},[s,a,l]);return(0,t.jsx)(aw,{className:(0,ad.cn)("bg-yellow text-black",e),onClick:c,disabled:n||r?.is_patron||r?.is_team_member,children:"Patron"})}function aS({className:e,user:n,noninteractive:r}){return n.is_patron||n.is_team_member?(0,t.jsx)(ak,{className:e,disabled:r}):null}e.s(["UserBadge",0,aS],1883),e.s(["UserAvatarWithName",0,function({user:e,withBadge:n=!1,className:r}){return(0,t.jsxs)("div",{className:(0,ad.cn)("inline-flex items-center no-underline",r),children:[(0,t.jsx)(p.default,{href:`/${e.username}`,className:"shrink-0",children:(0,t.jsx)("img",{className:"mr-3 h-9 w-9 rounded-full",src:e.profile192x192,alt:""})}),(0,t.jsxs)("span",{children:[(0,t.jsx)(p.default,{className:"font-semibold break-all text-primary underline-offset-2 hover:underline hover:decoration-gray-3 hover:decoration-2",href:`/${e.username}`,children:e.name}),n&&(0,t.jsx)(aS,{user:e})]})]})}],713687)},669337,e=>{"use strict";var t=e.i(526277);e.s(["mutate",()=>t.k])},850241,764357,e=>{"use strict";var t=e.i(380447),n=e.i(984138),r=e.i(313312),i=e.i(743133),o=e.i(99338),s=e.i(884545),l=e.i(368938),a=e.i(999161),c=e.i(445280),d=e.i(138400),h=e.i(98301),u=e.i(699721),p=e.i(790931),f=e.i(356636),m=e.i(918485),g=e.i(620917),y=e.i(582512),x=e.i(563823),v=e.i(713687),b=e.i(135790),w=e.i(864294),k=e.i(313890),S=e.i(843727),C=e.i(669337);function M({comment:e,post:n,handleToggleDialog:s,onFeature:l}){let{toast:c}=(0,m.useToasts)(),{flagEnabled:p}=(0,S.useFeatureFlags)(),[f,g]=(0,a.useState)(),[y,x]=(0,a.useState)(!1),[v,b]=(0,a.useState)(!1),{user:O}=(0,i.useAuth)(),[T,N]=(0,a.useState)(!1),[E,_]=(0,a.useState)(!1),[D,A]=(0,a.useState)(!1),j=async t=>{try{await (0,o.poster)(`/api/v1/comments/${e.id}/report`,{reason:t}),g("reportDone")}catch{c("Failed to report profile","error")}};return(0,t.jsxs)(k.Dialog,{handleToggleDialog:s,children:[E&&(0,t.jsx)(w.ConfirmationDialog,{title:"Delete comment",prompt:"Are you sure you want to delete this comment?",confirmText:"Delete comment",onCancel:()=>_(!1),onConfirm:()=>{(async()=>{try{N(!0),await (0,o.deleter)(`/api/v1/comments/${e.id}`),e.parent_id&&await (0,C.mutate)(`/api/v1/comments/${e.parent_id}/replies?idtype=web`),await (0,C.mutate)(`/api/v2/post/${n.friendly_id}/comments?idtype=web`),N(!1),s()}catch{c("Failed to delete comment","error")}})()}}),!f&&(0,t.jsxs)("ul",{children:[T?(0,t.jsx)("li",{children:(0,t.jsx)(r.Loa
84dingSpinner,{size:"medium"})}):(O?.username===e.user.username||O?.username===n.user.username)&&(0,t.jsx)("li",{children:(0,t.jsx)("button",{className:"text-red",onClick:()=>_(!0),children:"Delete comment"})}),O?.username!==e.user.username&&(0,t.jsx)("li",{children:(0,t.jsx)("button",{className:"text-red",onClick:()=>g("reportConfirm"),children:"Report"})}),p("manage_featured_comments")&&(0,t.jsx)("li",{children:D?(0,t.jsx)(r.LoadingSpinner,{size:"small"}):(0,t.jsxs)("button",{onClick:()=>{(async()=>{A(!0),e.is_featured?(await (0,o.deleter)(`/api/v1/comments/featured/${e.id}`),l&&l(),c((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.FontAwesomeIcon,{icon:d.faPartyHorn}),"Comment unfeatured"]}),"success")):(await (0,o.poster)(`/api/v1/comments/featured/${e.id}`),l&&l(),c((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.FontAwesomeIcon,{icon:h.faPartyHorn,className:"text-yellow"}),"Comment featured"]}),"success")),s(),A(!1)})()},className:e.is_featured?"text-primary":"text-yellow",children:[e.is_featured?"Unfeature":"Feature"," comment"]})}),(0,t.jsx)("li",{children:(0,t.jsx)("button",{onClick:s,children:"Cancel"})})]}),"reportConfirm"===f&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"border-b border-solid border-gray-5 px-6 py-0",children:[(0,t.jsx)("h2",{children:"Report"}),(0,t.jsx)("strong",{children:"Why are you reporting this comment?"}),(0,t.jsx)("p",{children:"We appreciate you helping us keep Glass safe. The member will not know who reported them."})]}),(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{children:y?(0,t.jsx)(r.Loa
84dingSpinner,{size:"medium"}):(0,t.jsx)("button",{onClick:()=>{(async()=>{x(!0),await j("spam"),x(!1)})()},children:"It's spam"})}),(0,t.jsx)("li",{children:v?(0,t.jsx)(r.LoadingSpinner,{size:"medium"}):(0,t.jsx)("button",{onClick:()=>{(async()=>{b(!0),await j("inappropriate"),b(!1)})()},children:"It's inappropriate"})}),(0,t.jsx)("li",{children:(0,t.jsx)("button",{onClick:()=>g(void 0),children:"Cancel"})})]})]}),"reportDone"===f&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"border-b border-solid border-gray-5 px-6 py-0",children:[(0,t.jsx)("h2",{children:"Report"}),(0,t.jsx)("strong",{children:"Thanks for letting us know!"}),(0,t.jsx)("p",{children:"This feedback is important in helping us keep the Glass community safe and secure for everyone."})]}),(0,t.jsx)("ul",{children:(0,t.jsx)("li",{children:(0,t.jsx)("button",{onClick:s,children:"Done"})})})]})]})}function O({comment:e,post:i,handleReplyFunc:s,handleEditFunc:l,anchorId:a}){let{data:d,error:h,mutate:u}=(0,c.default)(`/api/v1/comments/${e.id}/replies?idtype=web`,o.getter),p=()=>{u()},f=t=>{if(!d)return;let n=d.find(e=>e.id===t);n&&s.current&&s.current(n,e)};return h?(0,t.jsx)(n.LoadingError,{className:"border-t border-solid border-gray-5 bg-gray-6/70 px-0 py-6",title:"Failed to load replies",mutate:u}):d?(0,t.jsx)(t.Fragment,{children:d?.map(e=>(0,t.jsx)(T,{comment:e,post:i,onReply:f,handleEditFunc:l,anchorId:a,onFeature:p,isReply:!0},e.id))}
84):(0,t.jsx)(r.LoadingSpinner,{className:"border-t border-solid border-gray-5 bg-gray-6/70 px-0 py-6",size:"small"})}function T({post:e,comment:n,onReply:r,handleReplyFunc:s,handleEditFunc:l,onFeature:c,expanded:w,anchorId:k,isReply:S}){let C=(0,a.useRef)(null),{toast:N}=(0,m.useToasts)(),{mutate:E}=(0,g.useSWRConfig)(),{user:_,isLoggedIn:D}=(0,i.useAuth)(),[A,j]=(0,a.useState)(!1),[R,I]=(0,a.useState)(!1),[P,z]=(0,a.useState)(w||!1),[$,F]=(0,a.useState)(!1),{open:B}=(0,f.useSubscribeModal)(),V=()=>j(!A),L=()=>I(!R);return(0,a.useEffect)(()=>{k===n.id&&C?.current?.scrollIntoView({behavior:"smooth"})},[k,n.id]),(0,a.useEffect)(()=>{z(w||!1)},[w]),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:(0,y.cn)("group scroll-mt-25 border-t border-solid border-gray-6 px-4 pt-4 pb-6",{"border-t border-solid border-gray-5 bg-gray-6/70 pl-16":S}),ref:C,children:[A&&(0,t.jsx)(M,{handleToggleDialog:V,onFeature:c,comment:n,post:e}),(0,t.jsx)(b.AppreciationsModal,{open:R,onClick:L,comment:n}),(0,t.jsx)(v.UserAvatarWithName,{user:n.user}),(0,t.jsxs)("div",{className:(0,y.cn)("my-0 mr-0 ml-12 [word-break:break-word] whitespace-pre-wrap standalone:select-text","[&_a]:font-semibold [&_a]:text-primary [&_a]:underline-offset-2 [&_a:hover]:underline [&_a:hover]:decoration-gray-3 [&_a:hover]:decoration-2"),children:[(0,t.jsx)("span",{dangerouslySetInnerHTML:{__html:(0,x.parseMentions)(n.body)}}),n.updated_at&&(0,t.jsx)("span",{className:"ml-1 text-footnote text-gray-1",children:"(edited)"})]}),(0,t.jsxs)("div",{className:"mt-2.5 mb-0 ml-12 flex flex-row justify-between text-gray-1 [&_button:hover]:text-primary",children:[(0,t.jsx)(p.TimeAgo,{className:"text-footnote",date:n.created_at}),D&&(0,t.jsxs)("span",{className:"mr-2.5 flex gap-6",children:[(0,t.jsx)("button",{className:"group-hover:inline lg:hidden",onClick:V,children:(0,t.jsx)(u.FontAwesomeIcon,{icon:h.faEllipsis})}),_?.username===n.user.username&&(0,t.jsx)("button",{onClick:()=>{l?.current&&l.current(n)},children:(0,t.jsx)(u.FontAwesomeIcon,{icon:d.faPen})}),_?.username!==n.user.username&&(0,t.jsx)("button",{onClick:()=>{(async()=>{let r=S?`/api/v1/comments/${n.parent_id}/replies?idtype=web`:`/api/v2/post/${e.friendly_id}/comments?idtype=web`,i=async e=>{await E(r,t=>t?.map(t=>t.id===n.id?{...t,...e}:t),{revalidate:!1})};n.is_appreciated_by_me?(await (0,o.deleter)(`/api/v1/comments/${n.id}/appreciations`),await i({is_appreciated_by_me:!1})):(F(!0),await (0,o.poster)(`/api/v1/comments/${n.id}/appreciations`,{}),await i({is_appreciated_by_me:!0}),N((0,t.jsxs)(t.Fragment,{children:["Appreciation sent to ",(0,t.jsx)("b",{children:n.user.name})]}),"appreciation"))})()},children:(0,t.jsx)(u.FontAwesomeIcon,{className:(0,y.cn)({"fa-icon-pop":$,"text-yellow":n.is_appreciated_by_me}),icon:n.is_appreciated_by_me?h.faSparkles:d.faSparkles,onAnimationEnd:()=>F(!1)})}),(0,t.jsx)("button",{onClick:()=>{_?.is_member?r(n.id):B("comment")},children:(0,t.jsx)(u.FontAwesomeIcon,{icon:d.faReply})})]})]}),_?.username===n.user.username&&n.has_appreciations&&(0,t.jsxs)("button",{onClick:L,className:"ml-12 text-footnote",children:[(0,t.jsx)(u.FontAwesomeIcon,{className:"text-yellow",icon:h.faSparkles})," Appreciations"]}),n.reply_count>0&&(0,t.jsxs)("button",{onClick:()=>z(!P),className:"mt-3 ml-12 block py-1 pr-2 pl-0 text-footnote font-semibold text-gray-1",children:[(0,t.jsx)(u.FontAwesomeIcon,{className:"mr-2",icon:P?h.faMinus:h.faPlus}),P?`Hide ${1===n.reply_count?"reply":"replies"}`:`View ${1===n.reply_count?"reply":"replies"} (${n.reply_count})`]})]}),s&&P&&(0,t.jsx)(O,{comment:n,post:e,handleReplyFunc:s,handleEditFunc:l,anchorId:k})]})}e.s(["CommentList",0,function({className:e,post:d,handleReplyFunc:h,handleEditFunc:u,commentListEnd:p}){let{isLoadingInitial:f}=(0,i.useAuth)(),[m,g]=(0,a.useState)(),y=(0,l.useRouter)(),{data:x,error:v,mutate:b}=(0,c.default)(f?null:`/api/v2/post/${d.friendly_id}/comments?idtype=web`,o.getter),{data:w}=(0,c.default)(m?`/api/v1/comments/${m}`:null,o.getter);(0,a.useEffect)(()=>{-1!==window.location.href.indexOf("#")&&g(window.location.href.slice(window.location.href.indexOf("#")+1))},[]),(0,a.useEffect)(()=>{let e=e=>{-1!==e.indexOf("#")&&g(e.slice(e.indexOf("#")+1))};return y.events.on("hashChangeStart",e),()=>{y.events.off("hashChangeStart",e)}},[y.events]);let k=e=>{if(!x)return;let t=x.find(t=>
84t.id===e);t&&h.current&&h.current(t)},S=()=>{b()};return v?(0,t.jsx)(n.LoadingError,{className:"border-t border-solid border-gray-6 py-6",title:"Failed to load comments",mutate:b}):x?(0,t.jsxs)("div",{className:e,children:[(0,t.jsx)(s.motion.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.1},children:x.map(e=>(0,t.jsx)(T,{post:d,comment:e,onReply:k,handleReplyFunc:h,handleEditFunc:u,expanded:e.id===w?.parent_id,anchorId:w?.id||"",onFeature:S},e.id))}),(0,t.jsx)("div",{ref:p})," "]}):(0,t.jsx)(r.LoadingSpinner,{className:"py-6",size:"small",delayed:!0})}],850241);var N=e.i(121757),E=e.i(314691),_=e.i(553938),D=e.i(543140);function A({post:e,mutatePost:n,handleToggleDialog:s}){let{toast:c}=(0,m.useToasts)(),{user:p}=(0,i.useAuth)(),f=(0,l.useRouter)(),{flagEnabled:g}=(0,S.useFeatureFlags)(),[y,x]=(0,a.useState)(),[v,b]=(0,a.useState)(!1),[C,M]=(0,a.useState)(!1),[O,T]=(0,a.useState)(!1),[N,E]=(0,a.useState)(!1),[_,j]=(0,a.useState)(!1),[R,I]=(0,a.useState)(!1),P=async t=>{try{await (0,o.poster)(`/api/v1/posts/${e.id}/report`,{reason:t}),x("reportDone")}catch{c("Failed to report photo","error")}};return(0,t.jsxs)(k.Dialog,{handleToggleDialog:s,children:[N&&(0,t.jsx)(w.ConfirmationDialog,{title:"Delete photo",prompt:"Are you sure you want to delete this photo? This will permanently remove the photo and all of its comments.",confirmText:"Delete photo",onCancel:()=>E(!1),onConfirm:()=>{(async()=>{try{T(!0),await (0,o.deleter)(`/api/v1/posts/${e.id}`),await f.push(`/${e.user.username}`,void 0,{shallow:!0}),f.reload(),T(!1)}catch{c("Failed to delete photo","error")}})()},confirming:O}),!y&&(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{children:O?(0,t.jsx)(r.Loa
84dingSpinner,{size:"small"}):p?.username===e.user.username?(0,t.jsx)("button",{className:"text-red",onClick:()=>E(!0),children:"Delete photo"}):(0,t.jsx)("button",{className:"text-red",onClick:()=>x("reportConfirm"),children:"Report"})}),g("manage_featured_posts")&&(0,t.jsx)("li",{children:_?(0,t.jsx)(r.LoadingSpinner,{size:"small"}):(0,t.jsxs)("button",{onClick:()=>{(async()=>{j(!0),e.is_featured?(await (0,o.deleter)(`/api/v1/posts/featured/${e.id}`),await n({...e,is_featured:!1}),c((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.FontAwesomeIcon,{icon:d.faPartyHorn}),"Post unfeatured"]}),"success")):(await (0,o.poster)(`/api/v1/posts/featured/${e.id}`),await n({...e,is_featured:!0}),c((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.FontAwesomeIcon,{icon:h.faPartyHorn,className:"text-yellow"}),"Post featured"]}),"success")),s(),j(!1)})()},className:(e.is_featured,"text-primary"),children:[e.is_featured?"Unfeature":"Feature"," photo"]})}),g("manage_featured_posts")&&!e.is_featured&&(0,t.jsx)("li",{children:R?(0,t.jsx)(r.LoadingSpinner,{size:"small"}):(0,t.jsx)("button",{onClick:()=>{(async()=>{I(!0);try{await (0,o.poster)(`/api/v1/posts/queued/${e.id}`),c("Added to Explore queue","success"),s()}catch(e){(0,D.isAxiosError)(e)&&e.response?.status===409?c("Already queued or featured","error"):c("Failed to add to Explore queue","error")}I(!1)})()},className:"text-primary",children:"Add to Explore queue"})}),p?.is_team_member&&(0,t.jsx)("li",{children:(0,t.jsx)("button",{onClick:()=>{let t=window.open(e.image3072x3072,"_blank","noopener,noreferrer");t&&(t.opener=null)},className:"text-primary",children:"Download 3072x3072"})}),(0,t.jsx)("li",{children:(0,t.jsx)("button",{onClick:s,children:"Cancel"})})]}),"reportConfirm"===y&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"border-b border-solid border-gray-5 px-6 py-0",children:[(0,t.jsx)("h2",{children:"Report"}),(0,t.jsx)("strong",{children:"Why are you reporting this photo?"}),(0,t.jsx)("p",{children:"We appreciate you helping us keep Glass safe. The member will not know who reported them."})]}),(0,t.jsxs)("ul",{children:[(0,t.jsx)("li",{children:v?(0,t.jsx)(r.Loa
84dingSpinner,{size:"small"}):(0,t.jsx)("button",{onClick:()=>{(async()=>{b(!0),await P("spam"),b(!1)})()},children:"It's spam"})}),(0,t.jsx)("li",{children:C?(0,t.jsx)(r.LoadingSpinner,{size:"small"}):(0,t.jsx)("button",{onClick:()=>{(async()=>{M(!0),await P("inappropriate"),M(!1)})()},children:"It's inappropriate"})}),(0,t.jsx)("li",{children:(0,t.jsx)("button",{onClick:()=>x(void 0),children:"Cancel"})})]})]}),"reportDone"===y&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"border-b border-solid border-gray-5 px-6 py-0",children:[(0,t.jsx)("h2",{children:"Report"}),(0,t.jsx)("strong",{children:"Thanks for letting us know!"}),(0,t.jsx)("p",{children:"This feedback is important in helping us keep the Glass community safe and secure for everyone."})]}),(0,t.jsx)("ul",{children:(0,t.jsx)("li",{children:(0,t.jsx)("button",{onClick:s,children:"Done"})})})]})]})}e.s(["PostActions",0,function({className:e,post:n,origin:r,mutatePost:s}){let{user:l}=(0,i.useAuth)(),{open:c}=(0,f.useSubscribeModal)(),{toast:p}=(0,m.useToasts)(),[g,x]=(0,a.useState)(!1),[v,b]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),S=n.user.username===l?.username,C=()=>x(!g),M=()=>{(async()=>{n.is_appreciated_by_me?(await (0,o.deleter)(`/api/v1/post/${n.id}/appreciations`),await s({...n,is_appreciated_by_me:!1})):(k(!0),await (0,o.poster)(`/api/v1/post/${n.id}/appreciations`),await s({...n,is_appreciated_by_me:!0}),p((0,t.jsxs)(t.Fragment,{children:["Appreciation sent to ",(0,t.jsx)("b",{children:n.user.name})]}),"appreciation"))})()},O=()=>{l?.is_member?(async()=>{n.is_bookmarked_by_me?(await (0,o.deleter)(`/api/v1/post/${n.id}/bookmark`),await s({...n,is_bookmarked_by_me:!1}),p((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.FontAwesomeIcon,{icon:d.faBookmark}),"Bookmark removed"]}),"success")):(await (0,o.poster)(`/api/v2/post/${n.id}/bookmark`),await s({...n,is_bookmarked_by_me:!0}),p((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.FontAwesomeIcon,{icon:h.faBookmark,className:"text-yellow"}),"Post bookmarked"]}),"success"))})():c("bookmark")};return(0,_.useHotkeys)("e",()=>{l?.is_member&&(S?b(e=>!e):p("You can only edit your own posts","error"))},{preventDefault:!0,useKey:!0}),(0,_.useHotkeys)("a",()=>{S?p("You can't appreciate your own posts","error"):n.is_appreciated_by_me||M()},{useKey:!0},[n.is_appreciated_by_me]),(0,_.useHotkeys)("b",()=>{l?.is_member&&(S?p("You can't bookmark your own posts","error"):O())},{useKey:!0},[n.is_bookmarked_by_me]),(0,t.jsxs)(t.Fragment,{children:[g&&(0,t.jsx)(A,{handleToggleDialog:C,post:n,mutatePost:s}),v&&(0,t.jsx)(N.ComposerContainer,{initialPosts:[n],onClose:()=>{s(),b(!1)}}),(0,t.jsxs)(E.NavigationBar,{className:e,children:[!S&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("button",{type:"button",onClick:M,title:n.is_appreciated_by_me?"Unappreciate":"Appreciate","aria-label":n.is_appreciated_by_me?"Unappreciate":"Appreciate",children:(0,t.jsx)(u.FontAwesomeIcon,{className:(0,y.cn)({"fa-icon-pop":w,"text-yellow":n.is_appreciated_by_me}),icon:n.is_appreciated_by_me?h.faSparkles:d.faSparkles,onAnimationEnd:()=>k(!1)})}),(0,t.jsx)("button",{type:"button",onClick:O,title:n.is_bookmarked_by_me?"Remove bookmark":"Add bookmark","aria-label":n.is_bookmarked_by_me?"Remove bookmark":"Add bookmark",children:(0,t.jsx)(u.FontAwesomeIcon,{className:(0,y.cn)("mr-[-1px]",{"text-yellow":n.is_bookmarked_by_me}),icon:n.is_bookmarked_by_me?h.faBookmark:d.faBookmark})})]}),S&&(0,t.jsx)("button",{type:"button",onClick:()=>{l?.is_member?b(!0):c("edit")},title:"Edit post","aria-label":"Edit post",children:(0,t.jsx)(u.FontAwesomeIcon,{icon:d.faPen})}),"function"==typeof navigator.share&&n.user.enable_public_profile&&(0,t.jsx)("button",{type:"button",onClick:()=>{let e=`${r}/${n.user.username}/${n.friendly_id}`;(async()=>{if("function"==typeof navigator.canShare&&navigator.canShare&&navigator.canShare({url:e}))try{await navigator.share({url:e})}catch{}else await navigator.clipboard.writeText(e),p((0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u.FontAwesomeIcon,{icon:d.faClipboard})," Post link copied to clipboard"]}),"success")})()},"aria-label":"Share",children:(0,t.jsx)(u.FontAwesomeIcon,{icon:d.faArrowUpFromSquare})}),(0,t.jsx)("button",{type:"button",onClick:C,"aria-label":"More options",children:(0,t.jsx)(u.FontAwesomeIcon,{icon:h.faEllipsis})})]})]})}],764357)},240104,e=>{"use strict";var t=e.i(380447),n=e.i(543140),r=e.i(984138),i=e.i(313312),o=e.i(698524),s=e.i(743133),l=e.i(99338),a=e.i(794948),c=e.i(368938),d=e.i(999161),h=e.i(553938),u=e.i(445280),p=e.i(898136),f=e.i(864458),m=e.i(138400),g=e.i(699721),y=e.i(808193),x=e.i(314691),v=e.i(918485),b=e.i(620917),w=e.i(582512),k=e.i(56311),S=e.i(701831),C=e.i(850241),M=e.i(764357),O=e.i(909653),T=e.i(790931),N=e.i(713687),E=e.i(237011),_=e.i(552979),D=e.i(563823);function A({post:e}){return(0,t.jsxs)("section",{className:"p-4",children:[(0,t.jsx)(N.UserAvatarWithName,{user:e.user,withBadge:!0}),(0,t.jsxs)("div",{className:"grid grid-cols-[2.25rem_1fr] gap-x-3 gap-y-2.5 [overflow-wrap:anywhere] text-gray-1",children:[(0,t.jsx)(R,{description:e.description}),(0,t.jsx)(I,{series:e.series,username:e.user.username}),(0,t.jsx)(P,{categories:e.categories}),(0,t.jsx)(z,{camera:e.camera,rawCamera:e.exif?.camera}),(0,t.jsx)($,{lens:e.lens,rawLens:e.exif?.lens}),(0,t.jsx)(F,{exif:e.exif}),(0,t.jsx)(B,{timestamp:e.exif?.date_time_original}),(0,t.jsx)(V,{timestamp:e.created_at,isEdited:e.is_edited})]})]})}function j({icon:e,children:n}){return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"col-start-1 text-center",children:e&&(0,t.jsx)(g.FontAwesomeIcon,{icon:e})}),n]})}function R({description:e}){return(0,t.jsx)(j,{children:(0,t.jsx)("div",{dangerouslySetInnerHTML:{__html:(0,D.parseMentions)(e)},className:(0,w.cn)("whitespace-pre-wrap text-primary standalone:select-text","[&_a]:font-semibold [&_a]:break-all [&_a]:text-primary [&_a]:underline-offset-2 [&_a:hover]:underline [&_a:hover]:decoration-gray-3 [&_a:hover]:decoration-2")})})}function I({series:e,username:n}){if(!e)return null;let r=`/${n}/series/${e.slug}`;return(0,t.jsx)(j,{icon:m.faRectangleHistory,children:(0,t.jsxs)(_.default,{href:r,className:"group flex flex-col gap-2 font-semibold text-primary underline-offset-2",children:[(0,t.jsx)("div",{className:"group-hover:underline group-hover:decoration-gray-3 group-hover:decoration-2",children:e.title}),(0,t.jsx)("div",{className:"flex flex-row items-center justify-start gap-1",children:e.posts?.map((n,r)=>(0,t.jsx)("img",{className:"block h-18 w-18 rounded-xs object-cover xl:h-22 xl:w-22",src:n.image192x192,alt:""},`series-${e.id}-preview-${r}`))})]})})}function P({categories:e}){return e?(0,t.jsx)(j,{icon:m.faTag,children:(0,t.jsx)("ul",{className:"m-0 flex list-none flex-wrap p-0 indent-0",children:e.map(e=>(0,t.jsx)("li",{className:"whitespace-nowrap [&:not(:last-child):after]:whitespace-pre [&:not(:last-child):after]:content-['_â¢_']",children:(0,t.jsx)(_.default,{href:`/explore/categories/${e.slug}`,className:(0,w.cn)("font-semibold text-primary underline-offset-2 hover:underline hover:decoration-gray-3 hover:decoration-2",{"!underline !decoration-yellow":e.highlighted}),children:e.name})},e.id))})}):null}function z({camera:e,rawCamera:n}){return e||n?(0,t.jsx)(j,{icon:m.faCamera,children:e?(0,t.jsxs)(O.ConditionalLink,{className:(0,w.cn)({"font-semibold text-primary underline-offset-2 hover:underline hover:decoration-gray-3 hover:decoration-2":!!e.maker_slug&&!!e.model_slug}),href:`/explore/cameras/${e.maker_slug}/${e.model_slug}`,interactive:!!e.maker_slug&&!!e.model_slug,children:[e.maker," ",e.model," "]}):n}):null}function $({lens:e,rawLens:n}){return e||n?(0,t.jsx)(j,{icon:m.faAperture,children:e?(0,t.jsxs)(O.ConditionalLink,{className:(0,w.cn)({"font-semibold text-primary underline-offset-2 hover:underline hover:decoration-gray-3 hover:decoration-2":!!e.maker_slug&&!!e.model_slug}),href:`/explore/lenses/${e.maker_slug}/${e.model_slug}`,interactive:!!e.maker_slug&&!!e.model_slug,children:[e.maker," ",e.model]}):n}):null}function F({exif:e}){let n=[e?.focal_length,e?.aperture,e?.exposure_time,e?.iso?`ISO ${e.iso}
84`:null].filter(Boolean).join(", ");return n?(0,t.jsx)(j,{icon:m.faLoader,children:n}):null}function B({timestamp:e}){if(!e)return null;let n=E.DateTime.fromISO(e),r=n.toLocaleString(E.DateTime.DATETIME_MED_WITH_SECONDS,{locale:"en-US"}),i=n.toLocaleString(E.DateTime.DATE_MED,{locale:"en-US"});return(0,t.jsx)(j,{icon:m.faCalendar,children:(0,t.jsx)("span",{title:r,children:i})})}function V({timestamp:e,isEdited:n}){return(0,t.jsx)(j,{children:(0,t.jsxs)("span",{className:"mt-2 text-footnote text-gray-1",children:[(0,t.jsx)(T.TimeAgo,{prefix:"Uploaded ",date:e}),n&&(0,t.jsx)("span",{children:" (edited)"})]})})}function L({className:e,post:n,origin:r,mutatePost:i,onPrevious:o,onNext:a}){let{isLoggedIn:h}=(0,s.useAuth)(),{toast:u}=(0,v.useToasts)(),{mutate:p}=(0,b.useSWRConfig)(),f=(0,c.useRouter)(),O=(0,d.useRef)(void 0),T=(0,d.useRef)(void 0),N=(0,d.useRef)(null),[E,_]=(0,d.useState)(0),D=async(e,t)=>{try{let r=await (0,l.poster)(`/api/v2/post/${n.friendly_id}/comments`,{body:e,parent_id:t?.parent_id||t?.id});t&&await p(`/api/v1/comments/${t?.parent_id||t?.id}/replies?idtype=web`),await p(`/api/v2/post/${n.friendly_id}/comments?idtype=web`),_(e=>e+1),setTimeout(()=>{(async()=>{await f.replace(`/${n.user.username}/${n.friendly_id}#${r.id}`)})()})}catch{u("Something went wrong, your comment could not be posted. Please try again.","error")}},j=async(e,t,r)=>{try{await (0,l.patcher)(`/api/v1/comments/${e}`,{body:t}),r&&await p(`/api/v1/comments/${r}/replies?idtype=web`),await p(`/api/v2/post/${n.friendly_id}/comments?idtype=web`),_(e=>e+1)}catch{u("Something went wrong, your comment could not be updated. Please try again.","error")}},R=!!(o||a);return(0,t.jsxs)("div",{className:(0,w.cn)("flex flex-col lg:relative",e),children:[h&&(0,t.jsx)(M.PostActions,{className:"fixed right-6 bottom-6-safe z-20 flex-row-reverse lg:absolute lg:top-6 lg:right-auto lg:bottom-auto lg:left-4 lg:flex-row",post:n,origin:r,mutatePost:i}),R&&(0,t.jsxs)(x.NavigationBar,{className:"absolute top-6 right-4 z-20 hidden px-2 lg:flex [&_button]:!w-8",children:[(0,t.jsx)("button",{type:"button",onClick:o,disabled:!o,"aria-label":"Previous photo",children:(0,t.jsx)(g.FontAwesomeIcon,{icon:m.faAngleLeft})}),(0,t.jsx)("button",{type:"button",onClick:a,disabled:!a,"aria-label":"Next photo",children:(0,t.jsx)(g.FontAwesomeIcon,{icon:m.faAngleRight})})]}),(0,t.jsxs)("div",{className:(0,w.cn)("mb-20 flex flex-col lg:mb-20 lg:shrink lg:grow lg:basis-auto lg:overflow-x-hidden lg:overflow-y-auto",{"mb-0 lg:mb-26":h,"lg:pt-18":h||R}),children:[(0,t.jsx)(A,{post:n}),h&&(0,t.jsx)(k.Appreciations,{post:n}),(0,t.jsx)(C.CommentList,{post:n,handleReplyFunc:O,handleEditFunc:T,commentListEnd:N})]}),h&&(0,t.jsx)(S.CommentInput,{handleReplyFunc:O,handleEditFunc:T,onSubmit:D,onUpdate:j},E),(0,t.jsx)(y.JoinBanner,{className:"fixed bottom-0 w-full border-t border-solid border-gray-6 lg:absolute"})]})}e.s(["Post",0,function({postID:e,fallbackData:m,origin:g,willHydrate:y,onAccessDenied:x,onPrevious:v,onNext:b}){let w,{isLoadingInitial:k}=(0,s.useAuth)(),S=(0,c.useRouter)(),[C,M]=(0,d.useState)(!1);(0,h.useHotkeys)("?",()=>M(e=>!e),{useKey:!0,ignoreModifiers:!0});let{data:O,error:T,mutate:N}=(0,u.default)(e&&!k?`/api/v1/post/${e}`:null,l.getter,{fallbackData:m?.post,revalidateOnMount:void 0===m,revalidateOnFocus:!1});(0,h.useHotkeys)("p",()=>O&&void S.push(`${g}/${O.user.username}`),{useKey:!0},[O]);let E=(0,d.useMemo)(()=>{if(!O?.description)return"";let e=(O.description||"").replace(/\n/g," ");return e.length>150&&(e=e.substring(0,150)+"â¦"),e},[O?.description]);return T?x&&(0,n.isAxiosError)(T)&&T.response?.status===403?(x(),null):(0,t.jsx)(r.Loa
84dingError,{title:"Failed to load post",mutate:N}):void 0===O?(0,t.jsx)(i.LoadingSpinner,{size:"medium"}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(o.Title,{children:[E,`${O.user.name} on Glass Photography Community`].filter(Boolean).join(" â ")}),(0,t.jsxs)(a.default,{children:[(0,t.jsx)("link",{rel:"canonical",href:`${g}/${O.user.username}/${O.friendly_id}`}),(0,t.jsx)("meta",{name:"description",content:E}),(0,t.jsx)("meta",{name:"apple-itunes-app",content:`app-id=1528446339, app-argument=${g}/${O.user.username}/${O.friendly_id}`}),(0,t.jsx)("meta",{property:"og:title",content:E}),(0,t.jsx)("meta",{property:"og:description",content:`${O.user.name} on Glass`}),(0,t.jsx)("meta",{property:"og:image",content:O.image828x0}),(0,t.jsx)("meta",{property:"og:type",content:"website"}),(0,t.jsx)("meta",{property:"og:url",content:`${g}/${O.user.username}/${O.friendly_id}`}),(0,t.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,t.jsx)("meta",{name:"twitter:title",content:E}),(0,t.jsx)("meta",{name:"twitter:description",content:`${O.user.name} on Glass`}),(0,t.jsx)("meta",{name:"twitter:image",content:O.image800x418}),(0,t.jsx)("meta",{name:"twitter:site",content:"@tryglass"}),(0,t.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify((w=[],O.camera?.model&&w.push({"@type":"PropertyValue",name:"camera",value:`${O.camera.maker} ${O.camera.model}`}),O.lens?.model&&w.push({"@type":"PropertyValue",name:"lens",value:`${O.lens.maker} ${O.lens.model}`}),O.exif?.aperture&&w.push({"@type":"PropertyValue",name:"aperture",value:O.exif.aperture}),O.exif?.focal_length&&w.push({"@type":"PropertyValue",name:"focalLength",value:O.exif.focal_length}),O.exif?.iso&&w.push({"@type":"PropertyValue",name:"isoSpeed",value:O.exif.iso}),O.exif?.exposure_time&&w.push({"@type":"PropertyValue",name:"exposureTime",value:O.exif.exposure_time}),{"@context":"https://schema.org","@type":"ImageObject",contentUrl:O.image3072x3072,thumbnailUrl:O.image828x0,name:O.description||"Photograph",description:O.description||void 0,width:O.width,height:O.height,author:{"@type":"Person",name:O.user.name,url:`${g}/${O.user.username}`},datePublished:O.created_at,...O.location&&{contentLocation:O.location},...w.length>0&&{exifData:w}}))}})]}),C&&(0,t.jsx)(p.HotkeysDialog,{onClose:()=>M(!1)}),(0,t.jsxs)("div",{className:"flex flex-col lg:h-screen lg:flex-row",children:[(0,t.jsx)(f.ImageContainer,{className:"shrink grow basis-auto",post:O,willHydrate:y}),(0,t.jsx)(L,{className:"lg:shrink-0 lg:grow-0 lg:basis-[340px] xl:basis-[380px]",post:O,origin:g,mutatePost:N,onPrevious:v,onNext:b},`post-container-metadata-${O.id}`)]})]})}],240104)}]); 85 86//# debugId=3bea6fd2-cd9a-6ffb-04f0-bd83d6eb2ec0
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.