From d0ada32d31f5eea5298a6bc41560d3c2271db5fc Mon Sep 17 00:00:00 2001 From: Adam Weston Date: Sun, 17 Jul 2022 15:11:26 -0400 Subject: [PATCH] fix event listeners in floating ui for livewire dom diffing --- package-lock.json | 12 ++++++------ packages/admin/dist/app.js | 2 +- packages/admin/dist/app.js.map | 2 +- packages/admin/dist/mix-manifest.json | 2 +- packages/forms/dist/module.esm.js | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index 283cbd795da..40fda4a56ed 100644 --- a/package-lock.json +++ b/package-lock.json @@ -80,9 +80,9 @@ } }, "node_modules/@awcodes/alpine-floating-ui": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/@awcodes/alpine-floating-ui/-/alpine-floating-ui-3.2.3.tgz", - "integrity": "sha512-WuNAq5fj0SZt5EhyXY8cvrm8srM8Eb6FUMrV38EpZ/IjwHIYrDgSlGrWxRc2QQVCzARWPp+L5HVr/KH1a5+jWQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/@awcodes/alpine-floating-ui/-/alpine-floating-ui-3.2.5.tgz", + "integrity": "sha512-zCMDFXm75zyzz38+1GtpbGwOXLxISVEfSNzXKko7r73xbkvUPUEpq+GMhpik572oeSinhy4WUEcTlHZo3ACAYg==", "dev": true }, "node_modules/@babel/code-frame": { @@ -9642,9 +9642,9 @@ } }, "@awcodes/alpine-floating-ui": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/@awcodes/alpine-floating-ui/-/alpine-floating-ui-3.2.3.tgz", - "integrity": "sha512-WuNAq5fj0SZt5EhyXY8cvrm8srM8Eb6FUMrV38EpZ/IjwHIYrDgSlGrWxRc2QQVCzARWPp+L5HVr/KH1a5+jWQ==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/@awcodes/alpine-floating-ui/-/alpine-floating-ui-3.2.5.tgz", + "integrity": "sha512-zCMDFXm75zyzz38+1GtpbGwOXLxISVEfSNzXKko7r73xbkvUPUEpq+GMhpik572oeSinhy4WUEcTlHZo3ACAYg==", "dev": true }, "@babel/code-frame": { diff --git a/packages/admin/dist/app.js b/packages/admin/dist/app.js index 8abaf67e541..e801d5e525c 100644 --- a/packages/admin/dist/app.js +++ b/packages/admin/dist/app.js @@ -59,7 +59,7 @@ var Qh,td,ed=function(t){return t instanceof HTMLElement},nd=function(t){var e=a * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit undefined for details. */"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:Ub})),Cv(Lv),Cv(Fv),Cv(jv),Cv(Jv),Cv(Py),Cv(Ny),Cv(Nb),Cv(Ub),window.FilePond=Jh;var Gb=function(t){t.data("fileUploadFormComponent",(function(t){var e,n,i,r=t.acceptedFileTypes,o=t.canDownload,a=t.canOpen,s=t.canPreview,u=t.canReorder,l=t.deleteUploadedFileUsing,c=t.getUploadedFileUrlsUsing,h=t.imageCropAspectRatio,d=t.imagePreviewHeight,f=t.imageResizeMode,p=t.imageResizeTargetHeight,g=t.imageResizeTargetWidth,m=t.isAvatar,v=t.loadingIndicatorPosition,y=t.panelAspectRatio,b=t.panelLayout,_=t.placeholder,E=t.maxSize,x=t.minSize,w=t.removeUploadedFileButtonPosition,A=t.removeUploadedFileUsing,D=t.reorderUploadedFilesUsing,T=t.shouldAppendFiles,k=t.shouldTransformImage,C=t.state,S=t.uploadButtonPosition,I=t.uploadProgressIndicatorPosition,O=t.uploadUsing;return{fileKeyIndex:{},pond:null,shouldUpdateState:!0,state:C,lastState:null,uploadedFileUrlIndex:{},init:(i=Ul(Vl().mark((function t(){var e=this;return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.t0=Av,t.t1=this.$refs.input,t.t2=rc,t.t3=rc,t.t4=r,t.t5=u,t.t6=s,t.t7=s,t.t8=s,t.t9=k,t.next=12,this.getFiles();case 12:t.t10=t.sent,t.t11=h,t.t12=d,t.t13=p,t.t14=g,t.t15=f,t.t16=T?"after":"before",t.t17={acceptedFileTypes:t.t4,allowPaste:!1,allowReorder:t.t5,allowImagePreview:t.t6,allowVideoPreview:t.t7,allowAudioPreview:t.t8,allowImageTransform:t.t9,credits:!1,files:t.t10,imageCropAspectRatio:t.t11,imagePreviewHeight:t.t12,imageResizeTargetHeight:t.t13,imageResizeTargetWidth:t.t14,imageResizeMode:t.t15,itemInsertLocation:t.t16},t.t18=_&&{labelIdle:_},t.t19=(0,t.t3)(t.t17,t.t18),t.t20={},t.t21={maxFileSize:E,minFileSize:x,styleButtonProcessItemPosition:S,styleButtonRemoveItemPosition:w,styleLoadIndicatorPosition:v,stylePanelAspectRatio:y,stylePanelLayout:b,styleProgressIndicatorPosition:I,server:{load:function(){var t=Ul(Vl().mark((function t(e,n){var i,r;return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(e);case 2:return i=t.sent,t.next=5,i.blob();case 5:r=t.sent,n(r);case 7:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),process:function(t,n,i,r,o,a){e.shouldUpdateState=!1;var s=([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,(function(t){return(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16)}));O(s,n,(function(t){e.shouldUpdateState=!0,r(t)}),o,a)},remove:function(){var t=Ul(Vl().mark((function t(n,i){var r,o;return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o=null!==(r=e.uploadedFileUrlIndex[n])&&void 0!==r?r:null){t.next=3;break}return t.abrupt("return");case 3:return t.next=5,l(o);case 5:i();case 6:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}(),revert:function(){var t=Ul(Vl().mark((function t(e,n){return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,A(e);case 2:n();case 3:case"end":return t.stop()}}),t)})));return function(e,n){return t.apply(this,arguments)}}()}},t.t22=(0,t.t2)(t.t19,t.t20,t.t21),this.pond=(0,t.t0)(t.t1,t.t22),this.$watch("state",Ul(Vl().mark((function t(){return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.shouldUpdateState){t.next=2;break}return t.abrupt("return");case 2:if(!Object.values(e.state).filter((function(t){return t.startsWith("livewire-file:")})).length){t.next=4;break}return t.abrupt("return");case 4:if(JSON.stringify(e.state)!==e.lastState){t.next=6;break}return t.abrupt("return");case 6:return e.lastState=JSON.stringify(e.state),t.next=9,e.getFiles();case 9:e.pond.files=t.sent;case 10:case"end":return t.stop()}}),t)})))),this.pond.on("reorderfiles",function(){var t=Ul(Vl().mark((function t(n){var i;return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=n.map((function(t){var n;return t.source instanceof File?t.serverId:null!==(n=e.uploadedFileUrlIndex[t.source])&&void 0!==n?n:null})).filter((function(t){return t})),t.next=3,D(T?i:i.reverse());case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),this.pond.on("initfile",function(){var t=Ul(Vl().mark((function t(n){return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(o){t.next=2;break}return t.abrupt("return");case 2:if(!m){t.next=4;break}return t.abrupt("return");case 4:e.insertDownloadLink(n);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),this.pond.on("initfile",function(){var t=Ul(Vl().mark((function t(n){return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(a){t.next=2;break}return t.abrupt("return");case 2:if(!m){t.next=4;break}return t.abrupt("return");case 4:e.insertOpenLink(n);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),this.pond.on("processfilestart",Ul(Vl().mark((function t(){return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.dispatchFormEvent("file-upload-started");case 1:case"end":return t.stop()}}),t)})))),this.pond.on("processfileprogress",Ul(Vl().mark((function t(){return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.dispatchFormEvent("file-upload-started");case 1:case"end":return t.stop()}}),t)})))),this.pond.on("processfile",Ul(Vl().mark((function t(){return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.dispatchFormEvent("file-upload-finished");case 1:case"end":return t.stop()}}),t)})))),this.pond.on("processfiles",Ul(Vl().mark((function t(){return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.dispatchFormEvent("file-upload-finished");case 1:case"end":return t.stop()}}),t)})))),this.pond.on("processfileabort",Ul(Vl().mark((function t(){return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.dispatchFormEvent("file-upload-finished");case 1:case"end":return t.stop()}}),t)})))),this.pond.on("processfilerevert",Ul(Vl().mark((function t(){return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e.dispatchFormEvent("file-upload-finished");case 1:case"end":return t.stop()}}),t)}))));case 36:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)}),dispatchFormEvent:function(t){var e;null===(e=this.$el.closest("form"))||void 0===e||e.dispatchEvent(new CustomEvent(t,{composed:!0,cancelable:!0}))},getUploadedFileUrls:(n=Ul(Vl().mark((function t(){var e;return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,c();case 2:e=t.sent,this.fileKeyIndex=null!=e?e:{},this.uploadedFileUrlIndex=Object.entries(this.fileKeyIndex).filter((function(t){return t})).reduce((function(t,e){var n=Gl(e,2),i=n[0];return t[n[1]]=i,t}),{});case 5:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)}),getFiles:(e=Ul(Vl().mark((function t(){var e,n,i,r;return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getUploadedFileUrls();case 2:e=[],n=0,i=Object.values(this.fileKeyIndex);case 4:if(!(n-1}},{key:"saving",value:function(t){if("pending"!==this.state&&"saving"!==this.state)throw new Error("Unexpected transition from ".concat(this.state," to saving"));this.state="saving",this.percent=t}},{key:"saved",value:function(t){var e,n,i;if("pending"!==this.state&&"saving"!==this.state)throw new Error("Unexpected transition from ".concat(this.state," to saved"));this.state="saved",this.id=null!==(e=null==t?void 0:t.id)&&void 0!==e?e:null,this.href=null!==(n=null==t?void 0:t.href)&&void 0!==n?n:null,this.name=null!==(i=null==t?void 0:t.name)&&void 0!==i?i:null}},{key:"isPending",value:function(){return"pending"===this.state}},{key:"isSaving",value:function(){return"saving"===this.state}},{key:"isSaved",value:function(){return"saved"===this.state}}],[{key:"traverse",value:function(t,e){return qb(t,e)}},{key:"from",value:function(e){var n,i=[],r=lc(e);try{for(r.s();!(n=r.n()).done;){var o=n.value;if(o instanceof File)i.push(new t(o));else{if(!(o instanceof t))throw new Error("Unexpected type");i.push(o)}}}catch(t){r.e(t)}finally{r.f()}return i}}]),t}();function qb(t,e){return e&&function(t){return t.items&&Array.from(t.items).some((function(t){var e=t.webkitGetAsEntry&&t.webkitGetAsEntry();return e&&e.isDirectory}))}(t)?Kb("",function(t){return Array.from(t.items).map((function(t){return t.webkitGetAsEntry()})).filter((function(t){return null!=t}))}(t)):Promise.resolve($b(Array.from(t.files||[])).map((function(t){return new Wb(t)})))}function $b(t){return Array.from(t).filter((function(t){return!function(t){return t.name.startsWith(".")}(t)}))}function Yb(t){return new Promise((function(e,n){t.file(e,n)}))}function Xb(t){return new Promise((function(e,n){var i=[],r=t.createReader();!function t(){r.readEntries((function(n){n.length>0?(i.push.apply(i,nc(n)),t()):e(i)}),n)}()}))}function Kb(t,e){return Zb.apply(this,arguments)}function Zb(){return(Zb=Ul(Vl().mark((function t(e,n){var i,r,o,a,s;return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=[],r=lc($b(n)),t.prev=2,r.s();case 4:if((o=r.n()).done){t.next=28;break}if(!(a=o.value).isDirectory){t.next=22;break}return t.t0=i.push,t.t1=i,t.t2=nc,t.t3=Kb,t.t4=a.fullPath,t.next=14,Xb(a);case 14:return t.t5=t.sent,t.next=17,(0,t.t3)(t.t4,t.t5);case 17:t.t6=t.sent,t.t7=(0,t.t2)(t.t6),t.t0.apply.call(t.t0,t.t1,t.t7),t.next=26;break;case 22:return t.next=24,Yb(a);case 24:s=t.sent,i.push(new Wb(s,e));case 26:t.next=4;break;case 28:t.next=33;break;case 30:t.prev=30,t.t8=t.catch(2),r.e(t.t8);case 33:return t.prev=33,r.f(),t.finish(33);case 36:return t.abrupt("return",i);case 37:case"end":return t.stop()}}),t,null,[[2,30,33,36]])})))).apply(this,arguments)}var Jb=function(t){Xl(i,t);var e,n=Zl(i);function i(){return ac(this,i),n.apply(this,arguments)}return uc(i,[{key:"connectedCallback",value:function(){this.addEventListener("dragenter",e_),this.addEventListener("dragover",e_),this.addEventListener("dragleave",n_),this.addEventListener("drop",i_),this.addEventListener("paste",o_),this.addEventListener("change",a_)}},{key:"disconnectedCallback",value:function(){this.removeEventListener("dragenter",e_),this.removeEventListener("dragover",e_),this.removeEventListener("dragleave",n_),this.removeEventListener("drop",i_),this.removeEventListener("paste",o_),this.removeEventListener("change",a_)}},{key:"directory",get:function(){return this.hasAttribute("directory")},set:function(t){t?this.setAttribute("directory",""):this.removeAttribute("directory")}},{key:"attach",value:(e=Ul(Vl().mark((function t(e){var n;return Vl().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(e instanceof DataTransfer)){t.next=6;break}return t.next=3,Wb.traverse(e,this.directory);case 3:t.t0=t.sent,t.next=7;break;case 6:t.t0=Wb.from(e);case 7:n=t.t0,this.dispatchEvent(new CustomEvent("file-attachment-accept",{bubbles:!0,cancelable:!0,detail:{attachments:n}}))&&n.length&&this.dispatchEvent(new CustomEvent("file-attachment-accepted",{bubbles:!0,detail:{attachments:n}}));case 10:case"end":return t.stop()}}),t,this)}))),function(t){return e.apply(this,arguments)})}]),i}($l(HTMLElement));function Qb(t){return Array.from(t.types).indexOf("Files")>=0}var t_=null;function e_(t){var e=t.currentTarget;t_&&clearTimeout(t_),t_=window.setTimeout((function(){return e.removeAttribute("hover")}),200);var n=t.dataTransfer;n&&Qb(n)&&(n.dropEffect="copy",e.setAttribute("hover",""),t.stopPropagation(),t.preventDefault())}function n_(t){t.dataTransfer&&(t.dataTransfer.dropEffect="none"),t.currentTarget.removeAttribute("hover"),t.stopPropagation(),t.preventDefault()}function i_(t){var e=t.currentTarget;if(e instanceof Jb){e.removeAttribute("hover");var n=t.dataTransfer;n&&Qb(n)&&(e.attach(n),t.stopPropagation(),t.preventDefault())}}var r_=/^image\/(gif|png|jpeg)$/;function o_(t){if(t.clipboardData&&t.clipboardData.items){var e=t.currentTarget;if(e instanceof Jb){var n=function(t){var e,n=lc(t);try{for(n.s();!(e=n.n()).done;){var i=e.value;if(r_.test(i.type))return i.getAsFile()}}catch(t){n.e(t)}finally{n.f()}return null}(t.clipboardData.items);if(n){var i=[n];e.attach(i),t.preventDefault()}}}}function a_(t){var e=t.currentTarget;if(e instanceof Jb){var n=t.target;if(n instanceof HTMLInputElement){var i=e.getAttribute("input");if(!i||n.id===i){var r=n.files;r&&0!==r.length&&(e.attach(r),n.value="")}}}}window.customElements.get("file-attachment")||(window.FileAttachmentElement=Jb,window.customElements.define("file-attachment",Jb));var s_=["[data-md-button]","md-header","md-bold","md-italic","md-quote","md-code","md-link","md-image","md-unordered-list","md-ordered-list","md-task-list","md-mention","md-ref","md-strikethrough"];function u_(t){var e,n=[],i=lc(t.querySelectorAll(s_.join(", ")));try{for(i.s();!(e=i.n()).done;){var r=e.value;r.hidden||r.offsetWidth<=0&&r.offsetHeight<=0||r.closest("markdown-toolbar")===t&&n.push(r)}}catch(t){i.e(t)}finally{i.f()}return n}var l_=new WeakMap,c_=function(t){Xl(n,t);var e=Zl(n);function n(){var t;ac(this,n);var i,r=function(){var e=l_.get(Ql(t));e&&N_(Ql(t),e)};return(t=e.call(this)).addEventListener("keydown",(i=r,function(t){" "!==t.key&&"Enter"!==t.key||(t.preventDefault(),i(t))})),t.addEventListener("click",r),t}return uc(n,[{key:"connectedCallback",value:function(){this.hasAttribute("role")||this.setAttribute("role","button")}},{key:"click",value:function(){var t=l_.get(this);t&&N_(this,t)}}]),n}($l(HTMLElement)),h_=function(t){Xl(n,t);var e=Zl(n);function n(){var t;ac(this,n),t=e.call(this);var i=parseInt(t.getAttribute("level")||"3",10);if(i<1||i>6)return Jl(t);var r="".concat("#".repeat(i)," ");return l_.set(Ql(t),{prefix:r}),t}return uc(n)}(c_);window.customElements.get("md-header")||(window.MarkdownHeaderButtonElement=h_,window.customElements.define("md-header",h_));var d_=function(t){Xl(n,t);var e=Zl(n);function n(){var t;return ac(this,n),t=e.call(this),l_.set(Ql(t),{prefix:"**",suffix:"**",trimFirst:!0}),t}return uc(n,[{key:"connectedCallback",value:function(){Wl(ec(n.prototype),"connectedCallback",this).call(this),this.setAttribute("hotkey","b")}}]),n}(c_);window.customElements.get("md-bold")||(window.MarkdownBoldButtonElement=d_,window.customElements.define("md-bold",d_));var f_=function(t){Xl(n,t);var e=Zl(n);function n(){var t;return ac(this,n),t=e.call(this),l_.set(Ql(t),{prefix:"_",suffix:"_",trimFirst:!0}),t}return uc(n,[{key:"connectedCallback",value:function(){Wl(ec(n.prototype),"connectedCallback",this).call(this),this.setAttribute("hotkey","i")}}]),n}(c_);window.customElements.get("md-italic")||(window.MarkdownItalicButtonElement=f_,window.customElements.define("md-italic",f_));var p_=function(t){Xl(n,t);var e=Zl(n);function n(){var t;return ac(this,n),t=e.call(this),l_.set(Ql(t),{prefix:"> ",multiline:!0,surroundWithNewlines:!0}),t}return uc(n,[{key:"connectedCallback",value:function(){Wl(ec(n.prototype),"connectedCallback",this).call(this),this.setAttribute("hotkey","."),this.setAttribute("hotkey-requires-shift","true")}}]),n}(c_);window.customElements.get("md-quote")||(window.MarkdownQuoteButtonElement=p_,window.customElements.define("md-quote",p_));var g_=function(t){Xl(n,t);var e=Zl(n);function n(){var t;return ac(this,n),t=e.call(this),l_.set(Ql(t),{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"}),t}return uc(n,[{key:"connectedCallback",value:function(){Wl(ec(n.prototype),"connectedCallback",this).call(this),this.setAttribute("hotkey","e")}}]),n}(c_);window.customElements.get("md-code")||(window.MarkdownCodeButtonElement=g_,window.customElements.define("md-code",g_));var m_=function(t){Xl(n,t);var e=Zl(n);function n(){var t;return ac(this,n),t=e.call(this),l_.set(Ql(t),{prefix:"[",suffix:"](url)",replaceNext:"url",scanFor:"https?://"}),t}return uc(n,[{key:"connectedCallback",value:function(){Wl(ec(n.prototype),"connectedCallback",this).call(this),this.setAttribute("hotkey","k")}}]),n}(c_);window.customElements.get("md-link")||(window.MarkdownLinkButtonElement=m_,window.customElements.define("md-link",m_));var v_=function(t){Xl(n,t);var e=Zl(n);function n(){var t;return ac(this,n),t=e.call(this),l_.set(Ql(t),{prefix:"![",suffix:"](url)",replaceNext:"url",scanFor:"https?://"}),t}return uc(n)}(c_);window.customElements.get("md-image")||(window.MarkdownImageButtonElement=v_,window.customElements.define("md-image",v_));var y_=function(t){Xl(n,t);var e=Zl(n);function n(){var t;return ac(this,n),t=e.call(this),l_.set(Ql(t),{prefix:"- ",multiline:!0,surroundWithNewlines:!0}),t}return uc(n,[{key:"connectedCallback",value:function(){Wl(ec(n.prototype),"connectedCallback",this).call(this),this.setAttribute("hotkey","8"),this.setAttribute("hotkey-requires-shift","true")}}]),n}(c_);window.customElements.get("md-unordered-list")||(window.MarkdownUnorderedListButtonElement=y_,window.customElements.define("md-unordered-list",y_));var b_=function(t){Xl(n,t);var e=Zl(n);function n(){var t;return ac(this,n),t=e.call(this),l_.set(Ql(t),{prefix:"1. ",multiline:!0,orderedList:!0}),t}return uc(n,[{key:"connectedCallback",value:function(){Wl(ec(n.prototype),"connectedCallback",this).call(this),this.setAttribute("hotkey","7"),this.setAttribute("hotkey-requires-shift","true")}}]),n}(c_);window.customElements.get("md-ordered-list")||(window.MarkdownOrderedListButtonElement=b_,window.customElements.define("md-ordered-list",b_));var __=function(t){Xl(n,t);var e=Zl(n);function n(){var t;return ac(this,n),t=e.call(this),l_.set(Ql(t),{prefix:"- [ ] ",multiline:!0,surroundWithNewlines:!0}),t}return uc(n,[{key:"connectedCallback",value:function(){Wl(ec(n.prototype),"connectedCallback",this).call(this),this.setAttribute("hotkey","L")}}]),n}(c_);window.customElements.get("md-task-list")||(window.MarkdownTaskListButtonElement=__,window.customElements.define("md-task-list",__));var E_=function(t){Xl(n,t);var e=Zl(n);function n(){var t;return ac(this,n),t=e.call(this),l_.set(Ql(t),{prefix:"@",prefixSpace:!0}),t}return uc(n)}(c_);window.customElements.get("md-mention")||(window.MarkdownMentionButtonElement=E_,window.customElements.define("md-mention",E_));var x_=function(t){Xl(n,t);var e=Zl(n);function n(){var t;return ac(this,n),t=e.call(this),l_.set(Ql(t),{prefix:"#",prefixSpace:!0}),t}return uc(n)}(c_);window.customElements.get("md-ref")||(window.MarkdownRefButtonElement=x_,window.customElements.define("md-ref",x_));var w_=function(t){Xl(n,t);var e=Zl(n);function n(){var t;return ac(this,n),t=e.call(this),l_.set(Ql(t),{prefix:"~~",suffix:"~~",trimFirst:!0}),t}return uc(n)}(c_);window.customElements.get("md-strikethrough")||(window.MarkdownStrikethroughButtonElement=w_,window.customElements.define("md-strikethrough",w_));var A_=navigator.userAgent.match(/Macintosh/)?"Meta":"Control",D_=function(t){Xl(n,t);var e=Zl(n);function n(){return ac(this,n),e.call(this)}return uc(n,[{key:"connectedCallback",value:function(){this.hasAttribute("role")||this.setAttribute("role","toolbar"),this.addEventListener("keydown",k_);var t=S_.bind(null,this);this.field&&(this.field.addEventListener("keydown",t),C_.set(this,t)),this.setAttribute("tabindex","0"),this.addEventListener("focus",T_,{once:!0})}},{key:"disconnectedCallback",value:function(){var t=C_.get(this);t&&this.field&&(this.field.removeEventListener("keydown",t),C_.delete(this)),this.removeEventListener("keydown",k_)}},{key:"field",get:function(){var t=this.getAttribute("for");if(!t)return null;var e,n="getRootNode"in this?this.getRootNode():document;return(n instanceof Document||n instanceof ShadowRoot)&&(e=n.getElementById(t)),e instanceof HTMLTextAreaElement?e:null}}]),n}($l(HTMLElement));function T_(t){var e=t.target;if(e instanceof Element){e.removeAttribute("tabindex");var n,i="0",r=lc(u_(e));try{for(r.s();!(n=r.n()).done;){var o=n.value;o.setAttribute("tabindex",i),"0"===i&&(o.focus(),i="-1")}}catch(t){r.e(t)}finally{r.f()}}}function k_(t){var e=t.key;if("ArrowRight"===e||"ArrowLeft"===e||"Home"===e||"End"===e){var n=t.currentTarget;if(n instanceof HTMLElement){var i=u_(n),r=i.indexOf(t.target),o=i.length;if(-1!==r){var a=0;"ArrowLeft"===e&&(a=r-1),"ArrowRight"===e&&(a=r+1),"End"===e&&(a=o-1),a<0&&(a=o-1),a>o-1&&(a=0);for(var s=0;s1}function O_(t,e){return Array(e+1).join(t)}function M_(t,e){for(var n=e;t[n]&&null!=t[n-1]&&!t[n-1].match(/\s/);)n--;return n}function R_(t,e,n){for(var i=e,r=n?/\n/:/\s/;t[i]&&!t[i].match(r);)i++;return i}window.customElements.get("markdown-toolbar")||(window.MarkdownToolbarElement=D_,window.customElements.define("markdown-toolbar",D_));var L_=null;function P_(t,e){var n,i=t.value.slice(t.selectionStart,t.selectionEnd);n=e.orderedList?function(t){var e,n,i,r,o=/^\d+\.\s+/,a=t.selectionStart===t.selectionEnd,s=t.value.slice(t.selectionStart,t.selectionEnd),u=s,l=s.split("\n");if(a){var c=t.value.slice(0,t.selectionStart).split(/\n/);i=t.selectionStart-c[c.length-1].length,r=R_(t.value,t.selectionStart,!0),u=t.value.slice(i,r)}var h=u.split("\n");if(h.every((function(t){return o.test(t)}))){if(s=(l=h.map((function(t){return t.replace(o,"")}))).join("\n"),a&&i&&r){var d=h[0].length-l[0].length;n=e=t.selectionStart-d,t.selectionStart=i,t.selectionEnd=r}}else{s=(l=function(t){var e,n,i,r=[];for(i=e=0,n=t.length;e0?"".concat(r,"\n"):n,p=I_(d)&&o.length>0?"\n".concat(o):i;if(s){var g=t.value[t.selectionStart-1];0===t.selectionStart||null==g||g.match(/\s/)||(f=" ".concat(f))}d=function(t,e,n){var i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(t.selectionStart===t.selectionEnd)t.selectionStart=M_(t.value,t.selectionStart),t.selectionEnd=R_(t.value,t.selectionEnd,i);else{var r=t.selectionStart-e.length,o=t.selectionEnd+n.length,a=t.value.slice(r,t.selectionStart)===e,s=t.value.slice(t.selectionEnd,o)===n;a&&s&&(t.selectionStart=r,t.selectionEnd=o)}return t.value.slice(t.selectionStart,t.selectionEnd)}(t,f,p,e.multiline);var m=t.selectionStart,v=t.selectionEnd,y=a.length>0&&p.indexOf(a)>-1&&d.length>0;if(l){var b=F_(t);f=b.newlinesToAppend+n,p+=b.newlinesToPrepend}if(d.startsWith(f)&&d.endsWith(p)){var _=d.slice(f.length,d.length-p.length);if(c===h){var E=c-f.length;E=Math.max(E,m),m=v=E=Math.min(E,m+_.length)}else v=m+_.length;return{text:_,selectionStart:m,selectionEnd:v}}if(y)return u.length>0&&d.match(u)?{text:f+(p=p.replace(a,d)),selectionStart:m=v=m+f.length,selectionEnd:v}:{text:f+d+p,selectionStart:m=m+f.length+d.length+p.indexOf(a),selectionEnd:v=m+a.length};var x=f+d+p;m=c+f.length,v=h+f.length;var w=d.match(/^\s*|\s*$/g);if(e.trimFirst&&w){var A=w[0]||"",D=w[1]||"";x=A+f+d.trim()+p+D,m+=A.length,v-=D.length}return{text:x,selectionStart:m,selectionEnd:v}}(t,e),function(t,e){var n=e.text,i=e.selectionStart,r=e.selectionEnd,o=t.selectionStart,a=t.value.slice(0,o),s=t.value.slice(t.selectionEnd);if(null===L_||!0===L_){t.contentEditable="true";try{L_=document.execCommand("insertText",!1,n)}catch(t){L_=!1}t.contentEditable="false"}if(L_&&!t.value.slice(0,t.selectionStart).endsWith(n)&&(L_=!1),!L_){try{document.execCommand("ms-beginUndoUnit")}catch(t){}t.value=a+n+s;try{document.execCommand("ms-endUndoUnit")}catch(t){}t.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0}))}null!=i&&null!=r?t.setSelectionRange(i,r):t.setSelectionRange(o,t.selectionEnd)}(t,n)}function F_(t){var e,n,i=t.value.slice(0,t.selectionStart),r=t.value.slice(t.selectionEnd),o=i.match(/\n*$/),a=r.match(/^\n*/),s=o?o[0].length:0,u=a?a[0].length:0;return i.match(/\S/)&&s<2&&(e=O_("\n",2-s)),r.match(/\S/)&&u<2&&(n=O_("\n",2-u)),null==e&&(e=""),null==n&&(n=""),{newlinesToAppend:e,newlinesToPrepend:n}}function N_(t,e){var n=t.closest("markdown-toolbar");if(n instanceof D_){var i=Object.assign(Object.assign({},{prefix:"",suffix:"",blockPrefix:"",blockSuffix:"",multiline:!1,replaceNext:"",prefixSpace:!1,scanFor:"",surroundWithNewlines:!1,orderedList:!1,trimFirst:!1}),e),r=n.field;r&&(r.focus(),P_(r,i))}} -/*! @license DOMPurify 2.3.9 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.9/LICENSE */function B_(t){return(B_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function j_(t,e){return(j_=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function V_(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function z_(t,e,n){return(z_=V_()?Reflect.construct:function(t,e,n){var i=[null];i.push.apply(i,e);var r=new(Function.bind.apply(t,i));return n&&j_(r,n.prototype),r}).apply(null,arguments)}function U_(t){return function(t){if(Array.isArray(t))return G_(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return G_(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return G_(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function G_(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n1?n-1:0),r=1;r/gm),SE=K_(/^data-[\-\w.\u00B7-\uFFFF]/),IE=K_(/^aria-[\-\w]+$/),OE=K_(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ME=K_(/^(?:\w+script|data):/i),RE=K_(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),LE=K_(/^html$/i),PE=function(){return"undefined"==typeof window?null:window},FE=function(t,e){if("object"!==B_(t)||"function"!=typeof t.createPolicy)return null;var n=null,i="data-tt-policy-suffix";e.currentScript&&e.currentScript.hasAttribute(i)&&(n=e.currentScript.getAttribute(i));var r="dompurify"+(n?"#"+n:"");try{return t.createPolicy(r,{createHTML:function(t){return t}})}catch(t){return console.warn("TrustedTypes policy "+r+" could not be created."),null}};var NE=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:PE(),n=function(e){return t(e)};if(n.version="2.3.9",n.removed=[],!e||!e.document||9!==e.document.nodeType)return n.isSupported=!1,n;var i=e.document,r=e.document,o=e.DocumentFragment,a=e.HTMLTemplateElement,s=e.Node,u=e.Element,l=e.NodeFilter,c=e.NamedNodeMap,h=void 0===c?e.NamedNodeMap||e.MozNamedAttrMap:c,d=e.HTMLFormElement,f=e.DOMParser,p=e.trustedTypes,g=u.prototype,m=gE(g,"cloneNode"),v=gE(g,"nextSibling"),y=gE(g,"childNodes"),b=gE(g,"parentNode");if("function"==typeof a){var _=r.createElement("template");_.content&&_.content.ownerDocument&&(r=_.content.ownerDocument)}var E=FE(p,i),x=E?E.createHTML(""):"",w=r,A=w.implementation,D=w.createNodeIterator,T=w.createDocumentFragment,k=w.getElementsByTagName,C=i.importNode,S={};try{S=pE(r).documentMode?r.documentMode:{}}catch(t){}var I={};n.isSupported="function"==typeof b&&A&&void 0!==A.createHTMLDocument&&9!==S;var O,M,R=kE,L=CE,P=SE,F=IE,N=ME,B=RE,j=OE,V=null,z=fE({},[].concat(U_(mE),U_(vE),U_(yE),U_(_E),U_(xE))),U=null,G=fE({},[].concat(U_(wE),U_(AE),U_(DE),U_(TE))),H=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),W=null,q=null,$=!0,Y=!0,X=!1,K=!1,Z=!1,J=!1,Q=!1,tt=!1,et=!1,nt=!1,it=!0,rt=!0,ot=!1,at={},st=null,ut=fE({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),lt=null,ct=fE({},["audio","video","img","source","image","track"]),ht=null,dt=fE({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ft="http://www.w3.org/1998/Math/MathML",pt="http://www.w3.org/2000/svg",gt="http://www.w3.org/1999/xhtml",mt=gt,vt=!1,yt=["application/xhtml+xml","text/html"],bt="text/html",_t=null,Et=r.createElement("form"),xt=function(t){return t instanceof RegExp||t instanceof Function},wt=function(t){_t&&_t===t||(t&&"object"===B_(t)||(t={}),t=pE(t),O=O=-1===yt.indexOf(t.PARSER_MEDIA_TYPE)?bt:t.PARSER_MEDIA_TYPE,M="application/xhtml+xml"===O?function(t){return t}:oE,V="ALLOWED_TAGS"in t?fE({},t.ALLOWED_TAGS,M):z,U="ALLOWED_ATTR"in t?fE({},t.ALLOWED_ATTR,M):G,ht="ADD_URI_SAFE_ATTR"in t?fE(pE(dt),t.ADD_URI_SAFE_ATTR,M):dt,lt="ADD_DATA_URI_TAGS"in t?fE(pE(ct),t.ADD_DATA_URI_TAGS,M):ct,st="FORBID_CONTENTS"in t?fE({},t.FORBID_CONTENTS,M):ut,W="FORBID_TAGS"in t?fE({},t.FORBID_TAGS,M):{},q="FORBID_ATTR"in t?fE({},t.FORBID_ATTR,M):{},at="USE_PROFILES"in t&&t.USE_PROFILES,$=!1!==t.ALLOW_ARIA_ATTR,Y=!1!==t.ALLOW_DATA_ATTR,X=t.ALLOW_UNKNOWN_PROTOCOLS||!1,K=t.SAFE_FOR_TEMPLATES||!1,Z=t.WHOLE_DOCUMENT||!1,tt=t.RETURN_DOM||!1,et=t.RETURN_DOM_FRAGMENT||!1,nt=t.RETURN_TRUSTED_TYPE||!1,Q=t.FORCE_BODY||!1,it=!1!==t.SANITIZE_DOM,rt=!1!==t.KEEP_CONTENT,ot=t.IN_PLACE||!1,j=t.ALLOWED_URI_REGEXP||j,mt=t.NAMESPACE||gt,t.CUSTOM_ELEMENT_HANDLING&&xt(t.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(H.tagNameCheck=t.CUSTOM_ELEMENT_HANDLING.tagNameCheck),t.CUSTOM_ELEMENT_HANDLING&&xt(t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(H.attributeNameCheck=t.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),t.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(H.allowCustomizedBuiltInElements=t.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),K&&(Y=!1),et&&(tt=!0),at&&(V=fE({},U_(xE)),U=[],!0===at.html&&(fE(V,mE),fE(U,wE)),!0===at.svg&&(fE(V,vE),fE(U,AE),fE(U,TE)),!0===at.svgFilters&&(fE(V,yE),fE(U,AE),fE(U,TE)),!0===at.mathMl&&(fE(V,_E),fE(U,DE),fE(U,TE))),t.ADD_TAGS&&(V===z&&(V=pE(V)),fE(V,t.ADD_TAGS,M)),t.ADD_ATTR&&(U===G&&(U=pE(U)),fE(U,t.ADD_ATTR,M)),t.ADD_URI_SAFE_ATTR&&fE(ht,t.ADD_URI_SAFE_ATTR,M),t.FORBID_CONTENTS&&(st===ut&&(st=pE(st)),fE(st,t.FORBID_CONTENTS,M)),rt&&(V["#text"]=!0),Z&&fE(V,["html","head","body"]),V.table&&(fE(V,["tbody"]),delete W.tbody),X_&&X_(t),_t=t)},At=fE({},["mi","mo","mn","ms","mtext"]),Dt=fE({},["foreignobject","desc","title","annotation-xml"]),Tt=fE({},["title","style","font","a","script"]),kt=fE({},vE);fE(kt,yE),fE(kt,bE);var Ct=fE({},_E);fE(Ct,EE);var St=function(t){var e=b(t);e&&e.tagName||(e={namespaceURI:gt,tagName:"template"});var n=oE(t.tagName),i=oE(e.tagName);return t.namespaceURI===pt?e.namespaceURI===gt?"svg"===n:e.namespaceURI===ft?"svg"===n&&("annotation-xml"===i||At[i]):Boolean(kt[n]):t.namespaceURI===ft?e.namespaceURI===gt?"math"===n:e.namespaceURI===pt?"math"===n&&Dt[i]:Boolean(Ct[n]):t.namespaceURI===gt&&(!(e.namespaceURI===pt&&!Dt[i])&&(!(e.namespaceURI===ft&&!At[i])&&(!Ct[n]&&(Tt[n]||!kt[n]))))},It=function(t){rE(n.removed,{element:t});try{t.parentNode.removeChild(t)}catch(e){try{t.outerHTML=x}catch(e){t.remove()}}},Ot=function(t,e){try{rE(n.removed,{attribute:e.getAttributeNode(t),from:e})}catch(t){rE(n.removed,{attribute:null,from:e})}if(e.removeAttribute(t),"is"===t&&!U[t])if(tt||et)try{It(e)}catch(t){}else try{e.setAttribute(t,"")}catch(t){}},Mt=function(t){var e,n;if(Q)t=""+t;else{var i=aE(t,/^[\r\n\t ]+/);n=i&&i[0]}"application/xhtml+xml"===O&&(t=''+t+"");var o=E?E.createHTML(t):t;if(mt===gt)try{e=(new f).parseFromString(o,O)}catch(t){}if(!e||!e.documentElement){e=A.createDocument(mt,"template",null);try{e.documentElement.innerHTML=vt?"":o}catch(t){}}var a=e.body||e.documentElement;return t&&n&&a.insertBefore(r.createTextNode(n),a.childNodes[0]||null),mt===gt?k.call(e,Z?"html":"body")[0]:Z?e.documentElement:a},Rt=function(t){return D.call(t.ownerDocument||t,t,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT,null,!1)},Lt=function(t){return t instanceof d&&("string"!=typeof t.nodeName||"string"!=typeof t.textContent||"function"!=typeof t.removeChild||!(t.attributes instanceof h)||"function"!=typeof t.removeAttribute||"function"!=typeof t.setAttribute||"string"!=typeof t.namespaceURI||"function"!=typeof t.insertBefore)},Pt=function(t){return"object"===B_(s)?t instanceof s:t&&"object"===B_(t)&&"number"==typeof t.nodeType&&"string"==typeof t.nodeName},Ft=function(t,e,i){I[t]&&nE(I[t],(function(t){t.call(n,e,i,_t)}))},Nt=function(t){var e;if(Ft("beforeSanitizeElements",t,null),Lt(t))return It(t),!0;if(cE(/[\u0080-\uFFFF]/,t.nodeName))return It(t),!0;var i=M(t.nodeName);if(Ft("uponSanitizeElement",t,{tagName:i,allowedTags:V}),t.hasChildNodes()&&!Pt(t.firstElementChild)&&(!Pt(t.content)||!Pt(t.content.firstElementChild))&&cE(/<[/\w]/g,t.innerHTML)&&cE(/<[/\w]/g,t.textContent))return It(t),!0;if("select"===i&&cE(/