@beterdichtbij/component-library 0.46.0 → 0.46.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -59,7 +59,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
59
59
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var T=!0,_=!1,M;return{s:function(){N=O[Symbol.iterator]()},n:function(){var W=N.next();return T=W.done,W},e:function(W){_=!0,M=W},f:function(){try{!T&&N.return!=null&&N.return()}finally{if(_)throw M}}}}function v(O,D){if(O){if(typeof O=="string")return C(O,D);var N=Object.prototype.toString.call(O).slice(8,-1);if(N==="Object"&&O.constructor&&(N=O.constructor.name),N==="Map"||N==="Set")return Array.from(O);if(N==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(N))return C(O,D)}}function C(O,D){(D==null||D>O.length)&&(D=O.length);for(var N=0,L=new Array(D);N<D;N++)L[N]=O[N];return L}var A={url:null,method:"post",withCredentials:!1,timeout:null,parallelUploads:2,uploadMultiple:!1,chunking:!1,forceChunking:!1,chunkSize:2e6,parallelChunkUploads:!1,retryChunks:!1,retryChunksLimit:3,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,thumbnailMethod:"crop",resizeWidth:null,resizeHeight:null,resizeMimeType:null,resizeQuality:.8,resizeMethod:"contain",filesizeBase:1e3,maxFiles:null,headers:null,clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,disablePreviews:!1,hiddenInputContainer:"body",capture:null,renameFilename:null,renameFile:null,forceFallback:!1,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictUploadCanceled:"Upload canceled.",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init:function(){},params:function(D,N,L){if(L)return{dzuuid:L.file.upload.uuid,dzchunkindex:L.index,dztotalfilesize:L.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:L.file.upload.totalChunkCount,dzchunkbyteoffset:L.index*this.options.chunkSize}},accept:function(D,N){return N()},chunksUploaded:function(D,N){N()},fallback:function(){var D;this.element.className="".concat(this.element.className," dz-browser-not-supported");var N=g(this.element.getElementsByTagName("div"),!0),L;try{for(N.s();!(L=N.n()).done;){var b=L.value;if(/(^| )dz-message($| )/.test(b.className)){D=b,b.className="dz-message";break}}}catch(_){N.e(_)}finally{N.f()}D||(D=z.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(D));var T=D.getElementsByTagName("span")[0];return T&&(T.textContent!=null?T.textContent=this.options.dictFallbackMessage:T.innerText!=null&&(T.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(D,N,L,b){var T={srcX:0,srcY:0,srcWidth:D.width,srcHeight:D.height},_=D.width/D.height;N==null&&L==null?(N=T.srcWidth,L=T.srcHeight):N==null?N=L*_:L==null&&(L=N/_),N=Math.min(N,T.srcWidth),L=Math.min(L,T.srcHeight);var M=N/L;if(T.srcWidth>N||T.srcHeight>L)if(b==="crop")_>M?(T.srcHeight=D.height,T.srcWidth=T.srcHeight*M):(T.srcWidth=D.width,T.srcHeight=T.srcWidth/M);else if(b==="contain")_>M?L=N/_:N=L*_;else throw new Error("Unknown resizeMethod '".concat(b,"'"));return T.srcX=(D.width-T.srcWidth)/2,T.srcY=(D.height-T.srcHeight)/2,T.trgWidth=N,T.trgHeight=L,T},transformFile:function(D,N){return(this.options.resizeWidth||this.options.resizeHeight)&&D.type.match(/image.*/)?this.resizeImage(D,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,N):N(D)},previewTemplate:m,drop:function(D){return this.element.classList.remove("dz-drag-hover")},dragstart:function(D){},dragend:function(D){return this.element.classList.remove("dz-drag-hover")},dragenter:function(D){return this.element.classList.add("dz-drag-hover")},dragover:function(D){return this.element.classList.add("dz-drag-hover")},dragleave:function(D){return this.element.classList.remove("dz-drag-hover")},paste:function(D){},reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(D){var N=this;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){D.previewElement=z.createElement(this.options.previewTemplate.trim()),D.previewTemplate=D.previewElement,this.previewsContainer.appendChild(D.previewElement);var L=g(D.previewElement.querySelectorAll("[data-dz-name]"),!0),b;try{for(L.s();!(b=L.n()).done;){var T=b.value;T.textContent=D.name}}catch(S){L.e(S)}finally{L.f()}var _=g(D.previewElement.querySelectorAll("[data-dz-size]"),!0),M;try{for(_.s();!(M=_.n()).done;)T=M.value,T.innerHTML=this.filesize(D.size)}catch(S){_.e(S)}finally{_.f()}this.options.addRemoveLinks&&(D._removeLink=z.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'.concat(this.options.dictRemoveFile,"</a>")),D.previewElement.appendChild(D._removeLink));var j=function(k){return k.preventDefault(),k.stopPropagation(),D.status===z.UPLOADING?z.confirm(N.options.dictCancelUploadConfirmation,function(){return N.removeFile(D)}):N.options.dictRemoveFileConfirmation?z.confirm(N.options.dictRemoveFileConfirmation,function(){return N.removeFile(D)}):N.removeFile(D)},W=g(D.previewElement.querySelectorAll("[data-dz-remove]"),!0),Z;try{for(W.s();!(Z=W.n()).done;){var X=Z.value;X.addEventListener("click",j)}}catch(S){W.e(S)}finally{W.f()}}},removedfile:function(D){return D.previewElement!=null&&D.previewElement.parentNode!=null&&D.previewElement.parentNode.removeChild(D.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(D,N){if(D.previewElement){D.previewElement.classList.remove("dz-file-preview");var L=g(D.previewElement.querySelectorAll("[data-dz-thumbnail]"),!0),b;try{for(L.s();!(b=L.n()).done;){var T=b.value;T.alt=D.name,T.src=N}}catch(_){L.e(_)}finally{L.f()}return setTimeout(function(){return D.previewElement.classList.add("dz-image-preview")},1)}},error:function(D,N){if(D.previewElement){D.previewElement.classList.add("dz-error"),typeof N!="string"&&N.error&&(N=N.error);var L=g(D.previewElement.querySelectorAll("[data-dz-errormessage]"),!0),b;try{for(L.s();!(b=L.n()).done;){var T=b.value;T.textContent=N}}catch(_){L.e(_)}finally{L.f()}}},errormultiple:function(){},processing:function(D){if(D.previewElement&&(D.previewElement.classList.add("dz-processing"),D._removeLink))return D._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple:function(){},uploadprogress:function(D,N,L){if(D.previewElement){var b=g(D.previewElement.querySelectorAll("[data-dz-uploadprogress]"),!0),T;try{for(b.s();!(T=b.n()).done;){var _=T.value;_.nodeName==="PROGRESS"?_.value=N:_.style.width="".concat(N,"%")}}catch(M){b.e(M)}finally{b.f()}}},totaluploadprogress:function(){},sending:function(){},sendingmultiple:function(){},success:function(D){if(D.previewElement)return D.previewElement.classList.add("dz-success")},successmultiple:function(){},canceled:function(D){return this.emit("error",D,this.options.dictUploadCanceled)},canceledmultiple:function(){},complete:function(D){if(D._removeLink&&(D._removeLink.innerHTML=this.options.dictRemoveFile),D.previewElement)return D.previewElement.classList.add("dz-complete")},completemultiple:function(){},maxfilesexceeded:function(){},maxfilesreached:function(){},queuecomplete:function(){},addedfiles:function(){}},E=A;function y(O){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?y=function(N){return typeof N}:y=function(N){return N&&typeof Symbol=="function"&&N.constructor===Symbol&&N!==Symbol.prototype?"symbol":typeof N},y(O)}function x(O,D){var N;if(typeof Symbol>"u"||O[Symbol.iterator]==null){if(Array.isArray(O)||(N=w(O))||D&&O&&typeof O.length=="number"){N&&(O=N);var L=0,b=function(){};return{s:b,n:function(){return L>=O.length?{done:!0}:{done:!1,value:O[L++]}},e:function(W){throw W},f:b}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
60
60
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var T=!0,_=!1,M;return{s:function(){N=O[Symbol.iterator]()},n:function(){var W=N.next();return T=W.done,W},e:function(W){_=!0,M=W},f:function(){try{!T&&N.return!=null&&N.return()}finally{if(_)throw M}}}}function w(O,D){if(O){if(typeof O=="string")return I(O,D);var N=Object.prototype.toString.call(O).slice(8,-1);if(N==="Object"&&O.constructor&&(N=O.constructor.name),N==="Map"||N==="Set")return Array.from(O);if(N==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(N))return I(O,D)}}function I(O,D){(D==null||D>O.length)&&(D=O.length);for(var N=0,L=new Array(D);N<D;N++)L[N]=O[N];return L}function B(O,D){if(!(O instanceof D))throw new TypeError("Cannot call a class as a function")}function R(O,D){for(var N=0;N<D.length;N++){var L=D[N];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(O,L.key,L)}}function U(O,D,N){return D&&R(O.prototype,D),N&&R(O,N),O}function $(O,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function");O.prototype=Object.create(D&&D.prototype,{constructor:{value:O,writable:!0,configurable:!0}}),D&&P(O,D)}function P(O,D){return P=Object.setPrototypeOf||function(L,b){return L.__proto__=b,L},P(O,D)}function Y(O){var D=H();return function(){var L=J(O),b;if(D){var T=J(this).constructor;b=Reflect.construct(L,arguments,T)}else b=L.apply(this,arguments);return G(this,b)}}function G(O,D){return D&&(y(D)==="object"||typeof D=="function")?D:K(O)}function K(O){if(O===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O}function H(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function J(O){return J=Object.setPrototypeOf?Object.getPrototypeOf:function(N){return N.__proto__||Object.getPrototypeOf(N)},J(O)}var z=function(O){$(N,O);var D=Y(N);function N(L,b){var T;B(this,N),T=D.call(this);var _,M;if(T.element=L,T.version=N.version,T.clickableElements=[],T.listeners=[],T.files=[],typeof T.element=="string"&&(T.element=document.querySelector(T.element)),!T.element||T.element.nodeType==null)throw new Error("Invalid dropzone element.");if(T.element.dropzone)throw new Error("Dropzone already attached.");N.instances.push(K(T)),T.element.dropzone=K(T);var j=(M=N.optionsForElement(T.element))!=null?M:{};if(T.options=N.extend({},E,j,b??{}),T.options.previewTemplate=T.options.previewTemplate.replace(/\n*/g,""),T.options.forceFallback||!N.isBrowserSupported())return G(T,T.options.fallback.call(K(T)));if(T.options.url==null&&(T.options.url=T.element.getAttribute("action")),!T.options.url)throw new Error("No URL provided.");if(T.options.acceptedFiles&&T.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");if(T.options.uploadMultiple&&T.options.chunking)throw new Error("You cannot set both: uploadMultiple and chunking.");return T.options.acceptedMimeTypes&&(T.options.acceptedFiles=T.options.acceptedMimeTypes,delete T.options.acceptedMimeTypes),T.options.renameFilename!=null&&(T.options.renameFile=function(W){return T.options.renameFilename.call(K(T),W.name,W)}),typeof T.options.method=="string"&&(T.options.method=T.options.method.toUpperCase()),(_=T.getExistingFallback())&&_.parentNode&&_.parentNode.removeChild(_),T.options.previewsContainer!==!1&&(T.options.previewsContainer?T.previewsContainer=N.getElement(T.options.previewsContainer,"previewsContainer"):T.previewsContainer=T.element),T.options.clickable&&(T.options.clickable===!0?T.clickableElements=[T.element]:T.clickableElements=N.getElements(T.options.clickable,"clickable")),T.init(),T}return U(N,[{key:"getAcceptedFiles",value:function(){return this.files.filter(function(b){return b.accepted}).map(function(b){return b})}},{key:"getRejectedFiles",value:function(){return this.files.filter(function(b){return!b.accepted}).map(function(b){return b})}},{key:"getFilesWithStatus",value:function(b){return this.files.filter(function(T){return T.status===b}).map(function(T){return T})}},{key:"getQueuedFiles",value:function(){return this.getFilesWithStatus(N.QUEUED)}},{key:"getUploadingFiles",value:function(){return this.getFilesWithStatus(N.UPLOADING)}},{key:"getAddedFiles",value:function(){return this.getFilesWithStatus(N.ADDED)}},{key:"getActiveFiles",value:function(){return this.files.filter(function(b){return b.status===N.UPLOADING||b.status===N.QUEUED}).map(function(b){return b})}},{key:"init",value:function(){var b=this;if(this.element.tagName==="form"&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(N.createElement('<div class="dz-default dz-message"><button class="dz-button" type="button">'.concat(this.options.dictDefaultMessage,"</button></div>"))),this.clickableElements.length){var T=function X(){b.hiddenFileInput&&b.hiddenFileInput.parentNode.removeChild(b.hiddenFileInput),b.hiddenFileInput=document.createElement("input"),b.hiddenFileInput.setAttribute("type","file"),(b.options.maxFiles===null||b.options.maxFiles>1)&&b.hiddenFileInput.setAttribute("multiple","multiple"),b.hiddenFileInput.className="dz-hidden-input",b.options.acceptedFiles!==null&&b.hiddenFileInput.setAttribute("accept",b.options.acceptedFiles),b.options.capture!==null&&b.hiddenFileInput.setAttribute("capture",b.options.capture),b.hiddenFileInput.setAttribute("tabindex","-1"),b.hiddenFileInput.style.visibility="hidden",b.hiddenFileInput.style.position="absolute",b.hiddenFileInput.style.top="0",b.hiddenFileInput.style.left="0",b.hiddenFileInput.style.height="0",b.hiddenFileInput.style.width="0",N.getElement(b.options.hiddenInputContainer,"hiddenInputContainer").appendChild(b.hiddenFileInput),b.hiddenFileInput.addEventListener("change",function(){var S=b.hiddenFileInput.files;if(S.length){var k=x(S,!0),V;try{for(k.s();!(V=k.n()).done;){var Q=V.value;b.addFile(Q)}}catch(ie){k.e(ie)}finally{k.f()}}b.emit("addedfiles",S),X()})};T()}this.URL=window.URL!==null?window.URL:window.webkitURL;var _=x(this.events,!0),M;try{for(_.s();!(M=_.n()).done;){var j=M.value;this.on(j,this.options[j])}}catch(X){_.e(X)}finally{_.f()}this.on("uploadprogress",function(){return b.updateTotalUploadProgress()}),this.on("removedfile",function(){return b.updateTotalUploadProgress()}),this.on("canceled",function(X){return b.emit("complete",X)}),this.on("complete",function(X){if(b.getAddedFiles().length===0&&b.getUploadingFiles().length===0&&b.getQueuedFiles().length===0)return setTimeout(function(){return b.emit("queuecomplete")},0)});var W=function(S){if(S.dataTransfer.types){for(var k=0;k<S.dataTransfer.types.length;k++)if(S.dataTransfer.types[k]==="Files")return!0}return!1},Z=function(S){if(W(S))return S.stopPropagation(),S.preventDefault?S.preventDefault():S.returnValue=!1};return this.listeners=[{element:this.element,events:{dragstart:function(S){return b.emit("dragstart",S)},dragenter:function(S){return Z(S),b.emit("dragenter",S)},dragover:function(S){var k;try{k=S.dataTransfer.effectAllowed}catch{}return S.dataTransfer.dropEffect=k==="move"||k==="linkMove"?"move":"copy",Z(S),b.emit("dragover",S)},dragleave:function(S){return b.emit("dragleave",S)},drop:function(S){return Z(S),b.drop(S)},dragend:function(S){return b.emit("dragend",S)}}}],this.clickableElements.forEach(function(X){return b.listeners.push({element:X,events:{click:function(k){return(X!==b.element||k.target===b.element||N.elementInside(k.target,b.element.querySelector(".dz-message")))&&b.hiddenFileInput.click(),!0}}})}),this.enable(),this.options.init.call(this)}},{key:"destroy",value:function(){return this.disable(),this.removeAllFiles(!0),this.hiddenFileInput!=null&&this.hiddenFileInput.parentNode&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,N.instances.splice(N.instances.indexOf(this),1)}},{key:"updateTotalUploadProgress",value:function(){var b,T=0,_=0,M=this.getActiveFiles();if(M.length){var j=x(this.getActiveFiles(),!0),W;try{for(j.s();!(W=j.n()).done;){var Z=W.value;T+=Z.upload.bytesSent,_+=Z.upload.total}}catch(X){j.e(X)}finally{j.f()}b=100*T/_}else b=100;return this.emit("totaluploadprogress",b,_,T)}},{key:"_getParamName",value:function(b){return typeof this.options.paramName=="function"?this.options.paramName(b):"".concat(this.options.paramName).concat(this.options.uploadMultiple?"[".concat(b,"]"):"")}},{key:"_renameFile",value:function(b){return typeof this.options.renameFile!="function"?b.name:this.options.renameFile(b)}},{key:"getFallbackForm",value:function(){var b,T;if(b=this.getExistingFallback())return b;var _='<div class="dz-fallback">';this.options.dictFallbackText&&(_+="<p>".concat(this.options.dictFallbackText,"</p>")),_+='<input type="file" name="'.concat(this._getParamName(0),'" ').concat(this.options.uploadMultiple?'multiple="multiple"':void 0,' /><input type="submit" value="Upload!"></div>');var M=N.createElement(_);return this.element.tagName!=="FORM"?(T=N.createElement('<form action="'.concat(this.options.url,'" enctype="multipart/form-data" method="').concat(this.options.method,'"></form>')),T.appendChild(M)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),T??M}},{key:"getExistingFallback",value:function(){for(var b=function(Z){var X=x(Z,!0),S;try{for(X.s();!(S=X.n()).done;){var k=S.value;if(/(^| )fallback($| )/.test(k.className))return k}}catch(V){X.e(V)}finally{X.f()}},T=0,_=["div","form"];T<_.length;T++){var M=_[T],j;if(j=b(this.element.getElementsByTagName(M)))return j}}},{key:"setupEventListeners",value:function(){return this.listeners.map(function(b){return function(){var T=[];for(var _ in b.events){var M=b.events[_];T.push(b.element.addEventListener(_,M,!1))}return T}()})}},{key:"removeEventListeners",value:function(){return this.listeners.map(function(b){return function(){var T=[];for(var _ in b.events){var M=b.events[_];T.push(b.element.removeEventListener(_,M,!1))}return T}()})}},{key:"disable",value:function(){var b=this;return this.clickableElements.forEach(function(T){return T.classList.remove("dz-clickable")}),this.removeEventListeners(),this.disabled=!0,this.files.map(function(T){return b.cancelUpload(T)})}},{key:"enable",value:function(){return delete this.disabled,this.clickableElements.forEach(function(b){return b.classList.add("dz-clickable")}),this.setupEventListeners()}},{key:"filesize",value:function(b){var T=0,_="b";if(b>0){for(var M=["tb","gb","mb","kb","b"],j=0;j<M.length;j++){var W=M[j],Z=Math.pow(this.options.filesizeBase,4-j)/10;if(b>=Z){T=b/Math.pow(this.options.filesizeBase,4-j),_=W;break}}T=Math.round(10*T)/10}return"<strong>".concat(T,"</strong> ").concat(this.options.dictFileSizeUnits[_])}},{key:"_updateMaxFilesReachedClass",value:function(){return this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}},{key:"drop",value:function(b){if(b.dataTransfer){this.emit("drop",b);for(var T=[],_=0;_<b.dataTransfer.files.length;_++)T[_]=b.dataTransfer.files[_];if(T.length){var M=b.dataTransfer.items;M&&M.length&&M[0].webkitGetAsEntry!=null?this._addFilesFromItems(M):this.handleFiles(T)}this.emit("addedfiles",T)}}},{key:"paste",value:function(b){if(ke(b!=null?b.clipboardData:void 0,function(_){return _.items})!=null){this.emit("paste",b);var T=b.clipboardData.items;if(T.length)return this._addFilesFromItems(T)}}},{key:"handleFiles",value:function(b){var T=x(b,!0),_;try{for(T.s();!(_=T.n()).done;){var M=_.value;this.addFile(M)}}catch(j){T.e(j)}finally{T.f()}}},{key:"_addFilesFromItems",value:function(b){var T=this;return function(){var _=[],M=x(b,!0),j;try{for(M.s();!(j=M.n()).done;){var W=j.value,Z;W.webkitGetAsEntry!=null&&(Z=W.webkitGetAsEntry())?Z.isFile?_.push(T.addFile(W.getAsFile())):Z.isDirectory?_.push(T._addFilesFromDirectory(Z,Z.name)):_.push(void 0):W.getAsFile!=null&&(W.kind==null||W.kind==="file")?_.push(T.addFile(W.getAsFile())):_.push(void 0)}}catch(X){M.e(X)}finally{M.f()}return _}()}},{key:"_addFilesFromDirectory",value:function(b,T){var _=this,M=b.createReader(),j=function(X){return Ne(console,"log",function(S){return S.log(X)})},W=function Z(){return M.readEntries(function(X){if(X.length>0){var S=x(X,!0),k;try{for(S.s();!(k=S.n()).done;){var V=k.value;V.isFile?V.file(function(Q){if(!(_.options.ignoreHiddenFiles&&Q.name.substring(0,1)==="."))return Q.fullPath="".concat(T,"/").concat(Q.name),_.addFile(Q)}):V.isDirectory&&_._addFilesFromDirectory(V,"".concat(T,"/").concat(V.name))}}catch(Q){S.e(Q)}finally{S.f()}Z()}return null},j)};return W()}},{key:"accept",value:function(b,T){this.options.maxFilesize&&b.size>this.options.maxFilesize*1024*1024?T(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(b.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):N.isValidFile(b,this.options.acceptedFiles)?this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles?(T(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",b)):this.options.accept.call(this,b,T):T(this.options.dictInvalidFileType)}},{key:"addFile",value:function(b){var T=this;b.upload={uuid:N.uuidv4(),progress:0,total:b.size,bytesSent:0,filename:this._renameFile(b)},this.files.push(b),b.status=N.ADDED,this.emit("addedfile",b),this._enqueueThumbnail(b),this.accept(b,function(_){_?(b.accepted=!1,T._errorProcessing([b],_)):(b.accepted=!0,T.options.autoQueue&&T.enqueueFile(b)),T._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function(b){var T=x(b,!0),_;try{for(T.s();!(_=T.n()).done;){var M=_.value;this.enqueueFile(M)}}catch(j){T.e(j)}finally{T.f()}return null}},{key:"enqueueFile",value:function(b){var T=this;if(b.status===N.ADDED&&b.accepted===!0){if(b.status=N.QUEUED,this.options.autoProcessQueue)return setTimeout(function(){return T.processQueue()},0)}else throw new Error("This file can't be queued because it has already been processed or was rejected.")}},{key:"_enqueueThumbnail",value:function(b){var T=this;if(this.options.createImageThumbnails&&b.type.match(/image.*/)&&b.size<=this.options.maxThumbnailFilesize*1024*1024)return this._thumbnailQueue.push(b),setTimeout(function(){return T._processThumbnailQueue()},0)}},{key:"_processThumbnailQueue",value:function(){var b=this;if(!(this._processingThumbnail||this._thumbnailQueue.length===0)){this._processingThumbnail=!0;var T=this._thumbnailQueue.shift();return this.createThumbnail(T,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,function(_){return b.emit("thumbnail",T,_),b._processingThumbnail=!1,b._processThumbnailQueue()})}}},{key:"removeFile",value:function(b){if(b.status===N.UPLOADING&&this.cancelUpload(b),this.files=ee(this.files,b),this.emit("removedfile",b),this.files.length===0)return this.emit("reset")}},{key:"removeAllFiles",value:function(b){b==null&&(b=!1);var T=x(this.files.slice(),!0),_;try{for(T.s();!(_=T.n()).done;){var M=_.value;(M.status!==N.UPLOADING||b)&&this.removeFile(M)}}catch(j){T.e(j)}finally{T.f()}return null}},{key:"resizeImage",value:function(b,T,_,M,j){var W=this;return this.createThumbnail(b,T,_,M,!0,function(Z,X){if(X==null)return j(b);var S=W.options.resizeMimeType;S==null&&(S=b.type);var k=X.toDataURL(S,W.options.resizeQuality);return(S==="image/jpeg"||S==="image/jpg")&&(k=ve.restore(b.dataURL,k)),j(N.dataURItoBlob(k))})}},{key:"createThumbnail",value:function(b,T,_,M,j,W){var Z=this,X=new FileReader;X.onload=function(){if(b.dataURL=X.result,b.type==="image/svg+xml"){W!=null&&W(X.result);return}Z.createThumbnailFromUrl(b,T,_,M,j,W)},X.readAsDataURL(b)}},{key:"displayExistingFile",value:function(b,T,_,M){var j=this,W=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;if(this.emit("addedfile",b),this.emit("complete",b),!W)this.emit("thumbnail",b,T),_&&_();else{var Z=function(S){j.emit("thumbnail",b,S),_&&_()};b.dataURL=T,this.createThumbnailFromUrl(b,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,Z,M)}}},{key:"createThumbnailFromUrl",value:function(b,T,_,M,j,W,Z){var X=this,S=document.createElement("img");return Z&&(S.crossOrigin=Z),j=getComputedStyle(document.body).imageOrientation=="from-image"?!1:j,S.onload=function(){var k=function(Q){return Q(1)};return typeof EXIF<"u"&&EXIF!==null&&j&&(k=function(Q){return EXIF.getData(S,function(){return Q(EXIF.getTag(this,"Orientation"))})}),k(function(V){b.width=S.width,b.height=S.height;var Q=X.options.resize.call(X,b,T,_,M),ie=document.createElement("canvas"),he=ie.getContext("2d");switch(ie.width=Q.trgWidth,ie.height=Q.trgHeight,V>4&&(ie.width=Q.trgHeight,ie.height=Q.trgWidth),V){case 2:he.translate(ie.width,0),he.scale(-1,1);break;case 3:he.translate(ie.width,ie.height),he.rotate(Math.PI);break;case 4:he.translate(0,ie.height),he.scale(1,-1);break;case 5:he.rotate(.5*Math.PI),he.scale(1,-1);break;case 6:he.rotate(.5*Math.PI),he.translate(0,-ie.width);break;case 7:he.rotate(.5*Math.PI),he.translate(ie.height,-ie.width),he.scale(-1,1);break;case 8:he.rotate(-.5*Math.PI),he.translate(-ie.height,0);break}me(he,S,Q.srcX!=null?Q.srcX:0,Q.srcY!=null?Q.srcY:0,Q.srcWidth,Q.srcHeight,Q.trgX!=null?Q.trgX:0,Q.trgY!=null?Q.trgY:0,Q.trgWidth,Q.trgHeight);var Ae=ie.toDataURL("image/png");if(W!=null)return W(Ae,ie)})},W!=null&&(S.onerror=W),S.src=b.dataURL}},{key:"processQueue",value:function(){var b=this.options.parallelUploads,T=this.getUploadingFiles().length,_=T;if(!(T>=b)){var M=this.getQueuedFiles();if(M.length>0){if(this.options.uploadMultiple)return this.processFiles(M.slice(0,b-T));for(;_<b;){if(!M.length)return;this.processFile(M.shift()),_++}}}}},{key:"processFile",value:function(b){return this.processFiles([b])}},{key:"processFiles",value:function(b){var T=x(b,!0),_;try{for(T.s();!(_=T.n()).done;){var M=_.value;M.processing=!0,M.status=N.UPLOADING,this.emit("processing",M)}}catch(j){T.e(j)}finally{T.f()}return this.options.uploadMultiple&&this.emit("processingmultiple",b),this.uploadFiles(b)}},{key:"_getFilesWithXhr",value:function(b){return this.files.filter(function(T){return T.xhr===b}).map(function(T){return T})}},{key:"cancelUpload",value:function(b){if(b.status===N.UPLOADING){var T=this._getFilesWithXhr(b.xhr),_=x(T,!0),M;try{for(_.s();!(M=_.n()).done;){var j=M.value;j.status=N.CANCELED}}catch(S){_.e(S)}finally{_.f()}typeof b.xhr<"u"&&b.xhr.abort();var W=x(T,!0),Z;try{for(W.s();!(Z=W.n()).done;){var X=Z.value;this.emit("canceled",X)}}catch(S){W.e(S)}finally{W.f()}this.options.uploadMultiple&&this.emit("canceledmultiple",T)}else(b.status===N.ADDED||b.status===N.QUEUED)&&(b.status=N.CANCELED,this.emit("canceled",b),this.options.uploadMultiple&&this.emit("canceledmultiple",[b]));if(this.options.autoProcessQueue)return this.processQueue()}},{key:"resolveOption",value:function(b){if(typeof b=="function"){for(var T=arguments.length,_=new Array(T>1?T-1:0),M=1;M<T;M++)_[M-1]=arguments[M];return b.apply(this,_)}return b}},{key:"uploadFile",value:function(b){return this.uploadFiles([b])}},{key:"uploadFiles",value:function(b){var T=this;this._transformFiles(b,function(_){if(T.options.chunking){var M=_[0];b[0].upload.chunked=T.options.chunking&&(T.options.forceChunking||M.size>T.options.chunkSize),b[0].upload.totalChunkCount=Math.ceil(M.size/T.options.chunkSize)}if(b[0].upload.chunked){var j=b[0],W=_[0];j.upload.chunks=[];var Z=function(){for(var Q=0;j.upload.chunks[Q]!==void 0;)Q++;if(!(Q>=j.upload.totalChunkCount)){var ie=Q*T.options.chunkSize,he=Math.min(ie+T.options.chunkSize,W.size),Ae={name:T._getParamName(0),data:W.webkitSlice?W.webkitSlice(ie,he):W.slice(ie,he),filename:j.upload.filename,chunkIndex:Q};j.upload.chunks[Q]={file:j,index:Q,dataBlock:Ae,status:N.UPLOADING,progress:0,retries:0},T._uploadData(b,[Ae])}};if(j.upload.finishedChunkUpload=function(V,Q){var ie=!0;V.status=N.SUCCESS,V.dataBlock=null,V.xhr=null;for(var he=0;he<j.upload.totalChunkCount;he++){if(j.upload.chunks[he]===void 0)return Z();j.upload.chunks[he].status!==N.SUCCESS&&(ie=!1)}ie&&T.options.chunksUploaded(j,function(){T._finished(b,Q,null)})},T.options.parallelChunkUploads)for(var X=0;X<j.upload.totalChunkCount;X++)Z();else Z()}else{for(var S=[],k=0;k<b.length;k++)S[k]={name:T._getParamName(k),data:_[k],filename:b[k].upload.filename};T._uploadData(b,S)}})}},{key:"_getChunk",value:function(b,T){for(var _=0;_<b.upload.totalChunkCount;_++)if(b.upload.chunks[_]!==void 0&&b.upload.chunks[_].xhr===T)return b.upload.chunks[_]}},{key:"_uploadData",value:function(b,T){var _=this,M=new XMLHttpRequest,j=x(b,!0),W;try{for(j.s();!(W=j.n()).done;){var Z=W.value;Z.xhr=M}}catch(pe){j.e(pe)}finally{j.f()}b[0].upload.chunked&&(b[0].upload.chunks[T[0].chunkIndex].xhr=M);var X=this.resolveOption(this.options.method,b),S=this.resolveOption(this.options.url,b);M.open(X,S,!0);var k=this.resolveOption(this.options.timeout,b);k&&(M.timeout=this.resolveOption(this.options.timeout,b)),M.withCredentials=!!this.options.withCredentials,M.onload=function(pe){_._finishedUploading(b,M,pe)},M.ontimeout=function(){_._handleUploadError(b,M,"Request timedout after ".concat(_.options.timeout/1e3," seconds"))},M.onerror=function(){_._handleUploadError(b,M)};var V=M.upload!=null?M.upload:M;V.onprogress=function(pe){return _._updateFilesUploadProgress(b,M,pe)};var Q={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};this.options.headers&&N.extend(Q,this.options.headers);for(var ie in Q){var he=Q[ie];he&&M.setRequestHeader(ie,he)}var Ae=new FormData;if(this.options.params){var q=this.options.params;typeof q=="function"&&(q=q.call(this,b,M,b[0].upload.chunked?this._getChunk(b[0],M):null));for(var se in q){var be=q[se];if(Array.isArray(be))for(var Be=0;Be<be.length;Be++)Ae.append(se,be[Be]);else Ae.append(se,be)}}var Ze=x(b,!0),tt;try{for(Ze.s();!(tt=Ze.n()).done;){var Ct=tt.value;this.emit("sending",Ct,M,Ae)}}catch(pe){Ze.e(pe)}finally{Ze.f()}this.options.uploadMultiple&&this.emit("sendingmultiple",b,M,Ae),this._addFormElementData(Ae);for(var te=0;te<T.length;te++){var ge=T[te];Ae.append(ge.name,ge.data,ge.filename)}this.submitRequest(M,Ae,b)}},{key:"_transformFiles",value:function(b,T){for(var _=this,M=[],j=0,W=function(S){_.options.transformFile.call(_,b[S],function(k){M[S]=k,++j===b.length&&T(M)})},Z=0;Z<b.length;Z++)W(Z)}},{key:"_addFormElementData",value:function(b){if(this.element.tagName==="FORM"){var T=x(this.element.querySelectorAll("input, textarea, select, button"),!0),_;try{for(T.s();!(_=T.n()).done;){var M=_.value,j=M.getAttribute("name"),W=M.getAttribute("type");if(W&&(W=W.toLowerCase()),!(typeof j>"u"||j===null))if(M.tagName==="SELECT"&&M.hasAttribute("multiple")){var Z=x(M.options,!0),X;try{for(Z.s();!(X=Z.n()).done;){var S=X.value;S.selected&&b.append(j,S.value)}}catch(k){Z.e(k)}finally{Z.f()}}else(!W||W!=="checkbox"&&W!=="radio"||M.checked)&&b.append(j,M.value)}}catch(k){T.e(k)}finally{T.f()}}}},{key:"_updateFilesUploadProgress",value:function(b,T,_){if(b[0].upload.chunked){var Z=b[0],X=this._getChunk(Z,T);_?(X.progress=100*_.loaded/_.total,X.total=_.total,X.bytesSent=_.loaded):(X.progress=100,X.bytesSent=X.total),Z.upload.progress=0,Z.upload.total=0,Z.upload.bytesSent=0;for(var S=0;S<Z.upload.totalChunkCount;S++)Z.upload.chunks[S]&&typeof Z.upload.chunks[S].progress<"u"&&(Z.upload.progress+=Z.upload.chunks[S].progress,Z.upload.total+=Z.upload.chunks[S].total,Z.upload.bytesSent+=Z.upload.chunks[S].bytesSent);Z.upload.progress=Z.upload.progress/Z.upload.totalChunkCount,this.emit("uploadprogress",Z,Z.upload.progress,Z.upload.bytesSent)}else{var M=x(b,!0),j;try{for(M.s();!(j=M.n()).done;){var W=j.value;W.upload.total&&W.upload.bytesSent&&W.upload.bytesSent==W.upload.total||(_?(W.upload.progress=100*_.loaded/_.total,W.upload.total=_.total,W.upload.bytesSent=_.loaded):(W.upload.progress=100,W.upload.bytesSent=W.upload.total),this.emit("uploadprogress",W,W.upload.progress,W.upload.bytesSent))}}catch(k){M.e(k)}finally{M.f()}}}},{key:"_finishedUploading",value:function(b,T,_){var M;if(b[0].status!==N.CANCELED&&T.readyState===4){if(T.responseType!=="arraybuffer"&&T.responseType!=="blob"&&(M=T.responseText,T.getResponseHeader("content-type")&&~T.getResponseHeader("content-type").indexOf("application/json")))try{M=JSON.parse(M)}catch(j){_=j,M="Invalid JSON response from server."}this._updateFilesUploadProgress(b,T),200<=T.status&&T.status<300?b[0].upload.chunked?b[0].upload.finishedChunkUpload(this._getChunk(b[0],T),M):this._finished(b,M,_):this._handleUploadError(b,T,M)}}},{key:"_handleUploadError",value:function(b,T,_){if(b[0].status!==N.CANCELED){if(b[0].upload.chunked&&this.options.retryChunks){var M=this._getChunk(b[0],T);if(M.retries++<this.options.retryChunksLimit){this._uploadData(b,[M.dataBlock]);return}else console.warn("Retried this chunk too often. Giving up.")}this._errorProcessing(b,_||this.options.dictResponseError.replace("{{statusCode}}",T.status),T)}}},{key:"submitRequest",value:function(b,T,_){if(b.readyState!=1){console.warn("Cannot send this request because the XMLHttpRequest.readyState is not OPENED.");return}b.send(T)}},{key:"_finished",value:function(b,T,_){var M=x(b,!0),j;try{for(M.s();!(j=M.n()).done;){var W=j.value;W.status=N.SUCCESS,this.emit("success",W,T,_),this.emit("complete",W)}}catch(Z){M.e(Z)}finally{M.f()}if(this.options.uploadMultiple&&(this.emit("successmultiple",b,T,_),this.emit("completemultiple",b)),this.options.autoProcessQueue)return this.processQueue()}},{key:"_errorProcessing",value:function(b,T,_){var M=x(b,!0),j;try{for(M.s();!(j=M.n()).done;){var W=j.value;W.status=N.ERROR,this.emit("error",W,T,_),this.emit("complete",W)}}catch(Z){M.e(Z)}finally{M.f()}if(this.options.uploadMultiple&&(this.emit("errormultiple",b,T,_),this.emit("completemultiple",b)),this.options.autoProcessQueue)return this.processQueue()}}],[{key:"initClass",value:function(){this.prototype.Emitter=h,this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}},{key:"extend",value:function(b){for(var T=arguments.length,_=new Array(T>1?T-1:0),M=1;M<T;M++)_[M-1]=arguments[M];for(var j=0,W=_;j<W.length;j++){var Z=W[j];for(var X in Z){var S=Z[X];b[X]=S}}return b}},{key:"uuidv4",value:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(b){var T=Math.random()*16|0,_=b==="x"?T:T&3|8;return _.toString(16)})}}]),N}(h);z.initClass(),z.version="5.9.3",z.options={},z.optionsForElement=function(O){if(O.getAttribute("id"))return z.options[ne(O.getAttribute("id"))]},z.instances=[],z.forElement=function(O){if(typeof O=="string"&&(O=document.querySelector(O)),(O!=null?O.dropzone:void 0)==null)throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return O.dropzone},z.autoDiscover=!0,z.discover=function(){var O;if(document.querySelectorAll)O=document.querySelectorAll(".dropzone");else{O=[];var D=function(L){return function(){var b=[],T=x(L,!0),_;try{for(T.s();!(_=T.n()).done;){var M=_.value;/(^| )dropzone($| )/.test(M.className)?b.push(O.push(M)):b.push(void 0)}}catch(j){T.e(j)}finally{T.f()}return b}()};D(document.getElementsByTagName("div")),D(document.getElementsByTagName("form"))}return function(){var N=[],L=x(O,!0),b;try{for(L.s();!(b=L.n()).done;){var T=b.value;z.optionsForElement(T)!==!1?N.push(new z(T)):N.push(void 0)}}catch(_){L.e(_)}finally{L.f()}return N}()},z.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],z.isBrowserSupported=function(){var O=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if(!("classList"in document.createElement("a")))O=!1;else{z.blacklistedBrowsers!==void 0&&(z.blockedBrowsers=z.blacklistedBrowsers);var D=x(z.blockedBrowsers,!0),N;try{for(D.s();!(N=D.n()).done;){var L=N.value;if(L.test(navigator.userAgent)){O=!1;continue}}}catch(b){D.e(b)}finally{D.f()}}else O=!1;return O},z.dataURItoBlob=function(O){for(var D=atob(O.split(",")[1]),N=O.split(",")[0].split(":")[1].split(";")[0],L=new ArrayBuffer(D.length),b=new Uint8Array(L),T=0,_=D.length,M=0<=_;M?T<=_:T>=_;M?T++:T--)b[T]=D.charCodeAt(T);return new Blob([L],{type:N})};var ee=function(D,N){return D.filter(function(L){return L!==N}).map(function(L){return L})},ne=function(D){return D.replace(/[\-_](\w)/g,function(N){return N.charAt(1).toUpperCase()})};z.createElement=function(O){var D=document.createElement("div");return D.innerHTML=O,D.childNodes[0]},z.elementInside=function(O,D){if(O===D)return!0;for(;O=O.parentNode;)if(O===D)return!0;return!1},z.getElement=function(O,D){var N;if(typeof O=="string"?N=document.querySelector(O):O.nodeType!=null&&(N=O),N==null)throw new Error("Invalid `".concat(D,"` option provided. Please provide a CSS selector or a plain HTML element."));return N},z.getElements=function(O,D){var N,L;if(O instanceof Array){L=[];try{var b=x(O,!0),T;try{for(b.s();!(T=b.n()).done;)N=T.value,L.push(this.getElement(N,D))}catch(j){b.e(j)}finally{b.f()}}catch{L=null}}else if(typeof O=="string"){L=[];var _=x(document.querySelectorAll(O),!0),M;try{for(_.s();!(M=_.n()).done;)N=M.value,L.push(N)}catch(j){_.e(j)}finally{_.f()}}else O.nodeType!=null&&(L=[O]);if(L==null||!L.length)throw new Error("Invalid `".concat(D,"` option provided. Please provide a CSS selector, a plain HTML element or a list of those."));return L},z.confirm=function(O,D,N){if(window.confirm(O))return D();if(N!=null)return N()},z.isValidFile=function(O,D){if(!D)return!0;D=D.split(",");var N=O.type,L=N.replace(/\/.*$/,""),b=x(D,!0),T;try{for(b.s();!(T=b.n()).done;){var _=T.value;if(_=_.trim(),_.charAt(0)==="."){if(O.name.toLowerCase().indexOf(_.toLowerCase(),O.name.length-_.length)!==-1)return!0}else if(/\/\*$/.test(_)){if(L===_.replace(/\/.*$/,""))return!0}else if(N===_)return!0}}catch(M){b.e(M)}finally{b.f()}return!1},typeof jQuery<"u"&&jQuery!==null&&(jQuery.fn.dropzone=function(O){return this.each(function(){return new z(this,O)})}),z.ADDED="added",z.QUEUED="queued",z.ACCEPTED=z.QUEUED,z.UPLOADING="uploading",z.PROCESSING=z.UPLOADING,z.CANCELED="canceled",z.ERROR="error",z.SUCCESS="success";var ce=function(D){D.naturalWidth;var N=D.naturalHeight,L=document.createElement("canvas");L.width=1,L.height=N;var b=L.getContext("2d");b.drawImage(D,0,0);for(var T=b.getImageData(1,0,1,N),_=T.data,M=0,j=N,W=N;W>M;){var Z=_[(W-1)*4+3];Z===0?j=W:M=W,W=j+M>>1}var X=W/N;return X===0?1:X},me=function(D,N,L,b,T,_,M,j,W,Z){var X=ce(N);return D.drawImage(N,L,b,T,_,M,j,W,Z/X)},ve=function(){function O(){B(this,O)}return U(O,null,[{key:"initClass",value:function(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}},{key:"encode64",value:function(N){for(var L="",b=void 0,T=void 0,_="",M=void 0,j=void 0,W=void 0,Z="",X=0;b=N[X++],T=N[X++],_=N[X++],M=b>>2,j=(b&3)<<4|T>>4,W=(T&15)<<2|_>>6,Z=_&63,isNaN(T)?W=Z=64:isNaN(_)&&(Z=64),L=L+this.KEY_STR.charAt(M)+this.KEY_STR.charAt(j)+this.KEY_STR.charAt(W)+this.KEY_STR.charAt(Z),b=T=_="",M=j=W=Z="",X<N.length;);return L}},{key:"restore",value:function(N,L){if(!N.match("data:image/jpeg;base64,"))return L;var b=this.decode64(N.replace("data:image/jpeg;base64,","")),T=this.slice2Segments(b),_=this.exifManipulation(L,T);return"data:image/jpeg;base64,".concat(this.encode64(_))}},{key:"exifManipulation",value:function(N,L){var b=this.getExifArray(L),T=this.insertExif(N,b),_=new Uint8Array(T);return _}},{key:"getExifArray",value:function(N){for(var L=void 0,b=0;b<N.length;){if(L=N[b],L[0]===255&L[1]===225)return L;b++}return[]}},{key:"insertExif",value:function(N,L){var b=N.replace("data:image/jpeg;base64,",""),T=this.decode64(b),_=T.indexOf(255,3),M=T.slice(0,_),j=T.slice(_),W=M;return W=W.concat(L),W=W.concat(j),W}},{key:"slice2Segments",value:function(N){for(var L=0,b=[];;){var T;if(N[L]===255&N[L+1]===218)break;if(N[L]===255&N[L+1]===216)L+=2;else{T=N[L+2]*256+N[L+3];var _=L+T+2,M=N.slice(L,_);b.push(M),L=_}if(L>N.length)break}return b}},{key:"decode64",value:function(N){var L=void 0,b=void 0,T="",_=void 0,M=void 0,j=void 0,W="",Z=0,X=[],S=/[^A-Za-z0-9\+\/\=]/g;for(S.exec(N)&&console.warn(`There were invalid base64 characters in the input text.
|
|
61
61
|
Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='
|
|
62
|
-
Expect errors in decoding.`),N=N.replace(/[^A-Za-z0-9\+\/\=]/g,"");_=this.KEY_STR.indexOf(N.charAt(Z++)),M=this.KEY_STR.indexOf(N.charAt(Z++)),j=this.KEY_STR.indexOf(N.charAt(Z++)),W=this.KEY_STR.indexOf(N.charAt(Z++)),L=_<<2|M>>4,b=(M&15)<<4|j>>2,T=(j&3)<<6|W,X.push(L),j!==64&&X.push(b),W!==64&&X.push(T),L=b=T="",_=M=j=W="",Z<N.length;);return X}}]),O}();ve.initClass();var Te=function(D,N){var L=!1,b=!0,T=D.document,_=T.documentElement,M=T.addEventListener?"addEventListener":"attachEvent",j=T.addEventListener?"removeEventListener":"detachEvent",W=T.addEventListener?"":"on",Z=function S(k){if(!(k.type==="readystatechange"&&T.readyState!=="complete")&&((k.type==="load"?D:T)[j](W+k.type,S,!1),!L&&(L=!0)))return N.call(D,k.type||k)},X=function S(){try{_.doScroll("left")}catch{setTimeout(S,50);return}return Z("poll")};if(T.readyState!=="complete"){if(T.createEventObject&&_.doScroll){try{b=!D.frameElement}catch{}b&&X()}return T[M](W+"DOMContentLoaded",Z,!1),T[M](W+"readystatechange",Z,!1),D[M](W+"load",Z,!1)}};z._autoDiscoverFunction=function(){if(z.autoDiscover)return z.discover()},Te(window,z._autoDiscoverFunction);function ke(O,D){return typeof O<"u"&&O!==null?D(O):void 0}function Ne(O,D,N){if(typeof O<"u"&&O!==null&&typeof O[D]=="function")return N(O,D)}window.Dropzone=z;var Ce=z}(),s}()})})(q1);var o9=q1.exports;const qd=Nu(o9),s9={class:"fallback"},i9=c.createElementVNode("input",{id:"file",type:"file",name:"file",multiple:""},null,-1),a9={for:"file"},l9={class:"dz-message","data-dz-message":""},c9={id:"bd-dropzone-theme",style:{display:"none"}},u9={class:"dz-preview dz-file-preview"},d9={class:"dz-details"},f9=c.createElementVNode("img",{"data-dz-thumbnail":"",class:"dz-image"},null,-1),h9=c.createElementVNode("div",{class:"dz-filename"},[c.createElementVNode("small",{"data-dz-name":""})],-1),p9=c.createElementVNode("div",{class:"dz-progress"},[c.createElementVNode("div",{class:"spinner-border text-primary spinner-border-sm",role:"status"},[c.createElementVNode("span",{class:"visually-hidden"},"Loading...")])],-1),m9={class:"dz-success-mark"},g9={class:"dz-error-message text-danger"},v9=c.createElementVNode("small",{"data-dz-errormessage":""},null,-1),Iu=c.defineComponent({__name:"BDDropzone",props:{modelValue:{default:[]},buttonText:{default:void 0},multiple:{type:Boolean,default:!1},errorMessage:{default:void 0},fileSizeExceededMessage:{default:void 0},acceptedFiles:{default:".jpg"},url:{default:""},tag:{default:"form"},token:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=c.computed(()=>({variant:Fa.PRIMARY,size:Tt.SM})),o=io(t,"modelValue",e);let s=null;qd.autoDiscover=!1,c.watch(()=>t.modelValue,()=>{i()}),c.onMounted(()=>{document.getElementById("dropzone")&&l()});const i=()=>{s&&(s.destroy(),l())},l=()=>{var p;s=new qd("#dropzone",{url:t.url,method:"post",acceptedFiles:t.acceptedFiles,addRemoveLinks:!1,maxFilesize:10,maxFiles:t.multiple?3:1,headers:{RequestVerificationToken:t.token},dictResponseError:t.errorMessage,dictFileTooBig:t.fileSizeExceededMessage,previewTemplate:(p=document.querySelector("#bd-dropzone-theme"))==null?void 0:p.innerHTML}),s.on("error",u),s.on("success",a),s.on("removedfile",f)},a=function(p,m){var g;o.value.push({UUID:(g=p.upload)==null?void 0:g.uuid,CorrelationId:m.CorrelationId,Naam:m.Naam}),d(p)},u=function(p){d(p)},d=function(p){const m=p.name;if(!(m.endsWith(".png")||m.endsWith(".jpg")||m.endsWith(".jpeg")||m.endsWith(".gif"))){const g=p.previewElement.getElementsByClassName("icon-file"),v=p.previewElement.getElementsByClassName("dz-image");g[0].classList.remove("d-none"),v[0].classList.add("d-none")}},f=function(p){const m=o.value.findIndex(g=>{var v;return(g==null?void 0:g.UUID)===((v=p.upload)==null?void 0:v.uuid)});m!==-1&&o.value.splice(m,1)},h=c.computed(()=>t.tag??"form");return(p,m)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(h.value),{id:"dropzone",class:"dropzone bd-dropzone",enctype:"multipart/form-data"},{default:c.withCtx(()=>[c.createElementVNode("div",s9,[i9,c.createTextVNode(" test "),c.createElementVNode("label",a9,[c.createVNode(c.unref(Jr)),c.createTextVNode(" "+c.toDisplayString(t.buttonText),1)])]),c.createElementVNode("div",l9,[c.createVNode(Qe,c.normalizeProps(c.guardReactiveProps(r.value)),{default:c.withCtx(()=>[c.createVNode(c.unref(Jr)),c.createTextVNode(" "+c.toDisplayString(t.buttonText),1)]),_:1},16)])]),_:1})),c.createElementVNode("div",c9,[c.createElementVNode("div",u9,[c.createElementVNode("div",d9,[f9,c.createVNode(c.unref(gu),{"data-dz-thumbnail":"",class:"d-none"}),h9,c.createVNode(Qe,{class:"dz-remove",alt:"Click me to remove the file.","data-dz-remove":""},{default:c.withCtx(()=>[c.createVNode(c.unref(js))]),_:1})]),p9,c.createElementVNode("div",m9,[c.createVNode(c.unref(Go))]),c.createElementVNode("div",g9,[c.createVNode(c.unref(Ba)),v9])])])],64))}});function ht(n){this.content=n}ht.prototype={constructor:ht,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),s=r.content.slice();return o==-1?s.push(t||n,e):(s[o+1]=e,t&&(s[o]=t)),new ht(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ht(t)},addToStart:function(n,e){return new ht([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ht(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),s=r.find(n);return o.splice(s==-1?o.length:s,0,e,t),new ht(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=ht.from(n),n.size?new ht(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ht.from(n),n.size?new ht(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ht.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};ht.from=function(n){if(n instanceof ht)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ht(e)};function em(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),s=e.child(r);if(o==s){t+=o.nodeSize;continue}if(!o.sameMarkup(s))return t;if(o.isText&&o.text!=s.text){for(let i=0;o.text[i]==s.text[i];i++)t++;return t}if(o.content.size||s.content.size){let i=em(o.content,s.content,t+1);if(i!=null)return i}t+=o.nodeSize}}function tm(n,e,t,r){for(let o=n.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:t,b:r};let i=n.child(--o),l=e.child(--s),a=i.nodeSize;if(i==l){t-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:t,b:r};if(i.isText&&i.text!=l.text){let u=0,d=Math.min(i.text.length,l.text.length);for(;u<d&&i.text[i.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,r--;return{a:t,b:r}}if(i.content.size||l.content.size){let u=tm(i.content,l.content,t-1,r-1);if(u)return u}t-=a,r-=a}}class fe{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,s){for(let i=0,l=0;l<t;i++){let a=this.content[i],u=l+a.nodeSize;if(u>e&&r(a,o+l,s||null,i)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,o+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let s="",i=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(s+=l.text.slice(Math.max(e,a)-a,t-a),i=!r):l.isLeaf?(o?s+=typeof o=="function"?o(l):o:l.type.spec.leafText&&(s+=l.type.spec.leafText(l)),i=!r):!i&&l.isBlock&&(s+=r,i=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new fe(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let s=0,i=0;i<t;s++){let l=this.content[s],a=i+l.nodeSize;a>e&&((i<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,t-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,t-i-1))),r.push(l),o+=l.nodeSize),i=a}return new fe(r,o)}cutByIndex(e,t){return e==t?fe.empty:e==0&&t==this.content.length?this:new fe(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new fe(o,s)}addToStart(e){return new fe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new fe(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 new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return em(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return tm(this,e,t,r)}findIndex(e,t=-1){if(e==0)return si(0,e);if(e==this.size)return si(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let s=this.child(r),i=o+s.nodeSize;if(i>=e)return i==e||t>0?si(r+1,i):si(r,o);o=i}}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 fe.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new fe(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return fe.empty;let t,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(t||(t=e.slice(0,o)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new fe(t||e,r)}static from(e){if(!e)return fe.empty;if(e instanceof fe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new fe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}fe.empty=new fe([],0);const bl={index:0,offset:0};function si(n,e){return bl.index=n,bl.offset=e,bl}function Di(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Di(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Di(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let We=class gc{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let s=e[o];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,o));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||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&&Di(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 new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return gc.none;if(e instanceof gc)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};We.none=[];class Ri extends Error{}class we{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=rm(this.content,e+this.openStart,t);return r&&new we(r,this.openStart,this.openEnd)}removeBetween(e,t){return new we(nm(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 we.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new we(fe.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)o++;return new we(e,r,o)}}we.empty=new we(fe.empty,0,0);function nm(n,e,t){let{index:r,offset:o}=n.findIndex(e),s=n.maybeChild(r),{index:i,offset:l}=n.findIndex(t);if(o==e||s.isText){if(l!=t&&!n.child(i).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=i)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(nm(s.content,e-o-1,t-o-1)))}function rm(n,e,t,r){let{index:o,offset:s}=n.findIndex(e),i=n.maybeChild(o);if(s==e||i.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=rm(i.content,e-s-1,t);return l&&n.replaceChild(o,i.copy(l))}function y9(n,e,t){if(t.openStart>n.depth)throw new Ri("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Ri("Inconsistent open depths");return om(n,e,t,0)}function om(n,e,t,r){let o=n.index(r),s=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let i=om(n,e,t,r+1);return s.copy(s.content.replaceChild(o,i))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let i=n.parent,l=i.content;return Wr(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=E9(t,n);return Wr(s,im(n,i,l,e,r))}else return Wr(s,Bi(n,e,r))}function sm(n,e){if(!e.type.compatibleContent(n.type))throw new Ri("Cannot join "+e.type.name+" onto "+n.type.name)}function vc(n,e,t){let r=n.node(t);return sm(r,e.node(t)),r}function jr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ps(n,e,t,r){let o=(e||n).node(t),s=0,i=e?e.index(t):o.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(jr(n.nodeAfter,r),s++));for(let l=s;l<i;l++)jr(o.child(l),r);e&&e.depth==t&&e.textOffset&&jr(e.nodeBefore,r)}function Wr(n,e){return n.type.checkContent(e),n.copy(e)}function im(n,e,t,r,o){let s=n.depth>o&&vc(n,e,o+1),i=r.depth>o&&vc(t,r,o+1),l=[];return ps(null,n,o,l),s&&i&&e.index(o)==t.index(o)?(sm(s,i),jr(Wr(s,im(n,e,t,r,o+1)),l)):(s&&jr(Wr(s,Bi(n,e,o+1)),l),ps(e,t,o,l),i&&jr(Wr(i,Bi(t,r,o+1)),l)),ps(r,null,o,l),new fe(l)}function Bi(n,e,t){let r=[];if(ps(null,n,t,r),n.depth>t){let o=vc(n,e,t+1);jr(Wr(o,Bi(n,e,t+1)),r)}return ps(e,null,t,r),new fe(r)}function E9(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)o=e.node(s).copy(fe.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class _s{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?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[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].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 r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}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):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)o+=r.child(s).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return We.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let l=r;r=o,o=l}let s=r.marks;for(var i=0;i<s.length;i++)s[i].type.spec.inclusive===!1&&(!o||!s[i].isInSet(o.marks))&&(s=s[i--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.marks))&&(r=r[s--].removeFromSet(r));return r}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 r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Pi(this,e,r);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 new RangeError("Position "+t+" out of range");let r=[],o=0,s=t;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(s),u=s-a;if(r.push(i,l,o+a),!u||(i=i.child(l),i.isText))break;s=u-1,o+=a+1}return new _s(t,r,s)}static resolveCached(e,t){for(let o=0;o<Al.length;o++){let s=Al[o];if(s.pos==t&&s.doc==e)return s}let r=Al[wl]=_s.resolve(e,t);return wl=(wl+1)%C9,r}}let Al=[],wl=0,C9=12;class Pi{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}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)}}const b9=Object.create(null);let Kr=class yc{constructor(e,t,r,o=We.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||fe.empty}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,r,o=0){this.content.nodesBetween(e,t,r,o,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,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}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,r){return this.type==e&&Di(this.attrs,t||e.defaultAttrs||b9)&&We.sameSet(this.marks,r||We.none)}copy(e=null){return e==this.content?this:new yc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new yc(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return we.empty;let o=this.resolve(e),s=this.resolve(t),i=r?0:o.sharedDepth(t),l=o.start(i),u=o.node(i).content.cut(o.pos-l,s.pos-l);return new we(u,o.depth-i,s.depth-i)}replace(e,t,r){return y9(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return _s.resolveCached(this,e)}resolveNoCache(e){return _s.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(o=!0),!o)),o}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()+")"),am(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=fe.empty,o=0,s=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,o,s),l=i&&i.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let s=this.contentMatchAt(e).matchType(r),i=s&&s.matchFragment(this.content,t);return i?i.validEnd:!1}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);let e=We.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!We.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=fe.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,o,r)}};Kr.prototype.text=void 0;class Fi extends Kr{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):am(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 Fi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Fi(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&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 am(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Xr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new A9(e,t);if(r.next==null)return Xr.empty;let o=lm(r);r.next&&r.err("Unexpected trailing text");let s=N9(x9(o));return I9(s,r),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}matchFragment(e,t=0,r=e.childCount){let o=this;for(let s=t;o&&s<r;s++)o=o.matchType(e.child(s).type);return o}get inlineContent(){return this.next.length!=0&&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 r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function s(i,l){let a=i.matchFragment(e,r);if(a&&(!t||a.validEnd))return fe.from(l.map(u=>u.createAndFill()));for(let u=0;u<i.next.length;u++){let{type:d,next:f}=i.next[u];if(!(d.isText||d.hasRequiredAttrs())&&o.indexOf(f)==-1){o.push(f);let h=s(f,l.concat(d));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),s=o.match;if(s.matchType(e)){let i=[];for(let l=o;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<s.next.length;i++){let{type:l,next:a}=s.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let s=o+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)s+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return s}).join(`
|
|
62
|
+
Expect errors in decoding.`),N=N.replace(/[^A-Za-z0-9\+\/\=]/g,"");_=this.KEY_STR.indexOf(N.charAt(Z++)),M=this.KEY_STR.indexOf(N.charAt(Z++)),j=this.KEY_STR.indexOf(N.charAt(Z++)),W=this.KEY_STR.indexOf(N.charAt(Z++)),L=_<<2|M>>4,b=(M&15)<<4|j>>2,T=(j&3)<<6|W,X.push(L),j!==64&&X.push(b),W!==64&&X.push(T),L=b=T="",_=M=j=W="",Z<N.length;);return X}}]),O}();ve.initClass();var Te=function(D,N){var L=!1,b=!0,T=D.document,_=T.documentElement,M=T.addEventListener?"addEventListener":"attachEvent",j=T.addEventListener?"removeEventListener":"detachEvent",W=T.addEventListener?"":"on",Z=function S(k){if(!(k.type==="readystatechange"&&T.readyState!=="complete")&&((k.type==="load"?D:T)[j](W+k.type,S,!1),!L&&(L=!0)))return N.call(D,k.type||k)},X=function S(){try{_.doScroll("left")}catch{setTimeout(S,50);return}return Z("poll")};if(T.readyState!=="complete"){if(T.createEventObject&&_.doScroll){try{b=!D.frameElement}catch{}b&&X()}return T[M](W+"DOMContentLoaded",Z,!1),T[M](W+"readystatechange",Z,!1),D[M](W+"load",Z,!1)}};z._autoDiscoverFunction=function(){if(z.autoDiscover)return z.discover()},Te(window,z._autoDiscoverFunction);function ke(O,D){return typeof O<"u"&&O!==null?D(O):void 0}function Ne(O,D,N){if(typeof O<"u"&&O!==null&&typeof O[D]=="function")return N(O,D)}window.Dropzone=z;var Ce=z}(),s}()})})(q1);var o9=q1.exports;const qd=Nu(o9),s9={class:"fallback"},i9=c.createElementVNode("input",{id:"file",type:"file",name:"file",multiple:""},null,-1),a9={for:"file"},l9={class:"dz-message","data-dz-message":""},c9={id:"bd-dropzone-theme",style:{display:"none"}},u9={class:"dz-preview dz-file-preview"},d9={class:"dz-details"},f9=c.createElementVNode("img",{"data-dz-thumbnail":"",class:"dz-image"},null,-1),h9=c.createElementVNode("div",{class:"dz-filename"},[c.createElementVNode("small",{"data-dz-name":""})],-1),p9=c.createElementVNode("div",{class:"dz-progress"},[c.createElementVNode("div",{class:"spinner-border text-primary spinner-border-sm",role:"status"},[c.createElementVNode("span",{class:"visually-hidden"},"Loading...")])],-1),m9={class:"dz-success-mark"},g9={class:"dz-error-message text-danger"},v9=c.createElementVNode("small",{"data-dz-errormessage":""},null,-1),Iu=c.defineComponent({__name:"BDDropzone",props:{modelValue:{default:[]},buttonText:{default:void 0},multiple:{type:Boolean,default:!1},errorMessage:{default:void 0},fileSizeExceededMessage:{default:void 0},acceptedFiles:{default:".jpg"},url:{default:""},tag:{default:"form"},token:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=c.computed(()=>({variant:Fa.PRIMARY,size:Tt.SM})),o=io(t,"modelValue",e);let s=null;qd.autoDiscover=!1,c.watch(()=>t.modelValue,()=>{i()}),c.onMounted(()=>{document.getElementById("dropzone")&&l()});const i=()=>{s&&(s.destroy(),l())},l=()=>{var p;s=new qd("#dropzone",{url:t.url,method:"post",acceptedFiles:t.acceptedFiles,addRemoveLinks:!1,maxFilesize:10,maxFiles:t.multiple?10:1,headers:{RequestVerificationToken:t.token},dictResponseError:t.errorMessage,dictFileTooBig:t.fileSizeExceededMessage,previewTemplate:(p=document.querySelector("#bd-dropzone-theme"))==null?void 0:p.innerHTML}),s.on("error",u),s.on("success",a),s.on("removedfile",f)},a=function(p,m){var g;o.value.push({UUID:(g=p.upload)==null?void 0:g.uuid,CorrelationId:m.CorrelationId,Naam:m.Naam}),d(p)},u=function(p){d(p)},d=function(p){const m=p.name;if(!(m.endsWith(".png")||m.endsWith(".jpg")||m.endsWith(".jpeg")||m.endsWith(".gif"))){const g=p.previewElement.getElementsByClassName("icon-file"),v=p.previewElement.getElementsByClassName("dz-image");g[0].classList.remove("d-none"),v[0].classList.add("d-none")}},f=function(p){const m=o.value.findIndex(g=>{var v;return(g==null?void 0:g.UUID)===((v=p.upload)==null?void 0:v.uuid)});m!==-1&&o.value.splice(m,1)},h=c.computed(()=>t.tag??"form");return(p,m)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(h.value),{id:"dropzone",class:"dropzone bd-dropzone",enctype:"multipart/form-data"},{default:c.withCtx(()=>[c.createElementVNode("div",s9,[i9,c.createTextVNode(" test "),c.createElementVNode("label",a9,[c.createVNode(c.unref(Jr)),c.createTextVNode(" "+c.toDisplayString(t.buttonText),1)])]),c.createElementVNode("div",l9,[c.createVNode(Qe,c.normalizeProps(c.guardReactiveProps(r.value)),{default:c.withCtx(()=>[c.createVNode(c.unref(Jr)),c.createTextVNode(" "+c.toDisplayString(t.buttonText),1)]),_:1},16)])]),_:1})),c.createElementVNode("div",c9,[c.createElementVNode("div",u9,[c.createElementVNode("div",d9,[f9,c.createVNode(c.unref(gu),{"data-dz-thumbnail":"",class:"d-none"}),h9,c.createVNode(Qe,{class:"dz-remove",alt:"Click me to remove the file.","data-dz-remove":""},{default:c.withCtx(()=>[c.createVNode(c.unref(js))]),_:1})]),p9,c.createElementVNode("div",m9,[c.createVNode(c.unref(Go))]),c.createElementVNode("div",g9,[c.createVNode(c.unref(Ba)),v9])])])],64))}});function ht(n){this.content=n}ht.prototype={constructor:ht,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),s=r.content.slice();return o==-1?s.push(t||n,e):(s[o+1]=e,t&&(s[o]=t)),new ht(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ht(t)},addToStart:function(n,e){return new ht([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ht(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),s=r.find(n);return o.splice(s==-1?o.length:s,0,e,t),new ht(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=ht.from(n),n.size?new ht(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ht.from(n),n.size?new ht(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ht.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};ht.from=function(n){if(n instanceof ht)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ht(e)};function em(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),s=e.child(r);if(o==s){t+=o.nodeSize;continue}if(!o.sameMarkup(s))return t;if(o.isText&&o.text!=s.text){for(let i=0;o.text[i]==s.text[i];i++)t++;return t}if(o.content.size||s.content.size){let i=em(o.content,s.content,t+1);if(i!=null)return i}t+=o.nodeSize}}function tm(n,e,t,r){for(let o=n.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:t,b:r};let i=n.child(--o),l=e.child(--s),a=i.nodeSize;if(i==l){t-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:t,b:r};if(i.isText&&i.text!=l.text){let u=0,d=Math.min(i.text.length,l.text.length);for(;u<d&&i.text[i.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,r--;return{a:t,b:r}}if(i.content.size||l.content.size){let u=tm(i.content,l.content,t-1,r-1);if(u)return u}t-=a,r-=a}}class fe{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,s){for(let i=0,l=0;l<t;i++){let a=this.content[i],u=l+a.nodeSize;if(u>e&&r(a,o+l,s||null,i)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,o+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let s="",i=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(s+=l.text.slice(Math.max(e,a)-a,t-a),i=!r):l.isLeaf?(o?s+=typeof o=="function"?o(l):o:l.type.spec.leafText&&(s+=l.type.spec.leafText(l)),i=!r):!i&&l.isBlock&&(s+=r,i=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new fe(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let s=0,i=0;i<t;s++){let l=this.content[s],a=i+l.nodeSize;a>e&&((i<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,t-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,t-i-1))),r.push(l),o+=l.nodeSize),i=a}return new fe(r,o)}cutByIndex(e,t){return e==t?fe.empty:e==0&&t==this.content.length?this:new fe(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new fe(o,s)}addToStart(e){return new fe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new fe(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 new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return em(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return tm(this,e,t,r)}findIndex(e,t=-1){if(e==0)return si(0,e);if(e==this.size)return si(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let s=this.child(r),i=o+s.nodeSize;if(i>=e)return i==e||t>0?si(r+1,i):si(r,o);o=i}}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 fe.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new fe(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return fe.empty;let t,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(t||(t=e.slice(0,o)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new fe(t||e,r)}static from(e){if(!e)return fe.empty;if(e instanceof fe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new fe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}fe.empty=new fe([],0);const bl={index:0,offset:0};function si(n,e){return bl.index=n,bl.offset=e,bl}function Di(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Di(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Di(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let We=class gc{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let s=e[o];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,o));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||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&&Di(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 new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return gc.none;if(e instanceof gc)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};We.none=[];class Ri extends Error{}class we{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=rm(this.content,e+this.openStart,t);return r&&new we(r,this.openStart,this.openEnd)}removeBetween(e,t){return new we(nm(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 we.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new we(fe.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)o++;return new we(e,r,o)}}we.empty=new we(fe.empty,0,0);function nm(n,e,t){let{index:r,offset:o}=n.findIndex(e),s=n.maybeChild(r),{index:i,offset:l}=n.findIndex(t);if(o==e||s.isText){if(l!=t&&!n.child(i).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=i)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(nm(s.content,e-o-1,t-o-1)))}function rm(n,e,t,r){let{index:o,offset:s}=n.findIndex(e),i=n.maybeChild(o);if(s==e||i.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=rm(i.content,e-s-1,t);return l&&n.replaceChild(o,i.copy(l))}function y9(n,e,t){if(t.openStart>n.depth)throw new Ri("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Ri("Inconsistent open depths");return om(n,e,t,0)}function om(n,e,t,r){let o=n.index(r),s=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let i=om(n,e,t,r+1);return s.copy(s.content.replaceChild(o,i))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let i=n.parent,l=i.content;return Wr(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=E9(t,n);return Wr(s,im(n,i,l,e,r))}else return Wr(s,Bi(n,e,r))}function sm(n,e){if(!e.type.compatibleContent(n.type))throw new Ri("Cannot join "+e.type.name+" onto "+n.type.name)}function vc(n,e,t){let r=n.node(t);return sm(r,e.node(t)),r}function jr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function ps(n,e,t,r){let o=(e||n).node(t),s=0,i=e?e.index(t):o.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(jr(n.nodeAfter,r),s++));for(let l=s;l<i;l++)jr(o.child(l),r);e&&e.depth==t&&e.textOffset&&jr(e.nodeBefore,r)}function Wr(n,e){return n.type.checkContent(e),n.copy(e)}function im(n,e,t,r,o){let s=n.depth>o&&vc(n,e,o+1),i=r.depth>o&&vc(t,r,o+1),l=[];return ps(null,n,o,l),s&&i&&e.index(o)==t.index(o)?(sm(s,i),jr(Wr(s,im(n,e,t,r,o+1)),l)):(s&&jr(Wr(s,Bi(n,e,o+1)),l),ps(e,t,o,l),i&&jr(Wr(i,Bi(t,r,o+1)),l)),ps(r,null,o,l),new fe(l)}function Bi(n,e,t){let r=[];if(ps(null,n,t,r),n.depth>t){let o=vc(n,e,t+1);jr(Wr(o,Bi(n,e,t+1)),r)}return ps(e,null,t,r),new fe(r)}function E9(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)o=e.node(s).copy(fe.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class _s{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?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[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].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 r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}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):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)o+=r.child(s).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return We.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let l=r;r=o,o=l}let s=r.marks;for(var i=0;i<s.length;i++)s[i].type.spec.inclusive===!1&&(!o||!s[i].isInSet(o.marks))&&(s=s[i--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.marks))&&(r=r[s--].removeFromSet(r));return r}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 r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Pi(this,e,r);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 new RangeError("Position "+t+" out of range");let r=[],o=0,s=t;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(s),u=s-a;if(r.push(i,l,o+a),!u||(i=i.child(l),i.isText))break;s=u-1,o+=a+1}return new _s(t,r,s)}static resolveCached(e,t){for(let o=0;o<Al.length;o++){let s=Al[o];if(s.pos==t&&s.doc==e)return s}let r=Al[wl]=_s.resolve(e,t);return wl=(wl+1)%C9,r}}let Al=[],wl=0,C9=12;class Pi{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}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)}}const b9=Object.create(null);let Kr=class yc{constructor(e,t,r,o=We.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||fe.empty}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,r,o=0){this.content.nodesBetween(e,t,r,o,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,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}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,r){return this.type==e&&Di(this.attrs,t||e.defaultAttrs||b9)&&We.sameSet(this.marks,r||We.none)}copy(e=null){return e==this.content?this:new yc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new yc(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return we.empty;let o=this.resolve(e),s=this.resolve(t),i=r?0:o.sharedDepth(t),l=o.start(i),u=o.node(i).content.cut(o.pos-l,s.pos-l);return new we(u,o.depth-i,s.depth-i)}replace(e,t,r){return y9(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return _s.resolveCached(this,e)}resolveNoCache(e){return _s.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(o=!0),!o)),o}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()+")"),am(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=fe.empty,o=0,s=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,o,s),l=i&&i.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let s=this.contentMatchAt(e).matchType(r),i=s&&s.matchFragment(this.content,t);return i?i.validEnd:!1}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);let e=We.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!We.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=fe.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,o,r)}};Kr.prototype.text=void 0;class Fi extends Kr{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):am(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 Fi(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Fi(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&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 am(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Xr{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new A9(e,t);if(r.next==null)return Xr.empty;let o=lm(r);r.next&&r.err("Unexpected trailing text");let s=N9(x9(o));return I9(s,r),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}matchFragment(e,t=0,r=e.childCount){let o=this;for(let s=t;o&&s<r;s++)o=o.matchType(e.child(s).type);return o}get inlineContent(){return this.next.length!=0&&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 r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function s(i,l){let a=i.matchFragment(e,r);if(a&&(!t||a.validEnd))return fe.from(l.map(u=>u.createAndFill()));for(let u=0;u<i.next.length;u++){let{type:d,next:f}=i.next[u];if(!(d.isText||d.hasRequiredAttrs())&&o.indexOf(f)==-1){o.push(f);let h=s(f,l.concat(d));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),s=o.match;if(s.matchType(e)){let i=[];for(let l=o;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<s.next.length;i++){let{type:l,next:a}=s.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let s=o+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)s+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return s}).join(`
|
|
63
63
|
`)}}Xr.empty=new Xr(!0);class A9{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 new SyntaxError(e+" (in content expression '"+this.string+"')")}}function lm(n){let e=[];do e.push(w9(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function w9(n){let e=[];do e.push(T9(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function T9(n){let e=_9(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=S9(n,e);else break;return e}function ef(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function S9(n,e){let t=ef(n),r=t;return n.eat(",")&&(n.next!="}"?r=ef(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function k9(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let s in t){let i=t[s];i.groups.indexOf(e)>-1&&o.push(i)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function _9(n){if(n.eat("(")){let e=lm(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=k9(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function x9(n){let e=[[]];return o(s(n,0),t()),e;function t(){return e.push([])-1}function r(i,l,a){let u={term:a,to:l};return e[i].push(u),u}function o(i,l){i.forEach(a=>a.to=l)}function s(i,l){if(i.type=="choice")return i.exprs.reduce((a,u)=>a.concat(s(u,l)),[]);if(i.type=="seq")for(let a=0;;a++){let u=s(i.exprs[a],l);if(a==i.exprs.length-1)return u;o(u,l=t())}else if(i.type=="star"){let a=t();return r(l,a),o(s(i.expr,a),a),[r(a)]}else if(i.type=="plus"){let a=t();return o(s(i.expr,l),a),o(s(i.expr,a),a),[r(a)]}else{if(i.type=="opt")return[r(l)].concat(s(i.expr,l));if(i.type=="range"){let a=l;for(let u=0;u<i.min;u++){let d=t();o(s(i.expr,a),d),a=d}if(i.max==-1)o(s(i.expr,a),a);else for(let u=i.min;u<i.max;u++){let d=t();r(a,d),o(s(i.expr,a),d),a=d}return[r(a)]}else{if(i.type=="name")return[r(l,void 0,i.value)];throw new Error("Unknown expr type")}}}}function cm(n,e){return e-n}function tf(n,e){let t=[];return r(e),t.sort(cm);function r(o){let s=n[o];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(o);for(let i=0;i<s.length;i++){let{term:l,to:a}=s[i];!l&&t.indexOf(a)==-1&&r(a)}}}function N9(n){let e=Object.create(null);return t(tf(n,0));function t(r){let o=[];r.forEach(i=>{n[i].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let d=0;d<o.length;d++)o[d][0]==l&&(u=o[d][1]);tf(n,a).forEach(d=>{u||o.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let s=e[r.join(",")]=new Xr(r.indexOf(n.length-1)>-1);for(let i=0;i<o.length;i++){let l=o[i][1].sort(cm);s.next.push({type:o[i][0],next:e[l.join(",")]||t(l)})}return s}}function I9(n,e){for(let t=0,r=[n];t<r.length;t++){let o=r[t],s=!o.validEnd,i=[];for(let l=0;l<o.next.length;l++){let{type:a,next:u}=o.next[l];i.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(u)==-1&&r.push(u)}s&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function um(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function dm(n,e){let t=Object.create(null);for(let r in n){let o=e&&e[r];if(o===void 0){let s=n[r];if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=o}return t}function fm(n){let e=Object.create(null);if(n)for(let t in n)e[t]=new M9(n[t]);return e}let nf=class hm{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=fm(r.attrs),this.defaultAttrs=um(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Xr.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:dm(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Kr(this,this.computeAttrs(e),fe.from(t),We.setFrom(r))}createChecked(e=null,t,r){return t=fe.from(t),this.checkContent(t),new Kr(this,this.computeAttrs(e),t,We.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=fe.from(t),t.size){let i=this.contentMatch.fillBefore(t);if(!i)return null;t=i.append(t)}let o=this.contentMatch.matchFragment(t),s=o&&o.fillBefore(fe.empty,!0);return s?new Kr(this,e,t.append(s),We.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:We.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,i)=>r[s]=new hm(s,t,i));let o=t.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class M9{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class za{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=fm(o.attrs),this.excluded=null;let s=um(this.attrs);this.instance=s?new We(this,s):null}create(e=null){return!e&&this.instance?this.instance:new We(this,dm(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((s,i)=>r[s]=new za(s,o++,t,i)),r}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]}excludes(e){return this.excluded.indexOf(e)>-1}}class O9{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=ht.from(e.nodes),t.marks=ht.from(e.marks||{}),this.nodes=nf.compile(this.spec.nodes,this),this.marks=za.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let s=this.nodes[o],i=s.spec.content||"",l=s.spec.marks;s.contentMatch=r[i]||(r[i]=Xr.parse(i,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.markSet=l=="_"?null:l?rf(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let o in this.marks){let s=this.marks[o],i=s.spec.excludes;s.excluded=i==null?[s]:i==""?[]:rf(this,i.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof nf){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,o)}text(e,t){let r=this.nodes.text;return new Fi(r,r.defaultAttrs,e,We.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Kr.fromJSON(this,e)}markFromJSON(e){return We.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function rf(n,e){let t=[];for(let r=0;r<e.length;r++){let o=e[r],s=n.marks[o],i=s;if(s)t.push(s);else for(let l in n.marks){let a=n.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&t.push(i=a)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}class Lo{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let o=e.nodes[r.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new sf(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new sf(this,t,!0);return r.addAll(e,t.from,t.to),we.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let s=this.tags[o];if(R9(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let i=s.getAttrs(e);if(i===!1)continue;s.attrs=i||void 0}return s}}}matchStyle(e,t,r,o){for(let s=o?this.styles.indexOf(o)+1:0;s<this.styles.length;s++){let i=this.styles[s],l=i.style;if(!(l.indexOf(e)!=0||i.context&&!r.matchesContext(i.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(i.getAttrs){let a=i.getAttrs(t);if(a===!1)continue;i.attrs=a||void 0}return i}}}static schemaRules(e){let t=[];function r(o){let s=o.priority==null?50:o.priority,i=0;for(;i<t.length;i++){let l=t[i];if((l.priority==null?50:l.priority)<s)break}t.splice(i,0,o)}for(let o in e.marks){let s=e.marks[o].spec.parseDOM;s&&s.forEach(i=>{r(i=af(i)),i.mark||i.ignore||i.clearMark||(i.mark=o)})}for(let o in e.nodes){let s=e.nodes[o].spec.parseDOM;s&&s.forEach(i=>{r(i=af(i)),i.node||i.ignore||i.mark||(i.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Lo(e,Lo.schemaRules(e)))}}const pm={address:!0,article:!0,aside:!0,blockquote:!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},L9={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},mm={ol:!0,ul:!0},Vi=1,$i=2,ms=4;function of(n,e,t){return e!=null?(e?Vi:0)|(e==="full"?$i:0):n&&n.whitespace=="pre"?Vi|$i:t&~ms}class ii{constructor(e,t,r,o,s,i,l){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=o,this.solid=s,this.options=l,this.content=[],this.activeMarks=We.none,this.stashMarks=[],this.match=i||(l&ms?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(fe.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Vi)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-o[0].length))}}let t=fe.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(fe.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t<r.length;t++){let o=r[t];(this.type?this.type.allowsMarkType(o.type):P9(o.type,e))&&!o.isInSet(this.activeMarks)&&(this.activeMarks=o.addToSet(this.activeMarks),this.pendingMarks=o.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!pm.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class sf{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let o=t.topNode,s,i=of(null,t.preserveWhitespace,0)|(r?ms:0);o?s=new ii(o.type,o.attrs,We.none,We.none,!0,t.topMatch||o.type.contentMatch,i):r?s=new ii(null,null,We.none,We.none,!0,null,i):s=new ii(e.schema.topNodeType,null,We.none,We.none,!0,null,i),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,t){let r=e.getAttribute("style");if(!r)return t();let o=this.readStyles(B9(r));if(!o)return;let[s,i]=o,l=this.top;for(let a=0;a<i.length;a++)this.removePendingMark(i[a],l);for(let a=0;a<s.length;a++)this.addPendingMark(s[a]);t();for(let a=0;a<s.length;a++)this.removePendingMark(s[a],l);for(let a=0;a<i.length;a++)this.addPendingMark(i[a])}addTextNode(e){let t=e.nodeValue,r=this.top;if(r.options&$i||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(r.options&Vi)r.options&$i?t=t.replace(/\r\n?/g,`
|
|
64
64
|
`):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let o=r.content[r.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),o;mm.hasOwnProperty(r)&&this.parser.normalizeLists&&D9(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,t));if(s?s.ignore:L9.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let i,l=this.top,a=this.needsBlock;if(pm.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),i=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}s&&s.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),i&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,s,s.consuming===!1?o:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
65
65
|
`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=We.none,r=We.none;for(let o=0;o<e.length;o+=2)for(let s=void 0;;){let i=this.parser.matchStyle(e[o],e[o+1],this,s);if(!i)break;if(i.ignore)return null;if(i.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(l=>{i.clearMark(l)&&(r=l.addToSet(r))}):t=this.parser.schema.marks[i.mark].create(i.attrs).addToSet(t),i.consuming===!1)s=i;else break}return[t,r]}addElementByRule(e,t,r){let o,s,i;t.node?(s=this.parser.schema.nodes[t.node],s.isLeaf?this.insertNode(s.create(t.attrs))||this.leafFallback(e):o=this.enter(s,t.attrs||null,t.preserveWhitespace)):(i=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(i));let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}o&&this.sync(l)&&this.open--,i&&this.removePendingMark(i,l)}addAll(e,t,r){let o=t||0;for(let s=t?e.childNodes[t]:e.firstChild,i=r==null?null:e.childNodes[r];s!=i;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s);this.findAtPoint(e,o)}findPlace(e){let t,r;for(let o=this.open;o>=0;o--){let s=this.nodes[o],i=s.findWrapping(e);if(i&&(!t||t.length>i.length)&&(t=i,r=s,!i.length)||s.solid)break}if(!t)return!1;this.sync(r);for(let o=0;o<t.length;o++)this.enterInner(t[o],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let o=0;o<e.marks.length;o++)(!t.type||t.type.allowsMarkType(e.marks[o].type))&&(r=e.marks[o].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let o=this.findPlace(e.create(t));return o&&this.enterInner(e,t,!0,r),o}enterInner(e,t=null,r=!1,o){this.closeExtra();let s=this.top;s.applyPending(e),s.match=s.match&&s.match.matchType(e);let i=of(e,o,s.options);s.options&ms&&s.content.length==0&&(i|=ms),this.nodes.push(new ii(e,t,s.activeMarks,s.pendingMarks,r,null,i)),this.open++}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;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].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("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(o?0:1),i=(l,a)=>{for(;l>=0;l--){let u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(i(l-1,a))return!0;return!1}else{let d=a>0||a==0&&o?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!d||d.name!=u&&d.groups.indexOf(u)==-1)return!1;a--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=F9(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let o=this.nodes[r];if(o.pendingMarks.lastIndexOf(e)>-1)o.pendingMarks=e.removeFromSet(o.pendingMarks);else{o.activeMarks=e.removeFromSet(o.activeMarks);let i=o.popFromStashMark(e);i&&o.type&&o.type.allowsMarkType(i.type)&&(o.activeMarks=i.addToSet(o.activeMarks))}if(o==t)break}}}function D9(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&mm.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function R9(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function B9(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function af(n){let e={};for(let t in n)e[t]=n[t];return e}function P9(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let s=[],i=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:d}=l.edge(a);if(u==e||s.indexOf(d)<0&&i(d))return!0}};if(i(o.contentMatch))return!0}}function F9(n,e){for(let t=0;t<e.length;t++)if(n.eq(e[t]))return e[t]}class Sn{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Tl(t).createDocumentFragment());let o=r,s=[];return e.forEach(i=>{if(s.length||i.marks.length){let l=0,a=0;for(;l<s.length&&a<i.marks.length;){let u=i.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(s[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)o=s.pop()[1];for(;a<i.marks.length;){let u=i.marks[a++],d=this.serializeMark(u,i.isInline,t);d&&(s.push([u,o]),o.appendChild(d.dom),o=d.contentDOM||d.dom)}}o.appendChild(this.serializeNodeInner(i,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:o}=Sn.renderSpec(Tl(t),this.nodes[e.type.name](e));if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let s=this.serializeMark(e.marks[o],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&Sn.renderSpec(Tl(r),o(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let o=t[0],s=o.indexOf(" ");s>0&&(r=o.slice(0,s),o=o.slice(s+1));let i,l=r?e.createElementNS(r,o):e.createElement(o),a=t[1],u=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){u=2;for(let d in a)if(a[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),a[d]):l.setAttribute(d,a[d])}}for(let d=u;d<t.length;d++){let f=t[d];if(f===0){if(d<t.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=Sn.renderSpec(e,f,r);if(l.appendChild(h),p){if(i)throw new RangeError("Multiple content holes");i=p}}}return{dom:l,contentDOM:i}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Sn(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=lf(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return lf(e.marks)}}function lf(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Tl(n){return n.document||window.document}const gm=65535,vm=Math.pow(2,16);function V9(n,e){return n+e*vm}function cf(n){return n&gm}function $9(n){return(n-(n&gm))/vm}const ym=1,Em=2,Ai=4,Cm=8;class Ec{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Cm)>0}get deletedBefore(){return(this.delInfo&(ym|Ai))>0}get deletedAfter(){return(this.delInfo&(Em|Ai))>0}get deletedAcross(){return(this.delInfo&Ai)>0}}class $t{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&$t.empty)return $t.empty}recover(e){let t=0,r=cf(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+$9(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,s=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let u=this.ranges[l+s],d=this.ranges[l+i],f=a+u;if(e<=f){let h=u?e==a?-1:e==f?1:t:t,p=a+o+(h<0?0:d);if(r)return p;let m=e==(t<0?a:f)?null:V9(l/3,e-a),g=e==a?Em:e==f?ym:Ai;return(t<0?e!=a:e!=f)&&(g|=Cm),new Ec(p,g,m)}o+=d-u}return r?e+o:new Ec(e+o,0,null)}touches(e,t){let r=0,o=cf(t),s=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[l+s],d=a+u;if(e<=d&&l==o*3)return!0;r+=this.ranges[l+i]-u}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let i=this.ranges[o],l=i-(this.inverted?s:0),a=i+(this.inverted?0:s),u=this.ranges[o+t],d=this.ranges[o+r];e(l,l+u,a,a+d),s+=d-u}}invert(){return new $t(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?$t.empty:new $t(e<0?[0,-e,0]:[0,0,e])}}$t.empty=new $t([]);class gs{constructor(e=[],t,r=0,o=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=o}slice(e=0,t=this.maps.length){return new gs(this.maps,this.mirror,e,t)}copy(){return new gs(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let o=e.getMirror(t);this.appendMap(e.maps[t],o!=null&&o<t?r+o: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,r=this.maps.length+e.maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e.maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new gs;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let o=0;for(let s=this.from;s<this.to;s++){let i=this.maps[s],l=i.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this.maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new Ec(e,o,null)}}const Sl=Object.create(null);class Et{getMap(){return $t.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Sl[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Sl)throw new RangeError("Duplicate use of step JSON ID "+e);return Sl[e]=t,t.prototype.jsonID=e,t}}class ot{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ot(e,null)}static fail(e){return new ot(null,e)}static fromReplace(e,t,r,o){try{return ot.ok(e.replace(t,r,o))}catch(s){if(s instanceof Ri)return ot.fail(s.message);throw s}}}function Mu(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let s=n.child(o);s.content.size&&(s=s.copy(Mu(s.content,e,s))),s.isInline&&(s=e(s,t,o)),r.push(s)}return fe.fromArray(r)}class lr extends Et{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),s=new we(Mu(t.content,(i,l)=>!i.isAtom||!l.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),o),t.openStart,t.openEnd);return ot.fromReplace(e,this.from,this.to,s)}invert(){return new kn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new lr(t.pos,r.pos,this.mark)}merge(e){return e instanceof lr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new lr(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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new lr(t.from,t.to,e.markFromJSON(t.mark))}}Et.jsonID("addMark",lr);class kn extends Et{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new we(Mu(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return ot.fromReplace(e,this.from,this.to,r)}invert(){return new lr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new kn(t.pos,r.pos,this.mark)}merge(e){return e instanceof kn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new kn(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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new kn(t.from,t.to,e.markFromJSON(t.mark))}}Et.jsonID("removeMark",kn);class cr extends Et{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ot.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ot.fromReplace(e,this.pos,this.pos+1,new we(fe.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new cr(this.pos,t.marks[o]);return new cr(this.pos,this.mark)}}return new Do(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new cr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new cr(t.pos,e.markFromJSON(t.mark))}}Et.jsonID("addNodeMark",cr);class Do extends Et{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ot.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ot.fromReplace(e,this.pos,this.pos+1,new we(fe.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new cr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Do(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Do(t.pos,e.markFromJSON(t.mark))}}Et.jsonID("removeNodeMark",Do);class pt extends Et{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&Cc(e,this.from,this.to)?ot.fail("Structure replace would overwrite content"):ot.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new $t([this.from,this.to-this.from,this.slice.size])}invert(e){return new pt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new pt(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof pt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?we.empty:new we(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?we.empty:new we(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pt(e.from,this.to,t,this.structure)}else return null}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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new pt(t.from,t.to,we.fromJSON(e,t.slice),!!t.structure)}}Et.jsonID("replace",pt);class ut extends Et{constructor(e,t,r,o,s,i,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=i,this.structure=l}apply(e){if(this.structure&&(Cc(e,this.from,this.gapFrom)||Cc(e,this.gapTo,this.to)))return ot.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ot.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ot.fromReplace(e,this.from,this.to,r):ot.fail("Content does not fit in gap")}getMap(){return new $t([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 ut(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),r=e.mapResult(this.to,-1),o=e.map(this.gapFrom,-1),s=e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||s>r.pos?null:new ut(t.pos,r.pos,o,s,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(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new ut(t.from,t.to,t.gapFrom,t.gapTo,we.fromJSON(e,t.slice),t.insert,!!t.structure)}}Et.jsonID("replaceAround",ut);function Cc(n,e,t){let r=n.resolve(e),o=t-e,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let i=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,o--}}return!1}function U9(n,e,t,r){let o=[],s=[],i,l;n.doc.nodesBetween(e,t,(a,u,d)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&d.type.allowsMarkType(r.type)){let h=Math.max(u,e),p=Math.min(u+a.nodeSize,t),m=r.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(i&&i.to==h&&i.mark.eq(f[g])?i.to=p:o.push(i=new kn(h,p,f[g])));l&&l.to==h?l.to=p:s.push(l=new lr(h,p,r))}}),o.forEach(a=>n.step(a)),s.forEach(a=>n.step(a))}function z9(n,e,t,r){let o=[],s=0;n.doc.nodesBetween(e,t,(i,l)=>{if(!i.isInline)return;s++;let a=null;if(r instanceof za){let u=i.marks,d;for(;d=r.isInSet(u);)(a||(a=[])).push(d),u=d.removeFromSet(u)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let u=Math.min(l+i.nodeSize,t);for(let d=0;d<a.length;d++){let f=a[d],h;for(let p=0;p<o.length;p++){let m=o[p];m.step==s-1&&f.eq(o[p].style)&&(h=m)}h?(h.to=u,h.step=s):o.push({style:f,from:Math.max(l,e),to:u,step:s})}}}),o.forEach(i=>n.step(new kn(i.from,i.to,i.style)))}function H9(n,e,t,r=t.contentMatch){let o=n.doc.nodeAt(e),s=[],i=e+1;for(let l=0;l<o.childCount;l++){let a=o.child(l),u=i+a.nodeSize,d=r.matchType(a.type);if(!d)s.push(new pt(i,u,we.empty));else{r=d;for(let f=0;f<a.marks.length;f++)t.allowsMarkType(a.marks[f].type)||n.step(new kn(i,u,a.marks[f]));if(a.isText&&!t.spec.code){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(a.text);)p||(p=new we(fe.from(t.schema.text(" ",t.allowedMarks(a.marks))),0,0)),s.push(new pt(i+f.index,i+f.index+f[0].length,p))}}i=u}if(!r.validEnd){let l=r.fillBefore(fe.empty,!0);n.replace(i,i,new we(l,0,0))}for(let l=s.length-1;l>=0;l--)n.step(s[l])}function j9(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Zo(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let o=n.$from.node(r),s=n.$from.index(r),i=n.$to.indexAfter(r);if(r<n.depth&&o.canReplace(s,i,t))return r;if(r==0||o.type.spec.isolating||!j9(o,s,i))break}return null}function W9(n,e,t){let{$from:r,$to:o,depth:s}=e,i=r.before(s+1),l=o.after(s+1),a=i,u=l,d=fe.empty,f=0;for(let m=s,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,d=fe.from(r.node(m).copy(d)),f++):a--;let h=fe.empty,p=0;for(let m=s,g=!1;m>t;m--)g||o.after(m+1)<o.end(m)?(g=!0,h=fe.from(o.node(m).copy(h)),p++):u++;n.step(new ut(a,u,i,l,new we(d.append(h),f,p),d.size-f,!0))}function Ou(n,e,t=null,r=n){let o=K9(n,e),s=o&&Y9(r,e);return s?o.map(uf).concat({type:e,attrs:t}).concat(s.map(uf)):null}function uf(n){return{type:n,attrs:null}}function K9(n,e){let{parent:t,startIndex:r,endIndex:o}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let i=s.length?s[0]:e;return t.canReplaceWith(r,o,i)?s:null}function Y9(n,e){let{parent:t,startIndex:r,endIndex:o}=n,s=t.child(r),i=e.contentMatch.findWrapping(s.type);if(!i)return null;let a=(i.length?i[i.length-1]:e).contentMatch;for(let u=r;a&&u<o;u++)a=a.matchType(t.child(u).type);return!a||!a.validEnd?null:i}function G9(n,e,t){let r=fe.empty;for(let i=t.length-1;i>=0;i--){if(r.size){let l=t[i].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=fe.from(t[i].type.create(t[i].attrs,r))}let o=e.start,s=e.end;n.step(new ut(o,s,o,s,new we(r,0,0),t.length,!0))}function Q9(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(i,l)=>{if(i.isTextblock&&!i.hasMarkup(r,o)&&Z9(n.doc,n.mapping.slice(s).map(l),r)){n.clearIncompatible(n.mapping.slice(s).map(l,1),r);let a=n.mapping.slice(s),u=a.map(l,1),d=a.map(l+i.nodeSize,1);return n.step(new ut(u,d,u+1,d-1,new we(fe.from(r.create(o,null,i.marks)),0,0),1,!0)),!1}})}function Z9(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function J9(n,e,t,r,o){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let i=t.create(r,null,o||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,i);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new ut(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new we(fe.from(i),0,0),1,!0))}function Io(n,e,t=1,r){let o=n.resolve(e),s=o.depth-t,i=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!i.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let u=o.depth-1,d=t-2;u>s;u--,d--){let f=o.node(u),h=o.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[d]||f;if(!f.canReplace(h+1,f.childCount)||!g.type.validContent(p))return!1}let l=o.indexAfter(s),a=r&&r[0];return o.node(s).canReplaceWith(l,l,a?a.type:o.node(s+1).type)}function X9(n,e,t=1,r){let o=n.doc.resolve(e),s=fe.empty,i=fe.empty;for(let l=o.depth,a=o.depth-t,u=t-1;l>a;l--,u--){s=fe.from(o.node(l).copy(s));let d=r&&r[u];i=fe.from(d?d.type.create(d.attrs,i):o.node(l).copy(i))}n.step(new pt(e,e,new we(s.append(i),t,t),!0))}function Cr(n,e){let t=n.resolve(e),r=t.index();return bm(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function bm(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function Ha(n,e,t=-1){let r=n.resolve(e);for(let o=r.depth;;o--){let s,i,l=r.index(o);if(o==r.depth?(s=r.nodeBefore,i=r.nodeAfter):t>0?(s=r.node(o+1),l++,i=r.node(o).maybeChild(l)):(s=r.node(o).maybeChild(l-1),i=r.node(o+1)),s&&!s.isTextblock&&bm(s,i)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=t<0?r.before(o):r.after(o)}}function q9(n,e,t){let r=new pt(e-t,e+t,we.empty,!0);n.step(r)}function eE(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let s=r.index(o);if(r.node(o).canReplaceWith(s,s,t))return r.before(o+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let s=r.indexAfter(o);if(r.node(o).canReplaceWith(s,s,t))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function tE(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let s=0;s<t.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let i=r.depth;i>=0;i--){let l=i==r.depth?0:r.pos<=(r.start(i+1)+r.end(i+1))/2?-1:1,a=r.index(i)+(l>0?1:0),u=r.node(i),d=!1;if(s==1)d=u.canReplace(a,a,o);else{let f=u.contentMatchAt(a).findWrapping(o.firstChild.type);d=f&&u.canReplaceWith(a,a,f[0])}if(d)return l==0?r.pos:l<0?r.before(i+1):r.after(i+1)}return null}function Lu(n,e,t=e,r=we.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),s=n.resolve(t);return Am(o,s,r)?new pt(e,t,r):new nE(o,s,r).fit()}function Am(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class nE{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=fe.empty;for(let o=0;o<=e.depth;o++){let s=e.node(o);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=fe.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let s=this.placed,i=r.depth,l=o.depth;for(;i&&l&&s.childCount==1;)s=s.firstChild.content,i--,l--;let a=new we(s,i,l);return e>-1?new ut(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new pt(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(o=0),s.type.spec.isolating&&o<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,s=null;r?(s=kl(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let i=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],d,f=null;if(t==1&&(i?u.matchType(i.type)||(f=u.fillBefore(fe.from(i),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:f};if(t==2&&i&&(d=u.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:d};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=kl(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new we(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=kl(e,t);if(o.childCount<=1&&t>0){let s=e.size-t<=t+o.size;this.unplaced=new we(us(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new we(us(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let i=this.unplaced,l=r?r.content:i.content,a=i.openStart-e,u=0,d=[],{match:f,type:h}=this.frontier[t];if(o){for(let g=0;g<o.childCount;g++)d.push(o.child(g));f=f.matchFragment(o)}let p=l.size+e-(i.content.size-i.openEnd);for(;u<l.childCount;){let g=l.child(u),v=f.matchType(g.type);if(!v)break;u++,(u>1||a==0||g.content.size)&&(f=v,d.push(wm(g.mark(h.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?p:-1)))}let m=u==l.childCount;m||(p=-1),this.placed=ds(this.placed,t,fe.from(d)),this.frontier[t].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,v=l;g<p;g++){let C=v.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),v=C.content}this.unplaced=m?e==0?we.empty:new we(us(i.content,e-1,1),e-1,p<0?i.openEnd:e-1):new we(us(i.content,e,u),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!_l(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:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=_l(e,t,o,r,s);if(i){for(let l=t-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],d=_l(e,l,u,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:i,move:s?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=ds(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),s=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,s)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=ds(this.placed,this.depth,fe.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(fe.empty,!0);t.childCount&&(this.placed=ds(this.placed,this.frontier.length,t))}}function us(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(us(n.firstChild.content,e-1,t)))}function ds(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ds(n.lastChild.content,e-1,t)))}function kl(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function wm(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,wm(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(fe.empty,!0)))),n.copy(r)}function _l(n,e,t,r,o){let s=n.node(e),i=o?n.indexAfter(e):n.index(e);if(i==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,i);return l&&!rE(t,s.content,i)?l:null}function rE(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function oE(n){return n.spec.defining||n.spec.definingForContent}function sE(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),s=n.doc.resolve(t);if(Am(o,s,r))return n.step(new pt(e,t,r));let i=Sm(o,n.doc.resolve(t));i[i.length-1]==0&&i.pop();let l=-(o.depth+1);i.unshift(l);for(let h=o.depth,p=o.pos-1;h>0;h--,p--){let m=o.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;i.indexOf(h)>-1?l=h:o.before(h)==p&&i.splice(1,0,-h)}let a=i.indexOf(l),u=[],d=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(u.push(m),p==r.openStart)break;h=m.content}for(let h=d-1;h>=0;h--){let p=u[h],m=oE(p.type);if(m&&!p.sameMarkup(o.node(Math.abs(l)-1)))d=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+d+1)%(r.openStart+1),m=u[p];if(m)for(let g=0;g<i.length;g++){let v=i[(g+a)%i.length],C=!0;v<0&&(C=!1,v=-v);let A=o.node(v-1),E=o.index(v-1);if(A.canReplaceWith(E,E,m.type,m.marks))return n.replace(o.before(v),C?s.after(v):t,new we(Tm(r.content,0,r.openStart,p),p,r.openEnd))}}let f=n.steps.length;for(let h=i.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>f));h--){let p=i[h];p<0||(e=o.before(p),t=s.after(p))}}function Tm(n,e,t,r,o){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(Tm(s.content,e+1,t,r,s)))}if(e>r){let s=o.contentMatchAt(0),i=s.fillBefore(n).append(n);n=i.append(s.matchFragment(i).fillBefore(fe.empty,!0))}return n}function iE(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=eE(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new we(fe.from(r),0,0))}function aE(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t),s=Sm(r,o);for(let i=0;i<s.length;i++){let l=s[i],a=i==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return n.delete(r.before(l),o.after(l))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(e-r.start(i)==r.depth-i&&t>r.end(i)&&o.end(i)-t!=o.depth-i)return n.delete(r.before(i),t);n.delete(e,t)}function Sm(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let s=n.start(o);if(s<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(s==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==s-1)&&t.push(o)}return t}class Mo extends Et{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ot.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return ot.fromReplace(e,this.pos,this.pos+1,new we(fe.from(o),0,t.isLeaf?0:1))}getMap(){return $t.empty}invert(e){return new Mo(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 Mo(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Mo(t.pos,t.attr,t.value)}}Et.jsonID("attr",Mo);class xs extends Et{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ot.ok(r)}getMap(){return $t.empty}invert(e){return new xs(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(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new xs(t.attr,t.value)}}Et.jsonID("docAttr",xs);let Ro=class extends Error{};Ro=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ro.prototype=Object.create(Error.prototype);Ro.prototype.constructor=Ro;Ro.prototype.name="TransformError";class km{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new gs}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ro(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}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=we.empty){let o=Lu(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new we(fe.from(r),0,0))}delete(e,t){return this.replace(e,t,we.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return sE(this,e,t,r),this}replaceRangeWith(e,t,r){return iE(this,e,t,r),this}deleteRange(e,t){return aE(this,e,t),this}lift(e,t){return W9(this,e,t),this}join(e,t=1){return q9(this,e,t),this}wrap(e,t){return G9(this,e,t),this}setBlockType(e,t=e,r,o=null){return Q9(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return J9(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new Mo(e,t,r)),this}setDocAttribute(e,t){return this.step(new xs(e,t)),this}addNodeMark(e,t){return this.step(new cr(e,t)),this}removeNodeMark(e,t){if(!(t instanceof We)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new Do(e,t)),this}split(e,t=1,r){return X9(this,e,t,r),this}addMark(e,t,r){return U9(this,e,t,r),this}removeMark(e,t,r){return z9(this,e,t,r),this}clearIncompatible(e,t,r){return H9(this,e,t,r),this}}const xl=Object.create(null);class $e{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new lE(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=we.empty){let r=t.content.lastChild,o=null;for(let l=0;l<t.openEnd;l++)o=r,r=r.lastChild;let s=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){let{$from:a,$to:u}=i[l],d=e.mapping.slice(s);e.replaceRange(d.map(a.pos),d.map(u.pos),l?we.empty:t),l==0&&hf(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:i,$to:l}=o[s],a=e.mapping.slice(r),u=a.map(i.pos),d=a.map(l.pos);s?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),hf(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let o=e.parent.inlineContent?new ze(e):vo(e.node(0),e.parent,e.pos,e.index(),t,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let i=t<0?vo(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):vo(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new dn(e.node(0))}static atStart(e){return vo(e,e,0,0,1)||new dn(e)}static atEnd(e){return vo(e,e,e.content.size,e.childCount,-1)||new dn(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=xl[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in xl)throw new RangeError("Duplicate use of selection JSON ID "+e);return xl[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ze.between(this.$anchor,this.$head).getBookmark()}}$e.prototype.visible=!0;class lE{constructor(e,t){this.$from=e,this.$to=t}}let df=!1;function ff(n){!df&&!n.parent.inlineContent&&(df=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class ze extends $e{constructor(e,t=e){ff(e),ff(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return $e.near(r);let o=e.resolve(t.map(this.anchor));return new ze(o.parent.inlineContent?o:r,r)}replace(e,t=we.empty){if(super.replace(e,t),t==we.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ze&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ja(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ze(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let s=$e.findFrom(t,r,!0)||$e.findFrom(t,-r,!0);if(s)t=s.$head;else return $e.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=($e.findFrom(e,-r,!0)||$e.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new ze(e,t)}}$e.jsonID("text",ze);class ja{constructor(e,t){this.anchor=e,this.head=t}map(e){return new ja(e.map(this.anchor),e.map(this.head))}resolve(e){return ze.between(e.resolve(this.anchor),e.resolve(this.head))}}class Le extends $e{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:o}=t.mapResult(this.anchor),s=e.resolve(o);return r?$e.near(s):new Le(s)}content(){return new we(fe.from(this.node),0,0)}eq(e){return e instanceof Le&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Du(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Le(e.resolve(t.anchor))}static create(e,t){return new Le(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Le.prototype.visible=!1;$e.jsonID("node",Le);class Du{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new ja(r,r):new Du(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&Le.isSelectable(r)?new Le(t):$e.near(t)}}class dn extends $e{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=we.empty){if(t==we.empty){e.delete(0,e.doc.content.size);let r=$e.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new dn(e)}map(e){return new dn(e)}eq(e){return e instanceof dn}getBookmark(){return cE}}$e.jsonID("all",dn);const cE={map(){return this},resolve(n){return new dn(n)}};function vo(n,e,t,r,o,s=!1){if(e.inlineContent)return ze.create(n,t);for(let i=r-(o>0?0:1);o>0?i<e.childCount:i>=0;i+=o){let l=e.child(i);if(l.isAtom){if(!s&&Le.isSelectable(l))return Le.create(n,t-(o<0?l.nodeSize:0))}else{let a=vo(n,l,t+o,o<0?l.childCount:0,o,s);if(a)return a}t+=l.nodeSize*o}return null}function hf(n,e,t){let r=n.steps.length-1;if(r<e)return;let o=n.steps[r];if(!(o instanceof pt||o instanceof ut))return;let s=n.mapping.maps[r],i;s.forEach((l,a,u,d)=>{i==null&&(i=d)}),n.setSelection($e.near(n.doc.resolve(i),t))}const pf=1,ai=2,mf=4;class uE extends km{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 new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|pf)&~ai,this.storedMarks=null,this}get selectionSet(){return(this.updated&pf)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=ai,this}ensureMarks(e){return We.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(this.updated&ai)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~ai,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||We.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let i=this.doc.resolve(t);s=r==t?i.marks():i.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,s)),this.selection.empty||this.setSelection($e.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=mf,this}get scrolledIntoView(){return(this.updated&mf)>0}}function gf(n,e){return!e||!n?n:n.bind(e)}class fs{constructor(e,t,r){this.name=e,this.init=gf(t.init,r),this.apply=gf(t.apply,r)}}const dE=[new fs("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new fs("selection",{init(n,e){return n.selection||$e.atStart(e.doc)},apply(n){return n.selection}}),new fs("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new fs("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class Nl{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=dE.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new fs(r.key,r.spec.state,r))})}}class ko{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 r=0;r<this.config.plugins.length;r++)if(r!=t){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),o=null;for(;;){let s=!1;for(let i=0;i<this.config.plugins.length;i++){let l=this.config.plugins[i];if(l.spec.appendTransaction){let a=o?o[i].n:0,u=o?o[i].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,u,r);if(d&&r.filterTransaction(d,i)){if(d.setMeta("appendedTransaction",e),!o){o=[];for(let f=0;f<this.config.plugins.length;f++)o.push(f<i?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),s=!0}o&&(o[i]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new ko(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new uE(this)}static create(e){let t=new Nl(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new ko(t);for(let o=0;o<t.fields.length;o++)r[t.fields[o].name]=t.fields[o].init(e,r);return r}reconfigure(e){let t=new Nl(this.schema,e.plugins),r=t.fields,o=new ko(t);for(let s=0;s<r.length;s++){let i=r[s].name;o[i]=this.hasOwnProperty(i)?this[i]:r[s].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],s=o.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Nl(e.schema,e.plugins),s=new ko(o);return o.fields.forEach(i=>{if(i.name=="doc")s.doc=Kr.fromJSON(e.schema,t.doc);else if(i.name=="selection")s.selection=$e.fromJSON(s.doc,t.selection);else if(i.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],u=a.spec.state;if(a.key==i.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[i.name]=u.fromJSON.call(a,e,t[l],s);return}}s[i.name]=i.init(e,s)}}),s}}function _m(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=_m(o,e,{})),t[r]=o}return t}class Ft{constructor(e){this.spec=e,this.props={},e.props&&_m(e.props,this,this.props),this.key=e.key?e.key.key:xm("plugin")}getState(e){return e[this.key]}}const Il=Object.create(null);function xm(n){return n in Il?n+"$"+ ++Il[n]:(Il[n]=0,n+"$")}class gn{constructor(e="key"){this.key=xm(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const kt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Ns=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let vf=null;const $n=function(n,e,t){let r=vf||(vf=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},qr=function(n,e,t,r){return t&&(yf(n,e,t,r,-1)||yf(n,e,t,r,1))},fE=/^(img|br|input|textarea|hr)$/i;function yf(n,e,t,r,o){for(;;){if(n==t&&e==r)return!0;if(e==(o<0?0:Tn(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Ru(n)||fE.test(n.nodeName)||n.contentEditable=="false")return!1;e=kt(n)+(o<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(o<0?-1:0)],n.contentEditable=="false")return!1;e=o<0?Tn(n):0}else return!1}}function Tn(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function hE(n,e,t){for(let r=e==0,o=e==Tn(n);r||o;){if(n==t)return!0;let s=kt(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,o=o&&s==Tn(n)}}function Ru(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Wa=function(n){return n.focusNode&&qr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Rr(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function pE(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function mE(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:r.startOffset}}}const In=typeof navigator<"u"?navigator:null,Ef=typeof document<"u"?document:null,br=In&&In.userAgent||"",bc=/Edge\/(\d+)/.exec(br),Nm=/MSIE \d/.exec(br),Ac=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(br),Pt=!!(Nm||Ac||bc),dr=Nm?document.documentMode:Ac?+Ac[1]:bc?+bc[1]:0,pn=!Pt&&/gecko\/(\d+)/i.test(br);pn&&+(/Firefox\/(\d+)/.exec(br)||[0,0])[1];const wc=!Pt&&/Chrome\/(\d+)/.exec(br),vt=!!wc,gE=wc?+wc[1]:0,Nt=!Pt&&!!In&&/Apple Computer/.test(In.vendor),Bo=Nt&&(/Mobile\/\w+/.test(br)||!!In&&In.maxTouchPoints>2),qt=Bo||(In?/Mac/.test(In.platform):!1),vE=In?/Win/.test(In.platform):!1,cn=/Android \d/.test(br),Ks=!!Ef&&"webkitFontSmoothing"in Ef.documentElement.style,yE=Ks?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function EE(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Bn(n,e){return typeof n=="number"?n:n[e]}function CE(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Cf(n,e,t){let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let i=t||n.dom;i;i=Ns(i)){if(i.nodeType!=1)continue;let l=i,a=l==s.body,u=a?EE(s):CE(l),d=0,f=0;if(e.top<u.top+Bn(r,"top")?f=-(u.top-e.top+Bn(o,"top")):e.bottom>u.bottom-Bn(r,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+Bn(o,"top")-u.top:e.bottom-u.bottom+Bn(o,"bottom")),e.left<u.left+Bn(r,"left")?d=-(u.left-e.left+Bn(o,"left")):e.right>u.right-Bn(r,"right")&&(d=e.right-u.right+Bn(o,"right")),d||f)if(a)s.defaultView.scrollBy(d,f);else{let h=l.scrollLeft,p=l.scrollTop;f&&(l.scrollTop+=f),d&&(l.scrollLeft+=d);let m=l.scrollLeft-h,g=l.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(i).position))break}}function bE(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let s=(e.left+e.right)/2,i=t+1;i<Math.min(innerHeight,e.bottom);i+=5){let l=n.root.elementFromPoint(s,i);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:Im(n.dom)}}function Im(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Ns(r));return e}function AE({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Mm(t,r==0?0:r-e)}function Mm(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:o,left:s}=n[t];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let uo=null;function wE(n){if(n.setActive)return n.setActive();if(uo)return n.focus(uo);let e=Im(n);n.focus(uo==null?{get preventScroll(){return uo={preventScroll:!0},!0}}:void 0),uo||(uo=!1,Mm(e,0))}function Om(n,e){let t,r=2e8,o,s=0,i=e.top,l=e.top,a,u;for(let d=n.firstChild,f=0;d;d=d.nextSibling,f++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=$n(d).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=i&&m.bottom>=l){i=Math.max(m.bottom,i),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=d,r=g,o=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(s=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=f+1)}}return!t&&a&&(t=a,o=u,r=0),t&&t.nodeType==3?TE(t,o):!t||r&&t.nodeType==1?{node:n,offset:s}:Om(t,o)}function TE(n,e){let t=n.nodeValue.length,r=document.createRange();for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let s=rr(r,1);if(s.top!=s.bottom&&Bu(e,s))return{node:n,offset:o+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function Bu(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function SE(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function kE(n,e,t){let{node:r,offset:o}=Om(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let i=r.getBoundingClientRect();s=i.left!=i.right&&t.left>(i.left+i.right)/2?1:-1}return n.docView.posFromDOM(r,o,s)}function _E(n,e,t,r){let o=-1;for(let s=e,i=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent&&!i||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&!i&&(i=!0,a.left>r.left||a.top>r.top?o=l.posBefore:(a.right<r.left||a.bottom<r.top)&&(o=l.posAfter)),!l.contentDOM&&o<0&&!l.node.isText)return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}s=l.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function Lm(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=o;;){let i=n.childNodes[s];if(i.nodeType==1){let l=i.getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(Bu(e,u))return Lm(i,e,u)}}if((s=(s+1)%r)==o)break}return n}function xE(n,e){let t=n.dom.ownerDocument,r,o=0,s=mE(t,e.left,e.top);s&&({node:r,offset:o}=s);let i=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!i||!n.dom.contains(i.nodeType!=1?i.parentNode:i)){let u=n.dom.getBoundingClientRect();if(!Bu(e,u)||(i=Lm(n.dom,e,u),!i))return null}if(Nt)for(let u=i;r&&u;u=Ns(u))u.draggable&&(r=void 0);if(i=SE(i,e),r){if(pn&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let d=r.childNodes[o],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&o++}let u;Ks&&o&&r.nodeType==1&&(u=r.childNodes[o-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=_E(n,r,o,e))}l==null&&(l=kE(n,i,e));let a=n.docView.nearestDesc(i,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function bf(n){return n.top<n.bottom||n.left<n.right}function rr(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(bf(r))return r}return Array.prototype.find.call(t,bf)||n.getBoundingClientRect()}const NE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Dm(n,e,t){let{node:r,offset:o,atom:s}=n.docView.domFromPos(e,t<0?-1:1),i=Ks||pn;if(r.nodeType==3)if(i&&(NE.test(r.nodeValue)||(t<0?!o:o==r.nodeValue.length))){let a=rr($n(r,o,o),t);if(pn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let u=rr($n(r,o-1,o-1),-1);if(u.top==a.top){let d=rr($n(r,o,o+1),-1);if(d.top!=a.top)return is(d,d.left<u.left)}}return a}else{let a=o,u=o,d=t<0?1:-1;return t<0&&!o?(u++,d=-1):t>=0&&o==r.nodeValue.length?(a--,d=1):t<0?a--:u++,is(rr($n(r,a,u),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(t<0||o==Tn(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return Ml(a.getBoundingClientRect(),!1)}if(s==null&&o<Tn(r)){let a=r.childNodes[o];if(a.nodeType==1)return Ml(a.getBoundingClientRect(),!0)}return Ml(r.getBoundingClientRect(),t>=0)}if(s==null&&o&&(t<0||o==Tn(r))){let a=r.childNodes[o-1],u=a.nodeType==3?$n(a,Tn(a)-(i?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return is(rr(u,1),!1)}if(s==null&&o<Tn(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?a.nodeType==3?$n(a,0,i?0:1):a.nodeType==1?a:null:null;if(u)return is(rr(u,-1),!0)}return is(rr(r.nodeType==3?$n(r):r,-t),t>=0)}function is(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function Ml(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Rm(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function IE(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return Rm(n,e,()=>{let{node:s}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let i=Dm(n,o.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=$n(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<a.length;u++){let d=a[u];if(d.bottom>d.top+1&&(t=="up"?i.top-d.top>(d.bottom-i.top)*2:d.bottom-i.bottom>(i.bottom-d.top)*2))return!1}}return!0})}const ME=/[\u0590-\u08ac]/;function OE(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,i=o==r.parent.content.size,l=n.domSelection();return!ME.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:i:Rm(n,e,()=>{let{focusNode:a,focusOffset:u,anchorNode:d,anchorOffset:f}=n.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),v=m&&!p.contains(m.nodeType==1?m:m.parentNode)||a==m&&u==g;try{l.collapse(d,f),a&&(a!=d||u!=f)&&l.extend&&l.extend(a,u)}catch{}return h!=null&&(l.caretBidiLevel=h),v})}let Af=null,wf=null,Tf=!1;function LE(n,e,t){return Af==e&&wf==t?Tf:(Af=e,wf=t,Tf=t=="up"||t=="down"?IE(n,e,t):OE(n,e,t))}const nn=0,Sf=1,Pr=2,Mn=3;class Ys{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.dirty=nn,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){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,r=this.posAtStart;;t++){let o=this.children[t];if(o==e)return r;r+=o.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,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,i;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(i)+i.size:this.posAtStart}else{let s,i;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(i):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>kt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!0;break}if(s.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let s=this.getDesc(o),i;if(s&&(!t||s.node))if(r&&(i=s.nodeDOM)&&!(i.nodeType==1?i.contains(e.nodeType==1?e:e.parentNode):i==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let s=this.getDesc(o);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let o=this.children[t],s=r+o.size;if(r==e&&s!=r){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(e<s)return o.descAt(e-r-o.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let s=0;r<this.children.length;r++){let i=this.children[r],l=s+i.size;if(l>e||i instanceof Pm){o=e-s;break}s=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof Bm&&s.side>=0;r--);if(t<=0){let s,i=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,i=!1);return s&&t&&i&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?kt(s.dom)+1:0}}else{let s,i=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,i=!1);return s&&i&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?kt(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,s=-1;for(let i=r,l=0;;l++){let a=this.children[l],u=i+a.size;if(o==-1&&e<=u){let d=i+a.border;if(e>=d&&t<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=i;for(let f=l;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){o=kt(h.dom)+1;break}e-=h.size}o==-1&&(o=0)}if(o>-1&&(u>t||l==this.children.length-1)){t=u;for(let d=l+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=kt(f.dom);break}t+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}i=u}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,o=!1){let s=Math.min(e,t),i=Math.max(e,t);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],g=p+m.size;if(s>p&&i<g)return m.setSelection(e-p-m.border,t-p-m.border,r,o);p=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),u=r.getSelection(),d=!1;if((pn||Nt)&&e==t){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
|
|
@@ -8376,7 +8376,7 @@ const of = /* @__PURE__ */ Fu($9), V9 = { class: "fallback" }, U9 = /* @__PURE__
|
|
|
8376
8376
|
acceptedFiles: t.acceptedFiles,
|
|
8377
8377
|
addRemoveLinks: !1,
|
|
8378
8378
|
maxFilesize: 10,
|
|
8379
|
-
maxFiles: t.multiple ?
|
|
8379
|
+
maxFiles: t.multiple ? 10 : 1,
|
|
8380
8380
|
headers: {
|
|
8381
8381
|
RequestVerificationToken: t.token
|
|
8382
8382
|
},
|
|
@@ -59,7 +59,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
59
59
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var T=!0,k=!1,M;return{s:function(){I=O[Symbol.iterator]()},n:function(){var W=I.next();return T=W.done,W},e:function(W){k=!0,M=W},f:function(){try{!T&&I.return!=null&&I.return()}finally{if(k)throw M}}}}function y(O,D){if(O){if(typeof O=="string")return C(O,D);var I=Object.prototype.toString.call(O).slice(8,-1);if(I==="Object"&&O.constructor&&(I=O.constructor.name),I==="Map"||I==="Set")return Array.from(O);if(I==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(I))return C(O,D)}}function C(O,D){(D==null||D>O.length)&&(D=O.length);for(var I=0,L=new Array(D);I<D;I++)L[I]=O[I];return L}var b={url:null,method:"post",withCredentials:!1,timeout:null,parallelUploads:2,uploadMultiple:!1,chunking:!1,forceChunking:!1,chunkSize:2e6,parallelChunkUploads:!1,retryChunks:!1,retryChunksLimit:3,maxFilesize:256,paramName:"file",createImageThumbnails:!0,maxThumbnailFilesize:10,thumbnailWidth:120,thumbnailHeight:120,thumbnailMethod:"crop",resizeWidth:null,resizeHeight:null,resizeMimeType:null,resizeQuality:.8,resizeMethod:"contain",filesizeBase:1e3,maxFiles:null,headers:null,clickable:!0,ignoreHiddenFiles:!0,acceptedFiles:null,acceptedMimeTypes:null,autoProcessQueue:!0,autoQueue:!0,addRemoveLinks:!1,previewsContainer:null,disablePreviews:!1,hiddenInputContainer:"body",capture:null,renameFilename:null,renameFile:null,forceFallback:!1,dictDefaultMessage:"Drop files here to upload",dictFallbackMessage:"Your browser does not support drag'n'drop file uploads.",dictFallbackText:"Please use the fallback form below to upload your files like in the olden days.",dictFileTooBig:"File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB.",dictInvalidFileType:"You can't upload files of this type.",dictResponseError:"Server responded with {{statusCode}} code.",dictCancelUpload:"Cancel upload",dictUploadCanceled:"Upload canceled.",dictCancelUploadConfirmation:"Are you sure you want to cancel this upload?",dictRemoveFile:"Remove file",dictRemoveFileConfirmation:null,dictMaxFilesExceeded:"You can not upload any more files.",dictFileSizeUnits:{tb:"TB",gb:"GB",mb:"MB",kb:"KB",b:"b"},init:function(){},params:function(D,I,L){if(L)return{dzuuid:L.file.upload.uuid,dzchunkindex:L.index,dztotalfilesize:L.file.size,dzchunksize:this.options.chunkSize,dztotalchunkcount:L.file.upload.totalChunkCount,dzchunkbyteoffset:L.index*this.options.chunkSize}},accept:function(D,I){return I()},chunksUploaded:function(D,I){I()},fallback:function(){var D;this.element.className="".concat(this.element.className," dz-browser-not-supported");var I=g(this.element.getElementsByTagName("div"),!0),L;try{for(I.s();!(L=I.n()).done;){var A=L.value;if(/(^| )dz-message($| )/.test(A.className)){D=A,A.className="dz-message";break}}}catch(k){I.e(k)}finally{I.f()}D||(D=z.createElement('<div class="dz-message"><span></span></div>'),this.element.appendChild(D));var T=D.getElementsByTagName("span")[0];return T&&(T.textContent!=null?T.textContent=this.options.dictFallbackMessage:T.innerText!=null&&(T.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(D,I,L,A){var T={srcX:0,srcY:0,srcWidth:D.width,srcHeight:D.height},k=D.width/D.height;I==null&&L==null?(I=T.srcWidth,L=T.srcHeight):I==null?I=L*k:L==null&&(L=I/k),I=Math.min(I,T.srcWidth),L=Math.min(L,T.srcHeight);var M=I/L;if(T.srcWidth>I||T.srcHeight>L)if(A==="crop")k>M?(T.srcHeight=D.height,T.srcWidth=T.srcHeight*M):(T.srcWidth=D.width,T.srcHeight=T.srcWidth/M);else if(A==="contain")k>M?L=I/k:I=L*k;else throw new Error("Unknown resizeMethod '".concat(A,"'"));return T.srcX=(D.width-T.srcWidth)/2,T.srcY=(D.height-T.srcHeight)/2,T.trgWidth=I,T.trgHeight=L,T},transformFile:function(D,I){return(this.options.resizeWidth||this.options.resizeHeight)&&D.type.match(/image.*/)?this.resizeImage(D,this.options.resizeWidth,this.options.resizeHeight,this.options.resizeMethod,I):I(D)},previewTemplate:m,drop:function(D){return this.element.classList.remove("dz-drag-hover")},dragstart:function(D){},dragend:function(D){return this.element.classList.remove("dz-drag-hover")},dragenter:function(D){return this.element.classList.add("dz-drag-hover")},dragover:function(D){return this.element.classList.add("dz-drag-hover")},dragleave:function(D){return this.element.classList.remove("dz-drag-hover")},paste:function(D){},reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(D){var I=this;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer&&!this.options.disablePreviews){D.previewElement=z.createElement(this.options.previewTemplate.trim()),D.previewTemplate=D.previewElement,this.previewsContainer.appendChild(D.previewElement);var L=g(D.previewElement.querySelectorAll("[data-dz-name]"),!0),A;try{for(L.s();!(A=L.n()).done;){var T=A.value;T.textContent=D.name}}catch(S){L.e(S)}finally{L.f()}var k=g(D.previewElement.querySelectorAll("[data-dz-size]"),!0),M;try{for(k.s();!(M=k.n()).done;)T=M.value,T.innerHTML=this.filesize(D.size)}catch(S){k.e(S)}finally{k.f()}this.options.addRemoveLinks&&(D._removeLink=z.createElement('<a class="dz-remove" href="javascript:undefined;" data-dz-remove>'.concat(this.options.dictRemoveFile,"</a>")),D.previewElement.appendChild(D._removeLink));var j=function(_){return _.preventDefault(),_.stopPropagation(),D.status===z.UPLOADING?z.confirm(I.options.dictCancelUploadConfirmation,function(){return I.removeFile(D)}):I.options.dictRemoveFileConfirmation?z.confirm(I.options.dictRemoveFileConfirmation,function(){return I.removeFile(D)}):I.removeFile(D)},W=g(D.previewElement.querySelectorAll("[data-dz-remove]"),!0),Z;try{for(W.s();!(Z=W.n()).done;){var X=Z.value;X.addEventListener("click",j)}}catch(S){W.e(S)}finally{W.f()}}},removedfile:function(D){return D.previewElement!=null&&D.previewElement.parentNode!=null&&D.previewElement.parentNode.removeChild(D.previewElement),this._updateMaxFilesReachedClass()},thumbnail:function(D,I){if(D.previewElement){D.previewElement.classList.remove("dz-file-preview");var L=g(D.previewElement.querySelectorAll("[data-dz-thumbnail]"),!0),A;try{for(L.s();!(A=L.n()).done;){var T=A.value;T.alt=D.name,T.src=I}}catch(k){L.e(k)}finally{L.f()}return setTimeout(function(){return D.previewElement.classList.add("dz-image-preview")},1)}},error:function(D,I){if(D.previewElement){D.previewElement.classList.add("dz-error"),typeof I!="string"&&I.error&&(I=I.error);var L=g(D.previewElement.querySelectorAll("[data-dz-errormessage]"),!0),A;try{for(L.s();!(A=L.n()).done;){var T=A.value;T.textContent=I}}catch(k){L.e(k)}finally{L.f()}}},errormultiple:function(){},processing:function(D){if(D.previewElement&&(D.previewElement.classList.add("dz-processing"),D._removeLink))return D._removeLink.innerHTML=this.options.dictCancelUpload},processingmultiple:function(){},uploadprogress:function(D,I,L){if(D.previewElement){var A=g(D.previewElement.querySelectorAll("[data-dz-uploadprogress]"),!0),T;try{for(A.s();!(T=A.n()).done;){var k=T.value;k.nodeName==="PROGRESS"?k.value=I:k.style.width="".concat(I,"%")}}catch(M){A.e(M)}finally{A.f()}}},totaluploadprogress:function(){},sending:function(){},sendingmultiple:function(){},success:function(D){if(D.previewElement)return D.previewElement.classList.add("dz-success")},successmultiple:function(){},canceled:function(D){return this.emit("error",D,this.options.dictUploadCanceled)},canceledmultiple:function(){},complete:function(D){if(D._removeLink&&(D._removeLink.innerHTML=this.options.dictRemoveFile),D.previewElement)return D.previewElement.classList.add("dz-complete")},completemultiple:function(){},maxfilesexceeded:function(){},maxfilesreached:function(){},queuecomplete:function(){},addedfiles:function(){}},E=b;function v(O){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?v=function(I){return typeof I}:v=function(I){return I&&typeof Symbol=="function"&&I.constructor===Symbol&&I!==Symbol.prototype?"symbol":typeof I},v(O)}function N(O,D){var I;if(typeof Symbol>"u"||O[Symbol.iterator]==null){if(Array.isArray(O)||(I=w(O))||D&&O&&typeof O.length=="number"){I&&(O=I);var L=0,A=function(){};return{s:A,n:function(){return L>=O.length?{done:!0}:{done:!1,value:O[L++]}},e:function(W){throw W},f:A}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
60
60
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var T=!0,k=!1,M;return{s:function(){I=O[Symbol.iterator]()},n:function(){var W=I.next();return T=W.done,W},e:function(W){k=!0,M=W},f:function(){try{!T&&I.return!=null&&I.return()}finally{if(k)throw M}}}}function w(O,D){if(O){if(typeof O=="string")return x(O,D);var I=Object.prototype.toString.call(O).slice(8,-1);if(I==="Object"&&O.constructor&&(I=O.constructor.name),I==="Map"||I==="Set")return Array.from(O);if(I==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(I))return x(O,D)}}function x(O,D){(D==null||D>O.length)&&(D=O.length);for(var I=0,L=new Array(D);I<D;I++)L[I]=O[I];return L}function B(O,D){if(!(O instanceof D))throw new TypeError("Cannot call a class as a function")}function R(O,D){for(var I=0;I<D.length;I++){var L=D[I];L.enumerable=L.enumerable||!1,L.configurable=!0,"value"in L&&(L.writable=!0),Object.defineProperty(O,L.key,L)}}function U(O,D,I){return D&&R(O.prototype,D),I&&R(O,I),O}function $(O,D){if(typeof D!="function"&&D!==null)throw new TypeError("Super expression must either be null or a function");O.prototype=Object.create(D&&D.prototype,{constructor:{value:O,writable:!0,configurable:!0}}),D&&P(O,D)}function P(O,D){return P=Object.setPrototypeOf||function(L,A){return L.__proto__=A,L},P(O,D)}function Y(O){var D=H();return function(){var L=J(O),A;if(D){var T=J(this).constructor;A=Reflect.construct(L,arguments,T)}else A=L.apply(this,arguments);return G(this,A)}}function G(O,D){return D&&(v(D)==="object"||typeof D=="function")?D:K(O)}function K(O){if(O===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return O}function H(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function J(O){return J=Object.setPrototypeOf?Object.getPrototypeOf:function(I){return I.__proto__||Object.getPrototypeOf(I)},J(O)}var z=function(O){$(I,O);var D=Y(I);function I(L,A){var T;B(this,I),T=D.call(this);var k,M;if(T.element=L,T.version=I.version,T.clickableElements=[],T.listeners=[],T.files=[],typeof T.element=="string"&&(T.element=document.querySelector(T.element)),!T.element||T.element.nodeType==null)throw new Error("Invalid dropzone element.");if(T.element.dropzone)throw new Error("Dropzone already attached.");I.instances.push(K(T)),T.element.dropzone=K(T);var j=(M=I.optionsForElement(T.element))!=null?M:{};if(T.options=I.extend({},E,j,A??{}),T.options.previewTemplate=T.options.previewTemplate.replace(/\n*/g,""),T.options.forceFallback||!I.isBrowserSupported())return G(T,T.options.fallback.call(K(T)));if(T.options.url==null&&(T.options.url=T.element.getAttribute("action")),!T.options.url)throw new Error("No URL provided.");if(T.options.acceptedFiles&&T.options.acceptedMimeTypes)throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");if(T.options.uploadMultiple&&T.options.chunking)throw new Error("You cannot set both: uploadMultiple and chunking.");return T.options.acceptedMimeTypes&&(T.options.acceptedFiles=T.options.acceptedMimeTypes,delete T.options.acceptedMimeTypes),T.options.renameFilename!=null&&(T.options.renameFile=function(W){return T.options.renameFilename.call(K(T),W.name,W)}),typeof T.options.method=="string"&&(T.options.method=T.options.method.toUpperCase()),(k=T.getExistingFallback())&&k.parentNode&&k.parentNode.removeChild(k),T.options.previewsContainer!==!1&&(T.options.previewsContainer?T.previewsContainer=I.getElement(T.options.previewsContainer,"previewsContainer"):T.previewsContainer=T.element),T.options.clickable&&(T.options.clickable===!0?T.clickableElements=[T.element]:T.clickableElements=I.getElements(T.options.clickable,"clickable")),T.init(),T}return U(I,[{key:"getAcceptedFiles",value:function(){return this.files.filter(function(A){return A.accepted}).map(function(A){return A})}},{key:"getRejectedFiles",value:function(){return this.files.filter(function(A){return!A.accepted}).map(function(A){return A})}},{key:"getFilesWithStatus",value:function(A){return this.files.filter(function(T){return T.status===A}).map(function(T){return T})}},{key:"getQueuedFiles",value:function(){return this.getFilesWithStatus(I.QUEUED)}},{key:"getUploadingFiles",value:function(){return this.getFilesWithStatus(I.UPLOADING)}},{key:"getAddedFiles",value:function(){return this.getFilesWithStatus(I.ADDED)}},{key:"getActiveFiles",value:function(){return this.files.filter(function(A){return A.status===I.UPLOADING||A.status===I.QUEUED}).map(function(A){return A})}},{key:"init",value:function(){var A=this;if(this.element.tagName==="form"&&this.element.setAttribute("enctype","multipart/form-data"),this.element.classList.contains("dropzone")&&!this.element.querySelector(".dz-message")&&this.element.appendChild(I.createElement('<div class="dz-default dz-message"><button class="dz-button" type="button">'.concat(this.options.dictDefaultMessage,"</button></div>"))),this.clickableElements.length){var T=function X(){A.hiddenFileInput&&A.hiddenFileInput.parentNode.removeChild(A.hiddenFileInput),A.hiddenFileInput=document.createElement("input"),A.hiddenFileInput.setAttribute("type","file"),(A.options.maxFiles===null||A.options.maxFiles>1)&&A.hiddenFileInput.setAttribute("multiple","multiple"),A.hiddenFileInput.className="dz-hidden-input",A.options.acceptedFiles!==null&&A.hiddenFileInput.setAttribute("accept",A.options.acceptedFiles),A.options.capture!==null&&A.hiddenFileInput.setAttribute("capture",A.options.capture),A.hiddenFileInput.setAttribute("tabindex","-1"),A.hiddenFileInput.style.visibility="hidden",A.hiddenFileInput.style.position="absolute",A.hiddenFileInput.style.top="0",A.hiddenFileInput.style.left="0",A.hiddenFileInput.style.height="0",A.hiddenFileInput.style.width="0",I.getElement(A.options.hiddenInputContainer,"hiddenInputContainer").appendChild(A.hiddenFileInput),A.hiddenFileInput.addEventListener("change",function(){var S=A.hiddenFileInput.files;if(S.length){var _=N(S,!0),V;try{for(_.s();!(V=_.n()).done;){var Q=V.value;A.addFile(Q)}}catch(ae){_.e(ae)}finally{_.f()}}A.emit("addedfiles",S),X()})};T()}this.URL=window.URL!==null?window.URL:window.webkitURL;var k=N(this.events,!0),M;try{for(k.s();!(M=k.n()).done;){var j=M.value;this.on(j,this.options[j])}}catch(X){k.e(X)}finally{k.f()}this.on("uploadprogress",function(){return A.updateTotalUploadProgress()}),this.on("removedfile",function(){return A.updateTotalUploadProgress()}),this.on("canceled",function(X){return A.emit("complete",X)}),this.on("complete",function(X){if(A.getAddedFiles().length===0&&A.getUploadingFiles().length===0&&A.getQueuedFiles().length===0)return setTimeout(function(){return A.emit("queuecomplete")},0)});var W=function(S){if(S.dataTransfer.types){for(var _=0;_<S.dataTransfer.types.length;_++)if(S.dataTransfer.types[_]==="Files")return!0}return!1},Z=function(S){if(W(S))return S.stopPropagation(),S.preventDefault?S.preventDefault():S.returnValue=!1};return this.listeners=[{element:this.element,events:{dragstart:function(S){return A.emit("dragstart",S)},dragenter:function(S){return Z(S),A.emit("dragenter",S)},dragover:function(S){var _;try{_=S.dataTransfer.effectAllowed}catch{}return S.dataTransfer.dropEffect=_==="move"||_==="linkMove"?"move":"copy",Z(S),A.emit("dragover",S)},dragleave:function(S){return A.emit("dragleave",S)},drop:function(S){return Z(S),A.drop(S)},dragend:function(S){return A.emit("dragend",S)}}}],this.clickableElements.forEach(function(X){return A.listeners.push({element:X,events:{click:function(_){return(X!==A.element||_.target===A.element||I.elementInside(_.target,A.element.querySelector(".dz-message")))&&A.hiddenFileInput.click(),!0}}})}),this.enable(),this.options.init.call(this)}},{key:"destroy",value:function(){return this.disable(),this.removeAllFiles(!0),this.hiddenFileInput!=null&&this.hiddenFileInput.parentNode&&(this.hiddenFileInput.parentNode.removeChild(this.hiddenFileInput),this.hiddenFileInput=null),delete this.element.dropzone,I.instances.splice(I.instances.indexOf(this),1)}},{key:"updateTotalUploadProgress",value:function(){var A,T=0,k=0,M=this.getActiveFiles();if(M.length){var j=N(this.getActiveFiles(),!0),W;try{for(j.s();!(W=j.n()).done;){var Z=W.value;T+=Z.upload.bytesSent,k+=Z.upload.total}}catch(X){j.e(X)}finally{j.f()}A=100*T/k}else A=100;return this.emit("totaluploadprogress",A,k,T)}},{key:"_getParamName",value:function(A){return typeof this.options.paramName=="function"?this.options.paramName(A):"".concat(this.options.paramName).concat(this.options.uploadMultiple?"[".concat(A,"]"):"")}},{key:"_renameFile",value:function(A){return typeof this.options.renameFile!="function"?A.name:this.options.renameFile(A)}},{key:"getFallbackForm",value:function(){var A,T;if(A=this.getExistingFallback())return A;var k='<div class="dz-fallback">';this.options.dictFallbackText&&(k+="<p>".concat(this.options.dictFallbackText,"</p>")),k+='<input type="file" name="'.concat(this._getParamName(0),'" ').concat(this.options.uploadMultiple?'multiple="multiple"':void 0,' /><input type="submit" value="Upload!"></div>');var M=I.createElement(k);return this.element.tagName!=="FORM"?(T=I.createElement('<form action="'.concat(this.options.url,'" enctype="multipart/form-data" method="').concat(this.options.method,'"></form>')),T.appendChild(M)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),T??M}},{key:"getExistingFallback",value:function(){for(var A=function(Z){var X=N(Z,!0),S;try{for(X.s();!(S=X.n()).done;){var _=S.value;if(/(^| )fallback($| )/.test(_.className))return _}}catch(V){X.e(V)}finally{X.f()}},T=0,k=["div","form"];T<k.length;T++){var M=k[T],j;if(j=A(this.element.getElementsByTagName(M)))return j}}},{key:"setupEventListeners",value:function(){return this.listeners.map(function(A){return function(){var T=[];for(var k in A.events){var M=A.events[k];T.push(A.element.addEventListener(k,M,!1))}return T}()})}},{key:"removeEventListeners",value:function(){return this.listeners.map(function(A){return function(){var T=[];for(var k in A.events){var M=A.events[k];T.push(A.element.removeEventListener(k,M,!1))}return T}()})}},{key:"disable",value:function(){var A=this;return this.clickableElements.forEach(function(T){return T.classList.remove("dz-clickable")}),this.removeEventListeners(),this.disabled=!0,this.files.map(function(T){return A.cancelUpload(T)})}},{key:"enable",value:function(){return delete this.disabled,this.clickableElements.forEach(function(A){return A.classList.add("dz-clickable")}),this.setupEventListeners()}},{key:"filesize",value:function(A){var T=0,k="b";if(A>0){for(var M=["tb","gb","mb","kb","b"],j=0;j<M.length;j++){var W=M[j],Z=Math.pow(this.options.filesizeBase,4-j)/10;if(A>=Z){T=A/Math.pow(this.options.filesizeBase,4-j),k=W;break}}T=Math.round(10*T)/10}return"<strong>".concat(T,"</strong> ").concat(this.options.dictFileSizeUnits[k])}},{key:"_updateMaxFilesReachedClass",value:function(){return this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")}},{key:"drop",value:function(A){if(A.dataTransfer){this.emit("drop",A);for(var T=[],k=0;k<A.dataTransfer.files.length;k++)T[k]=A.dataTransfer.files[k];if(T.length){var M=A.dataTransfer.items;M&&M.length&&M[0].webkitGetAsEntry!=null?this._addFilesFromItems(M):this.handleFiles(T)}this.emit("addedfiles",T)}}},{key:"paste",value:function(A){if(ke(A!=null?A.clipboardData:void 0,function(k){return k.items})!=null){this.emit("paste",A);var T=A.clipboardData.items;if(T.length)return this._addFilesFromItems(T)}}},{key:"handleFiles",value:function(A){var T=N(A,!0),k;try{for(T.s();!(k=T.n()).done;){var M=k.value;this.addFile(M)}}catch(j){T.e(j)}finally{T.f()}}},{key:"_addFilesFromItems",value:function(A){var T=this;return function(){var k=[],M=N(A,!0),j;try{for(M.s();!(j=M.n()).done;){var W=j.value,Z;W.webkitGetAsEntry!=null&&(Z=W.webkitGetAsEntry())?Z.isFile?k.push(T.addFile(W.getAsFile())):Z.isDirectory?k.push(T._addFilesFromDirectory(Z,Z.name)):k.push(void 0):W.getAsFile!=null&&(W.kind==null||W.kind==="file")?k.push(T.addFile(W.getAsFile())):k.push(void 0)}}catch(X){M.e(X)}finally{M.f()}return k}()}},{key:"_addFilesFromDirectory",value:function(A,T){var k=this,M=A.createReader(),j=function(X){return xe(console,"log",function(S){return S.log(X)})},W=function Z(){return M.readEntries(function(X){if(X.length>0){var S=N(X,!0),_;try{for(S.s();!(_=S.n()).done;){var V=_.value;V.isFile?V.file(function(Q){if(!(k.options.ignoreHiddenFiles&&Q.name.substring(0,1)==="."))return Q.fullPath="".concat(T,"/").concat(Q.name),k.addFile(Q)}):V.isDirectory&&k._addFilesFromDirectory(V,"".concat(T,"/").concat(V.name))}}catch(Q){S.e(Q)}finally{S.f()}Z()}return null},j)};return W()}},{key:"accept",value:function(A,T){this.options.maxFilesize&&A.size>this.options.maxFilesize*1024*1024?T(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(A.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):I.isValidFile(A,this.options.acceptedFiles)?this.options.maxFiles!=null&&this.getAcceptedFiles().length>=this.options.maxFiles?(T(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",A)):this.options.accept.call(this,A,T):T(this.options.dictInvalidFileType)}},{key:"addFile",value:function(A){var T=this;A.upload={uuid:I.uuidv4(),progress:0,total:A.size,bytesSent:0,filename:this._renameFile(A)},this.files.push(A),A.status=I.ADDED,this.emit("addedfile",A),this._enqueueThumbnail(A),this.accept(A,function(k){k?(A.accepted=!1,T._errorProcessing([A],k)):(A.accepted=!0,T.options.autoQueue&&T.enqueueFile(A)),T._updateMaxFilesReachedClass()})}},{key:"enqueueFiles",value:function(A){var T=N(A,!0),k;try{for(T.s();!(k=T.n()).done;){var M=k.value;this.enqueueFile(M)}}catch(j){T.e(j)}finally{T.f()}return null}},{key:"enqueueFile",value:function(A){var T=this;if(A.status===I.ADDED&&A.accepted===!0){if(A.status=I.QUEUED,this.options.autoProcessQueue)return setTimeout(function(){return T.processQueue()},0)}else throw new Error("This file can't be queued because it has already been processed or was rejected.")}},{key:"_enqueueThumbnail",value:function(A){var T=this;if(this.options.createImageThumbnails&&A.type.match(/image.*/)&&A.size<=this.options.maxThumbnailFilesize*1024*1024)return this._thumbnailQueue.push(A),setTimeout(function(){return T._processThumbnailQueue()},0)}},{key:"_processThumbnailQueue",value:function(){var A=this;if(!(this._processingThumbnail||this._thumbnailQueue.length===0)){this._processingThumbnail=!0;var T=this._thumbnailQueue.shift();return this.createThumbnail(T,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,!0,function(k){return A.emit("thumbnail",T,k),A._processingThumbnail=!1,A._processThumbnailQueue()})}}},{key:"removeFile",value:function(A){if(A.status===I.UPLOADING&&this.cancelUpload(A),this.files=ee(this.files,A),this.emit("removedfile",A),this.files.length===0)return this.emit("reset")}},{key:"removeAllFiles",value:function(A){A==null&&(A=!1);var T=N(this.files.slice(),!0),k;try{for(T.s();!(k=T.n()).done;){var M=k.value;(M.status!==I.UPLOADING||A)&&this.removeFile(M)}}catch(j){T.e(j)}finally{T.f()}return null}},{key:"resizeImage",value:function(A,T,k,M,j){var W=this;return this.createThumbnail(A,T,k,M,!0,function(Z,X){if(X==null)return j(A);var S=W.options.resizeMimeType;S==null&&(S=A.type);var _=X.toDataURL(S,W.options.resizeQuality);return(S==="image/jpeg"||S==="image/jpg")&&(_=Ee.restore(A.dataURL,_)),j(I.dataURItoBlob(_))})}},{key:"createThumbnail",value:function(A,T,k,M,j,W){var Z=this,X=new FileReader;X.onload=function(){if(A.dataURL=X.result,A.type==="image/svg+xml"){W!=null&&W(X.result);return}Z.createThumbnailFromUrl(A,T,k,M,j,W)},X.readAsDataURL(A)}},{key:"displayExistingFile",value:function(A,T,k,M){var j=this,W=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!0;if(this.emit("addedfile",A),this.emit("complete",A),!W)this.emit("thumbnail",A,T),k&&k();else{var Z=function(S){j.emit("thumbnail",A,S),k&&k()};A.dataURL=T,this.createThumbnailFromUrl(A,this.options.thumbnailWidth,this.options.thumbnailHeight,this.options.thumbnailMethod,this.options.fixOrientation,Z,M)}}},{key:"createThumbnailFromUrl",value:function(A,T,k,M,j,W,Z){var X=this,S=document.createElement("img");return Z&&(S.crossOrigin=Z),j=getComputedStyle(document.body).imageOrientation=="from-image"?!1:j,S.onload=function(){var _=function(Q){return Q(1)};return typeof EXIF<"u"&&EXIF!==null&&j&&(_=function(Q){return EXIF.getData(S,function(){return Q(EXIF.getTag(this,"Orientation"))})}),_(function(V){A.width=S.width,A.height=S.height;var Q=X.options.resize.call(X,A,T,k,M),ae=document.createElement("canvas"),pe=ae.getContext("2d");switch(ae.width=Q.trgWidth,ae.height=Q.trgHeight,V>4&&(ae.width=Q.trgHeight,ae.height=Q.trgWidth),V){case 2:pe.translate(ae.width,0),pe.scale(-1,1);break;case 3:pe.translate(ae.width,ae.height),pe.rotate(Math.PI);break;case 4:pe.translate(0,ae.height),pe.scale(1,-1);break;case 5:pe.rotate(.5*Math.PI),pe.scale(1,-1);break;case 6:pe.rotate(.5*Math.PI),pe.translate(0,-ae.width);break;case 7:pe.rotate(.5*Math.PI),pe.translate(ae.height,-ae.width),pe.scale(-1,1);break;case 8:pe.rotate(-.5*Math.PI),pe.translate(-ae.height,0);break}ge(pe,S,Q.srcX!=null?Q.srcX:0,Q.srcY!=null?Q.srcY:0,Q.srcWidth,Q.srcHeight,Q.trgX!=null?Q.trgX:0,Q.trgY!=null?Q.trgY:0,Q.trgWidth,Q.trgHeight);var Te=ae.toDataURL("image/png");if(W!=null)return W(Te,ae)})},W!=null&&(S.onerror=W),S.src=A.dataURL}},{key:"processQueue",value:function(){var A=this.options.parallelUploads,T=this.getUploadingFiles().length,k=T;if(!(T>=A)){var M=this.getQueuedFiles();if(M.length>0){if(this.options.uploadMultiple)return this.processFiles(M.slice(0,A-T));for(;k<A;){if(!M.length)return;this.processFile(M.shift()),k++}}}}},{key:"processFile",value:function(A){return this.processFiles([A])}},{key:"processFiles",value:function(A){var T=N(A,!0),k;try{for(T.s();!(k=T.n()).done;){var M=k.value;M.processing=!0,M.status=I.UPLOADING,this.emit("processing",M)}}catch(j){T.e(j)}finally{T.f()}return this.options.uploadMultiple&&this.emit("processingmultiple",A),this.uploadFiles(A)}},{key:"_getFilesWithXhr",value:function(A){return this.files.filter(function(T){return T.xhr===A}).map(function(T){return T})}},{key:"cancelUpload",value:function(A){if(A.status===I.UPLOADING){var T=this._getFilesWithXhr(A.xhr),k=N(T,!0),M;try{for(k.s();!(M=k.n()).done;){var j=M.value;j.status=I.CANCELED}}catch(S){k.e(S)}finally{k.f()}typeof A.xhr<"u"&&A.xhr.abort();var W=N(T,!0),Z;try{for(W.s();!(Z=W.n()).done;){var X=Z.value;this.emit("canceled",X)}}catch(S){W.e(S)}finally{W.f()}this.options.uploadMultiple&&this.emit("canceledmultiple",T)}else(A.status===I.ADDED||A.status===I.QUEUED)&&(A.status=I.CANCELED,this.emit("canceled",A),this.options.uploadMultiple&&this.emit("canceledmultiple",[A]));if(this.options.autoProcessQueue)return this.processQueue()}},{key:"resolveOption",value:function(A){if(typeof A=="function"){for(var T=arguments.length,k=new Array(T>1?T-1:0),M=1;M<T;M++)k[M-1]=arguments[M];return A.apply(this,k)}return A}},{key:"uploadFile",value:function(A){return this.uploadFiles([A])}},{key:"uploadFiles",value:function(A){var T=this;this._transformFiles(A,function(k){if(T.options.chunking){var M=k[0];A[0].upload.chunked=T.options.chunking&&(T.options.forceChunking||M.size>T.options.chunkSize),A[0].upload.totalChunkCount=Math.ceil(M.size/T.options.chunkSize)}if(A[0].upload.chunked){var j=A[0],W=k[0];j.upload.chunks=[];var Z=function(){for(var Q=0;j.upload.chunks[Q]!==void 0;)Q++;if(!(Q>=j.upload.totalChunkCount)){var ae=Q*T.options.chunkSize,pe=Math.min(ae+T.options.chunkSize,W.size),Te={name:T._getParamName(0),data:W.webkitSlice?W.webkitSlice(ae,pe):W.slice(ae,pe),filename:j.upload.filename,chunkIndex:Q};j.upload.chunks[Q]={file:j,index:Q,dataBlock:Te,status:I.UPLOADING,progress:0,retries:0},T._uploadData(A,[Te])}};if(j.upload.finishedChunkUpload=function(V,Q){var ae=!0;V.status=I.SUCCESS,V.dataBlock=null,V.xhr=null;for(var pe=0;pe<j.upload.totalChunkCount;pe++){if(j.upload.chunks[pe]===void 0)return Z();j.upload.chunks[pe].status!==I.SUCCESS&&(ae=!1)}ae&&T.options.chunksUploaded(j,function(){T._finished(A,Q,null)})},T.options.parallelChunkUploads)for(var X=0;X<j.upload.totalChunkCount;X++)Z();else Z()}else{for(var S=[],_=0;_<A.length;_++)S[_]={name:T._getParamName(_),data:k[_],filename:A[_].upload.filename};T._uploadData(A,S)}})}},{key:"_getChunk",value:function(A,T){for(var k=0;k<A.upload.totalChunkCount;k++)if(A.upload.chunks[k]!==void 0&&A.upload.chunks[k].xhr===T)return A.upload.chunks[k]}},{key:"_uploadData",value:function(A,T){var k=this,M=new XMLHttpRequest,j=N(A,!0),W;try{for(j.s();!(W=j.n()).done;){var Z=W.value;Z.xhr=M}}catch(me){j.e(me)}finally{j.f()}A[0].upload.chunked&&(A[0].upload.chunks[T[0].chunkIndex].xhr=M);var X=this.resolveOption(this.options.method,A),S=this.resolveOption(this.options.url,A);M.open(X,S,!0);var _=this.resolveOption(this.options.timeout,A);_&&(M.timeout=this.resolveOption(this.options.timeout,A)),M.withCredentials=!!this.options.withCredentials,M.onload=function(me){k._finishedUploading(A,M,me)},M.ontimeout=function(){k._handleUploadError(A,M,"Request timedout after ".concat(k.options.timeout/1e3," seconds"))},M.onerror=function(){k._handleUploadError(A,M)};var V=M.upload!=null?M.upload:M;V.onprogress=function(me){return k._updateFilesUploadProgress(A,M,me)};var Q={Accept:"application/json","Cache-Control":"no-cache","X-Requested-With":"XMLHttpRequest"};this.options.headers&&I.extend(Q,this.options.headers);for(var ae in Q){var pe=Q[ae];pe&&M.setRequestHeader(ae,pe)}var Te=new FormData;if(this.options.params){var q=this.options.params;typeof q=="function"&&(q=q.call(this,A,M,A[0].upload.chunked?this._getChunk(A[0],M):null));for(var ie in q){var be=q[ie];if(Array.isArray(be))for(var Pe=0;Pe<be.length;Pe++)Te.append(ie,be[Pe]);else Te.append(ie,be)}}var qe=N(A,!0),nt;try{for(qe.s();!(nt=qe.n()).done;){var Mt=nt.value;this.emit("sending",Mt,M,Te)}}catch(me){qe.e(me)}finally{qe.f()}this.options.uploadMultiple&&this.emit("sendingmultiple",A,M,Te),this._addFormElementData(Te);for(var te=0;te<T.length;te++){var ye=T[te];Te.append(ye.name,ye.data,ye.filename)}this.submitRequest(M,Te,A)}},{key:"_transformFiles",value:function(A,T){for(var k=this,M=[],j=0,W=function(S){k.options.transformFile.call(k,A[S],function(_){M[S]=_,++j===A.length&&T(M)})},Z=0;Z<A.length;Z++)W(Z)}},{key:"_addFormElementData",value:function(A){if(this.element.tagName==="FORM"){var T=N(this.element.querySelectorAll("input, textarea, select, button"),!0),k;try{for(T.s();!(k=T.n()).done;){var M=k.value,j=M.getAttribute("name"),W=M.getAttribute("type");if(W&&(W=W.toLowerCase()),!(typeof j>"u"||j===null))if(M.tagName==="SELECT"&&M.hasAttribute("multiple")){var Z=N(M.options,!0),X;try{for(Z.s();!(X=Z.n()).done;){var S=X.value;S.selected&&A.append(j,S.value)}}catch(_){Z.e(_)}finally{Z.f()}}else(!W||W!=="checkbox"&&W!=="radio"||M.checked)&&A.append(j,M.value)}}catch(_){T.e(_)}finally{T.f()}}}},{key:"_updateFilesUploadProgress",value:function(A,T,k){if(A[0].upload.chunked){var Z=A[0],X=this._getChunk(Z,T);k?(X.progress=100*k.loaded/k.total,X.total=k.total,X.bytesSent=k.loaded):(X.progress=100,X.bytesSent=X.total),Z.upload.progress=0,Z.upload.total=0,Z.upload.bytesSent=0;for(var S=0;S<Z.upload.totalChunkCount;S++)Z.upload.chunks[S]&&typeof Z.upload.chunks[S].progress<"u"&&(Z.upload.progress+=Z.upload.chunks[S].progress,Z.upload.total+=Z.upload.chunks[S].total,Z.upload.bytesSent+=Z.upload.chunks[S].bytesSent);Z.upload.progress=Z.upload.progress/Z.upload.totalChunkCount,this.emit("uploadprogress",Z,Z.upload.progress,Z.upload.bytesSent)}else{var M=N(A,!0),j;try{for(M.s();!(j=M.n()).done;){var W=j.value;W.upload.total&&W.upload.bytesSent&&W.upload.bytesSent==W.upload.total||(k?(W.upload.progress=100*k.loaded/k.total,W.upload.total=k.total,W.upload.bytesSent=k.loaded):(W.upload.progress=100,W.upload.bytesSent=W.upload.total),this.emit("uploadprogress",W,W.upload.progress,W.upload.bytesSent))}}catch(_){M.e(_)}finally{M.f()}}}},{key:"_finishedUploading",value:function(A,T,k){var M;if(A[0].status!==I.CANCELED&&T.readyState===4){if(T.responseType!=="arraybuffer"&&T.responseType!=="blob"&&(M=T.responseText,T.getResponseHeader("content-type")&&~T.getResponseHeader("content-type").indexOf("application/json")))try{M=JSON.parse(M)}catch(j){k=j,M="Invalid JSON response from server."}this._updateFilesUploadProgress(A,T),200<=T.status&&T.status<300?A[0].upload.chunked?A[0].upload.finishedChunkUpload(this._getChunk(A[0],T),M):this._finished(A,M,k):this._handleUploadError(A,T,M)}}},{key:"_handleUploadError",value:function(A,T,k){if(A[0].status!==I.CANCELED){if(A[0].upload.chunked&&this.options.retryChunks){var M=this._getChunk(A[0],T);if(M.retries++<this.options.retryChunksLimit){this._uploadData(A,[M.dataBlock]);return}else console.warn("Retried this chunk too often. Giving up.")}this._errorProcessing(A,k||this.options.dictResponseError.replace("{{statusCode}}",T.status),T)}}},{key:"submitRequest",value:function(A,T,k){if(A.readyState!=1){console.warn("Cannot send this request because the XMLHttpRequest.readyState is not OPENED.");return}A.send(T)}},{key:"_finished",value:function(A,T,k){var M=N(A,!0),j;try{for(M.s();!(j=M.n()).done;){var W=j.value;W.status=I.SUCCESS,this.emit("success",W,T,k),this.emit("complete",W)}}catch(Z){M.e(Z)}finally{M.f()}if(this.options.uploadMultiple&&(this.emit("successmultiple",A,T,k),this.emit("completemultiple",A)),this.options.autoProcessQueue)return this.processQueue()}},{key:"_errorProcessing",value:function(A,T,k){var M=N(A,!0),j;try{for(M.s();!(j=M.n()).done;){var W=j.value;W.status=I.ERROR,this.emit("error",W,T,k),this.emit("complete",W)}}catch(Z){M.e(Z)}finally{M.f()}if(this.options.uploadMultiple&&(this.emit("errormultiple",A,T,k),this.emit("completemultiple",A)),this.options.autoProcessQueue)return this.processQueue()}}],[{key:"initClass",value:function(){this.prototype.Emitter=h,this.prototype.events=["drop","dragstart","dragend","dragenter","dragover","dragleave","addedfile","addedfiles","removedfile","thumbnail","error","errormultiple","processing","processingmultiple","uploadprogress","totaluploadprogress","sending","sendingmultiple","success","successmultiple","canceled","canceledmultiple","complete","completemultiple","reset","maxfilesexceeded","maxfilesreached","queuecomplete"],this.prototype._thumbnailQueue=[],this.prototype._processingThumbnail=!1}},{key:"extend",value:function(A){for(var T=arguments.length,k=new Array(T>1?T-1:0),M=1;M<T;M++)k[M-1]=arguments[M];for(var j=0,W=k;j<W.length;j++){var Z=W[j];for(var X in Z){var S=Z[X];A[X]=S}}return A}},{key:"uuidv4",value:function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(A){var T=Math.random()*16|0,k=A==="x"?T:T&3|8;return k.toString(16)})}}]),I}(h);z.initClass(),z.version="5.9.3",z.options={},z.optionsForElement=function(O){if(O.getAttribute("id"))return z.options[re(O.getAttribute("id"))]},z.instances=[],z.forElement=function(O){if(typeof O=="string"&&(O=document.querySelector(O)),(O!=null?O.dropzone:void 0)==null)throw new Error("No Dropzone found for given element. This is probably because you're trying to access it before Dropzone had the time to initialize. Use the `init` option to setup any additional observers on your Dropzone.");return O.dropzone},z.autoDiscover=!0,z.discover=function(){var O;if(document.querySelectorAll)O=document.querySelectorAll(".dropzone");else{O=[];var D=function(L){return function(){var A=[],T=N(L,!0),k;try{for(T.s();!(k=T.n()).done;){var M=k.value;/(^| )dropzone($| )/.test(M.className)?A.push(O.push(M)):A.push(void 0)}}catch(j){T.e(j)}finally{T.f()}return A}()};D(document.getElementsByTagName("div")),D(document.getElementsByTagName("form"))}return function(){var I=[],L=N(O,!0),A;try{for(L.s();!(A=L.n()).done;){var T=A.value;z.optionsForElement(T)!==!1?I.push(new z(T)):I.push(void 0)}}catch(k){L.e(k)}finally{L.f()}return I}()},z.blockedBrowsers=[/opera.*(Macintosh|Windows Phone).*version\/12/i],z.isBrowserSupported=function(){var O=!0;if(window.File&&window.FileReader&&window.FileList&&window.Blob&&window.FormData&&document.querySelector)if(!("classList"in document.createElement("a")))O=!1;else{z.blacklistedBrowsers!==void 0&&(z.blockedBrowsers=z.blacklistedBrowsers);var D=N(z.blockedBrowsers,!0),I;try{for(D.s();!(I=D.n()).done;){var L=I.value;if(L.test(navigator.userAgent)){O=!1;continue}}}catch(A){D.e(A)}finally{D.f()}}else O=!1;return O},z.dataURItoBlob=function(O){for(var D=atob(O.split(",")[1]),I=O.split(",")[0].split(":")[1].split(";")[0],L=new ArrayBuffer(D.length),A=new Uint8Array(L),T=0,k=D.length,M=0<=k;M?T<=k:T>=k;M?T++:T--)A[T]=D.charCodeAt(T);return new Blob([L],{type:I})};var ee=function(D,I){return D.filter(function(L){return L!==I}).map(function(L){return L})},re=function(D){return D.replace(/[\-_](\w)/g,function(I){return I.charAt(1).toUpperCase()})};z.createElement=function(O){var D=document.createElement("div");return D.innerHTML=O,D.childNodes[0]},z.elementInside=function(O,D){if(O===D)return!0;for(;O=O.parentNode;)if(O===D)return!0;return!1},z.getElement=function(O,D){var I;if(typeof O=="string"?I=document.querySelector(O):O.nodeType!=null&&(I=O),I==null)throw new Error("Invalid `".concat(D,"` option provided. Please provide a CSS selector or a plain HTML element."));return I},z.getElements=function(O,D){var I,L;if(O instanceof Array){L=[];try{var A=N(O,!0),T;try{for(A.s();!(T=A.n()).done;)I=T.value,L.push(this.getElement(I,D))}catch(j){A.e(j)}finally{A.f()}}catch{L=null}}else if(typeof O=="string"){L=[];var k=N(document.querySelectorAll(O),!0),M;try{for(k.s();!(M=k.n()).done;)I=M.value,L.push(I)}catch(j){k.e(j)}finally{k.f()}}else O.nodeType!=null&&(L=[O]);if(L==null||!L.length)throw new Error("Invalid `".concat(D,"` option provided. Please provide a CSS selector, a plain HTML element or a list of those."));return L},z.confirm=function(O,D,I){if(window.confirm(O))return D();if(I!=null)return I()},z.isValidFile=function(O,D){if(!D)return!0;D=D.split(",");var I=O.type,L=I.replace(/\/.*$/,""),A=N(D,!0),T;try{for(A.s();!(T=A.n()).done;){var k=T.value;if(k=k.trim(),k.charAt(0)==="."){if(O.name.toLowerCase().indexOf(k.toLowerCase(),O.name.length-k.length)!==-1)return!0}else if(/\/\*$/.test(k)){if(L===k.replace(/\/.*$/,""))return!0}else if(I===k)return!0}}catch(M){A.e(M)}finally{A.f()}return!1},typeof jQuery<"u"&&jQuery!==null&&(jQuery.fn.dropzone=function(O){return this.each(function(){return new z(this,O)})}),z.ADDED="added",z.QUEUED="queued",z.ACCEPTED=z.QUEUED,z.UPLOADING="uploading",z.PROCESSING=z.UPLOADING,z.CANCELED="canceled",z.ERROR="error",z.SUCCESS="success";var ue=function(D){D.naturalWidth;var I=D.naturalHeight,L=document.createElement("canvas");L.width=1,L.height=I;var A=L.getContext("2d");A.drawImage(D,0,0);for(var T=A.getImageData(1,0,1,I),k=T.data,M=0,j=I,W=I;W>M;){var Z=k[(W-1)*4+3];Z===0?j=W:M=W,W=j+M>>1}var X=W/I;return X===0?1:X},ge=function(D,I,L,A,T,k,M,j,W,Z){var X=ue(I);return D.drawImage(I,L,A,T,k,M,j,W,Z/X)},Ee=function(){function O(){B(this,O)}return U(O,null,[{key:"initClass",value:function(){this.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}},{key:"encode64",value:function(I){for(var L="",A=void 0,T=void 0,k="",M=void 0,j=void 0,W=void 0,Z="",X=0;A=I[X++],T=I[X++],k=I[X++],M=A>>2,j=(A&3)<<4|T>>4,W=(T&15)<<2|k>>6,Z=k&63,isNaN(T)?W=Z=64:isNaN(k)&&(Z=64),L=L+this.KEY_STR.charAt(M)+this.KEY_STR.charAt(j)+this.KEY_STR.charAt(W)+this.KEY_STR.charAt(Z),A=T=k="",M=j=W=Z="",X<I.length;);return L}},{key:"restore",value:function(I,L){if(!I.match("data:image/jpeg;base64,"))return L;var A=this.decode64(I.replace("data:image/jpeg;base64,","")),T=this.slice2Segments(A),k=this.exifManipulation(L,T);return"data:image/jpeg;base64,".concat(this.encode64(k))}},{key:"exifManipulation",value:function(I,L){var A=this.getExifArray(L),T=this.insertExif(I,A),k=new Uint8Array(T);return k}},{key:"getExifArray",value:function(I){for(var L=void 0,A=0;A<I.length;){if(L=I[A],L[0]===255&L[1]===225)return L;A++}return[]}},{key:"insertExif",value:function(I,L){var A=I.replace("data:image/jpeg;base64,",""),T=this.decode64(A),k=T.indexOf(255,3),M=T.slice(0,k),j=T.slice(k),W=M;return W=W.concat(L),W=W.concat(j),W}},{key:"slice2Segments",value:function(I){for(var L=0,A=[];;){var T;if(I[L]===255&I[L+1]===218)break;if(I[L]===255&I[L+1]===216)L+=2;else{T=I[L+2]*256+I[L+3];var k=L+T+2,M=I.slice(L,k);A.push(M),L=k}if(L>I.length)break}return A}},{key:"decode64",value:function(I){var L=void 0,A=void 0,T="",k=void 0,M=void 0,j=void 0,W="",Z=0,X=[],S=/[^A-Za-z0-9\+\/\=]/g;for(S.exec(I)&&console.warn(`There were invalid base64 characters in the input text.
|
|
61
61
|
Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='
|
|
62
|
-
Expect errors in decoding.`),I=I.replace(/[^A-Za-z0-9\+\/\=]/g,"");k=this.KEY_STR.indexOf(I.charAt(Z++)),M=this.KEY_STR.indexOf(I.charAt(Z++)),j=this.KEY_STR.indexOf(I.charAt(Z++)),W=this.KEY_STR.indexOf(I.charAt(Z++)),L=k<<2|M>>4,A=(M&15)<<4|j>>2,T=(j&3)<<6|W,X.push(L),j!==64&&X.push(A),W!==64&&X.push(T),L=A=T="",k=M=j=W="",Z<I.length;);return X}}]),O}();Ee.initClass();var Se=function(D,I){var L=!1,A=!0,T=D.document,k=T.documentElement,M=T.addEventListener?"addEventListener":"attachEvent",j=T.addEventListener?"removeEventListener":"detachEvent",W=T.addEventListener?"":"on",Z=function S(_){if(!(_.type==="readystatechange"&&T.readyState!=="complete")&&((_.type==="load"?D:T)[j](W+_.type,S,!1),!L&&(L=!0)))return I.call(D,_.type||_)},X=function S(){try{k.doScroll("left")}catch{setTimeout(S,50);return}return Z("poll")};if(T.readyState!=="complete"){if(T.createEventObject&&k.doScroll){try{A=!D.frameElement}catch{}A&&X()}return T[M](W+"DOMContentLoaded",Z,!1),T[M](W+"readystatechange",Z,!1),D[M](W+"load",Z,!1)}};z._autoDiscoverFunction=function(){if(z.autoDiscover)return z.discover()},Se(window,z._autoDiscoverFunction);function ke(O,D){return typeof O<"u"&&O!==null?D(O):void 0}function xe(O,D,I){if(typeof O<"u"&&O!==null&&typeof O[D]=="function")return I(O,D)}window.Dropzone=z;var Ae=z}(),s}()})})(Yf);var Iy=Yf.exports;const Gf=zl(Iy),xy={class:"fallback"},My=c.createElementVNode("input",{id:"file",type:"file",name:"file",multiple:""},null,-1),Oy={for:"file"},Ly={class:"dz-message","data-dz-message":""},Dy={id:"bd-dropzone-theme",style:{display:"none"}},Ry={class:"dz-preview dz-file-preview"},By={class:"dz-details"},Py=c.createElementVNode("img",{"data-dz-thumbnail":"",class:"dz-image"},null,-1),Fy=c.createElementVNode("div",{class:"dz-filename"},[c.createElementVNode("small",{"data-dz-name":""})],-1),Vy=c.createElementVNode("div",{class:"dz-progress"},[c.createElementVNode("div",{class:"spinner-border text-primary spinner-border-sm",role:"status"},[c.createElementVNode("span",{class:"visually-hidden"},"Loading...")])],-1),$y={class:"dz-success-mark"},Uy={class:"dz-error-message text-danger"},zy=c.createElementVNode("small",{"data-dz-errormessage":""},null,-1),Hl=c.defineComponent({__name:"BDDropzone",props:{modelValue:{default:[]},buttonText:{default:void 0},multiple:{type:Boolean,default:!1},errorMessage:{default:void 0},fileSizeExceededMessage:{default:void 0},acceptedFiles:{default:".jpg"},url:{default:""},tag:{default:"form"},token:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=c.computed(()=>({variant:li.PRIMARY,size:At.SM})),o=Dr(t,"modelValue",e);let s=null;Gf.autoDiscover=!1,c.watch(()=>t.modelValue,()=>{i()}),c.onMounted(()=>{document.getElementById("dropzone")&&l()});const i=()=>{s&&(s.destroy(),l())},l=()=>{var p;s=new Gf("#dropzone",{url:t.url,method:"post",acceptedFiles:t.acceptedFiles,addRemoveLinks:!1,maxFilesize:10,maxFiles:t.multiple?3:1,headers:{RequestVerificationToken:t.token},dictResponseError:t.errorMessage,dictFileTooBig:t.fileSizeExceededMessage,previewTemplate:(p=document.querySelector("#bd-dropzone-theme"))==null?void 0:p.innerHTML}),s.on("error",u),s.on("success",a),s.on("removedfile",f)},a=function(p,m){var g;o.value.push({UUID:(g=p.upload)==null?void 0:g.uuid,CorrelationId:m.CorrelationId,Naam:m.Naam}),d(p)},u=function(p){d(p)},d=function(p){const m=p.name;if(!(m.endsWith(".png")||m.endsWith(".jpg")||m.endsWith(".jpeg")||m.endsWith(".gif"))){const g=p.previewElement.getElementsByClassName("icon-file"),y=p.previewElement.getElementsByClassName("dz-image");g[0].classList.remove("d-none"),y[0].classList.add("d-none")}},f=function(p){const m=o.value.findIndex(g=>{var y;return(g==null?void 0:g.UUID)===((y=p.upload)==null?void 0:y.uuid)});m!==-1&&o.value.splice(m,1)},h=c.computed(()=>t.tag??"form");return(p,m)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(h.value),{id:"dropzone",class:"dropzone bd-dropzone",enctype:"multipart/form-data"},{default:c.withCtx(()=>[c.createElementVNode("div",xy,[My,c.createTextVNode(" test "),c.createElementVNode("label",Oy,[c.createVNode(c.unref(Or)),c.createTextVNode(" "+c.toDisplayString(t.buttonText),1)])]),c.createElementVNode("div",Ly,[c.createVNode(Ze,c.normalizeProps(c.guardReactiveProps(r.value)),{default:c.withCtx(()=>[c.createVNode(c.unref(Or)),c.createTextVNode(" "+c.toDisplayString(t.buttonText),1)]),_:1},16)])]),_:1})),c.createElementVNode("div",Dy,[c.createElementVNode("div",Ry,[c.createElementVNode("div",By,[Py,c.createVNode(c.unref(_l),{"data-dz-thumbnail":"",class:"d-none"}),Fy,c.createVNode(Ze,{class:"dz-remove",alt:"Click me to remove the file.","data-dz-remove":""},{default:c.withCtx(()=>[c.createVNode(c.unref(ls))]),_:1})]),Vy,c.createElementVNode("div",$y,[c.createVNode(c.unref(uo))]),c.createElementVNode("div",Uy,[c.createVNode(c.unref(ii)),zy])])])],64))}});function ht(n){this.content=n}ht.prototype={constructor:ht,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),s=r.content.slice();return o==-1?s.push(t||n,e):(s[o+1]=e,t&&(s[o]=t)),new ht(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ht(t)},addToStart:function(n,e){return new ht([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ht(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),s=r.find(n);return o.splice(s==-1?o.length:s,0,e,t),new ht(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=ht.from(n),n.size?new ht(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ht.from(n),n.size?new ht(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ht.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},ht.from=function(n){if(n instanceof ht)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ht(e)};function Qf(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),s=e.child(r);if(o==s){t+=o.nodeSize;continue}if(!o.sameMarkup(s))return t;if(o.isText&&o.text!=s.text){for(let i=0;o.text[i]==s.text[i];i++)t++;return t}if(o.content.size||s.content.size){let i=Qf(o.content,s.content,t+1);if(i!=null)return i}t+=o.nodeSize}}function Zf(n,e,t,r){for(let o=n.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:t,b:r};let i=n.child(--o),l=e.child(--s),a=i.nodeSize;if(i==l){t-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:t,b:r};if(i.isText&&i.text!=l.text){let u=0,d=Math.min(i.text.length,l.text.length);for(;u<d&&i.text[i.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,r--;return{a:t,b:r}}if(i.content.size||l.content.size){let u=Zf(i.content,l.content,t-1,r-1);if(u)return u}t-=a,r-=a}}class fe{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,s){for(let i=0,l=0;l<t;i++){let a=this.content[i],u=l+a.nodeSize;if(u>e&&r(a,o+l,s||null,i)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,o+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let s="",i=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(s+=l.text.slice(Math.max(e,a)-a,t-a),i=!r):l.isLeaf?(o?s+=typeof o=="function"?o(l):o:l.type.spec.leafText&&(s+=l.type.spec.leafText(l)),i=!r):!i&&l.isBlock&&(s+=r,i=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new fe(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let s=0,i=0;i<t;s++){let l=this.content[s],a=i+l.nodeSize;a>e&&((i<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,t-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,t-i-1))),r.push(l),o+=l.nodeSize),i=a}return new fe(r,o)}cutByIndex(e,t){return e==t?fe.empty:e==0&&t==this.content.length?this:new fe(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new fe(o,s)}addToStart(e){return new fe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new fe(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 new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return Qf(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Zf(this,e,t,r)}findIndex(e,t=-1){if(e==0)return gi(0,e);if(e==this.size)return gi(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let s=this.child(r),i=o+s.nodeSize;if(i>=e)return i==e||t>0?gi(r+1,i):gi(r,o);o=i}}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 fe.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new fe(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return fe.empty;let t,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(t||(t=e.slice(0,o)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new fe(t||e,r)}static from(e){if(!e)return fe.empty;if(e instanceof fe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new fe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}fe.empty=new fe([],0);const jl={index:0,offset:0};function gi(n,e){return jl.index=n,jl.offset=e,jl}function yi(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!yi(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!yi(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let We=class xd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let s=e[o];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,o));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||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&&yi(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 new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return xd.none;if(e instanceof xd)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};We.none=[];class vi extends Error{}class we{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Xf(this.content,e+this.openStart,t);return r&&new we(r,this.openStart,this.openEnd)}removeBetween(e,t){return new we(Jf(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 we.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new we(fe.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)o++;return new we(e,r,o)}}we.empty=new we(fe.empty,0,0);function Jf(n,e,t){let{index:r,offset:o}=n.findIndex(e),s=n.maybeChild(r),{index:i,offset:l}=n.findIndex(t);if(o==e||s.isText){if(l!=t&&!n.child(i).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=i)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(Jf(s.content,e-o-1,t-o-1)))}function Xf(n,e,t,r){let{index:o,offset:s}=n.findIndex(e),i=n.maybeChild(o);if(s==e||i.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Xf(i.content,e-s-1,t);return l&&n.replaceChild(o,i.copy(l))}function Hy(n,e,t){if(t.openStart>n.depth)throw new vi("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new vi("Inconsistent open depths");return qf(n,e,t,0)}function qf(n,e,t,r){let o=n.index(r),s=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let i=qf(n,e,t,r+1);return s.copy(s.content.replaceChild(o,i))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let i=n.parent,l=i.content;return Fr(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=jy(t,n);return Fr(s,th(n,i,l,e,r))}else return Fr(s,Ei(n,e,r))}function eh(n,e){if(!e.type.compatibleContent(n.type))throw new vi("Cannot join "+e.type.name+" onto "+n.type.name)}function Wl(n,e,t){let r=n.node(t);return eh(r,e.node(t)),r}function Pr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function fs(n,e,t,r){let o=(e||n).node(t),s=0,i=e?e.index(t):o.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Pr(n.nodeAfter,r),s++));for(let l=s;l<i;l++)Pr(o.child(l),r);e&&e.depth==t&&e.textOffset&&Pr(e.nodeBefore,r)}function Fr(n,e){return n.type.checkContent(e),n.copy(e)}function th(n,e,t,r,o){let s=n.depth>o&&Wl(n,e,o+1),i=r.depth>o&&Wl(t,r,o+1),l=[];return fs(null,n,o,l),s&&i&&e.index(o)==t.index(o)?(eh(s,i),Pr(Fr(s,th(n,e,t,r,o+1)),l)):(s&&Pr(Fr(s,Ei(n,e,o+1)),l),fs(e,t,o,l),i&&Pr(Fr(i,Ei(t,r,o+1)),l)),fs(r,null,o,l),new fe(l)}function Ei(n,e,t){let r=[];if(fs(null,n,t,r),n.depth>t){let o=Wl(n,e,t+1);Pr(Fr(o,Ei(n,e,t+1)),r)}return fs(e,null,t,r),new fe(r)}function jy(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)o=e.node(s).copy(fe.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class hs{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?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[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].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 r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}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):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)o+=r.child(s).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return We.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let l=r;r=o,o=l}let s=r.marks;for(var i=0;i<s.length;i++)s[i].type.spec.inclusive===!1&&(!o||!s[i].isInSet(o.marks))&&(s=s[i--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.marks))&&(r=r[s--].removeFromSet(r));return r}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 r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Ci(this,e,r);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 new RangeError("Position "+t+" out of range");let r=[],o=0,s=t;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(s),u=s-a;if(r.push(i,l,o+a),!u||(i=i.child(l),i.isText))break;s=u-1,o+=a+1}return new hs(t,r,s)}static resolveCached(e,t){for(let o=0;o<Kl.length;o++){let s=Kl[o];if(s.pos==t&&s.doc==e)return s}let r=Kl[Yl]=hs.resolve(e,t);return Yl=(Yl+1)%Wy,r}}let Kl=[],Yl=0,Wy=12;class Ci{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}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)}}const Ky=Object.create(null);let Vr=class Md{constructor(e,t,r,o=We.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||fe.empty}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,r,o=0){this.content.nodesBetween(e,t,r,o,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,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}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,r){return this.type==e&&yi(this.attrs,t||e.defaultAttrs||Ky)&&We.sameSet(this.marks,r||We.none)}copy(e=null){return e==this.content?this:new Md(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Md(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return we.empty;let o=this.resolve(e),s=this.resolve(t),i=r?0:o.sharedDepth(t),l=o.start(i),u=o.node(i).content.cut(o.pos-l,s.pos-l);return new we(u,o.depth-i,s.depth-i)}replace(e,t,r){return Hy(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return hs.resolveCached(this,e)}resolveNoCache(e){return hs.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(o=!0),!o)),o}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()+")"),nh(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=fe.empty,o=0,s=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,o,s),l=i&&i.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let s=this.contentMatchAt(e).matchType(r),i=s&&s.matchFragment(this.content,t);return i?i.validEnd:!1}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);let e=We.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!We.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=fe.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,o,r)}};Vr.prototype.text=void 0;class Ai extends Vr{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):nh(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 Ai(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ai(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&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 nh(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class $r{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Yy(e,t);if(r.next==null)return $r.empty;let o=rh(r);r.next&&r.err("Unexpected trailing text");let s=ev(qy(o));return tv(s,r),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}matchFragment(e,t=0,r=e.childCount){let o=this;for(let s=t;o&&s<r;s++)o=o.matchType(e.child(s).type);return o}get inlineContent(){return this.next.length!=0&&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 r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function s(i,l){let a=i.matchFragment(e,r);if(a&&(!t||a.validEnd))return fe.from(l.map(u=>u.createAndFill()));for(let u=0;u<i.next.length;u++){let{type:d,next:f}=i.next[u];if(!(d.isText||d.hasRequiredAttrs())&&o.indexOf(f)==-1){o.push(f);let h=s(f,l.concat(d));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),s=o.match;if(s.matchType(e)){let i=[];for(let l=o;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<s.next.length;i++){let{type:l,next:a}=s.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let s=o+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)s+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return s}).join(`
|
|
62
|
+
Expect errors in decoding.`),I=I.replace(/[^A-Za-z0-9\+\/\=]/g,"");k=this.KEY_STR.indexOf(I.charAt(Z++)),M=this.KEY_STR.indexOf(I.charAt(Z++)),j=this.KEY_STR.indexOf(I.charAt(Z++)),W=this.KEY_STR.indexOf(I.charAt(Z++)),L=k<<2|M>>4,A=(M&15)<<4|j>>2,T=(j&3)<<6|W,X.push(L),j!==64&&X.push(A),W!==64&&X.push(T),L=A=T="",k=M=j=W="",Z<I.length;);return X}}]),O}();Ee.initClass();var Se=function(D,I){var L=!1,A=!0,T=D.document,k=T.documentElement,M=T.addEventListener?"addEventListener":"attachEvent",j=T.addEventListener?"removeEventListener":"detachEvent",W=T.addEventListener?"":"on",Z=function S(_){if(!(_.type==="readystatechange"&&T.readyState!=="complete")&&((_.type==="load"?D:T)[j](W+_.type,S,!1),!L&&(L=!0)))return I.call(D,_.type||_)},X=function S(){try{k.doScroll("left")}catch{setTimeout(S,50);return}return Z("poll")};if(T.readyState!=="complete"){if(T.createEventObject&&k.doScroll){try{A=!D.frameElement}catch{}A&&X()}return T[M](W+"DOMContentLoaded",Z,!1),T[M](W+"readystatechange",Z,!1),D[M](W+"load",Z,!1)}};z._autoDiscoverFunction=function(){if(z.autoDiscover)return z.discover()},Se(window,z._autoDiscoverFunction);function ke(O,D){return typeof O<"u"&&O!==null?D(O):void 0}function xe(O,D,I){if(typeof O<"u"&&O!==null&&typeof O[D]=="function")return I(O,D)}window.Dropzone=z;var Ae=z}(),s}()})})(Yf);var Iy=Yf.exports;const Gf=zl(Iy),xy={class:"fallback"},My=c.createElementVNode("input",{id:"file",type:"file",name:"file",multiple:""},null,-1),Oy={for:"file"},Ly={class:"dz-message","data-dz-message":""},Dy={id:"bd-dropzone-theme",style:{display:"none"}},Ry={class:"dz-preview dz-file-preview"},By={class:"dz-details"},Py=c.createElementVNode("img",{"data-dz-thumbnail":"",class:"dz-image"},null,-1),Fy=c.createElementVNode("div",{class:"dz-filename"},[c.createElementVNode("small",{"data-dz-name":""})],-1),Vy=c.createElementVNode("div",{class:"dz-progress"},[c.createElementVNode("div",{class:"spinner-border text-primary spinner-border-sm",role:"status"},[c.createElementVNode("span",{class:"visually-hidden"},"Loading...")])],-1),$y={class:"dz-success-mark"},Uy={class:"dz-error-message text-danger"},zy=c.createElementVNode("small",{"data-dz-errormessage":""},null,-1),Hl=c.defineComponent({__name:"BDDropzone",props:{modelValue:{default:[]},buttonText:{default:void 0},multiple:{type:Boolean,default:!1},errorMessage:{default:void 0},fileSizeExceededMessage:{default:void 0},acceptedFiles:{default:".jpg"},url:{default:""},tag:{default:"form"},token:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=c.computed(()=>({variant:li.PRIMARY,size:At.SM})),o=Dr(t,"modelValue",e);let s=null;Gf.autoDiscover=!1,c.watch(()=>t.modelValue,()=>{i()}),c.onMounted(()=>{document.getElementById("dropzone")&&l()});const i=()=>{s&&(s.destroy(),l())},l=()=>{var p;s=new Gf("#dropzone",{url:t.url,method:"post",acceptedFiles:t.acceptedFiles,addRemoveLinks:!1,maxFilesize:10,maxFiles:t.multiple?10:1,headers:{RequestVerificationToken:t.token},dictResponseError:t.errorMessage,dictFileTooBig:t.fileSizeExceededMessage,previewTemplate:(p=document.querySelector("#bd-dropzone-theme"))==null?void 0:p.innerHTML}),s.on("error",u),s.on("success",a),s.on("removedfile",f)},a=function(p,m){var g;o.value.push({UUID:(g=p.upload)==null?void 0:g.uuid,CorrelationId:m.CorrelationId,Naam:m.Naam}),d(p)},u=function(p){d(p)},d=function(p){const m=p.name;if(!(m.endsWith(".png")||m.endsWith(".jpg")||m.endsWith(".jpeg")||m.endsWith(".gif"))){const g=p.previewElement.getElementsByClassName("icon-file"),y=p.previewElement.getElementsByClassName("dz-image");g[0].classList.remove("d-none"),y[0].classList.add("d-none")}},f=function(p){const m=o.value.findIndex(g=>{var y;return(g==null?void 0:g.UUID)===((y=p.upload)==null?void 0:y.uuid)});m!==-1&&o.value.splice(m,1)},h=c.computed(()=>t.tag??"form");return(p,m)=>(c.openBlock(),c.createElementBlock(c.Fragment,null,[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(h.value),{id:"dropzone",class:"dropzone bd-dropzone",enctype:"multipart/form-data"},{default:c.withCtx(()=>[c.createElementVNode("div",xy,[My,c.createTextVNode(" test "),c.createElementVNode("label",Oy,[c.createVNode(c.unref(Or)),c.createTextVNode(" "+c.toDisplayString(t.buttonText),1)])]),c.createElementVNode("div",Ly,[c.createVNode(Ze,c.normalizeProps(c.guardReactiveProps(r.value)),{default:c.withCtx(()=>[c.createVNode(c.unref(Or)),c.createTextVNode(" "+c.toDisplayString(t.buttonText),1)]),_:1},16)])]),_:1})),c.createElementVNode("div",Dy,[c.createElementVNode("div",Ry,[c.createElementVNode("div",By,[Py,c.createVNode(c.unref(_l),{"data-dz-thumbnail":"",class:"d-none"}),Fy,c.createVNode(Ze,{class:"dz-remove",alt:"Click me to remove the file.","data-dz-remove":""},{default:c.withCtx(()=>[c.createVNode(c.unref(ls))]),_:1})]),Vy,c.createElementVNode("div",$y,[c.createVNode(c.unref(uo))]),c.createElementVNode("div",Uy,[c.createVNode(c.unref(ii)),zy])])])],64))}});function ht(n){this.content=n}ht.prototype={constructor:ht,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,o=r.find(n),s=r.content.slice();return o==-1?s.push(t||n,e):(s[o+1]=e,t&&(s[o]=t)),new ht(s)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new ht(t)},addToStart:function(n,e){return new ht([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new ht(t)},addBefore:function(n,e,t){var r=this.remove(e),o=r.content.slice(),s=r.find(n);return o.splice(s==-1?o.length:s,0,e,t),new ht(o)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=ht.from(n),n.size?new ht(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ht.from(n),n.size?new ht(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=ht.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},ht.from=function(n){if(n instanceof ht)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new ht(e)};function Qf(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let o=n.child(r),s=e.child(r);if(o==s){t+=o.nodeSize;continue}if(!o.sameMarkup(s))return t;if(o.isText&&o.text!=s.text){for(let i=0;o.text[i]==s.text[i];i++)t++;return t}if(o.content.size||s.content.size){let i=Qf(o.content,s.content,t+1);if(i!=null)return i}t+=o.nodeSize}}function Zf(n,e,t,r){for(let o=n.childCount,s=e.childCount;;){if(o==0||s==0)return o==s?null:{a:t,b:r};let i=n.child(--o),l=e.child(--s),a=i.nodeSize;if(i==l){t-=a,r-=a;continue}if(!i.sameMarkup(l))return{a:t,b:r};if(i.isText&&i.text!=l.text){let u=0,d=Math.min(i.text.length,l.text.length);for(;u<d&&i.text[i.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,r--;return{a:t,b:r}}if(i.content.size||l.content.size){let u=Zf(i.content,l.content,t-1,r-1);if(u)return u}t-=a,r-=a}}class fe{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,o=0,s){for(let i=0,l=0;l<t;i++){let a=this.content[i],u=l+a.nodeSize;if(u>e&&r(a,o+l,s||null,i)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),r,o+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,o){let s="",i=!0;return this.nodesBetween(e,t,(l,a)=>{l.isText?(s+=l.text.slice(Math.max(e,a)-a,t-a),i=!r):l.isLeaf?(o?s+=typeof o=="function"?o(l):o:l.type.spec.leafText&&(s+=l.type.spec.leafText(l)),i=!r):!i&&l.isBlock&&(s+=r,i=!0)},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,o=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(r)&&(o[o.length-1]=t.withText(t.text+r.text),s=1);s<e.content.length;s++)o.push(e.content[s]);return new fe(o,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],o=0;if(t>e)for(let s=0,i=0;i<t;s++){let l=this.content[s],a=i+l.nodeSize;a>e&&((i<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-i),Math.min(l.text.length,t-i)):l=l.cut(Math.max(0,e-i-1),Math.min(l.content.size,t-i-1))),r.push(l),o+=l.nodeSize),i=a}return new fe(r,o)}cutByIndex(e,t){return e==t?fe.empty:e==0&&t==this.content.length?this:new fe(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let o=this.content.slice(),s=this.size+t.nodeSize-r.nodeSize;return o[e]=t,new fe(o,s)}addToStart(e){return new fe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new fe(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 new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let o=this.content[t];e(o,r,t),r+=o.nodeSize}}findDiffStart(e,t=0){return Qf(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Zf(this,e,t,r)}findIndex(e,t=-1){if(e==0)return gi(0,e);if(e==this.size)return gi(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let s=this.child(r),i=o+s.nodeSize;if(i>=e)return i==e||t>0?gi(r+1,i):gi(r,o);o=i}}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 fe.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new fe(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return fe.empty;let t,r=0;for(let o=0;o<e.length;o++){let s=e[o];r+=s.nodeSize,o&&s.isText&&e[o-1].sameMarkup(s)?(t||(t=e.slice(0,o)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new fe(t||e,r)}static from(e){if(!e)return fe.empty;if(e instanceof fe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new fe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}fe.empty=new fe([],0);const jl={index:0,offset:0};function gi(n,e){return jl.index=n,jl.offset=e,jl}function yi(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!yi(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!yi(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let We=class xd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let o=0;o<e.length;o++){let s=e[o];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,o));else{if(s.type.excludes(this.type))return e;!r&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,o)),t.push(this),r=!0),t&&t.push(s)}}return t||(t=e.slice()),r||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&&yi(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 new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);return r.create(t.attrs)}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return xd.none;if(e instanceof xd)return[e];let t=e.slice();return t.sort((r,o)=>r.type.rank-o.type.rank),t}};We.none=[];class vi extends Error{}class we{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Xf(this.content,e+this.openStart,t);return r&&new we(r,this.openStart,this.openEnd)}removeBetween(e,t){return new we(Jf(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 we.empty;let r=t.openStart||0,o=t.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new we(fe.fromJSON(e,t.content),r,o)}static maxOpen(e,t=!0){let r=0,o=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)r++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)o++;return new we(e,r,o)}}we.empty=new we(fe.empty,0,0);function Jf(n,e,t){let{index:r,offset:o}=n.findIndex(e),s=n.maybeChild(r),{index:i,offset:l}=n.findIndex(t);if(o==e||s.isText){if(l!=t&&!n.child(i).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=i)throw new RangeError("Removing non-flat range");return n.replaceChild(r,s.copy(Jf(s.content,e-o-1,t-o-1)))}function Xf(n,e,t,r){let{index:o,offset:s}=n.findIndex(e),i=n.maybeChild(o);if(s==e||i.isText)return r&&!r.canReplace(o,o,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=Xf(i.content,e-s-1,t);return l&&n.replaceChild(o,i.copy(l))}function Hy(n,e,t){if(t.openStart>n.depth)throw new vi("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new vi("Inconsistent open depths");return qf(n,e,t,0)}function qf(n,e,t,r){let o=n.index(r),s=n.node(r);if(o==e.index(r)&&r<n.depth-t.openStart){let i=qf(n,e,t,r+1);return s.copy(s.content.replaceChild(o,i))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let i=n.parent,l=i.content;return Fr(i,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:i,end:l}=jy(t,n);return Fr(s,th(n,i,l,e,r))}else return Fr(s,Ei(n,e,r))}function eh(n,e){if(!e.type.compatibleContent(n.type))throw new vi("Cannot join "+e.type.name+" onto "+n.type.name)}function Wl(n,e,t){let r=n.node(t);return eh(r,e.node(t)),r}function Pr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function fs(n,e,t,r){let o=(e||n).node(t),s=0,i=e?e.index(t):o.childCount;n&&(s=n.index(t),n.depth>t?s++:n.textOffset&&(Pr(n.nodeAfter,r),s++));for(let l=s;l<i;l++)Pr(o.child(l),r);e&&e.depth==t&&e.textOffset&&Pr(e.nodeBefore,r)}function Fr(n,e){return n.type.checkContent(e),n.copy(e)}function th(n,e,t,r,o){let s=n.depth>o&&Wl(n,e,o+1),i=r.depth>o&&Wl(t,r,o+1),l=[];return fs(null,n,o,l),s&&i&&e.index(o)==t.index(o)?(eh(s,i),Pr(Fr(s,th(n,e,t,r,o+1)),l)):(s&&Pr(Fr(s,Ei(n,e,o+1)),l),fs(e,t,o,l),i&&Pr(Fr(i,Ei(t,r,o+1)),l)),fs(r,null,o,l),new fe(l)}function Ei(n,e,t){let r=[];if(fs(null,n,t,r),n.depth>t){let o=Wl(n,e,t+1);Pr(Fr(o,Ei(n,e,t+1)),r)}return fs(e,null,t,r),new fe(r)}function jy(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)o=e.node(s).copy(fe.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}class hs{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?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[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].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 r=this.pos-this.path[this.path.length-1],o=e.child(t);return r?e.child(t).cut(r):o}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):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],o=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)o+=r.child(s).nodeSize;return o}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return We.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),o=e.maybeChild(t);if(!r){let l=r;r=o,o=l}let s=r.marks;for(var i=0;i<s.length;i++)s[i].type.spec.inclusive===!1&&(!o||!s[i].isInSet(o.marks))&&(s=s[i--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,o=e.parent.maybeChild(e.index());for(var s=0;s<r.length;s++)r[s].type.spec.inclusive===!1&&(!o||!r[s].isInSet(o.marks))&&(r=r[s--].removeFromSet(r));return r}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 r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Ci(this,e,r);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 new RangeError("Position "+t+" out of range");let r=[],o=0,s=t;for(let i=e;;){let{index:l,offset:a}=i.content.findIndex(s),u=s-a;if(r.push(i,l,o+a),!u||(i=i.child(l),i.isText))break;s=u-1,o+=a+1}return new hs(t,r,s)}static resolveCached(e,t){for(let o=0;o<Kl.length;o++){let s=Kl[o];if(s.pos==t&&s.doc==e)return s}let r=Kl[Yl]=hs.resolve(e,t);return Yl=(Yl+1)%Wy,r}}let Kl=[],Yl=0,Wy=12;class Ci{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}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)}}const Ky=Object.create(null);let Vr=class Md{constructor(e,t,r,o=We.none){this.type=e,this.attrs=t,this.marks=o,this.content=r||fe.empty}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,r,o=0){this.content.nodesBetween(e,t,r,o,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,"")}textBetween(e,t,r,o){return this.content.textBetween(e,t,r,o)}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,r){return this.type==e&&yi(this.attrs,t||e.defaultAttrs||Ky)&&We.sameSet(this.marks,r||We.none)}copy(e=null){return e==this.content?this:new Md(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Md(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return we.empty;let o=this.resolve(e),s=this.resolve(t),i=r?0:o.sharedDepth(t),l=o.start(i),u=o.node(i).content.cut(o.pos-l,s.pos-l);return new we(u,o.depth-i,s.depth-i)}replace(e,t,r){return Hy(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:o}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(o==e||t.isText)return t;e-=o+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let o=this.content.child(t-1);return{node:o,index:t-1,offset:r-o.nodeSize}}resolve(e){return hs.resolveCached(this,e)}resolveNoCache(e){return hs.resolve(this,e)}rangeHasMark(e,t,r){let o=!1;return t>e&&this.nodesBetween(e,t,s=>(r.isInSet(s.marks)&&(o=!0),!o)),o}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()+")"),nh(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=fe.empty,o=0,s=r.childCount){let i=this.contentMatchAt(e).matchFragment(r,o,s),l=i&&i.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=o;a<s;a++)if(!this.type.allowsMarks(r.child(a).marks))return!1;return!0}canReplaceWith(e,t,r,o){if(o&&!this.type.allowsMarks(o))return!1;let s=this.contentMatchAt(e).matchType(r),i=s&&s.matchFragment(this.content,t);return i?i.validEnd:!1}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);let e=We.none;for(let t=0;t<this.marks.length;t++)e=this.marks[t].addToSet(e);if(!We.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.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(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let o=fe.fromJSON(e,t.content);return e.nodeType(t.type).create(t.attrs,o,r)}};Vr.prototype.text=void 0;class Ai extends Vr{constructor(e,t,r,o){if(super(e,t,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):nh(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 Ai(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ai(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&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 nh(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class $r{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new Yy(e,t);if(r.next==null)return $r.empty;let o=rh(r);r.next&&r.err("Unexpected trailing text");let s=ev(qy(o));return tv(s,r),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}matchFragment(e,t=0,r=e.childCount){let o=this;for(let s=t;o&&s<r;s++)o=o.matchType(e.child(s).type);return o}get inlineContent(){return this.next.length!=0&&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 r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let o=[this];function s(i,l){let a=i.matchFragment(e,r);if(a&&(!t||a.validEnd))return fe.from(l.map(u=>u.createAndFill()));for(let u=0;u<i.next.length;u++){let{type:d,next:f}=i.next[u];if(!(d.isText||d.hasRequiredAttrs())&&o.indexOf(f)==-1){o.push(f);let h=s(f,l.concat(d));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let o=r.shift(),s=o.match;if(s.matchType(e)){let i=[];for(let l=o;l.type;l=l.via)i.push(l.type);return i.reverse()}for(let i=0;i<s.next.length;i++){let{type:l,next:a}=s.next[i];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!o.type||a.validEnd)&&(r.push({match:l.contentMatch,type:l,via:o}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let o=0;o<r.next.length;o++)e.indexOf(r.next[o].next)==-1&&t(r.next[o].next)}return t(this),e.map((r,o)=>{let s=o+(r.validEnd?"*":" ")+" ";for(let i=0;i<r.next.length;i++)s+=(i?", ":"")+r.next[i].type.name+"->"+e.indexOf(r.next[i].next);return s}).join(`
|
|
63
63
|
`)}}$r.empty=new $r(!0);class Yy{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 new SyntaxError(e+" (in content expression '"+this.string+"')")}}function rh(n){let e=[];do e.push(Gy(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function Gy(n){let e=[];do e.push(Qy(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function Qy(n){let e=Xy(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=Zy(n,e);else break;return e}function oh(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function Zy(n,e){let t=oh(n),r=t;return n.eat(",")&&(n.next!="}"?r=oh(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function Jy(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let o=[];for(let s in t){let i=t[s];i.groups.indexOf(e)>-1&&o.push(i)}return o.length==0&&n.err("No node type or group '"+e+"' found"),o}function Xy(n){if(n.eat("(")){let e=rh(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=Jy(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function qy(n){let e=[[]];return o(s(n,0),t()),e;function t(){return e.push([])-1}function r(i,l,a){let u={term:a,to:l};return e[i].push(u),u}function o(i,l){i.forEach(a=>a.to=l)}function s(i,l){if(i.type=="choice")return i.exprs.reduce((a,u)=>a.concat(s(u,l)),[]);if(i.type=="seq")for(let a=0;;a++){let u=s(i.exprs[a],l);if(a==i.exprs.length-1)return u;o(u,l=t())}else if(i.type=="star"){let a=t();return r(l,a),o(s(i.expr,a),a),[r(a)]}else if(i.type=="plus"){let a=t();return o(s(i.expr,l),a),o(s(i.expr,a),a),[r(a)]}else{if(i.type=="opt")return[r(l)].concat(s(i.expr,l));if(i.type=="range"){let a=l;for(let u=0;u<i.min;u++){let d=t();o(s(i.expr,a),d),a=d}if(i.max==-1)o(s(i.expr,a),a);else for(let u=i.min;u<i.max;u++){let d=t();r(a,d),o(s(i.expr,a),d),a=d}return[r(a)]}else{if(i.type=="name")return[r(l,void 0,i.value)];throw new Error("Unknown expr type")}}}}function sh(n,e){return e-n}function ih(n,e){let t=[];return r(e),t.sort(sh);function r(o){let s=n[o];if(s.length==1&&!s[0].term)return r(s[0].to);t.push(o);for(let i=0;i<s.length;i++){let{term:l,to:a}=s[i];!l&&t.indexOf(a)==-1&&r(a)}}}function ev(n){let e=Object.create(null);return t(ih(n,0));function t(r){let o=[];r.forEach(i=>{n[i].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let d=0;d<o.length;d++)o[d][0]==l&&(u=o[d][1]);ih(n,a).forEach(d=>{u||o.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let s=e[r.join(",")]=new $r(r.indexOf(n.length-1)>-1);for(let i=0;i<o.length;i++){let l=o[i][1].sort(sh);s.next.push({type:o[i][0],next:e[l.join(",")]||t(l)})}return s}}function tv(n,e){for(let t=0,r=[n];t<r.length;t++){let o=r[t],s=!o.validEnd,i=[];for(let l=0;l<o.next.length;l++){let{type:a,next:u}=o.next[l];i.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),r.indexOf(u)==-1&&r.push(u)}s&&e.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ah(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function lh(n,e){let t=Object.create(null);for(let r in n){let o=e&&e[r];if(o===void 0){let s=n[r];if(s.hasDefault)o=s.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=o}return t}function ch(n){let e=Object.create(null);if(n)for(let t in n)e[t]=new nv(n[t]);return e}let uh=class jg{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=ch(r.attrs),this.defaultAttrs=ah(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==$r.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}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:lh(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Vr(this,this.computeAttrs(e),fe.from(t),We.setFrom(r))}createChecked(e=null,t,r){return t=fe.from(t),this.checkContent(t),new Vr(this,this.computeAttrs(e),t,We.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=fe.from(t),t.size){let i=this.contentMatch.fillBefore(t);if(!i)return null;t=i.append(t)}let o=this.contentMatch.matchFragment(t),s=o&&o.fillBefore(fe.empty,!0);return s?new Vr(this,e,t.append(s),We.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:We.none:e}static compile(e,t){let r=Object.create(null);e.forEach((s,i)=>r[s]=new jg(s,t,i));let o=t.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let s in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};class nv{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}}class bi{constructor(e,t,r,o){this.name=e,this.rank=t,this.schema=r,this.spec=o,this.attrs=ch(o.attrs),this.excluded=null;let s=ah(this.attrs);this.instance=s?new We(this,s):null}create(e=null){return!e&&this.instance?this.instance:new We(this,lh(this.attrs,e))}static compile(e,t){let r=Object.create(null),o=0;return e.forEach((s,i)=>r[s]=new bi(s,o++,t,i)),r}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]}excludes(e){return this.excluded.indexOf(e)>-1}}class rv{constructor(e){this.cached=Object.create(null);let t=this.spec={};for(let o in e)t[o]=e[o];t.nodes=ht.from(e.nodes),t.marks=ht.from(e.marks||{}),this.nodes=uh.compile(this.spec.nodes,this),this.marks=bi.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let s=this.nodes[o],i=s.spec.content||"",l=s.spec.marks;s.contentMatch=r[i]||(r[i]=$r.parse(i,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.markSet=l=="_"?null:l?dh(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let o in this.marks){let s=this.marks[o],i=s.spec.excludes;s.excluded=i==null?[s]:i==""?[]:dh(this,i.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof uh){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,o)}text(e,t){let r=this.nodes.text;return new Ai(r,r.defaultAttrs,e,We.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeFromJSON(e){return Vr.fromJSON(this,e)}markFromJSON(e){return We.fromJSON(this,e)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function dh(n,e){let t=[];for(let r=0;r<e.length;r++){let o=e[r],s=n.marks[o],i=s;if(s)t.push(s);else for(let l in n.marks){let a=n.marks[l];(o=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(o)>-1)&&t.push(i=a)}if(!i)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}class po{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[],t.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let o=e.nodes[r.node];return o.contentMatch.matchType(o)})}parse(e,t={}){let r=new mh(this,t,!1);return r.addAll(e,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new mh(this,t,!0);return r.addAll(e,t.from,t.to),we.maxOpen(r.finish())}matchTag(e,t,r){for(let o=r?this.tags.indexOf(r)+1:0;o<this.tags.length;o++){let s=this.tags[o];if(iv(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let i=s.getAttrs(e);if(i===!1)continue;s.attrs=i||void 0}return s}}}matchStyle(e,t,r,o){for(let s=o?this.styles.indexOf(o)+1:0;s<this.styles.length;s++){let i=this.styles[s],l=i.style;if(!(l.indexOf(e)!=0||i.context&&!r.matchesContext(i.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(i.getAttrs){let a=i.getAttrs(t);if(a===!1)continue;i.attrs=a||void 0}return i}}}static schemaRules(e){let t=[];function r(o){let s=o.priority==null?50:o.priority,i=0;for(;i<t.length;i++){let l=t[i];if((l.priority==null?50:l.priority)<s)break}t.splice(i,0,o)}for(let o in e.marks){let s=e.marks[o].spec.parseDOM;s&&s.forEach(i=>{r(i=gh(i)),i.mark||i.ignore||i.clearMark||(i.mark=o)})}for(let o in e.nodes){let s=e.nodes[o].spec.parseDOM;s&&s.forEach(i=>{r(i=gh(i)),i.node||i.ignore||i.mark||(i.node=o)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new po(e,po.schemaRules(e)))}}const fh={address:!0,article:!0,aside:!0,blockquote:!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},ov={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},hh={ol:!0,ul:!0},wi=1,Ti=2,ps=4;function ph(n,e,t){return e!=null?(e?wi:0)|(e==="full"?Ti:0):n&&n.whitespace=="pre"?wi|Ti:t&~ps}class Si{constructor(e,t,r,o,s,i,l){this.type=e,this.attrs=t,this.marks=r,this.pendingMarks=o,this.solid=s,this.options=l,this.content=[],this.activeMarks=We.none,this.stashMarks=[],this.match=i||(l&ps?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(fe.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&wi)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let s=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-o[0].length))}}let t=fe.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(fe.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}popFromStashMark(e){for(let t=this.stashMarks.length-1;t>=0;t--)if(e.eq(this.stashMarks[t]))return this.stashMarks.splice(t,1)[0]}applyPending(e){for(let t=0,r=this.pendingMarks;t<r.length;t++){let o=r[t];(this.type?this.type.allowsMarkType(o.type):lv(o.type,e))&&!o.isInSet(this.activeMarks)&&(this.activeMarks=o.addToSet(this.activeMarks),this.pendingMarks=o.removeFromSet(this.pendingMarks))}}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!fh.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class mh{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0;let o=t.topNode,s,i=ph(null,t.preserveWhitespace,0)|(r?ps:0);o?s=new Si(o.type,o.attrs,We.none,We.none,!0,t.topMatch||o.type.contentMatch,i):r?s=new Si(null,null,We.none,We.none,!0,null,i):s=new Si(e.schema.topNodeType,null,We.none,We.none,!0,null,i),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e){e.nodeType==3?this.addTextNode(e):e.nodeType==1&&this.addElement(e)}withStyleRules(e,t){let r=e.getAttribute("style");if(!r)return t();let o=this.readStyles(av(r));if(!o)return;let[s,i]=o,l=this.top;for(let a=0;a<i.length;a++)this.removePendingMark(i[a],l);for(let a=0;a<s.length;a++)this.addPendingMark(s[a]);t();for(let a=0;a<s.length;a++)this.removePendingMark(s[a],l);for(let a=0;a<i.length;a++)this.addPendingMark(i[a])}addTextNode(e){let t=e.nodeValue,r=this.top;if(r.options&Ti||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(t)){if(r.options&wi)r.options&Ti?t=t.replace(/\r\n?/g,`
|
|
64
64
|
`):t=t.replace(/\r?\n|\r/g," ");else if(t=t.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(t)&&this.open==this.nodes.length-1){let o=r.content[r.content.length-1],s=e.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(t=t.slice(1))}t&&this.insertNode(this.parser.schema.text(t)),this.findInText(e)}else this.findInside(e)}addElement(e,t){let r=e.nodeName.toLowerCase(),o;hh.hasOwnProperty(r)&&this.parser.normalizeLists&&sv(e);let s=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(o=this.parser.matchTag(e,this,t));if(s?s.ignore:ov.hasOwnProperty(r))this.findInside(e),this.ignoreFallback(e);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(e=s.skip);let i,l=this.top,a=this.needsBlock;if(fh.hasOwnProperty(r))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),i=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e);return}s&&s.skip?this.addAll(e):this.withStyleRules(e,()=>this.addAll(e)),i&&this.sync(l),this.needsBlock=a}else this.withStyleRules(e,()=>{this.addElementByRule(e,s,s.consuming===!1?o:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
65
65
|
`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let t=We.none,r=We.none;for(let o=0;o<e.length;o+=2)for(let s=void 0;;){let i=this.parser.matchStyle(e[o],e[o+1],this,s);if(!i)break;if(i.ignore)return null;if(i.clearMark?this.top.pendingMarks.concat(this.top.activeMarks).forEach(l=>{i.clearMark(l)&&(r=l.addToSet(r))}):t=this.parser.schema.marks[i.mark].create(i.attrs).addToSet(t),i.consuming===!1)s=i;else break}return[t,r]}addElementByRule(e,t,r){let o,s,i;t.node?(s=this.parser.schema.nodes[t.node],s.isLeaf?this.insertNode(s.create(t.attrs))||this.leafFallback(e):o=this.enter(s,t.attrs||null,t.preserveWhitespace)):(i=this.parser.schema.marks[t.mark].create(t.attrs),this.addPendingMark(i));let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a)}o&&this.sync(l)&&this.open--,i&&this.removePendingMark(i,l)}addAll(e,t,r){let o=t||0;for(let s=t?e.childNodes[t]:e.firstChild,i=r==null?null:e.childNodes[r];s!=i;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s);this.findAtPoint(e,o)}findPlace(e){let t,r;for(let o=this.open;o>=0;o--){let s=this.nodes[o],i=s.findWrapping(e);if(i&&(!t||t.length>i.length)&&(t=i,r=s,!i.length)||s.solid)break}if(!t)return!1;this.sync(r);for(let o=0;o<t.length;o++)this.enterInner(t[o],null,!1);return!0}insertNode(e){if(e.isInline&&this.needsBlock&&!this.top.type){let t=this.textblockFromContext();t&&this.enterInner(t)}if(this.findPlace(e)){this.closeExtra();let t=this.top;t.applyPending(e.type),t.match&&(t.match=t.match.matchType(e.type));let r=t.activeMarks;for(let o=0;o<e.marks.length;o++)(!t.type||t.type.allowsMarkType(e.marks[o].type))&&(r=e.marks[o].addToSet(r));return t.content.push(e.mark(r)),!0}return!1}enter(e,t,r){let o=this.findPlace(e.create(t));return o&&this.enterInner(e,t,!0,r),o}enterInner(e,t=null,r=!1,o){this.closeExtra();let s=this.top;s.applyPending(e),s.match=s.match&&s.match.matchType(e);let i=ph(e,o,s.options);s.options&ps&&s.content.length==0&&(i|=ps),this.nodes.push(new Si(e,t,s.activeMarks,s.pendingMarks,r,null,i)),this.open++}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;return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let o=0;o<this.find.length;o++)this.find[o].pos==null&&e.nodeType==1&&e.contains(this.find[o].node)&&t.compareDocumentPosition(this.find[o].node)&(r?2:4)&&(this.find[o].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("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),s=-(r?r.depth+1:0)+(o?0:1),i=(l,a)=>{for(;l>=0;l--){let u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(i(l-1,a))return!0;return!1}else{let d=a>0||a==0&&o?this.nodes[a].type:r&&a>=s?r.node(a-s).type:null;if(!d||d.name!=u&&d.groups.indexOf(u)==-1)return!1;a--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let t=cv(e,this.top.pendingMarks);t&&this.top.stashMarks.push(t),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,t){for(let r=this.open;r>=0;r--){let o=this.nodes[r];if(o.pendingMarks.lastIndexOf(e)>-1)o.pendingMarks=e.removeFromSet(o.pendingMarks);else{o.activeMarks=e.removeFromSet(o.activeMarks);let i=o.popFromStashMark(e);i&&o.type&&o.type.allowsMarkType(i.type)&&(o.activeMarks=i.addToSet(o.activeMarks))}if(o==t)break}}}function sv(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&hh.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function iv(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function av(n){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,t,r=[];for(;t=e.exec(n);)r.push(t[1],t[2].trim());return r}function gh(n){let e={};for(let t in n)e[t]=n[t];return e}function lv(n,e){let t=e.schema.nodes;for(let r in t){let o=t[r];if(!o.allowsMarkType(n))continue;let s=[],i=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:d}=l.edge(a);if(u==e||s.indexOf(d)<0&&i(d))return!0}};if(i(o.contentMatch))return!0}}function cv(n,e){for(let t=0;t<e.length;t++)if(n.eq(e[t]))return e[t]}class En{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Gl(t).createDocumentFragment());let o=r,s=[];return e.forEach(i=>{if(s.length||i.marks.length){let l=0,a=0;for(;l<s.length&&a<i.marks.length;){let u=i.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(s[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<s.length;)o=s.pop()[1];for(;a<i.marks.length;){let u=i.marks[a++],d=this.serializeMark(u,i.isInline,t);d&&(s.push([u,o]),o.appendChild(d.dom),o=d.contentDOM||d.dom)}}o.appendChild(this.serializeNodeInner(i,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:o}=En.renderSpec(Gl(t),this.nodes[e.type.name](e));if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let o=e.marks.length-1;o>=0;o--){let s=this.serializeMark(e.marks[o],e.isInline,t);s&&((s.contentDOM||s.dom).appendChild(r),r=s.dom)}return r}serializeMark(e,t,r={}){let o=this.marks[e.type.name];return o&&En.renderSpec(Gl(r),o(e,t))}static renderSpec(e,t,r=null){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let o=t[0],s=o.indexOf(" ");s>0&&(r=o.slice(0,s),o=o.slice(s+1));let i,l=r?e.createElementNS(r,o):e.createElement(o),a=t[1],u=1;if(a&&typeof a=="object"&&a.nodeType==null&&!Array.isArray(a)){u=2;for(let d in a)if(a[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),a[d]):l.setAttribute(d,a[d])}}for(let d=u;d<t.length;d++){let f=t[d];if(f===0){if(d<t.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:h,contentDOM:p}=En.renderSpec(e,f,r);if(l.appendChild(h),p){if(i)throw new RangeError("Multiple content holes");i=p}}}return{dom:l,contentDOM:i}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new En(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=yh(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return yh(e.marks)}}function yh(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Gl(n){return n.document||window.document}const vh=65535,Eh=Math.pow(2,16);function uv(n,e){return n+e*Eh}function Ch(n){return n&vh}function dv(n){return(n-(n&vh))/Eh}const Ah=1,bh=2,_i=4,wh=8;class Ql{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&wh)>0}get deletedBefore(){return(this.delInfo&(Ah|_i))>0}get deletedAfter(){return(this.delInfo&(bh|_i))>0}get deletedAcross(){return(this.delInfo&_i)>0}}class $t{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&$t.empty)return $t.empty}recover(e){let t=0,r=Ch(e);if(!this.inverted)for(let o=0;o<r;o++)t+=this.ranges[o*3+2]-this.ranges[o*3+1];return this.ranges[r*3]+t+dv(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let o=0,s=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let u=this.ranges[l+s],d=this.ranges[l+i],f=a+u;if(e<=f){let h=u?e==a?-1:e==f?1:t:t,p=a+o+(h<0?0:d);if(r)return p;let m=e==(t<0?a:f)?null:uv(l/3,e-a),g=e==a?bh:e==f?Ah:_i;return(t<0?e!=a:e!=f)&&(g|=wh),new Ql(p,g,m)}o+=d-u}return r?e+o:new Ql(e+o,0,null)}touches(e,t){let r=0,o=Ch(t),s=this.inverted?2:1,i=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[l+s],d=a+u;if(e<=d&&l==o*3)return!0;r+=this.ranges[l+i]-u}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,s=0;o<this.ranges.length;o+=3){let i=this.ranges[o],l=i-(this.inverted?s:0),a=i+(this.inverted?0:s),u=this.ranges[o+t],d=this.ranges[o+r];e(l,l+u,a,a+d),s+=d-u}}invert(){return new $t(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?$t.empty:new $t(e<0?[0,-e,0]:[0,0,e])}}$t.empty=new $t([]);class ms{constructor(e=[],t,r=0,o=e.length){this.maps=e,this.mirror=t,this.from=r,this.to=o}slice(e=0,t=this.maps.length){return new ms(this.maps,this.mirror,e,t)}copy(){return new ms(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,t){this.to=this.maps.push(e),t!=null&&this.setMirror(this.maps.length-1,t)}appendMapping(e){for(let t=0,r=this.maps.length;t<e.maps.length;t++){let o=e.getMirror(t);this.appendMap(e.maps[t],o!=null&&o<t?r+o: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,r=this.maps.length+e.maps.length;t>=0;t--){let o=e.getMirror(t);this.appendMap(e.maps[t].invert(),o!=null&&o>t?r-o-1:void 0)}}invert(){let e=new ms;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let o=0;for(let s=this.from;s<this.to;s++){let i=this.maps[s],l=i.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this.maps[a].recover(l.recover);continue}}o|=l.delInfo,e=l.pos}return r?e:new Ql(e,o,null)}}const Zl=Object.create(null);class yt{getMap(){return $t.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Zl[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Zl)throw new RangeError("Duplicate use of step JSON ID "+e);return Zl[e]=t,t.prototype.jsonID=e,t}}class ot{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ot(e,null)}static fail(e){return new ot(null,e)}static fromReplace(e,t,r,o){try{return ot.ok(e.replace(t,r,o))}catch(s){if(s instanceof vi)return ot.fail(s.message);throw s}}}function Jl(n,e,t){let r=[];for(let o=0;o<n.childCount;o++){let s=n.child(o);s.content.size&&(s=s.copy(Jl(s.content,e,s))),s.isInline&&(s=e(s,t,o)),r.push(s)}return fe.fromArray(r)}class qn extends yt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),s=new we(Jl(t.content,(i,l)=>!i.isAtom||!l.type.allowsMarkType(this.mark.type)?i:i.mark(this.mark.addToSet(i.marks)),o),t.openStart,t.openEnd);return ot.fromReplace(e,this.from,this.to,s)}invert(){return new Cn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new qn(t.pos,r.pos,this.mark)}merge(e){return e instanceof qn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qn(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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new qn(t.from,t.to,e.markFromJSON(t.mark))}}yt.jsonID("addMark",qn);class Cn extends yt{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new we(Jl(t.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),t.openStart,t.openEnd);return ot.fromReplace(e,this.from,this.to,r)}invert(){return new qn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new Cn(t.pos,r.pos,this.mark)}merge(e){return e instanceof Cn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Cn(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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Cn(t.from,t.to,e.markFromJSON(t.mark))}}yt.jsonID("removeMark",Cn);class er extends yt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ot.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ot.fromReplace(e,this.pos,this.pos+1,new we(fe.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new er(this.pos,t.marks[o]);return new er(this.pos,this.mark)}}return new mo(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new er(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new er(t.pos,e.markFromJSON(t.mark))}}yt.jsonID("addNodeMark",er);class mo extends yt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ot.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ot.fromReplace(e,this.pos,this.pos+1,new we(fe.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new er(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new mo(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new mo(t.pos,e.markFromJSON(t.mark))}}yt.jsonID("removeNodeMark",mo);class pt extends yt{constructor(e,t,r,o=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=o}apply(e){return this.structure&&Xl(e,this.from,this.to)?ot.fail("Structure replace would overwrite content"):ot.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new $t([this.from,this.to-this.from,this.slice.size])}invert(e){return new pt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new pt(t.pos,Math.max(t.pos,r.pos),this.slice)}merge(e){if(!(e instanceof pt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?we.empty:new we(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new pt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?we.empty:new we(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new pt(e.from,this.to,t,this.structure)}else return null}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(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new pt(t.from,t.to,we.fromJSON(e,t.slice),!!t.structure)}}yt.jsonID("replace",pt);class lt extends yt{constructor(e,t,r,o,s,i,l=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=o,this.slice=s,this.insert=i,this.structure=l}apply(e){if(this.structure&&(Xl(e,this.from,this.gapFrom)||Xl(e,this.gapTo,this.to)))return ot.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ot.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?ot.fromReplace(e,this.from,this.to,r):ot.fail("Content does not fit in gap")}getMap(){return new $t([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 lt(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),r=e.mapResult(this.to,-1),o=e.map(this.gapFrom,-1),s=e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||s>r.pos?null:new lt(t.pos,r.pos,o,s,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(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new lt(t.from,t.to,t.gapFrom,t.gapTo,we.fromJSON(e,t.slice),t.insert,!!t.structure)}}yt.jsonID("replaceAround",lt);function Xl(n,e,t){let r=n.resolve(e),o=t-e,s=r.depth;for(;o>0&&s>0&&r.indexAfter(s)==r.node(s).childCount;)s--,o--;if(o>0){let i=r.node(s).maybeChild(r.indexAfter(s));for(;o>0;){if(!i||i.isLeaf)return!0;i=i.firstChild,o--}}return!1}function fv(n,e,t,r){let o=[],s=[],i,l;n.doc.nodesBetween(e,t,(a,u,d)=>{if(!a.isInline)return;let f=a.marks;if(!r.isInSet(f)&&d.type.allowsMarkType(r.type)){let h=Math.max(u,e),p=Math.min(u+a.nodeSize,t),m=r.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(i&&i.to==h&&i.mark.eq(f[g])?i.to=p:o.push(i=new Cn(h,p,f[g])));l&&l.to==h?l.to=p:s.push(l=new qn(h,p,r))}}),o.forEach(a=>n.step(a)),s.forEach(a=>n.step(a))}function hv(n,e,t,r){let o=[],s=0;n.doc.nodesBetween(e,t,(i,l)=>{if(!i.isInline)return;s++;let a=null;if(r instanceof bi){let u=i.marks,d;for(;d=r.isInSet(u);)(a||(a=[])).push(d),u=d.removeFromSet(u)}else r?r.isInSet(i.marks)&&(a=[r]):a=i.marks;if(a&&a.length){let u=Math.min(l+i.nodeSize,t);for(let d=0;d<a.length;d++){let f=a[d],h;for(let p=0;p<o.length;p++){let m=o[p];m.step==s-1&&f.eq(o[p].style)&&(h=m)}h?(h.to=u,h.step=s):o.push({style:f,from:Math.max(l,e),to:u,step:s})}}}),o.forEach(i=>n.step(new Cn(i.from,i.to,i.style)))}function pv(n,e,t,r=t.contentMatch){let o=n.doc.nodeAt(e),s=[],i=e+1;for(let l=0;l<o.childCount;l++){let a=o.child(l),u=i+a.nodeSize,d=r.matchType(a.type);if(!d)s.push(new pt(i,u,we.empty));else{r=d;for(let f=0;f<a.marks.length;f++)t.allowsMarkType(a.marks[f].type)||n.step(new Cn(i,u,a.marks[f]));if(a.isText&&!t.spec.code){let f,h=/\r?\n|\r/g,p;for(;f=h.exec(a.text);)p||(p=new we(fe.from(t.schema.text(" ",t.allowedMarks(a.marks))),0,0)),s.push(new pt(i+f.index,i+f.index+f[0].length,p))}}i=u}if(!r.validEnd){let l=r.fillBefore(fe.empty,!0);n.replace(i,i,new we(l,0,0))}for(let l=s.length-1;l>=0;l--)n.step(s[l])}function mv(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function go(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let o=n.$from.node(r),s=n.$from.index(r),i=n.$to.indexAfter(r);if(r<n.depth&&o.canReplace(s,i,t))return r;if(r==0||o.type.spec.isolating||!mv(o,s,i))break}return null}function gv(n,e,t){let{$from:r,$to:o,depth:s}=e,i=r.before(s+1),l=o.after(s+1),a=i,u=l,d=fe.empty,f=0;for(let m=s,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,d=fe.from(r.node(m).copy(d)),f++):a--;let h=fe.empty,p=0;for(let m=s,g=!1;m>t;m--)g||o.after(m+1)<o.end(m)?(g=!0,h=fe.from(o.node(m).copy(h)),p++):u++;n.step(new lt(a,u,i,l,new we(d.append(h),f,p),d.size-f,!0))}function ql(n,e,t=null,r=n){let o=yv(n,e),s=o&&vv(r,e);return s?o.map(Th).concat({type:e,attrs:t}).concat(s.map(Th)):null}function Th(n){return{type:n,attrs:null}}function yv(n,e){let{parent:t,startIndex:r,endIndex:o}=n,s=t.contentMatchAt(r).findWrapping(e);if(!s)return null;let i=s.length?s[0]:e;return t.canReplaceWith(r,o,i)?s:null}function vv(n,e){let{parent:t,startIndex:r,endIndex:o}=n,s=t.child(r),i=e.contentMatch.findWrapping(s.type);if(!i)return null;let a=(i.length?i[i.length-1]:e).contentMatch;for(let u=r;a&&u<o;u++)a=a.matchType(t.child(u).type);return!a||!a.validEnd?null:i}function Ev(n,e,t){let r=fe.empty;for(let i=t.length-1;i>=0;i--){if(r.size){let l=t[i].type.contentMatch.matchFragment(r);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=fe.from(t[i].type.create(t[i].attrs,r))}let o=e.start,s=e.end;n.step(new lt(o,s,o,s,new we(r,0,0),t.length,!0))}function Cv(n,e,t,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=n.steps.length;n.doc.nodesBetween(e,t,(i,l)=>{if(i.isTextblock&&!i.hasMarkup(r,o)&&Av(n.doc,n.mapping.slice(s).map(l),r)){n.clearIncompatible(n.mapping.slice(s).map(l,1),r);let a=n.mapping.slice(s),u=a.map(l,1),d=a.map(l+i.nodeSize,1);return n.step(new lt(u,d,u+1,d-1,new we(fe.from(r.create(o,null,i.marks)),0,0),1,!0)),!1}})}function Av(n,e,t){let r=n.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,t)}function bv(n,e,t,r,o){let s=n.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let i=t.create(r,null,o||s.marks);if(s.isLeaf)return n.replaceWith(e,e+s.nodeSize,i);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new lt(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new we(fe.from(i),0,0),1,!0))}function yo(n,e,t=1,r){let o=n.resolve(e),s=o.depth-t,i=r&&r[r.length-1]||o.parent;if(s<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!i.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let u=o.depth-1,d=t-2;u>s;u--,d--){let f=o.node(u),h=o.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(h,f.childCount),m=r&&r[d+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[d]||f;if(!f.canReplace(h+1,f.childCount)||!g.type.validContent(p))return!1}let l=o.indexAfter(s),a=r&&r[0];return o.node(s).canReplaceWith(l,l,a?a.type:o.node(s+1).type)}function wv(n,e,t=1,r){let o=n.doc.resolve(e),s=fe.empty,i=fe.empty;for(let l=o.depth,a=o.depth-t,u=t-1;l>a;l--,u--){s=fe.from(o.node(l).copy(s));let d=r&&r[u];i=fe.from(d?d.type.create(d.attrs,i):o.node(l).copy(i))}n.step(new pt(e,e,new we(s.append(i),t,t),!0))}function tr(n,e){let t=n.resolve(e),r=t.index();return Sh(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function Sh(n,e){return!!(n&&e&&!n.isLeaf&&n.canAppend(e))}function ki(n,e,t=-1){let r=n.resolve(e);for(let o=r.depth;;o--){let s,i,l=r.index(o);if(o==r.depth?(s=r.nodeBefore,i=r.nodeAfter):t>0?(s=r.node(o+1),l++,i=r.node(o).maybeChild(l)):(s=r.node(o).maybeChild(l-1),i=r.node(o+1)),s&&!s.isTextblock&&Sh(s,i)&&r.node(o).canReplace(l,l+1))return e;if(o==0)break;e=t<0?r.before(o):r.after(o)}}function Tv(n,e,t){let r=new pt(e-t,e+t,we.empty,!0);n.step(r)}function Sv(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let s=r.index(o);if(r.node(o).canReplaceWith(s,s,t))return r.before(o+1);if(s>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let s=r.indexAfter(o);if(r.node(o).canReplaceWith(s,s,t))return r.after(o+1);if(s<r.node(o).childCount)return null}return null}function _v(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let o=t.content;for(let s=0;s<t.openStart;s++)o=o.firstChild.content;for(let s=1;s<=(t.openStart==0&&t.size?2:1);s++)for(let i=r.depth;i>=0;i--){let l=i==r.depth?0:r.pos<=(r.start(i+1)+r.end(i+1))/2?-1:1,a=r.index(i)+(l>0?1:0),u=r.node(i),d=!1;if(s==1)d=u.canReplace(a,a,o);else{let f=u.contentMatchAt(a).findWrapping(o.firstChild.type);d=f&&u.canReplaceWith(a,a,f[0])}if(d)return l==0?r.pos:l<0?r.before(i+1):r.after(i+1)}return null}function ec(n,e,t=e,r=we.empty){if(e==t&&!r.size)return null;let o=n.resolve(e),s=n.resolve(t);return _h(o,s,r)?new pt(e,t,r):new kv(o,s,r).fit()}function _h(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class kv{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=fe.empty;for(let o=0;o<=e.depth;o++){let s=e.node(o);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=fe.from(e.node(o).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let s=this.placed,i=r.depth,l=o.depth;for(;i&&l&&s.childCount==1;)s=s.firstChild.content,i--,l--;let a=new we(s,i,l);return e>-1?new lt(r.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||r.pos!=this.$to.pos?new pt(r.pos,o.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,o=this.unplaced.openEnd;r<e;r++){let s=t.firstChild;if(t.childCount>1&&(o=0),s.type.spec.isolating&&o<=r){e=r;break}t=s.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let o,s=null;r?(s=tc(this.unplaced.content,r-1).firstChild,o=s.content):o=this.unplaced.content;let i=o.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],d,f=null;if(t==1&&(i?u.matchType(i.type)||(f=u.fillBefore(fe.from(i),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:r,frontierDepth:l,parent:s,inject:f};if(t==2&&i&&(d=u.findWrapping(i.type)))return{sliceDepth:r,frontierDepth:l,parent:s,wrap:d};if(s&&u.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=tc(e,t);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new we(e,t+1,Math.max(r,o.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,o=tc(e,t);if(o.childCount<=1&&t>0){let s=e.size-t<=t+o.size;this.unplaced=new we(gs(e,t-1,1),t-1,s?t-1:r)}else this.unplaced=new we(gs(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:o,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let g=0;g<s.length;g++)this.openFrontierNode(s[g]);let i=this.unplaced,l=r?r.content:i.content,a=i.openStart-e,u=0,d=[],{match:f,type:h}=this.frontier[t];if(o){for(let g=0;g<o.childCount;g++)d.push(o.child(g));f=f.matchFragment(o)}let p=l.size+e-(i.content.size-i.openEnd);for(;u<l.childCount;){let g=l.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||a==0||g.content.size)&&(f=y,d.push(kh(g.mark(h.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?p:-1)))}let m=u==l.childCount;m||(p=-1),this.placed=ys(this.placed,t,fe.from(d)),this.frontier[t].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<p;g++){let C=y.lastChild;this.frontier.push({type:C.type,match:C.contentMatchAt(C.childCount)}),y=C.content}this.unplaced=m?e==0?we.empty:new we(gs(i.content,e-1,1),e-1,p<0?i.openEnd:e-1):new we(gs(i.content,e,u),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!nc(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:r}=this.$to,o=this.$to.after(r);for(;r>1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:o}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=nc(e,t,o,r,s);if(i){for(let l=t-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],d=nc(e,l,u,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:i,move:s?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=ys(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let o=e.node(r),s=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,s)}return e}openFrontierNode(e,t=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=ys(this.placed,this.depth,fe.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(fe.empty,!0);t.childCount&&(this.placed=ys(this.placed,this.frontier.length,t))}}function gs(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(gs(n.firstChild.content,e-1,t)))}function ys(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ys(n.lastChild.content,e-1,t)))}function tc(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function kh(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,kh(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(fe.empty,!0)))),n.copy(r)}function nc(n,e,t,r,o){let s=n.node(e),i=o?n.indexAfter(e):n.index(e);if(i==s.childCount&&!t.compatibleContent(s.type))return null;let l=r.fillBefore(s.content,!0,i);return l&&!Nv(t,s.content,i)?l:null}function Nv(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function Iv(n){return n.spec.defining||n.spec.definingForContent}function xv(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let o=n.doc.resolve(e),s=n.doc.resolve(t);if(_h(o,s,r))return n.step(new pt(e,t,r));let i=Ih(o,n.doc.resolve(t));i[i.length-1]==0&&i.pop();let l=-(o.depth+1);i.unshift(l);for(let h=o.depth,p=o.pos-1;h>0;h--,p--){let m=o.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;i.indexOf(h)>-1?l=h:o.before(h)==p&&i.splice(1,0,-h)}let a=i.indexOf(l),u=[],d=r.openStart;for(let h=r.content,p=0;;p++){let m=h.firstChild;if(u.push(m),p==r.openStart)break;h=m.content}for(let h=d-1;h>=0;h--){let p=u[h],m=Iv(p.type);if(m&&!p.sameMarkup(o.node(Math.abs(l)-1)))d=h;else if(m||!p.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let p=(h+d+1)%(r.openStart+1),m=u[p];if(m)for(let g=0;g<i.length;g++){let y=i[(g+a)%i.length],C=!0;y<0&&(C=!1,y=-y);let b=o.node(y-1),E=o.index(y-1);if(b.canReplaceWith(E,E,m.type,m.marks))return n.replace(o.before(y),C?s.after(y):t,new we(Nh(r.content,0,r.openStart,p),p,r.openEnd))}}let f=n.steps.length;for(let h=i.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>f));h--){let p=i[h];p<0||(e=o.before(p),t=s.after(p))}}function Nh(n,e,t,r,o){if(e<t){let s=n.firstChild;n=n.replaceChild(0,s.copy(Nh(s.content,e+1,t,r,s)))}if(e>r){let s=o.contentMatchAt(0),i=s.fillBefore(n).append(n);n=i.append(s.matchFragment(i).fillBefore(fe.empty,!0))}return n}function Mv(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let o=Sv(n.doc,e,r.type);o!=null&&(e=t=o)}n.replaceRange(e,t,new we(fe.from(r),0,0))}function Ov(n,e,t){let r=n.doc.resolve(e),o=n.doc.resolve(t),s=Ih(r,o);for(let i=0;i<s.length;i++){let l=s[i],a=i==s.length-1;if(a&&l==0||r.node(l).type.contentMatch.validEnd)return n.delete(r.start(l),o.end(l));if(l>0&&(a||r.node(l-1).canReplace(r.index(l-1),o.indexAfter(l-1))))return n.delete(r.before(l),o.after(l))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(e-r.start(i)==r.depth-i&&t>r.end(i)&&o.end(i)-t!=o.depth-i)return n.delete(r.before(i),t);n.delete(e,t)}function Ih(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let o=r;o>=0;o--){let s=n.start(o);if(s<n.pos-(n.depth-o)||e.end(o)>e.pos+(e.depth-o)||n.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(s==e.start(o)||o==n.depth&&o==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==s-1)&&t.push(o)}return t}class vo extends yt{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return ot.fail("No node at attribute step's position");let r=Object.create(null);for(let s in t.attrs)r[s]=t.attrs[s];r[this.attr]=this.value;let o=t.type.create(r,null,t.marks);return ot.fromReplace(e,this.pos,this.pos+1,new we(fe.from(o),0,t.isLeaf?0:1))}getMap(){return $t.empty}invert(e){return new vo(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 vo(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new vo(t.pos,t.attr,t.value)}}yt.jsonID("attr",vo);class vs extends yt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let o in e.attrs)t[o]=e.attrs[o];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return ot.ok(r)}getMap(){return $t.empty}invert(e){return new vs(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(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new vs(t.attr,t.value)}}yt.jsonID("docAttr",vs);let Eo=class extends Error{};Eo=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},Eo.prototype=Object.create(Error.prototype),Eo.prototype.constructor=Eo,Eo.prototype.name="TransformError";class xh{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ms}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Eo(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}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=we.empty){let o=ec(this.doc,e,t,r);return o&&this.step(o),this}replaceWith(e,t,r){return this.replace(e,t,new we(fe.from(r),0,0))}delete(e,t){return this.replace(e,t,we.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return xv(this,e,t,r),this}replaceRangeWith(e,t,r){return Mv(this,e,t,r),this}deleteRange(e,t){return Ov(this,e,t),this}lift(e,t){return gv(this,e,t),this}join(e,t=1){return Tv(this,e,t),this}wrap(e,t){return Ev(this,e,t),this}setBlockType(e,t=e,r,o=null){return Cv(this,e,t,r,o),this}setNodeMarkup(e,t,r=null,o){return bv(this,e,t,r,o),this}setNodeAttribute(e,t,r){return this.step(new vo(e,t,r)),this}setDocAttribute(e,t){return this.step(new vs(e,t)),this}addNodeMark(e,t){return this.step(new er(e,t)),this}removeNodeMark(e,t){if(!(t instanceof We)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t=t.isInSet(r.marks),!t)return this}return this.step(new mo(e,t)),this}split(e,t=1,r){return wv(this,e,t,r),this}addMark(e,t,r){return fv(this,e,t,r),this}removeMark(e,t,r){return hv(this,e,t,r),this}clearIncompatible(e,t,r){return pv(this,e,t,r),this}}const rc=Object.create(null);class Ue{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Lv(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=we.empty){let r=t.content.lastChild,o=null;for(let l=0;l<t.openEnd;l++)o=r,r=r.lastChild;let s=e.steps.length,i=this.ranges;for(let l=0;l<i.length;l++){let{$from:a,$to:u}=i[l],d=e.mapping.slice(s);e.replaceRange(d.map(a.pos),d.map(u.pos),l?we.empty:t),l==0&&Lh(e,s,(r?r.isInline:o&&o.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,o=this.ranges;for(let s=0;s<o.length;s++){let{$from:i,$to:l}=o[s],a=e.mapping.slice(r),u=a.map(i.pos),d=a.map(l.pos);s?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),Lh(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let o=e.parent.inlineContent?new ze(e):Co(e.node(0),e.parent,e.pos,e.index(),t,r);if(o)return o;for(let s=e.depth-1;s>=0;s--){let i=t<0?Co(e.node(0),e.node(s),e.before(s+1),e.index(s),t,r):Co(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,r);if(i)return i}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new cn(e.node(0))}static atStart(e){return Co(e,e,0,0,1)||new cn(e)}static atEnd(e){return Co(e,e,e.content.size,e.childCount,-1)||new cn(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=rc[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in rc)throw new RangeError("Duplicate use of selection JSON ID "+e);return rc[e]=t,t.prototype.jsonID=e,t}getBookmark(){return ze.between(this.$anchor,this.$head).getBookmark()}}Ue.prototype.visible=!0;class Lv{constructor(e,t){this.$from=e,this.$to=t}}let Mh=!1;function Oh(n){!Mh&&!n.parent.inlineContent&&(Mh=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class ze extends Ue{constructor(e,t=e){Oh(e),Oh(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return Ue.near(r);let o=e.resolve(t.map(this.anchor));return new ze(o.parent.inlineContent?o:r,r)}replace(e,t=we.empty){if(super.replace(e,t),t==we.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof ze&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ni(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ze(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let o=e.resolve(t);return new this(o,r==t?o:e.resolve(r))}static between(e,t,r){let o=e.pos-t.pos;if((!r||o)&&(r=o>=0?1:-1),!t.parent.inlineContent){let s=Ue.findFrom(t,r,!0)||Ue.findFrom(t,-r,!0);if(s)t=s.$head;else return Ue.near(t,r)}return e.parent.inlineContent||(o==0?e=t:(e=(Ue.findFrom(e,-r,!0)||Ue.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=o<0&&(e=t))),new ze(e,t)}}Ue.jsonID("text",ze);class Ni{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Ni(e.map(this.anchor),e.map(this.head))}resolve(e){return ze.between(e.resolve(this.anchor),e.resolve(this.head))}}class Le extends Ue{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:o}=t.mapResult(this.anchor),s=e.resolve(o);return r?Ue.near(s):new Le(s)}content(){return new we(fe.from(this.node),0,0)}eq(e){return e instanceof Le&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new oc(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Le(e.resolve(t.anchor))}static create(e,t){return new Le(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Le.prototype.visible=!1,Ue.jsonID("node",Le);class oc{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Ni(r,r):new oc(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&Le.isSelectable(r)?new Le(t):Ue.near(t)}}class cn extends Ue{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=we.empty){if(t==we.empty){e.delete(0,e.doc.content.size);let r=Ue.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new cn(e)}map(e){return new cn(e)}eq(e){return e instanceof cn}getBookmark(){return Dv}}Ue.jsonID("all",cn);const Dv={map(){return this},resolve(n){return new cn(n)}};function Co(n,e,t,r,o,s=!1){if(e.inlineContent)return ze.create(n,t);for(let i=r-(o>0?0:1);o>0?i<e.childCount:i>=0;i+=o){let l=e.child(i);if(l.isAtom){if(!s&&Le.isSelectable(l))return Le.create(n,t-(o<0?l.nodeSize:0))}else{let a=Co(n,l,t+o,o<0?l.childCount:0,o,s);if(a)return a}t+=l.nodeSize*o}return null}function Lh(n,e,t){let r=n.steps.length-1;if(r<e)return;let o=n.steps[r];if(!(o instanceof pt||o instanceof lt))return;let s=n.mapping.maps[r],i;s.forEach((l,a,u,d)=>{i==null&&(i=d)}),n.setSelection(Ue.near(n.doc.resolve(i),t))}const Dh=1,Ii=2,Rh=4;class Rv extends xh{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 new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Dh)&~Ii,this.storedMarks=null,this}get selectionSet(){return(this.updated&Dh)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ii,this}ensureMarks(e){return We.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(this.updated&Ii)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Ii,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||We.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let o=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let s=this.storedMarks;if(!s){let i=this.doc.resolve(t);s=r==t?i.marks():i.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,o.text(e,s)),this.selection.empty||this.setSelection(Ue.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Rh,this}get scrolledIntoView(){return(this.updated&Rh)>0}}function Bh(n,e){return!e||!n?n:n.bind(e)}class Es{constructor(e,t,r){this.name=e,this.init=Bh(t.init,r),this.apply=Bh(t.apply,r)}}const Bv=[new Es("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Es("selection",{init(n,e){return n.selection||Ue.atStart(e.doc)},apply(n){return n.selection}}),new Es("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Es("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class sc{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Bv.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Es(r.key,r.spec.state,r))})}}class Ao{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 r=0;r<this.config.plugins.length;r++)if(r!=t){let o=this.config.plugins[r];if(o.spec.filterTransaction&&!o.spec.filterTransaction.call(o,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),o=null;for(;;){let s=!1;for(let i=0;i<this.config.plugins.length;i++){let l=this.config.plugins[i];if(l.spec.appendTransaction){let a=o?o[i].n:0,u=o?o[i].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,u,r);if(d&&r.filterTransaction(d,i)){if(d.setMeta("appendedTransaction",e),!o){o=[];for(let f=0;f<this.config.plugins.length;f++)o.push(f<i?{state:r,n:t.length}:{state:this,n:0})}t.push(d),r=r.applyInner(d),s=!0}o&&(o[i]={state:r,n:t.length})}}if(!s)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new Ao(this.config),r=this.config.fields;for(let o=0;o<r.length;o++){let s=r[o];t[s.name]=s.apply(e,this[s.name],this,t)}return t}get tr(){return new Rv(this)}static create(e){let t=new sc(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Ao(t);for(let o=0;o<t.fields.length;o++)r[t.fields[o].name]=t.fields[o].init(e,r);return r}reconfigure(e){let t=new sc(this.schema,e.plugins),r=t.fields,o=new Ao(t);for(let s=0;s<r.length;s++){let i=r[s].name;o[i]=this.hasOwnProperty(i)?this[i]:r[s].init(e,o)}return o}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],s=o.spec.state;s&&s.toJSON&&(t[r]=s.toJSON.call(o,this[o.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new sc(e.schema,e.plugins),s=new Ao(o);return o.fields.forEach(i=>{if(i.name=="doc")s.doc=Vr.fromJSON(e.schema,t.doc);else if(i.name=="selection")s.selection=Ue.fromJSON(s.doc,t.selection);else if(i.name=="storedMarks")t.storedMarks&&(s.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let l in r){let a=r[l],u=a.spec.state;if(a.key==i.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){s[i.name]=u.fromJSON.call(a,e,t[l],s);return}}s[i.name]=i.init(e,s)}}),s}}function Ph(n,e,t){for(let r in n){let o=n[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=Ph(o,e,{})),t[r]=o}return t}class Dt{constructor(e){this.spec=e,this.props={},e.props&&Ph(e.props,this,this.props),this.key=e.key?e.key.key:Fh("plugin")}getState(e){return e[this.key]}}const ic=Object.create(null);function Fh(n){return n in ic?n+"$"+ ++ic[n]:(ic[n]=0,n+"$")}class un{constructor(e="key"){this.key=Fh(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const bt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},Cs=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let Vh=null;const Rn=function(n,e,t){let r=Vh||(Vh=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},Ur=function(n,e,t,r){return t&&($h(n,e,t,r,-1)||$h(n,e,t,r,1))},Pv=/^(img|br|input|textarea|hr)$/i;function $h(n,e,t,r,o){for(;;){if(n==t&&e==r)return!0;if(e==(o<0?0:An(n))){let s=n.parentNode;if(!s||s.nodeType!=1||ac(n)||Pv.test(n.nodeName)||n.contentEditable=="false")return!1;e=bt(n)+(o<0?0:1),n=s}else if(n.nodeType==1){if(n=n.childNodes[e+(o<0?-1:0)],n.contentEditable=="false")return!1;e=o<0?An(n):0}else return!1}}function An(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Fv(n,e,t){for(let r=e==0,o=e==An(n);r||o;){if(n==t)return!0;let s=bt(n);if(n=n.parentNode,!n)return!1;r=r&&s==0,o=o&&s==An(n)}}function ac(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const xi=function(n){return n.focusNode&&Ur(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function zr(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function Vv(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function $v(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:r.startOffset}}}const bn=typeof navigator<"u"?navigator:null,Uh=typeof document<"u"?document:null,nr=bn&&bn.userAgent||"",lc=/Edge\/(\d+)/.exec(nr),zh=/MSIE \d/.exec(nr),cc=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(nr),Rt=!!(zh||cc||lc),rr=zh?document.documentMode:cc?+cc[1]:lc?+lc[1]:0,dn=!Rt&&/gecko\/(\d+)/i.test(nr);dn&&+(/Firefox\/(\d+)/.exec(nr)||[0,0])[1];const uc=!Rt&&/Chrome\/(\d+)/.exec(nr),vt=!!uc,Uv=uc?+uc[1]:0,wt=!Rt&&!!bn&&/Apple Computer/.test(bn.vendor),bo=wt&&(/Mobile\/\w+/.test(nr)||!!bn&&bn.maxTouchPoints>2),Gt=bo||(bn?/Mac/.test(bn.platform):!1),zv=bn?/Win/.test(bn.platform):!1,fn=/Android \d/.test(nr),As=!!Uh&&"webkitFontSmoothing"in Uh.documentElement.style,Hv=As?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function jv(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Bn(n,e){return typeof n=="number"?n:n[e]}function Wv(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Hh(n,e,t){let r=n.someProp("scrollThreshold")||0,o=n.someProp("scrollMargin")||5,s=n.dom.ownerDocument;for(let i=t||n.dom;i;i=Cs(i)){if(i.nodeType!=1)continue;let l=i,a=l==s.body,u=a?jv(s):Wv(l),d=0,f=0;if(e.top<u.top+Bn(r,"top")?f=-(u.top-e.top+Bn(o,"top")):e.bottom>u.bottom-Bn(r,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+Bn(o,"top")-u.top:e.bottom-u.bottom+Bn(o,"bottom")),e.left<u.left+Bn(r,"left")?d=-(u.left-e.left+Bn(o,"left")):e.right>u.right-Bn(r,"right")&&(d=e.right-u.right+Bn(o,"right")),d||f)if(a)s.defaultView.scrollBy(d,f);else{let h=l.scrollLeft,p=l.scrollTop;f&&(l.scrollTop+=f),d&&(l.scrollLeft+=d);let m=l.scrollLeft-h,g=l.scrollTop-p;e={left:e.left-m,top:e.top-g,right:e.right-m,bottom:e.bottom-g}}if(a||/^(fixed|sticky)$/.test(getComputedStyle(i).position))break}}function Kv(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,o;for(let s=(e.left+e.right)/2,i=t+1;i<Math.min(innerHeight,e.bottom);i+=5){let l=n.root.elementFromPoint(s,i);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){r=l,o=a.top;break}}return{refDOM:r,refTop:o,stack:jh(n.dom)}}function jh(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=Cs(r));return e}function Yv({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;Wh(t,r==0?0:r-e)}function Wh(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:o,left:s}=n[t];r.scrollTop!=o+e&&(r.scrollTop=o+e),r.scrollLeft!=s&&(r.scrollLeft=s)}}let wo=null;function Gv(n){if(n.setActive)return n.setActive();if(wo)return n.focus(wo);let e=jh(n);n.focus(wo==null?{get preventScroll(){return wo={preventScroll:!0},!0}}:void 0),wo||(wo=!1,Wh(e,0))}function Kh(n,e){let t,r=2e8,o,s=0,i=e.top,l=e.top,a,u;for(let d=n.firstChild,f=0;d;d=d.nextSibling,f++){let h;if(d.nodeType==1)h=d.getClientRects();else if(d.nodeType==3)h=Rn(d).getClientRects();else continue;for(let p=0;p<h.length;p++){let m=h[p];if(m.top<=i&&m.bottom>=l){i=Math.max(m.bottom,i),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=d,r=g,o=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(s=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(s=f+1)}}return!t&&a&&(t=a,o=u,r=0),t&&t.nodeType==3?Qv(t,o):!t||r&&t.nodeType==1?{node:n,offset:s}:Kh(t,o)}function Qv(n,e){let t=n.nodeValue.length,r=document.createRange();for(let o=0;o<t;o++){r.setEnd(n,o+1),r.setStart(n,o);let s=or(r,1);if(s.top!=s.bottom&&dc(e,s))return{node:n,offset:o+(e.left>=(s.left+s.right)/2?1:0)}}return{node:n,offset:0}}function dc(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Zv(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Jv(n,e,t){let{node:r,offset:o}=Kh(e,t),s=-1;if(r.nodeType==1&&!r.firstChild){let i=r.getBoundingClientRect();s=i.left!=i.right&&t.left>(i.left+i.right)/2?1:-1}return n.docView.posFromDOM(r,o,s)}function Xv(n,e,t,r){let o=-1;for(let s=e,i=!1;s!=n.dom;){let l=n.docView.nearestDesc(s,!0);if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent&&!i||!l.contentDOM)){let a=l.dom.getBoundingClientRect();if(l.node.isBlock&&l.parent&&!i&&(i=!0,a.left>r.left||a.top>r.top?o=l.posBefore:(a.right<r.left||a.bottom<r.top)&&(o=l.posAfter)),!l.contentDOM&&o<0&&!l.node.isText)return(l.node.isBlock?r.top<(a.top+a.bottom)/2:r.left<(a.left+a.right)/2)?l.posBefore:l.posAfter}s=l.dom.parentNode}return o>-1?o:n.docView.posFromDOM(e,t,-1)}function Yh(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let o=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),s=o;;){let i=n.childNodes[s];if(i.nodeType==1){let l=i.getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(dc(e,u))return Yh(i,e,u)}}if((s=(s+1)%r)==o)break}return n}function qv(n,e){let t=n.dom.ownerDocument,r,o=0,s=$v(t,e.left,e.top);s&&({node:r,offset:o}=s);let i=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!i||!n.dom.contains(i.nodeType!=1?i.parentNode:i)){let u=n.dom.getBoundingClientRect();if(!dc(e,u)||(i=Yh(n.dom,e,u),!i))return null}if(wt)for(let u=i;r&&u;u=Cs(u))u.draggable&&(r=void 0);if(i=Zv(i,e),r){if(dn&&r.nodeType==1&&(o=Math.min(o,r.childNodes.length),o<r.childNodes.length)){let d=r.childNodes[o],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&o++}let u;As&&o&&r.nodeType==1&&(u=r.childNodes[o-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&o--,r==n.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(l=Xv(n,r,o,e))}l==null&&(l=Jv(n,i,e));let a=n.docView.nearestDesc(i,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Gh(n){return n.top<n.bottom||n.left<n.right}function or(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(Gh(r))return r}return Array.prototype.find.call(t,Gh)||n.getBoundingClientRect()}const e9=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Qh(n,e,t){let{node:r,offset:o,atom:s}=n.docView.domFromPos(e,t<0?-1:1),i=As||dn;if(r.nodeType==3)if(i&&(e9.test(r.nodeValue)||(t<0?!o:o==r.nodeValue.length))){let a=or(Rn(r,o,o),t);if(dn&&o&&/\s/.test(r.nodeValue[o-1])&&o<r.nodeValue.length){let u=or(Rn(r,o-1,o-1),-1);if(u.top==a.top){let d=or(Rn(r,o,o+1),-1);if(d.top!=a.top)return bs(d,d.left<u.left)}}return a}else{let a=o,u=o,d=t<0?1:-1;return t<0&&!o?(u++,d=-1):t>=0&&o==r.nodeValue.length?(a--,d=1):t<0?a--:u++,bs(or(Rn(r,a,u),d),d<0)}if(!n.state.doc.resolve(e-(s||0)).parent.inlineContent){if(s==null&&o&&(t<0||o==An(r))){let a=r.childNodes[o-1];if(a.nodeType==1)return fc(a.getBoundingClientRect(),!1)}if(s==null&&o<An(r)){let a=r.childNodes[o];if(a.nodeType==1)return fc(a.getBoundingClientRect(),!0)}return fc(r.getBoundingClientRect(),t>=0)}if(s==null&&o&&(t<0||o==An(r))){let a=r.childNodes[o-1],u=a.nodeType==3?Rn(a,An(a)-(i?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return bs(or(u,1),!1)}if(s==null&&o<An(r)){let a=r.childNodes[o];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?a.nodeType==3?Rn(a,0,i?0:1):a.nodeType==1?a:null:null;if(u)return bs(or(u,-1),!0)}return bs(or(r.nodeType==3?Rn(r):r,-t),t>=0)}function bs(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function fc(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function Zh(n,e,t){let r=n.state,o=n.root.activeElement;r!=e&&n.updateState(e),o!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),o!=n.dom&&o&&o.focus()}}function t9(n,e,t){let r=e.selection,o=t=="up"?r.$from:r.$to;return Zh(n,e,()=>{let{node:s}=n.docView.domFromPos(o.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(s,!0);if(!l)break;if(l.node.isBlock){s=l.contentDOM||l.dom;break}s=l.dom.parentNode}let i=Qh(n,o.pos,1);for(let l=s.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=Rn(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<a.length;u++){let d=a[u];if(d.bottom>d.top+1&&(t=="up"?i.top-d.top>(d.bottom-i.top)*2:d.bottom-i.bottom>(i.bottom-d.top)*2))return!1}}return!0})}const n9=/[\u0590-\u08ac]/;function r9(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,s=!o,i=o==r.parent.content.size,l=n.domSelection();return!n9.test(r.parent.textContent)||!l.modify?t=="left"||t=="backward"?s:i:Zh(n,e,()=>{let{focusNode:a,focusOffset:u,anchorNode:d,anchorOffset:f}=n.domSelectionRange(),h=l.caretBidiLevel;l.modify("move",t,"character");let p=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!p.contains(m.nodeType==1?m:m.parentNode)||a==m&&u==g;try{l.collapse(d,f),a&&(a!=d||u!=f)&&l.extend&&l.extend(a,u)}catch{}return h!=null&&(l.caretBidiLevel=h),y})}let Jh=null,Xh=null,qh=!1;function o9(n,e,t){return Jh==e&&Xh==t?qh:(Jh=e,Xh=t,qh=t=="up"||t=="down"?t9(n,e,t):r9(n,e,t))}const Qt=0,ep=1,Hr=2,wn=3;class ws{constructor(e,t,r,o){this.parent=e,this.children=t,this.dom=r,this.contentDOM=o,this.dirty=Qt,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){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,r=this.posAtStart;;t++){let o=this.children[t];if(o==e)return r;r+=o.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,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let s,i;if(e==this.contentDOM)s=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.previousSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.previousSibling;return s?this.posBeforeChild(i)+i.size:this.posAtStart}else{let s,i;if(e==this.contentDOM)s=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;s=e.nextSibling}for(;s&&!((i=s.pmViewDesc)&&i.parent==this);)s=s.nextSibling;return s?this.posBeforeChild(i):this.posAtEnd}let o;if(e==this.dom&&this.contentDOM)o=t>bt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!1;break}if(s.previousSibling)break}if(o==null&&t==e.childNodes.length)for(let s=e;;s=s.parentNode){if(s==this.dom){o=!0;break}if(s.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,o=e;o;o=o.parentNode){let s=this.getDesc(o),i;if(s&&(!t||s.node))if(r&&(i=s.nodeDOM)&&!(i.nodeType==1?i.contains(e.nodeType==1?e:e.parentNode):i==e))r=!1;else return s}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let o=e;o;o=o.parentNode){let s=this.getDesc(o);if(s)return s.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let o=this.children[t],s=r+o.size;if(r==e&&s!=r){for(;!o.border&&o.children.length;)o=o.children[0];return o}if(e<s)return o.descAt(e-r-o.border);r=s}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,o=0;for(let s=0;r<this.children.length;r++){let i=this.children[r],l=s+i.size;if(l>e||i instanceof rp){o=e-s;break}s=l}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(let s;r&&!(s=this.children[r-1]).size&&s instanceof tp&&s.side>=0;r--);if(t<=0){let s,i=!0;for(;s=r?this.children[r-1]:null,!(!s||s.dom.parentNode==this.contentDOM);r--,i=!1);return s&&t&&i&&!s.border&&!s.domAtom?s.domFromPos(s.size,t):{node:this.contentDOM,offset:s?bt(s.dom)+1:0}}else{let s,i=!0;for(;s=r<this.children.length?this.children[r]:null,!(!s||s.dom.parentNode==this.contentDOM);r++,i=!1);return s&&i&&!s.border&&!s.domAtom?s.domFromPos(0,t):{node:this.contentDOM,offset:s?bt(s.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let o=-1,s=-1;for(let i=r,l=0;;l++){let a=this.children[l],u=i+a.size;if(o==-1&&e<=u){let d=i+a.border;if(e>=d&&t<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=i;for(let f=l;f>0;f--){let h=this.children[f-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){o=bt(h.dom)+1;break}e-=h.size}o==-1&&(o=0)}if(o>-1&&(u>t||l==this.children.length-1)){t=u;for(let d=l+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){s=bt(f.dom);break}t+=f.size}s==-1&&(s=this.contentDOM.childNodes.length);break}i=u}return{node:this.contentDOM,from:e,to:t,fromOffset:o,toOffset:s}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,o=!1){let s=Math.min(e,t),i=Math.max(e,t);for(let h=0,p=0;h<this.children.length;h++){let m=this.children[h],g=p+m.size;if(s>p&&i<g)return m.setSelection(e-p-m.border,t-p-m.border,r,o);p=g}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),u=r.getSelection(),d=!1;if((dn||wt)&&e==t){let{node:h,offset:p}=l;if(h.nodeType==3){if(d=!!(p&&h.nodeValue[p-1]==`
|