efficient-easel 24.2.0 → 25.1.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 (147) hide show
  1. package/README.md +43 -2
  2. package/dist/{CanvasDragLayer-NZpaX6aq.d.ts → CanvasDragLayer-DXeQGrwJ.d.ts} +42 -3
  3. package/dist/canvas/index.d.ts +2 -139
  4. package/dist/canvas/index.js +1 -1
  5. package/dist/chrome/index.js +1 -1
  6. package/dist/{chunk-6NJHYXJM.js → chunk-3XECMGXX.js} +1 -1
  7. package/dist/{chunk-FRAIEWRC.js → chunk-62UGN7VM.js} +1 -1
  8. package/dist/{chunk-HNKB2ZYR.js → chunk-6ATIYLUL.js} +1 -1
  9. package/dist/{chunk-Y53EKN35.js → chunk-6EDVZBUO.js} +1 -1
  10. package/dist/{chunk-JMAOCKB2.js → chunk-6WTWYHC2.js} +3 -3
  11. package/dist/chunk-7UFKEX72.js +1 -0
  12. package/dist/chunk-BBD3FLU3.js +16 -0
  13. package/dist/chunk-CEC5XLN4.js +1 -0
  14. package/dist/chunk-CWELHADJ.js +1 -0
  15. package/dist/chunk-DX3VILZ3.js +6 -0
  16. package/dist/chunk-ERB6FAZT.js +2 -0
  17. package/dist/{chunk-TGZCD6IP.js → chunk-EUFDQ4KL.js} +1 -1
  18. package/dist/chunk-FEP6XMNX.js +1 -0
  19. package/dist/chunk-FR7EEKFF.js +1 -0
  20. package/dist/chunk-GDO4QJ4G.js +1 -0
  21. package/dist/{chunk-GMCZXMOV.js → chunk-GR3XRILS.js} +1 -1
  22. package/dist/chunk-H6BER2EU.js +1 -0
  23. package/dist/{chunk-G67G63O5.js → chunk-ITIVCER6.js} +1 -1
  24. package/dist/chunk-IW5QXREH.js +64 -0
  25. package/dist/chunk-JIP5JNRB.js +1 -0
  26. package/dist/chunk-JQQFB7EZ.js +1 -0
  27. package/dist/{chunk-AGWKB77Q.js → chunk-K53PQAMP.js} +1 -1
  28. package/dist/{chunk-4ESG53BH.js → chunk-KF3LT7J2.js} +1 -1
  29. package/dist/{chunk-CLOS6SSX.js → chunk-KO47WAWR.js} +1 -1
  30. package/dist/chunk-KVIEUWTX.js +11 -0
  31. package/dist/{chunk-QORC32JO.js → chunk-LUHGBFOD.js} +3 -3
  32. package/dist/{chunk-DDH2DYQP.js → chunk-LUOY3A3Q.js} +1 -1
  33. package/dist/chunk-MIX7EGRG.js +2 -0
  34. package/dist/{chunk-2FYFAAAK.js → chunk-OXOUGEAT.js} +1 -1
  35. package/dist/chunk-PMRN5Z3T.js +1 -0
  36. package/dist/{chunk-55KKGABA.js → chunk-PVBDKBJB.js} +1 -1
  37. package/dist/{chunk-RPMSET77.js → chunk-QTHQPJWA.js} +1 -1
  38. package/dist/{chunk-ISS72IKO.js → chunk-QZJKWKGH.js} +1 -1
  39. package/dist/{chunk-IYHO4XQX.js → chunk-S6YOIRXQ.js} +1 -1
  40. package/dist/{chunk-5PXVT7JY.js → chunk-SBVIW3KJ.js} +1 -1
  41. package/dist/chunk-SC6E3UUS.js +13 -0
  42. package/dist/{chunk-LN43DP2A.js → chunk-SQTVXE5D.js} +13 -13
  43. package/dist/chunk-TOKMFZPB.js +1 -0
  44. package/dist/chunk-U3LTJSBU.js +20 -0
  45. package/dist/{chunk-75C6WFNF.js → chunk-UCZQWQNS.js} +1 -1
  46. package/dist/chunk-UDWXBS46.js +1 -0
  47. package/dist/{chunk-WYTPBF3Q.js → chunk-VBEVZZTV.js} +11 -11
  48. package/dist/{chunk-OITNWE52.js → chunk-XLC7HWW3.js} +1 -1
  49. package/dist/chunk-XTDOSL2M.js +8 -0
  50. package/dist/chunk-YYD257TD.js +1 -0
  51. package/dist/copy/index.js +13 -13
  52. package/dist/copy-place-CQIemdtU.d.ts +25 -0
  53. package/dist/data/index.d.ts +4 -1
  54. package/dist/data/index.js +1 -1
  55. package/dist/dom-BpxMcHFP.d.ts +200 -0
  56. package/dist/drag/index.d.ts +2 -3
  57. package/dist/drag/index.js +1 -1
  58. package/dist/draw/index.d.ts +1 -1
  59. package/dist/draw/index.js +1 -1
  60. package/dist/easel/index.d.ts +67 -1
  61. package/dist/easel/index.js +1 -1
  62. package/dist/edit-lock/index.d.ts +0 -46
  63. package/dist/edit-lock/index.js +1 -1
  64. package/dist/fields/fields.css +6 -40
  65. package/dist/fields/index.d.ts +1 -6
  66. package/dist/fields/index.js +1 -1
  67. package/dist/node-ops/index.js +1 -1
  68. package/dist/page-copy/index.d.ts +110 -0
  69. package/dist/page-copy/index.js +5 -0
  70. package/dist/panel/index.d.ts +29 -34
  71. package/dist/panel/index.js +1 -1
  72. package/dist/panel/panel.css +0 -78
  73. package/dist/screen/components/AddBlockRow.js +1 -1
  74. package/dist/screen/components/AddSidePanel.d.ts +37 -57
  75. package/dist/screen/components/AddSidePanel.js +1 -1
  76. package/dist/screen/components/NodeContextMenu.d.ts +19 -11
  77. package/dist/screen/components/NodeContextMenu.js +1 -1
  78. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  79. package/dist/screen/components/SaveControls.d.ts +10 -11
  80. package/dist/screen/components/SaveControls.js +1 -1
  81. package/dist/screen/components/ScreenChrome.js +1 -1
  82. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  83. package/dist/screen/components/ScreenMount.d.ts +5 -6
  84. package/dist/screen/components/ScreenMount.js +1 -1
  85. package/dist/screen/components/ScreenStoreProvider.d.ts +8 -9
  86. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  87. package/dist/screen/components/SectionScreenShell.js +17 -17
  88. package/dist/screen/components/SidePanelHead.js +1 -1
  89. package/dist/screen/components/panel-widths.js +1 -1
  90. package/dist/screen/components/usePartBridge.d.ts +10 -11
  91. package/dist/screen/components/usePartBridge.js +1 -1
  92. package/dist/screen/index.d.ts +9 -10
  93. package/dist/screen/index.js +1 -1
  94. package/dist/screen/lib/document/block-set-host.d.ts +55 -0
  95. package/dist/screen/lib/document/block-set-host.js +1 -0
  96. package/dist/screen/lib/document/block-types-in.js +1 -1
  97. package/dist/screen/lib/document/box-fields.d.ts +160 -5
  98. package/dist/screen/lib/document/box-fields.js +1 -9
  99. package/dist/screen/lib/document/device-fields.js +1 -1
  100. package/dist/screen/lib/document/palette-sections.d.ts +33 -97
  101. package/dist/screen/lib/document/palette-sections.js +1 -1
  102. package/dist/screen/lib/document/preview-dom.js +1 -1
  103. package/dist/screen/lib/document/section-doc.js +1 -1
  104. package/dist/screen/lib/document/style-clipboard.d.ts +10 -11
  105. package/dist/screen/lib/document/style-clipboard.js +1 -1
  106. package/dist/screen/lib/document/use-section-ops.js +1 -1
  107. package/dist/screen/lib/document-switch.js +1 -1
  108. package/dist/screen/lib/failure.js +1 -1
  109. package/dist/screen/lib/host-inbound.js +1 -1
  110. package/dist/screen/lib/key-scope.js +1 -1
  111. package/dist/screen/lib/media-picker.js +1 -1
  112. package/dist/screen/lib/page-lock.js +1 -1
  113. package/dist/screen/lib/screen-parts.d.ts +251 -12
  114. package/dist/screen/lib/screen-parts.js +1 -1
  115. package/dist/screen/screen.css +6 -0
  116. package/dist/screen/words.d.ts +9 -0
  117. package/dist/screen/words.js +1 -1
  118. package/dist/strings/index.d.ts +4 -1
  119. package/dist/strings/index.js +2 -2
  120. package/dist/style-clipboard/index.d.ts +0 -32
  121. package/dist/style-clipboard/index.js +1 -1
  122. package/dist/text-styles/index.d.ts +7 -6
  123. package/dist/text-styles/index.js +37 -36
  124. package/dist/text-styles/text-styles.css +5 -53
  125. package/dist/tree/index.d.ts +2 -2
  126. package/dist/{types-DBy3L69b.d.ts → types-CoUTWUwB.d.ts} +1 -1
  127. package/dist/words-Dl8Qja4K.d.ts +32 -0
  128. package/package.json +15 -3
  129. package/dist/chunk-3FIS2FRS.js +0 -1
  130. package/dist/chunk-7RSE6KKY.js +0 -1
  131. package/dist/chunk-CMPFUJ26.js +0 -8
  132. package/dist/chunk-CZAAGBVL.js +0 -7
  133. package/dist/chunk-DSKNJXB4.js +0 -1
  134. package/dist/chunk-FJTCSQWK.js +0 -16
  135. package/dist/chunk-G7ISR6DI.js +0 -1
  136. package/dist/chunk-H4Z2V56N.js +0 -21
  137. package/dist/chunk-K7MMLCTT.js +0 -2
  138. package/dist/chunk-KRL3IUV3.js +0 -1
  139. package/dist/chunk-LF3FUSCQ.js +0 -1
  140. package/dist/chunk-THWO5YVZ.js +0 -1
  141. package/dist/chunk-TOHOGVAE.js +0 -15
  142. package/dist/chunk-UKPZ2YWE.js +0 -64
  143. package/dist/chunk-V7U33NF2.js +0 -1
  144. package/dist/chunk-VKPOH6MK.js +0 -1
  145. package/dist/chunk-YU3WHLGI.js +0 -1
  146. package/dist/repeat-D65bJS8d.d.ts +0 -49
  147. package/dist/session-EsjORLQ0.d.ts +0 -43
@@ -1 +0,0 @@
1
- import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"efficient-shell/markup";var i={formatting:"Formatting",alignment:"Alignment",marks:{...Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),underline:{name:"Underline",title:"Underline · [words]{underline}"},sup:{name:"Superscript",title:"Superscript · [words]{sup}"},sub:{name:"Subscript",title:"Subscript · [words]{sub}"}},placeholders:t,showMarks:"Show marks",colors:{title:"Color",theme:"Theme colors",remove:"Remove",any:"Any color",square:"Saturation and brightness",hue:"Hue",hex:"Hex color"},panel:{style:"Style",editStyles:"Edit styles",updateStyle:"Update style",font:"Font",italic:"Italic",list:"List",lists:{none:"No list",bullet:"Bulleted",number:"Numbered"},capitalization:"Capitalization",cases:{none:"As typed",upper:"Uppercase",capitalize:"Capitalized",lower:"Lowercase"}},cells:{fontSize:"Font size",lineHeight:"Line spacing",letterSpacing:"Letter spacing",paragraphSpacing:"Paragraph spacing",tip:({name:e,step:t,unit:i})=>`${e} · step ${t} ${i} · Shift ×10`}};export{i as DEFAULT_COPY_WORDS};
@@ -1 +0,0 @@
1
- var t="data-sf-repeat",e="data-sf-repeat-index",r=`[${t}][${e}]:not([${e}="0"])`;function n(t){return null!==t.closest(r)}function l(t){let e=null;for(const r of t){if(!n(r))return r;e??=r}return e}function o(t,e){return l(t.querySelectorAll(e))}function u(t,e){const r=[...t.querySelectorAll(e)],o=l(r);return o?[o,...r.filter(t=>t!==o&&n(t))]:[]}export{t as REPEAT_ATTRIBUTE,e as REPEAT_INDEX_ATTRIBUTE,n as isRepeatCopy,l as mainCopyOf,u as queryAllCopies,o as queryMainCopy};
@@ -1 +0,0 @@
1
- import{DEFAULT_LOCK_WORDS as e}from"./chunk-RE4LP46F.js";var n=e=>"editing"===e.kind;function t(e){return e?{kind:"checking"}:{kind:"editing"}}var r=e=>"blocked"===e.kind||"readonly"===e.kind||"takenover"===e.kind?e.holder:null;function c(e){if(!e||"object"!=typeof e)return null;const n=e;return"string"!=typeof n.holder_name?null:{name:n.holder_name,secondsSinceSeen:"number"==typeof n.seconds_since_seen?n.seconds_since_seen:0,secondsSinceHeld:"number"==typeof n.seconds_since_held?n.seconds_since_held:0}}var s=e=>e?{edit:!0,insert:!0,delete:!0,duplicate:!0,drag:!1}:{edit:!1,insert:!1,delete:!1,duplicate:!1,drag:!1};function o(n,t=e){if(!Number.isFinite(n)||n<45)return t.justNow;const r=Math.round(n/60);if(r<60)return t.minutesAgo({count:r});const c=Math.round(r/60);return t.hoursAgo({count:c})}var a=(n,t=e)=>n.trim()||t.someone;function i(){return`tab-${"undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():Math.random().toString(36).slice(2)}`.slice(0,64)}var d="edit_lock_taken";function u(e,t,r){return!(n(e)||!n(t))&&(r.pending&&r.autoSaveEnabled&&!r.saveConflict)}function l(e,t,c){return!(null===r(e)||!n(t))&&(!c.pending&&!c.saveConflict)}function f(e,n){return e!==n&&Date.parse(e)>=Date.parse(n)}async function k(e){if(!e.ours)return!1;const n=await e.stored().catch(()=>null);return!(!n||!f(n,e.ours)||e.hasPending())&&(e.reload(),!0)}var h=8e3,y=3e4;function g(e){if(e.cancelled())return!1;const n=e.currentAccess();if("checking"!==n.kind)return!1;const t={kind:"editing"};return e.setAccess(t),u(n,t,e.heldWrite())&&e.releaseHeldWrite(),!0}function p(e){const{readFailure:n,conflictCode:t}=e,r=e=>{const t=n(e);return t&&409===t.status?c(t.data):null},s=e=>{const n=r(e);return n?{kind:"blocked",holder:n}:{kind:"editing"}},o=(e,n)=>{const t=r(e);return t?{kind:"blocked",holder:t}:n},a=(e,n)=>{const t=r(e);return t?{kind:"takenover",holder:t}:n},i=e=>{const t=n(e);return null!==t&&(401===t.status||403===t.status)};return{accessAfterClaimFailure:s,accessAfterTakeoverFailure:o,accessAfterHeartbeatFailure:a,isAuthRejection:i,readSaveConflict:e=>{const r=n(e);if(!r||409!==r.status)return null;if(!r.data||"object"!=typeof r.data)return null;const c=r.data;return c.code!==t?null:{savedBy:"string"==typeof c.saved_by?c.saved_by:"",savedByYou:!0===c.saved_by_you,secondsAgo:"number"==typeof c.seconds_ago?c.seconds_ago:0}},readLockTaken:e=>{const t=n(e);return t&&409===t.status&&t.data&&"object"==typeof t.data?t.data.code!==d?null:c(t.data)??{name:"",secondsSinceSeen:0,secondsSinceHeld:0}:null},makeClaimBeat:e=>{let n=!1;return async t=>{let r,c;try{const s=await e.claim(t);if(e.cancelled())return;r=e.currentAccess(),c={kind:"editing"},!n&&s.heartbeat_seconds>0&&(n=!0,e.startHeartbeat(1e3*s.heartbeat_seconds))}catch(n){if(e.cancelled())return;r=e.currentAccess(),c=t?o(n,r):"checking"===r.kind?s(n):a(n,r),i(n)&&e.stopHeartbeat()}e.setAccess(c);const d=e.heldWrite();u(r,c,d)?e.releaseHeldWrite():t&&l(r,c,d)&&e.reloadIfMoved?.()}}}}export{h as CLAIM_FAIL_OPEN_MS,d as EDIT_LOCK_TAKEN,y as FAIL_OPEN_RETRY_MS,t as accessForNewDocument,n as canWriteDocument,p as createEditLock,o as describeAge,s as documentPermissions,f as documentVersionMoved,r as holderOf,a as nameOrSomeone,i as newEaselClientId,g as openUnansweredClaim,c as readLockHolder,k as reloadIfVersionMoved,u as shouldReleaseHeldWrite,l as shouldReloadAfterTakeover};
@@ -1,15 +0,0 @@
1
- import{DEFAULT_PANEL_WORDS as e}from"./chunk-KFV7N2DJ.js";import{SettingsField as l,SettingsSegmented as n}from"./chunk-CZAAGBVL.js";import{AccordionHeading as a,SettingReset as i,Tooltip as t}from"efficient-shell/ui";export{AlignmentGrid,BorderInput,CornersInput,SidesEachToggle,SidesInput,borderSides,borderStartEach,sidesStartEach}from"efficient-shell/ui";import{jsx as s,jsxs as d,Fragment as o}from"react/jsx-runtime";import{BackgroundIcon as r,WidthIcon as c}from"efficient-shell/icons/efficient";function u({title:e,level:l=3,id:n,className:i}){/* @__PURE__ */
2
- return s(a,{title:e,level:l,id:n,className:i?`es-panel-band ${i}`:"es-panel-band"})}function b({title:e,level:l=4,id:n,className:i}){/* @__PURE__ */
3
- return s(a,{tier:"row",title:e,level:l,id:n,className:i})}function h({label:l,changed:n,onReset:a,detail:t,disabled:d,defaultAction:o,words:r,className:c}){const u={...e,...r},b=u.resetName({label:l});/* @__PURE__ */
4
- return s(i,{label:l,changed:n,onReset:a,detail:t,disabled:d,defaultAction:o,name:b,tip:t?u.resetTitle({label:l,detail:t}):b,className:c})}function m({name:e,preview:l,offPage:n,status:a,onOpen:i,id:r,className:c}){const u=null!=l;/* @__PURE__ */
5
- return d("button",{type:"button",id:r,className:c?`es-drill ${c}`:"es-drill",onClick:i,children:[
6
- /* @__PURE__ */d(t,{content:u?/* @__PURE__ */d(o,{children:[e,
7
- /* @__PURE__ */s("br",{}),l]}):e,describe:!1,className:"es-drill-text",children:[
8
- /* @__PURE__ */s("span",{className:"es-drill-name",children:e}),u?/* @__PURE__ */s("span",{className:n?"es-drill-preview is-offpage":"es-drill-preview",children:l}):null]}),a?/* @__PURE__ */s("span",{className:"es-drill-status",children:a}):null,
9
- /* @__PURE__ */s("span",{className:"es-drill-chev","aria-hidden":"true"})]})}function f({label:e,onPress:l,disabled:n,note:a,done:i,doneLabel:t,icon:o,id:r,className:c}){const u=void 0===t?e:t,b=i?u:e,h=null!=a,m=h&&r?`${r}-note`:void 0;/* @__PURE__ */
10
- return d("div",{className:c?`es-action-wrap ${c}`:"es-action-wrap",children:[
11
- /* @__PURE__ */d("button",{type:"button",id:r,className:i?"es-action is-done":"es-action",disabled:n,"aria-describedby":m,onClick:l,children:[o?/* @__PURE__ */s("span",{className:"es-action-icon","aria-hidden":"true",children:o}):null,
12
- /* @__PURE__ */s("span",{className:"es-action-label",children:b})]}),h?/* @__PURE__ */s("p",{id:m,className:"es-action-note",children:a}):null,
13
- /* @__PURE__ */s("span",{className:"es-action-live",role:"status","aria-live":"polite",children:i?u:null})]})}var p=["full","content"],N={label:"Background",full:"Full width",content:"Content width"};function v({value:e,changed:a,detail:i,onChange:t,onReset:d,disabled:o=!1,hint:c,labelId:u,words:b,resetWords:m}){const f={...N,...b};/* @__PURE__ */
14
- return s(l,{label:f.label,labelId:u,icon:/* @__PURE__ */s(r,{}),changed:a,hint:c,action:/* @__PURE__ */s(h,{words:m,label:f.label,changed:a,detail:i,onReset:d}),children:/* @__PURE__ */s(n,{options:p.map(e=>({id:e,label:"full"===e?f.full:f.content})),value:e,onChange:t,ariaLabel:f.label,disabled:o})})}var g={label:"Content",full:"Full width",content:"Content width"};function w({mode:e,onMode:a,number:i,changed:t,detail:o,onReset:r,fullClosed:u=!1,disabled:b=!1,hint:m,labelId:f,words:N,resetWords:v}){const w={...g,...N},C=void 0!==e&&a?/* @__PURE__ */s(n,{options:p.map(e=>({id:e,label:"full"===e?w.full:w.content,disabled:"full"===e&&u})),value:e,onChange:a,ariaLabel:w.label,disabled:b}):null;/* @__PURE__ */
15
- return s(l,{label:w.label,labelId:f,icon:/* @__PURE__ */s(c,{}),changed:t,hint:m,action:/* @__PURE__ */s(h,{words:v,label:w.label,changed:t,detail:o,onReset:r}),children:C&&i?/* @__PURE__ */d("div",{className:"es-width-stack",children:[C,i]}):C??i??null})}export{p as BACKGROUND_WIDTHS,N as DEFAULT_BACKGROUND_WIDTH_WORDS,g as DEFAULT_CONTENT_WIDTH_WORDS,f as SettingsAction,v as SettingsBackgroundWidth,w as SettingsContentWidth,h as SettingsDefaultReset,m as SettingsDrill,u as SettingsGroupHead,b as SettingsGroupSub};
@@ -1,64 +0,0 @@
1
- import{cloneNodeWithFreshIds as e}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as n}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as t}from"./chunk-DSKNJXB4.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-UMBNBCL4.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-DDH2DYQP.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-75C6WFNF.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as f,clampPanelWidth as m}from"./chunk-Y53EKN35.js";import{usePartBridge as g}from"./chunk-7RSE6KKY.js";import{useSectionOps as y}from"./chunk-OITNWE52.js";import{ScreenSaveIcon as v,ScreenMainButton as b}from"./chunk-55KKGABA.js";import{useBrowserOffline as k}from"./chunk-RKTF5XLP.js";import{AddChildRow as S}from"./chunk-5545A3PC.js";import{AddSidePanel as w}from"./chunk-CMPFUJ26.js";import{keepsSharedSections as x,sharedSectionsOf as z}from"./chunk-N3MJOHAG.js";import{PanelHideButton as C,SidePanelHead as N,PanelShowStrip as I}from"./chunk-5PXVT7JY.js";import{offeredChoices as O}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as B,useScreenNodeKeys as P,useScreenPinned as $,useScreenDocumentLabel as T,useScreenCanvasFrame as M,useScreenInspectorPanel as j,useScreenDevices as A,useScreenPickFollowsSelection as L,useScreenLeftView as E,SELECTION_MODE as R,isSelectionMode as F,sameInspectorMode as D,useScreenBridges as W,useScreenBlockRules as H,useScreenBlockLook as V,useScreenStorageNamespace as Y,useScreenNotify as U,useScreenCanvasHead as J,isSlotMode as X,useScreenStyleClipboard as K,useScreenDocumentPass as G,useScreenCanvasDrag as Q,ScreenCanvasTargetProvider as _,isPinnedFirst as Z,isPinnedLast as q,screenSlotsOf as ee,shownChildSlotsOf as ne}from"./chunk-QORC32JO.js";import{MediaPopup as te}from"./chunk-T2RINM7R.js";import{useNodeClipboard as oe,useNodeContextMenu as re}from"./chunk-G7ISR6DI.js";import{PageEditGuardNotices as ie}from"./chunk-FRAIEWRC.js";import{useScreenDocument as le}from"./chunk-K7MMLCTT.js";import{requestMediaPick as se}from"./chunk-3FIS2FRS.js";import{useMediaPanel as de,usePanelPick as ae,useMediaBrowsing as ce,useOpenMediaBrowse as pe,useMediaPlace as ue}from"./chunk-NCXYC7WI.js";import{useEaselSession as he}from"./chunk-YM4UEGBV.js";import{useEaselHost as fe,useHostEscape as me}from"./chunk-LX23TCTP.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-IYHO4XQX.js";import{heldStyle as be,styleShortcut as ke}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as Se}from"./chunk-6WY6ZXJG.js";import{rootRowName as we,slotChildRowName as xe,slotChildRenameProp as ze,sectionRenameProp as Ce}from"./chunk-5NHQ452C.js";import{ROOT_ZONE as Ne,blockNodeActions as Ie,TREE_MAX_DEPTH as Oe,childSlotsOf as Be,slotFieldsOf as Pe,newNodeId as $e,slotChildrenIn as Te,nestsInTree as Me}from"./chunk-TCAAOYQY.js";import{useEasel as je,useEaselApi as Ae,CanvasPartsContext as Le,partHasOwnBox as Ee,CanvasPassThroughContext as Re,CanvasSharedContext as Fe}from"./chunk-FJTCSQWK.js";import{TreeRow as De,Subtree as We,LayersTree as He,TreeGroupLabel as Ve,TreeRowAction as Ye,TreeSeam as Ue}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Je}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Xe}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ke,useNodeOps as Ge,clickPick as Qe}from"./chunk-RPMSET77.js";import{EaselTopBar as _e,EaselIconButton as Ze,TopBarCluster as qe,DeviceSwitch as en,InspectorIconButton as nn,PanelResizeHandle as tn,MAX_PANEL_W as on,MIN_PANEL_W_BY_SIDE as rn,panelWidthVars as ln}from"./chunk-WYTPBF3Q.js";import{DEFAULT_NOTICE_WORDS as sn,DEFAULT_CHROME_WORDS as dn}from"./chunk-AJSDWWJW.js";import{holderOf as an,nameOrSomeone as cn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as pn}from"./chunk-RE4LP46F.js";import{useWords as un}from"./chunk-MFIRYGHW.js";import{insertSeams as hn,CanvasDragLayer as fn,CanvasInsert as mn}from"./chunk-LN43DP2A.js";import{DEFAULT_DRAG_WORDS as gn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as yn,useTreeDrag as vn,gapToMoveIndex as bn}from"./chunk-6NJHYXJM.js";import{useCanvasFrame as kn,LIST_SELECTOR as Sn,BLOCK_SELECTOR as wn,useCanvasTyping as xn,useCanvasEvent as zn,nodeIdAt as Cn,frameRectToHost as Nn,BLOCK_ATTRIBUTE as In,drawnBox as On}from"./chunk-YU3WHLGI.js";import{queryMainCopy as Bn}from"./chunk-LF3FUSCQ.js";import{ROOT_ID as Pn,ROOT_SLOT as $n,zoneKey as Tn,parseZoneKey as Mn,find as jn,DataError as An}from"./chunk-TGZCD6IP.js";import{useRef as Ln,useMemo as En,useState as Rn,useEffect as Fn,useCallback as Dn,useLayoutEffect as Wn,useContext as Hn,Fragment as Vn,useId as Yn}from"react";import{ColoredBadge as Un,Button as Jn,Tabs as Xn,toast as Kn,readMediaFileDrag as Gn,Tooltip as Qn,groupColors as _n,Dialog as Zn,FormField as qn,Input as et,MEDIA_FILE_DRAG_TYPE as nt}from"efficient-shell/ui";import{UndoIcon as tt,RedoIcon as ot,RefreshIcon as rt,AddIcon as it,TrashIcon as lt,EyeOffIcon as st,EyeIcon as dt,SharedIcon as at,DuplicateIcon as ct}from"efficient-shell/icons/efficient";import{jsx as pt,jsxs as ut,Fragment as ht}from"react/jsx-runtime";var ft="media-file";function mt({name:e,onMake:n,onCancel:t}){const o=un("screen",ve).shared,[r,i]=Rn(e),[l,s]=Rn(!1),d=Yn(),a=Ln(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
2
- return pt(Zn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */ut(ht,{children:[
3
- /* @__PURE__ */pt(Jn,{variant:"secondary",onClick:t,children:o.cancel}),
4
- /* @__PURE__ */pt(Jn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */pt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */pt(qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */pt(et,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var gt=/* @__PURE__ */new WeakSet;function yt(e,n,t){const o=jn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function vt({canvas:e,tabs:n,onSelect:t}){const o=Ln(null),[r,i]=Rn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Wn(()=>{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=Nn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Bn(t,`[${In}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?On(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=Nn(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__ */pt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */pt("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__ */pt(Qn,{content:e.reach,children:/* @__PURE__ */ut(Un,{colorClass:_n("success","solid"),size:"sm",children:[
6
- /* @__PURE__ */pt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */pt(at,{size:12})}),e.label]})}):/* @__PURE__ */pt(Un,{colorClass:_n("info","solid"),size:"sm",children:e.label})},e.id):null})})}function bt({expand:e}){/* @__PURE__ */
7
- return pt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */ut(ht,e?{children:[
8
- /* @__PURE__ */pt("path",{d:"M8 9l4-4 4 4"}),
9
- /* @__PURE__ */pt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
10
- /* @__PURE__ */pt("path",{d:"M8 4l4 4 4-4"}),
11
- /* @__PURE__ */pt("path",{d:"M8 20l4-4 4 4"}),
12
- /* @__PURE__ */pt("path",{d:"M5 12h14"})]})})}var kt=`${Sn}, ${wn}`;function St(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 wt="__rungs";var xt="screen:band",zt={duplicate:!0,delete:!0},Ct=()=>null;function Nt(){const Sn=fe(),Nn=Sn.panels?.Toolbar,In=(Sn.panels?.useRight??Ct)(),{target:On,docId:Yn,capabilities:Qn,currentSlug:_n,siteId:Zn,onPublish:qn,saveState:et,saveConflict:at,retrySave:Nt,toggleAutoSave:It,flushSave:Ot,access:Bt,saveUnreachable:Pt=!1,readOnly:$t,readOnlyReason:Tt=null}=le(),Mt=B(),jt=P(),{mediaEditing:At,hasEditGuard:Lt,hasPinnedChrome:Et}=Qn,{appState:Rt,dispatch:Ft,history:Dt,selectedItem:Wt,getSelectorForId:Ht,config:Vt}=je(e=>e),Yt=$(),{first:Ut,firstGroup:Jt,lastGroup:Xt,isSectionGroup:Kt,sectionGroupZone:Gt,panelOf:Qt}=Yt,_t=Qt(Ut),Zt=e=>Z(Yt,e),qt=e=>q(Yt,e),eo="node"===Yt.firstRow,no=Yt.band??null,to=un("screen",ve),oo=un("tree",Je),ro=un("drag",gn),io=un("notice",sn),lo=un("lock",pn),so=un("menu",Xe),ao=un("styleClipboard",Se),co=un("chrome",dn),po=T()??`/${_n}`,uo=M(),ho=j(),fo=y({readOnly:$t}),mo=y({readOnly:$t,foldIntoHistory:!0}),go=Ln(null),yo=Ae(),vo=En(()=>({...fo,select:e=>{go.current=e,fo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=yo.config;go.current=Ke(e,t,n)}fo.commitDocument(e,n)}}),[fo,yo]),bo=Rt.ui,ko=bo.leftSideBarVisible,So=bo.rightSideBarVisible,{options:wo,widths:xo,initial:zo,fluid:Co,fit:No}=A(),[Io,Oo]=Rn(zo),Bo=de(),Po=At&&null!==Bo;ae(),ce();const $o=pe();L(Wt?.props.id);const{read:To,write:Mo,forSelection:jo}=E(),[Ao,Lo]=Rn(To);Fn(()=>{Mo(Ao)},[Ao]);const[Eo,Ro]=Rn(0),Fo=Ln(null),Do=Ln(null),Wo=kn(Do,{readySelector:kt}),Ho=xn(Wo),Vo=d(Do);a(Do,Wo);const Yo=k(),Uo=an(Bt),Jo={state:et,offline:Yo||et.failed&&Pt,readOnlyReason:Tt,editing:Uo?io.editing({name:cn(Uo.name,lo),noun:to.noun}):null,conflict:null!=at,notSaving:to.bar.notSaving},Xo=()=>{$t||(et.failed?Nt():Ot())};c(Do,Wo,Xo);const[Ko,Go]=Rn(!1),Qo=Ln(!1),[_o,Zo]=Rn(null),[qo,er]=Rn([]),[nr,tr]=Rn(R);F(nr);const or=o(nr,Wt?.props.id),[rr,ir]=Rn(null);Fn(()=>{rr&&(r(),ir(null))},[rr]);const lr=Ln(Ht);lr.current=Ht;const sr=Dn((e,{scroll:n})=>{Lo(n=>jo(e,n)),n&&ir(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=lr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Er(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),dr=Ln(null);Fn(()=>{const e=dr.current;dr.current=null;const n=null==Wt?.props.id?null:String(Wt.props.id);tr(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Qt(Wt?.type)??R);const t=Wt?.props.id,o=go.current;if(go.current=null,!t)return;const r=Ht(t);sr(String(t),{scroll:!i(o,r??null,Ne)})},[Wt?.props.id,sr]);const ar=Dn(e=>{tr(n=>D(n,e)?n:e),Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},[Ft]),cr=Ln(()=>{});cr.current=(e,n)=>{const t=e?Ti(e.zone??Ne)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Wt?.props.id?null:String(Wt.props.id);tr(e=>D(e,n)?e:n),o!==r&&(dr.current={id:o,mode:n},vo.select(e))};const pr=Dn((e,n)=>cr.current(e,n),[]),ur={kind:nr.kind,mode:nr,open:ar,show:e=>tr(e),reveal:()=>{So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},select:pr},hr=W(ur,{data:Rt.data,selected:Wt??null,zoneOf:e=>Ht(e)?.zone,readOnly:Boolean($t),select:e=>{tr(R),vo.select({index:e})},replace:(e,n)=>vo.replaceComponent(Ne,e,n),scrollTo:e=>l(e)},{device:Io,refreshes:Eo},{setView:Lo,reveal:()=>{ko||Ft({type:"setUi",ui:{leftSideBarVisible:!0}})}}),fr=hr.resolveLeftView?hr.resolveLeftView(Ao):"sections",mr=H(),{isLockedBlock:gr,duplicateBlocked:yr,nestDepth:vr,newSectionNode:br,canAddTo:kr,blockIsOffered:Sr}=mr,wr=e=>({id:String(e.props.id??""),data:Rt?.data}),xr=V(),{labelAtLevel:zr,Icon:Cr,useProducts:Nr}=xr,Ir=xr.rowName?(e,n,t)=>xr.rowName(e,n,t):void 0,Or=Dn(e=>{Ft({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),sr(e,{scroll:!0})},[Ft,sr]),{selectNode:Br,openPartId:Pr}=g({mode:nr,setMode:tr,onOpenPart:Or}),[$r,Tr]=Rn(null);me(null!==$r,()=>Tr(null));const Mr=h(Y()),jr=Mr.collapsed,Ar=Mr.panelWidths,[Lr,Er]=Rn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(jr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
- return new Set}});Fn(()=>{try{window.localStorage.setItem(jr,JSON.stringify([...Lr]))}catch{}},[Lr]);const[Rr,Fr]=Rn(()=>{if("undefined"==typeof window)return{...f};try{const e=window.localStorage.getItem(Ar);if(!e)return{...f};const n=JSON.parse(e);return{left:m(Number(n.left)||f.left,"left"),right:m(Number(n.right)||f.right,"right")}}catch{return{...f}}});Fn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Ar,JSON.stringify(Rr))}catch{}},300);return()=>clearTimeout(e)},[Rr]);const Dr=Dn((e,n)=>Fr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Wr=Dn(e=>Dr("left",e),[Dr]),Hr=Dn(e=>Dr("right",e),[Dr]),Vr=e=>Lr.has(e),Yr=e=>Er(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Ur=Ln(!1),Jr=Ln(null);Fn(()=>{if(Ur.current&&!Ko){const e=Jr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Do.current?.querySelector(`button[aria-label="${CSS.escape(to.add.title)}"]`))?.focus(),Jr.current=null}Ur.current=Ko},[Ko]),Fn(()=>{if(!Ko||!Vo)return;const e=e=>{"Escape"===e.key&&cl()};return Vo.addEventListener("keydown",e),()=>Vo.removeEventListener("keydown",e)},[Ko,Vo]),me(Ko,()=>cl()),Fn(()=>{!ko&&Ko&&(Go(!1),Zo(null),Qo.current=!1)},[ko]);const Xr=U(),Kr=(e,n="success",t)=>{if(Xr)return void(t?Xr(e,"error"===n?"error":"info",t):Xr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Kn.error(e,{...o,duration:t?.duration??3200}):Kn.success(e,{...o,duration:t?.duration??1900})},Gr=Ln(null),[Qr,_r]=Rn(0),[Zr,qr]=Rn(0),ei=J(),ni=Ln(null),ti=e=>Math.max(0,e.clientHeight-(ni.current?.offsetHeight??0));Fn(()=>{const e=Gr.current;if(!e)return;const n=()=>{_r(e.clientWidth),qr(ti(e))};n();const t=new ResizeObserver(n);return t.observe(e),ni.current&&t.observe(ni.current),()=>t.disconnect()},[]),Wn(()=>{Gr.current&&(_r(Gr.current.clientWidth),qr(ti(Gr.current)))},[Rr,ko,So]);const oi=Io===Co?Qr>0?Qr:xo[Co]:xo[Io],ri=Qr>0?Math.min(Qr/oi,"shrink"===No?1:2):1,ii=oi*ri,li=Qr>0&&ii>Qr+1,si={width:ii,height:Zr||"100%",flex:"none",position:"relative"},di={width:oi,height:Zr?Zr/ri:"100%",maxHeight:"none",transform:1!==ri?`scale(${ri})`:void 0,transformOrigin:"top left"},ai=()=>Ft({type:"setUi",ui:{leftSideBarVisible:!ko}}),ci=()=>Ft({type:"setUi",ui:{rightSideBarVisible:!So}}),pi=e=>{Ko&&(Go(!1),Zo(null),Qo.current=!1,ko&&Ao===e)||(Lo(e),ko||Ft({type:"setUi",ui:{leftSideBarVisible:!0}}))},ui=()=>{tr(_t??R),So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}})},hi=Rt.data.content??[],fi=()=>{const e=hi.findIndex(Zt),n=hi.findIndex(qt);return{floor:e>=0?e+1:0,cap:n>=0?n:hi.length}},mi=Vt,gi=mr.stripCopy,yi=n=>e(n,gi),vi=oe(),bi=Ge({data:Rt.data,config:mi,readOnly:Boolean($t),clipboard:vi,strip:gi?e=>gi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==Pn||e.slot!==$n)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&&tr(R);const t=void 0===n||"node"===n?.kind?n:null;vo.commitDocument(e,t)}}),ki=he(),[Si,wi]=Rn(null),xi=e=>{const n=hi.find(n=>String(n.props.id)===e),t=Yt.shared;n&&t&&bi.swap(e,t.detach(n))},zi=e=>{const n=jn(Rt.data,Vt,e);if(!n)return!1;const t=Tn(n.place),o=n.node,r=t===Ne?Bi(o):Vi(o),i=t===Ne?Yt.shared?.usedOn(o):null;return!!bi.remove(e)&&(Kr(i?to.shared.removed({count:Math.max(0,i.length-1)}):to.deleted({name:r}),"success",{duration:8e3,action:{label:to.bar.undo,onClick:()=>{bi.restore(n.node,n.place)}}}),!0)},Ci={...bi,remove:zi},Ni=e=>zr(e,"block",Vt.components[e]?.label??e),Ii=Dn(e=>Vt.components[e]?.defaultProps??{},[Vt]),Oi=e=>zr(e,"section",Ni(e)),Bi=e=>we({type:e.type,props:e.props??{}},Oi(e.type),Ir),{nodeAddresses:Pi,zoneItems:$i}=En(()=>{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>=Oe)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Be(Vt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(hi,Ne,0),{nodeAddresses:e,zoneItems:n}},[hi,Vt]),Ti=Dn(e=>$i.get(e)??[],[$i]),Mi=e=>{const n=Pi.get(e);return n?Ti(n.zone)[n.index]:void 0},ji=e=>ee(mr,Vt,e),Ai=e=>{if(!mr.slotsOf||e===Ne)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Mi(e.slice(0,n));if(!t)return null;const o=ji(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}},Li=(()=>{if(!X(nr))return null;const e=`${nr.nodeId}:${nr.slot}`;return Ai(e)?.slot.panel===nr.kind?e:null})(),Ei=Ln(null);Fn(()=>{const e=Ei.current;if(Ei.current=null,!Li||!X(nr))return;const n=nr.nodeId;sr(n,{scroll:e!==Li}),Er(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[nr]);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===Ne?ol(n.index):Pl(n.zone,n.index,e,Mi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Li!==i&&(Ei.current=i),pr(null,r),So||Ft({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Fi=(e,n,t)=>{const o=`${e}:${n}`;if(Er(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;Li!==o&&(Ei.current=o);pr(null,{kind:t,nodeId:e,slot:n})},Di=(e,n,t)=>{if($t||!mr.moveSlot)return;const o=Mi(e),r=o?ji(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:wt,index:n},s=bn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=mr.moveSlot(e,n,s);"string"==typeof d&&Fi(e,d,i.panel)},Wi=Nr(),Hi=En(()=>{const e=/* @__PURE__ */new Map;for(const n of Wi??[])e.set(n.slug,n.name);return e},[Wi]),Vi=e=>xe(e,Ni,xr.plainText,e=>Hi.get(e),xr.rowName),Yi=(e,n)=>{const t=Vt.components[e.type]?.fields,o=n===Ne||ts(n)?"section":"block",r=n===Ne&&(Zt(e)||qt(e)||Kt(e.type)),i="block"===o?ze(t):r?null:Ce(t);return xr.renamePropOf?xr.renamePropOf(e,o,i):i},Ui=(e,n,t,o)=>{if(!(!$t&&$r?.zone===e&&$r.index===n))return;const r=(t,o)=>{Tr(null),o&&((e,n,t)=>{const o=Ti(e)[n];if(!o)return;const r=Yi(o,e);r&&vo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
- return pt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":to.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)},Ji=t(K(),ao),Xi=Ji.scope({target:On,siteId:Zn,docId:Yn}),Ki=Vt,Gi=(e,n)=>n===Ne?Oi(e):Ni(e),Qi=(e,n,t)=>{const o=Ji.plan(Xi,t,Gi(t.type,e),Ki);o&&(o.changed&&vo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Kr(o.message))},_i=re({nodesIn:Ti,nodeAt:(e,n)=>Ti(e)[n]??null,labelOf:(e,n)=>n===Ne?Oi(e):Ni(e),renamePropOf:Yi,beginRename:(e,n)=>Tr({zone:e,index:n}),history:{hasPast:Dt.hasPast,hasFuture:Dt.hasFuture,back:()=>Dt.back(),forward:()=>Dt.forward()},openPageStyles:hr.openPageStyles,pageStylesLabel:to.pageStyles,words:{menu:so,styleClipboard:ao,screen:to.menu},readOnly:Boolean($t),collapseAll:()=>Er(new Set(Ti(Ne).map(e=>String(e.props.id)))),onPasteRefused:e=>Kr(e?to.pasteRefused({name:e.label}):to.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>is(e,n),menuRows:(e,n,t)=>{const o=hr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Yt.shared;if(!t||n!==Ne)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:to.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return $t||gr(e.type,e)?n:{...n,change:[{label:to.shared.detach,onClick:()=>xi(e.props.id)}],remove:[{label:to.shared.removeFromPage,danger:!0,onClick:()=>{zi(e.props.id)}}]}}return $t||Zt(e)||qt(e)||Kt(e.type)?null:x(ki)?{change:[{label:to.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=>gr(e.type,e),duplicateBlocked:e=>yr(Rt.data,e),permits:e=>{const n=Ie(Vt,e.type);return Yt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:Ci,isPinned:(e,n)=>n===Ne&&(Zt(e)||qt(e)),sectionBand:fi,locate:e=>Pi.get(e)??null,rowNameOf:(e,n)=>n===Ne?Bi(e):Vi(e),selectAt:(e,n,t,o)=>{e===Ne?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:()=>be(Xi),canCopy:e=>Ji.rows(Ki,e).some(e=>!1!==e.counted),copy:(e,n)=>Ji.copy(Xi,e,Gi(e.type,n),Ki),paste:(e,n,t)=>Qi(e,n,t)},keys:jt?{target:Vo,selected:()=>{const e=Rt.ui.itemSelector;return e?{zone:e.zone??Ne,index:e.index}:null},held:()=>vi.get(),readOnly:Boolean($t),onDone:({done:e,name:n})=>{"copied"===e&&Kr(to.copied({name:n}))}}:void 0},Wo),Zi=Ln({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Fn(()=>{Zi.current={copy:(e,n)=>Ji.copy(Xi,e,Gi(e.type,n),Ki),paste:Qi,at:()=>{const e=Rt.ui.itemSelector;if(!e)return null;const n=e.zone??Ne,t=Ti(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean($t)}});const qi=Dn(e=>{const n=ke(e);if(!n)return;const t=Zi.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))},[]);Fn(()=>{if(!Vo)return;const e=e=>qi(e);return Vo.addEventListener("keydown",e),()=>Vo.removeEventListener("keydown",e)},[qi,Vo]),zn(Wo,"keydown",qi);const el=hi.map(e=>e.props.id).join("|");Fn(()=>{const e=Wo?.document??null,n=Wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void er(e=>e.length?[]:e);const n=hi.findIndex(qt),t=n>=0?n:hi.length,o=n=>{const t=hi[n]?.props?.id;return null==t?null:Bn(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(wn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=hi.length>0&&!Zt(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=St(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})}er(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Wo,el,Io,ri,ko,So,Wt?.props.id]);const nl=Wo?.document??null,tl=Wo?.window??null;Fn(()=>{const e=Fo.current;if(!e||!nl||!tl)return;const n=[],t=()=>{const n=Bn(nl,`[data-easel-block="${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 Fo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[nl,tl]);const ol=e=>{tr(R),vo.select({index:e}),hr.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=Wt&&nr.kind!==_t?.kind?hi.findIndex(e=>e.props.id===Wt.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}:(vo.reorderComponent(Ne,e,i),vo.select({index:i}),{moved:!0,dest:i})},ll=(e,n,t,o)=>{tr(R),vo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Kr(to.sectionAdded({name:t}))},sl=(e,n)=>{const t=rl(n),o=br(e,{nodeDefaults:Ii,newNodeId:$e,sectionLabel:Oi,blockIsOffered:Sr}),r=o?vo.insertNode(Ne,t,o):vo.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 Be(Vt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=kr(e.type,l,d.slice(d.lastIndexOf(":")+1),wr(e)),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(Ne,e),al=(e,n)=>{Jr.current=document.activeElement??null,Zo(null===n?null:{zone:e,index:n}),Go(!0),ko||(Qo.current=!0,Ft({type:"setUi",ui:{leftSideBarVisible:!0}}))},cl=()=>{Go(!1),Zo(null),Qo.current&&Ft({type:"setUi",ui:{leftSideBarVisible:!1}}),Qo.current=!1},pl=(e,n)=>xr.rowName?n?Zt(e)?xr.rowName(e,"section",to.header):qt(e)?xr.rowName(e,"section",to.footer):Kt(e.type)?xr.rowName(e,"section",Ni(e.type)):Bi(e):Vi(e):n?Oi(e.type):Ni(e.type),ul=e=>n=>{e()},hl=(e,n,t)=>{if($t)return null;const o=Ti(e)[n];return o&&!Ie(Vt,o.type).delete||o&&gr(o.type,o)?null:/* @__PURE__ */pt(Ye,{kind:"delete",label:e===Ne&&o&&Yt.shared?.usedOn(o)?to.shared.removeFromPage:to.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Ti(e)[n]?.props?.id;null!=t&&zi(String(t))})(e,n),children:/* @__PURE__ */pt(lt,{size:15})})},fl=e=>xr.rowPreview?.(e)||void 0,ml=e=>xr.rowMarks?.(e)??void 0,gl=(e,n,t)=>xr.rowActions?.(e,n,t)??null,yl=(e,n,t,o)=>{if($t)return null;if(gr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
- return pt(Ye,{kind:"eye",label:r?to.showNamed({name:o}):to.hideNamed({name:o}),onClick:()=>bl(e,n,t),children:/* @__PURE__ */pt(r?st:dt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},vl=e=>Qs(Ne,e),bl=(e,n,t)=>{vo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},kl=e=>Pe(Vt,e),Sl=e=>Be(Vt,e),wl=e=>mr.slotsOf?ji(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Te(e,n.slot)})):[{slot:null,rung:null,kids:ne(Vt,e)}],xl=e=>mr.slotsOf?wl(e).flatMap(e=>e.kids):ne(Vt,e),zl=e=>Boolean(mr.slotsOf)&&ji(e).some(e=>e.rung),Cl=(e,n,t)=>kr(e.type,n,t??void 0,wr(e)),Nl=(e,n,t)=>{const o=Me(Vt,e.type,n)&&(t||xl(e).length>0||zl(e));return{collapsible:o,folded:o&&Vr(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(tr(R),kr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),vo.select({index:n,zone:e}),l(t)}else vo.select({index:n,zone:e}),l(t)},$l=(e,n,t,o,r)=>{const i=`${e}:${n}`;vo.insertComponent(i,t,o),kr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),vo.select({index:o,zone:i})}):vo.select({index:o,zone:i})},Tl=Ln(/* @__PURE__ */new Set);Fn(()=>{hi.forEach(e=>{const n=kr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Tl.current.has(t))return;Tl.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)=>mo.seedChild(o,t,n.childType,e))})},[hi,mo,Ii]);const Ml=Ln(/* @__PURE__ */new Set);Fn(()=>{hi.forEach((e,t)=>{const o=e.props.id;if(Ml.current.has(o))return;const r=n(e,kl(e.type));Ml.current.add(o),r&&mo.replaceComponent(Ne,t,{...e,props:r})})},[hi,mo]),G(mo,Vt);const jl=hi.findIndex(qt),Al=jl>=0?hi[jl]:null,Ll=eo?hi.findIndex(Zt):-1,El=Ll>=0?hi[Ll]:null,Rl=Yt.groupTab,Fl=En(()=>Rl?e=>Kt(e.type):void 0,[Rl]),Dl=Boolean(Yt.groupBadge),Wl=Yt.sharedReach,Hl=e=>Wl?.(e)??void 0,Vl=En(()=>Wl?new Set(hi.filter(e=>Hl(e)).map(e=>String(e.props.id))):null,[hi,Wl]),Yl=En(()=>Vl?e=>Vl.has(e):void 0,[Vl]),Ul=Yt.first?Wl?.({type:Yt.first,props:{id:""}})??void 0:void 0,Jl=Yt.groupBadge?/* @__PURE__ */pt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */pt(Un,{tone:"info",size:"xs",children:Yt.groupBadge})}):void 0,Xl=hi.find(e=>e.type===Jt)??null,Kl=hi.find(e=>e.type===Xt)??null,Gl=jl>=0?jl:hi.length,Ql=[];hi.forEach(e=>{qt(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 _l=Ql.length>0&&Ql.every(e=>Lr.has(e)),Zl=e=>{const n=xr.blockRowName(e,Ni);return xr.rowName?xr.rowName(e,"block",n):n},ql=(e,n,t,o)=>{const r=Ti(e)[t];if(!r)return;const i={...Mn(e),index:t},l={...Mn(n),index:Math.min(Math.max(o,0),Ti(n).length)},s=bn(i,l);if(e!==n||s!==t)try{bi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof An))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 kl(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===Ne)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=>Kt(e.type)&&String(e.props.id)===n);return t&&Gt(n)===e?t:null},os=(e,n)=>{const t=ts(e);return!t||(!Yt.groupAccepts||Yt.groupAccepts(t.type,n,Ti(e).length))},rs=(e,n,t)=>{if(e.rung){const t=Mi(e.rung.nodeId),o=t?ji(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===wt&&n.index>=0&&n.index<=o}if(n.slot===wt)return!1;if(e.add)return ds(e.add,n);const o=Tn(n);if(Kt(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<=Ti(o).length));if(e.zone===Ne||o===Ne){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>Ti(o).length)return!1;if(e.zone===o)return!0;const l=Al&&!Yt.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??Ti(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Pi.get(i),s=l?Ti(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&es(r).has(n))return!1;const d=kr(s.type,vr(Rt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1),wr(s));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Ti(n),r))})(e.zone,o,e.index,t)},is=(e,n)=>{const t=Tn(e.from),o=e.node;return t===Tn(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?Ti(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=kr(o.type,vr(Rt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1),wr(o));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===Ne)}},ss=(e,n)=>{if("section"!==e.kind)return e;const t=Tn(n);return t===Ne||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=Tn(n);if("shared"===t.kind){if(o!==Ne||!Yt.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<=Ti(o).length}if(o!==Ne)return!1;const{floor:e,cap:r}=fi();return n.index>=e&&n.index<=r}if(o===Ne)return!1;const r=ls(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Ti(o))},as=(e,n)=>{const t=ss(e,n);if("block"!==t.kind&&ts(Tn(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)vo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;vo.insertNode(n,t,yi(e.template.node))}tr(R),vo.select({index:t,zone:n})}})(t,Tn(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=vo.insertNode(Ne,o,n);ll(o,r,e)})(t.template.name,yi(t.template.node),n.index);if("shared"===t.kind){const e=Yt.shared?.nodeOf(t.section);if(!e)return;const o=rl(n.index);return void(bi.restore(e,{parentId:Pn,slot:$n,index:o})&&ll(o,e.props.id,t.section.title))}const o=Tn(n),r=ls(o);r&&(r.target.spec?$l(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{vo.insertComponent(e,n,t),tr(R),vo.select({index:t,zone:e})})(o,t.type,n.index))},cs=(e,n)=>{e.media?function(e){const n=Us();if(!n||!Hs)return;Xs(n).then(n=>{n&&function(e,n){if(!Hs)return;const t=Hs.create(e,{nodeDefaults:Ii,newNodeId:$e,sectionLabel:Oi,blockIsOffered:Sr}),o=Tn(n);if(o===Ne){const e=rl(n.index),o=vo.insertNode(Ne,e,t);return void ll(e,o,Oi(t.type))}vo.insertNode(o,n.index,t),tr(R),vo.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===Ne?il(e.index,n.index):ql(e.zone,Tn(n),e.index,n.index)},[ps]=Rn(()=>yn()),us=vn({keyOf:e=>e.id,readOnly:Boolean($t),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===Ne?((e,n)=>{const t=Oi(hi[e]?.type??""),o=il(e,n<0?e-1:e+2);if(!o.moved)return void Kr(n<0?to.sectionFirst({name:t}):to.sectionLast({name:t}));const{floor:r,cap:i}=fi();Kr(to.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=Dn(e=>{const{floor:n,cap:t}=fi(),o=[];for(const r of e.nodes){const e=Tn(r.place),i=Ti(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Zt(i)||qt(i)||gr(i.type,i))continue;if(Kt(i.type))continue;const l=Boolean(ts(e)),s=e===Ne||l;e===Ne&&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):Vi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Tn(e.list);if(n===Ne&&0===e.children.length)return[{...e,addLabel:to.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=Tn(e.list),t=n===Ne||ts(n)?null:ls(n);return t?.choices.length?hn(e,t.target.spec?.addLabel??to.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Rt.data]),fs=null==Wt?.props.id?null:String(Wt.props.id),ms=Hn(Le),gs=ms?.selected()&&Wo?.document&&fs?ms.selectedPart?.(Wo.document)??null:null,ys=gs&&fs&&Ee(Rt.data,Vt,fs,gs)?gs:null,vs=ys?.label?{element:ys.element,label:ys.label}:null,bs=null!==ys,ks=Dn(e=>{const n=Vt,t=e=>!e.item.rung&&null!==jn(Rt.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?bs?null:i:r(Qe(Rt.data,n,o.item.id,fs,Fl))??o},[Rt.data,Vt,fs,Fl,bs]),[Ss,ws]=Rn(null),xs=Boolean(Rl||Wl);zn(Wo,"mouseover",e=>{if(!xs)return;const n=Cn(e.target),t=n?yt(Rt.data,Vt,n):null;t!==Ss&&ws(t)}),zn(Wo,"mouseout",e=>{xs&&!e.relatedTarget&&ws(null)});const zs=e=>Zt(e)||qt(e)||Kt(e.type),Cs=e=>{const n=Kt(e.type)?Ni(e.type):Zt(e)?to.header:qt(e)?to.footer:null;return null===n?Bi(e):xr.rowName?xr.rowName(e,"section",n):n},Ns=[];if(xs){const e=fs?yt(Rt.data,Vt,fs):null;for(const n of/* @__PURE__ */new Set([e,Ss])){const e=n?hi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Zt(e)||e.type===Jt,o=Hl(e);if(o){Ns.push({id:String(e.props.id),label:Cs(e),below:t,reach:o});continue}if(!Rl||!zs(e))continue;const r=Rl(e);r&&Ns.push({id:String(e.props.id),label:r,below:t})}}const Is=he(),Os=Ln(null);Fn(()=>{const e=Yt.changeNotice;if(!e)return;const n=JSON.stringify(hi.filter(zs)),t=Os.current;if(Os.current={doc:Yn,bands:n,index:Dt.index},!t||t.doc!==Yn||t.bands===n)return;Dt.hasPast&&Dt.index>=t.index&&!gt.has(Is)&&(gt.add(Is),Kr(e,"success",{action:{label:to.bar.undo,onClick:()=>Dt.back()},duration:8e3}))},[hi]);const Bs=e=>{tr(R),vo.select(e.zone===Ne?{index:e.index}:{index:e.index,zone:e.zone})},Ps=Q(),$s=()=>({data:Rt.data,device:Io,ops:vo,inspector:ur}),Ts=Ps?.model,Ms=En(()=>Ts?e=>Ts(e,hs(e),$s()):hs,[Ts,hs,Io]),js=Ps?.measure,As=js?(e,n)=>js(e,n,$s()):void 0,Ls=Ps?.canDrop,Es=Ls?(e,n)=>Ls(e,n,rs,$s()):rs,Rs=Ps?.drop,Fs=Rs?(e,n)=>Rs(e,n,cs,$s()):cs,Ds=Ps?.pick,Ws=Ds?e=>Ds(e,Bs,$s()):Bs,Hs=Ps?.media??null,Vs=Ln(null),Ys=En(()=>Hs?{id:ft,zone:"",index:-1,type:Hs.adds.type,add:{kind:Hs.adds.kind,type:Hs.adds.type},media:!0}:null,[Hs]);Fn(()=>{if(!Ys||$t||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(nt))(e)&&(Vs.current=null,ps.start({key:ft,item:Ys}))},n=e=>{ps.get()?.item.media&&(Vs.current=Gn(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)}},[Ys,$t,ps]);const Us=()=>{const e=Vs.current;return Vs.current=null,e},Js=ue(),Xs=async e=>{if(!Js)return e;const n=await Js(e);return n?{...e,id:n.id,url:n.url}:null};const Ks=(e,n)=>{if(!Hs)return;const t=jn(yo.getState().appState.data,mi,n);if(!t)return;const o=t.node;vo.replaceComponent(Tn(t.place),t.place.index,{...o,props:{...Hs.replace(o,e),id:o.props.id}})},Gs=e=>{const n=Tn(e),t=Ai(n);t&&Ri(t.node,t.slot,!1),al(n,e.index)},Qs=(e,n)=>/* @__PURE__ */pt(Ue,{...$t?{}:us.seam({place:{...Mn(e),index:n}})},`seam:${e}:${n}`),_s={rowClick:ul,isCollapsed:Vr,toggleCollapse:Yr},Zs=e=>{const n=String(e.props.id),t=hi.findIndex(e=>String(e.props.id)===n),o=Gt(n),r=Ti(o),i=Vr(n),l=Ni(e.type),s=xr.rowName?xr.rowName(e,"section",l):l,d=e=>Qs(o,e);/* @__PURE__ */
16
- return ut(ht,{children:[
17
- /* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(Cr,{type:e.type,size:13}),name:s,preview:fl(e),marks:ml(e),onSelect:()=>ol(t),nameSlot:Ui(Ne,t,n,s),selected:or===n,badge:Hl(e)?void 0:Jl,shared:Hl(e),actions:gl(e,Ne,t)??void 0,rowProps:{"data-node-id":n,onClick:ul(()=>ol(t))},fold:{open:!i,label:"section",onToggle:()=>Yr(n)}}),!i&&/* @__PURE__ */ut(We,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Bi(n),l=Ol(n),s=l&&Vr(r),a=()=>Pl(o,t,r,e.type),{rowProps:c,...p}=us.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Mn(o),index:t}},{"data-node-id":r,onClick:ul(a)});/* @__PURE__ */
18
- return ut(Vn,{children:[d(t),
19
- /* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(Cr,{type:n.type,size:13}),name:i,preview:fl(n),marks:ml(n),onSelect:a,nameSlot:Ui(o,t,r,i),selected:or===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Yr(r)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[hl(o,t,i),gl(n,o,t),yl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */pt(We,{children:nd(n,2)})]},r)}),d(r.length)]})]})},qs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=us.dragging,d=!Vr(l)&&s?.rung?.nodeId!==i,a={...Mn(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}:${wt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:wt,index:t},into:c,canDrag:Boolean(mr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:ul(p)}),f=$t?null:mr.slotActions?.(e,n.slot);/* @__PURE__ */
20
- return ut(Vn,{children:[n.heading,
21
- /* @__PURE__ */pt(De,{words:oo,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Li===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Yr(l)},actions:f&&f.length>0?/* @__PURE__ */pt(ht,{children:f.map((t,o)=>/* @__PURE__ */pt(Ye,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if($t||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__ */pt(lt,{size:15}):/* @__PURE__ */pt(ct,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */pt(We,{children:r})]},l)},ed=(e,n)=>{const t=wl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
- return pt(ht,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Cl(e,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)=>Qs(e,n),p=/* @__PURE__ */ut(ht,{children:[i.map(({child:n,zone:t,index:o})=>{const r=or===String(n.props.id),{collapsible:i,folded:s}=Nl(n,l,Bl(n.type)),d=String(n.props.id),a=Zl(n),p=()=>Pl(t,o,d,e.type),{rowProps:u,...h}=us.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Mn(t),index:o}},{"data-node-id":d,onClick:ul(p)});/* @__PURE__ */
23
- return ut(Vn,{children:[0===o&&c(t,0),
24
- /* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(Cr,{type:n.type,size:13}),name:a,preview:fl(n),marks:ml(n),onSelect:p,nameSlot:Ui(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>Yr(d)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[hl(t,o,a),gl(n,t,o),yl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */pt(We,{children:ed(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?qs(e,t.rung,r++,o,p):/* @__PURE__ */pt(Vn,{children:p},t.slot??"")})})},nd=(e,n)=>{const t=vr(Rt?.data,e.type,String(e.props.id)),o=wl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
- return pt(ht,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Cl(e,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)=>Qs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */ut(ht,{children:[l.map(({child:n,zone:t,index:o})=>{const r=or===String(n.props.id),i=Vi(n),l=String(n.props.id),{collapsible:d,folded:a}=Nl(n,s,Bl(n.type)),c=kl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Mn(p),index:Ti(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:{...Mn(t),index:o},into:f,canDrag:!gr(n.type,n)},{"data-node-id":l,onClick:ul(g)});/* @__PURE__ */
26
- return ut(Vn,{children:[0===o&&m(t,0),
27
- /* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(Cr,{type:n.type,size:13}),name:i,preview:fl(n),marks:ml(n),onSelect:g,nameSlot:Ui(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Yr(l)}:void 0,actions:gr(n.type,n)?gl(n,t,o)??void 0:/* @__PURE__ */ut(ht,{children:[hl(t,o,i),gl(n,t,o),yl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */pt(We,{children:nd(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
- /* @__PURE__ */pt(S,{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?qs(e,o.rung,i++,r,v):/* @__PURE__ */pt(Vn,{children:v},o.slot??"")})})},td=Ko,od=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:ko&&!td&&fr===e.id,onSelect:()=>pi(e.id)}:e,rd=[...(hr.railLead??[]).map(od),{id:"sections",label:to.layers,icon:/* @__PURE__ */pt(ge,{}),active:ko&&!td&&"sections"===fr,onSelect:()=>pi("sections")},...(hr.railTrail??[]).map(od)],id=Po?{onPress:$o}:At?{onPress:()=>{se(Sn,{accept:"image/*",title:co.mediaLibrary})}}:null,ld={value:rd.find(e=>!0===e.active)?.id??"",press:e=>{const n=rd.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:rd.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */pt("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},sd=[...hr.railLead??[],...hr.railTrail??[]].find(e=>"panel"in e&&e.id===fr),dd=Boolean(no?.foldable),ad=no?.label??(Lt?to.pageSections:to.templateSections),cd=dd&&Vr(xt),pd=/* @__PURE__ */ut(ht,{children:[hi.map((e,n)=>{if(Zt(e)||qt(e)||Kt(e.type))return null;const t=or===String(e.props.id),o=Boolean(e.props._hidden);Sl(e);const r=String(e.props.id),i=hr.hasOwnRows?.(e)??!1,l=Ol(e)||i,s=l&&Vr(r),d=kl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Mn(a),index:Ti(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:Ne,index:n,type:e.type},place:{...Mn(Ne),index:n},into:u,canDrag:!gr(e.type,e)},{"data-node-id":r,onClick:ul(()=>ol(n))});/* @__PURE__ */
29
- return ut(Vn,{children:[n>0&&vl(n),
30
- /* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(Cr,{type:e.type,size:13}),name:Bi(e),preview:fl(e),marks:ml(e),shared:Hl(e),onSelect:()=>ol(n),nameSlot:Ui(Ne,n,r,Bi(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>Yr(r)}:void 0,actions:/* @__PURE__ */ut(ht,{children:[hl(Ne,n,Bi(e)),gl(e,Ne,n),yl(Ne,n,e,Bi(e))]}),rowProps:h}),Ol(e)&&!s&&/* @__PURE__ */ut(We,{children:[nd(e,1),hr.partRows?.(e,_s)]}),i&&!s&&/* @__PURE__ */pt(We,{children:hr.ownRows?.(e,n,_s)})]},String(e.props.id??n))}),Gl>0&&vl(Gl)]}),ud=(e,n,t)=>{const o=String(e.props.id),r=xl(e).length>0||zl(e)||Boolean(kr(e.type)),i=r&&Vr(o),l="header"===t?to.header:to.footer,s=xr.rowName?xr.rowName(e,"section",l):l;/* @__PURE__ */
31
- return ut(ht,{children:[
32
- /* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(Cr,{type:t,size:13}),name:s,preview:fl(e),marks:ml(e),badge:Hl(e)?void 0:Jl,shared:Hl(e),onSelect:()=>ol(n),nameSlot:Ui(Ne,n,o,s),selected:or===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Yr(o)}:void 0,actions:gl(e,Ne,n)??void 0,rowProps:{"data-node-id":o,onClick:ul(()=>ol(n))}}),r&&!i&&/* @__PURE__ */pt(We,{children:ed(e,1)})]})};return(hr.wrap??(e=>e))(
33
- /* @__PURE__ */pt(_,{target:Wo,children:/* @__PURE__ */ut("div",{ref:Do,className:"sf-editor es-editor",style:ln(Rr),onContextMenu:_i.onEditorContextMenu,...p(Sn),children:[
34
- /* @__PURE__ */ut(_e,{children:[
35
- /* @__PURE__ */ut("div",{className:"es-cluster es-cluster--left",children:[id?/* @__PURE__ */pt(Jn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */pt(ye,{}),onClick:id.onPress,children:to.railMedia}):null,
36
- /* @__PURE__ */pt(Ze,{label:to.bar.undo,disabled:Boolean($t)||!Dt.hasPast,onClick:()=>Dt.back(),children:/* @__PURE__ */pt(tt,{})}),
37
- /* @__PURE__ */pt(Ze,{label:to.bar.redo,disabled:Boolean($t)||!Dt.hasFuture,onClick:()=>Dt.forward(),children:/* @__PURE__ */pt(ot,{})})]}),
38
- /* @__PURE__ */ut(qe,{children:[
39
- /* @__PURE__ */pt(en,{devices:wo,value:Io,onChange:Oo}),
40
- /* @__PURE__ */pt(Ze,{label:to.bar.refresh,tip:to.bar.refreshTip,onClick:()=>{Fo.current=(()=>{const e=Wo?.document;if(!e)return null;const n=hi.findIndex(qt),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=Bn(e,`[data-easel-block="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Wt?.props?.id??hi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Ro(e=>e+1)},children:/* @__PURE__ */pt(rt,{})}),hr.barView?.()]}),
41
- /* @__PURE__ */ut(qe,{kind:"right",style:{minWidth:300},children:[
42
- /* @__PURE__ */pt(v,{input:Jo,words:to.saveStatus}),Nn?/* @__PURE__ */pt(Nn,{}):null,hr.barLead?.(),hr.barTrail?.(),hr.mainAction||!hr.barMain?/* @__PURE__ */pt(b,{input:Jo,action:hr.mainAction??{label:to.done,onPress:()=>{qn(Rt.data)}},readOnly:Boolean($t),saveSwitch:Mt,onToggleAutoSave:It,onSaveNow:Xo,bar:to.bar,words:to.saveStatus}):hr.barMain()]})]}),
43
- /* @__PURE__ */pt(ie,{}),
44
- /* @__PURE__ */ut("div",{className:"sf-body",children:[ko?/* @__PURE__ */ut(ht,{children:[
45
- /* @__PURE__ */ut("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":to.leftPanel,children:[
46
- /* @__PURE__ */ut("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
47
- /* @__PURE__ */pt(C,{side:"left",onHide:ai}),
48
- /* @__PURE__ */pt("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
49
- /* @__PURE__ */pt(Xn,{variant:"underline",block:!0,"aria-label":to.bar.views,value:ld.value,onChange:ld.press,items:ld.items})]}),Ko?/* @__PURE__ */pt(w,{at:_o?{label:(e=>{const n=ts(e.zone);if(n)return to.add.addingTo({name:xr.rowName?pl(n,!0):Ni(n.type)});if(e.zone===Ne){const n=hi[e.index];return n&&!qt(n)?to.add.addingBefore({name:pl(n,!0)}):to.add.addingAtEnd}const t=ls(e.zone);return t?to.add.addingTo({name:t.parentName}):to.add.addingHere})(_o),onClear:()=>Zo(null)}:void 0,placeBlocks:_o&&_o.zone!==Ne?ls(_o.zone)?.choices:void 0,canTake:_o?e=>{if(!_o)return null;const n={...Mn(_o.zone),index:_o.index};if(ds(e,n))return null;if("shared"===e.kind&&_o.zone===Ne&&!Yt.shared?.nodeOf(e.section))return to.shared.alreadyHere;const t=ts(_o.zone);if(t)return to.add.notInside({name:pl(t,!0)});if(_o.zone===Ne)return to.add.onlySections;const o=ls(_o.zone);return o?to.add.notInside({name:o.parentName}):to.add.onlySections}:void 0,onPick:_o?e=>{if(!_o)return;const n={...Mn(_o.zone),index:_o.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:hr.addPanelRow?.(cl),onClose:cl,readOnly:Boolean($t)}):sd?sd.panel({onHide:ai,notify:Kr}):/* @__PURE__ */ut(ht,{children:[
50
- /* @__PURE__ */pt(N,{icon:/* @__PURE__ */pt(ge,{}),title:to.layers,context:po,actions:/* @__PURE__ */ut(ht,{children:[!$t&&/* @__PURE__ */pt(nn,{label:to.add.title,onClick:()=>dl(null),children:/* @__PURE__ */pt(it,{size:15})}),
51
- /* @__PURE__ */pt(nn,{label:_l?to.expandAll:to.collapseAll,title:0===Ql.length?to.nothingToFold:void 0,disabled:0===Ql.length,onClick:()=>Er(e=>{const n=new Set(Ql);return _l?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Ql])}),children:/* @__PURE__ */pt(bt,{expand:_l})})]})}),
52
- /* @__PURE__ */ut(He,{className:"sf-tree sf-scroll",words:oo,children:[Xl&&/* @__PURE__ */ut(ht,{children:[!Dl&&/* @__PURE__ */pt(Ve,{children:to.header}),Zs(Xl)]}),Et&&!(Dl&&Xl)&&/* @__PURE__ */ut(ht,{children:[!Dl&&/* @__PURE__ */pt(Ve,{children:to.header}),!eo&&/* @__PURE__ */pt(De,{words:oo,icon:/* @__PURE__ */pt(Cr,{type:"header",size:13}),name:to.header,badge:Ul?void 0:Jl,shared:Ul,onSelect:ui,selected:nr.kind===_t?.kind,rowProps:{onClick:ul(ui)}})]}),El&&!(Dl&&Xl)&&ud(El,Ll,"header"),!dd&&/* @__PURE__ */pt(Ve,{children:ad}),dd?/* @__PURE__ */ut(ht,{children:[
53
- /* @__PURE__ */pt(De,{words:oo,icon:null,name:ad,fold:{open:!cd,label:ad,onToggle:()=>Yr(xt)}}),!cd&&/* @__PURE__ */pt(We,{children:pd})]}):pd,Et&&!Dl&&/* @__PURE__ */pt(Ve,{children:to.footer}),Al&&!(Dl&&Kl)&&ud(Al,jl,"footer"),Kl&&Zs(Kl),hr.treeFoot?.()]})]})]}),
54
- /* @__PURE__ */pt(tn,{side:"left",width:Rr.left,min:rn.left,max:on,defaultWidth:f.left,label:to.resizeLeftPanel,onResize:Wr})]}):/* @__PURE__ */pt(I,{side:"left",onShow:ai}),
55
- /* @__PURE__ */ut("div",{ref:Gr,className:"sf-center sf-scroll","data-sf-canvas-head":ei?"":void 0,style:{overflowX:li?"auto":"hidden",overflowY:"hidden"},children:[ei&&/* @__PURE__ */pt("div",{ref:ni,className:"sf-canvas-head",children:/* @__PURE__ */pt(ei,{device:Io})}),
56
- /* @__PURE__ */ut("div",{className:"sf-frame-scaler",style:si,children:[
57
- /* @__PURE__ */pt("div",{className:"sf-frame "+(Io===Co?"":`sf-frame--${Io}`),style:di,children:/* @__PURE__ */ut("div",{className:"sf-preview-host",children:[
58
- /* @__PURE__ */pt(Re.Provider,{value:Fl,children:/* @__PURE__ */pt(Fe.Provider,{value:Yl,children:/* @__PURE__ */pt(uo,{},Eo)})}),
59
- /* @__PURE__ */pt(fn,{canvas:Wo,session:ps,model:Ms,measure:As,canDrop:Es,onDrop:Fs,choose:ks,tag:vs,onPick:Ws,dropOn:Hs?{accepts:(e,n)=>{if(!e.media||!Hs||n.item.rung)return!1;const t=jn(Rt.data,mi,n.item.id);return null!==t&&Hs.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Us();n&&Hs&&Xs(n).then(n=>{n&&Ks(n,e.item.id)})})(n),label:()=>to.canvasReplaceImage}:void 0,onZoneAdd:Gs,onSeamAdd:Gs,zoneAddLabel:to.canvasAddBlock,words:ro.canvas,readOnly:Boolean($t),revision:Rt.data}),qo.length>0&&!Ho&&/* @__PURE__ */pt("div",{className:"sf-preview-gaps",children:qo.map(e=>
60
- /* @__PURE__ */pt(mn,{index:e.index,label:to.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))})]})}),xs?/* @__PURE__ */pt(vt,{canvas:Wo,tabs:Ns,onSelect:e=>{const n=hi.findIndex(n=>String(n.props.id)===e);n>=0&&ol(n)}}):null]})]}),So?/* @__PURE__ */ut(ht,{children:[In?
61
- /* @__PURE__ */pt("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:In}):/* @__PURE__ */pt(ht,{children:/* @__PURE__ */pt(u,{value:{selectChild:Pl,addChild:$l,childRowName:Vi,blockRowName:Zl},children:/* @__PURE__ */pt(ho,{mode:nr,onOpenWebsiteSettings:hr.openSettings??(()=>{}),onOpenSiteStyles:hr.openStyles,onOpenPageStyles:hr.openPageStyles,onSelectNode:Br,onNotify:Kr,onHidePanel:ci,nodeActions:Wt?Ie(Vt,Wt.type):zt})})}),
62
- /* @__PURE__ */pt(tn,{side:"right",width:Rr.right,min:rn.right,max:on,defaultWidth:f.right,label:to.resizeSettingsPanel,onResize:Hr})]}):
63
- /* @__PURE__ */pt(I,{side:"right",onShow:ci})]}),_i.menu,
64
- /* @__PURE__ */pt(te,{}),Si?/* @__PURE__ */pt(mt,{name:Si.name,onMake:e=>(async(e,n)=>{const t=hi.find(n=>String(n.props.id)===e),o=Yt.shared;if(!t||!o)return;let r;try{r=await z(ki).create(n,t)}catch{return void Kr(to.shared.makeFailed,"error")}o.adopt(t,r),wi(null)})(Si.id,e),onCancel:()=>wi(null)}):null]})}))}export{Nt as ScreenChrome};
@@ -1 +0,0 @@
1
- import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"./chunk-6WY6ZXJG.js";import{CopyStyleIcon as e,PasteStyleIcon as n}from"efficient-shell/icons/efficient";import{jsx as o}from"react/jsx-runtime";var r="__styleKind";function c(t,e){return t[r]=e,t}function i(t,e){return`${t}:${e.map(t=>String(t)).sort().join("|")}`}function u(t){if(!t)return null;const e=t.indexOf(":");if(e<0)return null;const n=t.slice(0,e);return s.has(n)?{control:n,values:t.slice(e+1).split("|")}:null}var s=/* @__PURE__ */new Set(["choice","select","radio"]);function l(t){if(!t||"object"!=typeof t)return null;const e=t;return"string"==typeof e[r]?e[r]:"text"===e.type||"textarea"===e.type||"number"===e.type?e.type:"select"!==e.type&&"radio"!==e.type||!Array.isArray(e.options)?null:i(e.type,e.options.map(t=>t?.value))}function a(t){return null!=t&&""!==t}function p(t,e){let n=t;for(const t of e){if(!n||"object"!=typeof n)return;n=n[t]}return n}function f(t){return void 0===t?t:JSON.parse(JSON.stringify(t))}function d(t,e,n){const[o,...r]=e,c={...t};if(0===r.length)return void 0===n?delete c[o]:c[o]=n,c;const i=c[o],u=d(i&&"object"==typeof i?i:{},r,n);return 0===Object.keys(u).length?delete c[o]:c[o]=u,c}var y=t=>t.join("."),h="editor-shell:style-clipboard",g=null,m=!1,v=/* @__PURE__ */new Set;function S(){try{return"undefined"==typeof sessionStorage?null:sessionStorage}catch{return null}}function b(){if(!m){m=!0;try{const t=S()?.getItem(h);t&&(g=JSON.parse(t))}catch{g=null}}}function k(t){b(),g={scope:t.scope,sourceType:t.type,sourceLabel:t.label,rows:t.rows.map(e=>{const n=p(t.props,e.path);return{path:[...e.path],kind:e.kind,counted:!1!==e.counted,value:a(n)?f(n):void 0}})};try{S()?.setItem(h,JSON.stringify(g))}catch{}return v.forEach(t=>t()),g}function N(t){return b(),g&&g.scope===t?g:null}function C(t){return v.add(t),()=>{v.delete(t)}}function j(){g=null,m=!0;try{S()?.removeItem(h)}catch{}v.forEach(t=>t())}function w(t,e,n){if(t.kind===e.kind)return null!==e.kind||n;const o=u(t.kind),r=u(e.kind);return!(!o||!r||o.control!==r.control)&&(!a(t.value)||r.values.includes(String(t.value)))}function O(t,e){const n=t.sourceType===e.type,o=new Map(t.rows.map(t=>[y(t.path),t]));let r=e.props,c=0,i=!1;for(const t of e.rows){const e=o.get(y(t.path));if(!e)continue;if(!w(e,t,n))continue;const u=p(r,t.path),s=void 0===e.value?void 0:f(e.value);JSON.stringify(a(u)?u:void 0)!==JSON.stringify(s)&&(r=d(r,t.path,s),i=!0),!1!==t.counted&&(c+=1)}return{props:r,pasted:c,changed:i}}function E(e,n,o,r=t){return 0===e.pasted?r.nothing({source:n,target:o}):r.pasted({count:e.pasted,source:n})}var J="⌥⌘C",K="⌥⌘V";function T(r){const c=r.words??t,i=[];return r.canCopy&&i.push({label:c.copy,icon:/* @__PURE__ */o(e,{}),shortcut:"⌥⌘C",onClick:r.onCopy}),r.held&&i.push({label:c.paste({source:r.held.sourceLabel}),icon:/* @__PURE__ */o(n,{}),shortcut:"⌥⌘V",onClick:r.onPaste}),i}function x(t){if(!t.altKey||t.shiftKey||!t.metaKey&&!t.ctrlKey)return null;const e=t.target;return e&&(e.isContentEditable||"INPUT"===e.tagName||"TEXTAREA"===e.tagName||"SELECT"===e.tagName)?null:"KeyC"===t.code?"copy":"KeyV"===t.code?"paste":null}export{J as COPY_STYLE_SHORTCUT,K as PASTE_STYLE_SHORTCUT,r as STYLE_KIND,i as choiceKind,j as clearStyle,k as copyStyle,l as fieldKind,N as heldStyle,E as pasteMessage,O as planPaste,T as styleMenuItems,x as styleShortcut,C as subscribeStyle,c as withStyleKind};
@@ -1 +0,0 @@
1
- function e(e,n){const o=e.categories??{},c=e.components,i=[];for(const[s,r]of Object.entries(o))if(!1!==r?.visible)for(const o of r?.components??[]){const r=c[o];if(!r)continue;const a=r.label??o,l=n.labelAtLevel(o,"section",a);i.push({type:o,cat:s,catLabel:t(e,s,n.categoryLabel),name:l,desc:n.descriptions[o]??"",...l===a?{}:{alias:a}})}return i}function t(e,t,n){return n(t)??e.categories?.[t]?.title??t}function n(e,t){return!t||`${e.name} ${e.alias??""} ${e.desc} ${e.type} ${e.catLabel}`.toLowerCase().includes(t)}function o(e,t){return e.find(e=>e.type===t)??null}function c(e,t){return e.filter(e=>e.type!==t)}export{e as buildPaletteSections,t as categoryLabel,n as matchesQuery,c as paletteWithoutPinned,o as pinnedSection};
@@ -1 +0,0 @@
1
- import{useState as t,useEffect as e,useRef as n}from"react";var o=/* @__PURE__ */new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function r(t){const e=t;if(!e||"string"!=typeof e.tagName)return!1;const n=e.tagName.toUpperCase();if("TEXTAREA"===n||"SELECT"===n)return!0;if("INPUT"===n)return!o.has(String(e.type??"text").toLowerCase());if(e.isContentEditable)return!0;const r=e.closest?.("[contenteditable]");return!(!r||"false"===r.getAttribute("contenteditable"))||null!=e.closest?.('[role="textbox"]')}var i="data-easel-block";function c(t,e=i){const n=t;return n&&"function"==typeof n.closest?n.closest(`[${e}]`)?.getAttribute(e)??null:null}function u(t){const e=t.getBoundingClientRect();if(e.width>0&&e.height>0)return{left:e.left,top:e.top,width:e.width,height:e.height};let n=1/0,o=1/0,r=-1/0,i=-1/0;for(const e of Array.from(t.children)){const t=u(e);t.width<=0||t.height<=0||(n=Math.min(n,t.left),o=Math.min(o,t.top),r=Math.max(r,t.left+t.width),i=Math.max(i,t.top+t.height))}return n===1/0?{left:e.left,top:e.top,width:e.width,height:e.height}:{left:n,top:o,width:r-n,height:i-o}}function s(t,e){return t===e||t.contains(e)||e.contains(t)}var l=4;function a(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function d(t,e,n){const o=t.getBoundingClientRect(),r=n?.getBoundingClientRect()??{left:0,top:0},i=a(t);return{left:o.left-r.left+e.left*i,top:o.top-r.top+e.top*i,width:e.width*i,height:e.height*i}}function f(t){const e=t.offsetWidth;if(!e)return 1;const n=t.getBoundingClientRect().width;return n>0?n/e:1}function h(t,e,n){const o=d(t,e,n),r=f(n);return{left:o.left/r,top:o.top/r,width:o.width/r,height:o.height/r}}function m(t,e,n){const o=t.getBoundingClientRect(),r=f(t);return{x:(e-o.left)/r,y:(n-o.top)/r}}function w(t,e,n,o){const{left:r,top:i}=d(t,{left:e,top:n,width:0,height:0},o);return{x:r,y:i}}function b({available:t,width:e,maxScale:n=1}){const o=Math.max(0,t);if(!e||e<=0)return{width:o,scale:1,shownWidth:o};const r=o>0?Math.min(o/e,n):1;return{width:e,scale:r,shownWidth:e*r}}var g="data-es-canvas-style",v=/* @__PURE__ */new WeakMap;function p(t,e){e?v.set(t,e):v.delete(t)}function y(t,e,n){const o=t.head??t.documentElement;let r=A(t,e);if(!r){r=t.createElement("style"),r.setAttribute(g,e);const n=v.get(t);n&&r.setAttribute("nonce",n),o.appendChild(r)}return r.textContent!==n&&(r.textContent=n),r}function E(t,e){A(t,e)?.remove()}function A(t,e){for(const n of Array.from(t.querySelectorAll(`style[${g}]`)))if(n.getAttribute(g)===e)return n;return null}var C="[data-easel-block]",L="[data-easel-dropzone]",x="iframe#preview-frame";function M(t){const e=t.contentDocument;if(!e||!t.contentWindow||"loading"===e.readyState||!e.body)return!1;if(t.hasAttribute("srcdoc"))return"about:srcdoc"===e.URL;const n=t.getAttribute("src");return!n||"about:blank"===n||"about:blank"!==e.URL}function S(t,e,{selector:n=x,readySelector:o}={}){let r=null,i=null,c=!1,u=!1,s=null;const l=()=>{s?.observer.disconnect(),s=null},a=()=>{if(u)return;let t=null;if(r&&M(r)){const e=r.contentDocument;(t=>{if(!o||t.querySelector(o))return l(),!0;if(s?.doc!==t){l();const e=t.defaultView?.MutationObserver;if(e){const n=new e(()=>a());n.observe(t,{childList:!0,subtree:!0}),s={doc:t,observer:n}}}return!1})(e)&&(t={frame:r,document:e,window:r.contentWindow})}else l();(t===i||!!t&&!!i&&t.frame===i.frame&&t.document===i.document)&&c||(c=!0,i=t,e(i))},d=()=>a(),f=()=>{const e=t.querySelector?.(n);e!==r?(r?.removeEventListener("load",d),r=e,r?.addEventListener("load",d),a()):a()},h=t.ownerDocument?.defaultView??t.defaultView,m=h?.MutationObserver,w=m?new m(t=>(t=>null!==r&&!r.isConnected||t.some(t=>[...t.addedNodes,...t.removedNodes].some(t=>"IFRAME"===t.nodeName||!!t.querySelector?.("iframe"))))(t)&&f()):null;return w?.observe(t,{childList:!0,subtree:!0}),f(),()=>{u=!0,w?.disconnect(),l(),r?.removeEventListener("load",d),r=null}}function R(n,{selector:o,readySelector:r}={}){const[i,c]=t(null);return e(()=>{const t=n.current;if(!t)return;const e=S(t,c,{selector:o,readySelector:r});return()=>{e(),c(null)}},[n,o,r]),i}var B="easel:canvas-typing",W="easel:canvas-typable";function k(t,o,r,{on:i="document",capture:c=!1}={}){const u=n(r);u.current=r;const s=t?.document??null,l=t?.window??null;e(()=>{const t="window"===i?l:s;if(!t)return;const e=t=>u.current(t);return t.addEventListener(o,e,c),()=>t.removeEventListener(o,e,c)},[s,l,o,i,c])}function q(e){const[n,o]=t(!1);return k(e,B,t=>o(Boolean(t.detail?.typing))),n}function N(t,n,o){const r=t?.document??null;e(()=>{if(!r)return;if(!o)return void E(r,n);const t=y(r,n,o),e=r.defaultView?.MutationObserver,i=e?new e(()=>{t.isConnected||y(r,n,o)}):null;return i?.observe(r.head??r.documentElement,{childList:!0}),()=>{i?.disconnect(),E(r,n)}},[r,n,o])}function T(n,{settle:o=[150,450]}={}){const[r,i]=t(0),c=n?.frame??null,u=n?.document??null,s=n?.window??null,l=o.join(",");return e(()=>{if(!c||!u||!s)return;const t=c.ownerDocument.defaultView;let e=!1,n=0;const r=()=>{if(e)return;e=!0;const o=()=>{e=!1,i(t=>t+1)};t?.requestAnimationFrame?n=t.requestAnimationFrame(o):o()},l=[],a=(t,e)=>{t.addEventListener(e,r,!0),l.push(()=>t.removeEventListener(e,r,!0))};a(u,"scroll"),a(s,"resize"),t&&(a(t,"scroll"),a(t,"resize"));const d=t?.ResizeObserver;if(d){const t=new d(r);t.observe(c),u.documentElement&&t.observe(u.documentElement),l.push(()=>t.disconnect())}const f=u.defaultView?.MutationObserver,h=u.body??u.documentElement;if(f&&h){const t=new f(r);t.observe(u===c.ownerDocument?c:h,{childList:!0,subtree:!0}),l.push(()=>t.disconnect())}const m=u.fonts;m&&a(m,"loadingdone");const w=o.map(t=>setTimeout(r,t));return r(),()=>{for(const t of l)t();for(const t of w)clearTimeout(t);n&&t?.cancelAnimationFrame&&t.cancelAnimationFrame(n)}},[c,u,s,l]),r}export{i as BLOCK_ATTRIBUTE,C as BLOCK_SELECTOR,x as CANVAS_SELECTOR,W as CANVAS_TYPABLE_EVENT,B as CANVAS_TYPING_EVENT,L as LIST_SELECTOR,l as WORDS_CLEAR,m as clientPointToLayer,u as drawnBox,f as elementScale,b as fitCanvas,w as framePointToHost,d as frameRectToHost,h as frameRectToLayer,a as frameScale,M as isFrameReady,r as isTypingTarget,c as nodeIdAt,s as related,E as removeCanvasStyle,p as setCanvasNonce,y as upsertCanvasStyle,k as useCanvasEvent,R as useCanvasFrame,T as useCanvasLayout,N as useCanvasStyle,q as useCanvasTyping,S as watchCanvasFrame};
@@ -1,49 +0,0 @@
1
- /**
2
- * A TEMPLATE DRAWN MANY TIMES (section parts plan §3.2, row B5, 2026-10-23).
3
- *
4
- * A data block (a product grid, a list of posts) holds ONE `template` slot of
5
- * real blocks and draws it once per data row. So the same block ids are in the
6
- * canvas several times. The host wraps each drawn copy:
7
- *
8
- * <div data-sf-repeat="<ownerId>:template" data-sf-repeat-index={i}>
9
- *
10
- * Index 0 is the MAIN copy. The blocks inside keep their real
11
- * `data-easel-block` / `data-easel-dnd` ids in every copy, so a click on any
12
- * copy selects the template block. What the canvas does with the copies:
13
- * - the hover and the selected outline are drawn on every copy;
14
- * - only the main copy's lists are drop targets (the others are pictures);
15
- * - a lookup of one element by id reads the main copy.
16
- *
17
- * The two names are written HERE, once. The website draws the wrappers with
18
- * them (it imports them from `efficient-easel/draw`, a render entry), so the
19
- * string is never typed twice. Pure DOM, no import, nothing run at import.
20
- *
21
- * A page with no `data-sf-repeat` gets the same answers as before: every
22
- * helper below falls back to the first match.
23
- */
24
- /** The wrapper round one drawn copy of a template: `"<ownerId>:<slot>"`. */
25
- declare const REPEAT_ATTRIBUTE = "data-sf-repeat";
26
- /** Which copy the wrapper holds: `"0"` is the main copy. */
27
- declare const REPEAT_INDEX_ATTRIBUTE = "data-sf-repeat-index";
28
- /**
29
- * Is `el` in a copy that is NOT the main one — inside (or itself) a wrapper
30
- * whose index is not 0, at any depth (a template inside a copy of an outer
31
- * template is a copy too)? False for a block in no wrapper at all.
32
- */
33
- declare function isRepeatCopy(el: Element): boolean;
34
- /** The main copy among `matches`: the first that is not a copy, else the first. */
35
- declare function mainCopyOf<T extends Element>(matches: Iterable<T>): T | null;
36
- /**
37
- * `root.querySelector(selector)`, but the main copy when a template is drawn
38
- * many times. With no `data-sf-repeat` it is exactly `querySelector`.
39
- */
40
- declare function queryMainCopy<T extends Element = Element>(root: ParentNode, selector: string): T | null;
41
- /**
42
- * The element for `selector` in every drawn copy: the main copy first, then
43
- * each other copy in page order. With no `data-sf-repeat` it is the first
44
- * match alone, as `querySelector` answers — a second element with the same id
45
- * that is not a drawn copy is never added.
46
- */
47
- declare function queryAllCopies<T extends Element = Element>(root: ParentNode, selector: string): T[];
48
-
49
- export { REPEAT_ATTRIBUTE as R, REPEAT_INDEX_ATTRIBUTE as a, queryMainCopy as b, isRepeatCopy as i, mainCopyOf as m, queryAllCopies as q };
@@ -1,43 +0,0 @@
1
- import { P as Place } from './types-Dq180WRV.js';
2
-
3
- /**
4
- * The one drag in flight, shared by every surface of an editor — the Layers
5
- * tree, the canvas and the Add list (blueprint step 3.2).
6
- *
7
- * Native drag-and-drop does not let a drop target read what is being dragged
8
- * until the drop itself (the data is sealed during `dragover`), and a tree that
9
- * only knows about drags it started cannot take a block from the Add list. So
10
- * the surface that starts a drag writes it here and every surface reads it: a
11
- * block picked up on the canvas can land in the tree, a tile from the Add list
12
- * on either.
13
- *
14
- * `from` is where the thing sits now — absent for something new (an Add tile),
15
- * which is also why a new thing can never be a no-op drop.
16
- */
17
-
18
- type DragHeld<I> = {
19
- /** The identity `keyOf` gave it — which row or box is the one being dragged. */
20
- key: string;
21
- item: I;
22
- /** Where it sits now. Absent: it is new, from the Add list. */
23
- from?: Place;
24
- };
25
- type DragSession<I> = {
26
- /** The drag in flight, current at once (for event handlers). */
27
- get: () => DragHeld<I> | null;
28
- /** The drag as last TOLD to subscribers (for rendering — see below). */
29
- shown: () => DragHeld<I> | null;
30
- start: (held: DragHeld<I>) => void;
31
- end: () => void;
32
- subscribe: (listener: () => void) => () => void;
33
- };
34
- /**
35
- * `get()` is current the moment a drag starts — the drop targets read it on
36
- * their first `dragover`. SUBSCRIBERS hear about a start one tick later: the
37
- * browser takes the drag picture when the `dragstart` handlers return, and a
38
- * render in between (a row dimming, the handle hiding) would be in the picture.
39
- * An end is told at once.
40
- */
41
- declare function createDragSession<I>(): DragSession<I>;
42
-
43
- export { type DragSession as D, type DragHeld as a, createDragSession as c };