efficient-easel 0.0.0 → 0.97.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 (119) hide show
  1. package/LICENSE +10 -0
  2. package/README.md +818 -4
  3. package/dist/autosave/index.d.ts +101 -0
  4. package/dist/autosave/index.js +1 -0
  5. package/dist/blocks/index.d.ts +306 -0
  6. package/dist/blocks/index.js +0 -0
  7. package/dist/buckets-1vRlQceY.d.ts +13 -0
  8. package/dist/canvas/index.d.ts +194 -0
  9. package/dist/canvas/index.js +1 -0
  10. package/dist/chrome/chrome.css +570 -0
  11. package/dist/chrome/index.d.ts +219 -0
  12. package/dist/chrome/index.js +21 -0
  13. package/dist/chunk-2LUSK32B.js +1 -0
  14. package/dist/chunk-2OAZYSWJ.js +1 -0
  15. package/dist/chunk-67VZRQLG.js +13 -0
  16. package/dist/chunk-6OPSJGAI.js +1 -0
  17. package/dist/chunk-6PS6STGA.js +1 -0
  18. package/dist/chunk-6WY6ZXJG.js +1 -0
  19. package/dist/chunk-7A7O2JWQ.js +1 -0
  20. package/dist/chunk-BZ5ASXOL.js +1 -0
  21. package/dist/chunk-CERTFXCV.js +13 -0
  22. package/dist/chunk-D2BCHTQR.js +1 -0
  23. package/dist/chunk-FI23ALVJ.js +1 -0
  24. package/dist/chunk-GGTPNGFJ.js +1 -0
  25. package/dist/chunk-H4B72XCJ.js +1 -0
  26. package/dist/chunk-H6DDIBQ4.js +1 -0
  27. package/dist/chunk-KDIVA6WD.js +1 -0
  28. package/dist/chunk-KRXQM65X.js +1 -0
  29. package/dist/chunk-MCLBHENY.js +1 -0
  30. package/dist/chunk-MFIRYGHW.js +1 -0
  31. package/dist/chunk-NKB3KVAB.js +1 -0
  32. package/dist/chunk-O2NLQBFX.js +1 -0
  33. package/dist/chunk-OGZFDJ6G.js +1 -0
  34. package/dist/chunk-OWBO4WKA.js +0 -0
  35. package/dist/chunk-QB3BZIRA.js +5 -0
  36. package/dist/chunk-RE4LP46F.js +1 -0
  37. package/dist/chunk-STFMZJKU.js +14 -0
  38. package/dist/chunk-SUO5627P.js +1 -0
  39. package/dist/chunk-TDA4HH54.js +1 -0
  40. package/dist/chunk-WK3AFPXY.js +1 -0
  41. package/dist/chunk-YIMRTIBN.js +3 -0
  42. package/dist/chunk-YNZZYHA4.js +450 -0
  43. package/dist/chunk-YRLPFZW3.js +1 -0
  44. package/dist/chunk-ZAOM6PFH.js +1 -0
  45. package/dist/chunk-ZNCEOSXO.js +1 -0
  46. package/dist/copy/copy.css +282 -0
  47. package/dist/copy/index.d.ts +336 -0
  48. package/dist/copy/index.js +10 -0
  49. package/dist/data/index.d.ts +375 -0
  50. package/dist/data/index.js +1 -0
  51. package/dist/drag/drag.css +360 -0
  52. package/dist/drag/index.d.ts +379 -0
  53. package/dist/drag/index.js +18 -0
  54. package/dist/edit-lock/index.d.ts +354 -0
  55. package/dist/edit-lock/index.js +1 -0
  56. package/dist/editor/editor.css +58 -0
  57. package/dist/editor/index.d.ts +361 -0
  58. package/dist/editor/index.js +9 -0
  59. package/dist/fields/fields.css +207 -0
  60. package/dist/fields/index.d.ts +273 -0
  61. package/dist/fields/index.js +46 -0
  62. package/dist/gold/gold.css +196 -0
  63. package/dist/gold/index.d.ts +280 -0
  64. package/dist/gold/index.js +1 -0
  65. package/dist/icons/index.d.ts +474 -0
  66. package/dist/icons/index.js +1 -0
  67. package/dist/index.d.ts +6 -0
  68. package/dist/index.js +1 -0
  69. package/dist/markup/index.d.ts +452 -0
  70. package/dist/markup/index.js +1 -0
  71. package/dist/menu/index.d.ts +49 -0
  72. package/dist/menu/index.js +15 -0
  73. package/dist/menu/menu.css +254 -0
  74. package/dist/node-ops/index.d.ts +91 -0
  75. package/dist/node-ops/index.js +1 -0
  76. package/dist/panel/index.d.ts +1088 -0
  77. package/dist/panel/index.js +16 -0
  78. package/dist/panel/panel.css +1460 -0
  79. package/dist/pick/index.d.ts +153 -0
  80. package/dist/pick/index.js +14 -0
  81. package/dist/pick/pick.css +235 -0
  82. package/dist/plan-DChbUXdS.d.ts +88 -0
  83. package/dist/rail/index.d.ts +145 -0
  84. package/dist/rail/index.js +1 -0
  85. package/dist/rail/rail.css +175 -0
  86. package/dist/render/index.d.ts +117 -0
  87. package/dist/render/index.js +5 -0
  88. package/dist/resolve-D68pb3Bx.d.ts +57 -0
  89. package/dist/shell/index.d.ts +159 -0
  90. package/dist/shell/index.js +1 -0
  91. package/dist/shell/shell.css +122 -0
  92. package/dist/strings/catalogue.d.ts +141 -0
  93. package/dist/strings/catalogue.js +1 -0
  94. package/dist/strings/index.d.ts +56 -0
  95. package/dist/strings/index.js +2 -0
  96. package/dist/style-clipboard/index.d.ts +184 -0
  97. package/dist/style-clipboard/index.js +1 -0
  98. package/dist/tree/index.d.ts +173 -0
  99. package/dist/tree/index.js +1 -0
  100. package/dist/tree/tree.css +618 -0
  101. package/dist/types-41704JE4.d.ts +112 -0
  102. package/dist/types-CEqUFH2j.d.ts +129 -0
  103. package/dist/types-CuNiSnX6.d.ts +204 -0
  104. package/dist/types-DNrn_w4V.d.ts +88 -0
  105. package/dist/types-Dy6oR6Z2.d.ts +153 -0
  106. package/dist/types-pGBXevBU.d.ts +131 -0
  107. package/dist/useNodeOps-BF0fQsif.d.ts +68 -0
  108. package/dist/watch-DmasQA61.d.ts +60 -0
  109. package/dist/wordFit-9B9nqyf3.d.ts +35 -0
  110. package/dist/words-B2YLaKEr.d.ts +30 -0
  111. package/dist/words-B87GIFWH.d.ts +86 -0
  112. package/dist/words-BK-npta-.d.ts +27 -0
  113. package/dist/words-CD3WADyb.d.ts +51 -0
  114. package/dist/words-CsRWXkY4.d.ts +129 -0
  115. package/dist/words-D9ChvbNC.d.ts +52 -0
  116. package/dist/words-DOhF-4D4.d.ts +35 -0
  117. package/dist/words-DagJdwIA.d.ts +78 -0
  118. package/dist/words-DfxEp_RH.d.ts +142 -0
  119. package/package.json +202 -3
@@ -0,0 +1,219 @@
1
+ import * as react from 'react';
2
+ import { T as TopBarProps, a as TopBarClusterProps, b as TopBarRailProps, E as EditorIconButtonProps, D as DeviceSwitchProps, c as SaveStateProps, d as SaveStateToggleProps, P as PanelResizeHandleProps, I as InspectorHeadProps, e as InspectorIconButtonProps, f as InspectorUpLevelProps, g as EditNoticeProps } from '../types-CuNiSnX6.js';
3
+ export { h as DEFAULT_PANEL_W, i as DeviceOption, M as MAX_PANEL_W, j as MIN_PANEL_W, k as PanelSide, l as PanelWidths, S as SaveTone, m as clampPanelWidth, p as panelWidthVars } from '../types-CuNiSnX6.js';
4
+ import { LockWords, EditAccess, SaveConflict } from '../edit-lock/index.js';
5
+ import { N as NoticeWords } from '../words-DagJdwIA.js';
6
+ export { C as ChromeWords } from '../words-DagJdwIA.js';
7
+ import '../types-DNrn_w4V.js';
8
+ import '../wordFit-9B9nqyf3.js';
9
+
10
+ /**
11
+ * The editor's top bar — 52px, white, a soft shadow, three clusters.
12
+ *
13
+ * Lifted from the website editor's `.sf-topbar` (efficient-shop). Its order is a
14
+ * decision, not a layout accident, so it is written here once:
15
+ *
16
+ * rail what the LEFT panel contains (Add, Layers, styles…). Exactly the left
17
+ * panel's width, so the column reads top of the screen down.
18
+ * centre what you DID (undo, redo) | divider | what you are LOOKING AT (the
19
+ * device, which side panels are open). One divider, never two.
20
+ * right what you DO next: the save state, ghost buttons, one primary button.
21
+ *
22
+ * Hook-free, directive-free: a server component may import it.
23
+ */
24
+ declare function EditorTopBar({ children }: TopBarProps): react.JSX.Element;
25
+ declare function TopBarCluster({ kind, style, children }: TopBarClusterProps): react.JSX.Element;
26
+ /**
27
+ * The bar's ONE divider: between what you did (undo / redo) and what you are
28
+ * looking at (device, panels). A second one splits the very run this order makes.
29
+ */
30
+ declare function TopBarDivider(): react.JSX.Element;
31
+
32
+ /**
33
+ * The rail in the top bar: the left column of the bar (exactly the left panel's
34
+ * width, carrying its hairline — `.es-cluster--rail`) holding an `EditorRail` in
35
+ * `orientation="row"`, wearing its words by THE SETTINGS TABS' RULE (owner,
36
+ * 2026-09-18: "the rule must be the same as the top tabs of the right settings
37
+ * panel"):
38
+ *
39
+ * every word when every button fits with its word;
40
+ * chosen word otherwise the glyphs plus the open panel's word;
41
+ * glyphs only when even that does not fit.
42
+ *
43
+ * THE WIDTH IS CSS'S QUESTION, NOT THIS COMPONENT'S. The column is a container
44
+ * (`.es-rail-fit`), and the word-fit rule in `panel.css` — the one the
45
+ * segmented control reads — compares it with the words' widths as the person
46
+ * drags the panel, with no script running. 0.48.0 decided the same thing here
47
+ * in JS, all-or-nothing, re-measuring the column on every resize; that rule is
48
+ * gone, so there is one.
49
+ *
50
+ * WHAT IS LEFT HERE IS THE ONE THING CSS CANNOT DO: say how wide a word is. The
51
+ * words are measured on a canvas in the rail's own type (no hidden copy of the
52
+ * rail in the page) once, again when the labels change, and once the web fonts
53
+ * have loaded. On a server, and anywhere a canvas cannot measure, there is no
54
+ * measurement and the rail is icon-only, which always fits.
55
+ */
56
+ declare function TopBarRail({ items, ariaLabel }: TopBarRailProps): react.JSX.Element;
57
+
58
+ /**
59
+ * A 30px glyph button in the top bar — undo, redo, the panel toggles.
60
+ *
61
+ * The label is the tooltip AND the accessible name, and it is required: an
62
+ * icon-only button has no other name, and "button" is all a screen reader would
63
+ * say. `state` is for a toggle; a plain action leaves it off.
64
+ */
65
+ declare function EditorIconButton({ label, onClick, disabled, state, buttonRef, children }: EditorIconButtonProps): react.JSX.Element;
66
+
67
+ /**
68
+ * Which device the canvas previews — icon-only, one button held down.
69
+ *
70
+ * Lifted from `efficient-shop/components/DeviceSwitch.tsx`. It takes its devices
71
+ * as a list because the two editors do not preview the same set: the website
72
+ * has Desktop / Tablet / Mobile, an email has Desktop / Phone. The drawing, the
73
+ * size and the pressed state are what must match, and those live here.
74
+ *
75
+ * NOT `SettingsSegmented`, deliberately (card 66083): that control edits a value
76
+ * a merchant STORES and draws words. This is toolbar chrome — glyphs sized to
77
+ * the icon buttons around it, editing only transient view state.
78
+ *
79
+ * `aria-pressed` carries the current device. Before card 66083 only a background
80
+ * colour did, so the strip read as unnamed buttons with no current value.
81
+ */
82
+ declare function DeviceSwitch<Id extends string>({ devices, value, onChange, ariaLabel, }: DeviceSwitchProps<Id>): react.JSX.Element;
83
+
84
+ /**
85
+ * The save pill — a dot (or an emptying ring) and, when there is something to
86
+ * say, a few words.
87
+ *
88
+ * Lifted from the website editor's `.sf-savestate`. The words belong to each
89
+ * editor; the dot, its colours, its footprint and the ring are shared, so the
90
+ * two editors say "saved" with the same mark.
91
+ *
92
+ * The ring empties ONCE over `waitMs` and holds empty (`forwards`) until the
93
+ * save lands. It restarts by CSS, not by React: the host keeps `ringRef` and
94
+ * re-adds `is-counting` on a keystroke, so typing never re-renders the chrome.
95
+ * Reduced motion: a steady ring, no countdown.
96
+ */
97
+ declare function SaveState({ tone, label, counting, waitMs, ringRef, role }: SaveStateProps): react.JSX.Element;
98
+ /**
99
+ * The pill as the autosave on / off switch. A bare `<button>` — a native button
100
+ * ignores author background and border on some platforms — so the inner
101
+ * `SaveState` carries every visual and this adds hover and a focus ring.
102
+ */
103
+ declare function SaveStateToggle({ pressed, title, onToggle, children }: SaveStateToggleProps): react.JSX.Element;
104
+
105
+ /**
106
+ * A drag grip on a side panel's inner edge.
107
+ *
108
+ * Lifted from `efficient-shop/components/PanelResizeHandle.tsx`; the campaign
109
+ * designer carried its own copy of the same idea. It owns NO width: the editor
110
+ * holds and persists it, and the grip only reports a new clamped width through
111
+ * `onResize`. The host renders it as an absolute child of the panel row, pinned
112
+ * over the panel↔canvas seam, so the panels' `overflow: hidden` never clips it.
113
+ *
114
+ * ARIA window splitter: a focusable `separator` with aria-value*, arrows nudge,
115
+ * Home resets, double-click resets.
116
+ *
117
+ * This leaf HAS hooks and touches `document.body` — in handlers and an effect
118
+ * cleanup only, never at module-eval or render. A server component may import
119
+ * the module and must render it inside the host's client boundary.
120
+ */
121
+ declare function PanelResizeHandle({ side, width, min, max, defaultWidth, label, onResize }: PanelResizeHandleProps): react.JSX.Element;
122
+
123
+ /**
124
+ * The top of the settings panel: a type chip, the selected thing's name, its
125
+ * kind, and its actions (duplicate, delete…).
126
+ *
127
+ * Lifted from the website editor's `.sf-insp-head` (SectionEditor.tsx). The name
128
+ * is the panel's `h2` (card 66127): without a heading a screen-reader user can
129
+ * neither jump to the panel nor hear what it is. `.es-insp-name` states its own
130
+ * margin, size and weight, so being an h2 moves nothing on screen.
131
+ */
132
+ declare function InspectorHead({ icon, name, kind, actions }: InspectorHeadProps): react.JSX.Element;
133
+ /** A 28px glyph button in the inspector head. Named, like every icon-only button. */
134
+ declare function InspectorIconButton({ label, title, hasPopup, onClick, disabled, danger, expanded, buttonRef, children, }: InspectorIconButtonProps): react.JSX.Element;
135
+ /**
136
+ * ↰ GO UP ONE LEVEL — one row at the top of the settings panel, naming the
137
+ * level above what is selected and selecting it when pressed. Lifted from the
138
+ * campaign designer's UpLevelControl (card 66042), where it moved off the
139
+ * canvas so a merchant could climb TWICE (Block → Column → Section).
140
+ *
141
+ * The WHOLE row is the button, glyph and name: the name of where you are going
142
+ * is the part that reads as the thing to press. The host renders nothing when
143
+ * there is no level above (efficient-easel/node-ops `parentStep` says so) — a
144
+ * dead control would be permanent furniture on the level selected most.
145
+ */
146
+ declare function InspectorUpLevel({ name, onSelect, icon, label }: InspectorUpLevelProps): react.JSX.Element;
147
+
148
+ /**
149
+ * The bar that says why edits are not being saved — somebody else holds the
150
+ * document, or a save was refused. Never a dialog (blueprint 2.5): the operator
151
+ * has to be able to read and copy from the screen it is warning them about.
152
+ *
153
+ * The host places it (under the top bar, above the canvas) and owns the
154
+ * handlers; the words are `editNotice`'s. Renders nothing when there is nothing
155
+ * to say, so a host can mount it unconditionally.
156
+ *
157
+ * The sentences are in the language of the strings provider above it
158
+ * (`efficient-easel/strings`), English with none. `noun` is the host's, and is
159
+ * the host's to translate.
160
+ */
161
+ declare function EditNotice({ access, conflict, noun, onTakeOver, onViewReadOnly, onReload }: EditNoticeProps): react.JSX.Element | null;
162
+
163
+ /**
164
+ * What to tell the operator when their edits cannot be saved — somebody else is
165
+ * in the document, or a save was refused — as words, for `EditNotice` to draw
166
+ * (blueprint step 2.5).
167
+ *
168
+ * The two editors said this differently: the campaign designer in a strip under
169
+ * its top bar (`EditLockBanner`, efficient-admin-portal
170
+ * `src/components/email/CampaignDesigner.tsx`), the website editor in modal
171
+ * dialogs over the canvas (`PageEditGuardNotices`, efficient-shop
172
+ * `components/PageEditGuardNotices.tsx`), which said "choosing one for both is a
173
+ * design ruling nobody has made". The blueprint made it: a bar, never a dialog,
174
+ * the save conflict included. A dialog stops the operator reading the very
175
+ * screen it tells them to copy from.
176
+ *
177
+ * The rules both kept, and keep here:
178
+ * - a refused save outranks the lock — it is the one that has already cost work;
179
+ * - it names a person, says how long ago in words the SERVER measured, and
180
+ * never blames a colleague for what you did in your own second tab;
181
+ * - every state offers a way on (the lock is advisory), and nothing here
182
+ * throws work away except the button that says it will.
183
+ */
184
+
185
+ type EditNoticeAction = 'reload' | 'take-over' | 'take-back' | 'view-read-only';
186
+ type EditNoticeContent = {
187
+ /** `warning` for a state that is costing (or about to cost) edits; `neutral` otherwise. */
188
+ tone: 'warning' | 'neutral';
189
+ /** Work is at risk right now: read out at once (`role="alert"`). */
190
+ urgent: boolean;
191
+ /** The sentence that names what happened — drawn bold. */
192
+ lead: string;
193
+ /** What it means for the operator's work. */
194
+ body: string;
195
+ actions: {
196
+ kind: EditNoticeAction;
197
+ label: string;
198
+ title?: string;
199
+ }[];
200
+ };
201
+ /**
202
+ * The two groups of words a notice is written in: its own sentences, and the
203
+ * edit lock's "2 minutes ago" / "Someone else". The whole catalogue fits —
204
+ * `editNotice(access, conflict, noun, useEditorStrings())`.
205
+ */
206
+ type EditNoticeWords = {
207
+ notice: NoticeWords;
208
+ lock: LockWords;
209
+ };
210
+ /**
211
+ * The notice for this access and conflict, or `null` when there is nothing to
212
+ * say. `noun` is what the document is called in a sentence: `'email'`, `'page'`.
213
+ *
214
+ * `words` is the host's language (0.95.0); left out, the notice is the English
215
+ * it always was.
216
+ */
217
+ declare function editNotice(access: EditAccess, conflict: SaveConflict | null, noun: string, words?: EditNoticeWords): EditNoticeContent | null;
218
+
219
+ export { DeviceSwitch, DeviceSwitchProps, EditNotice, type EditNoticeAction, type EditNoticeContent, EditNoticeProps, type EditNoticeWords, EditorIconButton, EditorIconButtonProps, EditorTopBar, InspectorHead, InspectorHeadProps, InspectorIconButton, InspectorIconButtonProps, InspectorUpLevel, InspectorUpLevelProps, NoticeWords, PanelResizeHandle, PanelResizeHandleProps, SaveState, SaveStateProps, SaveStateToggle, SaveStateToggleProps, TopBarCluster, TopBarClusterProps, TopBarDivider, TopBarProps, TopBarRail, editNotice };
@@ -0,0 +1,21 @@
1
+ import{DEFAULT_NOTICE_WORDS as e,DEFAULT_CHROME_WORDS as n}from"../chunk-KDIVA6WD.js";import{holderOf as t,describeAge as i,nameOrSomeone as a}from"../chunk-TDA4HH54.js";import{DEFAULT_LOCK_WORDS as r}from"../chunk-RE4LP46F.js";import{railTokens as o,EditorRail as s}from"../chunk-YIMRTIBN.js";import{DEFAULT_RAIL_WORDS as l}from"../chunk-2OAZYSWJ.js";import{useWords as c}from"../chunk-MFIRYGHW.js";import"../chunk-BZ5ASXOL.js";import{jsx as d,jsxs as u}from"react/jsx-runtime";import{useRef as m,useState as p,useCallback as v,useEffect as h,useLayoutEffect as b}from"react";function f({children:e}){/* @__PURE__ */
2
+ return d("div",{className:"es-topbar",children:e})}function k({kind:e,style:n,children:t}){/* @__PURE__ */
3
+ return d("div",{className:e?`es-cluster es-cluster--${e}`:"es-cluster",style:n,children:t})}function g(){/* @__PURE__ */
4
+ return d("div",{className:"es-divider-v","aria-hidden":"true"})}var y="undefined"==typeof window?h:b;function w({items:e,ariaLabel:n}){const t=c("rail",l),i=m(null),[a,r]=p(void 0),u=JSON.stringify(e.map(e=>e.label));return y(()=>{const n=i.current?.querySelector(".es-rail");if(!n)return;const t=document.createElement("canvas").getContext?.("2d")??null,a=()=>{if(!t)return r(void 0);const i=function(e,n,t){const i=parseFloat(getComputedStyle(e).getPropertyValue(n));return Number.isFinite(i)?i:t}(n,"--es-rail-word-size",o.wordFontSize),a=getComputedStyle(n).getPropertyValue("--es-rail-word-weight").trim()||String(o.wordFontWeight),s=getComputedStyle(n.querySelector(".es-rail-btn")??n).fontFamily;t.font=`${a} ${i}px ${s}`;const l=e.map(e=>t.measureText(e.label).width),c=e=>Math.ceil(4*e)/4;r({labelsPx:c(l.reduce((e,n)=>e+n,0)),widestLabelPx:c(Math.max(0,...l))})};a();let s=!0;return document.fonts?.ready.then(()=>s&&a()),()=>{s=!1}},[u]),/* @__PURE__ */d("div",{ref:i,className:"es-cluster es-cluster--rail es-rail-fit",children:/* @__PURE__ */d(s,{items:e,ariaLabel:n??t.label,orientation:"row",wordFit:a})})}function N({label:e,onClick:n,disabled:t,state:i,buttonRef:a,children:r}){/* @__PURE__ */
5
+ return d("button",{ref:a,type:"button",className:i?`es-iconbtn es-iconbtn--${i}`:"es-iconbtn",title:e,"aria-label":e,disabled:t,onClick:n,children:r})}function x({devices:e,value:t,onChange:i,ariaLabel:a}){const r=c("chrome",n);/* @__PURE__ */
6
+ return d("div",{className:"es-devseg",role:"group","aria-label":a??r.device,children:e.map(e=>{const n=e.id===t;/* @__PURE__ */
7
+ return d("button",{type:"button",title:e.label,"aria-label":e.label,"aria-pressed":n,className:n?"is-active":void 0,onClick:()=>{n||i(e.id)},children:e.icon},e.id)})})}var C={idle:"is-quiet",saved:"is-quiet is-saved",saving:"is-saving",error:"is-error",off:"is-off","off-unsaved":"is-off is-unsaved"};function O({tone:e,label:n,counting:t,waitMs:i,ringRef:a,role:r}){/* @__PURE__ */
8
+ return u("span",{className:`es-savestate ${C[e]}`,role:r,"aria-live":"polite",children:[/* @__PURE__ */d("span",t?{ref:a,className:"es-savestate-ring is-counting",style:void 0!==i?{"--es-savewait":`${i}ms`}:void 0,"aria-hidden":"true"}:{className:"es-savestate-dot","aria-hidden":"true"}),n]})}function P({pressed:e,title:n,onToggle:t,children:i}){/* @__PURE__ */
9
+ return d("button",{type:"button",className:"es-savestate-toggle","aria-pressed":e,title:n,onClick:t,children:i})}var S="es-col-resizing";function L({side:e,width:t,min:i,max:a,defaultWidth:r,label:o,onResize:s}){const l=c("chrome",n),u=m(null),p=v((n,t)=>{const r="left"===e?n+t:n-t;return Math.round(Math.min(a,Math.max(i,r)))},[e,i,a]),b=v(e=>{u.current&&(u.current=null,document.body.classList.remove(S),e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))},[]),f=v(e=>{0===e.button&&(u.current={x:e.clientX,w:t,moved:!1},e.currentTarget.setPointerCapture(e.pointerId),document.body.classList.add(S))},[t]),k=v(e=>{const n=u.current;if(!n)return;if(0===e.buttons)return void b(e);const t=e.clientX-n.x;if(!n.moved){if(Math.abs(t)<3)return;n.moved=!0}s(p(n.w,t))},[s,p,b]),g=v(e=>{"ArrowLeft"===e.key?(e.preventDefault(),s(e=>p(e,-16))):"ArrowRight"===e.key?(e.preventDefault(),s(e=>p(e,16))):"Home"===e.key&&(e.preventDefault(),s(r))},[s,p,r]);return h(()=>()=>document.body.classList.remove(S),[]),/* @__PURE__ */d("div",{className:`es-resizer es-resizer--${e}`,role:"separator",tabIndex:0,"aria-orientation":"vertical","aria-label":o,"aria-valuenow":t,"aria-valuemin":i,"aria-valuemax":a,title:l.resize,onPointerDown:f,onPointerMove:k,onPointerUp:b,onPointerCancel:b,onLostPointerCapture:b,onDoubleClick:()=>s(r),onKeyDown:g,children:/* @__PURE__ */d("span",{className:"es-resizer-bar","aria-hidden":"true"})})}function M({icon:e,name:n,kind:t,actions:i}){/* @__PURE__ */
10
+ return u("div",{className:"es-insp-head",children:[
11
+ /* @__PURE__ */d("span",{className:"es-insp-chip","aria-hidden":"true",children:e}),
12
+ /* @__PURE__ */u("div",{className:"es-insp-titles",children:[
13
+ /* @__PURE__ */d("h2",{className:"es-insp-name",children:n}),
14
+ /* @__PURE__ */d("div",{className:"es-insp-kind",children:t})]}),i?/* @__PURE__ */d("div",{className:"es-insp-actions",children:i}):null]})}function B({label:e,title:n,hasPopup:t,onClick:i,disabled:a,danger:r,expanded:o,buttonRef:s,children:l}){/* @__PURE__ */
15
+ return d("button",{ref:s,type:"button",className:r?"es-insp-iconbtn es-insp-iconbtn--danger":"es-insp-iconbtn",title:n??e,"aria-label":e,"aria-haspopup":t,"aria-expanded":o,disabled:a,onClick:i,children:l})}function R({name:e,onSelect:t,icon:i,label:a}){const r=c("chrome",n),o=a??r.upLevel;/* @__PURE__ */
16
+ return d("div",{className:"es-insp-up",children:/* @__PURE__ */u("button",{type:"button",className:"es-insp-up-btn",title:o,"aria-label":r.upLevelTo({label:o,name:e}),onClick:t,children:[i?/* @__PURE__ */d("span",{className:"es-insp-up-icon","aria-hidden":"true",children:i}):null,
17
+ /* @__PURE__ */d("span",{className:"es-insp-up-name",children:e})]})})}var $={notice:e,lock:r};function D(e,n,r,o=$){const s=o.notice,l=t(e),c={kind:"reload",label:s.reload};if(n){const e=i(n.secondsAgo,o.lock);return{tone:"warning",urgent:!0,lead:n.savedByYou?s.savedByYou({noun:r,when:e}):s.savedByOther({name:a(n.savedBy,o.lock),noun:r,when:e}),body:s.conflictBody,actions:l?[c,{kind:"take-over",label:s.takeOver,title:s.takeOverWhileDeciding}]:[c]}}if(!l)return null;const d=a(l.name,o.lock),u=i(l.secondsSinceSeen,o.lock);switch(e.kind){case"takenover":return{tone:"warning",urgent:!0,lead:s.tookOver({name:d,noun:r,when:i(l.secondsSinceHeld,o.lock)}),body:s.tookOverBody,actions:[{kind:"take-back",label:s.takeBack},c]};case"readonly":return{tone:"neutral",urgent:!1,lead:s.viewingOnly,body:s.viewingOnlyBody({name:d,noun:r,seen:u}),actions:[{kind:"take-over",label:s.takeOver}]};default:return{tone:"warning",urgent:!1,lead:s.editing({name:d,noun:r}),body:s.editingBody({seen:u}),actions:[{kind:"view-read-only",label:s.viewReadOnly},{kind:"take-over",label:s.takeOver,title:s.takeOverTold}]}}}function T({access:n,conflict:t,noun:i,onTakeOver:a,onViewReadOnly:o,onReload:s}){const l=D(n,t,i,{notice:c("notice",e),lock:c("lock",r)});if(!l)return null;const m={reload:s,"take-over":a,"take-back":a,"view-read-only":o};/* @__PURE__ */
18
+ return u("div",{className:`es-notice is-${l.tone}`,role:l.urgent?"alert":"status",children:[
19
+ /* @__PURE__ */u("span",{className:"es-notice-text",children:[
20
+ /* @__PURE__ */d("strong",{children:l.lead})," ",l.body]}),
21
+ /* @__PURE__ */d("span",{className:"es-notice-actions",children:l.actions.map(e=>/* @__PURE__ */d("button",{type:"button",className:"es-notice-btn",title:e.title,onClick:m[e.kind],children:e.label},e.kind))})]})}var j={left:288,right:320},z=220,F=560;function I(e){return Math.min(560,Math.max(220,Math.round(e)))}function A(e){return{"--es-left-w":`${e.left}px`,"--es-right-w":`${e.right}px`}}export{j as DEFAULT_PANEL_W,x as DeviceSwitch,T as EditNotice,N as EditorIconButton,f as EditorTopBar,M as InspectorHead,B as InspectorIconButton,R as InspectorUpLevel,F as MAX_PANEL_W,z as MIN_PANEL_W,L as PanelResizeHandle,O as SaveState,P as SaveStateToggle,k as TopBarCluster,g as TopBarDivider,w as TopBarRail,I as clampPanelWidth,D as editNotice,A as panelWidthVars};
@@ -0,0 +1 @@
1
+ import{MARKUP_TOOLS as e,MARK_PLACEHOLDERS as t}from"./chunk-6OPSJGAI.js";var i={formatting:"Formatting",alignment:"Alignment",align:{left:"Left",center:"Center",right:"Right",justify:"Justify"},link:{title:"Link",label:"Link to",placeholder:"https://… or /page",refused:"Use a web address (https://…), a page on this site (/…), mailto: or tel:.",remove:"Remove link",apply:"Apply"},marks:Object.fromEntries(e.map(e=>[e.style,{name:e.name??e.title,title:e.title}])),placeholders:t};export{i as DEFAULT_COPY_WORDS};
@@ -0,0 +1 @@
1
+ var r={label:"Editor"};export{r as DEFAULT_RAIL_WORDS};
@@ -0,0 +1,13 @@
1
+ import{DEFAULT_PANEL_WORDS as e}from"./chunk-7A7O2JWQ.js";import{jsx as a,jsxs as l,Fragment as i}from"react/jsx-runtime";import{isValidElement as n,cloneElement as s}from"react";function r({items:i,activeId:n,onSelect:s,ariaLabel:r=e.settings,className:t}){
2
+ /* @__PURE__ */
3
+ return a("div",{className:"es-tabs-fit",children:/* @__PURE__ */a("div",{role:"tablist","aria-label":r,"aria-orientation":"horizontal",className:t?`es-tabs ${t}`:"es-tabs",children:i.map(e=>{const i=e.id===n,r=`es-tab${e.icon?" has-icon":""}${i?" is-active":""}`;/* @__PURE__ */
4
+ return l("button",{type:"button",role:"tab",id:e.htmlId,title:e.label,"aria-label":e.label,"aria-selected":i,"aria-controls":e.panelId,className:r,onClick:()=>s(e.id),children:[e.icon?/* @__PURE__ */a("span",{className:"es-tab-icon","aria-hidden":"true",children:e.icon}):null,
5
+ /* @__PURE__ */a("span",{className:"es-tab-word",children:e.label}),"number"==typeof e.badge&&e.badge>0?/* @__PURE__ */a("span",{className:"es-tab-badge",children:e.badge}):null]},e.id)})})})}function t({checked:e,onChange:l,disabled:i,id:n,ariaLabel:s,ariaLabelledBy:r,className:t}){/* @__PURE__ */
6
+ return a("button",{type:"button",role:"switch",id:n,"aria-checked":e,"aria-label":s,"aria-labelledby":r,disabled:i,className:t?`es-switch ${t}`:"es-switch",onClick:()=>l(!e)})}function c(e){return Array.isArray(e)?e.some(c):n(e)}function d(e,a,l){if(!n(e)||e.type!==t)return e;const i=e.props;return i.ariaLabel||i.ariaLabelledBy?e:s(e,l?{ariaLabelledBy:l}:{ariaLabel:a})}function o({label:e,labelId:n,icon:s,value:r,hint:t,changed:o,htmlFor:u,action:h,children:b,className:m}){const p=c(b),N=c(h);if(!p&&!N)return null;const f=["es-field"];p||f.push("is-inline"),o&&f.push("is-changed"),m&&f.push(m);const g=/* @__PURE__ */l(i,{children:[s?/* @__PURE__ */a("span",{className:"es-field-icon","aria-hidden":"true",children:s}):null,
7
+ /* @__PURE__ */a("span",{className:"es-field-label",id:n,children:e})]});/* @__PURE__ */
8
+ return l("div",{className:f.join(" "),children:[
9
+ /* @__PURE__ */l("div",{className:"es-field-head",children:[u?/* @__PURE__ */a("label",{className:"es-field-name",htmlFor:u,children:g}):/* @__PURE__ */a("span",{className:"es-field-name",children:g}),null!=r?/* @__PURE__ */a("span",{className:"es-field-value",children:r}):null,N?d(h,e,n):null]}),p?/* @__PURE__ */a("div",{className:"es-field-ctl",children:b}):null,t?/* @__PURE__ */a("p",{className:"es-field-hint",children:t}):null]})}function u({title:e,open:i,onToggle:n,count:s,id:r,children:t,className:c}){const d=r?`${r}-body`:void 0;/* @__PURE__ */
10
+ return l("div",{className:c?`es-group ${c}`:"es-group",children:[
11
+ /* @__PURE__ */l("button",{type:"button",id:r,"aria-expanded":i,"aria-controls":d,className:"es-group-head",onClick:()=>n(!i),children:[e,"number"==typeof s&&s>0?/* @__PURE__ */a("span",{className:"es-group-count",children:s}):null,
12
+ /* @__PURE__ */a("span",{className:"es-group-sign","aria-hidden":"true"})]}),
13
+ /* @__PURE__ */a("div",{id:d,className:"es-group-body",hidden:!i,children:t})]})}var h=Object.freeze(["Content","Style","Layout","Animation"]);export{h as SETTINGS_BUCKETS,o as SettingsField,u as SettingsGroup,t as SettingsSwitch,r as SettingsTabs};
@@ -0,0 +1 @@
1
+ var e={bold:{fence:"**",placeholder:"bold text"},italic:{fence:"_",placeholder:"italic text"},strike:{fence:"~~",placeholder:"struck out"},code:{fence:"`",placeholder:"code"},highlight:{fence:"==",placeholder:"highlighted text"},quiet:{fence:"^^",placeholder:"quiet text"}},t={bold:e.bold.placeholder,italic:e.italic.placeholder,strike:e.strike.placeholder,code:e.code.placeholder,highlight:e.highlight.placeholder,quiet:e.quiet.placeholder,link:"link text"},n={bullet:()=>"- ",number:e=>`${e+1}. `,quote:()=>"> "};function l(l,i,r,s,o=u,c=t){if("clear"===s)return Q(l,i,r,o);const a=l.slice(i,r);if("link"===s){const e=a||c.link,t=`[${e}](https://)`;return{text:l.slice(0,i)+t+l.slice(r),selectionStart:i+e.length+3,selectionEnd:i+t.length-1}}const h=n[s];if(h){const e=l.lastIndexOf("\n",Math.max(i-1,0))+1,t=l.indexOf("\n",r),n=-1===t?l.length:t,s=l.slice(e,n).split("\n"),o=s.every((e,t)=>e.startsWith(h(t))),c=s.map((e,t)=>o?e.slice(h(t).length):h(t)+e).join("\n");return{text:l.slice(0,e)+c+l.slice(n),selectionStart:e,selectionEnd:e+c.length}}const{fence:d}=e[s],f=c[s],k=l.slice(Math.max(0,i-d.length),i),p=l.slice(r,r+d.length);if(k===d&&p===d)return{text:l.slice(0,i-d.length)+a+l.slice(r+d.length),selectionStart:i-d.length,selectionEnd:i-d.length+a.length};const g=a||f;return{text:l.slice(0,i)+d+g+d+l.slice(r),selectionStart:i+d.length,selectionEnd:i+d.length+g.length}}function i(t,n,l,i){const r=e[i];if(!r)return!1;const{fence:s}=r;return n>=s.length&&t.slice(n-s.length,n)===s&&t.slice(l,l+s.length)===s}function r(e,t,n){const l=0===t?0:e.lastIndexOf("\n",t-1)+1;for(let i=e.lastIndexOf("[",t);i>=l;i=0===i?-1:e.lastIndexOf("[",i-1)){const t=S(e,i);if(t&&n<=t.end)return{start:i,end:t.end,label:t.label,href:t.href}}return null}function s(e,t,n,l){const i=r(e,t,n),s=i?i.start:t,o=i?i.end:n,c=`[${i?i.label:e.slice(t,n)||l}](${l})`,a=s+c.length;return{text:e.slice(0,s)+c+e.slice(o),selectionStart:a,selectionEnd:a}}function o(e,t){return{text:e.slice(0,t.start)+t.label+e.slice(t.end),selectionStart:t.start,selectionEnd:t.start+t.label.length}}var c=[{style:"bold",label:"B",name:"Strong",title:"Strong · **words** · ⌘B",shortcut:"b"},{style:"italic",label:"I",name:"Italic",title:"Italic · _words_ · ⌘I",shortcut:"i"},{style:"strike",label:"S",name:"Strikethrough",title:"Strikethrough · ~~words~~"},{style:"highlight",label:"◆",name:"Emphasis",title:"Emphasis · ==words=="},{style:"quiet",label:"a",name:"Quiet",title:"Quiet · ^^words^^"},{style:"code",label:"‹›",name:"Code",title:"Code"},{style:"link",label:"🔗",name:"Link",title:"Link · [words](https://…) · ⌘K",shortcut:"k"},{style:"bullet",label:"•",name:"Bulleted list",title:"Bulleted list"},{style:"number",label:"1.",name:"Numbered list",title:"Numbered list"},{style:"quote",label:"❝",name:"Quote",title:"Quote"},{style:"clear",label:"T×",name:"Clear marks",title:"Clear marks · ⌘⇧X",shortcut:"shift+x"}],a={bold:"Strong",highlight:"Emphasis",quiet:"Quiet"};function h(e){return c.filter(t=>e.includes(t.style))}var u=[{open:"**",close:"**",kind:"bold"},{open:"==",close:"==",kind:"highlight"},{open:"~~",close:"~~",kind:"strike"},{open:"_",close:"_",kind:"italic",wordBoundary:!0},{open:"^^",close:"^^",kind:"quiet"},{open:"@@",close:"@@",kind:"highlight"},{open:"++",close:"++",kind:"bold"}],d=c.map(e=>e.style).filter(e=>u.some(t=>t.kind===e)),f=[...u,{open:"*",close:"*",kind:"accent"}],k=[...u,{open:"*",close:"*",kind:"accent"},{open:"#",close:"#",kind:"bold",notBefore:"0123456789"},{open:"[",close:"]",kind:"italic",notBefore:"("}];function p(e){return!/\s/.test(e)&&!/[!-\/:-@[-`{-~]/.test(e)}function g(e,t){const n=[];let l="",i=0;for(;i<e.length;){const r=m(e,i,t);r?(n.push({kind:"text",text:l}),l="",n.push({kind:r.rule.kind,text:r.inner}),i=r.end):(l+=e[i],i+=1)}return n.push({kind:"text",text:l}),n}function m(e,t,n){for(const l of n){if(!e.startsWith(l.open,t))continue;if(l.wordBoundary&&t>0&&p(e[t-1]))continue;const n=t+l.open.length,i=e.indexOf(l.close,n);if(i<n+1)continue;const r=e.slice(n,i);if(r.includes(l.close[0]))continue;if(r.includes("\n"))continue;const s=i+l.close.length,o=e[s];if((!l.notBefore||void 0===o||!l.notBefore.includes(o))&&(!l.wordBoundary||void 0===o||!p(o)))return{rule:l,inner:r,end:s}}return null}function x(e,t){return g(e,t).map(e=>e.text).join("")}var b=["http","https","mailto","tel"];function y(e){if(""===e||/[\s\u0000-\u001f\u007f]/.test(e))return!1;const t=/^([a-zA-Z][a-zA-Z0-9+.-]*):/.exec(e);return!t||b.includes(t[1].toLowerCase())}function S(e,t){if("["!==e[t])return null;const n=e.indexOf("]",t+1);if(n<t+2||"("!==e[n+1])return null;const l=e.slice(t+1,n);if(l.includes("["))return null;const i=e.indexOf(")",n+2);if(-1===i)return null;const r=e.slice(n+2,i);return y(r)?{label:l,href:r,end:i+1}:null}var v=2;function w(e,t,n){const l=[];let i="";const r=()=>{i&&l.push({kind:"text",text:i}),i=""},s=e=>n+1<v?w(e,t,n+1):[{kind:"text",text:e}];let o=0;for(;o<e.length;){const n=S(e,o);if(n){r(),l.push({kind:"link",href:n.href,children:s(n.label)}),o=n.end;continue}const c=m(e,o,t);c?(r(),l.push({kind:c.rule.kind,open:c.rule.open,close:c.rule.close,children:s(c.inner)}),o=c.end):(i+=e[o],o+=1)}return r(),l}function E(e,t){return e.split("\n").map(e=>{const n=e.startsWith("- ")&&""!==e.slice(2).trim();return{bullet:n,children:w(n?e.slice(2):e,t,0)}})}function B(e){return e.map(e=>"text"===e.kind?e.text:"link"===e.kind?`[${B(e.children)}](${e.href})`:e.open+B(e.children)+e.close).join("")}function q(e){return e.map(e=>(e.bullet?"- ":"")+B(e.children)).join("\n")}function O(t,n,l){if("link"===n)return void 0===l?null:{id:t,kind:"link",open:"[",close:`](${l})`,href:l};const i=e[n];return i&&"code"!==n?{id:t,kind:n,open:i.fence,close:i.fence}:null}function I(e,t){let n=0,l=0;return e.split("\n").map(e=>{const[i]=E(e,t);let r=l+(i.bullet?2:0);l+=e.length+1;const s=[],o=(e,t)=>{for(const l of e){if("text"===l.kind){for(const e of l.text)s.push({ch:e,marks:t,at:r}),r+=e.length;continue}const e="link"===l.kind?O(++n,"link",l.href):{id:++n,kind:l.kind,open:l.open,close:l.close};r+=e.open.length,o(l.children,[...t,e]),r+=e.close.length}};return o(i.children,[]),{bullet:i.bullet,chars:s}})}function $(e){let t="";const n=[];return e.forEach((e,l)=>{l>0&&(t+="\n"),e.bullet&&(t+="- ");const i=[],r=[];for(const n of e.chars){let e=0;for(;e<i.length&&e<n.marks.length&&i[e].id===n.marks[e].id;)e+=1;for(;i.length>e;)t+=i.pop().close;for(let l=e;l<n.marks.length;l+=1)t+=n.marks[l].open,i.push(n.marks[l]);r.push(t.length),t+=n.ch}for(;i.length>0;)t+=i.pop().close;n.push(r)}),{text:t,at:n}}function C(e,t){return e.length===t.length&&e.every((e,n)=>{const l=t[n];return e.bullet===l.bullet&&e.chars.length===l.chars.length&&e.chars.every((e,t)=>{const n=l.chars[t];return e.ch===n.ch&&e.marks.length===n.marks.length&&e.marks.every((e,t)=>e.kind===n.marks[t].kind&&e.href===n.marks[t].href)})})}function Q(e,t,n,l=u){const i=I(e,l),r=i.flatMap(e=>e.chars),s={text:e,selectionStart:t,selectionEnd:n},o=e=>i.map(t=>({bullet:t.bullet,chars:t.chars.map(t=>({...t,marks:t.marks.filter(n=>"link"===n.kind||!e(t,n))}))})),c=e=>{const t=$(e);return C(e,I(t.text,l))?t:null},a=(e,t)=>{let n=r.indexOf(t);for(let t=0;t<e.at.length;t+=1){if(n<e.at[t].length)return e.at[t][n];n-=e.at[t].length}return 0};if(t===n){const e=[...r].reverse().find(e=>e.at<t),n=r.find(e=>e.at>=t),l=new Set([...e?.marks??[],...n?.marks??[]].map(e=>e.id));if(![...l].some(e=>r.some(t=>t.marks.some(t=>t.id===e&&"link"!==t.kind))))return s;const i=c(o((e,t)=>l.has(t.id)));if(!i)return s;const h=n?a(i,n):e?a(i,e)+e.ch.length:0;return{text:i.text,selectionStart:h,selectionEnd:h}}const h=new Set(r.filter(e=>e.at>=t&&e.at<n));if(0===h.size)return s;const d=new Set([...h].flatMap(e=>e.marks.map(e=>e.id))),f=c(o(e=>h.has(e)))??c(o((e,t)=>d.has(t.id)));if(!f)return s;const k=r.find(e=>h.has(e)),p=[...r].reverse().find(e=>h.has(e));return{text:f.text,selectionStart:a(f,k),selectionEnd:a(f,p)+p.ch.length}}export{k as CAMPAIGN_MARKUP,d as COPY_FIELD_TOOLS,c as MARKUP_TOOLS,a as MARK_NAMES,t as MARK_PLACEHOLDERS,u as STANDARD_MARKUP,f as STOREFRONT_MARKUP,l as applyMark,Q as clearMarks,r as findLink,y as isSafeLinkHref,i as markedAt,I as markedLines,h as markupTools,E as parseMarkup,o as removeLink,C as sameMarks,q as serializeMarkup,O as spanFor,x as stripInline,g as tokenizeInline,s as writeLink,$ as writeMarkedLines};
@@ -0,0 +1 @@
1
+ import{zoneKey as e}from"./chunk-KRXQM65X.js";import{useRef as t,useEffect as n,useState as r,useSyncExternalStore as o,useCallback as i}from"react";var c=56,l=16;function u(e){const t=Math.max(e,0);return t>=c?0:Math.ceil(16*(1-t/c))}function a(e,t,n){if(e<t-c||e>n+c)return 0;const r=e-t,o=n-e;return r<c&&r<=o?-u(r):o<c?u(o):0}function s(e){const t=e?.ownerDocument?.defaultView;for(let n=e?.parentElement??null;n;n=n.parentElement){const e=t?.getComputedStyle(n).overflowY;if(("auto"===e||"scroll"===e)&&n.scrollHeight>n.clientHeight)return n}return null}function f(e){const t=e?.ownerDocument?.defaultView?.getComputedStyle(e).overflowY;return e&&("auto"===t||"scroll"===t)&&e.scrollHeight>e.clientHeight?e:s(e)}function d(e){const t=e.ownerDocument,n=t.defaultView;if(!n)return()=>{};let r=null,o=0;const i=e=>{r=e.clientY},c=()=>{if(null!==r){const t=e.getBoundingClientRect(),n=a(r,t.top,t.bottom);n&&(e.scrollTop+=n)}o=n.requestAnimationFrame(c)};return t.addEventListener("dragover",i,!0),o=n.requestAnimationFrame(c),()=>{t.removeEventListener("dragover",i,!0),n.cancelAnimationFrame(o)}}function g(){let e=null,t=null;const n=/* @__PURE__ */new Set,r=()=>{if(t!==e){t=e;for(const e of[...n])e()}};return{get:()=>e,shown:()=>t,start(t){e=t,globalThis.setTimeout(r,0)},end(){null===e&&null===t||(e=null,r())},subscribe:e=>(n.add(e),()=>{n.delete(e)})}}function p(e,t,n,r){if(e.into)return{side:"into",to:e.into};return"first"===e.pinned||"last"!==e.pinned&&t>n+r/2?{side:"after",to:{...e.place,index:e.place.index+1}}:{side:"before",to:{...e.place,index:e.place.index}}}var m=(t,n)=>e(t)===e(n);function v(e,t){return m(e,t)&&(t.index===e.index||t.index===e.index+1)}function D(e,t){return m(e,t)&&e.index<t.index?t.index-1:t.index}function y(e,t){return{...e,index:t<0?e.index-1:e.index+2}}function w(e,t){if(!t)return e;const n={...t,...e};for(const[r,o]of Object.entries(e)){const e=t[r];"function"==typeof o&&"function"==typeof e&&(n[r]=t=>{o(t),e(t)})}return n}function x(c){const l=t(c);n(()=>{l.current=c});const[u]=r(()=>g()),a=c.session??u,m=o(a.subscribe,a.shown,a.shown),[D,y]=r(null),x=t(null),b=i(()=>{x.current?.(),x.current=null},[]),h=i(()=>{b(),a.end(),y(null)},[a,b]);n(()=>a.subscribe(()=>{a.get()||(b(),y(null))}),[a,b]),n(()=>b,[b]);const T=i((e,t)=>{y(n=>n&&n.key===e&&n.side===t?n:{key:e,side:t})},[]),k=i(e=>{y(t=>t&&t.key===e?null:t)},[]),E=(e,t,n,r)=>!("into"===n?r===e.key:void 0!==e.from&&v(e.from,t))&&l.current.canDrop(e.item,t);return{dragging:m?.item??null,row:(e,t)=>{const{keyOf:n,readOnly:r}=l.current,o=n(e.item),i=!r&&!e.pinned&&!1!==e.canDrag,c=t=>{const n=t.currentTarget.getBoundingClientRect();return p(e,t.clientY,n.top,n.height)},u={draggable:i||void 0,onDragStart:i?t=>{const n=t.currentTarget;a.start({key:o,item:e.item,from:e.place}),t.dataTransfer.effectAllowed="move";try{t.dataTransfer.setData("text/plain",o)}catch{}n.classList.add("is-lifting");const r=n.getBoundingClientRect();t.dataTransfer.setDragImage?.(n,t.clientX-r.left,t.clientY-r.top),n.ownerDocument.defaultView?.setTimeout(()=>n.classList.remove("is-lifting"),0);const i=s(n);b(),x.current=i?d(i):null}:void 0,onDragEnd:i?()=>h():void 0,onDragOver:e=>{const t=a.get();if(!t)return;const n=c(e);E(t,n.to,n.side,o)?(e.preventDefault(),e.dataTransfer.dropEffect="move",T(o,n.side)):k(o)},onDrop:e=>{const t=a.get();if(!t)return;const n=c(e);E(t,n.to,n.side,o)&&(e.preventDefault(),h(),l.current.onDrop(t.item,n.to))},onKeyDown:t=>{if("ArrowUp"!==t.key&&"ArrowDown"!==t.key)return;if(!t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)return;if(t.preventDefault(),t.repeat||!i)return;const{onStep:n,canStep:r}=l.current,o="ArrowUp"===t.key?-1:1;n&&!1!==r?.(e.item,o)&&n(e.item,o)}};return{draggable:i,dragging:m?.key===o,drop:D?.key===o?D.side:void 0,rowProps:w(u,t)}},seam:(t,n)=>{const r=(o=t.place,`seam:${e(o)}:${o.index}`);var o;const i={onDragOver:e=>{const n=a.get();n&&(E(n,t.place,"before",r)?(e.preventDefault(),e.dataTransfer.dropEffect="move",T(r,"before")):k(r))},onDrop:e=>{const n=a.get();n&&E(n,t.place,"before",r)&&(e.preventDefault(),h(),l.current.onDrop(n.item,t.place))}};return{drop:D?.key===r,seamProps:w(i,n)}},rootProps:e=>w({onDragEnter:e=>{if(!a.get()||x.current)return;const t=f(e.currentTarget);x.current=t?d(t):null},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||y(null)}},e)}}export{c as AUTO_SCROLL_EDGE,l as AUTO_SCROLL_MAX_SPEED,a as autoScrollDelta,u as autoScrollSpeed,g as createDragSession,p as dropOnRow,D as gapToMoveIndex,v as isNoOpDrop,f as scrollBoxOf,s as scrollParent,d as startAutoScroll,y as stepGap,x as useTreeDrag};
@@ -0,0 +1 @@
1
+ var t={copy:"Copy style",paste:({source:t})=>`Paste style from ${t}`,nothing:({source:t,target:s})=>`Nothing to paste. ${s} has none of ${t}'s style settings.`,pasted:({count:t,source:s})=>`Pasted ${t} setting${1===t?"":"s"} from ${s}.`};export{t as DEFAULT_STYLE_CLIPBOARD_WORDS};
@@ -0,0 +1 @@
1
+ var t={settings:"Settings",buckets:{Content:"Content",Style:"Style",Layout:"Layout",Animation:"Animation"}};export{t as DEFAULT_PANEL_WORDS};
@@ -0,0 +1 @@
1
+ function e(e,t){return{"--es-fit-count":e,"--es-fit-labels":`${t.labelsPx}px`,"--es-fit-widest":`${t.widestLabelPx}px`}}export{e as wordFitVars};
@@ -0,0 +1,13 @@
1
+ import{tokenizeInline as e,STANDARD_MARKUP as t}from"./chunk-6OPSJGAI.js";import{jsx as n,jsxs as l}from"react/jsx-runtime";import{useRef as r}from"react";function s(t,n){const l=[];let r=0;for(const s of e(t,n)){if("text"===s.kind){s.text.length>0&&(l.push({kind:"text",text:t.slice(r,r+s.text.length)}),r+=s.text.length);continue}const e=i(t,r,s.kind,s.text,n);if(!e)return[{kind:"text",text:t}];const o=r+e.open.length,c=o+s.text.length,a=c+e.close.length;l.push({kind:"delimiter",text:t.slice(r,o)}),l.push({kind:s.kind,text:t.slice(o,c)}),l.push({kind:"delimiter",text:t.slice(c,a)}),r=a}return l.map(e=>e.text).join("")!==t?[{kind:"text",text:t}]:l}function i(e,t,n,l,r){for(const s of r){if(s.kind!==n)continue;if(!e.startsWith(s.open,t))continue;const r=t+s.open.length;if(e.startsWith(l,r)&&e.startsWith(s.close,r+l.length))return s}return null}function o({value:e,rules:l=t,className:r,layerRef:i}){const o=s(e,l);/* @__PURE__ */
2
+ return n("div",{ref:i,className:["es-gold-layer",r??""].filter(Boolean).join(" "),"aria-hidden":"true",children:o.map((e,t)=>function(e,t){const{kind:l,text:r}=e;switch(l){case"delimiter":/* @__PURE__ */
3
+ return n("span",{className:"es-gold-delim",children:r},t);case"accent":case"highlight":/* @__PURE__ */
4
+ return n("em",{className:"es-gold-mark es-gold-accent",children:r},t);case"bold":/* @__PURE__ */
5
+ return n("strong",{className:"es-gold-mark es-gold-bold",children:r},t);case"italic":/* @__PURE__ */
6
+ return n("em",{className:"es-gold-mark es-gold-italic",children:r},t);case"strike":/* @__PURE__ */
7
+ return n("s",{className:"es-gold-mark es-gold-strike",children:r},t);case"quiet":/* @__PURE__ */
8
+ return n("span",{className:"es-gold-mark es-gold-quiet",children:r},t);default:/* @__PURE__ */
9
+ return n("span",{className:"es-gold-text",children:r},t)}}(e,t))})}function c({value:e,onInput:s,onCommit:i,onCancel:c,multiline:a=!1,placeholder:u,className:d,rules:f=t,ariaLabel:m,disabled:h=!1,inputRef:g}){const p=r(null),k=r(e),x=r(!1);function v(e){x.current&&(x.current=!1,i?.(e))}/* @__PURE__ */
10
+ return l("div",{className:["es-gold",a?"es-gold-is-multiline":"es-gold-is-single",h?"es-gold-is-off":"",d??""].filter(Boolean).join(" "),children:[
11
+ /* @__PURE__ */n(o,{value:e,rules:f,layerRef:p}),u&&""===e?
12
+ /* @__PURE__ */n("div",{className:"es-gold-placeholder","aria-hidden":"true",children:u}):null,
13
+ /* @__PURE__ */n("textarea",{ref:g,className:"es-gold-input",disabled:h,value:e,placeholder:u,"aria-label":m,onChange:function(e){x.current=!0,s(e.currentTarget.value)},onFocus:function(){k.current=e,x.current=!1},onBlur:function(){v(e)},onKeyDown:function(t){return"Escape"===t.key?(t.preventDefault(),x.current=!1,void c?.(k.current)):"Enter"!==t.key||a?void 0:(t.preventDefault(),void v(e))},onScroll:function(e){const t=p.current;t&&(t.scrollTop=e.currentTarget.scrollTop,t.scrollLeft=e.currentTarget.scrollLeft)}})]})}export{o as GoldLayer,c as GoldTextInput,s as goldSegments};
@@ -0,0 +1 @@
1
+ import{find as t,remove as e,getList as n,newId as r,duplicate as o,move as a,copyNode as c,insert as l,setProps as d}from"./chunk-KRXQM65X.js";import{useRef as s,useSyncExternalStore as i,useCallback as p,useMemo as u}from"react";var f=t=>({kind:"node",id:t});function m(r,o,a,c="none"){const l=t(r,o,a),d=e(r,o,a);if("none"===c||!l)return{data:d,select:null};const s=n(r,o,l.place)??[],i=s[l.place.index+1]??s[l.place.index-1];return i?.props?.id?{data:d,select:f(i.props.id)}:"root"!==l.place.parentId?{data:d,select:f(l.place.parentId)}:{data:d,select:null}}function x(e,n,a,c={}){const l=t(e,n,a)?.node,d=c.id??r(l?.type??"Node");return{data:o(e,n,a,{strip:c.strip,id:d}),select:f(d)}}function I(t,e,n,r){return{data:a(t,e,n,r),select:f(n)}}var v=(t,e)=>({min:0,max:e-1});function b(e,r,o,a,c=v){const l=t(e,r,o);if(!l)return!1;const d=n(e,r,l.place)?.length??0,{min:s,max:i}=c(l.place,d),p=l.place.index+a;return l.place.index>=s&&l.place.index<=i&&p>=s&&p<=i}function g(e,n,r,o,a=v){if(!b(e,n,r,o,a))return null;const c=t(e,n,r);return I(e,n,r,{...c.place,index:c.place.index+o})}function k(t,e,n,r,o={}){const a=c(n,e,{strip:o.strip});return{data:l(t,e,r,a),select:f(a.props.id)}}function y(t,e,n,r){return{data:d(t,e,n,r),select:void 0}}function h(e,n,r,o=()=>!1){if(!r)return null;if("slot"===r.kind)return t(e,n,r.parentId)?f(r.parentId):null;const a=t(e,n,r.id);if(!a||"root"===a.place.parentId)return null;const c=t(e,n,a.place.parentId);return c?o(c.node,a.place.slot)?{kind:"slot",parentId:c.node.props.id,slot:a.place.slot}:f(c.node.props.id):null}function z(e,n,r){if(!r||"node"!==r.kind)return null;const o=t(e,n,r.id);return o?{zone:`${o.place.parentId}:${o.place.slot}`,index:o.place.index}:null}function O(t,e,r){if(!r)return null;const[o,a]=(r.zone??"root:default-zone").split(/:(.*)/s),c={parentId:o,slot:a},l=n(t,e,c)?.[r.index];return l?.props?.id?f(l.props.id):null}var R={get:()=>null,set:()=>{},subscribe:()=>()=>{}};function B(e){const n=s(e);n.current=e;const r=e.clipboard??R,o=i(r.subscribe,r.get,r.get),a=p(t=>{const e=n.current;if(e.readOnly)return!1;const r=t(e.data,e.config);return!!r&&((r.data!==e.data||void 0!==r.select)&&(e.commit(r.data,{select:r.select}),n.current={...e,data:r.data},!0))},[]);return u(()=>{const e=()=>n.current,r=(n,r)=>{const o=t(e().data,e().config,n);return o?{node:o.node,label:r,from:{parentId:o.place.parentId,slot:o.place.slot}}:null};return{held:o,remove:t=>a((n,r)=>m(n,r,t,e().afterRemove)),duplicate:t=>a((n,r)=>x(n,r,t,{strip:e().strip})),move:(t,e)=>a((n,r)=>I(n,r,t,e)),step:(t,n)=>a((r,o)=>g(r,o,t,n,e().stepBounds)),canStep:(t,n)=>b(e().data,e().config,t,n,e().stepBounds),setProps:(t,e)=>a((n,r)=>y(n,r,t,e)),copy:(t,n)=>{const o=r(t,n);return o&&(e().clipboard??R).set(o),!!o},cut:(t,n)=>{if(e().readOnly)return!1;const o=r(t,n);return!!o&&((e().clipboard??R).set(o),a((n,r)=>m(n,r,t,e().afterRemove)))},paste:t=>{const n=(e().clipboard??R).get();return!!n&&a((r,o)=>k(r,o,n.node,t,{strip:e().strip}))},parentOf:t=>h(e().data,e().config,t,e().slotIsLevel)}},[o,a])}export{b as canStep,O as fromItemSelector,h as parentStep,x as planDuplicate,I as planMove,k as planPaste,m as planRemove,y as planSetProps,g as planStep,z as toItemSelector,B as useNodeOps};
@@ -0,0 +1 @@
1
+ var e={accent:"#2563eb",accentTint:"#eff6ff",accentTintStrong:"#dbeafe",accentLine:"#bfdbfe",accentText:"#1d4ed8",accentRing:"rgba(37, 99, 235, 0.25)",accentShadow:"rgba(37, 99, 235, 0.35)",onAccent:"#ffffff",appBg:"#f9fafb",previewBg:"#f3f4f6",panel:"#ffffff",raised:"#ffffff",topbarBg:"#ffffff",frameBg:"#ffffff",hover:"#f3f4f6",hatch:"rgba(0, 0, 0, 0.018)",addcardVeil:"rgba(248, 249, 250, 0.66)",fieldBg:"#ffffff",trackBg:"#f3f4f6",inputBorder:"#d1d5db",fieldText:"#1f2937",fieldPlaceholder:"#9ca3af",knob:"#ffffff",text:"#111827",textStrong:"#030712",textSecondary:"#374151",muted:"#6b7280",icon:"#6b7280",disabled:"#9ca3af",divider:"#e5e7eb",line:"#e5e7eb",btnBorder:"#d1d5db",btnText:"#374151",chipBg:"#f3f4f6",chipFg:"#6b7280",brandSquare:"#111827",deviceBorder:"#e5e7eb",toastBg:"#111827",toggleOff:"#d1d5db",scrollbar:"#d1d5db",scrollbarHover:"#9ca3af",danger:"#dc2626",dangerStrong:"#b91c1c",dangerTint:"#fef2f2",warning:"#b45309",previewTint:"#fef3c7",success:"#15803d",panelRadius:12,rowRadius:8,fieldRadius:6,panelGap:10,panelShadow:"0 1px 2px rgba(0, 0, 0, 0.05), 0 10px 30px rgba(0, 0, 0, 0.06)",topbarShadow:"0 1px 3px rgba(0, 0, 0, 0.06)",raisedShadow:"0 1px 2px rgba(16, 24, 40, 0.1)",font:'-apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif'},a={accent:"--es-accent",accentTint:"--es-accent-tint",accentTintStrong:"--es-accent-tint-strong",accentLine:"--es-accent-line",accentText:"--es-accent-text",accentRing:"--es-accent-ring",accentShadow:"--es-accent-shadow",onAccent:"--es-on-accent",appBg:"--es-app-bg",previewBg:"--es-preview-bg",panel:"--es-panel",raised:"--es-raised",topbarBg:"--es-topbar-bg",frameBg:"--es-frame-bg",hover:"--es-hover",hatch:"--es-hatch",addcardVeil:"--es-addcard-veil",fieldBg:"--es-field-bg",trackBg:"--es-track-bg",inputBorder:"--es-input-border",fieldText:"--es-field-text",fieldPlaceholder:"--es-field-placeholder",knob:"--es-knob",text:"--es-text",textStrong:"--es-text-strong",textSecondary:"--es-text-secondary",muted:"--es-muted",icon:"--es-icon",disabled:"--es-disabled",divider:"--es-divider",line:"--es-line",btnBorder:"--es-btn-border",btnText:"--es-btn-text",chipBg:"--es-chip-bg",chipFg:"--es-chip-fg",brandSquare:"--es-brand-square",deviceBorder:"--es-device-border",toastBg:"--es-toast-bg",toggleOff:"--es-toggle-off",scrollbar:"--es-scrollbar",scrollbarHover:"--es-scrollbar-hover",danger:"--es-danger",dangerStrong:"--es-danger-strong",dangerTint:"--es-danger-tint",warning:"--es-warning",previewTint:"--es-preview-tint",success:"--es-success",panelRadius:"--es-panel-radius",rowRadius:"--es-row-radius",fieldRadius:"--es-field-radius",panelGap:"--es-panel-gap",panelShadow:"--es-panel-shadow",topbarShadow:"--es-topbar-shadow",raisedShadow:"--es-raised-shadow",font:"--es-font"};export{a as shellCssVars,e as shellTokens};
@@ -0,0 +1 @@
1
+ var a={frame:"Canvas"};export{a as DEFAULT_CANVAS_WORDS};
@@ -0,0 +1 @@
1
+ var a={dragHint:"Drag to move · ⌥↑ ⌥↓",collapse:"Collapse",expand:"Expand",collapseNamed:({label:a})=>`Collapse ${a}`,expandNamed:({label:a})=>`Expand ${a}`};export{a as DEFAULT_TREE_WORDS};
@@ -0,0 +1 @@
1
+ var e={stopped:"Auto-save stopped · not saved",pausedUnsaved:"Auto-save off · unsaved",paused:"Auto-save off",failed:"Save failed",unsaved:"Unsaved changes"};function a(a,d=e){return a.stopped?{tone:"off-unsaved",label:d.stopped}:a.paused?a.pending?{tone:"off-unsaved",label:d.pausedUnsaved}:{tone:"off",label:d.paused}:a.failed?{tone:"error",label:d.failed}:a.unsaved?{tone:"saving",label:d.unsaved}:{tone:a.saved?"saved":"idle",label:""}}export{e as DEFAULT_SAVE_WORDS,a as saveIndicator};
@@ -0,0 +1 @@
1
+ var e={reload:"Reload the saved version",takeOver:"Take over editing",takeBack:"Take it back",viewReadOnly:"View read-only",savedByYou:({noun:e,when:n})=>`You saved this ${e} in another tab or window ${n}.`,savedByOther:({name:e,noun:n,when:o})=>`${e} saved this ${n} ${o}.`,conflictBody:"Your last change was not saved. It is still on screen here, but this copy is out of date — copy anything you need, then reload to carry on from the saved version.",takeOverWhileDeciding:"Nobody else can save while you decide. Nothing on your screen is lost.",tookOver:({name:e,noun:n,when:o})=>`${e} took over this ${n} ${o}.`,tookOverBody:"Your changes since then are still on screen but are no longer being saved.",viewingOnly:"Viewing only.",viewingOnlyBody:({name:e,noun:n,seen:o})=>`${e} is editing this ${n} (last seen ${o}). Nothing you change here is saved.`,editing:({name:e,noun:n})=>`${e} is editing this ${n}`,editingBody:({seen:e})=>`(last seen ${e}). Nothing you change here will be saved while they are in it.`,takeOverTold:"They are told straight away and stop being able to save."},n={device:"Preview device",upLevel:"Go up one level",upLevelTo:({label:e,name:n})=>`${e} to ${n}`,resize:"Drag to resize · double-click to reset"};export{n as DEFAULT_CHROME_WORDS,e as DEFAULT_NOTICE_WORDS};
@@ -0,0 +1 @@
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-NKB3KVAB.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 N(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 E(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 J(n,e,r,s){const c=N(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&&P(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 P(p,s)?s:p}function P(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 R(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=N(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;K(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 K(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;K(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 T(d,n)){const e=d[o.from];if(!t(e))continue;const r="edited"===o.kind?n[o.to]:e;K(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 T(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 V(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 q(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 G="root",H="default-zone",L={parentId:G,slot:H},Q=({parentId:t,slot:n})=>`${t}:${n}`;function W(t){const n=t.indexOf(":");if(-1===n)throw new Y("no-slot",`"${t}" is not a zone key`);return{parentId:t.slice(0,n),slot:t.slice(n+1)}}var X=t=>t.parentId===G&&t.slot===H,Y=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 Y("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,L,[],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:G,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(X(o))return Array.isArray(t.content)?t.content:[];const e=t.zones?.[Q(o)];if(o.parentId===G){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(X(o)){const n=Array.isArray(t.content)?t.content:[];return{...t,content:e(n)}}const c=Q(o),p=!!t.zones&&Array.isArray(t.zones[c]);if(o.parentId===G){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 Y("not-found",`no node ${o.parentId}`)}if(p)return{...t,zones:{...t.zones,[c]:e(t.zones[c])}};throw new Y("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 Y("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!==G&&!rt(t,n,o.parentId))throw new Y("not-found",`no node ${o.parentId}`);throw new Y("no-slot",`no slot "${o.slot}" on ${o.parentId}`)}function ut(t,n,o){if(!Number.isInteger(t)||t<0||t>n)throw new Y("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||X(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===G)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 Y("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 Y("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 Y("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 Y("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 Y("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 Y("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 Y("unknown-type","replaceNode: not a node");if(e.props.id!==o)throw new Y("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 Y("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{Y as DataError,G as ROOT_ID,L as ROOT_LIST,H as ROOT_SLOT,E as applyTranslation,l as changedProps,At as copyNode,q as copyTranslation,vt as createNode,f as createResolveCache,a as deepEqual,kt as duplicate,J as extractTranslation,rt as find,st as getList,jt as insert,V as mapIds,Ot as move,Z as newId,gt as normalizeData,W as parseZoneKey,R 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,Q as zoneKey};
@@ -0,0 +1 @@
1
+ import{removeCanvasStyle as e,upsertCanvasStyle as n}from"./chunk-ZNCEOSXO.js";import{useState as t,useEffect as o,useRef as r}from"react";var c="[data-puck-component]",u="iframe#preview-frame";function s(e){const n=e.contentDocument;if(!n||!e.contentWindow||"loading"===n.readyState||!n.body)return!1;if(e.hasAttribute("srcdoc"))return"about:srcdoc"===n.URL;const t=e.getAttribute("src");return!t||"about:blank"===t||"about:blank"!==n.URL}function i(e,n,{selector:t=u,readySelector:o}={}){let r=null,c=null,i=!1,l=!1,d=null;const a=()=>{d?.observer.disconnect(),d=null},m=()=>{if(l)return;let e=null;if(r&&s(r)){const n=r.contentDocument;(e=>{if(!o||e.querySelector(o))return a(),!0;if(d?.doc!==e){a();const n=e.defaultView?.MutationObserver;if(n){const t=new n(()=>m());t.observe(e,{childList:!0,subtree:!0}),d={doc:e,observer:t}}}return!1})(n)&&(e={frame:r,document:n,window:r.contentWindow})}else a();(e===c||!!e&&!!c&&e.frame===c.frame&&e.document===c.document)&&i||(i=!0,c=e,n(c))},f=()=>m(),v=()=>{const n=e.querySelector?.(t);n!==r?(r?.removeEventListener("load",f),r=n,r?.addEventListener("load",f),m()):m()},b=e.ownerDocument?.defaultView??e.defaultView,w=b?.MutationObserver,E=w?new w(e=>(e=>null!==r&&!r.isConnected||e.some(e=>[...e.addedNodes,...e.removedNodes].some(e=>"IFRAME"===e.nodeName||!!e.querySelector?.("iframe"))))(e)&&v()):null;return E?.observe(e,{childList:!0,subtree:!0}),v(),()=>{l=!0,E?.disconnect(),a(),r?.removeEventListener("load",f),r=null}}function l(e,{selector:n,readySelector:r}={}){const[c,u]=t(null);return o(()=>{const t=e.current;if(!t)return;const o=i(t,u,{selector:n,readySelector:r});return()=>{o(),u(null)}},[e,n,r]),c}function d(e,n,t,{on:c="document",capture:u=!1}={}){const s=r(t);s.current=t;const i=e?.document??null,l=e?.window??null;o(()=>{const e="window"===c?l:i;if(!e)return;const t=e=>s.current(e);return e.addEventListener(n,t,u),()=>e.removeEventListener(n,t,u)},[i,l,n,c,u])}function a(t,r,c){const u=t?.document??null;o(()=>{if(!u)return;if(!c)return void e(u,r);const t=n(u,r,c),o=u.defaultView?.MutationObserver,s=o?new o(()=>{t.isConnected||n(u,r,c)}):null;return s?.observe(u.head??u.documentElement,{childList:!0}),()=>{s?.disconnect(),e(u,r)}},[u,r,c])}function m(e,{settle:n=[150,450]}={}){const[r,c]=t(0),u=e?.frame??null,s=e?.document??null,i=e?.window??null,l=n.join(",");return o(()=>{if(!u||!s||!i)return;const e=u.ownerDocument.defaultView;let t=!1,o=0;const r=()=>{if(t)return;t=!0;const n=()=>{t=!1,c(e=>e+1)};e?.requestAnimationFrame?o=e.requestAnimationFrame(n):n()},l=[],d=(e,n)=>{e.addEventListener(n,r,!0),l.push(()=>e.removeEventListener(n,r,!0))};d(s,"scroll"),d(i,"resize"),e&&(d(e,"scroll"),d(e,"resize"));const a=e?.ResizeObserver;if(a){const e=new a(r);e.observe(u),s.documentElement&&e.observe(s.documentElement),l.push(()=>e.disconnect())}const m=s.defaultView?.MutationObserver,f=s.body??s.documentElement;if(m&&f){const e=new m(r);e.observe(s===u.ownerDocument?u:f,{childList:!0,subtree:!0}),l.push(()=>e.disconnect())}const v=s.fonts;v&&d(v,"loadingdone");const b=n.map(e=>setTimeout(r,e));return r(),()=>{for(const e of l)e();for(const e of b)clearTimeout(e);o&&e?.cancelAnimationFrame&&e.cancelAnimationFrame(o)}},[u,s,i,l]),r}export{c as BLOCK_SELECTOR,u as CANVAS_SELECTOR,s as isFrameReady,d as useCanvasEvent,l as useCanvasFrame,m as useCanvasLayout,a as useCanvasStyle,i as watchCanvasFrame};
@@ -0,0 +1 @@
1
+ import{createContext as r,useContext as n}from"react";var t;function o(){return t??=r(null)}function u(r,t){const u=n(o());return u?u.strings[r]:t}export{o as stringsContext,u as useWords};
@@ -0,0 +1 @@
1
+ var t=t=>!!t&&"object"==typeof t&&!Array.isArray(t),r=r=>t(r)&&"string"==typeof r.type&&t(r.props);function n(t){let r="";for(const n of t)r+="number"==typeof n?`[${n}]`:""===r?n:`.${n}`;return r}function e(t,r){return"root"===r?t.root:t.components[r]}function o(t){return t?.fields??{}}function s(t){return t?.defaultProps}function c(t,r){return o(e(t,r))}function f(t){return Object.keys(t).filter(r=>"slot"===t[r]?.type)}function i(t,r){const n=[];return u(t,r,[],n),n}function u(r,e,o,s){for(const c of Object.keys(e)){const f=e[c];if(!f)continue;const i=[...o,c],y=r[c];if("slot"===f.type){const t=Array.isArray(y);s.push({slot:n(i),segments:i,content:t?y:[],present:t})}else if("object"===f.type&&f.objectFields&&t(y))u(y,f.objectFields,i,s);else if("array"===f.type&&f.arrayFields&&Array.isArray(y)){const r=f.arrayFields;y.forEach((n,e)=>{t(n)&&u(n,r,[...i,e],s)})}}}function y(t,r){let n=t;for(const t of r){if(null==n||"object"!=typeof n)return;n=n[t]}return n}function a(r,n,e){if(0===n.length)return e;const[o,...s]=n;if("number"==typeof o){const t=Array.isArray(r)?[...r]:[];return t[o]=a(t[o],s,e),t}const c=t(r)?r:{};return{...c,[o]:a(c[o],s,e)}}export{e as blockOf,s as defaultsFrom,o as fieldsFrom,c as fieldsOf,y as getIn,r as isNode,t as isRecord,a as setIn,i as slotLocations,f as topLevelSlotKeys};
@@ -0,0 +1 @@
1
+ var e={add:{stop:"Stop adding here",hint:"Drag onto the page, or click to add.",search:"Search blocks",searchPlaceholder:({label:e})=>`${e}…`,clearSearch:"Clear search",nothing:({query:e})=>`Nothing matches “${e}”`,tryAnother:"Try another word.",tile:({label:e})=>`Add ${e}`},canvas:{addSection:"Add section",addBlock:"Add block",addButton:({label:e})=>`+ ${e}`,handle:({label:e})=>`Drag to move this ${e.toLowerCase()}`}};export{e as DEFAULT_DRAG_WORDS};
@@ -0,0 +1 @@
1
+ import{DEFAULT_PICK_WORDS as o}from"./chunk-ZAOM6PFH.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as r}from"./chunk-6WY6ZXJG.js";import{DEFAULT_CANVAS_WORDS as t}from"./chunk-GGTPNGFJ.js";import{DEFAULT_FIELDS_WORDS as m}from"./chunk-SUO5627P.js";import{DEFAULT_TREE_WORDS as n}from"./chunk-H4B72XCJ.js";import{DEFAULT_PANEL_WORDS as c}from"./chunk-7A7O2JWQ.js";import{DEFAULT_NODE_MENU_WORDS as f}from"./chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as p}from"./chunk-H6DDIBQ4.js";import{DEFAULT_CHROME_WORDS as s,DEFAULT_NOTICE_WORDS as i}from"./chunk-KDIVA6WD.js";import{DEFAULT_LOCK_WORDS as u}from"./chunk-RE4LP46F.js";import{DEFAULT_RAIL_WORDS as e}from"./chunk-2OAZYSWJ.js";import{DEFAULT_COPY_WORDS as k}from"./chunk-2LUSK32B.js";import{DEFAULT_DRAG_WORDS as j}from"./chunk-O2NLQBFX.js";var h={notice:i,lock:u,save:p,chrome:s,rail:e,tree:n,panel:c,fields:m,pick:o,drag:j,menu:f,styleClipboard:r,copy:k,canvas:t},l=o=>"object"==typeof o&&null!==o;function a(o,r){const t={};for(const m of Object.keys(o)){const n=o[m],c=r[m];null==c?t[m]=n:l(n)?t[m]=l(c)?a(n,c):n:t[m]=typeof c==typeof n?c:n}return t}function y(o,r){return r?a(o,r):o}export{h as DEFAULT_EDITOR_STRINGS,y as mergeEditorStrings};
File without changes
@@ -0,0 +1,5 @@
1
+ import{wordFitVars as e}from"./chunk-BZ5ASXOL.js";import{jsx as a,jsxs as s}from"react/jsx-runtime";function i({options:i,value:l,onChange:n,ariaLabel:t,fit:r,disabled:d=!1,className:o}){const c=r&&e(i.length,r);
2
+ /* @__PURE__ */
3
+ return a("div",{className:"es-segs-fit",children:/* @__PURE__ */a("div",{role:"group","aria-label":t,"data-disabled":d||void 0,className:`es-segs${c?" is-measured":""}${o?` ${o}`:""}`,style:c,children:i.map(e=>{const i=e.id===l,t=e.title??("string"==typeof e.label?e.label:void 0),r=d||!0===e.disabled,o=`es-seg${e.icon?" has-icon":""}${i?" is-active":""}`;/* @__PURE__ */
4
+ return s("button",{type:"button",title:t,"aria-label":t,"aria-pressed":i,disabled:r,className:o,onClick:()=>n(e.id),children:[e.icon?/* @__PURE__ */a("span",{className:"es-seg-icon","aria-hidden":"true",children:e.icon}):null,
5
+ /* @__PURE__ */a("span",{className:"es-seg-word",children:e.label})]},String(e.id))})})})}export{i as SettingsSegmented};
@@ -0,0 +1 @@
1
+ var o={justNow:"just now",minutesAgo:({count:o})=>`${o} minute${1===o?"":"s"} ago`,hoursAgo:({count:o})=>`${o} hour${1===o?"":"s"} ago`,someone:"Someone else"};export{o as DEFAULT_LOCK_WORDS};
@@ -0,0 +1,14 @@
1
+ import{DEFAULT_TREE_WORDS as e}from"./chunk-H4B72XCJ.js";import{ChevronIcon as a}from"./chunk-YNZZYHA4.js";import{jsx as r,jsxs as l,Fragment as n}from"react/jsx-runtime";function s({className:e,children:a,rootProps:l}){/* @__PURE__ */
2
+ return r("div",{...l,className:e?`es-tree ${e}`:"es-tree",children:a})}function t({children:e}){/* @__PURE__ */
3
+ return r("div",{className:"es-tree-group",children:e})}function i({children:e}){/* @__PURE__ */
4
+ return r("div",{className:"es-subtree",children:e})}var d=e.dragHint;function c({icon:s,name:t,preview:i,selected:d,hidden:c,draggable:o,dragHint:p,dragging:h,drop:m,fold:u,handle:b,actions:N,nameSlot:g,onSelect:k,marks:f,badge:v,trailing:y,children:w,rowProps:x,words:A=e}){const C=["es-tree-row",d?"is-selected":"",c?"is-hidden":"",o?"is-draggable":"",h?"is-dragging":"",m?`is-drop-${m}`:""].filter(Boolean).join(" "),j=/* @__PURE__ */l(n,{children:[
5
+ /* @__PURE__ */l("span",{className:"es-tree-name",children:[t,i?/* @__PURE__ */r("span",{className:"es-tree-preview",children:i}):null]}),f?.map(e=>/* @__PURE__ */r("span",{className:"es-tree-mark",title:e.label,"aria-label":e.label,role:"img",children:e.icon},e.key)),null!=v&&!1!==v?/* @__PURE__ */r("span",{className:"es-tree-badge",children:v}):null]});/* @__PURE__ */
6
+ return l("div",{...x,className:C,children:[o?
7
+ /* @__PURE__ */l(n,{children:[
8
+ /* @__PURE__ */r("span",{className:"es-tree-grip","aria-hidden":"true",children:"⋮"}),
9
+ /* @__PURE__ */r("span",{className:"es-tree-hint","aria-hidden":"true",children:p??A.dragHint})]}):b?/* @__PURE__ */r("button",{type:"button",className:"es-tree-handle",...b,children:"⋮⋮"}):null,u?/* @__PURE__ */r("button",{type:"button",className:"es-tree-caret","aria-label":u.open?A.collapseNamed({label:u.label}):A.expandNamed({label:u.label}),"aria-expanded":u.open,title:u.open?A.collapse:A.expand,onClick:e=>{e.stopPropagation(),u.onToggle()},children:/* @__PURE__ */r(a,{size:11,strokeWidth:2.6,className:u.open?"es-tree-chev is-open":"es-tree-chev"})}):/* @__PURE__ */r("span",{className:"es-tree-caret-spacer","aria-hidden":"true"}),
10
+ /* @__PURE__ */r("span",{className:"es-tree-chip","aria-hidden":"true",children:s}),
11
+ /* @__PURE__ */l("span",{className:"es-tree-name-box",children:[g??(k?
12
+ /* @__PURE__ */r("button",{type:"button",className:"es-tree-select","aria-current":d?"true":void 0,"aria-keyshortcuts":o?"Alt+ArrowUp Alt+ArrowDown":void 0,onClick:k,children:j}):j),N?/* @__PURE__ */r("span",{className:"es-tree-actions",children:N}):null]}),y?/* @__PURE__ */r("span",{className:"es-tree-trailing",title:y.label,"aria-label":y.label,role:"img",children:y.icon}):null,w]})}function o({kind:e,label:a,onClick:l,pressed:n,disabled:s,children:t}){/* @__PURE__ */
13
+ return r("button",{type:"button",className:"delete"===e?"es-tree-del":"eye"===e?"es-tree-eye":"es-tree-act",title:a,"aria-label":a,"aria-pressed":n,disabled:s,onClick:e=>{e.stopPropagation(),l()},children:t})}function p({drop:e,onAdd:a,label:l,seamProps:n}){const s=["es-tree-seam",e?"is-drop":"",a?"has-add":""].filter(Boolean).join(" ");/* @__PURE__ */
14
+ return r("div",{...n,className:s,children:a?/* @__PURE__ */r("button",{type:"button",className:"es-tree-seam-add","aria-label":l,title:l,onClick:a,children:"+"}):null})}export{s as LayersTree,i as Subtree,d as TREE_DRAG_HINT,t as TreeGroupLabel,c as TreeRow,o as TreeRowAction,p as TreeSeam};
@@ -0,0 +1 @@
1
+ var e={less:"Less",more:"More",choose:"Choose…",list:{item:"item",itemName:({noun:e,n:t})=>{return`${o=e,o?o[0].toUpperCase()+o.slice(1):o} ${t}`;var o},position:({n:e,total:t})=>`${e} of ${t}`,duplicate:"Duplicate",duplicateItem:({noun:e})=>`Duplicate ${e}`,deleteItem:({noun:e})=>`Delete ${e}`,add:({noun:e})=>`+ Add ${e}`,addHere:({noun:e})=>`Add ${e} here`}};export{e as DEFAULT_FIELDS_WORDS};
@@ -0,0 +1 @@
1
+ import{DEFAULT_LOCK_WORDS as e}from"./chunk-RE4LP46F.js";var n=e=>"editing"===e.kind;function t(e){return e?{kind:"checking"}:{kind:"editing"}}var r=e=>"blocked"===e.kind||"readonly"===e.kind||"takenover"===e.kind?e.holder:null;function o(e){if(!e||"object"!=typeof e)return null;const n=e;return"string"!=typeof n.holder_name?null:{name:n.holder_name,secondsSinceSeen:"number"==typeof n.seconds_since_seen?n.seconds_since_seen:0,secondsSinceHeld:"number"==typeof n.seconds_since_held?n.seconds_since_held:0}}var a=e=>e?{edit:!0,insert:!0,delete:!0,duplicate:!0,drag:!1}:{edit:!1,insert:!1,delete:!1,duplicate:!1,drag:!1};function s(n,t=e){if(!Number.isFinite(n)||n<45)return t.justNow;const r=Math.round(n/60);if(r<60)return t.minutesAgo({count:r});const o=Math.round(r/60);return t.hoursAgo({count:o})}var c=(n,t=e)=>n.trim()||t.someone;function d(){return`tab-${"undefined"!=typeof crypto&&"randomUUID"in crypto?crypto.randomUUID():Math.random().toString(36).slice(2)}`.slice(0,64)}var i="edit_lock_taken";function u(e,t,r){return!(n(e)||!n(t))&&(r.pending&&r.autoSaveEnabled&&!r.saveConflict)}function l(e,t,o){return!(null===r(e)||!n(t))&&(!o.pending&&!o.saveConflict)}function f(e,n){return e!==n&&Date.parse(e)>=Date.parse(n)}async function k(e){if(!e.ours)return!1;const n=await e.stored().catch(()=>null);return!(!n||!f(n,e.ours)||e.hasPending())&&(e.reload(),!0)}function h(e){const{readFailure:n,conflictCode:t}=e,r=e=>{const t=n(e);return t&&409===t.status?o(t.data):null},a=e=>{const n=r(e);return n?{kind:"blocked",holder:n}:{kind:"editing"}},s=(e,n)=>{const t=r(e);return t?{kind:"blocked",holder:t}:n},c=(e,n)=>{const t=r(e);return t?{kind:"takenover",holder:t}:n},d=e=>{const t=n(e);return null!==t&&(401===t.status||403===t.status)};return{accessAfterClaimFailure:a,accessAfterTakeoverFailure:s,accessAfterHeartbeatFailure:c,isAuthRejection:d,readSaveConflict:e=>{const r=n(e);if(!r||409!==r.status)return null;if(!r.data||"object"!=typeof r.data)return null;const o=r.data;return o.code!==t?null:{savedBy:"string"==typeof o.saved_by?o.saved_by:"",savedByYou:!0===o.saved_by_you,secondsAgo:"number"==typeof o.seconds_ago?o.seconds_ago:0}},readLockTaken:e=>{const t=n(e);return t&&409===t.status&&t.data&&"object"==typeof t.data?t.data.code!==i?null:o(t.data)??{name:"",secondsSinceSeen:0,secondsSinceHeld:0}:null},makeClaimBeat:e=>{let n=!1;return async t=>{let r,o;try{const a=await e.claim(t);if(e.cancelled())return;r=e.currentAccess(),o={kind:"editing"},!n&&a.heartbeat_seconds>0&&(n=!0,e.startHeartbeat(1e3*a.heartbeat_seconds))}catch(n){if(e.cancelled())return;r=e.currentAccess(),o=t?s(n,r):"checking"===r.kind?a(n):c(n,r),d(n)&&e.stopHeartbeat()}e.setAccess(o);const i=e.heldWrite();u(r,o,i)?e.releaseHeldWrite():t&&l(r,o,i)&&e.reloadIfMoved?.()}}}}export{i as EDIT_LOCK_TAKEN,t as accessForNewDocument,n as canWriteDocument,h as createEditLock,s as describeAge,a as documentPermissions,f as documentVersionMoved,r as holderOf,c as nameOrSomeone,d as newEditorClientId,o as readLockHolder,k as reloadIfVersionMoved,u as shouldReleaseHeldWrite,l as shouldReloadAfterTakeover};
@@ -0,0 +1 @@
1
+ var e={layer:"Select layer",addInside:"Add block inside",duplicate:"Duplicate",moveUp:"Move up",moveDown:"Move down",copy:"Copy",cut:"Cut",paste:"Paste",rename:"Rename",hide:"Hide",show:"Show",upLevel:"Go up one level",delete:"Delete",pasteNamed:({paste:e,label:a})=>`${e} ${a}`};export{e as DEFAULT_NODE_MENU_WORDS};
@@ -0,0 +1,3 @@
1
+ import{DEFAULT_RAIL_WORDS as a}from"./chunk-2OAZYSWJ.js";import{wordFitVars as i}from"./chunk-BZ5ASXOL.js";import{jsxs as e,jsx as r}from"react/jsx-runtime";function o({label:a,worded:i,icon:o,active:l,disabled:t,onSelect:n,className:d}){const s=["es-rail-btn",l?"is-active":"",d??""].filter(Boolean).join(" ");/* @__PURE__ */
2
+ return e("button",{type:"button",className:s,title:a,"aria-label":a,"aria-pressed":"boolean"==typeof l?l:void 0,disabled:t,onClick:t?void 0:n,children:[o,i?/* @__PURE__ */r("span",{className:"es-rail-word","aria-hidden":"true",children:a}):null]})}function l({items:e,ariaLabel:l=a.label,className:t,orientation:n="column",wordFit:d}){const s="row"===n,c=s&&d?d:void 0;/* @__PURE__ */
3
+ return r("div",{className:["es-rail",s?"es-rail-row":"",c?"is-measured":"",t??""].filter(Boolean).join(" "),role:"toolbar","aria-orientation":s?"horizontal":"vertical","aria-label":l,style:c&&i(e.length,c),children:e.map(a=>/* @__PURE__ */r(o,{label:a.label,worded:Boolean(c),icon:a.icon,active:a.active,disabled:a.disabled,onSelect:a.onSelect},a.id))})}var t={railWidth:46,railPaddingY:8,railGap:4,railRadius:12,buttonSize:34,buttonRadius:9,iconSize:18,wordPaddingX:8,wordGap:6,wordFontSize:12,wordFontWeight:500,transition:"background 0.12s, color 0.12s",disabledOpacity:.35,color:{background:"#ffffff",shadow:"0 1px 2px rgba(0, 0, 0, 0.05), 0 10px 30px rgba(0, 0, 0, 0.06)",idle:"#6b7280",hoverBg:"#f3f4f6",hoverFg:"#111827",accent:"#2563eb",accentTint:"#eff6ff"}},n={railWidth:"--es-rail-w",railPaddingY:"--es-rail-pad-y",railGap:"--es-rail-gap",railRadius:"--es-rail-radius",buttonSize:"--es-rail-btn-size",buttonRadius:"--es-rail-btn-radius",iconSize:"--es-rail-icon-size",wordPaddingX:"--es-rail-word-pad-x",wordGap:"--es-rail-word-gap",wordFontSize:"--es-rail-word-size",wordFontWeight:"--es-rail-word-weight",background:"--es-rail-bg",shadow:"--es-rail-shadow",idle:"--es-rail-fg",hoverBg:"--es-rail-hover-bg",hoverFg:"--es-rail-hover-fg",accent:"--es-rail-accent",accentTint:"--es-rail-accent-tint"};export{l as EditorRail,o as EditorRailButton,n as railCssVars,t as railTokens};