efficient-easel 20.1.0 → 20.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/chrome/chrome.css +2 -1
  2. package/dist/{chunk-PEDR7G3K.js → chunk-2BOXPUGF.js} +1 -1
  3. package/dist/chunk-3R3PEVU7.js +65 -0
  4. package/dist/{chunk-ROPYFLNZ.js → chunk-EFHV56BO.js} +13 -13
  5. package/dist/chunk-FGJTX2DL.js +8 -0
  6. package/dist/{chunk-LDEEFLE3.js → chunk-H2PRGXCW.js} +8 -8
  7. package/dist/{chunk-HBBXDGDD.js → chunk-I7BROL77.js} +1 -1
  8. package/dist/{chunk-H4JCMK36.js → chunk-JQXD3TDE.js} +1 -1
  9. package/dist/{chunk-5THLKXTH.js → chunk-L2Y3PF2R.js} +1 -1
  10. package/dist/chunk-MEHLY5Q4.js +1 -0
  11. package/dist/{chunk-WBFLSCTI.js → chunk-OTONLZR4.js} +3 -3
  12. package/dist/chunk-PAOZMXEI.js +5 -0
  13. package/dist/{chunk-2E2SXDYQ.js → chunk-TNGOL65V.js} +1 -1
  14. package/dist/chunk-WEIE2FBC.js +1 -0
  15. package/dist/copy/index.js +13 -13
  16. package/dist/drag/index.js +1 -1
  17. package/dist/easel/index.js +1 -1
  18. package/dist/fields/index.js +1 -1
  19. package/dist/screen/components/AddBlockRow.js +1 -1
  20. package/dist/screen/components/AddSidePanel.js +1 -1
  21. package/dist/screen/components/NodeContextMenu.js +1 -1
  22. package/dist/screen/components/ScreenChrome.js +1 -1
  23. package/dist/screen/components/ScreenMount.js +1 -1
  24. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  25. package/dist/screen/components/SectionScreenShell.js +15 -15
  26. package/dist/screen/components/usePartBridge.js +1 -1
  27. package/dist/screen/index.js +1 -1
  28. package/dist/screen/lib/key-scope.js +1 -1
  29. package/dist/screen/lib/puck/preview-dom.js +1 -1
  30. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  31. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  32. package/dist/screen/lib/screen-parts.d.ts +5 -0
  33. package/dist/screen/lib/screen-parts.js +1 -1
  34. package/dist/screen/screen.css +37 -0
  35. package/dist/strings/index.js +1 -1
  36. package/dist/text-styles/index.js +21 -21
  37. package/package.json +1 -1
  38. package/dist/chunk-47CD7ULN.js +0 -1
  39. package/dist/chunk-47PYYMFM.js +0 -8
  40. package/dist/chunk-LEZFSSQN.js +0 -5
  41. package/dist/chunk-PI6RFJR4.js +0 -1
  42. package/dist/chunk-RVZJ52EP.js +0 -63
@@ -1,2 +1,2 @@
1
- import{DEFAULT_SCREEN_WORDS as r}from"../chunk-23DYNW6S.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as o}from"../chunk-6WY6ZXJG.js";import{DEFAULT_TEXT_STYLES_WORDS as n}from"../chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as t}from"../chunk-OFBZOI6W.js";import{DEFAULT_CANVAS_WORDS as c}from"../chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as e}from"../chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as m}from"../chunk-WK3AFPXY.js";import{DEFAULT_PANEL_WORDS as i}from"../chunk-KFV7N2DJ.js";import{DEFAULT_SAVE_WORDS as s}from"../chunk-H6DDIBQ4.js";import{DEFAULT_COPY_WORDS as u}from"../chunk-KRL3IUV3.js";import{DEFAULT_FIELDS_WORDS as f}from"../chunk-WRFD4EXD.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as l}from"../chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as h}from"../chunk-2OAZYSWJ.js";import{DEFAULT_LOCK_WORDS as j}from"../chunk-RE4LP46F.js";import{stringsContext as k}from"../chunk-MFIRYGHW.js";import{DEFAULT_DRAG_WORDS as a}from"../chunk-KAML3KQH.js";import{useContext as W,useMemo as D}from"react";import{jsx as Y}from"react/jsx-runtime";var y={notice:l,lock:j,save:s,chrome:p,rail:h,tree:e,panel:i,fields:f,pick:t,drag:a,menu:m,styleClipboard:o,copy:u,canvas:c,textStyles:n,screen:r},F=r=>"object"==typeof r&&null!==r;function K(r,o){const n={};for(const t of Object.keys(r)){const c=r[t],e=o[t];null==e?n[t]=c:F(c)?n[t]=F(e)?K(c,e):c:n[t]=typeof e==typeof c?e:c}return n}function d(r,o){return o?K(r,o):r}function v({value:r,locale:o,children:n}){const t=k(),c=W(t),e=c?.strings??y,m=o??c?.locale??"en",i=D(()=>({strings:d(e,r),locale:m}),[e,r,m]);/* @__PURE__ */
1
+ import{DEFAULT_SCREEN_WORDS as r}from"../chunk-23DYNW6S.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as o}from"../chunk-6WY6ZXJG.js";import{DEFAULT_TEXT_STYLES_WORDS as n}from"../chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as t}from"../chunk-OFBZOI6W.js";import{DEFAULT_CANVAS_WORDS as c}from"../chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as e}from"../chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as m}from"../chunk-WK3AFPXY.js";import{DEFAULT_PANEL_WORDS as i}from"../chunk-KFV7N2DJ.js";import{DEFAULT_SAVE_WORDS as s}from"../chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as u,DEFAULT_NOTICE_WORDS as f}from"../chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as p}from"../chunk-2OAZYSWJ.js";import{DEFAULT_LOCK_WORDS as l}from"../chunk-RE4LP46F.js";import{DEFAULT_COPY_WORDS as h}from"../chunk-KRL3IUV3.js";import{DEFAULT_FIELDS_WORDS as j}from"../chunk-WRFD4EXD.js";import{stringsContext as k}from"../chunk-MFIRYGHW.js";import{DEFAULT_DRAG_WORDS as a}from"../chunk-KAML3KQH.js";import{useContext as W,useMemo as D}from"react";import{jsx as Y}from"react/jsx-runtime";var y={notice:f,lock:l,save:s,chrome:u,rail:p,tree:e,panel:i,fields:j,pick:t,drag:a,menu:m,styleClipboard:o,copy:h,canvas:c,textStyles:n,screen:r},F=r=>"object"==typeof r&&null!==r;function K(r,o){const n={};for(const t of Object.keys(r)){const c=r[t],e=o[t];null==e?n[t]=c:F(c)?n[t]=F(e)?K(c,e):c:n[t]=typeof e==typeof c?e:c}return n}function d(r,o){return o?K(r,o):r}function v({value:r,locale:o,children:n}){const t=k(),c=W(t),e=c?.strings??y,m=o??c?.locale??"en",i=D(()=>({strings:d(e,r),locale:m}),[e,r,m]);/* @__PURE__ */
2
2
  return Y(t.Provider,{value:i,children:n})}function H(){return W(k())?.strings??y}function J(){return W(k())?.locale??"en"}export{y as DEFAULT_EASEL_STRINGS,v as EaselStringsProvider,d as mergeEaselStrings,J as useEaselLocale,H as useEaselStrings};
@@ -1,36 +1,36 @@
1
- import{hexReadout as e,ColourWindow as s,typedHex as t}from"../chunk-U6LJ5UKD.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-OFBZOI6W.js";import{FieldSlider as n}from"../chunk-ZEH6QLBH.js";import{TEXT_STYLE_KINDS as l,canAddTextStyle as i,TEXT_STYLE_MAX as r,isDefaultTextStyle as o,CAMPAIGN_TEXT_STYLE_SETTINGS as d,TEXT_STYLE_SETTINGS as c,textStyleRowSize as u,describeTextStyle as m,updateTextStyle as h,textStyleCaseCss as f,TEXT_STYLE_CASES as p,addTextStyle as v,removeTextStyle as y,TEXT_STYLE_RANGES as S}from"../chunk-YHZSBL2N.js";export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,updateTextStyle,weightWord}from"../chunk-YHZSBL2N.js";import{FieldSelect as g}from"../chunk-QAJAEWCZ.js";import"../chunk-WRFD4EXD.js";import{useWords as b}from"../chunk-MFIRYGHW.js";import{withTip as k}from"../chunk-P2VEMZH5.js";import{hsvToHex as N,Tooltip as C,ColorSwatch as x,IconButton as T}from"efficient-shell/ui";import{useState as w,useRef as E,useId as z,useEffect as O,Fragment as _}from"react";import{TrashIcon as L,ChevronIcon as A,BoldIcon as j,ItalicIcon as M,CaseLowerIcon as $,CaseCapitalizedIcon as D,CaseUpperIcon as W,CaseNormalIcon as Y}from"efficient-shell/icons/efficient";import{jsxs as I,jsx as X,Fragment as H}from"react/jsx-runtime";var B=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>N({h:e,s:1,v:1})).join(", ")})`;function F({value:t,hex:a,colours:n,label:l,followsWord:i,anyWord:r,onChange:o,readOnly:d=!1}){const[c,u]=w(!1),m=E(null),h=E(null),f=z(),p=void 0!==t&&n.some(e=>e.key===t),v=void 0!==t&&!p;return O(()=>{if(!c)return;const e=m.current?.ownerDocument;if(!e)return;const s=e=>{m.current&&!m.current.contains(e.target)&&u(!1)};return e.addEventListener("click",s,!0),()=>e.removeEventListener("click",s,!0)},[c]),/* @__PURE__ */I("div",{ref:m,className:"es-ts-set","data-ts-setting":"color",children:[
1
+ import{hexReadout as e,ColourWindow as s,typedHex as t}from"../chunk-U6LJ5UKD.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-OFBZOI6W.js";import{FieldSlider as n}from"../chunk-ZEH6QLBH.js";import{FieldSelect as l}from"../chunk-QAJAEWCZ.js";import"../chunk-WRFD4EXD.js";import{useWords as i}from"../chunk-MFIRYGHW.js";import{withTip as r}from"../chunk-P2VEMZH5.js";import{TEXT_STYLE_KINDS as o,canAddTextStyle as d,TEXT_STYLE_MAX as c,isDefaultTextStyle as u,CAMPAIGN_TEXT_STYLE_SETTINGS as m,TEXT_STYLE_SETTINGS as h,textStyleRowSize as f,describeTextStyle as p,updateTextStyle as v,textStyleCaseCss as y,TEXT_STYLE_CASES as S,addTextStyle as g,removeTextStyle as b,TEXT_STYLE_RANGES as k}from"../chunk-YHZSBL2N.js";export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,updateTextStyle,weightWord}from"../chunk-YHZSBL2N.js";import{hsvToHex as N,Tooltip as C,ColorSwatch as x,IconButton as T}from"efficient-shell/ui";import{useState as w,useRef as E,useId as z,useEffect as O,Fragment as _}from"react";import{TrashIcon as L,ChevronIcon as A,BoldIcon as j,ItalicIcon as M,CaseLowerIcon as $,CaseCapitalizedIcon as D,CaseUpperIcon as W,CaseNormalIcon as Y}from"efficient-shell/icons/efficient";import{jsxs as I,jsx as X,Fragment as H}from"react/jsx-runtime";var B=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>N({h:e,s:1,v:1})).join(", ")})`;function F({value:t,hex:a,colours:n,label:l,followsWord:i,anyWord:r,onChange:o,readOnly:d=!1}){const[c,u]=w(!1),m=E(null),h=E(null),f=z(),p=void 0!==t&&n.some(e=>e.key===t),v=void 0!==t&&!p;return O(()=>{if(!c)return;const e=m.current?.ownerDocument;if(!e)return;const s=e=>{m.current&&!m.current.contains(e.target)&&u(!1)};return e.addEventListener("click",s,!0),()=>e.removeEventListener("click",s,!0)},[c]),/* @__PURE__ */I("div",{ref:m,className:"es-ts-set","data-ts-setting":"color",children:[
2
2
  /* @__PURE__ */I("div",{className:"es-ts-top",children:[
3
3
  /* @__PURE__ */X("span",{className:"es-ts-sub",children:l}),
4
4
  /* @__PURE__ */X("span",{className:"es-ts-colour-read",children:a?e(a):i})]}),
5
5
  /* @__PURE__ */I("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[n.map(s=>/* @__PURE__ */X(C,{content:`${s.name} · ${e(s.value)}`,children:/* @__PURE__ */X(x,{color:s.value,size:"sm",className:"es-ts-swatch","aria-label":s.name,selected:t===s.key,disabled:d,onClick:()=>o(s.key)})},s.key)),
6
- /* @__PURE__ */X(C,{content:r,children:/* @__PURE__ */X(x,{ref:h,color:B,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:v,"aria-expanded":c,"aria-controls":c?f:void 0,disabled:d,onClick:()=>u(e=>!e)})})]}),c?/* @__PURE__ */X(s,{id:f,value:a??"",onChange:e=>o(e),label:l,readOnly:d,onClose:()=>{u(!1),h.current?.focus()}}):null]})}function P({styles:e,onChange:s,fonts:t,colours:n=[],settings:c=d,auto:u=[],fallback:m,sample:h,openId:f,defaultOpenId:p=null,onOpenChange:S,onAdd:g,rowActions:N,onRemove:C,max:x=r,device:T="desktop",readOnly:_=!1}){const A=b("textStyles",a),j=z(),[M,$]=w(p),D=void 0!==f?f:M,W=e=>{void 0===f&&$(e),S?.(e)},Y=E(null),[B,F]=w(null);O(()=>{if(!B||!Y.current)return;const e=[...Y.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===B.id),s=e?e.querySelector(".es-ts-row"):Y.current.querySelector(`.es-ts-add[data-ts-kind="${B.kind}"]`);s?.focus(),F(null)},[B]);/* @__PURE__ */
7
- return X("div",{className:"es-ts",ref:Y,children:l.map(a=>{const l=e.filter(e=>e.kind===a),r=!i(e,a,x),d=!_&&!r;/* @__PURE__ */
8
- return I(R,{label:A.groups[a],children:[l.map(a=>{const l=N?.(a),i=null!=l&&!1!==l,r=Boolean(C)&&!_&&!o(a);/* @__PURE__ */
9
- return X(G,{style:a,fonts:t,colours:n,settings:c,auto:u,fallback:m,sample:h,device:T,readOnly:_,open:D===a.id,onOpenChange:e=>W(e?a.id:null),onChange:t=>s(e.map(e=>e.id===t.id?t:e)),actions:r||i?/* @__PURE__ */I(H,{children:[r?k(A.remove,/* @__PURE__ */X("button",{type:"button",className:"es-ts-del","aria-label":A.removeNamed({name:a.name}),onClick:()=>(t=>{if(_||!C)return;const a=y(e,t.id,{name:A.styleName});if(!a)return;const n=e.filter(e=>e.kind===t.kind),l=n[n.indexOf(t)+1];D===t.id&&W(null),s(a.styles),C(a.removed),F({id:l?.id??null,kind:t.kind})})(a),children:/* @__PURE__ */X(L,{size:14,"aria-hidden":"true"})})):null,i?l:null]}):null},a.id)}),k(!_&&r?A.full({kind:a,max:x}):void 0,/* @__PURE__ */I("button",{type:"button",className:"es-ts-add","data-ts-kind":a,disabled:_,"aria-disabled":!(_||!r)||void 0,"aria-describedby":!_&&r?`${j}-full-${a}`:void 0,onClick:()=>{d&&(t=>{if(_)return;const a=v(e,t,{max:x,name:A.styleName,make:g});a&&s(a.styles)})(a)},children:[
6
+ /* @__PURE__ */X(C,{content:r,children:/* @__PURE__ */X(x,{ref:h,color:B,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:v,"aria-expanded":c,"aria-controls":c?f:void 0,disabled:d,onClick:()=>u(e=>!e)})})]}),c?/* @__PURE__ */X(s,{id:f,value:a??"",onChange:e=>o(e),label:l,readOnly:d,onClose:()=>{u(!1),h.current?.focus()}}):null]})}function P({styles:e,onChange:s,fonts:t,colours:n=[],settings:l=m,auto:h=[],fallback:f,sample:p,openId:v,defaultOpenId:y=null,onOpenChange:S,onAdd:k,rowActions:N,onRemove:C,max:x=c,device:T="desktop",readOnly:_=!1}){const A=i("textStyles",a),j=z(),[M,$]=w(y),D=void 0!==v?v:M,W=e=>{void 0===v&&$(e),S?.(e)},Y=E(null),[B,F]=w(null);O(()=>{if(!B||!Y.current)return;const e=[...Y.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===B.id),s=e?e.querySelector(".es-ts-row"):Y.current.querySelector(`.es-ts-add[data-ts-kind="${B.kind}"]`);s?.focus(),F(null)},[B]);/* @__PURE__ */
7
+ return X("div",{className:"es-ts",ref:Y,children:o.map(a=>{const i=e.filter(e=>e.kind===a),o=!d(e,a,x),c=!_&&!o;/* @__PURE__ */
8
+ return I(R,{label:A.groups[a],children:[i.map(a=>{const i=N?.(a),o=null!=i&&!1!==i,d=Boolean(C)&&!_&&!u(a);/* @__PURE__ */
9
+ return X(G,{style:a,fonts:t,colours:n,settings:l,auto:h,fallback:f,sample:p,device:T,readOnly:_,open:D===a.id,onOpenChange:e=>W(e?a.id:null),onChange:t=>s(e.map(e=>e.id===t.id?t:e)),actions:d||o?/* @__PURE__ */I(H,{children:[d?r(A.remove,/* @__PURE__ */X("button",{type:"button",className:"es-ts-del","aria-label":A.removeNamed({name:a.name}),onClick:()=>(t=>{if(_||!C)return;const a=b(e,t.id,{name:A.styleName});if(!a)return;const n=e.filter(e=>e.kind===t.kind),l=n[n.indexOf(t)+1];D===t.id&&W(null),s(a.styles),C(a.removed),F({id:l?.id??null,kind:t.kind})})(a),children:/* @__PURE__ */X(L,{size:14,"aria-hidden":"true"})})):null,o?i:null]}):null},a.id)}),r(!_&&o?A.full({kind:a,max:x}):void 0,/* @__PURE__ */I("button",{type:"button",className:"es-ts-add","data-ts-kind":a,disabled:_,"aria-disabled":!(_||!o)||void 0,"aria-describedby":!_&&o?`${j}-full-${a}`:void 0,onClick:()=>{c&&(t=>{if(_)return;const a=g(e,t,{max:x,name:A.styleName,make:k});a&&s(a.styles)})(a)},children:[
10
10
  /* @__PURE__ */X("span",{className:"es-ts-add-word",children:A.add[a]}),
11
- /* @__PURE__ */X("span",{className:"es-ts-count",children:A.count({n:l.length,max:x})})]})),_||!r?null:/* @__PURE__ */X("span",{id:`${j}-full-${a}`,className:"es-vh",children:A.full({kind:a,max:x})})]},a)})})}function R({label:e,children:s}){const t=z();/* @__PURE__ */
11
+ /* @__PURE__ */X("span",{className:"es-ts-count",children:A.count({n:i.length,max:x})})]})),_||!o?null:/* @__PURE__ */X("span",{id:`${j}-full-${a}`,className:"es-vh",children:A.full({kind:a,max:x})})]},a)})})}function R({label:e,children:s}){const t=z();/* @__PURE__ */
12
12
  return I("section",{className:"es-ts-section","aria-labelledby":t,children:[
13
- /* @__PURE__ */X("div",{className:"es-ts-group",id:t,children:e}),s]})}function G({style:e,fonts:s,colours:t=[],settings:n=d,auto:l=[],fallback:i,sample:r,open:o,onOpenChange:f,onChange:p,actions:v,device:y="desktop",readOnly:S=!1}){const g=b("textStyles",a),k=`${z()}-open-${e.id}`,N=new Set(l),C=c.filter(e=>n.includes(e)),x={...i?.(e)??{},...e.values},T="phone"===y,w=T&&void 0!==e.values.sizePhone?{...x,size:e.values.sizePhone}:x,E=s.find(e=>e.value===x.font),O={fontFamily:E?.family,fontSize:`${u(w.size??16)}px`,fontWeight:x.weight,fontStyle:x.italic?"italic":void 0};/* @__PURE__ */
13
+ /* @__PURE__ */X("div",{className:"es-ts-group",id:t,children:e}),s]})}function G({style:e,fonts:s,colours:t=[],settings:n=m,auto:l=[],fallback:r,sample:o,open:d,onOpenChange:c,onChange:u,actions:y,device:S="desktop",readOnly:g=!1}){const b=i("textStyles",a),k=`${z()}-open-${e.id}`,N=new Set(l),C=h.filter(e=>n.includes(e)),x={...r?.(e)??{},...e.values},T="phone"===S,w=T&&void 0!==e.values.sizePhone?{...x,size:e.values.sizePhone}:x,E=s.find(e=>e.value===x.font),O={fontFamily:E?.family,fontSize:`${f(w.size??16)}px`,fontWeight:x.weight,fontStyle:x.italic?"italic":void 0};/* @__PURE__ */
14
14
  return I(_,{children:[
15
15
  /* @__PURE__ */I("div",{className:"es-ts-item","data-ts-id":e.id,children:[
16
- /* @__PURE__ */I("button",{type:"button",className:"es-ts-row","aria-expanded":o,"aria-controls":o?k:void 0,onClick:()=>f(!o),children:[
16
+ /* @__PURE__ */I("button",{type:"button",className:"es-ts-row","aria-expanded":d,"aria-controls":d?k:void 0,onClick:()=>c(!d),children:[
17
17
  /* @__PURE__ */X("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */X(A,{size:12})}),
18
18
  /* @__PURE__ */X("span",{className:"es-ts-name",style:O,children:e.name}),
19
- /* @__PURE__ */X("span",{className:"es-ts-meta",children:m(w,s,g,{autoSize:N.has("size")&&w===x&&void 0===e.values.size})})]}),v?/* @__PURE__ */X("div",{className:"es-ts-actions",children:v}):null]}),o?/* @__PURE__ */X("div",{className:"es-ts-open",id:k,children:/* @__PURE__ */X(Z,{style:e,values:x,fonts:s,colours:t,settings:C,autoSet:N,sample:r??g.sample,words:g,phone:T,readOnly:S,set:s=>p(h([e],e.id,s)[0])})}):null]})}var U={none:Y,upper:W,capitalize:D,lower:$};function Z({style:e,values:s,fonts:a,colours:l,settings:i,autoSet:r,sample:o,words:d,phone:c,readOnly:u,set:m}){const h=e.values,p=a.find(e=>e.value===s.font),v=function(e,s){return e?s.find(s=>s.key===e)?.value??t(e)??void 0:void 0}(s.color,l),y=e=>"largestSize"===e||r.has(e),g=e=>y(e)?h[e]:s[e],b=g("size"),N=c&&void 0!==h.sizePhone?h.sizePhone:b,C=g("lineSpacing"),x=g("letterSpacing"),w=y("letterCase")?h.letterCase:s.letterCase,E={fontFamily:p?.family,fontSize:void 0===N?void 0:`${N}px`,fontWeight:s.weight,fontStyle:s.italic?"italic":void 0,lineHeight:void 0===C?void 0:String(C/100),letterSpacing:void 0===x?void 0:`${x}px`,color:v,textTransform:f(w)},z=e=>{const t=S[e],a=y(e);/* @__PURE__ */
20
- return X("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */X(n,{label:d.settings[e],value:h[e],onChange:s=>m({[e]:s}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:a?void 0:s[e],auto:a?d.auto:void 0,readOnly:u})},e)};/* @__PURE__ */
19
+ /* @__PURE__ */X("span",{className:"es-ts-meta",children:p(w,s,b,{autoSize:N.has("size")&&w===x&&void 0===e.values.size})})]}),y?/* @__PURE__ */X("div",{className:"es-ts-actions",children:y}):null]}),d?/* @__PURE__ */X("div",{className:"es-ts-open",id:k,children:/* @__PURE__ */X(Z,{style:e,values:x,fonts:s,colours:t,settings:C,autoSet:N,sample:o??b.sample,words:b,phone:T,readOnly:g,set:s=>u(v([e],e.id,s)[0])})}):null]})}var U={none:Y,upper:W,capitalize:D,lower:$};function Z({style:e,values:s,fonts:a,colours:l,settings:i,autoSet:o,sample:d,words:c,phone:u,readOnly:m,set:h}){const f=e.values,p=a.find(e=>e.value===s.font),v=function(e,s){return e?s.find(s=>s.key===e)?.value??t(e)??void 0:void 0}(s.color,l),S=e=>"largestSize"===e||o.has(e),g=e=>S(e)?f[e]:s[e],b=g("size"),N=u&&void 0!==f.sizePhone?f.sizePhone:b,C=g("lineSpacing"),x=g("letterSpacing"),w=S("letterCase")?f.letterCase:s.letterCase,E={fontFamily:p?.family,fontSize:void 0===N?void 0:`${N}px`,fontWeight:s.weight,fontStyle:s.italic?"italic":void 0,lineHeight:void 0===C?void 0:String(C/100),letterSpacing:void 0===x?void 0:`${x}px`,color:v,textTransform:y(w)},z=e=>{const t=k[e],a=S(e);/* @__PURE__ */
20
+ return X("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */X(n,{label:c.settings[e],value:f[e],onChange:s=>h({[e]:s}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:a?void 0:s[e],auto:a?c.auto:void 0,readOnly:m})},e)};/* @__PURE__ */
21
21
  return I(H,{children:[
22
- /* @__PURE__ */X("div",{className:"es-ts-preview",style:E,"aria-label":d.preview,children:o}),i.map(t=>{switch(t){case"font":/* @__PURE__ */
23
- return X(q,{value:h.font,fonts:a,words:d,readOnly:u,set:m},t);case"color":/* @__PURE__ */
24
- return X(K,{value:h.color,hex:v,colours:l,words:d,readOnly:u,set:m},t);case"emphasis":{const e=(s.weight??400)>=600,a=!1!==p?.italic;/* @__PURE__ */
22
+ /* @__PURE__ */X("div",{className:"es-ts-preview",style:E,"aria-label":c.preview,children:d}),i.map(t=>{switch(t){case"font":/* @__PURE__ */
23
+ return X(q,{value:f.font,fonts:a,words:c,readOnly:m,set:h},t);case"color":/* @__PURE__ */
24
+ return X(K,{value:f.color,hex:v,colours:l,words:c,readOnly:m,set:h},t);case"emphasis":{const e=(s.weight??400)>=600,a=!1!==p?.italic;/* @__PURE__ */
25
25
  return I("div",{className:"es-ts-set","data-ts-setting":t,children:[
26
- /* @__PURE__ */X("span",{className:"es-ts-sub",children:d.settings.emphasis}),
27
- /* @__PURE__ */I("div",{className:"es-ts-icons",children:[k(d.bold,/* @__PURE__ */X(T,{className:"es-ts-icon","aria-label":d.bold,"aria-pressed":e,disabled:u,onClick:()=>m({weight:e?400:700}),children:/* @__PURE__ */X(j,{size:16})})),u||a?k(d.italic,/* @__PURE__ */X(T,{className:"es-ts-icon","aria-label":d.italic,"aria-pressed":Boolean(s.italic),disabled:u,onClick:()=>m({italic:!s.italic||void 0}),children:/* @__PURE__ */X(M,{size:16})})):/* @__PURE__ */X(T,{className:"es-ts-icon","aria-label":d.italic,"aria-pressed":Boolean(s.italic),"aria-disabled":!0,disabledReason:d.italicMissing,children:/* @__PURE__ */X(M,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
28
- return X(V,{value:h.letterCase??s.letterCase,auto:y("letterCase"),words:d,readOnly:u,set:m},t);case"largestSize":return"heading"===e.kind?z(t):null;case"size":return c?(()=>{const e=S.size;/* @__PURE__ */
29
- return X("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */X(n,{label:d.settings.size,value:h.sizePhone,onChange:e=>m({sizePhone:e}),min:e.min,max:e.max,step:e.step,shiftStep:e.shiftStep,sliderMin:e.sliderMin,sliderMax:e.sliderMax,unit:e.unit||void 0,styleValue:b,readOnly:u})},"size")})():z(t);default:return z(t)}})]})}function q({value:e,fonts:s,words:t,readOnly:a,set:n}){const l=z();/* @__PURE__ */
26
+ /* @__PURE__ */X("span",{className:"es-ts-sub",children:c.settings.emphasis}),
27
+ /* @__PURE__ */I("div",{className:"es-ts-icons",children:[r(c.bold,/* @__PURE__ */X(T,{className:"es-ts-icon","aria-label":c.bold,"aria-pressed":e,disabled:m,onClick:()=>h({weight:e?400:700}),children:/* @__PURE__ */X(j,{size:16})})),m||a?r(c.italic,/* @__PURE__ */X(T,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(s.italic),disabled:m,onClick:()=>h({italic:!s.italic||void 0}),children:/* @__PURE__ */X(M,{size:16})})):/* @__PURE__ */X(T,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(s.italic),"aria-disabled":!0,disabledReason:c.italicMissing,children:/* @__PURE__ */X(M,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
28
+ return X(V,{value:f.letterCase??s.letterCase,auto:S("letterCase"),words:c,readOnly:m,set:h},t);case"largestSize":return"heading"===e.kind?z(t):null;case"size":return u?(()=>{const e=k.size;/* @__PURE__ */
29
+ return X("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */X(n,{label:c.settings.size,value:f.sizePhone,onChange:e=>h({sizePhone:e}),min:e.min,max:e.max,step:e.step,shiftStep:e.shiftStep,sliderMin:e.sliderMin,sliderMax:e.sliderMax,unit:e.unit||void 0,styleValue:b,readOnly:m})},"size")})():z(t);default:return z(t)}})]})}function q({value:e,fonts:s,words:t,readOnly:a,set:n}){const i=z();/* @__PURE__ */
30
30
  return I("div",{className:"es-ts-set","data-ts-setting":"font",children:[
31
- /* @__PURE__ */X("span",{className:"es-ts-sub",id:l,children:t.settings.font}),
32
- /* @__PURE__ */X(g,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>n({font:e}),ariaLabelledBy:l,readOnly:a})]})}function K({value:e,hex:s,colours:t,words:a,readOnly:n,set:l}){/* @__PURE__ */
33
- return X(F,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:n,onChange:e=>l({color:e})})}function V({value:e,auto:s,words:t,readOnly:a,set:n}){const l=s?["auto",...p]:p,i=e??(s?"auto":"none"),r=E([]),o=e=>n({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
31
+ /* @__PURE__ */X("span",{className:"es-ts-sub",id:i,children:t.settings.font}),
32
+ /* @__PURE__ */X(l,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>n({font:e}),ariaLabelledBy:i,readOnly:a})]})}function K({value:e,hex:s,colours:t,words:a,readOnly:n,set:l}){/* @__PURE__ */
33
+ return X(F,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:n,onChange:e=>l({color:e})})}function V({value:e,auto:s,words:t,readOnly:a,set:n}){const l=s?["auto",...S]:S,i=e??(s?"auto":"none"),o=E([]),d=e=>n({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
34
34
  return I("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
35
35
  /* @__PURE__ */X("span",{className:"es-ts-sub",children:t.settings.letterCase}),
36
- /* @__PURE__ */X("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const s="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!s||a)return;e.preventDefault();const t=(l.indexOf(i)+s+l.length)%l.length;o(l[t]),r.current[t]?.focus()},children:l.map((e,s)=>{const n=e===i;if("auto"===e)return k(t.case.autoTitle,/* @__PURE__ */X(T,{ref:e=>{r.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon es-ts-icon--word","aria-checked":n,"aria-label":t.case.auto,tabIndex:n?0:-1,disabled:a,onClick:()=>o(e),children:t.case.auto},e));const l=U[e];return k(t.case[e],/* @__PURE__ */X(T,{ref:e=>{r.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon","aria-checked":n,"aria-label":t.case[e],tabIndex:n?0:-1,disabled:a,onClick:()=>o(e),children:/* @__PURE__ */X(l,{size:16})},e))})})]})}export{F as ColourSwatchRow,G as TextStyleItem,R as TextStylesGroup,P as TextStylesList};
36
+ /* @__PURE__ */X("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const s="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!s||a)return;e.preventDefault();const t=(l.indexOf(i)+s+l.length)%l.length;d(l[t]),o.current[t]?.focus()},children:l.map((e,s)=>{const n=e===i;if("auto"===e)return r(t.case.autoTitle,/* @__PURE__ */X(T,{ref:e=>{o.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon es-ts-icon--word","aria-checked":n,"aria-label":t.case.auto,tabIndex:n?0:-1,disabled:a,onClick:()=>d(e),children:t.case.auto},e));const l=U[e];return r(t.case[e],/* @__PURE__ */X(T,{ref:e=>{o.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon","aria-checked":n,"aria-label":t.case[e],tabIndex:n?0:-1,disabled:a,onClick:()=>d(e),children:/* @__PURE__ */X(l,{size:16})},e))})})]})}export{F as ColourSwatchRow,G as TextStyleItem,R as TextStylesGroup,P as TextStylesList};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "20.1.0",
3
+ "version": "20.2.0",
4
4
  "description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",
@@ -1 +0,0 @@
1
- import{useSectionOps as o}from"./chunk-PI6RFJR4.js";import{SELECTION_MODE as e}from"./chunk-LEZFSSQN.js";import{decodePartId as r,encodePartId as t}from"./chunk-IYT6NN2J.js";import{useEasel as n}from"./chunk-ROPYFLNZ.js";import{usePreviewParts as p}from"./chunk-I54UCYOU.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}=n(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=p(),l=d(o=>{const t=r(o);if(!t)return;const{nodeId:n,propKey:p}=t;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),I?.(n)):i(o=>"part"===o.kind?e:o)},[i,I]);c(()=>{k(l)},[k,l]);const h=s(m)?t(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=a(o);r&&u.select(r)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
@@ -1,8 +0,0 @@
1
- import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as o}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as l}from"./chunk-BVN33R76.js";import{sharedSectionsOf as r}from"./chunk-43AEUUNQ.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SINAM2IT.js";import{blockRuns as c}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-LEZFSSQN.js";import{useEaselSession as m}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-23DYNW6S.js";import{useEasel as u}from"./chunk-ROPYFLNZ.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-LDEEFLE3.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-KAML3KQH.js";import{useState as b,useEffect as v,useMemo as j,useRef as w}from"react";import{SharedIcon as C,AddIcon as E}from"efficient-shell/icons/efficient";import{ContextMenu as F,toast as L,Dialog as N,Button as O}from"efficient-shell/ui";import{jsx as S,jsxs as T,Fragment as $}from"react/jsx-runtime";function x({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=w(null);/* @__PURE__ */
2
- return S(N,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */T($,{children:[
3
- /* @__PURE__ */S(O,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
4
- /* @__PURE__ */S(O,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var A=e=>`section:${e}`,D=e=>`block:${e}`,I=e=>`template:${e}`,M=e=>`shared:${e}`;function B({at:w,placeBlocks:N,canTake:O,onPick:B,itemFor:P,session:Q,siteWide:Z,onClose:z,onHide:H,readOnly:R}){const V=u(e=>e.config),W=a(),{labelAtLevel:Y,categoryLabel:K,firstSection:U,Icon:_,Thumbnail:G}=W,{blockIsOffered:J,canAddTo:q}=d(),X=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>J(e,te);return l(te).list().then(n=>{if(e)return;const l=V.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[V,te]);const le=p().shared,re=h("screen",f).shared,[ie,se]=b([]),[ce,ae]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>J(e,te);return r(te).list().then(n=>{if(e)return;const l=V.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[V,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(V,W),[V]),ye=e=>Y(e,"section",V.components[e]?.label??e),he=e=>({type:A(e.type),label:e.name,cover:/* @__PURE__ */S(G,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:X.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ke=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=ne.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ie.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}return null},ge=e=>/* @__PURE__ */S("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */S(_,{type:e,size:26})}),be=j(()=>{const e=t(ue,U),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!J(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=q(t.type)?.choices??[];e.forEach(l),e.forEach(e=>q(e.type,1)?.choices?.forEach(l))}N?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:D(e.type),label:e.label,cover:ge(e.type),title:X.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>o.has(e.type)?{...he(e),cover:ge(e.type)}:he(e),d=[];ie.length>0&&d.push({key:"shared",title:re.group,tiles:ie.map(e=>({type:M(e.id),label:e.title,cover:/* @__PURE__ */S(G,{type:e.node.type}),mark:/* @__PURE__ */S(C,{size:12}),title:re.onPages({count:e.used_on.length}),keywords:[ye(e.node.type),e.node.type]}))}),ne.length>0&&d.push({key:"templates",title:X.templates,tiles:ne.map(e=>({type:I(e.id),label:e.name,cover:/* @__PURE__ */S(G,{type:e.node.type}),keywords:[ye(e.node.type),e.node.type]}))});const p=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(V.categories??{})){const o=ue.filter(e=>e.cat===t);if(0===o.length)continue;const l=e&&o.some(t=>t.type===e.type)?e:null,r=(l?[l,...o.filter(e=>e.type!==l.type)]:o).map(a);l&&!m&&(r.splice(1,0,...p.map(s)),m=!0),d.push({key:`category:${t}`,title:n(V,t,K),tiles:r})}const f=d.find(e=>e.key?.startsWith("category:"));if(!m&&f&&p.length>0&&(f.tiles=[...f.tiles,...p.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!O)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?O(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[ne,ie,re,ue,V,X,O,N,te]);/* @__PURE__ */
5
- return T($,{children:[
6
- /* @__PURE__ */S(i,{icon:/* @__PURE__ */S(E,{size:15}),title:X.title,context:X.contextAll,actions:/* @__PURE__ */S(s,{label:X.done,description:X.doneDescription,onClick:z}),onHide:H}),
7
- /* @__PURE__ */T("div",{className:"sf-addside sf-scroll",children:[
8
- /* @__PURE__ */S(k,{groups:be,session:Q,itemFor:e=>P(ke(e)??{kind:"section",type:e}),onInsert:B?e=>{const t=ke(e);t&&B(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!R&&(pe({section:n.section,...t}),!0)},at:w,hint:X.hint,searchLabel:X.search,readOnly:R,words:ee}),Z??null]}),de?/* @__PURE__ */S(F,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>pe(null),"aria-label":de.section.title,items:y([{label:re.deleteShared,danger:!0,onClick:()=>{fe(de.section),pe(null)}}])}):null,me?/* @__PURE__ */S(x,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void L.error(re.deleteFailed)}fe(null),le?.removed?.(e),se(t=>t.filter(t=>t.id!==e.id)),ae(e=>e+1)})(me),onCancel:()=>fe(null)}):null]})}export{B as AddSidePanel,D as blockKey,A as sectionKey,M as sharedKey,I as templateKey};
@@ -1,5 +0,0 @@
1
- import{usePickFollowsSelection as n}from"./chunk-FHCKFOCD.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-ROPYFLNZ.js";import{Inspector as i}from"./chunk-7LYKFL3Q.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},O={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function C(){/* @__PURE__ */
2
- return s(t,{height:"fill"})}function F(){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 S({parts:n,children:e}){/* @__PURE__ */
4
- return s(P.Provider,{value:n,children:e})}function D(){return u(P)}function N(){return(D().useOwnerName??v)()}function G(){return(D().useDocumentLabel??g)()}function x(n,e,t,r){return(D().useBridges??h)(n,e,t,r)}function B(n){return(D().useStandaloneBridges??h)(n)}function I(n,e){(D().useDocumentPass??y)(n,e)}function K(){return D().blockRules??b}function R(){return D().blockLook??L}function T(){return D().devices??O}function Y(){return D().leftView??j}function A(){return D().pinned??w}function H(){return D().saveSwitch??!0}function V(e){n(!0===D().pickFollowsSelection,e)}function Z(){return D().storageNamespace||void 0}function E(){return D().styleClipboard??null}function Q(){return D().nodeKeys??!0}function q(){return D().notify??null}function z(){return D().Canvas??C}function J(){return D().CanvasHead??null}function M(){return D().canvasDrag??null}var U=o(null);function W({target:n,children:e}){/* @__PURE__ */
5
- return s(U.Provider,{value:n,children:e})}function X(){return u(U)}function $(){return D().Inspector??F}export{c as SELECTION_MODE,W as ScreenCanvasTargetProvider,S as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,R as useScreenBlockLook,K as useScreenBlockRules,x as useScreenBridges,M as useScreenCanvasDrag,z as useScreenCanvasFrame,J as useScreenCanvasHead,X as useScreenCanvasTarget,T as useScreenDevices,G as useScreenDocumentLabel,I as useScreenDocumentPass,$ as useScreenInspectorPanel,Y as useScreenLeftView,Q as useScreenNodeKeys,q as useScreenNotify,N as useScreenOwnerName,D as useScreenParts,V as useScreenPickFollowsSelection,A as useScreenPinned,H as useScreenSaveSwitch,Z as useScreenStorageNamespace,E as useScreenStyleClipboard,B as useStandaloneScreenBridges};
@@ -1 +0,0 @@
1
- import{useScreenBlockRules as e}from"./chunk-LEZFSSQN.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-PLVEGYK6.js";import{useEasel as o,useEaselApi as r}from"./chunk-ROPYFLNZ.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,63 +0,0 @@
1
- import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-JBOSEHIX.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-2E2SXDYQ.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-HBBXDGDD.js";import{SlotChildActionsProvider as h}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-C56MPJBH.js";import{usePartBridge as y}from"./chunk-47CD7ULN.js";import{useSectionOps as v}from"./chunk-PI6RFJR4.js";import{ScreenSaveIcon as k,ScreenMainButton as b}from"./chunk-PY7OOQEZ.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-47PYYMFM.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{SidePanelHead as N,PanelShowStrip as I}from"./chunk-SINAM2IT.js";import{offeredChoices as O}from"./chunk-M2Z775ZC.js";import{useScreenSaveSwitch as B,useScreenNodeKeys as P,useScreenPinned as $,useScreenDocumentLabel as M,useScreenCanvasFrame as j,useScreenInspectorPanel as L,useScreenDevices as A,useScreenPickFollowsSelection as T,useScreenLeftView as E,SELECTION_MODE as R,sameInspectorMode as F,useScreenBridges as D,useScreenBlockRules as H,useScreenBlockLook as V,useScreenStorageNamespace as W,useScreenNotify as U,useScreenCanvasHead as J,isSlotMode as Y,useScreenStyleClipboard as G,useScreenDocumentPass as K,useScreenCanvasDrag as Z,ScreenCanvasTargetProvider as Q,isPinnedFirst as X,isPinnedLast as _,screenSlotsOf as q}from"./chunk-LEZFSSQN.js";import{MediaPopup as ee}from"./chunk-2G6MAXPY.js";import{useNodeClipboard as ne,useNodeContextMenu as te}from"./chunk-PEDR7G3K.js";import{PageEditGuardNotices as oe}from"./chunk-UJ46J7QW.js";import{useScreenDocument as re}from"./chunk-276MBG5P.js";import{requestMediaPick as ie}from"./chunk-UNVKPVZW.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-FHCKFOCD.js";import{useEaselSession as pe}from"./chunk-O7Q4DDJT.js";import{useEaselHost as ue,useHostEscape as he}from"./chunk-MQA7OFRA.js";import{LayersIcon as fe,MediaIcon as me}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ge}from"./chunk-23DYNW6S.js";import{heldStyle as ye,styleShortcut as ve}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ke}from"./chunk-6WY6ZXJG.js";import{rootRowName as be,slotChildRowName as Se,slotChildRenameProp as we,sectionRenameProp as xe}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as ze,blockNodeActions as Ce,TREE_MAX_DEPTH as Ne,childSlotsOf as Ie,slotFieldsOf as Oe,newNodeId as Be,slotChildrenIn as Pe,nestsInTree as $e}from"./chunk-PLVEGYK6.js";import{useEasel as Me,useEaselApi as je,CanvasPassThroughContext as Le,CanvasSharedContext as Ae}from"./chunk-ROPYFLNZ.js";import{TreeRow as Te,Subtree as Ee,LayersTree as Re,TreeGroupLabel as Fe,TreeRowAction as De,TreeSeam as He}from"./chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as Ve}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as We}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ue,useNodeOps as Je,clickPick as Ye}from"./chunk-BSHIQIZC.js";import{EaselTopBar as Ge,TopBarCluster as Ke,EaselIconButton as Ze,TopBarDivider as Qe,DeviceSwitch as Xe,InspectorIconButton as _e,PanelResizeHandle as qe,MAX_PANEL_W as en,MIN_PANEL_W_BY_SIDE as nn,panelWidthVars as tn}from"./chunk-ZG6PVMC3.js";import{DEFAULT_NOTICE_WORDS as on,DEFAULT_CHROME_WORDS as rn}from"./chunk-AJSDWWJW.js";import{holderOf as ln,nameOrSomeone as sn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as dn}from"./chunk-RE4LP46F.js";import{useWords as an}from"./chunk-MFIRYGHW.js";import{insertSeams as cn,CanvasDragLayer as pn,CanvasInsert as un}from"./chunk-LDEEFLE3.js";import{DEFAULT_DRAG_WORDS as hn}from"./chunk-KAML3KQH.js";import{createDragSession as fn,useTreeDrag as mn,gapToMoveIndex as gn}from"./chunk-3S5N4HLJ.js";import{useCanvasFrame as yn,LIST_SELECTOR as vn,BLOCK_SELECTOR as kn,useCanvasTyping as bn,useCanvasEvent as Sn,nodeIdAt as wn,frameRectToHost as xn,BLOCK_ATTRIBUTE as zn,drawnBox as Cn}from"./chunk-QIDRJH3S.js";import{queryMainCopy as Nn}from"./chunk-LF3FUSCQ.js";import{ROOT_ID as In,ROOT_SLOT as On,zoneKey as Bn,parseZoneKey as Pn,find as $n,DataError as Mn}from"./chunk-K7BTCBWD.js";import{useRef as jn,useMemo as Ln,useState as An,useEffect as Tn,useCallback as En,useLayoutEffect as Rn,Fragment as Fn,useId as Dn}from"react";import{ColoredBadge as Hn,Tabs as Vn,toast as Wn,readMediaFileDrag as Un,Tooltip as Jn,groupColors as Yn,Dialog as Gn,FormField as Kn,Input as Zn,Button as Qn,MEDIA_FILE_DRAG_TYPE as Xn}from"efficient-shell/ui";import{UndoIcon as _n,RedoIcon as qn,RefreshIcon as et,AddIcon as nt,TrashIcon as tt,EyeOffIcon as ot,EyeIcon as rt,SharedIcon as it,DuplicateIcon as lt}from"efficient-shell/icons/efficient";import{jsx as st,jsxs as dt,Fragment as at}from"react/jsx-runtime";var ct="media-file";function pt({name:e,onMake:n,onCancel:t}){const o=an("screen",ge).shared,[r,i]=An(e),[l,s]=An(!1),d=Dn(),a=jn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
2
- return st(Gn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */dt(at,{children:[
3
- /* @__PURE__ */st(Qn,{variant:"secondary",onClick:t,children:o.cancel}),
4
- /* @__PURE__ */st(Qn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */st("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */st(Kn,{label:o.name,htmlFor:d,children:/* @__PURE__ */st(Zn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var ut=/* @__PURE__ */new WeakSet;function ht(e,n,t){const o=$n(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function ft({canvas:e,tabs:n,onSelect:t}){const o=jn(null),[r,i]=An({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Rn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=xn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Nn(t,`[${zn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?Cn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=xn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */st("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */st("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
5
- /* @__PURE__ */st(Jn,{content:e.reach,children:/* @__PURE__ */dt(Hn,{colorClass:Yn("success","solid"),size:"sm",children:[
6
- /* @__PURE__ */st("span",{className:"es-band-tab-mark",children:/* @__PURE__ */st(it,{size:12})}),e.label]})}):/* @__PURE__ */st(Hn,{colorClass:Yn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function mt({expand:e}){/* @__PURE__ */
7
- return st("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */dt(at,e?{children:[
8
- /* @__PURE__ */st("path",{d:"M8 9l4-4 4 4"}),
9
- /* @__PURE__ */st("path",{d:"M8 15l4 4 4-4"})]}:{children:[
10
- /* @__PURE__ */st("path",{d:"M8 4l4 4 4-4"}),
11
- /* @__PURE__ */st("path",{d:"M8 20l4-4 4 4"}),
12
- /* @__PURE__ */st("path",{d:"M5 12h14"})]})})}var gt=`${vn}, ${kn}`;function yt(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var vt="__rungs";var kt="screen:band",bt={duplicate:!0,delete:!0},St=()=>null;function wt(){const vn=ue(),xn=vn.panels?.Toolbar,zn=(vn.panels?.useRight??St)(),{target:Cn,docId:Dn,capabilities:Jn,currentSlug:Yn,siteId:Gn,onPublish:Kn,saveState:Zn,saveConflict:Qn,retrySave:it,toggleAutoSave:wt,flushSave:xt,access:zt,saveUnreachable:Ct=!1,readOnly:Nt,readOnlyReason:It=null}=re(),Ot=B(),Bt=P(),{mediaEditing:Pt,hasEditGuard:$t,hasPinnedChrome:Mt}=Jn,{appState:jt,dispatch:Lt,history:At,selectedItem:Tt,getSelectorForId:Et,config:Rt}=Me(e=>e),Ft=$(),{first:Dt,firstGroup:Ht,lastGroup:Vt,isSectionGroup:Wt,sectionGroupZone:Ut,panelOf:Jt}=Ft,Yt=Jt(Dt),Gt=e=>X(Ft,e),Kt=e=>_(Ft,e),Zt="node"===Ft.firstRow,Qt=Ft.band??null,Xt=an("screen",ge),_t=an("tree",Ve),qt=an("drag",hn),eo=an("notice",on),no=an("lock",dn),to=an("menu",We),oo=an("styleClipboard",ke),ro=an("chrome",rn),io=M()??`/${Yn}`,lo=j(),so=L(),ao=v({readOnly:Nt}),co=v({readOnly:Nt,foldIntoHistory:!0}),po=jn(null),uo=je(),ho=Ln(()=>({...ao,select:e=>{po.current=e,ao.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=uo.config;po.current=Ue(e,t,n)}ao.commitDocument(e,n)}}),[ao,uo]),fo=jt.ui,mo=fo.leftSideBarVisible,go=fo.rightSideBarVisible,{options:yo,widths:vo,initial:ko,fluid:bo,fit:So}=A(),[wo,xo]=An(ko),zo=le(),Co=Pt&&null!==zo,No=se(),Io=de(),Oo=null!==No||Io,Bo=ae();T(Tt?.props.id);const{read:Po,write:$o,forSelection:Mo}=E(),[jo,Lo]=An(Po);Tn(()=>{$o(jo)},[jo]);const[Ao,To]=An(0),Eo=jn(null),Ro=jn(null),Fo=yn(Ro,{readySelector:gt}),Do=bn(Fo),Ho=a(Ro);c(Ro,Fo);const Vo=S(),Wo=ln(zt),Uo={state:Zn,offline:Vo||Zn.failed&&Ct,readOnlyReason:It,editing:Wo?eo.editing({name:sn(Wo.name,no),noun:Xt.noun}):null,conflict:null!=Qn,notSaving:Xt.bar.notSaving},Jo=()=>{Nt||(Zn.failed?it():xt())};p(Ro,Fo,Jo);const[Yo,Go]=An(!1),Ko=jn(!1),[Zo,Qo]=An(null),[Xo,_o]=An([]),[qo,er]=An(R),nr="puck"===qo.kind,tr=o(qo,Tt?.props.id),[or,rr]=An(null);Tn(()=>{or&&(r(),rr(null))},[or]);const ir=jn(Et);ir.current=Et;const lr=En((e,{scroll:n})=>{Lo(n=>Mo(e,n)),n&&rr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=ir.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Ar(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),sr=jn(null);Tn(()=>{const e=sr.current;sr.current=null;const n=null==Tt?.props.id?null:String(Tt.props.id);er(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Jt(Tt?.type)??R);const t=Tt?.props.id,o=po.current;if(po.current=null,!t)return;const r=Et(t);lr(String(t),{scroll:!i(o,r??null,ze)})},[Tt?.props.id,lr]);const dr=En(e=>{er(n=>F(n,e)?n:e),Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Lt]),ar=jn(()=>{});ar.current=(e,n)=>{const t=e?Mi(e.zone??ze)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Tt?.props.id?null:String(Tt.props.id);er(e=>F(e,n)?e:n),o!==r&&(sr.current={id:o,mode:n},ho.select(e))};const cr=En((e,n)=>ar.current(e,n),[]),pr={kind:qo.kind,mode:qo,open:dr,show:e=>er(e),reveal:()=>{go||Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:cr},ur=D(pr,{data:jt.data,selected:Tt??null,zoneOf:e=>Et(e)?.zone,readOnly:Boolean(Nt),select:e=>{er(R),ho.select({index:e})},replace:(e,n)=>ho.replaceComponent(ze,e,n),scrollTo:e=>l(e)},{device:wo,refreshes:Ao},{setView:Lo,reveal:()=>{mo||Lt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),hr=ur.resolveLeftView?ur.resolveLeftView(jo):"sections",fr=H(),{isLockedBlock:mr,duplicateBlocked:gr,nestDepth:yr,newSectionNode:vr,canAddTo:kr,blockIsOffered:br}=fr,Sr=V(),{labelAtLevel:wr,Icon:xr,useProducts:zr}=Sr,Cr=Sr.rowName?(e,n,t)=>Sr.rowName(e,n,t):void 0,Nr=En(e=>{Lt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),lr(e,{scroll:!0})},[Lt,lr]),{selectNode:Ir,openPartId:Or}=y({mode:qo,setMode:er,onOpenPart:Nr}),[Br,Pr]=An(null);he(null!==Br,()=>Pr(null));const $r=f(W()),Mr=$r.collapsed,jr=$r.panelWidths,[Lr,Ar]=An(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Mr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
- return new Set}});Tn(()=>{try{window.localStorage.setItem(Mr,JSON.stringify([...Lr]))}catch{}},[Lr]);const[Tr,Er]=An(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(jr);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left,"left"),right:g(Number(n.right)||m.right,"right")}}catch{return{...m}}});Tn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(jr,JSON.stringify(Tr))}catch{}},300);return()=>clearTimeout(e)},[Tr]);const Rr=En((e,n)=>Er(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Fr=En(e=>Rr("left",e),[Rr]),Dr=En(e=>Rr("right",e),[Rr]),Hr=e=>Lr.has(e),Vr=e=>Ar(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Wr=jn(!1),Ur=jn(null);Tn(()=>{if(Wr.current&&!Yo){const e=Ur.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Ro.current?.querySelector(`button[aria-label="${CSS.escape(Xt.add.title)}"]`))?.focus(),Ur.current=null}Wr.current=Yo},[Yo]),Tn(()=>{if(!Yo||!Ho)return;const e=e=>{"Escape"===e.key&&cl()};return Ho.addEventListener("keydown",e),()=>Ho.removeEventListener("keydown",e)},[Yo,Ho]),he(Yo,()=>cl()),Tn(()=>{!mo&&Yo&&(Go(!1),Qo(null),Ko.current=!1)},[mo]);const Jr=U(),Yr=(e,n="success",t)=>{if(Jr)return void(t?Jr(e,"error"===n?"error":"info",t):Jr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Wn.error(e,{...o,duration:t?.duration??3200}):Wn.success(e,{...o,duration:t?.duration??1900})},Gr=jn(null),[Kr,Zr]=An(0),[Qr,Xr]=An(0),_r=J(),qr=jn(null),ei=e=>Math.max(0,e.clientHeight-(qr.current?.offsetHeight??0));Tn(()=>{const e=Gr.current;if(!e)return;const n=()=>{Zr(e.clientWidth),Xr(ei(e))};n();const t=new ResizeObserver(n);return t.observe(e),qr.current&&t.observe(qr.current),()=>t.disconnect()},[]),Rn(()=>{Gr.current&&(Zr(Gr.current.clientWidth),Xr(ei(Gr.current)))},[Tr,mo,go]);const ni=wo===bo?Kr>0?Kr:vo[bo]:vo[wo],ti=Kr>0?Math.min(Kr/ni,"shrink"===So?1:2):1,oi=ni*ti,ri=Kr>0&&oi>Kr+1,ii={width:oi,height:Qr||"100%",flex:"none",position:"relative"},li={width:ni,height:Qr?Qr/ti:"100%",maxHeight:"none",transform:1!==ti?`scale(${ti})`:void 0,transformOrigin:"top left"},si=()=>Lt({type:"setUi",ui:{leftSideBarVisible:!mo}}),di=()=>Lt({type:"setUi",ui:{rightSideBarVisible:!go}}),ai=e=>{Yo&&(Go(!1),Qo(null),Ko.current=!1,mo&&jo===e)||(Lo(e),mo||Lt({type:"setUi",ui:{leftSideBarVisible:!0}}))},ci=()=>{ie(vn,{accept:"image/*",title:ro.mediaLibrary})},pi=()=>{er(R),ho.select(null),d()},ui=()=>{er(Yt??R),go||Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},hi=jt.data.content??[],fi=()=>{const e=hi.findIndex(Gt),n=hi.findIndex(Kt);return{floor:e>=0?e+1:0,cap:n>=0?n:hi.length}},mi=Rt,gi=fr.stripCopy,yi=n=>e(n,gi),vi=ne(),ki=Je({data:jt.data,config:mi,readOnly:Boolean(Nt),clipboard:vi,strip:gi?e=>gi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==In||e.slot!==On)return{min:0,max:n-1};const{floor:t,cap:o}=fi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&er(R);const t=void 0===n||"node"===n?.kind?n:null;ho.commitDocument(e,t)}}),bi=pe(),[Si,wi]=An(null),xi=e=>{const n=hi.find(n=>String(n.props.id)===e),t=Ft.shared;n&&t&&ki.swap(e,t.detach(n))},zi=e=>{const n=$n(jt.data,Rt,e);if(!n)return!1;const t=Bn(n.place),o=n.node,r=t===ze?Bi(o):Wi(o),i=t===ze?Ft.shared?.usedOn(o):null;return!!ki.remove(e)&&(Yr(i?Xt.shared.removed({count:Math.max(0,i.length-1)}):Xt.deleted({name:r}),"success",{duration:8e3,action:{label:Xt.bar.undo,onClick:()=>{ki.restore(n.node,n.place)}}}),!0)},Ci={...ki,remove:zi},Ni=e=>wr(e,"block",Rt.components[e]?.label??e),Ii=En(e=>Rt.components[e]?.defaultProps??{},[Rt]),Oi=e=>wr(e,"section",Ni(e)),Bi=e=>be({type:e.type,props:e.props??{}},Oi(e.type),Cr),{nodeAddresses:Pi,zoneItems:$i}=Ln(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=Ne)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Ie(Rt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(hi,ze,0),{nodeAddresses:e,zoneItems:n}},[hi,Rt]),Mi=En(e=>$i.get(e)??[],[$i]),ji=e=>{const n=Pi.get(e);return n?Mi(n.zone)[n.index]:void 0},Li=e=>q(fr,Rt,e),Ai=e=>{if(!fr.slotsOf||e===ze)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=ji(e.slice(0,n));if(!t)return null;const o=Li(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}},Ti=(()=>{if(!Y(qo))return null;const e=`${qo.nodeId}:${qo.slot}`;return Ai(e)?.slot.panel===qo.kind?e:null})(),Ei=jn(null);Tn(()=>{const e=Ei.current;if(Ei.current=null,!Ti||!Y(qo))return;const n=qo.nodeId;lr(n,{scroll:e!==Ti}),Ar(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[qo]);const Ri=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Pi.get(e);n&&(n.zone===ze?ol(n.index):Pl(n.zone,n.index,e,ji(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Ti!==i&&(Ei.current=i),cr(null,r),go||Lt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Fi=(e,n,t)=>{const o=`${e}:${n}`;if(Ar(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;Ti!==o&&(Ei.current=o);cr(null,{kind:t,nodeId:e,slot:n})},Di=(e,n,t)=>{if(Nt||!fr.moveSlot)return;const o=ji(e),r=o?Li(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:vt,index:n},s=gn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=fr.moveSlot(e,n,s);"string"==typeof d&&Fi(e,d,i.panel)},Hi=zr(),Vi=Ln(()=>{const e=/* @__PURE__ */new Map;for(const n of Hi??[])e.set(n.slug,n.name);return e},[Hi]),Wi=e=>Se(e,Ni,Sr.plainText,e=>Vi.get(e),Sr.rowName),Ui=(e,n)=>{const t=Rt.components[e.type]?.fields,o=n===ze||ts(n)?"section":"block",r=n===ze&&(Gt(e)||Kt(e)||Wt(e.type)),i="block"===o?we(t):r?null:xe(t);return Sr.renamePropOf?Sr.renamePropOf(e,o,i):i},Ji=(e,n,t,o)=>{if(!(!Nt&&Br?.zone===e&&Br.index===n))return;const r=(t,o)=>{Pr(null),o&&((e,n,t)=>{const o=Mi(e)[n];if(!o)return;const r=Ui(o,e);r&&ho.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
- return st("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Xt.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)},Yi=t(G(),oo),Gi=Yi.scope({target:Cn,siteId:Gn,docId:Dn}),Ki=Rt,Zi=(e,n)=>n===ze?Oi(e):Ni(e),Qi=(e,n,t)=>{const o=Yi.plan(Gi,t,Zi(t.type,e),Ki);o&&(o.changed&&ho.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Yr(o.message))},Xi=te({nodesIn:Mi,nodeAt:(e,n)=>Mi(e)[n]??null,labelOf:(e,n)=>n===ze?Oi(e):Ni(e),renamePropOf:Ui,beginRename:(e,n)=>Pr({zone:e,index:n}),history:{hasPast:At.hasPast,hasFuture:At.hasFuture,back:()=>At.back(),forward:()=>At.forward()},openPageSettings:()=>{ho.select(null),er(R)},pageSettingsLabel:Xt.pageSettings,words:{menu:to,styleClipboard:oo,screen:Xt.menu},readOnly:Boolean(Nt),collapseAll:()=>Ar(new Set(Mi(ze).map(e=>String(e.props.id)))),onPasteRefused:e=>Yr(e?Xt.pasteRefused({name:e.label}):Xt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>is(e,n),menuRows:(e,n,t)=>{const o=ur.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Ft.shared;if(!t||n!==ze)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:Xt.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return Nt||mr(e.type,e)?n:{...n,change:[{label:Xt.shared.detach,onClick:()=>xi(e.props.id)}],remove:[{label:Xt.shared.removeFromPage,danger:!0,onClick:()=>{zi(e.props.id)}}]}}return Nt||Gt(e)||Kt(e)||Wt(e.type)?null:z(bi)?{change:[{label:Xt.shared.makeShared,onClick:()=>wi({id:e.props.id,name:Bi(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>mr(e.type,e),duplicateBlocked:e=>gr(jt.data,e),permits:e=>{const n=Ce(Rt,e.type);return Ft.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:Ci,isPinned:(e,n)=>n===ze&&(Gt(e)||Kt(e)),sectionBand:fi,locate:e=>Pi.get(e)??null,rowNameOf:(e,n)=>n===ze?Bi(e):Wi(e),selectAt:(e,n,t,o)=>{e===ze?ol(n):Pl(e,n,t,o??"")},slotRung:e=>{const n=Ai(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ri(n.node,n.slot,!1)}:null},style:{held:()=>ye(Gi),canCopy:e=>Yi.rows(Ki,e).some(e=>!1!==e.counted),copy:(e,n)=>Yi.copy(Gi,e,Zi(e.type,n),Ki),paste:(e,n,t)=>Qi(e,n,t)},keys:Bt?{target:Ho,selected:()=>{const e=jt.ui.itemSelector;return e?{zone:e.zone??ze,index:e.index}:null},held:()=>vi.get(),readOnly:Boolean(Nt),onDone:({done:e,name:n})=>{"copied"===e&&Yr(Xt.copied({name:n}))}}:void 0},Fo),_i=jn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Tn(()=>{_i.current={copy:(e,n)=>Yi.copy(Gi,e,Zi(e.type,n),Ki),paste:Qi,at:()=>{const e=jt.ui.itemSelector;if(!e)return null;const n=e.zone??ze,t=Mi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Nt)}});const qi=En(e=>{const n=ve(e);if(!n)return;const t=_i.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))},[]);Tn(()=>{if(!Ho)return;const e=e=>qi(e);return Ho.addEventListener("keydown",e),()=>Ho.removeEventListener("keydown",e)},[qi,Ho]),Sn(Fo,"keydown",qi);const el=hi.map(e=>e.props.id).join("|");Tn(()=>{const e=Fo?.document??null,n=Fo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void _o(e=>e.length?[]:e);const n=hi.findIndex(Kt),t=n>=0?n:hi.length,o=n=>{const t=hi[n]?.props?.id;return null==t?null:Nn(e,`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(kn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=hi.length>0&&!Gt(hi[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=yt(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}_o(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()}},[Fo,el,wo,ti,mo,go,Tt?.props.id]);const nl=Fo?.document??null,tl=Fo?.window??null;Tn(()=>{const e=Eo.current;if(!e||!nl||!tl)return;const n=[],t=()=>{const n=Nn(nl,`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&tl.scrollTo({left:tl.scrollX,top:tl.scrollY+t,behavior:"instant"}),!0};return Eo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[nl,tl]);const ol=e=>{er(R),ho.select({index:e}),ur.sectionPressed?.(hi[e]);const n=hi[e]?.props?.id;n&&l(n)},rl=e=>{const{floor:n,cap:t}=fi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Tt&&qo.kind!==Yt?.kind?hi.findIndex(e=>e.props.id===Tt.props.id):-1;return o(r>=0?r+1:t)},il=(e,n)=>{const{floor:t,cap:o}=fi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(ho.reorderComponent(ze,e,i),ho.select({index:i}),{moved:!0,dest:i})},ll=(e,n,t,o)=>{er(R),ho.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Yr(Xt.sectionAdded({name:t}))},sl=(e,n)=>{const t=rl(n),o=vr(e,{nodeDefaults:Ii,newNodeId:Be,sectionLabel:Oi,blockIsOffered:br}),r=o?ho.insertNode(ze,t,o):ho.insertSection(e,t);return ll(t,r,Oi(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of Ie(Rt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=kr(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},dl=e=>al(ze,e),al=(e,n)=>{Ur.current=document.activeElement??null,Qo(null===n?null:{zone:e,index:n}),Go(!0),mo||(Ko.current=!0,Lt({type:"setUi",ui:{leftSideBarVisible:!0}}))},cl=()=>{Go(!1),Qo(null),Ko.current&&Lt({type:"setUi",ui:{leftSideBarVisible:!1}}),Ko.current=!1},pl=(e,n)=>Sr.rowName?n?Gt(e)?Sr.rowName(e,"section",Xt.header):Kt(e)?Sr.rowName(e,"section",Xt.footer):Wt(e.type)?Sr.rowName(e,"section",Ni(e.type)):Bi(e):Wi(e):n?Oi(e.type):Ni(e.type),ul=e=>n=>{e()},hl=(e,n,t)=>{if(Nt)return null;const o=Mi(e)[n];return o&&!Ce(Rt,o.type).delete||o&&mr(o.type,o)?null:/* @__PURE__ */st(De,{kind:"delete",label:e===ze&&o&&Ft.shared?.usedOn(o)?Xt.shared.removeFromPage:Xt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Mi(e)[n]?.props?.id;null!=t&&zi(String(t))})(e,n),children:/* @__PURE__ */st(tt,{size:15})})},fl=e=>Sr.rowPreview?.(e)||void 0,ml=e=>Sr.rowMarks?.(e)??void 0,gl=(e,n,t)=>Sr.rowActions?.(e,n,t)??null,yl=(e,n,t,o)=>{if(Nt)return null;if(mr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
- return st(De,{kind:"eye",label:r?Xt.showNamed({name:o}):Xt.hideNamed({name:o}),onClick:()=>kl(e,n,t),children:/* @__PURE__ */st(r?ot:rt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},vl=e=>Js(ze,e),kl=(e,n,t)=>{ho.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},bl=e=>Oe(Rt,e),Sl=e=>Ie(Rt,e),wl=e=>fr.slotsOf?Li(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Pe(e,n.slot)})):[{slot:null,rung:null,kids:Sl(e)}],xl=e=>fr.slotsOf?wl(e).flatMap(e=>e.kids):Sl(e),zl=e=>Boolean(fr.slotsOf)&&Li(e).some(e=>e.rung),Cl=(e,n,t)=>null===t?void 0===n?kr(e):kr(e,n):kr(e,n,t),Nl=(e,n,t)=>{const o=$e(Rt,e.type,n)&&(t||xl(e).length>0||zl(e));return{collapsible:o,folded:o&&Hr(String(e.props.id))}},Il=(e,n,t)=>wl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Nl(e,r,t(e.type)).collapsible?[String(e.props.id),...Il(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Ol=e=>xl(e).length>0||zl(e)||Boolean(kr(e.type)),Bl=e=>Boolean(kr(e)),Pl=(e,n,t,o)=>{if(er(R),kr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),ho.select({index:n,zone:e}),l(t)}else ho.select({index:n,zone:e}),l(t)},$l=(e,n,t,o,r)=>{const i=`${e}:${n}`;ho.insertComponent(i,t,o),kr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),ho.select({index:o,zone:i})}):ho.select({index:o,zone:i})},Ml=jn(/* @__PURE__ */new Set);Tn(()=>{hi.forEach(e=>{const n=kr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Ml.current.has(t))return;Ml.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(Ii)).forEach((e,t)=>co.seedChild(o,t,n.childType,e))})},[hi,co,Ii]);const jl=jn(/* @__PURE__ */new Set);Tn(()=>{hi.forEach((e,t)=>{const o=e.props.id;if(jl.current.has(o))return;const r=n(e,bl(e.type));jl.current.add(o),r&&co.replaceComponent(ze,t,{...e,props:r})})},[hi,co]),K(co,Rt);const Ll=hi.findIndex(Kt),Al=Ll>=0?hi[Ll]:null,Tl=Zt?hi.findIndex(Gt):-1,El=Tl>=0?hi[Tl]:null,Rl=Ft.groupTab,Fl=Ln(()=>Rl?e=>Wt(e.type):void 0,[Rl]),Dl=Boolean(Ft.groupBadge),Hl=Ft.sharedReach,Vl=e=>Hl?.(e)??void 0,Wl=Ln(()=>Hl?new Set(hi.filter(e=>Vl(e)).map(e=>String(e.props.id))):null,[hi,Hl]),Ul=Ln(()=>Wl?e=>Wl.has(e):void 0,[Wl]),Jl=Ft.first?Hl?.({type:Ft.first,props:{id:""}})??void 0:void 0,Yl=Ft.groupBadge?/* @__PURE__ */st("span",{className:"es-tree-group-badge",children:/* @__PURE__ */st(Hn,{tone:"info",size:"xs",children:Ft.groupBadge})}):void 0,Gl=hi.find(e=>e.type===Ht)??null,Kl=hi.find(e=>e.type===Vt)??null,Zl=Ll>=0?Ll:hi.length,Ql=[];hi.forEach(e=>{Kt(e)||(Ol(e)&&Ql.push(String(e.props.id)),Ql.push(...Il(e,1,Bl)))}),Al&&(Ql.push(String(Al.props.id)),Ql.push(...Il(Al,1,Bl)));const Xl=Ql.length>0&&Ql.every(e=>Lr.has(e)),_l=e=>{const n=Sr.blockRowName(e,Ni);return Sr.rowName?Sr.rowName(e,"block",n):n},ql=(e,n,t,o)=>{const r=Mi(e)[t];if(!r)return;const i={...Pn(e),index:t},l={...Pn(n),index:Math.min(Math.max(o,0),Mi(n).length)},s=gn(i,l);if(e!==n||s!==t)try{ki.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Mn))throw e}},es=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Sl(e))n.add(r),t(o)};for(const t of bl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ns=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Pi.get(n);if(!e)return null;if(e.zone===ze)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ts=e=>{const n=e.slice(0,e.indexOf(":")),t=hi.find(e=>Wt(e.type)&&String(e.props.id)===n);return t&&Ut(n)===e?t:null},os=(e,n)=>{const t=ts(e);return!t||(!Ft.groupAccepts||Ft.groupAccepts(t.type,n,Mi(e).length))},rs=(e,n,t)=>{if(e.rung){const t=ji(e.rung.nodeId),o=t?Li(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===vt&&n.index>=0&&n.index<=o}if(n.slot===vt)return!1;if(e.add)return ds(e.add,n);const o=Bn(n);if(Wt(e.type))return!1;const r=ts(o),i=ts(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!os(o,e.type))&&(n.index>=0&&n.index<=Mi(o).length));if(e.zone===ze||o===ze){if(e.zone!==o)return!1;const{floor:t,cap:r}=fi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Mi(o).length)return!1;if(e.zone===o)return!0;const l=Al&&!Ft.lastIsOpen?String(Al.props.id):null;return(!l||ns(e.zone)!==l&&ns(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Mi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Pi.get(i),s=l?Mi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&es(r).has(n))return!1;const d=kr(s.type,yr(jt?.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?.(Mi(n),r))})(e.zone,o,e.index,t)},is=(e,n)=>{const t=Bn(e.from),o=e.node;return t===Bn(n)?os(t,o.type):rs({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},ls=e=>{const n=e.slice(0,e.indexOf(":")),t=Pi.get(n),o=t?Mi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=kr(o.type,yr(jt?.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=O(r.choices??(r.spec?[{type:r.spec.childType,label:Ni(r.spec.childType)}]:[])),l=Ai(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:pl(o,t.zone===ze)}},ss=(e,n)=>{if("section"!==e.kind)return e;const t=Bn(n);return t===ze||ts(t)?e:ls(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},ds=(e,n)=>{const t=ss(e,n),o=Bn(n);if("shared"===t.kind){if(o!==ze||!Ft.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=fi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ts(o)){const e="section"===t.kind?t.type:t.template.node.type;return os(o,e)&&n.index>=0&&n.index<=Mi(o).length}if(o!==ze)return!1;const{floor:e,cap:r}=fi();return n.index>=e&&n.index<=r}if(o===ze)return!1;const r=ls(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Mi(o))},as=(e,n)=>{const t=ss(e,n);if("block"!==t.kind&&ts(Bn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&os(n,o)){if("section"===e.kind)ho.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;ho.insertNode(n,t,yi(e.template.node))}er(R),ho.select({index:t,zone:n})}})(t,Bn(n),n.index);if("section"===t.kind)return void sl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=rl(t),r=ho.insertNode(ze,o,n);ll(o,r,e)})(t.template.name,yi(t.template.node),n.index);if("shared"===t.kind){const e=Ft.shared?.nodeOf(t.section);if(!e)return;const o=rl(n.index);return void(ki.restore(e,{parentId:In,slot:On,index:o})&&ll(o,e.props.id,t.section.title))}const o=Bn(n),r=ls(o);r&&(r.target.spec?$l(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{ho.insertComponent(e,n,t),er(R),ho.select({index:t,zone:e})})(o,t.type,n.index))},cs=(e,n)=>{e.media?function(e){const n=Ds();if(!n||!Es)return;Vs(n).then(n=>{n&&function(e,n){if(!Es)return;const t=Es.create(e,{nodeDefaults:Ii,newNodeId:Be,sectionLabel:Oi,blockIsOffered:br}),o=Bn(n);if(o===ze){const e=rl(n.index),o=ho.insertNode(ze,e,t);return void ll(e,o,Oi(t.type))}ho.insertNode(o,n.index,t),er(R),ho.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Di(e.rung.nodeId,e.index,n.index):e.add?as(e.add,n):e.zone===ze?il(e.index,n.index):ql(e.zone,Bn(n),e.index,n.index)},[ps]=An(()=>fn()),us=mn({keyOf:e=>e.id,readOnly:Boolean(Nt),session:ps,canDrop:rs,onDrop:cs,onStep:(e,n)=>{e.rung?Di(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ze?((e,n)=>{const t=Oi(hi[e]?.type??""),o=il(e,n<0?e-1:e+2);if(!o.moved)return void Yr(n<0?Xt.sectionFirst({name:t}):Xt.sectionLast({name:t}));const{floor:r,cap:i}=fi();Yr(Xt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):ql(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),hs=En(e=>{const{floor:n,cap:t}=fi(),o=[];for(const r of e.nodes){const e=Bn(r.place),i=Mi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Gt(i)||Kt(i)||mr(i.type,i))continue;if(Wt(i.type))continue;const l=Boolean(ts(e)),s=e===ze||l;e===ze&&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?Oi(i.type):Wi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Bn(e.list);if(n===ze&&0===e.children.length)return[{...e,addLabel:Xt.addSection,addAlways:!0}];const t=ls(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ts(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Bn(e.list),t=n===ze||ts(n)?null:ls(n);return t?.choices.length?cn(e,t.target.spec?.addLabel??Xt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[jt.data]),fs=null==Tt?.props.id?null:String(Tt.props.id),ms=En(e=>{const n=Rt,t=e=>!e.item.rung&&null!==$n(jt.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(fs);return i||(r(Ye(jt.data,n,o.item.id,fs,Fl))??o)},[jt.data,Rt,fs,Fl]),[gs,ys]=An(null),vs=Boolean(Rl||Hl);Sn(Fo,"mouseover",e=>{if(!vs)return;const n=wn(e.target),t=n?ht(jt.data,Rt,n):null;t!==gs&&ys(t)}),Sn(Fo,"mouseout",e=>{vs&&!e.relatedTarget&&ys(null)});const ks=e=>Gt(e)||Kt(e)||Wt(e.type),bs=e=>{const n=Wt(e.type)?Ni(e.type):Gt(e)?Xt.header:Kt(e)?Xt.footer:null;return null===n?Bi(e):Sr.rowName?Sr.rowName(e,"section",n):n},Ss=[];if(vs){const e=fs?ht(jt.data,Rt,fs):null;for(const n of/* @__PURE__ */new Set([e,gs])){const e=n?hi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Gt(e)||e.type===Ht,o=Vl(e);if(o){Ss.push({id:String(e.props.id),label:bs(e),below:t,reach:o});continue}if(!Rl||!ks(e))continue;const r=Rl(e);r&&Ss.push({id:String(e.props.id),label:r,below:t})}}const ws=pe(),xs=jn(null);Tn(()=>{const e=Ft.changeNotice;if(!e)return;const n=JSON.stringify(hi.filter(ks)),t=xs.current;if(xs.current={doc:Dn,bands:n,index:At.index},!t||t.doc!==Dn||t.bands===n)return;At.hasPast&&At.index>=t.index&&!ut.has(ws)&&(ut.add(ws),Yr(e,"success",{action:{label:Xt.bar.undo,onClick:()=>At.back()},duration:8e3}))},[hi]);const zs=e=>{er(R),ho.select(e.zone===ze?{index:e.index}:{index:e.index,zone:e.zone})},Cs=Z(),Ns=()=>({data:jt.data,device:wo,ops:ho,inspector:pr}),Is=Cs?.model,Os=Ln(()=>Is?e=>Is(e,hs(e),Ns()):hs,[Is,hs,wo]),Bs=Cs?.measure,Ps=Bs?(e,n)=>Bs(e,n,Ns()):void 0,$s=Cs?.canDrop,Ms=$s?(e,n)=>$s(e,n,rs,Ns()):rs,js=Cs?.drop,Ls=js?(e,n)=>js(e,n,cs,Ns()):cs,As=Cs?.pick,Ts=As?e=>As(e,zs,Ns()):zs,Es=Cs?.media??null,Rs=jn(null),Fs=Ln(()=>Es?{id:ct,zone:"",index:-1,type:Es.adds.type,add:{kind:Es.adds.kind,type:Es.adds.type},media:!0}:null,[Es]);Tn(()=>{if(!Fs||Nt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(Xn))(e)&&(Rs.current=null,ps.start({key:ct,item:Fs}))},n=e=>{ps.get()?.item.media&&(Rs.current=Un(e.dataTransfer))},t=()=>{ps.get()?.item.media&&ps.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Fs,Nt,ps]);const Ds=()=>{const e=Rs.current;return Rs.current=null,e},Hs=ce(),Vs=async e=>{if(!Hs)return e;const n=await Hs(e);return n?{...e,id:n.id,url:n.url}:null};const Ws=(e,n)=>{if(!Es)return;const t=$n(uo.getState().appState.data,mi,n);if(!t)return;const o=t.node;ho.replaceComponent(Bn(t.place),t.place.index,{...o,props:{...Es.replace(o,e),id:o.props.id}})},Us=e=>{const n=Bn(e),t=Ai(n);t&&Ri(t.node,t.slot,!1),al(n,e.index)},Js=(e,n)=>/* @__PURE__ */st(He,{...Nt?{}:us.seam({place:{...Pn(e),index:n}})},`seam:${e}:${n}`),Ys={rowClick:ul,isCollapsed:Hr,toggleCollapse:Vr},Gs=e=>{const n=String(e.props.id),t=hi.findIndex(e=>String(e.props.id)===n),o=Ut(n),r=Mi(o),i=Hr(n),l=Ni(e.type),s=Sr.rowName?Sr.rowName(e,"section",l):l,d=e=>Js(o,e);/* @__PURE__ */
16
- return dt(at,{children:[
17
- /* @__PURE__ */st(Te,{words:_t,icon:/* @__PURE__ */st(xr,{type:e.type,size:13}),name:s,preview:fl(e),marks:ml(e),onSelect:()=>ol(t),nameSlot:Ji(ze,t,n,s),selected:tr===n,badge:Vl(e)?void 0:Yl,shared:Vl(e),actions:gl(e,ze,t)??void 0,rowProps:{"data-node-id":n,onClick:ul(()=>ol(t))},fold:{open:!i,label:"section",onToggle:()=>Vr(n)}}),!i&&/* @__PURE__ */dt(Ee,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Bi(n),l=Ol(n),s=l&&Hr(r),a=()=>Pl(o,t,r,e.type),{rowProps:c,...p}=us.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Pn(o),index:t}},{"data-node-id":r,onClick:ul(a)});/* @__PURE__ */
18
- return dt(Fn,{children:[d(t),
19
- /* @__PURE__ */st(Te,{words:_t,icon:/* @__PURE__ */st(xr,{type:n.type,size:13}),name:i,preview:fl(n),marks:ml(n),onSelect:a,nameSlot:Ji(o,t,r,i),selected:tr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Vr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[hl(o,t,i),gl(n,o,t),yl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */st(Ee,{children:Qs(n,2)})]},r)}),d(r.length)]})]})},Ks=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=us.dragging,d=!Hr(l)&&s?.rung?.nodeId!==i,a={...Pn(l),index:0},c=s&&!s.rung&&rs(s,a)?a:void 0,p=()=>Ri(e,n,!0),{rowProps:u,...h}=us.row({item:{id:`rung:${l}`,zone:`${i}:${vt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:vt,index:t},into:c,canDrag:Boolean(fr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:ul(p)}),f=Nt?null:fr.slotActions?.(e,n.slot);/* @__PURE__ */
20
- return dt(Fn,{children:[n.heading,
21
- /* @__PURE__ */st(Te,{words:_t,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Ti===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Vr(l)},actions:f&&f.length>0?/* @__PURE__ */st(at,{children:f.map((t,o)=>/* @__PURE__ */st(De,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Nt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Fi(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__ */st(tt,{size:15}):/* @__PURE__ */st(lt,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */st(Ee,{children:r})]},l)},Zs=(e,n)=>{const t=wl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
- return st(at,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Cl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Js(e,n),p=/* @__PURE__ */dt(at,{children:[i.map(({child:n,zone:t,index:o})=>{const r=tr===String(n.props.id),{collapsible:i,folded:s}=Nl(n,l,Bl(n.type)),d=String(n.props.id),a=_l(n),p=()=>Pl(t,o,d,e.type),{rowProps:u,...h}=us.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Pn(t),index:o}},{"data-node-id":d,onClick:ul(p)});/* @__PURE__ */
23
- return dt(Fn,{children:[0===o&&c(t,0),
24
- /* @__PURE__ */st(Te,{words:_t,icon:/* @__PURE__ */st(xr,{type:n.type,size:13}),name:a,preview:fl(n),marks:ml(n),onSelect:p,nameSlot:Ji(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>Vr(d)}:void 0,actions:/* @__PURE__ */dt(at,{children:[hl(t,o,a),gl(n,t,o),yl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */st(Ee,{children:Zs(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?Ks(e,t.rung,r++,o,p):/* @__PURE__ */st(Fn,{children:p},t.slot??"")})})},Qs=(e,n)=>{const t=yr(jt?.data,e.type,String(e.props.id)),o=wl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
- return st(at,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Cl(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),h=a&&!a.fixed?`${u}:${a.slot}`:null,f=p?`${u}:${p.slot}`:null,m=(e,n)=>Js(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */dt(at,{children:[l.map(({child:n,zone:t,index:o})=>{const r=tr===String(n.props.id),i=Wi(n),l=String(n.props.id),{collapsible:d,folded:a}=Nl(n,s,Bl(n.type)),c=bl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Pn(p),index:Mi(p).length}:void 0,h=us.dragging,f=u&&h&&rs(h,u)?u:void 0,g=()=>Pl(t,o,l,e.type),{rowProps:y,...v}=us.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Pn(t),index:o},into:f,canDrag:!mr(n.type,n)},{"data-node-id":l,onClick:ul(g)});/* @__PURE__ */
26
- return dt(Fn,{children:[0===o&&m(t,0),
27
- /* @__PURE__ */st(Te,{words:_t,icon:/* @__PURE__ */st(xr,{type:n.type,size:13}),name:i,preview:fl(n),marks:ml(n),onSelect:g,nameSlot:Ji(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Vr(l)}:void 0,actions:mr(n.type,n)?gl(n,t,o)??void 0:/* @__PURE__ */dt(at,{children:[hl(t,o,i),gl(n,t,o),yl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */st(Ee,{children:Qs(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
- /* @__PURE__ */st(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>$l(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?f&&!l.some(e=>e.zone===f)?m(f,0):null:0!==l.length||(o.rung?y:g!==f)?null:m(g,0)]});return o.rung?Ks(e,o.rung,i++,r,v):/* @__PURE__ */st(Fn,{children:v},o.slot??"")})})},Xs=Yo,_s=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:mo&&!Xs&&hr===e.id,onSelect:()=>ai(e.id)}:e,qs=[...(ur.railLead??[]).map(_s),{id:"sections",label:Xt.layers,icon:/* @__PURE__ */st(fe,{}),active:mo&&!Xs&&"sections"===hr,onSelect:()=>ai("sections")},...(ur.railTrail??[]).map(_s)];Co?qs.push({id:"media",label:Xt.railMedia,icon:/* @__PURE__ */st(me,{}),active:Oo,onSelect:Bo}):Pt&&qs.push({id:"media",label:Xt.railMedia,icon:/* @__PURE__ */st(me,{}),onSelect:ci});const ed={value:qs.find(e=>!0===e.active)?.id??"",press:e=>{const n=qs.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:qs.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */st("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},nd=[...ur.railLead??[],...ur.railTrail??[]].find(e=>"panel"in e&&e.id===hr),td=Boolean(Qt?.foldable),od=Qt?.label??($t?Xt.pageSections:Xt.templateSections),rd=td&&Hr(kt),id=/* @__PURE__ */dt(at,{children:[hi.map((e,n)=>{if(Gt(e)||Kt(e)||Wt(e.type))return null;const t=tr===String(e.props.id),o=Boolean(e.props._hidden);Sl(e);const r=String(e.props.id),i=ur.hasOwnRows?.(e)??!1,l=Ol(e)||i,s=l&&Hr(r),d=bl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Pn(a),index:Mi(a).length}:void 0,p=us.dragging,u=c&&p&&rs(p,c)?c:void 0,{rowProps:h,...f}=us.row({item:{id:r,zone:ze,index:n,type:e.type},place:{...Pn(ze),index:n},into:u,canDrag:!mr(e.type,e)},{"data-node-id":r,onClick:ul(()=>ol(n))});/* @__PURE__ */
29
- return dt(Fn,{children:[n>0&&vl(n),
30
- /* @__PURE__ */st(Te,{words:_t,icon:/* @__PURE__ */st(xr,{type:e.type,size:13}),name:Bi(e),preview:fl(e),marks:ml(e),shared:Vl(e),onSelect:()=>ol(n),nameSlot:Ji(ze,n,r,Bi(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>Vr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[hl(ze,n,Bi(e)),gl(e,ze,n),yl(ze,n,e,Bi(e))]}),rowProps:h}),Ol(e)&&!s&&/* @__PURE__ */dt(Ee,{children:[Qs(e,1),ur.partRows?.(e,Ys)]}),i&&!s&&/* @__PURE__ */st(Ee,{children:ur.ownRows?.(e,n,Ys)})]},String(e.props.id??n))}),Zl>0&&vl(Zl)]}),ld=(e,n,t)=>{const o=String(e.props.id),r=xl(e).length>0||zl(e)||Boolean(kr(e.type)),i=r&&Hr(o),l="header"===t?Xt.header:Xt.footer,s=Sr.rowName?Sr.rowName(e,"section",l):l;/* @__PURE__ */
31
- return dt(at,{children:[
32
- /* @__PURE__ */st(Te,{words:_t,icon:/* @__PURE__ */st(xr,{type:t,size:13}),name:s,preview:fl(e),marks:ml(e),badge:Vl(e)?void 0:Yl,shared:Vl(e),onSelect:()=>ol(n),nameSlot:Ji(ze,n,o,s),selected:tr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Vr(o)}:void 0,actions:gl(e,ze,n)??void 0,rowProps:{"data-node-id":o,onClick:ul(()=>ol(n))}}),r&&!i&&/* @__PURE__ */st(Ee,{children:Zs(e,1)})]})};return(ur.wrap??(e=>e))(
33
- /* @__PURE__ */st(Q,{target:Fo,children:/* @__PURE__ */dt("div",{ref:Ro,className:"sf-editor es-editor",style:tn(Tr),onContextMenu:Xi.onEditorContextMenu,...u(vn),children:[
34
- /* @__PURE__ */dt(Ge,{children:[
35
- /* @__PURE__ */st("div",{className:"es-cluster es-cluster--left","aria-hidden":"true"}),
36
- /* @__PURE__ */dt(Ke,{children:[
37
- /* @__PURE__ */st(Ze,{label:Xt.bar.undo,disabled:Boolean(Nt)||!At.hasPast,onClick:()=>At.back(),children:/* @__PURE__ */st(_n,{})}),
38
- /* @__PURE__ */st(Ze,{label:Xt.bar.redo,disabled:Boolean(Nt)||!At.hasFuture,onClick:()=>At.forward(),children:/* @__PURE__ */st(qn,{})}),
39
- /* @__PURE__ */st(Qe,{}),
40
- /* @__PURE__ */st(Xe,{devices:yo,value:wo,onChange:xo}),
41
- /* @__PURE__ */st(Ze,{label:Xt.bar.refresh,tip:Xt.bar.refreshTip,onClick:()=>{Eo.current=(()=>{const e=Fo?.document;if(!e)return null;const n=hi.findIndex(Kt),t=n>=0?n:hi.length;let o=null;for(let n=0;n<t;n++){const t=hi[n]?.props?.id;if(null==t)continue;const r=Nn(e,`[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=Tt?.props?.id??hi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),To(e=>e+1)},children:/* @__PURE__ */st(et,{})})]}),
42
- /* @__PURE__ */dt(Ke,{kind:"right",style:{minWidth:300},children:[xn?/* @__PURE__ */st(xn,{}):null,
43
- /* @__PURE__ */st(k,{input:Uo,words:Xt.saveStatus}),ur.barLead?.(),ur.barTrail?.(),ur.mainAction||!ur.barMain?/* @__PURE__ */st(b,{input:Uo,action:ur.mainAction??{label:Xt.done,onPress:()=>{Kn(jt.data)}},readOnly:Boolean(Nt),saveSwitch:Ot,onToggleAutoSave:wt,onSaveNow:Jo,bar:Xt.bar,words:Xt.saveStatus}):ur.barMain()]})]}),
44
- /* @__PURE__ */st(oe,{}),
45
- /* @__PURE__ */dt("div",{className:"sf-body",children:[mo?/* @__PURE__ */dt(at,{children:[
46
- /* @__PURE__ */dt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Xt.leftPanel,children:[
47
- /* @__PURE__ */st("div",{className:"es-paneltabs",children:/* @__PURE__ */st(Vn,{variant:"underline",block:!0,"aria-label":Xt.bar.views,value:ed.value,onChange:ed.press,items:ed.items})}),Yo?/* @__PURE__ */st(x,{at:Zo?{label:(e=>{const n=ts(e.zone);if(n)return Xt.add.addingTo({name:Sr.rowName?pl(n,!0):Ni(n.type)});if(e.zone===ze){const n=hi[e.index];return n&&!Kt(n)?Xt.add.addingBefore({name:pl(n,!0)}):Xt.add.addingAtEnd}const t=ls(e.zone);return t?Xt.add.addingTo({name:t.parentName}):Xt.add.addingHere})(Zo),onClear:()=>Qo(null)}:void 0,placeBlocks:Zo&&Zo.zone!==ze?ls(Zo.zone)?.choices:void 0,canTake:Zo?e=>{if(!Zo)return null;const n={...Pn(Zo.zone),index:Zo.index};if(ds(e,n))return null;if("shared"===e.kind&&Zo.zone===ze&&!Ft.shared?.nodeOf(e.section))return Xt.shared.alreadyHere;const t=ts(Zo.zone);if(t)return Xt.add.notInside({name:pl(t,!0)});if(Zo.zone===ze)return Xt.add.onlySections;const o=ls(Zo.zone);return o?Xt.add.notInside({name:o.parentName}):Xt.add.onlySections}:void 0,onPick:Zo?e=>{if(!Zo)return;const n={...Pn(Zo.zone),index:Zo.index};ds(e,n)&&(as(e,n),cl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:ps,siteWide:ur.addPanelRow?.(cl),onClose:cl,onHide:si,readOnly:Boolean(Nt)}):nd?nd.panel({onHide:si,notify:Yr}):/* @__PURE__ */dt(at,{children:[
48
- /* @__PURE__ */st(N,{icon:/* @__PURE__ */st(fe,{}),title:Xt.layers,context:io,actions:/* @__PURE__ */dt(at,{children:[!Nt&&/* @__PURE__ */st(_e,{label:Xt.add.title,onClick:()=>dl(null),children:/* @__PURE__ */st(nt,{size:15})}),
49
- /* @__PURE__ */st(_e,{label:Xl?Xt.expandAll:Xt.collapseAll,title:0===Ql.length?Xt.nothingToFold:void 0,disabled:0===Ql.length,onClick:()=>Ar(e=>{const n=new Set(Ql);return Xl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Ql])}),children:/* @__PURE__ */st(mt,{expand:Xl})})]}),onHide:si}),
50
- /* @__PURE__ */dt(Re,{className:"sf-tree sf-scroll",words:_t,children:[
51
- /* @__PURE__ */st(Te,{words:_t,icon:/* @__PURE__ */st(xr,{type:"page",size:13}),name:Xt.pageSettings,onSelect:pi,selected:!Tt&&nr,rowProps:{onClick:ul(pi)}}),Gl&&/* @__PURE__ */dt(at,{children:[!Dl&&/* @__PURE__ */st(Fe,{children:Xt.header}),Gs(Gl)]}),Mt&&!(Dl&&Gl)&&/* @__PURE__ */dt(at,{children:[!Dl&&/* @__PURE__ */st(Fe,{children:Xt.header}),!Zt&&/* @__PURE__ */st(Te,{words:_t,icon:/* @__PURE__ */st(xr,{type:"header",size:13}),name:Xt.header,badge:Jl?void 0:Yl,shared:Jl,onSelect:ui,selected:qo.kind===Yt?.kind,rowProps:{onClick:ul(ui)}})]}),El&&!(Dl&&Gl)&&ld(El,Tl,"header"),!td&&/* @__PURE__ */st(Fe,{children:od}),td?/* @__PURE__ */dt(at,{children:[
52
- /* @__PURE__ */st(Te,{words:_t,icon:null,name:od,fold:{open:!rd,label:od,onToggle:()=>Vr(kt)}}),!rd&&/* @__PURE__ */st(Ee,{children:id})]}):id,Mt&&!Dl&&/* @__PURE__ */st(Fe,{children:Xt.footer}),Al&&!(Dl&&Kl)&&ld(Al,Ll,"footer"),Kl&&Gs(Kl),ur.treeFoot?.()]})]})]}),
53
- /* @__PURE__ */st(qe,{side:"left",width:Tr.left,min:nn.left,max:en,defaultWidth:m.left,label:Xt.resizeLeftPanel,onResize:Fr})]}):/* @__PURE__ */st(I,{side:"left",onShow:si}),
54
- /* @__PURE__ */dt("div",{ref:Gr,className:"sf-center sf-scroll","data-sf-canvas-head":_r?"":void 0,style:{overflowX:ri?"auto":"hidden",overflowY:"hidden"},children:[_r&&/* @__PURE__ */st("div",{ref:qr,className:"sf-canvas-head",children:/* @__PURE__ */st(_r,{device:wo})}),
55
- /* @__PURE__ */dt("div",{className:"sf-frame-scaler",style:ii,children:[
56
- /* @__PURE__ */st("div",{className:"sf-frame "+(wo===bo?"":`sf-frame--${wo}`),style:li,children:/* @__PURE__ */dt("div",{className:"sf-preview-host",children:[
57
- /* @__PURE__ */st(Le.Provider,{value:Fl,children:/* @__PURE__ */st(Ae.Provider,{value:Ul,children:/* @__PURE__ */st(lo,{},Ao)})}),
58
- /* @__PURE__ */st(pn,{canvas:Fo,session:ps,model:Os,measure:Ps,canDrop:Ms,onDrop:Ls,choose:ms,onPick:Ts,dropOn:Es?{accepts:(e,n)=>{if(!e.media||!Es||n.item.rung)return!1;const t=$n(jt.data,mi,n.item.id);return null!==t&&Es.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ds();n&&Es&&Vs(n).then(n=>{n&&Ws(n,e.item.id)})})(n),label:()=>Xt.canvasReplaceImage}:void 0,onZoneAdd:Us,onSeamAdd:Us,zoneAddLabel:Xt.canvasAddBlock,words:qt.canvas,readOnly:Boolean(Nt),revision:jt.data}),Xo.length>0&&!Do&&/* @__PURE__ */st("div",{className:"sf-preview-gaps",children:Xo.map(e=>
59
- /* @__PURE__ */st(un,{index:e.index,label:Xt.addSectionHere,onInsert:()=>dl(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),vs?/* @__PURE__ */st(ft,{canvas:Fo,tabs:Ss,onSelect:e=>{const n=hi.findIndex(n=>String(n.props.id)===e);n>=0&&ol(n)}}):null]})]}),go?/* @__PURE__ */dt(at,{children:[zn?
60
- /* @__PURE__ */st("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:zn}):/* @__PURE__ */st(at,{children:/* @__PURE__ */st(h,{value:{selectChild:Pl,addChild:$l,childRowName:Wi,blockRowName:_l},children:/* @__PURE__ */st(so,{mode:qo,onOpenWebsiteSettings:ur.openSettings??(()=>{}),onOpenSiteStyles:ur.openStyles,onSelectNode:Ir,onNotify:Yr,onHidePanel:di,nodeActions:Tt?Ce(Rt,Tt.type):bt})})}),
61
- /* @__PURE__ */st(qe,{side:"right",width:Tr.right,min:nn.right,max:en,defaultWidth:m.right,label:Xt.resizeSettingsPanel,onResize:Dr})]}):
62
- /* @__PURE__ */st(I,{side:"right",onShow:di})]}),Xi.menu,
63
- /* @__PURE__ */st(ee,{}),Si?/* @__PURE__ */st(pt,{name:Si.name,onMake:e=>(async(e,n)=>{const t=hi.find(n=>String(n.props.id)===e),o=Ft.shared;if(!t||!o)return;let r;try{r=await C(bi).create(n,t)}catch{return void Yr(Xt.shared.makeFailed,"error")}o.adopt(t,r),wi(null)})(Si.id,e),onCancel:()=>wi(null)}):null]})}))}export{wt as ScreenChrome};