efficient-easel 17.0.0 → 18.0.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 (104) hide show
  1. package/README.md +5 -1
  2. package/dist/blocks/index.d.ts +2 -2
  3. package/dist/chunk-43AEUUNQ.js +1 -0
  4. package/dist/{chunk-N3LYD2LK.js → chunk-5VD2LGIZ.js} +14 -14
  5. package/dist/chunk-A6Z4SD3I.js +10 -0
  6. package/dist/{chunk-NFLO4I2N.js → chunk-A7FF65FL.js} +1 -1
  7. package/dist/chunk-BHRC3ASL.js +1 -0
  8. package/dist/chunk-BRMYJBMB.js +8 -0
  9. package/dist/chunk-C2RHV42O.js +1 -0
  10. package/dist/{chunk-EXCIHRAE.js → chunk-F7FDF6NS.js} +1 -1
  11. package/dist/{chunk-4UBYPRAS.js → chunk-HGV3FWOB.js} +1 -1
  12. package/dist/chunk-LLDHIBYG.js +18 -0
  13. package/dist/{chunk-Z72CYM3L.js → chunk-MPF5QZJ7.js} +1 -1
  14. package/dist/chunk-N3VPBHR6.js +62 -0
  15. package/dist/{chunk-BU2YSTLJ.js → chunk-QEAUF632.js} +12 -12
  16. package/dist/{chunk-3ERZNZ5S.js → chunk-RFE7ZG3Y.js} +1 -1
  17. package/dist/{chunk-MTNBJPXX.js → chunk-STWSCR25.js} +2 -2
  18. package/dist/{chunk-XLUVTPKK.js → chunk-VEZPDGDQ.js} +1 -1
  19. package/dist/{chunk-OLRLHE5K.js → chunk-W2GEGVUY.js} +4 -4
  20. package/dist/{chunk-V63ERBLW.js → chunk-WOETW3H6.js} +1 -1
  21. package/dist/chunk-X3TYRF5V.js +1 -0
  22. package/dist/{chunk-FJL3MYPA.js → chunk-XHHVMAGM.js} +1 -1
  23. package/dist/{chunk-SPQOPWCL.js → chunk-XHSGRH42.js} +4 -4
  24. package/dist/chunk-YI4QXOVJ.js +1 -0
  25. package/dist/{chunk-JSH3XKEF.js → chunk-YLQYEDUQ.js} +1 -1
  26. package/dist/drag/drag.css +8 -0
  27. package/dist/drag/index.d.ts +15 -1
  28. package/dist/drag/index.js +1 -1
  29. package/dist/draw/index.js +1 -1
  30. package/dist/easel/easel.css +8 -0
  31. package/dist/easel/index.d.ts +16 -6
  32. package/dist/easel/index.js +1 -1
  33. package/dist/fields/index.js +1 -1
  34. package/dist/{host-Cxbhp0zg.d.ts → host-epHo7r8P.d.ts} +12 -1
  35. package/dist/node-ops/index.d.ts +2 -2
  36. package/dist/node-ops/index.js +1 -1
  37. package/dist/{plan-2BLk7pWs.d.ts → plan-CZS902DV.d.ts} +9 -1
  38. package/dist/screen/components/AddBlockRow.js +1 -1
  39. package/dist/screen/components/AddSidePanel.d.ts +6 -1
  40. package/dist/screen/components/AddSidePanel.js +1 -1
  41. package/dist/screen/components/MediaSidePanel.d.ts +4 -3
  42. package/dist/screen/components/MediaSidePanel.js +1 -1
  43. package/dist/screen/components/NodeContextMenu.d.ts +6 -5
  44. package/dist/screen/components/NodeContextMenu.js +1 -1
  45. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  46. package/dist/screen/components/SaveControls.d.ts +5 -4
  47. package/dist/screen/components/ScreenChrome.js +1 -1
  48. package/dist/screen/components/ScreenDocumentContext.d.ts +4 -3
  49. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  50. package/dist/screen/components/ScreenMount.d.ts +5 -4
  51. package/dist/screen/components/ScreenMount.js +1 -1
  52. package/dist/screen/components/ScreenStoreProvider.d.ts +5 -4
  53. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  54. package/dist/screen/components/SectionScreenShell.js +16 -16
  55. package/dist/screen/components/usePartBridge.d.ts +5 -4
  56. package/dist/screen/components/usePartBridge.js +1 -1
  57. package/dist/screen/index.d.ts +6 -5
  58. package/dist/screen/index.js +1 -1
  59. package/dist/screen/lib/admin-bridge.d.ts +3 -2
  60. package/dist/screen/lib/document-addressing.d.ts +4 -3
  61. package/dist/screen/lib/document-hooks.d.ts +2 -2
  62. package/dist/screen/lib/host.d.ts +4 -3
  63. package/dist/screen/lib/key-scope.js +1 -1
  64. package/dist/screen/lib/media-panel.d.ts +4 -3
  65. package/dist/screen/lib/media-picker.d.ts +7 -9
  66. package/dist/screen/lib/page-lock.d.ts +3 -2
  67. package/dist/screen/lib/puck/device-fields.js +1 -1
  68. package/dist/screen/lib/puck/palette-sections.d.ts +2 -2
  69. package/dist/screen/lib/puck/section-doc.d.ts +2 -2
  70. package/dist/screen/lib/puck/slot-child-name.js +1 -1
  71. package/dist/screen/lib/puck/style-clipboard.d.ts +5 -4
  72. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  73. package/dist/screen/lib/puck/use-section-ops.d.ts +2 -2
  74. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  75. package/dist/screen/lib/screen-parts.d.ts +69 -5
  76. package/dist/screen/lib/screen-parts.js +1 -1
  77. package/dist/screen/lib/section-templates.d.ts +3 -2
  78. package/dist/screen/lib/session-context.d.ts +3 -2
  79. package/dist/screen/lib/session.d.ts +6 -2
  80. package/dist/screen/lib/shared-section-types.d.ts +71 -0
  81. package/dist/screen/lib/shared-section-types.js +1 -0
  82. package/dist/screen/lib/shared-sections.d.ts +34 -0
  83. package/dist/screen/lib/shared-sections.js +1 -0
  84. package/dist/screen/screen.css +7 -0
  85. package/dist/screen/words.d.ts +49 -1
  86. package/dist/screen/words.js +1 -1
  87. package/dist/strings/index.d.ts +1 -1
  88. package/dist/strings/index.js +2 -2
  89. package/dist/text-styles/index.js +21 -21
  90. package/dist/tree/index.d.ts +3 -3
  91. package/dist/tree/index.js +1 -1
  92. package/dist/tree/tree.css +17 -0
  93. package/dist/{types-D8P9q-BG.d.ts → types-Bqq6ya0y.d.ts} +9 -0
  94. package/dist/{types-kR_4wYBw.d.ts → types-Cq53lL8d.d.ts} +1 -1
  95. package/dist/{useNodeOps-B0XZ8Bl8.d.ts → useNodeOps-fIDWzftn.d.ts} +3 -1
  96. package/package.json +15 -3
  97. package/dist/chunk-4JSBIW5H.js +0 -9
  98. package/dist/chunk-EL4F3IN7.js +0 -1
  99. package/dist/chunk-INIPQLPR.js +0 -1
  100. package/dist/chunk-MI54XTWD.js +0 -5
  101. package/dist/chunk-POSLNRTO.js +0 -18
  102. package/dist/chunk-SHS6WCLL.js +0 -1
  103. package/dist/chunk-TBF5CVPA.js +0 -1
  104. package/dist/chunk-WR3EVON3.js +0 -57
@@ -1,57 +0,0 @@
1
- import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-XLUVTPKK.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as c,useEaselUndoKeys as a,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-JSH3XKEF.js";import{SlotChildActionsProvider as f}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-U277UX5I.js";import{usePartBridge as y}from"./chunk-INIPQLPR.js";import{useSectionOps as S}from"./chunk-NFLO4I2N.js";import{ScreenSaveIcon as k,ScreenMainButton as b}from"./chunk-7TOQCTHV.js";import{useBrowserOffline as v}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-MI54XTWD.js";import{SidePanelHead as z,PanelShowStrip as C}from"./chunk-XDZHKYQX.js";import{offeredChoices as B}from"./chunk-M2Z775ZC.js";import{MediaSidePanel as I}from"./chunk-V63ERBLW.js";import{useScreenSaveSwitch as N,useScreenNodeKeys as O,useScreenPinned as P,useScreenDocumentLabel as $,useScreenCanvasFrame as T,useScreenInspectorPanel as L,useScreenDevices as M,useScreenPickFollowsSelection as j,useScreenLeftView as A,SELECTION_MODE as R,sameInspectorMode as E,useScreenBridges as V,useScreenBlockRules as F,useScreenBlockLook as W,useScreenStorageNamespace as H,useScreenNotify as D,useScreenCanvasHead as U,isSlotMode as X,useScreenStyleClipboard as J,useScreenDocumentPass as G,useScreenCanvasDrag as K,ScreenCanvasTargetProvider as Y,isPinnedFirst as Z,isPinnedLast as q,screenSlotsOf as Q}from"./chunk-SPQOPWCL.js";import{useNodeClipboard as _,useNodeContextMenu as ee}from"./chunk-3ERZNZ5S.js";import{PageEditGuardNotices as ne}from"./chunk-4UBYPRAS.js";import{useScreenDocument as te}from"./chunk-MTNBJPXX.js";import{requestMediaPick as oe}from"./chunk-KG7RJWOK.js";import{useMediaPanel as re,usePanelPick as ie,useCancelPanelPick as le}from"./chunk-R6WTQWAC.js";import{useEaselSession as se}from"./chunk-O7Q4DDJT.js";import{useEaselHost as de,useHostEscape as ce}from"./chunk-U3JP4VGF.js";import{LayersIcon as ae,MediaIcon as pe}from"./chunk-4VJATVVR.js";import{DEFAULT_SCREEN_WORDS as ue}from"./chunk-EL4F3IN7.js";import{heldStyle as fe,styleShortcut as he}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as me}from"./chunk-6WY6ZXJG.js";import{rootRowName as ge,slotChildRowName as ye,slotChildRenameProp as Se,sectionRenameProp as ke}from"./chunk-TBF5CVPA.js";import{ROOT_ZONE as be,blockNodeActions as ve,TREE_MAX_DEPTH as we,childSlotsOf as xe,slotFieldsOf as ze,slotChildrenIn as Ce,nestsInTree as Be,newNodeId as Ie}from"./chunk-PLVEGYK6.js";import{useEasel as Ne,useEaselApi as Oe,CanvasPassThroughContext as Pe}from"./chunk-BU2YSTLJ.js";import{TreeRow as $e,Subtree as Te,LayersTree as Le,TreeGroupLabel as Me,TreeRowAction as je,TreeSeam as Ae}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Re}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ee}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ve,useNodeOps as Fe,clickPick as We}from"./chunk-SHS6WCLL.js";import{EaselTopBar as He,TopBarRail as De,TopBarCluster as Ue,EaselIconButton as Xe,TopBarDivider as Je,DeviceSwitch as Ge,InspectorIconButton as Ke,PanelResizeHandle as Ye,MAX_PANEL_W as Ze,MIN_PANEL_W as qe,panelWidthVars as Qe}from"./chunk-GWIVPLOX.js";import{DEFAULT_NOTICE_WORDS as _e,DEFAULT_CHROME_WORDS as en}from"./chunk-Z6PVRXVY.js";import{holderOf as nn,nameOrSomeone as tn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as on}from"./chunk-RE4LP46F.js";import{useWords as rn}from"./chunk-MFIRYGHW.js";import{insertSeams as ln,CanvasDragLayer as sn,CanvasInsert as dn}from"./chunk-POSLNRTO.js";import{DEFAULT_DRAG_WORDS as cn}from"./chunk-KAML3KQH.js";import{createDragSession as an,useTreeDrag as pn,gapToMoveIndex as un}from"./chunk-67GNT6PF.js";import{useCanvasFrame as fn,LIST_SELECTOR as hn,BLOCK_SELECTOR as mn,useCanvasTyping as gn,useCanvasEvent as yn,nodeIdAt as Sn,frameRectToHost as kn,BLOCK_ATTRIBUTE as bn,drawnBox as vn}from"./chunk-X4T6JT3M.js";import{ROOT_ID as wn,ROOT_SLOT as xn,zoneKey as zn,parseZoneKey as Cn,find as Bn,DataError as In}from"./chunk-KRXQM65X.js";import{useRef as Nn,useMemo as On,useState as Pn,useEffect as $n,useCallback as Tn,useLayoutEffect as Ln,Fragment as Mn}from"react";import{ColoredBadge as jn,toast as An,groupColors as Rn}from"efficient-shell/ui";import{UndoIcon as En,RedoIcon as Vn,RefreshIcon as Fn,AddIcon as Wn,TrashIcon as Hn,EyeOffIcon as Dn,EyeIcon as Un,DuplicateIcon as Xn}from"efficient-shell/icons/efficient";import{jsx as Jn,jsxs as Gn,Fragment as Kn}from"react/jsx-runtime";var Yn=/* @__PURE__ */new WeakSet;function Zn(e,n,t){const o=Bn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function qn({canvas:e,tabs:n,onSelect:t}){const o=Nn(null),[r,i]=Pn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Ln(()=>{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=kn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${bn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?vn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=kn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),a=s.top+s.height;if(a<d.top||s.top>d.top+d.height){c[o.id]=null;continue}const p=o.below?a+4:Math.max(s.top,d.top)+6;c[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(c)},c=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",c,!0),r.addEventListener("resize",c);const a=new r.MutationObserver(c);return a.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",c,!0),r.removeEventListener("resize",c),a.disconnect()}},[e,l]),/* @__PURE__ */Jn("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Jn("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:/* @__PURE__ */Jn(jn,{colorClass:Rn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function Qn({expand:e}){/* @__PURE__ */
2
- return Jn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Gn(Kn,e?{children:[
3
- /* @__PURE__ */Jn("path",{d:"M8 9l4-4 4 4"}),
4
- /* @__PURE__ */Jn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
5
- /* @__PURE__ */Jn("path",{d:"M8 4l4 4 4-4"}),
6
- /* @__PURE__ */Jn("path",{d:"M8 20l4-4 4 4"}),
7
- /* @__PURE__ */Jn("path",{d:"M5 12h14"})]})})}var _n=`${hn}, ${mn}`;function et(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 nt="__rungs";var tt="screen:band",ot={duplicate:!0,delete:!0};function rt(){const hn=de(),{target:kn,docId:bn,capabilities:vn,currentSlug:Rn,siteId:rt,onPublish:it,saveState:lt,saveConflict:st,retrySave:dt,toggleAutoSave:ct,flushSave:at,access:pt,saveUnreachable:ut=!1,readOnly:ft,readOnlyReason:ht=null}=te(),mt=N(),gt=O(),{mediaEditing:yt,hasEditGuard:St,hasPinnedChrome:kt}=vn,{appState:bt,dispatch:vt,history:wt,selectedItem:xt,getSelectorForId:zt,config:Ct}=Ne(e=>e),Bt=P(),{first:It,firstGroup:Nt,lastGroup:Ot,isSectionGroup:Pt,sectionGroupZone:$t,panelOf:Tt}=Bt,Lt=Tt(It),Mt=e=>Z(Bt,e),jt=e=>q(Bt,e),At="node"===Bt.firstRow,Rt=Bt.band??null,Et=rn("screen",ue),Vt=rn("tree",Re),Ft=rn("drag",cn),Wt=rn("notice",_e),Ht=rn("lock",on),Dt=rn("menu",Ee),Ut=rn("styleClipboard",me),Xt=rn("chrome",en),Jt=$()??`/${Rn}`,Gt=T(),Kt=L(),Yt=S({readOnly:ft}),Zt=S({readOnly:ft,foldIntoHistory:!0}),qt=Nn(null),Qt=Oe(),_t=On(()=>({...Yt,select:e=>{qt.current=e,Yt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Qt.config;qt.current=Ve(e,t,n)}Yt.commitDocument(e,n)}}),[Yt,Qt]),eo=bt.ui,no=eo.leftSideBarVisible,to=eo.rightSideBarVisible,{options:oo,widths:ro,initial:io,fluid:lo,fit:so}=M(),[co,ao]=Pn(io),po=re(),uo=yt&&null!==po,fo=ie(),ho=le();j(xt?.props.id);const{read:mo,write:go,forSelection:yo}=A(),[So,ko]=Pn(mo);$n(()=>{go(So)},[So]);const[bo,vo]=Pn(0),wo=Nn(null),xo=Nn(null),zo=fn(xo,{readySelector:_n}),Co=gn(zo),Bo=c(xo);a(xo,zo);const Io=v(),No=nn(pt),Oo={state:lt,offline:Io||lt.failed&&ut,readOnlyReason:ht,editing:No?Wt.editing({name:tn(No.name,Ht),noun:Et.noun}):null,conflict:null!=st,notSaving:Et.bar.notSaving},Po=()=>{ft||(lt.failed?dt():at())};p(xo,zo,Po);const[$o,To]=Pn(!1),Lo=Nn(!1),Mo=Nn(!1),[jo,Ao]=Pn(null),[Ro,Eo]=Pn([]),[Vo,Fo]=Pn(R),Wo="puck"===Vo.kind,Ho=t(Vo,xt?.props.id),[Do,Uo]=Pn(null);$n(()=>{Do&&(o(),Uo(null))},[Do]);const Xo=Nn(zt);Xo.current=zt;const Jo=Tn((e,{scroll:n})=>{ko(n=>yo(e,n)),n&&Uo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Xo.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&vr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Go=Nn(null);$n(()=>{const e=Go.current;Go.current=null;const n=null==xt?.props.id?null:String(xt.props.id);Fo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Tt(xt?.type)??R);const t=xt?.props.id,o=qt.current;if(qt.current=null,!t)return;const i=zt(t);Jo(String(t),{scroll:!r(o,i??null,be)})},[xt?.props.id,Jo]);const Ko=Tn(e=>{Fo(n=>E(n,e)?n:e),vt({type:"setUi",ui:{rightSideBarVisible:!0}})},[vt]),Yo=Nn(()=>{});Yo.current=(e,n)=>{const t=e?hi(e.zone??be)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==xt?.props.id?null:String(xt.props.id);Fo(e=>E(e,n)?e:n),o!==r&&(Go.current={id:o,mode:n},_t.select(e))};const Zo=Tn((e,n)=>Yo.current(e,n),[]),qo={kind:Vo.kind,mode:Vo,open:Ko,show:e=>Fo(e),reveal:()=>{to||vt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Zo},Qo=V(qo,{data:bt.data,selected:xt??null,zoneOf:e=>zt(e)?.zone,readOnly:Boolean(ft),select:e=>{Fo(R),_t.select({index:e})},replace:(e,n)=>_t.replaceComponent(be,e,n),scrollTo:e=>l(e)},{device:co,refreshes:bo},{setView:ko,reveal:()=>{no||vt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),_o=Qo.resolveLeftView?Qo.resolveLeftView(So,uo):"media"===So&&uo?So:"sections",er=F(),{isLockedBlock:nr,duplicateBlocked:tr,nestDepth:or,newSectionNode:rr,canAddTo:ir,blockIsOffered:lr}=er,sr=W(),{labelAtLevel:dr,Icon:cr,useProducts:ar}=sr,pr=sr.rowName?(e,n,t)=>sr.rowName(e,n,t):void 0,ur=Tn(e=>{vt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),Jo(e,{scroll:!0})},[vt,Jo]),{selectNode:fr,openPartId:hr}=y({mode:Vo,setMode:Fo,onOpenPart:ur}),[mr,gr]=Pn(null);ce(null!==mr,()=>gr(null));const yr=h(H()),Sr=yr.collapsed,kr=yr.panelWidths,[br,vr]=Pn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Sr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
8
- return new Set}});$n(()=>{try{window.localStorage.setItem(Sr,JSON.stringify([...br]))}catch{}},[br]);const[wr,xr]=Pn(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(kr);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left),right:g(Number(n.right)||m.right)}}catch{return{...m}}});$n(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(kr,JSON.stringify(wr))}catch{}},300);return()=>clearTimeout(e)},[wr]);const zr=Tn((e,n)=>xr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Cr=Tn(e=>zr("left",e),[zr]),Br=Tn(e=>zr("right",e),[zr]),Ir=e=>br.has(e),Nr=e=>vr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Or=Nn(!1),Pr=Nn(null);$n(()=>{if(Or.current&&!$o){const e=Pr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??xo.current?.querySelector(`button[aria-label="${CSS.escape(Et.add.title)}"]`))?.focus(),Pr.current=null}Or.current=$o},[$o]),$n(()=>{if(!$o||!Bo)return;const e=e=>{"Escape"===e.key&&Ji()};return Bo.addEventListener("keydown",e),()=>Bo.removeEventListener("keydown",e)},[$o,Bo]),ce($o,()=>Ji()),$n(()=>{!no&&$o&&(To(!1),Ao(null),Lo.current=!1)},[no]),$n(()=>{if(!fo)return Mo.current&&vt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(Mo.current=!1);$o&&(To(!1),Ao(null),Mo.current=Lo.current,Lo.current=!1),no||(Mo.current=!0,vt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[fo]),$n(()=>{!no&&fo&&(Mo.current=!1,ho())},[no]),$n(()=>{if(!fo||!Bo)return;const e=e=>{"Escape"===e.key&&ho()};return Bo.addEventListener("keydown",e),()=>Bo.removeEventListener("keydown",e)},[fo,Bo]),ce(null!==fo,()=>ho());const $r=D(),Tr=(e,n="success",t)=>{if($r)return void(t?$r(e,"error"===n?"error":"info",t):$r(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?An.error(e,{...o,duration:t?.duration??3200}):An.success(e,{...o,duration:t?.duration??1900})},Lr=Nn(null),[Mr,jr]=Pn(0),[Ar,Rr]=Pn(0),Er=U(),Vr=Nn(null),Fr=e=>Math.max(0,e.clientHeight-(Vr.current?.offsetHeight??0));$n(()=>{const e=Lr.current;if(!e)return;const n=()=>{jr(e.clientWidth),Rr(Fr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Vr.current&&t.observe(Vr.current),()=>t.disconnect()},[]),Ln(()=>{Lr.current&&(jr(Lr.current.clientWidth),Rr(Fr(Lr.current)))},[wr,no,to]);const Wr=co===lo?Mr>0?Mr:ro[lo]:ro[co],Hr=Mr>0?Math.min(Mr/Wr,"shrink"===so?1:2):1,Dr=Wr*Hr,Ur=Mr>0&&Dr>Mr+1,Xr={width:Dr,height:Ar||"100%",flex:"none",position:"relative"},Jr={width:Wr,height:Ar?Ar/Hr:"100%",maxHeight:"none",transform:1!==Hr?`scale(${Hr})`:void 0,transformOrigin:"top left"},Gr=()=>vt({type:"setUi",ui:{leftSideBarVisible:!no}}),Kr=()=>vt({type:"setUi",ui:{rightSideBarVisible:!to}}),Yr=e=>{$o&&(To(!1),Ao(null),Lo.current=!1,no&&So===e)||fo&&(Mo.current=!1,ho(),no&&So===e)||(no&&So===e?Gr():(ko(e),no||vt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Zr=()=>{oe(hn,{accept:"image/*",title:Xt.mediaLibrary})},qr=()=>{Fo(R),_t.select(null),d()},Qr=()=>{Fo(Lt??R),to||vt({type:"setUi",ui:{rightSideBarVisible:!0}})},_r=bt.data.content??[],ei=()=>{const e=_r.findIndex(Mt),n=_r.findIndex(jt);return{floor:e>=0?e+1:0,cap:n>=0?n:_r.length}},ni=Ct,ti=er.stripCopy,oi=e=>i(e,ti),ri=_(),ii=Fe({data:bt.data,config:ni,readOnly:Boolean(ft),clipboard:ri,strip:ti?e=>ti(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==wn||e.slot!==xn)return{min:0,max:n-1};const{floor:t,cap:o}=ei();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Fo(R);const t=void 0===n||"node"===n?.kind?n:null;_t.commitDocument(e,t)}}),li=e=>{const n=Bn(bt.data,Ct,e);if(!n)return!1;const t=zn(n.place),o=n.node,r=t===be?pi(o):Ci(o);return!!ii.remove(e)&&(Tr(Et.deleted({name:r}),"success",{duration:8e3,action:{label:Et.bar.undo,onClick:()=>{ii.restore(n.node,n.place)}}}),!0)},si={...ii,remove:li},di=e=>dr(e,"block",Ct.components[e]?.label??e),ci=Tn(e=>Ct.components[e]?.defaultProps??{},[Ct]),ai=e=>dr(e,"section",di(e)),pi=e=>ge({type:e.type,props:e.props??{}},ai(e.type),pr),{nodeAddresses:ui,zoneItems:fi}=On(()=>{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>=we)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of xe(Ct,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(_r,be,0),{nodeAddresses:e,zoneItems:n}},[_r,Ct]),hi=Tn(e=>fi.get(e)??[],[fi]),mi=e=>{const n=ui.get(e);return n?hi(n.zone)[n.index]:void 0},gi=e=>Q(er,Ct,e),yi=e=>{if(!er.slotsOf||e===be)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=mi(e.slice(0,n));if(!t)return null;const o=gi(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}},Si=(()=>{if(!X(Vo))return null;const e=`${Vo.nodeId}:${Vo.slot}`;return yi(e)?.slot.panel===Vo.kind?e:null})(),ki=Nn(null);$n(()=>{const e=ki.current;if(ki.current=null,!Si||!X(Vo))return;const n=Vo.nodeId;Jo(n,{scroll:e!==Si}),vr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Vo]);const bi=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ui.get(e);n&&(n.zone===be?Vi(n.index):ul(n.zone,n.index,e,mi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Si!==i&&(ki.current=i),Zo(null,r),to||vt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},vi=(e,n,t)=>{const o=`${e}:${n}`;if(vr(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;Si!==o&&(ki.current=o);Zo(null,{kind:t,nodeId:e,slot:n})},wi=(e,n,t)=>{if(ft||!er.moveSlot)return;const o=mi(e),r=o?gi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:nt,index:n},s=un(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=er.moveSlot(e,n,s);"string"==typeof d&&vi(e,d,i.panel)},xi=ar(),zi=On(()=>{const e=/* @__PURE__ */new Map;for(const n of xi??[])e.set(n.slug,n.name);return e},[xi]),Ci=e=>ye(e,di,sr.plainText,e=>zi.get(e),sr.rowName),Bi=(e,n)=>{const t=Ct.components[e.type]?.fields,o=n===be||Ll(n)?"section":"block",r=n===be&&(Mt(e)||jt(e)||Pt(e.type)),i="block"===o?Se(t):r?null:ke(t);return sr.renamePropOf?sr.renamePropOf(e,o,i):i},Ii=(e,n,t,o)=>{if(!(!ft&&mr?.zone===e&&mr.index===n))return;const r=(t,o)=>{gr(null),o&&((e,n,t)=>{const o=hi(e)[n];if(!o)return;const r=Bi(o,e);r&&_t.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
9
- return Jn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Et.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)},Ni=n(J(),Ut),Oi=Ni.scope({target:kn,siteId:rt,docId:bn}),Pi=Ct,$i=(e,n)=>n===be?ai(e):di(e),Ti=(e,n,t)=>{const o=Ni.plan(Oi,t,$i(t.type,e),Pi);o&&(o.changed&&_t.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Tr(o.message))},Li=ee({nodesIn:hi,nodeAt:(e,n)=>hi(e)[n]??null,labelOf:(e,n)=>n===be?ai(e):di(e),renamePropOf:Bi,beginRename:(e,n)=>gr({zone:e,index:n}),history:{hasPast:wt.hasPast,hasFuture:wt.hasFuture,back:()=>wt.back(),forward:()=>wt.forward()},openPageSettings:()=>{_t.select(null),Fo(R)},pageSettingsLabel:Et.pageSettings,words:{menu:Dt,styleClipboard:Ut,screen:Et.menu},readOnly:Boolean(ft),collapseAll:()=>vr(new Set(hi(be).map(e=>String(e.props.id)))),onPasteRefused:e=>Tr(e?Et.pasteRefused({name:e.label}):Et.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Al(e,n),menuRows:Qo.menuRows,isLocked:e=>nr(e.type),duplicateBlocked:e=>tr(bt.data,e),permits:e=>ve(Ct,e.type),nodeOps:si,isPinned:(e,n)=>n===be&&(Mt(e)||jt(e)),sectionBand:ei,locate:e=>ui.get(e)??null,rowNameOf:(e,n)=>n===be?pi(e):Ci(e),selectAt:(e,n,t,o)=>{e===be?Vi(n):ul(e,n,t,o??"")},slotRung:e=>{const n=yi(e);return n?.slot.panel?{label:n.slot.label,select:()=>bi(n.node,n.slot,!1)}:null},style:{held:()=>fe(Oi),canCopy:e=>Ni.rows(Pi,e).some(e=>!1!==e.counted),copy:(e,n)=>Ni.copy(Oi,e,$i(e.type,n),Pi),paste:(e,n,t)=>Ti(e,n,t)},keys:gt?{target:Bo,selected:()=>{const e=bt.ui.itemSelector;return e?{zone:e.zone??be,index:e.index}:null},held:()=>ri.get(),readOnly:Boolean(ft),onDone:({done:e,name:n})=>{"copied"===e&&Tr(Et.copied({name:n}))}}:void 0},zo),Mi=Nn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});$n(()=>{Mi.current={copy:(e,n)=>Ni.copy(Oi,e,$i(e.type,n),Pi),paste:Ti,at:()=>{const e=bt.ui.itemSelector;if(!e)return null;const n=e.zone??be,t=hi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(ft)}});const ji=Tn(e=>{const n=he(e);if(!n)return;const t=Mi.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))},[]);$n(()=>{if(!Bo)return;const e=e=>ji(e);return Bo.addEventListener("keydown",e),()=>Bo.removeEventListener("keydown",e)},[ji,Bo]),yn(zo,"keydown",ji);const Ai=_r.map(e=>e.props.id).join("|");$n(()=>{const e=zo?.document??null,n=zo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Eo(e=>e.length?[]:e);const n=_r.findIndex(jt),t=n>=0?n:_r.length,o=n=>{const t=_r[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(mn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=_r.length>0&&!Mt(_r[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=et(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})}Eo(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()}},[zo,Ai,co,Hr,no,to,xt?.props.id]);const Ri=zo?.document??null,Ei=zo?.window??null;$n(()=>{const e=wo.current;if(!e||!Ri||!Ei)return;const n=[],t=()=>{const n=Ri.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Ei.scrollTo({left:Ei.scrollX,top:Ei.scrollY+t,behavior:"instant"}),!0};return wo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ri,Ei]);const Vi=e=>{Fo(R),_t.select({index:e}),Qo.sectionPressed?.(_r[e]);const n=_r[e]?.props?.id;n&&l(n)},Fi=e=>{const{floor:n,cap:t}=ei(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=xt&&Vo.kind!==Lt?.kind?_r.findIndex(e=>e.props.id===xt.props.id):-1;return o(r>=0?r+1:t)},Wi=(e,n)=>{const{floor:t,cap:o}=ei(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(_t.reorderComponent(be,e,i),_t.select({index:i}),{moved:!0,dest:i})},Hi=(e,n,t,o)=>{Fo(R),_t.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Tr(Et.sectionAdded({name:t}))},Di=(e,n)=>{const t=Fi(n),o=rr(e,{nodeDefaults:ci,newNodeId:Ie,sectionLabel:ai,blockIsOffered:lr}),r=o?_t.insertNode(be,t,o):_t.insertSection(e,t);return Hi(t,r,ai(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of xe(Ct,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=ir(e.type,l,d.slice(d.lastIndexOf(":")+1)),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:c,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},Ui=e=>Xi(be,e),Xi=(e,n)=>{Pr.current=document.activeElement??null,fo&&(Lo.current=Mo.current,Mo.current=!1,ho()),Ao(null===n?null:{zone:e,index:n}),To(!0),no||(Lo.current=!0,vt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ji=()=>{To(!1),Ao(null),Lo.current&&vt({type:"setUi",ui:{leftSideBarVisible:!1}}),Lo.current=!1},Gi=(e,n)=>sr.rowName?n?Mt(e)?sr.rowName(e,"section",Et.header):jt(e)?sr.rowName(e,"section",Et.footer):Pt(e.type)?sr.rowName(e,"section",di(e.type)):pi(e):Ci(e):n?ai(e.type):di(e.type),Ki=e=>n=>{e()},Yi=(e,n,t)=>{if(ft)return null;const o=hi(e)[n];return o&&!ve(Ct,o.type).delete?null:/* @__PURE__ */Jn(je,{kind:"delete",label:Et.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=hi(e)[n]?.props?.id;null!=t&&li(String(t))})(e,n),children:/* @__PURE__ */Jn(Hn,{size:15})})},Zi=e=>sr.rowPreview?.(e)||void 0,qi=e=>sr.rowMarks?.(e)??void 0,Qi=(e,n,t)=>sr.rowActions?.(e,n,t)??null,_i=(e,n,t,o)=>{if(ft)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
10
- return Jn(je,{kind:"eye",label:r?Et.showNamed({name:o}):Et.hideNamed({name:o}),onClick:()=>nl(e,n,t),children:/* @__PURE__ */Jn(r?Dn:Un,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},el=e=>fs(be,e),nl=(e,n,t)=>{_t.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},tl=e=>ze(Ct,e),ol=e=>xe(Ct,e),rl=e=>er.slotsOf?gi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Ce(e,n.slot)})):[{slot:null,rung:null,kids:ol(e)}],il=e=>er.slotsOf?rl(e).flatMap(e=>e.kids):ol(e),ll=e=>Boolean(er.slotsOf)&&gi(e).some(e=>e.rung),sl=(e,n,t)=>null===t?void 0===n?ir(e):ir(e,n):ir(e,n,t),dl=(e,n,t)=>{const o=Be(Ct,e.type,n)&&(t||il(e).length>0||ll(e));return{collapsible:o,folded:o&&Ir(String(e.props.id))}},cl=(e,n,t)=>rl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>dl(e,r,t(e.type)).collapsible?[String(e.props.id),...cl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),al=e=>il(e).length>0||ll(e)||Boolean(ir(e.type)),pl=e=>Boolean(ir(e)),ul=(e,n,t,o)=>{if(Fo(R),ir(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),_t.select({index:n,zone:e}),l(t)}else _t.select({index:n,zone:e}),l(t)},fl=(e,n,t,o,r)=>{const i=`${e}:${n}`;_t.insertComponent(i,t,o),ir(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),_t.select({index:o,zone:i})}):_t.select({index:o,zone:i})},hl=Nn(/* @__PURE__ */new Set);$n(()=>{_r.forEach(e=>{const n=ir(e.type)?.spec;if(!n)return;const t=e.props.id;if(hl.current.has(t))return;hl.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(ci)).forEach((e,t)=>Zt.seedChild(o,t,n.childType,e))})},[_r,Zt,ci]);const ml=Nn(/* @__PURE__ */new Set);$n(()=>{_r.forEach((n,t)=>{const o=n.props.id;if(ml.current.has(o))return;const r=e(n,tl(n.type));ml.current.add(o),r&&Zt.replaceComponent(be,t,{...n,props:r})})},[_r,Zt]),G(Zt,Ct);const gl=_r.findIndex(jt),yl=gl>=0?_r[gl]:null,Sl=At?_r.findIndex(Mt):-1,kl=Sl>=0?_r[Sl]:null,bl=Bt.groupTab,vl=On(()=>bl?e=>Pt(e.type):void 0,[bl]),wl=Boolean(Bt.groupBadge),xl=Bt.groupBadge?/* @__PURE__ */Jn("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Jn(jn,{tone:"info",size:"xs",children:Bt.groupBadge})}):void 0,zl=_r.find(e=>e.type===Nt)??null,Cl=_r.find(e=>e.type===Ot)??null,Bl=gl>=0?gl:_r.length,Il=[];_r.forEach(e=>{jt(e)||(al(e)&&Il.push(String(e.props.id)),Il.push(...cl(e,1,pl)))}),yl&&(Il.push(String(yl.props.id)),Il.push(...cl(yl,1,pl)));const Nl=Il.length>0&&Il.every(e=>br.has(e)),Ol=e=>{const n=sr.blockRowName(e,di);return sr.rowName?sr.rowName(e,"block",n):n},Pl=(e,n,t,o)=>{const r=hi(e)[t];if(!r)return;const i={...Cn(e),index:t},l={...Cn(n),index:Math.min(Math.max(o,0),hi(n).length)},s=un(i,l);if(e!==n||s!==t)try{ii.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof In))throw e}},$l=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of ol(e))n.add(r),t(o)};for(const t of tl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Tl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ui.get(n);if(!e)return null;if(e.zone===be)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Ll=e=>{const n=e.slice(0,e.indexOf(":")),t=_r.find(e=>Pt(e.type)&&String(e.props.id)===n);return t&&$t(n)===e?t:null},Ml=(e,n)=>{const t=Ll(e);return!t||(!Bt.groupAccepts||Bt.groupAccepts(t.type,n,hi(e).length))},jl=(e,n,t)=>{if(e.rung){const t=mi(e.rung.nodeId),o=t?gi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===nt&&n.index>=0&&n.index<=o}if(n.slot===nt)return!1;if(e.add)return Vl(e.add,n);const o=zn(n);if(Pt(e.type))return!1;const r=Ll(o),i=Ll(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!Ml(o,e.type))&&(n.index>=0&&n.index<=hi(o).length));if(e.zone===be||o===be){if(e.zone!==o)return!1;const{floor:t,cap:r}=ei();return n.index>=t&&n.index<=r}if(n.index<0||n.index>hi(o).length)return!1;if(e.zone===o)return!0;const l=yl&&!Bt.lastIsOpen?String(yl.props.id):null;return(!l||Tl(e.zone)!==l&&Tl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??hi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ui.get(i),s=l?hi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&$l(r).has(n))return!1;const d=ir(s.type,or(bt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(hi(n),r))})(e.zone,o,e.index,t)},Al=(e,n)=>{const t=zn(e.from),o=e.node;return t===zn(n)?Ml(t,o.type):jl({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Rl=e=>{const n=e.slice(0,e.indexOf(":")),t=ui.get(n),o=t?hi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=ir(o.type,or(bt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=B(r.choices??(r.spec?[{type:r.spec.childType,label:di(r.spec.childType)}]:[])),l=yi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Gi(o,t.zone===be)}},El=(e,n)=>{if("section"!==e.kind)return e;const t=zn(n);return t===be||Ll(t)?e:Rl(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},Vl=(e,n)=>{const t=El(e,n),o=zn(n);if("block"!==t.kind){if(Ll(o)){const e="section"===t.kind?t.type:t.template.node.type;return Ml(o,e)&&n.index>=0&&n.index<=hi(o).length}if(o!==be)return!1;const{floor:e,cap:r}=ei();return n.index>=e&&n.index<=r}if(o===be)return!1;const r=Rl(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(hi(o))},Fl=(e,n)=>{const t=El(e,n);if("block"!==t.kind&&Ll(zn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&Ml(n,o)){if("section"===e.kind)_t.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;_t.insertNode(n,t,oi(e.template.node))}Fo(R),_t.select({index:t,zone:n})}})(t,zn(n),n.index);if("section"===t.kind)return void Di(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Fi(t),r=_t.insertNode(be,o,n);Hi(o,r,e)})(t.template.name,oi(t.template.node),n.index);const o=zn(n),r=Rl(o);r&&(r.target.spec?fl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{_t.insertComponent(e,n,t),Fo(R),_t.select({index:t,zone:e})})(o,t.type,n.index))},Wl=(e,n)=>{e.rung?wi(e.rung.nodeId,e.index,n.index):e.add?Fl(e.add,n):e.zone===be?Wi(e.index,n.index):Pl(e.zone,zn(n),e.index,n.index)},[Hl]=Pn(()=>an()),Dl=pn({keyOf:e=>e.id,readOnly:Boolean(ft),session:Hl,canDrop:jl,onDrop:Wl,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=ai(_r[e]?.type??""),o=Wi(e,n<0?e-1:e+2);if(!o.moved)return void Tr(n<0?Et.sectionFirst({name:t}):Et.sectionLast({name:t}));const{floor:r,cap:i}=ei();Tr(Et.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Pl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Ul=Tn(e=>{const{floor:n,cap:t}=ei(),o=[];for(const r of e.nodes){const e=zn(r.place),i=hi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Mt(i)||jt(i)||nr(i.type))continue;if(Pt(i.type))continue;const l=Boolean(Ll(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?ai(i.type):Ci(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=zn(e.list);if(n===be&&0===e.children.length)return[{...e,addLabel:Et.addSection,addAlways:!0}];const t=Rl(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Ll(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=zn(e.list),t=n===be||Ll(n)?null:Rl(n);return t?.choices.length?ln(e,t.target.spec?.addLabel??Et.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[bt.data]),Xl=null==xt?.props.id?null:String(xt.props.id),Jl=Tn(e=>{const n=Ct,t=e=>!e.item.rung&&null!==Bn(bt.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(Xl);return i||(r(We(bt.data,n,o.item.id,Xl,vl))??o)},[bt.data,Ct,Xl,vl]),[Gl,Kl]=Pn(null);yn(zo,"mouseover",e=>{if(!bl)return;const n=Sn(e.target),t=n?Zn(bt.data,Ct,n):null;t!==Gl&&Kl(t)}),yn(zo,"mouseout",e=>{bl&&!e.relatedTarget&&Kl(null)});const Yl=e=>Mt(e)||jt(e)||Pt(e.type),Zl=[];if(bl){const e=Xl?Zn(bt.data,Ct,Xl):null;for(const n of/* @__PURE__ */new Set([e,Gl])){const e=n?_r.find(e=>String(e.props.id)===n):void 0;if(!e||!Yl(e))continue;const t=bl(e);t&&Zl.push({id:String(e.props.id),label:t,below:Mt(e)||e.type===Nt})}}const ql=se(),Ql=Nn(null);$n(()=>{const e=Bt.changeNotice;if(!e)return;const n=JSON.stringify(_r.filter(Yl)),t=Ql.current;if(Ql.current={doc:bn,bands:n,index:wt.index},!t||t.doc!==bn||t.bands===n)return;wt.hasPast&&wt.index>=t.index&&!Yn.has(ql)&&(Yn.add(ql),Tr(e,"success",{action:{label:Et.bar.undo,onClick:()=>wt.back()},duration:8e3}))},[_r]);const _l=e=>{Fo(R),_t.select(e.zone===be?{index:e.index}:{index:e.index,zone:e.zone})},es=K(),ns=()=>({data:bt.data,device:co,ops:_t,inspector:qo}),ts=es?.model,os=On(()=>ts?e=>ts(e,Ul(e),ns()):Ul,[ts,Ul,co]),rs=es?.measure,is=rs?(e,n)=>rs(e,n,ns()):void 0,ls=es?.canDrop,ss=ls?(e,n)=>ls(e,n,jl,ns()):jl,ds=es?.drop,cs=ds?(e,n)=>ds(e,n,Wl,ns()):Wl,as=es?.pick,ps=as?e=>as(e,_l,ns()):_l,us=e=>{const n=zn(e),t=yi(n);t&&bi(t.node,t.slot,!1),Xi(n,e.index)},fs=(e,n)=>/* @__PURE__ */Jn(Ae,{...ft?{}:Dl.seam({place:{...Cn(e),index:n}})},`seam:${e}:${n}`),hs={rowClick:Ki,isCollapsed:Ir,toggleCollapse:Nr},ms=e=>{const n=String(e.props.id),t=_r.findIndex(e=>String(e.props.id)===n),o=$t(n),r=hi(o),i=Ir(n),l=di(e.type),s=sr.rowName?sr.rowName(e,"section",l):l,d=e=>fs(o,e);/* @__PURE__ */
11
- return Gn(Kn,{children:[
12
- /* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:e.type,size:13}),name:s,preview:Zi(e),marks:qi(e),onSelect:()=>Vi(t),nameSlot:Ii(be,t,n,s),selected:Ho===n,badge:xl,actions:Qi(e,be,t)??void 0,rowProps:{"data-node-id":n,onClick:Ki(()=>Vi(t))},fold:{open:!i,label:"section",onToggle:()=>Nr(n)}}),!i&&/* @__PURE__ */Gn(Te,{children:[r.map((n,t)=>{const r=String(n.props.id),i=pi(n),l=al(n),s=l&&Ir(r),c=()=>ul(o,t,r,e.type),{rowProps:a,...p}=Dl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Cn(o),index:t}},{"data-node-id":r,onClick:Ki(c)});/* @__PURE__ */
13
- return Gn(Mn,{children:[d(t),
14
- /* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:n.type,size:13}),name:i,preview:Zi(n),marks:qi(n),onSelect:c,nameSlot:Ii(o,t,r,i),selected:Ho===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Nr(r)}:void 0,actions:/* @__PURE__ */Gn(Kn,{children:[Yi(o,t,i),Qi(n,o,t),_i(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Jn(Te,{children:Ss(n,2)})]},r)}),d(r.length)]})]})},gs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Dl.dragging,d=!Ir(l)&&s?.rung?.nodeId!==i,c={...Cn(l),index:0},a=s&&!s.rung&&jl(s,c)?c:void 0,p=()=>bi(e,n,!0),{rowProps:u,...f}=Dl.row({item:{id:`rung:${l}`,zone:`${i}:${nt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:nt,index:t},into:a,canDrag:Boolean(er.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Ki(p)}),h=ft?null:er.slotActions?.(e,n.slot);/* @__PURE__ */
15
- return Gn(Mn,{children:[n.heading,
16
- /* @__PURE__ */Jn($e,{words:Vt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Si===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Nr(l)},actions:h&&h.length>0?/* @__PURE__ */Jn(Kn,{children:h.map((t,o)=>/* @__PURE__ */Jn(je,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(ft||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__ */Jn(Hn,{size:15}):/* @__PURE__ */Jn(Xn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Jn(Te,{children:r})]},l)},ys=(e,n)=>{const t=rl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
17
- return Jn(Kn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=sl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=(e,n)=>fs(e,n),p=/* @__PURE__ */Gn(Kn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Ho===String(n.props.id),{collapsible:i,folded:s}=dl(n,l,pl(n.type)),d=String(n.props.id),c=Ol(n),p=()=>ul(t,o,d,e.type),{rowProps:u,...f}=Dl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Cn(t),index:o}},{"data-node-id":d,onClick:Ki(p)});/* @__PURE__ */
18
- return Gn(Mn,{children:[0===o&&a(t,0),
19
- /* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:n.type,size:13}),name:c,preview:Zi(n),marks:qi(n),onSelect:p,nameSlot:Ii(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Nr(d)}:void 0,actions:/* @__PURE__ */Gn(Kn,{children:[Yi(t,o,c),Qi(n,t,o),_i(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Jn(Te,{children:ys(n,l+1)}),a(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?a(d,0):null:0!==i.length||!t.rung&&d!==c?null:a(c,0)]});return t.rung?gs(e,t.rung,r++,o,p):/* @__PURE__ */Jn(Mn,{children:p},t.slot??"")})})},Ss=(e,n)=>{const t=or(bt?.data,e.type,String(e.props.id)),o=rl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
20
- return Jn(Kn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=sl(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>fs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),S=/* @__PURE__ */Gn(Kn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Ho===String(n.props.id),i=Ci(n),l=String(n.props.id),{collapsible:d,folded:c}=dl(n,s,pl(n.type)),a=tl(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...Cn(p),index:hi(p).length}:void 0,f=Dl.dragging,h=u&&f&&jl(f,u)?u:void 0,g=()=>ul(t,o,l,e.type),{rowProps:y,...S}=Dl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Cn(t),index:o},into:h,canDrag:!nr(n.type)},{"data-node-id":l,onClick:Ki(g)});/* @__PURE__ */
21
- return Gn(Mn,{children:[0===o&&m(t,0),
22
- /* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:n.type,size:13}),name:i,preview:Zi(n),marks:qi(n),onSelect:g,nameSlot:Ii(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Nr(l)}:void 0,actions:nr(n.type)?Qi(n,t,o)??void 0:/* @__PURE__ */Gn(Kn,{children:[Yi(t,o,i),Qi(n,t,o),_i(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Jn(Te,{children:Ss(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
23
- /* @__PURE__ */Jn(w,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>fl(e.props.id,c.slot,c.childType,a.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?gs(e,o.rung,i++,r,S):/* @__PURE__ */Jn(Mn,{children:S},o.slot??"")})})},ks=$o||null!==fo,bs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:no&&!ks&&_o===e.id,onSelect:()=>Yr(e.id)}:e,vs=[...(Qo.railLead??[]).map(bs),{id:"sections",label:Et.layers,icon:/* @__PURE__ */Jn(ae,{}),active:no&&!ks&&"sections"===_o,onSelect:()=>Yr("sections")},...(Qo.railTrail??[]).map(bs)];uo?vs.push({id:"media",label:Et.railMedia,icon:/* @__PURE__ */Jn(pe,{}),active:no&&!$o&&(null!==fo||"media"===_o),onSelect:()=>Yr("media")}):yt&&vs.push({id:"media",label:Et.railMedia,icon:/* @__PURE__ */Jn(pe,{}),onSelect:Zr});const ws=[...Qo.railLead??[],...Qo.railTrail??[]].find(e=>"panel"in e&&e.id===_o),xs=Boolean(Rt?.foldable),zs=Rt?.label??(St?Et.pageSections:Et.templateSections),Cs=xs&&Ir(tt),Bs=/* @__PURE__ */Gn(Kn,{children:[_r.map((e,n)=>{if(Mt(e)||jt(e)||Pt(e.type))return null;const t=Ho===String(e.props.id),o=Boolean(e.props._hidden);ol(e);const r=String(e.props.id),i=Qo.hasOwnRows?.(e)??!1,l=al(e)||i,s=l&&Ir(r),d=tl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...Cn(c),index:hi(c).length}:void 0,p=Dl.dragging,u=a&&p&&jl(p,a)?a:void 0,{rowProps:f,...h}=Dl.row({item:{id:r,zone:be,index:n,type:e.type},place:{...Cn(be),index:n},into:u},{"data-node-id":r,onClick:Ki(()=>Vi(n))});/* @__PURE__ */
24
- return Gn(Mn,{children:[n>0&&el(n),
25
- /* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:e.type,size:13}),name:pi(e),preview:Zi(e),marks:qi(e),onSelect:()=>Vi(n),nameSlot:Ii(be,n,r,pi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Nr(r)}:void 0,actions:/* @__PURE__ */Gn(Kn,{children:[Yi(be,n,pi(e)),Qi(e,be,n),_i(be,n,e,pi(e))]}),rowProps:f}),al(e)&&!s&&/* @__PURE__ */Gn(Te,{children:[Ss(e,1),Qo.partRows?.(e,hs)]}),i&&!s&&/* @__PURE__ */Jn(Te,{children:Qo.ownRows?.(e,n,hs)})]},String(e.props.id??n))}),Bl>0&&el(Bl)]}),Is=(e,n,t)=>{const o=String(e.props.id),r=il(e).length>0||ll(e)||Boolean(ir(e.type)),i=r&&Ir(o),l="header"===t?Et.header:Et.footer,s=sr.rowName?sr.rowName(e,"section",l):l;/* @__PURE__ */
26
- return Gn(Kn,{children:[
27
- /* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:t,size:13}),name:s,preview:Zi(e),marks:qi(e),badge:xl,onSelect:()=>Vi(n),nameSlot:Ii(be,n,o,s),selected:Ho===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Nr(o)}:void 0,actions:Qi(e,be,n)??void 0,rowProps:{"data-node-id":o,onClick:Ki(()=>Vi(n))}}),r&&!i&&/* @__PURE__ */Jn(Te,{children:ys(e,1)})]})};return(Qo.wrap??(e=>e))(
28
- /* @__PURE__ */Jn(Y,{target:zo,children:/* @__PURE__ */Gn("div",{ref:xo,className:"sf-editor es-editor",style:Qe(wr),onContextMenu:Li.onEditorContextMenu,...u(hn),children:[
29
- /* @__PURE__ */Gn(He,{children:[
30
- /* @__PURE__ */Jn(De,{items:vs,ariaLabel:Et.bar.views}),
31
- /* @__PURE__ */Gn(Ue,{children:[
32
- /* @__PURE__ */Jn(Xe,{label:Et.bar.undo,disabled:Boolean(ft)||!wt.hasPast,onClick:()=>wt.back(),children:/* @__PURE__ */Jn(En,{})}),
33
- /* @__PURE__ */Jn(Xe,{label:Et.bar.redo,disabled:Boolean(ft)||!wt.hasFuture,onClick:()=>wt.forward(),children:/* @__PURE__ */Jn(Vn,{})}),
34
- /* @__PURE__ */Jn(Je,{}),
35
- /* @__PURE__ */Jn(Ge,{devices:oo,value:co,onChange:ao}),
36
- /* @__PURE__ */Jn(Xe,{label:Et.bar.refresh,tip:Et.bar.refreshTip,onClick:()=>{wo.current=(()=>{const e=zo?.document;if(!e)return null;const n=_r.findIndex(jt),t=n>=0?n:_r.length;let o=null;for(let n=0;n<t;n++){const t=_r[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=xt?.props?.id??_r[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),vo(e=>e+1)},children:/* @__PURE__ */Jn(Fn,{})})]}),
37
- /* @__PURE__ */Gn(Ue,{kind:"right",style:{minWidth:300},children:[
38
- /* @__PURE__ */Jn(k,{input:Oo,words:Et.saveStatus}),Qo.barLead?.(),Qo.barTrail?.(),Qo.mainAction||!Qo.barMain?/* @__PURE__ */Jn(b,{input:Oo,action:Qo.mainAction??{label:Et.done,onPress:()=>{it(bt.data)}},readOnly:Boolean(ft),saveSwitch:mt,onToggleAutoSave:ct,onSaveNow:Po,bar:Et.bar,words:Et.saveStatus}):Qo.barMain()]})]}),
39
- /* @__PURE__ */Jn(ne,{}),
40
- /* @__PURE__ */Gn("div",{className:"sf-body",children:[no?/* @__PURE__ */Gn(Kn,{children:[
41
- /* @__PURE__ */Jn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Et.leftPanel,children:$o?/* @__PURE__ */Jn(x,{at:jo?{label:(e=>{const n=Ll(e.zone);if(n)return Et.add.addingTo({name:sr.rowName?Gi(n,!0):di(n.type)});if(e.zone===be){const n=_r[e.index];return n&&!jt(n)?Et.add.addingBefore({name:Gi(n,!0)}):Et.add.addingAtEnd}const t=Rl(e.zone);return t?Et.add.addingTo({name:t.parentName}):Et.add.addingHere})(jo),onClear:()=>Ao(null)}:void 0,placeBlocks:jo&&jo.zone!==be?Rl(jo.zone)?.choices:void 0,canTake:jo?e=>{if(!jo)return null;const n={...Cn(jo.zone),index:jo.index};if(Vl(e,n))return null;const t=Ll(jo.zone);if(t)return Et.add.notInside({name:Gi(t,!0)});if(jo.zone===be)return Et.add.onlySections;const o=Rl(jo.zone);return o?Et.add.notInside({name:o.parentName}):Et.add.onlySections}:void 0,onPick:jo?e=>{if(!jo)return;const n={...Cn(jo.zone),index:jo.index};Vl(e,n)&&(Fl(e,n),Ji())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Hl,siteWide:Qo.addPanelRow?.(Ji),onClose:Ji,onHide:Gr,readOnly:Boolean(ft)}):fo&&po?
42
- /* @__PURE__ */Jn(I,{panel:po,pick:fo,onHide:Gr}):ws?ws.panel({onHide:Gr,notify:Tr}):"media"===_o&&po?/* @__PURE__ */Jn(I,{panel:po,pick:null,onHide:Gr}):/* @__PURE__ */Gn(Kn,{children:[
43
- /* @__PURE__ */Jn(z,{icon:/* @__PURE__ */Jn(ae,{}),title:Et.layers,context:Jt,actions:/* @__PURE__ */Gn(Kn,{children:[!ft&&/* @__PURE__ */Jn(Ke,{label:Et.add.title,onClick:()=>Ui(null),children:/* @__PURE__ */Jn(Wn,{size:15})}),
44
- /* @__PURE__ */Jn(Ke,{label:Nl?Et.expandAll:Et.collapseAll,title:0===Il.length?Et.nothingToFold:void 0,disabled:0===Il.length,onClick:()=>vr(e=>{const n=new Set(Il);return Nl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Il])}),children:/* @__PURE__ */Jn(Qn,{expand:Nl})})]}),onHide:Gr}),
45
- /* @__PURE__ */Gn(Le,{className:"sf-tree sf-scroll",words:Vt,children:[
46
- /* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:"page",size:13}),name:Et.pageSettings,onSelect:qr,selected:!xt&&Wo,rowProps:{onClick:Ki(qr)}}),zl&&/* @__PURE__ */Gn(Kn,{children:[!wl&&/* @__PURE__ */Jn(Me,{children:Et.header}),ms(zl)]}),kt&&!(wl&&zl)&&/* @__PURE__ */Gn(Kn,{children:[!wl&&/* @__PURE__ */Jn(Me,{children:Et.header}),!At&&/* @__PURE__ */Jn($e,{words:Vt,icon:/* @__PURE__ */Jn(cr,{type:"header",size:13}),name:Et.header,badge:xl,onSelect:Qr,selected:Vo.kind===Lt?.kind,rowProps:{onClick:Ki(Qr)}})]}),kl&&!(wl&&zl)&&Is(kl,Sl,"header"),!xs&&/* @__PURE__ */Jn(Me,{children:zs}),xs?/* @__PURE__ */Gn(Kn,{children:[
47
- /* @__PURE__ */Jn($e,{words:Vt,icon:null,name:zs,fold:{open:!Cs,label:zs,onToggle:()=>Nr(tt)}}),!Cs&&/* @__PURE__ */Jn(Te,{children:Bs})]}):Bs,kt&&!wl&&/* @__PURE__ */Jn(Me,{children:Et.footer}),yl&&!(wl&&Cl)&&Is(yl,gl,"footer"),Cl&&ms(Cl),Qo.treeFoot?.()]})]})}),
48
- /* @__PURE__ */Jn(Ye,{side:"left",width:wr.left,min:qe,max:Ze,defaultWidth:m.left,label:Et.resizeLeftPanel,onResize:Cr})]}):/* @__PURE__ */Jn(C,{side:"left",onShow:Gr}),
49
- /* @__PURE__ */Gn("div",{ref:Lr,className:"sf-center sf-scroll","data-sf-canvas-head":Er?"":void 0,style:{overflowX:Ur?"auto":"hidden",overflowY:"hidden"},children:[Er&&/* @__PURE__ */Jn("div",{ref:Vr,className:"sf-canvas-head",children:/* @__PURE__ */Jn(Er,{device:co})}),
50
- /* @__PURE__ */Gn("div",{className:"sf-frame-scaler",style:Xr,children:[
51
- /* @__PURE__ */Jn("div",{className:"sf-frame "+(co===lo?"":`sf-frame--${co}`),style:Jr,children:/* @__PURE__ */Gn("div",{className:"sf-preview-host",children:[
52
- /* @__PURE__ */Jn(Pe.Provider,{value:vl,children:/* @__PURE__ */Jn(Gt,{},bo)}),
53
- /* @__PURE__ */Jn(sn,{canvas:zo,session:Hl,model:os,measure:is,canDrop:ss,onDrop:cs,choose:Jl,onPick:ps,onZoneAdd:us,onSeamAdd:us,zoneAddLabel:Et.canvasAddBlock,words:Ft.canvas,readOnly:Boolean(ft),revision:bt.data}),Ro.length>0&&!Co&&/* @__PURE__ */Jn("div",{className:"sf-preview-gaps",children:Ro.map(e=>
54
- /* @__PURE__ */Jn(dn,{index:e.index,label:Et.addSectionHere,onInsert:()=>Ui(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))})]})}),bl?/* @__PURE__ */Jn(qn,{canvas:zo,tabs:Zl,onSelect:e=>{const n=_r.findIndex(n=>String(n.props.id)===e);n>=0&&Vi(n)}}):null]})]}),to?/* @__PURE__ */Gn(Kn,{children:[
55
- /* @__PURE__ */Jn(f,{value:{selectChild:ul,addChild:fl,childRowName:Ci,blockRowName:Ol},children:/* @__PURE__ */Jn(Kt,{mode:Vo,onOpenWebsiteSettings:Qo.openSettings??(()=>{}),onOpenSiteStyles:Qo.openStyles,onSelectNode:fr,onNotify:Tr,onHidePanel:Kr,nodeActions:xt?ve(Ct,xt.type):ot})}),
56
- /* @__PURE__ */Jn(Ye,{side:"right",width:wr.right,min:qe,max:Ze,defaultWidth:m.right,label:Et.resizeSettingsPanel,onResize:Br})]}):
57
- /* @__PURE__ */Jn(C,{side:"right",onShow:Kr})]}),Li.menu]})}))}export{rt as ScreenChrome};