efficient-easel 14.0.0 → 14.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 (29) hide show
  1. package/README.md +5 -3
  2. package/dist/chrome/chrome.css +23 -21
  3. package/dist/{chunk-IWFVVCRN.js → chunk-2H3W5OLQ.js} +1 -1
  4. package/dist/{chunk-3DCI44F3.js → chunk-35VMTYPH.js} +4 -4
  5. package/dist/{chunk-F6NO7B57.js → chunk-XUAKHY4T.js} +27 -27
  6. package/dist/{chunk-FBS75I6E.js → chunk-ZZ64CEC2.js} +2 -2
  7. package/dist/{host-GOlVK3LX.d.ts → host-DGmdCaNL.d.ts} +10 -1
  8. package/dist/screen/components/MediaSidePanel.d.ts +1 -1
  9. package/dist/screen/components/NodeContextMenu.d.ts +1 -1
  10. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  11. package/dist/screen/components/SaveControls.d.ts +1 -1
  12. package/dist/screen/components/ScreenChrome.js +1 -1
  13. package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
  14. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  15. package/dist/screen/components/ScreenMount.d.ts +1 -1
  16. package/dist/screen/components/ScreenMount.js +1 -1
  17. package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
  18. package/dist/screen/components/SectionScreenShell.js +8 -8
  19. package/dist/screen/components/usePartBridge.d.ts +1 -1
  20. package/dist/screen/index.d.ts +1 -1
  21. package/dist/screen/index.js +1 -1
  22. package/dist/screen/lib/document-addressing.d.ts +1 -1
  23. package/dist/screen/lib/host.d.ts +1 -1
  24. package/dist/screen/lib/media-panel.d.ts +1 -1
  25. package/dist/screen/lib/media-picker.d.ts +1 -1
  26. package/dist/screen/lib/puck/style-clipboard.d.ts +1 -1
  27. package/dist/screen/lib/screen-parts.d.ts +1 -1
  28. package/dist/screen/screen.css +1 -1
  29. package/package.json +1 -1
package/README.md CHANGED
@@ -365,9 +365,11 @@ const { name, kind } = headWords({ name: 'At zero', tier: 'part', of: 'Countdown
365
365
  <div className="es-insp-body">{/* the panel's rows */}</div>
366
366
  ```
367
367
 
368
- `es-insp-body` is the settings body's side inset, owned here: 16px, and 8px
369
- under a 284px panel. It is opt-in, so a host adds the class and deletes its own
370
- side padding.
368
+ `es-insp-body` gives the settings body the panel's side inset, owned here:
369
+ 16px, and 12px under a 260px panel. The heads read the same value, the
370
+ `--es-insp-pad-x` token (one home since 14.1.0); a host that must line up
371
+ with the panel's edge reads it too. It is opt-in, so a host adds the class
372
+ and deletes its own side padding.
371
373
 
372
374
  ## The Layers tree — one row at every depth
373
375
 
@@ -252,6 +252,22 @@
252
252
  ask the panel's width, never the screen's. */
253
253
  container-type: inline-size;
254
254
  }
255
+ /* THE PANEL'S SIDE INSET, ONE HOME: 16, AND 12 UNDER A 260px PANEL (one
256
+ spacing scale, owner ruling 2026-10-02). Every panel head and the settings
257
+ body read `--es-insp-pad-x` and set no side padding of their own
258
+ (`tests/panel-one-inset.test.ts`). Until 14.1.0 the heads wrote 16 and 12
259
+ as literals and the body had its own token, 16 and 8 under 284, so a head
260
+ and its rows could sit 4px apart. On the editor root too, so a head drawn
261
+ outside a side panel still has the inset. The narrow value is set on the
262
+ panel's CHILDREN: a size query answers for the elements inside a container,
263
+ never for the container itself, and the children hand it down. */
264
+ .es-editor,
265
+ .es-sidepanel {
266
+ --es-insp-pad-x: var(--es-space-16, 16px);
267
+ }
268
+ @container (width < 260px) {
269
+ .es-sidepanel > * { --es-insp-pad-x: var(--es-space-12, 12px); }
270
+ }
255
271
  .es-sidepanel--left {
256
272
  width: var(--es-left-w, 288px);
257
273
  border-right: 1px solid var(--es-line);
@@ -264,7 +280,7 @@
264
280
  display: flex;
265
281
  align-items: center;
266
282
  justify-content: space-between;
267
- padding: 12px 16px;
283
+ padding: 12px var(--es-insp-pad-x);
268
284
  flex: none;
269
285
  }
270
286
  /* A panel's own name. States the margin an h2 would otherwise bring. */
@@ -307,7 +323,7 @@
307
323
  display: flex;
308
324
  flex: none;
309
325
  min-width: 0;
310
- padding: 12px 16px 0;
326
+ padding: 12px var(--es-insp-pad-x) 0;
311
327
  }
312
328
  /* The link is the shell's Button (`link`) in its Tooltip's wrapper; only its
313
329
  truncation is laid out here — a long name is cut inside the panel. */
@@ -334,37 +350,23 @@ span:has(> .es-insp-up-btn) {
334
350
  flex-wrap: wrap;
335
351
  align-items: center;
336
352
  gap: 8px 12px;
337
- padding: 12px 16px;
353
+ padding: 12px var(--es-insp-pad-x);
338
354
  flex: none;
339
355
  }
340
- /* THE PANEL'S OWN PADDING IS 16, AND 12 UNDER 260px (one spacing scale, owner
341
- ruling 2026-10-02). The side panel is the size container (above), so this
342
- asks the panel's width — a panel is dragged between 220 and 560 — and never
343
- the screen's. Only the heads are padded here: the settings body's padding
344
- is the host's. */
345
- @container (width < 260px) {
346
- .es-panel-head,
347
- .es-insp-head,
348
- .es-insp-up { padding-inline: 12px; }
349
- }
350
356
 
351
357
  /* THE SETTINGS BODY'S ROW INSET, OWNED HERE AND OPT-IN (one text panel v3,
352
358
  wave 2 · E1). Each editor padded its own body — the website 16px and 8px
353
359
  under a 284px panel (`storefront-editor.css` `.sf-insp-body`, card 66212's
354
360
  measured line), the email designer `p-3` plus 16px sides of its own — so the
355
361
  same text panel sat at two insets and the email one cut Alignment at 220.
356
- A host that puts `es-insp-body` on its panel body gets the website's numbers
362
+ A host that puts `es-insp-body` on its panel body gets the panel's inset
357
363
  and deletes its own; a host that does not is unchanged (no breaking change).
358
- ONLY THE SIDES: the room above and below stays the host's. The inset is ONE
359
- name, so anything that must line up with it reads the same value. The side
360
- panel is the size container (`.es-sidepanel`), so this asks the panel. */
364
+ ONLY THE SIDES: the room above and below stays the host's. Since 14.1.0 the
365
+ body reads the panel's ONE inset (above), the same value as the heads: it
366
+ had its own, 8 under 284. */
361
367
  .es-insp-body {
362
- --es-insp-pad-x: var(--es-space-16, 16px);
363
368
  padding-inline: var(--es-insp-pad-x);
364
369
  }
365
- @container (width < 284px) {
366
- .es-insp-body { --es-insp-pad-x: var(--es-space-8, 8px); }
367
- }
368
370
  /* A HEAD WITH A WAY-OUT WORD, UNDER 260px (card [MERGE] One Media Panel Head
369
371
  For Both Editors, GG 2026-10-06). At a 220px panel the chip, Cancel, the
370
372
  hairline and Hide left the titles about 38px: "Choose image" drew "Ch…" in
@@ -1 +1 @@
1
- import{useScreenDocument as n}from"./chunk-FBS75I6E.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VVPZMWJE.js";import{EditNotice as r}from"./chunk-IE55HNMA.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
1
+ import{useScreenDocument as n}from"./chunk-ZZ64CEC2.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VVPZMWJE.js";import{EditNotice as r}from"./chunk-IE55HNMA.js";import{useWords as e}from"./chunk-MFIRYGHW.js";import{jsx as i}from"react/jsx-runtime";function t(){const{capabilities:t,access:c,takeOverEditing:a,viewReadOnly:s,saveConflict:m,reloadFromServer:u}=n(),{noun:l}=e("screen",o);return t.hasEditGuard?/* @__PURE__ */i(r,{access:c,conflict:m,noun:l,onTakeOver:a,onViewReadOnly:s,onReload:u}):null}export{t as PageEditGuardNotices};
@@ -1,7 +1,7 @@
1
- import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-F6NO7B57.js";import{ScreenStoreProvider as e}from"./chunk-YKJ3RIMT.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-FBS75I6E.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VVPZMWJE.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var k=r(e),C=r(n);function N({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const k=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
1
+ import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-XUAKHY4T.js";import{ScreenStoreProvider as e}from"./chunk-YKJ3RIMT.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-ZZ64CEC2.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-VVPZMWJE.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var C=r(e),k=r(n);function j({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const C=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
2
2
  return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
3
3
  /* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
4
4
  /* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
5
- /* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{k()},children:i.save})]}),children:i.body})}function j({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
6
- return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var y=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function M({config:r,parts:n,wrap:e=y}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:j}=a(),M=t(()=>s(!g),[g]),F=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:F.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
7
- /* @__PURE__ */u(k,{config:r,data:i,onChange:h,permissions:M,parts:n,children:/* @__PURE__ */u(C,{})}),f&&/* @__PURE__ */u(N,{onCancel:p,onDiscard:v,onSave:j})):/* @__PURE__ */u("div",{className:"sf-msg",children:F.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:F.waitingForAuthorization})}export{M as DocumentScreen,j as ScreenMount};
5
+ /* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{C()},children:i.save})]}),children:i.body})}function y({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
6
+ return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var N=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function H({config:r,parts:n,wrap:e=N}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:y}=a(),H=t(()=>s(!g),[g]),M=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:M.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
7
+ /* @__PURE__ */u(C,{config:r,data:i,onChange:h,permissions:H,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(j,{onCancel:p,onDiscard:v,onSave:y})):/* @__PURE__ */u("div",{className:"sf-msg",children:M.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:M.waitingForAuthorization})}export{H as DocumentScreen,y as ScreenMount};
@@ -1,30 +1,30 @@
1
- import{styleClipboardOf as e}from"./chunk-XT6DOSHO.js";import{markedTreeNodeId as n,revealSelectedTreeRow as t,sameSelector as o}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as r}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as i}from"./chunk-26OOWIJJ.js";import{ScreenSaveIcon as l,ScreenMainButton as s}from"./chunk-RSKHAHPJ.js";import{useBrowserOffline as d}from"./chunk-RKTF5XLP.js";import{scrollPreviewToSection as c,gotoPreviewSlide as a,scrollPreviewToTop as p}from"./chunk-3Z2MVLCD.js";import{useEaselKeyTarget as u,useEaselUndoKeys as f,useEaselSaveKey as h,editorRootFocus as m}from"./chunk-CY52PUMZ.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as S,clampPanelWidth as k}from"./chunk-TZIIRGVY.js";import{usePartBridge as v}from"./chunk-CMXK3JT3.js";import{useSectionOps as b}from"./chunk-TR4APEJZ.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-D46OYLJR.js";import{SidePanelHead as z,PanelShowStrip as C}from"./chunk-62VPYC7F.js";import{MediaSidePanel as B}from"./chunk-44QA42OJ.js";import{useScreenSaveSwitch as I,useScreenNodeKeys as N,useScreenPinned as O,useScreenDocumentLabel as P,useScreenCanvasFrame as $,useScreenInspectorPanel as M,useScreenDevices as T,useScreenPickFollowsSelection as j,useScreenLeftView as A,SELECTION_MODE as L,sameInspectorMode as R,useScreenBridges as E,useScreenBlockRules as V,useScreenBlockLook as F,useScreenStorageNamespace as H,useScreenNotify as W,useScreenCanvasHead as D,isSlotMode as J,useScreenStyleClipboard as U,useScreenDocumentPass as Y,useScreenCanvasDrag as G,ScreenCanvasTargetProvider as X,isPinnedFirst as K,isPinnedLast as Z,screenSlotsOf as q}from"./chunk-CSGTPJTY.js";import{useNodeClipboard as _,useNodeContextMenu as Q}from"./chunk-NW4LJ4G4.js";import{PageEditGuardNotices as ee}from"./chunk-IWFVVCRN.js";import{useScreenDocument as ne}from"./chunk-FBS75I6E.js";import{requestMediaPick as te}from"./chunk-KG7RJWOK.js";import{useMediaPanel as oe,usePanelPick as re,useCancelPanelPick as ie}from"./chunk-R6WTQWAC.js";import{useEaselSession as le}from"./chunk-O7Q4DDJT.js";import{useEaselHost as se,useHostEscape as de}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as ce}from"./chunk-VVPZMWJE.js";import{heldStyle as ae,styleShortcut as pe}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ue}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as fe}from"./chunk-WK3AFPXY.js";import{rootRowName as he,slotChildRowName as me,slotChildRenameProp as ge,sectionRenameProp as ye}from"./chunk-TBF5CVPA.js";import{ROOT_ZONE as Se,blockNodeActions as ke,TREE_MAX_DEPTH as ve,childSlotsOf as be,slotFieldsOf as we,slotChildrenIn as xe,nestsInTree as ze,newNodeId as Ce}from"./chunk-PLVEGYK6.js";import{useEasel as Be,useEaselApi as Ie,CanvasPassThroughContext as Ne}from"./chunk-LPM2SCM4.js";import{toItemSelector as Oe,useNodeOps as Pe,clickPick as $e}from"./chunk-ECM5F6JJ.js";import{TreeRow as Me,Subtree as Te,LayersTree as je,TreeGroupLabel as Ae,TreeRowAction as Le,TreeSeam as Re}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Ee}from"./chunk-K56YDHYQ.js";import{LayersIcon as Ve,MediaIcon as Fe}from"./chunk-4VJATVVR.js";import{EaselTopBar as He,TopBarRail as We,TopBarCluster as De,EaselIconButton as Je,TopBarDivider as Ue,DeviceSwitch as Ye,InspectorIconButton as Ge,PanelResizeHandle as Xe,MAX_PANEL_W as Ke,MIN_PANEL_W as Ze,panelWidthVars as qe}from"./chunk-IE55HNMA.js";import{DEFAULT_NOTICE_WORDS as _e,DEFAULT_CHROME_WORDS as Qe}from"./chunk-Z6PVRXVY.js";import{holderOf as en,nameOrSomeone as nn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as tn}from"./chunk-RE4LP46F.js";import{useWords as on}from"./chunk-MFIRYGHW.js";import{insertSeams as rn,CanvasDragLayer as ln,CanvasInsert as sn}from"./chunk-QFVRMARS.js";import{DEFAULT_DRAG_WORDS as dn}from"./chunk-AYWN5NRH.js";import{createDragSession as cn,useTreeDrag as an,gapToMoveIndex as pn}from"./chunk-67GNT6PF.js";import{useCanvasFrame as un,LIST_SELECTOR as fn,BLOCK_SELECTOR as hn,useCanvasEvent as mn,nodeIdAt as gn,frameRectToHost as yn,BLOCK_ATTRIBUTE as Sn,drawnBox as kn}from"./chunk-ILXP5VX5.js";import{ROOT_ID as vn,ROOT_SLOT as bn,zoneKey as wn,parseZoneKey as xn,find as zn,DataError as Cn}from"./chunk-KRXQM65X.js";import{useRef as Bn,useMemo as In,useState as Nn,useEffect as On,useCallback as Pn,useLayoutEffect as $n,Fragment as Mn}from"react";import{ColoredBadge as Tn,toast as jn,groupColors as An}from"efficient-shell/ui";import{UndoIcon as Ln,RedoIcon as Rn,RefreshIcon as En,AddIcon as Vn,TrashIcon as Fn,EyeOffIcon as Hn,EyeIcon as Wn,DuplicateIcon as Dn}from"efficient-shell/icons/efficient";import{jsx as Jn,jsxs as Un,Fragment as Yn}from"react/jsx-runtime";var Gn=/* @__PURE__ */new WeakSet;function Xn(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 Kn({canvas:e,tabs:n,onSelect:t}){const o=Bn(null),[r,i]=Nn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return $n(()=>{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=yn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${Sn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?kn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=yn(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(Tn,{colorClass:An("info","solid"),size:"sm",children:e.label})},e.id):null})})}function Zn({expand:e}){/* @__PURE__ */
1
+ import{styleClipboardOf as e}from"./chunk-XT6DOSHO.js";import{markedTreeNodeId as n,revealSelectedTreeRow as t,sameSelector as o}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as r}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as i}from"./chunk-26OOWIJJ.js";import{ScreenSaveIcon as l,ScreenMainButton as s}from"./chunk-RSKHAHPJ.js";import{useBrowserOffline as d}from"./chunk-RKTF5XLP.js";import{scrollPreviewToSection as c,gotoPreviewSlide as a,scrollPreviewToTop as p}from"./chunk-3Z2MVLCD.js";import{useEaselKeyTarget as u,useEaselUndoKeys as f,useEaselSaveKey as h,editorRootFocus as m}from"./chunk-CY52PUMZ.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-TZIIRGVY.js";import{usePartBridge as v}from"./chunk-CMXK3JT3.js";import{useSectionOps as b}from"./chunk-TR4APEJZ.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-D46OYLJR.js";import{SidePanelHead as z,PanelShowStrip as C}from"./chunk-62VPYC7F.js";import{MediaSidePanel as B}from"./chunk-44QA42OJ.js";import{useScreenSaveSwitch as I,useScreenNodeKeys as O,useScreenPinned as N,useScreenDocumentLabel as P,useScreenCanvasFrame as $,useScreenInspectorPanel as M,useScreenDevices as T,useScreenPickFollowsSelection as j,useScreenLeftView as A,SELECTION_MODE as L,sameInspectorMode as R,useScreenBridges as E,useScreenBlockRules as V,useScreenBlockLook as F,useScreenStorageNamespace as H,useScreenNotify as W,useScreenCanvasHead as D,isSlotMode as J,useScreenStyleClipboard as U,useScreenDocumentPass as Y,useScreenCanvasDrag as G,ScreenCanvasTargetProvider as X,isPinnedFirst as Z,isPinnedLast as K,screenSlotsOf as q}from"./chunk-CSGTPJTY.js";import{useNodeClipboard as _,useNodeContextMenu as Q}from"./chunk-NW4LJ4G4.js";import{PageEditGuardNotices as ee}from"./chunk-2H3W5OLQ.js";import{useScreenDocument as ne}from"./chunk-ZZ64CEC2.js";import{requestMediaPick as te}from"./chunk-KG7RJWOK.js";import{useMediaPanel as oe,usePanelPick as re,useCancelPanelPick as ie}from"./chunk-R6WTQWAC.js";import{useEaselSession as le}from"./chunk-O7Q4DDJT.js";import{useEaselHost as se,useHostEscape as de}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as ce}from"./chunk-VVPZMWJE.js";import{heldStyle as ae,styleShortcut as pe}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ue}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as fe}from"./chunk-WK3AFPXY.js";import{rootRowName as he,slotChildRowName as me,slotChildRenameProp as ge,sectionRenameProp as ye}from"./chunk-TBF5CVPA.js";import{ROOT_ZONE as ke,blockNodeActions as Se,TREE_MAX_DEPTH as ve,childSlotsOf as be,slotFieldsOf as we,slotChildrenIn as xe,nestsInTree as ze,newNodeId as Ce}from"./chunk-PLVEGYK6.js";import{useEasel as Be,useEaselApi as Ie,CanvasPassThroughContext as Oe}from"./chunk-LPM2SCM4.js";import{toItemSelector as Ne,useNodeOps as Pe,clickPick as $e}from"./chunk-ECM5F6JJ.js";import{TreeRow as Me,Subtree as Te,LayersTree as je,TreeGroupLabel as Ae,TreeRowAction as Le,TreeSeam as Re}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Ee}from"./chunk-K56YDHYQ.js";import{LayersIcon as Ve,MediaIcon as Fe}from"./chunk-4VJATVVR.js";import{EaselTopBar as He,TopBarRail as We,TopBarCluster as De,EaselIconButton as Je,TopBarDivider as Ue,DeviceSwitch as Ye,InspectorIconButton as Ge,PanelResizeHandle as Xe,MAX_PANEL_W as Ze,MIN_PANEL_W as Ke,panelWidthVars as qe}from"./chunk-IE55HNMA.js";import{DEFAULT_NOTICE_WORDS as _e,DEFAULT_CHROME_WORDS as Qe}from"./chunk-Z6PVRXVY.js";import{holderOf as en,nameOrSomeone as nn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as tn}from"./chunk-RE4LP46F.js";import{useWords as on}from"./chunk-MFIRYGHW.js";import{insertSeams as rn,CanvasDragLayer as ln,CanvasInsert as sn}from"./chunk-QFVRMARS.js";import{DEFAULT_DRAG_WORDS as dn}from"./chunk-AYWN5NRH.js";import{createDragSession as cn,useTreeDrag as an,gapToMoveIndex as pn}from"./chunk-67GNT6PF.js";import{useCanvasFrame as un,LIST_SELECTOR as fn,BLOCK_SELECTOR as hn,useCanvasEvent as mn,nodeIdAt as gn,frameRectToHost as yn,BLOCK_ATTRIBUTE as kn,drawnBox as Sn}from"./chunk-ILXP5VX5.js";import{ROOT_ID as vn,ROOT_SLOT as bn,zoneKey as wn,parseZoneKey as xn,find as zn,DataError as Cn}from"./chunk-KRXQM65X.js";import{useRef as Bn,useMemo as In,useState as On,useEffect as Nn,useCallback as Pn,useLayoutEffect as $n,Fragment as Mn}from"react";import{ColoredBadge as Tn,toast as jn,groupColors as An}from"efficient-shell/ui";import{UndoIcon as Ln,RedoIcon as Rn,RefreshIcon as En,AddIcon as Vn,TrashIcon as Fn,EyeOffIcon as Hn,EyeIcon as Wn,DuplicateIcon as Dn}from"efficient-shell/icons/efficient";import{jsx as Jn,jsxs as Un,Fragment as Yn}from"react/jsx-runtime";var Gn=/* @__PURE__ */new WeakSet;function Xn(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 Zn({canvas:e,tabs:n,onSelect:t}){const o=Bn(null),[r,i]=On({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return $n(()=>{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=yn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),c={};for(const o of n){const n=t.querySelector(`[${kn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?Sn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=yn(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(Tn,{colorClass:An("info","solid"),size:"sm",children:e.label})},e.id):null})})}function Kn({expand:e}){/* @__PURE__ */
2
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__ */Un(Yn,e?{children:[
3
3
  /* @__PURE__ */Jn("path",{d:"M8 9l4-4 4 4"}),
4
4
  /* @__PURE__ */Jn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
5
5
  /* @__PURE__ */Jn("path",{d:"M8 4l4 4 4-4"}),
6
6
  /* @__PURE__ */Jn("path",{d:"M8 20l4-4 4 4"}),
7
- /* @__PURE__ */Jn("path",{d:"M5 12h14"})]})})}var qn=`${fn}, ${hn}`;function _n(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 Qn="__rungs";var et="screen:band",nt={duplicate:!0,delete:!0};function tt(){const fn=se(),{target:yn,docId:Sn,capabilities:kn,currentSlug:An,siteId:tt,onPublish:ot,saveState:rt,saveConflict:it,retrySave:lt,toggleAutoSave:st,flushSave:dt,access:ct,saveUnreachable:at=!1,readOnly:pt,readOnlyReason:ut=null}=ne(),ft=I(),ht=N(),{mediaEditing:mt,hasEditGuard:gt,hasPinnedChrome:yt}=kn,{appState:St,dispatch:kt,history:vt,selectedItem:bt,getSelectorForId:wt,config:xt}=Be(e=>e),zt=O(),{first:Ct,firstGroup:Bt,lastGroup:It,isSectionGroup:Nt,sectionGroupZone:Ot,panelOf:Pt}=zt,$t=Pt(Ct),Mt=e=>K(zt,e),Tt=e=>Z(zt,e),jt="node"===zt.firstRow,At=zt.band??null,Lt=on("screen",ce),Rt=on("tree",Ee),Et=on("drag",dn),Vt=on("notice",_e),Ft=on("lock",tn),Ht=on("menu",fe),Wt=on("styleClipboard",ue),Dt=on("chrome",Qe),Jt=P()??`/${An}`,Ut=$(),Yt=M(),Gt=b({readOnly:pt}),Xt=b({readOnly:pt,foldIntoHistory:!0}),Kt=Bn(null),Zt=Ie(),qt=In(()=>({...Gt,select:e=>{Kt.current=e,Gt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Zt.config;Kt.current=Oe(e,t,n)}Gt.commitDocument(e,n)}}),[Gt,Zt]),_t=St.ui,Qt=_t.leftSideBarVisible,eo=_t.rightSideBarVisible,{options:no,widths:to,initial:oo,fluid:ro,fit:io}=T(),[lo,so]=Nn(oo),co=oe(),ao=mt&&null!==co,po=re(),uo=ie();j(bt?.props.id);const{read:fo,write:ho,forSelection:mo}=A(),[go,yo]=Nn(fo);On(()=>{ho(go)},[go]);const[So,ko]=Nn(0),vo=Bn(null),bo=Bn(null),wo=un(bo,{readySelector:qn}),xo=u(bo);f(bo,wo);const zo=d(),Co=en(ct),Bo={state:rt,offline:zo||rt.failed&&at,readOnlyReason:ut,editing:Co?Vt.editing({name:nn(Co.name,Ft),noun:Lt.noun}):null,conflict:null!=it,notSaving:Lt.bar.notSaving},Io=()=>{pt||(rt.failed?lt():dt())};h(bo,wo,Io);const[No,Oo]=Nn(!1),Po=Bn(!1),$o=Bn(!1),[Mo,To]=Nn(null),[jo,Ao]=Nn([]),[Lo,Ro]=Nn(L),Eo="puck"===Lo.kind,Vo=n(Lo,bt?.props.id),[Fo,Ho]=Nn(null);On(()=>{Fo&&(t(),Ho(null))},[Fo]);const Wo=Bn(wt);Wo.current=wt;const Do=Pn((e,{scroll:n})=>{yo(n=>mo(e,n)),n&&Ho(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Wo.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&kr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Jo=Bn(null);On(()=>{const e=Jo.current;Jo.current=null;const n=null==bt?.props.id?null:String(bt.props.id);Ro(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Pt(bt?.type)??L);const t=bt?.props.id,r=Kt.current;if(Kt.current=null,!t)return;const i=wt(t);Do(String(t),{scroll:!o(r,i??null,Se)})},[bt?.props.id,Do]);const Uo=Pn(e=>{Ro(n=>R(n,e)?n:e),kt({type:"setUi",ui:{rightSideBarVisible:!0}})},[kt]),Yo=Bn(()=>{});Yo.current=(e,n)=>{const t=e?ui(e.zone??Se)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==bt?.props.id?null:String(bt.props.id);Ro(e=>R(e,n)?e:n),o!==r&&(Jo.current={id:o,mode:n},qt.select(e))};const Go=Pn((e,n)=>Yo.current(e,n),[]),Xo={kind:Lo.kind,mode:Lo,open:Uo,show:e=>Ro(e),reveal:()=>{eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Go},Ko=E(Xo,{data:St.data,selected:bt??null,zoneOf:e=>wt(e)?.zone,readOnly:Boolean(pt),select:e=>{Ro(L),qt.select({index:e})},replace:(e,n)=>qt.replaceComponent(Se,e,n),scrollTo:e=>Ri(e)},{device:lo,refreshes:So},{setView:yo,reveal:()=>{Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Zo=Ko.pinnedSource??!1,qo=Ko.resolveLeftView?Ko.resolveLeftView(go,ao):"media"===go&&ao?go:"sections",_o=V(),{isLockedBlock:Qo,duplicateBlocked:er,nestDepth:nr,newSectionNode:tr,canAddTo:or,blockIsOffered:rr}=_o,ir=F(),{labelAtLevel:lr,Icon:sr,useProducts:dr}=ir,cr=ir.rowName?(e,n,t)=>ir.rowName(e,n,t):void 0,ar=Pn(e=>{kt({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),Do(e,{scroll:!0})},[kt,Do]),{selectNode:pr,openPartId:ur}=v({mode:Lo,setMode:Ro,onOpenPart:ar}),[fr,hr]=Nn(null);de(null!==fr,()=>hr(null));const mr=y(H()),gr=mr.collapsed,yr=mr.panelWidths,[Sr,kr]=Nn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(gr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
8
- return new Set}});On(()=>{try{window.localStorage.setItem(gr,JSON.stringify([...Sr]))}catch{}},[Sr]);const[vr,br]=Nn(()=>{if("undefined"==typeof window)return{...S};try{const e=window.localStorage.getItem(yr);if(!e)return{...S};const n=JSON.parse(e);return{left:k(Number(n.left)||S.left),right:k(Number(n.right)||S.right)}}catch{return{...S}}});On(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(yr,JSON.stringify(vr))}catch{}},300);return()=>clearTimeout(e)},[vr]);const wr=Pn((e,n)=>br(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),xr=Pn(e=>wr("left",e),[wr]),zr=Pn(e=>wr("right",e),[wr]),Cr=e=>Sr.has(e),Br=e=>kr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Ir=Bn(!1),Nr=Bn(null);On(()=>{if(Ir.current&&!No){const e=Nr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??bo.current?.querySelector(`button[aria-label="${CSS.escape(Lt.add.title)}"]`))?.focus(),Nr.current=null}Ir.current=No},[No]),On(()=>{if(!No||!xo)return;const e=e=>{"Escape"===e.key&&Ui()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[No,xo]),de(No,()=>Ui()),On(()=>{!Qt&&No&&(Oo(!1),To(null),Po.current=!1)},[Qt]),On(()=>{if(!po)return $o.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),void($o.current=!1);No&&(Oo(!1),To(null),$o.current=Po.current,Po.current=!1),Qt||($o.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[po]),On(()=>{!Qt&&po&&($o.current=!1,uo())},[Qt]),On(()=>{if(!po||!xo)return;const e=e=>{"Escape"===e.key&&uo()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[po,xo]),de(null!==po,()=>uo());const Or=W(),Pr=(e,n="success",t)=>{if(Or)return void(t?Or(e,"error"===n?"error":"info",t):Or(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?jn.error(e,{...o,duration:t?.duration??3200}):jn.success(e,{...o,duration:t?.duration??1900})},$r=Bn(null),[Mr,Tr]=Nn(0),[jr,Ar]=Nn(0),Lr=D(),Rr=Bn(null),Er=e=>Math.max(0,e.clientHeight-(Rr.current?.offsetHeight??0));On(()=>{const e=$r.current;if(!e)return;const n=()=>{Tr(e.clientWidth),Ar(Er(e))};n();const t=new ResizeObserver(n);return t.observe(e),Rr.current&&t.observe(Rr.current),()=>t.disconnect()},[]),$n(()=>{$r.current&&(Tr($r.current.clientWidth),Ar(Er($r.current)))},[vr,Qt,eo]);const Vr=lo===ro?Mr>0?Mr:to[ro]:to[lo],Fr=Mr>0?Math.min(Mr/Vr,"shrink"===io?1:2):1,Hr=Vr*Fr,Wr=Mr>0&&Hr>Mr+1,Dr={width:Hr,height:jr||"100%",flex:"none",position:"relative"},Jr={width:Vr,height:jr?jr/Fr:"100%",maxHeight:"none",transform:1!==Fr?`scale(${Fr})`:void 0,transformOrigin:"top left"},Ur=()=>kt({type:"setUi",ui:{leftSideBarVisible:!Qt}}),Yr=()=>kt({type:"setUi",ui:{rightSideBarVisible:!eo}}),Gr=e=>{No&&(Oo(!1),To(null),Po.current=!1,Qt&&go===e)||po&&($o.current=!1,uo(),Qt&&go===e)||(Qt&&go===e?Ur():(yo(e),Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Xr=()=>{te(fn,{accept:"image/*",title:Dt.mediaLibrary})},Kr=()=>{Ro(L),qt.select(null),p()},Zr=()=>{Ro($t??L),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},qr=St.data.content??[],_r=()=>{const e=qr.findIndex(Mt),n=qr.findIndex(Tt);return{floor:e>=0?e+1:0,cap:n>=0?n:qr.length}},Qr=xt,ei=_o.stripCopy,ni=e=>r(e,ei),ti=_(),oi=Pe({data:St.data,config:Qr,readOnly:Boolean(pt),clipboard:ti,strip:ei?e=>ei(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==vn||e.slot!==bn)return{min:0,max:n-1};const{floor:t,cap:o}=_r();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Ro(L);const t=void 0===n||"node"===n?.kind?n:null;qt.commitDocument(e,t)}}),ri=e=>{const n=zn(St.data,xt,e);if(!n)return!1;const t=wn(n.place),o=n.node,r=t===Se?ci(o):xi(o);return!!oi.remove(e)&&(Pr(Lt.deleted({name:r}),"success",{duration:8e3,action:{label:Lt.bar.undo,onClick:()=>{oi.restore(n.node,n.place)}}}),!0)},ii={...oi,remove:ri},li=e=>lr(e,"block",xt.components[e]?.label??e),si=Pn(e=>xt.components[e]?.defaultProps??{},[xt]),di=e=>lr(e,"section",li(e)),ci=e=>he({type:e.type,props:e.props??{}},di(e.type),cr),{nodeAddresses:ai,zoneItems:pi}=In(()=>{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>=ve)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of be(xt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(qr,Se,0),{nodeAddresses:e,zoneItems:n}},[qr,xt]),ui=Pn(e=>pi.get(e)??[],[pi]),fi=e=>{const n=ai.get(e);return n?ui(n.zone)[n.index]:void 0},hi=e=>q(_o,xt,e),mi=e=>{if(!_o.slotsOf||e===Se)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=fi(e.slice(0,n));if(!t)return null;const o=hi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},gi=(()=>{if(!J(Lo))return null;const e=`${Lo.nodeId}:${Lo.slot}`;return mi(e)?.slot.panel===Lo.kind?e:null})(),yi=Bn(null);On(()=>{const e=yi.current;if(yi.current=null,!gi||!J(Lo))return;const n=Lo.nodeId;Do(n,{scroll:e!==gi}),kr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Lo]);const Si=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ai.get(e);n&&(n.zone===Se?Ei(n.index):ul(n.zone,n.index,e,fi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&gi!==i&&(yi.current=i),Go(null,r),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}}),Ri(o)},ki=(e,n,t)=>{const o=`${e}:${n}`;if(kr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;gi!==o&&(yi.current=o);Go(null,{kind:t,nodeId:e,slot:n})},vi=(e,n,t)=>{if(pt||!_o.moveSlot)return;const o=fi(e),r=o?hi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Qn,index:n},s=pn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=_o.moveSlot(e,n,s);"string"==typeof d&&ki(e,d,i.panel)},bi=dr(),wi=In(()=>{const e=/* @__PURE__ */new Map;for(const n of bi??[])e.set(n.slug,n.name);return e},[bi]),xi=e=>me(e,li,ir.plainText,e=>wi.get(e),ir.rowName),zi=(e,n)=>{const t=xt.components[e.type]?.fields,o=n===Se||Tl(n)?"section":"block",r=n===Se&&(Mt(e)||Tt(e)||Nt(e.type)),i="block"===o?ge(t):r?null:ye(t);return ir.renamePropOf?ir.renamePropOf(e,o,i):i},Ci=(e,n,t,o)=>{if(!(!pt&&fr?.zone===e&&fr.index===n))return;const r=(t,o)=>{hr(null),o&&((e,n,t)=>{const o=ui(e)[n];if(!o)return;const r=zi(o,e);r&&qt.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":Lt.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)},Bi=e(U(),Wt),Ii=Bi.scope({target:yn,siteId:tt,docId:Sn}),Ni=xt,Oi=(e,n)=>n===Se?di(e):li(e),Pi=(e,n,t)=>{const o=Bi.plan(Ii,t,Oi(t.type,e),Ni);o&&(o.changed&&qt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Pr(o.message))},$i=Q({nodesIn:ui,nodeAt:(e,n)=>ui(e)[n]??null,labelOf:(e,n)=>n===Se?di(e):li(e),renamePropOf:zi,beginRename:(e,n)=>hr({zone:e,index:n}),history:{hasPast:vt.hasPast,hasFuture:vt.hasFuture,back:()=>vt.back(),forward:()=>vt.forward()},openPageSettings:()=>{qt.select(null),Ro(L)},pageSettingsLabel:Lt.pageSettings,words:{menu:Ht,styleClipboard:Wt,screen:Lt.menu},readOnly:Boolean(pt),collapseAll:()=>kr(new Set(ui(Se).map(e=>String(e.props.id)))),onPasteRefused:e=>Pr(e?Lt.pasteRefused({name:e.label}):Lt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Ll(e,n),menuRows:Ko.menuRows,isLocked:e=>Qo(e.type),duplicateBlocked:e=>er(St.data,e),permits:e=>ke(xt,e.type),nodeOps:ii,isPinned:(e,n)=>n===Se&&(Mt(e)||Tt(e)),sectionBand:_r,locate:e=>ai.get(e)??null,rowNameOf:(e,n)=>n===Se?ci(e):xi(e),selectAt:(e,n,t,o)=>{e===Se?Ei(n):ul(e,n,t,o??"")},slotRung:e=>{const n=mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Si(n.node,n.slot,!1)}:null},style:{held:()=>ae(Ii),canCopy:e=>Bi.rows(Ni,e).some(e=>!1!==e.counted),copy:(e,n)=>Bi.copy(Ii,e,Oi(e.type,n),Ni),paste:(e,n,t)=>Pi(e,n,t)},keys:ht?{target:xo,selected:()=>{const e=St.ui.itemSelector;return e?{zone:e.zone??Se,index:e.index}:null},held:()=>ti.get(),readOnly:Boolean(pt),onDone:({done:e,name:n})=>{"copied"===e&&Pr(Lt.copied({name:n}))}}:void 0},wo),Mi=Bn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});On(()=>{Mi.current={copy:(e,n)=>Bi.copy(Ii,e,Oi(e.type,n),Ni),paste:Pi,at:()=>{const e=St.ui.itemSelector;if(!e)return null;const n=e.zone??Se,t=ui(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(pt)}});const Ti=Pn(e=>{const n=pe(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))},[]);On(()=>{if(!xo)return;const e=e=>Ti(e);return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[Ti,xo]),mn(wo,"keydown",Ti);const ji=qr.map(e=>e.props.id).join("|");On(()=>{const e=wo?.document??null,n=wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ao(e=>e.length?[]:e);const n=qr.findIndex(Tt),t=n>=0?n:qr.length,o=n=>{const t=qr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(hn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=qr.length>0&&!Mt(qr[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=_n(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})}Ao(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,ji,lo,Fr,Qt,eo,bt?.props.id]);const Ai=wo?.document??null,Li=wo?.window??null;On(()=>{const e=vo.current;if(!e||!Ai||!Li)return;const n=[],t=()=>{const n=Ai.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Li.scrollTo({left:Li.scrollX,top:Li.scrollY+t,behavior:"instant"}),!0};return vo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ai,Li]);const Ri=e=>{Ko.holdCanvasOn?Ko.holdCanvasOn(e):c(e)},Ei=e=>{Ro(L),qt.select({index:e}),Ko.sectionPressed?.(qr[e]);const n=qr[e]?.props?.id;n&&Ri(n)},Vi=e=>{const{floor:n,cap:t}=_r(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=bt&&Lo.kind!==$t?.kind?qr.findIndex(e=>e.props.id===bt.props.id):-1;return o(r>=0?r+1:t)},Fi=(e,n)=>{const{floor:t,cap:o}=_r(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(qt.reorderComponent(Se,e,i),qt.select({index:i}),{moved:!0,dest:i})},Hi=(e,n,t,o)=>{Ro(L),qt.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),Pr(Lt.sectionAdded({name:t}))},Wi=(e,n)=>{const t=Vi(n),o=tr(e,{nodeDefaults:si,newNodeId:Ce,sectionLabel:di,blockIsOffered:rr}),r=o?qt.insertNode(Se,t,o):qt.insertSection(e,t);return Hi(t,r,di(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 be(xt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=or(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},Di=e=>Ji(Se,e),Ji=(e,n)=>{Nr.current=document.activeElement??null,po&&(Po.current=$o.current,$o.current=!1,uo()),To(null===n?null:{zone:e,index:n}),Oo(!0),Qt||(Po.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ui=()=>{Oo(!1),To(null),Po.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),Po.current=!1},Yi=(e,n)=>ir.rowName?n?Mt(e)?ir.rowName(e,"section",Lt.header):Tt(e)?ir.rowName(e,"section",Lt.footer):Nt(e.type)?ir.rowName(e,"section",li(e.type)):ci(e):xi(e):n?di(e.type):li(e.type),Gi=e=>n=>{e()},Xi=()=>Ko.editPinnedSource?.(),Ki=(e,n,t)=>{if(pt)return null;const o=ui(e)[n];return o&&!ke(xt,o.type).delete?null:/* @__PURE__ */Jn(Le,{kind:"delete",label:Lt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=ui(e)[n]?.props?.id;null!=t&&ri(String(t))})(e,n),children:/* @__PURE__ */Jn(Fn,{size:15})})},Zi=e=>ir.rowPreview?.(e)||void 0,qi=e=>ir.rowMarks?.(e)??void 0,_i=(e,n,t)=>ir.rowActions?.(e,n,t)??null,Qi=(e,n,t,o)=>{if(pt)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
10
- return Jn(Le,{kind:"eye",label:r?Lt.showNamed({name:o}):Lt.hideNamed({name:o}),onClick:()=>nl(e,n,t),children:/* @__PURE__ */Jn(r?Hn:Wn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},el=e=>fs(Se,e),nl=(e,n,t)=>{qt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},tl=e=>we(xt,e),ol=e=>be(xt,e),rl=e=>_o.slotsOf?hi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:xe(e,n.slot)})):[{slot:null,rung:null,kids:ol(e)}],il=e=>_o.slotsOf?rl(e).flatMap(e=>e.kids):ol(e),ll=e=>Boolean(_o.slotsOf)&&hi(e).some(e=>e.rung),sl=(e,n,t)=>null===t?void 0===n?or(e):or(e,n):or(e,n,t),dl=(e,n,t)=>{const o=ze(xt,e.type,n)&&(t||il(e).length>0||ll(e));return{collapsible:o,folded:o&&Cr(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(or(e.type)),pl=e=>Boolean(or(e)),ul=(e,n,t,o)=>{if(Ro(L),or(o)?.spec?.slider){const t=e.split(":")[0];a(t,n),qt.select({index:n,zone:e}),c(t)}else qt.select({index:n,zone:e}),Ri(t)},fl=(e,n,t,o,r)=>{const i=`${e}:${n}`;qt.insertComponent(i,t,o),or(r)?.spec?.slider?requestAnimationFrame(()=>{a(e,o),qt.select({index:o,zone:i})}):qt.select({index:o,zone:i})},hl=Bn(/* @__PURE__ */new Set);On(()=>{qr.forEach(e=>{const n=or(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(si)).forEach((e,t)=>Xt.seedChild(o,t,n.childType,e))})},[qr,Xt,si]);const ml=Bn(/* @__PURE__ */new Set);On(()=>{qr.forEach((e,n)=>{const t=e.props.id;if(ml.current.has(t))return;const o=i(e,tl(e.type));ml.current.add(t),o&&Xt.replaceComponent(Se,n,{...e,props:o})})},[qr,Xt]),Y(Xt,xt);const gl=qr.findIndex(Tt),yl=gl>=0?qr[gl]:null,Sl=jt?qr.findIndex(Mt):-1,kl=Sl>=0?qr[Sl]:null,vl=zt.groupTab,bl=In(()=>vl?e=>Nt(e.type):void 0,[vl]),wl=Boolean(zt.groupBadge),xl=zt.groupBadge?/* @__PURE__ */Jn("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Jn(Tn,{tone:"info",size:"xs",children:zt.groupBadge})}):void 0,zl=qr.find(e=>e.type===Bt)??null,Cl=qr.find(e=>e.type===It)??null,Bl=gl>=0?gl:qr.length,Il=[];qr.forEach(e=>{Tt(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=>Sr.has(e)),Ol=e=>{const n=ir.blockRowName(e,li);return ir.rowName?ir.rowName(e,"block",n):n},Pl=(e,n,t,o)=>{const r=ui(e)[t];if(!r)return;const i={...xn(e),index:t},l={...xn(n),index:Math.min(Math.max(o,0),ui(n).length)},s=pn(i,l);if(e!==n||s!==t)try{oi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Cn))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},Ml=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ai.get(n);if(!e)return null;if(e.zone===Se)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Tl=e=>{const n=e.slice(0,e.indexOf(":")),t=qr.find(e=>Nt(e.type)&&String(e.props.id)===n);return t&&Ot(n)===e?t:null},jl=(e,n)=>{const t=Tl(e);return!t||(!zt.groupAccepts||zt.groupAccepts(t.type,n,ui(e).length))},Al=(e,n,t)=>{if(e.rung){const t=fi(e.rung.nodeId),o=t?hi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Qn&&n.index>=0&&n.index<=o}if(n.slot===Qn)return!1;if(e.add)return Vl(e.add,n);const o=wn(n);if(Nt(e.type))return!1;const r=Tl(o),i=Tl(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!jl(o,e.type))&&(n.index>=0&&n.index<=ui(o).length));if(e.zone===Se||o===Se){if(e.zone!==o)return!1;const{floor:t,cap:r}=_r();return n.index>=t&&n.index<=r}if(n.index<0||n.index>ui(o).length)return!1;if(e.zone===o)return!0;const l=yl&&!zt.lastIsOpen?String(yl.props.id):null;return(!l||Ml(e.zone)!==l&&Ml(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??ui(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ai.get(i),s=l?ui(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&$l(r).has(n))return!1;const d=or(s.type,nr(St?.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?.(ui(n),r))})(e.zone,o,e.index,t)},Ll=(e,n)=>{const t=wn(e.from),o=e.node;return t===wn(n)?jl(t,o.type):Al({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Rl=e=>{const n=e.slice(0,e.indexOf(":")),t=ai.get(n),o=t?ui(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=or(o.type,nr(St?.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=r.choices??(r.spec?[{type:r.spec.childType,label:li(r.spec.childType)}]:[]),l=mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Yi(o,t.zone===Se)}},El=(e,n)=>{if("section"!==e.kind)return e;const t=wn(n);return t===Se||Tl(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=wn(n);if("block"!==t.kind){if(Tl(o)){const e="section"===t.kind?t.type:t.template.node.type;return jl(o,e)&&n.index>=0&&n.index<=ui(o).length}if(o!==Se)return!1;const{floor:e,cap:r}=_r();return n.index>=e&&n.index<=r}if(o===Se)return!1;const r=Rl(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(ui(o))},Fl=(e,n)=>{const t=El(e,n);if("block"!==t.kind&&Tl(wn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&jl(n,o)){if("section"===e.kind)qt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;qt.insertNode(n,t,ni(e.template.node))}Ro(L),qt.select({index:t,zone:n})}})(t,wn(n),n.index);if("section"===t.kind)return void Wi(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Vi(t),r=qt.insertNode(Se,o,n);Hi(o,r,e)})(t.template.name,ni(t.template.node),n.index);const o=wn(n),r=Rl(o);r&&(r.target.spec?fl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{qt.insertComponent(e,n,t),Ro(L),qt.select({index:t,zone:e})})(o,t.type,n.index))},Hl=(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n.index):e.add?Fl(e.add,n):e.zone===Se?Fi(e.index,n.index):Pl(e.zone,wn(n),e.index,n.index)},[Wl]=Nn(()=>cn()),Dl=an({keyOf:e=>e.id,readOnly:Boolean(pt),session:Wl,canDrop:Al,onDrop:Hl,onStep:(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Se?((e,n)=>{const t=di(qr[e]?.type??""),o=Fi(e,n<0?e-1:e+2);if(!o.moved)return void Pr(n<0?Lt.sectionFirst({name:t}):Lt.sectionLast({name:t}));const{floor:r,cap:i}=_r();Pr(Lt.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)}}),Jl=Pn(e=>{const{floor:n,cap:t}=_r(),o=[];for(const r of e.nodes){const e=wn(r.place),i=ui(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Mt(i)||Tt(i)||Qo(i.type))continue;if(Nt(i.type))continue;const l=Boolean(Tl(e)),s=e===Se||l;e===Se&&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?di(i.type):xi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=wn(e.list);if(n===Se&&0===e.children.length)return[{...e,addLabel:Lt.addSection,addAlways:!0}];const t=Rl(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Tl(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=wn(e.list),t=n===Se||Tl(n)?null:Rl(n);return t?.choices.length?rn(e,t.target.spec?.addLabel??Lt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[St.data]),Ul=null==bt?.props.id?null:String(bt.props.id),Yl=Pn(e=>{const n=xt,t=e=>!e.item.rung&&null!==zn(St.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(Ul);return i||(r($e(St.data,n,o.item.id,Ul,bl))??o)},[St.data,xt,Ul,bl]),[Gl,Xl]=Nn(null);mn(wo,"mouseover",e=>{if(!vl)return;const n=gn(e.target),t=n?Xn(St.data,xt,n):null;t!==Gl&&Xl(t)}),mn(wo,"mouseout",e=>{vl&&!e.relatedTarget&&Xl(null)});const Kl=e=>Mt(e)||Tt(e)||Nt(e.type),Zl=[];if(vl){const e=Ul?Xn(St.data,xt,Ul):null;for(const n of/* @__PURE__ */new Set([e,Gl])){const e=n?qr.find(e=>String(e.props.id)===n):void 0;if(!e||!Kl(e))continue;const t=vl(e);t&&Zl.push({id:String(e.props.id),label:t,below:Mt(e)||e.type===Bt})}}const ql=le(),_l=Bn(null);On(()=>{const e=zt.changeNotice;if(!e)return;const n=JSON.stringify(qr.filter(Kl)),t=_l.current;if(_l.current={doc:Sn,bands:n,index:vt.index},!t||t.doc!==Sn||t.bands===n)return;vt.hasPast&&vt.index>=t.index&&!Gn.has(ql)&&(Gn.add(ql),Pr(e,"success",{action:{label:Lt.bar.undo,onClick:()=>vt.back()},duration:8e3}))},[qr]);const Ql=e=>{Ro(L),qt.select(e.zone===Se?{index:e.index}:{index:e.index,zone:e.zone})},es=G(),ns=()=>({data:St.data,device:lo,ops:qt,inspector:Xo}),ts=es?.model,os=In(()=>ts?e=>ts(e,Jl(e),ns()):Jl,[ts,Jl,lo]),rs=es?.measure,is=rs?(e,n)=>rs(e,n,ns()):void 0,ls=es?.canDrop,ss=ls?(e,n)=>ls(e,n,Al,ns()):Al,ds=es?.drop,cs=ds?(e,n)=>ds(e,n,Hl,ns()):Hl,as=es?.pick,ps=as?e=>as(e,Ql,ns()):Ql,us=e=>{const n=wn(e),t=mi(n);t&&Si(t.node,t.slot,!1),Ji(n,e.index)},fs=(e,n)=>/* @__PURE__ */Jn(Re,{...pt?{}:Dl.seam({place:{...xn(e),index:n}})},`seam:${e}:${n}`),hs={rowClick:Gi,isCollapsed:Cr,toggleCollapse:Br},ms=e=>{const n=String(e.props.id),t=qr.findIndex(e=>String(e.props.id)===n),o=Ot(n),r=ui(o),i=Cr(n),l=li(e.type),s=ir.rowName?ir.rowName(e,"section",l):l,d=e=>fs(o,e);/* @__PURE__ */
7
+ /* @__PURE__ */Jn("path",{d:"M5 12h14"})]})})}var qn=`${fn}, ${hn}`;function _n(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 Qn="__rungs";var et="screen:band",nt={duplicate:!0,delete:!0};function tt(){const fn=se(),{target:yn,docId:kn,capabilities:Sn,currentSlug:An,siteId:tt,onPublish:ot,saveState:rt,saveConflict:it,retrySave:lt,toggleAutoSave:st,flushSave:dt,access:ct,saveUnreachable:at=!1,readOnly:pt,readOnlyReason:ut=null}=ne(),ft=I(),ht=O(),{mediaEditing:mt,hasEditGuard:gt,hasPinnedChrome:yt}=Sn,{appState:kt,dispatch:St,history:vt,selectedItem:bt,getSelectorForId:wt,config:xt}=Be(e=>e),zt=N(),{first:Ct,firstGroup:Bt,lastGroup:It,isSectionGroup:Ot,sectionGroupZone:Nt,panelOf:Pt}=zt,$t=Pt(Ct),Mt=e=>Z(zt,e),Tt=e=>K(zt,e),jt="node"===zt.firstRow,At=zt.band??null,Lt=on("screen",ce),Rt=on("tree",Ee),Et=on("drag",dn),Vt=on("notice",_e),Ft=on("lock",tn),Ht=on("menu",fe),Wt=on("styleClipboard",ue),Dt=on("chrome",Qe),Jt=P()??`/${An}`,Ut=$(),Yt=M(),Gt=b({readOnly:pt}),Xt=b({readOnly:pt,foldIntoHistory:!0}),Zt=Bn(null),Kt=Ie(),qt=In(()=>({...Gt,select:e=>{Zt.current=e,Gt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Kt.config;Zt.current=Ne(e,t,n)}Gt.commitDocument(e,n)}}),[Gt,Kt]),_t=kt.ui,Qt=_t.leftSideBarVisible,eo=_t.rightSideBarVisible,{options:no,widths:to,initial:oo,fluid:ro,fit:io}=T(),[lo,so]=On(oo),co=oe(),ao=mt&&null!==co,po=re(),uo=ie();j(bt?.props.id);const{read:fo,write:ho,forSelection:mo}=A(),[go,yo]=On(fo);Nn(()=>{ho(go)},[go]);const[ko,So]=On(0),vo=Bn(null),bo=Bn(null),wo=un(bo,{readySelector:qn}),xo=u(bo);f(bo,wo);const zo=d(),Co=en(ct),Bo={state:rt,offline:zo||rt.failed&&at,readOnlyReason:ut,editing:Co?Vt.editing({name:nn(Co.name,Ft),noun:Lt.noun}):null,conflict:null!=it,notSaving:Lt.bar.notSaving},Io=()=>{pt||(rt.failed?lt():dt())};h(bo,wo,Io);const[Oo,No]=On(!1),Po=Bn(!1),$o=Bn(!1),[Mo,To]=On(null),[jo,Ao]=On([]),[Lo,Ro]=On(L),Eo="puck"===Lo.kind,Vo=n(Lo,bt?.props.id),[Fo,Ho]=On(null);Nn(()=>{Fo&&(t(),Ho(null))},[Fo]);const Wo=Bn(wt);Wo.current=wt;const Do=Pn((e,{scroll:n})=>{yo(n=>mo(e,n)),n&&Ho(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Wo.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Sr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Jo=Bn(null);Nn(()=>{const e=Jo.current;Jo.current=null;const n=null==bt?.props.id?null:String(bt.props.id);Ro(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Pt(bt?.type)??L);const t=bt?.props.id,r=Zt.current;if(Zt.current=null,!t)return;const i=wt(t);Do(String(t),{scroll:!o(r,i??null,ke)})},[bt?.props.id,Do]);const Uo=Pn(e=>{Ro(n=>R(n,e)?n:e),St({type:"setUi",ui:{rightSideBarVisible:!0}})},[St]),Yo=Bn(()=>{});Yo.current=(e,n)=>{const t=e?ui(e.zone??ke)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==bt?.props.id?null:String(bt.props.id);Ro(e=>R(e,n)?e:n),o!==r&&(Jo.current={id:o,mode:n},qt.select(e))};const Go=Pn((e,n)=>Yo.current(e,n),[]),Xo={kind:Lo.kind,mode:Lo,open:Uo,show:e=>Ro(e),reveal:()=>{eo||St({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Go},Zo=E(Xo,{data:kt.data,selected:bt??null,zoneOf:e=>wt(e)?.zone,readOnly:Boolean(pt),select:e=>{Ro(L),qt.select({index:e})},replace:(e,n)=>qt.replaceComponent(ke,e,n),scrollTo:e=>Ri(e)},{device:lo,refreshes:ko},{setView:yo,reveal:()=>{Qt||St({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Ko=Zo.pinnedSource??!1,qo=Zo.resolveLeftView?Zo.resolveLeftView(go,ao):"media"===go&&ao?go:"sections",_o=V(),{isLockedBlock:Qo,duplicateBlocked:er,nestDepth:nr,newSectionNode:tr,canAddTo:or,blockIsOffered:rr}=_o,ir=F(),{labelAtLevel:lr,Icon:sr,useProducts:dr}=ir,cr=ir.rowName?(e,n,t)=>ir.rowName(e,n,t):void 0,ar=Pn(e=>{St({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),Do(e,{scroll:!0})},[St,Do]),{selectNode:pr,openPartId:ur}=v({mode:Lo,setMode:Ro,onOpenPart:ar}),[fr,hr]=On(null);de(null!==fr,()=>hr(null));const mr=y(H()),gr=mr.collapsed,yr=mr.panelWidths,[kr,Sr]=On(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(gr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
8
+ return new Set}});Nn(()=>{try{window.localStorage.setItem(gr,JSON.stringify([...kr]))}catch{}},[kr]);const[vr,br]=On(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(yr);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});Nn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(yr,JSON.stringify(vr))}catch{}},300);return()=>clearTimeout(e)},[vr]);const wr=Pn((e,n)=>br(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),xr=Pn(e=>wr("left",e),[wr]),zr=Pn(e=>wr("right",e),[wr]),Cr=e=>kr.has(e),Br=e=>Sr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Ir=Bn(!1),Or=Bn(null);Nn(()=>{if(Ir.current&&!Oo){const e=Or.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??bo.current?.querySelector(`button[aria-label="${CSS.escape(Lt.add.title)}"]`))?.focus(),Or.current=null}Ir.current=Oo},[Oo]),Nn(()=>{if(!Oo||!xo)return;const e=e=>{"Escape"===e.key&&Ui()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[Oo,xo]),de(Oo,()=>Ui()),Nn(()=>{!Qt&&Oo&&(No(!1),To(null),Po.current=!1)},[Qt]),Nn(()=>{if(!po)return $o.current&&St({type:"setUi",ui:{leftSideBarVisible:!1}}),void($o.current=!1);Oo&&(No(!1),To(null),$o.current=Po.current,Po.current=!1),Qt||($o.current=!0,St({type:"setUi",ui:{leftSideBarVisible:!0}}))},[po]),Nn(()=>{!Qt&&po&&($o.current=!1,uo())},[Qt]),Nn(()=>{if(!po||!xo)return;const e=e=>{"Escape"===e.key&&uo()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[po,xo]),de(null!==po,()=>uo());const Nr=W(),Pr=(e,n="success",t)=>{if(Nr)return void(t?Nr(e,"error"===n?"error":"info",t):Nr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?jn.error(e,{...o,duration:t?.duration??3200}):jn.success(e,{...o,duration:t?.duration??1900})},$r=Bn(null),[Mr,Tr]=On(0),[jr,Ar]=On(0),Lr=D(),Rr=Bn(null),Er=e=>Math.max(0,e.clientHeight-(Rr.current?.offsetHeight??0));Nn(()=>{const e=$r.current;if(!e)return;const n=()=>{Tr(e.clientWidth),Ar(Er(e))};n();const t=new ResizeObserver(n);return t.observe(e),Rr.current&&t.observe(Rr.current),()=>t.disconnect()},[]),$n(()=>{$r.current&&(Tr($r.current.clientWidth),Ar(Er($r.current)))},[vr,Qt,eo]);const Vr=lo===ro?Mr>0?Mr:to[ro]:to[lo],Fr=Mr>0?Math.min(Mr/Vr,"shrink"===io?1:2):1,Hr=Vr*Fr,Wr=Mr>0&&Hr>Mr+1,Dr={width:Hr,height:jr||"100%",flex:"none",position:"relative"},Jr={width:Vr,height:jr?jr/Fr:"100%",maxHeight:"none",transform:1!==Fr?`scale(${Fr})`:void 0,transformOrigin:"top left"},Ur=()=>St({type:"setUi",ui:{leftSideBarVisible:!Qt}}),Yr=()=>St({type:"setUi",ui:{rightSideBarVisible:!eo}}),Gr=e=>{Oo&&(No(!1),To(null),Po.current=!1,Qt&&go===e)||po&&($o.current=!1,uo(),Qt&&go===e)||(Qt&&go===e?Ur():(yo(e),Qt||St({type:"setUi",ui:{leftSideBarVisible:!0}})))},Xr=()=>{te(fn,{accept:"image/*",title:Dt.mediaLibrary})},Zr=()=>{Ro(L),qt.select(null),p()},Kr=()=>{Ro($t??L),eo||St({type:"setUi",ui:{rightSideBarVisible:!0}})},qr=kt.data.content??[],_r=()=>{const e=qr.findIndex(Mt),n=qr.findIndex(Tt);return{floor:e>=0?e+1:0,cap:n>=0?n:qr.length}},Qr=xt,ei=_o.stripCopy,ni=e=>r(e,ei),ti=_(),oi=Pe({data:kt.data,config:Qr,readOnly:Boolean(pt),clipboard:ti,strip:ei?e=>ei(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==vn||e.slot!==bn)return{min:0,max:n-1};const{floor:t,cap:o}=_r();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Ro(L);const t=void 0===n||"node"===n?.kind?n:null;qt.commitDocument(e,t)}}),ri=e=>{const n=zn(kt.data,xt,e);if(!n)return!1;const t=wn(n.place),o=n.node,r=t===ke?ci(o):xi(o);return!!oi.remove(e)&&(Pr(Lt.deleted({name:r}),"success",{duration:8e3,action:{label:Lt.bar.undo,onClick:()=>{oi.restore(n.node,n.place)}}}),!0)},ii={...oi,remove:ri},li=e=>lr(e,"block",xt.components[e]?.label??e),si=Pn(e=>xt.components[e]?.defaultProps??{},[xt]),di=e=>lr(e,"section",li(e)),ci=e=>he({type:e.type,props:e.props??{}},di(e.type),cr),{nodeAddresses:ai,zoneItems:pi}=In(()=>{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>=ve)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of be(xt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(qr,ke,0),{nodeAddresses:e,zoneItems:n}},[qr,xt]),ui=Pn(e=>pi.get(e)??[],[pi]),fi=e=>{const n=ai.get(e);return n?ui(n.zone)[n.index]:void 0},hi=e=>q(_o,xt,e),mi=e=>{if(!_o.slotsOf||e===ke)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=fi(e.slice(0,n));if(!t)return null;const o=hi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},gi=(()=>{if(!J(Lo))return null;const e=`${Lo.nodeId}:${Lo.slot}`;return mi(e)?.slot.panel===Lo.kind?e:null})(),yi=Bn(null);Nn(()=>{const e=yi.current;if(yi.current=null,!gi||!J(Lo))return;const n=Lo.nodeId;Do(n,{scroll:e!==gi}),Sr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Lo]);const ki=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ai.get(e);n&&(n.zone===ke?Ei(n.index):ul(n.zone,n.index,e,fi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&gi!==i&&(yi.current=i),Go(null,r),eo||St({type:"setUi",ui:{rightSideBarVisible:!0}}),Ri(o)},Si=(e,n,t)=>{const o=`${e}:${n}`;if(Sr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;gi!==o&&(yi.current=o);Go(null,{kind:t,nodeId:e,slot:n})},vi=(e,n,t)=>{if(pt||!_o.moveSlot)return;const o=fi(e),r=o?hi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Qn,index:n},s=pn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=_o.moveSlot(e,n,s);"string"==typeof d&&Si(e,d,i.panel)},bi=dr(),wi=In(()=>{const e=/* @__PURE__ */new Map;for(const n of bi??[])e.set(n.slug,n.name);return e},[bi]),xi=e=>me(e,li,ir.plainText,e=>wi.get(e),ir.rowName),zi=(e,n)=>{const t=xt.components[e.type]?.fields,o=n===ke||Tl(n)?"section":"block",r=n===ke&&(Mt(e)||Tt(e)||Ot(e.type)),i="block"===o?ge(t):r?null:ye(t);return ir.renamePropOf?ir.renamePropOf(e,o,i):i},Ci=(e,n,t,o)=>{if(!(!pt&&fr?.zone===e&&fr.index===n))return;const r=(t,o)=>{hr(null),o&&((e,n,t)=>{const o=ui(e)[n];if(!o)return;const r=zi(o,e);r&&qt.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":Lt.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)},Bi=e(U(),Wt),Ii=Bi.scope({target:yn,siteId:tt,docId:kn}),Oi=xt,Ni=(e,n)=>n===ke?di(e):li(e),Pi=(e,n,t)=>{const o=Bi.plan(Ii,t,Ni(t.type,e),Oi);o&&(o.changed&&qt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Pr(o.message))},$i=Q({nodesIn:ui,nodeAt:(e,n)=>ui(e)[n]??null,labelOf:(e,n)=>n===ke?di(e):li(e),renamePropOf:zi,beginRename:(e,n)=>hr({zone:e,index:n}),history:{hasPast:vt.hasPast,hasFuture:vt.hasFuture,back:()=>vt.back(),forward:()=>vt.forward()},openPageSettings:()=>{qt.select(null),Ro(L)},pageSettingsLabel:Lt.pageSettings,words:{menu:Ht,styleClipboard:Wt,screen:Lt.menu},readOnly:Boolean(pt),collapseAll:()=>Sr(new Set(ui(ke).map(e=>String(e.props.id)))),onPasteRefused:e=>Pr(e?Lt.pasteRefused({name:e.label}):Lt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Ll(e,n),menuRows:Zo.menuRows,isLocked:e=>Qo(e.type),duplicateBlocked:e=>er(kt.data,e),permits:e=>Se(xt,e.type),nodeOps:ii,isPinned:(e,n)=>n===ke&&(Mt(e)||Tt(e)),sectionBand:_r,locate:e=>ai.get(e)??null,rowNameOf:(e,n)=>n===ke?ci(e):xi(e),selectAt:(e,n,t,o)=>{e===ke?Ei(n):ul(e,n,t,o??"")},slotRung:e=>{const n=mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>ki(n.node,n.slot,!1)}:null},style:{held:()=>ae(Ii),canCopy:e=>Bi.rows(Oi,e).some(e=>!1!==e.counted),copy:(e,n)=>Bi.copy(Ii,e,Ni(e.type,n),Oi),paste:(e,n,t)=>Pi(e,n,t)},keys:ht?{target:xo,selected:()=>{const e=kt.ui.itemSelector;return e?{zone:e.zone??ke,index:e.index}:null},held:()=>ti.get(),readOnly:Boolean(pt),onDone:({done:e,name:n})=>{"copied"===e&&Pr(Lt.copied({name:n}))}}:void 0},wo),Mi=Bn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Nn(()=>{Mi.current={copy:(e,n)=>Bi.copy(Ii,e,Ni(e.type,n),Oi),paste:Pi,at:()=>{const e=kt.ui.itemSelector;if(!e)return null;const n=e.zone??ke,t=ui(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(pt)}});const Ti=Pn(e=>{const n=pe(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))},[]);Nn(()=>{if(!xo)return;const e=e=>Ti(e);return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[Ti,xo]),mn(wo,"keydown",Ti);const ji=qr.map(e=>e.props.id).join("|");Nn(()=>{const e=wo?.document??null,n=wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ao(e=>e.length?[]:e);const n=qr.findIndex(Tt),t=n>=0?n:qr.length,o=n=>{const t=qr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(hn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=qr.length>0&&!Mt(qr[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=_n(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})}Ao(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,ji,lo,Fr,Qt,eo,bt?.props.id]);const Ai=wo?.document??null,Li=wo?.window??null;Nn(()=>{const e=vo.current;if(!e||!Ai||!Li)return;const n=[],t=()=>{const n=Ai.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Li.scrollTo({left:Li.scrollX,top:Li.scrollY+t,behavior:"instant"}),!0};return vo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ai,Li]);const Ri=e=>{Zo.holdCanvasOn?Zo.holdCanvasOn(e):c(e)},Ei=e=>{Ro(L),qt.select({index:e}),Zo.sectionPressed?.(qr[e]);const n=qr[e]?.props?.id;n&&Ri(n)},Vi=e=>{const{floor:n,cap:t}=_r(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=bt&&Lo.kind!==$t?.kind?qr.findIndex(e=>e.props.id===bt.props.id):-1;return o(r>=0?r+1:t)},Fi=(e,n)=>{const{floor:t,cap:o}=_r(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(qt.reorderComponent(ke,e,i),qt.select({index:i}),{moved:!0,dest:i})},Hi=(e,n,t,o)=>{Ro(L),qt.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),Pr(Lt.sectionAdded({name:t}))},Wi=(e,n)=>{const t=Vi(n),o=tr(e,{nodeDefaults:si,newNodeId:Ce,sectionLabel:di,blockIsOffered:rr}),r=o?qt.insertNode(ke,t,o):qt.insertSection(e,t);return Hi(t,r,di(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 be(xt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=or(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},Di=e=>Ji(ke,e),Ji=(e,n)=>{Or.current=document.activeElement??null,po&&(Po.current=$o.current,$o.current=!1,uo()),To(null===n?null:{zone:e,index:n}),No(!0),Qt||(Po.current=!0,St({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ui=()=>{No(!1),To(null),Po.current&&St({type:"setUi",ui:{leftSideBarVisible:!1}}),Po.current=!1},Yi=(e,n)=>ir.rowName?n?Mt(e)?ir.rowName(e,"section",Lt.header):Tt(e)?ir.rowName(e,"section",Lt.footer):Ot(e.type)?ir.rowName(e,"section",li(e.type)):ci(e):xi(e):n?di(e.type):li(e.type),Gi=e=>n=>{e()},Xi=()=>Zo.editPinnedSource?.(),Zi=(e,n,t)=>{if(pt)return null;const o=ui(e)[n];return o&&!Se(xt,o.type).delete?null:/* @__PURE__ */Jn(Le,{kind:"delete",label:Lt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=ui(e)[n]?.props?.id;null!=t&&ri(String(t))})(e,n),children:/* @__PURE__ */Jn(Fn,{size:15})})},Ki=e=>ir.rowPreview?.(e)||void 0,qi=e=>ir.rowMarks?.(e)??void 0,_i=(e,n,t)=>ir.rowActions?.(e,n,t)??null,Qi=(e,n,t,o)=>{if(pt)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
10
+ return Jn(Le,{kind:"eye",label:r?Lt.showNamed({name:o}):Lt.hideNamed({name:o}),onClick:()=>nl(e,n,t),children:/* @__PURE__ */Jn(r?Hn:Wn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},el=e=>fs(ke,e),nl=(e,n,t)=>{qt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},tl=e=>we(xt,e),ol=e=>be(xt,e),rl=e=>_o.slotsOf?hi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:xe(e,n.slot)})):[{slot:null,rung:null,kids:ol(e)}],il=e=>_o.slotsOf?rl(e).flatMap(e=>e.kids):ol(e),ll=e=>Boolean(_o.slotsOf)&&hi(e).some(e=>e.rung),sl=(e,n,t)=>null===t?void 0===n?or(e):or(e,n):or(e,n,t),dl=(e,n,t)=>{const o=ze(xt,e.type,n)&&(t||il(e).length>0||ll(e));return{collapsible:o,folded:o&&Cr(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(or(e.type)),pl=e=>Boolean(or(e)),ul=(e,n,t,o)=>{if(Ro(L),or(o)?.spec?.slider){const t=e.split(":")[0];a(t,n),qt.select({index:n,zone:e}),c(t)}else qt.select({index:n,zone:e}),Ri(t)},fl=(e,n,t,o,r)=>{const i=`${e}:${n}`;qt.insertComponent(i,t,o),or(r)?.spec?.slider?requestAnimationFrame(()=>{a(e,o),qt.select({index:o,zone:i})}):qt.select({index:o,zone:i})},hl=Bn(/* @__PURE__ */new Set);Nn(()=>{qr.forEach(e=>{const n=or(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(si)).forEach((e,t)=>Xt.seedChild(o,t,n.childType,e))})},[qr,Xt,si]);const ml=Bn(/* @__PURE__ */new Set);Nn(()=>{qr.forEach((e,n)=>{const t=e.props.id;if(ml.current.has(t))return;const o=i(e,tl(e.type));ml.current.add(t),o&&Xt.replaceComponent(ke,n,{...e,props:o})})},[qr,Xt]),Y(Xt,xt);const gl=qr.findIndex(Tt),yl=gl>=0?qr[gl]:null,kl=jt?qr.findIndex(Mt):-1,Sl=kl>=0?qr[kl]:null,vl=zt.groupTab,bl=In(()=>vl?e=>Ot(e.type):void 0,[vl]),wl=Boolean(zt.groupBadge),xl=zt.groupBadge?/* @__PURE__ */Jn("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Jn(Tn,{tone:"info",size:"xs",children:zt.groupBadge})}):void 0,zl=qr.find(e=>e.type===Bt)??null,Cl=qr.find(e=>e.type===It)??null,Bl=gl>=0?gl:qr.length,Il=[];qr.forEach(e=>{Tt(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 Ol=Il.length>0&&Il.every(e=>kr.has(e)),Nl=e=>{const n=ir.blockRowName(e,li);return ir.rowName?ir.rowName(e,"block",n):n},Pl=(e,n,t,o)=>{const r=ui(e)[t];if(!r)return;const i={...xn(e),index:t},l={...xn(n),index:Math.min(Math.max(o,0),ui(n).length)},s=pn(i,l);if(e!==n||s!==t)try{oi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Cn))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},Ml=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ai.get(n);if(!e)return null;if(e.zone===ke)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Tl=e=>{const n=e.slice(0,e.indexOf(":")),t=qr.find(e=>Ot(e.type)&&String(e.props.id)===n);return t&&Nt(n)===e?t:null},jl=(e,n)=>{const t=Tl(e);return!t||(!zt.groupAccepts||zt.groupAccepts(t.type,n,ui(e).length))},Al=(e,n,t)=>{if(e.rung){const t=fi(e.rung.nodeId),o=t?hi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Qn&&n.index>=0&&n.index<=o}if(n.slot===Qn)return!1;if(e.add)return Vl(e.add,n);const o=wn(n);if(Ot(e.type))return!1;const r=Tl(o),i=Tl(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!jl(o,e.type))&&(n.index>=0&&n.index<=ui(o).length));if(e.zone===ke||o===ke){if(e.zone!==o)return!1;const{floor:t,cap:r}=_r();return n.index>=t&&n.index<=r}if(n.index<0||n.index>ui(o).length)return!1;if(e.zone===o)return!0;const l=yl&&!zt.lastIsOpen?String(yl.props.id):null;return(!l||Ml(e.zone)!==l&&Ml(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??ui(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ai.get(i),s=l?ui(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&$l(r).has(n))return!1;const d=or(s.type,nr(kt?.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?.(ui(n),r))})(e.zone,o,e.index,t)},Ll=(e,n)=>{const t=wn(e.from),o=e.node;return t===wn(n)?jl(t,o.type):Al({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Rl=e=>{const n=e.slice(0,e.indexOf(":")),t=ai.get(n),o=t?ui(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=or(o.type,nr(kt?.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=r.choices??(r.spec?[{type:r.spec.childType,label:li(r.spec.childType)}]:[]),l=mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Yi(o,t.zone===ke)}},El=(e,n)=>{if("section"!==e.kind)return e;const t=wn(n);return t===ke||Tl(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=wn(n);if("block"!==t.kind){if(Tl(o)){const e="section"===t.kind?t.type:t.template.node.type;return jl(o,e)&&n.index>=0&&n.index<=ui(o).length}if(o!==ke)return!1;const{floor:e,cap:r}=_r();return n.index>=e&&n.index<=r}if(o===ke)return!1;const r=Rl(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(ui(o))},Fl=(e,n)=>{const t=El(e,n);if("block"!==t.kind&&Tl(wn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&jl(n,o)){if("section"===e.kind)qt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;qt.insertNode(n,t,ni(e.template.node))}Ro(L),qt.select({index:t,zone:n})}})(t,wn(n),n.index);if("section"===t.kind)return void Wi(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Vi(t),r=qt.insertNode(ke,o,n);Hi(o,r,e)})(t.template.name,ni(t.template.node),n.index);const o=wn(n),r=Rl(o);r&&(r.target.spec?fl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{qt.insertComponent(e,n,t),Ro(L),qt.select({index:t,zone:e})})(o,t.type,n.index))},Hl=(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n.index):e.add?Fl(e.add,n):e.zone===ke?Fi(e.index,n.index):Pl(e.zone,wn(n),e.index,n.index)},[Wl]=On(()=>cn()),Dl=an({keyOf:e=>e.id,readOnly:Boolean(pt),session:Wl,canDrop:Al,onDrop:Hl,onStep:(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ke?((e,n)=>{const t=di(qr[e]?.type??""),o=Fi(e,n<0?e-1:e+2);if(!o.moved)return void Pr(n<0?Lt.sectionFirst({name:t}):Lt.sectionLast({name:t}));const{floor:r,cap:i}=_r();Pr(Lt.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)}}),Jl=Pn(e=>{const{floor:n,cap:t}=_r(),o=[];for(const r of e.nodes){const e=wn(r.place),i=ui(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Mt(i)||Tt(i)||Qo(i.type))continue;if(Ot(i.type))continue;const l=Boolean(Tl(e)),s=e===ke||l;e===ke&&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?di(i.type):xi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=wn(e.list);if(n===ke&&0===e.children.length)return[{...e,addLabel:Lt.addSection,addAlways:!0}];const t=Rl(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Tl(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=wn(e.list),t=n===ke||Tl(n)?null:Rl(n);return t?.choices.length?rn(e,t.target.spec?.addLabel??Lt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[kt.data]),Ul=null==bt?.props.id?null:String(bt.props.id),Yl=Pn(e=>{const n=xt,t=e=>!e.item.rung&&null!==zn(kt.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(Ul);return i||(r($e(kt.data,n,o.item.id,Ul,bl))??o)},[kt.data,xt,Ul,bl]),[Gl,Xl]=On(null);mn(wo,"mouseover",e=>{if(!vl)return;const n=gn(e.target),t=n?Xn(kt.data,xt,n):null;t!==Gl&&Xl(t)}),mn(wo,"mouseout",e=>{vl&&!e.relatedTarget&&Xl(null)});const Zl=e=>Mt(e)||Tt(e)||Ot(e.type),Kl=[];if(vl){const e=Ul?Xn(kt.data,xt,Ul):null;for(const n of/* @__PURE__ */new Set([e,Gl])){const e=n?qr.find(e=>String(e.props.id)===n):void 0;if(!e||!Zl(e))continue;const t=vl(e);t&&Kl.push({id:String(e.props.id),label:t,below:Mt(e)||e.type===Bt})}}const ql=le(),_l=Bn(null);Nn(()=>{const e=zt.changeNotice;if(!e)return;const n=JSON.stringify(qr.filter(Zl)),t=_l.current;if(_l.current={doc:kn,bands:n,index:vt.index},!t||t.doc!==kn||t.bands===n)return;vt.hasPast&&vt.index>=t.index&&!Gn.has(ql)&&(Gn.add(ql),Pr(e,"success",{action:{label:Lt.bar.undo,onClick:()=>vt.back()},duration:8e3}))},[qr]);const Ql=e=>{Ro(L),qt.select(e.zone===ke?{index:e.index}:{index:e.index,zone:e.zone})},es=G(),ns=()=>({data:kt.data,device:lo,ops:qt,inspector:Xo}),ts=es?.model,os=In(()=>ts?e=>ts(e,Jl(e),ns()):Jl,[ts,Jl,lo]),rs=es?.measure,is=rs?(e,n)=>rs(e,n,ns()):void 0,ls=es?.canDrop,ss=ls?(e,n)=>ls(e,n,Al,ns()):Al,ds=es?.drop,cs=ds?(e,n)=>ds(e,n,Hl,ns()):Hl,as=es?.pick,ps=as?e=>as(e,Ql,ns()):Ql,us=e=>{const n=wn(e),t=mi(n);t&&ki(t.node,t.slot,!1),Ji(n,e.index)},fs=(e,n)=>/* @__PURE__ */Jn(Re,{...pt?{}:Dl.seam({place:{...xn(e),index:n}})},`seam:${e}:${n}`),hs={rowClick:Gi,isCollapsed:Cr,toggleCollapse:Br},ms=e=>{const n=String(e.props.id),t=qr.findIndex(e=>String(e.props.id)===n),o=Nt(n),r=ui(o),i=Cr(n),l=li(e.type),s=ir.rowName?ir.rowName(e,"section",l):l,d=e=>fs(o,e);/* @__PURE__ */
11
11
  return Un(Yn,{children:[
12
- /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:e.type,size:13}),name:s,preview:Zi(e),marks:qi(e),onSelect:()=>Ei(t),nameSlot:Ci(Se,t,n,s),selected:Vo===n,badge:xl,actions:_i(e,Se,t)??void 0,rowProps:{"data-node-id":n,onClick:Gi(()=>Ei(t))},fold:{open:!i,label:"section",onToggle:()=>Br(n)}}),!i&&/* @__PURE__ */Un(Te,{children:[r.map((n,t)=>{const r=String(n.props.id),i=ci(n),l=al(n),s=l&&Cr(r),c=()=>ul(o,t,r,e.type),{rowProps:a,...p}=Dl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...xn(o),index:t}},{"data-node-id":r,onClick:Gi(c)});/* @__PURE__ */
12
+ /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:e.type,size:13}),name:s,preview:Ki(e),marks:qi(e),onSelect:()=>Ei(t),nameSlot:Ci(ke,t,n,s),selected:Vo===n,badge:xl,actions:_i(e,ke,t)??void 0,rowProps:{"data-node-id":n,onClick:Gi(()=>Ei(t))},fold:{open:!i,label:"section",onToggle:()=>Br(n)}}),!i&&/* @__PURE__ */Un(Te,{children:[r.map((n,t)=>{const r=String(n.props.id),i=ci(n),l=al(n),s=l&&Cr(r),c=()=>ul(o,t,r,e.type),{rowProps:a,...p}=Dl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...xn(o),index:t}},{"data-node-id":r,onClick:Gi(c)});/* @__PURE__ */
13
13
  return Un(Mn,{children:[d(t),
14
- /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:n.type,size:13}),name:i,preview:Zi(n),marks:qi(n),onSelect:c,nameSlot:Ci(o,t,r,i),selected:Vo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Br(r)}:void 0,actions:/* @__PURE__ */Un(Yn,{children:[Ki(o,t,i),_i(n,o,t),Qi(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=!Cr(l)&&s?.rung?.nodeId!==i,c={...xn(l),index:0},a=s&&!s.rung&&Al(s,c)?c:void 0,p=()=>Si(e,n,!0),{rowProps:u,...f}=Dl.row({item:{id:`rung:${l}`,zone:`${i}:${Qn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Qn,index:t},into:a,canDrag:Boolean(_o.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Gi(p)}),h=pt?null:_o.slotActions?.(e,n.slot);/* @__PURE__ */
14
+ /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:n.type,size:13}),name:i,preview:Ki(n),marks:qi(n),onSelect:c,nameSlot:Ci(o,t,r,i),selected:Vo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Br(r)}:void 0,actions:/* @__PURE__ */Un(Yn,{children:[Zi(o,t,i),_i(n,o,t),Qi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Jn(Te,{children:ks(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=!Cr(l)&&s?.rung?.nodeId!==i,c={...xn(l),index:0},a=s&&!s.rung&&Al(s,c)?c:void 0,p=()=>ki(e,n,!0),{rowProps:u,...f}=Dl.row({item:{id:`rung:${l}`,zone:`${i}:${Qn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Qn,index:t},into:a,canDrag:Boolean(_o.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Gi(p)}),h=pt?null:_o.slotActions?.(e,n.slot);/* @__PURE__ */
15
15
  return Un(Mn,{children:[n.heading,
16
- /* @__PURE__ */Jn(Me,{words:Rt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:gi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Br(l)},actions:h&&h.length>0?/* @__PURE__ */Jn(Yn,{children:h.map((t,o)=>/* @__PURE__ */Jn(Le,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(pt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ki(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */Jn(Fn,{size:15}):/* @__PURE__ */Jn(Dn,{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(Yn,{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__ */Un(Yn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Vo===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:{...xn(t),index:o}},{"data-node-id":d,onClick:Gi(p)});/* @__PURE__ */
16
+ /* @__PURE__ */Jn(Me,{words:Rt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:gi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Br(l)},actions:h&&h.length>0?/* @__PURE__ */Jn(Yn,{children:h.map((t,o)=>/* @__PURE__ */Jn(Le,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(pt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Si(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(Fn,{size:15}):/* @__PURE__ */Jn(Dn,{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(Yn,{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__ */Un(Yn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Vo===String(n.props.id),{collapsible:i,folded:s}=dl(n,l,pl(n.type)),d=String(n.props.id),c=Nl(n),p=()=>ul(t,o,d,e.type),{rowProps:u,...f}=Dl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...xn(t),index:o}},{"data-node-id":d,onClick:Gi(p)});/* @__PURE__ */
18
18
  return Un(Mn,{children:[0===o&&a(t,0),
19
- /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:n.type,size:13}),name:c,preview:Zi(n),marks:qi(n),onSelect:p,nameSlot:Ci(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Br(d)}:void 0,actions:/* @__PURE__ */Un(Yn,{children:[Ki(t,o,c),_i(n,t,o),Qi(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=nr(St?.data,e.type,String(e.props.id)),o=rl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
20
- return Jn(Yn,{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__ */Un(Yn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Vo===String(n.props.id),i=xi(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?{...xn(p),index:ui(p).length}:void 0,f=Dl.dragging,h=u&&f&&Al(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:{...xn(t),index:o},into:h,canDrag:!Qo(n.type)},{"data-node-id":l,onClick:Gi(g)});/* @__PURE__ */
19
+ /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:n.type,size:13}),name:c,preview:Ki(n),marks:qi(n),onSelect:p,nameSlot:Ci(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Br(d)}:void 0,actions:/* @__PURE__ */Un(Yn,{children:[Zi(t,o,c),_i(n,t,o),Qi(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??"")})})},ks=(e,n)=>{const t=nr(kt?.data,e.type,String(e.props.id)),o=rl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
20
+ return Jn(Yn,{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)),k=/* @__PURE__ */Un(Yn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Vo===String(n.props.id),i=xi(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?{...xn(p),index:ui(p).length}:void 0,f=Dl.dragging,h=u&&f&&Al(f,u)?u:void 0,g=()=>ul(t,o,l,e.type),{rowProps:y,...k}=Dl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...xn(t),index:o},into:h,canDrag:!Qo(n.type)},{"data-node-id":l,onClick:Gi(g)});/* @__PURE__ */
21
21
  return Un(Mn,{children:[0===o&&m(t,0),
22
- /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:n.type,size:13}),name:i,preview:Zi(n),marks:qi(n),onSelect:g,nameSlot:Ci(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Br(l)}:void 0,actions:Qo(n.type)?_i(n,t,o)??void 0:/* @__PURE__ */Un(Yn,{children:[Ki(t,o,i),_i(n,t,o),Qi(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=No||null!==po,vs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Qt&&!ks&&qo===e.id,onSelect:()=>Gr(e.id)}:e,bs=[...(Ko.railLead??[]).map(vs),{id:"sections",label:Lt.layers,icon:/* @__PURE__ */Jn(Ve,{}),active:Qt&&!ks&&"sections"===qo,onSelect:()=>Gr("sections")},...(Ko.railTrail??[]).map(vs)];ao?bs.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Jn(Fe,{}),active:Qt&&!No&&(null!==po||"media"===qo),onSelect:()=>Gr("media")}):mt&&bs.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Jn(Fe,{}),onSelect:Xr});const ws=[...Ko.railLead??[],...Ko.railTrail??[]].find(e=>"panel"in e&&e.id===qo),xs=Boolean(At?.foldable)&&!Zo,zs=At?.label??(gt?Lt.pageSections:Lt.templateSections),Cs=xs&&Cr(et),Bs=/* @__PURE__ */Un(Yn,{children:[qr.map((e,n)=>{if(Mt(e)||Tt(e)||Nt(e.type))return null;const t=Vo===String(e.props.id),o=Boolean(e.props._hidden);ol(e);const r=String(e.props.id),i=Ko.hasOwnRows?.(e)??!1,l=al(e)||i,s=l&&Cr(r),d=tl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...xn(c),index:ui(c).length}:void 0,p=Dl.dragging,u=a&&p&&Al(p,a)?a:void 0,{rowProps:f,...h}=Dl.row({item:{id:r,zone:Se,index:n,type:e.type},place:{...xn(Se),index:n},into:u},{"data-node-id":r,onClick:Gi(()=>Ei(n))});/* @__PURE__ */
22
+ /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:n.type,size:13}),name:i,preview:Ki(n),marks:qi(n),onSelect:g,nameSlot:Ci(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!c,label:"group",onToggle:()=>Br(l)}:void 0,actions:Qo(n.type)?_i(n,t,o)??void 0:/* @__PURE__ */Un(Yn,{children:[Zi(t,o,i),_i(n,t,o),Qi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Jn(Te,{children:ks(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,k):/* @__PURE__ */Jn(Mn,{children:k},o.slot??"")})})},Ss=Oo||null!==po,vs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Qt&&!Ss&&qo===e.id,onSelect:()=>Gr(e.id)}:e,bs=[...(Zo.railLead??[]).map(vs),{id:"sections",label:Lt.layers,icon:/* @__PURE__ */Jn(Ve,{}),active:Qt&&!Ss&&"sections"===qo,onSelect:()=>Gr("sections")},...(Zo.railTrail??[]).map(vs)];ao?bs.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Jn(Fe,{}),active:Qt&&!Oo&&(null!==po||"media"===qo),onSelect:()=>Gr("media")}):mt&&bs.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Jn(Fe,{}),onSelect:Xr});const ws=[...Zo.railLead??[],...Zo.railTrail??[]].find(e=>"panel"in e&&e.id===qo),xs=Boolean(At?.foldable)&&!Ko,zs=At?.label??(gt?Lt.pageSections:Lt.templateSections),Cs=xs&&Cr(et),Bs=/* @__PURE__ */Un(Yn,{children:[qr.map((e,n)=>{if(Mt(e)||Tt(e)||Ot(e.type))return null;const t=Vo===String(e.props.id),o=Boolean(e.props._hidden);ol(e);const r=String(e.props.id),i=Zo.hasOwnRows?.(e)??!1,l=al(e)||i,s=l&&Cr(r),d=tl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...xn(c),index:ui(c).length}:void 0,p=Dl.dragging,u=a&&p&&Al(p,a)?a:void 0,{rowProps:f,...h}=Dl.row({item:{id:r,zone:ke,index:n,type:e.type},place:{...xn(ke),index:n},into:u},{"data-node-id":r,onClick:Gi(()=>Ei(n))});/* @__PURE__ */
24
24
  return Un(Mn,{children:[n>0&&el(n),
25
- /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:e.type,size:13}),name:ci(e),preview:Zi(e),marks:qi(e),onSelect:()=>Ei(n),nameSlot:Ci(Se,n,r,ci(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Br(r)}:void 0,actions:/* @__PURE__ */Un(Yn,{children:[Ki(Se,n,ci(e)),_i(e,Se,n),Qi(Se,n,e,ci(e))]}),rowProps:f}),al(e)&&!s&&/* @__PURE__ */Un(Te,{children:[Ss(e,1),Ko.partRows?.(e,hs)]}),i&&!s&&/* @__PURE__ */Jn(Te,{children:Ko.ownRows?.(e,n,hs)})]},String(e.props.id??n))}),!Zo&&Bl>0&&el(Bl)]}),Is=(e,n,t)=>{const o=String(e.props.id),r=il(e).length>0||ll(e)||Boolean(or(e.type)),i=r&&Cr(o),l="header"===t?Lt.header:Lt.footer,s=ir.rowName?ir.rowName(e,"section",l):l;/* @__PURE__ */
25
+ /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:e.type,size:13}),name:ci(e),preview:Ki(e),marks:qi(e),onSelect:()=>Ei(n),nameSlot:Ci(ke,n,r,ci(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Br(r)}:void 0,actions:/* @__PURE__ */Un(Yn,{children:[Zi(ke,n,ci(e)),_i(e,ke,n),Qi(ke,n,e,ci(e))]}),rowProps:f}),al(e)&&!s&&/* @__PURE__ */Un(Te,{children:[ks(e,1),Zo.partRows?.(e,hs)]}),i&&!s&&/* @__PURE__ */Jn(Te,{children:Zo.ownRows?.(e,n,hs)})]},String(e.props.id??n))}),!Ko&&Bl>0&&el(Bl)]}),Is=(e,n,t)=>{const o=String(e.props.id),r=il(e).length>0||ll(e)||Boolean(or(e.type)),i=r&&Cr(o),l="header"===t?Lt.header:Lt.footer,s=ir.rowName?ir.rowName(e,"section",l):l;/* @__PURE__ */
26
26
  return Un(Yn,{children:[
27
- /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:t,size:13}),name:s,preview:Zi(e),marks:qi(e),badge:xl,onSelect:()=>Ei(n),nameSlot:Ci(Se,n,o,s),selected:Vo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Br(o)}:void 0,actions:_i(e,Se,n)??void 0,rowProps:{"data-node-id":o,onClick:Gi(()=>Ei(n))}}),r&&!i&&/* @__PURE__ */Jn(Te,{children:ys(e,1)})]})};return(Ko.wrap??(e=>e))(
27
+ /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:t,size:13}),name:s,preview:Ki(e),marks:qi(e),badge:xl,onSelect:()=>Ei(n),nameSlot:Ci(ke,n,o,s),selected:Vo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Br(o)}:void 0,actions:_i(e,ke,n)??void 0,rowProps:{"data-node-id":o,onClick:Gi(()=>Ei(n))}}),r&&!i&&/* @__PURE__ */Jn(Te,{children:ys(e,1)})]})};return(Zo.wrap??(e=>e))(
28
28
  /* @__PURE__ */Jn(X,{target:wo,children:/* @__PURE__ */Un("div",{ref:bo,className:"sf-editor es-editor",style:qe(vr),onContextMenu:$i.onEditorContextMenu,...m(fn),children:[
29
29
  /* @__PURE__ */Un(He,{children:[
30
30
  /* @__PURE__ */Jn(We,{items:bs,ariaLabel:Lt.bar.views}),
@@ -33,25 +33,25 @@ return Un(Yn,{children:[
33
33
  /* @__PURE__ */Jn(Je,{label:Lt.bar.redo,disabled:Boolean(pt)||!vt.hasFuture,onClick:()=>vt.forward(),children:/* @__PURE__ */Jn(Rn,{})}),
34
34
  /* @__PURE__ */Jn(Ue,{}),
35
35
  /* @__PURE__ */Jn(Ye,{devices:no,value:lo,onChange:so}),
36
- /* @__PURE__ */Jn(Je,{label:Lt.bar.refresh,tip:Lt.bar.refreshTip,onClick:()=>{vo.current=(()=>{const e=wo?.document;if(!e)return null;const n=qr.findIndex(Tt),t=n>=0?n:qr.length;let o=null;for(let n=0;n<t;n++){const t=qr[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=bt?.props?.id??qr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),ko(e=>e+1)},children:/* @__PURE__ */Jn(En,{})})]}),
36
+ /* @__PURE__ */Jn(Je,{label:Lt.bar.refresh,tip:Lt.bar.refreshTip,onClick:()=>{vo.current=(()=>{const e=wo?.document;if(!e)return null;const n=qr.findIndex(Tt),t=n>=0?n:qr.length;let o=null;for(let n=0;n<t;n++){const t=qr[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=bt?.props?.id??qr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),So(e=>e+1)},children:/* @__PURE__ */Jn(En,{})})]}),
37
37
  /* @__PURE__ */Un(De,{kind:"right",style:{minWidth:300},children:[
38
- /* @__PURE__ */Jn(l,{input:Bo,words:Lt.saveStatus}),Ko.barLead?.(),Ko.barTrail?.(),Ko.mainAction||!Ko.barMain?/* @__PURE__ */Jn(s,{input:Bo,action:Ko.mainAction??{label:Lt.done,onPress:()=>{ot(St.data)}},readOnly:Boolean(pt),saveSwitch:ft,onToggleAutoSave:st,onSaveNow:Io,bar:Lt.bar,words:Lt.saveStatus}):Ko.barMain()]})]}),
38
+ /* @__PURE__ */Jn(l,{input:Bo,words:Lt.saveStatus}),Zo.barLead?.(),Zo.barTrail?.(),Zo.mainAction||!Zo.barMain?/* @__PURE__ */Jn(s,{input:Bo,action:Zo.mainAction??{label:Lt.done,onPress:()=>{ot(kt.data)}},readOnly:Boolean(pt),saveSwitch:ft,onToggleAutoSave:st,onSaveNow:Io,bar:Lt.bar,words:Lt.saveStatus}):Zo.barMain()]})]}),
39
39
  /* @__PURE__ */Jn(ee,{}),
40
40
  /* @__PURE__ */Un("div",{className:"sf-body",children:[Qt?/* @__PURE__ */Un(Yn,{children:[
41
- /* @__PURE__ */Jn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Lt.leftPanel,children:No?/* @__PURE__ */Jn(x,{at:Mo?{label:(e=>{const n=Tl(e.zone);if(n)return Lt.add.addingTo({name:ir.rowName?Yi(n,!0):li(n.type)});if(e.zone===Se){const n=qr[e.index];return n&&!Tt(n)?Lt.add.addingBefore({name:Yi(n,!0)}):Lt.add.addingAtEnd}const t=Rl(e.zone);return t?Lt.add.addingTo({name:t.parentName}):Lt.add.addingHere})(Mo),onClear:()=>To(null)}:void 0,placeBlocks:Mo&&Mo.zone!==Se?Rl(Mo.zone)?.choices:void 0,canTake:Mo?e=>{if(!Mo)return null;const n={...xn(Mo.zone),index:Mo.index};if(Vl(e,n))return null;const t=Tl(Mo.zone);if(t)return Lt.add.notInside({name:Yi(t,!0)});if(Mo.zone===Se)return Lt.add.onlySections;const o=Rl(Mo.zone);return o?Lt.add.notInside({name:o.parentName}):Lt.add.onlySections}:void 0,onPick:Mo?e=>{if(!Mo)return;const n={...xn(Mo.zone),index:Mo.index};Vl(e,n)&&(Fl(e,n),Ui())}: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:Wl,siteWide:Ko.addPanelRow?.(Ui),onClose:Ui,onHide:Ur,readOnly:Boolean(pt)}):po&&co?
41
+ /* @__PURE__ */Jn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Lt.leftPanel,children:Oo?/* @__PURE__ */Jn(x,{at:Mo?{label:(e=>{const n=Tl(e.zone);if(n)return Lt.add.addingTo({name:ir.rowName?Yi(n,!0):li(n.type)});if(e.zone===ke){const n=qr[e.index];return n&&!Tt(n)?Lt.add.addingBefore({name:Yi(n,!0)}):Lt.add.addingAtEnd}const t=Rl(e.zone);return t?Lt.add.addingTo({name:t.parentName}):Lt.add.addingHere})(Mo),onClear:()=>To(null)}:void 0,placeBlocks:Mo&&Mo.zone!==ke?Rl(Mo.zone)?.choices:void 0,canTake:Mo?e=>{if(!Mo)return null;const n={...xn(Mo.zone),index:Mo.index};if(Vl(e,n))return null;const t=Tl(Mo.zone);if(t)return Lt.add.notInside({name:Yi(t,!0)});if(Mo.zone===ke)return Lt.add.onlySections;const o=Rl(Mo.zone);return o?Lt.add.notInside({name:o.parentName}):Lt.add.onlySections}:void 0,onPick:Mo?e=>{if(!Mo)return;const n={...xn(Mo.zone),index:Mo.index};Vl(e,n)&&(Fl(e,n),Ui())}: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:Wl,siteWide:Zo.addPanelRow?.(Ui),onClose:Ui,onHide:Ur,readOnly:Boolean(pt)}):po&&co?
42
42
  /* @__PURE__ */Jn(B,{panel:co,pick:po,onHide:Ur}):ws?ws.panel({onHide:Ur,notify:Pr}):"media"===qo&&co?/* @__PURE__ */Jn(B,{panel:co,pick:null,onHide:Ur}):/* @__PURE__ */Un(Yn,{children:[
43
43
  /* @__PURE__ */Jn(z,{icon:/* @__PURE__ */Jn(Ve,{}),title:Lt.layers,context:Jt,actions:/* @__PURE__ */Un(Yn,{children:[!pt&&/* @__PURE__ */Jn(Ge,{label:Lt.add.title,onClick:()=>Di(null),children:/* @__PURE__ */Jn(Vn,{size:15})}),
44
- /* @__PURE__ */Jn(Ge,{label:Nl?Lt.expandAll:Lt.collapseAll,title:0===Il.length?Lt.nothingToFold:void 0,disabled:0===Il.length,onClick:()=>kr(e=>{const n=new Set(Il);return Nl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Il])}),children:/* @__PURE__ */Jn(Zn,{expand:Nl})})]}),onHide:Ur}),
44
+ /* @__PURE__ */Jn(Ge,{label:Ol?Lt.expandAll:Lt.collapseAll,title:0===Il.length?Lt.nothingToFold:void 0,disabled:0===Il.length,onClick:()=>Sr(e=>{const n=new Set(Il);return Ol?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Il])}),children:/* @__PURE__ */Jn(Kn,{expand:Ol})})]}),onHide:Ur}),
45
45
  /* @__PURE__ */Un(je,{className:"sf-tree sf-scroll",words:Rt,children:[
46
- /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:"page",size:13}),name:Lt.pageSettings,onSelect:Kr,selected:!bt&&Eo,rowProps:{onClick:Gi(Kr)}}),zl&&/* @__PURE__ */Un(Yn,{children:[!wl&&/* @__PURE__ */Jn(Ae,{children:Lt.header}),ms(zl)]}),!Zo&&yt&&!(wl&&zl)&&/* @__PURE__ */Un(Yn,{children:[!wl&&/* @__PURE__ */Jn(Ae,{children:Lt.header}),!jt&&/* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:"header",size:13}),name:Lt.header,badge:xl,onSelect:Zr,selected:Lo.kind===$t?.kind,rowProps:{onClick:Gi(Zr)}})]}),!Zo&&kl&&!(wl&&zl)&&Is(kl,Sl,"header"),!Zo&&!xs&&/* @__PURE__ */Jn(Ae,{children:zs}),xs?/* @__PURE__ */Un(Yn,{children:[
47
- /* @__PURE__ */Jn(Me,{words:Rt,icon:null,name:zs,fold:{open:!Cs,label:zs,onToggle:()=>Br(et)}}),!Cs&&/* @__PURE__ */Jn(Te,{children:Bs})]}):Bs,yt&&!wl&&/* @__PURE__ */Jn(Ae,{children:Lt.footer}),yl&&!(wl&&Cl)&&Is(yl,gl,"footer"),!Zo&&!yl&&yt&&!wl&&/* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:"footer",size:13}),name:Lt.footer,onSelect:Xi,rowProps:{onClick:Gi(Xi),title:Lt.editFooter}}),Cl&&ms(Cl),Ko.treeFoot?.()]})]})}),
48
- /* @__PURE__ */Jn(Xe,{side:"left",width:vr.left,min:Ze,max:Ke,defaultWidth:S.left,label:Lt.resizeLeftPanel,onResize:xr})]}):/* @__PURE__ */Jn(C,{side:"left",onShow:Ur}),
46
+ /* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:"page",size:13}),name:Lt.pageSettings,onSelect:Zr,selected:!bt&&Eo,rowProps:{onClick:Gi(Zr)}}),zl&&/* @__PURE__ */Un(Yn,{children:[!wl&&/* @__PURE__ */Jn(Ae,{children:Lt.header}),ms(zl)]}),!Ko&&yt&&!(wl&&zl)&&/* @__PURE__ */Un(Yn,{children:[!wl&&/* @__PURE__ */Jn(Ae,{children:Lt.header}),!jt&&/* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:"header",size:13}),name:Lt.header,badge:xl,onSelect:Kr,selected:Lo.kind===$t?.kind,rowProps:{onClick:Gi(Kr)}})]}),!Ko&&Sl&&!(wl&&zl)&&Is(Sl,kl,"header"),!Ko&&!xs&&/* @__PURE__ */Jn(Ae,{children:zs}),xs?/* @__PURE__ */Un(Yn,{children:[
47
+ /* @__PURE__ */Jn(Me,{words:Rt,icon:null,name:zs,fold:{open:!Cs,label:zs,onToggle:()=>Br(et)}}),!Cs&&/* @__PURE__ */Jn(Te,{children:Bs})]}):Bs,yt&&!wl&&/* @__PURE__ */Jn(Ae,{children:Lt.footer}),yl&&!(wl&&Cl)&&Is(yl,gl,"footer"),!Ko&&!yl&&yt&&!wl&&/* @__PURE__ */Jn(Me,{words:Rt,icon:/* @__PURE__ */Jn(sr,{type:"footer",size:13}),name:Lt.footer,onSelect:Xi,rowProps:{onClick:Gi(Xi),title:Lt.editFooter}}),Cl&&ms(Cl),Zo.treeFoot?.()]})]})}),
48
+ /* @__PURE__ */Jn(Xe,{side:"left",width:vr.left,min:Ke,max:Ze,defaultWidth:k.left,label:Lt.resizeLeftPanel,onResize:xr})]}):/* @__PURE__ */Jn(C,{side:"left",onShow:Ur}),
49
49
  /* @__PURE__ */Un("div",{ref:$r,className:"sf-center sf-scroll","data-sf-canvas-head":Lr?"":void 0,style:{overflowX:Wr?"auto":"hidden",overflowY:"hidden"},children:[Lr&&/* @__PURE__ */Jn("div",{ref:Rr,className:"sf-canvas-head",children:/* @__PURE__ */Jn(Lr,{device:lo})}),
50
50
  /* @__PURE__ */Un("div",{className:"sf-frame-scaler",style:Dr,children:[
51
51
  /* @__PURE__ */Jn("div",{className:"sf-frame "+(lo===ro?"":`sf-frame--${lo}`),style:Jr,children:/* @__PURE__ */Un("div",{className:"sf-preview-host",children:[
52
- /* @__PURE__ */Jn(Ne.Provider,{value:bl,children:/* @__PURE__ */Jn(Ut,{},So)}),
53
- /* @__PURE__ */Jn(ln,{canvas:wo,session:Wl,model:os,measure:is,canDrop:ss,onDrop:cs,choose:Yl,onPick:ps,onZoneAdd:us,onSeamAdd:us,zoneAddLabel:Lt.canvasAddBlock,words:Et.canvas,readOnly:Boolean(pt),revision:St.data}),jo.length>0&&/* @__PURE__ */Jn("div",{className:"sf-preview-gaps",children:jo.map(e=>
54
- /* @__PURE__ */Jn(sn,{index:e.index,label:Lt.addSectionHere,onInsert:()=>Di(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))})]})}),vl?/* @__PURE__ */Jn(Kn,{canvas:wo,tabs:Zl,onSelect:e=>{const n=qr.findIndex(n=>String(n.props.id)===e);n>=0&&Ei(n)}}):null]})]}),eo?/* @__PURE__ */Un(Yn,{children:[
55
- /* @__PURE__ */Jn(g,{value:{selectChild:ul,addChild:fl,childRowName:xi,blockRowName:Ol},children:/* @__PURE__ */Jn(Yt,{mode:Lo,onOpenWebsiteSettings:Ko.openSettings??(()=>{}),onOpenSiteStyles:Ko.openStyles,onSelectNode:pr,onNotify:Pr,onHidePanel:Yr,nodeActions:bt?ke(xt,bt.type):nt})}),
56
- /* @__PURE__ */Jn(Xe,{side:"right",width:vr.right,min:Ze,max:Ke,defaultWidth:S.right,label:Lt.resizeSettingsPanel,onResize:zr})]}):
52
+ /* @__PURE__ */Jn(Oe.Provider,{value:bl,children:/* @__PURE__ */Jn(Ut,{},ko)}),
53
+ /* @__PURE__ */Jn(ln,{canvas:wo,session:Wl,model:os,measure:is,canDrop:ss,onDrop:cs,choose:Yl,onPick:ps,onZoneAdd:us,onSeamAdd:us,zoneAddLabel:Lt.canvasAddBlock,words:Et.canvas,readOnly:Boolean(pt),revision:kt.data}),jo.length>0&&/* @__PURE__ */Jn("div",{className:"sf-preview-gaps",children:jo.map(e=>
54
+ /* @__PURE__ */Jn(sn,{index:e.index,label:Lt.addSectionHere,onInsert:()=>Di(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))})]})}),vl?/* @__PURE__ */Jn(Zn,{canvas:wo,tabs:Kl,onSelect:e=>{const n=qr.findIndex(n=>String(n.props.id)===e);n>=0&&Ei(n)}}):null]})]}),eo?/* @__PURE__ */Un(Yn,{children:[
55
+ /* @__PURE__ */Jn(g,{value:{selectChild:ul,addChild:fl,childRowName:xi,blockRowName:Nl},children:/* @__PURE__ */Jn(Yt,{mode:Lo,onOpenWebsiteSettings:Zo.openSettings??(()=>{}),onOpenSiteStyles:Zo.openStyles,onSelectNode:pr,onNotify:Pr,onHidePanel:Yr,nodeActions:bt?Se(xt,bt.type):nt})}),
56
+ /* @__PURE__ */Jn(Xe,{side:"right",width:vr.right,min:Ke,max:Ze,defaultWidth:k.right,label:Lt.resizeSettingsPanel,onResize:zr})]}):
57
57
  /* @__PURE__ */Jn(C,{side:"right",onShow:Yr})]}),$i.menu]})}))}export{tt as ScreenChrome};
@@ -1,2 +1,2 @@
1
- import{describeLoadFailure as e,hostLoadRefusal as r}from"./chunk-ERR437B5.js";import{editLockOf as n}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as t}from"./chunk-RLBXE4EU.js";import{saveStatusOf as o,resetForDocumentSwitch as u}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as a,readEaselFailure as s}from"./chunk-CLOS6SSX.js";import{routeSharedHostMessage as i}from"./chunk-S4AWJX4Q.js";import{useAdminBridge as l}from"./chunk-VPFNZ7TB.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-O7Q4DDJT.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-RSCMJIWS.js";import{useEaselHost as k}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as g}from"./chunk-VVPZMWJE.js";import{useAutosave as v}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as S,CLAIM_FAIL_OPEN_MS as b,holderOf as P}from"./chunk-THWO5YVZ.js";import{useWords as I}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as B,useMemo as O,useCallback as C,useEffect as E,useRef as H}from"react";import{jsx as T}from"react/jsx-runtime";var M={content:[],root:{},zones:{}};var V=j(null);function A(){const e=R(V);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function D({target:j,addressing:R=t,onHostMessage:A,children:D}){const N=R,{homeSlug:F,entryMayBounce:L,entryBounce:W,onSwitch:Z,tellsHost:J,adapterFor:Y,migrateRenamedProps:U,describeMissing:X,onLoadFailed:x}=N,[G,K]=B(j),Q=k(),z=d(),_=O(()=>f(z),[z]),q=O(()=>n(z),[z]),$="template"===G.kind,ee="template"===G.kind?G.id:null,re="template"===G.kind?G.pageSlug??F??"":"document"===G.kind?G.slug??"":G.slug,ne="page"===G.kind?G.siteId??null:null,te=z.blocks,oe=O(()=>Y(G,_,te),[Y,_,te,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),ue=oe.capabilities,ae=C(e=>z.documentHooks?.stored?.(e)??e,[z]),se="page"===G.kind?G.originSlug??null:null;E(()=>{m(z,ne)},[z,ne]);const ie=H(G);E(()=>{ie.current=G},[G]);const{token:le,tokenRef:ce,capabilities:de}=l({onMessage:e=>{if(A?.(e)||i(e))return;const r=e;if("storefront-editor:navigate"===r?.type){const r=e;r?.target&&Or(r.target)}}}),fe=!z.usesBridgedToken||null!==le,me=oe.lock,ke=Boolean(_.lock),[ge,ve]=B(null),[pe,he]=B(null),[ye,we]=B(null),[Se,be]=B(null),Pe=I("screen",g),Ie=Se?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(Se,Pe):null,[je,Re]=B(null),Be=H(null),Oe=H(null),[Ce,Ee]=B(!1),He=H(null),[Te,Me]=B(null),Ve=H(null),[Ae,De]=B(null),[Ne,Fe]=B(!1),Le=H(null);E(()=>{Le.current=Ae},[Ae]);const[We,Ze]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Je=H(We);E(()=>{Je.current=We},[We]);const Ye=H(()=>Promise.resolve(!1)),Ue=C(e=>{Oe.current=e,Ee(!0)},[]),Xe=v({save:async({id:e,data:r})=>{if(p(Je.current)){if(!await Ye.current(e,r)){if(!p(Je.current))return void Ue({id:e,data:r});throw new Error("page save did not land")}}else Ue({id:e,data:r})},onFailure:(e,r)=>{0===r&&Q.send("storefront-editor:save-failed")}}),{state:xe,push:Ge,flush:Ke,pause:Qe,resume:ze,stop:_e,reset:qe,retryNow:$e,hasPending:er}=Xe,rr=H(xe);E(()=>{rr.current=xe},[xe]);const nr=o(xe),tr=C(()=>{const e=Oe.current;e&&(Oe.current=null,Ee(!1),Ge(e))},[Ge]),or=H("");or.current||(or.current=h());const[ur,ar]=B(0),sr=H(!1),[ir,lr]=B(L(j)),cr=H(!1);E(()=>{if(cr.current)return;cr.current=!0;const e=Q.address.search(),r=W(j,e);r?Q.address.load(r):L(j)&&lr(!1)},[j,Q]);const dr=Q.send;E(()=>{if(!fe)return;let n=!1;const t=ie.current,o=oe.resolve(re),u=z.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async e=>{if(n)return;if(!e)return"page"===t.kind&&null!==F&&re!==F?void Q.address.load({kind:"page",slug:F,siteId:ne??void 0}):(be({target:t,slug:re,missing:!0,sentence:X?.(t)??null}),void x?.(t,null));const r=e.readOnlyReason?e.readOnlyReason:null;Be.current=r,Re(r),ve(e.id),he(e.kind??null),Ve.current=e.version??null;const o=e.layout,a=o&&Object.keys(o).length?o:M,s=U(a),i=u?await u(s):s;n||we(i)}).catch(o=>{n||(console.error("[storefront-editor] document load failed",o),be({target:t,slug:re,missing:!1,sentence:r(o,{slug:re},z),cause:e(o,z)}),x?.(t,o))}),()=>{n=!0}},[fe,le,$,oe,re]);const fr=C(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=ce.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),mr=C(async e=>{const r=ce.current;if(!r&&z.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(a(n,z)){dr("storefront-editor:auth-expired");const n=r?await fr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[dr,fr,z]),kr=C(async e=>{const r=ce.current?await mr(e):{ok:!1};return r.ok||dr("storefront-editor:save-failed"),r.ok},[dr,mr]),gr=C(async(e,r,n=!1)=>{if(null!==Be.current)return!1;if(!p(Je.current))return!1;if(Le.current)return!1;const t=await mr(()=>oe.saveLayout(e,r,Ve.current,or.current));if(t.ok)return Ve.current=t.value.version??Ve.current,Fe(!1),!0;const o=q.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Je.current=e,Ze(e),!1}const u=q.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await mr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return Ve.current=n.value,Ye.current(e,r,!0)}_e(),Le.current=u,De(u)}return Fe(s(t.error,z)?.status===c),!1},[oe,mr,_e,z]);E(()=>{Ye.current=gr},[gr]);const vr=C(e=>{if(null!==Be.current)return;if(dr("storefront-editor:dirty"),!ge)return;const r=ae(e);He.current=r,p(Je.current)?Ge({id:ge,data:r}):Ue({id:ge,data:r})},[ge,dr,Ue,Ge,ae]),pr=C(async()=>{p(Je.current)&&tr();return await Ke()&&null==Oe.current},[tr,Ke]),hr=H(pr);E(()=>{hr.current=pr},[pr]);const yr=H(mr);E(()=>{yr.current=mr},[mr]);const wr=C(()=>{Q.address.reload()},[Q]),Sr=H(()=>Promise.resolve(!1));E(()=>{Sr.current=()=>{const e=oe.rereadVersion;return ge&&e?y({ours:Ve.current,stored:async()=>{const r=await yr.current(()=>e(ge));return r.ok?r.value:null},hasPending:()=>null!=Oe.current||er(),reload:wr}):Promise.resolve(!1)}},[oe,ge,er,wr]);const br=null!==je;E(()=>{if(!me||!ge||!fe||br)return;let e=!1,r=null,n=null;const t=or.current,o={claim:async e=>{const r=await yr.current(()=>me.claim(ge,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Je.current,heldWrite:()=>({pending:null!=Oe.current||er(),autoSaveEnabled:!rr.current.paused,saveConflict:null!=Le.current}),setAccess:e=>{Je.current=e,Ze(e)},releaseHeldWrite:()=>{hr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{Sr.current()}},u=q.makeClaimBeat(o),a=sr.current;return sr.current=!1,a||(Ze({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(S)},b)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),me.release(ge,t).catch(()=>{})}},[ge,me,fe,le,ur,br]);const Pr=C(()=>{me&&ge&&(sr.current=!0,ar(e=>e+1))},[ge,me]),Ir=C(()=>{Ze(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),jr=C(()=>{rr.current.paused?(p(Je.current)&&tr(),ze()):Qe()},[tr,Qe,ze]),Rr=C(()=>{$e()},[$e]),Br=C(e=>{He.current=null,u("template"!==e.kind&&ke,{resetAutosave:()=>{qe(),Oe.current=null,Ee(!1)},setVersion:e=>{Ve.current=e},setSaveConflict:De,setAccess:Ze}),Z(e),K(e),Be.current=null,Re(null),ve(null),he(null),we(null),be(null),Q.address.show(e),"document"!==e.kind&&J(e)&&Q.send("storefront-editor:navigated",{target:e})},[qe,Q,ke,Z,J]),Or=C(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,ie.current,F))return;const r=null!=Oe.current;if(!r&&!er())return void Br(e);const n=rr.current;r||n.paused||n.failed||n.stopped?Me(e):Ke().then(r=>{r?Br(e):Me(e)})},[Br,er,Ke,F]),Cr=C(()=>Me(null),[]),Er=C(()=>{Me(e=>(e&&Br(e),null))},[Br]),Hr=C(async()=>{const e=Te;if(!e)return;await pr()&&(Me(null),Br(e))},[Te,pr,Br]),Tr=C(async e=>{if(null!==Be.current)return;if(!ge)return;if(!p(Je.current)||Le.current)return;const r=ae(e);if(!await gr(ge,r))return void(Le.current||dr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void dr("storefront-editor:saved");const t=await mr(()=>n(ge,Ve.current??void 0));t.ok?(Ve.current=t.value.version??Ve.current,dr("storefront-editor:published")):dr("storefront-editor:save-failed")},[ge,oe,ue.canPublish,dr,gr,mr,ae]);/* @__PURE__ */
2
- return T(V.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:pe,siteId:ne,ready:fe,token:le,tokenRef:ce,notifyParent:dr,bridgeCapabilities:de,runAuthed:kr,docId:ge,data:ye,getLiveData:()=>He.current??ye,footerOriginSlug:se,error:Ie,redirecting:ir,saveStatus:nr,saveState:xe,autoSaveEnabled:!xe.paused,autoSaveStoppedByConflict:xe.stopped,hasUnsavedEdits:xe.pending||Ce,toggleAutoSave:jr,retrySave:Rr,onChange:vr,flushSave:pr,onPublish:Tr,access:We,readOnly:null!==P(We)||null!==je||null!==Ae,readOnlyReason:je,takeOverEditing:Pr,viewReadOnly:Ir,saveConflict:Ae,saveUnreachable:Ne,reloadFromServer:wr,navigate:Or,pendingNav:Te,cancelPendingNav:Cr,discardAndNavigate:Er,saveAndNavigate:Hr},children:D})}export{V as ScreenDocumentContext,D as ScreenDocumentProvider,A as useScreenDocument};
1
+ import{describeLoadFailure as e,hostLoadRefusal as r}from"./chunk-ERR437B5.js";import{editLockOf as n}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as t}from"./chunk-RLBXE4EU.js";import{saveStatusOf as o,resetForDocumentSwitch as u}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as a,readEaselFailure as s}from"./chunk-CLOS6SSX.js";import{routeSharedHostMessage as i}from"./chunk-S4AWJX4Q.js";import{useAdminBridge as l}from"./chunk-VPFNZ7TB.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-O7Q4DDJT.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-RSCMJIWS.js";import{useEaselHost as g}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as k}from"./chunk-VVPZMWJE.js";import{useAutosave as v}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as S,CLAIM_FAIL_OPEN_MS as b,holderOf as P}from"./chunk-THWO5YVZ.js";import{useWords as I}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as B,useMemo as E,useCallback as O,useEffect as C,useRef as H}from"react";import{jsx as T}from"react/jsx-runtime";var M={content:[],root:{},zones:{}};var V=j(null);function A(){const e=R(V);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function D({target:j,addressing:R=t,onHostMessage:A,children:D}){const N=R,{homeSlug:F,entryMayBounce:L,entryBounce:W,onSwitch:Z,tellsHost:J,adapterFor:Y,migrateRenamedProps:U,describeMissing:X,onLoadFailed:x}=N,[G,K]=B(j),Q=g(),z=d(),_=E(()=>f(z),[z]),q=E(()=>n(z),[z]),$="template"===G.kind,ee="template"===G.kind?G.id:null,re="template"===G.kind?G.pageSlug??F??"":"document"===G.kind?G.slug??"":G.slug,ne="page"===G.kind?G.siteId??null:null,te=z.blocks,oe=E(()=>Y(G,_,te),[Y,_,te,G.kind,"template"===G.kind?G.id:"document"===G.kind?G.record:G.siteId]),ue=oe.capabilities,ae=O(e=>z.documentHooks?.stored?.(e)??e,[z]),se="page"===G.kind?G.originSlug??null:null;C(()=>{m(z,ne)},[z,ne]);const ie=H(G);C(()=>{ie.current=G},[G]);const{token:le,tokenRef:ce,capabilities:de}=l({onMessage:e=>{if(A?.(e)||i(e))return;const r=e;if("storefront-editor:navigate"===r?.type){const r=e;r?.target&&Er(r.target)}}}),fe=!z.usesBridgedToken||null!==le,me=oe.lock,ge=Boolean(_.lock),[ke,ve]=B(null),[pe,he]=B(null),[ye,we]=B(null),[Se,be]=B(null),Pe=I("screen",k),Ie=Se?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(Se,Pe):null,[je,Re]=B(null),Be=H(null),Ee=H(null),[Oe,Ce]=B(!1),He=H(null),[Te,Me]=B(null),Ve=H(null),[Ae,De]=B(null),[Ne,Fe]=B(!1),Le=H(null);C(()=>{Le.current=Ae},[Ae]);const[We,Ze]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Je=H(We);C(()=>{Je.current=We},[We]);const Ye=H(()=>Promise.resolve(!1)),Ue=O(e=>{Ee.current=e,Ce(!0)},[]),Xe=v({save:async({id:e,data:r})=>{if(p(Je.current)){if(!await Ye.current(e,r)){if(!p(Je.current))return void Ue({id:e,data:r});throw new Error("page save did not land")}}else Ue({id:e,data:r})},onFailure:(e,r)=>{0===r&&Q.send("storefront-editor:save-failed")}}),{state:xe,push:Ge,flush:Ke,pause:Qe,resume:ze,stop:_e,reset:qe,retryNow:$e,hasPending:er}=Xe,rr=H(xe);C(()=>{rr.current=xe},[xe]);const nr=o(xe),tr=O(()=>{const e=Ee.current;e&&(Ee.current=null,Ce(!1),Ge(e))},[Ge]),or=H("");or.current||(or.current=h());const[ur,ar]=B(0),sr=H(!1),[ir,lr]=B(L(j)),cr=H(!1);C(()=>{if(cr.current)return;cr.current=!0;const e=Q.address.search(),r=W(j,e);r?Q.address.load(r):L(j)&&lr(!1)},[j,Q]);const dr=Q.send;C(()=>{if(!fe)return;let n=!1;const t=ie.current,o=oe.resolve(re),u=z.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async e=>{if(n)return;if(!e)return"page"===t.kind&&null!==F&&re!==F?void Q.address.load({kind:"page",slug:F,siteId:ne??void 0}):(be({target:t,slug:re,missing:!0,sentence:X?.(t)??null}),void x?.(t,null));const r=e.readOnlyReason?e.readOnlyReason:null;Be.current=r,Re(r),ve(e.id),he(e.kind??null),Ve.current=e.version??null;const o=e.layout,a=o&&Object.keys(o).length?o:M,s=U(a),i=u?await u(s):s;n||we(i)}).catch(o=>{n||(console.error("[storefront-editor] document load failed",o),be({target:t,slug:re,missing:!1,sentence:r(o,{slug:re},z),cause:e(o,z)}),x?.(t,o))}),()=>{n=!0}},[fe,le,$,oe,re]);const fr=O(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=ce.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),mr=O(async e=>{const r=ce.current;if(!r&&z.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(a(n,z)){dr("storefront-editor:auth-expired");const n=r?await fr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[dr,fr,z]),gr=O(async e=>{const r=ce.current?await mr(e):{ok:!1};return r.ok||dr("storefront-editor:save-failed"),r.ok},[dr,mr]),kr=O(async(e,r,n=!1)=>{if(null!==Be.current)return!1;if(!p(Je.current))return!1;if(Le.current)return!1;const t=await mr(()=>oe.saveLayout(e,r,Ve.current,or.current));if(t.ok)return Ve.current=t.value.version??Ve.current,Fe(!1),!0;const o=q.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Je.current=e,Ze(e),!1}const u=q.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await mr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return Ve.current=n.value,Ye.current(e,r,!0)}_e(),Le.current=u,De(u)}return Fe(s(t.error,z)?.status===c),!1},[oe,mr,_e,z]);C(()=>{Ye.current=kr},[kr]);const vr=O(e=>{if(null!==Be.current)return;if(dr("storefront-editor:dirty"),!ke)return;const r=ae(e);He.current=r,p(Je.current)?Ge({id:ke,data:r}):Ue({id:ke,data:r})},[ke,dr,Ue,Ge,ae]),pr=O(async()=>{p(Je.current)&&tr();return await Ke()&&null==Ee.current},[tr,Ke]),hr=H(pr);C(()=>{hr.current=pr},[pr]);const yr=H(mr);C(()=>{yr.current=mr},[mr]);const wr=O(()=>{Q.address.reload()},[Q]),Sr=H(()=>Promise.resolve(!1));C(()=>{Sr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:Ve.current,stored:async()=>{const r=await yr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Ee.current||er(),reload:wr}):Promise.resolve(!1)}},[oe,ke,er,wr]);const br=null!==je;C(()=>{if(!me||!ke||!fe||br)return;let e=!1,r=null,n=null;const t=or.current,o={claim:async e=>{const r=await yr.current(()=>me.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Je.current,heldWrite:()=>({pending:null!=Ee.current||er(),autoSaveEnabled:!rr.current.paused,saveConflict:null!=Le.current}),setAccess:e=>{Je.current=e,Ze(e)},releaseHeldWrite:()=>{hr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{Sr.current()}},u=q.makeClaimBeat(o),a=sr.current;return sr.current=!1,a||(Ze({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(S)},b)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),me.release(ke,t).catch(()=>{})}},[ke,me,fe,le,ur,br]);const Pr=O(()=>{me&&ke&&(sr.current=!0,ar(e=>e+1))},[ke,me]),Ir=O(()=>{Ze(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),jr=O(()=>{rr.current.paused?(p(Je.current)&&tr(),ze()):Qe()},[tr,Qe,ze]),Rr=O(()=>{$e()},[$e]),Br=O(e=>{He.current=null,u("template"!==e.kind&&ge,{resetAutosave:()=>{qe(),Ee.current=null,Ce(!1)},setVersion:e=>{Ve.current=e},setSaveConflict:De,setAccess:Ze}),Z(e),K(e),Be.current=null,Re(null),ve(null),he(null),we(null),be(null),Q.address.show(e),"document"!==e.kind&&J(e)&&Q.send("storefront-editor:navigated",{target:e})},[qe,Q,ge,Z,J]),Er=O(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,ie.current,F))return;const r=null!=Ee.current;if(!r&&!er())return void Br(e);const n=rr.current;r||n.paused||n.failed||n.stopped?Me(e):Ke().then(r=>{r?Br(e):Me(e)})},[Br,er,Ke,F]),Or=O(()=>Me(null),[]),Cr=O(()=>{Me(e=>(e&&Br(e),null))},[Br]),Hr=O(async()=>{const e=Te;if(!e)return;await pr()&&(Me(null),Br(e))},[Te,pr,Br]),Tr=O(async e=>{if(null!==Be.current)return;if(!ke)return;if(!p(Je.current)||Le.current)return;const r=ae(e);if(!await kr(ke,r))return void(Le.current||dr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void dr("storefront-editor:saved");const t=await mr(()=>n(ke,Ve.current??void 0));if(!t.ok){const{error:e}=t;return void dr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}Ve.current=t.value.version??Ve.current,dr("storefront-editor:published")},[ke,oe,ue.canPublish,dr,kr,mr,ae]);/* @__PURE__ */
2
+ return T(V.Provider,{value:{target:G,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:pe,siteId:ne,ready:fe,token:le,tokenRef:ce,notifyParent:dr,bridgeCapabilities:de,runAuthed:gr,docId:ke,data:ye,getLiveData:()=>He.current??ye,footerOriginSlug:se,error:Ie,redirecting:ir,saveStatus:nr,saveState:xe,autoSaveEnabled:!xe.paused,autoSaveStoppedByConflict:xe.stopped,hasUnsavedEdits:xe.pending||Oe,toggleAutoSave:jr,retrySave:Rr,onChange:vr,flushSave:pr,onPublish:Tr,access:We,readOnly:null!==P(We)||null!==je||null!==Ae,readOnlyReason:je,takeOverEditing:Pr,viewReadOnly:Ir,saveConflict:Ae,saveUnreachable:Ne,reloadFromServer:wr,navigate:Er,pendingNav:Te,cancelPendingNav:Or,discardAndNavigate:Cr,saveAndNavigate:Hr},children:D})}export{V as ScreenDocumentContext,D as ScreenDocumentProvider,A as useScreenDocument};
@@ -402,10 +402,19 @@ type EaselToHostMessage =
402
402
  | {
403
403
  type: "storefront-editor:published";
404
404
  }
405
- /** A save failed (first failure of a retry run only). */
405
+ /** A save failed (first failure of a retry run only). The save icon says
406
+ * so too, so a host may stay quiet on it. */
406
407
  | {
407
408
  type: "storefront-editor:save-failed";
408
409
  }
410
+ /** Publish failed after its save landed: nothing went live, and the edits
411
+ * are kept as they were saved. `reason` is the failure's own words (the
412
+ * backend's, e.g. which part cannot go live), or null when it has none. The
413
+ * save icon is calm here, so the host says it. */
414
+ | {
415
+ type: "storefront-editor:publish-failed";
416
+ reason: string | null;
417
+ }
409
418
  /** The editor moved in place to another page (page targets only). */
410
419
  | {
411
420
  type: "storefront-editor:navigated";
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { MediaPanelComponent, MediaPickRequest } from '../lib/media-panel.js';
3
- import '../../host-GOlVK3LX.js';
3
+ import '../../host-DGmdCaNL.js';
4
4
  import '../../blocks/index.js';
5
5
  import '../../types-NQozKWEz.js';
6
6
  import '../../data/index.js';
@@ -29,7 +29,7 @@ import './AddSidePanel.js';
29
29
  import '../lib/section-template-types.js';
30
30
  import '../lib/puck/content-tree.js';
31
31
  import '../lib/puck/block-choice.js';
32
- import '../../host-GOlVK3LX.js';
32
+ import '../../host-DGmdCaNL.js';
33
33
  import '../lib/document-contract.js';
34
34
  import '../lib/document-switch.js';
35
35
  import '../../engine-CvXpFE86.js';
@@ -1 +1 @@
1
- export{PageEditGuardNotices as default}from"../../chunk-IWFVVCRN.js";import"../../chunk-FBS75I6E.js";import"../../chunk-ERR437B5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VVPZMWJE.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-MFIRYGHW.js";
1
+ export{PageEditGuardNotices as default}from"../../chunk-2H3W5OLQ.js";import"../../chunk-ZZ64CEC2.js";import"../../chunk-ERR437B5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VVPZMWJE.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-MFIRYGHW.js";
@@ -28,7 +28,7 @@ import './AddSidePanel.js';
28
28
  import '../lib/section-template-types.js';
29
29
  import '../lib/puck/content-tree.js';
30
30
  import '../lib/puck/block-choice.js';
31
- import '../../host-GOlVK3LX.js';
31
+ import '../../host-DGmdCaNL.js';
32
32
  import '../lib/document-contract.js';
33
33
  import '../lib/session.js';
34
34
  import '../lib/backend-error.js';
@@ -1 +1 @@
1
- export{ScreenChrome as default}from"../../chunk-F6NO7B57.js";import"../../chunk-XT6DOSHO.js";import"../../chunk-FGNR22NY.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-NBDMTIU2.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-LER7RKTO.js";import"../../chunk-7F52SZOI.js";import"../../chunk-RSKHAHPJ.js";import"../../chunk-RKTF5XLP.js";import"../../chunk-3Z2MVLCD.js";import"../../chunk-CY52PUMZ.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-TZIIRGVY.js";import"../../chunk-CMXK3JT3.js";import"../../chunk-TR4APEJZ.js";import"../../chunk-5545A3PC.js";import"../../chunk-D46OYLJR.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-62VPYC7F.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-44QA42OJ.js";import"../../chunk-CSGTPJTY.js";import"../../chunk-NW4LJ4G4.js";import"../../chunk-IWFVVCRN.js";import"../../chunk-FBS75I6E.js";import"../../chunk-ERR437B5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-UMDQ6CLQ.js";import"../../chunk-VVPZMWJE.js";import"../../chunk-V7U33NF2.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-BXMXTO36.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-BSPCSC45.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-LPM2SCM4.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-SO5OLDH7.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-EA2HTX37.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-4VJATVVR.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-NY7HHUGB.js";import"../../chunk-B4JN227A.js";import"../../chunk-2XMHLXMA.js";import"../../chunk-G3GWAP5R.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-36LVP5WD.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-QFVRMARS.js";import"../../chunk-AYWN5NRH.js";import"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{ScreenChrome as default}from"../../chunk-XUAKHY4T.js";import"../../chunk-XT6DOSHO.js";import"../../chunk-FGNR22NY.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-NBDMTIU2.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-LER7RKTO.js";import"../../chunk-7F52SZOI.js";import"../../chunk-RSKHAHPJ.js";import"../../chunk-RKTF5XLP.js";import"../../chunk-3Z2MVLCD.js";import"../../chunk-CY52PUMZ.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-TZIIRGVY.js";import"../../chunk-CMXK3JT3.js";import"../../chunk-TR4APEJZ.js";import"../../chunk-5545A3PC.js";import"../../chunk-D46OYLJR.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-62VPYC7F.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-44QA42OJ.js";import"../../chunk-CSGTPJTY.js";import"../../chunk-NW4LJ4G4.js";import"../../chunk-2H3W5OLQ.js";import"../../chunk-ZZ64CEC2.js";import"../../chunk-ERR437B5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-UMDQ6CLQ.js";import"../../chunk-VVPZMWJE.js";import"../../chunk-V7U33NF2.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-BXMXTO36.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-BSPCSC45.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-LPM2SCM4.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-SO5OLDH7.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-EA2HTX37.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-4VJATVVR.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-NY7HHUGB.js";import"../../chunk-B4JN227A.js";import"../../chunk-2XMHLXMA.js";import"../../chunk-G3GWAP5R.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-36LVP5WD.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-QFVRMARS.js";import"../../chunk-AYWN5NRH.js";import"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1,6 +1,6 @@
1
1
  import 'react';
2
2
  import '../../blocks/index.js';
3
- export { k as AnyScreenTarget, l as DocumentTarget, m as ScreenDocumentContext, n as ScreenDocumentProvider, o as ScreenDocumentValue, p as ScreenTarget, q as useScreenDocument } from '../../host-GOlVK3LX.js';
3
+ export { k as AnyScreenTarget, l as DocumentTarget, m as ScreenDocumentContext, n as ScreenDocumentProvider, o as ScreenDocumentValue, p as ScreenTarget, q as useScreenDocument } from '../../host-DGmdCaNL.js';
4
4
  import '../lib/document-contract.js';
5
5
  export { SaveStatus } from '../lib/document-switch.js';
6
6
  import '../lib/admin-bridge.js';
@@ -1 +1 @@
1
- export{ScreenDocumentContext,ScreenDocumentProvider,useScreenDocument}from"../../chunk-FBS75I6E.js";import"../../chunk-ERR437B5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VVPZMWJE.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MFIRYGHW.js";
1
+ export{ScreenDocumentContext,ScreenDocumentProvider,useScreenDocument}from"../../chunk-ZZ64CEC2.js";import"../../chunk-ERR437B5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VVPZMWJE.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MFIRYGHW.js";
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { k as AnyScreenTarget, A as AnyDocumentAddressing } from '../../host-GOlVK3LX.js';
3
+ import { k as AnyScreenTarget, A as AnyDocumentAddressing } from '../../host-DGmdCaNL.js';
4
4
  import { ScreenParts } from '../lib/screen-parts.js';
5
5
  import '../../blocks/index.js';
6
6
  import '../../types-NQozKWEz.js';
@@ -1 +1 @@
1
- export{DocumentScreen,ScreenMount as default}from"../../chunk-3DCI44F3.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-F6NO7B57.js";import"../../chunk-XT6DOSHO.js";import"../../chunk-FGNR22NY.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-NBDMTIU2.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-LER7RKTO.js";import"../../chunk-7F52SZOI.js";import"../../chunk-RSKHAHPJ.js";import"../../chunk-RKTF5XLP.js";import"../../chunk-YKJ3RIMT.js";import"../../chunk-3Z2MVLCD.js";import"../../chunk-CY52PUMZ.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-TZIIRGVY.js";import"../../chunk-CMXK3JT3.js";import"../../chunk-TR4APEJZ.js";import"../../chunk-5545A3PC.js";import"../../chunk-D46OYLJR.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-62VPYC7F.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-44QA42OJ.js";import"../../chunk-CSGTPJTY.js";import"../../chunk-NW4LJ4G4.js";import"../../chunk-IWFVVCRN.js";import"../../chunk-FBS75I6E.js";import"../../chunk-ERR437B5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-UMDQ6CLQ.js";import"../../chunk-VVPZMWJE.js";import"../../chunk-V7U33NF2.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-BXMXTO36.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-BSPCSC45.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-LPM2SCM4.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-SO5OLDH7.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-EA2HTX37.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-4VJATVVR.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-NY7HHUGB.js";import"../../chunk-B4JN227A.js";import"../../chunk-2XMHLXMA.js";import"../../chunk-G3GWAP5R.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-36LVP5WD.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-QFVRMARS.js";import"../../chunk-AYWN5NRH.js";import"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{DocumentScreen,ScreenMount as default}from"../../chunk-35VMTYPH.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-XUAKHY4T.js";import"../../chunk-XT6DOSHO.js";import"../../chunk-FGNR22NY.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-NBDMTIU2.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-LER7RKTO.js";import"../../chunk-7F52SZOI.js";import"../../chunk-RSKHAHPJ.js";import"../../chunk-RKTF5XLP.js";import"../../chunk-YKJ3RIMT.js";import"../../chunk-3Z2MVLCD.js";import"../../chunk-CY52PUMZ.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-TZIIRGVY.js";import"../../chunk-CMXK3JT3.js";import"../../chunk-TR4APEJZ.js";import"../../chunk-5545A3PC.js";import"../../chunk-D46OYLJR.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-62VPYC7F.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-44QA42OJ.js";import"../../chunk-CSGTPJTY.js";import"../../chunk-NW4LJ4G4.js";import"../../chunk-2H3W5OLQ.js";import"../../chunk-ZZ64CEC2.js";import"../../chunk-ERR437B5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-UMDQ6CLQ.js";import"../../chunk-VVPZMWJE.js";import"../../chunk-V7U33NF2.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-BXMXTO36.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-BSPCSC45.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-TBF5CVPA.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-LPM2SCM4.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-SO5OLDH7.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-EA2HTX37.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-4VJATVVR.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-NY7HHUGB.js";import"../../chunk-B4JN227A.js";import"../../chunk-2XMHLXMA.js";import"../../chunk-G3GWAP5R.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-36LVP5WD.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-QFVRMARS.js";import"../../chunk-AYWN5NRH.js";import"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-ILXP5VX5.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -26,7 +26,7 @@ import './AddSidePanel.js';
26
26
  import '../lib/section-template-types.js';
27
27
  import '../lib/puck/content-tree.js';
28
28
  import '../lib/puck/block-choice.js';
29
- import '../../host-GOlVK3LX.js';
29
+ import '../../host-DGmdCaNL.js';
30
30
  import '../lib/document-contract.js';
31
31
  import '../lib/session.js';
32
32
  import '../lib/backend-error.js';
@@ -1,16 +1,16 @@
1
- import{AddBlockRow as e}from"../../chunk-F3A7SXSV.js";import{scrollPreviewToSection as n,gotoPreviewSlide as o}from"../../chunk-3Z2MVLCD.js";import{useEaselUndoKeys as r}from"../../chunk-CY52PUMZ.js";import{SlotChildActionsProvider as t}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as s}from"../../chunk-TZIIRGVY.js";import{usePartBridge as i}from"../../chunk-CMXK3JT3.js";import{useSectionOps as c}from"../../chunk-TR4APEJZ.js";import"../../chunk-HQ4VVRIC.js";import{MediaSidePanel as p}from"../../chunk-44QA42OJ.js";import{SELECTION_MODE as l,useScreenPinned as m,useScreenCanvasFrame as d,useScreenInspectorPanel as a,useScreenPickFollowsSelection as u,sameInspectorMode as h,useStandaloneScreenBridges as k,useScreenBlockLook as f,useScreenBlockRules as j}from"../../chunk-CSGTPJTY.js";import{useScreenDocument as S}from"../../chunk-FBS75I6E.js";import"../../chunk-ERR437B5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import{useMediaPanel as y,usePanelPick as N,useCancelPanelPick as C}from"../../chunk-R6WTQWAC.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import{useHostEscape as P}from"../../chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as R}from"../../chunk-VVPZMWJE.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-IQ5TA7AM.js";import{slotChildRowName as A}from"../../chunk-TBF5CVPA.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-IYT6NN2J.js";import{slotFieldsOf as x,nestsInTree as M}from"../../chunk-PLVEGYK6.js";import{useEasel as v}from"../../chunk-LPM2SCM4.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-SO5OLDH7.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-XWFH2NHZ.js";import{LayersTree as V,Subtree as E,TreeRow as H,TreeRowAction as g,TreeSeam as B}from"../../chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as w}from"../../chunk-K56YDHYQ.js";import"../../chunk-EA2HTX37.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-NDRZP6YR.js";import{DEFAULT_SAVE_WORDS as z,saveIndicator as O}from"../../chunk-H6DDIBQ4.js";import{SaveState as b,panelWidthVars as D}from"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-NY7HHUGB.js";import"../../chunk-B4JN227A.js";import"../../chunk-2XMHLXMA.js";import"../../chunk-G3GWAP5R.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-36LVP5WD.js";import{useWords as F}from"../../chunk-MFIRYGHW.js";import"../../chunk-QFVRMARS.js";import"../../chunk-AYWN5NRH.js";import{useTreeDrag as J}from"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-ILXP5VX5.js";import{zoneKey as T,parseZoneKey as W}from"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import{useState as Y,useRef as L,useEffect as X,useCallback as Z,Fragment as I}from"react";import{Tooltip as G}from"efficient-shell/ui";import{TrashIcon as K}from"efficient-shell/icons/efficient";import{jsxs as $,jsx as Q,Fragment as U}from"react/jsx-runtime";var q=e=>n=>{n.target.closest("button, input")||e()},_={rowClick:q};function ee(){const{saveState:ee,readOnly:ne,readOnlyReason:oe=null}=S(),re=c(),{appState:te,selectedItem:se,config:ie}=v(e=>e),[ce,pe]=Y(l),le=F("screen",R),me=F("tree",w),de=F("save",z),{first:ae,last:ue,panelOf:he}=m(),ke=he(ae),fe=d(),je=a(),Se=te.data.content?.[0]??null,ye=Se?.props.id??null,Ne=Se?.type===ae,Ce=Se?.type===ue,Pe=L(null),Re=L(null);r(Re);const Ae=y(),xe=N(),Me=C();u(se?.props.id),X(()=>{const e=Re.current;if(!xe||!e)return;const n=e=>{"Escape"===e.key&&Me()};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[xe]),P(null!==xe,()=>Me()),X(()=>{ye&&Pe.current!==ye&&(Pe.current=ye,Ne?pe(ke??l):se||re.select({index:0}))},[ye,se,re,Ne]);const ve=Z(e=>pe(n=>h(n,e)?n:e),[]),Ve=k({kind:ce.kind,mode:ce,open:ve,show:e=>pe(e),reveal:()=>{},select:(e,n)=>{pe(e=>h(e,n)?e:n),re.select(e)}}),{selectNode:Ee}=i({mode:ce,setMode:pe,onOpenPart:n}),He=f(),{labelAtLevel:ge,Icon:Be}=He,{canAddTo:we}=j(),ze=e=>ge(e,"block",ie.components[e]?.label??e),Oe=e=>ge(e,"section",ze(e)),be=!Ne&&"puck"===ce.kind&&se?.props.id===ye,De=Se?we(Se.type)?.spec??null:null,Fe=Se&&De?`${Se.props.id}:${De.slot}`:null,Je=Se&&De&&Array.isArray(Se.props[De.slot])?Se.props[De.slot]:[],Te=e=>A(e,ze,He.plainText),We=(e,r)=>{Se&&De&&Fe&&(pe(l),De.slider?(o(String(Se.props.id),e),re.select({index:e,zone:Fe}),n(String(Se.props.id))):(re.select({index:e,zone:Fe}),n(r)))},Ye=()=>{if(!Se||!De||!Fe)return;const e=Je.length;re.insertComponent(Fe,De.childType,e),pe(l),De.slider?requestAnimationFrame(()=>{o(String(Se.props.id),e),re.select({index:e,zone:Fe})}):re.select({index:e,zone:Fe})},Le=e=>x(ie,e),Xe=e=>{const{parentId:n,slot:o}=W(e),r=e=>{if(!e)return null;if(String(e.props.id)===n)return e;for(const n of Le(e.type)){const o=Array.isArray(e.props[n])?e.props[n]:[];for(const e of o){const n=r(e);if(n)return n}}return null},t=r(Se)?.props[o];return Array.isArray(t)?t.length:0},Ze=(e,n,o)=>{const r=Math.min(Math.max(o,0),Xe(e)),t=n<r?r-1:r;t!==n&&(re.reorderComponent(e,n,t),pe(l),re.select({index:t,zone:e}))},Ie=J({keyOf:e=>e.id,readOnly:Boolean(ne),canDrop:(e,n)=>T(n)===e.zone&&n.index>=0&&n.index<=Xe(e.zone),onDrop:(e,n)=>Ze(e.zone,e.index,n.index),onStep:(e,n)=>Ze(e.zone,e.index,n<0?e.index-1:e.index+2)}),Ge=(e,n)=>/* @__PURE__ */Q(B,{...ne?{}:Ie.seam({place:{...W(e),index:n}})},`seam:${e}:${n}`),Ke=e=>He.blockRowName(e,ze),$e=(e,o,r)=>{pe(l),re.select({index:o,zone:e}),n(r)},Qe=(e,n,o)=>{re.insertComponent(e,n,o),pe(l),re.select({index:o,zone:e})},Ue=(n,o,r)=>/* @__PURE__ */Q(e,{choices:r,onPick:e=>Qe(n,e,o)}),qe=(e,n)=>{const o=Le((r=e).type).flatMap(e=>(Array.isArray(r.props[e])?r.props[e]:[]).map((n,o)=>({child:n,zone:`${r.props.id}:${e}`,index:o})));var r;const t=we(e.type),s=t?.choices??null,i="footer"===t?.source?Ke:Te;/* @__PURE__ */
2
- return $(U,{children:[o.map(({child:e,zone:o,index:r})=>{const t=se?.props.id===e.props.id,s=M(ie,e.type,n),c=i(e),p=String(e.props.id),m=()=>$e(o,r,p),{rowProps:d,...a}=Ie.row({item:{id:p,zone:o,index:r},place:{...W(o),index:r}},{onClick:q(m)});/* @__PURE__ */
1
+ import{AddBlockRow as e}from"../../chunk-F3A7SXSV.js";import{scrollPreviewToSection as n,gotoPreviewSlide as o}from"../../chunk-3Z2MVLCD.js";import{useEaselUndoKeys as r}from"../../chunk-CY52PUMZ.js";import{SlotChildActionsProvider as t}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as s}from"../../chunk-TZIIRGVY.js";import{usePartBridge as i}from"../../chunk-CMXK3JT3.js";import{useSectionOps as c}from"../../chunk-TR4APEJZ.js";import"../../chunk-HQ4VVRIC.js";import{MediaSidePanel as p}from"../../chunk-44QA42OJ.js";import{SELECTION_MODE as l,useScreenPinned as m,useScreenCanvasFrame as d,useScreenInspectorPanel as a,useScreenPickFollowsSelection as u,sameInspectorMode as h,useStandaloneScreenBridges as k,useScreenBlockLook as f,useScreenBlockRules as j}from"../../chunk-CSGTPJTY.js";import{useScreenDocument as S}from"../../chunk-ZZ64CEC2.js";import"../../chunk-ERR437B5.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-S4AWJX4Q.js";import"../../chunk-KG7RJWOK.js";import"../../chunk-VPFNZ7TB.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import{useMediaPanel as y,usePanelPick as N,useCancelPanelPick as C}from"../../chunk-R6WTQWAC.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import{useHostEscape as P}from"../../chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as R}from"../../chunk-VVPZMWJE.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-IQ5TA7AM.js";import{slotChildRowName as A}from"../../chunk-TBF5CVPA.js";import"../../chunk-DUVRZ456.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-IYT6NN2J.js";import{slotFieldsOf as x,nestsInTree as M}from"../../chunk-PLVEGYK6.js";import{useEasel as v}from"../../chunk-LPM2SCM4.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-SO5OLDH7.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-XWFH2NHZ.js";import{LayersTree as V,Subtree as E,TreeRow as H,TreeRowAction as g,TreeSeam as w}from"../../chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as z}from"../../chunk-K56YDHYQ.js";import"../../chunk-EA2HTX37.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-NDRZP6YR.js";import{DEFAULT_SAVE_WORDS as B,saveIndicator as O}from"../../chunk-H6DDIBQ4.js";import{SaveState as b,panelWidthVars as D}from"../../chunk-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-NY7HHUGB.js";import"../../chunk-B4JN227A.js";import"../../chunk-2XMHLXMA.js";import"../../chunk-G3GWAP5R.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-36LVP5WD.js";import{useWords as J}from"../../chunk-MFIRYGHW.js";import"../../chunk-QFVRMARS.js";import"../../chunk-AYWN5NRH.js";import{useTreeDrag as T}from"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-ILXP5VX5.js";import{zoneKey as W,parseZoneKey as Y}from"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import{useState as Z,useRef as F,useEffect as L,useCallback as X,Fragment as I}from"react";import{Tooltip as G}from"efficient-shell/ui";import{TrashIcon as K}from"efficient-shell/icons/efficient";import{jsxs as $,jsx as Q,Fragment as U}from"react/jsx-runtime";var q=e=>n=>{n.target.closest("button, input")||e()},_={rowClick:q};function ee(){const{saveState:ee,readOnly:ne,readOnlyReason:oe=null}=S(),re=c(),{appState:te,selectedItem:se,config:ie}=v(e=>e),[ce,pe]=Z(l),le=J("screen",R),me=J("tree",z),de=J("save",B),{first:ae,last:ue,panelOf:he}=m(),ke=he(ae),fe=d(),je=a(),Se=te.data.content?.[0]??null,ye=Se?.props.id??null,Ne=Se?.type===ae,Ce=Se?.type===ue,Pe=F(null),Re=F(null);r(Re);const Ae=y(),xe=N(),Me=C();u(se?.props.id),L(()=>{const e=Re.current;if(!xe||!e)return;const n=e=>{"Escape"===e.key&&Me()};return e.addEventListener("keydown",n),()=>e.removeEventListener("keydown",n)},[xe]),P(null!==xe,()=>Me()),L(()=>{ye&&Pe.current!==ye&&(Pe.current=ye,Ne?pe(ke??l):se||re.select({index:0}))},[ye,se,re,Ne]);const ve=X(e=>pe(n=>h(n,e)?n:e),[]),Ve=k({kind:ce.kind,mode:ce,open:ve,show:e=>pe(e),reveal:()=>{},select:(e,n)=>{pe(e=>h(e,n)?e:n),re.select(e)}}),{selectNode:Ee}=i({mode:ce,setMode:pe,onOpenPart:n}),He=f(),{labelAtLevel:ge,Icon:we}=He,{canAddTo:ze}=j(),Be=e=>ge(e,"block",ie.components[e]?.label??e),Oe=e=>ge(e,"section",Be(e)),be=!Ne&&"puck"===ce.kind&&se?.props.id===ye,De=Se?ze(Se.type)?.spec??null:null,Je=Se&&De?`${Se.props.id}:${De.slot}`:null,Te=Se&&De&&Array.isArray(Se.props[De.slot])?Se.props[De.slot]:[],We=e=>A(e,Be,He.plainText),Ye=(e,r)=>{Se&&De&&Je&&(pe(l),De.slider?(o(String(Se.props.id),e),re.select({index:e,zone:Je}),n(String(Se.props.id))):(re.select({index:e,zone:Je}),n(r)))},Ze=()=>{if(!Se||!De||!Je)return;const e=Te.length;re.insertComponent(Je,De.childType,e),pe(l),De.slider?requestAnimationFrame(()=>{o(String(Se.props.id),e),re.select({index:e,zone:Je})}):re.select({index:e,zone:Je})},Fe=e=>x(ie,e),Le=e=>{const{parentId:n,slot:o}=Y(e),r=e=>{if(!e)return null;if(String(e.props.id)===n)return e;for(const n of Fe(e.type)){const o=Array.isArray(e.props[n])?e.props[n]:[];for(const e of o){const n=r(e);if(n)return n}}return null},t=r(Se)?.props[o];return Array.isArray(t)?t.length:0},Xe=(e,n,o)=>{const r=Math.min(Math.max(o,0),Le(e)),t=n<r?r-1:r;t!==n&&(re.reorderComponent(e,n,t),pe(l),re.select({index:t,zone:e}))},Ie=T({keyOf:e=>e.id,readOnly:Boolean(ne),canDrop:(e,n)=>W(n)===e.zone&&n.index>=0&&n.index<=Le(e.zone),onDrop:(e,n)=>Xe(e.zone,e.index,n.index),onStep:(e,n)=>Xe(e.zone,e.index,n<0?e.index-1:e.index+2)}),Ge=(e,n)=>/* @__PURE__ */Q(w,{...ne?{}:Ie.seam({place:{...Y(e),index:n}})},`seam:${e}:${n}`),Ke=e=>He.blockRowName(e,Be),$e=(e,o,r)=>{pe(l),re.select({index:o,zone:e}),n(r)},Qe=(e,n,o)=>{re.insertComponent(e,n,o),pe(l),re.select({index:o,zone:e})},Ue=(n,o,r)=>/* @__PURE__ */Q(e,{choices:r,onPick:e=>Qe(n,e,o)}),qe=(e,n)=>{const o=Fe((r=e).type).flatMap(e=>(Array.isArray(r.props[e])?r.props[e]:[]).map((n,o)=>({child:n,zone:`${r.props.id}:${e}`,index:o})));var r;const t=ze(e.type),s=t?.choices??null,i="footer"===t?.source?Ke:We;/* @__PURE__ */
2
+ return $(U,{children:[o.map(({child:e,zone:o,index:r})=>{const t=se?.props.id===e.props.id,s=M(ie,e.type,n),c=i(e),p=String(e.props.id),m=()=>$e(o,r,p),{rowProps:d,...a}=Ie.row({item:{id:p,zone:o,index:r},place:{...Y(o),index:r}},{onClick:q(m)});/* @__PURE__ */
3
3
  return $(I,{children:[0===r&&Ge(o,0),
4
- /* @__PURE__ */Q(H,{words:me,icon:/* @__PURE__ */Q(Be,{type:e.type,size:13}),name:c,selected:t,onSelect:m,...a,actions:/* @__PURE__ */Q(g,{kind:"delete",label:le.deleteNamed({name:c}),onClick:()=>{return e=o,n=r,re.removeComponent(e,n),pe(l),void re.select(null);var e,n},children:/* @__PURE__ */Q(K,{size:13})}),rowProps:d}),s&&/* @__PURE__ */Q(E,{children:qe(e,n+1)}),Ge(o,r+1)]},String(e.props.id??`${o}-${r}`))}),t&&s?Ue(`${e.props.id}:${t.slot}`,o.length,s):null]})},_e="HeroSingle"===Se?.type,en=Boolean(Se)&&(Boolean(we(Se.type))||Le(Se.type).length>0),nn=Boolean(Se)&&(Boolean(De)||Ce||Ne||_e||en);/* @__PURE__ */
4
+ /* @__PURE__ */Q(H,{words:me,icon:/* @__PURE__ */Q(we,{type:e.type,size:13}),name:c,selected:t,onSelect:m,...a,actions:/* @__PURE__ */Q(g,{kind:"delete",label:le.deleteNamed({name:c}),onClick:()=>{return e=o,n=r,re.removeComponent(e,n),pe(l),void re.select(null);var e,n},children:/* @__PURE__ */Q(K,{size:13})}),rowProps:d}),s&&/* @__PURE__ */Q(E,{children:qe(e,n+1)}),Ge(o,r+1)]},String(e.props.id??`${o}-${r}`))}),t&&s?Ue(`${e.props.id}:${t.slot}`,o.length,s):null]})},_e="HeroSingle"===Se?.type,en=Boolean(Se)&&(Boolean(ze(Se.type))||Fe(Se.type).length>0),nn=Boolean(Se)&&(Boolean(De)||Ce||Ne||_e||en);/* @__PURE__ */
5
5
  return $("div",{ref:Re,className:"sf-editor es-editor",style:D(s),children:[
6
6
  /* @__PURE__ */Q("div",{className:"sf-section-bar",children:/* @__PURE__ */Q(b,null!==oe?{tone:"off",label:oe,role:"status"}:{...O(ee,de),role:"status"})}),
7
7
  /* @__PURE__ */$("div",{className:"sf-body",children:[xe&&Ae?/* @__PURE__ */Q("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:/* @__PURE__ */Q(p,{panel:Ae,pick:xe})}):nn&&Se&&/* @__PURE__ */$("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:[
8
8
  /* @__PURE__ */Q("div",{className:"sf-panel-head",children:/* @__PURE__ */Q(G,{content:Ne?le.headerSettings:le.sectionSettings({name:Oe(Se.type)}),side:"bottom",children:/* @__PURE__ */Q("button",{type:"button",className:"sf-panel-title sf-panel-title--btn "+(be?"is-selected":""),"aria-pressed":be,onClick:()=>{Ne?pe(ke??l):(pe(l),re.select({index:0}))},children:Oe(Se.type)})})}),
9
9
  /* @__PURE__ */Q(V,{className:"sf-tree sf-scroll",rootProps:Ie.rootProps(),words:me,children:/* @__PURE__ */Q(E,{children:Ne?
10
- /* @__PURE__ */Q(H,{words:me,icon:/* @__PURE__ */Q(Be,{type:"header",size:13}),name:le.headerSettings,selected:ce.kind===ke?.kind,onSelect:()=>pe(ke??l),rowProps:{onClick:q(()=>pe(ke??l))}}):De?/* @__PURE__ */$(U,{children:[Je.map((e,n)=>{const o=se?.props.id===e.props.id,r=Te(e),t=String(e.props.id),s=()=>We(n,t),{rowProps:i,...c}=Ie.row({item:{id:t,zone:Fe,index:n},place:{...W(Fe),index:n}},{onClick:q(s)});/* @__PURE__ */
11
- return $(I,{children:[0===n&&Ge(Fe,0),
12
- /* @__PURE__ */Q(H,{words:me,icon:/* @__PURE__ */Q(Be,{type:e.type,size:13}),name:r,selected:o,onSelect:s,...c,actions:/* @__PURE__ */Q(g,{kind:"delete",label:le.deleteNamed({name:r}),onClick:()=>{return e=n,void(Fe&&(re.removeComponent(Fe,e),pe(l),re.select(null)));var e},children:/* @__PURE__ */Q(K,{size:13})}),rowProps:i}),Ge(Fe,n+1)]},String(e.props.id??n))}),
13
- /* @__PURE__ */$("button",{type:"button",className:"sf-add-card",onClick:Ye,children:[
10
+ /* @__PURE__ */Q(H,{words:me,icon:/* @__PURE__ */Q(we,{type:"header",size:13}),name:le.headerSettings,selected:ce.kind===ke?.kind,onSelect:()=>pe(ke??l),rowProps:{onClick:q(()=>pe(ke??l))}}):De?/* @__PURE__ */$(U,{children:[Te.map((e,n)=>{const o=se?.props.id===e.props.id,r=We(e),t=String(e.props.id),s=()=>Ye(n,t),{rowProps:i,...c}=Ie.row({item:{id:t,zone:Je,index:n},place:{...Y(Je),index:n}},{onClick:q(s)});/* @__PURE__ */
11
+ return $(I,{children:[0===n&&Ge(Je,0),
12
+ /* @__PURE__ */Q(H,{words:me,icon:/* @__PURE__ */Q(we,{type:e.type,size:13}),name:r,selected:o,onSelect:s,...c,actions:/* @__PURE__ */Q(g,{kind:"delete",label:le.deleteNamed({name:r}),onClick:()=>{return e=n,void(Je&&(re.removeComponent(Je,e),pe(l),re.select(null)));var e},children:/* @__PURE__ */Q(K,{size:13})}),rowProps:i}),Ge(Je,n+1)]},String(e.props.id??n))}),
13
+ /* @__PURE__ */$("button",{type:"button",className:"sf-add-card",onClick:Ze,children:[
14
14
  /* @__PURE__ */Q("span",{className:"sf-plus sf-plus--sm",children:"+"}),De.addLabel]}),ye?Ve.partRows?.(Se,_):null]}):qe(Se,1)})})]}),
15
15
  /* @__PURE__ */Q("div",{className:"sf-center",children:/* @__PURE__ */Q("div",{className:"sf-preview-host",children:/* @__PURE__ */Q(fe,{})})}),
16
- /* @__PURE__ */Q(t,{value:{selectChild:(e,n,o,r)=>"section"===we(r)?.source?We(n,o):$e(e,n,o),addChild:(e,n,o,r,t)=>"section"===we(t)?.source?Ye():Qe(`${e}:${n}`,o,r),childRowName:Te,blockRowName:Ke},children:/* @__PURE__ */Q(je,{mode:ce,onOpenWebsiteSettings:Ve.openSettings??(()=>{}),onSelectNode:Ee,hideNodeActions:!0})})]})]})}export{ee as default};
16
+ /* @__PURE__ */Q(t,{value:{selectChild:(e,n,o,r)=>"section"===ze(r)?.source?Ye(n,o):$e(e,n,o),addChild:(e,n,o,r,t)=>"section"===ze(t)?.source?Ze():Qe(`${e}:${n}`,o,r),childRowName:We,blockRowName:Ke},children:/* @__PURE__ */Q(je,{mode:ce,onOpenWebsiteSettings:Ve.openSettings??(()=>{}),onSelectNode:Ee,hideNodeActions:!0})})]})]})}export{ee as default};
@@ -25,7 +25,7 @@ import './AddSidePanel.js';
25
25
  import '../lib/section-template-types.js';
26
26
  import '../lib/puck/content-tree.js';
27
27
  import '../lib/puck/block-choice.js';
28
- import '../../host-GOlVK3LX.js';
28
+ import '../../host-DGmdCaNL.js';
29
29
  import '../lib/document-contract.js';
30
30
  import '../lib/session.js';
31
31
  import '../lib/backend-error.js';
@@ -3,7 +3,7 @@ export { default as ScreenStoreProvider } from './components/ScreenStoreProvider
3
3
  export { NodeDefaults, SELECTION_MODE, ScreenBlockLook, ScreenBlockRules, ScreenBridges, ScreenCanvas, ScreenCanvasDrag, ScreenCanvasDragContext, ScreenCanvasHeadProps, ScreenCanvasTargetProvider, ScreenDevices, ScreenDocumentOps, ScreenDragItem, ScreenInspector, ScreenInspectorMode, ScreenInspectorPanelProps, ScreenLeftPanel, ScreenLeftView, ScreenLeftViewFrame, ScreenLeftViewRules, ScreenMainAction, ScreenMenuRows, ScreenNewNode, ScreenNode, ScreenNodeActions, ScreenNodeLevel, ScreenNodeMaker, ScreenPartMode, ScreenParts, ScreenPartsProvider, ScreenPinnedBand, ScreenPinnedNodes, ScreenRailItem, ScreenSelector, ScreenSlot, ScreenSlotAction, ScreenSlotMode, ScreenStyleClipboard, ScreenStyleDocument, ScreenStylePastePlan, ScreenToastExtra, ScreenTree, ScreenTreeFolds, ScreenTreeRows, isPinnedFirst, isPinnedLast, isSlotMode, sameInspectorMode, screenSlotsOf, useScreenBlockLook, useScreenBlockRules, useScreenBridges, useScreenCanvasDrag, useScreenCanvasFrame, useScreenCanvasHead, useScreenCanvasTarget, useScreenDevices, useScreenDocumentLabel, useScreenDocumentPass, useScreenInspectorPanel, useScreenLeftView, useScreenNodeKeys, useScreenNotify, useScreenOwnerName, useScreenParts, useScreenPickFollowsSelection, useScreenPinned, useScreenSaveSwitch, useScreenStorageNamespace, useScreenStyleClipboard, useStandaloneScreenBridges } from './lib/screen-parts.js';
4
4
  export { DefaultBackend, EFFICIENT_BACKEND, EaselSession, SessionBackend, SessionBlocks, activateEaselSession, backendOf, createEaselSession, currentEaselSession, deactivateEaselSession, efficientClientOpen, isEfficientBackend, provideDefaultBackend, resetAmbientEaselSession, sessionRegistry, setSessionBridgedSite, setSessionDocumentSite } from './lib/session.js';
5
5
  export { EaselSessionProvider, useEaselSession } from './lib/session-context.js';
6
- export { A as AnyDocumentAddressing, D as DETACHED_EASEL_HOST, a as DocumentAddressing, E as EaselHost, b as EaselHostAddress, c as EaselHostContext, d as EaselHostProvider, e as EaselMessageType, f as EaselToHostMessage, H as HostPickedMedia, g as HostToEaselMessage, I as InboundHostMessage, N as NO_DOCUMENT_ADDRESSING, S as SectionScreenTarget, h as SendToHost, i as createEaselHost, u as useEaselHost, j as useHostEscape } from '../host-GOlVK3LX.js';
6
+ export { A as AnyDocumentAddressing, D as DETACHED_EASEL_HOST, a as DocumentAddressing, E as EaselHost, b as EaselHostAddress, c as EaselHostContext, d as EaselHostProvider, e as EaselMessageType, f as EaselToHostMessage, H as HostPickedMedia, g as HostToEaselMessage, I as InboundHostMessage, N as NO_DOCUMENT_ADDRESSING, S as SectionScreenTarget, h as SendToHost, i as createEaselHost, u as useEaselHost, j as useHostEscape } from '../host-DGmdCaNL.js';
7
7
  export { EaselCapabilities, EaselDocument, EaselDocumentAdapter, EaselPageRow, SiteRecord, SiteRecordPatch, WebsiteEditLock } from './lib/document-contract.js';
8
8
  import 'react';
9
9
  import '../blocks/index.js';
@@ -1 +1 @@
1
- import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-3DCI44F3.js";import"../chunk-GXQCZJOP.js";import"../chunk-F6NO7B57.js";import"../chunk-XT6DOSHO.js";import"../chunk-FGNR22NY.js";import"../chunk-2GVCAIPX.js";import"../chunk-26OOWIJJ.js";import"../chunk-NBDMTIU2.js";import"../chunk-MQNBD6AB.js";import"../chunk-LER7RKTO.js";import"../chunk-7F52SZOI.js";import"../chunk-RSKHAHPJ.js";import"../chunk-RKTF5XLP.js";export{ScreenStoreProvider}from"../chunk-YKJ3RIMT.js";import"../chunk-3Z2MVLCD.js";import"../chunk-CY52PUMZ.js";import"../chunk-KCBEE2MC.js";import"../chunk-TZIIRGVY.js";import"../chunk-CMXK3JT3.js";import"../chunk-TR4APEJZ.js";import"../chunk-5545A3PC.js";import"../chunk-D46OYLJR.js";import"../chunk-PA3PNTVV.js";import"../chunk-BVN33R76.js";import"../chunk-5ZBY24K7.js";import"../chunk-62VPYC7F.js";import"../chunk-HQ4VVRIC.js";import"../chunk-44QA42OJ.js";export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-CSGTPJTY.js";import"../chunk-NW4LJ4G4.js";import"../chunk-IWFVVCRN.js";import"../chunk-FBS75I6E.js";import"../chunk-ERR437B5.js";import"../chunk-GMCZXMOV.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-CLOS6SSX.js";import"../chunk-S4AWJX4Q.js";import"../chunk-KG7RJWOK.js";import"../chunk-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";import"../chunk-KCOBHPN6.js";import"../chunk-R6WTQWAC.js";export{EaselSessionProvider,useEaselSession}from"../chunk-O7Q4DDJT.js";export{EFFICIENT_BACKEND,activateEaselSession,backendOf,createEaselSession,currentEaselSession,deactivateEaselSession,efficientClientOpen,isEfficientBackend,provideDefaultBackend,resetAmbientEaselSession,sessionRegistry,setSessionBridgedSite,setSessionDocumentSite}from"../chunk-RSCMJIWS.js";export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost,useHostEscape}from"../chunk-U3JP4VGF.js";import"../chunk-UMDQ6CLQ.js";import"../chunk-VVPZMWJE.js";import"../chunk-V7U33NF2.js";import"../chunk-6WY6ZXJG.js";import"../chunk-BXMXTO36.js";import"../chunk-OSPUG6S6.js";import"../chunk-WK3AFPXY.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-BSPCSC45.js";import"../chunk-IQ5TA7AM.js";import"../chunk-TBF5CVPA.js";import"../chunk-DUVRZ456.js";import"../chunk-6W7WLPZH.js";import"../chunk-IYT6NN2J.js";import"../chunk-PLVEGYK6.js";import"../chunk-LPM2SCM4.js";import"../chunk-TBY3DFKS.js";import"../chunk-ECM5F6JJ.js";import"../chunk-SO5OLDH7.js";import"../chunk-BPXEFVSQ.js";import"../chunk-XWFH2NHZ.js";import"../chunk-4JSBIW5H.js";import"../chunk-K56YDHYQ.js";import"../chunk-EA2HTX37.js";import"../chunk-RC25EGHD.js";import"../chunk-KFV7N2DJ.js";import"../chunk-YRLPFZW3.js";import"../chunk-4VJATVVR.js";import"../chunk-NDRZP6YR.js";import"../chunk-H6DDIBQ4.js";import"../chunk-IE55HNMA.js";import"../chunk-Z6PVRXVY.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-NY7HHUGB.js";import"../chunk-B4JN227A.js";import"../chunk-2XMHLXMA.js";import"../chunk-G3GWAP5R.js";import"../chunk-WRFD4EXD.js";import"../chunk-36LVP5WD.js";import"../chunk-MFIRYGHW.js";import"../chunk-QFVRMARS.js";import"../chunk-AYWN5NRH.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-ILXP5VX5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-35VMTYPH.js";import"../chunk-GXQCZJOP.js";import"../chunk-XUAKHY4T.js";import"../chunk-XT6DOSHO.js";import"../chunk-FGNR22NY.js";import"../chunk-2GVCAIPX.js";import"../chunk-26OOWIJJ.js";import"../chunk-NBDMTIU2.js";import"../chunk-MQNBD6AB.js";import"../chunk-LER7RKTO.js";import"../chunk-7F52SZOI.js";import"../chunk-RSKHAHPJ.js";import"../chunk-RKTF5XLP.js";export{ScreenStoreProvider}from"../chunk-YKJ3RIMT.js";import"../chunk-3Z2MVLCD.js";import"../chunk-CY52PUMZ.js";import"../chunk-KCBEE2MC.js";import"../chunk-TZIIRGVY.js";import"../chunk-CMXK3JT3.js";import"../chunk-TR4APEJZ.js";import"../chunk-5545A3PC.js";import"../chunk-D46OYLJR.js";import"../chunk-PA3PNTVV.js";import"../chunk-BVN33R76.js";import"../chunk-5ZBY24K7.js";import"../chunk-62VPYC7F.js";import"../chunk-HQ4VVRIC.js";import"../chunk-44QA42OJ.js";export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-CSGTPJTY.js";import"../chunk-NW4LJ4G4.js";import"../chunk-2H3W5OLQ.js";import"../chunk-ZZ64CEC2.js";import"../chunk-ERR437B5.js";import"../chunk-GMCZXMOV.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-CLOS6SSX.js";import"../chunk-S4AWJX4Q.js";import"../chunk-KG7RJWOK.js";import"../chunk-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";import"../chunk-KCOBHPN6.js";import"../chunk-R6WTQWAC.js";export{EaselSessionProvider,useEaselSession}from"../chunk-O7Q4DDJT.js";export{EFFICIENT_BACKEND,activateEaselSession,backendOf,createEaselSession,currentEaselSession,deactivateEaselSession,efficientClientOpen,isEfficientBackend,provideDefaultBackend,resetAmbientEaselSession,sessionRegistry,setSessionBridgedSite,setSessionDocumentSite}from"../chunk-RSCMJIWS.js";export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost,useHostEscape}from"../chunk-U3JP4VGF.js";import"../chunk-UMDQ6CLQ.js";import"../chunk-VVPZMWJE.js";import"../chunk-V7U33NF2.js";import"../chunk-6WY6ZXJG.js";import"../chunk-BXMXTO36.js";import"../chunk-OSPUG6S6.js";import"../chunk-WK3AFPXY.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-BSPCSC45.js";import"../chunk-IQ5TA7AM.js";import"../chunk-TBF5CVPA.js";import"../chunk-DUVRZ456.js";import"../chunk-6W7WLPZH.js";import"../chunk-IYT6NN2J.js";import"../chunk-PLVEGYK6.js";import"../chunk-LPM2SCM4.js";import"../chunk-TBY3DFKS.js";import"../chunk-ECM5F6JJ.js";import"../chunk-SO5OLDH7.js";import"../chunk-BPXEFVSQ.js";import"../chunk-XWFH2NHZ.js";import"../chunk-4JSBIW5H.js";import"../chunk-K56YDHYQ.js";import"../chunk-EA2HTX37.js";import"../chunk-RC25EGHD.js";import"../chunk-KFV7N2DJ.js";import"../chunk-YRLPFZW3.js";import"../chunk-4VJATVVR.js";import"../chunk-NDRZP6YR.js";import"../chunk-H6DDIBQ4.js";import"../chunk-IE55HNMA.js";import"../chunk-Z6PVRXVY.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MJM6SFD3.js";import"../chunk-2OAZYSWJ.js";import"../chunk-NY7HHUGB.js";import"../chunk-B4JN227A.js";import"../chunk-2XMHLXMA.js";import"../chunk-G3GWAP5R.js";import"../chunk-WRFD4EXD.js";import"../chunk-36LVP5WD.js";import"../chunk-MFIRYGHW.js";import"../chunk-QFVRMARS.js";import"../chunk-AYWN5NRH.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-ILXP5VX5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -1,4 +1,4 @@
1
- export { A as AnyDocumentAddressing, a as DocumentAddressing, N as NO_DOCUMENT_ADDRESSING } from '../../host-GOlVK3LX.js';
1
+ export { A as AnyDocumentAddressing, a as DocumentAddressing, N as NO_DOCUMENT_ADDRESSING } from '../../host-DGmdCaNL.js';
2
2
  import './document-contract.js';
3
3
  import './session.js';
4
4
  import 'react';
@@ -1,5 +1,5 @@
1
1
  import 'react';
2
- export { D as DETACHED_EASEL_HOST, E as EaselHost, b as EaselHostAddress, c as EaselHostContext, d as EaselHostProvider, e as EaselMessageType, f as EaselToHostMessage, H as HostPickedMedia, g as HostToEaselMessage, I as InboundHostMessage, S as SectionScreenTarget, h as SendToHost, i as createEaselHost, u as useEaselHost, j as useHostEscape } from '../../host-GOlVK3LX.js';
2
+ export { D as DETACHED_EASEL_HOST, E as EaselHost, b as EaselHostAddress, c as EaselHostContext, d as EaselHostProvider, e as EaselMessageType, f as EaselToHostMessage, H as HostPickedMedia, g as HostToEaselMessage, I as InboundHostMessage, S as SectionScreenTarget, h as SendToHost, i as createEaselHost, u as useEaselHost, j as useHostEscape } from '../../host-DGmdCaNL.js';
3
3
  import '../../blocks/index.js';
4
4
  import '../../types-NQozKWEz.js';
5
5
  import '../../data/index.js';
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ComponentType, ReactNode } from 'react';
3
- import { H as HostPickedMedia, E as EaselHost } from '../../host-GOlVK3LX.js';
3
+ import { H as HostPickedMedia, E as EaselHost } from '../../host-DGmdCaNL.js';
4
4
  import '../../blocks/index.js';
5
5
  import '../../types-NQozKWEz.js';
6
6
  import '../../data/index.js';
@@ -1,4 +1,4 @@
1
- import { E as EaselHost } from '../../host-GOlVK3LX.js';
1
+ import { E as EaselHost } from '../../host-DGmdCaNL.js';
2
2
  import 'react';
3
3
  import '../../blocks/index.js';
4
4
  import '../../types-NQozKWEz.js';
@@ -26,7 +26,7 @@ import '../../components/AddSidePanel.js';
26
26
  import '../section-template-types.js';
27
27
  import './content-tree.js';
28
28
  import './block-choice.js';
29
- import '../../../host-GOlVK3LX.js';
29
+ import '../../../host-DGmdCaNL.js';
30
30
  import '../document-contract.js';
31
31
  import '../session.js';
32
32
  import '../backend-error.js';
@@ -10,7 +10,7 @@ import { a as EaselRailItem } from '../../types-CsgMwHHa.js';
10
10
  import { StyleRow } from '../../style-clipboard/index.js';
11
11
  import { T as TreeRowMark } from '../../types-D8P9q-BG.js';
12
12
  import { AddKey } from '../components/AddSidePanel.js';
13
- import { k as AnyScreenTarget } from '../../host-GOlVK3LX.js';
13
+ import { k as AnyScreenTarget } from '../../host-DGmdCaNL.js';
14
14
  import { HostProduct } from './host-chrome.js';
15
15
  import { EaselSession } from './session.js';
16
16
  import { AddTarget } from './puck/add-target-types.js';
@@ -292,7 +292,7 @@
292
292
  display: flex;
293
293
  align-items: center;
294
294
  justify-content: space-between;
295
- padding: var(--space-16, 16px) var(--space-16, 16px) var(--space-12, 12px);
295
+ padding: var(--space-16, 16px) var(--es-insp-pad-x) var(--space-12, 12px);
296
296
  flex: none;
297
297
  }
298
298
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "14.0.0",
3
+ "version": "14.2.0",
4
4
  "description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",