efficient-easel 13.3.0 → 14.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/{canvas-typing-CC0wA-ys.d.ts → canvas-typing-BsNigaCa.d.ts} +1 -1
- package/dist/chrome/chrome.css +23 -21
- package/dist/{chunk-FVBRWKMP.js → chunk-3DCI44F3.js} +4 -4
- package/dist/{chunk-UU2WKWIA.js → chunk-44QA42OJ.js} +1 -1
- package/dist/{chunk-33C6ALT5.js → chunk-B4JN227A.js} +1 -1
- package/dist/chunk-CMXK3JT3.js +1 -0
- package/dist/chunk-CSGTPJTY.js +5 -0
- package/dist/{chunk-4EI6UGGH.js → chunk-CY52PUMZ.js} +1 -1
- package/dist/chunk-D46OYLJR.js +5 -0
- package/dist/{chunk-ZTJU4SGV.js → chunk-F3A7SXSV.js} +1 -1
- package/dist/chunk-F6NO7B57.js +57 -0
- package/dist/{chunk-PVAIOBBE.js → chunk-LPM2SCM4.js} +8 -8
- package/dist/{chunk-VRMUSWKL.js → chunk-TR4APEJZ.js} +1 -1
- package/dist/{chunk-YAFVODLX.js → chunk-XGW6NWLC.js} +1 -1
- package/dist/{chunk-3BP4XJVF.js → chunk-YKJ3RIMT.js} +1 -1
- package/dist/copy/index.d.ts +5 -6
- package/dist/copy/index.js +15 -15
- package/dist/easel/index.d.ts +3 -3
- package/dist/easel/index.js +1 -1
- package/dist/fields/index.d.ts +2 -2
- package/dist/screen/components/AddBlockRow.js +1 -1
- package/dist/screen/components/AddSidePanel.js +1 -1
- package/dist/screen/components/MediaSidePanel.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 +16 -16
- package/dist/screen/components/usePartBridge.js +1 -1
- package/dist/screen/index.js +1 -1
- package/dist/screen/lib/key-scope.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/screen/screen.css +1 -1
- package/dist/strings/catalogue.d.ts +1 -1
- package/dist/strings/catalogue.js +1 -1
- package/dist/strings/index.d.ts +1 -1
- package/dist/strings/index.js +1 -1
- package/dist/{types-URH28nku.d.ts → types-CDX6vd6A.d.ts} +1 -1
- package/dist/{words-CiuKuiy0.d.ts → words-D-yhjdOg.d.ts} +1 -10
- package/package.json +1 -1
- package/dist/chunk-44ACS7DZ.js +0 -1
- package/dist/chunk-O5HIBDDA.js +0 -5
- package/dist/chunk-TJHS4V2T.js +0 -57
- package/dist/chunk-VNIXR4UI.js +0 -5
package/dist/chunk-44ACS7DZ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{useSectionOps as o}from"./chunk-VRMUSWKL.js";import{SELECTION_MODE as e}from"./chunk-O5HIBDDA.js";import{usePreviewParts as r}from"./chunk-I54UCYOU.js";import{decodePartId as t,encodePartId as n}from"./chunk-IYT6NN2J.js";import{useEasel as p}from"./chunk-PVAIOBBE.js";import{useCallback as d,useEffect as c}from"react";var s=o=>"part"===o.kind;function m({mode:m,setMode:i,onOpenPart:I}){const{getSelectorForId:a}=p(o=>o),u=o(),{setSelectedPartId:f,setSelectHandler:k}=r(),l=d(o=>{const r=t(o);if(!r)return;const{nodeId:n,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===n&&o.propKey===p?o:{kind:"part",nodeId:n,propKey:p}),I?.(n)):i(o=>"part"===o.kind?e:o)},[i,I]);c(()=>{k(l)},[k,l]);const h=s(m)?n(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>e);const r=a(o);r&&u.select(r)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
|
package/dist/chunk-O5HIBDDA.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{usePickFollowsSelection as n}from"./chunk-R6WTQWAC.js";import{slotFieldsOf as e}from"./chunk-PLVEGYK6.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-PVAIOBBE.js";import{Inspector as i}from"./chunk-SO5OLDH7.js";import{createContext as o,useContext as u}from"react";import{DesktopIcon as l}from"efficient-shell/icons/efficient";import{jsx as s}from"react/jsx-runtime";var c={kind:"puck"};function f(n,e){const t=n,r=e,i=Object.keys(t);return i.length===Object.keys(r).length&&i.every(n=>Object.is(t[n],r[n]))}function a(n){const e=n;return"string"==typeof e.nodeId&&"string"==typeof e.slot}function d(n,t,r){const i=n.slotsOf?.(r);return i||e(t,r.type).map(n=>({slot:n,label:n,rung:!1}))}function p(n,e){return n.isFirst?n.isFirst(e):e.type===n.first}function m(n,e){return n.isLast?n.isLast(e):e.type===n.last}var k={},h=()=>k,v=()=>"",g=()=>null,y=()=>{},b={isLockedBlock:()=>!1,duplicateBlocked:()=>null,nestDepth:()=>0,newSectionNode:()=>null,canAddTo:()=>null,blockIsOffered:()=>!0},O={labelAtLevel:(n,e,t)=>t,descriptions:{},categoryLabel:()=>{},firstSection:null,blockRowName:(n,e)=>e(n.type),plainText:n=>n,Icon:()=>null,Thumbnail:()=>null,useProducts:()=>null},L={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},j={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},w={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__PURE__ */
|
|
2
|
-
return s(t,{height:"fill"})}function P(){const{id:n,fields:e,values:t,readOnly:o,onChange:u}=r();/* @__PURE__ */
|
|
3
|
-
return s("div",{className:"es-sidepanel es-sidepanel--right",children:/* @__PURE__ */s(i,{fields:e,values:t,onChange:u,readOnly:o,idPrefix:n})})}var B=o({});function C({parts:n,children:e}){/* @__PURE__ */
|
|
4
|
-
return s(B.Provider,{value:n,children:e})}function D(){return u(B)}function G(){return(D().useOwnerName??v)()}function I(){return(D().useDocumentLabel??g)()}function N(n,e,t,r){return(D().useBridges??h)(n,e,t,r)}function x(n){return(D().useStandaloneBridges??h)(n)}function A(n,e){(D().useDocumentPass??y)(n,e)}function T(){return D().blockRules??b}function F(){return D().blockLook??O}function R(){return D().devices??L}function V(){return D().leftView??j}function E(){return D().pinned??w}function H(){return D().saveSwitch??!0}function K(e){n(!0===D().pickFollowsSelection,e)}function W(){return D().storageNamespace||void 0}function Q(){return D().styleClipboard??null}function Y(){return D().nodeKeys??!0}function Z(){return D().notify??null}function q(){return D().Canvas??S}function z(){return D().CanvasHead??null}function J(){return D().canvasDrag??null}var M=o(null);function U({target:n,children:e}){/* @__PURE__ */
|
|
5
|
-
return s(M.Provider,{value:n,children:e})}function X(){return u(M)}function $(){return D().Inspector??P}export{c as SELECTION_MODE,U as ScreenCanvasTargetProvider,C as ScreenPartsProvider,p as isPinnedFirst,m as isPinnedLast,a as isSlotMode,f as sameInspectorMode,d as screenSlotsOf,F as useScreenBlockLook,T as useScreenBlockRules,N as useScreenBridges,J as useScreenCanvasDrag,q as useScreenCanvasFrame,z as useScreenCanvasHead,X as useScreenCanvasTarget,R as useScreenDevices,I as useScreenDocumentLabel,A as useScreenDocumentPass,$ as useScreenInspectorPanel,V as useScreenLeftView,Y as useScreenNodeKeys,Z as useScreenNotify,G as useScreenOwnerName,D as useScreenParts,K as useScreenPickFollowsSelection,E as useScreenPinned,H as useScreenSaveSwitch,W as useScreenStorageNamespace,Q as useScreenStyleClipboard,x as useStandaloneScreenBridges};
|
package/dist/chunk-TJHS4V2T.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import{styleClipboardOf as e}from"./chunk-XT6DOSHO.js";import{markedTreeNodeId as n,revealSelectedTreeRow as t,sameSelector as o}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as r}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as i}from"./chunk-26OOWIJJ.js";import{ScreenSaveIcon as l,ScreenMainButton as s}from"./chunk-RSKHAHPJ.js";import{useBrowserOffline as d}from"./chunk-RKTF5XLP.js";import{scrollPreviewToSection as c,gotoPreviewSlide as a,scrollPreviewToTop as p}from"./chunk-3Z2MVLCD.js";import{useEaselKeyTarget as u,useEaselUndoKeys as f,useEaselSaveKey as h,editorRootFocus as m}from"./chunk-4EI6UGGH.js";import{SlotChildActionsProvider as g}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as y,DEFAULT_PANEL_W as S,clampPanelWidth as k}from"./chunk-TZIIRGVY.js";import{usePartBridge as v}from"./chunk-44ACS7DZ.js";import{useSectionOps as b}from"./chunk-VRMUSWKL.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-VNIXR4UI.js";import{SidePanelHead as z,PanelShowStrip as C}from"./chunk-62VPYC7F.js";import{MediaSidePanel as I}from"./chunk-UU2WKWIA.js";import{useScreenSaveSwitch as B,useScreenNodeKeys as N,useScreenPinned as O,useScreenDocumentLabel as P,useScreenCanvasFrame as $,useScreenInspectorPanel as M,useScreenDevices as A,useScreenPickFollowsSelection as j,useScreenLeftView as T,SELECTION_MODE as L,sameInspectorMode as R,useScreenBridges as V,useScreenBlockRules as E,useScreenBlockLook as F,useScreenStorageNamespace as W,useScreenNotify as H,useScreenCanvasHead as D,isSlotMode as U,useScreenStyleClipboard as J,useScreenDocumentPass as G,useScreenCanvasDrag as Y,ScreenCanvasTargetProvider as X,isPinnedFirst as K,isPinnedLast as q,screenSlotsOf as Z}from"./chunk-O5HIBDDA.js";import{useNodeClipboard as _,useNodeContextMenu as Q}from"./chunk-NW4LJ4G4.js";import{PageEditGuardNotices as ee}from"./chunk-IWFVVCRN.js";import{useScreenDocument as ne}from"./chunk-FBS75I6E.js";import{requestMediaPick as te}from"./chunk-KG7RJWOK.js";import{useMediaPanel as oe,usePanelPick as re,useCancelPanelPick as ie}from"./chunk-R6WTQWAC.js";import{useEaselSession as le}from"./chunk-O7Q4DDJT.js";import{useEaselHost as se,useHostEscape as de}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as ce}from"./chunk-VVPZMWJE.js";import{heldStyle as ae,styleShortcut as pe}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ue}from"./chunk-6WY6ZXJG.js";import{DEFAULT_NODE_MENU_WORDS as fe}from"./chunk-WK3AFPXY.js";import{rootRowName as he,slotChildRowName as me,slotChildRenameProp as ge,sectionRenameProp as ye}from"./chunk-TBF5CVPA.js";import{ROOT_ZONE as Se,blockNodeActions as ke,TREE_MAX_DEPTH as ve,childSlotsOf as be,slotFieldsOf as we,slotChildrenIn as xe,nestsInTree as ze,newNodeId as Ce}from"./chunk-PLVEGYK6.js";import{useEasel as Ie,useEaselApi as Be,CanvasPassThroughContext as Ne}from"./chunk-PVAIOBBE.js";import{toItemSelector as Oe,useNodeOps as Pe,clickPick as $e}from"./chunk-ECM5F6JJ.js";import{TreeRow as Me,Subtree as Ae,LayersTree as je,TreeGroupLabel as Te,TreeRowAction as Le,TreeSeam as Re}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as Ve}from"./chunk-K56YDHYQ.js";import{LayersIcon as Ee,MediaIcon as Fe}from"./chunk-4VJATVVR.js";import{EaselTopBar as We,TopBarRail as He,TopBarCluster as De,EaselIconButton as Ue,TopBarDivider as Je,DeviceSwitch as Ge,InspectorIconButton as Ye,PanelResizeHandle as Xe,MAX_PANEL_W as Ke,MIN_PANEL_W as qe,panelWidthVars as Ze}from"./chunk-IE55HNMA.js";import{DEFAULT_NOTICE_WORDS as _e,DEFAULT_CHROME_WORDS as Qe}from"./chunk-Z6PVRXVY.js";import{holderOf as en,nameOrSomeone as nn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as tn}from"./chunk-RE4LP46F.js";import{useWords as on}from"./chunk-MFIRYGHW.js";import{insertSeams as rn,CanvasDragLayer as ln,CanvasInsert as sn}from"./chunk-QFVRMARS.js";import{DEFAULT_DRAG_WORDS as dn}from"./chunk-AYWN5NRH.js";import{createDragSession as cn,useTreeDrag as an,gapToMoveIndex as pn}from"./chunk-67GNT6PF.js";import{useCanvasFrame as un,LIST_SELECTOR as fn,BLOCK_SELECTOR as hn,useCanvasEvent as mn,nodeIdAt as gn,frameRectToHost as yn,BLOCK_ATTRIBUTE as Sn,drawnBox as kn}from"./chunk-ILXP5VX5.js";import{ROOT_ID as vn,ROOT_SLOT as bn,zoneKey as wn,parseZoneKey as xn,find as zn,DataError as Cn}from"./chunk-KRXQM65X.js";import{useRef as In,useMemo as Bn,useState as Nn,useEffect as On,useCallback as Pn,useLayoutEffect as $n,Fragment as Mn}from"react";import{ColoredBadge as An,toast as jn,groupColors as Tn}from"efficient-shell/ui";import{UndoIcon as Ln,RedoIcon as Rn,RefreshIcon as Vn,AddIcon as En,TrashIcon as Fn,EyeOffIcon as Wn,EyeIcon as Hn,DuplicateIcon as Dn}from"efficient-shell/icons/efficient";import{jsx as Un,jsxs as Jn,Fragment as Gn}from"react/jsx-runtime";var Yn=/* @__PURE__ */new WeakSet;function Xn(e,n,t){const o=zn(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function Kn({canvas:e,tabs:n,onSelect:t}){const o=In(null),[r,i]=Nn({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return $n(()=>{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),c={};for(const o of n){const n=t.querySelector(`[${Sn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?kn(n):null;if(!i||0===i.height){c[o.id]=null;continue}const s=yn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),a=s.top+s.height;if(a<d.top||s.top>d.top+d.height){c[o.id]=null;continue}const p=o.below?a+4:Math.max(s.top,d.top)+6;c[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(c)},c=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",c,!0),r.addEventListener("resize",c);const a=new r.MutationObserver(c);return a.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",c,!0),r.removeEventListener("resize",c),a.disconnect()}},[e,l]),/* @__PURE__ */Un("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Un("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:/* @__PURE__ */Un(An,{colorClass:Tn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function qn({expand:e}){/* @__PURE__ */
|
|
2
|
-
return Un("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Jn(Gn,e?{children:[
|
|
3
|
-
/* @__PURE__ */Un("path",{d:"M8 9l4-4 4 4"}),
|
|
4
|
-
/* @__PURE__ */Un("path",{d:"M8 15l4 4 4-4"})]}:{children:[
|
|
5
|
-
/* @__PURE__ */Un("path",{d:"M8 4l4 4 4-4"}),
|
|
6
|
-
/* @__PURE__ */Un("path",{d:"M8 20l4-4 4 4"}),
|
|
7
|
-
/* @__PURE__ */Un("path",{d:"M5 12h14"})]})})}var Zn=`${fn}, ${hn}`;function _n(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 Qn="__rungs";var et="screen:band",nt={duplicate:!0,delete:!0};function tt(){const fn=se(),{target:yn,docId:Sn,capabilities:kn,currentSlug:Tn,siteId:tt,onPublish:ot,saveState:rt,saveConflict:it,retrySave:lt,toggleAutoSave:st,flushSave:dt,access:ct,saveUnreachable:at=!1,readOnly:pt,readOnlyReason:ut=null}=ne(),ft=B(),ht=N(),{mediaEditing:mt,hasEditGuard:gt,hasPinnedChrome:yt}=kn,{appState:St,dispatch:kt,history:vt,selectedItem:bt,getSelectorForId:wt,config:xt}=Ie(e=>e),zt=O(),{first:Ct,firstGroup:It,lastGroup:Bt,isSectionGroup:Nt,sectionGroupZone:Ot,panelOf:Pt}=zt,$t=Pt(Ct),Mt=e=>K(zt,e),At=e=>q(zt,e),jt="node"===zt.firstRow,Tt=zt.band??null,Lt=on("screen",ce),Rt=on("tree",Ve),Vt=on("drag",dn),Et=on("notice",_e),Ft=on("lock",tn),Wt=on("menu",fe),Ht=on("styleClipboard",ue),Dt=on("chrome",Qe),Ut=P()??`/${Tn}`,Jt=$(),Gt=M(),Yt=b({readOnly:pt}),Xt=b({readOnly:pt,foldIntoHistory:!0}),Kt=In(null),qt=Be(),Zt=Bn(()=>({...Yt,select:e=>{Kt.current=e,Yt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=qt.config;Kt.current=Oe(e,t,n)}Yt.commitDocument(e,n)}}),[Yt,qt]),_t=St.ui,Qt=_t.leftSideBarVisible,eo=_t.rightSideBarVisible,{options:no,widths:to,initial:oo,fluid:ro,fit:io}=A(),[lo,so]=Nn(oo),co=oe(),ao=mt&&null!==co,po=re(),uo=ie();j(bt?.props.id);const{read:fo,write:ho,forSelection:mo}=T(),[go,yo]=Nn(fo);On(()=>{ho(go)},[go]);const[So,ko]=Nn(0),vo=In(null),bo=In(null),wo=un(bo,{readySelector:Zn}),xo=u(bo);f(bo,wo);const zo=d(),Co=en(ct),Io={state:rt,offline:zo||rt.failed&&at,readOnlyReason:ut,editing:Co?Et.editing({name:nn(Co.name,Ft),noun:Lt.noun}):null,conflict:null!=it,notSaving:Lt.bar.notSaving},Bo=()=>{pt||(rt.failed?lt():dt())};h(bo,wo,Bo);const[No,Oo]=Nn(!1),Po=In(!1),$o=In(!1),[Mo,Ao]=Nn(null),[jo,To]=Nn([]),[Lo,Ro]=Nn(L),Vo="puck"===Lo.kind,Eo=n(Lo,bt?.props.id),[Fo,Wo]=Nn(null);On(()=>{Fo&&(t(),Wo(null))},[Fo]);const Ho=In(wt);Ho.current=wt;const Do=Pn((e,{scroll:n})=>{yo(n=>mo(e,n)),n&&Wo(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Ho.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&kr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),Uo=In(null);On(()=>{const e=Uo.current;Uo.current=null;const n=null==bt?.props.id?null:String(bt.props.id);Ro(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Pt(bt?.type)??L);const t=bt?.props.id,r=Kt.current;if(Kt.current=null,!t)return;const i=wt(t);Do(String(t),{scroll:!o(r,i??null,Se)})},[bt?.props.id,Do]);const Jo=Pn(e=>{Ro(n=>R(n,e)?n:e),kt({type:"setUi",ui:{rightSideBarVisible:!0}})},[kt]),Go=In(()=>{});Go.current=(e,n)=>{const t=e?ui(e.zone??Se)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==bt?.props.id?null:String(bt.props.id);Ro(e=>R(e,n)?e:n),o!==r&&(Uo.current={id:o,mode:n},Zt.select(e))};const Yo=Pn((e,n)=>Go.current(e,n),[]),Xo={kind:Lo.kind,mode:Lo,open:Jo,show:e=>Ro(e),reveal:()=>{eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Yo},Ko=V(Xo,{data:St.data,selected:bt??null,zoneOf:e=>wt(e)?.zone,readOnly:Boolean(pt),select:e=>{Ro(L),Zt.select({index:e})},replace:(e,n)=>Zt.replaceComponent(Se,e,n),scrollTo:e=>Ri(e)},{device:lo,refreshes:So},{setView:yo,reveal:()=>{Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})}}),qo=Ko.pinnedSource??!1,Zo=Ko.resolveLeftView?Ko.resolveLeftView(go,ao):"media"===go&&ao?go:"sections",_o=E(),{isLockedBlock:Qo,duplicateBlocked:er,nestDepth:nr,newSectionNode:tr,canAddTo:or,blockIsOffered:rr}=_o,ir=F(),{labelAtLevel:lr,Icon:sr,useProducts:dr}=ir,cr=ir.rowName?(e,n,t)=>ir.rowName(e,n,t):void 0,ar=Pn(e=>{kt({type:"setUi",ui:{rightSideBarVisible:!0}}),c(e),Do(e,{scroll:!0})},[kt,Do]),{selectNode:pr,openPartId:ur}=v({mode:Lo,setMode:Ro,onOpenPart:ar}),[fr,hr]=Nn(null);de(null!==fr,()=>hr(null));const mr=y(W()),gr=mr.collapsed,yr=mr.panelWidths,[Sr,kr]=Nn(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(gr);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
|
|
8
|
-
return new Set}});On(()=>{try{window.localStorage.setItem(gr,JSON.stringify([...Sr]))}catch{}},[Sr]);const[vr,br]=Nn(()=>{if("undefined"==typeof window)return{...S};try{const e=window.localStorage.getItem(yr);if(!e)return{...S};const n=JSON.parse(e);return{left:k(Number(n.left)||S.left),right:k(Number(n.right)||S.right)}}catch{return{...S}}});On(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(yr,JSON.stringify(vr))}catch{}},300);return()=>clearTimeout(e)},[vr]);const wr=Pn((e,n)=>br(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),xr=Pn(e=>wr("left",e),[wr]),zr=Pn(e=>wr("right",e),[wr]),Cr=e=>Sr.has(e),Ir=e=>kr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Br=In(!1),Nr=In(null);On(()=>{if(Br.current&&!No){const e=Nr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??bo.current?.querySelector(`button[aria-label="${CSS.escape(Lt.add.title)}"]`))?.focus(),Nr.current=null}Br.current=No},[No]),On(()=>{if(!No||!xo)return;const e=e=>{"Escape"===e.key&&Ji()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[No,xo]),de(No,()=>Ji()),On(()=>{!Qt&&No&&(Oo(!1),Ao(null),Po.current=!1)},[Qt]),On(()=>{if(!po)return $o.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),void($o.current=!1);No&&(Oo(!1),Ao(null),$o.current=Po.current,Po.current=!1),Qt||($o.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},[po]),On(()=>{!Qt&&po&&($o.current=!1,uo())},[Qt]),On(()=>{if(!po||!xo)return;const e=e=>{"Escape"===e.key&&uo()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[po,xo]),de(null!==po,()=>uo());const Or=H(),Pr=(e,n="success",t)=>{if(Or)return void(t?Or(e,"error"===n?"error":"info",t):Or(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?jn.error(e,{...o,duration:t?.duration??3200}):jn.success(e,{...o,duration:t?.duration??1900})},$r=In(null),[Mr,Ar]=Nn(0),[jr,Tr]=Nn(0),Lr=D(),Rr=In(null),Vr=e=>Math.max(0,e.clientHeight-(Rr.current?.offsetHeight??0));On(()=>{const e=$r.current;if(!e)return;const n=()=>{Ar(e.clientWidth),Tr(Vr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Rr.current&&t.observe(Rr.current),()=>t.disconnect()},[]),$n(()=>{$r.current&&(Ar($r.current.clientWidth),Tr(Vr($r.current)))},[vr,Qt,eo]);const Er=lo===ro?Mr>0?Mr:to[ro]:to[lo],Fr=Mr>0?Math.min(Mr/Er,"shrink"===io?1:2):1,Wr=Er*Fr,Hr=Mr>0&&Wr>Mr+1,Dr={width:Wr,height:jr||"100%",flex:"none",position:"relative"},Ur={width:Er,height:jr?jr/Fr:"100%",maxHeight:"none",transform:1!==Fr?`scale(${Fr})`:void 0,transformOrigin:"top left"},Jr=()=>kt({type:"setUi",ui:{leftSideBarVisible:!Qt}}),Gr=()=>kt({type:"setUi",ui:{rightSideBarVisible:!eo}}),Yr=e=>{No&&(Oo(!1),Ao(null),Po.current=!1,Qt&&go===e)||po&&($o.current=!1,uo(),Qt&&go===e)||(Qt&&go===e?Jr():(yo(e),Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Xr=()=>{te(fn,{accept:"image/*",title:Dt.mediaLibrary})},Kr=()=>{Ro(L),Zt.select(null),p()},qr=()=>{Ro($t??L),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},Zr=St.data.content??[],_r=()=>{const e=Zr.findIndex(Mt),n=Zr.findIndex(At);return{floor:e>=0?e+1:0,cap:n>=0?n:Zr.length}},Qr=xt,ei=_o.stripCopy,ni=e=>r(e,ei),ti=_(),oi=Pe({data:St.data,config:Qr,readOnly:Boolean(pt),clipboard:ti,strip:ei?e=>ei(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==vn||e.slot!==bn)return{min:0,max:n-1};const{floor:t,cap:o}=_r();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Ro(L);const t=void 0===n||"node"===n?.kind?n:null;Zt.commitDocument(e,t)}}),ri=e=>{const n=zn(St.data,xt,e);if(!n)return!1;const t=wn(n.place),o=n.node,r=t===Se?ci(o):xi(o);return!!oi.remove(e)&&(Pr(Lt.deleted({name:r}),"success",{duration:8e3,action:{label:Lt.bar.undo,onClick:()=>{oi.restore(n.node,n.place)}}}),!0)},ii={...oi,remove:ri},li=e=>lr(e,"block",xt.components[e]?.label??e),si=Pn(e=>xt.components[e]?.defaultProps??{},[xt]),di=e=>lr(e,"section",li(e)),ci=e=>he({type:e.type,props:e.props??{}},di(e.type),cr),{nodeAddresses:ai,zoneItems:pi}=Bn(()=>{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>=ve)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of be(xt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(Zr,Se,0),{nodeAddresses:e,zoneItems:n}},[Zr,xt]),ui=Pn(e=>pi.get(e)??[],[pi]),fi=e=>{const n=ai.get(e);return n?ui(n.zone)[n.index]:void 0},hi=e=>Z(_o,xt,e),mi=e=>{if(!_o.slotsOf||e===Se)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=fi(e.slice(0,n));if(!t)return null;const o=hi(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}},gi=(()=>{if(!U(Lo))return null;const e=`${Lo.nodeId}:${Lo.slot}`;return mi(e)?.slot.panel===Lo.kind?e:null})(),yi=In(null);On(()=>{const e=yi.current;if(yi.current=null,!gi||!U(Lo))return;const n=Lo.nodeId;Do(n,{scroll:e!==gi}),kr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Lo]);const Si=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=ai.get(e);n&&(n.zone===Se?Vi(n.index):ul(n.zone,n.index,e,fi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&gi!==i&&(yi.current=i),Yo(null,r),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}}),Ri(o)},ki=(e,n,t)=>{const o=`${e}:${n}`;if(kr(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;gi!==o&&(yi.current=o);Yo(null,{kind:t,nodeId:e,slot:n})},vi=(e,n,t)=>{if(pt||!_o.moveSlot)return;const o=fi(e),r=o?hi(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:Qn,index:n},s=pn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=_o.moveSlot(e,n,s);"string"==typeof d&&ki(e,d,i.panel)},bi=dr(),wi=Bn(()=>{const e=/* @__PURE__ */new Map;for(const n of bi??[])e.set(n.slug,n.name);return e},[bi]),xi=e=>me(e,li,ir.plainText,e=>wi.get(e),ir.rowName),zi=(e,n)=>{const t=xt.components[e.type]?.fields,o=n===Se||Al(n)?"section":"block",r=n===Se&&(Mt(e)||At(e)||Nt(e.type)),i="block"===o?ge(t):r?null:ye(t);return ir.renamePropOf?ir.renamePropOf(e,o,i):i},Ci=(e,n,t,o)=>{if(!(!pt&&fr?.zone===e&&fr.index===n))return;const r=(t,o)=>{hr(null),o&&((e,n,t)=>{const o=ui(e)[n];if(!o)return;const r=zi(o,e);r&&Zt.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
|
|
9
|
-
return Un("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Lt.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)},Ii=e(J(),Ht),Bi=Ii.scope({target:yn,siteId:tt,docId:Sn}),Ni=xt,Oi=(e,n)=>n===Se?di(e):li(e),Pi=(e,n,t)=>{const o=Ii.plan(Bi,t,Oi(t.type,e),Ni);o&&(o.changed&&Zt.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Pr(o.message))},$i=Q({nodesIn:ui,nodeAt:(e,n)=>ui(e)[n]??null,labelOf:(e,n)=>n===Se?di(e):li(e),renamePropOf:zi,beginRename:(e,n)=>hr({zone:e,index:n}),history:{hasPast:vt.hasPast,hasFuture:vt.hasFuture,back:()=>vt.back(),forward:()=>vt.forward()},openPageSettings:()=>{Zt.select(null),Ro(L)},pageSettingsLabel:Lt.pageSettings,words:{menu:Wt,styleClipboard:Ht,screen:Lt.menu},readOnly:Boolean(pt),collapseAll:()=>kr(new Set(ui(Se).map(e=>String(e.props.id)))),onPasteRefused:e=>Pr(e?Lt.pasteRefused({name:e.label}):Lt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Ll(e,n),menuRows:Ko.menuRows,isLocked:e=>Qo(e.type),duplicateBlocked:e=>er(St.data,e),permits:e=>ke(xt,e.type),nodeOps:ii,isPinned:(e,n)=>n===Se&&(Mt(e)||At(e)),sectionBand:_r,locate:e=>ai.get(e)??null,rowNameOf:(e,n)=>n===Se?ci(e):xi(e),selectAt:(e,n,t,o)=>{e===Se?Vi(n):ul(e,n,t,o??"")},slotRung:e=>{const n=mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Si(n.node,n.slot,!1)}:null},style:{held:()=>ae(Bi),canCopy:e=>Ii.rows(Ni,e).some(e=>!1!==e.counted),copy:(e,n)=>Ii.copy(Bi,e,Oi(e.type,n),Ni),paste:(e,n,t)=>Pi(e,n,t)},keys:ht?{target:xo,selected:()=>{const e=St.ui.itemSelector;return e?{zone:e.zone??Se,index:e.index}:null},held:()=>ti.get(),readOnly:Boolean(pt),onDone:({done:e,name:n})=>{"copied"===e&&Pr(Lt.copied({name:n}))}}:void 0},wo),Mi=In({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});On(()=>{Mi.current={copy:(e,n)=>Ii.copy(Bi,e,Oi(e.type,n),Ni),paste:Pi,at:()=>{const e=St.ui.itemSelector;if(!e)return null;const n=e.zone??Se,t=ui(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(pt)}});const Ai=Pn(e=>{const n=pe(e);if(!n)return;const t=Mi.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))},[]);On(()=>{if(!xo)return;const e=e=>Ai(e);return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[Ai,xo]),mn(wo,"keydown",Ai);const ji=Zr.map(e=>e.props.id).join("|");On(()=>{const e=wo?.document??null,n=wo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void To(e=>e.length?[]:e);const n=Zr.findIndex(At),t=n>=0?n:Zr.length,o=n=>{const t=Zr[n]?.props?.id;return null==t?null:e.querySelector(`[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=Zr.length>0&&!Mt(Zr[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=_n(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})}To(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()}},[wo,ji,lo,Fr,Qt,eo,bt?.props.id]);const Ti=wo?.document??null,Li=wo?.window??null;On(()=>{const e=vo.current;if(!e||!Ti||!Li)return;const n=[],t=()=>{const n=Ti.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Li.scrollTo({left:Li.scrollX,top:Li.scrollY+t,behavior:"instant"}),!0};return vo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ti,Li]);const Ri=e=>{Ko.holdCanvasOn?Ko.holdCanvasOn(e):c(e)},Vi=e=>{Ro(L),Zt.select({index:e}),Ko.sectionPressed?.(Zr[e]);const n=Zr[e]?.props?.id;n&&Ri(n)},Ei=e=>{const{floor:n,cap:t}=_r(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=bt&&Lo.kind!==$t?.kind?Zr.findIndex(e=>e.props.id===bt.props.id):-1;return o(r>=0?r+1:t)},Fi=(e,n)=>{const{floor:t,cap:o}=_r(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(Zt.reorderComponent(Se,e,i),Zt.select({index:i}),{moved:!0,dest:i})},Wi=(e,n,t,o)=>{Ro(L),Zt.select(o?{index:o.index,zone:o.zone}:{index:e}),c(n),Pr(Lt.sectionAdded({name:t}))},Hi=(e,n)=>{const t=Ei(n),o=tr(e,{nodeDefaults:si,newNodeId:Ce,sectionLabel:di,blockIsOffered:rr}),r=o?Zt.insertNode(Se,t,o):Zt.insertSection(e,t);return Wi(t,r,di(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:c}of be(xt,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=or(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:c,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},Di=e=>Ui(Se,e),Ui=(e,n)=>{Nr.current=document.activeElement??null,po&&(Po.current=$o.current,$o.current=!1,uo()),Ao(null===n?null:{zone:e,index:n}),Oo(!0),Qt||(Po.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Ji=()=>{Oo(!1),Ao(null),Po.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),Po.current=!1},Gi=(e,n)=>ir.rowName?n?Mt(e)?ir.rowName(e,"section",Lt.header):At(e)?ir.rowName(e,"section",Lt.footer):Nt(e.type)?ir.rowName(e,"section",li(e.type)):ci(e):xi(e):n?di(e.type):li(e.type),Yi=e=>n=>{e()},Xi=()=>Ko.editPinnedSource?.(),Ki=(e,n,t)=>{if(pt)return null;const o=ui(e)[n];return o&&!ke(xt,o.type).delete?null:/* @__PURE__ */Un(Le,{kind:"delete",label:Lt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=ui(e)[n]?.props?.id;null!=t&&ri(String(t))})(e,n),children:/* @__PURE__ */Un(Fn,{size:15})})},qi=e=>ir.rowPreview?.(e)||void 0,Zi=e=>ir.rowMarks?.(e)??void 0,_i=(e,n,t)=>ir.rowActions?.(e,n,t)??null,Qi=(e,n,t,o)=>{if(pt)return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
|
|
10
|
-
return Un(Le,{kind:"eye",label:r?Lt.showNamed({name:o}):Lt.hideNamed({name:o}),onClick:()=>nl(e,n,t),children:/* @__PURE__ */Un(r?Wn:Hn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},el=e=>fs(Se,e),nl=(e,n,t)=>{Zt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},tl=e=>we(xt,e),ol=e=>be(xt,e),rl=e=>_o.slotsOf?hi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:xe(e,n.slot)})):[{slot:null,rung:null,kids:ol(e)}],il=e=>_o.slotsOf?rl(e).flatMap(e=>e.kids):ol(e),ll=e=>Boolean(_o.slotsOf)&&hi(e).some(e=>e.rung),sl=(e,n,t)=>null===t?void 0===n?or(e):or(e,n):or(e,n,t),dl=(e,n,t)=>{const o=ze(xt,e.type,n)&&(t||il(e).length>0||ll(e));return{collapsible:o,folded:o&&Cr(String(e.props.id))}},cl=(e,n,t)=>rl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>dl(e,r,t(e.type)).collapsible?[String(e.props.id),...cl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),al=e=>il(e).length>0||ll(e)||Boolean(or(e.type)),pl=e=>Boolean(or(e)),ul=(e,n,t,o)=>{if(Ro(L),or(o)?.spec?.slider){const t=e.split(":")[0];a(t,n),Zt.select({index:n,zone:e}),c(t)}else Zt.select({index:n,zone:e}),Ri(t)},fl=(e,n,t,o,r)=>{const i=`${e}:${n}`;Zt.insertComponent(i,t,o),or(r)?.spec?.slider?requestAnimationFrame(()=>{a(e,o),Zt.select({index:o,zone:i})}):Zt.select({index:o,zone:i})},hl=In(/* @__PURE__ */new Set);On(()=>{Zr.forEach(e=>{const n=or(e.type)?.spec;if(!n)return;const t=e.props.id;if(hl.current.has(t))return;hl.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(si)).forEach((e,t)=>Xt.seedChild(o,t,n.childType,e))})},[Zr,Xt,si]);const ml=In(/* @__PURE__ */new Set);On(()=>{Zr.forEach((e,n)=>{const t=e.props.id;if(ml.current.has(t))return;const o=i(e,tl(e.type));ml.current.add(t),o&&Xt.replaceComponent(Se,n,{...e,props:o})})},[Zr,Xt]),G(Xt,xt);const gl=Zr.findIndex(At),yl=gl>=0?Zr[gl]:null,Sl=jt?Zr.findIndex(Mt):-1,kl=Sl>=0?Zr[Sl]:null,vl=zt.groupTab,bl=Bn(()=>vl?e=>Nt(e.type):void 0,[vl]),wl=Boolean(zt.groupBadge),xl=zt.groupBadge?/* @__PURE__ */Un("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Un(An,{tone:"info",size:"xs",children:zt.groupBadge})}):void 0,zl=Zr.find(e=>e.type===It)??null,Cl=Zr.find(e=>e.type===Bt)??null,Il=gl>=0?gl:Zr.length,Bl=[];Zr.forEach(e=>{At(e)||(al(e)&&Bl.push(String(e.props.id)),Bl.push(...cl(e,1,pl)))}),yl&&(Bl.push(String(yl.props.id)),Bl.push(...cl(yl,1,pl)));const Nl=Bl.length>0&&Bl.every(e=>Sr.has(e)),Ol=e=>{const n=ir.blockRowName(e,li);return ir.rowName?ir.rowName(e,"block",n):n},Pl=(e,n,t,o)=>{const r=ui(e)[t];if(!r)return;const i={...xn(e),index:t},l={...xn(n),index:Math.min(Math.max(o,0),ui(n).length)},s=pn(i,l);if(e!==n||s!==t)try{oi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Cn))throw e}},$l=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of ol(e))n.add(r),t(o)};for(const t of tl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},Ml=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=ai.get(n);if(!e)return null;if(e.zone===Se)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Al=e=>{const n=e.slice(0,e.indexOf(":")),t=Zr.find(e=>Nt(e.type)&&String(e.props.id)===n);return t&&Ot(n)===e?t:null},jl=(e,n)=>{const t=Al(e);return!t||(!zt.groupAccepts||zt.groupAccepts(t.type,n,ui(e).length))},Tl=(e,n,t)=>{if(e.rung){const t=fi(e.rung.nodeId),o=t?hi(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===Qn&&n.index>=0&&n.index<=o}if(n.slot===Qn)return!1;if(e.add)return El(e.add,n);const o=wn(n);if(Nt(e.type))return!1;const r=Al(o),i=Al(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!jl(o,e.type))&&(n.index>=0&&n.index<=ui(o).length));if(e.zone===Se||o===Se){if(e.zone!==o)return!1;const{floor:t,cap:r}=_r();return n.index>=t&&n.index<=r}if(n.index<0||n.index>ui(o).length)return!1;if(e.zone===o)return!0;const l=yl&&!zt.lastIsOpen?String(yl.props.id):null;return(!l||Ml(e.zone)!==l&&Ml(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??ui(e)[t];if(!r)return!1;const i=n.split(":")[0],l=ai.get(i),s=l?ui(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&$l(r).has(n))return!1;const d=or(s.type,nr(St?.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?.(ui(n),r))})(e.zone,o,e.index,t)},Ll=(e,n)=>{const t=wn(e.from),o=e.node;return t===wn(n)?jl(t,o.type):Tl({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Rl=e=>{const n=e.slice(0,e.indexOf(":")),t=ai.get(n),o=t?ui(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=or(o.type,nr(St?.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=r.choices??(r.spec?[{type:r.spec.childType,label:li(r.spec.childType)}]:[]),l=mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:Gi(o,t.zone===Se)}},Vl=(e,n)=>{if("section"!==e.kind)return e;const t=wn(n);return t===Se||Al(t)?e:Rl(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},El=(e,n)=>{const t=Vl(e,n),o=wn(n);if("block"!==t.kind){if(Al(o)){const e="section"===t.kind?t.type:t.template.node.type;return jl(o,e)&&n.index>=0&&n.index<=ui(o).length}if(o!==Se)return!1;const{floor:e,cap:r}=_r();return n.index>=e&&n.index<=r}if(o===Se)return!1;const r=Rl(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(ui(o))},Fl=(e,n)=>{const t=Vl(e,n);if("block"!==t.kind&&Al(wn(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&jl(n,o)){if("section"===e.kind)Zt.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;Zt.insertNode(n,t,ni(e.template.node))}Ro(L),Zt.select({index:t,zone:n})}})(t,wn(n),n.index);if("section"===t.kind)return void Hi(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Ei(t),r=Zt.insertNode(Se,o,n);Wi(o,r,e)})(t.template.name,ni(t.template.node),n.index);const o=wn(n),r=Rl(o);r&&(r.target.spec?fl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{Zt.insertComponent(e,n,t),Ro(L),Zt.select({index:t,zone:e})})(o,t.type,n.index))},Wl=(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n.index):e.add?Fl(e.add,n):e.zone===Se?Fi(e.index,n.index):Pl(e.zone,wn(n),e.index,n.index)},[Hl]=Nn(()=>cn()),Dl=an({keyOf:e=>e.id,readOnly:Boolean(pt),session:Hl,canDrop:Tl,onDrop:Wl,onStep:(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===Se?((e,n)=>{const t=di(Zr[e]?.type??""),o=Fi(e,n<0?e-1:e+2);if(!o.moved)return void Pr(n<0?Lt.sectionFirst({name:t}):Lt.sectionLast({name:t}));const{floor:r,cap:i}=_r();Pr(Lt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Pl(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),Ul=Pn(e=>{const{floor:n,cap:t}=_r(),o=[];for(const r of e.nodes){const e=wn(r.place),i=ui(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Mt(i)||At(i)||Qo(i.type))continue;if(Nt(i.type))continue;const l=Boolean(Al(e)),s=e===Se||l;e===Se&&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?di(i.type):xi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=wn(e.list);if(n===Se&&0===e.children.length)return[{...e,addLabel:Lt.addSection,addAlways:!0}];const t=Rl(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Al(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=wn(e.list),t=n===Se||Al(n)?null:Rl(n);return t?.choices.length?rn(e,t.target.spec?.addLabel??Lt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[St.data]),Jl=null==bt?.props.id?null:String(bt.props.id),Gl=Pn(e=>{const n=xt,t=e=>!e.item.rung&&null!==zn(St.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(Jl);return i||(r($e(St.data,n,o.item.id,Jl,bl))??o)},[St.data,xt,Jl,bl]),[Yl,Xl]=Nn(null);mn(wo,"mouseover",e=>{if(!vl)return;const n=gn(e.target),t=n?Xn(St.data,xt,n):null;t!==Yl&&Xl(t)}),mn(wo,"mouseout",e=>{vl&&!e.relatedTarget&&Xl(null)});const Kl=e=>Mt(e)||At(e)||Nt(e.type),ql=[];if(vl){const e=Jl?Xn(St.data,xt,Jl):null;for(const n of/* @__PURE__ */new Set([e,Yl])){const e=n?Zr.find(e=>String(e.props.id)===n):void 0;if(!e||!Kl(e))continue;const t=vl(e);t&&ql.push({id:String(e.props.id),label:t,below:Mt(e)||e.type===It})}}const Zl=le(),_l=In(null);On(()=>{const e=zt.changeNotice;if(!e)return;const n=JSON.stringify(Zr.filter(Kl)),t=_l.current;if(_l.current={doc:Sn,bands:n,index:vt.index},!t||t.doc!==Sn||t.bands===n)return;vt.hasPast&&vt.index>=t.index&&!Yn.has(Zl)&&(Yn.add(Zl),Pr(e,"success",{action:{label:Lt.bar.undo,onClick:()=>vt.back()},duration:8e3}))},[Zr]);const Ql=e=>{Ro(L),Zt.select(e.zone===Se?{index:e.index}:{index:e.index,zone:e.zone})},es=Y(),ns=()=>({data:St.data,device:lo,ops:Zt,inspector:Xo}),ts=es?.model,os=Bn(()=>ts?e=>ts(e,Ul(e),ns()):Ul,[ts,Ul,lo]),rs=es?.measure,is=rs?(e,n)=>rs(e,n,ns()):void 0,ls=es?.canDrop,ss=ls?(e,n)=>ls(e,n,Tl,ns()):Tl,ds=es?.drop,cs=ds?(e,n)=>ds(e,n,Wl,ns()):Wl,as=es?.pick,ps=as?e=>as(e,Ql,ns()):Ql,us=e=>{const n=wn(e),t=mi(n);t&&Si(t.node,t.slot,!1),Ui(n,e.index)},fs=(e,n)=>/* @__PURE__ */Un(Re,{...pt?{}:Dl.seam({place:{...xn(e),index:n}})},`seam:${e}:${n}`),hs={rowClick:Yi,isCollapsed:Cr,toggleCollapse:Ir},ms=e=>{const n=String(e.props.id),t=Zr.findIndex(e=>String(e.props.id)===n),o=Ot(n),r=ui(o),i=Cr(n),l=li(e.type),s=ir.rowName?ir.rowName(e,"section",l):l,d=e=>fs(o,e);/* @__PURE__ */
|
|
11
|
-
return Jn(Gn,{children:[
|
|
12
|
-
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(sr,{type:e.type,size:13}),name:s,preview:qi(e),marks:Zi(e),onSelect:()=>Vi(t),nameSlot:Ci(Se,t,n,s),selected:Eo===n,badge:xl,actions:_i(e,Se,t)??void 0,rowProps:{"data-node-id":n,onClick:Yi(()=>Vi(t))},fold:{open:!i,label:"section",onToggle:()=>Ir(n)}}),!i&&/* @__PURE__ */Jn(Ae,{children:[r.map((n,t)=>{const r=String(n.props.id),i=ci(n),l=al(n),s=l&&Cr(r),c=()=>ul(o,t,r,e.type),{rowProps:a,...p}=Dl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...xn(o),index:t}},{"data-node-id":r,onClick:Yi(c)});/* @__PURE__ */
|
|
13
|
-
return Jn(Mn,{children:[d(t),
|
|
14
|
-
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(sr,{type:n.type,size:13}),name:i,preview:qi(n),marks:Zi(n),onSelect:c,nameSlot:Ci(o,t,r,i),selected:Eo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Ir(r)}:void 0,actions:/* @__PURE__ */Jn(Gn,{children:[Ki(o,t,i),_i(n,o,t),Qi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Un(Ae,{children:Ss(n,2)})]},r)}),d(r.length)]})]})},gs=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=Dl.dragging,d=!Cr(l)&&s?.rung?.nodeId!==i,c={...xn(l),index:0},a=s&&!s.rung&&Tl(s,c)?c:void 0,p=()=>Si(e,n,!0),{rowProps:u,...f}=Dl.row({item:{id:`rung:${l}`,zone:`${i}:${Qn}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:Qn,index:t},into:a,canDrag:Boolean(_o.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:Yi(p)}),h=pt?null:_o.slotActions?.(e,n.slot);/* @__PURE__ */
|
|
15
|
-
return Jn(Mn,{children:[n.heading,
|
|
16
|
-
/* @__PURE__ */Un(Me,{words:Rt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:gi===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Ir(l)},actions:h&&h.length>0?/* @__PURE__ */Un(Gn,{children:h.map((t,o)=>/* @__PURE__ */Un(Le,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(pt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&ki(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__ */Un(Fn,{size:15}):/* @__PURE__ */Un(Dn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Un(Ae,{children:r})]},l)},ys=(e,n)=>{const t=rl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
|
|
17
|
-
return Un(Gn,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=sl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,c=null===t.slot?null:`${e.props.id}:${t.slot}`,a=(e,n)=>fs(e,n),p=/* @__PURE__ */Jn(Gn,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Eo===String(n.props.id),{collapsible:i,folded:s}=dl(n,l,pl(n.type)),d=String(n.props.id),c=Ol(n),p=()=>ul(t,o,d,e.type),{rowProps:u,...f}=Dl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...xn(t),index:o}},{"data-node-id":d,onClick:Yi(p)});/* @__PURE__ */
|
|
18
|
-
return Jn(Mn,{children:[0===o&&a(t,0),
|
|
19
|
-
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(sr,{type:n.type,size:13}),name:c,preview:qi(n),marks:Zi(n),onSelect:p,nameSlot:Ci(t,o,d,c),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Ir(d)}:void 0,actions:/* @__PURE__ */Jn(Gn,{children:[Ki(t,o,c),_i(n,t,o),Qi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Un(Ae,{children:ys(n,l+1)}),a(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===c?d&&!i.some(e=>e.zone===d)?a(d,0):null:0!==i.length||!t.rung&&d!==c?null:a(c,0)]});return t.rung?gs(e,t.rung,r++,o,p):/* @__PURE__ */Un(Mn,{children:p},t.slot??"")})})},Ss=(e,n)=>{const t=nr(St?.data,e.type,String(e.props.id)),o=rl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
|
|
20
|
-
return Un(Gn,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=sl(e.type,t,o.slot),c=d?.spec??null,a=c&&Array.isArray(e.props[c.slot])?e.props[c.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=c&&!c.fixed?`${u}:${c.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>fs(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(c&&!c.fixed&&(null===g||g===f)),S=/* @__PURE__ */Jn(Gn,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Eo===String(n.props.id),i=xi(n),l=String(n.props.id),{collapsible:d,folded:c}=dl(n,s,pl(n.type)),a=tl(n.type),p=1===a.length?`${l}:${a[0]}`:null,u=p?{...xn(p),index:ui(p).length}:void 0,f=Dl.dragging,h=u&&f&&Tl(f,u)?u:void 0,g=()=>ul(t,o,l,e.type),{rowProps:y,...S}=Dl.row({item:{id:l,zone:t,index:o,type:n.type},place:{...xn(t),index:o},into:h,canDrag:!Qo(n.type)},{"data-node-id":l,onClick:Yi(g)});/* @__PURE__ */
|
|
21
|
-
return Jn(Mn,{children:[0===o&&m(t,0),
|
|
22
|
-
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(sr,{type:n.type,size:13}),name:i,preview:qi(n),marks:Zi(n),onSelect:g,nameSlot:Ci(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...S,fold:d?{open:!c,label:"group",onToggle:()=>Ir(l)}:void 0,actions:Qo(n.type)?_i(n,t,o)??void 0:/* @__PURE__ */Jn(Gn,{children:[Ki(t,o,i),_i(n,t,o),Qi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Un(Ae,{children:Ss(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
|
|
23
|
-
/* @__PURE__ */Un(w,{small:!0,label:c.addLabel,blocked:c.addBlocked?.(a)??null,onAdd:()=>fl(e.props.id,c.slot,c.childType,a.length,e.type)}),null===g?h&&!l.some(e=>e.zone===h)?m(h,0):null:0!==l.length||(o.rung?y:g!==h)?null:m(g,0)]});return o.rung?gs(e,o.rung,i++,r,S):/* @__PURE__ */Un(Mn,{children:S},o.slot??"")})})},ks=No||null!==po,vs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:Qt&&!ks&&Zo===e.id,onSelect:()=>Yr(e.id)}:e,bs=[...(Ko.railLead??[]).map(vs),{id:"sections",label:Lt.layers,icon:/* @__PURE__ */Un(Ee,{}),active:Qt&&!ks&&"sections"===Zo,onSelect:()=>Yr("sections")},...(Ko.railTrail??[]).map(vs)];ao?bs.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Un(Fe,{}),active:Qt&&!No&&(null!==po||"media"===Zo),onSelect:()=>Yr("media")}):mt&&bs.push({id:"media",label:Lt.railMedia,icon:/* @__PURE__ */Un(Fe,{}),onSelect:Xr});const ws=[...Ko.railLead??[],...Ko.railTrail??[]].find(e=>"panel"in e&&e.id===Zo),xs=Boolean(Tt?.foldable)&&!qo,zs=Tt?.label??(gt?Lt.pageSections:Lt.templateSections),Cs=xs&&Cr(et),Is=/* @__PURE__ */Jn(Gn,{children:[Zr.map((e,n)=>{if(Mt(e)||At(e)||Nt(e.type))return null;const t=Eo===String(e.props.id),o=Boolean(e.props._hidden);ol(e);const r=String(e.props.id),i=Ko.hasOwnRows?.(e)??!1,l=al(e)||i,s=l&&Cr(r),d=tl(e.type),c=1===d.length?`${r}:${d[0]}`:null,a=c?{...xn(c),index:ui(c).length}:void 0,p=Dl.dragging,u=a&&p&&Tl(p,a)?a:void 0,{rowProps:f,...h}=Dl.row({item:{id:r,zone:Se,index:n,type:e.type},place:{...xn(Se),index:n},into:u},{"data-node-id":r,onClick:Yi(()=>Vi(n))});/* @__PURE__ */
|
|
24
|
-
return Jn(Mn,{children:[n>0&&el(n),
|
|
25
|
-
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(sr,{type:e.type,size:13}),name:ci(e),preview:qi(e),marks:Zi(e),onSelect:()=>Vi(n),nameSlot:Ci(Se,n,r,ci(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Ir(r)}:void 0,actions:/* @__PURE__ */Jn(Gn,{children:[Ki(Se,n,ci(e)),_i(e,Se,n),Qi(Se,n,e,ci(e))]}),rowProps:f}),al(e)&&!s&&/* @__PURE__ */Jn(Ae,{children:[Ss(e,1),Ko.partRows?.(e,hs)]}),i&&!s&&/* @__PURE__ */Un(Ae,{children:Ko.ownRows?.(e,n,hs)})]},String(e.props.id??n))}),!qo&&Il>0&&el(Il)]}),Bs=(e,n,t)=>{const o=String(e.props.id),r=il(e).length>0||ll(e)||Boolean(or(e.type)),i=r&&Cr(o),l="header"===t?Lt.header:Lt.footer,s=ir.rowName?ir.rowName(e,"section",l):l;/* @__PURE__ */
|
|
26
|
-
return Jn(Gn,{children:[
|
|
27
|
-
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(sr,{type:t,size:13}),name:s,preview:qi(e),marks:Zi(e),badge:xl,onSelect:()=>Vi(n),nameSlot:Ci(Se,n,o,s),selected:Eo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Ir(o)}:void 0,actions:_i(e,Se,n)??void 0,rowProps:{"data-node-id":o,onClick:Yi(()=>Vi(n))}}),r&&!i&&/* @__PURE__ */Un(Ae,{children:ys(e,1)})]})};return(Ko.wrap??(e=>e))(
|
|
28
|
-
/* @__PURE__ */Un(X,{target:wo,children:/* @__PURE__ */Jn("div",{ref:bo,className:"sf-editor es-editor",style:Ze(vr),onContextMenu:$i.onEditorContextMenu,...m(fn),children:[
|
|
29
|
-
/* @__PURE__ */Jn(We,{children:[
|
|
30
|
-
/* @__PURE__ */Un(He,{items:bs,ariaLabel:Lt.bar.views}),
|
|
31
|
-
/* @__PURE__ */Jn(De,{children:[
|
|
32
|
-
/* @__PURE__ */Un(Ue,{label:Lt.bar.undo,disabled:Boolean(pt)||!vt.hasPast,onClick:()=>vt.back(),children:/* @__PURE__ */Un(Ln,{})}),
|
|
33
|
-
/* @__PURE__ */Un(Ue,{label:Lt.bar.redo,disabled:Boolean(pt)||!vt.hasFuture,onClick:()=>vt.forward(),children:/* @__PURE__ */Un(Rn,{})}),
|
|
34
|
-
/* @__PURE__ */Un(Je,{}),
|
|
35
|
-
/* @__PURE__ */Un(Ge,{devices:no,value:lo,onChange:so}),
|
|
36
|
-
/* @__PURE__ */Un(Ue,{label:Lt.bar.refresh,tip:Lt.bar.refreshTip,onClick:()=>{vo.current=(()=>{const e=wo?.document;if(!e)return null;const n=Zr.findIndex(At),t=n>=0?n:Zr.length;let o=null;for(let n=0;n<t;n++){const t=Zr[n]?.props?.id;if(null==t)continue;const r=e.querySelector(`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=bt?.props?.id??Zr[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),ko(e=>e+1)},children:/* @__PURE__ */Un(Vn,{})})]}),
|
|
37
|
-
/* @__PURE__ */Jn(De,{kind:"right",style:{minWidth:300},children:[
|
|
38
|
-
/* @__PURE__ */Un(l,{input:Io,words:Lt.saveStatus}),Ko.barLead?.(),Ko.barTrail?.(),Ko.mainAction||!Ko.barMain?/* @__PURE__ */Un(s,{input:Io,action:Ko.mainAction??{label:Lt.done,onPress:()=>{ot(St.data)}},readOnly:Boolean(pt),saveSwitch:ft,onToggleAutoSave:st,onSaveNow:Bo,bar:Lt.bar,words:Lt.saveStatus}):Ko.barMain()]})]}),
|
|
39
|
-
/* @__PURE__ */Un(ee,{}),
|
|
40
|
-
/* @__PURE__ */Jn("div",{className:"sf-body",children:[Qt?/* @__PURE__ */Jn(Gn,{children:[
|
|
41
|
-
/* @__PURE__ */Un("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Lt.leftPanel,children:No?/* @__PURE__ */Un(x,{at:Mo?{label:(e=>{const n=Al(e.zone);if(n)return Lt.add.addingTo({name:ir.rowName?Gi(n,!0):li(n.type)});if(e.zone===Se){const n=Zr[e.index];return n&&!At(n)?Lt.add.addingBefore({name:Gi(n,!0)}):Lt.add.addingAtEnd}const t=Rl(e.zone);return t?Lt.add.addingTo({name:t.parentName}):Lt.add.addingHere})(Mo),onClear:()=>Ao(null)}:void 0,placeBlocks:Mo&&Mo.zone!==Se?Rl(Mo.zone)?.choices:void 0,canTake:Mo?e=>{if(!Mo)return null;const n={...xn(Mo.zone),index:Mo.index};if(El(e,n))return null;const t=Al(Mo.zone);if(t)return Lt.add.notInside({name:Gi(t,!0)});if(Mo.zone===Se)return Lt.add.onlySections;const o=Rl(Mo.zone);return o?Lt.add.notInside({name:o.parentName}):Lt.add.onlySections}:void 0,onPick:Mo?e=>{if(!Mo)return;const n={...xn(Mo.zone),index:Mo.index};El(e,n)&&(Fl(e,n),Ji())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:e.type,add:e}),session:Hl,siteWide:Ko.addPanelRow?.(Ji),onClose:Ji,onHide:Jr,readOnly:Boolean(pt)}):po&&co?
|
|
42
|
-
/* @__PURE__ */Un(I,{panel:co,pick:po,onHide:Jr}):ws?ws.panel({onHide:Jr,notify:Pr}):"media"===Zo&&co?/* @__PURE__ */Un(I,{panel:co,pick:null,onHide:Jr}):/* @__PURE__ */Jn(Gn,{children:[
|
|
43
|
-
/* @__PURE__ */Un(z,{icon:/* @__PURE__ */Un(Ee,{}),title:Lt.layers,context:Ut,actions:/* @__PURE__ */Jn(Gn,{children:[!pt&&/* @__PURE__ */Un(Ye,{label:Lt.add.title,onClick:()=>Di(null),children:/* @__PURE__ */Un(En,{size:15})}),
|
|
44
|
-
/* @__PURE__ */Un(Ye,{label:Nl?Lt.expandAll:Lt.collapseAll,title:0===Bl.length?Lt.nothingToFold:void 0,disabled:0===Bl.length,onClick:()=>kr(e=>{const n=new Set(Bl);return Nl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Bl])}),children:/* @__PURE__ */Un(qn,{expand:Nl})})]}),onHide:Jr}),
|
|
45
|
-
/* @__PURE__ */Jn(je,{className:"sf-tree sf-scroll",words:Rt,children:[
|
|
46
|
-
/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(sr,{type:"page",size:13}),name:Lt.pageSettings,onSelect:Kr,selected:!bt&&Vo,rowProps:{onClick:Yi(Kr)}}),zl&&/* @__PURE__ */Jn(Gn,{children:[!wl&&/* @__PURE__ */Un(Te,{children:Lt.header}),ms(zl)]}),!qo&&yt&&!(wl&&zl)&&/* @__PURE__ */Jn(Gn,{children:[!wl&&/* @__PURE__ */Un(Te,{children:Lt.header}),!jt&&/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(sr,{type:"header",size:13}),name:Lt.header,badge:xl,onSelect:qr,selected:Lo.kind===$t?.kind,rowProps:{onClick:Yi(qr)}})]}),!qo&&kl&&!(wl&&zl)&&Bs(kl,Sl,"header"),!qo&&!xs&&/* @__PURE__ */Un(Te,{children:zs}),xs?/* @__PURE__ */Jn(Gn,{children:[
|
|
47
|
-
/* @__PURE__ */Un(Me,{words:Rt,icon:null,name:zs,fold:{open:!Cs,label:zs,onToggle:()=>Ir(et)}}),!Cs&&/* @__PURE__ */Un(Ae,{children:Is})]}):Is,yt&&!wl&&/* @__PURE__ */Un(Te,{children:Lt.footer}),yl&&!(wl&&Cl)&&Bs(yl,gl,"footer"),!qo&&!yl&&yt&&!wl&&/* @__PURE__ */Un(Me,{words:Rt,icon:/* @__PURE__ */Un(sr,{type:"footer",size:13}),name:Lt.footer,onSelect:Xi,rowProps:{onClick:Yi(Xi),title:Lt.editFooter}}),Cl&&ms(Cl),Ko.treeFoot?.()]})]})}),
|
|
48
|
-
/* @__PURE__ */Un(Xe,{side:"left",width:vr.left,min:qe,max:Ke,defaultWidth:S.left,label:Lt.resizeLeftPanel,onResize:xr})]}):/* @__PURE__ */Un(C,{side:"left",onShow:Jr}),
|
|
49
|
-
/* @__PURE__ */Jn("div",{ref:$r,className:"sf-center sf-scroll","data-sf-canvas-head":Lr?"":void 0,style:{overflowX:Hr?"auto":"hidden",overflowY:"hidden"},children:[Lr&&/* @__PURE__ */Un("div",{ref:Rr,className:"sf-canvas-head",children:/* @__PURE__ */Un(Lr,{device:lo})}),
|
|
50
|
-
/* @__PURE__ */Jn("div",{className:"sf-frame-scaler",style:Dr,children:[
|
|
51
|
-
/* @__PURE__ */Un("div",{className:"sf-frame "+(lo===ro?"":`sf-frame--${lo}`),style:Ur,children:/* @__PURE__ */Jn("div",{className:"sf-preview-host",children:[
|
|
52
|
-
/* @__PURE__ */Un(Ne.Provider,{value:bl,children:/* @__PURE__ */Un(Jt,{},So)}),
|
|
53
|
-
/* @__PURE__ */Un(ln,{canvas:wo,session:Hl,model:os,measure:is,canDrop:ss,onDrop:cs,choose:Gl,onPick:ps,onZoneAdd:us,onSeamAdd:us,zoneAddLabel:Lt.canvasAddBlock,words:Vt.canvas,readOnly:Boolean(pt),revision:St.data}),jo.length>0&&/* @__PURE__ */Un("div",{className:"sf-preview-gaps",children:jo.map(e=>
|
|
54
|
-
/* @__PURE__ */Un(sn,{index:e.index,label:Lt.addSectionHere,onInsert:()=>Di(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))})]})}),vl?/* @__PURE__ */Un(Kn,{canvas:wo,tabs:ql,onSelect:e=>{const n=Zr.findIndex(n=>String(n.props.id)===e);n>=0&&Vi(n)}}):null]})]}),eo?/* @__PURE__ */Jn(Gn,{children:[
|
|
55
|
-
/* @__PURE__ */Un(g,{value:{selectChild:ul,addChild:fl,childRowName:xi,blockRowName:Ol},children:/* @__PURE__ */Un(Gt,{mode:Lo,onOpenWebsiteSettings:Ko.openSettings??(()=>{}),onOpenSiteStyles:Ko.openStyles,onSelectNode:pr,onNotify:Pr,onHidePanel:Gr,nodeActions:bt?ke(xt,bt.type):nt})}),
|
|
56
|
-
/* @__PURE__ */Un(Xe,{side:"right",width:vr.right,min:qe,max:Ke,defaultWidth:S.right,label:Lt.resizeSettingsPanel,onResize:zr})]}):
|
|
57
|
-
/* @__PURE__ */Un(C,{side:"right",onShow:Gr})]}),$i.menu]})}))}export{tt as ScreenChrome};
|
package/dist/chunk-VNIXR4UI.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{sectionTemplatesOf as n}from"./chunk-BVN33R76.js";import{blockTypesIn as s}from"./chunk-5ZBY24K7.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-62VPYC7F.js";import{blockRuns as l}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as c,useScreenBlockRules as a}from"./chunk-O5HIBDDA.js";import{useEaselSession as p}from"./chunk-O7Q4DDJT.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VVPZMWJE.js";import{useEasel as d}from"./chunk-PVAIOBBE.js";import{useWords as f}from"./chunk-MFIRYGHW.js";import{AddPanel as y}from"./chunk-QFVRMARS.js";import{DEFAULT_DRAG_WORDS as h}from"./chunk-AYWN5NRH.js";import{useState as u,useEffect as k,useMemo as b}from"react";import{AddIcon as g}from"efficient-shell/icons/efficient";import{jsx as j,jsxs as v,Fragment as V}from"react/jsx-runtime";var A=e=>`section:${e}`,B=e=>`block:${e}`,O=e=>`template:${e}`;function E({at:E,placeBlocks:I,canTake:R,onPick:$,itemFor:w,session:H,siteWide:N,onClose:P,onHide:x,readOnly:D}){const F=d(e=>e.config),T=c(),{labelAtLevel:W,categoryLabel:C,firstSection:L,Icon:M,Thumbnail:Y}=T,{blockIsOffered:Q,canAddTo:S}=a(),z=f("screen",m).add,J=f("drag",h).add,Z=p(),[G,K]=u([]);k(()=>{let e=!1;const t=e=>Q(e,Z);return n(Z).list().then(o=>{if(e)return;const n=F.components;K(o.filter(e=>e.node?.type&&n[e.node.type]&&s(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[F,Z]);const q=b(()=>e(F,T),[F]),U=e=>({type:A(e.type),label:e.name,cover:/* @__PURE__ */j(Y,{type:e.type}),title:e.desc?`${e.name} — ${e.desc}`:z.tile({name:e.name}),keywords:[e.alias??"",e.desc,e.type,e.catLabel].filter(Boolean)}),X=e=>{const t=e.indexOf(":"),o=e.slice(0,t),n=e.slice(t+1);if("section"===o)return{kind:"section",type:n};if("block"===o)return{kind:"block",type:n};if("template"===o){const e=G.find(e=>e.id===n);return e?{kind:"template",template:e}:null}return null},_=e=>/* @__PURE__ */j("span",{className:"es-add-glyph-cover",children:/* @__PURE__ */j(M,{type:e,size:26})}),ee=b(()=>{const e=t(q,L),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&Q(e.type,Z)&&n.set(e.type,e)};for(const t of e?[e]:q){const e=S(t.type)?.choices??[];e.forEach(s),e.forEach(e=>S(e.type,1)?.choices?.forEach(s))}I?.forEach(s);const i=new Set(q.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),c=e=>({type:B(e.type),label:e.label,cover:_(e.type),title:z.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...U(e),cover:_(e.type)}:U(e),p=[];G.length>0&&p.push({key:"templates",title:z.templates,tiles:G.map(e=>{return{type:O(e.id),label:e.name,cover:/* @__PURE__ */j(Y,{type:e.node.type}),keywords:[(t=e.node.type,W(t,"section",F.components[t]?.label??t)),e.node.type]};var t})});const m=r.filter(e=>!e.group);let d=!1;for(const t of Object.keys(F.categories??{})){const n=q.filter(e=>e.cat===t);if(0===n.length)continue;const s=e&&n.some(t=>t.type===e.type)?e:null,i=(s?[s,...n.filter(e=>e.type!==s.type)]:n).map(a);s&&!d&&(i.splice(1,0,...m.map(c)),d=!0),p.push({key:`category:${t}`,title:o(F,t,C),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(c)],d=!0),l(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(c)})}),!R)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=X(e.type),o=t?R(t):null;return o?{...e,disabled:!0,disabledReason:o}:e})})),h=e=>e.tiles.some(e=>!e.disabled);return[...y.filter(h),...y.filter(e=>!h(e))]},[G,q,F,z,R,I,Z]);/* @__PURE__ */
|
|
2
|
-
return v(V,{children:[
|
|
3
|
-
/* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:z.title,context:z.contextAll,actions:/* @__PURE__ */j(r,{label:z.done,description:z.doneDescription,onClick:P}),onHide:x}),
|
|
4
|
-
/* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
|
|
5
|
-
/* @__PURE__ */j(y,{groups:ee,session:H,itemFor:e=>w(X(e)??{kind:"section",type:e}),onInsert:$?e=>{const t=X(e);t&&$(t)}:void 0,at:E,hint:z.hint,searchLabel:z.search,readOnly:D,words:J}),N??null]})]})}export{E as AddSidePanel,B as blockKey,A as sectionKey,O as templateKey};
|