efficient-easel 25.1.0 → 26.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 (86) hide show
  1. package/README.md +3 -4
  2. package/dist/chunk-2S7PJZWH.js +1 -0
  3. package/dist/chunk-2T22IY3J.js +2 -0
  4. package/dist/chunk-4FFDGEWA.js +1 -0
  5. package/dist/{chunk-BBD3FLU3.js → chunk-53ME3GAI.js} +14 -14
  6. package/dist/{chunk-KFV7N2DJ.js → chunk-56ID6FKZ.js} +1 -1
  7. package/dist/{chunk-OXOUGEAT.js → chunk-7GGNFLHT.js} +1 -1
  8. package/dist/chunk-BYONFJVQ.js +2 -0
  9. package/dist/chunk-CLAADE4J.js +14 -0
  10. package/dist/{chunk-FEP6XMNX.js → chunk-CP6KQP5A.js} +1 -1
  11. package/dist/chunk-FIH23CB7.js +1 -0
  12. package/dist/chunk-FT3O7X6U.js +5 -0
  13. package/dist/{chunk-UCZQWQNS.js → chunk-FYV6GZXP.js} +1 -1
  14. package/dist/{chunk-6WTWYHC2.js → chunk-I3KB7LH7.js} +4 -4
  15. package/dist/{chunk-IW5QXREH.js → chunk-IHXQZDDW.js} +39 -39
  16. package/dist/chunk-JYVQ62TL.js +1 -0
  17. package/dist/{chunk-XLC7HWW3.js → chunk-LDXYMHYW.js} +1 -1
  18. package/dist/chunk-LUG22U5L.js +1 -0
  19. package/dist/chunk-M5IKANJ5.js +13 -0
  20. package/dist/{chunk-SQTVXE5D.js → chunk-MBEUSPIN.js} +4 -4
  21. package/dist/{chunk-S6YOIRXQ.js → chunk-Q3VAJMXS.js} +1 -1
  22. package/dist/{chunk-U3LTJSBU.js → chunk-R76XMEKT.js} +11 -11
  23. package/dist/{chunk-62UGN7VM.js → chunk-TOEJCZUO.js} +1 -1
  24. package/dist/{chunk-ITIVCER6.js → chunk-WQXAAVCE.js} +1 -1
  25. package/dist/chunk-X3EMJ2EX.js +1 -0
  26. package/dist/{chunk-KF3LT7J2.js → chunk-YDJZX2XS.js} +1 -1
  27. package/dist/{chunk-XTDOSL2M.js → chunk-ZIEINXSZ.js} +6 -6
  28. package/dist/chunk-ZJRMB5KN.js +4 -0
  29. package/dist/drag/index.js +1 -1
  30. package/dist/draw/index.d.ts +1 -0
  31. package/dist/draw/index.js +1 -1
  32. package/dist/easel/index.js +1 -1
  33. package/dist/fields/index.js +1 -1
  34. package/dist/panel/index.d.ts +63 -2
  35. package/dist/panel/index.js +1 -1
  36. package/dist/panel/panel.css +46 -0
  37. package/dist/pick/index.d.ts +16 -195
  38. package/dist/pick/index.js +1 -1
  39. package/dist/pick/pick.css +6 -196
  40. package/dist/screen/components/AddBlockRow.js +1 -1
  41. package/dist/screen/components/AddSidePanel.js +1 -1
  42. package/dist/screen/components/NodeContextMenu.js +1 -1
  43. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  44. package/dist/screen/components/ScreenChrome.js +1 -1
  45. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  46. package/dist/screen/components/ScreenMount.js +1 -1
  47. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  48. package/dist/screen/components/SectionScreenShell.js +17 -17
  49. package/dist/screen/components/usePartBridge.js +1 -1
  50. package/dist/screen/index.js +1 -1
  51. package/dist/screen/lib/content/block-size.d.ts +74 -0
  52. package/dist/screen/lib/content/block-size.js +1 -0
  53. package/dist/screen/lib/document/block-set-host.js +1 -1
  54. package/dist/screen/lib/document/block-size-fields.d.ts +48 -0
  55. package/dist/screen/lib/document/block-size-fields.js +1 -0
  56. package/dist/screen/lib/document/box-fields.d.ts +58 -10
  57. package/dist/screen/lib/document/box-fields.js +1 -1
  58. package/dist/screen/lib/document/button-fields.d.ts +97 -0
  59. package/dist/screen/lib/document/button-fields.js +1 -0
  60. package/dist/screen/lib/document/device-fields.js +1 -1
  61. package/dist/screen/lib/document/image-fields.d.ts +118 -0
  62. package/dist/screen/lib/document/image-fields.js +5 -0
  63. package/dist/screen/lib/document/style-clipboard.js +1 -1
  64. package/dist/screen/lib/document/style-fields.d.ts +109 -0
  65. package/dist/screen/lib/document/style-fields.js +1 -0
  66. package/dist/screen/lib/document/use-section-ops.js +1 -1
  67. package/dist/screen/lib/key-scope.js +1 -1
  68. package/dist/screen/lib/screen-parts.js +1 -1
  69. package/dist/screen/words.d.ts +22 -1
  70. package/dist/screen/words.js +1 -1
  71. package/dist/strings/index.d.ts +12 -9
  72. package/dist/strings/index.js +2 -2
  73. package/dist/text-styles/index.d.ts +3 -3
  74. package/dist/text-styles/index.js +37 -37
  75. package/dist/{words-fbR9IwxH.d.ts → words-BrN08Fup.d.ts} +16 -1
  76. package/package.json +31 -1
  77. package/dist/chunk-ERB6FAZT.js +0 -2
  78. package/dist/chunk-H6BER2EU.js +0 -1
  79. package/dist/chunk-JQQFB7EZ.js +0 -1
  80. package/dist/chunk-KVIEUWTX.js +0 -11
  81. package/dist/chunk-LUHGBFOD.js +0 -5
  82. package/dist/chunk-OFBZOI6W.js +0 -1
  83. package/dist/chunk-SC6E3UUS.js +0 -13
  84. package/dist/chunk-U6LJ5UKD.js +0 -6
  85. package/dist/chunk-UDWXBS46.js +0 -1
  86. package/dist/words-DWvCJXwR.d.ts +0 -51
@@ -1,64 +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-H6BER2EU.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-LUOY3A3Q.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-UCZQWQNS.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as h,clampPanelWidth as m}from"./chunk-6EDVZBUO.js";import{usePartBridge as g}from"./chunk-UDWXBS46.js";import{useSectionOps as y}from"./chunk-XLC7HWW3.js";import{PageEditGuardNotices as v}from"./chunk-62UGN7VM.js";import{ScreenSaveIcon as b,ScreenMainButton as k}from"./chunk-PVBDKBJB.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{useScreenDocument as w}from"./chunk-ERB6FAZT.js";import{requestMediaPick as x}from"./chunk-JIP5JNRB.js";import{AddChildRow as z}from"./chunk-5545A3PC.js";import{AddSidePanel as C}from"./chunk-XTDOSL2M.js";import{keepsSharedSections as B,sharedSectionsOf as N}from"./chunk-N3MJOHAG.js";import{PanelHideButton as O,SidePanelHead as I,PanelShowStrip as P}from"./chunk-SBVIW3KJ.js";import{offeredChoices as $}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as T,useScreenNodeKeys as M,useScreenPinned as j,useScreenDocumentLabel as E,useScreenCanvasFrame as L,useScreenInspectorPanel as A,useScreenDevices as R,useScreenPickFollowsSelection as F,useScreenLeftView as D,SELECTION_MODE as V,isSelectionMode as W,sameInspectorMode as H,useScreenBridges as U,useScreenBlockRules as X,useScreenBlockLook as Y,useScreenStorageNamespace as J,useScreenNotify as Q,useScreenCanvasHead as G,isSlotMode as K,useScreenStyleClipboard as Z,useScreenDocumentPass as _,useScreenCanvasDrag as q,ScreenCanvasTargetProvider as ee,isPinnedFirst as ne,isPinnedLast as te,screenSlotsOf as oe,shownChildSlotsOf as re}from"./chunk-LUHGBFOD.js";import{MediaPopup as ie}from"./chunk-T2RINM7R.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-NCXYC7WI.js";import{useNodeClipboard as pe,useNodeContextMenu as ue}from"./chunk-FEP6XMNX.js";import{useEaselSession as fe}from"./chunk-YM4UEGBV.js";import{useEaselHost as he,useHostEscape as me}from"./chunk-LX23TCTP.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-S6YOIRXQ.js";import{heldStyle as be,styleShortcut as ke}from"./chunk-CWELHADJ.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{rootRowName as we,slotChildRowName as xe,slotChildRenameProp as ze,sectionRenameProp as Ce}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Be,blockNodeActions as Ne,TREE_MAX_DEPTH as Oe,childSlotsOf as Ie,slotFieldsOf as Pe,newNodeId as $e,slotChildrenIn as Te,nestsInTree as Me}from"./chunk-TCAAOYQY.js";import{useEasel as je,useEaselApi as Ee,CanvasPartsContext as Le,partHasOwnBox as Ae,CanvasPassThroughContext as Re,CanvasSharedContext as Fe}from"./chunk-BBD3FLU3.js";import{TreeRow as De,Subtree as Ve,LayersTree as We,TreeGroupLabel as He,TreeRowAction as Ue,TreeSeam as Xe}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Ye}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Je}from"./chunk-WK3AFPXY.js";import{toItemSelector as Qe,useNodeOps as Ge,clickPick as Ke}from"./chunk-QTHQPJWA.js";import{EaselTopBar as Ze,EaselIconButton as _e,TopBarCluster as qe,DeviceSwitch as en,InspectorIconButton as nn,PanelResizeHandle as tn,MAX_PANEL_W as on,MIN_PANEL_W_BY_SIDE as rn,panelWidthVars as ln}from"./chunk-VBEVZZTV.js";import{DEFAULT_NOTICE_WORDS as sn,DEFAULT_CHROME_WORDS as dn}from"./chunk-AJSDWWJW.js";import{holderOf as an,nameOrSomeone as cn}from"./chunk-YYD257TD.js";import{DEFAULT_LOCK_WORDS as pn}from"./chunk-RE4LP46F.js";import{useWords as un}from"./chunk-MFIRYGHW.js";import{insertSeams as fn,CanvasDragLayer as hn,CanvasInsert as mn}from"./chunk-SQTVXE5D.js";import{DEFAULT_DRAG_WORDS as gn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as yn,useTreeDrag as vn,gapToMoveIndex as bn}from"./chunk-3XECMGXX.js";import{useCanvasFrame as kn,LIST_SELECTOR as Sn,BLOCK_SELECTOR as wn,useCanvasTyping as xn,useCanvasEvent as zn}from"./chunk-TOKMFZPB.js";import{nodeIdAt as Cn,frameRectToHost as Bn,BLOCK_ATTRIBUTE as Nn,drawnBox as On}from"./chunk-FR7EEKFF.js";import{queryMainCopy as In}from"./chunk-7UFKEX72.js";import{ROOT_ID as Pn,ROOT_SLOT as $n,zoneKey as Tn,parseZoneKey as Mn,find as jn,DataError as En}from"./chunk-EUFDQ4KL.js";import{useRef as Ln,useMemo as An,useState as Rn,useEffect as Fn,useCallback as Dn,useLayoutEffect as Vn,useContext as Wn,Fragment as Hn,useId as Un}from"react";import{ColoredBadge as Xn,Button as Yn,Tabs as Jn,toast as Qn,readMediaFileDrag as Gn,Tooltip as Kn,groupColors as Zn,Dialog as _n,FormField as qn,Input as et,MEDIA_FILE_DRAG_TYPE as nt}from"efficient-shell/ui";import{UndoIcon as tt,RedoIcon as ot,RefreshIcon as rt,AddIcon as it,TrashIcon as lt,EyeOffIcon as st,EyeIcon as dt,SharedIcon as at,DuplicateIcon as ct}from"efficient-shell/icons/efficient";import{jsx as pt,jsxs as ut,Fragment as ft}from"react/jsx-runtime";var ht="media-file";function mt({name:e,onMake:n,onCancel:t}){const o=un("screen",ve).shared,[r,i]=Rn(e),[l,s]=Rn(!1),d=Un(),a=Ln(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
1
+ import{dedupeSlotChildren as e}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as n}from"./chunk-JYVQ62TL.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-UMBNBCL4.js";import{cloneNodeWithFreshIds as i}from"./chunk-OXZDSOZV.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-LUOY3A3Q.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-FYV6GZXP.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as h,clampPanelWidth as m}from"./chunk-6EDVZBUO.js";import{usePartBridge as g}from"./chunk-2S7PJZWH.js";import{useSectionOps as y}from"./chunk-LDXYMHYW.js";import{PageEditGuardNotices as v}from"./chunk-TOEJCZUO.js";import{ScreenSaveIcon as b,ScreenMainButton as k}from"./chunk-PVBDKBJB.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{useScreenDocument as w}from"./chunk-BYONFJVQ.js";import{requestMediaPick as x}from"./chunk-JIP5JNRB.js";import{AddChildRow as z}from"./chunk-5545A3PC.js";import{AddSidePanel as C}from"./chunk-ZIEINXSZ.js";import{keepsSharedSections as O,sharedSectionsOf as N}from"./chunk-N3MJOHAG.js";import{PanelHideButton as I,SidePanelHead as B,PanelShowStrip as P}from"./chunk-SBVIW3KJ.js";import{offeredChoices as $}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as M,useScreenNodeKeys as T,useScreenPinned as j,useScreenDocumentLabel as E,useScreenCanvasFrame as A,useScreenInspectorPanel as L,useScreenDevices as R,useScreenPickFollowsSelection as F,useScreenLeftView as D,SELECTION_MODE as V,isSelectionMode as W,sameInspectorMode as H,useScreenBridges as U,useScreenBlockRules as Y,useScreenBlockLook as J,useScreenStorageNamespace as X,useScreenNotify as Q,useScreenCanvasHead as Z,isSlotMode as K,useScreenStyleClipboard as G,useScreenDocumentPass as _,useScreenCanvasDrag as q,ScreenCanvasTargetProvider as ee,isPinnedFirst as ne,isPinnedLast as te,screenSlotsOf as oe,shownChildSlotsOf as re}from"./chunk-FT3O7X6U.js";import{MediaPopup as ie}from"./chunk-T2RINM7R.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-NCXYC7WI.js";import{useNodeClipboard as pe,useNodeContextMenu as ue}from"./chunk-CP6KQP5A.js";import{useEaselSession as fe}from"./chunk-YM4UEGBV.js";import{useEaselHost as he,useHostEscape as me}from"./chunk-LX23TCTP.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-Q3VAJMXS.js";import{heldStyle as be,styleShortcut as ke}from"./chunk-CWELHADJ.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{rootRowName as we,slotChildRowName as xe,slotChildRenameProp as ze,sectionRenameProp as Ce}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Oe,blockNodeActions as Ne,TREE_MAX_DEPTH as Ie,childSlotsOf as Be,slotFieldsOf as Pe,newNodeId as $e,slotChildrenIn as Me,nestsInTree as Te}from"./chunk-TCAAOYQY.js";import{useEasel as je,useEaselApi as Ee,CanvasPartsContext as Ae,partHasOwnBox as Le,CanvasPassThroughContext as Re,CanvasSharedContext as Fe}from"./chunk-53ME3GAI.js";import{TreeRow as De,Subtree as Ve,LayersTree as We,TreeGroupLabel as He,TreeRowAction as Ue,TreeSeam as Ye}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Je}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Xe}from"./chunk-WK3AFPXY.js";import{toItemSelector as Qe,useNodeOps as Ze,clickPick as Ke}from"./chunk-QTHQPJWA.js";import{EaselTopBar as Ge,EaselIconButton as _e,TopBarCluster as qe,DeviceSwitch as en,InspectorIconButton as nn,PanelResizeHandle as tn,MAX_PANEL_W as on,MIN_PANEL_W_BY_SIDE as rn,panelWidthVars as ln}from"./chunk-VBEVZZTV.js";import{DEFAULT_NOTICE_WORDS as sn,DEFAULT_CHROME_WORDS as dn}from"./chunk-AJSDWWJW.js";import{holderOf as an,nameOrSomeone as cn}from"./chunk-YYD257TD.js";import{DEFAULT_LOCK_WORDS as pn}from"./chunk-RE4LP46F.js";import{useWords as un}from"./chunk-MFIRYGHW.js";import{insertSeams as fn,CanvasDragLayer as hn,CanvasInsert as mn}from"./chunk-MBEUSPIN.js";import{DEFAULT_DRAG_WORDS as gn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as yn,useTreeDrag as vn,gapToMoveIndex as bn}from"./chunk-3XECMGXX.js";import{ROOT_ID as kn,ROOT_SLOT as Sn,zoneKey as wn,parseZoneKey as xn,find as zn,DataError as Cn}from"./chunk-EUFDQ4KL.js";import{useCanvasFrame as On,LIST_SELECTOR as Nn,BLOCK_SELECTOR as In,useCanvasTyping as Bn,useCanvasEvent as Pn}from"./chunk-TOKMFZPB.js";import{nodeIdAt as $n,frameRectToHost as Mn,BLOCK_ATTRIBUTE as Tn,drawnBox as jn}from"./chunk-FR7EEKFF.js";import{queryMainCopy as En}from"./chunk-7UFKEX72.js";import{useRef as An,useMemo as Ln,useState as Rn,useEffect as Fn,useCallback as Dn,useLayoutEffect as Vn,useContext as Wn,Fragment as Hn,useId as Un}from"react";import{ColoredBadge as Yn,Button as Jn,Tabs as Xn,toast as Qn,readMediaFileDrag as Zn,Tooltip as Kn,groupColors as Gn,Dialog as _n,FormField as qn,Input as et,MEDIA_FILE_DRAG_TYPE as nt}from"efficient-shell/ui";import{UndoIcon as tt,RedoIcon as ot,RefreshIcon as rt,AddIcon as it,TrashIcon as lt,EyeOffIcon as st,EyeIcon as dt,SharedIcon as at,DuplicateIcon as ct}from"efficient-shell/icons/efficient";import{jsx as pt,jsxs as ut,Fragment as ft}from"react/jsx-runtime";var ht="media-file";function mt({name:e,onMake:n,onCancel:t}){const o=un("screen",ve).shared,[r,i]=Rn(e),[l,s]=Rn(!1),d=Un(),a=An(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
2
2
  return pt(_n,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */ut(ft,{children:[
3
- /* @__PURE__ */pt(Yn,{variant:"secondary",onClick:t,children:o.cancel}),
4
- /* @__PURE__ */pt(Yn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */pt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */pt(qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */pt(et,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var gt=/* @__PURE__ */new WeakSet;function yt(e,n,t){const o=jn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function vt({canvas:e,tabs:n,onSelect:t}){const o=Ln(null),[r,i]=Rn({}),l=n.map(e=>`${e.id}:${e.below?1:e.above?2:0}`).join("|");return Vn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=Bn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=In(t,`[${Nn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?On(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=Bn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=!0===o.above&&s.top-4>d.top,u=o.below?c+4:p?s.top-4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+(o.above?0:6),top:u,above:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */pt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */pt("span",{className:"es-band-tab"+(n.above?" is-above":""),"data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
5
- /* @__PURE__ */pt(Kn,{content:e.reach,children:/* @__PURE__ */ut(Xn,{colorClass:Zn("success","solid"),size:"sm",children:[
6
- /* @__PURE__ */pt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */pt(at,{size:12})}),e.label]})}):/* @__PURE__ */pt(Xn,{colorClass:Zn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function bt({expand:e}){/* @__PURE__ */
3
+ /* @__PURE__ */pt(Jn,{variant:"secondary",onClick:t,children:o.cancel}),
4
+ /* @__PURE__ */pt(Jn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */pt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */pt(qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */pt(et,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var gt=/* @__PURE__ */new WeakSet;function yt(e,n,t){const o=zn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function vt({canvas:e,tabs:n,onSelect:t}){const o=An(null),[r,i]=Rn({}),l=n.map(e=>`${e.id}:${e.below?1:e.above?2:0}`).join("|");return Vn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=Mn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=En(t,`[${Tn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?jn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=Mn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=!0===o.above&&s.top-4>d.top,u=o.below?c+4:p?s.top-4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+(o.above?0:6),top:u,above:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */pt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */pt("span",{className:"es-band-tab"+(n.above?" is-above":""),"data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
5
+ /* @__PURE__ */pt(Kn,{content:e.reach,children:/* @__PURE__ */ut(Yn,{colorClass:Gn("success","solid"),size:"sm",children:[
6
+ /* @__PURE__ */pt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */pt(at,{size:12})}),e.label]})}):/* @__PURE__ */pt(Yn,{colorClass:Gn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function bt({expand:e}){/* @__PURE__ */
7
7
  return pt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */ut(ft,e?{children:[
8
8
  /* @__PURE__ */pt("path",{d:"M8 9l4-4 4 4"}),
9
9
  /* @__PURE__ */pt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
10
10
  /* @__PURE__ */pt("path",{d:"M8 4l4 4 4-4"}),
11
11
  /* @__PURE__ */pt("path",{d:"M8 20l4-4 4 4"}),
12
- /* @__PURE__ */pt("path",{d:"M5 12h14"})]})})}var kt=`${Sn}, ${wn}`;function St(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 wt="__rungs",xt=e=>"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:"preset"===e.kind?e.preset.key:e.type;var zt="screen:band",Ct={duplicate:!0,delete:!0},Bt=()=>null;function Nt(){const Sn=he(),Bn=Sn.panels?.Toolbar,Nn=(Sn.panels?.useRight??Bt)(),{target:On,docId:Un,capabilities:Kn,currentSlug:Zn,siteId:_n,onPublish:qn,saveState:et,saveConflict:at,retrySave:Nt,toggleAutoSave:Ot,flushSave:It,access:Pt,saveUnreachable:$t=!1,readOnly:Tt,readOnlyReason:Mt=null}=w(),jt=T(),Et=M(),{mediaEditing:Lt,hasEditGuard:At,hasPinnedChrome:Rt}=Kn,{appState:Ft,dispatch:Dt,history:Vt,selectedItem:Wt,getSelectorForId:Ht,config:Ut}=je(e=>e),Xt=j(),{first:Yt,firstGroup:Jt,lastGroup:Qt,isSectionGroup:Gt,sectionGroupZone:Kt,panelOf:Zt}=Xt,_t=Zt(Yt),qt=e=>ne(Xt,e),eo=e=>te(Xt,e),no="node"===Xt.firstRow,to=Xt.band??null,oo=un("screen",ve),ro=un("tree",Ye),io=un("drag",gn),lo=un("notice",sn),so=un("lock",pn),ao=un("menu",Je),co=un("styleClipboard",Se),po=un("chrome",dn),uo=E()??`/${Zn}`,fo=L(),ho=A(),mo=y({readOnly:Tt}),go=y({readOnly:Tt,foldIntoHistory:!0}),yo=Ln(null),vo=Ee(),bo=An(()=>({...mo,select:e=>{yo.current=e,mo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=vo.config;yo.current=Qe(e,t,n)}mo.commitDocument(e,n)}}),[mo,vo]),ko=Ft.ui,So=ko.leftSideBarVisible,wo=ko.rightSideBarVisible,{options:xo,widths:zo,initial:Co,fluid:Bo,fit:No}=R(),[Oo,Io]=Rn(Co),Po=le(),$o=Lt&&null!==Po;se(),de();const To=ae();F(Wt?.props.id);const{read:Mo,write:jo,forSelection:Eo}=D(),[Lo,Ao]=Rn(Mo);Fn(()=>{jo(Lo)},[Lo]);const[Ro,Fo]=Rn(0),Do=Ln(null),Vo=Ln(null),Wo=kn(Vo,{readySelector:kt}),Ho=xn(Wo),Uo=d(Vo);a(Vo,Wo);const Xo=S(),Yo=an(Pt),Jo={state:et,offline:Xo||et.failed&&$t,readOnlyReason:Mt,editing:Yo?lo.editing({name:cn(Yo.name,so),noun:oo.noun}):null,conflict:null!=at,notSaving:oo.bar.notSaving},Qo=()=>{Tt||(et.failed?Nt():It())};c(Vo,Wo,Qo);const[Go,Ko]=Rn(!1),Zo=Ln(!1),[_o,qo]=Rn(null),[er,nr]=Rn([]),[tr,or]=Rn(V);W(tr);const rr=e(tr,Wt?.props.id),[ir,lr]=Rn(null);Fn(()=>{ir&&(n(),lr(null))},[ir]);const sr=Ln(Ht);sr.current=Ht;const dr=Dn((e,{scroll:n})=>{Ao(n=>Eo(e,n)),n&&lr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=sr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Rr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),ar=Ln(null);Fn(()=>{const e=ar.current;ar.current=null;const n=null==Wt?.props.id?null:String(Wt.props.id);or(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Zt(Wt?.type)??V);const o=Wt?.props.id,r=yo.current;if(yo.current=null,!o)return;const i=Ht(o);dr(String(o),{scroll:!t(r,i??null,Be)})},[Wt?.props.id,dr]);const cr=Dn(e=>{or(n=>H(n,e)?n:e),Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Dt]),pr=Ln(()=>{});pr.current=(e,n)=>{const t=e?Mi(e.zone??Be)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Wt?.props.id?null:String(Wt.props.id);or(e=>H(e,n)?e:n),o!==r&&(ar.current={id:o,mode:n},bo.select(e))};const ur=Dn((e,n)=>pr.current(e,n),[]),fr={kind:tr.kind,mode:tr,open:cr,show:e=>or(e),reveal:()=>{wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:ur},hr=U(fr,{data:Ft.data,selected:Wt??null,zoneOf:e=>Ht(e)?.zone,readOnly:Boolean(Tt),select:e=>{or(V),bo.select({index:e})},replace:(e,n)=>bo.replaceComponent(Be,e,n),scrollTo:e=>l(e)},{device:Oo,refreshes:Ro},{setView:Ao,reveal:()=>{So||Dt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),mr=hr.resolveLeftView?hr.resolveLeftView(Lo):"sections",gr=X(),{isLockedBlock:yr,duplicateBlocked:vr,nestDepth:br,newSectionNode:kr,canAddTo:Sr,blockIsOffered:wr}=gr,xr=e=>({id:String(e.props.id??""),data:Ft?.data}),zr=Y(),{labelAtLevel:Cr,Icon:Br,useProducts:Nr}=zr,Or=zr.rowName?(e,n,t)=>zr.rowName(e,n,t):void 0,Ir=Dn(e=>{Dt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),dr(e,{scroll:!0})},[Dt,dr]),{selectNode:Pr,openPartId:$r}=g({mode:tr,setMode:or,onOpenPart:Ir}),[Tr,Mr]=Rn(null);me(null!==Tr,()=>Mr(null));const jr=f(J()),Er=jr.collapsed,Lr=jr.panelWidths,[Ar,Rr]=Rn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Er);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
- return new Set}});Fn(()=>{try{window.localStorage.setItem(Er,JSON.stringify([...Ar]))}catch{}},[Ar]);const[Fr,Dr]=Rn(()=>{if("undefined"==typeof window)return{...h};try{const e=window.localStorage.getItem(Lr);if(!e)return{...h};const n=JSON.parse(e);return{left:m(Number(n.left)||h.left,"left"),right:m(Number(n.right)||h.right,"right")}}catch{return{...h}}});Fn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Lr,JSON.stringify(Fr))}catch{}},300);return()=>clearTimeout(e)},[Fr]);const Vr=Dn((e,n)=>Dr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Wr=Dn(e=>Vr("left",e),[Vr]),Hr=Dn(e=>Vr("right",e),[Vr]),Ur=e=>Ar.has(e),Xr=e=>Rr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Yr=Ln(!1),Jr=Ln(null);Fn(()=>{if(Yr.current&&!Go){const e=Jr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Vo.current?.querySelector(`button[aria-label="${CSS.escape(oo.add.title)}"]`))?.focus(),Jr.current=null}Yr.current=Go},[Go]),Fn(()=>{if(!Go||!Uo)return;const e=e=>{"Escape"===e.key&&ul()};return Uo.addEventListener("keydown",e),()=>Uo.removeEventListener("keydown",e)},[Go,Uo]),me(Go,()=>ul()),Fn(()=>{!So&&Go&&(Ko(!1),qo(null),Zo.current=!1)},[So]);const Qr=Q(),Gr=(e,n="success",t)=>{if(Qr)return void(t?Qr(e,"error"===n?"error":"info",t):Qr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Qn.error(e,{...o,duration:t?.duration??3200}):Qn.success(e,{...o,duration:t?.duration??1900})},Kr=Ln(null),[Zr,_r]=Rn(0),[qr,ei]=Rn(0),ni=G(),ti=Ln(null),oi=e=>Math.max(0,e.clientHeight-(ti.current?.offsetHeight??0));Fn(()=>{const e=Kr.current;if(!e)return;const n=()=>{_r(e.clientWidth),ei(oi(e))};n();const t=new ResizeObserver(n);return t.observe(e),ti.current&&t.observe(ti.current),()=>t.disconnect()},[]),Vn(()=>{Kr.current&&(_r(Kr.current.clientWidth),ei(oi(Kr.current)))},[Fr,So,wo]);const ri=Oo===Bo?Zr>0?Zr:zo[Bo]:zo[Oo],ii=Zr>0?Math.min(Zr/ri,"shrink"===No?1:2):1,li=ri*ii,si=Zr>0&&li>Zr+1,di={width:li,height:qr||"100%",flex:"none",position:"relative"},ai={width:ri,height:qr?qr/ii:"100%",maxHeight:"none",transform:1!==ii?`scale(${ii})`:void 0,transformOrigin:"top left"},ci=()=>Dt({type:"setUi",ui:{leftSideBarVisible:!So}}),pi=()=>Dt({type:"setUi",ui:{rightSideBarVisible:!wo}}),ui=e=>{Go&&(Ko(!1),qo(null),Zo.current=!1,So&&Lo===e)||(Ao(e),So||Dt({type:"setUi",ui:{leftSideBarVisible:!0}}))},fi=()=>{or(_t??V),wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},hi=Ft.data.content??[],mi=()=>{const e=hi.findIndex(qt),n=hi.findIndex(eo);return{floor:e>=0?e+1:0,cap:n>=0?n:hi.length}},gi=Ut,yi=gr.stripCopy,vi=e=>o(e,yi),bi=pe(),ki=Ge({data:Ft.data,config:gi,readOnly:Boolean(Tt),clipboard:bi,strip:yi?e=>yi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Pn||e.slot!==$n)return{min:0,max:n-1};const{floor:t,cap:o}=mi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&or(V);const t=void 0===n||"node"===n?.kind?n:null;bo.commitDocument(e,t)}}),Si=fe(),[wi,xi]=Rn(null),zi=e=>{const n=hi.find(n=>String(n.props.id)===e),t=Xt.shared;n&&t&&ki.swap(e,t.detach(n))},Ci=e=>{const n=jn(Ft.data,Ut,e);if(!n)return!1;const t=Tn(n.place),o=n.node,r=t===Be?Pi(o):Xi(o),i=t===Be?Xt.shared?.usedOn(o):null;return!!ki.remove(e)&&(Gr(i?oo.shared.removed({count:Math.max(0,i.length-1)}):oo.deleted({name:r}),"success",{duration:8e3,action:{label:oo.bar.undo,onClick:()=>{ki.restore(n.node,n.place)}}}),!0)},Bi={...ki,remove:Ci},Ni=e=>Cr(e,"block",Ut.components[e]?.label??e),Oi=Dn(e=>Ut.components[e]?.defaultProps??{},[Ut]),Ii=e=>Cr(e,"section",Ni(e)),Pi=e=>we({type:e.type,props:e.props??{}},Ii(e.type),Or),{nodeAddresses:$i,zoneItems:Ti}=An(()=>{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>=Oe)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Ie(Ut,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(hi,Be,0),{nodeAddresses:e,zoneItems:n}},[hi,Ut]),Mi=Dn(e=>Ti.get(e)??[],[Ti]),ji=e=>{const n=$i.get(e);return n?Mi(n.zone)[n.index]:void 0},Ei=e=>oe(gr,Ut,e),Li=e=>{if(!gr.slotsOf||e===Be)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=ji(e.slice(0,n));if(!t)return null;const o=Ei(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}},Ai=(()=>{if(!K(tr))return null;const e=`${tr.nodeId}:${tr.slot}`;return Li(e)?.slot.panel===tr.kind?e:null})(),Ri=Ln(null);Fn(()=>{const e=Ri.current;if(Ri.current=null,!Ai||!K(tr))return;const n=tr.nodeId;dr(n,{scroll:e!==Ai}),Rr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[tr]);const Fi=e=>{const n=$i.get(e);n&&(n.zone===Be?il(n.index):Tl(n.zone,n.index,e,ji(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))},Di=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void Fi(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Ai!==i&&(Ri.current=i),ur(null,r),wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Vi=(e,n,t)=>{const o=`${e}:${n}`;if(Rr(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;Ai!==o&&(Ri.current=o);ur(null,{kind:t,nodeId:e,slot:n})},Wi=(e,n,t)=>{if(Tt||!gr.moveSlot)return;const o=ji(e),r=o?Ei(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:wt,index:n},s=bn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=gr.moveSlot(e,n,s);"string"==typeof d&&Vi(e,d,i.panel)},Hi=Nr(),Ui=An(()=>{const e=/* @__PURE__ */new Map;for(const n of Hi??[])e.set(n.slug,n.name);return e},[Hi]),Xi=e=>xe(e,Ni,zr.plainText,e=>Ui.get(e),zr.rowName),Yi=(e,n)=>{const t=Ut.components[e.type]?.fields,o=n===Be||rs(n)?"section":"block",r=n===Be&&(qt(e)||eo(e)||Gt(e.type)),i="block"===o?ze(t):r?null:Ce(t);return zr.renamePropOf?zr.renamePropOf(e,o,i):i},Ji=(e,n,t,o)=>{if(!(!Tt&&Tr?.zone===e&&Tr.index===n))return;const r=(t,o)=>{Mr(null),o&&((e,n,t)=>{const o=Mi(e)[n];if(!o)return;const r=Yi(o,e);r&&bo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
- return pt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":oo.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)},Qi=i(Z(),co),Gi=Qi.scope({target:On,siteId:_n,docId:Un}),Ki=Ut,Zi=(e,n)=>n===Be?Ii(e):Ni(e),_i=(e,n,t)=>{const o=Qi.plan(Gi,t,Zi(t.type,e),Ki);o&&(o.changed&&bo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Gr(o.message))},qi=ue({nodesIn:Mi,nodeAt:(e,n)=>Mi(e)[n]??null,labelOf:(e,n)=>n===Be?Ii(e):Ni(e),renamePropOf:Yi,beginRename:(e,n)=>Mr({zone:e,index:n}),history:{hasPast:Vt.hasPast,hasFuture:Vt.hasFuture,back:()=>Vt.back(),forward:()=>Vt.forward()},openPageStyles:hr.openPageStyles,pageStylesLabel:oo.pageStyles,words:{menu:ao,styleClipboard:co,screen:oo.menu},readOnly:Boolean(Tt),collapseAll:()=>Rr(new Set(Mi(Be).map(e=>String(e.props.id)))),onPasteRefused:e=>Gr(e?oo.pasteRefused({name:e.label}):oo.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ss(e,n),copyItem:hr.onCopyItem,menuRows:(e,n,t)=>{const o=hr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Xt.shared;if(!t||n!==Be)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:oo.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return Tt||yr(e.type,e)?n:{...n,change:[{label:oo.shared.detach,onClick:()=>zi(e.props.id)}],remove:[{label:oo.shared.removeFromPage,danger:!0,onClick:()=>{Ci(e.props.id)}}]}}return Tt||qt(e)||eo(e)||Gt(e.type)?null:B(Si)?{change:[{label:oo.shared.makeShared,onClick:()=>xi({id:e.props.id,name:Pi(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=>yr(e.type,e),duplicateBlocked:e=>vr(Ft.data,e),permits:e=>{const n=Ne(Ut,e.type);return Xt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:Bi,isPinned:(e,n)=>n===Be&&(qt(e)||eo(e)),sectionBand:mi,locate:e=>$i.get(e)??null,rowNameOf:(e,n)=>n===Be?Pi(e):Xi(e),selectAt:(e,n,t,o)=>{e===Be?il(n):Tl(e,n,t,o??"")},slotRung:e=>{const n=Li(e);return n?.slot.panel?{label:n.slot.label,select:()=>Di(n.node,n.slot,!1)}:null},style:{held:()=>be(Gi),canCopy:e=>Qi.rows(Ki,e).some(e=>!1!==e.counted),copy:(e,n)=>Qi.copy(Gi,e,Zi(e.type,n),Ki),paste:(e,n,t)=>_i(e,n,t)},keys:Et?{target:Uo,selected:()=>{const e=Ft.ui.itemSelector;return e?{zone:e.zone??Be,index:e.index}:null},held:()=>bi.get(),readOnly:Boolean(Tt),onDone:({done:e,name:n})=>{"copied"===e&&Gr(oo.copied({name:n}))}}:void 0},Wo),el=Ln({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Fn(()=>{el.current={copy:(e,n)=>Qi.copy(Gi,e,Zi(e.type,n),Ki),paste:_i,at:()=>{const e=Ft.ui.itemSelector;if(!e)return null;const n=e.zone??Be,t=Mi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Tt)}});const nl=Dn(e=>{const n=ke(e);if(!n)return;const t=el.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))},[]);Fn(()=>{if(!Uo)return;const e=e=>nl(e);return Uo.addEventListener("keydown",e),()=>Uo.removeEventListener("keydown",e)},[nl,Uo]),zn(Wo,"keydown",nl);const tl=hi.map(e=>e.props.id).join("|");Fn(()=>{const e=Wo?.document??null,n=Wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void nr(e=>e.length?[]:e);const n=hi.findIndex(eo),t=n>=0?n:hi.length,o=n=>{const t=hi[n]?.props?.id;return null==t?null:In(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(wn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=hi.length>0&&!qt(hi[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=St(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})}nr(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=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Wo,tl,Oo,ii,So,wo,Wt?.props.id]);const ol=Wo?.document??null,rl=Wo?.window??null;Fn(()=>{const e=Do.current;if(!e||!ol||!rl)return;const n=[],t=()=>{const n=In(ol,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&rl.scrollTo({left:rl.scrollX,top:rl.scrollY+t,behavior:"instant"}),!0};return Do.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ol,rl]);const il=e=>{or(V),bo.select({index:e}),hr.sectionPressed?.(hi[e]);const n=hi[e]?.props?.id;n&&l(n)},ll=e=>{const{floor:n,cap:t}=mi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Wt&&tr.kind!==_t?.kind?hi.findIndex(e=>e.props.id===Wt.props.id):-1;return o(r>=0?r+1:t)},sl=(e,n)=>{const{floor:t,cap:o}=mi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(bo.reorderComponent(Be,e,i),bo.select({index:i}),{moved:!0,dest:i})},dl=(e,n,t,o)=>{or(V),bo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Gr(oo.sectionAdded({name:t}))},al=(e,n)=>{const t=ll(n),o=kr(e,{nodeDefaults:Oi,newNodeId:$e,sectionLabel:Ii,blockIsOffered:wr}),r=o?bo.insertNode(Be,t,o):bo.insertSection(e,t);return dl(t,r,Ii(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 Ie(Ut,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Sr(e.type,l,d.slice(d.lastIndexOf(":")+1),xr(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},cl=e=>pl(Be,e),pl=(e,n)=>{Jr.current=document.activeElement??null,qo(null===n?null:{zone:e,index:n}),Ko(!0),So||(Zo.current=!0,Dt({type:"setUi",ui:{leftSideBarVisible:!0}}))},ul=()=>{Ko(!1),qo(null),Zo.current&&Dt({type:"setUi",ui:{leftSideBarVisible:!1}}),Zo.current=!1},fl=(e,n)=>zr.rowName?n?qt(e)?zr.rowName(e,"section",oo.header):eo(e)?zr.rowName(e,"section",oo.footer):Gt(e.type)?zr.rowName(e,"section",Ni(e.type)):Pi(e):Xi(e):n?Ii(e.type):Ni(e.type),hl=e=>n=>{e()},ml=(e,n,t)=>{if(Tt)return null;const o=Mi(e)[n];return o&&!Ne(Ut,o.type).delete||o&&yr(o.type,o)?null:/* @__PURE__ */pt(Ue,{kind:"delete",label:e===Be&&o&&Xt.shared?.usedOn(o)?oo.shared.removeFromPage:oo.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Mi(e)[n]?.props?.id;null!=t&&Ci(String(t))})(e,n),children:/* @__PURE__ */pt(lt,{size:15})})},gl=e=>zr.rowPreview?.(e)||void 0,yl=e=>zr.rowMarks?.(e)??void 0,vl=(e,n,t)=>zr.rowActions?.(e,n,t)??null,bl=(e,n,t,o)=>{if(Tt)return null;if(yr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
- return pt(Ue,{kind:"eye",label:r?oo.showNamed({name:o}):oo.hideNamed({name:o}),onClick:()=>Sl(e,n,t),children:/* @__PURE__ */pt(r?st:dt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},kl=e=>nd(Be,e),Sl=(e,n,t)=>{bo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},wl=e=>Pe(Ut,e),xl=e=>Ie(Ut,e),zl=e=>gr.slotsOf?Ei(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Te(e,n.slot)})):[{slot:null,rung:null,kids:re(Ut,e)}],Cl=e=>gr.slotsOf?zl(e).flatMap(e=>e.kids):re(Ut,e),Bl=e=>Boolean(gr.slotsOf)&&Ei(e).some(e=>e.rung),Nl=(e,n,t)=>Sr(e.type,n,t??void 0,xr(e)),Ol=(e,n,t)=>{const o=Me(Ut,e.type,n)&&(t||Cl(e).length>0||Bl(e));return{collapsible:o,folded:o&&Ur(String(e.props.id))}},Il=(e,n,t)=>zl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Ol(e,r,t(e.type)).collapsible?[String(e.props.id),...Il(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Pl=e=>Cl(e).length>0||Bl(e)||Boolean(Sr(e.type)),$l=e=>Boolean(Sr(e)),Tl=(e,n,t,o)=>{if(or(V),Sr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),bo.select({index:n,zone:e}),l(t)}else bo.select({index:n,zone:e}),l(t)},Ml=(e,n,t,o,r)=>{const i=`${e}:${n}`;bo.insertComponent(i,t,o),Sr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),bo.select({index:o,zone:i})}):bo.select({index:o,zone:i})},jl=Ln(/* @__PURE__ */new Set);Fn(()=>{hi.forEach(e=>{const n=Sr(e.type)?.spec;if(!n)return;const t=e.props.id;if(jl.current.has(t))return;jl.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(Oi)).forEach((e,t)=>go.seedChild(o,t,n.childType,e))})},[hi,go,Oi]);const El=Ln(/* @__PURE__ */new Set);Fn(()=>{hi.forEach((e,n)=>{const t=e.props.id;if(El.current.has(t))return;const o=r(e,wl(e.type));El.current.add(t),o&&go.replaceComponent(Be,n,{...e,props:o})})},[hi,go]),_(go,Ut);const Ll=hi.findIndex(eo),Al=Ll>=0?hi[Ll]:null,Rl=no?hi.findIndex(qt):-1,Fl=Rl>=0?hi[Rl]:null,Dl=Xt.groupTab,Vl=An(()=>Dl?e=>Gt(e.type):void 0,[Dl]),Wl=Boolean(Xt.groupBadge),Hl=Xt.sharedReach,Ul=e=>Hl?.(e)??void 0,Xl=An(()=>Hl?new Set(hi.filter(e=>Ul(e)).map(e=>String(e.props.id))):null,[hi,Hl]),Yl=An(()=>Xl?e=>Xl.has(e):void 0,[Xl]),Jl=Xt.first?Hl?.({type:Xt.first,props:{id:""}})??void 0:void 0,Ql=Xt.groupBadge?/* @__PURE__ */pt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */pt(Xn,{tone:"info",size:"xs",children:Xt.groupBadge})}):void 0,Gl=hi.find(e=>e.type===Jt)??null,Kl=hi.find(e=>e.type===Qt)??null,Zl=Ll>=0?Ll:hi.length,_l=[];hi.forEach(e=>{eo(e)||(Pl(e)&&_l.push(String(e.props.id)),_l.push(...Il(e,1,$l)))}),Al&&(_l.push(String(Al.props.id)),_l.push(...Il(Al,1,$l)));const ql=_l.length>0&&_l.every(e=>Ar.has(e)),es=e=>{const n=zr.blockRowName(e,Ni);return zr.rowName?zr.rowName(e,"block",n):n},ns=(e,n,t,o)=>{const r=Mi(e)[t];if(!r)return;const i={...Mn(e),index:t},l={...Mn(n),index:Math.min(Math.max(o,0),Mi(n).length)},s=bn(i,l);if(e!==n||s!==t)try{ki.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof En))throw e}},ts=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of xl(e))n.add(r),t(o)};for(const t of wl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},os=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=$i.get(n);if(!e)return null;if(e.zone===Be)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},rs=e=>{const n=e.slice(0,e.indexOf(":")),t=hi.find(e=>Gt(e.type)&&String(e.props.id)===n);return t&&Kt(n)===e?t:null},is=(e,n)=>{const t=rs(e);return!t||(!Xt.groupAccepts||Xt.groupAccepts(t.type,n,Mi(e).length))},ls=(e,n,t)=>{if(e.rung){const t=ji(e.rung.nodeId),o=t?Ei(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===wt&&n.index>=0&&n.index<=o}if(n.slot===wt)return!1;if(e.add)return cs(e.add,n);const o=Tn(n);if(Gt(e.type))return!1;const r=rs(o),i=rs(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!is(o,e.type))&&(n.index>=0&&n.index<=Mi(o).length));if(e.zone===Be||o===Be){if(e.zone!==o)return!1;const{floor:t,cap:r}=mi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Mi(o).length)return!1;if(e.zone===o)return!0;const l=Al&&!Xt.lastIsOpen?String(Al.props.id):null;return(!l||os(e.zone)!==l&&os(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Mi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=$i.get(i),s=l?Mi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ts(r).has(n))return!1;const d=Sr(s.type,br(Ft?.data,s.type,i),n.slice(n.lastIndexOf(":")+1),xr(s));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Mi(n),r))})(e.zone,o,e.index,t)},ss=(e,n)=>{const t=Tn(e.from),o=e.node;return t===Tn(n)?is(t,o.type):ls({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},ds=e=>{const n=e.slice(0,e.indexOf(":")),t=$i.get(n),o=t?Mi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Sr(o.type,br(Ft?.data,o.type,n),e.slice(e.lastIndexOf(":")+1),xr(o));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=$(r.choices??(r.spec?[{type:r.spec.childType,label:Ni(r.spec.childType)}]:[])),l=Li(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:fl(o,t.zone===Be)}},as=(e,n)=>{if("section"!==e.kind)return e;const t=Tn(n);return t===Be||rs(t)?e:ds(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},cs=(e,n)=>{const t=as(e,n),o=Tn(n);if("shared"===t.kind){if(o!==Be||!Xt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=mi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(rs(o)){if("preset"===t.kind)return!1;const e="section"===t.kind?t.type:t.template.node.type;return is(o,e)&&n.index>=0&&n.index<=Mi(o).length}if(o!==Be)return!1;const{floor:e,cap:r}=mi();return n.index>=e&&n.index<=r}if(o===Be)return!1;const r=ds(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Mi(o))},ps=(e,n)=>{const t=as(e,n);if("block"!==t.kind&&rs(Tn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&is(n,o)){if("section"===e.kind)bo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;bo.insertNode(n,t,vi(e.template.node))}or(V),bo.select({index:t,zone:n})}})(t,Tn(n),n.index);if("section"===t.kind)return void al(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=ll(t),r=bo.insertNode(Be,o,n);dl(o,r,e)})(t.template.name,vi(t.template.node),n.index);if("preset"===t.kind)return void((e,n,t)=>{const o=n({nodeDefaults:Oi,newNodeId:$e,sectionLabel:Ii,blockIsOffered:wr});if(!o)return;const r=ll(t),i=bo.insertNode(Be,r,o);dl(r,i,e)})(t.preset.label,t.preset.insert,n.index);if("shared"===t.kind){const e=Xt.shared?.nodeOf(t.section);if(!e)return;const o=ll(n.index);return void(ki.restore(e,{parentId:Pn,slot:$n,index:o})&&dl(o,e.props.id,t.section.title))}const o=Tn(n),r=ds(o);r&&(r.target.spec?Ml(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{bo.insertComponent(e,n,t),or(V),bo.select({index:t,zone:e})})(o,t.type,n.index))},us=(e,n)=>{e.media?function(e){const n=Ks();if(!n||!Js)return;_s(n).then(n=>{n&&function(e,n){if(!Js)return;const t=Js.create(e,{nodeDefaults:Oi,newNodeId:$e,sectionLabel:Ii,blockIsOffered:wr}),o=Tn(n);if(o===Be){const e=ll(n.index),o=bo.insertNode(Be,e,t);return void dl(e,o,Ii(t.type))}bo.insertNode(o,n.index,t),or(V),bo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Wi(e.rung.nodeId,e.index,n.index):e.add?ps(e.add,n):e.zone===Be?sl(e.index,n.index):ns(e.zone,Tn(n),e.index,n.index)},[fs]=Rn(()=>yn()),hs=vn({keyOf:e=>e.id,readOnly:Boolean(Tt),session:fs,canDrop:ls,onDrop:us,onStep:(e,n)=>{e.rung?Wi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Be?((e,n)=>{const t=Ii(hi[e]?.type??""),o=sl(e,n<0?e-1:e+2);if(!o.moved)return void Gr(n<0?oo.sectionFirst({name:t}):oo.sectionLast({name:t}));const{floor:r,cap:i}=mi();Gr(oo.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):ns(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ms=Dn(e=>{const{floor:n,cap:t}=mi(),o=[];for(const r of e.nodes){const e=Tn(r.place),i=Mi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(qt(i)||eo(i)||yr(i.type,i))continue;if(Gt(i.type))continue;const l=Boolean(rs(e)),s=e===Be||l;e===Be&&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?Ii(i.type):Xi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Tn(e.list);if(n===Be&&0===e.children.length)return[{...e,addLabel:oo.addSection,addAlways:!0}];const t=ds(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(rs(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Tn(e.list),t=n===Be||rs(n)?null:ds(n);return t?.choices.length?fn(e,t.target.spec?.addLabel??oo.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Ft.data]),gs=null==Wt?.props.id?null:String(Wt.props.id),ys=Wn(Le),vs=ys?.selected()&&Wo?.document&&gs?ys.selectedPart?.(Wo.document)??null:null,bs=vs&&gs&&Ae(Ft.data,Ut,gs,vs)?vs:null,ks=bs?.label?{element:bs.element,label:bs.label}:null,Ss=null!==bs,ws=Dn(e=>{const n=Ut,t=e=>!e.item.rung&&null!==jn(Ft.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(gs);return i?Ss?null:i:r(Ke(Ft.data,n,o.item.id,gs,Vl))??o},[Ft.data,Ut,gs,Vl,Ss]),[xs,zs]=Rn(null),[Cs,Bs]=Rn(null),Ns=zr.canvasTab,Os=Boolean(Dl||Hl||Ns);zn(Wo,"mouseover",e=>{if(!Os)return;const n=Cn(e.target),t=n?yt(Ft.data,Ut,n):null;t!==xs&&zs(t),Ns&&n!==Cs&&Bs(n)}),zn(Wo,"mouseout",e=>{Os&&!e.relatedTarget&&(zs(null),Bs(null))});const Is=e=>qt(e)||eo(e)||Gt(e.type),Ps=e=>{const n=Gt(e.type)?Ni(e.type):qt(e)?oo.header:eo(e)?oo.footer:null;return null===n?Pi(e):zr.rowName?zr.rowName(e,"section",n):n},$s=[];if(Os){const e=gs?yt(Ft.data,Ut,gs):null;for(const n of/* @__PURE__ */new Set([e,xs])){const e=n?hi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=qt(e)||e.type===Jt,o=Ul(e);if(o){$s.push({id:String(e.props.id),label:Ps(e),below:t,reach:o});continue}if(!Dl||!Is(e))continue;const r=Dl(e);r&&$s.push({id:String(e.props.id),label:r,below:t})}for(const e of Ns?/* @__PURE__ */new Set([gs,Cs]):[]){const n=e?ji(e):void 0,t=n?Ns(n):null;t&&!$s.some(n=>n.id===e)&&$s.push({id:e,label:t,below:!1,above:!0})}}const Ts=fe(),Ms=Ln(null);Fn(()=>{const e=Xt.changeNotice;if(!e)return;const n=JSON.stringify(hi.filter(Is)),t=Ms.current;if(Ms.current={doc:Un,bands:n,index:Vt.index},!t||t.doc!==Un||t.bands===n)return;Vt.hasPast&&Vt.index>=t.index&&!gt.has(Ts)&&(gt.add(Ts),Gr(e,"success",{action:{label:oo.bar.undo,onClick:()=>Vt.back()},duration:8e3}))},[hi]);const js=e=>{or(V),bo.select(e.zone===Be?{index:e.index}:{index:e.index,zone:e.zone})},Es=q(),Ls=()=>({data:Ft.data,device:Oo,ops:bo,inspector:fr}),As=Es?.model,Rs=An(()=>As?e=>As(e,ms(e),Ls()):ms,[As,ms,Oo]),Fs=Es?.measure,Ds=Fs?(e,n)=>Fs(e,n,Ls()):void 0,Vs=Es?.canDrop,Ws=Vs?(e,n)=>Vs(e,n,ls,Ls()):ls,Hs=Es?.drop,Us=Hs?(e,n)=>Hs(e,n,us,Ls()):us,Xs=Es?.pick,Ys=Xs?e=>Xs(e,js,Ls()):js,Js=Es?.media??null,Qs=Ln(null),Gs=An(()=>Js?{id:ht,zone:"",index:-1,type:Js.adds.type,add:{kind:Js.adds.kind,type:Js.adds.type},media:!0}:null,[Js]);Fn(()=>{if(!Gs||Tt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(nt))(e)&&(Qs.current=null,fs.start({key:ht,item:Gs}))},n=e=>{fs.get()?.item.media&&(Qs.current=Gn(e.dataTransfer))},t=()=>{fs.get()?.item.media&&fs.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)}},[Gs,Tt,fs]);const Ks=()=>{const e=Qs.current;return Qs.current=null,e},Zs=ce(),_s=async e=>{if(!Zs)return e;const n=await Zs(e);return n?{...e,id:n.id,url:n.url}:null};const qs=(e,n)=>{if(!Js)return;const t=jn(vo.getState().appState.data,gi,n);if(!t)return;const o=t.node;bo.replaceComponent(Tn(t.place),t.place.index,{...o,props:{...Js.replace(o,e),id:o.props.id}})},ed=e=>{const n=Tn(e),t=Li(n);t&&Di(t.node,t.slot,!1),pl(n,e.index)},nd=(e,n)=>/* @__PURE__ */pt(Xe,{...Tt?{}:hs.seam({place:{...Mn(e),index:n}})},`seam:${e}:${n}`),td={rowClick:hl,isCollapsed:Ur,toggleCollapse:Xr},od=e=>{const n=String(e.props.id),t=hi.findIndex(e=>String(e.props.id)===n),o=Kt(n),r=Mi(o),i=Ur(n),l=Ni(e.type),s=zr.rowName?zr.rowName(e,"section",l):l,d=e=>nd(o,e);/* @__PURE__ */
12
+ /* @__PURE__ */pt("path",{d:"M5 12h14"})]})})}var kt=`${Nn}, ${In}`;function St(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 wt="__rungs",xt=e=>"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:"preset"===e.kind?e.preset.key:e.type;var zt="screen:band",Ct={duplicate:!0,delete:!0},Ot=()=>null;function Nt(){const Nn=he(),Mn=Nn.panels?.Toolbar,Tn=(Nn.panels?.useRight??Ot)(),{target:jn,docId:Un,capabilities:Kn,currentSlug:Gn,siteId:_n,onPublish:qn,saveState:et,saveConflict:at,retrySave:Nt,toggleAutoSave:It,flushSave:Bt,access:Pt,saveUnreachable:$t=!1,readOnly:Mt,readOnlyReason:Tt=null}=w(),jt=M(),Et=T(),{mediaEditing:At,hasEditGuard:Lt,hasPinnedChrome:Rt}=Kn,{appState:Ft,dispatch:Dt,history:Vt,selectedItem:Wt,getSelectorForId:Ht,config:Ut}=je(e=>e),Yt=j(),{first:Jt,firstGroup:Xt,lastGroup:Qt,isSectionGroup:Zt,sectionGroupZone:Kt,panelOf:Gt}=Yt,_t=Gt(Jt),qt=e=>ne(Yt,e),eo=e=>te(Yt,e),no="node"===Yt.firstRow,to=Yt.band??null,oo=un("screen",ve),ro=un("tree",Je),io=un("drag",gn),lo=un("notice",sn),so=un("lock",pn),ao=un("menu",Xe),co=un("styleClipboard",Se),po=un("chrome",dn),uo=E()??`/${Gn}`,fo=A(),ho=L(),mo=y({readOnly:Mt}),go=y({readOnly:Mt,foldIntoHistory:!0}),yo=An(null),vo=Ee(),bo=Ln(()=>({...mo,select:e=>{yo.current=e,mo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=vo.config;yo.current=Qe(e,t,n)}mo.commitDocument(e,n)}}),[mo,vo]),ko=Ft.ui,So=ko.leftSideBarVisible,wo=ko.rightSideBarVisible,{options:xo,widths:zo,initial:Co,fluid:Oo,fit:No}=R(),[Io,Bo]=Rn(Co),Po=le(),$o=At&&null!==Po;se(),de();const Mo=ae();F(Wt?.props.id);const{read:To,write:jo,forSelection:Eo}=D(),[Ao,Lo]=Rn(To);Fn(()=>{jo(Ao)},[Ao]);const[Ro,Fo]=Rn(0),Do=An(null),Vo=An(null),Wo=On(Vo,{readySelector:kt}),Ho=Bn(Wo),Uo=d(Vo);a(Vo,Wo);const Yo=S(),Jo=an(Pt),Xo={state:et,offline:Yo||et.failed&&$t,readOnlyReason:Tt,editing:Jo?lo.editing({name:cn(Jo.name,so),noun:oo.noun}):null,conflict:null!=at,notSaving:oo.bar.notSaving},Qo=()=>{Mt||(et.failed?Nt():Bt())};c(Vo,Wo,Qo);const[Zo,Ko]=Rn(!1),Go=An(!1),[_o,qo]=Rn(null),[er,nr]=Rn([]),[tr,or]=Rn(V);W(tr);const rr=t(tr,Wt?.props.id),[ir,lr]=Rn(null);Fn(()=>{ir&&(o(),lr(null))},[ir]);const sr=An(Ht);sr.current=Ht;const dr=Dn((e,{scroll:n})=>{Lo(n=>Eo(e,n)),n&&lr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=sr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Rr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),ar=An(null);Fn(()=>{const e=ar.current;ar.current=null;const n=null==Wt?.props.id?null:String(Wt.props.id);or(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Gt(Wt?.type)??V);const t=Wt?.props.id,o=yo.current;if(yo.current=null,!t)return;const i=Ht(t);dr(String(t),{scroll:!r(o,i??null,Oe)})},[Wt?.props.id,dr]);const cr=Dn(e=>{or(n=>H(n,e)?n:e),Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Dt]),pr=An(()=>{});pr.current=(e,n)=>{const t=e?Ti(e.zone??Oe)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Wt?.props.id?null:String(Wt.props.id);or(e=>H(e,n)?e:n),o!==r&&(ar.current={id:o,mode:n},bo.select(e))};const ur=Dn((e,n)=>pr.current(e,n),[]),fr={kind:tr.kind,mode:tr,open:cr,show:e=>or(e),reveal:()=>{wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:ur},hr=U(fr,{data:Ft.data,selected:Wt??null,zoneOf:e=>Ht(e)?.zone,readOnly:Boolean(Mt),select:e=>{or(V),bo.select({index:e})},replace:(e,n)=>bo.replaceComponent(Oe,e,n),scrollTo:e=>l(e)},{device:Io,refreshes:Ro},{setView:Lo,reveal:()=>{So||Dt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),mr=hr.resolveLeftView?hr.resolveLeftView(Ao):"sections",gr=Y(),{isLockedBlock:yr,duplicateBlocked:vr,nestDepth:br,newSectionNode:kr,canAddTo:Sr,blockIsOffered:wr}=gr,xr=e=>({id:String(e.props.id??""),data:Ft?.data}),zr=J(),{labelAtLevel:Cr,Icon:Or,useProducts:Nr}=zr,Ir=zr.rowName?(e,n,t)=>zr.rowName(e,n,t):void 0,Br=Dn(e=>{Dt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),dr(e,{scroll:!0})},[Dt,dr]),{selectNode:Pr,openPartId:$r}=g({mode:tr,setMode:or,onOpenPart:Br}),[Mr,Tr]=Rn(null);me(null!==Mr,()=>Tr(null));const jr=f(X()),Er=jr.collapsed,Ar=jr.panelWidths,[Lr,Rr]=Rn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Er);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
+ return new Set}});Fn(()=>{try{window.localStorage.setItem(Er,JSON.stringify([...Lr]))}catch{}},[Lr]);const[Fr,Dr]=Rn(()=>{if("undefined"==typeof window)return{...h};try{const e=window.localStorage.getItem(Ar);if(!e)return{...h};const n=JSON.parse(e);return{left:m(Number(n.left)||h.left,"left"),right:m(Number(n.right)||h.right,"right")}}catch{return{...h}}});Fn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Ar,JSON.stringify(Fr))}catch{}},300);return()=>clearTimeout(e)},[Fr]);const Vr=Dn((e,n)=>Dr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Wr=Dn(e=>Vr("left",e),[Vr]),Hr=Dn(e=>Vr("right",e),[Vr]),Ur=e=>Lr.has(e),Yr=e=>Rr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Jr=An(!1),Xr=An(null);Fn(()=>{if(Jr.current&&!Zo){const e=Xr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Vo.current?.querySelector(`button[aria-label="${CSS.escape(oo.add.title)}"]`))?.focus(),Xr.current=null}Jr.current=Zo},[Zo]),Fn(()=>{if(!Zo||!Uo)return;const e=e=>{"Escape"===e.key&&ul()};return Uo.addEventListener("keydown",e),()=>Uo.removeEventListener("keydown",e)},[Zo,Uo]),me(Zo,()=>ul()),Fn(()=>{!So&&Zo&&(Ko(!1),qo(null),Go.current=!1)},[So]);const Qr=Q(),Zr=(e,n="success",t)=>{if(Qr)return void(t?Qr(e,"error"===n?"error":"info",t):Qr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Qn.error(e,{...o,duration:t?.duration??3200}):Qn.success(e,{...o,duration:t?.duration??1900})},Kr=An(null),[Gr,_r]=Rn(0),[qr,ei]=Rn(0),ni=Z(),ti=An(null),oi=e=>Math.max(0,e.clientHeight-(ti.current?.offsetHeight??0));Fn(()=>{const e=Kr.current;if(!e)return;const n=()=>{_r(e.clientWidth),ei(oi(e))};n();const t=new ResizeObserver(n);return t.observe(e),ti.current&&t.observe(ti.current),()=>t.disconnect()},[]),Vn(()=>{Kr.current&&(_r(Kr.current.clientWidth),ei(oi(Kr.current)))},[Fr,So,wo]);const ri=Io===Oo?Gr>0?Gr:zo[Oo]:zo[Io],ii=Gr>0?Math.min(Gr/ri,"shrink"===No?1:2):1,li=ri*ii,si=Gr>0&&li>Gr+1,di={width:li,height:qr||"100%",flex:"none",position:"relative"},ai={width:ri,height:qr?qr/ii:"100%",maxHeight:"none",transform:1!==ii?`scale(${ii})`:void 0,transformOrigin:"top left"},ci=()=>Dt({type:"setUi",ui:{leftSideBarVisible:!So}}),pi=()=>Dt({type:"setUi",ui:{rightSideBarVisible:!wo}}),ui=e=>{Zo&&(Ko(!1),qo(null),Go.current=!1,So&&Ao===e)||(Lo(e),So||Dt({type:"setUi",ui:{leftSideBarVisible:!0}}))},fi=()=>{or(_t??V),wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}})},hi=Ft.data.content??[],mi=()=>{const e=hi.findIndex(qt),n=hi.findIndex(eo);return{floor:e>=0?e+1:0,cap:n>=0?n:hi.length}},gi=Ut,yi=gr.stripCopy,vi=e=>i(e,yi),bi=pe(),ki=Ze({data:Ft.data,config:gi,readOnly:Boolean(Mt),clipboard:bi,strip:yi?e=>yi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==kn||e.slot!==Sn)return{min:0,max:n-1};const{floor:t,cap:o}=mi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&or(V);const t=void 0===n||"node"===n?.kind?n:null;bo.commitDocument(e,t)}}),Si=fe(),[wi,xi]=Rn(null),zi=e=>{const n=hi.find(n=>String(n.props.id)===e),t=Yt.shared;n&&t&&ki.swap(e,t.detach(n))},Ci=e=>{const n=zn(Ft.data,Ut,e);if(!n)return!1;const t=wn(n.place),o=n.node,r=t===Oe?Pi(o):Yi(o),i=t===Oe?Yt.shared?.usedOn(o):null;return!!ki.remove(e)&&(Zr(i?oo.shared.removed({count:Math.max(0,i.length-1)}):oo.deleted({name:r}),"success",{duration:8e3,action:{label:oo.bar.undo,onClick:()=>{ki.restore(n.node,n.place)}}}),!0)},Oi={...ki,remove:Ci},Ni=e=>Cr(e,"block",Ut.components[e]?.label??e),Ii=Dn(e=>Ut.components[e]?.defaultProps??{},[Ut]),Bi=e=>Cr(e,"section",Ni(e)),Pi=e=>we({type:e.type,props:e.props??{}},Bi(e.type),Ir),{nodeAddresses:$i,zoneItems:Mi}=Ln(()=>{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>=Ie)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Be(Ut,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(hi,Oe,0),{nodeAddresses:e,zoneItems:n}},[hi,Ut]),Ti=Dn(e=>Mi.get(e)??[],[Mi]),ji=e=>{const n=$i.get(e);return n?Ti(n.zone)[n.index]:void 0},Ei=e=>oe(gr,Ut,e),Ai=e=>{if(!gr.slotsOf||e===Oe)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=ji(e.slice(0,n));if(!t)return null;const o=Ei(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}},Li=(()=>{if(!K(tr))return null;const e=`${tr.nodeId}:${tr.slot}`;return Ai(e)?.slot.panel===tr.kind?e:null})(),Ri=An(null);Fn(()=>{const e=Ri.current;if(Ri.current=null,!Li||!K(tr))return;const n=tr.nodeId;dr(n,{scroll:e!==Li}),Rr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[tr]);const Fi=e=>{const n=$i.get(e);n&&(n.zone===Oe?il(n.index):Ml(n.zone,n.index,e,ji(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))},Di=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void Fi(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Li!==i&&(Ri.current=i),ur(null,r),wo||Dt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Vi=(e,n,t)=>{const o=`${e}:${n}`;if(Rr(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;Li!==o&&(Ri.current=o);ur(null,{kind:t,nodeId:e,slot:n})},Wi=(e,n,t)=>{if(Mt||!gr.moveSlot)return;const o=ji(e),r=o?Ei(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:wt,index:n},s=bn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=gr.moveSlot(e,n,s);"string"==typeof d&&Vi(e,d,i.panel)},Hi=Nr(),Ui=Ln(()=>{const e=/* @__PURE__ */new Map;for(const n of Hi??[])e.set(n.slug,n.name);return e},[Hi]),Yi=e=>xe(e,Ni,zr.plainText,e=>Ui.get(e),zr.rowName),Ji=(e,n)=>{const t=Ut.components[e.type]?.fields,o=n===Oe||rs(n)?"section":"block",r=n===Oe&&(qt(e)||eo(e)||Zt(e.type)),i="block"===o?ze(t):r?null:Ce(t);return zr.renamePropOf?zr.renamePropOf(e,o,i):i},Xi=(e,n,t,o)=>{if(!(!Mt&&Mr?.zone===e&&Mr.index===n))return;const r=(t,o)=>{Tr(null),o&&((e,n,t)=>{const o=Ti(e)[n];if(!o)return;const r=Ji(o,e);r&&bo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
+ return pt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":oo.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)},Qi=n(G(),co),Zi=Qi.scope({target:jn,siteId:_n,docId:Un}),Ki=Ut,Gi=(e,n)=>n===Oe?Bi(e):Ni(e),_i=(e,n,t)=>{const o=Qi.plan(Zi,t,Gi(t.type,e),Ki);o&&(o.changed&&bo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Zr(o.message))},qi=ue({nodesIn:Ti,nodeAt:(e,n)=>Ti(e)[n]??null,labelOf:(e,n)=>n===Oe?Bi(e):Ni(e),renamePropOf:Ji,beginRename:(e,n)=>Tr({zone:e,index:n}),history:{hasPast:Vt.hasPast,hasFuture:Vt.hasFuture,back:()=>Vt.back(),forward:()=>Vt.forward()},openPageStyles:hr.openPageStyles,pageStylesLabel:oo.pageStyles,words:{menu:ao,styleClipboard:co,screen:oo.menu},readOnly:Boolean(Mt),collapseAll:()=>Rr(new Set(Ti(Oe).map(e=>String(e.props.id)))),onPasteRefused:e=>Zr(e?oo.pasteRefused({name:e.label}):oo.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ss(e,n),copyItem:hr.onCopyItem,menuRows:(e,n,t)=>{const o=hr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Yt.shared;if(!t||n!==Oe)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:oo.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return Mt||yr(e.type,e)?n:{...n,change:[{label:oo.shared.detach,onClick:()=>zi(e.props.id)}],remove:[{label:oo.shared.removeFromPage,danger:!0,onClick:()=>{Ci(e.props.id)}}]}}return Mt||qt(e)||eo(e)||Zt(e.type)?null:O(Si)?{change:[{label:oo.shared.makeShared,onClick:()=>xi({id:e.props.id,name:Pi(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=>yr(e.type,e),duplicateBlocked:e=>vr(Ft.data,e),permits:e=>{const n=Ne(Ut,e.type);return Yt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:Oi,isPinned:(e,n)=>n===Oe&&(qt(e)||eo(e)),sectionBand:mi,locate:e=>$i.get(e)??null,rowNameOf:(e,n)=>n===Oe?Pi(e):Yi(e),selectAt:(e,n,t,o)=>{e===Oe?il(n):Ml(e,n,t,o??"")},slotRung:e=>{const n=Ai(e);return n?.slot.panel?{label:n.slot.label,select:()=>Di(n.node,n.slot,!1)}:null},style:{held:()=>be(Zi),canCopy:e=>Qi.rows(Ki,e).some(e=>!1!==e.counted),copy:(e,n)=>Qi.copy(Zi,e,Gi(e.type,n),Ki),paste:(e,n,t)=>_i(e,n,t)},keys:Et?{target:Uo,selected:()=>{const e=Ft.ui.itemSelector;return e?{zone:e.zone??Oe,index:e.index}:null},held:()=>bi.get(),readOnly:Boolean(Mt),onDone:({done:e,name:n})=>{"copied"===e&&Zr(oo.copied({name:n}))}}:void 0},Wo),el=An({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Fn(()=>{el.current={copy:(e,n)=>Qi.copy(Zi,e,Gi(e.type,n),Ki),paste:_i,at:()=>{const e=Ft.ui.itemSelector;if(!e)return null;const n=e.zone??Oe,t=Ti(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Mt)}});const nl=Dn(e=>{const n=ke(e);if(!n)return;const t=el.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))},[]);Fn(()=>{if(!Uo)return;const e=e=>nl(e);return Uo.addEventListener("keydown",e),()=>Uo.removeEventListener("keydown",e)},[nl,Uo]),Pn(Wo,"keydown",nl);const tl=hi.map(e=>e.props.id).join("|");Fn(()=>{const e=Wo?.document??null,n=Wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void nr(e=>e.length?[]:e);const n=hi.findIndex(eo),t=n>=0?n:hi.length,o=n=>{const t=hi[n]?.props?.id;return null==t?null:En(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(In)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=hi.length>0&&!qt(hi[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=St(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})}nr(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=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Wo,tl,Io,ii,So,wo,Wt?.props.id]);const ol=Wo?.document??null,rl=Wo?.window??null;Fn(()=>{const e=Do.current;if(!e||!ol||!rl)return;const n=[],t=()=>{const n=En(ol,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&rl.scrollTo({left:rl.scrollX,top:rl.scrollY+t,behavior:"instant"}),!0};return Do.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[ol,rl]);const il=e=>{or(V),bo.select({index:e}),hr.sectionPressed?.(hi[e]);const n=hi[e]?.props?.id;n&&l(n)},ll=e=>{const{floor:n,cap:t}=mi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Wt&&tr.kind!==_t?.kind?hi.findIndex(e=>e.props.id===Wt.props.id):-1;return o(r>=0?r+1:t)},sl=(e,n)=>{const{floor:t,cap:o}=mi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(bo.reorderComponent(Oe,e,i),bo.select({index:i}),{moved:!0,dest:i})},dl=(e,n,t,o)=>{or(V),bo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Zr(oo.sectionAdded({name:t}))},al=(e,n)=>{const t=ll(n),o=kr(e,{nodeDefaults:Ii,newNodeId:$e,sectionLabel:Bi,blockIsOffered:wr}),r=o?bo.insertNode(Oe,t,o):bo.insertSection(e,t);return dl(t,r,Bi(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 Be(Ut,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Sr(e.type,l,d.slice(d.lastIndexOf(":")+1),xr(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},cl=e=>pl(Oe,e),pl=(e,n)=>{Xr.current=document.activeElement??null,qo(null===n?null:{zone:e,index:n}),Ko(!0),So||(Go.current=!0,Dt({type:"setUi",ui:{leftSideBarVisible:!0}}))},ul=()=>{Ko(!1),qo(null),Go.current&&Dt({type:"setUi",ui:{leftSideBarVisible:!1}}),Go.current=!1},fl=(e,n)=>zr.rowName?n?qt(e)?zr.rowName(e,"section",oo.header):eo(e)?zr.rowName(e,"section",oo.footer):Zt(e.type)?zr.rowName(e,"section",Ni(e.type)):Pi(e):Yi(e):n?Bi(e.type):Ni(e.type),hl=e=>n=>{e()},ml=(e,n,t)=>{if(Mt)return null;const o=Ti(e)[n];return o&&!Ne(Ut,o.type).delete||o&&yr(o.type,o)?null:/* @__PURE__ */pt(Ue,{kind:"delete",label:e===Oe&&o&&Yt.shared?.usedOn(o)?oo.shared.removeFromPage:oo.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Ti(e)[n]?.props?.id;null!=t&&Ci(String(t))})(e,n),children:/* @__PURE__ */pt(lt,{size:15})})},gl=e=>zr.rowPreview?.(e)||void 0,yl=e=>zr.rowMarks?.(e)??void 0,vl=(e,n,t)=>zr.rowActions?.(e,n,t)??null,bl=(e,n,t,o)=>{if(Mt)return null;if(yr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
+ return pt(Ue,{kind:"eye",label:r?oo.showNamed({name:o}):oo.hideNamed({name:o}),onClick:()=>Sl(e,n,t),children:/* @__PURE__ */pt(r?st:dt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},kl=e=>nd(Oe,e),Sl=(e,n,t)=>{bo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},wl=e=>Pe(Ut,e),xl=e=>Be(Ut,e),zl=e=>gr.slotsOf?Ei(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Me(e,n.slot)})):[{slot:null,rung:null,kids:re(Ut,e)}],Cl=e=>gr.slotsOf?zl(e).flatMap(e=>e.kids):re(Ut,e),Ol=e=>Boolean(gr.slotsOf)&&Ei(e).some(e=>e.rung),Nl=(e,n,t)=>Sr(e.type,n,t??void 0,xr(e)),Il=(e,n,t)=>{const o=Te(Ut,e.type,n)&&(t||Cl(e).length>0||Ol(e));return{collapsible:o,folded:o&&Ur(String(e.props.id))}},Bl=(e,n,t)=>zl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Il(e,r,t(e.type)).collapsible?[String(e.props.id),...Bl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Pl=e=>Cl(e).length>0||Ol(e)||Boolean(Sr(e.type)),$l=e=>Boolean(Sr(e)),Ml=(e,n,t,o)=>{if(or(V),Sr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),bo.select({index:n,zone:e}),l(t)}else bo.select({index:n,zone:e}),l(t)},Tl=(e,n,t,o,r)=>{const i=`${e}:${n}`;bo.insertComponent(i,t,o),Sr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),bo.select({index:o,zone:i})}):bo.select({index:o,zone:i})},jl=An(/* @__PURE__ */new Set);Fn(()=>{hi.forEach(e=>{const n=Sr(e.type)?.spec;if(!n)return;const t=e.props.id;if(jl.current.has(t))return;jl.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(Ii)).forEach((e,t)=>go.seedChild(o,t,n.childType,e))})},[hi,go,Ii]);const El=An(/* @__PURE__ */new Set);Fn(()=>{hi.forEach((n,t)=>{const o=n.props.id;if(El.current.has(o))return;const r=e(n,wl(n.type));El.current.add(o),r&&go.replaceComponent(Oe,t,{...n,props:r})})},[hi,go]),_(go,Ut);const Al=hi.findIndex(eo),Ll=Al>=0?hi[Al]:null,Rl=no?hi.findIndex(qt):-1,Fl=Rl>=0?hi[Rl]:null,Dl=Yt.groupTab,Vl=Ln(()=>Dl?e=>Zt(e.type):void 0,[Dl]),Wl=Boolean(Yt.groupBadge),Hl=Yt.sharedReach,Ul=e=>Hl?.(e)??void 0,Yl=Ln(()=>Hl?new Set(hi.filter(e=>Ul(e)).map(e=>String(e.props.id))):null,[hi,Hl]),Jl=Ln(()=>Yl?e=>Yl.has(e):void 0,[Yl]),Xl=Yt.first?Hl?.({type:Yt.first,props:{id:""}})??void 0:void 0,Ql=Yt.groupBadge?/* @__PURE__ */pt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */pt(Yn,{tone:"info",size:"xs",children:Yt.groupBadge})}):void 0,Zl=hi.find(e=>e.type===Xt)??null,Kl=hi.find(e=>e.type===Qt)??null,Gl=Al>=0?Al:hi.length,_l=[];hi.forEach(e=>{eo(e)||(Pl(e)&&_l.push(String(e.props.id)),_l.push(...Bl(e,1,$l)))}),Ll&&(_l.push(String(Ll.props.id)),_l.push(...Bl(Ll,1,$l)));const ql=_l.length>0&&_l.every(e=>Lr.has(e)),es=e=>{const n=zr.blockRowName(e,Ni);return zr.rowName?zr.rowName(e,"block",n):n},ns=(e,n,t,o)=>{const r=Ti(e)[t];if(!r)return;const i={...xn(e),index:t},l={...xn(n),index:Math.min(Math.max(o,0),Ti(n).length)},s=bn(i,l);if(e!==n||s!==t)try{ki.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Cn))throw e}},ts=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of xl(e))n.add(r),t(o)};for(const t of wl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},os=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=$i.get(n);if(!e)return null;if(e.zone===Oe)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},rs=e=>{const n=e.slice(0,e.indexOf(":")),t=hi.find(e=>Zt(e.type)&&String(e.props.id)===n);return t&&Kt(n)===e?t:null},is=(e,n)=>{const t=rs(e);return!t||(!Yt.groupAccepts||Yt.groupAccepts(t.type,n,Ti(e).length))},ls=(e,n,t)=>{if(e.rung){const t=ji(e.rung.nodeId),o=t?Ei(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===wt&&n.index>=0&&n.index<=o}if(n.slot===wt)return!1;if(e.add)return cs(e.add,n);const o=wn(n);if(Zt(e.type))return!1;const r=rs(o),i=rs(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!is(o,e.type))&&(n.index>=0&&n.index<=Ti(o).length));if(e.zone===Oe||o===Oe){if(e.zone!==o)return!1;const{floor:t,cap:r}=mi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Ti(o).length)return!1;if(e.zone===o)return!0;const l=Ll&&!Yt.lastIsOpen?String(Ll.props.id):null;return(!l||os(e.zone)!==l&&os(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Ti(e)[t];if(!r)return!1;const i=n.split(":")[0],l=$i.get(i),s=l?Ti(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ts(r).has(n))return!1;const d=Sr(s.type,br(Ft?.data,s.type,i),n.slice(n.lastIndexOf(":")+1),xr(s));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Ti(n),r))})(e.zone,o,e.index,t)},ss=(e,n)=>{const t=wn(e.from),o=e.node;return t===wn(n)?is(t,o.type):ls({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},ds=e=>{const n=e.slice(0,e.indexOf(":")),t=$i.get(n),o=t?Ti(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Sr(o.type,br(Ft?.data,o.type,n),e.slice(e.lastIndexOf(":")+1),xr(o));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=$(r.choices??(r.spec?[{type:r.spec.childType,label:Ni(r.spec.childType)}]:[])),l=Ai(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:fl(o,t.zone===Oe)}},as=(e,n)=>{if("section"!==e.kind)return e;const t=wn(n);return t===Oe||rs(t)?e:ds(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},cs=(e,n)=>{const t=as(e,n),o=wn(n);if("shared"===t.kind){if(o!==Oe||!Yt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=mi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(rs(o)){if("preset"===t.kind)return!1;const e="section"===t.kind?t.type:t.template.node.type;return is(o,e)&&n.index>=0&&n.index<=Ti(o).length}if(o!==Oe)return!1;const{floor:e,cap:r}=mi();return n.index>=e&&n.index<=r}if(o===Oe)return!1;const r=ds(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Ti(o))},ps=(e,n)=>{const t=as(e,n);if("block"!==t.kind&&rs(wn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&is(n,o)){if("section"===e.kind)bo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;bo.insertNode(n,t,vi(e.template.node))}or(V),bo.select({index:t,zone:n})}})(t,wn(n),n.index);if("section"===t.kind)return void al(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=ll(t),r=bo.insertNode(Oe,o,n);dl(o,r,e)})(t.template.name,vi(t.template.node),n.index);if("preset"===t.kind)return void((e,n,t)=>{const o=n({nodeDefaults:Ii,newNodeId:$e,sectionLabel:Bi,blockIsOffered:wr});if(!o)return;const r=ll(t),i=bo.insertNode(Oe,r,o);dl(r,i,e)})(t.preset.label,t.preset.insert,n.index);if("shared"===t.kind){const e=Yt.shared?.nodeOf(t.section);if(!e)return;const o=ll(n.index);return void(ki.restore(e,{parentId:kn,slot:Sn,index:o})&&dl(o,e.props.id,t.section.title))}const o=wn(n),r=ds(o);r&&(r.target.spec?Tl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{bo.insertComponent(e,n,t),or(V),bo.select({index:t,zone:e})})(o,t.type,n.index))},us=(e,n)=>{e.media?function(e){const n=Ks();if(!n||!Xs)return;_s(n).then(n=>{n&&function(e,n){if(!Xs)return;const t=Xs.create(e,{nodeDefaults:Ii,newNodeId:$e,sectionLabel:Bi,blockIsOffered:wr}),o=wn(n);if(o===Oe){const e=ll(n.index),o=bo.insertNode(Oe,e,t);return void dl(e,o,Bi(t.type))}bo.insertNode(o,n.index,t),or(V),bo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Wi(e.rung.nodeId,e.index,n.index):e.add?ps(e.add,n):e.zone===Oe?sl(e.index,n.index):ns(e.zone,wn(n),e.index,n.index)},[fs]=Rn(()=>yn()),hs=vn({keyOf:e=>e.id,readOnly:Boolean(Mt),session:fs,canDrop:ls,onDrop:us,onStep:(e,n)=>{e.rung?Wi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Oe?((e,n)=>{const t=Bi(hi[e]?.type??""),o=sl(e,n<0?e-1:e+2);if(!o.moved)return void Zr(n<0?oo.sectionFirst({name:t}):oo.sectionLast({name:t}));const{floor:r,cap:i}=mi();Zr(oo.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):ns(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ms=Dn(e=>{const{floor:n,cap:t}=mi(),o=[];for(const r of e.nodes){const e=wn(r.place),i=Ti(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(qt(i)||eo(i)||yr(i.type,i))continue;if(Zt(i.type))continue;const l=Boolean(rs(e)),s=e===Oe||l;e===Oe&&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?Bi(i.type):Yi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=wn(e.list);if(n===Oe&&0===e.children.length)return[{...e,addLabel:oo.addSection,addAlways:!0}];const t=ds(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(rs(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=wn(e.list),t=n===Oe||rs(n)?null:ds(n);return t?.choices.length?fn(e,t.target.spec?.addLabel??oo.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Ft.data]),gs=null==Wt?.props.id?null:String(Wt.props.id),ys=Wn(Ae),vs=ys?.selected()&&Wo?.document&&gs?ys.selectedPart?.(Wo.document)??null:null,bs=vs&&gs&&Le(Ft.data,Ut,gs,vs)?vs:null,ks=bs?.label?{element:bs.element,label:bs.label}:null,Ss=null!==bs,ws=Dn(e=>{const n=Ut,t=e=>!e.item.rung&&null!==zn(Ft.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(gs);return i?Ss?null:i:r(Ke(Ft.data,n,o.item.id,gs,Vl))??o},[Ft.data,Ut,gs,Vl,Ss]),[xs,zs]=Rn(null),[Cs,Os]=Rn(null),Ns=zr.canvasTab,Is=Boolean(Dl||Hl||Ns);Pn(Wo,"mouseover",e=>{if(!Is)return;const n=$n(e.target),t=n?yt(Ft.data,Ut,n):null;t!==xs&&zs(t),Ns&&n!==Cs&&Os(n)}),Pn(Wo,"mouseout",e=>{Is&&!e.relatedTarget&&(zs(null),Os(null))});const Bs=e=>qt(e)||eo(e)||Zt(e.type),Ps=e=>{const n=Zt(e.type)?Ni(e.type):qt(e)?oo.header:eo(e)?oo.footer:null;return null===n?Pi(e):zr.rowName?zr.rowName(e,"section",n):n},$s=[];if(Is){const e=gs?yt(Ft.data,Ut,gs):null;for(const n of/* @__PURE__ */new Set([e,xs])){const e=n?hi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=qt(e)||e.type===Xt,o=Ul(e);if(o){$s.push({id:String(e.props.id),label:Ps(e),below:t,reach:o});continue}if(!Dl||!Bs(e))continue;const r=Dl(e);r&&$s.push({id:String(e.props.id),label:r,below:t})}for(const e of Ns?/* @__PURE__ */new Set([gs,Cs]):[]){const n=e?ji(e):void 0,t=n?Ns(n):null;t&&!$s.some(n=>n.id===e)&&$s.push({id:e,label:t,below:!1,above:!0})}}const Ms=fe(),Ts=An(null);Fn(()=>{const e=Yt.changeNotice;if(!e)return;const n=JSON.stringify(hi.filter(Bs)),t=Ts.current;if(Ts.current={doc:Un,bands:n,index:Vt.index},!t||t.doc!==Un||t.bands===n)return;Vt.hasPast&&Vt.index>=t.index&&!gt.has(Ms)&&(gt.add(Ms),Zr(e,"success",{action:{label:oo.bar.undo,onClick:()=>Vt.back()},duration:8e3}))},[hi]);const js=e=>{or(V),bo.select(e.zone===Oe?{index:e.index}:{index:e.index,zone:e.zone})},Es=q(),As=()=>({data:Ft.data,device:Io,ops:bo,inspector:fr}),Ls=Es?.model,Rs=Ln(()=>Ls?e=>Ls(e,ms(e),As()):ms,[Ls,ms,Io]),Fs=Es?.measure,Ds=Fs?(e,n)=>Fs(e,n,As()):void 0,Vs=Es?.canDrop,Ws=Vs?(e,n)=>Vs(e,n,ls,As()):ls,Hs=Es?.drop,Us=Hs?(e,n)=>Hs(e,n,us,As()):us,Ys=Es?.pick,Js=Ys?e=>Ys(e,js,As()):js,Xs=Es?.media??null,Qs=An(null),Zs=Ln(()=>Xs?{id:ht,zone:"",index:-1,type:Xs.adds.type,add:{kind:Xs.adds.kind,type:Xs.adds.type},media:!0}:null,[Xs]);Fn(()=>{if(!Zs||Mt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(nt))(e)&&(Qs.current=null,fs.start({key:ht,item:Zs}))},n=e=>{fs.get()?.item.media&&(Qs.current=Zn(e.dataTransfer))},t=()=>{fs.get()?.item.media&&fs.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)}},[Zs,Mt,fs]);const Ks=()=>{const e=Qs.current;return Qs.current=null,e},Gs=ce(),_s=async e=>{if(!Gs)return e;const n=await Gs(e);return n?{...e,id:n.id,url:n.url}:null};const qs=(e,n)=>{if(!Xs)return;const t=zn(vo.getState().appState.data,gi,n);if(!t)return;const o=t.node;bo.replaceComponent(wn(t.place),t.place.index,{...o,props:{...Xs.replace(o,e),id:o.props.id}})},ed=e=>{const n=wn(e),t=Ai(n);t&&Di(t.node,t.slot,!1),pl(n,e.index)},nd=(e,n)=>/* @__PURE__ */pt(Ye,{...Mt?{}:hs.seam({place:{...xn(e),index:n}})},`seam:${e}:${n}`),td={rowClick:hl,isCollapsed:Ur,toggleCollapse:Yr},od=e=>{const n=String(e.props.id),t=hi.findIndex(e=>String(e.props.id)===n),o=Kt(n),r=Ti(o),i=Ur(n),l=Ni(e.type),s=zr.rowName?zr.rowName(e,"section",l):l,d=e=>nd(o,e);/* @__PURE__ */
16
16
  return ut(ft,{children:[
17
- /* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:e.type,size:13}),name:s,preview:gl(e),marks:yl(e),onSelect:()=>il(t),nameSlot:Ji(Be,t,n,s),selected:rr===n,badge:Ul(e)?void 0:Ql,shared:Ul(e),actions:vl(e,Be,t)??void 0,rowProps:{"data-node-id":n,onClick:hl(()=>il(t))},fold:{open:!i,label:"section",onToggle:()=>Xr(n)}}),!i&&/* @__PURE__ */ut(Ve,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Pi(n),l=Pl(n),s=l&&Ur(r),a=()=>Tl(o,t,r,e.type),{rowProps:c,...p}=hs.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Mn(o),index:t}},{"data-node-id":r,onClick:hl(a)});/* @__PURE__ */
17
+ /* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:e.type,size:13}),name:s,preview:gl(e),marks:yl(e),onSelect:()=>il(t),nameSlot:Xi(Oe,t,n,s),selected:rr===n,badge:Ul(e)?void 0:Ql,shared:Ul(e),actions:vl(e,Oe,t)??void 0,rowProps:{"data-node-id":n,onClick:hl(()=>il(t))},fold:{open:!i,label:"section",onToggle:()=>Yr(n)}}),!i&&/* @__PURE__ */ut(Ve,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Pi(n),l=Pl(n),s=l&&Ur(r),a=()=>Ml(o,t,r,e.type),{rowProps:c,...p}=hs.row({item:{id:r,zone:o,index:t,type:n.type},place:{...xn(o),index:t}},{"data-node-id":r,onClick:hl(a)});/* @__PURE__ */
18
18
  return ut(Hn,{children:[d(t),
19
- /* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:n.type,size:13}),name:i,preview:gl(n),marks:yl(n),onSelect:a,nameSlot:Ji(o,t,r,i),selected:rr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Xr(r)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(o,t,i),vl(n,o,t),bl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */pt(Ve,{children:ld(n,2)})]},r)}),d(r.length)]})]})},rd=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=hs.dragging,d=!Ur(l)&&s?.rung?.nodeId!==i,a={...Mn(l),index:0},c=s&&!s.rung&&ls(s,a)?a:void 0,p=()=>Di(e,n,!0),{rowProps:u,...f}=hs.row({item:{id:`rung:${l}`,zone:`${i}:${wt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:wt,index:t},into:c,canDrag:Boolean(gr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:hl(p)}),h=Tt?null:gr.slotActions?.(e,n.slot);/* @__PURE__ */
19
+ /* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:n.type,size:13}),name:i,preview:gl(n),marks:yl(n),onSelect:a,nameSlot:Xi(o,t,r,i),selected:rr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Yr(r)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(o,t,i),vl(n,o,t),bl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */pt(Ve,{children:ld(n,2)})]},r)}),d(r.length)]})]})},rd=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=hs.dragging,d=!Ur(l)&&s?.rung?.nodeId!==i,a={...xn(l),index:0},c=s&&!s.rung&&ls(s,a)?a:void 0,p=()=>Di(e,n,!0),{rowProps:u,...f}=hs.row({item:{id:`rung:${l}`,zone:`${i}:${wt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:wt,index:t},into:c,canDrag:Boolean(gr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:hl(p)}),h=Mt?null:gr.slotActions?.(e,n.slot);/* @__PURE__ */
20
20
  return ut(Hn,{children:[n.heading,
21
- /* @__PURE__ */pt(De,{words:ro,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Ai===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Xr(l)},actions:h&&h.length>0?/* @__PURE__ */pt(ft,{children:h.map((t,o)=>/* @__PURE__ */pt(Ue,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Tt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Vi(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__ */pt(lt,{size:15}):/* @__PURE__ */pt(ct,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */pt(Ve,{children:r})]},l)},id=(e,n)=>{const t=zl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
- return pt(ft,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Nl(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)=>nd(e,n),p=/* @__PURE__ */ut(ft,{children:[i.map(({child:n,zone:t,index:o})=>{const r=rr===String(n.props.id),{collapsible:i,folded:s}=Ol(n,l,$l(n.type)),d=String(n.props.id),a=es(n),p=()=>Tl(t,o,d,e.type),{rowProps:u,...f}=hs.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Mn(t),index:o}},{"data-node-id":d,onClick:hl(p)});/* @__PURE__ */
21
+ /* @__PURE__ */pt(De,{words:ro,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Li===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Yr(l)},actions:h&&h.length>0?/* @__PURE__ */pt(ft,{children:h.map((t,o)=>/* @__PURE__ */pt(Ue,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Mt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Vi(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__ */pt(lt,{size:15}):/* @__PURE__ */pt(ct,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */pt(Ve,{children:r})]},l)},id=(e,n)=>{const t=zl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
+ return pt(ft,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Nl(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)=>nd(e,n),p=/* @__PURE__ */ut(ft,{children:[i.map(({child:n,zone:t,index:o})=>{const r=rr===String(n.props.id),{collapsible:i,folded:s}=Il(n,l,$l(n.type)),d=String(n.props.id),a=es(n),p=()=>Ml(t,o,d,e.type),{rowProps:u,...f}=hs.row({item:{id:d,zone:t,index:o,type:n.type},place:{...xn(t),index:o}},{"data-node-id":d,onClick:hl(p)});/* @__PURE__ */
23
23
  return ut(Hn,{children:[0===o&&c(t,0),
24
- /* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:n.type,size:13}),name:a,preview:gl(n),marks:yl(n),onSelect:p,nameSlot:Ji(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Xr(d)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(t,o,a),vl(n,t,o),bl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */pt(Ve,{children:id(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?rd(e,t.rung,r++,o,p):/* @__PURE__ */pt(Hn,{children:p},t.slot??"")})})},ld=(e,n)=>{const t=br(Ft?.data,e.type,String(e.props.id)),o=zl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
- return pt(ft,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Nl(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),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>nd(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),v=/* @__PURE__ */ut(ft,{children:[l.map(({child:n,zone:t,index:o})=>{const r=rr===String(n.props.id),i=Xi(n),l=String(n.props.id),{collapsible:d,folded:a}=Ol(n,s,$l(n.type)),c=wl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Mn(p),index:Mi(p).length}:void 0,f=hs.dragging,h=u&&f&&ls(f,u)?u:void 0,g=()=>Tl(t,o,l,e.type),{rowProps:y,...v}=hs.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Mn(t),index:o},into:h,canDrag:!yr(n.type,n)},{"data-node-id":l,onClick:hl(g)});/* @__PURE__ */
24
+ /* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:n.type,size:13}),name:a,preview:gl(n),marks:yl(n),onSelect:p,nameSlot:Xi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Yr(d)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(t,o,a),vl(n,t,o),bl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */pt(Ve,{children:id(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?rd(e,t.rung,r++,o,p):/* @__PURE__ */pt(Hn,{children:p},t.slot??"")})})},ld=(e,n)=>{const t=br(Ft?.data,e.type,String(e.props.id)),o=zl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
+ return pt(ft,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Nl(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),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>nd(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),v=/* @__PURE__ */ut(ft,{children:[l.map(({child:n,zone:t,index:o})=>{const r=rr===String(n.props.id),i=Yi(n),l=String(n.props.id),{collapsible:d,folded:a}=Il(n,s,$l(n.type)),c=wl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...xn(p),index:Ti(p).length}:void 0,f=hs.dragging,h=u&&f&&ls(f,u)?u:void 0,g=()=>Ml(t,o,l,e.type),{rowProps:y,...v}=hs.row({item:{id:l,zone:t,index:o,type:n.type},place:{...xn(t),index:o},into:h,canDrag:!yr(n.type,n)},{"data-node-id":l,onClick:hl(g)});/* @__PURE__ */
26
26
  return ut(Hn,{children:[0===o&&m(t,0),
27
- /* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:n.type,size:13}),name:i,preview:gl(n),marks:yl(n),onSelect:g,nameSlot:Ji(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Xr(l)}:void 0,actions:yr(n.type,n)?vl(n,t,o)??void 0:/* @__PURE__ */ut(ft,{children:[ml(t,o,i),vl(n,t,o),bl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */pt(Ve,{children:ld(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
- /* @__PURE__ */pt(z,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Ml(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?rd(e,o.rung,i++,r,v):/* @__PURE__ */pt(Hn,{children:v},o.slot??"")})})},sd=Go,dd=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:So&&!sd&&mr===e.id,onSelect:()=>ui(e.id)}:e,ad=[...(hr.railLead??[]).map(dd),{id:"sections",label:oo.layers,icon:/* @__PURE__ */pt(ge,{}),active:So&&!sd&&"sections"===mr,onSelect:()=>ui("sections")},...(hr.railTrail??[]).map(dd)],cd=$o?{onPress:To}:Lt?{onPress:()=>{x(Sn,{accept:"image/*",title:po.mediaLibrary})}}:null,pd={value:ad.find(e=>!0===e.active)?.id??"",press:e=>{const n=ad.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:ad.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */pt("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},ud=[...hr.railLead??[],...hr.railTrail??[]].find(e=>"panel"in e&&e.id===mr),fd=Boolean(to?.foldable),hd=to?.label??(At?oo.pageSections:oo.templateSections),md=fd&&Ur(zt),gd=/* @__PURE__ */ut(ft,{children:[hi.map((e,n)=>{if(qt(e)||eo(e)||Gt(e.type))return null;const t=rr===String(e.props.id),o=Boolean(e.props._hidden);xl(e);const r=String(e.props.id),i=hr.hasOwnRows?.(e)??!1,l=Pl(e)||i,s=l&&Ur(r),d=wl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Mn(a),index:Mi(a).length}:void 0,p=hs.dragging,u=c&&p&&ls(p,c)?c:void 0,{rowProps:f,...h}=hs.row({item:{id:r,zone:Be,index:n,type:e.type},place:{...Mn(Be),index:n},into:u,canDrag:!yr(e.type,e)},{"data-node-id":r,onClick:hl(()=>il(n))});/* @__PURE__ */
27
+ /* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:n.type,size:13}),name:i,preview:gl(n),marks:yl(n),onSelect:g,nameSlot:Xi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Yr(l)}:void 0,actions:yr(n.type,n)?vl(n,t,o)??void 0:/* @__PURE__ */ut(ft,{children:[ml(t,o,i),vl(n,t,o),bl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */pt(Ve,{children:ld(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
+ /* @__PURE__ */pt(z,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Tl(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?rd(e,o.rung,i++,r,v):/* @__PURE__ */pt(Hn,{children:v},o.slot??"")})})},sd=Zo,dd=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:So&&!sd&&mr===e.id,onSelect:()=>ui(e.id)}:e,ad=[...(hr.railLead??[]).map(dd),{id:"sections",label:oo.layers,icon:/* @__PURE__ */pt(ge,{}),active:So&&!sd&&"sections"===mr,onSelect:()=>ui("sections")},...(hr.railTrail??[]).map(dd)],cd=$o?{onPress:Mo}:At?{onPress:()=>{x(Nn,{accept:"image/*",title:po.mediaLibrary})}}:null,pd={value:ad.find(e=>!0===e.active)?.id??"",press:e=>{const n=ad.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:ad.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */pt("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},ud=[...hr.railLead??[],...hr.railTrail??[]].find(e=>"panel"in e&&e.id===mr),fd=Boolean(to?.foldable),hd=to?.label??(Lt?oo.pageSections:oo.templateSections),md=fd&&Ur(zt),gd=/* @__PURE__ */ut(ft,{children:[hi.map((e,n)=>{if(qt(e)||eo(e)||Zt(e.type))return null;const t=rr===String(e.props.id),o=Boolean(e.props._hidden);xl(e);const r=String(e.props.id),i=hr.hasOwnRows?.(e)??!1,l=Pl(e)||i,s=l&&Ur(r),d=wl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...xn(a),index:Ti(a).length}:void 0,p=hs.dragging,u=c&&p&&ls(p,c)?c:void 0,{rowProps:f,...h}=hs.row({item:{id:r,zone:Oe,index:n,type:e.type},place:{...xn(Oe),index:n},into:u,canDrag:!yr(e.type,e)},{"data-node-id":r,onClick:hl(()=>il(n))});/* @__PURE__ */
29
29
  return ut(Hn,{children:[n>0&&kl(n),
30
- /* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:e.type,size:13}),name:Pi(e),preview:gl(e),marks:yl(e),shared:Ul(e),onSelect:()=>il(n),nameSlot:Ji(Be,n,r,Pi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Xr(r)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(Be,n,Pi(e)),vl(e,Be,n),bl(Be,n,e,Pi(e))]}),rowProps:f}),Pl(e)&&!s&&/* @__PURE__ */ut(Ve,{children:[ld(e,1),hr.partRows?.(e,td)]}),i&&!s&&/* @__PURE__ */pt(Ve,{children:hr.ownRows?.(e,n,td)})]},String(e.props.id??n))}),Zl>0&&kl(Zl)]}),yd=(e,n,t)=>{const o=String(e.props.id),r=Cl(e).length>0||Bl(e)||Boolean(Sr(e.type)),i=r&&Ur(o),l="header"===t?oo.header:oo.footer,s=zr.rowName?zr.rowName(e,"section",l):l;/* @__PURE__ */
30
+ /* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:e.type,size:13}),name:Pi(e),preview:gl(e),marks:yl(e),shared:Ul(e),onSelect:()=>il(n),nameSlot:Xi(Oe,n,r,Pi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Yr(r)}:void 0,actions:/* @__PURE__ */ut(ft,{children:[ml(Oe,n,Pi(e)),vl(e,Oe,n),bl(Oe,n,e,Pi(e))]}),rowProps:f}),Pl(e)&&!s&&/* @__PURE__ */ut(Ve,{children:[ld(e,1),hr.partRows?.(e,td)]}),i&&!s&&/* @__PURE__ */pt(Ve,{children:hr.ownRows?.(e,n,td)})]},String(e.props.id??n))}),Gl>0&&kl(Gl)]}),yd=(e,n,t)=>{const o=String(e.props.id),r=Cl(e).length>0||Ol(e)||Boolean(Sr(e.type)),i=r&&Ur(o),l="header"===t?oo.header:oo.footer,s=zr.rowName?zr.rowName(e,"section",l):l;/* @__PURE__ */
31
31
  return ut(ft,{children:[
32
- /* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:t,size:13}),name:s,preview:gl(e),marks:yl(e),badge:Ul(e)?void 0:Ql,shared:Ul(e),onSelect:()=>il(n),nameSlot:Ji(Be,n,o,s),selected:rr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Xr(o)}:void 0,actions:vl(e,Be,n)??void 0,rowProps:{"data-node-id":o,onClick:hl(()=>il(n))}}),r&&!i&&/* @__PURE__ */pt(Ve,{children:id(e,1)})]})};return(hr.wrap??(e=>e))(
33
- /* @__PURE__ */pt(ee,{target:Wo,children:/* @__PURE__ */ut("div",{ref:Vo,className:"sf-editor es-editor",style:ln(Fr),onContextMenu:qi.onEditorContextMenu,...p(Sn),children:[
34
- /* @__PURE__ */ut(Ze,{children:[
35
- /* @__PURE__ */ut("div",{className:"es-cluster es-cluster--left",children:[cd?/* @__PURE__ */pt(Yn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */pt(ye,{}),onClick:cd.onPress,children:oo.railMedia}):null,
36
- /* @__PURE__ */pt(_e,{label:oo.bar.undo,disabled:Boolean(Tt)||!Vt.hasPast,onClick:()=>Vt.back(),children:/* @__PURE__ */pt(tt,{})}),
37
- /* @__PURE__ */pt(_e,{label:oo.bar.redo,disabled:Boolean(Tt)||!Vt.hasFuture,onClick:()=>Vt.forward(),children:/* @__PURE__ */pt(ot,{})})]}),
32
+ /* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:t,size:13}),name:s,preview:gl(e),marks:yl(e),badge:Ul(e)?void 0:Ql,shared:Ul(e),onSelect:()=>il(n),nameSlot:Xi(Oe,n,o,s),selected:rr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Yr(o)}:void 0,actions:vl(e,Oe,n)??void 0,rowProps:{"data-node-id":o,onClick:hl(()=>il(n))}}),r&&!i&&/* @__PURE__ */pt(Ve,{children:id(e,1)})]})};return(hr.wrap??(e=>e))(
33
+ /* @__PURE__ */pt(ee,{target:Wo,children:/* @__PURE__ */ut("div",{ref:Vo,className:"sf-editor es-editor",style:ln(Fr),onContextMenu:qi.onEditorContextMenu,...p(Nn),children:[
34
+ /* @__PURE__ */ut(Ge,{children:[
35
+ /* @__PURE__ */ut("div",{className:"es-cluster es-cluster--left",children:[cd?/* @__PURE__ */pt(Jn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */pt(ye,{}),onClick:cd.onPress,children:oo.railMedia}):null,
36
+ /* @__PURE__ */pt(_e,{label:oo.bar.undo,disabled:Boolean(Mt)||!Vt.hasPast,onClick:()=>Vt.back(),children:/* @__PURE__ */pt(tt,{})}),
37
+ /* @__PURE__ */pt(_e,{label:oo.bar.redo,disabled:Boolean(Mt)||!Vt.hasFuture,onClick:()=>Vt.forward(),children:/* @__PURE__ */pt(ot,{})})]}),
38
38
  /* @__PURE__ */ut(qe,{children:[
39
- /* @__PURE__ */pt(en,{devices:xo,value:Oo,onChange:Io}),
40
- /* @__PURE__ */pt(_e,{label:oo.bar.refresh,tip:oo.bar.refreshTip,onClick:()=>{Do.current=(()=>{const e=Wo?.document;if(!e)return null;const n=hi.findIndex(eo),t=n>=0?n:hi.length;let o=null;for(let n=0;n<t;n++){const t=hi[n]?.props?.id;if(null==t)continue;const r=In(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=Wt?.props?.id??hi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Fo(e=>e+1)},children:/* @__PURE__ */pt(rt,{})}),hr.barView?.()]}),
39
+ /* @__PURE__ */pt(en,{devices:xo,value:Io,onChange:Bo}),
40
+ /* @__PURE__ */pt(_e,{label:oo.bar.refresh,tip:oo.bar.refreshTip,onClick:()=>{Do.current=(()=>{const e=Wo?.document;if(!e)return null;const n=hi.findIndex(eo),t=n>=0?n:hi.length;let o=null;for(let n=0;n<t;n++){const t=hi[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=Wt?.props?.id??hi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Fo(e=>e+1)},children:/* @__PURE__ */pt(rt,{})}),hr.barView?.()]}),
41
41
  /* @__PURE__ */ut(qe,{kind:"right",style:{minWidth:300},children:[
42
- /* @__PURE__ */pt(b,{input:Jo,words:oo.saveStatus}),Bn?/* @__PURE__ */pt(Bn,{}):null,hr.barLead?.(),hr.barTrail?.(),hr.mainAction||!hr.barMain?/* @__PURE__ */pt(k,{input:Jo,action:hr.mainAction??{label:oo.done,onPress:()=>{qn(Ft.data)}},readOnly:Boolean(Tt),saveSwitch:jt,onToggleAutoSave:Ot,onSaveNow:Qo,bar:oo.bar,words:oo.saveStatus}):hr.barMain()]})]}),
42
+ /* @__PURE__ */pt(b,{input:Xo,words:oo.saveStatus}),Mn?/* @__PURE__ */pt(Mn,{}):null,hr.barLead?.(),hr.barTrail?.(),hr.mainAction||!hr.barMain?/* @__PURE__ */pt(k,{input:Xo,action:hr.mainAction??{label:oo.done,onPress:()=>{qn(Ft.data)}},readOnly:Boolean(Mt),saveSwitch:jt,onToggleAutoSave:It,onSaveNow:Qo,bar:oo.bar,words:oo.saveStatus}):hr.barMain()]})]}),
43
43
  /* @__PURE__ */pt(v,{}),
44
44
  /* @__PURE__ */ut("div",{className:"sf-body",children:[So?/* @__PURE__ */ut(ft,{children:[
45
45
  /* @__PURE__ */ut("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":oo.leftPanel,children:[
46
46
  /* @__PURE__ */ut("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
47
- /* @__PURE__ */pt(O,{side:"left",onHide:ci}),
47
+ /* @__PURE__ */pt(I,{side:"left",onHide:ci}),
48
48
  /* @__PURE__ */pt("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
49
- /* @__PURE__ */pt(Jn,{variant:"underline",block:!0,"aria-label":oo.bar.views,value:pd.value,onChange:pd.press,items:pd.items})]}),Go?/* @__PURE__ */pt(C,{at:_o?{label:(e=>{const n=rs(e.zone);if(n)return oo.add.addingTo({name:zr.rowName?fl(n,!0):Ni(n.type)});if(e.zone===Be){const n=hi[e.index];return n&&!eo(n)?oo.add.addingBefore({name:fl(n,!0)}):oo.add.addingAtEnd}const t=ds(e.zone);return t?oo.add.addingTo({name:t.parentName}):oo.add.addingHere})(_o),onClear:()=>qo(null)}:void 0,placeBlocks:_o&&_o.zone!==Be?ds(_o.zone)?.choices:void 0,canTake:_o?e=>{if(!_o)return null;const n={...Mn(_o.zone),index:_o.index};if(cs(e,n))return null;if("shared"===e.kind&&_o.zone===Be&&!Xt.shared?.nodeOf(e.section))return oo.shared.alreadyHere;const t=rs(_o.zone);if(t)return oo.add.notInside({name:fl(t,!0)});if(_o.zone===Be)return oo.add.onlySections;const o=ds(_o.zone);return o?oo.add.notInside({name:o.parentName}):oo.add.onlySections}:void 0,onPick:_o?e=>{if(!_o)return;const n={...Mn(_o.zone),index:_o.index};cs(e,n)&&(ps(e,n),ul())}:void 0,itemFor:e=>({id:`new:${e.kind}:${xt(e)}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:xt(e),add:e}),session:fs,siteWide:hr.addPanelRow?.(ul),onClose:ul,readOnly:Boolean(Tt)}):ud?ud.panel({onHide:ci,notify:Gr}):/* @__PURE__ */ut(ft,{children:[
50
- /* @__PURE__ */pt(I,{icon:/* @__PURE__ */pt(ge,{}),title:oo.layers,context:uo,actions:/* @__PURE__ */ut(ft,{children:[!Tt&&/* @__PURE__ */pt(nn,{label:oo.add.title,onClick:()=>cl(null),children:/* @__PURE__ */pt(it,{size:15})}),
49
+ /* @__PURE__ */pt(Xn,{variant:"underline",block:!0,"aria-label":oo.bar.views,value:pd.value,onChange:pd.press,items:pd.items})]}),Zo?/* @__PURE__ */pt(C,{at:_o?{label:(e=>{const n=rs(e.zone);if(n)return oo.add.addingTo({name:zr.rowName?fl(n,!0):Ni(n.type)});if(e.zone===Oe){const n=hi[e.index];return n&&!eo(n)?oo.add.addingBefore({name:fl(n,!0)}):oo.add.addingAtEnd}const t=ds(e.zone);return t?oo.add.addingTo({name:t.parentName}):oo.add.addingHere})(_o),onClear:()=>qo(null)}:void 0,placeBlocks:_o&&_o.zone!==Oe?ds(_o.zone)?.choices:void 0,canTake:_o?e=>{if(!_o)return null;const n={...xn(_o.zone),index:_o.index};if(cs(e,n))return null;if("shared"===e.kind&&_o.zone===Oe&&!Yt.shared?.nodeOf(e.section))return oo.shared.alreadyHere;const t=rs(_o.zone);if(t)return oo.add.notInside({name:fl(t,!0)});if(_o.zone===Oe)return oo.add.onlySections;const o=ds(_o.zone);return o?oo.add.notInside({name:o.parentName}):oo.add.onlySections}:void 0,onPick:_o?e=>{if(!_o)return;const n={...xn(_o.zone),index:_o.index};cs(e,n)&&(ps(e,n),ul())}:void 0,itemFor:e=>({id:`new:${e.kind}:${xt(e)}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:xt(e),add:e}),session:fs,siteWide:hr.addPanelRow?.(ul),onClose:ul,readOnly:Boolean(Mt)}):ud?ud.panel({onHide:ci,notify:Zr}):/* @__PURE__ */ut(ft,{children:[
50
+ /* @__PURE__ */pt(B,{icon:/* @__PURE__ */pt(ge,{}),title:oo.layers,context:uo,actions:/* @__PURE__ */ut(ft,{children:[!Mt&&/* @__PURE__ */pt(nn,{label:oo.add.title,onClick:()=>cl(null),children:/* @__PURE__ */pt(it,{size:15})}),
51
51
  /* @__PURE__ */pt(nn,{label:ql?oo.expandAll:oo.collapseAll,title:0===_l.length?oo.nothingToFold:void 0,disabled:0===_l.length,onClick:()=>Rr(e=>{const n=new Set(_l);return ql?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,..._l])}),children:/* @__PURE__ */pt(bt,{expand:ql})})]})}),
52
- /* @__PURE__ */ut(We,{className:"sf-tree sf-scroll",words:ro,children:[Gl&&/* @__PURE__ */ut(ft,{children:[!Wl&&/* @__PURE__ */pt(He,{children:oo.header}),od(Gl)]}),Rt&&!(Wl&&Gl)&&/* @__PURE__ */ut(ft,{children:[!Wl&&/* @__PURE__ */pt(He,{children:oo.header}),!no&&/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Br,{type:"header",size:13}),name:oo.header,badge:Jl?void 0:Ql,shared:Jl,onSelect:fi,selected:tr.kind===_t?.kind,rowProps:{onClick:hl(fi)}})]}),Fl&&!(Wl&&Gl)&&yd(Fl,Rl,"header"),!fd&&/* @__PURE__ */pt(He,{children:hd}),fd?/* @__PURE__ */ut(ft,{children:[
53
- /* @__PURE__ */pt(De,{words:ro,icon:null,name:hd,fold:{open:!md,label:hd,onToggle:()=>Xr(zt)}}),!md&&/* @__PURE__ */pt(Ve,{children:gd})]}):gd,Rt&&!Wl&&/* @__PURE__ */pt(He,{children:oo.footer}),Al&&!(Wl&&Kl)&&yd(Al,Ll,"footer"),Kl&&od(Kl),hr.treeFoot?.()]})]})]}),
52
+ /* @__PURE__ */ut(We,{className:"sf-tree sf-scroll",words:ro,children:[Zl&&/* @__PURE__ */ut(ft,{children:[!Wl&&/* @__PURE__ */pt(He,{children:oo.header}),od(Zl)]}),Rt&&!(Wl&&Zl)&&/* @__PURE__ */ut(ft,{children:[!Wl&&/* @__PURE__ */pt(He,{children:oo.header}),!no&&/* @__PURE__ */pt(De,{words:ro,icon:/* @__PURE__ */pt(Or,{type:"header",size:13}),name:oo.header,badge:Xl?void 0:Ql,shared:Xl,onSelect:fi,selected:tr.kind===_t?.kind,rowProps:{onClick:hl(fi)}})]}),Fl&&!(Wl&&Zl)&&yd(Fl,Rl,"header"),!fd&&/* @__PURE__ */pt(He,{children:hd}),fd?/* @__PURE__ */ut(ft,{children:[
53
+ /* @__PURE__ */pt(De,{words:ro,icon:null,name:hd,fold:{open:!md,label:hd,onToggle:()=>Yr(zt)}}),!md&&/* @__PURE__ */pt(Ve,{children:gd})]}):gd,Rt&&!Wl&&/* @__PURE__ */pt(He,{children:oo.footer}),Ll&&!(Wl&&Kl)&&yd(Ll,Al,"footer"),Kl&&od(Kl),hr.treeFoot?.()]})]})]}),
54
54
  /* @__PURE__ */pt(tn,{side:"left",width:Fr.left,min:rn.left,max:on,defaultWidth:h.left,label:oo.resizeLeftPanel,onResize:Wr})]}):/* @__PURE__ */pt(P,{side:"left",onShow:ci}),
55
- /* @__PURE__ */ut("div",{ref:Kr,className:"sf-center sf-scroll","data-sf-canvas-head":ni?"":void 0,style:{overflowX:si?"auto":"hidden",overflowY:"hidden"},children:[ni&&/* @__PURE__ */pt("div",{ref:ti,className:"sf-canvas-head",children:/* @__PURE__ */pt(ni,{device:Oo})}),
55
+ /* @__PURE__ */ut("div",{ref:Kr,className:"sf-center sf-scroll","data-sf-canvas-head":ni?"":void 0,style:{overflowX:si?"auto":"hidden",overflowY:"hidden"},children:[ni&&/* @__PURE__ */pt("div",{ref:ti,className:"sf-canvas-head",children:/* @__PURE__ */pt(ni,{device:Io})}),
56
56
  /* @__PURE__ */ut("div",{className:"sf-frame-scaler",style:di,children:[
57
- /* @__PURE__ */pt("div",{className:"sf-frame "+(Oo===Bo?"":`sf-frame--${Oo}`),style:ai,children:/* @__PURE__ */ut("div",{className:"sf-preview-host",children:[
58
- /* @__PURE__ */pt(Re.Provider,{value:Vl,children:/* @__PURE__ */pt(Fe.Provider,{value:Yl,children:/* @__PURE__ */pt(fo,{},Ro)})}),
59
- /* @__PURE__ */pt(hn,{canvas:Wo,session:fs,model:Rs,measure:Ds,canDrop:Ws,onDrop:Us,choose:ws,tag:ks,onPick:Ys,dropOn:Js?{accepts:(e,n)=>{if(!e.media||!Js||n.item.rung)return!1;const t=jn(Ft.data,gi,n.item.id);return null!==t&&Js.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ks();n&&Js&&_s(n).then(n=>{n&&qs(n,e.item.id)})})(n),label:()=>oo.canvasReplaceImage}:void 0,onZoneAdd:ed,onSeamAdd:ed,zoneAddLabel:oo.canvasAddBlock,words:io.canvas,readOnly:Boolean(Tt),revision:Ft.data}),er.length>0&&!Ho&&/* @__PURE__ */pt("div",{className:"sf-preview-gaps",children:er.map(e=>
60
- /* @__PURE__ */pt(mn,{index:e.index,label:oo.addSectionHere,onInsert:()=>cl(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))})]})}),Os?/* @__PURE__ */pt(vt,{canvas:Wo,tabs:$s,onSelect:Fi}):null]})]}),wo?/* @__PURE__ */ut(ft,{children:[Nn?
61
- /* @__PURE__ */pt("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Nn}):/* @__PURE__ */pt(ft,{children:/* @__PURE__ */pt(u,{value:{selectChild:Tl,addChild:Ml,childRowName:Xi,blockRowName:es},children:/* @__PURE__ */pt(ho,{mode:tr,onOpenWebsiteSettings:hr.openSettings??(()=>{}),onOpenSiteStyles:hr.openStyles,onOpenPageStyles:hr.openPageStyles,onSelectNode:Pr,onNotify:Gr,onHidePanel:pi,nodeActions:Wt?Ne(Ut,Wt.type):Ct})})}),
57
+ /* @__PURE__ */pt("div",{className:"sf-frame "+(Io===Oo?"":`sf-frame--${Io}`),style:ai,children:/* @__PURE__ */ut("div",{className:"sf-preview-host",children:[
58
+ /* @__PURE__ */pt(Re.Provider,{value:Vl,children:/* @__PURE__ */pt(Fe.Provider,{value:Jl,children:/* @__PURE__ */pt(fo,{},Ro)})}),
59
+ /* @__PURE__ */pt(hn,{canvas:Wo,session:fs,model:Rs,measure:Ds,canDrop:Ws,onDrop:Us,choose:ws,tag:ks,onPick:Js,dropOn:Xs?{accepts:(e,n)=>{if(!e.media||!Xs||n.item.rung)return!1;const t=zn(Ft.data,gi,n.item.id);return null!==t&&Xs.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ks();n&&Xs&&_s(n).then(n=>{n&&qs(n,e.item.id)})})(n),label:()=>oo.canvasReplaceImage}:void 0,onZoneAdd:ed,onSeamAdd:ed,zoneAddLabel:oo.canvasAddBlock,words:io.canvas,readOnly:Boolean(Mt),revision:Ft.data}),er.length>0&&!Ho&&/* @__PURE__ */pt("div",{className:"sf-preview-gaps",children:er.map(e=>
60
+ /* @__PURE__ */pt(mn,{index:e.index,label:oo.addSectionHere,onInsert:()=>cl(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))})]})}),Is?/* @__PURE__ */pt(vt,{canvas:Wo,tabs:$s,onSelect:Fi}):null]})]}),wo?/* @__PURE__ */ut(ft,{children:[Tn?
61
+ /* @__PURE__ */pt("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Tn}):/* @__PURE__ */pt(ft,{children:/* @__PURE__ */pt(u,{value:{selectChild:Ml,addChild:Tl,childRowName:Yi,blockRowName:es},children:/* @__PURE__ */pt(ho,{mode:tr,onOpenWebsiteSettings:hr.openSettings??(()=>{}),onOpenSiteStyles:hr.openStyles,onOpenPageStyles:hr.openPageStyles,onSelectNode:Pr,onNotify:Zr,onHidePanel:pi,nodeActions:Wt?Ne(Ut,Wt.type):Ct})})}),
62
62
  /* @__PURE__ */pt(tn,{side:"right",width:Fr.right,min:rn.right,max:on,defaultWidth:h.right,label:oo.resizeSettingsPanel,onResize:Hr})]}):
63
63
  /* @__PURE__ */pt(P,{side:"right",onShow:pi})]}),qi.menu,
64
- /* @__PURE__ */pt(ie,{}),wi?/* @__PURE__ */pt(mt,{name:wi.name,onMake:e=>(async(e,n)=>{const t=hi.find(n=>String(n.props.id)===e),o=Xt.shared;if(!t||!o)return;let r;try{r=await N(Si).create(n,t)}catch{return void Gr(oo.shared.makeFailed,"error")}o.adopt(t,r),xi(null)})(wi.id,e),onCancel:()=>xi(null)}):null]})}))}export{Nt as ScreenChrome};
64
+ /* @__PURE__ */pt(ie,{}),wi?/* @__PURE__ */pt(mt,{name:wi.name,onMake:e=>(async(e,n)=>{const t=hi.find(n=>String(n.props.id)===e),o=Yt.shared;if(!t||!o)return;let r;try{r=await N(Si).create(n,t)}catch{return void Zr(oo.shared.makeFailed,"error")}o.adopt(t,r),xi(null)})(wi.id,e),onCancel:()=>xi(null)}):null]})}))}export{Nt as ScreenChrome};
@@ -0,0 +1 @@
1
+ import{panelFieldsOf as t}from"./chunk-5XL2RXFU.js";import{DESIGN_GROUP_KEY as o,BUCKET_KEY as n}from"./chunk-3QB2ZQXK.js";import{withoutDeviceGate as e}from"./chunk-7GGNFLHT.js";import{STYLE_KIND as r,fieldKind as s,copyStyle as c,heldStyle as i,planPaste as p,pasteMessage as u}from"./chunk-CWELHADJ.js";import{ANCHOR_FIELD_KEYS as f,foldMetaOf as a,MEDIA_FIELD_MARKER as l,TEXT_FIELD_MARKER as m,LINK_FIELD_MARKER as h}from"./chunk-ANPOR6EY.js";import{deviceMetaOf as y}from"./chunk-YCSZAP7T.js";var j=/* @__PURE__ */new Set([o.Size,o.Design,o.Layout,o.Position]),w=new Set(Object.values(o)),b=new Set(Object.values(n)),S=new Set(f),k=/* @__PURE__ */new Set(["focal","imageFocal"]),g=[l,m,h];function v(t){return`site:${t??""}`}function A(t){if(!t||"object"!=typeof t)return null;const o=t,n=e(t)??t,c=o[r]??n[r];if("string"==typeof c)return c;const i=o.options??n.options;if(Array.isArray(i)){return`choice:${i.map(t=>String(t?.value)).sort().join("|")}`}return s(n)}function L(t){const o=t,n=e(t);return g.some(t=>t in o||n&&t in n)}function O(o,e){const r=t(o,e)??{},s=[];let c=!0,i=!1;for(const[t,o]of Object.entries(r))b.has(t)?(c=t===n.Design,i=!1):w.has(t)?c&&(i=j.has(t)):i&&o&&"object"==typeof o&&!t.startsWith("_")&&(a(o)||S.has(t)||k.has(t)||L(o)||"slot"!==o.type&&s.push({path:[t],kind:A(o),counted:"mobile"!==y(o)?.tier}));return s}function d(t,o,n,e,r){c({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function D(t,o,n,e,r,s){const c=i(n);if(!c)return null;const f=p(c,{type:e.type,rows:t(o,e),props:e.props});return{...f,message:u(f,c.sourceLabel,r,s)}}function F(t,o,n,e){d(O,t,o,n,e)}function P(t,o,n,e,r){return D(O,t,o,n,e,r)}var X={scope:t=>v(t.siteId),rows:(t,o)=>O(t,o),copy:(t,o,n,e)=>F(e,t,o,n),plan:(t,o,n,e)=>P(e,t,o,n)};function C(t,o){if(!t&&!o)return X;const n=t?.rows,e=n?(t,o)=>n(t,o):O;return{scope:t?.scope??X.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>d(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>D(e,s,t,n,r,o))}}export{F as copyNodeStyle,O as nodeStyleRows,P as planNodePaste,A as shopFieldKind,v as siteStyleScope,C as styleClipboardOf};
@@ -1 +1 @@
1
- import{useScreenBlockRules as e}from"./chunk-LUHGBFOD.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-BBD3FLU3.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
1
+ import{useScreenBlockRules as e}from"./chunk-FT3O7X6U.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-53ME3GAI.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
@@ -0,0 +1 @@
1
+ import{parseZoneKey as t}from"./chunk-EUFDQ4KL.js";import{repeatWrapperAt as e,REPEAT_ATTRIBUTE as r,REPEAT_INDEX_ATTRIBUTE as n}from"./chunk-7UFKEX72.js";var o=`[${r}][${n}]`;function l(l){const c=e(l);if(!c)return null;let i;try{i=t(c.zone)}catch{return null}if(!i.parentId||!i.slot)return null;const{wrapper:a,zone:p,index:f}=c;let s=a.parentElement;for(let t=a.parentElement;t;t=t.parentElement)if(t.getAttribute("data-easel-block")===i.parentId){s=t;break}const d=/* @__PURE__ */new Set;for(const t of Array.from(s?.querySelectorAll(o)??[]))t.getAttribute(r)===p&&d.add(t.getAttribute(n)??"");const m={ownerId:i.parentId,slot:i.slot,index:f,count:Math.max(d.size,f+1)},y=a.parentElement?u(a.parentElement):null;return y&&(m.outer=y),{copy:m,wrapper:a}}function u(t){return l(t)?.copy??null}function c(t,e){return t&&e?t.ownerId===e.ownerId&&t.slot===e.slot&&t.index===e.index&&c(t.outer,e.outer):t===e}function i(t,e){for(const r of Array.from(t.querySelectorAll(o))){if(r.getAttribute(n)!==String(e.index))continue;const t=l(r);if(t?.wrapper===r&&c(t.copy,e))return r}return null}export{i as findCopy,u as repeatCopyAt,l as repeatCopyWithWrapper};
@@ -0,0 +1,13 @@
1
+ import{sidesStartEach as e,SidesInput as n,SidesEachToggle as t}from"./chunk-CLAADE4J.js";import{SettingsDefaultReset as o}from"./chunk-2T22IY3J.js";import{deviceField as l}from"./chunk-7GGNFLHT.js";import{noControlField as a,NoControlMark as i}from"./chunk-22I55W37.js";import{describedAs as r}from"./chunk-LX23TCTP.js";import{withStyleKind as u}from"./chunk-CWELHADJ.js";import{phoneKey as s}from"./chunk-E52W3M5I.js";import{foldMetaOf as c,FOLD_FIELD_MARKER as d}from"./chunk-ANPOR6EY.js";import{useSelectedHost as p,useEaselApi as f,useEasel as m}from"./chunk-53ME3GAI.js";import{DEFAULT_PANEL_WORDS as b}from"./chunk-56ID6FKZ.js";import{SettingsSwitch as h}from"./chunk-OECWLNKJ.js";import{FieldSelect as g}from"./chunk-KFWNGPW3.js";import{SettingsField as v}from"./chunk-MIX7EGRG.js";import{SettingsSegmented as y}from"./chunk-DX3VILZ3.js";import{useWords as k}from"./chunk-MFIRYGHW.js";import{useState as w}from"react";import{AlignmentIcon as C,BoxJustifyIcon as x,WrapIcon as j,GapIcon as F,WidthIcon as L,PlacementIcon as O,NudgeIcon as S,DesktopIcon as E,BoxXEndIcon as P,BoxXCenterIcon as I,BoxXStartIcon as A,PaddingAllIcon as K,BoxYBetweenIcon as R,BoxYStretchIcon as B,BoxYEndIcon as G,BoxYCenterIcon as M,BoxYStartIcon as W,BoxXBetweenIcon as N,BoxXStretchIcon as T,BoxItemAlignmentIcon as V}from"efficient-shell/icons/efficient";import{Slider as D,textAlignOptions as J,AlignmentGrid as $,PositionInput as _}from"efficient-shell/ui";import{jsx as X,Fragment as Y,jsxs as z}from"react/jsx-runtime";var H=e=>e;function Z(){return null}function U(e){if(!e.trim())throw new Error("noGlyph() needs a reason naming the ruling that decided it.");/* @__PURE__ */
2
+ return X(Z,{},e)}function q(e){return e.type===Z}function Q(e){return q(e)?void 0:e}function ee(e){for(const[n,t]of Object.entries(e))t&&"object"==typeof t&&!c(t)&&u(t,`section:${n}`);return e}function ne(e,n){return{type:"custom",[d]:{label:e,level:n},marker:!0,fold:e,render:()=>/* @__PURE__ */X(Y,{})}}function te(e){return ne(e,2)}function oe(e){return ne(e,1)}var le=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"Space between",value:"between"},{label:"End",value:"end"}],ae=[{label:"Start",value:"start"},{label:"Center",value:"center"},{label:"End",value:"end"},{label:"Stretch",value:"stretch"}],ie="Wrap",re=[{label:"Wrap",value:"wrap"},{label:"No wrap",value:"nowrap"}],ue="Direction",se=[{label:"Stacked",value:"column"},{label:"One row",value:"row"}],ce={min:-32,max:64,step:2,builtIn:0},de={min:30,max:100,step:5,fallback:60},pe=["top-left","top-center","top-right","left","center","right","bottom-left","bottom-center","bottom-right"],fe="bottom-left",me={"top-left":"Top left","top-center":"Top center","top-right":"Top right",left:"Left",center:"Center",right:"Right","bottom-left":"Bottom left","bottom-center":"Bottom center","bottom-right":"Bottom right"},be=pe.map(e=>({value:e,label:me[e]}));function he(e,n=fe){return pe.includes(e)?e:n}var ge=40,ve=e=>"number"==typeof e?e:null;function ye(e,n,t){const o={};for(const l of["x","y"])t[l]!==n[l]&&(o[e[l]]=t[l]??void 0);return o}var ke=["top","right","bottom","left"],we={top:"sectionPaddingTop",right:"sectionPaddingRight",bottom:"sectionPaddingBottom",left:"sectionPaddingLeft"},Ce=e=>"number"==typeof e?e:null;function xe(e,n,t){const o={};for(const l of ke)t[l]!==n[l]&&(o[e[l]]=t[l]??void 0);return o}function je(e){if("number"==typeof e)return{top:e,right:e,bottom:e,left:e};const n=e&&"object"==typeof e?e:{};return Object.fromEntries(ke.map(e=>[e,Ce(n[e])]))}function Fe(e){const n={};for(const t of ke)"number"==typeof e[t]&&(n[t]=e[t]);return Object.keys(n).length?n:void 0}function Le(e,n={}){const t=n=>{const t=n[e];return t&&"object"==typeof t?t:{}},o=e=>Object.hasOwn(n,e)?n[e]:e;return{read:(e,n)=>t(e)[o(n)],write:(n,l,a)=>{const i={...t(n)};return void 0===a?delete i[o(l)]:i[o(l)]=a,{[e]:Object.keys(i).length?i:void 0}}}}function Oe(e,n,t){const o=Se(e),l=p();if(t)return[t.value,t.onChange];const a=l?.values??{};return[e.read(a,n),e=>o([[n,e]])]}function Se(e){const n=p(),t=function(){try{return f()}catch{return null}}();return o=>{if(!n)return;const l=t?.getState(),a=(l?"root"===n.id?l.appState.data.root.props:l.getItemById(n.id)?.props:void 0)??n.values??{};let i={};for(const[n,t]of o)i={...i,...e.write({...a,...i},n,t)};n.onChangeMany(i)}}var Ee={read:(e,n)=>e[n],write:(e,n,t)=>({[n]:t})},Pe={fieldKey:s,ownField:!0,read:(e,n)=>e[s(n)],write:(e,n,t)=>({[s(n)]:t})};function Ie(e){return{...Le(e),fieldKey:n=>`_${e}_${n}`}}function Ae({row:e,desktopKey:n,access:t,props:o}){const l=p(),a=l?.values?.[n],[i,r]=Oe(t,n);return t.ownField?e.render({...o,follows:a}):e.render({...o,value:i,storedValue:i,follows:a,onChange:r})}function Ke(e,n,t=Pe){const o={...n,render:o=>/* @__PURE__ */X(Ae,{row:n,desktopKey:e,access:t,props:o})};return{[e]:l("desktop",n),[t.fieldKey(e)]:l("mobile",o)}}var Re=["left","center","right"];function Be(e,{options:n,value:t,onChange:o,ariaLabel:l,disabled:a=!1}){/* @__PURE__ */
3
+ return X(y,{options:n.map(n=>n.picture?{id:n.value,label:n.picture,title:e(n.title??n.label)}:{id:n.value,label:e(n.label),title:void 0===n.title?void 0:e(n.title)}),value:t,onChange:o,ariaLabel:e(l),disabled:a})}function Ge(e,{label:n,value:t,onChange:o,points:l}){const a=l.find(e=>e.disabled),i=l.map(n=>({...n,label:e(n.label),...n.title?{title:e(n.title)}:null}));/* @__PURE__ */
4
+ return X(v,{label:e(n),icon:/* @__PURE__ */X(O,{}),hint:a?.title?e(a.title):void 0,children:/* @__PURE__ */X($,{label:e(n),value:t,points:i,onChange:o})})}function Me({say:e,label:n,value:t,onChange:o,pointsFor:l}){const{appState:a,selectedItem:i}=m(e=>e),r=i?.props?.id?String(i.props.id):void 0;return Ge(e,{label:n,value:t,onChange:o,points:l(a?.data,r)})}function We({say:e,o:n}){const t=p(),l=k("panel",b),a=t?.values??{},i={x:ve(a[n.keys.x]),y:ve(a[n.keys.y])},r=e(n.label??"Position"),u=Boolean(i.x||i.y),s=e=>{const o=ye(n.keys,i,e);Object.keys(o).length&&t?.onChangeMany(o)},c=/* @__PURE__ */X(_,{label:r,value:i,onChange:s,words:{x:e("Left and right"),y:e("Up and down"),unit:"px"},placeholder:{x:"0",y:"0"},min:n.min,max:n.max,step:n.step??1}),d=/* @__PURE__ */X(o,{words:l,label:r,changed:u,detail:"0 px, 0 px",onReset:()=>s({x:null,y:null})});return null===n.label?/* @__PURE__ */z("div",{className:"sf-position-line",children:[c,d]}):/* @__PURE__ */X(v,{label:r,icon:/* @__PURE__ */X(S,{}),changed:u,action:d,children:c})}var Ne={x:{start:/* @__PURE__ */X(A,{}),center:/* @__PURE__ */X(I,{}),end:/* @__PURE__ */X(P,{}),stretch:/* @__PURE__ */X(T,{}),between:/* @__PURE__ */X(N,{})},y:{start:/* @__PURE__ */X(W,{}),center:/* @__PURE__ */X(M,{}),end:/* @__PURE__ */X(G,{}),stretch:/* @__PURE__ */X(B,{}),between:/* @__PURE__ */X(R,{})}},Te=e=>"row"===e?"row":"column";function Ve({say:e,kind:n,label:t,options:o,value:l,onChange:a,o:i}){const r=p(),u="justify"===n==("row"===(i.runs??Te)(r?.values?.[i.directionKey??"direction"]))?"x":"y";return Be(e,{options:o.map(e=>({label:e.label,value:e.value,picture:Ne[u][e.value]})),value:l,onChange:a,ariaLabel:t})}function De({say:e,tier:n,o:t}){const o=p(),l=o?.values??{},a="mobile"===n?t.phoneKeys:t.keys,i=Object.fromEntries(ke.map(e=>[e,Ce(l[a[e]])])),r="mobile"===n?Object.fromEntries(ke.map(e=>[e,Ce(l[t.keys[e]])])):null;/* @__PURE__ */
5
+ return X($e,{say:e,o:t,value:i,follows:r,onChange:e=>{const n=xe(a,i,e);Object.keys(n).length&&o?.onChangeMany(n)}})}function Je({say:e,o:n,props:t}){/* @__PURE__ */
6
+ return X($e,{say:e,o:n,value:je(t.value),follows:"follows"in t?je(t.follows):null,readOnly:t.readOnly,onChange:e=>t.onChange(Fe(e))})}function $e({say:o,o:l,value:a,follows:i,readOnly:r,onChange:u}){const s=Object.fromEntries(ke.map(e=>[e,String(i?.[e]??l.fallback[e])])),[c,d]=w(()=>e(a,s));/* @__PURE__ */
7
+ return X(v,{label:o("Padding"),icon:/* @__PURE__ */X(K,{}),action:/* @__PURE__ */X(t,{each:c,label:o("Each side"),onChange:d,disabled:r}),children:/* @__PURE__ */X(n,{label:o("Padding"),each:c,value:a,placeholder:s,min:l.min,max:l.max,step:l.step,readOnly:r,onChange:u,words:{sides:{top:o("Padding top"),right:o("Padding right"),bottom:o("Padding bottom"),left:o("Padding left")},vertical:o("Top and bottom"),horizontal:o("Left and right"),unit:"px"}})})}function _e(e=H){function n(n,t,l,a,i,u,s="",c){const d="function"==typeof c?{action:c}:c??{},{action:p,clear:f}=d;return{type:"custom",...r({},{type:"number",label:n}),render:r=>{const c="storedValue"in r?r.storedValue:r.value,m="follows"in r,b=m||void 0!==f,h="number"==typeof r.value,g=m&&"number"==typeof r.follows?r.follows:void 0===f?u:"function"==typeof f.hint?f.hint(r):f.hint,y=h?r.value:b?null:u,k=""===s||"px"===s?s:` ${s}`,w=!f?.emptyLabel||m&&"number"==typeof r.follows?void 0:f.emptyLabel,C=w??`${g}${k}`,x=m?e("{value} on desktop").replace("{value}",C):C,j=!0===r.readOnly;/* @__PURE__ */
8
+ return X(v,{label:e(n),icon:Q(t),action:b?/* @__PURE__ */X(o,{label:e(n),changed:h,detail:x,disabled:j,onReset:()=>r.onChange(void 0)}):p?p(c,r.onChange):void 0,children:/* @__PURE__ */X("div",{className:"sf-slider",children:/* @__PURE__ */X(D,{min:l,max:a,step:i,value:y,suffix:s||void 0,showInput:!0,label:e(n),disabled:j,...b?{placeholderValue:g}:{},...w?{emptyLabel:w}:{},...void 0!==d.inputMax?{inputMax:d.inputMax}:{},size:"sm",boxSize:"md",className:"sf-slider-track",onChange:e=>{null===e?b&&h&&r.onChange(void 0):e!==y&&r.onChange(e)}})})})}}}function t(n){return Be(e,n)}function u(n,l,a,i,u={}){const s=a.map(e=>"string"==typeof e?{label:e,value:e}:e);return{type:"custom",...r({},{type:"radio",label:n,options:s.map(e=>({value:e.value,label:e.label}))}),render:a=>{const{value:r,onChange:c,field:d}=a,p=s.some(e=>e.value===r),f=!0===a.readOnly;if("follows"in a&&!s.some(e=>""===e.value)){const d=u.phoneRest?u.phoneRest(a.follows):a.follows,m=s.find(e=>e.value===d)??s.find(e=>e.value===i);/* @__PURE__ */
9
+ return X(v,{label:e(n),icon:Q(l),action:/* @__PURE__ */X(o,{label:e(n),changed:p,detail:e("{value} on desktop").replace("{value}",e(m?.label??"")),disabled:f,onReset:()=>c(void 0)}),children:t({options:s,value:p?r:m?.value??i,onChange:c,ariaLabel:n,disabled:f})})}/* @__PURE__ */
10
+ return X(v,{label:e(n),icon:Q(l),children:t({options:s,value:p?r:r||d?.currentValue||i,onChange:c,ariaLabel:n,disabled:f})})}}}function c(e,n){return n.phone?e.unshift({label:"Match desktop",value:"",picture:/* @__PURE__ */X(E,{})}):n.inherit&&e.unshift({label:n.inherit,value:""}),e}function d(e,n){return n.inherit||n.phone?{...e,render:n=>e.render({...n,onChange:e=>n.onChange(""===e?void 0:e)})}:e}function p(e,n,t){return{[e]:l("desktop",n(t)),[s(e)]:l("mobile",n({...t,phone:!0},""))}}function f(e){return c(J(e.allow??Re).map(e=>({label:e.label,value:e.value,picture:e.icon})),e)}function m(e={},n=e.fallback??"left"){return d(u(e.label??"Text alignment",/* @__PURE__ */X(C,{}),f(e),n),e)}function b(e){const n={left:Ne.x.start,center:Ne.x.center,right:Ne.x.end};return c(J((e.allow??Re).filter(e=>e in n)).map(e=>({label:e.label,value:e.value,picture:n[e.value]})),e)}function y(e={},n=e.fallback??"left"){return d(u(e.label??"Block alignment",/* @__PURE__ */X(x,{}),b(e),n),e)}function k(n,t,o,l,a,i){return{type:"custom",options:l,fallback:a,...r({},{type:"radio",label:t,options:l.map(e=>({value:e.value,label:e.label}))}),render:({value:r,onChange:u,field:s})=>{const c=s.options??l,d=s.fallback??a,p=c.some(e=>e.value===r)?r:d;/* @__PURE__ */
11
+ return X(v,{label:e(t),icon:Q(o),children:/* @__PURE__ */X(Ve,{say:e,kind:n,label:t,options:c,value:p,onChange:u,o:i})})}}}function w(e={}){return k("justify","Justify",/* @__PURE__ */X(x,{}),le,le[0].value,e)}function O(e={}){return k("align","Item alignment",/* @__PURE__ */X(V,{}),ae,"stretch",e)}function S(){const n=ie;return{type:"custom",options:re,fallback:re[1].value,...r({},{type:"radio",label:n,options:re.map(e=>({value:e.value,label:e.label}))}),render:({value:t,onChange:o,id:l,name:a})=>{const i=`${l??a??n}-label`;/* @__PURE__ */
12
+ return X(v,{label:e(n),labelId:i,icon:/* @__PURE__ */X(j,{}),action:/* @__PURE__ */X(h,{checked:(r=t,!0===r||"wrap"===r),onChange:e=>o(e?re[0].value:re[1].value),ariaLabelledBy:i})});var r}}}function P({offered:e,fallback:n,resolve:t}){const o=t??(t=>e.some(e=>e.value===t)?t:n),l=u(ue,U("`Direction` names how a container’s children run — a MODIFIER, not a thing. doc/naming.md N10.1 gives the idea a dash in its Glyph column; the shell’s own `direction` meaning says the bare row is CORRECT and not an omission (SS seat, 2026-09-11)."),e.map(e=>({label:e.label,value:e.value})),o(void 0));return{type:"custom",render:e=>l.render({...e,value:o(e.value),onChange:n=>e.onChange(n)})}}function I({min:e,max:t,step:o,builtIn:l,resolve:a,action:i,mark:r}){const u=n("Gap",/* @__PURE__ */X(F,{}),e,t,o,l,"px",i),s=a??(e=>"number"==typeof e?e:l);return{...r,type:"custom",render:e=>u.render({...e,value:s(e.value,e.field),storedValue:e.value,onChange:n=>e.onChange(n)})}}function A(n,{fallback:t=fe,pointsFor:o}={}){return{type:"custom",render:({value:l,onChange:a})=>{const i=he(l,t);return o?/* @__PURE__ */X(Me,{say:e,label:n,value:i,onChange:a,pointsFor:o}):Ge(e,{label:n,value:i,onChange:a,points:be})}}}function K(n){return{[n.keys.x]:{type:"custom",render:()=>/* @__PURE__ */X(We,{say:e,o:n})},[n.keys.y]:{...a({type:"custom",render:()=>/* @__PURE__ */X(i,{})},"always"),reachedBy:n.keys.x}}}function R(n={}){const t={...we,...n.keys},o={keys:t,phoneKeys:Object.fromEntries(ke.map(e=>[e,s(t[e])])),fallback:{top:0,right:0,bottom:0,left:0,...n.fallback},min:n.min??0,max:n.max??200,step:n.step??4},r=!1!==n.phone,u=!1===n.group?{}:{_gSpacing:te("Padding")};if(n.object){const t={type:"custom",render:n=>/* @__PURE__ */X(Je,{say:e,o:o,props:n})};return ee({...u,...r?Ke(n.object.key,t,n.object.phone):{[n.object.key]:t}})}const c=n=>{const t={type:"custom",render:()=>/* @__PURE__ */X(De,{say:e,tier:n,o:o})};return r?l(n,t):t},d=()=>a({type:"custom",render:()=>/* @__PURE__ */X(i,{})},"always"),p=ke.filter(e=>"top"!==e);return ee({...u,[o.keys.top]:c("desktop"),...r?{[o.phoneKeys.top]:c("mobile")}:{},...Object.fromEntries(p.map(e=>[o.keys[e],{...d(),reachedBy:o.keys.top}])),...r?Object.fromEntries(p.map(e=>[o.phoneKeys[e],l("mobile",d())])):{}})}return{slider:n,select:function(n,t,o,l,a){return{type:"custom",options:o,fallback:l,...a?{note:a}:{},...r({},{type:"select",label:n}),render:({value:i,onChange:r,field:u})=>{const s=u.options??o,c=u.fallback??l,d=s.some(e=>e.value===i)?i:c;/* @__PURE__ */
13
+ return X(v,{label:e(n),icon:Q(t),children:/* @__PURE__ */X(g,{value:d,ariaLabel:e(n),onChange:r,options:[...a?[{label:e(a),value:"\0note",disabled:!0}]:[],...s.map(n=>({label:e(n.label),value:n.value}))]})})}}},Segmented:t,segmented:u,boxJustifyField:w,boxAlignField:O,boxWrapField:S,directionField:P,gapField:I,placementField:A,PlacementGridView:function(n){return Ge(e,n)},positionFields:K,sidesPaddingFields:R,alignmentField:m,alignmentFields:function(e="align",n={}){return p(e,m,n)},AlignmentStrip:function({opts:e={},value:n,onChange:o,ariaLabel:l,disabled:a=!1}){return t({options:f(e),value:n,onChange:o,ariaLabel:l,disabled:a})},blockAlignmentField:y,blockAlignmentFields:function(e="align",n={}){return p(e,y,n)},BlockAlignmentStrip:function({opts:e={},value:n,onChange:o,ariaLabel:l,disabled:a=!1}){return t({options:b(e),value:n,onChange:o,ariaLabel:l,disabled:a})},boxFieldSet:function(e={}){const t=e.width??de,o=e.nudge?.limit??40,l=e.direction??{offered:se,fallback:"column"},a=l.resolve??(e=>l.offered.some(n=>n.value===e)?e:l.fallback),i={runs:e=>"row"===a(e)?"row":"column"};return{_gLayout:te("Layout"),placement:A("Placement",e.placement),width:n("Width",/* @__PURE__ */X(L,{}),t.min,t.max,t.step,t.fallback,"%"),direction:P(l),gap:I(e.gap??ce),justify:w(i),align:O(i),wrap:S(),_gNudge:te("Nudge"),...K({keys:e.nudge?.keys??{x:"nudgeX",y:"nudgeY"},min:-o,max:o,label:null}),...R(e.padding)}}}}var{slider:Xe,select:Ye,Segmented:ze,segmented:He,boxJustifyField:Ze,boxAlignField:Ue,boxWrapField:qe,directionField:Qe,gapField:en,placementField:nn,PlacementGridView:tn,positionFields:on,sidesPaddingFields:ln,alignmentField:an,alignmentFields:rn,AlignmentStrip:un,blockAlignmentField:sn,blockAlignmentFields:cn,BlockAlignmentStrip:dn,boxFieldSet:pn}=_e();export{me as ANCHOR_LABELS,un as AlignmentStrip,ae as BOX_ALIGN_POINTS,se as BOX_DIRECTIONS,ue as BOX_DIRECTION_LABEL,ce as BOX_GAP,le as BOX_JUSTIFY_POINTS,ge as BOX_NUDGE_LIMIT,pe as BOX_PLACEMENTS,fe as BOX_PLACEMENT_DEFAULT,de as BOX_WIDTH,ie as BOX_WRAP_LABEL,re as BOX_WRAP_POINTS,dn as BlockAlignmentStrip,Ee as FLAT_ACCESS,be as OPEN_PLACEMENT_POINTS,Pe as PHONE_KEY_ACCESS,tn as PlacementGridView,we as SIDE_PAD_KEYS,ze as Segmented,an as alignmentField,rn as alignmentFields,sn as blockAlignmentField,cn as blockAlignmentFields,Ue as boxAlignField,_e as boxFieldBuilders,pn as boxFieldSet,Ze as boxJustifyField,qe as boxWrapField,Qe as directionField,en as gapField,te as group,Q as iconOf,q as isNoGlyph,U as noGlyph,he as normaliseBoxPlacement,Le as objectAccess,Ie as phoneObjectAccess,Ke as phoneTwinFields,nn as placementField,on as positionFields,ye as positionPatch,oe as section,He as segmented,Ye as select,ee as sharedStyleKinds,je as sidesFromObject,ln as sidesPaddingFields,xe as sidesPaddingPatch,Fe as sidesToObject,Xe as slider,Se as useAccessPatch,Oe as useAccessValue};
@@ -1,9 +1,9 @@
1
- import{DEFAULT_DRAG_WORDS as e}from"./chunk-TQ5Y6S2X.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"./chunk-3XECMGXX.js";import{withTip as s}from"./chunk-P2VEMZH5.js";import{useCanvasLayout as o,useCanvasTyping as i,useCanvasEvent as c,CANVAS_TYPABLE_EVENT as d}from"./chunk-TOKMFZPB.js";import{framePointToHost as u,elementScale as h,related as f,WORDS_CLEAR as p,frameRectToLayer as m,clientPointToLayer as g}from"./chunk-FR7EEKFF.js";import{isRepeatCopy as b}from"./chunk-7UFKEX72.js";import{parseZoneKey as y,ROOT_ID as x}from"./chunk-EUFDQ4KL.js";import{useRef as v,useEffect as w,useState as k,useCallback as N,useMemo as D,useSyncExternalStore as A,useId as T,useLayoutEffect as M}from"react";import{Tooltip as z,IconButton as E,solidSurfaceStyle as C,Input as $,ItemCount as S}from"efficient-shell/ui";import{AddIcon as j,CloseIcon as L,SearchIcon as B}from"efficient-shell/icons/efficient";import{jsxs as K,jsx as O}from"react/jsx-runtime";function X({label:e,onInsert:t,style:n,axis:l="y",className:r,index:a}){const s=["es-canvas-insert","x"===l?"is-x":"",r??""].filter(Boolean).join(" ");/* @__PURE__ */
1
+ import{DEFAULT_DRAG_WORDS as e}from"./chunk-TQ5Y6S2X.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as r,isNoOpDrop as a}from"./chunk-3XECMGXX.js";import{withTip as s}from"./chunk-P2VEMZH5.js";import{parseZoneKey as o,ROOT_ID as i}from"./chunk-EUFDQ4KL.js";import{useCanvasLayout as c,useCanvasTyping as d,useCanvasEvent as u,CANVAS_TYPABLE_EVENT as h}from"./chunk-TOKMFZPB.js";import{framePointToHost as f,elementScale as p,related as m,WORDS_CLEAR as g,frameRectToLayer as b,clientPointToLayer as y}from"./chunk-FR7EEKFF.js";import{isRepeatCopy as x}from"./chunk-7UFKEX72.js";import{useRef as v,useEffect as w,useState as k,useCallback as N,useMemo as D,useSyncExternalStore as A,useId as T,useLayoutEffect as M}from"react";import{Tooltip as z,IconButton as E,solidSurfaceStyle as C,Input as $,ItemCount as S}from"efficient-shell/ui";import{AddIcon as j,CloseIcon as L,SearchIcon as B}from"efficient-shell/icons/efficient";import{jsxs as K,jsx as O}from"react/jsx-runtime";function X({label:e,onInsert:t,style:n,axis:l="y",className:r,index:a}){const s=["es-canvas-insert","x"===l?"is-x":"",r??""].filter(Boolean).join(" ");/* @__PURE__ */
2
2
  return K("div",{className:s,style:n,"data-index":a,children:[
3
3
  /* @__PURE__ */O("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
4
- /* @__PURE__ */O("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */O(z,{content:e,children:/* @__PURE__ */O(E,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */O(j,{})})})})]})}var F=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,I=e=>e.width*e.height;function q(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>F(e.box,t,n)).sort((e,t)=>I(t.s.box)-I(e.s.box)||e.at-t.at).map(({s:e})=>e)}function Y(e,t,n){return q(e,t,n).at(-1)??null}function P(e,t,n){const l="x"===e.axis?t:n;let r=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(r+=1)}return r}function Z(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],r=n[t],a=l&&r?(l.left+l.width+r.left)/2:l?l.left+l.width:r?r.left:e.box.left,s=r??l??e.box;return{left:a-1,top:s.top,width:2,height:s.height}}const l=n[t-1],r=n[t],a=l&&r?(l.top+l.height+r.top)/2:l?l.top+l.height:r?r.top:e.box.top;return{left:e.box.left,top:a-1,width:e.box.width,height:2}}function R(e,t,n,l,r=()=>!1,a=()=>!0){const s=e.filter(e=>F(e.box,t,n)).sort((e,t)=>I(e.box)-I(t.box));for(const e of s){const s=P(e,t,n),o={...e.list,index:s};if(r(o))return null;if(l(o))return{zone:e,to:o,line:Z(e,s)};if(!a(o))return null}return null}function H(e,t,n=12){const l=e.children;if(0===l.length)return[];const r=e.box,a="x"===e.axis,s=a?r.left:r.top,o=s+(a?r.width:r.height),i=e=>a?e.left:e.top,c=e=>a?e.left+e.width:e.top+e.height,d=[];for(let r=0;r<=l.length;r++){const u=l[r-1],h=l[r];let f,p;if(u&&h)f=c(u),p=Math.max(i(h)-f,0);else{const e=u?(c(u)+o)/2:(s+i(h))/2,t=Math.min(Math.max(e,s+n),o-n);f=u?Math.max(t,c(u)):Math.min(t,i(h)),p=0}const m=[u,h].filter(e=>Boolean(e)),g=Math.min(...m.map(e=>a?e.top:e.left)),b=Math.max(...m.map(e=>a?e.top+e.height:e.left+e.width)),y=a?{left:f,top:g,width:p,height:b-g}:{left:g,top:f,width:b-g,height:p};d.push({key:`${e.key}:+${r}`,place:{...e.list,index:r},box:y,axis:e.axis,label:t})}return d}function Q(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const r=e.children[l-1],a=e.children[l],s=r.top+r.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:s,width:e.box.width,height:Math.max(a.top-s,0)}})}return n}var U={nodes:[],zones:[]},V="data-easel-dropzone",G="data-easel-block";function W(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function J(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function _(e,t,n){return m(e.frame,W(n),t)}function ee(e,t){const{frame:n,document:l}=e,r=e=>m(n,W(e),t),a=[],s=[];for(const e of l.querySelectorAll(`[${V}]`)){if(b(e))continue;const t=e.getAttribute(V)??"";let n;try{n=y(t)}catch{continue}const l=[...e.querySelectorAll(`[${G}]`)].filter(t=>t.parentElement?.closest(`[${V}]`)===e&&!b(t)),o=l.map(r);s.push({key:t,list:n,box:r(e),axis:J(o,e),children:o}),l.forEach((e,t)=>{const l=e.getAttribute(G);l&&a.push({id:l,place:{...n,index:t},box:o[t]})})}return{nodes:a,zones:s}}var te="data-es-empty-cell",ne="data-easel-dropzone",le=140;var re=e=>({left:e.left,top:e.top,width:e.width,height:e.height}),ae=e=>({left:e.left+2,top:Math.max(e.top-11,0)});function se(s){const{canvas:m,session:b,readOnly:y,words:T=e.canvas}=s,E=v(s);w(()=>{E.current=s});const $=v(null),S=o(m),[j,L]=k(0),B=N(()=>L(e=>e+1),[]),[F,I]=k(U);w(()=>{const e=$.current;m&&e&&I((E.current.measure??ee)(m,e))},[m,S,s.revision,j]);const Y=s.model,P=D(()=>Y(F),[Y,F]),Z=A(b.subscribe,b.shown,b.shown),H=s.choose,Q=(e,t)=>{const n=q(P.sources,e,t);return 0===n.length?null:H?H(n):n[n.length-1]},[V,G]=k(null),[W,J]=k(null),[le,se]=k(null),oe=v(null),ie=()=>{oe.current&&clearTimeout(oe.current),oe.current=null},ce=()=>{ie(),oe.current=setTimeout(()=>{b.get()||G(null)},140)};w(()=>ie,[]);const de=v(null),ue=i(m),he=v(!1);he.current=ue;const[fe,pe]=k(null),me=v(null),ge=v(V);ge.current=V,w(()=>{ue?(pe(ge.current?.key??me.current?.id??null),ie(),G(null)):pe(null)},[ue]);const[be,ye]=k(null);c(m,d,e=>{const t=e.detail?.id??null,n=t?{id:t,words:e.detail?.words??null}:null;ye(n),n&&(me.current=n)});const xe=e=>{if(!(e&&e.isConnected&&m&&$.current))return null;const t=_(m,$.current,e);return{left:t.left-p,top:t.top-p,width:t.width+2*p,height:t.height+2*p}},ve=!be||ue||y||Z?null:xe(be.words)??F.nodes.find(e=>e.id===be.id)?.box??null;c(m,"mousemove",e=>{const t=$.current;if(!m||!t)return;const n=u(m.frame,e.clientX,e.clientY,t),l=h(t),r={x:n.x/l,y:n.y/l};if(de.current=r,E.current.readOnly||b.get()||he.current)return;ie();const a=Q(r.x,r.y);G(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),c(m,"mouseout",e=>{e.relatedTarget||(de.current=null,ce())}),c(m,"mouseover",e=>{e.relatedTarget||B()});const we=v(null),ke=N(()=>{we.current?.(),we.current=null,J(null),se(null)},[]);w(()=>b.subscribe(()=>{b.get()?B():ke()}),[b,ke,B]),w(()=>ke,[ke]),("undefined"==typeof document?w:M)(()=>{if(b.get())return;const e=de.current;G(t=>y||he.current?null:e?Q(e.x,e.y):t?P.sources.find(e=>e.key===t.key)??null:null)},[P,Z,b,y,H]);const Ne=e=>{const t=b.get(),n=$.current,l=E.current.dropOn;if(!t||!n||!l)return null;const r=g(n,e.clientX,e.clientY);de.current=r;const a=q(P.sources,r.x,r.y);for(let e=a.length-1;e>=0;e-=1)if(l.accepts(t.item,a[e]))return{h:t,source:a[e]};return null},De=e=>{const t=b.get(),n=$.current;if(!t||!n)return null;const l=g(n,e.clientX,e.clientY);de.current=l;const r=R(P.zones,l.x,l.y,e=>E.current.canDrop(t.item,e),e=>!!t.from&&a(t.from,e),e=>E.current.fallThrough?.(t.item,e,t.from)??!0);return r?{h:t,t:r}:null},Ae={onDragEnter:e=>{if(we.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),a=m?l(m.document):null,s=[];t&&s.push(r(t)),a&&m&&s.push(r(a,m.frame)),we.current=s.length?()=>s.forEach(e=>e()):null},onDragOver:e=>{const n=Ne(e);if(n)return e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed),J(null),void se(e=>e&&e.key===n.source.key&&e.box===n.source.box?e:n.source);se(null);const l=De(e);if(!l)return void J(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const r={zoneKey:l.t.zone.key,line:l.t.line,axis:l.t.zone.axis};J(e=>e&&e.zoneKey===r.zoneKey&&e.line.left===r.line.left&&e.line.top===r.line.top?e:r)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(de.current=null,J(null),se(null))},onDrop:e=>{const t=Ne(e);if(t)return e.preventDefault(),b.end(),ke(),void E.current.dropOn.onDrop(t.h.item,t.source);const n=De(e);n&&(e.preventDefault(),b.end(),ke(),E.current.onDrop(n.h.item,n.t.to))}},Te={draggable:!y&&!!V,onMouseEnter:ie,onMouseLeave:()=>!b.get()&&ce(),onDragStart:e=>{if(V&&!y){b.start({key:V.key,item:V.item,from:V.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",V.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{b.end(),ke()},onClick:()=>{V&&!y&&E.current.onPick?.(V.item)}},{seams:Me=[]}=P,ze=be?.words??(ue?me.current?.words??null:null),Ee=s.tag&&m&&$.current&&!Z?(ze&&f(s.tag.element,ze)?xe(ze):null)??_(m,$.current,s.tag.element):null,Ce=V?(be&&be.id===V.key?xe(be.words):null)??V.box:null,$e=ue&&fe&&!s.tag?P.sources.find(e=>e.key===fe)??null:null,Se=$e?xe(ze)??$e.box:null,je=P.zones.filter(e=>0===e.children.length),Le=!s.onZoneAdd||y||ue?[]:je,Be=Le.map(e=>e.key).join("\n");return w(()=>{const e=m?.document;if(!e)return;const t=new Set(Be?Be.split("\n"):[]);for(const n of e.querySelectorAll(`[${ne}]`))n.toggleAttribute(te,t.has(n.getAttribute(ne)??""));return()=>{for(const t of e.querySelectorAll(`[${te}]`))t.removeAttribute(te)}},[m,Be,F,S,j]),/* @__PURE__ */K("div",{ref:$,className:"es-canvas-layer",children:[Z||!s.onSeamAdd||y||ue?null:Me.map(e=>
5
- /* @__PURE__ */O(X,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??s.seamLabel??T.addSection,onInsert:()=>s.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),Le.length?Le.map(e=>/* @__PURE__ */O("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",W?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:re(e.box),"data-node-id":e.list.parentId===x?void 0:e.list.parentId,onClick:()=>s.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */O("span",{className:"es-canvas-empty-add",children:T.addButton({label:e.addLabel??s.zoneAddLabel??T.addBlock})})},e.key)):null,Z?/* @__PURE__ */O("div",{className:"es-canvas-catch",...Ae}):null,le&&Z?/* @__PURE__ */O("div",{className:"es-canvas-target",style:re(le.box),children:s.dropOn?.label?/* @__PURE__ */O("span",{className:"es-canvas-target-label",style:C(),children:s.dropOn.label(Z.item,le)}):null}):null,W&&!je.some(e=>e.key===W.zoneKey)?/* @__PURE__ */O("div",{className:`es-canvas-line is-${W.axis}`,style:re(W.line)}):null,ve?/* @__PURE__ */O("span",{className:"es-canvas-hint"+(ve.width<200?" is-below":""),style:{...C(),left:ve.left+ve.width,top:ve.width<200?ve.top+ve.height:ve.top},children:T.typeHint}):null,Ee&&s.tag?/* @__PURE__ */O("span",{className:"es-canvas-tag",style:ae(Ee),children:s.tag.label}):$e&&Se?/* @__PURE__ */O("span",{className:"es-canvas-tag",style:ae(Se),children:$e.label}):null,
6
- /* @__PURE__ */O("div",{className:"es-canvas-handle-spot",style:Ce?{"--es-handle-x":`${ae(Ce).left}px`,"--es-handle-y":`${ae(Ce).top}px`}:void 0,children:/* @__PURE__ */O(z,{className:"es-canvas-handle-tip",side:"top",content:!V||y||Z?null:V.title??T.handle({label:V.label}),children:/* @__PURE__ */K("div",{className:["es-canvas-handle",V&&!y?"is-shown":"",Z?"is-dragging":""].filter(Boolean).join(" "),...Te,children:[
4
+ /* @__PURE__ */O("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */O(z,{content:e,children:/* @__PURE__ */O(E,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */O(j,{})})})})]})}var F=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,I=e=>e.width*e.height;function q(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>F(e.box,t,n)).sort((e,t)=>I(t.s.box)-I(e.s.box)||e.at-t.at).map(({s:e})=>e)}function Y(e,t,n){return q(e,t,n).at(-1)??null}function P(e,t,n){const l="x"===e.axis?t:n;let r=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(r+=1)}return r}function Z(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],r=n[t],a=l&&r?(l.left+l.width+r.left)/2:l?l.left+l.width:r?r.left:e.box.left,s=r??l??e.box;return{left:a-1,top:s.top,width:2,height:s.height}}const l=n[t-1],r=n[t],a=l&&r?(l.top+l.height+r.top)/2:l?l.top+l.height:r?r.top:e.box.top;return{left:e.box.left,top:a-1,width:e.box.width,height:2}}function R(e,t,n,l,r=()=>!1,a=()=>!0){const s=e.filter(e=>F(e.box,t,n)).sort((e,t)=>I(e.box)-I(t.box));for(const e of s){const s=P(e,t,n),o={...e.list,index:s};if(r(o))return null;if(l(o))return{zone:e,to:o,line:Z(e,s)};if(!a(o))return null}return null}function H(e,t,n=12){const l=e.children;if(0===l.length)return[];const r=e.box,a="x"===e.axis,s=a?r.left:r.top,o=s+(a?r.width:r.height),i=e=>a?e.left:e.top,c=e=>a?e.left+e.width:e.top+e.height,d=[];for(let r=0;r<=l.length;r++){const u=l[r-1],h=l[r];let f,p;if(u&&h)f=c(u),p=Math.max(i(h)-f,0);else{const e=u?(c(u)+o)/2:(s+i(h))/2,t=Math.min(Math.max(e,s+n),o-n);f=u?Math.max(t,c(u)):Math.min(t,i(h)),p=0}const m=[u,h].filter(e=>Boolean(e)),g=Math.min(...m.map(e=>a?e.top:e.left)),b=Math.max(...m.map(e=>a?e.top+e.height:e.left+e.width)),y=a?{left:f,top:g,width:p,height:b-g}:{left:g,top:f,width:b-g,height:p};d.push({key:`${e.key}:+${r}`,place:{...e.list,index:r},box:y,axis:e.axis,label:t})}return d}function Q(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const r=e.children[l-1],a=e.children[l],s=r.top+r.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:s,width:e.box.width,height:Math.max(a.top-s,0)}})}return n}var U={nodes:[],zones:[]},V="data-easel-dropzone",G="data-easel-block";function W(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}function J(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function _(e,t,n){return b(e.frame,W(n),t)}function ee(e,t){const{frame:n,document:l}=e,r=e=>b(n,W(e),t),a=[],s=[];for(const e of l.querySelectorAll(`[${V}]`)){if(x(e))continue;const t=e.getAttribute(V)??"";let n;try{n=o(t)}catch{continue}const l=[...e.querySelectorAll(`[${G}]`)].filter(t=>t.parentElement?.closest(`[${V}]`)===e&&!x(t)),i=l.map(r);s.push({key:t,list:n,box:r(e),axis:J(i,e),children:i}),l.forEach((e,t)=>{const l=e.getAttribute(G);l&&a.push({id:l,place:{...n,index:t},box:i[t]})})}return{nodes:a,zones:s}}var te="data-es-empty-cell",ne="data-easel-dropzone",le=140;var re=e=>({left:e.left,top:e.top,width:e.width,height:e.height}),ae=e=>({left:e.left+2,top:Math.max(e.top-11,0)});function se(s){const{canvas:o,session:b,readOnly:x,words:T=e.canvas}=s,E=v(s);w(()=>{E.current=s});const $=v(null),S=c(o),[j,L]=k(0),B=N(()=>L(e=>e+1),[]),[F,I]=k(U);w(()=>{const e=$.current;o&&e&&I((E.current.measure??ee)(o,e))},[o,S,s.revision,j]);const Y=s.model,P=D(()=>Y(F),[Y,F]),Z=A(b.subscribe,b.shown,b.shown),H=s.choose,Q=(e,t)=>{const n=q(P.sources,e,t);return 0===n.length?null:H?H(n):n[n.length-1]},[V,G]=k(null),[W,J]=k(null),[le,se]=k(null),oe=v(null),ie=()=>{oe.current&&clearTimeout(oe.current),oe.current=null},ce=()=>{ie(),oe.current=setTimeout(()=>{b.get()||G(null)},140)};w(()=>ie,[]);const de=v(null),ue=d(o),he=v(!1);he.current=ue;const[fe,pe]=k(null),me=v(null),ge=v(V);ge.current=V,w(()=>{ue?(pe(ge.current?.key??me.current?.id??null),ie(),G(null)):pe(null)},[ue]);const[be,ye]=k(null);u(o,h,e=>{const t=e.detail?.id??null,n=t?{id:t,words:e.detail?.words??null}:null;ye(n),n&&(me.current=n)});const xe=e=>{if(!(e&&e.isConnected&&o&&$.current))return null;const t=_(o,$.current,e);return{left:t.left-g,top:t.top-g,width:t.width+2*g,height:t.height+2*g}},ve=!be||ue||x||Z?null:xe(be.words)??F.nodes.find(e=>e.id===be.id)?.box??null;u(o,"mousemove",e=>{const t=$.current;if(!o||!t)return;const n=f(o.frame,e.clientX,e.clientY,t),l=p(t),r={x:n.x/l,y:n.y/l};if(de.current=r,E.current.readOnly||b.get()||he.current)return;ie();const a=Q(r.x,r.y);G(e=>e?.key===a?.key&&e?.box===a?.box?e:a)}),u(o,"mouseout",e=>{e.relatedTarget||(de.current=null,ce())}),u(o,"mouseover",e=>{e.relatedTarget||B()});const we=v(null),ke=N(()=>{we.current?.(),we.current=null,J(null),se(null)},[]);w(()=>b.subscribe(()=>{b.get()?B():ke()}),[b,ke,B]),w(()=>ke,[ke]),("undefined"==typeof document?w:M)(()=>{if(b.get())return;const e=de.current;G(t=>x||he.current?null:e?Q(e.x,e.y):t?P.sources.find(e=>e.key===t.key)??null:null)},[P,Z,b,x,H]);const Ne=e=>{const t=b.get(),n=$.current,l=E.current.dropOn;if(!t||!n||!l)return null;const r=y(n,e.clientX,e.clientY);de.current=r;const a=q(P.sources,r.x,r.y);for(let e=a.length-1;e>=0;e-=1)if(l.accepts(t.item,a[e]))return{h:t,source:a[e]};return null},De=e=>{const t=b.get(),n=$.current;if(!t||!n)return null;const l=y(n,e.clientX,e.clientY);de.current=l;const r=R(P.zones,l.x,l.y,e=>E.current.canDrop(t.item,e),e=>!!t.from&&a(t.from,e),e=>E.current.fallThrough?.(t.item,e,t.from)??!0);return r?{h:t,t:r}:null},Ae={onDragEnter:e=>{if(we.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),a=o?l(o.document):null,s=[];t&&s.push(r(t)),a&&o&&s.push(r(a,o.frame)),we.current=s.length?()=>s.forEach(e=>e()):null},onDragOver:e=>{const n=Ne(e);if(n)return e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed),J(null),void se(e=>e&&e.key===n.source.key&&e.box===n.source.box?e:n.source);se(null);const l=De(e);if(!l)return void J(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const r={zoneKey:l.t.zone.key,line:l.t.line,axis:l.t.zone.axis};J(e=>e&&e.zoneKey===r.zoneKey&&e.line.left===r.line.left&&e.line.top===r.line.top?e:r)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(de.current=null,J(null),se(null))},onDrop:e=>{const t=Ne(e);if(t)return e.preventDefault(),b.end(),ke(),void E.current.dropOn.onDrop(t.h.item,t.source);const n=De(e);n&&(e.preventDefault(),b.end(),ke(),E.current.onDrop(n.h.item,n.t.to))}},Te={draggable:!x&&!!V,onMouseEnter:ie,onMouseLeave:()=>!b.get()&&ce(),onDragStart:e=>{if(V&&!x){b.start({key:V.key,item:V.item,from:V.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",V.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{b.end(),ke()},onClick:()=>{V&&!x&&E.current.onPick?.(V.item)}},{seams:Me=[]}=P,ze=be?.words??(ue?me.current?.words??null:null),Ee=s.tag&&o&&$.current&&!Z?(ze&&m(s.tag.element,ze)?xe(ze):null)??_(o,$.current,s.tag.element):null,Ce=V?(be&&be.id===V.key?xe(be.words):null)??V.box:null,$e=ue&&fe&&!s.tag?P.sources.find(e=>e.key===fe)??null:null,Se=$e?xe(ze)??$e.box:null,je=P.zones.filter(e=>0===e.children.length),Le=!s.onZoneAdd||x||ue?[]:je,Be=Le.map(e=>e.key).join("\n");return w(()=>{const e=o?.document;if(!e)return;const t=new Set(Be?Be.split("\n"):[]);for(const n of e.querySelectorAll(`[${ne}]`))n.toggleAttribute(te,t.has(n.getAttribute(ne)??""));return()=>{for(const t of e.querySelectorAll(`[${te}]`))t.removeAttribute(te)}},[o,Be,F,S,j]),/* @__PURE__ */K("div",{ref:$,className:"es-canvas-layer",children:[Z||!s.onSeamAdd||x||ue?null:Me.map(e=>
5
+ /* @__PURE__ */O(X,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??s.seamLabel??T.addSection,onInsert:()=>s.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),Le.length?Le.map(e=>/* @__PURE__ */O("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",W?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:re(e.box),"data-node-id":e.list.parentId===i?void 0:e.list.parentId,onClick:()=>s.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */O("span",{className:"es-canvas-empty-add",children:T.addButton({label:e.addLabel??s.zoneAddLabel??T.addBlock})})},e.key)):null,Z?/* @__PURE__ */O("div",{className:"es-canvas-catch",...Ae}):null,le&&Z?/* @__PURE__ */O("div",{className:"es-canvas-target",style:re(le.box),children:s.dropOn?.label?/* @__PURE__ */O("span",{className:"es-canvas-target-label",style:C(),children:s.dropOn.label(Z.item,le)}):null}):null,W&&!je.some(e=>e.key===W.zoneKey)?/* @__PURE__ */O("div",{className:`es-canvas-line is-${W.axis}`,style:re(W.line)}):null,ve?/* @__PURE__ */O("span",{className:"es-canvas-hint"+(ve.width<200?" is-below":""),style:{...C(),left:ve.left+ve.width,top:ve.width<200?ve.top+ve.height:ve.top},children:T.typeHint}):null,Ee&&s.tag?/* @__PURE__ */O("span",{className:"es-canvas-tag",style:ae(Ee),children:s.tag.label}):$e&&Se?/* @__PURE__ */O("span",{className:"es-canvas-tag",style:ae(Se),children:$e.label}):null,
6
+ /* @__PURE__ */O("div",{className:"es-canvas-handle-spot",style:Ce?{"--es-handle-x":`${ae(Ce).left}px`,"--es-handle-y":`${ae(Ce).top}px`}:void 0,children:/* @__PURE__ */O(z,{className:"es-canvas-handle-tip",side:"top",content:!V||x||Z?null:V.title??T.handle({label:V.label}),children:/* @__PURE__ */K("div",{className:["es-canvas-handle",V&&!x?"is-shown":"",Z?"is-dragging":""].filter(Boolean).join(" "),...Te,children:[
7
7
  /* @__PURE__ */O("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),V?.label]})})})]})}var oe=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function ie({groups:t,session:n,itemFor:l,onInsert:r,onTileMenu:a,at:o,hint:i,searchLabel:c,readOnly:d,words:u=e.add}){const h=i??u.hint,f=c??u.search,[p,m]=k(""),g=T(),b=p.trim().toLowerCase(),y=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),x=t.map((e,t)=>({...e,key:y[t],tiles:b?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,b)):e.tiles})).filter(e=>e.tiles.length>0),v=(e,t)=>r=>{if(t)r.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),r.dataTransfer.effectAllowed="copy";try{r.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
8
8
  return K("div",{className:"es-add",children:[o?/* @__PURE__ */K("div",{className:"es-add-at",role:"status",children:[
9
9
  /* @__PURE__ */O("span",{children:o.label}),s(u.stop,/* @__PURE__ */O("button",{type:"button",className:"es-add-at-clear","aria-label":u.stop,onClick:o.onClear,children:/* @__PURE__ */O(L,{size:12,"aria-hidden":"true"})}))]}):null,
@@ -1 +1 @@
1
- var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"},a=e=>1===e?"1 page":`${e} pages`,t={group:"Shared sections",onPages:({count:e})=>`On ${a(e)}`,makeShared:"Make shared",makeSharedHint:"Use this section on other pages from Add. Change it once, and every page changes.",name:"Name",cancel:"Cancel",makeFailed:"Could not make it shared. Try again.",detach:"Detach from shared",removeFromPage:"Remove from this page",removed:({count:e})=>e>0?`Removed from this page · still on ${a(e)}`:"Removed from this page",deleteShared:"Delete shared section",deleteTitle:({name:e})=>`Delete “${e}”?`,deleteMessage:({count:e})=>0===e?"No page uses it. Nothing on the website changes.":1===e?"The page that uses it keeps its own copy. Nothing disappears from the website.":`The ${e} pages that use it each keep their own copy. Nothing disappears from the website.`,deleteFailed:"Could not delete it. Try again.",alreadyHere:"Already on this page"};var o={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const t=Math.floor(a/60);if(t<60)return`Saved ${t} minute${1===t?"":"s"} ago`;const o=Math.floor(t/60);return`Saved ${o} hour${1===o?"":"s"} ago`},saved:"All changes saved",saving:"Saving",pending:"Changes not saved yet — saving in a moment",failedIn:({seconds:e})=>`Not saved — trying again in ${e} s`,failedSoon:"Not saved — trying again soon",offline:"You’re offline — we’ll save when you’re back",pausedHeld:"Auto-save is off — changes not saved",paused:"Auto-save is off",locked:({editing:e})=>`Not saving — ${e}`,blockedOffline:"You’re offline. Try again when you’re back online.",blockedFailed:"Your last changes are not saved yet. Try again when they are.",blockedConflict:"Your last save was refused. See the notice below."},n={blockCount:({count:e})=>`${e} ${1===e?"block":"blocks"}`,loading:"Loading",waitingForAuthorization:"Waiting for editor authorization",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageStyles:"This page",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,shared:t,canvasAddBlock:"Add block",canvasReplaceImage:"Replace image",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving"},bar:{undo:"Undo",redo:"Redo",refresh:"Reload the preview",refreshTip:"Reload the preview (keeps your place)",notSaving:"Not saving — see the notice below",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views",saveOptions:"Save options",autoSave:"Auto-save",saveNow:"Save now"},saveStatus:o,menu:{undo:"Undo",redo:"Redo",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V",itemAddAfter:"Add item after",itemMoveEarlier:"Move item earlier",itemMoveLater:"Move item later",itemDelete:"Delete item"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:a,total:t})=>`Moved “${e}” to position ${a} of ${t}`,sectionAdded:({name:e})=>`Added “${e}” section`,deleted:({name:e})=>`Deleted “${e}”`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}};export{e as DEFAULT_SCREEN_ADD_WORDS,o as DEFAULT_SCREEN_SAVE_STATUS_WORDS,t as DEFAULT_SCREEN_SHARED_WORDS,n as DEFAULT_SCREEN_WORDS};
1
+ var e={title:"Add",contextAll:"Sections and blocks",done:"Done",doneDescription:"Close Add and go back",templates:"Your templates",tile:({name:e})=>`Add ${e}`,hint:"Drag onto the page.",search:"Search",onlySections:"Only sections go here",notInside:({name:e})=>`Cannot go inside ${e}`,addingTo:({name:e})=>`Adding to ${e}`,addingBefore:({name:e})=>`Adding before ${e}`,addingAtEnd:"Adding at the end of the page",addingHere:"Adding here"},a=e=>1===e?"1 page":`${e} pages`,t={group:"Shared sections",onPages:({count:e})=>`On ${a(e)}`,makeShared:"Make shared",makeSharedHint:"Use this section on other pages from Add. Change it once, and every page changes.",name:"Name",cancel:"Cancel",makeFailed:"Could not make it shared. Try again.",detach:"Detach from shared",removeFromPage:"Remove from this page",removed:({count:e})=>e>0?`Removed from this page · still on ${a(e)}`:"Removed from this page",deleteShared:"Delete shared section",deleteTitle:({name:e})=>`Delete “${e}”?`,deleteMessage:({count:e})=>0===e?"No page uses it. Nothing on the website changes.":1===e?"The page that uses it keeps its own copy. Nothing disappears from the website.":`The ${e} pages that use it each keep their own copy. Nothing disappears from the website.`,deleteFailed:"Could not delete it. Try again.",alreadyHere:"Already on this page"};var o={savedAgo:function({seconds:e}){const a=Math.max(0,Math.floor(e));if(a<1)return"Saved just now";if(a<60)return`Saved ${a} second${1===a?"":"s"} ago`;const t=Math.floor(a/60);if(t<60)return`Saved ${t} minute${1===t?"":"s"} ago`;const o=Math.floor(t/60);return`Saved ${o} hour${1===o?"":"s"} ago`},saved:"All changes saved",saving:"Saving",pending:"Changes not saved yet — saving in a moment",failedIn:({seconds:e})=>`Not saved — trying again in ${e} s`,failedSoon:"Not saved — trying again soon",offline:"You’re offline — we’ll save when you’re back",pausedHeld:"Auto-save is off — changes not saved",paused:"Auto-save is off",locked:({editing:e})=>`Not saving — ${e}`,blockedOffline:"You’re offline. Try again when you’re back online.",blockedFailed:"Your last changes are not saved yet. Try again when they are.",blockedConflict:"Your last save was refused. See the notice below."},n={blockCount:({count:e})=>`${e} ${1===e?"block":"blocks"}`,loading:"Loading",waitingForAuthorization:"Waiting for editor authorization",missingTemplatePage:"Couldn’t open a page in this template.",missingPage:({slug:e})=>`No page with slug "${e}".`,missingDocument:"Couldn’t open this document.",loadFailed:({cause:e})=>`Could not load the document — ${e}`,noun:"page",pageStyles:"This page",header:"Header",footer:"Footer",pageSections:"Page",templateSections:"Template",addSection:"Add section",addSectionHere:"Add section here",done:"Done",copied:({name:e})=>`Copied ${e}`,pasteRefused:({name:e})=>`${e} can’t be pasted here.`,add:e,shared:t,canvasAddBlock:"Add block",canvasReplaceImage:"Replace image",railMedia:"Media library",leftPanel:"Left panel",resizeLeftPanel:"Resize left panel",leave:{title:"Unsaved changes",body:"Your most recent edits haven’t finished saving yet. Save them before switching, or leave and discard them.",cancel:"Cancel",discard:"Discard & leave",save:"Save & leave",saving:"Saving"},bar:{undo:"Undo",redo:"Redo",refresh:"Reload the preview",refreshTip:"Reload the preview (keeps your place)",notSaving:"Not saving — see the notice below",retry:"Retry now",autoSaveOff:"Auto-save is off — click to turn it back on (saves your held edits)",autoSaveOn:"Auto-save is on — click to pause it",views:"Left panel views",saveOptions:"Save options",autoSave:"Auto-save",saveNow:"Save now"},saveStatus:o,menu:{undo:"Undo",redo:"Redo",collapseAll:"Collapse all layers",selectAll:"Select all",pinned:"Pinned — can’t be moved or deleted",clipboardRefused:"Your browser won’t let us read the clipboard — press ⌘V",itemAddAfter:"Add item after",itemMoveEarlier:"Move item earlier",itemMoveLater:"Move item later",itemDelete:"Delete item"},layers:"Layers",expandAll:"Expand all sections",collapseAll:"Collapse all sections",nothingToFold:"Nothing to fold on this page",rename:"Rename",deleteNamed:({name:e})=>`Delete ${e}`,hideNamed:({name:e})=>`Hide ${e}`,showNamed:({name:e})=>`Show ${e}`,addBlockHere:"Add block here",sectionFirst:({name:e})=>`“${e}” is already first`,sectionLast:({name:e})=>`“${e}” is already last`,sectionMoved:({name:e,n:a,total:t})=>`Moved “${e}” to position ${a} of ${t}`,sectionAdded:({name:e})=>`Added “${e}” section`,deleted:({name:e})=>`Deleted “${e}”`,resizeSettingsPanel:"Resize settings panel",sectionSettings:({name:e})=>`${e} settings`,headerSettings:"Header settings",addBlockMenu:"Add block",deviceNote:{tablet:"Tablet uses the desktop settings.",mobile:"Showing the phone settings for this section."}},s={focus:"Image focus",onDesktop:e=>`${e} on desktop`,pasteLink:"or paste an image URL",pasteName:"Image URL",template:"Templates don’t store images. This slot stays a placeholder. Each website picks its own after it’s created.",templateVideo:"Templates don’t store videos. This slot stays a placeholder. Each website picks its own after it’s created."};export{s as DEFAULT_IMAGE_ROW_WORDS,e as DEFAULT_SCREEN_ADD_WORDS,o as DEFAULT_SCREEN_SAVE_STATUS_WORDS,t as DEFAULT_SCREEN_SHARED_WORDS,n as DEFAULT_SCREEN_WORDS};