efficient-easel 27.1.0 → 27.3.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 (92) hide show
  1. package/dist/AddSidePanel-DwfZOS5C.d.ts +2002 -0
  2. package/dist/{ScreenDocumentContext-DPW_6gOC.d.ts → ScreenDocumentContext-JQr4hTeP.d.ts} +7 -5
  3. package/dist/blocks/index.d.ts +1 -1
  4. package/dist/{canvas-typing-CD1aeYnk.d.ts → canvas-typing-B33ssbpU.d.ts} +22 -3
  5. package/dist/{chunk-J5VPNHOW.js → chunk-2DFSODES.js} +1 -1
  6. package/dist/{chunk-LAJYMOY3.js → chunk-2ODVRWRM.js} +1 -1
  7. package/dist/{chunk-WL57KM5C.js → chunk-36AWYQLN.js} +6 -6
  8. package/dist/{chunk-QPNNWQ24.js → chunk-4JPAVKV6.js} +1 -1
  9. package/dist/chunk-64NREOML.js +1 -0
  10. package/dist/chunk-7WONGRN3.js +64 -0
  11. package/dist/chunk-AI5IQV4A.js +2 -0
  12. package/dist/chunk-BDYS3UAD.js +5 -0
  13. package/dist/{chunk-RTMDZJNE.js → chunk-DFLPDOZF.js} +1 -1
  14. package/dist/chunk-IHYRYSP2.js +7 -0
  15. package/dist/chunk-JEKFHCKS.js +8 -0
  16. package/dist/{chunk-SEH3Q3EL.js → chunk-JNNBGI6Y.js} +1 -1
  17. package/dist/chunk-KRONK73U.js +1 -0
  18. package/dist/{chunk-L36E2WCO.js → chunk-NMLAW6FI.js} +17 -17
  19. package/dist/chunk-OHHODU7N.js +26 -0
  20. package/dist/{chunk-XESNAMI3.js → chunk-PMDIDRDB.js} +4 -4
  21. package/dist/{chunk-P3HXHLES.js → chunk-TWXA55SR.js} +1 -1
  22. package/dist/copy/index.d.ts +3 -3
  23. package/dist/copy/index.js +29 -29
  24. package/dist/data/index.d.ts +1 -1
  25. package/dist/easel/index.d.ts +10 -2
  26. package/dist/easel/index.js +1 -1
  27. package/dist/fields/index.d.ts +1 -1
  28. package/dist/fields/index.js +1 -1
  29. package/dist/panel/index.d.ts +5 -0
  30. package/dist/panel/index.js +1 -1
  31. package/dist/{phone-order-CRKvsTsz.d.ts → phone-order-BCM_f8A1.d.ts} +7 -1
  32. package/dist/screen/components/AddBlockRow.js +1 -1
  33. package/dist/screen/components/AddSidePanel.d.ts +3 -5
  34. package/dist/screen/components/AddSidePanel.js +1 -1
  35. package/dist/screen/components/NodeContextMenu.d.ts +3 -5
  36. package/dist/screen/components/SaveControls.d.ts +3 -5
  37. package/dist/screen/components/ScreenChrome.js +1 -1
  38. package/dist/screen/components/ScreenDocumentContext.d.ts +2 -2
  39. package/dist/screen/components/ScreenMount.d.ts +3 -5
  40. package/dist/screen/components/ScreenMount.js +1 -1
  41. package/dist/screen/components/ScreenStoreProvider.d.ts +3 -5
  42. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  43. package/dist/screen/components/SectionScreenShell.js +17 -17
  44. package/dist/screen/components/usePartBridge.d.ts +3 -5
  45. package/dist/screen/components/usePartBridge.js +1 -1
  46. package/dist/screen/index.d.ts +3 -5
  47. package/dist/screen/index.js +1 -1
  48. package/dist/screen/lib/admin-bridge.d.ts +1 -1
  49. package/dist/screen/lib/document/add-target-types.d.ts +37 -55
  50. package/dist/screen/lib/document/block-set-host.js +1 -1
  51. package/dist/screen/lib/document/block-size-fields.d.ts +2 -2
  52. package/dist/screen/lib/document/block-size-fields.js +1 -1
  53. package/dist/screen/lib/document/box-fields.d.ts +2 -2
  54. package/dist/screen/lib/document/box-fields.js +1 -1
  55. package/dist/screen/lib/document/button-fields.d.ts +2 -2
  56. package/dist/screen/lib/document/button-fields.js +1 -1
  57. package/dist/screen/lib/document/image-fields.d.ts +2 -2
  58. package/dist/screen/lib/document/image-fields.js +4 -4
  59. package/dist/screen/lib/document/new-child.d.ts +58 -0
  60. package/dist/screen/lib/document/new-child.js +1 -0
  61. package/dist/screen/lib/document/palette-sections.d.ts +3 -5
  62. package/dist/screen/lib/document/section-doc.d.ts +1 -1
  63. package/dist/screen/lib/document/shadow-fields.d.ts +2 -2
  64. package/dist/screen/lib/document/shadow-fields.js +1 -1
  65. package/dist/screen/lib/document/slot-section-spec.d.ts +37 -96
  66. package/dist/screen/lib/document/style-clipboard.d.ts +3 -5
  67. package/dist/screen/lib/document/style-fields.d.ts +2 -2
  68. package/dist/screen/lib/document/style-fields.js +1 -1
  69. package/dist/screen/lib/document/use-section-ops.d.ts +37 -3
  70. package/dist/screen/lib/document/use-section-ops.js +1 -1
  71. package/dist/screen/lib/document-addressing.d.ts +2 -2
  72. package/dist/screen/lib/document-hooks.d.ts +1 -1
  73. package/dist/screen/lib/host.d.ts +2 -2
  74. package/dist/screen/lib/key-scope.js +1 -1
  75. package/dist/screen/lib/media-panel.d.ts +2 -2
  76. package/dist/screen/lib/media-picker.d.ts +2 -2
  77. package/dist/screen/lib/page-lock.d.ts +1 -1
  78. package/dist/screen/lib/screen-parts.d.ts +21 -1828
  79. package/dist/screen/lib/screen-parts.js +1 -1
  80. package/dist/screen/lib/section-templates.d.ts +1 -1
  81. package/dist/screen/lib/session-context.d.ts +1 -1
  82. package/dist/screen/lib/session.d.ts +1 -1
  83. package/dist/screen/lib/shared-sections.d.ts +1 -1
  84. package/dist/text-styles/index.js +11 -11
  85. package/package.json +10 -4
  86. package/dist/chunk-3FANFZ4D.js +0 -1
  87. package/dist/chunk-D4TH4QQR.js +0 -2
  88. package/dist/chunk-DTEYSPJE.js +0 -64
  89. package/dist/chunk-GJ427TZL.js +0 -8
  90. package/dist/chunk-MNQDOSAX.js +0 -7
  91. package/dist/chunk-SDSBXW3V.js +0 -26
  92. package/dist/chunk-TUIBPB77.js +0 -5
@@ -1 +1 @@
1
- export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSelectionMode,isSlotMode,sameInspectorMode,screenSlotsOf,shownChildSlotsOf,shownSlotFieldsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-TUIBPB77.js";import"../../chunk-NCXYC7WI.js";import"../../chunk-LX23TCTP.js";import"../../chunk-TCAAOYQY.js";import"../../chunk-L36E2WCO.js";import"../../chunk-XT75WETI.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-SDSBXW3V.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-YCSZAP7T.js";import"../../chunk-TDEBPOWV.js";import"../../chunk-WHS6Y55E.js";import"../../chunk-D4TH4QQR.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-56ID6FKZ.js";import"../../chunk-LDHUPZBK.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-TF6NAIV7.js";import"../../chunk-MNQDOSAX.js";import"../../chunk-PMRN5Z3T.js";import"../../chunk-ANBPE45L.js";import"../../chunk-C63IB4VW.js";import"../../chunk-DX3VILZ3.js";import"../../chunk-MIX7EGRG.js";import"../../chunk-UMTUKSE6.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-QEEW4X64.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-YDTEYXQW.js";import"../../chunk-KXM6YRG2.js";import"../../chunk-6GJEOER4.js";import"../../chunk-FR7EEKFF.js";import"../../chunk-7UFKEX72.js";
1
+ export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSelectionMode,isSlotMode,sameInspectorMode,screenSlotsOf,shownChildSlotsOf,shownSlotFieldsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-BDYS3UAD.js";import"../../chunk-NCXYC7WI.js";import"../../chunk-LX23TCTP.js";import"../../chunk-TCAAOYQY.js";import"../../chunk-NMLAW6FI.js";import"../../chunk-XT75WETI.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-OHHODU7N.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-YCSZAP7T.js";import"../../chunk-TDEBPOWV.js";import"../../chunk-WHS6Y55E.js";import"../../chunk-AI5IQV4A.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-56ID6FKZ.js";import"../../chunk-LDHUPZBK.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-TF6NAIV7.js";import"../../chunk-IHYRYSP2.js";import"../../chunk-PMRN5Z3T.js";import"../../chunk-ANBPE45L.js";import"../../chunk-C63IB4VW.js";import"../../chunk-DX3VILZ3.js";import"../../chunk-MIX7EGRG.js";import"../../chunk-UMTUKSE6.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-QEEW4X64.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-YDTEYXQW.js";import"../../chunk-KXM6YRG2.js";import"../../chunk-6GJEOER4.js";import"../../chunk-FR7EEKFF.js";import"../../chunk-7UFKEX72.js";
@@ -6,7 +6,7 @@ import 'react';
6
6
  import '../../types-BljCVdzR.js';
7
7
  import '../../data/index.js';
8
8
  import '../../types-Dq180WRV.js';
9
- import '../../phone-order-CRKvsTsz.js';
9
+ import '../../phone-order-BCM_f8A1.js';
10
10
  import '../../plan-D0DgSLnY.js';
11
11
  import './backend-error.js';
12
12
  import '../../edit-lock/index.js';
@@ -5,7 +5,7 @@ import '../../blocks/index.js';
5
5
  import '../../types-BljCVdzR.js';
6
6
  import '../../data/index.js';
7
7
  import '../../types-Dq180WRV.js';
8
- import '../../phone-order-CRKvsTsz.js';
8
+ import '../../phone-order-BCM_f8A1.js';
9
9
  import '../../plan-D0DgSLnY.js';
10
10
  import './backend-error.js';
11
11
  import '../../edit-lock/index.js';
@@ -9,7 +9,7 @@ import 'react';
9
9
  import '../../types-BljCVdzR.js';
10
10
  import '../../data/index.js';
11
11
  import '../../types-Dq180WRV.js';
12
- import '../../phone-order-CRKvsTsz.js';
12
+ import '../../phone-order-BCM_f8A1.js';
13
13
  import '../../plan-D0DgSLnY.js';
14
14
  import '../../edit-lock/index.js';
15
15
  import './links/link-filters.js';
@@ -6,7 +6,7 @@ import 'react';
6
6
  import '../../types-BljCVdzR.js';
7
7
  import '../../data/index.js';
8
8
  import '../../types-Dq180WRV.js';
9
- import '../../phone-order-CRKvsTsz.js';
9
+ import '../../phone-order-BCM_f8A1.js';
10
10
  import '../../plan-D0DgSLnY.js';
11
11
  import './backend-error.js';
12
12
  import '../../edit-lock/index.js';
@@ -1,9 +1,9 @@
1
- import{SettingsDefaultReset as e}from"../chunk-2T22IY3J.js";import{hexReadout as s,typedHex as t}from"../chunk-4FFDGEWA.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import{FieldSlider as l}from"../chunk-TDEBPOWV.js";import{DEFAULT_PANEL_WORDS as i}from"../chunk-56ID6FKZ.js";import{TEXT_STYLE_KINDS as n,canAddTextStyle as r,TEXT_STYLE_MAX as o,isDefaultTextStyle as d,CAMPAIGN_TEXT_STYLE_SETTINGS as c,TEXT_STYLE_SETTINGS as u,textStyleViewValues as m,textStyleRowSize as h,describeTextStyle as p,updateTextStyle as f,textStyleCaseCss as v,TEXT_STYLE_VIEW_NUMBERS as g,TEXT_STYLE_CASES as y,addTextStyle as S,removeTextStyle as b,TEXT_STYLE_RANGES as T,textStyleViewKey as k}from"../chunk-53QUHEHK.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,TEXT_STYLE_VIEW_NUMBERS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,textStyleViewKey,textStyleViewValues,updateTextStyle,weightWord}from"../chunk-53QUHEHK.js";import{viewFollows as N,isAuto as C}from"../chunk-DIOTWSCO.js";import{FieldSelect as x}from"../chunk-C63IB4VW.js";import{SettingsSegmented as E}from"../chunk-DX3VILZ3.js";import{SettingsField as w}from"../chunk-MIX7EGRG.js";import"../chunk-UMTUKSE6.js";import{useWords as O}from"../chunk-MFIRYGHW.js";import{withTip as _}from"../chunk-P2VEMZH5.js";import{hsvToHex as z,Tooltip as j,ColorSwatch as L,Popover as M,ColorPickerPanel as I,colorSwatchClasses as $,IconButton as W,Button as A}from"efficient-shell/ui";import{useId as X,useState as Y,useRef as D,useEffect as G,Fragment as V}from"react";import{TrashIcon as F,ChevronIcon as H,BoldIcon as R,ItalicIcon as U,CaseLowerIcon as B,CaseCapitalizedIcon as K,CaseUpperIcon as q,CaseNormalIcon as P}from"efficient-shell/icons/efficient";import{jsxs as Z,jsx as Q,Fragment as J}from"react/jsx-runtime";var ee=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>z({h:e,s:1,v:1})).join(", ")})`;function se({value:e,hex:t,colours:a,label:l,followsWord:i,anyWord:n,onChange:r,readOnly:o=!1}){const d=void 0!==e&&a.some(s=>s.key===e),c=void 0!==e&&!d;/* @__PURE__ */
1
+ import{hexReadout as e,typedHex as s}from"../chunk-4FFDGEWA.js";import{SettingsDefaultReset as t}from"../chunk-2T22IY3J.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import{FieldSlider as l}from"../chunk-TDEBPOWV.js";import{DEFAULT_PANEL_WORDS as i}from"../chunk-56ID6FKZ.js";import{TEXT_STYLE_KINDS as n,canAddTextStyle as r,TEXT_STYLE_MAX as o,isDefaultTextStyle as d,CAMPAIGN_TEXT_STYLE_SETTINGS as c,TEXT_STYLE_SETTINGS as u,textStyleViewValues as m,textStyleRowSize as h,describeTextStyle as p,updateTextStyle as f,textStyleCaseCss as v,TEXT_STYLE_VIEW_NUMBERS as g,TEXT_STYLE_CASES as y,addTextStyle as S,removeTextStyle as b,TEXT_STYLE_RANGES as T,textStyleViewKey as k}from"../chunk-53QUHEHK.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,TEXT_STYLE_VIEW_NUMBERS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,textStyleViewKey,textStyleViewValues,updateTextStyle,weightWord}from"../chunk-53QUHEHK.js";import{viewFollows as N,isAuto as C}from"../chunk-DIOTWSCO.js";import{FieldSelect as x}from"../chunk-C63IB4VW.js";import{SettingsSegmented as E}from"../chunk-DX3VILZ3.js";import{SettingsField as w}from"../chunk-MIX7EGRG.js";import"../chunk-UMTUKSE6.js";import{useWords as O}from"../chunk-MFIRYGHW.js";import{withTip as _}from"../chunk-P2VEMZH5.js";import{hsvToHex as z,Tooltip as j,ColorSwatch as L,Popover as M,ColorPickerPanel as I,colorSwatchClasses as $,IconButton as W,Button as A}from"efficient-shell/ui";import{useId as X,useState as Y,useRef as D,useEffect as G,Fragment as V}from"react";import{TrashIcon as F,ChevronIcon as H,BoldIcon as R,ItalicIcon as U,CaseLowerIcon as B,CaseCapitalizedIcon as K,CaseUpperIcon as q,CaseNormalIcon as P}from"efficient-shell/icons/efficient";import{jsxs as Z,jsx as Q,Fragment as J}from"react/jsx-runtime";var ee=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>z({h:e,s:1,v:1})).join(", ")})`;function se({value:s,hex:t,colours:a,label:l,followsWord:i,anyWord:n,onChange:r,readOnly:o=!1}){const d=void 0!==s&&a.some(e=>e.key===s),c=void 0!==s&&!d;/* @__PURE__ */
2
2
  return Z("div",{className:"es-ts-set","data-ts-setting":"color",children:[
3
3
  /* @__PURE__ */Z("div",{className:"es-ts-top",children:[
4
4
  /* @__PURE__ */Q("span",{className:"es-ts-sub",children:l}),
5
- /* @__PURE__ */Q("span",{className:"es-ts-colour-read",children:t?s(t):i})]}),
6
- /* @__PURE__ */Z("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[a.map(t=>/* @__PURE__ */Q(j,{content:`${t.name} · ${s(t.value)}`,children:/* @__PURE__ */Q(L,{color:t.value,size:"sm",className:"es-ts-swatch","aria-label":t.name,selected:e===t.key,disabled:o,onClick:()=>r(t.key)})},t.key)),
5
+ /* @__PURE__ */Q("span",{className:"es-ts-colour-read",children:t?e(t):i})]}),
6
+ /* @__PURE__ */Z("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[a.map(t=>/* @__PURE__ */Q(j,{content:`${t.name} · ${e(t.value)}`,children:/* @__PURE__ */Q(L,{color:t.value,size:"sm",className:"es-ts-swatch","aria-label":t.name,selected:s===t.key,disabled:o,onClick:()=>r(t.key)})},t.key)),
7
7
  /* @__PURE__ */Q(j,{content:n,children:/* @__PURE__ */Q(M,{trigger:/* @__PURE__ */Q("span",{"aria-hidden":"true",className:"absolute inset-0",style:{background:ee}}),triggerLabel:n,triggerClassName:$({size:"sm",selected:c,className:"es-ts-swatch es-ts-swatch--any"}),"aria-label":l,disabled:o,children:/* @__PURE__ */Q(I,{className:"es-pick-window",value:t??"",onChange:e=>r(e),label:l,disabled:o})})})]})]})}function te({styles:e,onChange:s,fonts:t,colours:l=[],settings:i=c,auto:u=[],fallback:m,sample:h,openId:p,defaultOpenId:f=null,onOpenChange:v,onAdd:g,rowActions:y,onRemove:T,max:k=o,device:N="desktop",readOnly:C=!1}){const x=O("textStyles",a),E=X(),[w,z]=Y(f),j=void 0!==p?p:w,L=e=>{void 0===p&&z(e),v?.(e)},M=D(null),[I,$]=Y(null);G(()=>{if(!I||!M.current)return;const e=[...M.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===I.id),s=e?e.querySelector(".es-ts-row"):M.current.querySelector(`.es-ts-add[data-ts-kind="${I.kind}"]`);s?.focus(),$(null)},[I]);/* @__PURE__ */
8
8
  return Q("div",{className:"es-ts",ref:M,children:n.map(a=>{const n=e.filter(e=>e.kind===a),o=!r(e,a,k),c=!C&&!o;/* @__PURE__ */
9
9
  return Z(ae,{label:x.groups[a],children:[n.map(a=>{const n=y?.(a),r=null!=n&&!1!==n,o=Boolean(T)&&!C&&!d(a);/* @__PURE__ */
@@ -17,17 +17,17 @@ return Z(V,{children:[
17
17
  /* @__PURE__ */Z("button",{type:"button",className:"es-ts-row","aria-expanded":o,"aria-controls":o?T:void 0,onClick:()=>d(!o),children:[
18
18
  /* @__PURE__ */Q("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */Q(H,{size:12})}),
19
19
  /* @__PURE__ */Q("span",{className:"es-ts-name",style:w,children:e.name}),
20
- /* @__PURE__ */Q("span",{className:"es-ts-meta",children:p(x,s,b,{autoSize:k.has("size")&&void 0===x.size})})]}),g?/* @__PURE__ */Q("div",{className:"es-ts-actions",children:g}):null]}),o?/* @__PURE__ */Q("div",{className:"es-ts-open",id:T,children:/* @__PURE__ */Q(ne,{style:e,values:C,fonts:s,colours:t,settings:N,autoSet:k,sample:r??b.sample,words:b,device:y,readOnly:S,set:s=>v(f([e],e.id,s)[0])})}):null]})}var ie={none:P,upper:q,capitalize:K,lower:B};function ne({style:s,values:a,fonts:n,colours:r,settings:o,autoSet:d,sample:c,words:u,device:h,readOnly:p,set:f}){const y=s.values,S=O("panel",i),b=n.find(e=>e.value===a.font),x=function(e,s){return e?s.find(s=>s.key===e)?.value??t(e)??void 0:void 0}(a.color,r),E=e=>"largestSize"===e||d.has(e),z=e=>E(e)?y[e]:a[e],j=m(y,h),L=j.size??z("size"),M=j.lineSpacing??z("lineSpacing"),I=j.letterSpacing??z("letterSpacing"),$=E("letterCase")?y.letterCase:a.letterCase,A={fontFamily:b?.family,fontSize:void 0===L?void 0:`${L}px`,fontWeight:a.weight,fontStyle:a.italic?"italic":void 0,lineHeight:void 0===M?void 0:String(M/100),letterSpacing:void 0===I?void 0:`${I}px`,color:x,textTransform:v($)},X=e=>{const s=T[e],t=E(e);/* @__PURE__ */
20
+ /* @__PURE__ */Q("span",{className:"es-ts-meta",children:p(x,s,b,{autoSize:k.has("size")&&void 0===x.size})})]}),g?/* @__PURE__ */Q("div",{className:"es-ts-actions",children:g}):null]}),o?/* @__PURE__ */Q("div",{className:"es-ts-open",id:T,children:/* @__PURE__ */Q(ne,{style:e,values:C,fonts:s,colours:t,settings:N,autoSet:k,sample:r??b.sample,words:b,device:y,readOnly:S,set:s=>v(f([e],e.id,s)[0])})}):null]})}var ie={none:P,upper:q,capitalize:K,lower:B};function ne({style:e,values:a,fonts:n,colours:r,settings:o,autoSet:d,sample:c,words:u,device:h,readOnly:p,set:f}){const y=e.values,S=O("panel",i),b=n.find(e=>e.value===a.font),x=function(e,t){return e?t.find(s=>s.key===e)?.value??s(e)??void 0:void 0}(a.color,r),E=e=>"largestSize"===e||d.has(e),z=e=>E(e)?y[e]:a[e],j=m(y,h),L=j.size??z("size"),M=j.lineSpacing??z("lineSpacing"),I=j.letterSpacing??z("letterSpacing"),$=E("letterCase")?y.letterCase:a.letterCase,A={fontFamily:b?.family,fontSize:void 0===L?void 0:`${L}px`,fontWeight:a.weight,fontStyle:a.italic?"italic":void 0,lineHeight:void 0===M?void 0:String(M/100),letterSpacing:void 0===I?void 0:`${I}px`,color:x,textTransform:v($)},X=e=>{const s=T[e],t=E(e);/* @__PURE__ */
21
21
  return Q("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */Q(l,{label:u.settings[e],value:y[e],onChange:s=>f({[e]:s}),min:s.min,max:s.max,step:s.step,shiftStep:s.shiftStep,sliderMin:s.sliderMin,sliderMax:s.sliderMax,unit:s.unit||void 0,styleValue:t?void 0:a[e],auto:t?u.auto:void 0,readOnly:p})},e)};/* @__PURE__ */
22
22
  return Z(J,{children:[
23
- /* @__PURE__ */Q("div",{className:"es-ts-preview",style:A,"aria-label":u.preview,children:c}),o.map(t=>{if("desktop"!==h)return g.includes(t)?"largestSize"===t&&"heading"!==s.kind?null:((s,t)=>{const a=T[s],i=k(s,t),n=N(z(s),"phone"===t?y[k(s,"tablet")]:void 0),r=!C(y[i]);/* @__PURE__ */
24
- return Q("div",{className:"es-ts-slider","data-ts-setting":s,"data-ts-device":t,children:/* @__PURE__ */Q(w,{label:u.settings[s],changed:r,action:/* @__PURE__ */Q(e,{label:u.settings[s],changed:r,disabled:p,onReset:()=>f({[i]:void 0}),detail:void 0===n?u.auto:`${n}${a.unit}`,words:S}),children:/* @__PURE__ */Q(l,{bare:!0,label:u.settings[s],value:y[i],onChange:e=>f({[i]:e}),min:a.min,max:a.max,step:a.step,shiftStep:a.shiftStep,sliderMin:a.sliderMin,sliderMax:a.sliderMax,unit:a.unit||void 0,styleValue:n,auto:void 0===n?u.auto:void 0,readOnly:p})})},s)})(t,h):null;switch(t){case"font":/* @__PURE__ */
25
- return Q(re,{value:y.font,fonts:n,words:u,readOnly:p,set:f},t);case"color":/* @__PURE__ */
26
- return Q(oe,{value:y.color,hex:x,colours:r,words:u,readOnly:p,set:f},t);case"emphasis":{const e=(a.weight??400)>=600,s=!1!==b?.italic;/* @__PURE__ */
27
- return Z("div",{className:"es-ts-set","data-ts-setting":t,children:[
23
+ /* @__PURE__ */Q("div",{className:"es-ts-preview",style:A,"aria-label":u.preview,children:c}),o.map(s=>{if("desktop"!==h)return g.includes(s)?"largestSize"===s&&"heading"!==e.kind?null:((e,s)=>{const a=T[e],i=k(e,s),n=N(z(e),"phone"===s?y[k(e,"tablet")]:void 0),r=!C(y[i]);/* @__PURE__ */
24
+ return Q("div",{className:"es-ts-slider","data-ts-setting":e,"data-ts-device":s,children:/* @__PURE__ */Q(w,{label:u.settings[e],changed:r,action:/* @__PURE__ */Q(t,{label:u.settings[e],changed:r,disabled:p,onReset:()=>f({[i]:void 0}),detail:void 0===n?u.auto:`${n}${a.unit}`,words:S}),children:/* @__PURE__ */Q(l,{bare:!0,label:u.settings[e],value:y[i],onChange:e=>f({[i]:e}),min:a.min,max:a.max,step:a.step,shiftStep:a.shiftStep,sliderMin:a.sliderMin,sliderMax:a.sliderMax,unit:a.unit||void 0,styleValue:n,auto:void 0===n?u.auto:void 0,readOnly:p})})},e)})(s,h):null;switch(s){case"font":/* @__PURE__ */
25
+ return Q(re,{value:y.font,fonts:n,words:u,readOnly:p,set:f},s);case"color":/* @__PURE__ */
26
+ return Q(oe,{value:y.color,hex:x,colours:r,words:u,readOnly:p,set:f},s);case"emphasis":{const e=(a.weight??400)>=600,t=!1!==b?.italic;/* @__PURE__ */
27
+ return Z("div",{className:"es-ts-set","data-ts-setting":s,children:[
28
28
  /* @__PURE__ */Q("span",{className:"es-ts-sub",children:u.settings.emphasis}),
29
- /* @__PURE__ */Z("div",{className:"es-ts-icons",children:[_(u.bold,/* @__PURE__ */Q(W,{className:"es-ts-icon","aria-label":u.bold,"aria-pressed":e,disabled:p,onClick:()=>f({weight:e?400:700}),children:/* @__PURE__ */Q(R,{size:16})})),p||s?_(u.italic,/* @__PURE__ */Q(W,{className:"es-ts-icon","aria-label":u.italic,"aria-pressed":Boolean(a.italic),disabled:p,onClick:()=>f({italic:!a.italic||void 0}),children:/* @__PURE__ */Q(U,{size:16})})):/* @__PURE__ */Q(W,{className:"es-ts-icon","aria-label":u.italic,"aria-pressed":Boolean(a.italic),"aria-disabled":!0,disabledReason:u.italicMissing,children:/* @__PURE__ */Q(U,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
30
- return Q(de,{value:y.letterCase??a.letterCase,auto:E("letterCase"),words:u,readOnly:p,set:f},t);case"largestSize":return"heading"===s.kind?X(t):null;default:return X(t)}})]})}function re({value:e,fonts:s,words:t,readOnly:a,set:l}){const i=X();/* @__PURE__ */
29
+ /* @__PURE__ */Z("div",{className:"es-ts-icons",children:[_(u.bold,/* @__PURE__ */Q(W,{className:"es-ts-icon","aria-label":u.bold,"aria-pressed":e,disabled:p,onClick:()=>f({weight:e?400:700}),children:/* @__PURE__ */Q(R,{size:16})})),p||t?_(u.italic,/* @__PURE__ */Q(W,{className:"es-ts-icon","aria-label":u.italic,"aria-pressed":Boolean(a.italic),disabled:p,onClick:()=>f({italic:!a.italic||void 0}),children:/* @__PURE__ */Q(U,{size:16})})):/* @__PURE__ */Q(W,{className:"es-ts-icon","aria-label":u.italic,"aria-pressed":Boolean(a.italic),"aria-disabled":!0,disabledReason:u.italicMissing,children:/* @__PURE__ */Q(U,{size:16})})]})]},s)}case"letterCase":/* @__PURE__ */
30
+ return Q(de,{value:y.letterCase??a.letterCase,auto:E("letterCase"),words:u,readOnly:p,set:f},s);case"largestSize":return"heading"===e.kind?X(s):null;default:return X(s)}})]})}function re({value:e,fonts:s,words:t,readOnly:a,set:l}){const i=X();/* @__PURE__ */
31
31
  return Z("div",{className:"es-ts-set","data-ts-setting":"font",children:[
32
32
  /* @__PURE__ */Q("span",{className:"es-ts-sub",id:i,children:t.settings.font}),
33
33
  /* @__PURE__ */Q(x,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>l({font:e}),ariaLabelledBy:i,readOnly:a})]})}function oe({value:e,hex:s,colours:t,words:a,readOnly:l,set:i}){/* @__PURE__ */
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "27.1.0",
3
+ "version": "27.3.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",
7
- "homepage": "https://github.com/Efficient-Pty-Ltd/efficient-easel#readme",
7
+ "homepage": "https://github.com/eff-erp/efficient-easel#readme",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "git+https://github.com/Efficient-Pty-Ltd/efficient-easel.git"
10
+ "url": "git+https://github.com/eff-erp/efficient-easel.git"
11
11
  },
12
12
  "bugs": {
13
- "url": "https://github.com/Efficient-Pty-Ltd/efficient-easel/issues"
13
+ "url": "https://github.com/eff-erp/efficient-easel/issues"
14
14
  },
15
15
  "publishConfig": {
16
16
  "access": "public"
@@ -108,6 +108,7 @@
108
108
  "./screen/lib/document/field-markers",
109
109
  "./screen/lib/document/image-fields",
110
110
  "./screen/lib/document/shadow-fields",
111
+ "./screen/lib/document/new-child",
111
112
  "./screen/lib/document/palette-sections",
112
113
  "./screen/lib/document/panel-fields",
113
114
  "./screen/lib/document/panel-no-control-mark",
@@ -513,6 +514,11 @@
513
514
  "import": "./dist/screen/lib/document/hidable.js",
514
515
  "default": "./dist/screen/lib/document/hidable.js"
515
516
  },
517
+ "./screen/lib/document/new-child": {
518
+ "types": "./dist/screen/lib/document/new-child.d.ts",
519
+ "import": "./dist/screen/lib/document/new-child.js",
520
+ "default": "./dist/screen/lib/document/new-child.js"
521
+ },
516
522
  "./screen/lib/document/palette-sections": {
517
523
  "types": "./dist/screen/lib/document/palette-sections.d.ts",
518
524
  "import": "./dist/screen/lib/document/palette-sections.js",
@@ -1 +0,0 @@
1
- import{useScreenBlockRules as e}from"./chunk-TUIBPB77.js";import{newNodeId as t,ROOT_ZONE as n}from"./chunk-TCAAOYQY.js";import{useEasel as o,useEaselApi as r}from"./chunk-L36E2WCO.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,2 +0,0 @@
1
- import{Accordion as e}from"efficient-shell/ui";import{jsx as n}from"react/jsx-runtime";var t=Object.freeze(["Design","Animation"]),o=Object.freeze(["Content","Size","Design","Layout","Position","Anchor"]);function i({title:t,open:o,onToggle:i,count:l,level:r=3,id:s,children:a,className:c}){const d=s??"group";/* @__PURE__ */
2
- return n(e,{level:r,keepMounted:!0,openIds:o?[d]:[],onOpenChange:e=>i(e.includes(d)),items:[{id:d,headId:s,title:t,count:l,className:c?`es-panel-band ${c}`:"es-panel-band",content:a}]})}export{o as DESIGN_GROUPS,t as SETTINGS_BUCKETS,i as SettingsGroup};
@@ -1,64 +0,0 @@
1
- import{markedTreeNodeId as e,revealSelectedTreeRow as n,sameSelector as t}from"./chunk-UMBNBCL4.js";import{cloneNodeWithFreshIds as o}from"./chunk-OXZDSOZV.js";import{dedupeSlotChildren as r}from"./chunk-7OCEPOEJ.js";import{styleClipboardOf as i}from"./chunk-VNUXFD4X.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s}from"./chunk-LUOY3A3Q.js";import{useEaselKeyTarget as d,useEaselUndoKeys as a,useEaselSaveKey as c,editorRootFocus as p}from"./chunk-RTMDZJNE.js";import{SlotChildActionsProvider as u}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as h,clampPanelWidth as m}from"./chunk-TQUEVJOO.js";import{usePartBridge as g}from"./chunk-J5VPNHOW.js";import{useSectionOps as y}from"./chunk-3FANFZ4D.js";import{PageEditGuardNotices as b}from"./chunk-XV5D4V2T.js";import{ScreenSaveIcon as v,ScreenMainButton as k}from"./chunk-2EEYFRQM.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{useScreenDocument as w}from"./chunk-OB4KI2AN.js";import{requestMediaPick as x}from"./chunk-5HYVOOH3.js";import{AddChildRow as z}from"./chunk-5545A3PC.js";import{AddSidePanel as C}from"./chunk-GJ427TZL.js";import{keepsSharedSections as O,sharedSectionsOf as N}from"./chunk-N3MJOHAG.js";import{PanelHideButton as I,SidePanelHead as B,PanelShowStrip as P}from"./chunk-MTWQYLJE.js";import{offeredChoices as $}from"./chunk-RUQOIQWI.js";import{useScreenSaveSwitch as E,useScreenNodeKeys as M,useScreenPinned as T,useScreenDocumentLabel as j,useScreenCanvasFrame as L,useScreenInspectorPanel as A,useScreenDevices as R,useScreenPickFollowsSelection as F,useScreenLeftView as D,SELECTION_MODE as V,isSelectionMode as W,sameInspectorMode as H,useScreenBridges as Y,useScreenBlockRules as U,useScreenBlockLook as J,useScreenStorageNamespace as X,useScreenNotify as G,useScreenCanvasHead as Q,isSlotMode as K,useScreenStyleClipboard as Z,useScreenDocumentPass as _,useScreenCanvasDrag as q,ScreenCanvasTargetProvider as ee,isPinnedFirst as ne,isPinnedLast as te,screenSlotsOf as oe,shownChildSlotsOf as re}from"./chunk-TUIBPB77.js";import{MediaPopup as ie}from"./chunk-T2RINM7R.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-NCXYC7WI.js";import{useNodeClipboard as pe,useNodeContextMenu as ue}from"./chunk-WW24O7HT.js";import{useEaselSession as fe}from"./chunk-YM4UEGBV.js";import{useEaselHost as he,useHostEscape as me}from"./chunk-LX23TCTP.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as be}from"./chunk-G2VZ4DET.js";import{heldStyle as ve,styleShortcut as ke}from"./chunk-3OOYGEJY.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 Oe,blockNodeActions as Ne,TREE_MAX_DEPTH as Ie,childSlotsOf as Be,slotFieldsOf as Pe,newNodeId as $e,slotChildrenIn as Ee,nestsInTree as Me}from"./chunk-TCAAOYQY.js";import{useEasel as Te,useEaselApi as je,useSettledAction as Le,subscribeLateWrites as Ae,CanvasPartsContext as Re,partHasOwnBox as Fe,CanvasPassThroughContext as De,CanvasSharedContext as Ve}from"./chunk-L36E2WCO.js";import{TreeRow as We,Subtree as He,LayersTree as Ye,TreeGroupLabel as Ue,TreeRowAction as Je,TreeSeam as Xe}from"./chunk-WHS6Y55E.js";import{DEFAULT_TREE_WORDS as Ge}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Qe}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ke,useNodeOps as Ze,clickPick as _e}from"./chunk-TF6NAIV7.js";import{EaselTopBar as qe,EaselIconButton as en,TopBarCluster as nn,DeviceSwitch as tn,InspectorIconButton as on,PanelResizeHandle as rn,MAX_PANEL_W as ln,MIN_PANEL_W_BY_SIDE as sn,panelWidthVars as dn}from"./chunk-VTY7OQB5.js";import{DEFAULT_NOTICE_WORDS as an,DEFAULT_CHROME_WORDS as cn}from"./chunk-AJSDWWJW.js";import{holderOf as pn,nameOrSomeone as un}from"./chunk-G7J6SGMF.js";import{DEFAULT_LOCK_WORDS as fn}from"./chunk-RE4LP46F.js";import{useWords as hn}from"./chunk-MFIRYGHW.js";import{insertSeams as mn,CanvasDragLayer as gn,CanvasInsert as yn}from"./chunk-SEC6NV6Y.js";import{DEFAULT_DRAG_WORDS as bn}from"./chunk-TQ5Y6S2X.js";import{createDragSession as vn,useTreeDrag as kn,gapToMoveIndex as Sn}from"./chunk-QEEW4X64.js";import{ROOT_ID as wn,ROOT_SLOT as xn,zoneKey as zn,parseZoneKey as Cn,find as On,DataError as Nn}from"./chunk-YDTEYXQW.js";import{useCanvasFrame as In,LIST_SELECTOR as Bn,BLOCK_SELECTOR as Pn,useCanvasTyping as $n,useCanvasEvent as En,onMotionEnd as Mn}from"./chunk-6GJEOER4.js";import{nodeIdAt as Tn,frameRectToHost as jn,BLOCK_ATTRIBUTE as Ln,drawnBox as An}from"./chunk-FR7EEKFF.js";import{queryMainCopy as Rn}from"./chunk-7UFKEX72.js";import{useRef as Fn,useMemo as Dn,useState as Vn,useEffect as Wn,useCallback as Hn,useLayoutEffect as Yn,useContext as Un,Fragment as Jn,useId as Xn}from"react";import{ColoredBadge as Gn,Button as Qn,Tabs as Kn,toast as Zn,readMediaFileDrag as _n,Tooltip as qn,groupColors as et,Dialog as nt,FormField as tt,Input as ot,MEDIA_FILE_DRAG_TYPE as rt}from"efficient-shell/ui";import{UndoIcon as it,RedoIcon as lt,RefreshIcon as st,AddIcon as dt,TrashIcon as at,EyeOffIcon as ct,EyeIcon as pt,SharedIcon as ut,DuplicateIcon as ft}from"efficient-shell/icons/efficient";import{jsx as ht,jsxs as mt,Fragment as gt}from"react/jsx-runtime";var yt="media-file";function bt({name:e,onMake:n,onCancel:t}){const o=hn("screen",be).shared,[r,i]=Vn(e),[l,s]=Vn(!1),d=Xn(),a=Fn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
2
- return ht(nt,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */mt(gt,{children:[
3
- /* @__PURE__ */ht(Qn,{variant:"secondary",onClick:t,children:o.cancel}),
4
- /* @__PURE__ */ht(Qn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */ht("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */ht(tt,{label:o.name,htmlFor:d,children:/* @__PURE__ */ht(ot,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var vt=/* @__PURE__ */new WeakSet;function kt(e,n,t){const o=On(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function St(e,n,t){const o=o=>o>=t.left&&o+e.width<=t.left+t.width&&n.every(n=>n.right<=o||n.left>=o+e.width||n.bottom<=e.top||n.top>=e.top+e.height);if(n.every(n=>n.right<=e.left||n.left>=e.left+e.width||n.bottom<=e.top||n.top>=e.top+e.height))return e.left;const r=n.map(e=>e.right+4).filter(n=>n>e.left&&o(n));if(r.length)return Math.min(...r);const i=n.map(n=>n.left-4-e.width).filter(n=>n<e.left&&o(n));return i.length?Math.max(...i):e.left}function wt({canvas:e,tabs:n,onSelect:t,onPointer:o}){const r=Fn(null),[i,l]=Vn({}),s=Fn({id:null,places:{},measure:null});s.current.places=i;const d=!(null===s.current.id||n.some(e=>e.id===s.current.id)&&i[s.current.id]);Wn(()=>{d&&(s.current.id=null,o(null))},[d,o]),Wn(()=>()=>{null!==s.current.id&&o(null)},[o]);const a=n.map(e=>`${e.id}:${e.below?1:0}:${e.label}:${e.reach??""}`).join("|");return Yn(()=>{const t=e?.document,o=e?.window,i=e?.frame;if(!t||!o||!i||0===n.length)return void l(e=>0===Object.keys(e).length?e:{});let d=0;const a=()=>{d=0;const e=r.current;if(!e)return;const a=jn(i,{left:0,top:0,width:o.innerWidth,height:o.innerHeight},e),p={};let u=!1;const f=e.getBoundingClientRect(),h=[...e.parentElement?.querySelectorAll(".es-canvas-handle.is-shown:not(.is-dragging), .es-canvas-tag, .es-canvas-hint")??[]].map(e=>{const n=e.getBoundingClientRect();return{left:n.left-f.left,top:n.top-f.top,right:n.right-f.left,bottom:n.bottom-f.top}});for(const r of n){const n=o.CSS?.escape?o.CSS.escape(r.id):JSON.stringify(r.id).slice(1,-1),l=Rn(t,`[${Ln}="${n}"]`),d=l?An(l):null;if(!d||0===d.height){p[r.id]=null;continue}const c=jn(i,{left:d.left,top:d.top,width:d.width,height:d.height},e),f=c.top+c.height;if(f<a.top||c.top>a.top+a.height){p[r.id]=null;continue}const m=r.below?f+4:Math.max(c.top,a.top)+6,g=e.querySelector(`[data-band-tab="${n}"]`);g||(u=!0);const y=Math.max(c.left,a.left)+6,b=g?.offsetHeight??0,v=g?.offsetWidth??0,k=s.current.id===r.id?s.current.places[r.id]:null,S=k?k.left:St({left:y,top:m,width:v,height:b},h,a);v>0&&b>0&&h.push({left:S,top:m,right:S+v,bottom:m+b}),p[r.id]={left:S,top:m}}l(e=>function(e,n){const t=Object.keys(e);return t.length===Object.keys(n).length&&t.every(t=>{const o=e[t],r=n[t];return o===r||!!o&&!!r&&o.left===r.left&&o.top===r.top})}(e,p)?e:p),u&&c()},c=()=>{d||(d=o.requestAnimationFrame(a))};s.current.measure=c,a(),o.addEventListener("scroll",c,!0),o.addEventListener("resize",c);const p=Mn(o,c),u=new o.MutationObserver(c);u.observe(t.body,{childList:!0,subtree:!0,attributes:!0});const f=r.current?.parentElement,h=f?.ownerDocument.defaultView?.MutationObserver,m=h?new h(c):null;return f&&m?.observe(f,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class","style"]}),()=>{d&&o.cancelAnimationFrame(d),o.removeEventListener("scroll",c,!0),o.removeEventListener("resize",c),p(),u.disconnect(),m?.disconnect(),s.current.measure=null}},[e,a]),/* @__PURE__ */ht("div",{ref:r,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=i[e.id];return n?/* @__PURE__ */ht("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onMouseEnter:()=>{s.current.id=e.id,o(e.id)},onMouseLeave:()=>{s.current.id=null,o(null),s.current.measure?.()},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
5
- /* @__PURE__ */ht(qn,{content:e.reach,children:/* @__PURE__ */mt(Gn,{colorClass:et("success","solid"),size:"sm",children:[
6
- /* @__PURE__ */ht("span",{className:"es-band-tab-mark",children:/* @__PURE__ */ht(ut,{size:12})}),e.label]})}):/* @__PURE__ */ht(Gn,{colorClass:et("info","solid"),size:"sm",children:e.label})},e.id):null})})}function xt({expand:e}){/* @__PURE__ */
7
- return ht("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */mt(gt,e?{children:[
8
- /* @__PURE__ */ht("path",{d:"M8 9l4-4 4 4"}),
9
- /* @__PURE__ */ht("path",{d:"M8 15l4 4 4-4"})]}:{children:[
10
- /* @__PURE__ */ht("path",{d:"M8 4l4 4 4-4"}),
11
- /* @__PURE__ */ht("path",{d:"M8 20l4-4 4 4"}),
12
- /* @__PURE__ */ht("path",{d:"M5 12h14"})]})})}var zt=`${Bn}, ${Pn}`;function Ct(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 Ot="__rungs",Nt=e=>"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:"preset"===e.kind?e.preset.key:e.type;var It="screen:band",Bt={duplicate:!0,delete:!0},Pt=()=>null;function $t(){const Bn=he(),jn=Bn.panels?.Toolbar,Ln=(Bn.panels?.useRight??Pt)(),{target:An,docId:Xn,capabilities:qn,currentSlug:et,siteId:nt,onPublish:tt,saveState:ot,saveConflict:ut,retrySave:St,toggleAutoSave:$t,flushSave:Et,access:Mt,saveUnreachable:Tt=!1,readOnly:jt,readOnlyReason:Lt=null}=w(),At=E(),Rt=M(),{mediaEditing:Ft,hasEditGuard:Dt,hasPinnedChrome:Vt}=qn,{appState:Wt,dispatch:Ht,history:Yt,selectedItem:Ut,getSelectorForId:Jt,config:Xt}=Te(e=>e),Gt=T(),{first:Qt,firstGroup:Kt,lastGroup:Zt,isSectionGroup:_t,sectionGroupZone:qt,panelOf:eo}=Gt,no=eo(Qt),to=e=>ne(Gt,e),oo=e=>te(Gt,e),ro="node"===Gt.firstRow,io=Gt.band??null,lo=hn("screen",be),so=hn("tree",Ge),ao=hn("drag",bn),co=hn("notice",an),po=hn("lock",fn),uo=hn("menu",Qe),fo=hn("styleClipboard",Se),ho=hn("chrome",cn),mo=j()??`/${et}`,go=L(),yo=A(),bo=y({readOnly:jt}),vo=y({readOnly:jt,foldIntoHistory:!0}),ko=Fn(null),So=je(),wo=Dn(()=>({...bo,select:e=>{ko.current=e,bo.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=So.config;ko.current=Ke(e,t,n)}bo.commitDocument(e,n)}}),[bo,So]),xo=Wt.ui,zo=xo.leftSideBarVisible,Co=xo.rightSideBarVisible,{options:Oo,widths:No,initial:Io,fluid:Bo,fit:Po}=R(),[$o,Eo]=Vn(Io),Mo=le(),To=Ft&&null!==Mo;se(),de();const jo=ae();F(Ut?.props.id);const{read:Lo,write:Ao,forSelection:Ro}=D(),[Fo,Do]=Vn(Lo);Wn(()=>{Ao(Fo)},[Fo]);const[Vo,Wo]=Vn(0),Ho=Fn(null),Yo=Fn(null),Uo=In(Yo,{readySelector:zt}),Jo=$n(Uo),Xo=d(Yo);a(Yo,Uo);const Go=S(),Qo=pn(Mt),Ko={state:ot,offline:Go||ot.failed&&Tt,readOnlyReason:Lt,editing:Qo?co.editing({name:un(Qo.name,po),noun:lo.noun}):null,conflict:null!=ut,notSaving:lo.bar.notSaving},Zo=Le({onPress:()=>{jt||(ot.failed?St():Et())}}).onPress;c(Yo,Uo,Zo);const[_o,qo]=Vn(!1),er=Fn(!1),[nr,tr]=Vn(null),[or,rr]=Vn([]),[ir,lr]=Vn(V);W(ir);const sr=e(ir,Ut?.props.id),[dr,ar]=Vn(null);Wn(()=>{dr&&(n(),ar(null))},[dr]);const cr=Fn(Jt);cr.current=Jt;const pr=Hn((e,{scroll:n})=>{Do(n=>Ro(e,n)),n&&ar(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=cr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Vr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),ur=Fn(null);Wn(()=>{const e=ur.current;ur.current=null;const n=null==Ut?.props.id?null:String(Ut.props.id);lr(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:eo(Ut?.type)??V);const o=Ut?.props.id,r=ko.current;if(ko.current=null,!o)return;const i=Jt(o);pr(String(o),{scroll:!t(r,i??null,Oe)})},[Ut?.props.id,pr]);const fr=Hn(e=>{lr(n=>H(n,e)?n:e),Ht({type:"setUi",ui:{rightSideBarVisible:!0}})},[Ht]),hr=Fn(()=>{});hr.current=(e,n)=>{const t=e?Ri(e.zone??Oe)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Ut?.props.id?null:String(Ut.props.id);lr(e=>H(e,n)?e:n),o!==r&&(ur.current={id:o,mode:n},wo.select(e))};const mr=Hn((e,n)=>hr.current(e,n),[]),gr={kind:ir.kind,mode:ir,open:fr,show:e=>lr(e),reveal:()=>{Co||Ht({type:"setUi",ui:{rightSideBarVisible:!0}})},select:mr},yr=Y(gr,{data:Wt.data,selected:Ut??null,zoneOf:e=>Jt(e)?.zone,readOnly:Boolean(jt),select:e=>{lr(V),wo.select({index:e})},replace:(e,n)=>wo.replaceComponent(Oe,e,n),scrollTo:e=>l(e)},{device:$o,refreshes:Vo},{setView:Do,reveal:()=>{zo||Ht({type:"setUi",ui:{leftSideBarVisible:!0}})}}),br=yr.resolveLeftView?yr.resolveLeftView(Fo):"sections",vr=U(),{isLockedBlock:kr,duplicateBlocked:Sr,nestDepth:wr,newSectionNode:xr,canAddTo:zr,blockIsOffered:Cr}=vr,Or=e=>({id:String(e.props.id??""),data:Wt?.data}),Nr=J(),{labelAtLevel:Ir,Icon:Br,useProducts:Pr}=Nr,$r=Nr.rowName?(e,n,t)=>Nr.rowName(e,n,t):void 0,Er=Hn(e=>{Ht({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),pr(e,{scroll:!0})},[Ht,pr]),{selectNode:Mr,openPartId:Tr}=g({mode:ir,setMode:lr,onOpenPart:Er}),[jr,Lr]=Vn(null);me(null!==jr,()=>Lr(null));const Ar=f(X()),Rr=Ar.collapsed,Fr=Ar.panelWidths,[Dr,Vr]=Vn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Rr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
- return new Set}});Wn(()=>{try{window.localStorage.setItem(Rr,JSON.stringify([...Dr]))}catch{}},[Dr]);const[Wr,Hr]=Vn(()=>{if("undefined"==typeof window)return{...h};try{const e=window.localStorage.getItem(Fr);if(!e)return{...h};const n=JSON.parse(e);return{left:m(Number(n.left)||h.left,"left"),right:m(Number(n.right)||h.right,"right")}}catch{return{...h}}});Wn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Fr,JSON.stringify(Wr))}catch{}},300);return()=>clearTimeout(e)},[Wr]);const Yr=Hn((e,n)=>Hr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Ur=Hn(e=>Yr("left",e),[Yr]),Jr=Hn(e=>Yr("right",e),[Yr]),Xr=e=>Dr.has(e),Gr=e=>Vr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Qr=Fn(!1),Kr=Fn(null);Wn(()=>{if(Qr.current&&!_o){const e=Kr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Yo.current?.querySelector(`button[aria-label="${CSS.escape(lo.add.title)}"]`))?.focus(),Kr.current=null}Qr.current=_o},[_o]),Wn(()=>{if(!_o||!Xo)return;const e=e=>{"Escape"===e.key&&yl()};return Xo.addEventListener("keydown",e),()=>Xo.removeEventListener("keydown",e)},[_o,Xo]),me(_o,()=>yl()),Wn(()=>{!zo&&_o&&(qo(!1),tr(null),er.current=!1)},[zo]);const Zr=G(),_r=(e,n="success",t)=>{if(Zr)return void(t?Zr(e,"error"===n?"error":"info",t):Zr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Zn.error(e,{...o,duration:t?.duration??3200}):Zn.success(e,{...o,duration:t?.duration??1900})},qr=Le(yr.mainAction??{label:lo.done,onPress:()=>{tt(So.getState().appState.data)}}),ei=Fn(_r);ei.current=_r,Wn(()=>Ae(So,()=>ei.current(lo.writeLate,"error")),[So,lo]);const ni=Fn(null),[ti,oi]=Vn(0),[ri,ii]=Vn(0),li=Q(),si=Fn(null),di=e=>Math.max(0,e.clientHeight-(si.current?.offsetHeight??0));Wn(()=>{const e=ni.current;if(!e)return;const n=()=>{oi(e.clientWidth),ii(di(e))};n();const t=new ResizeObserver(n);return t.observe(e),si.current&&t.observe(si.current),()=>t.disconnect()},[]),Yn(()=>{ni.current&&(oi(ni.current.clientWidth),ii(di(ni.current)))},[Wr,zo,Co]);const ai=$o===Bo?ti>0?ti:No[Bo]:No[$o],ci=ti>0?Math.min(ti/ai,"shrink"===Po?1:2):1,pi=ai*ci,ui=ti>0&&pi>ti+1,fi={width:pi,height:ri||"100%",flex:"none",position:"relative"},hi={width:ai,height:ri?ri/ci:"100%",maxHeight:"none",transform:1!==ci?`scale(${ci})`:void 0,transformOrigin:"top left"},mi=()=>Ht({type:"setUi",ui:{leftSideBarVisible:!zo}}),gi=()=>Ht({type:"setUi",ui:{rightSideBarVisible:!Co}}),yi=e=>{_o&&(qo(!1),tr(null),er.current=!1,zo&&Fo===e)||(Do(e),zo||Ht({type:"setUi",ui:{leftSideBarVisible:!0}}))},bi=()=>{lr(no??V),Co||Ht({type:"setUi",ui:{rightSideBarVisible:!0}})},vi=Wt.data.content??[],ki=()=>{const e=vi.findIndex(to),n=vi.findIndex(oo);return{floor:e>=0?e+1:0,cap:n>=0?n:vi.length}},Si=Xt,wi=vr.stripCopy,xi=e=>o(e,wi),zi=pe(),Ci=Ze({data:Wt.data,config:Si,readOnly:Boolean(jt),clipboard:zi,strip:wi?e=>wi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==wn||e.slot!==xn)return{min:0,max:n-1};const{floor:t,cap:o}=ki();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&lr(V);const t=void 0===n||"node"===n?.kind?n:null;wo.commitDocument(e,t)}}),Oi=fe(),[Ni,Ii]=Vn(null),Bi=e=>{const n=vi.find(n=>String(n.props.id)===e),t=Gt.shared;n&&t&&Ci.swap(e,t.detach(n))},Pi=e=>{const n=On(Wt.data,Xt,e);if(!n)return!1;const t=zn(n.place),o=n.node,r=t===Oe?ji(o):Ki(o),i=t===Oe?Gt.shared?.usedOn(o):null;return!!Ci.remove(e)&&(_r(i?lo.shared.removed({count:Math.max(0,i.length-1)}):lo.deleted({name:r}),"success",{duration:8e3,action:{label:lo.bar.undo,onClick:()=>{Ci.restore(n.node,n.place)}}}),!0)},$i={...Ci,remove:Pi},Ei=e=>Ir(e,"block",Xt.components[e]?.label??e),Mi=Hn(e=>Xt.components[e]?.defaultProps??{},[Xt]),Ti=e=>Ir(e,"section",Ei(e)),ji=e=>we({type:e.type,props:e.props??{}},Ti(e.type),$r),{nodeAddresses:Li,zoneItems:Ai}=Dn(()=>{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>=Ie)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Be(Xt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(vi,Oe,0),{nodeAddresses:e,zoneItems:n}},[vi,Xt]),Ri=Hn(e=>Ai.get(e)??[],[Ai]),Fi=e=>{const n=Li.get(e);return n?Ri(n.zone)[n.index]:void 0},Di=e=>oe(vr,Xt,e),Vi=e=>{if(!vr.slotsOf||e===Oe)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Fi(e.slice(0,n));if(!t)return null;const o=Di(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}},Wi=(()=>{if(!K(ir))return null;const e=`${ir.nodeId}:${ir.slot}`;return Vi(e)?.slot.panel===ir.kind?e:null})(),Hi=Fn(null);Wn(()=>{const e=Hi.current;if(Hi.current=null,!Wi||!K(ir))return;const n=ir.nodeId;pr(n,{scroll:e!==Wi}),Vr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[ir]);const Yi=e=>{const n=Li.get(e);n&&(n.zone===Oe?cl(n.index):Al(n.zone,n.index,e,Fi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))},Ui=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void Yi(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Wi!==i&&(Hi.current=i),mr(null,r),Co||Ht({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ji=(e,n,t)=>{const o=`${e}:${n}`;if(Vr(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;Wi!==o&&(Hi.current=o);mr(null,{kind:t,nodeId:e,slot:n})},Xi=(e,n,t)=>{if(jt||!vr.moveSlot)return;const o=Fi(e),r=o?Di(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Ot,index:n},s=Sn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=vr.moveSlot(e,n,s);"string"==typeof d&&Ji(e,d,i.panel)},Gi=Pr(),Qi=Dn(()=>{const e=/* @__PURE__ */new Map;for(const n of Gi??[])e.set(n.slug,n.name);return e},[Gi]),Ki=e=>xe(e,Ei,Nr.plainText,e=>Qi.get(e),Nr.rowName),Zi=(e,n)=>{const t=Xt.components[e.type]?.fields,o=n===Oe||as(n)?"section":"block",r=n===Oe&&(to(e)||oo(e)||_t(e.type)),i="block"===o?ze(t):r?null:Ce(t);return Nr.renamePropOf?Nr.renamePropOf(e,o,i):i},_i=(e,n,t,o)=>{if(!(!jt&&jr?.zone===e&&jr.index===n))return;const r=(t,o)=>{Lr(null),o&&((e,n,t)=>{const o=Ri(e)[n];if(!o)return;const r=Zi(o,e);r&&wo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
- return ht("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":lo.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)},qi=i(Z(),fo),el=qi.scope({target:An,siteId:nt,docId:Xn}),nl=Xt,tl=(e,n)=>n===Oe?Ti(e):Ei(e),ol=(e,n,t)=>{const o=qi.plan(el,t,tl(t.type,e),nl);o&&(o.changed&&wo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),_r(o.message))},rl=ue({nodesIn:Ri,nodeAt:(e,n)=>Ri(e)[n]??null,labelOf:(e,n)=>n===Oe?Ti(e):Ei(e),renamePropOf:Zi,beginRename:(e,n)=>Lr({zone:e,index:n}),history:{hasPast:Yt.hasPast,hasFuture:Yt.hasFuture,back:()=>Yt.back(),forward:()=>Yt.forward()},openPageStyles:yr.openPageStyles,pageStylesLabel:lo.pageStyles,words:{menu:uo,styleClipboard:fo,screen:lo.menu},readOnly:Boolean(jt),collapseAll:()=>Vr(new Set(Ri(Oe).map(e=>String(e.props.id)))),onPasteRefused:e=>_r(e?lo.pasteRefused({name:e.label}):lo.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>us(e,n),copyItem:yr.onCopyItem,menuRows:(e,n,t)=>{const o=yr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Gt.shared;if(!t||n!==Oe)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:lo.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return jt||kr(e.type,e)?n:{...n,change:[{label:lo.shared.detach,onClick:()=>Bi(e.props.id)}],remove:[{label:lo.shared.removeFromPage,danger:!0,onClick:()=>{Pi(e.props.id)}}]}}return jt||to(e)||oo(e)||_t(e.type)?null:O(Oi)?{change:[{label:lo.shared.makeShared,onClick:()=>Ii({id:e.props.id,name:ji(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=>kr(e.type,e),duplicateBlocked:e=>Sr(Wt.data,e),permits:e=>{const n=Ne(Xt,e.type);return Gt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:$i,isPinned:(e,n)=>n===Oe&&(to(e)||oo(e)),sectionBand:ki,locate:e=>Li.get(e)??null,rowNameOf:(e,n)=>n===Oe?ji(e):Ki(e),selectAt:(e,n,t,o)=>{e===Oe?cl(n):Al(e,n,t,o??"")},slotRung:e=>{const n=Vi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ui(n.node,n.slot,!1)}:null},style:{held:()=>ve(el),canCopy:e=>qi.rows(nl,e).some(e=>!1!==e.counted),copy:(e,n)=>qi.copy(el,e,tl(e.type,n),nl),paste:(e,n,t)=>ol(e,n,t)},keys:Rt?{target:Xo,selected:()=>{const e=Wt.ui.itemSelector;return e?{zone:e.zone??Oe,index:e.index}:null},held:()=>zi.get(),readOnly:Boolean(jt),onDone:({done:e,name:n})=>{"copied"===e&&_r(lo.copied({name:n}))}}:void 0},Uo),il=Fn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Wn(()=>{il.current={copy:(e,n)=>qi.copy(el,e,tl(e.type,n),nl),paste:ol,at:()=>{const e=Wt.ui.itemSelector;if(!e)return null;const n=e.zone??Oe,t=Ri(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(jt)}});const ll=Hn(e=>{const n=ke(e);if(!n)return;const t=il.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))},[]);Wn(()=>{if(!Xo)return;const e=e=>ll(e);return Xo.addEventListener("keydown",e),()=>Xo.removeEventListener("keydown",e)},[ll,Xo]),En(Uo,"keydown",ll);const sl=vi.map(e=>e.props.id).join("|");Wn(()=>{const e=Uo?.document??null,n=Uo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void rr(e=>e.length?[]:e);const n=vi.findIndex(oo),t=n>=0?n:vi.length,o=n=>{const t=vi[n]?.props?.id;return null==t?null:Rn(e,`[data-easel-block="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Pn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=vi.length>0&&!to(vi[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=Ct(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})}rr(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=Mn(n,i),s=new ResizeObserver(i);return s.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l(),s.disconnect()}},[Uo,sl,$o,ci,zo,Co,Ut?.props.id]);const dl=Uo?.document??null,al=Uo?.window??null;Wn(()=>{const e=Ho.current;if(!e||!dl||!al)return;const n=[],t=()=>{const n=Rn(dl,`[data-easel-block="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&al.scrollTo({left:al.scrollX,top:al.scrollY+t,behavior:"instant"}),!0};return Ho.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[dl,al]);const cl=e=>{lr(V),wo.select({index:e}),yr.sectionPressed?.(vi[e]);const n=vi[e]?.props?.id;n&&l(n)},pl=e=>{const{floor:n,cap:t}=ki(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Ut&&ir.kind!==no?.kind?vi.findIndex(e=>e.props.id===Ut.props.id):-1;return o(r>=0?r+1:t)},ul=(e,n)=>{const{floor:t,cap:o}=ki(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(wo.reorderComponent(Oe,e,i),wo.select({index:i}),{moved:!0,dest:i})},fl=(e,n,t,o)=>{lr(V),wo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),_r(lo.sectionAdded({name:t}))},hl=(e,n)=>{const t=pl(n),o=xr(e,{nodeDefaults:Mi,newNodeId:$e,sectionLabel:Ti,blockIsOffered:Cr}),r=o?wo.insertNode(Oe,t,o):wo.insertSection(e,t);return fl(t,r,Ti(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(Xt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=zr(e.type,l,d.slice(d.lastIndexOf(":")+1),Or(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},ml=e=>gl(Oe,e),gl=(e,n)=>{Kr.current=document.activeElement??null,tr(null===n?null:{zone:e,index:n}),qo(!0),zo||(er.current=!0,Ht({type:"setUi",ui:{leftSideBarVisible:!0}}))},yl=()=>{qo(!1),tr(null),er.current&&Ht({type:"setUi",ui:{leftSideBarVisible:!1}}),er.current=!1},bl=(e,n)=>Nr.rowName?n?to(e)?Nr.rowName(e,"section",lo.header):oo(e)?Nr.rowName(e,"section",lo.footer):_t(e.type)?Nr.rowName(e,"section",Ei(e.type)):ji(e):Ki(e):n?Ti(e.type):Ei(e.type),vl=e=>n=>{e()},kl=(e,n,t)=>{if(jt)return null;const o=Ri(e)[n];return o&&!Ne(Xt,o.type).delete||o&&kr(o.type,o)?null:/* @__PURE__ */ht(Je,{kind:"delete",label:e===Oe&&o&&Gt.shared?.usedOn(o)?lo.shared.removeFromPage:lo.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Ri(e)[n]?.props?.id;null!=t&&Pi(String(t))})(e,n),children:/* @__PURE__ */ht(at,{size:15})})},Sl=e=>Nr.rowPreview?.(e)||void 0,wl=e=>Nr.rowMarks?.(e)??void 0,xl=(e,n,t)=>Nr.rowActions?.(e,n,t)??null,zl=(e,n,t,o)=>{if(jt)return null;if(kr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
- return ht(Je,{kind:"eye",label:r?lo.showNamed({name:o}):lo.hideNamed({name:o}),onClick:()=>Ol(e,n,t),children:/* @__PURE__ */ht(r?ct:pt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},Cl=e=>id(Oe,e),Ol=(e,n,t)=>{wo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},Nl=e=>Pe(Xt,e),Il=e=>Be(Xt,e),Bl=e=>vr.slotsOf?Di(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Ee(e,n.slot)})):[{slot:null,rung:null,kids:re(Xt,e)}],Pl=e=>vr.slotsOf?Bl(e).flatMap(e=>e.kids):re(Xt,e),$l=e=>Boolean(vr.slotsOf)&&Di(e).some(e=>e.rung),El=(e,n,t)=>zr(e.type,n,t??void 0,Or(e)),Ml=(e,n,t)=>{const o=Me(Xt,e.type,n)&&(t||Pl(e).length>0||$l(e));return{collapsible:o,folded:o&&Xr(String(e.props.id))}},Tl=(e,n,t)=>Bl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Ml(e,r,t(e.type)).collapsible?[String(e.props.id),...Tl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),jl=e=>Pl(e).length>0||$l(e)||Boolean(zr(e.type)),Ll=e=>Boolean(zr(e)),Al=(e,n,t,o)=>{if(lr(V),zr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),wo.select({index:n,zone:e}),l(t)}else wo.select({index:n,zone:e}),l(t)},Rl=(e,n,t,o,r)=>{const i=`${e}:${n}`;wo.insertComponent(i,t,o),zr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),wo.select({index:o,zone:i})}):wo.select({index:o,zone:i})},Fl=Fn(/* @__PURE__ */new Set);Wn(()=>{vi.forEach(e=>{const n=zr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Fl.current.has(t))return;Fl.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(Mi)).forEach((e,t)=>vo.seedChild(o,t,n.childType,e))})},[vi,vo,Mi]);const Dl=Fn(/* @__PURE__ */new Set);Wn(()=>{vi.forEach((e,n)=>{const t=e.props.id;if(Dl.current.has(t))return;const o=r(e,Nl(e.type));Dl.current.add(t),o&&vo.replaceComponent(Oe,n,{...e,props:o})})},[vi,vo]),_(vo,Xt);const Vl=vi.findIndex(oo),Wl=Vl>=0?vi[Vl]:null,Hl=ro?vi.findIndex(to):-1,Yl=Hl>=0?vi[Hl]:null,Ul=Gt.groupTab,Jl=Dn(()=>Ul?e=>_t(e.type):void 0,[Ul]),Xl=Boolean(Gt.groupBadge),Gl=Gt.sharedReach,Ql=e=>Gl?.(e)??void 0,Kl=Dn(()=>Gl?new Set(vi.filter(e=>Ql(e)).map(e=>String(e.props.id))):null,[vi,Gl]),Zl=Dn(()=>Kl?e=>Kl.has(e):void 0,[Kl]),_l=Gt.first?Gl?.({type:Gt.first,props:{id:""}})??void 0:void 0,ql=Gt.groupBadge?/* @__PURE__ */ht("span",{className:"es-tree-group-badge",children:/* @__PURE__ */ht(Gn,{tone:"info",size:"xs",children:Gt.groupBadge})}):void 0,es=vi.find(e=>e.type===Kt)??null,ns=vi.find(e=>e.type===Zt)??null,ts=Vl>=0?Vl:vi.length,os=[];vi.forEach(e=>{oo(e)||(jl(e)&&os.push(String(e.props.id)),os.push(...Tl(e,1,Ll)))}),Wl&&(os.push(String(Wl.props.id)),os.push(...Tl(Wl,1,Ll)));const rs=os.length>0&&os.every(e=>Dr.has(e)),is=e=>{const n=Nr.blockRowName(e,Ei);return Nr.rowName?Nr.rowName(e,"block",n):n},ls=(e,n,t,o)=>{const r=Ri(e)[t];if(!r)return;const i={...Cn(e),index:t},l={...Cn(n),index:Math.min(Math.max(o,0),Ri(n).length)},s=Sn(i,l);if(e!==n||s!==t)try{Ci.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Nn))throw e}},ss=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Il(e))n.add(r),t(o)};for(const t of Nl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ds=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Li.get(n);if(!e)return null;if(e.zone===Oe)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},as=e=>{const n=e.slice(0,e.indexOf(":")),t=vi.find(e=>_t(e.type)&&String(e.props.id)===n);return t&&qt(n)===e?t:null},cs=(e,n)=>{const t=as(e);return!t||(!Gt.groupAccepts||Gt.groupAccepts(t.type,n,Ri(e).length))},ps=(e,n,t)=>{if(e.rung){const t=Fi(e.rung.nodeId),o=t?Di(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Ot&&n.index>=0&&n.index<=o}if(n.slot===Ot)return!1;if(e.add)return ms(e.add,n);const o=zn(n);if(_t(e.type))return!1;const r=as(o),i=as(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!cs(o,e.type))&&(n.index>=0&&n.index<=Ri(o).length));if(e.zone===Oe||o===Oe){if(e.zone!==o)return!1;const{floor:t,cap:r}=ki();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Ri(o).length)return!1;if(e.zone===o)return!0;const l=Wl&&!Gt.lastIsOpen?String(Wl.props.id):null;return(!l||ds(e.zone)!==l&&ds(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Ri(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Li.get(i),s=l?Ri(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&ss(r).has(n))return!1;const d=zr(s.type,wr(Wt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1),Or(s));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Ri(n),r))})(e.zone,o,e.index,t)},us=(e,n)=>{const t=zn(e.from),o=e.node;return t===zn(n)?cs(t,o.type):ps({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},fs=e=>{const n=e.slice(0,e.indexOf(":")),t=Li.get(n),o=t?Ri(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=zr(o.type,wr(Wt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1),Or(o));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=$(r.choices??(r.spec?[{type:r.spec.childType,label:Ei(r.spec.childType)}]:[])),l=Vi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:bl(o,t.zone===Oe)}},hs=(e,n)=>{if("section"!==e.kind)return e;const t=zn(n);return t===Oe||as(t)?e:fs(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},ms=(e,n)=>{const t=hs(e,n),o=zn(n);if("shared"===t.kind){if(o!==Oe||!Gt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=ki();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(as(o)){if("preset"===t.kind)return!1;const e="section"===t.kind?t.type:t.template.node.type;return cs(o,e)&&n.index>=0&&n.index<=Ri(o).length}if(o!==Oe)return!1;const{floor:e,cap:r}=ki();return n.index>=e&&n.index<=r}if(o===Oe)return!1;const r=fs(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Ri(o))},gs=(e,n)=>{const t=hs(e,n);if("block"!==t.kind&&as(zn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&cs(n,o)){if("section"===e.kind)wo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;wo.insertNode(n,t,xi(e.template.node))}lr(V),wo.select({index:t,zone:n})}})(t,zn(n),n.index);if("section"===t.kind)return void hl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=pl(t),r=wo.insertNode(Oe,o,n);fl(o,r,e)})(t.template.name,xi(t.template.node),n.index);if("preset"===t.kind)return void((e,n,t)=>{const o=n({nodeDefaults:Mi,newNodeId:$e,sectionLabel:Ti,blockIsOffered:Cr});if(!o)return;const r=pl(t),i=wo.insertNode(Oe,r,o);fl(r,i,e)})(t.preset.label,t.preset.insert,n.index);if("shared"===t.kind){const e=Gt.shared?.nodeOf(t.section);if(!e)return;const o=pl(n.index);return void(Ci.restore(e,{parentId:wn,slot:xn,index:o})&&fl(o,e.props.id,t.section.title))}const o=zn(n),r=fs(o);r&&(r.target.spec?Rl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{wo.insertComponent(e,n,t),lr(V),wo.select({index:t,zone:e})})(o,t.type,n.index))},ys=(e,n)=>{e.media?function(e){const n=ed();if(!n||!Zs)return;td(n).then(n=>{n&&function(e,n){if(!Zs)return;const t=Zs.create(e,{nodeDefaults:Mi,newNodeId:$e,sectionLabel:Ti,blockIsOffered:Cr}),o=zn(n);if(o===Oe){const e=pl(n.index),o=wo.insertNode(Oe,e,t);return void fl(e,o,Ti(t.type))}wo.insertNode(o,n.index,t),lr(V),wo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Xi(e.rung.nodeId,e.index,n.index):e.add?gs(e.add,n):e.zone===Oe?ul(e.index,n.index):ls(e.zone,zn(n),e.index,n.index)},[bs]=Vn(()=>vn()),vs=kn({keyOf:e=>e.id,readOnly:Boolean(jt),session:bs,canDrop:ps,onDrop:ys,onStep:(e,n)=>{e.rung?Xi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Oe?((e,n)=>{const t=Ti(vi[e]?.type??""),o=ul(e,n<0?e-1:e+2);if(!o.moved)return void _r(n<0?lo.sectionFirst({name:t}):lo.sectionLast({name:t}));const{floor:r,cap:i}=ki();_r(lo.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):ls(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),ks=Hn(e=>{const{floor:n,cap:t}=ki(),o=[];for(const r of e.nodes){const e=zn(r.place),i=Ri(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(to(i)||oo(i)||kr(i.type,i))continue;if(_t(i.type))continue;const l=Boolean(as(e)),s=e===Oe||l;e===Oe&&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?Ti(i.type):Ki(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=zn(e.list);if(n===Oe&&0===e.children.length)return[{...e,addLabel:lo.addSection,addAlways:!0}];const t=fs(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(as(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=zn(e.list),t=n===Oe||as(n)?null:fs(n);return t?.choices.length?mn(e,t.target.spec?.addLabel??lo.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Wt.data]),Ss=null==Ut?.props.id?null:String(Ut.props.id),ws=Un(Re),xs=ws?.selected()&&Uo?.document&&Ss?ws.selectedPart?.(Uo.document)??null:null,zs=xs&&Ss&&Fe(Wt.data,Xt,Ss,xs)?xs:null,Cs=zs?.label?{element:zs.element,label:zs.label}:null,Os=null!==zs,Ns=Hn(e=>{const n=Xt,t=e=>!e.item.rung&&null!==On(Wt.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(Ss);return i?Os?null:i:r(_e(Wt.data,n,o.item.id,Ss,Jl))??o},[Wt.data,Xt,Ss,Jl,Os]),[Is,Bs]=Vn(null),[Ps,$s]=Vn(null),Es=Boolean(Ul||Gl);En(Uo,"mouseover",e=>{if(!Es)return;const n=Tn(e.target),t=n?kt(Wt.data,Xt,n):null;t!==Is&&Bs(t)}),En(Uo,"mouseout",e=>{Es&&!e.relatedTarget&&Bs(null)});const Ms=e=>to(e)||oo(e)||_t(e.type),Ts=e=>{const n=_t(e.type)?Ei(e.type):to(e)?lo.header:oo(e)?lo.footer:null;return null===n?ji(e):Nr.rowName?Nr.rowName(e,"section",n):n},js=[];if(Es){const e=Ss?kt(Wt.data,Xt,Ss):null;for(const n of/* @__PURE__ */new Set([e,Is,Ps])){const e=n?vi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=to(e)||e.type===Kt,o=Ql(e);if(o){js.push({id:String(e.props.id),label:Ts(e),below:t,reach:o});continue}if(!Ul||!Ms(e))continue;const r=Ul(e);r&&js.push({id:String(e.props.id),label:r,below:t})}}const Ls=fe(),As=Fn(null);Wn(()=>{const e=Gt.changeNotice;if(!e)return;const n=JSON.stringify(vi.filter(Ms)),t=As.current;if(As.current={doc:Xn,bands:n,index:Yt.index},!t||t.doc!==Xn||t.bands===n)return;Yt.hasPast&&Yt.index>=t.index&&!vt.has(Ls)&&(vt.add(Ls),_r(e,"success",{action:{label:lo.bar.undo,onClick:()=>Yt.back()},duration:8e3}))},[vi]);const Rs=e=>{lr(V),wo.select(e.zone===Oe?{index:e.index}:{index:e.index,zone:e.zone})},Fs=q(),Ds=()=>({data:Wt.data,device:$o,ops:wo,inspector:gr}),Vs=Fs?.model,Ws=Dn(()=>Vs?e=>Vs(e,ks(e),Ds()):ks,[Vs,ks,$o]),Hs=Fs?.measure,Ys=Hs?(e,n)=>Hs(e,n,Ds()):void 0,Us=Fs?.canDrop,Js=Us?(e,n)=>Us(e,n,ps,Ds()):ps,Xs=Fs?.drop,Gs=Xs?(e,n)=>Xs(e,n,ys,Ds()):ys,Qs=Fs?.pick,Ks=Qs?e=>Qs(e,Rs,Ds()):Rs,Zs=Fs?.media??null,_s=Fn(null),qs=Dn(()=>Zs?{id:yt,zone:"",index:-1,type:Zs.adds.type,add:{kind:Zs.adds.kind,type:Zs.adds.type},media:!0}:null,[Zs]);Wn(()=>{if(!qs||jt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(rt))(e)&&(_s.current=null,bs.start({key:yt,item:qs}))},n=e=>{bs.get()?.item.media&&(_s.current=_n(e.dataTransfer))},t=()=>{bs.get()?.item.media&&bs.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)}},[qs,jt,bs]);const ed=()=>{const e=_s.current;return _s.current=null,e},nd=ce(),td=async e=>{if(!nd)return e;const n=await nd(e);return n?{...e,id:n.id,url:n.url}:null};const od=(e,n)=>{if(!Zs)return;const t=On(So.getState().appState.data,Si,n);if(!t)return;const o=t.node;wo.replaceComponent(zn(t.place),t.place.index,{...o,props:{...Zs.replace(o,e),id:o.props.id}})},rd=e=>{const n=zn(e),t=Vi(n);t&&Ui(t.node,t.slot,!1),gl(n,e.index)},id=(e,n)=>/* @__PURE__ */ht(Xe,{...jt?{}:vs.seam({place:{...Cn(e),index:n}})},`seam:${e}:${n}`),ld={rowClick:vl,isCollapsed:Xr,toggleCollapse:Gr},sd=e=>{const n=String(e.props.id),t=vi.findIndex(e=>String(e.props.id)===n),o=qt(n),r=Ri(o),i=Xr(n),l=Ei(e.type),s=Nr.rowName?Nr.rowName(e,"section",l):l,d=e=>id(o,e);/* @__PURE__ */
16
- return mt(gt,{children:[
17
- /* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:e.type,size:13}),name:s,preview:Sl(e),marks:wl(e),onSelect:()=>cl(t),nameSlot:_i(Oe,t,n,s),selected:sr===n,badge:Ql(e)?void 0:ql,shared:Ql(e),actions:xl(e,Oe,t)??void 0,rowProps:{"data-node-id":n,onClick:vl(()=>cl(t))},fold:{open:!i,label:"section",onToggle:()=>Gr(n)}}),!i&&/* @__PURE__ */mt(He,{children:[r.map((n,t)=>{const r=String(n.props.id),i=ji(n),l=jl(n),s=l&&Xr(r),a=()=>Al(o,t,r,e.type),{rowProps:c,...p}=vs.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Cn(o),index:t}},{"data-node-id":r,onClick:vl(a)});/* @__PURE__ */
18
- return mt(Jn,{children:[d(t),
19
- /* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:n.type,size:13}),name:i,preview:Sl(n),marks:wl(n),onSelect:a,nameSlot:_i(o,t,r,i),selected:sr===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Gr(r)}:void 0,actions:/* @__PURE__ */mt(gt,{children:[kl(o,t,i),xl(n,o,t),zl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */ht(He,{children:cd(n,2)})]},r)}),d(r.length)]})]})},dd=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=vs.dragging,d=!Xr(l)&&s?.rung?.nodeId!==i,a={...Cn(l),index:0},c=s&&!s.rung&&ps(s,a)?a:void 0,p=()=>Ui(e,n,!0),{rowProps:u,...f}=vs.row({item:{id:`rung:${l}`,zone:`${i}:${Ot}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Ot,index:t},into:c,canDrag:Boolean(vr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:vl(p)}),h=jt?null:vr.slotActions?.(e,n.slot);/* @__PURE__ */
20
- return mt(Jn,{children:[n.heading,
21
- /* @__PURE__ */ht(We,{words:so,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Wi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Gr(l)},actions:h&&h.length>0?/* @__PURE__ */ht(gt,{children:h.map((t,o)=>/* @__PURE__ */ht(Je,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(jt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ji(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__ */ht(at,{size:15}):/* @__PURE__ */ht(ft,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */ht(He,{children:r})]},l)},ad=(e,n)=>{const t=Bl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
- return ht(gt,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=El(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)=>id(e,n),p=/* @__PURE__ */mt(gt,{children:[i.map(({child:n,zone:t,index:o})=>{const r=sr===String(n.props.id),{collapsible:i,folded:s}=Ml(n,l,Ll(n.type)),d=String(n.props.id),a=is(n),p=()=>Al(t,o,d,e.type),{rowProps:u,...f}=vs.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Cn(t),index:o}},{"data-node-id":d,onClick:vl(p)});/* @__PURE__ */
23
- return mt(Jn,{children:[0===o&&c(t,0),
24
- /* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:n.type,size:13}),name:a,preview:Sl(n),marks:wl(n),onSelect:p,nameSlot:_i(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Gr(d)}:void 0,actions:/* @__PURE__ */mt(gt,{children:[kl(t,o,a),xl(n,t,o),zl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */ht(He,{children:ad(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?dd(e,t.rung,r++,o,p):/* @__PURE__ */ht(Jn,{children:p},t.slot??"")})})},cd=(e,n)=>{const t=wr(Wt?.data,e.type,String(e.props.id)),o=Bl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
- return ht(gt,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=El(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),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>id(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),b=/* @__PURE__ */mt(gt,{children:[l.map(({child:n,zone:t,index:o})=>{const r=sr===String(n.props.id),i=Ki(n),l=String(n.props.id),{collapsible:d,folded:a}=Ml(n,s,Ll(n.type)),c=Nl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Cn(p),index:Ri(p).length}:void 0,f=vs.dragging,h=u&&f&&ps(f,u)?u:void 0,g=()=>Al(t,o,l,e.type),{rowProps:y,...b}=vs.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Cn(t),index:o},into:h,canDrag:!kr(n.type,n)},{"data-node-id":l,onClick:vl(g)});/* @__PURE__ */
26
- return mt(Jn,{children:[0===o&&m(t,0),
27
- /* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:n.type,size:13}),name:i,preview:Sl(n),marks:wl(n),onSelect:g,nameSlot:_i(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...b,fold:d?{open:!a,label:"group",onToggle:()=>Gr(l)}:void 0,actions:kr(n.type,n)?xl(n,t,o)??void 0:/* @__PURE__ */mt(gt,{children:[kl(t,o,i),xl(n,t,o),zl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */ht(He,{children:cd(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
- /* @__PURE__ */ht(z,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Rl(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?dd(e,o.rung,i++,r,b):/* @__PURE__ */ht(Jn,{children:b},o.slot??"")})})},pd=_o,ud=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:zo&&!pd&&br===e.id,onSelect:()=>yi(e.id)}:e,fd=[...(yr.railLead??[]).map(ud),{id:"sections",label:lo.layers,icon:/* @__PURE__ */ht(ge,{}),active:zo&&!pd&&"sections"===br,onSelect:()=>yi("sections")},...(yr.railTrail??[]).map(ud)],hd=To?{onPress:jo}:Ft?{onPress:()=>{x(Bn,{accept:"image/*",title:ho.mediaLibrary})}}:null,md={value:fd.find(e=>!0===e.active)?.id??"",press:e=>{const n=fd.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:fd.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */ht("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},gd=[...yr.railLead??[],...yr.railTrail??[]].find(e=>"panel"in e&&e.id===br),yd=Boolean(io?.foldable),bd=io?.label??(Dt?lo.pageSections:lo.templateSections),vd=yd&&Xr(It),kd=/* @__PURE__ */mt(gt,{children:[vi.map((e,n)=>{if(to(e)||oo(e)||_t(e.type))return null;const t=sr===String(e.props.id),o=Boolean(e.props._hidden);Il(e);const r=String(e.props.id),i=yr.hasOwnRows?.(e)??!1,l=jl(e)||i,s=l&&Xr(r),d=Nl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Cn(a),index:Ri(a).length}:void 0,p=vs.dragging,u=c&&p&&ps(p,c)?c:void 0,{rowProps:f,...h}=vs.row({item:{id:r,zone:Oe,index:n,type:e.type},place:{...Cn(Oe),index:n},into:u,canDrag:!kr(e.type,e)},{"data-node-id":r,onClick:vl(()=>cl(n))});/* @__PURE__ */
29
- return mt(Jn,{children:[n>0&&Cl(n),
30
- /* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:e.type,size:13}),name:ji(e),preview:Sl(e),marks:wl(e),shared:Ql(e),onSelect:()=>cl(n),nameSlot:_i(Oe,n,r,ji(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Gr(r)}:void 0,actions:/* @__PURE__ */mt(gt,{children:[kl(Oe,n,ji(e)),xl(e,Oe,n),zl(Oe,n,e,ji(e))]}),rowProps:f}),jl(e)&&!s&&/* @__PURE__ */mt(He,{children:[cd(e,1),yr.partRows?.(e,ld)]}),i&&!s&&/* @__PURE__ */ht(He,{children:yr.ownRows?.(e,n,ld)})]},String(e.props.id??n))}),ts>0&&Cl(ts)]}),Sd=(e,n,t)=>{const o=String(e.props.id),r=Pl(e).length>0||$l(e)||Boolean(zr(e.type)),i=r&&Xr(o),l="header"===t?lo.header:lo.footer,s=Nr.rowName?Nr.rowName(e,"section",l):l;/* @__PURE__ */
31
- return mt(gt,{children:[
32
- /* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:t,size:13}),name:s,preview:Sl(e),marks:wl(e),badge:Ql(e)?void 0:ql,shared:Ql(e),onSelect:()=>cl(n),nameSlot:_i(Oe,n,o,s),selected:sr===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Gr(o)}:void 0,actions:xl(e,Oe,n)??void 0,rowProps:{"data-node-id":o,onClick:vl(()=>cl(n))}}),r&&!i&&/* @__PURE__ */ht(He,{children:ad(e,1)})]})};return(yr.wrap??(e=>e))(
33
- /* @__PURE__ */ht(ee,{target:Uo,children:/* @__PURE__ */mt("div",{ref:Yo,className:"sf-editor es-editor",style:dn(Wr),onContextMenu:rl.onEditorContextMenu,...p(Bn),children:[
34
- /* @__PURE__ */mt(qe,{children:[
35
- /* @__PURE__ */mt("div",{className:"es-cluster es-cluster--left",children:[hd?/* @__PURE__ */ht(Qn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */ht(ye,{}),onClick:hd.onPress,children:lo.railMedia}):null,
36
- /* @__PURE__ */ht(en,{label:lo.bar.undo,disabled:Boolean(jt)||!Yt.hasPast,onClick:()=>Yt.back(),children:/* @__PURE__ */ht(it,{})}),
37
- /* @__PURE__ */ht(en,{label:lo.bar.redo,disabled:Boolean(jt)||!Yt.hasFuture,onClick:()=>Yt.forward(),children:/* @__PURE__ */ht(lt,{})})]}),
38
- /* @__PURE__ */mt(nn,{children:[
39
- /* @__PURE__ */ht(tn,{devices:Oo,value:$o,onChange:Eo}),
40
- /* @__PURE__ */ht(en,{label:lo.bar.refresh,tip:lo.bar.refreshTip,onClick:()=>{Ho.current=(()=>{const e=Uo?.document;if(!e)return null;const n=vi.findIndex(oo),t=n>=0?n:vi.length;let o=null;for(let n=0;n<t;n++){const t=vi[n]?.props?.id;if(null==t)continue;const r=Rn(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=Ut?.props?.id??vi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Wo(e=>e+1)},children:/* @__PURE__ */ht(st,{})}),yr.barView?.()]}),
41
- /* @__PURE__ */mt(nn,{kind:"right",style:{minWidth:300},children:[
42
- /* @__PURE__ */ht(v,{input:Ko,words:lo.saveStatus}),jn?/* @__PURE__ */ht(jn,{}):null,yr.barLead?.(),yr.barTrail?.(),yr.mainAction||!yr.barMain?/* @__PURE__ */ht(k,{input:Ko,action:qr,readOnly:Boolean(jt),saveSwitch:At,onToggleAutoSave:$t,onSaveNow:Zo,bar:lo.bar,words:lo.saveStatus}):yr.barMain()]})]}),
43
- /* @__PURE__ */ht(b,{}),
44
- /* @__PURE__ */mt("div",{className:"sf-body",children:[zo?/* @__PURE__ */mt(gt,{children:[
45
- /* @__PURE__ */mt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":lo.leftPanel,children:[
46
- /* @__PURE__ */mt("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
47
- /* @__PURE__ */ht(I,{side:"left",onHide:mi}),
48
- /* @__PURE__ */ht("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
49
- /* @__PURE__ */ht(Kn,{variant:"underline",block:!0,"aria-label":lo.bar.views,value:md.value,onChange:md.press,items:md.items})]}),_o?/* @__PURE__ */ht(C,{at:nr?{label:(e=>{const n=as(e.zone);if(n)return lo.add.addingTo({name:Nr.rowName?bl(n,!0):Ei(n.type)});if(e.zone===Oe){const n=vi[e.index];return n&&!oo(n)?lo.add.addingBefore({name:bl(n,!0)}):lo.add.addingAtEnd}const t=fs(e.zone);return t?lo.add.addingTo({name:t.parentName}):lo.add.addingHere})(nr),onClear:()=>tr(null)}:void 0,placeBlocks:nr&&nr.zone!==Oe?fs(nr.zone)?.choices:void 0,canTake:nr?e=>{if(!nr)return null;const n={...Cn(nr.zone),index:nr.index};if(ms(e,n))return null;if("shared"===e.kind&&nr.zone===Oe&&!Gt.shared?.nodeOf(e.section))return lo.shared.alreadyHere;const t=as(nr.zone);if(t)return lo.add.notInside({name:bl(t,!0)});if(nr.zone===Oe)return lo.add.onlySections;const o=fs(nr.zone);return o?lo.add.notInside({name:o.parentName}):lo.add.onlySections}:void 0,onPick:nr?e=>{if(!nr)return;const n={...Cn(nr.zone),index:nr.index};ms(e,n)&&(gs(e,n),yl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${Nt(e)}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:Nt(e),add:e}),session:bs,siteWide:yr.addPanelRow?.(yl),onClose:yl,readOnly:Boolean(jt)}):gd?gd.panel({onHide:mi,notify:_r}):/* @__PURE__ */mt(gt,{children:[
50
- /* @__PURE__ */ht(B,{icon:/* @__PURE__ */ht(ge,{}),title:lo.layers,context:mo,actions:/* @__PURE__ */mt(gt,{children:[!jt&&/* @__PURE__ */ht(on,{label:lo.add.title,onClick:()=>ml(null),children:/* @__PURE__ */ht(dt,{size:15})}),
51
- /* @__PURE__ */ht(on,{label:rs?lo.expandAll:lo.collapseAll,title:0===os.length?lo.nothingToFold:void 0,disabled:0===os.length,onClick:()=>Vr(e=>{const n=new Set(os);return rs?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...os])}),children:/* @__PURE__ */ht(xt,{expand:rs})})]})}),
52
- /* @__PURE__ */mt(Ye,{className:"sf-tree sf-scroll",words:so,children:[es&&/* @__PURE__ */mt(gt,{children:[!Xl&&/* @__PURE__ */ht(Ue,{children:lo.header}),sd(es)]}),Vt&&!(Xl&&es)&&/* @__PURE__ */mt(gt,{children:[!Xl&&/* @__PURE__ */ht(Ue,{children:lo.header}),!ro&&/* @__PURE__ */ht(We,{words:so,icon:/* @__PURE__ */ht(Br,{type:"header",size:13}),name:lo.header,badge:_l?void 0:ql,shared:_l,onSelect:bi,selected:ir.kind===no?.kind,rowProps:{onClick:vl(bi)}})]}),Yl&&!(Xl&&es)&&Sd(Yl,Hl,"header"),!yd&&/* @__PURE__ */ht(Ue,{children:bd}),yd?/* @__PURE__ */mt(gt,{children:[
53
- /* @__PURE__ */ht(We,{words:so,icon:null,name:bd,fold:{open:!vd,label:bd,onToggle:()=>Gr(It)}}),!vd&&/* @__PURE__ */ht(He,{children:kd})]}):kd,Vt&&!Xl&&/* @__PURE__ */ht(Ue,{children:lo.footer}),Wl&&!(Xl&&ns)&&Sd(Wl,Vl,"footer"),ns&&sd(ns),yr.treeFoot?.()]})]})]}),
54
- /* @__PURE__ */ht(rn,{side:"left",width:Wr.left,min:sn.left,max:ln,defaultWidth:h.left,label:lo.resizeLeftPanel,onResize:Ur})]}):/* @__PURE__ */ht(P,{side:"left",onShow:mi}),
55
- /* @__PURE__ */mt("div",{ref:ni,className:"sf-center sf-scroll","data-sf-canvas-head":li?"":void 0,style:{overflowX:ui?"auto":"hidden",overflowY:"hidden"},children:[li&&/* @__PURE__ */ht("div",{ref:si,className:"sf-canvas-head",children:/* @__PURE__ */ht(li,{device:$o})}),
56
- /* @__PURE__ */mt("div",{className:"sf-frame-scaler",style:fi,children:[
57
- /* @__PURE__ */ht("div",{className:"sf-frame "+($o===Bo?"":`sf-frame--${$o}`),style:hi,children:/* @__PURE__ */mt("div",{className:"sf-preview-host",children:[
58
- /* @__PURE__ */ht(De.Provider,{value:Jl,children:/* @__PURE__ */ht(Ve.Provider,{value:Zl,children:/* @__PURE__ */ht(go,{},Vo)})}),
59
- /* @__PURE__ */ht(gn,{canvas:Uo,session:bs,model:Ws,measure:Ys,canDrop:Js,onDrop:Gs,choose:Ns,tag:Cs,onPick:Ks,dropOn:Zs?{accepts:(e,n)=>{if(!e.media||!Zs||n.item.rung)return!1;const t=On(Wt.data,Si,n.item.id);return null!==t&&Zs.takes(t.node)},onDrop:(e,n)=>(e=>{const n=ed();n&&Zs&&td(n).then(n=>{n&&od(n,e.item.id)})})(n),label:()=>lo.canvasReplaceImage}:void 0,onZoneAdd:rd,onSeamAdd:rd,zoneAddLabel:lo.canvasAddBlock,words:ao.canvas,readOnly:Boolean(jt),revision:Wt.data}),or.length>0&&!Jo&&/* @__PURE__ */ht("div",{className:"sf-preview-gaps",children:or.map(e=>
60
- /* @__PURE__ */ht(yn,{index:e.index,label:lo.addSectionHere,onInsert:()=>ml(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))})]})}),Es?/* @__PURE__ */ht(wt,{canvas:Uo,tabs:js,onSelect:Yi,onPointer:$s}):null]})]}),Co?/* @__PURE__ */mt(gt,{children:[Ln?
61
- /* @__PURE__ */ht("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:Ln}):/* @__PURE__ */ht(gt,{children:/* @__PURE__ */ht(u,{value:{selectChild:Al,addChild:Rl,childRowName:Ki,blockRowName:is},children:/* @__PURE__ */ht(yo,{mode:ir,onOpenWebsiteSettings:yr.openSettings??(()=>{}),onOpenSiteStyles:yr.openStyles,onOpenPageStyles:yr.openPageStyles,onSelectNode:Mr,onNotify:_r,onHidePanel:gi,nodeActions:Ut?Ne(Xt,Ut.type):Bt})})}),
62
- /* @__PURE__ */ht(rn,{side:"right",width:Wr.right,min:sn.right,max:ln,defaultWidth:h.right,label:lo.resizeSettingsPanel,onResize:Jr})]}):
63
- /* @__PURE__ */ht(P,{side:"right",onShow:gi})]}),rl.menu,
64
- /* @__PURE__ */ht(ie,{}),Ni?/* @__PURE__ */ht(bt,{name:Ni.name,onMake:e=>(async(e,n)=>{const t=vi.find(n=>String(n.props.id)===e),o=Gt.shared;if(!t||!o)return;let r;try{r=await N(Oi).create(n,t)}catch{return void _r(lo.shared.makeFailed,"error")}o.adopt(t,r),Ii(null)})(Ni.id,e),onCancel:()=>Ii(null)}):null]})}))}export{$t as ScreenChrome};
@@ -1,8 +0,0 @@
1
- import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-GDO4QJ4G.js";import{blockTypesIn as o}from"./chunk-IZGFJWH4.js";import{sectionTemplatesOf as r}from"./chunk-N7E6264U.js";import{sharedSectionsOf as l}from"./chunk-N3MJOHAG.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-MTWQYLJE.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as p,useScreenPinned as d}from"./chunk-TUIBPB77.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-G2VZ4DET.js";import{useEasel as u}from"./chunk-L36E2WCO.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-SEC6NV6Y.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as C}from"react";import{SharedIcon as w,AddIcon as E}from"efficient-shell/icons/efficient";import{ContextMenu as O,toast as I,Dialog as T,Button as $}from"efficient-shell/ui";import{jsx as x,jsxs as F,Fragment as G}from"react/jsx-runtime";function M({name:e,pages:t,onDelete:n,onCancel:o}){const r=h("screen",f).shared,[l,i]=b(!1),s=C(null);/* @__PURE__ */
2
- return x(T,{open:!0,role:"alertdialog",size:"sm",title:r.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */F(G,{children:[
3
- /* @__PURE__ */x($,{ref:s,variant:"secondary",onClick:o,children:r.cancel}),
4
- /* @__PURE__ */x($,{variant:"danger",loading:l,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:r.deleteShared})]}),children:r.deleteMessage({count:t})})}var W=e=>`section:${e}`,B=e=>`block:${e}`,L=e=>`template:${e}`,Q=e=>`shared:${e}`,S=e=>`preset:${e}`;function D({at:C,placeBlocks:T,canTake:$,onPick:D,itemFor:H,session:N,siteWide:U,onClose:Y,onHide:z,readOnly:A}){const J=u(e=>e.config),V=a(),{labelAtLevel:P,categoryLabel:R,firstSection:Z,Icon:_,Thumbnail:X}=V,{blockIsOffered:q,canAddTo:K}=p(),ee=h("screen",f).add,te=h("drag",g).add,ne=m(),[oe,re]=b([]);v(()=>{let e=!1;const t=e=>q(e,ne);return r(ne).list().then(n=>{if(e)return;const r=J.components;re(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[J,ne]);const le=d().shared,ie=h("screen",f).shared,[se,ce]=b([]),[ae,pe]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>q(e,ne);return l(ne).list().then(n=>{if(e)return;const r=J.components;ce(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[J,ne,ae]);const[de,me]=b(null),[fe,ue]=b(null),ye=j(()=>e(J,V),[J]),he=e=>P(e,"section",J.components[e]?.label??e),ke=e=>({type:e.preset?S(e.preset.key):W(e.type),label:e.name,cover:/* @__PURE__ */x(X,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:ee.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ge=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=oe.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=se.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}if("preset"===n){const e=ye.find(e=>e.preset?.key===o)?.preset;return e?{kind:"preset",preset:e}:null}return null},be=e=>/* @__PURE__ */x("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */x(_,{type:e,size:26})}),ve=j(()=>{const e=t(ye,Z),o=/* @__PURE__ */new Map,r=e=>{e.retired||o.has(e.type)||!q(e.type,ne)||o.set(e.type,e)};for(const t of e?[e]:ye.filter(e=>!e.preset)){const e=K(t.type)?.choices??[];e.forEach(r),e.forEach(e=>K(e.type,1)?.choices?.forEach(r))}T?.forEach(r);const l=new Set(ye.filter(e=>!e.preset).map(e=>e.type)),i=[...o.values()].filter(e=>!l.has(e.type)),s=e=>({type:B(e.type),label:e.label,cover:be(e.type),title:ee.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>!e.preset&&o.has(e.type)?{...ke(e),cover:be(e.type)}:ke(e),p=[];se.length>0&&p.push({key:"shared",title:ie.group,tiles:se.map(e=>({type:Q(e.id),label:e.title,cover:/* @__PURE__ */x(X,{type:e.node.type}),mark:/* @__PURE__ */x(w,{size:12}),title:ie.onPages({count:e.used_on.length}),keywords:[he(e.node.type),e.node.type]}))}),oe.length>0&&p.push({key:"templates",title:ee.templates,tiles:oe.map(e=>({type:L(e.id),label:e.name,cover:/* @__PURE__ */x(X,{type:e.node.type}),keywords:[he(e.node.type),e.node.type]}))});const d=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(J.categories??{})){const o=ye.filter(e=>e.cat===t);if(0===o.length)continue;const r=e&&o.some(t=>t.type===e.type)?e:null,l=(r?[r,...o.filter(e=>e.type!==r.type)]:o).map(a);r&&!m&&(l.splice(1,0,...d.map(s)),m=!0),p.push({key:`category:${t}`,title:n(J,t,R),tiles:l})}const f=p.find(e=>e.key?.startsWith("category:"));if(!m&&f&&d.length>0&&(f.tiles=[...f.tiles,...d.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!$)return p;const u=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ge(e.type),n=t?$(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))]},[oe,se,ie,ye,J,ee,$,T,ne]);/* @__PURE__ */
5
- return F(G,{children:[
6
- /* @__PURE__ */x(i,{icon:/* @__PURE__ */x(E,{size:15}),title:ee.title,context:ee.contextAll,actions:/* @__PURE__ */x(s,{label:ee.done,description:ee.doneDescription,onClick:Y}),onHide:z}),
7
- /* @__PURE__ */F("div",{className:"sf-addside sf-scroll",children:[
8
- /* @__PURE__ */x(k,{groups:ve,session:N,itemFor:e=>H(ge(e)??{kind:"section",type:e}),onInsert:D?e=>{const t=ge(e);t&&D(t)}:void 0,onTileMenu:(e,t)=>{const n=ge(e);return"shared"===n?.kind&&!A&&(me({section:n.section,...t}),!0)},at:C,hint:ee.hint,searchLabel:ee.search,readOnly:A,words:te}),U??null]}),de?/* @__PURE__ */x(O,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>me(null),"aria-label":de.section.title,items:y([{label:ie.deleteShared,danger:!0,onClick:()=>{ue(de.section),me(null)}}])}):null,fe?/* @__PURE__ */x(M,{name:fe.title,pages:fe.used_on.length,onDelete:()=>(async e=>{try{await l(ne).remove(e.id)}catch{return void I.error(ie.deleteFailed)}ue(null),le?.removed?.(e),ce(t=>t.filter(t=>t.id!==e.id)),pe(e=>e+1)})(fe),onCancel:()=>ue(null)}):null]})}export{D as AddSidePanel,B as blockKey,S as presetKey,W as sectionKey,Q as sharedKey,L as templateKey};
@@ -1,7 +0,0 @@
1
- import{STANDARD_MARKUP as t,writeMarkedLines as e,sameMarks as n,markedLines as r,spanFor as l,marksIn as o,toggleMark as i,styleIn as a,styleOver as s,listIn as c,setList as u,colorOver as d,unlinkAt as f,linkOver as h,colorIn as p,findLink as m,clearStyle as g,isSafeLinkHref as b}from"efficient-shell/markup";import{Tooltip as v,ColorSwatch as k,ColorPickerPanel as y,Button as x}from"efficient-shell/ui";import{jsxs as w,jsx as D}from"react/jsx-runtime";function N(t,e){return t&&t.start!==t.end?t:{start:0,end:e}}var T=/* @__PURE__ */new Set(["script","style","head","title","meta","link","template","noscript","svg","math","object","iframe"]),M=/* @__PURE__ */new Set(["p","div","li","ul","ol","dl","dt","dd","h1","h2","h3","h4","h5","h6","blockquote","pre","table","thead","tbody","tfoot","tr","section","article","header","footer","aside","nav","figure","figcaption","address","hr"]);function C(l,o){const i=o.rules??t,a=l.html&&""!==l.html.trim()?function(t,l,o){const i=l.createElement("template");i.innerHTML=t;const a=[[]],s=()=>a[a.length-1],c=()=>{const t=s();for(;t.length>0&&" "===t[t.length-1].ch;)t.pop();t.length>0&&a.push([])},u=(t,e,n,r)=>{if(3===t.nodeType){for(const l of t.textContent??""){const t=/\s/.test(l)?" ":l,o=s();" "===t&&(0===o.length&&a.length>1||" "===o[o.length-1]?.ch)||o.push({ch:t,bold:e,italic:n,href:r})}return}if(1!==t.nodeType&&11!==t.nodeType)return;const l=t,o=1===t.nodeType?l.localName:"";if(T.has(o))return;if("br"===o)return void a.push([]);let i=e,d=n,f=r;if("b"!==o&&"strong"!==o||(i=!0),"i"!==o&&"em"!==o||(d=!0),"a"===o){const t=(l.getAttribute("href")??"").trim();f=b(t)?t:null}const h=1===t.nodeType?l.style:null;if(h){const t=h.fontWeight;"bold"===t||"bolder"===t||Number(t)>=600?i=!0:("normal"===t||"lighter"===t||""!==t&&Number(t)<600)&&(i=!1),"italic"===h.fontStyle||"oblique"===h.fontStyle?d=!0:"normal"===h.fontStyle&&(d=!1)}const p=M.has(o);p&&c();for(const e of[...t.childNodes])u(e,i,d,f);p&&c()};u(i.content,!1,!1,null);for(;a.length>1&&0===a[a.length-1].length;)a.pop();return a.map(t=>function(t,l){const o=e=>t.map((n,r)=>n[e]&&(" "!==n.ch||Boolean(t[r-1]?.[e])&&Boolean(t[r+1]?.[e]))),i=[{bold:!0,italic:!0,links:!0},{bold:!0,italic:!1,links:!0},{bold:!1,italic:!1,links:!0},{bold:!1,italic:!1,links:!1}];for(const a of i){const i=S(t,a.bold?o("bold"):null,a.italic?o("italic"):null,a.links),s=e([i]).text;if(n([i],r(s,l)))return s}return t.map(t=>t.ch).join("")}(t,o))}(l.html,o.doc,i):(l.text??"").replace(/\r\n?/g,"\n").split("\n");return o.multiline?a.join("\n"):1===a.length?a[0]:a.map(t=>t.trim()).filter(t=>""!==t).join(" ")}function S(t,e,n,r){let o=0,i=null,a=null,s=null;return{bullet:!1,chars:t.map((t,c)=>{const u=r?t.href:null;return i=null===u?null:i&&i.href===u?i:l(++o,"link",u),a=e?.[c]?a??l(++o,"bold"):null,s=n?.[c]?s??l(++o,"italic"):null,{ch:t.ch,at:-1,marks:[i,a,s].filter(t=>null!==t)}})}}var A="application/x-efficient-markup",E=/^([0-9]{1,3})\. $/;function B(t,e){const n=t.split("\n"),l=r(t,e);let o=0,i=0;const a=l.map((t,e)=>{const r=!t.bullet&&null==t.number&&"- "===n[e],l=null!=t.number||t.bullet?null:E.exec(n[e]),a=t.bullet||r,s=l?l[1]:t.number??null,c=r||l?[]:t.chars,u=c.map(t=>t.ch).join(""),d=null!=s?s.length+2:a?2:0,f={bullet:a,number:s,chars:c,start:o,src:o+d,vis:i,text:u};return o+=n[e].length+1,i+=u.length+1,f});return{lines:a,text:a.map(t=>t.text).join("\n")}}function R(t,e){const{lines:n}=t;for(let t=0;t<n.length;t+=1){const r=n[t];if(e<=r.vis+r.text.length||t===n.length-1)return[r,Math.max(0,Math.min(e-r.vis,r.text.length)),t]}return[n[0],0,0]}function W(t,e){const[n,r]=R(t,e);if(0===r)return n.src;let l=0;for(const t of n.chars){if(r<=l+t.ch.length)return t.at+(r-l);l+=t.ch.length}return n.src}function L(t,e){const[n,r]=R(t,e);let l=0;for(const t of n.chars){if(r===l)return t.at;l+=t.ch.length}return W(t,e)}function K(t,e){const{lines:n}=t;let r=n[0];for(const t of n)e>=t.start&&(r=t);let l=0;for(const t of r.chars){if(!(e>=t.at+t.ch.length)){e>t.at&&(l+=e-t.at);break}l+=t.ch.length}return r.vis+l}function P(t,e,n){return[K(t,e),K(t,n)]}function j(t,e,n){return e===n?[W(t,e),W(t,e)]:[L(t,e),W(t,n)]}function V(t,e){let n=0;for(let r=0;r<t.chars.length;r+=1){if(n>=e)return r;n+=t.chars[r].ch.length}return t.chars.length}function q(t,o,i,a,s){const c=B(t,o),[u,d,f]=R(c,Math.min(i,a)),[h,p,m]=R(c,Math.max(i,a)),g=V(u,d),b=V(h,p),v=u.chars.slice(0,g),k=h.chars.slice(b),y=i!==a&&u.chars[g]&&(f!==m||g<b)?u.chars[g].marks:function(t,e){const n=t.chars[e-1],r=t.chars[e],l=(t,e)=>{const n=t.findIndex(t=>"link"===t.kind);return-1===n||e?t:t.slice(0,n)};if(n){const t=n.marks.find(t=>"link"===t.kind),e=Boolean(t&&r?.marks.some(e=>e.id===t.id));return l(n.marks,e)}return r?l(r.marks,!1):[]}(u,g);let x=(w=c.lines,Math.max(0,...w.flatMap(t=>t.chars.flatMap(t=>t.marks.map(t=>t.id))))+1);var w;const D=t=>{let e;if(void 0!==s.markup){const t=x;e=r(s.markup,o).map(e=>({bullet:e.bullet,number:e.number??null,chars:e.chars.map(e=>({...e,at:-1,marks:e.marks.map(e=>({...e,id:e.id+t}))}))}))}else{let n=u.number??null;e=(s.text??"").split("\n").map((e,r)=>(r>0&&null!=n&&(n=function(t){return String(Number(t)+1).padStart(t.length,"0")}(n)),{bullet:u.bullet,number:n,chars:[...e].map(e=>({ch:e,at:-1,marks:t??[]}))}))}const n=e.map(t=>t.chars.map(t=>t.ch).join("")).join("\n"),l={bullet:u.bullet,number:u.number??null,chars:[...v,...e[0].chars]},i=e.slice(1);if(i.length>0){const t=i[i.length-1];i[i.length-1]={...t,chars:[...t.chars,...k]}}else l.chars.push(...k);return{lines:[...c.lines.slice(0,f).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n})),l,...i,...c.lines.slice(m+1).map(({bullet:t,number:e,chars:n})=>({bullet:t,number:e,chars:n}))],shown:n}},N=void 0!==s.markup?[null]:[(t=>{let e=t.filter(t=>!s.drop?.some(e=>t.kind===e||"highlight"===e&&"accent"===t.kind));for(const t of s.add??[]){if(e.some(e=>e.kind===t))continue;const n=l(x++,t);n&&(e=[...e,n])}if(void 0!==s.color){e=e.filter(t=>"color"!==t.kind);const t=null===s.color?null:l(x++,"color",s.color);t&&(e=[...e,t])}return e})(y),y,[]];let T="",M="";for(const t of N){const r=D(t),l=e(r.lines).text;if(T=l,M=r.shown,n(r.lines,B(l,o).lines))break}return{text:T,caret:Math.min(i,a)+M.length}}function F(t,e,n,r){const l=B(t,e),[o,,i]=R(l,n);return n!==r||!o.bullet&&null==o.number||""!==o.text?q(t,e,n,r,{text:"\n"}):I(t,e,i,!1,n)}function I(t,n,r,l,o){const i=B(t,n).lines.map(({bullet:t,number:e,chars:n},o)=>o===r?{bullet:l,number:null,chars:n}:{bullet:t,number:e,chars:n});return{text:e(i).text,caret:o}}function O(t,n,r,l){const o=B(t,n),[i,a,s]=R(o,Math.min(r,l)),[c,u,d]=R(o,Math.max(r,l)),f=o.lines.slice(s,d+1).map(({bullet:t,number:e,chars:n},r)=>{const l=0===r?V(i,a):0,o=r===d-s?V(c,u):n.length;return{bullet:t,number:e,chars:n.slice(l,o)}});return e(f).text}function z(t,e,n){if(n<0){const n=t.charCodeAt(e-1);return e-(n>=56320&&n<=57343&&e>=2?2:1)}const r=t.charCodeAt(e);return e+(r>=55296&&r<=56319?2:1)}function U(t){const{value:e,rules:n,multiline:r,inputType:l,pending:o}=t;let[i,a]=t.sel;t.target&&t.target[0]!==t.target[1]&&l.startsWith("delete")&&([i,a]=t.target);const s=[i,a];if("historyUndo"===l||"historyRedo"===l)return{kind:"history",dir:"historyUndo"===l?"undo":"redo"};if("formatBold"===l||"formatItalic"===l||"formatStrikeThrough"===l)return{kind:"format",style:"formatBold"===l?"bold":"formatItalic"===l?"italic":"strike"};if("insertParagraph"===l||"insertLineBreak"===l)return r?{kind:"edit",edit:F(e,n,i,a),range:s}:null;if(l.startsWith("insert")){if("insertTranspose"===l)return null;let c=t.data??"";if("insertFromDrop"===l||"insertFromPaste"===l){const l=C({html:t.html??void 0,text:c},{doc:t.doc,multiline:r,rules:n});return{kind:"edit",edit:q(e,n,i,a,{markup:l}),range:s}}return r||(c=c.replace(/\s*\r?\n\s*/g," ")),{kind:"type",edit:q(e,n,i,a,{text:c,add:o?.add,drop:o?.drop,color:o?.color}),range:s}}if(l.startsWith("delete")){const t=B(e,n),r=t.text;if(i===a){const o=l.includes("Backward"),c=t.lines.findIndex(t=>i>=t.vis&&i<=t.vis+t.text.length),u=t.lines[c];if(o&&u&&i===u.vis&&(u.bullet||null!=u.number))return{kind:"edit",edit:I(e,n,c,!1,i),range:s};if(o?0===i:i===r.length)return null;o?i=z(r,i,-1):a=z(r,a,1)}return{kind:"type",edit:q(e,n,i,a,{text:""}),range:[i,a]}}return null}var $=1e3;function H(t=200){let e=[],n=[],r=null,l=0;return{record(o,i,a){const s="type"===i&&"type"===r&&a-l<1e3;r=i,l=a,n=[],s||(e.push(o),e.length>t&&e.shift())},undo(t){const l=e.pop();return l?(n.push(t),r=null,l):null},redo(t){const l=n.pop();return l?(e.push(t),r=null,l):null},reset(){e=[],n=[],r=null}}}var X=t=>t.preventDefault();function Y(t,e){if(t)return t.startsWith("#")?t:e?.find(e=>e.name===t)?.value}function Z({colors:t,current:e,words:n,onPick:r}){const l=null===e?null:e.startsWith("#")?e.toLowerCase():t.find(t=>t.name===e)?.value.toLowerCase()??null;/* @__PURE__ */
2
- return w("div",{className:"es-copy-pop es-copy-colors",role:"dialog","aria-label":n.title,onMouseDown:t=>{"INPUT"!==t.target.tagName&&t.preventDefault()},children:[
3
- /* @__PURE__ */D("span",{className:"es-copy-pop-label",children:n.theme}),
4
- /* @__PURE__ */D("div",{className:"es-copy-theme",role:"group","aria-label":n.theme,children:t.map(t=>/* @__PURE__ */D(v,{content:`${t.label} · ${t.value.toUpperCase()}`,children:/* @__PURE__ */D(k,{color:t.value,size:"sm",className:"es-copy-theme-swatch","data-color":t.name,"aria-label":t.label,selected:e===t.name,onMouseDown:X,onClick:()=>r(t.name)})},t.name))}),
5
- /* @__PURE__ */D("span",{className:"es-copy-pop-label",children:n.any}),
6
- /* @__PURE__ */D(y,{className:"es-copy-any",value:l??"",onChange:t=>{t!==e&&r(t)},label:n.title,dragWrites:"end"}),
7
- /* @__PURE__ */D("div",{className:"es-copy-pop-foot",children:/* @__PURE__ */D(x,{variant:"ghost-danger",size:"sm","data-window-action":"remove",onMouseDown:X,onClick:()=>r(null),children:n.remove})})]})}var G={sup:"sub",sub:"sup"};function J(t){const{value:e,rules:n,start:r,end:l,style:a,pending:s}=t,c=G[a];if(r===l){const t=o(e,r,l,n),i=s&&s.at===r?s:null,u=t.has(a),d=!!i?.add.includes(a)||!i?.drop.includes(a)&&u;let f=(i?.add??[]).filter(t=>t!==a),h=(i?.drop??[]).filter(t=>t!==a);return d&&u?h.push(a):d||u||f.push(a),!d&&c&&(f=f.filter(t=>t!==c),t.has(c)&&(h=[...h.filter(t=>t!==c),c])),{kind:"pending",pending:f.length||h.length||void 0!==i?.color?{add:f,drop:h,color:i?.color,at:r}:null}}let u=e,d=r,f=l;if(c&&!o(u,d,f,n).has(a)&&o(u,d,f,n).has(c)){const t=i(u,d,f,c,n);({text:u,selectionStart:d,selectionEnd:f}=t)}return{kind:"edit",result:i(u,d,f,a,n)}}function Q(t){if(null!==t.id&&a(t.value,t.start,t.end,t.rules)===t.id)return null;const e=s(t.value,t.start,t.end,t.id,t.rules);return e.text===t.value?null:e}var _=/^(block|list-item|flex|grid|table|flow-root)$/;function tt(t){const e=t.ownerDocument.defaultView;return!!e&&_.test(e.getComputedStyle(t).display)}function et(t,e){const n=[],r=/* @__PURE__ */new Map,l=/* @__PURE__ */new Map;let o="",i=!1;const a=()=>{i&&(o+="\n",i=!1)},s=t=>{for(const c of Array.from(t.childNodes)){if(3===c.nodeType){c.data.length>0&&a(),r.set(c,o.length),n.push({node:c,start:o.length,length:c.data.length}),o+=c.data,l.set(c,o.length);continue}if(1!==c.nodeType)continue;const t=c;if(e&&t.matches(e)){r.set(t,o.length),l.set(t,o.length);continue}if("BR"===t.tagName){a(),r.set(t,o.length),o+="\n",l.set(t,o.length);continue}const u=tt(t);u&&((i||o.length>0&&!o.endsWith("\n"))&&(o+="\n"),i=!1),r.set(t,o.length);const d=o.length;s(t),u&&o.length===d&&!i&&n.push({node:t,start:d,length:0}),l.set(t,o.length),u&&(i=!0)}};r.set(t,0),s(t),l.set(t,o.length);return{text:o,at:(t,e)=>{if(3===t.nodeType)return(r.get(t)??0)+Math.min(e,t.data.length);const n=t.childNodes;return e<n.length?r.get(n[e])??l.get(t)??0:l.get(t)??o.length},dom:e=>{for(let t=0;t<n.length;t+=1){const r=n[t],l=r.start+r.length;if(e<r.start)return[r.node,0];if(e<l||e===l&&(t===n.length-1||n[t+1].start>e))return 3===r.node.nodeType?[r.node,e-r.start]:[r.node,0]}const r=n[n.length-1];return r?3===r.node.nodeType?[r.node,r.length]:[r.node,0]:[t,0]}}}function nt(t){const e=t.element();if(!e)return null;let n=t.value;const r=t.rules;if(et(e,t.skip).text!==B(n,r).text)return null;const l=t.now??(()=>Date.now()),i=H();let s=e,b=!1,v=null,k=null,y=[t.caret[0],t.caret[1]],x=null,w=!1,D=!1;const T=()=>{D||t.onSelect?.()},M={contenteditable:e.getAttribute("contenteditable"),spellcheck:e.getAttribute("spellcheck")},S=()=>s.ownerDocument,E=()=>S().defaultView?.getSelection()??null,R=()=>{if(!k)return!0;ct();const e=et(s,t.skip);if(e.text!==B(n,r).text)return!1;const[l,o]=k,[i,a]=e.dom(l),[c,u]=e.dom(o);return w||S().activeElement===s||s.focus({preventScroll:!0}),E()?.setBaseAndExtent(i,a,c,u),y=k,W=k,k=null,T(),!0};let W=null;const L=()=>{if(!W)return!1;const t=E(),e=t?.anchorNode??null;return!(e&&e.isConnected&&s.contains(e))||e===s&&0===t.anchorOffset&&(0!==W[0]||0!==W[1])},K=()=>{k=W,R()},V=()=>{R(),S().activeElement===s&&L()&&K();const e=E();if(!(e&&e.anchorNode&&e.focusNode&&s.contains(e.anchorNode)&&s.contains(e.focusNode)))return y;const n=et(s,t.skip),r=n.at(e.anchorNode,e.anchorOffset),l=n.at(e.focusNode,e.focusOffset);return y=r<=l?[r,l]:[l,r],y},F=t=>{const e=S().defaultView;t<=0||!e?W=null:e.requestAnimationFrame(()=>{b||k||(ct(),S().activeElement===s?(L()&&(K(),T()),F(t-1)):W=null)})},I=(t,e)=>{k=[t,e];const n=t=>{if(b)return;if(R())return void F(3);const e=S().defaultView;t>0&&e&&e.requestAnimationFrame(()=>n(t-1))};n(30)},z=(e,r,o)=>{e.text!==n?(i.record({text:n,start:r[0],end:r[1]},o,l()),n=e.text,t.write(n),I(e.caret,e.caret),T()):I(e.caret,e.caret)},$=t=>j(B(n,r),t[0],t[1]),X=(t,e)=>{const l=N({start:t,end:e},n.length);return g(n,l.start,l.end,r)},Y=(e,o)=>{if(e.text===n)return;i.record({text:n,start:o[0],end:o[1]},"edit",l()),n=e.text,t.write(n);const[a,s]=P(B(n,r),e.selectionStart,e.selectionEnd);I(a,s),T()},Z=t=>{if(b)return;const e=V(),[l,o]=$(e),i=J({value:n,rules:r,start:l,end:o,style:t,pending:x});if("pending"===i.kind)return x=i.pending,void T();Y(i.result,e)},G=e=>{n=e.text,t.write(n),I(e.start,e.end)},_=e=>{if(b)return;b=!0,ut.removeEventListener("selectionchange",dt),v&&tt&&t.editable&&!t.editable()&&(nt(tt),tt=null,v=null,ot()),st(s);const n=E();n&&n.rangeCount>0&&s.contains(n.anchorNode)&&s.contains(n.focusNode)&&n.removeAllRanges(),t.end(e)};let tt=null;const nt=t=>{const e=new Set(t.map(([t])=>t)),n=s.ownerDocument.createTreeWalker(s,4),r=[];for(let t=n.nextNode();t;t=n.nextNode())e.has(t)||r.push(t);for(const t of r)t.parentNode?.removeChild(t);for(const[e,n]of t)e.data!==n&&(e.data=n)},rt=(t,e)=>{const l=V();!b&&l[0]!==l[1]&&t.clipboardData&&(t.preventDefault(),t.clipboardData.setData("text/plain",B(n,r).text.slice(l[0],l[1])),t.clipboardData.setData(A,O(n,r,l[0],l[1])),e&&z(q(n,r,l[0],l[1],{text:""}),l,"edit"))},lt=t=>t.preventDefault(),ot=()=>{t.remount?.()},it=[["keydown",e=>{if(b||e.isComposing)return;const r=e.metaKey||e.ctrlKey;if("Escape"!==e.key){if(r&&!e.altKey&&!e.shiftKey&&("k"===e.key||"K"===e.key)&&t.onLinkKey?.())return e.preventDefault(),void e.stopPropagation();if(r&&!e.altKey&&!e.shiftKey&&("KeyA"===e.code||"a"===e.key||"A"===e.key))return e.preventDefault(),e.stopPropagation(),I(0,et(s,t.skip).text.length),void T();if("Enter"===e.key&&(!e.shiftKey||r))return e.preventDefault(),e.stopPropagation(),void _("enter");if(r&&("z"===e.key||"Z"===e.key||"y"===e.key)){e.preventDefault(),e.stopPropagation();const t=V(),r={text:n,start:t[0],end:t[1]},l="y"===e.key||e.shiftKey?i.redo(r):i.undo(r);l&&G(l)}}else{if(e.preventDefault(),e.stopPropagation(),t.onEscape?.())return;_("escape")}}],["beforeinput",e=>{if(b)return;if("insertCompositionText"===e.inputType)return;e.preventDefault();const l=V(),o=et(s,t.skip),a="function"==typeof e.getTargetRanges?e.getTargetRanges()[0]:void 0,c=a&&!a.collapsed?[o.at(a.startContainer,a.startOffset),o.at(a.endContainer,a.endOffset)]:null,u=U({value:n,rules:r,multiline:t.multiline,inputType:e.inputType,data:e.data??e.dataTransfer?.getData("text/plain")??"",html:e.dataTransfer?.getData("text/html"),doc:S(),sel:l,target:c,pending:x&&x.at===$(l)[0]?x:null});if(u){if("type"!==u.kind&&"edit"!==u.kind||(x=null),"history"===u.kind){const t={text:n,start:l[0],end:l[1]},e="undo"===u.dir?i.undo(t):i.redo(t);return void(e&&G(e))}"format"!==u.kind?z(u.edit,u.range,u.kind):Z(u.style)}}],["compositionstart",()=>{v=V(),tt=(()=>{const t=[],e=s.ownerDocument.createTreeWalker(s,4);for(let n=e.nextNode();n;n=e.nextNode())t.push([n,n.data]);return t})()}],["compositionend",e=>{const o=v;if(v=null,!b&&o){if(t.editable&&!t.editable())return tt&&nt(tt),tt=null,void ot();if(tt=null,e.data){const a=q(n,r,o[0],o[1],{text:e.data});i.record({text:n,start:o[0],end:o[1]},"type",l()),n=a.text,t.write(n),ot(),I(a.caret,a.caret)}else ot(),I(o[0],o[0])}}],["paste",e=>{if(b)return;e.preventDefault();const l=V(),o=e.clipboardData,i=o?.getData(A)??"",a=i?t.multiline?i:i.replace(/\s*\r?\n\s*/g," "):C({html:o?.getData("text/html")??"",text:o?.getData("text/plain")??""},{doc:S(),multiline:t.multiline,rules:r});z(q(n,r,l[0],l[1],{markup:a}),l,"edit")}],["copy",t=>rt(t,!1)],["cut",t=>rt(t,!0)],["drop",lt],["dragstart",lt],["blur",e=>{if(b||null!==v||w)return;const n=e.target,r=n.ownerDocument.defaultView,l=()=>{b||(n.isConnected&&n===t.element()?w||n.ownerDocument.activeElement===n||_("blur"):I(y[0],y[1]))};r?.requestAnimationFrame?r.requestAnimationFrame(l):setTimeout(l,0)}],["focus",()=>{w=!1}]];function at(t){t.setAttribute("contenteditable","true"),t.setAttribute("spellcheck","false"),t.setAttribute("data-es-typing","");for(const[e,n]of it)t.addEventListener(e,n)}function st(t){for(const[e,n]of it)t.removeEventListener(e,n);null===M.contenteditable?t.removeAttribute("contenteditable"):t.setAttribute("contenteditable",M.contenteditable),null===M.spellcheck?t.removeAttribute("spellcheck"):t.setAttribute("spellcheck",M.spellcheck),t.removeAttribute("data-es-typing")}function ct(){const e=t.element();e&&e!==s&&(st(s),s=e,at(s))}const ut=s.ownerDocument;function dt(){b||T()}return ut.addEventListener("selectionchange",dt),at(s),s.focus({preventScroll:!0}),I(t.caret[0],t.caret[1]),{get value(){return n},update(t){if(t===n)return;const e=B(t,r).text.length,[l,o]=V();n=t,i.reset(),I(Math.min(l,e),Math.min(o,e))},stop(t="stop"){_(t)},pressed(){let t;D=!0;try{t=V()}finally{D=!1}const[e,l]=$(t),i=o(n,e,l,r),s={};for(const t of["bold","italic","underline","strike","sup","sub","link"]){const n=i.has(t),r=x&&x.at===e?x:null;s[t]=!!r?.add.includes(t)||!r?.drop.includes(t)&&n}const u=x&&x.at===e&&void 0!==x.color?x:null;return{marks:s,list:c(n,e,l,r),selected:l>e,href:m(n,e,l)?.href??null,color:u?u.color??null:p(n,e,l,r),style:l>e?a(n,e,l,r):null,clearable:X(e,l).text!==n}},press:Z,insert(t){if(b)return;w=!1;const e=V(),[r,l]=$(e),o=r+t.length;Y({text:n.slice(0,r)+t+n.slice(l),selectionStart:o,selectionEnd:o},e),ct(),s.focus({preventScroll:!0})},hold(){b||(V(),w=!0)},release(){w=!1},resume(){b||(w=!1,ct(),s.focus({preventScroll:!0}),I(y[0],y[1]))},link(t){if(b)return;w=!1;const e=V(),[l,o]=$(e),i=null===t?f(n,l,o,r):h(n,l,o,t,r),a=i.text===n;Y(i,e),ct(),s.focus({preventScroll:!0}),a&&I(e[0],e[1])},color(t){if(b)return;const e=V(),[l,o]=$(e);if(l===o){const e=x&&x.at===l?x:null;return x={add:e?.add??[],drop:e?.drop??[],color:t,at:l},void T()}Y(d(n,l,o,t,r),e)},textStyle(t){if(b)return;w=!1;const e=V(),[l,o]=$(e),i=Q({value:n,start:l,end:o,id:t,rules:r});i&&Y(i,e),ct(),s.focus({preventScroll:!0}),i||I(e[0],e[1])},clear(){if(b)return;const t=V(),[e,n]=$(t);Y(X(e,n),t)},list(e){if(b||!t.multiline)return;const l=V(),[o,i]=$(l),a=c(n,o,i,r);Y(u(n,o,i,a===e?null:e,r),l)}}}var rt=(t,e,n)=>Math.min(Math.max(t,e),Math.max(e,n));function lt({anchor:t,size:e,within:n,clip:r,parent:l,gap:o=8}){const i=Math.max(n.left,r.left),a=Math.min(n.right,r.right)-e.width,s=rt(t.left,i,a),c=r.bottom-(t.bottom+o),u=t.top-o-r.top,d=e.height>c&&(e.height<=u||u>c),f=d?t.top-o-e.height:t.bottom+o,h=t.left+Math.min((t.right-t.left)/2,10),p=rt(h-5-s,10,e.width-10-10);return{top:f-l.top,left:s-l.left,above:d,point:p}}var ot=t=>({left:t.left,top:t.top,right:t.right,bottom:t.bottom});function it(t,e){const n=("function"==typeof t.getClientRects?[...t.getClientRects()]:[]).filter(t=>t.height>0);if(n.length>0){const e="function"==typeof t.getBoundingClientRect?t.getBoundingClientRect():n[0];return e.height>0?ot(e):ot(n[0])}if(!e)return null;const r=e.getBoundingClientRect();return{left:r.left,top:r.top,right:r.left,bottom:r.bottom}}function at(t){const e=t.ownerDocument,n=e.documentElement,r={left:0,top:0,right:n.clientWidth,bottom:n.clientHeight},l=e.defaultView?.getComputedStyle.bind(e.defaultView);for(let o=t.parentElement;o&&o!==n&&o!==e.body;o=o.parentElement){const t=l?.(o);if(!t||"visible"===t.overflowX&&"visible"===t.overflowY)continue;const e=o.getBoundingClientRect();if(0===e.width&&0===e.height)continue;const n=e.left+o.clientLeft,i=e.top+o.clientTop;r.left=Math.max(r.left,n),r.top=Math.max(r.top,i),r.right=Math.min(r.right,n+(o.clientWidth||e.width)),r.bottom=Math.min(r.bottom,i+(o.clientHeight||e.height))}return r}function st(t){const e=t.offsetParent??t.parentElement;if(!e)return{left:0,top:0};const n=e.getBoundingClientRect();return{left:n.left+e.clientLeft-e.scrollLeft,top:n.top+e.clientTop-e.scrollTop}}function ct(t,e,n){const r=t.ownerDocument,l=r.createTreeWalker(t,4),o=t=>{let e=t,n=null;for(let t=l.nextNode();t;t=l.nextNode()){if(e<=t.data.length)return[t,e];e-=t.data.length,n=t}return n?[n,n.data.length]:null},i=o(e);l.currentNode=t;const a=o(n);if(!i||!a)return null;const s=r.createRange();return s.setStart(i[0],i[1]),s.setEnd(a[0],a[1]),s}export{Z as ColorWindow,A as MARKUP_CLIPBOARD_TYPE,$ as TYPING_BURST_MS,N as clearRangeOf,Y as colorRunOf,H as createHistory,q as editVisible,J as markPress,O as markupOfRange,F as newLine,st as offsetOrigin,C as pasteToMarkup,lt as placeWindow,U as richInput,B as richLayout,it as selectionBox,j as selectionToSource,P as selectionToVisible,I as setBullet,nt as startCanvasTyping,Q as styleChange,et as textMap,ct as textRange,W as toSource,L as toSourceStart,K as toVisible,at as visibleArea};
@@ -1,26 +0,0 @@
1
- import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{deviceMetaOf as t,noControlMetaOf as l}from"./chunk-YCSZAP7T.js";import{TreeSeam as r}from"./chunk-WHS6Y55E.js";import{SETTINGS_BUCKETS as o,SettingsGroup as a}from"./chunk-D4TH4QQR.js";import{DEFAULT_TREE_WORDS as i}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as s}from"./chunk-56ID6FKZ.js";import{easelMenuEntries as c}from"./chunk-FIVU2COQ.js";import{FieldNumber as d}from"./chunk-ANBPE45L.js";import{FieldSelect as u}from"./chunk-C63IB4VW.js";import{SettingsSegmented as m}from"./chunk-DX3VILZ3.js";import{SettingsField as h}from"./chunk-MIX7EGRG.js";import{DEFAULT_FIELDS_WORDS as p}from"./chunk-UMTUKSE6.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{useTreeDrag as b,gapToMoveIndex as v}from"./chunk-QEEW4X64.js";import{withTip as g}from"./chunk-P2VEMZH5.js";import{normalizePhoneOrder as y,isCustomPhoneOrder as k,settlePhoneOrder as w,clone as x}from"./chunk-YDTEYXQW.js";import{Textarea as C,Input as O,ItemCount as N,SortableList as D,ListRow as j,IconButton as I,ContextMenu as S,tabPanelId as $,Tabs as P,tabButtonId as L,Button as E}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as T,useState as F,useLayoutEffect as M,useId as R}from"react";import{jsx as z,jsxs as W,Fragment as B}from"react/jsx-runtime";import{LockIcon as A,CloseIcon as H,ListIcon as Y,MoveUpIcon as K,MoveDownIcon as Q,DuplicateIcon as V,TrashIcon as X}from"efficient-shell/icons/efficient";function Z({id:e,value:n,onChange:t,placeholder:l,multiline:r=!1,rows:o=3,readOnly:a=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return r?/* @__PURE__ */z(C,{id:e,size:"sm",className:"es-fin",value:c,rows:o,placeholder:l,readOnly:a,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */z(O,{id:e,size:"md",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:a,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function U(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function G(e,n,t){const l=e.slice(),[r]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,r),l}function q(e,n){return e.filter((e,t)=>t!==n)}var _='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',J={parentId:"list",slot:"items"};function ee({label:e,icon:n,noun:t,items:l,onChange:o,newItem:a,summary:s,itemName:d,thumb:u,min:m=0,max:h,readOnly:y=!1,open:k,onOpen:w,renderItem:C,renderRow:O,canRemove:$,lockedReason:P,fixed:L=!1,removeOnRow:E=!0,canDuplicate:R,above:Y,head:Z=!0}){const ee=f("fields",p).list,ne=f("tree",i),te=t??ee.item,le=!y&&!L&&("number"!=typeof h||l.length<h),re=l.length<=m,oe=e=>!!$&&!$(l[e],e),ae=e=>!y&&!L&&E&&!re&&!oe(e),ie=e=>le&&(!R||R(l[e],e)),se=(e,n)=>d?d(e,n):ee.itemName({noun:te,n:n+1}),ce=T([]),de=T(null),[ue,me]=F(null),he=T(null),[pe,fe]=F(null),[be,ve]=F("");M(()=>{const e=de.current;if(!e)return;de.current=null;const n=ce.current[e.index]?.querySelectorAll(_)[e.nth]??ce.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const ge=(e,n)=>{if(n<0||n>=l.length||n===e)return;const t=ce.current[e],r=t?.ownerDocument.activeElement;if(t&&r&&t.contains(r)){const e=[...t.querySelectorAll(_)].indexOf(r),l=r;de.current={index:n,nth:e,start:"number"==typeof l.selectionStart?l.selectionStart:null,end:"number"==typeof l.selectionEnd?l.selectionEnd:null}}o(G(l,e,n));const a=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}(k,e,n);a!==k&&w(a),ve(ee.moved({n:n+1,total:l.length}))},ye=e=>{le&&(o(U(l,e,a())),O?(de.current={index:e,nth:0,start:null,end:null},null!==k&&k>=e&&w(k+1)):w(e))},ke=e=>{ae(e)&&(o(q(l,e)),k===e?w(null):null!==k&&k>e&&w(k-1))},we=b({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===J.parentId&&n.slot===J.slot,onDrop:(e,n)=>{const t=v({...J,index:e},n);t!==e&&ge(e,t)},onStep:(e,n)=>ge(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<l.length,readOnly:y}),xe=e=>{const n=[];return e>0&&n.push({label:ee.moveUp,icon:/* @__PURE__ */z(K,{size:14}),shortcut:"⌥↑",onClick:()=>ge(e,e-1)}),e<l.length-1&&n.push({label:ee.moveDown,icon:/* @__PURE__ */z(Q,{size:14}),shortcut:"⌥↓",onClick:()=>ge(e,e+1)}),ie(e)&&n.push({label:ee.duplicate,icon:/* @__PURE__ */z(V,{size:14}),onClick:()=>(e=>{ie(e)&&(o(U(l,e+1,x(l[e]))),null!==k&&k>e&&w(k+1))})(e)}),ae(e)&&n.push({label:ee.delete,icon:/* @__PURE__ */z(X,{size:14}),danger:!0,onClick:()=>ke(e)}),n},Ce=(e,n,t,l)=>{y||0===xe(e).length||fe({index:e,x:n,y:t,owner:l})},Oe=e=>n=>{const t=l.slice();t[e]=n,o(t)};/* @__PURE__ */
2
- return W("div",{className:"es-list",children:[Z?/* @__PURE__ */W("div",{className:"es-list-head",children:[
3
- /* @__PURE__ */W("span",{className:"es-list-label",children:[n?/* @__PURE__ */z("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
4
- /* @__PURE__ */z(N,{count:l.length,label:ee.count({noun:te,n:l.length}),showZero:!0})]}):null,Y?/* @__PURE__ */z("div",{className:"es-list-above",children:Y}):null,l.length?/* @__PURE__ */W(D,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:we.rootProps(),children:[l.map((e,n)=>{const t=we.row({item:n,place:{...J,index:n}}),l=t.draggable&&ue!==n,o=!O&&k===n,a=!y&&!L&&E&&oe(n),i=["es-list-row",O?"is-inline":"is-item",o?"is-open":"",l?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */z(r,{...we.seam({place:{...J,index:n}}),onAdd:le?()=>ye(n):void 0,label:ee.addHere({noun:te})},`seam-${n}`):null,
5
- /* @__PURE__ */z(j,{className:i,flat:!!O,active:o,title:O?void 0:/* @__PURE__ */W(B,{children:[
6
- /* @__PURE__ */z("span",{className:"es-list-row-name",children:se(e,n)}),s?/* @__PURE__ */z("span",{className:"es-list-row-summary",children:s(e,n)}):null]}),thumb:!O&&u?u(e,n):void 0,expanded:O?void 0:o,onToggle:O?void 0:()=>w(o?null:n),draggable:t.draggable,dragHint:ne.dragHint,dragging:t.dragging,drop:"before"===t.drop||"after"===t.drop?t.drop:void 0,onMove:t.draggable?e=>ge(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{ce.current[n]=e},rowProps:{...t.rowProps,draggable:l||void 0,onPointerDown:e=>{const l=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),r=!!l&&l===l.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!r,he.current=l&&!r?l:null,me(r?n:null)},onDragStart:e=>{const n=he.current;he.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{y||(e.preventDefault(),e.stopPropagation(),Ce(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const r=e.currentTarget.getBoundingClientRect();return void Ce(n,r.left+24,r.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)}},actions:y||L||!E?void 0:a?g(P?P(e,n):ee.locked,/* @__PURE__ */z("span",{className:"es-list-lock",role:"img","aria-label":P?P(e,n):ee.locked,children:/* @__PURE__ */z(A,{size:13})})):g(ee.deleteItem({noun:te}),/* @__PURE__ */z(I,{size:"sm",className:"es-list-x","aria-label":ee.deleteItem({noun:te}),disabled:!ae(n),onClick:()=>ke(n),children:/* @__PURE__ */z(H,{size:14,"aria-hidden":"true"})})),below:o?/* @__PURE__ */z("div",{className:"es-list-item",children:C(e,n,Oe(n))}):void 0,children:O?/* @__PURE__ */z("div",{className:"es-list-row-main",children:O(e,n,Oe(n))}):null},n)]}),
7
- /* @__PURE__ */z(r,{...we.seam({place:{...J,index:l.length}})})]}):null,y||L?null:/* @__PURE__ */z("button",{type:"button",className:"es-list-add",disabled:!le,onClick:()=>ye(l.length),children:ee.add({noun:te})}),
8
- /* @__PURE__ */z("span",{className:"es-list-said","aria-live":"polite",children:be}),pe&&pe.index<l.length?
9
- /* @__PURE__ */z(S,{at:{x:pe.x,y:pe.y},owner:pe.owner,onClose:()=>fe(null),items:c(xe(pe.index))}):null]})}var ne=e=>e<6?e+1:6,te=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function le({field:e,name:t,id:l,value:r,onChange:o,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=F(!0),p=r&&"object"==typeof r?r:{};/* @__PURE__ */
10
- return z(a,{id:`${l}-group`,title:te(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */z(oe,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>o({...p,[e]:n}),readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:ne(u)},e))})}function re({field:e,name:t,id:l,value:r,onChange:o,readOnly:a,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=F(null),f=u?d??null:h,b=u??p,v=Array.isArray(r)?r:[],g=e.getItemSummary;/* @__PURE__ */
11
- return z(ee,{label:te(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:v,onChange:o,newItem:()=>x({...e.defaultItemProps??{}}),summary:g?(e,n)=>g(e,n):void 0,min:e.min,max:e.max,readOnly:a,open:f,onOpen:b,renderItem:(r,o,d)=>Object.entries(n(e.arrayFields,{values:r,context:s})).map(([e,n])=>/* @__PURE__ */z(oe,{field:n,name:`${t}[${o}].${e}`,id:`${l}-${o}-${e}`,value:r?.[e],onChange:n=>d({...r,[e]:n}),readOnly:a,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function oe(e){const{field:n,name:t,id:l,value:r,onChange:o,readOnly:a,context:i,renderers:s}=e;if(!n||n.marker||!1===n.visible)return null;const c=s?.[n.type];if(c)return c({field:n,name:t,id:l,value:r,onChange:o,readOnly:a});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:r,onChange:o,readOnly:a};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
12
- return z(h,{label:te(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */z(Z,{id:l,value:"string"==typeof r?r:null==r?"":String(r),onChange:o,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:a})});case"number":/* @__PURE__ */
13
- return z(h,{label:te(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */z(d,{id:l,value:"number"==typeof r?r:void 0,onChange:o,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:a})});case"select":{const e=`${l}-label`;/* @__PURE__ */
14
- return z(h,{label:te(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */z(u,{id:l,value:r,options:n.options,onChange:o,readOnly:a,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
15
- return z(h,{label:te(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */z(m,{ariaLabel:te(n,t),value:r,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||a})),onChange:e=>{a||o(e)}})});case"object":/* @__PURE__ */
16
- return z(le,{...e,field:n});case"array":/* @__PURE__ */
17
- return z(re,{...e,field:n});case"slot":return null}}function ae(e,n,r){if("mobile"!==n&&"tablet"!==n)return!0;const o=e;if(o&&"string"==typeof o.reachedBy){const t=r?.[o.reachedBy];return void 0!==t&&t!==e&&ae(t,n)}if(!o||o.marker||"slot"===o.type)return!0;const a=t(e)?.tier;return a?a===n||"each"===a:"always"===l(e)}var ie={},se=e=>o.includes(e);function ce(n,t){let l,r=o[0];const a=[],i=/* @__PURE__ */new Set;for(const[o,s]of Object.entries(n))s&&(se(s.bucket)&&((s.marker||s.bucket!==r)&&(l=void 0),r=s.bucket),s.marker&&"string"==typeof s.fold?l={key:o,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||t&&!ue(s,n,t)||t&&!ae(s,t.context?.device,n)||(a.push(l?{name:o,field:s,bucket:r,fold:l}:{name:o,field:s,bucket:r}),"slot"!==s.type&&i.add(r)));return{rows:a,buckets:o.filter(e=>i.has(e))}}function de(e){return new Map(ce(e).rows.map(e=>[e.name,e.bucket]))}function ue(n,t,l){const r=n.reachedBy;if("string"!=typeof r)return!0;const o=t[r];return!!o&&!1!==o.visible&&e(o,l)}function me(e){const n=[];for(const t of e){const e=n[n.length-1];e&&e.fold?.key===t.fold?.key?e.rows.push(t):n.push({fold:t.fold,rows:[t]})}return n}function he({fields:e,values:n,onChange:t,readOnly:l=!1,context:r,showWhenContext:i,tab:c,onTab:d,tabs:u=!0,allTabs:m=!1,tabIcons:h,renderers:p,idPrefix:b,ariaLabel:v,lead:g,children:y,leadFold:k,closedFolds:w,onFold:x,headingLevel:C=3}){const O=f("panel",s),N=R(),D=b??`es-insp${N.replace(/:/g,"")}`,j=ce(e,{values:n,context:i}),[I,S]=F(void 0),E=I&&(I.panel===D||j.buckets.includes(I.tab))?I.tab:void 0,T=c??E,M=m?o:j.buckets,B=T&&M.includes(T)?T:j.buckets[0]??M[0],[A,H]=F(null),Y=A&&A.panel===D&&j.rows.some(e=>e.name===A.name)?A:null,K=u&&M.length>1,Q=K&&B?$(D,B):`${D}-rows`,[V,X]=F(()=>/* @__PURE__ */new Set),Z=w??V,U=(e,n)=>{/* @__PURE__ */return z(a,{title:e.title,open:!Z.has(e.key),onToggle:n=>((e,n)=>{void 0===w&&X(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),x?.(e,n)})(e.key,n),id:`${D}-fold-${t=e.key,[...t].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:C,children:n});var t},G=e=>K&&e!==B,q=({name:e,field:o,bucket:a,fold:s})=>/* @__PURE__ */z("div",{className:"es-insp-row","data-field":e,"data-bucket":a,hidden:!!G(a)||void 0,children:/* @__PURE__ */z(oe,{field:o,name:e,id:`${D}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:r,showWhenContext:i,renderers:p,openItem:Y&&Y.name===e?Y.index:null,onOpenItem:n=>H(null===n?null:{panel:D,name:e,index:n}),headingLevel:s?ne(C):C})},e);/* @__PURE__ */
18
- return W("div",{className:"es-insp",children:[K?/* @__PURE__ */z("div",{className:"es-insp-tabs",children:/* @__PURE__ */z(P,{variant:"underline",block:!0,"aria-label":v??O.settings,idPrefix:D,value:B,onChange:e=>{const n=e;void 0===c&&S({panel:D,tab:n}),d?.(n)},items:M.map(e=>{const n=O.buckets[e],t=h?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */z("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
19
- /* @__PURE__ */W("div",{className:"es-insp-rows",id:Q,role:K?"tabpanel":void 0,"aria-labelledby":K&&B?L(D,B):void 0,children:[g&&ae(ie,i?.device)?k?/* @__PURE__ */z("div",{className:"es-insp-band","data-fold":k.key,children:U(k,g)}):g:null,me(j.rows).map((e,n)=>{if(!e.fold)return e.rows.map(q);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
20
- return z("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!G(t)&&!l)||void 0,children:U(e.fold,e.rows.map(q))},`fold-${e.fold.key}-${n}`)}),y]})]})}function pe(e,n,l=ae){const r=t(e)?.tier,o=t=>l(e,t,n)&&r!==t&&"each"!==r?1:0;return{phoneShared:o("mobile"),tabletShared:o("tablet")}}function fe(e){const{arrayFields:n,objectFields:t}=e;return Object.values(n??t??{}).reduce((e,n)=>e+1+fe(n),0)}var be=/\buse(?:PreviewDevice\(\)|(?:Context)?\(PreviewDeviceContext\))|\b(?:previewD|d)evice\s*(?:[!=]==?|\?)|(?:[!=]==?)\s*(?:previewD|d)evice\b|switch\s*\(\s*(?:previewD|d)evice\b|shownTier\(\w+\)\s*[!=]==|\btier\s*[!=]==\s*"(?:mobile|tablet|desktop|each)"|context:\s*"device"/g;function ve(e){return e.match(be)??[]}function ge({value:e,count:n,onChange:t,readOnly:l,noun:r,itemLabel:o,hint:a,children:i}){const s=f("fields",p).phoneOrder??p.phoneOrder;if(!(n>=2))return null;const c=y(e,n),d=k(c);/* @__PURE__ */
21
- return z(h,{label:s.label,icon:/* @__PURE__ */z(Y,{}),hint:a??s.hint({noun:r}),value:n,children:/* @__PURE__ */W("div",{className:"es-phone-order",children:[
22
- /* @__PURE__ */z(ee,{label:s.label,head:!1,noun:r,items:c,onChange:e=>t(w(e,n)),newItem:()=>0,fixed:!0,readOnly:l,open:null,onOpen:()=>{},renderItem:()=>null,itemName:e=>o(e),renderRow:(e,n)=>/* @__PURE__ */W("span",{className:"es-phone-order-row",children:[
23
- /* @__PURE__ */z("span",{className:"es-phone-order-pos","aria-hidden":"true",children:n+1}),
24
- /* @__PURE__ */z("span",{className:"es-phone-order-name",children:o(e)})]})}),
25
- /* @__PURE__ */z("p",{className:"es-phone-order-note",children:d?s.desktopKept:s.followsDesktop({noun:r})}),d&&i,d&&!l&&
26
- /* @__PURE__ */z(E,{variant:"secondary",size:"md",block:!0,onClick:()=>t(void 0),children:s.matchDesktop})]})})}export{Z as FieldText,he as Inspector,oe as InspectorField,ee as ListField,ge as PhoneOrderField,de as bucketsOf,ae as fieldShownInView,fe as innerRowCount,U as insertAt,te as labelOf,G as moveTo,ce as planFields,q as removeAt,pe as rowViewState,ve as viewReadsIn};
@@ -1,5 +0,0 @@
1
- import{usePickFollowsSelection as n}from"./chunk-NCXYC7WI.js";import{slotFieldsOf as e,slotChildrenIn as t}from"./chunk-TCAAOYQY.js";import{EaselCanvas as r,useSelectedFields as o}from"./chunk-L36E2WCO.js";import{Inspector as i}from"./chunk-SDSBXW3V.js";import{fieldIsShown as u}from"./chunk-BPXEFVSQ.js";import{createContext as l,useContext as s}from"react";import{DesktopIcon as c}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";var a={kind:"selection"};function d(n){return"selection"===n.kind}function p(n,e){if(d(n)&&d(e))return!0;const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}function m(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function k(n,t){const r=n.components?.[t.type]?.fields??{};return e(n,t.type).filter(n=>u(r[n],{values:t.props}))}function h(n,e){return k(n,e).flatMap(n=>t(e,n))}function v(n,e,t){const r=n.slotsOf?.(t);return r||k(e,t).map(n=>({slot:n,label:n,rung:!1}))}function y(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function g(n,e){return n.isLast?n.isLast(e):e.type===n.last}var b={},O=()=>b,S=()=>"",j=()=>null,C=()=>{},w={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},B={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */f(c,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},D={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},N={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function P(){/* @__PURE__ */
2
- return f(r,{height:"fill"})}function I(){const{id:n,fields:e,values:t,readOnly:r,onChange:u}=o();/* @__PURE__ */
3
- return f("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */f(i,{fields:e,values:t,onChange:u,readOnly:r,idPrefix:n})})}var x=l({});function A({parts:n,children:e}){/* @__PURE__ */
4
- return f(x.Provider,{value:n,children:e})}function F(){return s(x)}function G(){return(F().useOwnerName??S)()}function T(){return(F().useDocumentLabel??j)()}function V(n,e,t,r){return(F().useBridges??O)(n,e,t,r)}function W(n){return(F().useStandaloneBridges??O)(n)}function X(n,e){(F().useDocumentPass??C)(n,e)}function Y(){return F().blockRules??w}function E(){return F().blockLook??L}function Q(){return F().devices??B}function R(){return F().leftView??D}function H(){return F().pinned??N}function K(){return F().saveSwitch??!0}function M(e){n(!0===F().pickFollowsSelection,e)}function Z(){return F().storageNamespace||void 0}function q(){return F().styleClipboard??null}function z(){return F().nodeKeys??!0}function J(){return F().notify??null}function U(){return F().Canvas??P}function $(){return F().CanvasHead??null}function _(){return F().canvasDrag??null}var nn=l(null);function en({target:n,children:e}){/* @__PURE__ */
5
- return f(nn.Provider,{value:n,children:e})}function tn(){return s(nn)}function rn(){return F().Inspector??I}export{a as SELECTION_MODE,en as ScreenCanvasTargetProvider,A as ScreenPartsProvider,y as isPinnedFirst,g as isPinnedLast,d as isSelectionMode,m as isSlotMode,p as sameInspectorMode,v as screenSlotsOf,h as shownChildSlotsOf,k as shownSlotFieldsOf,E as useScreenBlockLook,Y as useScreenBlockRules,V as useScreenBridges,_ as useScreenCanvasDrag,U as useScreenCanvasFrame,$ as useScreenCanvasHead,tn as useScreenCanvasTarget,Q as useScreenDevices,T as useScreenDocumentLabel,X as useScreenDocumentPass,rn as useScreenInspectorPanel,R as useScreenLeftView,z as useScreenNodeKeys,J as useScreenNotify,G as useScreenOwnerName,F as useScreenParts,M as useScreenPickFollowsSelection,H as useScreenPinned,K as useScreenSaveSwitch,Z as useScreenStorageNamespace,q as useScreenStyleClipboard,W as useStandaloneScreenBridges};