efficient-easel 15.0.0 → 16.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +5 -3
  2. package/dist/{chunk-GS44HQ45.js → chunk-63ZDVAVE.js} +1 -1
  3. package/dist/chunk-BALFHI3G.js +2 -0
  4. package/dist/{chunk-Z62Z75UI.js → chunk-GGC72GS4.js} +1 -1
  5. package/dist/{chunk-5EPK5WB3.js → chunk-JD5HXBEX.js} +1 -1
  6. package/dist/{chunk-YQVR54RE.js → chunk-KFPCMMRK.js} +1 -1
  7. package/dist/chunk-N2B32EZB.js +5 -0
  8. package/dist/{chunk-OJ6QWOLG.js → chunk-N2BVA6TS.js} +1 -1
  9. package/dist/chunk-N3LYD2LK.js +21 -0
  10. package/dist/{chunk-GOABCALQ.js → chunk-OK7OH2ZN.js} +1 -1
  11. package/dist/{chunk-JASNL4KG.js → chunk-P3XVBLZ6.js} +4 -4
  12. package/dist/{chunk-EHBWUEEE.js → chunk-PQRYAW2G.js} +4 -4
  13. package/dist/chunk-RQBIFINA.js +57 -0
  14. package/dist/chunk-UVQR7W6I.js +1 -0
  15. package/dist/chunk-WXFZD7WC.js +1 -0
  16. package/dist/fields/index.js +1 -1
  17. package/dist/menu/index.d.ts +22 -27
  18. package/dist/menu/index.js +1 -1
  19. package/dist/menu/menu.css +7 -6
  20. package/dist/screen/components/AddBlockRow.js +1 -1
  21. package/dist/screen/components/AddSidePanel.js +1 -1
  22. package/dist/screen/components/MediaSidePanel.js +1 -1
  23. package/dist/screen/components/NodeContextMenu.js +1 -1
  24. package/dist/screen/components/ScreenChrome.js +1 -1
  25. package/dist/screen/components/ScreenMount.js +1 -1
  26. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  27. package/dist/screen/components/SectionScreenShell.js +16 -16
  28. package/dist/screen/components/usePartBridge.js +1 -1
  29. package/dist/screen/index.js +1 -1
  30. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  31. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  32. package/dist/screen/lib/screen-parts.js +1 -1
  33. package/dist/strings/catalogue.js +1 -1
  34. package/dist/strings/index.js +1 -1
  35. package/package.json +3 -3
  36. package/dist/chunk-BXMXTO36.js +0 -1
  37. package/dist/chunk-EA2HTX37.js +0 -5
  38. package/dist/chunk-FRXE6EQN.js +0 -5
  39. package/dist/chunk-QKZPPI5O.js +0 -57
  40. package/dist/chunk-SO5OLDH7.js +0 -21
  41. package/dist/chunk-VJZDNOQ7.js +0 -1
package/README.md CHANGED
@@ -1051,13 +1051,15 @@ runs the same rules (`--axe <axe.min.js>`).
1051
1051
  <EaselContextMenu x={e.clientX} y={e.clientY} owner={e.currentTarget} items={items} onClose={close} />
1052
1052
  ```
1053
1053
 
1054
- Or the shell's own pieces, with the editors' item list as the rows:
1054
+ Or the shell's own menu, with the editors' item list as its `items`
1055
+ (efficient-shell 8.18.0, #580: the shell draws every row with its one
1056
+ renderer; `EaselMenuItems` is gone since this change):
1055
1057
 
1056
1058
  ```tsx
1057
1059
  import { ContextMenu, useContextMenu } from 'efficient-shell/ui';
1058
- import { EaselMenuItems } from 'efficient-easel/menu';
1060
+ import { easelMenuEntries } from 'efficient-easel/menu';
1059
1061
 
1060
- {menu.state && <ContextMenu {...menu.props}><EaselMenuItems items={items} onClose={menu.close} /></ContextMenu>}
1062
+ {menu.state && <ContextMenu {...menu.props} items={easelMenuEntries(items)} />}
1061
1063
  ```
1062
1064
  - **A dropdown's open list has a name.** In a settings row
1063
1065
  (`InspectorField`) the list is `aria-labelledby` the row's own label. A
@@ -1,4 +1,4 @@
1
- import{useScreenOwnerName as e}from"./chunk-EHBWUEEE.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-IE55HNMA.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
1
+ import{useScreenOwnerName as e}from"./chunk-PQRYAW2G.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-IE55HNMA.js";import{jsxs as o,Fragment as r,jsx as t}from"react/jsx-runtime";function l({panel:l,pick:d,onHide:m}){const p=e();/* @__PURE__ */
2
2
  return o(r,{children:[
3
3
  /* @__PURE__ */t(i,{context:p,pick:d?{kind:c(d.accept),field:d.title||void 0}:null,onCancel:()=>d&&n(d.requestId,null),onHide:m}),
4
4
  /* @__PURE__ */t("div",{className:"sf-media-panel",children:/* @__PURE__ */t(l,{pick:d,onPick:e=>d&&n(d.requestId,e)})})]})}export{l as MediaSidePanel};
@@ -0,0 +1,2 @@
1
+ import{jsx as e,jsxs as n,Fragment as l}from"react/jsx-runtime";function r(e){return e.map((e,n)=>{const l=String(n);if("—"===e.label)return{type:"divider",key:l};if(e.header)return{type:"label",key:l,label:e.label};if(e.children?.length){const n=e.children.some(e=>void 0!==e.checked);return{type:"submenu",key:l,label:e.label,icon:i(e),items:e.children.map((e,l)=>n?{type:"radio",key:String(l),label:c(e),icon:i(e),checked:Boolean(e.checked),onSelect:e.onClick}:{type:"item",key:String(l),label:c(e),icon:i(e),danger:e.danger,onSelect:e.onClick})}}return{type:"item",key:l,label:c(e),icon:i(e),danger:e.danger,onSelect:e.onClick}})}function t(e){return e.find(e=>e.header)?.label}function i(n){return null==n.icon?void 0:/* @__PURE__ */e("span",{className:"es-menu-icon","aria-hidden":"true",children:n.icon})}function c(r){return null==r.icon&&null==r.shortcut?r.label:/* @__PURE__ */n(l,{children:[
2
+ /* @__PURE__ */e("span",{className:"es-menu-label",children:r.label}),null==r.shortcut?null:/* @__PURE__ */e("span",{className:"es-menu-shortcut","aria-hidden":"true",children:r.shortcut})]})}export{r as easelMenuEntries,t as menuLabel};
@@ -1 +1 @@
1
- import{useSectionOps as o}from"./chunk-OJ6QWOLG.js";import{SELECTION_MODE as e}from"./chunk-EHBWUEEE.js";import{usePreviewParts as r}from"./chunk-I54UCYOU.js";import{decodePartId as t,encodePartId as n}from"./chunk-IYT6NN2J.js";import{useEasel as p}from"./chunk-SMM3ST7A.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=p(o=>o),I=o(),{setSelectedPartId:f,setSelectHandler:k}=r(),l=d(o=>{const r=t(o);if(!r)return;const{nodeId:n,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{k(l)},[k,l]);const h=s(m)?n(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&I.select(r)},[i,u,I]),openPartId:h}}export{m as usePartBridge};
1
+ import{useSectionOps as o}from"./chunk-N2BVA6TS.js";import{SELECTION_MODE as e}from"./chunk-PQRYAW2G.js";import{usePreviewParts as r}from"./chunk-I54UCYOU.js";import{decodePartId as t,encodePartId as n}from"./chunk-IYT6NN2J.js";import{useEasel as p}from"./chunk-SMM3ST7A.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:a}){const{getSelectorForId:u}=p(o=>o),I=o(),{setSelectedPartId:f,setSelectHandler:k}=r(),l=d(o=>{const r=t(o);if(!r)return;const{nodeId:n,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),a?.(n)):i(o=>"part"===o.kind?e:o)},[i,a]);c(()=>{k(l)},[k,l]);const S=s(m)?n(m.nodeId,m.propKey):null;c(()=>{f(S)},[S,f]);return{selectNode:d(o=>{i(()=>e);const r=u(o);r&&I.select(r)},[i,u,I]),openPartId:S}}export{m as usePartBridge};
@@ -1 +1 @@
1
- import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-OFBZOI6W.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as m}from"./chunk-WK3AFPXY.js";import{DEFAULT_SCREEN_WORDS as n}from"./chunk-VVPZMWJE.js";import{DEFAULT_CANVAS_WORDS as c}from"./chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as s}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as f}from"./chunk-KFV7N2DJ.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as e,DEFAULT_NOTICE_WORDS as i}from"./chunk-Z6PVRXVY.js";import{DEFAULT_LOCK_WORDS as u}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as k}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as j}from"./chunk-B4JN227A.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-WRFD4EXD.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-KAML3KQH.js";var a={notice:i,lock:u,save:p,chrome:e,rail:k,tree:s,panel:f,fields:h,pick:r,drag:l,menu:m,styleClipboard:t,copy:j,canvas:c,textStyles:o,screen:n},y=o=>"object"==typeof o&&null!==o;function D(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:y(n)?t[m]=y(c)?D(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function Y(o,r){return r?D(o,r):o}export{a as DEFAULT_EASEL_STRINGS,Y as mergeEaselStrings};
1
+ import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-OFBZOI6W.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-VVPZMWJE.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as m}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as n}from"./chunk-WK3AFPXY.js";import{DEFAULT_CANVAS_WORDS as c}from"./chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as s}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as f}from"./chunk-KFV7N2DJ.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as e,DEFAULT_NOTICE_WORDS as i}from"./chunk-Z6PVRXVY.js";import{DEFAULT_LOCK_WORDS as u}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as k}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as j}from"./chunk-B4JN227A.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-WRFD4EXD.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-KAML3KQH.js";var a={notice:i,lock:u,save:p,chrome:e,rail:k,tree:s,panel:f,fields:h,pick:r,drag:l,menu:n,styleClipboard:m,copy:j,canvas:c,textStyles:o,screen:t},y=o=>"object"==typeof o&&null!==o;function D(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:y(n)?t[m]=y(c)?D(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function Y(o,r){return r?D(o,r):o}export{a as DEFAULT_EASEL_STRINGS,Y as mergeEaselStrings};
@@ -1,2 +1,2 @@
1
- import{ScreenPartsProvider as t}from"./chunk-EHBWUEEE.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-SMM3ST7A.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
1
+ import{ScreenPartsProvider as t}from"./chunk-PQRYAW2G.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-SMM3ST7A.js";import{useState as o,useEffect as s}from"react";import{jsx as i}from"react/jsx-runtime";function a({config:a,data:c,onChange:m,permissions:p,parts:f,children:u}){const[h]=o(()=>e({config:a,data:c,permissions:p}));s(()=>{h.setConfig(a)},[h,a]),s(()=>{if(!m)return;let t=h.getState().appState.data;return h.subscribe(()=>{const r=h.getState().appState.data;r!==t&&(t=r,m(r))})},[h,m]),s(()=>{p&&h.setPermissions(p)},[h,p]);const d=r();/* @__PURE__ */
2
2
  return i(n,{easel:h,hotkeys:d.ownsDocument,children:/* @__PURE__ */i(t,{parts:f,children:u})})}export{a as ScreenStoreProvider};
@@ -0,0 +1,5 @@
1
+ import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as n}from"./chunk-BVN33R76.js";import{blockTypesIn as s}from"./chunk-5ZBY24K7.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-62VPYC7F.js";import{blockRuns as l}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as c,useScreenBlockRules as a}from"./chunk-PQRYAW2G.js";import{useEaselSession as p}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VVPZMWJE.js";import{useEasel as d}from"./chunk-SMM3ST7A.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{AddPanel as y}from"./chunk-POSLNRTO.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-KAML3KQH.js";import{useState as u,useEffect as k,useMemo as b}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as j,jsxs as v,Fragment as O}from"react/jsx-runtime";var V=e=>`section:${e}`,A=e=>`block:${e}`,P=e=>`template:${e}`;function T({at:T,placeBlocks:$,canTake:w,onPick:E,itemFor:L,session:M,siteWide:R,onClose:x,onHide:B,readOnly:H}){const I=d(e=>e.config),N=c(),{labelAtLevel:S,categoryLabel:W,firstSection:C,Icon:F,Thumbnail:Q}=N,{blockIsOffered:Y,canAddTo:D}=a(),K=f("screen",m).add,z=f("drag",h).add,G=p(),[J,Z]=u([]);k(()=>{let e=!1;const t=e=>Y(e,G);return n(G).list().then(o=>{if(e)return;const n=I.components;Z(o.filter(e=>e.node?.type&&n[e.node.type]&&s(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[I,G]);const q=b(()=>e(I,N),[I]),U=e=>({type:V(e.type),label:e.name,cover:/* @__PURE__ */j(Q,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:K.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),X=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=J.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null},_=e=>/* @__PURE__ */j("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */j(F,{type:e,size:26})}),ee=b(()=>{const e=t(q,C),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&Y(e.type,G)&&n.set(e.type,e)};for(const t of e?[e]:q){const e=D(t.type)?.choices??[];e.forEach(s),e.forEach(e=>D(e.type,1)?.choices?.forEach(s))}$?.forEach(s);const i=new Set(q.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),c=e=>({type:A(e.type),label:e.label,cover:_(e.type),title:K.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...U(e),cover:_(e.type)}:U(e),p=[];J.length>0&&p.push({key:"templates",title:K.templates,tiles:J.map(e=>{return{type:P(e.id),label:e.name,cover:/* @__PURE__ */j(Q,{type:e.node.type}),keywords:[(t=e.node.type,S(t,"section",I.components[t]?.label??t)),e.node.type]};var t})});const m=r.filter(e=>!e.group);let d=!1;for(const t of Object.keys(I.categories??{})){const n=q.filter(e=>e.cat===t);if(0===n.length)continue;const s=e&&n.some(t=>t.type===e.type)?e:null,i=(s?[s,...n.filter(e=>e.type!==s.type)]:n).map(a);s&&!d&&(i.splice(1,0,...m.map(c)),d=!0),p.push({key:`category:${t}`,title:o(I,t,W),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(c)],d=!0),l(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(c)})}),!w)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=X(e.type),o=t?w(t):null;return o?{...e,disabled:!0,disabledReason:o}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...y.filter(h),...y.filter(e=>!h(e))]},[J,q,I,K,w,$,G]);/* @__PURE__ */
2
+ return v(O,{children:[
3
+ /* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:K.title,context:K.contextAll,actions:/* @__PURE__ */j(r,{label:K.done,description:K.doneDescription,onClick:x}),onHide:B}),
4
+ /* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
5
+ /* @__PURE__ */j(y,{groups:ee,session:M,itemFor:e=>L(X(e)??{kind:"section",type:e}),onInsert:E?e=>{const t=X(e);t&&E(t)}:void 0,at:T,hint:K.hint,searchLabel:K.search,readOnly:H,words:z}),R??null]})]})}export{T as AddSidePanel,A as blockKey,V as sectionKey,P as templateKey};
@@ -1 +1 @@
1
- import{useScreenBlockRules as e}from"./chunk-EHBWUEEE.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-SMM3ST7A.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
1
+ import{useScreenBlockRules as e}from"./chunk-PQRYAW2G.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-SMM3ST7A.js";import{useMemo as s}from"react";function i(i={}){const{dispatch:p}=o(e=>e),d=r(),c=!0===i.readOnly,a=e().resolveOnInsert,l=!0===(i.resolveOnInsert??a),m=!0===i.foldIntoHistory;return s(()=>{const e=m?e=>p({...e,recordHistory:!1}):p,o=(n,o,r)=>{const s=t(o);return c||e({type:"insert",componentType:o,destinationZone:n,destinationIndex:r,id:s}),s},r=e=>(l&&!c&&d.resolveNode(e,{trigger:"insert"}),e),s=(t,n,o)=>{c||e({type:"replace",destinationZone:t,destinationIndex:n,data:o})},i=(e,t,n)=>r(o(e,t,n));return{insertComponent:i,insertSection:(e,t)=>i(n,e,t),replaceComponent:s,seedChild:(e,t,n,i)=>{const p=o(e,n,t);s(e,t,{type:n,props:{id:p,...i}}),r(p)},insertNode:(e,t,n)=>{const i=o(e,n.type,t);return s(e,t,{type:n.type,props:{...n.props,id:i}}),r(i)},removeComponent:(t,n)=>{c||e({type:"remove",index:n,zone:t})},reorderComponent:(t,n,o)=>{c||e({type:"reorder",sourceIndex:n,destinationIndex:o,destinationZone:t})},duplicateComponent:(t,n)=>{c||e({type:"duplicate",sourceIndex:n,sourceZone:t})},select:e=>p({type:"setUi",ui:{itemSelector:e}}),setDocument:t=>{c||e({type:"setData",data:t})},commitDocument:(t,n)=>{c||(m?d.batch(()=>{e({type:"setData",data:t}),void 0!==n&&("slot"===n?.kind?d.selectSlot({parentId:n.parentId,slot:n.slot}):d.select(n?n.id:null))}):d.run({data:t,select:n}))}}},[p,c,l,d,m])}export{i as useSectionOps};
@@ -0,0 +1,21 @@
1
+ import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{TreeSeam as t}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as l}from"./chunk-K56YDHYQ.js";import{easelMenuEntries as a}from"./chunk-BALFHI3G.js";import{SETTINGS_BUCKETS as r,SettingsGroup as o}from"./chunk-RC25EGHD.js";import{DEFAULT_PANEL_WORDS as i}from"./chunk-KFV7N2DJ.js";import{FieldNumber as s}from"./chunk-2XMHLXMA.js";import{FieldSelect as c}from"./chunk-G3GWAP5R.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-WRFD4EXD.js";import{SettingsField as u,SettingsSegmented as m}from"./chunk-36LVP5WD.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{useTreeDrag as p,gapToMoveIndex as f}from"./chunk-67GNT6PF.js";import{withTip as b}from"./chunk-P2VEMZH5.js";import{Textarea as g,Input as v,SortableList as y,ListRow as k,ContextMenu as x,tabPanelId as w,Tabs as C,tabButtonId as N}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as O,useState as j,useLayoutEffect as $,useId as D}from"react";import{jsx as S,jsxs as I}from"react/jsx-runtime";import{ChevronIcon as P,LockIcon as L,MoveUpIcon as F,MoveDownIcon as M,DuplicateIcon as R,TrashIcon as E}from"efficient-shell/icons/efficient";function W({id:e,value:n,onChange:t,placeholder:l,multiline:a=!1,rows:r=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return a?/* @__PURE__ */S(g,{id:e,size:"sm",className:"es-fin",value:c,rows:r,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */S(v,{id:e,size:"sm",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function A(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function H(e,n,t){const l=e.slice(),[a]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,a),l}function T(e,n){return e.filter((e,t)=>t!==n)}function z(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var B='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',G={parentId:"list",slot:"items"};function K({label:e,icon:n,noun:r,items:o,onChange:i,newItem:s,summary:c,itemName:u,thumb:m,min:g=0,max:v,readOnly:w=!1,open:C,onOpen:N,renderItem:D,renderRow:W,canRemove:K,lockedReason:V,fixed:X=!1,removeOnRow:J=!0,canDuplicate:Y,above:q,head:Q=!0}){const Z=h("fields",d).list,U=h("tree",l),_=r??Z.item,ee=!w&&!X&&("number"!=typeof v||o.length<v),ne=o.length<=g,te=e=>!!K&&!K(o[e],e),le=e=>!w&&!X&&J&&!ne&&!te(e),ae=e=>ee&&(!Y||Y(o[e],e)),re=(e,n)=>u?u(e,n):Z.itemName({noun:_,n:n+1}),oe=O([]),ie=O(null),[se,ce]=j(null),de=O(null),[ue,me]=j(null),[he,pe]=j("");$(()=>{const e=ie.current;if(!e)return;ie.current=null;const n=oe.current[e.index]?.querySelectorAll(B)[e.nth]??oe.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const fe=(e,n)=>{if(n<0||n>=o.length||n===e)return;const t=oe.current[e],l=t?.ownerDocument.activeElement;if(t&&l&&t.contains(l)){const e=[...t.querySelectorAll(B)].indexOf(l),a=l;ie.current={index:n,nth:e,start:"number"==typeof a.selectionStart?a.selectionStart:null,end:"number"==typeof a.selectionEnd?a.selectionEnd:null}}i(H(o,e,n));const a=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}(C,e,n);a!==C&&N(a),pe(Z.moved({n:n+1,total:o.length}))},be=e=>{ee&&(i(A(o,e,s())),W?(ie.current={index:e,nth:0,start:null,end:null},null!==C&&C>=e&&N(C+1)):N(e))},ge=e=>{le(e)&&(i(T(o,e)),C===e?N(null):null!==C&&C>e&&N(C-1))},ve=p({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===G.parentId&&n.slot===G.slot,onDrop:(e,n)=>{const t=f({...G,index:e},n);t!==e&&fe(e,t)},onStep:(e,n)=>fe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<o.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Z.moveUp,icon:/* @__PURE__ */S(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<o.length-1&&n.push({label:Z.moveDown,icon:/* @__PURE__ */S(M,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),ae(e)&&n.push({label:Z.duplicate,icon:/* @__PURE__ */S(R,{size:14}),onClick:()=>(e=>{ae(e)&&(i(A(o,e+1,z(o[e]))),null!==C&&C>e&&N(C+1))})(e)}),le(e)&&n.push({label:Z.delete,icon:/* @__PURE__ */S(E,{size:14}),danger:!0,onClick:()=>ge(e)}),n},ke=(e,n,t,l)=>{w||0===ye(e).length||me({index:e,x:n,y:t,owner:l})},xe=e=>n=>{const t=o.slice();t[e]=n,i(t)};/* @__PURE__ */
2
+ return I("div",{className:"es-list",children:[Q?/* @__PURE__ */I("div",{className:"es-list-head",children:[
3
+ /* @__PURE__ */I("span",{className:"es-list-label",children:[n?/* @__PURE__ */S("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
4
+ /* @__PURE__ */S("span",{className:"es-list-count",children:o.length})]}):null,q?/* @__PURE__ */S("div",{className:"es-list-above",children:q}):null,o.length?/* @__PURE__ */I(y,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[o.map((e,n)=>{const l=ve.row({item:n,place:{...G,index:n}}),a=l.draggable&&se!==n,r=!W&&C===n,o=!w&&!X&&J&&te(n),i=["es-list-row",W?"is-inline":"is-item",r?"is-open":"",a?"is-draggable":"",l.dragging?"is-dragging":"",l.drop?`is-drop-${l.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */S(t,{...ve.seam({place:{...G,index:n}}),onAdd:ee?()=>be(n):void 0,label:Z.addHere({noun:_})},`seam-${n}`):null,
5
+ /* @__PURE__ */S(k,{className:i,flat:!!W,active:r,draggable:l.draggable,dragHint:U.dragHint,dragging:l.dragging,drop:"before"===l.drop||"after"===l.drop?l.drop:void 0,onMove:l.draggable?e=>fe(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{oe.current[n]=e},rowProps:{...l.rowProps,draggable:a||void 0,onPointerDown:e=>{const t=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),a=!!t&&t===t.ownerDocument.activeElement;e.currentTarget.draggable=l.draggable&&!a,de.current=t&&!a?t:null,ce(a?n:null)},onDragStart:e=>{const n=de.current;de.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),l.rowProps.onDragStart?.(e)},onContextMenu:e=>{w||(e.preventDefault(),e.stopPropagation(),ke(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const a=e.currentTarget.getBoundingClientRect();return void ke(n,a.left+24,a.bottom,e.currentTarget)}l.rowProps.onKeyDown?.(e)}},actions:w||X||!J?void 0:o?b(V?V(e,n):Z.locked,/* @__PURE__ */S("span",{className:"es-list-lock",role:"img","aria-label":V?V(e,n):Z.locked,children:/* @__PURE__ */S(L,{size:13})})):b(Z.deleteItem({noun:_}),/* @__PURE__ */S("button",{type:"button",className:"es-list-x","aria-label":Z.deleteItem({noun:_}),disabled:!le(n),onClick:()=>ge(n),children:"×"})),below:r?/* @__PURE__ */S("div",{className:"es-list-item",children:D(e,n,xe(n))}):void 0,children:W?/* @__PURE__ */S("div",{className:"es-list-row-main",children:W(e,n,xe(n))}):/* @__PURE__ */I("button",{type:"button",className:"es-list-open","aria-expanded":r,onClick:()=>N(r?null:n),children:[m?/* @__PURE__ */S("span",{className:"es-list-thumb","aria-hidden":"true",children:m(e,n)}):null,
6
+ /* @__PURE__ */S("span",{className:"es-list-row-name",children:re(e,n)}),/* @__PURE__ */S("span",c?{className:"es-list-row-summary",children:c(e,n)}:{className:"es-list-row-summary"}),
7
+ /* @__PURE__ */S(P,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},n)]}),
8
+ /* @__PURE__ */S(t,{...ve.seam({place:{...G,index:o.length}})})]}):null,w||X?null:/* @__PURE__ */S("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(o.length),children:Z.add({noun:_})}),
9
+ /* @__PURE__ */S("span",{className:"es-list-said","aria-live":"polite",children:he}),ue&&ue.index<o.length?
10
+ /* @__PURE__ */S(x,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),items:a(ye(ue.index))}):null]})}var V=e=>e<6?e+1:6,X=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function J({field:e,name:t,id:l,value:a,onChange:r,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=j(!0),p=a&&"object"==typeof a?a:{};/* @__PURE__ */
11
+ return S(o,{id:`${l}-group`,title:X(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */S(q,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>r({...p,[e]:n}),readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:V(u)},e))})}function Y({field:e,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=j(null),f=u?d??null:h,b=u??p,g=Array.isArray(a)?a:[],v=e.getItemSummary;/* @__PURE__ */
12
+ return S(K,{label:X(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:r,newItem:()=>z({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:o,open:f,onOpen:b,renderItem:(a,r,d)=>Object.entries(n(e.arrayFields,{values:a,context:s})).map(([e,n])=>/* @__PURE__ */S(q,{field:n,name:`${t}[${r}].${e}`,id:`${l}-${r}-${e}`,value:a?.[e],onChange:n=>d({...a,[e]:n}),readOnly:o,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function q(e){const{field:n,name:t,id:l,value:a,onChange:r,readOnly:o,context:i,renderers:d}=e;if(!n||n.marker||!1===n.visible)return null;const h=d?.[n.type];if(h)return h({field:n,name:t,id:l,value:a,onChange:r,readOnly:o});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:a,onChange:r,readOnly:o};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
13
+ return S(u,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(W,{id:l,value:"string"==typeof a?a:null==a?"":String(a),onChange:r,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:o})});case"number":/* @__PURE__ */
14
+ return S(u,{label:X(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(s,{id:l,value:"number"==typeof a?a:void 0,onChange:r,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:o})});case"select":{const e=`${l}-label`;/* @__PURE__ */
15
+ return S(u,{label:X(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(c,{id:l,value:a,options:n.options,onChange:r,readOnly:o,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
16
+ return S(u,{label:X(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */S(m,{ariaLabel:X(n,t),value:a,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||o})),onChange:e=>{o||r(e)}})});case"object":/* @__PURE__ */
17
+ return S(J,{...e,field:n});case"array":/* @__PURE__ */
18
+ return S(Y,{...e,field:n});case"slot":return null}}var Q=e=>r.includes(e);function Z(n,t){let l,a=r[0];const o=[],i=/* @__PURE__ */new Set;for(const[r,s]of Object.entries(n))s&&(Q(s.bucket)&&((s.marker||s.bucket!==a)&&(l=void 0),a=s.bucket),s.marker&&"string"==typeof s.fold?l={key:r,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||(o.push(l?{name:r,field:s,bucket:a,fold:l}:{name:r,field:s,bucket:a}),"slot"!==s.type&&i.add(a)));return{rows:o,buckets:r.filter(e=>i.has(e))}}function U(e){return new Map(Z(e).rows.map(e=>[e.name,e.bucket]))}function _(e){const n=[];for(const t of e){const e=n[n.length-1];e&&e.fold?.key===t.fold?.key?e.rows.push(t):n.push({fold:t.fold,rows:[t]})}return n}function ee({fields:e,values:n,onChange:t,readOnly:l=!1,context:a,showWhenContext:r,tab:s,onTab:c,tabs:d=!0,tabIcons:u,renderers:m,idPrefix:p,ariaLabel:f,lead:b,children:g,leadFold:v,closedFolds:y,onFold:k,headingLevel:x=3}){const O=h("panel",i),$=D(),P=p??`es-insp${$.replace(/:/g,"")}`,L=Z(e,{values:n,context:r}),[F,M]=j(void 0),R=s??F,E=R&&L.buckets.includes(R)?R:L.buckets[0],[W,A]=j(null),H=W&&W.panel===P&&L.rows.some(e=>e.name===W.name)?W:null,T=d&&L.buckets.length>1,z=T&&E?w(P,E):`${P}-rows`,[B,G]=j(()=>/* @__PURE__ */new Set),K=y??B,X=(e,n)=>{/* @__PURE__ */return S(o,{title:e.title,open:!K.has(e.key),onToggle:n=>((e,n)=>{void 0===y&&G(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),k?.(e,n)})(e.key,n),id:`${P}-fold-${t=e.key,[...t].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:x,children:n});var t},J=e=>T&&e!==E,Y=({name:e,field:o,bucket:i,fold:s})=>/* @__PURE__ */S("div",{className:"es-insp-row","data-field":e,"data-bucket":i,hidden:!!J(i)||void 0,children:/* @__PURE__ */S(q,{field:o,name:e,id:`${P}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:a,showWhenContext:r,renderers:m,openItem:H&&H.name===e?H.index:null,onOpenItem:n=>A(null===n?null:{panel:P,name:e,index:n}),headingLevel:s?V(x):x})},e);/* @__PURE__ */
19
+ return I("div",{className:"es-insp",children:[T?/* @__PURE__ */S("div",{className:"es-insp-tabs",children:/* @__PURE__ */S(C,{variant:"underline",block:!0,"aria-label":f??O.settings,idPrefix:P,value:E,onChange:e=>{const n=e;void 0===s&&M(n),c?.(n)},items:L.buckets.map(e=>{const n=O.buckets[e],t=u?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */S("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
20
+ /* @__PURE__ */I("div",{className:"es-insp-rows",id:z,role:T?"tabpanel":void 0,"aria-labelledby":T&&E?N(P,E):void 0,children:[b?v?/* @__PURE__ */S("div",{className:"es-insp-band","data-fold":v.key,children:X(v,b)}):b:null,_(L.rows).map((e,n)=>{if(!e.fold)return e.rows.map(Y);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
21
+ return S("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!J(t)&&!l)||void 0,children:X(e.fold,e.rows.map(Y))},`fold-${e.fold.key}-${n}`)}),g]})]})}export{W as FieldText,ee as Inspector,q as InspectorField,K as ListField,U as bucketsOf,z as copyItem,A as insertAt,X as labelOf,H as moveTo,Z as planFields,T as removeAt};
@@ -1,4 +1,4 @@
1
- import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-EHBWUEEE.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-VVPZMWJE.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{DropdownMenu as n}from"efficient-shell/ui";import{jsxs as c,Fragment as i,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:p}){const{Icon:a}=r(),m=t("screen",s),u=e(l).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */c(i,{children:[e.group," ",
1
+ import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-PQRYAW2G.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-VVPZMWJE.js";import{useWords as t}from"./chunk-MFIRYGHW.js";import{DropdownMenu as n}from"efficient-shell/ui";import{jsxs as c,Fragment as i,jsx as o}from"react/jsx-runtime";function l({choices:l,onPick:p}){const{Icon:a}=r(),m=t("screen",s),u=e(l).flatMap(e=>[...e.group?[{type:"label",key:`group:${e.group}`,label:/* @__PURE__ */c(i,{children:[e.group," ",
2
2
  /* @__PURE__ */o("span",{className:"sf-menugroup-count",children:e.items.length})]})}]:[],...e.items.map(e=>({key:e.type,label:e.label,icon:/* @__PURE__ */o("span",{className:"sf-chip",children:/* @__PURE__ */o(a,{type:e.type,size:13})}),onSelect:()=>p(e.type)}))]);/* @__PURE__ */
3
3
  return o(n,{align:"start",triggerClassName:"sf-add-card",items:u,trigger:/* @__PURE__ */c(i,{children:[
4
4
  /* @__PURE__ */o("span",{className:"sf-plus sf-plus--sm",children:"+"}),m.addBlockMenu]})})}export{l as AddBlockRow};
@@ -1,7 +1,7 @@
1
- import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-QKZPPI5O.js";import{ScreenStoreProvider as e}from"./chunk-YQVR54RE.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__ */
1
+ import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-RQBIFINA.js";import{ScreenStoreProvider as e}from"./chunk-KFPCMMRK.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 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 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:()=>{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 Z({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(),Z=t(()=>s(!g),[g]),P=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:P.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:Z,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(j,{onCancel:p,onDiscard:v,onSave:y})):/* @__PURE__ */u("div",{className:"sf-msg",children:P.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:P.waitingForAuthorization})}export{Z as DocumentScreen,y as ScreenMount};
5
+ /* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{C()},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]),Z=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:Z.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:M,parts:n,children:/* @__PURE__ */u(k,{})}),f&&/* @__PURE__ */u(N,{onCancel:p,onDiscard:v,onSave:j})):/* @__PURE__ */u("div",{className:"sf-msg",children:Z.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:Z.waitingForAuthorization})}export{M as DocumentScreen,j as ScreenMount};
@@ -1,5 +1,5 @@
1
- import{usePickFollowsSelection as n}from"./chunk-R6WTQWAC.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-SMM3ST7A.js";import{Inspector as i}from"./chunk-SO5OLDH7.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},O={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},S={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},L={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},j={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function w(){/* @__PURE__ */
1
+ import{usePickFollowsSelection as n}from"./chunk-R6WTQWAC.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-SMM3ST7A.js";import{Inspector as i}from"./chunk-N3LYD2LK.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},O={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},S={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},j={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function w(){/* @__PURE__ */
2
2
  return s(t,{height:"fill"})}function C(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
3
- return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var D=o({});function P({parts:n,children:e}){/* @__PURE__ */
4
- return s(D.Provider,{value:n,children:e})}function G(){return u(D)}function N(){return(G().useOwnerName??v)()}function T(){return(G().useDocumentLabel??g)()}function x(n,e,t,r){return(G().useBridges??h)(n,e,t,r)}function A(n){return(G().useStandaloneBridges??h)(n)}function B(n,e){(G().useDocumentPass??y)(n,e)}function I(){return G().blockRules??b}function F(){return G().blockLook??O}function R(){return G().devices??S}function H(){return G().leftView??L}function K(){return G().pinned??j}function M(){return G().saveSwitch??!0}function V(e){n(!0===G().pickFollowsSelection,e)}function W(){return G().storageNamespace||void 0}function E(){return G().styleClipboard??null}function Q(){return G().nodeKeys??!0}function Y(){return G().notify??null}function Z(){return G().Canvas??w}function q(){return G().CanvasHead??null}function z(){return G().canvasDrag??null}var J=o(null);function U({target:n,children:e}){/* @__PURE__ */
5
- return s(J.Provider,{value:n,children:e})}function X(){return u(J)}function $(){return G().Inspector??C}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,P as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,F as useScreenBlockLook,I as useScreenBlockRules,x as useScreenBridges,z as useScreenCanvasDrag,Z as useScreenCanvasFrame,q as useScreenCanvasHead,X as useScreenCanvasTarget,R as useScreenDevices,T as useScreenDocumentLabel,B as useScreenDocumentPass,$ as useScreenInspectorPanel,H as useScreenLeftView,Q as useScreenNodeKeys,Y as useScreenNotify,N as useScreenOwnerName,G as useScreenParts,V as useScreenPickFollowsSelection,K as useScreenPinned,M as useScreenSaveSwitch,W as useScreenStorageNamespace,E as useScreenStyleClipboard,A as useStandaloneScreenBridges};
3
+ return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var D=o({});function N({parts:n,children:e}){/* @__PURE__ */
4
+ return s(D.Provider,{value:n,children:e})}function P(){return u(D)}function G(){return(P().useOwnerName??v)()}function T(){return(P().useDocumentLabel??g)()}function x(n,e,t,r){return(P().useBridges??h)(n,e,t,r)}function A(n){return(P().useStandaloneBridges??h)(n)}function B(n,e){(P().useDocumentPass??y)(n,e)}function I(){return P().blockRules??b}function F(){return P().blockLook??L}function K(){return P().devices??O}function R(){return P().leftView??S}function M(){return P().pinned??j}function V(){return P().saveSwitch??!0}function W(e){n(!0===P().pickFollowsSelection,e)}function Y(){return P().storageNamespace||void 0}function E(){return P().styleClipboard??null}function H(){return P().nodeKeys??!0}function Q(){return P().notify??null}function Z(){return P().Canvas??w}function q(){return P().CanvasHead??null}function z(){return P().canvasDrag??null}var J=o(null);function U({target:n,children:e}){/* @__PURE__ */
5
+ return s(J.Provider,{value:n,children:e})}function X(){return u(J)}function $(){return P().Inspector??C}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,N as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,F as useScreenBlockLook,I as useScreenBlockRules,x as useScreenBridges,z as useScreenCanvasDrag,Z as useScreenCanvasFrame,q as useScreenCanvasHead,X as useScreenCanvasTarget,K as useScreenDevices,T as useScreenDocumentLabel,B as useScreenDocumentPass,$ as useScreenInspectorPanel,R as useScreenLeftView,H as useScreenNodeKeys,Q as useScreenNotify,G as useScreenOwnerName,P as useScreenParts,W as useScreenPickFollowsSelection,M as useScreenPinned,V as useScreenSaveSwitch,Y as useScreenStorageNamespace,E as useScreenStyleClipboard,A as useStandaloneScreenBridges};
@@ -0,0 +1,57 @@
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-HM7S7H5H.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-GGC72GS4.js";import{useSectionOps as b}from"./chunk-N2BVA6TS.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-N2B32EZB.js";import{SidePanelHead as z,PanelShowStrip as C}from"./chunk-62VPYC7F.js";import{MediaSidePanel as B}from"./chunk-63ZDVAVE.js";import{useScreenSaveSwitch as I,useScreenNodeKeys as O,useScreenPinned as N,useScreenDocumentLabel as P,useScreenCanvasFrame as $,useScreenInspectorPanel as M,useScreenDevices as T,useScreenPickFollowsSelection as A,useScreenLeftView as j,SELECTION_MODE as L,sameInspectorMode as R,useScreenBridges as E,useScreenBlockRules as V,useScreenBlockLook as H,useScreenStorageNamespace as F,useScreenNotify as W,useScreenCanvasHead as D,isSlotMode as G,useScreenStyleClipboard as J,useScreenDocumentPass as U,useScreenCanvasDrag as Y,ScreenCanvasTargetProvider as K,isPinnedFirst as Z,isPinnedLast as X,screenSlotsOf as q}from"./chunk-PQRYAW2G.js";import{useNodeClipboard as _,useNodeContextMenu as Q}from"./chunk-UVQR7W6I.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 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 Oe}from"./chunk-SMM3ST7A.js";import{toItemSelector as Ne,useNodeOps as Pe,clickPick as $e}from"./chunk-ECM5F6JJ.js";import{TreeRow as Me,Subtree as Te,LayersTree as Ae,TreeGroupLabel as je,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 He}from"./chunk-4VJATVVR.js";import{EaselTopBar as Fe,TopBarRail as We,TopBarCluster as De,EaselIconButton as Ge,TopBarDivider as Je,DeviceSwitch as Ue,InspectorIconButton as Ye,PanelResizeHandle as Ke,MAX_PANEL_W as Ze,MIN_PANEL_W as Xe,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-POSLNRTO.js";import{DEFAULT_DRAG_WORDS as dn}from"./chunk-KAML3KQH.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,useCanvasTyping as mn,useCanvasEvent as gn,nodeIdAt as yn,frameRectToHost as Sn,BLOCK_ATTRIBUTE as kn,drawnBox as vn}from"./chunk-X4T6JT3M.js";import{ROOT_ID as bn,ROOT_SLOT as wn,zoneKey as xn,parseZoneKey as zn,find as Cn,DataError as Bn}from"./chunk-KRXQM65X.js";import{useRef as In,useMemo as On,useState as Nn,useEffect as Pn,useCallback as $n,useLayoutEffect as Mn,Fragment as Tn}from"react";import{ColoredBadge as An,toast as jn,groupColors as Ln}from"efficient-shell/ui";import{UndoIcon as Rn,RedoIcon as En,RefreshIcon as Vn,AddIcon as Hn,TrashIcon as Fn,EyeOffIcon as Wn,EyeIcon as Dn,DuplicateIcon as Gn}from"efficient-shell/icons/efficient";import{jsx as Jn,jsxs as Un,Fragment as Yn}from"react/jsx-runtime";var Kn=/* @__PURE__ */new WeakSet;function Zn(e,n,t){const o=Cn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function Xn({canvas:e,tabs:n,onSelect:t}){const o=In(null),[r,i]=Nn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Mn(()=>{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=Sn(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?vn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=Sn(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(An,{colorClass:Ln("info","solid"),size:"sm",children:e.label})},e.id):null})})}function qn({expand:e}){/* @__PURE__ */
2
+ return Jn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Un(Yn,e?{children:[
3
+ /* @__PURE__ */Jn("path",{d:"M8 9l4-4 4 4"}),
4
+ /* @__PURE__ */Jn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
5
+ /* @__PURE__ */Jn("path",{d:"M8 4l4 4 4-4"}),
6
+ /* @__PURE__ */Jn("path",{d:"M8 20l4-4 4 4"}),
7
+ /* @__PURE__ */Jn("path",{d:"M5 12h14"})]})})}var _n=`${fn}, ${hn}`;function Qn(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 et="__rungs";var nt="screen:band",tt={duplicate:!0,delete:!0};function ot(){const fn=se(),{target:Sn,docId:kn,capabilities:vn,currentSlug:Ln,siteId:ot,onPublish:rt,saveState:it,saveConflict:lt,retrySave:st,toggleAutoSave:dt,flushSave:ct,access:at,saveUnreachable:pt=!1,readOnly:ut,readOnlyReason:ft=null}=ne(),ht=I(),mt=O(),{mediaEditing:gt,hasEditGuard:yt,hasPinnedChrome:St}=vn,{appState:kt,dispatch:vt,history:bt,selectedItem:wt,getSelectorForId:xt,config:zt}=Be(e=>e),Ct=N(),{first:Bt,firstGroup:It,lastGroup:Ot,isSectionGroup:Nt,sectionGroupZone:Pt,panelOf:$t}=Ct,Mt=$t(Bt),Tt=e=>Z(Ct,e),At=e=>X(Ct,e),jt="node"===Ct.firstRow,Lt=Ct.band??null,Rt=on("screen",ce),Et=on("tree",Ee),Vt=on("drag",dn),Ht=on("notice",_e),Ft=on("lock",tn),Wt=on("menu",fe),Dt=on("styleClipboard",ue),Gt=on("chrome",Qe),Jt=P()??`/${Ln}`,Ut=$(),Yt=M(),Kt=b({readOnly:ut}),Zt=b({readOnly:ut,foldIntoHistory:!0}),Xt=In(null),qt=Ie(),_t=On(()=>({...Kt,select:e=>{Xt.current=e,Kt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=qt.config;Xt.current=Ne(e,t,n)}Kt.commitDocument(e,n)}}),[Kt,qt]),Qt=kt.ui,eo=Qt.leftSideBarVisible,no=Qt.rightSideBarVisible,{options:to,widths:oo,initial:ro,fluid:io,fit:lo}=T(),[so,co]=Nn(ro),ao=oe(),po=gt&&null!==ao,uo=re(),fo=ie();A(wt?.props.id);const{read:ho,write:mo,forSelection:go}=j(),[yo,So]=Nn(ho);Pn(()=>{mo(yo)},[yo]);const[ko,vo]=Nn(0),bo=In(null),wo=In(null),xo=un(wo,{readySelector:_n}),zo=mn(xo),Co=u(wo);f(wo,xo);const Bo=d(),Io=en(at),Oo={state:it,offline:Bo||it.failed&&pt,readOnlyReason:ft,editing:Io?Ht.editing({name:nn(Io.name,Ft),noun:Rt.noun}):null,conflict:null!=lt,notSaving:Rt.bar.notSaving},No=()=>{ut||(it.failed?st():ct())};h(wo,xo,No);const[Po,$o]=Nn(!1),Mo=In(!1),To=In(!1),[Ao,jo]=Nn(null),[Lo,Ro]=Nn([]),[Eo,Vo]=Nn(L),Ho="puck"===Eo.kind,Fo=n(Eo,wt?.props.id),[Wo,Do]=Nn(null);Pn(()=>{Wo&&(t(),Do(null))},[Wo]);const Go=In(xt);Go.current=xt;const Jo=$n((e,{scroll:n})=>{So(n=>go(e,n)),n&&Do(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Go.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&br(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Uo=In(null);Pn(()=>{const e=Uo.current;Uo.current=null;const n=null==wt?.props.id?null:String(wt.props.id);Vo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:$t(wt?.type)??L);const t=wt?.props.id,r=Xt.current;if(Xt.current=null,!t)return;const i=xt(t);Jo(String(t),{scroll:!o(r,i??null,Se)})},[wt?.props.id,Jo]);const Yo=$n(e=>{Vo(n=>R(n,e)?n:e),vt({type:"setUi",ui:{rightSideBarVisible:!0}})},[vt]),Ko=In(()=>{});Ko.current=(e,n)=>{const t=e?hi(e.zone??Se)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==wt?.props.id?null:String(wt.props.id);Vo(e=>R(e,n)?e:n),o!==r&&(Uo.current={id:o,mode:n},_t.select(e))};const Zo=$n((e,n)=>Ko.current(e,n),[]),Xo={kind:Eo.kind,mode:Eo,open:Yo,show:e=>Vo(e),reveal:()=>{no||vt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Zo},qo=E(Xo,{data:kt.data,selected:wt??null,zoneOf:e=>xt(e)?.zone,readOnly:Boolean(ut),select:e=>{Vo(L),_t.select({index:e})},replace:(e,n)=>_t.replaceComponent(Se,e,n),scrollTo:e=>Vi(e)},{device:so,refreshes:ko},{setView:So,reveal:()=>{eo||vt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),_o=qo.pinnedSource??!1,Qo=qo.resolveLeftView?qo.resolveLeftView(yo,po):"media"===yo&&po?yo:"sections",er=V(),{isLockedBlock:nr,duplicateBlocked:tr,nestDepth:or,newSectionNode:rr,canAddTo:ir,blockIsOffered:lr}=er,sr=H(),{labelAtLevel:dr,Icon:cr,useProducts:ar}=sr,pr=sr.rowName?(e,n,t)=>sr.rowName(e,n,t):void 0,ur=$n(e=>{vt({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),Jo(e,{scroll:!0})},[vt,Jo]),{selectNode:fr,openPartId:hr}=v({mode:Eo,setMode:Vo,onOpenPart:ur}),[mr,gr]=Nn(null);de(null!==mr,()=>gr(null));const yr=y(F()),Sr=yr.collapsed,kr=yr.panelWidths,[vr,br]=Nn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Sr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
8
+ return new Set}});Pn(()=>{try{window.localStorage.setItem(Sr,JSON.stringify([...vr]))}catch{}},[vr]);const[wr,xr]=Nn(()=>{if("undefined"==typeof window)return{...S};try{const e=window.localStorage.getItem(kr);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}}});Pn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(kr,JSON.stringify(wr))}catch{}},300);return()=>clearTimeout(e)},[wr]);const zr=$n((e,n)=>xr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Cr=$n(e=>zr("left",e),[zr]),Br=$n(e=>zr("right",e),[zr]),Ir=e=>vr.has(e),Or=e=>br(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Nr=In(!1),Pr=In(null);Pn(()=>{if(Nr.current&&!Po){const e=Pr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??wo.current?.querySelector(`button[aria-label="${CSS.escape(Rt.add.title)}"]`))?.focus(),Pr.current=null}Nr.current=Po},[Po]),Pn(()=>{if(!Po||!Co)return;const e=e=>{"Escape"===e.key&&Yi()};return Co.addEventListener("keydown",e),()=>Co.removeEventListener("keydown",e)},[Po,Co]),de(Po,()=>Yi()),Pn(()=>{!eo&&Po&&($o(!1),jo(null),Mo.current=!1)},[eo]),Pn(()=>{if(!uo)return To.current&&vt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(To.current=!1);Po&&($o(!1),jo(null),To.current=Mo.current,Mo.current=!1),eo||(To.current=!0,vt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[uo]),Pn(()=>{!eo&&uo&&(To.current=!1,fo())},[eo]),Pn(()=>{if(!uo||!Co)return;const e=e=>{"Escape"===e.key&&fo()};return Co.addEventListener("keydown",e),()=>Co.removeEventListener("keydown",e)},[uo,Co]),de(null!==uo,()=>fo());const $r=W(),Mr=(e,n="success",t)=>{if($r)return void(t?$r(e,"error"===n?"error":"info",t):$r(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?jn.error(e,{...o,duration:t?.duration??3200}):jn.success(e,{...o,duration:t?.duration??1900})},Tr=In(null),[Ar,jr]=Nn(0),[Lr,Rr]=Nn(0),Er=D(),Vr=In(null),Hr=e=>Math.max(0,e.clientHeight-(Vr.current?.offsetHeight??0));Pn(()=>{const e=Tr.current;if(!e)return;const n=()=>{jr(e.clientWidth),Rr(Hr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Vr.current&&t.observe(Vr.current),()=>t.disconnect()},[]),Mn(()=>{Tr.current&&(jr(Tr.current.clientWidth),Rr(Hr(Tr.current)))},[wr,eo,no]);const Fr=so===io?Ar>0?Ar:oo[io]:oo[so],Wr=Ar>0?Math.min(Ar/Fr,"shrink"===lo?1:2):1,Dr=Fr*Wr,Gr=Ar>0&&Dr>Ar+1,Jr={width:Dr,height:Lr||"100%",flex:"none",position:"relative"},Ur={width:Fr,height:Lr?Lr/Wr:"100%",maxHeight:"none",transform:1!==Wr?`scale(${Wr})`:void 0,transformOrigin:"top left"},Yr=()=>vt({type:"setUi",ui:{leftSideBarVisible:!eo}}),Kr=()=>vt({type:"setUi",ui:{rightSideBarVisible:!no}}),Zr=e=>{Po&&($o(!1),jo(null),Mo.current=!1,eo&&yo===e)||uo&&(To.current=!1,fo(),eo&&yo===e)||(eo&&yo===e?Yr():(So(e),eo||vt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Xr=()=>{te(fn,{accept:"image/*",title:Gt.mediaLibrary})},qr=()=>{Vo(L),_t.select(null),p()},_r=()=>{Vo(Mt??L),no||vt({type:"setUi",ui:{rightSideBarVisible:!0}})},Qr=kt.data.content??[],ei=()=>{const e=Qr.findIndex(Tt),n=Qr.findIndex(At);return{floor:e>=0?e+1:0,cap:n>=0?n:Qr.length}},ni=zt,ti=er.stripCopy,oi=e=>r(e,ti),ri=_(),ii=Pe({data:kt.data,config:ni,readOnly:Boolean(ut),clipboard:ri,strip:ti?e=>ti(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==bn||e.slot!==wn)return{min:0,max:n-1};const{floor:t,cap:o}=ei();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Vo(L);const t=void 0===n||"node"===n?.kind?n:null;_t.commitDocument(e,t)}}),li=e=>{const n=Cn(kt.data,zt,e);if(!n)return!1;const t=xn(n.place),o=n.node,r=t===Se?pi(o):Ci(o);return!!ii.remove(e)&&(Mr(Rt.deleted({name:r}),"success",{duration:8e3,action:{label:Rt.bar.undo,onClick:()=>{ii.restore(n.node,n.place)}}}),!0)},si={...ii,remove:li},di=e=>dr(e,"block",zt.components[e]?.label??e),ci=$n(e=>zt.components[e]?.defaultProps??{},[zt]),ai=e=>dr(e,"section",di(e)),pi=e=>he({type:e.type,props:e.props??{}},ai(e.type),pr),{nodeAddresses:ui,zoneItems:fi}=On(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=ve)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of be(zt,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,zt]),hi=$n(e=>fi.get(e)??[],[fi]),mi=e=>{const n=ui.get(e);return n?hi(n.zone)[n.index]:void 0},gi=e=>q(er,zt,e),yi=e=>{if(!er.slotsOf||e===Se)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=mi(e.slice(0,n));if(!t)return null;const o=gi(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},Si=(()=>{if(!G(Eo))return null;const e=`${Eo.nodeId}:${Eo.slot}`;return yi(e)?.slot.panel===Eo.kind?e:null})(),ki=In(null);Pn(()=>{const e=ki.current;if(ki.current=null,!Si||!G(Eo))return;const n=Eo.nodeId;Jo(n,{scroll:e!==Si}),br(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Eo]);const vi=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ui.get(e);n&&(n.zone===Se?Hi(n.index):hl(n.zone,n.index,e,mi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Si!==i&&(ki.current=i),Zo(null,r),no||vt({type:"setUi",ui:{rightSideBarVisible:!0}}),Vi(o)},bi=(e,n,t)=>{const o=`${e}:${n}`;if(br(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;Si!==o&&(ki.current=o);Zo(null,{kind:t,nodeId:e,slot:n})},wi=(e,n,t)=>{if(ut||!er.moveSlot)return;const o=mi(e),r=o?gi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:et,index:n},s=pn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=er.moveSlot(e,n,s);"string"==typeof d&&bi(e,d,i.panel)},xi=ar(),zi=On(()=>{const e=/* @__PURE__ */new Map;for(const n of xi??[])e.set(n.slug,n.name);return e},[xi]),Ci=e=>me(e,di,sr.plainText,e=>zi.get(e),sr.rowName),Bi=(e,n)=>{const t=zt.components[e.type]?.fields,o=n===Se||jl(n)?"section":"block",r=n===Se&&(Tt(e)||At(e)||Nt(e.type)),i="block"===o?ge(t):r?null:ye(t);return sr.renamePropOf?sr.renamePropOf(e,o,i):i},Ii=(e,n,t,o)=>{if(!(!ut&&mr?.zone===e&&mr.index===n))return;const r=(t,o)=>{gr(null),o&&((e,n,t)=>{const o=hi(e)[n];if(!o)return;const r=Bi(o,e);r&&_t.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
9
+ return Jn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Rt.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)},Oi=e(J(),Dt),Ni=Oi.scope({target:Sn,siteId:ot,docId:kn}),Pi=zt,$i=(e,n)=>n===Se?ai(e):di(e),Mi=(e,n,t)=>{const o=Oi.plan(Ni,t,$i(t.type,e),Pi);o&&(o.changed&&_t.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Mr(o.message))},Ti=Q({nodesIn:hi,nodeAt:(e,n)=>hi(e)[n]??null,labelOf:(e,n)=>n===Se?ai(e):di(e),renamePropOf:Bi,beginRename:(e,n)=>gr({zone:e,index:n}),history:{hasPast:bt.hasPast,hasFuture:bt.hasFuture,back:()=>bt.back(),forward:()=>bt.forward()},openPageSettings:()=>{_t.select(null),Vo(L)},pageSettingsLabel:Rt.pageSettings,words:{menu:Wt,styleClipboard:Dt,screen:Rt.menu},readOnly:Boolean(ut),collapseAll:()=>br(new Set(hi(Se).map(e=>String(e.props.id)))),onPasteRefused:e=>Mr(e?Rt.pasteRefused({name:e.label}):Rt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>El(e,n),menuRows:qo.menuRows,isLocked:e=>nr(e.type),duplicateBlocked:e=>tr(kt.data,e),permits:e=>ke(zt,e.type),nodeOps:si,isPinned:(e,n)=>n===Se&&(Tt(e)||At(e)),sectionBand:ei,locate:e=>ui.get(e)??null,rowNameOf:(e,n)=>n===Se?pi(e):Ci(e),selectAt:(e,n,t,o)=>{e===Se?Hi(n):hl(e,n,t,o??"")},slotRung:e=>{const n=yi(e);return n?.slot.panel?{label:n.slot.label,select:()=>vi(n.node,n.slot,!1)}:null},style:{held:()=>ae(Ni),canCopy:e=>Oi.rows(Pi,e).some(e=>!1!==e.counted),copy:(e,n)=>Oi.copy(Ni,e,$i(e.type,n),Pi),paste:(e,n,t)=>Mi(e,n,t)},keys:mt?{target:Co,selected:()=>{const e=kt.ui.itemSelector;return e?{zone:e.zone??Se,index:e.index}:null},held:()=>ri.get(),readOnly:Boolean(ut),onDone:({done:e,name:n})=>{"copied"===e&&Mr(Rt.copied({name:n}))}}:void 0},xo),Ai=In({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Pn(()=>{Ai.current={copy:(e,n)=>Oi.copy(Ni,e,$i(e.type,n),Pi),paste:Mi,at:()=>{const e=kt.ui.itemSelector;if(!e)return null;const n=e.zone??Se,t=hi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(ut)}});const ji=$n(e=>{const n=pe(e);if(!n)return;const t=Ai.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))},[]);Pn(()=>{if(!Co)return;const e=e=>ji(e);return Co.addEventListener("keydown",e),()=>Co.removeEventListener("keydown",e)},[ji,Co]),gn(xo,"keydown",ji);const Li=Qr.map(e=>e.props.id).join("|");Pn(()=>{const e=xo?.document??null,n=xo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ro(e=>e.length?[]:e);const n=Qr.findIndex(At),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&&!Tt(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=Qn(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})}Ro(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()}},[xo,Li,so,Wr,eo,no,wt?.props.id]);const Ri=xo?.document??null,Ei=xo?.window??null;Pn(()=>{const e=bo.current;if(!e||!Ri||!Ei)return;const n=[],t=()=>{const n=Ri.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Ei.scrollTo({left:Ei.scrollX,top:Ei.scrollY+t,behavior:"instant"}),!0};return bo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ri,Ei]);const Vi=e=>{qo.holdCanvasOn?qo.holdCanvasOn(e):c(e)},Hi=e=>{Vo(L),_t.select({index:e}),qo.sectionPressed?.(Qr[e]);const n=Qr[e]?.props?.id;n&&Vi(n)},Fi=e=>{const{floor:n,cap:t}=ei(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=wt&&Eo.kind!==Mt?.kind?Qr.findIndex(e=>e.props.id===wt.props.id):-1;return o(r>=0?r+1:t)},Wi=(e,n)=>{const{floor:t,cap:o}=ei(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(_t.reorderComponent(Se,e,i),_t.select({index:i}),{moved:!0,dest:i})},Di=(e,n,t,o)=>{Vo(L),_t.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),Mr(Rt.sectionAdded({name:t}))},Gi=(e,n)=>{const t=Fi(n),o=rr(e,{nodeDefaults:ci,newNodeId:Ce,sectionLabel:ai,blockIsOffered:lr}),r=o?_t.insertNode(Se,t,o):_t.insertSection(e,t);return Di(t,r,ai(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:c}of be(zt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=ir(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:c,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Ji=e=>Ui(Se,e),Ui=(e,n)=>{Pr.current=document.activeElement??null,uo&&(Mo.current=To.current,To.current=!1,fo()),jo(null===n?null:{zone:e,index:n}),$o(!0),eo||(Mo.current=!0,vt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Yi=()=>{$o(!1),jo(null),Mo.current&&vt({type:"setUi",ui:{leftSideBarVisible:!1}}),Mo.current=!1},Ki=(e,n)=>sr.rowName?n?Tt(e)?sr.rowName(e,"section",Rt.header):At(e)?sr.rowName(e,"section",Rt.footer):Nt(e.type)?sr.rowName(e,"section",di(e.type)):pi(e):Ci(e):n?ai(e.type):di(e.type),Zi=e=>n=>{e()},Xi=()=>qo.editPinnedSource?.(),qi=(e,n,t)=>{if(ut)return null;const o=hi(e)[n];return o&&!ke(zt,o.type).delete?null:/* @__PURE__ */Jn(Le,{kind:"delete",label:Rt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=hi(e)[n]?.props?.id;null!=t&&li(String(t))})(e,n),children:/* @__PURE__ */Jn(Fn,{size:15})})},_i=e=>sr.rowPreview?.(e)||void 0,Qi=e=>sr.rowMarks?.(e)??void 0,el=(e,n,t)=>sr.rowActions?.(e,n,t)??null,nl=(e,n,t,o)=>{if(ut)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
10
+ return Jn(Le,{kind:"eye",label:r?Rt.showNamed({name:o}):Rt.hideNamed({name:o}),onClick:()=>ol(e,n,t),children:/* @__PURE__ */Jn(r?Wn:Dn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},tl=e=>ms(Se,e),ol=(e,n,t)=>{_t.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},rl=e=>we(zt,e),il=e=>be(zt,e),ll=e=>er.slotsOf?gi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:xe(e,n.slot)})):[{slot:null,rung:null,kids:il(e)}],sl=e=>er.slotsOf?ll(e).flatMap(e=>e.kids):il(e),dl=e=>Boolean(er.slotsOf)&&gi(e).some(e=>e.rung),cl=(e,n,t)=>null===t?void 0===n?ir(e):ir(e,n):ir(e,n,t),al=(e,n,t)=>{const o=ze(zt,e.type,n)&&(t||sl(e).length>0||dl(e));return{collapsible:o,folded:o&&Ir(String(e.props.id))}},pl=(e,n,t)=>ll(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>al(e,r,t(e.type)).collapsible?[String(e.props.id),...pl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),ul=e=>sl(e).length>0||dl(e)||Boolean(ir(e.type)),fl=e=>Boolean(ir(e)),hl=(e,n,t,o)=>{if(Vo(L),ir(o)?.spec?.slider){const t=e.split(":")[0];a(t,n),_t.select({index:n,zone:e}),c(t)}else _t.select({index:n,zone:e}),Vi(t)},ml=(e,n,t,o,r)=>{const i=`${e}:${n}`;_t.insertComponent(i,t,o),ir(r)?.spec?.slider?requestAnimationFrame(()=>{a(e,o),_t.select({index:o,zone:i})}):_t.select({index:o,zone:i})},gl=In(/* @__PURE__ */new Set);Pn(()=>{Qr.forEach(e=>{const n=ir(e.type)?.spec;if(!n)return;const t=e.props.id;if(gl.current.has(t))return;gl.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(ci)).forEach((e,t)=>Zt.seedChild(o,t,n.childType,e))})},[Qr,Zt,ci]);const yl=In(/* @__PURE__ */new Set);Pn(()=>{Qr.forEach((e,n)=>{const t=e.props.id;if(yl.current.has(t))return;const o=i(e,rl(e.type));yl.current.add(t),o&&Zt.replaceComponent(Se,n,{...e,props:o})})},[Qr,Zt]),U(Zt,zt);const Sl=Qr.findIndex(At),kl=Sl>=0?Qr[Sl]:null,vl=jt?Qr.findIndex(Tt):-1,bl=vl>=0?Qr[vl]:null,wl=Ct.groupTab,xl=On(()=>wl?e=>Nt(e.type):void 0,[wl]),zl=Boolean(Ct.groupBadge),Cl=Ct.groupBadge?/* @__PURE__ */Jn("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Jn(An,{tone:"info",size:"xs",children:Ct.groupBadge})}):void 0,Bl=Qr.find(e=>e.type===It)??null,Il=Qr.find(e=>e.type===Ot)??null,Ol=Sl>=0?Sl:Qr.length,Nl=[];Qr.forEach(e=>{At(e)||(ul(e)&&Nl.push(String(e.props.id)),Nl.push(...pl(e,1,fl)))}),kl&&(Nl.push(String(kl.props.id)),Nl.push(...pl(kl,1,fl)));const Pl=Nl.length>0&&Nl.every(e=>vr.has(e)),$l=e=>{const n=sr.blockRowName(e,di);return sr.rowName?sr.rowName(e,"block",n):n},Ml=(e,n,t,o)=>{const r=hi(e)[t];if(!r)return;const i={...zn(e),index:t},l={...zn(n),index:Math.min(Math.max(o,0),hi(n).length)},s=pn(i,l);if(e!==n||s!==t)try{ii.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Bn))throw e}},Tl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of il(e))n.add(r),t(o)};for(const t of rl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Al=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ui.get(n);if(!e)return null;if(e.zone===Se)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},jl=e=>{const n=e.slice(0,e.indexOf(":")),t=Qr.find(e=>Nt(e.type)&&String(e.props.id)===n);return t&&Pt(n)===e?t:null},Ll=(e,n)=>{const t=jl(e);return!t||(!Ct.groupAccepts||Ct.groupAccepts(t.type,n,hi(e).length))},Rl=(e,n,t)=>{if(e.rung){const t=mi(e.rung.nodeId),o=t?gi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===et&&n.index>=0&&n.index<=o}if(n.slot===et)return!1;if(e.add)return Fl(e.add,n);const o=xn(n);if(Nt(e.type))return!1;const r=jl(o),i=jl(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!Ll(o,e.type))&&(n.index>=0&&n.index<=hi(o).length));if(e.zone===Se||o===Se){if(e.zone!==o)return!1;const{floor:t,cap:r}=ei();return n.index>=t&&n.index<=r}if(n.index<0||n.index>hi(o).length)return!1;if(e.zone===o)return!0;const l=kl&&!Ct.lastIsOpen?String(kl.props.id):null;return(!l||Al(e.zone)!==l&&Al(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??hi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ui.get(i),s=l?hi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Tl(r).has(n))return!1;const d=ir(s.type,or(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?.(hi(n),r))})(e.zone,o,e.index,t)},El=(e,n)=>{const t=xn(e.from),o=e.node;return t===xn(n)?Ll(t,o.type):Rl({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Vl=e=>{const n=e.slice(0,e.indexOf(":")),t=ui.get(n),o=t?hi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=ir(o.type,or(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:di(r.spec.childType)}]:[]),l=yi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Ki(o,t.zone===Se)}},Hl=(e,n)=>{if("section"!==e.kind)return e;const t=xn(n);return t===Se||jl(t)?e:Vl(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},Fl=(e,n)=>{const t=Hl(e,n),o=xn(n);if("block"!==t.kind){if(jl(o)){const e="section"===t.kind?t.type:t.template.node.type;return Ll(o,e)&&n.index>=0&&n.index<=hi(o).length}if(o!==Se)return!1;const{floor:e,cap:r}=ei();return n.index>=e&&n.index<=r}if(o===Se)return!1;const r=Vl(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(hi(o))},Wl=(e,n)=>{const t=Hl(e,n);if("block"!==t.kind&&jl(xn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&Ll(n,o)){if("section"===e.kind)_t.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;_t.insertNode(n,t,oi(e.template.node))}Vo(L),_t.select({index:t,zone:n})}})(t,xn(n),n.index);if("section"===t.kind)return void Gi(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Fi(t),r=_t.insertNode(Se,o,n);Di(o,r,e)})(t.template.name,oi(t.template.node),n.index);const o=xn(n),r=Vl(o);r&&(r.target.spec?ml(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{_t.insertComponent(e,n,t),Vo(L),_t.select({index:t,zone:e})})(o,t.type,n.index))},Dl=(e,n)=>{e.rung?wi(e.rung.nodeId,e.index,n.index):e.add?Wl(e.add,n):e.zone===Se?Wi(e.index,n.index):Ml(e.zone,xn(n),e.index,n.index)},[Gl]=Nn(()=>cn()),Jl=an({keyOf:e=>e.id,readOnly:Boolean(ut),session:Gl,canDrop:Rl,onDrop:Dl,onStep:(e,n)=>{e.rung?wi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Se?((e,n)=>{const t=ai(Qr[e]?.type??""),o=Wi(e,n<0?e-1:e+2);if(!o.moved)return void Mr(n<0?Rt.sectionFirst({name:t}):Rt.sectionLast({name:t}));const{floor:r,cap:i}=ei();Mr(Rt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Ml(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Ul=$n(e=>{const{floor:n,cap:t}=ei(),o=[];for(const r of e.nodes){const e=xn(r.place),i=hi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Tt(i)||At(i)||nr(i.type))continue;if(Nt(i.type))continue;const l=Boolean(jl(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?ai(i.type):Ci(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=xn(e.list);if(n===Se&&0===e.children.length)return[{...e,addLabel:Rt.addSection,addAlways:!0}];const t=Vl(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(jl(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=xn(e.list),t=n===Se||jl(n)?null:Vl(n);return t?.choices.length?rn(e,t.target.spec?.addLabel??Rt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[kt.data]),Yl=null==wt?.props.id?null:String(wt.props.id),Kl=$n(e=>{const n=zt,t=e=>!e.item.rung&&null!==Cn(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(Yl);return i||(r($e(kt.data,n,o.item.id,Yl,xl))??o)},[kt.data,zt,Yl,xl]),[Zl,Xl]=Nn(null);gn(xo,"mouseover",e=>{if(!wl)return;const n=yn(e.target),t=n?Zn(kt.data,zt,n):null;t!==Zl&&Xl(t)}),gn(xo,"mouseout",e=>{wl&&!e.relatedTarget&&Xl(null)});const ql=e=>Tt(e)||At(e)||Nt(e.type),_l=[];if(wl){const e=Yl?Zn(kt.data,zt,Yl):null;for(const n of/* @__PURE__ */new Set([e,Zl])){const e=n?Qr.find(e=>String(e.props.id)===n):void 0;if(!e||!ql(e))continue;const t=wl(e);t&&_l.push({id:String(e.props.id),label:t,below:Tt(e)||e.type===It})}}const Ql=le(),es=In(null);Pn(()=>{const e=Ct.changeNotice;if(!e)return;const n=JSON.stringify(Qr.filter(ql)),t=es.current;if(es.current={doc:kn,bands:n,index:bt.index},!t||t.doc!==kn||t.bands===n)return;bt.hasPast&&bt.index>=t.index&&!Kn.has(Ql)&&(Kn.add(Ql),Mr(e,"success",{action:{label:Rt.bar.undo,onClick:()=>bt.back()},duration:8e3}))},[Qr]);const ns=e=>{Vo(L),_t.select(e.zone===Se?{index:e.index}:{index:e.index,zone:e.zone})},ts=Y(),os=()=>({data:kt.data,device:so,ops:_t,inspector:Xo}),rs=ts?.model,is=On(()=>rs?e=>rs(e,Ul(e),os()):Ul,[rs,Ul,so]),ls=ts?.measure,ss=ls?(e,n)=>ls(e,n,os()):void 0,ds=ts?.canDrop,cs=ds?(e,n)=>ds(e,n,Rl,os()):Rl,as=ts?.drop,ps=as?(e,n)=>as(e,n,Dl,os()):Dl,us=ts?.pick,fs=us?e=>us(e,ns,os()):ns,hs=e=>{const n=xn(e),t=yi(n);t&&vi(t.node,t.slot,!1),Ui(n,e.index)},ms=(e,n)=>/* @__PURE__ */Jn(Re,{...ut?{}:Jl.seam({place:{...zn(e),index:n}})},`seam:${e}:${n}`),gs={rowClick:Zi,isCollapsed:Ir,toggleCollapse:Or},ys=e=>{const n=String(e.props.id),t=Qr.findIndex(e=>String(e.props.id)===n),o=Pt(n),r=hi(o),i=Ir(n),l=di(e.type),s=sr.rowName?sr.rowName(e,"section",l):l,d=e=>ms(o,e);/* @__PURE__ */
11
+ return Un(Yn,{children:[
12
+ /* @__PURE__ */Jn(Me,{words:Et,icon:/* @__PURE__ */Jn(cr,{type:e.type,size:13}),name:s,preview:_i(e),marks:Qi(e),onSelect:()=>Hi(t),nameSlot:Ii(Se,t,n,s),selected:Fo===n,badge:Cl,actions:el(e,Se,t)??void 0,rowProps:{"data-node-id":n,onClick:Zi(()=>Hi(t))},fold:{open:!i,label:"section",onToggle:()=>Or(n)}}),!i&&/* @__PURE__ */Un(Te,{children:[r.map((n,t)=>{const r=String(n.props.id),i=pi(n),l=ul(n),s=l&&Ir(r),c=()=>hl(o,t,r,e.type),{rowProps:a,...p}=Jl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...zn(o),index:t}},{"data-node-id":r,onClick:Zi(c)});/* @__PURE__ */
13
+ return Un(Tn,{children:[d(t),
14
+ /* @__PURE__ */Jn(Me,{words:Et,icon:/* @__PURE__ */Jn(cr,{type:n.type,size:13}),name:i,preview:_i(n),marks:Qi(n),onSelect:c,nameSlot:Ii(o,t,r,i),selected:Fo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Or(r)}:void 0,actions:/* @__PURE__ */Un(Yn,{children:[qi(o,t,i),el(n,o,t),nl(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Jn(Te,{children:vs(n,2)})]},r)}),d(r.length)]})]})},Ss=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Jl.dragging,d=!Ir(l)&&s?.rung?.nodeId!==i,c={...zn(l),index:0},a=s&&!s.rung&&Rl(s,c)?c:void 0,p=()=>vi(e,n,!0),{rowProps:u,...f}=Jl.row({item:{id:`rung:${l}`,zone:`${i}:${et}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:et,index:t},into:a,canDrag:Boolean(er.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Zi(p)}),h=ut?null:er.slotActions?.(e,n.slot);/* @__PURE__ */
15
+ return Un(Tn,{children:[n.heading,
16
+ /* @__PURE__ */Jn(Me,{words:Et,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Si===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Or(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(ut||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&bi(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(Gn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Jn(Te,{children:r})]},l)},ks=(e,n)=>{const t=ll(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=cl(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)=>ms(e,n),p=/* @__PURE__ */Un(Yn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Fo===String(n.props.id),{collapsible:i,folded:s}=al(n,l,fl(n.type)),d=String(n.props.id),c=$l(n),p=()=>hl(t,o,d,e.type),{rowProps:u,...f}=Jl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...zn(t),index:o}},{"data-node-id":d,onClick:Zi(p)});/* @__PURE__ */
18
+ return Un(Tn,{children:[0===o&&a(t,0),
19
+ /* @__PURE__ */Jn(Me,{words:Et,icon:/* @__PURE__ */Jn(cr,{type:n.type,size:13}),name:c,preview:_i(n),marks:Qi(n),onSelect:p,nameSlot:Ii(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Or(d)}:void 0,actions:/* @__PURE__ */Un(Yn,{children:[qi(t,o,c),el(n,t,o),nl(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Jn(Te,{children:ks(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?Ss(e,t.rung,r++,o,p):/* @__PURE__ */Jn(Tn,{children:p},t.slot??"")})})},vs=(e,n)=>{const t=or(kt?.data,e.type,String(e.props.id)),o=ll(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=cl(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)=>ms(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=Fo===String(n.props.id),i=Ci(n),l=String(n.props.id),{collapsible:d,folded:c}=al(n,s,fl(n.type)),a=rl(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...zn(p),index:hi(p).length}:void 0,f=Jl.dragging,h=u&&f&&Rl(f,u)?u:void 0,g=()=>hl(t,o,l,e.type),{rowProps:y,...S}=Jl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...zn(t),index:o},into:h,canDrag:!nr(n.type)},{"data-node-id":l,onClick:Zi(g)});/* @__PURE__ */
21
+ return Un(Tn,{children:[0===o&&m(t,0),
22
+ /* @__PURE__ */Jn(Me,{words:Et,icon:/* @__PURE__ */Jn(cr,{type:n.type,size:13}),name:i,preview:_i(n),marks:Qi(n),onSelect:g,nameSlot:Ii(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Or(l)}:void 0,actions:nr(n.type)?el(n,t,o)??void 0:/* @__PURE__ */Un(Yn,{children:[qi(t,o,i),el(n,t,o),nl(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Jn(Te,{children:vs(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:()=>ml(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?Ss(e,o.rung,i++,r,S):/* @__PURE__ */Jn(Tn,{children:S},o.slot??"")})})},bs=Po||null!==uo,ws=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:eo&&!bs&&Qo===e.id,onSelect:()=>Zr(e.id)}:e,xs=[...(qo.railLead??[]).map(ws),{id:"sections",label:Rt.layers,icon:/* @__PURE__ */Jn(Ve,{}),active:eo&&!bs&&"sections"===Qo,onSelect:()=>Zr("sections")},...(qo.railTrail??[]).map(ws)];po?xs.push({id:"media",label:Rt.railMedia,icon:/* @__PURE__ */Jn(He,{}),active:eo&&!Po&&(null!==uo||"media"===Qo),onSelect:()=>Zr("media")}):gt&&xs.push({id:"media",label:Rt.railMedia,icon:/* @__PURE__ */Jn(He,{}),onSelect:Xr});const zs=[...qo.railLead??[],...qo.railTrail??[]].find(e=>"panel"in e&&e.id===Qo),Cs=Boolean(Lt?.foldable)&&!_o,Bs=Lt?.label??(yt?Rt.pageSections:Rt.templateSections),Is=Cs&&Ir(nt),Os=/* @__PURE__ */Un(Yn,{children:[Qr.map((e,n)=>{if(Tt(e)||At(e)||Nt(e.type))return null;const t=Fo===String(e.props.id),o=Boolean(e.props._hidden);il(e);const r=String(e.props.id),i=qo.hasOwnRows?.(e)??!1,l=ul(e)||i,s=l&&Ir(r),d=rl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...zn(c),index:hi(c).length}:void 0,p=Jl.dragging,u=a&&p&&Rl(p,a)?a:void 0,{rowProps:f,...h}=Jl.row({item:{id:r,zone:Se,index:n,type:e.type},place:{...zn(Se),index:n},into:u},{"data-node-id":r,onClick:Zi(()=>Hi(n))});/* @__PURE__ */
24
+ return Un(Tn,{children:[n>0&&tl(n),
25
+ /* @__PURE__ */Jn(Me,{words:Et,icon:/* @__PURE__ */Jn(cr,{type:e.type,size:13}),name:pi(e),preview:_i(e),marks:Qi(e),onSelect:()=>Hi(n),nameSlot:Ii(Se,n,r,pi(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Or(r)}:void 0,actions:/* @__PURE__ */Un(Yn,{children:[qi(Se,n,pi(e)),el(e,Se,n),nl(Se,n,e,pi(e))]}),rowProps:f}),ul(e)&&!s&&/* @__PURE__ */Un(Te,{children:[vs(e,1),qo.partRows?.(e,gs)]}),i&&!s&&/* @__PURE__ */Jn(Te,{children:qo.ownRows?.(e,n,gs)})]},String(e.props.id??n))}),!_o&&Ol>0&&tl(Ol)]}),Ns=(e,n,t)=>{const o=String(e.props.id),r=sl(e).length>0||dl(e)||Boolean(ir(e.type)),i=r&&Ir(o),l="header"===t?Rt.header:Rt.footer,s=sr.rowName?sr.rowName(e,"section",l):l;/* @__PURE__ */
26
+ return Un(Yn,{children:[
27
+ /* @__PURE__ */Jn(Me,{words:Et,icon:/* @__PURE__ */Jn(cr,{type:t,size:13}),name:s,preview:_i(e),marks:Qi(e),badge:Cl,onSelect:()=>Hi(n),nameSlot:Ii(Se,n,o,s),selected:Fo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Or(o)}:void 0,actions:el(e,Se,n)??void 0,rowProps:{"data-node-id":o,onClick:Zi(()=>Hi(n))}}),r&&!i&&/* @__PURE__ */Jn(Te,{children:ks(e,1)})]})};return(qo.wrap??(e=>e))(
28
+ /* @__PURE__ */Jn(K,{target:xo,children:/* @__PURE__ */Un("div",{ref:wo,className:"sf-editor es-editor",style:qe(wr),onContextMenu:Ti.onEditorContextMenu,...m(fn),children:[
29
+ /* @__PURE__ */Un(Fe,{children:[
30
+ /* @__PURE__ */Jn(We,{items:xs,ariaLabel:Rt.bar.views}),
31
+ /* @__PURE__ */Un(De,{children:[
32
+ /* @__PURE__ */Jn(Ge,{label:Rt.bar.undo,disabled:Boolean(ut)||!bt.hasPast,onClick:()=>bt.back(),children:/* @__PURE__ */Jn(Rn,{})}),
33
+ /* @__PURE__ */Jn(Ge,{label:Rt.bar.redo,disabled:Boolean(ut)||!bt.hasFuture,onClick:()=>bt.forward(),children:/* @__PURE__ */Jn(En,{})}),
34
+ /* @__PURE__ */Jn(Je,{}),
35
+ /* @__PURE__ */Jn(Ue,{devices:to,value:so,onChange:co}),
36
+ /* @__PURE__ */Jn(Ge,{label:Rt.bar.refresh,tip:Rt.bar.refreshTip,onClick:()=>{bo.current=(()=>{const e=xo?.document;if(!e)return null;const n=Qr.findIndex(At),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=wt?.props?.id??Qr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),vo(e=>e+1)},children:/* @__PURE__ */Jn(Vn,{})})]}),
37
+ /* @__PURE__ */Un(De,{kind:"right",style:{minWidth:300},children:[
38
+ /* @__PURE__ */Jn(l,{input:Oo,words:Rt.saveStatus}),qo.barLead?.(),qo.barTrail?.(),qo.mainAction||!qo.barMain?/* @__PURE__ */Jn(s,{input:Oo,action:qo.mainAction??{label:Rt.done,onPress:()=>{rt(kt.data)}},readOnly:Boolean(ut),saveSwitch:ht,onToggleAutoSave:dt,onSaveNow:No,bar:Rt.bar,words:Rt.saveStatus}):qo.barMain()]})]}),
39
+ /* @__PURE__ */Jn(ee,{}),
40
+ /* @__PURE__ */Un("div",{className:"sf-body",children:[eo?/* @__PURE__ */Un(Yn,{children:[
41
+ /* @__PURE__ */Jn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Rt.leftPanel,children:Po?/* @__PURE__ */Jn(x,{at:Ao?{label:(e=>{const n=jl(e.zone);if(n)return Rt.add.addingTo({name:sr.rowName?Ki(n,!0):di(n.type)});if(e.zone===Se){const n=Qr[e.index];return n&&!At(n)?Rt.add.addingBefore({name:Ki(n,!0)}):Rt.add.addingAtEnd}const t=Vl(e.zone);return t?Rt.add.addingTo({name:t.parentName}):Rt.add.addingHere})(Ao),onClear:()=>jo(null)}:void 0,placeBlocks:Ao&&Ao.zone!==Se?Vl(Ao.zone)?.choices:void 0,canTake:Ao?e=>{if(!Ao)return null;const n={...zn(Ao.zone),index:Ao.index};if(Fl(e,n))return null;const t=jl(Ao.zone);if(t)return Rt.add.notInside({name:Ki(t,!0)});if(Ao.zone===Se)return Rt.add.onlySections;const o=Vl(Ao.zone);return o?Rt.add.notInside({name:o.parentName}):Rt.add.onlySections}:void 0,onPick:Ao?e=>{if(!Ao)return;const n={...zn(Ao.zone),index:Ao.index};Fl(e,n)&&(Wl(e,n),Yi())}: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:Gl,siteWide:qo.addPanelRow?.(Yi),onClose:Yi,onHide:Yr,readOnly:Boolean(ut)}):uo&&ao?
42
+ /* @__PURE__ */Jn(B,{panel:ao,pick:uo,onHide:Yr}):zs?zs.panel({onHide:Yr,notify:Mr}):"media"===Qo&&ao?/* @__PURE__ */Jn(B,{panel:ao,pick:null,onHide:Yr}):/* @__PURE__ */Un(Yn,{children:[
43
+ /* @__PURE__ */Jn(z,{icon:/* @__PURE__ */Jn(Ve,{}),title:Rt.layers,context:Jt,actions:/* @__PURE__ */Un(Yn,{children:[!ut&&/* @__PURE__ */Jn(Ye,{label:Rt.add.title,onClick:()=>Ji(null),children:/* @__PURE__ */Jn(Hn,{size:15})}),
44
+ /* @__PURE__ */Jn(Ye,{label:Pl?Rt.expandAll:Rt.collapseAll,title:0===Nl.length?Rt.nothingToFold:void 0,disabled:0===Nl.length,onClick:()=>br(e=>{const n=new Set(Nl);return Pl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Nl])}),children:/* @__PURE__ */Jn(qn,{expand:Pl})})]}),onHide:Yr}),
45
+ /* @__PURE__ */Un(Ae,{className:"sf-tree sf-scroll",words:Et,children:[
46
+ /* @__PURE__ */Jn(Me,{words:Et,icon:/* @__PURE__ */Jn(cr,{type:"page",size:13}),name:Rt.pageSettings,onSelect:qr,selected:!wt&&Ho,rowProps:{onClick:Zi(qr)}}),Bl&&/* @__PURE__ */Un(Yn,{children:[!zl&&/* @__PURE__ */Jn(je,{children:Rt.header}),ys(Bl)]}),!_o&&St&&!(zl&&Bl)&&/* @__PURE__ */Un(Yn,{children:[!zl&&/* @__PURE__ */Jn(je,{children:Rt.header}),!jt&&/* @__PURE__ */Jn(Me,{words:Et,icon:/* @__PURE__ */Jn(cr,{type:"header",size:13}),name:Rt.header,badge:Cl,onSelect:_r,selected:Eo.kind===Mt?.kind,rowProps:{onClick:Zi(_r)}})]}),!_o&&bl&&!(zl&&Bl)&&Ns(bl,vl,"header"),!_o&&!Cs&&/* @__PURE__ */Jn(je,{children:Bs}),Cs?/* @__PURE__ */Un(Yn,{children:[
47
+ /* @__PURE__ */Jn(Me,{words:Et,icon:null,name:Bs,fold:{open:!Is,label:Bs,onToggle:()=>Or(nt)}}),!Is&&/* @__PURE__ */Jn(Te,{children:Os})]}):Os,St&&!zl&&/* @__PURE__ */Jn(je,{children:Rt.footer}),kl&&!(zl&&Il)&&Ns(kl,Sl,"footer"),!_o&&!kl&&St&&!zl&&/* @__PURE__ */Jn(Me,{words:Et,icon:/* @__PURE__ */Jn(cr,{type:"footer",size:13}),name:Rt.footer,onSelect:Xi,rowProps:{onClick:Zi(Xi),title:Rt.editFooter}}),Il&&ys(Il),qo.treeFoot?.()]})]})}),
48
+ /* @__PURE__ */Jn(Ke,{side:"left",width:wr.left,min:Xe,max:Ze,defaultWidth:S.left,label:Rt.resizeLeftPanel,onResize:Cr})]}):/* @__PURE__ */Jn(C,{side:"left",onShow:Yr}),
49
+ /* @__PURE__ */Un("div",{ref:Tr,className:"sf-center sf-scroll","data-sf-canvas-head":Er?"":void 0,style:{overflowX:Gr?"auto":"hidden",overflowY:"hidden"},children:[Er&&/* @__PURE__ */Jn("div",{ref:Vr,className:"sf-canvas-head",children:/* @__PURE__ */Jn(Er,{device:so})}),
50
+ /* @__PURE__ */Un("div",{className:"sf-frame-scaler",style:Jr,children:[
51
+ /* @__PURE__ */Jn("div",{className:"sf-frame "+(so===io?"":`sf-frame--${so}`),style:Ur,children:/* @__PURE__ */Un("div",{className:"sf-preview-host",children:[
52
+ /* @__PURE__ */Jn(Oe.Provider,{value:xl,children:/* @__PURE__ */Jn(Ut,{},ko)}),
53
+ /* @__PURE__ */Jn(ln,{canvas:xo,session:Gl,model:is,measure:ss,canDrop:cs,onDrop:ps,choose:Kl,onPick:fs,onZoneAdd:hs,onSeamAdd:hs,zoneAddLabel:Rt.canvasAddBlock,words:Vt.canvas,readOnly:Boolean(ut),revision:kt.data}),Lo.length>0&&!zo&&/* @__PURE__ */Jn("div",{className:"sf-preview-gaps",children:Lo.map(e=>
54
+ /* @__PURE__ */Jn(sn,{index:e.index,label:Rt.addSectionHere,onInsert:()=>Ji(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))})]})}),wl?/* @__PURE__ */Jn(Xn,{canvas:xo,tabs:_l,onSelect:e=>{const n=Qr.findIndex(n=>String(n.props.id)===e);n>=0&&Hi(n)}}):null]})]}),no?/* @__PURE__ */Un(Yn,{children:[
55
+ /* @__PURE__ */Jn(g,{value:{selectChild:hl,addChild:ml,childRowName:Ci,blockRowName:$l},children:/* @__PURE__ */Jn(Yt,{mode:Eo,onOpenWebsiteSettings:qo.openSettings??(()=>{}),onOpenSiteStyles:qo.openStyles,onSelectNode:fr,onNotify:Mr,onHidePanel:Kr,nodeActions:wt?ke(zt,wt.type):tt})}),
56
+ /* @__PURE__ */Jn(Ke,{side:"right",width:wr.right,min:Xe,max:Ze,defaultWidth:S.right,label:Rt.resizeSettingsPanel,onResize:Br})]}):
57
+ /* @__PURE__ */Jn(C,{side:"right",onShow:Kr})]}),Ti.menu]})}))}export{ot as ScreenChrome};
@@ -0,0 +1 @@
1
+ import{useEaselSession as e}from"./chunk-O7Q4DDJT.js";import{useHostEscape as n}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-VVPZMWJE.js";import{styleMenuItems as o}from"./chunk-V7U33NF2.js";import{createNodeClipboard as l,nodeMenuItems as r}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as i}from"./chunk-WK3AFPXY.js";import{ROOT_ZONE as c}from"./chunk-PLVEGYK6.js";import{easelMenuEntries as s,menuLabel as a}from"./chunk-BALFHI3G.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-X4T6JT3M.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as z,LayersIcon as P,CopyIcon as O}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,n){const t=[],o=/* @__PURE__ */new Set;let l={zone:n.zone,index:n.index};for(;l;){const n=e.nodeAt(l.zone,l.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:l.zone,index:l.index,node:n,parentType:null}),l.zone===c)break;const r=l.zone.lastIndexOf(":");if(r<=0)break;l=e.locate(l.zone.slice(0,r))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var K=l(),M=/* @__PURE__ */new WeakMap;function j(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",l);let t=M.get(n);return t||(t=l(),M.set(n,t)),t}function S(){return j(e())}function T(e,n,t){if(n===c){const{floor:n,cap:o}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function X(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function E(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?T(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=T(e,l.zone,l.index+1);if(o(n,t))return t}return null}function L(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(u(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function V(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=X(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:E(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function I(e,n){const{zone:t,index:l}=n,i=e.nodeAt(t,l);if(!i)return[];const s=i.props.id,a=e.labelOf(i.type,t),u=Boolean(i.props._hidden),d=e.nodeOps,p=e.isPinned(i,t),f=e.isLocked(i),m=!p&&!f&&!e.duplicateBlocked(i),h=e.permits?.(i)??{duplicate:!0,delete:!0},y=X(e,i,t),k=D(e,n),b=d.held,v=b&&!p?E(e,b,n):null,g=!e.readOnly,w=e.style?o({held:g?e.style.held():null,canCopy:e.style.canCopy(i,t),onCopy:()=>e.style?.copy(i,t),onPaste:()=>e.style?.paste(t,l,i),words:e.words?.styleClipboard}):[];return r({title:a,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},l=n.zone===c?null:e.slotRung?.(n.zone)??null;return l?[o,{label:l.label,checked:!1,onClick:l.select}]:[o]})},actions:{duplicate:g&&m&&h.duplicate?()=>d.duplicate(s):void 0,moveUp:g&&d.canStep(s,-1)?()=>d.step(s,-1):void 0,moveDown:g&&d.canStep(s,1)?()=>d.step(s,1):void 0,copy:y.copy?()=>d.copy(s,a):void 0,cut:g&&y.cut?()=>d.cut(s,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&e.renamePropOf(i,t)?()=>e.beginRename(t,l):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(s,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(s):void 0},style:w,extras:e.menuRows?.(i,t,l)??void 0,pinnedLine:p?R(e).pinned:void 0})}var R=e=>e.words?.screen??t.menu;function B(e){const n=R(e),o=!e.readOnly,l=[];o&&e.history.hasPast&&l.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&l.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const r=[],s=e.nodeOps.held,a=T(e,c,e.sectionBand().cap);if(o&&s&&(e.canPasteAt?e.canPasteAt(s,a):f(s.from)===c)){const n=a,t=e.words?.menu??i;r.push({label:t.pasteNamed({paste:t.paste,label:s.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[l,r,[{label:e.pageSettingsLabel??t.pageSettings,icon:/* @__PURE__ */A(z,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */A(P,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function U(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},c=e.words?.menu??i,s=R(e),a=[];l&&(a.push({label:c.copy,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),a.push({label:c.cut,icon:/* @__PURE__ */A(O,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),a.push({label:c.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[a,n.value?[{label:s.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function Y(e){return e.shiftKey}function F(e,t){const[o,l]=y(null),r=k(()=>l(null),[]);n(null!==o,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=L(e);if(!o)return;const l=t.selected();if(!l)return;const r=V(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(t,"keydown",c);const a=k(n=>{if(Y(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(t,"contextmenu",n=>{if(Y(n)||!t)return;const o=n.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;n.preventDefault();const c=p(t.frame,n.clientX,n.clientY),s=t.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(t,"mousedown",r),d(t,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:o?/* @__PURE__ */A(N,{host:e,target:o,onClose:r}):null,closeMenu:r}}function N({host:e,target:n,onClose:t}){const o="node"===n.kind?I(e,n):"input"===n.kind?U(e,n.el):B(e);return 0===o.length?null:/* @__PURE__ */A(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":a(o),items:s(o)})}export{K as EASEL_NODE_CLIPBOARD,D as ancestorChain,j as nodeClipboardOf,X as nodeClipboardRules,I as nodeMenuItems,L as nodeShortcut,B as pageMenuItems,E as pastePlace,V as runNodeShortcut,U as textMenuItems,S as useNodeClipboard,F as useNodeContextMenu};
@@ -0,0 +1 @@
1
+ import{easelMenuEntries as o,menuLabel as e}from"./chunk-BALFHI3G.js";import{ContextMenu as r}from"efficient-shell/ui";import{jsx as t}from"react/jsx-runtime";function n({x:n,y:l,items:i,onClose:m,owner:s,portalTo:u}){return 0===i.length?null:/* @__PURE__ */t(r,{at:{x:n,y:l},owner:s??u??null,onClose:m,"aria-label":e(i),items:o(i)})}export{n as EaselContextMenu};
@@ -1 +1 @@
1
- export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-SO5OLDH7.js";export{fieldIsShown,showWhenOf,shownFields,withShowWhen}from"../chunk-BPXEFVSQ.js";export{FieldSlider}from"../chunk-XWFH2NHZ.js";import"../chunk-4JSBIW5H.js";import"../chunk-K56YDHYQ.js";import"../chunk-EA2HTX37.js";import"../chunk-RC25EGHD.js";import"../chunk-KFV7N2DJ.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";export{FieldNumber}from"../chunk-2XMHLXMA.js";export{FieldSelect,optionFor}from"../chunk-G3GWAP5R.js";import"../chunk-WRFD4EXD.js";import"../chunk-36LVP5WD.js";import"../chunk-MFIRYGHW.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
1
+ export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-N3LYD2LK.js";export{fieldIsShown,showWhenOf,shownFields,withShowWhen}from"../chunk-BPXEFVSQ.js";export{FieldSlider}from"../chunk-XWFH2NHZ.js";import"../chunk-4JSBIW5H.js";import"../chunk-K56YDHYQ.js";import"../chunk-BALFHI3G.js";import"../chunk-RC25EGHD.js";import"../chunk-KFV7N2DJ.js";export{useResolvedFields}from"../chunk-YRLPFZW3.js";export{FieldNumber}from"../chunk-2XMHLXMA.js";export{FieldSelect,optionFor}from"../chunk-G3GWAP5R.js";import"../chunk-WRFD4EXD.js";import"../chunk-36LVP5WD.js";import"../chunk-MFIRYGHW.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";
@@ -1,10 +1,12 @@
1
1
  import * as react from 'react';
2
2
  import { a as EaselContextMenuProps, E as EaselContextMenuItem } from '../types-BsyPh6EW.js';
3
3
  export { b as EaselContextMenuSkin } from '../types-BsyPh6EW.js';
4
+ import { DropdownMenuEntry } from 'efficient-shell/ui';
4
5
 
5
6
  /**
6
7
  * The editors' right-click menu: the shell's `ContextMenu` with an
7
- * {@link EaselMenuItems} list in it (harness UI-16, UI-24; efficient-easel#199).
8
+ * {@link easelMenuEntries} list as its `items` (harness UI-16, UI-24;
9
+ * efficient-easel#199, efficient-shell#580): the shell draws the rows.
8
10
  *
9
11
  * Up to 0.106.0 this drew a box of its own — moved here from the admin
10
12
  * portal's `RowContextMenu` (card 66400.d) with a skin, an edge flip, a
@@ -22,39 +24,32 @@ export { b as EaselContextMenuSkin } from '../types-BsyPh6EW.js';
22
24
  declare function EaselContextMenu({ x, y, items, onClose, owner, portalTo }: EaselContextMenuProps): react.JSX.Element | null;
23
25
 
24
26
  /**
25
- * The editors' item list, drawn with the shell's menu pieces (harness UI-16,
26
- * UI-24; efficient-easel#199 step 4).
27
+ * The editors' item list as the shell's menu entries (harness UI-16, UI-24;
28
+ * efficient-shell#580).
27
29
  *
28
30
  * What a menu OFFERS stays a list of {@link EaselContextMenuItem}s — the node
29
31
  * menu, the Layers rows, the canvas block and the list field build theirs from
30
- * registries, and so do the hosts — and this turns one into the shell's
31
- * `PopupMenuItem` / `PopupSubmenu` / `PopupMenuDivider` / `PopupMenuLabel`.
32
- * Render it inside the shell's `ContextMenu` (or `EaselContextMenu`, which
33
- * does that for you):
32
+ * registries, and so do the hosts. This turns one into the `DropdownMenuEntry`
33
+ * list that the shell's `ContextMenu` and `DropdownMenu` both take as `items`,
34
+ * and the shell draws every row with its one renderer:
34
35
  *
35
- * <ContextMenu {...menu.props}>
36
- * <EaselMenuItems items={items} onClose={menu.close} />
37
- * </ContextMenu>
36
+ * <ContextMenu {...menu.props} items={easelMenuEntries(items)} />
38
37
  *
39
- * `'—'` a `PopupMenuDivider`;
40
- * `header` a `PopupMenuLabel` (the first names the menu: `menuLabel`);
41
- * `children` a `PopupSubmenu` — the flyout the shell now has, which is
42
- * what retires UI-16's one exception (the email canvas block
43
- * menu's layer ladder). One level, as before: a child's own
44
- * `children` are not drawn;
45
- * otherwise a `PopupMenuItem`, `danger` kept.
38
+ * `'—'` a `divider`;
39
+ * `header` a `label` (the first names the menu: `menuLabel`);
40
+ * `children` a `submenu`. One level, as before: a child's own `children`
41
+ * are not offered. A flyout whose entries carry `checked` is a
42
+ * set of states (the layer a "Select layer" ladder is on), so
43
+ * its entries are `radio`s;
44
+ * otherwise an `item`, `danger` kept.
46
45
  *
47
- * A root item closes the menu after it acts (a `PopupMenuItem` at the root
48
- * leaves that to its caller); one in a submenu closes it through the shell.
49
- * `icon` and `shortcut` are drawn only when given, in the `es-menu-*` columns
50
- * `menu.css` lays out — no Tailwind class is written here (the hosts' Tailwind
51
- * does not scan this package); a flyout's tick is the shell's (`checked`).
46
+ * Choosing an entry closes the menu, then runs its `onClick` (the shell's
47
+ * order). Easel draws no row: only the glyph and the shortcut, which the
48
+ * shell's entries have no slot for, are laid out by `menu.css`
49
+ * (`es-menu-icon`, `es-menu-label`, `es-menu-shortcut`), and only when given.
52
50
  */
53
- declare function EaselMenuItems({ items, onClose }: {
54
- items: readonly EaselContextMenuItem[];
55
- onClose: () => void;
56
- }): react.JSX.Element;
51
+ declare function easelMenuEntries(items: readonly EaselContextMenuItem[]): DropdownMenuEntry[];
57
52
  /** The menu's accessible name: its first caption, as it has always been. */
58
53
  declare function menuLabel(items: readonly EaselContextMenuItem[]): string | undefined;
59
54
 
60
- export { EaselContextMenu, EaselContextMenuItem, EaselContextMenuProps, EaselMenuItems, menuLabel };
55
+ export { EaselContextMenu, EaselContextMenuItem, EaselContextMenuProps, easelMenuEntries, menuLabel };
@@ -1 +1 @@
1
- export{EaselContextMenu}from"../chunk-BXMXTO36.js";export{EaselMenuItems,menuLabel}from"../chunk-EA2HTX37.js";
1
+ export{EaselContextMenu}from"../chunk-WXFZD7WC.js";export{easelMenuEntries,menuLabel}from"../chunk-BALFHI3G.js";
@@ -1,17 +1,18 @@
1
1
  /*
2
2
  * efficient-easel/menu.css — the columns of an editor menu row.
3
3
  *
4
- * The box and the rows are efficient-shell's `ContextMenu` and `PopupMenu`
5
- * pieces since 1.0.0 (efficient-easel#199, harness UI-16 and UI-24), dressed
6
- * by `efficient-shell/ui.css`. A row from `EaselMenuItems` may carry three
7
- * things the shell's row has no slot for, and this sheet lays them out with
8
- * the shell's tokens and nothing else:
4
+ * The box and the rows are efficient-shell's: `ContextMenu` since 1.0.0
5
+ * (efficient-easel#199, harness UI-16 and UI-24), and its one entries renderer
6
+ * since efficient-shell#580, dressed by `efficient-shell/ui.css`. An entry
7
+ * from `easelMenuEntries` may carry a glyph and a shortcut the shell's entry
8
+ * has no slot of its own for, and this sheet lays them out with the shell's
9
+ * tokens and nothing else:
9
10
  *
10
11
  * .es-menu-icon the glyph before the label;
11
12
  * .es-menu-label the label, which takes the room between them;
12
13
  * .es-menu-shortcut the keyboard shortcut, right-aligned and quieter.
13
14
  *
14
- * A flyout's "you are here" tick is the shell's (`PopupMenuItem` `checked`,
15
+ * A flyout's "you are here" tick is the shell's (a `radio` entry,
15
16
  * efficient-shell 4.165.0), not a column of this sheet's.
16
17
  *
17
18
  * Import once, after the shell's sheet:
@@ -1 +1 @@
1
- export{AddBlockRow as default}from"../../chunk-GOABCALQ.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-EHBWUEEE.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VVPZMWJE.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-SMM3ST7A.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-23VM4PMV.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-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{AddBlockRow as default}from"../../chunk-OK7OH2ZN.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-PQRYAW2G.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VVPZMWJE.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-SMM3ST7A.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-N3LYD2LK.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-BALFHI3G.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-23VM4PMV.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-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-FRXE6EQN.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-62VPYC7F.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-EHBWUEEE.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-PLVEGYK6.js";import"../../chunk-SMM3ST7A.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-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-23VM4PMV.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-POSLNRTO.js";import"../../chunk-KAML3KQH.js";import"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{blockKey,AddSidePanel as default,sectionKey,templateKey}from"../../chunk-N2B32EZB.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-BVN33R76.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-62VPYC7F.js";import"../../chunk-HQ4VVRIC.js";import"../../chunk-PQRYAW2G.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-PLVEGYK6.js";import"../../chunk-SMM3ST7A.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-N3LYD2LK.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-BALFHI3G.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.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-23VM4PMV.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-POSLNRTO.js";import"../../chunk-KAML3KQH.js";import"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{MediaSidePanel as default}from"../../chunk-GS44HQ45.js";import"../../chunk-EHBWUEEE.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-SMM3ST7A.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-IE55HNMA.js";import"../../chunk-Z6PVRXVY.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-23VM4PMV.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-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{MediaSidePanel as default}from"../../chunk-63ZDVAVE.js";import"../../chunk-PQRYAW2G.js";import"../../chunk-R6WTQWAC.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-SMM3ST7A.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-N3LYD2LK.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-4JSBIW5H.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-BALFHI3G.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-YRLPFZW3.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-23VM4PMV.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-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
@@ -1 +1 @@
1
- export{EASEL_NODE_CLIPBOARD,ancestorChain,nodeClipboardOf,nodeClipboardRules,nodeMenuItems,nodeShortcut,pageMenuItems,pastePlace,runNodeShortcut,textMenuItems,useNodeClipboard,useNodeContextMenu}from"../../chunk-VJZDNOQ7.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-V7U33NF2.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-BXMXTO36.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-VVPZMWJE.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-EA2HTX37.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{EASEL_NODE_CLIPBOARD,ancestorChain,nodeClipboardOf,nodeClipboardRules,nodeMenuItems,nodeShortcut,pageMenuItems,pastePlace,runNodeShortcut,textMenuItems,useNodeClipboard,useNodeContextMenu}from"../../chunk-UVQR7W6I.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-VVPZMWJE.js";import"../../chunk-V7U33NF2.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-WXFZD7WC.js";import"../../chunk-OSPUG6S6.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-ECM5F6JJ.js";import"../../chunk-BALFHI3G.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";