efficient-easel 20.2.0 → 20.2.1
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.
- package/dist/{chunk-2BOXPUGF.js → chunk-6FWAE2RN.js} +1 -1
- package/dist/{chunk-OTONLZR4.js → chunk-7YVEYQDE.js} +3 -3
- package/dist/{chunk-H2PRGXCW.js → chunk-LQV5FZTQ.js} +7 -7
- package/dist/chunk-R5KEFI55.js +8 -0
- package/dist/chunk-XJ2WXGFJ.js +65 -0
- package/dist/drag/index.js +1 -1
- package/dist/fields/index.js +1 -1
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaPopup.d.ts +5 -6
- package/dist/screen/components/NodeContextMenu.js +1 -1
- package/dist/screen/components/ScreenChrome.js +1 -1
- package/dist/screen/components/ScreenMount.js +1 -1
- package/dist/screen/components/ScreenStoreProvider.js +1 -1
- package/dist/screen/components/SectionScreenShell.js +13 -13
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/puck/use-section-ops.js +1 -1
- package/dist/screen/lib/screen-parts.js +1 -1
- package/dist/strings/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-3R3PEVU7.js +0 -65
- package/dist/chunk-FGJTX2DL.js +0 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEaselSession as e}from"./chunk-O7Q4DDJT.js";import{useHostEscape as n}from"./chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-23DYNW6S.js";import{styleMenuItems as o}from"./chunk-V7U33NF2.js";import{
|
|
1
|
+
import{useEaselSession as e}from"./chunk-O7Q4DDJT.js";import{useHostEscape as n}from"./chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as t}from"./chunk-23DYNW6S.js";import{styleMenuItems as o}from"./chunk-V7U33NF2.js";import{easelMenuEntries as l,menuLabel as r}from"./chunk-FIVU2COQ.js";import{createNodeClipboard as i,nodeMenuItems as c}from"./chunk-P5VYGWYO.js";import{DEFAULT_NODE_MENU_WORDS as s}from"./chunk-WK3AFPXY.js";import{zoneKey as u,ROOT_SLOT as a,ROOT_ID as d}from"./chunk-K7BTCBWD.js";import{isTypingTarget as p,useCanvasEvent as f,framePointToHost as m}from"./chunk-QIDRJH3S.js";import{ROOT_ZONE as h}from"./chunk-PLVEGYK6.js";import{useState as y,useCallback as k,useRef as b,useEffect as g}from"react";import{ContextMenu as v}from"efficient-shell/ui";import{UndoIcon as w,RedoIcon as x,PasteIcon as C,SettingsIcon as O,LayersIcon as z,CopyIcon as P}from"efficient-shell/icons/efficient";import{jsx as A}from"react/jsx-runtime";function D(e,n){const t=[],o=/* @__PURE__ */new Set;let l={zone:n.zone,index:n.index};for(;l;){const n=e.nodeAt(l.zone,l.index);if(!n||o.has(n.props.id))break;if(o.add(n.props.id),t.push({zone:l.zone,index:l.index,node:n,parentType:null}),l.zone===h)break;const r=l.zone.lastIndexOf(":");if(r<=0)break;l=e.locate(l.zone.slice(0,r))}for(let e=0;e<t.length-1;e+=1)t[e].parentType=t[e+1].node.type;return t}var K=i(),j=/* @__PURE__ */new WeakMap;function M(e){if(e.claimsPage)return K;const n=e.registry;if(!n)return e.cache("easel:node-clipboard",i);let t=j.get(n);return t||(t=i(),j.set(n,t)),t}function S(){return M(e())}function T(e,n,t){if(n===h){const{floor:n,cap:o}=e.sectionBand();return{parentId:d,slot:a,index:Math.min(Math.max(t,n),o)}}const o=n.lastIndexOf(":");return{parentId:n.slice(0,o),slot:n.slice(o+1),index:t}}function Y(e,n,t){const o=e.isPinned(n,t),l=!o&&!e.isLocked(n)&&!e.duplicateBlocked(n),r=e.permits?.(n)??{duplicate:!0,delete:!0};return{copy:!o&&r.duplicate,cut:l&&r.duplicate&&r.delete,delete:l&&r.delete}}function I(e,n,t){const o=e.canPasteAt;if(!o)return u(n.from)===t.zone?T(e,t.zone,t.index+1):null;for(const l of D(e,t)){const t=T(e,l.zone,l.index+1);if(o(n,t))return t}return null}function R(e){if(e.defaultPrevented||e.altKey||e.shiftKey)return null;if(p(e.target))return null;const n=e.target,t=n&&"ownerDocument"in n?n.ownerDocument??n:null,o=t?.getSelection?.();if(o&&!o.isCollapsed&&o.toString().trim())return null;if(!e.metaKey&&!e.ctrlKey)return"Delete"===e.key?"delete":null;const l=e.code||(1===e.key.length?`Key${e.key.toUpperCase()}`:"");return"KeyC"===l?"copy":"KeyX"===l?"cut":"KeyV"===l?"paste":null}function B(e,n,t,o){const l=e.nodeAt(t.zone,t.index);if(!l)return null;const r=l.props.id,i=e.labelOf(l.type,t.zone),c=Y(e,l,t.zone);if("copy"===n)return c.copy?(e.nodeOps.copy(r,i),{done:"copied",name:i}):null;if(o.readOnly)return null;if("cut"===n)return c.cut?(e.nodeOps.cut(r,i),{done:"cut",name:i}):null;if("delete"===n)return c.delete?(e.nodeOps.remove(r),{done:"deleted",name:i}):null;const s=o.held;if(!s)return null;const u=e.isPinned(l,t.zone)?null:I(e,s,t);return u?(e.nodeOps.paste(u),{done:"pasted",name:s.label}):(e.onPasteRefused(s),{done:"refused",name:s.label})}function E(e,n){const{zone:t,index:l}=n,r=e.nodeAt(t,l);if(!r)return[];const i=r.props.id,s=e.labelOf(r.type,t),u=Boolean(r.props._hidden),a=e.nodeOps,d=e.isPinned(r,t),p=e.isLocked(r),f=!d&&!p&&!e.duplicateBlocked(r),m=e.permits?.(r)??{duplicate:!0,delete:!0},y=Y(e,r,t),k=D(e,n),b=a.held,g=b&&!d?I(e,b,n):null,v=!e.readOnly,w=e.style?o({held:v?e.style.held():null,canCopy:e.style.canCopy(r,t),onCopy:()=>e.style?.copy(r,t),onPaste:()=>e.style?.paste(t,l,r),words:e.words?.styleClipboard}):[];return c({title:s,words:e.words?.menu,layer:{group:"pick",items:k.flatMap((n,t)=>{const o={label:e.rowNameOf(n.node,n.zone),checked:0===t,onClick:()=>e.selectAt(n.zone,n.index,n.node.props.id,n.parentType)},l=n.zone===h?null:e.slotRung?.(n.zone)??null;return l?[o,{label:l.label,checked:!1,onClick:l.select}]:[o]})},actions:{duplicate:v&&f&&m.duplicate?()=>a.duplicate(i):void 0,...L(v&&!d,e=>a.canStep(i,e),e=>a.step(i,e)),copy:y.copy?()=>a.copy(i,s):void 0,cut:v&&y.cut?()=>a.cut(i,s):void 0,paste:v&&b&&g?{label:b.label,run:()=>a.paste(g)}:void 0,rename:v&&e.renamePropOf(r,t)?()=>e.beginRename(t,l):void 0,hide:!v||p||d?void 0:{hidden:u,run:()=>a.setProps(i,{_hidden:!u})},delete:v&&f&&m.delete?()=>a.remove(i):void 0},style:w,extras:e.menuRows?.(r,t,l)??void 0,pinnedLine:d?V(e).pinned:void 0})}function L(e,n,t){return e?{moveUp:n(-1)?()=>t(-1):null,moveDown:n(1)?()=>t(1):null}:{}}var V=e=>e.words?.screen??t.menu;function X(e){const n=V(e),o=!e.readOnly,l=[];o&&e.history.hasPast&&l.push({label:n.undo,icon:/* @__PURE__ */A(w,{}),shortcut:"⌘Z",onClick:e.history.back}),o&&e.history.hasFuture&&l.push({label:n.redo,icon:/* @__PURE__ */A(x,{}),shortcut:"⇧⌘Z",onClick:e.history.forward});const r=[],i=e.nodeOps.held,c=T(e,h,e.sectionBand().cap);if(o&&i&&(e.canPasteAt?e.canPasteAt(i,c):u(i.from)===h)){const n=c,t=e.words?.menu??s;r.push({label:t.pasteNamed({paste:t.paste,label:i.label}),icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>e.nodeOps.paste(n)})}const a=[l,r,[{label:e.pageSettingsLabel??t.pageSettings,icon:/* @__PURE__ */A(O,{}),onClick:e.openPageSettings},{label:n.collapseAll,icon:/* @__PURE__ */A(z,{}),onClick:e.collapseAll}]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return a.flatMap((e,n)=>n?[d,...e]:e)}function N(e,n){const t=n.selectionStart??0,o=n.selectionEnd??0,l=n.value.slice(t,o),r=e=>{n.focus(),n.setRangeText(e,t,o,"end"),n.dispatchEvent(new Event("input",{bubbles:!0}))},i=e.words?.menu??s,c=V(e),u=[];l&&(u.push({label:i.copy,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘C",onClick:()=>navigator.clipboard?.writeText(l)}),u.push({label:i.cut,icon:/* @__PURE__ */A(P,{}),shortcut:"⌘X",onClick:()=>{navigator.clipboard?.writeText(l),r("")}})),u.push({label:i.paste,icon:/* @__PURE__ */A(C,{}),shortcut:"⌘V",onClick:()=>{navigator.clipboard?.readText().then(e=>{e&&r(e)}).catch(()=>e.onPasteRefused())}});const a=[u,n.value?[{label:c.selectAll,shortcut:"⌘A",onClick:()=>{n.focus(),n.select()}}]:[]].filter(e=>e.length>0),d={label:"—",onClick:()=>{}};return a.flatMap((e,n)=>n?[d,...e]:e)}function F(e){return e.shiftKey}function U(e,t){const[o,l]=y(null),r=k(()=>l(null),[]);n(null!==o,r);const i=b(e);i.current=e;const c=k(e=>{const n=i.current,t=n.keys;if(!t)return;const o=R(e);if(!o)return;const l=t.selected();if(!l)return;const r=B(n,o,l,{readOnly:t.readOnly,held:t.held()});r&&(e.preventDefault(),t.onDone?.(r))},[]),s=e.keys?.target??null;g(()=>{if(!s)return;const e=e=>c(e);return s.addEventListener("keydown",e),()=>s.removeEventListener("keydown",e)},[s,c]),f(t,"keydown",c);const u=k(n=>{if(F(n))return;const t=n.target;if(t?.closest?.("[data-slot-zone]"))return n.preventDefault(),void l(null);const o=function(e){const n=e?.closest?.("input, textarea");return n&&("INPUT"!==n.tagName||["text","search","url","email","tel","number",""].includes(n.type))?n:null}(t);if(o)return n.preventDefault(),void l({kind:"input",x:n.clientX,y:n.clientY,el:o,owner:t});const r=t?.closest?.("[data-node-id]")?.getAttribute("data-node-id"),i=r?e.locate(r):null;n.preventDefault(),l(i?{kind:"node",x:n.clientX,y:n.clientY,...i,owner:t}:{kind:"empty",x:n.clientX,y:n.clientY,owner:t})},[e]);f(t,"contextmenu",n=>{if(F(n)||!t)return;const o=n.target?.closest?.("[data-puck-component]")??null,r=o?.getAttribute("data-puck-component"),i=r?e.locate(r):null;n.preventDefault();const c=m(t.frame,n.clientX,n.clientY),s=t.frame;l(i?{kind:"node",...c,...i,owner:s}:{kind:"empty",...c,owner:s})}),f(t,"mousedown",r),f(t,"scroll",r,{on:"window"});return{onEditorContextMenu:u,menu:o?/* @__PURE__ */A(W,{host:e,target:o,onClose:r}):null,closeMenu:r}}function W({host:e,target:n,onClose:t}){const o="node"===n.kind?E(e,n):"input"===n.kind?N(e,n.el):X(e);return 0===o.length?null:/* @__PURE__ */A(v,{at:{x:n.x,y:n.y},owner:n.owner??null,onClose:t,"aria-label":r(o),items:l(o)})}export{K as EASEL_NODE_CLIPBOARD,D as ancestorChain,M as nodeClipboardOf,Y as nodeClipboardRules,E as nodeMenuItems,R as nodeShortcut,X as pageMenuItems,I as pastePlace,B as runNodeShortcut,N as textMenuItems,S as useNodeClipboard,U as useNodeContextMenu};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-
|
|
1
|
+
import{clientOnly as r}from"./chunk-GXQCZJOP.js";import{ScreenChrome as n}from"./chunk-XJ2WXGFJ.js";import{ScreenStoreProvider as e}from"./chunk-JQXD3TDE.js";import{ScreenDocumentProvider as i,useScreenDocument as a}from"./chunk-276MBG5P.js";import{DEFAULT_SCREEN_WORDS as o}from"./chunk-23DYNW6S.js";import{documentPermissions as s}from"./chunk-THWO5YVZ.js";import{useWords as c}from"./chunk-MFIRYGHW.js";import{useMemo as t,useState as d,useRef as l,useEffect as m,useCallback as g}from"react";import{Dialog as h,Button as f}from"efficient-shell/ui";import{jsx as u,jsxs as p,Fragment as v}from"react/jsx-runtime";var k=r(e),C=r(n);function N({onCancel:r,onDiscard:n,onSave:e}){const i=c("screen",o).leave,[a,s]=d(!1),t=l(!0);m(()=>(t.current=!0,()=>{t.current=!1}),[]);const k=g(async()=>{s(!0);try{await e()}finally{t.current&&s(!1)}},[e]);/* @__PURE__ */
|
|
2
2
|
return u(h,{open:!0,role:"alertdialog",size:"sm",title:i.title,onClose:r,footer:/* @__PURE__ */p(v,{children:[
|
|
3
3
|
/* @__PURE__ */u(f,{variant:"secondary",onClick:r,children:i.cancel}),
|
|
4
4
|
/* @__PURE__ */u(f,{variant:"ghost-danger",onClick:n,children:i.discard}),
|
|
5
5
|
/* @__PURE__ */u(f,{variant:"primary",loading:a,onClick:()=>{k()},children:i.save})]}),children:i.body})}function j({target:r,addressing:n,onHostMessage:e,children:a}){/* @__PURE__ */
|
|
6
|
-
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var y=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function D({config:r,parts:n,wrap:e=y}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:j}=a(),D=t(()=>s(!g),[g]),
|
|
7
|
-
/* @__PURE__ */u(k,{config:r,data:i,onChange:h,permissions:D,parts:n,children:/* @__PURE__ */u(C,{})}),f&&/* @__PURE__ */u(N,{onCancel:p,onDiscard:v,onSave:j})):/* @__PURE__ */u("div",{className:"sf-msg",children:
|
|
6
|
+
return u(i,{target:r,addressing:n,onHostMessage:e,children:a})}var y=(r,n)=>/* @__PURE__ */p(v,{children:[r,n]});function D({config:r,parts:n,wrap:e=y}){const{data:i,error:d,redirecting:l,ready:m,readOnly:g,onChange:h,pendingNav:f,cancelPendingNav:p,discardAndNavigate:v,saveAndNavigate:j}=a(),D=t(()=>s(!g),[g]),G=c("screen",o);return l?/* @__PURE__ */u("div",{className:"sf-msg",children:G.loading}):d?/* @__PURE__ */u("div",{className:"sf-msg sf-msg--error",children:d}):m?i?e(
|
|
7
|
+
/* @__PURE__ */u(k,{config:r,data:i,onChange:h,permissions:D,parts:n,children:/* @__PURE__ */u(C,{})}),f&&/* @__PURE__ */u(N,{onCancel:p,onDiscard:v,onSave:j})):/* @__PURE__ */u("div",{className:"sf-msg",children:G.loading}):/* @__PURE__ */u("div",{className:"sf-msg",children:G.waitingForAuthorization})}export{D as DocumentScreen,j as ScreenMount};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{DEFAULT_DRAG_WORDS as e}from"./chunk-KAML3KQH.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as a,isNoOpDrop as r}from"./chunk-3S5N4HLJ.js";import{
|
|
1
|
+
import{DEFAULT_DRAG_WORDS as e}from"./chunk-KAML3KQH.js";import{dropEffectFor as t,scrollBoxOf as n,frameScrollBox as l,startAutoScroll as a,isNoOpDrop as r}from"./chunk-3S5N4HLJ.js";import{withTip as o}from"./chunk-P2VEMZH5.js";import{parseZoneKey as s,ROOT_ID as i}from"./chunk-K7BTCBWD.js";import{useCanvasLayout as c,useCanvasTyping as d,useCanvasEvent as u,CANVAS_TYPABLE_EVENT as h,framePointToHost as f,elementScale as p,frameRectToLayer as m,clientPointToLayer as g}from"./chunk-QIDRJH3S.js";import{isRepeatCopy as x}from"./chunk-LF3FUSCQ.js";import{useRef as b,useEffect as y,useState as v,useCallback as w,useMemo as k,useSyncExternalStore as N,useId as D,useLayoutEffect as A}from"react";import{Tooltip as z,IconButton as T,solidSurfaceStyle as M,Input as C}from"efficient-shell/ui";import{AddIcon as S,CloseIcon as $,SearchIcon as E}from"efficient-shell/icons/efficient";import{jsxs as L,jsx as j}from"react/jsx-runtime";function B({label:e,onInsert:t,style:n,axis:l="y",className:a,index:r}){const o=["es-canvas-insert","x"===l?"is-x":"",a??""].filter(Boolean).join(" ");/* @__PURE__ */
|
|
2
2
|
return L("div",{className:o,style:n,"data-index":r,children:[
|
|
3
3
|
/* @__PURE__ */j("span",{className:"es-canvas-insert-line","aria-hidden":"true"}),
|
|
4
|
-
/* @__PURE__ */j("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */j(z,{content:e,children:/* @__PURE__ */j(T,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */j(S,{})})})})]})}var K=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,O=e=>e.width*e.height;function I(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>K(e.box,t,n)).sort((e,t)=>O(t.s.box)-O(e.s.box)||e.at-t.at).map(({s:e})=>e)}function q(e,t,n){return I(e,t,n).at(-1)??null}function H(e,t,n){const l="x"===e.axis?t:n;let a=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(a+=1)}return a}function X(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],a=n[t],r=l&&a?(l.left+l.width+a.left)/2:l?l.left+l.width:a?a.left:e.box.left,o=a??l??e.box;return{left:r-1,top:o.top,width:2,height:o.height}}const l=n[t-1],a=n[t],r=l&&a?(l.top+l.height+a.top)/2:l?l.top+l.height:a?a.top:e.box.top;return{left:e.box.left,top:r-1,width:e.box.width,height:2}}function Y(e,t,n,l,a=()=>!1,r=()=>!0){const o=e.filter(e=>K(e.box,t,n)).sort((e,t)=>O(e.box)-O(t.box));for(const e of o){const o=H(e,t,n),s={...e.list,index:o};if(a(s))return null;if(l(s))return{zone:e,to:s,line:X(e,o)};if(!r(s))return null}return null}function F(e,t,n=12){const l=e.children;if(0===l.length)return[];const a=e.box,r="x"===e.axis,o=r?a.left:a.top,s=o+(r?a.width:a.height),i=e=>r?e.left:e.top,c=e=>r?e.left+e.width:e.top+e.height,d=[];for(let a=0;a<=l.length;a++){const u=l[a-1],h=l[a];let f,p;if(u&&h)f=c(u),p=Math.max(i(h)-f,0);else{const e=u?(c(u)+s)/2:(o+i(h))/2,t=Math.min(Math.max(e,o+n),s-n);f=u?Math.max(t,c(u)):Math.min(t,i(h)),p=0}const m=[u,h].filter(e=>Boolean(e)),g=Math.min(...m.map(e=>r?e.top:e.left)),x=Math.max(...m.map(e=>r?e.top+e.height:e.left+e.width)),b=r?{left:f,top:g,width:p,height:x-g}:{left:g,top:f,width:x-g,height:p};d.push({key:`${e.key}:+${a}`,place:{...e.list,index:a},box:b,axis:e.axis,label:t})}return d}function P(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const a=e.children[l-1],r=e.children[l],o=a.top+a.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(r.top-o,0)}})}return n}var Q={nodes:[],zones:[]},R="data-puck-dropzone",Z="data-puck-component";function J(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function V(e,t){const{frame:n,document:l}=e,a=e=>m(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),r=[],
|
|
5
|
-
/* @__PURE__ */j(B,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??o.seamLabel??D.addSection,onInsert:()=>o.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),ve.length?ve.map(e=>/* @__PURE__ */j("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",G?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:_(e.box),"data-node-id":e.list.parentId===
|
|
4
|
+
/* @__PURE__ */j("span",{className:"es-canvas-insert-chip",children:/* @__PURE__ */j(z,{content:e,children:/* @__PURE__ */j(T,{variant:"ghost",size:"sm","aria-label":e,onClick:t,children:/* @__PURE__ */j(S,{})})})})]})}var K=(e,t,n)=>t>=e.left&&t<=e.left+e.width&&n>=e.top&&n<=e.top+e.height,O=e=>e.width*e.height;function I(e,t,n){return e.map((e,t)=>({s:e,at:t})).filter(({s:e})=>K(e.box,t,n)).sort((e,t)=>O(t.s.box)-O(e.s.box)||e.at-t.at).map(({s:e})=>e)}function q(e,t,n){return I(e,t,n).at(-1)??null}function H(e,t,n){const l="x"===e.axis?t:n;let a=0;for(const t of e.children){l>("x"===e.axis?t.left+t.width/2:t.top+t.height/2)&&(a+=1)}return a}function X(e,t){const n=e.children;if("x"===e.axis){const l=n[t-1],a=n[t],r=l&&a?(l.left+l.width+a.left)/2:l?l.left+l.width:a?a.left:e.box.left,o=a??l??e.box;return{left:r-1,top:o.top,width:2,height:o.height}}const l=n[t-1],a=n[t],r=l&&a?(l.top+l.height+a.top)/2:l?l.top+l.height:a?a.top:e.box.top;return{left:e.box.left,top:r-1,width:e.box.width,height:2}}function Y(e,t,n,l,a=()=>!1,r=()=>!0){const o=e.filter(e=>K(e.box,t,n)).sort((e,t)=>O(e.box)-O(t.box));for(const e of o){const o=H(e,t,n),s={...e.list,index:o};if(a(s))return null;if(l(s))return{zone:e,to:s,line:X(e,o)};if(!r(s))return null}return null}function F(e,t,n=12){const l=e.children;if(0===l.length)return[];const a=e.box,r="x"===e.axis,o=r?a.left:a.top,s=o+(r?a.width:a.height),i=e=>r?e.left:e.top,c=e=>r?e.left+e.width:e.top+e.height,d=[];for(let a=0;a<=l.length;a++){const u=l[a-1],h=l[a];let f,p;if(u&&h)f=c(u),p=Math.max(i(h)-f,0);else{const e=u?(c(u)+s)/2:(o+i(h))/2,t=Math.min(Math.max(e,o+n),s-n);f=u?Math.max(t,c(u)):Math.min(t,i(h)),p=0}const m=[u,h].filter(e=>Boolean(e)),g=Math.min(...m.map(e=>r?e.top:e.left)),x=Math.max(...m.map(e=>r?e.top+e.height:e.left+e.width)),b=r?{left:f,top:g,width:p,height:x-g}:{left:g,top:f,width:x-g,height:p};d.push({key:`${e.key}:+${a}`,place:{...e.list,index:a},box:b,axis:e.axis,label:t})}return d}function P(e,t=e.key){const n=[];for(let l=1;l<e.children.length;l++){const a=e.children[l-1],r=e.children[l],o=a.top+a.height;n.push({key:`${t}:${l}`,place:{...e.list,index:l},box:{left:e.box.left,top:o,width:e.box.width,height:Math.max(r.top-o,0)}})}return n}var Q={nodes:[],zones:[]},R="data-puck-dropzone",Z="data-puck-component";function J(e,t){if(e.length>=2){const[t,n]=e;return Math.abs(n.top-t.top)<Math.min(t.height,n.height)/2&&n.left>t.left?"x":"y"}const n=t.ownerDocument.defaultView?.getComputedStyle(t);return n&&n.display.includes("flex")&&n.flexDirection.startsWith("row")?"x":"y"}function V(e,t){const{frame:n,document:l}=e,a=e=>m(n,function(e){const t=e.getBoundingClientRect();return{left:t.left,top:t.top,width:t.width,height:t.height}}(e),t),r=[],o=[];for(const e of l.querySelectorAll(`[${R}]`)){if(x(e))continue;const t=e.getAttribute(R)??"";let n;try{n=s(t)}catch{continue}const l=[...e.querySelectorAll(`[${Z}]`)].filter(t=>t.parentElement?.closest(`[${R}]`)===e&&!x(t)),i=l.map(a);o.push({key:t,list:n,box:a(e),axis:J(i,e),children:i}),l.forEach((e,t)=>{const l=e.getAttribute(Z);l&&r.push({id:l,place:{...n,index:t},box:i[t]})})}return{nodes:r,zones:o}}var W="data-es-empty-cell",U="data-puck-dropzone",G=140;var _=e=>({left:e.left,top:e.top,width:e.width,height:e.height});function ee(o){const{canvas:s,session:m,readOnly:x,words:D=e.canvas}=o,T=b(o);y(()=>{T.current=o});const C=b(null),S=c(s),[$,E]=v(0),K=w(()=>E(e=>e+1),[]),[O,q]=v(Q);y(()=>{const e=C.current;s&&e&&q((T.current.measure??V)(s,e))},[s,S,o.revision,$]);const H=o.model,X=k(()=>H(O),[H,O]),F=N(m.subscribe,m.shown,m.shown),P=o.choose,R=(e,t)=>{const n=I(X.sources,e,t);return 0===n.length?null:P?P(n):n[n.length-1]},[Z,J]=v(null),[G,ee]=v(null),[te,ne]=v(null),le=b(null),ae=()=>{le.current&&clearTimeout(le.current),le.current=null},re=()=>{ae(),le.current=setTimeout(()=>{m.get()||J(null)},140)};y(()=>ae,[]);const oe=b(null),se=d(s),ie=b(!1);ie.current=se,y(()=>{se&&(ae(),J(null))},[se]);const[ce,de]=v(null);u(s,h,e=>de(e.detail?.id??null));const ue=!ce||se||x||F?null:O.nodes.find(e=>e.id===ce)?.box??null;u(s,"mousemove",e=>{const t=C.current;if(!s||!t)return;const n=f(s.frame,e.clientX,e.clientY,t),l=p(t),a={x:n.x/l,y:n.y/l};if(oe.current=a,T.current.readOnly||m.get()||ie.current)return;ae();const r=R(a.x,a.y);J(e=>e?.key===r?.key&&e?.box===r?.box?e:r)}),u(s,"mouseout",e=>{e.relatedTarget||(oe.current=null,re())}),u(s,"mouseover",e=>{e.relatedTarget||K()});const he=b(null),fe=w(()=>{he.current?.(),he.current=null,ee(null),ne(null)},[]);y(()=>m.subscribe(()=>{m.get()?K():fe()}),[m,fe,K]),y(()=>fe,[fe]),("undefined"==typeof document?y:A)(()=>{if(m.get())return;const e=oe.current;J(t=>x||ie.current?null:e?R(e.x,e.y):t?X.sources.find(e=>e.key===t.key)??null:null)},[X,F,m,x,P]);const pe=e=>{const t=m.get(),n=C.current,l=T.current.dropOn;if(!t||!n||!l)return null;const a=g(n,e.clientX,e.clientY);oe.current=a;const r=I(X.sources,a.x,a.y);for(let e=r.length-1;e>=0;e-=1)if(l.accepts(t.item,r[e]))return{h:t,source:r[e]};return null},me=e=>{const t=m.get(),n=C.current;if(!t||!n)return null;const l=g(n,e.clientX,e.clientY);oe.current=l;const a=Y(X.zones,l.x,l.y,e=>T.current.canDrop(t.item,e),e=>!!t.from&&r(t.from,e),e=>T.current.fallThrough?.(t.item,e,t.from)??!0);return a?{h:t,t:a}:null},ge={onDragEnter:e=>{if(he.current)return;const t=n(e.currentTarget.parentElement?.parentElement??null),r=s?l(s.document):null,o=[];t&&o.push(a(t)),r&&s&&o.push(a(r,s.frame)),he.current=o.length?()=>o.forEach(e=>e()):null},onDragOver:e=>{const n=pe(e);if(n)return e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed),ee(null),void ne(e=>e&&e.key===n.source.key&&e.box===n.source.box?e:n.source);ne(null);const l=me(e);if(!l)return void ee(null);e.preventDefault(),e.dataTransfer.dropEffect=t(e.dataTransfer.effectAllowed);const a={zoneKey:l.t.zone.key,line:l.t.line,axis:l.t.zone.axis};ee(e=>e&&e.zoneKey===a.zoneKey&&e.line.left===a.line.left&&e.line.top===a.line.top?e:a)},onDragLeave:e=>{const t=e.relatedTarget;t&&e.currentTarget.contains(t)||(oe.current=null,ee(null),ne(null))},onDrop:e=>{const t=pe(e);if(t)return e.preventDefault(),m.end(),fe(),void T.current.dropOn.onDrop(t.h.item,t.source);const n=me(e);n&&(e.preventDefault(),m.end(),fe(),T.current.onDrop(n.h.item,n.t.to))}},xe={draggable:!x&&!!Z,onMouseEnter:ae,onMouseLeave:()=>!m.get()&&re(),onDragStart:e=>{if(Z&&!x){m.start({key:Z.key,item:Z.item,from:Z.from}),e.dataTransfer.effectAllowed="move";try{e.dataTransfer.setData("text/plain",Z.key)}catch{}}else e.preventDefault()},onDragEnd:()=>{m.end(),fe()},onClick:()=>{Z&&!x&&T.current.onPick?.(Z.item)}},{seams:be=[]}=X,ye=X.zones.filter(e=>0===e.children.length),ve=!o.onZoneAdd||x||se?[]:ye,we=ve.map(e=>e.key).join("\n");return y(()=>{const e=s?.document;if(!e)return;const t=new Set(we?we.split("\n"):[]);for(const n of e.querySelectorAll(`[${U}]`))n.toggleAttribute(W,t.has(n.getAttribute(U)??""));return()=>{for(const t of e.querySelectorAll(`[${W}]`))t.removeAttribute(W)}},[s,we,O,S,$]),/* @__PURE__ */L("div",{ref:C,className:"es-canvas-layer",children:[F||!o.onSeamAdd||x||se?null:be.map(e=>
|
|
5
|
+
/* @__PURE__ */j(B,{className:"es-canvas-seam",axis:e.axis,index:e.place.index,label:e.label??o.seamLabel??D.addSection,onInsert:()=>o.onSeamAdd?.(e.place),style:"x"===e.axis?{left:e.box.left+e.box.width/2-12,top:e.box.top,width:24,height:e.box.height}:{left:e.box.left,top:e.box.top+e.box.height/2-12,width:e.box.width,height:24}},e.key)),ve.length?ve.map(e=>/* @__PURE__ */j("button",{type:"button",className:["es-canvas-empty",e.addAlways?"is-always":"",G?.zoneKey===e.key?"is-over":""].filter(Boolean).join(" "),style:_(e.box),"data-node-id":e.list.parentId===i?void 0:e.list.parentId,onClick:()=>o.onZoneAdd?.({...e.list,index:0}),children:/* @__PURE__ */j("span",{className:"es-canvas-empty-add",children:D.addButton({label:e.addLabel??o.zoneAddLabel??D.addBlock})})},e.key)):null,F?/* @__PURE__ */j("div",{className:"es-canvas-catch",...ge}):null,te&&F?/* @__PURE__ */j("div",{className:"es-canvas-target",style:_(te.box),children:o.dropOn?.label?/* @__PURE__ */j("span",{className:"es-canvas-target-label",style:M(),children:o.dropOn.label(F.item,te)}):null}):null,G&&!ye.some(e=>e.key===G.zoneKey)?/* @__PURE__ */j("div",{className:`es-canvas-line is-${G.axis}`,style:_(G.line)}):null,ue?/* @__PURE__ */j("span",{className:"es-canvas-hint"+(ue.width<200?" is-below":""),style:{...M(),left:ue.left+ue.width,top:ue.width<200?ue.top+ue.height:ue.top},children:D.typeHint}):null,
|
|
6
6
|
/* @__PURE__ */j("div",{className:"es-canvas-handle-spot",style:Z?{"--es-handle-x":`${Z.box.left+2}px`,"--es-handle-y":`${Math.max(Z.box.top-11,0)}px`}:void 0,children:/* @__PURE__ */j(z,{className:"es-canvas-handle-tip",side:"top",content:!Z||x||F?null:Z.title??D.handle({label:Z.label}),children:/* @__PURE__ */L("div",{className:["es-canvas-handle",Z&&!x?"is-shown":"",F?"is-dragging":""].filter(Boolean).join(" "),...xe,children:[
|
|
7
|
-
/* @__PURE__ */j("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),Z?.label]})})})]})}var te=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function ne({groups:t,session:n,itemFor:l,onInsert:a,onTileMenu:r,at:
|
|
8
|
-
return L("div",{className:"es-add",children:[
|
|
9
|
-
/* @__PURE__ */j("span",{children:
|
|
7
|
+
/* @__PURE__ */j("span",{className:"es-canvas-grip","aria-hidden":"true",children:"⋮⋮"}),Z?.label]})})})]})}var te=e=>e.tiles.length>0&&e.tiles.every(e=>null!=e.cover);function ne({groups:t,session:n,itemFor:l,onInsert:a,onTileMenu:r,at:s,hint:i,searchLabel:c,readOnly:d,words:u=e.add}){const h=i??u.hint,f=c??u.search,[p,m]=v(""),g=D(),x=p.trim().toLowerCase(),b=function(e){const t=/* @__PURE__ */new Map;return e.map(e=>{const n=e.key??e.title,l=t.get(n)??0;return t.set(n,l+1),0===l?n:`${n}\0${l}`})}(t),y=t.map((e,t)=>({...e,key:b[t],tiles:x?e.tiles.filter(e=>((e,t)=>e.label.toLowerCase().includes(t)||(e.keywords??[]).some(e=>e.toLowerCase().includes(t)))(e,x)):e.tiles})).filter(e=>e.tiles.length>0),w=(e,t)=>a=>{if(t)a.preventDefault();else{n.start({key:`new:${e}`,item:l(e)}),a.dataTransfer.effectAllowed="copy";try{a.dataTransfer.setData("text/plain",e)}catch{}}};/* @__PURE__ */
|
|
8
|
+
return L("div",{className:"es-add",children:[s?/* @__PURE__ */L("div",{className:"es-add-at",role:"status",children:[
|
|
9
|
+
/* @__PURE__ */j("span",{children:s.label}),o(u.stop,/* @__PURE__ */j("button",{type:"button",className:"es-add-at-clear","aria-label":u.stop,onClick:s.onClear,children:/* @__PURE__ */j($,{size:12,"aria-hidden":"true"})}))]}):null,
|
|
10
10
|
/* @__PURE__ */j("p",{className:"es-add-hint",children:h}),
|
|
11
11
|
/* @__PURE__ */j("div",{className:"es-add-find",children:/* @__PURE__ */j(C,{id:g,type:"search","aria-label":f,placeholder:u.searchPlaceholder({label:f}),value:p,onChange:e=>m(e.target.value),leftIcon:/* @__PURE__ */j(E,{size:16,"aria-hidden":"true"}),rightAdornment:p?/* @__PURE__ */j(T,{size:"sm","aria-label":u.clearSearch,onClick:()=>m(""),children:/* @__PURE__ */j($,{size:12,"aria-hidden":"true"})}):void 0})}),0===y.length?/* @__PURE__ */L("div",{className:"es-add-empty",role:"status",children:[
|
|
12
12
|
/* @__PURE__ */j("div",{className:"es-add-empty-title",children:u.nothing({query:p.trim()})}),
|
|
@@ -14,5 +14,5 @@ return L("div",{className:"es-add",children:[o?/* @__PURE__ */L("div",{className
|
|
|
14
14
|
/* @__PURE__ */L("div",{className:"es-add-group-head",children:[
|
|
15
15
|
/* @__PURE__ */j("span",{className:"es-add-group-title",children:e.title}),
|
|
16
16
|
/* @__PURE__ */j("span",{className:"es-add-group-count",children:e.tiles.length})]}),
|
|
17
|
-
/* @__PURE__ */j("div",{className:te(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(d||e.disabled),l=d?void 0:e.disabled?e.disabledReason:e.title??u.tile({label:e.label});return
|
|
17
|
+
/* @__PURE__ */j("div",{className:te(e)?"es-add-grid is-cards":"es-add-grid",children:e.tiles.map(e=>{const t=Boolean(d||e.disabled),l=d?void 0:e.disabled?e.disabledReason:e.title??u.tile({label:e.label});return o(l,/* @__PURE__ */L("button",{type:"button",className:null!=e.cover?"es-add-tile has-cover":"es-add-tile",draggable:!t,"aria-disabled":t||void 0,"aria-label":u.tile({label:e.label}),onDragStart:w(e.type,t),onDragEnd:()=>n.end(),onClick:()=>!t&&a?.(e.type),onContextMenu:r?t=>{r(e.type,{x:t.clientX,y:t.clientY,owner:t.currentTarget})&&t.preventDefault()}:void 0,children:[null!=e.cover?/* @__PURE__ */j("span",{className:"es-add-tile-cover","aria-hidden":"true",children:e.cover}):e.icon?/* @__PURE__ */j("span",{className:"es-add-tile-glyph","aria-hidden":"true",children:e.icon}):null,
|
|
18
18
|
/* @__PURE__ */L("span",{className:"es-add-tile-label",children:[e.label,null!=e.mark?/* @__PURE__ */j("span",{className:"es-add-tile-mark","aria-hidden":"true",children:e.mark}):null]})]},e.type))})})]},e.key))]})}export{ne as AddPanel,ee as CanvasDragLayer,B as CanvasInsert,Q as EMPTY_MEASURE,G as HANDLE_GRACE_MS,Y as canvasTarget,K as contains,H as gapInZone,X as gapLine,F as insertSeams,V as measureCanvas,q as pickSource,P as seamsBetween,I as sourcesAt};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as o}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as l}from"./chunk-BVN33R76.js";import{sharedSectionsOf as r}from"./chunk-43AEUUNQ.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SINAM2IT.js";import{blockRuns as c}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-PAOZMXEI.js";import{useEaselSession as m}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-23DYNW6S.js";import{useEasel as u}from"./chunk-EFHV56BO.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-LQV5FZTQ.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-KAML3KQH.js";import{useState as b,useEffect as v,useMemo as j,useRef as w}from"react";import{SharedIcon as C,AddIcon as O}from"efficient-shell/icons/efficient";import{ContextMenu as T,toast as A,Dialog as E,Button as F}from"efficient-shell/ui";import{jsx as I,jsxs as M,Fragment as $}from"react/jsx-runtime";function x({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=w(null);/* @__PURE__ */
|
|
2
|
+
return I(E,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */M($,{children:[
|
|
3
|
+
/* @__PURE__ */I(F,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
|
|
4
|
+
/* @__PURE__ */I(F,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var N=e=>`section:${e}`,B=e=>`block:${e}`,D=e=>`template:${e}`,L=e=>`shared:${e}`;function Q({at:w,placeBlocks:E,canTake:F,onPick:Q,itemFor:S,session:V,siteWide:H,onClose:P,onHide:Z,readOnly:z}){const W=u(e=>e.config),K=a(),{labelAtLevel:R,categoryLabel:U,firstSection:Y,Icon:_,Thumbnail:G}=K,{blockIsOffered:J,canAddTo:X}=d(),q=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>J(e,te);return l(te).list().then(n=>{if(e)return;const l=W.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[W,te]);const le=p().shared,re=h("screen",f).shared,[ie,se]=b([]),[ce,ae]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>J(e,te);return r(te).list().then(n=>{if(e)return;const l=W.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[W,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(W,K),[W]),ye=e=>R(e,"section",W.components[e]?.label??e),he=e=>({type:N(e.type),label:e.name,cover:/* @__PURE__ */I(G,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:q.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ke=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=ne.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ie.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}return null},ge=e=>/* @__PURE__ */I("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */I(_,{type:e,size:26})}),be=j(()=>{const e=t(ue,Y),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!J(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=X(t.type)?.choices??[];e.forEach(l),e.forEach(e=>X(e.type,1)?.choices?.forEach(l))}E?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:B(e.type),label:e.label,cover:ge(e.type),title:q.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>o.has(e.type)?{...he(e),cover:ge(e.type)}:he(e),d=[];ie.length>0&&d.push({key:"shared",title:re.group,tiles:ie.map(e=>({type:L(e.id),label:e.title,cover:/* @__PURE__ */I(G,{type:e.node.type}),mark:/* @__PURE__ */I(C,{size:12}),title:re.onPages({count:e.used_on.length}),keywords:[ye(e.node.type),e.node.type]}))}),ne.length>0&&d.push({key:"templates",title:q.templates,tiles:ne.map(e=>({type:D(e.id),label:e.name,cover:/* @__PURE__ */I(G,{type:e.node.type}),keywords:[ye(e.node.type),e.node.type]}))});const p=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(W.categories??{})){const o=ue.filter(e=>e.cat===t);if(0===o.length)continue;const l=e&&o.some(t=>t.type===e.type)?e:null,r=(l?[l,...o.filter(e=>e.type!==l.type)]:o).map(a);l&&!m&&(r.splice(1,0,...p.map(s)),m=!0),d.push({key:`category:${t}`,title:n(W,t,U),tiles:r})}const f=d.find(e=>e.key?.startsWith("category:"));if(!m&&f&&p.length>0&&(f.tiles=[...f.tiles,...p.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!F)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?F(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[ne,ie,re,ue,W,q,F,E,te]);/* @__PURE__ */
|
|
5
|
+
return M($,{children:[
|
|
6
|
+
/* @__PURE__ */I(i,{icon:/* @__PURE__ */I(O,{size:15}),title:q.title,context:q.contextAll,actions:/* @__PURE__ */I(s,{label:q.done,description:q.doneDescription,onClick:P}),onHide:Z}),
|
|
7
|
+
/* @__PURE__ */M("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
+
/* @__PURE__ */I(k,{groups:be,session:V,itemFor:e=>S(ke(e)??{kind:"section",type:e}),onInsert:Q?e=>{const t=ke(e);t&&Q(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!z&&(pe({section:n.section,...t}),!0)},at:w,hint:q.hint,searchLabel:q.search,readOnly:z,words:ee}),H??null]}),de?/* @__PURE__ */I(T,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>pe(null),"aria-label":de.section.title,items:y([{label:re.deleteShared,danger:!0,onClick:()=>{fe(de.section),pe(null)}}])}):null,me?/* @__PURE__ */I(x,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void A.error(re.deleteFailed)}fe(null),le?.removed?.(e),se(t=>t.filter(t=>t.id!==e.id)),ae(e=>e+1)})(me),onCancel:()=>fe(null)}):null]})}export{Q as AddSidePanel,B as blockKey,N as sectionKey,L as sharedKey,D as templateKey};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-JBOSEHIX.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-TNGOL65V.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-I7BROL77.js";import{SlotChildActionsProvider as h}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-C56MPJBH.js";import{usePartBridge as y}from"./chunk-MEHLY5Q4.js";import{useSectionOps as v}from"./chunk-WEIE2FBC.js";import{ScreenSaveIcon as k,ScreenMainButton as b}from"./chunk-PY7OOQEZ.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-R5KEFI55.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{PanelHideButton as I,SidePanelHead as N,PanelShowStrip as O}from"./chunk-SINAM2IT.js";import{offeredChoices as B}from"./chunk-M2Z775ZC.js";import{useScreenSaveSwitch as P,useScreenNodeKeys as $,useScreenPinned as M,useScreenDocumentLabel as j,useScreenCanvasFrame as A,useScreenInspectorPanel as L,useScreenDevices as T,useScreenPickFollowsSelection as E,useScreenLeftView as R,SELECTION_MODE as F,sameInspectorMode as D,useScreenBridges as H,useScreenBlockRules as V,useScreenBlockLook as W,useScreenStorageNamespace as U,useScreenNotify as J,useScreenCanvasHead as Y,isSlotMode as G,useScreenStyleClipboard as K,useScreenDocumentPass as Q,useScreenCanvasDrag as Z,ScreenCanvasTargetProvider as X,isPinnedFirst as _,isPinnedLast as q,screenSlotsOf as ee}from"./chunk-PAOZMXEI.js";import{MediaPopup as ne}from"./chunk-2G6MAXPY.js";import{useNodeClipboard as te,useNodeContextMenu as oe}from"./chunk-6FWAE2RN.js";import{PageEditGuardNotices as re}from"./chunk-UJ46J7QW.js";import{useScreenDocument as ie}from"./chunk-276MBG5P.js";import{requestMediaPick as le}from"./chunk-UNVKPVZW.js";import{useMediaPanel as se,usePanelPick as de,useMediaBrowsing as ae,useOpenMediaBrowse as ce,useMediaPlace as pe}from"./chunk-FHCKFOCD.js";import{useEaselSession as ue}from"./chunk-O7Q4DDJT.js";import{useEaselHost as he,useHostEscape as fe}from"./chunk-MQA7OFRA.js";import{LayersIcon as me,MediaIcon as ge}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ye}from"./chunk-23DYNW6S.js";import{heldStyle as ve,styleShortcut as ke}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as be}from"./chunk-6WY6ZXJG.js";import{useEasel as Se,useEaselApi as we,CanvasPassThroughContext as xe,CanvasSharedContext as ze}from"./chunk-EFHV56BO.js";import{TreeRow as Ce,Subtree as Ie,LayersTree as Ne,TreeGroupLabel as Oe,TreeRowAction as Be,TreeSeam as Pe}from"./chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as $e}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Me}from"./chunk-WK3AFPXY.js";import{toItemSelector as je,useNodeOps as Ae,clickPick as Le}from"./chunk-BSHIQIZC.js";import{EaselTopBar as Te,EaselIconButton as Ee,TopBarCluster as Re,DeviceSwitch as Fe,InspectorIconButton as De,PanelResizeHandle as He,MAX_PANEL_W as Ve,MIN_PANEL_W_BY_SIDE as We,panelWidthVars as Ue}from"./chunk-ZG6PVMC3.js";import{DEFAULT_NOTICE_WORDS as Je,DEFAULT_CHROME_WORDS as Ye}from"./chunk-AJSDWWJW.js";import{holderOf as Ge,nameOrSomeone as Ke}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as Qe}from"./chunk-RE4LP46F.js";import{useWords as Ze}from"./chunk-MFIRYGHW.js";import{insertSeams as Xe,CanvasDragLayer as _e,CanvasInsert as qe}from"./chunk-LQV5FZTQ.js";import{DEFAULT_DRAG_WORDS as en}from"./chunk-KAML3KQH.js";import{createDragSession as nn,useTreeDrag as tn,gapToMoveIndex as on}from"./chunk-3S5N4HLJ.js";import{ROOT_ID as rn,ROOT_SLOT as ln,zoneKey as sn,parseZoneKey as dn,find as an,DataError as cn}from"./chunk-K7BTCBWD.js";import{useCanvasFrame as pn,LIST_SELECTOR as un,BLOCK_SELECTOR as hn,useCanvasTyping as fn,useCanvasEvent as mn,nodeIdAt as gn,frameRectToHost as yn,BLOCK_ATTRIBUTE as vn,drawnBox as kn}from"./chunk-QIDRJH3S.js";import{rootRowName as bn,slotChildRowName as Sn,slotChildRenameProp as wn,sectionRenameProp as xn}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as zn,blockNodeActions as Cn,TREE_MAX_DEPTH as In,childSlotsOf as Nn,slotFieldsOf as On,newNodeId as Bn,slotChildrenIn as Pn,nestsInTree as $n}from"./chunk-PLVEGYK6.js";import{queryMainCopy as Mn}from"./chunk-LF3FUSCQ.js";import{useRef as jn,useMemo as An,useState as Ln,useEffect as Tn,useCallback as En,useLayoutEffect as Rn,Fragment as Fn,useId as Dn}from"react";import{ColoredBadge as Hn,Button as Vn,Tabs as Wn,toast as Un,readMediaFileDrag as Jn,Tooltip as Yn,groupColors as Gn,Dialog as Kn,FormField as Qn,Input as Zn,MEDIA_FILE_DRAG_TYPE as Xn}from"efficient-shell/ui";import{UndoIcon as _n,RedoIcon as qn,RefreshIcon as et,AddIcon as nt,TrashIcon as tt,EyeOffIcon as ot,EyeIcon as rt,SharedIcon as it,DuplicateIcon as lt}from"efficient-shell/icons/efficient";import{jsx as st,jsxs as dt,Fragment as at}from"react/jsx-runtime";var ct="media-file";function pt({name:e,onMake:n,onCancel:t}){const o=Ze("screen",ye).shared,[r,i]=Ln(e),[l,s]=Ln(!1),d=Dn(),a=jn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
+
return st(Kn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */dt(at,{children:[
|
|
3
|
+
/* @__PURE__ */st(Vn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
+
/* @__PURE__ */st(Vn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */st("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */st(Qn,{label:o.name,htmlFor:d,children:/* @__PURE__ */st(Zn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var ut=/* @__PURE__ */new WeakSet;function ht(e,n,t){const o=an(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function ft({canvas:e,tabs:n,onSelect:t}){const o=jn(null),[r,i]=Ln({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Rn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=yn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Mn(t,`[${vn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?kn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=yn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */st("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */st("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
|
|
5
|
+
/* @__PURE__ */st(Yn,{content:e.reach,children:/* @__PURE__ */dt(Hn,{colorClass:Gn("success","solid"),size:"sm",children:[
|
|
6
|
+
/* @__PURE__ */st("span",{className:"es-band-tab-mark",children:/* @__PURE__ */st(it,{size:12})}),e.label]})}):/* @__PURE__ */st(Hn,{colorClass:Gn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function mt({expand:e}){/* @__PURE__ */
|
|
7
|
+
return st("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */dt(at,e?{children:[
|
|
8
|
+
/* @__PURE__ */st("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
+
/* @__PURE__ */st("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
+
/* @__PURE__ */st("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
+
/* @__PURE__ */st("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
+
/* @__PURE__ */st("path",{d:"M5 12h14"})]})})}var gt=`${un}, ${hn}`;function yt(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var vt="__rungs";var kt="screen:band",bt={duplicate:!0,delete:!0},St=()=>null;function wt(){const un=he(),yn=un.panels?.Toolbar,vn=(un.panels?.useRight??St)(),{target:kn,docId:Dn,capabilities:Yn,currentSlug:Gn,siteId:Kn,onPublish:Qn,saveState:Zn,saveConflict:it,retrySave:wt,toggleAutoSave:xt,flushSave:zt,access:Ct,saveUnreachable:It=!1,readOnly:Nt,readOnlyReason:Ot=null}=ie(),Bt=P(),Pt=$(),{mediaEditing:$t,hasEditGuard:Mt,hasPinnedChrome:jt}=Yn,{appState:At,dispatch:Lt,history:Tt,selectedItem:Et,getSelectorForId:Rt,config:Ft}=Se(e=>e),Dt=M(),{first:Ht,firstGroup:Vt,lastGroup:Wt,isSectionGroup:Ut,sectionGroupZone:Jt,panelOf:Yt}=Dt,Gt=Yt(Ht),Kt=e=>_(Dt,e),Qt=e=>q(Dt,e),Zt="node"===Dt.firstRow,Xt=Dt.band??null,_t=Ze("screen",ye),qt=Ze("tree",$e),eo=Ze("drag",en),no=Ze("notice",Je),to=Ze("lock",Qe),oo=Ze("menu",Me),ro=Ze("styleClipboard",be),io=Ze("chrome",Ye),lo=j()??`/${Gn}`,so=A(),ao=L(),co=v({readOnly:Nt}),po=v({readOnly:Nt,foldIntoHistory:!0}),uo=jn(null),ho=we(),fo=An(()=>({...co,select:e=>{uo.current=e,co.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=ho.config;uo.current=je(e,t,n)}co.commitDocument(e,n)}}),[co,ho]),mo=At.ui,go=mo.leftSideBarVisible,yo=mo.rightSideBarVisible,{options:vo,widths:ko,initial:bo,fluid:So,fit:wo}=T(),[xo,zo]=Ln(bo),Co=se(),Io=$t&&null!==Co;de(),ae();const No=ce();E(Et?.props.id);const{read:Oo,write:Bo,forSelection:Po}=R(),[$o,Mo]=Ln(Oo);Tn(()=>{Bo($o)},[$o]);const[jo,Ao]=Ln(0),Lo=jn(null),To=jn(null),Eo=pn(To,{readySelector:gt}),Ro=fn(Eo),Fo=a(To);c(To,Eo);const Do=S(),Ho=Ge(Ct),Vo={state:Zn,offline:Do||Zn.failed&&It,readOnlyReason:Ot,editing:Ho?no.editing({name:Ke(Ho.name,to),noun:_t.noun}):null,conflict:null!=it,notSaving:_t.bar.notSaving},Wo=()=>{Nt||(Zn.failed?wt():zt())};p(To,Eo,Wo);const[Uo,Jo]=Ln(!1),Yo=jn(!1),[Go,Ko]=Ln(null),[Qo,Zo]=Ln([]),[Xo,_o]=Ln(F),qo="puck"===Xo.kind,er=o(Xo,Et?.props.id),[nr,tr]=Ln(null);Tn(()=>{nr&&(r(),tr(null))},[nr]);const or=jn(Rt);or.current=Rt;const rr=En((e,{scroll:n})=>{Mo(n=>Po(e,n)),n&&tr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=or.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&jr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),ir=jn(null);Tn(()=>{const e=ir.current;ir.current=null;const n=null==Et?.props.id?null:String(Et.props.id);_o(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Yt(Et?.type)??F);const t=Et?.props.id,o=uo.current;if(uo.current=null,!t)return;const r=Rt(t);rr(String(t),{scroll:!i(o,r??null,zn)})},[Et?.props.id,rr]);const lr=En(e=>{_o(n=>D(n,e)?n:e),Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Lt]),sr=jn(()=>{});sr.current=(e,n)=>{const t=e?Bi(e.zone??zn)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Et?.props.id?null:String(Et.props.id);_o(e=>D(e,n)?e:n),o!==r&&(ir.current={id:o,mode:n},fo.select(e))};const dr=En((e,n)=>sr.current(e,n),[]),ar={kind:Xo.kind,mode:Xo,open:lr,show:e=>_o(e),reveal:()=>{yo||Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:dr},cr=H(ar,{data:At.data,selected:Et??null,zoneOf:e=>Rt(e)?.zone,readOnly:Boolean(Nt),select:e=>{_o(F),fo.select({index:e})},replace:(e,n)=>fo.replaceComponent(zn,e,n),scrollTo:e=>l(e)},{device:xo,refreshes:jo},{setView:Mo,reveal:()=>{go||Lt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),pr=cr.resolveLeftView?cr.resolveLeftView($o):"sections",ur=V(),{isLockedBlock:hr,duplicateBlocked:fr,nestDepth:mr,newSectionNode:gr,canAddTo:yr,blockIsOffered:vr}=ur,kr=W(),{labelAtLevel:br,Icon:Sr,useProducts:wr}=kr,xr=kr.rowName?(e,n,t)=>kr.rowName(e,n,t):void 0,zr=En(e=>{Lt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),rr(e,{scroll:!0})},[Lt,rr]),{selectNode:Cr,openPartId:Ir}=y({mode:Xo,setMode:_o,onOpenPart:zr}),[Nr,Or]=Ln(null);fe(null!==Nr,()=>Or(null));const Br=f(U()),Pr=Br.collapsed,$r=Br.panelWidths,[Mr,jr]=Ln(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Pr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
+
return new Set}});Tn(()=>{try{window.localStorage.setItem(Pr,JSON.stringify([...Mr]))}catch{}},[Mr]);const[Ar,Lr]=Ln(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem($r);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left,"left"),right:g(Number(n.right)||m.right,"right")}}catch{return{...m}}});Tn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem($r,JSON.stringify(Ar))}catch{}},300);return()=>clearTimeout(e)},[Ar]);const Tr=En((e,n)=>Lr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Er=En(e=>Tr("left",e),[Tr]),Rr=En(e=>Tr("right",e),[Tr]),Fr=e=>Mr.has(e),Dr=e=>jr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Hr=jn(!1),Vr=jn(null);Tn(()=>{if(Hr.current&&!Uo){const e=Vr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??To.current?.querySelector(`button[aria-label="${CSS.escape(_t.add.title)}"]`))?.focus(),Vr.current=null}Hr.current=Uo},[Uo]),Tn(()=>{if(!Uo||!Fo)return;const e=e=>{"Escape"===e.key&&sl()};return Fo.addEventListener("keydown",e),()=>Fo.removeEventListener("keydown",e)},[Uo,Fo]),fe(Uo,()=>sl()),Tn(()=>{!go&&Uo&&(Jo(!1),Ko(null),Yo.current=!1)},[go]);const Wr=J(),Ur=(e,n="success",t)=>{if(Wr)return void(t?Wr(e,"error"===n?"error":"info",t):Wr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Un.error(e,{...o,duration:t?.duration??3200}):Un.success(e,{...o,duration:t?.duration??1900})},Jr=jn(null),[Yr,Gr]=Ln(0),[Kr,Qr]=Ln(0),Zr=Y(),Xr=jn(null),_r=e=>Math.max(0,e.clientHeight-(Xr.current?.offsetHeight??0));Tn(()=>{const e=Jr.current;if(!e)return;const n=()=>{Gr(e.clientWidth),Qr(_r(e))};n();const t=new ResizeObserver(n);return t.observe(e),Xr.current&&t.observe(Xr.current),()=>t.disconnect()},[]),Rn(()=>{Jr.current&&(Gr(Jr.current.clientWidth),Qr(_r(Jr.current)))},[Ar,go,yo]);const qr=xo===So?Yr>0?Yr:ko[So]:ko[xo],ei=Yr>0?Math.min(Yr/qr,"shrink"===wo?1:2):1,ni=qr*ei,ti=Yr>0&&ni>Yr+1,oi={width:ni,height:Kr||"100%",flex:"none",position:"relative"},ri={width:qr,height:Kr?Kr/ei:"100%",maxHeight:"none",transform:1!==ei?`scale(${ei})`:void 0,transformOrigin:"top left"},ii=()=>Lt({type:"setUi",ui:{leftSideBarVisible:!go}}),li=()=>Lt({type:"setUi",ui:{rightSideBarVisible:!yo}}),si=e=>{Uo&&(Jo(!1),Ko(null),Yo.current=!1,go&&$o===e)||(Mo(e),go||Lt({type:"setUi",ui:{leftSideBarVisible:!0}}))},di=()=>{_o(F),fo.select(null),d()},ai=()=>{_o(Gt??F),yo||Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},ci=At.data.content??[],pi=()=>{const e=ci.findIndex(Kt),n=ci.findIndex(Qt);return{floor:e>=0?e+1:0,cap:n>=0?n:ci.length}},ui=Ft,hi=ur.stripCopy,fi=n=>e(n,hi),mi=te(),gi=Ae({data:At.data,config:ui,readOnly:Boolean(Nt),clipboard:mi,strip:hi?e=>hi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==rn||e.slot!==ln)return{min:0,max:n-1};const{floor:t,cap:o}=pi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&_o(F);const t=void 0===n||"node"===n?.kind?n:null;fo.commitDocument(e,t)}}),yi=ue(),[vi,ki]=Ln(null),bi=e=>{const n=ci.find(n=>String(n.props.id)===e),t=Dt.shared;n&&t&&gi.swap(e,t.detach(n))},Si=e=>{const n=an(At.data,Ft,e);if(!n)return!1;const t=sn(n.place),o=n.node,r=t===zn?Ii(o):Di(o),i=t===zn?Dt.shared?.usedOn(o):null;return!!gi.remove(e)&&(Ur(i?_t.shared.removed({count:Math.max(0,i.length-1)}):_t.deleted({name:r}),"success",{duration:8e3,action:{label:_t.bar.undo,onClick:()=>{gi.restore(n.node,n.place)}}}),!0)},wi={...gi,remove:Si},xi=e=>br(e,"block",Ft.components[e]?.label??e),zi=En(e=>Ft.components[e]?.defaultProps??{},[Ft]),Ci=e=>br(e,"section",xi(e)),Ii=e=>bn({type:e.type,props:e.props??{}},Ci(e.type),xr),{nodeAddresses:Ni,zoneItems:Oi}=An(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=In)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Nn(Ft,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ci,zn,0),{nodeAddresses:e,zoneItems:n}},[ci,Ft]),Bi=En(e=>Oi.get(e)??[],[Oi]),Pi=e=>{const n=Ni.get(e);return n?Bi(n.zone)[n.index]:void 0},$i=e=>ee(ur,Ft,e),Mi=e=>{if(!ur.slotsOf||e===zn)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Pi(e.slice(0,n));if(!t)return null;const o=$i(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},ji=(()=>{if(!G(Xo))return null;const e=`${Xo.nodeId}:${Xo.slot}`;return Mi(e)?.slot.panel===Xo.kind?e:null})(),Ai=jn(null);Tn(()=>{const e=Ai.current;if(Ai.current=null,!ji||!G(Xo))return;const n=Xo.nodeId;rr(n,{scroll:e!==ji}),jr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Xo]);const Li=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Ni.get(e);n&&(n.zone===zn?el(n.index):Nl(n.zone,n.index,e,Pi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&ji!==i&&(Ai.current=i),dr(null,r),yo||Lt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ti=(e,n,t)=>{const o=`${e}:${n}`;if(jr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;ji!==o&&(Ai.current=o);dr(null,{kind:t,nodeId:e,slot:n})},Ei=(e,n,t)=>{if(Nt||!ur.moveSlot)return;const o=Pi(e),r=o?$i(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:vt,index:n},s=on(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=ur.moveSlot(e,n,s);"string"==typeof d&&Ti(e,d,i.panel)},Ri=wr(),Fi=An(()=>{const e=/* @__PURE__ */new Map;for(const n of Ri??[])e.set(n.slug,n.name);return e},[Ri]),Di=e=>Sn(e,xi,kr.plainText,e=>Fi.get(e),kr.rowName),Hi=(e,n)=>{const t=Ft.components[e.type]?.fields,o=n===zn||ql(n)?"section":"block",r=n===zn&&(Kt(e)||Qt(e)||Ut(e.type)),i="block"===o?wn(t):r?null:xn(t);return kr.renamePropOf?kr.renamePropOf(e,o,i):i},Vi=(e,n,t,o)=>{if(!(!Nt&&Nr?.zone===e&&Nr.index===n))return;const r=(t,o)=>{Or(null),o&&((e,n,t)=>{const o=Bi(e)[n];if(!o)return;const r=Hi(o,e);r&&fo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
+
return st("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":_t.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},Wi=t(K(),ro),Ui=Wi.scope({target:kn,siteId:Kn,docId:Dn}),Ji=Ft,Yi=(e,n)=>n===zn?Ci(e):xi(e),Gi=(e,n,t)=>{const o=Wi.plan(Ui,t,Yi(t.type,e),Ji);o&&(o.changed&&fo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Ur(o.message))},Ki=oe({nodesIn:Bi,nodeAt:(e,n)=>Bi(e)[n]??null,labelOf:(e,n)=>n===zn?Ci(e):xi(e),renamePropOf:Hi,beginRename:(e,n)=>Or({zone:e,index:n}),history:{hasPast:Tt.hasPast,hasFuture:Tt.hasFuture,back:()=>Tt.back(),forward:()=>Tt.forward()},openPageSettings:()=>{fo.select(null),_o(F)},pageSettingsLabel:_t.pageSettings,words:{menu:oo,styleClipboard:ro,screen:_t.menu},readOnly:Boolean(Nt),collapseAll:()=>jr(new Set(Bi(zn).map(e=>String(e.props.id)))),onPasteRefused:e=>Ur(e?_t.pasteRefused({name:e.label}):_t.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ts(e,n),menuRows:(e,n,t)=>{const o=cr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Dt.shared;if(!t||n!==zn)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:_t.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return Nt||hr(e.type,e)?n:{...n,change:[{label:_t.shared.detach,onClick:()=>bi(e.props.id)}],remove:[{label:_t.shared.removeFromPage,danger:!0,onClick:()=>{Si(e.props.id)}}]}}return Nt||Kt(e)||Qt(e)||Ut(e.type)?null:z(yi)?{change:[{label:_t.shared.makeShared,onClick:()=>ki({id:e.props.id,name:Ii(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>hr(e.type,e),duplicateBlocked:e=>fr(At.data,e),permits:e=>{const n=Cn(Ft,e.type);return Dt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:wi,isPinned:(e,n)=>n===zn&&(Kt(e)||Qt(e)),sectionBand:pi,locate:e=>Ni.get(e)??null,rowNameOf:(e,n)=>n===zn?Ii(e):Di(e),selectAt:(e,n,t,o)=>{e===zn?el(n):Nl(e,n,t,o??"")},slotRung:e=>{const n=Mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Li(n.node,n.slot,!1)}:null},style:{held:()=>ve(Ui),canCopy:e=>Wi.rows(Ji,e).some(e=>!1!==e.counted),copy:(e,n)=>Wi.copy(Ui,e,Yi(e.type,n),Ji),paste:(e,n,t)=>Gi(e,n,t)},keys:Pt?{target:Fo,selected:()=>{const e=At.ui.itemSelector;return e?{zone:e.zone??zn,index:e.index}:null},held:()=>mi.get(),readOnly:Boolean(Nt),onDone:({done:e,name:n})=>{"copied"===e&&Ur(_t.copied({name:n}))}}:void 0},Eo),Qi=jn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Tn(()=>{Qi.current={copy:(e,n)=>Wi.copy(Ui,e,Yi(e.type,n),Ji),paste:Gi,at:()=>{const e=At.ui.itemSelector;if(!e)return null;const n=e.zone??zn,t=Bi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(Nt)}});const Zi=En(e=>{const n=ke(e);if(!n)return;const t=Qi.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);Tn(()=>{if(!Fo)return;const e=e=>Zi(e);return Fo.addEventListener("keydown",e),()=>Fo.removeEventListener("keydown",e)},[Zi,Fo]),mn(Eo,"keydown",Zi);const Xi=ci.map(e=>e.props.id).join("|");Tn(()=>{const e=Eo?.document??null,n=Eo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Zo(e=>e.length?[]:e);const n=ci.findIndex(Qt),t=n>=0?n:ci.length,o=n=>{const t=ci[n]?.props?.id;return null==t?null:Mn(e,`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(hn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ci.length>0&&!Kt(ci[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=yt(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Zo(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Eo,Xi,xo,ei,go,yo,Et?.props.id]);const _i=Eo?.document??null,qi=Eo?.window??null;Tn(()=>{const e=Lo.current;if(!e||!_i||!qi)return;const n=[],t=()=>{const n=Mn(_i,`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&qi.scrollTo({left:qi.scrollX,top:qi.scrollY+t,behavior:"instant"}),!0};return Lo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[_i,qi]);const el=e=>{_o(F),fo.select({index:e}),cr.sectionPressed?.(ci[e]);const n=ci[e]?.props?.id;n&&l(n)},nl=e=>{const{floor:n,cap:t}=pi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Et&&Xo.kind!==Gt?.kind?ci.findIndex(e=>e.props.id===Et.props.id):-1;return o(r>=0?r+1:t)},tl=(e,n)=>{const{floor:t,cap:o}=pi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(fo.reorderComponent(zn,e,i),fo.select({index:i}),{moved:!0,dest:i})},ol=(e,n,t,o)=>{_o(F),fo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Ur(_t.sectionAdded({name:t}))},rl=(e,n)=>{const t=nl(n),o=gr(e,{nodeDefaults:zi,newNodeId:Bn,sectionLabel:Ci,blockIsOffered:vr}),r=o?fo.insertNode(zn,t,o):fo.insertSection(e,t);return ol(t,r,Ci(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of Nn(Ft,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=yr(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},il=e=>ll(zn,e),ll=(e,n)=>{Vr.current=document.activeElement??null,Ko(null===n?null:{zone:e,index:n}),Jo(!0),go||(Yo.current=!0,Lt({type:"setUi",ui:{leftSideBarVisible:!0}}))},sl=()=>{Jo(!1),Ko(null),Yo.current&&Lt({type:"setUi",ui:{leftSideBarVisible:!1}}),Yo.current=!1},dl=(e,n)=>kr.rowName?n?Kt(e)?kr.rowName(e,"section",_t.header):Qt(e)?kr.rowName(e,"section",_t.footer):Ut(e.type)?kr.rowName(e,"section",xi(e.type)):Ii(e):Di(e):n?Ci(e.type):xi(e.type),al=e=>n=>{e()},cl=(e,n,t)=>{if(Nt)return null;const o=Bi(e)[n];return o&&!Cn(Ft,o.type).delete||o&&hr(o.type,o)?null:/* @__PURE__ */st(Be,{kind:"delete",label:e===zn&&o&&Dt.shared?.usedOn(o)?_t.shared.removeFromPage:_t.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Bi(e)[n]?.props?.id;null!=t&&Si(String(t))})(e,n),children:/* @__PURE__ */st(tt,{size:15})})},pl=e=>kr.rowPreview?.(e)||void 0,ul=e=>kr.rowMarks?.(e)??void 0,hl=(e,n,t)=>kr.rowActions?.(e,n,t)??null,fl=(e,n,t,o)=>{if(Nt)return null;if(hr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
+
return st(Be,{kind:"eye",label:r?_t.showNamed({name:o}):_t.hideNamed({name:o}),onClick:()=>gl(e,n,t),children:/* @__PURE__ */st(r?ot:rt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},ml=e=>Vs(zn,e),gl=(e,n,t)=>{fo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},yl=e=>On(Ft,e),vl=e=>Nn(Ft,e),kl=e=>ur.slotsOf?$i(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Pn(e,n.slot)})):[{slot:null,rung:null,kids:vl(e)}],bl=e=>ur.slotsOf?kl(e).flatMap(e=>e.kids):vl(e),Sl=e=>Boolean(ur.slotsOf)&&$i(e).some(e=>e.rung),wl=(e,n,t)=>null===t?void 0===n?yr(e):yr(e,n):yr(e,n,t),xl=(e,n,t)=>{const o=$n(Ft,e.type,n)&&(t||bl(e).length>0||Sl(e));return{collapsible:o,folded:o&&Fr(String(e.props.id))}},zl=(e,n,t)=>kl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>xl(e,r,t(e.type)).collapsible?[String(e.props.id),...zl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Cl=e=>bl(e).length>0||Sl(e)||Boolean(yr(e.type)),Il=e=>Boolean(yr(e)),Nl=(e,n,t,o)=>{if(_o(F),yr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),fo.select({index:n,zone:e}),l(t)}else fo.select({index:n,zone:e}),l(t)},Ol=(e,n,t,o,r)=>{const i=`${e}:${n}`;fo.insertComponent(i,t,o),yr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),fo.select({index:o,zone:i})}):fo.select({index:o,zone:i})},Bl=jn(/* @__PURE__ */new Set);Tn(()=>{ci.forEach(e=>{const n=yr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Bl.current.has(t))return;Bl.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(zi)).forEach((e,t)=>po.seedChild(o,t,n.childType,e))})},[ci,po,zi]);const Pl=jn(/* @__PURE__ */new Set);Tn(()=>{ci.forEach((e,t)=>{const o=e.props.id;if(Pl.current.has(o))return;const r=n(e,yl(e.type));Pl.current.add(o),r&&po.replaceComponent(zn,t,{...e,props:r})})},[ci,po]),Q(po,Ft);const $l=ci.findIndex(Qt),Ml=$l>=0?ci[$l]:null,jl=Zt?ci.findIndex(Kt):-1,Al=jl>=0?ci[jl]:null,Ll=Dt.groupTab,Tl=An(()=>Ll?e=>Ut(e.type):void 0,[Ll]),El=Boolean(Dt.groupBadge),Rl=Dt.sharedReach,Fl=e=>Rl?.(e)??void 0,Dl=An(()=>Rl?new Set(ci.filter(e=>Fl(e)).map(e=>String(e.props.id))):null,[ci,Rl]),Hl=An(()=>Dl?e=>Dl.has(e):void 0,[Dl]),Vl=Dt.first?Rl?.({type:Dt.first,props:{id:""}})??void 0:void 0,Wl=Dt.groupBadge?/* @__PURE__ */st("span",{className:"es-tree-group-badge",children:/* @__PURE__ */st(Hn,{tone:"info",size:"xs",children:Dt.groupBadge})}):void 0,Ul=ci.find(e=>e.type===Vt)??null,Jl=ci.find(e=>e.type===Wt)??null,Yl=$l>=0?$l:ci.length,Gl=[];ci.forEach(e=>{Qt(e)||(Cl(e)&&Gl.push(String(e.props.id)),Gl.push(...zl(e,1,Il)))}),Ml&&(Gl.push(String(Ml.props.id)),Gl.push(...zl(Ml,1,Il)));const Kl=Gl.length>0&&Gl.every(e=>Mr.has(e)),Ql=e=>{const n=kr.blockRowName(e,xi);return kr.rowName?kr.rowName(e,"block",n):n},Zl=(e,n,t,o)=>{const r=Bi(e)[t];if(!r)return;const i={...dn(e),index:t},l={...dn(n),index:Math.min(Math.max(o,0),Bi(n).length)},s=on(i,l);if(e!==n||s!==t)try{gi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof cn))throw e}},Xl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of vl(e))n.add(r),t(o)};for(const t of yl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},_l=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ni.get(n);if(!e)return null;if(e.zone===zn)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ql=e=>{const n=e.slice(0,e.indexOf(":")),t=ci.find(e=>Ut(e.type)&&String(e.props.id)===n);return t&&Jt(n)===e?t:null},es=(e,n)=>{const t=ql(e);return!t||(!Dt.groupAccepts||Dt.groupAccepts(t.type,n,Bi(e).length))},ns=(e,n,t)=>{if(e.rung){const t=Pi(e.rung.nodeId),o=t?$i(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===vt&&n.index>=0&&n.index<=o}if(n.slot===vt)return!1;if(e.add)return is(e.add,n);const o=sn(n);if(Ut(e.type))return!1;const r=ql(o),i=ql(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!es(o,e.type))&&(n.index>=0&&n.index<=Bi(o).length));if(e.zone===zn||o===zn){if(e.zone!==o)return!1;const{floor:t,cap:r}=pi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Bi(o).length)return!1;if(e.zone===o)return!0;const l=Ml&&!Dt.lastIsOpen?String(Ml.props.id):null;return(!l||_l(e.zone)!==l&&_l(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Bi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ni.get(i),s=l?Bi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Xl(r).has(n))return!1;const d=yr(s.type,mr(At?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Bi(n),r))})(e.zone,o,e.index,t)},ts=(e,n)=>{const t=sn(e.from),o=e.node;return t===sn(n)?es(t,o.type):ns({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},os=e=>{const n=e.slice(0,e.indexOf(":")),t=Ni.get(n),o=t?Bi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=yr(o.type,mr(At?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=B(r.choices??(r.spec?[{type:r.spec.childType,label:xi(r.spec.childType)}]:[])),l=Mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:dl(o,t.zone===zn)}},rs=(e,n)=>{if("section"!==e.kind)return e;const t=sn(n);return t===zn||ql(t)?e:os(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},is=(e,n)=>{const t=rs(e,n),o=sn(n);if("shared"===t.kind){if(o!==zn||!Dt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=pi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ql(o)){const e="section"===t.kind?t.type:t.template.node.type;return es(o,e)&&n.index>=0&&n.index<=Bi(o).length}if(o!==zn)return!1;const{floor:e,cap:r}=pi();return n.index>=e&&n.index<=r}if(o===zn)return!1;const r=os(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Bi(o))},ls=(e,n)=>{const t=rs(e,n);if("block"!==t.kind&&ql(sn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&es(n,o)){if("section"===e.kind)fo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;fo.insertNode(n,t,fi(e.template.node))}_o(F),fo.select({index:t,zone:n})}})(t,sn(n),n.index);if("section"===t.kind)return void rl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=nl(t),r=fo.insertNode(zn,o,n);ol(o,r,e)})(t.template.name,fi(t.template.node),n.index);if("shared"===t.kind){const e=Dt.shared?.nodeOf(t.section);if(!e)return;const o=nl(n.index);return void(gi.restore(e,{parentId:rn,slot:ln,index:o})&&ol(o,e.props.id,t.section.title))}const o=sn(n),r=os(o);r&&(r.target.spec?Ol(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{fo.insertComponent(e,n,t),_o(F),fo.select({index:t,zone:e})})(o,t.type,n.index))},ss=(e,n)=>{e.media?function(e){const n=Es();if(!n||!As)return;Fs(n).then(n=>{n&&function(e,n){if(!As)return;const t=As.create(e,{nodeDefaults:zi,newNodeId:Bn,sectionLabel:Ci,blockIsOffered:vr}),o=sn(n);if(o===zn){const e=nl(n.index),o=fo.insertNode(zn,e,t);return void ol(e,o,Ci(t.type))}fo.insertNode(o,n.index,t),_o(F),fo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Ei(e.rung.nodeId,e.index,n.index):e.add?ls(e.add,n):e.zone===zn?tl(e.index,n.index):Zl(e.zone,sn(n),e.index,n.index)},[ds]=Ln(()=>nn()),as=tn({keyOf:e=>e.id,readOnly:Boolean(Nt),session:ds,canDrop:ns,onDrop:ss,onStep:(e,n)=>{e.rung?Ei(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===zn?((e,n)=>{const t=Ci(ci[e]?.type??""),o=tl(e,n<0?e-1:e+2);if(!o.moved)return void Ur(n<0?_t.sectionFirst({name:t}):_t.sectionLast({name:t}));const{floor:r,cap:i}=pi();Ur(_t.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Zl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),cs=En(e=>{const{floor:n,cap:t}=pi(),o=[];for(const r of e.nodes){const e=sn(r.place),i=Bi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Kt(i)||Qt(i)||hr(i.type,i))continue;if(Ut(i.type))continue;const l=Boolean(ql(e)),s=e===zn||l;e===zn&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Ci(i.type):Di(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=sn(e.list);if(n===zn&&0===e.children.length)return[{...e,addLabel:_t.addSection,addAlways:!0}];const t=os(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ql(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=sn(e.list),t=n===zn||ql(n)?null:os(n);return t?.choices.length?Xe(e,t.target.spec?.addLabel??_t.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[At.data]),ps=null==Et?.props.id?null:String(Et.props.id),us=En(e=>{const n=Ft,t=e=>!e.item.rung&&null!==an(At.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(ps);return i||(r(Le(At.data,n,o.item.id,ps,Tl))??o)},[At.data,Ft,ps,Tl]),[hs,fs]=Ln(null),ms=Boolean(Ll||Rl);mn(Eo,"mouseover",e=>{if(!ms)return;const n=gn(e.target),t=n?ht(At.data,Ft,n):null;t!==hs&&fs(t)}),mn(Eo,"mouseout",e=>{ms&&!e.relatedTarget&&fs(null)});const gs=e=>Kt(e)||Qt(e)||Ut(e.type),ys=e=>{const n=Ut(e.type)?xi(e.type):Kt(e)?_t.header:Qt(e)?_t.footer:null;return null===n?Ii(e):kr.rowName?kr.rowName(e,"section",n):n},vs=[];if(ms){const e=ps?ht(At.data,Ft,ps):null;for(const n of/* @__PURE__ */new Set([e,hs])){const e=n?ci.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Kt(e)||e.type===Vt,o=Fl(e);if(o){vs.push({id:String(e.props.id),label:ys(e),below:t,reach:o});continue}if(!Ll||!gs(e))continue;const r=Ll(e);r&&vs.push({id:String(e.props.id),label:r,below:t})}}const ks=ue(),bs=jn(null);Tn(()=>{const e=Dt.changeNotice;if(!e)return;const n=JSON.stringify(ci.filter(gs)),t=bs.current;if(bs.current={doc:Dn,bands:n,index:Tt.index},!t||t.doc!==Dn||t.bands===n)return;Tt.hasPast&&Tt.index>=t.index&&!ut.has(ks)&&(ut.add(ks),Ur(e,"success",{action:{label:_t.bar.undo,onClick:()=>Tt.back()},duration:8e3}))},[ci]);const Ss=e=>{_o(F),fo.select(e.zone===zn?{index:e.index}:{index:e.index,zone:e.zone})},ws=Z(),xs=()=>({data:At.data,device:xo,ops:fo,inspector:ar}),zs=ws?.model,Cs=An(()=>zs?e=>zs(e,cs(e),xs()):cs,[zs,cs,xo]),Is=ws?.measure,Ns=Is?(e,n)=>Is(e,n,xs()):void 0,Os=ws?.canDrop,Bs=Os?(e,n)=>Os(e,n,ns,xs()):ns,Ps=ws?.drop,$s=Ps?(e,n)=>Ps(e,n,ss,xs()):ss,Ms=ws?.pick,js=Ms?e=>Ms(e,Ss,xs()):Ss,As=ws?.media??null,Ls=jn(null),Ts=An(()=>As?{id:ct,zone:"",index:-1,type:As.adds.type,add:{kind:As.adds.kind,type:As.adds.type},media:!0}:null,[As]);Tn(()=>{if(!Ts||Nt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(Xn))(e)&&(Ls.current=null,ds.start({key:ct,item:Ts}))},n=e=>{ds.get()?.item.media&&(Ls.current=Jn(e.dataTransfer))},t=()=>{ds.get()?.item.media&&ds.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Ts,Nt,ds]);const Es=()=>{const e=Ls.current;return Ls.current=null,e},Rs=pe(),Fs=async e=>{if(!Rs)return e;const n=await Rs(e);return n?{...e,id:n.id,url:n.url}:null};const Ds=(e,n)=>{if(!As)return;const t=an(ho.getState().appState.data,ui,n);if(!t)return;const o=t.node;fo.replaceComponent(sn(t.place),t.place.index,{...o,props:{...As.replace(o,e),id:o.props.id}})},Hs=e=>{const n=sn(e),t=Mi(n);t&&Li(t.node,t.slot,!1),ll(n,e.index)},Vs=(e,n)=>/* @__PURE__ */st(Pe,{...Nt?{}:as.seam({place:{...dn(e),index:n}})},`seam:${e}:${n}`),Ws={rowClick:al,isCollapsed:Fr,toggleCollapse:Dr},Us=e=>{const n=String(e.props.id),t=ci.findIndex(e=>String(e.props.id)===n),o=Jt(n),r=Bi(o),i=Fr(n),l=xi(e.type),s=kr.rowName?kr.rowName(e,"section",l):l,d=e=>Vs(o,e);/* @__PURE__ */
|
|
16
|
+
return dt(at,{children:[
|
|
17
|
+
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(Sr,{type:e.type,size:13}),name:s,preview:pl(e),marks:ul(e),onSelect:()=>el(t),nameSlot:Vi(zn,t,n,s),selected:er===n,badge:Fl(e)?void 0:Wl,shared:Fl(e),actions:hl(e,zn,t)??void 0,rowProps:{"data-node-id":n,onClick:al(()=>el(t))},fold:{open:!i,label:"section",onToggle:()=>Dr(n)}}),!i&&/* @__PURE__ */dt(Ie,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ii(n),l=Cl(n),s=l&&Fr(r),a=()=>Nl(o,t,r,e.type),{rowProps:c,...p}=as.row({item:{id:r,zone:o,index:t,type:n.type},place:{...dn(o),index:t}},{"data-node-id":r,onClick:al(a)});/* @__PURE__ */
|
|
18
|
+
return dt(Fn,{children:[d(t),
|
|
19
|
+
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(Sr,{type:n.type,size:13}),name:i,preview:pl(n),marks:ul(n),onSelect:a,nameSlot:Vi(o,t,r,i),selected:er===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Dr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(o,t,i),hl(n,o,t),fl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */st(Ie,{children:Gs(n,2)})]},r)}),d(r.length)]})]})},Js=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=as.dragging,d=!Fr(l)&&s?.rung?.nodeId!==i,a={...dn(l),index:0},c=s&&!s.rung&&ns(s,a)?a:void 0,p=()=>Li(e,n,!0),{rowProps:u,...h}=as.row({item:{id:`rung:${l}`,zone:`${i}:${vt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:vt,index:t},into:c,canDrag:Boolean(ur.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:al(p)}),f=Nt?null:ur.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
+
return dt(Fn,{children:[n.heading,
|
|
21
|
+
/* @__PURE__ */st(Ce,{words:qt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:ji===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Dr(l)},actions:f&&f.length>0?/* @__PURE__ */st(at,{children:f.map((t,o)=>/* @__PURE__ */st(Be,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(Nt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ti(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */st(tt,{size:15}):/* @__PURE__ */st(lt,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */st(Ie,{children:r})]},l)},Ys=(e,n)=>{const t=kl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
+
return st(at,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=wl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Vs(e,n),p=/* @__PURE__ */dt(at,{children:[i.map(({child:n,zone:t,index:o})=>{const r=er===String(n.props.id),{collapsible:i,folded:s}=xl(n,l,Il(n.type)),d=String(n.props.id),a=Ql(n),p=()=>Nl(t,o,d,e.type),{rowProps:u,...h}=as.row({item:{id:d,zone:t,index:o,type:n.type},place:{...dn(t),index:o}},{"data-node-id":d,onClick:al(p)});/* @__PURE__ */
|
|
23
|
+
return dt(Fn,{children:[0===o&&c(t,0),
|
|
24
|
+
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(Sr,{type:n.type,size:13}),name:a,preview:pl(n),marks:ul(n),onSelect:p,nameSlot:Vi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>Dr(d)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(t,o,a),hl(n,t,o),fl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */st(Ie,{children:Ys(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?Js(e,t.rung,r++,o,p):/* @__PURE__ */st(Fn,{children:p},t.slot??"")})})},Gs=(e,n)=>{const t=mr(At?.data,e.type,String(e.props.id)),o=kl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
+
return st(at,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=wl(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),h=a&&!a.fixed?`${u}:${a.slot}`:null,f=p?`${u}:${p.slot}`:null,m=(e,n)=>Vs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */dt(at,{children:[l.map(({child:n,zone:t,index:o})=>{const r=er===String(n.props.id),i=Di(n),l=String(n.props.id),{collapsible:d,folded:a}=xl(n,s,Il(n.type)),c=yl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...dn(p),index:Bi(p).length}:void 0,h=as.dragging,f=u&&h&&ns(h,u)?u:void 0,g=()=>Nl(t,o,l,e.type),{rowProps:y,...v}=as.row({item:{id:l,zone:t,index:o,type:n.type},place:{...dn(t),index:o},into:f,canDrag:!hr(n.type,n)},{"data-node-id":l,onClick:al(g)});/* @__PURE__ */
|
|
26
|
+
return dt(Fn,{children:[0===o&&m(t,0),
|
|
27
|
+
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(Sr,{type:n.type,size:13}),name:i,preview:pl(n),marks:ul(n),onSelect:g,nameSlot:Vi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Dr(l)}:void 0,actions:hr(n.type,n)?hl(n,t,o)??void 0:/* @__PURE__ */dt(at,{children:[cl(t,o,i),hl(n,t,o),fl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */st(Ie,{children:Gs(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
+
/* @__PURE__ */st(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Ol(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?f&&!l.some(e=>e.zone===f)?m(f,0):null:0!==l.length||(o.rung?y:g!==f)?null:m(g,0)]});return o.rung?Js(e,o.rung,i++,r,v):/* @__PURE__ */st(Fn,{children:v},o.slot??"")})})},Ks=Uo,Qs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:go&&!Ks&&pr===e.id,onSelect:()=>si(e.id)}:e,Zs=[...(cr.railLead??[]).map(Qs),{id:"sections",label:_t.layers,icon:/* @__PURE__ */st(me,{}),active:go&&!Ks&&"sections"===pr,onSelect:()=>si("sections")},...(cr.railTrail??[]).map(Qs)],Xs=Io?{onPress:No}:$t?{onPress:()=>{le(un,{accept:"image/*",title:io.mediaLibrary})}}:null,_s={value:Zs.find(e=>!0===e.active)?.id??"",press:e=>{const n=Zs.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:Zs.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */st("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},qs=[...cr.railLead??[],...cr.railTrail??[]].find(e=>"panel"in e&&e.id===pr),ed=Boolean(Xt?.foldable),nd=Xt?.label??(Mt?_t.pageSections:_t.templateSections),td=ed&&Fr(kt),od=/* @__PURE__ */dt(at,{children:[ci.map((e,n)=>{if(Kt(e)||Qt(e)||Ut(e.type))return null;const t=er===String(e.props.id),o=Boolean(e.props._hidden);vl(e);const r=String(e.props.id),i=cr.hasOwnRows?.(e)??!1,l=Cl(e)||i,s=l&&Fr(r),d=yl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...dn(a),index:Bi(a).length}:void 0,p=as.dragging,u=c&&p&&ns(p,c)?c:void 0,{rowProps:h,...f}=as.row({item:{id:r,zone:zn,index:n,type:e.type},place:{...dn(zn),index:n},into:u,canDrag:!hr(e.type,e)},{"data-node-id":r,onClick:al(()=>el(n))});/* @__PURE__ */
|
|
29
|
+
return dt(Fn,{children:[n>0&&ml(n),
|
|
30
|
+
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(Sr,{type:e.type,size:13}),name:Ii(e),preview:pl(e),marks:ul(e),shared:Fl(e),onSelect:()=>el(n),nameSlot:Vi(zn,n,r,Ii(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>Dr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(zn,n,Ii(e)),hl(e,zn,n),fl(zn,n,e,Ii(e))]}),rowProps:h}),Cl(e)&&!s&&/* @__PURE__ */dt(Ie,{children:[Gs(e,1),cr.partRows?.(e,Ws)]}),i&&!s&&/* @__PURE__ */st(Ie,{children:cr.ownRows?.(e,n,Ws)})]},String(e.props.id??n))}),Yl>0&&ml(Yl)]}),rd=(e,n,t)=>{const o=String(e.props.id),r=bl(e).length>0||Sl(e)||Boolean(yr(e.type)),i=r&&Fr(o),l="header"===t?_t.header:_t.footer,s=kr.rowName?kr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
+
return dt(at,{children:[
|
|
32
|
+
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(Sr,{type:t,size:13}),name:s,preview:pl(e),marks:ul(e),badge:Fl(e)?void 0:Wl,shared:Fl(e),onSelect:()=>el(n),nameSlot:Vi(zn,n,o,s),selected:er===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Dr(o)}:void 0,actions:hl(e,zn,n)??void 0,rowProps:{"data-node-id":o,onClick:al(()=>el(n))}}),r&&!i&&/* @__PURE__ */st(Ie,{children:Ys(e,1)})]})};return(cr.wrap??(e=>e))(
|
|
33
|
+
/* @__PURE__ */st(X,{target:Eo,children:/* @__PURE__ */dt("div",{ref:To,className:"sf-editor es-editor",style:Ue(Ar),onContextMenu:Ki.onEditorContextMenu,...u(un),children:[
|
|
34
|
+
/* @__PURE__ */dt(Te,{children:[
|
|
35
|
+
/* @__PURE__ */dt("div",{className:"es-cluster es-cluster--left",children:[Xs?/* @__PURE__ */st(Vn,{variant:"secondary",className:"es-barbtn",leftIcon:/* @__PURE__ */st(ge,{}),onClick:Xs.onPress,children:_t.railMedia}):null,
|
|
36
|
+
/* @__PURE__ */st(Ee,{label:_t.bar.undo,disabled:Boolean(Nt)||!Tt.hasPast,onClick:()=>Tt.back(),children:/* @__PURE__ */st(_n,{})}),
|
|
37
|
+
/* @__PURE__ */st(Ee,{label:_t.bar.redo,disabled:Boolean(Nt)||!Tt.hasFuture,onClick:()=>Tt.forward(),children:/* @__PURE__ */st(qn,{})})]}),
|
|
38
|
+
/* @__PURE__ */dt(Re,{children:[
|
|
39
|
+
/* @__PURE__ */st(Fe,{devices:vo,value:xo,onChange:zo}),
|
|
40
|
+
/* @__PURE__ */st(Ee,{label:_t.bar.refresh,tip:_t.bar.refreshTip,onClick:()=>{Lo.current=(()=>{const e=Eo?.document;if(!e)return null;const n=ci.findIndex(Qt),t=n>=0?n:ci.length;let o=null;for(let n=0;n<t;n++){const t=ci[n]?.props?.id;if(null==t)continue;const r=Mn(e,`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Et?.props?.id??ci[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Ao(e=>e+1)},children:/* @__PURE__ */st(et,{})}),cr.barView?.()]}),
|
|
41
|
+
/* @__PURE__ */dt(Re,{kind:"right",style:{minWidth:300},children:[
|
|
42
|
+
/* @__PURE__ */st(k,{input:Vo,words:_t.saveStatus}),yn?/* @__PURE__ */st(yn,{}):null,cr.barLead?.(),cr.barTrail?.(),cr.mainAction||!cr.barMain?/* @__PURE__ */st(b,{input:Vo,action:cr.mainAction??{label:_t.done,onPress:()=>{Qn(At.data)}},readOnly:Boolean(Nt),saveSwitch:Bt,onToggleAutoSave:xt,onSaveNow:Wo,bar:_t.bar,words:_t.saveStatus}):cr.barMain()]})]}),
|
|
43
|
+
/* @__PURE__ */st(re,{}),
|
|
44
|
+
/* @__PURE__ */dt("div",{className:"sf-body",children:[go?/* @__PURE__ */dt(at,{children:[
|
|
45
|
+
/* @__PURE__ */dt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":_t.leftPanel,children:[
|
|
46
|
+
/* @__PURE__ */dt("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
|
|
47
|
+
/* @__PURE__ */st(I,{side:"left",onHide:ii}),
|
|
48
|
+
/* @__PURE__ */st("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
|
|
49
|
+
/* @__PURE__ */st(Wn,{variant:"underline",block:!0,"aria-label":_t.bar.views,value:_s.value,onChange:_s.press,items:_s.items})]}),Uo?/* @__PURE__ */st(x,{at:Go?{label:(e=>{const n=ql(e.zone);if(n)return _t.add.addingTo({name:kr.rowName?dl(n,!0):xi(n.type)});if(e.zone===zn){const n=ci[e.index];return n&&!Qt(n)?_t.add.addingBefore({name:dl(n,!0)}):_t.add.addingAtEnd}const t=os(e.zone);return t?_t.add.addingTo({name:t.parentName}):_t.add.addingHere})(Go),onClear:()=>Ko(null)}:void 0,placeBlocks:Go&&Go.zone!==zn?os(Go.zone)?.choices:void 0,canTake:Go?e=>{if(!Go)return null;const n={...dn(Go.zone),index:Go.index};if(is(e,n))return null;if("shared"===e.kind&&Go.zone===zn&&!Dt.shared?.nodeOf(e.section))return _t.shared.alreadyHere;const t=ql(Go.zone);if(t)return _t.add.notInside({name:dl(t,!0)});if(Go.zone===zn)return _t.add.onlySections;const o=os(Go.zone);return o?_t.add.notInside({name:o.parentName}):_t.add.onlySections}:void 0,onPick:Go?e=>{if(!Go)return;const n={...dn(Go.zone),index:Go.index};is(e,n)&&(ls(e,n),sl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:ds,siteWide:cr.addPanelRow?.(sl),onClose:sl,readOnly:Boolean(Nt)}):qs?qs.panel({onHide:ii,notify:Ur}):/* @__PURE__ */dt(at,{children:[
|
|
50
|
+
/* @__PURE__ */st(N,{icon:/* @__PURE__ */st(me,{}),title:_t.layers,context:lo,actions:/* @__PURE__ */dt(at,{children:[!Nt&&/* @__PURE__ */st(De,{label:_t.add.title,onClick:()=>il(null),children:/* @__PURE__ */st(nt,{size:15})}),
|
|
51
|
+
/* @__PURE__ */st(De,{label:Kl?_t.expandAll:_t.collapseAll,title:0===Gl.length?_t.nothingToFold:void 0,disabled:0===Gl.length,onClick:()=>jr(e=>{const n=new Set(Gl);return Kl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Gl])}),children:/* @__PURE__ */st(mt,{expand:Kl})})]})}),
|
|
52
|
+
/* @__PURE__ */dt(Ne,{className:"sf-tree sf-scroll",words:qt,children:[
|
|
53
|
+
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(Sr,{type:"page",size:13}),name:_t.pageSettings,onSelect:di,selected:!Et&&qo,rowProps:{onClick:al(di)}}),Ul&&/* @__PURE__ */dt(at,{children:[!El&&/* @__PURE__ */st(Oe,{children:_t.header}),Us(Ul)]}),jt&&!(El&&Ul)&&/* @__PURE__ */dt(at,{children:[!El&&/* @__PURE__ */st(Oe,{children:_t.header}),!Zt&&/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(Sr,{type:"header",size:13}),name:_t.header,badge:Vl?void 0:Wl,shared:Vl,onSelect:ai,selected:Xo.kind===Gt?.kind,rowProps:{onClick:al(ai)}})]}),Al&&!(El&&Ul)&&rd(Al,jl,"header"),!ed&&/* @__PURE__ */st(Oe,{children:nd}),ed?/* @__PURE__ */dt(at,{children:[
|
|
54
|
+
/* @__PURE__ */st(Ce,{words:qt,icon:null,name:nd,fold:{open:!td,label:nd,onToggle:()=>Dr(kt)}}),!td&&/* @__PURE__ */st(Ie,{children:od})]}):od,jt&&!El&&/* @__PURE__ */st(Oe,{children:_t.footer}),Ml&&!(El&&Jl)&&rd(Ml,$l,"footer"),Jl&&Us(Jl),cr.treeFoot?.()]})]})]}),
|
|
55
|
+
/* @__PURE__ */st(He,{side:"left",width:Ar.left,min:We.left,max:Ve,defaultWidth:m.left,label:_t.resizeLeftPanel,onResize:Er})]}):/* @__PURE__ */st(O,{side:"left",onShow:ii}),
|
|
56
|
+
/* @__PURE__ */dt("div",{ref:Jr,className:"sf-center sf-scroll","data-sf-canvas-head":Zr?"":void 0,style:{overflowX:ti?"auto":"hidden",overflowY:"hidden"},children:[Zr&&/* @__PURE__ */st("div",{ref:Xr,className:"sf-canvas-head",children:/* @__PURE__ */st(Zr,{device:xo})}),
|
|
57
|
+
/* @__PURE__ */dt("div",{className:"sf-frame-scaler",style:oi,children:[
|
|
58
|
+
/* @__PURE__ */st("div",{className:"sf-frame "+(xo===So?"":`sf-frame--${xo}`),style:ri,children:/* @__PURE__ */dt("div",{className:"sf-preview-host",children:[
|
|
59
|
+
/* @__PURE__ */st(xe.Provider,{value:Tl,children:/* @__PURE__ */st(ze.Provider,{value:Hl,children:/* @__PURE__ */st(so,{},jo)})}),
|
|
60
|
+
/* @__PURE__ */st(_e,{canvas:Eo,session:ds,model:Cs,measure:Ns,canDrop:Bs,onDrop:$s,choose:us,onPick:js,dropOn:As?{accepts:(e,n)=>{if(!e.media||!As||n.item.rung)return!1;const t=an(At.data,ui,n.item.id);return null!==t&&As.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Es();n&&As&&Fs(n).then(n=>{n&&Ds(n,e.item.id)})})(n),label:()=>_t.canvasReplaceImage}:void 0,onZoneAdd:Hs,onSeamAdd:Hs,zoneAddLabel:_t.canvasAddBlock,words:eo.canvas,readOnly:Boolean(Nt),revision:At.data}),Qo.length>0&&!Ro&&/* @__PURE__ */st("div",{className:"sf-preview-gaps",children:Qo.map(e=>
|
|
61
|
+
/* @__PURE__ */st(qe,{index:e.index,label:_t.addSectionHere,onInsert:()=>il(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),ms?/* @__PURE__ */st(ft,{canvas:Eo,tabs:vs,onSelect:e=>{const n=ci.findIndex(n=>String(n.props.id)===e);n>=0&&el(n)}}):null]})]}),yo?/* @__PURE__ */dt(at,{children:[vn?
|
|
62
|
+
/* @__PURE__ */st("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:vn}):/* @__PURE__ */st(at,{children:/* @__PURE__ */st(h,{value:{selectChild:Nl,addChild:Ol,childRowName:Di,blockRowName:Ql},children:/* @__PURE__ */st(ao,{mode:Xo,onOpenWebsiteSettings:cr.openSettings??(()=>{}),onOpenSiteStyles:cr.openStyles,onSelectNode:Cr,onNotify:Ur,onHidePanel:li,nodeActions:Et?Cn(Ft,Et.type):bt})})}),
|
|
63
|
+
/* @__PURE__ */st(He,{side:"right",width:Ar.right,min:We.right,max:Ve,defaultWidth:m.right,label:_t.resizeSettingsPanel,onResize:Rr})]}):
|
|
64
|
+
/* @__PURE__ */st(O,{side:"right",onShow:li})]}),Ki.menu,
|
|
65
|
+
/* @__PURE__ */st(ne,{}),vi?/* @__PURE__ */st(pt,{name:vi.name,onMake:e=>(async(e,n)=>{const t=ci.find(n=>String(n.props.id)===e),o=Dt.shared;if(!t||!o)return;let r;try{r=await C(yi).create(n,t)}catch{return void Ur(_t.shared.makeFailed,"error")}o.adopt(t,r),ki(null)})(vi.id,e),onCancel:()=>ki(null)}):null]})}))}export{wt as ScreenChrome};
|
package/dist/drag/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AddPanel,CanvasDragLayer,CanvasInsert,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,insertSeams,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-
|
|
1
|
+
export{AddPanel,CanvasDragLayer,CanvasInsert,EMPTY_MEASURE,HANDLE_GRACE_MS,canvasTarget,contains,gapInZone,gapLine,insertSeams,measureCanvas,pickSource,seamsBetween,sourcesAt}from"../chunk-LQV5FZTQ.js";import"../chunk-KAML3KQH.js";export{AUTO_SCROLL_EDGE,AUTO_SCROLL_MAX_SPEED,autoScrollDelta,autoScrollSpeed,createDragSession,dropEffectFor,dropOnRow,frameScrollBox,gapToMoveIndex,isNoOpDrop,scrollBoxOf,scrollParent,startAutoScroll,stepGap,useTreeDrag}from"../chunk-3S5N4HLJ.js";import"../chunk-P2VEMZH5.js";import"../chunk-K7BTCBWD.js";import"../chunk-L55YIXDC.js";import"../chunk-QIDRJH3S.js";import"../chunk-LF3FUSCQ.js";
|
package/dist/fields/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-7LYKFL3Q.js";export{fieldIsShown,showWhenOf,shownFields,withShowWhen}from"../chunk-BPXEFVSQ.js";import"../chunk-A6Z4SD3I.js";import"../chunk-K56YDHYQ.js";export{FieldSlider}from"../chunk-ZEH6QLBH.js";export{useResolvedFields}from"../chunk-IWCKVZHS.js";import"../chunk-FIVU2COQ.js";import"../chunk-RC25EGHD.js";import"../chunk-KFV7N2DJ.js";export{FieldNumber}from"../chunk-ZOBSIXRD.js";export{FieldSelect,optionFor}from"../chunk-QAJAEWCZ.js";import"../chunk-WRFD4EXD.js";import"../chunk-VANKQVOW.js";import"../chunk-MFIRYGHW.js";import"../chunk-3S5N4HLJ.js";import"../chunk-
|
|
1
|
+
export{FieldText,Inspector,InspectorField,LinkPicker,ListField,bucketsOf,copyItem,insertAt,labelOf,moveTo,planFields,removeAt}from"../chunk-7LYKFL3Q.js";export{fieldIsShown,showWhenOf,shownFields,withShowWhen}from"../chunk-BPXEFVSQ.js";import"../chunk-A6Z4SD3I.js";import"../chunk-K56YDHYQ.js";export{FieldSlider}from"../chunk-ZEH6QLBH.js";export{useResolvedFields}from"../chunk-IWCKVZHS.js";import"../chunk-FIVU2COQ.js";import"../chunk-RC25EGHD.js";import"../chunk-KFV7N2DJ.js";export{FieldNumber}from"../chunk-ZOBSIXRD.js";export{FieldSelect,optionFor}from"../chunk-QAJAEWCZ.js";import"../chunk-WRFD4EXD.js";import"../chunk-VANKQVOW.js";import"../chunk-MFIRYGHW.js";import"../chunk-3S5N4HLJ.js";import"../chunk-P2VEMZH5.js";import"../chunk-K7BTCBWD.js";import"../chunk-L55YIXDC.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{AddBlockRow as default}from"../../chunk-L2Y3PF2R.js";import"../../chunk-M2Z775ZC.js";import"../../chunk-PAOZMXEI.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-MQA7OFRA.js";import"../../chunk-23DYNW6S.js";import"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-
|
|
1
|
+
export{AddBlockRow as default}from"../../chunk-L2Y3PF2R.js";import"../../chunk-M2Z775ZC.js";import"../../chunk-PAOZMXEI.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-MQA7OFRA.js";import"../../chunk-23DYNW6S.js";import"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-BSHIQIZC.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-ZOBSIXRD.js";import"../../chunk-QAJAEWCZ.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-VANKQVOW.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-3S5N4HLJ.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-K7BTCBWD.js";import"../../chunk-L55YIXDC.js";import"../../chunk-QIDRJH3S.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-LF3FUSCQ.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{blockKey,AddSidePanel as default,sectionKey,sharedKey,templateKey}from"../../chunk-
|
|
1
|
+
export{blockKey,AddSidePanel as default,sectionKey,sharedKey,templateKey}from"../../chunk-R5KEFI55.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-BVN33R76.js";import"../../chunk-43AEUUNQ.js";import"../../chunk-SINAM2IT.js";import"../../chunk-UMDQ6CLQ.js";import"../../chunk-M2Z775ZC.js";import"../../chunk-PAOZMXEI.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-MQA7OFRA.js";import"../../chunk-23DYNW6S.js";import"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-ZKY45F5G.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-BSHIQIZC.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-ZOBSIXRD.js";import"../../chunk-QAJAEWCZ.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-VANKQVOW.js";import"../../chunk-ZG6PVMC3.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-AJSDWWJW.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-LQV5FZTQ.js";import"../../chunk-KAML3KQH.js";import"../../chunk-3S5N4HLJ.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-K7BTCBWD.js";import"../../chunk-L55YIXDC.js";import"../../chunk-QIDRJH3S.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-LF3FUSCQ.js";
|
|
@@ -6,12 +6,11 @@ import * as react from 'react';
|
|
|
6
6
|
* in the left panel was too small; it pops up).
|
|
7
7
|
*
|
|
8
8
|
* The host's component is drawn always and is told what to be: choosing for a
|
|
9
|
-
* field (`pick`), browsing from the
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* one
|
|
13
|
-
*
|
|
14
|
-
* and ends the browse.
|
|
9
|
+
* field (`pick`), browsing from the top bar's Media library button
|
|
10
|
+
* (`browsing`), or closed (neither). The host decides how to show its library:
|
|
11
|
+
* the admin portal draws nothing here and answers with its one Media Library
|
|
12
|
+
* window (owner 2026-10-25: one window, one place). A pick answers the field
|
|
13
|
+
* it was asked for; `onClose` leaves the field as it was and ends the browse.
|
|
15
14
|
*
|
|
16
15
|
* Nothing is drawn where the host supplied no popup: fields then ask the host
|
|
17
16
|
* for its window (lib/media-picker).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{EASEL_NODE_CLIPBOARD,ancestorChain,nodeClipboardOf,nodeClipboardRules,nodeMenuItems,nodeShortcut,pageMenuItems,pastePlace,runNodeShortcut,textMenuItems,useNodeClipboard,useNodeContextMenu}from"../../chunk-
|
|
1
|
+
export{EASEL_NODE_CLIPBOARD,ancestorChain,nodeClipboardOf,nodeClipboardRules,nodeMenuItems,nodeShortcut,pageMenuItems,pastePlace,runNodeShortcut,textMenuItems,useNodeClipboard,useNodeContextMenu}from"../../chunk-6FWAE2RN.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-MQA7OFRA.js";import"../../chunk-23DYNW6S.js";import"../../chunk-V7U33NF2.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-ZKY45F5G.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-P5VYGWYO.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-BSHIQIZC.js";import"../../chunk-K7BTCBWD.js";import"../../chunk-L55YIXDC.js";import"../../chunk-QIDRJH3S.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-LF3FUSCQ.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{ScreenChrome as default}from"../../chunk-
|
|
1
|
+
export{ScreenChrome as default}from"../../chunk-XJ2WXGFJ.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-JBOSEHIX.js";import"../../chunk-FGNR22NY.js";import"../../chunk-LER7RKTO.js";import"../../chunk-FGYJ5DJY.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TNGOL65V.js";import"../../chunk-I7BROL77.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-C56MPJBH.js";import"../../chunk-MEHLY5Q4.js";import"../../chunk-WEIE2FBC.js";import"../../chunk-PY7OOQEZ.js";import"../../chunk-RKTF5XLP.js";import"../../chunk-5545A3PC.js";import"../../chunk-R5KEFI55.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-BVN33R76.js";import"../../chunk-43AEUUNQ.js";import"../../chunk-SINAM2IT.js";import"../../chunk-UMDQ6CLQ.js";import"../../chunk-M2Z775ZC.js";import"../../chunk-PAOZMXEI.js";import"../../chunk-2G6MAXPY.js";import"../../chunk-6FWAE2RN.js";import"../../chunk-UJ46J7QW.js";import"../../chunk-276MBG5P.js";import"../../chunk-77IWWW6X.js";import"../../chunk-ERR437B5.js";import"../../chunk-UNVKPVZW.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-U66YKDAR.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-MQA7OFRA.js";import"../../chunk-XFYFKITX.js";import"../../chunk-23DYNW6S.js";import"../../chunk-V7U33NF2.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-ZKY45F5G.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-P5VYGWYO.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-BSHIQIZC.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-ZOBSIXRD.js";import"../../chunk-QAJAEWCZ.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-VANKQVOW.js";import"../../chunk-ZG6PVMC3.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-AJSDWWJW.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-LQV5FZTQ.js";import"../../chunk-KAML3KQH.js";import"../../chunk-3S5N4HLJ.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-K7BTCBWD.js";import"../../chunk-L55YIXDC.js";import"../../chunk-QIDRJH3S.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-BHRC3ASL.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-LF3FUSCQ.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{DocumentScreen,ScreenMount as default}from"../../chunk-
|
|
1
|
+
export{DocumentScreen,ScreenMount as default}from"../../chunk-7YVEYQDE.js";import"../../chunk-GXQCZJOP.js";import"../../chunk-XJ2WXGFJ.js";import"../../chunk-2GVCAIPX.js";import"../../chunk-26OOWIJJ.js";import"../../chunk-JBOSEHIX.js";import"../../chunk-FGNR22NY.js";import"../../chunk-LER7RKTO.js";import"../../chunk-FGYJ5DJY.js";import"../../chunk-7F52SZOI.js";import"../../chunk-MQNBD6AB.js";import"../../chunk-TNGOL65V.js";import"../../chunk-I7BROL77.js";import"../../chunk-KCBEE2MC.js";import"../../chunk-C56MPJBH.js";import"../../chunk-MEHLY5Q4.js";import"../../chunk-WEIE2FBC.js";import"../../chunk-PY7OOQEZ.js";import"../../chunk-RKTF5XLP.js";import"../../chunk-JQXD3TDE.js";import"../../chunk-5545A3PC.js";import"../../chunk-R5KEFI55.js";import"../../chunk-PA3PNTVV.js";import"../../chunk-5ZBY24K7.js";import"../../chunk-BVN33R76.js";import"../../chunk-43AEUUNQ.js";import"../../chunk-SINAM2IT.js";import"../../chunk-UMDQ6CLQ.js";import"../../chunk-M2Z775ZC.js";import"../../chunk-PAOZMXEI.js";import"../../chunk-2G6MAXPY.js";import"../../chunk-6FWAE2RN.js";import"../../chunk-UJ46J7QW.js";import"../../chunk-276MBG5P.js";import"../../chunk-77IWWW6X.js";import"../../chunk-ERR437B5.js";import"../../chunk-UNVKPVZW.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-U66YKDAR.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-MQA7OFRA.js";import"../../chunk-XFYFKITX.js";import"../../chunk-23DYNW6S.js";import"../../chunk-V7U33NF2.js";import"../../chunk-6WY6ZXJG.js";import"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-ZKY45F5G.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-P5VYGWYO.js";import"../../chunk-WK3AFPXY.js";import"../../chunk-BSHIQIZC.js";import"../../chunk-NDRZP6YR.js";import"../../chunk-H6DDIBQ4.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-ZOBSIXRD.js";import"../../chunk-QAJAEWCZ.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-VANKQVOW.js";import"../../chunk-ZG6PVMC3.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-AJSDWWJW.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-LQV5FZTQ.js";import"../../chunk-KAML3KQH.js";import"../../chunk-3S5N4HLJ.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-K7BTCBWD.js";import"../../chunk-L55YIXDC.js";import"../../chunk-QIDRJH3S.js";import"../../chunk-BSPCSC45.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-BHRC3ASL.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-LF3FUSCQ.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{ScreenStoreProvider as default}from"../../chunk-JQXD3TDE.js";import"../../chunk-PAOZMXEI.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-MQA7OFRA.js";import"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-
|
|
1
|
+
export{ScreenStoreProvider as default}from"../../chunk-JQXD3TDE.js";import"../../chunk-PAOZMXEI.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-MQA7OFRA.js";import"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-BSHIQIZC.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-ZOBSIXRD.js";import"../../chunk-QAJAEWCZ.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-VANKQVOW.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-3S5N4HLJ.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-K7BTCBWD.js";import"../../chunk-L55YIXDC.js";import"../../chunk-QIDRJH3S.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-LF3FUSCQ.js";
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import{AddBlockRow as e}from"../../chunk-L2Y3PF2R.js";import{scrollPreviewToSection as n,gotoPreviewSlide as o}from"../../chunk-TNGOL65V.js";import{useEaselUndoKeys as r}from"../../chunk-I7BROL77.js";import{SlotChildActionsProvider as t}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as s}from"../../chunk-C56MPJBH.js";import{usePartBridge as i}from"../../chunk-MEHLY5Q4.js";import{useSectionOps as c}from"../../chunk-WEIE2FBC.js";import"../../chunk-M2Z775ZC.js";import{SELECTION_MODE as p,useScreenPinned as l,useScreenCanvasFrame as m,useScreenInspectorPanel as d,useScreenPickFollowsSelection as a,sameInspectorMode as u,useStandaloneScreenBridges as h,useScreenBlockLook as k,useScreenBlockRules as j}from"../../chunk-PAOZMXEI.js";import{MediaPopup as f}from"../../chunk-2G6MAXPY.js";import{useScreenDocument as S}from"../../chunk-276MBG5P.js";import"../../chunk-77IWWW6X.js";import"../../chunk-ERR437B5.js";import"../../chunk-UNVKPVZW.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-U66YKDAR.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as C}from"../../chunk-23DYNW6S.js";import{useEasel as y}from"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import{LayersTree as N,Subtree as x,TreeRow as A,TreeRowAction as R,TreeSeam as D}from"../../chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as M}from"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-
|
|
2
|
-
return Q(
|
|
3
|
-
return Q(
|
|
4
|
-
/* @__PURE__ */J(A,{words:ie,icon:/* @__PURE__ */J(De,{type:e.type,size:13}),name:c,selected:t,onSelect:m,...a,actions:/* @__PURE__ */J(R,{kind:"delete",label:se.deleteNamed({name:c}),onClick:()=>{return e=o,n=r,_.removeComponent(e,n),te(p),void _.select(null);var e,n},children:/* @__PURE__ */J(K,{size:13})}),rowProps:d}),s&&/* @__PURE__ */J(x,{children:Qe(e,n+1)}),
|
|
1
|
+
import{AddBlockRow as e}from"../../chunk-L2Y3PF2R.js";import{scrollPreviewToSection as n,gotoPreviewSlide as o}from"../../chunk-TNGOL65V.js";import{useEaselUndoKeys as r}from"../../chunk-I7BROL77.js";import{SlotChildActionsProvider as t}from"../../chunk-KCBEE2MC.js";import{DEFAULT_PANEL_W as s}from"../../chunk-C56MPJBH.js";import{usePartBridge as i}from"../../chunk-MEHLY5Q4.js";import{useSectionOps as c}from"../../chunk-WEIE2FBC.js";import"../../chunk-M2Z775ZC.js";import{SELECTION_MODE as p,useScreenPinned as l,useScreenCanvasFrame as m,useScreenInspectorPanel as d,useScreenPickFollowsSelection as a,sameInspectorMode as u,useStandaloneScreenBridges as h,useScreenBlockLook as k,useScreenBlockRules as j}from"../../chunk-PAOZMXEI.js";import{MediaPopup as f}from"../../chunk-2G6MAXPY.js";import{useScreenDocument as S}from"../../chunk-276MBG5P.js";import"../../chunk-77IWWW6X.js";import"../../chunk-ERR437B5.js";import"../../chunk-UNVKPVZW.js";import"../../chunk-GMCZXMOV.js";import"../../chunk-RLBXE4EU.js";import"../../chunk-HNKB2ZYR.js";import"../../chunk-CLOS6SSX.js";import"../../chunk-U66YKDAR.js";import"../../chunk-LOMEH6DG.js";import"../../chunk-KCOBHPN6.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-O7Q4DDJT.js";import"../../chunk-RSCMJIWS.js";import"../../chunk-MQA7OFRA.js";import{DEFAULT_SCREEN_WORDS as C}from"../../chunk-23DYNW6S.js";import{useEasel as y}from"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import{LayersTree as N,Subtree as x,TreeRow as A,TreeRowAction as R,TreeSeam as D}from"../../chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as M}from"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-BSHIQIZC.js";import"../../chunk-NDRZP6YR.js";import{DEFAULT_SAVE_WORDS as O,saveIndicator as B}from"../../chunk-H6DDIBQ4.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-ZOBSIXRD.js";import"../../chunk-QAJAEWCZ.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-VANKQVOW.js";import{SaveState as P,panelWidthVars as H}from"../../chunk-ZG6PVMC3.js";import"../../chunk-MJM6SFD3.js";import"../../chunk-AJSDWWJW.js";import"../../chunk-2OAZYSWJ.js";import"../../chunk-THWO5YVZ.js";import"../../chunk-RE4LP46F.js";import{useWords as L}from"../../chunk-MFIRYGHW.js";import"../../chunk-LQV5FZTQ.js";import"../../chunk-KAML3KQH.js";import{useTreeDrag as I}from"../../chunk-3S5N4HLJ.js";import"../../chunk-P2VEMZH5.js";import{zoneKey as g,parseZoneKey as W}from"../../chunk-K7BTCBWD.js";import"../../chunk-L55YIXDC.js";import"../../chunk-QIDRJH3S.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import{slotChildRowName as v}from"../../chunk-BHRC3ASL.js";import"../../chunk-6W7WLPZH.js";import"../../chunk-IQ5TA7AM.js";import"../../chunk-DUVRZ456.js";import"../../chunk-IYT6NN2J.js";import{slotFieldsOf as z,nestsInTree as E}from"../../chunk-PLVEGYK6.js";import"../../chunk-LF3FUSCQ.js";import{useState as F,useRef as V,useEffect as Z,useCallback as b,Fragment as Y}from"react";import{Tooltip as w}from"efficient-shell/ui";import{TrashIcon as K}from"efficient-shell/icons/efficient";import{jsxs as Q,jsx as J,Fragment as T}from"react/jsx-runtime";var $=e=>n=>{n.target.closest("button, input")||e()},X={rowClick:$};function G(){const{saveState:G,readOnly:U,readOnlyReason:q=null}=S(),_=c(),{appState:ee,selectedItem:ne,config:oe}=y(e=>e),[re,te]=F(p),se=L("screen",C),ie=L("tree",M),ce=L("save",O),{first:pe,last:le,panelOf:me}=l(),de=me(pe),ae=m(),ue=d(),he=ee.data.content?.[0]??null,ke=he?.props.id??null,je=he?.type===pe,fe=he?.type===le,Se=V(null),Ce=V(null);r(Ce),a(ne?.props.id),Z(()=>{ke&&Se.current!==ke&&(Se.current=ke,je?te(de??p):ne||_.select({index:0}))},[ke,ne,_,je]);const ye=b(e=>te(n=>u(n,e)?n:e),[]),Ne=h({kind:re.kind,mode:re,open:ye,show:e=>te(e),reveal:()=>{},select:(e,n)=>{te(e=>u(e,n)?e:n),_.select(e)}}),{selectNode:xe}=i({mode:re,setMode:te,onOpenPart:n}),Ae=k(),{labelAtLevel:Re,Icon:De}=Ae,{canAddTo:Me}=j(),Oe=e=>Re(e,"block",oe.components[e]?.label??e),Be=e=>Re(e,"section",Oe(e)),Pe=!je&&"puck"===re.kind&&ne?.props.id===ke,He=he?Me(he.type)?.spec??null:null,Le=he&&He?`${he.props.id}:${He.slot}`:null,Ie=he&&He&&Array.isArray(he.props[He.slot])?he.props[He.slot]:[],ge=e=>v(e,Oe,Ae.plainText),We=(e,r)=>{he&&He&&Le&&(te(p),He.slider?(o(String(he.props.id),e),_.select({index:e,zone:Le}),n(String(he.props.id))):(_.select({index:e,zone:Le}),n(r)))},ve=()=>{if(!he||!He||!Le)return;const e=Ie.length;_.insertComponent(Le,He.childType,e),te(p),He.slider?requestAnimationFrame(()=>{o(String(he.props.id),e),_.select({index:e,zone:Le})}):_.select({index:e,zone:Le})},ze=e=>z(oe,e),Ee=e=>{const{parentId:n,slot:o}=W(e),r=e=>{if(!e)return null;if(String(e.props.id)===n)return e;for(const n of ze(e.type)){const o=Array.isArray(e.props[n])?e.props[n]:[];for(const e of o){const n=r(e);if(n)return n}}return null},t=r(he)?.props[o];return Array.isArray(t)?t.length:0},Fe=(e,n,o)=>{const r=Math.min(Math.max(o,0),Ee(e)),t=n<r?r-1:r;t!==n&&(_.reorderComponent(e,n,t),te(p),_.select({index:t,zone:e}))},Ve=I({keyOf:e=>e.id,readOnly:Boolean(U),canDrop:(e,n)=>g(n)===e.zone&&n.index>=0&&n.index<=Ee(e.zone),onDrop:(e,n)=>Fe(e.zone,e.index,n.index),onStep:(e,n)=>Fe(e.zone,e.index,n<0?e.index-1:e.index+2)}),Ze=(e,n)=>/* @__PURE__ */J(D,{...U?{}:Ve.seam({place:{...W(e),index:n}})},`seam:${e}:${n}`),be=e=>Ae.blockRowName(e,Oe),Ye=(e,o,r)=>{te(p),_.select({index:o,zone:e}),n(r)},we=(e,n,o)=>{_.insertComponent(e,n,o),te(p),_.select({index:o,zone:e})},Ke=(n,o,r)=>/* @__PURE__ */J(e,{choices:r,onPick:e=>we(n,e,o)}),Qe=(e,n)=>{const o=ze((r=e).type).flatMap(e=>(Array.isArray(r.props[e])?r.props[e]:[]).map((n,o)=>({child:n,zone:`${r.props.id}:${e}`,index:o})));var r;const t=Me(e.type),s=t?.choices??null,i="footer"===t?.source?be:ge;/* @__PURE__ */
|
|
2
|
+
return Q(T,{children:[o.map(({child:e,zone:o,index:r})=>{const t=ne?.props.id===e.props.id,s=E(oe,e.type,n),c=i(e),l=String(e.props.id),m=()=>Ye(o,r,l),{rowProps:d,...a}=Ve.row({item:{id:l,zone:o,index:r},place:{...W(o),index:r}},{onClick:$(m)});/* @__PURE__ */
|
|
3
|
+
return Q(Y,{children:[0===r&&Ze(o,0),
|
|
4
|
+
/* @__PURE__ */J(A,{words:ie,icon:/* @__PURE__ */J(De,{type:e.type,size:13}),name:c,selected:t,onSelect:m,...a,actions:/* @__PURE__ */J(R,{kind:"delete",label:se.deleteNamed({name:c}),onClick:()=>{return e=o,n=r,_.removeComponent(e,n),te(p),void _.select(null);var e,n},children:/* @__PURE__ */J(K,{size:13})}),rowProps:d}),s&&/* @__PURE__ */J(x,{children:Qe(e,n+1)}),Ze(o,r+1)]},String(e.props.id??`${o}-${r}`))}),t&&s?Ke(`${e.props.id}:${t.slot}`,o.length,s):null]})},Je="HeroSingle"===he?.type,Te=Boolean(he)&&(Boolean(Me(he.type))||ze(he.type).length>0),$e=Boolean(he)&&(Boolean(He)||fe||je||Je||Te);/* @__PURE__ */
|
|
5
5
|
return Q("div",{ref:Ce,className:"sf-editor es-editor",style:H(s),children:[
|
|
6
|
-
/* @__PURE__ */J("div",{className:"sf-section-bar",children:/* @__PURE__ */J(
|
|
6
|
+
/* @__PURE__ */J("div",{className:"sf-section-bar",children:/* @__PURE__ */J(P,null!==q?{tone:"off",label:q,role:"status"}:{...B(G,ce),role:"status"})}),
|
|
7
7
|
/* @__PURE__ */Q("div",{className:"sf-body",children:[$e&&he&&/* @__PURE__ */Q("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left",children:[
|
|
8
|
-
/* @__PURE__ */J("div",{className:"sf-panel-head",children:/* @__PURE__ */J(w,{content:je?se.headerSettings:se.sectionSettings({name:
|
|
9
|
-
/* @__PURE__ */J(N,{className:"sf-tree sf-scroll",rootProps:
|
|
10
|
-
/* @__PURE__ */J(A,{words:ie,icon:/* @__PURE__ */J(De,{type:"header",size:13}),name:se.headerSettings,selected:re.kind===de?.kind,onSelect:()=>te(de??p),rowProps:{onClick:$(()=>te(de??p))}}):He?/* @__PURE__ */Q(
|
|
11
|
-
return Q(
|
|
12
|
-
/* @__PURE__ */J(A,{words:ie,icon:/* @__PURE__ */J(De,{type:e.type,size:13}),name:r,selected:o,onSelect:s,...c,actions:/* @__PURE__ */J(R,{kind:"delete",label:se.deleteNamed({name:r}),onClick:()=>{return e=n,void(
|
|
8
|
+
/* @__PURE__ */J("div",{className:"sf-panel-head",children:/* @__PURE__ */J(w,{content:je?se.headerSettings:se.sectionSettings({name:Be(he.type)}),side:"bottom",children:/* @__PURE__ */J("button",{type:"button",className:"sf-panel-title sf-panel-title--btn "+(Pe?"is-selected":""),"aria-pressed":Pe,onClick:()=>{je?te(de??p):(te(p),_.select({index:0}))},children:Be(he.type)})})}),
|
|
9
|
+
/* @__PURE__ */J(N,{className:"sf-tree sf-scroll",rootProps:Ve.rootProps(),words:ie,children:/* @__PURE__ */J(x,{children:je?
|
|
10
|
+
/* @__PURE__ */J(A,{words:ie,icon:/* @__PURE__ */J(De,{type:"header",size:13}),name:se.headerSettings,selected:re.kind===de?.kind,onSelect:()=>te(de??p),rowProps:{onClick:$(()=>te(de??p))}}):He?/* @__PURE__ */Q(T,{children:[Ie.map((e,n)=>{const o=ne?.props.id===e.props.id,r=ge(e),t=String(e.props.id),s=()=>We(n,t),{rowProps:i,...c}=Ve.row({item:{id:t,zone:Le,index:n},place:{...W(Le),index:n}},{onClick:$(s)});/* @__PURE__ */
|
|
11
|
+
return Q(Y,{children:[0===n&&Ze(Le,0),
|
|
12
|
+
/* @__PURE__ */J(A,{words:ie,icon:/* @__PURE__ */J(De,{type:e.type,size:13}),name:r,selected:o,onSelect:s,...c,actions:/* @__PURE__ */J(R,{kind:"delete",label:se.deleteNamed({name:r}),onClick:()=>{return e=n,void(Le&&(_.removeComponent(Le,e),te(p),_.select(null)));var e},children:/* @__PURE__ */J(K,{size:13})}),rowProps:i}),Ze(Le,n+1)]},String(e.props.id??n))}),
|
|
13
13
|
/* @__PURE__ */Q("button",{type:"button",className:"sf-add-card",onClick:ve,children:[
|
|
14
|
-
/* @__PURE__ */J("span",{className:"sf-plus sf-plus--sm",children:"+"}),He.addLabel]}),ke?Ne.partRows?.(he,
|
|
14
|
+
/* @__PURE__ */J("span",{className:"sf-plus sf-plus--sm",children:"+"}),He.addLabel]}),ke?Ne.partRows?.(he,X):null]}):Qe(he,1)})})]}),
|
|
15
15
|
/* @__PURE__ */J("div",{className:"sf-center",children:/* @__PURE__ */J("div",{className:"sf-preview-host",children:/* @__PURE__ */J(ae,{})})}),
|
|
16
|
-
/* @__PURE__ */J(t,{value:{selectChild:(e,n,o,r)=>"section"===Me(r)?.source?
|
|
17
|
-
/* @__PURE__ */J(f,{})]})}export{
|
|
16
|
+
/* @__PURE__ */J(t,{value:{selectChild:(e,n,o,r)=>"section"===Me(r)?.source?We(n,o):Ye(e,n,o),addChild:(e,n,o,r,t)=>"section"===Me(t)?.source?ve():we(`${e}:${n}`,o,r),childRowName:ge,blockRowName:be},children:/* @__PURE__ */J(ue,{mode:re,onOpenWebsiteSettings:Ne.openSettings??(()=>{}),onSelectNode:xe,hideNodeActions:!0})})]}),
|
|
17
|
+
/* @__PURE__ */J(f,{})]})}export{G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{usePartBridge}from"../../chunk-MEHLY5Q4.js";import"../../chunk-WEIE2FBC.js";import"../../chunk-PAOZMXEI.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-MQA7OFRA.js";import"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-
|
|
1
|
+
export{usePartBridge}from"../../chunk-MEHLY5Q4.js";import"../../chunk-WEIE2FBC.js";import"../../chunk-PAOZMXEI.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-MQA7OFRA.js";import"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-BSHIQIZC.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-ZOBSIXRD.js";import"../../chunk-QAJAEWCZ.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-VANKQVOW.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-3S5N4HLJ.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-K7BTCBWD.js";import"../../chunk-L55YIXDC.js";import"../../chunk-QIDRJH3S.js";import"../../chunk-I54UCYOU.js";import"../../chunk-GOTN2KY4.js";import"../../chunk-R5L2E7JX.js";import"../../chunk-IYT6NN2J.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-LF3FUSCQ.js";
|
package/dist/screen/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-
|
|
1
|
+
import"../chunk-GZO72N3Q.js";export{DocumentScreen,ScreenMount}from"../chunk-7YVEYQDE.js";import"../chunk-GXQCZJOP.js";import"../chunk-XJ2WXGFJ.js";import"../chunk-2GVCAIPX.js";import"../chunk-26OOWIJJ.js";import"../chunk-JBOSEHIX.js";import"../chunk-FGNR22NY.js";import"../chunk-LER7RKTO.js";import"../chunk-FGYJ5DJY.js";import"../chunk-7F52SZOI.js";import"../chunk-MQNBD6AB.js";import"../chunk-TNGOL65V.js";import"../chunk-I7BROL77.js";import"../chunk-KCBEE2MC.js";import"../chunk-C56MPJBH.js";import"../chunk-MEHLY5Q4.js";import"../chunk-WEIE2FBC.js";import"../chunk-PY7OOQEZ.js";import"../chunk-RKTF5XLP.js";export{ScreenStoreProvider}from"../chunk-JQXD3TDE.js";import"../chunk-5545A3PC.js";import"../chunk-R5KEFI55.js";import"../chunk-PA3PNTVV.js";import"../chunk-5ZBY24K7.js";import"../chunk-BVN33R76.js";import"../chunk-43AEUUNQ.js";import"../chunk-SINAM2IT.js";import"../chunk-UMDQ6CLQ.js";import"../chunk-M2Z775ZC.js";export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../chunk-PAOZMXEI.js";import"../chunk-2G6MAXPY.js";import"../chunk-6FWAE2RN.js";import"../chunk-UJ46J7QW.js";import"../chunk-276MBG5P.js";import"../chunk-77IWWW6X.js";import"../chunk-ERR437B5.js";import"../chunk-UNVKPVZW.js";import"../chunk-GMCZXMOV.js";export{NO_DOCUMENT_ADDRESSING}from"../chunk-RLBXE4EU.js";import"../chunk-HNKB2ZYR.js";import"../chunk-CLOS6SSX.js";import"../chunk-U66YKDAR.js";import"../chunk-LOMEH6DG.js";import"../chunk-KCOBHPN6.js";import"../chunk-FHCKFOCD.js";export{EaselSessionProvider,useEaselSession}from"../chunk-O7Q4DDJT.js";export{EFFICIENT_BACKEND,activateEaselSession,backendOf,createEaselSession,currentEaselSession,deactivateEaselSession,efficientClientOpen,isEfficientBackend,provideDefaultBackend,resetAmbientEaselSession,sessionRegistry,setSessionBridgedSite,setSessionDocumentSite}from"../chunk-RSCMJIWS.js";export{DETACHED_EASEL_HOST,EaselHostContext,EaselHostProvider,createEaselHost,useEaselHost,useHostEscape}from"../chunk-MQA7OFRA.js";import"../chunk-XFYFKITX.js";import"../chunk-23DYNW6S.js";import"../chunk-V7U33NF2.js";import"../chunk-6WY6ZXJG.js";import"../chunk-EFHV56BO.js";import"../chunk-TBY3DFKS.js";import"../chunk-7LYKFL3Q.js";import"../chunk-BPXEFVSQ.js";import"../chunk-A6Z4SD3I.js";import"../chunk-K56YDHYQ.js";import"../chunk-ZEH6QLBH.js";import"../chunk-IWCKVZHS.js";import"../chunk-ZKY45F5G.js";import"../chunk-FIVU2COQ.js";import"../chunk-RC25EGHD.js";import"../chunk-KFV7N2DJ.js";import"../chunk-P5VYGWYO.js";import"../chunk-WK3AFPXY.js";import"../chunk-BSHIQIZC.js";import"../chunk-NDRZP6YR.js";import"../chunk-H6DDIBQ4.js";import"../chunk-23VM4PMV.js";import"../chunk-KRL3IUV3.js";import"../chunk-ZOBSIXRD.js";import"../chunk-QAJAEWCZ.js";import"../chunk-WRFD4EXD.js";import"../chunk-VANKQVOW.js";import"../chunk-ZG6PVMC3.js";import"../chunk-MJM6SFD3.js";import"../chunk-AJSDWWJW.js";import"../chunk-2OAZYSWJ.js";import"../chunk-THWO5YVZ.js";import"../chunk-RE4LP46F.js";import"../chunk-MFIRYGHW.js";import"../chunk-LQV5FZTQ.js";import"../chunk-KAML3KQH.js";import"../chunk-3S5N4HLJ.js";import"../chunk-P2VEMZH5.js";import"../chunk-K7BTCBWD.js";import"../chunk-L55YIXDC.js";import"../chunk-QIDRJH3S.js";import"../chunk-BSPCSC45.js";import"../chunk-I54UCYOU.js";import"../chunk-GOTN2KY4.js";import"../chunk-R5L2E7JX.js";import"../chunk-BHRC3ASL.js";import"../chunk-6W7WLPZH.js";import"../chunk-IQ5TA7AM.js";import"../chunk-DUVRZ456.js";import"../chunk-IYT6NN2J.js";import"../chunk-PLVEGYK6.js";import"../chunk-LF3FUSCQ.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{useSectionOps}from"../../../chunk-WEIE2FBC.js";import"../../../chunk-PAOZMXEI.js";import"../../../chunk-FHCKFOCD.js";import"../../../chunk-MQA7OFRA.js";import"../../../chunk-EFHV56BO.js";import"../../../chunk-TBY3DFKS.js";import"../../../chunk-7LYKFL3Q.js";import"../../../chunk-BPXEFVSQ.js";import"../../../chunk-A6Z4SD3I.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-ZEH6QLBH.js";import"../../../chunk-IWCKVZHS.js";import"../../../chunk-
|
|
1
|
+
export{useSectionOps}from"../../../chunk-WEIE2FBC.js";import"../../../chunk-PAOZMXEI.js";import"../../../chunk-FHCKFOCD.js";import"../../../chunk-MQA7OFRA.js";import"../../../chunk-EFHV56BO.js";import"../../../chunk-TBY3DFKS.js";import"../../../chunk-7LYKFL3Q.js";import"../../../chunk-BPXEFVSQ.js";import"../../../chunk-A6Z4SD3I.js";import"../../../chunk-K56YDHYQ.js";import"../../../chunk-ZEH6QLBH.js";import"../../../chunk-IWCKVZHS.js";import"../../../chunk-FIVU2COQ.js";import"../../../chunk-RC25EGHD.js";import"../../../chunk-KFV7N2DJ.js";import"../../../chunk-BSHIQIZC.js";import"../../../chunk-23VM4PMV.js";import"../../../chunk-KRL3IUV3.js";import"../../../chunk-ZOBSIXRD.js";import"../../../chunk-QAJAEWCZ.js";import"../../../chunk-WRFD4EXD.js";import"../../../chunk-VANKQVOW.js";import"../../../chunk-MFIRYGHW.js";import"../../../chunk-3S5N4HLJ.js";import"../../../chunk-P2VEMZH5.js";import"../../../chunk-K7BTCBWD.js";import"../../../chunk-L55YIXDC.js";import"../../../chunk-QIDRJH3S.js";import"../../../chunk-PLVEGYK6.js";import"../../../chunk-LF3FUSCQ.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-PAOZMXEI.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-MQA7OFRA.js";import"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-
|
|
1
|
+
export{SELECTION_MODE,ScreenCanvasTargetProvider,ScreenPartsProvider,isPinnedFirst,isPinnedLast,isSlotMode,sameInspectorMode,screenSlotsOf,useScreenBlockLook,useScreenBlockRules,useScreenBridges,useScreenCanvasDrag,useScreenCanvasFrame,useScreenCanvasHead,useScreenCanvasTarget,useScreenDevices,useScreenDocumentLabel,useScreenDocumentPass,useScreenInspectorPanel,useScreenLeftView,useScreenNodeKeys,useScreenNotify,useScreenOwnerName,useScreenParts,useScreenPickFollowsSelection,useScreenPinned,useScreenSaveSwitch,useScreenStorageNamespace,useScreenStyleClipboard,useStandaloneScreenBridges}from"../../chunk-PAOZMXEI.js";import"../../chunk-FHCKFOCD.js";import"../../chunk-MQA7OFRA.js";import"../../chunk-EFHV56BO.js";import"../../chunk-TBY3DFKS.js";import"../../chunk-7LYKFL3Q.js";import"../../chunk-BPXEFVSQ.js";import"../../chunk-A6Z4SD3I.js";import"../../chunk-K56YDHYQ.js";import"../../chunk-ZEH6QLBH.js";import"../../chunk-IWCKVZHS.js";import"../../chunk-FIVU2COQ.js";import"../../chunk-RC25EGHD.js";import"../../chunk-KFV7N2DJ.js";import"../../chunk-BSHIQIZC.js";import"../../chunk-23VM4PMV.js";import"../../chunk-KRL3IUV3.js";import"../../chunk-ZOBSIXRD.js";import"../../chunk-QAJAEWCZ.js";import"../../chunk-WRFD4EXD.js";import"../../chunk-VANKQVOW.js";import"../../chunk-MFIRYGHW.js";import"../../chunk-3S5N4HLJ.js";import"../../chunk-P2VEMZH5.js";import"../../chunk-K7BTCBWD.js";import"../../chunk-L55YIXDC.js";import"../../chunk-QIDRJH3S.js";import"../../chunk-PLVEGYK6.js";import"../../chunk-LF3FUSCQ.js";
|
package/dist/strings/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{DEFAULT_SCREEN_WORDS as r}from"../chunk-23DYNW6S.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as o}from"../chunk-6WY6ZXJG.js";import{DEFAULT_TEXT_STYLES_WORDS as n}from"../chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as t}from"../chunk-OFBZOI6W.js";import{DEFAULT_CANVAS_WORDS as c}from"../chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as e}from"../chunk-K56YDHYQ.js";import{
|
|
1
|
+
import{DEFAULT_SCREEN_WORDS as r}from"../chunk-23DYNW6S.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as o}from"../chunk-6WY6ZXJG.js";import{DEFAULT_TEXT_STYLES_WORDS as n}from"../chunk-OGH6CC3E.js";import{DEFAULT_PICK_WORDS as t}from"../chunk-OFBZOI6W.js";import{DEFAULT_CANVAS_WORDS as c}from"../chunk-TBY3DFKS.js";import{DEFAULT_TREE_WORDS as e}from"../chunk-K56YDHYQ.js";import{DEFAULT_PANEL_WORDS as m}from"../chunk-KFV7N2DJ.js";import{DEFAULT_NODE_MENU_WORDS as i}from"../chunk-WK3AFPXY.js";import{DEFAULT_SAVE_WORDS as s}from"../chunk-H6DDIBQ4.js";import{DEFAULT_COPY_WORDS as u}from"../chunk-KRL3IUV3.js";import{DEFAULT_FIELDS_WORDS as f}from"../chunk-WRFD4EXD.js";import{DEFAULT_CHROME_WORDS as p,DEFAULT_NOTICE_WORDS as l}from"../chunk-AJSDWWJW.js";import{DEFAULT_RAIL_WORDS as h}from"../chunk-2OAZYSWJ.js";import{DEFAULT_LOCK_WORDS as j}from"../chunk-RE4LP46F.js";import{stringsContext as k}from"../chunk-MFIRYGHW.js";import{DEFAULT_DRAG_WORDS as a}from"../chunk-KAML3KQH.js";import{useContext as W,useMemo as D}from"react";import{jsx as Y}from"react/jsx-runtime";var y={notice:l,lock:j,save:s,chrome:p,rail:h,tree:e,panel:m,fields:f,pick:t,drag:a,menu:i,styleClipboard:o,copy:u,canvas:c,textStyles:n,screen:r},F=r=>"object"==typeof r&&null!==r;function K(r,o){const n={};for(const t of Object.keys(r)){const c=r[t],e=o[t];null==e?n[t]=c:F(c)?n[t]=F(e)?K(c,e):c:n[t]=typeof e==typeof c?e:c}return n}function d(r,o){return o?K(r,o):r}function v({value:r,locale:o,children:n}){const t=k(),c=W(t),e=c?.strings??y,m=o??c?.locale??"en",i=D(()=>({strings:d(e,r),locale:m}),[e,r,m]);/* @__PURE__ */
|
|
2
2
|
return Y(t.Provider,{value:i,children:n})}function H(){return W(k())?.strings??y}function J(){return W(k())?.locale??"en"}export{y as DEFAULT_EASEL_STRINGS,v as EaselStringsProvider,d as mergeEaselStrings,J as useEaselLocale,H as useEaselStrings};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-easel",
|
|
3
|
-
"version": "20.2.
|
|
3
|
+
"version": "20.2.1",
|
|
4
4
|
"description": "Efficient Easel: the EFFICIENT editors' shared engine and chrome: the saved document as pure functions, the published renderer, and the editor frame, panels, Layers tree, text grammar and type-in-place box. Published as editor-shell up to 0.66.0 and as efficient-editor up to 0.95.0.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
package/dist/chunk-3R3PEVU7.js
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-JBOSEHIX.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-TNGOL65V.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-I7BROL77.js";import{SlotChildActionsProvider as h}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as f,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-C56MPJBH.js";import{usePartBridge as y}from"./chunk-MEHLY5Q4.js";import{useSectionOps as v}from"./chunk-WEIE2FBC.js";import{ScreenSaveIcon as k,ScreenMainButton as b}from"./chunk-PY7OOQEZ.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-FGJTX2DL.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{PanelHideButton as O,SidePanelHead as I,PanelShowStrip as N}from"./chunk-SINAM2IT.js";import{offeredChoices as B}from"./chunk-M2Z775ZC.js";import{useScreenSaveSwitch as P,useScreenNodeKeys as $,useScreenPinned as M,useScreenDocumentLabel as j,useScreenCanvasFrame as A,useScreenInspectorPanel as L,useScreenDevices as T,useScreenPickFollowsSelection as E,useScreenLeftView as R,SELECTION_MODE as F,sameInspectorMode as D,useScreenBridges as H,useScreenBlockRules as V,useScreenBlockLook as W,useScreenStorageNamespace as U,useScreenNotify as J,useScreenCanvasHead as G,isSlotMode as Y,useScreenStyleClipboard as X,useScreenDocumentPass as K,useScreenCanvasDrag as Z,ScreenCanvasTargetProvider as Q,isPinnedFirst as _,isPinnedLast as q,screenSlotsOf as ee}from"./chunk-PAOZMXEI.js";import{MediaPopup as ne}from"./chunk-2G6MAXPY.js";import{useNodeClipboard as te,useNodeContextMenu as oe}from"./chunk-2BOXPUGF.js";import{PageEditGuardNotices as re}from"./chunk-UJ46J7QW.js";import{useScreenDocument as ie}from"./chunk-276MBG5P.js";import{requestMediaPick as le}from"./chunk-UNVKPVZW.js";import{useMediaPanel as se,usePanelPick as de,useMediaBrowsing as ae,useOpenMediaBrowse as ce,useMediaPlace as pe}from"./chunk-FHCKFOCD.js";import{useEaselSession as ue}from"./chunk-O7Q4DDJT.js";import{useEaselHost as he,useHostEscape as fe}from"./chunk-MQA7OFRA.js";import{LayersIcon as me,MediaIcon as ge}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ye}from"./chunk-23DYNW6S.js";import{heldStyle as ve,styleShortcut as ke}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as be}from"./chunk-6WY6ZXJG.js";import{useEasel as Se,useEaselApi as we,CanvasPassThroughContext as xe,CanvasSharedContext as ze}from"./chunk-EFHV56BO.js";import{TreeRow as Ce,Subtree as Oe,LayersTree as Ie,TreeGroupLabel as Ne,TreeRowAction as Be,TreeSeam as Pe}from"./chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as $e}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Me}from"./chunk-WK3AFPXY.js";import{toItemSelector as je,useNodeOps as Ae,clickPick as Le}from"./chunk-BSHIQIZC.js";import{EaselTopBar as Te,EaselIconButton as Ee,TopBarCluster as Re,DeviceSwitch as Fe,InspectorIconButton as De,PanelResizeHandle as He,MAX_PANEL_W as Ve,MIN_PANEL_W_BY_SIDE as We,panelWidthVars as Ue}from"./chunk-ZG6PVMC3.js";import{DEFAULT_NOTICE_WORDS as Je,DEFAULT_CHROME_WORDS as Ge}from"./chunk-AJSDWWJW.js";import{holderOf as Ye,nameOrSomeone as Xe}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as Ke}from"./chunk-RE4LP46F.js";import{useWords as Ze}from"./chunk-MFIRYGHW.js";import{insertSeams as Qe,CanvasDragLayer as _e,CanvasInsert as qe}from"./chunk-H2PRGXCW.js";import{DEFAULT_DRAG_WORDS as en}from"./chunk-KAML3KQH.js";import{createDragSession as nn,useTreeDrag as tn,gapToMoveIndex as on}from"./chunk-3S5N4HLJ.js";import{ROOT_ID as rn,ROOT_SLOT as ln,zoneKey as sn,parseZoneKey as dn,find as an,DataError as cn}from"./chunk-K7BTCBWD.js";import{useCanvasFrame as pn,LIST_SELECTOR as un,BLOCK_SELECTOR as hn,useCanvasTyping as fn,useCanvasEvent as mn,nodeIdAt as gn,frameRectToHost as yn,BLOCK_ATTRIBUTE as vn,drawnBox as kn}from"./chunk-QIDRJH3S.js";import{rootRowName as bn,slotChildRowName as Sn,slotChildRenameProp as wn,sectionRenameProp as xn}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as zn,blockNodeActions as Cn,TREE_MAX_DEPTH as On,childSlotsOf as In,slotFieldsOf as Nn,newNodeId as Bn,slotChildrenIn as Pn,nestsInTree as $n}from"./chunk-PLVEGYK6.js";import{queryMainCopy as Mn}from"./chunk-LF3FUSCQ.js";import{useRef as jn,useMemo as An,useState as Ln,useEffect as Tn,useCallback as En,useLayoutEffect as Rn,Fragment as Fn,useId as Dn}from"react";import{ColoredBadge as Hn,Button as Vn,Tabs as Wn,toast as Un,readMediaFileDrag as Jn,Tooltip as Gn,groupColors as Yn,Dialog as Xn,FormField as Kn,Input as Zn,MEDIA_FILE_DRAG_TYPE as Qn}from"efficient-shell/ui";import{UndoIcon as _n,RedoIcon as qn,RefreshIcon as et,AddIcon as nt,TrashIcon as tt,EyeOffIcon as ot,EyeIcon as rt,SharedIcon as it,DuplicateIcon as lt}from"efficient-shell/icons/efficient";import{jsx as st,jsxs as dt,Fragment as at}from"react/jsx-runtime";var ct="media-file";function pt({name:e,onMake:n,onCancel:t}){const o=Ze("screen",ye).shared,[r,i]=Ln(e),[l,s]=Ln(!1),d=Dn(),a=jn(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
|
|
2
|
-
return st(Xn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */dt(at,{children:[
|
|
3
|
-
/* @__PURE__ */st(Vn,{variant:"secondary",onClick:t,children:o.cancel}),
|
|
4
|
-
/* @__PURE__ */st(Vn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */st("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */st(Kn,{label:o.name,htmlFor:d,children:/* @__PURE__ */st(Zn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var ut=/* @__PURE__ */new WeakSet;function ht(e,n,t){const o=an(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function ft({canvas:e,tabs:n,onSelect:t}){const o=jn(null),[r,i]=Ln({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Rn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=yn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Mn(t,`[${vn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?kn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=yn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */st("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */st("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
|
|
5
|
-
/* @__PURE__ */st(Gn,{content:e.reach,children:/* @__PURE__ */dt(Hn,{colorClass:Yn("success","solid"),size:"sm",children:[
|
|
6
|
-
/* @__PURE__ */st("span",{className:"es-band-tab-mark",children:/* @__PURE__ */st(it,{size:12})}),e.label]})}):/* @__PURE__ */st(Hn,{colorClass:Yn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function mt({expand:e}){/* @__PURE__ */
|
|
7
|
-
return st("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */dt(at,e?{children:[
|
|
8
|
-
/* @__PURE__ */st("path",{d:"M8 9l4-4 4 4"}),
|
|
9
|
-
/* @__PURE__ */st("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
10
|
-
/* @__PURE__ */st("path",{d:"M8 4l4 4 4-4"}),
|
|
11
|
-
/* @__PURE__ */st("path",{d:"M8 20l4-4 4 4"}),
|
|
12
|
-
/* @__PURE__ */st("path",{d:"M5 12h14"})]})})}var gt=`${un}, ${hn}`;function yt(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var vt="__rungs";var kt="screen:band",bt={duplicate:!0,delete:!0},St=()=>null;function wt(){const un=he(),yn=un.panels?.Toolbar,vn=(un.panels?.useRight??St)(),{target:kn,docId:Dn,capabilities:Gn,currentSlug:Yn,siteId:Xn,onPublish:Kn,saveState:Zn,saveConflict:it,retrySave:wt,toggleAutoSave:xt,flushSave:zt,access:Ct,saveUnreachable:Ot=!1,readOnly:It,readOnlyReason:Nt=null}=ie(),Bt=P(),Pt=$(),{mediaEditing:$t,hasEditGuard:Mt,hasPinnedChrome:jt}=Gn,{appState:At,dispatch:Lt,history:Tt,selectedItem:Et,getSelectorForId:Rt,config:Ft}=Se(e=>e),Dt=M(),{first:Ht,firstGroup:Vt,lastGroup:Wt,isSectionGroup:Ut,sectionGroupZone:Jt,panelOf:Gt}=Dt,Yt=Gt(Ht),Xt=e=>_(Dt,e),Kt=e=>q(Dt,e),Zt="node"===Dt.firstRow,Qt=Dt.band??null,_t=Ze("screen",ye),qt=Ze("tree",$e),eo=Ze("drag",en),no=Ze("notice",Je),to=Ze("lock",Ke),oo=Ze("menu",Me),ro=Ze("styleClipboard",be),io=Ze("chrome",Ge),lo=j()??`/${Yn}`,so=A(),ao=L(),co=v({readOnly:It}),po=v({readOnly:It,foldIntoHistory:!0}),uo=jn(null),ho=we(),fo=An(()=>({...co,select:e=>{uo.current=e,co.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=ho.config;uo.current=je(e,t,n)}co.commitDocument(e,n)}}),[co,ho]),mo=At.ui,go=mo.leftSideBarVisible,yo=mo.rightSideBarVisible,{options:vo,widths:ko,initial:bo,fluid:So,fit:wo}=T(),[xo,zo]=Ln(bo),Co=se(),Oo=$t&&null!==Co,Io=de(),No=ae(),Bo=null!==Io||No,Po=ce();E(Et?.props.id);const{read:$o,write:Mo,forSelection:jo}=R(),[Ao,Lo]=Ln($o);Tn(()=>{Mo(Ao)},[Ao]);const[To,Eo]=Ln(0),Ro=jn(null),Fo=jn(null),Do=pn(Fo,{readySelector:gt}),Ho=fn(Do),Vo=a(Fo);c(Fo,Do);const Wo=S(),Uo=Ye(Ct),Jo={state:Zn,offline:Wo||Zn.failed&&Ot,readOnlyReason:Nt,editing:Uo?no.editing({name:Xe(Uo.name,to),noun:_t.noun}):null,conflict:null!=it,notSaving:_t.bar.notSaving},Go=()=>{It||(Zn.failed?wt():zt())};p(Fo,Do,Go);const[Yo,Xo]=Ln(!1),Ko=jn(!1),[Zo,Qo]=Ln(null),[_o,qo]=Ln([]),[er,nr]=Ln(F),tr="puck"===er.kind,or=o(er,Et?.props.id),[rr,ir]=Ln(null);Tn(()=>{rr&&(r(),ir(null))},[rr]);const lr=jn(Rt);lr.current=Rt;const sr=En((e,{scroll:n})=>{Lo(n=>jo(e,n)),n&&ir(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=lr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Tr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),dr=jn(null);Tn(()=>{const e=dr.current;dr.current=null;const n=null==Et?.props.id?null:String(Et.props.id);nr(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Gt(Et?.type)??F);const t=Et?.props.id,o=uo.current;if(uo.current=null,!t)return;const r=Rt(t);sr(String(t),{scroll:!i(o,r??null,zn)})},[Et?.props.id,sr]);const ar=En(e=>{nr(n=>D(n,e)?n:e),Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},[Lt]),cr=jn(()=>{});cr.current=(e,n)=>{const t=e?Mi(e.zone??zn)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Et?.props.id?null:String(Et.props.id);nr(e=>D(e,n)?e:n),o!==r&&(dr.current={id:o,mode:n},fo.select(e))};const pr=En((e,n)=>cr.current(e,n),[]),ur={kind:er.kind,mode:er,open:ar,show:e=>nr(e),reveal:()=>{yo||Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:pr},hr=H(ur,{data:At.data,selected:Et??null,zoneOf:e=>Rt(e)?.zone,readOnly:Boolean(It),select:e=>{nr(F),fo.select({index:e})},replace:(e,n)=>fo.replaceComponent(zn,e,n),scrollTo:e=>l(e)},{device:xo,refreshes:To},{setView:Lo,reveal:()=>{go||Lt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),fr=hr.resolveLeftView?hr.resolveLeftView(Ao):"sections",mr=V(),{isLockedBlock:gr,duplicateBlocked:yr,nestDepth:vr,newSectionNode:kr,canAddTo:br,blockIsOffered:Sr}=mr,wr=W(),{labelAtLevel:xr,Icon:zr,useProducts:Cr}=wr,Or=wr.rowName?(e,n,t)=>wr.rowName(e,n,t):void 0,Ir=En(e=>{Lt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),sr(e,{scroll:!0})},[Lt,sr]),{selectNode:Nr,openPartId:Br}=y({mode:er,setMode:nr,onOpenPart:Ir}),[Pr,$r]=Ln(null);fe(null!==Pr,()=>$r(null));const Mr=f(U()),jr=Mr.collapsed,Ar=Mr.panelWidths,[Lr,Tr]=Ln(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(jr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
13
|
-
return new Set}});Tn(()=>{try{window.localStorage.setItem(jr,JSON.stringify([...Lr]))}catch{}},[Lr]);const[Er,Rr]=Ln(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(Ar);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left,"left"),right:g(Number(n.right)||m.right,"right")}}catch{return{...m}}});Tn(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Ar,JSON.stringify(Er))}catch{}},300);return()=>clearTimeout(e)},[Er]);const Fr=En((e,n)=>Rr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Dr=En(e=>Fr("left",e),[Fr]),Hr=En(e=>Fr("right",e),[Fr]),Vr=e=>Lr.has(e),Wr=e=>Tr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Ur=jn(!1),Jr=jn(null);Tn(()=>{if(Ur.current&&!Yo){const e=Jr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Fo.current?.querySelector(`button[aria-label="${CSS.escape(_t.add.title)}"]`))?.focus(),Jr.current=null}Ur.current=Yo},[Yo]),Tn(()=>{if(!Yo||!Vo)return;const e=e=>{"Escape"===e.key&&cl()};return Vo.addEventListener("keydown",e),()=>Vo.removeEventListener("keydown",e)},[Yo,Vo]),fe(Yo,()=>cl()),Tn(()=>{!go&&Yo&&(Xo(!1),Qo(null),Ko.current=!1)},[go]);const Gr=J(),Yr=(e,n="success",t)=>{if(Gr)return void(t?Gr(e,"error"===n?"error":"info",t):Gr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Un.error(e,{...o,duration:t?.duration??3200}):Un.success(e,{...o,duration:t?.duration??1900})},Xr=jn(null),[Kr,Zr]=Ln(0),[Qr,_r]=Ln(0),qr=G(),ei=jn(null),ni=e=>Math.max(0,e.clientHeight-(ei.current?.offsetHeight??0));Tn(()=>{const e=Xr.current;if(!e)return;const n=()=>{Zr(e.clientWidth),_r(ni(e))};n();const t=new ResizeObserver(n);return t.observe(e),ei.current&&t.observe(ei.current),()=>t.disconnect()},[]),Rn(()=>{Xr.current&&(Zr(Xr.current.clientWidth),_r(ni(Xr.current)))},[Er,go,yo]);const ti=xo===So?Kr>0?Kr:ko[So]:ko[xo],oi=Kr>0?Math.min(Kr/ti,"shrink"===wo?1:2):1,ri=ti*oi,ii=Kr>0&&ri>Kr+1,li={width:ri,height:Qr||"100%",flex:"none",position:"relative"},si={width:ti,height:Qr?Qr/oi:"100%",maxHeight:"none",transform:1!==oi?`scale(${oi})`:void 0,transformOrigin:"top left"},di=()=>Lt({type:"setUi",ui:{leftSideBarVisible:!go}}),ai=()=>Lt({type:"setUi",ui:{rightSideBarVisible:!yo}}),ci=e=>{Yo&&(Xo(!1),Qo(null),Ko.current=!1,go&&Ao===e)||(Lo(e),go||Lt({type:"setUi",ui:{leftSideBarVisible:!0}}))},pi=()=>{nr(F),fo.select(null),d()},ui=()=>{nr(Yt??F),yo||Lt({type:"setUi",ui:{rightSideBarVisible:!0}})},hi=At.data.content??[],fi=()=>{const e=hi.findIndex(Xt),n=hi.findIndex(Kt);return{floor:e>=0?e+1:0,cap:n>=0?n:hi.length}},mi=Ft,gi=mr.stripCopy,yi=n=>e(n,gi),vi=te(),ki=Ae({data:At.data,config:mi,readOnly:Boolean(It),clipboard:vi,strip:gi?e=>gi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==rn||e.slot!==ln)return{min:0,max:n-1};const{floor:t,cap:o}=fi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&nr(F);const t=void 0===n||"node"===n?.kind?n:null;fo.commitDocument(e,t)}}),bi=ue(),[Si,wi]=Ln(null),xi=e=>{const n=hi.find(n=>String(n.props.id)===e),t=Dt.shared;n&&t&&ki.swap(e,t.detach(n))},zi=e=>{const n=an(At.data,Ft,e);if(!n)return!1;const t=sn(n.place),o=n.node,r=t===zn?Bi(o):Wi(o),i=t===zn?Dt.shared?.usedOn(o):null;return!!ki.remove(e)&&(Yr(i?_t.shared.removed({count:Math.max(0,i.length-1)}):_t.deleted({name:r}),"success",{duration:8e3,action:{label:_t.bar.undo,onClick:()=>{ki.restore(n.node,n.place)}}}),!0)},Ci={...ki,remove:zi},Oi=e=>xr(e,"block",Ft.components[e]?.label??e),Ii=En(e=>Ft.components[e]?.defaultProps??{},[Ft]),Ni=e=>xr(e,"section",Oi(e)),Bi=e=>bn({type:e.type,props:e.props??{}},Ni(e.type),Or),{nodeAddresses:Pi,zoneItems:$i}=An(()=>{const e=/* @__PURE__ */new Map,n=/* @__PURE__ */new Map,t=(o,r,i)=>{n.set(r,o),o.forEach((n,o)=>{const l=String(n.props?.id??"");if(l&&e.set(l,{zone:r,index:o}),i>=On)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of In(Ft,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(hi,zn,0),{nodeAddresses:e,zoneItems:n}},[hi,Ft]),Mi=En(e=>$i.get(e)??[],[$i]),ji=e=>{const n=Pi.get(e);return n?Mi(n.zone)[n.index]:void 0},Ai=e=>ee(mr,Ft,e),Li=e=>{if(!mr.slotsOf||e===zn)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=ji(e.slice(0,n));if(!t)return null;const o=Ai(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},Ti=(()=>{if(!Y(er))return null;const e=`${er.nodeId}:${er.slot}`;return Li(e)?.slot.panel===er.kind?e:null})(),Ei=jn(null);Tn(()=>{const e=Ei.current;if(Ei.current=null,!Ti||!Y(er))return;const n=er.nodeId;sr(n,{scroll:e!==Ti}),Tr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[er]);const Ri=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Pi.get(e);n&&(n.zone===zn?ol(n.index):Pl(n.zone,n.index,e,ji(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Ti!==i&&(Ei.current=i),pr(null,r),yo||Lt({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Fi=(e,n,t)=>{const o=`${e}:${n}`;if(Tr(n=>{if(!n.has(o)&&!n.has(e))return n;const t=new Set(n);return t.delete(o),t.delete(e),t}),!t)return;Ti!==o&&(Ei.current=o);pr(null,{kind:t,nodeId:e,slot:n})},Di=(e,n,t)=>{if(It||!mr.moveSlot)return;const o=ji(e),r=o?Ai(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:vt,index:n},s=on(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=mr.moveSlot(e,n,s);"string"==typeof d&&Fi(e,d,i.panel)},Hi=Cr(),Vi=An(()=>{const e=/* @__PURE__ */new Map;for(const n of Hi??[])e.set(n.slug,n.name);return e},[Hi]),Wi=e=>Sn(e,Oi,wr.plainText,e=>Vi.get(e),wr.rowName),Ui=(e,n)=>{const t=Ft.components[e.type]?.fields,o=n===zn||ts(n)?"section":"block",r=n===zn&&(Xt(e)||Kt(e)||Ut(e.type)),i="block"===o?wn(t):r?null:xn(t);return wr.renamePropOf?wr.renamePropOf(e,o,i):i},Ji=(e,n,t,o)=>{if(!(!It&&Pr?.zone===e&&Pr.index===n))return;const r=(t,o)=>{$r(null),o&&((e,n,t)=>{const o=Mi(e)[n];if(!o)return;const r=Ui(o,e);r&&fo.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
14
|
-
return st("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":_t.rename,onClick:e=>e.stopPropagation(),onBlur:e=>r(e.currentTarget.value,!0),onKeyDown:e=>{"Enter"===e.key?(e.preventDefault(),r(e.currentTarget.value,!0)):"Escape"===e.key&&(e.preventDefault(),r("",!1))}},t)},Gi=t(X(),ro),Yi=Gi.scope({target:kn,siteId:Xn,docId:Dn}),Xi=Ft,Ki=(e,n)=>n===zn?Ni(e):Oi(e),Zi=(e,n,t)=>{const o=Gi.plan(Yi,t,Ki(t.type,e),Xi);o&&(o.changed&&fo.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Yr(o.message))},Qi=oe({nodesIn:Mi,nodeAt:(e,n)=>Mi(e)[n]??null,labelOf:(e,n)=>n===zn?Ni(e):Oi(e),renamePropOf:Ui,beginRename:(e,n)=>$r({zone:e,index:n}),history:{hasPast:Tt.hasPast,hasFuture:Tt.hasFuture,back:()=>Tt.back(),forward:()=>Tt.forward()},openPageSettings:()=>{fo.select(null),nr(F)},pageSettingsLabel:_t.pageSettings,words:{menu:oo,styleClipboard:ro,screen:_t.menu},readOnly:Boolean(It),collapseAll:()=>Tr(new Set(Mi(zn).map(e=>String(e.props.id)))),onPasteRefused:e=>Yr(e?_t.pasteRefused({name:e.label}):_t.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>is(e,n),menuRows:(e,n,t)=>{const o=hr.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Dt.shared;if(!t||n!==zn)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:_t.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return It||gr(e.type,e)?n:{...n,change:[{label:_t.shared.detach,onClick:()=>xi(e.props.id)}],remove:[{label:_t.shared.removeFromPage,danger:!0,onClick:()=>{zi(e.props.id)}}]}}return It||Xt(e)||Kt(e)||Ut(e.type)?null:z(bi)?{change:[{label:_t.shared.makeShared,onClick:()=>wi({id:e.props.id,name:Bi(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>gr(e.type,e),duplicateBlocked:e=>yr(At.data,e),permits:e=>{const n=Cn(Ft,e.type);return Dt.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:Ci,isPinned:(e,n)=>n===zn&&(Xt(e)||Kt(e)),sectionBand:fi,locate:e=>Pi.get(e)??null,rowNameOf:(e,n)=>n===zn?Bi(e):Wi(e),selectAt:(e,n,t,o)=>{e===zn?ol(n):Pl(e,n,t,o??"")},slotRung:e=>{const n=Li(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ri(n.node,n.slot,!1)}:null},style:{held:()=>ve(Yi),canCopy:e=>Gi.rows(Xi,e).some(e=>!1!==e.counted),copy:(e,n)=>Gi.copy(Yi,e,Ki(e.type,n),Xi),paste:(e,n,t)=>Zi(e,n,t)},keys:Pt?{target:Vo,selected:()=>{const e=At.ui.itemSelector;return e?{zone:e.zone??zn,index:e.index}:null},held:()=>vi.get(),readOnly:Boolean(It),onDone:({done:e,name:n})=>{"copied"===e&&Yr(_t.copied({name:n}))}}:void 0},Do),_i=jn({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});Tn(()=>{_i.current={copy:(e,n)=>Gi.copy(Yi,e,Ki(e.type,n),Xi),paste:Zi,at:()=>{const e=At.ui.itemSelector;if(!e)return null;const n=e.zone??zn,t=Mi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(It)}});const qi=En(e=>{const n=ke(e);if(!n)return;const t=_i.current,o=t.at();o&&(e.preventDefault(),"copy"===n?t.copy(o.node,o.zone):t.readOnly||t.paste(o.zone,o.index,o.node))},[]);Tn(()=>{if(!Vo)return;const e=e=>qi(e);return Vo.addEventListener("keydown",e),()=>Vo.removeEventListener("keydown",e)},[qi,Vo]),mn(Do,"keydown",qi);const el=hi.map(e=>e.props.id).join("|");Tn(()=>{const e=Do?.document??null,n=Do?.window??null;let t=0;const o=[],r=()=>{if(!e)return void qo(e=>e.length?[]:e);const n=hi.findIndex(Kt),t=n>=0?n:hi.length,o=n=>{const t=hi[n]?.props?.id;return null==t?null:Mn(e,`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(hn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=hi.length>0&&!Xt(hi[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=yt(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}qo(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Do,el,xo,oi,go,yo,Et?.props.id]);const nl=Do?.document??null,tl=Do?.window??null;Tn(()=>{const e=Ro.current;if(!e||!nl||!tl)return;const n=[],t=()=>{const n=Mn(nl,`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&tl.scrollTo({left:tl.scrollX,top:tl.scrollY+t,behavior:"instant"}),!0};return Ro.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[nl,tl]);const ol=e=>{nr(F),fo.select({index:e}),hr.sectionPressed?.(hi[e]);const n=hi[e]?.props?.id;n&&l(n)},rl=e=>{const{floor:n,cap:t}=fi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Et&&er.kind!==Yt?.kind?hi.findIndex(e=>e.props.id===Et.props.id):-1;return o(r>=0?r+1:t)},il=(e,n)=>{const{floor:t,cap:o}=fi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(fo.reorderComponent(zn,e,i),fo.select({index:i}),{moved:!0,dest:i})},ll=(e,n,t,o)=>{nr(F),fo.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Yr(_t.sectionAdded({name:t}))},sl=(e,n)=>{const t=rl(n),o=kr(e,{nodeDefaults:Ii,newNodeId:Bn,sectionLabel:Ni,blockIsOffered:Sr}),r=o?fo.insertNode(zn,t,o):fo.insertSection(e,t);return ll(t,r,Ni(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of In(Ft,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=br(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},dl=e=>al(zn,e),al=(e,n)=>{Jr.current=document.activeElement??null,Qo(null===n?null:{zone:e,index:n}),Xo(!0),go||(Ko.current=!0,Lt({type:"setUi",ui:{leftSideBarVisible:!0}}))},cl=()=>{Xo(!1),Qo(null),Ko.current&&Lt({type:"setUi",ui:{leftSideBarVisible:!1}}),Ko.current=!1},pl=(e,n)=>wr.rowName?n?Xt(e)?wr.rowName(e,"section",_t.header):Kt(e)?wr.rowName(e,"section",_t.footer):Ut(e.type)?wr.rowName(e,"section",Oi(e.type)):Bi(e):Wi(e):n?Ni(e.type):Oi(e.type),ul=e=>n=>{e()},hl=(e,n,t)=>{if(It)return null;const o=Mi(e)[n];return o&&!Cn(Ft,o.type).delete||o&&gr(o.type,o)?null:/* @__PURE__ */st(Be,{kind:"delete",label:e===zn&&o&&Dt.shared?.usedOn(o)?_t.shared.removeFromPage:_t.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Mi(e)[n]?.props?.id;null!=t&&zi(String(t))})(e,n),children:/* @__PURE__ */st(tt,{size:15})})},fl=e=>wr.rowPreview?.(e)||void 0,ml=e=>wr.rowMarks?.(e)??void 0,gl=(e,n,t)=>wr.rowActions?.(e,n,t)??null,yl=(e,n,t,o)=>{if(It)return null;if(gr(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
15
|
-
return st(Be,{kind:"eye",label:r?_t.showNamed({name:o}):_t.hideNamed({name:o}),onClick:()=>kl(e,n,t),children:/* @__PURE__ */st(r?ot:rt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},vl=e=>Js(zn,e),kl=(e,n,t)=>{fo.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},bl=e=>Nn(Ft,e),Sl=e=>In(Ft,e),wl=e=>mr.slotsOf?Ai(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Pn(e,n.slot)})):[{slot:null,rung:null,kids:Sl(e)}],xl=e=>mr.slotsOf?wl(e).flatMap(e=>e.kids):Sl(e),zl=e=>Boolean(mr.slotsOf)&&Ai(e).some(e=>e.rung),Cl=(e,n,t)=>null===t?void 0===n?br(e):br(e,n):br(e,n,t),Ol=(e,n,t)=>{const o=$n(Ft,e.type,n)&&(t||xl(e).length>0||zl(e));return{collapsible:o,folded:o&&Vr(String(e.props.id))}},Il=(e,n,t)=>wl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>Ol(e,r,t(e.type)).collapsible?[String(e.props.id),...Il(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Nl=e=>xl(e).length>0||zl(e)||Boolean(br(e.type)),Bl=e=>Boolean(br(e)),Pl=(e,n,t,o)=>{if(nr(F),br(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),fo.select({index:n,zone:e}),l(t)}else fo.select({index:n,zone:e}),l(t)},$l=(e,n,t,o,r)=>{const i=`${e}:${n}`;fo.insertComponent(i,t,o),br(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),fo.select({index:o,zone:i})}):fo.select({index:o,zone:i})},Ml=jn(/* @__PURE__ */new Set);Tn(()=>{hi.forEach(e=>{const n=br(e.type)?.spec;if(!n)return;const t=e.props.id;if(Ml.current.has(t))return;Ml.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(Ii)).forEach((e,t)=>po.seedChild(o,t,n.childType,e))})},[hi,po,Ii]);const jl=jn(/* @__PURE__ */new Set);Tn(()=>{hi.forEach((e,t)=>{const o=e.props.id;if(jl.current.has(o))return;const r=n(e,bl(e.type));jl.current.add(o),r&&po.replaceComponent(zn,t,{...e,props:r})})},[hi,po]),K(po,Ft);const Al=hi.findIndex(Kt),Ll=Al>=0?hi[Al]:null,Tl=Zt?hi.findIndex(Xt):-1,El=Tl>=0?hi[Tl]:null,Rl=Dt.groupTab,Fl=An(()=>Rl?e=>Ut(e.type):void 0,[Rl]),Dl=Boolean(Dt.groupBadge),Hl=Dt.sharedReach,Vl=e=>Hl?.(e)??void 0,Wl=An(()=>Hl?new Set(hi.filter(e=>Vl(e)).map(e=>String(e.props.id))):null,[hi,Hl]),Ul=An(()=>Wl?e=>Wl.has(e):void 0,[Wl]),Jl=Dt.first?Hl?.({type:Dt.first,props:{id:""}})??void 0:void 0,Gl=Dt.groupBadge?/* @__PURE__ */st("span",{className:"es-tree-group-badge",children:/* @__PURE__ */st(Hn,{tone:"info",size:"xs",children:Dt.groupBadge})}):void 0,Yl=hi.find(e=>e.type===Vt)??null,Xl=hi.find(e=>e.type===Wt)??null,Kl=Al>=0?Al:hi.length,Zl=[];hi.forEach(e=>{Kt(e)||(Nl(e)&&Zl.push(String(e.props.id)),Zl.push(...Il(e,1,Bl)))}),Ll&&(Zl.push(String(Ll.props.id)),Zl.push(...Il(Ll,1,Bl)));const Ql=Zl.length>0&&Zl.every(e=>Lr.has(e)),_l=e=>{const n=wr.blockRowName(e,Oi);return wr.rowName?wr.rowName(e,"block",n):n},ql=(e,n,t,o)=>{const r=Mi(e)[t];if(!r)return;const i={...dn(e),index:t},l={...dn(n),index:Math.min(Math.max(o,0),Mi(n).length)},s=on(i,l);if(e!==n||s!==t)try{ki.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof cn))throw e}},es=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of Sl(e))n.add(r),t(o)};for(const t of bl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},ns=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Pi.get(n);if(!e)return null;if(e.zone===zn)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ts=e=>{const n=e.slice(0,e.indexOf(":")),t=hi.find(e=>Ut(e.type)&&String(e.props.id)===n);return t&&Jt(n)===e?t:null},os=(e,n)=>{const t=ts(e);return!t||(!Dt.groupAccepts||Dt.groupAccepts(t.type,n,Mi(e).length))},rs=(e,n,t)=>{if(e.rung){const t=ji(e.rung.nodeId),o=t?Ai(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===vt&&n.index>=0&&n.index<=o}if(n.slot===vt)return!1;if(e.add)return ds(e.add,n);const o=sn(n);if(Ut(e.type))return!1;const r=ts(o),i=ts(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!os(o,e.type))&&(n.index>=0&&n.index<=Mi(o).length));if(e.zone===zn||o===zn){if(e.zone!==o)return!1;const{floor:t,cap:r}=fi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Mi(o).length)return!1;if(e.zone===o)return!0;const l=Ll&&!Dt.lastIsOpen?String(Ll.props.id):null;return(!l||ns(e.zone)!==l&&ns(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Mi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Pi.get(i),s=l?Mi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&es(r).has(n))return!1;const d=br(s.type,vr(At?.data,s.type,i),n.slice(n.lastIndexOf(":")+1));return!!d&&(!!(d.choices?d.choices.some(e=>e.type===r.type):d.spec?.childType===r.type)&&!d.spec?.addBlocked?.(Mi(n),r))})(e.zone,o,e.index,t)},is=(e,n)=>{const t=sn(e.from),o=e.node;return t===sn(n)?os(t,o.type):rs({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},ls=e=>{const n=e.slice(0,e.indexOf(":")),t=Pi.get(n),o=t?Mi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=br(o.type,vr(At?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=B(r.choices??(r.spec?[{type:r.spec.childType,label:Oi(r.spec.childType)}]:[])),l=Li(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:pl(o,t.zone===zn)}},ss=(e,n)=>{if("section"!==e.kind)return e;const t=sn(n);return t===zn||ts(t)?e:ls(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},ds=(e,n)=>{const t=ss(e,n),o=sn(n);if("shared"===t.kind){if(o!==zn||!Dt.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=fi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ts(o)){const e="section"===t.kind?t.type:t.template.node.type;return os(o,e)&&n.index>=0&&n.index<=Mi(o).length}if(o!==zn)return!1;const{floor:e,cap:r}=fi();return n.index>=e&&n.index<=r}if(o===zn)return!1;const r=ls(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Mi(o))},as=(e,n)=>{const t=ss(e,n);if("block"!==t.kind&&ts(sn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&os(n,o)){if("section"===e.kind)fo.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;fo.insertNode(n,t,yi(e.template.node))}nr(F),fo.select({index:t,zone:n})}})(t,sn(n),n.index);if("section"===t.kind)return void sl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=rl(t),r=fo.insertNode(zn,o,n);ll(o,r,e)})(t.template.name,yi(t.template.node),n.index);if("shared"===t.kind){const e=Dt.shared?.nodeOf(t.section);if(!e)return;const o=rl(n.index);return void(ki.restore(e,{parentId:rn,slot:ln,index:o})&&ll(o,e.props.id,t.section.title))}const o=sn(n),r=ls(o);r&&(r.target.spec?$l(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{fo.insertComponent(e,n,t),nr(F),fo.select({index:t,zone:e})})(o,t.type,n.index))},cs=(e,n)=>{e.media?function(e){const n=Ds();if(!n||!Es)return;Vs(n).then(n=>{n&&function(e,n){if(!Es)return;const t=Es.create(e,{nodeDefaults:Ii,newNodeId:Bn,sectionLabel:Ni,blockIsOffered:Sr}),o=sn(n);if(o===zn){const e=rl(n.index),o=fo.insertNode(zn,e,t);return void ll(e,o,Ni(t.type))}fo.insertNode(o,n.index,t),nr(F),fo.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Di(e.rung.nodeId,e.index,n.index):e.add?as(e.add,n):e.zone===zn?il(e.index,n.index):ql(e.zone,sn(n),e.index,n.index)},[ps]=Ln(()=>nn()),us=tn({keyOf:e=>e.id,readOnly:Boolean(It),session:ps,canDrop:rs,onDrop:cs,onStep:(e,n)=>{e.rung?Di(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===zn?((e,n)=>{const t=Ni(hi[e]?.type??""),o=il(e,n<0?e-1:e+2);if(!o.moved)return void Yr(n<0?_t.sectionFirst({name:t}):_t.sectionLast({name:t}));const{floor:r,cap:i}=fi();Yr(_t.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):ql(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),hs=En(e=>{const{floor:n,cap:t}=fi(),o=[];for(const r of e.nodes){const e=sn(r.place),i=Mi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Xt(i)||Kt(i)||gr(i.type,i))continue;if(Ut(i.type))continue;const l=Boolean(ts(e)),s=e===zn||l;e===zn&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Ni(i.type):Wi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=sn(e.list);if(n===zn&&0===e.children.length)return[{...e,addLabel:_t.addSection,addAlways:!0}];const t=ls(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ts(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=sn(e.list),t=n===zn||ts(n)?null:ls(n);return t?.choices.length?Qe(e,t.target.spec?.addLabel??_t.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[At.data]),fs=null==Et?.props.id?null:String(Et.props.id),ms=En(e=>{const n=Ft,t=e=>!e.item.rung&&null!==an(At.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(fs);return i||(r(Le(At.data,n,o.item.id,fs,Fl))??o)},[At.data,Ft,fs,Fl]),[gs,ys]=Ln(null),vs=Boolean(Rl||Hl);mn(Do,"mouseover",e=>{if(!vs)return;const n=gn(e.target),t=n?ht(At.data,Ft,n):null;t!==gs&&ys(t)}),mn(Do,"mouseout",e=>{vs&&!e.relatedTarget&&ys(null)});const ks=e=>Xt(e)||Kt(e)||Ut(e.type),bs=e=>{const n=Ut(e.type)?Oi(e.type):Xt(e)?_t.header:Kt(e)?_t.footer:null;return null===n?Bi(e):wr.rowName?wr.rowName(e,"section",n):n},Ss=[];if(vs){const e=fs?ht(At.data,Ft,fs):null;for(const n of/* @__PURE__ */new Set([e,gs])){const e=n?hi.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Xt(e)||e.type===Vt,o=Vl(e);if(o){Ss.push({id:String(e.props.id),label:bs(e),below:t,reach:o});continue}if(!Rl||!ks(e))continue;const r=Rl(e);r&&Ss.push({id:String(e.props.id),label:r,below:t})}}const ws=ue(),xs=jn(null);Tn(()=>{const e=Dt.changeNotice;if(!e)return;const n=JSON.stringify(hi.filter(ks)),t=xs.current;if(xs.current={doc:Dn,bands:n,index:Tt.index},!t||t.doc!==Dn||t.bands===n)return;Tt.hasPast&&Tt.index>=t.index&&!ut.has(ws)&&(ut.add(ws),Yr(e,"success",{action:{label:_t.bar.undo,onClick:()=>Tt.back()},duration:8e3}))},[hi]);const zs=e=>{nr(F),fo.select(e.zone===zn?{index:e.index}:{index:e.index,zone:e.zone})},Cs=Z(),Os=()=>({data:At.data,device:xo,ops:fo,inspector:ur}),Is=Cs?.model,Ns=An(()=>Is?e=>Is(e,hs(e),Os()):hs,[Is,hs,xo]),Bs=Cs?.measure,Ps=Bs?(e,n)=>Bs(e,n,Os()):void 0,$s=Cs?.canDrop,Ms=$s?(e,n)=>$s(e,n,rs,Os()):rs,js=Cs?.drop,As=js?(e,n)=>js(e,n,cs,Os()):cs,Ls=Cs?.pick,Ts=Ls?e=>Ls(e,zs,Os()):zs,Es=Cs?.media??null,Rs=jn(null),Fs=An(()=>Es?{id:ct,zone:"",index:-1,type:Es.adds.type,add:{kind:Es.adds.kind,type:Es.adds.type},media:!0}:null,[Es]);Tn(()=>{if(!Fs||It||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(Qn))(e)&&(Rs.current=null,ps.start({key:ct,item:Fs}))},n=e=>{ps.get()?.item.media&&(Rs.current=Jn(e.dataTransfer))},t=()=>{ps.get()?.item.media&&ps.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Fs,It,ps]);const Ds=()=>{const e=Rs.current;return Rs.current=null,e},Hs=pe(),Vs=async e=>{if(!Hs)return e;const n=await Hs(e);return n?{...e,id:n.id,url:n.url}:null};const Ws=(e,n)=>{if(!Es)return;const t=an(ho.getState().appState.data,mi,n);if(!t)return;const o=t.node;fo.replaceComponent(sn(t.place),t.place.index,{...o,props:{...Es.replace(o,e),id:o.props.id}})},Us=e=>{const n=sn(e),t=Li(n);t&&Ri(t.node,t.slot,!1),al(n,e.index)},Js=(e,n)=>/* @__PURE__ */st(Pe,{...It?{}:us.seam({place:{...dn(e),index:n}})},`seam:${e}:${n}`),Gs={rowClick:ul,isCollapsed:Vr,toggleCollapse:Wr},Ys=e=>{const n=String(e.props.id),t=hi.findIndex(e=>String(e.props.id)===n),o=Jt(n),r=Mi(o),i=Vr(n),l=Oi(e.type),s=wr.rowName?wr.rowName(e,"section",l):l,d=e=>Js(o,e);/* @__PURE__ */
|
|
16
|
-
return dt(at,{children:[
|
|
17
|
-
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(zr,{type:e.type,size:13}),name:s,preview:fl(e),marks:ml(e),onSelect:()=>ol(t),nameSlot:Ji(zn,t,n,s),selected:or===n,badge:Vl(e)?void 0:Gl,shared:Vl(e),actions:gl(e,zn,t)??void 0,rowProps:{"data-node-id":n,onClick:ul(()=>ol(t))},fold:{open:!i,label:"section",onToggle:()=>Wr(n)}}),!i&&/* @__PURE__ */dt(Oe,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Bi(n),l=Nl(n),s=l&&Vr(r),a=()=>Pl(o,t,r,e.type),{rowProps:c,...p}=us.row({item:{id:r,zone:o,index:t,type:n.type},place:{...dn(o),index:t}},{"data-node-id":r,onClick:ul(a)});/* @__PURE__ */
|
|
18
|
-
return dt(Fn,{children:[d(t),
|
|
19
|
-
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(zr,{type:n.type,size:13}),name:i,preview:fl(n),marks:ml(n),onSelect:a,nameSlot:Ji(o,t,r,i),selected:or===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Wr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[hl(o,t,i),gl(n,o,t),yl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */st(Oe,{children:Zs(n,2)})]},r)}),d(r.length)]})]})},Xs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=us.dragging,d=!Vr(l)&&s?.rung?.nodeId!==i,a={...dn(l),index:0},c=s&&!s.rung&&rs(s,a)?a:void 0,p=()=>Ri(e,n,!0),{rowProps:u,...h}=us.row({item:{id:`rung:${l}`,zone:`${i}:${vt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:vt,index:t},into:c,canDrag:Boolean(mr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:ul(p)}),f=It?null:mr.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
20
|
-
return dt(Fn,{children:[n.heading,
|
|
21
|
-
/* @__PURE__ */st(Ce,{words:qt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Ti===l,...h,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Wr(l)},actions:f&&f.length>0?/* @__PURE__ */st(at,{children:f.map((t,o)=>/* @__PURE__ */st(Be,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(It||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Fi(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */st(tt,{size:15}):/* @__PURE__ */st(lt,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */st(Oe,{children:r})]},l)},Ks=(e,n)=>{const t=wl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
22
|
-
return st(at,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=Cl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Js(e,n),p=/* @__PURE__ */dt(at,{children:[i.map(({child:n,zone:t,index:o})=>{const r=or===String(n.props.id),{collapsible:i,folded:s}=Ol(n,l,Bl(n.type)),d=String(n.props.id),a=_l(n),p=()=>Pl(t,o,d,e.type),{rowProps:u,...h}=us.row({item:{id:d,zone:t,index:o,type:n.type},place:{...dn(t),index:o}},{"data-node-id":d,onClick:ul(p)});/* @__PURE__ */
|
|
23
|
-
return dt(Fn,{children:[0===o&&c(t,0),
|
|
24
|
-
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(zr,{type:n.type,size:13}),name:a,preview:fl(n),marks:ml(n),onSelect:p,nameSlot:Ji(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...h,fold:i?{open:!s,label:"group",onToggle:()=>Wr(d)}:void 0,actions:/* @__PURE__ */dt(at,{children:[hl(t,o,a),gl(n,t,o),yl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */st(Oe,{children:Ks(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?Xs(e,t.rung,r++,o,p):/* @__PURE__ */st(Fn,{children:p},t.slot??"")})})},Zs=(e,n)=>{const t=vr(At?.data,e.type,String(e.props.id)),o=wl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
25
|
-
return st(at,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=Cl(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),h=a&&!a.fixed?`${u}:${a.slot}`:null,f=p?`${u}:${p.slot}`:null,m=(e,n)=>Js(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===h)),v=/* @__PURE__ */dt(at,{children:[l.map(({child:n,zone:t,index:o})=>{const r=or===String(n.props.id),i=Wi(n),l=String(n.props.id),{collapsible:d,folded:a}=Ol(n,s,Bl(n.type)),c=bl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...dn(p),index:Mi(p).length}:void 0,h=us.dragging,f=u&&h&&rs(h,u)?u:void 0,g=()=>Pl(t,o,l,e.type),{rowProps:y,...v}=us.row({item:{id:l,zone:t,index:o,type:n.type},place:{...dn(t),index:o},into:f,canDrag:!gr(n.type,n)},{"data-node-id":l,onClick:ul(g)});/* @__PURE__ */
|
|
26
|
-
return dt(Fn,{children:[0===o&&m(t,0),
|
|
27
|
-
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(zr,{type:n.type,size:13}),name:i,preview:fl(n),marks:ml(n),onSelect:g,nameSlot:Ji(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Wr(l)}:void 0,actions:gr(n.type,n)?gl(n,t,o)??void 0:/* @__PURE__ */dt(at,{children:[hl(t,o,i),gl(n,t,o),yl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */st(Oe,{children:Zs(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
|
|
28
|
-
/* @__PURE__ */st(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>$l(e.props.id,a.slot,a.childType,c.length,e.type)}),null===g?f&&!l.some(e=>e.zone===f)?m(f,0):null:0!==l.length||(o.rung?y:g!==f)?null:m(g,0)]});return o.rung?Xs(e,o.rung,i++,r,v):/* @__PURE__ */st(Fn,{children:v},o.slot??"")})})},Qs=Yo,_s=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:go&&!Qs&&fr===e.id,onSelect:()=>ci(e.id)}:e,qs=[...(hr.railLead??[]).map(_s),{id:"sections",label:_t.layers,icon:/* @__PURE__ */st(me,{}),active:go&&!Qs&&"sections"===fr,onSelect:()=>ci("sections")},...(hr.railTrail??[]).map(_s)],ed=Oo?{pressed:Bo,onPress:Po}:$t?{pressed:!1,onPress:()=>{le(un,{accept:"image/*",title:io.mediaLibrary})}}:null,nd={value:qs.find(e=>!0===e.active)?.id??"",press:e=>{const n=qs.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:qs.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */st("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},td=[...hr.railLead??[],...hr.railTrail??[]].find(e=>"panel"in e&&e.id===fr),od=Boolean(Qt?.foldable),rd=Qt?.label??(Mt?_t.pageSections:_t.templateSections),id=od&&Vr(kt),ld=/* @__PURE__ */dt(at,{children:[hi.map((e,n)=>{if(Xt(e)||Kt(e)||Ut(e.type))return null;const t=or===String(e.props.id),o=Boolean(e.props._hidden);Sl(e);const r=String(e.props.id),i=hr.hasOwnRows?.(e)??!1,l=Nl(e)||i,s=l&&Vr(r),d=bl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...dn(a),index:Mi(a).length}:void 0,p=us.dragging,u=c&&p&&rs(p,c)?c:void 0,{rowProps:h,...f}=us.row({item:{id:r,zone:zn,index:n,type:e.type},place:{...dn(zn),index:n},into:u,canDrag:!gr(e.type,e)},{"data-node-id":r,onClick:ul(()=>ol(n))});/* @__PURE__ */
|
|
29
|
-
return dt(Fn,{children:[n>0&&vl(n),
|
|
30
|
-
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(zr,{type:e.type,size:13}),name:Bi(e),preview:fl(e),marks:ml(e),shared:Vl(e),onSelect:()=>ol(n),nameSlot:Ji(zn,n,r,Bi(e)),selected:t,hidden:o,...f,fold:l?{open:!s,label:"section",onToggle:()=>Wr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[hl(zn,n,Bi(e)),gl(e,zn,n),yl(zn,n,e,Bi(e))]}),rowProps:h}),Nl(e)&&!s&&/* @__PURE__ */dt(Oe,{children:[Zs(e,1),hr.partRows?.(e,Gs)]}),i&&!s&&/* @__PURE__ */st(Oe,{children:hr.ownRows?.(e,n,Gs)})]},String(e.props.id??n))}),Kl>0&&vl(Kl)]}),sd=(e,n,t)=>{const o=String(e.props.id),r=xl(e).length>0||zl(e)||Boolean(br(e.type)),i=r&&Vr(o),l="header"===t?_t.header:_t.footer,s=wr.rowName?wr.rowName(e,"section",l):l;/* @__PURE__ */
|
|
31
|
-
return dt(at,{children:[
|
|
32
|
-
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(zr,{type:t,size:13}),name:s,preview:fl(e),marks:ml(e),badge:Vl(e)?void 0:Gl,shared:Vl(e),onSelect:()=>ol(n),nameSlot:Ji(zn,n,o,s),selected:or===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Wr(o)}:void 0,actions:gl(e,zn,n)??void 0,rowProps:{"data-node-id":o,onClick:ul(()=>ol(n))}}),r&&!i&&/* @__PURE__ */st(Oe,{children:Ks(e,1)})]})};return(hr.wrap??(e=>e))(
|
|
33
|
-
/* @__PURE__ */st(Q,{target:Do,children:/* @__PURE__ */dt("div",{ref:Fo,className:"sf-editor es-editor",style:Ue(Er),onContextMenu:Qi.onEditorContextMenu,...u(un),children:[
|
|
34
|
-
/* @__PURE__ */dt(Te,{children:[
|
|
35
|
-
/* @__PURE__ */dt("div",{className:"es-cluster es-cluster--left",children:[ed?/* @__PURE__ */st(Vn,{variant:ed.pressed?"primary":"secondary",className:"es-barbtn","aria-pressed":ed.pressed,leftIcon:/* @__PURE__ */st(ge,{}),onClick:ed.onPress,children:_t.railMedia}):null,
|
|
36
|
-
/* @__PURE__ */st(Ee,{label:_t.bar.undo,disabled:Boolean(It)||!Tt.hasPast,onClick:()=>Tt.back(),children:/* @__PURE__ */st(_n,{})}),
|
|
37
|
-
/* @__PURE__ */st(Ee,{label:_t.bar.redo,disabled:Boolean(It)||!Tt.hasFuture,onClick:()=>Tt.forward(),children:/* @__PURE__ */st(qn,{})})]}),
|
|
38
|
-
/* @__PURE__ */dt(Re,{children:[
|
|
39
|
-
/* @__PURE__ */st(Fe,{devices:vo,value:xo,onChange:zo}),
|
|
40
|
-
/* @__PURE__ */st(Ee,{label:_t.bar.refresh,tip:_t.bar.refreshTip,onClick:()=>{Ro.current=(()=>{const e=Do?.document;if(!e)return null;const n=hi.findIndex(Kt),t=n>=0?n:hi.length;let o=null;for(let n=0;n<t;n++){const t=hi[n]?.props?.id;if(null==t)continue;const r=Mn(e,`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Et?.props?.id??hi[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Eo(e=>e+1)},children:/* @__PURE__ */st(et,{})}),hr.barView?.()]}),
|
|
41
|
-
/* @__PURE__ */dt(Re,{kind:"right",style:{minWidth:300},children:[
|
|
42
|
-
/* @__PURE__ */st(k,{input:Jo,words:_t.saveStatus}),yn?/* @__PURE__ */st(yn,{}):null,hr.barLead?.(),hr.barTrail?.(),hr.mainAction||!hr.barMain?/* @__PURE__ */st(b,{input:Jo,action:hr.mainAction??{label:_t.done,onPress:()=>{Kn(At.data)}},readOnly:Boolean(It),saveSwitch:Bt,onToggleAutoSave:xt,onSaveNow:Go,bar:_t.bar,words:_t.saveStatus}):hr.barMain()]})]}),
|
|
43
|
-
/* @__PURE__ */st(re,{}),
|
|
44
|
-
/* @__PURE__ */dt("div",{className:"sf-body",children:[go?/* @__PURE__ */dt(at,{children:[
|
|
45
|
-
/* @__PURE__ */dt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":_t.leftPanel,children:[
|
|
46
|
-
/* @__PURE__ */dt("div",{className:"es-paneltabs es-paneltabs--with-hide",children:[
|
|
47
|
-
/* @__PURE__ */st(O,{side:"left",onHide:di}),
|
|
48
|
-
/* @__PURE__ */st("span",{className:"es-paneltabs-divider","aria-hidden":"true"}),
|
|
49
|
-
/* @__PURE__ */st(Wn,{variant:"underline",block:!0,"aria-label":_t.bar.views,value:nd.value,onChange:nd.press,items:nd.items})]}),Yo?/* @__PURE__ */st(x,{at:Zo?{label:(e=>{const n=ts(e.zone);if(n)return _t.add.addingTo({name:wr.rowName?pl(n,!0):Oi(n.type)});if(e.zone===zn){const n=hi[e.index];return n&&!Kt(n)?_t.add.addingBefore({name:pl(n,!0)}):_t.add.addingAtEnd}const t=ls(e.zone);return t?_t.add.addingTo({name:t.parentName}):_t.add.addingHere})(Zo),onClear:()=>Qo(null)}:void 0,placeBlocks:Zo&&Zo.zone!==zn?ls(Zo.zone)?.choices:void 0,canTake:Zo?e=>{if(!Zo)return null;const n={...dn(Zo.zone),index:Zo.index};if(ds(e,n))return null;if("shared"===e.kind&&Zo.zone===zn&&!Dt.shared?.nodeOf(e.section))return _t.shared.alreadyHere;const t=ts(Zo.zone);if(t)return _t.add.notInside({name:pl(t,!0)});if(Zo.zone===zn)return _t.add.onlySections;const o=ls(Zo.zone);return o?_t.add.notInside({name:o.parentName}):_t.add.onlySections}:void 0,onPick:Zo?e=>{if(!Zo)return;const n={...dn(Zo.zone),index:Zo.index};ds(e,n)&&(as(e,n),cl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:ps,siteWide:hr.addPanelRow?.(cl),onClose:cl,readOnly:Boolean(It)}):td?td.panel({onHide:di,notify:Yr}):/* @__PURE__ */dt(at,{children:[
|
|
50
|
-
/* @__PURE__ */st(I,{icon:/* @__PURE__ */st(me,{}),title:_t.layers,context:lo,actions:/* @__PURE__ */dt(at,{children:[!It&&/* @__PURE__ */st(De,{label:_t.add.title,onClick:()=>dl(null),children:/* @__PURE__ */st(nt,{size:15})}),
|
|
51
|
-
/* @__PURE__ */st(De,{label:Ql?_t.expandAll:_t.collapseAll,title:0===Zl.length?_t.nothingToFold:void 0,disabled:0===Zl.length,onClick:()=>Tr(e=>{const n=new Set(Zl);return Ql?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Zl])}),children:/* @__PURE__ */st(mt,{expand:Ql})})]})}),
|
|
52
|
-
/* @__PURE__ */dt(Ie,{className:"sf-tree sf-scroll",words:qt,children:[
|
|
53
|
-
/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(zr,{type:"page",size:13}),name:_t.pageSettings,onSelect:pi,selected:!Et&&tr,rowProps:{onClick:ul(pi)}}),Yl&&/* @__PURE__ */dt(at,{children:[!Dl&&/* @__PURE__ */st(Ne,{children:_t.header}),Ys(Yl)]}),jt&&!(Dl&&Yl)&&/* @__PURE__ */dt(at,{children:[!Dl&&/* @__PURE__ */st(Ne,{children:_t.header}),!Zt&&/* @__PURE__ */st(Ce,{words:qt,icon:/* @__PURE__ */st(zr,{type:"header",size:13}),name:_t.header,badge:Jl?void 0:Gl,shared:Jl,onSelect:ui,selected:er.kind===Yt?.kind,rowProps:{onClick:ul(ui)}})]}),El&&!(Dl&&Yl)&&sd(El,Tl,"header"),!od&&/* @__PURE__ */st(Ne,{children:rd}),od?/* @__PURE__ */dt(at,{children:[
|
|
54
|
-
/* @__PURE__ */st(Ce,{words:qt,icon:null,name:rd,fold:{open:!id,label:rd,onToggle:()=>Wr(kt)}}),!id&&/* @__PURE__ */st(Oe,{children:ld})]}):ld,jt&&!Dl&&/* @__PURE__ */st(Ne,{children:_t.footer}),Ll&&!(Dl&&Xl)&&sd(Ll,Al,"footer"),Xl&&Ys(Xl),hr.treeFoot?.()]})]})]}),
|
|
55
|
-
/* @__PURE__ */st(He,{side:"left",width:Er.left,min:We.left,max:Ve,defaultWidth:m.left,label:_t.resizeLeftPanel,onResize:Dr})]}):/* @__PURE__ */st(N,{side:"left",onShow:di}),
|
|
56
|
-
/* @__PURE__ */dt("div",{ref:Xr,className:"sf-center sf-scroll","data-sf-canvas-head":qr?"":void 0,style:{overflowX:ii?"auto":"hidden",overflowY:"hidden"},children:[qr&&/* @__PURE__ */st("div",{ref:ei,className:"sf-canvas-head",children:/* @__PURE__ */st(qr,{device:xo})}),
|
|
57
|
-
/* @__PURE__ */dt("div",{className:"sf-frame-scaler",style:li,children:[
|
|
58
|
-
/* @__PURE__ */st("div",{className:"sf-frame "+(xo===So?"":`sf-frame--${xo}`),style:si,children:/* @__PURE__ */dt("div",{className:"sf-preview-host",children:[
|
|
59
|
-
/* @__PURE__ */st(xe.Provider,{value:Fl,children:/* @__PURE__ */st(ze.Provider,{value:Ul,children:/* @__PURE__ */st(so,{},To)})}),
|
|
60
|
-
/* @__PURE__ */st(_e,{canvas:Do,session:ps,model:Ns,measure:Ps,canDrop:Ms,onDrop:As,choose:ms,onPick:Ts,dropOn:Es?{accepts:(e,n)=>{if(!e.media||!Es||n.item.rung)return!1;const t=an(At.data,mi,n.item.id);return null!==t&&Es.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ds();n&&Es&&Vs(n).then(n=>{n&&Ws(n,e.item.id)})})(n),label:()=>_t.canvasReplaceImage}:void 0,onZoneAdd:Us,onSeamAdd:Us,zoneAddLabel:_t.canvasAddBlock,words:eo.canvas,readOnly:Boolean(It),revision:At.data}),_o.length>0&&!Ho&&/* @__PURE__ */st("div",{className:"sf-preview-gaps",children:_o.map(e=>
|
|
61
|
-
/* @__PURE__ */st(qe,{index:e.index,label:_t.addSectionHere,onInsert:()=>dl(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),vs?/* @__PURE__ */st(ft,{canvas:Do,tabs:Ss,onSelect:e=>{const n=hi.findIndex(n=>String(n.props.id)===e);n>=0&&ol(n)}}):null]})]}),yo?/* @__PURE__ */dt(at,{children:[vn?
|
|
62
|
-
/* @__PURE__ */st("div",{className:"es-sidepanel es-sidepanel--right","data-es-host-panel":"",children:vn}):/* @__PURE__ */st(at,{children:/* @__PURE__ */st(h,{value:{selectChild:Pl,addChild:$l,childRowName:Wi,blockRowName:_l},children:/* @__PURE__ */st(ao,{mode:er,onOpenWebsiteSettings:hr.openSettings??(()=>{}),onOpenSiteStyles:hr.openStyles,onSelectNode:Nr,onNotify:Yr,onHidePanel:ai,nodeActions:Et?Cn(Ft,Et.type):bt})})}),
|
|
63
|
-
/* @__PURE__ */st(He,{side:"right",width:Er.right,min:We.right,max:Ve,defaultWidth:m.right,label:_t.resizeSettingsPanel,onResize:Hr})]}):
|
|
64
|
-
/* @__PURE__ */st(N,{side:"right",onShow:ai})]}),Qi.menu,
|
|
65
|
-
/* @__PURE__ */st(ne,{}),Si?/* @__PURE__ */st(pt,{name:Si.name,onMake:e=>(async(e,n)=>{const t=hi.find(n=>String(n.props.id)===e),o=Dt.shared;if(!t||!o)return;let r;try{r=await C(bi).create(n,t)}catch{return void Yr(_t.shared.makeFailed,"error")}o.adopt(t,r),wi(null)})(Si.id,e),onCancel:()=>wi(null)}):null]})}))}export{wt as ScreenChrome};
|
package/dist/chunk-FGJTX2DL.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as n}from"./chunk-PA3PNTVV.js";import{blockTypesIn as o}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as l}from"./chunk-BVN33R76.js";import{sharedSectionsOf as r}from"./chunk-43AEUUNQ.js";import{SidePanelHead as i,PanelModeExit as s}from"./chunk-SINAM2IT.js";import{blockRuns as c}from"./chunk-M2Z775ZC.js";import{useScreenBlockLook as a,useScreenBlockRules as d,useScreenPinned as p}from"./chunk-PAOZMXEI.js";import{useEaselSession as m}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as f}from"./chunk-23DYNW6S.js";import{useEasel as u}from"./chunk-EFHV56BO.js";import{easelMenuEntries as y}from"./chunk-FIVU2COQ.js";import{useWords as h}from"./chunk-MFIRYGHW.js";import{AddPanel as k}from"./chunk-H2PRGXCW.js";import{DEFAULT_DRAG_WORDS as g}from"./chunk-KAML3KQH.js";import{useState as b,useEffect as v,useMemo as j,useRef as C}from"react";import{SharedIcon as w,AddIcon as O}from"efficient-shell/icons/efficient";import{ContextMenu as A,toast as E,Dialog as I,Button as M}from"efficient-shell/ui";import{jsx as T,jsxs as $,Fragment as x}from"react/jsx-runtime";function F({name:e,pages:t,onDelete:n,onCancel:o}){const l=h("screen",f).shared,[r,i]=b(!1),s=C(null);/* @__PURE__ */
|
|
2
|
-
return T(I,{open:!0,role:"alertdialog",size:"sm",title:l.deleteTitle({name:e}),onClose:o,initialFocus:s,footer:/* @__PURE__ */$(x,{children:[
|
|
3
|
-
/* @__PURE__ */T(M,{ref:s,variant:"secondary",onClick:o,children:l.cancel}),
|
|
4
|
-
/* @__PURE__ */T(M,{variant:"danger",loading:r,onClick:()=>{(async()=>{i(!0);try{await n()}finally{i(!1)}})()},children:l.deleteShared})]}),children:l.deleteMessage({count:t})})}var N=e=>`section:${e}`,B=e=>`block:${e}`,D=e=>`template:${e}`,H=e=>`shared:${e}`;function P({at:C,placeBlocks:I,canTake:M,onPick:P,itemFor:S,session:L,siteWide:V,onClose:W,onHide:z,readOnly:Q}){const R=u(e=>e.config),Z=a(),{labelAtLevel:K,categoryLabel:U,firstSection:Y,Icon:G,Thumbnail:X}=Z,{blockIsOffered:_,canAddTo:J}=d(),q=h("screen",f).add,ee=h("drag",g).add,te=m(),[ne,oe]=b([]);v(()=>{let e=!1;const t=e=>_(e,te);return l(te).list().then(n=>{if(e)return;const l=R.components;oe(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[R,te]);const le=p().shared,re=h("screen",f).shared,[ie,se]=b([]),[ce,ae]=b(0);v(()=>{if(!le)return;let e=!1;const t=e=>_(e,te);return r(te).list().then(n=>{if(e)return;const l=R.components;se(n.filter(e=>e.node?.type&&l[e.node.type]&&o(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[R,te,ce]);const[de,pe]=b(null),[me,fe]=b(null),ue=j(()=>e(R,Z),[R]),ye=e=>K(e,"section",R.components[e]?.label??e),he=e=>({type:N(e.type),label:e.name,cover:/* @__PURE__ */T(X,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:q.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),ke=e=>{const t=e.indexOf(":"),n=e.slice(0,t),o=e.slice(t+1);if("section"===n)return{kind:"section",type:o};if("block"===n)return{kind:"block",type:o};if("template"===n){const e=ne.find(e=>e.id===o);return e?{kind:"template",template:e}:null}if("shared"===n){const e=ie.find(e=>e.id===o);return e?{kind:"shared",section:e}:null}return null},ge=e=>/* @__PURE__ */T("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */T(G,{type:e,size:26})}),be=j(()=>{const e=t(ue,Y),o=/* @__PURE__ */new Map,l=e=>{e.retired||o.has(e.type)||!_(e.type,te)||o.set(e.type,e)};for(const t of e?[e]:ue){const e=J(t.type)?.choices??[];e.forEach(l),e.forEach(e=>J(e.type,1)?.choices?.forEach(l))}I?.forEach(l);const r=new Set(ue.map(e=>e.type)),i=[...o.values()].filter(e=>!r.has(e.type)),s=e=>({type:B(e.type),label:e.label,cover:ge(e.type),title:q.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>o.has(e.type)?{...he(e),cover:ge(e.type)}:he(e),d=[];ie.length>0&&d.push({key:"shared",title:re.group,tiles:ie.map(e=>({type:H(e.id),label:e.title,cover:/* @__PURE__ */T(X,{type:e.node.type}),mark:/* @__PURE__ */T(w,{size:12}),title:re.onPages({count:e.used_on.length}),keywords:[ye(e.node.type),e.node.type]}))}),ne.length>0&&d.push({key:"templates",title:q.templates,tiles:ne.map(e=>({type:D(e.id),label:e.name,cover:/* @__PURE__ */T(X,{type:e.node.type}),keywords:[ye(e.node.type),e.node.type]}))});const p=i.filter(e=>!e.group);let m=!1;for(const t of Object.keys(R.categories??{})){const o=ue.filter(e=>e.cat===t);if(0===o.length)continue;const l=e&&o.some(t=>t.type===e.type)?e:null,r=(l?[l,...o.filter(e=>e.type!==l.type)]:o).map(a);l&&!m&&(r.splice(1,0,...p.map(s)),m=!0),d.push({key:`category:${t}`,title:n(R,t,U),tiles:r})}const f=d.find(e=>e.key?.startsWith("category:"));if(!m&&f&&p.length>0&&(f.tiles=[...f.tiles,...p.map(s)],m=!0),c(i.filter(e=>e.group||!m)).forEach((e,t)=>{d.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(s)})}),!M)return d;const u=d.map(e=>({...e,tiles:e.tiles.map(e=>{const t=ke(e.type),n=t?M(t):null;return n?{...e,disabled:!0,disabledReason:n}:e})})),y=e=>e.tiles.some(e=>!e.disabled);return[...u.filter(y),...u.filter(e=>!y(e))]},[ne,ie,re,ue,R,q,M,I,te]);/* @__PURE__ */
|
|
5
|
-
return $(x,{children:[
|
|
6
|
-
/* @__PURE__ */T(i,{icon:/* @__PURE__ */T(O,{size:15}),title:q.title,context:q.contextAll,actions:/* @__PURE__ */T(s,{label:q.done,description:q.doneDescription,onClick:W}),onHide:z}),
|
|
7
|
-
/* @__PURE__ */$("div",{className:"sf-addside sf-scroll",children:[
|
|
8
|
-
/* @__PURE__ */T(k,{groups:be,session:L,itemFor:e=>S(ke(e)??{kind:"section",type:e}),onInsert:P?e=>{const t=ke(e);t&&P(t)}:void 0,onTileMenu:(e,t)=>{const n=ke(e);return"shared"===n?.kind&&!Q&&(pe({section:n.section,...t}),!0)},at:C,hint:q.hint,searchLabel:q.search,readOnly:Q,words:ee}),V??null]}),de?/* @__PURE__ */T(A,{at:{x:de.x,y:de.y},owner:de.owner,onClose:()=>pe(null),"aria-label":de.section.title,items:y([{label:re.deleteShared,danger:!0,onClick:()=>{fe(de.section),pe(null)}}])}):null,me?/* @__PURE__ */T(F,{name:me.title,pages:me.used_on.length,onDelete:()=>(async e=>{try{await r(te).remove(e.id)}catch{return void E.error(re.deleteFailed)}fe(null),le?.removed?.(e),se(t=>t.filter(t=>t.id!==e.id)),ae(e=>e+1)})(me),onCancel:()=>fe(null)}):null]})}export{P as AddSidePanel,B as blockKey,N as sectionKey,H as sharedKey,D as templateKey};
|