efficient-easel 19.0.0 → 19.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/chrome/chrome.css +11 -0
  2. package/dist/{chunk-4ES5JGGX.js → chunk-3Z2MVLCD.js} +1 -1
  3. package/dist/chunk-45NZSAND.js +2 -0
  4. package/dist/{chunk-WMQKV3DK.js → chunk-6U6AISPX.js} +4 -4
  5. package/dist/{chunk-6DNDTEF6.js → chunk-BQMZ2YAF.js} +1 -1
  6. package/dist/chunk-EFQCH7CO.js +1 -0
  7. package/dist/chunk-I2BCNLLV.js +5 -0
  8. package/dist/chunk-LFHMDGLE.js +8 -0
  9. package/dist/chunk-LOXB5OVK.js +63 -0
  10. package/dist/chunk-OD4WIIER.js +1 -0
  11. package/dist/{chunk-CM732ENS.js → chunk-RTCNJRF6.js} +1 -1
  12. package/dist/chunk-UAS2LEW2.js +1 -0
  13. package/dist/chunk-UZXGXMNO.js +14 -0
  14. package/dist/{chunk-5ZBV5RA6.js → chunk-ZFFWO2AF.js} +16 -16
  15. package/dist/copy/index.js +13 -13
  16. package/dist/easel/index.d.ts +13 -0
  17. package/dist/easel/index.js +1 -1
  18. package/dist/fields/index.js +1 -1
  19. package/dist/panel/index.d.ts +93 -1
  20. package/dist/panel/index.js +15 -13
  21. package/dist/panel/panel.css +12 -0
  22. package/dist/screen/components/AddBlockRow.js +1 -1
  23. package/dist/screen/components/AddSidePanel.js +1 -1
  24. package/dist/screen/components/NodeContextMenu.js +1 -1
  25. package/dist/screen/components/ScreenChrome.js +1 -1
  26. package/dist/screen/components/ScreenMount.js +1 -1
  27. package/dist/screen/components/ScreenStoreProvider.d.ts +3 -1
  28. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  29. package/dist/screen/components/SectionScreenShell.js +17 -17
  30. package/dist/screen/components/usePartBridge.js +1 -1
  31. package/dist/screen/index.js +1 -1
  32. package/dist/screen/lib/key-scope.js +1 -1
  33. package/dist/screen/lib/puck/preview-dom.js +1 -1
  34. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  35. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  36. package/dist/screen/lib/screen-parts.js +1 -1
  37. package/dist/screen/screen.css +9 -0
  38. package/dist/strings/index.js +2 -2
  39. package/dist/text-styles/index.js +20 -20
  40. package/package.json +1 -1
  41. package/dist/chunk-324PHMLC.js +0 -8
  42. package/dist/chunk-CPFDJMFD.js +0 -14
  43. package/dist/chunk-EZKUTVQP.js +0 -62
  44. package/dist/chunk-J4MHNAED.js +0 -5
  45. package/dist/chunk-JC34NH4G.js +0 -1
  46. package/dist/chunk-LUBJKUVV.js +0 -1
  47. package/dist/chunk-SP3TRDKA.js +0 -2
  48. package/dist/chunk-T5WDR5IE.js +0 -1
@@ -1 +1 @@
1
- export{usePartBridge}from"../../chunk-T5WDR5IE.js";import"../../chunk-LUBJKUVV.js";import"../../chunk-J4MHNAED.js";import"../../chunk-LNHT2KPX.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-CPFDJMFD.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-5ZBV5RA6.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BALFHI3G.js";import"../../chunk-X3TYRF5V.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-2XMHLXMA.js";import"../../chunk-G3GWAP5R.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-36LVP5WD.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";
1
+ export{usePartBridge}from"../../chunk-OD4WIIER.js";import"../../chunk-UAS2LEW2.js";import"../../chunk-I2BCNLLV.js";import"../../chunk-LNHT2KPX.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-UZXGXMNO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ZFFWO2AF.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-67GNT6PF.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BALFHI3G.js";import"../../chunk-X3TYRF5V.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-2XMHLXMA.js";import"../../chunk-G3GWAP5R.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-36LVP5WD.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-PLVEGYK6.js";
@@ -1 +1 @@
1
- import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-WMQKV3DK.js";import"../chunk-GXQCZJOP.js";import"../chunk-EZKUTVQP.js";import"../chunk-2GVCAIPX.js";import"../chunk-26OOWIJJ.js";import"../chunk-JBOSEHIX.js";import"../chunk-FGNR22NY.js";import"../chunk-LER7RKTO.js";import"../chunk-FGYJ5DJY.js";import"../chunk-7F52SZOI.js";import"../chunk-MQNBD6AB.js";import"../chunk-4ES5JGGX.js";import"../chunk-6DNDTEF6.js";import"../chunk-KCBEE2MC.js";import"../chunk-C56MPJBH.js";import"../chunk-T5WDR5IE.js";import"../chunk-LUBJKUVV.js";import"../chunk-PY7OOQEZ.js";import"../chunk-RKTF5XLP.js";export{ScreenStoreProvider}from"../chunk-SP3TRDKA.js";import"../chunk-5545A3PC.js";import"../chunk-324PHMLC.js";import"../chunk-PA3PNTVV.js";import"../chunk-5ZBY24K7.js";import"../chunk-BVN33R76.js";import"../chunk-43AEUUNQ.js";import"../chunk-SINAM2IT.js";import"../chunk-UMDQ6CLQ.js";import"../chunk-M2Z775ZC.js";export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-J4MHNAED.js";import"../chunk-MS2U6MV5.js";import"../chunk-JC34NH4G.js";import"../chunk-V7U33NF2.js";import"../chunk-5DPIGWUL.js";import"../chunk-M62P4IQK.js";import"../chunk-EZG3TGQ7.js";import"../chunk-ERR437B5.js";import"../chunk-RYNBSKE7.js";import"../chunk-GMCZXMOV.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-CLOS6SSX.js";import"../chunk-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";import"../chunk-KCOBHPN6.js";import"../chunk-LNHT2KPX.js";export{EaselSessionProvider,useEaselSession}from"../chunk-O7Q4DDJT.js";export{EFFICIENT_BACKEND,activateEaselSession,backendOf,createEaselSession,currentEaselSession,deactivateEaselSession,efficientClientOpen,isEfficientBackend,provideDefaultBackend,resetAmbientEaselSession,sessionRegistry,setSessionBridgedSite,setSessionDocumentSite}from"../chunk-RSCMJIWS.js";export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost,useHostEscape}from"../chunk-U3JP4VGF.js";import"../chunk-4VJATVVR.js";import"../chunk-6WY6ZXJG.js";import"../chunk-23DYNW6S.js";import"../chunk-BHRC3ASL.js";import"../chunk-6W7WLPZH.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-IYT6NN2J.js";import"../chunk-PLVEGYK6.js";import"../chunk-CPFDJMFD.js";import"../chunk-TBY3DFKS.js";import"../chunk-5ZBV5RA6.js";import"../chunk-BPXEFVSQ.js";import"../chunk-A6Z4SD3I.js";import"../chunk-K56YDHYQ.js";import"../chunk-XWFH2NHZ.js";import"../chunk-YRLPFZW3.js";import"../chunk-WXFZD7WC.js";import"../chunk-BALFHI3G.js";import"../chunk-OSPUG6S6.js";import"../chunk-WK3AFPXY.js";import"../chunk-X3TYRF5V.js";import"../chunk-RC25EGHD.js";import"../chunk-KFV7N2DJ.js";import"../chunk-NDRZP6YR.js";import"../chunk-H6DDIBQ4.js";import"../chunk-ZG6PVMC3.js";import"../chunk-MJM6SFD3.js";import"../chunk-AJSDWWJW.js";import"../chunk-2OAZYSWJ.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-23VM4PMV.js";import"../chunk-KRL3IUV3.js";import"../chunk-2XMHLXMA.js";import"../chunk-G3GWAP5R.js";import"../chunk-WRFD4EXD.js";import"../chunk-36LVP5WD.js";import"../chunk-MFIRYGHW.js";import"../chunk-Z2V3TTAR.js";import"../chunk-KAML3KQH.js";import"../chunk-67GNT6PF.js";import"../chunk-P2VEMZH5.js";import"../chunk-X4T6JT3M.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";
1
+ import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-6U6AISPX.js";import"../chunk-GXQCZJOP.js";import"../chunk-LOXB5OVK.js";import"../chunk-2GVCAIPX.js";import"../chunk-26OOWIJJ.js";import"../chunk-JBOSEHIX.js";import"../chunk-FGNR22NY.js";import"../chunk-LER7RKTO.js";import"../chunk-FGYJ5DJY.js";import"../chunk-7F52SZOI.js";import"../chunk-MQNBD6AB.js";import"../chunk-3Z2MVLCD.js";import"../chunk-BQMZ2YAF.js";import"../chunk-KCBEE2MC.js";import"../chunk-C56MPJBH.js";import"../chunk-OD4WIIER.js";import"../chunk-UAS2LEW2.js";import"../chunk-PY7OOQEZ.js";import"../chunk-RKTF5XLP.js";export{ScreenStoreProvider}from"../chunk-45NZSAND.js";import"../chunk-5545A3PC.js";import"../chunk-LFHMDGLE.js";import"../chunk-PA3PNTVV.js";import"../chunk-5ZBY24K7.js";import"../chunk-BVN33R76.js";import"../chunk-43AEUUNQ.js";import"../chunk-SINAM2IT.js";import"../chunk-UMDQ6CLQ.js";import"../chunk-M2Z775ZC.js";export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-I2BCNLLV.js";import"../chunk-MS2U6MV5.js";import"../chunk-EFQCH7CO.js";import"../chunk-5DPIGWUL.js";import"../chunk-M62P4IQK.js";import"../chunk-EZG3TGQ7.js";import"../chunk-ERR437B5.js";import"../chunk-RYNBSKE7.js";import"../chunk-GMCZXMOV.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-CLOS6SSX.js";import"../chunk-VPFNZ7TB.js";import"../chunk-LOMEH6DG.js";import"../chunk-KCOBHPN6.js";import"../chunk-LNHT2KPX.js";export{EaselSessionProvider,useEaselSession}from"../chunk-O7Q4DDJT.js";export{EFFICIENT_BACKEND,activateEaselSession,backendOf,createEaselSession,currentEaselSession,deactivateEaselSession,efficientClientOpen,isEfficientBackend,provideDefaultBackend,resetAmbientEaselSession,sessionRegistry,setSessionBridgedSite,setSessionDocumentSite}from"../chunk-RSCMJIWS.js";export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost,useHostEscape}from"../chunk-U3JP4VGF.js";import"../chunk-4VJATVVR.js";import"../chunk-23DYNW6S.js";import"../chunk-V7U33NF2.js";import"../chunk-6WY6ZXJG.js";import"../chunk-Z2V3TTAR.js";import"../chunk-KAML3KQH.js";import"../chunk-UZXGXMNO.js";import"../chunk-TBY3DFKS.js";import"../chunk-ZFFWO2AF.js";import"../chunk-BPXEFVSQ.js";import"../chunk-A6Z4SD3I.js";import"../chunk-K56YDHYQ.js";import"../chunk-XWFH2NHZ.js";import"../chunk-67GNT6PF.js";import"../chunk-YRLPFZW3.js";import"../chunk-WXFZD7WC.js";import"../chunk-BALFHI3G.js";import"../chunk-OSPUG6S6.js";import"../chunk-WK3AFPXY.js";import"../chunk-X3TYRF5V.js";import"../chunk-RC25EGHD.js";import"../chunk-KFV7N2DJ.js";import"../chunk-P2VEMZH5.js";import"../chunk-NDRZP6YR.js";import"../chunk-H6DDIBQ4.js";import"../chunk-X4T6JT3M.js";import"../chunk-KRXQM65X.js";import"../chunk-NKB3KVAB.js";import"../chunk-23VM4PMV.js";import"../chunk-KRL3IUV3.js";import"../chunk-2XMHLXMA.js";import"../chunk-G3GWAP5R.js";import"../chunk-WRFD4EXD.js";import"../chunk-36LVP5WD.js";import"../chunk-ZG6PVMC3.js";import"../chunk-MJM6SFD3.js";import"../chunk-AJSDWWJW.js";import"../chunk-2OAZYSWJ.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MFIRYGHW.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-BHRC3ASL.js";import"../chunk-6W7WLPZH.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-IYT6NN2J.js";import"../chunk-PLVEGYK6.js";
@@ -1 +1 @@
1
- export{editorRootFocus,isSaveShortcut,useEaselKeyTarget,useEaselSaveKey,useEaselUndoKeys}from"../../chunk-6DNDTEF6.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-CPFDJMFD.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-X3TYRF5V.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{editorRootFocus,isSaveShortcut,useEaselKeyTarget,useEaselSaveKey,useEaselUndoKeys}from"../../chunk-BQMZ2YAF.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-UZXGXMNO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-X3TYRF5V.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-MFIRYGHW.js";
@@ -1 +1 @@
1
- export{gotoPreviewSlide,pinPreviewToBottom,pinPreviewToSection,previewFrame,scrollPreviewToSection,scrollPreviewToTop}from"../../../chunk-4ES5JGGX.js";import"../../../chunk-IQ5TA7AM.js";import"../../../chunk-R5L2E7JX.js";
1
+ export{gotoPreviewSlide,pinPreviewToBottom,pinPreviewToSection,previewFrame,scrollPreviewToSection,scrollPreviewToTop}from"../../../chunk-3Z2MVLCD.js";import"../../../chunk-R5L2E7JX.js";import"../../../chunk-IQ5TA7AM.js";
@@ -1 +1 @@
1
- export{copyNodeStyle,nodeStyleRows,planNodePaste,shopFieldKind,siteStyleScope,styleClipboardOf}from"../../../chunk-JBOSEHIX.js";import"../../../chunk-LER7RKTO.js";import"../../../chunk-FGYJ5DJY.js";import"../../../chunk-7F52SZOI.js";import"../../../chunk-MQNBD6AB.js";import"../../../chunk-V7U33NF2.js";import"../../../chunk-6WY6ZXJG.js";import"../../../chunk-23DYNW6S.js";import"../../../chunk-DUVRZ456.js";import"../../../chunk-BPXEFVSQ.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-BSPCSC45.js";
1
+ export{copyNodeStyle,nodeStyleRows,planNodePaste,shopFieldKind,siteStyleScope,styleClipboardOf}from"../../../chunk-JBOSEHIX.js";import"../../../chunk-LER7RKTO.js";import"../../../chunk-FGYJ5DJY.js";import"../../../chunk-7F52SZOI.js";import"../../../chunk-MQNBD6AB.js";import"../../../chunk-23DYNW6S.js";import"../../../chunk-V7U33NF2.js";import"../../../chunk-6WY6ZXJG.js";import"../../../chunk-BPXEFVSQ.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-BSPCSC45.js";import"../../../chunk-DUVRZ456.js";
@@ -1 +1 @@
1
- export{useSectionOps}from"../../../chunk-LUBJKUVV.js";import"../../../chunk-J4MHNAED.js";import"../../../chunk-LNHT2KPX.js";import"../../../chunk-U3JP4VGF.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-CPFDJMFD.js";import"../../../chunk-TBY3DFKS.js";import"../../../chunk-5ZBV5RA6.js";import"../../../chunk-BPXEFVSQ.js";import"../../../chunk-A6Z4SD3I.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-XWFH2NHZ.js";import"../../../chunk-YRLPFZW3.js";import"../../../chunk-BALFHI3G.js";import"../../../chunk-X3TYRF5V.js";import"../../../chunk-RC25EGHD.js";import"../../../chunk-KFV7N2DJ.js";import"../../../chunk-23VM4PMV.js";import"../../../chunk-KRL3IUV3.js";import"../../../chunk-2XMHLXMA.js";import"../../../chunk-G3GWAP5R.js";import"../../../chunk-WRFD4EXD.js";import"../../../chunk-36LVP5WD.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-67GNT6PF.js";import"../../../chunk-P2VEMZH5.js";import"../../../chunk-X4T6JT3M.js";import"../../../chunk-KRXQM65X.js";import"../../../chunk-NKB3KVAB.js";
1
+ export{useSectionOps}from"../../../chunk-UAS2LEW2.js";import"../../../chunk-I2BCNLLV.js";import"../../../chunk-LNHT2KPX.js";import"../../../chunk-U3JP4VGF.js";import"../../../chunk-UZXGXMNO.js";import"../../../chunk-TBY3DFKS.js";import"../../../chunk-ZFFWO2AF.js";import"../../../chunk-BPXEFVSQ.js";import"../../../chunk-A6Z4SD3I.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-XWFH2NHZ.js";import"../../../chunk-67GNT6PF.js";import"../../../chunk-YRLPFZW3.js";import"../../../chunk-BALFHI3G.js";import"../../../chunk-X3TYRF5V.js";import"../../../chunk-RC25EGHD.js";import"../../../chunk-KFV7N2DJ.js";import"../../../chunk-P2VEMZH5.js";import"../../../chunk-X4T6JT3M.js";import"../../../chunk-KRXQM65X.js";import"../../../chunk-NKB3KVAB.js";import"../../../chunk-23VM4PMV.js";import"../../../chunk-KRL3IUV3.js";import"../../../chunk-2XMHLXMA.js";import"../../../chunk-G3GWAP5R.js";import"../../../chunk-WRFD4EXD.js";import"../../../chunk-36LVP5WD.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-PLVEGYK6.js";
@@ -1 +1 @@
1
- export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-J4MHNAED.js";import"../../chunk-LNHT2KPX.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-CPFDJMFD.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-5ZBV5RA6.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BALFHI3G.js";import"../../chunk-X3TYRF5V.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-2XMHLXMA.js";import"../../chunk-G3GWAP5R.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-36LVP5WD.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-67GNT6PF.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";
1
+ export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-I2BCNLLV.js";import"../../chunk-LNHT2KPX.js";import"../../chunk-U3JP4VGF.js";import"../../chunk-UZXGXMNO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-ZFFWO2AF.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-XWFH2NHZ.js";import"../../chunk-67GNT6PF.js";import"../../chunk-YRLPFZW3.js";import"../../chunk-BALFHI3G.js";import"../../chunk-X3TYRF5V.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-X4T6JT3M.js";import"../../chunk-KRXQM65X.js";import"../../chunk-NKB3KVAB.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-2XMHLXMA.js";import"../../chunk-G3GWAP5R.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-36LVP5WD.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-PLVEGYK6.js";
@@ -850,3 +850,12 @@
850
850
  display: none;
851
851
  }
852
852
  }
853
+
854
+ /* ── The left panel's tabs (2026-10-23) ─────────────────────────────────────
855
+ The switcher at the top of the left panel: the shell's Tabs, drawn as the
856
+ settings panel's strip (`.es-insp-tabs`). It never shrinks and never
857
+ scrolls away with the view under it. */
858
+ .es-paneltabs {
859
+ flex: none;
860
+ background: var(--es-panel);
861
+ }
@@ -1,2 +1,2 @@
1
- import{DEFAULT_STYLE_CLIPBOARD_WORDS as r}from"../chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as o}from"../chunk-23DYNW6S.js";import{DEFAULT_TEXT_STYLES_WORDS as n}from"../chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as t}from"../chunk-OFBZOI6W.js";import{DEFAULT_CANVAS_WORDS as c}from"../chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as e}from"../chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as m}from"../chunk-WK3AFPXY.js";import{DEFAULT_PANEL_WORDS as i}from"../chunk-KFV7N2DJ.js";import{DEFAULT_SAVE_WORDS as s}from"../chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as u,DEFAULT_NOTICE_WORDS as f}from"../chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as p}from"../chunk-2OAZYSWJ.js";import{DEFAULT_LOCK_WORDS as l}from"../chunk-RE4LP46F.js";import{DEFAULT_COPY_WORDS as h}from"../chunk-KRL3IUV3.js";import{DEFAULT_FIELDS_WORDS as j}from"../chunk-WRFD4EXD.js";import{stringsContext as k}from"../chunk-MFIRYGHW.js";import{DEFAULT_DRAG_WORDS as a}from"../chunk-KAML3KQH.js";import{useContext as W,useMemo as D}from"react";import{jsx as Y}from"react/jsx-runtime";var y={notice:f,lock:l,save:s,chrome:u,rail:p,tree:e,panel:i,fields:j,pick:t,drag:a,menu:m,styleClipboard:r,copy:h,canvas:c,textStyles:n,screen:o},F=r=>"object"==typeof r&&null!==r;function K(r,o){const n={};for(const t of Object.keys(r)){const c=r[t],e=o[t];null==e?n[t]=c:F(c)?n[t]=F(e)?K(c,e):c:n[t]=typeof e==typeof c?e:c}return n}function d(r,o){return o?K(r,o):r}function v({value:r,locale:o,children:n}){const t=k(),c=W(t),e=c?.strings??y,m=o??c?.locale??"en",i=D(()=>({strings:d(e,r),locale:m}),[e,r,m]);/* @__PURE__ */
2
- return Y(t.Provider,{value:i,children:n})}function H(){return W(k())?.strings??y}function J(){return W(k())?.locale??"en"}export{y as DEFAULT_EASEL_STRINGS,v as EaselStringsProvider,d as mergeEaselStrings,J as useEaselLocale,H as useEaselStrings};
1
+ import{DEFAULT_SCREEN_WORDS as r}from"../chunk-23DYNW6S.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as o}from"../chunk-6WY6ZXJG.js";import{DEFAULT_TEXT_STYLES_WORDS as n}from"../chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as t}from"../chunk-OFBZOI6W.js";import{DEFAULT_DRAG_WORDS as c}from"../chunk-KAML3KQH.js";import{DEFAULT_CANVAS_WORDS as e}from"../chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as m}from"../chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as i}from"../chunk-WK3AFPXY.js";import{DEFAULT_PANEL_WORDS as s}from"../chunk-KFV7N2DJ.js";import{DEFAULT_SAVE_WORDS as u}from"../chunk-H6DDIBQ4.js";import{DEFAULT_COPY_WORDS as f}from"../chunk-KRL3IUV3.js";import{DEFAULT_FIELDS_WORDS as p}from"../chunk-WRFD4EXD.js";import{DEFAULT_CHROME_WORDS as l,DEFAULT_NOTICE_WORDS as h}from"../chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as j}from"../chunk-2OAZYSWJ.js";import{DEFAULT_LOCK_WORDS as k}from"../chunk-RE4LP46F.js";import{stringsContext as a}from"../chunk-MFIRYGHW.js";import{useContext as W,useMemo as D}from"react";import{jsx as Y}from"react/jsx-runtime";var y={notice:h,lock:k,save:u,chrome:l,rail:j,tree:m,panel:s,fields:p,pick:t,drag:c,menu:i,styleClipboard:o,copy:f,canvas:e,textStyles:n,screen:r},F=r=>"object"==typeof r&&null!==r;function K(r,o){const n={};for(const t of Object.keys(r)){const c=r[t],e=o[t];null==e?n[t]=c:F(c)?n[t]=F(e)?K(c,e):c:n[t]=typeof e==typeof c?e:c}return n}function d(r,o){return o?K(r,o):r}function v({value:r,locale:o,children:n}){const t=a(),c=W(t),e=c?.strings??y,m=o??c?.locale??"en",i=D(()=>({strings:d(e,r),locale:m}),[e,r,m]);/* @__PURE__ */
2
+ return Y(t.Provider,{value:i,children:n})}function H(){return W(a())?.strings??y}function J(){return W(a())?.locale??"en"}export{y as DEFAULT_EASEL_STRINGS,v as EaselStringsProvider,d as mergeEaselStrings,J as useEaselLocale,H as useEaselStrings};
@@ -1,36 +1,36 @@
1
- import{hexReadout as e,ColourWindow as s,typedHex as t}from"../chunk-U6LJ5UKD.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-OFBZOI6W.js";import{FieldSlider as n}from"../chunk-XWFH2NHZ.js";import{TEXT_STYLE_KINDS as l,canAddTextStyle as i,TEXT_STYLE_MAX as r,isDefaultTextStyle as o,CAMPAIGN_TEXT_STYLE_SETTINGS as d,TEXT_STYLE_SETTINGS as c,textStyleRowSize as u,describeTextStyle as m,updateTextStyle as h,textStyleCaseCss as f,TEXT_STYLE_CASES as p,addTextStyle as v,removeTextStyle as y,TEXT_STYLE_RANGES as S}from"../chunk-YHZSBL2N.js";export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,updateTextStyle,weightWord}from"../chunk-YHZSBL2N.js";import{FieldSelect as g}from"../chunk-G3GWAP5R.js";import"../chunk-WRFD4EXD.js";import{useWords as b}from"../chunk-MFIRYGHW.js";import{withTip as k}from"../chunk-P2VEMZH5.js";import{hsvToHex as N,Tooltip as C,ColorSwatch as x,IconButton as T}from"efficient-shell/ui";import{useState as w,useRef as z,useId as E,useEffect as O,Fragment as _}from"react";import{TrashIcon as L,ChevronIcon as A,BoldIcon as j,ItalicIcon as M,CaseLowerIcon as W,CaseCapitalizedIcon as $,CaseUpperIcon as D,CaseNormalIcon as X}from"efficient-shell/icons/efficient";import{jsxs as Y,jsx as I,Fragment as F}from"react/jsx-runtime";var G=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>N({h:e,s:1,v:1})).join(", ")})`;function H({value:t,hex:a,colours:n,label:l,followsWord:i,anyWord:r,onChange:o,readOnly:d=!1}){const[c,u]=w(!1),m=z(null),h=z(null),f=E(),p=void 0!==t&&n.some(e=>e.key===t),v=void 0!==t&&!p;return O(()=>{if(!c)return;const e=m.current?.ownerDocument;if(!e)return;const s=e=>{m.current&&!m.current.contains(e.target)&&u(!1)};return e.addEventListener("click",s,!0),()=>e.removeEventListener("click",s,!0)},[c]),/* @__PURE__ */Y("div",{ref:m,className:"es-ts-set","data-ts-setting":"color",children:[
1
+ import{hexReadout as e,ColourWindow as s,typedHex as t}from"../chunk-U6LJ5UKD.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import"../chunk-OFBZOI6W.js";import{FieldSlider as n}from"../chunk-XWFH2NHZ.js";import{withTip as l}from"../chunk-P2VEMZH5.js";import{FieldSelect as i}from"../chunk-G3GWAP5R.js";import"../chunk-WRFD4EXD.js";import{useWords as r}from"../chunk-MFIRYGHW.js";import{TEXT_STYLE_KINDS as o,canAddTextStyle as d,TEXT_STYLE_MAX as c,isDefaultTextStyle as u,CAMPAIGN_TEXT_STYLE_SETTINGS as m,TEXT_STYLE_SETTINGS as h,textStyleRowSize as f,describeTextStyle as p,updateTextStyle as v,textStyleCaseCss as y,TEXT_STYLE_CASES as S,addTextStyle as g,removeTextStyle as b,TEXT_STYLE_RANGES as k}from"../chunk-YHZSBL2N.js";export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,updateTextStyle,weightWord}from"../chunk-YHZSBL2N.js";import{hsvToHex as N,Tooltip as C,ColorSwatch as x,IconButton as T}from"efficient-shell/ui";import{useState as w,useRef as z,useId as E,useEffect as O,Fragment as _}from"react";import{TrashIcon as L,ChevronIcon as A,BoldIcon as j,ItalicIcon as M,CaseLowerIcon as W,CaseCapitalizedIcon as $,CaseUpperIcon as D,CaseNormalIcon as X}from"efficient-shell/icons/efficient";import{jsxs as Y,jsx as I,Fragment as F}from"react/jsx-runtime";var G=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>N({h:e,s:1,v:1})).join(", ")})`;function H({value:t,hex:a,colours:n,label:l,followsWord:i,anyWord:r,onChange:o,readOnly:d=!1}){const[c,u]=w(!1),m=z(null),h=z(null),f=E(),p=void 0!==t&&n.some(e=>e.key===t),v=void 0!==t&&!p;return O(()=>{if(!c)return;const e=m.current?.ownerDocument;if(!e)return;const s=e=>{m.current&&!m.current.contains(e.target)&&u(!1)};return e.addEventListener("click",s,!0),()=>e.removeEventListener("click",s,!0)},[c]),/* @__PURE__ */Y("div",{ref:m,className:"es-ts-set","data-ts-setting":"color",children:[
2
2
  /* @__PURE__ */Y("div",{className:"es-ts-top",children:[
3
3
  /* @__PURE__ */I("span",{className:"es-ts-sub",children:l}),
4
4
  /* @__PURE__ */I("span",{className:"es-ts-colour-read",children:a?e(a):i})]}),
5
5
  /* @__PURE__ */Y("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[n.map(s=>/* @__PURE__ */I(C,{content:`${s.name} · ${e(s.value)}`,children:/* @__PURE__ */I(x,{color:s.value,size:"sm",className:"es-ts-swatch","aria-label":s.name,selected:t===s.key,disabled:d,onClick:()=>o(s.key)})},s.key)),
6
- /* @__PURE__ */I(C,{content:r,children:/* @__PURE__ */I(x,{ref:h,color:G,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:v,"aria-expanded":c,"aria-controls":c?f:void 0,disabled:d,onClick:()=>u(e=>!e)})})]}),c?/* @__PURE__ */I(s,{id:f,value:a??"",onChange:e=>o(e),label:l,readOnly:d,onClose:()=>{u(!1),h.current?.focus()}}):null]})}function P({styles:e,onChange:s,fonts:t,colours:n=[],settings:c=d,auto:u=[],fallback:m,sample:h,openId:f,defaultOpenId:p=null,onOpenChange:S,onAdd:g,rowActions:N,onRemove:C,max:x=r,device:T="desktop",readOnly:_=!1}){const A=b("textStyles",a),j=E(),[M,W]=w(p),$=void 0!==f?f:M,D=e=>{void 0===f&&W(e),S?.(e)},X=z(null),[G,H]=w(null);O(()=>{if(!G||!X.current)return;const e=[...X.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===G.id),s=e?e.querySelector(".es-ts-row"):X.current.querySelector(`.es-ts-add[data-ts-kind="${G.kind}"]`);s?.focus(),H(null)},[G]);/* @__PURE__ */
7
- return I("div",{className:"es-ts",ref:X,children:l.map(a=>{const l=e.filter(e=>e.kind===a),r=!i(e,a,x),d=!_&&!r;/* @__PURE__ */
8
- return Y(R,{label:A.groups[a],children:[l.map(a=>{const l=N?.(a),i=null!=l&&!1!==l,r=Boolean(C)&&!_&&!o(a);/* @__PURE__ */
9
- return I(B,{style:a,fonts:t,colours:n,settings:c,auto:u,fallback:m,sample:h,device:T,readOnly:_,open:$===a.id,onOpenChange:e=>D(e?a.id:null),onChange:t=>s(e.map(e=>e.id===t.id?t:e)),actions:r||i?/* @__PURE__ */Y(F,{children:[r?k(A.remove,/* @__PURE__ */I("button",{type:"button",className:"es-ts-del","aria-label":A.removeNamed({name:a.name}),onClick:()=>(t=>{if(_||!C)return;const a=y(e,t.id,{name:A.styleName});if(!a)return;const n=e.filter(e=>e.kind===t.kind),l=n[n.indexOf(t)+1];$===t.id&&D(null),s(a.styles),C(a.removed),H({id:l?.id??null,kind:t.kind})})(a),children:/* @__PURE__ */I(L,{size:14,"aria-hidden":"true"})})):null,i?l:null]}):null},a.id)}),k(!_&&r?A.full({kind:a,max:x}):void 0,/* @__PURE__ */Y("button",{type:"button",className:"es-ts-add","data-ts-kind":a,disabled:_,"aria-disabled":!(_||!r)||void 0,"aria-describedby":!_&&r?`${j}-full-${a}`:void 0,onClick:()=>{d&&(t=>{if(_)return;const a=v(e,t,{max:x,name:A.styleName,make:g});a&&s(a.styles)})(a)},children:[
6
+ /* @__PURE__ */I(C,{content:r,children:/* @__PURE__ */I(x,{ref:h,color:G,size:"sm",className:"es-ts-swatch es-ts-swatch--any","aria-label":r,selected:v,"aria-expanded":c,"aria-controls":c?f:void 0,disabled:d,onClick:()=>u(e=>!e)})})]}),c?/* @__PURE__ */I(s,{id:f,value:a??"",onChange:e=>o(e),label:l,readOnly:d,onClose:()=>{u(!1),h.current?.focus()}}):null]})}function P({styles:e,onChange:s,fonts:t,colours:n=[],settings:i=m,auto:h=[],fallback:f,sample:p,openId:v,defaultOpenId:y=null,onOpenChange:S,onAdd:k,rowActions:N,onRemove:C,max:x=c,device:T="desktop",readOnly:_=!1}){const A=r("textStyles",a),j=E(),[M,W]=w(y),$=void 0!==v?v:M,D=e=>{void 0===v&&W(e),S?.(e)},X=z(null),[G,H]=w(null);O(()=>{if(!G||!X.current)return;const e=[...X.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===G.id),s=e?e.querySelector(".es-ts-row"):X.current.querySelector(`.es-ts-add[data-ts-kind="${G.kind}"]`);s?.focus(),H(null)},[G]);/* @__PURE__ */
7
+ return I("div",{className:"es-ts",ref:X,children:o.map(a=>{const r=e.filter(e=>e.kind===a),o=!d(e,a,x),c=!_&&!o;/* @__PURE__ */
8
+ return Y(R,{label:A.groups[a],children:[r.map(a=>{const r=N?.(a),o=null!=r&&!1!==r,d=Boolean(C)&&!_&&!u(a);/* @__PURE__ */
9
+ return I(B,{style:a,fonts:t,colours:n,settings:i,auto:h,fallback:f,sample:p,device:T,readOnly:_,open:$===a.id,onOpenChange:e=>D(e?a.id:null),onChange:t=>s(e.map(e=>e.id===t.id?t:e)),actions:d||o?/* @__PURE__ */Y(F,{children:[d?l(A.remove,/* @__PURE__ */I("button",{type:"button",className:"es-ts-del","aria-label":A.removeNamed({name:a.name}),onClick:()=>(t=>{if(_||!C)return;const a=b(e,t.id,{name:A.styleName});if(!a)return;const n=e.filter(e=>e.kind===t.kind),l=n[n.indexOf(t)+1];$===t.id&&D(null),s(a.styles),C(a.removed),H({id:l?.id??null,kind:t.kind})})(a),children:/* @__PURE__ */I(L,{size:14,"aria-hidden":"true"})})):null,o?r:null]}):null},a.id)}),l(!_&&o?A.full({kind:a,max:x}):void 0,/* @__PURE__ */Y("button",{type:"button",className:"es-ts-add","data-ts-kind":a,disabled:_,"aria-disabled":!(_||!o)||void 0,"aria-describedby":!_&&o?`${j}-full-${a}`:void 0,onClick:()=>{c&&(t=>{if(_)return;const a=g(e,t,{max:x,name:A.styleName,make:k});a&&s(a.styles)})(a)},children:[
10
10
  /* @__PURE__ */I("span",{className:"es-ts-add-word",children:A.add[a]}),
11
- /* @__PURE__ */I("span",{className:"es-ts-count",children:A.count({n:l.length,max:x})})]})),_||!r?null:/* @__PURE__ */I("span",{id:`${j}-full-${a}`,className:"es-vh",children:A.full({kind:a,max:x})})]},a)})})}function R({label:e,children:s}){const t=E();/* @__PURE__ */
11
+ /* @__PURE__ */I("span",{className:"es-ts-count",children:A.count({n:r.length,max:x})})]})),_||!o?null:/* @__PURE__ */I("span",{id:`${j}-full-${a}`,className:"es-vh",children:A.full({kind:a,max:x})})]},a)})})}function R({label:e,children:s}){const t=E();/* @__PURE__ */
12
12
  return Y("section",{className:"es-ts-section","aria-labelledby":t,children:[
13
- /* @__PURE__ */I("div",{className:"es-ts-group",id:t,children:e}),s]})}function B({style:e,fonts:s,colours:t=[],settings:n=d,auto:l=[],fallback:i,sample:r,open:o,onOpenChange:f,onChange:p,actions:v,device:y="desktop",readOnly:S=!1}){const g=b("textStyles",a),k=`${E()}-open-${e.id}`,N=new Set(l),C=c.filter(e=>n.includes(e)),x={...i?.(e)??{},...e.values},T="phone"===y,w=T&&void 0!==e.values.sizePhone?{...x,size:e.values.sizePhone}:x,z=s.find(e=>e.value===x.font),O={fontFamily:z?.family,fontSize:`${u(w.size??16)}px`,fontWeight:x.weight,fontStyle:x.italic?"italic":void 0};/* @__PURE__ */
13
+ /* @__PURE__ */I("div",{className:"es-ts-group",id:t,children:e}),s]})}function B({style:e,fonts:s,colours:t=[],settings:n=m,auto:l=[],fallback:i,sample:o,open:d,onOpenChange:c,onChange:u,actions:y,device:S="desktop",readOnly:g=!1}){const b=r("textStyles",a),k=`${E()}-open-${e.id}`,N=new Set(l),C=h.filter(e=>n.includes(e)),x={...i?.(e)??{},...e.values},T="phone"===S,w=T&&void 0!==e.values.sizePhone?{...x,size:e.values.sizePhone}:x,z=s.find(e=>e.value===x.font),O={fontFamily:z?.family,fontSize:`${f(w.size??16)}px`,fontWeight:x.weight,fontStyle:x.italic?"italic":void 0};/* @__PURE__ */
14
14
  return Y(_,{children:[
15
15
  /* @__PURE__ */Y("div",{className:"es-ts-item","data-ts-id":e.id,children:[
16
- /* @__PURE__ */Y("button",{type:"button",className:"es-ts-row","aria-expanded":o,"aria-controls":o?k:void 0,onClick:()=>f(!o),children:[
16
+ /* @__PURE__ */Y("button",{type:"button",className:"es-ts-row","aria-expanded":d,"aria-controls":d?k:void 0,onClick:()=>c(!d),children:[
17
17
  /* @__PURE__ */I("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */I(A,{size:12})}),
18
18
  /* @__PURE__ */I("span",{className:"es-ts-name",style:O,children:e.name}),
19
- /* @__PURE__ */I("span",{className:"es-ts-meta",children:m(w,s,g,{autoSize:N.has("size")&&w===x&&void 0===e.values.size})})]}),v?/* @__PURE__ */I("div",{className:"es-ts-actions",children:v}):null]}),o?/* @__PURE__ */I("div",{className:"es-ts-open",id:k,children:/* @__PURE__ */I(Z,{style:e,values:x,fonts:s,colours:t,settings:C,autoSet:N,sample:r??g.sample,words:g,phone:T,readOnly:S,set:s=>p(h([e],e.id,s)[0])})}):null]})}var U={none:X,upper:D,capitalize:$,lower:W};function Z({style:e,values:s,fonts:a,colours:l,settings:i,autoSet:r,sample:o,words:d,phone:c,readOnly:u,set:m}){const h=e.values,p=a.find(e=>e.value===s.font),v=function(e,s){return e?s.find(s=>s.key===e)?.value??t(e)??void 0:void 0}(s.color,l),y=e=>"largestSize"===e||r.has(e),g=e=>y(e)?h[e]:s[e],b=g("size"),N=c&&void 0!==h.sizePhone?h.sizePhone:b,C=g("lineSpacing"),x=g("letterSpacing"),w=y("letterCase")?h.letterCase:s.letterCase,z={fontFamily:p?.family,fontSize:void 0===N?void 0:`${N}px`,fontWeight:s.weight,fontStyle:s.italic?"italic":void 0,lineHeight:void 0===C?void 0:String(C/100),letterSpacing:void 0===x?void 0:`${x}px`,color:v,textTransform:f(w)},E=e=>{const t=S[e],a=y(e);/* @__PURE__ */
20
- return I("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */I(n,{label:d.settings[e],value:h[e],onChange:s=>m({[e]:s}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:a?void 0:s[e],auto:a?d.auto:void 0,readOnly:u})},e)};/* @__PURE__ */
19
+ /* @__PURE__ */I("span",{className:"es-ts-meta",children:p(w,s,b,{autoSize:N.has("size")&&w===x&&void 0===e.values.size})})]}),y?/* @__PURE__ */I("div",{className:"es-ts-actions",children:y}):null]}),d?/* @__PURE__ */I("div",{className:"es-ts-open",id:k,children:/* @__PURE__ */I(Z,{style:e,values:x,fonts:s,colours:t,settings:C,autoSet:N,sample:o??b.sample,words:b,phone:T,readOnly:g,set:s=>u(v([e],e.id,s)[0])})}):null]})}var U={none:X,upper:D,capitalize:$,lower:W};function Z({style:e,values:s,fonts:a,colours:i,settings:r,autoSet:o,sample:d,words:c,phone:u,readOnly:m,set:h}){const f=e.values,p=a.find(e=>e.value===s.font),v=function(e,s){return e?s.find(s=>s.key===e)?.value??t(e)??void 0:void 0}(s.color,i),S=e=>"largestSize"===e||o.has(e),g=e=>S(e)?f[e]:s[e],b=g("size"),N=u&&void 0!==f.sizePhone?f.sizePhone:b,C=g("lineSpacing"),x=g("letterSpacing"),w=S("letterCase")?f.letterCase:s.letterCase,z={fontFamily:p?.family,fontSize:void 0===N?void 0:`${N}px`,fontWeight:s.weight,fontStyle:s.italic?"italic":void 0,lineHeight:void 0===C?void 0:String(C/100),letterSpacing:void 0===x?void 0:`${x}px`,color:v,textTransform:y(w)},E=e=>{const t=k[e],a=S(e);/* @__PURE__ */
20
+ return I("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */I(n,{label:c.settings[e],value:f[e],onChange:s=>h({[e]:s}),min:t.min,max:t.max,step:t.step,shiftStep:t.shiftStep,sliderMin:t.sliderMin,sliderMax:t.sliderMax,unit:t.unit||void 0,styleValue:a?void 0:s[e],auto:a?c.auto:void 0,readOnly:m})},e)};/* @__PURE__ */
21
21
  return Y(F,{children:[
22
- /* @__PURE__ */I("div",{className:"es-ts-preview",style:z,"aria-label":d.preview,children:o}),i.map(t=>{switch(t){case"font":/* @__PURE__ */
23
- return I(q,{value:h.font,fonts:a,words:d,readOnly:u,set:m},t);case"color":/* @__PURE__ */
24
- return I(K,{value:h.color,hex:v,colours:l,words:d,readOnly:u,set:m},t);case"emphasis":{const e=(s.weight??400)>=600,a=!1!==p?.italic;/* @__PURE__ */
22
+ /* @__PURE__ */I("div",{className:"es-ts-preview",style:z,"aria-label":c.preview,children:d}),r.map(t=>{switch(t){case"font":/* @__PURE__ */
23
+ return I(q,{value:f.font,fonts:a,words:c,readOnly:m,set:h},t);case"color":/* @__PURE__ */
24
+ return I(K,{value:f.color,hex:v,colours:i,words:c,readOnly:m,set:h},t);case"emphasis":{const e=(s.weight??400)>=600,a=!1!==p?.italic;/* @__PURE__ */
25
25
  return Y("div",{className:"es-ts-set","data-ts-setting":t,children:[
26
- /* @__PURE__ */I("span",{className:"es-ts-sub",children:d.settings.emphasis}),
27
- /* @__PURE__ */Y("div",{className:"es-ts-icons",children:[k(d.bold,/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":d.bold,"aria-pressed":e,disabled:u,onClick:()=>m({weight:e?400:700}),children:/* @__PURE__ */I(j,{size:16})})),u||a?k(d.italic,/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":d.italic,"aria-pressed":Boolean(s.italic),disabled:u,onClick:()=>m({italic:!s.italic||void 0}),children:/* @__PURE__ */I(M,{size:16})})):/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":d.italic,"aria-pressed":Boolean(s.italic),"aria-disabled":!0,disabledReason:d.italicMissing,children:/* @__PURE__ */I(M,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
28
- return I(V,{value:h.letterCase??s.letterCase,auto:y("letterCase"),words:d,readOnly:u,set:m},t);case"largestSize":return"heading"===e.kind?E(t):null;case"size":return c?(()=>{const e=S.size;/* @__PURE__ */
29
- return I("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */I(n,{label:d.settings.size,value:h.sizePhone,onChange:e=>m({sizePhone:e}),min:e.min,max:e.max,step:e.step,shiftStep:e.shiftStep,sliderMin:e.sliderMin,sliderMax:e.sliderMax,unit:e.unit||void 0,styleValue:b,readOnly:u})},"size")})():E(t);default:return E(t)}})]})}function q({value:e,fonts:s,words:t,readOnly:a,set:n}){const l=E();/* @__PURE__ */
26
+ /* @__PURE__ */I("span",{className:"es-ts-sub",children:c.settings.emphasis}),
27
+ /* @__PURE__ */Y("div",{className:"es-ts-icons",children:[l(c.bold,/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":c.bold,"aria-pressed":e,disabled:m,onClick:()=>h({weight:e?400:700}),children:/* @__PURE__ */I(j,{size:16})})),m||a?l(c.italic,/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(s.italic),disabled:m,onClick:()=>h({italic:!s.italic||void 0}),children:/* @__PURE__ */I(M,{size:16})})):/* @__PURE__ */I(T,{className:"es-ts-icon","aria-label":c.italic,"aria-pressed":Boolean(s.italic),"aria-disabled":!0,disabledReason:c.italicMissing,children:/* @__PURE__ */I(M,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
28
+ return I(V,{value:f.letterCase??s.letterCase,auto:S("letterCase"),words:c,readOnly:m,set:h},t);case"largestSize":return"heading"===e.kind?E(t):null;case"size":return u?(()=>{const e=k.size;/* @__PURE__ */
29
+ return I("div",{className:"es-ts-slider","data-ts-setting":"size","data-ts-device":"phone",children:/* @__PURE__ */I(n,{label:c.settings.size,value:f.sizePhone,onChange:e=>h({sizePhone:e}),min:e.min,max:e.max,step:e.step,shiftStep:e.shiftStep,sliderMin:e.sliderMin,sliderMax:e.sliderMax,unit:e.unit||void 0,styleValue:b,readOnly:m})},"size")})():E(t);default:return E(t)}})]})}function q({value:e,fonts:s,words:t,readOnly:a,set:n}){const l=E();/* @__PURE__ */
30
30
  return Y("div",{className:"es-ts-set","data-ts-setting":"font",children:[
31
31
  /* @__PURE__ */I("span",{className:"es-ts-sub",id:l,children:t.settings.font}),
32
- /* @__PURE__ */I(g,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>n({font:e}),ariaLabelledBy:l,readOnly:a})]})}function K({value:e,hex:s,colours:t,words:a,readOnly:n,set:l}){/* @__PURE__ */
33
- return I(H,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:n,onChange:e=>l({color:e})})}function V({value:e,auto:s,words:t,readOnly:a,set:n}){const l=s?["auto",...p]:p,i=e??(s?"auto":"none"),r=z([]),o=e=>n({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
32
+ /* @__PURE__ */I(i,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>n({font:e}),ariaLabelledBy:l,readOnly:a})]})}function K({value:e,hex:s,colours:t,words:a,readOnly:n,set:l}){/* @__PURE__ */
33
+ return I(H,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:n,onChange:e=>l({color:e})})}function V({value:e,auto:s,words:t,readOnly:a,set:n}){const i=s?["auto",...S]:S,r=e??(s?"auto":"none"),o=z([]),d=e=>n({letterCase:"auto"===e?void 0:e});/* @__PURE__ */
34
34
  return Y("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
35
35
  /* @__PURE__ */I("span",{className:"es-ts-sub",children:t.settings.letterCase}),
36
- /* @__PURE__ */I("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const s="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!s||a)return;e.preventDefault();const t=(l.indexOf(i)+s+l.length)%l.length;o(l[t]),r.current[t]?.focus()},children:l.map((e,s)=>{const n=e===i;if("auto"===e)return k(t.case.autoTitle,/* @__PURE__ */I(T,{ref:e=>{r.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon es-ts-icon--word","aria-checked":n,"aria-label":t.case.auto,tabIndex:n?0:-1,disabled:a,onClick:()=>o(e),children:t.case.auto},e));const l=U[e];return k(t.case[e],/* @__PURE__ */I(T,{ref:e=>{r.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon","aria-checked":n,"aria-label":t.case[e],tabIndex:n?0:-1,disabled:a,onClick:()=>o(e),children:/* @__PURE__ */I(l,{size:16})},e))})})]})}export{H as ColourSwatchRow,B as TextStyleItem,R as TextStylesGroup,P as TextStylesList};
36
+ /* @__PURE__ */I("div",{className:"es-ts-icons",role:"radiogroup","aria-label":t.settings.letterCase,onKeyDown:e=>{const s="ArrowRight"===e.key||"ArrowDown"===e.key?1:"ArrowLeft"===e.key||"ArrowUp"===e.key?-1:0;if(!s||a)return;e.preventDefault();const t=(i.indexOf(r)+s+i.length)%i.length;d(i[t]),o.current[t]?.focus()},children:i.map((e,s)=>{const n=e===r;if("auto"===e)return l(t.case.autoTitle,/* @__PURE__ */I(T,{ref:e=>{o.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon es-ts-icon--word","aria-checked":n,"aria-label":t.case.auto,tabIndex:n?0:-1,disabled:a,onClick:()=>d(e),children:t.case.auto},e));const i=U[e];return l(t.case[e],/* @__PURE__ */I(T,{ref:e=>{o.current[s]=e},role:"radio",pressed:n,className:"es-ts-icon","aria-checked":n,"aria-label":t.case[e],tabIndex:n?0:-1,disabled:a,onClick:()=>d(e),children:/* @__PURE__ */I(i,{size:16})},e))})})]})}export{H as ColourSwatchRow,B as TextStyleItem,R as TextStylesGroup,P as TextStylesList};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "19.0.0",
3
+ "version": "19.2.0",
4
4
  "description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Efficient Pty Ltd",
@@ -1,8 +0,0 @@
1
- import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as o}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as l}from"./chunk-BVN33R76.js";import{sharedSectionsOf as r}from"./chunk-43AEUUNQ.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SINAM2IT.js";import{blockRuns as c}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-J4MHNAED.js";import{useEaselSession as m}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-23DYNW6S.js";import{useEasel as u}from"./chunk-CPFDJMFD.js";import{easelMenuEntries as y}from"./chunk-BALFHI3G.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-Z2V3TTAR.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-KAML3KQH.js";import{useState as b,useEffect as v,useMemo as j,useRef as w}from"react";import{SharedIcon as C,AddIcon as A}from"efficient-shell/icons/efficient";import{ContextMenu as T,toast as D,Dialog as M,Button as F}from"efficient-shell/ui";import{jsx as N,jsxs as $,Fragment as x}from"react/jsx-runtime";function E({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=w(null);/* @__PURE__ */
2
- return N(M,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */$(x,{children:[
3
- /* @__PURE__ */N(F,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
4
- /* @__PURE__ */N(F,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var I=e=>`section:${e}`,B=e=>`block:${e}`,H=e=>`template:${e}`,L=e=>`shared:${e}`;function O({at:w,placeBlocks:M,canTake:F,onPick:O,itemFor:S,session:P,siteWide:z,onClose:R,onHide:V,readOnly:W}){const Z=u(e=>e.config),J=a(),{labelAtLevel:K,categoryLabel:Q,firstSection:Y,Icon:G,Thumbnail:U}=J,{blockIsOffered:_,canAddTo:q}=d(),X=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>_(e,te);return l(te).list().then(n=>{if(e)return;const l=Z.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[Z,te]);const le=p().shared,re=h("screen",f).shared,[ie,se]=b([]),[ce,ae]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>_(e,te);return r(te).list().then(n=>{if(e)return;const l=Z.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[Z,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(Z,J),[Z]),ye=e=>K(e,"section",Z.components[e]?.label??e),he=e=>({type:I(e.type),label:e.name,cover:/* @__PURE__ */N(U,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:X.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ke=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=ne.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ie.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}return null},ge=e=>/* @__PURE__ */N("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */N(G,{type:e,size:26})}),be=j(()=>{const e=t(ue,Y),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!_(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=q(t.type)?.choices??[];e.forEach(l),e.forEach(e=>q(e.type,1)?.choices?.forEach(l))}M?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:B(e.type),label:e.label,cover:ge(e.type),title:X.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>o.has(e.type)?{...he(e),cover:ge(e.type)}:he(e),d=[];ie.length>0&&d.push({key:"shared",title:re.group,tiles:ie.map(e=>({type:L(e.id),label:e.title,cover:/* @__PURE__ */N(U,{type:e.node.type}),mark:/* @__PURE__ */N(C,{size:12}),title:re.onPages({count:e.used_on.length}),keywords:[ye(e.node.type),e.node.type]}))}),ne.length>0&&d.push({key:"templates",title:X.templates,tiles:ne.map(e=>({type:H(e.id),label:e.name,cover:/* @__PURE__ */N(U,{type:e.node.type}),keywords:[ye(e.node.type),e.node.type]}))});const p=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(Z.categories??{})){const o=ue.filter(e=>e.cat===t);if(0===o.length)continue;const l=e&&o.some(t=>t.type===e.type)?e:null,r=(l?[l,...o.filter(e=>e.type!==l.type)]:o).map(a);l&&!m&&(r.splice(1,0,...p.map(s)),m=!0),d.push({key:`category:${t}`,title:n(Z,t,Q),tiles:r})}const f=d.find(e=>e.key?.startsWith("category:"));if(!m&&f&&p.length>0&&(f.tiles=[...f.tiles,...p.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!F)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?F(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[ne,ie,re,ue,Z,X,F,M,te]);/* @__PURE__ */
5
- return $(x,{children:[
6
- /* @__PURE__ */N(i,{icon:/* @__PURE__ */N(A,{size:15}),title:X.title,context:X.contextAll,actions:/* @__PURE__ */N(s,{label:X.done,description:X.doneDescription,onClick:R}),onHide:V}),
7
- /* @__PURE__ */$("div",{className:"sf-addside sf-scroll",children:[
8
- /* @__PURE__ */N(k,{groups:be,session:P,itemFor:e=>S(ke(e)??{kind:"section",type:e}),onInsert:O?e=>{const t=ke(e);t&&O(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!W&&(pe({section:n.section,...t}),!0)},at:w,hint:X.hint,searchLabel:X.search,readOnly:W,words:ee}),z??null]}),de?/* @__PURE__ */N(T,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>pe(null),"aria-label":de.section.title,items:y([{label:re.deleteShared,danger:!0,onClick:()=>{fe(de.section),pe(null)}}])}):null,me?/* @__PURE__ */N(E,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void D.error(re.deleteFailed)}fe(null),le?.removed?.(e),se(t=>t.filter(t=>t.id!==e.id)),ae(e=>e+1)})(me),onCancel:()=>fe(null)}):null]})}export{O as AddSidePanel,B as blockKey,I as sectionKey,L as sharedKey,H as templateKey};
@@ -1,14 +0,0 @@
1
- import{DEFAULT_CANVAS_WORDS as e}from"./chunk-TBY3DFKS.js";import{useResolvedFields as t}from"./chunk-YRLPFZW3.js";import{toItemSelector as n,fromItemSelector as o,useNodeOps as r,parentStep as i,clickPickPart as l,clickPick as s}from"./chunk-X3TYRF5V.js";import{selectionBox as a,placeWindow as c,offsetOrigin as d,colorRunOf as u,ColorWindow as p,startCanvasTyping as f,textMap as h}from"./chunk-23VM4PMV.js";import{DEFAULT_COPY_WORDS as m}from"./chunk-KRL3IUV3.js";import{useWords as g}from"./chunk-MFIRYGHW.js";import{setCanvasNonce as v,CANVAS_TYPABLE_EVENT as y,isTypingTarget as w,frameRectToHost as b,CANVAS_TYPING_EVENT as k,drawnBox as S}from"./chunk-X4T6JT3M.js";import{find as C,ROOT_ID as I,getList as E,remove as D,parseZoneKey as x,move as M,duplicate as A,replaceNode as O,createNode as R,insert as z,normalizeData as V,createResolveCache as P,resolveNodeData as $,ROOT_SLOT as B}from"./chunk-KRXQM65X.js";import{topLevelSlotKeys as L,fieldsFrom as N,defaultsFrom as K}from"./chunk-NKB3KVAB.js";import{createContext as j,useEffect as Z,useContext as T,useRef as F,useSyncExternalStore as H,useState as W,useMemo as Y,useCallback as q,useLayoutEffect as X}from"react";import{jsx as U,jsxs as G,Fragment as J}from"react/jsx-runtime";import{createPortal as Q}from"react-dom";import{registerModalEscapeInterceptor as _,FloatingBar as ee,TextToolbar as te,LinkPicker as ne}from"efficient-shell/ui";function oe(e){return!["setData","setUi","set"].includes(e.type)}var re=(e,t,n,o)=>{const r=E(e,t,x(n));return r?.[o]??null},ie=(e,t,n,o,r)=>{const i=re(e,t,n,o);if(!i)throw new Error(`${r}: nothing at ${n}[${o}]`);return i};function le(e,t){const{selection:o}=e;return{...e.ui,itemSelector:n(e.data,t,o),selectedSlot:o&&"slot"===o.kind?{parentId:o.parentId,slot:o.slot}:null}}function se(e,t,n){return n?"node"===n.kind?C(e,t,n.id)?n:null:n.parentId===I?E(e,t,n)?n:null:C(e,t,n.parentId)&&E(e,t,n)?n:null:null}function ae(e,t,n,r=!1){const{itemSelector:i,selectedSlot:l,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=o(e.data,t,i??null)),"selectedSlot"in n&&(l?a=(c=l)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:r?s:{...e.ui,...s}}}function ce(e,t,n){const o=de(e,t,n);if(o===e)return e;const r=se(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function de(e,t,n){const{data:o}=e;switch(t.type){case"setData":{const n="function"==typeof t.data?t.data(o):t.data;return{...e,data:{...o,...n}}}case"setUi":return ae(e,n,"function"==typeof t.ui?t.ui(le(e,n)):t.ui);case"set":{const r={data:o,ui:le(e,n)},i="function"==typeof t.state?t.state(r):t.state;let l=i.data?{...e,data:i.data}:e;return i.ui&&(l=ae(l,n,i.ui,!0)),l}case"insert":{const r={...x(t.destinationZone),index:t.destinationIndex},i=R(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:z(o,n,r,i)}}case"replace":{const r=ie(o,n,t.destinationZone,t.destinationIndex,"replace");if(r.props.id!==t.data.props.id)throw new Error("Can't change the id during a replace action. Use remove and insert for a new node.");return{...e,data:O(o,n,r.props.id,t.data)}}case"replaceRoot":{const n={...o.root,props:{...o.root.props,...t.root.props},readOnly:t.root.readOnly};return{...e,data:{...o,root:n}}}case"duplicate":{const r=ie(o,n,t.sourceZone,t.sourceIndex,"duplicate"),i=A(o,n,r.props.id),l=re(i,n,t.sourceZone,t.sourceIndex+1);return{...e,data:i,selection:l?{kind:"node",id:l.props.id}:e.selection}}case"reorder":return de(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=re(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const i={...x(t.destinationZone),index:t.destinationIndex};return{...e,data:M(o,n,r.props.id,i)}}case"remove":{const r=ie(o,n,t.zone,t.index,"remove");return{...e,data:D(o,n,r.props.id)}}default:return e}}var ue={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},pe={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},fe=0,he=()=>`history-${fe+=1}`;function me(e){let t=e.config;const r=e.now??(()=>Date.now()),i=e.historyCoalesceMs??250;let l=e.permissions??{};const s=V(e.data,t);let a={data:s,selection:null,ui:{...pe}};if(e.ui){const{itemSelector:n,selectedSlot:r,...i}=e.ui;a={data:s,selection:r?{kind:"slot",...r}:o(s,t,n??null),ui:{...pe,...i}}}let c=[{core:a,at:-1/0,sealed:!0,id:he()}],d=0;const u=e=>{const t=c[d],n=r();!e&&d===c.length-1&&d>0&&!t.sealed&&n-t.at<i?c=[...c.slice(0,d),{...t,core:a,at:n}]:(c=[...c.slice(0,d+1),{core:a,at:n,sealed:e,id:he()}],d=c.length-1)},p=/* @__PURE__ */new Set;let f=null,h=null,m=0,g=null,v=!1;const y=()=>{for(const e of[...p])e()},w=()=>{c=[...c.slice(0,d),{...c[d],core:a},...c.slice(d+1)]},b=(t,n)=>{m>0?v=v||n:(n?u(!1):a!==t&&w(),a.data!==t.data&&e.onChange?.(a.data),a!==t&&y())},k=e=>{const n=a;if(a=ce(a,e,t),a===n)return;const o=e.recordHistory??oe(e);b(n,o&&a.data!==n.data)},S=t=>{0===m&&(g=a,v=!1),m+=1;try{t()}catch(e){throw m-=1,0===m&&g&&(a=g,g=null),e}if(m-=1,m>0||!g)return;const n=g;g=null,v&&a.data!==n.data?u(!0):a!==n&&w(),a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},I=e=>{const n=a,o=se(a.data,t,e);var r,i;(r=o,i=a.selection,r===i||r&&i&&r.kind===i.kind&&("node"===r.kind&&"node"===i.kind?r.id===i.id:"slot"===r.kind&&"slot"===i.kind&&r.parentId===i.parentId&&r.slot===i.slot))||(a={...a,selection:o},b(n,!1))},D=t=>{const n=a;d=t,a=c[d].core,a.data!==n.data&&e.onChange?.(a.data),a!==n&&y()},x=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...ue,...l,...n}};let M=x();const A=P(),R={resolveCache:A,async resolveAll({trigger:e="load",metadata:n}={}){const o=a.data,r={type:"root",props:{...o.root.props??{}}},i=[...o.content,...Object.values(o.zones??{}).flat()],[l,...s]=await Promise.all([$(r,t,{cache:A,trigger:e,metadata:n}),...i.map(o=>$(o,t,{cache:A,trigger:e,metadata:n}))]);S(()=>{const e=a;let n=a.data;s.forEach((e,r)=>{if(!e.didChange)return;const l=i[r].props.id,s=C(n,t,l)?.node;s&&s===C(o,t,l)?.node&&(n=O(n,t,l,e.node))}),l.didChange&&n.root===o.root&&(n={...n,root:{...n.root,props:l.node.props,readOnly:l.node.readOnly??n.root.readOnly}}),n!==a.data&&(a={...a,data:n,selection:se(n,t,a.selection)},b(e,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=C(a.data,t,e)?.node;if(!r)return!1;const i=await $(r,t,{cache:A,trigger:n,metadata:o});if(!i.didChange)return!1;let l=!1;return S(()=>{const n=a;if(C(a.data,t,e)?.node!==r)return;const o=O(a.data,t,e,i.node);o!==a.data&&(a={...a,data:o,selection:se(o,t,a.selection)},b(n,!1),l=!0)}),l},get config(){return t},getState(){if(f&&h===a)return f;const e=a,o={data:e.data,ui:le(e,t)},r="node"===e.selection?.kind?C(e.data,t,e.selection.id)?.node??null:null;return f={appState:o,selection:e.selection,selectedItem:r,config:t,dispatch:k,history:{back:()=>R.undo(),forward:()=>R.redo(),hasPast:d>0,hasFuture:d<c.length-1,histories:c.map(e=>({id:e.id,state:{data:e.core.data,ui:le(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<c.length&&e!==d&&D(e)}},getPermissions:M,getItemById:n=>C(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return E(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:o=>{const r=n(e.data,t,{kind:"node",id:o});return r?{index:r.index,zone:r.zone??"root:default-zone"}:void 0}},h=e,f},subscribe:e=>(p.add(e),()=>{p.delete(e)}),dispatch:k,batch:S,group:()=>{const e=d,t=c[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,c[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(c=[...c.slice(0,d),{...c[d],sealed:!0},...c.slice(d+1)]));const o=c[d];c=[...c.slice(0,e+1),{...o,sealed:!0},...c.slice(d+1)],d=e+1}}},select:e=>I(e?{kind:"node",id:e}:null),selectSlot:e=>I(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){S(()=>{const n=a,o=void 0===e.select?a.selection:e.select;a={...a,data:e.data,selection:se(e.data,t,o)},b(n,e.data!==n.data)})},load(e,n={}){const o=a,r=V(e,t);a={...a,data:r,selection:se(r,t,n.selection??a.selection)},n.keepHistory||(c=[{core:a,at:-1/0,sealed:!0,id:he()}],d=0),a!==o&&y()},undo(){d>0&&D(d-1)},redo(){d<c.length-1&&D(d+1)},setPermissions(e){(function(e,t){if(e===t)return!0;const n=Object.keys(e);return n.length===Object.keys(t).length&&n.every(n=>e[n]===t[n])})(e,l)||(l=e,M=x(),f=null,y())},setConfig(e){e!==t&&(t=e,M=x(),f=null,y())}};return R}function ge(e,t,n={}){const o=e=>{if(e.altKey)return;if(!(e.metaKey!==e.ctrlKey))return;const o="KeyZ"===e.code,r="KeyY"===e.code&&!e.shiftKey;(o||r)&&(n.leaveTyping&&w(e.target)||!1!==t.getState?.().getPermissions().edit&&(e.preventDefault(),r||e.shiftKey?t.redo():t.undo()))};return e.addEventListener("keydown",o),()=>e.removeEventListener("keydown",o)}var ve=j(null),ye=j(!0);function we({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return Z(()=>{n&&e.resolveAll()},[e,n]),Z(()=>{if(t&&"undefined"!=typeof document)return ge(document,e)},[e,t]),/* @__PURE__ */U(ve.Provider,{value:e,children:/* @__PURE__ */U(ye.Provider,{value:t,children:o})})}function be(){const e=T(ve);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function ke(e){const t=be(),n=F({view:null,selector:null,value:void 0,has:!1}),o=()=>{const o=t.getState(),r=n.current;if(r.has&&r.view===o&&r.selector===e)return r.value;const i=e(o);return r.has&&Object.is(r.value,i)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:i,has:!0},i)};return H(t.subscribe,o,o)}function Se(){return function(e){return ke(e)}}var Ce="data-puck-component",Ie="data-puck-dropzone",Ee={},De="data-es-mirror",xe="undefined"==typeof window?Z:X;function Me(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${De}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(De,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function Ae({children:t,id:n="preview-frame",title:o,className:r,style:i,mirrorStyles:l=!0,onDocument:s,height:a="auto",nonce:c}){const d=g("canvas",e),u=F(null),[p,f]=W(null);return xe(()=>{const e=u.current,t=p?.ownerDocument.defaultView;if("auto"!==a||!e||!p||!t)return;const n=()=>{e.style.height=`${Math.ceil(p.getBoundingClientRect().height)}px`};n();const o=t.ResizeObserver,r=o?new o(n):null;return r?.observe(p),()=>r?.disconnect()},[p,a]),xe(()=>{let e=u.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=u.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-puck-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),v(e,c),f(t),s?.(e);let n=null;const o=u.current?.ownerDocument;if(l&&o){Me(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>Me(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}return()=>{n?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */U("iframe",{ref:u,id:n,title:o??d.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:i,children:p?Q(t,p):null})}var Oe=j(null),Re=j(Ee),ze=[];function Ve({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:i=120}){const l=be(),s=ke(n=>E(n.appState.data,l.config,{parentId:e,slot:t})??ze),a=ke(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==I),c=ke(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),d=T(Oe),u=["es-zone"];return s.length&&u.push("has-children"),e===I&&u.push("is-root"),(a||c)&&u.push("is-area-selected"),null!==d&&d===e&&e!==I&&u.push("is-hovering-area"),n&&u.push(n),/* @__PURE__ */U("div",{className:u.join(" "),[Ie]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${i}px`},children:s.map(e=>/* @__PURE__ */U(Ze,{node:e},e.props.id))})}function Pe(e,t){return Y(()=>{const n={};for(const o of L(N(e)))n[o]=function(e={}){/* @__PURE__ */
2
- return U(Ve,{parentId:t,slot:o,...e})};return n},[e,t])}function $e(e){return Y(()=>function({zone:t,...n}){/* @__PURE__ */
3
- return U(Ve,{parentId:e,slot:t,...n})},[e])}var Be=["top","bottom","zIndex"];function Le(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function Ne(e){const t=function(e){const t=e?.ownerDocument.defaultView?.getComputedStyle(e);if(!t||"sticky"!==t.position)return null;const n=e=>"auto"===e?"":e;return{top:n(t.top),bottom:n(t.bottom),zIndex:n(t.zIndex)}}(function(e){const t=e.ownerDocument.defaultView;let n=null;for(const o of Array.from(e.children))if("none"!==t?.getComputedStyle(o).display){if(n)return null;n=o}return n}(e));Le(e,"position",t?"sticky":"relative");for(const n of Be)Le(e,n,t?.[n]??"");return!!t}var Ke="data-es-canvas-relative";function je(e){e.hasAttribute(Ke)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(Ke));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(Ke,"")),!1)}function Ze({node:e}){const t=be().config.components[e.type],n=e.props.id,o=F(null),r=function(e,t){return Y(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(Ce),o.removeAttribute("data-puck-dnd")),t.current=n,n&&(n.setAttribute(Ce,e),n.setAttribute("data-puck-dnd",e),je(n))},[e,t])}(n,o),i=F(null),l=!!t?.inline;!function(e,t){const n=F(!1),o=F(()=>{});o.current=()=>{const o=e(),i=n.current;n.current=!!o&&t(o),i!==n.current&&r.current()};const r=F(()=>{});xe(()=>o.current()),xe(()=>{const t=e(),i=t?.ownerDocument.defaultView;if(!t||!i)return;const l=()=>o.current();i.addEventListener("resize",l);const s=i.ResizeObserver,a=s?new s(l):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&i.MutationObserver&&(c=new i.MutationObserver(l),c.observe(e,{attributes:!0}))},r.current(),()=>{i.removeEventListener("resize",l),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>l?o.current:i.current,e=>l?je(e):Ne(e));const s=T(Re),a=Pe(t,n),c=$e(n);if(!t?.render)return null;const d=t.render,u={...K(t),...e.props,...a},p={renderDropZone:c,isEditing:!0,dragRef:t.inline?r:null,metadata:{...s,...t.metadata}};return t.inline?/* @__PURE__ */U(d,{...u,puck:p,editMode:!0}):
4
- /* @__PURE__ */U("div",{ref:i,[Ce]:n,"data-puck-dnd":n,style:{position:"relative"},children:/* @__PURE__ */U(d,{...u,puck:p,editMode:!0})})}function Te({metadata:e}){const t=ke(e=>e.config),n=ke(e=>e.appState.data.root).props??{},o=t.root?.render,r=Pe(t.root,I),i=$e(I),l=/* @__PURE__ */U(Ve,{parentId:I,slot:B}),s=o?/* @__PURE__ */U(o,{id:"puck-root",...n,...r,puck:{renderDropZone:i,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:l}):l;/* @__PURE__ */
5
- return U(Re.Provider,{value:e??Ee,children:s})}var Fe=j(void 0),He=j(void 0),We=j(void 0);function Ye({element:e}){const t=F(null),n=qe(t,e?()=>e:null,e);/* @__PURE__ */
6
- return U("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-hover is-hover-part",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function qe(e,t,n){const[o,r]=W(null),i=F(t);return i.current=t,xe(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!i.current)return void r(null);let o=0;const l=()=>{o=0;const n=function(e,t){if(!e||!t)return null;const n=S(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(i.current?i.current(t):null,e.current?.parentElement??null);r(e=>{return(t=e)===(o=n)||t&&o&&t.top===o.top&&t.left===o.left&&t.width===o.width&&t.height===o.height?e:n;var t,o})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(l))};l();const a="MutationObserver"in n?new n.MutationObserver(s):null;a?.observe(t.body,{childList:!0,subtree:!0,attributes:!0,characterData:!0});const c="ResizeObserver"in n?new n.ResizeObserver(s):null;return c?.observe(t.documentElement),n.addEventListener("resize",s),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}function Xe({id:e,kind:t,overlay:n}){const o=F(null),r=T(He),i=null!==e&&!0===r?.(e),l=qe(o,e?t=>t.querySelector(`[${Ce}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),s=/* @__PURE__ */U("div",{ref:o,"aria-hidden":"true",className:`es-canvas-outline is-${t}${i?" is-shared":""}`,style:l?{position:"absolute",top:l.top,left:l.left,width:l.width,height:l.height}:{display:"none"}});return n&&e?/* @__PURE__ */U(n,{componentId:e,kind:t,children:s}):s}function Ue(e,t,n){const o=h(e,n),r=o.text.length,i=e.ownerDocument;if(!t)return[r,r];let l=null;const s=i.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))l=o.at(s.offsetNode,s.offset);else{const n=i.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(l=o.at(n.startContainer,n.startOffset))}if(null===l)return[r,r];const a=o.text;let c=l,d=l;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;d<a.length&&!/\s/.test(a[d]);)d+=1;return[c,d]}function Ge({s:e,element:t,toolbar:n,label:o,keys:r}){const i=g("copy",m),l=e.pressed(),s=new Set(n.offered),f=n.colors&&n.colors.length>0?n.colors:null,h=F(null),[v,y]=W(!1),[w,k]=W(null),S=v||null!==w,C=()=>{e.hold(),y(!1),k({href:e.pressed().href})},I=()=>{y(!1),k(null),e.resume()};X(()=>{r.current={escape:()=>!!S&&(I(),!0),link:()=>!!s.has("link")&&(C(),!0)}}),X(()=>()=>{r.current=null},[r]);const E=F(I);E.current=I,Z(()=>{if(v)return _(e=>{const t=h.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(E.current(),!0)},()=>h.current?.querySelector(".es-copy-colors"))},[v]),Z(()=>{const n=h.current;if(!S||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const i=o=>{const r=o.target;if(r&&n.contains(r))return;y(!1),k(null);const i=t();r&&i&&i.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",i,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",i,!0)}},[S,e,t]),X(()=>{const e=h.current,n=e?.querySelector(".rosh-tb-wrap > .es-copy-pop"),o=t();if(!(S&&e&&n&&o))return;const r=o.ownerDocument.defaultView?.getSelection()??null,i=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,l=(i?a(i,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),s=o.ownerDocument.defaultView?.frameElement,u=s?b(s,{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top}):{left:l.left,top:l.top,width:l.right-l.left,height:l.bottom-l.top},p=o.getBoundingClientRect(),f=s?b(s,{left:p.left,top:p.top,width:p.width,height:p.height}):{left:p.left,top:p.top,width:p.width,height:p.height},m=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),g={left:u.left,right:u.left+u.width,top:Math.min(u.top,f.top-6,m.top),bottom:Math.max(u.top+u.height,f.top+f.height+6,m.bottom)},v=e.ownerDocument.documentElement,y=(s??o.closest(".es-canvas")??o).getBoundingClientRect(),w={left:Math.max(0,y.left),top:Math.max(0,y.top),right:Math.min(v.clientWidth||y.right,y.right),bottom:Math.min(v.clientHeight||y.bottom,y.bottom)};if(w.right<=w.left||w.bottom<=w.top||0===n.offsetWidth)return;const k=c({anchor:g,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:y.left,top:y.top,right:y.right,bottom:y.bottom},clip:w,parent:d(n)});n.style.top=`${k.top}px`,n.style.left=`${k.left}px`,n.style.setProperty("--es-pop-point",`${k.point}px`),n.dataset.side=k.above?"above":"below"});const D=f?{run:u(l.color,f),open:v,onToggle:()=>{k(null),v?I():(e.hold(),y(!0))}}:void 0;/* @__PURE__ */
7
- return U(ee,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?b(o,{left:n.left,top:n.top,width:n.width,height:n.height}):{left:n.left,top:n.top,width:n.width,height:n.height};return{left:r.left-6,top:r.top-6,right:r.left+r.width+6,bottom:r.top+r.height+6}},bounds:()=>{const e=t(),n=e?.ownerDocument.defaultView?.frameElement,o=(n??e?.closest(".es-canvas")??e)?.getBoundingClientRect();return o?{left:o.left,top:o.top,right:o.right,bottom:o.bottom}:{left:0,top:0,right:window.innerWidth,bottom:window.innerHeight}},"aria-label":o,children:/* @__PURE__ */U("div",{ref:h,children:/* @__PURE__ */U(te,{layout:"row",offered:s,pressed:l.marks,onMark:t=>{"link"===t?C():e.press(t)},color:D,linkOpen:null!==w,list:{pressed:l.list,onList:t=>e.list(t)},alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:!1,selected:l.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t)}),windows:/* @__PURE__ */G(J,{children:[v&&f?/* @__PURE__ */U(p,{colors:f,current:l.color,words:i.colors??m.colors,onPick:t=>e.color(t)}):null,w?
8
- /* @__PURE__ */U(ne,{className:"es-copy-link es-copy-pop",value:w.href??"",onApply:t=>{k(null),e.link(t)},onRemove:null!==w.href?()=>{k(null),e.link(null)}:void 0,onCancel:I}):null]})})})})}function Je({element:e}){const t=F(null),n=qe(t,()=>e(),e);/* @__PURE__ */
9
- return U("div",{ref:t,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:n?{position:"absolute",top:n.top,left:n.left,width:n.width,height:n.height}:{display:"none"}})}function Qe({frame:t=!0,className:n,style:o,metadata:r,mirrorStyles:a,onDocument:c,height:d,title:u,nonce:p,hotkeys:h,frameWrapper:m,overlay:v,children:w,typing:b,passThrough:S}){const C=be(),I=T(Fe),E=S??I,D=T(ye),x=g("canvas",e),M=h??D,[A,O]=W(void 0),R=ke(e=>"node"===e.selection?.kind?e.selection.id:null),[z,V]=W(null),[P,$]=W(null),B=T(We),[L,N]=W(null),K=F(null),[,j]=W(0),H=F(b);H.current=b;const Y=F(null),q=F(null),X=ke(e=>e.appState.data);Z(()=>{const e=q.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=R&&!L&&H.current?.atSelection?.()?R:null;e.dispatchEvent(new t(y,{detail:{id:n}}))},[R,L,X]);const J=e=>{const t=q.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(k,{detail:{typing:e}}))},Q=(e,t)=>{K.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=C.group(),r=e.element,i=f({element:r,value:e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:Ue(n,t,e.skip),write:e.write,remount:e.remount,onSelect:()=>j(e=>e+1),onEscape:()=>Y.current?.escape()??!1,onLinkKey:()=>Y.current?.link()??!1,end:e=>{o.close(),K.current?.element===r&&(K.current=null),N(null),J(!1),H.current?.onChange?.({typing:!1,why:e})}});if(!i)return o.close(),!1;const l=n.closest?.(`[${Ce}]`)?.getAttribute(Ce);return l&&C.select(l),K.current={s:i,element:r,target:e},N(()=>r),V(null),J(!0),H.current?.onChange?.({typing:!0,element:n}),!0};Z(()=>()=>K.current?.s.stop("stop"),[]);const _=e=>{const t=K.current?.element();return Boolean(t&&t.contains(e))},ee=e=>{const t=e.closest?.(`[${Ce}]`)?.getAttribute(Ce);if(!t)return;const n=C.getState(),o="node"===n.selection?.kind?n.selection.id:null,r=B?.partAt(e,t)??null;if(r){const e=l(n.appState.data,C.config,t,r.id,o,B?.selected()??null,E);if(e)return{node:e.node,part:e.part?r:null}}return{node:s(n.appState.data,C.config,t,o,E)??t,part:null}},te=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(K.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=H.current?.atSelection?.();n&&Q(n,null)&&e.preventDefault()},ne=/* @__PURE__ */G("div",{ref:q,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),K.current){if(_(t))return;K.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=ee(t);if(void 0!==o)return C.select(o.node),void(B&&(o.part?.id??null)!==B.selected()&&B.select(o.part?.id??null));t.hasAttribute?.(Ie)||(C.select(null),B?.selected()&&B.select(null))},onDoubleClick:e=>{const t=H.current;if(!t||_(e.target))return;const n=t.at(e.target);n&&Q(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>te(e),onMouseOver:e=>{if(K.current)return;const t=ee(e.target),n=t?.part&&t.part.id!==B?.selected()?t.part.element:null,o=t&&!t.part?t.node:null;o!==z&&V(o),n!==P&&$(n)},onMouseLeave:()=>{V(null),$(null)},children:[
10
- /* @__PURE__ */U(Oe.Provider,{value:z,children:/* @__PURE__ */U(Te,{metadata:r})}),
11
- /* @__PURE__ */G("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
12
- /* @__PURE__ */U(Xe,{id:!L&&z&&z!==R?z:null,kind:"hover",overlay:v}),B?/* @__PURE__ */U(Ye,{element:L?null:P}):null,
13
- /* @__PURE__ */U(Xe,{id:L?null:R,kind:"selected",overlay:v}),L?/* @__PURE__ */U(Je,{element:L}):null]}),w]}),oe=m?/* @__PURE__ */U(m,{document:A,children:ne}):ne;Z(()=>{if(A&&M)return ge(A,C)},[A,M,C]),Z(()=>{if(!A)return;const e=e=>{if("Enter"===e.key)return void te(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=C.getState();if("node"!==n.selection?.kind)return;if(B?.selected())return void B.select(null);const o=i(n.appState.data,C.config,n.selection);"node"===o?.kind&&C.select(o.id)};return A.addEventListener("keydown",e),()=>A.removeEventListener("keydown",e)},[A,C,B]);/* @__PURE__ */
14
- return G("div",{className:"es-canvas"+(n?` ${n}`:""),style:o,"data-puck-preview":"","data-es-typing":L?"":void 0,children:[L&&K.current?.target.toolbar?/* @__PURE__ */U(Ge,{s:K.current.s,element:K.current.element,toolbar:K.current.target.toolbar,label:x.textTools,keys:Y}):null,t?/* @__PURE__ */U(Ae,{mirrorStyles:a,onDocument:e=>{O(e??void 0),c?.(e)},height:d,title:u,nonce:p,children:oe}):/* @__PURE__ */U("div",{id:"preview-frame","data-puck-entry":"",children:oe})]})}function _e(e={}){const t=be(),n=ke(e=>e.appState.data);return r({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}function et(){const e=be(),n=ke(e=>e.config),o=e.resolveCache,r=ke(e=>e.selectedItem),i=ke(e=>e.appState.data.root),l=r?r.props.id:"root",s=i.props??{},a=Y(()=>r||{type:"root",props:s},[r,s]),c=r?n.components[r.type]:n.root,d=e.getState(),u=r?C(d.appState.data,n,l):null,p=u&&"root"!==u.place.parentId?u.place.parentId:null,f=p?d.getItemById(p)??null:null,{fields:h}=t({id:l,node:a,block:c,parent:f,appState:d.appState}),m=ke(e=>!1===e.getPermissions(r?{item:r}:{root:!0}).edit),g=q(t=>{(async()=>{const r=e.getState();if("root"!==l){const i=r.getItemById(l),s=r.getSelectorForId(l);if(!i||!s)return;const a={...i,props:{...i.props,...t}},{node:c}=await $(a,n,{cache:o,trigger:"replace"}),d=e.getState().getSelectorForId(l);if(!d)return;return void e.dispatch({type:"replace",destinationZone:d.zone??"root:default-zone",destinationIndex:d.index,data:c})}const i=r.appState.data.root.props??{},{node:s}=await $({type:"root",props:{...i,...t}},n,{cache:o,trigger:"replace"});e.dispatch({type:"replaceRoot",root:{props:s.props,readOnly:s.readOnly},recordHistory:!0})})()},[e,n,o,l]),v=q((e,t)=>g({[e]:t}),[g]);return{id:l,node:a,fields:h,values:a.props,readOnly:m,onChange:v,onChangeMany:g}}export{Ae as CanvasFrame,We as CanvasPartsContext,Fe as CanvasPassThroughContext,He as CanvasSharedContext,pe as DEFAULT_UI,Qe as EaselCanvas,we as EaselProvider,Te as EditDocument,ge as bindUndoKeys,me as createEasel,Se as createUseEasel,oe as recordsByDefault,ce as reduce,le as uiView,ke as useEasel,be as useEaselApi,_e as useEaselNodeOps,et as useSelectedFields,se as validSelection};
@@ -1,62 +0,0 @@
1
- import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-JBOSEHIX.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-6DNDTEF6.js";import{SlotChildActionsProvider as f}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-C56MPJBH.js";import{usePartBridge as y}from"./chunk-T5WDR5IE.js";import{useSectionOps as k}from"./chunk-LUBJKUVV.js";import{ScreenSaveIcon as v,ScreenMainButton as S}from"./chunk-PY7OOQEZ.js";import{useBrowserOffline as b}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-324PHMLC.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{SidePanelHead as N,PanelShowStrip as I}from"./chunk-SINAM2IT.js";import{offeredChoices as O}from"./chunk-M2Z775ZC.js";import{useScreenSaveSwitch as B,useScreenNodeKeys as P,useScreenPinned as M,useScreenDocumentLabel as $,useScreenCanvasFrame as T,useScreenInspectorPanel as j,useScreenDevices as A,useScreenPickFollowsSelection as L,useScreenLeftView as E,SELECTION_MODE as R,sameInspectorMode as D,useScreenBridges as F,useScreenBlockRules as V,useScreenBlockLook as H,useScreenStorageNamespace as W,useScreenNotify as J,useScreenCanvasHead as U,isSlotMode as G,useScreenStyleClipboard as Y,useScreenDocumentPass as K,useScreenCanvasDrag as X,ScreenCanvasTargetProvider as Z,isPinnedFirst as q,isPinnedLast as _,screenSlotsOf as Q}from"./chunk-J4MHNAED.js";import{MediaPopup as ee}from"./chunk-MS2U6MV5.js";import{useNodeClipboard as ne,useNodeContextMenu as te}from"./chunk-JC34NH4G.js";import{heldStyle as oe,styleShortcut as re}from"./chunk-V7U33NF2.js";import{PageEditGuardNotices as ie}from"./chunk-5DPIGWUL.js";import{useScreenDocument as le}from"./chunk-M62P4IQK.js";import{requestMediaPick as se}from"./chunk-RYNBSKE7.js";import{useMediaPanel as de,usePanelPick as ae,useMediaBrowsing as ce,useOpenMediaBrowse as pe,useMediaPlace as ue}from"./chunk-LNHT2KPX.js";import{useEaselSession as fe}from"./chunk-O7Q4DDJT.js";import{useEaselHost as he,useHostEscape as me}from"./chunk-U3JP4VGF.js";import{LayersIcon as ge,MediaIcon as ye}from"./chunk-4VJATVVR.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ke}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as ve}from"./chunk-23DYNW6S.js";import{rootRowName as Se,slotChildRowName as be,slotChildRenameProp as we,sectionRenameProp as xe}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as ze,blockNodeActions as Ce,TREE_MAX_DEPTH as Ne,childSlotsOf as Ie,slotFieldsOf as Oe,newNodeId as Be,slotChildrenIn as Pe,nestsInTree as Me}from"./chunk-PLVEGYK6.js";import{useEasel as $e,useEaselApi as Te,CanvasPassThroughContext as je,CanvasSharedContext as Ae}from"./chunk-CPFDJMFD.js";import{TreeRow as Le,Subtree as Ee,LayersTree as Re,TreeGroupLabel as De,TreeRowAction as Fe,TreeSeam as Ve}from"./chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as He}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as We}from"./chunk-WK3AFPXY.js";import{toItemSelector as Je,useNodeOps as Ue,clickPick as Ge}from"./chunk-X3TYRF5V.js";import{EaselTopBar as Ye,TopBarRail as Ke,TopBarCluster as Xe,EaselIconButton as Ze,TopBarDivider as qe,DeviceSwitch as _e,InspectorIconButton as Qe,PanelResizeHandle as en,MAX_PANEL_W as nn,MIN_PANEL_W_BY_SIDE as tn,panelWidthVars as on}from"./chunk-ZG6PVMC3.js";import{DEFAULT_NOTICE_WORDS as rn,DEFAULT_CHROME_WORDS as ln}from"./chunk-AJSDWWJW.js";import{holderOf as sn,nameOrSomeone as dn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as an}from"./chunk-RE4LP46F.js";import{useWords as cn}from"./chunk-MFIRYGHW.js";import{insertSeams as pn,CanvasDragLayer as un,CanvasInsert as fn}from"./chunk-Z2V3TTAR.js";import{DEFAULT_DRAG_WORDS as hn}from"./chunk-KAML3KQH.js";import{createDragSession as mn,useTreeDrag as gn,gapToMoveIndex as yn}from"./chunk-67GNT6PF.js";import{useCanvasFrame as kn,LIST_SELECTOR as vn,BLOCK_SELECTOR as Sn,useCanvasTyping as bn,useCanvasEvent as wn,nodeIdAt as xn,frameRectToHost as zn,BLOCK_ATTRIBUTE as Cn,drawnBox as Nn}from"./chunk-X4T6JT3M.js";import{ROOT_ID as In,ROOT_SLOT as On,zoneKey as Bn,parseZoneKey as Pn,find as Mn,DataError as $n}from"./chunk-KRXQM65X.js";import{useRef as Tn,useMemo as jn,useState as An,useEffect as Ln,useCallback as En,useLayoutEffect as Rn,Fragment as Dn,useId as Fn}from"react";import{ColoredBadge as Vn,toast as Hn,readMediaFileDrag as Wn,Tooltip as Jn,groupColors as Un,Dialog as Gn,FormField as Yn,Input as Kn,Button as Xn,MEDIA_FILE_DRAG_TYPE as Zn}from"efficient-shell/ui";import{UndoIcon as qn,RedoIcon as _n,RefreshIcon as Qn,AddIcon as et,TrashIcon as nt,EyeOffIcon as tt,EyeIcon as ot,SharedIcon as rt,DuplicateIcon as it}from"efficient-shell/icons/efficient";import{jsx as lt,jsxs as st,Fragment as dt}from"react/jsx-runtime";var at="media-file";function ct({name:e,onMake:n,onCancel:t}){const o=cn("screen",ve).shared,[r,i]=An(e),[l,s]=An(!1),d=Fn(),a=Tn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
2
- return lt(Gn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */st(dt,{children:[
3
- /* @__PURE__ */lt(Xn,{variant:"secondary",onClick:t,children:o.cancel}),
4
- /* @__PURE__ */lt(Xn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */lt("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */lt(Yn,{label:o.name,htmlFor:d,children:/* @__PURE__ */lt(Kn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var pt=/* @__PURE__ */new WeakSet;function ut(e,n,t){const o=Mn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function ft({canvas:e,tabs:n,onSelect:t}){const o=Tn(null),[r,i]=An({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Rn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=zn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=t.querySelector(`[${Cn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?Nn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=zn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */lt("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */lt("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
5
- /* @__PURE__ */lt(Jn,{content:e.reach,children:/* @__PURE__ */st(Vn,{colorClass:Un("success","solid"),size:"sm",children:[
6
- /* @__PURE__ */lt("span",{className:"es-band-tab-mark",children:/* @__PURE__ */lt(rt,{size:12})}),e.label]})}):/* @__PURE__ */lt(Vn,{colorClass:Un("info","solid"),size:"sm",children:e.label})},e.id):null})})}function ht({expand:e}){/* @__PURE__ */
7
- return lt("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */st(dt,e?{children:[
8
- /* @__PURE__ */lt("path",{d:"M8 9l4-4 4 4"}),
9
- /* @__PURE__ */lt("path",{d:"M8 15l4 4 4-4"})]}:{children:[
10
- /* @__PURE__ */lt("path",{d:"M8 4l4 4 4-4"}),
11
- /* @__PURE__ */lt("path",{d:"M8 20l4-4 4 4"}),
12
- /* @__PURE__ */lt("path",{d:"M5 12h14"})]})})}var mt=`${vn}, ${Sn}`;function gt(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 yt="__rungs";var kt="screen:band",vt={duplicate:!0,delete:!0};function St(){const vn=he(),{target:zn,docId:Cn,capabilities:Nn,currentSlug:Fn,siteId:Jn,onPublish:Un,saveState:Gn,saveConflict:Yn,retrySave:Kn,toggleAutoSave:Xn,flushSave:rt,access:St,saveUnreachable:bt=!1,readOnly:wt,readOnlyReason:xt=null}=le(),zt=B(),Ct=P(),{mediaEditing:Nt,hasEditGuard:It,hasPinnedChrome:Ot}=Nn,{appState:Bt,dispatch:Pt,history:Mt,selectedItem:$t,getSelectorForId:Tt,config:jt}=$e(e=>e),At=M(),{first:Lt,firstGroup:Et,lastGroup:Rt,isSectionGroup:Dt,sectionGroupZone:Ft,panelOf:Vt}=At,Ht=Vt(Lt),Wt=e=>q(At,e),Jt=e=>_(At,e),Ut="node"===At.firstRow,Gt=At.band??null,Yt=cn("screen",ve),Kt=cn("tree",He),Xt=cn("drag",hn),Zt=cn("notice",rn),qt=cn("lock",an),_t=cn("menu",We),Qt=cn("styleClipboard",ke),eo=cn("chrome",ln),no=$()??`/${Fn}`,to=T(),oo=j(),ro=k({readOnly:wt}),io=k({readOnly:wt,foldIntoHistory:!0}),lo=Tn(null),so=Te(),ao=jn(()=>({...ro,select:e=>{lo.current=e,ro.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=so.config;lo.current=Je(e,t,n)}ro.commitDocument(e,n)}}),[ro,so]),co=Bt.ui,po=co.leftSideBarVisible,uo=co.rightSideBarVisible,{options:fo,widths:ho,initial:mo,fluid:go,fit:yo}=A(),[ko,vo]=An(mo),So=de(),bo=Nt&&null!==So,wo=ae(),xo=ce(),zo=null!==wo||xo,Co=pe();L($t?.props.id);const{read:No,write:Io,forSelection:Oo}=E(),[Bo,Po]=An(No);Ln(()=>{Io(Bo)},[Bo]);const[Mo,$o]=An(0),To=Tn(null),jo=Tn(null),Ao=kn(jo,{readySelector:mt}),Lo=bn(Ao),Eo=a(jo);c(jo,Ao);const Ro=b(),Do=sn(St),Fo={state:Gn,offline:Ro||Gn.failed&&bt,readOnlyReason:xt,editing:Do?Zt.editing({name:dn(Do.name,qt),noun:Yt.noun}):null,conflict:null!=Yn,notSaving:Yt.bar.notSaving},Vo=()=>{wt||(Gn.failed?Kn():rt())};p(jo,Ao,Vo);const[Ho,Wo]=An(!1),Jo=Tn(!1),[Uo,Go]=An(null),[Yo,Ko]=An([]),[Xo,Zo]=An(R),qo="puck"===Xo.kind,_o=o(Xo,$t?.props.id),[Qo,er]=An(null);Ln(()=>{Qo&&(r(),er(null))},[Qo]);const nr=Tn(Tt);nr.current=Tt;const tr=En((e,{scroll:n})=>{Po(n=>Oo(e,n)),n&&er(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=nr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Mr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),or=Tn(null);Ln(()=>{const e=or.current;or.current=null;const n=null==$t?.props.id?null:String($t.props.id);Zo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Vt($t?.type)??R);const t=$t?.props.id,o=lo.current;if(lo.current=null,!t)return;const r=Tt(t);tr(String(t),{scroll:!i(o,r??null,ze)})},[$t?.props.id,tr]);const rr=En(e=>{Zo(n=>D(n,e)?n:e),Pt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Pt]),ir=Tn(()=>{});ir.current=(e,n)=>{const t=e?Oi(e.zone??ze)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==$t?.props.id?null:String($t.props.id);Zo(e=>D(e,n)?e:n),o!==r&&(or.current={id:o,mode:n},ao.select(e))};const lr=En((e,n)=>ir.current(e,n),[]),sr={kind:Xo.kind,mode:Xo,open:rr,show:e=>Zo(e),reveal:()=>{uo||Pt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:lr},dr=F(sr,{data:Bt.data,selected:$t??null,zoneOf:e=>Tt(e)?.zone,readOnly:Boolean(wt),select:e=>{Zo(R),ao.select({index:e})},replace:(e,n)=>ao.replaceComponent(ze,e,n),scrollTo:e=>l(e)},{device:ko,refreshes:Mo},{setView:Po,reveal:()=>{po||Pt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),ar=dr.resolveLeftView?dr.resolveLeftView(Bo):"sections",cr=V(),{isLockedBlock:pr,duplicateBlocked:ur,nestDepth:fr,newSectionNode:hr,canAddTo:mr,blockIsOffered:gr}=cr,yr=H(),{labelAtLevel:kr,Icon:vr,useProducts:Sr}=yr,br=yr.rowName?(e,n,t)=>yr.rowName(e,n,t):void 0,wr=En(e=>{Pt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),tr(e,{scroll:!0})},[Pt,tr]),{selectNode:xr,openPartId:zr}=y({mode:Xo,setMode:Zo,onOpenPart:wr}),[Cr,Nr]=An(null);me(null!==Cr,()=>Nr(null));const Ir=h(W()),Or=Ir.collapsed,Br=Ir.panelWidths,[Pr,Mr]=An(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Or);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
- return new Set}});Ln(()=>{try{window.localStorage.setItem(Or,JSON.stringify([...Pr]))}catch{}},[Pr]);const[$r,Tr]=An(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(Br);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left,"left"),right:g(Number(n.right)||m.right,"right")}}catch{return{...m}}});Ln(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Br,JSON.stringify($r))}catch{}},300);return()=>clearTimeout(e)},[$r]);const jr=En((e,n)=>Tr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Ar=En(e=>jr("left",e),[jr]),Lr=En(e=>jr("right",e),[jr]),Er=e=>Pr.has(e),Rr=e=>Mr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Dr=Tn(!1),Fr=Tn(null);Ln(()=>{if(Dr.current&&!Ho){const e=Fr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??jo.current?.querySelector(`button[aria-label="${CSS.escape(Yt.add.title)}"]`))?.focus(),Fr.current=null}Dr.current=Ho},[Ho]),Ln(()=>{if(!Ho||!Eo)return;const e=e=>{"Escape"===e.key&&ll()};return Eo.addEventListener("keydown",e),()=>Eo.removeEventListener("keydown",e)},[Ho,Eo]),me(Ho,()=>ll()),Ln(()=>{!po&&Ho&&(Wo(!1),Go(null),Jo.current=!1)},[po]);const Vr=J(),Hr=(e,n="success",t)=>{if(Vr)return void(t?Vr(e,"error"===n?"error":"info",t):Vr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Hn.error(e,{...o,duration:t?.duration??3200}):Hn.success(e,{...o,duration:t?.duration??1900})},Wr=Tn(null),[Jr,Ur]=An(0),[Gr,Yr]=An(0),Kr=U(),Xr=Tn(null),Zr=e=>Math.max(0,e.clientHeight-(Xr.current?.offsetHeight??0));Ln(()=>{const e=Wr.current;if(!e)return;const n=()=>{Ur(e.clientWidth),Yr(Zr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Xr.current&&t.observe(Xr.current),()=>t.disconnect()},[]),Rn(()=>{Wr.current&&(Ur(Wr.current.clientWidth),Yr(Zr(Wr.current)))},[$r,po,uo]);const qr=ko===go?Jr>0?Jr:ho[go]:ho[ko],_r=Jr>0?Math.min(Jr/qr,"shrink"===yo?1:2):1,Qr=qr*_r,ei=Jr>0&&Qr>Jr+1,ni={width:Qr,height:Gr||"100%",flex:"none",position:"relative"},ti={width:qr,height:Gr?Gr/_r:"100%",maxHeight:"none",transform:1!==_r?`scale(${_r})`:void 0,transformOrigin:"top left"},oi=()=>Pt({type:"setUi",ui:{leftSideBarVisible:!po}}),ri=()=>Pt({type:"setUi",ui:{rightSideBarVisible:!uo}}),ii=e=>{Ho&&(Wo(!1),Go(null),Jo.current=!1,po&&Bo===e)||(po&&Bo===e?oi():(Po(e),po||Pt({type:"setUi",ui:{leftSideBarVisible:!0}})))},li=()=>{se(vn,{accept:"image/*",title:eo.mediaLibrary})},si=()=>{Zo(R),ao.select(null),d()},di=()=>{Zo(Ht??R),uo||Pt({type:"setUi",ui:{rightSideBarVisible:!0}})},ai=Bt.data.content??[],ci=()=>{const e=ai.findIndex(Wt),n=ai.findIndex(Jt);return{floor:e>=0?e+1:0,cap:n>=0?n:ai.length}},pi=jt,ui=cr.stripCopy,fi=n=>e(n,ui),hi=ne(),mi=Ue({data:Bt.data,config:pi,readOnly:Boolean(wt),clipboard:hi,strip:ui?e=>ui(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==In||e.slot!==On)return{min:0,max:n-1};const{floor:t,cap:o}=ci();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Zo(R);const t=void 0===n||"node"===n?.kind?n:null;ao.commitDocument(e,t)}}),gi=fe(),[yi,ki]=An(null),vi=e=>{const n=ai.find(n=>String(n.props.id)===e),t=At.shared;n&&t&&mi.swap(e,t.detach(n))},Si=e=>{const n=Mn(Bt.data,jt,e);if(!n)return!1;const t=Bn(n.place),o=n.node,r=t===ze?Ci(o):Di(o),i=t===ze?At.shared?.usedOn(o):null;return!!mi.remove(e)&&(Hr(i?Yt.shared.removed({count:Math.max(0,i.length-1)}):Yt.deleted({name:r}),"success",{duration:8e3,action:{label:Yt.bar.undo,onClick:()=>{mi.restore(n.node,n.place)}}}),!0)},bi={...mi,remove:Si},wi=e=>kr(e,"block",jt.components[e]?.label??e),xi=En(e=>jt.components[e]?.defaultProps??{},[jt]),zi=e=>kr(e,"section",wi(e)),Ci=e=>Se({type:e.type,props:e.props??{}},zi(e.type),br),{nodeAddresses:Ni,zoneItems:Ii}=jn(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=Ne)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Ie(jt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ai,ze,0),{nodeAddresses:e,zoneItems:n}},[ai,jt]),Oi=En(e=>Ii.get(e)??[],[Ii]),Bi=e=>{const n=Ni.get(e);return n?Oi(n.zone)[n.index]:void 0},Pi=e=>Q(cr,jt,e),Mi=e=>{if(!cr.slotsOf||e===ze)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Bi(e.slice(0,n));if(!t)return null;const o=Pi(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}},$i=(()=>{if(!G(Xo))return null;const e=`${Xo.nodeId}:${Xo.slot}`;return Mi(e)?.slot.panel===Xo.kind?e:null})(),Ti=Tn(null);Ln(()=>{const e=Ti.current;if(Ti.current=null,!$i||!G(Xo))return;const n=Xo.nodeId;tr(n,{scroll:e!==$i}),Mr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Xo]);const ji=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Ni.get(e);n&&(n.zone===ze?Qi(n.index):Nl(n.zone,n.index,e,Bi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&$i!==i&&(Ti.current=i),lr(null,r),uo||Pt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ai=(e,n,t)=>{const o=`${e}:${n}`;if(Mr(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;$i!==o&&(Ti.current=o);lr(null,{kind:t,nodeId:e,slot:n})},Li=(e,n,t)=>{if(wt||!cr.moveSlot)return;const o=Bi(e),r=o?Pi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:yt,index:n},s=yn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=cr.moveSlot(e,n,s);"string"==typeof d&&Ai(e,d,i.panel)},Ei=Sr(),Ri=jn(()=>{const e=/* @__PURE__ */new Map;for(const n of Ei??[])e.set(n.slug,n.name);return e},[Ei]),Di=e=>be(e,wi,yr.plainText,e=>Ri.get(e),yr.rowName),Fi=(e,n)=>{const t=jt.components[e.type]?.fields,o=n===ze||_l(n)?"section":"block",r=n===ze&&(Wt(e)||Jt(e)||Dt(e.type)),i="block"===o?we(t):r?null:xe(t);return yr.renamePropOf?yr.renamePropOf(e,o,i):i},Vi=(e,n,t,o)=>{if(!(!wt&&Cr?.zone===e&&Cr.index===n))return;const r=(t,o)=>{Nr(null),o&&((e,n,t)=>{const o=Oi(e)[n];if(!o)return;const r=Fi(o,e);r&&ao.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
- return lt("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Yt.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)},Hi=t(Y(),Qt),Wi=Hi.scope({target:zn,siteId:Jn,docId:Cn}),Ji=jt,Ui=(e,n)=>n===ze?zi(e):wi(e),Gi=(e,n,t)=>{const o=Hi.plan(Wi,t,Ui(t.type,e),Ji);o&&(o.changed&&ao.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Hr(o.message))},Yi=te({nodesIn:Oi,nodeAt:(e,n)=>Oi(e)[n]??null,labelOf:(e,n)=>n===ze?zi(e):wi(e),renamePropOf:Fi,beginRename:(e,n)=>Nr({zone:e,index:n}),history:{hasPast:Mt.hasPast,hasFuture:Mt.hasFuture,back:()=>Mt.back(),forward:()=>Mt.forward()},openPageSettings:()=>{ao.select(null),Zo(R)},pageSettingsLabel:Yt.pageSettings,words:{menu:_t,styleClipboard:Qt,screen:Yt.menu},readOnly:Boolean(wt),collapseAll:()=>Mr(new Set(Oi(ze).map(e=>String(e.props.id)))),onPasteRefused:e=>Hr(e?Yt.pasteRefused({name:e.label}):Yt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ns(e,n),menuRows:(e,n,t)=>{const o=dr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=At.shared;if(!t||n!==ze)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:Yt.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return wt||pr(e.type,e)?n:{...n,change:[{label:Yt.shared.detach,onClick:()=>vi(e.props.id)}],remove:[{label:Yt.shared.removeFromPage,danger:!0,onClick:()=>{Si(e.props.id)}}]}}return wt||Wt(e)||Jt(e)||Dt(e.type)?null:z(gi)?{change:[{label:Yt.shared.makeShared,onClick:()=>ki({id:e.props.id,name:Ci(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=>pr(e.type,e),duplicateBlocked:e=>ur(Bt.data,e),permits:e=>{const n=Ce(jt,e.type);return At.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:bi,isPinned:(e,n)=>n===ze&&(Wt(e)||Jt(e)),sectionBand:ci,locate:e=>Ni.get(e)??null,rowNameOf:(e,n)=>n===ze?Ci(e):Di(e),selectAt:(e,n,t,o)=>{e===ze?Qi(n):Nl(e,n,t,o??"")},slotRung:e=>{const n=Mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>ji(n.node,n.slot,!1)}:null},style:{held:()=>oe(Wi),canCopy:e=>Hi.rows(Ji,e).some(e=>!1!==e.counted),copy:(e,n)=>Hi.copy(Wi,e,Ui(e.type,n),Ji),paste:(e,n,t)=>Gi(e,n,t)},keys:Ct?{target:Eo,selected:()=>{const e=Bt.ui.itemSelector;return e?{zone:e.zone??ze,index:e.index}:null},held:()=>hi.get(),readOnly:Boolean(wt),onDone:({done:e,name:n})=>{"copied"===e&&Hr(Yt.copied({name:n}))}}:void 0},Ao),Ki=Tn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Ln(()=>{Ki.current={copy:(e,n)=>Hi.copy(Wi,e,Ui(e.type,n),Ji),paste:Gi,at:()=>{const e=Bt.ui.itemSelector;if(!e)return null;const n=e.zone??ze,t=Oi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(wt)}});const Xi=En(e=>{const n=re(e);if(!n)return;const t=Ki.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))},[]);Ln(()=>{if(!Eo)return;const e=e=>Xi(e);return Eo.addEventListener("keydown",e),()=>Eo.removeEventListener("keydown",e)},[Xi,Eo]),wn(Ao,"keydown",Xi);const Zi=ai.map(e=>e.props.id).join("|");Ln(()=>{const e=Ao?.document??null,n=Ao?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Ko(e=>e.length?[]:e);const n=ai.findIndex(Jt),t=n>=0?n:ai.length,o=n=>{const t=ai[n]?.props?.id;return null==t?null:e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(Sn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ai.length>0&&!Wt(ai[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=gt(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})}Ko(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Ao,Zi,ko,_r,po,uo,$t?.props.id]);const qi=Ao?.document??null,_i=Ao?.window??null;Ln(()=>{const e=To.current;if(!e||!qi||!_i)return;const n=[],t=()=>{const n=qi.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&_i.scrollTo({left:_i.scrollX,top:_i.scrollY+t,behavior:"instant"}),!0};return To.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[qi,_i]);const Qi=e=>{Zo(R),ao.select({index:e}),dr.sectionPressed?.(ai[e]);const n=ai[e]?.props?.id;n&&l(n)},el=e=>{const{floor:n,cap:t}=ci(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=$t&&Xo.kind!==Ht?.kind?ai.findIndex(e=>e.props.id===$t.props.id):-1;return o(r>=0?r+1:t)},nl=(e,n)=>{const{floor:t,cap:o}=ci(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(ao.reorderComponent(ze,e,i),ao.select({index:i}),{moved:!0,dest:i})},tl=(e,n,t,o)=>{Zo(R),ao.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Hr(Yt.sectionAdded({name:t}))},ol=(e,n)=>{const t=el(n),o=hr(e,{nodeDefaults:xi,newNodeId:Be,sectionLabel:zi,blockIsOffered:gr}),r=o?ao.insertNode(ze,t,o):ao.insertSection(e,t);return tl(t,r,zi(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of Ie(jt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=mr(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},rl=e=>il(ze,e),il=(e,n)=>{Fr.current=document.activeElement??null,Go(null===n?null:{zone:e,index:n}),Wo(!0),po||(Jo.current=!0,Pt({type:"setUi",ui:{leftSideBarVisible:!0}}))},ll=()=>{Wo(!1),Go(null),Jo.current&&Pt({type:"setUi",ui:{leftSideBarVisible:!1}}),Jo.current=!1},sl=(e,n)=>yr.rowName?n?Wt(e)?yr.rowName(e,"section",Yt.header):Jt(e)?yr.rowName(e,"section",Yt.footer):Dt(e.type)?yr.rowName(e,"section",wi(e.type)):Ci(e):Di(e):n?zi(e.type):wi(e.type),dl=e=>n=>{e()},al=(e,n,t)=>{if(wt)return null;const o=Oi(e)[n];return o&&!Ce(jt,o.type).delete||o&&pr(o.type,o)?null:/* @__PURE__ */lt(Fe,{kind:"delete",label:e===ze&&o&&At.shared?.usedOn(o)?Yt.shared.removeFromPage:Yt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Oi(e)[n]?.props?.id;null!=t&&Si(String(t))})(e,n),children:/* @__PURE__ */lt(nt,{size:15})})},cl=e=>yr.rowPreview?.(e)||void 0,pl=e=>yr.rowMarks?.(e)??void 0,ul=(e,n,t)=>yr.rowActions?.(e,n,t)??null,fl=(e,n,t,o)=>{if(wt)return null;if(pr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
- return lt(Fe,{kind:"eye",label:r?Yt.showNamed({name:o}):Yt.hideNamed({name:o}),onClick:()=>ml(e,n,t),children:/* @__PURE__ */lt(r?tt:ot,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},hl=e=>Vs(ze,e),ml=(e,n,t)=>{ao.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},gl=e=>Oe(jt,e),yl=e=>Ie(jt,e),kl=e=>cr.slotsOf?Pi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Pe(e,n.slot)})):[{slot:null,rung:null,kids:yl(e)}],vl=e=>cr.slotsOf?kl(e).flatMap(e=>e.kids):yl(e),Sl=e=>Boolean(cr.slotsOf)&&Pi(e).some(e=>e.rung),bl=(e,n,t)=>null===t?void 0===n?mr(e):mr(e,n):mr(e,n,t),wl=(e,n,t)=>{const o=Me(jt,e.type,n)&&(t||vl(e).length>0||Sl(e));return{collapsible:o,folded:o&&Er(String(e.props.id))}},xl=(e,n,t)=>kl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>wl(e,r,t(e.type)).collapsible?[String(e.props.id),...xl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),zl=e=>vl(e).length>0||Sl(e)||Boolean(mr(e.type)),Cl=e=>Boolean(mr(e)),Nl=(e,n,t,o)=>{if(Zo(R),mr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),ao.select({index:n,zone:e}),l(t)}else ao.select({index:n,zone:e}),l(t)},Il=(e,n,t,o,r)=>{const i=`${e}:${n}`;ao.insertComponent(i,t,o),mr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),ao.select({index:o,zone:i})}):ao.select({index:o,zone:i})},Ol=Tn(/* @__PURE__ */new Set);Ln(()=>{ai.forEach(e=>{const n=mr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Ol.current.has(t))return;Ol.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(xi)).forEach((e,t)=>io.seedChild(o,t,n.childType,e))})},[ai,io,xi]);const Bl=Tn(/* @__PURE__ */new Set);Ln(()=>{ai.forEach((e,t)=>{const o=e.props.id;if(Bl.current.has(o))return;const r=n(e,gl(e.type));Bl.current.add(o),r&&io.replaceComponent(ze,t,{...e,props:r})})},[ai,io]),K(io,jt);const Pl=ai.findIndex(Jt),Ml=Pl>=0?ai[Pl]:null,$l=Ut?ai.findIndex(Wt):-1,Tl=$l>=0?ai[$l]:null,jl=At.groupTab,Al=jn(()=>jl?e=>Dt(e.type):void 0,[jl]),Ll=Boolean(At.groupBadge),El=At.sharedReach,Rl=e=>El?.(e)??void 0,Dl=jn(()=>El?new Set(ai.filter(e=>Rl(e)).map(e=>String(e.props.id))):null,[ai,El]),Fl=jn(()=>Dl?e=>Dl.has(e):void 0,[Dl]),Vl=At.first?El?.({type:At.first,props:{id:""}})??void 0:void 0,Hl=At.groupBadge?/* @__PURE__ */lt("span",{className:"es-tree-group-badge",children:/* @__PURE__ */lt(Vn,{tone:"info",size:"xs",children:At.groupBadge})}):void 0,Wl=ai.find(e=>e.type===Et)??null,Jl=ai.find(e=>e.type===Rt)??null,Ul=Pl>=0?Pl:ai.length,Gl=[];ai.forEach(e=>{Jt(e)||(zl(e)&&Gl.push(String(e.props.id)),Gl.push(...xl(e,1,Cl)))}),Ml&&(Gl.push(String(Ml.props.id)),Gl.push(...xl(Ml,1,Cl)));const Yl=Gl.length>0&&Gl.every(e=>Pr.has(e)),Kl=e=>{const n=yr.blockRowName(e,wi);return yr.rowName?yr.rowName(e,"block",n):n},Xl=(e,n,t,o)=>{const r=Oi(e)[t];if(!r)return;const i={...Pn(e),index:t},l={...Pn(n),index:Math.min(Math.max(o,0),Oi(n).length)},s=yn(i,l);if(e!==n||s!==t)try{mi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof $n))throw e}},Zl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of yl(e))n.add(r),t(o)};for(const t of gl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ql=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ni.get(n);if(!e)return null;if(e.zone===ze)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},_l=e=>{const n=e.slice(0,e.indexOf(":")),t=ai.find(e=>Dt(e.type)&&String(e.props.id)===n);return t&&Ft(n)===e?t:null},Ql=(e,n)=>{const t=_l(e);return!t||(!At.groupAccepts||At.groupAccepts(t.type,n,Oi(e).length))},es=(e,n,t)=>{if(e.rung){const t=Bi(e.rung.nodeId),o=t?Pi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===yt&&n.index>=0&&n.index<=o}if(n.slot===yt)return!1;if(e.add)return rs(e.add,n);const o=Bn(n);if(Dt(e.type))return!1;const r=_l(o),i=_l(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!Ql(o,e.type))&&(n.index>=0&&n.index<=Oi(o).length));if(e.zone===ze||o===ze){if(e.zone!==o)return!1;const{floor:t,cap:r}=ci();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Oi(o).length)return!1;if(e.zone===o)return!0;const l=Ml&&!At.lastIsOpen?String(Ml.props.id):null;return(!l||ql(e.zone)!==l&&ql(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Oi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ni.get(i),s=l?Oi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Zl(r).has(n))return!1;const d=mr(s.type,fr(Bt?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Oi(n),r))})(e.zone,o,e.index,t)},ns=(e,n)=>{const t=Bn(e.from),o=e.node;return t===Bn(n)?Ql(t,o.type):es({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},ts=e=>{const n=e.slice(0,e.indexOf(":")),t=Ni.get(n),o=t?Oi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=mr(o.type,fr(Bt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=O(r.choices??(r.spec?[{type:r.spec.childType,label:wi(r.spec.childType)}]:[])),l=Mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:sl(o,t.zone===ze)}},os=(e,n)=>{if("section"!==e.kind)return e;const t=Bn(n);return t===ze||_l(t)?e:ts(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},rs=(e,n)=>{const t=os(e,n),o=Bn(n);if("shared"===t.kind){if(o!==ze||!At.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=ci();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(_l(o)){const e="section"===t.kind?t.type:t.template.node.type;return Ql(o,e)&&n.index>=0&&n.index<=Oi(o).length}if(o!==ze)return!1;const{floor:e,cap:r}=ci();return n.index>=e&&n.index<=r}if(o===ze)return!1;const r=ts(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Oi(o))},is=(e,n)=>{const t=os(e,n);if("block"!==t.kind&&_l(Bn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&Ql(n,o)){if("section"===e.kind)ao.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;ao.insertNode(n,t,fi(e.template.node))}Zo(R),ao.select({index:t,zone:n})}})(t,Bn(n),n.index);if("section"===t.kind)return void ol(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=el(t),r=ao.insertNode(ze,o,n);tl(o,r,e)})(t.template.name,fi(t.template.node),n.index);if("shared"===t.kind){const e=At.shared?.nodeOf(t.section);if(!e)return;const o=el(n.index);return void(mi.restore(e,{parentId:In,slot:On,index:o})&&tl(o,e.props.id,t.section.title))}const o=Bn(n),r=ts(o);r&&(r.target.spec?Il(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{ao.insertComponent(e,n,t),Zo(R),ao.select({index:t,zone:e})})(o,t.type,n.index))},ls=(e,n)=>{e.media?function(e){const n=Ls();if(!n||!Ts)return;Rs(n).then(n=>{n&&function(e,n){if(!Ts)return;const t=Ts.create(e,{nodeDefaults:xi,newNodeId:Be,sectionLabel:zi,blockIsOffered:gr}),o=Bn(n);if(o===ze){const e=el(n.index),o=ao.insertNode(ze,e,t);return void tl(e,o,zi(t.type))}ao.insertNode(o,n.index,t),Zo(R),ao.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Li(e.rung.nodeId,e.index,n.index):e.add?is(e.add,n):e.zone===ze?nl(e.index,n.index):Xl(e.zone,Bn(n),e.index,n.index)},[ss]=An(()=>mn()),ds=gn({keyOf:e=>e.id,readOnly:Boolean(wt),session:ss,canDrop:es,onDrop:ls,onStep:(e,n)=>{e.rung?Li(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ze?((e,n)=>{const t=zi(ai[e]?.type??""),o=nl(e,n<0?e-1:e+2);if(!o.moved)return void Hr(n<0?Yt.sectionFirst({name:t}):Yt.sectionLast({name:t}));const{floor:r,cap:i}=ci();Hr(Yt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Xl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),as=En(e=>{const{floor:n,cap:t}=ci(),o=[];for(const r of e.nodes){const e=Bn(r.place),i=Oi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Wt(i)||Jt(i)||pr(i.type,i))continue;if(Dt(i.type))continue;const l=Boolean(_l(e)),s=e===ze||l;e===ze&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?zi(i.type):Di(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=Bn(e.list);if(n===ze&&0===e.children.length)return[{...e,addLabel:Yt.addSection,addAlways:!0}];const t=ts(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(_l(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=Bn(e.list),t=n===ze||_l(n)?null:ts(n);return t?.choices.length?pn(e,t.target.spec?.addLabel??Yt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Bt.data]),cs=null==$t?.props.id?null:String($t.props.id),ps=En(e=>{const n=jt,t=e=>!e.item.rung&&null!==Mn(Bt.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(cs);return i||(r(Ge(Bt.data,n,o.item.id,cs,Al))??o)},[Bt.data,jt,cs,Al]),[us,fs]=An(null),hs=Boolean(jl||El);wn(Ao,"mouseover",e=>{if(!hs)return;const n=xn(e.target),t=n?ut(Bt.data,jt,n):null;t!==us&&fs(t)}),wn(Ao,"mouseout",e=>{hs&&!e.relatedTarget&&fs(null)});const ms=e=>Wt(e)||Jt(e)||Dt(e.type),gs=e=>{const n=Dt(e.type)?wi(e.type):Wt(e)?Yt.header:Jt(e)?Yt.footer:null;return null===n?Ci(e):yr.rowName?yr.rowName(e,"section",n):n},ys=[];if(hs){const e=cs?ut(Bt.data,jt,cs):null;for(const n of/* @__PURE__ */new Set([e,us])){const e=n?ai.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Wt(e)||e.type===Et,o=Rl(e);if(o){ys.push({id:String(e.props.id),label:gs(e),below:t,reach:o});continue}if(!jl||!ms(e))continue;const r=jl(e);r&&ys.push({id:String(e.props.id),label:r,below:t})}}const ks=fe(),vs=Tn(null);Ln(()=>{const e=At.changeNotice;if(!e)return;const n=JSON.stringify(ai.filter(ms)),t=vs.current;if(vs.current={doc:Cn,bands:n,index:Mt.index},!t||t.doc!==Cn||t.bands===n)return;Mt.hasPast&&Mt.index>=t.index&&!pt.has(ks)&&(pt.add(ks),Hr(e,"success",{action:{label:Yt.bar.undo,onClick:()=>Mt.back()},duration:8e3}))},[ai]);const Ss=e=>{Zo(R),ao.select(e.zone===ze?{index:e.index}:{index:e.index,zone:e.zone})},bs=X(),ws=()=>({data:Bt.data,device:ko,ops:ao,inspector:sr}),xs=bs?.model,zs=jn(()=>xs?e=>xs(e,as(e),ws()):as,[xs,as,ko]),Cs=bs?.measure,Ns=Cs?(e,n)=>Cs(e,n,ws()):void 0,Is=bs?.canDrop,Os=Is?(e,n)=>Is(e,n,es,ws()):es,Bs=bs?.drop,Ps=Bs?(e,n)=>Bs(e,n,ls,ws()):ls,Ms=bs?.pick,$s=Ms?e=>Ms(e,Ss,ws()):Ss,Ts=bs?.media??null,js=Tn(null),As=jn(()=>Ts?{id:at,zone:"",index:-1,type:Ts.adds.type,add:{kind:Ts.adds.kind,type:Ts.adds.type},media:!0}:null,[Ts]);Ln(()=>{if(!As||wt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(Zn))(e)&&(js.current=null,ss.start({key:at,item:As}))},n=e=>{ss.get()?.item.media&&(js.current=Wn(e.dataTransfer))},t=()=>{ss.get()?.item.media&&ss.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)}},[As,wt,ss]);const Ls=()=>{const e=js.current;return js.current=null,e},Es=ue(),Rs=async e=>{if(!Es)return e;const n=await Es(e);return n?{...e,id:n.id,url:n.url}:null};const Ds=(e,n)=>{if(!Ts)return;const t=Mn(so.getState().appState.data,pi,n);if(!t)return;const o=t.node;ao.replaceComponent(Bn(t.place),t.place.index,{...o,props:{...Ts.replace(o,e),id:o.props.id}})},Fs=e=>{const n=Bn(e),t=Mi(n);t&&ji(t.node,t.slot,!1),il(n,e.index)},Vs=(e,n)=>/* @__PURE__ */lt(Ve,{...wt?{}:ds.seam({place:{...Pn(e),index:n}})},`seam:${e}:${n}`),Hs={rowClick:dl,isCollapsed:Er,toggleCollapse:Rr},Ws=e=>{const n=String(e.props.id),t=ai.findIndex(e=>String(e.props.id)===n),o=Ft(n),r=Oi(o),i=Er(n),l=wi(e.type),s=yr.rowName?yr.rowName(e,"section",l):l,d=e=>Vs(o,e);/* @__PURE__ */
16
- return st(dt,{children:[
17
- /* @__PURE__ */lt(Le,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:e.type,size:13}),name:s,preview:cl(e),marks:pl(e),onSelect:()=>Qi(t),nameSlot:Vi(ze,t,n,s),selected:_o===n,badge:Rl(e)?void 0:Hl,shared:Rl(e),actions:ul(e,ze,t)??void 0,rowProps:{"data-node-id":n,onClick:dl(()=>Qi(t))},fold:{open:!i,label:"section",onToggle:()=>Rr(n)}}),!i&&/* @__PURE__ */st(Ee,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ci(n),l=zl(n),s=l&&Er(r),a=()=>Nl(o,t,r,e.type),{rowProps:c,...p}=ds.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Pn(o),index:t}},{"data-node-id":r,onClick:dl(a)});/* @__PURE__ */
18
- return st(Dn,{children:[d(t),
19
- /* @__PURE__ */lt(Le,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:n.type,size:13}),name:i,preview:cl(n),marks:pl(n),onSelect:a,nameSlot:Vi(o,t,r,i),selected:_o===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Rr(r)}:void 0,actions:/* @__PURE__ */st(dt,{children:[al(o,t,i),ul(n,o,t),fl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */lt(Ee,{children:Gs(n,2)})]},r)}),d(r.length)]})]})},Js=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=ds.dragging,d=!Er(l)&&s?.rung?.nodeId!==i,a={...Pn(l),index:0},c=s&&!s.rung&&es(s,a)?a:void 0,p=()=>ji(e,n,!0),{rowProps:u,...f}=ds.row({item:{id:`rung:${l}`,zone:`${i}:${yt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:yt,index:t},into:c,canDrag:Boolean(cr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:dl(p)}),h=wt?null:cr.slotActions?.(e,n.slot);/* @__PURE__ */
20
- return st(Dn,{children:[n.heading,
21
- /* @__PURE__ */lt(Le,{words:Kt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:$i===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Rr(l)},actions:h&&h.length>0?/* @__PURE__ */lt(dt,{children:h.map((t,o)=>/* @__PURE__ */lt(Fe,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(wt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ai(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__ */lt(nt,{size:15}):/* @__PURE__ */lt(it,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */lt(Ee,{children:r})]},l)},Us=(e,n)=>{const t=kl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
- return lt(dt,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=bl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Vs(e,n),p=/* @__PURE__ */st(dt,{children:[i.map(({child:n,zone:t,index:o})=>{const r=_o===String(n.props.id),{collapsible:i,folded:s}=wl(n,l,Cl(n.type)),d=String(n.props.id),a=Kl(n),p=()=>Nl(t,o,d,e.type),{rowProps:u,...f}=ds.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Pn(t),index:o}},{"data-node-id":d,onClick:dl(p)});/* @__PURE__ */
23
- return st(Dn,{children:[0===o&&c(t,0),
24
- /* @__PURE__ */lt(Le,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:n.type,size:13}),name:a,preview:cl(n),marks:pl(n),onSelect:p,nameSlot:Vi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Rr(d)}:void 0,actions:/* @__PURE__ */st(dt,{children:[al(t,o,a),ul(n,t,o),fl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */lt(Ee,{children:Us(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?Js(e,t.rung,r++,o,p):/* @__PURE__ */lt(Dn,{children:p},t.slot??"")})})},Gs=(e,n)=>{const t=fr(Bt?.data,e.type,String(e.props.id)),o=kl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
- return lt(dt,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=bl(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>Vs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),k=/* @__PURE__ */st(dt,{children:[l.map(({child:n,zone:t,index:o})=>{const r=_o===String(n.props.id),i=Di(n),l=String(n.props.id),{collapsible:d,folded:a}=wl(n,s,Cl(n.type)),c=gl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Pn(p),index:Oi(p).length}:void 0,f=ds.dragging,h=u&&f&&es(f,u)?u:void 0,g=()=>Nl(t,o,l,e.type),{rowProps:y,...k}=ds.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Pn(t),index:o},into:h,canDrag:!pr(n.type,n)},{"data-node-id":l,onClick:dl(g)});/* @__PURE__ */
26
- return st(Dn,{children:[0===o&&m(t,0),
27
- /* @__PURE__ */lt(Le,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:n.type,size:13}),name:i,preview:cl(n),marks:pl(n),onSelect:g,nameSlot:Vi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...k,fold:d?{open:!a,label:"group",onToggle:()=>Rr(l)}:void 0,actions:pr(n.type,n)?ul(n,t,o)??void 0:/* @__PURE__ */st(dt,{children:[al(t,o,i),ul(n,t,o),fl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */lt(Ee,{children:Gs(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
- /* @__PURE__ */lt(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Il(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?Js(e,o.rung,i++,r,k):/* @__PURE__ */lt(Dn,{children:k},o.slot??"")})})},Ys=Ho,Ks=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:po&&!Ys&&ar===e.id,onSelect:()=>ii(e.id)}:e,Xs=[...(dr.railLead??[]).map(Ks),{id:"sections",label:Yt.layers,icon:/* @__PURE__ */lt(ge,{}),active:po&&!Ys&&"sections"===ar,onSelect:()=>ii("sections")},...(dr.railTrail??[]).map(Ks)];bo?Xs.push({id:"media",label:Yt.railMedia,icon:/* @__PURE__ */lt(ye,{}),active:zo,onSelect:Co}):Nt&&Xs.push({id:"media",label:Yt.railMedia,icon:/* @__PURE__ */lt(ye,{}),onSelect:li});const Zs=[...dr.railLead??[],...dr.railTrail??[]].find(e=>"panel"in e&&e.id===ar),qs=Boolean(Gt?.foldable),_s=Gt?.label??(It?Yt.pageSections:Yt.templateSections),Qs=qs&&Er(kt),ed=/* @__PURE__ */st(dt,{children:[ai.map((e,n)=>{if(Wt(e)||Jt(e)||Dt(e.type))return null;const t=_o===String(e.props.id),o=Boolean(e.props._hidden);yl(e);const r=String(e.props.id),i=dr.hasOwnRows?.(e)??!1,l=zl(e)||i,s=l&&Er(r),d=gl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Pn(a),index:Oi(a).length}:void 0,p=ds.dragging,u=c&&p&&es(p,c)?c:void 0,{rowProps:f,...h}=ds.row({item:{id:r,zone:ze,index:n,type:e.type},place:{...Pn(ze),index:n},into:u,canDrag:!pr(e.type,e)},{"data-node-id":r,onClick:dl(()=>Qi(n))});/* @__PURE__ */
29
- return st(Dn,{children:[n>0&&hl(n),
30
- /* @__PURE__ */lt(Le,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:e.type,size:13}),name:Ci(e),preview:cl(e),marks:pl(e),shared:Rl(e),onSelect:()=>Qi(n),nameSlot:Vi(ze,n,r,Ci(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Rr(r)}:void 0,actions:/* @__PURE__ */st(dt,{children:[al(ze,n,Ci(e)),ul(e,ze,n),fl(ze,n,e,Ci(e))]}),rowProps:f}),zl(e)&&!s&&/* @__PURE__ */st(Ee,{children:[Gs(e,1),dr.partRows?.(e,Hs)]}),i&&!s&&/* @__PURE__ */lt(Ee,{children:dr.ownRows?.(e,n,Hs)})]},String(e.props.id??n))}),Ul>0&&hl(Ul)]}),nd=(e,n,t)=>{const o=String(e.props.id),r=vl(e).length>0||Sl(e)||Boolean(mr(e.type)),i=r&&Er(o),l="header"===t?Yt.header:Yt.footer,s=yr.rowName?yr.rowName(e,"section",l):l;/* @__PURE__ */
31
- return st(dt,{children:[
32
- /* @__PURE__ */lt(Le,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:t,size:13}),name:s,preview:cl(e),marks:pl(e),badge:Rl(e)?void 0:Hl,shared:Rl(e),onSelect:()=>Qi(n),nameSlot:Vi(ze,n,o,s),selected:_o===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Rr(o)}:void 0,actions:ul(e,ze,n)??void 0,rowProps:{"data-node-id":o,onClick:dl(()=>Qi(n))}}),r&&!i&&/* @__PURE__ */lt(Ee,{children:Us(e,1)})]})};return(dr.wrap??(e=>e))(
33
- /* @__PURE__ */lt(Z,{target:Ao,children:/* @__PURE__ */st("div",{ref:jo,className:"sf-editor es-editor",style:on($r),onContextMenu:Yi.onEditorContextMenu,...u(vn),children:[
34
- /* @__PURE__ */st(Ye,{children:[
35
- /* @__PURE__ */lt(Ke,{items:Xs,ariaLabel:Yt.bar.views}),
36
- /* @__PURE__ */st(Xe,{children:[
37
- /* @__PURE__ */lt(Ze,{label:Yt.bar.undo,disabled:Boolean(wt)||!Mt.hasPast,onClick:()=>Mt.back(),children:/* @__PURE__ */lt(qn,{})}),
38
- /* @__PURE__ */lt(Ze,{label:Yt.bar.redo,disabled:Boolean(wt)||!Mt.hasFuture,onClick:()=>Mt.forward(),children:/* @__PURE__ */lt(_n,{})}),
39
- /* @__PURE__ */lt(qe,{}),
40
- /* @__PURE__ */lt(_e,{devices:fo,value:ko,onChange:vo}),
41
- /* @__PURE__ */lt(Ze,{label:Yt.bar.refresh,tip:Yt.bar.refreshTip,onClick:()=>{To.current=(()=>{const e=Ao?.document;if(!e)return null;const n=ai.findIndex(Jt),t=n>=0?n:ai.length;let o=null;for(let n=0;n<t;n++){const t=ai[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=$t?.props?.id??ai[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),$o(e=>e+1)},children:/* @__PURE__ */lt(Qn,{})})]}),
42
- /* @__PURE__ */st(Xe,{kind:"right",style:{minWidth:300},children:[
43
- /* @__PURE__ */lt(v,{input:Fo,words:Yt.saveStatus}),dr.barLead?.(),dr.barTrail?.(),dr.mainAction||!dr.barMain?/* @__PURE__ */lt(S,{input:Fo,action:dr.mainAction??{label:Yt.done,onPress:()=>{Un(Bt.data)}},readOnly:Boolean(wt),saveSwitch:zt,onToggleAutoSave:Xn,onSaveNow:Vo,bar:Yt.bar,words:Yt.saveStatus}):dr.barMain()]})]}),
44
- /* @__PURE__ */lt(ie,{}),
45
- /* @__PURE__ */st("div",{className:"sf-body",children:[po?/* @__PURE__ */st(dt,{children:[
46
- /* @__PURE__ */lt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Yt.leftPanel,children:Ho?/* @__PURE__ */lt(x,{at:Uo?{label:(e=>{const n=_l(e.zone);if(n)return Yt.add.addingTo({name:yr.rowName?sl(n,!0):wi(n.type)});if(e.zone===ze){const n=ai[e.index];return n&&!Jt(n)?Yt.add.addingBefore({name:sl(n,!0)}):Yt.add.addingAtEnd}const t=ts(e.zone);return t?Yt.add.addingTo({name:t.parentName}):Yt.add.addingHere})(Uo),onClear:()=>Go(null)}:void 0,placeBlocks:Uo&&Uo.zone!==ze?ts(Uo.zone)?.choices:void 0,canTake:Uo?e=>{if(!Uo)return null;const n={...Pn(Uo.zone),index:Uo.index};if(rs(e,n))return null;if("shared"===e.kind&&Uo.zone===ze&&!At.shared?.nodeOf(e.section))return Yt.shared.alreadyHere;const t=_l(Uo.zone);if(t)return Yt.add.notInside({name:sl(t,!0)});if(Uo.zone===ze)return Yt.add.onlySections;const o=ts(Uo.zone);return o?Yt.add.notInside({name:o.parentName}):Yt.add.onlySections}:void 0,onPick:Uo?e=>{if(!Uo)return;const n={...Pn(Uo.zone),index:Uo.index};rs(e,n)&&(is(e,n),ll())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:ss,siteWide:dr.addPanelRow?.(ll),onClose:ll,onHide:oi,readOnly:Boolean(wt)}):Zs?Zs.panel({onHide:oi,notify:Hr}):/* @__PURE__ */st(dt,{children:[
47
- /* @__PURE__ */lt(N,{icon:/* @__PURE__ */lt(ge,{}),title:Yt.layers,context:no,actions:/* @__PURE__ */st(dt,{children:[!wt&&/* @__PURE__ */lt(Qe,{label:Yt.add.title,onClick:()=>rl(null),children:/* @__PURE__ */lt(et,{size:15})}),
48
- /* @__PURE__ */lt(Qe,{label:Yl?Yt.expandAll:Yt.collapseAll,title:0===Gl.length?Yt.nothingToFold:void 0,disabled:0===Gl.length,onClick:()=>Mr(e=>{const n=new Set(Gl);return Yl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Gl])}),children:/* @__PURE__ */lt(ht,{expand:Yl})})]}),onHide:oi}),
49
- /* @__PURE__ */st(Re,{className:"sf-tree sf-scroll",words:Kt,children:[
50
- /* @__PURE__ */lt(Le,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:"page",size:13}),name:Yt.pageSettings,onSelect:si,selected:!$t&&qo,rowProps:{onClick:dl(si)}}),Wl&&/* @__PURE__ */st(dt,{children:[!Ll&&/* @__PURE__ */lt(De,{children:Yt.header}),Ws(Wl)]}),Ot&&!(Ll&&Wl)&&/* @__PURE__ */st(dt,{children:[!Ll&&/* @__PURE__ */lt(De,{children:Yt.header}),!Ut&&/* @__PURE__ */lt(Le,{words:Kt,icon:/* @__PURE__ */lt(vr,{type:"header",size:13}),name:Yt.header,badge:Vl?void 0:Hl,shared:Vl,onSelect:di,selected:Xo.kind===Ht?.kind,rowProps:{onClick:dl(di)}})]}),Tl&&!(Ll&&Wl)&&nd(Tl,$l,"header"),!qs&&/* @__PURE__ */lt(De,{children:_s}),qs?/* @__PURE__ */st(dt,{children:[
51
- /* @__PURE__ */lt(Le,{words:Kt,icon:null,name:_s,fold:{open:!Qs,label:_s,onToggle:()=>Rr(kt)}}),!Qs&&/* @__PURE__ */lt(Ee,{children:ed})]}):ed,Ot&&!Ll&&/* @__PURE__ */lt(De,{children:Yt.footer}),Ml&&!(Ll&&Jl)&&nd(Ml,Pl,"footer"),Jl&&Ws(Jl),dr.treeFoot?.()]})]})}),
52
- /* @__PURE__ */lt(en,{side:"left",width:$r.left,min:tn.left,max:nn,defaultWidth:m.left,label:Yt.resizeLeftPanel,onResize:Ar})]}):/* @__PURE__ */lt(I,{side:"left",onShow:oi}),
53
- /* @__PURE__ */st("div",{ref:Wr,className:"sf-center sf-scroll","data-sf-canvas-head":Kr?"":void 0,style:{overflowX:ei?"auto":"hidden",overflowY:"hidden"},children:[Kr&&/* @__PURE__ */lt("div",{ref:Xr,className:"sf-canvas-head",children:/* @__PURE__ */lt(Kr,{device:ko})}),
54
- /* @__PURE__ */st("div",{className:"sf-frame-scaler",style:ni,children:[
55
- /* @__PURE__ */lt("div",{className:"sf-frame "+(ko===go?"":`sf-frame--${ko}`),style:ti,children:/* @__PURE__ */st("div",{className:"sf-preview-host",children:[
56
- /* @__PURE__ */lt(je.Provider,{value:Al,children:/* @__PURE__ */lt(Ae.Provider,{value:Fl,children:/* @__PURE__ */lt(to,{},Mo)})}),
57
- /* @__PURE__ */lt(un,{canvas:Ao,session:ss,model:zs,measure:Ns,canDrop:Os,onDrop:Ps,choose:ps,onPick:$s,dropOn:Ts?{accepts:(e,n)=>{if(!e.media||!Ts||n.item.rung)return!1;const t=Mn(Bt.data,pi,n.item.id);return null!==t&&Ts.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ls();n&&Ts&&Rs(n).then(n=>{n&&Ds(n,e.item.id)})})(n),label:()=>Yt.canvasReplaceImage}:void 0,onZoneAdd:Fs,onSeamAdd:Fs,zoneAddLabel:Yt.canvasAddBlock,words:Xt.canvas,readOnly:Boolean(wt),revision:Bt.data}),Yo.length>0&&!Lo&&/* @__PURE__ */lt("div",{className:"sf-preview-gaps",children:Yo.map(e=>
58
- /* @__PURE__ */lt(fn,{index:e.index,label:Yt.addSectionHere,onInsert:()=>rl(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))})]})}),hs?/* @__PURE__ */lt(ft,{canvas:Ao,tabs:ys,onSelect:e=>{const n=ai.findIndex(n=>String(n.props.id)===e);n>=0&&Qi(n)}}):null]})]}),uo?/* @__PURE__ */st(dt,{children:[
59
- /* @__PURE__ */lt(f,{value:{selectChild:Nl,addChild:Il,childRowName:Di,blockRowName:Kl},children:/* @__PURE__ */lt(oo,{mode:Xo,onOpenWebsiteSettings:dr.openSettings??(()=>{}),onOpenSiteStyles:dr.openStyles,onSelectNode:xr,onNotify:Hr,onHidePanel:ri,nodeActions:$t?Ce(jt,$t.type):vt})}),
60
- /* @__PURE__ */lt(en,{side:"right",width:$r.right,min:tn.right,max:nn,defaultWidth:m.right,label:Yt.resizeSettingsPanel,onResize:Lr})]}):
61
- /* @__PURE__ */lt(I,{side:"right",onShow:ri})]}),Yi.menu,
62
- /* @__PURE__ */lt(ee,{}),yi?/* @__PURE__ */lt(ct,{name:yi.name,onMake:e=>(async(e,n)=>{const t=ai.find(n=>String(n.props.id)===e),o=At.shared;if(!t||!o)return;let r;try{r=await C(gi).create(n,t)}catch{return void Hr(Yt.shared.makeFailed,"error")}o.adopt(t,r),ki(null)})(yi.id,e),onCancel:()=>ki(null)}):null]})}))}export{St as ScreenChrome};
@@ -1,5 +0,0 @@
1
- import{usePickFollowsSelection as n}from"./chunk-LNHT2KPX.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-CPFDJMFD.js";import{Inspector as i}from"./chunk-5ZBV5RA6.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},L={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},O={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function P(){/* @__PURE__ */
2
- return s(t,{height:"fill"})}function D(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
3
- return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var S=o({});function C({parts:n,children:e}){/* @__PURE__ */
4
- return s(S.Provider,{value:n,children:e})}function N(){return u(S)}function B(){return(N().useOwnerName??v)()}function F(){return(N().useDocumentLabel??g)()}function G(n,e,t,r){return(N().useBridges??h)(n,e,t,r)}function x(n){return(N().useStandaloneBridges??h)(n)}function I(n,e){(N().useDocumentPass??y)(n,e)}function T(){return N().blockRules??b}function A(){return N().blockLook??L}function K(){return N().devices??O}function R(){return N().leftView??j}function V(){return N().pinned??w}function H(){return N().saveSwitch??!0}function Z(e){n(!0===N().pickFollowsSelection,e)}function E(){return N().storageNamespace||void 0}function J(){return N().styleClipboard??null}function M(){return N().nodeKeys??!0}function X(){return N().notify??null}function Y(){return N().Canvas??P}function q(){return N().CanvasHead??null}function z(){return N().canvasDrag??null}var Q=o(null);function U({target:n,children:e}){/* @__PURE__ */
5
- return s(Q.Provider,{value:n,children:e})}function W(){return u(Q)}function $(){return N().Inspector??D}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,C as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,A as useScreenBlockLook,T as useScreenBlockRules,G as useScreenBridges,z as useScreenCanvasDrag,Y as useScreenCanvasFrame,q as useScreenCanvasHead,W as useScreenCanvasTarget,K as useScreenDevices,F as useScreenDocumentLabel,I as useScreenDocumentPass,$ as useScreenInspectorPanel,R as useScreenLeftView,M as useScreenNodeKeys,X as useScreenNotify,B as useScreenOwnerName,N as useScreenParts,Z as useScreenPickFollowsSelection,V as useScreenPinned,H as useScreenSaveSwitch,E as useScreenStorageNamespace,J as useScreenStyleClipboard,x as useStandaloneScreenBridges};
@@ -1 +0,0 @@
1
- import{styleMenuItems as e}from"./chunk-V7U33NF2.js";import{useEaselSession as n}from"./chunk-O7Q4DDJT.js";import{useHostEscape as t}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-23DYNW6S.js";import{ROOT_ZONE as l}from"./chunk-PLVEGYK6.js";import{easelMenuEntries as r,menuLabel as i}from"./chunk-BALFHI3G.js";import{createNodeClipboard as c,nodeMenuItems as s}from"./chunk-OSPUG6S6.js";import{DEFAULT_NODE_MENU_WORDS as a}from"./chunk-WK3AFPXY.js";import{isTypingTarget as u,useCanvasEvent as d,framePointToHost as p}from"./chunk-X4T6JT3M.js";import{zoneKey as f,ROOT_SLOT as m,ROOT_ID as h}from"./chunk-KRXQM65X.js";import{useState as y,useCallback as k,useRef as b,useEffect as v}from"react";import{ContextMenu as g}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as z,LayersIcon as O,CopyIcon as P}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,n){const t=[],o=/* @__PURE__ */new Set;let r={zone:n.zone,index:n.index};for(;r;){const n=e.nodeAt(r.zone,r.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:r.zone,index:r.index,node:n,parentType:null}),r.zone===l)break;const i=r.zone.lastIndexOf(":");if(i<=0)break;r=e.locate(r.zone.slice(0,i))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var K=c(),S=/* @__PURE__ */new WeakMap;function j(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",c);let t=S.get(n);return t||(t=c(),S.set(n,t)),t}function M(){return j(n())}function T(e,n,t){if(n===l){const{floor:n,cap:o}=e.sectionBand();return{parentId:h,slot:m,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function X(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function L(e,n,t){const o=e.canPasteAt;if(!o)return f(n.from)===t.zone?T(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=T(e,l.zone,l.index+1);if(o(n,t))return t}return null}function E(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(u(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function I(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=X(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const a=e.isPinned(l,t.zone)?null:L(e,s,t);return a?(e.nodeOps.paste(a),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function R(n,t){const{zone:o,index:r}=t,i=n.nodeAt(o,r);if(!i)return[];const c=i.props.id,a=n.labelOf(i.type,o),u=Boolean(i.props._hidden),d=n.nodeOps,p=n.isPinned(i,o),f=n.isLocked(i),m=!p&&!f&&!n.duplicateBlocked(i),h=n.permits?.(i)??{duplicate:!0,delete:!0},y=X(n,i,o),k=D(n,t),b=d.held,v=b&&!p?L(n,b,t):null,g=!n.readOnly,w=n.style?e({held:g?n.style.held():null,canCopy:n.style.canCopy(i,o),onCopy:()=>n.style?.copy(i,o),onPaste:()=>n.style?.paste(o,r,i),words:n.words?.styleClipboard}):[];return s({title:a,words:n.words?.menu,layer:{group:"pick",items:k.flatMap((e,t)=>{const o={label:n.rowNameOf(e.node,e.zone),checked:0===t,onClick:()=>n.selectAt(e.zone,e.index,e.node.props.id,e.parentType)},r=e.zone===l?null:n.slotRung?.(e.zone)??null;return r?[o,{label:r.label,checked:!1,onClick:r.select}]:[o]})},actions:{duplicate:g&&m&&h.duplicate?()=>d.duplicate(c):void 0,moveUp:g&&d.canStep(c,-1)?()=>d.step(c,-1):void 0,moveDown:g&&d.canStep(c,1)?()=>d.step(c,1):void 0,copy:y.copy?()=>d.copy(c,a):void 0,cut:g&&y.cut?()=>d.cut(c,a):void 0,paste:g&&b&&v?{label:b.label,run:()=>d.paste(v)}:void 0,rename:g&&n.renamePropOf(i,o)?()=>n.beginRename(o,r):void 0,hide:!g||f||p?void 0:{hidden:u,run:()=>d.setProps(c,{_hidden:!u})},delete:g&&m&&h.delete?()=>d.remove(c):void 0},style:w,extras:n.menuRows?.(i,o,r)??void 0,pinnedLine:p?Y(n).pinned:void 0})}var Y=e=>e.words?.screen??o.menu;function B(e){const n=Y(e),t=!e.readOnly,r=[];t&&e.history.hasPast&&r.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),t&&e.history.hasFuture&&r.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const i=[],c=e.nodeOps.held,s=T(e,l,e.sectionBand().cap);if(t&&c&&(e.canPasteAt?e.canPasteAt(c,s):f(c.from)===l)){const n=s,t=e.words?.menu??a;i.push({label:t.pasteNamed({paste:t.paste,label:c.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const u=[r,i,[{label:e.pageSettingsLabel??o.pageSettings,icon:/* @__PURE__ */A(z,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */A(O,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function N(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??a,c=Y(e),s=[];l&&(s.push({label:i.copy,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),s.push({label:i.cut,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),s.push({label:i.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const u=[s,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return u.flatMap((e,n)=>n?[d,...e]:e)}function U(e){return e.shiftKey}function V(e,n){const[o,l]=y(null),r=k(()=>l(null),[]);t(null!==o,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=E(e);if(!o)return;const l=t.selected();if(!l)return;const r=I(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;v(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),d(n,"keydown",c);const a=k(n=>{if(U(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);d(n,"contextmenu",t=>{if(U(t)||!n)return;const o=t.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;t.preventDefault();const c=p(n.frame,t.clientX,t.clientY),s=n.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),d(n,"mousedown",r),d(n,"scroll",r,{on:"window"});return{onEditorContextMenu:a,menu:o?/* @__PURE__ */A(F,{host:e,target:o,onClose:r}):null,closeMenu:r}}function F({host:e,target:n,onClose:t}){const o="node"===n.kind?R(e,n):"input"===n.kind?N(e,n.el):B(e);return 0===o.length?null:/* @__PURE__ */A(g,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":i(o),items:r(o)})}export{K as EASEL_NODE_CLIPBOARD,D as ancestorChain,j as nodeClipboardOf,X as nodeClipboardRules,R as nodeMenuItems,E as nodeShortcut,B as pageMenuItems,L as pastePlace,I as runNodeShortcut,N as textMenuItems,M as useNodeClipboard,V as useNodeContextMenu};