efficient-easel 11.8.0 → 12.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.
Files changed (67) hide show
  1. package/README.md +24 -0
  2. package/dist/{chunk-4ES5JGGX.js → chunk-3Z2MVLCD.js} +1 -1
  3. package/dist/{chunk-HRUMNRYI.js → chunk-4EI6UGGH.js} +1 -1
  4. package/dist/chunk-5AIA5VIP.js +1 -0
  5. package/dist/chunk-6OA4UXKZ.js +2 -0
  6. package/dist/{chunk-UBAYMWCX.js → chunk-BPZQ7S2Z.js} +12 -12
  7. package/dist/chunk-DWIOHQG7.js +1 -0
  8. package/dist/{chunk-6TJ2CIMY.js → chunk-ENXLPJ77.js} +1 -1
  9. package/dist/chunk-FZ3Y3QTQ.js +5 -0
  10. package/dist/chunk-GYNIDJKN.js +57 -0
  11. package/dist/chunk-H5QI34FV.js +1 -0
  12. package/dist/{chunk-URC5Y5G2.js → chunk-J2JDC3EZ.js} +1 -1
  13. package/dist/{chunk-7BRKNQF7.js → chunk-J54OXLQF.js} +1 -1
  14. package/dist/chunk-M4CNCPHA.js +1 -0
  15. package/dist/{chunk-FHLYUIJJ.js → chunk-NBDMTIU2.js} +2 -2
  16. package/dist/{chunk-KEWQZYUF.js → chunk-NQXFINT2.js} +3 -3
  17. package/dist/{chunk-EC2I7SIY.js → chunk-O5XI3WAQ.js} +1 -1
  18. package/dist/chunk-PIND6KE7.js +1 -0
  19. package/dist/{chunk-5IUS6PM6.js → chunk-PVAIOBBE.js} +5 -5
  20. package/dist/{chunk-ATF2T5CI.js → chunk-S2MMPHKD.js} +1 -1
  21. package/dist/{chunk-6IT5H37Y.js → chunk-TLDRFVD2.js} +1 -1
  22. package/dist/chunk-WUSJ6SSF.js +5 -0
  23. package/dist/{chunk-PS5BWS4I.js → chunk-ZIFDZGY7.js} +1 -1
  24. package/dist/copy/index.js +1 -1
  25. package/dist/draw/client.d.ts +6 -0
  26. package/dist/draw/client.js +1 -0
  27. package/dist/draw/index.d.ts +8 -0
  28. package/dist/draw/index.js +1 -0
  29. package/dist/easel/index.js +1 -1
  30. package/dist/fields/index.js +1 -1
  31. package/dist/index.js +1 -1
  32. package/dist/pick/index.d.ts +30 -8
  33. package/dist/pick/index.js +3 -7
  34. package/dist/pick/pick.css +6 -80
  35. package/dist/screen/components/AddBlockRow.js +1 -1
  36. package/dist/screen/components/AddSidePanel.js +1 -1
  37. package/dist/screen/components/MediaSidePanel.js +1 -1
  38. package/dist/screen/components/NodeContextMenu.js +1 -1
  39. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  40. package/dist/screen/components/ScreenChrome.js +1 -1
  41. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  42. package/dist/screen/components/ScreenMount.js +1 -1
  43. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  44. package/dist/screen/components/SectionScreenShell.js +16 -16
  45. package/dist/screen/components/UiIcon.js +1 -2
  46. package/dist/screen/components/usePartBridge.js +1 -1
  47. package/dist/screen/index.js +1 -1
  48. package/dist/screen/lib/content/view-tiers.js +1 -1
  49. package/dist/screen/lib/key-scope.js +1 -1
  50. package/dist/screen/lib/puck/device-fields.js +1 -1
  51. package/dist/screen/lib/puck/preview-dom.js +1 -1
  52. package/dist/screen/lib/puck/style-clipboard.js +1 -1
  53. package/dist/screen/lib/puck/text-control-kinds.js +1 -1
  54. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  55. package/dist/screen/lib/screen-parts.js +1 -1
  56. package/dist/strings/catalogue.js +1 -1
  57. package/dist/strings/index.js +1 -1
  58. package/dist/text-styles/index.d.ts +12 -4
  59. package/dist/text-styles/index.js +36 -35
  60. package/dist/text-styles/model.d.ts +9 -1
  61. package/package.json +13 -3
  62. package/dist/chunk-A6PY6C3C.js +0 -1
  63. package/dist/chunk-DE35IQ4T.js +0 -57
  64. package/dist/chunk-H6IXH4A3.js +0 -1
  65. package/dist/chunk-JHYKRGRA.js +0 -5
  66. package/dist/chunk-JRRYFSCY.js +0 -5
  67. package/dist/chunk-LZS7JZK5.js +0 -1
@@ -1,57 +0,0 @@
1
- import{markedTreeNodeId as e,revealSelectedTreeRow as n,sameSelector as t}from"./chunk-FGNR22NY.js";import{cloneNodeWithFreshIds as o}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as r}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as i}from"./chunk-LZS7JZK5.js";import{rootRowName as l,slotChildRowName as s,slotChildRenameProp as d,sectionRenameProp as c}from"./chunk-TBF5CVPA.js";import{scrollPreviewToSection as a,gotoPreviewSlide as p,scrollPreviewToTop as u}from"./chunk-4ES5JGGX.js";import{useEaselKeyTarget as f,useEaselUndoKeys as h,useEaselSaveKey as m,editorRootFocus as g}from"./chunk-HRUMNRYI.js";import{usePartBridge as y}from"./chunk-H6IXH4A3.js";import{useSectionOps as S}from"./chunk-ATF2T5CI.js";import{SlotChildActionsProvider as k}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as v,DEFAULT_PANEL_W as b,clampPanelWidth as w}from"./chunk-TZIIRGVY.js";import{MediaSidePanel as x}from"./chunk-URC5Y5G2.js";import{useNodeClipboard as z,useNodeContextMenu as C}from"./chunk-EC2I7SIY.js";import{PageEditGuardNotices as I}from"./chunk-6TJ2CIMY.js";import{useScreenDocument as B}from"./chunk-PS5BWS4I.js";import{requestMediaPick as N}from"./chunk-KG7RJWOK.js";import{ScreenSaveIcon as O,ScreenMainButton as P}from"./chunk-W4U4SHKW.js";import{useBrowserOffline as $}from"./chunk-RKTF5XLP.js";import{heldStyle as M,styleShortcut as T}from"./chunk-V7U33NF2.js";import{AddChildRow as j}from"./chunk-5545A3PC.js";import{AddSidePanel as A}from"./chunk-JHYKRGRA.js";import{SidePanelHead as R,PanelShowStrip as L}from"./chunk-62VPYC7F.js";import{useEaselSession as E}from"./chunk-O7Q4DDJT.js";import{useScreenSaveSwitch as V,useScreenNodeKeys as F,useScreenPinned as H,useScreenDocumentLabel as W,useScreenCanvasFrame as J,useScreenInspectorPanel as Y,useScreenDevices as D,useScreenPickFollowsSelection as U,useScreenLeftView as G,SELECTION_MODE as X,sameInspectorMode as K,useScreenBridges as q,useScreenBlockRules as Z,useScreenBlockLook as _,useScreenStorageNamespace as Q,useScreenNotify as ee,useScreenCanvasHead as ne,isSlotMode as te,useScreenStyleClipboard as oe,useScreenDocumentPass as re,useScreenCanvasDrag as ie,ScreenCanvasTargetProvider as le,isPinnedFirst as se,isPinnedLast as de,screenSlotsOf as ce}from"./chunk-JRRYFSCY.js";import{ROOT_ZONE as ae,blockNodeActions as pe,TREE_MAX_DEPTH as ue,childSlotsOf as fe,slotFieldsOf as he,slotChildrenIn as me,nestsInTree as ge,newNodeId as ye}from"./chunk-PLVEGYK6.js";import{useMediaPanel as Se,usePanelPick as ke,useCancelPanelPick as ve}from"./chunk-R6WTQWAC.js";import{useEaselHost as be,useHostEscape as we}from"./chunk-U3JP4VGF.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as xe}from"./chunk-6WY6ZXJG.js";import{DEFAULT_SCREEN_WORDS as ze}from"./chunk-VVPZMWJE.js";import{useEasel as Ce,useEaselApi as Ie,CanvasPassThroughContext as Be}from"./chunk-5IUS6PM6.js";import{TreeRow as Ne,Subtree as Oe,LayersTree as Pe,TreeGroupLabel as $e,TreeRowAction as Me,TreeSeam as Te}from"./chunk-4JSBIW5H.js";import{DEFAULT_TREE_WORDS as je}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ae}from"./chunk-WK3AFPXY.js";import{toItemSelector as Re,useNodeOps as Le,clickPick as Ee}from"./chunk-ECM5F6JJ.js";import{LayersIcon as Ve,MediaIcon as Fe}from"./chunk-4VJATVVR.js";import{EaselTopBar as He,TopBarRail as We,TopBarCluster as Je,EaselIconButton as Ye,TopBarDivider as De,DeviceSwitch as Ue,InspectorIconButton as Ge,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 Tn,toast as jn,groupColors as An}from"efficient-shell/ui";import{UndoIcon as Rn,RedoIcon as Ln,RefreshIcon as En,AddIcon as Vn,TrashIcon as Fn,EyeOffIcon as Hn,EyeIcon as Wn,DuplicateIcon as Jn}from"efficient-shell/icons/efficient";import{jsx as Yn,jsxs as Dn,Fragment as Un}from"react/jsx-runtime";var Gn=/* @__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__ */Yn("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */Yn("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__ */Yn(Tn,{colorClass:An("info","solid"),size:"sm",children:e.label})},e.id):null})})}function qn({expand:e}){/* @__PURE__ */
2
- return Yn("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */Dn(Un,e?{children:[
3
- /* @__PURE__ */Yn("path",{d:"M8 9l4-4 4 4"}),
4
- /* @__PURE__ */Yn("path",{d:"M8 15l4 4 4-4"})]}:{children:[
5
- /* @__PURE__ */Yn("path",{d:"M8 4l4 4 4-4"}),
6
- /* @__PURE__ */Yn("path",{d:"M8 20l4-4 4 4"}),
7
- /* @__PURE__ */Yn("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=be(),{target:yn,docId:Sn,capabilities:kn,currentSlug:An,siteId:tt,onPublish:ot,saveState:rt,saveConflict:it,retrySave:lt,toggleAutoSave:st,flushSave:dt,access:ct,saveUnreachable:at=!1,readOnly:pt,readOnlyReason:ut=null}=B(),ft=V(),ht=F(),{mediaEditing:mt,hasEditGuard:gt,hasPinnedChrome:yt}=kn,{appState:St,dispatch:kt,history:vt,selectedItem:bt,getSelectorForId:wt,config:xt}=Ce(e=>e),zt=H(),{first:Ct,firstGroup:It,lastGroup:Bt,isSectionGroup:Nt,sectionGroupZone:Ot,panelOf:Pt}=zt,$t=Pt(Ct),Mt=e=>se(zt,e),Tt=e=>de(zt,e),jt="node"===zt.firstRow,At=zt.band??null,Rt=on("screen",ze),Lt=on("tree",je),Et=on("drag",dn),Vt=on("notice",_e),Ft=on("lock",tn),Ht=on("menu",Ae),Wt=on("styleClipboard",xe),Jt=on("chrome",Qe),Yt=W()??`/${An}`,Dt=J(),Ut=Y(),Gt=S({readOnly:pt}),Xt=S({readOnly:pt,foldIntoHistory:!0}),Kt=In(null),qt=Ie(),Zt=Bn(()=>({...Gt,select:e=>{Kt.current=e,Gt.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=qt.config;Kt.current=Re(e,t,n)}Gt.commitDocument(e,n)}}),[Gt,qt]),_t=St.ui,Qt=_t.leftSideBarVisible,eo=_t.rightSideBarVisible,{options:no,widths:to,initial:oo,fluid:ro,fit:io}=D(),[lo,so]=Nn(oo),co=Se(),ao=mt&&null!==co,po=ke(),uo=ve();U(bt?.props.id);const{read:fo,write:ho,forSelection:mo}=G(),[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=f(bo);h(bo,wo);const zo=$(),Co=en(ct),Io={state:rt,offline:zo||rt.failed&&at,readOnlyReason:ut,editing:Co?Vt.editing({name:nn(Co.name,Ft),noun:Rt.noun}):null,conflict:null!=it,notSaving:Rt.bar.notSaving},Bo=()=>{pt||(rt.failed?lt():dt())};m(bo,wo,Bo);const[No,Oo]=Nn(!1),Po=In(!1),$o=In(!1),[Mo,To]=Nn(null),[jo,Ao]=Nn([]),[Ro,Lo]=Nn(X),Eo="puck"===Ro.kind,Vo=e(Ro,bt?.props.id),[Fo,Ho]=Nn(null);On(()=>{Fo&&(n(),Ho(null))},[Fo]);const Wo=In(wt);Wo.current=wt;const Jo=Pn((e,{scroll:n})=>{yo(n=>mo(e,n)),n&&Ho(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=Wo.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})},[]),Yo=In(null);On(()=>{const e=Yo.current;Yo.current=null;const n=null==bt?.props.id?null:String(bt.props.id);Lo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Pt(bt?.type)??X);const o=bt?.props.id,r=Kt.current;if(Kt.current=null,!o)return;const i=wt(o);Jo(String(o),{scroll:!t(r,i??null,ae)})},[bt?.props.id,Jo]);const Do=Pn(e=>{Lo(n=>K(n,e)?n:e),kt({type:"setUi",ui:{rightSideBarVisible:!0}})},[kt]),Uo=In(()=>{});Uo.current=(e,n)=>{const t=e?ui(e.zone??ae)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==bt?.props.id?null:String(bt.props.id);Lo(e=>K(e,n)?e:n),o!==r&&(Yo.current={id:o,mode:n},Zt.select(e))};const Go=Pn((e,n)=>Uo.current(e,n),[]),Xo={kind:Ro.kind,mode:Ro,open:Do,show:e=>Lo(e),reveal:()=>{eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},select:Go},Ko=q(Xo,{data:St.data,selected:bt??null,zoneOf:e=>wt(e)?.zone,readOnly:Boolean(pt),select:e=>{Lo(X),Zt.select({index:e})},replace:(e,n)=>Zt.replaceComponent(ae,e,n),scrollTo:e=>Li(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=Z(),{isLockedBlock:Qo,duplicateBlocked:er,nestDepth:nr,newSectionNode:tr,canAddTo:or,blockIsOffered:rr}=_o,ir=_(),{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}}),a(e),Jo(e,{scroll:!0})},[kt,Jo]),{selectNode:pr,openPartId:ur}=y({mode:Ro,setMode:Lo,onOpenPart:ar}),[fr,hr]=Nn(null);we(null!==fr,()=>hr(null));const mr=v(Q()),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{...b};try{const e=window.localStorage.getItem(yr);if(!e)return{...b};const n=JSON.parse(e);return{left:w(Number(n.left)||b.left),right:w(Number(n.right)||b.right)}}catch{return{...b}}});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(Rt.add.title)}"]`))?.focus(),Nr.current=null}Br.current=No},[No]),On(()=>{if(!No||!xo)return;const e=e=>{"Escape"===e.key&&Di()};return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[No,xo]),we(No,()=>Di()),On(()=>{!Qt&&No&&(Oo(!1),To(null),Po.current=!1)},[Qt]),On(()=>{if(!po)return $o.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),void($o.current=!1);No&&(Oo(!1),To(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]),we(null!==po,()=>uo());const Or=ee(),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,Tr]=Nn(0),[jr,Ar]=Nn(0),Rr=ne(),Lr=In(null),Er=e=>Math.max(0,e.clientHeight-(Lr.current?.offsetHeight??0));On(()=>{const e=$r.current;if(!e)return;const n=()=>{Tr(e.clientWidth),Ar(Er(e))};n();const t=new ResizeObserver(n);return t.observe(e),Lr.current&&t.observe(Lr.current),()=>t.disconnect()},[]),$n(()=>{$r.current&&(Tr($r.current.clientWidth),Ar(Er($r.current)))},[vr,Qt,eo]);const Vr=lo===ro?Mr>0?Mr:to[ro]:to[lo],Fr=Mr>0?Math.min(Mr/Vr,"shrink"===io?1:2):1,Hr=Vr*Fr,Wr=Mr>0&&Hr>Mr+1,Jr={width:Hr,height:jr||"100%",flex:"none",position:"relative"},Yr={width:Vr,height:jr?jr/Fr:"100%",maxHeight:"none",transform:1!==Fr?`scale(${Fr})`:void 0,transformOrigin:"top left"},Dr=()=>kt({type:"setUi",ui:{leftSideBarVisible:!Qt}}),Ur=()=>kt({type:"setUi",ui:{rightSideBarVisible:!eo}}),Gr=e=>{No&&(Oo(!1),To(null),Po.current=!1,Qt&&go===e)||po&&($o.current=!1,uo(),Qt&&go===e)||(Qt&&go===e?Dr():(yo(e),Qt||kt({type:"setUi",ui:{leftSideBarVisible:!0}})))},Xr=()=>{N(fn,{accept:"image/*",title:Jt.mediaLibrary})},Kr=()=>{Lo(X),Zt.select(null),u()},qr=()=>{Lo($t??X),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}})},Zr=St.data.content??[],_r=()=>{const e=Zr.findIndex(Mt),n=Zr.findIndex(Tt);return{floor:e>=0?e+1:0,cap:n>=0?n:Zr.length}},Qr=xt,ei=_o.stripCopy,ni=e=>o(e,ei),ti=z(),oi=Le({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&&Lo(X);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===ae?ci(o):xi(o);return!!oi.remove(e)&&(Pr(Rt.deleted({name:r}),"success",{duration:8e3,action:{label:Rt.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=>l({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>=ue)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of fe(xt,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(Zr,ae,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=>ce(_o,xt,e),mi=e=>{if(!_o.slotsOf||e===ae)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(!te(Ro))return null;const e=`${Ro.nodeId}:${Ro.slot}`;return mi(e)?.slot.panel===Ro.kind?e:null})(),yi=In(null);On(()=>{const e=yi.current;if(yi.current=null,!gi||!te(Ro))return;const n=Ro.nodeId;Jo(n,{scroll:e!==gi}),kr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Ro]);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===ae?Ei(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),Go(null,r),eo||kt({type:"setUi",ui:{rightSideBarVisible:!0}}),Li(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);Go(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=>s(e,li,ir.plainText,e=>wi.get(e),ir.rowName),zi=(e,n)=>{const t=xt.components[e.type]?.fields,o=n===ae||Tl(n)?"section":"block",r=n===ae&&(Mt(e)||Tt(e)||Nt(e.type)),i="block"===o?d(t):r?null:c(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 Yn("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Rt.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=i(oe(),Wt),Bi=Ii.scope({target:yn,siteId:tt,docId:Sn}),Ni=xt,Oi=(e,n)=>n===ae?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=C({nodesIn:ui,nodeAt:(e,n)=>ui(e)[n]??null,labelOf:(e,n)=>n===ae?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),Lo(X)},pageSettingsLabel:Rt.pageSettings,words:{menu:Ht,styleClipboard:Wt,screen:Rt.menu},readOnly:Boolean(pt),collapseAll:()=>kr(new Set(ui(ae).map(e=>String(e.props.id)))),onPasteRefused:e=>Pr(e?Rt.pasteRefused({name:e.label}):Rt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>Rl(e,n),menuRows:Ko.menuRows,isLocked:e=>Qo(e.type),duplicateBlocked:e=>er(St.data,e),permits:e=>pe(xt,e.type),nodeOps:ii,isPinned:(e,n)=>n===ae&&(Mt(e)||Tt(e)),sectionBand:_r,locate:e=>ai.get(e)??null,rowNameOf:(e,n)=>n===ae?ci(e):xi(e),selectAt:(e,n,t,o)=>{e===ae?Ei(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:()=>M(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??ae,index:e.index}:null},held:()=>ti.get(),readOnly:Boolean(pt),onDone:({done:e,name:n})=>{"copied"===e&&Pr(Rt.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??ae,t=ui(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(pt)}});const Ti=Pn(e=>{const n=T(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=>Ti(e);return xo.addEventListener("keydown",e),()=>xo.removeEventListener("keydown",e)},[Ti,xo]),mn(wo,"keydown",Ti);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 Ao(e=>e.length?[]:e);const n=Zr.findIndex(Tt),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})}Ao(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 Ai=wo?.document??null,Ri=wo?.window??null;On(()=>{const e=vo.current;if(!e||!Ai||!Ri)return;const n=[],t=()=>{const n=Ai.querySelector(`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&Ri.scrollTo({left:Ri.scrollX,top:Ri.scrollY+t,behavior:"instant"}),!0};return vo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[Ai,Ri]);const Li=e=>{Ko.holdCanvasOn?Ko.holdCanvasOn(e):a(e)},Ei=e=>{Lo(X),Zt.select({index:e}),Ko.sectionPressed?.(Zr[e]);const n=Zr[e]?.props?.id;n&&Li(n)},Vi=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&&Ro.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(ae,e,i),Zt.select({index:i}),{moved:!0,dest:i})},Hi=(e,n,t,o)=>{Lo(X),Zt.select(o?{index:o.index,zone:o.zone}:{index:e}),a(n),Pr(Rt.sectionAdded({name:t}))},Wi=(e,n)=>{const t=Vi(n),o=tr(e,{nodeDefaults:si,newNodeId:ye,sectionLabel:di,blockIsOffered:rr}),r=o?Zt.insertNode(ae,t,o):Zt.insertSection(e,t);return Hi(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 fe(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},Ji=e=>Yi(ae,e),Yi=(e,n)=>{Nr.current=document.activeElement??null,po&&(Po.current=$o.current,$o.current=!1,uo()),To(null===n?null:{zone:e,index:n}),Oo(!0),Qt||(Po.current=!0,kt({type:"setUi",ui:{leftSideBarVisible:!0}}))},Di=()=>{Oo(!1),To(null),Po.current&&kt({type:"setUi",ui:{leftSideBarVisible:!1}}),Po.current=!1},Ui=(e,n)=>ir.rowName?n?Mt(e)?ir.rowName(e,"section",Rt.header):Tt(e)?ir.rowName(e,"section",Rt.footer):Nt(e.type)?ir.rowName(e,"section",li(e.type)):ci(e):xi(e):n?di(e.type):li(e.type),Gi=e=>n=>{e()},Xi=()=>Ko.editPinnedSource?.(),Ki=(e,n,t)=>{if(pt)return null;const o=ui(e)[n];return o&&!pe(xt,o.type).delete?null:/* @__PURE__ */Yn(Me,{kind:"delete",label:Rt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=ui(e)[n]?.props?.id;null!=t&&ri(String(t))})(e,n),children:/* @__PURE__ */Yn(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 Yn(Me,{kind:"eye",label:r?Rt.showNamed({name:o}):Rt.hideNamed({name:o}),onClick:()=>nl(e,n,t),children:/* @__PURE__ */Yn(r?Hn:Wn,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},el=e=>fs(ae,e),nl=(e,n,t)=>{Zt.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},tl=e=>he(xt,e),ol=e=>fe(xt,e),rl=e=>_o.slotsOf?hi(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:me(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=ge(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(Lo(X),or(o)?.spec?.slider){const t=e.split(":")[0];p(t,n),Zt.select({index:n,zone:e}),a(t)}else Zt.select({index:n,zone:e}),Li(t)},fl=(e,n,t,o,r)=>{const i=`${e}:${n}`;Zt.insertComponent(i,t,o),or(r)?.spec?.slider?requestAnimationFrame(()=>{p(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=r(e,tl(e.type));ml.current.add(t),o&&Xt.replaceComponent(ae,n,{...e,props:o})})},[Zr,Xt]),re(Xt,xt);const gl=Zr.findIndex(Tt),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__ */Yn("span",{className:"es-tree-group-badge",children:/* @__PURE__ */Yn(Tn,{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=>{Tt(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===ae)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},Tl=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=Tl(e);return!t||(!zt.groupAccepts||zt.groupAccepts(t.type,n,ui(e).length))},Al=(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 Vl(e.add,n);const o=wn(n);if(Nt(e.type))return!1;const r=Tl(o),i=Tl(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===ae||o===ae){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)},Rl=(e,n)=>{const t=wn(e.from),o=e.node;return t===wn(n)?jl(t,o.type):Al({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},Ll=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:Ui(o,t.zone===ae)}},El=(e,n)=>{if("section"!==e.kind)return e;const t=wn(n);return t===ae||Tl(t)?e:Ll(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},Vl=(e,n)=>{const t=El(e,n),o=wn(n);if("block"!==t.kind){if(Tl(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!==ae)return!1;const{floor:e,cap:r}=_r();return n.index>=e&&n.index<=r}if(o===ae)return!1;const r=Ll(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(ui(o))},Fl=(e,n)=>{const t=El(e,n);if("block"!==t.kind&&Tl(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))}Lo(X),Zt.select({index:t,zone:n})}})(t,wn(n),n.index);if("section"===t.kind)return void Wi(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=Vi(t),r=Zt.insertNode(ae,o,n);Hi(o,r,e)})(t.template.name,ni(t.template.node),n.index);const o=wn(n),r=Ll(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),Lo(X),Zt.select({index:t,zone:e})})(o,t.type,n.index))},Hl=(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n.index):e.add?Fl(e.add,n):e.zone===ae?Fi(e.index,n.index):Pl(e.zone,wn(n),e.index,n.index)},[Wl]=Nn(()=>cn()),Jl=an({keyOf:e=>e.id,readOnly:Boolean(pt),session:Wl,canDrop:Al,onDrop:Hl,onStep:(e,n)=>{e.rung?vi(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ae?((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?Rt.sectionFirst({name:t}):Rt.sectionLast({name:t}));const{floor:r,cap:i}=_r();Pr(Rt.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)}}),Yl=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)||Tt(i)||Qo(i.type))continue;if(Nt(i.type))continue;const l=Boolean(Tl(e)),s=e===ae||l;e===ae&&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===ae&&0===e.children.length)return[{...e,addLabel:Rt.addSection,addAlways:!0}];const t=Ll(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(Tl(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=wn(e.list),t=n===ae||Tl(n)?null:Ll(n);return t?.choices.length?rn(e,t.target.spec?.addLabel??Rt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[St.data]),Dl=null==bt?.props.id?null:String(bt.props.id),Ul=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(Dl);return i||(r(Ee(St.data,n,o.item.id,Dl,bl))??o)},[St.data,xt,Dl,bl]),[Gl,Xl]=Nn(null);mn(wo,"mouseover",e=>{if(!vl)return;const n=gn(e.target),t=n?Xn(St.data,xt,n):null;t!==Gl&&Xl(t)}),mn(wo,"mouseout",e=>{vl&&!e.relatedTarget&&Xl(null)});const Kl=e=>Mt(e)||Tt(e)||Nt(e.type),ql=[];if(vl){const e=Dl?Xn(St.data,xt,Dl):null;for(const n of/* @__PURE__ */new Set([e,Gl])){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=E(),_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&&!Gn.has(Zl)&&(Gn.add(Zl),Pr(e,"success",{action:{label:Rt.bar.undo,onClick:()=>vt.back()},duration:8e3}))},[Zr]);const Ql=e=>{Lo(X),Zt.select(e.zone===ae?{index:e.index}:{index:e.index,zone:e.zone})},es=ie(),ns=()=>({data:St.data,device:lo,ops:Zt,inspector:Xo}),ts=es?.model,os=Bn(()=>ts?e=>ts(e,Yl(e),ns()):Yl,[ts,Yl,lo]),rs=es?.measure,is=rs?(e,n)=>rs(e,n,ns()):void 0,ls=es?.canDrop,ss=ls?(e,n)=>ls(e,n,Al,ns()):Al,ds=es?.drop,cs=ds?(e,n)=>ds(e,n,Hl,ns()):Hl,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),Yi(n,e.index)},fs=(e,n)=>/* @__PURE__ */Yn(Te,{...pt?{}:Jl.seam({place:{...xn(e),index:n}})},`seam:${e}:${n}`),hs={rowClick:Gi,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 Dn(Un,{children:[
12
- /* @__PURE__ */Yn(Ne,{words:Lt,icon:/* @__PURE__ */Yn(sr,{type:e.type,size:13}),name:s,preview:qi(e),marks:Zi(e),onSelect:()=>Ei(t),nameSlot:Ci(ae,t,n,s),selected:Vo===n,badge:xl,actions:_i(e,ae,t)??void 0,rowProps:{"data-node-id":n,onClick:Gi(()=>Ei(t))},fold:{open:!i,label:"section",onToggle:()=>Ir(n)}}),!i&&/* @__PURE__ */Dn(Oe,{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}=Jl.row({item:{id:r,zone:o,index:t,type:n.type},place:{...xn(o),index:t}},{"data-node-id":r,onClick:Gi(c)});/* @__PURE__ */
13
- return Dn(Mn,{children:[d(t),
14
- /* @__PURE__ */Yn(Ne,{words:Lt,icon:/* @__PURE__ */Yn(sr,{type:n.type,size:13}),name:i,preview:qi(n),marks:Zi(n),onSelect:c,nameSlot:Ci(o,t,r,i),selected:Vo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Ir(r)}:void 0,actions:/* @__PURE__ */Dn(Un,{children:[Ki(o,t,i),_i(n,o,t),Qi(o,t,n,i)]}),rowProps:a}),l&&!s&&/* @__PURE__ */Yn(Oe,{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=Jl.dragging,d=!Cr(l)&&s?.rung?.nodeId!==i,c={...xn(l),index:0},a=s&&!s.rung&&Al(s,c)?c:void 0,p=()=>Si(e,n,!0),{rowProps:u,...f}=Jl.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:Gi(p)}),h=pt?null:_o.slotActions?.(e,n.slot);/* @__PURE__ */
15
- return Dn(Mn,{children:[n.heading,
16
- /* @__PURE__ */Yn(Ne,{words:Lt,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__ */Yn(Un,{children:h.map((t,o)=>/* @__PURE__ */Yn(Me,{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__ */Yn(Fn,{size:15}):/* @__PURE__ */Yn(Jn,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */Yn(Oe,{children:r})]},l)},ys=(e,n)=>{const t=rl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
17
- return Yn(Un,{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__ */Dn(Un,{children:[i.map(({child:n,zone:t,index:o})=>{const r=Vo===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}=Jl.row({item:{id:d,zone:t,index:o,type:n.type},place:{...xn(t),index:o}},{"data-node-id":d,onClick:Gi(p)});/* @__PURE__ */
18
- return Dn(Mn,{children:[0===o&&a(t,0),
19
- /* @__PURE__ */Yn(Ne,{words:Lt,icon:/* @__PURE__ */Yn(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__ */Dn(Un,{children:[Ki(t,o,c),_i(n,t,o),Qi(t,o,n,c)]}),rowProps:u}),i&&!s&&/* @__PURE__ */Yn(Oe,{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__ */Yn(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 Yn(Un,{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__ */Dn(Un,{children:[l.map(({child:n,zone:t,index:o})=>{const r=Vo===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=Jl.dragging,h=u&&f&&Al(f,u)?u:void 0,g=()=>ul(t,o,l,e.type),{rowProps:y,...S}=Jl.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:Gi(g)});/* @__PURE__ */
21
- return Dn(Mn,{children:[0===o&&m(t,0),
22
- /* @__PURE__ */Yn(Ne,{words:Lt,icon:/* @__PURE__ */Yn(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__ */Dn(Un,{children:[Ki(t,o,i),_i(n,t,o),Qi(t,o,n,i)]}),rowProps:y}),d&&!c&&/* @__PURE__ */Yn(Oe,{children:Ss(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&c&&
23
- /* @__PURE__ */Yn(j,{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__ */Yn(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:()=>Gr(e.id)}:e,bs=[...(Ko.railLead??[]).map(vs),{id:"sections",label:Rt.layers,icon:/* @__PURE__ */Yn(Ve,{}),active:Qt&&!ks&&"sections"===Zo,onSelect:()=>Gr("sections")},...(Ko.railTrail??[]).map(vs)];ao?bs.push({id:"media",label:Rt.railMedia,icon:/* @__PURE__ */Yn(Fe,{}),active:Qt&&!No&&(null!==po||"media"===Zo),onSelect:()=>Gr("media")}):mt&&bs.push({id:"media",label:Rt.railMedia,icon:/* @__PURE__ */Yn(Fe,{}),onSelect:Xr});const ws=[...Ko.railLead??[],...Ko.railTrail??[]].find(e=>"panel"in e&&e.id===Zo),xs=Boolean(At?.foldable)&&!qo,zs=At?.label??(gt?Rt.pageSections:Rt.templateSections),Cs=xs&&Cr(et),Is=/* @__PURE__ */Dn(Un,{children:[Zr.map((e,n)=>{if(Mt(e)||Tt(e)||Nt(e.type))return null;const t=Vo===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=Jl.dragging,u=a&&p&&Al(p,a)?a:void 0,{rowProps:f,...h}=Jl.row({item:{id:r,zone:ae,index:n,type:e.type},place:{...xn(ae),index:n},into:u},{"data-node-id":r,onClick:Gi(()=>Ei(n))});/* @__PURE__ */
24
- return Dn(Mn,{children:[n>0&&el(n),
25
- /* @__PURE__ */Yn(Ne,{words:Lt,icon:/* @__PURE__ */Yn(sr,{type:e.type,size:13}),name:ci(e),preview:qi(e),marks:Zi(e),onSelect:()=>Ei(n),nameSlot:Ci(ae,n,r,ci(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Ir(r)}:void 0,actions:/* @__PURE__ */Dn(Un,{children:[Ki(ae,n,ci(e)),_i(e,ae,n),Qi(ae,n,e,ci(e))]}),rowProps:f}),al(e)&&!s&&/* @__PURE__ */Dn(Oe,{children:[Ss(e,1),Ko.partRows?.(e,hs)]}),i&&!s&&/* @__PURE__ */Yn(Oe,{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?Rt.header:Rt.footer,s=ir.rowName?ir.rowName(e,"section",l):l;/* @__PURE__ */
26
- return Dn(Un,{children:[
27
- /* @__PURE__ */Yn(Ne,{words:Lt,icon:/* @__PURE__ */Yn(sr,{type:t,size:13}),name:s,preview:qi(e),marks:Zi(e),badge:xl,onSelect:()=>Ei(n),nameSlot:Ci(ae,n,o,s),selected:Vo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Ir(o)}:void 0,actions:_i(e,ae,n)??void 0,rowProps:{"data-node-id":o,onClick:Gi(()=>Ei(n))}}),r&&!i&&/* @__PURE__ */Yn(Oe,{children:ys(e,1)})]})};return(Ko.wrap??(e=>e))(
28
- /* @__PURE__ */Yn(le,{target:wo,children:/* @__PURE__ */Dn("div",{ref:bo,className:"sf-editor es-editor",style:Ze(vr),onContextMenu:$i.onEditorContextMenu,...g(fn),children:[
29
- /* @__PURE__ */Dn(He,{children:[
30
- /* @__PURE__ */Yn(We,{items:bs,ariaLabel:Rt.bar.views}),
31
- /* @__PURE__ */Dn(Je,{children:[
32
- /* @__PURE__ */Yn(Ye,{label:Rt.bar.undo,disabled:Boolean(pt)||!vt.hasPast,onClick:()=>vt.back(),children:/* @__PURE__ */Yn(Rn,{})}),
33
- /* @__PURE__ */Yn(Ye,{label:Rt.bar.redo,disabled:Boolean(pt)||!vt.hasFuture,onClick:()=>vt.forward(),children:/* @__PURE__ */Yn(Ln,{})}),
34
- /* @__PURE__ */Yn(De,{}),
35
- /* @__PURE__ */Yn(Ue,{devices:no,value:lo,onChange:so}),
36
- /* @__PURE__ */Yn(Ye,{label:Rt.bar.refresh,tip:Rt.bar.refreshTip,onClick:()=>{vo.current=(()=>{const e=wo?.document;if(!e)return null;const n=Zr.findIndex(Tt),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__ */Yn(En,{})})]}),
37
- /* @__PURE__ */Dn(Je,{kind:"right",style:{minWidth:300},children:[
38
- /* @__PURE__ */Yn(O,{input:Io,words:Rt.saveStatus}),Ko.barLead?.(),Ko.barTrail?.(),Ko.mainAction||!Ko.barMain?/* @__PURE__ */Yn(P,{input:Io,action:Ko.mainAction??{label:Rt.done,onPress:()=>{ot(St.data)}},readOnly:Boolean(pt),saveSwitch:ft,onToggleAutoSave:st,onSaveNow:Bo,bar:Rt.bar,words:Rt.saveStatus}):Ko.barMain()]})]}),
39
- /* @__PURE__ */Yn(I,{}),
40
- /* @__PURE__ */Dn("div",{className:"sf-body",children:[Qt?/* @__PURE__ */Dn(Un,{children:[
41
- /* @__PURE__ */Yn("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Rt.leftPanel,children:No?/* @__PURE__ */Yn(A,{at:Mo?{label:(e=>{const n=Tl(e.zone);if(n)return Rt.add.addingTo({name:ir.rowName?Ui(n,!0):li(n.type)});if(e.zone===ae){const n=Zr[e.index];return n&&!Tt(n)?Rt.add.addingBefore({name:Ui(n,!0)}):Rt.add.addingAtEnd}const t=Ll(e.zone);return t?Rt.add.addingTo({name:t.parentName}):Rt.add.addingHere})(Mo),onClear:()=>To(null)}:void 0,placeBlocks:Mo&&Mo.zone!==ae?Ll(Mo.zone)?.choices:void 0,canTake:Mo?e=>{if(!Mo)return null;const n={...xn(Mo.zone),index:Mo.index};if(Vl(e,n))return null;const t=Tl(Mo.zone);if(t)return Rt.add.notInside({name:Ui(t,!0)});if(Mo.zone===ae)return Rt.add.onlySections;const o=Ll(Mo.zone);return o?Rt.add.notInside({name:o.parentName}):Rt.add.onlySections}:void 0,onPick:Mo?e=>{if(!Mo)return;const n={...xn(Mo.zone),index:Mo.index};Vl(e,n)&&(Fl(e,n),Di())}: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:Wl,siteWide:Ko.addPanelRow?.(Di),onClose:Di,onHide:Dr,readOnly:Boolean(pt)}):po&&co?
42
- /* @__PURE__ */Yn(x,{panel:co,pick:po,onHide:Dr}):ws?ws.panel({onHide:Dr,notify:Pr}):"media"===Zo&&co?/* @__PURE__ */Yn(x,{panel:co,pick:null,onHide:Dr}):/* @__PURE__ */Dn(Un,{children:[
43
- /* @__PURE__ */Yn(R,{icon:/* @__PURE__ */Yn(Ve,{}),title:Rt.layers,context:Yt,actions:/* @__PURE__ */Dn(Un,{children:[!pt&&/* @__PURE__ */Yn(Ge,{label:Rt.add.title,onClick:()=>Ji(null),children:/* @__PURE__ */Yn(Vn,{size:15})}),
44
- /* @__PURE__ */Yn(Ge,{label:Nl?Rt.expandAll:Rt.collapseAll,title:0===Bl.length?Rt.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__ */Yn(qn,{expand:Nl})})]}),onHide:Dr}),
45
- /* @__PURE__ */Dn(Pe,{className:"sf-tree sf-scroll",words:Lt,children:[
46
- /* @__PURE__ */Yn(Ne,{words:Lt,icon:/* @__PURE__ */Yn(sr,{type:"page",size:13}),name:Rt.pageSettings,onSelect:Kr,selected:!bt&&Eo,rowProps:{onClick:Gi(Kr)}}),zl&&/* @__PURE__ */Dn(Un,{children:[!wl&&/* @__PURE__ */Yn($e,{children:Rt.header}),ms(zl)]}),!qo&&yt&&!(wl&&zl)&&/* @__PURE__ */Dn(Un,{children:[!wl&&/* @__PURE__ */Yn($e,{children:Rt.header}),!jt&&/* @__PURE__ */Yn(Ne,{words:Lt,icon:/* @__PURE__ */Yn(sr,{type:"header",size:13}),name:Rt.header,badge:xl,onSelect:qr,selected:Ro.kind===$t?.kind,rowProps:{onClick:Gi(qr)}})]}),!qo&&kl&&!(wl&&zl)&&Bs(kl,Sl,"header"),!qo&&!xs&&/* @__PURE__ */Yn($e,{children:zs}),xs?/* @__PURE__ */Dn(Un,{children:[
47
- /* @__PURE__ */Yn(Ne,{words:Lt,icon:null,name:zs,fold:{open:!Cs,label:zs,onToggle:()=>Ir(et)}}),!Cs&&/* @__PURE__ */Yn(Oe,{children:Is})]}):Is,yt&&!wl&&/* @__PURE__ */Yn($e,{children:Rt.footer}),yl&&!(wl&&Cl)&&Bs(yl,gl,"footer"),!qo&&!yl&&yt&&!wl&&/* @__PURE__ */Yn(Ne,{words:Lt,icon:/* @__PURE__ */Yn(sr,{type:"footer",size:13}),name:Rt.footer,onSelect:Xi,rowProps:{onClick:Gi(Xi),title:Rt.editFooter}}),Cl&&ms(Cl),Ko.treeFoot?.()]})]})}),
48
- /* @__PURE__ */Yn(Xe,{side:"left",width:vr.left,min:qe,max:Ke,defaultWidth:b.left,label:Rt.resizeLeftPanel,onResize:xr})]}):/* @__PURE__ */Yn(L,{side:"left",onShow:Dr}),
49
- /* @__PURE__ */Dn("div",{ref:$r,className:"sf-center sf-scroll","data-sf-canvas-head":Rr?"":void 0,style:{overflowX:Wr?"auto":"hidden",overflowY:"hidden"},children:[Rr&&/* @__PURE__ */Yn("div",{ref:Lr,className:"sf-canvas-head",children:/* @__PURE__ */Yn(Rr,{device:lo})}),
50
- /* @__PURE__ */Dn("div",{className:"sf-frame-scaler",style:Jr,children:[
51
- /* @__PURE__ */Yn("div",{className:"sf-frame "+(lo===ro?"":`sf-frame--${lo}`),style:Yr,children:/* @__PURE__ */Dn("div",{className:"sf-preview-host",children:[
52
- /* @__PURE__ */Yn(Be.Provider,{value:bl,children:/* @__PURE__ */Yn(Dt,{},So)}),
53
- /* @__PURE__ */Yn(ln,{canvas:wo,session:Wl,model:os,measure:is,canDrop:ss,onDrop:cs,choose:Ul,onPick:ps,onZoneAdd:us,onSeamAdd:us,zoneAddLabel:Rt.canvasAddBlock,words:Et.canvas,readOnly:Boolean(pt),revision:St.data}),jo.length>0&&/* @__PURE__ */Yn("div",{className:"sf-preview-gaps",children:jo.map(e=>
54
- /* @__PURE__ */Yn(sn,{index:e.index,label:Rt.addSectionHere,onInsert:()=>Ji(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__ */Yn(Kn,{canvas:wo,tabs:ql,onSelect:e=>{const n=Zr.findIndex(n=>String(n.props.id)===e);n>=0&&Ei(n)}}):null]})]}),eo?/* @__PURE__ */Dn(Un,{children:[
55
- /* @__PURE__ */Yn(k,{value:{selectChild:ul,addChild:fl,childRowName:xi,blockRowName:Ol},children:/* @__PURE__ */Yn(Ut,{mode:Ro,onOpenWebsiteSettings:Ko.openSettings??(()=>{}),onOpenSiteStyles:Ko.openStyles,onSelectNode:pr,onNotify:Pr,onHidePanel:Ur,nodeActions:bt?pe(xt,bt.type):nt})}),
56
- /* @__PURE__ */Yn(Xe,{side:"right",width:vr.right,min:qe,max:Ke,defaultWidth:b.right,label:Rt.resizeSettingsPanel,onResize:zr})]}):
57
- /* @__PURE__ */Yn(L,{side:"right",onShow:Ur})]}),$i.menu]})}))}export{tt as ScreenChrome};
@@ -1 +0,0 @@
1
- import{useSectionOps as o}from"./chunk-ATF2T5CI.js";import{decodePartId as e,encodePartId as r}from"./chunk-IYT6NN2J.js";import{usePreviewParts as t}from"./chunk-I54UCYOU.js";import{SELECTION_MODE as n}from"./chunk-JRRYFSCY.js";import{useEasel as p}from"./chunk-5IUS6PM6.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}=t(),l=d(o=>{const r=e(o);if(!r)return;const{nodeId:t,propKey:p}=r;p?(i(o=>s(o)&&o.nodeId===t&&o.propKey===p?o:{kind:"part",nodeId:t,propKey:p}),I?.(t)):i(o=>"part"===o.kind?n:o)},[i,I]);c(()=>{k(l)},[k,l]);const h=s(m)?r(m.nodeId,m.propKey):null;c(()=>{f(h)},[h,f]);return{selectNode:d(o=>{i(()=>n);const e=a(o);e&&u.select(e)},[i,a,u]),openPartId:h}}export{m as usePartBridge};
@@ -1,5 +0,0 @@
1
- import{buildPaletteSections as e,pinnedSection as t,categoryLabel as o}from"./chunk-PA3PNTVV.js";import{blockTypesIn as n}from"./chunk-5ZBY24K7.js";import{sectionTemplatesOf as s}from"./chunk-BVN33R76.js";import{SidePanelHead as i,PanelModeExit as r}from"./chunk-62VPYC7F.js";import{useEaselSession as l}from"./chunk-O7Q4DDJT.js";import{blockRuns as c}from"./chunk-HQ4VVRIC.js";import{useScreenBlockLook as a,useScreenBlockRules as p}from"./chunk-JRRYFSCY.js";import{DEFAULT_SCREEN_WORDS as m}from"./chunk-VVPZMWJE.js";import{useEasel as d}from"./chunk-5IUS6PM6.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 R}from"react/jsx-runtime";var V=e=>`section:${e}`,$=e=>`block:${e}`,w=e=>`template:${e}`;function A({at:A,placeBlocks:E,canTake:F,onPick:I,itemFor:N,session:O,siteWide:P,onClose:Y,onHide:x,readOnly:B}){const C=d(e=>e.config),H=a(),{labelAtLevel:M,categoryLabel:S,firstSection:T,Icon:W,Thumbnail:L}=H,{blockIsOffered:D,canAddTo:J}=p(),Q=f("screen",m).add,z=f("drag",h).add,Z=l(),[G,K]=u([]);k(()=>{let e=!1;const t=e=>D(e,Z);return s(Z).list().then(o=>{if(e)return;const s=C.components;K(o.filter(e=>e.node?.type&&s[e.node.type]&&n(e.node).every(t)))}).catch(()=>{}),()=>{e=!0}},[C,Z]);const U=b(()=>e(C,H),[C]),q=e=>({type:V(e.type),label:e.name,cover:/* @__PURE__ */j(L,{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)}),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(W,{type:e,size:26})}),ee=b(()=>{const e=t(U,T),n=/* @__PURE__ */new Map,s=e=>{!n.has(e.type)&&D(e.type,Z)&&n.set(e.type,e)};for(const t of e?[e]:U){const e=J(t.type)?.choices??[];e.forEach(s),e.forEach(e=>J(e.type,1)?.choices?.forEach(s))}E?.forEach(s);const i=new Set(U.map(e=>e.type)),r=[...n.values()].filter(e=>!i.has(e.type)),l=e=>({type:$(e.type),label:e.label,cover:_(e.type),title:Q.tile({name:e.label}),keywords:[e.group??"",e.type].filter(Boolean)}),a=e=>n.has(e.type)?{...q(e),cover:_(e.type)}:q(e),p=[];G.length>0&&p.push({key:"templates",title:Q.templates,tiles:G.map(e=>{return{type:w(e.id),label:e.name,cover:/* @__PURE__ */j(L,{type:e.node.type}),keywords:[(t=e.node.type,M(t,"section",C.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(C.categories??{})){const n=U.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(l)),d=!0),p.push({key:`category:${t}`,title:o(C,t,S),tiles:i})}const f=p.find(e=>e.key?.startsWith("category:"));if(!d&&f&&m.length>0&&(f.tiles=[...f.tiles,...m.map(l)],d=!0),c(r.filter(e=>e.group||!d)).forEach((e,t)=>{p.push({key:`blocks:${t}`,title:e.group??"",tiles:e.items.map(l)})}),!F)return p;const y=p.map(e=>({...e,tiles:e.tiles.map(e=>{const t=X(e.type),o=t?F(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,U,C,Q,F,E,Z]);/* @__PURE__ */
2
- return v(R,{children:[
3
- /* @__PURE__ */j(i,{icon:/* @__PURE__ */j(g,{size:15}),title:Q.title,context:Q.contextAll,actions:/* @__PURE__ */j(r,{label:Q.done,description:Q.doneDescription,onClick:Y}),onHide:x}),
4
- /* @__PURE__ */v("div",{className:"sf-addside sf-scroll",children:[
5
- /* @__PURE__ */j(y,{groups:ee,session:O,itemFor:e=>N(X(e)??{kind:"section",type:e}),onInsert:I?e=>{const t=X(e);t&&I(t)}:void 0,at:A,hint:Q.hint,searchLabel:Q.search,readOnly:B,words:z}),P??null]})]})}export{A as AddSidePanel,$ as blockKey,V as sectionKey,w as templateKey};
@@ -1,5 +0,0 @@
1
- import{slotFieldsOf as n}from"./chunk-PLVEGYK6.js";import{usePickFollowsSelection as e}from"./chunk-R6WTQWAC.js";import{EaselCanvas as t,useSelectedFields as r}from"./chunk-5IUS6PM6.js";import{Inspector as i}from"./chunk-UBAYMWCX.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(e,t,r){const i=e.slotsOf?.(r);return i||n(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},j={options:[{id:"desktop",label:"Desktop",icon:/* @__PURE__ */s(l,{})}],initial:"desktop",fluid:"desktop",widths:{desktop:2e3}},w={read:()=>"sections",write:()=>{},forSelection:(n,e)=>n?"sections":e},L={first:null,last:null,firstGroup:null,lastGroup:null,isSectionGroup:()=>!1,sectionGroupZone:()=>"",panelOf:()=>null};function S(){/* @__PURE__ */
2
- return s(t,{height:"fill"})}function C(){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 P=o({});function B({parts:n,children:e}){/* @__PURE__ */
4
- return s(P.Provider,{value:n,children:e})}function D(){return u(P)}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??j}function W(){return D().leftView??w}function K(){return D().pinned??L}function M(){return D().saveSwitch??!0}function U(n){e(!0===D().pickFollowsSelection,n)}function V(){return D().storageNamespace||void 0}function Y(){return D().styleClipboard??null}function E(){return D().nodeKeys??!0}function H(){return D().notify??null}function Q(){return D().Canvas??S}function X(){return D().CanvasHead??null}function Z(){return D().canvasDrag??null}var q=o(null);function z({target:n,children:e}){/* @__PURE__ */
5
- return s(q.Provider,{value:n,children:e})}function J(){return u(q)}function $(){return D().Inspector??C}export{c as SELECTION_MODE,z as ScreenCanvasTargetProvider,B 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,Z as useScreenCanvasDrag,Q as useScreenCanvasFrame,X as useScreenCanvasHead,J as useScreenCanvasTarget,R as useScreenDevices,I as useScreenDocumentLabel,A as useScreenDocumentPass,$ as useScreenInspectorPanel,W as useScreenLeftView,E as useScreenNodeKeys,H as useScreenNotify,G as useScreenOwnerName,D as useScreenParts,U as useScreenPickFollowsSelection,K as useScreenPinned,M as useScreenSaveSwitch,V as useScreenStorageNamespace,Y as useScreenStyleClipboard,x as useStandaloneScreenBridges};
@@ -1 +0,0 @@
1
- import{panelFieldsOf as t}from"./chunk-ZE7I3PLX.js";import{withoutDeviceGate as o,deviceMetaOf as n}from"./chunk-FHLYUIJJ.js";import{DESIGN_GROUP_KEY as e,BUCKET_KEY as r}from"./chunk-MQNBD6AB.js";import{ANCHOR_FIELD_KEYS as s,foldMetaOf as c,MEDIA_FIELD_MARKER as i,TEXT_FIELD_MARKER as p,LINK_FIELD_MARKER as u}from"./chunk-DUVRZ456.js";import{STYLE_KIND as a,fieldKind as f,copyStyle as l,heldStyle as m,planPaste as h,pasteMessage as y}from"./chunk-V7U33NF2.js";var j=/* @__PURE__ */new Set([e.Size,e.Design,e.Layout,e.Position]),w=new Set(Object.values(e)),b=new Set(Object.values(r)),S=new Set(s),g=/* @__PURE__ */new Set(["focal","imageFocal"]),k=[i,p,u];function v(t){return`site:${t??""}`}function D(t){if(!t||"object"!=typeof t)return null;const n=t,e=o(t)??t,r=n[a]??e[a];if("string"==typeof r)return r;const s=n.options??e.options;if(Array.isArray(s)){return`choice:${s.map(t=>String(t?.value)).sort().join("|")}`}return f(e)}function L(t){const n=t,e=o(t);return k.some(t=>t in n||e&&t in e)}function d(o,e){const s=t(o,e)??{},i=[];let p=!0,u=!1;for(const[t,o]of Object.entries(s))b.has(t)?(p=t===r.Design,u=!1):w.has(t)?p&&(u=j.has(t)):u&&o&&"object"==typeof o&&!t.startsWith("_")&&(c(o)||S.has(t)||g.has(t)||L(o)||"slot"!==o.type&&i.push({path:[t],kind:D(o),counted:"mobile"!==n(o)?.tier}));return i}function A(t,o,n,e,r){l({scope:n,type:e.type,label:r,rows:t(o,e),props:e.props})}function F(t,o,n,e,r,s){const c=m(n);if(!c)return null;const i=h(c,{type:e.type,rows:t(o,e),props:e.props});return{...i,message:y(i,c.sourceLabel,r,s)}}function I(t,o,n,e){A(d,t,o,n,e)}function O(t,o,n,e,r){return F(d,t,o,n,e,r)}var U={scope:t=>v(t.siteId),rows:(t,o)=>d(t,o),copy:(t,o,n,e)=>I(e,t,o,n),plan:(t,o,n,e)=>O(e,t,o,n)};function B(t,o){if(!t&&!o)return U;const n=t?.rows,e=n?(t,o)=>n(t,o):d;return{scope:t?.scope??U.scope,rows:(t,o)=>e(t,o),copy:t?.copy??((t,o,n,r)=>A(e,r,t,o,n)),plan:t?.plan??((t,n,r,s)=>F(e,s,t,n,r,o))}}export{I as copyNodeStyle,d as nodeStyleRows,O as planNodePaste,D as shopFieldKind,v as siteStyleScope,B as styleClipboardOf};