efficient-easel 6.3.0 → 6.4.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 (33) hide show
  1. package/dist/{chunk-H3WBX7FN.js → chunk-3PPA5S2J.js} +1 -1
  2. package/dist/{chunk-I6U2G7L4.js → chunk-6EKKPFVG.js} +1 -1
  3. package/dist/chunk-6XXW6ZW3.js +5 -0
  4. package/dist/{chunk-X4OF36J2.js → chunk-7XHDCQVL.js} +17 -17
  5. package/dist/{chunk-DQLK3QQ2.js → chunk-F4XCIEXI.js} +1 -1
  6. package/dist/{chunk-LVUDUQNL.js → chunk-ISBKAONU.js} +1 -1
  7. package/dist/{chunk-PRRFBVJ2.js → chunk-LWQQQ72E.js} +3 -3
  8. package/dist/{chunk-T5HFGW57.js → chunk-NL4OU4UU.js} +1 -1
  9. package/dist/{chunk-FXJBKKGI.js → chunk-NTMY5EXS.js} +1 -1
  10. package/dist/chunk-TAF5AECR.js +65 -0
  11. package/dist/{chunk-CJBU4E4L.js → chunk-VFI3ONLN.js} +1 -1
  12. package/dist/{chunk-B4ZNYLZX.js → chunk-YB4QPUEZ.js} +4 -4
  13. package/dist/copy/index.js +7 -7
  14. package/dist/fields/index.js +1 -1
  15. package/dist/screen/components/AddBlockRow.js +1 -1
  16. package/dist/screen/components/AddSidePanel.js +1 -1
  17. package/dist/screen/components/MediaSidePanel.js +1 -1
  18. package/dist/screen/components/NodeContextMenu.js +1 -1
  19. package/dist/screen/components/ScreenChrome.js +1 -1
  20. package/dist/screen/components/ScreenMount.js +1 -1
  21. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  22. package/dist/screen/components/SectionScreenShell.js +15 -15
  23. package/dist/screen/components/usePartBridge.js +1 -1
  24. package/dist/screen/index.js +1 -1
  25. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  26. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  27. package/dist/screen/lib/screen-parts.js +1 -1
  28. package/dist/strings/catalogue.js +1 -1
  29. package/dist/strings/index.js +1 -1
  30. package/dist/text-styles/index.js +16 -16
  31. package/package.json +1 -1
  32. package/dist/chunk-EXCKAZKN.js +0 -5
  33. package/dist/chunk-HAUTMX4H.js +0 -65
@@ -1,2 +1,2 @@
1
- import{ScreenPartsProvider as t}from"./chunk-EXCKAZKN.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-DSUMM2WF.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-6XXW6ZW3.js";import{useEaselHost as r}from"./chunk-U3JP4VGF.js";import{createEasel as e,EaselProvider as n}from"./chunk-DSUMM2WF.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};
@@ -1 +1 @@
1
- import{useScreenBlockRules as e}from"./chunk-EXCKAZKN.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-DSUMM2WF.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-6XXW6ZW3.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-DSUMM2WF.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,5 @@
1
+ import{slotFieldsOf as n}from"./chunk-PLVEGYK6.js";import{usePickFollowsSelection as e}from"./chunk-R6WTQWAC.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-DSUMM2WF.js";import{Inspector as i}from"./chunk-7XHDCQVL.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(e,t,r){const i=e.slotsOf?.(r);return i||n(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={},v=()=>k,g=()=>"",y=()=>null,b=()=>{},L={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},j={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},w={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},S={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function C(){/* @__PURE__ */
2
+ return s(t,{height:"fill"})}function D(){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 P=o({});function G({parts:n,children:e}){/* @__PURE__ */
4
+ return s(P.Provider,{value:n,children:e})}function N(){return u(P)}function x(){return(N().useOwnerName??g)()}function B(){return(N().useDocumentLabel??y)()}function F(n,e,t,r){return(N().useBridges??v)(n,e,t,r)}function I(n){return(N().useStandaloneBridges??v)(n)}function T(n,e){(N().useDocumentPass??b)(n,e)}function A(){return N().blockRules??L}function R(){return N().blockLook??O}function V(){return N().devices??j}function W(){return N().leftView??w}function H(){return N().pinned??S}function K(){return N().saveSwitch??!0}function M(n){e(!0===N().pickFollowsSelection,n)}function Q(){return N().add??h}function E(){return N().storageNamespace||void 0}function U(){return N().styleClipboard??null}function X(){return N().nodeKeys??!0}function Y(){return N().notify??null}function Z(){return N().Canvas??C}function q(){return N().CanvasHead??null}function z(){return N().canvasDrag??null}var J=o(null);function $({target:n,children:e}){/* @__PURE__ */
5
+ return s(J.Provider,{value:n,children:e})}function _(){return u(J)}function nn(){return N().Inspector??D}export{c as SELECTION_MODE,$ as ScreenCanvasTargetProvider,G as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,Q as useScreenAdd,R as useScreenBlockLook,A as useScreenBlockRules,F as useScreenBridges,z as useScreenCanvasDrag,Z as useScreenCanvasFrame,q as useScreenCanvasHead,_ as useScreenCanvasTarget,V as useScreenDevices,B as useScreenDocumentLabel,T as useScreenDocumentPass,nn as useScreenInspectorPanel,W as useScreenLeftView,X as useScreenNodeKeys,Y as useScreenNotify,x as useScreenOwnerName,N as useScreenParts,M as useScreenPickFollowsSelection,H as useScreenPinned,K as useScreenSaveSwitch,E as useScreenStorageNamespace,U as useScreenStyleClipboard,I as useStandaloneScreenBridges};
@@ -1,21 +1,21 @@
1
- import{TreeSeam as e}from"./chunk-4JSBIW5H.js";import{FieldSelect as n}from"./chunk-OZ72A6MY.js";import{SettingsField as t,SETTINGS_BUCKETS as l,SettingsGroup as r}from"./chunk-3ZJSLHHI.js";import{DEFAULT_TREE_WORDS as a}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as o}from"./chunk-KFV7N2DJ.js";import{EaselMenuItems as i}from"./chunk-EA2HTX37.js";import{FieldNumber as s}from"./chunk-66LWADFP.js";import{SettingsSegmented as c}from"./chunk-QLD57GBB.js";import{DEFAULT_FIELDS_WORDS as d}from"./chunk-FFYXVAAL.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{useTreeDrag as m,gapToMoveIndex as p}from"./chunk-67GNT6PF.js";import{withTip as h}from"./chunk-P2VEMZH5.js";import{Textarea as f,Input as b,SortableList as g,ListRow as v,ContextMenu as y,tabPanelId as k,Tabs as x,tabButtonId as w}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as N,useState as C,useLayoutEffect as O,useId as $}from"react";import{jsx as j,jsxs as D}from"react/jsx-runtime";import{ChevronIcon as I,LockIcon as S,MoveUpIcon as F,MoveDownIcon as P,DuplicateIcon as L,TrashIcon as M}from"efficient-shell/icons/efficient";function T({id:e,value:n,onChange:t,placeholder:l,multiline:r=!1,rows:a=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return r?/* @__PURE__ */j(f,{id:e,size:"sm",className:"es-fin",value:c,rows:a,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */j(b,{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(),[r]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,r),l}function E(e,n){return e.filter((e,t)=>t!==n)}function R(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var z='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',B={parentId:"list",slot:"items"};function Y({label:n,icon:t,noun:l,items:r,onChange:o,newItem:s,summary:c,itemName:f,thumb:b,min:k=0,max:x,readOnly:w=!1,open:$,onOpen:T,renderItem:Y,renderRow:J,canRemove:K,lockedReason:V,fixed:G=!1,removeOnRow:W=!0,canDuplicate:X,above:Z,head:q=!0}){const Q=u("fields",d).list,U=u("tree",a),_=l??Q.item,ee=!w&&!G&&("number"!=typeof x||r.length<x),ne=r.length<=k,te=e=>!!K&&!K(r[e],e),le=e=>!w&&!G&&W&&!ne&&!te(e),re=e=>ee&&(!X||X(r[e],e)),ae=(e,n)=>f?f(e,n):Q.itemName({noun:_,n:n+1}),oe=N([]),ie=N(null),[se,ce]=C(null),de=N(null),[ue,me]=C(null),[pe,he]=C("");O(()=>{const e=ie.current;if(!e)return;ie.current=null;const n=oe.current[e.index]?.querySelectorAll(z)[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>=r.length||n===e)return;const t=oe.current[e],l=t?.ownerDocument.activeElement;if(t&&l&&t.contains(l)){const e=[...t.querySelectorAll(z)].indexOf(l),r=l;ie.current={index:n,nth:e,start:"number"==typeof r.selectionStart?r.selectionStart:null,end:"number"==typeof r.selectionEnd?r.selectionEnd:null}}o(H(r,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}($,e,n);a!==$&&T(a),he(Q.moved({n:n+1,total:r.length}))},be=e=>{ee&&(o(A(r,e,s())),J?(ie.current={index:e,nth:0,start:null,end:null},null!==$&&$>=e&&T($+1)):T(e))},ge=e=>{le(e)&&(o(E(r,e)),$===e?T(null):null!==$&&$>e&&T($-1))},ve=m({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===B.parentId&&n.slot===B.slot,onDrop:(e,n)=>{const t=p({...B,index:e},n);t!==e&&fe(e,t)},onStep:(e,n)=>fe(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<r.length,readOnly:w}),ye=e=>{const n=[];return e>0&&n.push({label:Q.moveUp,icon:/* @__PURE__ */j(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<r.length-1&&n.push({label:Q.moveDown,icon:/* @__PURE__ */j(P,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),re(e)&&n.push({label:Q.duplicate,icon:/* @__PURE__ */j(L,{size:14}),onClick:()=>(e=>{re(e)&&(o(A(r,e+1,R(r[e]))),null!==$&&$>e&&T($+1))})(e)}),le(e)&&n.push({label:Q.delete,icon:/* @__PURE__ */j(M,{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=r.slice();t[e]=n,o(t)};/* @__PURE__ */
1
+ import{FieldSelect as e}from"./chunk-OZ72A6MY.js";import{TreeSeam as n}from"./chunk-4JSBIW5H.js";import{EaselMenuItems as t}from"./chunk-EA2HTX37.js";import{DEFAULT_TREE_WORDS as l}from"./chunk-K56YDHYQ.js";import{SettingsField as r,SETTINGS_BUCKETS as a,SettingsGroup as o}from"./chunk-3ZJSLHHI.js";import{DEFAULT_PANEL_WORDS as i}from"./chunk-KFV7N2DJ.js";import{FieldNumber as s}from"./chunk-66LWADFP.js";import{DEFAULT_FIELDS_WORDS as c}from"./chunk-FFYXVAAL.js";import{SettingsSegmented as d}from"./chunk-QLD57GBB.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{useTreeDrag as m,gapToMoveIndex as p}from"./chunk-67GNT6PF.js";import{withTip as h}from"./chunk-P2VEMZH5.js";import{Textarea as f,Input as b,SortableList as g,ListRow as v,ContextMenu as y,tabPanelId as k,Tabs as x,tabButtonId as w}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as N,useState as C,useLayoutEffect as O,useId as $}from"react";import{jsx as j,jsxs as D}from"react/jsx-runtime";import{ChevronIcon as I,LockIcon as S,MoveUpIcon as F,MoveDownIcon as P,DuplicateIcon as L,TrashIcon as M}from"efficient-shell/icons/efficient";function T({id:e,value:n,onChange:t,placeholder:l,multiline:r=!1,rows:a=3,readOnly:o=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return r?/* @__PURE__ */j(f,{id:e,size:"sm",className:"es-fin",value:c,rows:a,placeholder:l,readOnly:o,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */j(b,{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(),[r]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,r),l}function E(e,n){return e.filter((e,t)=>t!==n)}function R(e){return null===e||"object"!=typeof e?e:JSON.parse(JSON.stringify(e))}var z='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',B={parentId:"list",slot:"items"};function Y({label:e,icon:r,noun:a,items:o,onChange:i,newItem:s,summary:d,itemName:f,thumb:b,min:k=0,max:x,readOnly:w=!1,open:$,onOpen:T,renderItem:Y,renderRow:J,canRemove:K,lockedReason:V,fixed:G=!1,removeOnRow:W=!0,canDuplicate:X,above:Z,head:q=!0}){const Q=u("fields",c).list,U=u("tree",l),_=a??Q.item,ee=!w&&!G&&("number"!=typeof x||o.length<x),ne=o.length<=k,te=e=>!!K&&!K(o[e],e),le=e=>!w&&!G&&W&&!ne&&!te(e),re=e=>ee&&(!X||X(o[e],e)),ae=(e,n)=>f?f(e,n):Q.itemName({noun:_,n:n+1}),oe=N([]),ie=N(null),[se,ce]=C(null),de=N(null),[ue,me]=C(null),[pe,he]=C("");O(()=>{const e=ie.current;if(!e)return;ie.current=null;const n=oe.current[e.index]?.querySelectorAll(z)[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(z)].indexOf(l),r=l;ie.current={index:n,nth:e,start:"number"==typeof r.selectionStart?r.selectionStart:null,end:"number"==typeof r.selectionEnd?r.selectionEnd:null}}i(H(o,e,n));const r=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}($,e,n);r!==$&&T(r),he(Q.moved({n:n+1,total:o.length}))},be=e=>{ee&&(i(A(o,e,s())),J?(ie.current={index:e,nth:0,start:null,end:null},null!==$&&$>=e&&T($+1)):T(e))},ge=e=>{le(e)&&(i(E(o,e)),$===e?T(null):null!==$&&$>e&&T($-1))},ve=m({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===B.parentId&&n.slot===B.slot,onDrop:(e,n)=>{const t=p({...B,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:Q.moveUp,icon:/* @__PURE__ */j(F,{size:14}),shortcut:"⌥↑",onClick:()=>fe(e,e-1)}),e<o.length-1&&n.push({label:Q.moveDown,icon:/* @__PURE__ */j(P,{size:14}),shortcut:"⌥↓",onClick:()=>fe(e,e+1)}),re(e)&&n.push({label:Q.duplicate,icon:/* @__PURE__ */j(L,{size:14}),onClick:()=>(e=>{re(e)&&(i(A(o,e+1,R(o[e]))),null!==$&&$>e&&T($+1))})(e)}),le(e)&&n.push({label:Q.delete,icon:/* @__PURE__ */j(M,{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
2
  return D("div",{className:"es-list",children:[q?/* @__PURE__ */D("div",{className:"es-list-head",children:[
3
- /* @__PURE__ */D("span",{className:"es-list-label",children:[t?/* @__PURE__ */j("span",{className:"es-field-icon","aria-hidden":"true",children:t}):null,n]}),
4
- /* @__PURE__ */j("span",{className:"es-list-count",children:r.length})]}):null,Z?/* @__PURE__ */j("div",{className:"es-list-above",children:Z}):null,r.length?/* @__PURE__ */D(g,{"aria-label":n,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[r.map((n,t)=>{const l=ve.row({item:t,place:{...B,index:t}}),r=l.draggable&&se!==t,a=!J&&$===t,o=!w&&!G&&W&&te(t),i=["es-list-row",J?"is-inline":"is-item",a?"is-open":"",r?"is-draggable":"",l.dragging?"is-dragging":"",l.drop?`is-drop-${l.drop}`:""].filter(Boolean).join(" ");return[t>0?/* @__PURE__ */j(e,{...ve.seam({place:{...B,index:t}}),onAdd:ee?()=>be(t):void 0,label:Q.addHere({noun:_})},`seam-${t}`):null,
5
- /* @__PURE__ */j(v,{className:i,flat:!!J,active:a,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(t,"up"===e?t-1:t+1):void 0,rowRef:e=>{oe.current[t]=e},rowProps:{...l.rowProps,draggable:r||void 0,onPointerDown:e=>{const n=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),r=!!n&&n===n.ownerDocument.activeElement;e.currentTarget.draggable=l.draggable&&!r,de.current=n&&!r?n:null,ce(r?t: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(t,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const n=e.currentTarget.ownerDocument,l=e=>e.preventDefault();n.addEventListener("contextmenu",l,{capture:!0,once:!0}),n.defaultView?.setTimeout(()=>n.removeEventListener("contextmenu",l,{capture:!0}),500);const r=e.currentTarget.getBoundingClientRect();return void ke(t,r.left+24,r.bottom,e.currentTarget)}l.rowProps.onKeyDown?.(e)}},actions:w||G||!W?void 0:o?h(V?V(n,t):Q.locked,/* @__PURE__ */j("span",{className:"es-list-lock",role:"img","aria-label":V?V(n,t):Q.locked,children:/* @__PURE__ */j(S,{size:13})})):h(Q.deleteItem({noun:_}),/* @__PURE__ */j("button",{type:"button",className:"es-list-x","aria-label":Q.deleteItem({noun:_}),disabled:!le(t),onClick:()=>ge(t),children:"×"})),below:a?/* @__PURE__ */j("div",{className:"es-list-item",children:Y(n,t,xe(t))}):void 0,children:J?/* @__PURE__ */j("div",{className:"es-list-row-main",children:J(n,t,xe(t))}):/* @__PURE__ */D("button",{type:"button",className:"es-list-open","aria-expanded":a,onClick:()=>T(a?null:t),children:[b?/* @__PURE__ */j("span",{className:"es-list-thumb","aria-hidden":"true",children:b(n,t)}):null,
6
- /* @__PURE__ */j("span",{className:"es-list-row-name",children:ae(n,t)}),/* @__PURE__ */j("span",c?{className:"es-list-row-summary",children:c(n,t)}:{className:"es-list-row-summary"}),
3
+ /* @__PURE__ */D("span",{className:"es-list-label",children:[r?/* @__PURE__ */j("span",{className:"es-field-icon","aria-hidden":"true",children:r}):null,e]}),
4
+ /* @__PURE__ */j("span",{className:"es-list-count",children:o.length})]}):null,Z?/* @__PURE__ */j("div",{className:"es-list-above",children:Z}):null,o.length?/* @__PURE__ */D(g,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ve.rootProps(),children:[o.map((e,t)=>{const l=ve.row({item:t,place:{...B,index:t}}),r=l.draggable&&se!==t,a=!J&&$===t,o=!w&&!G&&W&&te(t),i=["es-list-row",J?"is-inline":"is-item",a?"is-open":"",r?"is-draggable":"",l.dragging?"is-dragging":"",l.drop?`is-drop-${l.drop}`:""].filter(Boolean).join(" ");return[t>0?/* @__PURE__ */j(n,{...ve.seam({place:{...B,index:t}}),onAdd:ee?()=>be(t):void 0,label:Q.addHere({noun:_})},`seam-${t}`):null,
5
+ /* @__PURE__ */j(v,{className:i,flat:!!J,active:a,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(t,"up"===e?t-1:t+1):void 0,rowRef:e=>{oe.current[t]=e},rowProps:{...l.rowProps,draggable:r||void 0,onPointerDown:e=>{const n=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),r=!!n&&n===n.ownerDocument.activeElement;e.currentTarget.draggable=l.draggable&&!r,de.current=n&&!r?n:null,ce(r?t: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(t,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const n=e.currentTarget.ownerDocument,l=e=>e.preventDefault();n.addEventListener("contextmenu",l,{capture:!0,once:!0}),n.defaultView?.setTimeout(()=>n.removeEventListener("contextmenu",l,{capture:!0}),500);const r=e.currentTarget.getBoundingClientRect();return void ke(t,r.left+24,r.bottom,e.currentTarget)}l.rowProps.onKeyDown?.(e)}},actions:w||G||!W?void 0:o?h(V?V(e,t):Q.locked,/* @__PURE__ */j("span",{className:"es-list-lock",role:"img","aria-label":V?V(e,t):Q.locked,children:/* @__PURE__ */j(S,{size:13})})):h(Q.deleteItem({noun:_}),/* @__PURE__ */j("button",{type:"button",className:"es-list-x","aria-label":Q.deleteItem({noun:_}),disabled:!le(t),onClick:()=>ge(t),children:"×"})),below:a?/* @__PURE__ */j("div",{className:"es-list-item",children:Y(e,t,xe(t))}):void 0,children:J?/* @__PURE__ */j("div",{className:"es-list-row-main",children:J(e,t,xe(t))}):/* @__PURE__ */D("button",{type:"button",className:"es-list-open","aria-expanded":a,onClick:()=>T(a?null:t),children:[b?/* @__PURE__ */j("span",{className:"es-list-thumb","aria-hidden":"true",children:b(e,t)}):null,
6
+ /* @__PURE__ */j("span",{className:"es-list-row-name",children:ae(e,t)}),/* @__PURE__ */j("span",d?{className:"es-list-row-summary",children:d(e,t)}:{className:"es-list-row-summary"}),
7
7
  /* @__PURE__ */j(I,{size:14,className:"es-list-chev","aria-hidden":"true"})]})},t)]}),
8
- /* @__PURE__ */j(e,{...ve.seam({place:{...B,index:r.length}})})]}):null,w||G?null:/* @__PURE__ */j("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(r.length),children:Q.add({noun:_})}),
9
- /* @__PURE__ */j("span",{className:"es-list-said","aria-live":"polite",children:pe}),ue&&ue.index<r.length?
10
- /* @__PURE__ */j(y,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),children:/* @__PURE__ */j(i,{items:ye(ue.index),onClose:()=>me(null)})}):null]})}var J=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function K({field:e,name:n,id:t,value:l,onChange:a,readOnly:o,context:i,renderers:s}){const[c,d]=C(!0),u=l&&"object"==typeof l?l:{};/* @__PURE__ */
11
- return j(r,{id:`${t}-group`,title:J(e,n),open:c,onToggle:d,children:Object.entries(e.objectFields).map(([e,l])=>/* @__PURE__ */j(G,{field:l,name:`${n}.${e}`,id:`${t}-${e}`,value:u[e],onChange:n=>a({...u,[e]:n}),readOnly:o,context:i,renderers:s},e))})}function V({field:e,name:n,id:t,value:l,onChange:r,readOnly:a,context:o,renderers:i,openItem:s,onOpenItem:c}){const[d,u]=C(null),m=c?s??null:d,p=c??u,h=Array.isArray(l)?l:[],f=e.getItemSummary;/* @__PURE__ */
12
- return j(Y,{label:J(e,n),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:h,onChange:r,newItem:()=>R({...e.defaultItemProps??{}}),summary:f?(e,n)=>f(e,n):void 0,min:e.min,max:e.max,readOnly:a,open:m,onOpen:p,renderItem:(l,r,s)=>Object.entries(e.arrayFields).map(([e,c])=>/* @__PURE__ */j(G,{field:c,name:`${n}[${r}].${e}`,id:`${t}-${r}-${e}`,value:l?.[e],onChange:n=>s({...l,[e]:n}),readOnly:a,context:o,renderers:i},e))})}function G(e){const{field:l,name:r,id:a,value:o,onChange:i,readOnly:d,context:u,renderers:m}=e;if(!l||l.marker||!1===l.visible)return null;const p=m?.[l.type];if(p)return p({field:l,name:r,id:a,value:o,onChange:i,readOnly:d});switch(l.type){case"custom":{const e={...u,field:l,name:r,id:a,value:o,onChange:i,readOnly:d};return l.render(e)}case"text":case"textarea":/* @__PURE__ */
13
- return j(t,{label:J(l,r),htmlFor:a,icon:l.icon,hint:l.hint,children:/* @__PURE__ */j(T,{id:a,value:"string"==typeof o?o:null==o?"":String(o),onChange:i,placeholder:l.placeholder,multiline:"textarea"===l.type,readOnly:d})});case"number":/* @__PURE__ */
14
- return j(t,{label:J(l,r),htmlFor:a,icon:l.icon,hint:l.hint,children:/* @__PURE__ */j(s,{id:a,value:"number"==typeof o?o:void 0,onChange:i,min:l.min,max:l.max,step:l.step,placeholder:l.placeholder,readOnly:d})});case"select":{const e=`${a}-label`;/* @__PURE__ */
15
- return j(t,{label:J(l,r),labelId:e,htmlFor:a,icon:l.icon,hint:l.hint,children:/* @__PURE__ */j(n,{id:a,value:o,options:l.options,onChange:i,readOnly:d,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
16
- return j(t,{label:J(l,r),icon:l.icon,hint:l.hint,children:/* @__PURE__ */j(c,{ariaLabel:J(l,r),value:o,options:l.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||d})),onChange:e=>{d||i(e)}})});case"object":/* @__PURE__ */
17
- return j(K,{...e,field:l});case"array":/* @__PURE__ */
18
- return j(V,{...e,field:l});case"slot":return null}}var W=e=>l.includes(e);function X(e){let n,t=l[0];const r=[],a=/* @__PURE__ */new Set;for(const[l,o]of Object.entries(e))o&&(W(o.bucket)&&((o.marker||o.bucket!==t)&&(n=void 0),t=o.bucket),o.marker&&"string"==typeof o.fold?n={key:l,title:o.fold}:o.marker&&!1===o.fold&&(n=void 0),o.marker||!1===o.visible||(r.push(n?{name:l,field:o,bucket:t,fold:n}:{name:l,field:o,bucket:t}),"slot"!==o.type&&a.add(t)));return{rows:r,buckets:l.filter(e=>a.has(e))}}function Z(e){return new Map(X(e).rows.map(e=>[e.name,e.bucket]))}function q(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 Q({fields:e,values:n,onChange:t,readOnly:l=!1,context:a,tab:i,onTab:s,tabs:c=!0,tabIcons:d,renderers:m,idPrefix:p,ariaLabel:h,lead:f,children:b,leadFold:g,closedFolds:v,onFold:y}){const N=u("panel",o),O=$(),I=p??`es-insp${O.replace(/:/g,"")}`,S=X(e),[F,P]=C(void 0),L=i??F,M=L&&S.buckets.includes(L)?L:S.buckets[0],[T,A]=C(null),H=T&&T.panel===I&&S.rows.some(e=>e.name===T.name)?T:null,E=c&&S.buckets.length>1,R=E&&M?k(I,M):`${I}-rows`,[z,B]=C(()=>/* @__PURE__ */new Set),Y=v??z,J=(e,n)=>/* @__PURE__ */j(r,{title:e.title,open:!Y.has(e.key),onToggle:n=>((e,n)=>{void 0===v&&B(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),y?.(e,n)})(e.key,n),id:`${I}-fold-${e.key}`,children:n}),K=e=>E&&e!==M,V=({name:e,field:r,bucket:o})=>/* @__PURE__ */j("div",{className:"es-insp-row","data-field":e,"data-bucket":o,hidden:!!K(o)||void 0,children:/* @__PURE__ */j(G,{field:r,name:e,id:`${I}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:a,renderers:m,openItem:H&&H.name===e?H.index:null,onOpenItem:n=>A(null===n?null:{panel:I,name:e,index:n})})},e);/* @__PURE__ */
19
- return D("div",{className:"es-insp",children:[E?/* @__PURE__ */j("div",{className:"es-insp-tabs",children:/* @__PURE__ */j(x,{variant:"underline",block:!0,"aria-label":h??N.settings,idPrefix:I,value:M,onChange:e=>{const n=e;void 0===i&&P(n),s?.(n)},items:S.buckets.map(e=>{const n=N.buckets[e],t=d?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */j("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
8
+ /* @__PURE__ */j(n,{...ve.seam({place:{...B,index:o.length}})})]}):null,w||G?null:/* @__PURE__ */j("button",{type:"button",className:"es-list-add",disabled:!ee,onClick:()=>be(o.length),children:Q.add({noun:_})}),
9
+ /* @__PURE__ */j("span",{className:"es-list-said","aria-live":"polite",children:pe}),ue&&ue.index<o.length?
10
+ /* @__PURE__ */j(y,{at:{x:ue.x,y:ue.y},owner:ue.owner,onClose:()=>me(null),children:/* @__PURE__ */j(t,{items:ye(ue.index),onClose:()=>me(null)})}):null]})}var J=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function K({field:e,name:n,id:t,value:l,onChange:r,readOnly:a,context:i,renderers:s}){const[c,d]=C(!0),u=l&&"object"==typeof l?l:{};/* @__PURE__ */
11
+ return j(o,{id:`${t}-group`,title:J(e,n),open:c,onToggle:d,children:Object.entries(e.objectFields).map(([e,l])=>/* @__PURE__ */j(G,{field:l,name:`${n}.${e}`,id:`${t}-${e}`,value:u[e],onChange:n=>r({...u,[e]:n}),readOnly:a,context:i,renderers:s},e))})}function V({field:e,name:n,id:t,value:l,onChange:r,readOnly:a,context:o,renderers:i,openItem:s,onOpenItem:c}){const[d,u]=C(null),m=c?s??null:d,p=c??u,h=Array.isArray(l)?l:[],f=e.getItemSummary;/* @__PURE__ */
12
+ return j(Y,{label:J(e,n),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:h,onChange:r,newItem:()=>R({...e.defaultItemProps??{}}),summary:f?(e,n)=>f(e,n):void 0,min:e.min,max:e.max,readOnly:a,open:m,onOpen:p,renderItem:(l,r,s)=>Object.entries(e.arrayFields).map(([e,c])=>/* @__PURE__ */j(G,{field:c,name:`${n}[${r}].${e}`,id:`${t}-${r}-${e}`,value:l?.[e],onChange:n=>s({...l,[e]:n}),readOnly:a,context:o,renderers:i},e))})}function G(n){const{field:t,name:l,id:a,value:o,onChange:i,readOnly:c,context:u,renderers:m}=n;if(!t||t.marker||!1===t.visible)return null;const p=m?.[t.type];if(p)return p({field:t,name:l,id:a,value:o,onChange:i,readOnly:c});switch(t.type){case"custom":{const e={...u,field:t,name:l,id:a,value:o,onChange:i,readOnly:c};return t.render(e)}case"text":case"textarea":/* @__PURE__ */
13
+ return j(r,{label:J(t,l),htmlFor:a,icon:t.icon,hint:t.hint,children:/* @__PURE__ */j(T,{id:a,value:"string"==typeof o?o:null==o?"":String(o),onChange:i,placeholder:t.placeholder,multiline:"textarea"===t.type,readOnly:c})});case"number":/* @__PURE__ */
14
+ return j(r,{label:J(t,l),htmlFor:a,icon:t.icon,hint:t.hint,children:/* @__PURE__ */j(s,{id:a,value:"number"==typeof o?o:void 0,onChange:i,min:t.min,max:t.max,step:t.step,placeholder:t.placeholder,readOnly:c})});case"select":{const n=`${a}-label`;/* @__PURE__ */
15
+ return j(r,{label:J(t,l),labelId:n,htmlFor:a,icon:t.icon,hint:t.hint,children:/* @__PURE__ */j(e,{id:a,value:o,options:t.options,onChange:i,readOnly:c,ariaLabelledBy:n})})}case"radio":/* @__PURE__ */
16
+ return j(r,{label:J(t,l),icon:t.icon,hint:t.hint,children:/* @__PURE__ */j(d,{ariaLabel:J(t,l),value:o,options:t.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||c})),onChange:e=>{c||i(e)}})});case"object":/* @__PURE__ */
17
+ return j(K,{...n,field:t});case"array":/* @__PURE__ */
18
+ return j(V,{...n,field:t});case"slot":return null}}var W=e=>a.includes(e);function X(e){let n,t=a[0];const l=[],r=/* @__PURE__ */new Set;for(const[a,o]of Object.entries(e))o&&(W(o.bucket)&&((o.marker||o.bucket!==t)&&(n=void 0),t=o.bucket),o.marker&&"string"==typeof o.fold?n={key:a,title:o.fold}:o.marker&&!1===o.fold&&(n=void 0),o.marker||!1===o.visible||(l.push(n?{name:a,field:o,bucket:t,fold:n}:{name:a,field:o,bucket:t}),"slot"!==o.type&&r.add(t)));return{rows:l,buckets:a.filter(e=>r.has(e))}}function Z(e){return new Map(X(e).rows.map(e=>[e.name,e.bucket]))}function q(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 Q({fields:e,values:n,onChange:t,readOnly:l=!1,context:r,tab:a,onTab:s,tabs:c=!0,tabIcons:d,renderers:m,idPrefix:p,ariaLabel:h,lead:f,children:b,leadFold:g,closedFolds:v,onFold:y}){const N=u("panel",i),O=$(),I=p??`es-insp${O.replace(/:/g,"")}`,S=X(e),[F,P]=C(void 0),L=a??F,M=L&&S.buckets.includes(L)?L:S.buckets[0],[T,A]=C(null),H=T&&T.panel===I&&S.rows.some(e=>e.name===T.name)?T:null,E=c&&S.buckets.length>1,R=E&&M?k(I,M):`${I}-rows`,[z,B]=C(()=>/* @__PURE__ */new Set),Y=v??z,J=(e,n)=>/* @__PURE__ */j(o,{title:e.title,open:!Y.has(e.key),onToggle:n=>((e,n)=>{void 0===v&&B(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),y?.(e,n)})(e.key,n),id:`${I}-fold-${e.key}`,children:n}),K=e=>E&&e!==M,V=({name:e,field:a,bucket:o})=>/* @__PURE__ */j("div",{className:"es-insp-row","data-field":e,"data-bucket":o,hidden:!!K(o)||void 0,children:/* @__PURE__ */j(G,{field:a,name:e,id:`${I}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:r,renderers:m,openItem:H&&H.name===e?H.index:null,onOpenItem:n=>A(null===n?null:{panel:I,name:e,index:n})})},e);/* @__PURE__ */
19
+ return D("div",{className:"es-insp",children:[E?/* @__PURE__ */j("div",{className:"es-insp-tabs",children:/* @__PURE__ */j(x,{variant:"underline",block:!0,"aria-label":h??N.settings,idPrefix:I,value:M,onChange:e=>{const n=e;void 0===a&&P(n),s?.(n)},items:S.buckets.map(e=>{const n=N.buckets[e],t=d?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */j("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
20
20
  /* @__PURE__ */D("div",{className:"es-insp-rows",id:R,role:E?"tabpanel":void 0,"aria-labelledby":E&&M?w(I,M):void 0,children:[f?g?/* @__PURE__ */j("div",{className:"es-insp-band","data-fold":g.key,children:J(g,f)}):f:null,q(S.rows).map((e,n)=>{if(!e.fold)return e.rows.map(V);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
21
21
  return j("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!K(t)&&!l)||void 0,children:J(e.fold,e.rows.map(V))},`fold-${e.fold.key}-${n}`)}),b]})]})}export{T as FieldText,Q as Inspector,G as InspectorField,Y as ListField,Z as bucketsOf,R as copyItem,A as insertAt,J as labelOf,H as moveTo,X as planFields,E as removeAt};
@@ -1,4 +1,4 @@
1
- import{useScreenOwnerName as e}from"./chunk-EXCKAZKN.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-UB4TLWVJ.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-6XXW6ZW3.js";import{settlePanelPick as n}from"./chunk-R6WTQWAC.js";import{MediaPanelHead as i,mediaPickKind as c}from"./chunk-UB4TLWVJ.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};
@@ -1 +1 @@
1
- import{styleMenuItems as e}from"./chunk-V7U33NF2.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as t}from"./chunk-PLVEGYK6.js";import{useHostEscape as o}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as l}from"./chunk-MCHMF32I.js";import{EaselMenuItems as r,menuLabel as i}from"./chunk-EA2HTX37.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-AWJUYMX7.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,AddIcon as C,PasteIcon as z,SettingsIcon as P,LayersIcon as A,CopyIcon as O}from"efficient-shell/icons/efficient";import{jsx as M}from"react/jsx-runtime";function S(e,n){const o=[],l=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||l.has(n.props.id))break;if(l.add(n.props.id),o.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===t)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var K=c(),j=/* @__PURE__ */new WeakMap;function D(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=j.get(n);return t||(t=c(),j.set(n,t)),t}function T(){return D(n())}function X(e,n,o){if(n===t){const{floor:n,cap:t}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(o,n),t)}}const l=n.lastIndexOf(":");return{parentId:n.slice(0,l),slot:n.slice(l+1),index:o}}function I(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}}function E(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?X(e,t.zone,t.index+1):null;for(const l of S(e,t)){const t=X(e,l.zone,l.index+1);if(o(n,t))return t}return null}function L(e){if(e.defaultPrevented||e.altKey||e.shiftKey||!e.metaKey&&!e.ctrlKey)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;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function R(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=I(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;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 U(n,o){const{zone:l,index:r}=o,i=n.nodeAt(l,r);if(!i)return[];const c=i.props.id,a=n.labelOf(i.type,l),u=Boolean(i.props._hidden),d=n.nodeOps,p=n.isPinned(i,l),f=n.isLocked(i),m=!p&&!f&&!n.duplicateBlocked(i),h=n.permits?.(i)??{duplicate:!0,delete:!0},y=I(n,i,l),k=S(n,o),b=d.held,v=b&&!p?E(n,b,o):null,g=!n.readOnly,w=n.style?e({held:g?n.style.held():null,canCopy:n.style.canCopy(i,l),onCopy:()=>n.style?.copy(i,l),onPaste:()=>n.style?.paste(l,r,i),words:n.words?.styleClipboard}):[];return s({title:a,words:n.words?.menu,layer:{group:"pick",items:k.flatMap((e,o)=>{const l={label:n.rowNameOf(e.node,e.zone),checked:0===o,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},r=e.zone===t?null:n.slotRung?.(e.zone)??null;return r?[l,{label:r.label,checked:!1,onClick:r.select}]:[l]})},actions:{addInside:g&&n.canAddTo(i.type)?()=>n.openAddInside(l,r):void 0,duplicate:g&&m&&h.duplicate?()=>d.duplicate(c):void 0,moveUp:g&&d.canStep(c,-1)?()=>d.step(c,-1):void 0,moveDown:g&&d.canStep(c,1)?()=>d.step(c,1):void 0,copy:y.copy?()=>d.copy(c,a):void 0,cut:g&&y.cut?()=>d.cut(c,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&n.renamePropOf(i,l)?()=>n.beginRename(l,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:n.menuRows?.(i,l,r)??void 0,pinnedLine:p?Y(n).pinned:void 0})}var Y=e=>e.words?.screen??l.menu;function V(e){const n=Y(e),o=!e.readOnly,r=[];o&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */M(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */M(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=o?[{label:n.addSection,icon:/* @__PURE__ */M(C,{}),onClick:e.openAddSection}]:[],c=e.nodeOps.held,s=X(e,t,e.sectionBand().cap);if(o&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===t)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */M(z,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??l.pageSettings,icon:/* @__PURE__ */M(P,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */M(A,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function B(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}))},i=e.words?.menu??a,c=Y(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */M(O,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */M(O,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */M(z,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.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 F(e){return e.shiftKey}function N(e,n){const[t,l]=y(null),r=k(()=>l(null),[]);o(null!==t,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=R(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(n,"keydown",c);const a=k(n=>{if(F(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(n,"contextmenu",t=>{if(F(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;t.preventDefault();const c=p(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(n,"mousedown",r),d(n,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:t?/* @__PURE__ */M(G,{host:e,target:t,onClose:r}):null,closeMenu:r}}function G({host:e,target:n,onClose:t}){const o="node"===n.kind?U(e,n):"input"===n.kind?B(e,n.el):V(e);return 0===o.length?null:/* @__PURE__ */M(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),children:/* @__PURE__ */M(r,{items:o,onClose:t})})}export{K as EASEL_NODE_CLIPBOARD,S as ancestorChain,D as nodeClipboardOf,I as nodeClipboardRules,U as nodeMenuItems,L as nodeShortcut,V as pageMenuItems,E as pastePlace,R as runNodeShortcut,B as textMenuItems,T as useNodeClipboard,N as useNodeContextMenu};
1
+ import{useEaselSession as e}from"./chunk-O7Q4DDJT.js";import{ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useHostEscape as t}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-MCHMF32I.js";import{styleMenuItems as l}from"./chunk-V7U33NF2.js";import{EaselMenuItems as r,menuLabel as i}from"./chunk-EA2HTX37.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-AWJUYMX7.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,AddIcon as C,PasteIcon as z,SettingsIcon as P,LayersIcon as A,CopyIcon as O}from"efficient-shell/icons/efficient";import{jsx as M}from"react/jsx-runtime";function S(e,t){const o=[],l=/* @__PURE__ */new Set;let r={zone:t.zone,index:t.index};for(;r;){const t=e.nodeAt(r.zone,r.index);if(!t||l.has(t.props.id))break;if(l.add(t.props.id),o.push({zone:r.zone,index:r.index,node:t,parentType:null}),r.zone===n)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<o.length-1;e+=1)o[e].parentType=o[e+1].node.type;return o}var K=c(),j=/* @__PURE__ */new WeakMap;function D(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=j.get(n);return t||(t=c(),j.set(n,t)),t}function T(){return D(e())}function X(e,t,o){if(t===n){const{floor:n,cap:t}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(o,n),t)}}const l=t.lastIndexOf(":");return{parentId:t.slice(0,l),slot:t.slice(l+1),index:o}}function I(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}}function E(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?X(e,t.zone,t.index+1):null;for(const l of S(e,t)){const t=X(e,l.zone,l.index+1);if(o(n,t))return t}return null}function L(e){if(e.defaultPrevented||e.altKey||e.shiftKey||!e.metaKey&&!e.ctrlKey)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;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function R(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=I(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;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 U(e,t){const{zone:o,index:r}=t,i=e.nodeAt(o,r);if(!i)return[];const c=i.props.id,a=e.labelOf(i.type,o),u=Boolean(i.props._hidden),d=e.nodeOps,p=e.isPinned(i,o),f=e.isLocked(i),m=!p&&!f&&!e.duplicateBlocked(i),h=e.permits?.(i)??{duplicate:!0,delete:!0},y=I(e,i,o),k=S(e,t),b=d.held,v=b&&!p?E(e,b,t):null,g=!e.readOnly,w=e.style?l({held:g?e.style.held():null,canCopy:e.style.canCopy(i,o),onCopy:()=>e.style?.copy(i,o),onPaste:()=>e.style?.paste(o,r,i),words:e.words?.styleClipboard}):[];return s({title:a,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((t,o)=>{const l={label:e.rowNameOf(t.node,t.zone),checked:0===o,onClick:()=>e.selectAt(t.zone,t.index,t.node.props.id,t.parentType)},r=t.zone===n?null:e.slotRung?.(t.zone)??null;return r?[l,{label:r.label,checked:!1,onClick:r.select}]:[l]})},actions:{addInside:g&&e.canAddTo(i.type)?()=>e.openAddInside(o,r):void 0,duplicate:g&&m&&h.duplicate?()=>d.duplicate(c):void 0,moveUp:g&&d.canStep(c,-1)?()=>d.step(c,-1):void 0,moveDown:g&&d.canStep(c,1)?()=>d.step(c,1):void 0,copy:y.copy?()=>d.copy(c,a):void 0,cut:g&&y.cut?()=>d.cut(c,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&e.renamePropOf(i,o)?()=>e.beginRename(o,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:e.menuRows?.(i,o,r)??void 0,pinnedLine:p?Y(e).pinned:void 0})}var Y=e=>e.words?.screen??o.menu;function V(e){const t=Y(e),l=!e.readOnly,r=[];l&&e.history.hasPast&&r.push({label:t.undo,icon:/* @__PURE__ */M(w,{}),shortcut:"⌘Z",onClick:e.history.back}),l&&e.history.hasFuture&&r.push({label:t.redo,icon:/* @__PURE__ */M(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=l?[{label:t.addSection,icon:/* @__PURE__ */M(C,{}),onClick:e.openAddSection}]:[],c=e.nodeOps.held,s=X(e,n,e.sectionBand().cap);if(l&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===n)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */M(z,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??o.pageSettings,icon:/* @__PURE__ */M(P,{}),onClick:e.openPageSettings},{label:t.collapseAll,icon:/* @__PURE__ */M(A,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function B(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}))},i=e.words?.menu??a,c=Y(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */M(O,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */M(O,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */M(z,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.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 F(e){return e.shiftKey}function N(e,n){const[o,l]=y(null),r=k(()=>l(null),[]);t(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=R(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(n,"keydown",c);const a=k(n=>{if(F(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(n,"contextmenu",t=>{if(F(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;t.preventDefault();const c=p(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(n,"mousedown",r),d(n,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:o?/* @__PURE__ */M(G,{host:e,target:o,onClose:r}):null,closeMenu:r}}function G({host:e,target:n,onClose:t}){const o="node"===n.kind?U(e,n):"input"===n.kind?B(e,n.el):V(e);return 0===o.length?null:/* @__PURE__ */M(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),children:/* @__PURE__ */M(r,{items:o,onClose:t})})}export{K as EASEL_NODE_CLIPBOARD,S as ancestorChain,D as nodeClipboardOf,I as nodeClipboardRules,U as nodeMenuItems,L as nodeShortcut,V as pageMenuItems,E as pastePlace,R as runNodeShortcut,B as textMenuItems,T as useNodeClipboard,N as useNodeContextMenu};
@@ -1,7 +1,7 @@
1
- import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-H3WBX7FN.js";import{ScreenChrome as e}from"./chunk-HAUTMX4H.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t}from"react";import{Dialog as d,Button as l}from"efficient-shell/ui";import{jsx as m,jsxs as g,Fragment as h}from"react/jsx-runtime";var f=n(r),v=n(e);function p({saving:n,onCancel:r,onDiscard:e,onSave:i}){const a=c("screen",s).leave;/* @__PURE__ */
1
+ import{clientOnly as n}from"./chunk-GXQCZJOP.js";import{ScreenStoreProvider as r}from"./chunk-3PPA5S2J.js";import{ScreenChrome as e}from"./chunk-TAF5AECR.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-WZMU646D.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.js";import{documentPermissions as o}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t}from"react";import{Dialog as d,Button as l}from"efficient-shell/ui";import{jsx as m,jsxs as g,Fragment as h}from"react/jsx-runtime";var f=n(r),v=n(e);function p({saving:n,onCancel:r,onDiscard:e,onSave:i}){const a=c("screen",s).leave;/* @__PURE__ */
2
2
  return m(d,{open:!0,role:"alertdialog",size:"sm",title:a.title,onClose:r,footer:/* @__PURE__ */g(h,{children:[
3
3
  /* @__PURE__ */m(l,{variant:"secondary",onClick:r,children:a.cancel}),
4
4
  /* @__PURE__ */m(l,{variant:"ghost-danger",onClick:e,children:a.discard}),
5
5
  /* @__PURE__ */m(l,{variant:"primary",loading:n,onClick:i,children:n?a.saving:a.save})]}),children:a.body})}function u({target:n,addressing:r,onHostMessage:e,children:a}){/* @__PURE__ */
6
- return m(i,{target:n,addressing:r,onHostMessage:e,children:a})}var k=(n,r)=>/* @__PURE__ */g(h,{children:[n,r]});function C({config:n,parts:r,wrap:e=k}){const{data:i,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:C,pendingNav:N,cancelPendingNav:j,discardAndNavigate:H,saveAndNavigate:M}=a(),y=t(()=>o(!u),[u]),A=c("screen",s);return l?/* @__PURE__ */m("div",{className:"sf-msg",children:A.loading}):d?/* @__PURE__ */m("div",{className:"sf-msg sf-msg--error",children:d}):g?i?e(
7
- /* @__PURE__ */m(f,{config:n,data:i,onChange:C,permissions:y,parts:r,children:/* @__PURE__ */m(v,{})}),N&&/* @__PURE__ */m(p,{saving:"saving"===h,onCancel:j,onDiscard:H,onSave:()=>{M()}})):/* @__PURE__ */m("div",{className:"sf-msg",children:A.loading}):/* @__PURE__ */m("div",{className:"sf-msg",children:A.waitingForAuthorization})}export{C as DocumentScreen,u as ScreenMount};
6
+ return m(i,{target:n,addressing:r,onHostMessage:e,children:a})}var C=(n,r)=>/* @__PURE__ */g(h,{children:[n,r]});function k({config:n,parts:r,wrap:e=C}){const{data:i,error:d,redirecting:l,ready:g,saveStatus:h,readOnly:u,onChange:k,pendingNav:j,cancelPendingNav:N,discardAndNavigate:A,saveAndNavigate:M}=a(),y=t(()=>o(!u),[u]),H=c("screen",s);return l?/* @__PURE__ */m("div",{className:"sf-msg",children:H.loading}):d?/* @__PURE__ */m("div",{className:"sf-msg sf-msg--error",children:d}):g?i?e(
7
+ /* @__PURE__ */m(f,{config:n,data:i,onChange:k,permissions:y,parts:r,children:/* @__PURE__ */m(v,{})}),j&&/* @__PURE__ */m(p,{saving:"saving"===h,onCancel:N,onDiscard:A,onSave:()=>{M()}})):/* @__PURE__ */m("div",{className:"sf-msg",children:H.loading}):/* @__PURE__ */m("div",{className:"sf-msg",children:H.waitingForAuthorization})}export{k as DocumentScreen,u as ScreenMount};
@@ -1 +1 @@
1
- import{useSectionOps as o}from"./chunk-I6U2G7L4.js";import{decodePartId as e,encodePartId as r}from"./chunk-IYT6NN2J.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{SELECTION_MODE as n}from"./chunk-EXCKAZKN.js";import{useEasel as p}from"./chunk-DSUMM2WF.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=p(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=t(),l=d(o=>{const r=e(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),I?.(t)):i(o=>"part"===o.kind?n:o)},[i,I]);c(()=>{k(l)},[k,l]);const K=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(K)},[K,f]);return{selectNode:d(o=>{i(()=>n);const e=a(o);e&&u.select(e)},[i,a,u]),openPartId:K}}export{m as usePartBridge};
1
+ import{useSectionOps as o}from"./chunk-6EKKPFVG.js";import{decodePartId as e,encodePartId as r}from"./chunk-IYT6NN2J.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{SELECTION_MODE as n}from"./chunk-6XXW6ZW3.js";import{useEasel as p}from"./chunk-DSUMM2WF.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}=t(),l=d(o=>{const r=e(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),a?.(t)):i(o=>"part"===o.kind?n:o)},[i,a]);c(()=>{k(l)},[k,l]);const K=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(K)},[K,f]);return{selectNode:d(o=>{i(()=>n);const e=u(o);e&&I.select(e)},[i,u,I]),openPartId:K}}export{m as usePartBridge};
@@ -1 +1 @@
1
- import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-M6F6LS3H.js";import{DEFAULT_PICK_WORDS as r}from"./chunk-ZAOM6PFH.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-MCHMF32I.js";import{DEFAULT_CANVAS_WORDS as n}from"./chunk-AELNNAFM.js";import{DEFAULT_TREE_WORDS as c}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as s}from"./chunk-KFV7N2DJ.js";import{DEFAULT_NODE_MENU_WORDS as f}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as e,DEFAULT_NOTICE_WORDS as i}from"./chunk-Y2G7CU6A.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-AUT242JK.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-FFYXVAAL.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-O2NLQBFX.js";var F={notice:i,lock:u,save:p,chrome:e,rail:k,tree:c,panel:s,fields:h,pick:r,drag:l,menu:f,styleClipboard:t,copy:j,canvas:n,textStyles:o,screen:m},A=o=>"object"==typeof o&&null!==o;function a(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:A(n)?t[m]=A(c)?a(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?a(o,r):o}export{F as DEFAULT_EASEL_STRINGS,y as mergeEaselStrings};
1
+ import{DEFAULT_TEXT_STYLES_WORDS as o}from"./chunk-M6F6LS3H.js";import{DEFAULT_SCREEN_WORDS as r}from"./chunk-MCHMF32I.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{DEFAULT_CANVAS_WORDS as m}from"./chunk-AELNNAFM.js";import{DEFAULT_TREE_WORDS as n}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as c}from"./chunk-WK3AFPXY.js";import{DEFAULT_PANEL_WORDS as s}from"./chunk-KFV7N2DJ.js";import{DEFAULT_PICK_WORDS as f}from"./chunk-ZAOM6PFH.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as e,DEFAULT_NOTICE_WORDS as i}from"./chunk-Y2G7CU6A.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-AUT242JK.js";import{DEFAULT_FIELDS_WORDS as h}from"./chunk-FFYXVAAL.js";import{DEFAULT_DRAG_WORDS as l}from"./chunk-O2NLQBFX.js";var F={notice:i,lock:u,save:p,chrome:e,rail:k,tree:n,panel:s,fields:h,pick:f,drag:l,menu:c,styleClipboard:t,copy:j,canvas:m,textStyles:o,screen:r},A=o=>"object"==typeof o&&null!==o;function a(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:A(n)?t[m]=A(c)?a(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?a(o,r):o}export{F as DEFAULT_EASEL_STRINGS,y as mergeEaselStrings};
@@ -0,0 +1,65 @@
1
+ import{dedupeSlotChildren as e}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as n}from"./chunk-BXQBCW3P.js";import{markedTreeNodeId as t,revealSelectedTreeRow as o,sameSelector as r}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as i}from"./chunk-2GVCAIPX.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as a}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as c,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,editorRootFocus as m}from"./chunk-QPQXKKSC.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as k,clampPanelWidth as S}from"./chunk-6TOYXESC.js";import{usePartBridge as v}from"./chunk-NL4OU4UU.js";import{useSectionOps as w}from"./chunk-6EKKPFVG.js";import{useNodeClipboard as x,useNodeContextMenu as b}from"./chunk-ISBKAONU.js";import{PageEditGuardNotices as z}from"./chunk-HQWQLDCB.js";import{useScreenDocument as B}from"./chunk-WZMU646D.js";import{requestMediaPick as C}from"./chunk-KG7RJWOK.js";import{AddChildRow as N}from"./chunk-5545A3PC.js";import{AddSidePanel as O}from"./chunk-YB4QPUEZ.js";import{SidePanelHead as I,PanelShowStrip as $}from"./chunk-PFNIVZPN.js";import{MediaSidePanel as P}from"./chunk-F4XCIEXI.js";import{useScreenSaveSwitch as T,useScreenNodeKeys as A,useScreenPinned as M,useScreenDocumentLabel as j,useScreenCanvasFrame as R,useScreenInspectorPanel as E,useScreenDevices as L,useScreenPickFollowsSelection as F,useScreenLeftView as V,useScreenAdd as U,SELECTION_MODE as W,sameInspectorMode as D,useScreenBridges as H,useScreenBlockRules as G,useScreenBlockLook as X,useScreenStorageNamespace as Y,useScreenNotify as J,useScreenCanvasHead as K,isSlotMode as Q,useScreenStyleClipboard as _,useScreenDocumentPass as q,useScreenCanvasDrag as Z,ScreenCanvasTargetProvider as ee,isPinnedFirst as ne,isPinnedLast as te,screenSlotsOf as oe}from"./chunk-6XXW6ZW3.js";import{ROOT_ZONE as re,blockNodeActions as ie,TREE_MAX_DEPTH as le,childSlotsOf as se,slotFieldsOf as de,slotChildrenIn as ae,nestsInTree as ce,newNodeId as pe}from"./chunk-PLVEGYK6.js";import{useMediaPanel as ue,usePanelPick as fe,useCancelPanelPick as he}from"./chunk-R6WTQWAC.js";import{useEaselHost as me,useHostEscape as ge}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as ye}from"./chunk-MCHMF32I.js";import{heldStyle as ke,styleShortcut as Se}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ve}from"./chunk-6WY6ZXJG.js";import{useEasel as we,useEaselApi as xe}from"./chunk-DSUMM2WF.js";import{TreeRow as be,Subtree as ze,LayersTree as Be,TreeGroupLabel as Ce,TreeRowAction as Ne,TreeSeam as Oe}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Ie}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as $e}from"./chunk-WK3AFPXY.js";import{toItemSelector as Pe,useNodeOps as Te,clickPick as Ae}from"./chunk-UK2FQOUT.js";import{LayersIcon as Me,MediaIcon as je}from"./chunk-4VJATVVR.js";import{DEFAULT_SAVE_WORDS as Re,saveIndicator as Ee}from"./chunk-H6DDIBQ4.js";import{EaselTopBar as Le,TopBarRail as Fe,TopBarCluster as Ve,EaselIconButton as Ue,TopBarDivider as We,DeviceSwitch as De,InspectorIconButton as He,PanelResizeHandle as Ge,MAX_PANEL_W as Xe,MIN_PANEL_W as Ye,panelWidthVars as Je,SaveState as Ke,SaveStateToggle as Qe}from"./chunk-UB4TLWVJ.js";import{DEFAULT_CHROME_WORDS as _e}from"./chunk-Y2G7CU6A.js";import{useWords as qe}from"./chunk-MFIRYGHW.js";import{CanvasDragLayer as Ze}from"./chunk-AYNU4FYF.js";import{DEFAULT_DRAG_WORDS as en}from"./chunk-O2NLQBFX.js";import{createDragSession as nn,useTreeDrag as tn,gapToMoveIndex as on}from"./chunk-67GNT6PF.js";import{useCanvasFrame as rn,LIST_SELECTOR as ln,BLOCK_SELECTOR as sn,useCanvasEvent as dn}from"./chunk-AWJUYMX7.js";import{zoneKey as an,ROOT_ID as cn,ROOT_SLOT as pn,parseZoneKey as un,DataError as fn,find as hn}from"./chunk-KRXQM65X.js";import{useRef as mn,useMemo as gn,useState as yn,useEffect as kn,useCallback as Sn,useLayoutEffect as vn,Fragment as wn}from"react";import{Tooltip as xn,Button as bn,toast as zn}from"efficient-shell/ui";import{UndoIcon as Bn,RedoIcon as Cn,TrashIcon as Nn,EyeOffIcon as On,EyeIcon as In,DuplicateIcon as $n}from"efficient-shell/icons/efficient";import{jsx as Pn,jsxs as Tn,Fragment as An}from"react/jsx-runtime";function Mn({saveState:e,notSaving:n,readOnlyReason:t,toggle:o,onToggle:r,onRetry:i,words:l,saveWords:s}){if(null!==t)/* @__PURE__ */return Pn(Ke,{tone:"off",label:t,role:"status"});if(n)/* @__PURE__ */
2
+ return Pn(Ke,{tone:e.pending?"off-unsaved":"off",label:l.notSaving,role:"status"});const{tone:d,label:a}=Ee(e,s),c=e.failed&&!e.paused&&/* @__PURE__ */Pn(bn,{variant:"secondary",size:"sm",onClick:i,children:l.retry});/* @__PURE__ */
3
+ return Tn(An,o?{children:[
4
+ /* @__PURE__ */Pn(Qe,{pressed:e.paused,onToggle:r,title:e.paused?l.autoSaveOff:l.autoSaveOn,children:/* @__PURE__ */Pn(Ke,{tone:d,label:a})}),c]}:{children:[
5
+ /* @__PURE__ */Pn(Ke,{tone:d,label:a,role:"status"}),c]})}function jn({expand:e}){/* @__PURE__ */
6
+ return Pn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Tn(An,e?{children:[
7
+ /* @__PURE__ */Pn("path",{d:"M8 9l4-4 4 4"}),
8
+ /* @__PURE__ */Pn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
9
+ /* @__PURE__ */Pn("path",{d:"M8 4l4 4 4-4"}),
10
+ /* @__PURE__ */Pn("path",{d:"M8 20l4-4 4 4"}),
11
+ /* @__PURE__ */Pn("path",{d:"M5 12h14"})]})})}var Rn=`${ln}, ${sn}`;function En(e,n,t){const o=t-n;if(o<6)return null;if(o<26)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+13),t-13))}}var Ln="__rungs";var Fn="screen:band",Vn={duplicate:!0,delete:!0};function Un(){const Ee=me(),{target:Ke,docId:Qe,capabilities:ln,currentSlug:Un,siteId:Wn,onPublish:Dn,saveState:Hn,saveConflict:Gn,retrySave:Xn,toggleAutoSave:Yn,readOnly:Jn,readOnlyReason:Kn=null}=B(),Qn=T(),_n=A(),{mediaEditing:qn,hasEditGuard:Zn,hasPinnedChrome:et}=ln,{appState:nt,dispatch:tt,history:ot,selectedItem:rt,getSelectorForId:it,config:lt}=we(e=>e),st=M(),{first:dt,firstGroup:at,lastGroup:ct,isSectionGroup:pt,sectionGroupZone:ut,panelOf:ft}=st,ht=ft(dt),mt=e=>ne(st,e),gt=e=>te(st,e),yt="node"===st.firstRow,kt=st.band??null,St=qe("screen",ye),vt=qe("tree",Ie),wt=qe("drag",en),xt=qe("save",Re),bt=qe("menu",$e),zt=qe("styleClipboard",ve),Bt=qe("chrome",_e),Ct=j()??`/${Un}`,Nt=R(),Ot=E(),It=w({readOnly:Jn}),$t=w({readOnly:Jn,foldIntoHistory:!0}),Pt=mn(null),Tt=xe(),At=gn(()=>({...It,select:e=>{Pt.current=e,It.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=Tt.config;Pt.current=Pe(e,t,n)}It.commitDocument(e,n)}}),[It,Tt]),Mt=nt.ui,jt=Mt.leftSideBarVisible,Rt=Mt.rightSideBarVisible,{options:Et,widths:Lt,initial:Ft,fluid:Vt,fit:Ut}=L(),[Wt,Dt]=yn(Ft),Ht=ue(),Gt=qn&&null!==Ht,Xt=fe(),Yt=he();F(rt?.props.id);const{read:Jt,write:Kt,forSelection:Qt}=V(),[_t,qt]=yn(Jt);kn(()=>{Kt(_t)},[_t]);const[Zt,eo]=yn(0),no=mn(null),to=mn(null),oo=rn(to,{readySelector:Rn}),ro=f(to);h(to,oo);const[io,lo]=yn(!1),so=mn(!1),ao=mn(!1),[co,po]=yn(null),uo=U(),fo=e=>po(null===e?null:{zone:re,index:e}),[ho,mo]=yn([]),[go,yo]=yn(W),ko="puck"===go.kind,So=io&&!co&&uo.railTarget?uo.railTarget(nt.data,{node:rt??null,mode:go}):null,vo=So?{zone:an(So),index:So.index}:null,wo=co??vo,xo=wo&&wo.zone===re?wo.index:null,bo=t(go,rt?.props.id),[zo,Bo]=yn(null);kn(()=>{zo&&(o(),Bo(null))},[zo]);const Co=mn(it);Co.current=it;const No=Sn((e,{scroll:n})=>{qt(n=>Qt(e,n)),n&&Bo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Co.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&or(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Oo=mn(null);kn(()=>{const e=Oo.current;Oo.current=null;const n=null==rt?.props.id?null:String(rt.props.id);yo(e&&e.id===n?e.mode:ft(rt?.type)??W);const t=rt?.props.id,o=Pt.current;if(Pt.current=null,!t)return;const i=it(t);No(String(t),{scroll:!r(o,i??null,re)})},[rt?.props.id,No]);const Io=Sn(e=>{yo(n=>D(n,e)?n:e),tt({type:"setUi",ui:{rightSideBarVisible:!0}})},[tt]),$o=mn(()=>{});$o.current=(e,n)=>{const t=e?Jr(e.zone??re)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==rt?.props.id?null:String(rt.props.id);yo(e=>D(e,n)?e:n),o!==r&&(Oo.current={id:o,mode:n},At.select(e))};const Po=Sn((e,n)=>$o.current(e,n),[]),To={kind:go.kind,mode:go,open:Io,show:e=>yo(e),reveal:()=>{Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Po},Ao=H(To,{data:nt.data,selected:rt??null,zoneOf:e=>it(e)?.zone,readOnly:Boolean(Jn),select:e=>{yo(W),At.select({index:e})},replace:(e,n)=>At.replaceComponent(re,e,n),scrollTo:e=>Si(e)},{device:Wt,refreshes:Zt},{setView:qt,reveal:()=>{jt||tt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),Mo=Ao.pinnedSource??!1,jo=Ao.resolveLeftView?Ao.resolveLeftView(_t,Gt):"media"===_t&&Gt?_t:"sections",Ro=G(),{isLockedBlock:Eo,duplicateBlocked:Lo,nestDepth:Fo,newSectionNode:Vo,canAddTo:Uo,blockIsOffered:Wo}=Ro,Do=X(),{labelAtLevel:Ho,Icon:Go,useProducts:Xo}=Do,Yo=Do.rowName?(e,n,t)=>Do.rowName(e,n,t):void 0,Jo=Sn(e=>{tt({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),No(e,{scroll:!0})},[tt,No]),{selectNode:Ko,openPartId:Qo}=v({mode:go,setMode:yo,onOpenPart:Jo}),[_o,qo]=yn(null);ge(null!==_o,()=>qo(null));const Zo=y(Y()),er=Zo.collapsed,nr=Zo.panelWidths,[tr,or]=yn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(er);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
12
+ return new Set}});kn(()=>{try{window.localStorage.setItem(er,JSON.stringify([...tr]))}catch{}},[tr]);const[rr,ir]=yn(()=>{if("undefined"==typeof window)return{...k};try{const e=window.localStorage.getItem(nr);if(!e)return{...k};const n=JSON.parse(e);return{left:S(Number(n.left)||k.left),right:S(Number(n.right)||k.right)}}catch{return{...k}}});kn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(nr,JSON.stringify(rr))}catch{}},300);return()=>clearTimeout(e)},[rr]);const lr=Sn((e,n)=>ir(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),sr=Sn(e=>lr("left",e),[lr]),dr=Sn(e=>lr("right",e),[lr]),ar=e=>tr.has(e),cr=e=>or(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),pr=mn(!1),ur=mn(null);kn(()=>{if(pr.current&&!io){const e=ur.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??to.current?.querySelector(`button[aria-label="${CSS.escape(St.add.title)}"]`))?.focus(),ur.current=null}pr.current=io},[io]),kn(()=>{if(!io||!ro)return;const e=e=>{"Escape"===e.key&&Oi()};return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[io,ro]),ge(io,()=>Oi()),kn(()=>{!jt&&io&&(lo(!1),po(null),so.current=!1)},[jt]),kn(()=>{if(!Xt)return ao.current&&tt({type:"setUi",ui:{leftSideBarVisible:!1}}),void(ao.current=!1);io&&(lo(!1),po(null),ao.current=so.current,so.current=!1),jt||(ao.current=!0,tt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[Xt]),kn(()=>{!jt&&Xt&&(ao.current=!1,Yt())},[jt]),kn(()=>{if(!Xt||!ro)return;const e=e=>{"Escape"===e.key&&Yt()};return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[Xt,ro]),ge(null!==Xt,()=>Yt());const fr=J(),hr=(e,n="success")=>{fr?fr(e,"error"===n?"error":"info"):"error"===n?zn.error(e,{duration:3200,sound:!1}):zn.success(e,{duration:1900,sound:!1})},mr=mn(null),[gr,yr]=yn(0),[kr,Sr]=yn(0),vr=K(),wr=mn(null),xr=e=>Math.max(0,e.clientHeight-(wr.current?.offsetHeight??0));kn(()=>{const e=mr.current;if(!e)return;const n=()=>{yr(e.clientWidth),Sr(xr(e))};n();const t=new ResizeObserver(n);return t.observe(e),wr.current&&t.observe(wr.current),()=>t.disconnect()},[]),vn(()=>{mr.current&&(yr(mr.current.clientWidth),Sr(xr(mr.current)))},[rr,jt,Rt]);const br=Wt===Vt?gr>0?gr:Lt[Vt]:Lt[Wt],zr=gr>0?Math.min(gr/br,"shrink"===Ut?1:2):1,Br=br*zr,Cr=gr>0&&Br>gr+1,Nr={width:Br,height:kr||"100%",flex:"none",position:"relative"},Or={width:br,height:kr?kr/zr:"100%",maxHeight:"none",transform:1!==zr?`scale(${zr})`:void 0,transformOrigin:"top left"},Ir=()=>tt({type:"setUi",ui:{leftSideBarVisible:!jt}}),$r=()=>tt({type:"setUi",ui:{rightSideBarVisible:!Rt}}),Pr=e=>{io&&(lo(!1),po(null),so.current=!1,jt&&_t===e)||Xt&&(ao.current=!1,Yt(),jt&&_t===e)||(jt&&_t===e?Ir():(qt(e),jt||tt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Tr=()=>{C(Ee,{accept:"image/*",title:Bt.mediaLibrary})},Ar=()=>{yo(W),At.select(null),u()},Mr=()=>{yo(ht??W),Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}})},jr=nt.data.content??[],Rr=()=>{const e=jr.findIndex(mt),n=jr.findIndex(gt);return{floor:e>=0?e+1:0,cap:n>=0?n:jr.length}},Er=lt,Lr=Ro.stripCopy,Fr=e=>i(e,Lr),Vr=x(),Ur=Te({data:nt.data,config:Er,readOnly:Boolean(Jn),clipboard:Vr,strip:Lr?e=>Lr(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==cn||e.slot!==pn)return{min:0,max:n-1};const{floor:t,cap:o}=Rr();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&yo(W);const t=void 0===n||"node"===n?.kind?n:null;At.commitDocument(e,t)}}),Wr=e=>Ho(e,"block",lt.components[e]?.label??e),Dr=Sn(e=>lt.components[e]?.defaultProps??{},[lt]),Hr=e=>Ho(e,"section",Wr(e)),Gr=e=>l({type:e.type,props:e.props??{}},Hr(e.type),Yo),{nodeAddresses:Xr,zoneItems:Yr}=gn(()=>{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>=le)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of se(lt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(jr,re,0),{nodeAddresses:e,zoneItems:n}},[jr,lt]),Jr=Sn(e=>Yr.get(e)??[],[Yr]),Kr=e=>{const n=Xr.get(e);return n?Jr(n.zone)[n.index]:void 0},Qr=e=>oe(Ro,lt,e),_r=e=>{if(!Ro.slotsOf||e===re)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Kr(e.slice(0,n));if(!t)return null;const o=Qr(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}},qr=(()=>{if(!Q(go))return null;const e=`${go.nodeId}:${go.slot}`;return _r(e)?.slot.panel===go.kind?e:null})(),Zr=mn(null);kn(()=>{const e=Zr.current;if(Zr.current=null,!qr||!Q(go))return;const n=go.nodeId;No(n,{scroll:e!==qr}),or(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[go]);const ei=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Xr.get(e);n&&(n.zone===re?vi(n.index):Qi(n.zone,n.index,e,Kr(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&qr!==i&&(Zr.current=i),Po(null,r),Rt||tt({type:"setUi",ui:{rightSideBarVisible:!0}}),Si(o)},ni=(e,n,t)=>{const o=`${e}:${n}`;if(or(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;qr!==o&&(Zr.current=o);Po(null,{kind:t,nodeId:e,slot:n})},ti=(e,n,t)=>{if(Jn||!Ro.moveSlot)return;const o=Kr(e),r=o?Qr(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Ln,index:n},s=on(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=Ro.moveSlot(e,n,s);"string"==typeof d&&ni(e,d,i.panel)},oi=Xo(),ri=gn(()=>{const e=/* @__PURE__ */new Map;for(const n of oi??[])e.set(n.slug,n.name);return e},[oi]),ii=e=>s(e,Wr,Do.plainText,e=>ri.get(e),Do.rowName),li=(e,n)=>{const t=lt.components[e.type]?.fields,o=n===re||hl(n)?"section":"block",r=n===re&&(mt(e)||gt(e)||pt(e.type)),i="block"===o?d(t):r?null:a(t);return Do.renamePropOf?Do.renamePropOf(e,o,i):i},si=(e,n,t,o)=>{if(!(!Jn&&_o?.zone===e&&_o.index===n))return;const r=(t,o)=>{qo(null),o&&((e,n,t)=>{const o=Jr(e)[n];if(!o)return;const r=li(o,e);r&&At.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
13
+ return Pn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":St.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)},di=n(_(),zt),ai=di.scope({target:Ke,siteId:Wn,docId:Qe}),ci=lt,pi=(e,n)=>n===re?Hr(e):Wr(e),ui=(e,n,t)=>{const o=di.plan(ai,t,pi(t.type,e),ci);o&&(o.changed&&At.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),hr(o.message))},fi=b({nodesIn:Jr,nodeAt:(e,n)=>Jr(e)[n]??null,labelOf:(e,n)=>n===re?Hr(e):Wr(e),renamePropOf:li,beginRename:(e,n)=>qo({zone:e,index:n}),history:{hasPast:ot.hasPast,hasFuture:ot.hasFuture,back:()=>ot.back(),forward:()=>ot.forward()},openAddSection:()=>{At.select(null),Ci(null)},openPageSettings:()=>{At.select(null),yo(W)},pageSettingsLabel:St.pageSettings,words:{menu:bt,styleClipboard:zt,screen:St.menu},readOnly:Boolean(Jn),collapseAll:()=>or(new Set(Jr(re).map(e=>String(e.props.id)))),onPasteRefused:e=>hr(e?St.pasteRefused({name:e.label}):St.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>gl(e,n),menuRows:Ao.menuRows,isLocked:e=>Eo(e.type),duplicateBlocked:e=>Lo(nt.data,e),permits:e=>ie(lt,e.type),canAddTo:Uo,nodeOps:Ur,isPinned:(e,n)=>n===re&&(mt(e)||gt(e)),sectionBand:Rr,openAddInside:(e,n)=>{e===re?vi(n):At.select({zone:e,index:n}),Ci(null)},locate:e=>Xr.get(e)??null,rowNameOf:(e,n)=>n===re?Gr(e):ii(e),selectAt:(e,n,t,o)=>{e===re?vi(n):Qi(e,n,t,o??"")},slotRung:e=>{const n=_r(e);return n?.slot.panel?{label:n.slot.label,select:()=>ei(n.node,n.slot,!1)}:null},style:{held:()=>ke(ai),canCopy:e=>di.rows(ci,e).some(e=>!1!==e.counted),copy:(e,n)=>di.copy(ai,e,pi(e.type,n),ci),paste:(e,n,t)=>ui(e,n,t)},keys:_n?{target:ro,selected:()=>{const e=nt.ui.itemSelector;return e?{zone:e.zone??re,index:e.index}:null},held:()=>Vr.get(),readOnly:Boolean(Jn),onDone:({done:e,name:n})=>{"copied"===e&&hr(St.copied({name:n}))}}:void 0},oo),hi=mn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});kn(()=>{hi.current={copy:(e,n)=>di.copy(ai,e,pi(e.type,n),ci),paste:ui,at:()=>{const e=nt.ui.itemSelector;if(!e)return null;const n=e.zone??re,t=Jr(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Jn)}});const mi=Sn(e=>{const n=Se(e);if(!n)return;const t=hi.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))},[]);kn(()=>{if(!ro)return;const e=e=>mi(e);return ro.addEventListener("keydown",e),()=>ro.removeEventListener("keydown",e)},[mi,ro]),dn(oo,"keydown",mi);const gi=jr.map(e=>e.props.id).join("|");kn(()=>{const e=oo?.document??null,n=oo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void mo(e=>e.length?[]:e);const n=jr.findIndex(gt),t=n>=0?n:jr.length,o=n=>{const t=jr[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(sn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=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=En(l&&s?(s.bottom+l.top)/2:l?l.top:s.bottom,Math.max(-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}mo(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()}},[oo,gi,Wt,zr,jt,Rt,rt?.props.id]);const yi=oo?.document??null,ki=oo?.window??null;kn(()=>{const e=no.current;if(!e||!yi||!ki)return;const n=[],t=()=>{const n=yi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&ki.scrollTo({left:ki.scrollX,top:ki.scrollY+t,behavior:"instant"}),!0};return no.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[yi,ki]);const Si=e=>{Ao.holdCanvasOn?Ao.holdCanvasOn(e):c(e)},vi=e=>{yo(W),At.select({index:e}),Ao.sectionPressed?.(jr[e]);const n=jr[e]?.props?.id;n&&Si(n)},wi=e=>{const{floor:n,cap:t}=Rr(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=rt&&go.kind!==ht?.kind?jr.findIndex(e=>e.props.id===rt.props.id):-1;return o(r>=0?r+1:t)},xi=(e,n)=>{const{floor:t,cap:o}=Rr(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(At.reorderComponent(re,e,i),At.select({index:i}),{moved:!0,dest:i})},bi=(e,n,t,o)=>{yo(W),At.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),hr(St.sectionAdded({name:t}))},zi=(e,n)=>{const t=wi(n),o=Vo(e,{nodeDefaults:Dr,newNodeId:pe,sectionLabel:Hr,blockIsOffered:Wo}),r=o?At.insertNode(re,t,o):At.insertSection(e,t);return bi(t,r,Hr(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of se(lt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=Uo(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:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},Bi=(e,n,t)=>{const o=wi(t),r=At.insertNode(re,o,n);return bi(o,r,e),o},Ci=e=>Ni(re,e),Ni=(e,n)=>{ur.current=document.activeElement??null,Xt&&(so.current=ao.current,ao.current=!1,Yt()),po(null===n?null:{zone:e,index:n}),lo(!0),jt||(so.current=!0,tt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Oi=()=>{lo(!1),po(null),so.current&&tt({type:"setUi",ui:{leftSideBarVisible:!1}}),so.current=!1},Ii=(e,n,t)=>{if("section"===e.kind)At.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;At.insertNode(n,t,Fr(e.template.node))}yo(W),At.select({index:t,zone:n})},$i=(e,n)=>Do.rowName?n?mt(e)?Do.rowName(e,"section",St.header):gt(e)?Do.rowName(e,"section",St.footer):pt(e.type)?Do.rowName(e,"section",Wr(e.type)):Gr(e):ii(e):n?Hr(e.type):Wr(e.type),Pi=e=>n=>{e()},Ti=()=>Ao.editPinnedSource?.(),Ai=(e,n,t)=>{if(Jn)return null;const o=Jr(e)[n];return o&&!ie(lt,o.type).delete?null:/* @__PURE__ */Pn(Ne,{kind:"delete",label:St.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Jr(e)[n]?.props?.id;null!=t&&Ur.remove(String(t))})(e,n),children:/* @__PURE__ */Pn(Nn,{size:15})})},Mi=e=>Do.rowPreview?.(e)||void 0,ji=e=>Do.rowMarks?.(e)??void 0,Ri=(e,n,t)=>Do.rowActions?.(e,n,t)??null,Ei=(e,n,t,o)=>{if(Jn)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
14
+ return Pn(Ne,{kind:"eye",label:r?St.showNamed({name:o}):St.hideNamed({name:o}),onClick:()=>Fi(e,n,t),children:/* @__PURE__ */Pn(r?On:In,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Li=e=>{const n=Hr(jr[e]?.type??""),t=n?St.addSectionBefore({name:n}):St.addSectionHere;return Ll(re,e,()=>Ci(e),t)},Fi=(e,n,t)=>{At.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Vi=e=>de(lt,e),Ui=e=>se(lt,e),Wi=e=>Ro.slotsOf?Qr(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:ae(e,n.slot)})):[{slot:null,rung:null,kids:Ui(e)}],Di=e=>Ro.slotsOf?Wi(e).flatMap(e=>e.kids):Ui(e),Hi=e=>Boolean(Ro.slotsOf)&&Qr(e).some(e=>e.rung),Gi=(e,n,t)=>null===t?void 0===n?Uo(e):Uo(e,n):Uo(e,n,t),Xi=(e,n,t)=>{const o=ce(lt,e.type,n)&&(t||Di(e).length>0||Hi(e));return{collapsible:o,folded:o&&ar(String(e.props.id))}},Yi=(e,n,t)=>Wi(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Xi(e,r,t(e.type)).collapsible?[String(e.props.id),...Yi(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ji=e=>Di(e).length>0||Hi(e)||Boolean(Uo(e.type)),Ki=e=>Boolean(Uo(e)),Qi=(e,n,t,o)=>{if(yo(W),Uo(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),At.select({index:n,zone:e}),c(t)}else At.select({index:n,zone:e}),Si(t)},_i=(e,n,t,o,r)=>{const i=`${e}:${n}`;At.insertComponent(i,t,o),Uo(r)?.spec?.slider?requestAnimationFrame(()=>{p(e,o),At.select({index:o,zone:i})}):At.select({index:o,zone:i})},qi=(e,n,t)=>{At.insertComponent(e,n,t),yo(W),At.select({index:t,zone:e})},Zi=mn(/* @__PURE__ */new Set);kn(()=>{jr.forEach(e=>{const n=Uo(e.type)?.spec;if(!n)return;const t=e.props.id;if(Zi.current.has(t))return;Zi.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(Dr)).forEach((e,t)=>$t.seedChild(o,t,n.childType,e))})},[jr,$t,Dr]);const el=mn(/* @__PURE__ */new Set);kn(()=>{jr.forEach((n,t)=>{const o=n.props.id;if(el.current.has(o))return;const r=e(n,Vi(n.type));el.current.add(o),r&&$t.replaceComponent(re,t,{...n,props:r})})},[jr,$t]),q($t,lt);const nl=jr.findIndex(gt),tl=nl>=0?jr[nl]:null,ol=yt?jr.findIndex(mt):-1,rl=ol>=0?jr[ol]:null,il=jr.find(e=>e.type===at)??null,ll=jr.find(e=>e.type===ct)??null,sl=nl>=0?nl:jr.length,dl=[];jr.forEach(e=>{gt(e)||(Ji(e)&&dl.push(String(e.props.id)),dl.push(...Yi(e,1,Ki)))}),tl&&(dl.push(String(tl.props.id)),dl.push(...Yi(tl,1,Ki)));const al=dl.length>0&&dl.every(e=>tr.has(e)),cl=e=>{const n=Do.blockRowName(e,Wr);return Do.rowName?Do.rowName(e,"block",n):n},pl=(e,n,t,o)=>{const r=Jr(e)[t];if(!r)return;const i={...un(e),index:t},l={...un(n),index:Math.min(Math.max(o,0),Jr(n).length)},s=on(i,l);if(e!==n||s!==t)try{Ur.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof fn))throw e}},ul=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Ui(e))n.add(r),t(o)};for(const t of Vi(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},fl=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Xr.get(n);if(!e)return null;if(e.zone===re)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},hl=e=>{const n=e.slice(0,e.indexOf(":")),t=jr.find(e=>pt(e.type)&&String(e.props.id)===n);return t&&ut(n)===e?t:null},ml=(e,n,t)=>{if(e.rung){const t=Kr(e.rung.nodeId),o=t?Qr(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Ln&&n.index>=0&&n.index<=o}if(n.slot===Ln)return!1;if(e.add)return kl(e.add,n);const o=an(n);if(pt(e.type))return!1;const r=hl(o),i=hl(e.zone);if(r||i)return!(!r||!i)&&(n.index>=0&&n.index<=Jr(o).length);if(e.zone===re||o===re){if(e.zone!==o)return!1;const{floor:t,cap:r}=Rr();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Jr(o).length)return!1;if(e.zone===o)return!0;const l=tl&&!st.lastIsOpen?String(tl.props.id):null;return(!l||fl(e.zone)!==l&&fl(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Jr(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Xr.get(i),s=l?Jr(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ul(r).has(n))return!1;const d=Uo(s.type,Fo(nt?.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?.(Jr(n),r))})(e.zone,o,e.index,t)},gl=(e,n)=>{const t=an(e.from);if(t===an(n))return!0;const o=e.node;return ml({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},yl=e=>{const n=e.slice(0,e.indexOf(":")),t=Xr.get(n),o=t?Jr(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=Uo(o.type,Fo(nt?.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:Wr(r.spec.childType)}]:[]),l=_r(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:$i(o,t.zone===re)}},kl=(e,n)=>{const t=an(n);if("block"!==e.kind){if(hl(t))return n.index>=0&&n.index<=Jr(t).length;if(t!==re)return!1;const{floor:e,cap:o}=Rr();return n.index>=e&&n.index<=o}if(t===re)return!1;const o=yl(t);return!(!o||!o.choices.some(n=>n.type===e.type))&&!o.target.spec?.addBlocked?.(Jr(t))},Sl=(e,n)=>{e.rung?ti(e.rung.nodeId,e.index,n.index):e.add?((e,n)=>{if("block"!==e.kind&&hl(an(n)))return void Ii(e,an(n),n.index);if("section"===e.kind)return void zi(e.type,n.index);if("template"===e.kind)return void Bi(e.template.name,Fr(e.template.node),n.index);const t=an(n),o=yl(t);o&&(o.target.spec?_i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):qi(t,e.type,n.index))})(e.add,n):e.zone===re?xi(e.index,n.index):pl(e.zone,an(n),e.index,n.index)},[vl]=yn(()=>nn()),wl=tn({keyOf:e=>e.id,readOnly:Boolean(Jn),session:vl,canDrop:ml,onDrop:Sl,onStep:(e,n)=>{e.rung?ti(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===re?((e,n)=>{const t=Hr(jr[e]?.type??""),o=xi(e,n<0?e-1:e+2);if(!o.moved)return void hr(n<0?St.sectionFirst({name:t}):St.sectionLast({name:t}));const{floor:r,cap:i}=Rr();hr(St.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):pl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),xl=Sn(e=>{const{floor:n,cap:t}=Rr(),o=[];for(const r of e.nodes){const e=an(r.place),i=Jr(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(mt(i)||gt(i)||Eo(i.type))continue;if(pt(i.type))continue;const l=Boolean(hl(e)),s=e===re||l;e===re&&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?Hr(i.type):ii(i),from:r.place})}return{sources:o,zones:e.zones.flatMap(e=>{const n=an(e.list);return n===re&&0===e.children.length?[{...e,addLabel:St.addSection,addAlways:!0}]:e.children.length>0||Boolean(yl(n)?.choices.length)||Boolean(hl(n))?[e]:[]})}},[nt.data]),bl=null==rt?.props.id?null:String(rt.props.id),zl=Sn(e=>{const n=lt,t=e=>!e.item.rung&&null!==hn(nt.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(bl);return i||(r(Ae(nt.data,n,o.item.id,bl))??o)},[nt.data,lt,bl]),Bl=e=>{yo(W),At.select(e.zone===re?{index:e.index}:{index:e.index,zone:e.zone})},Cl=Z(),Nl=()=>({data:nt.data,device:Wt,ops:At,inspector:To}),Ol=Cl?.model,Il=gn(()=>Ol?e=>Ol(e,xl(e),Nl()):xl,[Ol,xl,Wt]),$l=Cl?.measure,Pl=$l?(e,n)=>$l(e,n,Nl()):void 0,Tl=Cl?.canDrop,Al=Tl?(e,n)=>Tl(e,n,ml,Nl()):ml,Ml=Cl?.drop,jl=Ml?(e,n)=>Ml(e,n,Sl,Nl()):Sl,Rl=Cl?.pick,El=Rl?e=>Rl(e,Bl,Nl()):Bl,Ll=(e,n,t,o)=>/* @__PURE__ */Pn(Oe,{...Jn?{}:wl.seam({place:{...un(e),index:n}}),onAdd:Jn?void 0:t,label:o},`seam:${e}:${n}`),Fl={rowClick:Pi,isCollapsed:ar,toggleCollapse:cr},Vl=e=>{const n=String(e.props.id),t=jr.findIndex(e=>String(e.props.id)===n),o=ut(n),r=Jr(o),i=ar(n),l=Wr(e.type),s=Do.rowName?Do.rowName(e,"section",l):l,d=e=>Ll(o,e,()=>Ni(o,e),St.addSectionHere);/* @__PURE__ */
15
+ return Tn(An,{children:[
16
+ /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:e.type,size:13}),name:s,preview:Mi(e),marks:ji(e),onSelect:()=>vi(t),nameSlot:si(re,t,n,s),selected:bo===n,actions:Ri(e,re,t)??void 0,rowProps:{"data-node-id":n,onClick:Pi(()=>vi(t))},fold:{open:!i,label:"section",onToggle:()=>cr(n)}}),!i&&/* @__PURE__ */Tn(ze,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Gr(n),l=Ji(n),s=l&&ar(r),a=()=>Qi(o,t,r,e.type),{rowProps:c,...p}=wl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...un(o),index:t}},{"data-node-id":r,onClick:Pi(a)});/* @__PURE__ */
17
+ return Tn(wn,{children:[d(t),
18
+ /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:i,preview:Mi(n),marks:ji(n),onSelect:a,nameSlot:si(o,t,r,i),selected:bo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn(An,{children:[Ai(o,t,i),Ri(n,o,t),Ei(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */Pn(ze,{children:Dl(n,2)})]},r)}),d(r.length)]})]})},Ul=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=wl.dragging,d=!ar(l)&&s?.rung?.nodeId!==i,a={...un(l),index:0},c=s&&!s.rung&&ml(s,a)?a:void 0,p=()=>ei(e,n,!0),{rowProps:u,...f}=wl.row({item:{id:`rung:${l}`,zone:`${i}:${Ln}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Ln,index:t},into:c,canDrag:Boolean(Ro.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Pi(p)}),h=Jn?null:Ro.slotActions?.(e,n.slot);/* @__PURE__ */
19
+ return Tn(wn,{children:[n.heading,
20
+ /* @__PURE__ */Pn(be,{words:vt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:qr===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>cr(l)},actions:h&&h.length>0?/* @__PURE__ */Pn(An,{children:h.map((t,o)=>/* @__PURE__ */Pn(Ne,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Jn||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ni(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__ */Pn(Nn,{size:15}):/* @__PURE__ */Pn($n,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Pn(ze,{children:r})]},l)},Wl=(e,n)=>{const t=Wi(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
21
+ return Pn(An,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Gi(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=null!==a&&Boolean(yl(a)?.choices.length),p=(e,n)=>c?Ll(e,n,()=>Ni(e,n),St.addBlockHere):Ll(e,n),u=/* @__PURE__ */Tn(An,{children:[i.map(({child:n,zone:t,index:o})=>{const r=bo===String(n.props.id),{collapsible:i,folded:s}=Xi(n,l,Ki(n.type)),d=String(n.props.id),a=cl(n),c=()=>Qi(t,o,d,e.type),{rowProps:u,...f}=wl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...un(t),index:o}},{"data-node-id":d,onClick:Pi(c)});/* @__PURE__ */
22
+ return Tn(wn,{children:[0===o&&p(t,0),
23
+ /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:a,preview:Mi(n),marks:ji(n),onSelect:c,nameSlot:si(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>cr(d)}:void 0,actions:/* @__PURE__ */Tn(An,{children:[Ai(t,o,a),Ri(n,t,o),Ei(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Pn(ze,{children:Wl(n,l+1)}),p(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?p(d,0):null:0!==i.length||!t.rung&&d!==a?null:p(a,0)]});return t.rung?Ul(e,t.rung,r++,o,u):/* @__PURE__ */Pn(wn,{children:u},t.slot??"")})})},Dl=(e,n)=>{const t=Fo(nt?.data,e.type,String(e.props.id)),o=Wi(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
24
+ return Pn(An,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Gi(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(n,t)=>{const o=n===f&&a&&!a.addBlocked?.(c)?()=>_i(e.props.id,a.slot,a.childType,t,e.type):n===h?()=>Ni(n,t):void 0;return Ll(n,t,o,n===f&&a?a.addLabel:St.addBlockHere)},g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),k=/* @__PURE__ */Tn(An,{children:[l.map(({child:n,zone:t,index:o})=>{const r=bo===String(n.props.id),i=ii(n),l=String(n.props.id),{collapsible:d,folded:a}=Xi(n,s,Ki(n.type)),c=Vi(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...un(p),index:Jr(p).length}:void 0,f=wl.dragging,h=u&&f&&ml(f,u)?u:void 0,g=()=>Qi(t,o,l,e.type),{rowProps:y,...k}=wl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...un(t),index:o},into:h,canDrag:!Eo(n.type)},{"data-node-id":l,onClick:Pi(g)});/* @__PURE__ */
25
+ return Tn(wn,{children:[0===o&&m(t,0),
26
+ /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:n.type,size:13}),name:i,preview:Mi(n),marks:ji(n),onSelect:g,nameSlot:si(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!a,label:"group",onToggle:()=>cr(l)}:void 0,actions:Eo(n.type)?Ri(n,t,o)??void 0:/* @__PURE__ */Tn(An,{children:[Ai(t,o,i),Ri(n,t,o),Ei(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */Pn(ze,{children:Dl(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
27
+ /* @__PURE__ */Pn(N,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>_i(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?Ul(e,o.rung,i++,r,k):/* @__PURE__ */Pn(wn,{children:k},o.slot??"")})})},Hl=(()=>{if(!rt||!ko)return null;const e=String(rt.type),n=String(rt.props.id),t=Uo(e,Fo(nt?.data,e,n));if(!t||"footer"===t.source)return null;const o=jr.some(e=>String(e.props?.id)===n),r=Array.isArray(rt.props[t.slot])?rt.props[t.slot]:[];if(t.spec?.addBlocked?.(r))return null;const i=t.choices??(t.spec?[{type:t.spec.childType,label:Wr(t.spec.childType)}]:[]);return 0===i.length?null:{parentName:$i(rt,o),choices:i,onPick:o=>{t.spec?_i(n,t.slot,o,r.length,e):qi(`${n}:${t.slot}`,o,r.length)}}})(),Gl=wo&&wo.zone!==re&&!hl(wo.zone)?wo.zone:null,Xl=!0===uo.blocksFirst,Yl=Gl?yl(Gl):Xl&&wo?null:Hl,Jl=Boolean(co&&Gl)||Xl&&Boolean(Yl&&Yl.choices.length>0),Kl=io||null!==Xt,Ql=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:jt&&!Kl&&jo===e.id,onSelect:()=>Pr(e.id)}:e,_l=[{id:"add",label:St.add.title,icon:/* @__PURE__ */Pn("span",{className:"sf-rail-plus","aria-hidden":"true",children:"+"}),active:io,onSelect:()=>io?Oi():Ci(null)},...(Ao.railLead??[]).map(Ql),{id:"sections",label:St.layers,icon:/* @__PURE__ */Pn(Me,{}),active:jt&&!Kl&&"sections"===jo,onSelect:()=>Pr("sections")},...(Ao.railTrail??[]).map(Ql)];Gt?_l.push({id:"media",label:St.railMedia,icon:/* @__PURE__ */Pn(je,{}),active:jt&&!io&&(null!==Xt||"media"===jo),onSelect:()=>Pr("media")}):qn&&_l.push({id:"media",label:St.railMedia,icon:/* @__PURE__ */Pn(je,{}),onSelect:Tr});const ql=[...Ao.railLead??[],...Ao.railTrail??[]].find(e=>"panel"in e&&e.id===jo),Zl=Boolean(kt?.foldable)&&!Mo,es=kt?.label??(Zn?St.pageSections:St.templateSections),ns=Zl&&ar(Fn),ts=/* @__PURE__ */Tn(An,{children:[jr.map((e,n)=>{if(mt(e)||gt(e)||pt(e.type))return null;const t=bo===String(e.props.id),o=Boolean(e.props._hidden);Ui(e);const r=String(e.props.id),i=Ao.hasOwnRows?.(e)??!1,l=Ji(e)||i,s=l&&ar(r),d=Vi(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...un(a),index:Jr(a).length}:void 0,p=wl.dragging,u=c&&p&&ml(p,c)?c:void 0,{rowProps:f,...h}=wl.row({item:{id:r,zone:re,index:n,type:e.type},place:{...un(re),index:n},into:u},{"data-node-id":r,onClick:Pi(()=>vi(n))});/* @__PURE__ */
28
+ return Tn(wn,{children:[n>0&&Li(n),
29
+ /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:e.type,size:13}),name:Gr(e),preview:Mi(e),marks:ji(e),onSelect:()=>vi(n),nameSlot:si(re,n,r,Gr(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>cr(r)}:void 0,actions:/* @__PURE__ */Tn(An,{children:[Ai(re,n,Gr(e)),Ri(e,re,n),Ei(re,n,e,Gr(e))]}),rowProps:f}),Ji(e)&&!s&&/* @__PURE__ */Tn(ze,{children:[Dl(e,1),Ao.partRows?.(e,Fl)]}),i&&!s&&/* @__PURE__ */Pn(ze,{children:Ao.ownRows?.(e,n,Fl)})]},String(e.props.id??n))}),!Mo&&sl>0&&Li(sl),kt?.addAtEnd&&!Mo&&!Jn&&/* @__PURE__ */Pn(N,{small:!0,label:St.addSection,blocked:null,onAdd:()=>Ci(sl)})]}),os=(e,n,t)=>{const o=String(e.props.id),r=Di(e).length>0||Hi(e)||Boolean(Uo(e.type)),i=r&&ar(o),l="header"===t?St.header:St.footer,s=Do.rowName?Do.rowName(e,"section",l):l;/* @__PURE__ */
30
+ return Tn(An,{children:[
31
+ /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:t,size:13}),name:s,preview:Mi(e),marks:ji(e),onSelect:()=>vi(n),nameSlot:si(re,n,o,s),selected:bo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>cr(o)}:void 0,actions:Ri(e,re,n)??void 0,rowProps:{"data-node-id":o,onClick:Pi(()=>vi(n))}}),r&&!i&&/* @__PURE__ */Pn(ze,{children:Wl(e,1)})]})};return(Ao.wrap??(e=>e))(
32
+ /* @__PURE__ */Pn(ee,{target:oo,children:/* @__PURE__ */Tn("div",{ref:to,className:"sf-editor es-editor",style:Je(rr),onContextMenu:fi.onEditorContextMenu,...m(Ee),children:[
33
+ /* @__PURE__ */Tn(Le,{children:[
34
+ /* @__PURE__ */Pn(Fe,{items:_l,ariaLabel:St.bar.views}),
35
+ /* @__PURE__ */Tn(Ve,{children:[
36
+ /* @__PURE__ */Pn(Ue,{label:St.bar.undo,disabled:Boolean(Jn)||!ot.hasPast,onClick:()=>ot.back(),children:/* @__PURE__ */Pn(Bn,{})}),
37
+ /* @__PURE__ */Pn(Ue,{label:St.bar.redo,disabled:Boolean(Jn)||!ot.hasFuture,onClick:()=>ot.forward(),children:/* @__PURE__ */Pn(Cn,{})}),
38
+ /* @__PURE__ */Pn(We,{}),
39
+ /* @__PURE__ */Pn(De,{devices:Et,value:Wt,onChange:Dt})]}),
40
+ /* @__PURE__ */Tn(Ve,{kind:"right",style:{minWidth:300},children:[
41
+ /* @__PURE__ */Pn(Mn,{saveState:Hn,notSaving:Boolean(Jn)||null!=Gn,readOnlyReason:Kn,toggle:Qn,onToggle:Yn,onRetry:Xn,words:St.bar,saveWords:xt}),Ao.barLead?.(),
42
+ /* @__PURE__ */Pn(xn,{content:St.bar.refreshTip,side:"bottom",children:/* @__PURE__ */Pn(bn,{variant:"secondary",onClick:()=>{no.current=(()=>{const e=oo?.document;if(!e)return null;const n=jr.findIndex(gt),t=n>=0?n:jr.length;let o=null;for(let n=0;n<t;n++){const t=jr[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=rt?.props?.id??jr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),eo(e=>e+1)},children:St.bar.refresh})}),Ao.barTrail?.(),Ao.barMain?Ao.barMain():/* @__PURE__ */Pn(bn,{variant:"primary",disabled:null!==Kn,onClick:()=>{Dn(nt.data)},children:St.done})]})]}),
43
+ /* @__PURE__ */Pn(z,{}),
44
+ /* @__PURE__ */Tn("div",{className:"sf-body",children:[jt?/* @__PURE__ */Tn(An,{children:[
45
+ /* @__PURE__ */Pn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":St.leftPanel,children:io?/* @__PURE__ */Pn(O,{blocks:Yl,blocksOnly:Jl,at:co?{label:(e=>{const n=hl(e.zone);if(n)return St.add.addingTo({name:Do.rowName?$i(n,!0):Wr(n.type)});if(e.zone===re){const n=jr[e.index];return n&&!gt(n)?St.add.addingBefore({name:$i(n,!0)}):St.add.addingAtEnd}const t=yl(e.zone);return t?St.add.addingTo({name:t.parentName}):St.add.addingHere})(co),onClear:()=>po(null)}:void 0,onAdd:e=>{const n=wo,t=(e,n)=>{co&&po({zone:e,index:n})};if(n&&"block"!==e.kind&&hl(n.zone))return Ii(e,n.zone,n.index),void t(n.zone,n.index+1);if("section"===e.kind)return(e=>{if(null===xo)return void zi(e);const n=zi(e,xo);co&&fo(n+1)})(e.type);if("template"===e.kind)return((e,n)=>{if(null===xo)return void Bi(e,n);const t=Bi(e,n,xo);co&&fo(t+1)})(e.template.name,Fr(e.template.node));if(n&&n.zone!==re){const o=yl(n.zone);if(!o)return;return o.target.spec?_i(o.parentId,o.target.slot,e.type,n.index,o.parent.type):qi(n.zone,e.type,n.index),void t(n.zone,n.index+1)}Hl?.onPick(e.type)},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:vl,siteWide:Ao.addPanelRow?.(Oi),onClose:Oi,onHide:Ir,readOnly:Boolean(Jn)}):Xt&&Ht?
46
+ /* @__PURE__ */Pn(P,{panel:Ht,pick:Xt,onHide:Ir}):ql?ql.panel({onHide:Ir,notify:hr}):"media"===jo&&Ht?/* @__PURE__ */Pn(P,{panel:Ht,pick:null,onHide:Ir}):/* @__PURE__ */Tn(An,{children:[
47
+ /* @__PURE__ */Pn(I,{icon:/* @__PURE__ */Pn(Me,{}),title:St.layers,context:Ct,actions:
48
+ /* @__PURE__ */Pn(He,{label:al?St.expandAll:St.collapseAll,title:0===dl.length?St.nothingToFold:void 0,disabled:0===dl.length,onClick:()=>or(e=>{const n=new Set(dl);return al?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...dl])}),children:/* @__PURE__ */Pn(jn,{expand:al})}),onHide:Ir}),
49
+ /* @__PURE__ */Tn(Be,{className:"sf-tree sf-scroll",words:vt,children:[
50
+ /* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"page",size:13}),name:St.pageSettings,onSelect:Ar,selected:!rt&&ko,rowProps:{onClick:Pi(Ar)}}),il&&/* @__PURE__ */Tn(An,{children:[
51
+ /* @__PURE__ */Pn(Ce,{children:St.header}),Vl(il)]}),!Mo&&et&&/* @__PURE__ */Tn(An,{children:[
52
+ /* @__PURE__ */Pn(Ce,{children:St.header}),!yt&&/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"header",size:13}),name:St.header,onSelect:Mr,selected:go.kind===ht?.kind,rowProps:{onClick:Pi(Mr)}})]}),!Mo&&rl&&os(rl,ol,"header"),!Mo&&!Zl&&/* @__PURE__ */Pn(Ce,{children:es}),Zl?/* @__PURE__ */Tn(An,{children:[
53
+ /* @__PURE__ */Pn(be,{words:vt,icon:null,name:es,fold:{open:!ns,label:es,onToggle:()=>cr(Fn)}}),!ns&&/* @__PURE__ */Pn(ze,{children:ts})]}):ts,et&&/* @__PURE__ */Pn(Ce,{children:St.footer}),tl&&os(tl,nl,"footer"),!Mo&&!tl&&et&&/* @__PURE__ */Pn(be,{words:vt,icon:/* @__PURE__ */Pn(Go,{type:"footer",size:13}),name:St.footer,onSelect:Ti,rowProps:{onClick:Pi(Ti),title:St.editFooter}}),ll&&Vl(ll),Ao.treeFoot?.()]})]})}),
54
+ /* @__PURE__ */Pn(Ge,{side:"left",width:rr.left,min:Ye,max:Xe,defaultWidth:k.left,label:St.resizeLeftPanel,onResize:sr})]}):/* @__PURE__ */Pn($,{side:"left",onShow:Ir}),
55
+ /* @__PURE__ */Tn("div",{ref:mr,className:"sf-center sf-scroll","data-sf-canvas-head":vr?"":void 0,style:{overflowX:Cr?"auto":"hidden",overflowY:"hidden"},children:[vr&&/* @__PURE__ */Pn("div",{ref:wr,className:"sf-canvas-head",children:/* @__PURE__ */Pn(vr,{device:Wt})}),
56
+ /* @__PURE__ */Pn("div",{className:"sf-frame-scaler",style:Nr,children:/* @__PURE__ */Pn("div",{className:"sf-frame "+(Wt===Vt?"":`sf-frame--${Wt}`),style:Or,children:/* @__PURE__ */Tn("div",{className:"sf-preview-host",children:[
57
+ /* @__PURE__ */Pn(Nt,{},Zt),
58
+ /* @__PURE__ */Pn(Ze,{canvas:oo,session:vl,model:Il,measure:Pl,canDrop:Al,onDrop:jl,choose:zl,onPick:El,onZoneAdd:e=>{const n=an(e),t=_r(n);t&&ei(t.node,t.slot,!1),Ni(n,0)},zoneAddLabel:St.canvasAddBlock,words:wt.canvas,readOnly:Boolean(Jn),revision:nt.data}),ho.length>0&&/* @__PURE__ */Pn("div",{className:"sf-preview-gaps","aria-hidden":"true",children:ho.map(e=>/* @__PURE__ */Tn("button",{type:"button",tabIndex:-1,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},onClick:()=>Ci(e.index),children:[
59
+ /* @__PURE__ */Pn("span",{className:"sf-preview-gap-line"}),
60
+ /* @__PURE__ */Tn("span",{className:"sf-preview-gap-pill",children:[
61
+ /* @__PURE__ */Pn("span",{className:"sf-preview-gap-plus",children:"+"}),
62
+ /* @__PURE__ */Pn("span",{className:"sf-preview-gap-label",children:St.addSection})]})]},e.index))})]})})})]}),Rt?/* @__PURE__ */Tn(An,{children:[
63
+ /* @__PURE__ */Pn(g,{value:{selectChild:Qi,addChild:_i,childRowName:ii,blockRowName:cl},children:/* @__PURE__ */Pn(Ot,{mode:go,onOpenWebsiteSettings:Ao.openSettings??(()=>{}),onOpenSiteStyles:Ao.openStyles,onSelectNode:Ko,onNotify:hr,onHidePanel:$r,nodeActions:rt?ie(lt,rt.type):Vn})}),
64
+ /* @__PURE__ */Pn(Ge,{side:"right",width:rr.right,min:Ye,max:Xe,defaultWidth:k.right,label:St.resizeSettingsPanel,onResize:dr})]}):
65
+ /* @__PURE__ */Pn($,{side:"right",onShow:$r})]}),fi.menu]})}))}export{Un as ScreenChrome};
@@ -1,4 +1,4 @@
1
- import{blockRuns as e}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as r}from"./chunk-EXCKAZKN.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.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-6XXW6ZW3.js";import{DEFAULT_SCREEN_WORDS as s}from"./chunk-MCHMF32I.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,5 +1,5 @@
1
- import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PFNIVZPN.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-EXCKAZKN.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-MCHMF32I.js";import{useEasel as f}from"./chunk-DSUMM2WF.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-AYNU4FYF.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-O2NLQBFX.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as $,jsxs as F,Fragment as N}from"react/jsx-runtime";var B=e=>`section:${e}`,O=e=>`block:${e}`,v=e=>`template:${e}`;function I({blocks:I,blocksOnly:x,at:A,onAdd:V,itemFor:C,session:H,siteWide:L,onClose:M,onHide:D,readOnly:P}){const Y=f(e=>e.config),w=p(),{labelAtLevel:K,categoryLabel:Q,firstSection:R,Icon:S,Thumbnail:T}=w,{blockIsOffered:W}=m(),Z=u("screen",d).add,z=u("drag",h).add,E=l(),[U,X]=y([]);b(()=>{let t=!1;const o=e=>W(e,E);return s(E).list().then(n=>{if(t)return;const i=Y.components;X(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[Y,E]);const G=j(()=>t(Y,w),[Y]),J=e=>({type:B(e.type),label:e.name,cover:/* @__PURE__ */$(T,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:Z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=j(()=>{const e=[];if(I&&I.choices.length>0&&a(I.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${Z.inside({name:I.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:O(e.type),label:e.label,icon:/* @__PURE__ */$(S,{type:e.type,size:18}),title:Z.tile({name:e.label})}))})}),x)return e;const t=o(G,R);t&&e.push({key:"start",title:Z.startBlank,tiles:[J(t)]}),U.length>0&&e.push({key:"templates",title:Z.templates,tiles:U.map(e=>{return{type:v(e.id),label:e.name,cover:/* @__PURE__ */$(T,{type:e.node.type}),keywords:[(t=e.node.type,K(t,"section",Y.components[t]?.label??t)),e.node.type]};var t})});const s=n(G,R);for(const t of Object.keys(Y.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(Y,t,Q),tiles:o.map(J)})}return e},[I,x,U,G,Y,Z]),_=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=U.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
2
- return F(N,{children:[
3
- /* @__PURE__ */$(r,{icon:/* @__PURE__ */$(g,{size:15}),title:Z.title,context:x?Z.contextBlocks:Z.contextAll,actions:/* @__PURE__ */$(c,{label:Z.done,description:Z.doneDescription,onClick:M}),onHide:D}),
1
+ import{blockTypesIn as e}from"./chunk-5ZBY24K7.js";import{buildPaletteSections as t,pinnedSection as o,paletteWithoutPinned as n,categoryLabel as i}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as r,PanelModeExit as c}from"./chunk-PFNIVZPN.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as a}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as p,useScreenBlockRules as m}from"./chunk-6XXW6ZW3.js";import{DEFAULT_SCREEN_WORDS as d}from"./chunk-MCHMF32I.js";import{useEasel as f}from"./chunk-DSUMM2WF.js";import{useWords as u}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-AYNU4FYF.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-O2NLQBFX.js";import{useState as y,useEffect as b,useMemo as j}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as $,jsxs as F,Fragment as B}from"react/jsx-runtime";var N=e=>`section:${e}`,O=e=>`block:${e}`,v=e=>`template:${e}`;function I({blocks:I,blocksOnly:x,at:V,onAdd:A,itemFor:H,session:L,siteWide:M,onClose:W,onHide:C,readOnly:D}){const P=f(e=>e.config),Y=p(),{labelAtLevel:w,categoryLabel:Q,firstSection:R,Icon:S,Thumbnail:T}=Y,{blockIsOffered:X}=m(),Z=u("screen",d).add,z=u("drag",h).add,U=l(),[E,G]=y([]);b(()=>{let t=!1;const o=e=>X(e,U);return s(U).list().then(n=>{if(t)return;const i=P.components;G(n.filter(t=>t.node?.type&&i[t.node.type]&&e(t.node).every(o)))}).catch(()=>{}),()=>{t=!0}},[P,U]);const J=j(()=>t(P,Y),[P]),K=e=>({type:N(e.type),label:e.name,cover:/* @__PURE__ */$(T,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:Z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),q=j(()=>{const e=[];if(I&&I.choices.length>0&&a(I.choices).forEach((t,o)=>{e.push({key:`blocks:${o}`,title:0===o?`${Z.inside({name:I.parentName})}${t.group?` · ${t.group}`:""}`:t.group??"",tiles:t.items.map(e=>({type:O(e.type),label:e.label,icon:/* @__PURE__ */$(S,{type:e.type,size:18}),title:Z.tile({name:e.label})}))})}),x)return e;const t=o(J,R);t&&e.push({key:"start",title:Z.startBlank,tiles:[K(t)]}),E.length>0&&e.push({key:"templates",title:Z.templates,tiles:E.map(e=>{return{type:v(e.id),label:e.name,cover:/* @__PURE__ */$(T,{type:e.node.type}),keywords:[(t=e.node.type,w(t,"section",P.components[t]?.label??t)),e.node.type]};var t})});const s=n(J,R);for(const t of Object.keys(P.categories??{})){const o=s.filter(e=>e.cat===t);0!==o.length&&e.push({key:`category:${t}`,title:i(P,t,Q),tiles:o.map(K)})}return e},[I,x,E,J,P,Z]),_=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=E.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null};/* @__PURE__ */
2
+ return F(B,{children:[
3
+ /* @__PURE__ */$(r,{icon:/* @__PURE__ */$(g,{size:15}),title:Z.title,context:x?Z.contextBlocks:Z.contextAll,actions:/* @__PURE__ */$(c,{label:Z.done,description:Z.doneDescription,onClick:W}),onHide:C}),
4
4
  /* @__PURE__ */F("div",{className:"sf-addside sf-scroll",children:[
5
- /* @__PURE__ */$(k,{groups:q,session:H,itemFor:e=>C(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&V(t)},at:A,hint:x?Z.hintBlocks:Z.hint,searchLabel:x?Z.searchBlocks:Z.searchSections,readOnly:P,words:z}),L&&!x?L:null]})]})}export{I as AddSidePanel,O as blockKey,B as sectionKey,v as templateKey};
5
+ /* @__PURE__ */$(k,{groups:q,session:L,itemFor:e=>H(_(e)??{kind:"section",type:e}),onInsert:e=>{const t=_(e);t&&A(t)},at:V,hint:x?Z.hintBlocks:Z.hint,searchLabel:x?Z.searchBlocks:Z.searchSections,readOnly:D,words:z}),M&&!x?M:null]})]})}export{I as AddSidePanel,O as blockKey,N as sectionKey,v as templateKey};