@solibo/solibo-ui 2.2.9 → 2.2.10

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.
@@ -1 +1 @@
1
- ._field_1clme_3{min-width:0;width:100%}._editor_1clme_8{display:grid;grid-template-areas:"toolbar submit" "content content" "files files";grid-template-columns:minmax(0,1fr) auto;background-color:var(--colors-semantic-bg-surface);border:var(--scale-1) solid var(--colors-semantic-border-default);border-radius:var(--shape-border-radius-radius-md);box-shadow:var(--shape-box-shadow-xs-position-x) var(--shape-box-shadow-xs-position-y) var(--shape-box-shadow-xs-blur) var(--shape-box-shadow-xs-spread) var(--shape-box-shadow-xs-color)}._editor_1clme_8>[data-component=toolbar]{grid-area:toolbar}._editor_1clme_8:has(>._submit_1clme_26)>[data-component=toolbar]{border-top-right-radius:0}._editor_1clme_8 [role=textbox]{border-radius:inherit;box-sizing:border-box;line-height:1.25;max-height:var(--editor-max-height);min-height:var(--editor-min-height);overflow-y:auto;padding:var(--scale-8) var(--utils-tokens-unit)}._editor_1clme_8 img{max-width:100%}@media (width <= 370px){._editor_1clme_8 [data-component=toolbar]:first-of-type{justify-content:space-between}._editor_1clme_8 button{padding-inline:calc(var(--scale-12) - var(--scale-1))!important}}._resizable_1clme_56 [role=textbox]{resize:vertical}._resized_1clme_60 [role=textbox]{max-height:none}._resize-handle_1clme_64{align-items:center;cursor:ns-resize;display:flex;height:var(--scale-12);justify-content:center;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}._resize-handle_1clme_64:after{background:var(--colors-semantic-border-default);border-radius:var(--shape-border-radius-radius-md);content:"";height:var(--scale-2);width:var(--scale-32)}._resize-handle_1clme_64:focus-visible{outline:solid var(--scale-2) var(--colors-semantic-border-focus);outline-offset:var(--shape-outline-offset, calc(var(--scale-2) * -1))}._invalid_1clme_86{border-color:var(--colors-semantic-status-error-border)}._error_1clme_90{color:var(--colors-semantic-status-error-content);font-size:var(--typography-font-sizes-body-sm);margin-top:var(--scale-4)}._dragging_1clme_96{background-color:var(--colors-semantic-primary-primary-subtle)}._content_1clme_100{grid-area:content;border-radius:0 0 var(--shape-border-radius-radius-md) var(--shape-border-radius-radius-md);position:relative;transition:background-color var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function)}._content_1clme_100:has([role=textbox]:focus-visible){outline:solid var(--scale-2) var(--colors-semantic-border-focus);outline-offset:var(--shape-outline-offset, calc(var(--scale-2) * -1))}._has-files_1clme_112 ._content_1clme_100{border-radius:0}._files_1clme_116{grid-area:files;border-top:var(--scale-1) solid var(--colors-semantic-border-default);display:flex;flex-wrap:wrap;gap:var(--scale-8);padding:var(--scale-8) var(--utils-tokens-unit)}._placeholder_1clme_125{color:var(--colors-semantic-content-secondary);left:var(--utils-tokens-unit);pointer-events:none;position:absolute;top:var(--scale-8)}._fill_1clme_133{display:grid;flex:1;grid-template-rows:minmax(0,1fr) auto;height:100%;min-height:0}._fill-editor_1clme_141{display:grid;grid-template-rows:auto minmax(0,1fr) auto;height:100%;min-height:0}._fill-editor_1clme_141 ._content_1clme_100{min-height:0}._fill-editor_1clme_141 [role=textbox]{height:100%;max-height:none}._editor_1clme_8 [role=textbox]:focus-visible{outline:0}._meta_1clme_161{align-items:center;display:grid;flex-basis:100%;grid-template-columns:minmax(0,1fr) auto auto auto;opacity:0;transition:all var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function)}._meta_1clme_161._active_1clme_170{border-top:var(--scale-1) solid var(--colors-semantic-border-default);height:auto;opacity:1}._meta_1clme_161 input{border-radius:0;width:100%}._image-sizes_1clme_182{display:flex;flex-wrap:wrap;gap:var(--scale-4);padding:var(--scale-4)}._submit_1clme_26{align-items:flex-start;background-color:var(--colors-semantic-bg-page);border-bottom:var(--scale-1) solid var(--colors-semantic-border-default);border-top-right-radius:var(--shape-border-radius-radius-md);display:flex;grid-area:submit}._submit_1clme_26>button{margin:var(--shape-outline-focus) var(--shape-spacing-2xs)}._bold_1clme_202{font-weight:700}._italic_1clme_206{font-style:italic}._underline_1clme_210{text-decoration:underline}._link_1clme_214{color:var(--colors-semantic-primary-primary);cursor:pointer;text-decoration:underline}._list_1clme_220,._paragraph_1clme_221{margin:var(--scale-8) 0}._paragraph_1clme_221:first-child{margin-top:0}._list_1clme_220{list-style-type:disc!important}._list_1clme_220 li{list-style:inherit;margin-bottom:var(--scale-8);margin-left:var(--scale-16)}@media (width < 480px){._submit_1clme_26>button>span:not([data-component=icon]){display:none}._image-sizes_1clme_182{grid-row:1;grid-column:1 / 5}}
1
+ ._field_1trki_3{min-width:0;width:100%}._editor_1trki_8{display:grid;grid-template-areas:"toolbar submit" "content content" "files files";grid-template-columns:minmax(0,1fr) auto;background-color:var(--colors-semantic-bg-surface);border:var(--scale-1) solid var(--colors-semantic-border-default);border-radius:var(--shape-border-radius-radius-md);box-shadow:var(--shape-box-shadow-xs-position-x) var(--shape-box-shadow-xs-position-y) var(--shape-box-shadow-xs-blur) var(--shape-box-shadow-xs-spread) var(--shape-box-shadow-xs-color)}._editor_1trki_8>[data-component=toolbar]{grid-area:toolbar}._editor_1trki_8:has(>._submit_1trki_26)>[data-component=toolbar]{border-top-right-radius:0}._editor_1trki_8 [role=textbox]{border-radius:inherit;box-sizing:border-box;line-height:1.25;max-height:var(--editor-max-height);min-height:var(--editor-min-height);overflow-y:auto;padding:var(--scale-8) var(--utils-tokens-unit)}._editor_1trki_8 img{max-width:100%}@media (width <= 370px){._editor_1trki_8 [data-component=toolbar]:first-of-type{justify-content:space-between}._editor_1trki_8 button:not(._image-resize-handle_1trki_50){padding-inline:calc(var(--scale-12) - var(--scale-1))!important}}._resizable_1trki_56 [role=textbox]{resize:vertical}._resized_1trki_60 [role=textbox]{max-height:none}._resize-handle_1trki_64{align-items:center;cursor:ns-resize;display:flex;height:var(--scale-12);justify-content:center;touch-action:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}._resize-handle_1trki_64:after{background:var(--colors-semantic-border-default);border-radius:var(--shape-border-radius-radius-md);content:"";height:var(--scale-2);width:var(--scale-32)}._resize-handle_1trki_64:focus-visible{outline:solid var(--scale-2) var(--colors-semantic-border-focus);outline-offset:var(--shape-outline-offset, calc(var(--scale-2) * -1))}._invalid_1trki_86{border-color:var(--colors-semantic-status-error-border)}._error_1trki_90{color:var(--colors-semantic-status-error-content);font-size:var(--typography-font-sizes-body-sm);margin-top:var(--scale-4)}._dragging_1trki_96{background-color:var(--colors-semantic-primary-primary-subtle)}._content_1trki_100{grid-area:content;border-radius:0 0 var(--shape-border-radius-radius-md) var(--shape-border-radius-radius-md);position:relative;transition:background-color var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function)}._content_1trki_100:has([role=textbox]:focus-visible){outline:solid var(--scale-2) var(--colors-semantic-border-focus);outline-offset:var(--shape-outline-offset, calc(var(--scale-2) * -1))}._has-files_1trki_112 ._content_1trki_100{border-radius:0}._files_1trki_116{grid-area:files;border-top:var(--scale-1) solid var(--colors-semantic-border-default);display:flex;flex-wrap:wrap;gap:var(--scale-8);padding:var(--scale-8) var(--utils-tokens-unit)}._placeholder_1trki_125{color:var(--colors-semantic-content-secondary);left:var(--utils-tokens-unit);pointer-events:none;position:absolute;top:var(--scale-8)}._fill_1trki_133{display:grid;flex:1;grid-template-rows:minmax(0,1fr) auto;height:100%;min-height:0}._fill-editor_1trki_141{display:grid;grid-template-rows:auto minmax(0,1fr) auto;height:100%;min-height:0}._fill-editor_1trki_141 ._content_1trki_100{min-height:0}._fill-editor_1trki_141 [role=textbox]{height:100%;max-height:none}._editor_1trki_8 [role=textbox]:focus-visible{outline:0}._meta_1trki_161{align-items:center;display:grid;flex-basis:100%;grid-template-columns:minmax(0,1fr) auto auto auto;opacity:0;transition:all var(--utils-tokens-transition-duration) var(--utils-tokens-transition-timing-function)}._meta_1trki_161._active_1trki_170{border-top:var(--scale-1) solid var(--colors-semantic-border-default);height:auto;opacity:1}._meta_1trki_161 input{border-radius:0;width:100%}._inline-image_1trki_182{display:inline-block;max-width:100%;position:relative;vertical-align:bottom}._inline-image_1trki_182 img{display:block;height:auto}._inline-image_1trki_182:focus-visible{outline:solid var(--scale-2) var(--colors-semantic-border-focus);outline-offset:var(--shape-outline-offset, calc(var(--scale-2) * -1))}._image-resize-handle_1trki_50{background:transparent;border:0;bottom:0;cursor:ew-resize;height:var(--scale-24);padding:0;position:absolute;right:0;touch-action:none;width:var(--scale-24)}._image-resize-handle_1trki_50:after{background:var(--colors-semantic-bg-surface);border:var(--scale-2) solid var(--colors-semantic-primary-primary);bottom:0;box-sizing:border-box;content:"";height:var(--scale-12);position:absolute;right:0;width:var(--scale-12)}._image-resize-handle_1trki_50:focus-visible{outline:solid var(--scale-2) var(--colors-semantic-border-focus);outline-offset:var(--shape-outline-offset, calc(var(--scale-2) * -1))}._submit_1trki_26{align-items:flex-start;background-color:var(--colors-semantic-bg-page);border-bottom:var(--scale-1) solid var(--colors-semantic-border-default);border-top-right-radius:var(--shape-border-radius-radius-md);display:flex;grid-area:submit}._submit_1trki_26>button{margin:var(--shape-outline-focus) var(--shape-spacing-2xs)}._bold_1trki_240{font-weight:700}._italic_1trki_244{font-style:italic}._underline_1trki_248{text-decoration:underline}._link_1trki_252{color:var(--colors-semantic-primary-primary);cursor:pointer;text-decoration:underline}._list_1trki_258,._paragraph_1trki_259{margin:var(--scale-8) 0}._paragraph_1trki_259:first-child{margin-top:0}._list_1trki_258{list-style-type:disc!important}._list_1trki_258 li{list-style:inherit;margin-bottom:var(--scale-8);margin-left:var(--scale-16)}@media (width < 480px){._submit_1trki_26>button>span:not([data-component=icon]){display:none}}
@@ -1 +1 @@
1
- "use strict";require('../../assets/index43.css');var De=Object.defineProperty;var Ie=(l,n,t)=>n in l?De(l,n,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[n]=t;var F=(l,n,t)=>Ie(l,typeof n!="symbol"?n+"":n,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),xe=require("@lexical/html"),E=require("@lexical/link"),$=require("@lexical/list"),Le=require("@lexical/react/LexicalAutoFocusPlugin"),ke=require("@lexical/react/LexicalAutoLinkPlugin"),ge=require("@lexical/react/LexicalComposerContext"),Ce=require("@lexical/react/LexicalContentEditable"),Se=require("@lexical/react/LexicalErrorBoundary"),Ne=require("@lexical/react/LexicalExtensionComposer"),Me=require("@lexical/react/LexicalHistoryPlugin"),je=require("@lexical/react/LexicalLinkPlugin"),we=require("@lexical/react/LexicalListPlugin"),Ae=require("@lexical/react/LexicalOnChangePlugin"),Ee=require("@lexical/react/LexicalRichTextPlugin"),re=require("classix"),a=require("lexical"),s=require("react"),me=require("sanitize-html"),k=require("../button/index.cjs"),$e=require("../file/index.cjs"),Te=require("@lexical/utils"),A=require("../icon/index.cjs"),be=require("../../index-7blZaPiA.cjs"),ye=require("../toolbar/index.cjs"),ve=a.createCommand();class se extends a.DecoratorNode{constructor(t,c,f,g,p,o,h){super(p);F(this,"__src");F(this,"__alt");F(this,"__width");F(this,"__height");F(this,"__soliboDocumentId");F(this,"__soliboDocumentSlot");this.__src=t,this.__alt=c,this.__width=f,this.__height=g,this.__soliboDocumentId=o,this.__soliboDocumentSlot=h}static getType(){return"image"}static clone(t){return new se(t.__src,t.__alt,t.__width,t.__height,t.__key,t.__soliboDocumentId,t.__soliboDocumentSlot)}static importJSON(t){return de({alt:t.alt,height:t.height,soliboDocumentId:t.soliboDocumentId,soliboDocumentSlot:t.soliboDocumentSlot,src:t.src,width:t.width})}exportJSON(){return{alt:this.__alt,height:this.__height,...this.__soliboDocumentId?{soliboDocumentId:this.__soliboDocumentId}:void 0,...this.__soliboDocumentSlot?{soliboDocumentSlot:this.__soliboDocumentSlot}:void 0,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:t=>({conversion:c=>{if(!(c instanceof HTMLImageElement))return null;const f=c.getAttribute("src")??"";if(!f)return null;const g=c.getAttribute("width"),p=c.getAttribute("height");return{node:de({alt:c.getAttribute("alt")??"",height:p?Number(p):void 0,soliboDocumentId:c.getAttribute("data-solibo-document-id")??void 0,soliboDocumentSlot:c.getAttribute("data-solibo-document-slot")??void 0,src:f,width:g?Number(g):void 0})}},priority:0})}}exportDOM(){const t=document.createElement("img");return this.__soliboDocumentSlot||t.setAttribute("src",this.__src),this.__soliboDocumentId&&t.setAttribute("data-solibo-document-id",this.__soliboDocumentId),this.__soliboDocumentSlot&&t.setAttribute("data-solibo-document-slot",this.__soliboDocumentSlot),this.__alt&&t.setAttribute("alt",this.__alt),this.__width&&t.setAttribute("width",String(this.__width)),this.__height&&t.setAttribute("height",String(this.__height)),{element:t}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(t){const c=this.getWritable();return c.__src=t,c}setWidth(t){const c=this.getWritable();return c.__width=t,c.__height=void 0,c}decorate(t){return i.jsx("img",{alt:this.__alt,height:this.__height,"data-solibo-document-id":this.__soliboDocumentId,"data-solibo-document-slot":this.__soliboDocumentSlot,onClick:c=>{c.preventDefault(),t.dispatchCommand(ve,{key:this.getKey(),soliboDocumentSlot:this.__soliboDocumentSlot,src:this.__src,width:this.__width})},src:this.__src,width:this.__width})}}function de({alt:l="",height:n,soliboDocumentId:t,soliboDocumentSlot:c,src:f,width:g}){return a.$applyNodeReplacement(new se(f,l,g,n,void 0,t,c))}function he(l){return l instanceof se}const Oe=({createImages:l})=>{const[n]=ge.useLexicalComposerContext();return s.useEffect(()=>n.registerCommand(a.PASTE_COMMAND,t=>{var p;if(!("clipboardData"in t))return!1;const c=t,f=Array.from(((p=c.clipboardData)==null?void 0:p.items)??[]).flatMap(o=>{if(o.kind!=="file"||!o.type.startsWith("image/"))return[];const h=o.getAsFile();return h?[h]:[]});if(f.length===0)return!1;c.preventDefault();const g=l(f);return n.update(()=>{a.$insertNodes(g.map(o=>de(o)))}),!0},a.COMMAND_PRIORITY_HIGH),[l,n]),null},Re=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,Pe=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,Be=[l=>{const n=Re.exec(l);return n!=null&&n.length?{index:n.index,length:n[0].length,text:n[0],url:`mailto:${n[0]}`}:null},l=>{const n=Pe.exec(l);return n!=null&&n.length?{index:n.index,length:n[0].length,text:n[0],url:n[0].startsWith("http")?n[0]:`https://${n[0]}`}:null}];function _e(l){try{const n=new URL(l);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}const qe="_field_1clme_3",Ue="_editor_1clme_8",ze="_submit_1clme_26",He="_resizable_1clme_56",Fe="_resized_1clme_60",Ke="_invalid_1clme_86",We="_error_1clme_90",Ge="_dragging_1clme_96",Ze="_content_1clme_100",Ye="_files_1clme_116",Ve="_placeholder_1clme_125",Xe="_fill_1clme_133",Je="_meta_1clme_161",Qe="_active_1clme_170",et="_bold_1clme_202",tt="_italic_1clme_206",it="_underline_1clme_210",nt="_link_1clme_214",rt="_list_1clme_220",st="_paragraph_1clme_221",_={field:qe,editor:Ue,submit:ze,resizable:He,resized:Fe,"resize-handle":"_resize-handle_1clme_64",invalid:Ke,error:We,dragging:Ge,content:Ze,"has-files":"_has-files_1clme_112",files:Ye,placeholder:Ve,fill:Xe,"fill-editor":"_fill-editor_1clme_141",meta:Je,active:Qe,"image-sizes":"_image-sizes_1clme_182",bold:et,italic:tt,underline:it,link:nt,list:rt,paragraph:st};function ot({editableRef:l}){const n=s.useRef(null),[t,c]=s.useState(0),[f,g]=s.useState(0);s.useEffect(()=>{const o=l.current;if(!o)return;const h=()=>{c(Math.round(o.getBoundingClientRect().height)),g(Math.round(parseFloat(getComputedStyle(o).minHeight)||0))};if(h(),typeof ResizeObserver>"u")return;const C=new ResizeObserver(h);return C.observe(o),()=>C.disconnect()},[l]);const p=o=>{const h=l.current;if(!h)return;const C=parseFloat(getComputedStyle(h).minHeight)||0;h.style.height=`${Math.max(C,o)}px`};return i.jsx("div",{"aria-label":"Resize editor","aria-orientation":"horizontal","aria-valuemin":f,"aria-valuenow":t,"aria-valuetext":`${t} pixels`,className:_["resize-handle"],role:"separator",tabIndex:0,onDoubleClick:()=>{var o;return(o=l.current)==null?void 0:o.style.removeProperty("height")},onKeyDown:o=>{const h=l.current;h&&(o.key==="Home"?(o.preventDefault(),h.style.removeProperty("height")):(o.key==="ArrowUp"||o.key==="ArrowDown")&&(o.preventDefault(),p(h.getBoundingClientRect().height+(o.key==="ArrowUp"?20:-20))))},onPointerDown:o=>{const h=l.current;o.button!==0||!h||(o.preventDefault(),o.currentTarget.focus({preventScroll:!0}),o.currentTarget.setPointerCapture(o.pointerId),n.current={pointerId:o.pointerId,y:o.clientY,height:h.getBoundingClientRect().height})},onPointerMove:o=>{!n.current||n.current.pointerId!==o.pointerId||p(n.current.height+n.current.y-o.clientY)},onPointerUp:o=>{!n.current||n.current.pointerId!==o.pointerId||(n.current=null,o.currentTarget.releasePointerCapture(o.pointerId))},onLostPointerCapture:()=>{n.current=null},onPointerCancel:()=>{n.current=null},"data-component":"editorresizehandle"})}const lt=[{label:"Small",width:320},{label:"Medium",width:640},{label:"Large",width:960},{label:"Original",width:void 0}],at=({onFilesSelected:l,onInlineImageRemove:n})=>{const[t]=ge.useLexicalComposerContext(),[c,f]=s.useState(!1),[g,p]=s.useState(!1),[o,h]=s.useState(!1),[C,J]=s.useState(!1),[z,j]=s.useState(!1),[Q,S]=s.useState(!1),[T,O]=s.useState(""),[b,K]=s.useState(null),[W,R]=s.useState(null),[oe,G]=s.useState(void 0),[P,v]=s.useState(""),le=_e(P.trim()),ee=s.useRef(null),ae=s.useRef(null),B=s.useRef(null),y=s.useRef(null),Z=s.useRef(!1),te=e=>e.preventDefault(),Y=s.useCallback(e=>{y.current=a.$isRangeSelection(e)?e.clone():null},[]),D=s.useCallback(e=>{t.update(()=>{y.current&&a.$setSelection(y.current),e()}),y.current=null},[t]),I=e=>{Z.current=!0,e.preventDefault()},q=()=>{if(Z.current){Z.current=!1;return}ne()},x=s.useCallback(()=>{p(!1),O(""),K(null),R(null),G(void 0)},[]),N=s.useCallback(()=>{j(!1),v("")},[]),ce=s.useCallback(e=>{p(!0),O((e==null?void 0:e.src)??""),K((e==null?void 0:e.key)??null),R((e==null?void 0:e.soliboDocumentSlot)??null),G(e==null?void 0:e.width),N(),e!=null&&e.soliboDocumentSlot||setTimeout(()=>{var d;return(d=ae.current)==null?void 0:d.focus()},0)},[N]),ue=s.useCallback(e=>{t.getEditorState().read(()=>{Y(a.$getSelection())}),j(!0),v(e),x(),setTimeout(()=>{var d;return(d=B.current)==null?void 0:d.focus()},0)},[x,t,Y]),ie=s.useCallback(()=>{const e=P.trim();_e(e)&&(D(()=>{t.dispatchCommand(E.TOGGLE_LINK_COMMAND,{url:e,target:"_blank"});const d=a.$getSelection();if(!a.$isRangeSelection(d))return;const w=d.getNodes().at(-1)??null,H=(w==null?void 0:w.getParent())??null,L=E.$isLinkNode(w)?w:E.$isLinkNode(H)?H:null;if(L){const U=L.getLastChild();if(a.$isTextNode(U)){const fe=U.getTextContent(),pe=fe.replace(/\s+$/,"");pe!==fe&&U.setTextContent(pe)}const X=L.getNextSibling();if(a.$isTextNode(X)&&/^\s/.test(X.getTextContent())){X.select(1,1);return}const M=a.$createTextNode(" ");L.insertAfter(M),M.selectEnd()}}),N())},[N,t,P,D]),ne=s.useCallback(()=>{const e=T.trim();if(!e){x();return}t.update(()=>{if(b){const d=a.$getNodeByKey(b);he(d)&&d.setSrc(e);return}a.$insertNodes([de({src:e})])}),x()},[x,t,b,T]),V=s.useCallback(()=>{if(!b){x();return}t.update(()=>{const e=a.$getNodeByKey(b);if(he(e)){const d=e.getParent();a.$isParagraphNode(d)&&d.getChildrenSize()===1?d.remove():e.remove(),W&&(n==null||n(W))}}),x()},[x,t,b,W,n]),r=s.useCallback(e=>{b&&(t.update(()=>{const d=a.$getNodeByKey(b);he(d)&&d.setWidth(e)}),G(e))},[t,b]),u=s.useCallback(()=>{D(()=>{t.dispatchCommand(E.TOGGLE_LINK_COMMAND,null)}),N()},[N,t,D]),m=s.useCallback(()=>{const e=a.$getSelection();if(!a.$isRangeSelection(e)){if(a.$isNodeSelection(e)){const H=e.getNodes(),L=H[0]??null,U=(L==null?void 0:L.getParent())??null;f(H.some(M=>a.$isTextNode(M)&&M.hasFormat("bold"))),h(H.some(M=>a.$isTextNode(M)&&M.hasFormat("italic"))),J(H.some(M=>a.$isTextNode(M)&&M.hasFormat("underline"))),S($.$isListNode(U)||$.$isListItemNode(U)||$.$isListNode(L)||$.$isListItemNode(L));const X=E.$isLinkNode(L)?L:E.$isLinkNode(U)?U:null;if(X){j(!0),v(X.getURL());return}j(!1),v(""),y.current=null;return}f(!1),h(!1),J(!1),S(!1),j(!1),v(""),y.current=null;return}const[d]=e.getNodes(),w=(d==null?void 0:d.getParent())??null;if(f(e.hasFormat("bold")),h(e.hasFormat("italic")),J(e.hasFormat("underline")),S($.$isListNode(w)||$.$isListItemNode(w)),E.$isLinkNode(w)){j(!0),v(w.getURL()),Y(e);return}j(!1),v(""),y.current=null},[Y]);return s.useEffect(()=>Te.mergeRegister(t.registerUpdateListener(({editorState:e})=>{e.read(()=>{m()})}),t.registerCommand(ve,e=>(ce(e),!0),a.COMMAND_PRIORITY_LOW),t.registerCommand(a.SELECTION_CHANGE_COMMAND,()=>(t.getEditorState().read(()=>{m()}),!1),a.COMMAND_PRIORITY_LOW)),[t,ce,m]),i.jsxs(ye.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[i.jsx(k.Button,{"aria-label":"Bold","data-active":c,onClick:()=>{t.dispatchCommand(a.FORMAT_TEXT_COMMAND,"bold")},title:"Bold",variant:"tertiary",children:i.jsx(A.Icon,{name:"TextB"})}),i.jsx(k.Button,{"aria-label":"Italic","data-active":o,onClick:()=>{t.dispatchCommand(a.FORMAT_TEXT_COMMAND,"italic")},title:"Italic",variant:"tertiary",children:i.jsx(A.Icon,{name:"TextItalic"})}),i.jsx(k.Button,{"aria-label":"Underline","data-active":C,onClick:()=>{t.dispatchCommand(a.FORMAT_TEXT_COMMAND,"underline")},title:"Underline",variant:"tertiary",children:i.jsx(A.Icon,{name:"TextUnderline"})}),i.jsx(k.Button,{"aria-label":"List","data-active":Q,onClick:()=>{Q?t.dispatchCommand($.REMOVE_LIST_COMMAND,void 0):t.dispatchCommand($.INSERT_UNORDERED_LIST_COMMAND,void 0)},title:"List",variant:"tertiary",children:i.jsx(A.Icon,{name:"ListBullets"})}),i.jsx(k.Button,{"aria-label":"Link","data-active":z,onClick:()=>{z?ue(P):(t.dispatchCommand(E.TOGGLE_LINK_COMMAND,{url:"https://"}),ue("https://"))},title:"Link",variant:"tertiary",children:i.jsx(A.Icon,{name:"Link"})}),l&&i.jsxs(i.Fragment,{children:[i.jsx("input",{hidden:!0,multiple:!0,onChange:e=>{e.target.files&&l(e.target.files),e.target.value=""},ref:ee,type:"file"}),i.jsx(k.Button,{"aria-label":"Upload files",onClick:()=>{var e;return(e=ee.current)==null?void 0:e.click()},title:"Upload files",variant:"tertiary",children:i.jsx(A.Icon,{name:"Paperclip"})})]}),i.jsxs("div",{className:re(_.meta,z||g?_.active:""),children:[z&&i.jsxs(i.Fragment,{children:[i.jsx(be.Input,{"aria-invalid":!le,onBlur:()=>ie(),onChange:e=>v(e.target.value),onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),ie())},ref:B,value:P}),i.jsx(k.Button,{"aria-label":"Apply link",disabled:!le,onClick:()=>{ie()},onMouseDown:te,variant:"tertiary",children:i.jsx(A.Icon,{name:"Check"})}),i.jsx(k.Button,{"aria-label":"Remove link",onClick:()=>u(),onMouseDown:te,variant:"tertiary",children:i.jsx(A.Icon,{name:"Trash",variant:"danger"})})]}),g&&i.jsxs(i.Fragment,{children:[!W&&i.jsxs(i.Fragment,{children:[i.jsx(be.Input,{className:re(_.active),onBlur:q,onChange:e=>O(e.target.value),onKeyDown:e=>{e.key==="Enter"&&(e.preventDefault(),Z.current=!0,ne())},ref:ae,value:T}),i.jsx(k.Button,{"aria-label":"Apply image",onClick:()=>ne(),onMouseDown:I,variant:"tertiary",children:i.jsx(A.Icon,{name:"Check"})})]}),i.jsx("div",{className:_["image-sizes"],children:lt.map(({label:e,width:d})=>i.jsx(k.Button,{"aria-label":`${e} image`,"data-active":oe===d,onClick:()=>r(d),onMouseDown:te,variant:"tertiary",children:e},e))}),i.jsx(k.Button,{"aria-label":"Remove image",onClick:()=>V(),onMouseDown:I,variant:"tertiary",children:i.jsx(A.Icon,{name:"Trash",variant:"danger"})})]})]})]})},ct=a.defineExtension({name:"solibo-editor",namespace:"Editor",nodes:[E.AutoLinkNode,E.LinkNode,$.ListNode,$.ListItemNode,se],onError(l){throw l},theme:{link:_.link,list:{ol:_.list,ul:_.list},paragraph:_.paragraph,text:{bold:_.bold,italic:_.italic,underline:_.underline}}});function ut({autofocus:l,content:n="",lastEmittedContentRef:t}){const[c]=ge.useLexicalComposerContext();return s.useEffect(()=>{t.current!==n&&c.update(()=>{const g=new DOMParser().parseFromString(n,"text/html"),p=xe.$generateNodesFromDOM(c,g),o=a.$getRoot();o.clear().select(),a.$insertNodes(p),l?o.selectEnd():a.$setSelection(null)})},[l,n,c,t]),null}const dt=({autofocus:l=!1,autolink:n=!1,content:t,disabled:c=!1,errorMessage:f,fill:g=!1,files:p,inline:o=!1,inlineImages:h,invalid:C=!1,isSubmitting:J=!1,maxRows:z=12,minRows:j=1,onChange:Q,onFilesChange:S,onInlineImagesChange:T,onSubmit:O,onUpload:b,placeholder:K,required:W=!1,resizable:R=!1,submitLabel:oe="Submit"})=>{const G=s.useId(),P=s.useRef(void 0),v=s.useRef(null),[le,ee]=s.useState(!1),[ae,B]=s.useState(!1),[y,Z]=s.useState([]),[te,Y]=s.useState([]),D=s.useRef(new Map),I=p??y,q=h??te;s.useEffect(()=>{const r=v.current;if(!r)return;if(!R||g){r.style.removeProperty("height"),ee(!1);return}const u=()=>ee(r.style.height!==""),m=new MutationObserver(u);return m.observe(r,{attributes:!0,attributeFilter:["style"]}),u(),()=>m.disconnect()},[g,R]);const x=r=>{p===void 0&&Z(r),S==null||S(r)},N=s.useCallback(r=>{h===void 0&&Y(r),T==null||T(r)},[h,T]),ce=s.useCallback(r=>{const u=r.map(m=>{const e=`pasted-${crypto.randomUUID()}`,d=URL.createObjectURL(m);return D.current.set(e,d),{image:{alt:m.name,soliboDocumentSlot:e,src:d},pending:{file:m,slot:e}}});return N([...q,...u.map(({pending:m})=>m)]),u.map(({image:m})=>m)},[q,N]),ue=s.useCallback(r=>{N(q.filter(m=>m.slot!==r));const u=D.current.get(r);u&&URL.revokeObjectURL(u),D.current.delete(r)},[q,N]);s.useEffect(()=>()=>{D.current.forEach(r=>URL.revokeObjectURL(r)),D.current.clear()},[]),s.useEffect(()=>{const r=new Set(q.map(u=>u.slot));D.current.forEach((u,m)=>{r.has(m)||(URL.revokeObjectURL(u),D.current.delete(m))})},[q]);const ie=r=>{if(typeof DataTransfer<"u"){const u=new DataTransfer;return r.forEach(m=>u.items.add(m)),u.files}return Object.assign([...r],{item:u=>r[u]??null})},ne=async()=>{try{I.length>0&&await(b==null?void 0:b(ie(I))),await(O==null?void 0:O()),I.length>0&&x([])}catch{return}},V=r=>{r.preventDefault(),r.stopPropagation()};return i.jsxs("div",{className:re(_.field,g&&_.fill),"data-max-rows":z,"data-min-rows":j,onDragEnter:r=>{V(r),B(!!S)},onDragOver:r=>{V(r),B(!!S)},onDragLeave:r=>{V(r),B(!1)},onDropCapture:r=>{var m;const u=(m=r.dataTransfer)==null?void 0:m.files;u!=null&&u.length&&(V(r),(S||b)&&x([...I,...Array.from(u)]),B(!1))},onDrop:r=>{r.preventDefault(),B(!1)},"data-component":"editor",children:[R==="top"&&!g&&i.jsx(ot,{editableRef:v}),i.jsx("div",{className:re(_.editor,g&&_["fill-editor"],R===!0&&!g&&_.resizable,R&&!g&&le&&_.resized,C&&_.invalid,I.length>0&&_["has-files"]),style:{"--editor-max-height":`calc(${z*1.25}em + (2 * var(--scale-8)))`,"--editor-min-height":`calc(${j*1.25}em + (2 * var(--scale-8)))`},children:i.jsxs(Ne.LexicalExtensionComposer,{contentEditable:null,extension:ct,children:[!o&&i.jsx(at,{onInlineImageRemove:ue,onFilesSelected:b||S?r=>{x([...I,...Array.from(r)])}:void 0}),i.jsx("div",{className:re(_.content,ae&&_.dragging),children:i.jsx(Ee.RichTextPlugin,{contentEditable:i.jsx(Ce.ContentEditable,{ref:v,"aria-placeholder":K??"",ariaErrorMessage:C&&f?G:void 0,ariaInvalid:C||void 0,ariaRequired:W||void 0,placeholder:()=>K?i.jsx("div",{className:_.placeholder,children:K}):null}),ErrorBoundary:Se.LexicalErrorBoundary})}),!o&&O&&i.jsx("div",{className:_.submit,children:i.jsx(k.Button,{"aria-label":oe,"data-cy":"toolbar-submit-button",disabled:c,icon:"PaperPlaneTilt",isLoading:J,onClick:()=>void ne(),variant:"primary",children:i.jsx("span",{children:oe})})}),I.length>0&&i.jsx("div",{"aria-label":"Files to upload",className:_.files,role:"region",children:I.map((r,u)=>i.jsx($e.File,{deleteAccessibleLabel:`Remove ${r.name} from upload queue`,name:r.name,onDelete:()=>x(I.filter((m,e)=>e!==u))},`${r.name}-${r.size}-${r.lastModified}-${u}`))}),l&&i.jsx(Le.AutoFocusPlugin,{}),n&&i.jsx(ke.AutoLinkPlugin,{matchers:Be}),i.jsx(Me.HistoryPlugin,{}),T&&i.jsx(Oe,{createImages:ce}),t!==void 0&&i.jsx(ut,{autofocus:l,content:t,lastEmittedContentRef:P}),i.jsx(je.LinkPlugin,{validateUrl:_e}),i.jsx(we.ListPlugin,{}),Q&&i.jsx(Ae.OnChangePlugin,{onChange:(r,u)=>{r.read(()=>{const m=xe.$generateHtmlFromNodes(u,null),e=me(m,{allowedAttributes:{...me.defaults.allowedAttributes,img:[...me.defaults.allowedAttributes.img??[],"data-solibo-document-id","data-solibo-document-slot"]},allowedTags:["a","b","br","i","img","li","ol","p","u","ul"]});P.current=e,Q(e)})}})]})}),C&&f&&i.jsx("div",{className:_.error,id:G,children:f})]})};exports.Editor=dt;
1
+ "use strict";require('../../assets/index43.css');var xt=Object.defineProperty;var kt=(l,r,e)=>r in l?xt(l,r,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[r]=e;var F=(l,r,e)=>kt(l,typeof r!="symbol"?r+"":r,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),ft=require("@lexical/html"),j=require("@lexical/link"),E=require("@lexical/list"),It=require("@lexical/react/LexicalAutoFocusPlugin"),Dt=require("@lexical/react/LexicalAutoLinkPlugin"),mt=require("@lexical/react/LexicalComposerContext"),Ct=require("@lexical/react/LexicalContentEditable"),Lt=require("@lexical/react/LexicalErrorBoundary"),vt=require("@lexical/react/LexicalExtensionComposer"),Nt=require("@lexical/react/LexicalHistoryPlugin"),wt=require("@lexical/react/LexicalLinkPlugin"),Mt=require("@lexical/react/LexicalListPlugin"),At=require("@lexical/react/LexicalOnChangePlugin"),St=require("@lexical/react/LexicalRichTextPlugin"),et=require("classix"),c=require("lexical"),s=require("react"),ut=require("sanitize-html"),A=require("../button/index.cjs"),yt=require("../file/index.cjs"),jt=require("@lexical/utils"),y=require("../icon/index.cjs"),_t=require("../../index-7blZaPiA.cjs"),Et=require("../toolbar/index.cjs"),Rt="_field_1trki_3",Tt="_editor_1trki_8",$t="_submit_1trki_26",Pt="_resizable_1trki_56",Ot="_resized_1trki_60",Bt="_invalid_1trki_86",qt="_error_1trki_90",Ut="_dragging_1trki_96",zt="_content_1trki_100",Ht="_files_1trki_116",Ft="_placeholder_1trki_125",Kt="_fill_1trki_133",Wt="_meta_1trki_161",Gt="_active_1trki_170",Xt="_bold_1trki_240",Yt="_italic_1trki_244",Zt="_underline_1trki_248",Vt="_link_1trki_252",Jt="_list_1trki_258",Qt="_paragraph_1trki_259",_={field:Rt,editor:Tt,submit:$t,"image-resize-handle":"_image-resize-handle_1trki_50",resizable:Pt,resized:Ot,"resize-handle":"_resize-handle_1trki_64",invalid:Bt,error:qt,dragging:Ut,content:zt,"has-files":"_has-files_1trki_112",files:Ht,placeholder:Ft,fill:Kt,"fill-editor":"_fill-editor_1trki_141",meta:Wt,active:Gt,"inline-image":"_inline-image_1trki_182",bold:Xt,italic:Yt,underline:Zt,link:Vt,list:Jt,paragraph:Qt};function te({alt:l="",editor:r,height:e,nodeKey:d,soliboDocumentId:f,soliboDocumentSlot:g,src:b,width:o}){const m=s.useRef(null),p=s.useRef(null),[P,N]=s.useState(),v=()=>{const n=r.getRootElement();if(!n)return 1/0;const u=getComputedStyle(n);return Math.max(1,n.clientWidth-(parseFloat(u.paddingLeft)||0)-(parseFloat(u.paddingRight)||0))},R=(n,u=v())=>Math.round(Math.min(u,Math.max(Math.min(32,u),n))),L=n=>{r.update(()=>{const u=c.$getNodeByKey(d);at(u)&&u.setWidth(n)}),N(void 0)};return i.jsxs("span",{className:_["inline-image"],contentEditable:!1,tabIndex:g?0:void 0,onKeyDown:n=>{!g||n.target!==n.currentTarget||!["Backspace","Delete"].includes(n.key)||(n.preventDefault(),n.stopPropagation(),r.update(()=>{const u=c.$getNodeByKey(d);if(!at(u))return;const k=u.getParent();c.$isParagraphNode(k)&&k.getChildrenSize()===1?k.remove():u.remove(),r.dispatchCommand(pt,g)}),r.focus())},"data-component":"editorimage",children:[i.jsx("img",{alt:l,"data-solibo-document-id":f,"data-solibo-document-slot":g,draggable:!1,height:P===void 0?e:void 0,ref:m,src:b,width:P??o,onClick:n=>{var u;n.preventDefault(),g&&((u=n.currentTarget.parentElement)==null||u.focus()),r.dispatchCommand(bt,{key:d,soliboDocumentSlot:g,src:b,width:o})}}),i.jsx("button",{type:"button","aria-label":`Resize image${l?`: ${l}`:""}`,title:"Drag to resize; use arrow keys to adjust width",className:_["image-resize-handle"],tabIndex:0,onClick:n=>{n.preventDefault(),n.stopPropagation()},onKeyDown:n=>{var k;if(!["ArrowLeft","ArrowRight","ArrowUp","ArrowDown"].includes(n.key))return;n.preventDefault(),n.stopPropagation();const u=((k=m.current)==null?void 0:k.getBoundingClientRect().width)??o??32;L(R(u+(["ArrowRight","ArrowUp"].includes(n.key)?10:-10)))},onPointerDown:n=>{n.button!==0||!m.current||(n.preventDefault(),n.stopPropagation(),n.currentTarget.focus({preventScroll:!0}),n.currentTarget.setPointerCapture(n.pointerId),p.current={pointerId:n.pointerId,x:n.clientX,width:m.current.getBoundingClientRect().width,maximum:v()})},onPointerMove:n=>{const u=p.current;!u||u.pointerId!==n.pointerId||N(R(u.width+n.clientX-u.x,u.maximum))},onPointerUp:n=>{const u=p.current;!u||u.pointerId!==n.pointerId||(p.current=null,L(R(u.width+n.clientX-u.x,u.maximum)),n.currentTarget.releasePointerCapture(n.pointerId))},onPointerCancel:()=>{p.current=null,N(void 0)},onLostPointerCapture:()=>{p.current=null,N(void 0)}})]})}const pt=c.createCommand(),bt=c.createCommand();class rt extends c.DecoratorNode{constructor(e,d,f,g,b,o,m){super(b);F(this,"__src");F(this,"__alt");F(this,"__width");F(this,"__height");F(this,"__soliboDocumentId");F(this,"__soliboDocumentSlot");this.__src=e,this.__alt=d,this.__width=f,this.__height=g,this.__soliboDocumentId=o,this.__soliboDocumentSlot=m}static getType(){return"image"}static clone(e){return new rt(e.__src,e.__alt,e.__width,e.__height,e.__key,e.__soliboDocumentId,e.__soliboDocumentSlot)}static importJSON(e){return ot({alt:e.alt,height:e.height,soliboDocumentId:e.soliboDocumentId,soliboDocumentSlot:e.soliboDocumentSlot,src:e.src,width:e.width})}exportJSON(){return{alt:this.__alt,height:this.__height,...this.__soliboDocumentId?{soliboDocumentId:this.__soliboDocumentId}:void 0,...this.__soliboDocumentSlot?{soliboDocumentSlot:this.__soliboDocumentSlot}:void 0,src:this.__src,type:"image",version:1,width:this.__width}}static importDOM(){return{img:e=>({conversion:d=>{if(!(d instanceof HTMLImageElement))return null;const f=d.getAttribute("src")??"";if(!f)return null;const g=d.getAttribute("width"),b=d.getAttribute("height");return{node:ot({alt:d.getAttribute("alt")??"",height:b?Number(b):void 0,soliboDocumentId:d.getAttribute("data-solibo-document-id")??void 0,soliboDocumentSlot:d.getAttribute("data-solibo-document-slot")??void 0,src:f,width:g?Number(g):void 0})}},priority:0})}}exportDOM(){const e=document.createElement("img");return this.__soliboDocumentSlot||e.setAttribute("src",this.__src),this.__soliboDocumentId&&e.setAttribute("data-solibo-document-id",this.__soliboDocumentId),this.__soliboDocumentSlot&&e.setAttribute("data-solibo-document-slot",this.__soliboDocumentSlot),this.__alt&&e.setAttribute("alt",this.__alt),this.__width&&e.setAttribute("width",String(this.__width)),this.__height&&e.setAttribute("height",String(this.__height)),{element:e}}createDOM(){return document.createElement("span")}updateDOM(){return!1}isInline(){return!0}getSrc(){return this.__src}setSrc(e){const d=this.getWritable();return d.__src=e,d}setWidth(e){const d=this.getWritable();return d.__width=e,d.__height=void 0,d}decorate(e){return i.jsx(te,{alt:this.__alt,editor:e,height:this.__height,nodeKey:this.getKey(),soliboDocumentId:this.__soliboDocumentId,soliboDocumentSlot:this.__soliboDocumentSlot,src:this.__src,width:this.__width})}}function ot({alt:l="",height:r,soliboDocumentId:e,soliboDocumentSlot:d,src:f,width:g}){return c.$applyNodeReplacement(new rt(f,l,g,r,void 0,e,d))}function at(l){return l instanceof rt}const ee=({createImages:l,onRemove:r})=>{const[e]=mt.useLexicalComposerContext();return s.useEffect(()=>e.registerCommand(pt,d=>(r(d),!0),c.COMMAND_PRIORITY_HIGH),[e,r]),s.useEffect(()=>e.registerCommand(c.PASTE_COMMAND,d=>{var o;if(!("clipboardData"in d))return!1;const f=d,g=Array.from(((o=f.clipboardData)==null?void 0:o.items)??[]).flatMap(m=>{if(m.kind!=="file"||!m.type.startsWith("image/"))return[];const p=m.getAsFile();return p?[p]:[]});if(g.length===0)return!1;f.preventDefault();const b=l(g);return e.update(()=>{c.$insertNodes(b.map(m=>ot(m)))}),!0},c.COMMAND_PRIORITY_HIGH),[l,e]),null},re=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/,ie=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,ne=[l=>{const r=re.exec(l);return r!=null&&r.length?{index:r.index,length:r[0].length,text:r[0],url:`mailto:${r[0]}`}:null},l=>{const r=ie.exec(l);return r!=null&&r.length?{index:r.index,length:r[0].length,text:r[0],url:r[0].startsWith("http")?r[0]:`https://${r[0]}`}:null}];function dt(l){try{const r=new URL(l);return r.protocol==="http:"||r.protocol==="https:"}catch{return!1}}function se({editableRef:l}){const r=s.useRef(null),[e,d]=s.useState(0),[f,g]=s.useState(0);s.useEffect(()=>{const o=l.current;if(!o)return;const m=()=>{d(Math.round(o.getBoundingClientRect().height)),g(Math.round(parseFloat(getComputedStyle(o).minHeight)||0))};if(m(),typeof ResizeObserver>"u")return;const p=new ResizeObserver(m);return p.observe(o),()=>p.disconnect()},[l]);const b=o=>{const m=l.current;if(!m)return;const p=parseFloat(getComputedStyle(m).minHeight)||0;m.style.height=`${Math.max(p,o)}px`};return i.jsx("div",{"aria-label":"Resize editor","aria-orientation":"horizontal","aria-valuemin":f,"aria-valuenow":e,"aria-valuetext":`${e} pixels`,className:_["resize-handle"],role:"separator",tabIndex:0,onDoubleClick:()=>{var o;return(o=l.current)==null?void 0:o.style.removeProperty("height")},onKeyDown:o=>{const m=l.current;m&&(o.key==="Home"?(o.preventDefault(),m.style.removeProperty("height")):(o.key==="ArrowUp"||o.key==="ArrowDown")&&(o.preventDefault(),b(m.getBoundingClientRect().height+(o.key==="ArrowUp"?20:-20))))},onPointerDown:o=>{const m=l.current;o.button!==0||!m||(o.preventDefault(),o.currentTarget.focus({preventScroll:!0}),o.currentTarget.setPointerCapture(o.pointerId),r.current={pointerId:o.pointerId,y:o.clientY,height:m.getBoundingClientRect().height})},onPointerMove:o=>{!r.current||r.current.pointerId!==o.pointerId||b(r.current.height+r.current.y-o.clientY)},onPointerUp:o=>{!r.current||r.current.pointerId!==o.pointerId||(r.current=null,o.currentTarget.releasePointerCapture(o.pointerId))},onLostPointerCapture:()=>{r.current=null},onPointerCancel:()=>{r.current=null},"data-component":"editorresizehandle"})}const oe=({onFilesSelected:l,onInlineImageRemove:r})=>{const[e]=mt.useLexicalComposerContext(),[d,f]=s.useState(!1),[g,b]=s.useState(!1),[o,m]=s.useState(!1),[p,P]=s.useState(!1),[N,v]=s.useState(!1),[R,L]=s.useState(!1),[n,u]=s.useState(""),[k,K]=s.useState(null),[W,O]=s.useState(null),[B,w]=s.useState(""),J=dt(B.trim()),G=s.useRef(null),it=s.useRef(null),Q=s.useRef(null),T=s.useRef(null),S=s.useRef(!1),nt=t=>t.preventDefault(),X=s.useCallback(t=>{T.current=c.$isRangeSelection(t)?t.clone():null},[]),Y=s.useCallback(t=>{e.update(()=>{T.current&&c.$setSelection(T.current),t()}),T.current=null},[e]),st=t=>{S.current=!0,t.preventDefault()},$=()=>{if(S.current){S.current=!1;return}Z()},x=s.useCallback(()=>{b(!1),u(""),K(null),O(null)},[]),D=s.useCallback(()=>{v(!1),w("")},[]),z=s.useCallback(t=>{b(!0),u((t==null?void 0:t.src)??""),K((t==null?void 0:t.key)??null),O((t==null?void 0:t.soliboDocumentSlot)??null),D(),t!=null&&t.soliboDocumentSlot||setTimeout(()=>{var a;return(a=it.current)==null?void 0:a.focus()},0)},[D]),H=s.useCallback(t=>{e.getEditorState().read(()=>{X(c.$getSelection())}),v(!0),w(t),x(),setTimeout(()=>{var a;return(a=Q.current)==null?void 0:a.focus()},0)},[x,e,X]),tt=s.useCallback(()=>{const t=B.trim();dt(t)&&(Y(()=>{e.dispatchCommand(j.TOGGLE_LINK_COMMAND,{url:t,target:"_blank"});const a=c.$getSelection();if(!c.$isRangeSelection(a))return;const h=a.getNodes().at(-1)??null,I=(h==null?void 0:h.getParent())??null,C=j.$isLinkNode(h)?h:j.$isLinkNode(I)?I:null;if(C){const U=C.getLastChild();if(c.$isTextNode(U)){const ht=U.getTextContent(),gt=ht.replace(/\s+$/,"");gt!==ht&&U.setTextContent(gt)}const V=C.getNextSibling();if(c.$isTextNode(V)&&/^\s/.test(V.getTextContent())){V.select(1,1);return}const M=c.$createTextNode(" ");C.insertAfter(M),M.selectEnd()}}),D())},[D,e,B,Y]),Z=s.useCallback(()=>{const t=n.trim();if(!t){x();return}e.update(()=>{if(k){const a=c.$getNodeByKey(k);at(a)&&a.setSrc(t);return}c.$insertNodes([ot({src:t})])}),x()},[x,e,k,n]),lt=s.useCallback(()=>{if(!k){x();return}e.update(()=>{const t=c.$getNodeByKey(k);if(at(t)){const a=t.getParent();c.$isParagraphNode(a)&&a.getChildrenSize()===1?a.remove():t.remove(),W&&(r==null||r(W))}}),x()},[x,e,k,W,r]),ct=s.useCallback(()=>{Y(()=>{e.dispatchCommand(j.TOGGLE_LINK_COMMAND,null)}),D()},[D,e,Y]),q=s.useCallback(()=>{const t=c.$getSelection();if(!c.$isRangeSelection(t)){if(c.$isNodeSelection(t)){const I=t.getNodes(),C=I[0]??null,U=(C==null?void 0:C.getParent())??null;f(I.some(M=>c.$isTextNode(M)&&M.hasFormat("bold"))),m(I.some(M=>c.$isTextNode(M)&&M.hasFormat("italic"))),P(I.some(M=>c.$isTextNode(M)&&M.hasFormat("underline"))),L(E.$isListNode(U)||E.$isListItemNode(U)||E.$isListNode(C)||E.$isListItemNode(C));const V=j.$isLinkNode(C)?C:j.$isLinkNode(U)?U:null;if(V){v(!0),w(V.getURL());return}v(!1),w(""),T.current=null;return}f(!1),m(!1),P(!1),L(!1),v(!1),w(""),T.current=null;return}const[a]=t.getNodes(),h=(a==null?void 0:a.getParent())??null;if(f(t.hasFormat("bold")),m(t.hasFormat("italic")),P(t.hasFormat("underline")),L(E.$isListNode(h)||E.$isListItemNode(h)),j.$isLinkNode(h)){v(!0),w(h.getURL()),X(t);return}v(!1),w(""),T.current=null},[X]);return s.useEffect(()=>jt.mergeRegister(e.registerUpdateListener(({editorState:t})=>{t.read(()=>{q()})}),e.registerCommand(bt,t=>(t.soliboDocumentSlot?(x(),D()):z(t),!0),c.COMMAND_PRIORITY_LOW),e.registerCommand(c.SELECTION_CHANGE_COMMAND,()=>(e.getEditorState().read(()=>{q()}),!1),c.COMMAND_PRIORITY_LOW)),[x,D,e,z,q]),i.jsxs(Et.Toolbar,{variant:"editor","data-component":"editortoolbar",children:[i.jsx(A.Button,{"aria-label":"Bold","data-active":d,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"bold")},title:"Bold",variant:"tertiary",children:i.jsx(y.Icon,{name:"TextB"})}),i.jsx(A.Button,{"aria-label":"Italic","data-active":o,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"italic")},title:"Italic",variant:"tertiary",children:i.jsx(y.Icon,{name:"TextItalic"})}),i.jsx(A.Button,{"aria-label":"Underline","data-active":p,onClick:()=>{e.dispatchCommand(c.FORMAT_TEXT_COMMAND,"underline")},title:"Underline",variant:"tertiary",children:i.jsx(y.Icon,{name:"TextUnderline"})}),i.jsx(A.Button,{"aria-label":"List","data-active":R,onClick:()=>{R?e.dispatchCommand(E.REMOVE_LIST_COMMAND,void 0):e.dispatchCommand(E.INSERT_UNORDERED_LIST_COMMAND,void 0)},title:"List",variant:"tertiary",children:i.jsx(y.Icon,{name:"ListBullets"})}),i.jsx(A.Button,{"aria-label":"Link","data-active":N,onClick:()=>{N?H(B):(e.dispatchCommand(j.TOGGLE_LINK_COMMAND,{url:"https://"}),H("https://"))},title:"Link",variant:"tertiary",children:i.jsx(y.Icon,{name:"Link"})}),l&&i.jsxs(i.Fragment,{children:[i.jsx("input",{hidden:!0,multiple:!0,onChange:t=>{t.target.files&&l(t.target.files),t.target.value=""},ref:G,type:"file"}),i.jsx(A.Button,{"aria-label":"Upload files",onClick:()=>{var t;return(t=G.current)==null?void 0:t.click()},title:"Upload files",variant:"tertiary",children:i.jsx(y.Icon,{name:"Paperclip"})})]}),i.jsxs("div",{className:et(_.meta,N||g?_.active:""),children:[N&&i.jsxs(i.Fragment,{children:[i.jsx(_t.Input,{"aria-invalid":!J,onBlur:()=>tt(),onChange:t=>w(t.target.value),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),tt())},ref:Q,value:B}),i.jsx(A.Button,{"aria-label":"Apply link",disabled:!J,onClick:()=>{tt()},onMouseDown:nt,variant:"tertiary",children:i.jsx(y.Icon,{name:"Check"})}),i.jsx(A.Button,{"aria-label":"Remove link",onClick:()=>ct(),onMouseDown:nt,variant:"tertiary",children:i.jsx(y.Icon,{name:"Trash",variant:"danger"})})]}),g&&i.jsxs(i.Fragment,{children:[!W&&i.jsxs(i.Fragment,{children:[i.jsx(_t.Input,{className:et(_.active),onBlur:$,onChange:t=>u(t.target.value),onKeyDown:t=>{t.key==="Enter"&&(t.preventDefault(),S.current=!0,Z())},ref:it,value:n}),i.jsx(A.Button,{"aria-label":"Apply image",onClick:()=>Z(),onMouseDown:st,variant:"tertiary",children:i.jsx(y.Icon,{name:"Check"})})]}),i.jsx(A.Button,{"aria-label":"Remove image",onClick:()=>lt(),onMouseDown:st,variant:"tertiary",children:i.jsx(y.Icon,{name:"Trash",variant:"danger"})})]})]})]})},ae=c.defineExtension({name:"solibo-editor",namespace:"Editor",nodes:[j.AutoLinkNode,j.LinkNode,E.ListNode,E.ListItemNode,rt],onError(l){throw l},theme:{link:_.link,list:{ol:_.list,ul:_.list},paragraph:_.paragraph,text:{bold:_.bold,italic:_.italic,underline:_.underline}}});function le({autofocus:l,content:r="",lastEmittedContentRef:e}){const[d]=mt.useLexicalComposerContext();return s.useEffect(()=>{e.current!==r&&d.update(()=>{const g=new DOMParser().parseFromString(r,"text/html"),b=ft.$generateNodesFromDOM(d,g),o=c.$getRoot();o.clear().select(),c.$insertNodes(b),l?o.selectEnd():c.$setSelection(null)})},[l,r,d,e]),null}const ce=({autofocus:l=!1,autolink:r=!1,content:e,disabled:d=!1,errorMessage:f,fill:g=!1,files:b,inline:o=!1,inlineImages:m,invalid:p=!1,isSubmitting:P=!1,maxRows:N=12,minRows:v=1,onChange:R,onFilesChange:L,onInlineImagesChange:n,onSubmit:u,onUpload:k,placeholder:K,required:W=!1,resizable:O=!1,submitLabel:B="Submit"})=>{const w=s.useId(),J=s.useRef(void 0),G=s.useRef(null),[it,Q]=s.useState(!1),[T,S]=s.useState(!1),[nt,X]=s.useState([]),[Y,st]=s.useState([]),$=s.useRef(new Map),x=b??nt,D=m??Y;s.useEffect(()=>{const t=G.current;if(!t)return;if(!O||g){t.style.removeProperty("height"),Q(!1);return}const a=()=>Q(t.style.height!==""),h=new MutationObserver(a);return h.observe(t,{attributes:!0,attributeFilter:["style"]}),a(),()=>h.disconnect()},[g,O]);const z=t=>{b===void 0&&X(t),L==null||L(t)},H=s.useCallback(t=>{m===void 0&&st(t),n==null||n(t)},[m,n]),tt=s.useCallback(t=>{const a=t.map(h=>{const I=`pasted-${crypto.randomUUID()}`,C=URL.createObjectURL(h);return $.current.set(I,C),{image:{alt:h.name,soliboDocumentSlot:I,src:C},pending:{file:h,slot:I}}});return H([...D,...a.map(({pending:h})=>h)]),a.map(({image:h})=>h)},[D,H]),Z=s.useCallback(t=>{H(D.filter(h=>h.slot!==t));const a=$.current.get(t);a&&URL.revokeObjectURL(a),$.current.delete(t)},[D,H]);s.useEffect(()=>()=>{$.current.forEach(t=>URL.revokeObjectURL(t)),$.current.clear()},[]),s.useEffect(()=>{const t=new Set(D.map(a=>a.slot));$.current.forEach((a,h)=>{t.has(h)||(URL.revokeObjectURL(a),$.current.delete(h))})},[D]);const lt=t=>{if(typeof DataTransfer<"u"){const a=new DataTransfer;return t.forEach(h=>a.items.add(h)),a.files}return Object.assign([...t],{item:a=>t[a]??null})},ct=async()=>{try{x.length>0&&await(k==null?void 0:k(lt(x))),await(u==null?void 0:u()),x.length>0&&z([])}catch{return}},q=t=>{t.preventDefault(),t.stopPropagation()};return i.jsxs("div",{className:et(_.field,g&&_.fill),"data-max-rows":N,"data-min-rows":v,onDragEnter:t=>{q(t),S(!!L)},onDragOver:t=>{q(t),S(!!L)},onDragLeave:t=>{q(t),S(!1)},onDropCapture:t=>{var h;const a=(h=t.dataTransfer)==null?void 0:h.files;a!=null&&a.length&&(q(t),(L||k)&&z([...x,...Array.from(a)]),S(!1))},onDrop:t=>{t.preventDefault(),S(!1)},"data-component":"editor",children:[O==="top"&&!g&&i.jsx(se,{editableRef:G}),i.jsx("div",{className:et(_.editor,g&&_["fill-editor"],O===!0&&!g&&_.resizable,O&&!g&&it&&_.resized,p&&_.invalid,x.length>0&&_["has-files"]),style:{"--editor-max-height":`calc(${N*1.25}em + (2 * var(--scale-8)))`,"--editor-min-height":`calc(${v*1.25}em + (2 * var(--scale-8)))`},children:i.jsxs(vt.LexicalExtensionComposer,{contentEditable:null,extension:ae,children:[!o&&i.jsx(oe,{onInlineImageRemove:Z,onFilesSelected:k||L?t=>{z([...x,...Array.from(t)])}:void 0}),i.jsx("div",{className:et(_.content,T&&_.dragging),children:i.jsx(St.RichTextPlugin,{contentEditable:i.jsx(Ct.ContentEditable,{ref:G,"aria-placeholder":K??"",ariaErrorMessage:p&&f?w:void 0,ariaInvalid:p||void 0,ariaRequired:W||void 0,placeholder:()=>K?i.jsx("div",{className:_.placeholder,children:K}):null}),ErrorBoundary:Lt.LexicalErrorBoundary})}),!o&&u&&i.jsx("div",{className:_.submit,children:i.jsx(A.Button,{"aria-label":B,"data-cy":"toolbar-submit-button",disabled:d,icon:"PaperPlaneTilt",isLoading:P,onClick:()=>void ct(),variant:"primary",children:i.jsx("span",{children:B})})}),x.length>0&&i.jsx("div",{"aria-label":"Files to upload",className:_.files,role:"region",children:x.map((t,a)=>i.jsx(yt.File,{deleteAccessibleLabel:`Remove ${t.name} from upload queue`,name:t.name,onDelete:()=>z(x.filter((h,I)=>I!==a))},`${t.name}-${t.size}-${t.lastModified}-${a}`))}),l&&i.jsx(It.AutoFocusPlugin,{}),r&&i.jsx(Dt.AutoLinkPlugin,{matchers:ne}),i.jsx(Nt.HistoryPlugin,{}),n&&i.jsx(ee,{createImages:tt,onRemove:Z}),e!==void 0&&i.jsx(le,{autofocus:l,content:e,lastEmittedContentRef:J}),i.jsx(wt.LinkPlugin,{validateUrl:dt}),i.jsx(Mt.ListPlugin,{}),R&&i.jsx(At.OnChangePlugin,{onChange:(t,a)=>{t.read(()=>{const h=ft.$generateHtmlFromNodes(a,null),I=ut(h,{allowedAttributes:{...ut.defaults.allowedAttributes,img:[...ut.defaults.allowedAttributes.img??[],"data-solibo-document-id","data-solibo-document-slot"]},allowedTags:["a","b","br","i","img","li","ol","p","u","ul"]});J.current=I,R(I)})}})]})}),p&&f&&i.jsx("div",{className:_.error,id:w,children:f})]})};exports.Editor=ce;
@@ -1,51 +1,146 @@
1
- import '../../assets/index43.css';var Ot = Object.defineProperty;
2
- var Pt = (s, r, e) => r in s ? Ot(s, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[r] = e;
3
- var K = (s, r, e) => Pt(s, typeof r != "symbol" ? r + "" : r, e);
4
- import { jsx as n, jsxs as B, Fragment as _t } from "react/jsx-runtime";
5
- import { $generateHtmlFromNodes as $t, $generateNodesFromDOM as Rt } from "@lexical/html";
6
- import { TOGGLE_LINK_COMMAND as ft, $isLinkNode as ot, AutoLinkNode as Ut, LinkNode as zt } from "@lexical/link";
7
- import { $isListNode as pt, $isListItemNode as bt, REMOVE_LIST_COMMAND as Ht, INSERT_UNORDERED_LIST_COMMAND as Bt, ListNode as Ft, ListItemNode as Wt } from "@lexical/list";
8
- import { AutoFocusPlugin as Kt } from "@lexical/react/LexicalAutoFocusPlugin";
9
- import { AutoLinkPlugin as jt } from "@lexical/react/LexicalAutoLinkPlugin";
10
- import { useLexicalComposerContext as At } from "@lexical/react/LexicalComposerContext";
11
- import { ContentEditable as Gt } from "@lexical/react/LexicalContentEditable";
12
- import { LexicalErrorBoundary as Zt } from "@lexical/react/LexicalErrorBoundary";
13
- import { LexicalExtensionComposer as qt } from "@lexical/react/LexicalExtensionComposer";
14
- import { HistoryPlugin as Yt } from "@lexical/react/LexicalHistoryPlugin";
15
- import { LinkPlugin as Vt } from "@lexical/react/LexicalLinkPlugin";
1
+ import '../../assets/index43.css';var Rt = Object.defineProperty;
2
+ var Ot = (s, r, e) => r in s ? Rt(s, r, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[r] = e;
3
+ var j = (s, r, e) => Ot(s, typeof r != "symbol" ? r + "" : r, e);
4
+ import { jsxs as O, jsx as o, Fragment as ct } from "react/jsx-runtime";
5
+ import { $generateHtmlFromNodes as $t, $generateNodesFromDOM as Ut } from "@lexical/html";
6
+ import { TOGGLE_LINK_COMMAND as ft, $isLinkNode as rt, AutoLinkNode as zt, LinkNode as Bt } from "@lexical/link";
7
+ import { $isListNode as pt, $isListItemNode as _t, REMOVE_LIST_COMMAND as Ht, INSERT_UNORDERED_LIST_COMMAND as Ft, ListNode as Wt, ListItemNode as Kt } from "@lexical/list";
8
+ import { AutoFocusPlugin as jt } from "@lexical/react/LexicalAutoFocusPlugin";
9
+ import { AutoLinkPlugin as Gt } from "@lexical/react/LexicalAutoLinkPlugin";
10
+ import { useLexicalComposerContext as wt } from "@lexical/react/LexicalComposerContext";
11
+ import { ContentEditable as Zt } from "@lexical/react/LexicalContentEditable";
12
+ import { LexicalErrorBoundary as qt } from "@lexical/react/LexicalErrorBoundary";
13
+ import { LexicalExtensionComposer as Vt } from "@lexical/react/LexicalExtensionComposer";
14
+ import { HistoryPlugin as Xt } from "@lexical/react/LexicalHistoryPlugin";
15
+ import { LinkPlugin as Yt } from "@lexical/react/LexicalLinkPlugin";
16
16
  import { ListPlugin as Jt } from "@lexical/react/LexicalListPlugin";
17
- import { OnChangePlugin as Xt } from "@lexical/react/LexicalOnChangePlugin";
18
- import { RichTextPlugin as Qt } from "@lexical/react/LexicalRichTextPlugin";
19
- import lt from "classix";
20
- import { DecoratorNode as te, $applyNodeReplacement as ee, createCommand as re, PASTE_COMMAND as ie, $insertNodes as Mt, COMMAND_PRIORITY_HIGH as ne, $isRangeSelection as vt, $setSelection as xt, $getSelection as Dt, $isTextNode as st, $createTextNode as oe, $getNodeByKey as It, $isParagraphNode as se, $isNodeSelection as le, COMMAND_PRIORITY_LOW as Et, SELECTION_CHANGE_COMMAND as ae, FORMAT_TEXT_COMMAND as kt, defineExtension as ce, $getRoot as ue } from "lexical";
21
- import { useEffect as j, useRef as O, useState as f, useCallback as b, useId as de } from "react";
22
- import wt from "sanitize-html";
23
- import { Button as L } from "../button/index.js";
24
- import { File as me } from "../file/index.js";
25
- import { mergeRegister as he } from "@lexical/utils";
26
- import { Icon as y } from "../icon/index.js";
27
- import { I as yt } from "../../index-Dd20d_9U.js";
28
- import { Toolbar as _e } from "../toolbar/index.js";
29
- const Tt = re();
30
- class at extends te {
31
- constructor(e, l, _, h, g, o, d) {
32
- super(g);
33
- K(this, "__src");
34
- K(this, "__alt");
35
- K(this, "__width");
36
- K(this, "__height");
37
- K(this, "__soliboDocumentId");
38
- K(this, "__soliboDocumentSlot");
39
- this.__src = e, this.__alt = l, this.__width = _, this.__height = h, this.__soliboDocumentId = o, this.__soliboDocumentSlot = d;
17
+ import { OnChangePlugin as Qt } from "@lexical/react/LexicalOnChangePlugin";
18
+ import { RichTextPlugin as te } from "@lexical/react/LexicalRichTextPlugin";
19
+ import nt from "classix";
20
+ import { $getNodeByKey as ut, $isParagraphNode as xt, DecoratorNode as ee, $applyNodeReplacement as re, createCommand as Et, COMMAND_PRIORITY_HIGH as Mt, PASTE_COMMAND as ie, $insertNodes as Ct, $isRangeSelection as bt, $setSelection as Pt, $getSelection as kt, $isTextNode as it, $createTextNode as ne, $isNodeSelection as oe, COMMAND_PRIORITY_LOW as yt, SELECTION_CHANGE_COMMAND as ae, FORMAT_TEXT_COMMAND as Dt, defineExtension as se, $getRoot as le } from "lexical";
21
+ import { useRef as x, useState as k, useEffect as F, useCallback as C, useId as ce } from "react";
22
+ import vt from "sanitize-html";
23
+ import { Button as N } from "../button/index.js";
24
+ import { File as ue } from "../file/index.js";
25
+ import { mergeRegister as de } from "@lexical/utils";
26
+ import { Icon as P } from "../icon/index.js";
27
+ import { I as Nt } from "../../index-Dd20d_9U.js";
28
+ import { Toolbar as me } from "../toolbar/index.js";
29
+ const he = "_field_1trki_3", ge = "_editor_1trki_8", fe = "_submit_1trki_26", pe = "_resizable_1trki_56", _e = "_resized_1trki_60", be = "_invalid_1trki_86", ke = "_error_1trki_90", De = "_dragging_1trki_96", ve = "_content_1trki_100", Ie = "_files_1trki_116", we = "_placeholder_1trki_125", Ce = "_fill_1trki_133", Le = "_meta_1trki_161", Ae = "_active_1trki_170", Me = "_bold_1trki_240", ye = "_italic_1trki_244", Ne = "_underline_1trki_248", xe = "_link_1trki_252", Ee = "_list_1trki_258", Pe = "_paragraph_1trki_259", h = {
30
+ field: he,
31
+ editor: ge,
32
+ submit: fe,
33
+ "image-resize-handle": "_image-resize-handle_1trki_50",
34
+ resizable: pe,
35
+ resized: _e,
36
+ "resize-handle": "_resize-handle_1trki_64",
37
+ invalid: be,
38
+ error: ke,
39
+ dragging: De,
40
+ content: ve,
41
+ "has-files": "_has-files_1trki_112",
42
+ files: Ie,
43
+ placeholder: we,
44
+ fill: Ce,
45
+ "fill-editor": "_fill-editor_1trki_141",
46
+ meta: Le,
47
+ active: Ae,
48
+ "inline-image": "_inline-image_1trki_182",
49
+ bold: Me,
50
+ italic: ye,
51
+ underline: Ne,
52
+ link: xe,
53
+ list: Ee,
54
+ paragraph: Pe
55
+ };
56
+ function Se({
57
+ alt: s = "",
58
+ editor: r,
59
+ height: e,
60
+ nodeKey: c,
61
+ soliboDocumentId: g,
62
+ soliboDocumentSlot: m,
63
+ src: p,
64
+ width: n
65
+ }) {
66
+ const u = x(null), f = x(null), [$, A] = k(), L = () => {
67
+ const i = r.getRootElement();
68
+ if (!i) return 1 / 0;
69
+ const l = getComputedStyle(i);
70
+ return Math.max(1, i.clientWidth - (parseFloat(l.paddingLeft) || 0) - (parseFloat(l.paddingRight) || 0));
71
+ }, S = (i, l = L()) => Math.round(Math.min(l, Math.max(Math.min(32, l), i))), w = (i) => {
72
+ r.update(() => {
73
+ const l = ut(c);
74
+ mt(l) && l.setWidth(i);
75
+ }), A(void 0);
76
+ };
77
+ return /* @__PURE__ */ O("span", { className: h["inline-image"], contentEditable: !1, tabIndex: m ? 0 : void 0, onKeyDown: (i) => {
78
+ !m || i.target !== i.currentTarget || !["Backspace", "Delete"].includes(i.key) || (i.preventDefault(), i.stopPropagation(), r.update(() => {
79
+ const l = ut(c);
80
+ if (!mt(l)) return;
81
+ const b = l.getParent();
82
+ xt(b) && b.getChildrenSize() === 1 ? b.remove() : l.remove(), r.dispatchCommand(St, m);
83
+ }), r.focus());
84
+ }, "data-component": "editorimage", children: [
85
+ /* @__PURE__ */ o("img", { alt: s, "data-solibo-document-id": g, "data-solibo-document-slot": m, draggable: !1, height: $ === void 0 ? e : void 0, ref: u, src: p, width: $ ?? n, onClick: (i) => {
86
+ var l;
87
+ i.preventDefault(), m && ((l = i.currentTarget.parentElement) == null || l.focus()), r.dispatchCommand(Tt, {
88
+ key: c,
89
+ soliboDocumentSlot: m,
90
+ src: p,
91
+ width: n
92
+ });
93
+ } }),
94
+ /* @__PURE__ */ o("button", { type: "button", "aria-label": `Resize image${s ? `: ${s}` : ""}`, title: "Drag to resize; use arrow keys to adjust width", className: h["image-resize-handle"], tabIndex: 0, onClick: (i) => {
95
+ i.preventDefault(), i.stopPropagation();
96
+ }, onKeyDown: (i) => {
97
+ var b;
98
+ if (!["ArrowLeft", "ArrowRight", "ArrowUp", "ArrowDown"].includes(i.key)) return;
99
+ i.preventDefault(), i.stopPropagation();
100
+ const l = ((b = u.current) == null ? void 0 : b.getBoundingClientRect().width) ?? n ?? 32;
101
+ w(S(l + (["ArrowRight", "ArrowUp"].includes(i.key) ? 10 : -10)));
102
+ }, onPointerDown: (i) => {
103
+ i.button !== 0 || !u.current || (i.preventDefault(), i.stopPropagation(), i.currentTarget.focus({
104
+ preventScroll: !0
105
+ }), i.currentTarget.setPointerCapture(i.pointerId), f.current = {
106
+ pointerId: i.pointerId,
107
+ x: i.clientX,
108
+ width: u.current.getBoundingClientRect().width,
109
+ maximum: L()
110
+ });
111
+ }, onPointerMove: (i) => {
112
+ const l = f.current;
113
+ !l || l.pointerId !== i.pointerId || A(S(l.width + i.clientX - l.x, l.maximum));
114
+ }, onPointerUp: (i) => {
115
+ const l = f.current;
116
+ !l || l.pointerId !== i.pointerId || (f.current = null, w(S(l.width + i.clientX - l.x, l.maximum)), i.currentTarget.releasePointerCapture(i.pointerId));
117
+ }, onPointerCancel: () => {
118
+ f.current = null, A(void 0);
119
+ }, onLostPointerCapture: () => {
120
+ f.current = null, A(void 0);
121
+ } })
122
+ ] });
123
+ }
124
+ const St = Et(), Tt = Et();
125
+ class ot extends ee {
126
+ constructor(e, c, g, m, p, n, u) {
127
+ super(p);
128
+ j(this, "__src");
129
+ j(this, "__alt");
130
+ j(this, "__width");
131
+ j(this, "__height");
132
+ j(this, "__soliboDocumentId");
133
+ j(this, "__soliboDocumentSlot");
134
+ this.__src = e, this.__alt = c, this.__width = g, this.__height = m, this.__soliboDocumentId = n, this.__soliboDocumentSlot = u;
40
135
  }
41
136
  static getType() {
42
137
  return "image";
43
138
  }
44
139
  static clone(e) {
45
- return new at(e.__src, e.__alt, e.__width, e.__height, e.__key, e.__soliboDocumentId, e.__soliboDocumentSlot);
140
+ return new ot(e.__src, e.__alt, e.__width, e.__height, e.__key, e.__soliboDocumentId, e.__soliboDocumentSlot);
46
141
  }
47
142
  static importJSON(e) {
48
- return gt({
143
+ return dt({
49
144
  alt: e.alt,
50
145
  height: e.height,
51
146
  soliboDocumentId: e.soliboDocumentId,
@@ -74,21 +169,21 @@ class at extends te {
74
169
  return {
75
170
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
76
171
  img: (e) => ({
77
- conversion: (l) => {
78
- if (!(l instanceof HTMLImageElement))
172
+ conversion: (c) => {
173
+ if (!(c instanceof HTMLImageElement))
79
174
  return null;
80
- const _ = l.getAttribute("src") ?? "";
81
- if (!_)
175
+ const g = c.getAttribute("src") ?? "";
176
+ if (!g)
82
177
  return null;
83
- const h = l.getAttribute("width"), g = l.getAttribute("height");
178
+ const m = c.getAttribute("width"), p = c.getAttribute("height");
84
179
  return {
85
- node: gt({
86
- alt: l.getAttribute("alt") ?? "",
87
- height: g ? Number(g) : void 0,
88
- soliboDocumentId: l.getAttribute("data-solibo-document-id") ?? void 0,
89
- soliboDocumentSlot: l.getAttribute("data-solibo-document-slot") ?? void 0,
90
- src: _,
91
- width: h ? Number(h) : void 0
180
+ node: dt({
181
+ alt: c.getAttribute("alt") ?? "",
182
+ height: p ? Number(p) : void 0,
183
+ soliboDocumentId: c.getAttribute("data-solibo-document-id") ?? void 0,
184
+ soliboDocumentSlot: c.getAttribute("data-solibo-document-slot") ?? void 0,
185
+ src: g,
186
+ width: m ? Number(m) : void 0
92
187
  })
93
188
  };
94
189
  },
@@ -115,58 +210,52 @@ class at extends te {
115
210
  return this.__src;
116
211
  }
117
212
  setSrc(e) {
118
- const l = this.getWritable();
119
- return l.__src = e, l;
213
+ const c = this.getWritable();
214
+ return c.__src = e, c;
120
215
  }
121
216
  setWidth(e) {
122
- const l = this.getWritable();
123
- return l.__width = e, l.__height = void 0, l;
217
+ const c = this.getWritable();
218
+ return c.__width = e, c.__height = void 0, c;
124
219
  }
125
220
  decorate(e) {
126
- return /* @__PURE__ */ n("img", { alt: this.__alt, height: this.__height, "data-solibo-document-id": this.__soliboDocumentId, "data-solibo-document-slot": this.__soliboDocumentSlot, onClick: (l) => {
127
- l.preventDefault(), e.dispatchCommand(Tt, {
128
- key: this.getKey(),
129
- soliboDocumentSlot: this.__soliboDocumentSlot,
130
- src: this.__src,
131
- width: this.__width
132
- });
133
- }, src: this.__src, width: this.__width });
221
+ return /* @__PURE__ */ o(Se, { alt: this.__alt, editor: e, height: this.__height, nodeKey: this.getKey(), soliboDocumentId: this.__soliboDocumentId, soliboDocumentSlot: this.__soliboDocumentSlot, src: this.__src, width: this.__width });
134
222
  }
135
223
  }
136
- function gt({
224
+ function dt({
137
225
  alt: s = "",
138
226
  height: r,
139
227
  soliboDocumentId: e,
140
- soliboDocumentSlot: l,
141
- src: _,
142
- width: h
228
+ soliboDocumentSlot: c,
229
+ src: g,
230
+ width: m
143
231
  }) {
144
- return ee(new at(_, s, h, r, void 0, e, l));
232
+ return re(new ot(g, s, m, r, void 0, e, c));
145
233
  }
146
- function Lt(s) {
147
- return s instanceof at;
234
+ function mt(s) {
235
+ return s instanceof ot;
148
236
  }
149
- const ge = ({
150
- createImages: s
237
+ const Te = ({
238
+ createImages: s,
239
+ onRemove: r
151
240
  }) => {
152
- const [r] = At();
153
- return j(() => r.registerCommand(ie, (e) => {
154
- var g;
155
- if (!("clipboardData" in e)) return !1;
156
- const l = e, _ = Array.from(((g = l.clipboardData) == null ? void 0 : g.items) ?? []).flatMap((o) => {
157
- if (o.kind !== "file" || !o.type.startsWith("image/")) return [];
158
- const d = o.getAsFile();
159
- return d ? [d] : [];
241
+ const [e] = wt();
242
+ return F(() => e.registerCommand(St, (c) => (r(c), !0), Mt), [e, r]), F(() => e.registerCommand(ie, (c) => {
243
+ var n;
244
+ if (!("clipboardData" in c)) return !1;
245
+ const g = c, m = Array.from(((n = g.clipboardData) == null ? void 0 : n.items) ?? []).flatMap((u) => {
246
+ if (u.kind !== "file" || !u.type.startsWith("image/")) return [];
247
+ const f = u.getAsFile();
248
+ return f ? [f] : [];
160
249
  });
161
- if (_.length === 0) return !1;
162
- l.preventDefault();
163
- const h = s(_);
164
- return r.update(() => {
165
- Mt(h.map((o) => gt(o)));
250
+ if (m.length === 0) return !1;
251
+ g.preventDefault();
252
+ const p = s(m);
253
+ return e.update(() => {
254
+ Ct(p.map((u) => dt(u)));
166
255
  }), !0;
167
- }, ne), [s, r]), null;
168
- }, fe = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/, pe = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/, be = [(s) => {
169
- const r = fe.exec(s);
256
+ }, Mt), [s, e]), null;
257
+ }, Re = /(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))/, Oe = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/, $e = [(s) => {
258
+ const r = Re.exec(s);
170
259
  return r != null && r.length ? {
171
260
  index: r.index,
172
261
  length: r[0].length,
@@ -174,7 +263,7 @@ const ge = ({
174
263
  url: `mailto:${r[0]}`
175
264
  } : null;
176
265
  }, (s) => {
177
- const r = pe.exec(s);
266
+ const r = Oe.exec(s);
178
267
  return r != null && r.length ? {
179
268
  index: r.index,
180
269
  length: r[0].length,
@@ -182,7 +271,7 @@ const ge = ({
182
271
  url: r[0].startsWith("http") ? r[0] : `https://${r[0]}`
183
272
  } : null;
184
273
  }];
185
- function Ct(s) {
274
+ function It(s) {
186
275
  try {
187
276
  const r = new URL(s);
188
277
  return r.protocol === "http:" || r.protocol === "https:";
@@ -190,442 +279,395 @@ function Ct(s) {
190
279
  return !1;
191
280
  }
192
281
  }
193
- const ve = "_field_1clme_3", De = "_editor_1clme_8", Ie = "_submit_1clme_26", ke = "_resizable_1clme_56", we = "_resized_1clme_60", Le = "_invalid_1clme_86", Ce = "_error_1clme_90", Ae = "_dragging_1clme_96", Me = "_content_1clme_100", Se = "_files_1clme_116", Ne = "_placeholder_1clme_125", Ee = "_fill_1clme_133", ye = "_meta_1clme_161", xe = "_active_1clme_170", Te = "_bold_1clme_202", Oe = "_italic_1clme_206", Pe = "_underline_1clme_210", $e = "_link_1clme_214", Re = "_list_1clme_220", Ue = "_paragraph_1clme_221", m = {
194
- field: ve,
195
- editor: De,
196
- submit: Ie,
197
- resizable: ke,
198
- resized: we,
199
- "resize-handle": "_resize-handle_1clme_64",
200
- invalid: Le,
201
- error: Ce,
202
- dragging: Ae,
203
- content: Me,
204
- "has-files": "_has-files_1clme_112",
205
- files: Se,
206
- placeholder: Ne,
207
- fill: Ee,
208
- "fill-editor": "_fill-editor_1clme_141",
209
- meta: ye,
210
- active: xe,
211
- "image-sizes": "_image-sizes_1clme_182",
212
- bold: Te,
213
- italic: Oe,
214
- underline: Pe,
215
- link: $e,
216
- list: Re,
217
- paragraph: Ue
218
- };
219
- function ze({
282
+ function Ue({
220
283
  editableRef: s
221
284
  }) {
222
- const r = O(null), [e, l] = f(0), [_, h] = f(0);
223
- j(() => {
224
- const o = s.current;
225
- if (!o) return;
226
- const d = () => {
227
- l(Math.round(o.getBoundingClientRect().height)), h(Math.round(parseFloat(getComputedStyle(o).minHeight) || 0));
285
+ const r = x(null), [e, c] = k(0), [g, m] = k(0);
286
+ F(() => {
287
+ const n = s.current;
288
+ if (!n) return;
289
+ const u = () => {
290
+ c(Math.round(n.getBoundingClientRect().height)), m(Math.round(parseFloat(getComputedStyle(n).minHeight) || 0));
228
291
  };
229
- if (d(), typeof ResizeObserver > "u") return;
230
- const C = new ResizeObserver(d);
231
- return C.observe(o), () => C.disconnect();
292
+ if (u(), typeof ResizeObserver > "u") return;
293
+ const f = new ResizeObserver(u);
294
+ return f.observe(n), () => f.disconnect();
232
295
  }, [s]);
233
- const g = (o) => {
234
- const d = s.current;
235
- if (!d) return;
236
- const C = parseFloat(getComputedStyle(d).minHeight) || 0;
237
- d.style.height = `${Math.max(C, o)}px`;
296
+ const p = (n) => {
297
+ const u = s.current;
298
+ if (!u) return;
299
+ const f = parseFloat(getComputedStyle(u).minHeight) || 0;
300
+ u.style.height = `${Math.max(f, n)}px`;
238
301
  };
239
- return /* @__PURE__ */ n("div", { "aria-label": "Resize editor", "aria-orientation": "horizontal", "aria-valuemin": _, "aria-valuenow": e, "aria-valuetext": `${e} pixels`, className: m["resize-handle"], role: "separator", tabIndex: 0, onDoubleClick: () => {
240
- var o;
241
- return (o = s.current) == null ? void 0 : o.style.removeProperty("height");
242
- }, onKeyDown: (o) => {
243
- const d = s.current;
244
- d && (o.key === "Home" ? (o.preventDefault(), d.style.removeProperty("height")) : (o.key === "ArrowUp" || o.key === "ArrowDown") && (o.preventDefault(), g(d.getBoundingClientRect().height + (o.key === "ArrowUp" ? 20 : -20))));
245
- }, onPointerDown: (o) => {
246
- const d = s.current;
247
- o.button !== 0 || !d || (o.preventDefault(), o.currentTarget.focus({
302
+ return /* @__PURE__ */ o("div", { "aria-label": "Resize editor", "aria-orientation": "horizontal", "aria-valuemin": g, "aria-valuenow": e, "aria-valuetext": `${e} pixels`, className: h["resize-handle"], role: "separator", tabIndex: 0, onDoubleClick: () => {
303
+ var n;
304
+ return (n = s.current) == null ? void 0 : n.style.removeProperty("height");
305
+ }, onKeyDown: (n) => {
306
+ const u = s.current;
307
+ u && (n.key === "Home" ? (n.preventDefault(), u.style.removeProperty("height")) : (n.key === "ArrowUp" || n.key === "ArrowDown") && (n.preventDefault(), p(u.getBoundingClientRect().height + (n.key === "ArrowUp" ? 20 : -20))));
308
+ }, onPointerDown: (n) => {
309
+ const u = s.current;
310
+ n.button !== 0 || !u || (n.preventDefault(), n.currentTarget.focus({
248
311
  preventScroll: !0
249
- }), o.currentTarget.setPointerCapture(o.pointerId), r.current = {
250
- pointerId: o.pointerId,
251
- y: o.clientY,
252
- height: d.getBoundingClientRect().height
312
+ }), n.currentTarget.setPointerCapture(n.pointerId), r.current = {
313
+ pointerId: n.pointerId,
314
+ y: n.clientY,
315
+ height: u.getBoundingClientRect().height
253
316
  });
254
- }, onPointerMove: (o) => {
255
- !r.current || r.current.pointerId !== o.pointerId || g(r.current.height + r.current.y - o.clientY);
256
- }, onPointerUp: (o) => {
257
- !r.current || r.current.pointerId !== o.pointerId || (r.current = null, o.currentTarget.releasePointerCapture(o.pointerId));
317
+ }, onPointerMove: (n) => {
318
+ !r.current || r.current.pointerId !== n.pointerId || p(r.current.height + r.current.y - n.clientY);
319
+ }, onPointerUp: (n) => {
320
+ !r.current || r.current.pointerId !== n.pointerId || (r.current = null, n.currentTarget.releasePointerCapture(n.pointerId));
258
321
  }, onLostPointerCapture: () => {
259
322
  r.current = null;
260
323
  }, onPointerCancel: () => {
261
324
  r.current = null;
262
325
  }, "data-component": "editorresizehandle" });
263
326
  }
264
- const He = [{
265
- label: "Small",
266
- width: 320
267
- }, {
268
- label: "Medium",
269
- width: 640
270
- }, {
271
- label: "Large",
272
- width: 960
273
- }, {
274
- label: "Original",
275
- width: void 0
276
- }], Be = ({
327
+ const ze = ({
277
328
  onFilesSelected: s,
278
329
  onInlineImageRemove: r
279
330
  }) => {
280
- const [e] = At(), [l, _] = f(!1), [h, g] = f(!1), [o, d] = f(!1), [C, Q] = f(!1), [F, N] = f(!1), [tt, A] = f(!1), [x, P] = f(""), [p, G] = f(null), [Z, $] = f(null), [ct, q] = f(void 0), [R, D] = f(""), ut = Ct(R.trim()), et = O(null), dt = O(null), U = O(null), T = O(null), Y = O(!1), rt = (t) => t.preventDefault(), V = b((t) => {
281
- T.current = vt(t) ? t.clone() : null;
282
- }, []), I = b((t) => {
331
+ const [e] = wt(), [c, g] = k(!1), [m, p] = k(!1), [n, u] = k(!1), [f, $] = k(!1), [A, L] = k(!1), [S, w] = k(!1), [i, l] = k(""), [b, G] = k(null), [Z, U] = k(null), [z, M] = k(""), Q = It(z.trim()), q = x(null), at = x(null), tt = x(null), T = x(null), E = x(!1), st = (t) => t.preventDefault(), V = C((t) => {
332
+ T.current = bt(t) ? t.clone() : null;
333
+ }, []), X = C((t) => {
283
334
  e.update(() => {
284
- T.current && xt(T.current), t();
335
+ T.current && Pt(T.current), t();
285
336
  }), T.current = null;
286
- }, [e]), k = (t) => {
287
- Y.current = !0, t.preventDefault();
288
- }, z = () => {
289
- if (Y.current) {
290
- Y.current = !1;
337
+ }, [e]), lt = (t) => {
338
+ E.current = !0, t.preventDefault();
339
+ }, R = () => {
340
+ if (E.current) {
341
+ E.current = !1;
291
342
  return;
292
343
  }
293
- nt();
294
- }, v = b(() => {
295
- g(!1), P(""), G(null), $(null), q(void 0);
296
- }, []), M = b(() => {
297
- N(!1), D("");
298
- }, []), mt = b((t) => {
299
- g(!0), P((t == null ? void 0 : t.src) ?? ""), G((t == null ? void 0 : t.key) ?? null), $((t == null ? void 0 : t.soliboDocumentSlot) ?? null), q(t == null ? void 0 : t.width), M(), t != null && t.soliboDocumentSlot || setTimeout(() => {
300
- var c;
301
- return (c = dt.current) == null ? void 0 : c.focus();
344
+ Y();
345
+ }, _ = C(() => {
346
+ p(!1), l(""), G(null), U(null);
347
+ }, []), v = C(() => {
348
+ L(!1), M("");
349
+ }, []), W = C((t) => {
350
+ p(!0), l((t == null ? void 0 : t.src) ?? ""), G((t == null ? void 0 : t.key) ?? null), U((t == null ? void 0 : t.soliboDocumentSlot) ?? null), v(), t != null && t.soliboDocumentSlot || setTimeout(() => {
351
+ var a;
352
+ return (a = at.current) == null ? void 0 : a.focus();
302
353
  }, 0);
303
- }, [M]), ht = b((t) => {
354
+ }, [v]), K = C((t) => {
304
355
  e.getEditorState().read(() => {
305
- V(Dt());
306
- }), N(!0), D(t), v(), setTimeout(() => {
307
- var c;
308
- return (c = U.current) == null ? void 0 : c.focus();
356
+ V(kt());
357
+ }), L(!0), M(t), _(), setTimeout(() => {
358
+ var a;
359
+ return (a = tt.current) == null ? void 0 : a.focus();
309
360
  }, 0);
310
- }, [v, e, V]), it = b(() => {
311
- const t = R.trim();
312
- Ct(t) && (I(() => {
361
+ }, [_, e, V]), et = C(() => {
362
+ const t = z.trim();
363
+ It(t) && (X(() => {
313
364
  e.dispatchCommand(ft, {
314
365
  url: t,
315
366
  target: "_blank"
316
367
  });
317
- const c = Dt();
318
- if (!vt(c)) return;
319
- const E = c.getNodes().at(-1) ?? null, W = (E == null ? void 0 : E.getParent()) ?? null, w = ot(E) ? E : ot(W) ? W : null;
320
- if (w) {
321
- const H = w.getLastChild();
322
- if (st(H)) {
323
- const St = H.getTextContent(), Nt = St.replace(/\s+$/, "");
324
- Nt !== St && H.setTextContent(Nt);
368
+ const a = kt();
369
+ if (!bt(a)) return;
370
+ const d = a.getNodes().at(-1) ?? null, D = (d == null ? void 0 : d.getParent()) ?? null, I = rt(d) ? d : rt(D) ? D : null;
371
+ if (I) {
372
+ const H = I.getLastChild();
373
+ if (it(H)) {
374
+ const Lt = H.getTextContent(), At = Lt.replace(/\s+$/, "");
375
+ At !== Lt && H.setTextContent(At);
325
376
  }
326
- const X = w.getNextSibling();
327
- if (st(X) && /^\s/.test(X.getTextContent())) {
328
- X.select(1, 1);
377
+ const J = I.getNextSibling();
378
+ if (it(J) && /^\s/.test(J.getTextContent())) {
379
+ J.select(1, 1);
329
380
  return;
330
381
  }
331
- const S = oe(" ");
332
- w.insertAfter(S), S.selectEnd();
382
+ const y = ne(" ");
383
+ I.insertAfter(y), y.selectEnd();
333
384
  }
334
- }), M());
335
- }, [M, e, R, I]), nt = b(() => {
336
- const t = x.trim();
385
+ }), v());
386
+ }, [v, e, z, X]), Y = C(() => {
387
+ const t = i.trim();
337
388
  if (!t) {
338
- v();
389
+ _();
339
390
  return;
340
391
  }
341
392
  e.update(() => {
342
- if (p) {
343
- const c = It(p);
344
- Lt(c) && c.setSrc(t);
393
+ if (b) {
394
+ const a = ut(b);
395
+ mt(a) && a.setSrc(t);
345
396
  return;
346
397
  }
347
- Mt([gt({
398
+ Ct([dt({
348
399
  src: t
349
400
  })]);
350
- }), v();
351
- }, [v, e, p, x]), J = b(() => {
352
- if (!p) {
353
- v();
401
+ }), _();
402
+ }, [_, e, b, i]), ht = C(() => {
403
+ if (!b) {
404
+ _();
354
405
  return;
355
406
  }
356
407
  e.update(() => {
357
- const t = It(p);
358
- if (Lt(t)) {
359
- const c = t.getParent();
360
- se(c) && c.getChildrenSize() === 1 ? c.remove() : t.remove(), Z && (r == null || r(Z));
408
+ const t = ut(b);
409
+ if (mt(t)) {
410
+ const a = t.getParent();
411
+ xt(a) && a.getChildrenSize() === 1 ? a.remove() : t.remove(), Z && (r == null || r(Z));
361
412
  }
362
- }), v();
363
- }, [v, e, p, Z, r]), i = b((t) => {
364
- p && (e.update(() => {
365
- const c = It(p);
366
- Lt(c) && c.setWidth(t);
367
- }), q(t));
368
- }, [e, p]), a = b(() => {
369
- I(() => {
413
+ }), _();
414
+ }, [_, e, b, Z, r]), gt = C(() => {
415
+ X(() => {
370
416
  e.dispatchCommand(ft, null);
371
- }), M();
372
- }, [M, e, I]), u = b(() => {
373
- const t = Dt();
374
- if (!vt(t)) {
375
- if (le(t)) {
376
- const W = t.getNodes(), w = W[0] ?? null, H = (w == null ? void 0 : w.getParent()) ?? null;
377
- _(W.some((S) => st(S) && S.hasFormat("bold"))), d(W.some((S) => st(S) && S.hasFormat("italic"))), Q(W.some((S) => st(S) && S.hasFormat("underline"))), A(pt(H) || bt(H) || pt(w) || bt(w));
378
- const X = ot(w) ? w : ot(H) ? H : null;
379
- if (X) {
380
- N(!0), D(X.getURL());
417
+ }), v();
418
+ }, [v, e, X]), B = C(() => {
419
+ const t = kt();
420
+ if (!bt(t)) {
421
+ if (oe(t)) {
422
+ const D = t.getNodes(), I = D[0] ?? null, H = (I == null ? void 0 : I.getParent()) ?? null;
423
+ g(D.some((y) => it(y) && y.hasFormat("bold"))), u(D.some((y) => it(y) && y.hasFormat("italic"))), $(D.some((y) => it(y) && y.hasFormat("underline"))), w(pt(H) || _t(H) || pt(I) || _t(I));
424
+ const J = rt(I) ? I : rt(H) ? H : null;
425
+ if (J) {
426
+ L(!0), M(J.getURL());
381
427
  return;
382
428
  }
383
- N(!1), D(""), T.current = null;
429
+ L(!1), M(""), T.current = null;
384
430
  return;
385
431
  }
386
- _(!1), d(!1), Q(!1), A(!1), N(!1), D(""), T.current = null;
432
+ g(!1), u(!1), $(!1), w(!1), L(!1), M(""), T.current = null;
387
433
  return;
388
434
  }
389
- const [c] = t.getNodes(), E = (c == null ? void 0 : c.getParent()) ?? null;
390
- if (_(t.hasFormat("bold")), d(t.hasFormat("italic")), Q(t.hasFormat("underline")), A(pt(E) || bt(E)), ot(E)) {
391
- N(!0), D(E.getURL()), V(t);
435
+ const [a] = t.getNodes(), d = (a == null ? void 0 : a.getParent()) ?? null;
436
+ if (g(t.hasFormat("bold")), u(t.hasFormat("italic")), $(t.hasFormat("underline")), w(pt(d) || _t(d)), rt(d)) {
437
+ L(!0), M(d.getURL()), V(t);
392
438
  return;
393
439
  }
394
- N(!1), D(""), T.current = null;
440
+ L(!1), M(""), T.current = null;
395
441
  }, [V]);
396
- return j(() => he(e.registerUpdateListener(({
442
+ return F(() => de(e.registerUpdateListener(({
397
443
  editorState: t
398
444
  }) => {
399
445
  t.read(() => {
400
- u();
446
+ B();
401
447
  });
402
- }), e.registerCommand(Tt, (t) => (mt(t), !0), Et), e.registerCommand(ae, () => (e.getEditorState().read(() => {
403
- u();
404
- }), !1), Et)), [e, mt, u]), /* @__PURE__ */ B(_e, { variant: "editor", "data-component": "editortoolbar", children: [
405
- /* @__PURE__ */ n(L, { "aria-label": "Bold", "data-active": l, onClick: () => {
406
- e.dispatchCommand(kt, "bold");
407
- }, title: "Bold", variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "TextB" }) }),
408
- /* @__PURE__ */ n(L, { "aria-label": "Italic", "data-active": o, onClick: () => {
409
- e.dispatchCommand(kt, "italic");
410
- }, title: "Italic", variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "TextItalic" }) }),
411
- /* @__PURE__ */ n(L, { "aria-label": "Underline", "data-active": C, onClick: () => {
412
- e.dispatchCommand(kt, "underline");
413
- }, title: "Underline", variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "TextUnderline" }) }),
414
- /* @__PURE__ */ n(L, { "aria-label": "List", "data-active": tt, onClick: () => {
415
- tt ? e.dispatchCommand(Ht, void 0) : e.dispatchCommand(Bt, void 0);
416
- }, title: "List", variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "ListBullets" }) }),
417
- /* @__PURE__ */ n(L, { "aria-label": "Link", "data-active": F, onClick: () => {
418
- F ? ht(R) : (e.dispatchCommand(ft, {
448
+ }), e.registerCommand(Tt, (t) => (t.soliboDocumentSlot ? (_(), v()) : W(t), !0), yt), e.registerCommand(ae, () => (e.getEditorState().read(() => {
449
+ B();
450
+ }), !1), yt)), [_, v, e, W, B]), /* @__PURE__ */ O(me, { variant: "editor", "data-component": "editortoolbar", children: [
451
+ /* @__PURE__ */ o(N, { "aria-label": "Bold", "data-active": c, onClick: () => {
452
+ e.dispatchCommand(Dt, "bold");
453
+ }, title: "Bold", variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "TextB" }) }),
454
+ /* @__PURE__ */ o(N, { "aria-label": "Italic", "data-active": n, onClick: () => {
455
+ e.dispatchCommand(Dt, "italic");
456
+ }, title: "Italic", variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "TextItalic" }) }),
457
+ /* @__PURE__ */ o(N, { "aria-label": "Underline", "data-active": f, onClick: () => {
458
+ e.dispatchCommand(Dt, "underline");
459
+ }, title: "Underline", variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "TextUnderline" }) }),
460
+ /* @__PURE__ */ o(N, { "aria-label": "List", "data-active": S, onClick: () => {
461
+ S ? e.dispatchCommand(Ht, void 0) : e.dispatchCommand(Ft, void 0);
462
+ }, title: "List", variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "ListBullets" }) }),
463
+ /* @__PURE__ */ o(N, { "aria-label": "Link", "data-active": A, onClick: () => {
464
+ A ? K(z) : (e.dispatchCommand(ft, {
419
465
  url: "https://"
420
- }), ht("https://"));
421
- }, title: "Link", variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "Link" }) }),
422
- s && /* @__PURE__ */ B(_t, { children: [
423
- /* @__PURE__ */ n("input", { hidden: !0, multiple: !0, onChange: (t) => {
466
+ }), K("https://"));
467
+ }, title: "Link", variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "Link" }) }),
468
+ s && /* @__PURE__ */ O(ct, { children: [
469
+ /* @__PURE__ */ o("input", { hidden: !0, multiple: !0, onChange: (t) => {
424
470
  t.target.files && s(t.target.files), t.target.value = "";
425
- }, ref: et, type: "file" }),
426
- /* @__PURE__ */ n(L, { "aria-label": "Upload files", onClick: () => {
471
+ }, ref: q, type: "file" }),
472
+ /* @__PURE__ */ o(N, { "aria-label": "Upload files", onClick: () => {
427
473
  var t;
428
- return (t = et.current) == null ? void 0 : t.click();
429
- }, title: "Upload files", variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "Paperclip" }) })
474
+ return (t = q.current) == null ? void 0 : t.click();
475
+ }, title: "Upload files", variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "Paperclip" }) })
430
476
  ] }),
431
- /* @__PURE__ */ B("div", { className: lt(m.meta, F || h ? m.active : ""), children: [
432
- F && /* @__PURE__ */ B(_t, { children: [
433
- /* @__PURE__ */ n(yt, { "aria-invalid": !ut, onBlur: () => it(), onChange: (t) => D(t.target.value), onKeyDown: (t) => {
434
- t.key === "Enter" && (t.preventDefault(), it());
435
- }, ref: U, value: R }),
436
- /* @__PURE__ */ n(L, { "aria-label": "Apply link", disabled: !ut, onClick: () => {
437
- it();
438
- }, onMouseDown: rt, variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "Check" }) }),
439
- /* @__PURE__ */ n(L, { "aria-label": "Remove link", onClick: () => a(), onMouseDown: rt, variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "Trash", variant: "danger" }) })
477
+ /* @__PURE__ */ O("div", { className: nt(h.meta, A || m ? h.active : ""), children: [
478
+ A && /* @__PURE__ */ O(ct, { children: [
479
+ /* @__PURE__ */ o(Nt, { "aria-invalid": !Q, onBlur: () => et(), onChange: (t) => M(t.target.value), onKeyDown: (t) => {
480
+ t.key === "Enter" && (t.preventDefault(), et());
481
+ }, ref: tt, value: z }),
482
+ /* @__PURE__ */ o(N, { "aria-label": "Apply link", disabled: !Q, onClick: () => {
483
+ et();
484
+ }, onMouseDown: st, variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "Check" }) }),
485
+ /* @__PURE__ */ o(N, { "aria-label": "Remove link", onClick: () => gt(), onMouseDown: st, variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "Trash", variant: "danger" }) })
440
486
  ] }),
441
- h && /* @__PURE__ */ B(_t, { children: [
442
- !Z && /* @__PURE__ */ B(_t, { children: [
443
- /* @__PURE__ */ n(yt, { className: lt(m.active), onBlur: z, onChange: (t) => P(t.target.value), onKeyDown: (t) => {
444
- t.key === "Enter" && (t.preventDefault(), Y.current = !0, nt());
445
- }, ref: dt, value: x }),
446
- /* @__PURE__ */ n(L, { "aria-label": "Apply image", onClick: () => nt(), onMouseDown: k, variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "Check" }) })
487
+ m && /* @__PURE__ */ O(ct, { children: [
488
+ !Z && /* @__PURE__ */ O(ct, { children: [
489
+ /* @__PURE__ */ o(Nt, { className: nt(h.active), onBlur: R, onChange: (t) => l(t.target.value), onKeyDown: (t) => {
490
+ t.key === "Enter" && (t.preventDefault(), E.current = !0, Y());
491
+ }, ref: at, value: i }),
492
+ /* @__PURE__ */ o(N, { "aria-label": "Apply image", onClick: () => Y(), onMouseDown: lt, variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "Check" }) })
447
493
  ] }),
448
- /* @__PURE__ */ n("div", { className: m["image-sizes"], children: He.map(({
449
- label: t,
450
- width: c
451
- }) => /* @__PURE__ */ n(L, { "aria-label": `${t} image`, "data-active": ct === c, onClick: () => i(c), onMouseDown: rt, variant: "tertiary", children: t }, t)) }),
452
- /* @__PURE__ */ n(L, { "aria-label": "Remove image", onClick: () => J(), onMouseDown: k, variant: "tertiary", children: /* @__PURE__ */ n(y, { name: "Trash", variant: "danger" }) })
494
+ /* @__PURE__ */ o(N, { "aria-label": "Remove image", onClick: () => ht(), onMouseDown: lt, variant: "tertiary", children: /* @__PURE__ */ o(P, { name: "Trash", variant: "danger" }) })
453
495
  ] })
454
496
  ] })
455
497
  ] });
456
- }, Fe = ce({
498
+ }, Be = se({
457
499
  name: "solibo-editor",
458
500
  namespace: "Editor",
459
- nodes: [Ut, zt, Ft, Wt, at],
501
+ nodes: [zt, Bt, Wt, Kt, ot],
460
502
  onError(s) {
461
503
  throw s;
462
504
  },
463
505
  theme: {
464
- link: m.link,
506
+ link: h.link,
465
507
  list: {
466
- ol: m.list,
467
- ul: m.list
508
+ ol: h.list,
509
+ ul: h.list
468
510
  },
469
- paragraph: m.paragraph,
511
+ paragraph: h.paragraph,
470
512
  text: {
471
- bold: m.bold,
472
- italic: m.italic,
473
- underline: m.underline
513
+ bold: h.bold,
514
+ italic: h.italic,
515
+ underline: h.underline
474
516
  }
475
517
  }
476
518
  });
477
- function We({
519
+ function He({
478
520
  autofocus: s,
479
521
  content: r = "",
480
522
  lastEmittedContentRef: e
481
523
  }) {
482
- const [l] = At();
483
- return j(() => {
484
- e.current !== r && l.update(() => {
485
- const h = new DOMParser().parseFromString(r, "text/html"), g = Rt(l, h), o = ue();
486
- o.clear().select(), Mt(g), s ? o.selectEnd() : xt(null);
524
+ const [c] = wt();
525
+ return F(() => {
526
+ e.current !== r && c.update(() => {
527
+ const m = new DOMParser().parseFromString(r, "text/html"), p = Ut(c, m), n = le();
528
+ n.clear().select(), Ct(p), s ? n.selectEnd() : Pt(null);
487
529
  });
488
- }, [s, r, l, e]), null;
530
+ }, [s, r, c, e]), null;
489
531
  }
490
- const fr = ({
532
+ const gr = ({
491
533
  autofocus: s = !1,
492
534
  autolink: r = !1,
493
535
  content: e,
494
- disabled: l = !1,
495
- errorMessage: _,
496
- fill: h = !1,
497
- files: g,
498
- inline: o = !1,
499
- inlineImages: d,
500
- invalid: C = !1,
501
- isSubmitting: Q = !1,
502
- maxRows: F = 12,
503
- minRows: N = 1,
504
- onChange: tt,
505
- onFilesChange: A,
506
- onInlineImagesChange: x,
507
- onSubmit: P,
508
- onUpload: p,
536
+ disabled: c = !1,
537
+ errorMessage: g,
538
+ fill: m = !1,
539
+ files: p,
540
+ inline: n = !1,
541
+ inlineImages: u,
542
+ invalid: f = !1,
543
+ isSubmitting: $ = !1,
544
+ maxRows: A = 12,
545
+ minRows: L = 1,
546
+ onChange: S,
547
+ onFilesChange: w,
548
+ onInlineImagesChange: i,
549
+ onSubmit: l,
550
+ onUpload: b,
509
551
  placeholder: G,
510
552
  required: Z = !1,
511
- resizable: $ = !1,
512
- submitLabel: ct = "Submit"
553
+ resizable: U = !1,
554
+ submitLabel: z = "Submit"
513
555
  }) => {
514
- const q = de(), R = O(void 0), D = O(null), [ut, et] = f(!1), [dt, U] = f(!1), [T, Y] = f([]), [rt, V] = f([]), I = O(/* @__PURE__ */ new Map()), k = g ?? T, z = d ?? rt;
515
- j(() => {
516
- const i = D.current;
517
- if (!i) return;
518
- if (!$ || h) {
519
- i.style.removeProperty("height"), et(!1);
556
+ const M = ce(), Q = x(void 0), q = x(null), [at, tt] = k(!1), [T, E] = k(!1), [st, V] = k([]), [X, lt] = k([]), R = x(/* @__PURE__ */ new Map()), _ = p ?? st, v = u ?? X;
557
+ F(() => {
558
+ const t = q.current;
559
+ if (!t) return;
560
+ if (!U || m) {
561
+ t.style.removeProperty("height"), tt(!1);
520
562
  return;
521
563
  }
522
- const a = () => et(i.style.height !== ""), u = new MutationObserver(a);
523
- return u.observe(i, {
564
+ const a = () => tt(t.style.height !== ""), d = new MutationObserver(a);
565
+ return d.observe(t, {
524
566
  attributes: !0,
525
567
  attributeFilter: ["style"]
526
- }), a(), () => u.disconnect();
527
- }, [h, $]);
528
- const v = (i) => {
529
- g === void 0 && Y(i), A == null || A(i);
530
- }, M = b((i) => {
531
- d === void 0 && V(i), x == null || x(i);
532
- }, [d, x]), mt = b((i) => {
533
- const a = i.map((u) => {
534
- const t = `pasted-${crypto.randomUUID()}`, c = URL.createObjectURL(u);
535
- return I.current.set(t, c), {
568
+ }), a(), () => d.disconnect();
569
+ }, [m, U]);
570
+ const W = (t) => {
571
+ p === void 0 && V(t), w == null || w(t);
572
+ }, K = C((t) => {
573
+ u === void 0 && lt(t), i == null || i(t);
574
+ }, [u, i]), et = C((t) => {
575
+ const a = t.map((d) => {
576
+ const D = `pasted-${crypto.randomUUID()}`, I = URL.createObjectURL(d);
577
+ return R.current.set(D, I), {
536
578
  image: {
537
- alt: u.name,
538
- soliboDocumentSlot: t,
539
- src: c
579
+ alt: d.name,
580
+ soliboDocumentSlot: D,
581
+ src: I
540
582
  },
541
583
  pending: {
542
- file: u,
543
- slot: t
584
+ file: d,
585
+ slot: D
544
586
  }
545
587
  };
546
588
  });
547
- return M([...z, ...a.map(({
548
- pending: u
549
- }) => u)]), a.map(({
550
- image: u
551
- }) => u);
552
- }, [z, M]), ht = b((i) => {
553
- M(z.filter((u) => u.slot !== i));
554
- const a = I.current.get(i);
555
- a && URL.revokeObjectURL(a), I.current.delete(i);
556
- }, [z, M]);
557
- j(() => () => {
558
- I.current.forEach((i) => URL.revokeObjectURL(i)), I.current.clear();
559
- }, []), j(() => {
560
- const i = new Set(z.map((a) => a.slot));
561
- I.current.forEach((a, u) => {
562
- i.has(u) || (URL.revokeObjectURL(a), I.current.delete(u));
589
+ return K([...v, ...a.map(({
590
+ pending: d
591
+ }) => d)]), a.map(({
592
+ image: d
593
+ }) => d);
594
+ }, [v, K]), Y = C((t) => {
595
+ K(v.filter((d) => d.slot !== t));
596
+ const a = R.current.get(t);
597
+ a && URL.revokeObjectURL(a), R.current.delete(t);
598
+ }, [v, K]);
599
+ F(() => () => {
600
+ R.current.forEach((t) => URL.revokeObjectURL(t)), R.current.clear();
601
+ }, []), F(() => {
602
+ const t = new Set(v.map((a) => a.slot));
603
+ R.current.forEach((a, d) => {
604
+ t.has(d) || (URL.revokeObjectURL(a), R.current.delete(d));
563
605
  });
564
- }, [z]);
565
- const it = (i) => {
606
+ }, [v]);
607
+ const ht = (t) => {
566
608
  if (typeof DataTransfer < "u") {
567
609
  const a = new DataTransfer();
568
- return i.forEach((u) => a.items.add(u)), a.files;
610
+ return t.forEach((d) => a.items.add(d)), a.files;
569
611
  }
570
- return Object.assign([...i], {
571
- item: (a) => i[a] ?? null
612
+ return Object.assign([...t], {
613
+ item: (a) => t[a] ?? null
572
614
  });
573
- }, nt = async () => {
615
+ }, gt = async () => {
574
616
  try {
575
- k.length > 0 && await (p == null ? void 0 : p(it(k))), await (P == null ? void 0 : P()), k.length > 0 && v([]);
617
+ _.length > 0 && await (b == null ? void 0 : b(ht(_))), await (l == null ? void 0 : l()), _.length > 0 && W([]);
576
618
  } catch {
577
619
  return;
578
620
  }
579
- }, J = (i) => {
580
- i.preventDefault(), i.stopPropagation();
621
+ }, B = (t) => {
622
+ t.preventDefault(), t.stopPropagation();
581
623
  };
582
- return /* @__PURE__ */ B("div", { className: lt(m.field, h && m.fill), "data-max-rows": F, "data-min-rows": N, onDragEnter: (i) => {
583
- J(i), U(!!A);
584
- }, onDragOver: (i) => {
585
- J(i), U(!!A);
586
- }, onDragLeave: (i) => {
587
- J(i), U(!1);
588
- }, onDropCapture: (i) => {
589
- var u;
590
- const a = (u = i.dataTransfer) == null ? void 0 : u.files;
591
- a != null && a.length && (J(i), (A || p) && v([...k, ...Array.from(a)]), U(!1));
592
- }, onDrop: (i) => {
593
- i.preventDefault(), U(!1);
624
+ return /* @__PURE__ */ O("div", { className: nt(h.field, m && h.fill), "data-max-rows": A, "data-min-rows": L, onDragEnter: (t) => {
625
+ B(t), E(!!w);
626
+ }, onDragOver: (t) => {
627
+ B(t), E(!!w);
628
+ }, onDragLeave: (t) => {
629
+ B(t), E(!1);
630
+ }, onDropCapture: (t) => {
631
+ var d;
632
+ const a = (d = t.dataTransfer) == null ? void 0 : d.files;
633
+ a != null && a.length && (B(t), (w || b) && W([..._, ...Array.from(a)]), E(!1));
634
+ }, onDrop: (t) => {
635
+ t.preventDefault(), E(!1);
594
636
  }, "data-component": "editor", children: [
595
- $ === "top" && !h && /* @__PURE__ */ n(ze, { editableRef: D }),
596
- /* @__PURE__ */ n("div", { className: lt(m.editor, h && m["fill-editor"], $ === !0 && !h && m.resizable, $ && !h && ut && m.resized, C && m.invalid, k.length > 0 && m["has-files"]), style: {
597
- "--editor-max-height": `calc(${F * 1.25}em + (2 * var(--scale-8)))`,
598
- "--editor-min-height": `calc(${N * 1.25}em + (2 * var(--scale-8)))`
599
- }, children: /* @__PURE__ */ B(qt, { contentEditable: null, extension: Fe, children: [
600
- !o && /* @__PURE__ */ n(Be, { onInlineImageRemove: ht, onFilesSelected: p || A ? (i) => {
601
- v([...k, ...Array.from(i)]);
637
+ U === "top" && !m && /* @__PURE__ */ o(Ue, { editableRef: q }),
638
+ /* @__PURE__ */ o("div", { className: nt(h.editor, m && h["fill-editor"], U === !0 && !m && h.resizable, U && !m && at && h.resized, f && h.invalid, _.length > 0 && h["has-files"]), style: {
639
+ "--editor-max-height": `calc(${A * 1.25}em + (2 * var(--scale-8)))`,
640
+ "--editor-min-height": `calc(${L * 1.25}em + (2 * var(--scale-8)))`
641
+ }, children: /* @__PURE__ */ O(Vt, { contentEditable: null, extension: Be, children: [
642
+ !n && /* @__PURE__ */ o(ze, { onInlineImageRemove: Y, onFilesSelected: b || w ? (t) => {
643
+ W([..._, ...Array.from(t)]);
602
644
  } : void 0 }),
603
- /* @__PURE__ */ n("div", { className: lt(m.content, dt && m.dragging), children: /* @__PURE__ */ n(Qt, { contentEditable: /* @__PURE__ */ n(Gt, { ref: D, "aria-placeholder": G ?? "", ariaErrorMessage: C && _ ? q : void 0, ariaInvalid: C || void 0, ariaRequired: Z || void 0, placeholder: () => G ? /* @__PURE__ */ n("div", { className: m.placeholder, children: G }) : null }), ErrorBoundary: Zt }) }),
604
- !o && P && /* @__PURE__ */ n("div", { className: m.submit, children: /* @__PURE__ */ n(L, { "aria-label": ct, "data-cy": "toolbar-submit-button", disabled: l, icon: "PaperPlaneTilt", isLoading: Q, onClick: () => void nt(), variant: "primary", children: /* @__PURE__ */ n("span", { children: ct }) }) }),
605
- k.length > 0 && /* @__PURE__ */ n("div", { "aria-label": "Files to upload", className: m.files, role: "region", children: k.map((i, a) => /* @__PURE__ */ n(me, { deleteAccessibleLabel: `Remove ${i.name} from upload queue`, name: i.name, onDelete: () => v(k.filter((u, t) => t !== a)) }, `${i.name}-${i.size}-${i.lastModified}-${a}`)) }),
606
- s && /* @__PURE__ */ n(Kt, {}),
607
- r && /* @__PURE__ */ n(jt, { matchers: be }),
608
- /* @__PURE__ */ n(Yt, {}),
609
- x && /* @__PURE__ */ n(ge, { createImages: mt }),
610
- e !== void 0 && /* @__PURE__ */ n(We, { autofocus: s, content: e, lastEmittedContentRef: R }),
611
- /* @__PURE__ */ n(Vt, { validateUrl: Ct }),
612
- /* @__PURE__ */ n(Jt, {}),
613
- tt && /* @__PURE__ */ n(Xt, { onChange: (i, a) => {
614
- i.read(() => {
615
- const u = $t(a, null), t = wt(u, {
645
+ /* @__PURE__ */ o("div", { className: nt(h.content, T && h.dragging), children: /* @__PURE__ */ o(te, { contentEditable: /* @__PURE__ */ o(Zt, { ref: q, "aria-placeholder": G ?? "", ariaErrorMessage: f && g ? M : void 0, ariaInvalid: f || void 0, ariaRequired: Z || void 0, placeholder: () => G ? /* @__PURE__ */ o("div", { className: h.placeholder, children: G }) : null }), ErrorBoundary: qt }) }),
646
+ !n && l && /* @__PURE__ */ o("div", { className: h.submit, children: /* @__PURE__ */ o(N, { "aria-label": z, "data-cy": "toolbar-submit-button", disabled: c, icon: "PaperPlaneTilt", isLoading: $, onClick: () => void gt(), variant: "primary", children: /* @__PURE__ */ o("span", { children: z }) }) }),
647
+ _.length > 0 && /* @__PURE__ */ o("div", { "aria-label": "Files to upload", className: h.files, role: "region", children: _.map((t, a) => /* @__PURE__ */ o(ue, { deleteAccessibleLabel: `Remove ${t.name} from upload queue`, name: t.name, onDelete: () => W(_.filter((d, D) => D !== a)) }, `${t.name}-${t.size}-${t.lastModified}-${a}`)) }),
648
+ s && /* @__PURE__ */ o(jt, {}),
649
+ r && /* @__PURE__ */ o(Gt, { matchers: $e }),
650
+ /* @__PURE__ */ o(Xt, {}),
651
+ i && /* @__PURE__ */ o(Te, { createImages: et, onRemove: Y }),
652
+ e !== void 0 && /* @__PURE__ */ o(He, { autofocus: s, content: e, lastEmittedContentRef: Q }),
653
+ /* @__PURE__ */ o(Yt, { validateUrl: It }),
654
+ /* @__PURE__ */ o(Jt, {}),
655
+ S && /* @__PURE__ */ o(Qt, { onChange: (t, a) => {
656
+ t.read(() => {
657
+ const d = $t(a, null), D = vt(d, {
616
658
  allowedAttributes: {
617
- ...wt.defaults.allowedAttributes,
618
- img: [...wt.defaults.allowedAttributes.img ?? [], "data-solibo-document-id", "data-solibo-document-slot"]
659
+ ...vt.defaults.allowedAttributes,
660
+ img: [...vt.defaults.allowedAttributes.img ?? [], "data-solibo-document-id", "data-solibo-document-slot"]
619
661
  },
620
662
  allowedTags: ["a", "b", "br", "i", "img", "li", "ol", "p", "u", "ul"]
621
663
  });
622
- R.current = t, tt(t);
664
+ Q.current = D, S(D);
623
665
  });
624
666
  } })
625
667
  ] }) }),
626
- C && _ && /* @__PURE__ */ n("div", { className: m.error, id: q, children: _ })
668
+ f && g && /* @__PURE__ */ o("div", { className: h.error, id: M, children: g })
627
669
  ] });
628
670
  };
629
671
  export {
630
- fr as Editor
672
+ gr as Editor
631
673
  };
package/dist/tokens.json CHANGED
@@ -363,7 +363,7 @@
363
363
  },
364
364
  "com.solibo": {
365
365
  "packageName": "@solibo/solibo-ui",
366
- "packageVersion": "2.2.9"
366
+ "packageVersion": "2.2.10"
367
367
  }
368
368
  },
369
369
  "$name": "TEST Solibo UI Tokens (Copy)",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solibo/solibo-ui",
3
- "version": "2.2.9",
3
+ "version": "2.2.10",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "./dist/index.js",