efficient-easel 11.2.0 → 11.8.0

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.
Files changed (121) hide show
  1. package/README.md +20 -41
  2. package/dist/{canvas-typing-DvoqQINU.d.ts → canvas-typing-CC0wA-ys.d.ts} +16 -105
  3. package/dist/chrome/chrome.css +5 -5
  4. package/dist/{chunk-66LWADFP.js → chunk-2XMHLXMA.js} +1 -1
  5. package/dist/chunk-33C6ALT5.js +1 -0
  6. package/dist/{chunk-XJCMEEBH.js → chunk-36LVP5WD.js} +7 -7
  7. package/dist/{chunk-SJPKSE5G.js → chunk-5IUS6PM6.js} +12 -12
  8. package/dist/{chunk-FPAVNX3Y.js → chunk-5XUMLKQF.js} +3 -3
  9. package/dist/{chunk-PPL7GB7D.js → chunk-62VPYC7F.js} +1 -1
  10. package/dist/chunk-643PVCEG.js +1 -0
  11. package/dist/{chunk-TWFM6GNK.js → chunk-6IT5H37Y.js} +1 -1
  12. package/dist/{chunk-AFSSKGTD.js → chunk-6TJ2CIMY.js} +1 -1
  13. package/dist/{chunk-4ACVXF5V.js → chunk-7BRKNQF7.js} +1 -1
  14. package/dist/chunk-A6PY6C3C.js +1 -0
  15. package/dist/{chunk-XWK7WZQS.js → chunk-ATF2T5CI.js} +1 -1
  16. package/dist/chunk-AYWN5NRH.js +1 -0
  17. package/dist/chunk-DE35IQ4T.js +57 -0
  18. package/dist/{chunk-PPHUWGLZ.js → chunk-EC2I7SIY.js} +1 -1
  19. package/dist/{chunk-DGAXQTDW.js → chunk-FHLYUIJJ.js} +1 -1
  20. package/dist/{chunk-65Z5FSAW.js → chunk-G3GWAP5R.js} +5 -5
  21. package/dist/{chunk-2FZJWH24.js → chunk-H4UMY7QF.js} +1 -1
  22. package/dist/chunk-H6IXH4A3.js +1 -0
  23. package/dist/{chunk-EXKKLTXH.js → chunk-HRUMNRYI.js} +1 -1
  24. package/dist/chunk-JHYKRGRA.js +5 -0
  25. package/dist/chunk-JRRYFSCY.js +5 -0
  26. package/dist/chunk-KEWQZYUF.js +7 -0
  27. package/dist/{chunk-IFS5P7CO.js → chunk-LZS7JZK5.js} +1 -1
  28. package/dist/{chunk-FGJSCWUN.js → chunk-NY7HHUGB.js} +2 -2
  29. package/dist/chunk-PS5BWS4I.js +2 -0
  30. package/dist/{chunk-47RGVCPH.js → chunk-QFVRMARS.js} +12 -12
  31. package/dist/chunk-TBF5CVPA.js +1 -0
  32. package/dist/{chunk-26GHWMNN.js → chunk-UBAYMWCX.js} +19 -19
  33. package/dist/chunk-UMDQ6CLQ.js +2 -0
  34. package/dist/{chunk-ZXGQT75B.js → chunk-URC5Y5G2.js} +1 -1
  35. package/dist/chunk-VVPZMWJE.js +1 -0
  36. package/dist/chunk-WRFD4EXD.js +1 -0
  37. package/dist/chunk-YHZSBL2N.js +1 -0
  38. package/dist/copy/copy.css +8 -108
  39. package/dist/copy/index.d.ts +39 -9
  40. package/dist/copy/index.js +18 -19
  41. package/dist/drag/drag.css +8 -8
  42. package/dist/drag/index.js +1 -1
  43. package/dist/easel/index.d.ts +3 -3
  44. package/dist/easel/index.js +1 -1
  45. package/dist/fields/fields.css +8 -8
  46. package/dist/fields/index.js +1 -1
  47. package/dist/gold/index.d.ts +3 -3
  48. package/dist/gold/index.js +1 -1
  49. package/dist/{host-Ud6rLpph.d.ts → host-GOlVK3LX.d.ts} +9 -0
  50. package/dist/icons/index.d.ts +1 -0
  51. package/dist/markup/index.d.ts +1 -629
  52. package/dist/markup/index.js +1 -1
  53. package/dist/menu/menu.css +1 -1
  54. package/dist/panel/index.js +1 -1
  55. package/dist/panel/panel.css +12 -12
  56. package/dist/pick/index.js +1 -1
  57. package/dist/pick/pick.css +7 -7
  58. package/dist/screen/components/AddBlockRow.js +1 -1
  59. package/dist/screen/components/AddSidePanel.js +1 -1
  60. package/dist/screen/components/MediaSidePanel.d.ts +1 -1
  61. package/dist/screen/components/MediaSidePanel.js +1 -1
  62. package/dist/screen/components/NodeContextMenu.d.ts +1 -1
  63. package/dist/screen/components/NodeContextMenu.js +1 -1
  64. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  65. package/dist/screen/components/PanelToggleIcon.d.ts +6 -5
  66. package/dist/screen/components/PanelToggleIcon.js +1 -1
  67. package/dist/screen/components/SaveControls.d.ts +1 -1
  68. package/dist/screen/components/ScreenChrome.js +1 -1
  69. package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
  70. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  71. package/dist/screen/components/ScreenMount.d.ts +1 -1
  72. package/dist/screen/components/ScreenMount.js +1 -1
  73. package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
  74. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  75. package/dist/screen/components/SectionScreenShell.js +16 -16
  76. package/dist/screen/components/SidePanelHead.js +1 -1
  77. package/dist/screen/components/usePartBridge.d.ts +1 -1
  78. package/dist/screen/components/usePartBridge.js +1 -1
  79. package/dist/screen/index.d.ts +1 -1
  80. package/dist/screen/index.js +1 -1
  81. package/dist/screen/lib/document-addressing.d.ts +1 -1
  82. package/dist/screen/lib/host.d.ts +1 -1
  83. package/dist/screen/lib/key-scope.js +1 -1
  84. package/dist/screen/lib/media-panel.d.ts +1 -1
  85. package/dist/screen/lib/media-picker.d.ts +1 -1
  86. package/dist/screen/lib/puck/device-fields.js +1 -1
  87. package/dist/screen/lib/puck/slot-child-name.js +1 -1
  88. package/dist/screen/lib/puck/style-clipboard.d.ts +1 -1
  89. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  90. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  91. package/dist/screen/lib/screen-parts.d.ts +1 -1
  92. package/dist/screen/lib/screen-parts.js +1 -1
  93. package/dist/screen/screen.css +16 -16
  94. package/dist/screen/words.js +1 -1
  95. package/dist/shell/shell.css +10 -8
  96. package/dist/strings/catalogue.d.ts +2 -2
  97. package/dist/strings/catalogue.js +1 -1
  98. package/dist/strings/index.d.ts +2 -2
  99. package/dist/strings/index.js +1 -1
  100. package/dist/text-styles/index.d.ts +4 -231
  101. package/dist/text-styles/index.js +35 -35
  102. package/dist/text-styles/model.d.ts +259 -0
  103. package/dist/text-styles/model.js +1 -0
  104. package/dist/text-styles/text-styles.css +6 -6
  105. package/dist/{words-dsex49Jh.d.ts → words-CiuKuiy0.d.ts} +12 -6
  106. package/package.json +6 -1
  107. package/dist/chunk-546BBOPE.js +0 -1
  108. package/dist/chunk-AZOCY74V.js +0 -57
  109. package/dist/chunk-BHRC3ASL.js +0 -1
  110. package/dist/chunk-BPFPM3L4.js +0 -7
  111. package/dist/chunk-DD7A6RRL.js +0 -5
  112. package/dist/chunk-EQFBUNEB.js +0 -1
  113. package/dist/chunk-FAAZZXIS.js +0 -1
  114. package/dist/chunk-FFYXVAAL.js +0 -1
  115. package/dist/chunk-GCCBEY2W.js +0 -2
  116. package/dist/chunk-GG4FGBFR.js +0 -1
  117. package/dist/chunk-KQMML6JM.js +0 -4
  118. package/dist/chunk-Q6AM43CA.js +0 -1
  119. package/dist/chunk-U7KFFC7N.js +0 -5
  120. package/dist/chunk-VWXUMVCD.js +0 -1
  121. package/dist/chunk-ZAOM6PFH.js +0 -1
@@ -1,19 +1,18 @@
1
- import{selectionToVisible as e,selectionToSource as t,richLayout as n,createHistory as r,colorRunOf as l,textRange as a,selectionBox as o,placeWindow as s,offsetOrigin as i,visibleArea as c,ColorWindow as u,markPress as d,pasteToMarkup as p,richInput as h,editVisible as f,MARKUP_CLIPBOARD_TYPE as m,markupOfRange as g}from"../chunk-FGJSCWUN.js";export{ColorWindow,MARKUP_CLIPBOARD_TYPE,TYPING_BURST_MS,colorRunOf,createHistory,editVisible,markupOfRange,newLine,pasteToMarkup,richInput,richLayout,selectionToSource,selectionToVisible,setBullet,startCanvasTyping,textMap,toSource,toSourceStart,toVisible}from"../chunk-FGJSCWUN.js";import{DEFAULT_COPY_WORDS as y}from"../chunk-Q6AM43CA.js";import{FieldNumber as v}from"../chunk-66LWADFP.js";import{FieldSelect as b}from"../chunk-65Z5FSAW.js";import{SettingsSegmented as k,SettingsSwitch as S,SettingsField as x}from"../chunk-XJCMEEBH.js";import"../chunk-FFYXVAAL.js";import{GoldTextInput as w}from"../chunk-2FZJWH24.js";import{RETIRED_MARKS as E,applyMark as C,markupTools as D,marksIn as N,STANDARD_MARKUP as L,findLink as O,markedAt as T,listIn as z,colorIn as F,spanFor as P,clearStyle as M,toggleMark as R,colorOver as B,setList as K,unlinkAt as j,removeLink as $,linkOver as H,writeLink as V}from"../chunk-546BBOPE.js";import{useWords as A}from"../chunk-MFIRYGHW.js";import{withTip as W}from"../chunk-P2VEMZH5.js";import{IconButton as U,registerModalEscapeInterceptor as I,textToolbarRows as q,TextToolbar as Y,Button as G,LinkPicker as J,Tooltip as Z}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as _,useState as X,useLayoutEffect as Q,useEffect as ee,useId as te}from"react";import{AlignJustifyIcon as ne,AlignRightIcon as re,AlignCenterIcon as le,AlignLeftIcon as ae,ParagraphSpacingIcon as oe,LetterSpacingIcon as se,LineSpacingIcon as ie,TextSizeIcon as ce,ClearMarksIcon as ue,StylesIcon as de,TypeIcon as pe,AlignmentIcon as he,ListFormatIcon as fe,CaseIcon as me,ItalicIcon as ge,LinkIcon as ye,QuietIcon as ve,EmphasisIcon as be,StrikeIcon as ke,BoldIcon as Se,NumberedListIcon as xe,ListIcon as we,ListNoneIcon as Ee,CaseLowerIcon as Ce,CaseCapitalizedIcon as De,CaseUpperIcon as Ne,CaseNormalIcon as Le}from"efficient-shell/icons/efficient";import{jsx as Oe,jsxs as Te,Fragment as ze}from"react/jsx-runtime";var Fe=["left","center","right","justify"],Pe=y.align,Me={left:/* @__PURE__ */Oe(ae,{}),center:/* @__PURE__ */Oe(le,{}),right:/* @__PURE__ */Oe(re,{}),justify:/* @__PURE__ */Oe(ne,{})},Re={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function Be(e,t=Pe){return Fe.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:Me[e],title:t[e]}))}var Ke=/[\u1100-\u11ff\u2e80-\u9fff\uac00-\ud7af\uf900-\ufaff\uff00-\uffef]/;function je(e){if(e.every(e=>e.label===Pe[e.id]))return e.length>3?Re.four:Re.three;const t=e.map(e=>[...e.label].reduce((e,t)=>e+(Ke.test(t)?13:8),0));return{labelsPx:t.reduce((e,t)=>e+t,0),widestLabelPx:Math.max(0,...t)}}function $e(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function He(e,t,n,r=C){const{start:l,end:a}=$e(e,n);return r(e,l,a,t)}function Ve(e,t,n){const{start:r,end:l}=$e(e,n),a=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:a,selectionEnd:a}}function Ae(e,t,n,r){switch(t){case"bold":return e.createElement("strong");case"italic":return e.createElement("em");case"strike":return e.createElement("s");case"underline":return e.createElement("u");case"sup":return e.createElement("sup");case"sub":return e.createElement("sub");case"color":{const t=e.createElement("span");return t.className="es-rich-color",r&&(t.dataset.color=r,t.title=r.startsWith("#")?r.toUpperCase():r,t.style.color=r.startsWith("#")?r:`var(--es-color-${r}, inherit)`),t}case"link":{const t=e.createElement("a");return t.className="es-rich-link",n&&(t.title=n),t}default:{const n=e.createElement("span");return n.className="highlight"===t||"accent"===t?"es-rich-emphasis":`es-rich-${t}`,n}}}function We(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const a=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===a)return 0;const o=t.ownerDocument.createRange();o.setStart(e.lines[a],0);try{o.setEnd(n,r)}catch{return l[a].vis}return l[a].vis+Math.min(o.toString().length,l[a].text.length)}function Ue(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const a=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let o=a.nextNode(),s=null;for(;o;){if(l<=o.data.length)return[o,l];l-=o.data.length,s=o,o=a.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function Ie({value:r,rules:l,multiline:a,readOnly:o=!1,placeholder:s,ariaLabel:i,handle:c,onEdit:u,onSelect:d,onHistory:y,onFormat:v,pending:b,onCommit:k,onCancel:S}){const x=_(null),w=_(null),E=_(null),C=_(null),D=_(null),N=_(r),[L,O]=X(0),T=_({value:r,rules:l,multiline:a,readOnly:o,pending:b,onEdit:u,onHistory:y,onFormat:v});T.current={value:r,rules:l,multiline:a,readOnly:o,pending:b,onEdit:u,onHistory:y,onFormat:v};const z=()=>{const e=x.current,t=w.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=We(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?We(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},F=(e,t)=>{const n=x.current,r=w.current;if(!n||!r)return;const[l,a]=Ue(r,e),[o,s]=Ue(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,a,o,s)};c.current={getSource(){const e=z(),n=w.current;if(!e||!n)return null;const[r,l]=t(n.layout,e[0],e[1]);return{start:r,end:l}},setSource(e,t,n){C.current={text:n,src:[e,t]},O(e=>e+1)},focus(){x.current?.focus()},rangeOf(t,n){const r=x.current,l=w.current;if(!r||!l)return null;const[a,o]=e(l.layout,t,n),[s,i]=Ue(l,a),[c,u]=Ue(l,o),d=r.ownerDocument.createRange();return d.setStart(s,i),d.setEnd(c,u),d}},Q(()=>{const t=x.current;if(!t||D.current)return;const a=C.current?null:z();w.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],a=()=>l.length?l[l.length-1].el:r;let o=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(o=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=Ae(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color);a().appendChild(t),l.push({id:e.marks[r].id,el:t})}o||(o=n.createTextNode(""),a().appendChild(o)),o.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(t,n(r,l)),E.current=r;const o=C.current;if(!o||o.text!==r)return void(a&&t.ownerDocument.activeElement===t&&F(a[0],Math.min(a[1],w.current.layout.text.length)));C.current=null;const s=w.current.layout,[i,c]=o.vis??e(s,o.src[0],o.src[1]);t.ownerDocument.activeElement!==t&&t.focus(),F(i,c)},[r,l,L]);const P=(e,n,r)=>{const l=w.current,[a,o]=t(l.layout,n[0],n[1]);C.current={text:e.text,vis:[e.caret,e.caret]},e.text!==T.current.value?T.current.onEdit(e.text,{start:a,end:o},r):O(e=>e+1)};ee(()=>{const e=x.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:a,pending:o}=T.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),a)return;const s=w.current,i=z();if(!s||!i)return;const c="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,u=c&&!c.collapsed?[We(s,e,c.startContainer,c.startOffset),We(s,e,c.endContainer,c.endOffset)]:null,d=h({value:n,rules:r,multiline:l,inputType:t.inputType,data:t.data??t.dataTransfer?.getData("text/plain")??"",html:t.dataTransfer?.getData("text/html"),doc:e.ownerDocument,sel:i,target:u,pending:o});d&&("history"!==d.kind?"format"!==d.kind?P(d.edit,d.range,d.kind):T.current.onFormat(d.style):T.current.onHistory(d.dir))},n=()=>{D.current||O(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),ee(()=>{const e=x.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=c.current?.getSource();e&&d(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const M=(e,t=!1)=>{const n=z();if(!n||n[0]===n[1])return;e.preventDefault();const a=w.current;e.clipboardData.setData("text/plain",a.layout.text.slice(n[0],n[1])),e.clipboardData.setData(m,g(r,l,n[0],n[1])),t&&!o&&P(f(r,l,n[0],n[1],{text:""}),n,"edit")};/* @__PURE__ */
2
- return Te("div",{className:"es-rich-wrap",children:[s&&""===r?/* @__PURE__ */Oe("div",{className:"es-rich-placeholder","aria-hidden":"true",children:s}):null,
3
- /* @__PURE__ */Oe("div",{ref:x,className:`es-rich${a?" is-multiline":" is-single"}${o?" is-off":""}`,contentEditable:!o,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":a,"aria-label":i,"aria-readonly":o||void 0,"aria-placeholder":s,tabIndex:o?-1:0,spellCheck:!0,onFocus:()=>{N.current=r},onBlur:()=>{r!==N.current&&k?.(r),N.current=r},onKeyDown:e=>{if("Escape"===e.key)return e.preventDefault(),S?.(N.current),void(N.current=r);"Enter"!==e.key||a||(e.preventDefault(),r!==N.current&&k?.(r),N.current=r)},onCompositionStart:()=>{const e=z()??[0,0];D.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=D.current;if(D.current=null,!t)return;const{value:n,rules:r,pending:l}=T.current;e.data?P(f(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):O(e=>e+1)},onCopy:e=>M(e),onCut:e=>M(e,!0),onPaste:e=>{if(e.preventDefault(),o)return;const t=z();if(!t)return;const n=e.clipboardData.getData(m),s=n?a?n:n.replace(/\s*\r?\n\s*/g," "):p({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:e.currentTarget.ownerDocument,multiline:a,rules:l});P(f(r,l,t[0],t[1],{markup:s}),t,"edit")}})]})}var qe={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */Oe(ce,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */Oe(ie,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */Oe(se,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */Oe(oe,{}),unit:"px",step:1,shiftStep:10,min:0}};function Ye(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Ge({cells:e,words:t,readOnly:n=!1}){const r=t??y.cells,l=te();/* @__PURE__ */
4
- return Oe("div",{className:"es-copy-cells-fit",children:/* @__PURE__ */Oe("div",{className:"es-copy-cells",children:e.map(e=>{const t=e.scale??1,a=e.name??(e.nameKey?r[e.nameKey]:e.key),o=e.unit??"",s=e.step??1,i=`${l}-${e.key}`;/* @__PURE__ */
5
- return Te("div",{className:"es-copy-cell",children:[
6
- /* @__PURE__ */Oe("label",{className:"es-field-label es-copy-cell-name",htmlFor:i,children:a}),
7
- /* @__PURE__ */Oe(v,{id:i,value:Ye(e.value,t),styleValue:Ye(e.styleValue,t),onChange:n=>e.onChange(void 0===n?void 0:Number((n/t).toFixed(6))),min:e.min,max:e.max,step:s,shiftStep:e.shiftStep,icon:e.icon,unit:o||void 0,steppers:"compact",readOnly:n,ariaLabel:a,title:r.tip({name:a,step:s,unit:o})})]},e.key)})})})}var Je=/* @__PURE__ */new Set([...E,"clear"]),Ze={bold:/* @__PURE__ */Oe(Se,{size:16}),italic:/* @__PURE__ */Oe(ge,{size:16}),strike:/* @__PURE__ */Oe(ke,{size:16}),highlight:/* @__PURE__ */Oe(be,{size:16}),quiet:/* @__PURE__ */Oe(ve,{size:16}),link:/* @__PURE__ */Oe(ye,{size:16}),clear:/* @__PURE__ */Oe(ue,{size:16})};function _e(e){if(!e)return;const t=e.split("+"),n=t.pop().toUpperCase();return["Meta",...t.map(e=>e[0].toUpperCase()+e.slice(1)),n].join("+")}var Xe={bold:"is-bold",italic:"is-italic",strike:"is-strike"};function Qe({tools:e,onApply:t,disabled:n=!1,actions:r,align:l,glyphs:a,ariaLabel:o,pressed:s,open:i=null}){const c=A("copy",y),u=("string"==typeof e[0]?D(e).map(e=>({...e,...c.marks[e.style]})):e).filter(e=>!Je.has(e.style));return 0!==u.length||r||l?/* @__PURE__ */Te("div",{className:"es-copy-bar",role:"group","aria-label":o??c.formatting,children:[u.map(e=>{const r=a?.[e.style]??Ze[e.style],l=i===e.style||Boolean(s?.[e.style]),o="link"===e.style&&Boolean(s);return W(e.title,/* @__PURE__ */Oe(U,{onMouseDown:e=>e.preventDefault(),onClick:()=>t(e.style),disabled:n,"aria-label":e.name??e.title,"aria-keyshortcuts":_e(e.shortcut),"aria-pressed":o||!s&&!i?void 0:l,pressed:o?l:void 0,"aria-haspopup":o?"dialog":void 0,"aria-expanded":o?"link"===i:void 0,className:`es-copy-mark${r?" has-glyph":Xe[e.style]?` ${Xe[e.style]}`:""}${l?" is-active":""}`,children:r??e.label},e.style))}),r?/* @__PURE__ */Te(ze,{children:[
8
- /* @__PURE__ */Oe("span",{className:"es-copy-bar-split","aria-hidden":"true"}),r]}):null,l?/* @__PURE__ */Oe("span",{className:"es-copy-bar-end",children:l}):null]}):null}function et({target:e,onChange:t}){const n=_(null);return Q(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var tt=["bold","italic","underline","strike","sup","sub"];function nt({value:e,onChange:t,onCommit:n,onCancel:h,multiline:f=!1,placeholder:m,ariaLabel:g,className:v,readOnly:b=!1,rules:x,tools:E=[],writeMark:U,actions:Z,align:ne,glyphs:re,barLabel:le,renderFooter:ae,inputRef:oe,barShows:se="always",richText:ie=!0,defaultShowMarks:ce=!1,toolbar:de="final",colors:pe,cells:he,letterCase:fe,lastTool:me}){const ge="final"===de,ye=A("copy",y),ve=_(null),be=oe??ve,[ke,Se]=X(!1),[xe,we]=X(null),Ee=_(r()).current,Ce=_(null);ee(()=>{const t=Ce.current;t&&e===t.to?Ce.current=null:t&&e===t.from||(Ce.current=null,Ee.reset())},[e,Ee]);const De=n=>{Ce.current={from:Ce.current?.from??e,to:n},t(n)},Ne=t=>({text:e,start:t?.selectionStart??xe?.start??e.length,end:t?.selectionEnd??xe?.end??e.length}),[Le,Fe]=X(ce),Pe=ie&&!(f&&Le),Me=_(null),Re=te(),[Ke,$e]=X(null),[Ae,We]=X(!1),Ue=()=>{if(!Pe)return be.current;const e=Me.current?.getSource()??xe;return e?{selectionStart:e.start,selectionEnd:e.end}:null},qe=et({target:be,onChange:De}),Ye=e=>(we({start:e.selectionStart,end:e.selectionEnd}),e),Ze=(t,n)=>{if(!Pe)return void qe(e=>(n&&Ee.record(Ne(e),"edit",Date.now()),Ye(t(e))));const r=Ue(),l=Ye(t(r));n&&Ee.record(Ne(r),"edit",Date.now()),$e(null),l.text!==e&&De(l.text),Me.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},_e=e=>Ze(e,!0),Xe=e=>Ze(t=>{const n=Ne(t),r=Ee[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),nt=_(null);Q(()=>{const t=nt.current;t&&(nt.current=null,Pe?Me.current?.setSource(t.start,t.end,e):(be.current?.focus(),be.current?.setSelectionRange(t.start,t.end),we(t)))},[Pe]);const[rt,lt]=X(null),at=x??L,ot=("string"==typeof E[0]?D(E):E).filter(e=>!Je.has(e.style)),st=ge?("string"==typeof E[0]?E:E.map(e=>e.style)).filter(e=>!Je.has(e)):ot.map(e=>e.style),it={};if(xe&&(Pe||ge)){const t=N(e,xe.start,xe.end,at);for(const e of st){const n=t.has(e)||"highlight"===e&&t.has("accent");it[e]=!!Ke?.add.includes(e)||!Ke?.drop.includes(e)&&n}ge&&(it.link=t.has("link"))}else if(xe)for(const t of st)it[t]="link"===t?null!==O(e,xe.start,xe.end):T(e,xe.start,xe.end,t);const ct=()=>{const t=Ue(),n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}},ut=t=>{if(ge&&"link"!==t&&P(0,t)){const{start:n,end:r}=ct();if(n===r&&!Pe)return void _e(n=>He(e,t,n,(e,t,n,r)=>C(e,t,n,r,at,ye.placeholders)));const l=d({value:e,rules:at,start:n,end:r,style:t,pending:Ke});return void("pending"===l.kind?$e(l.pending):_e(()=>l.result))}if("clear"===t)return void _e(n=>He(e,t,n,(e,t,n)=>C(e,t,n,"clear",at)));if("link"!==t&&Pe&&P(0,t)){const n=Ue(),r=n?.selectionStart??e.length,l=n?.selectionEnd??r;if(r===l){const n=N(e,r,l,at),a=n.has(t)||"highlight"===t&&n.has("accent"),o=Ke&&Ke.at===r?Ke:null,s=!!o?.add.includes(t)||!o?.drop.includes(t)&&a,i=(o?.add??[]).filter(e=>e!==t),c=(o?.drop??[]).filter(e=>e!==t);return s&&a?c.push(t):s||a||i.push(t),void $e(i.length||c.length?{add:i,drop:c,at:r}:null)}return void _e(n=>R(e,n?.selectionStart??r,n?.selectionEnd??l,t,at))}if("link"!==t){const n=U??((e,t,n,r)=>C(e,t,n,r,L,ye.placeholders));return void _e(r=>He(e,t,r,n))}const n=Ue(),r=n?.selectionStart??e.length,l=n?.selectionEnd??r;We(!1),lt({start:r,end:l,link:O(e,r,l)})},dt=Boolean(xe&&xe.start!==xe.end),pt=xe?z(e,xe.start,xe.end,at):null,ht=xe?Ke&&void 0!==Ke.color&&Ke.at===xe.start?Ke.color:F(e,xe.start,xe.end,at):null,ft=l(ht,pe),mt=t=>{Pe?t?Me.current?.setSource(t.start,t.end,e):Me.current?.focus():(be.current?.focus(),t&&be.current?.setSelectionRange(t.start,t.end))},gt=()=>{const e=rt;lt(null),mt(e?{start:e.start,end:e.end}:xe)},yt=()=>{const e=bt.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));We(!1),t&&mt(xe)},vt=_(yt);vt.current=yt,ee(()=>{if(Ae)return I(e=>{const t=bt.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(vt.current(),!0)},()=>bt.current?.querySelector(".es-copy-colors"))},[Ae]);const bt=_(null),kt=Ae||null!==rt;ee(()=>{const e=bt.current;if(!kt||!e)return;const t=e.ownerDocument,n=()=>{We(!1),lt(null)},r=t=>{e.contains(t.target)||n()};let l;const a=r=>{const a=r.relatedTarget;a?e.contains(a)||n():(clearTimeout(l),l=setTimeout(()=>{const r=t.activeElement;t.hasFocus()&&r&&r!==t.body&&!e.contains(r)&&n()},0))};return t.addEventListener("pointerdown",r,!0),e.addEventListener("focusout",a),()=>{clearTimeout(l),t.removeEventListener("pointerdown",r,!0),e.removeEventListener("focusout",a)}},[kt]);const St=rt??(Ae?xe??{start:e.length,end:e.length}:null),xt=_(()=>{});xt.current=()=>{const e=bt.current,t=e?.querySelector(".rosh-tb-wrap > .es-copy-pop");if(!e||!t||!St)return;const n=Pe?null:e.querySelector(".es-gold-layer"),r=Pe?Me.current?.rangeOf(St.start,St.end)??null:n?a(n,St.start,St.end):null,l=r?.endContainer,u=l?1===l.nodeType?l:l.parentElement:null,d=r?o(r,u?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!d)return;const p=s({anchor:d,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:c(e),parent:i(t)});t.style.top=`${p.top}px`,t.style.left=`${p.left}px`,t.style.setProperty("--es-pop-point",`${p.point}px`),t.dataset.side=p.above?"above":"below"},Q(()=>{const e=bt.current;if(!kt||!e)return;const t=()=>xt.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".rosh-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,a=l&&r?new l(t):null;return a&&r&&a.observe(r),()=>{n?.removeEventListener("resize",t),a?.disconnect()}},[kt,Ae,rt,St?.start,St?.end,Pe]);const wt=t=>rt&&/* @__PURE__ */Oe(J,{className:t?"es-copy-link es-copy-pop":"es-copy-link",value:rt.link?.href??"",onApply:t=>{const n=rt;lt(null),_e(()=>Pe?H(e,n.start,n.end,t,at):V(e,n.start,n.end,t))},onRemove:rt.link?()=>{const t=rt.link,n=rt;lt(null),t&&_e(()=>Pe?j(e,n.start,n.end,at):$(e,t))}:void 0,onCancel:gt}),Et=ne?Be(ne.allow,ye.align):[],Ct="always"===se||ke||null!==rt||Ae,Dt=pe&&pe.length>0?{run:ft,open:Ae,onToggle:()=>{lt(null),Ae?yt():We(!0)}}:void 0,Nt=Ct&&ge&&me?me({className:"rosh-tb-btn",disabled:b,selected:dt,keepCaret:e=>e.preventDefault(),insert:t=>_e(n=>Ve(e,t,n))}):void 0,Lt=new Set(st),Ot=ne?{value:ne.value,allow:ne.allow,onChange:ne.onChange,disabled:ne.disabled}:void 0,Tt={pressed:pt,onList:t=>{const{start:n,end:r}=ct(),l=z(e,n,r,at);_e(()=>K(e,n,r,l===t?null:t,at))}},zt=q({offered:Lt,color:Dt,last:Nt,alignment:Ot,list:Tt,letterCase:fe}),Ft=ge&&Ct&&(tt.some(e=>Lt.has(e))||Boolean(Dt));/* @__PURE__ */
9
- return Te("div",{ref:bt,className:"es-copy"+(v?` ${v}`:""),onFocus:()=>Se(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||Se(!1)},onKeyDown:e=>{const t=e.target===be.current||Boolean(e.target.closest?.(".es-rich"));if(b||!t)return;if(e.altKey||e.metaKey===e.ctrlKey)return;const n=e.key.toLowerCase(),r="KeyZ"===e.code||"z"===n,l=("KeyY"===e.code||"y"===n)&&!e.shiftKey;if(r||l)return e.preventDefault(),e.stopPropagation(),void Xe(l||e.shiftKey?"redo":"undo");const a=`${e.shiftKey?"shift+":""}${n}`;if(ge){const t={b:"bold",i:"italic",u:"underline",k:"link"}[a];if(!t||!st.includes(t))return;return e.preventDefault(),e.stopPropagation(),void ut(t)}const o=ot.find(e=>e.shortcut===a);o&&(e.preventDefault(),e.stopPropagation(),ut(o.style))},onPaste:t=>{const n=be.current;if(b||!n||t.target!==n)return;t.preventDefault();const r=p({html:t.clipboardData.getData("text/html"),text:t.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:f,rules:at});_e(t=>Ve(e,r,t))},style:pe&&pe.length>0?Object.fromEntries(pe.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const t=be.current;t&&t.ownerDocument.activeElement===t&&we({start:t.selectionStart??e.length,end:t.selectionEnd??e.length})},children:[Ct&&ge&&(zt.words||zt.paragraph)?
10
- /* @__PURE__ */Oe(Y,{className:"es-copy-toolbar","aria-label":le??ye.formatting,offered:Lt,pressed:it,onMark:e=>ut(e),color:Dt,linkOpen:null!==rt,last:Nt,alignment:Ot,list:Tt,letterCase:fe,disabled:b,windows:/* @__PURE__ */Te(ze,{children:[Ae&&pe&&pe.length>0?/* @__PURE__ */Oe(u,{colors:pe,current:ht,words:ye.colors??y.colors,onPick:t=>{const{start:n,end:r}=ct();if(n!==r)_e(()=>B(e,n,r,t,at));else{if(!Pe)return;$e({add:Ke?.add??[],drop:Ke?.drop??[],color:t,at:n})}}}):null,rt?wt(!0):null]})}):null,ge&&he&&he.length>0?/* @__PURE__ */Oe(Ge,{cells:he,words:ye.cells??y.cells,readOnly:b}):null,Ct&&!ge?/* @__PURE__ */Oe(Qe,{tools:E,disabled:b,actions:Z,glyphs:re,ariaLabel:le,pressed:it,open:rt?"link":null,onApply:ut,align:ne?/* @__PURE__ */Oe(k,{options:Et,value:ne.value,onChange:ne.onChange,ariaLabel:ye.alignment,disabled:b||ne.disabled,fit:je(Et)}):null}):null,Pe?/* @__PURE__ */Oe(Ie,{value:e,rules:at,multiline:f,readOnly:b,placeholder:m,ariaLabel:g,handle:Me,pending:Ke??void 0,onEdit:(t,n,r)=>{Ee.record({text:e,start:n.start,end:n.end},r,Date.now()),$e(null),De(t)},onSelect:e=>{we(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Ke||e.start===Ke.at&&e.end===Ke.at||$e(null)},onHistory:Xe,onFormat:e=>{st.includes(e)&&ut(e)},onCommit:n,onCancel:h}):/* @__PURE__ */Oe(w,{value:e,onInput:e=>{Ee.record(Ne(null),"type",Date.now()),De(e)},onCommit:n,onCancel:h,multiline:f,placeholder:m,ariaLabel:g,rules:x,disabled:b,inputRef:be,className:"es-copy-box"}),rt&&!ge?wt(!1):null,ae?ae({focused:ke,insert:t=>_e(n=>Ve(e,t,n))}):null,ie&&f||Ft?
11
- /* @__PURE__ */Te("div",{className:"es-copy-marks",children:[ie&&f?/* @__PURE__ */Te(ze,{children:[
12
- /* @__PURE__ */Oe(S,{checked:Le,onChange:()=>{const e=Ue();nt.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:xe,$e(null),Fe(e=>!e)},ariaLabelledBy:Re,disabled:b}),
13
- /* @__PURE__ */Oe("span",{id:Re,className:"es-copy-marks-label",children:ye.showMarks??"Show marks"})]}):null,Ft?W(dt?void 0:ye.clearStyleEmpty??"Select words first",/* @__PURE__ */Te(G,{variant:"secondary",size:"sm",className:"es-copy-clear",disabled:b||!dt,onMouseDown:e=>e.preventDefault(),onClick:()=>{const{start:t,end:n}=ct();if(t===n)return;const r=M(e,t,n,at);r.text!==e&&_e(()=>r)},children:[
14
- /* @__PURE__ */Oe(ue,{size:16}),ye.clearStyle??y.clearStyle]})):null]}):null]})}var rt=["none","bullet","number"],lt=["none","upper","capitalize","lower"],at={none:/* @__PURE__ */Oe(Ee,{}),bullet:/* @__PURE__ */Oe(we,{}),number:/* @__PURE__ */Oe(xe,{})},ot={none:/* @__PURE__ */Oe(Le,{}),upper:/* @__PURE__ */Oe(Ne,{}),capitalize:/* @__PURE__ */Oe(De,{}),lower:/* @__PURE__ */Oe(Ce,{})};function st({label:e,icon:t,answers:n,names:r,glyphs:l,row:a,readOnly:o}){const s=a.value||a.styleValue||"";/* @__PURE__ */
15
- return Oe(x,{label:e,icon:t,children:/* @__PURE__ */Oe(k,{ariaLabel:e,value:s,disabled:o,onChange:e=>{o||a.onChange(function(e,t){return t===e.value||""===e.value&&t===e.styleValue?"":t}(a,e))},options:n.map(e=>({id:e,label:l[e],title:r[e]}))})})}function it({kept:e,keptHint:t,readOnly:n=!1,style:r,font:l,italic:a,cells:o,align:s,list:i,letterCase:c}){const u=A("copy",y),d={...y.panel,...u.panel},p=u.clearStyle??y.clearStyle,h=r&&!n?[r.onClearChanges&&{label:p,onSelect:r.onClearChanges},r.onEditStyles&&{label:d.editStyles,onSelect:r.onEditStyles},r.onUpdateStyle&&{label:d.updateStyle,onSelect:r.onUpdateStyle}].filter(e=>!!e):[],f=!!a&&(a.value??a.styleValue??!1),m=a?/* @__PURE__ */Oe(Z,{content:d.italic,children:/* @__PURE__ */Oe(U,{size:"sm",variant:"ghost","aria-label":d.italic,"aria-pressed":f,disabled:n,onClick:()=>{if(n)return;const e=!f;a.onChange(e===(a.styleValue??!1)?void 0:e)},children:/* @__PURE__ */Oe(ge,{})})}):null;/* @__PURE__ */
16
- return Te("div",{className:"es-tpp",children:[e?/* @__PURE__ */Te("div",{className:"es-tpp-kept",children:[
17
- /* @__PURE__ */Oe(nt,{...e,readOnly:n||e.readOnly}),t?/* @__PURE__ */Oe("p",{className:"es-field-hint",children:t}):null]}):null,r?/* @__PURE__ */Oe(x,{label:d.style,icon:/* @__PURE__ */Oe(de,{}),children:/* @__PURE__ */Oe(b,{ariaLabel:d.style,value:r.value,options:r.options,onChange:r.onChange,changed:r.changed,footer:h,readOnly:n})}):null,l?/* @__PURE__ */Oe(x,{label:d.font,icon:/* @__PURE__ */Oe(pe,{}),children:/* @__PURE__ */Te("div",{className:"es-tpp-font",children:[
18
- /* @__PURE__ */Oe("div",{className:"es-tpp-font-select",children:/* @__PURE__ */Oe(b,{ariaLabel:d.font,value:l.value||void 0,placeholder:l.styleValue,options:l.options,onChange:l.onChange,searchable:l.searchable,readOnly:n})}),m]})}):m?
19
- /* @__PURE__ */Oe(x,{label:d.italic,icon:/* @__PURE__ */Oe(pe,{}),children:/* @__PURE__ */Oe("div",{className:"es-tpp-font",children:m})}):null,o?.length?/* @__PURE__ */Oe(Ge,{cells:o,words:u.cells,readOnly:n}):null,s?/* @__PURE__ */Oe(st,{label:u.alignment,icon:/* @__PURE__ */Oe(he,{}),answers:Fe.filter(e=>!s.allow||s.allow.includes(e)),names:u.align,glyphs:Me,row:s,readOnly:n}):null,i?/* @__PURE__ */Oe(st,{label:d.list,icon:/* @__PURE__ */Oe(fe,{}),answers:rt,names:d.lists,glyphs:at,row:i,readOnly:n}):null,c?/* @__PURE__ */Oe(st,{label:d.capitalization,icon:/* @__PURE__ */Oe(me,{}),answers:lt,names:d.cases,glyphs:ot,row:c,readOnly:n}):null]})}export{Fe as COPY_ALIGNS,Re as COPY_ALIGN_FIT,Me as COPY_ALIGN_GLYPHS,Pe as COPY_ALIGN_LABELS,qe as COPY_CELLS,nt as CopyBox,Ge as CopyCells,Qe as MarkBar,Ie as RichBox,it as TextPartPanel,_e as ariaShortcut,Be as copyAlignOptions,Ve as insertSelection,He as markSelection,et as useCaretEdit};
1
+ import{TEXT_STYLE_CASES as e}from"../chunk-YHZSBL2N.js";import{selectionToVisible as t,selectionToSource as n,richLayout as r,createHistory as l,colorRunOf as o,textRange as a,selectionBox as s,placeWindow as c,offsetOrigin as i,visibleArea as u,ColorWindow as d,markPress as p,pasteToMarkup as m,richInput as h,editVisible as f,MARKUP_CLIPBOARD_TYPE as g,markupOfRange as y}from"../chunk-NY7HHUGB.js";export{ColorWindow,MARKUP_CLIPBOARD_TYPE,TYPING_BURST_MS,colorRunOf,createHistory,editVisible,markupOfRange,newLine,pasteToMarkup,richInput,richLayout,selectionToSource,selectionToVisible,setBullet,startCanvasTyping,textMap,toSource,toSourceStart,toVisible}from"../chunk-NY7HHUGB.js";import{DEFAULT_COPY_WORDS as v}from"../chunk-33C6ALT5.js";import{FieldNumber as b}from"../chunk-2XMHLXMA.js";import{FieldSelect as S}from"../chunk-G3GWAP5R.js";import{SettingsSwitch as k,SettingsField as x,SettingsSegmented as w}from"../chunk-36LVP5WD.js";import"../chunk-WRFD4EXD.js";import{GoldTextInput as E}from"../chunk-H4UMY7QF.js";import{useWords as C}from"../chunk-MFIRYGHW.js";import{TextToolbar as D,registerModalEscapeInterceptor as N,textToolbarRows as L,LinkPicker as O,Tooltip as T,IconButton as R}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as H,useState as K,useLayoutEffect as M,useEffect as P,useId as j}from"react";import{RETIRED_MARKS as F,applyMark as B,marksIn as $,STANDARD_MARKUP as V,listIn as z,colorIn as U,spanFor as W,findLink as A,colorOver as Y,setList as I,unlinkAt as G,removeLink as q,linkOver as _,writeLink as X}from"efficient-shell/markup";import{jsxs as Z,jsx as Q,Fragment as J}from"react/jsx-runtime";import{ParagraphSpacingIcon as ee,LetterSpacingIcon as te,LineSpacingIcon as ne,TextSizeIcon as re,AlignJustifyIcon as le,AlignRightIcon as oe,AlignCenterIcon as ae,AlignLeftIcon as se,StylesIcon as ce,TypeIcon as ie,AlignmentIcon as ue,ListFormatIcon as de,CaseIcon as pe,ItalicIcon as me,NumberedListIcon as he,ListIcon as fe,ListNoneIcon as ge,CaseLowerIcon as ye,CaseCapitalizedIcon as ve,CaseUpperIcon as be,CaseNormalIcon as Se}from"efficient-shell/icons/efficient";function ke(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function xe(e,t,n,r=B){const{start:l,end:o}=ke(e,n);return r(e,l,o,t)}function we(e,t,n){const{start:r,end:l}=ke(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}function Ee(e,t,n,r){switch(t){case"bold":return e.createElement("strong");case"italic":return e.createElement("em");case"strike":return e.createElement("s");case"underline":return e.createElement("u");case"sup":return e.createElement("sup");case"sub":return e.createElement("sub");case"color":{const t=e.createElement("span");return t.className="es-rich-color",r&&(t.dataset.color=r,t.title=r.startsWith("#")?r.toUpperCase():r,t.style.color=r.startsWith("#")?r:`var(--es-color-${r}, inherit)`),t}case"link":{const t=e.createElement("a");return t.className="es-rich-link",n&&(t.title=n),t}default:{const n=e.createElement("span");return n.className="highlight"===t||"accent"===t?"es-rich-emphasis":`es-rich-${t}`,n}}}function Ce(e,t,n,r){const l=e.layout.lines;if(n===t)return r>=e.lines.length?e.layout.text.length:l[r].vis;const o=e.lines.findIndex(e=>e===n||e.contains(n));if(-1===o)return 0;const a=t.ownerDocument.createRange();a.setStart(e.lines[o],0);try{a.setEnd(n,r)}catch{return l[o].vis}return l[o].vis+Math.min(a.toString().length,l[o].text.length)}function De(e,t){const n=e.layout.lines;let r=n.length-1;for(let e=0;e<n.length;e+=1)if(t<=n[e].vis+n[e].text.length){r=e;break}let l=Math.max(0,t-n[r].vis);const o=e.lines[r].ownerDocument.createTreeWalker(e.lines[r],4);let a=o.nextNode(),s=null;for(;a;){if(l<=a.data.length)return[a,l];l-=a.data.length,s=a,a=o.nextNode()}return s?[s,s.data.length]:[e.lines[r],0]}function Ne({value:e,rules:l,multiline:o,readOnly:a=!1,placeholder:s,ariaLabel:c,handle:i,onEdit:u,onSelect:d,onHistory:p,onFormat:v,pending:b,onCommit:S,onCancel:k}){const x=H(null),w=H(null),E=H(null),C=H(null),D=H(null),N=H(e),[L,O]=K(0),T=H({value:e,rules:l,multiline:o,readOnly:a,pending:b,onEdit:u,onHistory:p,onFormat:v});T.current={value:e,rules:l,multiline:o,readOnly:a,pending:b,onEdit:u,onHistory:p,onFormat:v};const R=()=>{const e=x.current,t=w.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Ce(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Ce(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},j=(e,t)=>{const n=x.current,r=w.current;if(!n||!r)return;const[l,o]=De(r,e),[a,s]=De(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};i.current={getSource(){const e=R(),t=w.current;if(!e||!t)return null;const[r,l]=n(t.layout,e[0],e[1]);return{start:r,end:l}},setSource(e,t,n){C.current={text:n,src:[e,t]},O(e=>e+1)},focus(){x.current?.focus()},rangeOf(e,n){const r=x.current,l=w.current;if(!r||!l)return null;const[o,a]=t(l.layout,e,n),[s,c]=De(l,o),[i,u]=De(l,a),d=r.ownerDocument.createRange();return d.setStart(s,c),d.setEnd(i,u),d}},M(()=>{const n=x.current;if(!n||D.current)return;const o=C.current?null:R();w.current=function(e,t){const n=e.ownerDocument;e.replaceChildren();const r=t.lines.map(t=>{const r=n.createElement("div");r.className=null!=t.number?"es-rich-line is-numbered":t.bullet?"es-rich-line is-bullet":"es-rich-line",null!=t.number&&(r.dataset.number=t.number);const l=[],o=()=>l.length?l[l.length-1].el:r;let a=null;for(const e of t.chars){let t=0;for(;t<l.length&&t<e.marks.length&&l[t].id===e.marks[t].id;)t+=1;(l.length>t||e.marks.length>t)&&(a=null),l.length=t;for(let r=t;r<e.marks.length;r+=1){const t=Ee(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color);o().appendChild(t),l.push({id:e.marks[r].id,el:t})}a||(a=n.createTextNode(""),o().appendChild(a)),a.data+=e.ch}return 0===t.chars.length&&r.appendChild(n.createElement("br")),e.appendChild(r),r});return{layout:t,lines:r}}(n,r(e,l)),E.current=e;const a=C.current;if(!a||a.text!==e)return void(o&&n.ownerDocument.activeElement===n&&j(o[0],Math.min(o[1],w.current.layout.text.length)));C.current=null;const s=w.current.layout,[c,i]=a.vis??t(s,a.src[0],a.src[1]);n.ownerDocument.activeElement!==n&&n.focus(),j(c,i)},[e,l,L]);const F=(e,t,r)=>{const l=w.current,[o,a]=n(l.layout,t[0],t[1]);C.current={text:e.text,vis:[e.caret,e.caret]},e.text!==T.current.value?T.current.onEdit(e.text,{start:o,end:a},r):O(e=>e+1)};P(()=>{const e=x.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=T.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=w.current,c=R();if(!s||!c)return;const i="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,u=i&&!i.collapsed?[Ce(s,e,i.startContainer,i.startOffset),Ce(s,e,i.endContainer,i.endOffset)]:null,d=h({value:n,rules:r,multiline:l,inputType:t.inputType,data:t.data??t.dataTransfer?.getData("text/plain")??"",html:t.dataTransfer?.getData("text/html"),doc:e.ownerDocument,sel:c,target:u,pending:a});d&&("history"!==d.kind?"format"!==d.kind?F(d.edit,d.range,d.kind):T.current.onFormat(d.style):T.current.onHistory(d.dir))},n=()=>{D.current||O(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),P(()=>{const e=x.current;if(!e)return;const t=e.ownerDocument,n=()=>{const e=i.current?.getSource();e&&d(e)};return t.addEventListener("selectionchange",n),()=>t.removeEventListener("selectionchange",n)});const B=(t,n=!1)=>{const r=R();if(!r||r[0]===r[1])return;t.preventDefault();const o=w.current;t.clipboardData.setData("text/plain",o.layout.text.slice(r[0],r[1])),t.clipboardData.setData(g,y(e,l,r[0],r[1])),n&&!a&&F(f(e,l,r[0],r[1],{text:""}),r,"edit")};/* @__PURE__ */
2
+ return Z("div",{className:"es-rich-wrap",children:[s&&""===e?/* @__PURE__ */Q("div",{className:"es-rich-placeholder","aria-hidden":"true",children:s}):null,
3
+ /* @__PURE__ */Q("div",{ref:x,className:`es-rich${o?" is-multiline":" is-single"}${a?" is-off":""}`,contentEditable:!a,suppressContentEditableWarning:!0,role:"textbox","aria-multiline":o,"aria-label":c,"aria-readonly":a||void 0,"aria-placeholder":s,tabIndex:a?-1:0,spellCheck:!0,onFocus:()=>{N.current=e},onBlur:()=>{e!==N.current&&S?.(e),N.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),k?.(N.current),void(N.current=e);"Enter"!==t.key||o||(t.preventDefault(),e!==N.current&&S?.(e),N.current=e)},onCompositionStart:()=>{const e=R()??[0,0];D.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=D.current;if(D.current=null,!t)return;const{value:n,rules:r,pending:l}=T.current;e.data?F(f(n,r,t.from,t.to,{text:e.data,add:l?.add,drop:l?.drop,color:l?.color}),[t.from,t.to],"type"):O(e=>e+1)},onCopy:e=>B(e),onCut:e=>B(e,!0),onPaste:t=>{if(t.preventDefault(),a)return;const n=R();if(!n)return;const r=t.clipboardData.getData(g),s=r?o?r:r.replace(/\s*\r?\n\s*/g," "):m({html:t.clipboardData.getData("text/html"),text:t.clipboardData.getData("text/plain")},{doc:t.currentTarget.ownerDocument,multiline:o,rules:l});F(f(e,l,n[0],n[1],{markup:s}),n,"edit")}})]})}var Le={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */Q(re,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */Q(ne,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */Q(te,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */Q(ee,{}),unit:"px",step:1,shiftStep:10,min:0}};function Oe(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function Te({cells:e,words:t,readOnly:n=!1}){const r=t??v.cells,l=j();/* @__PURE__ */
4
+ return Q("div",{className:"es-copy-cells-fit",children:/* @__PURE__ */Q("div",{className:"es-copy-cells",children:e.map(e=>{const t=e.scale??1,o=e.name??(e.nameKey?r[e.nameKey]:e.key),a=e.unit??"",s=e.step??1,c=`${l}-${e.key}`;/* @__PURE__ */
5
+ return Z("div",{className:"es-copy-cell",children:[
6
+ /* @__PURE__ */Q("label",{className:"es-field-label es-copy-cell-name",htmlFor:c,children:o}),
7
+ /* @__PURE__ */Q(b,{id:c,value:Oe(e.value,t),styleValue:Oe(e.styleValue,t),onChange:n=>e.onChange(void 0===n?void 0:Number((n/t).toFixed(6))),min:e.min,max:e.max,step:s,shiftStep:e.shiftStep,icon:e.icon,unit:a||void 0,steppers:"compact",readOnly:n,ariaLabel:o,title:r.tip({name:o,step:s,unit:a})})]},e.key)})})})}function Re({target:e,onChange:t}){const n=H(null);return M(()=>{const t=n.current,r=e.current;t&&r&&r.value===t.text&&(n.current=null,r.focus(),r.setSelectionRange(t.start,t.end))}),r=>{const l=r(e.current);t(l.text),n.current={start:l.selectionStart,end:l.selectionEnd,text:l.text}}}var He=/* @__PURE__ */new Set([...F,"clear"]);function Ke(e){if(!e)return;const t=e.split("+"),n=t.pop().toUpperCase();return["Meta",...t.map(e=>e[0].toUpperCase()+e.slice(1)),n].join("+")}function Me({tools:e,onApply:t,disabled:n=!1,actions:r,ariaLabel:l,pressed:o,open:a=null}){const s=C("copy",v),c=("string"==typeof e[0]?e:e.map(e=>e.style)).filter(e=>!He.has(e));/* @__PURE__ */
8
+ return Q(D,{"aria-label":l??s.formatting,offered:new Set(c),pressed:o??{},onMark:e=>t(e),linkOpen:"link"===a,list:c.includes("bullet")||c.includes("number")?{pressed:null,onList:e=>t(e)}:void 0,last:r,disabled:n})}function Pe({value:e,onChange:t,onCommit:n,onCancel:r,multiline:h=!1,placeholder:f,ariaLabel:g,className:y,readOnly:b=!1,rules:S,tools:x=[],writeMark:w,align:T,actions:R,toolbar:F,barLabel:ee,renderFooter:te,inputRef:ne,barShows:re="always",richText:le=!0,defaultShowMarks:oe=!1,colors:ae,cells:se,letterCase:ce,lastTool:ie}){const ue=C("copy",v),de=H(null),pe=ne??de,[me,he]=K(!1),[fe,ge]=K(null),ye=H(l()).current,ve=H(null);P(()=>{const t=ve.current;t&&e===t.to?ve.current=null:t&&e===t.from||(ve.current=null,ye.reset())},[e,ye]);const be=n=>{ve.current={from:ve.current?.from??e,to:n},t(n)},Se=t=>({text:e,start:t?.selectionStart??fe?.start??e.length,end:t?.selectionEnd??fe?.end??e.length}),[ke,Ee]=K(oe),Ce=le&&!(h&&ke),De=H(null),Le=j(),[Oe,Ke]=K(null),[Me,Pe]=K(!1),je=()=>{if(!Ce)return pe.current;const e=De.current?.getSource()??fe;return e?{selectionStart:e.start,selectionEnd:e.end}:null},Fe=Re({target:pe,onChange:be}),Be=e=>(ge({start:e.selectionStart,end:e.selectionEnd}),e),$e=(t,n)=>{if(!Ce)return void Fe(e=>(n&&ye.record(Se(e),"edit",Date.now()),Be(t(e))));const r=je(),l=Be(t(r));n&&ye.record(Se(r),"edit",Date.now()),Ke(null),l.text!==e&&be(l.text),De.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},Ve=e=>$e(e,!0),ze=e=>$e(t=>{const n=Se(t),r=ye[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),Ue=H(null);M(()=>{const t=Ue.current;t&&(Ue.current=null,Ce?De.current?.setSource(t.start,t.end,e):(pe.current?.focus(),pe.current?.setSelectionRange(t.start,t.end),ge(t)))},[Ce]);const[We,Ae]=K(null),Ye=S??V,Ie=("string"==typeof x[0]?x:x.map(e=>e.style)).filter(e=>!He.has(e)),Ge={};if(fe){const t=$(e,fe.start,fe.end,Ye);for(const e of Ie){const n=t.has(e)||"highlight"===e&&t.has("accent");Ge[e]=!!Oe?.add.includes(e)||!Oe?.drop.includes(e)&&n}Ge.link=t.has("link")}const qe=()=>{const t=je(),n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}},_e=t=>{if("link"!==t&&W(0,t)){const{start:n,end:r}=qe();if(n===r&&!Ce)return void Ve(n=>xe(e,t,n,(e,t,n,r)=>B(e,t,n,r,Ye,ue.placeholders)));const l=p({value:e,rules:Ye,start:n,end:r,style:t,pending:Oe});return void("pending"===l.kind?Ke(l.pending):Ve(()=>l.result))}if("link"!==t){const n=w??((e,t,n,r)=>B(e,t,n,r,V,ue.placeholders));return void Ve(r=>xe(e,t,r,n))}const n=je(),r=n?.selectionStart??e.length,l=n?.selectionEnd??r;Pe(!1),Ae({start:r,end:l,link:A(e,r,l)})},Xe=Boolean(fe&&fe.start!==fe.end),Ze=fe?z(e,fe.start,fe.end,Ye):null,Qe=fe?Oe&&void 0!==Oe.color&&Oe.at===fe.start?Oe.color:U(e,fe.start,fe.end,Ye):null,Je=o(Qe,ae),et=t=>{Ce?t?De.current?.setSource(t.start,t.end,e):De.current?.focus():(pe.current?.focus(),t&&pe.current?.setSelectionRange(t.start,t.end))},tt=()=>{const e=We;Ae(null),et(e?{start:e.start,end:e.end}:fe)},nt=()=>{const e=lt.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Pe(!1),t&&et(fe)},rt=H(nt);rt.current=nt,P(()=>{if(Me)return N(e=>{const t=lt.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(rt.current(),!0)},()=>lt.current?.querySelector(".es-copy-colors"))},[Me]);const lt=H(null),ot=Me||null!==We;P(()=>{const e=lt.current;if(!ot||!e)return;const t=e.ownerDocument,n=()=>{Pe(!1),Ae(null)},r=t=>{e.contains(t.target)||n()};let l;const o=r=>{const o=r.relatedTarget;o?e.contains(o)||n():(clearTimeout(l),l=setTimeout(()=>{const r=t.activeElement;t.hasFocus()&&r&&r!==t.body&&!e.contains(r)&&n()},0))};return t.addEventListener("pointerdown",r,!0),e.addEventListener("focusout",o),()=>{clearTimeout(l),t.removeEventListener("pointerdown",r,!0),e.removeEventListener("focusout",o)}},[ot]);const at=We??(Me?fe??{start:e.length,end:e.length}:null),st=H(()=>{});st.current=()=>{const e=lt.current,t=e?.querySelector(".rosh-tb-wrap > .es-copy-pop");if(!e||!t||!at)return;const n=Ce?null:e.querySelector(".es-gold-layer"),r=Ce?De.current?.rangeOf(at.start,at.end)??null:n?a(n,at.start,at.end):null,l=r?.endContainer,o=l?1===l.nodeType?l:l.parentElement:null,d=r?s(r,o?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!d)return;const p=c({anchor:d,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:u(e),parent:i(t)});t.style.top=`${p.top}px`,t.style.left=`${p.left}px`,t.style.setProperty("--es-pop-point",`${p.point}px`),t.dataset.side=p.above?"above":"below"},M(()=>{const e=lt.current;if(!ot||!e)return;const t=()=>st.current();t();const n=e.ownerDocument.defaultView;n?.addEventListener("resize",t);const r=e.querySelector(".rosh-tb-wrap > .es-copy-pop"),l=n?.ResizeObserver,o=l&&r?new l(t):null;return o&&r&&o.observe(r),()=>{n?.removeEventListener("resize",t),o?.disconnect()}},[ot,Me,We,at?.start,at?.end,Ce]);const ct="always"===re||me||null!==We||Me,it=ae&&ae.length>0?{run:Je,open:Me,onToggle:()=>{Ae(null),Me?nt():Pe(!0)}}:void 0,ut=ct?ie?ie({className:"rosh-tb-btn",disabled:b,selected:Xe,keepCaret:e=>e.preventDefault(),insert:t=>Ve(n=>we(e,t,n))}):"classic"===F?R:void 0:void 0,dt=new Set(Ie),pt=T?{value:T.value,allow:T.allow,onChange:T.onChange,disabled:T.disabled}:void 0,mt={pressed:Ze,onList:t=>{const{start:n,end:r}=qe(),l=z(e,n,r,Ye);Ve(()=>I(e,n,r,l===t?null:t,Ye))}},ht=L({offered:dt,color:it,last:ut,alignment:pt,list:mt,letterCase:ce});/* @__PURE__ */
9
+ return Z("div",{ref:lt,className:"es-copy"+(y?` ${y}`:""),onFocus:()=>he(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||he(!1)},onKeyDown:e=>{const t=e.target===pe.current||Boolean(e.target.closest?.(".es-rich"));if(b||!t)return;if(e.altKey||e.metaKey===e.ctrlKey)return;const n=e.key.toLowerCase(),r="KeyZ"===e.code||"z"===n,l=("KeyY"===e.code||"y"===n)&&!e.shiftKey;if(r||l)return e.preventDefault(),e.stopPropagation(),void ze(l||e.shiftKey?"redo":"undo");const o={b:"bold",i:"italic",u:"underline",k:"link"}[`${e.shiftKey?"shift+":""}${n}`];o&&Ie.includes(o)&&(e.preventDefault(),e.stopPropagation(),_e(o))},onPaste:t=>{const n=pe.current;if(b||!n||t.target!==n)return;t.preventDefault();const r=m({html:t.clipboardData.getData("text/html"),text:t.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:h,rules:Ye});Ve(t=>we(e,r,t))},style:ae&&ae.length>0?Object.fromEntries(ae.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const t=pe.current;t&&t.ownerDocument.activeElement===t&&ge({start:t.selectionStart??e.length,end:t.selectionEnd??e.length})},children:[ct&&(ht.words||ht.paragraph)?
10
+ /* @__PURE__ */Q(D,{className:"es-copy-toolbar","aria-label":ee??ue.formatting,offered:dt,pressed:Ge,onMark:e=>_e(e),color:it,linkOpen:null!==We,last:ut,alignment:pt,list:mt,letterCase:ce,disabled:b,windows:/* @__PURE__ */Z(J,{children:[Me&&ae&&ae.length>0?/* @__PURE__ */Q(d,{colors:ae,current:Qe,words:ue.colors??v.colors,onPick:t=>{const{start:n,end:r}=qe();if(n!==r)Ve(()=>Y(e,n,r,t,Ye));else{if(!Ce)return;Ke({add:Oe?.add??[],drop:Oe?.drop??[],color:t,at:n})}}}):null,We?We&&/* @__PURE__ */Q(O,{className:"es-copy-link es-copy-pop",value:We.link?.href??"",onApply:t=>{const n=We;Ae(null),Ve(()=>Ce?_(e,n.start,n.end,t,Ye):X(e,n.start,n.end,t))},onRemove:We.link?()=>{const t=We.link,n=We;Ae(null),t&&Ve(()=>Ce?G(e,n.start,n.end,Ye):q(e,t))}:void 0,onCancel:tt}):null]})}):null,se&&se.length>0?/* @__PURE__ */Q(Te,{cells:se,words:ue.cells??v.cells,readOnly:b}):null,Ce?/* @__PURE__ */Q(Ne,{value:e,rules:Ye,multiline:h,readOnly:b,placeholder:f,ariaLabel:g,handle:De,pending:Oe??void 0,onEdit:(t,n,r)=>{ye.record({text:e,start:n.start,end:n.end},r,Date.now()),Ke(null),be(t)},onSelect:e=>{ge(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Oe||e.start===Oe.at&&e.end===Oe.at||Ke(null)},onHistory:ze,onFormat:e=>{Ie.includes(e)&&_e(e)},onCommit:n,onCancel:r}):/* @__PURE__ */Q(E,{value:e,onInput:e=>{ye.record(Se(null),"type",Date.now()),be(e)},onCommit:n,onCancel:r,multiline:h,placeholder:f,ariaLabel:g,rules:S,disabled:b,inputRef:pe,className:"es-copy-box"}),te?te({focused:me,insert:t=>Ve(n=>we(e,t,n))}):null,le&&h?
11
+ /* @__PURE__ */Z("div",{className:"es-copy-marks",children:[
12
+ /* @__PURE__ */Q(k,{checked:ke,onChange:()=>{const e=je();Ue.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:fe,Ke(null),Ee(e=>!e)},ariaLabelledBy:Le,disabled:b}),
13
+ /* @__PURE__ */Q("span",{id:Le,className:"es-copy-marks-label",children:ue.showMarks??"Show marks"})]}):null]})}var je=["left","center","right","justify"],Fe=v.align,Be={left:/* @__PURE__ */Q(se,{}),center:/* @__PURE__ */Q(ae,{}),right:/* @__PURE__ */Q(oe,{}),justify:/* @__PURE__ */Q(le,{})},$e={three:{labelsPx:94.5,widestLabelPx:39.94},four:{labelsPx:140,widestLabelPx:44}};function Ve(e,t=Fe){return je.filter(t=>e.includes(t)).map(e=>({id:e,label:t[e],icon:Be[e],title:t[e]}))}var ze=["none","bullet","number"],Ue=e,We={none:/* @__PURE__ */Q(ge,{}),bullet:/* @__PURE__ */Q(fe,{}),number:/* @__PURE__ */Q(he,{})},Ae={none:/* @__PURE__ */Q(Se,{}),upper:/* @__PURE__ */Q(be,{}),capitalize:/* @__PURE__ */Q(ve,{}),lower:/* @__PURE__ */Q(ye,{})};function Ye({label:e,icon:t,answers:n,names:r,glyphs:l,row:o,readOnly:a}){const s=o.value||o.styleValue||"";/* @__PURE__ */
14
+ return Q(x,{label:e,icon:t,children:/* @__PURE__ */Q(w,{ariaLabel:e,value:s,disabled:a,onChange:e=>{a||o.onChange(function(e,t){return t===e.value||""===e.value&&t===e.styleValue?"":t}(o,e))},options:n.map(e=>({id:e,label:l[e],title:r[e]}))})})}function Ie({kept:e,keptHint:t,readOnly:n=!1,style:r,font:l,italic:o,cells:a,align:s,list:c,letterCase:i}){const u=C("copy",v),d={...v.panel,...u.panel},p=u.clearStyle??v.clearStyle,m=r&&!n?[r.onClearChanges&&{label:p,onSelect:r.onClearChanges},r.onEditStyles&&{label:d.editStyles,onSelect:r.onEditStyles},r.onUpdateStyle&&{label:d.updateStyle,onSelect:r.onUpdateStyle}].filter(e=>!!e):[],h=!!o&&(o.value??o.styleValue??!1),f=o?/* @__PURE__ */Q(T,{content:d.italic,children:/* @__PURE__ */Q(R,{size:"sm",variant:"ghost","aria-label":d.italic,"aria-pressed":h,disabled:n,onClick:()=>{if(n)return;const e=!h;o.onChange(e===(o.styleValue??!1)?void 0:e)},children:/* @__PURE__ */Q(me,{})})}):null;/* @__PURE__ */
15
+ return Z("div",{className:"es-tpp",children:[e?/* @__PURE__ */Z("div",{className:"es-tpp-kept",children:[
16
+ /* @__PURE__ */Q(Pe,{...e,readOnly:n||e.readOnly}),t?/* @__PURE__ */Q("p",{className:"es-field-hint",children:t}):null]}):null,r?/* @__PURE__ */Q(x,{label:d.style,icon:/* @__PURE__ */Q(ce,{}),children:/* @__PURE__ */Q(S,{ariaLabel:d.style,value:r.value,options:r.options,onChange:r.onChange,changed:r.changed,footer:m,readOnly:n})}):null,l?/* @__PURE__ */Q(x,{label:d.font,icon:/* @__PURE__ */Q(ie,{}),children:/* @__PURE__ */Z("div",{className:"es-tpp-font",children:[
17
+ /* @__PURE__ */Q("div",{className:"es-tpp-font-select",children:/* @__PURE__ */Q(S,{ariaLabel:d.font,value:l.value||void 0,placeholder:l.styleValue,options:l.options,onChange:l.onChange,searchable:l.searchable,readOnly:n})}),f]})}):f?
18
+ /* @__PURE__ */Q(x,{label:d.italic,icon:/* @__PURE__ */Q(ie,{}),children:/* @__PURE__ */Q("div",{className:"es-tpp-font",children:f})}):null,a?.length?/* @__PURE__ */Q(Te,{cells:a,words:u.cells,readOnly:n}):null,s?/* @__PURE__ */Q(Ye,{label:u.alignment,icon:/* @__PURE__ */Q(ue,{}),answers:je.filter(e=>!s.allow||s.allow.includes(e)),names:u.align,glyphs:Be,row:s,readOnly:n}):null,c?/* @__PURE__ */Q(Ye,{label:d.list,icon:/* @__PURE__ */Q(de,{}),answers:ze,names:d.lists,glyphs:We,row:c,readOnly:n}):null,i?/* @__PURE__ */Q(Ye,{label:d.capitalization,icon:/* @__PURE__ */Q(pe,{}),answers:Ue,names:d.cases,glyphs:Ae,row:i,readOnly:n}):null]})}export{je as COPY_ALIGNS,$e as COPY_ALIGN_FIT,Be as COPY_ALIGN_GLYPHS,Fe as COPY_ALIGN_LABELS,Le as COPY_CELLS,Pe as CopyBox,Te as CopyCells,Me as MarkBar,Ne as RichBox,Ie as TextPartPanel,Ke as ariaShortcut,Ve as copyAlignOptions,we as insertSelection,xe as markSelection,Re as useCaretEdit};
@@ -63,7 +63,7 @@
63
63
  opacity: 0;
64
64
  }
65
65
  .es-canvas-grip {
66
- font-size: 10px;
66
+ font-size: var(--text-2xs, 11px);
67
67
  letter-spacing: -2px;
68
68
  opacity: 0.8;
69
69
  }
@@ -221,7 +221,7 @@
221
221
  border-radius: var(--radius-lg);
222
222
  background: var(--es-accent-tint);
223
223
  color: var(--es-accent-text);
224
- font-size: 12.5px;
224
+ font-size: var(--text-xs, 12px);
225
225
  font-weight: 600;
226
226
  }
227
227
  .es-add-at-clear {
@@ -242,7 +242,7 @@
242
242
  }
243
243
  .es-add-hint {
244
244
  margin: 0 0 12px;
245
- font-size: 12.5px;
245
+ font-size: var(--text-xs, 12px);
246
246
  color: var(--es-muted);
247
247
  }
248
248
  /* The search is the shell's `Input` (leftIcon, rightAdornment): one field.
@@ -261,7 +261,7 @@
261
261
  margin-bottom: 12px;
262
262
  }
263
263
  .es-add-group-title {
264
- font-size: 11px;
264
+ font-size: var(--text-2xs, 11px);
265
265
  font-weight: 700;
266
266
  letter-spacing: 0.07em;
267
267
  text-transform: uppercase;
@@ -272,7 +272,7 @@
272
272
  this size (second host, axe-core, 2026-10-07). A count is read, so it is not
273
273
  a placeholder. Held by ratio in tests/contrast-small-text.test.ts. */
274
274
  .es-add-group-count {
275
- font-size: 11px;
275
+ font-size: var(--text-2xs, 11px);
276
276
  color: var(--es-muted);
277
277
  }
278
278
  .es-add-grid {
@@ -297,7 +297,7 @@
297
297
  background: var(--es-panel);
298
298
  color: var(--es-text);
299
299
  font: inherit;
300
- font-size: 12px;
300
+ font-size: var(--text-xs, 12px);
301
301
  line-height: 1.2;
302
302
  text-align: center;
303
303
  cursor: grab;
@@ -389,10 +389,10 @@
389
389
  color: var(--es-muted);
390
390
  }
391
391
  .es-add-empty-title {
392
- font-size: 14px;
392
+ font-size: var(--text-sm, 14px);
393
393
  font-weight: 600;
394
394
  color: var(--es-text);
395
395
  }
396
396
  .es-add-empty-sub {
397
- font-size: 12.5px;
397
+ font-size: var(--text-xs, 12px);
398
398
  }
@@ -1 +1 @@
1
- export{AddPanel,CanvasDragLayer,CanvasInsert,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,insertSeams,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-47RGVCPH.js";import"../chunk-GG4FGBFR.js";export{AUTO_SCROLL_EDGE,AUTO_SCROLL_MAX_SPEED,autoScrollDelta,autoScrollSpeed,createDragSession,dropEffectFor,dropOnRow,frameScrollBox,gapToMoveIndex,isNoOpDrop,scrollBoxOf,scrollParent,startAutoScroll,stepGap,useTreeDrag}from"../chunk-67GNT6PF.js";import"../chunk-ILXP5VX5.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ export{AddPanel,CanvasDragLayer,CanvasInsert,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,insertSeams,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-QFVRMARS.js";import"../chunk-AYWN5NRH.js";export{AUTO_SCROLL_EDGE,AUTO_SCROLL_MAX_SPEED,autoScrollDelta,autoScrollSpeed,createDragSession,dropEffectFor,dropOnRow,frameScrollBox,gapToMoveIndex,isNoOpDrop,scrollBoxOf,scrollParent,startAutoScroll,stepGap,useTreeDrag}from"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-ILXP5VX5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -8,11 +8,11 @@ import { c as ResolveTrigger, a as ResolveCache, R as ResolvableItem } from '../
8
8
  import * as react from 'react';
9
9
  import { ReactNode, CSSProperties, ComponentType, ReactElement } from 'react';
10
10
  import { TextToolbarProps } from 'efficient-shell/ui';
11
- import { C as CopyBoxLastTool, a as CopyThemeColor, b as CanvasTypingEnd } from '../canvas-typing-DvoqQINU.js';
12
- import { InlineRule } from '../markup/index.js';
11
+ import { C as CopyBoxLastTool, a as CopyThemeColor, b as CanvasTypingEnd } from '../canvas-typing-CC0wA-ys.js';
12
+ import { InlineRule } from 'efficient-shell/markup';
13
13
  import { b as NodeOpsHost, C as ClipboardEntry } from '../useNodeOps-BHRkUFfG.js';
14
14
  import { I as InspectorFields } from '../types-Dkx1VAIQ.js';
15
- import '../words-dsex49Jh.js';
15
+ import '../words-CiuKuiy0.js';
16
16
  import '../buckets-Tj-nkBpg.js';
17
17
 
18
18
  interface EaselOptions<C extends EaselConfig = EaselConfig> {
@@ -1 +1 @@
1
- export{CanvasFrame,CanvasPassThroughContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-SJPKSE5G.js";import"../chunk-TBY3DFKS.js";import"../chunk-YRLPFZW3.js";import"../chunk-ECM5F6JJ.js";import"../chunk-FGJSCWUN.js";import"../chunk-Q6AM43CA.js";import"../chunk-546BBOPE.js";import"../chunk-MFIRYGHW.js";import"../chunk-ILXP5VX5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ export{CanvasFrame,CanvasPassThroughContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,bindUndoKeys,createEasel,createUseEasel,recordsByDefault,reduce,uiView,useEasel,useEaselApi,useEaselNodeOps,useSelectedFields,validSelection}from"../chunk-5IUS6PM6.js";import"../chunk-TBY3DFKS.js";import"../chunk-YRLPFZW3.js";import"../chunk-ECM5F6JJ.js";import"../chunk-NY7HHUGB.js";import"../chunk-33C6ALT5.js";import"../chunk-MFIRYGHW.js";import"../chunk-ILXP5VX5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -34,7 +34,7 @@ span:has(> .es-fnum) { display: flex; min-width: 0; }
34
34
  overflow: hidden;
35
35
  text-overflow: ellipsis;
36
36
  white-space: nowrap;
37
- font-size: 12px;
37
+ font-size: var(--text-xs, 12px);
38
38
  font-weight: 500;
39
39
  color: var(--es-text-secondary);
40
40
  }
@@ -49,7 +49,7 @@ span:has(> .es-fnum) { display: flex; min-width: 0; }
49
49
  .es-fsel { position: relative; width: 100%; min-width: 0; }
50
50
  .es-fsel-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
51
51
  .es-fsel-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
52
- .es-fsel-meta { flex: none; font-size: 11px; font-weight: 400; color: var(--es-muted); }
52
+ .es-fsel-meta { flex: none; font-size: var(--text-2xs, 11px); font-weight: 400; color: var(--es-muted); }
53
53
  .es-fsel-thumb {
54
54
  flex: none;
55
55
  width: 26px;
@@ -106,8 +106,8 @@ span:has(> .es-fnum) { display: flex; min-width: 0; }
106
106
  justify-content: space-between;
107
107
  gap: 8px;
108
108
  }
109
- .es-list-label { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--es-text); }
110
- .es-list-count { font-size: 11px; color: var(--es-muted); font-variant-numeric: tabular-nums; }
109
+ .es-list-label { display: inline-flex; align-items: center; gap: 8px; font-size: var(--text-xs, 12px); font-weight: 600; color: var(--es-text); }
110
+ .es-list-count { font-size: var(--text-2xs, 11px); color: var(--es-muted); font-variant-numeric: tabular-nums; }
111
111
 
112
112
  /* A host's bar for the row in use, between the name and the rows. */
113
113
  .es-list-above { min-width: 0; }
@@ -126,7 +126,7 @@ span:has(> .es-fnum) { display: flex; min-width: 0; }
126
126
  .es-list-row.is-lifting { background: var(--es-raised); box-shadow: var(--rosh-glass-solid-shadow); }
127
127
 
128
128
  /* The row's own control (renderRow): it fills the row up to the ×. */
129
- .es-list-row-main { flex: 1 1 auto; min-width: 0; min-height: 32px; display: flex; align-items: center; font-size: 12px; color: var(--es-text); }
129
+ .es-list-row-main { flex: 1 1 auto; min-width: 0; min-height: 32px; display: flex; align-items: center; font-size: var(--text-xs, 12px); color: var(--es-text); }
130
130
  .es-list-row-main > * { flex: 1 1 auto; min-width: 0; }
131
131
 
132
132
  /* A many-field item: its name, its summary, a chevron that turns when open. */
@@ -142,7 +142,7 @@ span:has(> .es-fnum) { display: flex; min-width: 0; }
142
142
  background: none;
143
143
  color: var(--es-text);
144
144
  font: inherit;
145
- font-size: 12px;
145
+ font-size: var(--text-xs, 12px);
146
146
  text-align: left;
147
147
  cursor: inherit;
148
148
  }
@@ -162,7 +162,7 @@ span:has(> .es-fnum) { display: flex; min-width: 0; }
162
162
  background: transparent;
163
163
  color: var(--es-muted);
164
164
  font: inherit;
165
- font-size: 16px;
165
+ font-size: var(--text-base, 16px);
166
166
  line-height: 1;
167
167
  cursor: pointer;
168
168
  }
@@ -197,7 +197,7 @@ span:has(> .es-fnum) { display: flex; min-width: 0; }
197
197
  background: none;
198
198
  color: var(--es-accent);
199
199
  font: inherit;
200
- font-size: 12px;
200
+ font-size: var(--text-xs, 12px);
201
201
  font-weight: 500;
202
202
  cursor: pointer;
203
203
  }
@@ -1 +1 @@
1
- export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-26GHWMNN.js";export{FieldSlider}from"../chunk-XWFH2NHZ.js";import"../chunk-4JSBIW5H.js";import"../chunk-RC25EGHD.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";import"../chunk-EA2HTX37.js";export{FieldNumber}from"../chunk-66LWADFP.js";export{FieldSelect,optionFor}from"../chunk-65Z5FSAW.js";import"../chunk-XJCMEEBH.js";import"../chunk-FFYXVAAL.js";import"../chunk-MFIRYGHW.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-UBAYMWCX.js";export{FieldSlider}from"../chunk-XWFH2NHZ.js";import"../chunk-4JSBIW5H.js";import"../chunk-RC25EGHD.js";import"../chunk-K56YDHYQ.js";import"../chunk-KFV7N2DJ.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";import"../chunk-EA2HTX37.js";export{FieldNumber}from"../chunk-2XMHLXMA.js";export{FieldSelect,optionFor}from"../chunk-G3GWAP5R.js";import"../chunk-36LVP5WD.js";import"../chunk-WRFD4EXD.js";import"../chunk-MFIRYGHW.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { Ref } from 'react';
3
- import { InlineRule, InlineKind } from '../markup/index.js';
3
+ import { InlineRule, InlineKind } from 'efficient-shell/markup';
4
4
 
5
5
  /**
6
6
  * The type-in-place box: a controlled leaf, and NOTHING else.
@@ -49,7 +49,7 @@ interface GoldTextInputProps {
49
49
  /**
50
50
  * The grammar's rule set — `STOREFRONT_MARKUP` in the shop,
51
51
  * `CAMPAIGN_MARKUP` in the campaign designer, both from
52
- * `efficient-easel/markup`. Defaults to `STANDARD_MARKUP`, which is the subset
52
+ * `efficient-shell/markup`. Defaults to `STANDARD_MARKUP`, which is the subset
53
53
  * every product shares; a product with legacy runs (the storefront's
54
54
  * `*phrase*` accent) MUST pass its own set or those runs draw as plain text
55
55
  * here while the page paints them gold.
@@ -152,7 +152,7 @@ declare function GoldLayer({ value, rules, className, layerRef }: GoldLayerProps
152
152
  * character.
153
153
  *
154
154
  * The grammar is not re-implemented here and never will be (constitution E8):
155
- * {@link tokenizeInline} from `efficient-easel/markup` (../markup) decides what is a run and
155
+ * {@link tokenizeInline} from `efficient-shell/markup` decides what is a run and
156
156
  * what is not, exactly as it does for the published page. What it does not
157
157
  * return is the delimiters — it hands back a run's INNER text, because every
158
158
  * other consumer wants the words without the asterisks.
@@ -1 +1 @@
1
- export{GoldLayer,GoldTextInput,goldSegments}from"../chunk-2FZJWH24.js";import"../chunk-546BBOPE.js";var e={accent:"var(--gold, #c9a461)",quiet:"var(--es-muted, var(--ink-faint))",caret:"var(--es-text, var(--ink-strongest))",placeholder:"var(--es-field-placeholder, var(--ink-faintest))",delimiterOpacity:"0.35",delimiterRestingOpacity:"0.25",boldShadow:"0 0 0.4px currentColor",italicDecoration:"underline dotted",strikeDecoration:"line-through",pad:"0"},t={accent:"--es-gold-accent",quiet:"--es-gold-quiet",caret:"--es-gold-caret",placeholder:"--es-gold-placeholder",delimiterOpacity:"--es-gold-delim-opacity",delimiterRestingOpacity:"--es-gold-delim-resting-opacity",boldShadow:"--es-gold-bold-shadow",italicDecoration:"--es-gold-italic-decoration",strikeDecoration:"--es-gold-strike-decoration",pad:"--es-gold-pad"};export{t as goldCssVars,e as goldTokens};
1
+ export{GoldLayer,GoldTextInput,goldSegments}from"../chunk-H4UMY7QF.js";var e={accent:"var(--gold, #c9a461)",quiet:"var(--es-muted, var(--ink-faint))",caret:"var(--es-text, var(--ink-strongest))",placeholder:"var(--es-field-placeholder, var(--ink-faintest))",delimiterOpacity:"0.35",delimiterRestingOpacity:"0.25",boldShadow:"0 0 0.4px currentColor",italicDecoration:"underline dotted",strikeDecoration:"line-through",pad:"0"},t={accent:"--es-gold-accent",quiet:"--es-gold-quiet",caret:"--es-gold-caret",placeholder:"--es-gold-placeholder",delimiterOpacity:"--es-gold-delim-opacity",delimiterRestingOpacity:"--es-gold-delim-resting-opacity",boldShadow:"--es-gold-bold-shadow",italicDecoration:"--es-gold-italic-decoration",strikeDecoration:"--es-gold-strike-decoration",pad:"--es-gold-pad"};export{t as goldCssVars,e as goldTokens};
@@ -445,6 +445,15 @@ type EaselToHostMessage =
445
445
  } | {
446
446
  type: "storefront-editor:open-page";
447
447
  slug: string;
448
+ }
449
+ /** Open one section of the website's own pages in the host — its Settings
450
+ * (`section: "settings"`, e.g. Selling, where the stock rules live) or its
451
+ * Shipping (`"shipping"`, the pickup places). For a panel row that reads a
452
+ * website rule it does not own and offers to open where it is set. Nothing
453
+ * answers it. */
454
+ | {
455
+ type: "storefront-editor:open-site-section";
456
+ section: "settings" | "shipping";
448
457
  } | {
449
458
  type: "storefront-editor:new-page";
450
459
  }
@@ -1,2 +1,3 @@
1
1
  export * from 'efficient-shell/icons/efficient';
2
2
  export { EfficientIconName as IconName, EfficientIconProps as IconProps, efficientIconMeanings as iconMeanings } from 'efficient-shell/icons/efficient';
3
+ import 'efficient-shell/markup';