efficient-easel 27.0.0 → 27.2.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 (143) hide show
  1. package/dist/AddSidePanel-DoCx-ZrM.d.ts +1994 -0
  2. package/dist/{ScreenDocumentContext-DPW_6gOC.d.ts → ScreenDocumentContext-JQr4hTeP.d.ts} +7 -5
  3. package/dist/blocks/index.d.ts +1 -1
  4. package/dist/canvas/index.d.ts +2 -1
  5. package/dist/canvas/index.js +1 -1
  6. package/dist/chrome/index.js +1 -1
  7. package/dist/{chunk-PVBDKBJB.js → chunk-2EEYFRQM.js} +1 -1
  8. package/dist/{chunk-W3UZNKGS.js → chunk-2Y4CAWZQ.js} +4 -4
  9. package/dist/{chunk-CWELHADJ.js → chunk-3OOYGEJY.js} +1 -1
  10. package/dist/{chunk-BFJAEQZ6.js → chunk-3RGHXL5V.js} +1 -1
  11. package/dist/{chunk-JIP5JNRB.js → chunk-5HYVOOH3.js} +1 -1
  12. package/dist/chunk-64NREOML.js +1 -0
  13. package/dist/chunk-6GJEOER4.js +1 -0
  14. package/dist/{chunk-6ATIYLUL.js → chunk-6V6LC7QV.js} +1 -1
  15. package/dist/{chunk-KO47WAWR.js → chunk-7YXWWMBM.js} +1 -1
  16. package/dist/{chunk-GR3XRILS.js → chunk-A5USZ6Z6.js} +1 -1
  17. package/dist/{chunk-Y2T3JX7K.js → chunk-ANBPE45L.js} +1 -1
  18. package/dist/{chunk-KFWNGPW3.js → chunk-C63IB4VW.js} +5 -5
  19. package/dist/chunk-DCBUJ36Q.js +5 -0
  20. package/dist/{chunk-SQTVXE5D.js → chunk-DQSRGKSM.js} +18 -18
  21. package/dist/{chunk-YYD257TD.js → chunk-G7J6SGMF.js} +1 -1
  22. package/dist/chunk-HGTDDSFJ.js +19 -0
  23. package/dist/chunk-I4Z75MCX.js +1 -0
  24. package/dist/{chunk-AAZIMKLQ.js → chunk-JI7GUM3C.js} +1 -1
  25. package/dist/{chunk-QZJKWKGH.js → chunk-JUJEVGLY.js} +1 -1
  26. package/dist/{chunk-K53PQAMP.js → chunk-LDHUPZBK.js} +1 -1
  27. package/dist/{chunk-JQQFB7EZ.js → chunk-LK56FUFT.js} +1 -1
  28. package/dist/chunk-M5UCPD66.js +1 -0
  29. package/dist/{chunk-ZFEAWEFS.js → chunk-MMHYTIUY.js} +3 -3
  30. package/dist/{chunk-SBVIW3KJ.js → chunk-MTWQYLJE.js} +1 -1
  31. package/dist/chunk-OB4KI2AN.js +2 -0
  32. package/dist/{chunk-5OWAV3MH.js → chunk-OSF2H3LO.js} +1 -1
  33. package/dist/{chunk-TYTMUHUK.js → chunk-PTTQWCD7.js} +1 -1
  34. package/dist/{chunk-3XECMGXX.js → chunk-QEEW4X64.js} +1 -1
  35. package/dist/chunk-SDSBXW3V.js +26 -0
  36. package/dist/{chunk-76MUJIZE.js → chunk-SR2535CN.js} +17 -17
  37. package/dist/{chunk-QTHQPJWA.js → chunk-TF6NAIV7.js} +1 -1
  38. package/dist/{chunk-6EDVZBUO.js → chunk-TQUEVJOO.js} +1 -1
  39. package/dist/chunk-UMTUKSE6.js +1 -0
  40. package/dist/chunk-VNUXFD4X.js +1 -0
  41. package/dist/{chunk-VBEVZZTV.js → chunk-VTY7OQB5.js} +11 -11
  42. package/dist/{chunk-5JNVMCCB.js → chunk-XGTO4LHI.js} +1 -1
  43. package/dist/{chunk-YES5F7OS.js → chunk-XV5D4V2T.js} +1 -1
  44. package/dist/chunk-YCYGY54I.js +8 -0
  45. package/dist/chunk-YDTEYXQW.js +1 -0
  46. package/dist/chunk-ZSP4ZAQ2.js +64 -0
  47. package/dist/copy/index.js +11 -11
  48. package/dist/data/index.d.ts +2 -1
  49. package/dist/data/index.js +1 -1
  50. package/dist/drag/index.js +1 -1
  51. package/dist/easel/index.d.ts +1 -1
  52. package/dist/easel/index.js +1 -1
  53. package/dist/edit-lock/index.js +1 -1
  54. package/dist/fields/fields.css +8 -0
  55. package/dist/fields/index.d.ts +47 -3
  56. package/dist/fields/index.js +1 -1
  57. package/dist/node-ops/index.js +1 -1
  58. package/dist/phone-order-CRKvsTsz.d.ts +141 -0
  59. package/dist/screen/components/AddBlockRow.js +1 -1
  60. package/dist/screen/components/AddSidePanel.d.ts +3 -5
  61. package/dist/screen/components/AddSidePanel.js +1 -1
  62. package/dist/screen/components/NodeContextMenu.d.ts +3 -5
  63. package/dist/screen/components/NodeContextMenu.js +1 -1
  64. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  65. package/dist/screen/components/SaveControls.d.ts +3 -5
  66. package/dist/screen/components/SaveControls.js +1 -1
  67. package/dist/screen/components/ScreenChrome.js +1 -1
  68. package/dist/screen/components/ScreenDocumentContext.d.ts +2 -2
  69. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  70. package/dist/screen/components/ScreenMount.d.ts +3 -5
  71. package/dist/screen/components/ScreenMount.js +1 -1
  72. package/dist/screen/components/ScreenStoreProvider.d.ts +3 -5
  73. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  74. package/dist/screen/components/SectionScreenShell.js +17 -17
  75. package/dist/screen/components/SidePanelHead.js +1 -1
  76. package/dist/screen/components/panel-widths.js +1 -1
  77. package/dist/screen/components/usePartBridge.d.ts +3 -5
  78. package/dist/screen/components/usePartBridge.js +1 -1
  79. package/dist/screen/index.d.ts +3 -5
  80. package/dist/screen/index.js +1 -1
  81. package/dist/screen/lib/admin-bridge.d.ts +1 -1
  82. package/dist/screen/lib/document/add-target-types.d.ts +37 -55
  83. package/dist/screen/lib/document/block-set-host.js +1 -1
  84. package/dist/screen/lib/document/block-size-fields.d.ts +2 -2
  85. package/dist/screen/lib/document/block-size-fields.js +1 -1
  86. package/dist/screen/lib/document/block-types-in.js +1 -1
  87. package/dist/screen/lib/document/box-fields.d.ts +2 -2
  88. package/dist/screen/lib/document/box-fields.js +1 -1
  89. package/dist/screen/lib/document/button-fields.d.ts +2 -2
  90. package/dist/screen/lib/document/button-fields.js +1 -1
  91. package/dist/screen/lib/document/image-fields.d.ts +2 -2
  92. package/dist/screen/lib/document/image-fields.js +5 -5
  93. package/dist/screen/lib/document/new-child.d.ts +58 -0
  94. package/dist/screen/lib/document/new-child.js +1 -0
  95. package/dist/screen/lib/document/palette-sections.d.ts +3 -5
  96. package/dist/screen/lib/document/section-doc.d.ts +1 -1
  97. package/dist/screen/lib/document/section-doc.js +1 -1
  98. package/dist/screen/lib/document/shadow-fields.d.ts +2 -2
  99. package/dist/screen/lib/document/shadow-fields.js +2 -2
  100. package/dist/screen/lib/document/slot-section-spec.d.ts +37 -96
  101. package/dist/screen/lib/document/style-clipboard.d.ts +3 -5
  102. package/dist/screen/lib/document/style-clipboard.js +1 -1
  103. package/dist/screen/lib/document/style-fields.d.ts +2 -2
  104. package/dist/screen/lib/document/style-fields.js +1 -1
  105. package/dist/screen/lib/document/use-section-ops.d.ts +1 -1
  106. package/dist/screen/lib/document/use-section-ops.js +1 -1
  107. package/dist/screen/lib/document-addressing.d.ts +2 -2
  108. package/dist/screen/lib/document-hooks.d.ts +1 -1
  109. package/dist/screen/lib/document-switch.js +1 -1
  110. package/dist/screen/lib/failure.js +1 -1
  111. package/dist/screen/lib/host-inbound.js +1 -1
  112. package/dist/screen/lib/host.d.ts +2 -2
  113. package/dist/screen/lib/key-scope.js +1 -1
  114. package/dist/screen/lib/media-panel.d.ts +2 -2
  115. package/dist/screen/lib/media-picker.d.ts +2 -2
  116. package/dist/screen/lib/media-picker.js +1 -1
  117. package/dist/screen/lib/page-lock.d.ts +1 -1
  118. package/dist/screen/lib/page-lock.js +1 -1
  119. package/dist/screen/lib/screen-parts.d.ts +21 -1828
  120. package/dist/screen/lib/screen-parts.js +1 -1
  121. package/dist/screen/lib/section-templates.d.ts +1 -1
  122. package/dist/screen/lib/session-context.d.ts +1 -1
  123. package/dist/screen/lib/session.d.ts +1 -1
  124. package/dist/screen/lib/shared-sections.d.ts +1 -1
  125. package/dist/strings/index.d.ts +1 -1
  126. package/dist/strings/index.js +2 -2
  127. package/dist/style-clipboard/index.js +1 -1
  128. package/dist/text-styles/index.js +27 -27
  129. package/dist/{words-CFkb8XtN.d.ts → words-dNm6REMa.d.ts} +21 -0
  130. package/package.json +7 -1
  131. package/dist/chunk-2262JGFV.js +0 -5
  132. package/dist/chunk-3W2O22DZ.js +0 -19
  133. package/dist/chunk-DAKKPW2Z.js +0 -1
  134. package/dist/chunk-EUFDQ4KL.js +0 -1
  135. package/dist/chunk-FW35PCK7.js +0 -1
  136. package/dist/chunk-HG65R6IN.js +0 -20
  137. package/dist/chunk-JACEEVVF.js +0 -1
  138. package/dist/chunk-L2WK5JYB.js +0 -2
  139. package/dist/chunk-L7PSERQH.js +0 -8
  140. package/dist/chunk-NTG5ODKZ.js +0 -1
  141. package/dist/chunk-O4OWODU2.js +0 -64
  142. package/dist/chunk-TOKMFZPB.js +0 -1
  143. package/dist/resolve-Bz4mszpL.d.ts +0 -57
@@ -0,0 +1,64 @@
1
+ import{markedTreeNodeId as e,revealSelectedTreeRow as n,sameSelector as t}from"./chunk-UMBNBCL4.js";import{cloneNodeWithFreshIds as o}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as r}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as i}from"./chunk-VNUXFD4X.js";import{configNodeDefaults as l,newChildOf as s,newChildName as d}from"./chunk-64NREOML.js";import{scrollPreviewToSection as a,gotoPreviewSlide as c}from"./chunk-LUOY3A3Q.js";import{useEaselKeyTarget as p,useEaselUndoKeys as u,useEaselSaveKey as h,editorRootFocus as f}from"./chunk-3RGHXL5V.js";import{SlotChildActionsProvider as m}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as g,DEFAULT_PANEL_W as y,clampPanelWidth as v}from"./chunk-TQUEVJOO.js";import{usePartBridge as b}from"./chunk-OSF2H3LO.js";import{useSectionOps as k}from"./chunk-PTTQWCD7.js";import{PageEditGuardNotices as S}from"./chunk-XV5D4V2T.js";import{ScreenSaveIcon as w,ScreenMainButton as x}from"./chunk-2EEYFRQM.js";import{useBrowserOffline as z}from"./chunk-RKTF5XLP.js";import{useScreenDocument as C}from"./chunk-OB4KI2AN.js";import{requestMediaPick as O}from"./chunk-5HYVOOH3.js";import{AddChildRow as N}from"./chunk-5545A3PC.js";import{AddSidePanel as B}from"./chunk-YCYGY54I.js";import{keepsSharedSections as I,sharedSectionsOf as P}from"./chunk-N3MJOHAG.js";import{PanelHideButton as M,SidePanelHead as $,PanelShowStrip as T}from"./chunk-MTWQYLJE.js";import{offeredChoices as j}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as E,useScreenNodeKeys as L,useScreenPinned as A,useScreenDocumentLabel as R,useScreenCanvasFrame as F,useScreenInspectorPanel as D,useScreenDevices as V,useScreenPickFollowsSelection as H,useScreenLeftView as W,SELECTION_MODE as Y,isSelectionMode as U,sameInspectorMode as G,useScreenBridges as J,useScreenBlockRules as X,useScreenBlockLook as Q,useScreenStorageNamespace as K,useScreenNotify as _,useScreenCanvasHead as q,isSlotMode as Z,useScreenStyleClipboard as ee,useScreenDocumentPass as ne,useScreenCanvasDrag as te,ScreenCanvasTargetProvider as oe,isPinnedFirst as re,isPinnedLast as ie,screenSlotsOf as le,shownChildSlotsOf as se}from"./chunk-DCBUJ36Q.js";import{MediaPopup as de}from"./chunk-T2RINM7R.js";import{useMediaPanel as ae,usePanelPick as ce,useMediaBrowsing as pe,useOpenMediaBrowse as ue,useMediaPlace as he}from"./chunk-NCXYC7WI.js";import{useNodeClipboard as fe,useNodeContextMenu as me}from"./chunk-M5UCPD66.js";import{useEaselSession as ge}from"./chunk-YM4UEGBV.js";import{useEaselHost as ye,useHostEscape as ve}from"./chunk-LX23TCTP.js";import{LayersIcon as be,MediaIcon as ke}from"./chunk-XFYFKITX.js";import{heldStyle as Se,styleShortcut as we}from"./chunk-3OOYGEJY.js";import{DEFAULT_SCREEN_WORDS as xe}from"./chunk-G2VZ4DET.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ze}from"./chunk-6WY6ZXJG.js";import{rootRowName as Ce,slotChildRowName as Oe,slotChildRenameProp as Ne,sectionRenameProp as Be}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Ie,blockNodeActions as Pe,TREE_MAX_DEPTH as Me,childSlotsOf as $e,slotFieldsOf as Te,newNodeId as je,slotChildrenIn as Ee,nestsInTree as Le}from"./chunk-TCAAOYQY.js";import{useEasel as Ae,useEaselApi as Re,useSettledAction as Fe,subscribeLateWrites as De,CanvasPartsContext as Ve,partHasOwnBox as He,CanvasPassThroughContext as We,CanvasSharedContext as Ye}from"./chunk-HGTDDSFJ.js";import{TreeRow as Ue,Subtree as Ge,LayersTree as Je,TreeGroupLabel as Xe,TreeRowAction as Qe,TreeSeam as Ke}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as _e}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as qe}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ze,useNodeOps as en,clickPick as nn}from"./chunk-TF6NAIV7.js";import{EaselTopBar as tn,EaselIconButton as on,TopBarCluster as rn,DeviceSwitch as ln,InspectorIconButton as sn,PanelResizeHandle as dn,MAX_PANEL_W as an,MIN_PANEL_W_BY_SIDE as cn,panelWidthVars as pn}from"./chunk-VTY7OQB5.js";import{DEFAULT_NOTICE_WORDS as un,DEFAULT_CHROME_WORDS as hn}from"./chunk-AJSDWWJW.js";import{holderOf as fn,nameOrSomeone as mn}from"./chunk-G7J6SGMF.js";import{DEFAULT_LOCK_WORDS as gn}from"./chunk-RE4LP46F.js";import{useWords as yn}from"./chunk-MFIRYGHW.js";import{insertSeams as vn,CanvasDragLayer as bn,CanvasInsert as kn}from"./chunk-DQSRGKSM.js";import{DEFAULT_DRAG_WORDS as Sn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as wn,useTreeDrag as xn,gapToMoveIndex as zn}from"./chunk-QEEW4X64.js";import{useCanvasFrame as Cn,LIST_SELECTOR as On,BLOCK_SELECTOR as Nn,useCanvasTyping as Bn,useCanvasEvent as In,onMotionEnd as Pn}from"./chunk-6GJEOER4.js";import{nodeIdAt as Mn,frameRectToHost as $n,BLOCK_ATTRIBUTE as Tn,drawnBox as jn}from"./chunk-FR7EEKFF.js";import{queryMainCopy as En}from"./chunk-7UFKEX72.js";import{ROOT_ID as Ln,ROOT_SLOT as An,zoneKey as Rn,parseZoneKey as Fn,find as Dn,DataError as Vn}from"./chunk-YDTEYXQW.js";import{useRef as Hn,useMemo as Wn,useState as Yn,useEffect as Un,useCallback as Gn,useLayoutEffect as Jn,useContext as Xn,Fragment as Qn,useId as Kn}from"react";import{ColoredBadge as _n,Button as qn,Tabs as Zn,toast as et,readMediaFileDrag as nt,Tooltip as tt,groupColors as ot,Dialog as rt,FormField as it,Input as lt,MEDIA_FILE_DRAG_TYPE as st}from"efficient-shell/ui";import{UndoIcon as dt,RedoIcon as at,RefreshIcon as ct,AddIcon as pt,TrashIcon as ut,EyeOffIcon as ht,EyeIcon as ft,SharedIcon as mt,DuplicateIcon as gt}from"efficient-shell/icons/efficient";import{jsx as yt,jsxs as vt,Fragment as bt}from"react/jsx-runtime";var kt="media-file";function St({name:e,onMake:n,onCancel:t}){const o=yn("screen",xe).shared,[r,i]=Yn(e),[l,s]=Yn(!1),d=Kn(),a=Hn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
2
+ return yt(rt,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */vt(bt,{children:[
3
+ /* @__PURE__ */yt(qn,{variant:"secondary",onClick:t,children:o.cancel}),
4
+ /* @__PURE__ */yt(qn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */yt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */yt(it,{label:o.name,htmlFor:d,children:/* @__PURE__ */yt(lt,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var wt=/* @__PURE__ */new WeakSet;function xt(e,n,t){const o=Dn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function zt(e,n,t){const o=o=>o>=t.left&&o+e.width<=t.left+t.width&&n.every(n=>n.right<=o||n.left>=o+e.width||n.bottom<=e.top||n.top>=e.top+e.height);if(n.every(n=>n.right<=e.left||n.left>=e.left+e.width||n.bottom<=e.top||n.top>=e.top+e.height))return e.left;const r=n.map(e=>e.right+4).filter(n=>n>e.left&&o(n));if(r.length)return Math.min(...r);const i=n.map(n=>n.left-4-e.width).filter(n=>n<e.left&&o(n));return i.length?Math.max(...i):e.left}function Ct({canvas:e,tabs:n,onSelect:t,onPointer:o}){const r=Hn(null),[i,l]=Yn({}),s=Hn({id:null,places:{},measure:null});s.current.places=i;const d=!(null===s.current.id||n.some(e=>e.id===s.current.id)&&i[s.current.id]);Un(()=>{d&&(s.current.id=null,o(null))},[d,o]),Un(()=>()=>{null!==s.current.id&&o(null)},[o]);const a=n.map(e=>`${e.id}:${e.below?1:0}:${e.label}:${e.reach??""}`).join("|");return Jn(()=>{const t=e?.document,o=e?.window,i=e?.frame;if(!t||!o||!i||0===n.length)return void l(e=>0===Object.keys(e).length?e:{});let d=0;const a=()=>{d=0;const e=r.current;if(!e)return;const a=$n(i,{left:0,top:0,width:o.innerWidth,height:o.innerHeight},e),p={};let u=!1;const h=e.getBoundingClientRect(),f=[...e.parentElement?.querySelectorAll(".es-canvas-handle.is-shown:not(.is-dragging), .es-canvas-tag, .es-canvas-hint")??[]].map(e=>{const n=e.getBoundingClientRect();return{left:n.left-h.left,top:n.top-h.top,right:n.right-h.left,bottom:n.bottom-h.top}});for(const r of n){const n=o.CSS?.escape?o.CSS.escape(r.id):JSON.stringify(r.id).slice(1,-1),l=En(t,`[${Tn}="${n}"]`),d=l?jn(l):null;if(!d||0===d.height){p[r.id]=null;continue}const c=$n(i,{left:d.left,top:d.top,width:d.width,height:d.height},e),h=c.top+c.height;if(h<a.top||c.top>a.top+a.height){p[r.id]=null;continue}const m=r.below?h+4:Math.max(c.top,a.top)+6,g=e.querySelector(`[data-band-tab="${n}"]`);g||(u=!0);const y=Math.max(c.left,a.left)+6,v=g?.offsetHeight??0,b=g?.offsetWidth??0,k=s.current.id===r.id?s.current.places[r.id]:null,S=k?k.left:zt({left:y,top:m,width:b,height:v},f,a);b>0&&v>0&&f.push({left:S,top:m,right:S+b,bottom:m+v}),p[r.id]={left:S,top:m}}l(e=>function(e,n){const t=Object.keys(e);return t.length===Object.keys(n).length&&t.every(t=>{const o=e[t],r=n[t];return o===r||!!o&&!!r&&o.left===r.left&&o.top===r.top})}(e,p)?e:p),u&&c()},c=()=>{d||(d=o.requestAnimationFrame(a))};s.current.measure=c,a(),o.addEventListener("scroll",c,!0),o.addEventListener("resize",c);const p=Pn(o,c),u=new o.MutationObserver(c);u.observe(t.body,{childList:!0,subtree:!0,attributes:!0});const h=r.current?.parentElement,f=h?.ownerDocument.defaultView?.MutationObserver,m=f?new f(c):null;return h&&m?.observe(h,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style"]}),()=>{d&&o.cancelAnimationFrame(d),o.removeEventListener("scroll",c,!0),o.removeEventListener("resize",c),p(),u.disconnect(),m?.disconnect(),s.current.measure=null}},[e,a]),/* @__PURE__ */yt("div",{ref:r,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=i[e.id];return n?/* @__PURE__ */yt("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onMouseEnter:()=>{s.current.id=e.id,o(e.id)},onMouseLeave:()=>{s.current.id=null,o(null),s.current.measure?.()},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
5
+ /* @__PURE__ */yt(tt,{content:e.reach,children:/* @__PURE__ */vt(_n,{colorClass:ot("success","solid"),size:"sm",children:[
6
+ /* @__PURE__ */yt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */yt(mt,{size:12})}),e.label]})}):/* @__PURE__ */yt(_n,{colorClass:ot("info","solid"),size:"sm",children:e.label})},e.id):null})})}function Ot({expand:e}){/* @__PURE__ */
7
+ return yt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */vt(bt,e?{children:[
8
+ /* @__PURE__ */yt("path",{d:"M8 9l4-4 4 4"}),
9
+ /* @__PURE__ */yt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
10
+ /* @__PURE__ */yt("path",{d:"M8 4l4 4 4-4"}),
11
+ /* @__PURE__ */yt("path",{d:"M8 20l4-4 4 4"}),
12
+ /* @__PURE__ */yt("path",{d:"M5 12h14"})]})})}var Nt=`${On}, ${Nn}`;function Bt(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var It="__rungs",Pt=e=>"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:"preset"===e.kind?e.preset.key:e.type;var Mt="screen:band",$t={duplicate:!0,delete:!0},Tt=()=>null;function jt(){const On=ye(),$n=On.panels?.Toolbar,Tn=(On.panels?.useRight??Tt)(),{target:jn,docId:Kn,capabilities:tt,currentSlug:ot,siteId:rt,onPublish:it,saveState:lt,saveConflict:mt,retrySave:zt,toggleAutoSave:jt,flushSave:Et,access:Lt,saveUnreachable:At=!1,readOnly:Rt,readOnlyReason:Ft=null}=C(),Dt=E(),Vt=L(),{mediaEditing:Ht,hasEditGuard:Wt,hasPinnedChrome:Yt}=tt,{appState:Ut,dispatch:Gt,history:Jt,selectedItem:Xt,getSelectorForId:Qt,config:Kt}=Ae(e=>e),_t=A(),{first:qt,firstGroup:Zt,lastGroup:eo,isSectionGroup:no,sectionGroupZone:to,panelOf:oo}=_t,ro=oo(qt),io=e=>re(_t,e),lo=e=>ie(_t,e),so="node"===_t.firstRow,ao=_t.band??null,co=yn("screen",xe),po=yn("tree",_e),uo=yn("drag",Sn),ho=yn("notice",un),fo=yn("lock",gn),mo=yn("menu",qe),go=yn("styleClipboard",ze),yo=yn("chrome",hn),vo=R()??`/${ot}`,bo=F(),ko=D(),So=k({readOnly:Rt}),wo=k({readOnly:Rt,foldIntoHistory:!0}),xo=Hn(null),zo=Re(),Co=Wn(()=>({...So,select:e=>{xo.current=e,So.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=zo.config;xo.current=Ze(e,t,n)}So.commitDocument(e,n)}}),[So,zo]),Oo=Ut.ui,No=Oo.leftSideBarVisible,Bo=Oo.rightSideBarVisible,{options:Io,widths:Po,initial:Mo,fluid:$o,fit:To}=V(),[jo,Eo]=Yn(Mo),Lo=ae(),Ao=Ht&&null!==Lo;ce(),pe();const Ro=ue();H(Xt?.props.id);const{read:Fo,write:Do,forSelection:Vo}=W(),[Ho,Wo]=Yn(Fo);Un(()=>{Do(Ho)},[Ho]);const[Yo,Uo]=Yn(0),Go=Hn(null),Jo=Hn(null),Xo=Cn(Jo,{readySelector:Nt}),Qo=Bn(Xo),Ko=p(Jo);u(Jo,Xo);const _o=z(),qo=fn(Lt),Zo={state:lt,offline:_o||lt.failed&&At,readOnlyReason:Ft,editing:qo?ho.editing({name:mn(qo.name,fo),noun:co.noun}):null,conflict:null!=mt,notSaving:co.bar.notSaving},er=Fe({onPress:()=>{Rt||(lt.failed?zt():Et())}}).onPress;h(Jo,Xo,er);const[nr,tr]=Yn(!1),or=Hn(!1),[rr,ir]=Yn(null),[lr,sr]=Yn([]),[dr,ar]=Yn(Y);U(dr);const cr=e(dr,Xt?.props.id),[pr,ur]=Yn(null);Un(()=>{pr&&(n(),ur(null))},[pr]);const hr=Hn(Qt);hr.current=Qt;const fr=Gn((e,{scroll:n})=>{Wo(n=>Vo(e,n)),n&&ur(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=hr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Yr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),mr=Hn(null);Un(()=>{const e=mr.current;mr.current=null;const n=null==Xt?.props.id?null:String(Xt.props.id);ar(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:oo(Xt?.type)??Y);const o=Xt?.props.id,r=xo.current;if(xo.current=null,!o)return;const i=Qt(o);fr(String(o),{scroll:!t(r,i??null,Ie)})},[Xt?.props.id,fr]);const gr=Gn(e=>{ar(n=>G(n,e)?n:e),Gt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Gt]),yr=Hn(()=>{});yr.current=(e,n)=>{const t=e?Hi(e.zone??Ie)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Xt?.props.id?null:String(Xt.props.id);ar(e=>G(e,n)?e:n),o!==r&&(mr.current={id:o,mode:n},Co.select(e))};const vr=Gn((e,n)=>yr.current(e,n),[]),br={kind:dr.kind,mode:dr,open:gr,show:e=>ar(e),reveal:()=>{Bo||Gt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:vr},kr=J(br,{data:Ut.data,selected:Xt??null,zoneOf:e=>Qt(e)?.zone,readOnly:Boolean(Rt),select:e=>{ar(Y),Co.select({index:e})},replace:(e,n)=>Co.replaceComponent(Ie,e,n),scrollTo:e=>a(e)},{device:jo,refreshes:Yo},{setView:Wo,reveal:()=>{No||Gt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Sr=kr.resolveLeftView?kr.resolveLeftView(Ho):"sections",wr=X(),{isLockedBlock:xr,duplicateBlocked:zr,nestDepth:Cr,newSectionNode:Or,canAddTo:Nr,blockIsOffered:Br}=wr,Ir=e=>({id:String(e.props.id??""),data:Ut?.data}),Pr=Q(),{labelAtLevel:Mr,Icon:$r,useProducts:Tr}=Pr,jr=Pr.rowName?(e,n,t)=>Pr.rowName(e,n,t):void 0,Er=Gn(e=>{Gt({type:"setUi",ui:{rightSideBarVisible:!0}}),a(e),fr(e,{scroll:!0})},[Gt,fr]),{selectNode:Lr,openPartId:Ar}=b({mode:dr,setMode:ar,onOpenPart:Er}),[Rr,Fr]=Yn(null);ve(null!==Rr,()=>Fr(null));const Dr=g(K()),Vr=Dr.collapsed,Hr=Dr.panelWidths,[Wr,Yr]=Yn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Vr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
+ return new Set}});Un(()=>{try{window.localStorage.setItem(Vr,JSON.stringify([...Wr]))}catch{}},[Wr]);const[Ur,Gr]=Yn(()=>{if("undefined"==typeof window)return{...y};try{const e=window.localStorage.getItem(Hr);if(!e)return{...y};const n=JSON.parse(e);return{left:v(Number(n.left)||y.left,"left"),right:v(Number(n.right)||y.right,"right")}}catch{return{...y}}});Un(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Hr,JSON.stringify(Ur))}catch{}},300);return()=>clearTimeout(e)},[Ur]);const Jr=Gn((e,n)=>Gr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Xr=Gn(e=>Jr("left",e),[Jr]),Qr=Gn(e=>Jr("right",e),[Jr]),Kr=e=>Wr.has(e),_r=e=>Yr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),qr=Hn(!1),Zr=Hn(null);Un(()=>{if(qr.current&&!nr){const e=Zr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Jo.current?.querySelector(`button[aria-label="${CSS.escape(co.add.title)}"]`))?.focus(),Zr.current=null}qr.current=nr},[nr]),Un(()=>{if(!nr||!Ko)return;const e=e=>{"Escape"===e.key&&Sl()};return Ko.addEventListener("keydown",e),()=>Ko.removeEventListener("keydown",e)},[nr,Ko]),ve(nr,()=>Sl()),Un(()=>{!No&&nr&&(tr(!1),ir(null),or.current=!1)},[No]);const ei=_(),ni=(e,n="success",t)=>{if(ei)return void(t?ei(e,"error"===n?"error":"info",t):ei(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?et.error(e,{...o,duration:t?.duration??3200}):et.success(e,{...o,duration:t?.duration??1900})},ti=Fe(kr.mainAction??{label:co.done,onPress:()=>{it(zo.getState().appState.data)}}),oi=Hn(ni);oi.current=ni,Un(()=>De(zo,()=>oi.current(co.writeLate,"error")),[zo,co]);const ri=Hn(null),[ii,li]=Yn(0),[si,di]=Yn(0),ai=q(),ci=Hn(null),pi=e=>Math.max(0,e.clientHeight-(ci.current?.offsetHeight??0));Un(()=>{const e=ri.current;if(!e)return;const n=()=>{li(e.clientWidth),di(pi(e))};n();const t=new ResizeObserver(n);return t.observe(e),ci.current&&t.observe(ci.current),()=>t.disconnect()},[]),Jn(()=>{ri.current&&(li(ri.current.clientWidth),di(pi(ri.current)))},[Ur,No,Bo]);const ui=jo===$o?ii>0?ii:Po[$o]:Po[jo],hi=ii>0?Math.min(ii/ui,"shrink"===To?1:2):1,fi=ui*hi,mi=ii>0&&fi>ii+1,gi={width:fi,height:si||"100%",flex:"none",position:"relative"},yi={width:ui,height:si?si/hi:"100%",maxHeight:"none",transform:1!==hi?`scale(${hi})`:void 0,transformOrigin:"top left"},vi=()=>Gt({type:"setUi",ui:{leftSideBarVisible:!No}}),bi=()=>Gt({type:"setUi",ui:{rightSideBarVisible:!Bo}}),ki=e=>{nr&&(tr(!1),ir(null),or.current=!1,No&&Ho===e)||(Wo(e),No||Gt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Si=()=>{ar(ro??Y),Bo||Gt({type:"setUi",ui:{rightSideBarVisible:!0}})},wi=Ut.data.content??[],xi=()=>{const e=wi.findIndex(io),n=wi.findIndex(lo);return{floor:e>=0?e+1:0,cap:n>=0?n:wi.length}},zi=Kt,Ci=wr.stripCopy,Oi=e=>o(e,Ci),Ni=fe(),Bi=en({data:Ut.data,config:zi,readOnly:Boolean(Rt),clipboard:Ni,strip:Ci?e=>Ci(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Ln||e.slot!==An)return{min:0,max:n-1};const{floor:t,cap:o}=xi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&ar(Y);const t=void 0===n||"node"===n?.kind?n:null;Co.commitDocument(e,t)}}),Ii=ge(),[Pi,Mi]=Yn(null),$i=e=>{const n=wi.find(n=>String(n.props.id)===e),t=_t.shared;n&&t&&Bi.swap(e,t.detach(n))},Ti=e=>{const n=Dn(Ut.data,Kt,e);if(!n)return!1;const t=Rn(n.place),o=n.node,r=t===Ie?Fi(o):el(o),i=t===Ie?_t.shared?.usedOn(o):null;return!!Bi.remove(e)&&(ni(i?co.shared.removed({count:Math.max(0,i.length-1)}):co.deleted({name:r}),"success",{duration:8e3,action:{label:co.bar.undo,onClick:()=>{Bi.restore(n.node,n.place)}}}),!0)},ji={...Bi,remove:Ti},Ei=e=>Mr(e,"block",Kt.components[e]?.label??e),Li=Wn(()=>l(Kt),[Kt]),Ai=e=>Mr(e,"section",Ei(e)),Ri={nodeDefaults:Li,newNodeId:je,sectionLabel:Ai,blockIsOffered:Br},Fi=e=>Ce({type:e.type,props:e.props??{}},Ai(e.type),jr),{nodeAddresses:Di,zoneItems:Vi}=Wn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=Me)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of $e(Kt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(wi,Ie,0),{nodeAddresses:e,zoneItems:n}},[wi,Kt]),Hi=Gn(e=>Vi.get(e)??[],[Vi]),Wi=e=>{const n=Di.get(e);return n?Hi(n.zone)[n.index]:void 0},Yi=e=>le(wr,Kt,e),Ui=e=>{if(!wr.slotsOf||e===Ie)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Wi(e.slice(0,n));if(!t)return null;const o=Yi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},Gi=(()=>{if(!Z(dr))return null;const e=`${dr.nodeId}:${dr.slot}`;return Ui(e)?.slot.panel===dr.kind?e:null})(),Ji=Hn(null);Un(()=>{const e=Ji.current;if(Ji.current=null,!Gi||!Z(dr))return;const n=dr.nodeId;fr(n,{scroll:e!==Gi}),Yr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[dr]);const Xi=e=>{const n=Di.get(e);n&&(n.zone===Ie?fl(n.index):Vl(n.zone,n.index,e,Wi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))},Qi=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void Xi(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Gi!==i&&(Ji.current=i),vr(null,r),Bo||Gt({type:"setUi",ui:{rightSideBarVisible:!0}}),a(o)},Ki=(e,n,t)=>{const o=`${e}:${n}`;if(Yr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;Gi!==o&&(Ji.current=o);vr(null,{kind:t,nodeId:e,slot:n})},_i=(e,n,t)=>{if(Rt||!wr.moveSlot)return;const o=Wi(e),r=o?Yi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:It,index:n},s=zn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=wr.moveSlot(e,n,s);"string"==typeof d&&Ki(e,d,i.panel)},qi=Tr(),Zi=Wn(()=>{const e=/* @__PURE__ */new Map;for(const n of qi??[])e.set(n.slug,n.name);return e},[qi]),el=e=>Oe(e,Ei,Pr.plainText,e=>Zi.get(e),Pr.rowName),nl=(e,n)=>{const t=Kt.components[e.type]?.fields,o=n===Ie||hs(n)?"section":"block",r=n===Ie&&(io(e)||lo(e)||no(e.type)),i="block"===o?Ne(t):r?null:Be(t);return Pr.renamePropOf?Pr.renamePropOf(e,o,i):i},tl=(e,n,t,o)=>{if(!(!Rt&&Rr?.zone===e&&Rr.index===n))return;const r=(t,o)=>{Fr(null),o&&((e,n,t)=>{const o=Hi(e)[n];if(!o)return;const r=nl(o,e);r&&Co.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
+ return yt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":co.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},ol=i(ee(),go),rl=ol.scope({target:jn,siteId:rt,docId:Kn}),il=Kt,ll=(e,n)=>n===Ie?Ai(e):Ei(e),sl=(e,n,t)=>{const o=ol.plan(rl,t,ll(t.type,e),il);o&&(o.changed&&Co.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),ni(o.message))},dl=me({nodesIn:Hi,nodeAt:(e,n)=>Hi(e)[n]??null,labelOf:(e,n)=>n===Ie?Ai(e):Ei(e),renamePropOf:nl,beginRename:(e,n)=>Fr({zone:e,index:n}),history:{hasPast:Jt.hasPast,hasFuture:Jt.hasFuture,back:()=>Jt.back(),forward:()=>Jt.forward()},openPageStyles:kr.openPageStyles,pageStylesLabel:co.pageStyles,words:{menu:mo,styleClipboard:go,screen:co.menu},readOnly:Boolean(Rt),collapseAll:()=>Yr(new Set(Hi(Ie).map(e=>String(e.props.id)))),onPasteRefused:e=>ni(e?co.pasteRefused({name:e.label}):co.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>gs(e,n),copyItem:kr.onCopyItem,menuRows:(e,n,t)=>{const o=kr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=_t.shared;if(!t||n!==Ie)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:co.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return Rt||xr(e.type,e)?n:{...n,change:[{label:co.shared.detach,onClick:()=>$i(e.props.id)}],remove:[{label:co.shared.removeFromPage,danger:!0,onClick:()=>{Ti(e.props.id)}}]}}return Rt||io(e)||lo(e)||no(e.type)?null:I(Ii)?{change:[{label:co.shared.makeShared,onClick:()=>Mi({id:e.props.id,name:Fi(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>xr(e.type,e),duplicateBlocked:e=>zr(Ut.data,e),permits:e=>{const n=Pe(Kt,e.type);return _t.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:ji,isPinned:(e,n)=>n===Ie&&(io(e)||lo(e)),sectionBand:xi,locate:e=>Di.get(e)??null,rowNameOf:(e,n)=>n===Ie?Fi(e):el(e),selectAt:(e,n,t,o)=>{e===Ie?fl(n):Vl(e,n,t,o??"")},slotRung:e=>{const n=Ui(e);return n?.slot.panel?{label:n.slot.label,select:()=>Qi(n.node,n.slot,!1)}:null},style:{held:()=>Se(rl),canCopy:e=>ol.rows(il,e).some(e=>!1!==e.counted),copy:(e,n)=>ol.copy(rl,e,ll(e.type,n),il),paste:(e,n,t)=>sl(e,n,t)},keys:Vt?{target:Ko,selected:()=>{const e=Ut.ui.itemSelector;return e?{zone:e.zone??Ie,index:e.index}:null},held:()=>Ni.get(),readOnly:Boolean(Rt),onDone:({done:e,name:n})=>{"copied"===e&&ni(co.copied({name:n}))}}:void 0},Xo),al=Hn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Un(()=>{al.current={copy:(e,n)=>ol.copy(rl,e,ll(e.type,n),il),paste:sl,at:()=>{const e=Ut.ui.itemSelector;if(!e)return null;const n=e.zone??Ie,t=Hi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Rt)}});const cl=Gn(e=>{const n=we(e);if(!n)return;const t=al.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);Un(()=>{if(!Ko)return;const e=e=>cl(e);return Ko.addEventListener("keydown",e),()=>Ko.removeEventListener("keydown",e)},[cl,Ko]),In(Xo,"keydown",cl);const pl=wi.map(e=>e.props.id).join("|");Un(()=>{const e=Xo?.document??null,n=Xo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void sr(e=>e.length?[]:e);const n=wi.findIndex(lo),t=n>=0?n:wi.length,o=n=>{const t=wi[n]?.props?.id;return null==t?null:En(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Nn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=wi.length>0&&!io(wi[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=Bt(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}sr(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=Pn(n,i),s=new ResizeObserver(i);return s.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l(),s.disconnect()}},[Xo,pl,jo,hi,No,Bo,Xt?.props.id]);const ul=Xo?.document??null,hl=Xo?.window??null;Un(()=>{const e=Go.current;if(!e||!ul||!hl)return;const n=[],t=()=>{const n=En(ul,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&hl.scrollTo({left:hl.scrollX,top:hl.scrollY+t,behavior:"instant"}),!0};return Go.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ul,hl]);const fl=e=>{ar(Y),Co.select({index:e}),kr.sectionPressed?.(wi[e]);const n=wi[e]?.props?.id;n&&a(n)},ml=e=>{const{floor:n,cap:t}=xi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Xt&&dr.kind!==ro?.kind?wi.findIndex(e=>e.props.id===Xt.props.id):-1;return o(r>=0?r+1:t)},gl=(e,n)=>{const{floor:t,cap:o}=xi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Co.reorderComponent(Ie,e,i),Co.select({index:i}),{moved:!0,dest:i})},yl=(e,n,t,o)=>{ar(Y),Co.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),ni(co.sectionAdded({name:t}))},vl=(e,n)=>{const t=ml(n),o=Or(e,Ri),r=o?Co.insertNode(Ie,t,o):Co.insertSection(e,t);return yl(t,r,Ai(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of $e(Kt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Nr(e.type,l,d.slice(d.lastIndexOf(":")+1),Ir(e)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},bl=e=>kl(Ie,e),kl=(e,n)=>{Zr.current=document.activeElement??null,ir(null===n?null:{zone:e,index:n}),tr(!0),No||(or.current=!0,Gt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Sl=()=>{tr(!1),ir(null),or.current&&Gt({type:"setUi",ui:{leftSideBarVisible:!1}}),or.current=!1},wl=(e,n)=>Pr.rowName?n?io(e)?Pr.rowName(e,"section",co.header):lo(e)?Pr.rowName(e,"section",co.footer):no(e.type)?Pr.rowName(e,"section",Ei(e.type)):Fi(e):el(e):n?Ai(e.type):Ei(e.type),xl=e=>n=>{e()},zl=(e,n,t)=>{if(Rt)return null;const o=Hi(e)[n];return o&&!Pe(Kt,o.type).delete||o&&xr(o.type,o)?null:/* @__PURE__ */yt(Qe,{kind:"delete",label:e===Ie&&o&&_t.shared?.usedOn(o)?co.shared.removeFromPage:co.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Hi(e)[n]?.props?.id;null!=t&&Ti(String(t))})(e,n),children:/* @__PURE__ */yt(ut,{size:15})})},Cl=e=>Pr.rowPreview?.(e)||void 0,Ol=e=>Pr.rowMarks?.(e)??void 0,Nl=(e,n,t)=>Pr.rowActions?.(e,n,t)??null,Bl=(e,n,t,o)=>{if(Rt)return null;if(xr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
+ return yt(Qe,{kind:"eye",label:r?co.showNamed({name:o}):co.hideNamed({name:o}),onClick:()=>Pl(e,n,t),children:/* @__PURE__ */yt(r?ht:ft,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Il=e=>ad(Ie,e),Pl=(e,n,t)=>{Co.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Ml=e=>Te(Kt,e),$l=e=>$e(Kt,e),Tl=e=>wr.slotsOf?Yi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Ee(e,n.slot)})):[{slot:null,rung:null,kids:se(Kt,e)}],jl=e=>wr.slotsOf?Tl(e).flatMap(e=>e.kids):se(Kt,e),El=e=>Boolean(wr.slotsOf)&&Yi(e).some(e=>e.rung),Ll=(e,n,t)=>Nr(e.type,n,t??void 0,Ir(e)),Al=(e,n,t)=>{const o=Le(Kt,e.type,n)&&(t||jl(e).length>0||El(e));return{collapsible:o,folded:o&&Kr(String(e.props.id))}},Rl=(e,n,t)=>Tl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Al(e,r,t(e.type)).collapsible?[String(e.props.id),...Rl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Fl=e=>jl(e).length>0||El(e)||Boolean(Nr(e.type)),Dl=e=>Boolean(Nr(e)),Vl=(e,n,t,o)=>{if(ar(Y),Nr(o)?.spec?.slider){const t=e.split(":")[0];c(t,n),Co.select({index:n,zone:e}),a(t)}else Co.select({index:n,zone:e}),a(t)},Hl=(e,n,t,o,r)=>{const i=`${e}:${n}`,l=ys(i)?.target.spec??null,d=s(l,t,Ri);d?Co.insertNode(i,o,d):Co.insertComponent(i,t,o),l?.slider?requestAnimationFrame(()=>{c(e,o),Co.select({index:o,zone:i})}):Co.select({index:o,zone:i})},Wl=Hn(/* @__PURE__ */new Set);Un(()=>{wi.forEach(e=>{const n=Nr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Wl.current.has(t))return;Wl.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(Li)).forEach((e,t)=>wo.seedChild(o,t,n.childType,e))})},[wi,wo,Li]);const Yl=Hn(/* @__PURE__ */new Set);Un(()=>{wi.forEach((e,n)=>{const t=e.props.id;if(Yl.current.has(t))return;const o=r(e,Ml(e.type));Yl.current.add(t),o&&wo.replaceComponent(Ie,n,{...e,props:o})})},[wi,wo]),ne(wo,Kt);const Ul=wi.findIndex(lo),Gl=Ul>=0?wi[Ul]:null,Jl=so?wi.findIndex(io):-1,Xl=Jl>=0?wi[Jl]:null,Ql=_t.groupTab,Kl=Wn(()=>Ql?e=>no(e.type):void 0,[Ql]),_l=Boolean(_t.groupBadge),ql=_t.sharedReach,Zl=e=>ql?.(e)??void 0,es=Wn(()=>ql?new Set(wi.filter(e=>Zl(e)).map(e=>String(e.props.id))):null,[wi,ql]),ns=Wn(()=>es?e=>es.has(e):void 0,[es]),ts=_t.first?ql?.({type:_t.first,props:{id:""}})??void 0:void 0,os=_t.groupBadge?/* @__PURE__ */yt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */yt(_n,{tone:"info",size:"xs",children:_t.groupBadge})}):void 0,rs=wi.find(e=>e.type===Zt)??null,is=wi.find(e=>e.type===eo)??null,ls=Ul>=0?Ul:wi.length,ss=[];wi.forEach(e=>{lo(e)||(Fl(e)&&ss.push(String(e.props.id)),ss.push(...Rl(e,1,Dl)))}),Gl&&(ss.push(String(Gl.props.id)),ss.push(...Rl(Gl,1,Dl)));const ds=ss.length>0&&ss.every(e=>Wr.has(e)),as=e=>{const n=Pr.blockRowName(e,Ei);return Pr.rowName?Pr.rowName(e,"block",n):n},cs=(e,n,t,o)=>{const r=Hi(e)[t];if(!r)return;const i={...Fn(e),index:t},l={...Fn(n),index:Math.min(Math.max(o,0),Hi(n).length)},s=zn(i,l);if(e!==n||s!==t)try{Bi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Vn))throw e}},ps=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of $l(e))n.add(r),t(o)};for(const t of Ml(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},us=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Di.get(n);if(!e)return null;if(e.zone===Ie)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},hs=e=>{const n=e.slice(0,e.indexOf(":")),t=wi.find(e=>no(e.type)&&String(e.props.id)===n);return t&&to(n)===e?t:null},fs=(e,n)=>{const t=hs(e);return!t||(!_t.groupAccepts||_t.groupAccepts(t.type,n,Hi(e).length))},ms=(e,n,t)=>{if(e.rung){const t=Wi(e.rung.nodeId),o=t?Yi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===It&&n.index>=0&&n.index<=o}if(n.slot===It)return!1;if(e.add)return bs(e.add,n);const o=Rn(n);if(no(e.type))return!1;const r=hs(o),i=hs(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!fs(o,e.type))&&(n.index>=0&&n.index<=Hi(o).length));if(e.zone===Ie||o===Ie){if(e.zone!==o)return!1;const{floor:t,cap:r}=xi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Hi(o).length)return!1;if(e.zone===o)return!0;const l=Gl&&!_t.lastIsOpen?String(Gl.props.id):null;return(!l||us(e.zone)!==l&&us(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Hi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Di.get(i),s=l?Hi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ps(r).has(n))return!1;const d=Nr(s.type,Cr(Ut?.data,s.type,i),n.slice(n.lastIndexOf(":")+1),Ir(s));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Hi(n),r))})(e.zone,o,e.index,t)},gs=(e,n)=>{const t=Rn(e.from),o=e.node;return t===Rn(n)?fs(t,o.type):ms({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},ys=e=>{const n=e.slice(0,e.indexOf(":")),t=Di.get(n),o=t?Hi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Nr(o.type,Cr(Ut?.data,o.type,n),e.slice(e.lastIndexOf(":")+1),Ir(o));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=j(r.choices??(r.spec?[{type:r.spec.childType,label:Ei(r.spec.childType)}]:[])),l=Ui(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:wl(o,t.zone===Ie)}},vs=(e,n)=>{if("section"!==e.kind)return e;const t=Rn(n);return t===Ie||hs(t)?e:ys(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},bs=(e,n)=>{const t=vs(e,n),o=Rn(n);if("shared"===t.kind){if(o!==Ie||!_t.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=xi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(hs(o)){if("preset"===t.kind)return!1;const e="section"===t.kind?t.type:t.template.node.type;return fs(o,e)&&n.index>=0&&n.index<=Hi(o).length}if(o!==Ie)return!1;const{floor:e,cap:r}=xi();return n.index>=e&&n.index<=r}if(o===Ie)return!1;const r=ys(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Hi(o))},ks=(e,n)=>{const t=vs(e,n);if("block"!==t.kind&&hs(Rn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&fs(n,o)){if("section"===e.kind)Co.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Co.insertNode(n,t,Oi(e.template.node))}ar(Y),Co.select({index:t,zone:n})}})(t,Rn(n),n.index);if("section"===t.kind)return void vl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=ml(t),r=Co.insertNode(Ie,o,n);yl(o,r,e)})(t.template.name,Oi(t.template.node),n.index);if("preset"===t.kind)return void((e,n,t)=>{const o=n(Ri);if(!o)return;const r=ml(t),i=Co.insertNode(Ie,r,o);yl(r,i,e)})(t.preset.label,t.preset.insert,n.index);if("shared"===t.kind){const e=_t.shared?.nodeOf(t.section);if(!e)return;const o=ml(n.index);return void(Bi.restore(e,{parentId:Ln,slot:An,index:o})&&yl(o,e.props.id,t.section.title))}const o=Rn(n),r=ys(o);r&&(r.target.spec?Hl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{Co.insertComponent(e,n,t),ar(Y),Co.select({index:t,zone:e})})(o,t.type,n.index))},Ss=(e,n)=>{e.media?function(e){const n=rd();if(!n||!nd)return;ld(n).then(n=>{n&&function(e,n){if(!nd)return;const t=nd.create(e,Ri),o=Rn(n);if(o===Ie){const e=ml(n.index),o=Co.insertNode(Ie,e,t);return void yl(e,o,Ai(t.type))}Co.insertNode(o,n.index,t),ar(Y),Co.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?_i(e.rung.nodeId,e.index,n.index):e.add?ks(e.add,n):e.zone===Ie?gl(e.index,n.index):cs(e.zone,Rn(n),e.index,n.index)},[ws]=Yn(()=>wn()),xs=xn({keyOf:e=>e.id,readOnly:Boolean(Rt),session:ws,canDrop:ms,onDrop:Ss,onStep:(e,n)=>{e.rung?_i(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Ie?((e,n)=>{const t=Ai(wi[e]?.type??""),o=gl(e,n<0?e-1:e+2);if(!o.moved)return void ni(n<0?co.sectionFirst({name:t}):co.sectionLast({name:t}));const{floor:r,cap:i}=xi();ni(co.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):cs(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),zs=Gn(e=>{const{floor:n,cap:t}=xi(),o=[];for(const r of e.nodes){const e=Rn(r.place),i=Hi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(io(i)||lo(i)||xr(i.type,i))continue;if(no(i.type))continue;const l=Boolean(hs(e)),s=e===Ie||l;e===Ie&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Ai(i.type):el(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Rn(e.list);if(n===Ie&&0===e.children.length)return[{...e,addLabel:co.addSection,addAlways:!0}];const t=ys(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(hs(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Rn(e.list),t=n===Ie||hs(n)?null:ys(n);return t?.choices.length?vn(e,t.target.spec?.addLabel??co.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Ut.data]),Cs=null==Xt?.props.id?null:String(Xt.props.id),Os=Xn(Ve),Ns=Os?.selected()&&Xo?.document&&Cs?Os.selectedPart?.(Xo.document)??null:null,Bs=Ns&&Cs&&He(Ut.data,Kt,Cs,Ns)?Ns:null,Is=Bs?.label?{element:Bs.element,label:Bs.label}:null,Ps=null!==Bs,Ms=Gn(e=>{const n=Kt,t=e=>!e.item.rung&&null!==Dn(Ut.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(Cs);return i?Ps?null:i:r(nn(Ut.data,n,o.item.id,Cs,Kl))??o},[Ut.data,Kt,Cs,Kl,Ps]),[$s,Ts]=Yn(null),[js,Es]=Yn(null),Ls=Boolean(Ql||ql);In(Xo,"mouseover",e=>{if(!Ls)return;const n=Mn(e.target),t=n?xt(Ut.data,Kt,n):null;t!==$s&&Ts(t)}),In(Xo,"mouseout",e=>{Ls&&!e.relatedTarget&&Ts(null)});const As=e=>io(e)||lo(e)||no(e.type),Rs=e=>{const n=no(e.type)?Ei(e.type):io(e)?co.header:lo(e)?co.footer:null;return null===n?Fi(e):Pr.rowName?Pr.rowName(e,"section",n):n},Fs=[];if(Ls){const e=Cs?xt(Ut.data,Kt,Cs):null;for(const n of/* @__PURE__ */new Set([e,$s,js])){const e=n?wi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=io(e)||e.type===Zt,o=Zl(e);if(o){Fs.push({id:String(e.props.id),label:Rs(e),below:t,reach:o});continue}if(!Ql||!As(e))continue;const r=Ql(e);r&&Fs.push({id:String(e.props.id),label:r,below:t})}}const Ds=ge(),Vs=Hn(null);Un(()=>{const e=_t.changeNotice;if(!e)return;const n=JSON.stringify(wi.filter(As)),t=Vs.current;if(Vs.current={doc:Kn,bands:n,index:Jt.index},!t||t.doc!==Kn||t.bands===n)return;Jt.hasPast&&Jt.index>=t.index&&!wt.has(Ds)&&(wt.add(Ds),ni(e,"success",{action:{label:co.bar.undo,onClick:()=>Jt.back()},duration:8e3}))},[wi]);const Hs=e=>{ar(Y),Co.select(e.zone===Ie?{index:e.index}:{index:e.index,zone:e.zone})},Ws=te(),Ys=()=>({data:Ut.data,device:jo,ops:Co,inspector:br}),Us=Ws?.model,Gs=Wn(()=>Us?e=>Us(e,zs(e),Ys()):zs,[Us,zs,jo]),Js=Ws?.measure,Xs=Js?(e,n)=>Js(e,n,Ys()):void 0,Qs=Ws?.canDrop,Ks=Qs?(e,n)=>Qs(e,n,ms,Ys()):ms,_s=Ws?.drop,qs=_s?(e,n)=>_s(e,n,Ss,Ys()):Ss,Zs=Ws?.pick,ed=Zs?e=>Zs(e,Hs,Ys()):Hs,nd=Ws?.media??null,td=Hn(null),od=Wn(()=>nd?{id:kt,zone:"",index:-1,type:nd.adds.type,add:{kind:nd.adds.kind,type:nd.adds.type},media:!0}:null,[nd]);Un(()=>{if(!od||Rt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(st))(e)&&(td.current=null,ws.start({key:kt,item:od}))},n=e=>{ws.get()?.item.media&&(td.current=nt(e.dataTransfer))},t=()=>{ws.get()?.item.media&&ws.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[od,Rt,ws]);const rd=()=>{const e=td.current;return td.current=null,e},id=he(),ld=async e=>{if(!id)return e;const n=await id(e);return n?{...e,id:n.id,url:n.url}:null};const sd=(e,n)=>{if(!nd)return;const t=Dn(zo.getState().appState.data,zi,n);if(!t)return;const o=t.node;Co.replaceComponent(Rn(t.place),t.place.index,{...o,props:{...nd.replace(o,e),id:o.props.id}})},dd=e=>{const n=Rn(e),t=Ui(n);t&&Qi(t.node,t.slot,!1),kl(n,e.index)},ad=(e,n)=>/* @__PURE__ */yt(Ke,{...Rt?{}:xs.seam({place:{...Fn(e),index:n}})},`seam:${e}:${n}`),cd={rowClick:xl,isCollapsed:Kr,toggleCollapse:_r},pd=e=>{const n=String(e.props.id),t=wi.findIndex(e=>String(e.props.id)===n),o=to(n),r=Hi(o),i=Kr(n),l=Ei(e.type),s=Pr.rowName?Pr.rowName(e,"section",l):l,d=e=>ad(o,e);/* @__PURE__ */
16
+ return vt(bt,{children:[
17
+ /* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:e.type,size:13}),name:s,preview:Cl(e),marks:Ol(e),onSelect:()=>fl(t),nameSlot:tl(Ie,t,n,s),selected:cr===n,badge:Zl(e)?void 0:os,shared:Zl(e),actions:Nl(e,Ie,t)??void 0,rowProps:{"data-node-id":n,onClick:xl(()=>fl(t))},fold:{open:!i,label:"section",onToggle:()=>_r(n)}}),!i&&/* @__PURE__ */vt(Ge,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Fi(n),l=Fl(n),s=l&&Kr(r),a=()=>Vl(o,t,r,e.type),{rowProps:c,...p}=xs.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Fn(o),index:t}},{"data-node-id":r,onClick:xl(a)});/* @__PURE__ */
18
+ return vt(Qn,{children:[d(t),
19
+ /* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:n.type,size:13}),name:i,preview:Cl(n),marks:Ol(n),onSelect:a,nameSlot:tl(o,t,r,i),selected:cr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>_r(r)}:void 0,actions:/* @__PURE__ */vt(bt,{children:[zl(o,t,i),Nl(n,o,t),Bl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */yt(Ge,{children:fd(n,2)})]},r)}),d(r.length)]})]})},ud=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=xs.dragging,d=!Kr(l)&&s?.rung?.nodeId!==i,a={...Fn(l),index:0},c=s&&!s.rung&&ms(s,a)?a:void 0,p=()=>Qi(e,n,!0),{rowProps:u,...h}=xs.row({item:{id:`rung:${l}`,zone:`${i}:${It}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:It,index:t},into:c,canDrag:Boolean(wr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:xl(p)}),f=Rt?null:wr.slotActions?.(e,n.slot);/* @__PURE__ */
20
+ return vt(Qn,{children:[n.heading,
21
+ /* @__PURE__ */yt(Ue,{words:po,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Gi===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>_r(l)},actions:f&&f.length>0?/* @__PURE__ */yt(bt,{children:f.map((t,o)=>/* @__PURE__ */yt(Qe,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Rt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ki(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */yt(ut,{size:15}):/* @__PURE__ */yt(gt,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */yt(Ge,{children:r})]},l)},hd=(e,n)=>{const t=Tl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
+ return yt(bt,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Ll(e,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>ad(e,n),p=/* @__PURE__ */vt(bt,{children:[i.map(({child:n,zone:t,index:o})=>{const r=cr===String(n.props.id),{collapsible:i,folded:s}=Al(n,l,Dl(n.type)),d=String(n.props.id),a=as(n),p=()=>Vl(t,o,d,e.type),{rowProps:u,...h}=xs.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Fn(t),index:o}},{"data-node-id":d,onClick:xl(p)});/* @__PURE__ */
23
+ return vt(Qn,{children:[0===o&&c(t,0),
24
+ /* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:n.type,size:13}),name:a,preview:Cl(n),marks:Ol(n),onSelect:p,nameSlot:tl(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>_r(d)}:void 0,actions:/* @__PURE__ */vt(bt,{children:[zl(t,o,a),Nl(n,t,o),Bl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */yt(Ge,{children:hd(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?ud(e,t.rung,r++,o,p):/* @__PURE__ */yt(Qn,{children:p},t.slot??"")})})},fd=(e,n)=>{const t=Cr(Ut?.data,e.type,String(e.props.id)),o=Tl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
+ return yt(bt,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Ll(e,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),h=a&&!a.fixed?`${u}:${a.slot}`:null,f=p?`${u}:${p.slot}`:null,m=(e,n)=>ad(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */vt(bt,{children:[l.map(({child:n,zone:t,index:o})=>{const r=cr===String(n.props.id),i=el(n),l=String(n.props.id),{collapsible:d,folded:a}=Al(n,s,Dl(n.type)),c=Ml(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Fn(p),index:Hi(p).length}:void 0,h=xs.dragging,f=u&&h&&ms(h,u)?u:void 0,g=()=>Vl(t,o,l,e.type),{rowProps:y,...v}=xs.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Fn(t),index:o},into:f,canDrag:!xr(n.type,n)},{"data-node-id":l,onClick:xl(g)});/* @__PURE__ */
26
+ return vt(Qn,{children:[0===o&&m(t,0),
27
+ /* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:n.type,size:13}),name:i,preview:Cl(n),marks:Ol(n),onSelect:g,nameSlot:tl(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>_r(l)}:void 0,actions:xr(n.type,n)?Nl(n,t,o)??void 0:/* @__PURE__ */vt(bt,{children:[zl(t,o,i),Nl(n,t,o),Bl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */yt(Ge,{children:fd(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
+ /* @__PURE__ */yt(N,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Hl(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?f&&!l.some(e=>e.zone===f)?m(f,0):null:0!==l.length||(o.rung?y:g!==f)?null:m(g,0)]});return o.rung?ud(e,o.rung,i++,r,v):/* @__PURE__ */yt(Qn,{children:v},o.slot??"")})})},md=nr,gd=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:No&&!md&&Sr===e.id,onSelect:()=>ki(e.id)}:e,yd=[...(kr.railLead??[]).map(gd),{id:"sections",label:co.layers,icon:/* @__PURE__ */yt(be,{}),active:No&&!md&&"sections"===Sr,onSelect:()=>ki("sections")},...(kr.railTrail??[]).map(gd)],vd=Ao?{onPress:Ro}:Ht?{onPress:()=>{O(On,{accept:"image/*",title:yo.mediaLibrary})}}:null,bd={value:yd.find(e=>!0===e.active)?.id??"",press:e=>{const n=yd.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:yd.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */yt("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},kd=[...kr.railLead??[],...kr.railTrail??[]].find(e=>"panel"in e&&e.id===Sr),Sd=Boolean(ao?.foldable),wd=ao?.label??(Wt?co.pageSections:co.templateSections),xd=Sd&&Kr(Mt),zd=/* @__PURE__ */vt(bt,{children:[wi.map((e,n)=>{if(io(e)||lo(e)||no(e.type))return null;const t=cr===String(e.props.id),o=Boolean(e.props._hidden);$l(e);const r=String(e.props.id),i=kr.hasOwnRows?.(e)??!1,l=Fl(e)||i,s=l&&Kr(r),d=Ml(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Fn(a),index:Hi(a).length}:void 0,p=xs.dragging,u=c&&p&&ms(p,c)?c:void 0,{rowProps:h,...f}=xs.row({item:{id:r,zone:Ie,index:n,type:e.type},place:{...Fn(Ie),index:n},into:u,canDrag:!xr(e.type,e)},{"data-node-id":r,onClick:xl(()=>fl(n))});/* @__PURE__ */
29
+ return vt(Qn,{children:[n>0&&Il(n),
30
+ /* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:e.type,size:13}),name:Fi(e),preview:Cl(e),marks:Ol(e),shared:Zl(e),onSelect:()=>fl(n),nameSlot:tl(Ie,n,r,Fi(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>_r(r)}:void 0,actions:/* @__PURE__ */vt(bt,{children:[zl(Ie,n,Fi(e)),Nl(e,Ie,n),Bl(Ie,n,e,Fi(e))]}),rowProps:h}),Fl(e)&&!s&&/* @__PURE__ */vt(Ge,{children:[fd(e,1),kr.partRows?.(e,cd)]}),i&&!s&&/* @__PURE__ */yt(Ge,{children:kr.ownRows?.(e,n,cd)})]},String(e.props.id??n))}),ls>0&&Il(ls)]}),Cd=(e,n,t)=>{const o=String(e.props.id),r=jl(e).length>0||El(e)||Boolean(Nr(e.type)),i=r&&Kr(o),l="header"===t?co.header:co.footer,s=Pr.rowName?Pr.rowName(e,"section",l):l;/* @__PURE__ */
31
+ return vt(bt,{children:[
32
+ /* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:t,size:13}),name:s,preview:Cl(e),marks:Ol(e),badge:Zl(e)?void 0:os,shared:Zl(e),onSelect:()=>fl(n),nameSlot:tl(Ie,n,o,s),selected:cr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>_r(o)}:void 0,actions:Nl(e,Ie,n)??void 0,rowProps:{"data-node-id":o,onClick:xl(()=>fl(n))}}),r&&!i&&/* @__PURE__ */yt(Ge,{children:hd(e,1)})]})};return(kr.wrap??(e=>e))(
33
+ /* @__PURE__ */yt(oe,{target:Xo,children:/* @__PURE__ */vt("div",{ref:Jo,className:"sf-editor es-editor",style:pn(Ur),onContextMenu:dl.onEditorContextMenu,...f(On),children:[
34
+ /* @__PURE__ */vt(tn,{children:[
35
+ /* @__PURE__ */vt("div",{className:"es-cluster es-cluster--left",children:[vd?/* @__PURE__ */yt(qn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */yt(ke,{}),onClick:vd.onPress,children:co.railMedia}):null,
36
+ /* @__PURE__ */yt(on,{label:co.bar.undo,disabled:Boolean(Rt)||!Jt.hasPast,onClick:()=>Jt.back(),children:/* @__PURE__ */yt(dt,{})}),
37
+ /* @__PURE__ */yt(on,{label:co.bar.redo,disabled:Boolean(Rt)||!Jt.hasFuture,onClick:()=>Jt.forward(),children:/* @__PURE__ */yt(at,{})})]}),
38
+ /* @__PURE__ */vt(rn,{children:[
39
+ /* @__PURE__ */yt(ln,{devices:Io,value:jo,onChange:Eo}),
40
+ /* @__PURE__ */yt(on,{label:co.bar.refresh,tip:co.bar.refreshTip,onClick:()=>{Go.current=(()=>{const e=Xo?.document;if(!e)return null;const n=wi.findIndex(lo),t=n>=0?n:wi.length;let o=null;for(let n=0;n<t;n++){const t=wi[n]?.props?.id;if(null==t)continue;const r=En(e,`[data-easel-block="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Xt?.props?.id??wi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Uo(e=>e+1)},children:/* @__PURE__ */yt(ct,{})}),kr.barView?.()]}),
41
+ /* @__PURE__ */vt(rn,{kind:"right",style:{minWidth:300},children:[
42
+ /* @__PURE__ */yt(w,{input:Zo,words:co.saveStatus}),$n?/* @__PURE__ */yt($n,{}):null,kr.barLead?.(),kr.barTrail?.(),kr.mainAction||!kr.barMain?/* @__PURE__ */yt(x,{input:Zo,action:ti,readOnly:Boolean(Rt),saveSwitch:Dt,onToggleAutoSave:jt,onSaveNow:er,bar:co.bar,words:co.saveStatus}):kr.barMain()]})]}),
43
+ /* @__PURE__ */yt(S,{}),
44
+ /* @__PURE__ */vt("div",{className:"sf-body",children:[No?/* @__PURE__ */vt(bt,{children:[
45
+ /* @__PURE__ */vt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":co.leftPanel,children:[
46
+ /* @__PURE__ */vt("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
47
+ /* @__PURE__ */yt(M,{side:"left",onHide:vi}),
48
+ /* @__PURE__ */yt("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
49
+ /* @__PURE__ */yt(Zn,{variant:"underline",block:!0,"aria-label":co.bar.views,value:bd.value,onChange:bd.press,items:bd.items})]}),nr?/* @__PURE__ */yt(B,{at:rr?{label:(e=>{const n=hs(e.zone);if(n)return co.add.addingTo({name:Pr.rowName?wl(n,!0):Ei(n.type)});if(e.zone===Ie){const n=wi[e.index];return n&&!lo(n)?co.add.addingBefore({name:wl(n,!0)}):co.add.addingAtEnd}const t=ys(e.zone);return t?co.add.addingTo({name:t.parentName}):co.add.addingHere})(rr),onClear:()=>ir(null)}:void 0,placeBlocks:rr&&rr.zone!==Ie?ys(rr.zone)?.choices:void 0,placeNames:rr&&rr.zone!==Ie?(e=>{const n=ys(e),t=n?.target.spec,o=t?d(t,t.childType):null;return t&&o?/* @__PURE__ */new Map([[t.childType,o]]):void 0})(rr.zone):void 0,canTake:rr?e=>{if(!rr)return null;const n={...Fn(rr.zone),index:rr.index};if(bs(e,n))return null;if("shared"===e.kind&&rr.zone===Ie&&!_t.shared?.nodeOf(e.section))return co.shared.alreadyHere;const t=hs(rr.zone);if(t)return co.add.notInside({name:wl(t,!0)});if(rr.zone===Ie)return co.add.onlySections;const o=ys(rr.zone);return o?co.add.notInside({name:o.parentName}):co.add.onlySections}:void 0,onPick:rr?e=>{if(!rr)return;const n={...Fn(rr.zone),index:rr.index};bs(e,n)&&(ks(e,n),Sl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${Pt(e)}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:Pt(e),add:e}),session:ws,siteWide:kr.addPanelRow?.(Sl),onClose:Sl,readOnly:Boolean(Rt)}):kd?kd.panel({onHide:vi,notify:ni}):/* @__PURE__ */vt(bt,{children:[
50
+ /* @__PURE__ */yt($,{icon:/* @__PURE__ */yt(be,{}),title:co.layers,context:vo,actions:/* @__PURE__ */vt(bt,{children:[!Rt&&/* @__PURE__ */yt(sn,{label:co.add.title,onClick:()=>bl(null),children:/* @__PURE__ */yt(pt,{size:15})}),
51
+ /* @__PURE__ */yt(sn,{label:ds?co.expandAll:co.collapseAll,title:0===ss.length?co.nothingToFold:void 0,disabled:0===ss.length,onClick:()=>Yr(e=>{const n=new Set(ss);return ds?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...ss])}),children:/* @__PURE__ */yt(Ot,{expand:ds})})]})}),
52
+ /* @__PURE__ */vt(Je,{className:"sf-tree sf-scroll",words:po,children:[rs&&/* @__PURE__ */vt(bt,{children:[!_l&&/* @__PURE__ */yt(Xe,{children:co.header}),pd(rs)]}),Yt&&!(_l&&rs)&&/* @__PURE__ */vt(bt,{children:[!_l&&/* @__PURE__ */yt(Xe,{children:co.header}),!so&&/* @__PURE__ */yt(Ue,{words:po,icon:/* @__PURE__ */yt($r,{type:"header",size:13}),name:co.header,badge:ts?void 0:os,shared:ts,onSelect:Si,selected:dr.kind===ro?.kind,rowProps:{onClick:xl(Si)}})]}),Xl&&!(_l&&rs)&&Cd(Xl,Jl,"header"),!Sd&&/* @__PURE__ */yt(Xe,{children:wd}),Sd?/* @__PURE__ */vt(bt,{children:[
53
+ /* @__PURE__ */yt(Ue,{words:po,icon:null,name:wd,fold:{open:!xd,label:wd,onToggle:()=>_r(Mt)}}),!xd&&/* @__PURE__ */yt(Ge,{children:zd})]}):zd,Yt&&!_l&&/* @__PURE__ */yt(Xe,{children:co.footer}),Gl&&!(_l&&is)&&Cd(Gl,Ul,"footer"),is&&pd(is),kr.treeFoot?.()]})]})]}),
54
+ /* @__PURE__ */yt(dn,{side:"left",width:Ur.left,min:cn.left,max:an,defaultWidth:y.left,label:co.resizeLeftPanel,onResize:Xr})]}):/* @__PURE__ */yt(T,{side:"left",onShow:vi}),
55
+ /* @__PURE__ */vt("div",{ref:ri,className:"sf-center sf-scroll","data-sf-canvas-head":ai?"":void 0,style:{overflowX:mi?"auto":"hidden",overflowY:"hidden"},children:[ai&&/* @__PURE__ */yt("div",{ref:ci,className:"sf-canvas-head",children:/* @__PURE__ */yt(ai,{device:jo})}),
56
+ /* @__PURE__ */vt("div",{className:"sf-frame-scaler",style:gi,children:[
57
+ /* @__PURE__ */yt("div",{className:"sf-frame "+(jo===$o?"":`sf-frame--${jo}`),style:yi,children:/* @__PURE__ */vt("div",{className:"sf-preview-host",children:[
58
+ /* @__PURE__ */yt(We.Provider,{value:Kl,children:/* @__PURE__ */yt(Ye.Provider,{value:ns,children:/* @__PURE__ */yt(bo,{},Yo)})}),
59
+ /* @__PURE__ */yt(bn,{canvas:Xo,session:ws,model:Gs,measure:Xs,canDrop:Ks,onDrop:qs,choose:Ms,tag:Is,onPick:ed,dropOn:nd?{accepts:(e,n)=>{if(!e.media||!nd||n.item.rung)return!1;const t=Dn(Ut.data,zi,n.item.id);return null!==t&&nd.takes(t.node)},onDrop:(e,n)=>(e=>{const n=rd();n&&nd&&ld(n).then(n=>{n&&sd(n,e.item.id)})})(n),label:()=>co.canvasReplaceImage}:void 0,onZoneAdd:dd,onSeamAdd:dd,zoneAddLabel:co.canvasAddBlock,words:uo.canvas,readOnly:Boolean(Rt),revision:Ut.data}),lr.length>0&&!Qo&&/* @__PURE__ */yt("div",{className:"sf-preview-gaps",children:lr.map(e=>
60
+ /* @__PURE__ */yt(kn,{index:e.index,label:co.addSectionHere,onInsert:()=>bl(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),Ls?/* @__PURE__ */yt(Ct,{canvas:Xo,tabs:Fs,onSelect:Xi,onPointer:Es}):null]})]}),Bo?/* @__PURE__ */vt(bt,{children:[Tn?
61
+ /* @__PURE__ */yt("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Tn}):/* @__PURE__ */yt(bt,{children:/* @__PURE__ */yt(m,{value:{selectChild:Vl,addChild:Hl,childRowName:el,blockRowName:as},children:/* @__PURE__ */yt(ko,{mode:dr,onOpenWebsiteSettings:kr.openSettings??(()=>{}),onOpenSiteStyles:kr.openStyles,onOpenPageStyles:kr.openPageStyles,onSelectNode:Lr,onNotify:ni,onHidePanel:bi,nodeActions:Xt?Pe(Kt,Xt.type):$t})})}),
62
+ /* @__PURE__ */yt(dn,{side:"right",width:Ur.right,min:cn.right,max:an,defaultWidth:y.right,label:co.resizeSettingsPanel,onResize:Qr})]}):
63
+ /* @__PURE__ */yt(T,{side:"right",onShow:bi})]}),dl.menu,
64
+ /* @__PURE__ */yt(de,{}),Pi?/* @__PURE__ */yt(St,{name:Pi.name,onMake:e=>(async(e,n)=>{const t=wi.find(n=>String(n.props.id)===e),o=_t.shared;if(!t||!o)return;let r;try{r=await P(Ii).create(n,t)}catch{return void ni(co.shared.makeFailed,"error")}o.adopt(t,r),Mi(null)})(Pi.id,e),onCancel:()=>Mi(null)}):null]})}))}export{jt as ScreenChrome};
@@ -1,4 +1,4 @@
1
- import{SettingsSwitch as e}from"../chunk-OECWLNKJ.js";import{TEXT_STYLE_CASES as t}from"../chunk-53QUHEHK.js";import"../chunk-DIOTWSCO.js";import{selectionToVisible as n,selectionToSource as r,richLayout as l,createHistory as o,colorRunOf as a,textRange as s,selectionBox as c,placeWindow as i,offsetOrigin as u,visibleArea as d,styleChange as p,clearRangeOf as h,ColorWindow as m,markPress as f,pasteToMarkup as g,richInput as y,editVisible as v,MARKUP_CLIPBOARD_TYPE as b,markupOfRange as k}from"../chunk-MNQDOSAX.js";export{ColorWindow,MARKUP_CLIPBOARD_TYPE,TYPING_BURST_MS,clearRangeOf,colorRunOf,createHistory,editVisible,markupOfRange,newLine,pasteToMarkup,richInput,richLayout,selectionToSource,selectionToVisible,setBullet,startCanvasTyping,textMap,toSource,toSourceStart,toVisible}from"../chunk-MNQDOSAX.js";import{DEFAULT_COPY_WORDS as x}from"../chunk-PMRN5Z3T.js";import{FieldNumber as S}from"../chunk-Y2T3JX7K.js";import{FieldSelect as E}from"../chunk-KFWNGPW3.js";import{SettingsSegmented as w}from"../chunk-DX3VILZ3.js";import{SettingsField as C}from"../chunk-MIX7EGRG.js";import"../chunk-JACEEVVF.js";import{useWords as N}from"../chunk-MFIRYGHW.js";import{registerModalEscapeInterceptor as D,textToolbarRows as T,TextToolbar as O,textAlignWords as L,useShellStrings as R,textAlignOptions as K,TEXT_ALIGNS as j,LinkPicker as F,Tooltip as M,IconButton as B}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as H,useState as V,useLayoutEffect as W,useEffect as $,useId as P}from"react";import{RETIRED_MARKS as z,applyMark as I,marksIn as q,STANDARD_MARKUP as A,listIn as U,colorIn as G,styleIn as X,clearStyle as Y,spanFor as _,findLink as J,tokenizeInline as Q,colorOver as Z,setList as ee,unlinkAt as te,removeLink as ne,linkOver as re,writeLink as le}from"efficient-shell/markup";import{jsxs as oe,jsx as ae,Fragment as se}from"react/jsx-runtime";import{ParagraphSpacingIcon as ce,LetterSpacingIcon as ie,LineSpacingIcon as ue,TextSizeIcon as de,StylesIcon as pe,TypeIcon as he,AlignmentIcon as me,ListFormatIcon as fe,CaseIcon as ge,ItalicIcon as ye,NumberedListIcon as ve,ListIcon as be,ListNoneIcon as ke,CaseLowerIcon as xe,CaseCapitalizedIcon as Se,CaseUpperIcon as Ee,CaseNormalIcon as we}from"efficient-shell/icons/efficient";function Ce(e,t,n,r,l){for(const o of l){if(o.kind!==n)continue;if(!e.startsWith(o.open,t))continue;const l=t+o.open.length;if(e.startsWith(r,l)&&e.startsWith(o.close,l+r.length))return o}return null}function Ne({value:e,rules:t=A,className:n,layerRef:r}){const l=function(e,t){const n=[];let r=0;for(const l of Q(e,t)){if("text"===l.kind){l.text.length>0&&(n.push({kind:"text",text:e.slice(r,r+l.text.length)}),r+=l.text.length);continue}const o=Ce(e,r,l.kind,l.text,t);if(!o)return[{kind:"text",text:e}];const a=r+o.open.length,s=a+l.text.length,c=s+o.close.length;n.push({kind:"delimiter",text:e.slice(r,a)}),n.push({kind:l.kind,text:e.slice(a,s)}),n.push({kind:"delimiter",text:e.slice(s,c)}),r=c}return n.map(e=>e.text).join("")!==e?[{kind:"text",text:e}]:n}(e,t);/* @__PURE__ */
1
+ import{SettingsSwitch as e}from"../chunk-OECWLNKJ.js";import{TEXT_STYLE_CASES as t}from"../chunk-53QUHEHK.js";import"../chunk-DIOTWSCO.js";import{selectionToVisible as n,selectionToSource as r,richLayout as l,createHistory as o,colorRunOf as a,textRange as s,selectionBox as c,placeWindow as i,offsetOrigin as u,visibleArea as d,styleChange as p,clearRangeOf as h,ColorWindow as m,markPress as f,pasteToMarkup as g,richInput as y,editVisible as v,MARKUP_CLIPBOARD_TYPE as b,markupOfRange as k}from"../chunk-MNQDOSAX.js";export{ColorWindow,MARKUP_CLIPBOARD_TYPE,TYPING_BURST_MS,clearRangeOf,colorRunOf,createHistory,editVisible,markupOfRange,newLine,pasteToMarkup,richInput,richLayout,selectionToSource,selectionToVisible,setBullet,startCanvasTyping,textMap,toSource,toSourceStart,toVisible}from"../chunk-MNQDOSAX.js";import{DEFAULT_COPY_WORDS as x}from"../chunk-PMRN5Z3T.js";import{FieldNumber as S}from"../chunk-ANBPE45L.js";import{FieldSelect as E}from"../chunk-C63IB4VW.js";import{SettingsSegmented as w}from"../chunk-DX3VILZ3.js";import{SettingsField as C}from"../chunk-MIX7EGRG.js";import"../chunk-UMTUKSE6.js";import{useWords as N}from"../chunk-MFIRYGHW.js";import{registerModalEscapeInterceptor as D,textToolbarRows as T,TextToolbar as O,textAlignWords as L,useShellStrings as R,textAlignOptions as K,TEXT_ALIGNS as j,LinkPicker as M,Tooltip as B,IconButton as F}from"efficient-shell/ui";export{TextToolbar}from"efficient-shell/ui";import{useRef as H,useState as V,useLayoutEffect as W,useEffect as $,useId as I}from"react";import{RETIRED_MARKS as P,applyMark as z,marksIn as U,STANDARD_MARKUP as q,listIn as A,colorIn as G,styleIn as X,clearStyle as Y,spanFor as _,findLink as Q,tokenizeInline as Z,colorOver as J,setList as ee,unlinkAt as te,removeLink as ne,linkOver as re,writeLink as le}from"efficient-shell/markup";import{jsxs as oe,jsx as ae,Fragment as se}from"react/jsx-runtime";import{ParagraphSpacingIcon as ce,LetterSpacingIcon as ie,LineSpacingIcon as ue,TextSizeIcon as de,StylesIcon as pe,TypeIcon as he,AlignmentIcon as me,ListFormatIcon as fe,CaseIcon as ge,ItalicIcon as ye,NumberedListIcon as ve,ListIcon as be,ListNoneIcon as ke,CaseLowerIcon as xe,CaseCapitalizedIcon as Se,CaseUpperIcon as Ee,CaseNormalIcon as we}from"efficient-shell/icons/efficient";function Ce(e,t,n,r,l){for(const o of l){if(o.kind!==n)continue;if(!e.startsWith(o.open,t))continue;const l=t+o.open.length;if(e.startsWith(r,l)&&e.startsWith(o.close,l+r.length))return o}return null}function Ne({value:e,rules:t=q,className:n,layerRef:r}){const l=function(e,t){const n=[];let r=0;for(const l of Z(e,t)){if("text"===l.kind){l.text.length>0&&(n.push({kind:"text",text:e.slice(r,r+l.text.length)}),r+=l.text.length);continue}const o=Ce(e,r,l.kind,l.text,t);if(!o)return[{kind:"text",text:e}];const a=r+o.open.length,s=a+l.text.length,c=s+o.close.length;n.push({kind:"delimiter",text:e.slice(r,a)}),n.push({kind:l.kind,text:e.slice(a,s)}),n.push({kind:"delimiter",text:e.slice(s,c)}),r=c}return n.map(e=>e.text).join("")!==e?[{kind:"text",text:e}]:n}(e,t);/* @__PURE__ */
2
2
  return ae("div",{ref:r,className:["es-gold-layer",n??""].filter(Boolean).join(" "),"aria-hidden":"true",children:l.map((e,t)=>function(e,t){const{kind:n,text:r}=e;switch(n){case"delimiter":/* @__PURE__ */
3
3
  return ae("span",{className:"es-gold-delim",children:r},t);case"accent":case"highlight":/* @__PURE__ */
4
4
  return ae("em",{className:"es-gold-mark es-gold-accent",children:r},t);case"bold":/* @__PURE__ */
@@ -6,24 +6,24 @@ return ae("strong",{className:"es-gold-mark es-gold-bold",children:r},t);case"it
6
6
  return ae("em",{className:"es-gold-mark es-gold-italic",children:r},t);case"strike":/* @__PURE__ */
7
7
  return ae("s",{className:"es-gold-mark es-gold-strike",children:r},t);case"quiet":/* @__PURE__ */
8
8
  return ae("span",{className:"es-gold-mark es-gold-quiet",children:r},t);default:/* @__PURE__ */
9
- return ae("span",{className:"es-gold-text",children:r},t)}}(e,t))})}function De({value:e,onInput:t,onCommit:n,onCancel:r,multiline:l=!1,placeholder:o,className:a,rules:s=A,ariaLabel:c,disabled:i=!1,inputRef:u}){const d=H(null),p=H(e),h=H(!1);function m(e){h.current&&(h.current=!1,n?.(e))}/* @__PURE__ */
9
+ return ae("span",{className:"es-gold-text",children:r},t)}}(e,t))})}function De({value:e,onInput:t,onCommit:n,onCancel:r,multiline:l=!1,placeholder:o,className:a,rules:s=q,ariaLabel:c,disabled:i=!1,inputRef:u}){const d=H(null),p=H(e),h=H(!1);function m(e){h.current&&(h.current=!1,n?.(e))}/* @__PURE__ */
10
10
  return oe("div",{className:["es-gold",l?"es-gold-is-multiline":"es-gold-is-single",i?"es-gold-is-off":"",a??""].filter(Boolean).join(" "),children:[
11
11
  /* @__PURE__ */ae(Ne,{value:e,rules:s,layerRef:d}),o&&""===e?
12
12
  /* @__PURE__ */ae("div",{className:"es-gold-placeholder","aria-hidden":"true",children:o}):null,
13
- /* @__PURE__ */ae("textarea",{ref:u,className:"es-gold-input",disabled:i,value:e,placeholder:o,"aria-label":c,onChange:function(e){h.current=!0,t(e.currentTarget.value)},onFocus:function(){p.current=e,h.current=!1},onBlur:function(){m(e)},onKeyDown:function(t){return"Escape"===t.key?(t.preventDefault(),h.current=!1,void r?.(p.current)):"Enter"!==t.key||l?void 0:(t.preventDefault(),void m(e))},onScroll:function(e){const t=d.current;t&&(t.scrollTop=e.currentTarget.scrollTop,t.scrollLeft=e.currentTarget.scrollLeft)}})]})}function Te(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function Oe(e,t,n,r=I){const{start:l,end:o}=Te(e,n);return r(e,l,o,t)}function Le(e,t,n){const{start:r,end:l}=Te(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}function Re(e,t,n,r,l){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}`,l&&(n.dataset.textStyle=l),n}}}function Ke(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 je(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 Fe({value:e,rules:t,multiline:o,readOnly:a=!1,placeholder:s,ariaLabel:c,handle:i,onEdit:u,onSelect:d,onHistory:p,onFormat:h,pending:m,onCommit:f,onCancel:x}){const S=H(null),E=H(null),w=H(null),C=H(null),N=H(null),D=H(e),[T,O]=V(0),L=H({value:e,rules:t,multiline:o,readOnly:a,pending:m,onEdit:u,onHistory:p,onFormat:h});L.current={value:e,rules:t,multiline:o,readOnly:a,pending:m,onEdit:u,onHistory:p,onFormat:h};const R=()=>{const e=S.current,t=E.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Ke(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Ke(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},K=(e,t)=>{const n=S.current,r=E.current;if(!n||!r)return;const[l,o]=je(r,e),[a,s]=je(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};i.current={getSource(){const e=R(),t=E.current;if(!e||!t)return null;const[n,l]=r(t.layout,e[0],e[1]);return{start:n,end:l}},setSource(e,t,n){C.current={text:n,src:[e,t]},O(e=>e+1)},focus(){S.current?.focus()},rangeOf(e,t){const r=S.current,l=E.current;if(!r||!l)return null;const[o,a]=n(l.layout,e,t),[s,c]=je(l,o),[i,u]=je(l,a),d=r.ownerDocument.createRange();return d.setStart(s,c),d.setEnd(i,u),d}},W(()=>{const r=S.current;if(!r||N.current)return;const o=C.current?null:R();E.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=Re(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color,e.marks[r].style);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}}(r,l(e,t)),w.current=e;const a=C.current;if(!a||a.text!==e)return void(o&&r.ownerDocument.activeElement===r&&K(o[0],Math.min(o[1],E.current.layout.text.length)));C.current=null;const s=E.current.layout,[c,i]=a.vis??n(s,a.src[0],a.src[1]);r.ownerDocument.activeElement!==r&&r.focus(),K(c,i)},[e,t,T]);const j=(e,t,n)=>{const l=E.current,[o,a]=r(l.layout,t[0],t[1]);C.current={text:e.text,vis:[e.caret,e.caret]},e.text!==L.current.value?L.current.onEdit(e.text,{start:o,end:a},n):O(e=>e+1)};$(()=>{const e=S.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=L.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=E.current,c=R();if(!s||!c)return;const i="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,u=i&&!i.collapsed?[Ke(s,e,i.startContainer,i.startOffset),Ke(s,e,i.endContainer,i.endOffset)]:null,d=y({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?j(d.edit,d.range,d.kind):L.current.onFormat(d.style):L.current.onHistory(d.dir))},n=()=>{N.current||O(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),$(()=>{const e=S.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 F=(n,r=!1)=>{const l=R();if(!l||l[0]===l[1])return;n.preventDefault();const o=E.current;n.clipboardData.setData("text/plain",o.layout.text.slice(l[0],l[1])),n.clipboardData.setData(b,k(e,t,l[0],l[1])),r&&!a&&j(v(e,t,l[0],l[1],{text:""}),l,"edit")};/* @__PURE__ */
13
+ /* @__PURE__ */ae("textarea",{ref:u,className:"es-gold-input",disabled:i,value:e,placeholder:o,"aria-label":c,onChange:function(e){h.current=!0,t(e.currentTarget.value)},onFocus:function(){p.current=e,h.current=!1},onBlur:function(){m(e)},onKeyDown:function(t){return"Escape"===t.key?(t.preventDefault(),h.current=!1,void r?.(p.current)):"Enter"!==t.key||l?void 0:(t.preventDefault(),void m(e))},onScroll:function(e){const t=d.current;t&&(t.scrollTop=e.currentTarget.scrollTop,t.scrollLeft=e.currentTarget.scrollLeft)}})]})}function Te(e,t){const n=t?.selectionStart??e.length;return{start:n,end:t?.selectionEnd??n}}function Oe(e,t,n,r=z){const{start:l,end:o}=Te(e,n);return r(e,l,o,t)}function Le(e,t,n){const{start:r,end:l}=Te(e,n),o=r+t.length;return{text:e.slice(0,r)+t+e.slice(l),selectionStart:o,selectionEnd:o}}function Re(e,t,n,r,l){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}`,l&&(n.dataset.textStyle=l),n}}}function Ke(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 je(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 Me({value:e,rules:t,multiline:o,readOnly:a=!1,placeholder:s,ariaLabel:c,handle:i,onEdit:u,onSelect:d,onHistory:p,onFormat:h,pending:m,onCommit:f,onCancel:x}){const S=H(null),E=H(null),w=H(null),C=H(null),N=H(null),D=H(e),[T,O]=V(0),L=H({value:e,rules:t,multiline:o,readOnly:a,pending:m,onEdit:u,onHistory:p,onFormat:h});L.current={value:e,rules:t,multiline:o,readOnly:a,pending:m,onEdit:u,onHistory:p,onFormat:h};const R=()=>{const e=S.current,t=E.current,n=e?.ownerDocument.getSelection();if(!(e&&t&&n&&0!==n.rangeCount&&n.anchorNode&&e.contains(n.anchorNode)))return null;const r=Ke(t,e,n.anchorNode,n.anchorOffset),l=n.focusNode&&e.contains(n.focusNode)?Ke(t,e,n.focusNode,n.focusOffset):r;return r<=l?[r,l]:[l,r]},K=(e,t)=>{const n=S.current,r=E.current;if(!n||!r)return;const[l,o]=je(r,e),[a,s]=je(r,t);n.ownerDocument.getSelection()?.setBaseAndExtent(l,o,a,s)};i.current={getSource(){const e=R(),t=E.current;if(!e||!t)return null;const[n,l]=r(t.layout,e[0],e[1]);return{start:n,end:l}},setSource(e,t,n){C.current={text:n,src:[e,t]},O(e=>e+1)},focus(){S.current?.focus()},rangeOf(e,t){const r=S.current,l=E.current;if(!r||!l)return null;const[o,a]=n(l.layout,e,t),[s,c]=je(l,o),[i,u]=je(l,a),d=r.ownerDocument.createRange();return d.setStart(s,c),d.setEnd(i,u),d}},W(()=>{const r=S.current;if(!r||N.current)return;const o=C.current?null:R();E.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=Re(n,e.marks[r].kind,e.marks[r].href,e.marks[r].color,e.marks[r].style);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}}(r,l(e,t)),w.current=e;const a=C.current;if(!a||a.text!==e)return void(o&&r.ownerDocument.activeElement===r&&K(o[0],Math.min(o[1],E.current.layout.text.length)));C.current=null;const s=E.current.layout,[c,i]=a.vis??n(s,a.src[0],a.src[1]);r.ownerDocument.activeElement!==r&&r.focus(),K(c,i)},[e,t,T]);const j=(e,t,n)=>{const l=E.current,[o,a]=r(l.layout,t[0],t[1]);C.current={text:e.text,vis:[e.caret,e.caret]},e.text!==L.current.value?L.current.onEdit(e.text,{start:o,end:a},n):O(e=>e+1)};$(()=>{const e=S.current;if(!e)return;const t=t=>{const{value:n,rules:r,multiline:l,readOnly:o,pending:a}=L.current;if("insertCompositionText"===t.inputType)return;if(t.preventDefault(),o)return;const s=E.current,c=R();if(!s||!c)return;const i="function"==typeof t.getTargetRanges?t.getTargetRanges()[0]:void 0,u=i&&!i.collapsed?[Ke(s,e,i.startContainer,i.startOffset),Ke(s,e,i.endContainer,i.endOffset)]:null,d=y({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?j(d.edit,d.range,d.kind):L.current.onFormat(d.style):L.current.onHistory(d.dir))},n=()=>{N.current||O(e=>e+1)};return e.addEventListener("beforeinput",t),e.addEventListener("input",n),()=>{e.removeEventListener("beforeinput",t),e.removeEventListener("input",n)}},[]),$(()=>{const e=S.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 M=(n,r=!1)=>{const l=R();if(!l||l[0]===l[1])return;n.preventDefault();const o=E.current;n.clipboardData.setData("text/plain",o.layout.text.slice(l[0],l[1])),n.clipboardData.setData(b,k(e,t,l[0],l[1])),r&&!a&&j(v(e,t,l[0],l[1],{text:""}),l,"edit")};/* @__PURE__ */
14
14
  return oe("div",{className:"es-rich-wrap",children:[s&&""===e?/* @__PURE__ */ae("div",{className:"es-rich-placeholder","aria-hidden":"true",children:s}):null,
15
- /* @__PURE__ */ae("div",{ref:S,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:()=>{D.current=e},onBlur:()=>{e!==D.current&&f?.(e),D.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),x?.(D.current),void(D.current=e);"Enter"!==t.key||o||(t.preventDefault(),e!==D.current&&f?.(e),D.current=e)},onCompositionStart:()=>{const e=R()??[0,0];N.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=N.current;if(N.current=null,!t)return;const{value:n,rules:r,pending:l}=L.current;e.data?j(v(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=>F(e),onCut:e=>F(e,!0),onPaste:n=>{if(n.preventDefault(),a)return;const r=R();if(!r)return;const l=n.clipboardData.getData(b),s=l?o?l:l.replace(/\s*\r?\n\s*/g," "):g({html:n.clipboardData.getData("text/html"),text:n.clipboardData.getData("text/plain")},{doc:n.currentTarget.ownerDocument,multiline:o,rules:t});j(v(e,t,r[0],r[1],{markup:s}),r,"edit")}})]})}var Me={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */ae(de,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */ae(ue,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */ae(ie,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */ae(ce,{}),unit:"px",step:1,shiftStep:10,min:0}};function Be(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function He({cells:e,words:t,readOnly:n=!1}){const r=t??x.cells,l=P();/* @__PURE__ */
15
+ /* @__PURE__ */ae("div",{ref:S,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:()=>{D.current=e},onBlur:()=>{e!==D.current&&f?.(e),D.current=e},onKeyDown:t=>{if("Escape"===t.key)return t.preventDefault(),x?.(D.current),void(D.current=e);"Enter"!==t.key||o||(t.preventDefault(),e!==D.current&&f?.(e),D.current=e)},onCompositionStart:()=>{const e=R()??[0,0];N.current={from:e[0],to:e[1]}},onCompositionEnd:e=>{const t=N.current;if(N.current=null,!t)return;const{value:n,rules:r,pending:l}=L.current;e.data?j(v(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:n=>{if(n.preventDefault(),a)return;const r=R();if(!r)return;const l=n.clipboardData.getData(b),s=l?o?l:l.replace(/\s*\r?\n\s*/g," "):g({html:n.clipboardData.getData("text/html"),text:n.clipboardData.getData("text/plain")},{doc:n.currentTarget.ownerDocument,multiline:o,rules:t});j(v(e,t,r[0],r[1],{markup:s}),r,"edit")}})]})}var Be={fontSize:{key:"fontSize",nameKey:"fontSize",icon:/* @__PURE__ */ae(de,{}),unit:"px",step:1,shiftStep:10,min:5},lineHeight:{key:"lineHeight",nameKey:"lineHeight",icon:/* @__PURE__ */ae(ue,{}),unit:"%",step:1,shiftStep:10,min:50,max:250,scale:100},letterSpacing:{key:"letterSpacing",nameKey:"letterSpacing",icon:/* @__PURE__ */ae(ie,{}),unit:"px",step:.1,shiftStep:1,min:-10},paragraphSpacing:{key:"paragraphSpacing",nameKey:"paragraphSpacing",icon:/* @__PURE__ */ae(ce,{}),unit:"px",step:1,shiftStep:10,min:0}};function Fe(e,t){return void 0===e?void 0:Number((e*t).toFixed(6))}function He({cells:e,words:t,readOnly:n=!1}){const r=t??x.cells,l=I();/* @__PURE__ */
16
16
  return ae("div",{className:"es-copy-cells-fit",children:/* @__PURE__ */ae("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__ */
17
17
  return oe("div",{className:"es-copy-cell",children:[
18
18
  /* @__PURE__ */ae("label",{className:"es-field-label es-copy-cell-name",htmlFor:c,children:o}),
19
- /* @__PURE__ */ae(S,{id:c,value:Be(e.value,t),styleValue:Be(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 Ve({target:e,onChange:t}){const n=H(null);return W(()=>{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 We=/* @__PURE__ */new Set([...z,"clear"]);function $e({value:t,onChange:n,onCommit:r,onCancel:l,multiline:y=!1,placeholder:v,ariaLabel:b,className:k,readOnly:S=!1,rules:E,tools:w=[],writeMark:C,align:L,actions:R,toolbar:K,barLabel:j,renderFooter:M,inputRef:B,barShows:z="always",richText:Q=!0,defaultShowMarks:ce=!1,colors:ie,cells:ue,letterCase:de,lastTool:pe}){const he=N("copy",x),me=H(null),fe=B??me,[ge,ye]=V(!1),[ve,be]=V(null),ke=H(o()).current,xe=H(null);$(()=>{const e=xe.current;e&&t===e.to?xe.current=null:e&&t===e.from||(xe.current=null,ke.reset(),be(Te.current?.getSource()??null))},[t,ke]);const Se=e=>{xe.current={from:xe.current?.from??t,to:e},n(e)},Ee=e=>({text:t,start:e?.selectionStart??ve?.start??t.length,end:e?.selectionEnd??ve?.end??t.length}),[we,Ce]=V(ce),Ne=Q&&!(y&&we),Te=H(null),Re=P(),[Ke,je]=V(null),[Me,Be]=V(!1),$e=()=>{if(!Ne)return fe.current;const e=Te.current?.getSource()??ve;return e?{selectionStart:e.start,selectionEnd:e.end}:null},Pe=Ve({target:fe,onChange:Se}),ze=e=>(be({start:e.selectionStart,end:e.selectionEnd}),e),Ie=(e,n)=>{if(!Ne)return void Pe(t=>(n&&ke.record(Ee(t),"edit",Date.now()),ze(e(t))));const r=$e(),l=ze(e(r));n&&ke.record(Ee(r),"edit",Date.now()),je(null),l.text!==t&&Se(l.text),Te.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},qe=e=>Ie(e,!0),Ae=e=>Ie(t=>{const n=Ee(t),r=ke[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);W(()=>{const e=Ue.current;e&&(Ue.current=null,Ne?Te.current?.setSource(e.start,e.end,t):(fe.current?.focus(),fe.current?.setSelectionRange(e.start,e.end),be(e)))},[Ne]);const[Ge,Xe]=V(null),Ye=E??A,_e=("string"==typeof w[0]?w:w.map(e=>e.style)).filter(e=>!We.has(e)),Je={};if(ve){const e=q(t,ve.start,ve.end,Ye);for(const t of _e){const n=e.has(t)||"highlight"===t&&e.has("accent");Je[t]=!!Ke?.add.includes(t)||!Ke?.drop.includes(t)&&n}Je.link=e.has("link")}const Qe=()=>{const e=$e(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},Ze=e=>{if("link"!==e&&_(0,e)){const{start:n,end:r}=Qe();if(n===r&&!Ne)return void qe(n=>Oe(t,e,n,(e,t,n,r)=>I(e,t,n,r,Ye,he.placeholders)));const l=f({value:t,rules:Ye,start:n,end:r,style:e,pending:Ke});return void("pending"===l.kind?je(l.pending):qe(()=>l.result))}if("link"!==e){const n=C??((e,t,n,r)=>I(e,t,n,r,A,he.placeholders));return void qe(r=>Oe(t,e,r,n))}const n=$e(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Be(!1),Xe({start:r,end:l,link:J(t,r,l)})},et=Boolean(ve&&ve.start!==ve.end),tt=ve?U(t,ve.start,ve.end,Ye):null,nt=ve?Ke&&void 0!==Ke.color&&Ke.at===ve.start?Ke.color:G(t,ve.start,ve.end,Ye):null,rt=a(nt,ie),lt=e=>{Ne?e?Te.current?.setSource(e.start,e.end,t):Te.current?.focus():(fe.current?.focus(),e&&fe.current?.setSelectionRange(e.start,e.end))},ot=()=>{const e=Ge;Xe(null),lt(e?{start:e.start,end:e.end}:ve)},at=()=>{const e=ct.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Be(!1),t&&lt(ve)},st=H(at);st.current=at,$(()=>{if(Me)return D(e=>{const t=ct.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(st.current(),!0)},()=>ct.current?.querySelector(".es-copy-colors"))},[Me]);const ct=H(null),it=Me||null!==Ge;$(()=>{const e=ct.current;if(!it||!e)return;const t=e.ownerDocument,n=()=>{Be(!1),Xe(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)}},[it]);const ut=Ge??(Me?ve??{start:t.length,end:t.length}:null),dt=H(()=>{});dt.current=()=>{const e=ct.current,t=e?.querySelector(".rosh-tb-wrap > .es-copy-pop");if(!e||!t||!ut)return;const n=Ne?null:e.querySelector(".es-gold-layer"),r=Ne?Te.current?.rangeOf(ut.start,ut.end)??null:n?s(n,ut.start,ut.end):null,l=r?.endContainer,o=l?1===l.nodeType?l:l.parentElement:null,a=r?c(r,o?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!a)return;const p=i({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:d(e),parent:u(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"},W(()=>{const e=ct.current;if(!it||!e)return;const t=()=>dt.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()}},[it,Me,Ge,ut?.start,ut?.end,Ne]);const pt="always"===z||ge||null!==Ge||Me,ht=ie&&ie.length>0?{run:rt,open:Me,onToggle:()=>{Xe(null),Me?at():Be(!0)}}:void 0,mt=pt?pe?pe({className:"rosh-tb-btn",disabled:S,selected:et,keepCaret:e=>e.preventDefault(),insert:e=>qe(n=>Le(t,e,n)),style:et&&ve?X(t,ve.start,ve.end,Ye):null,applyStyle:e=>{if(S)return;const{start:n,end:r}=Qe();if(n===r)return;const l=p({value:t,start:n,end:r,id:e,rules:Ye});l?qe(()=>l):((e,n)=>{be({start:e,end:n}),Ne?Te.current?.setSource(e,n,t):(fe.current?.focus(),fe.current?.setSelectionRange(e,n))})(n,r)}}):"classic"===K?R:void 0:void 0,ft=new Set(_e),gt=L?{value:L.value,allow:L.allow,onChange:L.onChange,disabled:L.disabled}:void 0,yt={pressed:tt,onList:e=>{const{start:n,end:r}=Qe(),l=U(t,n,r,Ye);qe(()=>ee(t,n,r,l===e?null:e,Ye))}},vt=h(ve,t.length),bt=S||Y(t,vt.start,vt.end,Ye).text===t?void 0:{onClear:()=>{const{start:e,end:n}=h(Qe(),t.length);qe(()=>Y(t,e,n,Ye))}},kt=T({offered:ft,color:ht,last:mt,alignment:gt,list:yt,letterCase:de,clear:bt});/* @__PURE__ */
20
- return oe("div",{ref:ct,className:"es-copy"+(k?` ${k}`:""),onFocus:()=>ye(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ye(!1)},onKeyDown:e=>{const t=e.target===fe.current||Boolean(e.target.closest?.(".es-rich"));if(S||!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 Ae(l||e.shiftKey?"redo":"undo");const o={b:"bold",i:"italic",u:"underline",k:"link"}[`${e.shiftKey?"shift+":""}${n}`];o&&_e.includes(o)&&(e.preventDefault(),e.stopPropagation(),Ze(o))},onPaste:e=>{const n=fe.current;if(S||!n||e.target!==n)return;e.preventDefault();const r=g({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:y,rules:Ye});qe(e=>Le(t,r,e))},style:ie&&ie.length>0?Object.fromEntries(ie.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=fe.current;e&&e.ownerDocument.activeElement===e&&be({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[pt&&(kt.words||kt.paragraph)?
21
- /* @__PURE__ */ae(O,{className:"es-copy-toolbar","aria-label":j??he.formatting,offered:ft,pressed:Je,onMark:e=>Ze(e),color:ht,linkOpen:null!==Ge,last:mt,alignment:gt,list:yt,letterCase:de,clear:bt,disabled:S,windows:/* @__PURE__ */oe(se,{children:[Me&&ie&&ie.length>0?/* @__PURE__ */ae(m,{colors:ie,current:nt,words:he.colors??x.colors,onPick:e=>{const{start:n,end:r}=Qe();if(n!==r)qe(()=>Z(t,n,r,e,Ye));else{if(!Ne)return;je({add:Ke?.add??[],drop:Ke?.drop??[],color:e,at:n})}}}):null,Ge?Ge&&/* @__PURE__ */ae(F,{className:"es-copy-link es-copy-pop",value:Ge.link?.href??"",onApply:e=>{const n=Ge;Xe(null),qe(()=>Ne?re(t,n.start,n.end,e,Ye):le(t,n.start,n.end,e))},onRemove:Ge.link?()=>{const e=Ge.link,n=Ge;Xe(null),e&&qe(()=>Ne?te(t,n.start,n.end,Ye):ne(t,e))}:void 0,onCancel:ot}):null]})}):null,ue&&ue.length>0?/* @__PURE__ */ae(He,{cells:ue,words:he.cells??x.cells,readOnly:S}):null,Ne?/* @__PURE__ */ae(Fe,{value:t,rules:Ye,multiline:y,readOnly:S,placeholder:v,ariaLabel:b,handle:Te,pending:Ke??void 0,onEdit:(e,n,r)=>{ke.record({text:t,start:n.start,end:n.end},r,Date.now()),je(null),Se(e)},onSelect:e=>{be(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Ke||e.start===Ke.at&&e.end===Ke.at||je(null)},onHistory:Ae,onFormat:e=>{_e.includes(e)&&Ze(e)},onCommit:r,onCancel:l}):/* @__PURE__ */ae(De,{value:t,onInput:e=>{ke.record(Ee(null),"type",Date.now()),Se(e)},onCommit:r,onCancel:l,multiline:y,placeholder:v,ariaLabel:b,rules:E,disabled:S,inputRef:fe,className:"es-copy-box"}),M?M({focused:ge,insert:e=>qe(n=>Le(t,e,n))}):null,Q&&y?
19
+ /* @__PURE__ */ae(S,{id:c,value:Fe(e.value,t),styleValue:Fe(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 Ve({target:e,onChange:t}){const n=H(null);return W(()=>{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 We=/* @__PURE__ */new Set([...P,"clear"]);function $e({value:t,onChange:n,onCommit:r,onCancel:l,multiline:y=!1,placeholder:v,ariaLabel:b,className:k,readOnly:S=!1,rules:E,tools:w=[],writeMark:C,align:L,actions:R,toolbar:K,barLabel:j,renderFooter:B,inputRef:F,barShows:P="always",richText:Z=!0,defaultShowMarks:ce=!1,colors:ie,cells:ue,letterCase:de,lastTool:pe}){const he=N("copy",x),me=H(null),fe=F??me,[ge,ye]=V(!1),[ve,be]=V(null),ke=H(o()).current,xe=H(null);$(()=>{const e=xe.current;e&&t===e.to?xe.current=null:e&&t===e.from||(xe.current=null,ke.reset(),be(Te.current?.getSource()??null))},[t,ke]);const Se=e=>{xe.current={from:xe.current?.from??t,to:e},n(e)},Ee=e=>({text:t,start:e?.selectionStart??ve?.start??t.length,end:e?.selectionEnd??ve?.end??t.length}),[we,Ce]=V(ce),Ne=Z&&!(y&&we),Te=H(null),Re=I(),[Ke,je]=V(null),[Be,Fe]=V(!1),$e=()=>{if(!Ne)return fe.current;const e=Te.current?.getSource()??ve;return e?{selectionStart:e.start,selectionEnd:e.end}:null},Ie=Ve({target:fe,onChange:Se}),Pe=e=>(be({start:e.selectionStart,end:e.selectionEnd}),e),ze=(e,n)=>{if(!Ne)return void Ie(t=>(n&&ke.record(Ee(t),"edit",Date.now()),Pe(e(t))));const r=$e(),l=Pe(e(r));n&&ke.record(Ee(r),"edit",Date.now()),je(null),l.text!==t&&Se(l.text),Te.current?.setSource(l.selectionStart,l.selectionEnd,l.text)},Ue=e=>ze(e,!0),qe=e=>ze(t=>{const n=Ee(t),r=ke[e](n);return r?{text:r.text,selectionStart:r.start,selectionEnd:r.end}:{text:n.text,selectionStart:n.start,selectionEnd:n.end}},!1),Ae=H(null);W(()=>{const e=Ae.current;e&&(Ae.current=null,Ne?Te.current?.setSource(e.start,e.end,t):(fe.current?.focus(),fe.current?.setSelectionRange(e.start,e.end),be(e)))},[Ne]);const[Ge,Xe]=V(null),Ye=E??q,_e=("string"==typeof w[0]?w:w.map(e=>e.style)).filter(e=>!We.has(e)),Qe={};if(ve){const e=U(t,ve.start,ve.end,Ye);for(const t of _e){const n=e.has(t)||"highlight"===t&&e.has("accent");Qe[t]=!!Ke?.add.includes(t)||!Ke?.drop.includes(t)&&n}Qe.link=e.has("link")}const Ze=()=>{const e=$e(),n=e?.selectionStart??t.length;return{start:n,end:e?.selectionEnd??n}},Je=e=>{if("link"!==e&&_(0,e)){const{start:n,end:r}=Ze();if(n===r&&!Ne)return void Ue(n=>Oe(t,e,n,(e,t,n,r)=>z(e,t,n,r,Ye,he.placeholders)));const l=f({value:t,rules:Ye,start:n,end:r,style:e,pending:Ke});return void("pending"===l.kind?je(l.pending):Ue(()=>l.result))}if("link"!==e){const n=C??((e,t,n,r)=>z(e,t,n,r,q,he.placeholders));return void Ue(r=>Oe(t,e,r,n))}const n=$e(),r=n?.selectionStart??t.length,l=n?.selectionEnd??r;Fe(!1),Xe({start:r,end:l,link:Q(t,r,l)})},et=Boolean(ve&&ve.start!==ve.end),tt=ve?A(t,ve.start,ve.end,Ye):null,nt=ve?Ke&&void 0!==Ke.color&&Ke.at===ve.start?Ke.color:G(t,ve.start,ve.end,Ye):null,rt=a(nt,ie),lt=e=>{Ne?e?Te.current?.setSource(e.start,e.end,t):Te.current?.focus():(fe.current?.focus(),e&&fe.current?.setSelectionRange(e.start,e.end))},ot=()=>{const e=Ge;Xe(null),lt(e?{start:e.start,end:e.end}:ve)},at=()=>{const e=ct.current,t=Boolean(e&&e.querySelector(".es-copy-colors")?.contains(e.ownerDocument.activeElement));Fe(!1),t&&lt(ve)},st=H(at);st.current=at,$(()=>{if(Be)return D(e=>{const t=ct.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(st.current(),!0)},()=>ct.current?.querySelector(".es-copy-colors"))},[Be]);const ct=H(null),it=Be||null!==Ge;$(()=>{const e=ct.current;if(!it||!e)return;const t=e.ownerDocument,n=()=>{Fe(!1),Xe(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)}},[it]);const ut=Ge??(Be?ve??{start:t.length,end:t.length}:null),dt=H(()=>{});dt.current=()=>{const e=ct.current,t=e?.querySelector(".rosh-tb-wrap > .es-copy-pop");if(!e||!t||!ut)return;const n=Ne?null:e.querySelector(".es-gold-layer"),r=Ne?Te.current?.rangeOf(ut.start,ut.end)??null:n?s(n,ut.start,ut.end):null,l=r?.endContainer,o=l?1===l.nodeType?l:l.parentElement:null,a=r?c(r,o?.closest(".es-rich-line, .es-gold-layer")??null):null;if(!a)return;const p=i({anchor:a,size:{width:t.offsetWidth,height:t.offsetHeight},within:e.getBoundingClientRect(),clip:d(e),parent:u(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"},W(()=>{const e=ct.current;if(!it||!e)return;const t=()=>dt.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()}},[it,Be,Ge,ut?.start,ut?.end,Ne]);const pt="always"===P||ge||null!==Ge||Be,ht=ie&&ie.length>0?{run:rt,open:Be,onToggle:()=>{Xe(null),Be?at():Fe(!0)}}:void 0,mt=pt?pe?pe({className:"rosh-tb-btn",disabled:S,selected:et,keepCaret:e=>e.preventDefault(),insert:e=>Ue(n=>Le(t,e,n)),style:et&&ve?X(t,ve.start,ve.end,Ye):null,applyStyle:e=>{if(S)return;const{start:n,end:r}=Ze();if(n===r)return;const l=p({value:t,start:n,end:r,id:e,rules:Ye});l?Ue(()=>l):((e,n)=>{be({start:e,end:n}),Ne?Te.current?.setSource(e,n,t):(fe.current?.focus(),fe.current?.setSelectionRange(e,n))})(n,r)}}):"classic"===K?R:void 0:void 0,ft=new Set(_e),gt=L?{value:L.value,allow:L.allow,onChange:L.onChange,disabled:L.disabled}:void 0,yt={pressed:tt,onList:e=>{const{start:n,end:r}=Ze(),l=A(t,n,r,Ye);Ue(()=>ee(t,n,r,l===e?null:e,Ye))}},vt=h(ve,t.length),bt=S||Y(t,vt.start,vt.end,Ye).text===t?void 0:{onClear:()=>{const{start:e,end:n}=h(Ze(),t.length);Ue(()=>Y(t,e,n,Ye))}},kt=T({offered:ft,color:ht,last:mt,alignment:gt,list:yt,letterCase:de,clear:bt});/* @__PURE__ */
20
+ return oe("div",{ref:ct,className:"es-copy"+(k?` ${k}`:""),onFocus:()=>ye(!0),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||ye(!1)},onKeyDown:e=>{const t=e.target===fe.current||Boolean(e.target.closest?.(".es-rich"));if(S||!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 qe(l||e.shiftKey?"redo":"undo");const o={b:"bold",i:"italic",u:"underline",k:"link"}[`${e.shiftKey?"shift+":""}${n}`];o&&_e.includes(o)&&(e.preventDefault(),e.stopPropagation(),Je(o))},onPaste:e=>{const n=fe.current;if(S||!n||e.target!==n)return;e.preventDefault();const r=g({html:e.clipboardData.getData("text/html"),text:e.clipboardData.getData("text/plain")},{doc:n.ownerDocument,multiline:y,rules:Ye});Ue(e=>Le(t,r,e))},style:ie&&ie.length>0?Object.fromEntries(ie.map(e=>[`--es-color-${e.name}`,e.value])):void 0,onSelect:()=>{const e=fe.current;e&&e.ownerDocument.activeElement===e&&be({start:e.selectionStart??t.length,end:e.selectionEnd??t.length})},children:[pt&&(kt.words||kt.paragraph)?
21
+ /* @__PURE__ */ae(O,{className:"es-copy-toolbar","aria-label":j??he.formatting,offered:ft,pressed:Qe,onMark:e=>Je(e),color:ht,linkOpen:null!==Ge,last:mt,alignment:gt,list:yt,letterCase:de,clear:bt,disabled:S,windows:/* @__PURE__ */oe(se,{children:[Be&&ie&&ie.length>0?/* @__PURE__ */ae(m,{colors:ie,current:nt,words:he.colors??x.colors,onPick:e=>{const{start:n,end:r}=Ze();if(n!==r)Ue(()=>J(t,n,r,e,Ye));else{if(!Ne)return;je({add:Ke?.add??[],drop:Ke?.drop??[],color:e,at:n})}}}):null,Ge?Ge&&/* @__PURE__ */ae(M,{className:"es-copy-link es-copy-pop",value:Ge.link?.href??"",onApply:e=>{const n=Ge;Xe(null),Ue(()=>Ne?re(t,n.start,n.end,e,Ye):le(t,n.start,n.end,e))},onRemove:Ge.link?()=>{const e=Ge.link,n=Ge;Xe(null),e&&Ue(()=>Ne?te(t,n.start,n.end,Ye):ne(t,e))}:void 0,onCancel:ot}):null]})}):null,ue&&ue.length>0?/* @__PURE__ */ae(He,{cells:ue,words:he.cells??x.cells,readOnly:S}):null,Ne?/* @__PURE__ */ae(Me,{value:t,rules:Ye,multiline:y,readOnly:S,placeholder:v,ariaLabel:b,handle:Te,pending:Ke??void 0,onEdit:(e,n,r)=>{ke.record({text:t,start:n.start,end:n.end},r,Date.now()),je(null),Se(e)},onSelect:e=>{be(t=>t&&t.start===e.start&&t.end===e.end?t:e),!Ke||e.start===Ke.at&&e.end===Ke.at||je(null)},onHistory:qe,onFormat:e=>{_e.includes(e)&&Je(e)},onCommit:r,onCancel:l}):/* @__PURE__ */ae(De,{value:t,onInput:e=>{ke.record(Ee(null),"type",Date.now()),Se(e)},onCommit:r,onCancel:l,multiline:y,placeholder:v,ariaLabel:b,rules:E,disabled:S,inputRef:fe,className:"es-copy-box"}),B?B({focused:ge,insert:e=>Ue(n=>Le(t,e,n))}):null,Z&&y?
22
22
  /* @__PURE__ */oe("div",{className:"es-copy-marks",children:[
23
- /* @__PURE__ */ae(e,{checked:we,onChange:()=>{const e=$e();Ue.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:ve,je(null),Ce(e=>!e)},ariaLabelledBy:Re,disabled:S}),
24
- /* @__PURE__ */ae("span",{id:Re,className:"es-copy-marks-label",children:he.showMarks??"Show marks"})]}):null]})}var Pe=["none","bullet","number"],ze=t,Ie={none:/* @__PURE__ */ae(ke,{}),bullet:/* @__PURE__ */ae(be,{}),number:/* @__PURE__ */ae(ve,{})},qe={none:/* @__PURE__ */ae(we,{}),upper:/* @__PURE__ */ae(Ee,{}),capitalize:/* @__PURE__ */ae(Se,{}),lower:/* @__PURE__ */ae(xe,{})};function Ae({label:e,icon:t,answers:n,names:r,glyphs:l,row:o,readOnly:a}){const s=o.value||o.styleValue||"";/* @__PURE__ */
25
- return ae(C,{label:e,icon:t,children:/* @__PURE__ */ae(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 Ue({kept:e,keptHint:t,readOnly:n=!1,style:r,font:l,italic:o,cells:a,align:s,list:c,letterCase:i}){const u=N("copy",x),d=L(R().textToolbar),p=Object.fromEntries(K(j).map(e=>[e.value,e.icon])),h={...x.panel,...u.panel},m=r&&!n?[r.onEditStyles&&{label:h.editStyles,onSelect:r.onEditStyles},r.onUpdateStyle&&{label:h.updateStyle,onSelect:r.onUpdateStyle}].filter(e=>!!e):[],f=!!o&&(o.value??o.styleValue??!1),g=o?/* @__PURE__ */ae(M,{content:h.italic,children:/* @__PURE__ */ae(B,{size:"md",variant:"ghost","aria-label":h.italic,"aria-pressed":f,disabled:n,onClick:()=>{if(n)return;const e=!f;o.onChange(e===(o.styleValue??!1)?void 0:e)},children:/* @__PURE__ */ae(ye,{})})}):null;/* @__PURE__ */
23
+ /* @__PURE__ */ae(e,{checked:we,onChange:()=>{const e=$e();Ae.current=e&&null!==e.selectionStart&&null!==e.selectionEnd?{start:e.selectionStart,end:e.selectionEnd}:ve,je(null),Ce(e=>!e)},ariaLabelledBy:Re,disabled:S}),
24
+ /* @__PURE__ */ae("span",{id:Re,className:"es-copy-marks-label",children:he.showMarks??"Show marks"})]}):null]})}var Ie=["none","bullet","number"],Pe=t,ze={none:/* @__PURE__ */ae(ke,{}),bullet:/* @__PURE__ */ae(be,{}),number:/* @__PURE__ */ae(ve,{})},Ue={none:/* @__PURE__ */ae(we,{}),upper:/* @__PURE__ */ae(Ee,{}),capitalize:/* @__PURE__ */ae(Se,{}),lower:/* @__PURE__ */ae(xe,{})};function qe({label:e,icon:t,answers:n,names:r,glyphs:l,row:o,readOnly:a}){const s=o.value||o.styleValue||"";/* @__PURE__ */
25
+ return ae(C,{label:e,icon:t,children:/* @__PURE__ */ae(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 Ae({kept:e,keptHint:t,readOnly:n=!1,style:r,font:l,italic:o,cells:a,align:s,list:c,letterCase:i}){const u=N("copy",x),d=L(R().textToolbar),p=Object.fromEntries(K(j).map(e=>[e.value,e.icon])),h={...x.panel,...u.panel},m=r&&!n?[r.onEditStyles&&{label:h.editStyles,onSelect:r.onEditStyles},r.onUpdateStyle&&{label:h.updateStyle,onSelect:r.onUpdateStyle}].filter(e=>!!e):[],f=!!o&&(o.value??o.styleValue??!1),g=o?/* @__PURE__ */ae(B,{content:h.italic,children:/* @__PURE__ */ae(F,{size:"md",variant:"ghost","aria-label":h.italic,"aria-pressed":f,disabled:n,onClick:()=>{if(n)return;const e=!f;o.onChange(e===(o.styleValue??!1)?void 0:e)},children:/* @__PURE__ */ae(ye,{})})}):null;/* @__PURE__ */
26
26
  return oe("div",{className:"es-tpp",children:[e?/* @__PURE__ */oe("div",{className:"es-tpp-kept",children:[
27
27
  /* @__PURE__ */ae($e,{...e,readOnly:n||e.readOnly}),t?/* @__PURE__ */ae("p",{className:"es-field-hint",children:t}):null]}):null,r?/* @__PURE__ */ae(C,{label:h.style,icon:/* @__PURE__ */ae(pe,{}),children:/* @__PURE__ */ae(E,{ariaLabel:h.style,value:r.value,options:r.options,onChange:r.onChange,changed:r.changed,footer:m,readOnly:n})}):null,l?/* @__PURE__ */ae(C,{label:h.font,icon:/* @__PURE__ */ae(he,{}),children:/* @__PURE__ */oe("div",{className:"es-tpp-font",children:[
28
28
  /* @__PURE__ */ae("div",{className:"es-tpp-font-select",children:/* @__PURE__ */ae(E,{ariaLabel:h.font,value:l.value||void 0,placeholder:l.styleValue,options:l.options,onChange:l.onChange,searchable:l.searchable,readOnly:n})}),g]})}):g?
29
- /* @__PURE__ */ae(C,{label:h.italic,icon:/* @__PURE__ */ae(he,{}),children:/* @__PURE__ */ae("div",{className:"es-tpp-font",children:g})}):null,a?.length?/* @__PURE__ */ae(He,{cells:a,words:u.cells,readOnly:n}):null,s?/* @__PURE__ */ae(Ae,{label:u.alignment,icon:/* @__PURE__ */ae(me,{}),answers:j.filter(e=>!s.allow||s.allow.includes(e)),names:d,glyphs:p,row:s,readOnly:n}):null,c?/* @__PURE__ */ae(Ae,{label:h.list,icon:/* @__PURE__ */ae(fe,{}),answers:Pe,names:h.lists,glyphs:Ie,row:c,readOnly:n}):null,i?/* @__PURE__ */ae(Ae,{label:h.capitalization,icon:/* @__PURE__ */ae(ge,{}),answers:ze,names:h.cases,glyphs:qe,row:i,readOnly:n}):null]})}export{Me as COPY_CELLS,$e as CopyBox,He as CopyCells,Fe as RichBox,Ue as TextPartPanel,Le as insertSelection,Oe as markSelection,Ve as useCaretEdit};
29
+ /* @__PURE__ */ae(C,{label:h.italic,icon:/* @__PURE__ */ae(he,{}),children:/* @__PURE__ */ae("div",{className:"es-tpp-font",children:g})}):null,a?.length?/* @__PURE__ */ae(He,{cells:a,words:u.cells,readOnly:n}):null,s?/* @__PURE__ */ae(qe,{label:u.alignment,icon:/* @__PURE__ */ae(me,{}),answers:j.filter(e=>!s.allow||s.allow.includes(e)),names:d,glyphs:p,row:s,readOnly:n}):null,c?/* @__PURE__ */ae(qe,{label:h.list,icon:/* @__PURE__ */ae(fe,{}),answers:Ie,names:h.lists,glyphs:ze,row:c,readOnly:n}):null,i?/* @__PURE__ */ae(qe,{label:h.capitalization,icon:/* @__PURE__ */ae(ge,{}),answers:Pe,names:h.cases,glyphs:Ue,row:i,readOnly:n}):null]})}export{Be as COPY_CELLS,$e as CopyBox,He as CopyCells,Me as RichBox,Ae as TextPartPanel,Le as insertSelection,Oe as markSelection,Ve as useCaretEdit};
@@ -1,6 +1,6 @@
1
1
  import { N as Node, D as Data, a as DataConfig, S as SlotAddress, F as Found, P as Place, b as SlotEntry, W as WalkInfo } from '../types-Dq180WRV.js';
2
2
  export { B as BlockShape, c as FieldShape, d as FieldsShape, e as NodeProps, R as RootData } from '../types-Dq180WRV.js';
3
- export { R as ResolvableItem, a as ResolveCache, b as ResolveOptions, c as ResolveTrigger, d as changedProps, e as createResolveCache, f as deepEqual, r as resolveNodeData } from '../resolve-Bz4mszpL.js';
3
+ export { P as PhoneOrder, R as ResolvableItem, a as ResolveCache, b as ResolveOptions, c as ResolveTrigger, d as carryPhoneOrder, e as changedProps, f as createResolveCache, g as deepEqual, i as isCustomPhoneOrder, m as movePhoneOrder, n as normalizePhoneOrder, r as resolveNodeData, s as settlePhoneOrder } from '../phone-order-CRKvsTsz.js';
4
4
 
5
5
  /**
6
6
  * Finding a node's slots, and reading or writing a value at a prop path.
@@ -215,6 +215,7 @@ declare function copyTranslation(overlay: TranslationOverlay | null | undefined,
215
215
  * normalizeData what the easel does to a document it opens
216
216
  * createNode · newId make a block the way the Add panel does
217
217
  * applyTranslation · … a page's other languages, kept beside it (./translate)
218
+ * normalizePhoneOrder · … the order children stack in on a phone (./phone-order)
218
219
  *
219
220
  * THE FORMAT DOES NOT CHANGE. A document goes in and comes out in exactly the
220
221
  * shape Puck 0.20 saves (see ./types). Four rules keep it that way, and the
@@ -1 +1 @@
1
- export{DataError,ROOT_ID,ROOT_LIST,ROOT_SLOT,applyTranslation,changedProps,clone,copyNode,copyTranslation,createNode,createResolveCache,deepEqual,duplicate,extractTranslation,find,getList,insert,mapIds,move,newId,normalizeData,parseZoneKey,pruneTranslation,rebaseTranslation,remove,replaceNode,resolveNodeData,setProps,setRoot,slotsOf,translatablePaths,translationFingerprint,translationStatus,walk,zoneKey}from"../chunk-EUFDQ4KL.js";export{getIn,isNode,isNodeList}from"../chunk-KXM6YRG2.js";
1
+ export{DataError,ROOT_ID,ROOT_LIST,ROOT_SLOT,applyTranslation,carryPhoneOrder,changedProps,clone,copyNode,copyTranslation,createNode,createResolveCache,deepEqual,duplicate,extractTranslation,find,getList,insert,isCustomPhoneOrder,mapIds,move,movePhoneOrder,newId,normalizeData,normalizePhoneOrder,parseZoneKey,pruneTranslation,rebaseTranslation,remove,replaceNode,resolveNodeData,setProps,setRoot,settlePhoneOrder,slotsOf,translatablePaths,translationFingerprint,translationStatus,walk,zoneKey}from"../chunk-YDTEYXQW.js";export{getIn,isNode,isNodeList}from"../chunk-KXM6YRG2.js";
@@ -1 +1 @@
1
- export{AddPanel,CanvasDragLayer,CanvasInsert,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,insertSeams,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-SQTVXE5D.js";import"../chunk-TQ5Y6S2X.js";export{AUTO_SCROLL_EDGE,AUTO_SCROLL_MAX_SPEED,autoScrollDelta,autoScrollSpeed,createDragSession,dropEffectFor,dropOnRow,frameScrollBox,gapToMoveIndex,isNoOpDrop,scrollBoxOf,scrollParent,startAutoScroll,stepGap,useTreeDrag}from"../chunk-3XECMGXX.js";import"../chunk-P2VEMZH5.js";import"../chunk-TOKMFZPB.js";import"../chunk-FR7EEKFF.js";import"../chunk-7UFKEX72.js";import"../chunk-EUFDQ4KL.js";import"../chunk-KXM6YRG2.js";
1
+ export{AddPanel,CanvasDragLayer,CanvasInsert,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,insertSeams,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-DQSRGKSM.js";import"../chunk-TQ5Y6S2X.js";export{AUTO_SCROLL_EDGE,AUTO_SCROLL_MAX_SPEED,autoScrollDelta,autoScrollSpeed,createDragSession,dropEffectFor,dropOnRow,frameScrollBox,gapToMoveIndex,isNoOpDrop,scrollBoxOf,scrollParent,startAutoScroll,stepGap,useTreeDrag}from"../chunk-QEEW4X64.js";import"../chunk-P2VEMZH5.js";import"../chunk-6GJEOER4.js";import"../chunk-FR7EEKFF.js";import"../chunk-7UFKEX72.js";import"../chunk-YDTEYXQW.js";import"../chunk-KXM6YRG2.js";
@@ -4,7 +4,7 @@ export { I as ItemSelector } from '../plan-D0DgSLnY.js';
4
4
  import { E as EaselConfig, a as EaselView, b as EaselAction, P as Permissions, c as EaselCore, d as EaselUi } from '../types-BljCVdzR.js';
5
5
  export { A as AppState, e as EaselHistory, H as HistoryEntry, S as SetDataPatch } from '../types-BljCVdzR.js';
6
6
  import { S as SlotAddress, D as Data, a as DataConfig, P as Place, N as Node } from '../types-Dq180WRV.js';
7
- import { c as ResolveTrigger, a as ResolveCache, R as ResolvableItem } from '../resolve-Bz4mszpL.js';
7
+ import { c as ResolveTrigger, a as ResolveCache, R as ResolvableItem } from '../phone-order-CRKvsTsz.js';
8
8
  import * as react from 'react';
9
9
  import { ReactNode, CSSProperties, ComponentType, ReactElement } from 'react';
10
10
  import { TextToolbarProps } from 'efficient-shell/ui';
@@ -1 +1 @@
1
- export{CHROME_ATTR,CanvasChromeContext,CanvasFrame,CanvasPartsContext,CanvasPassThroughContext,CanvasSharedContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,RootHostScope,bindUndoKeys,createEasel,createUseEasel,partHasOwnBox,recordsByDefault,reduce,subscribeLateWrites,uiView,useEasel,useEaselApi,useEaselNodeOps,useRootFields,useSelectedFields,useSelectedHost,useSettledAction,useSettledPress,validSelection,writesSettled}from"../chunk-3W2O22DZ.js";export{repeatCopyAt}from"../chunk-JQQFB7EZ.js";import"../chunk-TBY3DFKS.js";import"../chunk-K53PQAMP.js";import"../chunk-QTHQPJWA.js";import"../chunk-MNQDOSAX.js";import"../chunk-PMRN5Z3T.js";import"../chunk-MFIRYGHW.js";import"../chunk-TOKMFZPB.js";import"../chunk-FR7EEKFF.js";import"../chunk-7UFKEX72.js";import"../chunk-EUFDQ4KL.js";import"../chunk-KXM6YRG2.js";
1
+ export{CHROME_ATTR,CanvasChromeContext,CanvasFrame,CanvasPartsContext,CanvasPassThroughContext,CanvasSharedContext,DEFAULT_UI,EaselCanvas,EaselProvider,EditDocument,RootHostScope,bindUndoKeys,createEasel,createUseEasel,partHasOwnBox,recordsByDefault,reduce,subscribeLateWrites,uiView,useEasel,useEaselApi,useEaselNodeOps,useRootFields,useSelectedFields,useSelectedHost,useSettledAction,useSettledPress,validSelection,writesSettled}from"../chunk-HGTDDSFJ.js";export{repeatCopyAt}from"../chunk-LK56FUFT.js";import"../chunk-TBY3DFKS.js";import"../chunk-LDHUPZBK.js";import"../chunk-TF6NAIV7.js";import"../chunk-MNQDOSAX.js";import"../chunk-PMRN5Z3T.js";import"../chunk-MFIRYGHW.js";import"../chunk-6GJEOER4.js";import"../chunk-FR7EEKFF.js";import"../chunk-7UFKEX72.js";import"../chunk-YDTEYXQW.js";import"../chunk-KXM6YRG2.js";
@@ -1 +1 @@
1
- export{CLAIM_FAIL_OPEN_MS,EDIT_LOCK_TAKEN,FAIL_OPEN_RETRY_MS,accessForNewDocument,canWriteDocument,createEditLock,describeAge,documentPermissions,documentVersionMoved,holderOf,nameOrSomeone,newEaselClientId,openUnansweredClaim,readLockHolder,reloadIfVersionMoved,shouldReleaseHeldWrite,shouldReloadAfterTakeover}from"../chunk-YYD257TD.js";import"../chunk-RE4LP46F.js";import"../chunk-EUFDQ4KL.js";import"../chunk-KXM6YRG2.js";
1
+ export{CLAIM_FAIL_OPEN_MS,EDIT_LOCK_TAKEN,FAIL_OPEN_RETRY_MS,accessForNewDocument,canWriteDocument,createEditLock,describeAge,documentPermissions,documentVersionMoved,holderOf,nameOrSomeone,newEaselClientId,openUnansweredClaim,readLockHolder,reloadIfVersionMoved,shouldReleaseHeldWrite,shouldReloadAfterTakeover}from"../chunk-G7J6SGMF.js";import"../chunk-RE4LP46F.js";import"../chunk-YDTEYXQW.js";import"../chunk-KXM6YRG2.js";
@@ -173,3 +173,11 @@ span:has(> .es-fnum) { display: flex; min-width: 0; }
173
173
 
174
174
  /* Read out after a move; never seen. */
175
175
  .es-list-said { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
176
+
177
+ /* PhoneOrderField: the fixed list, a note and the reset, 8px apart (the list's step). */
178
+ .es-phone-order { display: flex; flex-direction: column; flex: 1 1 auto; gap: 8px; min-width: 0; }
179
+ .es-phone-order > .es-list { margin-top: 0; }
180
+ .es-phone-order-row { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--text-xs, 12px); }
181
+ .es-phone-order-pos { flex: none; width: 16px; text-align: right; font-size: var(--text-2xs, 11px); font-weight: 500; font-variant-numeric: tabular-nums; color: var(--es-muted); }
182
+ .es-phone-order-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--es-text); }
183
+ .es-phone-order-note { margin: 0; font-size: var(--text-xs, 12px); line-height: 1.5; color: var(--es-muted); }
@@ -6,8 +6,8 @@ import { ShowWhenContext } from 'efficient-shell/format';
6
6
  export { ShowWhenContext, ShowWhenRule, showWhenOf, withShowWhen } from 'efficient-shell/format';
7
7
  import { a as InspectorFieldDef, b as FieldRenderer, I as InspectorFields, c as FieldTextProps, d as FieldNumberProps, e as FieldSliderProps, f as FieldSelectManyProps, g as FieldSelectOneProps, F as FieldOption } from '../types-DcyH17ij.js';
8
8
  export { A as ArrayFieldDef, C as CustomFieldDef, h as CustomFieldRenderProps, i as FieldSelectProps, N as NumberFieldDef, O as ObjectFieldDef, R as RadioFieldDef, S as SelectFieldDef, j as SlotFieldDef, T as TextFieldDef, k as TextareaFieldDef } from '../types-DcyH17ij.js';
9
- import { R as ResolvableItem } from '../resolve-Bz4mszpL.js';
10
- export { F as FieldsWords } from '../words-CFkb8XtN.js';
9
+ import { R as ResolvableItem, P as PhoneOrder } from '../phone-order-CRKvsTsz.js';
10
+ export { F as FieldsWords } from '../words-dNm6REMa.js';
11
11
  export { LinkFilter, LinkFilterField, LinkKindChoice, LinkOption, LinkOptionGroup, LinkPicker, LinkPickerProps, LinkRules, LinkTarget } from 'efficient-shell/ui';
12
12
  import '../types-Dq180WRV.js';
13
13
 
@@ -474,6 +474,50 @@ declare function moveTo<T>(items: readonly T[], from: number, to: number): T[];
474
474
  declare function removeAt<T>(items: readonly T[], index: number): T[];
475
475
  declare function ListField<T>({ label, icon, noun: ownNoun, items, onChange, newItem, summary, itemName, thumb, min, max, readOnly, open, onOpen, renderItem, renderRow, canRemove: removable, lockedReason, fixed, removeOnRow, canDuplicate, above, head, }: ListFieldProps<T>): react.JSX.Element;
476
476
 
477
+ /**
478
+ * "Phone order" — the control that reorders a parent's children for the PHONE
479
+ * STACK ONLY, leaving the desktop layout exactly where it is. Drawn once for
480
+ * both editors (the email section's columns, the website Box's children); the
481
+ * rule it writes through is `efficient-easel/data`'s phone order.
482
+ *
483
+ * WHY A LIST AND NOT A CANVAS DRAG. Children laid out side by side on desktop
484
+ * and stacked on a phone give a drag on the canvas two orders it could belong
485
+ * to the moment the two differ. This row is the unambiguous statement of the
486
+ * same fact: a labelled list, in phone order, that says which child stacks
487
+ * where.
488
+ *
489
+ * WHAT IT MUST NEVER LOOK LIKE is a desktop reorder. Everything is named for
490
+ * the phone (the name, the note, the reset), and the note states the
491
+ * guarantee outright ("Your desktop layout doesn't change"), since the surest
492
+ * way to stop someone worrying about that is to answer it before they ask.
493
+ * A host's own limits (the email's mail-client note) are its `children`,
494
+ * drawn under the list once an order is set.
495
+ *
496
+ * EMPTY STATE IS THE DEFAULT: until someone moves something, the list shows
497
+ * the desktop order and stores nothing. Every write goes through
498
+ * `settlePhoneOrder`, so an order put back to the desktop one is CLEARED, not
499
+ * stored. Below two children there is no order to speak of, and the row draws
500
+ * nothing at all: no name over an empty control.
501
+ */
502
+ interface PhoneOrderFieldProps {
503
+ /** The stored order (desktop positions, phone first), or undefined = follow desktop. */
504
+ value: PhoneOrder | undefined;
505
+ /** How many children the parent lays out now: the list follows it at once. */
506
+ count: number;
507
+ /** The new order, or undefined = follow desktop again. */
508
+ onChange: (next: PhoneOrder | undefined) => void;
509
+ readOnly?: boolean;
510
+ /** One child's word, lower case: "column", "block". */
511
+ noun: string;
512
+ /** A child's name by its DESKTOP position: "Column 2", "Heading". */
513
+ itemLabel: (position: number) => string;
514
+ /** The row's hint; default "The order the <noun>s stack in on a phone." */
515
+ hint?: ReactNode;
516
+ /** The host's extra lines under the list, drawn once an order is set. */
517
+ children?: ReactNode;
518
+ }
519
+ declare function PhoneOrderField({ value, count, onChange, readOnly, noun, itemLabel, hint, children, }: PhoneOrderFieldProps): react.JSX.Element | null;
520
+
477
521
  /**
478
522
  * A text value, one line or several (blueprint step 4.1, "native inputs become
479
523
  * shell controls"): the shell's `Input` / `Textarea` (harness UI-24,
@@ -586,4 +630,4 @@ declare function optionFor<V>(options: readonly FieldOption<V>[], value: V | und
586
630
  declare function FieldSelect<V>(props: FieldSelectManyProps<V>): ReactNode;
587
631
  declare function FieldSelect<V>(props: FieldSelectOneProps<V>): ReactNode;
588
632
 
589
- export { FieldNumber, FieldNumberProps, FieldOption, type FieldPlan, FieldRenderer, FieldSelect, FieldSelectManyProps, FieldSelectOneProps, FieldSlider, FieldSliderProps, FieldText, FieldTextProps, type FieldsBlock, Inspector, InspectorField, InspectorFieldDef, type InspectorFieldProps, InspectorFields, type InspectorProps, ListField, type ListFieldProps, type PlannedFold, type PlannedRow, type ResolvedFieldsInput, type RowShownInView, SettingsBucket, type ShowWhenInput, bucketsOf, fieldIsShown, fieldShownInView, innerRowCount, insertAt, labelOf, moveTo, optionFor, planFields, removeAt, rowViewState, shownFields, useResolvedFields, viewReadsIn };
633
+ export { FieldNumber, FieldNumberProps, FieldOption, type FieldPlan, FieldRenderer, FieldSelect, FieldSelectManyProps, FieldSelectOneProps, FieldSlider, FieldSliderProps, FieldText, FieldTextProps, type FieldsBlock, Inspector, InspectorField, InspectorFieldDef, type InspectorFieldProps, InspectorFields, type InspectorProps, ListField, type ListFieldProps, PhoneOrderField, type PhoneOrderFieldProps, type PlannedFold, type PlannedRow, type ResolvedFieldsInput, type RowShownInView, SettingsBucket, type ShowWhenInput, bucketsOf, fieldIsShown, fieldShownInView, innerRowCount, insertAt, labelOf, moveTo, optionFor, planFields, removeAt, rowViewState, shownFields, useResolvedFields, viewReadsIn };
@@ -1 +1 @@
1
- export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,fieldShownInView,innerRowCount,insertAt,labelOf,moveTo,planFields,removeAt,rowViewState,viewReadsIn}from"../chunk-HG65R6IN.js";export{fieldIsShown,showWhenOf,shownFields,withShowWhen}from"../chunk-BPXEFVSQ.js";import"../chunk-YCSZAP7T.js";export{FieldSlider}from"../chunk-TDEBPOWV.js";import"../chunk-WHS6Y55E.js";import"../chunk-D4TH4QQR.js";import"../chunk-K56YDHYQ.js";import"../chunk-56ID6FKZ.js";export{useResolvedFields}from"../chunk-K53PQAMP.js";import"../chunk-FIVU2COQ.js";export{FieldNumber}from"../chunk-Y2T3JX7K.js";export{FieldSelect,optionFor}from"../chunk-KFWNGPW3.js";import"../chunk-DX3VILZ3.js";import"../chunk-MIX7EGRG.js";import"../chunk-JACEEVVF.js";import"../chunk-MFIRYGHW.js";import"../chunk-3XECMGXX.js";import"../chunk-P2VEMZH5.js";import"../chunk-EUFDQ4KL.js";import"../chunk-KXM6YRG2.js";
1
+ export{FieldText,Inspector,InspectorField,LinkPicker,ListField,PhoneOrderField,bucketsOf,fieldShownInView,innerRowCount,insertAt,labelOf,moveTo,planFields,removeAt,rowViewState,viewReadsIn}from"../chunk-SDSBXW3V.js";export{fieldIsShown,showWhenOf,shownFields,withShowWhen}from"../chunk-BPXEFVSQ.js";import"../chunk-YCSZAP7T.js";export{FieldSlider}from"../chunk-TDEBPOWV.js";import"../chunk-WHS6Y55E.js";import"../chunk-D4TH4QQR.js";import"../chunk-K56YDHYQ.js";import"../chunk-56ID6FKZ.js";export{useResolvedFields}from"../chunk-LDHUPZBK.js";import"../chunk-FIVU2COQ.js";export{FieldNumber}from"../chunk-ANBPE45L.js";export{FieldSelect,optionFor}from"../chunk-C63IB4VW.js";import"../chunk-DX3VILZ3.js";import"../chunk-MIX7EGRG.js";import"../chunk-UMTUKSE6.js";import"../chunk-MFIRYGHW.js";import"../chunk-QEEW4X64.js";import"../chunk-P2VEMZH5.js";import"../chunk-YDTEYXQW.js";import"../chunk-KXM6YRG2.js";
@@ -1 +1 @@
1
- export{createNodeClipboard,nodeMenuItems}from"../chunk-P5VYGWYO.js";import"../chunk-WK3AFPXY.js";export{canStep,clickPick,clickPickPart,fromItemSelector,nextInChain,nodeChain,parentStep,planDuplicate,planMove,planPaste,planRemove,planRestore,planSetProps,planStep,planSwap,toItemSelector,useNodeOps}from"../chunk-QTHQPJWA.js";import"../chunk-EUFDQ4KL.js";import"../chunk-KXM6YRG2.js";
1
+ export{createNodeClipboard,nodeMenuItems}from"../chunk-P5VYGWYO.js";import"../chunk-WK3AFPXY.js";export{canStep,clickPick,clickPickPart,fromItemSelector,nextInChain,nodeChain,parentStep,planDuplicate,planMove,planPaste,planRemove,planRestore,planSetProps,planStep,planSwap,toItemSelector,useNodeOps}from"../chunk-TF6NAIV7.js";import"../chunk-YDTEYXQW.js";import"../chunk-KXM6YRG2.js";