@mrakomor/core 0.0.11 → 0.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blockChrome.mjs +2 -2
- package/dist/blockInsertMenu.mjs +1 -1
- package/dist/chunk-2C6UDFD4.mjs +1 -0
- package/dist/chunk-5HWTMPF4.mjs +2 -0
- package/dist/{chunk-NR2BAMSW.mjs → chunk-6CG6EGQM.mjs} +2 -2
- package/dist/{chunk-K2DMHAUD.mjs → chunk-7CJLTNHZ.mjs} +1 -1
- package/dist/chunk-ERNLRJPB.mjs +1 -0
- package/dist/chunk-EXDY5TZH.mjs +1 -0
- package/dist/chunk-FAXIFXQK.mjs +4 -0
- package/dist/{chunk-2VURZA2E.mjs → chunk-GDDVUIEH.mjs} +1 -1
- package/dist/{chunk-VYTSZ4S6.mjs → chunk-JVQ2YGII.mjs} +1 -1
- package/dist/{chunk-SCFD3XBH.mjs → chunk-P7TUN2KD.mjs} +1 -1
- package/dist/chunk-S2W6LYHT.mjs +1 -0
- package/dist/chunk-TL5BHWDU.mjs +2 -0
- package/dist/chunk-ZHOZPQZH.mjs +1 -0
- package/dist/clipboard.cjs +3 -3
- package/dist/clipboard.mjs +3 -3
- package/dist/footer.cjs +2 -2
- package/dist/footer.mjs +2 -2
- package/dist/headline.cjs +2 -2
- package/dist/headline.mjs +1 -1
- package/dist/help.mjs +2 -2
- package/dist/index.cjs +6 -6
- package/dist/index.mjs +4 -4
- package/dist/link.mjs +2 -2
- package/dist/list.cjs +3 -3
- package/dist/list.mjs +1 -1
- package/dist/paragraph.cjs +2 -2
- package/dist/paragraph.mjs +1 -1
- package/dist/slashCommand.cjs +2 -2
- package/dist/slashCommand.mjs +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.mjs +2 -2
- package/dist/tts.cjs +8 -8
- package/dist/tts.mjs +3 -3
- package/dist/types/Mrakomor.d.mts +230 -0
- package/dist/types/component/AbstractComponent.d.mts +69 -0
- package/dist/types/component/Editor.d.mts +8 -0
- package/dist/types/component/block/BlockComponent.d.mts +105 -0
- package/dist/types/component/block/BlockRegister.d.mts +29 -0
- package/dist/types/component/block/ExternalComponent.d.mts +42 -0
- package/dist/types/component/block/UnknownComponent.d.mts +3 -0
- package/dist/types/component/block/blockItemEquals.d.mts +6 -0
- package/dist/types/component/block/helpers.d.mts +319 -0
- package/dist/types/component/editorContext.d.mts +4 -0
- package/dist/types/component/entityRange/EntityRangeElement.d.mts +15 -0
- package/dist/types/component/inlineStyle/Bold.d.mts +4 -0
- package/dist/types/component/inlineStyle/InlineElement.d.mts +10 -0
- package/dist/types/component/inlineStyle/Italic.d.mts +4 -0
- package/dist/types/component/inlineStyle/Subscript.d.mts +4 -0
- package/dist/types/component/inlineStyle/Superscript.d.mts +4 -0
- package/dist/types/component/inlineStyle/Underline.d.mts +4 -0
- package/dist/types/component/inlineStyle/index.d.mts +5 -0
- package/dist/types/component/overlayMount.d.mts +46 -0
- package/dist/types/dom.d.mts +161 -0
- package/dist/types/emitter.d.mts +38 -0
- package/dist/types/index.d.mts +7 -0
- package/dist/types/namespaces.d.mts +17 -0
- package/dist/types/plugin/blockChrome/BlockChrome.d.mts +11 -0
- package/dist/types/plugin/blockChrome/index.d.mts +1 -0
- package/dist/types/plugin/blockInsertMenu/BlockInsertMenu.d.mts +6 -0
- package/dist/types/plugin/blockInsertMenu/index.d.mts +1 -0
- package/dist/types/plugin/clipboard/clipboardHelpers.d.mts +151 -0
- package/dist/types/plugin/clipboard/clipboardPlugin.d.mts +6 -0
- package/dist/types/plugin/clipboard/index.d.mts +1 -0
- package/dist/types/plugin/default/defaultMrakomorPlugin.d.mts +21 -0
- package/dist/types/plugin/dialog/Dialog.d.mts +23 -0
- package/dist/types/plugin/footer/footerPlugin.d.mts +7 -0
- package/dist/types/plugin/footer/index.d.mts +1 -0
- package/dist/types/plugin/headline/Headline.d.mts +29 -0
- package/dist/types/plugin/headline/index.d.mts +1 -0
- package/dist/types/plugin/help/HelpRegister.d.mts +15 -0
- package/dist/types/plugin/help/helpPlugin.d.mts +26 -0
- package/dist/types/plugin/help/helpSchema.d.mts +11 -0
- package/dist/types/plugin/help/index.d.mts +1 -0
- package/dist/types/plugin/linkEntity/LinkEntity.d.mts +37 -0
- package/dist/types/plugin/linkEntity/index.d.mts +1 -0
- package/dist/types/plugin/list/List.d.mts +61 -0
- package/dist/types/plugin/list/index.d.mts +1 -0
- package/dist/types/plugin/list/listHelpers.d.mts +166 -0
- package/dist/types/plugin/menu/Menu.d.mts +22 -0
- package/dist/types/plugin/menu/menuPlugin.d.mts +6 -0
- package/dist/types/plugin/paragraph/Paragraph.d.mts +16 -0
- package/dist/types/plugin/paragraph/index.d.mts +1 -0
- package/dist/types/plugin/slashCommand/SlashActionRegister.d.mts +12 -0
- package/dist/types/plugin/slashCommand/index.d.mts +1 -0
- package/dist/types/plugin/slashCommand/slashActionSchema.d.mts +29 -0
- package/dist/types/plugin/slashCommand/slashCommandHelpers.d.mts +77 -0
- package/dist/types/plugin/slashCommand/slashCommandPlugin.d.mts +11 -0
- package/dist/types/plugin/slashCommand/slashHelp.d.mts +12 -0
- package/dist/types/plugin/tooltip/Tooltip.d.mts +16 -0
- package/dist/types/plugin/tooltip/index.d.mts +1 -0
- package/dist/types/plugin/tts/TtsHeadline.d.mts +27 -0
- package/dist/types/plugin/tts/TtsList.d.mts +19 -0
- package/dist/types/plugin/tts/TtsParagraph.d.mts +9 -0
- package/dist/types/plugin/tts/TtsVoice.d.mts +52 -0
- package/dist/types/plugin/tts/index.d.mts +4 -0
- package/dist/types/register/Register.d.mts +50 -0
- package/dist/types/register/sortRegisterEntries.d.mts +7 -0
- package/dist/types/schema/blockContent.d.mts +34 -0
- package/dist/types/schema/blockRegister.d.mts +14 -0
- package/dist/types/schema/config.d.mts +6 -0
- package/dist/types/types.d.mts +636 -0
- package/package.json +35 -22
- package/dist/chunk-5VPYPKGA.mjs +0 -1
- package/dist/chunk-BCE45I7Q.mjs +0 -2
- package/dist/chunk-N4I2WZWF.mjs +0 -1
- package/dist/chunk-T7OO472O.mjs +0 -1
- package/dist/chunk-WQWE5UCN.mjs +0 -1
- package/dist/chunk-YO4ZA6PJ.mjs +0 -2
- package/dist/chunk-ZDMD7SRT.mjs +0 -4
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {a as a$
|
|
2
|
-
`,document.head.appendChild(e);}}})();var I=class extends p{static get nodeName(){return "span"}static get style(){return "SPAN"}static match(t){return t.nodeName===this.nodeName.toUpperCase()||t.style===this.style}getState(){return {style:this.constructor.style}}render(){return o(this.constructor.nodeName,{},this.props.children)}};var w=class extends I{static get nodeName(){return "b"}static get style(){return "BOLD"}static get LABEL(){return o("b",{},"B")}static match(t){return t.nodeName==="strong"?true:super.match(t)}};var P=class extends I{static get nodeName(){return "i"}static get style(){return "ITALIC"}static get LABEL(){return o("i",{},"I")}};var U=class extends I{static get nodeName(){return "sub"}static get style(){return "SUBSCRIPT"}static get LABEL(){return o("sub",{},"Sub")}};var K=class extends I{static get nodeName(){return "sup"}static get style(){return "SUPERSCRIPT"}static get LABEL(){return o("sup",{},"Sup")}};var z=class extends I{static get nodeName(){return "u"}static get style(){return "UNDERLINE"}static get LABEL(){return o("u",{},"U")}};var Ft=a.object({component:a.function(),id:a.string(),label:a.string(),keywords:a.array(a.string()),group:a.string(),order:a.number().default(({context:n})=>n?.index??0),settings:a.any().optional()});function qt(n,t){let e=`block:${n}`;return t?.style==="UNORDERED"?`${e}:ul`:t?.style==="ORDERED"?`${e}:ol`:e}function Kt(n,t=0){let e=typeof n=="function",o=e?n:n?.component,r=e?{}:n,s=o.NAMESPACE??"",i=s.split(".").pop()||s,m=r.label||o.LABEL||i||s,u=Array.isArray(o.KEYWORDS)?o.KEYWORDS:[],a=r.keywords?.length?r.keywords.map(String):u.length?u.map(String):[m,i].filter(Boolean).map(String),g=r.settings;return Ft.parse({component:o,id:r.id||qt(s,g),label:String(m),keywords:a,group:String(r.group||o.GROUP||"blocks"),...typeof r.order=="number"?{order:r.order}:{},...g?{settings:g}:{}},{context:{index:t}})}var Z=class n extends a$6{#n=null;constructor(t){super(t),this.subscribe(()=>{this.#n=null;});}normalize(t,e){if(t==null)return null;try{return Kt(t,e)}catch{return null}}getByNamespace(t){return this.#o().get(t)}#o(){return this.#n??=n.buildNamespaceMap(this.list()),this.#n}static buildNamespaceMap(t){let e=new Map;for(let o of t){let r=o.component?.NAMESPACE;r&&!e.has(r)&&e.set(r,o.component);}return e}};var M=class n extends a$4{static get NAMESPACE(){return c$1}static getStateSchema(t){return a.object({component:a.string().default(n.NAMESPACE),componentId:a.string().default(t?.getAttribute("data-componentid")||a$3()),properties:a.object({}).default({}),settings:a.object({}).default({})}).default({})}constructor(t){super(t),this.root=null;}getState(){return this.state.peek()}isAtomic(){return true}static appendExchangeState(){return null}onMount(){}onUnmount(){}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-");return o("div",{className:t,contentEditable:false,style:"position: relative;",$ref:o=>{this.element=o;},"data-state":()=>JSON.stringify(this.state.get()),"data-componentid":this.state.peek().componentId},[o("div",{$ref:o=>{this.root=o;},style:"display: block;",contentEditable:false}),o("span",{style:"position: absolute; bottom: 0; right: 0; width: 10px; height: 100%; outline: none;",contentEditable:true,[d$1]:true},document.createTextNode("\xA0"))])}onKeydown(t){t.key!=="Backspace"&&t.key!=="ArrowUp"&&t.key!=="ArrowDown"&&t.preventDefault(),y$1(this,t);}};var G=class extends M{static get NAMESPACE(){return d$2}onMount(){let t=o("div",{style:"user-select: none;",contentEditable:false},()=>`Unknown component: ${this.state.get().component}`);r(this.root,t);}onUnmount(){this.root.innerHTML="";}};function Vt(n,t){let e=n._getBlockElementByComponentId(t);return v(e)?.isStale?.()??false}function zt(n){return (t,e)=>{if(!h(t,e))return false;let o=e?.componentId??t?.componentId;return !(o&&Vt(n,o))}}function Gt({mrakomor:n}){let t=n.get(),e=zt(t);j$1(a$7,t);let o$1=f(r=>{t._setContentRoot(r??null);});return l$1(()=>{t._onMount();}),m(()=>{t._onUnmount();}),o("div",{id:t._id,className:"mrakomor-editor"},[o("div",{className:"mrakomor-editor-surface"},[o("div",{className:"mrakomor-tools-container"}),o("div",{className:"mrakomor-content",contentEditable:true,style:{spellcheck:true,outline:"none"},$ref:o$1},[q(()=>t._getContentState(),r=>r.componentId,(r,s)=>o(()=>{let i;l$1(()=>{i.getNodeComponent=()=>{let a=u(i);return a?g(a):null},t._setBlockElement(i,s);}),m(()=>{t._removeBlockElement(i);});let m$1=t.resolveComponent(r.get().component,r),u$1=t.wrapBlockElement(m$1);return o("div",{className:"mrakomor-block-element",[b$2]:true,$ref:a=>{i=a;}},u$1)}),{equals:e})])])])}function tt(n,t,e){let o=n._getBlockElementIndex(t);if(o===-1)return false;let r=n.getContent();return r.splice(o,1,n.normalizeComponentState(e)),n._setContentState(r),true}function Xt(n$1){let{mrakomor:t}=n$1,{blockElement:e$1,range:o,newLineState:r,originalLineState:s,namespace:i,position:m,cursor:u}=n$1,a,g;if(m||(e$1?a=t._getBlockElementIndex(e$1):o&&(a=t._getBlockElementIndex(e(o))),a===void 0||a===-1))return;g=a+1;let f=t.getContent();s&&f.splice(a,1,t.normalizeComponentState(s)),r&&(r.component=i,f.splice(g,0,t.normalizeComponentState(r))),t._setContentState(f),n(()=>{typeof u=="number"&&v(t._getBlockElements()[g])?.setCursor?.(u);});}function Jt(n$1){let{mrakomor:t}=n$1,{blockElement:e$1,range:o,blocks:r,cursor:s,cursorBlockIndex:i=0}=n$1;if(!Array.isArray(r)||r.length===0)return;let m=e$1??(o?e(o):null),u$1=t._getBlockElementIndex(m);if(u$1===-1)return;let a=[...t._getContentState()];a.splice(u$1,1,...r.map(g=>t.normalizeComponentState(g))),t._setContentState(a),n(()=>{if(typeof s!="number")return;t._syncBlockElementsFromDom();let g=u(t._getBlockElements()[u$1+i]);g?.isConnected&&t$1(g,s);});}function Qt(n){let{mrakomor:t,blockElement:e,namespace:o}=n,r=t._getBlockElementState(e);if(!r)return;let s=t.register.blocks.getByNamespace(r.component),i=t.register.blocks.getByNamespace(o),m=(n.exchangeState&&k$1(n.exchangeState))??s?.toExchangeState?.(r)??k$1({properties:r.properties,settings:r.settings}),u=i?.fromExchangeState?.(m)??m;tt(t,e,{...u,component:o,componentId:a$3()});}function Zt(n){let{mrakomor:t,blockElement:e,targetIndex:o}=n,r=t._getBlockElementIndex(e);if(r===-1||typeof o!="number")return;let s=o>r?o-1:o;if(s===r)return;let i=[...t._getContentState()],[m]=i.splice(r,1);i.splice(s,0,m),t._setContentState(i);}function te(n$1){let{mrakomor:t,blockElement:e$1,range:o}=n$1,r=t._getBlockElementIndex(e$1);if(r!==-1){let s=t.getContent();s.splice(r,1),t._setContentState(s);}n(()=>{let s=e(o);t$1(u(s),0);});}function ee(n){let{mrakomor:t,state:e,blockElement:o}=n,r=t._getBlockElementState(o);if(!r)return;let s=structuredClone(r),i=e?.offset,m=e?.length,u=e?.entity?.type;s.properties.entityRanges=(s.properties.entityRanges??[]).filter(a=>!(a?.offset===i&&a?.length===m&&a?.entity?.type===u)),tt(t,o,s),t.command.closeDialog?.();}function ne(n){let{mrakomor:t,namespace:e$1,state:o}=n,r=n.range??k(),s=n.blockElement??e(r),i=o$2(t,s,r);if(!i||i.item.entityRanges===void 0)return;let{Constructor:m,current:u,element:a,itemIndex:g,item:f}=i,h=C(f.entityRanges,a,r,{namespace:e$1,entityData:o});if(h===null)return;let k$1=n$1(m,u,g,{entityRanges:h});tt(t,s,k$1);}function oe(n){let{mrakomor:t,style:e$1}=n,o=n.range??k(),r=n.blockElement??e(o),s=o$2(t,r,o);if(!s||s.item.inlineStyleRanges===void 0)return;let{Constructor:i,current:m,element:u,itemIndex:a,item:g}=s,f=B(g.inlineStyleRanges,u,o,e$1);if(f===null)return;let h=n$1(i,m,a,{inlineStyleRanges:f});tt(t,r,h);}function re(n$1){let{mrakomor:t,blockElement:e,previousBlockElement:o}=n$1,r=t._getBlockElementIndex(o),s=t._getBlockElementIndex(e);if(r===-1||s===-1)return;let i=t.getContent(),m=i[s],u$1=i[r],a=t.register.blocks.getByNamespace(u$1.component),g=t.register.blocks.getByNamespace(m.component),f=(n$1.exchangeState&&k$1(n$1.exchangeState))??g?.toExchangeState?.(m)??k$1({properties:m.properties,settings:m.settings}),h=a?.appendExchangeState?.(u$1,f);if(!h)return;i.splice(s,1),i.splice(r,1,t.normalizeComponentState(h.state)),t._setContentState(i);let k=()=>{if(typeof h.cursor!="number")return;let x=t._getBlockElements()[r]??o,B=v(x);if(B?.setCursor){B.setCursor(h.cursor);return}let _=u(x);_?.isConnected&&t$1(_,h.cursor);};k(),n(k);}function se(n){let{mrakomor:t}=n,e=t.getRoot();if(n.relatedTarget instanceof Node&&e.contains(n.relatedTarget))return;let[r,s]=a$5(()=>[t.getContent(),t._getContentState()]);r.length===s.length&&r.every((m,u)=>m===s[u])||t.setContent(r);}function ie(n){let t=k();return e(t)?.getNodeComponent?.()?.classInstance?.onKeydown?.(n)}function ce(n){v(n)?.setCursor?.();}function ae(n$1){if(n$1.key!=="Backspace")return;let{mrakomor:t}=n$1,e$1=k();if(!e$1)return;let o=e(e$1);if(!o)return;let r=w$1(o),s=o?.previousSibling,m=w$1(s)?.childNodes?.[0]?.contentEditable==="true",u$1=r?.childNodes?.[0]?.contentEditable==="true",a=u(o),g=!j(a?.textContent),f=e$1.collapsed&&(e$1.startOffset===0||l()===0||g);if(!e$1.collapsed){let p=r$1(e$1);if(p&&p.startBlock!==p.endBlock){let E=t._getBlockElementIndex(p.startBlock),S=t._getBlockElementIndex(p.endBlock),b=t.getContent(),O=E>=0?b[E]:void 0,D=S>=0?b[S]:void 0;if(E>=0&&S>E&&typeof O?.properties?.text=="string"&&typeof D?.properties?.text=="string"){n$1.preventDefault();let{content:jt,cursor:ft,resultIndex:Wt}=v$1(b,{startIndex:E,endIndex:S,startOffset:p.startOffset,endOffset:p.endOffset});t._setContentState(jt.map(F=>t.normalizeComponentState(F))),n(()=>{let F=t._getBlockElements()[Wt];F&&typeof ft=="number"&&t$1(u(F),ft);});}}return}if(!f)return;let h=t._getBlockElementIndex(o),k$1=s?t._getBlockElementIndex(s):-1,x=t._getBlockElementState(o),B=t._getBlockElementState(s),_=s?v(s):null;if(!s||k$1<0){n$1.preventDefault();return}if(B&&x&&p$1(x)&&_&&!_.isAtomic?.()){if(g&&!p$1(B)){n$1.preventDefault();let p=t.getContent();p.splice(h,1),t._setContentState(p),ce(s);return}n$1.preventDefault(),t.command.mergeBlockElement({blockElement:o,previousBlockElement:s,range:e$1});return}_?.isAtomic?.()&&(!m&&e$1.startOffset===0||o?.textContent==="\xA0"&&!u$1)&&(n$1.preventDefault(),t.command.removeBlockElement({blockElement:s,range:e$1})),x&&!p$1(x)&&n$1.preventDefault();}function et(n){return {resolveComponent:t=>t===M.NAMESPACE?M:G,registerCommands(t){t.emitter.on(a$1.INSERT_BLOCK_ELEMENT,b(Xt)),t.emitter.on(a$1.REPLACE_BLOCK_ELEMENT,b(Jt)),t.emitter.on(a$1.TRANSFORM_BLOCK_ELEMENT,b(Qt)),t.emitter.on(a$1.MOVE_BLOCK_ELEMENT,b(Zt)),t.emitter.on(a$1.REMOVE_BLOCK_ELEMENT,b(te)),t.emitter.on(a$1.REMOVE_ENTITY_RANGE,b(ee)),t.emitter.on(a$1.INSERT_ENTITY_RANGE,b(ne)),t.emitter.on(a$1.INSERT_INLINE_STYLE_RANGE,b(oe)),t.emitter.on(a$1.MERGE_BLOCK_ELEMENT,b(re));},registerHandlers(t){t.emitter.on(a$1.FOCUSOUT,se),t.emitter.on(a$1.KEYDOWN,b(ie)),t.emitter.on(a$1.KEYDOWN,b(ae));},registerListeners(t){let e=t.getRoot(),{signal:o}=t.listenerAbortController;e.addEventListener("keydown",r=>t.emitDomEvent(a$1.KEYDOWN,r),{signal:o}),e.addEventListener("beforeinput",r=>t.emitDomEvent(a$1.BEFORE_INPUT,r),{signal:o}),e.addEventListener("input",r=>t.emitDomEvent(a$1.INPUT,r),{signal:o}),e.addEventListener("focusin",r=>t.emitDomEvent(a$1.FOCUSIN,r),{signal:o}),e.addEventListener("focusout",r=>t.emitDomEvent(a$1.FOCUSOUT,r),{signal:o}),e.addEventListener("click",r=>t.emitDomEvent(a$1.CLICK,r),{signal:o}),document.addEventListener("selectionchange",r=>t.emitDomEvent(a$1.SELECTION_CHANGE,r),{signal:o});}}}(function(){if(!(typeof document>"u")){var n="mrakomor/core/plugin/dialog/Dialog.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(o){return o.getAttribute("data-mrakomor-css-path")===n});if(!t){var e=document.createElement("style");e.setAttribute("data-mrakomor-css",""),e.setAttribute("data-mrakomor-css-path",n),e.textContent=`.mrakomor-dialog-container,.mrakomor-dialog-backdrop{pointer-events:all}.dialog[open]{background-color:#fff;border:1px solid black;border-radius:8px;box-shadow:0 0 5px #0000001a;padding:12px;display:flex;flex-flow:row wrap;justify-content:space-between}.dialog[open] .dialog-controls{text-align:right;width:100%}.dialog[open] .dialog-button-close{background-color:#f0f0f0;border:1px solid black;border-radius:4px;color:#000;cursor:pointer;display:inline-block;font-size:14px;margin-right:1px;padding:4px 8px;text-align:center}.dialog[open] .dialog-container{width:100%}
|
|
3
|
-
`,document.head.appendChild(e);}}})();var
|
|
4
|
-
`,document.head.appendChild(e);}}})();function
|
|
1
|
+
import {a as a$5,c as c$3}from'./chunk-EXDY5TZH.mjs';import {a as a$4,c as c$2}from'./chunk-S2W6LYHT.mjs';export{c as defaultMrakomorPlugin}from'./chunk-S2W6LYHT.mjs';import'./chunk-GDDVUIEH.mjs';import {a as a$6}from'./chunk-ZHOZPQZH.mjs';import {a}from'./chunk-P7IKAZYZ.mjs';import {a as a$1}from'./chunk-ERNLRJPB.mjs';import'./chunk-FAXIFXQK.mjs';import {a as a$2,c as c$1}from'./chunk-B6JJAATK.mjs';export{a as EVENT}from'./chunk-B6JJAATK.mjs';import {y,x,a as a$3,v,o as o$1,u as u$1,b}from'./chunk-P7TUN2KD.mjs';import {p,c,u,e,g,o,s,t,q as q$1,k,m,n,r,h,i}from'./chunk-7CJLTNHZ.mjs';(function(){if(!(typeof document>"u")){var o="mrakomor/core/style/core.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(n){return n.getAttribute("data-mrakomor-css-path")===o});if(!t){var e=document.createElement("style");e.setAttribute("data-mrakomor-css",""),e.setAttribute("data-mrakomor-css-path",o),e.textContent=`.namespace-unknown-unknowncomponent{background-color:#f0f0f0;padding:12px 0;margin-bottom:8px}.mrakomor-editor:focus-visible{outline:none}.mrakomor-editor{display:flex;flex-direction:column;height:100%;min-height:0}.mrakomor-editor-surface{position:relative;flex:1 1 auto;min-height:0}.mrakomor-tools-container{position:absolute;inset:0;pointer-events:none;z-index:4}.mrakomor-content{position:relative;height:100%;min-height:0;overflow-y:auto}.mrakomor-content:focus-visible{outline:none}
|
|
2
|
+
`,document.head.appendChild(e);}}})();var E=class extends q$1{static get nodeName(){return "span"}static get style(){return "SPAN"}static match(t){return t.nodeName===this.nodeName.toUpperCase()||t.style===this.style}getState(){return {style:this.constructor.style}}render(){return p(this.constructor.nodeName,{},this.props.children)}};var B=class extends E{static get nodeName(){return "b"}static get style(){return "BOLD"}static get LABEL(){return p("b",{},"B")}static match(t){return t.nodeName==="strong"?true:super.match(t)}};var w=class extends E{static get nodeName(){return "i"}static get style(){return "ITALIC"}static get LABEL(){return p("i",{},"I")}};var L=class extends E{static get nodeName(){return "sub"}static get style(){return "SUBSCRIPT"}static get LABEL(){return p("sub",{},"Sub")}};var R=class extends E{static get nodeName(){return "sup"}static get style(){return "SUPERSCRIPT"}static get LABEL(){return p("sup",{},"Sup")}};var O=class extends E{static get nodeName(){return "u"}static get style(){return "UNDERLINE"}static get LABEL(){return p("u",{},"U")}};var xt=a.object({component:a.function(),id:a.string(),label:a.string(),keywords:a.array(a.string()),group:a.string(),order:a.number().default(({context:o})=>o?.index??0),settings:a.any().optional()});function yt(o,t){let e=`block:${o}`;return t?.style==="UNORDERED"?`${e}:ul`:t?.style==="ORDERED"?`${e}:ol`:e}function dt(o,t=0){let e=typeof o=="function",n=e?o:o?.component,r=e?{}:o,c=n.NAMESPACE??"",l=c.split(".").pop()||c,h=r.label||n.LABEL||l||c,d=Array.isArray(n.KEYWORDS)?n.KEYWORDS:[],p=r.keywords?.length?r.keywords.map(String):d.length?d.map(String):[h,l].filter(Boolean).map(String),b=r.settings;return xt.parse({component:n,id:r.id||yt(c,b),label:String(h),keywords:p,group:String(r.group||n.GROUP||"blocks"),...typeof r.order=="number"?{order:r.order}:{},...b?{settings:b}:{}},{context:{index:t}})}var G=class o extends a$5{#o=null;constructor(t){super(t),this.subscribe(()=>{this.#o=null;});}normalize(t,e){if(t==null)return null;try{return dt(t,e)}catch{return null}}getByNamespace(t){return this.#n().get(t)}#n(){return this.#o??=o.buildNamespaceMap(this.list()),this.#o}static buildNamespaceMap(t){let e=new Map;for(let n of t){let r=n.component?.NAMESPACE;r&&!e.has(r)&&e.set(r,n.component);}return e}};function Ct(o,t){let e=o._getBlockElementByComponentId(t);return v(e)?.isStale?.()??false}function ft(o){return (t,e)=>{if(!i(t,e))return false;let n=e?.componentId??t?.componentId;return !(n&&Ct(o,n))}}function gt({mrakomor:o}){let t=o.get(),e=ft(t);k(a$6,t);let n$1=g(r=>{t._setContentRoot(r??null);});return m(()=>{t._onMount();}),n(()=>{t._onUnmount();}),p("div",{id:t._id,className:"mrakomor-editor"},[p("div",{className:"mrakomor-editor-surface"},[p("div",{className:"mrakomor-tools-container"}),p("div",{className:"mrakomor-content",contentEditable:true,style:{spellcheck:true,outline:"none"},$ref:n$1},[r(()=>t._getContentState(),r=>r.componentId,(r,c)=>p(()=>{let l;m(()=>{l.getNodeComponent=()=>{let p=u$1(l);return p?h(p):null},t._setBlockElement(l,c);}),n(()=>{t._removeBlockElement(l);});let h$1=t.resolveComponent(r.get().component,r),d=t.wrapBlockElement(h$1);return p("div",{className:"mrakomor-block-element",[b]:true,$ref:p=>{l=p;}},d)}),{equals:e})])])])}(function(){if(!(typeof document>"u")){var o="mrakomor/core/plugin/dialog/Dialog.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(n){return n.getAttribute("data-mrakomor-css-path")===o});if(!t){var e=document.createElement("style");e.setAttribute("data-mrakomor-css",""),e.setAttribute("data-mrakomor-css-path",o),e.textContent=`.mrakomor-dialog-container,.mrakomor-dialog-backdrop{pointer-events:all}.dialog[open]{background-color:#fff;border:1px solid black;border-radius:8px;box-shadow:0 0 5px #0000001a;padding:12px;display:flex;flex-flow:row wrap;justify-content:space-between}.dialog[open] .dialog-controls{text-align:right;width:100%}.dialog[open] .dialog-button-close{background-color:#f0f0f0;border:1px solid black;border-radius:4px;color:#000;cursor:pointer;display:inline-block;font-size:14px;margin-right:1px;padding:4px 8px;text-align:center}.dialog[open] .dialog-container{width:100%}
|
|
3
|
+
`,document.head.appendChild(e);}}})();var ht="mrakomor.dialog.Dialog";function H({open:o,placement:t,positionX:e,positionY:n,block:r,dialogRef:c$1}){let l=c(()=>{let d=t.get()==="center";return {position:"absolute",zIndex:d?"9100":"9000",top:`${n.get()}px`,left:`${e.get()}px`,...d?{padding:0,background:"transparent",border:"none",boxShadow:"none",minWidth:0}:{background:"#fff",border:"1px solid #ccc",borderRadius:"4px",padding:"8px 10px",boxShadow:"0 2px 8px rgba(0,0,0,.15)",minWidth:"220px"}}}),h=c(()=>({position:"absolute",inset:"0",zIndex:"9050",background:"rgba(15, 23, 42, 0.28)",pointerEvents:"all"}));return p("span",{style:{display:"contents"}},[u(()=>o.get()&&t.get()==="center",p("div",{className:"mrakomor-dialog-backdrop",contentEditable:false,style:h})),u(()=>o.get(),p("div",{className:"mrakomor-dialog-container",contenteditable:false,style:l,$ref:c$1},()=>r.get()))])}H.NAMESPACE=ht;function q({mrakomor:o$2}){let t=null,e$1=e(false),n=e(false),r=e("anchor"),c=e(0),l=e(0),h=e(null),d=g(null),p$1=g(null);function b(){n.set(false),r.set("anchor"),o$1(),d.set(null),o(()=>{e$1.set(false);});}return {resolveComponent(f){if(f===ht)return H},registerEvents(){a$2.OPEN_DIALOG="mrakomor:open-dialog",a$2.CLOSE_DIALOG="mrakomor:close-dialog";},registerCommands(f){f.command.openDialog=(x,k)=>{f.emit(a$2.OPEN_DIALOG,{...x,options:k});},f.command.closeDialog=()=>{f.emit(a$2.CLOSE_DIALOG);};},registerHandlers(){o$2.emitter.on(a$2.OPEN_DIALOG,({children:f,element:x$1,options:k={}})=>{h.set(f??p("div",{},"Empty dialog")),n.set(true),d.set(x$1??null),r.set(k.placement??"anchor"),o(()=>{let N=o$2.getRoot(),{x:I,y:v}=k.placement==="center"?y(N,p$1):x(N,x$1??{left:0,top:0},p$1);c.set(I),l.set(v),e$1.set(true);});}),o$2.emitter.on(a$2.CLOSE_DIALOG,b),o$2.emitter.on(a$2.KEYDOWN,f=>{f.key==="Escape"&&n.peek()===true&&o$2.command.closeDialog();}),o$2.emitter.on(a$2.CLICK,f=>{if(n.peek()!==true||e$1.peek()!==true)return;let x=f.target,k=p$1&&typeof p$1.contains=="function"&&p$1.contains(x),N=d&&typeof d.contains=="function"&&d.contains(x);!k&&!N&&o$2.command.closeDialog();});},onMount(){let{dispose:f}=a$1(o$2,"mrakomor-dialog-plugin-container",p(H,{open:n,placement:r,positionX:c,positionY:l,block:h,dialogRef:p$1}));t=f;},onUnmount(){t?.(),t=null;}}}var Y=class extends a$5{constructor(t){super(t,{sort:e=>e});}normalize(t){return c$3(t)}};(function(){if(!(typeof document>"u")){var o="mrakomor/core/plugin/menu/Menu.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(n){return n.getAttribute("data-mrakomor-css-path")===o});if(!t){var e=document.createElement("style");e.setAttribute("data-mrakomor-css",""),e.setAttribute("data-mrakomor-css-path",o),e.textContent=`.mrakomor-menu{position:absolute;z-index:9300;display:flex;flex-direction:column;gap:2px;min-width:160px;max-height:240px;overflow-y:auto;background:#1a1a1a;border-radius:6px;padding:4px;box-shadow:0 3px 10px #00000040;pointer-events:all}.mrakomor-menu__item{display:flex;align-items:center;width:100%;padding:6px 10px;border:none;border-radius:4px;background:transparent;color:#fff;cursor:pointer;font-size:13px;font-weight:600;text-align:left;transition:background .1s}.mrakomor-menu__item:hover,.mrakomor-menu__item--active{background:#ffffff26}.mrakomor-menu__empty{padding:6px 10px;font-size:13px;font-weight:600;color:#ffffff80}
|
|
4
|
+
`,document.head.appendChild(e);}}})();function St(o,t=-1){if(!o.length)return p("div",{className:"mrakomor-menu__empty",role:"presentation"},"No results");let e=o.map((n,r)=>p("button",{type:"button",role:"option",id:`mrakomor-menu-option-${n.id}`,className:["mrakomor-menu__item",r===t?"mrakomor-menu__item--active":""].filter(Boolean).join(" "),title:n.label,"data-id":n.id,"aria-selected":r===t?"true":"false",onMouseDown:c=>{c.preventDefault();}},n.label));return p("span",{style:"display: contents"},e)}function X({open:o,positionX:t,positionY:e,entries:n,highlightIndex:r,ariaLabel:c$1,menuRef:l}){let h=c(()=>({left:`${t.get()}px`,top:`${e.get()}px`}));return u(()=>o.get(),p("div",{className:"mrakomor-menu",role:"listbox","aria-label":()=>c$1.get(),contenteditable:false,style:h,$ref:l},()=>St(n.get(),r.get())))}function j({mrakomor:o$1}){let t=null,e$1=null,n=g(null),r=null,c=e(false),l=e(false),h=e(0),d=e(0),p$1=e([]),b=e(-1),f=e("Menu");function x$1(s){o(()=>{let u=o$1.getRoot();if(!u||!s)return;let C=n?.offsetHeight??200,y=u.getBoundingClientRect();if(s.top-y.top>C+8){let{x:_,y:bt}=x(u,s,{offsetHeight:C},4);h.set(_),d.set(bt);}else h.set(s.left-y.left),d.set(s.bottom-y.top+4);c.set(true);});}function k(){l.set(false),r=null,b.set(-1),p$1.set([]),o(()=>{c.set(false);});}function N(s){!s||!r||r(s);}function I(s){if(l.peek()!==true)return;let u=s.target?.closest?.(".mrakomor-menu__item");if(!u||!e$1?.contains(u))return;s.preventDefault(),s.stopPropagation();let C=u.getAttribute("data-id"),y=p$1.peek().find(D=>D.id===C);y&&N(y);}function v(s={}){let{entries:u=[],anchorRect:C,highlightIndex:y=-1,ariaLabel:D="Menu",onSelect:_=null}=s;p$1.set(u),b.set(y),f.set(D),_!==void 0&&(r=_),l.set(true),C?x$1(C):c.set(true);}return {registerEvents(){a$2.OPEN_MENU="mrakomor:open-menu",a$2.CLOSE_MENU="mrakomor:close-menu",a$2.UPDATE_MENU="mrakomor:update-menu";},registerCommands(s){s.command.openMenu=u=>{s.emit(a$2.OPEN_MENU,u);},s.command.updateMenu=u=>{s.emit(a$2.UPDATE_MENU,u);},s.command.closeMenu=()=>{s.emit(a$2.CLOSE_MENU);};},registerHandlers(){o$1.emitter.on(a$2.OPEN_MENU,v),o$1.emitter.on(a$2.UPDATE_MENU,v),o$1.emitter.on(a$2.CLOSE_MENU,k),o$1.emitter.on(a$2.CLICK,s=>{let u=n?.current??n;l.peek()===true&&c.peek()===true&&u&&typeof u.contains=="function"&&!u.contains(s.target)&&k();}),o$1.emitter.on(a$2.KEYDOWN,s=>{s.key==="Escape"&&l.peek()===true&&k();});},onMount(){let{container:s,dispose:u}=a$1(o$1,"mrakomor-menu-plugin-container",p(X,{open:l,positionX:h,positionY:d,entries:p$1,highlightIndex:b,ariaLabel:f,menuRef:n}));e$1=s,e$1?.addEventListener("click",I),t=u;},onUnmount(){e$1?.removeEventListener("click",I),t?.(),t=null,e$1=null,n.current=null,r=null;}}}function Nt(o){return o!=null&&typeof o=="object"&&(typeof Element>"u"?o.nodeType===1:o instanceof Element)}function kt(){return a.object({root:a.any().refine(Nt,{message:"root must be a DOM Element"}),id:a.string().optional(),debug:a.boolean().optional(),content:a.array(a.any()).optional(),plugins:a.array(a.function()).optional(),blockComponents:a.array(a.any().refine(o=>typeof o=="function"||o!=null&&typeof o=="object"&&typeof o.component=="function",{message:"blockComponents entry must be a constructor or registration"})).optional(),slashActions:a.array(a.any().refine(o=>o!=null&&typeof o=="object"&&typeof o.handler=="function",{message:"slashActions entry must include a handler function"})).optional(),inlineStyles:a.array(a.function()).optional(),entityRanges:a.array(a.function()).optional(),tooltip:a.any().optional()})}function Et(o){return [...o.filter(t=>t!==q&&t!==j&&t!==c$2),q,j,c$2]}function _t(o){kt().parse(o);let t={debug:false,content:[],plugins:[],blockComponents:[],slashActions:[],inlineStyles:[B,w,O,L,R],entityRanges:[],tooltip:{}},e={...t,...o,plugins:Et(o.plugins??t.plugins)},n=new W(e);return n._init(),n}var W=class{#o=a$3();#n;#i=null;#e=[];#t=[];#r;#s=false;listenerAbortController=new AbortController;#a=e([],{debug:"content"});#l=[];command;emitter;register;constructor(t){let{root:e,id:n,content:r}=t;this.#o=n||this.#o,this.#n=e,this.#l=r,this.#t=[],this.#r={...t,plugins:Et(t.plugins??[])},this.register={blocks:new G(this),help:new Y(this)};let{emitter:c,command:l}=c$1({mrakomor:this});this.command=l,this.emitter=c;}_init(){this.#u(),this.#a=e(this._normalizeContentState(this.#l),{debug:"content"});}#u(){this.#e=this.#r.plugins.map(t=>t?.({config:this.#r,root:this.#n,mrakomor:this}))??[],this.#r=this.#e.reduce((t,e)=>e?.resolveConfig?.(t)??t,this.#r),this.register.blocks.add(this.#r.blockComponents??[]),this.#e.forEach(t=>{t?.registerEvents?.(this);}),this.#e.forEach(t=>{t?.registerCommands?.(this);}),this.#e.forEach(t=>{this.emitter.on(a$2.KEYDOWN,e=>t?.onKeyDown?.(e));}),this.#e.forEach(t=>{t?.registerHandlers?.(this);}),this.#e.forEach(t=>{t?.registerListeners?.(this);});}emit(t,e={}){return this.emitter.emit(t,{...e,mrakomor:this})}on(t,e){return this.emitter.on(t,e)}onChangeContent(t){return this.on(a$2.CONTENT_CHANGE,t)}emitDomEvent(t,e){let{clipboardData:n,metaKey:r,altKey:c,code:l,ctrlKey:h,key:d,isComposing:p,repeat:b,button:f,shiftKey:x,which:k,detail:N,isTrusted:I,target:v,relatedTarget:s,data:u,inputType:C,clientX:y,clientY:D}=e??{},{defaultPrevented:_}=this.emit(t,{clipboardData:n,metaKey:r,altKey:c,code:l,ctrlKey:h,key:d,isComposing:p,repeat:b,button:f,shiftKey:x,which:k,detail:N,isTrusted:I,target:v,relatedTarget:s,data:u,inputType:C,clientX:y,clientY:D});return _&&e?.preventDefault?.(),_}getConfig(){return {...this.#r,blockComponents:this.register.blocks.list(),slashActions:this.register.slashActions?.list()??[]}}wrapBlockElement(t){for(let e of this.#e){let n=e.wrapBlockElement?.(t);if(n)return n}return t}getRoot(){return this.#n}_getContentRoot(){return this.#i}_setContentRoot(t){this.#i=t;}get _id(){return this.#o}getContent(){return this.#t.map(e=>v(e)?.getState())}setContent(t=[]){this._setContentState(this._normalizeContentState(t));}_syncBlockElementsFromDom(){let t=this.#i;t&&(this.#t=[...t.querySelectorAll(".mrakomor-block-element")]);}_getBlockElements(){return this.#t}_getContentState(){return this.#a.get()}_setContentState(t=[]){this.#a.set(t),this.emit(a$2.CONTENT_CHANGE,{content:t}),o(()=>{this._syncBlockElementsFromDom();});}_normalizeContentState(t=[]){return t.map(e=>{let n=this.normalizeComponentState(e);return n===void 0?void 0:structuredClone(n)}).filter(e=>e!==void 0)??[]}_setBlockElement(t,e=this.#t.length){this.#t.splice(e,0,t);}_removeBlockElement(t){this.#t=this.#t.filter(e=>e!==t);}#m(t){return v(t)?.state?.peek()?.componentId}#c(t){return t?this.#t.findIndex(e=>this.#m(e)===t):-1}_getBlockElementIndex(t){if(!t)return -1;let e=this.#t.indexOf(t);return e!==-1?e:this.#c(this.#m(t))}_getBlockElementByComponentId(t){let e=this.#c(t);return e===-1?null:this.#t[e]}_getBlockElementState(t){let e=this._getBlockElementIndex(t);if(e!==-1)return v(this.#t[e])?.getState()}mount(){let t=s(this.#n,p(gt,{mrakomor:this}));return this.#s=true,t}unmount(){this.#s&&(this.#s=false,t(this.#n));}_onUnmount(){this.listenerAbortController.abort(),this.#e.forEach(t=>{t?.onUnmount?.(this);}),this.emitter.removeAllListeners();}_onMount(){this.#e.forEach(t=>{t?.onMount?.(this);}),o(()=>{this._syncBlockElementsFromDom();});}resolveComponent(t,e){let n=this.resolveComponentConstructor(t);return n?p(n,{state:e}):p(a$4,{state:e})}resolveComponentConstructor(t){let e=this.register.blocks.getByNamespace(t);if(!e){for(let n of this.#e)if(e=n?.resolveComponent?.(t),e)break}return e}normalizeComponentState(t){if(t==null){console.warn("normalizeComponentState() received a nullish state; dropping it.");return}let e="component"in t?t.component:t.entity.type;return this.resolveComponentConstructor(e)?.getStateSchema()?.parse(t)}};export{B as Bold,H as Dialog,w as Italic,X as Menu,W as Mrakomor,L as Subscript,R as Superscript,O as Underline,_t as createMrakomor,q as dialogPlugin,j as menuPlugin};
|
package/dist/link.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {a as a$1}from'./chunk-
|
|
2
|
-
`,document.head.appendChild(t);}}})();var k=a.preprocess(r=>String(r??"").trim(),a.string().refine(r=>r===""||/^(?:https?:|mailto:)/i.test(r)||!/^[a-z][a-z0-9+.-]*:/i.test(r),{message:"Invalid link href"}).catch(""));function u(r){return k.parse(r)}var f='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';var b='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>';var i=class r extends a$1{static get nodeName(){return "a"}static get NAMESPACE(){return "atom.link.Link"}static getStateSchema(e){let t;if(e?.getAttribute("data-state"))try{t=JSON.parse(e.getAttribute("data-state"));}catch{}return b$1({type:r.NAMESPACE,data:a.object({href:a.string().default(t?.entity?.data?.href??e?.href??"").transform(a=>u(a)),target:a.string().default(t?.entity?.data?.target??e?.target??"")}).default({}),length:t?.length??0,offset:t?.offset??0}).default({})}constructor(e){super(e),this.input=
|
|
1
|
+
import {a as a$1}from'./chunk-2C6UDFD4.mjs';import {b as b$1}from'./chunk-JVQ2YGII.mjs';import'./chunk-ZHOZPQZH.mjs';import {a}from'./chunk-P7IKAZYZ.mjs';import {f as f$1,m}from'./chunk-P7TUN2KD.mjs';import {g,o,p}from'./chunk-7CJLTNHZ.mjs';(function(){if(!(typeof document>"u")){var r="mrakomor/core/plugin/linkEntity/LinkEntity.css",e=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(a){return a.getAttribute("data-mrakomor-css-path")===r});if(!e){var t=document.createElement("style");t.setAttribute("data-mrakomor-css",""),t.setAttribute("data-mrakomor-css-path",r),t.textContent=`.link-toolbar{display:flex;flex-direction:column;gap:6px}.link-toolbar__row{display:flex;align-items:center;gap:4px;min-width:0}.link-toolbar__sep{width:1px;height:18px;background:#e0e0e0;flex-shrink:0;margin:0 2px}.link-toolbar__btn{display:flex;align-items:center;justify-content:center;flex-shrink:0;background:none;border:none;cursor:pointer;padding:4px;border-radius:4px;color:#555}.link-toolbar__btn:hover{background:#f0f0f0;color:#222}.link-toolbar__btn--danger:hover{color:#d32f2f;background:#fdecea}
|
|
2
|
+
`,document.head.appendChild(t);}}})();var k=a.preprocess(r=>String(r??"").trim(),a.string().refine(r=>r===""||/^(?:https?:|mailto:)/i.test(r)||!/^[a-z][a-z0-9+.-]*:/i.test(r),{message:"Invalid link href"}).catch(""));function u(r){return k.parse(r)}var f='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"/><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"/></svg>';var b='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="3 6 5 6 21 6"/><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2"/></svg>';var i=class r extends a$1{static get nodeName(){return "a"}static get NAMESPACE(){return "atom.link.Link"}static getStateSchema(e){let t;if(e?.getAttribute("data-state"))try{t=JSON.parse(e.getAttribute("data-state"));}catch{}return b$1({type:r.NAMESPACE,data:a.object({href:a.string().default(t?.entity?.data?.href??e?.href??"").transform(a=>u(a)),target:a.string().default(t?.entity?.data?.target??e?.target??"")}).default({}),length:t?.length??0,offset:t?.offset??0}).default({})}constructor(e){super(e),this.input=g(t=>o(()=>{t.focus();}));}#e({entity:e,length:t,offset:a}){return p("div",{className:"link-toolbar"},[p("div",{className:"link-toolbar__row",style:{display:"flex"}},[p("button",{className:"link-toolbar__btn",title:"Copy URL",$dangerouslySetInnerHTML:f,onClick:()=>navigator.clipboard?.writeText(e.peek()?.data?.href??"")}),p("input",{type:"text",$ref:this.input,value:e.peek()?.data?.href??"",defaultValue:e.peek()?.data?.href??"",onKeyDown:o=>{o.key==="Enter"&&(o.preventDefault(),o.stopPropagation(),this.mrakomor.command.closeDialog());},onInput:o=>{let s=o.currentTarget.value;e.set({...e.peek(),data:{...e.peek()?.data,href:s}});}}),p("select",{value:e.peek()?.data?.target??"",onChange:o=>{e.set({...e.peek(),data:{...e.peek()?.data,target:o.currentTarget.value}});}},[p("option",{value:"",selected:e.peek()?.data?.target===""},""),p("option",{value:"_self",selected:e.peek()?.data?.target==="_self"},"_self"),p("option",{value:"_blank",selected:e.peek()?.data?.target==="_blank"},"_blank"),p("option",{value:"_parent",selected:e.peek()?.data?.target==="_parent"},"_parent"),p("option",{value:"_top",selected:e.peek()?.data?.target==="_top"},"_top")]),p("span",{className:"link-toolbar__sep"}),p("button",{className:"link-toolbar__btn link-toolbar__btn--danger",title:"Remove link",$dangerouslySetInnerHTML:b,onClick:()=>{this.mrakomor.command.removeEntityRange?.({state:{entity:e.peek(),length:t.peek(),offset:a.peek()},blockElement:f$1(this.element)});}})])])}onMount(){let{entity:e}=this.props;e.peek()?.data?.href||this.mrakomor.command.openDialog({element:this.element,children:this.#e(this.props)});}render(){let{entity:e,length:t,offset:a,children:o$1}=this.props;return p("a",{href:()=>u(e.get()?.data?.href),target:()=>e.get()?.data?.target||null,rel:()=>e.get()?.data?.target==="_blank"?"noopener noreferrer":null,$ref:this.element,onClick:s=>{s.ctrlKey||s.metaKey||o(()=>{m(),this.mrakomor.command.openDialog({element:this.element,children:this.#e({entity:e,length:t,offset:a})});});},"data-state":()=>JSON.stringify({entity:e.get(),length:t.get(),offset:a.get()})},o$1)}};function v({mrakomor:r}){return {resolveConfig:e=>(e.entityRanges.push(i),e),resolveComponent:e=>{if(e===i.NAMESPACE)return i},registerHandlers(){r.register.help.add({id:"link.insert",group:"formatting",description:"Insert or edit a link on the selection",commands:[],shortcuts:["Mod+K"]});},onKeyDown(e){e.key==="k"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),r.command.insertEntityRange({namespace:i.NAMESPACE}));}}}
|
|
3
3
|
export{i as LinkEntity,v as linkEntityPlugin};
|
package/dist/list.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/list/List.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(r){return r.getAttribute("data-mrakomor-css-path")===e});if(!t){var n=document.createElement("style");n.setAttribute("data-mrakomor-css",""),n.setAttribute("data-mrakomor-css-path",e),n.textContent=`.molecule-list-list{margin:0 0 1em;padding-inline-start:1.5em}.molecule-list-list li{margin:.25em 0;outline:none}.molecule-list-list li:focus{outline:none}.molecule-list-list li[data-depth="1"]{margin-inline-start:1.5em}.molecule-list-list li[data-depth="2"]{margin-inline-start:3em}.molecule-list-list li[data-depth="3"]{margin-inline-start:4.5em}
|
|
2
|
-
`,document.head.appendChild(n);}}})();var lt=class{next(...e){}error(...e){}complete(...e){}},Ae=class{#e=new Set;pipe(...e){return e.reduce((t,n)=>n(t),this)}next(...e){Array.from(this.#e).forEach(t=>{typeof t=="function"?t(...e):t.next(...e);});}error(...e){Array.from(this.#e).forEach(t=>{t?.error?.(...e),this.unsubscribe(t);});}complete(...e){Array.from(this.#e).forEach(t=>{t?.complete?.(...e),this.unsubscribe(t);});}subscribe(e){return this.#e.add(e),{unsubscribe:()=>{this.unsubscribe(e);}}}unsubscribe(e){this.#e.delete(e);}};var se=Symbol("@esmj/signals:type"),z=Symbol("@esmj/signals:name");var R=null,Le=false,we=[];function w(e){let t=R;R=null;let n=e();return R=t,n}function _n(){Le=false;let e=mt();for(let n of e)n.get();let t=we;we=[];for(let n of t)n();}function ut(){Le||(Le=true,queueMicrotask(_n));}function Te(e){we.push(e),ut();}var ft=Symbol("@esmj/signals:internal observable"),A=Symbol("@esmj/signals:original function"),In=class extends Ae{#e=new Set;#r=null;constructor(e){super(),this.#r=e,this.pipe(t=>{let n=t.subscribe.bind(t),r=t.unsubscribe.bind(t);return t.subscribe=o=>{n(o),this.#e.add(o);},t.unsubscribe=o=>{r(o),this.#e.delete(o);},t});}watch(e){if(typeof e.next!="function"&&(e.next=()=>w(()=>{this.#e.add(e),this.#r();}),e.next[A]=void 0),e instanceof ht&&e.next[A]===void 0){let t=e.next.bind(e);e.next=()=>w(()=>{this.#e.add(e),t(),this.#r();}),e.next[A]=t;}return this.subscribe(e)}getPending(){let e=[];for(let t of this.#e){if(!t.get[A]){let n=t.get,r=n.bind(t);t.get=()=>w(()=>(this.#e.delete(t),r())),t.get[A]=n;}e.push(t);}return e}unwatch(e){return e.next=e.next[A]?e.next[A]:e.next,e.get=e.get[A]?e.get[A]:e.get,this.#e.delete(e),this.unsubscribe(e)}},ie=null;function pt(e){ie=new In(e);}pt(()=>{ut();});function mt(){return ie.getPending()}function dt(e){return ie.watch(e)}function gt(e){return ie.unwatch(e)}var L=Symbol("@esmj/signals:no error"),ht=class yt extends lt{#e=true;#r=false;#t=null;#o=this.#p();#l=null;#c=null;#i=0;#s=new Map;#n=L;constructor(t,n){super(),this.#l=t,this.#c=n,this.debug=n?.debug,this[se]="computed",this[z]=n?.debug??null,this.get=this.get.bind(this);}#u(){for(let{unsubscribe:t}of this.#o.dependencies.values())t();this.#o.dependencies.clear();}#p(){return {dependencies:new Map,sourceRevisions:new Map,observer:this}}getRevision(){return this.#i}getDebugInfo(){return {name:this[z],dirty:this.#e,revision:this.#i,sourceDependencies:[...this.#s.keys()]}}#f(){for(let[t,n]of this.#s)if(t instanceof yt&&w(()=>t.get()),t.getRevision()!==n)return true;return false}next(){this.#e=true,this.#t[ft].next();}get(){if(this.#r)throw new Error("Cycle detected in computed signal");if(this.#t||(this.#t=P(this.#a(),this.#c)),(this.#e||this.#n!==L)&&(this.#s.size===0||this.#f()?this.#a():this.#e=false),R&&R.sourceRevisions.set(this,this.#i),this.#n!==L)throw this.#n;return this.#t.get()}peek(){if(this.#t||(this.#t=P(this.#a(),this.#c)),(this.#e||this.#n!==L)&&(this.#s.size===0||this.#f()?this.#a():this.#e=false),this.#n!==L)throw this.#n;return this.#t.peek()}#a(){this.#r=true,this.#e=false,this.#n=L,this.#u(),this.#o.sourceRevisions.clear();let t=R;R=this.#o;let n;try{n=this.#l();}catch(r){this.#n=r;}return R=t,this.#s=this.#o.sourceRevisions,this.#o.sourceRevisions=new Map,this.#r=false,n instanceof Promise&&(n=n.then(r=>{this.#n=L,this.#t.set(r);}).catch(r=>{this.#n=r;})),this.#n===L&&this.#t&&this.#t.set(n),this.#i++,n}destroy(){this.#u(),this.#s.clear(),this.#e=true,this.#n=L;}};function j(e,t){return new ht(e,t)}function _(e,t){let n,{debug:r,...o}={},s=j(()=>{n?.(),n=e();},{equals:()=>false,...o});s.get(),dt(s);let i=()=>{n?.(),s.destroy(),gt(s);};return i[Symbol.dispose]=i,i[se]="effect",i[z]=r??null,i.__RX_COMPUTED__=s,i}function P(e,t={}){let n=t?.equals??Object.is,r=0,o=new Ae;function s(){return R&&(R.dependencies.set(o,o.subscribe(R.observer)),R.sourceRevisions.set(l,r)),e}function i(){return e}function a(u){if(!n(e,u)){e=u,r++,o.next();}return e}function c(){return r}let l={get:s,set:a,peek:i,getRevision:c,[ft]:o,[se]:"signal",[z]:t?.debug??null};return l}function ae(){return Date.now().toString(32).substring(5)+Math.random().toString(32).substring(2)}var _t=Symbol("node-component"),ce=Symbol("node-internal"),An=Symbol("keep-literal"),pe=Symbol("raw-props");function De(e){return typeof e=="function"?e:e!=null&&typeof e.get=="function"?()=>e.get():()=>e}function Pe(e,t){let n=e.children!==void 0?e.children:t;return Array.isArray(n)?n[0]:n}var Ln=new Set(["template","script"]);function wn(e,t){let n=(e==null?"span":String(e)).trim(),r=n;Ln.has(n.toLowerCase())&&(console.warn(`[esmj-dom] tagName "${e}" cannot render children in normal flow and is not supported as a reconciliation wrapper; falling back to "span".`),r="span");let o=document.createElement(r);return r==="span"&&(o.style.display="contents"),o.setAttribute(t,ae()),o}function je(e,t,n){let r=wn(e,t);return n?.id&&r.setAttribute("id",n.id),r}var It=null;function $(){return It}function le(e){It=e;}function me(e){return e?.[_t]||null}function Et(e,t){e[_t]=t;}function ue(e,t={disposers:[],id:ae()}){return e?.[ce]?e[ce]:(e&&(e[ce]=t),t)}function Tn(e){return e[ce]}function M(e,t){let n=Tn(e);n||(n=ue(e)),n.disposers.push(t);}function Me(e,t,n){e.has(t)||e.set(t,[]),e.get(t).push(n);}function O(e,t){let n=$();le(e);try{return t()}finally{le(n);}}var Oe=new Map,fe=new Map,St=new Map;function At(e,t){let n=typeof t=="function"?t:o=>!!t?.includes(o),r=Object.create(null);for(let o of Object.keys(e)){let s=e[o];o==="children"||n(o)?r[o]=s:s?.[An]?r[o]=s():s!=null&&typeof s.get=="function"?r[o]=s:typeof s=="function"?r[o]=j(s):r[o]=P(s);}return r}function de(e,t){if(e===t)return true;if(e==null||t==null||typeof e!="object"||typeof t!="object")return false;let n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?false:n.every(o=>{let s=Object.getOwnPropertyDescriptor(e,o),i=Object.getOwnPropertyDescriptor(t,o);if(!s||!i)return false;let a="value"in s?s.value:s.get?.call(e),c="value"in i?i.value:i.get?.call(t);return de(a,c)})}function $e(e){return {id:Symbol("context-id"),defaultValue:e}}function Fe(e){let t=$();return t?.contexts?.has(e.id)?t.contexts.get(e.id):e.defaultValue}function F(e){Te(()=>{setTimeout(e,0);});}function Q(e){let t=e.componentId,n=Oe.get(t);if(n){Oe.delete(t);for(let r of n){let o=r();typeof o=="function"&&Me(fe,t,o);}}}function vn(e){let t=fe.get(e);if(t){fe.delete(e);for(let n of t)n();}}function Mn(e){let t=St.get(e);if(t){St.delete(e);for(let n of t)n();}}function ge(e){if(!e)return;let t=ue(e);if(t?.disposers?.length){for(let r of t.disposers)try{r();}catch(o){console.error("[esmj-dom] cleanupTree: disposer threw, cleanup continues",o);}t.disposers=[];}let n=me(e);if(n&&(vn(n.componentId),Mn(n.componentId)),e.childNodes){let r=e.firstChild;for(;r;){let o=r.nextSibling;ge(r),r=o;}}}function H(e){return e!=null&&typeof e=="object"&&typeof e.$constructor=="function"}function xt(e){return typeof e=="function"&&typeof e.prototype?.render=="function"}function On(e,t,n){let r=ae(),o={componentId:r,$children:n,element:null,classInstance:null,$constructor(){let s=xt(e)?void 0:e[pe],i={...At(t??{},s),children:n},a=$(),c={disposers:[],id:r,contexts:new Map(a?.contexts)};le(c);let l;if(xt(e)){o.ClassConstructor=e;let f=new e(i);o.classInstance=f,typeof f.onMount=="function"&&Me(Oe,r,()=>{f.onMount?.();}),typeof f.onUnmount=="function"&&Me(fe,r,()=>{f.onUnmount?.();}),l=f.render();}else l=e(i);le(a);let u=Bn(l);if(o.element=u,u instanceof DocumentFragment&&u.childNodes.length)for(let f of u.childNodes)ue(f,c),Et(f,o);else ue(u,c),u instanceof Node&&Et(u,o);return u}};return o}function He(e,t){let n=t.$constructor();n instanceof Node&&e.appendChild(n),queueMicrotask(()=>{Q(t);});}function Bn(e){return e instanceof Node?e:H(e)?e.$constructor():typeof e=="string"||typeof e=="number"?document.createTextNode(String(e)):document.createTextNode("")}var bt={className:"class",htmlFor:"for"},Rt=new Set(["value","defaultValue","checked","selected","indeterminate"]),Dn=new Set(["srcdoc"]),Pn=new Set(["href","src","action","formaction","xlink:href"]),jn=new Set(["securitypolicyviolation"]),$n=new Set(["contenteditable","draggable","spellcheck"]);function J(e){return e!=null&&typeof e=="object"&&typeof e.get=="function"&&!(e instanceof Node)}var Lt=Symbol("Fragment");function K(e,t,n){if(e===Lt){let o=document.createDocumentFragment();return Be(o,Nt(n)),o}if(typeof e=="function")return On(e,t||{},n);typeof e!="string"&&(n=t,t=e,e="div"),t=t||{};let r=document.createElement(e);return t.id&&r.setAttribute("id",t.id),he(r,t),Be(r,Nt(n)),r}function ve(e,t){t instanceof DocumentFragment?e.replaceChildren(t):e.innerHTML=t??"";}function Fn(e){return typeof e!="string"?false:e.replace(/[\p{White_Space}\p{Cc}]+/gu,"").toLowerCase().startsWith("javascript:")}function Hn(e,t){if(typeof e!="string")return false;let n=e.toLowerCase();return Dn.has(n)?true:Pn.has(n)&&t!==null&&t!==void 0&&Fn(String(t))}function wt(e){return typeof e!="string"?e:bt[e]?bt[e]:e}function Un(e,t){let n=wt(e),r=typeof n=="string"?n.toLowerCase():String(n).toLowerCase();return $n.has(r)&&(t===true||t===false||t==="true"||t==="false")?String(t):t==null||t===false?null:t}function Ct(e,t,n){let r=Un(t,n);if(r===null){e.removeAttribute(t);return}if(Hn(t,r)){e.removeAttribute(t),console.warn(`[esmj-dom] Blocked unsafe attribute "${String(t)}" on <${e.tagName.toLowerCase()}>`);return}e.setAttribute(t,r);}function he(e,t){let n=$();for(let[r,o]of Reflect.ownKeys(t).map(s=>[s,t[s]]))if(r!=="id"){if(r=wt(r),r==="$ref"){typeof o=="function"?o(e):typeof o=="object"&&o!==null&&(o.current=e);continue}if(r==="$dangerouslySetInnerHTML"){if(J(o)){let s=_(()=>{O(n,()=>{ve(e,o.get());});});M(e,s);}else if(typeof o=="function"){let s=_(()=>{O(n,()=>{ve(e,o());});});M(e,s);}else ve(e,o);continue}if(r==="style"){if(J(o)){let s=_(()=>{O(n,()=>{Object.assign(e.style,o.get());});});M(e,s);}else typeof o=="object"&&o!==null?Object.assign(e.style,o):e.setAttribute("style",o);continue}if(typeof r=="string"&&r.startsWith("on")&&typeof o=="function"){let s=r.slice(2).toLowerCase();if(jn.has(s)){console.warn(`[esmj-dom] Blocked unsafe event binding "${r}" on <${e.tagName.toLowerCase()}>`);continue}e.addEventListener(s,o);continue}if(J(o)||typeof o=="function"){let s=r,i=_(()=>{O(n,()=>{let a=typeof o=="function"?o():o.get();Rt.has(s)?e[s]=a??"":Ct(e,s,a);});});M(e,i);continue}Rt.has(r)||typeof r=="symbol"?e[r]=o??"":Ct(e,r,o);}}function Nt(e){return e==null?[]:Array.isArray(e)?e.flat(Number.POSITIVE_INFINITY):[e]}function Be(e,t){for(let n of t)Tt(e,n);}function Tt(e,t){if(!(t==null||t===false||t===true)){if(t instanceof Node){e.appendChild(t);return}if(typeof t=="string"||typeof t=="number"){e.appendChild(document.createTextNode(String(t)));return}if(typeof t=="function"){kt(e,t);return}if(H(t)){He(e,t);return}if(J(t)){kt(e,()=>t.get());return}if(Array.isArray(t)){Be(e,t);return}e.appendChild(document.createTextNode(String(t)));}}function G(e){let t=null,n=e;return H(e)&&(t=e,n=e.$constructor()),n instanceof DocumentFragment?{nodes:Array.from(n.childNodes),instance:t}:n instanceof Node?{nodes:[n],instance:t}:n==null||n===false||n===true?{nodes:[],instance:t}:{nodes:[document.createTextNode(String(n))],instance:t}}function ye(e,t=true){for(let n of e)t&&ge(n),n.remove();}function kt(e,t){let n=$(),r=document.createComment("");e.appendChild(r);let o=[],s=_(()=>{O(n,()=>{let i=t(),{nodes:a,instance:c}=G(i);ye(o),a.length&&r.after(...a),c&&queueMicrotask(()=>Q(c)),o=a;});});M(e,s);}var Ot=class{constructor(e){this.props=e;}};function vt(e,t,n,r){let{equals:o=de,tagName:s="span",...i}=r??{},a=je(s,"data-for",i);he(a,i);let c=$(),l=[],u=new Map,f=j(()=>e()),p=_(()=>{let d=f.get(),y=Array.isArray(d)?d:[],N=[],E=[],B=new Set;for(let g=0;g<y.length;g++){let x=y[g],k=t(x,g);if(B.has(k)){console.error(`For: duplicate key "${String(k)}" detected; ignoring later item at index ${g}`);continue}B.add(k),N.push(x),E.push(k);}let q=new Map(l.map(g=>[g.key,g])),v=[];for(let g=0;g<N.length;g++){let x=E[g],k=N[g],D=q.get(x);if(D)u.get(x).set(k),v.push(D),q.delete(x);else {let it=P(k,{equals:o});u.set(x,it);let bn={...it,set(){}},at={key:x,nodes:[]};O(c,()=>{let Rn=n(bn,g),{nodes:Cn,instance:ct}=G(Rn);at.nodes=Cn,ct&&queueMicrotask(()=>Q(ct));}),v.push(at);}}for(let[g,x]of q)ye(x.nodes),u.delete(g);let I=null;for(let g=v.length-1;g>=0;g--){let x=v[g].nodes;for(let k=x.length-1;k>=0;k--){let D=x[k];(D.parentNode!==a||D.nextSibling!==I)&&a.insertBefore(D,I),I=D;}}l=v;});return M(a,p),a}function Ue(e,t,n,r){if(typeof e=="function")return vt(e,t,n,r);let{each:o,keyFn:s,equals:i,tagName:a,children:c,...l}=e??{};if(typeof s!="function")throw new Error('For: "keyFn" prop is required and must be a function');let u=De(o),f=Pe(e??{},t);return vt(u,s,f,{...l,equals:i,tagName:a})}Ue[pe]=e=>e!=="each";function Bt(e,t){if(typeof e=="string"&&(e=document.querySelector(e)),!e)throw new Error("mount: container not found");e instanceof DocumentFragment||(ge(e),e.innerHTML=""),H(t)?He(e,t):t instanceof Node?e.appendChild(t):e.appendChild(document.createTextNode(String(t)));}var Kn={abortEarly:true};function Ye(e,t){if(t===void 0)return e;let n=e?.cause?.key?`${t}.${e.cause.key}`:`${t}`;return {message:`Error parsing key "${n}": ${e.message}`,cause:{key:n}}}function Gn(e,t,n){if(e.errors?.length)for(let r=0;r<e.errors.length;r++)t.push(Ye(e.errors[r],n));}function jt(e,t,n,r){if(n!==false){let o=Ye(e.error,t);return {success:false,error:o,errors:[o]}}Gn(e,r,t);}function Ee(e){return e?.abortEarly!==void 0?e:Kn}function qe(e,t){S(e,"_parse",(n,r,o)=>{let s=n(r,o);return !s.success&&t(r)?{success:true,data:r}:s});}var Z=e=>typeof e=="string"||e instanceof String,Ke=e=>(typeof e=="number"||e instanceof Number)&&!Number.isNaN(e),Ge=e=>e===true||e===false,Vn=e=>e instanceof Date&&!Number.isNaN(e.getTime()),Yn=e=>typeof e=="function",Wn=e=>Array.isArray(e),Ve=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function $t(e,t){let n=C(Ve,{...t,type:"object"});n._getDescription=()=>`object({ ${Object.entries(e).map(([o,s])=>`${o}: ${s._getDescription()}`).join(", ")} })`,n._getDefinition=()=>e;let r=n;return r.derive=function(o,{when:s="always"}={}){return S(this,"_parse",(i,a,c)=>{let l=i(a,c);if(!l.success)return l;let u=o(l.data,{context:c?.context});if(!Ve(u)){let f={message:`derive() callback must return a plain object of overrides, got ${u===null?"null":typeof u}`};return {success:false,error:f,errors:[f]}}if(s==="missing"){let f={...l.data};for(let p in u)f[p]===void 0&&(f[p]=u[p]);return {success:true,data:f}}return {success:true,data:{...l.data,...u}}}),this},S(n,"_parse",(o,s,i)=>{let a=o(s,i),{abortEarly:c}=Ee(i);if(a.success===false)return a;let l={},u=[];for(let f in e){let p=e[f]._parse(a.data[f],i);if(p.success)l[f]=p.data;else {let d=jt(p,f,c,u);if(d)return d}}return u.length>0?{success:false,error:u[0],errors:u}:{success:true,data:l}}),r}function We(e){return C(Z,{...e,type:"string"})}function ze(e){return C(Ke,{...e,type:"number"})}function Xe(e){return C(Ge,{...e,type:"boolean"})}function Je(e){return C(Vn,{...e,type:"date"})}function Ft(e){return C(Yn,{...e,type:"function"})}function Ht(e,t){let n=i=>e.includes(i),r=i=>`Invalid ${o} value. Expected ${e.map(a=>`"${a}"`).join(" | ")}, received "${i}".`,o="enum",s=C(n,{message:r,...t,type:o});return s._getDescription=()=>`enum(${e.map(i=>`"${i}"`).join(" | ")})`,s._getDefinition=()=>e,s}function Ut(e,t){let n=C(Wn,{...t,type:"array"});return n._getDescription=()=>`array(${e._getDescription()})`,n._getDefinition=()=>e,S(n,"_parse",(r,o,s)=>{let i=r(o,s),{abortEarly:a}=Ee(s);if(i.success===false)return i;let c=[],l=[],u=s;for(let f=0;f<i.data.length;f++){let p={...u,context:{...u?.context,index:f}},d=e._parse(i.data[f],p);if(d.success)c.push(d.data);else {let y=jt(d,f,a,l);if(y)return y}}return l.length>0?{success:false,error:l[0],errors:l}:{success:true,data:c}}),n}function qt(){return C(()=>true)}function V(e,t){return S(t,"_parse",(n,r,o)=>(r=e(r),n(r,o))),t}function Kt(e,t){let n=o=>`Invalid union value. Expected the value to match one of the schemas:${e.map((s,i)=>` ${i+1}. ${s._getDescription()}`).join(",")} but received "${typeof o}" with value: ${Ve(o)?JSON.stringify(o):`"${o}"`}`,r=C(()=>false,{message:n,...t,type:"union"});return r._getDefinition=()=>e,S(r,"_parse",(o,s,i)=>{let a=i,c=[];for(let p=0;p<e.length;p++){let d=e[p]._parse(s,a);if(d.success)return d;c.push(d);}let{abortEarly:l}=Ee(a),u={message:typeof n=="function"?n(s):n};if(l!==false)return {success:false,error:u,errors:[u]};let f=[];for(let p=0;p<c.length;p++){let d=c[p].errors;if(d?.length)for(let y=0;y<d.length;y++)d[y].cause?.key&&f.push(Ye(d[y],`branch ${p}`));}return f.length===0&&f.push(u),{success:false,error:f[0],errors:f}}),r}function Gt(e,t){let n=C(r=>r===e,{message:r=>t?.message?typeof t.message=="function"?t.message(r):t.message:`Expected literal value "${e}", received "${r}"`,name:t?.name,type:"literal"});return n._getDescription=()=>`literal("${e}")`,n._getDefinition=()=>e,n}function Vt(e){let t=C(()=>true,{type:"contextRef"});return t._getDescription=()=>`contextRef("${e}")`,S(t,"_parse",(n,r,o)=>({success:true,data:o?.context?.[e]})),t}function Yt(e,t){return {parse(n,r){let o=e.parse(r?.context??{},r);return t(o).parse(n,r)},safeParse(n,r){let o=e.safeParse(r?.context??{},r);return o.success?t(o.data).safeParse(n,r):o}}}var Wt={boolean(e){let t=e?.message??(n=>`Cannot cast "${n}" to boolean. Accepted: true/false, 1/0, yes/no, on/off.`);return V(n=>{let r;return Z(n)&&(r=n.toLowerCase()),r==="true"||r==="yes"||r==="on"||r==="1"||n===1?true:r==="false"||r==="no"||r==="off"||r==="0"||n===0?false:n},Xe({...e,message:t}))},number(e){let t=e?.message??(n=>`Cannot cast "${n}" to a number. Expected a numeric string or number.`);return V(n=>{if(Ge(n))return Number(n);if(Z(n)){let r=n.trim();if(r==="")return n;let o=Number(r);if(Number.isFinite(o))return o}return n},ze({...e,message:t}))},string(e){let t=e?.message??(n=>`Cannot cast "${n}" to string. Expected a string, number, or boolean.`);return V(n=>Ge(n)||Ke(n)&&Number.isFinite(n)?String(n):n,We({...e,message:t}))},date(e){let t=e?.message??(n=>`Cannot cast "${n}" to a valid date.`);return V(n=>{let r;return Z(n)&&(r=n.trim()),Ke(n)&&Number.isFinite(n)||r?new Date(r??n):n},Je({...e,message:t}))},json(e,t){let n=t?.message??(r=>`Cannot parse "${r}" as JSON.`);return S(e,"_parse",(r,o,s)=>{if(Z(o))try{o=JSON.parse(o);}catch{let i={message:typeof n=="function"?n(o):n};return {success:false,error:i,errors:[i]}}return r(o,s)}),e}},zt={},m={object:$t,string:We,number:ze,boolean:Xe,date:Je,function:Ft,enum:Ht,array:Ut,any:qt,preprocess:V,union:Kt,literal:Gt,contextRef:Vt,withContext:Yt,coerce:zt,cast:Wt};function Dt(e){return t=>`The value "${t}" must be type of ${e} but is type of "${typeof t}".`}function S(e,t,n){let r=e[t];e[t]=(...o)=>n(r,...o);}function C(e,{type:t="any",name:n,message:r}={}){r=r||Dt(t);let o={name:n,message:r,type:t},s={_getName(){return n},_getType(){return t},_getDescription(){return this._getName()??this._getType()},_parse(i,a){let c=e(i);if(c===true)return {success:true,data:i};if(typeof c=="object"&&c?.success===true)return c;let l={message:typeof r=="function"?r(i):r};return {success:false,error:l,errors:[l]}},parse(i,a){let c=this._parse(i,a);if(!c.success)throw c=c,new Error(c.error.message,{cause:c.error.cause});return c.data},safeParse(i,a){return this._parse(i,a)},transform(i){return S(this,"_parse",(a,c,l)=>{let u=a(c,l);return u.success&&(u.data=i(u.data)),u}),this},optional(){return qe(this,i=>i===void 0),this},nullable(){return qe(this,i=>i===null),this},nullish(){return qe(this,i=>i==null),this},default(i){return S(this,"_parse",(a,c,l)=>(c===void 0&&(c=typeof i=="function"?i({context:l?.context}):i),a(c,l))),this},catch(i){return S(this,"_parse",(a,c,l)=>{let u=a(c,l);return u.success?u:{success:true,data:typeof i=="function"?i({input:c,error:u.error}):i}}),this},pipe(i){return S(this,"_parse",(a,c,l)=>{let u=a(c,l);return u.success?i._parse(u.data,l):u}),this},refine(i,{message:a,type:c,jsonSchema:l}={}){if(c&&(a=a||Dt(c),t=c),l){let u=[...this._getJsonSchemaHints?.()??[],l];this._getJsonSchemaHints=()=>u;}return S(this,"_parse",(u,f,p)=>{let d=u(f,p),{abortEarly:y}=Ee(p);if(!d.success)return d;let N=i(d.data);if(N===true||typeof N=="object"&&N?.success===true)return d;let E={message:typeof a=="function"?a(f):a};return {success:false,error:E,errors:[E]}}),this},clone(){return {...this}}};return Pt.length>0?Pt.reduce((i,a)=>a(i,e,o)??i,s):s}var Pt=[];var Qe=et(),Ze=et(),Xt=et(),zn=Array.from({length:256},(e,t)=>(t<=15?"0":"")+t.toString(16));function et(){return Math.floor(Math.random()*16777215)}function Xn(){return Ze=(Ze+1)%16777215,Ze}function b(){let e=Math.floor(Date.now()/1e3);e=parseInt(e,10)%4294967295;let t=Xn(),n=String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255,Qe>>16&255,Qe>>8&255,Qe&255,Xt>>8&255,Xt&255,t>>16&255,t>>8&255,t&255),r="";for(let o=0;o<n.length;o++)r+=zn[n.charCodeAt(o)];return r}var Jt=Symbol("block-element"),Jn=Symbol("block-element-body"),ee=Symbol("selectable-element");function Qt(e,t){let n=e;for(n?.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n[t]===void 0;)n=n.parentElement;return n??null}function Se(e){return Qt(e,Jt)}function Qn(e){return e?Qt(e.startContainer,ee):null}function Zn(e){return e?e[ee]!==void 0?[e]:[...e.children].filter(t=>t[ee]!==void 0):[]}function er(e,t){return t?Zn(e).indexOf(t):-1}function te(e,t){let n=Qn(t);return !n||!e?.contains(n)?null:{element:n,index:er(e,n)}}function Zt(){return window.getSelection()}function ne(){let e=Zt();return e.rangeCount>0?e.getRangeAt(0).cloneRange():null}function tt(e,t,n){if(!e)return 0;if(t===e){if(t.nodeType===Node.TEXT_NODE)return n;let i=0,a=e.childNodes,c=Math.min(n,a.length);for(let l=0;l<c;l++)i+=a[l].textContent.length;return i}if(t.nodeType===Node.ELEMENT_NODE&&!e.contains(t))return 0;let r=0,o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),s=o.nextNode();for(;s;){if(s===t)return r+n;r+=s.textContent.length,s=o.nextNode();}return r}function tr(e,t){let n=document.createRange();if(!e)return n;if(t<=0)return n.setStart(e,0),n.collapse(true),n;let r=0,o=[e];for(;o.length>0;){let s=o.pop();if(s.nodeType===Node.TEXT_NODE){let i=s.textContent.length;if(r+i>=t)return n.setEnd(s,t-r),n.setStart(s,t-r),n;r+=i;}else if(s.childNodes&&s.childNodes.length>0)for(let i=s.childNodes.length-1;i>=0;i--)o.push(s.childNodes[i]);}return n.setEnd(e,e.childNodes.length),n.setStart(e,e.childNodes.length),n}function Y(e,t){let n=tr(e,t),r=Zt();r.removeAllRanges(),r.addRange(n);}function en(e){if(!e)return null;let t=nr(e);return t?.firstElementChild??t?.firstChild}function nt(e){if(!e?.[Jt])return null;let t=en(e);return t?me(t)?.classInstance:null}function nr(e){if(!e)return null;for(let t of e.children)if(t[Jn])return t;return null}var xe={INPUT:"mrakomor:input",TRANSFORM_BLOCK_ELEMENT:"mrakomor:transform-block-element"};var tn=$e();var be=class extends Ot{state;element;mrakomor;constructor(t){super(t);let{state:n,observeDOMChanges:r=true}=t??{};this.state=n,this.element=null,this.mrakomor=Fe(tn),this._stale=false,this._observer=null,this._offInputStale=null,this._onInputMarkStale=null,this._observeDOMChanges=r;}static get NAMESPACE(){return "namespace.AbstractComponent"}static getStateSchema(){return m.object({component:m.string().default(this.NAMESPACE),properties:m.object().default({}),settings:m.object().default({})}).default({})}static getPropsSchema(){return m.object({state:this.getStateSchema(),observeDOMChanges:m.boolean().default(true)}).default({})}parseFromHTML(t){return this.constructor.getStateSchema(t).parse()}getState(){if(this._stale){let t=this.element;return this.parseFromHTML(t)}return this.state.peek()}isStale(){return this._stale}#e(){this._stale=true;}onMount(){!this.element||!this._observeDOMChanges||(this._observer=new MutationObserver(()=>{this.#e();}),this._observer.observe(this.element,{subtree:true,characterData:true,characterDataOldValue:true,childList:true,attributes:true,attributeOldValue:true}),this._onInputMarkStale=t=>{let n=t.target;n instanceof Node&&this.element?.contains(n)&&this.#e();},this.mrakomor?.emitter&&(this._offInputStale=this.mrakomor.emitter.on(xe.INPUT,this._onInputMarkStale)));}onUnmount(){this._observer&&(this._observer.disconnect(),this._observer=null),this._offInputStale?.(),this._offInputStale=null,this._onInputMarkStale=null,this._stale=false;}};var W="molecule.paragraph.Paragraph",Re="molecule.list.List";var nn="molecule.headline.";function h(e){return e===`
|
|
2
|
+
`,document.head.appendChild(n);}}})();var dt=class{next(...e){}error(...e){}complete(...e){}},ve=class{#e=new Set;pipe(...e){return e.reduce((t,n)=>n(t),this)}next(...e){Array.from(this.#e).forEach(t=>{typeof t=="function"?t(...e):t.next(...e);});}error(...e){Array.from(this.#e).forEach(t=>{t?.error?.(...e),this.unsubscribe(t);});}complete(...e){Array.from(this.#e).forEach(t=>{t?.complete?.(...e),this.unsubscribe(t);});}subscribe(e){return this.#e.add(e),{unsubscribe:()=>{this.unsubscribe(e);}}}unsubscribe(e){this.#e.delete(e);}};var ue=Symbol("@esmj/signals:type"),J=Symbol("@esmj/signals:name");var R=null,Te=false,Oe=[];function v(e){let t=R;R=null;let n=e();return R=t,n}function Tn(){Te=false;let e=St();for(let n of e)n.get();let t=Oe;Oe=[];for(let n of t)n();}function ht(){Te||(Te=true,queueMicrotask(Tn));}function Me(e){Oe.push(e),ht();}var Et=Symbol("@esmj/signals:internal observable"),L=Symbol("@esmj/signals:original function"),On=class extends ve{#e=new Set;#r=null;constructor(e){super(),this.#r=e,this.pipe(t=>{let n=t.subscribe.bind(t),r=t.unsubscribe.bind(t);return t.subscribe=o=>{n(o),this.#e.add(o);},t.unsubscribe=o=>{r(o),this.#e.delete(o);},t});}watch(e){if(typeof e.next!="function"&&(e.next=()=>v(()=>{this.#e.add(e),this.#r();}),e.next[L]=void 0),e instanceof bt&&e.next[L]===void 0){let t=e.next.bind(e);e.next=()=>v(()=>{this.#e.add(e),t(),this.#r();}),e.next[L]=t;}return this.subscribe(e)}getPending(){let e=[];for(let t of this.#e){if(!t.get[L]){let n=t.get,r=n.bind(t);t.get=()=>v(()=>(this.#e.delete(t),r())),t.get[L]=n;}e.push(t);}return e}unwatch(e){return e.next=e.next[L]?e.next[L]:e.next,e.get=e.get[L]?e.get[L]:e.get,this.#e.delete(e),this.unsubscribe(e)}},fe=null;function yt(e){fe=new On(e);}yt(()=>{ht();});function St(){return fe.getPending()}function xt(e){return fe.watch(e)}function Ct(e){return fe.unwatch(e)}var A=Symbol("@esmj/signals:no error"),bt=class Rt extends dt{#e=true;#r=false;#t=null;#o=this.#p();#a=null;#l=null;#i=0;#s=new Map;#n=A;constructor(t,n){super(),this.#a=t,this.#l=n,this.debug=n?.debug,this[ue]="computed",this[J]=n?.debug??null,this.get=this.get.bind(this);}#u(){for(let{unsubscribe:t}of this.#o.dependencies.values())t();this.#o.dependencies.clear();}#p(){return {dependencies:new Map,sourceRevisions:new Map,observer:this}}getRevision(){return this.#i}getDebugInfo(){return {name:this[J],dirty:this.#e,revision:this.#i,sourceDependencies:[...this.#s.keys()]}}#f(){for(let[t,n]of this.#s)if(t instanceof Rt&&v(()=>t.get()),t.getRevision()!==n)return true;return false}next(){this.#e=true,this.#t[Et].next();}get(){if(this.#r)throw new Error("Cycle detected in computed signal");if(this.#t||(this.#t=$(this.#c(),this.#l)),(this.#e||this.#n!==A)&&(this.#s.size===0||this.#f()?this.#c():this.#e=false),R&&R.sourceRevisions.set(this,this.#i),this.#n!==A)throw this.#n;return this.#t.get()}peek(){if(this.#t||(this.#t=$(this.#c(),this.#l)),(this.#e||this.#n!==A)&&(this.#s.size===0||this.#f()?this.#c():this.#e=false),this.#n!==A)throw this.#n;return this.#t.peek()}#c(){this.#r=true,this.#e=false,this.#n=A,this.#u(),this.#o.sourceRevisions.clear();let t=R;R=this.#o;let n;try{n=this.#a();}catch(r){this.#n=r;}return R=t,this.#s=this.#o.sourceRevisions,this.#o.sourceRevisions=new Map,this.#r=false,n instanceof Promise&&(n=n.then(r=>{this.#n=A,this.#t.set(r);}).catch(r=>{this.#n=r;})),this.#n===A&&this.#t&&this.#t.set(n),this.#i++,n}destroy(){this.#u(),this.#s.clear(),this.#e=true,this.#n=A;}};function F(e,t){return new bt(e,t)}function I(e,t){let n,{debug:r,...o}={},s=F(()=>{n?.(),n=e();},{equals:()=>false,...o});s.get(),xt(s);let i=()=>{n?.(),s.destroy(),Ct(s);};return i[Symbol.dispose]=i,i[ue]="effect",i[J]=r??null,i.__RX_COMPUTED__=s,i}function $(e,t={}){let n=t?.equals??Object.is,r=0,o=new ve;function s(){return R&&(R.dependencies.set(o,o.subscribe(R.observer)),R.sourceRevisions.set(a,r)),e}function i(){return e}function c(u){if(!n(e,u)){e=u,r++,o.next();}return e}function l(){return r}let a={get:s,set:c,peek:i,getRevision:l,[Et]:o,[ue]:"signal",[J]:t?.debug??null};return a}function pe(){return Date.now().toString(32).substring(5)+Math.random().toString(32).substring(2)}var Tt=Symbol("node-component"),me=Symbol("node-internal"),Mn=Symbol("keep-literal"),Ee=Symbol("raw-props");function $e(e){return typeof e=="function"?e:e!=null&&typeof e.get=="function"?()=>e.get():()=>e}function Fe(e,t){let n=e.children!==void 0?e.children:t;return Array.isArray(n)?n[0]:n}var wn=new Set(["template","script"]);function Dn(e,t){let n=(e==null?"span":String(e)).trim(),r=n;wn.has(n.toLowerCase())&&(console.warn(`[esmj-dom] tagName "${e}" cannot render children in normal flow and is not supported as a reconciliation wrapper; falling back to "span".`),r="span");let o=document.createElement(r);return r==="span"&&(o.style.display="contents"),o.setAttribute(t,pe()),o}function He(e,t,n){let r=Dn(e,t);return n?.id&&r.setAttribute("id",n.id),r}var Ot=null;function H(){return Ot}function ge(e){Ot=e;}function ye(e){return e?.[Tt]||null}function kt(e,t){e[Tt]=t;}function de(e,t={disposers:[],id:pe()}){return e?.[me]?e[me]:(e&&(e[me]=t),t)}function Pn(e){return e[me]}function M(e,t){let n=Pn(e);n||(n=de(e)),n.disposers.push(t);}function De(e,t,n){e.has(t)||e.set(t,[]),e.get(t).push(n);}function w(e,t){let n=H();ge(e);try{return t()}finally{ge(n);}}var Pe=new Map,he=new Map,_t=new Map;function Mt(e,t){let n=typeof t=="function"?t:o=>!!t?.includes(o),r=Object.create(null);for(let o of Object.keys(e)){let s=e[o];o==="children"||n(o)?r[o]=s:s?.[Mn]?r[o]=s():s!=null&&typeof s.get=="function"?r[o]=s:typeof s=="function"?r[o]=F(s):r[o]=$(s);}return r}function Se(e,t){if(e===t)return true;if(e==null||t==null||typeof e!="object"||typeof t!="object")return false;let n=Object.keys(e),r=Object.keys(t);return n.length!==r.length?false:n.every(o=>{let s=Object.getOwnPropertyDescriptor(e,o),i=Object.getOwnPropertyDescriptor(t,o);if(!s||!i)return false;let c="value"in s?s.value:s.get?.call(e),l="value"in i?i.value:i.get?.call(t);return Se(c,l)})}function Ke(e){return {id:Symbol("context-id"),defaultValue:e}}function Ue(e){let t=H();return t?.contexts?.has(e.id)?t.contexts.get(e.id):e.defaultValue}function N(e){Me(()=>{setTimeout(e,0);});}function ee(e){let t=e.componentId,n=Pe.get(t);if(n){Pe.delete(t);for(let r of n){let o=r();typeof o=="function"&&De(he,t,o);}}}function jn(e){let t=he.get(e);if(t){he.delete(e);for(let n of t)n();}}function $n(e){let t=_t.get(e);if(t){_t.delete(e);for(let n of t)n();}}function xe(e){if(!e)return;let t=de(e);if(t?.disposers?.length){for(let r of t.disposers)try{r();}catch(o){console.error("[esmj-dom] cleanupTree: disposer threw, cleanup continues",o);}t.disposers=[];}let n=ye(e);if(n&&(jn(n.componentId),$n(n.componentId)),e.childNodes){let r=e.firstChild;for(;r;){let o=r.nextSibling;xe(r),r=o;}}}function K(e){return e!=null&&typeof e=="object"&&typeof e.$constructor=="function"}function It(e){return typeof e=="function"&&typeof e.prototype?.render=="function"}function Fn(e,t,n){let r=pe(),o={componentId:r,$children:n,element:null,classInstance:null,$constructor(){let s=It(e)?void 0:e[Ee],i={...Mt(t??{},s),children:n},c=H(),l={disposers:[],id:r,contexts:new Map(c?.contexts)};ge(l);let a;if(It(e)){o.ClassConstructor=e;let f=new e(i);o.classInstance=f,typeof f.onMount=="function"&&De(Pe,r,()=>{f.onMount?.();}),typeof f.onUnmount=="function"&&De(he,r,()=>{f.onUnmount?.();}),a=f.render();}else a=e(i);ge(c);let u=Hn(a);if(o.element=u,u instanceof DocumentFragment&&u.childNodes.length)for(let f of u.childNodes)de(f,l),kt(f,o);else de(u,l),u instanceof Node&&kt(u,o);return u}};return o}function qe(e,t){let n=t.$constructor();n instanceof Node&&e.appendChild(n),queueMicrotask(()=>{ee(t);});}function Hn(e){return e instanceof Node?e:K(e)?e.$constructor():typeof e=="string"||typeof e=="number"?document.createTextNode(String(e)):document.createTextNode("")}var Nt={className:"class",htmlFor:"for"},Bt=new Set(["value","defaultValue","checked","selected","indeterminate"]),Kn=new Set(["srcdoc"]),Un=new Set(["href","src","action","formaction","xlink:href"]),qn=new Set(["securitypolicyviolation"]),Gn=new Set(["contenteditable","draggable","spellcheck"]);function Z(e){return e!=null&&typeof e=="object"&&typeof e.get=="function"&&!(e instanceof Node)}var wt=Symbol("Fragment");function V(e,t,n){if(e===wt){let o=document.createDocumentFragment();return je(o,At(n)),o}if(typeof e=="function")return Fn(e,t||{},n);typeof e!="string"&&(n=t,t=e,e="div"),t=t||{};let r=document.createElement(e);return t.id&&r.setAttribute("id",t.id),Ce(r,t),je(r,At(n)),r}function we(e,t){t instanceof DocumentFragment?e.replaceChildren(t):e.innerHTML=t??"";}function Vn(e){return typeof e!="string"?false:e.replace(/[\p{White_Space}\p{Cc}]+/gu,"").toLowerCase().startsWith("javascript:")}function Yn(e,t){if(typeof e!="string")return false;let n=e.toLowerCase();return Kn.has(n)?true:Un.has(n)&&t!==null&&t!==void 0&&Vn(String(t))}function Dt(e){return typeof e!="string"?e:Nt[e]?Nt[e]:e}function zn(e,t){let n=Dt(e),r=typeof n=="string"?n.toLowerCase():String(n).toLowerCase();return Gn.has(r)&&(t===true||t===false||t==="true"||t==="false")?String(t):t==null||t===false?null:t}function Lt(e,t,n){let r=zn(t,n);if(r===null){e.removeAttribute(t);return}if(Yn(t,r)){e.removeAttribute(t),console.warn(`[esmj-dom] Blocked unsafe attribute "${String(t)}" on <${e.tagName.toLowerCase()}>`);return}e.setAttribute(t,r);}function Ce(e,t){let n=H();for(let[r,o]of Reflect.ownKeys(t).map(s=>[s,t[s]]))if(r!=="id"){if(r=Dt(r),r==="$ref"){typeof o=="function"?o(e):typeof o=="object"&&o!==null&&(o.current=e);continue}if(r==="$dangerouslySetInnerHTML"){if(Z(o)){let s=I(()=>{w(n,()=>{we(e,o.get());});});M(e,s);}else if(typeof o=="function"){let s=I(()=>{w(n,()=>{we(e,o());});});M(e,s);}else we(e,o);continue}if(r==="style"){if(Z(o)){let s=I(()=>{w(n,()=>{Object.assign(e.style,o.get());});});M(e,s);}else typeof o=="object"&&o!==null?Object.assign(e.style,o):e.setAttribute("style",o);continue}if(typeof r=="string"&&r.startsWith("on")&&typeof o=="function"){let s=r.slice(2).toLowerCase();if(qn.has(s)){console.warn(`[esmj-dom] Blocked unsafe event binding "${r}" on <${e.tagName.toLowerCase()}>`);continue}e.addEventListener(s,o);continue}if(Z(o)||typeof o=="function"){let s=r,i=I(()=>{w(n,()=>{let c=typeof o=="function"?o():o.get();Bt.has(s)?e[s]=c??"":Lt(e,s,c);});});M(e,i);continue}Bt.has(r)||typeof r=="symbol"?e[r]=o??"":Lt(e,r,o);}}function At(e){return e==null?[]:Array.isArray(e)?e.flat(Number.POSITIVE_INFINITY):[e]}function je(e,t){for(let n of t)Pt(e,n);}function Pt(e,t){if(!(t==null||t===false||t===true)){if(t instanceof Node){e.appendChild(t);return}if(typeof t=="string"||typeof t=="number"){e.appendChild(document.createTextNode(String(t)));return}if(typeof t=="function"){vt(e,t);return}if(K(t)){qe(e,t);return}if(Z(t)){vt(e,()=>t.get());return}if(Array.isArray(t)){je(e,t);return}e.appendChild(document.createTextNode(String(t)));}}function Y(e){let t=null,n=e;return K(e)&&(t=e,n=e.$constructor()),n instanceof DocumentFragment?{nodes:Array.from(n.childNodes),instance:t}:n instanceof Node?{nodes:[n],instance:t}:n==null||n===false||n===true?{nodes:[],instance:t}:{nodes:[document.createTextNode(String(n))],instance:t}}function be(e,t=true){for(let n of e)t&&xe(n),n.remove();}function vt(e,t){let n=H(),r=document.createComment("");e.appendChild(r);let o=[],s=I(()=>{w(n,()=>{let i=t(),{nodes:c,instance:l}=Y(i);be(o),c.length&&r.after(...c),l&&queueMicrotask(()=>ee(l)),o=c;});});M(e,s);}var Ft=class{constructor(e){this.props=e;}};function jt(e,t,n,r){let{equals:o=Se,tagName:s="span",...i}=r??{},c=He(s,"data-for",i);Ce(c,i);let l=H(),a=[],u=new Map,f=F(()=>e()),p=I(()=>{let m=f.get(),h=Array.isArray(m)?m:[],S=[],y=[],P=new Set;for(let d=0;d<h.length;d++){let b=h[d],_=t(b,d);if(P.has(_)){console.error(`For: duplicate key "${String(_)}" detected; ignoring later item at index ${d}`);continue}P.add(_),S.push(b),y.push(_);}let G=new Map(a.map(d=>[d.key,d])),O=[];for(let d=0;d<S.length;d++){let b=y[d],_=S[d],j=G.get(b);if(j)u.get(b).set(_),O.push(j),G.delete(b);else {let pt=$(_,{equals:o});u.set(b,pt);let Nn={...pt,set(){}},mt={key:b,nodes:[]};w(l,()=>{let Bn=n(Nn,d),{nodes:Ln,instance:gt}=Y(Bn);mt.nodes=Ln,gt&&queueMicrotask(()=>ee(gt));}),O.push(mt);}}for(let[d,b]of G)be(b.nodes),u.delete(d);let B=null;for(let d=O.length-1;d>=0;d--){let b=O[d].nodes;for(let _=b.length-1;_>=0;_--){let j=b[_];(j.parentNode!==c||j.nextSibling!==B)&&c.insertBefore(j,B),B=j;}}a=O;});return M(c,p),c}function Ge(e,t,n,r){if(typeof e=="function")return jt(e,t,n,r);let{each:o,keyFn:s,equals:i,tagName:c,children:l,...a}=e??{};if(typeof s!="function")throw new Error('For: "keyFn" prop is required and must be a function');let u=$e(o),f=Fe(e??{},t);return jt(u,s,f,{...a,equals:i,tagName:c})}Ge[Ee]=e=>e!=="each";function Ht(e,t){if(typeof e=="string"&&(e=document.querySelector(e)),!e)throw new Error("mount: container not found");e instanceof DocumentFragment||(xe(e),e.innerHTML=""),K(t)?qe(e,t):t instanceof Node?e.appendChild(t):e.appendChild(document.createTextNode(String(t)));}var Xn={abortEarly:true};function Xe(e,t){if(t===void 0)return e;let n=e?.cause?.key?`${t}.${e.cause.key}`:`${t}`;return {message:`Error parsing key "${n}": ${e.message}`,cause:{key:n}}}function Jn(e,t,n){if(e.errors?.length)for(let r=0;r<e.errors.length;r++)t.push(Xe(e.errors[r],n));}function qt(e,t,n,r){if(n!==false){let o=Xe(e.error,t);return {success:false,error:o,errors:[o]}}Jn(e,r,t);}function Re(e){return e?.abortEarly!==void 0?e:Xn}function Ve(e,t){x(e,"_parse",(n,r,o)=>{let s=n(r,o);return !s.success&&t(r)?{success:true,data:r}:s});}var te=e=>typeof e=="string"||e instanceof String,Ye=e=>(typeof e=="number"||e instanceof Number)&&!Number.isNaN(e),ze=e=>e===true||e===false,Qn=e=>e instanceof Date&&!Number.isNaN(e.getTime()),Zn=e=>typeof e=="function",er=e=>Array.isArray(e),We=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Gt(e,t){let n=k(We,{...t,type:"object"});n._getDescription=()=>`object({ ${Object.entries(e).map(([o,s])=>`${o}: ${s._getDescription()}`).join(", ")} })`,n._getDefinition=()=>e;let r=n;return r.derive=function(o,{when:s="always"}={}){return x(this,"_parse",(i,c,l)=>{let a=i(c,l);if(!a.success)return a;let u=o(a.data,{context:l?.context});if(!We(u)){let f={message:`derive() callback must return a plain object of overrides, got ${u===null?"null":typeof u}`};return {success:false,error:f,errors:[f]}}if(s==="missing"){let f={...a.data};for(let p in u)f[p]===void 0&&(f[p]=u[p]);return {success:true,data:f}}return {success:true,data:{...a.data,...u}}}),this},x(n,"_parse",(o,s,i)=>{let c=o(s,i),{abortEarly:l}=Re(i);if(c.success===false)return c;let a={},u=[];for(let f in e){let p=e[f]._parse(c.data[f],i);if(p.success)a[f]=p.data;else {let m=qt(p,f,l,u);if(m)return m}}return u.length>0?{success:false,error:u[0],errors:u}:{success:true,data:a}}),r}function Je(e){return k(te,{...e,type:"string"})}function Qe(e){return k(Ye,{...e,type:"number"})}function Ze(e){return k(ze,{...e,type:"boolean"})}function et(e){return k(Qn,{...e,type:"date"})}function Vt(e){return k(Zn,{...e,type:"function"})}function Yt(e,t){let n=i=>e.includes(i),r=i=>`Invalid ${o} value. Expected ${e.map(c=>`"${c}"`).join(" | ")}, received "${i}".`,o="enum",s=k(n,{message:r,...t,type:o});return s._getDescription=()=>`enum(${e.map(i=>`"${i}"`).join(" | ")})`,s._getDefinition=()=>e,s}function zt(e,t){let n=k(er,{...t,type:"array"});return n._getDescription=()=>`array(${e._getDescription()})`,n._getDefinition=()=>e,x(n,"_parse",(r,o,s)=>{let i=r(o,s),{abortEarly:c}=Re(s);if(i.success===false)return i;let l=[],a=[],u=s;for(let f=0;f<i.data.length;f++){let p={...u,context:{...u?.context,index:f}},m=e._parse(i.data[f],p);if(m.success)l.push(m.data);else {let h=qt(m,f,c,a);if(h)return h}}return a.length>0?{success:false,error:a[0],errors:a}:{success:true,data:l}}),n}function Wt(){return k(()=>true)}function z(e,t){return x(t,"_parse",(n,r,o)=>(r=e(r),n(r,o))),t}function Xt(e,t){let n=o=>`Invalid union value. Expected the value to match one of the schemas:${e.map((s,i)=>` ${i+1}. ${s._getDescription()}`).join(",")} but received "${typeof o}" with value: ${We(o)?JSON.stringify(o):`"${o}"`}`,r=k(()=>false,{message:n,...t,type:"union"});return r._getDefinition=()=>e,x(r,"_parse",(o,s,i)=>{let c=i,l=[];for(let p=0;p<e.length;p++){let m=e[p]._parse(s,c);if(m.success)return m;l.push(m);}let{abortEarly:a}=Re(c),u={message:typeof n=="function"?n(s):n};if(a!==false)return {success:false,error:u,errors:[u]};let f=[];for(let p=0;p<l.length;p++){let m=l[p].errors;if(m?.length)for(let h=0;h<m.length;h++)m[h].cause?.key&&f.push(Xe(m[h],`branch ${p}`));}return f.length===0&&f.push(u),{success:false,error:f[0],errors:f}}),r}function Jt(e,t){let n=k(r=>r===e,{message:r=>t?.message?typeof t.message=="function"?t.message(r):t.message:`Expected literal value "${e}", received "${r}"`,name:t?.name,type:"literal"});return n._getDescription=()=>`literal("${e}")`,n._getDefinition=()=>e,n}function Qt(e){let t=k(()=>true,{type:"contextRef"});return t._getDescription=()=>`contextRef("${e}")`,x(t,"_parse",(n,r,o)=>({success:true,data:o?.context?.[e]})),t}function Zt(e,t){return {parse(n,r){let o=e.parse(r?.context??{},r);return t(o).parse(n,r)},safeParse(n,r){let o=e.safeParse(r?.context??{},r);return o.success?t(o.data).safeParse(n,r):o}}}var en={boolean(e){let t=e?.message??(n=>`Cannot cast "${n}" to boolean. Accepted: true/false, 1/0, yes/no, on/off.`);return z(n=>{let r;return te(n)&&(r=n.toLowerCase()),r==="true"||r==="yes"||r==="on"||r==="1"||n===1?true:r==="false"||r==="no"||r==="off"||r==="0"||n===0?false:n},Ze({...e,message:t}))},number(e){let t=e?.message??(n=>`Cannot cast "${n}" to a number. Expected a numeric string or number.`);return z(n=>{if(ze(n))return Number(n);if(te(n)){let r=n.trim();if(r==="")return n;let o=Number(r);if(Number.isFinite(o))return o}return n},Qe({...e,message:t}))},string(e){let t=e?.message??(n=>`Cannot cast "${n}" to string. Expected a string, number, or boolean.`);return z(n=>ze(n)||Ye(n)&&Number.isFinite(n)?String(n):n,Je({...e,message:t}))},date(e){let t=e?.message??(n=>`Cannot cast "${n}" to a valid date.`);return z(n=>{let r;return te(n)&&(r=n.trim()),Ye(n)&&Number.isFinite(n)||r?new Date(r??n):n},et({...e,message:t}))},json(e,t){let n=t?.message??(r=>`Cannot parse "${r}" as JSON.`);return x(e,"_parse",(r,o,s)=>{if(te(o))try{o=JSON.parse(o);}catch{let i={message:typeof n=="function"?n(o):n};return {success:false,error:i,errors:[i]}}return r(o,s)}),e}},tn={},g={object:Gt,string:Je,number:Qe,boolean:Ze,date:et,function:Vt,enum:Yt,array:zt,any:Wt,preprocess:z,union:Xt,literal:Jt,contextRef:Qt,withContext:Zt,coerce:tn,cast:en};function Kt(e){return t=>`The value "${t}" must be type of ${e} but is type of "${typeof t}".`}function x(e,t,n){let r=e[t];e[t]=(...o)=>n(r,...o);}function k(e,{type:t="any",name:n,message:r}={}){r=r||Kt(t);let o={name:n,message:r,type:t},s={_getName(){return n},_getType(){return t},_getDescription(){return this._getName()??this._getType()},_parse(i,c){let l=e(i);if(l===true)return {success:true,data:i};if(typeof l=="object"&&l?.success===true)return l;let a={message:typeof r=="function"?r(i):r};return {success:false,error:a,errors:[a]}},parse(i,c){let l=this._parse(i,c);if(!l.success)throw l=l,new Error(l.error.message,{cause:l.error.cause});return l.data},safeParse(i,c){return this._parse(i,c)},transform(i){return x(this,"_parse",(c,l,a)=>{let u=c(l,a);return u.success&&(u.data=i(u.data)),u}),this},optional(){return Ve(this,i=>i===void 0),this},nullable(){return Ve(this,i=>i===null),this},nullish(){return Ve(this,i=>i==null),this},default(i){return x(this,"_parse",(c,l,a)=>(l===void 0&&(l=typeof i=="function"?i({context:a?.context}):i),c(l,a))),this},catch(i){return x(this,"_parse",(c,l,a)=>{let u=c(l,a);return u.success?u:{success:true,data:typeof i=="function"?i({input:l,error:u.error}):i}}),this},pipe(i){return x(this,"_parse",(c,l,a)=>{let u=c(l,a);return u.success?i._parse(u.data,a):u}),this},refine(i,{message:c,type:l,jsonSchema:a}={}){if(l&&(c=c||Kt(l),t=l),a){let u=[...this._getJsonSchemaHints?.()??[],a];this._getJsonSchemaHints=()=>u;}return x(this,"_parse",(u,f,p)=>{let m=u(f,p),{abortEarly:h}=Re(p);if(!m.success)return m;let S=i(m.data);if(S===true||typeof S=="object"&&S?.success===true)return m;let y={message:typeof c=="function"?c(f):c};return {success:false,error:y,errors:[y]}}),this},clone(){return {...this}}};return Ut.length>0?Ut.reduce((i,c)=>c(i,e,o)??i,s):s}var Ut=[];var tt=rt(),nt=rt(),nn=rt(),tr=Array.from({length:256},(e,t)=>(t<=15?"0":"")+t.toString(16));function rt(){return Math.floor(Math.random()*16777215)}function nr(){return nt=(nt+1)%16777215,nt}function C(){let e=Math.floor(Date.now()/1e3);e=parseInt(e,10)%4294967295;let t=nr(),n=String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255,tt>>16&255,tt>>8&255,tt&255,nn>>8&255,nn&255,t>>16&255,t>>8&255,t&255),r="";for(let o=0;o<n.length;o++)r+=tr[n.charCodeAt(o)];return r}var ot=Symbol("block-element"),rr=Symbol("block-element-body"),ne=Symbol("selectable-element");function st(e,t){let n=e;for(n?.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n[t]===void 0;)n=n.parentElement;return n??null}function it(e){return e?st(e.startContainer,ot):null}function ke(e){return st(e,ot)}function rn(e){return e?st(e.startContainer,ne):null}function or(e){return e?e[ne]!==void 0?[e]:[...e.children].filter(t=>t[ne]!==void 0):[]}function sr(e,t){return t?or(e).indexOf(t):-1}function re(e,t){let n=rn(t);return !n||!e?.contains(n)?null:{element:n,index:sr(e,n)}}function on(){return window.getSelection()}function U(){let e=on();return e.rangeCount>0?e.getRangeAt(0).cloneRange():null}function ct(){let e=U();if(!e)return 0;e.collapse(true);let t=rn(e),n=it(e),r=t??W(n);return _e(r,e.startContainer,e.startOffset)}function _e(e,t,n){if(!e)return 0;if(t===e){if(t.nodeType===Node.TEXT_NODE)return n;let i=0,c=e.childNodes,l=Math.min(n,c.length);for(let a=0;a<l;a++)i+=c[a].textContent.length;return i}if(t.nodeType===Node.ELEMENT_NODE&&!e.contains(t))return 0;let r=0,o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),s=o.nextNode();for(;s;){if(s===t)return r+n;r+=s.textContent.length,s=o.nextNode();}return r}function ir(e,t){let n=document.createRange();if(!e)return n;if(t<=0)return n.setStart(e,0),n.collapse(true),n;let r=0,o=[e];for(;o.length>0;){let s=o.pop();if(s.nodeType===Node.TEXT_NODE){let i=s.textContent.length;if(r+i>=t)return n.setEnd(s,t-r),n.setStart(s,t-r),n;r+=i;}else if(s.childNodes&&s.childNodes.length>0)for(let i=s.childNodes.length-1;i>=0;i--)o.push(s.childNodes[i]);}return n.setEnd(e,e.childNodes.length),n.setStart(e,e.childNodes.length),n}function D(e,t){let n=ir(e,t),r=on();r.removeAllRanges(),r.addRange(n);}function W(e){if(!e)return null;let t=cr(e);return t?.firstElementChild??t?.firstChild}function oe(e){if(!e?.[ot])return null;let t=W(e);return t?ye(t)?.classInstance:null}function cr(e){if(!e)return null;for(let t of e.children)if(t[rr])return t;return null}var se={KEYDOWN:"mrakomor:keydown",INPUT:"mrakomor:input",TRANSFORM_BLOCK_ELEMENT:"mrakomor:transform-block-element"};var sn=Ke();var Ie=class extends Ft{state;element;mrakomor;constructor(t){super(t);let{state:n,observeDOMChanges:r=true}=t??{};this.state=n,this.element=null,this.mrakomor=Ue(sn),this._stale=false,this._observer=null,this._offInputStale=null,this._onInputMarkStale=null,this._observeDOMChanges=r;}static get NAMESPACE(){return "namespace.AbstractComponent"}static getStateSchema(){return g.object({component:g.string().default(this.NAMESPACE),properties:g.object().default({}),settings:g.object().default({})}).default({})}static getPropsSchema(){return g.object({state:this.getStateSchema(),observeDOMChanges:g.boolean().default(true)}).default({})}parseFromHTML(t){return this.constructor.getStateSchema(t).parse()}getState(){if(this._stale){let t=this.element;return this.parseFromHTML(t)}return this.state.peek()}isStale(){return this._stale}#e(){this._stale=true;}onMount(){!this.element||!this._observeDOMChanges||(this._observer=new MutationObserver(()=>{this.#e();}),this._observer.observe(this.element,{subtree:true,characterData:true,characterDataOldValue:true,childList:true,attributes:true,attributeOldValue:true}),this._onInputMarkStale=t=>{let n=t.target;n instanceof Node&&this.element?.contains(n)&&this.#e();},this.mrakomor?.emitter&&(this._offInputStale=this.mrakomor.emitter.on(se.INPUT,this._onInputMarkStale)));}onUnmount(){this._observer&&(this._observer.disconnect(),this._observer=null),this._offInputStale?.(),this._offInputStale=null,this._onInputMarkStale=null,this._stale=false;}};var X="molecule.paragraph.Paragraph",ie="molecule.list.List";var cn="molecule.headline.";function E(e){return e===`
|
|
3
3
|
`||e===`\r
|
|
4
|
-
`?"":e??""}function
|
|
5
|
-
`);let i=t.length;t+=h(o?.text);for(let a of o?.inlineStyleRanges??[])n.push({...a,offset:a.offset+i});for(let a of o?.entityRanges??[])r.push({...a,offset:a.offset+i});}),{text:t,inlineStyleRanges:n,entityRanges:r}}function T(e){return {properties:{text:e?.text??"",inlineStyleRanges:e?.inlineStyleRanges??[],entityRanges:e?.entityRanges??[]}}}function an(e){let t=e?.component??"";return t===W||t.startsWith(nn)}function Ne(e){return Array.isArray(e?.properties?.items)}function rr(e,t){let n=new Set([0,t]);for(let r of e)n.add(r.offset),n.add(r.offset+r.length);return [...n].sort((r,o)=>r-o)}function rn(e,t,n){return e.filter(r=>r.offset<=t&&r.offset+r.length>=n)}function or(e,t,n,{inlineStyleComponents:r,entityRangeComponents:o}){let s=e;for(let i of t){let a=r.find(c=>c.match(i));a&&(s=K(a,{},s));}for(let i of n){let a=o.find(c=>c.match(i));a&&(s=K(a,i,s));}return s}function cn(e,{inlineStyleComponents:t,entityRangeComponents:n}){let r=document.createDocumentFragment(),o=h(e.properties.text),s=e.properties.inlineStyleRanges??[],i=e.properties.entityRanges??[];if(!o)return r;let a=rr([...s,...i],o.length);for(let c=0;c<a.length-1;c+=1){let l=a[c],u=a[c+1];if(l>=u)continue;let f=o.slice(l,u),p=or(f,rn(s,l,u),rn(i,l,u),{inlineStyleComponents:t,entityRangeComponents:n});Bt(r,p);}return r}function re(e,t,n,{inlineStyleComponents:r,entityRangeComponents:o}){let s=n;for(let i of e){if(i.nodeType===Node.TEXT_NODE){s+=i.textContent.length;continue}if(i.nodeType!==Node.ELEMENT_NODE||i.nodeName==="BR")continue;let a=r.find(l=>l.match(i));if(a){let l=i.textContent.length;t.properties.inlineStyleRanges.push({style:a.style,offset:s,length:l}),s=re(i.childNodes,t,s,{inlineStyleComponents:r,entityRangeComponents:o});continue}let c=o.find(l=>l.match(i));if(c){let l=i.textContent.length;t.properties.entityRanges.push({...c.getStateSchema(i).parse(),offset:s,length:l}),s=re(i.childNodes,t,s,{inlineStyleComponents:r,entityRangeComponents:o});continue}s=re(i.childNodes,t,s,{inlineStyleComponents:r,entityRangeComponents:o});}return s}function oe(e,t){let n=h(e.properties.text),r=h(t.properties.text);return {state:{...e,properties:{...t.properties,...e.properties,text:n+r,inlineStyleRanges:[...e.properties.inlineStyleRanges??[],...(t.properties.inlineStyleRanges??[]).map(o=>({...o,offset:o.offset+n.length}))],entityRanges:[...e.properties.entityRanges??[],...(t.properties.entityRanges??[]).map(o=>({...o,offset:o.offset+n.length}))]},settings:{...t.settings,...e.settings}},cursor:n.length}}function on(e,t){return (e??[]).filter(n=>n.offset<t).map(n=>({...n,length:Math.min(n.length,t-n.offset)}))}function sn(e,t){return (e??[]).filter(n=>n.offset+n.length>t).map(n=>({...n,offset:Math.max(0,n.offset-t),length:n.offset+n.length-Math.max(n.offset,t)}))}function ln(e,t){let n=structuredClone(e),r=structuredClone(e);return n.properties.text=e.properties.text.slice(0,t),r.properties.text=e.properties.text.slice(t),n.properties.inlineStyleRanges=on(e.properties.inlineStyleRanges,t),r.properties.inlineStyleRanges=sn(e.properties.inlineStyleRanges,t),n.properties.entityRanges=on(e.properties.entityRanges,t),r.properties.entityRanges=sn(e.properties.entityRanges,t),r.componentId=b(),{originalLineState:n,newLineState:r}}var ke=class extends be{static get NAMESPACE(){return "namespace.block.BlockComponent"}static get LABEL(){return ""}static get KEYWORDS(){return []}static get GROUP(){return "blocks"}isAtomic(){return false}setCursor(t){let n=()=>{if(!this.element?.isConnected)return;let r=typeof t=="number"?t:h(this.getState()?.properties?.text).length;Y(this.element,r);};n(),F(n);}onKeydown(t){}static toExchangeState(t){let n=t?.properties,r={text:h(n?.text)};return n?.inlineStyleRanges!==void 0&&(r.inlineStyleRanges=n.inlineStyleRanges),n?.entityRanges!==void 0&&(r.entityRanges=n.entityRanges),U({originComponent:this.NAMESPACE,properties:{items:[r]},settings:t?.settings})}static fromExchangeState(t){let n=t?.properties?.items?.[0];return {properties:{text:n?.text??"",inlineStyleRanges:n?.inlineStyleRanges??[],entityRanges:n?.entityRanges??[]},settings:t?.settings}}static appendExchangeState(t,n){let r=Ce(n?.properties?.items);return oe(t,T(r))}};function un(){return m.object({length:m.number(),offset:m.number(),style:m.string()})}function fn({type:e,data:t=m.any(),length:n,offset:r}={}){let o=e!=null,s=m.object({type:o?m.string().default(e):m.string(),data:t}),i=n??(o?0:void 0),a=r??(o?0:void 0);return m.object({entity:o?s.default({}):s,length:i==null?m.number():m.number().default(i),offset:a==null?m.number():m.number().default(a)})}function mn(e){if(e?.nodeName==="OL")return "ORDERED";if(e?.nodeName==="UL")return "UNORDERED"}function rt(e=[]){let t=new Set;return e.map(n=>{if(n?.componentId&&!t.has(n.componentId))return t.add(n.componentId),n;let r=b();return t.add(r),{...n,componentId:r}})}function dn(e){return e?[...e.children].filter(t=>t.nodeName==="LI"):[]}function ot(e,t){return !e||!t?0:tt(e,t.startContainer,t.startOffset)}function gn(e,t){let n=T(e),{originalLineState:r,newLineState:o}=ln(n,t);return {before:{componentId:e.componentId,depth:e.depth??0,text:r.properties.text,inlineStyleRanges:r.properties.inlineStyleRanges??[],entityRanges:r.properties.entityRanges??[]},after:{componentId:b(),depth:e.depth??0,text:o.properties.text,inlineStyleRanges:o.properties.inlineStyleRanges??[],entityRanges:o.properties.entityRanges??[]}}}function hn(e,{style:t="UNORDERED"}={}){let n=e?.properties?.items,r=Array.isArray(n)&&n.length?n.map(o=>({componentId:o?.componentId??b(),depth:o?.depth??0,text:h(o?.text??""),inlineStyleRanges:[...o?.inlineStyleRanges??[]],entityRanges:[...o?.entityRanges??[]]})):[{componentId:b(),depth:0,text:h(e?.properties?.text??""),inlineStyleRanges:[...e?.properties?.inlineStyleRanges??[]],entityRanges:[...e?.properties?.entityRanges??[]]}];return {component:Re,componentId:b(),properties:{items:r},settings:{style:t==="ORDERED"?"ORDERED":"UNORDERED"}}}function st(e,t,{namespace:n=W,Constructor:r}={}){let o=e.properties?.items??[],s=o[t];if(!s)return {blocks:[e],paragraphIndex:0};let i=o.slice(0,t),a=o.slice(t+1),c=U({properties:{text:s.text,inlineStyleRanges:s.inlineStyleRanges,entityRanges:s.entityRanges}}),l={component:n,componentId:b(),settings:{},...r?.fromExchangeState(c)??T(s)},u=[];return i.length&&u.push({...e,properties:{...e.properties,items:i}}),u.push(l),a.length&&u.push({...e,componentId:i.length?b():e.componentId,properties:{...e.properties,items:a}}),{blocks:u,paragraphIndex:i.length?1:0}}function pn(e){return Ne(e)?e.settings?.style==="ORDERED"?"ORDERED":"UNORDERED":null}function sr(e,t){let n=pn(e),r=pn(t);return n!=null&&n===r}function yn(e,t,n){if(t<0||n!==t+1||n>=e.length)return null;let r=e[t],o=e[n];if(!sr(r,o))return null;let s=[...r.properties?.items??[]],i=[...o.properties?.items??[]];if(i.length===0){let p=[...e];p.splice(n,1);let d=s.length-1,y=d>=0?h(s[d]?.text).length:0;return {content:p,listIndex:t,cursor:y}}let[a,...c]=i,l=0;if(s.length===0)s.push(a,...c),l=0;else {let p=s.length-1,d=s[p],y=T(d),N=T(a),{state:E,cursor:B}=oe(y,N);s[p]={...d,text:E.properties.text,inlineStyleRanges:E.properties.inlineStyleRanges,entityRanges:E.properties.entityRanges},c.length&&s.push(...c),l=B;}let u={...r,properties:{...r.properties,items:rt(s)}},f=[...e];return f[t]=u,f.splice(n,1),{content:f,listIndex:t,cursor:l}}function En(e,t){let n=e.properties?.items??[],r=n.length-1;if(r<0)return null;let o=n[r],s=T(o),i=Ce(U({properties:t?.properties}).properties.items),a=T(i),{state:c,cursor:l}=oe(s,a);return {state:{...e,properties:{...e.properties,items:n.map((u,f)=>f===r?{...u,text:c.properties.text,inlineStyleRanges:c.properties.inlineStyleRanges,entityRanges:c.properties.entityRanges}:u)}},cursor:l}}function Sn(e,t){return cn({properties:{text:e?.text??"",inlineStyleRanges:e?.inlineStyleRanges??[],entityRanges:e?.entityRanges??[]}},t)}function xn(e,t){let n=Number(e.getAttribute("data-depth")??0)||0,r={properties:{text:h(e.innerText??e.textContent??""),inlineStyleRanges:[],entityRanges:[]}};return re(e.childNodes,r,0,t),{componentId:e.getAttribute("data-componentid")||void 0,depth:n,text:h(r.properties.text),inlineStyleRanges:r.properties.inlineStyleRanges,entityRanges:r.properties.entityRanges}}var _e=e=>m.object({componentId:m.string().default(()=>e?.getAttribute?.("data-componentid")||b()),depth:m.number().default(0),text:m.string().default(""),inlineStyleRanges:m.array(un()).default([]),entityRanges:m.array(fn()).default([])}).default({}),Ie=class e extends ke{static get NAMESPACE(){return Re}static get LABEL(){return "List"}static get GROUP(){return "lists"}getInlineStyleComponents(){return this.props?.inlineStyles?.get()??this.mrakomor.getConfig()?.inlineStyles??[]}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}static getStateSchema(t){let n=mn(t);return m.object({component:m.string().default(e.NAMESPACE),componentId:m.string().default(t?.getAttribute("data-componentid")||b()),properties:m.object({items:m.array(_e()).default([_e().parse()]).transform(rt)}).default({}),settings:m.object({style:m.enum(["ORDERED","UNORDERED"]).default(n??"UNORDERED")}).default({})}).default({})}static toExchangeState(t){let r=(t?.properties?.items??[]).map(o=>{let s={componentId:o?.componentId,text:h(o?.text),depth:o?.depth??0};return o?.inlineStyleRanges!==void 0&&(s.inlineStyleRanges=o.inlineStyleRanges),o?.entityRanges!==void 0&&(s.entityRanges=o.entityRanges),s});return U({originComponent:this.NAMESPACE,properties:{items:r},settings:t?.settings})}static fromExchangeState(t){return hn(t,{style:t?.settings?.style})}static appendExchangeState(t,n){return En(t,n)}parseFromHTML(t){if(!t)return this.constructor.getStateSchema(t).parse();let n=structuredClone(this.constructor.getStateSchema(t).parse()),r={inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()},o=dn(t);if(o.length)n.properties.items=o.map(s=>_e(s).parse(xn(s,r)));else {let s=this.state?.peek?.()?.properties?.items;n.properties.items=s?.length?structuredClone(s):[_e().parse()];}return n.settings={...n.settings,style:t.nodeName==="OL"?"ORDERED":t.nodeName==="UL"?"UNORDERED":this.state?.peek()?.settings?.style??n.settings?.style??"UNORDERED"},n}_commitState(t){let n=Se(this.element)??this.mrakomor._getBlockElementByComponentId(t.componentId),r=this.mrakomor._getBlockElementIndex(n);if(r===-1)return;let o=this.mrakomor.getContent();o.splice(r,1,t),this.mrakomor.setContent(o);}_buildItemContent(t){return Sn(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-"),n=this.state.peek(),r=n.settings?.style==="ORDERED"?"ol":"ul",o=Ue(()=>this.state.get().properties?.items??[],(s,i)=>s.componentId??String(i),(s,i)=>K("li",{contentEditable:true,[ee]:true,"data-componentid":()=>s.get().componentId,"data-item-index":()=>{let a=s.get()?.componentId,l=(this.state.get().properties?.items??[]).findIndex(u=>u.componentId===a);return String(l>=0?l:i)},"data-depth":()=>String(s.get()?.depth??0),$dangerouslySetInnerHTML:()=>{let a=s.get(),c=a?.text??"";return h(c)?w(()=>this._buildItemContent(a)):"<br>"}}),{tagName:r});return o.className=t,n.componentId&&o.setAttribute("data-componentid",n.componentId),this.element=o,o}onKeydown(t){if(t.key==="Enter"){this.#r(t);return}t.key==="Backspace"&&this.#t(t);}setCursor(t){let n=this.getState()?.properties?.items??[],r=n.length-1;if(r<0)return;let o=typeof t=="number"?t:h(n[r]?.text).length,s=()=>{let i=this.element?.querySelector(`li[data-item-index="${r}"]`);i?.isConnected&&Y(i,o);};s(),F(s);}#e(t){let n=this.getState(),r=[...n.properties.items??[]],o=r[t];if(!o)return;if((o.depth??0)>0){r[t]={...o,depth:o.depth-1},this._commitState({...n,properties:{...n.properties,items:r}});let f=()=>{let p=this.element?.querySelector(`li[data-item-index="${t}"]`);p?.isConnected&&Y(p,0);};f(),F(f);return}let s=Se(this.element),i=this.mrakomor._getBlockElementIndex(s),a=s?.previousElementSibling??null,c=a?this.mrakomor._getBlockElementIndex(a):-1;if(t===0&&c>=0&&i===c+1){let f=this.mrakomor.getContent(),p=yn(f,c,i);if(p){this.mrakomor._setContentState(p.content.map(d=>this.mrakomor.normalizeComponentState(d))),nt(a)?.setCursor?.(p.cursor);return}}let{blocks:l,paragraphIndex:u}=st(n,t,{Constructor:this.mrakomor.register.blocks.getByNamespace(W)});this.mrakomor.command.replaceBlockElement({blockElement:Se(this.element),blocks:l,cursor:0,cursorBlockIndex:u});}#r(t){t.preventDefault();let n=ne(),r=te(this.element,n);if(!r)return;let{element:o,index:s}=r,i=ot(o,n),a=this.getState(),c=[...a.properties.items??[]],l=c[s];if(!l)return;if(!h(l.text)){this.#e(s);return}let{before:u,after:f}=gn(l,i);c.splice(s,1,u,f),this._commitState({...a,properties:{...a.properties,items:c}}),F(()=>{let p=this.element?.querySelector(`li[data-item-index="${s+1}"]`);p&&Y(p,0);});}#t(t){let n=ne();if(!n?.collapsed)return;let r=te(this.element,n);if(!r){let a=n.startContainer;if(!(a===this.element||this.element?.contains?.(a)))return;t.preventDefault(),this.#e(0);return}let{element:o,index:s}=r;ot(o,n)===0&&(t.preventDefault(),this.#e(s));}};function ir(e){let{mrakomor:t,blockElement:n,namespace:r}=e;if(!t||!n||!r)return;let o=t._getBlockElementState(n);if(!o||!an({component:r})||!Ne(o))return;e.preventDefault();let i=nt(n)?.element,a=e.range??ne(),c=te(i,a);if(!c)return;let{index:l}=c,{blocks:u,paragraphIndex:f}=st(o,l,{namespace:r,Constructor:t.register.blocks.getByNamespace(r)});t.command.replaceBlockElement({blockElement:n,blocks:u,cursor:0,cursorBlockIndex:f});}function ar(e){return {resolveConfig:t=>(t.blockComponents.push({component:e,label:"UL",keywords:["ul","unordered","bullet"],order:100,settings:{style:"UNORDERED"}},{component:e,label:"OL",keywords:["ol","ordered","number"],order:101,settings:{style:"ORDERED"}}),t),resolveComponent:t=>{if(t===e.NAMESPACE)return e},registerCommands(t){t.emitter.on(xe.TRANSFORM_BLOCK_ELEMENT,ir);}}}function cr(){return ar(Ie)}exports.List=Ie;exports.listPlugin=cr;
|
|
4
|
+
`?"":e??""}function q({component:e,originComponent:t,properties:n,settings:r}={}){let o=n??{},s=Array.isArray(o.items)?o.items:[{text:o.text??"",inlineStyleRanges:o.inlineStyleRanges??[],entityRanges:o.entityRanges??[]}];return {...e?{component:e}:{},...t?{originComponent:t}:{},properties:{items:s},...r?{settings:r}:{}}}function fn(e){let t="",n=[],r=[];return (e??[]).forEach((o,s)=>{s>0&&(t+=`
|
|
5
|
+
`);let i=t.length;t+=E(o?.text);for(let c of o?.inlineStyleRanges??[])n.push({...c,offset:c.offset+i});for(let c of o?.entityRanges??[])r.push({...c,offset:c.offset+i});}),{text:t,inlineStyleRanges:n,entityRanges:r}}function T(e){return {properties:{text:e?.text??"",inlineStyleRanges:e?.inlineStyleRanges??[],entityRanges:e?.entityRanges??[]}}}function pn({mrakomor:e,resultIndex:t,cursor:n,fallbackBlockElement:r,itemIndex:o}){let s=()=>{if(typeof n!="number")return;let i=e._getBlockElements()[t]??r,c=oe(i);if(c?.setCursor){c.setCursor({cursor:n,itemIndex:o});return}let l=W(i);l?.isConnected&&D(l,n);};s(),N(s);}function lt(e){let t=e?.component??"";return t===X||t.startsWith(cn)}function Ne(e){return Array.isArray(e?.properties?.items)}function lr(e,t){let n=new Set([0,t]);for(let r of e)n.add(r.offset),n.add(r.offset+r.length);return [...n].sort((r,o)=>r-o)}function ln(e,t,n){return e.filter(r=>r.offset<=t&&r.offset+r.length>=n)}function ar(e,t,n,{inlineStyleComponents:r,entityRangeComponents:o}){let s=e;for(let i of t){let c=r.find(l=>l.match(i));c&&(s=V(c,{},s));}for(let i of n){let c=o.find(l=>l.match(i));c&&(s=V(c,i,s));}return s}function mn(e,{inlineStyleComponents:t,entityRangeComponents:n}){let r=document.createDocumentFragment(),o=E(e.properties.text),s=e.properties.inlineStyleRanges??[],i=e.properties.entityRanges??[];if(!o)return r;let c=lr([...s,...i],o.length);for(let l=0;l<c.length-1;l+=1){let a=c[l],u=c[l+1];if(a>=u)continue;let f=o.slice(a,u),p=ar(f,ln(s,a,u),ln(i,a,u),{inlineStyleComponents:t,entityRangeComponents:n});Ht(r,p);}return r}function ce(e,t,n,{inlineStyleComponents:r,entityRangeComponents:o}){let s=n;for(let i of e){if(i.nodeType===Node.TEXT_NODE){s+=i.textContent.length;continue}if(i.nodeType!==Node.ELEMENT_NODE||i.nodeName==="BR")continue;let c=r.find(a=>a.match(i));if(c){let a=i.textContent.length;t.properties.inlineStyleRanges.push({style:c.style,offset:s,length:a}),s=ce(i.childNodes,t,s,{inlineStyleComponents:r,entityRangeComponents:o});continue}let l=o.find(a=>a.match(i));if(l){let a=i.textContent.length;t.properties.entityRanges.push({...l.getStateSchema(i).parse(),offset:s,length:a}),s=ce(i.childNodes,t,s,{inlineStyleComponents:r,entityRangeComponents:o});continue}s=ce(i.childNodes,t,s,{inlineStyleComponents:r,entityRangeComponents:o});}return s}function le(e,t){let n=E(e.properties.text),r=E(t.properties.text);return {state:{...e,properties:{...t.properties,...e.properties,text:n+r,inlineStyleRanges:[...e.properties.inlineStyleRanges??[],...(t.properties.inlineStyleRanges??[]).map(o=>({...o,offset:o.offset+n.length}))],entityRanges:[...e.properties.entityRanges??[],...(t.properties.entityRanges??[]).map(o=>({...o,offset:o.offset+n.length}))]},settings:{...t.settings,...e.settings}},cursor:n.length}}function an(e,t){return (e??[]).filter(n=>n.offset<t).map(n=>({...n,length:Math.min(n.length,t-n.offset)}))}function un(e,t){return (e??[]).filter(n=>n.offset+n.length>t).map(n=>({...n,offset:Math.max(0,n.offset-t),length:n.offset+n.length-Math.max(n.offset,t)}))}function gn(e,t){let n=structuredClone(e),r=structuredClone(e);return n.properties.text=e.properties.text.slice(0,t),r.properties.text=e.properties.text.slice(t),n.properties.inlineStyleRanges=an(e.properties.inlineStyleRanges,t),r.properties.inlineStyleRanges=un(e.properties.inlineStyleRanges,t),n.properties.entityRanges=an(e.properties.entityRanges,t),r.properties.entityRanges=un(e.properties.entityRanges,t),r.componentId=C(),{originalLineState:n,newLineState:r}}var Be=class extends Ie{static get NAMESPACE(){return "namespace.block.BlockComponent"}static get LABEL(){return ""}static get KEYWORDS(){return []}static get GROUP(){return "blocks"}isAtomic(){return false}setCursor({cursor:t}={}){let n=()=>{if(!this.element?.isConnected)return;let r=typeof t=="number"?t:E(this.getState()?.properties?.text).length;D(this.element,r);};n(),N(n);}onKeydown(t){}static toExchangeState(t){let n=t?.properties,r={text:E(n?.text)};return n?.inlineStyleRanges!==void 0&&(r.inlineStyleRanges=n.inlineStyleRanges),n?.entityRanges!==void 0&&(r.entityRanges=n.entityRanges),q({originComponent:this.NAMESPACE,properties:{items:[r]},settings:t?.settings})}static fromExchangeState(t){let n=t?.properties?.items?.[0];return {properties:{text:n?.text??"",inlineStyleRanges:n?.inlineStyleRanges??[],entityRanges:n?.entityRanges??[]},settings:t?.settings}}static appendExchangeState(t,n){let r=fn(n?.properties?.items);return le(t,T(r))}};function dn(e,t,n){let r=e._getBlockElementIndex(t);if(r===-1)return false;let o=e.getContent();return o.splice(r,1,e.normalizeComponentState(n)),e._setContentState(o),true}function hn(){return g.object({length:g.number(),offset:g.number(),style:g.string()})}function En({type:e,data:t=g.any(),length:n,offset:r}={}){let o=e!=null,s=g.object({type:o?g.string().default(e):g.string(),data:t}),i=n??(o?0:void 0),c=r??(o?0:void 0);return g.object({entity:o?s.default({}):s,length:i==null?g.number():g.number().default(i),offset:c==null?g.number():g.number().default(c)})}function Sn(e){if(e?.nodeName==="OL")return "ORDERED";if(e?.nodeName==="UL")return "UNORDERED"}function Le(e=[]){let t=new Set;return e.map(n=>{if(n?.componentId&&!t.has(n.componentId))return t.add(n.componentId),n;let r=C();return t.add(r),{...n,componentId:r}})}function xn(e){return e?[...e.children].filter(t=>t.nodeName==="LI"):[]}function at(e,t){return !e||!t?0:_e(e,t.startContainer,t.startOffset)}function Cn(e,t){let n=T(e),{originalLineState:r,newLineState:o}=gn(n,t);return {before:{componentId:e.componentId,depth:e.depth??0,text:r.properties.text,inlineStyleRanges:r.properties.inlineStyleRanges??[],entityRanges:r.properties.entityRanges??[]},after:{componentId:C(),depth:e.depth??0,text:o.properties.text,inlineStyleRanges:o.properties.inlineStyleRanges??[],entityRanges:o.properties.entityRanges??[]}}}function bn(e,{style:t="UNORDERED"}={}){let n=e?.properties?.items,r=Array.isArray(n)&&n.length?n.map(o=>({componentId:o?.componentId??C(),depth:o?.depth??0,text:E(o?.text??""),inlineStyleRanges:[...o?.inlineStyleRanges??[]],entityRanges:[...o?.entityRanges??[]]})):[{componentId:C(),depth:0,text:E(e?.properties?.text??""),inlineStyleRanges:[...e?.properties?.inlineStyleRanges??[]],entityRanges:[...e?.properties?.entityRanges??[]]}];return {component:ie,componentId:C(),properties:{items:r},settings:{style:t==="ORDERED"?"ORDERED":"UNORDERED"}}}function ut(e,t,{namespace:n=X,Constructor:r}={}){let o=e.properties?.items??[],s=o[t];if(!s)return {blocks:[e],paragraphIndex:0};let i=o.slice(0,t),c=o.slice(t+1),l=q({properties:{text:s.text,inlineStyleRanges:s.inlineStyleRanges,entityRanges:s.entityRanges}}),a={component:n,componentId:C(),settings:{},...r?.fromExchangeState(l)??T(s)},u=[];return i.length&&u.push({...e,properties:{...e.properties,items:i}}),u.push(a),c.length&&u.push({...e,componentId:i.length?C():e.componentId,properties:{...e.properties,items:c}}),{blocks:u,paragraphIndex:i.length?1:0}}function yn(e){return Ne(e)?e.settings?.style==="ORDERED"?"ORDERED":"UNORDERED":null}function ft(e,t){let n=yn(e),r=yn(t);return n!=null&&n===r}function Rn(e,t,n){if(t<0||n!==t+1||n>=e.length)return null;let r=e[t],o=e[n];if(!ft(r,o))return null;let s=[...r.properties?.items??[]],i=[...o.properties?.items??[]];if(i.length===0){let p=[...e];p.splice(n,1);let m=s.length-1,h=m>=0?E(s[m]?.text).length:0;return {content:p,listIndex:t,cursor:h}}let[c,...l]=i,a=0;if(s.length===0)s.push(c,...l),a=0;else {let p=s.length-1,m=s[p],h=T(m),S=T(c),{state:y,cursor:P}=le(h,S);s[p]={...m,text:y.properties.text,inlineStyleRanges:y.properties.inlineStyleRanges,entityRanges:y.properties.entityRanges},l.length&&s.push(...l),a=P;}let u={...r,properties:{...r.properties,items:Le(s)}},f=[...e];return f[t]=u,f.splice(n,1),{content:f,listIndex:t,cursor:a}}function kn(e,t){let n=e.properties?.items??[],r=n.length-1;if(r<0)return null;let o=q({properties:t?.properties}).properties.items,[s,...i]=o,c=n[r],l=T(c),a=T(s),{state:u,cursor:f}=le(l,a),p=n.map((m,h)=>h===r?{...m,text:u.properties.text,inlineStyleRanges:u.properties.inlineStyleRanges,entityRanges:u.properties.entityRanges}:m);return i.length&&p.push(...i.map(m=>({componentId:m?.componentId??C(),depth:m?.depth??0,text:E(m?.text??""),inlineStyleRanges:m?.inlineStyleRanges??[],entityRanges:m?.entityRanges??[]}))),{state:{...e,properties:{...e.properties,items:Le(p)}},cursor:f,itemIndex:r}}function _n(e,t){return mn({properties:{text:e?.text??"",inlineStyleRanges:e?.inlineStyleRanges??[],entityRanges:e?.entityRanges??[]}},t)}function In(e,t){let n=Number(e.getAttribute("data-depth")??0)||0,r={properties:{text:E(e.innerText??e.textContent??""),inlineStyleRanges:[],entityRanges:[]}};return ce(e.childNodes,r,0,t),{componentId:e.getAttribute("data-componentid")||void 0,depth:n,text:E(r.properties.text),inlineStyleRanges:r.properties.inlineStyleRanges,entityRanges:r.properties.entityRanges}}var Ae=e=>g.object({componentId:g.string().default(()=>e?.getAttribute?.("data-componentid")||C()),depth:g.number().default(0),text:g.string().default(""),inlineStyleRanges:g.array(hn()).default([]),entityRanges:g.array(En()).default([])}).default({}),ae=class e extends Be{static get NAMESPACE(){return ie}static get LABEL(){return "List"}static get GROUP(){return "lists"}getInlineStyleComponents(){return this.props?.inlineStyles?.get()??this.mrakomor.getConfig()?.inlineStyles??[]}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}static getStateSchema(t){let n=Sn(t);return g.object({component:g.string().default(e.NAMESPACE),componentId:g.string().default(t?.getAttribute("data-componentid")||C()),properties:g.object({items:g.array(Ae()).default([Ae().parse()]).transform(Le)}).default({}),settings:g.object({style:g.enum(["ORDERED","UNORDERED"]).default(n??"UNORDERED")}).default({})}).default({})}static toExchangeState(t){let r=(t?.properties?.items??[]).map(o=>{let s={componentId:o?.componentId,text:E(o?.text),depth:o?.depth??0};return o?.inlineStyleRanges!==void 0&&(s.inlineStyleRanges=o.inlineStyleRanges),o?.entityRanges!==void 0&&(s.entityRanges=o.entityRanges),s});return q({originComponent:this.NAMESPACE,properties:{items:r},settings:t?.settings})}static fromExchangeState(t){return bn(t,{style:t?.settings?.style})}static appendExchangeState(t,n){return kn(t,n)}parseFromHTML(t){if(!t)return this.constructor.getStateSchema(t).parse();let n=structuredClone(this.constructor.getStateSchema(t).parse()),r={inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()},o=xn(t);if(o.length)n.properties.items=o.map(s=>Ae(s).parse(In(s,r)));else {let s=this.state?.peek?.()?.properties?.items;n.properties.items=s?.length?structuredClone(s):[Ae().parse()];}return n.settings={...n.settings,style:t.nodeName==="OL"?"ORDERED":t.nodeName==="UL"?"UNORDERED":this.state?.peek()?.settings?.style??n.settings?.style??"UNORDERED"},n}_commitState(t){let n=ke(this.element)??this.mrakomor._getBlockElementByComponentId(t.componentId);dn(this.mrakomor,n,t);}_buildItemContent(t){return _n(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-"),n=this.state.peek(),r=n.settings?.style==="ORDERED"?"ol":"ul",o=Ge(()=>this.state.get().properties?.items??[],(s,i)=>s.componentId??String(i),(s,i)=>V("li",{contentEditable:true,[ne]:true,"data-componentid":()=>s.get().componentId,"data-item-index":()=>{let c=s.get()?.componentId,a=(this.state.get().properties?.items??[]).findIndex(u=>u.componentId===c);return String(a>=0?a:i)},"data-depth":()=>String(s.get()?.depth??0),$dangerouslySetInnerHTML:()=>{let c=s.get(),l=c?.text??"";return E(l)?v(()=>this._buildItemContent(c)):"<br>"}}),{tagName:r});return o.className=t,n.componentId&&o.setAttribute("data-componentid",n.componentId),this.element=o,o}onKeydown(t){if(t.key==="Enter"){this.#r(t);return}t.key==="Backspace"&&this.#t(t);}setCursor({cursor:t,itemIndex:n}={}){let r=this.getState()?.properties?.items??[],o=r.length-1;if(o<0)return;let s=typeof n=="number"&&n>=0&&n<=o?n:o,i=typeof t=="number"?t:E(r[s]?.text).length,c=()=>{let l=this.element?.querySelector(`li[data-item-index="${s}"]`);l?.isConnected&&D(l,i);};c(),N(c);}#e(t){let n=this.getState(),r=[...n.properties.items??[]],o=r[t];if(!o)return;if((o.depth??0)>0){r[t]={...o,depth:o.depth-1},this._commitState({...n,properties:{...n.properties,items:r}});let f=()=>{let p=this.element?.querySelector(`li[data-item-index="${t}"]`);p?.isConnected&&D(p,0);};f(),N(f);return}let s=ke(this.element),i=this.mrakomor._getBlockElementIndex(s),c=s?.previousElementSibling??null,l=c?this.mrakomor._getBlockElementIndex(c):-1;if(t===0&&l>=0&&i===l+1){let f=this.mrakomor.getContent(),p=Rn(f,l,i);if(p){let m=p.content.map((h,S)=>S===p.listIndex?this.mrakomor.normalizeComponentState(h):h);this.mrakomor._setContentState(m),oe(c)?.setCursor?.({cursor:p.cursor});return}}let{blocks:a,paragraphIndex:u}=ut(n,t,{Constructor:this.mrakomor.register.blocks.getByNamespace(X)});this.mrakomor.command.replaceBlockElement({blockElement:ke(this.element),blocks:a,cursor:0,cursorBlockIndex:u});}#r(t){t.preventDefault();let n=U(),r=re(this.element,n);if(!r)return;let{element:o,index:s}=r,i=at(o,n),c=this.getState(),l=[...c.properties.items??[]],a=l[s];if(!a)return;if(!E(a.text)){this.#e(s);return}let{before:u,after:f}=Cn(a,i);l.splice(s,1,u,f),this._commitState({...c,properties:{...c.properties,items:l}}),N(()=>{let p=this.element?.querySelector(`li[data-item-index="${s+1}"]`);p&&D(p,0);});}#t(t){let n=U();if(!n?.collapsed)return;let r=re(this.element,n);if(!r){let c=n.startContainer;if(!(c===this.element||this.element?.contains?.(c)))return;t.preventDefault(),this.#e(0);return}let{element:o,index:s}=r;at(o,n)===0&&(t.preventDefault(),this.#e(s));}};function ur(e){let{mrakomor:t,blockElement:n,namespace:r}=e;if(!t||!n||!r)return;let o=t._getBlockElementState(n);if(!o||!lt({component:r})||!Ne(o))return;e.preventDefault();let i=oe(n)?.element,c=e.range??U(),l=re(i,c);if(!l)return;let{index:a}=l,{blocks:u,paragraphIndex:f}=ut(o,a,{namespace:r,Constructor:t.register.blocks.getByNamespace(r)});t.command.replaceBlockElement({blockElement:n,blocks:u,cursor:0,cursorBlockIndex:f});}function fr(e){if(e.key!=="Backspace")return;let t=U();if(!t?.collapsed)return;let n=it(t);if(!n)return;let r=W(n),o=!E(r?.textContent),s=t.startOffset===0||ct()===0||o;if(!o||!s)return;let i=n.previousSibling;if(!i)return;let{mrakomor:c}=e,l=c._getBlockElementIndex(n),a=c._getBlockElementIndex(i);if(l<0||a<0)return;let u=c._getBlockElementState(n),f=c._getBlockElementState(i);if(!u||!lt(u)||!f||f.component!==ie)return;let p=c.getContent(),m=p[l+1];if(!ft(f,m))return;let S=c.register.blocks.getByNamespace(m.component)?.toExchangeState?.(m),y=S&&ae.appendExchangeState(f,S);y&&(e.preventDefault(),p.splice(l,1),p.splice(a,2,c.normalizeComponentState(y.state)),c._setContentState(p),pn({mrakomor:c,resultIndex:a,cursor:y.cursor,fallbackBlockElement:i,itemIndex:y.itemIndex}));}function pr(e){return {resolveConfig:t=>(t.blockComponents.push({component:e,label:"UL",keywords:["ul","unordered","bullet"],order:100,settings:{style:"UNORDERED"}},{component:e,label:"OL",keywords:["ol","ordered","number"],order:101,settings:{style:"ORDERED"}}),t),resolveComponent:t=>{if(t===e.NAMESPACE)return e},registerCommands(t){t.emitter.on(se.TRANSFORM_BLOCK_ELEMENT,ur),t.emitter.on(se.KEYDOWN,fr);}}}function mr(){return pr(ae)}exports.List=ae;exports.listPlugin=mr;
|
package/dist/list.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{c as List,e as listPlugin}from'./chunk-
|
|
1
|
+
export{c as List,e as listPlugin}from'./chunk-5HWTMPF4.mjs';import'./chunk-S2W6LYHT.mjs';import'./chunk-GDDVUIEH.mjs';import'./chunk-JVQ2YGII.mjs';import'./chunk-ZHOZPQZH.mjs';import'./chunk-P7IKAZYZ.mjs';import'./chunk-FAXIFXQK.mjs';import'./chunk-B6JJAATK.mjs';import'./chunk-P7TUN2KD.mjs';import'./chunk-7CJLTNHZ.mjs';
|
package/dist/paragraph.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict';(function(){if(!(typeof document>"u")){var e="mrakomor/core/plugin/paragraph/Paragraph.css",t=Array.prototype.some.call(document.head.querySelectorAll("style[data-mrakomor-css-path]"),function(r){return r.getAttribute("data-mrakomor-css-path")===e});if(!t){var n=document.createElement("style");n.setAttribute("data-mrakomor-css",""),n.setAttribute("data-mrakomor-css-path",e),n.textContent=`.mrakomor-content p{margin-top:0}
|
|
2
|
-
`,document.head.appendChild(n);}}})();var Ge=class{next(...e){}error(...e){}complete(...e){}},pe=class{#e=new Set;pipe(...e){return e.reduce((t,n)=>n(t),this)}next(...e){Array.from(this.#e).forEach(t=>{typeof t=="function"?t(...e):t.next(...e);});}error(...e){Array.from(this.#e).forEach(t=>{t?.error?.(...e),this.unsubscribe(t);});}complete(...e){Array.from(this.#e).forEach(t=>{t?.complete?.(...e),this.unsubscribe(t);});}subscribe(e){return this.#e.add(e),{unsubscribe:()=>{this.unsubscribe(e);}}}unsubscribe(e){this.#e.delete(e);}};var X=Symbol("@esmj/signals:type"),V=Symbol("@esmj/signals:name");var S=null,me=false,he=[];function w(e){let t=S;S=null;let n=e();return S=t,n}function an(){me=false;let e=Xe();for(let n of e)n.get();let t=he;he=[];for(let n of t)n();}function Ue(){me||(me=true,queueMicrotask(an));}function de(e){he.push(e),Ue();}var Ye=Symbol("@esmj/signals:internal observable"),A=Symbol("@esmj/signals:original function"),ln=class extends pe{#e=new Set;#r=null;constructor(e){super(),this.#r=e,this.pipe(t=>{let n=t.subscribe.bind(t),r=t.unsubscribe.bind(t);return t.subscribe=o=>{n(o),this.#e.add(o);},t.unsubscribe=o=>{r(o),this.#e.delete(o);},t});}watch(e){if(typeof e.next!="function"&&(e.next=()=>w(()=>{this.#e.add(e),this.#r();}),e.next[A]=void 0),e instanceof Qe&&e.next[A]===void 0){let t=e.next.bind(e);e.next=()=>w(()=>{this.#e.add(e),t(),this.#r();}),e.next[A]=t;}return this.subscribe(e)}getPending(){let e=[];for(let t of this.#e){if(!t.get[A]){let n=t.get,r=n.bind(t);t.get=()=>w(()=>(this.#e.delete(t),r())),t.get[A]=n;}e.push(t);}return e}unwatch(e){return e.next=e.next[A]?e.next[A]:e.next,e.get=e.get[A]?e.get[A]:e.get,this.#e.delete(e),this.unsubscribe(e)}},z=null;function We(e){z=new ln(e);}We(()=>{Ue();});function Xe(){return z.getPending()}function ze(e){return z.watch(e)}function Je(e){return z.unwatch(e)}var v=Symbol("@esmj/signals:no error"),Qe=class Ze extends Ge{#e=true;#r=false;#n=null;#o=this.#p();#c=null;#l=null;#i=0;#s=new Map;#t=v;constructor(t,n){super(),this.#c=t,this.#l=n,this.debug=n?.debug,this[X]="computed",this[V]=n?.debug??null,this.get=this.get.bind(this);}#u(){for(let{unsubscribe:t}of this.#o.dependencies.values())t();this.#o.dependencies.clear();}#p(){return {dependencies:new Map,sourceRevisions:new Map,observer:this}}getRevision(){return this.#i}getDebugInfo(){return {name:this[V],dirty:this.#e,revision:this.#i,sourceDependencies:[...this.#s.keys()]}}#f(){for(let[t,n]of this.#s)if(t instanceof Ze&&w(()=>t.get()),t.getRevision()!==n)return true;return false}next(){this.#e=true,this.#n[Ye].next();}get(){if(this.#r)throw new Error("Cycle detected in computed signal");if(this.#n||(this.#n=I(this.#a(),this.#l)),(this.#e||this.#t!==v)&&(this.#s.size===0||this.#f()?this.#a():this.#e=false),S&&S.sourceRevisions.set(this,this.#i),this.#t!==v)throw this.#t;return this.#n.get()}peek(){if(this.#n||(this.#n=I(this.#a(),this.#l)),(this.#e||this.#t!==v)&&(this.#s.size===0||this.#f()?this.#a():this.#e=false),this.#t!==v)throw this.#t;return this.#n.peek()}#a(){this.#r=true,this.#e=false,this.#t=v,this.#u(),this.#o.sourceRevisions.clear();let t=S;S=this.#o;let n;try{n=this.#c();}catch(r){this.#t=r;}return S=t,this.#s=this.#o.sourceRevisions,this.#o.sourceRevisions=new Map,this.#r=false,n instanceof Promise&&(n=n.then(r=>{this.#t=v,this.#n.set(r);}).catch(r=>{this.#t=r;})),this.#t===v&&this.#n&&this.#n.set(n),this.#i++,n}destroy(){this.#u(),this.#s.clear(),this.#e=true,this.#t=v;}};function P(e,t){return new Qe(e,t)}function _(e,t){let n,{debug:r,...o}={},i=P(()=>{n?.(),n=e();},{equals:()=>false,...o});i.get(),ze(i);let s=()=>{n?.(),i.destroy(),Je(i);};return s[Symbol.dispose]=s,s[X]="effect",s[V]=r??null,s.__RX_COMPUTED__=i,s}function I(e,t={}){let n=t?.equals??Object.is,r=0,o=new pe;function i(){return S&&(S.dependencies.set(o,o.subscribe(S.observer)),S.sourceRevisions.set(c,r)),e}function s(){return e}function a(u){if(!n(e,u)){e=u,r++,o.next();}return e}function l(){return r}let c={get:i,set:a,peek:s,getRevision:l,[Ye]:o,[X]:"signal",[V]:t?.debug??null};return c}function J(){return Date.now().toString(32).substring(5)+Math.random().toString(32).substring(2)}var lt=Symbol("node-component"),Q=Symbol("node-internal"),cn=Symbol("keep-literal"),ne=Symbol("raw-props");var ct=null;function B(){return ct}function Z(e){ct=e;}function _e(e){return e?.[lt]||null}function et(e,t){e[lt]=t;}function ee(e,t={disposers:[],id:J()}){return e?.[Q]?e[Q]:(e&&(e[Q]=t),t)}function pn(e){return e[Q]}function M(e,t){let n=pn(e);n||(n=ee(e)),n.disposers.push(t);}function ye(e,t,n){e.has(t)||e.set(t,[]),e.get(t).push(n);}function L(e,t){let n=B();Z(e);try{return t()}finally{Z(n);}}var Ee=new Map,te=new Map,tt=new Map;function ut(e,t){let n=typeof t=="function"?t:o=>!!t?.includes(o),r=Object.create(null);for(let o of Object.keys(e)){let i=e[o];o==="children"||n(o)?r[o]=i:i?.[cn]?r[o]=i():i!=null&&typeof i.get=="function"?r[o]=i:typeof i=="function"?r[o]=P(i):r[o]=I(i);}return r}function Ne(e){return {id:Symbol("context-id"),defaultValue:e}}function Re(e){let t=B();return t?.contexts?.has(e.id)?t.contexts.get(e.id):e.defaultValue}function ke(e){de(()=>{setTimeout(e,0);});}function Y(e){let t=e.componentId,n=Ee.get(t);if(n){Ee.delete(t);for(let r of n){let o=r();typeof o=="function"&&ye(te,t,o);}}}function mn(e){let t=te.get(e);if(t){te.delete(e);for(let n of t)n();}}function hn(e){let t=tt.get(e);if(t){tt.delete(e);for(let n of t)n();}}function oe(e){if(!e)return;let t=ee(e);if(t?.disposers?.length){for(let r of t.disposers)try{r();}catch(o){console.error("[esmj-dom] cleanupTree: disposer threw, cleanup continues",o);}t.disposers=[];}let n=_e(e);if(n&&(mn(n.componentId),hn(n.componentId)),e.childNodes){let r=e.firstChild;for(;r;){let o=r.nextSibling;oe(r),r=o;}}}function j(e){return e!=null&&typeof e=="object"&&typeof e.$constructor=="function"}function nt(e){return typeof e=="function"&&typeof e.prototype?.render=="function"}function dn(e,t,n){let r=J(),o={componentId:r,$children:n,element:null,classInstance:null,$constructor(){let i=nt(e)?void 0:e[ne],s={...ut(t??{},i),children:n},a=B(),l={disposers:[],id:r,contexts:new Map(a?.contexts)};Z(l);let c;if(nt(e)){o.ClassConstructor=e;let f=new e(s);o.classInstance=f,typeof f.onMount=="function"&&ye(Ee,r,()=>{f.onMount?.();}),typeof f.onUnmount=="function"&&ye(te,r,()=>{f.onUnmount?.();}),c=f.render();}else c=e(s);Z(a);let u=gn(c);if(o.element=u,u instanceof DocumentFragment&&u.childNodes.length)for(let f of u.childNodes)ee(f,l),et(f,o);else ee(u,l),u instanceof Node&&et(u,o);return u}};return o}function Ae(e,t){let n=t.$constructor();n instanceof Node&&e.appendChild(n),queueMicrotask(()=>{Y(t);});}function gn(e){return e instanceof Node?e:j(e)?e.$constructor():typeof e=="string"||typeof e=="number"?document.createTextNode(String(e)):document.createTextNode("")}var rt={className:"class",htmlFor:"for"},ot=new Set(["value","defaultValue","checked","selected","indeterminate"]),yn=new Set(["srcdoc"]),En=new Set(["href","src","action","formaction","xlink:href"]),Sn=new Set(["securitypolicyviolation"]),bn=new Set(["contenteditable","draggable","spellcheck"]);function U(e){return e!=null&&typeof e=="object"&&typeof e.get=="function"&&!(e instanceof Node)}var ft=Symbol("Fragment");function D(e,t,n){if(e===ft){let o=document.createDocumentFragment();return Se(o,it(n)),o}if(typeof e=="function")return dn(e,t||{},n);typeof e!="string"&&(n=t,t=e,e="div"),t=t||{};let r=document.createElement(e);return t.id&&r.setAttribute("id",t.id),se(r,t),Se(r,it(n)),r}function ge(e,t){t instanceof DocumentFragment?e.replaceChildren(t):e.innerHTML=t??"";}function xn(e){return typeof e!="string"?false:e.replace(/[\p{White_Space}\p{Cc}]+/gu,"").toLowerCase().startsWith("javascript:")}function Cn(e,t){if(typeof e!="string")return false;let n=e.toLowerCase();return yn.has(n)?true:En.has(n)&&t!==null&&t!==void 0&&xn(String(t))}function pt(e){return typeof e!="string"?e:rt[e]?rt[e]:e}function _n(e,t){let n=pt(e),r=typeof n=="string"?n.toLowerCase():String(n).toLowerCase();return bn.has(r)&&(t===true||t===false||t==="true"||t==="false")?String(t):t==null||t===false?null:t}function st(e,t,n){let r=_n(t,n);if(r===null){e.removeAttribute(t);return}if(Cn(t,r)){e.removeAttribute(t),console.warn(`[esmj-dom] Blocked unsafe attribute "${String(t)}" on <${e.tagName.toLowerCase()}>`);return}e.setAttribute(t,r);}function se(e,t){let n=B();for(let[r,o]of Reflect.ownKeys(t).map(i=>[i,t[i]]))if(r!=="id"){if(r=pt(r),r==="$ref"){typeof o=="function"?o(e):typeof o=="object"&&o!==null&&(o.current=e);continue}if(r==="$dangerouslySetInnerHTML"){if(U(o)){let i=_(()=>{L(n,()=>{ge(e,o.get());});});M(e,i);}else if(typeof o=="function"){let i=_(()=>{L(n,()=>{ge(e,o());});});M(e,i);}else ge(e,o);continue}if(r==="style"){if(U(o)){let i=_(()=>{L(n,()=>{Object.assign(e.style,o.get());});});M(e,i);}else typeof o=="object"&&o!==null?Object.assign(e.style,o):e.setAttribute("style",o);continue}if(typeof r=="string"&&r.startsWith("on")&&typeof o=="function"){let i=r.slice(2).toLowerCase();if(Sn.has(i)){console.warn(`[esmj-dom] Blocked unsafe event binding "${r}" on <${e.tagName.toLowerCase()}>`);continue}e.addEventListener(i,o);continue}if(U(o)||typeof o=="function"){let i=r,s=_(()=>{L(n,()=>{let a=typeof o=="function"?o():o.get();ot.has(i)?e[i]=a??"":st(e,i,a);});});M(e,s);continue}ot.has(r)||typeof r=="symbol"?e[r]=o??"":st(e,r,o);}}function it(e){return e==null?[]:Array.isArray(e)?e.flat(Number.POSITIVE_INFINITY):[e]}function Se(e,t){for(let n of t)mt(e,n);}function mt(e,t){if(!(t==null||t===false||t===true)){if(t instanceof Node){e.appendChild(t);return}if(typeof t=="string"||typeof t=="number"){e.appendChild(document.createTextNode(String(t)));return}if(typeof t=="function"){at(e,t);return}if(j(t)){Ae(e,t);return}if(U(t)){at(e,()=>t.get());return}if(Array.isArray(t)){Se(e,t);return}e.appendChild(document.createTextNode(String(t)));}}function F(e){let t=null,n=e;return j(e)&&(t=e,n=e.$constructor()),n instanceof DocumentFragment?{nodes:Array.from(n.childNodes),instance:t}:n instanceof Node?{nodes:[n],instance:t}:n==null||n===false||n===true?{nodes:[],instance:t}:{nodes:[document.createTextNode(String(n))],instance:t}}function ie(e,t=true){for(let n of e)t&&oe(n),n.remove();}function at(e,t){let n=B(),r=document.createComment("");e.appendChild(r);let o=[],i=_(()=>{L(n,()=>{let s=t(),{nodes:a,instance:l}=F(s);ie(o),a.length&&r.after(...a),l&&queueMicrotask(()=>Y(l)),o=a;});});M(e,i);}var gt=class{constructor(e){this.props=e;}};function yt(e,t){if(typeof e=="string"&&(e=document.querySelector(e)),!e)throw new Error("mount: container not found");e instanceof DocumentFragment||(oe(e),e.innerHTML=""),j(t)?Ae(e,t):t instanceof Node?e.appendChild(t):e.appendChild(document.createTextNode(String(t)));}var kn={abortEarly:true};function Le(e,t){if(t===void 0)return e;let n=e?.cause?.key?`${t}.${e.cause.key}`:`${t}`;return {message:`Error parsing key "${n}": ${e.message}`,cause:{key:n}}}function An(e,t,n){if(e.errors?.length)for(let r=0;r<e.errors.length;r++)t.push(Le(e.errors[r],n));}function bt(e,t,n,r){if(n!==false){let o=Le(e.error,t);return {success:false,error:o,errors:[o]}}An(e,r,t);}function ae(e){return e?.abortEarly!==void 0?e:kn}function ve(e,t){g(e,"_parse",(n,r,o)=>{let i=n(r,o);return !i.success&&t(r)?{success:true,data:r}:i});}var W=e=>typeof e=="string"||e instanceof String,we=e=>(typeof e=="number"||e instanceof Number)&&!Number.isNaN(e),Te=e=>e===true||e===false,vn=e=>e instanceof Date&&!Number.isNaN(e.getTime()),wn=e=>typeof e=="function",Tn=e=>Array.isArray(e),Me=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function xt(e,t){let n=b(Me,{...t,type:"object"});n._getDescription=()=>`object({ ${Object.entries(e).map(([o,i])=>`${o}: ${i._getDescription()}`).join(", ")} })`,n._getDefinition=()=>e;let r=n;return r.derive=function(o,{when:i="always"}={}){return g(this,"_parse",(s,a,l)=>{let c=s(a,l);if(!c.success)return c;let u=o(c.data,{context:l?.context});if(!Me(u)){let f={message:`derive() callback must return a plain object of overrides, got ${u===null?"null":typeof u}`};return {success:false,error:f,errors:[f]}}if(i==="missing"){let f={...c.data};for(let m in u)f[m]===void 0&&(f[m]=u[m]);return {success:true,data:f}}return {success:true,data:{...c.data,...u}}}),this},g(n,"_parse",(o,i,s)=>{let a=o(i,s),{abortEarly:l}=ae(s);if(a.success===false)return a;let c={},u=[];for(let f in e){let m=e[f]._parse(a.data[f],s);if(m.success)c[f]=m.data;else {let h=bt(m,f,l,u);if(h)return h}}return u.length>0?{success:false,error:u[0],errors:u}:{success:true,data:c}}),r}function Oe(e){return b(W,{...e,type:"string"})}function Ie(e){return b(we,{...e,type:"number"})}function Pe(e){return b(Te,{...e,type:"boolean"})}function Be(e){return b(vn,{...e,type:"date"})}function Ct(e){return b(wn,{...e,type:"function"})}function _t(e,t){let n=s=>e.includes(s),r=s=>`Invalid ${o} value. Expected ${e.map(a=>`"${a}"`).join(" | ")}, received "${s}".`,o="enum",i=b(n,{message:r,...t,type:o});return i._getDescription=()=>`enum(${e.map(s=>`"${s}"`).join(" | ")})`,i._getDefinition=()=>e,i}function Nt(e,t){let n=b(Tn,{...t,type:"array"});return n._getDescription=()=>`array(${e._getDescription()})`,n._getDefinition=()=>e,g(n,"_parse",(r,o,i)=>{let s=r(o,i),{abortEarly:a}=ae(i);if(s.success===false)return s;let l=[],c=[],u=i;for(let f=0;f<s.data.length;f++){let m={...u,context:{...u?.context,index:f}},h=e._parse(s.data[f],m);if(h.success)l.push(h.data);else {let y=bt(h,f,a,c);if(y)return y}}return c.length>0?{success:false,error:c[0],errors:c}:{success:true,data:l}}),n}function Rt(){return b(()=>true)}function H(e,t){return g(t,"_parse",(n,r,o)=>(r=e(r),n(r,o))),t}function kt(e,t){let n=o=>`Invalid union value. Expected the value to match one of the schemas:${e.map((i,s)=>` ${s+1}. ${i._getDescription()}`).join(",")} but received "${typeof o}" with value: ${Me(o)?JSON.stringify(o):`"${o}"`}`,r=b(()=>false,{message:n,...t,type:"union"});return r._getDefinition=()=>e,g(r,"_parse",(o,i,s)=>{let a=s,l=[];for(let m=0;m<e.length;m++){let h=e[m]._parse(i,a);if(h.success)return h;l.push(h);}let{abortEarly:c}=ae(a),u={message:typeof n=="function"?n(i):n};if(c!==false)return {success:false,error:u,errors:[u]};let f=[];for(let m=0;m<l.length;m++){let h=l[m].errors;if(h?.length)for(let y=0;y<h.length;y++)h[y].cause?.key&&f.push(Le(h[y],`branch ${m}`));}return f.length===0&&f.push(u),{success:false,error:f[0],errors:f}}),r}function At(e,t){let n=b(r=>r===e,{message:r=>t?.message?typeof t.message=="function"?t.message(r):t.message:`Expected literal value "${e}", received "${r}"`,name:t?.name,type:"literal"});return n._getDescription=()=>`literal("${e}")`,n._getDefinition=()=>e,n}function vt(e){let t=b(()=>true,{type:"contextRef"});return t._getDescription=()=>`contextRef("${e}")`,g(t,"_parse",(n,r,o)=>({success:true,data:o?.context?.[e]})),t}function wt(e,t){return {parse(n,r){let o=e.parse(r?.context??{},r);return t(o).parse(n,r)},safeParse(n,r){let o=e.safeParse(r?.context??{},r);return o.success?t(o.data).safeParse(n,r):o}}}var Tt={boolean(e){let t=e?.message??(n=>`Cannot cast "${n}" to boolean. Accepted: true/false, 1/0, yes/no, on/off.`);return H(n=>{let r;return W(n)&&(r=n.toLowerCase()),r==="true"||r==="yes"||r==="on"||r==="1"||n===1?true:r==="false"||r==="no"||r==="off"||r==="0"||n===0?false:n},Pe({...e,message:t}))},number(e){let t=e?.message??(n=>`Cannot cast "${n}" to a number. Expected a numeric string or number.`);return H(n=>{if(Te(n))return Number(n);if(W(n)){let r=n.trim();if(r==="")return n;let o=Number(r);if(Number.isFinite(o))return o}return n},Ie({...e,message:t}))},string(e){let t=e?.message??(n=>`Cannot cast "${n}" to string. Expected a string, number, or boolean.`);return H(n=>Te(n)||we(n)&&Number.isFinite(n)?String(n):n,Oe({...e,message:t}))},date(e){let t=e?.message??(n=>`Cannot cast "${n}" to a valid date.`);return H(n=>{let r;return W(n)&&(r=n.trim()),we(n)&&Number.isFinite(n)||r?new Date(r??n):n},Be({...e,message:t}))},json(e,t){let n=t?.message??(r=>`Cannot parse "${r}" as JSON.`);return g(e,"_parse",(r,o,i)=>{if(W(o))try{o=JSON.parse(o);}catch{let s={message:typeof n=="function"?n(o):n};return {success:false,error:s,errors:[s]}}return r(o,i)}),e}},Mt={},p={object:xt,string:Oe,number:Ie,boolean:Pe,date:Be,function:Ct,enum:_t,array:Nt,any:Rt,preprocess:H,union:kt,literal:At,contextRef:vt,withContext:wt,coerce:Mt,cast:Tt};function Et(e){return t=>`The value "${t}" must be type of ${e} but is type of "${typeof t}".`}function g(e,t,n){let r=e[t];e[t]=(...o)=>n(r,...o);}function b(e,{type:t="any",name:n,message:r}={}){r=r||Et(t);let o={name:n,message:r,type:t},i={_getName(){return n},_getType(){return t},_getDescription(){return this._getName()??this._getType()},_parse(s,a){let l=e(s);if(l===true)return {success:true,data:s};if(typeof l=="object"&&l?.success===true)return l;let c={message:typeof r=="function"?r(s):r};return {success:false,error:c,errors:[c]}},parse(s,a){let l=this._parse(s,a);if(!l.success)throw l=l,new Error(l.error.message,{cause:l.error.cause});return l.data},safeParse(s,a){return this._parse(s,a)},transform(s){return g(this,"_parse",(a,l,c)=>{let u=a(l,c);return u.success&&(u.data=s(u.data)),u}),this},optional(){return ve(this,s=>s===void 0),this},nullable(){return ve(this,s=>s===null),this},nullish(){return ve(this,s=>s==null),this},default(s){return g(this,"_parse",(a,l,c)=>(l===void 0&&(l=typeof s=="function"?s({context:c?.context}):s),a(l,c))),this},catch(s){return g(this,"_parse",(a,l,c)=>{let u=a(l,c);return u.success?u:{success:true,data:typeof s=="function"?s({input:l,error:u.error}):s}}),this},pipe(s){return g(this,"_parse",(a,l,c)=>{let u=a(l,c);return u.success?s._parse(u.data,c):u}),this},refine(s,{message:a,type:l,jsonSchema:c}={}){if(l&&(a=a||Et(l),t=l),c){let u=[...this._getJsonSchemaHints?.()??[],c];this._getJsonSchemaHints=()=>u;}return g(this,"_parse",(u,f,m)=>{let h=u(f,m),{abortEarly:y}=ae(m);if(!h.success)return h;let R=s(h.data);if(R===true||typeof R=="object"&&R?.success===true)return h;let C={message:typeof a=="function"?a(f):a};return {success:false,error:C,errors:[C]}}),this},clone(){return {...this}}};return St.length>0?St.reduce((s,a)=>a(s,e,o)??s,i):i}var St=[];var je=De(),$e=De(),Lt=De(),Mn=Array.from({length:256},(e,t)=>(t<=15?"0":"")+t.toString(16));function De(){return Math.floor(Math.random()*16777215)}function Ln(){return $e=($e+1)%16777215,$e}function le(){let e=Math.floor(Date.now()/1e3);e=parseInt(e,10)%4294967295;let t=Ln(),n=String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255,je>>16&255,je>>8&255,je&255,Lt>>8&255,Lt&255,t>>16&255,t>>8&255,t&255),r="";for(let o=0;o<n.length;o++)r+=Mn[n.charCodeAt(o)];return r}var On=Symbol("block-element"),In=Symbol("block-element-body"),Fe=Symbol("selectable-element");function Ot(e,t){let n=e;for(n?.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n[t]===void 0;)n=n.parentElement;return n??null}function Pn(e){return e?Ot(e.startContainer,On):null}function Bn(e){return e?Ot(e.startContainer,Fe):null}function It(){return window.getSelection()}function He(){let e=It();return e.rangeCount>0?e.getRangeAt(0).cloneRange():null}function Pt(){let e=He();if(!e)return 0;e.collapse(true);let t=Bn(e),n=Pn(e),r=t??$t(n);return Bt(r,e.startContainer,e.startOffset)}function Bt(e,t,n){if(!e)return 0;if(t===e){if(t.nodeType===Node.TEXT_NODE)return n;let s=0,a=e.childNodes,l=Math.min(n,a.length);for(let c=0;c<l;c++)s+=a[c].textContent.length;return s}if(t.nodeType===Node.ELEMENT_NODE&&!e.contains(t))return 0;let r=0,o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=o.nextNode();for(;i;){if(i===t)return r+n;r+=i.textContent.length,i=o.nextNode();}return r}function jn(e,t){let n=document.createRange();if(!e)return n;if(t<=0)return n.setStart(e,0),n.collapse(true),n;let r=0,o=[e];for(;o.length>0;){let i=o.pop();if(i.nodeType===Node.TEXT_NODE){let s=i.textContent.length;if(r+s>=t)return n.setEnd(i,t-r),n.setStart(i,t-r),n;r+=s;}else if(i.childNodes&&i.childNodes.length>0)for(let s=i.childNodes.length-1;s>=0;s--)o.push(i.childNodes[s]);}return n.setEnd(e,e.childNodes.length),n.setStart(e,e.childNodes.length),n}function jt(e,t){let n=jn(e,t),r=It();r.removeAllRanges(),r.addRange(n);}function $t(e){if(!e)return null;let t=$n(e);return t?.firstElementChild??t?.firstChild}function $n(e){if(!e)return null;for(let t of e.children)if(t[In])return t;return null}var Dt={INPUT:"mrakomor:input"};var Ft=Ne();var ce=class extends gt{state;element;mrakomor;constructor(t){super(t);let{state:n,observeDOMChanges:r=true}=t??{};this.state=n,this.element=null,this.mrakomor=Re(Ft),this._stale=false,this._observer=null,this._offInputStale=null,this._onInputMarkStale=null,this._observeDOMChanges=r;}static get NAMESPACE(){return "namespace.AbstractComponent"}static getStateSchema(){return p.object({component:p.string().default(this.NAMESPACE),properties:p.object().default({}),settings:p.object().default({})}).default({})}static getPropsSchema(){return p.object({state:this.getStateSchema(),observeDOMChanges:p.boolean().default(true)}).default({})}parseFromHTML(t){return this.constructor.getStateSchema(t).parse()}getState(){if(this._stale){let t=this.element;return this.parseFromHTML(t)}return this.state.peek()}isStale(){return this._stale}#e(){this._stale=true;}onMount(){!this.element||!this._observeDOMChanges||(this._observer=new MutationObserver(()=>{this.#e();}),this._observer.observe(this.element,{subtree:true,characterData:true,characterDataOldValue:true,childList:true,attributes:true,attributeOldValue:true}),this._onInputMarkStale=t=>{let n=t.target;n instanceof Node&&this.element?.contains(n)&&this.#e();},this.mrakomor?.emitter&&(this._offInputStale=this.mrakomor.emitter.on(Dt.INPUT,this._onInputMarkStale)));}onUnmount(){this._observer&&(this._observer.disconnect(),this._observer=null),this._offInputStale?.(),this._offInputStale=null,this._onInputMarkStale=null,this._stale=false;}};var Ht="molecule.paragraph.Paragraph";function N(e){return e===`
|
|
2
|
+
`,document.head.appendChild(n);}}})();var Ue=class{next(...e){}error(...e){}complete(...e){}},me=class{#e=new Set;pipe(...e){return e.reduce((t,n)=>n(t),this)}next(...e){Array.from(this.#e).forEach(t=>{typeof t=="function"?t(...e):t.next(...e);});}error(...e){Array.from(this.#e).forEach(t=>{t?.error?.(...e),this.unsubscribe(t);});}complete(...e){Array.from(this.#e).forEach(t=>{t?.complete?.(...e),this.unsubscribe(t);});}subscribe(e){return this.#e.add(e),{unsubscribe:()=>{this.unsubscribe(e);}}}unsubscribe(e){this.#e.delete(e);}};var X=Symbol("@esmj/signals:type"),V=Symbol("@esmj/signals:name");var S=null,he=false,de=[];function w(e){let t=S;S=null;let n=e();return S=t,n}function an(){he=false;let e=ze();for(let n of e)n.get();let t=de;de=[];for(let n of t)n();}function Ye(){he||(he=true,queueMicrotask(an));}function ge(e){de.push(e),Ye();}var We=Symbol("@esmj/signals:internal observable"),A=Symbol("@esmj/signals:original function"),ln=class extends me{#e=new Set;#r=null;constructor(e){super(),this.#r=e,this.pipe(t=>{let n=t.subscribe.bind(t),r=t.unsubscribe.bind(t);return t.subscribe=o=>{n(o),this.#e.add(o);},t.unsubscribe=o=>{r(o),this.#e.delete(o);},t});}watch(e){if(typeof e.next!="function"&&(e.next=()=>w(()=>{this.#e.add(e),this.#r();}),e.next[A]=void 0),e instanceof Ze&&e.next[A]===void 0){let t=e.next.bind(e);e.next=()=>w(()=>{this.#e.add(e),t(),this.#r();}),e.next[A]=t;}return this.subscribe(e)}getPending(){let e=[];for(let t of this.#e){if(!t.get[A]){let n=t.get,r=n.bind(t);t.get=()=>w(()=>(this.#e.delete(t),r())),t.get[A]=n;}e.push(t);}return e}unwatch(e){return e.next=e.next[A]?e.next[A]:e.next,e.get=e.get[A]?e.get[A]:e.get,this.#e.delete(e),this.unsubscribe(e)}},z=null;function Xe(e){z=new ln(e);}Xe(()=>{Ye();});function ze(){return z.getPending()}function Je(e){return z.watch(e)}function Qe(e){return z.unwatch(e)}var v=Symbol("@esmj/signals:no error"),Ze=class et extends Ue{#e=true;#r=false;#n=null;#o=this.#p();#c=null;#l=null;#i=0;#s=new Map;#t=v;constructor(t,n){super(),this.#c=t,this.#l=n,this.debug=n?.debug,this[X]="computed",this[V]=n?.debug??null,this.get=this.get.bind(this);}#u(){for(let{unsubscribe:t}of this.#o.dependencies.values())t();this.#o.dependencies.clear();}#p(){return {dependencies:new Map,sourceRevisions:new Map,observer:this}}getRevision(){return this.#i}getDebugInfo(){return {name:this[V],dirty:this.#e,revision:this.#i,sourceDependencies:[...this.#s.keys()]}}#f(){for(let[t,n]of this.#s)if(t instanceof et&&w(()=>t.get()),t.getRevision()!==n)return true;return false}next(){this.#e=true,this.#n[We].next();}get(){if(this.#r)throw new Error("Cycle detected in computed signal");if(this.#n||(this.#n=I(this.#a(),this.#l)),(this.#e||this.#t!==v)&&(this.#s.size===0||this.#f()?this.#a():this.#e=false),S&&S.sourceRevisions.set(this,this.#i),this.#t!==v)throw this.#t;return this.#n.get()}peek(){if(this.#n||(this.#n=I(this.#a(),this.#l)),(this.#e||this.#t!==v)&&(this.#s.size===0||this.#f()?this.#a():this.#e=false),this.#t!==v)throw this.#t;return this.#n.peek()}#a(){this.#r=true,this.#e=false,this.#t=v,this.#u(),this.#o.sourceRevisions.clear();let t=S;S=this.#o;let n;try{n=this.#c();}catch(r){this.#t=r;}return S=t,this.#s=this.#o.sourceRevisions,this.#o.sourceRevisions=new Map,this.#r=false,n instanceof Promise&&(n=n.then(r=>{this.#t=v,this.#n.set(r);}).catch(r=>{this.#t=r;})),this.#t===v&&this.#n&&this.#n.set(n),this.#i++,n}destroy(){this.#u(),this.#s.clear(),this.#e=true,this.#t=v;}};function P(e,t){return new Ze(e,t)}function _(e,t){let n,{debug:r,...o}={},i=P(()=>{n?.(),n=e();},{equals:()=>false,...o});i.get(),Je(i);let s=()=>{n?.(),i.destroy(),Qe(i);};return s[Symbol.dispose]=s,s[X]="effect",s[V]=r??null,s.__RX_COMPUTED__=i,s}function I(e,t={}){let n=t?.equals??Object.is,r=0,o=new me;function i(){return S&&(S.dependencies.set(o,o.subscribe(S.observer)),S.sourceRevisions.set(c,r)),e}function s(){return e}function a(u){if(!n(e,u)){e=u,r++,o.next();}return e}function l(){return r}let c={get:i,set:a,peek:s,getRevision:l,[We]:o,[X]:"signal",[V]:t?.debug??null};return c}function J(){return Date.now().toString(32).substring(5)+Math.random().toString(32).substring(2)}var ct=Symbol("node-component"),Q=Symbol("node-internal"),cn=Symbol("keep-literal"),ne=Symbol("raw-props");var ut=null;function B(){return ut}function Z(e){ut=e;}function Ne(e){return e?.[ct]||null}function tt(e,t){e[ct]=t;}function ee(e,t={disposers:[],id:J()}){return e?.[Q]?e[Q]:(e&&(e[Q]=t),t)}function pn(e){return e[Q]}function M(e,t){let n=pn(e);n||(n=ee(e)),n.disposers.push(t);}function Ee(e,t,n){e.has(t)||e.set(t,[]),e.get(t).push(n);}function L(e,t){let n=B();Z(e);try{return t()}finally{Z(n);}}var Se=new Map,te=new Map,nt=new Map;function ft(e,t){let n=typeof t=="function"?t:o=>!!t?.includes(o),r=Object.create(null);for(let o of Object.keys(e)){let i=e[o];o==="children"||n(o)?r[o]=i:i?.[cn]?r[o]=i():i!=null&&typeof i.get=="function"?r[o]=i:typeof i=="function"?r[o]=P(i):r[o]=I(i);}return r}function Re(e){return {id:Symbol("context-id"),defaultValue:e}}function ke(e){let t=B();return t?.contexts?.has(e.id)?t.contexts.get(e.id):e.defaultValue}function oe(e){ge(()=>{setTimeout(e,0);});}function Y(e){let t=e.componentId,n=Se.get(t);if(n){Se.delete(t);for(let r of n){let o=r();typeof o=="function"&&Ee(te,t,o);}}}function mn(e){let t=te.get(e);if(t){te.delete(e);for(let n of t)n();}}function hn(e){let t=nt.get(e);if(t){nt.delete(e);for(let n of t)n();}}function se(e){if(!e)return;let t=ee(e);if(t?.disposers?.length){for(let r of t.disposers)try{r();}catch(o){console.error("[esmj-dom] cleanupTree: disposer threw, cleanup continues",o);}t.disposers=[];}let n=Ne(e);if(n&&(mn(n.componentId),hn(n.componentId)),e.childNodes){let r=e.firstChild;for(;r;){let o=r.nextSibling;se(r),r=o;}}}function j(e){return e!=null&&typeof e=="object"&&typeof e.$constructor=="function"}function rt(e){return typeof e=="function"&&typeof e.prototype?.render=="function"}function dn(e,t,n){let r=J(),o={componentId:r,$children:n,element:null,classInstance:null,$constructor(){let i=rt(e)?void 0:e[ne],s={...ft(t??{},i),children:n},a=B(),l={disposers:[],id:r,contexts:new Map(a?.contexts)};Z(l);let c;if(rt(e)){o.ClassConstructor=e;let f=new e(s);o.classInstance=f,typeof f.onMount=="function"&&Ee(Se,r,()=>{f.onMount?.();}),typeof f.onUnmount=="function"&&Ee(te,r,()=>{f.onUnmount?.();}),c=f.render();}else c=e(s);Z(a);let u=gn(c);if(o.element=u,u instanceof DocumentFragment&&u.childNodes.length)for(let f of u.childNodes)ee(f,l),tt(f,o);else ee(u,l),u instanceof Node&&tt(u,o);return u}};return o}function Ae(e,t){let n=t.$constructor();n instanceof Node&&e.appendChild(n),queueMicrotask(()=>{Y(t);});}function gn(e){return e instanceof Node?e:j(e)?e.$constructor():typeof e=="string"||typeof e=="number"?document.createTextNode(String(e)):document.createTextNode("")}var ot={className:"class",htmlFor:"for"},st=new Set(["value","defaultValue","checked","selected","indeterminate"]),yn=new Set(["srcdoc"]),En=new Set(["href","src","action","formaction","xlink:href"]),Sn=new Set(["securitypolicyviolation"]),bn=new Set(["contenteditable","draggable","spellcheck"]);function U(e){return e!=null&&typeof e=="object"&&typeof e.get=="function"&&!(e instanceof Node)}var pt=Symbol("Fragment");function D(e,t,n){if(e===pt){let o=document.createDocumentFragment();return be(o,at(n)),o}if(typeof e=="function")return dn(e,t||{},n);typeof e!="string"&&(n=t,t=e,e="div"),t=t||{};let r=document.createElement(e);return t.id&&r.setAttribute("id",t.id),ie(r,t),be(r,at(n)),r}function ye(e,t){t instanceof DocumentFragment?e.replaceChildren(t):e.innerHTML=t??"";}function xn(e){return typeof e!="string"?false:e.replace(/[\p{White_Space}\p{Cc}]+/gu,"").toLowerCase().startsWith("javascript:")}function Cn(e,t){if(typeof e!="string")return false;let n=e.toLowerCase();return yn.has(n)?true:En.has(n)&&t!==null&&t!==void 0&&xn(String(t))}function mt(e){return typeof e!="string"?e:ot[e]?ot[e]:e}function _n(e,t){let n=mt(e),r=typeof n=="string"?n.toLowerCase():String(n).toLowerCase();return bn.has(r)&&(t===true||t===false||t==="true"||t==="false")?String(t):t==null||t===false?null:t}function it(e,t,n){let r=_n(t,n);if(r===null){e.removeAttribute(t);return}if(Cn(t,r)){e.removeAttribute(t),console.warn(`[esmj-dom] Blocked unsafe attribute "${String(t)}" on <${e.tagName.toLowerCase()}>`);return}e.setAttribute(t,r);}function ie(e,t){let n=B();for(let[r,o]of Reflect.ownKeys(t).map(i=>[i,t[i]]))if(r!=="id"){if(r=mt(r),r==="$ref"){typeof o=="function"?o(e):typeof o=="object"&&o!==null&&(o.current=e);continue}if(r==="$dangerouslySetInnerHTML"){if(U(o)){let i=_(()=>{L(n,()=>{ye(e,o.get());});});M(e,i);}else if(typeof o=="function"){let i=_(()=>{L(n,()=>{ye(e,o());});});M(e,i);}else ye(e,o);continue}if(r==="style"){if(U(o)){let i=_(()=>{L(n,()=>{Object.assign(e.style,o.get());});});M(e,i);}else typeof o=="object"&&o!==null?Object.assign(e.style,o):e.setAttribute("style",o);continue}if(typeof r=="string"&&r.startsWith("on")&&typeof o=="function"){let i=r.slice(2).toLowerCase();if(Sn.has(i)){console.warn(`[esmj-dom] Blocked unsafe event binding "${r}" on <${e.tagName.toLowerCase()}>`);continue}e.addEventListener(i,o);continue}if(U(o)||typeof o=="function"){let i=r,s=_(()=>{L(n,()=>{let a=typeof o=="function"?o():o.get();st.has(i)?e[i]=a??"":it(e,i,a);});});M(e,s);continue}st.has(r)||typeof r=="symbol"?e[r]=o??"":it(e,r,o);}}function at(e){return e==null?[]:Array.isArray(e)?e.flat(Number.POSITIVE_INFINITY):[e]}function be(e,t){for(let n of t)ht(e,n);}function ht(e,t){if(!(t==null||t===false||t===true)){if(t instanceof Node){e.appendChild(t);return}if(typeof t=="string"||typeof t=="number"){e.appendChild(document.createTextNode(String(t)));return}if(typeof t=="function"){lt(e,t);return}if(j(t)){Ae(e,t);return}if(U(t)){lt(e,()=>t.get());return}if(Array.isArray(t)){be(e,t);return}e.appendChild(document.createTextNode(String(t)));}}function F(e){let t=null,n=e;return j(e)&&(t=e,n=e.$constructor()),n instanceof DocumentFragment?{nodes:Array.from(n.childNodes),instance:t}:n instanceof Node?{nodes:[n],instance:t}:n==null||n===false||n===true?{nodes:[],instance:t}:{nodes:[document.createTextNode(String(n))],instance:t}}function ae(e,t=true){for(let n of e)t&&se(n),n.remove();}function lt(e,t){let n=B(),r=document.createComment("");e.appendChild(r);let o=[],i=_(()=>{L(n,()=>{let s=t(),{nodes:a,instance:l}=F(s);ae(o),a.length&&r.after(...a),l&&queueMicrotask(()=>Y(l)),o=a;});});M(e,i);}var yt=class{constructor(e){this.props=e;}};function Et(e,t){if(typeof e=="string"&&(e=document.querySelector(e)),!e)throw new Error("mount: container not found");e instanceof DocumentFragment||(se(e),e.innerHTML=""),j(t)?Ae(e,t):t instanceof Node?e.appendChild(t):e.appendChild(document.createTextNode(String(t)));}var kn={abortEarly:true};function Le(e,t){if(t===void 0)return e;let n=e?.cause?.key?`${t}.${e.cause.key}`:`${t}`;return {message:`Error parsing key "${n}": ${e.message}`,cause:{key:n}}}function An(e,t,n){if(e.errors?.length)for(let r=0;r<e.errors.length;r++)t.push(Le(e.errors[r],n));}function xt(e,t,n,r){if(n!==false){let o=Le(e.error,t);return {success:false,error:o,errors:[o]}}An(e,r,t);}function le(e){return e?.abortEarly!==void 0?e:kn}function ve(e,t){g(e,"_parse",(n,r,o)=>{let i=n(r,o);return !i.success&&t(r)?{success:true,data:r}:i});}var W=e=>typeof e=="string"||e instanceof String,we=e=>(typeof e=="number"||e instanceof Number)&&!Number.isNaN(e),Te=e=>e===true||e===false,vn=e=>e instanceof Date&&!Number.isNaN(e.getTime()),wn=e=>typeof e=="function",Tn=e=>Array.isArray(e),Me=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function Ct(e,t){let n=b(Me,{...t,type:"object"});n._getDescription=()=>`object({ ${Object.entries(e).map(([o,i])=>`${o}: ${i._getDescription()}`).join(", ")} })`,n._getDefinition=()=>e;let r=n;return r.derive=function(o,{when:i="always"}={}){return g(this,"_parse",(s,a,l)=>{let c=s(a,l);if(!c.success)return c;let u=o(c.data,{context:l?.context});if(!Me(u)){let f={message:`derive() callback must return a plain object of overrides, got ${u===null?"null":typeof u}`};return {success:false,error:f,errors:[f]}}if(i==="missing"){let f={...c.data};for(let m in u)f[m]===void 0&&(f[m]=u[m]);return {success:true,data:f}}return {success:true,data:{...c.data,...u}}}),this},g(n,"_parse",(o,i,s)=>{let a=o(i,s),{abortEarly:l}=le(s);if(a.success===false)return a;let c={},u=[];for(let f in e){let m=e[f]._parse(a.data[f],s);if(m.success)c[f]=m.data;else {let h=xt(m,f,l,u);if(h)return h}}return u.length>0?{success:false,error:u[0],errors:u}:{success:true,data:c}}),r}function Oe(e){return b(W,{...e,type:"string"})}function Ie(e){return b(we,{...e,type:"number"})}function Pe(e){return b(Te,{...e,type:"boolean"})}function Be(e){return b(vn,{...e,type:"date"})}function _t(e){return b(wn,{...e,type:"function"})}function Nt(e,t){let n=s=>e.includes(s),r=s=>`Invalid ${o} value. Expected ${e.map(a=>`"${a}"`).join(" | ")}, received "${s}".`,o="enum",i=b(n,{message:r,...t,type:o});return i._getDescription=()=>`enum(${e.map(s=>`"${s}"`).join(" | ")})`,i._getDefinition=()=>e,i}function Rt(e,t){let n=b(Tn,{...t,type:"array"});return n._getDescription=()=>`array(${e._getDescription()})`,n._getDefinition=()=>e,g(n,"_parse",(r,o,i)=>{let s=r(o,i),{abortEarly:a}=le(i);if(s.success===false)return s;let l=[],c=[],u=i;for(let f=0;f<s.data.length;f++){let m={...u,context:{...u?.context,index:f}},h=e._parse(s.data[f],m);if(h.success)l.push(h.data);else {let y=xt(h,f,a,c);if(y)return y}}return c.length>0?{success:false,error:c[0],errors:c}:{success:true,data:l}}),n}function kt(){return b(()=>true)}function H(e,t){return g(t,"_parse",(n,r,o)=>(r=e(r),n(r,o))),t}function At(e,t){let n=o=>`Invalid union value. Expected the value to match one of the schemas:${e.map((i,s)=>` ${s+1}. ${i._getDescription()}`).join(",")} but received "${typeof o}" with value: ${Me(o)?JSON.stringify(o):`"${o}"`}`,r=b(()=>false,{message:n,...t,type:"union"});return r._getDefinition=()=>e,g(r,"_parse",(o,i,s)=>{let a=s,l=[];for(let m=0;m<e.length;m++){let h=e[m]._parse(i,a);if(h.success)return h;l.push(h);}let{abortEarly:c}=le(a),u={message:typeof n=="function"?n(i):n};if(c!==false)return {success:false,error:u,errors:[u]};let f=[];for(let m=0;m<l.length;m++){let h=l[m].errors;if(h?.length)for(let y=0;y<h.length;y++)h[y].cause?.key&&f.push(Le(h[y],`branch ${m}`));}return f.length===0&&f.push(u),{success:false,error:f[0],errors:f}}),r}function vt(e,t){let n=b(r=>r===e,{message:r=>t?.message?typeof t.message=="function"?t.message(r):t.message:`Expected literal value "${e}", received "${r}"`,name:t?.name,type:"literal"});return n._getDescription=()=>`literal("${e}")`,n._getDefinition=()=>e,n}function wt(e){let t=b(()=>true,{type:"contextRef"});return t._getDescription=()=>`contextRef("${e}")`,g(t,"_parse",(n,r,o)=>({success:true,data:o?.context?.[e]})),t}function Tt(e,t){return {parse(n,r){let o=e.parse(r?.context??{},r);return t(o).parse(n,r)},safeParse(n,r){let o=e.safeParse(r?.context??{},r);return o.success?t(o.data).safeParse(n,r):o}}}var Mt={boolean(e){let t=e?.message??(n=>`Cannot cast "${n}" to boolean. Accepted: true/false, 1/0, yes/no, on/off.`);return H(n=>{let r;return W(n)&&(r=n.toLowerCase()),r==="true"||r==="yes"||r==="on"||r==="1"||n===1?true:r==="false"||r==="no"||r==="off"||r==="0"||n===0?false:n},Pe({...e,message:t}))},number(e){let t=e?.message??(n=>`Cannot cast "${n}" to a number. Expected a numeric string or number.`);return H(n=>{if(Te(n))return Number(n);if(W(n)){let r=n.trim();if(r==="")return n;let o=Number(r);if(Number.isFinite(o))return o}return n},Ie({...e,message:t}))},string(e){let t=e?.message??(n=>`Cannot cast "${n}" to string. Expected a string, number, or boolean.`);return H(n=>Te(n)||we(n)&&Number.isFinite(n)?String(n):n,Oe({...e,message:t}))},date(e){let t=e?.message??(n=>`Cannot cast "${n}" to a valid date.`);return H(n=>{let r;return W(n)&&(r=n.trim()),we(n)&&Number.isFinite(n)||r?new Date(r??n):n},Be({...e,message:t}))},json(e,t){let n=t?.message??(r=>`Cannot parse "${r}" as JSON.`);return g(e,"_parse",(r,o,i)=>{if(W(o))try{o=JSON.parse(o);}catch{let s={message:typeof n=="function"?n(o):n};return {success:false,error:s,errors:[s]}}return r(o,i)}),e}},Lt={},p={object:Ct,string:Oe,number:Ie,boolean:Pe,date:Be,function:_t,enum:Nt,array:Rt,any:kt,preprocess:H,union:At,literal:vt,contextRef:wt,withContext:Tt,coerce:Lt,cast:Mt};function St(e){return t=>`The value "${t}" must be type of ${e} but is type of "${typeof t}".`}function g(e,t,n){let r=e[t];e[t]=(...o)=>n(r,...o);}function b(e,{type:t="any",name:n,message:r}={}){r=r||St(t);let o={name:n,message:r,type:t},i={_getName(){return n},_getType(){return t},_getDescription(){return this._getName()??this._getType()},_parse(s,a){let l=e(s);if(l===true)return {success:true,data:s};if(typeof l=="object"&&l?.success===true)return l;let c={message:typeof r=="function"?r(s):r};return {success:false,error:c,errors:[c]}},parse(s,a){let l=this._parse(s,a);if(!l.success)throw l=l,new Error(l.error.message,{cause:l.error.cause});return l.data},safeParse(s,a){return this._parse(s,a)},transform(s){return g(this,"_parse",(a,l,c)=>{let u=a(l,c);return u.success&&(u.data=s(u.data)),u}),this},optional(){return ve(this,s=>s===void 0),this},nullable(){return ve(this,s=>s===null),this},nullish(){return ve(this,s=>s==null),this},default(s){return g(this,"_parse",(a,l,c)=>(l===void 0&&(l=typeof s=="function"?s({context:c?.context}):s),a(l,c))),this},catch(s){return g(this,"_parse",(a,l,c)=>{let u=a(l,c);return u.success?u:{success:true,data:typeof s=="function"?s({input:l,error:u.error}):s}}),this},pipe(s){return g(this,"_parse",(a,l,c)=>{let u=a(l,c);return u.success?s._parse(u.data,c):u}),this},refine(s,{message:a,type:l,jsonSchema:c}={}){if(l&&(a=a||St(l),t=l),c){let u=[...this._getJsonSchemaHints?.()??[],c];this._getJsonSchemaHints=()=>u;}return g(this,"_parse",(u,f,m)=>{let h=u(f,m),{abortEarly:y}=le(m);if(!h.success)return h;let R=s(h.data);if(R===true||typeof R=="object"&&R?.success===true)return h;let C={message:typeof a=="function"?a(f):a};return {success:false,error:C,errors:[C]}}),this},clone(){return {...this}}};return bt.length>0?bt.reduce((s,a)=>a(s,e,o)??s,i):i}var bt=[];var je=De(),$e=De(),Ot=De(),Mn=Array.from({length:256},(e,t)=>(t<=15?"0":"")+t.toString(16));function De(){return Math.floor(Math.random()*16777215)}function Ln(){return $e=($e+1)%16777215,$e}function ce(){let e=Math.floor(Date.now()/1e3);e=parseInt(e,10)%4294967295;let t=Ln(),n=String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,e&255,je>>16&255,je>>8&255,je&255,Ot>>8&255,Ot&255,t>>16&255,t>>8&255,t&255),r="";for(let o=0;o<n.length;o++)r+=Mn[n.charCodeAt(o)];return r}var On=Symbol("block-element"),In=Symbol("block-element-body"),Fe=Symbol("selectable-element");function It(e,t){let n=e;for(n?.nodeType===Node.TEXT_NODE&&(n=n.parentElement);n&&n[t]===void 0;)n=n.parentElement;return n??null}function Pn(e){return e?It(e.startContainer,On):null}function Bn(e){return e?It(e.startContainer,Fe):null}function Pt(){return window.getSelection()}function He(){let e=Pt();return e.rangeCount>0?e.getRangeAt(0).cloneRange():null}function Bt(){let e=He();if(!e)return 0;e.collapse(true);let t=Bn(e),n=Pn(e),r=t??$t(n);return jt(r,e.startContainer,e.startOffset)}function jt(e,t,n){if(!e)return 0;if(t===e){if(t.nodeType===Node.TEXT_NODE)return n;let s=0,a=e.childNodes,l=Math.min(n,a.length);for(let c=0;c<l;c++)s+=a[c].textContent.length;return s}if(t.nodeType===Node.ELEMENT_NODE&&!e.contains(t))return 0;let r=0,o=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=o.nextNode();for(;i;){if(i===t)return r+n;r+=i.textContent.length,i=o.nextNode();}return r}function jn(e,t){let n=document.createRange();if(!e)return n;if(t<=0)return n.setStart(e,0),n.collapse(true),n;let r=0,o=[e];for(;o.length>0;){let i=o.pop();if(i.nodeType===Node.TEXT_NODE){let s=i.textContent.length;if(r+s>=t)return n.setEnd(i,t-r),n.setStart(i,t-r),n;r+=s;}else if(i.childNodes&&i.childNodes.length>0)for(let s=i.childNodes.length-1;s>=0;s--)o.push(i.childNodes[s]);}return n.setEnd(e,e.childNodes.length),n.setStart(e,e.childNodes.length),n}function Ke(e,t){let n=jn(e,t),r=Pt();r.removeAllRanges(),r.addRange(n);}function $t(e){if(!e)return null;let t=$n(e);return t?.firstElementChild??t?.firstChild}function $n(e){if(!e)return null;for(let t of e.children)if(t[In])return t;return null}var Dt={INPUT:"mrakomor:input"};var Ft=Re();var ue=class extends yt{state;element;mrakomor;constructor(t){super(t);let{state:n,observeDOMChanges:r=true}=t??{};this.state=n,this.element=null,this.mrakomor=ke(Ft),this._stale=false,this._observer=null,this._offInputStale=null,this._onInputMarkStale=null,this._observeDOMChanges=r;}static get NAMESPACE(){return "namespace.AbstractComponent"}static getStateSchema(){return p.object({component:p.string().default(this.NAMESPACE),properties:p.object().default({}),settings:p.object().default({})}).default({})}static getPropsSchema(){return p.object({state:this.getStateSchema(),observeDOMChanges:p.boolean().default(true)}).default({})}parseFromHTML(t){return this.constructor.getStateSchema(t).parse()}getState(){if(this._stale){let t=this.element;return this.parseFromHTML(t)}return this.state.peek()}isStale(){return this._stale}#e(){this._stale=true;}onMount(){!this.element||!this._observeDOMChanges||(this._observer=new MutationObserver(()=>{this.#e();}),this._observer.observe(this.element,{subtree:true,characterData:true,characterDataOldValue:true,childList:true,attributes:true,attributeOldValue:true}),this._onInputMarkStale=t=>{let n=t.target;n instanceof Node&&this.element?.contains(n)&&this.#e();},this.mrakomor?.emitter&&(this._offInputStale=this.mrakomor.emitter.on(Dt.INPUT,this._onInputMarkStale)));}onUnmount(){this._observer&&(this._observer.disconnect(),this._observer=null),this._offInputStale?.(),this._offInputStale=null,this._onInputMarkStale=null,this._stale=false;}};var Ht="molecule.paragraph.Paragraph";function N(e){return e===`
|
|
3
3
|
`||e===`\r
|
|
4
4
|
`?"":e??""}function Gt({component:e,originComponent:t,properties:n,settings:r}={}){let o=n??{},i=Array.isArray(o.items)?o.items:[{text:o.text??"",inlineStyleRanges:o.inlineStyleRanges??[],entityRanges:o.entityRanges??[]}];return {...e?{component:e}:{},...t?{originComponent:t}:{},properties:{items:i},...r?{settings:r}:{}}}function Ut(e){let t="",n=[],r=[];return (e??[]).forEach((o,i)=>{i>0&&(t+=`
|
|
5
|
-
`);let s=t.length;t+=N(o?.text);for(let a of o?.inlineStyleRanges??[])n.push({...a,offset:a.offset+s});for(let a of o?.entityRanges??[])r.push({...a,offset:a.offset+s});}),{text:t,inlineStyleRanges:n,entityRanges:r}}function Yt(e){return {properties:{text:e?.text??"",inlineStyleRanges:e?.inlineStyleRanges??[],entityRanges:e?.entityRanges??[]}}}function Dn(e,t){let n=new Set([0,t]);for(let r of e)n.add(r.offset),n.add(r.offset+r.length);return [...n].sort((r,o)=>r-o)}function Kt(e,t,n){return e.filter(r=>r.offset<=t&&r.offset+r.length>=n)}function Fn(e,t,n,{inlineStyleComponents:r,entityRangeComponents:o}){let i=e;for(let s of t){let a=r.find(l=>l.match(s));a&&(i=D(a,{},i));}for(let s of n){let a=o.find(l=>l.match(s));a&&(i=D(a,s,i));}return i}function Wt(e,{inlineStyleComponents:t,entityRangeComponents:n}){let r=document.createDocumentFragment(),o=N(e.properties.text),i=e.properties.inlineStyleRanges??[],s=e.properties.entityRanges??[];if(!o)return r;let a=Dn([...i,...s],o.length);for(let l=0;l<a.length-1;l+=1){let c=a[l],u=a[l+1];if(c>=u)continue;let f=o.slice(c,u),m=Fn(f,Kt(i,c,u),Kt(s,c,u),{inlineStyleComponents:t,entityRangeComponents:n});
|
|
5
|
+
`);let s=t.length;t+=N(o?.text);for(let a of o?.inlineStyleRanges??[])n.push({...a,offset:a.offset+s});for(let a of o?.entityRanges??[])r.push({...a,offset:a.offset+s});}),{text:t,inlineStyleRanges:n,entityRanges:r}}function Yt(e){return {properties:{text:e?.text??"",inlineStyleRanges:e?.inlineStyleRanges??[],entityRanges:e?.entityRanges??[]}}}function Dn(e,t){let n=new Set([0,t]);for(let r of e)n.add(r.offset),n.add(r.offset+r.length);return [...n].sort((r,o)=>r-o)}function Kt(e,t,n){return e.filter(r=>r.offset<=t&&r.offset+r.length>=n)}function Fn(e,t,n,{inlineStyleComponents:r,entityRangeComponents:o}){let i=e;for(let s of t){let a=r.find(l=>l.match(s));a&&(i=D(a,{},i));}for(let s of n){let a=o.find(l=>l.match(s));a&&(i=D(a,s,i));}return i}function Wt(e,{inlineStyleComponents:t,entityRangeComponents:n}){let r=document.createDocumentFragment(),o=N(e.properties.text),i=e.properties.inlineStyleRanges??[],s=e.properties.entityRanges??[];if(!o)return r;let a=Dn([...i,...s],o.length);for(let l=0;l<a.length-1;l+=1){let c=a[l],u=a[l+1];if(c>=u)continue;let f=o.slice(c,u),m=Fn(f,Kt(i,c,u),Kt(s,c,u),{inlineStyleComponents:t,entityRangeComponents:n});Et(r,m);}return r}function fe(e,t,n,{inlineStyleComponents:r,entityRangeComponents:o}){let i=n;for(let s of e){if(s.nodeType===Node.TEXT_NODE){i+=s.textContent.length;continue}if(s.nodeType!==Node.ELEMENT_NODE||s.nodeName==="BR")continue;let a=r.find(c=>c.match(s));if(a){let c=s.textContent.length;t.properties.inlineStyleRanges.push({style:a.style,offset:i,length:c}),i=fe(s.childNodes,t,i,{inlineStyleComponents:r,entityRangeComponents:o});continue}let l=o.find(c=>c.match(s));if(l){let c=s.textContent.length;t.properties.entityRanges.push({...l.getStateSchema(s).parse(),offset:i,length:c}),i=fe(s.childNodes,t,i,{inlineStyleComponents:r,entityRangeComponents:o});continue}i=fe(s.childNodes,t,i,{inlineStyleComponents:r,entityRangeComponents:o});}return i}function Xt(e,t){let n=N(e.properties.text),r=N(t.properties.text);return {state:{...e,properties:{...t.properties,...e.properties,text:n+r,inlineStyleRanges:[...e.properties.inlineStyleRanges??[],...(t.properties.inlineStyleRanges??[]).map(o=>({...o,offset:o.offset+n.length}))],entityRanges:[...e.properties.entityRanges??[],...(t.properties.entityRanges??[]).map(o=>({...o,offset:o.offset+n.length}))]},settings:{...t.settings,...e.settings}},cursor:n.length}}function qt(e,t){return (e??[]).filter(n=>n.offset<t).map(n=>({...n,length:Math.min(n.length,t-n.offset)}))}function Vt(e,t){return (e??[]).filter(n=>n.offset+n.length>t).map(n=>({...n,offset:Math.max(0,n.offset-t),length:n.offset+n.length-Math.max(n.offset,t)}))}function Hn(e,t){let n=structuredClone(e),r=structuredClone(e);return n.properties.text=e.properties.text.slice(0,t),r.properties.text=e.properties.text.slice(t),n.properties.inlineStyleRanges=qt(e.properties.inlineStyleRanges,t),r.properties.inlineStyleRanges=Vt(e.properties.inlineStyleRanges,t),n.properties.entityRanges=qt(e.properties.entityRanges,t),r.properties.entityRanges=Vt(e.properties.entityRanges,t),r.componentId=ce(),{originalLineState:n,newLineState:r}}function zt(e,t,{namespace:n=e.constructor.NAMESPACE}={}){if(t.key!=="Enter")return false;t.preventDefault();let{originalLineState:r,newLineState:o}=Hn(e.getState(),Bt(e.element));return e.mrakomor.command.insertBlockElement({range:He(),cursor:0,newLineState:o,originalLineState:r,namespace:n}),true}function Jt(e,t){let n=e.constructor;if(!t)return n.getStateSchema(t).parse();let r=structuredClone(n.getStateSchema(t).parse());return fe(t.childNodes,r,0,{inlineStyleComponents:e.getInlineStyleComponents(),entityRangeComponents:e.getEntityRangeComponents()}),r.properties.text=N(r.properties.text),r}var pe=class extends ue{static get NAMESPACE(){return "namespace.block.BlockComponent"}static get LABEL(){return ""}static get KEYWORDS(){return []}static get GROUP(){return "blocks"}isAtomic(){return false}setCursor({cursor:t}={}){let n=()=>{if(!this.element?.isConnected)return;let r=typeof t=="number"?t:N(this.getState()?.properties?.text).length;Ke(this.element,r);};n(),oe(n);}onKeydown(t){}static toExchangeState(t){let n=t?.properties,r={text:N(n?.text)};return n?.inlineStyleRanges!==void 0&&(r.inlineStyleRanges=n.inlineStyleRanges),n?.entityRanges!==void 0&&(r.entityRanges=n.entityRanges),Gt({originComponent:this.NAMESPACE,properties:{items:[r]},settings:t?.settings})}static fromExchangeState(t){let n=t?.properties?.items?.[0];return {properties:{text:n?.text??"",inlineStyleRanges:n?.inlineStyleRanges??[],entityRanges:n?.entityRanges??[]},settings:t?.settings}}static appendExchangeState(t,n){let r=Ut(n?.properties?.items);return Xt(t,Yt(r))}};function Qt(){return p.object({length:p.number(),offset:p.number(),style:p.string()})}function Zt({type:e,data:t=p.any(),length:n,offset:r}={}){let o=e!=null,i=p.object({type:o?p.string().default(e):p.string(),data:t}),s=n??(o?0:void 0),a=r??(o?0:void 0);return p.object({entity:o?i.default({}):i,length:s==null?p.number():p.number().default(s),offset:a==null?p.number():p.number().default(a)})}function en(e,{component:t,properties:n,settings:r=p.object({}).default({})}){return p.object({component:p.string().default(t),componentId:p.string().default(e?.getAttribute("data-componentid")||ce()),properties:p.object(n).default({}),settings:r}).default({})}var K=class e extends pe{static get NAMESPACE(){return Ht}static get LABEL(){return "P"}static get KEYWORDS(){return ["p","paragraph","text"]}getInlineStyleComponents(){return this.props?.inlineStyles?.get()??this.mrakomor.getConfig()?.inlineStyles??[]}getEntityRangeComponents(){return this.props?.entityRanges?.get()??this.mrakomor.getConfig()?.entityRanges??[]}static getStateSchema(t){return en(t,{component:e.NAMESPACE,properties:{entityRanges:p.array(Zt()).default([]),inlineStyleRanges:p.array(Qt()).default([]),text:p.string().default(t?.innerText??t?.textContent??"")}})}parseFromHTML(t){return Jt(this,t)}_buildContent(t){return Wt(t,{inlineStyleComponents:this.getInlineStyleComponents(),entityRangeComponents:this.getEntityRangeComponents()})}render(){let t=this.constructor.NAMESPACE.toLowerCase().replaceAll(".","-");return D("p",{className:t,"data-componentid":this.state.peek().componentId,contentEditable:true,[Fe]:true,$ref:n=>{this.element=n;},$dangerouslySetInnerHTML:()=>{let n=this.state.get(),r=n.properties?.text??"";return N(r)?w(()=>this._buildContent(n)):"<br>"}})}onKeydown(t){zt(this,t);}};function Kn(){return {resolveConfig:e=>(e.blockComponents.push(K),e),resolveComponent:e=>{if(e===K.NAMESPACE)return K}}}exports.Paragraph=K;exports.paragraphPlugin=Kn;
|
package/dist/paragraph.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{a as Paragraph,b as paragraphPlugin}from'./chunk-
|
|
1
|
+
export{a as Paragraph,b as paragraphPlugin}from'./chunk-6CG6EGQM.mjs';import'./chunk-GDDVUIEH.mjs';import'./chunk-JVQ2YGII.mjs';import'./chunk-ZHOZPQZH.mjs';import'./chunk-P7IKAZYZ.mjs';import'./chunk-FAXIFXQK.mjs';import'./chunk-B6JJAATK.mjs';import'./chunk-P7TUN2KD.mjs';import'./chunk-7CJLTNHZ.mjs';
|