ados-rcm 1.1.697 → 1.1.698
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.
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -477,7 +477,7 @@ received: ${n.quality}
|
|
|
477
477
|
received: ${n.imageType}
|
|
478
478
|
-> using default image/jpeg`),n.imageType="image/jpeg")}function wz(n,e){n.keepImageTypes??(n.keepImageTypes=[]),n.keepImageTypes&&!Array.isArray(n.keepImageTypes)&&(e.warn(`quill.imageCompressor: [config error] 'keepImageTypes' is required to be a "array", received: ${n.keepImageTypes} -> using default []`),n.keepImageTypes=[]),n.ignoreImageTypes??(n.ignoreImageTypes=[]),n.ignoreImageTypes&&!Array.isArray(n.ignoreImageTypes)&&(e.warn(`quill.imageCompressor: [config error] 'ignoreImageTypes' is required to be a "array", received: ${n.ignoreImageTypes} -> using default []`),n.ignoreImageTypes=[])}function Cz(n,e){n.handleOnPaste&&typeof n.handleOnPaste!="boolean"&&typeof n.handleOnPaste!="function"&&(e.warn(`quill.imageCompressor: [config error] 'handlePaste' is required to be a "boolean" or a "function", received: ${n.ignoreImageTypes} -> using default true`),n.handleOnPaste=!0),n.insertIntoEditor&&typeof n.insertIntoEditor!="function"&&(e.warn(`quill.imageCompressor: [config error] 'insertIntoEditor' is required to be a "function", received: ${n.insertIntoEditor} -> using default undefined`),n.insertIntoEditor=void 0)}function Lw(n){return!!/^image\/(gif|jpe?g|a?png|svg|webp|bmp)/i.exec(n)}class _z{constructor(e,t,r,i){Te(this,"localDrag",!1);this.quill=e,this.onNewDataUrl=t,this.logger=r,this.handleOnPaste=i,this.quill.root.addEventListener("dragstart",o=>this.handleDragStart(o),!1),this.quill.root.addEventListener("dragend",o=>this.handleDragEnd(o),!1),this.quill.root.addEventListener("drop",o=>this.handleDrop(o),!0),this.handleOnPaste!==!1&&this.quill.root.addEventListener("paste",o=>this.handlePaste(o),!0)}handleDragStart(e){this.localDrag=!0}handleDragEnd(e){this.localDrag=!1}async handleDrop(e){var l,a,u,g;if(this.localDrag)return;e.preventDefault();const t=document.getSelection();if(t&&document.caretPositionFromPoint){const m=document.caretPositionFromPoint(e.clientX,e.clientY);m&&t.setBaseAndExtent(m.offsetNode,m.offset,m.offsetNode,m.offset)}this.logger.log("handleDrop",{evt:e});const r=(l=e.dataTransfer)==null?void 0:l.files,i=Array.from(r||[]).filter(m=>Lw(m.type));if(i.length>0){e.stopPropagation(),this.logger.log("handleDrop","found files",{evt:e,files:r,imageFiles:i}),await this.pasteFilesIntoQuill(i);return}if((a=e.dataTransfer)!=null&&a.items){e.stopPropagation(),this.logger.log("handleDrop","found items",{evt:e,files:r,imageFiles:i}),await this.handleDataTransferList((u=e.dataTransfer)==null?void 0:u.items,e);return}const o=(g=e.dataTransfer)==null?void 0:g.getData("URL");if(this.logger.log("handleDrop","trying getData('URL')",{draggedUrl:o}),o){const m=await(await fetch(o)).blob();this.logger.log("handleDrop","blob from drag event",{evt:e,files:r,imageFiles:i}),await this.pasteFilesIntoQuill([m])}}async handlePaste(e){var t;typeof this.handleOnPaste=="function"&&!this.handleOnPaste(e)||await this.handleDataTransferList((t=e.clipboardData)==null?void 0:t.items,e)}async handleDataTransferList(e,t){const r=Array.from(e||[]),i=r.filter(a=>a.kind==="file"&&Lw(a.type)),o=r.map(a=>({type:a.type,kind:a.kind}));if(this.logger.log("handleDataTransferList",{fileTypes:o,imageCount:i.length}),!i.length)return;t.preventDefault(),t.stopPropagation();const l=i.map(a=>a.getAsFile());await this.pasteFilesIntoQuill(l)}async pasteFilesIntoQuill(e){this.logger.log(" pasteFilesIntoQuill",`pasting ${e.length} images...`),await Promise.all(e.map(async(t,r)=>{if(!t)return;const i=await R4(t);this.logger.log(" pasteFilesIntoQuill",`pasting image (${r})`),this.onNewDataUrl(i)})),this.logger.log(" pasteFilesIntoQuill","done")}}class Fp{constructor(e,t){Te(this,"quill");Te(this,"range");Te(this,"options");Te(this,"imageDrop");Te(this,"fileHolder");Te(this,"Logger");this.quill=e,this.options=t||{};const r=!!t.debug,i=!!t.suppressErrorLogging;this.Logger=new gz(r,i),bz(t,this.Logger);const o=async a=>{this.Logger.log("onImageDrop",{dataUrl:a});const u=await this.downscaleImageFromUrl(a);this.insertToEditor(u,Fp.b64toBlob(u))};this.imageDrop=new _z(e,o,this.Logger,typeof this.options.handleOnPaste=="function"?this.options.handleOnPaste:this.options.handleOnPaste!==!1),this.Logger.log("fileChanged",{options:t,quill:e,debug:r});const l=this.quill.getModule("toolbar");l?l.addHandler("image",()=>this.selectLocalImage()):this.Logger.error("Quill toolbar module not found! need { toolbar: // options } in Quill.modules for image icon to sit in")}static b64toBlob(e){const t=atob(e.split(",")[1]),r=e.slice(5).split(";")[0],i=new ArrayBuffer(t.length);let o=new Uint8Array(i);for(let l=0;l<t.length;l++)o[l]=t.charCodeAt(l);return new Blob([i],{type:r})}destroy(){this.imageDrop&&console.warn("ImageDrop instance cleanup")}selectLocalImage(e){this.range=this.quill.getSelection(),this.fileHolder=document.createElement("input"),this.fileHolder.setAttribute("type","file"),this.fileHolder.setAttribute("accept","image/*"),this.fileHolder.setAttribute("style","visibility:hidden"),this.fileHolder.onchange=()=>this.fileChanged().then(()=>e&&e()),document.body.appendChild(this.fileHolder),this.fileHolder.click(),window.requestAnimationFrame(()=>{this.fileHolder&&document.body.removeChild(this.fileHolder)})}async fileChanged(e){var l;const t=e||((l=this.fileHolder)==null?void 0:l.files);if(!(t!=null&&t.length))return;const r=t[0];if(this.Logger.log("fileChanged",{file:r}),!r)return;const i=await R4(r),o=await this.downscaleImageFromUrl(i);this.insertToEditor(o,Fp.b64toBlob(o))}async downscaleImageFromUrl(e){const t=await vz(this.Logger,e,{maxWidth:this.options.maxWidth,maxHeight:this.options.maxHeight,imageType:this.options.imageType,keepImageTypes:this.options.keepImageTypes,ignoreImageTypes:this.options.ignoreImageTypes,imageQuality:this.options.quality});return this.Logger.log("downscaleImageFromUrl",{dataUrl:e,dataUrlCompressed:t}),t}insertToEditor(e,t){if(this.options.insertIntoEditor)this.options.insertIntoEditor(e,t,this.quill);else{this.Logger.log("insertToEditor",{url:e}),this.range=this.quill.getSelection();const r=this.range;if(!r)return;this.logFileSize(e),this.quill.insertEmbed(r.index,"image",`${e}`,"user"),r.index++,this.quill.setSelection(r,"api")}}logFileSize(e){const i=(Math.round((e.length-"data:image/png;base64,".length)*3/4)/1024).toFixed(0);this.Logger.log("estimated img size: "+i+" kb")}}window.imageCompressor=Fp;const Bp={OVERLAY:"ql-image-resizer-overlay",HANDLE:"ql-image-resizer-handle",DISPLAY:"ql-image-resizer-display",TOOLBAR:"ql-image-resizer-toolbar",TOOLBAR_BUTTON:"ql-image-resizer-toolbar-button"},Zd={BACKSPACE:8,DELETE:46,LEFT:37,UP:38,RIGHT:39,DOWN:40},D0=(n,e)=>{const t=n?"top":"bottom",r=e?"left":"right",i=n===e?"nwse-resize":"nesw-resize";return{[t]:"-5px",[r]:"-5px",cursor:i}},Sz={tl:D0(!0,!0),tr:D0(!0,!1),bl:D0(!1,!0),br:D0(!1,!1)},Tz={modules:["DisplaySize","Toolbar","Resize","Keyboard"],embedTags:["VIDEO","IFRAME"],tools:["left","center","right","justify"],contentOptions:[{attribute:["width"],limit:{minWidth:100},blotName:"image"},{attribute:["width","height"],limit:{minWidth:200,ratio:.5625},blotName:"video"}]},Az=Xe.import("formats/image");class q0 extends Az{static get ATTRIBUTES(){return["alt","height","width","class","style","data-align"]}static formats(e){return this.ATTRIBUTES.reduce((t,r)=>(e.hasAttribute(r)&&(t[r]=e.getAttribute(r)??""),t),{})}format(e,t){this.constructor.ATTRIBUTES.indexOf(e)>-1?t?this.domNode.setAttribute(e,t):this.domNode.removeAttribute(e):super.format(e,t)}}Te(q0,"blotName","image"),Te(q0,"tagName","img"),Te(q0,"scope",Qn.INLINE);Xe.register("formats/image",q0,!0);class Xp{constructor(e){Te(this,"resizer");Te(this,"quill");Te(this,"overlay");Te(this,"activeEle");Te(this,"blot");Te(this,"options");Te(this,"requestUpdate");this.resizer=e,this.quill=e.quill,this.overlay=e.overlay,this.activeEle=e.activeEle,this.blot=e.blot,this.options=e.options,this.requestUpdate=()=>e.onUpdate(!0)}onCreate(){}onDestroy(){}onUpdate(){}}class Ez extends Xp{constructor(){super(...arguments);Te(this,"display")}onCreate(){var t;this.display=document.createElement("div"),this.display.className=Ff[Bp.DISPLAY],(t=this.overlay)==null||t.appendChild(this.display)}onUpdate(){if(!this.display||!this.activeEle)return;const[t,r]=[this.activeEle.offsetWidth,this.activeEle.offsetHeight];this.display.innerHTML=`${t} × ${r}`,this.positionDisplay(t,r)}positionDisplay(t,r){var a;if(!this.display)return;const i=this.display.getBoundingClientRect(),o=t>120&&r>30,l=((a=this.activeEle)==null?void 0:a.style.float)==="right";Object.assign(this.display.style,{right:o?"4px":l?"auto":`-${i.width+4}px`,bottom:o?"4px":`-${i.height+4}px`,left:o?"auto":l?`-${i.width+4}px`:"auto"})}}class Rz extends Xp{constructor(){super(...arguments);Te(this,"boxes",[]);Te(this,"dragBox",null);Te(this,"dragStartX",0);Te(this,"dragStartY",0);Te(this,"contentOption");Te(this,"preDragSize",{width:0,height:0});Te(this,"naturalSize",[0,0]);Te(this,"handleDragProxy",null);Te(this,"handleMouseupProxy",null);Te(this,"handleMousedown",t=>{!this.blot||!this.activeEle||(this.dragBox=t.target,this.dragStartX=t.clientX,this.dragStartY=t.clientY,this.preDragSize={width:this.activeEle.offsetWidth,height:this.activeEle.offsetHeight},this.naturalSize=this.getNaturalSize(),this.setCursor(window.getComputedStyle(this.dragBox).cursor),this.handleDragProxy=this.handleDrag.bind(this),this.handleMouseupProxy=this.handleMouseup.bind(this),document.addEventListener("mousemove",this.handleDragProxy,!0),document.addEventListener("mouseup",this.handleMouseupProxy,!0))});Te(this,"handleMouseup",t=>{if(!this.activeEle||!this.blot||!this.contentOption)return;const r=this.calcSize(t,this.contentOption.limit);Object.assign(this.activeEle,r),Object.assign(this.activeEle.style,{width:null,height:null}),this.setCursor(""),this.removeEventListeners()});Te(this,"handleDrag",t=>{!this.activeEle||!this.blot||!this.contentOption||(Object.assign(this.activeEle.style,this.calcSize(t,{...this.contentOption.limit,unit:!0})),this.requestUpdate())});Te(this,"handleDoubleClick",t=>{if(!this.blot||!this.activeEle||!this.contentOption)return;t.stopPropagation();const[r,i]=this.naturalSize,o={};this.contentOption.attribute.includes("width")&&(o.width=r),this.contentOption.attribute.includes("height")&&(o.height=i);const l=this.applyConstraints(o,this.contentOption.limit);Object.assign(this.activeEle,l),this.requestUpdate()})}onCreate(){!this.blot||!this.options.contentOptions||(this.contentOption=this.options.contentOptions.find(t=>t.blotName===this.blot.statics.blotName),this.boxes=[],["tl","tr","br","bl"].forEach(this.addBox.bind(this)))}onDestroy(){this.setCursor("")}addBox(t){var i;const r=document.createElement("div");r.className=`${Ff[Bp.HANDLE]} ${t}`,r.addEventListener("mousedown",this.handleMousedown,!1),r.addEventListener("dblclick",this.handleDoubleClick,!1),Object.assign(r.style,Sz[t]),(i=this.overlay)==null||i.appendChild(r),this.boxes.push(r)}removeEventListeners(){this.handleDragProxy&&(document.removeEventListener("mousemove",this.handleDragProxy,!0),this.handleDragProxy=null),this.handleMouseupProxy&&(document.removeEventListener("mouseup",this.handleMouseupProxy,!0),this.handleMouseupProxy=null)}calcSize(t,r={}){var u;if(!this.dragBox||!this.activeEle)return{};const i=t.clientX-this.dragStartX,o=t.clientY-this.dragStartY,l=this.dragBox===this.boxes[0]||this.dragBox===this.boxes[3]?-1:1,a={};return(u=this.contentOption)!=null&&u.attribute?this.contentOption.attribute.forEach(g=>a[g]=this.preDragSize[g]):a.width=this.preDragSize.width,a.width&&(a.width=Math.round(this.preDragSize.width+i*l)),a.height&&(a.height=Math.round(this.preDragSize.height+o*l)),this.applyConstraints(a,r)}applyConstraints(t,r={}){const i=typeof t.width=="string"?parseInt(t.width,10):t.width||0,o=typeof t.height=="string"?parseInt(t.height,10):t.height||0;let l=i,a=o;if(r.ratio){l=this.applyLimit(l,r.minWidth,r.maxWidth),a=l*r.ratio;const g=this.applyLimit(a,r.minHeight,r.maxHeight);g!==a&&(a=g,l=a/r.ratio)}else i&&(l=this.applyLimit(l,r.minWidth,r.maxWidth)),o&&(a=this.applyLimit(a,r.minHeight,r.maxHeight));const u={};return t.width!==void 0&&(u.width=r.unit?`${l}px`:l),t.height!==void 0&&(u.height=r.unit?`${a}px`:a),u}applyLimit(t,r,i){let o=t;return r!==void 0&&(o=Math.max(r,o)),i!==void 0&&(o=Math.min(i,o)),o}getNaturalSize(){if(!this.activeEle)return[0,0];const t=this.activeEle.getAttribute("data-size");if(!t){const r=this.activeEle,i=[r.offsetWidth,r.offsetHeight];return r.setAttribute("data-size",i.join(",")),i}return t.split(",").map(Number)}setCursor(t){[document.body,this.activeEle].forEach(r=>r&&(r.style.cursor=t))}}const jd=class jd extends Xp{constructor(){super(...arguments);Te(this,"keyboardProxy",null)}static injectInit(t){var i;const r=(i=t.keyboard)==null?void 0:i.bindings;r&&[jd.keys.LEFT,jd.keys.RIGHT].forEach(o=>(r[o]||[]).unshift(jd.makeArrowHandler(o)))}static makeArrowHandler(t){const r=t===jd.keys.LEFT;return{key:t,shiftKey:!1,altKey:null,[r?"prefix":"suffix"]:/^$/,handler(i){const o=this.quill;if(!o.resizer)return!0;let l=i.index;const a=t===jd.keys.RIGHT,[u]=o.getLine(l+(r?-1:0));if(!u)return!0;if(o.resizer.judgeShow(u))return!1;const g=o.getIndex(u);if(a&&g+u.length()-1===l)return!0;a&&(l+=i.length+1);const[m]=o.getLeaf(l);if(!m)return!0;const x=m.offset(m.parent),w=m.constructor&&"scope"in m.constructor&&m.constructor.scope===Qn.BLOCK_BLOT;if(r&&(w&&l===x||l===0||l===g))return!0;let _=m;if(r&&x===0){const[S]=o.getLeaf(l-1);S&&(_=S)}return!_||!o.resizer.judgeShow(_)}}}onCreate(){this.keyboardProxy=this.keyboardHandle.bind(this),document.addEventListener("keydown",this.keyboardProxy,!0)}onDestroy(){this.keyboardProxy&&document.removeEventListener("keydown",this.keyboardProxy,!0)}keyboardHandle(t){if(t.defaultPrevented||t.shiftKey||t.ctrlKey||t.altKey||!this.activeEle)return;const r=t.keyCode;let i=this.blot.offset(this.quill.scroll),o=null,l=!1;r===Zd.BACKSPACE||r===Zd.DELETE?(this.handleDelete(),l=!0):r>=Zd.LEFT&&r<=Zd.DOWN&&([i,o]=this.handleArrowKeys(r,i),l=!0),l&&(t.stopPropagation(),t.preventDefault()),!(o&&this.resizer.judgeShow(o,o.domNode))&&(this.quill.setSelection(i),this.resizer.hide())}handleDelete(){this.blot&&(this.blot.deleteAt(0,1),this.blot.parent.optimize({}))}handleArrowKeys(t,r){let i=null;return t===Zd.RIGHT?r+=this.blot.length()||1:t===Zd.UP?(r=this.getOtherLineIndex(-1),i=this.quill.getLeaf(r)[0]):t===Zd.DOWN&&(r=this.getOtherLineIndex(1),i=this.quill.getLeaf(r)[0]),[r,i]}getOtherLineIndex(t){if(!this.blot)return 0;const r=this.blot.offset(this.quill.scroll),[i]=this.quill.getLine(r);if(!i)return r;const o=this.blot.offset(i)+1,l=t>0?i.next:i.prev;if(!l)return r;let a=l.length();return l.statics.blotName==="block"&&a--,l.offset(this.quill.scroll)+Math.min(a,o)}};Te(jd,"keys",Zd);let vv=jd;const f1=class f1 extends Xp{constructor(t){super(t);Te(this,"toolbar");Te(this,"blot");this.blot=t.blot}createStyleTool(t,r){const i={left:{float:"left"},right:{float:"right"},center:{display:"block",margin:"0 auto",float:"none"},justify:{display:"block",float:"none",margin:"0",width:"100%"}};return{icon:t,apply:o=>{const l=i[r];Object.assign(o.style,l),o.setAttribute("data-align",r)},isApplied:o=>{const l=o.style;switch(r){case"center":return l.float==="none";case"justify":return l.display==="block"&&l.width==="100%";case"left":case"right":return l.float===r;default:return!1}}}}onCreate(){var t;this.toolbar=document.createElement("div"),this.toolbar.className=Ff[Bp.TOOLBAR],(t=this.overlay)==null||t.appendChild(this.toolbar),Object.keys(f1.Tools).forEach(r=>{const i=r;f1.Tools[i]=this.createStyleTool(f1.Tools[i].icon,i)}),this._addToolbarButtons()}_addToolbarButtons(){if(!this.toolbar||!this.activeEle)return;const{Tools:t}=this.constructor;this.options.tools.forEach(r=>{const i=r,o=t[i];if(!o)return;const l=document.createElement("button");l.type="button",l.className=Ff[Bp.TOOLBAR_BUTTON],l.innerHTML=a1.renderToString(M.jsx(uo,{icon:o.icon,size:"xs"})),l.setAttribute("data-tool",i),o.isApplied&&o.isApplied.call(this,this.activeEle)&&(l.style.backgroundColor="var(--AEditor_Addon_Secondary_color)"),this.addButtonClickHandler(l,o),this.toolbar.appendChild(l)})}addButtonClickHandler(t,r){!this.activeEle||!this.blot||t.addEventListener("click",i=>{var l;if(i.stopPropagation(),r.handler&&r.handler.call(this,i,t,this.activeEle)!==!0)return;const o=r.isApplied&&r.isApplied.call(this,this.activeEle);return this.toolbar&&Array.from(this.toolbar.querySelectorAll("button")).forEach(a=>a.style.backgroundColor=""),o?(this.activeEle.style.cssText="",this.activeEle.setAttribute("data-align","")):(t.style.backgroundColor="var(--AEditor_Addon_Secondary_color)",(l=r.apply)==null||l.call(r,this.activeEle)),this.requestUpdate(),!1})}};Te(f1,"Tools",{left:{icon:"AlignLeft"},center:{icon:"AlignCenter"},right:{icon:"AlignRight"},justify:{icon:"AlignJustify"}});let cm=f1;class I4{constructor(e,t={}){Te(this,"quill");Te(this,"options");Te(this,"moduleClasses");Te(this,"modules",[]);Te(this,"blot");Te(this,"selectedBlots",[]);Te(this,"embedClassName","");Te(this,"activeEle");Te(this,"overlay");Te(this,"updateFromModule",!1);Te(this,"hideProxy",null);Te(this,"updateOverlayPositionProxy",null);var i;e.resizer=this,this.quill=e;const r=t.modules?[...t.modules]:null;this.options={...Tz,...t},r&&(this.options.modules=r),document.execCommand("enableObjectResizing",!1,"false"),this.moduleClasses=this.options.modules,this.quill.root.addEventListener("mousedown",this.handleClick.bind(this),!1),this.quill.on("text-change",this.handleChange.bind(this)),this.quill.container.style.position=this.quill.container.style.position||"relative",this.quill.on("selection-change",this.addBlotsSelectedClass.bind(this)),vv.injectInit(this.quill),(i=this.options.embedTags)!=null&&i.length&&this.initializeEmbed()}initializeModules(){this.modules.forEach(e=>e.onDestroy()),this.modules=[],this.modules=this.moduleClasses.map(e=>new(this.constructor.Modules[e]||e)(this)),this.modules.forEach(e=>e.onCreate()),this.repositionElements(),this.modules.forEach(e=>e.onUpdate())}initializeEmbed(){if(!this.options.embedTags.length)return;this.embedClassName=`ql-${Array.from({length},()=>[Math.floor(Math.random()*62)]).join("")}`;const e=[""].concat(this.options.embedTags).join(`, .${this.embedClassName} `).slice(2)+"{pointer-events: none;}",t=document.createElement("style");t.textContent=e,this.quill.container.appendChild(t),this.quill.root.classList.add(this.embedClassName)}onUpdate(e){this.updateFromModule=!!e,this.repositionElements(),this.modules.forEach(t=>t.onUpdate())}handleClick(e){if(this.overlay&&(e.target===this.overlay||this.overlay.contains(e.target)))return;let t=e.target;if(t=this.getEventTarget(e,t),t!=null&&t.tagName){const r=this.quill.scroll.find(t);if(r&&this.judgeShow(r,t)){e.preventDefault();return}}this.activeEle&&this.hide()}getEventTarget(e,t){var o;const r=(o=this.options.embedTags)==null?void 0:o.join();if(!r)return t;const i=this.quill.root;return(t===i||t.querySelectorAll(r).length)&&(i.classList.remove(this.embedClassName),t=document.elementFromPoint(e.clientX,e.clientY),i.classList.add(this.embedClassName)),t}judgeShow(e,t){if(!e||!this.options.contentOptions)return!1;!t&&e.domNode&&(t=e.domNode);const r=this.options.contentOptions.find(o=>o.blotName===e.statics.blotName);if(!r)return!1;if(this.activeEle===t)return!0;const i=r.limit||{};return!i.minWidth||i.minWidth&&t.offsetWidth>=i.minWidth?(this.activeEle&&this.hide(),this.activeEle=t,this.blot=e,this.showOverlay(),this.initializeModules(),!0):!1}handleChange(e,t,r){if(this.updateFromModule){this.updateFromModule=!1;return}r!=="user"||!this.overlay||!this.activeEle||this.onUpdate()}showOverlay(){this.overlay&&this.hideOverlay(),this.quill.setSelection(null),[document.body,this.quill.root].forEach(e=>e.style.userSelect="none"),this.overlay=document.createElement("div"),this.overlay.className=`${Ff[Bp.OVERLAY]}`,this.overlay.addEventListener("wheel",e=>{e.preventDefault(),e.stopPropagation(),this.quill.root.scrollTop+=e.deltaY*.5},{passive:!1}),this.quill.container.appendChild(this.overlay),this.hideProxy=()=>this.activeEle&&this.hide(),this.updateOverlayPositionProxy=()=>this.overlay&&(this.overlay.style.marginTop=-1*this.quill.root.scrollTop+"px"),this.quill.root.addEventListener("input",this.hideProxy,!0),this.quill.root.addEventListener("scroll",this.updateOverlayPositionProxy),this.repositionElements()}hideOverlay(){this.overlay&&(this.quill.container.removeChild(this.overlay),this.overlay=void 0,this.hideProxy&&this.quill.root.removeEventListener("input",this.hideProxy,!0),this.updateOverlayPositionProxy&&this.quill.root.removeEventListener("scroll",this.updateOverlayPositionProxy),[document.body,this.quill.root].forEach(e=>e.style.userSelect=""))}repositionElements(){if(!this.overlay||!this.activeEle)return;const e=this.quill.container,t=this.activeEle.getBoundingClientRect(),r=e.getBoundingClientRect();Object.assign(this.overlay.style,{left:`${t.left-r.left-1+e.scrollLeft}px`,top:`${t.top-r.top+this.quill.root.scrollTop}px`,width:`${t.width}px`,height:`${t.height}px`,marginTop:-1*this.quill.root.scrollTop+"px"})}addBlotsSelectedClass(e){if(!e){this.selectedBlots=[];return}try{const t=i=>{var o;return["image","iframe","video"].includes((o=i.statics)==null?void 0:o.blotName)},r=this.quill.scroll.descendants(t,e.index,e.length);this.selectedBlots=r.filter(i=>!i.statics||!this.options.contentOptions?!1:!!this.options.contentOptions.find(o=>o.blotName===i.statics.blotName))}catch{}}hide(){this.hideOverlay(),this.modules.forEach(e=>e.onDestroy()),this.modules=[],this.activeEle=void 0,this.blot=void 0}}Te(I4,"Modules",{Base:Xp,DisplaySize:Ez,Toolbar:cm,Resize:Rz,Keyboard:vv});const N0=Xe.import("delta"),Iz=Xe.import("modules/clipboard");function kz(n){let e=Number.parseFloat(n.getAttribute("width")||String(Ss.colDefaultWidth));if(Number.isNaN(e)){const t=n.style.width;e=t?Number.parseFloat(t):n.offsetWidth}return e}function Mz(n,e){const t=new Array(e).fill(Ss.colDefaultWidth),r=Array.from(n.querySelectorAll("tr"));for(const i of r){const o=Array.from(i.querySelectorAll("td"));for(const[l,a]of o.entries())if(l<e){const u=kz(a);t[l]=u||t[l]}else break}return t}class Lz extends Iz{constructor(t,r){super(t,r);Te(this,"tableId",Na());Te(this,"rowId",Na());Te(this,"colIds",[]);Te(this,"rowspanCount",[]);Te(this,"cellCount",0);Te(this,"colCount",0);Te(this,"STYLE_PROPERTIES",["color","background","background-color","mso-pattern","border","border-color","border-top","border-right","border-bottom","border-left"]);this.quill=t,this.addMatcher("table",this.matchTable.bind(this)),this.addMatcher("colgroup",this.matchColgroup.bind(this)),this.addMatcher("col",this.matchCol.bind(this)),this.addMatcher("tr",this.matchTr.bind(this)),this.addMatcher("td",this.matchTd.bind(this)),this.addMatcher("th",this.matchTd.bind(this)),this.addMatcher("caption",this.matchCaption.bind(this))}matchTable(t,r){if(r.ops.length===0)return r;const i=[],o=[];let l=-1;for(let g=0;g<r.ops.length;g++){const{attributes:m,insert:x}=r.ops[g],{table:w,[qe.tableCell]:_,...S}=m||{},R=ng.isObject(x)&&x[qe.tableCol];R?o.push({insert:x}):i.push({attributes:S,insert:x}),!(S!=null&&S[qe.tableCellInner])&&!R&&(l=g)}const u=Mz(t,this.colIds.length).reduce((g,m,x)=>(o[x]?g.push(o[x]):g.push({insert:{[qe.tableCol]:{tableId:this.tableId,colId:this.colIds[x],width:m,full:!0}}}),g),[]);return i.splice(l+1,0,...u),this.tableId=Na(),this.colIds=[],this.rowspanCount=[],this.cellCount=0,this.colCount=0,new N0(i)}matchColgroup(t,r){const i=[];for(let o=0;o<r.ops.length;o++){const l=r.ops[o];l&&ng.isObject(l.insert)&&l.insert[qe.tableCol]&&i.push(l)}return new N0(i)}matchCol(t){this.colIds[this.colCount]=Na();const r=new N0().insert({[qe.tableCol]:Object.assign(kg.value(t),{tableId:this.tableId,colId:this.colIds[this.colCount]})});return this.colCount+=1,r}matchTr(t,r){this.rowId=Na(),this.cellCount=0;for(const[i,o]of this.rowspanCount.entries())o.rowspan>0&&(o.rowspan-=1),o.rowspan<=0&&(this.rowspanCount[i]={rowspan:0,colspan:0});return r}matchTd(t,r){const i=t,o=Df.formats(i);if(!this.colIds[this.cellCount]||!this.rowspanCount[this.cellCount])for(let m=this.cellCount;m>=0;m--)this.colIds[m]||(this.colIds[m]=Na()),this.rowspanCount[m]||(this.rowspanCount[m]={rowspan:0,colspan:0});const{colspan:l}=this.rowspanCount[this.cellCount];this.cellCount+=l,o.rowspan>0&&(this.rowspanCount[this.cellCount]={rowspan:o.rowspan,colspan:o.colspan});const a=this.colIds[this.cellCount];this.cellCount+=o.colspan;const u=Object.assign(o,{tableId:this.tableId,rowId:this.rowId,colId:a});this.handleBorderNoneStyles(i,u);const g=[];for(const m of r.ops){const{attributes:x={},...w}=m,{[qe.tableCell]:_,...S}=x;g.push({...w,attributes:{...S,[qe.tableCellInner]:u}})}return(g.length<=0||!ng.isString(g[g.length-1].insert)||!g[g.length-1].insert.endsWith(`
|
|
479
479
|
`))&&g.push({insert:`
|
|
480
|
-
`,attributes:{[qe.tableCellInner]:u}}),new N0(g)}handleBorderNoneStyles(t,r){if(!(r!=null&&r.style))return;["border",...["top","right","bottom","left"].flatMap(o=>[`border-${o}`,`border-${o}-style`])].filter(o=>t.style[o]==="none").forEach(o=>r.style=r.style.replaceAll(new RegExp(`${o}:none;?`,"g"),""))}convert({html:t,text:r},i={}){if(t){const a=new DOMParser().parseFromString(t,"text/html");this.preprocessTableHtml(a),this.mergeClassStylesToInline(a),t=a.body.innerHTML}const o=super.convert({html:t,text:r},i);if(i[qe.tableCellInner])for(const l of o.ops){if(ng.isObject(l.insert)&&l.insert[qe.tableCol]){l.insert="";continue}l.attributes||(l.attributes={}),l.attributes[qe.tableCellInner]=i[qe.tableCellInner]}return o}parseStyleWithFilter(t,r){if(!t)return{};const i={};let o="",l="",a=!0,u=0;for(let g=0;g<t.length;g++){const m=t[g];m===":"&&a?(o=t.substring(u,g).trim(),u=g+1,a=!1):m===";"&&(!a&&o&&(l=t.substring(u,g).trim(),(!r||r(o))&&(i[o]=l)),u=g+1,a=!0)}return!a&&o&&u<t.length&&(l=t.substring(u).trim(),(!r||r(o))&&(i[o]=l)),i}mergeClassStylesToInline(t){var r;try{const i=t.querySelectorAll("td[class], th[class]");if(i.length===0)return;const o=new Set;for(const m of i)(m.getAttribute("class")||"").split(/\s+/).filter(Boolean).forEach(w=>o.add(w));if(o.size===0)return;const l=t.querySelectorAll("style");if(l.length===0)return;const a=Array.from(l).map(m=>m.textContent||"").join("");if(!a)return;const u={},g=m=>this.STYLE_PROPERTIES.some(x=>m.startsWith(x));for(const m of o){const x=new RegExp(`\\.${m}[^{]*{([^}]*)}`,"g");let w;for(;(w=x.exec(a))!==null;){const _=w[1],S=this.parseStyleWithFilter(_),R={};let I=!1;for(const O in S)g(O)&&(R[O]=S[O],I=!0);I&&(u[m]=R)}}if(Object.keys(u).length===0)return;for(let m=0;m<i.length;m++){const x=i[m],w=((r=x.getAttribute("class"))==null?void 0:r.split(/\s+/).filter(Boolean))||[],_=x.getAttribute("style")||"",S=this.parseStyleWithFilter(_);let R=!1;for(const I of w){const O=u[I];if(O)for(const P in O)S[P]||(S[P]=O[P],R=!0)}if(R){let I="";for(const O in S)I+=O+":"+S[O]+";";I&&x.setAttribute("style",I)}x.removeAttribute("class")}}catch(i){console.error("스타일 처리 오류",i)}}matchCaption(t,r){for(let i=0;i<r.ops.length;i++){const o=r.ops[i],{attributes:l}=o;l&&l[qe.tableCaption]&&(l[qe.tableCaption].tableId=this.tableId,o.attributes=l)}return r}preprocessTableHtml(t){try{const r=t.querySelectorAll("table");for(const i of Array.from(r))i.querySelectorAll("tr").length!==0&&(this.cleanupTableStyles(i),this.applyRowspanHeights(i),this.fixRowspanCells(i));this.mergeClassStylesToInline(t)}catch(r){console.error("테이블 전처리 오류",r)}}cleanupTableStyles(t){const r=t.querySelectorAll("td, th, tr, colgroup");for(const i of r){const o=i;o.removeAttribute("height");const l=o.getAttribute("style");if(l){const a=l.replace(/height\s*:[^;]*;?/gi,"").trim();o.setAttribute("style",a||"")}}}applyRowspanHeights(t){const i=t.querySelectorAll("td, th");t.style.borderCollapse="collapse";for(const o of i){const l=o,u=parseInt(l.getAttribute("rowspan")||"1")*24,g=l.getAttribute("style")||"",m=g+(g?"; ":"")+`height: ${u}px`;l.setAttribute("style",m)}}fixRowspanCells(t){const r=t.querySelectorAll("tr");if(r.length<=1)return;const i=[],o=new Map;for(let l=0;l<r.length;l++){const u=r[l].querySelectorAll("td, th");if(u.length===0&&l<r.length-1){i.push(l);continue}for(const g of Array.from(u)){const m=parseInt(g.getAttribute("rowspan")||"1");if(m>1)for(let x=1;x<m;x++){const w=l+x;if(w>=r.length)break;o.has(w)||o.set(w,[]),o.get(w).push(g)}}}i.length>0&&this.processEmptyRows(i,r,o)}processEmptyRows(t,r,i){for(const o of t){const l=i.get(o);if(l)for(const a of l){const u=parseInt(a.getAttribute("rowspan")||"1");u>1&&a.setAttribute("rowspan",(u-1).toString())}}for(const o of t.reverse())r[o].remove()}}class Oz extends E4{fixUnusuaDeletelTable(){}mergeCells(e){if(!this.table||!this.tableSelection)return;const t=this.tableSelection.selectedTds||[];if(t.length>1&&(e=t),!e||e.length<=1)return;const r=Kl(e[0],qe.tableMain),i=r.getRows(),o=e.map(w=>{if(!w||!w.parent||!w.parent.domNode)return null;const _=w.parent.domNode;if(!_)return null;const S=i.findIndex(O=>O.rowId===w.rowId);if(S===-1)return null;const R=w.getColumnIndex();if(R===-1)return null;const I=_.getBoundingClientRect();return!I||I.width===0||I.height===0?null:{td:w,rowIndex:S,colIndex:R,rowspan:w.rowspan,colspan:w.colspan,visualLeft:I.left,visualRight:I.right,visualTop:I.top,visualBottom:I.bottom}}).filter(Boolean);if(o.length<=1)return;o.sort((w,_)=>w.visualTop-_.visualTop||w.visualLeft-_.visualLeft);const l=o[0],a=l.td,u=Math.max(...o.map(w=>w.rowIndex+w.rowspan-1)),g=Math.max(...o.map(w=>w.colIndex+w.colspan-1)),m=u-l.rowIndex+1,x=g-l.colIndex+1;for(const w of o)w.td!==a&&(w.td.moveChildren(a),w.td.parent.remove());a.rowspan=m,a.colspan=x,this.fixTableByRemove(r)}}Xe.register({"modules/imageCompress":Fp,"modules/resize":I4,"modules/tableUp":Oz,"modules/magicUrl":aF,"formats/divider":am,"modules/clipboard":Lz,"modules/copy":fz,"modules/toggleFullscreen":o4},!0);const u1={KB:1024,QUALITY:.7,IMAGE_SIZES:new Map},Pz={getCharLength:n=>Array.from(n).length,calculateTextSize:n=>{if(!n.ops||n.ops.length===0)return 0;let e=0;for(const t of n.ops)if(typeof t.insert=="string")e+=new TextEncoder().encode(t.insert).length-1;else if(typeof t.insert=="object"&&t.insert.image){const r=t.insert.image;r&&(e+=u1.IMAGE_SIZES.get(r)||Math.ceil(r.length*u1.QUALITY))}return e}},Dz=n=>{const{type:e="Primary",editorRef:t,useValue:r,useError:i,placeholder:o,tabIndex:l,autoFocus:a,editorProps:u,style:g,minHeight:m,maxHeight:x,contentHeight:w,contentMaxHeight:_=1e3,toolbarSize:S="Med",toolbarType:R="Default",readOnly:I,limitPosition:O="Bottom",maxLength:P,size:H=100,editorClassName:W,editorStyle:Y,noImageResize:B,...ee}=n,[{wrapId:D,wrapProps:J,labelProps:fe,...Z},te]=zg(ee),ne=z.useMemo(()=>e==="ReadOnly"||I,[e,I]),ue=z.useMemo(()=>w?20:0,[w]),[se,j]=z.useState(S==="Med"?40:50),re=z.useMemo(()=>ne?0:se,[ne,se]),[ge,ve]=z.useMemo(()=>!i||ne||O==="Top"?[0,0]:[20,6],[i,ne,O]),oe=z.useMemo(()=>ge+ve,[ge,ve]),[K,he]=z.useState(w),[Ae,He]=z.useState(!1),[xe,Fe]=z.useState(!1),Me=z.useRef(null),Be=z.useRef(0),ke=z.useRef(0),Re=z.useMemo(()=>Z.label?24:0,[Z.label]),ze=z.useMemo(()=>R==="Title",[R]),Ke=z.useMemo(()=>{if(w&&K)switch(e){case"ReadOnly":return K;case"Raw":return K+oe;default:return K+re+oe}},[w,K,e,re,oe]),Le=z.useMemo(()=>{if(!(!x||x<=re+oe))switch(e){case"ReadOnly":return x;case"Raw":return x-oe;default:return x-re-oe}},[e,re,oe,x]),ft=z.useMemo(()=>{if(m&&w){const vt=Math.min(m-re-oe,w);return ne?vt:vt+re+oe}else return m||(w?void 0:`calc(100% - ${Re}px)`)},[m,w,Re,re,oe,ne]),je=z.useMemo(()=>(Array.isArray(Z.errorMessage)?Z.errorMessage.some(Boolean):!!Z.errorMessage)?"Error":e,[Z.errorMessage,e]),rt=z.useCallback(vt=>{let _t=vt;_t=p7.sanitize(vt);const At=document.createElement("div");return At.innerHTML=_t,new Xe(At,{readOnly:!0}).getContents()},[]),[tt,nt]=Do(r,""),[ht,Pt]=z.useState(()=>rt(tt));z.useEffect(()=>{nt===void 0&&Pt(rt(tt))},[rt,nt,tt]);const Wt=z.useMemo(()=>M.jsx(Nz,{htmlDelta:ht,isReadonly:ne,limit:H*u1.KB,useError:i}),[ht,ne,H,i]),zt=z.useRef(null),Zt=z.useRef([]),[an,Yt]=z.useState(!0);z.useEffect(()=>{const vt=setTimeout(()=>Yt(!1),0);return()=>{clearTimeout(vt),Zt.current.forEach(_t=>_t()),Zt.current=[]}},[]);const pn=z.useCallback((vt,_t)=>{if(!w)return _t;const At=m?m-re-oe:w,Ot=Math.max(At,0),Dt=x?x-re-oe:_;return Math.min(Dt,Math.max(Ot,_t+vt))},[w,m,re,oe,x,_]),Ht=z.useCallback(vt=>{if(!Ae||!w)return;const _t=vt.clientY-ke.current,At=pn(_t,Be.current);K!==At&&he(At),vt.preventDefault(),vt.stopPropagation()},[Ae,w,pn,K]),Sn=z.useCallback(vt=>{He(!1),Fe(!1),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Sn),vt.preventDefault(),vt.stopPropagation()},[Ht]),ut=z.useCallback(vt=>{if(!w)return;if(vt.detail===2){he(w);return}K===void 0?(he(w),Be.current=w):Be.current=K,He(!0),Fe(!0),ke.current=vt.clientY;const _t=Ot=>{if(!w)return;const Dt=Ot.clientY-ke.current,cn=pn(Dt,Be.current);he(cn),Ot.preventDefault(),Ot.stopPropagation()},At=Ot=>{He(!1),Fe(!1),document.removeEventListener("mousemove",_t),document.removeEventListener("mouseup",At),Ot.preventDefault(),Ot.stopPropagation()};document.addEventListener("mousemove",_t),document.addEventListener("mouseup",At),vt.preventDefault(),vt.stopPropagation()},[w,K,pn]),at=z.useCallback((vt,_t,At,Ot)=>{if(At!=="user"&&At!=="api")return;const Dt=Ot.getContents(),cn=Ot.getLength()-1,yn=P!==void 0&&cn>P,Tt=mn=>mn.replace(/\s{2,}/g,Nn=>" ".repeat(Nn.length)),Lt=vt.replace(/^<p><br><\/p>$/,"").trim(),vn=Tt(Lt);if(!yn){Pt(Dt),nt==null||nt(vn);return}const In=dt(Dt,P);Pt(In);const Dn=new Xe(document.createElement("div"));Dn.setContents(In);const jt=Tt(Dn.root.innerHTML.replace(/^<p><br><\/p>$/,"").trim());nt==null||nt(jt)},[P,nt]),dt=(vt,_t)=>{var Dt,cn,yn;if(!vt.ops)return vt;const At=new Jn;let Ot=0;for(const Tt of vt.ops){if(Ot>=_t)break;if(Tt.insert&&typeof Tt.insert=="string"){const Lt=Tt.insert,vn=_t-Ot;if(Lt.length<=vn)(Dt=At.ops)==null||Dt.push(Tt),Ot+=Lt.length;else{const In={...Tt,insert:Lt.substring(0,vn)};(cn=At.ops)==null||cn.push(In),Ot+=vn;break}}else Ot<_t&&((yn=At.ops)==null||yn.push(Tt),Ot+=1)}return At},kt=z.useCallback(vt=>{var Dt,cn;const _t=vt.getEditor().container;if(!_t)return null;const At=(Dt=_t.closest(".AEditorContainer"))==null?void 0:Dt.querySelector(".ql-toolbar");return At||((cn=_t.parentElement)==null?void 0:cn.querySelector(".ql-toolbar"))||null},[]),rn=z.useCallback((vt,_t,At,Ot)=>{if(!vt)return;const Dt=At;vt.addEventListener(_t,Dt,Ot),Zt.current.push(()=>vt.removeEventListener(_t,Dt,Ot))},[]),sn=z.useCallback((vt,_t,At)=>{const Ot=_t.getFormat();vt.forEach(Dt=>{if(Ot[Dt]){const cn=Ot[Dt],yn=`.ql-${Dt}`,Tt=At.querySelector(`${yn} .ql-picker-label`),Lt=At.querySelectorAll(`${yn} .ql-picker-item`),vn=Array.from(Lt).find(In=>In.getAttribute("data-value")===cn);vn&&(vn.classList.add("ql-selected"),Tt==null||Tt.classList.add("ql-active"))}})},[]),on=z.useCallback(vt=>{if(!vt.length)return;const Ot=vt[0].target.getBoundingClientRect(),Dt=Math.ceil(Ot.height);j(cn=>Math.abs(cn-Dt)<.1?cn:Dt)},[]),Ue=z.useCallback((vt,_t)=>{if(vt.key!=="Backspace")return;const At=_t.getSelection(!1);if(!At||At.length>0)return;const Ot=At.index;if(Ot<=0)return;const[Dt]=_t.getLine(Ot);if(Dt&&Ot===_t.getIndex(Dt)||_t.getFormat(Ot,1).link)return;const cn=_t.getFormat(Ot-1,1);if(cn.link){vt.preventDefault();let yn=Ot-1;for(;yn>0&&_t.getFormat(yn-1,1).link===cn.link;)yn--;const[Tt]=_t.scroll.descendant(Lt=>{var vn;return((vn=Lt==null?void 0:Lt.statics)==null?void 0:vn.blotName)==="link"},yn);if(Tt!=null&&Tt.domNode){const Lt=(Tt.domNode.textContent||"").length;_t.removeFormat(yn,Lt)}}},[]),Ce=z.useCallback(()=>({clipboard:{matchers:[["img",()=>!1],["table",()=>!1],["iframe",()=>!1],["video",()=>!1],["h1, h2, h3, h4, h5, h6",()=>!1],["blockquote",()=>!1],["hr",()=>!1]]},copy:{isTitleMode:!0},keyboard:{bindings:{enter:{key:"Enter",handler:()=>!1},newline:{key:"Enter",shiftKey:!0,handler:()=>!1},tab:{key:"Tab",handler:()=>!1},"remove-newline":{key:"Backspace",collapsed:!0,format:["blockquote","list","code-block"],offset:0,handler:function(vt){const{blockquote:_t,list:At,["code-block"]:Ot}=vt.getFormat();return _t||At||Ot?(vt.format("blockquote",!1),vt.format("list",!1),vt.format("code-block",!1),!1):!0}}}},magicUrl:!0,toolbar:{container:[["bold","italic","underline","strike",{color:[]},{background:[]},"clean"]]}}),[]),Ze=z.useCallback(()=>({clipboard:{},copy:{},keyboard:{},magicUrl:!0,toggleFullscreen:{type:je,maximize:a1.renderToString(M.jsx(uo,{icon:"Maximize",size:S==="Med"?"sm":"md"})),minimize:a1.renderToString(M.jsx(uo,{icon:"Minimize",size:S==="Med"?"sm":"md"}))},imageCompress:{quality:u1.QUALITY,imageType:"image/jpeg",maxWidth:1500,maxHeight:1500,debug:!1,handleOnPaste:vt=>{var _t,At;try{const Ot=(_t=vt.clipboardData)==null?void 0:_t.items;if(!Ot)return!0;const Dt=Array.from(Ot).some(Tt=>{const Lt=Tt.type.toLowerCase();return Lt.includes("Excel")||Lt.includes("text/html")}),cn=(At=vt.clipboardData)==null?void 0:At.getData("text/html"),yn=cn&&(cn.includes("<table")||cn.includes("<tbody")||cn.includes("<td"));return!(Dt||yn)}catch(Ot){return console.warn("Error in handleOnPaste:",Ot),!0}},insertIntoEditor:(vt,_t,At)=>{u1.IMAGE_SIZES.has(vt)||u1.IMAGE_SIZES.set(vt,_t.size);const Ot=At.getSelection();Ot&&At.insertEmbed(Ot.index,"image",vt,Xe.sources.USER)}},...!ne&&{...!B&&{resize:{}},table:!1,tableUp:{fullSwitch:!1,icon:a1.renderToString(M.jsx(uo,{icon:"Table",size:S==="Med"?"sm":"md",strokeWidth:2.5})),resize:ZB,resizeScale:XB,customSelect:ez,selection:JB,fixUnusuaDeletelTable:!1,selectionOptions:{tableMenu:YB,tableMenuOptions:{localstorageKey:"used-color",tipText:!0,tools:[io.InsertCaption,io.InsertTop,io.InsertRight,io.InsertBottom,io.InsertLeft,io.Break,io.MergeCell,io.SplitCell,io.Break,io.DeleteRow,io.DeleteColumn,io.DeleteTable,io.Break,io.BackgroundColor,io.BorderColor,io.Break,io.CopyCell,io.CutCell,io.Break,io.SwitchWidth]}},texts:{fullCheckboxText:Nr.AEditor["Insert Full Width Table"],customBtnText:Nr.AEditor.Custom,confirmText:Nr.AEditor.Confirm,cancelText:Nr.AEditor.Cancel,rowText:Nr.AEditor.Row,colText:Nr.AEditor.Column,CopyCell:Nr.AEditor["Copy Cell"],CutCell:Nr.AEditor["Cut Cell"],notPositiveNumberError:Nr.AEditor["Not Positive Number Error"],custom:Nr.AEditor.Custom,clear:Nr.AEditor.Clear,transparent:Nr.AEditor.Transparent,perWidthInsufficient:Nr.AEditor.perWidthInsufficient,InsertTop:Nr.AEditor["Insert Row Top"],InsertRight:Nr.AEditor["Insert Column Right"],InsertBottom:Nr.AEditor["Insert Row Bottom"],InsertLeft:Nr.AEditor["Insert Column Left"],MergeCell:Nr.AEditor["Merge Cell"],SplitCell:Nr.AEditor["Split Cell"],DeleteRow:Nr.AEditor["Delete Row"],DeleteColumn:Nr.AEditor["Delete Column"],DeleteTable:Nr.AEditor["Delete Table"],BackgroundColor:Nr.AEditor["Set Background Color"],BorderColor:Nr.AEditor["Set Border Color"],SwitchWidth:Nr.AEditor["Switch Table Width"],InsertCaption:Nr.AEditor["Insert Table Caption"]}},toolbar:{container:[[{header:[1,2,3,!1,4]}],["bold","italic","underline","strike","blockquote","divider",{[E4.toolName]:[]},{color:[]},{background:[]}],[{list:"ordered"},{list:"bullet"},{indent:"-1"},{indent:"+1"},{align:[]}],["link","image","video"],["clean"]],handlers:{divider:function(){const vt=this.quill,_t=vt.getSelection(!0);if(!_t)return;const At=Math.min(_t.index+1,vt.getLength()-1);vt.insertEmbed(At,"divider",!0,Xe.sources.USER),setTimeout(()=>vt.setSelection(Math.min(At+1,vt.getLength()-1),0,Xe.sources.SILENT),0)}}}}}),[ne,B,S,je]),Ct=z.useMemo(()=>ze?Ce():Ze(),[ze,Ce,Ze]),Qt=z.useCallback(vt=>{if(!vt)return;const _t=vt.getEditor();if(!_t)return;const At=_t.root,Ot=kt(vt);At&&W&&At.classList.add(...W.split(" ")),At&&Y&&Object.entries(Y).forEach(([cn,yn])=>{const Tt=cn.replace(/([A-Z])/g,Lt=>`-${Lt[0].toLowerCase()}`);At.style[Tt]=yn}),rn(At,"keydown",cn=>Ue(cn,_t));const Dt=new ResizeObserver(on);if(Ot){Dt.observe(Ot),Zt.current.push(()=>Dt.disconnect());const cn=["header","color","background"];cn.forEach(yn=>{const Tt=Ot.querySelector(`.ql-${yn} .ql-picker-label`);Tt&&rn(Tt,"click",()=>sn(cn,_t,Ot))})}},[kt,W,Y,rn,on,Ue,sn]),Xt=z.useCallback(vt=>{if(Zt.current.forEach(At=>At()),Zt.current=[],zt.current=vt,!vt){ng.isFunction(t)?t(null):t!=null&&t.current&&(t.current=null);return}const _t=vt;_t.copyContent=At=>{vt.getEditor().getModule("copy").copyContent(At)},ng.isFunction(t)?t(_t):t&&(t.current=_t),Qt(vt)},[t,Qt]);return M.jsx(sg,{wrapId:D,...Z,wrapProps:{...J,style:{...J==null?void 0:J.style,height:"100%"}},label:M.jsxs(vl,{style:{gap:4},children:[Z.label,O==="Top"&&Wt]}),labelProps:{...fe,style:{minHeight:Z.label?20:void 0,marginBottom:Z.label?4:0,...fe==null?void 0:fe.style}},children:M.jsxs(Wi,{...te,className:yt.clsx(te.className,Ff.AEditorContainer,an&&"NoTransition"),style:{...g,height:Ke,minHeight:ft,maxHeight:Le},children:[M.jsx(Pv,{...u,ref:Xt,preserveWhitespace:!0,modules:Ct,placeholder:o,readOnly:ne,theme:"snow",value:ht,className:yt.clsx(u==null?void 0:u.className,Ff.AEditor,Ff[je],ze&&"Title",an&&"NoTransition"),style:{...u==null?void 0:u.style,"--editor-padding":ze?"8px 12px":"12px","--title-color-picker-row":ze?1:4,"--icon-size":`${S==="Med"?20:24}px`,"--toolbar-padding":`${S==="Med"?7.5:12.5}px`,"--title-header-font-size":`${S==="Med"?12:14}px`,"--default-text":`'${Nr.AEditor.Default}'`,"--visit-url-text":`'${Nr.AEditor["Visit URL:"]}'`,"--enter-link-text":`'${Nr.AEditor["Enter link:"]}'`,"--enter-video-text":`'${Nr.AEditor["Enter video:"]}'`,"--edit-text":`'${Nr.AEditor.Edit}'`,"--save-text":`'${Nr.AEditor.Save}'`,"--remove-text":`'${Nr.AEditor.Remove}'`,"--arrow-background":`url("data:image/svg+xml,${encodeURIComponent(a1.renderToString(M.jsx(uo,{icon:"EditorArrow"})))}`},onChange:at}),w&&M.jsxs(M.Fragment,{children:[M.jsx("div",{ref:Me,className:yt.clsx(Ff.Resizer,an&&"NoTransition"),style:{height:ue,bottom:i&&!ne?oe:0},onMouseDown:ut}),M.jsx("div",{children:`${Math.round(K)}px`,className:yt.clsx(Ff.Indicator,"NoSelect","Label1",an&&"NoTransition"),style:{height:ue,bottom:i&&!ne?oe:0,display:xe?"flex":"none"}})]}),M.jsx("div",{children:Wt,className:yt.clsx(Ff.LimitContainer,"NoSelect",an&&"NoTransition"),style:{marginTop:ve,minHeight:ge,display:O==="Bottom"?"flex":"none"}})]})})},Nz=n=>{const e=Vn.c(17),{htmlDelta:t,limit:r,useError:i,isReadonly:o}=n,[l,a]=Do(i,!1),u=Pz.calculateTextSize(t);let g,m;if(e[0]!==u||e[1]!==r||e[2]!==a?(g=()=>{a&&a(u>r)},m=[u,r,a],e[0]=u,e[1]=r,e[2]=a,e[3]=g,e[4]=m):(g=e[3],m=e[4]),z.useEffect(g,m),!i||o)return null;let x;e[5]!==l?(x=yt.clsx(l&&Ff.Error),e[5]=l,e[6]=x):x=e[6];let w;e[7]!==u?(w=Lg(u),e[7]=u,e[8]=w):w=e[8];let _;e[9]!==x||e[10]!==w?(_=M.jsx("span",{className:x,children:w}),e[9]=x,e[10]=w,e[11]=_):_=e[11];let S;e[12]!==r?(S=Lg(r),e[12]=r,e[13]=S):S=e[13];let R;return e[14]!==_||e[15]!==S?(R=M.jsxs(nd,{className:Ff.Limit,children:["(",_," / ",S,")"]}),e[14]=_,e[15]=S,e[16]=R):R=e[16],R};function Fz(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return z.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const zv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function N1(n){const e=Object.prototype.toString.call(n);return e==="[object Window]"||e==="[object global]"}function jm(n){return"nodeType"in n}function cf(n){var e,t;return n?N1(n)?n:jm(n)&&(e=(t=n.ownerDocument)==null?void 0:t.defaultView)!=null?e:window:window}function $m(n){const{Document:e}=cf(n);return n instanceof e}function Kp(n){return N1(n)?!1:n instanceof cf(n).HTMLElement}function k4(n){return n instanceof cf(n).SVGElement}function F1(n){return n?N1(n)?n.document:jm(n)?$m(n)?n:Kp(n)||k4(n)?n.ownerDocument:document:document:document}const ld=zv?z.useLayoutEffect:z.useEffect;function e2(n){const e=z.useRef(n);return ld(()=>{e.current=n}),z.useCallback(function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function Bz(){const n=z.useRef(null),e=z.useCallback((r,i)=>{n.current=setInterval(r,i)},[]),t=z.useCallback(()=>{n.current!==null&&(clearInterval(n.current),n.current=null)},[]);return[e,t]}function zp(n,e){e===void 0&&(e=[n]);const t=z.useRef(n);return ld(()=>{t.current!==n&&(t.current=n)},e),t}function Jp(n,e){const t=z.useRef();return z.useMemo(()=>{const r=n(t.current);return t.current=r,r},[...e])}function bv(n){const e=e2(n),t=z.useRef(null),r=z.useCallback(i=>{i!==t.current&&(e==null||e(i,t.current)),t.current=i},[]);return[t,r]}function um(n){const e=z.useRef();return z.useEffect(()=>{e.current=n},[n]),e.current}let Pb={};function Qp(n,e){return z.useMemo(()=>{if(e)return e;const t=Pb[n]==null?0:Pb[n]+1;return Pb[n]=t,n+"-"+t},[n,e])}function M4(n){return function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return r.reduce((o,l)=>{const a=Object.entries(l);for(const[u,g]of a){const m=o[u];m!=null&&(o[u]=m+n*g)}return o},{...e})}}const m1=M4(1),yv=M4(-1);function zz(n){return"clientX"in n&&"clientY"in n}function t2(n){if(!n)return!1;const{KeyboardEvent:e}=cf(n.target);return e&&n instanceof e}function Hz(n){if(!n)return!1;const{TouchEvent:e}=cf(n.target);return e&&n instanceof e}function fm(n){if(Hz(n)){if(n.touches&&n.touches.length){const{clientX:e,clientY:t}=n.touches[0];return{x:e,y:t}}else if(n.changedTouches&&n.changedTouches.length){const{clientX:e,clientY:t}=n.changedTouches[0];return{x:e,y:t}}}return zz(n)?{x:n.clientX,y:n.clientY}:null}const Hp=Object.freeze({Translate:{toString(n){if(!n)return;const{x:e,y:t}=n;return"translate3d("+(e?Math.round(e):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(n){if(!n)return;const{scaleX:e,scaleY:t}=n;return"scaleX("+e+") scaleY("+t+")"}},Transform:{toString(n){if(n)return[Hp.Translate.toString(n),Hp.Scale.toString(n)].join(" ")}},Transition:{toString(n){let{property:e,duration:t,easing:r}=n;return e+" "+t+"ms "+r}}}),Ow="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Wz(n){return n.matches(Ow)?n:n.querySelector(Ow)}const Uz={display:"none"};function Gz(n){let{id:e,value:t}=n;return z.createElement("div",{id:e,style:Uz},t)}function Yz(n){let{id:e,announcement:t,ariaLiveType:r="assertive"}=n;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return z.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},t)}function Vz(){const[n,e]=z.useState("");return{announce:z.useCallback(r=>{r!=null&&e(r)},[]),announcement:n}}const L4=z.createContext(null);function Zz(n){const e=z.useContext(L4);z.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(n)},[n,e])}function Xz(){const[n]=z.useState(()=>new Set),e=z.useCallback(r=>(n.add(r),()=>n.delete(r)),[n]);return[z.useCallback(r=>{let{type:i,event:o}=r;n.forEach(l=>{var a;return(a=l[i])==null?void 0:a.call(l,o)})},[n]),e]}const Kz={draggable:`
|
|
480
|
+
`,attributes:{[qe.tableCellInner]:u}}),new N0(g)}handleBorderNoneStyles(t,r){if(!(r!=null&&r.style))return;["border",...["top","right","bottom","left"].flatMap(o=>[`border-${o}`,`border-${o}-style`])].filter(o=>t.style[o]==="none").forEach(o=>r.style=r.style.replaceAll(new RegExp(`${o}:none;?`,"g"),""))}convert({html:t,text:r},i={}){if(t){const a=new DOMParser().parseFromString(t,"text/html");this.preprocessTableHtml(a),this.mergeClassStylesToInline(a),t=a.body.innerHTML}const o=super.convert({html:t,text:r},i);if(i[qe.tableCellInner])for(const l of o.ops){if(ng.isObject(l.insert)&&l.insert[qe.tableCol]){l.insert="";continue}l.attributes||(l.attributes={}),l.attributes[qe.tableCellInner]=i[qe.tableCellInner]}return o}parseStyleWithFilter(t,r){if(!t)return{};const i={};let o="",l="",a=!0,u=0;for(let g=0;g<t.length;g++){const m=t[g];m===":"&&a?(o=t.substring(u,g).trim(),u=g+1,a=!1):m===";"&&(!a&&o&&(l=t.substring(u,g).trim(),(!r||r(o))&&(i[o]=l)),u=g+1,a=!0)}return!a&&o&&u<t.length&&(l=t.substring(u).trim(),(!r||r(o))&&(i[o]=l)),i}mergeClassStylesToInline(t){var r;try{const i=t.querySelectorAll("td[class], th[class]");if(i.length===0)return;const o=new Set;for(const m of i)(m.getAttribute("class")||"").split(/\s+/).filter(Boolean).forEach(w=>o.add(w));if(o.size===0)return;const l=t.querySelectorAll("style");if(l.length===0)return;const a=Array.from(l).map(m=>m.textContent||"").join("");if(!a)return;const u={},g=m=>this.STYLE_PROPERTIES.some(x=>m.startsWith(x));for(const m of o){const x=new RegExp(`\\.${m}[^{]*{([^}]*)}`,"g");let w;for(;(w=x.exec(a))!==null;){const _=w[1],S=this.parseStyleWithFilter(_),R={};let I=!1;for(const O in S)g(O)&&(R[O]=S[O],I=!0);I&&(u[m]=R)}}if(Object.keys(u).length===0)return;for(let m=0;m<i.length;m++){const x=i[m],w=((r=x.getAttribute("class"))==null?void 0:r.split(/\s+/).filter(Boolean))||[],_=x.getAttribute("style")||"",S=this.parseStyleWithFilter(_);let R=!1;for(const I of w){const O=u[I];if(O)for(const P in O)S[P]||(S[P]=O[P],R=!0)}if(R){let I="";for(const O in S)I+=O+":"+S[O]+";";I&&x.setAttribute("style",I)}x.removeAttribute("class")}}catch(i){console.error("스타일 처리 오류",i)}}matchCaption(t,r){for(let i=0;i<r.ops.length;i++){const o=r.ops[i],{attributes:l}=o;l&&l[qe.tableCaption]&&(l[qe.tableCaption].tableId=this.tableId,o.attributes=l)}return r}preprocessTableHtml(t){try{const r=t.querySelectorAll("table");for(const i of Array.from(r))i.querySelectorAll("tr").length!==0&&(this.cleanupTableStyles(i),this.applyRowspanHeights(i),this.fixRowspanCells(i));this.mergeClassStylesToInline(t)}catch(r){console.error("테이블 전처리 오류",r)}}cleanupTableStyles(t){const r=t.querySelectorAll("td, th, tr, colgroup");for(const i of r){const o=i;o.removeAttribute("height");const l=o.getAttribute("style");if(l){const a=l.replace(/height\s*:[^;]*;?/gi,"").trim();o.setAttribute("style",a||"")}}}applyRowspanHeights(t){const i=t.querySelectorAll("td, th");t.style.borderCollapse="collapse";for(const o of i){const l=o,u=parseInt(l.getAttribute("rowspan")||"1")*24,g=l.getAttribute("style")||"",m=g+(g?"; ":"")+`height: ${u}px`;l.setAttribute("style",m)}}fixRowspanCells(t){const r=t.querySelectorAll("tr");if(r.length<=1)return;const i=[],o=new Map;for(let l=0;l<r.length;l++){const u=r[l].querySelectorAll("td, th");if(u.length===0&&l<r.length-1){i.push(l);continue}for(const g of Array.from(u)){const m=parseInt(g.getAttribute("rowspan")||"1");if(m>1)for(let x=1;x<m;x++){const w=l+x;if(w>=r.length)break;o.has(w)||o.set(w,[]),o.get(w).push(g)}}}i.length>0&&this.processEmptyRows(i,r,o)}processEmptyRows(t,r,i){for(const o of t){const l=i.get(o);if(l)for(const a of l){const u=parseInt(a.getAttribute("rowspan")||"1");u>1&&a.setAttribute("rowspan",(u-1).toString())}}for(const o of t.reverse())r[o].remove()}}class Oz extends E4{fixUnusuaDeletelTable(){}mergeCells(e){if(!this.table||!this.tableSelection)return;const t=this.tableSelection.selectedTds||[];if(t.length>1&&(e=t),!e||e.length<=1)return;const r=Kl(e[0],qe.tableMain),i=r.getRows(),o=e.map(w=>{if(!w||!w.parent||!w.parent.domNode)return null;const _=w.parent.domNode;if(!_)return null;const S=i.findIndex(O=>O.rowId===w.rowId);if(S===-1)return null;const R=w.getColumnIndex();if(R===-1)return null;const I=_.getBoundingClientRect();return!I||I.width===0||I.height===0?null:{td:w,rowIndex:S,colIndex:R,rowspan:w.rowspan,colspan:w.colspan,visualLeft:I.left,visualRight:I.right,visualTop:I.top,visualBottom:I.bottom}}).filter(Boolean);if(o.length<=1)return;o.sort((w,_)=>w.visualTop-_.visualTop||w.visualLeft-_.visualLeft);const l=o[0],a=l.td,u=Math.max(...o.map(w=>w.rowIndex+w.rowspan-1)),g=Math.max(...o.map(w=>w.colIndex+w.colspan-1)),m=u-l.rowIndex+1,x=g-l.colIndex+1;for(const w of o)w.td!==a&&(w.td.moveChildren(a),w.td.parent.remove());a.rowspan=m,a.colspan=x,this.fixTableByRemove(r)}}Xe.register({"modules/imageCompress":Fp,"modules/resize":I4,"modules/tableUp":Oz,"modules/magicUrl":aF,"formats/divider":am,"modules/clipboard":Lz,"modules/copy":fz,"modules/toggleFullscreen":o4},!0);const u1={KB:1024,QUALITY:.7,IMAGE_SIZES:new Map},Pz={getCharLength:n=>Array.from(n).length,calculateTextSize:n=>{if(!n.ops||n.ops.length===0)return 0;let e=0;for(const t of n.ops)if(typeof t.insert=="string")e+=new TextEncoder().encode(t.insert).length-1;else if(typeof t.insert=="object"&&t.insert.image){const r=t.insert.image;r&&(e+=u1.IMAGE_SIZES.get(r)||Math.ceil(r.length*u1.QUALITY))}return e}},Dz=n=>{const{type:e="Primary",editorRef:t,useValue:r,useError:i,placeholder:o,tabIndex:l,autoFocus:a,editorProps:u,style:g,minHeight:m,maxHeight:x,contentHeight:w,contentMaxHeight:_=1e3,toolbarSize:S="Med",toolbarType:R="Default",readOnly:I,limitPosition:O="Bottom",maxLength:P,size:H=100,editorClassName:W,editorStyle:Y,noImageResize:B,...ee}=n,[{wrapId:D,wrapProps:J,labelProps:fe,...Z},te]=zg(ee),ne=z.useMemo(()=>e==="ReadOnly"||I,[e,I]),ue=z.useMemo(()=>w?20:0,[w]),[se,j]=z.useState(S==="Med"?40:50),re=z.useMemo(()=>ne?0:se,[ne,se]),[ge,ve]=z.useMemo(()=>!i||ne||O==="Top"?[0,0]:[20,6],[i,ne,O]),oe=z.useMemo(()=>ge+ve,[ge,ve]),[K,he]=z.useState(w),[Ae,He]=z.useState(!1),[xe,Fe]=z.useState(!1),Me=z.useRef(null),Be=z.useRef(0),ke=z.useRef(0),Re=z.useMemo(()=>Z.label?24:0,[Z.label]),ze=z.useMemo(()=>R==="Title",[R]),Ke=z.useMemo(()=>{if(w&&K)switch(e){case"ReadOnly":return K;case"Raw":return K+oe;default:return K+re+oe}},[w,K,e,re,oe]),Le=z.useMemo(()=>{if(!(!x||x<=re+oe))switch(e){case"ReadOnly":return x;case"Raw":return x-oe;default:return x-re-oe}},[e,re,oe,x]),ft=z.useMemo(()=>{if(m&&w){const vt=Math.min(m-re-oe,w);return ne?vt:vt+re+oe}else return m||(w?void 0:`calc(100% - ${Re}px)`)},[m,w,Re,re,oe,ne]),je=z.useMemo(()=>(Array.isArray(Z.errorMessage)?Z.errorMessage.some(Boolean):!!Z.errorMessage)?"Error":e,[Z.errorMessage,e]),rt=z.useCallback(vt=>{let _t=vt;_t=p7.sanitize(vt);const At=document.createElement("div");return At.innerHTML=_t,new Xe(At,{readOnly:!0}).getContents()},[]),[tt,nt]=Do(r,""),[ht,Pt]=z.useState(()=>rt(tt));z.useEffect(()=>{nt===void 0&&Pt(rt(tt))},[rt,nt,tt]);const Wt=z.useMemo(()=>M.jsx(Nz,{htmlDelta:ht,isReadonly:ne,limit:H*u1.KB,useError:i}),[ht,ne,H,i]),zt=z.useRef(null),Zt=z.useRef([]),[an,Yt]=z.useState(!0);z.useEffect(()=>{const vt=setTimeout(()=>Yt(!1),0);return()=>{clearTimeout(vt),Zt.current.forEach(_t=>_t()),Zt.current=[]}},[]);const pn=z.useCallback((vt,_t)=>{if(!w)return _t;const At=m?m-re-oe:w,Ot=Math.max(At,0),Dt=x?x-re-oe:_;return Math.min(Dt,Math.max(Ot,_t+vt))},[w,m,re,oe,x,_]),Ht=z.useCallback(vt=>{if(!Ae||!w)return;const _t=vt.clientY-ke.current,At=pn(_t,Be.current);K!==At&&he(At),vt.preventDefault(),vt.stopPropagation()},[Ae,w,pn,K]),Sn=z.useCallback(vt=>{He(!1),Fe(!1),document.removeEventListener("mousemove",Ht),document.removeEventListener("mouseup",Sn),vt.preventDefault(),vt.stopPropagation()},[Ht]),ut=z.useCallback(vt=>{if(!w)return;if(vt.detail===2){he(w);return}K===void 0?(he(w),Be.current=w):Be.current=K,He(!0),Fe(!0),ke.current=vt.clientY;const _t=Ot=>{if(!w)return;const Dt=Ot.clientY-ke.current,cn=pn(Dt,Be.current);he(cn),Ot.preventDefault(),Ot.stopPropagation()},At=Ot=>{He(!1),Fe(!1),document.removeEventListener("mousemove",_t),document.removeEventListener("mouseup",At),Ot.preventDefault(),Ot.stopPropagation()};document.addEventListener("mousemove",_t),document.addEventListener("mouseup",At),vt.preventDefault(),vt.stopPropagation()},[w,K,pn]),at=z.useCallback((vt,_t,At,Ot)=>{if(At!=="user"&&At!=="api")return;const Dt=Ot.getContents(),cn=Ot.getLength()-1,yn=P!==void 0&&cn>P,Tt=mn=>mn.replace(/\s{2,}/g,Nn=>" ".repeat(Nn.length)),Lt=vt.replace(/^<p><br><\/p>$/,"").trim(),vn=Tt(Lt);if(!yn){Pt(Dt),nt==null||nt(vn);return}const In=dt(Dt,P);Pt(In);const Dn=new Xe(document.createElement("div"));Dn.setContents(In);const jt=Tt(Dn.root.innerHTML.replace(/^<p><br><\/p>$/,"").trim());nt==null||nt(jt)},[P,nt]),dt=(vt,_t)=>{var Dt,cn,yn;if(!vt.ops)return vt;const At=new Jn;let Ot=0;for(const Tt of vt.ops){if(Ot>=_t)break;if(Tt.insert&&typeof Tt.insert=="string"){const Lt=Tt.insert,vn=_t-Ot;if(Lt.length<=vn)(Dt=At.ops)==null||Dt.push(Tt),Ot+=Lt.length;else{const In={...Tt,insert:Lt.substring(0,vn)};(cn=At.ops)==null||cn.push(In),Ot+=vn;break}}else Ot<_t&&((yn=At.ops)==null||yn.push(Tt),Ot+=1)}return At},kt=z.useCallback(vt=>{var Dt,cn;const _t=vt.getEditor().container;if(!_t)return null;const At=(Dt=_t.closest(".AEditorContainer"))==null?void 0:Dt.querySelector(".ql-toolbar");return At||((cn=_t.parentElement)==null?void 0:cn.querySelector(".ql-toolbar"))||null},[]),rn=z.useCallback((vt,_t,At,Ot)=>{if(!vt)return;const Dt=At;vt.addEventListener(_t,Dt,Ot),Zt.current.push(()=>vt.removeEventListener(_t,Dt,Ot))},[]),sn=z.useCallback((vt,_t,At)=>{const Ot=_t.getFormat();vt.forEach(Dt=>{if(Ot[Dt]){const cn=Ot[Dt],yn=`.ql-${Dt}`,Tt=At.querySelector(`${yn} .ql-picker-label`),Lt=At.querySelectorAll(`${yn} .ql-picker-item`),vn=Array.from(Lt).find(In=>In.getAttribute("data-value")===cn);vn&&(vn.classList.add("ql-selected"),Tt==null||Tt.classList.add("ql-active"))}})},[]),on=z.useCallback(vt=>{if(!vt.length)return;const Ot=vt[0].target.getBoundingClientRect(),Dt=Math.ceil(Ot.height);j(cn=>Math.abs(cn-Dt)<.1?cn:Dt)},[]),Ue=z.useCallback((vt,_t)=>{if(vt.key!=="Backspace")return;const At=_t.getSelection(!1);if(!At||At.length>0)return;const Ot=At.index;if(Ot<=0)return;const[Dt]=_t.getLine(Ot);if(Dt&&Ot===_t.getIndex(Dt)||_t.getFormat(Ot,1).link)return;const cn=_t.getFormat(Ot-1,1);if(cn.link){vt.preventDefault();let yn=Ot-1;for(;yn>0&&_t.getFormat(yn-1,1).link===cn.link;)yn--;const[Tt]=_t.scroll.descendant(Lt=>{var vn;return((vn=Lt==null?void 0:Lt.statics)==null?void 0:vn.blotName)==="link"},yn);if(Tt!=null&&Tt.domNode){const Lt=(Tt.domNode.textContent||"").length;_t.removeFormat(yn,Lt)}}},[]),Ce=z.useCallback(()=>({clipboard:{matchers:[["img",()=>!1],["table",()=>!1],["iframe",()=>!1],["video",()=>!1],["h1, h2, h3, h4, h5, h6",()=>!1],["blockquote",()=>!1],["hr",()=>!1]]},copy:{isTitleMode:!0},keyboard:{bindings:{enter:{key:"Enter",handler:()=>!1},newline:{key:"Enter",shiftKey:!0,handler:()=>!1},tab:{key:"Tab",handler:()=>!1},"remove-newline":{key:"Backspace",collapsed:!0,format:["blockquote","list","code-block"],offset:0,handler:function(vt){const{blockquote:_t,list:At,["code-block"]:Ot}=vt.getFormat();return _t||At||Ot?(vt.format("blockquote",!1),vt.format("list",!1),vt.format("code-block",!1),!1):!0}}}},magicUrl:!0,toolbar:{container:[["bold","italic","underline","strike",{color:[]},{background:[]},"clean"]]}}),[]),Ze=z.useCallback(()=>({clipboard:{},copy:{},keyboard:{},magicUrl:!0,toggleFullscreen:{type:je,maximize:a1.renderToString(M.jsx(uo,{icon:"Maximize",size:S==="Med"?"sm":"md"})),minimize:a1.renderToString(M.jsx(uo,{icon:"Minimize",size:S==="Med"?"sm":"md"}))},imageCompress:{quality:u1.QUALITY,imageType:"image/jpeg",maxWidth:1500,maxHeight:1500,debug:!1,handleOnPaste:vt=>{var _t,At;try{const Ot=(_t=vt.clipboardData)==null?void 0:_t.items;if(!Ot)return!0;const Dt=Array.from(Ot).some(Tt=>{const Lt=Tt.type.toLowerCase();return Lt.includes("Excel")||Lt.includes("text/html")}),cn=(At=vt.clipboardData)==null?void 0:At.getData("text/html"),yn=cn&&(cn.includes("<table")||cn.includes("<tbody")||cn.includes("<td"));return!(Dt||yn)}catch(Ot){return console.warn("Error in handleOnPaste:",Ot),!0}},insertIntoEditor:(vt,_t,At)=>{u1.IMAGE_SIZES.has(vt)||u1.IMAGE_SIZES.set(vt,_t.size);const Ot=At.getSelection();Ot&&At.insertEmbed(Ot.index,"image",vt,Xe.sources.USER)}},...!ne&&{...!B&&{resize:{}},table:!1,tableUp:{fullSwitch:!1,icon:a1.renderToString(M.jsx(uo,{icon:"Table",size:S==="Med"?"sm":"md",strokeWidth:2.5})),resize:ZB,resizeScale:XB,customSelect:ez,selection:JB,fixUnusuaDeletelTable:!1,selectionOptions:{tableMenu:YB,tableMenuOptions:{localstorageKey:"used-color",tipText:!0,tools:[io.InsertCaption,io.InsertTop,io.InsertRight,io.InsertBottom,io.InsertLeft,io.Break,io.MergeCell,io.SplitCell,io.Break,io.DeleteRow,io.DeleteColumn,io.DeleteTable,io.Break,io.BackgroundColor,io.BorderColor,io.Break,io.CopyCell,io.CutCell,io.Break,io.SwitchWidth]}},texts:{fullCheckboxText:Nr.AEditor["Insert Full Width Table"],customBtnText:Nr.AEditor.Custom,confirmText:Nr.AEditor.Confirm,cancelText:Nr.AEditor.Cancel,rowText:Nr.AEditor.Row,colText:Nr.AEditor.Column,CopyCell:Nr.AEditor["Copy Cell"],CutCell:Nr.AEditor["Cut Cell"],notPositiveNumberError:Nr.AEditor["Not Positive Number Error"],custom:Nr.AEditor.Custom,clear:Nr.AEditor.Clear,transparent:Nr.AEditor.Transparent,perWidthInsufficient:Nr.AEditor.perWidthInsufficient,InsertTop:Nr.AEditor["Insert Row Top"],InsertRight:Nr.AEditor["Insert Column Right"],InsertBottom:Nr.AEditor["Insert Row Bottom"],InsertLeft:Nr.AEditor["Insert Column Left"],MergeCell:Nr.AEditor["Merge Cell"],SplitCell:Nr.AEditor["Split Cell"],DeleteRow:Nr.AEditor["Delete Row"],DeleteColumn:Nr.AEditor["Delete Column"],DeleteTable:Nr.AEditor["Delete Table"],BackgroundColor:Nr.AEditor["Set Background Color"],BorderColor:Nr.AEditor["Set Border Color"],SwitchWidth:Nr.AEditor["Switch Table Width"],InsertCaption:Nr.AEditor["Insert Table Caption"]}},toolbar:{container:[[{header:[1,2,3,!1,4]}],["bold","italic","underline","strike","blockquote","divider",{[E4.toolName]:[]},{color:[]},{background:[]}],[{list:"ordered"},{list:"bullet"},{indent:"-1"},{indent:"+1"},{align:[]}],["link","image","video"],["clean"]],handlers:{divider:function(){const vt=this.quill,_t=vt.getSelection(!0);if(!_t)return;const At=Math.min(_t.index+1,vt.getLength()-1);vt.insertEmbed(At,"divider",!0,Xe.sources.USER),setTimeout(()=>vt.setSelection(Math.min(At+1,vt.getLength()-1),0,Xe.sources.SILENT),0)}}}}}),[ne,B,S,je]),Ct=z.useMemo(()=>ze?Ce():Ze(),[ze,Ce,Ze]),Qt=z.useCallback(vt=>{if(!vt)return;const _t=vt.getEditor();if(!_t)return;const At=_t.root,Ot=kt(vt);At&&W&&At.classList.add(...W.split(" ")),At&&Y&&Object.entries(Y).forEach(([cn,yn])=>{const Tt=cn.replace(/([A-Z])/g,Lt=>`-${Lt[0].toLowerCase()}`);At.style[Tt]=yn}),rn(At,"keydown",cn=>Ue(cn,_t));const Dt=new ResizeObserver(on);if(Ot){Dt.observe(Ot),Zt.current.push(()=>Dt.disconnect());const cn=["header","color","background"];cn.forEach(yn=>{const Tt=Ot.querySelector(`.ql-${yn} .ql-picker-label`);Tt&&rn(Tt,"click",()=>sn(cn,_t,Ot))})}},[kt,W,Y,rn,on,Ue,sn]),Xt=z.useCallback(vt=>{if(Zt.current.forEach(At=>At()),Zt.current=[],zt.current=vt,!vt){ng.isFunction(t)?t(null):t!=null&&t.current&&(t.current=null);return}const _t=vt;_t.copyContent=At=>{vt.getEditor().getModule("copy").copyContent(At)},ng.isFunction(t)?t(_t):t&&(t.current=_t),Qt(vt)},[t,Qt]);return M.jsx(sg,{wrapId:D,...Z,wrapProps:{...J,style:{...J==null?void 0:J.style,height:w?"fit-content":"100%"}},label:M.jsxs(vl,{style:{gap:4},children:[Z.label,O==="Top"&&Wt]}),labelProps:{...fe,style:{minHeight:Z.label?20:void 0,marginBottom:Z.label?4:0,...fe==null?void 0:fe.style}},children:M.jsxs(Wi,{...te,className:yt.clsx(te.className,Ff.AEditorContainer,an&&"NoTransition"),style:{...g,height:Ke,minHeight:ft,maxHeight:Le},children:[M.jsx(Pv,{...u,ref:Xt,preserveWhitespace:!0,modules:Ct,placeholder:o,readOnly:ne,theme:"snow",value:ht,className:yt.clsx(u==null?void 0:u.className,Ff.AEditor,Ff[je],ze&&"Title",an&&"NoTransition"),style:{...u==null?void 0:u.style,"--editor-padding":ze?"8px 12px":"12px","--title-color-picker-row":ze?1:4,"--icon-size":`${S==="Med"?20:24}px`,"--toolbar-padding":`${S==="Med"?7.5:12.5}px`,"--title-header-font-size":`${S==="Med"?12:14}px`,"--default-text":`'${Nr.AEditor.Default}'`,"--visit-url-text":`'${Nr.AEditor["Visit URL:"]}'`,"--enter-link-text":`'${Nr.AEditor["Enter link:"]}'`,"--enter-video-text":`'${Nr.AEditor["Enter video:"]}'`,"--edit-text":`'${Nr.AEditor.Edit}'`,"--save-text":`'${Nr.AEditor.Save}'`,"--remove-text":`'${Nr.AEditor.Remove}'`,"--arrow-background":`url("data:image/svg+xml,${encodeURIComponent(a1.renderToString(M.jsx(uo,{icon:"EditorArrow"})))}`},onChange:at}),w&&M.jsxs(M.Fragment,{children:[M.jsx("div",{ref:Me,className:yt.clsx(Ff.Resizer,an&&"NoTransition"),style:{height:ue,bottom:i&&!ne?oe:0},onMouseDown:ut}),M.jsx("div",{children:`${Math.round(K)}px`,className:yt.clsx(Ff.Indicator,"NoSelect","Label1",an&&"NoTransition"),style:{height:ue,bottom:i&&!ne?oe:0,display:xe?"flex":"none"}})]}),M.jsx("div",{children:Wt,className:yt.clsx(Ff.LimitContainer,"NoSelect",an&&"NoTransition"),style:{marginTop:ve,minHeight:ge,display:O==="Bottom"?"flex":"none"}})]})})},Nz=n=>{const e=Vn.c(17),{htmlDelta:t,limit:r,useError:i,isReadonly:o}=n,[l,a]=Do(i,!1),u=Pz.calculateTextSize(t);let g,m;if(e[0]!==u||e[1]!==r||e[2]!==a?(g=()=>{a&&a(u>r)},m=[u,r,a],e[0]=u,e[1]=r,e[2]=a,e[3]=g,e[4]=m):(g=e[3],m=e[4]),z.useEffect(g,m),!i||o)return null;let x;e[5]!==l?(x=yt.clsx(l&&Ff.Error),e[5]=l,e[6]=x):x=e[6];let w;e[7]!==u?(w=Lg(u),e[7]=u,e[8]=w):w=e[8];let _;e[9]!==x||e[10]!==w?(_=M.jsx("span",{className:x,children:w}),e[9]=x,e[10]=w,e[11]=_):_=e[11];let S;e[12]!==r?(S=Lg(r),e[12]=r,e[13]=S):S=e[13];let R;return e[14]!==_||e[15]!==S?(R=M.jsxs(nd,{className:Ff.Limit,children:["(",_," / ",S,")"]}),e[14]=_,e[15]=S,e[16]=R):R=e[16],R};function Fz(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return z.useMemo(()=>r=>{e.forEach(i=>i(r))},e)}const zv=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function N1(n){const e=Object.prototype.toString.call(n);return e==="[object Window]"||e==="[object global]"}function jm(n){return"nodeType"in n}function cf(n){var e,t;return n?N1(n)?n:jm(n)&&(e=(t=n.ownerDocument)==null?void 0:t.defaultView)!=null?e:window:window}function $m(n){const{Document:e}=cf(n);return n instanceof e}function Kp(n){return N1(n)?!1:n instanceof cf(n).HTMLElement}function k4(n){return n instanceof cf(n).SVGElement}function F1(n){return n?N1(n)?n.document:jm(n)?$m(n)?n:Kp(n)||k4(n)?n.ownerDocument:document:document:document}const ld=zv?z.useLayoutEffect:z.useEffect;function e2(n){const e=z.useRef(n);return ld(()=>{e.current=n}),z.useCallback(function(){for(var t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];return e.current==null?void 0:e.current(...r)},[])}function Bz(){const n=z.useRef(null),e=z.useCallback((r,i)=>{n.current=setInterval(r,i)},[]),t=z.useCallback(()=>{n.current!==null&&(clearInterval(n.current),n.current=null)},[]);return[e,t]}function zp(n,e){e===void 0&&(e=[n]);const t=z.useRef(n);return ld(()=>{t.current!==n&&(t.current=n)},e),t}function Jp(n,e){const t=z.useRef();return z.useMemo(()=>{const r=n(t.current);return t.current=r,r},[...e])}function bv(n){const e=e2(n),t=z.useRef(null),r=z.useCallback(i=>{i!==t.current&&(e==null||e(i,t.current)),t.current=i},[]);return[t,r]}function um(n){const e=z.useRef();return z.useEffect(()=>{e.current=n},[n]),e.current}let Pb={};function Qp(n,e){return z.useMemo(()=>{if(e)return e;const t=Pb[n]==null?0:Pb[n]+1;return Pb[n]=t,n+"-"+t},[n,e])}function M4(n){return function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return r.reduce((o,l)=>{const a=Object.entries(l);for(const[u,g]of a){const m=o[u];m!=null&&(o[u]=m+n*g)}return o},{...e})}}const m1=M4(1),yv=M4(-1);function zz(n){return"clientX"in n&&"clientY"in n}function t2(n){if(!n)return!1;const{KeyboardEvent:e}=cf(n.target);return e&&n instanceof e}function Hz(n){if(!n)return!1;const{TouchEvent:e}=cf(n.target);return e&&n instanceof e}function fm(n){if(Hz(n)){if(n.touches&&n.touches.length){const{clientX:e,clientY:t}=n.touches[0];return{x:e,y:t}}else if(n.changedTouches&&n.changedTouches.length){const{clientX:e,clientY:t}=n.changedTouches[0];return{x:e,y:t}}}return zz(n)?{x:n.clientX,y:n.clientY}:null}const Hp=Object.freeze({Translate:{toString(n){if(!n)return;const{x:e,y:t}=n;return"translate3d("+(e?Math.round(e):0)+"px, "+(t?Math.round(t):0)+"px, 0)"}},Scale:{toString(n){if(!n)return;const{scaleX:e,scaleY:t}=n;return"scaleX("+e+") scaleY("+t+")"}},Transform:{toString(n){if(n)return[Hp.Translate.toString(n),Hp.Scale.toString(n)].join(" ")}},Transition:{toString(n){let{property:e,duration:t,easing:r}=n;return e+" "+t+"ms "+r}}}),Ow="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function Wz(n){return n.matches(Ow)?n:n.querySelector(Ow)}const Uz={display:"none"};function Gz(n){let{id:e,value:t}=n;return z.createElement("div",{id:e,style:Uz},t)}function Yz(n){let{id:e,announcement:t,ariaLiveType:r="assertive"}=n;const i={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return z.createElement("div",{id:e,style:i,role:"status","aria-live":r,"aria-atomic":!0},t)}function Vz(){const[n,e]=z.useState("");return{announce:z.useCallback(r=>{r!=null&&e(r)},[]),announcement:n}}const L4=z.createContext(null);function Zz(n){const e=z.useContext(L4);z.useEffect(()=>{if(!e)throw new Error("useDndMonitor must be used within a children of <DndContext>");return e(n)},[n,e])}function Xz(){const[n]=z.useState(()=>new Set),e=z.useCallback(r=>(n.add(r),()=>n.delete(r)),[n]);return[z.useCallback(r=>{let{type:i,event:o}=r;n.forEach(l=>{var a;return(a=l[i])==null?void 0:a.call(l,o)})},[n]),e]}const Kz={draggable:`
|
|
481
481
|
To pick up a draggable item, press the space bar.
|
|
482
482
|
While dragging, use the arrow keys to move the item.
|
|
483
483
|
Press space again to drop the item in its new position, or press escape to cancel.
|
package/dist/index.es.js
CHANGED
|
@@ -49330,7 +49330,7 @@ const d1 = {
|
|
|
49330
49330
|
...K,
|
|
49331
49331
|
style: {
|
|
49332
49332
|
...K == null ? void 0 : K.style,
|
|
49333
|
-
height: "100%"
|
|
49333
|
+
height: w ? "fit-content" : "100%"
|
|
49334
49334
|
}
|
|
49335
49335
|
}, label: /* @__PURE__ */ L.jsxs(Nl, { style: {
|
|
49336
49336
|
gap: 4
|