efficient-easel 20.0.0 → 20.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 (61) hide show
  1. package/dist/{ScreenDocumentContext-RxVWWWHq.d.ts → ScreenDocumentContext-CFJeqqKk.d.ts} +27 -2
  2. package/dist/chunk-276MBG5P.js +2 -0
  3. package/dist/{chunk-MS2U6MV5.js → chunk-2G6MAXPY.js} +1 -1
  4. package/dist/{chunk-A42LPWNM.js → chunk-47CD7ULN.js} +1 -1
  5. package/dist/{chunk-EW6XAMDZ.js → chunk-47PYYMFM.js} +6 -6
  6. package/dist/{chunk-2A7HLAI5.js → chunk-5THLKXTH.js} +1 -1
  7. package/dist/{chunk-EZG3TGQ7.js → chunk-77IWWW6X.js} +1 -1
  8. package/dist/{chunk-SK3P56FS.js → chunk-7LYKFL3Q.js} +13 -13
  9. package/dist/{chunk-LNHT2KPX.js → chunk-FHCKFOCD.js} +2 -2
  10. package/dist/{chunk-BW5COX42.js → chunk-H4JCMK36.js} +1 -1
  11. package/dist/{chunk-KC24D76S.js → chunk-HBBXDGDD.js} +1 -1
  12. package/dist/{chunk-CBICQ4J3.js → chunk-LEZFSSQN.js} +5 -5
  13. package/dist/chunk-MQA7OFRA.js +2 -0
  14. package/dist/{chunk-QALW2ECZ.js → chunk-PEDR7G3K.js} +1 -1
  15. package/dist/{chunk-NHY5L3SE.js → chunk-PI6RFJR4.js} +1 -1
  16. package/dist/chunk-RVZJ52EP.js +63 -0
  17. package/dist/{chunk-VPFNZ7TB.js → chunk-U66YKDAR.js} +1 -1
  18. package/dist/{chunk-5DPIGWUL.js → chunk-UJ46J7QW.js} +1 -1
  19. package/dist/{chunk-RYNBSKE7.js → chunk-UNVKPVZW.js} +1 -1
  20. package/dist/{chunk-RR4VIAHP.js → chunk-WBFLSCTI.js} +3 -3
  21. package/dist/copy/index.js +12 -12
  22. package/dist/fields/index.js +1 -1
  23. package/dist/screen/components/AddBlockRow.js +1 -1
  24. package/dist/screen/components/AddSidePanel.js +1 -1
  25. package/dist/screen/components/MediaPopup.js +1 -1
  26. package/dist/screen/components/NodeContextMenu.d.ts +1 -1
  27. package/dist/screen/components/NodeContextMenu.js +1 -1
  28. package/dist/screen/components/PageEditGuardNotices.js +1 -1
  29. package/dist/screen/components/SaveControls.d.ts +1 -1
  30. package/dist/screen/components/ScreenChrome.js +1 -1
  31. package/dist/screen/components/ScreenDocumentContext.d.ts +1 -1
  32. package/dist/screen/components/ScreenDocumentContext.js +1 -1
  33. package/dist/screen/components/ScreenMount.d.ts +1 -1
  34. package/dist/screen/components/ScreenMount.js +1 -1
  35. package/dist/screen/components/ScreenStoreProvider.d.ts +1 -1
  36. package/dist/screen/components/ScreenStoreProvider.js +1 -1
  37. package/dist/screen/components/SectionScreenShell.js +16 -16
  38. package/dist/screen/components/usePartBridge.d.ts +1 -1
  39. package/dist/screen/components/usePartBridge.js +1 -1
  40. package/dist/screen/index.d.ts +1 -1
  41. package/dist/screen/index.js +1 -1
  42. package/dist/screen/lib/admin-bridge.js +1 -1
  43. package/dist/screen/lib/document-addressing.d.ts +1 -1
  44. package/dist/screen/lib/host-inbound.js +1 -1
  45. package/dist/screen/lib/host.d.ts +1 -1
  46. package/dist/screen/lib/host.js +1 -1
  47. package/dist/screen/lib/key-scope.js +1 -1
  48. package/dist/screen/lib/media-panel.d.ts +1 -1
  49. package/dist/screen/lib/media-panel.js +1 -1
  50. package/dist/screen/lib/media-picker.d.ts +1 -1
  51. package/dist/screen/lib/media-picker.js +1 -1
  52. package/dist/screen/lib/puck/style-clipboard.d.ts +1 -1
  53. package/dist/screen/lib/puck/use-section-ops.js +1 -1
  54. package/dist/screen/lib/screen-parts.d.ts +1 -1
  55. package/dist/screen/lib/screen-parts.js +1 -1
  56. package/dist/strings/index.js +1 -1
  57. package/dist/text-styles/index.js +21 -21
  58. package/package.json +1 -1
  59. package/dist/chunk-BC5KJNHN.js +0 -63
  60. package/dist/chunk-M62P4IQK.js +0 -2
  61. package/dist/chunk-U3JP4VGF.js +0 -2
@@ -1,63 +0,0 @@
1
- import{cloneNodeWithFreshIds as e}from"./chunk-2GVCAIPX.js";import{dedupeSlotChildren as n}from"./chunk-26OOWIJJ.js";import{styleClipboardOf as t}from"./chunk-JBOSEHIX.js";import{markedTreeNodeId as o,revealSelectedTreeRow as r,sameSelector as i}from"./chunk-FGNR22NY.js";import{scrollPreviewToSection as l,gotoPreviewSlide as s,scrollPreviewToTop as d}from"./chunk-2E2SXDYQ.js";import{useEaselKeyTarget as a,useEaselUndoKeys as c,useEaselSaveKey as p,editorRootFocus as u}from"./chunk-KC24D76S.js";import{SlotChildActionsProvider as f}from"./chunk-KCBEE2MC.js";import{screenStorageKeys as h,DEFAULT_PANEL_W as m,clampPanelWidth as g}from"./chunk-C56MPJBH.js";import{usePartBridge as y}from"./chunk-A42LPWNM.js";import{useSectionOps as v}from"./chunk-NHY5L3SE.js";import{ScreenSaveIcon as k,ScreenMainButton as b}from"./chunk-PY7OOQEZ.js";import{useBrowserOffline as S}from"./chunk-RKTF5XLP.js";import{AddChildRow as w}from"./chunk-5545A3PC.js";import{AddSidePanel as x}from"./chunk-EW6XAMDZ.js";import{keepsSharedSections as z,sharedSectionsOf as C}from"./chunk-43AEUUNQ.js";import{SidePanelHead as N,PanelShowStrip as I}from"./chunk-SINAM2IT.js";import{offeredChoices as B}from"./chunk-M2Z775ZC.js";import{useScreenSaveSwitch as O,useScreenNodeKeys as P,useScreenPinned as $,useScreenDocumentLabel as M,useScreenCanvasFrame as L,useScreenInspectorPanel as j,useScreenDevices as A,useScreenPickFollowsSelection as E,useScreenLeftView as T,SELECTION_MODE as R,sameInspectorMode as D,useScreenBridges as F,useScreenBlockRules as H,useScreenBlockLook as W,useScreenStorageNamespace as V,useScreenNotify as U,useScreenCanvasHead as J,isSlotMode as Y,useScreenStyleClipboard as K,useScreenDocumentPass as G,useScreenCanvasDrag as Z,ScreenCanvasTargetProvider as Q,isPinnedFirst as X,isPinnedLast as _,screenSlotsOf as q}from"./chunk-CBICQ4J3.js";import{MediaPopup as ee}from"./chunk-MS2U6MV5.js";import{useNodeClipboard as ne,useNodeContextMenu as te}from"./chunk-QALW2ECZ.js";import{PageEditGuardNotices as oe}from"./chunk-5DPIGWUL.js";import{useScreenDocument as re}from"./chunk-M62P4IQK.js";import{requestMediaPick as ie}from"./chunk-RYNBSKE7.js";import{useMediaPanel as le,usePanelPick as se,useMediaBrowsing as de,useOpenMediaBrowse as ae,useMediaPlace as ce}from"./chunk-LNHT2KPX.js";import{useEaselSession as pe}from"./chunk-O7Q4DDJT.js";import{useEaselHost as ue,useHostEscape as fe}from"./chunk-U3JP4VGF.js";import{LayersIcon as he,MediaIcon as me}from"./chunk-XFYFKITX.js";import{DEFAULT_SCREEN_WORDS as ge}from"./chunk-23DYNW6S.js";import{heldStyle as ye,styleShortcut as ve}from"./chunk-V7U33NF2.js";import{DEFAULT_STYLE_CLIPBOARD_WORDS as ke}from"./chunk-6WY6ZXJG.js";import{rootRowName as be,slotChildRowName as Se,slotChildRenameProp as we,sectionRenameProp as xe}from"./chunk-BHRC3ASL.js";import{ROOT_ZONE as ze,blockNodeActions as Ce,TREE_MAX_DEPTH as Ne,childSlotsOf as Ie,slotFieldsOf as Be,newNodeId as Oe,slotChildrenIn as Pe,nestsInTree as $e}from"./chunk-PLVEGYK6.js";import{useEasel as Me,useEaselApi as Le,CanvasPassThroughContext as je,CanvasSharedContext as Ae}from"./chunk-ROPYFLNZ.js";import{TreeRow as Ee,Subtree as Te,LayersTree as Re,TreeGroupLabel as De,TreeRowAction as Fe,TreeSeam as He}from"./chunk-A6Z4SD3I.js";import{DEFAULT_TREE_WORDS as We}from"./chunk-K56YDHYQ.js";import{DEFAULT_NODE_MENU_WORDS as Ve}from"./chunk-WK3AFPXY.js";import{toItemSelector as Ue,useNodeOps as Je,clickPick as Ye}from"./chunk-BSHIQIZC.js";import{EaselTopBar as Ke,TopBarCluster as Ge,EaselIconButton as Ze,TopBarDivider as Qe,DeviceSwitch as Xe,InspectorIconButton as _e,PanelResizeHandle as qe,MAX_PANEL_W as en,MIN_PANEL_W_BY_SIDE as nn,panelWidthVars as tn}from"./chunk-ZG6PVMC3.js";import{DEFAULT_NOTICE_WORDS as on,DEFAULT_CHROME_WORDS as rn}from"./chunk-AJSDWWJW.js";import{holderOf as ln,nameOrSomeone as sn}from"./chunk-THWO5YVZ.js";import{DEFAULT_LOCK_WORDS as dn}from"./chunk-RE4LP46F.js";import{useWords as an}from"./chunk-MFIRYGHW.js";import{insertSeams as cn,CanvasDragLayer as pn,CanvasInsert as un}from"./chunk-LDEEFLE3.js";import{DEFAULT_DRAG_WORDS as fn}from"./chunk-KAML3KQH.js";import{createDragSession as hn,useTreeDrag as mn,gapToMoveIndex as gn}from"./chunk-3S5N4HLJ.js";import{useCanvasFrame as yn,LIST_SELECTOR as vn,BLOCK_SELECTOR as kn,useCanvasTyping as bn,useCanvasEvent as Sn,nodeIdAt as wn,frameRectToHost as xn,BLOCK_ATTRIBUTE as zn,drawnBox as Cn}from"./chunk-QIDRJH3S.js";import{queryMainCopy as Nn}from"./chunk-LF3FUSCQ.js";import{ROOT_ID as In,ROOT_SLOT as Bn,zoneKey as On,parseZoneKey as Pn,find as $n,DataError as Mn}from"./chunk-K7BTCBWD.js";import{useRef as Ln,useMemo as jn,useState as An,useEffect as En,useCallback as Tn,useLayoutEffect as Rn,Fragment as Dn,useId as Fn}from"react";import{ColoredBadge as Hn,Tabs as Wn,toast as Vn,readMediaFileDrag as Un,Tooltip as Jn,groupColors as Yn,Dialog as Kn,FormField as Gn,Input as Zn,Button as Qn,MEDIA_FILE_DRAG_TYPE as Xn}from"efficient-shell/ui";import{UndoIcon as _n,RedoIcon as qn,RefreshIcon as et,AddIcon as nt,TrashIcon as tt,EyeOffIcon as ot,EyeIcon as rt,SharedIcon as it,DuplicateIcon as lt}from"efficient-shell/icons/efficient";import{jsx as st,jsxs as dt,Fragment as at}from"react/jsx-runtime";var ct="media-file";function pt({name:e,onMake:n,onCancel:t}){const o=an("screen",ge).shared,[r,i]=An(e),[l,s]=An(!1),d=Fn(),a=Ln(null),c=async()=>{const e=r.trim();if(e&&!l){s(!0);try{await n(e)}finally{s(!1)}}};/* @__PURE__ */
2
- return st(Kn,{open:!0,size:"sm",title:o.makeShared,description:o.makeSharedHint,onClose:t,initialFocus:a,footer:/* @__PURE__ */dt(at,{children:[
3
- /* @__PURE__ */st(Qn,{variant:"secondary",onClick:t,children:o.cancel}),
4
- /* @__PURE__ */st(Qn,{variant:"primary",loading:l,disabled:!r.trim(),onClick:()=>{c()},children:o.makeShared})]}),children:/* @__PURE__ */st("form",{onSubmit:e=>{e.preventDefault(),c()},children:/* @__PURE__ */st(Gn,{label:o.name,htmlFor:d,children:/* @__PURE__ */st(Zn,{id:d,ref:a,value:r,onChange:e=>i(e.target.value)})})})})}var ut=/* @__PURE__ */new WeakSet;function ft(e,n,t){const o=$n(e,n,t);if(!o)return null;const r=o.path.find(e=>"root"!==e.parentId);return r?r.parentId:t}function ht({canvas:e,tabs:n,onSelect:t}){const o=Ln(null),[r,i]=An({}),l=n.map(e=>`${e.id}:${e.below?1:0}`).join("|");return Rn(()=>{const t=e?.document,r=e?.window,l=e?.frame;if(!t||!r||!l||0===n.length)return void i({});let s=0;const d=()=>{s=0;const e=o.current;if(!e)return;const d=xn(l,{left:0,top:0,width:r.innerWidth,height:r.innerHeight},e),a={};for(const o of n){const n=Nn(t,`[${zn}="${r.CSS?.escape?r.CSS.escape(o.id):o.id}"]`),i=n?Cn(n):null;if(!i||0===i.height){a[o.id]=null;continue}const s=xn(l,{left:i.left,top:i.top,width:i.width,height:i.height},e),c=s.top+s.height;if(c<d.top||s.top>d.top+d.height){a[o.id]=null;continue}const p=o.below?c+4:Math.max(s.top,d.top)+6;a[o.id]={left:Math.max(s.left,d.left)+6,top:p}}i(a)},a=()=>{s||(s=r.requestAnimationFrame(d))};d(),r.addEventListener("scroll",a,!0),r.addEventListener("resize",a);const c=new r.MutationObserver(a);return c.observe(t.body,{childList:!0,subtree:!0,attributes:!0}),()=>{s&&r.cancelAnimationFrame(s),r.removeEventListener("scroll",a,!0),r.removeEventListener("resize",a),c.disconnect()}},[e,l]),/* @__PURE__ */st("div",{ref:o,className:"es-band-tabs","aria-hidden":"true",children:n.map(e=>{const n=r[e.id];return n?/* @__PURE__ */st("span",{className:"es-band-tab","data-band-tab":e.id,style:{left:n.left,top:n.top},onClick:n=>{n.stopPropagation(),t(e.id)},children:e.reach?
5
- /* @__PURE__ */st(Jn,{content:e.reach,children:/* @__PURE__ */dt(Hn,{colorClass:Yn("success","solid"),size:"sm",children:[
6
- /* @__PURE__ */st("span",{className:"es-band-tab-mark",children:/* @__PURE__ */st(it,{size:12})}),e.label]})}):/* @__PURE__ */st(Hn,{colorClass:Yn("info","solid"),size:"sm",children:e.label})},e.id):null})})}function mt({expand:e}){/* @__PURE__ */
7
- return st("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:1.9,strokeLinecap:"round",strokeLinejoin:"round",children:/* @__PURE__ */dt(at,e?{children:[
8
- /* @__PURE__ */st("path",{d:"M8 9l4-4 4 4"}),
9
- /* @__PURE__ */st("path",{d:"M8 15l4 4 4-4"})]}:{children:[
10
- /* @__PURE__ */st("path",{d:"M8 4l4 4 4-4"}),
11
- /* @__PURE__ */st("path",{d:"M8 20l4-4 4 4"}),
12
- /* @__PURE__ */st("path",{d:"M5 12h14"})]})})}var gt=`${vn}, ${kn}`;function yt(e,n,t){const o=t-n;if(o<6)return null;if(o<24)return{top:Math.round((n+t)/2),height:Math.round(o)};return{top:Math.round(Math.min(Math.max(e,n+12),t-12))}}var vt="__rungs";var kt="screen:band",bt={duplicate:!0,delete:!0};function St(){const vn=ue(),{target:xn,docId:zn,capabilities:Cn,currentSlug:Fn,siteId:Jn,onPublish:Yn,saveState:Kn,saveConflict:Gn,retrySave:Zn,toggleAutoSave:Qn,flushSave:it,access:St,saveUnreachable:wt=!1,readOnly:xt,readOnlyReason:zt=null}=re(),Ct=O(),Nt=P(),{mediaEditing:It,hasEditGuard:Bt,hasPinnedChrome:Ot}=Cn,{appState:Pt,dispatch:$t,history:Mt,selectedItem:Lt,getSelectorForId:jt,config:At}=Me(e=>e),Et=$(),{first:Tt,firstGroup:Rt,lastGroup:Dt,isSectionGroup:Ft,sectionGroupZone:Ht,panelOf:Wt}=Et,Vt=Wt(Tt),Ut=e=>X(Et,e),Jt=e=>_(Et,e),Yt="node"===Et.firstRow,Kt=Et.band??null,Gt=an("screen",ge),Zt=an("tree",We),Qt=an("drag",fn),Xt=an("notice",on),_t=an("lock",dn),qt=an("menu",Ve),eo=an("styleClipboard",ke),no=an("chrome",rn),to=M()??`/${Fn}`,oo=L(),ro=j(),io=v({readOnly:xt}),lo=v({readOnly:xt,foldIntoHistory:!0}),so=Ln(null),ao=Le(),co=jn(()=>({...io,select:e=>{so.current=e,io.select(e)},commitDocument:(e,n)=>{if(void 0!==n){const t=ao.config;so.current=Ue(e,t,n)}io.commitDocument(e,n)}}),[io,ao]),po=Pt.ui,uo=po.leftSideBarVisible,fo=po.rightSideBarVisible,{options:ho,widths:mo,initial:go,fluid:yo,fit:vo}=A(),[ko,bo]=An(go),So=le(),wo=It&&null!==So,xo=se(),zo=de(),Co=null!==xo||zo,No=ae();E(Lt?.props.id);const{read:Io,write:Bo,forSelection:Oo}=T(),[Po,$o]=An(Io);En(()=>{Bo(Po)},[Po]);const[Mo,Lo]=An(0),jo=Ln(null),Ao=Ln(null),Eo=yn(Ao,{readySelector:gt}),To=bn(Eo),Ro=a(Ao);c(Ao,Eo);const Do=S(),Fo=ln(St),Ho={state:Kn,offline:Do||Kn.failed&&wt,readOnlyReason:zt,editing:Fo?Xt.editing({name:sn(Fo.name,_t),noun:Gt.noun}):null,conflict:null!=Gn,notSaving:Gt.bar.notSaving},Wo=()=>{xt||(Kn.failed?Zn():it())};p(Ao,Eo,Wo);const[Vo,Uo]=An(!1),Jo=Ln(!1),[Yo,Ko]=An(null),[Go,Zo]=An([]),[Qo,Xo]=An(R),_o="puck"===Qo.kind,qo=o(Qo,Lt?.props.id),[er,nr]=An(null);En(()=>{er&&(r(),nr(null))},[er]);const tr=Ln(jt);tr.current=jt;const or=Tn((e,{scroll:n})=>{$o(n=>Oo(e,n)),n&&nr(e);const t=[];let o=e;for(let e=0;e<4;e++){const e=tr.current(o)?.zone;if(!e||!e.includes(":"))break;const n=e.split(":")[0];t.push(n),t.push(e),o=n}0!==t.length&&Mr(e=>{if(t.every(n=>!e.has(n)))return e;const n=new Set(e);return t.forEach(e=>n.delete(e)),n})},[]),rr=Ln(null);En(()=>{const e=rr.current;rr.current=null;const n=null==Lt?.props.id?null:String(Lt.props.id);Xo(t=>e&&e.id===n?e.mode:"part"===t.kind&&"nodeId"in t&&t.nodeId===n?t:Wt(Lt?.type)??R);const t=Lt?.props.id,o=so.current;if(so.current=null,!t)return;const r=jt(t);or(String(t),{scroll:!i(o,r??null,ze)})},[Lt?.props.id,or]);const ir=Tn(e=>{Xo(n=>D(n,e)?n:e),$t({type:"setUi",ui:{rightSideBarVisible:!0}})},[$t]),lr=Ln(()=>{});lr.current=(e,n)=>{const t=e?Oi(e.zone??ze)[e.index]?.props.id:null,o=null==t?null:String(t),r=null==Lt?.props.id?null:String(Lt.props.id);Xo(e=>D(e,n)?e:n),o!==r&&(rr.current={id:o,mode:n},co.select(e))};const sr=Tn((e,n)=>lr.current(e,n),[]),dr={kind:Qo.kind,mode:Qo,open:ir,show:e=>Xo(e),reveal:()=>{fo||$t({type:"setUi",ui:{rightSideBarVisible:!0}})},select:sr},ar=F(dr,{data:Pt.data,selected:Lt??null,zoneOf:e=>jt(e)?.zone,readOnly:Boolean(xt),select:e=>{Xo(R),co.select({index:e})},replace:(e,n)=>co.replaceComponent(ze,e,n),scrollTo:e=>l(e)},{device:ko,refreshes:Mo},{setView:$o,reveal:()=>{uo||$t({type:"setUi",ui:{leftSideBarVisible:!0}})}}),cr=ar.resolveLeftView?ar.resolveLeftView(Po):"sections",pr=H(),{isLockedBlock:ur,duplicateBlocked:fr,nestDepth:hr,newSectionNode:mr,canAddTo:gr,blockIsOffered:yr}=pr,vr=W(),{labelAtLevel:kr,Icon:br,useProducts:Sr}=vr,wr=vr.rowName?(e,n,t)=>vr.rowName(e,n,t):void 0,xr=Tn(e=>{$t({type:"setUi",ui:{rightSideBarVisible:!0}}),l(e),or(e,{scroll:!0})},[$t,or]),{selectNode:zr,openPartId:Cr}=y({mode:Qo,setMode:Xo,onOpenPart:xr}),[Nr,Ir]=An(null);fe(null!==Nr,()=>Ir(null));const Br=h(V()),Or=Br.collapsed,Pr=Br.panelWidths,[$r,Mr]=An(()=>{if("undefined"==typeof window)/* @__PURE__ */return new Set;try{const e=window.localStorage.getItem(Or);return new Set(e?JSON.parse(e):[])}catch{/* @__PURE__ */
13
- return new Set}});En(()=>{try{window.localStorage.setItem(Or,JSON.stringify([...$r]))}catch{}},[$r]);const[Lr,jr]=An(()=>{if("undefined"==typeof window)return{...m};try{const e=window.localStorage.getItem(Pr);if(!e)return{...m};const n=JSON.parse(e);return{left:g(Number(n.left)||m.left,"left"),right:g(Number(n.right)||m.right,"right")}}catch{return{...m}}});En(()=>{const e=setTimeout(()=>{try{window.localStorage.setItem(Pr,JSON.stringify(Lr))}catch{}},300);return()=>clearTimeout(e)},[Lr]);const Ar=Tn((e,n)=>jr(t=>{const o="function"==typeof n?n(t[e]):n;return t[e]===o?t:{...t,[e]:o}}),[]),Er=Tn(e=>Ar("left",e),[Ar]),Tr=Tn(e=>Ar("right",e),[Ar]),Rr=e=>$r.has(e),Dr=e=>Mr(n=>{const t=new Set(n);return t.has(e)?t.delete(e):t.add(e),t}),Fr=Ln(!1),Hr=Ln(null);En(()=>{if(Fr.current&&!Vo){const e=Hr.current,n=e&&e.isConnected&&!e.closest('[aria-hidden="true"]')?e:null;(n??Ao.current?.querySelector(`button[aria-label="${CSS.escape(Gt.add.title)}"]`))?.focus(),Hr.current=null}Fr.current=Vo},[Vo]),En(()=>{if(!Vo||!Ro)return;const e=e=>{"Escape"===e.key&&sl()};return Ro.addEventListener("keydown",e),()=>Ro.removeEventListener("keydown",e)},[Vo,Ro]),fe(Vo,()=>sl()),En(()=>{!uo&&Vo&&(Uo(!1),Ko(null),Jo.current=!1)},[uo]);const Wr=U(),Vr=(e,n="success",t)=>{if(Wr)return void(t?Wr(e,"error"===n?"error":"info",t):Wr(e,"error"===n?"error":"info"));const o={sound:!1,action:t?.action,onClose:t?.onClose};"error"===n?Vn.error(e,{...o,duration:t?.duration??3200}):Vn.success(e,{...o,duration:t?.duration??1900})},Ur=Ln(null),[Jr,Yr]=An(0),[Kr,Gr]=An(0),Zr=J(),Qr=Ln(null),Xr=e=>Math.max(0,e.clientHeight-(Qr.current?.offsetHeight??0));En(()=>{const e=Ur.current;if(!e)return;const n=()=>{Yr(e.clientWidth),Gr(Xr(e))};n();const t=new ResizeObserver(n);return t.observe(e),Qr.current&&t.observe(Qr.current),()=>t.disconnect()},[]),Rn(()=>{Ur.current&&(Yr(Ur.current.clientWidth),Gr(Xr(Ur.current)))},[Lr,uo,fo]);const _r=ko===yo?Jr>0?Jr:mo[yo]:mo[ko],qr=Jr>0?Math.min(Jr/_r,"shrink"===vo?1:2):1,ei=_r*qr,ni=Jr>0&&ei>Jr+1,ti={width:ei,height:Kr||"100%",flex:"none",position:"relative"},oi={width:_r,height:Kr?Kr/qr:"100%",maxHeight:"none",transform:1!==qr?`scale(${qr})`:void 0,transformOrigin:"top left"},ri=()=>$t({type:"setUi",ui:{leftSideBarVisible:!uo}}),ii=()=>$t({type:"setUi",ui:{rightSideBarVisible:!fo}}),li=e=>{Vo&&(Uo(!1),Ko(null),Jo.current=!1,uo&&Po===e)||($o(e),uo||$t({type:"setUi",ui:{leftSideBarVisible:!0}}))},si=()=>{ie(vn,{accept:"image/*",title:no.mediaLibrary})},di=()=>{Xo(R),co.select(null),d()},ai=()=>{Xo(Vt??R),fo||$t({type:"setUi",ui:{rightSideBarVisible:!0}})},ci=Pt.data.content??[],pi=()=>{const e=ci.findIndex(Ut),n=ci.findIndex(Jt);return{floor:e>=0?e+1:0,cap:n>=0?n:ci.length}},ui=At,fi=pr.stripCopy,hi=n=>e(n,fi),mi=ne(),gi=Je({data:Pt.data,config:ui,readOnly:Boolean(xt),clipboard:mi,strip:fi?e=>fi(e):void 0,afterRemove:"none",stepBounds:(e,n)=>{if(e.parentId!==In||e.slot!==Bn)return{min:0,max:n-1};const{floor:t,cap:o}=pi();return{min:t,max:o-1}},commit:(e,{select:n})=>{void 0!==n&&Xo(R);const t=void 0===n||"node"===n?.kind?n:null;co.commitDocument(e,t)}}),yi=pe(),[vi,ki]=An(null),bi=e=>{const n=ci.find(n=>String(n.props.id)===e),t=Et.shared;n&&t&&gi.swap(e,t.detach(n))},Si=e=>{const n=$n(Pt.data,At,e);if(!n)return!1;const t=On(n.place),o=n.node,r=t===ze?Ni(o):Fi(o),i=t===ze?Et.shared?.usedOn(o):null;return!!gi.remove(e)&&(Vr(i?Gt.shared.removed({count:Math.max(0,i.length-1)}):Gt.deleted({name:r}),"success",{duration:8e3,action:{label:Gt.bar.undo,onClick:()=>{gi.restore(n.node,n.place)}}}),!0)},wi={...gi,remove:Si},xi=e=>kr(e,"block",At.components[e]?.label??e),zi=Tn(e=>At.components[e]?.defaultProps??{},[At]),Ci=e=>kr(e,"section",xi(e)),Ni=e=>be({type:e.type,props:e.props??{}},Ci(e.type),wr),{nodeAddresses:Ii,zoneItems:Bi}=jn(()=>{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>=Ne)return;const s=/* @__PURE__ */new Map;for(const{child:e,zone:t}of Ie(At,n))s.set(t,[...s.get(t)??[],e]);for(const[e,n]of s)t(n,e,i+1)})};return t(ci,ze,0),{nodeAddresses:e,zoneItems:n}},[ci,At]),Oi=Tn(e=>Bi.get(e)??[],[Bi]),Pi=e=>{const n=Ii.get(e);return n?Oi(n.zone)[n.index]:void 0},$i=e=>q(pr,At,e),Mi=e=>{if(!pr.slotsOf||e===ze)return null;const n=e.lastIndexOf(":");if(n<=0)return null;const t=Pi(e.slice(0,n));if(!t)return null;const o=$i(t).filter(e=>e.rung),r=o.findIndex(t=>t.slot===e.slice(n+1));return r<0?null:{node:t,slot:o[r],position:r}},Li=(()=>{if(!Y(Qo))return null;const e=`${Qo.nodeId}:${Qo.slot}`;return Mi(e)?.slot.panel===Qo.kind?e:null})(),ji=Ln(null);En(()=>{const e=ji.current;if(ji.current=null,!Li||!Y(Qo))return;const n=Qo.nodeId;or(n,{scroll:e!==Li}),Mr(e=>{if(!e.has(n))return e;const t=new Set(e);return t.delete(n),t})},[Qo]);const Ai=(e,n,t)=>{const o=String(e.props.id);if(!n.panel)return void(e=>{const n=Ii.get(e);n&&(n.zone===ze?el(n.index):Il(n.zone,n.index,e,Pi(n.zone.slice(0,n.zone.lastIndexOf(":")))?.type??""))})(o);const r={kind:n.panel,nodeId:o,slot:n.slot},i=`${o}:${n.slot}`;t&&Li!==i&&(ji.current=i),sr(null,r),fo||$t({type:"setUi",ui:{rightSideBarVisible:!0}}),l(o)},Ei=(e,n,t)=>{const o=`${e}:${n}`;if(Mr(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;Li!==o&&(ji.current=o);sr(null,{kind:t,nodeId:e,slot:n})},Ti=(e,n,t)=>{if(xt||!pr.moveSlot)return;const o=Pi(e),r=o?$i(o).filter(e=>e.rung):[],i=r[n];if(!i)return;const l={parentId:e,slot:vt,index:n},s=gn(l,{...l,index:Math.min(Math.max(t,0),r.length)});if(s===n)return;const d=pr.moveSlot(e,n,s);"string"==typeof d&&Ei(e,d,i.panel)},Ri=Sr(),Di=jn(()=>{const e=/* @__PURE__ */new Map;for(const n of Ri??[])e.set(n.slug,n.name);return e},[Ri]),Fi=e=>Se(e,xi,vr.plainText,e=>Di.get(e),vr.rowName),Hi=(e,n)=>{const t=At.components[e.type]?.fields,o=n===ze||ql(n)?"section":"block",r=n===ze&&(Ut(e)||Jt(e)||Ft(e.type)),i="block"===o?we(t):r?null:xe(t);return vr.renamePropOf?vr.renamePropOf(e,o,i):i},Wi=(e,n,t,o)=>{if(!(!xt&&Nr?.zone===e&&Nr.index===n))return;const r=(t,o)=>{Ir(null),o&&((e,n,t)=>{const o=Oi(e)[n];if(!o)return;const r=Hi(o,e);r&&co.replaceComponent(e,n,{...o,props:{...o.props,[r]:t.trim()}})})(e,n,t)};/* @__PURE__ */
14
- return st("input",{className:"es-tree-rename",defaultValue:o,autoFocus:!0,"aria-label":Gt.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)},Vi=t(K(),eo),Ui=Vi.scope({target:xn,siteId:Jn,docId:zn}),Ji=At,Yi=(e,n)=>n===ze?Ci(e):xi(e),Ki=(e,n,t)=>{const o=Vi.plan(Ui,t,Yi(t.type,e),Ji);o&&(o.changed&&co.replaceComponent(e,n,{...t,props:{...o.props,id:t.props.id}}),Vr(o.message))},Gi=te({nodesIn:Oi,nodeAt:(e,n)=>Oi(e)[n]??null,labelOf:(e,n)=>n===ze?Ci(e):xi(e),renamePropOf:Hi,beginRename:(e,n)=>Ir({zone:e,index:n}),history:{hasPast:Mt.hasPast,hasFuture:Mt.hasFuture,back:()=>Mt.back(),forward:()=>Mt.forward()},openPageSettings:()=>{co.select(null),Xo(R)},pageSettingsLabel:Gt.pageSettings,words:{menu:qt,styleClipboard:eo,screen:Gt.menu},readOnly:Boolean(xt),collapseAll:()=>Mr(new Set(Oi(ze).map(e=>String(e.props.id)))),onPasteRefused:e=>Vr(e?Gt.pasteRefused({name:e.label}):Gt.menu.clipboardRefused,"error"),canPasteAt:(e,n)=>ts(e,n),menuRows:(e,n,t)=>{const o=ar.menuRows?.(e,n,t)??null,r=((e,n)=>{const t=Et.shared;if(!t||n!==ze)return null;const o=t.usedOn(e);if(o){const n={pick:[{label:Gt.shared.onPages({count:o.length}),onClick:()=>{},children:o.map(e=>({label:e.title,onClick:()=>t.openPage(e)}))}]};return xt||ur(e.type,e)?n:{...n,change:[{label:Gt.shared.detach,onClick:()=>bi(e.props.id)}],remove:[{label:Gt.shared.removeFromPage,danger:!0,onClick:()=>{Si(e.props.id)}}]}}return xt||Ut(e)||Jt(e)||Ft(e.type)?null:z(yi)?{change:[{label:Gt.shared.makeShared,onClick:()=>ki({id:e.props.id,name:Ni(e)})}]}:null})(e,n);if(!r)return o;return Object.fromEntries(["pick","make","change","remove"].map(e=>[e,[...o?.[e]??[],...r[e]??[]]]).filter(([,e])=>e.length>0))},isLocked:e=>ur(e.type,e),duplicateBlocked:e=>fr(Pt.data,e),permits:e=>{const n=Ce(At,e.type);return Et.shared?.usedOn(e)?{...n,delete:!1}:n},nodeOps:wi,isPinned:(e,n)=>n===ze&&(Ut(e)||Jt(e)),sectionBand:pi,locate:e=>Ii.get(e)??null,rowNameOf:(e,n)=>n===ze?Ni(e):Fi(e),selectAt:(e,n,t,o)=>{e===ze?el(n):Il(e,n,t,o??"")},slotRung:e=>{const n=Mi(e);return n?.slot.panel?{label:n.slot.label,select:()=>Ai(n.node,n.slot,!1)}:null},style:{held:()=>ye(Ui),canCopy:e=>Vi.rows(Ji,e).some(e=>!1!==e.counted),copy:(e,n)=>Vi.copy(Ui,e,Yi(e.type,n),Ji),paste:(e,n,t)=>Ki(e,n,t)},keys:Nt?{target:Ro,selected:()=>{const e=Pt.ui.itemSelector;return e?{zone:e.zone??ze,index:e.index}:null},held:()=>mi.get(),readOnly:Boolean(xt),onDone:({done:e,name:n})=>{"copied"===e&&Vr(Gt.copied({name:n}))}}:void 0},Eo),Zi=Ln({copy:(e,n)=>{},paste:(e,n,t)=>{},at:()=>null,readOnly:!1});En(()=>{Zi.current={copy:(e,n)=>Vi.copy(Ui,e,Yi(e.type,n),Ji),paste:Ki,at:()=>{const e=Pt.ui.itemSelector;if(!e)return null;const n=e.zone??ze,t=Oi(n)[e.index];return t?{zone:n,index:e.index,node:t}:null},readOnly:Boolean(xt)}});const Qi=Tn(e=>{const n=ve(e);if(!n)return;const t=Zi.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))},[]);En(()=>{if(!Ro)return;const e=e=>Qi(e);return Ro.addEventListener("keydown",e),()=>Ro.removeEventListener("keydown",e)},[Qi,Ro]),Sn(Eo,"keydown",Qi);const Xi=ci.map(e=>e.props.id).join("|");En(()=>{const e=Eo?.document??null,n=Eo?.window??null;let t=0;const o=[],r=()=>{if(!e)return void Zo(e=>e.length?[]:e);const n=ci.findIndex(Jt),t=n>=0?n:ci.length,o=n=>{const t=ci[n]?.props?.id;return null==t?null:Nn(e,`[data-puck-component="${CSS.escape(String(t))}"]`)},r=e=>e?[...e.querySelectorAll(kn)].map(e=>e.getBoundingClientRect()).filter(e=>e.width>0||e.height>0):[],i=[];for(let e=ci.length>0&&!Ut(ci[0])?0:1;e<=t;e++){const n=o(e),t=o(e-1),l=n?.getBoundingClientRect()??null,s=t?.getBoundingClientRect()??null;if(!l&&!s)continue;const d=yt(l&&s?(s.bottom+l.top)/2:l?0===e?l.top+12:l.top:s.bottom,Math.max(0===e?0:-1/0,...r(t).map(e=>e.bottom)),Math.min(1/0,...r(n).map(e=>e.top)));d&&i.push({...d,index:e})}Zo(e=>function(e,n){if(e.length!==n.length)return!1;for(let t=0;t<e.length;t++)if(e[t].top!==n[t].top||e[t].index!==n[t].index||e[t].height!==n[t].height)return!1;return!0}(e,i)?e:i)},i=()=>{cancelAnimationFrame(t),t=requestAnimationFrame(r)};if(!e||!n)return void r();n.addEventListener("scroll",i,{passive:!0});const l=new ResizeObserver(i);return l.observe(e.documentElement),r(),o.push(setTimeout(r,150),setTimeout(r,450)),()=>{cancelAnimationFrame(t),o.forEach(clearTimeout),n.removeEventListener("scroll",i),l.disconnect()}},[Eo,Xi,ko,qr,uo,fo,Lt?.props.id]);const _i=Eo?.document??null,qi=Eo?.window??null;En(()=>{const e=jo.current;if(!e||!_i||!qi)return;const n=[],t=()=>{const n=Nn(_i,`[data-puck-component="${CSS.escape(e.id)}"]`);if(!n)return!1;const t=n.getBoundingClientRect().top-e.offset;return Math.abs(t)>1&&qi.scrollTo({left:qi.scrollX,top:qi.scrollY+t,behavior:"instant"}),!0};return jo.current=null,t()&&n.push(setTimeout(t,150),setTimeout(t,450)),()=>n.forEach(clearTimeout)},[_i,qi]);const el=e=>{Xo(R),co.select({index:e}),ar.sectionPressed?.(ci[e]);const n=ci[e]?.props?.id;n&&l(n)},nl=e=>{const{floor:n,cap:t}=pi(),o=e=>Math.min(Math.max(n,e),t);if("number"==typeof e)return o(e);const r=Lt&&Qo.kind!==Vt?.kind?ci.findIndex(e=>e.props.id===Lt.props.id):-1;return o(r>=0?r+1:t)},tl=(e,n)=>{const{floor:t,cap:o}=pi(),r=Math.min(Math.max(n,t),o),i=e<r?r-1:r;return i===e?{moved:!1,dest:e}:(co.reorderComponent(ze,e,i),co.select({index:i}),{moved:!0,dest:i})},ol=(e,n,t,o)=>{Xo(R),co.select(o?{index:o.index,zone:o.zone}:{index:e}),l(n),Vr(Gt.sectionAdded({name:t}))},rl=(e,n)=>{const t=nl(n),o=mr(e,{nodeDefaults:zi,newNodeId:Oe,sectionLabel:Ci,blockIsOffered:yr}),r=o?co.insertNode(ze,t,o):co.insertSection(e,t);return ol(t,r,Ci(e),o?((e,n,t)=>{if(e.type===t)return null;const o={at:null},r=(e,n,i)=>{const l=i.filter(n=>n===e.type).length;for(const{child:s,zone:d,index:a}of Ie(At,e)){if(s.type===t&&(!o.at||n>o.at.depth)){const r=gr(e.type,l,d.slice(d.lastIndexOf(":")+1)),i=r?.choices??(r?.spec?[{type:r.spec.childType,label:r.spec.childType}]:[]);null!==r&&"footer"!==r.source&&`${e.props.id}:${r.slot}`===d&&i.some(e=>e.type===t)&&(o.at={zone:d,index:a,depth:n})}r(s,n+1,[...i,e.type])}};return r({type:e.type,props:{...e.props,id:n}},1,[]),o.at?{zone:o.at.zone,index:o.at.index}:null})(o,r,e):null),t},il=e=>ll(ze,e),ll=(e,n)=>{Hr.current=document.activeElement??null,Ko(null===n?null:{zone:e,index:n}),Uo(!0),uo||(Jo.current=!0,$t({type:"setUi",ui:{leftSideBarVisible:!0}}))},sl=()=>{Uo(!1),Ko(null),Jo.current&&$t({type:"setUi",ui:{leftSideBarVisible:!1}}),Jo.current=!1},dl=(e,n)=>vr.rowName?n?Ut(e)?vr.rowName(e,"section",Gt.header):Jt(e)?vr.rowName(e,"section",Gt.footer):Ft(e.type)?vr.rowName(e,"section",xi(e.type)):Ni(e):Fi(e):n?Ci(e.type):xi(e.type),al=e=>n=>{e()},cl=(e,n,t)=>{if(xt)return null;const o=Oi(e)[n];return o&&!Ce(At,o.type).delete||o&&ur(o.type,o)?null:/* @__PURE__ */st(Fe,{kind:"delete",label:e===ze&&o&&Et.shared?.usedOn(o)?Gt.shared.removeFromPage:Gt.deleteNamed({name:t}),onClick:()=>((e,n)=>{const t=Oi(e)[n]?.props?.id;null!=t&&Si(String(t))})(e,n),children:/* @__PURE__ */st(tt,{size:15})})},pl=e=>vr.rowPreview?.(e)||void 0,ul=e=>vr.rowMarks?.(e)??void 0,fl=(e,n,t)=>vr.rowActions?.(e,n,t)??null,hl=(e,n,t,o)=>{if(xt)return null;if(ur(t.type,t))return null;const r=Boolean(t.props._hidden);/* @__PURE__ */
15
- return st(Fe,{kind:"eye",label:r?Gt.showNamed({name:o}):Gt.hideNamed({name:o}),onClick:()=>gl(e,n,t),children:/* @__PURE__ */st(r?ot:rt,{size:14,strokeWidth:1.8,strokeLinecap:void 0,strokeLinejoin:void 0})})},ml=e=>Ws(ze,e),gl=(e,n,t)=>{co.replaceComponent(e,n,{...t,props:{...t.props,_hidden:!t.props._hidden}})},yl=e=>Be(At,e),vl=e=>Ie(At,e),kl=e=>pr.slotsOf?$i(e).map(n=>({slot:n.slot,rung:n.rung?n:null,kids:Pe(e,n.slot)})):[{slot:null,rung:null,kids:vl(e)}],bl=e=>pr.slotsOf?kl(e).flatMap(e=>e.kids):vl(e),Sl=e=>Boolean(pr.slotsOf)&&$i(e).some(e=>e.rung),wl=(e,n,t)=>null===t?void 0===n?gr(e):gr(e,n):gr(e,n,t),xl=(e,n,t)=>{const o=$e(At,e.type,n)&&(t||bl(e).length>0||Sl(e));return{collapsible:o,folded:o&&Rr(String(e.props.id))}},zl=(e,n,t)=>kl(e).flatMap(o=>{const r=o.rung?n+1:n,i=o.kids.flatMap(({child:e})=>xl(e,r,t(e.type)).collapsible?[String(e.props.id),...zl(e,r+1,t)]:[]);return o.rung?[`${e.props.id}:${o.rung.slot}`,...i]:i}),Cl=e=>bl(e).length>0||Sl(e)||Boolean(gr(e.type)),Nl=e=>Boolean(gr(e)),Il=(e,n,t,o)=>{if(Xo(R),gr(o)?.spec?.slider){const t=e.split(":")[0];s(t,n),co.select({index:n,zone:e}),l(t)}else co.select({index:n,zone:e}),l(t)},Bl=(e,n,t,o,r)=>{const i=`${e}:${n}`;co.insertComponent(i,t,o),gr(r)?.spec?.slider?requestAnimationFrame(()=>{s(e,o),co.select({index:o,zone:i})}):co.select({index:o,zone:i})},Ol=Ln(/* @__PURE__ */new Set);En(()=>{ci.forEach(e=>{const n=gr(e.type)?.spec;if(!n)return;const t=e.props.id;if(Ol.current.has(t))return;Ol.current.add(t);if((Array.isArray(e.props[n.slot])?e.props[n.slot]:[]).length>0)return;if(n.skipSeed?.(e.props))return;const o=`${t}:${n.slot}`,r=n.legacy?.(e.props)??[];(r.length?r:n.seeds(zi)).forEach((e,t)=>lo.seedChild(o,t,n.childType,e))})},[ci,lo,zi]);const Pl=Ln(/* @__PURE__ */new Set);En(()=>{ci.forEach((e,t)=>{const o=e.props.id;if(Pl.current.has(o))return;const r=n(e,yl(e.type));Pl.current.add(o),r&&lo.replaceComponent(ze,t,{...e,props:r})})},[ci,lo]),G(lo,At);const $l=ci.findIndex(Jt),Ml=$l>=0?ci[$l]:null,Ll=Yt?ci.findIndex(Ut):-1,jl=Ll>=0?ci[Ll]:null,Al=Et.groupTab,El=jn(()=>Al?e=>Ft(e.type):void 0,[Al]),Tl=Boolean(Et.groupBadge),Rl=Et.sharedReach,Dl=e=>Rl?.(e)??void 0,Fl=jn(()=>Rl?new Set(ci.filter(e=>Dl(e)).map(e=>String(e.props.id))):null,[ci,Rl]),Hl=jn(()=>Fl?e=>Fl.has(e):void 0,[Fl]),Wl=Et.first?Rl?.({type:Et.first,props:{id:""}})??void 0:void 0,Vl=Et.groupBadge?/* @__PURE__ */st("span",{className:"es-tree-group-badge",children:/* @__PURE__ */st(Hn,{tone:"info",size:"xs",children:Et.groupBadge})}):void 0,Ul=ci.find(e=>e.type===Rt)??null,Jl=ci.find(e=>e.type===Dt)??null,Yl=$l>=0?$l:ci.length,Kl=[];ci.forEach(e=>{Jt(e)||(Cl(e)&&Kl.push(String(e.props.id)),Kl.push(...zl(e,1,Nl)))}),Ml&&(Kl.push(String(Ml.props.id)),Kl.push(...zl(Ml,1,Nl)));const Gl=Kl.length>0&&Kl.every(e=>$r.has(e)),Zl=e=>{const n=vr.blockRowName(e,xi);return vr.rowName?vr.rowName(e,"block",n):n},Ql=(e,n,t,o)=>{const r=Oi(e)[t];if(!r)return;const i={...Pn(e),index:t},l={...Pn(n),index:Math.min(Math.max(o,0),Oi(n).length)},s=gn(i,l);if(e!==n||s!==t)try{gi.move(String(r.props.id),{...l,index:s})}catch(e){if(!(e instanceof Mn))throw e}},Xl=e=>{const n=/* @__PURE__ */new Set,t=e=>{for(const{child:o,zone:r}of vl(e))n.add(r),t(o)};for(const t of yl(e.type))n.add(`${e.props.id}:${t}`);return t(e),n},_l=e=>{let n=e.slice(0,e.indexOf(":"));for(let e=0;e<64;e++){const e=Ii.get(n);if(!e)return null;if(e.zone===ze)return n;n=e.zone.slice(0,e.zone.indexOf(":"))}return null},ql=e=>{const n=e.slice(0,e.indexOf(":")),t=ci.find(e=>Ft(e.type)&&String(e.props.id)===n);return t&&Ht(n)===e?t:null},es=(e,n)=>{const t=ql(e);return!t||(!Et.groupAccepts||Et.groupAccepts(t.type,n,Oi(e).length))},ns=(e,n,t)=>{if(e.rung){const t=Pi(e.rung.nodeId),o=t?$i(t).filter(e=>e.rung).length:0;return n.parentId===e.rung.nodeId&&n.slot===vt&&n.index>=0&&n.index<=o}if(n.slot===vt)return!1;if(e.add)return is(e.add,n);const o=On(n);if(Ft(e.type))return!1;const r=ql(o),i=ql(e.zone);if(r||i)return!(!r||!i)&&(!(r!==i&&!es(o,e.type))&&(n.index>=0&&n.index<=Oi(o).length));if(e.zone===ze||o===ze){if(e.zone!==o)return!1;const{floor:t,cap:r}=pi();return n.index>=t&&n.index<=r}if(n.index<0||n.index>Oi(o).length)return!1;if(e.zone===o)return!0;const l=Ml&&!Et.lastIsOpen?String(Ml.props.id):null;return(!l||_l(e.zone)!==l&&_l(o)!==l)&&((e,n,t,o)=>{if(e===n)return!0;const r=o??Oi(e)[t];if(!r)return!1;const i=n.split(":")[0],l=Ii.get(i),s=l?Oi(l.zone)[l.index]:void 0;if(!s)return!1;if(!o&&Xl(r).has(n))return!1;const d=gr(s.type,hr(Pt?.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?.(Oi(n),r))})(e.zone,o,e.index,t)},ts=(e,n)=>{const t=On(e.from),o=e.node;return t===On(n)?es(t,o.type):ns({id:String(o.props?.id??""),zone:t,index:-1,type:o.type},n,o)},os=e=>{const n=e.slice(0,e.indexOf(":")),t=Ii.get(n),o=t?Oi(t.zone)[t.index]:void 0;if(!t||!o)return null;const r=gr(o.type,hr(Pt?.data,o.type,n),e.slice(e.lastIndexOf(":")+1));if(!r||`${n}:${r.slot}`!==e)return null;if("footer"===r.source)return null;const i=B(r.choices??(r.spec?[{type:r.spec.childType,label:xi(r.spec.childType)}]:[])),l=Mi(e);return{parent:o,parentId:n,target:r,choices:i,parentName:l?l.slot.label:dl(o,t.zone===ze)}},rs=(e,n)=>{if("section"!==e.kind)return e;const t=On(n);return t===ze||ql(t)?e:os(t)?.choices.some(n=>n.type===e.type)?{kind:"block",type:e.type}:e},is=(e,n)=>{const t=rs(e,n),o=On(n);if("shared"===t.kind){if(o!==ze||!Et.shared?.nodeOf(t.section))return!1;const{floor:e,cap:r}=pi();return n.index>=e&&n.index<=r}if("block"!==t.kind){if(ql(o)){const e="section"===t.kind?t.type:t.template.node.type;return es(o,e)&&n.index>=0&&n.index<=Oi(o).length}if(o!==ze)return!1;const{floor:e,cap:r}=pi();return n.index>=e&&n.index<=r}if(o===ze)return!1;const r=os(o);return!(!r||!r.choices.some(e=>e.type===t.type))&&!r.target.spec?.addBlocked?.(Oi(o))},ls=(e,n)=>{const t=rs(e,n);if("block"!==t.kind&&ql(On(n)))return void((e,n,t)=>{const o="section"===e.kind?e.type:"template"===e.kind?e.template.node.type:null;if(o&&es(n,o)){if("section"===e.kind)co.insertComponent(n,e.type,t);else{if("template"!==e.kind)return;co.insertNode(n,t,hi(e.template.node))}Xo(R),co.select({index:t,zone:n})}})(t,On(n),n.index);if("section"===t.kind)return void rl(t.type,n.index);if("template"===t.kind)return void((e,n,t)=>{const o=nl(t),r=co.insertNode(ze,o,n);ol(o,r,e)})(t.template.name,hi(t.template.node),n.index);if("shared"===t.kind){const e=Et.shared?.nodeOf(t.section);if(!e)return;const o=nl(n.index);return void(gi.restore(e,{parentId:In,slot:Bn,index:o})&&ol(o,e.props.id,t.section.title))}const o=On(n),r=os(o);r&&(r.target.spec?Bl(r.parentId,r.target.slot,t.type,n.index,r.parent.type):((e,n,t)=>{co.insertComponent(e,n,t),Xo(R),co.select({index:t,zone:e})})(o,t.type,n.index))},ss=(e,n)=>{e.media?function(e){const n=Ts();if(!n||!js)return;Ds(n).then(n=>{n&&function(e,n){if(!js)return;const t=js.create(e,{nodeDefaults:zi,newNodeId:Oe,sectionLabel:Ci,blockIsOffered:yr}),o=On(n);if(o===ze){const e=nl(n.index),o=co.insertNode(ze,e,t);return void ol(e,o,Ci(t.type))}co.insertNode(o,n.index,t),Xo(R),co.select({index:n.index,zone:o})}(n,e)})}(n):e.rung?Ti(e.rung.nodeId,e.index,n.index):e.add?ls(e.add,n):e.zone===ze?tl(e.index,n.index):Ql(e.zone,On(n),e.index,n.index)},[ds]=An(()=>hn()),as=mn({keyOf:e=>e.id,readOnly:Boolean(xt),session:ds,canDrop:ns,onDrop:ss,onStep:(e,n)=>{e.rung?Ti(e.rung.nodeId,e.index,n<0?e.index-1:e.index+2):e.zone===ze?((e,n)=>{const t=Ci(ci[e]?.type??""),o=tl(e,n<0?e-1:e+2);if(!o.moved)return void Vr(n<0?Gt.sectionFirst({name:t}):Gt.sectionLast({name:t}));const{floor:r,cap:i}=pi();Vr(Gt.sectionMoved({name:t,n:o.dest-r+1,total:i-r}))})(e.index,n):Ql(e.zone,e.zone,e.index,n<0?e.index-1:e.index+2)}}),cs=Tn(e=>{const{floor:n,cap:t}=pi(),o=[];for(const r of e.nodes){const e=On(r.place),i=Oi(e)[r.place.index];if(!i||String(i.props.id)!==r.id)continue;if(Ut(i)||Jt(i)||ur(i.type,i))continue;if(Ft(i.type))continue;const l=Boolean(ql(e)),s=e===ze||l;e===ze&&t-n<2||o.push({key:r.id,item:{id:r.id,zone:e,index:r.place.index,type:i.type},box:r.box,label:s?Ci(i.type):Fi(i),from:r.place})}const r=e.zones.flatMap(e=>{const n=On(e.list);if(n===ze&&0===e.children.length)return[{...e,addLabel:Gt.addSection,addAlways:!0}];const t=os(n),o=t?.target.spec?.addLabel;return e.children.length>0||Boolean(t?.choices.length)||Boolean(ql(n))?[o?{...e,addLabel:o}:e]:[]}),i=r.flatMap(e=>{const n=On(e.list),t=n===ze||ql(n)?null:os(n);return t?.choices.length?cn(e,t.target.spec?.addLabel??Gt.addBlockHere):[]});return{sources:o,zones:r,seams:i}},[Pt.data]),ps=null==Lt?.props.id?null:String(Lt.props.id),us=Tn(e=>{const n=At,t=e=>!e.item.rung&&null!==$n(Pt.data,n,e.item.id),o=e[e.length-1];if(!t(o))return o;const r=n=>e.find(e=>t(e)&&e.item.id===n),i=r(ps);return i||(r(Ye(Pt.data,n,o.item.id,ps,El))??o)},[Pt.data,At,ps,El]),[fs,hs]=An(null),ms=Boolean(Al||Rl);Sn(Eo,"mouseover",e=>{if(!ms)return;const n=wn(e.target),t=n?ft(Pt.data,At,n):null;t!==fs&&hs(t)}),Sn(Eo,"mouseout",e=>{ms&&!e.relatedTarget&&hs(null)});const gs=e=>Ut(e)||Jt(e)||Ft(e.type),ys=e=>{const n=Ft(e.type)?xi(e.type):Ut(e)?Gt.header:Jt(e)?Gt.footer:null;return null===n?Ni(e):vr.rowName?vr.rowName(e,"section",n):n},vs=[];if(ms){const e=ps?ft(Pt.data,At,ps):null;for(const n of/* @__PURE__ */new Set([e,fs])){const e=n?ci.find(e=>String(e.props.id)===n):void 0;if(!e)continue;const t=Ut(e)||e.type===Rt,o=Dl(e);if(o){vs.push({id:String(e.props.id),label:ys(e),below:t,reach:o});continue}if(!Al||!gs(e))continue;const r=Al(e);r&&vs.push({id:String(e.props.id),label:r,below:t})}}const ks=pe(),bs=Ln(null);En(()=>{const e=Et.changeNotice;if(!e)return;const n=JSON.stringify(ci.filter(gs)),t=bs.current;if(bs.current={doc:zn,bands:n,index:Mt.index},!t||t.doc!==zn||t.bands===n)return;Mt.hasPast&&Mt.index>=t.index&&!ut.has(ks)&&(ut.add(ks),Vr(e,"success",{action:{label:Gt.bar.undo,onClick:()=>Mt.back()},duration:8e3}))},[ci]);const Ss=e=>{Xo(R),co.select(e.zone===ze?{index:e.index}:{index:e.index,zone:e.zone})},ws=Z(),xs=()=>({data:Pt.data,device:ko,ops:co,inspector:dr}),zs=ws?.model,Cs=jn(()=>zs?e=>zs(e,cs(e),xs()):cs,[zs,cs,ko]),Ns=ws?.measure,Is=Ns?(e,n)=>Ns(e,n,xs()):void 0,Bs=ws?.canDrop,Os=Bs?(e,n)=>Bs(e,n,ns,xs()):ns,Ps=ws?.drop,$s=Ps?(e,n)=>Ps(e,n,ss,xs()):ss,Ms=ws?.pick,Ls=Ms?e=>Ms(e,Ss,xs()):Ss,js=ws?.media??null,As=Ln(null),Es=jn(()=>js?{id:ct,zone:"",index:-1,type:js.adds.type,add:{kind:js.adds.kind,type:js.adds.type},media:!0}:null,[js]);En(()=>{if(!Es||xt||"undefined"==typeof document)return;const e=e=>{(e=>Array.from(e.dataTransfer?.types??[]).includes(Xn))(e)&&(As.current=null,ds.start({key:ct,item:Es}))},n=e=>{ds.get()?.item.media&&(As.current=Un(e.dataTransfer))},t=()=>{ds.get()?.item.media&&ds.end()};return document.addEventListener("dragstart",e),document.addEventListener("drop",n,!0),document.addEventListener("dragend",t,!0),()=>{document.removeEventListener("dragstart",e),document.removeEventListener("drop",n,!0),document.removeEventListener("dragend",t,!0)}},[Es,xt,ds]);const Ts=()=>{const e=As.current;return As.current=null,e},Rs=ce(),Ds=async e=>{if(!Rs)return e;const n=await Rs(e);return n?{...e,id:n.id,url:n.url}:null};const Fs=(e,n)=>{if(!js)return;const t=$n(ao.getState().appState.data,ui,n);if(!t)return;const o=t.node;co.replaceComponent(On(t.place),t.place.index,{...o,props:{...js.replace(o,e),id:o.props.id}})},Hs=e=>{const n=On(e),t=Mi(n);t&&Ai(t.node,t.slot,!1),ll(n,e.index)},Ws=(e,n)=>/* @__PURE__ */st(He,{...xt?{}:as.seam({place:{...Pn(e),index:n}})},`seam:${e}:${n}`),Vs={rowClick:al,isCollapsed:Rr,toggleCollapse:Dr},Us=e=>{const n=String(e.props.id),t=ci.findIndex(e=>String(e.props.id)===n),o=Ht(n),r=Oi(o),i=Rr(n),l=xi(e.type),s=vr.rowName?vr.rowName(e,"section",l):l,d=e=>Ws(o,e);/* @__PURE__ */
16
- return dt(at,{children:[
17
- /* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:e.type,size:13}),name:s,preview:pl(e),marks:ul(e),onSelect:()=>el(t),nameSlot:Wi(ze,t,n,s),selected:qo===n,badge:Dl(e)?void 0:Vl,shared:Dl(e),actions:fl(e,ze,t)??void 0,rowProps:{"data-node-id":n,onClick:al(()=>el(t))},fold:{open:!i,label:"section",onToggle:()=>Dr(n)}}),!i&&/* @__PURE__ */dt(Te,{children:[r.map((n,t)=>{const r=String(n.props.id),i=Ni(n),l=Cl(n),s=l&&Rr(r),a=()=>Il(o,t,r,e.type),{rowProps:c,...p}=as.row({item:{id:r,zone:o,index:t,type:n.type},place:{...Pn(o),index:t}},{"data-node-id":r,onClick:al(a)});/* @__PURE__ */
18
- return dt(Dn,{children:[d(t),
19
- /* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:n.type,size:13}),name:i,preview:pl(n),marks:ul(n),onSelect:a,nameSlot:Wi(o,t,r,i),selected:qo===r,hidden:Boolean(n.props._hidden),...p,fold:l?{open:!s,label:"section",onToggle:()=>Dr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(o,t,i),fl(n,o,t),hl(o,t,n,i)]}),rowProps:c}),l&&!s&&/* @__PURE__ */st(Te,{children:Ks(n,2)})]},r)}),d(r.length)]})]})},Js=(e,n,t,o,r)=>{const i=String(e.props.id),l=`${i}:${n.slot}`,s=as.dragging,d=!Rr(l)&&s?.rung?.nodeId!==i,a={...Pn(l),index:0},c=s&&!s.rung&&ns(s,a)?a:void 0,p=()=>Ai(e,n,!0),{rowProps:u,...f}=as.row({item:{id:`rung:${l}`,zone:`${i}:${vt}`,index:t,type:e.type,rung:{nodeId:i,slot:n.slot}},place:{parentId:i,slot:vt,index:t},into:c,canDrag:Boolean(pr.moveSlot)&&!1!==n.movable&&o>1},{"data-slot-zone":l,onClick:al(p)}),h=xt?null:pr.slotActions?.(e,n.slot);/* @__PURE__ */
20
- return dt(Dn,{children:[n.heading,
21
- /* @__PURE__ */st(Ee,{words:Zt,icon:n.glyph??null,name:n.label,badge:n.badge,onSelect:p,selected:Li===l,...f,dragHint:n.dragHint,fold:{open:d,label:n.label,onToggle:()=>Dr(l)},actions:h&&h.length>0?/* @__PURE__ */st(at,{children:h.map((t,o)=>/* @__PURE__ */st(Fe,{kind:"delete"===t.kind?"delete":"plain",label:t.label,disabled:t.disabled,onClick:()=>((e,n,t)=>{if(xt||t.disabled)return;const o=String(e.props.id),r=e=>{"string"==typeof e&&Ei(o,e,n.panel)},i=t.run();i&&"function"==typeof i.then?i.then(r):r(i)})(e,n,t),children:"delete"===t.kind?/* @__PURE__ */st(tt,{size:15}):/* @__PURE__ */st(lt,{size:15})},`${o}:${t.kind}`))}):void 0,rowProps:u}),d&&/* @__PURE__ */st(Te,{children:r})]},l)},Ys=(e,n)=>{const t=kl(e),o=t.filter(e=>e.rung).length;let r=0;/* @__PURE__ */
22
- return st(at,{children:t.map(t=>{const i=t.kids,l=t.rung?n+1:n,s=wl(e.type,void 0,t.slot),d=s?`${e.props.id}:${s.slot}`:null,a=null===t.slot?null:`${e.props.id}:${t.slot}`,c=(e,n)=>Ws(e,n),p=/* @__PURE__ */dt(at,{children:[i.map(({child:n,zone:t,index:o})=>{const r=qo===String(n.props.id),{collapsible:i,folded:s}=xl(n,l,Nl(n.type)),d=String(n.props.id),a=Zl(n),p=()=>Il(t,o,d,e.type),{rowProps:u,...f}=as.row({item:{id:d,zone:t,index:o,type:n.type},place:{...Pn(t),index:o}},{"data-node-id":d,onClick:al(p)});/* @__PURE__ */
23
- return dt(Dn,{children:[0===o&&c(t,0),
24
- /* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:n.type,size:13}),name:a,preview:pl(n),marks:ul(n),onSelect:p,nameSlot:Wi(t,o,d,a),selected:r,hidden:Boolean(n.props._hidden),...f,fold:i?{open:!s,label:"group",onToggle:()=>Dr(d)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(t,o,a),fl(n,t,o),hl(t,o,n,a)]}),rowProps:u}),i&&!s&&/* @__PURE__ */st(Te,{children:Ys(n,l+1)}),c(t,o+1)]},String(n.props.id??`${t}-${o}`))}),null===a?d&&!i.some(e=>e.zone===d)?c(d,0):null:0!==i.length||!t.rung&&d!==a?null:c(a,0)]});return t.rung?Js(e,t.rung,r++,o,p):/* @__PURE__ */st(Dn,{children:p},t.slot??"")})})},Ks=(e,n)=>{const t=hr(Pt?.data,e.type,String(e.props.id)),o=kl(e),r=o.filter(e=>e.rung).length;let i=0;/* @__PURE__ */
25
- return st(at,{children:o.map(o=>{const l=o.kids,s=o.rung?n+1:n,d=wl(e.type,t,o.slot),a=d?.spec??null,c=a&&Array.isArray(e.props[a.slot])?e.props[a.slot]:[],p=d&&d.choices?{slot:d.slot,choices:d.choices}:null,u=String(e.props.id),f=a&&!a.fixed?`${u}:${a.slot}`:null,h=p?`${u}:${p.slot}`:null,m=(e,n)=>Ws(e,n),g=null===o.slot?null:`${u}:${o.slot}`,y=Boolean(a&&!a.fixed&&(null===g||g===f)),v=/* @__PURE__ */dt(at,{children:[l.map(({child:n,zone:t,index:o})=>{const r=qo===String(n.props.id),i=Fi(n),l=String(n.props.id),{collapsible:d,folded:a}=xl(n,s,Nl(n.type)),c=yl(n.type),p=1===c.length?`${l}:${c[0]}`:null,u=p?{...Pn(p),index:Oi(p).length}:void 0,f=as.dragging,h=u&&f&&ns(f,u)?u:void 0,g=()=>Il(t,o,l,e.type),{rowProps:y,...v}=as.row({item:{id:l,zone:t,index:o,type:n.type},place:{...Pn(t),index:o},into:h,canDrag:!ur(n.type,n)},{"data-node-id":l,onClick:al(g)});/* @__PURE__ */
26
- return dt(Dn,{children:[0===o&&m(t,0),
27
- /* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:n.type,size:13}),name:i,preview:pl(n),marks:ul(n),onSelect:g,nameSlot:Wi(t,o,l,i),selected:r,hidden:Boolean(n.props._hidden),...v,fold:d?{open:!a,label:"group",onToggle:()=>Dr(l)}:void 0,actions:ur(n.type,n)?fl(n,t,o)??void 0:/* @__PURE__ */dt(at,{children:[cl(t,o,i),fl(n,t,o),hl(t,o,n,i)]}),rowProps:y}),d&&!a&&/* @__PURE__ */st(Te,{children:Ks(n,s+1)}),m(t,o+1)]},String(n.props.id??`${t}-${o}`))}),y&&a&&
28
- /* @__PURE__ */st(w,{small:!0,label:a.addLabel,blocked:a.addBlocked?.(c)??null,onAdd:()=>Bl(e.props.id,a.slot,a.childType,c.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?Js(e,o.rung,i++,r,v):/* @__PURE__ */st(Dn,{children:v},o.slot??"")})})},Gs=Vo,Zs=e=>"panel"in e?{id:e.id,label:e.label,icon:e.icon,active:uo&&!Gs&&cr===e.id,onSelect:()=>li(e.id)}:e,Qs=[...(ar.railLead??[]).map(Zs),{id:"sections",label:Gt.layers,icon:/* @__PURE__ */st(he,{}),active:uo&&!Gs&&"sections"===cr,onSelect:()=>li("sections")},...(ar.railTrail??[]).map(Zs)];wo?Qs.push({id:"media",label:Gt.railMedia,icon:/* @__PURE__ */st(me,{}),active:Co,onSelect:No}):It&&Qs.push({id:"media",label:Gt.railMedia,icon:/* @__PURE__ */st(me,{}),onSelect:si});const Xs={value:Qs.find(e=>!0===e.active)?.id??"",press:e=>{const n=Qs.find(n=>n.id===e);n&&!n.disabled&&!0!==n.active&&n.onSelect?.()},items:Qs.map(e=>({id:e.id,icon:e.icon,label:/* @__PURE__ */st("span",{className:"sr-only",children:e.label}),tooltip:e.label,disabled:e.disabled}))},_s=[...ar.railLead??[],...ar.railTrail??[]].find(e=>"panel"in e&&e.id===cr),qs=Boolean(Kt?.foldable),ed=Kt?.label??(Bt?Gt.pageSections:Gt.templateSections),nd=qs&&Rr(kt),td=/* @__PURE__ */dt(at,{children:[ci.map((e,n)=>{if(Ut(e)||Jt(e)||Ft(e.type))return null;const t=qo===String(e.props.id),o=Boolean(e.props._hidden);vl(e);const r=String(e.props.id),i=ar.hasOwnRows?.(e)??!1,l=Cl(e)||i,s=l&&Rr(r),d=yl(e.type),a=1===d.length?`${r}:${d[0]}`:null,c=a?{...Pn(a),index:Oi(a).length}:void 0,p=as.dragging,u=c&&p&&ns(p,c)?c:void 0,{rowProps:f,...h}=as.row({item:{id:r,zone:ze,index:n,type:e.type},place:{...Pn(ze),index:n},into:u,canDrag:!ur(e.type,e)},{"data-node-id":r,onClick:al(()=>el(n))});/* @__PURE__ */
29
- return dt(Dn,{children:[n>0&&ml(n),
30
- /* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:e.type,size:13}),name:Ni(e),preview:pl(e),marks:ul(e),shared:Dl(e),onSelect:()=>el(n),nameSlot:Wi(ze,n,r,Ni(e)),selected:t,hidden:o,...h,fold:l?{open:!s,label:"section",onToggle:()=>Dr(r)}:void 0,actions:/* @__PURE__ */dt(at,{children:[cl(ze,n,Ni(e)),fl(e,ze,n),hl(ze,n,e,Ni(e))]}),rowProps:f}),Cl(e)&&!s&&/* @__PURE__ */dt(Te,{children:[Ks(e,1),ar.partRows?.(e,Vs)]}),i&&!s&&/* @__PURE__ */st(Te,{children:ar.ownRows?.(e,n,Vs)})]},String(e.props.id??n))}),Yl>0&&ml(Yl)]}),od=(e,n,t)=>{const o=String(e.props.id),r=bl(e).length>0||Sl(e)||Boolean(gr(e.type)),i=r&&Rr(o),l="header"===t?Gt.header:Gt.footer,s=vr.rowName?vr.rowName(e,"section",l):l;/* @__PURE__ */
31
- return dt(at,{children:[
32
- /* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:t,size:13}),name:s,preview:pl(e),marks:ul(e),badge:Dl(e)?void 0:Vl,shared:Dl(e),onSelect:()=>el(n),nameSlot:Wi(ze,n,o,s),selected:qo===String(e.props.id),fold:r?{open:!i,label:"section",onToggle:()=>Dr(o)}:void 0,actions:fl(e,ze,n)??void 0,rowProps:{"data-node-id":o,onClick:al(()=>el(n))}}),r&&!i&&/* @__PURE__ */st(Te,{children:Ys(e,1)})]})};return(ar.wrap??(e=>e))(
33
- /* @__PURE__ */st(Q,{target:Eo,children:/* @__PURE__ */dt("div",{ref:Ao,className:"sf-editor es-editor",style:tn(Lr),onContextMenu:Gi.onEditorContextMenu,...u(vn),children:[
34
- /* @__PURE__ */dt(Ke,{children:[
35
- /* @__PURE__ */st("div",{className:"es-cluster es-cluster--left","aria-hidden":"true"}),
36
- /* @__PURE__ */dt(Ge,{children:[
37
- /* @__PURE__ */st(Ze,{label:Gt.bar.undo,disabled:Boolean(xt)||!Mt.hasPast,onClick:()=>Mt.back(),children:/* @__PURE__ */st(_n,{})}),
38
- /* @__PURE__ */st(Ze,{label:Gt.bar.redo,disabled:Boolean(xt)||!Mt.hasFuture,onClick:()=>Mt.forward(),children:/* @__PURE__ */st(qn,{})}),
39
- /* @__PURE__ */st(Qe,{}),
40
- /* @__PURE__ */st(Xe,{devices:ho,value:ko,onChange:bo}),
41
- /* @__PURE__ */st(Ze,{label:Gt.bar.refresh,tip:Gt.bar.refreshTip,onClick:()=>{jo.current=(()=>{const e=Eo?.document;if(!e)return null;const n=ci.findIndex(Jt),t=n>=0?n:ci.length;let o=null;for(let n=0;n<t;n++){const t=ci[n]?.props?.id;if(null==t)continue;const r=Nn(e,`[data-puck-component="${CSS.escape(String(t))}"]`);if(!r)continue;const i=r.getBoundingClientRect().top;i<=4&&(null===o||i>o.offset)&&(o={id:String(t),offset:i})}if(!o){const e=Lt?.props?.id??ci[0]?.props?.id;null!=e&&(o={id:String(e),offset:0})}return o})(),Lo(e=>e+1)},children:/* @__PURE__ */st(et,{})})]}),
42
- /* @__PURE__ */dt(Ge,{kind:"right",style:{minWidth:300},children:[
43
- /* @__PURE__ */st(k,{input:Ho,words:Gt.saveStatus}),ar.barLead?.(),ar.barTrail?.(),ar.mainAction||!ar.barMain?/* @__PURE__ */st(b,{input:Ho,action:ar.mainAction??{label:Gt.done,onPress:()=>{Yn(Pt.data)}},readOnly:Boolean(xt),saveSwitch:Ct,onToggleAutoSave:Qn,onSaveNow:Wo,bar:Gt.bar,words:Gt.saveStatus}):ar.barMain()]})]}),
44
- /* @__PURE__ */st(oe,{}),
45
- /* @__PURE__ */dt("div",{className:"sf-body",children:[uo?/* @__PURE__ */dt(at,{children:[
46
- /* @__PURE__ */dt("aside",{className:"es-sidepanel es-sidepanel--left sf-panel sf-panel--left","aria-label":Gt.leftPanel,children:[
47
- /* @__PURE__ */st("div",{className:"es-paneltabs",children:/* @__PURE__ */st(Wn,{variant:"underline",block:!0,"aria-label":Gt.bar.views,value:Xs.value,onChange:Xs.press,items:Xs.items})}),Vo?/* @__PURE__ */st(x,{at:Yo?{label:(e=>{const n=ql(e.zone);if(n)return Gt.add.addingTo({name:vr.rowName?dl(n,!0):xi(n.type)});if(e.zone===ze){const n=ci[e.index];return n&&!Jt(n)?Gt.add.addingBefore({name:dl(n,!0)}):Gt.add.addingAtEnd}const t=os(e.zone);return t?Gt.add.addingTo({name:t.parentName}):Gt.add.addingHere})(Yo),onClear:()=>Ko(null)}:void 0,placeBlocks:Yo&&Yo.zone!==ze?os(Yo.zone)?.choices:void 0,canTake:Yo?e=>{if(!Yo)return null;const n={...Pn(Yo.zone),index:Yo.index};if(is(e,n))return null;if("shared"===e.kind&&Yo.zone===ze&&!Et.shared?.nodeOf(e.section))return Gt.shared.alreadyHere;const t=ql(Yo.zone);if(t)return Gt.add.notInside({name:dl(t,!0)});if(Yo.zone===ze)return Gt.add.onlySections;const o=os(Yo.zone);return o?Gt.add.notInside({name:o.parentName}):Gt.add.onlySections}:void 0,onPick:Yo?e=>{if(!Yo)return;const n={...Pn(Yo.zone),index:Yo.index};is(e,n)&&(ls(e,n),sl())}:void 0,itemFor:e=>({id:`new:${e.kind}:${"template"===e.kind?e.template.id:"shared"===e.kind?e.section.id:e.type}`,zone:"",index:-1,type:"template"===e.kind?e.template.node.type:"shared"===e.kind?e.section.node.type:e.type,add:e}),session:ds,siteWide:ar.addPanelRow?.(sl),onClose:sl,onHide:ri,readOnly:Boolean(xt)}):_s?_s.panel({onHide:ri,notify:Vr}):/* @__PURE__ */dt(at,{children:[
48
- /* @__PURE__ */st(N,{icon:/* @__PURE__ */st(he,{}),title:Gt.layers,context:to,actions:/* @__PURE__ */dt(at,{children:[!xt&&/* @__PURE__ */st(_e,{label:Gt.add.title,onClick:()=>il(null),children:/* @__PURE__ */st(nt,{size:15})}),
49
- /* @__PURE__ */st(_e,{label:Gl?Gt.expandAll:Gt.collapseAll,title:0===Kl.length?Gt.nothingToFold:void 0,disabled:0===Kl.length,onClick:()=>Mr(e=>{const n=new Set(Kl);return Gl?new Set([...e].filter(e=>!n.has(e))):/* @__PURE__ */new Set([...e,...Kl])}),children:/* @__PURE__ */st(mt,{expand:Gl})})]}),onHide:ri}),
50
- /* @__PURE__ */dt(Re,{className:"sf-tree sf-scroll",words:Zt,children:[
51
- /* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:"page",size:13}),name:Gt.pageSettings,onSelect:di,selected:!Lt&&_o,rowProps:{onClick:al(di)}}),Ul&&/* @__PURE__ */dt(at,{children:[!Tl&&/* @__PURE__ */st(De,{children:Gt.header}),Us(Ul)]}),Ot&&!(Tl&&Ul)&&/* @__PURE__ */dt(at,{children:[!Tl&&/* @__PURE__ */st(De,{children:Gt.header}),!Yt&&/* @__PURE__ */st(Ee,{words:Zt,icon:/* @__PURE__ */st(br,{type:"header",size:13}),name:Gt.header,badge:Wl?void 0:Vl,shared:Wl,onSelect:ai,selected:Qo.kind===Vt?.kind,rowProps:{onClick:al(ai)}})]}),jl&&!(Tl&&Ul)&&od(jl,Ll,"header"),!qs&&/* @__PURE__ */st(De,{children:ed}),qs?/* @__PURE__ */dt(at,{children:[
52
- /* @__PURE__ */st(Ee,{words:Zt,icon:null,name:ed,fold:{open:!nd,label:ed,onToggle:()=>Dr(kt)}}),!nd&&/* @__PURE__ */st(Te,{children:td})]}):td,Ot&&!Tl&&/* @__PURE__ */st(De,{children:Gt.footer}),Ml&&!(Tl&&Jl)&&od(Ml,$l,"footer"),Jl&&Us(Jl),ar.treeFoot?.()]})]})]}),
53
- /* @__PURE__ */st(qe,{side:"left",width:Lr.left,min:nn.left,max:en,defaultWidth:m.left,label:Gt.resizeLeftPanel,onResize:Er})]}):/* @__PURE__ */st(I,{side:"left",onShow:ri}),
54
- /* @__PURE__ */dt("div",{ref:Ur,className:"sf-center sf-scroll","data-sf-canvas-head":Zr?"":void 0,style:{overflowX:ni?"auto":"hidden",overflowY:"hidden"},children:[Zr&&/* @__PURE__ */st("div",{ref:Qr,className:"sf-canvas-head",children:/* @__PURE__ */st(Zr,{device:ko})}),
55
- /* @__PURE__ */dt("div",{className:"sf-frame-scaler",style:ti,children:[
56
- /* @__PURE__ */st("div",{className:"sf-frame "+(ko===yo?"":`sf-frame--${ko}`),style:oi,children:/* @__PURE__ */dt("div",{className:"sf-preview-host",children:[
57
- /* @__PURE__ */st(je.Provider,{value:El,children:/* @__PURE__ */st(Ae.Provider,{value:Hl,children:/* @__PURE__ */st(oo,{},Mo)})}),
58
- /* @__PURE__ */st(pn,{canvas:Eo,session:ds,model:Cs,measure:Is,canDrop:Os,onDrop:$s,choose:us,onPick:Ls,dropOn:js?{accepts:(e,n)=>{if(!e.media||!js||n.item.rung)return!1;const t=$n(Pt.data,ui,n.item.id);return null!==t&&js.takes(t.node)},onDrop:(e,n)=>(e=>{const n=Ts();n&&js&&Ds(n).then(n=>{n&&Fs(n,e.item.id)})})(n),label:()=>Gt.canvasReplaceImage}:void 0,onZoneAdd:Hs,onSeamAdd:Hs,zoneAddLabel:Gt.canvasAddBlock,words:Qt.canvas,readOnly:Boolean(xt),revision:Pt.data}),Go.length>0&&!To&&/* @__PURE__ */st("div",{className:"sf-preview-gaps",children:Go.map(e=>
59
- /* @__PURE__ */st(un,{index:e.index,label:Gt.addSectionHere,onInsert:()=>il(e.index),className:void 0===e.height?"sf-preview-gap":"sf-preview-gap sf-preview-gap--tight",style:void 0===e.height?{top:e.top}:{top:e.top,height:e.height}},e.index))})]})}),ms?/* @__PURE__ */st(ht,{canvas:Eo,tabs:vs,onSelect:e=>{const n=ci.findIndex(n=>String(n.props.id)===e);n>=0&&el(n)}}):null]})]}),fo?/* @__PURE__ */dt(at,{children:[
60
- /* @__PURE__ */st(f,{value:{selectChild:Il,addChild:Bl,childRowName:Fi,blockRowName:Zl},children:/* @__PURE__ */st(ro,{mode:Qo,onOpenWebsiteSettings:ar.openSettings??(()=>{}),onOpenSiteStyles:ar.openStyles,onSelectNode:zr,onNotify:Vr,onHidePanel:ii,nodeActions:Lt?Ce(At,Lt.type):bt})}),
61
- /* @__PURE__ */st(qe,{side:"right",width:Lr.right,min:nn.right,max:en,defaultWidth:m.right,label:Gt.resizeSettingsPanel,onResize:Tr})]}):
62
- /* @__PURE__ */st(I,{side:"right",onShow:ii})]}),Gi.menu,
63
- /* @__PURE__ */st(ee,{}),vi?/* @__PURE__ */st(pt,{name:vi.name,onMake:e=>(async(e,n)=>{const t=ci.find(n=>String(n.props.id)===e),o=Et.shared;if(!t||!o)return;let r;try{r=await C(yi).create(n,t)}catch{return void Vr(Gt.shared.makeFailed,"error")}o.adopt(t,r),ki(null)})(vi.id,e),onCancel:()=>ki(null)}):null]})}))}export{St as ScreenChrome};
@@ -1,2 +0,0 @@
1
- import{routeSharedHostMessage as e}from"./chunk-EZG3TGQ7.js";import{describeLoadFailure as r,hostLoadRefusal as n}from"./chunk-ERR437B5.js";import{editLockOf as t}from"./chunk-GMCZXMOV.js";import{NO_DOCUMENT_ADDRESSING as o}from"./chunk-RLBXE4EU.js";import{saveStatusOf as u,resetForDocumentSwitch as a}from"./chunk-HNKB2ZYR.js";import{isExpiredSession as s,readEaselFailure as i}from"./chunk-CLOS6SSX.js";import{useAdminBridge as l}from"./chunk-VPFNZ7TB.js";import{STATUS_UNREACHABLE as c}from"./chunk-KCOBHPN6.js";import{useEaselSession as d}from"./chunk-O7Q4DDJT.js";import{backendOf as f,setSessionDocumentSite as m}from"./chunk-RSCMJIWS.js";import{useEaselHost as k}from"./chunk-U3JP4VGF.js";import{DEFAULT_SCREEN_WORDS as v}from"./chunk-23DYNW6S.js";import{useAutosave as g}from"./chunk-NDRZP6YR.js";import{canWriteDocument as p,newEaselClientId as h,reloadIfVersionMoved as y,openUnansweredClaim as w,FAIL_OPEN_RETRY_MS as S,CLAIM_FAIL_OPEN_MS as b,holderOf as P}from"./chunk-THWO5YVZ.js";import{useWords as I}from"./chunk-MFIRYGHW.js";import{createContext as j,useContext as R,useState as B,useMemo as E,useCallback as C,useEffect as H,useRef as O}from"react";import{jsx as T}from"react/jsx-runtime";var D={content:[],root:{},zones:{}};var N=j(null);function M(){const e=R(N);if(!e)throw new Error("useStorefrontDocument must be used within StorefrontDocumentProvider");return e}function A({target:j,addressing:R=o,onHostMessage:M,children:A}){const F=R,{homeSlug:V,entryMayBounce:L,entryBounce:W,onSwitch:Y,tellsHost:Z,adapterFor:G,migrateRenamedProps:U,describeMissing:x,onLoadFailed:J}=F,[K,X]=B(j),Q=k(),z=d(),_=E(()=>f(z),[z]),q=E(()=>t(z),[z]),$="template"===K.kind,ee="template"===K.kind?K.id:null,re="template"===K.kind?K.pageSlug??V??"":"document"===K.kind?K.slug??"":K.slug,ne="page"===K.kind?K.siteId??null:null,te=z.blocks,oe=E(()=>G(K,_,te),[G,_,te,K.kind,"template"===K.kind?K.id:"document"===K.kind?K.record:K.siteId]),ue=oe.capabilities,ae=C(e=>z.documentHooks?.stored?.(e)??e,[z]);H(()=>{m(z,ne)},[z,ne]);const se=O(K);H(()=>{se.current=K},[K]);const{token:ie,tokenRef:le,capabilities:ce}=l({onMessage:r=>{if(M?.(r)||e(r))return;const n=r;if("storefront-editor:navigate"===n?.type){const e=r;e?.target&&Br(e.target)}}}),de=!z.usesBridgedToken||null!==ie,fe=oe.lock,me=Boolean(_.lock),[ke,ve]=B(null),[ge,pe]=B(null),[he,ye]=B(null),[we,Se]=B(null),be=I("screen",v),Pe=we?function(e,r){if(null!==e.sentence)return e.sentence;if(!e.missing)return r.loadFailed({cause:e.cause});switch(e.target.kind){case"template":return r.missingTemplatePage;case"document":return r.missingDocument;default:return r.missingPage({slug:e.slug})}}(we,be):null,[Ie,je]=B(null),Re=O(null),Be=O(null),[Ee,Ce]=B(!1),He=O(null),[Oe,Te]=B(null),De=O(null),[Ne,Me]=B(null),[Ae,Fe]=B(!1),Ve=O(null);H(()=>{Ve.current=Ne},[Ne]);const[Le,We]=B(ue.hasEditLock?{kind:"checking"}:{kind:"editing"}),Ye=O(Le);H(()=>{Ye.current=Le},[Le]);const Ze=O(()=>Promise.resolve(!1)),Ge=C(e=>{Be.current=e,Ce(!0)},[]),Ue=g({save:async({id:e,data:r})=>{if(p(Ye.current)){if(!await Ze.current(e,r)){if(!p(Ye.current))return void Ge({id:e,data:r});throw new Error("page save did not land")}}else Ge({id:e,data:r})},onFailure:(e,r)=>{0===r&&Q.send("storefront-editor:save-failed")}}),{state:xe,push:Je,flush:Ke,pause:Xe,resume:Qe,stop:ze,reset:_e,retryNow:qe,hasPending:$e}=Ue,er=O(xe);H(()=>{er.current=xe},[xe]);const rr=u(xe),nr=C(()=>{const e=Be.current;e&&(Be.current=null,Ce(!1),Je(e))},[Je]),tr=O("");tr.current||(tr.current=h());const[or,ur]=B(0),ar=O(!1),[sr,ir]=B(L(j)),lr=O(!1);H(()=>{if(lr.current)return;lr.current=!0;const e=Q.address.search(),r=W(j,e);r?Q.address.load(r):L(j)&&ir(!1)},[j,Q]);const cr=Q.send;H(()=>{if(!de)return;let e=!1;const t=se.current,o=oe.resolve(re),u=z.documentHooks?.opening?.({slug:re,isTemplate:$,capabilities:ue});return o.then(async r=>{if(e)return;if(!r)return"page"===t.kind&&null!==V&&re!==V?void Q.address.load({kind:"page",slug:V,siteId:ne??void 0}):(Se({target:t,slug:re,missing:!0,sentence:x?.(t)??null}),void J?.(t,null));const n=r.readOnlyReason?r.readOnlyReason:null;Re.current=n,je(n),ve(r.id),pe(r.kind??null),De.current=r.version??null;const o=r.layout,a=o&&Object.keys(o).length?o:D,s=U(a),i=u?await u(s):s;e||ye(i)}).catch(o=>{e||(console.error("[storefront-editor] document load failed",o),Se({target:t,slug:re,missing:!1,sentence:n(o,{slug:re},z),cause:r(o,z)}),J?.(t,o))}),()=>{e=!0}},[de,ie,$,oe,re]);const dr=C(e=>new Promise(r=>{const n=Date.now(),t=setInterval(()=>{const o=le.current;o&&o!==e?(clearInterval(t),r(o)):Date.now()-n>6e3&&(clearInterval(t),r(null))},200)}),[]),fr=C(async e=>{const r=le.current;if(!r&&z.usesBridgedToken)return{ok:!1,error:new Error("no editor token")};try{return{ok:!0,value:await e(r??"")}}catch(n){if(s(n,z)){cr("storefront-editor:auth-expired");const n=r?await dr(r):null;if(n)try{return{ok:!0,value:await e(n)}}catch(e){return{ok:!1,error:e}}}return{ok:!1,error:n}}},[cr,dr,z]),mr=C(async e=>{const r=le.current?await fr(e):{ok:!1};return r.ok||cr("storefront-editor:save-failed"),r.ok},[cr,fr]),kr=C(async(e,r,n=!1)=>{if(null!==Re.current)return!1;if(!p(Ye.current))return!1;if(Ve.current)return!1;const t=await fr(()=>oe.saveLayout(e,r,De.current,tr.current));if(t.ok)return De.current=t.value.version??De.current,Fe(!1),!0;const o=q.readLockTaken(t.error);if(o){const e={kind:"takenover",holder:o};return Ye.current=e,We(e),!1}const u=q.readSaveConflict(t.error);if(u){if(u.savedByYou&&!n&&oe.rereadVersion){const n=await fr(()=>oe.rereadVersion(e));if(n.ok&&n.value)return De.current=n.value,Ze.current(e,r,!0)}ze(),Ve.current=u,Me(u)}return Fe(i(t.error,z)?.status===c),!1},[oe,fr,ze,z]);H(()=>{Ze.current=kr},[kr]);const vr=C(e=>{if(null!==Re.current)return;if(cr("storefront-editor:dirty"),!ke)return;const r=ae(e);He.current=r,p(Ye.current)?Je({id:ke,data:r}):Ge({id:ke,data:r})},[ke,cr,Ge,Je,ae]),gr=C(async()=>{p(Ye.current)&&nr();return await Ke()&&null==Be.current},[nr,Ke]),pr=O(gr);H(()=>{pr.current=gr},[gr]);const hr=O(fr);H(()=>{hr.current=fr},[fr]);const yr=C(()=>{Q.address.reload()},[Q]),wr=O(()=>Promise.resolve(!1));H(()=>{wr.current=()=>{const e=oe.rereadVersion;return ke&&e?y({ours:De.current,stored:async()=>{const r=await hr.current(()=>e(ke));return r.ok?r.value:null},hasPending:()=>null!=Be.current||$e(),reload:yr}):Promise.resolve(!1)}},[oe,ke,$e,yr]);const Sr=null!==Ie;H(()=>{if(!fe||!ke||!de||Sr)return;let e=!1,r=null,n=null;const t=tr.current,o={claim:async e=>{const r=await hr.current(()=>fe.claim(ke,t,e));if(r.ok)return{heartbeat_seconds:r.value.heartbeatSeconds};throw r.error},cancelled:()=>e,currentAccess:()=>Ye.current,heldWrite:()=>({pending:null!=Be.current||$e(),autoSaveEnabled:!er.current.paused,saveConflict:null!=Ve.current}),setAccess:e=>{Ye.current=e,We(e)},releaseHeldWrite:()=>{pr.current()},startHeartbeat:e=>{r&&clearInterval(r),r=setInterval(()=>{u(!1)},e)},stopHeartbeat:()=>{r&&(clearInterval(r),r=null)},reloadIfMoved:()=>{wr.current()}},u=q.makeClaimBeat(o),a=ar.current;return ar.current=!1,a||(We({kind:"checking"}),n=setTimeout(()=>{n=null,w(o)&&o.startHeartbeat(S)},b)),u(a).finally(()=>{n&&clearTimeout(n),n=null}),()=>{e=!0,n&&clearTimeout(n),r&&clearInterval(r),fe.release(ke,t).catch(()=>{})}},[ke,fe,de,ie,or,Sr]);const br=C(()=>{fe&&ke&&(ar.current=!0,ur(e=>e+1))},[ke,fe]),Pr=C(()=>{We(e=>{const r="blocked"===e.kind||"takenover"===e.kind?e.holder:null;return r?{kind:"readonly",holder:r}:e})},[]),Ir=C(()=>{er.current.paused?(p(Ye.current)&&nr(),Qe()):Xe()},[nr,Xe,Qe]),jr=C(()=>{qe()},[qe]),Rr=C(e=>{He.current=null,a("template"!==e.kind&&me,{resetAutosave:()=>{_e(),Be.current=null,Ce(!1)},setVersion:e=>{De.current=e},setSaveConflict:Me,setAccess:We}),Y(e),X(e),Re.current=null,je(null),ve(null),pe(null),ye(null),Se(null),Q.address.show(e),"document"!==e.kind&&Z(e)&&Q.send("storefront-editor:navigated",{target:e})},[_e,Q,me,Y,Z]),Br=C(e=>{if(function(e,r,n){if(e.kind!==r.kind)return!1;if("template"===e.kind){const t=r;return e.id===t.id&&(e.pageSlug??n)===(t.pageSlug??n)}if("document"===e.kind){const n=r;return e.record===n.record&&(e.slug??"")===(n.slug??"")}const t=r;return e.slug===t.slug&&e.siteId===t.siteId}(e,se.current,V))return;const r=null!=Be.current;if(!r&&!$e())return void Rr(e);const n=er.current;r||n.paused||n.failed||n.stopped?Te(e):Ke().then(r=>{r?Rr(e):Te(e)})},[Rr,$e,Ke,V]),Er=C(()=>Te(null),[]),Cr=C(()=>{Te(e=>(e&&Rr(e),null))},[Rr]),Hr=C(async()=>{const e=Oe;if(!e)return;await gr()&&(Te(null),Rr(e))},[Oe,gr,Rr]),Or=C(async e=>{if(null!==Re.current)return;if(!ke)return;if(!p(Ye.current)||Ve.current)return;const r=ae(e);if(!await kr(ke,r))return void(Ve.current||cr("storefront-editor:save-failed"));const n=oe.publish;if(!ue.canPublish||!n)return void cr("storefront-editor:saved");const t=await fr(()=>n(ke,De.current??void 0));if(!t.ok){const{error:e}=t;return void cr("storefront-editor:publish-failed",{reason:e instanceof Error&&e.message?e.message:null})}De.current=t.value.version??De.current,cr("storefront-editor:published")},[ke,oe,ue.canPublish,cr,kr,fr,ae]);/* @__PURE__ */
2
- return T(N.Provider,{value:{target:K,adapter:oe,capabilities:ue,templateId:ee,currentSlug:re,currentKind:ge,siteId:ne,ready:de,token:ie,tokenRef:le,notifyParent:cr,bridgeCapabilities:ce,runAuthed:mr,docId:ke,data:he,getLiveData:()=>He.current??he,error:Pe,redirecting:sr,saveStatus:rr,saveState:xe,autoSaveEnabled:!xe.paused,autoSaveStoppedByConflict:xe.stopped,hasUnsavedEdits:xe.pending||Ee,toggleAutoSave:Ir,retrySave:jr,onChange:vr,flushSave:gr,onPublish:Or,access:Le,readOnly:null!==P(Le)||null!==Ie||null!==Ne,readOnlyReason:Ie,takeOverEditing:br,viewReadOnly:Pr,saveConflict:Ne,saveUnreachable:Ae,reloadFromServer:yr,navigate:Br,pendingNav:Oe,cancelPendingNav:Er,discardAndNavigate:Cr,saveAndNavigate:Hr},children:A})}export{N as ScreenDocumentContext,A as ScreenDocumentProvider,M as useScreenDocument};
@@ -1,2 +0,0 @@
1
- import{createContext as e,useContext as r,useRef as c,useEffect as n}from"react";import{jsx as s}from"react/jsx-runtime";var t={connected:!1,ownsDocument:!0,send:()=>{},subscribe:()=>()=>{},address:{search:()=>"",show:()=>{},load:()=>{},reload:()=>{}}},o=e(t);function a({host:e,children:r}){/* @__PURE__ */
2
- return s(o.Provider,{value:e,children:r})}function d(){return r(o)}function i(e,r){const s=d(),t=c(r);t.current=r,n(()=>{if(e&&s.claimEscape)return s.claimEscape(e=>"Escape"===e.key&&(t.current(),!0))},[e,s])}function u(e){const r=/* @__PURE__ */new Set;return{host:{connected:!0,ownsDocument:!1,send:(r,c)=>{e.onMessage({type:r,...c})},subscribe:e=>(r.add(e),()=>{r.delete(e)}),address:e.address,...e.claimEscape?{claimEscape:e.claimEscape}:null},deliver:e=>{for(const c of[...r])c(e)}}}export{t as DETACHED_EASEL_HOST,o as EaselHostContext,a as EaselHostProvider,u as createEaselHost,d as useEaselHost,i as useHostEscape};