efficient-easel 27.0.0 → 27.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 (143) hide show
  1. package/dist/AddSidePanel-DoCx-ZrM.d.ts +1994 -0
  2. package/dist/{ScreenDocumentContext-DPW_6gOC.d.ts → ScreenDocumentContext-JQr4hTeP.d.ts} +7 -5
  3. package/dist/blocks/index.d.ts +1 -1
  4. package/dist/canvas/index.d.ts +2 -1
  5. package/dist/canvas/index.js +1 -1
  6. package/dist/chrome/index.js +1 -1
  7. package/dist/{chunk-PVBDKBJB.js → chunk-2EEYFRQM.js} +1 -1
  8. package/dist/{chunk-W3UZNKGS.js → chunk-2Y4CAWZQ.js} +4 -4
  9. package/dist/{chunk-CWELHADJ.js → chunk-3OOYGEJY.js} +1 -1
  10. package/dist/{chunk-BFJAEQZ6.js → chunk-3RGHXL5V.js} +1 -1
  11. package/dist/{chunk-JIP5JNRB.js → chunk-5HYVOOH3.js} +1 -1
  12. package/dist/chunk-64NREOML.js +1 -0
  13. package/dist/chunk-6GJEOER4.js +1 -0
  14. package/dist/{chunk-6ATIYLUL.js → chunk-6V6LC7QV.js} +1 -1
  15. package/dist/{chunk-KO47WAWR.js → chunk-7YXWWMBM.js} +1 -1
  16. package/dist/{chunk-GR3XRILS.js → chunk-A5USZ6Z6.js} +1 -1
  17. package/dist/{chunk-Y2T3JX7K.js → chunk-ANBPE45L.js} +1 -1
  18. package/dist/{chunk-KFWNGPW3.js → chunk-C63IB4VW.js} +5 -5
  19. package/dist/chunk-DCBUJ36Q.js +5 -0
  20. package/dist/{chunk-SQTVXE5D.js → chunk-DQSRGKSM.js} +18 -18
  21. package/dist/{chunk-YYD257TD.js → chunk-G7J6SGMF.js} +1 -1
  22. package/dist/chunk-HGTDDSFJ.js +19 -0
  23. package/dist/chunk-I4Z75MCX.js +1 -0
  24. package/dist/{chunk-AAZIMKLQ.js → chunk-JI7GUM3C.js} +1 -1
  25. package/dist/{chunk-QZJKWKGH.js → chunk-JUJEVGLY.js} +1 -1
  26. package/dist/{chunk-K53PQAMP.js → chunk-LDHUPZBK.js} +1 -1
  27. package/dist/{chunk-JQQFB7EZ.js → chunk-LK56FUFT.js} +1 -1
  28. package/dist/chunk-M5UCPD66.js +1 -0
  29. package/dist/{chunk-ZFEAWEFS.js → chunk-MMHYTIUY.js} +3 -3
  30. package/dist/{chunk-SBVIW3KJ.js → chunk-MTWQYLJE.js} +1 -1
  31. package/dist/chunk-OB4KI2AN.js +2 -0
  32. package/dist/{chunk-5OWAV3MH.js → chunk-OSF2H3LO.js} +1 -1
  33. package/dist/{chunk-TYTMUHUK.js → chunk-PTTQWCD7.js} +1 -1
  34. package/dist/{chunk-3XECMGXX.js → chunk-QEEW4X64.js} +1 -1
  35. package/dist/chunk-SDSBXW3V.js +26 -0
  36. package/dist/{chunk-76MUJIZE.js → chunk-SR2535CN.js} +17 -17
  37. package/dist/{chunk-QTHQPJWA.js → chunk-TF6NAIV7.js} +1 -1
  38. package/dist/{chunk-6EDVZBUO.js → chunk-TQUEVJOO.js} +1 -1
  39. package/dist/chunk-UMTUKSE6.js +1 -0
  40. package/dist/chunk-VNUXFD4X.js +1 -0
  41. package/dist/{chunk-VBEVZZTV.js → chunk-VTY7OQB5.js} +11 -11
  42. package/dist/{chunk-5JNVMCCB.js → chunk-XGTO4LHI.js} +1 -1
  43. package/dist/{chunk-YES5F7OS.js → chunk-XV5D4V2T.js} +1 -1
  44. package/dist/chunk-YCYGY54I.js +8 -0
  45. package/dist/chunk-YDTEYXQW.js +1 -0
  46. package/dist/chunk-ZSP4ZAQ2.js +64 -0
  47. package/dist/copy/index.js +11 -11
  48. package/dist/data/index.d.ts +2 -1
  49. package/dist/data/index.js +1 -1
  50. package/dist/drag/index.js +1 -1
  51. package/dist/easel/index.d.ts +1 -1
  52. package/dist/easel/index.js +1 -1
  53. package/dist/edit-lock/index.js +1 -1
  54. package/dist/fields/fields.css +8 -0
  55. package/dist/fields/index.d.ts +47 -3
  56. package/dist/fields/index.js +1 -1
  57. package/dist/node-ops/index.js +1 -1
  58. package/dist/phone-order-CRKvsTsz.d.ts +141 -0
  59. package/dist/screen/components/AddBlockRow.js +1 -1
  60. package/dist/screen/components/AddSidePanel.d.ts +3 -5
  61. package/dist/screen/components/AddSidePanel.js +1 -1
  62. package/dist/screen/components/NodeContextMenu.d.ts +3 -5
  63. package/dist/screen/components/NodeContextMenu.js +1 -1
  64. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  65. package/dist/screen/components/SaveControls.d.ts +3 -5
  66. package/dist/screen/components/SaveControls.js +1 -1
  67. package/dist/screen/components/ScreenChrome.js +1 -1
  68. package/dist/screen/components/ScreenDocumentContext.d.ts +2 -2
  69. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  70. package/dist/screen/components/ScreenMount.d.ts +3 -5
  71. package/dist/screen/components/ScreenMount.js +1 -1
  72. package/dist/screen/components/ScreenStoreProvider.d.ts +3 -5
  73. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  74. package/dist/screen/components/SectionScreenShell.js +17 -17
  75. package/dist/screen/components/SidePanelHead.js +1 -1
  76. package/dist/screen/components/panel-widths.js +1 -1
  77. package/dist/screen/components/usePartBridge.d.ts +3 -5
  78. package/dist/screen/components/usePartBridge.js +1 -1
  79. package/dist/screen/index.d.ts +3 -5
  80. package/dist/screen/index.js +1 -1
  81. package/dist/screen/lib/admin-bridge.d.ts +1 -1
  82. package/dist/screen/lib/document/add-target-types.d.ts +37 -55
  83. package/dist/screen/lib/document/block-set-host.js +1 -1
  84. package/dist/screen/lib/document/block-size-fields.d.ts +2 -2
  85. package/dist/screen/lib/document/block-size-fields.js +1 -1
  86. package/dist/screen/lib/document/block-types-in.js +1 -1
  87. package/dist/screen/lib/document/box-fields.d.ts +2 -2
  88. package/dist/screen/lib/document/box-fields.js +1 -1
  89. package/dist/screen/lib/document/button-fields.d.ts +2 -2
  90. package/dist/screen/lib/document/button-fields.js +1 -1
  91. package/dist/screen/lib/document/image-fields.d.ts +2 -2
  92. package/dist/screen/lib/document/image-fields.js +5 -5
  93. package/dist/screen/lib/document/new-child.d.ts +58 -0
  94. package/dist/screen/lib/document/new-child.js +1 -0
  95. package/dist/screen/lib/document/palette-sections.d.ts +3 -5
  96. package/dist/screen/lib/document/section-doc.d.ts +1 -1
  97. package/dist/screen/lib/document/section-doc.js +1 -1
  98. package/dist/screen/lib/document/shadow-fields.d.ts +2 -2
  99. package/dist/screen/lib/document/shadow-fields.js +2 -2
  100. package/dist/screen/lib/document/slot-section-spec.d.ts +37 -96
  101. package/dist/screen/lib/document/style-clipboard.d.ts +3 -5
  102. package/dist/screen/lib/document/style-clipboard.js +1 -1
  103. package/dist/screen/lib/document/style-fields.d.ts +2 -2
  104. package/dist/screen/lib/document/style-fields.js +1 -1
  105. package/dist/screen/lib/document/use-section-ops.d.ts +1 -1
  106. package/dist/screen/lib/document/use-section-ops.js +1 -1
  107. package/dist/screen/lib/document-addressing.d.ts +2 -2
  108. package/dist/screen/lib/document-hooks.d.ts +1 -1
  109. package/dist/screen/lib/document-switch.js +1 -1
  110. package/dist/screen/lib/failure.js +1 -1
  111. package/dist/screen/lib/host-inbound.js +1 -1
  112. package/dist/screen/lib/host.d.ts +2 -2
  113. package/dist/screen/lib/key-scope.js +1 -1
  114. package/dist/screen/lib/media-panel.d.ts +2 -2
  115. package/dist/screen/lib/media-picker.d.ts +2 -2
  116. package/dist/screen/lib/media-picker.js +1 -1
  117. package/dist/screen/lib/page-lock.d.ts +1 -1
  118. package/dist/screen/lib/page-lock.js +1 -1
  119. package/dist/screen/lib/screen-parts.d.ts +21 -1828
  120. package/dist/screen/lib/screen-parts.js +1 -1
  121. package/dist/screen/lib/section-templates.d.ts +1 -1
  122. package/dist/screen/lib/session-context.d.ts +1 -1
  123. package/dist/screen/lib/session.d.ts +1 -1
  124. package/dist/screen/lib/shared-sections.d.ts +1 -1
  125. package/dist/strings/index.d.ts +1 -1
  126. package/dist/strings/index.js +2 -2
  127. package/dist/style-clipboard/index.js +1 -1
  128. package/dist/text-styles/index.js +27 -27
  129. package/dist/{words-CFkb8XtN.d.ts → words-dNm6REMa.d.ts} +21 -0
  130. package/package.json +7 -1
  131. package/dist/chunk-2262JGFV.js +0 -5
  132. package/dist/chunk-3W2O22DZ.js +0 -19
  133. package/dist/chunk-DAKKPW2Z.js +0 -1
  134. package/dist/chunk-EUFDQ4KL.js +0 -1
  135. package/dist/chunk-FW35PCK7.js +0 -1
  136. package/dist/chunk-HG65R6IN.js +0 -20
  137. package/dist/chunk-JACEEVVF.js +0 -1
  138. package/dist/chunk-L2WK5JYB.js +0 -2
  139. package/dist/chunk-L7PSERQH.js +0 -8
  140. package/dist/chunk-NTG5ODKZ.js +0 -1
  141. package/dist/chunk-O4OWODU2.js +0 -64
  142. package/dist/chunk-TOKMFZPB.js +0 -1
  143. package/dist/resolve-Bz4mszpL.d.ts +0 -57
@@ -1 +1 @@
1
- export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSelectionMode,isSlotMode,sameInspectorMode,screenSlotsOf,shownChildSlotsOf,shownSlotFieldsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-2262JGFV.js";import"../../chunk-NCXYC7WI.js";import"../../chunk-LX23TCTP.js";import"../../chunk-TCAAOYQY.js";import"../../chunk-3W2O22DZ.js";import"../../chunk-JQQFB7EZ.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-HG65R6IN.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-YCSZAP7T.js";import"../../chunk-TDEBPOWV.js";import"../../chunk-WHS6Y55E.js";import"../../chunk-D4TH4QQR.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-56ID6FKZ.js";import"../../chunk-K53PQAMP.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-QTHQPJWA.js";import"../../chunk-MNQDOSAX.js";import"../../chunk-PMRN5Z3T.js";import"../../chunk-Y2T3JX7K.js";import"../../chunk-KFWNGPW3.js";import"../../chunk-DX3VILZ3.js";import"../../chunk-MIX7EGRG.js";import"../../chunk-JACEEVVF.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-3XECMGXX.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-TOKMFZPB.js";import"../../chunk-FR7EEKFF.js";import"../../chunk-7UFKEX72.js";import"../../chunk-EUFDQ4KL.js";import"../../chunk-KXM6YRG2.js";
1
+ export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSelectionMode,isSlotMode,sameInspectorMode,screenSlotsOf,shownChildSlotsOf,shownSlotFieldsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-DCBUJ36Q.js";import"../../chunk-NCXYC7WI.js";import"../../chunk-LX23TCTP.js";import"../../chunk-TCAAOYQY.js";import"../../chunk-HGTDDSFJ.js";import"../../chunk-LK56FUFT.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-SDSBXW3V.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-YCSZAP7T.js";import"../../chunk-TDEBPOWV.js";import"../../chunk-WHS6Y55E.js";import"../../chunk-D4TH4QQR.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-56ID6FKZ.js";import"../../chunk-LDHUPZBK.js";import"../../chunk-TF6NAIV7.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-MNQDOSAX.js";import"../../chunk-PMRN5Z3T.js";import"../../chunk-ANBPE45L.js";import"../../chunk-C63IB4VW.js";import"../../chunk-DX3VILZ3.js";import"../../chunk-MIX7EGRG.js";import"../../chunk-UMTUKSE6.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-QEEW4X64.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-6GJEOER4.js";import"../../chunk-FR7EEKFF.js";import"../../chunk-7UFKEX72.js";import"../../chunk-YDTEYXQW.js";import"../../chunk-KXM6YRG2.js";
@@ -6,7 +6,7 @@ import 'react';
6
6
  import '../../types-BljCVdzR.js';
7
7
  import '../../data/index.js';
8
8
  import '../../types-Dq180WRV.js';
9
- import '../../resolve-Bz4mszpL.js';
9
+ import '../../phone-order-CRKvsTsz.js';
10
10
  import '../../plan-D0DgSLnY.js';
11
11
  import './backend-error.js';
12
12
  import '../../edit-lock/index.js';
@@ -5,7 +5,7 @@ import '../../blocks/index.js';
5
5
  import '../../types-BljCVdzR.js';
6
6
  import '../../data/index.js';
7
7
  import '../../types-Dq180WRV.js';
8
- import '../../resolve-Bz4mszpL.js';
8
+ import '../../phone-order-CRKvsTsz.js';
9
9
  import '../../plan-D0DgSLnY.js';
10
10
  import './backend-error.js';
11
11
  import '../../edit-lock/index.js';
@@ -9,7 +9,7 @@ import 'react';
9
9
  import '../../types-BljCVdzR.js';
10
10
  import '../../data/index.js';
11
11
  import '../../types-Dq180WRV.js';
12
- import '../../resolve-Bz4mszpL.js';
12
+ import '../../phone-order-CRKvsTsz.js';
13
13
  import '../../plan-D0DgSLnY.js';
14
14
  import '../../edit-lock/index.js';
15
15
  import './links/link-filters.js';
@@ -6,7 +6,7 @@ import 'react';
6
6
  import '../../types-BljCVdzR.js';
7
7
  import '../../data/index.js';
8
8
  import '../../types-Dq180WRV.js';
9
- import '../../resolve-Bz4mszpL.js';
9
+ import '../../phone-order-CRKvsTsz.js';
10
10
  import '../../plan-D0DgSLnY.js';
11
11
  import './backend-error.js';
12
12
  import '../../edit-lock/index.js';
@@ -3,7 +3,7 @@ import { N as NoticeWords, C as ChromeWords } from '../words-DYu4iBrR.js';
3
3
  import { C as CopyWords } from '../words-Cf5VT2Ic.js';
4
4
  import { D as DragWords } from '../words-SD4neL0n.js';
5
5
  import { LockWords } from '../edit-lock/index.js';
6
- import { F as FieldsWords } from '../words-CFkb8XtN.js';
6
+ import { F as FieldsWords } from '../words-dNm6REMa.js';
7
7
  import { N as NodeMenuWords } from '../words-DMG4dYq2.js';
8
8
  import { P as PageCopyWords } from '../words-Dl8Qja4K.js';
9
9
  import { P as PanelWords, C as ColourRowWords } from '../words-BgeDGDKn.js';
@@ -1,2 +1,2 @@
1
- import{DEFAULT_TEXT_STYLES_WORDS as o}from"../chunk-OGH6CC3E.js";import{DEFAULT_SCREEN_WORDS as r,DEFAULT_IMAGE_ROW_WORDS as n}from"../chunk-G2VZ4DET.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"../chunk-6WY6ZXJG.js";import{DEFAULT_CANVAS_WORDS as c}from"../chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as e}from"../chunk-K56YDHYQ.js";import{DEFAULT_COLOUR_ROW_WORDS as m,DEFAULT_PANEL_WORDS as i}from"../chunk-56ID6FKZ.js";import{DEFAULT_NODE_MENU_WORDS as s}from"../chunk-WK3AFPXY.js";import{DEFAULT_PAGE_COPY_WORDS as u}from"../chunk-CEC5XLN4.js";import{DEFAULT_SAVE_WORDS as f}from"../chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as l}from"../chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as h}from"../chunk-2OAZYSWJ.js";import{DEFAULT_LOCK_WORDS as j}from"../chunk-RE4LP46F.js";import{DEFAULT_COPY_WORDS as a}from"../chunk-PMRN5Z3T.js";import{DEFAULT_FIELDS_WORDS as k}from"../chunk-JACEEVVF.js";import{stringsContext as y}from"../chunk-MFIRYGHW.js";import{DEFAULT_DRAG_WORDS as Y}from"../chunk-TQ5Y6S2X.js";import{useContext as C,useMemo as D}from"react";import{jsx as W}from"react/jsx-runtime";var d={notice:l,lock:j,save:f,chrome:p,rail:h,tree:e,panel:i,fields:k,colourRow:m,imageRow:n,drag:Y,menu:s,styleClipboard:t,copy:a,canvas:c,textStyles:o,screen:r,pageCopy:u},g=o=>"object"==typeof o&&null!==o;function v(o,r){const n={};for(const t of Object.keys(o)){const c=o[t],e=r[t];null==e?n[t]=c:g(c)?n[t]=g(e)?v(c,e):c:n[t]=typeof e==typeof c?e:c}return n}function E(o,r){return r?v(o,r):o}function F({value:o,locale:r,children:n}){const t=y(),c=C(t),e=c?.strings??d,m=r??c?.locale??"en",i=D(()=>({strings:E(e,o),locale:m}),[e,o,m]);/* @__PURE__ */
2
- return W(t.Provider,{value:i,children:n})}function J(){return C(y())?.strings??d}function R(){return C(y())?.locale??"en"}export{d as DEFAULT_EASEL_STRINGS,F as EaselStringsProvider,E as mergeEaselStrings,R as useEaselLocale,J as useEaselStrings};
1
+ import{DEFAULT_TEXT_STYLES_WORDS as o}from"../chunk-OGH6CC3E.js";import{DEFAULT_SCREEN_WORDS as r,DEFAULT_IMAGE_ROW_WORDS as n}from"../chunk-G2VZ4DET.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as t}from"../chunk-6WY6ZXJG.js";import{DEFAULT_CANVAS_WORDS as c}from"../chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as e}from"../chunk-K56YDHYQ.js";import{DEFAULT_COLOUR_ROW_WORDS as m,DEFAULT_PANEL_WORDS as i}from"../chunk-56ID6FKZ.js";import{DEFAULT_NODE_MENU_WORDS as s}from"../chunk-WK3AFPXY.js";import{DEFAULT_PAGE_COPY_WORDS as u}from"../chunk-CEC5XLN4.js";import{DEFAULT_SAVE_WORDS as f}from"../chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as l}from"../chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as h}from"../chunk-2OAZYSWJ.js";import{DEFAULT_LOCK_WORDS as j}from"../chunk-RE4LP46F.js";import{DEFAULT_COPY_WORDS as a}from"../chunk-PMRN5Z3T.js";import{DEFAULT_FIELDS_WORDS as k}from"../chunk-UMTUKSE6.js";import{stringsContext as y}from"../chunk-MFIRYGHW.js";import{DEFAULT_DRAG_WORDS as Y}from"../chunk-TQ5Y6S2X.js";import{useContext as D,useMemo as W}from"react";import{jsx as d}from"react/jsx-runtime";var g={notice:l,lock:j,save:f,chrome:p,rail:h,tree:e,panel:i,fields:k,colourRow:m,imageRow:n,drag:Y,menu:s,styleClipboard:t,copy:a,canvas:c,textStyles:o,screen:r,pageCopy:u},v=o=>"object"==typeof o&&null!==o;function C(o,r){const n={};for(const t of Object.keys(o)){const c=o[t],e=r[t];null==e?n[t]=c:v(c)?n[t]=v(e)?C(c,e):c:n[t]=typeof e==typeof c?e:c}return n}function S(o,r){return r?C(o,r):o}function E({value:o,locale:r,children:n}){const t=y(),c=D(t),e=c?.strings??g,m=r??c?.locale??"en",i=W(()=>({strings:S(e,o),locale:m}),[e,o,m]);/* @__PURE__ */
2
+ return d(t.Provider,{value:i,children:n})}function F(){return D(y())?.strings??g}function K(){return D(y())?.locale??"en"}export{g as DEFAULT_EASEL_STRINGS,E as EaselStringsProvider,S as mergeEaselStrings,K as useEaselLocale,F as useEaselStrings};
@@ -1 +1 @@
1
- export{COPY_STYLE_SHORTCUT,PASTE_STYLE_SHORTCUT,STYLE_KIND,choiceKind,clearStyle,copyStyle,fieldKind,heldStyle,pasteMessage,planPaste,styleMenuItems,styleShortcut,subscribeStyle,withStyleKind}from"../chunk-CWELHADJ.js";import"../chunk-6WY6ZXJG.js";import"../chunk-EUFDQ4KL.js";import"../chunk-KXM6YRG2.js";
1
+ export{COPY_STYLE_SHORTCUT,PASTE_STYLE_SHORTCUT,STYLE_KIND,choiceKind,clearStyle,copyStyle,fieldKind,heldStyle,pasteMessage,planPaste,styleMenuItems,styleShortcut,subscribeStyle,withStyleKind}from"../chunk-3OOYGEJY.js";import"../chunk-6WY6ZXJG.js";import"../chunk-YDTEYXQW.js";import"../chunk-KXM6YRG2.js";
@@ -1,37 +1,37 @@
1
- import{SettingsDefaultReset as e}from"../chunk-2T22IY3J.js";import{hexReadout as s,typedHex as t}from"../chunk-4FFDGEWA.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import{FieldSlider as l}from"../chunk-TDEBPOWV.js";import{DEFAULT_PANEL_WORDS as i}from"../chunk-56ID6FKZ.js";import{TEXT_STYLE_KINDS as n,canAddTextStyle as r,TEXT_STYLE_MAX as o,isDefaultTextStyle as d,CAMPAIGN_TEXT_STYLE_SETTINGS as c,TEXT_STYLE_SETTINGS as u,textStyleViewValues as m,textStyleRowSize as h,describeTextStyle as p,updateTextStyle as f,textStyleCaseCss as v,TEXT_STYLE_VIEW_NUMBERS as g,TEXT_STYLE_CASES as y,addTextStyle as S,removeTextStyle as b,TEXT_STYLE_RANGES as T,textStyleViewKey as N}from"../chunk-53QUHEHK.js";export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,TEXT_STYLE_VIEW_NUMBERS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,textStyleViewKey,textStyleViewValues,updateTextStyle,weightWord}from"../chunk-53QUHEHK.js";import{viewFollows as k,isAuto as C}from"../chunk-DIOTWSCO.js";import{FieldSelect as x}from"../chunk-KFWNGPW3.js";import{SettingsSegmented as E}from"../chunk-DX3VILZ3.js";import{SettingsField as w}from"../chunk-MIX7EGRG.js";import"../chunk-JACEEVVF.js";import{useWords as O}from"../chunk-MFIRYGHW.js";import{withTip as _}from"../chunk-P2VEMZH5.js";import{hsvToHex as z,Tooltip as j,ColorSwatch as L,Popover as M,ColorPickerPanel as W,colorSwatchClasses as $,IconButton as A,Button as I}from"efficient-shell/ui";import{useId as X,useState as Y,useRef as F,useEffect as G,Fragment as V}from"react";import{TrashIcon as D,ChevronIcon as H,BoldIcon as R,ItalicIcon as B,CaseLowerIcon as K,CaseCapitalizedIcon as U,CaseUpperIcon as P,CaseNormalIcon as q}from"efficient-shell/icons/efficient";import{jsxs as Z,jsx as J,Fragment as Q}from"react/jsx-runtime";var ee=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>z({h:e,s:1,v:1})).join(", ")})`;function se({value:e,hex:t,colours:a,label:l,followsWord:i,anyWord:n,onChange:r,readOnly:o=!1}){const d=void 0!==e&&a.some(s=>s.key===e),c=void 0!==e&&!d;/* @__PURE__ */
1
+ import{SettingsDefaultReset as e}from"../chunk-2T22IY3J.js";import{hexReadout as s,typedHex as t}from"../chunk-4FFDGEWA.js";import{DEFAULT_TEXT_STYLES_WORDS as a}from"../chunk-OGH6CC3E.js";export{DEFAULT_TEXT_STYLES_WORDS}from"../chunk-OGH6CC3E.js";import{FieldSlider as l}from"../chunk-TDEBPOWV.js";import{DEFAULT_PANEL_WORDS as i}from"../chunk-56ID6FKZ.js";import{TEXT_STYLE_KINDS as n,canAddTextStyle as r,TEXT_STYLE_MAX as o,isDefaultTextStyle as d,CAMPAIGN_TEXT_STYLE_SETTINGS as c,TEXT_STYLE_SETTINGS as u,textStyleViewValues as m,textStyleRowSize as h,describeTextStyle as p,updateTextStyle as f,textStyleCaseCss as v,TEXT_STYLE_VIEW_NUMBERS as g,TEXT_STYLE_CASES as y,addTextStyle as S,removeTextStyle as b,TEXT_STYLE_RANGES as T,textStyleViewKey as k}from"../chunk-53QUHEHK.js";export{CAMPAIGN_TEXT_STYLE_SETTINGS,TEXT_STYLE_CASES,TEXT_STYLE_CASE_CSS,TEXT_STYLE_DEFAULT_COUNT,TEXT_STYLE_KINDS,TEXT_STYLE_MAX,TEXT_STYLE_RANGES,TEXT_STYLE_SETTINGS,TEXT_STYLE_VIEW_NUMBERS,addTextStyle,canAddTextStyle,defaultTextStyles,describeTextStyle,isDefaultTextStyle,isTextStyleCase,removeTextStyle,resolveTextStyle,textStyleCaseCss,textStyleCaseOfCss,textStyleRowSize,textStyleViewKey,textStyleViewValues,updateTextStyle,weightWord}from"../chunk-53QUHEHK.js";import{viewFollows as N,isAuto as C}from"../chunk-DIOTWSCO.js";import{FieldSelect as x}from"../chunk-C63IB4VW.js";import{SettingsSegmented as E}from"../chunk-DX3VILZ3.js";import{SettingsField as w}from"../chunk-MIX7EGRG.js";import"../chunk-UMTUKSE6.js";import{useWords as O}from"../chunk-MFIRYGHW.js";import{withTip as _}from"../chunk-P2VEMZH5.js";import{hsvToHex as z,Tooltip as j,ColorSwatch as L,Popover as M,ColorPickerPanel as I,colorSwatchClasses as $,IconButton as W,Button as A}from"efficient-shell/ui";import{useId as X,useState as Y,useRef as D,useEffect as G,Fragment as V}from"react";import{TrashIcon as F,ChevronIcon as H,BoldIcon as R,ItalicIcon as U,CaseLowerIcon as B,CaseCapitalizedIcon as K,CaseUpperIcon as q,CaseNormalIcon as P}from"efficient-shell/icons/efficient";import{jsxs as Z,jsx as Q,Fragment as J}from"react/jsx-runtime";var ee=`conic-gradient(${[0,60,120,180,240,300,0].map(e=>z({h:e,s:1,v:1})).join(", ")})`;function se({value:e,hex:t,colours:a,label:l,followsWord:i,anyWord:n,onChange:r,readOnly:o=!1}){const d=void 0!==e&&a.some(s=>s.key===e),c=void 0!==e&&!d;/* @__PURE__ */
2
2
  return Z("div",{className:"es-ts-set","data-ts-setting":"color",children:[
3
3
  /* @__PURE__ */Z("div",{className:"es-ts-top",children:[
4
- /* @__PURE__ */J("span",{className:"es-ts-sub",children:l}),
5
- /* @__PURE__ */J("span",{className:"es-ts-colour-read",children:t?s(t):i})]}),
6
- /* @__PURE__ */Z("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[a.map(t=>/* @__PURE__ */J(j,{content:`${t.name} · ${s(t.value)}`,children:/* @__PURE__ */J(L,{color:t.value,size:"sm",className:"es-ts-swatch","aria-label":t.name,selected:e===t.key,disabled:o,onClick:()=>r(t.key)})},t.key)),
7
- /* @__PURE__ */J(j,{content:n,children:/* @__PURE__ */J(M,{trigger:/* @__PURE__ */J("span",{"aria-hidden":"true",className:"absolute inset-0",style:{background:ee}}),triggerLabel:n,triggerClassName:$({size:"sm",selected:c,className:"es-ts-swatch es-ts-swatch--any"}),"aria-label":l,disabled:o,children:/* @__PURE__ */J(W,{className:"es-pick-window",value:t??"",onChange:e=>r(e),label:l,disabled:o})})})]})]})}function te({styles:e,onChange:s,fonts:t,colours:l=[],settings:i=c,auto:u=[],fallback:m,sample:h,openId:p,defaultOpenId:f=null,onOpenChange:v,onAdd:g,rowActions:y,onRemove:T,max:N=o,device:k="desktop",readOnly:C=!1}){const x=O("textStyles",a),E=X(),[w,z]=Y(f),j=void 0!==p?p:w,L=e=>{void 0===p&&z(e),v?.(e)},M=F(null),[W,$]=Y(null);G(()=>{if(!W||!M.current)return;const e=[...M.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===W.id),s=e?e.querySelector(".es-ts-row"):M.current.querySelector(`.es-ts-add[data-ts-kind="${W.kind}"]`);s?.focus(),$(null)},[W]);/* @__PURE__ */
8
- return J("div",{className:"es-ts",ref:M,children:n.map(a=>{const n=e.filter(e=>e.kind===a),o=!r(e,a,N),c=!C&&!o;/* @__PURE__ */
4
+ /* @__PURE__ */Q("span",{className:"es-ts-sub",children:l}),
5
+ /* @__PURE__ */Q("span",{className:"es-ts-colour-read",children:t?s(t):i})]}),
6
+ /* @__PURE__ */Z("div",{className:"es-ts-swatches",role:"group","aria-label":l,children:[a.map(t=>/* @__PURE__ */Q(j,{content:`${t.name} · ${s(t.value)}`,children:/* @__PURE__ */Q(L,{color:t.value,size:"sm",className:"es-ts-swatch","aria-label":t.name,selected:e===t.key,disabled:o,onClick:()=>r(t.key)})},t.key)),
7
+ /* @__PURE__ */Q(j,{content:n,children:/* @__PURE__ */Q(M,{trigger:/* @__PURE__ */Q("span",{"aria-hidden":"true",className:"absolute inset-0",style:{background:ee}}),triggerLabel:n,triggerClassName:$({size:"sm",selected:c,className:"es-ts-swatch es-ts-swatch--any"}),"aria-label":l,disabled:o,children:/* @__PURE__ */Q(I,{className:"es-pick-window",value:t??"",onChange:e=>r(e),label:l,disabled:o})})})]})]})}function te({styles:e,onChange:s,fonts:t,colours:l=[],settings:i=c,auto:u=[],fallback:m,sample:h,openId:p,defaultOpenId:f=null,onOpenChange:v,onAdd:g,rowActions:y,onRemove:T,max:k=o,device:N="desktop",readOnly:C=!1}){const x=O("textStyles",a),E=X(),[w,z]=Y(f),j=void 0!==p?p:w,L=e=>{void 0===p&&z(e),v?.(e)},M=D(null),[I,$]=Y(null);G(()=>{if(!I||!M.current)return;const e=[...M.current.querySelectorAll(".es-ts-item")].find(e=>e.dataset.tsId===I.id),s=e?e.querySelector(".es-ts-row"):M.current.querySelector(`.es-ts-add[data-ts-kind="${I.kind}"]`);s?.focus(),$(null)},[I]);/* @__PURE__ */
8
+ return Q("div",{className:"es-ts",ref:M,children:n.map(a=>{const n=e.filter(e=>e.kind===a),o=!r(e,a,k),c=!C&&!o;/* @__PURE__ */
9
9
  return Z(ae,{label:x.groups[a],children:[n.map(a=>{const n=y?.(a),r=null!=n&&!1!==n,o=Boolean(T)&&!C&&!d(a);/* @__PURE__ */
10
- return J(le,{style:a,fonts:t,colours:l,settings:i,auto:u,fallback:m,sample:h,device:k,readOnly:C,open:j===a.id,onOpenChange:e=>L(e?a.id:null),onChange:t=>s(e.map(e=>e.id===t.id?t:e)),actions:o||r?/* @__PURE__ */Z(Q,{children:[o?_(x.remove,/* @__PURE__ */J(A,{variant:"ghost-danger",size:"sm",className:"es-ts-del","aria-label":x.removeNamed({name:a.name}),onClick:()=>(t=>{if(C||!T)return;const a=b(e,t.id,{name:x.styleName});if(!a)return;const l=e.filter(e=>e.kind===t.kind),i=l[l.indexOf(t)+1];j===t.id&&L(null),s(a.styles),T(a.removed),$({id:i?.id??null,kind:t.kind})})(a),children:/* @__PURE__ */J(D,{size:14,"aria-hidden":"true"})})):null,r?n:null]}):null},a.id)}),_(!C&&o?x.full({kind:a,max:N}):void 0,/* @__PURE__ */Z(I,{variant:"link",className:"es-ts-add","data-ts-kind":a,disabled:C,"aria-disabled":!(C||!o)||void 0,"aria-describedby":!C&&o?`${E}-full-${a}`:void 0,onClick:()=>{c&&(t=>{if(C)return;const a=S(e,t,{max:N,name:x.styleName,make:g});a&&s(a.styles)})(a)},children:[
11
- /* @__PURE__ */J("span",{className:"es-ts-add-word",children:x.add[a]}),
12
- /* @__PURE__ */J("span",{className:"es-ts-count",children:x.count({n:n.length,max:N})})]})),C||!o?null:/* @__PURE__ */J("span",{id:`${E}-full-${a}`,className:"es-vh",children:x.full({kind:a,max:N})})]},a)})})}function ae({label:e,children:s}){const t=X();/* @__PURE__ */
10
+ return Q(le,{style:a,fonts:t,colours:l,settings:i,auto:u,fallback:m,sample:h,device:N,readOnly:C,open:j===a.id,onOpenChange:e=>L(e?a.id:null),onChange:t=>s(e.map(e=>e.id===t.id?t:e)),actions:o||r?/* @__PURE__ */Z(J,{children:[o?_(x.remove,/* @__PURE__ */Q(W,{variant:"ghost-danger",size:"sm",className:"es-ts-del","aria-label":x.removeNamed({name:a.name}),onClick:()=>(t=>{if(C||!T)return;const a=b(e,t.id,{name:x.styleName});if(!a)return;const l=e.filter(e=>e.kind===t.kind),i=l[l.indexOf(t)+1];j===t.id&&L(null),s(a.styles),T(a.removed),$({id:i?.id??null,kind:t.kind})})(a),children:/* @__PURE__ */Q(F,{size:14,"aria-hidden":"true"})})):null,r?n:null]}):null},a.id)}),_(!C&&o?x.full({kind:a,max:k}):void 0,/* @__PURE__ */Z(A,{variant:"link",className:"es-ts-add","data-ts-kind":a,disabled:C,"aria-disabled":!(C||!o)||void 0,"aria-describedby":!C&&o?`${E}-full-${a}`:void 0,onClick:()=>{c&&(t=>{if(C)return;const a=S(e,t,{max:k,name:x.styleName,make:g});a&&s(a.styles)})(a)},children:[
11
+ /* @__PURE__ */Q("span",{className:"es-ts-add-word",children:x.add[a]}),
12
+ /* @__PURE__ */Q("span",{className:"es-ts-count",children:x.count({n:n.length,max:k})})]})),C||!o?null:/* @__PURE__ */Q("span",{id:`${E}-full-${a}`,className:"es-vh",children:x.full({kind:a,max:k})})]},a)})})}function ae({label:e,children:s}){const t=X();/* @__PURE__ */
13
13
  return Z("section",{className:"es-ts-section","aria-labelledby":t,children:[
14
- /* @__PURE__ */J("div",{className:"es-ts-group",id:t,children:e}),s]})}function le({style:e,fonts:s,colours:t=[],settings:l=c,auto:i=[],fallback:n,sample:r,open:o,onOpenChange:d,onChange:v,actions:g,device:y="desktop",readOnly:S=!1}){const b=O("textStyles",a),T=`${X()}-open-${e.id}`,N=new Set(i),k=u.filter(e=>l.includes(e)),C={...n?.(e)??{},...e.values},x=m(C,y),E=s.find(e=>e.value===C.font),w={fontFamily:E?.family,fontSize:`${h(x.size??16)}px`,fontWeight:C.weight,fontStyle:C.italic?"italic":void 0};/* @__PURE__ */
14
+ /* @__PURE__ */Q("div",{className:"es-ts-group",id:t,children:e}),s]})}function le({style:e,fonts:s,colours:t=[],settings:l=c,auto:i=[],fallback:n,sample:r,open:o,onOpenChange:d,onChange:v,actions:g,device:y="desktop",readOnly:S=!1}){const b=O("textStyles",a),T=`${X()}-open-${e.id}`,k=new Set(i),N=u.filter(e=>l.includes(e)),C={...n?.(e)??{},...e.values},x=m(C,y),E=s.find(e=>e.value===C.font),w={fontFamily:E?.family,fontSize:`${h(x.size??16)}px`,fontWeight:C.weight,fontStyle:C.italic?"italic":void 0};/* @__PURE__ */
15
15
  return Z(V,{children:[
16
16
  /* @__PURE__ */Z("div",{className:"es-ts-item","data-ts-id":e.id,children:[
17
17
  /* @__PURE__ */Z("button",{type:"button",className:"es-ts-row","aria-expanded":o,"aria-controls":o?T:void 0,onClick:()=>d(!o),children:[
18
- /* @__PURE__ */J("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */J(H,{size:12})}),
19
- /* @__PURE__ */J("span",{className:"es-ts-name",style:w,children:e.name}),
20
- /* @__PURE__ */J("span",{className:"es-ts-meta",children:p(x,s,b,{autoSize:N.has("size")&&void 0===x.size})})]}),g?/* @__PURE__ */J("div",{className:"es-ts-actions",children:g}):null]}),o?/* @__PURE__ */J("div",{className:"es-ts-open",id:T,children:/* @__PURE__ */J(ne,{style:e,values:C,fonts:s,colours:t,settings:k,autoSet:N,sample:r??b.sample,words:b,device:y,readOnly:S,set:s=>v(f([e],e.id,s)[0])})}):null]})}var ie={none:q,upper:P,capitalize:U,lower:K};function ne({style:s,values:a,fonts:n,colours:r,settings:o,autoSet:d,sample:c,words:u,device:h,readOnly:p,set:f}){const y=s.values,S=O("panel",i),b=n.find(e=>e.value===a.font),x=function(e,s){return e?s.find(s=>s.key===e)?.value??t(e)??void 0:void 0}(a.color,r),E=e=>"largestSize"===e||d.has(e),z=e=>E(e)?y[e]:a[e],j=m(y,h),L=j.size??z("size"),M=j.lineSpacing??z("lineSpacing"),W=j.letterSpacing??z("letterSpacing"),$=E("letterCase")?y.letterCase:a.letterCase,I={fontFamily:b?.family,fontSize:void 0===L?void 0:`${L}px`,fontWeight:a.weight,fontStyle:a.italic?"italic":void 0,lineHeight:void 0===M?void 0:String(M/100),letterSpacing:void 0===W?void 0:`${W}px`,color:x,textTransform:v($)},X=e=>{const s=T[e],t=E(e);/* @__PURE__ */
21
- return J("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */J(l,{label:u.settings[e],value:y[e],onChange:s=>f({[e]:s}),min:s.min,max:s.max,step:s.step,shiftStep:s.shiftStep,sliderMin:s.sliderMin,sliderMax:s.sliderMax,unit:s.unit||void 0,styleValue:t?void 0:a[e],auto:t?u.auto:void 0,readOnly:p})},e)};/* @__PURE__ */
22
- return Z(Q,{children:[
23
- /* @__PURE__ */J("div",{className:"es-ts-preview",style:I,"aria-label":u.preview,children:c}),o.map(t=>{if("desktop"!==h)return g.includes(t)?"largestSize"===t&&"heading"!==s.kind?null:((s,t)=>{const a=T[s],i=N(s,t),n=k(z(s),"phone"===t?y[N(s,"tablet")]:void 0),r=!C(y[i]);/* @__PURE__ */
24
- return J("div",{className:"es-ts-slider","data-ts-setting":s,"data-ts-device":t,children:/* @__PURE__ */J(w,{label:u.settings[s],changed:r,action:/* @__PURE__ */J(e,{label:u.settings[s],changed:r,disabled:p,onReset:()=>f({[i]:void 0}),detail:void 0===n?u.auto:`${n}${a.unit}`,words:S}),children:/* @__PURE__ */J(l,{bare:!0,label:u.settings[s],value:y[i],onChange:e=>f({[i]:e}),min:a.min,max:a.max,step:a.step,shiftStep:a.shiftStep,sliderMin:a.sliderMin,sliderMax:a.sliderMax,unit:a.unit||void 0,styleValue:n,auto:void 0===n?u.auto:void 0,readOnly:p})})},s)})(t,h):null;switch(t){case"font":/* @__PURE__ */
25
- return J(re,{value:y.font,fonts:n,words:u,readOnly:p,set:f},t);case"color":/* @__PURE__ */
26
- return J(oe,{value:y.color,hex:x,colours:r,words:u,readOnly:p,set:f},t);case"emphasis":{const e=(a.weight??400)>=600,s=!1!==b?.italic;/* @__PURE__ */
18
+ /* @__PURE__ */Q("span",{className:"es-ts-chev","aria-hidden":"true",children:/* @__PURE__ */Q(H,{size:12})}),
19
+ /* @__PURE__ */Q("span",{className:"es-ts-name",style:w,children:e.name}),
20
+ /* @__PURE__ */Q("span",{className:"es-ts-meta",children:p(x,s,b,{autoSize:k.has("size")&&void 0===x.size})})]}),g?/* @__PURE__ */Q("div",{className:"es-ts-actions",children:g}):null]}),o?/* @__PURE__ */Q("div",{className:"es-ts-open",id:T,children:/* @__PURE__ */Q(ne,{style:e,values:C,fonts:s,colours:t,settings:N,autoSet:k,sample:r??b.sample,words:b,device:y,readOnly:S,set:s=>v(f([e],e.id,s)[0])})}):null]})}var ie={none:P,upper:q,capitalize:K,lower:B};function ne({style:s,values:a,fonts:n,colours:r,settings:o,autoSet:d,sample:c,words:u,device:h,readOnly:p,set:f}){const y=s.values,S=O("panel",i),b=n.find(e=>e.value===a.font),x=function(e,s){return e?s.find(s=>s.key===e)?.value??t(e)??void 0:void 0}(a.color,r),E=e=>"largestSize"===e||d.has(e),z=e=>E(e)?y[e]:a[e],j=m(y,h),L=j.size??z("size"),M=j.lineSpacing??z("lineSpacing"),I=j.letterSpacing??z("letterSpacing"),$=E("letterCase")?y.letterCase:a.letterCase,A={fontFamily:b?.family,fontSize:void 0===L?void 0:`${L}px`,fontWeight:a.weight,fontStyle:a.italic?"italic":void 0,lineHeight:void 0===M?void 0:String(M/100),letterSpacing:void 0===I?void 0:`${I}px`,color:x,textTransform:v($)},X=e=>{const s=T[e],t=E(e);/* @__PURE__ */
21
+ return Q("div",{className:"es-ts-slider","data-ts-setting":e,children:/* @__PURE__ */Q(l,{label:u.settings[e],value:y[e],onChange:s=>f({[e]:s}),min:s.min,max:s.max,step:s.step,shiftStep:s.shiftStep,sliderMin:s.sliderMin,sliderMax:s.sliderMax,unit:s.unit||void 0,styleValue:t?void 0:a[e],auto:t?u.auto:void 0,readOnly:p})},e)};/* @__PURE__ */
22
+ return Z(J,{children:[
23
+ /* @__PURE__ */Q("div",{className:"es-ts-preview",style:A,"aria-label":u.preview,children:c}),o.map(t=>{if("desktop"!==h)return g.includes(t)?"largestSize"===t&&"heading"!==s.kind?null:((s,t)=>{const a=T[s],i=k(s,t),n=N(z(s),"phone"===t?y[k(s,"tablet")]:void 0),r=!C(y[i]);/* @__PURE__ */
24
+ return Q("div",{className:"es-ts-slider","data-ts-setting":s,"data-ts-device":t,children:/* @__PURE__ */Q(w,{label:u.settings[s],changed:r,action:/* @__PURE__ */Q(e,{label:u.settings[s],changed:r,disabled:p,onReset:()=>f({[i]:void 0}),detail:void 0===n?u.auto:`${n}${a.unit}`,words:S}),children:/* @__PURE__ */Q(l,{bare:!0,label:u.settings[s],value:y[i],onChange:e=>f({[i]:e}),min:a.min,max:a.max,step:a.step,shiftStep:a.shiftStep,sliderMin:a.sliderMin,sliderMax:a.sliderMax,unit:a.unit||void 0,styleValue:n,auto:void 0===n?u.auto:void 0,readOnly:p})})},s)})(t,h):null;switch(t){case"font":/* @__PURE__ */
25
+ return Q(re,{value:y.font,fonts:n,words:u,readOnly:p,set:f},t);case"color":/* @__PURE__ */
26
+ return Q(oe,{value:y.color,hex:x,colours:r,words:u,readOnly:p,set:f},t);case"emphasis":{const e=(a.weight??400)>=600,s=!1!==b?.italic;/* @__PURE__ */
27
27
  return Z("div",{className:"es-ts-set","data-ts-setting":t,children:[
28
- /* @__PURE__ */J("span",{className:"es-ts-sub",children:u.settings.emphasis}),
29
- /* @__PURE__ */Z("div",{className:"es-ts-icons",children:[_(u.bold,/* @__PURE__ */J(A,{className:"es-ts-icon","aria-label":u.bold,"aria-pressed":e,disabled:p,onClick:()=>f({weight:e?400:700}),children:/* @__PURE__ */J(R,{size:16})})),p||s?_(u.italic,/* @__PURE__ */J(A,{className:"es-ts-icon","aria-label":u.italic,"aria-pressed":Boolean(a.italic),disabled:p,onClick:()=>f({italic:!a.italic||void 0}),children:/* @__PURE__ */J(B,{size:16})})):/* @__PURE__ */J(A,{className:"es-ts-icon","aria-label":u.italic,"aria-pressed":Boolean(a.italic),"aria-disabled":!0,disabledReason:u.italicMissing,children:/* @__PURE__ */J(B,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
30
- return J(de,{value:y.letterCase??a.letterCase,auto:E("letterCase"),words:u,readOnly:p,set:f},t);case"largestSize":return"heading"===s.kind?X(t):null;default:return X(t)}})]})}function re({value:e,fonts:s,words:t,readOnly:a,set:l}){const i=X();/* @__PURE__ */
28
+ /* @__PURE__ */Q("span",{className:"es-ts-sub",children:u.settings.emphasis}),
29
+ /* @__PURE__ */Z("div",{className:"es-ts-icons",children:[_(u.bold,/* @__PURE__ */Q(W,{className:"es-ts-icon","aria-label":u.bold,"aria-pressed":e,disabled:p,onClick:()=>f({weight:e?400:700}),children:/* @__PURE__ */Q(R,{size:16})})),p||s?_(u.italic,/* @__PURE__ */Q(W,{className:"es-ts-icon","aria-label":u.italic,"aria-pressed":Boolean(a.italic),disabled:p,onClick:()=>f({italic:!a.italic||void 0}),children:/* @__PURE__ */Q(U,{size:16})})):/* @__PURE__ */Q(W,{className:"es-ts-icon","aria-label":u.italic,"aria-pressed":Boolean(a.italic),"aria-disabled":!0,disabledReason:u.italicMissing,children:/* @__PURE__ */Q(U,{size:16})})]})]},t)}case"letterCase":/* @__PURE__ */
30
+ return Q(de,{value:y.letterCase??a.letterCase,auto:E("letterCase"),words:u,readOnly:p,set:f},t);case"largestSize":return"heading"===s.kind?X(t):null;default:return X(t)}})]})}function re({value:e,fonts:s,words:t,readOnly:a,set:l}){const i=X();/* @__PURE__ */
31
31
  return Z("div",{className:"es-ts-set","data-ts-setting":"font",children:[
32
- /* @__PURE__ */J("span",{className:"es-ts-sub",id:i,children:t.settings.font}),
33
- /* @__PURE__ */J(x,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>l({font:e}),ariaLabelledBy:i,readOnly:a})]})}function oe({value:e,hex:s,colours:t,words:a,readOnly:l,set:i}){/* @__PURE__ */
34
- return J(se,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:l,onChange:e=>i({color:e})})}function de({value:e,auto:s,words:t,readOnly:a,set:l}){const i=y.map(e=>{const s=ie[e];return{id:e,label:/* @__PURE__ */J(s,{size:16}),title:t.case[e]}}),n=s?[{id:"auto",label:/* @__PURE__ */J("span",{children:t.case.auto}),title:t.case.autoTitle},...i]:i;/* @__PURE__ */
32
+ /* @__PURE__ */Q("span",{className:"es-ts-sub",id:i,children:t.settings.font}),
33
+ /* @__PURE__ */Q(x,{value:e,options:s.map(e=>({label:e.label,value:e.value})),onChange:e=>l({font:e}),ariaLabelledBy:i,readOnly:a})]})}function oe({value:e,hex:s,colours:t,words:a,readOnly:l,set:i}){/* @__PURE__ */
34
+ return Q(se,{value:e,hex:s,colours:t,label:a.settings.color,followsWord:a.colour.follows,anyWord:a.colour.any,readOnly:l,onChange:e=>i({color:e})})}function de({value:e,auto:s,words:t,readOnly:a,set:l}){const i=y.map(e=>{const s=ie[e];return{id:e,label:/* @__PURE__ */Q(s,{size:16}),title:t.case[e]}}),n=s?[{id:"auto",label:/* @__PURE__ */Q("span",{children:t.case.auto}),title:t.case.autoTitle},...i]:i;/* @__PURE__ */
35
35
  return Z("div",{className:"es-ts-set","data-ts-setting":"letterCase",children:[
36
- /* @__PURE__ */J("span",{className:"es-ts-sub",children:t.settings.letterCase}),
37
- /* @__PURE__ */J(E,{options:n,value:e??(s?"auto":"none"),ariaLabel:t.settings.letterCase,disabled:a,onChange:e=>l({letterCase:"auto"===e?void 0:e})})]})}export{se as ColourSwatchRow,le as TextStyleItem,ae as TextStylesGroup,te as TextStylesList};
36
+ /* @__PURE__ */Q("span",{className:"es-ts-sub",children:t.settings.letterCase}),
37
+ /* @__PURE__ */Q(E,{options:n,value:e??(s?"auto":"none"),ariaLabel:t.settings.letterCase,disabled:a,onChange:e=>l({letterCase:"auto"===e?void 0:e})})]})}export{se as ColourSwatchRow,le as TextStyleItem,ae as TextStylesGroup,te as TextStylesList};
@@ -71,6 +71,27 @@ type FieldsWords = {
71
71
  total: number;
72
72
  }) => string;
73
73
  };
74
+ /**
75
+ * `PhoneOrderField` — the order a parent's children stack in on a phone.
76
+ * Optional: a host's older catalogue falls back to the English. `noun` is
77
+ * one child's word, lower case ("column", "block").
78
+ */
79
+ phoneOrder?: {
80
+ /** The row's name, and the list's. */
81
+ label: string;
82
+ /** The row's hint when the host gives none: "The order the columns stack in on a phone." */
83
+ hint: (v: {
84
+ noun: string;
85
+ }) => string;
86
+ /** Under the list while it follows the desktop order. */
87
+ followsDesktop: (v: {
88
+ noun: string;
89
+ }) => string;
90
+ /** Under the list once an order is set. */
91
+ desktopKept: string;
92
+ /** The button that clears the order. */
93
+ matchDesktop: string;
94
+ };
74
95
  };
75
96
 
76
97
  export type { FieldsWords as F };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efficient-easel",
3
- "version": "27.0.0",
3
+ "version": "27.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",
@@ -108,6 +108,7 @@
108
108
  "./screen/lib/document/field-markers",
109
109
  "./screen/lib/document/image-fields",
110
110
  "./screen/lib/document/shadow-fields",
111
+ "./screen/lib/document/new-child",
111
112
  "./screen/lib/document/palette-sections",
112
113
  "./screen/lib/document/panel-fields",
113
114
  "./screen/lib/document/panel-no-control-mark",
@@ -513,6 +514,11 @@
513
514
  "import": "./dist/screen/lib/document/hidable.js",
514
515
  "default": "./dist/screen/lib/document/hidable.js"
515
516
  },
517
+ "./screen/lib/document/new-child": {
518
+ "types": "./dist/screen/lib/document/new-child.d.ts",
519
+ "import": "./dist/screen/lib/document/new-child.js",
520
+ "default": "./dist/screen/lib/document/new-child.js"
521
+ },
516
522
  "./screen/lib/document/palette-sections": {
517
523
  "types": "./dist/screen/lib/document/palette-sections.d.ts",
518
524
  "import": "./dist/screen/lib/document/palette-sections.js",
@@ -1,5 +0,0 @@
1
- import{usePickFollowsSelection as n}from"./chunk-NCXYC7WI.js";import{slotFieldsOf as e,slotChildrenIn as t}from"./chunk-TCAAOYQY.js";import{EaselCanvas as r,useSelectedFields as o}from"./chunk-3W2O22DZ.js";import{Inspector as i}from"./chunk-HG65R6IN.js";import{fieldIsShown as u}from"./chunk-BPXEFVSQ.js";import{createContext as l,useContext as s}from"react";import{DesktopIcon as c}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";var a={kind:"selection"};function d(n){return"selection"===n.kind}function p(n,e){if(d(n)&&d(e))return!0;const t=n,r=e,o=Object.keys(t);return o.length===Object.keys(r).length&&o.every(n=>Object.is(t[n],r[n]))}function m(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function k(n,t){const r=n.components?.[t.type]?.fields??{};return e(n,t.type).filter(n=>u(r[n],{values:t.props}))}function h(n,e){return k(n,e).flatMap(n=>t(e,n))}function v(n,e,t){const r=n.slotsOf?.(t);return r||k(e,t).map(n=>({slot:n,label:n,rung:!1}))}function y(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function g(n,e){return n.isLast?n.isLast(e):e.type===n.last}var b={},O=()=>b,j=()=>"",w=()=>null,C=()=>{},S={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},N={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */f(c,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},D={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},I={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function P(){/* @__PURE__ */
2
- return f(r,{height:"fill"})}function B(){const{id:n,fields:e,values:t,readOnly:r,onChange:u}=o();/* @__PURE__ */
3
- return f("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */f(i,{fields:e,values:t,onChange:u,readOnly:r,idPrefix:n})})}var G=l({});function x({parts:n,children:e}){/* @__PURE__ */
4
- return f(G.Provider,{value:n,children:e})}function A(){return s(G)}function F(){return(A().useOwnerName??j)()}function T(){return(A().useDocumentLabel??w)()}function R(n,e,t,r){return(A().useBridges??O)(n,e,t,r)}function Y(n){return(A().useStandaloneBridges??O)(n)}function H(n,e){(A().useDocumentPass??C)(n,e)}function Q(){return A().blockRules??S}function V(){return A().blockLook??L}function W(){return A().devices??N}function X(){return A().leftView??D}function Z(){return A().pinned??I}function E(){return A().saveSwitch??!0}function K(e){n(!0===A().pickFollowsSelection,e)}function M(){return A().storageNamespace||void 0}function q(){return A().styleClipboard??null}function z(){return A().nodeKeys??!0}function J(){return A().notify??null}function U(){return A().Canvas??P}function $(){return A().CanvasHead??null}function _(){return A().canvasDrag??null}var nn=l(null);function en({target:n,children:e}){/* @__PURE__ */
5
- return f(nn.Provider,{value:n,children:e})}function tn(){return s(nn)}function rn(){return A().Inspector??B}export{a as SELECTION_MODE,en as ScreenCanvasTargetProvider,x as ScreenPartsProvider,y as isPinnedFirst,g as isPinnedLast,d as isSelectionMode,m as isSlotMode,p as sameInspectorMode,v as screenSlotsOf,h as shownChildSlotsOf,k as shownSlotFieldsOf,V as useScreenBlockLook,Q as useScreenBlockRules,R as useScreenBridges,_ as useScreenCanvasDrag,U as useScreenCanvasFrame,$ as useScreenCanvasHead,tn as useScreenCanvasTarget,W as useScreenDevices,T as useScreenDocumentLabel,H as useScreenDocumentPass,rn as useScreenInspectorPanel,X as useScreenLeftView,z as useScreenNodeKeys,J as useScreenNotify,F as useScreenOwnerName,A as useScreenParts,K as useScreenPickFollowsSelection,Z as useScreenPinned,E as useScreenSaveSwitch,M as useScreenStorageNamespace,q as useScreenStyleClipboard,Y as useStandaloneScreenBridges};
@@ -1,19 +0,0 @@
1
- import{findCopy as e,repeatCopyWithWrapper as t}from"./chunk-JQQFB7EZ.js";import{DEFAULT_CANVAS_WORDS as n}from"./chunk-TBY3DFKS.js";import{useResolvedFields as o}from"./chunk-K53PQAMP.js";import{toItemSelector as r,fromItemSelector as l,useNodeOps as i,parentStep as s,clickPickPart as a,clickPick as c}from"./chunk-QTHQPJWA.js";import{selectionBox as u,placeWindow as d,offsetOrigin as p,colorRunOf as f,ColorWindow as h,startCanvasTyping as m,textMap as g,richLayout as y}from"./chunk-MNQDOSAX.js";import{DEFAULT_COPY_WORDS as v}from"./chunk-PMRN5Z3T.js";import{useWords as w}from"./chunk-MFIRYGHW.js";import{CANVAS_TYPABLE_EVENT as b,CANVAS_TYPING_EVENT as k}from"./chunk-TOKMFZPB.js";import{setCanvasNonce as S,related as x,isTypingTarget as C,upsertCanvasStyle as I,removeCanvasStyle as E,WORDS_CLEAR as A,frameRectToHost as M,drawnBox as D}from"./chunk-FR7EEKFF.js";import{queryAllCopies as O}from"./chunk-7UFKEX72.js";import{find as $,ROOT_ID as P,getList as j,remove as z,parseZoneKey as R,move as L,duplicate as N,replaceNode as B,createNode as V,insert as K,normalizeData as T,createResolveCache as F,slotsOf as Z,deepEqual as H,ROOT_SLOT as W,resolveNodeData as q}from"./chunk-EUFDQ4KL.js";import{topLevelSlotKeys as Q,fieldsFrom as Y,drawnBlockCount as U,defaultsFrom as X}from"./chunk-KXM6YRG2.js";import{createContext as G,useEffect as J,useContext as _,useRef as ee,useSyncExternalStore as te,useState as ne,useReducer as oe,useCallback as re,createElement as le,useMemo as ie,useLayoutEffect as se}from"react";import{jsx as ae,jsxs as ce,Fragment as ue}from"react/jsx-runtime";import{createPortal as de}from"react-dom";import{registerModalEscapeInterceptor as pe,FloatingBar as fe,TextToolbar as he,LinkPicker as me}from"efficient-shell/ui";function ge(e){return!["setData","setUi","set"].includes(e.type)}var ye=(e,t,n,o)=>{const r=j(e,t,R(n));return r?.[o]??null},ve=(e,t,n,o,r)=>{const l=ye(e,t,n,o);if(!l)throw new Error(`${r}: nothing at ${n}[${o}]`);return l};function we(e,t){const{selection:n}=e;return{...e.ui,itemSelector:r(e.data,t,n),selectedSlot:n&&"slot"===n.kind?{parentId:n.parentId,slot:n.slot}:null}}function be(e,t,n){return n?"node"===n.kind?$(e,t,n.id)?n:null:n.parentId===P?j(e,t,n)?n:null:$(e,t,n.parentId)&&j(e,t,n)?n:null:null}function ke(e,t,n,o=!1){const{itemSelector:r,selectedSlot:i,...s}=n;let a=e.selection;var c;return"itemSelector"in n&&(a=l(e.data,t,r??null)),"selectedSlot"in n&&(i?a=(c=i)?{kind:"slot",parentId:c.parentId,slot:c.slot}:null:"slot"===a?.kind&&(a=null)),{...e,selection:a,ui:o?s:{...e.ui,...s}}}function Se(e,t,n){const o=xe(e,t,n);if(o===e)return e;const r=be(o.data,n,o.selection);return r===o.selection?o:{...o,selection:r}}function xe(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 ke(e,n,"function"==typeof t.ui?t.ui(we(e,n)):t.ui);case"set":{const r={data:o,ui:we(e,n)},l="function"==typeof t.state?t.state(r):t.state;let i=l.data?{...e,data:l.data}:e;return l.ui&&(i=ke(i,n,l.ui,!0)),i}case"insert":{const r={...R(t.destinationZone),index:t.destinationIndex},l=V(n,t.componentType,{},t.id?{id:t.id}:{});return{...e,data:K(o,n,r,l)}}case"replace":{const r=ve(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:B(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=ve(o,n,t.sourceZone,t.sourceIndex,"duplicate"),l=N(o,n,r.props.id),i=ye(l,n,t.sourceZone,t.sourceIndex+1);return{...e,data:l,selection:i?{kind:"node",id:i.props.id}:e.selection}}case"reorder":return xe(e,{...t,type:"move",sourceZone:t.destinationZone},n);case"move":{if(t.sourceZone===t.destinationZone&&t.sourceIndex===t.destinationIndex)return e;const r=ye(o,n,t.sourceZone,t.sourceIndex);if(!r)return e;const l={...R(t.destinationZone),index:t.destinationIndex};return{...e,data:L(o,n,r.props.id,l)}}case"remove":{const r=ve(o,n,t.zone,t.index,"remove");return{...e,data:z(o,n,r.props.id)}}default:return e}}var Ce={drag:!0,duplicate:!0,delete:!0,edit:!0,insert:!0},Ie={leftSideBarVisible:!0,rightSideBarVisible:!0,arrayState:{},componentList:{},isDragging:!1,previewMode:"edit",viewports:{current:{width:360,height:"auto"},options:[],controlsVisible:!0},field:{focus:null}},Ee=0,Ae=()=>`history-${Ee+=1}`;function Me(e){let t=e.config;const n=e.now??(()=>Date.now()),o=e.historyCoalesceMs??250;let i=e.permissions??{};const s=T(e.data,t);let a=s,c={data:s,selection:null,ui:{...Ie}};if(e.ui){const{itemSelector:n,selectedSlot:o,...r}=e.ui;c={data:s,selection:o?{kind:"slot",...o}:l(s,t,n??null),ui:{...Ie,...r}}}let u=[{core:c,at:-1/0,sealed:!0,id:Ae()}],d=0;const p=e=>{const t=u[d],r=n();!e&&d===u.length-1&&d>0&&!t.sealed&&r-t.at<o?u=[...u.slice(0,d),{...t,core:c,at:r}]:(u=[...u.slice(0,d+1),{core:c,at:r,sealed:e,id:Ae()}],d=u.length-1)},f=/* @__PURE__ */new Set;let h=null,m=null,g=0,y=null,v=!1;const w=()=>{for(const e of[...f])e()},b=()=>{u=[...u.slice(0,d),{...u[d],core:c},...u.slice(d+1)]},k=(t,n)=>{g>0?v=v||n:(n?p(!1):c!==t&&b(),c.data!==t.data&&e.onChange?.(c.data),c!==t&&w())},S=e=>{const n=c;if(c=Se(c,e,t),c===n)return;const o=e.recordHistory??ge(e);k(n,o&&c.data!==n.data)},x=t=>{0===g&&(y=c,v=!1),g+=1;try{t()}catch(e){throw g-=1,0===g&&y&&(c=y,y=null),e}if(g-=1,g>0||!y)return;const n=y;y=null,v&&c.data!==n.data?p(!0):c!==n&&b(),c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},C=e=>{const n=c,o=be(c.data,t,e);var r,l;(r=o,l=c.selection,r===l||r&&l&&r.kind===l.kind&&("node"===r.kind&&"node"===l.kind?r.id===l.id:"slot"===r.kind&&"slot"===l.kind&&r.parentId===l.parentId&&r.slot===l.slot))||(c={...c,selection:o},k(n,!1))},I=t=>{const n=c;d=t,c=u[d].core,c.data!==n.data&&e.onChange?.(c.data),c!==n&&w()},E=()=>(e={})=>{const n=e.root?t.root?.permissions:t.components[e.item?.type??e.type??""]?.permissions;return{...Ce,...i,...n}};let A=E();const M=F(),D={resolveCache:M,async resolveAll({trigger:e="load",metadata:n}={}){const o=c.data,r={type:"root",props:{...o.root.props??{}}},l=[...o.content,...Object.values(o.zones??{}).flat()],[i,...s]=await Promise.all([q(r,t,{cache:M,trigger:e,metadata:n}),...l.map(o=>q(o,t,{cache:M,trigger:e,metadata:n}))]);x(()=>{const n=c;let r=c.data;s.forEach((e,n)=>{if(!e.didChange)return;const i=l[n].props.id,s=$(r,t,i)?.node;s&&s===$(o,t,i)?.node&&(r=B(r,t,i,e.node))}),i.didChange&&r.root===o.root&&(r={...r,root:{...r.root,props:i.node.props,readOnly:i.node.readOnly??r.root.readOnly}}),r!==c.data&&("load"===e&&c.data===a&&(a=r),c={...c,data:r,selection:be(r,t,c.selection)},k(n,!1))})},async resolveNode(e,{trigger:n="replace",metadata:o}={}){const r=$(c.data,t,e)?.node;if(!r)return!1;const l=await q(r,t,{cache:M,trigger:n,metadata:o});if(!l.didChange)return!1;let i=!1;return x(()=>{const n=c;if($(c.data,t,e)?.node!==r)return;const o=B(c.data,t,e,l.node);o!==c.data&&(c={...c,data:o,selection:be(o,t,c.selection)},k(n,!1),i=!0)}),i},get config(){return t},get loaded(){return a},getState(){if(h&&m===c)return h;const e=c,n={data:e.data,ui:we(e,t)},o="node"===e.selection?.kind?$(e.data,t,e.selection.id)?.node??null:null;return h={appState:n,selection:e.selection,selectedItem:o,config:t,dispatch:S,history:{back:()=>D.undo(),forward:()=>D.redo(),hasPast:d>0,hasFuture:d<u.length-1,histories:u.map(e=>({id:e.id,state:{data:e.core.data,ui:we(e.core,t)}})),index:d,setHistoryIndex:e=>{e>=0&&e<u.length&&e!==d&&I(e)}},getPermissions:A,getItemById:n=>$(e.data,t,n)?.node,getItemBySelector:n=>function(e,t,n){const[o,r]=(n.zone??"root:default-zone").split(/:(.*)/s);return j(e,t,{parentId:o,slot:r})?.[n.index]}(e.data,t,n),getSelectorForId:n=>{const o=r(e.data,t,{kind:"node",id:n});return o?{index:o.index,zone:o.zone??"root:default-zone"}:void 0}},m=e,h},subscribe:e=>(f.add(e),()=>{f.delete(e)}),dispatch:S,batch:x,group:()=>{const e=d,t=u[e].id;let n=!0;return{close:()=>{if(!n)return;if(n=!1,u[e]?.id!==t)return;if(d<=e+1)return void(d===e+1&&(u=[...u.slice(0,d),{...u[d],sealed:!0},...u.slice(d+1)]));const o=u[d];u=[...u.slice(0,e+1),{...o,sealed:!0},...u.slice(d+1)],d=e+1}}},select:e=>C(e?{kind:"node",id:e}:null),selectSlot:e=>C(e?{kind:"slot",parentId:e.parentId,slot:e.slot}:null),run(e){x(()=>{const n=c,o=void 0===e.select?c.selection:e.select;c={...c,data:e.data,selection:be(e.data,t,o)},k(n,e.data!==n.data)})},load(e,n={}){const o=c,r=T(e,t);c={...c,data:r,selection:be(r,t,n.selection??c.selection)},a=r,n.keepHistory||(u=[{core:c,at:-1/0,sealed:!0,id:Ae()}],d=0),c!==o&&w()},undo(){d>0&&I(d-1)},redo(){d<u.length-1&&I(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,i)||(i=e,A=E(),h=null,w())},setConfig(e){e!==t&&(t=e,A=E(),h=null,w())}};return D}function De(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&&C(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 Oe=G(null),$e=G(!0);function Pe({easel:e,hotkeys:t=!0,resolveOnMount:n=!0,children:o}){return J(()=>{n&&e.resolveAll()},[e,n]),J(()=>{if(t&&"undefined"!=typeof document)return De(document,e)},[e,t]),/* @__PURE__ */ae(Oe.Provider,{value:e,children:/* @__PURE__ */ae($e.Provider,{value:t,children:o})})}function je(){const e=_(Oe);if(!e)throw new Error("useEasel: no <EaselProvider> above this component");return e}function ze(e){const t=je(),n=ee({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 l=e(o);return r.has&&Object.is(r.value,l)?(n.current={view:o,selector:e,value:r.value,has:!0},r.value):(n.current={view:o,selector:e,value:l,has:!0},l)};return te(t.subscribe,o,o)}function Re(){return function(e){return ze(e)}}var Le=["--es-accent","--es-accent-tint","--es-accent-tint-strong","--es-accent-line","--es-accent-text","--es-accent-ring","--es-accent-shadow","--es-on-accent","--status-success-solid","--elevation-panel"],Ne="host-tokens";function Be(e,t){const n=function(e){const t=e.ownerDocument.defaultView;if(!t)return"";const n=t.getComputedStyle(e),o=[];for(const e of Le){const t=n.getPropertyValue(e).trim();t&&o.push(`${e}: ${t};`)}return o.length?`:root { ${o.join(" ")} }`:""}(e);n?I(t,Ne,n):E(t,Ne)}var Ve="data-easel-block",Ke="data-easel-dropzone",Te={},Fe="data-es-mirror",Ze="undefined"==typeof window?J:se;function He(e,t,n){for(const e of Array.from(t.head.querySelectorAll(`[${Fe}]`)))e.remove();for(const o of Array.from(e.head.querySelectorAll('style, link[rel="stylesheet"]'))){const e=o.cloneNode(!0);e.setAttribute(Fe,""),n&&e.setAttribute("nonce",n),t.head.appendChild(e)}}function We({children:e,id:t="preview-frame",title:o,className:r,style:l,mirrorStyles:i=!0,onDocument:s,height:a="auto",nonce:c}){const u=w("canvas",n),d=ee(null),[p,f]=ne(null);return Ze(()=>{const e=d.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]),Ze(()=>{let e=d.current?.contentDocument;if(!e)return;"CSS1Compat"!==e.compatMode&&(e.open(),e.write("<!DOCTYPE html><html><head></head><body></body></html>"),e.close(),e=d.current?.contentDocument??e),e.body||e.documentElement.appendChild(e.createElement("body")),e.body.style.margin="0";const t=e.createElement("div");t.setAttribute("data-easel-entry",""),t.id="frame-root","fill"===a&&t.classList.add("es-frame-fill"),e.body.appendChild(t),S(e,c),f(t),s?.(e);let n=null;const o=d.current?.ownerDocument;if(i&&o){He(o,e,c);const t=o.defaultView;t&&"MutationObserver"in t&&(n=new t.MutationObserver(()=>He(o,e,c)),n.observe(o.head,{childList:!0,subtree:!0,characterData:!0}))}let r=null;const l=d.current;if(l&&o){Be(l,e);const t=o.defaultView;if(t&&"MutationObserver"in t){r=new t.MutationObserver(()=>Be(l,e)),r.observe(o.head,{childList:!0,subtree:!0,characterData:!0});const n={attributes:!0,attributeFilter:["class","style","data-theme"]};for(const e of[o.documentElement,o.body,l.closest(".es-editor")])e&&r.observe(e,n)}}return()=>{n?.disconnect(),r?.disconnect(),t.remove(),f(null),s?.(null)}},[]),/* @__PURE__ */ae("iframe",{ref:d,id:t,title:o??u.frame,className:["es-canvas-frame","fill"===a?"is-fill":"",r??""].filter(Boolean).join(" "),style:l,children:p?de(e,p):null})}var qe=G(null),Qe=G(Te),Ye=[];function Ue({parentId:e,slot:t,className:n,style:o,minEmptyHeight:r=128,minEmptyWidth:l=120}){const i=je(),s=ze(n=>j(n.appState.data,i.config,{parentId:e,slot:t})??Ye),a=ze(t=>"node"===t.selection?.kind&&t.selection.id===e&&e!==P),c=ze(n=>"slot"===n.selection?.kind&&n.selection.parentId===e&&n.selection.slot===t),u=_(qe),d=["es-zone"];return s.length&&d.push("has-children"),e===P&&d.push("is-root"),(a||c)&&d.push("is-area-selected"),null!==u&&u===e&&e!==P&&d.push("is-hovering-area"),n&&d.push(n),/* @__PURE__ */ae("div",{className:d.join(" "),[Ke]:`${e}:${t}`,style:{...o,"--min-empty-height":`${r}px`,"--min-empty-width":`${l}px`},children:s.map(e=>/* @__PURE__ */ae(ot,{node:e},e.props.id))})}function Xe(e,t,n,o){const r=ie(()=>{const n={};for(const o of Q(Y(e)))n[o]=Object.assign(function(e={}){/* @__PURE__ */
2
- return ae(Ue,{parentId:t,slot:o,...e})},{blockCount:0});return n},[e,t]);for(const e of Object.keys(r))r[e].blockCount=U(n[e],o);return r}function Ge(e){return ie(()=>function({zone:t,...n}){/* @__PURE__ */
3
- return ae(Ue,{parentId:e,slot:t,...n})},[e])}var Je=["top","bottom","zIndex"];function _e(e,t,n){e.style[t]!==n&&(e.style[t]=n)}function et(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));_e(e,"position",t?"sticky":"relative");for(const n of Je)_e(e,n,t?.[n]??"");return!!t}var tt="data-es-canvas-relative";function nt(e){e.hasAttribute(tt)&&("relative"===e.style.position&&(e.style.position=""),e.removeAttribute(tt));const t=e.ownerDocument.defaultView?.getComputedStyle(e).position;return t&&"static"!==t?"sticky"===t:(e.style.position||(e.style.position="relative",e.setAttribute(tt,"")),!1)}function ot({node:e}){const t=je().config,n=t.components[e.type],o=e.props.id,r=ee(null),l=function(e,t){return ie(()=>n=>{const o=t.current;o&&o!==n&&(o.removeAttribute(Ve),o.removeAttribute("data-easel-dnd")),t.current=n,n&&(n.setAttribute(Ve,e),n.setAttribute("data-easel-dnd",e),nt(n))},[e,t])}(o,r),i=ee(null),s=!!n?.inline;!function(e,t){const n=ee(!1),o=ee(()=>{});o.current=()=>{const o=e(),l=n.current;n.current=!!o&&t(o),l!==n.current&&r.current()};const r=ee(()=>{});Ze(()=>o.current()),Ze(()=>{const t=e(),l=t?.ownerDocument.defaultView;if(!t||!l)return;const i=()=>o.current();l.addEventListener("resize",i);const s=l.ResizeObserver,a=s?new s(i):null;a?.observe(t);let c=null;return r.current=()=>{c?.disconnect(),c=null;const e=t.ownerDocument.documentElement;n.current&&e&&l.MutationObserver&&(c=new l.MutationObserver(i),c.observe(e,{attributes:!0}))},r.current(),()=>{l.removeEventListener("resize",i),a?.disconnect(),c?.disconnect(),r.current=()=>{}}},[])}(()=>s?r.current:i.current,e=>s?nt(e):et(e));const a=_(Qe),c=Xe(n,o,e.props,t.components),u=Ge(o);if(!n?.render)return null;const d=n.render,p={...X(n),...e.props,...c},f={renderDropZone:u,isEditing:!0,dragRef:n.inline?l:null,metadata:{...a,...n.metadata}};return n.inline?/* @__PURE__ */ae(d,{...p,editor:f,editMode:!0}):
4
- /* @__PURE__ */ae("div",{ref:i,[Ve]:o,"data-easel-dnd":o,style:{position:"relative"},children:/* @__PURE__ */ae(d,{...p,editor:f,editMode:!0})})}function rt({metadata:e}){const t=ze(e=>e.config),n=ze(e=>e.appState.data.root).props??{},o=t.root?.render,r=Xe(t.root,P,n,t.components),l=Ge(P),i=/* @__PURE__ */ae(Ue,{parentId:P,slot:W}),s=o?/* @__PURE__ */ae(o,{id:"page-root",...n,...r,editor:{renderDropZone:l,isEditing:!0,dragRef:null,metadata:e??{}},editMode:!0,children:i}):i;/* @__PURE__ */
5
- return ae(Qe.Provider,{value:e??Te,children:s})}var lt=G(void 0),it=G(void 0);function st(e,t,n,o){const r=$(e,t,n);return!!r&&(Z(r.node,t).length>0||!1===o.whole)}var at=G(void 0),ct="data-es-chrome",ut=G(void 0);function dt(e){const t=e?.closest?.(`[${ct}]`)??null,n=t?.getAttribute(ct);return t&&n?{id:n,element:t}:null}function pt({element:e,clip:t=!1}){const n=ee(null),o=mt(n,e?()=>e:null,e),r=_(St);/* @__PURE__ */
6
- return ae("div",{ref:n,"aria-hidden":"true",className:"es-canvas-outline is-hover is-hover-part",style:o?{position:"absolute",top:o.top,left:o.left,width:o.width,height:o.height,clipPath:t?kt(o,r):void 0}:{display:"none"}})}var ft={"--es-words-clear":`${A}px`};function ht({element:e,words:t=!1,clip:n=!1}){const o=ee(null),r=mt(o,e?()=>e:null,e),l=_(St);/* @__PURE__ */
7
- return ae("div",{ref:o,"aria-hidden":"true",className:"es-canvas-outline is-selected is-selected-part"+(t?" is-words":""),style:r?{position:"absolute",top:r.top,left:r.left,width:r.width,height:r.height,clipPath:n?kt(r,l):void 0,...ft}:{display:"none"}})}function mt(e,t,n){return yt(e,t?e=>{const n=t(e);return n?[n]:[]}:null,n)[0]??null}var gt=[];function yt(e,t,n){const[o,r]=ne(gt),l=ee(t);return l.current=t,Ze(()=>{const t=e.current?.ownerDocument,n=t?.defaultView;if(!t||!n||!l.current)return void r(gt);let o=0;const i=()=>{o=0;const n=e.current?.parentElement??null,i=(l.current?l.current(t):[]).map(e=>function(e,t){if(!e||!t)return null;const n=D(e),o=t.getBoundingClientRect();return{top:n.top-o.top,left:n.left-o.left,width:n.width,height:n.height}}(e,n)).filter(e=>null!==e);r(e=>{return(t=e)===(n=i)||t.length===n.length&&t.every((e,t)=>function(e,t){return e===t||!!e&&!!t&&e.top===t.top&&e.left===t.left&&e.width===t.width&&e.height===t.height}(e,n[t]))?e:i.length?i:gt;var t,n})},s=()=>{o||(o=(n.requestAnimationFrame??(e=>n.setTimeout(e,16)))(i))};i();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),n.addEventListener("scroll",s,{capture:!0,passive:!0}),()=>{a?.disconnect(),c?.disconnect(),n.removeEventListener("resize",s),n.removeEventListener("scroll",s,{capture:!0}),o&&(n.cancelAnimationFrame??n.clearTimeout)(o)}},[n]),o}var vt=A+2,wt=vt+2,bt=1;function kt(e,t){const n=e.left+e.width,o=e.top+e.height,r=t.map(t=>{const r=t.left+t.width,l=t.top+t.height;if(!(r>e.left-vt&&t.left<n+vt&&l>e.top-vt&&t.top<o+vt))return null;const i=Math.max(t.left<=e.left&&r>e.left?Math.min(t.left,e.left-bt):t.left,e.left-wt)-e.left,s=Math.max(t.top<=e.top&&l>e.top?Math.min(t.top,e.top-bt):t.top,e.top-wt)-e.top,a=Math.min(r>=n&&t.left<n?Math.max(r,n+bt):r,n+wt)-e.left,c=Math.min(l>=o&&t.top<o?Math.max(l,o+bt):l,o+wt)-e.top;return a>i&&c>s?{x:i,y:s,w:a-i,h:c-s}:null}).filter(e=>null!==e);if(!r.length)return;const l=function(e){if(e.length<2)return e;const t=Array.from(new Set(e.flatMap(e=>[e.x,e.x+e.w]))).sort((e,t)=>e-t),n=Array.from(new Set(e.flatMap(e=>[e.y,e.y+e.h]))).sort((e,t)=>e-t),o=[];for(let r=0;r<n.length-1;r++){const l=o=>e.some(e=>e.x<=t[o]&&t[o+1]<=e.x+e.w&&e.y<=n[r]&&n[r+1]<=e.y+e.h);for(let e=0;e<t.length-1;e++){if(!l(e))continue;let i=e+1;for(;i<t.length-1&&l(i);)i++;const s={x:t[e],y:n[r],w:t[i]-t[e],h:n[r+1]-n[r]},a=o.find(e=>e.x===s.x&&e.w===s.w&&e.y+e.h===s.y);a?a.h+=s.h:o.push(s),e=i-1}}return o}(r);return`path(evenodd, "${`M${-wt} ${-wt}h${e.width+2*wt}v${e.height+2*wt}h${-(e.width+2*wt)}z`}${l.map(e=>`M${e.x} ${e.y}h${e.w}v${e.h}h${-e.w}z`).join("")}")`}var St=G([]);function xt({children:e}){const t=ee(null),n=_(ut),o=yt(t,n?e=>Array.from(e.querySelectorAll(`[${ct}]`)):null,n?1:0);/* @__PURE__ */
8
- return ce("div",{className:"es-canvas-outlines",style:{position:"absolute",top:0,left:0,pointerEvents:"none"},children:[
9
- /* @__PURE__ */ae("span",{ref:t,hidden:!0,"aria-hidden":"true"}),
10
- /* @__PURE__ */ae(St.Provider,{value:o,children:e})]})}function Ct({id:e,kind:t,overlay:n}){const o=ee(null),r=_(it),l=null!==e&&!0===r?.(e),i=yt(o,e?t=>O(t,`[${Ve}="${t.defaultView?.CSS?.escape?t.defaultView.CSS.escape(e):e}"]`):null,e),[s,...a]=i,c=_(St),u=`es-canvas-outline is-${t}${l?" is-shared":""}`,d=e=>({position:"absolute",top:e.top,left:e.left,width:e.width,height:e.height,clipPath:kt(e,c)}),p=/* @__PURE__ */ce(ue,{children:[
11
- /* @__PURE__ */ae("div",{ref:o,"aria-hidden":"true",className:u,style:s?d(s):{display:"none"}}),a.map((e,t)=>/* @__PURE__ */ae("div",{"aria-hidden":"true",className:u,style:d(e)},t))]});return n&&e?/* @__PURE__ */ae(n,{componentId:e,kind:t,children:p}):p}function It(e,n){return Array.from(e.querySelectorAll(`[${Ve}]`)).find(o=>o.getAttribute(Ve)===n&&t(o)?.wrapper===e)??null}function Et(e,t,n){const o=g(e,n),r=o.text.length,l=e.ownerDocument;if(!t)return[r,r];let i=null;const s=l.caretPositionFromPoint?.(t.x,t.y);if(s&&e.contains(s.offsetNode))i=o.at(s.offsetNode,s.offset);else{const n=l.caretRangeFromPoint?.(t.x,t.y);n&&e.contains(n.startContainer)&&(i=o.at(n.startContainer,n.startOffset))}if(null===i)return[r,r];const a=o.text;let c=i,u=i;for(;c>0&&!/\s/.test(a[c-1]);)c-=1;for(;u<a.length&&!/\s/.test(a[u]);)u+=1;return[c,u]}function At(e,t){const n=t?.closest?.(`[${Ve}]`)?.getAttribute(Ve)??null;return!1===e.getPermissions(n?{item:e.getItemById(n)}:{root:!0}).edit}function Mt({s:e,element:t,toolbar:n,label:o,keys:r}){const l=w("copy",v),i=ze(e=>At(e,t())),s=e.pressed(),a=new Set(n.offered),c=n.colors&&n.colors.length>0?n.colors:null,m=ee(null),[g,y]=ne(!1),[b,k]=ne(null),S=g||null!==b,x=()=>{e.hold(),y(!1),k({href:e.pressed().href})},C=()=>{y(!1),k(null),e.resume()};se(()=>{r.current={escape:()=>!!S&&(C(),!0),link:()=>!!a.has("link")&&(x(),!0)}}),se(()=>()=>{r.current=null},[r]);const I=ee(C);I.current=C,J(()=>{if(g)return pe(e=>{const t=m.current;return!!("Escape"===e.key&&t&&e.target instanceof Node&&t.contains(e.target))&&(I.current(),!0)},()=>m.current?.querySelector(".es-copy-colors"))},[g]),J(()=>{const n=m.current;if(!S||!n)return;const o=/* @__PURE__ */new Set([n.ownerDocument]),r=t();r&&o.add(r.ownerDocument);const l=o=>{const r=o.target;if(r&&n.contains(r))return;y(!1),k(null);const l=t();r&&l&&l.contains(r)?e.release():e.stop("outside")};for(const e of o)e.addEventListener("pointerdown",l,!0);return()=>{for(const e of o)e.removeEventListener("pointerdown",l,!0)}},[S,e,t]),se(()=>{const e=m.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,l=r&&r.rangeCount>0&&o.contains(r.getRangeAt(0).startContainer)?r.getRangeAt(0):null,i=(l?u(l,o):null)??(()=>{const e=o.getBoundingClientRect();return{left:e.left,top:e.top,right:e.right,bottom:e.bottom}})(),s=o.ownerDocument.defaultView?.frameElement,a=s?M(s,{left:i.left,top:i.top,width:i.right-i.left,height:i.bottom-i.top}):{left:i.left,top:i.top,width:i.right-i.left,height:i.bottom-i.top},c=o.getBoundingClientRect(),f=s?M(s,{left:c.left,top:c.top,width:c.width,height:c.height}):{left:c.left,top:c.top,width:c.width,height:c.height},h=(e.closest("[data-floating-bar]")??e).getBoundingClientRect(),g={left:a.left,right:a.left+a.width,top:Math.min(a.top,f.top-6,h.top),bottom:Math.max(a.top+a.height,f.top+f.height+6,h.bottom)},y=e.ownerDocument.documentElement,v=(s??o.closest(".es-canvas")??o).getBoundingClientRect(),w={left:Math.max(0,v.left),top:Math.max(0,v.top),right:Math.min(y.clientWidth||v.right,v.right),bottom:Math.min(y.clientHeight||v.bottom,v.bottom)};if(w.right<=w.left||w.bottom<=w.top||0===n.offsetWidth)return;const b=d({anchor:g,size:{width:n.offsetWidth,height:n.offsetHeight},within:{left:v.left,top:v.top,right:v.right,bottom:v.bottom},clip:w,parent:p(n)});n.style.top=`${b.top}px`,n.style.left=`${b.left}px`,n.style.setProperty("--es-pop-point",`${b.point}px`),n.dataset.side=b.above?"above":"below"});const E=c?{run:f(s.color,c),open:g,onToggle:()=>{k(null),g?C():(e.hold(),y(!0))}}:void 0;/* @__PURE__ */
12
- return ae(fe,{anchor:()=>{const e=t();if(!e)return null;const n=e.getBoundingClientRect(),o=e.ownerDocument.defaultView?.frameElement,r=o?M(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__ */ae("div",{ref:m,children:/* @__PURE__ */ae(he,{layout:"row",offered:a,pressed:s.marks,onMark:t=>{"link"===t?x():e.press(t)},color:E,linkOpen:null!==b,list:{pressed:s.list,onList:t=>e.list(t)},clear:s.clearable?{onClear:()=>e.clear()}:void 0,alignment:n.alignment,letterCase:n.letterCase,last:n.lastTool?.({className:"rosh-tb-btn",disabled:i,selected:s.selected,keepCaret:t=>{t.preventDefault(),e.hold()},insert:t=>e.insert(t),style:s.style,applyStyle:t=>e.textStyle(t)}),windows:/* @__PURE__ */ce(ue,{children:[g&&c?/* @__PURE__ */ae(h,{colors:c,current:s.color,words:l.colors??v.colors,onPick:t=>e.color(t)}):null,b?
13
- /* @__PURE__ */ae(me,{className:"es-copy-link es-copy-pop",value:b.href??"",onApply:t=>{k(null),e.link(t)},onRemove:null!==b.href?()=>{k(null),e.link(null)}:void 0,onCancel:C}):null]})})})})}function Dt({element:e,which:t}){const n=ee(null),o=mt(n,()=>e(),t),r=_(St);/* @__PURE__ */
14
- return ae("div",{ref:n,"aria-hidden":"true",className:"es-canvas-outline is-typing",style:o?{position:"absolute",top:o.top,left:o.left,width:o.width,height:o.height,clipPath:kt(o,r),...ft}:{display:"none"}})}function Ot({frame:o=!0,className:r,style:l,metadata:i,mirrorStyles:u,onDocument:d,height:p,title:f,nonce:h,hotkeys:v,frameWrapper:S,overlay:C,children:I,typing:E,passThrough:A}){const M=je(),D=_(lt),O=A??D,P=_($e),j=w("canvas",n),z=v??P,[R,L]=ne(void 0),N=ze(e=>"node"===e.selection?.kind?e.selection.id:null),[B,V]=ne(null),[K,T]=ne(null),F=_(at),H=_(ut),[W,q]=ne(null),[,Q]=oe(e=>e+1,0),[,Y]=oe(e=>e+1,0),U=e=>{F?.select(e),Y()},[X,G]=ne(null),te=ee(null),re=ze(e=>!!X&&At(e,X()));J(()=>{re&&te.current?.s.stop("stop")},[re]);const le=ee(null),[,ie]=ne(0),se=ee(E);se.current=E;const ue=ee(null),de=ee(null),pe=()=>{if(!N)return null;const e=se.current?.atSelection?.()?.element()??null;if(!e)return null;const t=de.current?.ownerDocument;if(F){const n=F.selected()&&t?F.selectedPart?.(t)??null:null;return n&&x(n.element,e)?n.element:null}const n=$(M.getState().appState.data,M.config,N);return n&&0===Z(n.node,M.config).length?e:null},fe=ze(e=>e.appState.data),he=F?.selected()??null;J(()=>{const e=de.current?.ownerDocument,t=e?.defaultView?.CustomEvent;if(!e||!t)return;const n=N&&!X&&se.current?.atSelection?.()?N:null,o=n?pe():null;e.dispatchEvent(new t(b,{detail:o?{id:n,words:o}:{id:n}}))},[N,X,fe,he]);const me=e=>{const t=de.current?.ownerDocument,n=t?.defaultView?.CustomEvent;t&&n&&t.dispatchEvent(new n(k,{detail:{typing:e}}))},ge=(e,t)=>{te.current?.s.stop("stop");const n=e.element();if(!n)return!1;const o=e.element,r=()=>At(M.getState(),o());if(r())return!1;const l=ye(e,n),i=l?.write??e.write,s=M.group(),a=m({element:o,value:l?.value??e.value,rules:e.rules,multiline:e.multiline,skip:e.skip,caret:Et(n,t,e.skip),editable:()=>!r(),write:e=>{r()?queueMicrotask(()=>te.current?.s.stop("stop")):i(e)},remount:e.remount,onSelect:()=>ie(e=>e+1),onEscape:()=>ue.current?.escape()??!1,onLinkKey:()=>ue.current?.link()??!1,end:e=>{s.close(),te.current?.element===o&&(te.current=null),G(null),me(!1),se.current?.onChange?.({typing:!1,why:e})}});if(!a)return s.close(),!1;const c=n.closest?.(`[${Ve}]`)?.getAttribute(Ve);return c&&M.select(c),te.current={s:a,element:o,target:e},G(()=>o),V(null),me(!0),se.current?.onChange?.({typing:!0,element:n}),!0},ye=(e,n)=>{const o=e.key;if(!o||!se.current?.onCopyText)return null;const r=t(n),l=n.closest?.(`[${Ve}]`),i=l?.getAttribute(Ve);if(!r||!i||!r.wrapper.contains(l))return null;const{copy:s}=r,a=se.current.copyValue?.({...s,nodeId:i,key:o}),c=g(n,e.skip).text,u=a??(y(e.value,e.rules).text===c?e.value:c),d={ownerId:s.ownerId,slot:s.slot,index:s.index,...s.outer?{outer:s.outer}:{},nodeId:i,key:o};return{value:u,write:t=>{const n=se.current?.onCopyText;n&&!1!==n({...d,text:t})||e.write(t)}}};J(()=>()=>te.current?.s.stop("stop"),[]);const ve=e=>{const t=te.current?.element();return Boolean(t&&t.contains(e))},we=(e,t)=>st(M.getState().appState.data,M.config,e,t),be=e=>{const t=e.closest?.(`[${Ve}]`)?.getAttribute(Ve);if(!t)return;const n=M.getState(),o="node"===n.selection?.kind?n.selection.id:null,r=F?.partAt(e,t)??null;if(r){const e=a(n.appState.data,M.config,t,r.id,o,F?.selected()??null,O);if(e)return{node:e.node,part:e.part?r:null}}return{node:c(n.appState.data,M.config,t,o,O)??t,part:null}},ke=e=>{if("Enter"!==e.key||e.defaultPrevented||e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return;if(te.current)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select, button"))return;const n=Se(),o=void 0===n?se.current?.atSelection?.():n;o&&ge(o,null)&&e.preventDefault()},Se=()=>{const t=se.current,n=le.current;if(!t?.onCopyText||!n?.copy||n.node!==N)return;const o=de.current,r=o?e(o,n.copy):null,l=r?It(r,n.node):null;if(!l)return null;const i=t.atSelection?.()??null,s=i?.element()??null;if(!i||!s)return null;if(l.contains(s))return i;const a=function(e,t){const n=e.closest(`[${Ve}]`);if(!n||n.getAttribute(Ve)!==t.getAttribute(Ve))return null;const o=[];for(let t=e;t!==n;t=t.parentElement)o.unshift(Array.prototype.indexOf.call(t.parentElement.children,t));let r=t;for(const e of o)r=r?.children[e];return r&&r.tagName===e.tagName?r:null}(s,l);return a?t.at(a):null},xe=(e,n)=>{if(!se.current?.onCopyText)return null;const o=t(e);return o&&It(o.wrapper,n)?o.copy:null},Ce=de.current?.ownerDocument??null,Ie=F?.selected()&&Ce&&N?F.selectedPart?.(Ce)??null:null,Ee=Ie&&N&&we(N,Ie)?Ie.element:null,Ae=H?.selected()??null,Me=Ae&&Ce?Array.from(Ce.querySelectorAll(`[${ct}]`)).find(e=>e.getAttribute(ct)===Ae)??null:null,Oe=X?null:pe(),Pe=/* @__PURE__ */ce("div",{ref:de,className:"es-canvas-content",style:{position:"relative"},onClick:e=>{const t=e.target;if(t.closest?.("a[href]")&&e.preventDefault(),te.current){if(ve(t))return;te.current.s.stop("outside")}const n=t.ownerDocument?.getSelection?.();n&&n.rangeCount>0&&n.isCollapsed&&n.removeAllRanges();const o=H?dt(t):null;if(H&&o)return H.select(o.id),q(null),void Q();const r=be(t);if(le.current=void 0!==r?{node:r.node,copy:xe(t,r.node)}:null,void 0!==r)return M.select(r.node),void(F&&(r.part?.id??null)!==F.selected()&&U(r.part?.id??null));t.hasAttribute?.(Ke)||(M.select(null),F?.selected()&&U(null))},onDoubleClick:e=>{const t=se.current;if(!t||ve(e.target))return;const n=t.at(e.target);n&&ge(n,{x:e.clientX,y:e.clientY})&&e.preventDefault()},onKeyDown:e=>ke(e),onMouseOver:e=>{if(te.current)return;const t=H?dt(e.target):null;if(t?.element!==W?.element&&q(t),t)return null!==B&&V(null),void(null!==K&&T(null));const n=be(e.target),o=!!n?.part&&we(n.node,n.part),r=n?.part&&o&&n.part.id!==F?.selected()?n.part:null,l=!n||n.part&&o?null:n.node;l!==B&&V(l),r?.id===K?.id&&r?.element===K?.element||T(r)},onMouseLeave:()=>{V(null),T(null),q(null)},children:[
15
- /* @__PURE__ */ae(qe.Provider,{value:B,children:/* @__PURE__ */ae(rt,{metadata:i})}),
16
- /* @__PURE__ */ce(xt,{children:[
17
- /* @__PURE__ */ae(Ct,{id:!X&&B&&B!==N?B:null,kind:"hover",overlay:C}),F?/* @__PURE__ */ae(pt,{clip:!0,element:X||!K||K.id===F.selected()?null:K.element}):null,Oe||Ee?/* @__PURE__ */ae(ht,{clip:!0,element:X?null:Oe??Ee,words:null!==Oe}):null,H?/* @__PURE__ */ae(pt,{element:X||!W||W.element===Me?null:W.element}):null,Me?/* @__PURE__ */ae(ht,{element:X?null:Me}):null,
18
- /* @__PURE__ */ae(Ct,{id:X||Ee||Oe||Me?null:N,kind:"selected",overlay:C}),X?/* @__PURE__ */ae(Dt,{element:()=>{const e=X?.()??null;return e?Ie&&x(Ie.element,e)?Ie.element:e:null},which:Ie?.element??X}):null]}),I]}),Re=S?/* @__PURE__ */ae(S,{document:R,children:Pe}):Pe;J(()=>{if(R&&z)return De(R,M)},[R,z,M]),J(()=>{if(!R)return;const e=e=>{if("Enter"===e.key)return void ke(e);if("Escape"!==e.key||e.defaultPrevented)return;const t=e.target;if(t?.isContentEditable||t?.closest?.("input, textarea, select"))return;const n=M.getState();if("node"!==n.selection?.kind)return;if(F?.selected())return void U(null);const o=s(n.appState.data,M.config,n.selection);"node"===o?.kind&&M.select(o.id)};return R.addEventListener("keydown",e),()=>R.removeEventListener("keydown",e)},[R,M,F]);/* @__PURE__ */
19
- return ce("div",{className:"es-canvas"+(r?` ${r}`:""),style:l,"data-easel-preview":"","data-es-typing":X?"":void 0,children:[X&&te.current?.target.toolbar?/* @__PURE__ */ae(Mt,{s:te.current.s,element:te.current.element,toolbar:te.current.target.toolbar,label:j.textTools,keys:ue}):null,o?/* @__PURE__ */ae(We,{mirrorStyles:u,onDocument:e=>{L(e??void 0),d?.(e)},height:p,title:f,nonce:h,children:Re}):/* @__PURE__ */ae("div",{id:"preview-frame","data-easel-entry":"",children:Re})]})}function $t(e={}){const t=je(),n=ze(e=>e.appState.data);return i({...e,data:n,config:t.config,commit:(e,{select:n})=>t.run({data:e,select:n})})}var Pt=/* @__PURE__ */new WeakMap,jt=[];function zt(e){let t=Pt.get(e);return t||(t={nodes:/* @__PURE__ */new Map,shown:/* @__PURE__ */new Map,listeners:/* @__PURE__ */new Set,lateListeners:/* @__PURE__ */new Set,settled:[]},Pt.set(e,t)),t}function Rt(e,t){const n=e.nodes.get(t),o=n?[...n.running,...n.next]:jt;o.length?e.shown.set(t,o):e.shown.delete(t),e.listeners.forEach(e=>e())}function Lt(e,t,n,o){const r=zt(e),l=r.nodes.get(t);l?l.next=[...l.next,n]:r.nodes.set(t,{running:jt,next:[n]}),Rt(r,t),l||Promise.resolve().then(()=>Nt(r,t,o))}function Nt(e,t,n){const o=e.nodes.get(t);if(!o)return;if(!o.next.length)return e.nodes.delete(t),Rt(e,t),void(e.nodes.size||e.settled.splice(0).forEach(e=>e()));const r=o.next;o.running=r,o.next=jt;let l=!0;const i=()=>{l=!1,clearTimeout(a),o.running=jt,Rt(e,t)};let s=!1;const a=setTimeout(()=>{s=!0,i();try{n.landWithoutAnswer(r)&&(e.lateListeners.forEach(e=>e()),Promise.reject(new Error(`A write to ${t} landed without its resolver's answer after 60000 ms.`)))}catch(e){Promise.reject(e)}Nt(e,t,n)},6e4);n.run(r,{live:()=>l,landing:i}).catch(e=>{if(!s)throw e}).finally(()=>{s||(l&&i(),Nt(e,t,n))})}function Bt(e){const t=zt(e);return t.nodes.size?new Promise(e=>t.settled.push(e)):Promise.resolve()}function Vt(){const e=je(),t=ee([]),n=ee(!1),[o,r]=ne(!1),[,l]=oe(e=>e+1,0);J(()=>{t.current.splice(0).forEach(e=>e())});return{run:re(o=>{n.current||(n.current=!0,r(!0),Bt(e).then(()=>new Promise(e=>{t.current.push(e),l()})).then(()=>{n.current=!1,r(!1),o()}))},[e]),waiting:o}}function Kt(e){const t=Vt(),n=ee(e);return n.current=e,{...e,busy:!0===e.busy||t.waiting,onPress:()=>t.run(()=>n.current.onPress())}}function Tt(e,t){const{lateListeners:n}=zt(e);return n.add(t),()=>{n.delete(t)}}var Ft=e=>"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.prototype;function Zt(e,t,n){if(t===e)return n;if(Array.isArray(e)&&Array.isArray(t)&&Array.isArray(n)){if(e.length!==n.length||e.some((e,t)=>n.includes(e)&&n[t]!==e))return t;const o=e.length===t.length&&1===t.filter((t,n)=>t!==e[n]).length;return t.map((t,r)=>{if(t===e[r])return n[r];const l=Ft(t)?e.indexOf(t):-1;return l>=0?n[l]:o?Zt(e[r],t,n[r]):t})}if(Ft(e)&&Ft(t)&&Ft(n)){const o={...n};for(const n of Object.keys(e))n in t||delete o[n];for(const r of Object.keys(t))o[r]=Zt(e[r],t[r],n[r]);return o}return t}function Ht(e,t){let n=null;for(const o of e){const e="function"==typeof o?o({...t,...n}):o;e&&(n={...n,...e})}return n}function Wt(e,t){if(!e.length)return t;try{return{...t,...Ht(e,t)}}catch{return t}}function qt(){return Gt(ze(e=>e.selectedItem))}function Qt(){const e=_(Yt);try{return function(e){const t=ze(e=>e.selectedItem);return Gt("root"===e?null:t)}(e)}catch{return null}}var Yt=G("selected");function Ut({children:e}){return le(Yt.Provider,{value:"root"},e)}function Xt(){return Gt(null)}function Gt(e){const t=je(),n=ze(e=>e.config),r=t.resolveCache,l=ze(e=>e.appState.data.root),i=e?e.props.id:"root",s=l.props??{},a=ie(()=>e||{type:"root",props:s},[e,s]),c=e?n.components[e.type]:n.root,u=t.getState(),d=e?$(u.appState.data,n,i):null,p=d&&"root"!==d.place.parentId?d.place.parentId:null,f=p?u.getItemById(p)??null:null,{fields:h}=o({id:i,node:a,block:c,parent:f,appState:u.appState}),m=ze(t=>!1===t.getPermissions(e?{item:e}:{root:!0}).edit),g=re(e=>{Lt(t,i,e,{landWithoutAnswer:e=>{const n=t.getState();if("root"===i){const o=n.appState.data.root.props??{},r=Ht(e,o);return!!r&&(t.dispatch({type:"replaceRoot",root:{props:{...o,...r},readOnly:n.appState.data.root.readOnly},recordHistory:!0}),!0)}const o=n.getItemById(i),r=n.getSelectorForId(i);if(!o||!r)return!1;const l=Ht(e,o.props);return!!l&&(t.dispatch({type:"replace",destinationZone:r.zone??"root:default-zone",destinationIndex:r.index,data:{...o,props:{...o.props,...l}}}),!0)},run:async(e,{live:n,landing:o})=>{for(let l=1;;l+=1){const s=t.getState(),a={...r,lastChange:Object.create(r.lastChange)},c=()=>{o(),Object.assign(r.lastChange,a.lastChange)};if("root"!==i){const o=s.getItemById(i);if(!o)return;const r=Ht(e,o.props);if(!r)return;const u={...o,props:{...o.props,...r}},{node:d}=await q(u,t.config,{cache:a,trigger:"replace"});if(!n())return;const p=t.getState(),f=p.getSelectorForId(i);if(!f)return;if(p.getItemById(i)!==o&&l<5)continue;return c(),void t.dispatch({type:"replace",destinationZone:f.zone??"root:default-zone",destinationIndex:f.index,data:d})}const u=s.appState.data.root.props??{},d=Ht(e,u);if(!d)return;const{node:p}=await q({type:"root",props:{...u,...d}},t.config,{cache:a,trigger:"replace"});if(!n())return;if(!(t.getState().appState.data.root.props!==s.appState.data.root.props&&l<5))return c(),void t.dispatch({type:"replaceRoot",root:{props:p.props,readOnly:p.readOnly},recordHistory:!0})}}})},[t,r,i]),y=re(e=>{const{listeners:n}=zt(t);return n.add(e),()=>{n.delete(e)}},[t]),v=re(()=>zt(t).shown.get(i)??jt,[t,i]),w=te(y,v,v),b=ie(()=>Wt(w,a.props),[w,a.props]),k=ee({id:i,values:b});k.current={id:i,values:b};const S=re((e,n)=>{const o=t.getState(),r=("root"===i?o.appState.data.root.props:o.getItemById(i)?.props)??{},l=Wt(zt(t).shown.get(i)??jt,r),s=k.current,a=(s.id===i?s.values:l)[e];H(n,a)&&!H(l[e],a)?g({[e]:n}):g(t=>({[e]:Zt(a,n,t[e])}))},[t,i,g]);return{id:i,node:a,fields:h,values:b,readOnly:m,onChange:S,onChangeMany:g}}export{ct as CHROME_ATTR,ut as CanvasChromeContext,We as CanvasFrame,at as CanvasPartsContext,lt as CanvasPassThroughContext,it as CanvasSharedContext,Ie as DEFAULT_UI,Ot as EaselCanvas,Pe as EaselProvider,rt as EditDocument,Ut as RootHostScope,De as bindUndoKeys,Me as createEasel,Re as createUseEasel,st as partHasOwnBox,ge as recordsByDefault,Se as reduce,Tt as subscribeLateWrites,we as uiView,ze as useEasel,je as useEaselApi,$t as useEaselNodeOps,Xt as useRootFields,qt as useSelectedFields,Qt as useSelectedHost,Kt as useSettledAction,Vt as useSettledPress,be as validSelection,Bt as writesSettled};
@@ -1 +0,0 @@
1
- import{styleFieldBuilders as e,keptByRow as s}from"./chunk-ZFEAWEFS.js";import{boxFieldBuilders as o,PHONE_KEY_ACCESS as l,phoneTwinFields as r,section as i}from"./chunk-76MUJIZE.js";import{deviceField as t}from"./chunk-ZNLODQD4.js";import{BUTTON_STYLE_KEYS as c,BUTTON_PAD_KEYS as n}from"./chunk-PLTTPHK5.js";import{TextColorIcon as u,GroundIcon as d}from"efficient-shell/icons/efficient";import{jsx as f}from"react/jsx-runtime";function a(a){const p=o(a.say),F=e(a.say),y=c,m=a.style,k=a.phone??l;return{...a.padding&&{_dSize:i("Size"),...p.sidesPaddingFields({keys:n,group:!1,...a.padding})},_dDesign:i("Design"),[y.fill]:F.colourField({key:y.fill,access:m,label:"Fill color",icon:/* @__PURE__ */f(d,{}),useFollows:a.follows.useFill,usePresets:a.usePresets,resetTo:a.resetTo,opacity:{key:y.fillOpacity,useUnset:a.follows.useFillOpacity}}),[y.fillOpacity]:s(y.fill),[y.border]:F.borderField({key:y.border,access:m,useFollows:a.follows.useBorder}),[y.text]:F.colourField({key:y.text,access:m,label:"Text color",icon:/* @__PURE__ */f(u,{}),useFollows:a.follows.useText,usePresets:a.usePresets,resetTo:a.resetTo}),[y.corners]:F.cornersField({key:y.corners,access:m,sidesKey:y.cornerSides,useFollows:a.follows.useCorners,useFollowsSides:a.follows.useCornerSides}),[y.cornerSides]:s(y.corners),_dLayout:i("Layout"),...r("align",p.blockAlignmentField({phone:!0},""),k),align:t("desktop",p.blockAlignmentField())}}export{a as buttonFieldSet};
@@ -1 +0,0 @@
1
- import{isRecord as t,fieldsFrom as n,blockOf as o,topLevelSlotKeys as e,slotLocations as r,setIn as s,fieldsOf as i,isNode as c,defaultsFrom as p}from"./chunk-KXM6YRG2.js";var f=()=>({lastChange:{}});function a(t,n){if(t===n)return!0;if(!t||!n||"object"!=typeof t||"object"!=typeof n)return t!=t&&n!=n;if(Array.isArray(t)!==Array.isArray(n))return!1;if(Array.isArray(t)){const o=n;if(t.length!==o.length)return!1;for(let n=0;n<t.length;n++)if(!a(t[n],o[n]))return!1;return!0}const o=Object.keys(t),e=Object.keys(n);if(o.length!==e.length)return!1;for(const e of o){if(!Object.prototype.hasOwnProperty.call(n,e))return!1;if(!a(t[e],n[e]))return!1}return!0}function l(t,n){if(!t)return{};const o=t.props??{},e=n?.props??{},r={};for(const t of Object.keys(o))r[t]=!a(e[t],o[t]);return r}async function u(i,c,p={}){const{metadata:d={},trigger:h="replace",cache:y=f(),onResolveStart:g,onResolveEnd:m}=p,w=function(t,n){return t.type&&"root"!==t.type?n.components[t.type]:n.root}(i,c);let b={...i};const v=Boolean(w?.resolveData&&i.props),j=t(i.props)&&"id"in i.props?String(i.props.id):"root";if(v){const t=y.lastChange[j];if("force"!==h&&t&&a(i,t.item))return{node:t.resolved,didChange:!1};const n=l(i,t?.item??null);g?.(i);const o=await w.resolveData(i,{changed:n,lastData:t?.item??null,metadata:{...d,...w.metadata??{}},trigger:h})??{};b.props={...i.props,...o.props??{}},o.readOnly&&Object.keys(o.readOnly).length&&(b.readOnly=o.readOnly)}const $=n(i.type&&"root"!==i.type?o(c,i.type):c.root);if(w)for(const t of e($))void 0===b.props[t]&&(b={...b,props:{...b.props,[t]:[]}});for(const t of r(b.props,$)){if(!t.present)continue;const n=await Promise.all(t.content.map(async t=>(await u(t,c,{metadata:d,trigger:h,cache:y,onResolveStart:g,onResolveEnd:m})).node));b={...b,props:s(b.props,t.segments,n)}}return v&&m?.(b),y.lastChange[j]={item:i,resolved:b},{node:b,didChange:!a(i,b)}}var d="root";function h(t){if(void 0===t)return"u";if("string"==typeof t)return`s${t.length.toString(36)}.${y(t)}`;const n=g(t);return`j${n.length.toString(36)}.${y(n)}`}function y(t){let n=2166136261;for(let o=0;o<t.length;o++)n^=t.charCodeAt(o),n=Math.imul(n,16777619);return(n>>>0).toString(36)}function g(t){if(null===t||"object"!=typeof t)return JSON.stringify(t)??"null";if(Array.isArray(t))return`[${t.map(g).join(",")}]`;const n=t;return`{${Object.keys(n).filter(t=>void 0!==n[t]).sort().map(t=>`${JSON.stringify(t)}:${g(n[t])}`).join(",")}}`}var m=(t,n)=>Object.prototype.hasOwnProperty.call(t,n);function w(t,n){return t&&m(t,n)?t[n]:void 0}var b=t=>Object.keys(t).length>0,v=n=>t(n)&&"string"==typeof n.src&&void 0!==n.v,j=t=>null==t||"string"==typeof t&&""===t.trim(),$=t=>"text"===t||"textarea"===t,O=(t,n)=>"boolean"==typeof t.translatable?t.translatable:n;function k(n,o){const e=w(n,o);return t(e)?e:void 0}function A(t,n){const o=[];return x(t,n,[],[],[],void 0,o),o}function x(n,o,e,r,s,i,c){for(const p of Object.keys(o)){const f=o[p];if(!f||"slot"===f.type)continue;if(0===e.length&&"id"===p)continue;const a=[...e,p],l=[...r,p],u=w(n,p),d=O(f,i);if("object"===f.type&&f.objectFields)null==u?x({},f.objectFields,a,l,s,d,c):t(u)&&x(u,f.objectFields,a,l,s,d,c);else if("array"===f.type&&f.arrayFields){if(!Array.isArray(u))continue;const n=f.arrayFields;u.forEach((o,e)=>{t(o)&&x(o,n,[...a,e],[...l,"*"],[...s,e],d,c)})}else(d??$(f.type))&&c.push({path:a.join("."),segments:a,pattern:l.join("."),indices:s,value:u})}}function z(t,n){const o=t.split("."),e=[],r=[];let s,i=n,c=0;for(;c<o.length;){const t=w(i,o[c]);if(!t||"slot"===t.type)return null;if(0===c&&"id"===o[c])return null;e.push(o[c]),c+=1;const n=O(t,s);if("object"===t.type&&t.objectFields)i=t.objectFields,s=n;else{if("array"!==t.type||!t.arrayFields)return c!==o.length?null:n??$(t.type)?{pattern:e.join("."),indices:r}:null;{const p=o[c];if(void 0===p||!/^(0|[1-9]\d*)$/.test(p))return null;r.push(Number(p)),e.push("*"),c+=1,i=t.arrayFields,s=n}}}return null}function I(n,o){return A(t(n?.props)?n.props:{},i(o,n?.type??d)).map(({path:t,value:n})=>({path:t,value:n}))}function S(t,n,o){const e=A(t,n),r=/* @__PURE__ */new Map,s=[],i=[];if(!o)return{positions:e,hits:r,orphans:s,beaten:i};const c=/* @__PURE__ */new Map;for(const t of e)c.set(t.path,t);const p=/* @__PURE__ */new Map,f=t=>{let n=p.get(t);return void 0===n&&(n=h(t.value),p.set(t,n)),n},a=[];for(const t of Object.keys(o)){const e=o[t],p=c.get(t);if(!v(e)){(p?i:s).push(t);continue}if(p&&f(p)===e.src){r.set(t,{position:p,entry:e,from:t,stale:!1,applied:!0});continue}const l=p??z(t,n);l?l.indices.length>0?a.push({path:t,entry:e,own:p,pattern:l.pattern,indices:l.indices}):p?r.set(t,{position:p,entry:e,from:t,stale:!0,applied:!0}):s.push(t):s.push(t)}a.sort((t,n)=>function(t,n){const o=Math.min(t.length,n.length);for(let e=0;e<o;e++)if(t[e]!==n[e])return t[e]-n[e];return t.length-n.length}(t.indices,n.indices)||(t.path<n.path?-1:t.path>n.path?1:0));const l=[];for(const t of a){let n,o=-1;for(const s of e){if(s.pattern!==t.pattern||r.has(s.path))continue;if(f(s)!==t.entry.src)continue;const e=F(s.indices,t.indices);e>o&&(n=s,o=e)}n?r.set(n.path,{position:n,entry:t.entry,from:t.path,stale:!1,applied:!0}):l.push(t)}for(const t of l)t.own?r.has(t.path)?i.push(t.path):r.set(t.path,{position:t.own,entry:t.entry,from:t.path,stale:!0,applied:!1}):s.push(t.path);return{positions:e,hits:r,orphans:s,beaten:i}}function F(t,n){let o=0;for(;o<t.length&&o<n.length&&t[o]===n[o];)o+=1;return o}function M(n,o,e){const p=t=>{if(!Array.isArray(t))return t;let n=null;return t.forEach((o,r)=>{if(!c(o))return;const s=f(e(o.props.id,o.type,o.props),o.type);s!==o.props&&(n??=[...t],n[r]={...o,props:s})}),n??t},f=(t,n)=>{let e=t;for(const c of r(t,i(o,n))){if(!c.present)continue;const t=p(c.content);t!==c.content&&(e=s(e,c.segments,t))}return e};let a=n;const l=t(n.root?.props)?n.root.props:{},u=e(d,d,l),h=p(n.content);h!==n.content&&(a={...a,content:h});const y=f(u,d);y!==l&&(a={...a,root:{...a.root,props:y}});const g=n.zones;if(t(g)){let t=g;for(const n of Object.keys(g)){if(-1===n.indexOf(":"))continue;const o=p(g[n]);o!==g[n]&&(t={...t,[n]:o})}t!==g&&(a={...a,zones:t})}return a}function E(t,n){const o=/* @__PURE__ */new Map;return M(t,n,(t,n,e)=>(o.has(t)||o.set(t,{type:n,props:e}),e)),o}function N(t,n,o){return o&&b(o)?M(t,n,(t,e,r)=>{const c=k(o,t);if(!c)return r;const p=S(r,i(n,e),c);let f=r;for(const t of p.positions){const n=p.hits.get(t.path);n&&n.applied&&!a(t.value,n.entry.v)&&(f=s(f,t.segments,n.entry.v))}return f}):t}function D(t,n,o){const e={total:0,missing:[],stale:[]};return M(t,n,(t,r,s)=>{const c=S(s,i(n,r),k(o,t));for(const n of c.positions){const o=c.hits.get(n.path);!o&&j(n.value)||(e.total+=1,o?o.stale&&e.stale.push({id:t,path:n.path}):e.missing.push({id:t,path:n.path}))}return s}),e}function C(n,o){let e=n;for(let n=0;n<o.length-1;n++){const r=o[n];if("number"==typeof r){if(!Array.isArray(e)||r>=e.length)return{held:!1,value:void 0};e=e[r]}else{if(!t(e))return{held:!1,value:void 0};e=w(e,r)}}return t(e)?{held:!0,value:w(e,String(o[o.length-1]))}:{held:!1,value:void 0}}function R(n,e,r,s){const c=E(e,r),p={},f=/* @__PURE__ */new Set;if(M(n,r,(t,n,e)=>{if(f.has(t))return e;f.add(t);const l=k(s,t),u=c.get(t);if(!u||u.type!==n||!o(r,n))return l&&(p[t]=l),e;const d=S(e,i(r,n),l),y={};for(const t of d.positions){const n=d.hits.get(t.path),{held:o,value:e}=C(u.props,t.segments),r=n&&n.applied?n.entry.v:t.value;!o||void 0!==e&&a(e,r)?n&&(y[t.path]=n.entry):void 0===e||a(e,t.value)||(y[t.path]={v:e,src:h(t.value)})}if(l)for(const t of d.orphans)m(y,t)||(y[t]=l[t]);return b(y)&&(p[t]=l&&J(y,l)?l:y),e}),!s)return p;for(const n of Object.keys(s))f.has(n)||m(p,n)||!t(s[n])||(p[n]=s[n]);return J(p,s)?s:p}function J(t,n){const o=Object.keys(t);return o.length===Object.keys(n).length&&o.every(o=>m(n,o)&&t[o]===n[o])}function P(t,n,e){const r={},s=/* @__PURE__ */new Set;let c=!1;M(t,n,(t,p,f)=>{if(m(r,t))return f;const a=k(e,t);if(!o(n,p))return U(f,s),a&&(r[t]=a),f;if(!a)return f;const l=function(t,n){let o=0===t.orphans.length&&0===t.beaten.length;const e={};for(const n of t.positions){const r=t.hits.get(n.path);r&&(e[n.path]=r.entry,r.from!==n.path&&(o=!1))}return o?n:e}(S(f,i(n,p),a),a);return l!==a&&(c=!0),b(l)&&(r[t]=l),f});for(const t of s){const n=k(e,t);n&&!m(r,t)&&(r[t]=n)}return c||Object.keys(r).length!==Object.keys(e).length?r:e}function U(n,o){if(Array.isArray(n))for(const t of n)U(t,o);else if(t(n)){c(n)&&"string"==typeof n.props.id&&o.add(n.props.id);for(const t of Object.keys(n))U(n[t],o)}}function B(n,e,r,s){if(!t(s)||!b(s))return s;const c=E(e,r),p=/* @__PURE__ */new Map;if(M(n,r,(t,n,e)=>{if(p.has(t))return e;const f=k(s,t),a=c.get(t);if(!f||!a||a.type!==n||!o(r,n))return e;const l=function(t,n,o,e){const r=S(t,o,e),s=/* @__PURE__ */new Map,i=/* @__PURE__ */new Map;G(t,n,o,"","",void 0,s,i);const c={};let p=0===r.beaten.length;for(const t of r.positions){const n=r.hits.get(t.path);if(!n)continue;const o=s.get(t.path)?.[0];void 0!==o?(c[o]=n.entry,o!==n.from&&(p=!1)):p=!1}for(const t of r.positions){const n=r.hits.get(t.path);if(n)for(const o of i.get(t.path)??[])m(c,o)||(c[o]=n.entry,p=!1)}for(const t of[...r.orphans].sort())m(c,t)?p=!1:c[t]=e[t];return p?e:c}(e,a.props,i(r,n),f);return l!==f&&p.set(t,l),e}),0===p.size)return s;const f={};for(const t of Object.keys(s)){const n=p.get(t);n?b(n)&&(f[t]=n):f[t]=s[t]}return f}function G(n,o,e,r,s,i,c,p){for(const f of Object.keys(e)){const a=e[f];if(!a||"slot"===a.type)continue;if(""===r&&"id"===f)continue;const l=""===r?f:`${r}.${f}`,u=""===s?f:`${s}.${f}`,d=w(n,f),h=w(o,f),y=O(a,i);if("object"===a.type&&a.objectFields){if(null!=d&&!t(d))continue;G(t(d)?d:{},t(h)?h:{},a.objectFields,l,u,y,c,p)}else if("array"===a.type&&a.arrayFields){if(!Array.isArray(d))continue;const n=Array.isArray(h)?h:[];for(const o of K(d,n)){const e=d[o.from];if(!t(e))continue;const r="edited"===o.kind?n[o.to]:e;G(e,t(r)?r:{},a.arrayFields,`${l}.${o.from}`,`${u}.${o.to}`,y,"copy"===o.kind?p:c,p)}}else if(y??$(a.type)){const t=c.get(l);t?t.push(u):c.set(l,[u])}}}function K(t,n){const o=t.map(g),e=n.map(g),r=o.map(()=>!1),s=e.map(()=>!1),i=[],c=Math.min(o.length,e.length);for(let t=0;t<c;t++)o[t]===e[t]&&(i.push({from:t,to:t,kind:"same"}),r[t]=s[t]=!0);for(let t=0;t<e.length;t++){if(s[t])continue;const n=o.findIndex((n,o)=>!r[o]&&n===e[t]);-1!==n&&(i.push({from:n,to:t,kind:"same"}),r[n]=s[t]=!0)}for(let t=0;t<c;t++)r[t]||s[t]||(i.push({from:t,to:t,kind:"edited"}),r[t]=s[t]=!0);for(let t=0;t<e.length;t++){if(s[t])continue;const n=o.indexOf(e[t]);-1!==n&&i.push({from:n,to:t,kind:"copy"})}return i}function T(t,n,o){const e={},s=(t,n)=>{if(t.type!==n.type)return;e[t.props.id]=n.props.id;const p=r(n.props,i(o,n.type));for(const n of r(t.props,i(o,t.type))){const t=p.find(t=>t.slot===n.slot);t&&n.content.forEach((n,o)=>{const e=t.content[o];c(n)&&c(e)&&s(n,e)})}};return c(t)&&c(n)&&s(t,n),e}function X(t,n){const o={};if(!t)return o;for(const e of Object.keys(n)){const r=k(t,e),s=n[e];r&&b(r)&&"string"==typeof s&&(o[s]={...r})}return o}var Y="root",q="default-zone",H={parentId:Y,slot:q},L=({parentId:t,slot:n})=>`${t}:${n}`;function Q(t){const n=t.indexOf(":");if(-1===n)throw new W("no-slot",`"${t}" is not a zone key`);return{parentId:t.slice(0,n),slot:t.slice(n+1)}}var V=t=>t.parentId===Y&&t.slot===q,W=class extends Error{code;constructor(t,n){super(n),this.name="DataError",this.code=t}};function Z(t){try{const n=globalThis.crypto;if(n&&"function"==typeof n.randomUUID)return`${t}-${n.randomUUID()}`}catch{}return`${t}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function _(t,n){return r(t.props,i(n,t.type)).map(({slot:t,content:n})=>({slot:t,content:n}))}function tt(t,o){return r(nt(t),n(o.root))}function nt(n){return t(n.root?.props)?n.root.props:{}}function ot(t,n,o){const e=(t,n,e,r,s)=>{if(!Array.isArray(t))return t;const i=[...e,n];let f=null;return t.forEach((e,a)=>{if(!c(e))return;const l={place:{...n,index:a},path:i,parent:r,depth:s};let u=o(e,l)??e;if(u!==e&&u.props.id!==e.props.id)throw new W("id-change",`walk: ${e.props.id} came back as ${u.props.id}`);u=p(u,i,s+1),u!==e&&(f??=[...t],f[a]=u)}),f??t},p=(t,o,c)=>{let p=t.props;for(const f of r(t.props,i(n,t.type))){if(!f.present)continue;const n=e(f.content,{parentId:t.props.id,slot:f.slot},o,t,c);n!==f.content&&(p=s(p,f.segments,n))}return p===t.props?t:{...t,props:p}};let f=t;const a=e(t.content,H,[],null,0);a!==t.content&&(f={...f,content:a});let l=nt(f);for(const t of tt(f,n)){if(!t.present)continue;const n=e(t.content,{parentId:Y,slot:t.slot},[],null,0);n!==t.content&&(l=s(l,t.segments,n))}l!==nt(f)&&(f={...f,root:{...f.root,props:l}});const u=f.zones;if(u){let t=u;for(const n of Object.keys(u)){const o=et(n);if(!o)continue;const r=e(u[n],o,[],null,0);r!==u[n]&&(t={...t,[n]:r})}t!==u&&(f={...f,zones:t})}return f}function et(t){const n=t.indexOf(":");return-1===n?null:{parentId:t.slice(0,n),slot:t.slice(n+1)}}function rt(t,n,o){let e=null;const r={};try{ot(t,n,(t,n)=>{if(t.props.id===o)throw e={node:t,place:n.place,path:n.path},r})}catch(t){if(t!==r)throw t}return e}function st(t,n,o){if(V(o))return Array.isArray(t.content)?t.content:[];const e=t.zones?.[L(o)];if(o.parentId===Y){const r=tt(t,n).find(t=>t.slot===o.slot);return r?r.content:e??null}const s=rt(t,n,o.parentId);if(s){const t=r(s.node.props,i(n,s.node.type)).find(t=>t.slot===o.slot);if(t)return t.content}return e??null}function it(t,n){const o=/* @__PURE__ */new Set;return ot(t,n,t=>{o.add(t.props.id)}),o}function ct(t,n){const o=/* @__PURE__ */new Set([t.props.id]),e=t=>{for(const{content:r}of _(t,n))for(const t of r)c(t)&&(o.add(t.props.id),e(t))};return e(t),o}function pt(t,n,o,e){if(V(o)){const n=Array.isArray(t.content)?t.content:[];return{...t,content:e(n)}}const c=L(o),p=!!t.zones&&Array.isArray(t.zones[c]);if(o.parentId===Y){const r=tt(t,n).find(t=>t.slot===o.slot);if(r){const n=s(nt(t),r.segments,e(r.content));return{...t,root:{...t.root,props:n}}}}else{const c=rt(t,n,o.parentId);if(c){const p=r(c.node.props,i(n,c.node.type)).find(t=>t.slot===o.slot);if(p)return ft(t,n,c,t=>({...t,props:s(t.props,p.segments,e(p.content))}))}else if(!p)throw new W("not-found",`no node ${o.parentId}`)}if(p)return{...t,zones:{...t.zones,[c]:e(t.zones[c])}};throw new W("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function ft(t,n,o,e){return pt(t,n,o.place,t=>{const n=[...t];return n[o.place.index]=e(t[o.place.index]),n})}function at(t,n,o){const e=rt(t,n,o);if(!e)throw new W("not-found",`no node ${o}`);return e}function lt(t,n,o){const e=st(t,n,o);if(e)return e;if(o.parentId!==Y&&!rt(t,n,o.parentId))throw new W("not-found",`no node ${o.parentId}`);throw new W("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function ut(t,n,o){if(!Number.isInteger(t)||t<0||t>n)throw new W("bad-index",`${o}: index ${t} is outside 0…${n}`)}function dt(t,i){const c=o(i,t.type);if(!c)return t;const p=n(c);let f=t.props;for(const t of e(p))null==f[t]&&(f={...f,[t]:[]});for(const t of r(f,p)){if(!t.present)continue;const n=ht(t.content,i);n!==t.content&&(f=s(f,t.segments,n))}return f===t.props?t:{...t,props:f}}function ht(n,o){let e=null;return n.forEach((r,s)=>{if(!t(r)||"string"!=typeof r.type)return;let i=r;if(t(i.props)){if("string"!=typeof i.props.id||""===i.props.id){const{id:t,...n}=i.props;i={...i,props:{id:Z(i.type),...n}}}}else i={...i,props:{id:Z(i.type)}};const c=dt(i,o);c!==r&&(e??=[...n],e[s]=c)}),e??n}function yt(t,o){const i=n(o.root);let c=t.props;for(const t of e(i))null==c[t]&&(c={...c,[t]:[]});for(const t of r(c,i)){if(!t.present)continue;const n=ht(t.content,o);n!==t.content&&(c=s(c,t.segments,n))}return c===t.props?t:{...t,props:c}}function gt(n,o){let e=t(n)?n:{};const r=e.root;if(t(r)){if(!t(r.props)){const t=Object.keys(r).filter(t=>"props"!==t);e={...e,root:t.length?{props:{...wt(r,t)}}:{props:{}}}}}else e={...e,root:{props:{}}};const s=p(o.root);if(s){const t=Object.keys(s).filter(t=>!(t in e.root.props));if(t.length){const n=bt(wt(s,t));e={...e,root:{...e.root,props:{...e.root.props,...n}}}}}const i=yt(e.root,o);i!==e.root&&(e={...e,root:i}),Array.isArray(e.content)||(e={...e,content:[]});const c=ht(e.content,o);return c!==e.content&&(e={...e,content:c}),e=t(e.zones)?function(t,n){let o=t;for(const e of Object.keys(t.zones??{})){const t=o.zones[e];if(!Array.isArray(t)||0===t.length)continue;const r=et(e);if(!r||V(r))continue;const s=mt(o,n,r);if(!s||s.content.length>0)continue;const{[e]:i,...c}=o.zones;o=pt({...o,zones:c},n,r,()=>ht(t,n))}const e=o.zones;let r=e;for(const t of Object.keys(e)){if(!Array.isArray(e[t]))continue;const o=ht(e[t],n);o!==e[t]&&(r={...r,[t]:o})}return r===e?o:{...o,zones:r}}(e,o):{...e,zones:{}},e}function mt(t,n,o){if(o.parentId===Y)return tt(t,n).find(t=>t.slot===o.slot);const e=rt(t,n,o.parentId);return e?r(e.node.props,i(n,e.node.type)).find(t=>t.slot===o.slot):void 0}function wt(t,n){const o={};for(const e of n)o[e]=t[e];return o}function bt(t){return void 0===t?t:JSON.parse(JSON.stringify(t))}function vt(t,n,o={},e={}){const r=t.components[n];if(!r)throw new W("unknown-type",`no block type "${n}" in the config`);return dt({type:n,props:{...bt(p(r)??{}),...bt(o),id:e.id??Z(n)}},t)}function jt(n,o,e,r){if(!c(r))throw new W("unknown-type","insert: not a node");const s=lt(n,o,e);ut(e.index,s.length,"insert");const i=dt(t(r.props)&&"string"==typeof r.props.id&&r.props.id?r:{...r,props:{...r.props,id:Z(r.type)}},o),p=it(n,o);for(const t of ct(i,o))if(p.has(t))throw new W("duplicate-id",`insert: ${t} is already in the document`);return pt(n,o,e,t=>[...t.slice(0,e.index),i,...t.slice(e.index)])}function $t(t,n,o){const e=at(t,n,o);let r=pt(t,n,e.place,t=>[...t.slice(0,e.place.index),...t.slice(e.place.index+1)]);if(r.zones&&Object.keys(r.zones).length){const t=ct(e.node,n),o=Object.keys(r.zones).filter(n=>!t.has(n.split(":")[0]));o.length!==Object.keys(r.zones).length&&(r={...r,zones:wt(r.zones,o)})}return r}function Ot(t,n,o,e){const r=at(t,n,o);if(ct(r.node,n).has(e.parentId))throw new W("cycle",`move: ${o} cannot go inside itself`);if(r.place.parentId===e.parentId&&r.place.slot===e.slot){const o=lt(t,n,e);return ut(e.index,o.length-1,"move"),e.index===r.place.index?t:pt(t,n,e,t=>{const n=[...t],[o]=n.splice(r.place.index,1);return n.splice(e.index,0,o),n})}ut(e.index,lt(t,n,e).length,"move");const s=pt(t,n,r.place,t=>[...t.slice(0,r.place.index),...t.slice(r.place.index+1)]);return pt(s,n,e,t=>[...t.slice(0,e.index),r.node,...t.slice(e.index)])}function kt(t,n,o,e={}){const r=at(t,n,o),s=xt(bt(r.node),n,e.strip,e.id);return pt(t,n,r.place,t=>[...t.slice(0,r.place.index+1),s,...t.slice(r.place.index+1)])}function At(t,n,o={}){return xt(bt(t),n,o.strip,o.id)}function xt(t,n,o,e){let p={...t,props:{...t.props,id:e??Z(t.type)}};if(o){const t=o(p);if(t.props.id!==p.props.id)throw new W("id-change","duplicate: strip must not change the id");p=t}let f=p.props;for(const t of r(f,i(n,p.type))){if(!t.present)continue;const e=t.content.map(t=>c(t)?xt(t,n,o):t);f=s(f,t.segments,e)}return dt({...p,props:f},n)}function zt(t,n,o,e){if("id"in e&&e.id!==o)throw new W("id-change",`setProps: ${o} cannot become ${String(e.id)}`);const r=at(t,n,o);return Ft(r.node.props,e)?ft(t,n,r,t=>dt({...t,props:{...t.props,...e,id:o}},n)):t}function It(t,n,o,e){if(!c(e))throw new W("unknown-type","replaceNode: not a node");if(e.props.id!==o)throw new W("id-change",`replaceNode: ${o} cannot become ${String(e.props.id)}`);const r=at(t,n,o),s=dt(e,n),i=it(t,n);for(const t of ct(r.node,n))i.delete(t);for(const t of ct(s,n))if(i.has(t))throw new W("duplicate-id",`replaceNode: ${t} is already in the document`);return ft(t,n,r,()=>s)}function St(t,n,o){const e=nt(t);if(!Ft(e,o))return t;const r=yt({...t.root,props:{...e,...o}},n);return{...t,root:r}}function Ft(t,n){return Object.keys(n).some(o=>!(o in t)||!Object.is(t[o],n[o]))}export{W as DataError,Y as ROOT_ID,H as ROOT_LIST,q as ROOT_SLOT,N as applyTranslation,l as changedProps,bt as clone,At as copyNode,X as copyTranslation,vt as createNode,f as createResolveCache,a as deepEqual,kt as duplicate,R as extractTranslation,rt as find,st as getList,jt as insert,T as mapIds,Ot as move,Z as newId,gt as normalizeData,Q as parseZoneKey,P as pruneTranslation,B as rebaseTranslation,$t as remove,It as replaceNode,u as resolveNodeData,zt as setProps,St as setRoot,_ as slotsOf,I as translatablePaths,h as translationFingerprint,D as translationStatus,ot as walk,L as zoneKey};
@@ -1 +0,0 @@
1
- import{panelFieldsOf as t}from"./chunk-5XL2RXFU.js";import{DESIGN_GROUP_KEY as o,BUCKET_KEY as n}from"./chunk-3QB2ZQXK.js";import{withoutDeviceGate as e}from"./chunk-ZNLODQD4.js";import{STYLE_KIND as r,fieldKind as s,copyStyle as i,heldStyle as c,planPaste as p,pasteMessage as u}from"./chunk-CWELHADJ.js";import{ANCHOR_FIELD_KEYS as a,foldMetaOf as f,MEDIA_FIELD_MARKER as l,TEXT_FIELD_MARKER as m,LINK_FIELD_MARKER as h}from"./chunk-ANPOR6EY.js";import{deviceMetaOf as y}from"./chunk-YCSZAP7T.js";var j=/* @__PURE__ */new Set([o.Size,o.Design,o.Layout,o.Position]),w=new Set(Object.values(o)),b=new Set(Object.values(n)),S=new Set(a),k=/* @__PURE__ */new Set(["focal","imageFocal"]),g=[l,m,h];function v(t){return`site:${t??""}`}function A(t){if(!t||"object"!=typeof t)return null;const o=t,n=e(t)??t,i=o[r]??n[r];if("string"==typeof i)return i;const c=o.options??n.options;if(Array.isArray(c)){return`choice:${c.map(t=>String(t?.value)).sort().join("|")}`}return s(n)}function D(t){const o=t,n=e(t);return g.some(t=>t in o||n&&t in n)}function L(o,e){const r=t(o,e)??{},s=[];let i=!0,c=!1;for(const[t,o]of Object.entries(r))b.has(t)?(i=t===n.Design,c=!1):w.has(t)?i&&(c=j.has(t)):c&&o&&"object"==typeof o&&!t.startsWith("_")&&(f(o)||S.has(t)||k.has(t)||D(o)||"slot"!==o.type&&s.push({path:[t],kind:A(o),counted:"mobile"!==y(o)?.tier&&"tablet"!==y(o)?.tier}));return s}function O(t,o,n,e,r){i({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function d(t,o,n,e,r,s){const i=c(n);if(!i)return null;const a=p(i,{type:e.type,rows:t(o,e),props:e.props});return{...a,message:u(a,i.sourceLabel,r,s)}}function P(t,o,n,e){O(L,t,o,n,e)}function Q(t,o,n,e,r){return d(L,t,o,n,e,r)}var X={scope:t=>v(t.siteId),rows:(t,o)=>L(t,o),copy:(t,o,n,e)=>P(e,t,o,n),plan:(t,o,n,e)=>Q(e,t,o,n)};function Z(t,o){if(!t&&!o)return X;const n=t?.rows,e=n?(t,o)=>n(t,o):L;return{scope:t?.scope??X.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>O(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>d(e,s,t,n,r,o))}}export{P as copyNodeStyle,L as nodeStyleRows,Q as planNodePaste,A as shopFieldKind,v as siteStyleScope,Z as styleClipboardOf};
@@ -1,20 +0,0 @@
1
- import{fieldIsShown as e,shownFields as n}from"./chunk-BPXEFVSQ.js";import{deviceMetaOf as t,noControlMetaOf as l}from"./chunk-YCSZAP7T.js";import{TreeSeam as r}from"./chunk-WHS6Y55E.js";import{SETTINGS_BUCKETS as o,SettingsGroup as a}from"./chunk-D4TH4QQR.js";import{DEFAULT_TREE_WORDS as i}from"./chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as s}from"./chunk-56ID6FKZ.js";import{easelMenuEntries as c}from"./chunk-FIVU2COQ.js";import{FieldNumber as d}from"./chunk-Y2T3JX7K.js";import{FieldSelect as u}from"./chunk-KFWNGPW3.js";import{SettingsSegmented as m}from"./chunk-DX3VILZ3.js";import{SettingsField as h}from"./chunk-MIX7EGRG.js";import{DEFAULT_FIELDS_WORDS as p}from"./chunk-JACEEVVF.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{useTreeDrag as b,gapToMoveIndex as g}from"./chunk-3XECMGXX.js";import{withTip as v}from"./chunk-P2VEMZH5.js";import{clone as y}from"./chunk-EUFDQ4KL.js";import{Textarea as w,Input as k,ItemCount as x,SortableList as C,ListRow as O,IconButton as j,ContextMenu as N,tabPanelId as D,Tabs as $,tabButtonId as I}from"efficient-shell/ui";export{LinkPicker}from"efficient-shell/ui";import{useRef as S,useState as P,useLayoutEffect as F,useId as L}from"react";import{jsx as E,jsxs as T,Fragment as M}from"react/jsx-runtime";import{LockIcon as R,CloseIcon as z,MoveUpIcon as W,MoveDownIcon as A,DuplicateIcon as B,TrashIcon as H}from"efficient-shell/icons/efficient";function K({id:e,value:n,onChange:t,placeholder:l,multiline:r=!1,rows:o=3,readOnly:a=!1,ariaLabel:i,ariaLabelledBy:s}){const c=n??"";return r?/* @__PURE__ */E(w,{id:e,size:"sm",className:"es-fin",value:c,rows:o,placeholder:l,readOnly:a,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)}):/* @__PURE__ */E(k,{id:e,size:"md",className:"es-fin",type:"text",value:c,placeholder:l,readOnly:a,"aria-label":i,"aria-labelledby":s,onChange:e=>t(e.target.value)})}function X(e,n,t){const l=e.slice();return l.splice(Math.max(0,Math.min(n,l.length)),0,t),l}function V(e,n,t){const l=e.slice(),[r]=l.splice(n,1);return l.splice(Math.max(0,Math.min(t,l.length)),0,r),l}function Y(e,n){return e.filter((e,t)=>t!==n)}var Q='input, textarea, select, button, [contenteditable]:not([contenteditable="false"]), [tabindex]',Z={parentId:"list",slot:"items"};function G({label:e,icon:n,noun:t,items:l,onChange:o,newItem:a,summary:s,itemName:d,thumb:u,min:m=0,max:h,readOnly:w=!1,open:k,onOpen:D,renderItem:$,renderRow:I,canRemove:L,lockedReason:K,fixed:G=!1,removeOnRow:U=!0,canDuplicate:q,above:J,head:_=!0}){const ee=f("fields",p).list,ne=f("tree",i),te=t??ee.item,le=!w&&!G&&("number"!=typeof h||l.length<h),re=l.length<=m,oe=e=>!!L&&!L(l[e],e),ae=e=>!w&&!G&&U&&!re&&!oe(e),ie=e=>le&&(!q||q(l[e],e)),se=(e,n)=>d?d(e,n):ee.itemName({noun:te,n:n+1}),ce=S([]),de=S(null),[ue,me]=P(null),he=S(null),[pe,fe]=P(null),[be,ge]=P("");F(()=>{const e=de.current;if(!e)return;de.current=null;const n=ce.current[e.index]?.querySelectorAll(Q)[e.nth]??ce.current[e.index];if(n?.focus(),n&&null!==e.start&&"setSelectionRange"in n)try{n.setSelectionRange(e.start,e.end)}catch{}});const ve=(e,n)=>{if(n<0||n>=l.length||n===e)return;const t=ce.current[e],r=t?.ownerDocument.activeElement;if(t&&r&&t.contains(r)){const e=[...t.querySelectorAll(Q)].indexOf(r),l=r;de.current={index:n,nth:e,start:"number"==typeof l.selectionStart?l.selectionStart:null,end:"number"==typeof l.selectionEnd?l.selectionEnd:null}}o(V(l,e,n));const a=function(e,n,t){return null===e?null:e===n?t:n<e&&t>=e?e-1:n>e&&t<=e?e+1:e}(k,e,n);a!==k&&D(a),ge(ee.moved({n:n+1,total:l.length}))},ye=e=>{le&&(o(X(l,e,a())),I?(de.current={index:e,nth:0,start:null,end:null},null!==k&&k>=e&&D(k+1)):D(e))},we=e=>{ae(e)&&(o(Y(l,e)),k===e?D(null):null!==k&&k>e&&D(k-1))},ke=b({keyOf:e=>String(e),canDrop:(e,n)=>n.parentId===Z.parentId&&n.slot===Z.slot,onDrop:(e,n)=>{const t=g({...Z,index:e},n);t!==e&&ve(e,t)},onStep:(e,n)=>ve(e,e+n),canStep:(e,n)=>e+n>=0&&e+n<l.length,readOnly:w}),xe=e=>{const n=[];return e>0&&n.push({label:ee.moveUp,icon:/* @__PURE__ */E(W,{size:14}),shortcut:"⌥↑",onClick:()=>ve(e,e-1)}),e<l.length-1&&n.push({label:ee.moveDown,icon:/* @__PURE__ */E(A,{size:14}),shortcut:"⌥↓",onClick:()=>ve(e,e+1)}),ie(e)&&n.push({label:ee.duplicate,icon:/* @__PURE__ */E(B,{size:14}),onClick:()=>(e=>{ie(e)&&(o(X(l,e+1,y(l[e]))),null!==k&&k>e&&D(k+1))})(e)}),ae(e)&&n.push({label:ee.delete,icon:/* @__PURE__ */E(H,{size:14}),danger:!0,onClick:()=>we(e)}),n},Ce=(e,n,t,l)=>{w||0===xe(e).length||fe({index:e,x:n,y:t,owner:l})},Oe=e=>n=>{const t=l.slice();t[e]=n,o(t)};/* @__PURE__ */
2
- return T("div",{className:"es-list",children:[_?/* @__PURE__ */T("div",{className:"es-list-head",children:[
3
- /* @__PURE__ */T("span",{className:"es-list-label",children:[n?/* @__PURE__ */E("span",{className:"es-field-icon","aria-hidden":"true",children:n}):null,e]}),
4
- /* @__PURE__ */E(x,{count:l.length,label:ee.count({noun:te,n:l.length}),showZero:!0})]}):null,J?/* @__PURE__ */E("div",{className:"es-list-above",children:J}):null,l.length?/* @__PURE__ */T(C,{"aria-label":e,spacing:"comfortable",className:"es-list-rows",rootProps:ke.rootProps(),children:[l.map((e,n)=>{const t=ke.row({item:n,place:{...Z,index:n}}),l=t.draggable&&ue!==n,o=!I&&k===n,a=!w&&!G&&U&&oe(n),i=["es-list-row",I?"is-inline":"is-item",o?"is-open":"",l?"is-draggable":"",t.dragging?"is-dragging":"",t.drop?`is-drop-${t.drop}`:""].filter(Boolean).join(" ");return[n>0?/* @__PURE__ */E(r,{...ke.seam({place:{...Z,index:n}}),onAdd:le?()=>ye(n):void 0,label:ee.addHere({noun:te})},`seam-${n}`):null,
5
- /* @__PURE__ */E(O,{className:i,flat:!!I,active:o,title:I?void 0:/* @__PURE__ */T(M,{children:[
6
- /* @__PURE__ */E("span",{className:"es-list-row-name",children:se(e,n)}),s?/* @__PURE__ */E("span",{className:"es-list-row-summary",children:s(e,n)}):null]}),thumb:!I&&u?u(e,n):void 0,expanded:I?void 0:o,onToggle:I?void 0:()=>D(o?null:n),draggable:t.draggable,dragHint:ne.dragHint,dragging:t.dragging,drop:"before"===t.drop||"after"===t.drop?t.drop:void 0,onMove:t.draggable?e=>ve(n,"up"===e?n-1:n+1):void 0,rowRef:e=>{ce.current[n]=e},rowProps:{...t.rowProps,draggable:l||void 0,onPointerDown:e=>{const l=e.target.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"])'),r=!!l&&l===l.ownerDocument.activeElement;e.currentTarget.draggable=t.draggable&&!r,he.current=l&&!r?l:null,me(r?n:null)},onDragStart:e=>{const n=he.current;he.current=null,n&&n.ownerDocument.activeElement===n&&n.blur(),t.rowProps.onDragStart?.(e)},onContextMenu:e=>{w||(e.preventDefault(),e.stopPropagation(),Ce(n,e.clientX,e.clientY,e.currentTarget))},onKeyDown:e=>{if("ContextMenu"===e.key||e.shiftKey&&"F10"===e.key){e.preventDefault();const t=e.currentTarget.ownerDocument,l=e=>e.preventDefault();t.addEventListener("contextmenu",l,{capture:!0,once:!0}),t.defaultView?.setTimeout(()=>t.removeEventListener("contextmenu",l,{capture:!0}),500);const r=e.currentTarget.getBoundingClientRect();return void Ce(n,r.left+24,r.bottom,e.currentTarget)}t.rowProps.onKeyDown?.(e)}},actions:w||G||!U?void 0:a?v(K?K(e,n):ee.locked,/* @__PURE__ */E("span",{className:"es-list-lock",role:"img","aria-label":K?K(e,n):ee.locked,children:/* @__PURE__ */E(R,{size:13})})):v(ee.deleteItem({noun:te}),/* @__PURE__ */E(j,{size:"sm",className:"es-list-x","aria-label":ee.deleteItem({noun:te}),disabled:!ae(n),onClick:()=>we(n),children:/* @__PURE__ */E(z,{size:14,"aria-hidden":"true"})})),below:o?/* @__PURE__ */E("div",{className:"es-list-item",children:$(e,n,Oe(n))}):void 0,children:I?/* @__PURE__ */E("div",{className:"es-list-row-main",children:I(e,n,Oe(n))}):null},n)]}),
7
- /* @__PURE__ */E(r,{...ke.seam({place:{...Z,index:l.length}})})]}):null,w||G?null:/* @__PURE__ */E("button",{type:"button",className:"es-list-add",disabled:!le,onClick:()=>ye(l.length),children:ee.add({noun:te})}),
8
- /* @__PURE__ */E("span",{className:"es-list-said","aria-live":"polite",children:be}),pe&&pe.index<l.length?
9
- /* @__PURE__ */E(N,{at:{x:pe.x,y:pe.y},owner:pe.owner,onClose:()=>fe(null),items:c(xe(pe.index))}):null]})}var U=e=>e<6?e+1:6,q=(e,n)=>"string"==typeof e.label&&e.label?e.label:n;function J({field:e,name:t,id:l,value:r,onChange:o,readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:u=3}){const[m,h]=P(!0),p=r&&"object"==typeof r?r:{};/* @__PURE__ */
10
- return E(a,{id:`${l}-group`,title:q(e,t),open:m,onToggle:h,level:u,children:Object.entries(n(e.objectFields,{values:p,context:c})).map(([e,n])=>/* @__PURE__ */E(ee,{field:n,name:`${t}.${e}`,id:`${l}-${e}`,value:p[e],onChange:n=>o({...p,[e]:n}),readOnly:i,context:s,showWhenContext:c,renderers:d,headingLevel:U(u)},e))})}function _({field:e,name:t,id:l,value:r,onChange:o,readOnly:a,context:i,showWhenContext:s,renderers:c,openItem:d,onOpenItem:u,headingLevel:m}){const[h,p]=P(null),f=u?d??null:h,b=u??p,g=Array.isArray(r)?r:[],v=e.getItemSummary;/* @__PURE__ */
11
- return E(G,{label:q(e,t),icon:e.icon,noun:"string"==typeof e.noun?e.noun:void 0,items:g,onChange:o,newItem:()=>y({...e.defaultItemProps??{}}),summary:v?(e,n)=>v(e,n):void 0,min:e.min,max:e.max,readOnly:a,open:f,onOpen:b,renderItem:(r,o,d)=>Object.entries(n(e.arrayFields,{values:r,context:s})).map(([e,n])=>/* @__PURE__ */E(ee,{field:n,name:`${t}[${o}].${e}`,id:`${l}-${o}-${e}`,value:r?.[e],onChange:n=>d({...r,[e]:n}),readOnly:a,context:i,showWhenContext:s,renderers:c,headingLevel:m},e))})}function ee(e){const{field:n,name:t,id:l,value:r,onChange:o,readOnly:a,context:i,renderers:s}=e;if(!n||n.marker||!1===n.visible)return null;const c=s?.[n.type];if(c)return c({field:n,name:t,id:l,value:r,onChange:o,readOnly:a});switch(n.type){case"custom":{const e={...i,field:n,name:t,id:l,value:r,onChange:o,readOnly:a};return n.render(e)}case"text":case"textarea":/* @__PURE__ */
12
- return E(h,{label:q(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */E(K,{id:l,value:"string"==typeof r?r:null==r?"":String(r),onChange:o,placeholder:n.placeholder,multiline:"textarea"===n.type,readOnly:a})});case"number":/* @__PURE__ */
13
- return E(h,{label:q(n,t),htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */E(d,{id:l,value:"number"==typeof r?r:void 0,onChange:o,min:n.min,max:n.max,step:n.step,placeholder:n.placeholder,readOnly:a})});case"select":{const e=`${l}-label`;/* @__PURE__ */
14
- return E(h,{label:q(n,t),labelId:e,htmlFor:l,icon:n.icon,hint:n.hint,children:/* @__PURE__ */E(u,{id:l,value:r,options:n.options,onChange:o,readOnly:a,ariaLabelledBy:e})})}case"radio":/* @__PURE__ */
15
- return E(h,{label:q(n,t),icon:n.icon,hint:n.hint,children:/* @__PURE__ */E(m,{ariaLabel:q(n,t),value:r,options:n.options.map(e=>({id:e.value,label:e.label,icon:e.icon,disabled:e.disabled||a})),onChange:e=>{a||o(e)}})});case"object":/* @__PURE__ */
16
- return E(J,{...e,field:n});case"array":/* @__PURE__ */
17
- return E(_,{...e,field:n});case"slot":return null}}function ne(e,n,r){if("mobile"!==n&&"tablet"!==n)return!0;const o=e;if(o&&"string"==typeof o.reachedBy){const t=r?.[o.reachedBy];return void 0!==t&&t!==e&&ne(t,n)}if(!o||o.marker||"slot"===o.type)return!0;const a=t(e)?.tier;return a?a===n||"each"===a:"always"===l(e)}var te={},le=e=>o.includes(e);function re(n,t){let l,r=o[0];const a=[],i=/* @__PURE__ */new Set;for(const[o,s]of Object.entries(n))s&&(le(s.bucket)&&((s.marker||s.bucket!==r)&&(l=void 0),r=s.bucket),s.marker&&"string"==typeof s.fold?l={key:o,title:s.fold}:s.marker&&!1===s.fold&&(l=void 0),s.marker||!1===s.visible||t&&!e(s,t)||t&&!ae(s,n,t)||t&&!ne(s,t.context?.device,n)||(a.push(l?{name:o,field:s,bucket:r,fold:l}:{name:o,field:s,bucket:r}),"slot"!==s.type&&i.add(r)));return{rows:a,buckets:o.filter(e=>i.has(e))}}function oe(e){return new Map(re(e).rows.map(e=>[e.name,e.bucket]))}function ae(n,t,l){const r=n.reachedBy;if("string"!=typeof r)return!0;const o=t[r];return!!o&&!1!==o.visible&&e(o,l)}function ie(e){const n=[];for(const t of e){const e=n[n.length-1];e&&e.fold?.key===t.fold?.key?e.rows.push(t):n.push({fold:t.fold,rows:[t]})}return n}function se({fields:e,values:n,onChange:t,readOnly:l=!1,context:r,showWhenContext:i,tab:c,onTab:d,tabs:u=!0,allTabs:m=!1,tabIcons:h,renderers:p,idPrefix:b,ariaLabel:g,lead:v,children:y,leadFold:w,closedFolds:k,onFold:x,headingLevel:C=3}){const O=f("panel",s),j=L(),N=b??`es-insp${j.replace(/:/g,"")}`,S=re(e,{values:n,context:i}),[F,M]=P(void 0),R=F&&(F.panel===N||S.buckets.includes(F.tab))?F.tab:void 0,z=c??R,W=m?o:S.buckets,A=z&&W.includes(z)?z:S.buckets[0]??W[0],[B,H]=P(null),K=B&&B.panel===N&&S.rows.some(e=>e.name===B.name)?B:null,X=u&&W.length>1,V=X&&A?D(N,A):`${N}-rows`,[Y,Q]=P(()=>/* @__PURE__ */new Set),Z=k??Y,G=(e,n)=>{/* @__PURE__ */return E(a,{title:e.title,open:!Z.has(e.key),onToggle:n=>((e,n)=>{void 0===k&&Q(t=>{const l=new Set(t);return n?l.delete(e):l.add(e),l}),x?.(e,n)})(e.key,n),id:`${N}-fold-${t=e.key,[...t].map(e=>/[A-Za-z0-9_-]/.test(e)?e:`-u${e.codePointAt(0).toString(16)}-`).join("")}`,level:C,children:n});var t},q=e=>X&&e!==A,J=({name:e,field:o,bucket:a,fold:s})=>/* @__PURE__ */E("div",{className:"es-insp-row","data-field":e,"data-bucket":a,hidden:!!q(a)||void 0,children:/* @__PURE__ */E(ee,{field:o,name:e,id:`${N}-${e}`,value:n[e],onChange:n=>t(e,n),readOnly:l,context:r,showWhenContext:i,renderers:p,openItem:K&&K.name===e?K.index:null,onOpenItem:n=>H(null===n?null:{panel:N,name:e,index:n}),headingLevel:s?U(C):C})},e);/* @__PURE__ */
18
- return T("div",{className:"es-insp",children:[X?/* @__PURE__ */E("div",{className:"es-insp-tabs",children:/* @__PURE__ */E($,{variant:"underline",block:!0,"aria-label":g??O.settings,idPrefix:N,value:A,onChange:e=>{const n=e;void 0===c&&M({panel:N,tab:n}),d?.(n)},items:W.map(e=>{const n=O.buckets[e],t=h?.[e];return t?{id:e,icon:t,label:/* @__PURE__ */E("span",{className:"sr-only",children:n}),tooltip:n}:{id:e,label:n}})})}):null,
19
- /* @__PURE__ */T("div",{className:"es-insp-rows",id:V,role:X?"tabpanel":void 0,"aria-labelledby":X&&A?I(N,A):void 0,children:[v&&ne(te,i?.device)?w?/* @__PURE__ */E("div",{className:"es-insp-band","data-fold":w.key,children:G(w,v)}):v:null,ie(S.rows).map((e,n)=>{if(!e.fold)return e.rows.map(J);const t=e.rows[0].bucket,l=e.rows.every(e=>"slot"===e.field.type);/* @__PURE__ */
20
- return E("div",{className:"es-insp-band","data-fold":e.fold.key,"data-bucket":t,hidden:!(!q(t)&&!l)||void 0,children:G(e.fold,e.rows.map(J))},`fold-${e.fold.key}-${n}`)}),y]})]})}function ce(e,n,l=ne){const r=t(e)?.tier,o=t=>l(e,t,n)&&r!==t&&"each"!==r?1:0;return{phoneShared:o("mobile"),tabletShared:o("tablet")}}function de(e){const{arrayFields:n,objectFields:t}=e;return Object.values(n??t??{}).reduce((e,n)=>e+1+de(n),0)}var ue=/\buse(?:PreviewDevice\(\)|(?:Context)?\(PreviewDeviceContext\))|\b(?:previewD|d)evice\s*(?:[!=]==?|\?)|(?:[!=]==?)\s*(?:previewD|d)evice\b|switch\s*\(\s*(?:previewD|d)evice\b|shownTier\(\w+\)\s*[!=]==|\btier\s*[!=]==\s*"(?:mobile|tablet|desktop|each)"|context:\s*"device"/g;function me(e){return e.match(ue)??[]}export{K as FieldText,se as Inspector,ee as InspectorField,G as ListField,oe as bucketsOf,ne as fieldShownInView,de as innerRowCount,X as insertAt,q as labelOf,V as moveTo,re as planFields,Y as removeAt,ce as rowViewState,me as viewReadsIn};
@@ -1 +0,0 @@
1
- var e={less:"Less",more:"More",choose:"Choose",search:"Search",noMatches:"No matches",list:{item:"item",itemName:({noun:e,n:o})=>{return`${t=e,t?t[0].toUpperCase()+t.slice(1):t} ${o}`;var t},count:({noun:e,n:o})=>`${o} ${1===o?e:(e=>/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:`${e}s`)(e)}`,position:({n:e,total:o})=>`${e} of ${o}`,duplicate:"Duplicate",duplicateItem:({noun:e})=>`Duplicate ${e}`,deleteItem:({noun:e})=>`Delete ${e}`,add:({noun:e})=>`+ Add ${e}`,addHere:({noun:e})=>`Add ${e} here`,moveUp:"Move up",moveDown:"Move down",delete:"Delete",locked:"This one cannot be removed",moved:({n:e,total:o})=>`Moved to ${e} of ${o}`}};export{e as DEFAULT_FIELDS_WORDS};
@@ -1,2 +0,0 @@
1
- import{routeSharedHostMessage as e}from"./chunk-QZJKWKGH.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GR3XRILS.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-6ATIYLUL.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-KO47WAWR.js";import{useAdminBridge as l}from"./chunk-NQW6XCAY.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-YM4UEGBV.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-SNF5764Q.js";import{useEaselHost as k}from"./chunk-LX23TCTP.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-G2VZ4DET.js";import{useAutosave as g}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as b,CLAIM_FAIL_OPEN_MS as S,holderOf as I}from"./chunk-YYD257TD.js";import{useWords as P}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as E,useMemo as T,useCallback as B,useEffect as A,useRef as C}from"react";import{jsx as H}from"react/jsx-runtime";var D={content:[],root:{},zones:{}};var L=j(null);function N(){const e=R(L);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function O({target:j,addressing:R=o,onHostMessage:N,children:O}){const Y=R,{homeSlug:F,entryMayBounce:M,entryBounce:W,onSwitch:V,tellsHost:G,adapterFor:K,migrateRenamedProps:U,describeMissing:X,onLoadFailed:x}=Y,[Q,Z]=E(j),z=k(),J=d(),_=T(()=>f(J),[J]),q=T(()=>t(J),[J]),$="template"===Q.kind,ee="template"===Q.kind?Q.id:null,re="template"===Q.kind?Q.pageSlug??F??"":"document"===Q.kind?Q.slug??"":Q.slug,ne="page"===Q.kind?Q.siteId??null:null,te=J.blocks,oe=T(()=>K(Q,_,te),[K,_,te,Q.kind,"template"===Q.kind?Q.id:"document"===Q.kind?Q.record:Q.siteId]),ue=oe.capabilities,ae=B(e=>J.documentHooks?.stored?.(e)??e,[J]);A(()=>{m(J,ne)},[J,ne]);const se=C(Q);A(()=>{se.current=Q},[Q]);const{token:ie,tokenRef:le,capabilities:ce}=l({onMessage:r=>{if(N?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Er(e.target)}}}),de=!J.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(_.lock),[ke,ve]=E(null),[ge,pe]=E(null),[he,ye]=E(null),[we,be]=E(null),Se=P("screen",v),Ie=we?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(we,Se):null,[Pe,je]=E(null),Re=C(null),Ee=C(null),[Te,Be]=E(!1),Ae=C(null),[Ce,He]=E(null),De=C(null),[Le,Ne]=E(null),[Oe,Ye]=E(!1),Fe=C(null);A(()=>{Fe.current=Le},[Le]);const[Me,We]=E(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ve=C(Me);A(()=>{Ve.current=Me},[Me]);const Ge=C(()=>Promise.resolve(!1)),Ke=B(e=>{Ee.current=e,Be(!0)},[]),Ue=g({save:async({id:e,data:r})=>{if(p(Ve.current)){if(!await Ge.current(e,r)){if(!p(Ve.current))return void Ke({id:e,data:r});throw new Error("page save did not land")}}else Ke({id:e,data:r})},onFailure:(e,r)=>{0===r&&z.send("storefront-editor:save-failed")}}),{state:Xe,push:xe,flush:Qe,pause:Ze,resume:ze,stop:Je,reset:_e,retryNow:qe,hasPending:$e}=Ue,er=C(Xe);A(()=>{er.current=Xe},[Xe]);const rr=u(Xe),nr=B(()=>{const e=Ee.current;e&&(Ee.current=null,Be(!1),xe(e))},[xe]),tr=C("");tr.current||(tr.current=h());const[or,ur]=E(0),ar=C(!1),[sr,ir]=E(M(j)),lr=C(!1);A(()=>{if(lr.current)return;lr.current=!0;const e=z.address.search(),r=W(j,e);r?z.address.load(r):M(j)&&ir(!1)},[j,z]);const cr=z.send;A(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=J.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==F&&re!==F?void z.address.load({kind:"page",slug:F,siteId:ne??void 0}):(be({target:t,slug:re,missing:!0,sentence:X?.(t)??null}),void x?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Re.current=n,je(n),ve(r.id),pe(r.kind??null),De.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:D,s=U(a),i=u?await u(s):s;e||ye(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),be({target:t,slug:re,missing:!1,sentence:n(o,{slug:re},J),cause:r(o,J)}),x?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=B(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=le.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),fr=B(async e=>{const r=le.current;if(!r&&J.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,J)){cr("storefront-editor:auth-expired");const n=r?await dr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[cr,dr,J]),mr=B(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=B(async(e,r,n=!1)=>{if(null!==Re.current)return!1;if(!p(Ve.current))return!1;if(Fe.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,De.current,tr.current));if(t.ok)return De.current=t.value.version??De.current,Ye(!1),!0;const o=q.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ve.current=e,We(e),!1}const u=q.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await fr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return De.current=n.value,Ge.current(e,r,!0)}Je(),Fe.current=u,Ne(u)}return Ye(i(t.error,J)?.status===c),!1},[oe,fr,Je,J]);A(()=>{Ge.current=kr},[kr]);const vr=B(e=>{if(null!==Re.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);Ae.current=r,p(Ve.current)?xe({id:ke,data:r}):Ke({id:ke,data:r})},[ke,cr,Ke,xe,ae]),gr=B(async()=>{p(Ve.current)&&nr();return await Qe()&&null==Ee.current},[nr,Qe]),pr=C(gr);A(()=>{pr.current=gr},[gr]);const hr=C(fr);A(()=>{hr.current=fr},[fr]);const yr=B(()=>{z.address.reload()},[z]),wr=C(()=>Promise.resolve(!1));A(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:De.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Ee.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const br=null!==Pe;A(()=>{if(!fe||!ke||!de||br)return;let e=!1,r=null,n=null;const t=tr.current,o={claim:async e=>{const r=await hr.current(()=>fe.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ve.current,heldWrite:()=>({pending:null!=Ee.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=Fe.current}),setAccess:e=>{Ve.current=e,We(e)},releaseHeldWrite:()=>{pr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{wr.current()}},u=q.makeClaimBeat(o),a=ar.current;return ar.current=!1,a||(We({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(b)},S)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),fe.release(ke,t).catch(()=>{})}},[ke,fe,de,ie,or,br]);const Sr=B(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Ir=B(()=>{We(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Pr=B(()=>{er.current.paused?(p(Ve.current)&&nr(),ze()):Ze()},[nr,Ze,ze]),jr=B(()=>{qe()},[qe]),Rr=B(e=>{Ae.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{_e(),Ee.current=null,Be(!1)},setVersion:e=>{De.current=e},setSaveConflict:Ne,setAccess:We}),V(e),Z(e),Re.current=null,je(null),ve(null),pe(null),ye(null),be(null),z.address.show(e),"document"!==e.kind&&G(e)&&z.send("storefront-editor:navigated",{target:e})},[_e,z,me,V,G]),Er=B(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,se.current,F))return;const r=null!=Ee.current;if(!r&&!$e())return void Rr(e);const n=er.current;r||n.paused||n.failed||n.stopped?He(e):Qe().then(r=>{r?Rr(e):He(e)})},[Rr,$e,Qe,F]),Tr=B(()=>He(null),[]),Br=B(()=>{He(e=>(e&&Rr(e),null))},[Rr]),Ar=B(async()=>{const e=Ce;if(!e)return;await gr()&&(He(null),Rr(e))},[Ce,gr,Rr]),Cr=B(async e=>{if(null!==Re.current)return;if(!ke)return;if(!p(Ve.current)||Fe.current)return;const r=ae(e);if(!await kr(ke,r))return void(Fe.current||cr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void cr("storefront-editor:saved");const t=await fr(()=>n(ke,De.current??void 0));if(!t.ok){const{error:e}=t;return void cr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}De.current=t.value.version??De.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
2
- return H(L.Provider,{value:{target:Q,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>Ae.current??he,error:Ie,redirecting:sr,saveStatus:rr,saveState:Xe,autoSaveEnabled:!Xe.paused,autoSaveStoppedByConflict:Xe.stopped,hasUnsavedEdits:Xe.pending||Te,toggleAutoSave:Pr,retrySave:jr,onChange:vr,flushSave:gr,onPublish:Cr,access:Me,readOnly:null!==I(Me)||null!==Pe||null!==Le,readOnlyReason:Pe,takeOverEditing:Sr,viewReadOnly:Ir,saveConflict:Le,saveUnreachable:Oe,reloadFromServer:yr,navigate:Er,pendingNav:Ce,cancelPendingNav:Tr,discardAndNavigate:Br,saveAndNavigate:Ar},children:O})}export{L as ScreenDocumentContext,O as ScreenDocumentProvider,N as useScreenDocument};
@@ -1,8 +0,0 @@
1
- import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-GDO4QJ4G.js";import{blockTypesIn as o}from"./chunk-IZGFJWH4.js";import{sectionTemplatesOf as r}from"./chunk-N7E6264U.js";import{sharedSectionsOf as l}from"./chunk-N3MJOHAG.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SBVIW3KJ.js";import{blockRuns as c}from"./chunk-RUQOIQWI.js";import{useScreenBlockLook as a,useScreenBlockRules as p,useScreenPinned as d}from"./chunk-2262JGFV.js";import{useEaselSession as m}from"./chunk-YM4UEGBV.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-G2VZ4DET.js";import{useEasel as u}from"./chunk-3W2O22DZ.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-SQTVXE5D.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-TQ5Y6S2X.js";import{useState as b,useEffect as v,useMemo as j,useRef as w}from"react";import{SharedIcon as C,AddIcon as O}from"efficient-shell/icons/efficient";import{ContextMenu as E,toast as I,Dialog as $,Button as F}from"efficient-shell/ui";import{jsx as G,jsxs as T,Fragment as x}from"react/jsx-runtime";function D({name:e,pages:t,onDelete:n,onCancel:o}){const r=h("screen",f).shared,[l,i]=b(!1),s=w(null);/* @__PURE__ */
2
- return G($,{open:!0,role:"alertdialog",size:"sm",title:r.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */T(x,{children:[
3
- /* @__PURE__ */G(F,{ref:s,variant:"secondary",onClick:o,children:r.cancel}),
4
- /* @__PURE__ */G(F,{variant:"danger",loading:l,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:r.deleteShared})]}),children:r.deleteMessage({count:t})})}var S=e=>`section:${e}`,W=e=>`block:${e}`,M=e=>`template:${e}`,Q=e=>`shared:${e}`,V=e=>`preset:${e}`;function B({at:w,placeBlocks:$,canTake:F,onPick:B,itemFor:H,session:J,siteWide:z,onClose:A,onHide:L,readOnly:N}){const U=u(e=>e.config),R=a(),{labelAtLevel:Y,categoryLabel:Z,firstSection:P,Icon:X,Thumbnail:_}=R,{blockIsOffered:K,canAddTo:q}=p(),ee=h("screen",f).add,te=h("drag",g).add,ne=m(),[oe,re]=b([]);v(()=>{let e=!1;const t=e=>K(e,ne);return r(ne).list().then(n=>{if(e)return;const r=U.components;re(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[U,ne]);const le=d().shared,ie=h("screen",f).shared,[se,ce]=b([]),[ae,pe]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>K(e,ne);return l(ne).list().then(n=>{if(e)return;const r=U.components;ce(n.filter(e=>e.node?.type&&r[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[U,ne,ae]);const[de,me]=b(null),[fe,ue]=b(null),ye=j(()=>e(U,R),[U]),he=e=>Y(e,"section",U.components[e]?.label??e),ke=e=>({type:e.preset?V(e.preset.key):S(e.type),label:e.name,cover:/* @__PURE__ */G(_,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:ee.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ge=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=oe.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=se.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}if("preset"===n){const e=ye.find(e=>e.preset?.key===o)?.preset;return e?{kind:"preset",preset:e}:null}return null},be=e=>/* @__PURE__ */G("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */G(X,{type:e,size:26})}),ve=j(()=>{const e=t(ye,P),o=/* @__PURE__ */new Map,r=e=>{e.retired||o.has(e.type)||!K(e.type,ne)||o.set(e.type,e)};for(const t of e?[e]:ye.filter(e=>!e.preset)){const e=q(t.type)?.choices??[];e.forEach(r),e.forEach(e=>q(e.type,1)?.choices?.forEach(r))}$?.forEach(r);const l=new Set(ye.filter(e=>!e.preset).map(e=>e.type)),i=[...o.values()].filter(e=>!l.has(e.type)),s=e=>({type:W(e.type),label:e.label,cover:be(e.type),title:ee.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>!e.preset&&o.has(e.type)?{...ke(e),cover:be(e.type)}:ke(e),p=[];se.length>0&&p.push({key:"shared",title:ie.group,tiles:se.map(e=>({type:Q(e.id),label:e.title,cover:/* @__PURE__ */G(_,{type:e.node.type}),mark:/* @__PURE__ */G(C,{size:12}),title:ie.onPages({count:e.used_on.length}),keywords:[he(e.node.type),e.node.type]}))}),oe.length>0&&p.push({key:"templates",title:ee.templates,tiles:oe.map(e=>({type:M(e.id),label:e.name,cover:/* @__PURE__ */G(_,{type:e.node.type}),keywords:[he(e.node.type),e.node.type]}))});const d=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(U.categories??{})){const o=ye.filter(e=>e.cat===t);if(0===o.length)continue;const r=e&&o.some(t=>t.type===e.type)?e:null,l=(r?[r,...o.filter(e=>e.type!==r.type)]:o).map(a);r&&!m&&(l.splice(1,0,...d.map(s)),m=!0),p.push({key:`category:${t}`,title:n(U,t,Z),tiles:l})}const f=p.find(e=>e.key?.startsWith("category:"));if(!m&&f&&d.length>0&&(f.tiles=[...f.tiles,...d.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!F)return p;const u=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ge(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))]},[oe,se,ie,ye,U,ee,F,$,ne]);/* @__PURE__ */
5
- return T(x,{children:[
6
- /* @__PURE__ */G(i,{icon:/* @__PURE__ */G(O,{size:15}),title:ee.title,context:ee.contextAll,actions:/* @__PURE__ */G(s,{label:ee.done,description:ee.doneDescription,onClick:A}),onHide:L}),
7
- /* @__PURE__ */T("div",{className:"sf-addside sf-scroll",children:[
8
- /* @__PURE__ */G(k,{groups:ve,session:J,itemFor:e=>H(ge(e)??{kind:"section",type:e}),onInsert:B?e=>{const t=ge(e);t&&B(t)}:void 0,onTileMenu:(e,t)=>{const n=ge(e);return"shared"===n?.kind&&!N&&(me({section:n.section,...t}),!0)},at:w,hint:ee.hint,searchLabel:ee.search,readOnly:N,words:te}),z??null]}),de?/* @__PURE__ */G(E,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>me(null),"aria-label":de.section.title,items:y([{label:ie.deleteShared,danger:!0,onClick:()=>{ue(de.section),me(null)}}])}):null,fe?/* @__PURE__ */G(D,{name:fe.title,pages:fe.used_on.length,onDelete:()=>(async e=>{try{await l(ne).remove(e.id)}catch{return void I.error(ie.deleteFailed)}ue(null),le?.removed?.(e),ce(t=>t.filter(t=>t.id!==e.id)),pe(e=>e+1)})(fe),onCancel:()=>ue(null)}):null]})}export{B as AddSidePanel,W as blockKey,V as presetKey,S as sectionKey,Q as sharedKey,M as templateKey};