graview 0.1.51 → 0.1.52

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 (166) hide show
  1. package/dist/preview/chunk.2EB7COX5.js +1 -0
  2. package/dist/preview/{chunk.K7ECYKZL.js → chunk.2K3YQJW3.js} +1 -1
  3. package/dist/preview/{chunk.PPZ2TOB5.js → chunk.2X3UZJWI.js} +1 -1
  4. package/dist/preview/{chunk.KRODTMGR.js → chunk.337JMOTL.js} +1 -1
  5. package/dist/preview/{chunk.5ZAK57JA.js → chunk.3FKP32RG.js} +2 -2
  6. package/dist/preview/{chunk.ACB4TD4W.js → chunk.3TME4BG3.js} +1 -1
  7. package/dist/preview/chunk.3ZQAPPJ5.js +18 -0
  8. package/dist/preview/{chunk.EA2NMVRE.js → chunk.4LI73QOY.js} +1 -1
  9. package/dist/preview/{chunk.UIWI4GKW.js → chunk.4VI3EYDL.js} +1 -1
  10. package/dist/preview/{chunk.OHDJYGH7.js → chunk.4ZLCMATU.js} +1 -1
  11. package/dist/preview/{chunk.GJQF7I22.js → chunk.52J42KR5.js} +1 -1
  12. package/dist/preview/{chunk.4EZFOZBA.js → chunk.5DDHFNZM.js} +1 -1
  13. package/dist/preview/chunk.5LWPNOJA.js +1 -0
  14. package/dist/preview/{chunk.FKJ3HIA5.js → chunk.5WU2UTP7.js} +1 -1
  15. package/dist/preview/{chunk.OPCBZNKF.js → chunk.63SRVTG2.js} +2 -2
  16. package/dist/preview/{chunk.CV55N3Y6.js → chunk.6BA6RUK7.js} +1 -1
  17. package/dist/preview/{chunk.WFHFWJ6E.js → chunk.6CY3EA6U.js} +1 -1
  18. package/dist/preview/{chunk.IBJBCZKG.js → chunk.6JERQFZI.js} +1 -1
  19. package/dist/preview/{chunk.IFL2MYTQ.js → chunk.6NIE3ILA.js} +1 -1
  20. package/dist/preview/{chunk.JMDKAP23.js → chunk.6QNBUBGD.js} +1 -1
  21. package/dist/preview/chunk.6YGRRXJB.js +2 -0
  22. package/dist/preview/{chunk.JX2C3HVD.js → chunk.7354O67H.js} +1 -1
  23. package/dist/preview/{chunk.MY5OXSS7.js → chunk.73EKJ4JN.js} +1 -1
  24. package/dist/preview/{chunk.CQPNDJAC.js → chunk.7EA7THSM.js} +1 -1
  25. package/dist/preview/{chunk.IUIDDNN3.js → chunk.7FMS57QO.js} +1 -1
  26. package/dist/preview/{chunk.3TVAE7LE.js → chunk.7FZY5E2U.js} +1 -1
  27. package/dist/preview/{chunk.R5R7CLOU.js → chunk.7IOC6U3C.js} +1 -1
  28. package/dist/preview/{chunk.JI2UVZUU.js → chunk.7KZ44FEU.js} +1 -1
  29. package/dist/preview/chunk.7OAXW7QF.js +1 -0
  30. package/dist/preview/chunk.7SNIX56B.js +1 -0
  31. package/dist/preview/{chunk.OJ64WTLW.js → chunk.7UJZP3YK.js} +2 -2
  32. package/dist/preview/{chunk.353CGK6C.js → chunk.7UXDIEPK.js} +1 -1
  33. package/dist/preview/{chunk.NQ26KMSQ.js → chunk.7XJ3XQZD.js} +1 -1
  34. package/dist/preview/chunk.AI2HBKVP.js +359 -0
  35. package/dist/preview/{chunk.KOBCLWPC.js → chunk.BDQ4FUKO.js} +1 -1
  36. package/dist/preview/{chunk.ESSENNHM.js → chunk.BHPZK4WJ.js} +2 -2
  37. package/dist/preview/{chunk.W2DKFQ6R.js → chunk.BJL6EL6B.js} +1 -1
  38. package/dist/preview/{chunk.UK5F3S2N.js → chunk.C4EPMV7O.js} +1 -1
  39. package/dist/preview/{chunk.DQNN5FE5.js → chunk.C4UNAJWC.js} +1 -1
  40. package/dist/preview/{chunk.Z7N3MJ36.js → chunk.C7EEYSAM.js} +1 -1
  41. package/dist/preview/{chunk.7RIFDWDF.js → chunk.CBGKWYGI.js} +1 -1
  42. package/dist/preview/chunk.CC7E6NUQ.js +1 -0
  43. package/dist/preview/chunk.CHMUL36A.js +1 -0
  44. package/dist/preview/{chunk.VICCAWAN.js → chunk.CV4QA4ZF.js} +1 -1
  45. package/dist/preview/{chunk.5ON3JSAK.js → chunk.D2T563AA.js} +1 -1
  46. package/dist/preview/{chunk.B7LBG4UP.js → chunk.D62V3TBW.js} +1 -1
  47. package/dist/preview/{chunk.2W45NM7Q.js → chunk.DC7M56NM.js} +2 -2
  48. package/dist/preview/{chunk.6KYWJXZR.js → chunk.DGWNVDZB.js} +1 -1
  49. package/dist/preview/{chunk.TBSPEO2L.js → chunk.DIS7JS7X.js} +1 -1
  50. package/dist/preview/{chunk.FYDDFOSD.js → chunk.DVLWSCIC.js} +1 -1
  51. package/dist/preview/{chunk.FU4YSVWX.js → chunk.DXZ5VYCQ.js} +1 -1
  52. package/dist/preview/{chunk.PMV6XVVZ.js → chunk.EHOEMVQP.js} +1 -1
  53. package/dist/preview/{chunk.B4PUI3GO.js → chunk.EIWTZC4A.js} +1 -1
  54. package/dist/preview/chunk.EME5HQ3H.js +1 -0
  55. package/dist/preview/{chunk.HVX7LFWR.js → chunk.FEBCIEI3.js} +1 -1
  56. package/dist/preview/{chunk.IE4ZJQV3.js → chunk.FJC6PMOG.js} +1 -1
  57. package/dist/preview/{chunk.2W2YVB6X.js → chunk.FJEXINFF.js} +1 -1
  58. package/dist/preview/{chunk.APFRPN5S.js → chunk.FLNYLE6S.js} +1 -1
  59. package/dist/preview/{chunk.2VJ52LGS.js → chunk.G7XKQNOL.js} +1 -1
  60. package/dist/preview/{chunk.SSAY4ITS.js → chunk.GL3YVGAP.js} +2 -2
  61. package/dist/preview/{chunk.K7RKWB2K.js → chunk.GZHEGKPF.js} +1 -1
  62. package/dist/preview/{chunk.KK46XLGU.js → chunk.HSGUXMAO.js} +1 -1
  63. package/dist/preview/{chunk.AZOW57MT.js → chunk.HST7BYFW.js} +1 -1
  64. package/dist/preview/{chunk.T3RTFTOZ.js → chunk.I2W7HSBU.js} +1 -1
  65. package/dist/preview/{chunk.XCQ7ZPR5.js → chunk.I43ONAEL.js} +1 -1
  66. package/dist/preview/{chunk.NVRK6A7T.js → chunk.INL4OZI7.js} +1 -1
  67. package/dist/preview/{chunk.ALCH5H7U.js → chunk.IVI3HRSF.js} +1 -1
  68. package/dist/preview/{chunk.XCCBUWMC.js → chunk.J263VQF5.js} +1 -1
  69. package/dist/preview/{chunk.TNL2BVCH.js → chunk.J2R55TM7.js} +1 -1
  70. package/dist/preview/{chunk.U7SNDY3F.js → chunk.J6IB2HUZ.js} +1 -1
  71. package/dist/preview/{chunk.Y5AMZBHA.js → chunk.JOWJNIWH.js} +2 -2
  72. package/dist/preview/{chunk.7GAC7U34.js → chunk.JQBP6QWQ.js} +1 -1
  73. package/dist/preview/chunk.JV7FLVUV.js +1 -0
  74. package/dist/preview/{chunk.SJKHVIHA.js → chunk.KFTZLNHY.js} +2 -2
  75. package/dist/preview/{chunk.NZDHXREL.js → chunk.KPUX27ZT.js} +1 -1
  76. package/dist/preview/chunk.KSJ3J5UN.js +1 -0
  77. package/dist/preview/chunk.LESRQN3Y.js +32 -0
  78. package/dist/preview/{chunk.CTOBNZLM.js → chunk.LSL25VXW.js} +1 -1
  79. package/dist/preview/{chunk.SRFZKDQ6.js → chunk.LTJYKQJG.js} +1 -1
  80. package/dist/preview/{chunk.32BOL7OL.js → chunk.LXJW2Z2M.js} +1 -1
  81. package/dist/preview/{chunk.WQLAIEWJ.js → chunk.M33LUF3Q.js} +1 -1
  82. package/dist/preview/{chunk.B6LKLV32.js → chunk.MBNZ2HK7.js} +1 -1
  83. package/dist/preview/{chunk.SJYQ72EC.js → chunk.MYKRJ4SV.js} +1 -1
  84. package/dist/preview/{chunk.UWFEXEY3.js → chunk.N7D5LKBI.js} +1 -1
  85. package/dist/preview/{chunk.AL7LFNOS.js → chunk.NAPTE3S6.js} +1 -1
  86. package/dist/preview/{chunk.MX3Y3LPH.js → chunk.NB6WN4DO.js} +1 -1
  87. package/dist/preview/{chunk.MN6WHE4B.js → chunk.NHIPVAGR.js} +1 -1
  88. package/dist/preview/chunk.NICCIJV4.js +1 -0
  89. package/dist/preview/{chunk.MRXQBEPQ.js → chunk.NQPNK6I5.js} +1 -1
  90. package/dist/preview/{chunk.MG3DMURZ.js → chunk.NVNQSZ43.js} +1 -1
  91. package/dist/preview/{chunk.CI4DEKPX.js → chunk.NWK4E7TJ.js} +1 -1
  92. package/dist/preview/{chunk.HASVT7IC.js → chunk.NZB5S5UO.js} +1 -1
  93. package/dist/preview/{chunk.WESWDXRW.js → chunk.OS3WZV6C.js} +1 -1
  94. package/dist/preview/{chunk.OU5TRY4N.js → chunk.OYRZ2DEI.js} +1 -1
  95. package/dist/preview/{chunk.4T67XS2D.js → chunk.P5PXWOHI.js} +1 -1
  96. package/dist/preview/{chunk.KYKHZZT7.js → chunk.PRCWGE7A.js} +1 -1
  97. package/dist/preview/{chunk.DUY27OJV.js → chunk.PXHBPLTQ.js} +1 -1
  98. package/dist/preview/chunk.PXVJBL2C.js +1 -0
  99. package/dist/preview/{chunk.V4GAOZAW.js → chunk.Q3XKNZQW.js} +1 -1
  100. package/dist/preview/chunk.Q5IAXTF5.js +25 -0
  101. package/dist/preview/{chunk.2534FLZZ.js → chunk.QPP3OJVR.js} +1 -1
  102. package/dist/preview/{chunk.GLTWLQ6L.js → chunk.QRCTTDDQ.js} +1 -1
  103. package/dist/preview/{chunk.CMEETACI.js → chunk.QWQBPJ4U.js} +1 -1
  104. package/dist/preview/chunk.QXCYAFRT.js +1 -0
  105. package/dist/preview/{chunk.ESK3UZRC.js → chunk.R6FHEEJ7.js} +1 -1
  106. package/dist/preview/{chunk.GMAXA5GV.js → chunk.R77TACXU.js} +1 -1
  107. package/dist/preview/{chunk.HFKGND5Q.js → chunk.R7CRV2FE.js} +1 -1
  108. package/dist/preview/{chunk.XWXYC3BJ.js → chunk.R7ZZJOJW.js} +1 -1
  109. package/dist/preview/{chunk.S32AGJ3W.js → chunk.RBWYXVUW.js} +1 -1
  110. package/dist/preview/{chunk.N5XONWU2.js → chunk.RMRO5JZX.js} +1 -1
  111. package/dist/preview/{chunk.FFCUZPTC.js → chunk.RWCWRJJC.js} +1 -1
  112. package/dist/preview/{chunk.CXC5FOIO.js → chunk.S4ZWBCYC.js} +1 -1
  113. package/dist/preview/{chunk.UVAWWCFW.js → chunk.SELLAVIQ.js} +1 -1
  114. package/dist/preview/{chunk.7NQROWHU.js → chunk.SM6HTPYF.js} +1 -1
  115. package/dist/preview/chunk.SZCZD2GM.js +1 -0
  116. package/dist/preview/{chunk.SPU3BVAO.js → chunk.T2Q3AAQI.js} +1 -1
  117. package/dist/preview/{chunk.BV6HKTHK.js → chunk.T6KKNWZT.js} +1 -1
  118. package/dist/preview/{chunk.76QSPWSJ.js → chunk.U6PCKJ26.js} +1 -1
  119. package/dist/preview/{chunk.FEIJ7ETK.js → chunk.UEPVA6IS.js} +1 -1
  120. package/dist/preview/{chunk.PYRJDTVS.js → chunk.ULAMIQ52.js} +1 -1
  121. package/dist/preview/chunk.UMS7XRPO.js +1 -0
  122. package/dist/preview/{chunk.RNOBACJ6.js → chunk.VGIWQNJB.js} +1 -1
  123. package/dist/preview/{chunk.3H7YIKKC.js → chunk.VGTEEANA.js} +1 -1
  124. package/dist/preview/{chunk.ZZODDJYK.js → chunk.VKOCD5CL.js} +1 -1
  125. package/dist/preview/{chunk.P4CLT32V.js → chunk.VOHRQXCF.js} +5 -5
  126. package/dist/preview/chunk.W5UJLKIT.js +1 -0
  127. package/dist/preview/{chunk.E2R6VFZX.js → chunk.WUEU3QBL.js} +1 -1
  128. package/dist/preview/{chunk.34HGT7HQ.js → chunk.WWUMSCYC.js} +1 -1
  129. package/dist/preview/{chunk.3MU37W5D.js → chunk.XLM4ONUB.js} +1 -1
  130. package/dist/preview/{chunk.TVWN5I4M.js → chunk.XPR3QFF4.js} +1 -1
  131. package/dist/preview/{chunk.BYY7YXBI.js → chunk.XZLKTOJE.js} +1 -1
  132. package/dist/preview/{chunk.LYIHPVDZ.js → chunk.Y37DXEHG.js} +1 -1
  133. package/dist/preview/{chunk.OW72XZF4.js → chunk.YKACMLLU.js} +1 -1
  134. package/dist/preview/{chunk.DEH6O3K4.js → chunk.YKXUDACI.js} +1 -1
  135. package/dist/preview/{chunk.7G4M2PX3.js → chunk.YUEOUV7G.js} +2 -2
  136. package/dist/preview/chunk.YYWLYVAW.js +1 -0
  137. package/dist/preview/chunk.Z2JMTRF4.js +1 -0
  138. package/dist/preview/{chunk.SKG4IHT5.js → chunk.Z2UFPOAN.js} +1 -1
  139. package/dist/preview/chunk.ZEKKIMKI.js +1 -0
  140. package/dist/preview/{chunk.RMMJQYJJ.js → chunk.ZK42LPF5.js} +1 -1
  141. package/dist/preview/{chunk.GRYS6VSF.js → chunk.ZZGXVYW2.js} +1 -1
  142. package/dist/preview/index.html +50 -50
  143. package/dist/preview/page.js +2 -2
  144. package/package.json +6 -6
  145. package/dist/preview/chunk.3SBTQ66X.js +0 -1
  146. package/dist/preview/chunk.4N5R4K6O.js +0 -1
  147. package/dist/preview/chunk.AJAMTRZ3.js +0 -1
  148. package/dist/preview/chunk.AL45OI4A.js +0 -1
  149. package/dist/preview/chunk.CUB4IAUJ.js +0 -1
  150. package/dist/preview/chunk.CUN4VN42.js +0 -1
  151. package/dist/preview/chunk.ET3XJDPX.js +0 -1
  152. package/dist/preview/chunk.FG5ZFYYL.js +0 -1
  153. package/dist/preview/chunk.FTBH7CPZ.js +0 -1
  154. package/dist/preview/chunk.GYTVL6GR.js +0 -359
  155. package/dist/preview/chunk.JBR66TUP.js +0 -1
  156. package/dist/preview/chunk.JG2FGZF2.js +0 -18
  157. package/dist/preview/chunk.MMVCZOEX.js +0 -32
  158. package/dist/preview/chunk.NNUUD26E.js +0 -1
  159. package/dist/preview/chunk.QEQQXWYU.js +0 -1
  160. package/dist/preview/chunk.QPAJCRFB.js +0 -1
  161. package/dist/preview/chunk.S4CKKT3C.js +0 -1
  162. package/dist/preview/chunk.TMYGLXR6.js +0 -25
  163. package/dist/preview/chunk.UCUWEYKM.js +0 -1
  164. package/dist/preview/chunk.XZVPVAIS.js +0 -1
  165. package/dist/preview/chunk.Y2ZBVWII.js +0 -1
  166. package/dist/preview/chunk.Y3LTHEN7.js +0 -1
@@ -1 +1 @@
1
- import{a as C,e as L,n as H,o as R,p as k}from"./chunk.R5R7CLOU.js";import"./chunk.3TVAE7LE.js";import"./chunk.JX2C3HVD.js";import"./chunk.3MU37W5D.js";import"./chunk.XOZU4OFA.js";import"./chunk.Z7N3MJ36.js";import{a as S}from"./chunk.6KYWJXZR.js";import"./chunk.TI4OSTQV.js";import"./chunk.ACB4TD4W.js";import"./chunk.VICCAWAN.js";import"./chunk.OU5TRY4N.js";import"./chunk.CQPNDJAC.js";import"./chunk.GYTVL6GR.js";import{G as T,Ra as E,T as b}from"./chunk.TMYGLXR6.js";import"./chunk.SDO3U72B.js";import{Oc as x}from"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import{b as g}from"./chunk.AJZBJBMO.js";var t=g(T(),1);var c=g(b(),1);function N(n){if(!n||n.interaction.outcome==="failed")return null;let s=n.offers[0],o=s?n.interaction.offered.find(i=>i.id===s.id)?.confidence:void 0;return s&&o!==void 0&&o>=.6?{offer:s,confidence:o}:null}function j({rest:n,hold:s,leave:o}){let i=S(),u=(0,t.useMemo)(()=>C(n.target,e=>i.store.graph.has(e)),[n.target,i.store]),l=u.on==="record"&&L(i.ai)!==void 0,m=l?H(i,u):void 0,p=JSON.stringify(u),[y,I]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!l||m!==void 0)return;let e=!0;return R(i,u).then(r=>{e&&I({key:p,result:r})}),()=>{e=!1}},[p,l]);let w=m??(y?.key===p?y.result:void 0),f=l?N(w):null,v=f?.offer.id??null,h=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(v===null)return;let e=r=>{r.target instanceof Node&&h.current?.contains(r.target)||o(!0)};return document.addEventListener("pointerdown",e,{capture:!0,passive:!0}),document.addEventListener("contextmenu",e,{capture:!0,passive:!0}),addEventListener("scroll",e,{capture:!0,passive:!0}),addEventListener("resize",e,{passive:!0}),()=>{document.removeEventListener("pointerdown",e,{capture:!0}),document.removeEventListener("contextmenu",e,{capture:!0}),removeEventListener("scroll",e,{capture:!0}),removeEventListener("resize",e)}},[v,o]),(0,t.useLayoutEffect)(()=>{let e=h.current;if(!e)return;if(typeof e.showPopover=="function"&&!E(e))try{e.showPopover()}catch{}let r=n.element.getBoundingClientRect(),d=e.getBoundingClientRect(),O=r.top-d.height-4>=4?r.top-d.height-4:Math.min(innerHeight-d.height-4,r.top+4),A=Math.max(4,Math.min(innerWidth-d.width-4,r.right-d.width));e.style.top=`${Math.round(O)}px`,e.style.left=`${Math.round(A)}px`},[v,n.element]),!f)return null;let{offer:a,confidence:P}=f,M=a.type==="panel"?"a panel":a.type==="place"?"go there":a.type==="record"?"open it":"suggested";return(0,c.jsxs)("button",{ref:h,type:"button",popover:"manual","data-testid":"hover-chip","data-ai-offer":a.id,"data-ai-offer-type":a.type,"data-graview-overlay":"","data-graview-popover":"","aria-label":`Suggested by AI: ${a.label}`,title:`Suggested by AI, ${Math.round(P*100)}% sure`,onPointerEnter:s,onPointerLeave:()=>o(),onClick:()=>{n.element.closest("[tabindex], a[href], button")?.focus({preventScroll:!0}),o(!0),k(i,w,a)},style:$,children:[(0,c.jsxs)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:["\u2726"," "]}),a.label,(0,c.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",M]})]})}var $={position:"fixed",inset:"auto",top:0,left:0,margin:0,zIndex:x("toast"),boxSizing:"border-box",width:"max-content",maxWidth:"min(320px, calc(100vw - 8px))",height:"auto",minHeight:24,padding:"2px 10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",font:"inherit",fontSize:"0.75rem",cursor:"pointer"};export{j as HoverChip};
1
+ import{a as C,e as L,n as H,o as R,p as k}from"./chunk.7IOC6U3C.js";import"./chunk.7FZY5E2U.js";import"./chunk.7354O67H.js";import"./chunk.XLM4ONUB.js";import"./chunk.XOZU4OFA.js";import"./chunk.C7EEYSAM.js";import{a as S}from"./chunk.DGWNVDZB.js";import"./chunk.TI4OSTQV.js";import"./chunk.3TME4BG3.js";import"./chunk.CV4QA4ZF.js";import"./chunk.OYRZ2DEI.js";import"./chunk.7EA7THSM.js";import"./chunk.AI2HBKVP.js";import{G as T,Ra as E,T as b}from"./chunk.Q5IAXTF5.js";import"./chunk.SDO3U72B.js";import{Oc as x}from"./chunk.VOHRQXCF.js";import"./chunk.SLBWPVIY.js";import{b as g}from"./chunk.AJZBJBMO.js";var t=g(T(),1);var c=g(b(),1);function N(n){if(!n||n.interaction.outcome==="failed")return null;let s=n.offers[0],o=s?n.interaction.offered.find(i=>i.id===s.id)?.confidence:void 0;return s&&o!==void 0&&o>=.6?{offer:s,confidence:o}:null}function j({rest:n,hold:s,leave:o}){let i=S(),u=(0,t.useMemo)(()=>C(n.target,e=>i.store.graph.has(e)),[n.target,i.store]),l=u.on==="record"&&L(i.ai)!==void 0,m=l?H(i,u):void 0,p=JSON.stringify(u),[y,I]=(0,t.useState)(null);(0,t.useEffect)(()=>{if(!l||m!==void 0)return;let e=!0;return R(i,u).then(r=>{e&&I({key:p,result:r})}),()=>{e=!1}},[p,l]);let w=m??(y?.key===p?y.result:void 0),f=l?N(w):null,v=f?.offer.id??null,h=(0,t.useRef)(null);if((0,t.useEffect)(()=>{if(v===null)return;let e=r=>{r.target instanceof Node&&h.current?.contains(r.target)||o(!0)};return document.addEventListener("pointerdown",e,{capture:!0,passive:!0}),document.addEventListener("contextmenu",e,{capture:!0,passive:!0}),addEventListener("scroll",e,{capture:!0,passive:!0}),addEventListener("resize",e,{passive:!0}),()=>{document.removeEventListener("pointerdown",e,{capture:!0}),document.removeEventListener("contextmenu",e,{capture:!0}),removeEventListener("scroll",e,{capture:!0}),removeEventListener("resize",e)}},[v,o]),(0,t.useLayoutEffect)(()=>{let e=h.current;if(!e)return;if(typeof e.showPopover=="function"&&!E(e))try{e.showPopover()}catch{}let r=n.element.getBoundingClientRect(),d=e.getBoundingClientRect(),O=r.top-d.height-4>=4?r.top-d.height-4:Math.min(innerHeight-d.height-4,r.top+4),A=Math.max(4,Math.min(innerWidth-d.width-4,r.right-d.width));e.style.top=`${Math.round(O)}px`,e.style.left=`${Math.round(A)}px`},[v,n.element]),!f)return null;let{offer:a,confidence:P}=f,M=a.type==="panel"?"a panel":a.type==="place"?"go there":a.type==="record"?"open it":"suggested";return(0,c.jsxs)("button",{ref:h,type:"button",popover:"manual","data-testid":"hover-chip","data-ai-offer":a.id,"data-ai-offer-type":a.type,"data-graview-overlay":"","data-graview-popover":"","aria-label":`Suggested by AI: ${a.label}`,title:`Suggested by AI, ${Math.round(P*100)}% sure`,onPointerEnter:s,onPointerLeave:()=>o(),onClick:()=>{n.element.closest("[tabindex], a[href], button")?.focus({preventScroll:!0}),o(!0),k(i,w,a)},style:$,children:[(0,c.jsxs)("span",{"aria-hidden":"true",style:{color:"var(--graview-accent)"},children:["\u2726"," "]}),a.label,(0,c.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",M]})]})}var $={position:"fixed",inset:"auto",top:0,left:0,margin:0,zIndex:x("toast"),boxSizing:"border-box",width:"max-content",maxWidth:"min(320px, calc(100vw - 8px))",height:"auto",minHeight:24,padding:"2px 10px",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",borderRadius:999,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",font:"inherit",fontSize:"0.75rem",cursor:"pointer"};export{j as HoverChip};
@@ -5,67 +5,67 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <title>Graview preview</title>
7
7
  <link rel="preload" href="/graview/document" as="fetch" crossorigin="anonymous">
8
- <link rel="modulepreload" href="/chunk.353CGK6C.js">
9
- <link rel="modulepreload" href="/chunk.WQLAIEWJ.js">
10
- <link rel="modulepreload" href="/chunk.4N5R4K6O.js">
11
- <link rel="modulepreload" href="/chunk.KK46XLGU.js">
8
+ <link rel="modulepreload" href="/chunk.M33LUF3Q.js">
9
+ <link rel="modulepreload" href="/chunk.7UXDIEPK.js">
10
+ <link rel="modulepreload" href="/chunk.KSJ3J5UN.js">
11
+ <link rel="modulepreload" href="/chunk.HSGUXMAO.js">
12
12
  <link rel="modulepreload" href="/chunk.Q5WEOX3Q.js">
13
- <link rel="modulepreload" href="/chunk.76QSPWSJ.js">
14
- <link rel="modulepreload" href="/chunk.FKJ3HIA5.js">
15
- <link rel="modulepreload" href="/chunk.GYTVL6GR.js">
16
- <link rel="modulepreload" href="/chunk.TMYGLXR6.js">
13
+ <link rel="modulepreload" href="/chunk.U6PCKJ26.js">
14
+ <link rel="modulepreload" href="/chunk.5WU2UTP7.js">
15
+ <link rel="modulepreload" href="/chunk.AI2HBKVP.js">
16
+ <link rel="modulepreload" href="/chunk.Q5IAXTF5.js">
17
17
  <link rel="modulepreload" href="/chunk.SDO3U72B.js">
18
- <link rel="modulepreload" href="/chunk.P4CLT32V.js">
18
+ <link rel="modulepreload" href="/chunk.VOHRQXCF.js">
19
19
  <link rel="modulepreload" href="/chunk.SLBWPVIY.js">
20
20
  <link rel="modulepreload" href="/chunk.AJZBJBMO.js">
21
- <link rel="modulepreload" href="/chunk.Y2ZBVWII.js">
22
- <link rel="modulepreload" href="/chunk.JG2FGZF2.js">
23
- <link rel="modulepreload" href="/chunk.IE4ZJQV3.js">
24
- <link rel="modulepreload" href="/chunk.TVWN5I4M.js">
25
- <link rel="modulepreload" href="/chunk.B7LBG4UP.js">
26
- <link rel="modulepreload" href="/chunk.7G4M2PX3.js">
21
+ <link rel="modulepreload" href="/chunk.ZEKKIMKI.js">
22
+ <link rel="modulepreload" href="/chunk.3ZQAPPJ5.js">
23
+ <link rel="modulepreload" href="/chunk.D62V3TBW.js">
24
+ <link rel="modulepreload" href="/chunk.FJC6PMOG.js">
25
+ <link rel="modulepreload" href="/chunk.XPR3QFF4.js">
26
+ <link rel="modulepreload" href="/chunk.YUEOUV7G.js">
27
27
  <link rel="modulepreload" href="/chunk.UGFDSE37.js">
28
- <link rel="modulepreload" href="/chunk.NNUUD26E.js">
28
+ <link rel="modulepreload" href="/chunk.W5UJLKIT.js">
29
29
  <link rel="modulepreload" href="/chunk.PXQVXBNG.js">
30
- <link rel="modulepreload" href="/chunk.OJ64WTLW.js">
31
- <link rel="modulepreload" href="/chunk.GMAXA5GV.js">
32
- <link rel="modulepreload" href="/chunk.IBJBCZKG.js">
33
- <link rel="modulepreload" href="/chunk.NQ26KMSQ.js">
34
- <link rel="modulepreload" href="/chunk.GJQF7I22.js">
35
- <link rel="modulepreload" href="/chunk.SPU3BVAO.js">
36
- <link rel="modulepreload" href="/chunk.OPCBZNKF.js">
37
- <link rel="modulepreload" href="/chunk.UK5F3S2N.js">
38
- <link rel="modulepreload" href="/chunk.2VJ52LGS.js">
39
- <link rel="modulepreload" href="/chunk.JI2UVZUU.js">
40
- <link rel="modulepreload" href="/chunk.CTOBNZLM.js">
41
- <link rel="modulepreload" href="/chunk.34HGT7HQ.js">
42
- <link rel="modulepreload" href="/chunk.TNL2BVCH.js">
43
- <link rel="modulepreload" href="/chunk.NZDHXREL.js">
44
- <link rel="modulepreload" href="/chunk.TBSPEO2L.js">
45
- <link rel="modulepreload" href="/chunk.5ON3JSAK.js">
46
- <link rel="modulepreload" href="/chunk.3SBTQ66X.js">
47
- <link rel="modulepreload" href="/chunk.SSAY4ITS.js">
48
- <link rel="modulepreload" href="/chunk.3TVAE7LE.js">
49
- <link rel="modulepreload" href="/chunk.JX2C3HVD.js">
30
+ <link rel="modulepreload" href="/chunk.7UJZP3YK.js">
31
+ <link rel="modulepreload" href="/chunk.R77TACXU.js">
32
+ <link rel="modulepreload" href="/chunk.6JERQFZI.js">
33
+ <link rel="modulepreload" href="/chunk.7XJ3XQZD.js">
34
+ <link rel="modulepreload" href="/chunk.52J42KR5.js">
35
+ <link rel="modulepreload" href="/chunk.T2Q3AAQI.js">
36
+ <link rel="modulepreload" href="/chunk.63SRVTG2.js">
37
+ <link rel="modulepreload" href="/chunk.C4EPMV7O.js">
38
+ <link rel="modulepreload" href="/chunk.G7XKQNOL.js">
39
+ <link rel="modulepreload" href="/chunk.7KZ44FEU.js">
40
+ <link rel="modulepreload" href="/chunk.LSL25VXW.js">
41
+ <link rel="modulepreload" href="/chunk.WWUMSCYC.js">
42
+ <link rel="modulepreload" href="/chunk.J2R55TM7.js">
43
+ <link rel="modulepreload" href="/chunk.KPUX27ZT.js">
44
+ <link rel="modulepreload" href="/chunk.DIS7JS7X.js">
45
+ <link rel="modulepreload" href="/chunk.D2T563AA.js">
46
+ <link rel="modulepreload" href="/chunk.JV7FLVUV.js">
47
+ <link rel="modulepreload" href="/chunk.GL3YVGAP.js">
48
+ <link rel="modulepreload" href="/chunk.7FZY5E2U.js">
49
+ <link rel="modulepreload" href="/chunk.7354O67H.js">
50
50
  <link rel="modulepreload" href="/chunk.XOZU4OFA.js">
51
- <link rel="modulepreload" href="/chunk.Z7N3MJ36.js">
51
+ <link rel="modulepreload" href="/chunk.C7EEYSAM.js">
52
52
  <link rel="modulepreload" href="/chunk.MB7LKKUD.js">
53
53
  <link rel="modulepreload" href="/chunk.WVUJXDXZ.js">
54
- <link rel="modulepreload" href="/chunk.GLTWLQ6L.js">
55
- <link rel="modulepreload" href="/chunk.ACB4TD4W.js">
56
- <link rel="modulepreload" href="/chunk.XCQ7ZPR5.js">
57
- <link rel="modulepreload" href="/chunk.MY5OXSS7.js">
58
- <link rel="modulepreload" href="/chunk.NVRK6A7T.js">
54
+ <link rel="modulepreload" href="/chunk.QRCTTDDQ.js">
55
+ <link rel="modulepreload" href="/chunk.3TME4BG3.js">
56
+ <link rel="modulepreload" href="/chunk.I43ONAEL.js">
57
+ <link rel="modulepreload" href="/chunk.73EKJ4JN.js">
58
+ <link rel="modulepreload" href="/chunk.INL4OZI7.js">
59
59
  <link rel="modulepreload" href="/chunk.GZHZLJBF.js">
60
- <link rel="modulepreload" href="/chunk.OW72XZF4.js">
60
+ <link rel="modulepreload" href="/chunk.YKACMLLU.js">
61
61
  <link rel="modulepreload" href="/chunk.OJGHDWI6.js">
62
- <link rel="modulepreload" href="/chunk.KRODTMGR.js">
63
- <link rel="modulepreload" href="/chunk.VICCAWAN.js">
64
- <link rel="modulepreload" href="/chunk.OU5TRY4N.js">
65
- <link rel="modulepreload" href="/chunk.CQPNDJAC.js">
66
- <link rel="modulepreload" href="/chunk.CUB4IAUJ.js">
67
- <link rel="modulepreload" href="/chunk.BV6HKTHK.js">
68
- <script>(()=>{const later=["/chunk.AL45OI4A.js","/chunk.MMVCZOEX.js","/chunk.Y5AMZBHA.js","/chunk.HJCQ6I3S.js","/chunk.7GAC7U34.js","/chunk.T3RTFTOZ.js","/chunk.W2DKFQ6R.js","/chunk.3H7YIKKC.js","/chunk.ET3XJDPX.js","/chunk.HVX7LFWR.js","/chunk.Y3LTHEN7.js","/chunk.FYDDFOSD.js","/chunk.2W45NM7Q.js","/chunk.FEIJ7ETK.js","/chunk.LYIHPVDZ.js","/chunk.FU4YSVWX.js","/chunk.TI4OSTQV.js","/chunk.PPZ2TOB5.js"],first=[...document.querySelectorAll('link[rel="modulepreload"]')];let left=first.length;const go=()=>{for(const href of later){const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};if(left===0)return go();const one=()=>{if(--left===0)go()};for(const link of first){link.addEventListener("load",one,{once:true});link.addEventListener("error",one,{once:true})}})()</script>
62
+ <link rel="modulepreload" href="/chunk.337JMOTL.js">
63
+ <link rel="modulepreload" href="/chunk.CV4QA4ZF.js">
64
+ <link rel="modulepreload" href="/chunk.OYRZ2DEI.js">
65
+ <link rel="modulepreload" href="/chunk.7EA7THSM.js">
66
+ <link rel="modulepreload" href="/chunk.7OAXW7QF.js">
67
+ <link rel="modulepreload" href="/chunk.T6KKNWZT.js">
68
+ <script>(()=>{const later=["/chunk.QXCYAFRT.js","/chunk.LESRQN3Y.js","/chunk.JOWJNIWH.js","/chunk.HJCQ6I3S.js","/chunk.JQBP6QWQ.js","/chunk.I2W7HSBU.js","/chunk.BJL6EL6B.js","/chunk.VGTEEANA.js","/chunk.SZCZD2GM.js","/chunk.FEBCIEI3.js","/chunk.CC7E6NUQ.js","/chunk.DVLWSCIC.js","/chunk.DC7M56NM.js","/chunk.UEPVA6IS.js","/chunk.Y37DXEHG.js","/chunk.DXZ5VYCQ.js","/chunk.TI4OSTQV.js","/chunk.2X3UZJWI.js"],first=[...document.querySelectorAll('link[rel="modulepreload"]')];let left=first.length;const go=()=>{for(const href of later){const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};if(left===0)return go();const one=()=>{if(--left===0)go()};for(const link of first){link.addEventListener("load",one,{once:true});link.addEventListener("error",one,{once:true})}})()</script>
69
69
  <style>html,body{margin:0;height:100%}#graview-app{min-height:100dvh}</style>
70
70
  </head>
71
71
  <body>
@@ -1,2 +1,2 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Dt,b as Xn,c as er,d as tr,e as nr,f as Bt,g as rr,h as Wt}from"./chunk.353CGK6C.js";import{a as Zr}from"./chunk.WQLAIEWJ.js";import{a as $t,b as ar,c as ir,d as sr,e as Nt,f as dr,g as cr,h as lr,i as ur,j as fr,k as pr,l as mr,m as hr,n as je}from"./chunk.4N5R4K6O.js";import{b as or}from"./chunk.KK46XLGU.js";import{a as At}from"./chunk.Q5WEOX3Q.js";import{a as Rt,g as Tn}from"./chunk.76QSPWSJ.js";import{k as rt}from"./chunk.FKJ3HIA5.js";import{C as Jn,H as Yn,L as Qn,M as Zn,j as Qr,k as zn,n as it,o as Gn,q as Un,u as Kn,z as st}from"./chunk.GYTVL6GR.js";import{Ba as Nn,Ca as In,Ea as _n,Fa as Vt,G as Ht,Ja as jn,Ka as qn,Na as at,T as Fn,Y as Cn,a as xn,b as Lt,c as ot,fa as Ln,ga as Mn,j as On,m as Mt,ua as Hn,va as Vn,wa as Dn,xa as Bn,ya as Wn,za as $n}from"./chunk.TMYGLXR6.js";import{a as Ee}from"./chunk.SDO3U72B.js";import{Bb as wn,Ed as ke,Fd as En,Gd as An,Ld as xt,Md as Ot,Nd as Ft,Qc as bn,Qd as Rn,Rd as Ct,cb as _e,dd as Sn,ec as Tt,fc as vn,fd as Pn,gd as kn,id as nt,nb as tt,ob as gn}from"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import{b as Le}from"./chunk.AJZBJBMO.js";async function dt(e,n={}){let a=e.compiled===void 0||!eo(e.compiled,e.document)?void 0:Tn(e.compiled,n);if(a?.ok)return a;let{compileDocumentWithoutCheck:s}=await Xr();return s(e.document,n)}var yr,Xr=()=>yr??=(__graviewPreload(import.meta.url,["./chunk.JBR66TUP.js","./chunk.76QSPWSJ.js","./chunk.XCQ7ZPR5.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.AJAMTRZ3.js")).catch(e=>{throw yr=void 0,e});function eo(e,n){let a=typeof e=="object"&&e!==null?e.document:void 0,s=n;if(typeof s=="string")try{s=JSON.parse(s)}catch{return!1}return a!==void 0&&At(Rt(a).document)===At(Rt(s).document)}var c=Le(Ht(),1);var lt=Le(Ht(),1),It="data-graview-drawn",to=200,gr=50,no=1e4,ct=()=>typeof performance<"u"?performance.now():Date.now();function ro(e){let n=[...e.querySelectorAll("img")];for(let a of e.querySelectorAll("[data-worker-view]"))a.shadowRoot&&n.push(...a.shadowRoot.querySelectorAll("img"));return n}function oo(e,n){if(e.ownerDocument.fonts?.status==="loading"||Vn()>0||$n(n)>0||e.querySelector('[aria-busy="true"]')||ro(e).some(s=>!s.complete&&s.loading!=="lazy"))return!1;for(let s of e.querySelectorAll("[data-worker-view-place]"))if(!s.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function wr(e){let n=e.querySelector("[data-embed-content]"),a=[...e.querySelectorAll("[data-worker-view]")].map(s=>`${s.offsetWidth}x${s.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${a.join(",")}`}function ao(e,n,a,s){e.removeAttribute(It);let d=e.ownerDocument.defaultView;if(!d)return()=>{};let l=ct(),S=l,p=wr(e),w=!1,R,O=typeof MutationObserver>"u"?void 0:new MutationObserver(P=>{P.some(j=>!(j.target===e&&j.attributeName===It))&&(S=ct())});O?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let v=()=>{w=!0,O?.disconnect(),R!==void 0&&clearTimeout(R)},E=P=>{let j=!1,se=()=>{j||(j=!0,P())};typeof d.requestAnimationFrame=="function"&&d.requestAnimationFrame(()=>setTimeout(se,0)),setTimeout(se,100)},L=()=>{if(w)return;let P=wr(e);P!==p&&(p=P,S=ct());let j=ct();if(oo(e,s)&&j-S>=to||j-l>=no){E(()=>{w||(v(),e.setAttribute(It,n),In(),a())});return}R=setTimeout(L,gr)};return R=setTimeout(L,gr),v}function vr(e,n,a,s,d){Nn();let l=(0,lt.useRef)({place:a,onDrawn:s});l.current={place:a,onDrawn:s},(0,lt.useLayoutEffect)(()=>{d&&Wn(d);let S=R=>ao(R,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),d);if(e.current)return S(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=S(e.current))}),()=>{w=!0,p?.()}},[n,e,d])}var ye=Le(Ht(),1),qe,io=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.KVEDMKUN.js","./chunk.XCCBUWMC.js","./chunk.FFCUZPTC.js","./chunk.MG3DMURZ.js","./chunk.2W2YVB6X.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.DUY27OJV.js"))),br=()=>io().then(e=>void(qe=e),()=>new Promise(e=>setTimeout(e,2e3)).then(br)),_t=Hn(br),Sr=e=>!!e&&qe===void 0;function jt({onReady:e,fetch:n}){return(0,ye.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var so=0;function Pr(e){let[n,a]=(0,ye.useState)(()=>qe);(0,ye.useEffect)(()=>{if(!e||n)return;let l=!1;return _t().then(()=>{l||a(qe)}),()=>{l=!0}},[e,n]);let s=(0,ye.useMemo)(()=>so+=1,[e]);return{over:(0,ye.useMemo)(()=>{let l=n??qe;if(!e||!l)return;let{source:S,worker:p,...w}=e,R={...w,worker:p??{source:S},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:O=>l.registerWorkerView(O,R)}},[e,n]),n:s}}var Ar=Le(Zr(),1),G=Le(Qr(),1);var h=Le(Fn(),1);function ut(e,n={}){let a=Vt(e);return{Face:a.part((d,l)=>(0,c.createElement)(d,l),n),fetch:()=>a.load().then(()=>{}),here:()=>a.current!==void 0||a.failed}}var Gt=e=>Promise.all([e,Qn()]).then(([n])=>n),Rr=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.NNUUD26E.js","./chunk.GMAXA5GV.js","./chunk.Y5AMZBHA.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.HJCQ6I3S.js","./chunk.7GAC7U34.js","./chunk.T3RTFTOZ.js","./chunk.FEIJ7ETK.js","./chunk.34HGT7HQ.js","./chunk.LYIHPVDZ.js","./chunk.FU4YSVWX.js","./chunk.TNL2BVCH.js","./chunk.TBSPEO2L.js","./chunk.3SBTQ66X.js","./chunk.3H7YIKKC.js","./chunk.ET3XJDPX.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.4N5R4K6O.js","./chunk.KK46XLGU.js","./chunk.TI4OSTQV.js","./chunk.HVX7LFWR.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.SJKHVIHA.js"))),co=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.JG2FGZF2.js","./chunk.IE4ZJQV3.js","./chunk.TVWN5I4M.js","./chunk.B7LBG4UP.js","./chunk.7G4M2PX3.js","./chunk.UGFDSE37.js","./chunk.NNUUD26E.js","./chunk.PXQVXBNG.js","./chunk.OJ64WTLW.js","./chunk.GMAXA5GV.js","./chunk.IBJBCZKG.js","./chunk.NQ26KMSQ.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.OPCBZNKF.js","./chunk.UK5F3S2N.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.CTOBNZLM.js","./chunk.34HGT7HQ.js","./chunk.TNL2BVCH.js","./chunk.NZDHXREL.js","./chunk.TBSPEO2L.js","./chunk.5ON3JSAK.js","./chunk.3SBTQ66X.js","./chunk.SSAY4ITS.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.Y2ZBVWII.js"))),lo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.JG2FGZF2.js","./chunk.IE4ZJQV3.js","./chunk.TVWN5I4M.js","./chunk.B7LBG4UP.js","./chunk.7G4M2PX3.js","./chunk.UGFDSE37.js","./chunk.NNUUD26E.js","./chunk.PXQVXBNG.js","./chunk.OJ64WTLW.js","./chunk.GMAXA5GV.js","./chunk.IBJBCZKG.js","./chunk.NQ26KMSQ.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.OPCBZNKF.js","./chunk.UK5F3S2N.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.CTOBNZLM.js","./chunk.34HGT7HQ.js","./chunk.TNL2BVCH.js","./chunk.NZDHXREL.js","./chunk.TBSPEO2L.js","./chunk.5ON3JSAK.js","./chunk.3SBTQ66X.js","./chunk.SSAY4ITS.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.QEQQXWYU.js"))),Tr=ut(()=>Gt(Rr().then(e=>e.SceneFace)),{what:"This view"}),xr=ut(()=>Rr().then(e=>e.SceneKeeping),{quiet:!0}),Or=ut(()=>Gt(co().then(e=>e.PagesContent)),{what:"This page"}),Fr=ut(()=>Gt(lo().then(e=>e.PictureFace)),{what:"This picture"}),uo=Tr.Face,fo=xr.Face,po=Or.Face,mo=Fr.Face;function Me(...e){let n=e.length>0?e:["scene","pages","picture"],a=new Set(n.flatMap(Cr));return Promise.all([...[...a].map(s=>s.fetch()),Un()]).then(()=>{},()=>{})}var Cr=e=>e==="pages"?[Or]:e==="picture"?[Fr]:[Tr,xr],Lr=e=>Cr(e).every(n=>n.here()),ho=150,qt=0;function kr(e,n){if(Lr(e))return n();let a=++qt,s=()=>{a===qt&&(qt+=1,n())};Me(e).then(s),setTimeout(s,ho)}var yo=768;function go(e,n){let a=n!==null&&n>=yo;(0,c.useEffect)(()=>{if(!a||e==="picture")return;let s=e==="pages"?"scene":"pages";if(Lr(s))return;let d=globalThis,l=()=>void Me(s),S=()=>{},p=_n(()=>{if(d.requestIdleCallback&&d.cancelIdleCallback){let w=d.requestIdleCallback(l,{timeout:4e3});S=()=>d.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);S=()=>clearTimeout(w)}});return()=>(p(),S())},[e,a])}function wo({asked:e,shown:n,onDrawn:a}){return(0,c.useLayoutEffect)(()=>a(e,n),[e,n,a]),null}function vo({auto:e,scene:n}){return(0,h.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${Nt}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var bo=Vt(Ee(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,h.jsx)(e.StudioPlace,{...n}),{quiet:!0});function Mr(e,n,a,s,d){return Bt(e,nr(n?ot(n):d??xn,s),a)}function Ut(e){return e&&ot(e).overview?"graview":"scene"}function Er(e,n){if(n.homeView?.()===void 0)return!1;let a=e.pages?.first?.trim();return a===void 0||a===""||a==="/"||a.toLowerCase()==="home"}function Hr(e){let[,n]=(0,c.useState)(!1),a=(0,c.useCallback)(()=>n(!0),[]),s=(0,c.useRef)(!1);return e.at&&!ft?(0,h.jsx)(jt,{onReady:a,fetch:Kt}):!s.current&&Sr(e.draftView)?(0,h.jsx)(jt,{onReady:a,fetch:_t}):(s.current=!0,(0,h.jsx)(So,{...e}))}function So(e){let{app:n,stop:a,bar:s=!0,standing:d="Everything is in order",principal:l,heading:S=2}=e,{rootRef:p,scope:w,css:R,scheme:O,store:v,presence:E,brand:L,auto:P,height:j}=dr(e),se=Pr(e.draftView),D=ir(e,Zn,se.over),[ee]=(0,c.useState)(Bn),f=e.basePath===void 0?{}:{basePath:e.basePath},[B]=(0,c.useState)(it),U=e.notices??B,Y=y=>xt(y,f),F={...e.routing?{routing:e.routing}:{},...f},[le]=(0,c.useState)(()=>{let y=e.at?.face;if(y)return y;let H=a===void 0&&Er(n,D)?"pages":Ut(a),V=Dt({...F,face:H});return e.face===void 0&&e.onOpening?.(V),V}),[W,x]=(0,c.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&a===void 0&&Xn(F)&&Er(n,D)),Re=(0,c.useRef)(e.onFace);Re.current=e.onFace,(0,c.useLayoutEffect)(()=>{W&&(Re.current?.("pages"),x(!1))},[W]);let k=W?"pages":e.face??le,oe=n.schema.kinds,T=e.routing==="address",Q=(0,c.useMemo)(()=>e.at?ft.settleAt(e,v.seenBy(l??{kind:"human"}),D.places()):void 0,[]),$=(0,c.useMemo)(()=>Mn(D,n.schema),[D,n.schema]),ue=(0,c.useMemo)(()=>{let y=Q?.stop??(T?er(e.basePath):void 0)??a;return k==="scene"&&y===void 0&&$===void 0&&(e.path===void 0||zt(e.path))?Wt(void 0):Mr(k,y,oe,D.places(),$)},[]),[ve]=(0,c.useState)(k);(0,c.useEffect)(()=>{ve!=="pages"&&Ln(D)},[ve,D]);let N=(0,c.useRef)(void 0),q=y=>y===void 0||zt(y)?"/":y;N.current??={path:q(Q?.path??(T?k==="pages"?(Ot(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==N.current.asked&&(N.current={path:q(e.path),asked:e.path});let I=(0,c.useRef)(e.onNavigate);I.current=e.onNavigate;let ae=(0,c.useCallback)((y,H)=>{N.current.path=y,I.current?.(y,H)},[]),{at:M,setAt:Te,steering:K,steer:te}=pr(N.current.path),C=(0,c.useContext)(Vr);C&&(C.pages=()=>N.current.path);let fe=(0,c.useRef)(void 0),pe=(0,c.useCallback)(y=>void(N.current.path=y),[]),de=zn(p),[Z,Ge]=(0,c.useState)(!1),xe=e.pagesBelow!==void 0&&de!==null&&de<e.pagesBelow&&(k==="scene"||k==="graview")&&!Z,A=xe?"pages":k,$e=(0,c.useRef)(!1);$e.current=Z&&e.pagesBelow!==void 0&&de!==null&&de<e.pagesBelow&&(k==="scene"||k==="graview"),C&&(C.shown=A);let ne=(0,c.useRef)(k==="graview"?"graview":"scene");(A==="scene"||A==="graview")&&(ne.current=A),(0,c.useState)(()=>{if(!T||typeof window>"u"||A==="pages"||A==="picture")return;let{pathname:y,search:H,hash:V}=window.location;Ot(y,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${Y(ke)}${H}${V}`)}),sr(p,A,e.onIntrinsicHeight),go(A,de);let ce=mr(e.onError,A),be=hr(e.onReady,A),Ne=(0,c.useRef)(e.onFaceDrawn);Ne.current=e.onFaceDrawn;let He=(0,c.useCallback)((y,H)=>{be(H),Ne.current?.(y)},[be]),[yt,gt]=(0,c.useState)(null),Ue=D.places(),_=(0,c.useRef)({shown:A,onFace:e.onFace});_.current={shown:A,onFace:e.onFace};let re=(0,c.useCallback)((y,H,V)=>{if(T){fe.current?.(y,H,V);return}_.current.onFace?.(y),I.current?.(y==="pages"?H??N.current.path:ke,"push")},[T]),[X,Oe]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{A==="pages"&&Oe(void 0)},[A]);let Se=(0,c.useRef)(a);(0,c.useEffect)(()=>{Se.current!==a&&(Se.current=a,Oe(void 0))},[a]);let Ke=(0,c.useCallback)(y=>{if(_.current.shown==="pages"){if(Ge(!0),Oe(y),k==="scene"||k==="graview"){kr(k,()=>{T?window.history.pushState(null,"",`${Y(ke)}${y??""}`):I.current?.(ke,"push")});return}kr(ne.current,()=>re(ne.current,void 0,y))}},[T,k,e.basePath,re]),Pe=(0,c.useCallback)(y=>{if(_.current.shown==="pages"){K.go.current||(N.current.path=y),te(y);return}if(N.current.path=y,Te(y),$e.current){Ge(!1),T?window.history.pushState(null,"",Y(y)):I.current?.(y,"push");return}re("pages",y)},[K,te,Te,re,T,e.basePath]),Fe=D.arrangement?.(),me=A==="pages",Ve=e.hrefOf,z=Ve??(T?Y:void 0),Ce=(0,c.useMemo)(()=>({open:Pe,...Ve?{href:Ve}:T?{href:y=>xt(y,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[Pe,T,e.basePath,Ve]);return(0,h.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":A,"data-graview-scheme":O,...xe?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:j,minHeight:P?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,h.jsx)("style",{children:R}),(0,h.jsxs)(qn.Provider,{value:ce,children:[(0,h.jsx)(cr,{rootRef:p,board:U}),(0,h.jsx)(ar,{rootRef:p,firstLook:e.firstLook,app:Jn(L??{name:n.name},n.schema)}),(0,h.jsx)(je,{module:"@graview/react",report:ce,content:!0,children:(0,h.jsx)(Dn.Provider,{value:ee,children:(0,h.jsx)(Cn,{store:v,views:D,initialView:ue,scheme:O,...lr(e,E,L),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,h.jsxs)(Gn.Provider,{value:U,children:[(0,h.jsx)(Ao,{face:A,stop:X??a,kinds:oe,places:Ue,opens:$}),C?(0,h.jsx)(Po,{into:C}):null,(0,h.jsx)(ko,{rootRef:p,face:k,shown:A,path:M,stop:a,draft:se.n,onDrawn:e.onDrawn,parts:ee}),T?(0,h.jsx)(tr,{pagesWere:Q?.path,basePath:e.basePath,shown:A,onFace:e.onFace,toggle:fe,kinds:oe,places:Ue,opens:$,landed:pe}):null,s&&A!=="picture"?(0,h.jsx)(je,{module:"@graview/embed",report:ce,children:(0,h.jsx)(ur,{name:L?.name??n.name,heading:S,named:$t(s).name!==!1,faces:$t(s).faces===!1?void 0:{scene:{label:En(Fe),current:!me,go:()=>Ke(),reach:()=>void Me(ne.current)},pages:{label:An(Fe),current:me,go:()=>Pe(N.current.path),reach:()=>void Me("pages")}},at:me?M:null,without:e.pages?.without(),home:{...z?.("/")!==void 0?{href:z("/")}:{},go:()=>Pe("/"),current:me&&M.split("?")[0]==="/"},reach:{...z?{href:z}:{},go:y=>Pe(y.path)},standing:d,hostActions:e.hostActions,keeping:me?void 0:(0,h.jsx)(Ro,{app:n,studio:e.studio,report:ce}),onFind:gt,switch:e.switch})}):null,(0,h.jsx)(Kn.Provider,{value:yt,children:(0,h.jsx)(je,{module:A==="pages"||A==="picture"?"@graview/pages":"@graview/react",report:ce,content:!0,children:(0,h.jsxs)(c.Suspense,{fallback:(0,h.jsx)(vo,{auto:P,scene:A!=="pages"&&A!=="picture"}),children:[A==="picture"?(0,h.jsx)(mo,{scope:w,store:v,views:D,as:(a?ot(a).within?.view:void 0)??""}):A==="pages"?(0,h.jsx)(po,{store:v,views:D,presence:E,auto:P,brand:L,steering:K,overview:Ke,scope:w,titleLevel:fr(S),quickAsk:st(e.quickAsk),props:{...e,onNavigate:ae,...T?{}:{path:N.current.path}}}):(0,h.jsx)(jn.Provider,{value:Ce,children:(0,h.jsx)(uo,{address:T,auto:P,scheme:O,scope:w,quickAsk:st(e.quickAsk)})}),(0,h.jsx)(wo,{asked:k,shown:A,onDrawn:He})]})},A)})]})})})})]})]})}var zt=e=>e.split(/[?#]/)[0]===ke,Vr=(0,c.createContext)(null);function Po({into:e}){return e.view=at().view,null}function ko({rootRef:e,face:n,shown:a,path:s,stop:d,draft:l,onDrawn:S,parts:p}){let{view:w}=at(),R=a==="scene"||a==="graview",O=Lt(w),v={face:n,path:R?ke:a==="picture"?d??"#":s,stop:O};return vr(e,`${a} ${R?O:v.path} ${l}`,v,S,p),null}var ft,Eo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.353CGK6C.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.CI4DEKPX.js"))),Kt=()=>Eo().then(e=>void(ft=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(a),e()},a=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Kt));function Ao({face:e,stop:n,kinds:a,places:s,opens:d}){let{view:l,go:S}=at(),p=(0,c.useRef)({face:e,stop:n});return(0,c.useLayoutEffect)(()=>{let w=p.current.stop!==n,R=p.current.face!==e,O=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!R||e==="pages"||e==="picture")return;let v=(w||O)&&n!==void 0?Mr(e,n,a,s):O&&rr(l)?Bt(e,Wt(d),a):e==="graview"?Mt(l,!0):l.overview?On(Mt(l,!1),Yn(l,a)):l;S(v)},[e,n,a,l,S,d]),null}function Ro({app:e,studio:n,report:a}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(fo,{})}),n!==!1?(0,h.jsx)(je,{module:"@graview/studio",report:a,children:(0,h.jsx)(To,{app:e,studio:n})}):null]})}function To({app:e,studio:n}){let a={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},s=n?.place;return s?(0,h.jsx)(s,{...a}):(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(bo,{...a})})}function xo({path:e,stop:n,...a},s){return{...a,app:s.app,at:s.at,remote:s.remote,...s.remote.presence?{presence:s.remote.presence}:{}}}function Jt(e,n){let a=n.store??n.remote?.store??or(n.app,n.seed),s=n.notices??it(),d=null,l={},S=0,p=n.label,w=n.app,R=Promise.resolve(),O=n.at?.face??n.face,v=O===void 0?void 0:Dt({...n,face:O}),E=v??Ut(n.stop),L=null,P=[],j=f=>{if(L=f,f!==E)return;let B=P;P=[];for(let U of B)U()};function se(){let[f,B]=(0,c.useState)(v),[U,Y]=(0,c.useState)(n.stop),[F,le]=(0,c.useState)(n.path),[W,x]=(0,c.useState)(n.scheme??"auto"),[Re,k]=(0,c.useState)(n.principal),[oe,T]=(0,c.useState)(n.seats),[Q,$]=(0,c.useState)(n.quickAsk),[ue,ve]=(0,c.useState)(n.people),[N,q]=(0,c.useState)(n.hostContext),[I,ae]=(0,c.useState)(n.brand),[M,Te]=(0,c.useState)(n.label),[K,te]=(0,c.useState)(n.hostActions),[C,fe]=(0,c.useState)(void 0),[pe,de]=(0,c.useState)(n.draftView);return d={app:Z=>{fe(Z),le(void 0),Y(void 0)},face:B,stop:Y,path:le,scheme:x,seat:k,seats:T,quickAsk:$,people:ve,hostContext:q,brand:ae,label:Te,hostActions:te,draft:de},(0,h.jsx)(Vr.Provider,{value:l,children:(0,h.jsx)(Hr,{...C?xo(n,C):n,store:a,notices:s,...f!==void 0?{face:f}:{},onOpening:Z=>{E=Z},...U!==void 0?{stop:U}:{},...F!==void 0?{path:F}:{},...Re?{principal:Re}:{},...oe?{seats:oe}:{},...Q!==void 0?{quickAsk:Q}:{},...ue?{people:ue}:{},...N?{hostContext:N}:{},...I?{brand:I}:{},label:M,hostActions:K,draftView:pe,scheme:W,onFace:Z=>{E=Z,B(Z)},onSeat:k,onFaceDrawn:j},C?.n??0)})}let D=()=>{let f=l.view?.focusId,B=f?a.graph.getNode(f)?.kind:void 0,U=(l.shown??E)==="scene"||(l.shown??E)==="graview";return{face:E,path:U?ke:l.pages?.()??n.path??"/",stop:l.view?Lt(l.view):n.stop??"#",...B?{kind:B}:{}}},ee=(0,Ar.createRoot)(e);return(0,G.flushSync)(()=>ee.render((0,h.jsx)(se,{}))),{get store(){return a},where:D,setApp:(f,B,U)=>{let Y="graph"in B?{store:B}:B,F=()=>{let le=D();a=Y.store,p=U?.label??(p===w.name?f.name:p),w=f,(0,G.flushSync)(()=>{d?.label(p),d?.app({app:f,remote:Y,at:le,n:++S})})};ft?F():R=R.then(Kt).then(F)},setFace:f=>{E=f,(0,G.flushSync)(()=>d?.face(f))},setStop:f=>(0,G.flushSync)(()=>d?.stop(f)),setPath:f=>(0,G.flushSync)(()=>{if(zt(f)){(E==="pages"||E==="picture")&&(E="scene",d?.face("scene"));return}d?.path(f),E!=="pages"&&(E="pages",d?.face("pages"))}),setScheme:f=>(0,G.flushSync)(()=>d?.scheme(f)),setSeat:f=>(0,G.flushSync)(()=>d?.seat(f)),setSeats:f=>(0,G.flushSync)(()=>d?.seats(f)),setQuickAsk:f=>(0,G.flushSync)(()=>d?.quickAsk(f)),setPeople:f=>(0,G.flushSync)(()=>d?.people(f)),setHostContext:f=>(0,G.flushSync)(()=>d?.hostContext(f)),setBrand:f=>(0,G.flushSync)(()=>d?.brand(f)),setDraftView:f=>(0,G.flushSync)(()=>d?.draft(f)),setLabel:f=>{p=f,(0,G.flushSync)(()=>d?.label(f))},setHostActions:f=>(0,G.flushSync)(()=>d?.hostActions(f)),drawn:()=>R.then(()=>L===E?void 0:new Promise(f=>P.push(f))),notify:f=>{let B;return(0,G.flushSync)(()=>{B=s.notify(f)}),B},unmount:()=>ee.unmount()}}var pt=e=>`s${(e+1).toString(36)}`;var Dr="/graview/live",Yt="graview.ship",Qt=`${Yt}.${tt}`;var ge={seat:"x-graview-seat",roles:"x-graview-roles",kind:"x-graview-kind",name:"x-graview-name",for:"x-graview-for",forRoles:"x-graview-for-roles",forName:"x-graview-for-name",via:"x-graview-via"};var Be=class extends Error{constructor(n){super(n),this.name="Superseded"}},Ae=e=>e?.lineage?{lineage:e.lineage}:{},Oo=(e,n)=>`${e.calls.map(a=>a.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
2
- `)[0]??"":String(n)})`;function Fo(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let a=JSON.parse(n);return Array.isArray(a)?a.filter(s=>!!s&&Array.isArray(s.calls)):[]}catch{return[]}}var We=class extends Error{constructor(a){super(a.sentence);this.refusal=a;this.name="RemoteRefusedError"}},Co={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},we=class extends Error{constructor(a,s){super(a);this.conflicts=s;this.name="StaleWrite"}},ze=class extends Error{constructor(n){super(n),this.name="Unreached"}},Lo=new Set([502,503,504]);async function Mo(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function Ho(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Vo=1,Do=()=>({refusals:new Set,conflicts:new Set,statuses:new Set,helds:new Set,builds:new Set,who:new Set,declarations:new Set,tally:{reconnects:0,rebases:0,conflicts:0,resyncs:0}});async function mt(e){return(await Br(e,Fo(e.carry),"This app was updated while your changes were on the way.",Do())).remote}async function Br(e,n,a,s){let d=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},S={...ht(e.principal),[ge.via]:e.via??"web"};Object.assign(l,S);let p=e.live===!0,w=e.presenceEveryMs,R=e.visible??$o,O="connecting",v=s.statuses,E=s.tally,L=[],P,j=[],se=()=>O==="online"&&P!==void 0?"held":O,D=()=>{let t=se();if(s.told!==t){s.told=t;for(let r of[...v])r(t)}},ee=t=>{if(!(t===O||ie)&&(O==="offline"&&t==="online"&&E.reconnects++,O=t,D(),t==="online"))for(let r of L.splice(0))r.again()},f=t=>{if(ie)return;let r=typeof t=="string"&&t.length>0?t:void 0,i=r!==P;if(P=r,B(),!!i&&(D(),r===void 0)){for(let o of j.splice(0))o();V&&clearTimeout(V),nn()}},B=()=>{if(s.toldHeld!==P){s.toldHeld=P;for(let t of[...s.helds])t(P??null)}},U=async(t,r)=>{let i;try{i=await d(t,r)}catch(o){throw z()||ee("offline"),new ze(o instanceof Error?o.message:String(o))}if(i.status===503&&await Mo(i))return ee("online"),i;if(Lo.has(i.status))throw z()||ee("offline"),new ze(`The server is away (${i.status})`);return ee("online"),i},Y=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${_e.op}`,i=t?await d(r,{headers:l}):await U(r,{headers:l});if(!i.ok)throw new Error((await i.json().catch(()=>({}))).error??`The server refused (${i.status})`);return await i.json()},F=e.state??await Y(!0);p||(O="online"),P=typeof F.held=="string"&&F.held.length>0?F.held:void 0,B();let le=F.enabledModules??e.enabledModules,W=e.localApp?e.localApp(e.app):e.app,x=new kn({schema:W.schema,mutations:W.mutations??[],invariants:W.invariants??[],...W.policy?{policy:W.policy}:{},...W.publishing?{publishing:W.publishing}:{},...W.modules?{modules:W.modules}:{},...le?{enabledModules:le}:{},...W.intelligence?{intelligence:W.intelligence}:{},...W.brand?.timeZone?{timeZone:W.brand.timeZone}:{},snapshot:F.snapshot,log:F.log,...F.horizon!==void 0?{horizon:F.horizon}:{},ids:Ho(),...e.storeOptions??{}});bn.served.add(x);let Re=Sn(x),k=F.log.at(-1)?.seq??(F.horizon??0)-1,oe=Tt.of(F.log,{horizon:F.horizon??0}),T=null,Q,$=new Map,ue=s.who,ve=!1,N=t=>{if(ie)return;ve=!0;let r=Rn(new Map,t,Date.now(),Ft,T?.participant);Q!==void 0&&r.delete(Q);let i=r.size!==$.size;if(!i)for(let[o,u]of r)Ct(u,$.get(o))||(i=!0);if($=r,!!i)for(let o of[...ue])o([...$.values()])},q=[],I=new Set,ae=t=>{let r=q.indexOf(t);r>=0&&q.splice(r,1)},M=new Map,Te=(t,r)=>{let i=M.get(t);i&&(M.delete(t),i.resolve({ops:r.filter(o=>o.batch===t),batch:t}))},K,te=[],C=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(K)return te.push({ops:t,drop:r}),[];let i=Math.min(...t.filter(g=>g.seq>k).map(g=>g.seq));if(Number.isFinite(i)&&i>k+1)return te.push({ops:t,drop:r}),fe(),[];let o=q.filter(g=>t.some(J=>J.batch===g)),u=[...new Set([...r,...o])].filter(g=>I.has(g)),m,b=q.filter(g=>!o.includes(g));try{m=x.rebase({confirmed:t,pending:b,drop:u}).confirmed}catch(g){if(!(g instanceof Pn))throw g;return te.push({ops:t,drop:r}),fe(),[]}for(let g of o)ae(g);t.some(g=>g.seq>k)&&b.some(g=>!u.includes(g))&&E.rebases++,t.length>0&&(k=Math.max(k,...t.map(g=>g.seq)),oe.note(t));for(let g of u)I.delete(g);for(let g of o)Te(g,t);return m},fe=()=>{K||(K=be(Y().then(t=>{if(pe(t)){te=[];return}let r=new Set(t.log.map(u=>u.batch)),i=q.filter(u=>r.has(u));for(let u of i)ae(u);let o=x.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...q],drop:[...I].filter(u=>!q.includes(u))});I.clear();for(let u of o.pending)I.add(u.batch);k=t.log.at(-1)?.seq??(t.horizon??0)-1,oe=Tt.of(t.log,{horizon:t.horizon??0}),E.resyncs++;for(let u of i)Te(u,t.log)}).then(()=>{K=void 0;let t=te;te=[];for(let{ops:r,drop:i}of t)C(r,i)},()=>{K=void 0,te=[]})))},pe=t=>(typeof t.build=="string"&&on(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===F.version?!1:(bt(t.version),!0)),de=async t=>{let i=await(await U(`${e.url}/graview/since?seq=${pt(t)}&opFormat=${_e.op}`,{headers:l})).json();return pe(i)?[]:i.reset===!0?(fe(),[]):i.ops??[]},Z=async()=>{let t=await Ge();return K&&await K,t},Ge=async()=>{if(T&&!z()&&R()){let r=await(await U(`${e.url}/graview/here`,{method:"POST",headers:l,body:JSON.stringify({presence:T,seq:pt(k)})})).json();return pe(r)?[]:(typeof r.participant=="string"&&(Q=r.participant),N(r.who??[]),C(r.ops??[]))}return C(await de(k))},xe=new Map,A=new Map,$e=new Set,ne=new Map,ce=new Set,be=t=>(ce.add(t),t.finally(()=>ce.delete(t)).catch(()=>{}),t),Ne=Promise.resolve(),He=0,yt=(t,r)=>{let i=Ne.then(()=>Ue(t,r));return Ne=i.catch(()=>{}),i},gt=()=>new Promise((t,r)=>L.push({again:t,give:r})),Ue=async(t,r)=>{let i,o;for(;;){try{i=await U(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:_e.op})})}catch(g){if(!(g instanceof ze)||X)throw g;if(await gt(),z())return Je(t,r);continue}if(o=await i.json().catch(()=>({})),i.status===503&&o.reason==="unavailable"&&typeof o.held=="string"&&!X){if(typeof o.version=="number"?pe(o):(f(o.held),!1))break;if(P!==void 0&&(Et>0||p)){if(await new Promise(g=>j.push(g)),X)throw new Be("The client closed.");if(z())return Je(t,r);continue}}let b;if(i.status===503&&o.reason==="unavailable"&&!X)b=Zt(e.backoff,He++);else{if(He=0,i.status!==429||X)break;b=Bo(i.headers.get("retry-after"),o.retryAfter)}if(await new Promise(g=>setTimeout(g,b)),z())return Je(t,r)}if(ie||pe(o))throw new Be("The app was changed.");if(!i.ok){let b=o.error??`The server refused (${i.status})`;throw o.conflict?new we(b,o.conflicts??[]):new We({reason:o.reason??Co[i.status]??"invalid",sentence:b,...o.wouldNeed?.length?{wouldNeed:o.wouldNeed}:{}})}let u=o.ops??[],m=u[0]?.seq;return m!==void 0&&m>k+1&&(u=await de(k)),r!==void 0&&(o.batch&&xe.set(r,o.batch),ae(r)),C(u,r!==void 0?[r]:[]),{ops:o.ops??[],...o.batch?{batch:o.batch}:{}}},_,re=!1,X=!1,Oe=0,Se,Ke=0,Pe=0,Fe=null,me=()=>{},Ve=new Promise(t=>{me=t}),z=()=>p&&re&&_?.readyState===Vo,Ce=t=>{if(!z())return!1;try{return _.send(JSON.stringify(t)),!0}catch{return!1}},y=(t=!1)=>{!T||!z()||!R()||!t&&Fe&&Ct(T,Fe)&&(w===void 0||Date.now()-Pe<w)||Ce({t:"here",presence:T})&&(Fe=T,Pe=Date.now())},H=new Set,V,nn=()=>{if(V=void 0,P!==void 0)return;let t=[...M.entries()].filter(([r])=>H.has(r));H.clear();for(let[,r]of t)Ce(r.message)},rn=(t,r)=>{M.has(t)&&(H.add(t),V&&clearTimeout(V),V=setTimeout(nn,Math.max(0,r)))},Nr=t=>{M.has(t)&&H.add(t)},Je=(t,r)=>new Promise((i,o)=>{let u=r??`send-${++Ke}`,m=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...Ae(t)}:{t:"call",cid:u,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...Ae(t)};if(M.set(u,{message:m,...r!==void 0?{mine:r}:{},resolve:i,reject:o}),H.size>0||P!==void 0){H.add(u);return}Ce(m)}),Ye=(t,r)=>z()?Je(t,r):yt(t,r),Ir=t=>{switch(t.t){case"welcome":{if(on(t.build),typeof t.version=="number"&&t.version!==F.version){bt(t.version);return}if(re=!0,Oe=0,typeof t.participant=="string"&&(Q=t.participant),f(t.held),t.state?fe():C(t.ops??[]),H.clear(),V&&clearTimeout(V),V=void 0,P!==void 0)for(let r of M.keys())H.add(r);else for(let r of M.values())Ce(r.message);y(!0),ee("online"),me();return}case"ops":C(t.ops??[]);return;case"ack":{let r=M.get(t.cid);if(!r){C(t.ops??[]);return}M.delete(t.cid),He=0,r.mine!==void 0&&(xe.set(r.mine,t.batch),ae(r.mine)),C(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=M.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){P!==void 0?Nr(t.cid):rn(t.cid,Zt(e.backoff,He++));return}M.delete(t.cid),r.reject(t.t==="conflict"?new we(t.sentence,t.conflicts??[]):new We({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&rn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":N(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==F.version&&bt(t.version);return;case"reload":cn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&_){let r=_;un(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},ie=!1,wt=s.declarations,vt=s.builds,on=t=>{if(!(ie||s.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){s.otherBuild=t;for(let r of[...vt])r(t)}},an=()=>{let t=[],r=0;for(let i of q){let o=ne.get(i);o?t.push({calls:o.calls,...o.intent?{intent:o.intent}:{},...o.via?{via:o.via}:{},...Ae(o),batch:i}):r++}return{carried:t,undos:r}},sn=(t,r)=>`${r} while ${t===1?"an undo of yours was":"undos of yours were"} on the way; ${t===1?"it was":"they were"} not made.`,dn=t=>{ie=!0,T=null;let r=new Be(t);for(let o of M.values())o.reject(r);M.clear(),Xe&&clearInterval(Xe),X=!0,Se&&clearTimeout(Se),V&&clearTimeout(V),he&&clearTimeout(he);for(let o of L.splice(0))o.give(r);for(let o of j.splice(0))o();let i=_;_=void 0,re=!1;try{i?.close(1e3,t)}catch{}me()};async function bt(t){if(ie)return;if(!e.resolveApp){cn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:i}=an(),o=e.resolveApp,u=T;dn("The app was changed.");try{let m=await o(t),{state:b,...g}=e,J=await Br({...g,app:m},r,"The app was changed while your changes were on the way.",s);u&&J.remote.presence.here(u);for(let et of[...wt])et(J.remote,t);let Jr=[...i>0?[Qe(sn(i,"The app was changed"))]:[],...J.unheard()];for(let et of Jr)for(let Yr of De)Yr(et.sentence,et)}catch(m){let b=`The app was changed, but the new version could not be opened: ${m instanceof Error?m.message:String(m)}`;for(let g of De)g(b,Qe(b))}}function cn(t){if(ie)return;let{carried:r,undos:i}=an();dn(t);let o=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),o=!0}catch{}let u=[];!o&&r.length>0&&u.push(`${t} ${r.length===1?"A change of yours was":`${r.length} changes of yours were`} not sent; make ${r.length===1?"it":"them"} again after the page reloads.`),i>0&&u.push(sn(i,"This app was updated"));for(let m of u)for(let b of De)b(m,Qe(m));(e.reloadPage??Wo)()}let ln=()=>{if(X||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${Dr}`,{"content-type":r,...i}=l,o;try{o=e.socket?e.socket(t,i,[Qt]):Kr(t,i)}catch{return fn()}_=o,re=!1,o.onopen=()=>{_===o&&o.send(JSON.stringify({t:"hello",seq:pt(k),protocol:tt,wire:Yt,opFormat:_e.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},o.onmessage=u=>{if(_!==o)return;let m;try{m=JSON.parse(String(u.data))}catch{return}Ir(m)},o.onclose=()=>un(o),o.onerror=()=>{}},he,_r=()=>{ve=!1,he&&clearTimeout(he),he=setTimeout(()=>{if(he=void 0,ve||X)return;let t=new Map([...$].filter(([,r])=>r.held!=="socket"));if(t.size!==$.size){$=t;for(let r of ue)r([...$.values()])}},Ft),he.unref?.()};function un(t){if(_!==t)return;let r=re;_=void 0,re=!1,Fe=null,r&&(ee("offline"),_r()),fn()}let fn=()=>{if(X)return;let t=Zt(e.backoff,Oe);Oe++,Se=setTimeout(ln,t)},pn=x.applyAll.bind(x),jr=x.undo.bind(x),qr=x.previewAll.bind(x);x.previewAll=(t,r)=>qr(t,{...e.principal?{author:e.principal}:{},...r});let De=s.refusals,Ie=[],Qe=t=>({reason:"invalid",sentence:t}),Ze=s.conflicts,St=!1,mn,Pt=async(t,r)=>{if(r instanceof Be||ie)return;let i=r instanceof We?r.refusal:wn(r),o=i.sentence,u=r instanceof we?mn?.yoursOf(x,ne.get(t)?.calls??[]):void 0;ae(t);try{C([],[t])}catch{}let m=ne.get(t);if(ne.delete(t),r instanceof we&&E.conflicts++,r instanceof we&&!z()&&await Z().catch(()=>[]),r instanceof we&&K&&await K,r instanceof we&&Ze.size>0){let b=!1,g={sentence:o,conflicts:u?r.conflicts.map(J=>J.node===u.node&&J.field===u.field?{...J,yours:u.yours}:J):r.conflicts,keepTheirs(){b=!0},useMine(){if(!(b||!m)){b=!0,St=!0;try{x.applyAll(u?[u.over(k)]:m.calls,{...m.intent?{intent:m.intent}:{},...m.via?{via:m.via}:{},...Ae(m)})}finally{St=!1}}}};for(let J of Ze)J(g);return}for(let b of De)b(o,i)},zr=(t,r)=>t.flatMap(i=>i.mutation?.name===gn?[]:i.primitives.flatMap(o=>o.op==="splice-text"&&!r.has(o.id)&&!r.has(`${o.id}\0${o.field}`)?[{node:o.id,field:o.field,rev:k}]:[]));x.applyAll=(t,r)=>{let i=vn(x.log.all().filter(b=>I.has(b.batch))),o=pn(t,{...e.principal?{author:e.principal}:{},...r}),u=t.map((b,g)=>{let J=o.minted?.[g];return J===void 0||b.args?.id!==void 0?b:{...b,mintedHint:J}});q.push(o.batch),I.add(o.batch),ne.set(o.batch,{calls:u,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...Ae(r)});let m=St?[]:[...oe.baseFor(o.ops,i,(b,g)=>x.collaborative(b,g)),...zr(o.ops,i)];return A.set(o.batch,be(Ye({calls:u,...r?.intent?{intent:r.intent}:{},batch:o.batch,...m.length>0?{base:m}:{},...r?.via?{via:r.via}:{},...Ae(r)},o.batch).catch(b=>Pt(o.batch,b)))),o},x.apply=(t,r)=>x.applyAll([t],r),x.undo=(t,r)=>{let i=typeof t=="string"?[t]:t,o=jr(i.map(m=>xe.get(m)??m),{...e.principal?{author:e.principal}:{},...r});q.push(o.batch),I.add(o.batch);let u=Promise.allSettled(i.map(m=>A.get(m)));return A.set(o.batch,be(u.then(()=>{let m=i.filter(b=>!$e.has(b));if(m.length===0){ae(o.batch),ne.delete(o.batch),C([],[o.batch]);return}return Ye({undo:m.map(b=>xe.get(b)??b),...r?.intent?{intent:r.intent}:{},batch:o.batch,...r?.via?{via:r.via}:{},...Ae(r)},o.batch)}).catch(m=>Pt(o.batch,m)))),o};let Gr=async(t,r={})=>{kt++;try{return(await be(Ye({calls:t,...r}))).ops}finally{kt--}},kt=0,hn={here(t){T=t,y()},onWho(t){return ue.add(t),$.size>0&&t([...$.values()]),()=>{ue.delete(t)}},leave(){if(!T)return;let t=JSON.stringify({participant:Q??T.participant});if(T=null,Ce({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):d(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},Et=e.pollMs??800,Xe=Et>0&&typeof setInterval=="function"?setInterval(()=>{z()||Z().catch(()=>{})},Et):null;if(p){ln();let t;await Promise.race([Ve,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!ie){let t=[],r=new Set(x.log.all().map(i=>i.batch));for(let i of n)if(!(i.batch!==void 0&&r.has(i.batch)))try{x.applyAll(i.calls,{...i.intent?{intent:i.intent}:{},...i.batch?{batch:i.batch}:{},...i.via?{via:i.via}:{},...Ae(i)})}catch(o){t.push(Oo(i,o))}t.length>0&&Ie.push(Qe(`${a} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let yn=new Map,Ur=()=>({store:x,author:e.principal,appliedAll:pn,pending:q,provisional:I,asked:ne,answers:A,letGo:$e,sent:(t,r)=>be(Ye({calls:r,batch:t},t).catch(i=>Pt(t,i))),settle:ae,land:C,seen:()=>k,gone:()=>X||ie});return{remote:{store:x,typing(t,r){let i=`${t}\0${r}`,o=yn.get(i);return o||(o=(__graviewPreload(import.meta.url,["./chunk.XWXYC3BJ.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.DQNN5FE5.js")).then(u=>(mn=u,u.typingOf(t,r,u.wireOf(Ur())))),yn.set(i,o)),o},version:F.version,migrated:F.migrated??[],send:Gr,pull:Z,onRefusal(t){De.add(t);let r=Ie;Ie=[];for(let i of r)t(i.sentence,i);return()=>De.delete(t)},onDeclaration(t){return wt.add(t),()=>wt.delete(t)},onBuild(t){return vt.add(t),s.otherBuild!==void 0&&t(s.otherBuild),()=>vt.delete(t)},onConflict(t){return Ze.add(t),()=>Ze.delete(t)},revision:(t,r)=>oe.of(t,r),seq:()=>k,participant:()=>Q,transport:()=>z()?"socket":"poll",status:se,onStatus(t){return v.add(t),()=>v.delete(t)},held:()=>P,onHeld(t){return s.helds.add(t),P!==void 0&&t(P),()=>s.helds.delete(t)},counters:()=>({...E}),who:()=>[...$.values()],pending:()=>q.length+kt,async settled(){for(;ce.size>0;)await Promise.allSettled([...ce])},presence:hn,close(){Xe&&clearInterval(Xe),Re(),hn.leave(),X=!0,Se&&clearTimeout(Se),V&&clearTimeout(V),he&&clearTimeout(he);for(let r of L.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of j.splice(0))r();let t=_;_=void 0,re=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Ie;return Ie=[],t}};function Kr(t,r){let i=globalThis.WebSocket;if(!i)throw new Error("This runtime has no WebSocket; the client polls instead.");let o=typeof globalThis.document<"u",u=e.subprotocol?[Qt]:[];if(!o)try{return new i(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let m=new URL(t);for(let[b,g]of Object.entries(S))m.searchParams.set(b,g);return u.length>0?new i(m.toString(),u):new i(m.toString())}}function Bo(e,n,a=Date.now()){let s,d=e?.trim();if(d)if(/^\d+(\.\d+)?$/.test(d))s=Number(d)*1e3;else{let p=Date.parse(d);Number.isFinite(p)&&(s=Math.max(0,p-a))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,S=l!==void 0&&l<50&&s!==void 0&&Math.abs(l*1e3-s)<1e3;return l!==void 0&&!S?l:s??1e3}function Wo(){globalThis.location?.reload?.()}function $o(){return globalThis.document?.visibilityState!=="hidden"}function Zt(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:a=250,max:s=1e4,factor:d=2}=e??{};return Math.min(s,a*d**n)*(.75+Math.random()*.5)}function ht(e){let n={};if(!e)return n;e.id&&(n[ge.seat]=e.id),e.roles?.length&&(n[ge.roles]=e.roles.join(",")),e.kind!=="human"&&(n[ge.kind]=e.kind),e.name&&(n[ge.name]=encodeURIComponent(e.name));let a=e.onBehalfOf;return a?.id&&(n[ge.for]=a.id),a?.roles?.length&&(n[ge.forRoles]=a.roles.join(",")),a?.name&&(n[ge.forName]=encodeURIComponent(a.name)),n}var Wr="/graview/views";function Xt(e){let n=e.fetch??fetch,a=e.url.replace(/\/$/,""),s={"content-type":"application/json",...e.principal?ht(e.principal):{},...e.headers??{}},d=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??nt.may}:nt,l=new Set,S=v=>{if(JSON.stringify(v)!==JSON.stringify(d)){d=v;for(let E of l)E()}},p=async(v,E)=>{let L=await n(`${a}${e.path??Wr}`,{method:v,headers:s,...E!==void 0?{body:JSON.stringify(E)}:{}}),P=await L.json();if(!L.ok)throw new Error(P.error??`The store answered ${L.status}.`);S({hidden:P.hidden??[],removed:P.removed??[],may:P.may??nt.may})},w=()=>p("GET"),R=e.state?Promise.resolve():w().catch(()=>{}),O=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:R,refresh:w,close:()=>clearInterval(O),current:()=>d,onChange(v){return l.add(v),()=>void l.delete(v)},hide:v=>p("POST",{hide:v}),show:v=>p("POST",{show:v}),remove:(v,E)=>p("POST",{remove:v,...E?{about:E}:{}}),async restore(v){let E=d.removed.find(L=>L.name===v)?.lens;await p("POST",{restore:v}),E&&await e.onDeclaration?.()},async lens(v){await p("POST",{lens:v}),await e.onDeclaration?.()}}}var tn=document.getElementById("graview-app"),en=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),$r=en?(__graviewPreload(import.meta.url,["./chunk.B7LBG4UP.js","./chunk.7G4M2PX3.js","./chunk.UGFDSE37.js","./chunk.NNUUD26E.js","./chunk.OJ64WTLW.js","./chunk.GMAXA5GV.js","./chunk.IBJBCZKG.js","./chunk.NQ26KMSQ.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.OPCBZNKF.js","./chunk.UK5F3S2N.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.CTOBNZLM.js","./chunk.34HGT7HQ.js","./chunk.TNL2BVCH.js","./chunk.NZDHXREL.js","./chunk.TBSPEO2L.js","./chunk.5ON3JSAK.js","./chunk.3SBTQ66X.js","./chunk.SSAY4ITS.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.MB7LKKUD.js","./chunk.WQLAIEWJ.js","./chunk.KK46XLGU.js","./chunk.WVUJXDXZ.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.APFRPN5S.js")):Me("pages");try{en?await No(decodeURIComponent(en[1])):await Io()}catch(e){let n=document.createElement("pre");n.setAttribute("role","alert"),n.style.cssText="margin:2rem;font:14px/1.5 ui-monospace,monospace;white-space:pre-wrap",n.textContent=e instanceof Error?e.message:String(e),tn.replaceChildren(n),window.__graviewFailed=n.textContent}async function No(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),a=await n.json();if(!n.ok)throw new Error(a.error??`The preview server did not hand over the form (${n.status}).`);let s=await dt(a);if(!s.ok)throw new Error(rt(s.findings));let d=s.app,l=a.principal,S=await mt({app:d,url:location.origin,principal:l,...a.state?{state:a.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=d.forms?.[e]?.title??d.name;let{mount:p}=await $r;window.__graview=p(tn,{app:d,form:e,principal:l,remote:S,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Io(){let e=await fetch("/graview/document");if(!e.ok)throw new Error(`The preview server did not hand over the document (${e.status}).`);let n=await e.json(),s=await(async w=>{if(typeof w.module=="string")return(await import(w.module)).app;let R=await dt(w);if(!R.ok)throw new Error(rt(R.findings));return R.app})(n);if(!s||typeof s!="object"||!("schema"in s))throw new Error("The app module the preview server handed does not export an app.");let d=n.principal,l=await mt({app:s,url:location.origin,principal:d,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=s.name;let S,p=Xt({url:location.origin,principal:d,...n.views?{state:n.views}:{},onDeclaration:async()=>{let w=await(await fetch("/graview/document")).json();if(typeof w.module=="string")return;let R=await dt(w);R.ok&&S?.setApp(R.app,l)}});await Promise.all([$r,p.ready]),S=Jt(tn,{app:s,remote:l,principal:d,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:s.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=S,S.drawn().then(()=>{window.__graviewReady=!0})}
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Zr}from"./chunk.M33LUF3Q.js";import{a as Dt,b as Xn,c as er,d as tr,e as nr,f as Bt,g as rr,h as Wt}from"./chunk.7UXDIEPK.js";import{a as $t,b as ar,c as ir,d as sr,e as Nt,f as dr,g as cr,h as lr,i as ur,j as fr,k as pr,l as mr,m as hr,n as je}from"./chunk.KSJ3J5UN.js";import{b as or}from"./chunk.HSGUXMAO.js";import{a as At}from"./chunk.Q5WEOX3Q.js";import{a as Rt,g as Tn}from"./chunk.U6PCKJ26.js";import{k as rt}from"./chunk.5WU2UTP7.js";import{C as Jn,H as Yn,L as Qn,M as Zn,j as Qr,k as zn,n as it,o as Gn,q as Un,u as Kn,z as st}from"./chunk.AI2HBKVP.js";import{Ba as Nn,Ca as In,Ea as _n,Fa as Vt,G as Ht,Ja as jn,Ka as qn,Na as at,T as Fn,Y as Cn,a as xn,b as Lt,c as ot,fa as Ln,ga as Mn,j as On,m as Mt,ua as Hn,va as Vn,wa as Dn,xa as Bn,ya as Wn,za as $n}from"./chunk.Q5IAXTF5.js";import{a as Ee}from"./chunk.SDO3U72B.js";import{Bb as wn,Fd as ke,Gd as En,Hd as An,Md as xt,Nd as Ot,Od as Ft,Qc as bn,Rd as Rn,Sd as Ct,cb as _e,dd as Sn,ec as Tt,fc as vn,fd as Pn,gd as kn,id as nt,nb as tt,ob as gn}from"./chunk.VOHRQXCF.js";import"./chunk.SLBWPVIY.js";import{b as Le}from"./chunk.AJZBJBMO.js";async function dt(e,n={}){let a=e.compiled===void 0||!eo(e.compiled,e.document)?void 0:Tn(e.compiled,n);if(a?.ok)return a;let{compileDocumentWithoutCheck:s}=await Xr();return s(e.document,n)}var yr,Xr=()=>yr??=(__graviewPreload(import.meta.url,["./chunk.CHMUL36A.js","./chunk.U6PCKJ26.js","./chunk.I43ONAEL.js","./chunk.INL4OZI7.js","./chunk.5WU2UTP7.js","./chunk.VOHRQXCF.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.PXVJBL2C.js")).catch(e=>{throw yr=void 0,e});function eo(e,n){let a=typeof e=="object"&&e!==null?e.document:void 0,s=n;if(typeof s=="string")try{s=JSON.parse(s)}catch{return!1}return a!==void 0&&At(Rt(a).document)===At(Rt(s).document)}var c=Le(Ht(),1);var lt=Le(Ht(),1),It="data-graview-drawn",to=200,gr=50,no=1e4,ct=()=>typeof performance<"u"?performance.now():Date.now();function ro(e){let n=[...e.querySelectorAll("img")];for(let a of e.querySelectorAll("[data-worker-view]"))a.shadowRoot&&n.push(...a.shadowRoot.querySelectorAll("img"));return n}function oo(e,n){if(e.ownerDocument.fonts?.status==="loading"||Vn()>0||$n(n)>0||e.querySelector('[aria-busy="true"]')||ro(e).some(s=>!s.complete&&s.loading!=="lazy"))return!1;for(let s of e.querySelectorAll("[data-worker-view-place]"))if(!s.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function wr(e){let n=e.querySelector("[data-embed-content]"),a=[...e.querySelectorAll("[data-worker-view]")].map(s=>`${s.offsetWidth}x${s.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${a.join(",")}`}function ao(e,n,a,s){e.removeAttribute(It);let d=e.ownerDocument.defaultView;if(!d)return()=>{};let l=ct(),S=l,p=wr(e),w=!1,R,O=typeof MutationObserver>"u"?void 0:new MutationObserver(P=>{P.some(j=>!(j.target===e&&j.attributeName===It))&&(S=ct())});O?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let v=()=>{w=!0,O?.disconnect(),R!==void 0&&clearTimeout(R)},E=P=>{let j=!1,se=()=>{j||(j=!0,P())};typeof d.requestAnimationFrame=="function"&&d.requestAnimationFrame(()=>setTimeout(se,0)),setTimeout(se,100)},L=()=>{if(w)return;let P=wr(e);P!==p&&(p=P,S=ct());let j=ct();if(oo(e,s)&&j-S>=to||j-l>=no){E(()=>{w||(v(),e.setAttribute(It,n),In(),a())});return}R=setTimeout(L,gr)};return R=setTimeout(L,gr),v}function vr(e,n,a,s,d){Nn();let l=(0,lt.useRef)({place:a,onDrawn:s});l.current={place:a,onDrawn:s},(0,lt.useLayoutEffect)(()=>{d&&Wn(d);let S=R=>ao(R,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),d);if(e.current)return S(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=S(e.current))}),()=>{w=!0,p?.()}},[n,e,d])}var ye=Le(Ht(),1),qe,io=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.KVEDMKUN.js","./chunk.J263VQF5.js","./chunk.RWCWRJJC.js","./chunk.NVNQSZ43.js","./chunk.FJEXINFF.js","./chunk.Q5IAXTF5.js","./chunk.SDO3U72B.js","./chunk.VOHRQXCF.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.PXHBPLTQ.js"))),br=()=>io().then(e=>void(qe=e),()=>new Promise(e=>setTimeout(e,2e3)).then(br)),_t=Hn(br),Sr=e=>!!e&&qe===void 0;function jt({onReady:e,fetch:n}){return(0,ye.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var so=0;function Pr(e){let[n,a]=(0,ye.useState)(()=>qe);(0,ye.useEffect)(()=>{if(!e||n)return;let l=!1;return _t().then(()=>{l||a(qe)}),()=>{l=!0}},[e,n]);let s=(0,ye.useMemo)(()=>so+=1,[e]);return{over:(0,ye.useMemo)(()=>{let l=n??qe;if(!e||!l)return;let{source:S,worker:p,...w}=e,R={...w,worker:p??{source:S},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:O=>l.registerWorkerView(O,R)}},[e,n]),n:s}}var Ar=Le(Zr(),1),G=Le(Qr(),1);var h=Le(Fn(),1);function ut(e,n={}){let a=Vt(e);return{Face:a.part((d,l)=>(0,c.createElement)(d,l),n),fetch:()=>a.load().then(()=>{}),here:()=>a.current!==void 0||a.failed}}var Gt=e=>Promise.all([e,Qn()]).then(([n])=>n),Rr=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.W5UJLKIT.js","./chunk.R77TACXU.js","./chunk.JOWJNIWH.js","./chunk.52J42KR5.js","./chunk.T2Q3AAQI.js","./chunk.G7XKQNOL.js","./chunk.7KZ44FEU.js","./chunk.HJCQ6I3S.js","./chunk.JQBP6QWQ.js","./chunk.I2W7HSBU.js","./chunk.UEPVA6IS.js","./chunk.WWUMSCYC.js","./chunk.Y37DXEHG.js","./chunk.DXZ5VYCQ.js","./chunk.J2R55TM7.js","./chunk.DIS7JS7X.js","./chunk.JV7FLVUV.js","./chunk.VGTEEANA.js","./chunk.SZCZD2GM.js","./chunk.7FZY5E2U.js","./chunk.7354O67H.js","./chunk.KSJ3J5UN.js","./chunk.HSGUXMAO.js","./chunk.TI4OSTQV.js","./chunk.FEBCIEI3.js","./chunk.GZHZLJBF.js","./chunk.YKACMLLU.js","./chunk.OJGHDWI6.js","./chunk.337JMOTL.js","./chunk.CV4QA4ZF.js","./chunk.OYRZ2DEI.js","./chunk.7EA7THSM.js","./chunk.AI2HBKVP.js","./chunk.Q5IAXTF5.js","./chunk.SDO3U72B.js","./chunk.VOHRQXCF.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.KFTZLNHY.js"))),co=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.3ZQAPPJ5.js","./chunk.D62V3TBW.js","./chunk.FJC6PMOG.js","./chunk.XPR3QFF4.js","./chunk.YUEOUV7G.js","./chunk.UGFDSE37.js","./chunk.W5UJLKIT.js","./chunk.PXQVXBNG.js","./chunk.7UJZP3YK.js","./chunk.R77TACXU.js","./chunk.6JERQFZI.js","./chunk.7XJ3XQZD.js","./chunk.52J42KR5.js","./chunk.T2Q3AAQI.js","./chunk.63SRVTG2.js","./chunk.C4EPMV7O.js","./chunk.G7XKQNOL.js","./chunk.7KZ44FEU.js","./chunk.LSL25VXW.js","./chunk.WWUMSCYC.js","./chunk.J2R55TM7.js","./chunk.KPUX27ZT.js","./chunk.DIS7JS7X.js","./chunk.D2T563AA.js","./chunk.JV7FLVUV.js","./chunk.GL3YVGAP.js","./chunk.7FZY5E2U.js","./chunk.7354O67H.js","./chunk.XOZU4OFA.js","./chunk.C7EEYSAM.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.QRCTTDDQ.js","./chunk.3TME4BG3.js","./chunk.I43ONAEL.js","./chunk.73EKJ4JN.js","./chunk.INL4OZI7.js","./chunk.5WU2UTP7.js","./chunk.GZHZLJBF.js","./chunk.YKACMLLU.js","./chunk.OJGHDWI6.js","./chunk.337JMOTL.js","./chunk.CV4QA4ZF.js","./chunk.OYRZ2DEI.js","./chunk.7EA7THSM.js","./chunk.AI2HBKVP.js","./chunk.Q5IAXTF5.js","./chunk.SDO3U72B.js","./chunk.VOHRQXCF.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZEKKIMKI.js"))),lo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.3ZQAPPJ5.js","./chunk.D62V3TBW.js","./chunk.FJC6PMOG.js","./chunk.XPR3QFF4.js","./chunk.YUEOUV7G.js","./chunk.UGFDSE37.js","./chunk.W5UJLKIT.js","./chunk.PXQVXBNG.js","./chunk.7UJZP3YK.js","./chunk.R77TACXU.js","./chunk.6JERQFZI.js","./chunk.7XJ3XQZD.js","./chunk.52J42KR5.js","./chunk.T2Q3AAQI.js","./chunk.63SRVTG2.js","./chunk.C4EPMV7O.js","./chunk.G7XKQNOL.js","./chunk.7KZ44FEU.js","./chunk.LSL25VXW.js","./chunk.WWUMSCYC.js","./chunk.J2R55TM7.js","./chunk.KPUX27ZT.js","./chunk.DIS7JS7X.js","./chunk.D2T563AA.js","./chunk.JV7FLVUV.js","./chunk.GL3YVGAP.js","./chunk.7FZY5E2U.js","./chunk.7354O67H.js","./chunk.XOZU4OFA.js","./chunk.C7EEYSAM.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.QRCTTDDQ.js","./chunk.3TME4BG3.js","./chunk.I43ONAEL.js","./chunk.73EKJ4JN.js","./chunk.INL4OZI7.js","./chunk.5WU2UTP7.js","./chunk.GZHZLJBF.js","./chunk.YKACMLLU.js","./chunk.OJGHDWI6.js","./chunk.337JMOTL.js","./chunk.CV4QA4ZF.js","./chunk.OYRZ2DEI.js","./chunk.7EA7THSM.js","./chunk.AI2HBKVP.js","./chunk.Q5IAXTF5.js","./chunk.SDO3U72B.js","./chunk.VOHRQXCF.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.UMS7XRPO.js"))),Tr=ut(()=>Gt(Rr().then(e=>e.SceneFace)),{what:"This view"}),xr=ut(()=>Rr().then(e=>e.SceneKeeping),{quiet:!0}),Or=ut(()=>Gt(co().then(e=>e.PagesContent)),{what:"This page"}),Fr=ut(()=>Gt(lo().then(e=>e.PictureFace)),{what:"This picture"}),uo=Tr.Face,fo=xr.Face,po=Or.Face,mo=Fr.Face;function Me(...e){let n=e.length>0?e:["scene","pages","picture"],a=new Set(n.flatMap(Cr));return Promise.all([...[...a].map(s=>s.fetch()),Un()]).then(()=>{},()=>{})}var Cr=e=>e==="pages"?[Or]:e==="picture"?[Fr]:[Tr,xr],Lr=e=>Cr(e).every(n=>n.here()),ho=150,qt=0;function kr(e,n){if(Lr(e))return n();let a=++qt,s=()=>{a===qt&&(qt+=1,n())};Me(e).then(s),setTimeout(s,ho)}var yo=768;function go(e,n){let a=n!==null&&n>=yo;(0,c.useEffect)(()=>{if(!a||e==="picture")return;let s=e==="pages"?"scene":"pages";if(Lr(s))return;let d=globalThis,l=()=>void Me(s),S=()=>{},p=_n(()=>{if(d.requestIdleCallback&&d.cancelIdleCallback){let w=d.requestIdleCallback(l,{timeout:4e3});S=()=>d.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);S=()=>clearTimeout(w)}});return()=>(p(),S())},[e,a])}function wo({asked:e,shown:n,onDrawn:a}){return(0,c.useLayoutEffect)(()=>a(e,n),[e,n,a]),null}function vo({auto:e,scene:n}){return(0,h.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${Nt}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var bo=Vt(Ee(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,h.jsx)(e.StudioPlace,{...n}),{quiet:!0});function Mr(e,n,a,s,d){return Bt(e,nr(n?ot(n):d??xn,s),a)}function Ut(e){return e&&ot(e).overview?"graview":"scene"}function Er(e,n){if(n.homeView?.()===void 0)return!1;let a=e.pages?.first?.trim();return a===void 0||a===""||a==="/"||a.toLowerCase()==="home"}function Hr(e){let[,n]=(0,c.useState)(!1),a=(0,c.useCallback)(()=>n(!0),[]),s=(0,c.useRef)(!1);return e.at&&!ft?(0,h.jsx)(jt,{onReady:a,fetch:Kt}):!s.current&&Sr(e.draftView)?(0,h.jsx)(jt,{onReady:a,fetch:_t}):(s.current=!0,(0,h.jsx)(So,{...e}))}function So(e){let{app:n,stop:a,bar:s=!0,standing:d="Everything is in order",principal:l,heading:S=2}=e,{rootRef:p,scope:w,css:R,scheme:O,store:v,presence:E,brand:L,auto:P,height:j}=dr(e),se=Pr(e.draftView),D=ir(e,Zn,se.over),[ee]=(0,c.useState)(Bn),f=e.basePath===void 0?{}:{basePath:e.basePath},[B]=(0,c.useState)(it),U=e.notices??B,Y=y=>xt(y,f),F={...e.routing?{routing:e.routing}:{},...f},[le]=(0,c.useState)(()=>{let y=e.at?.face;if(y)return y;let H=a===void 0&&Er(n,D)?"pages":Ut(a),V=Dt({...F,face:H});return e.face===void 0&&e.onOpening?.(V),V}),[W,x]=(0,c.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&a===void 0&&Xn(F)&&Er(n,D)),Re=(0,c.useRef)(e.onFace);Re.current=e.onFace,(0,c.useLayoutEffect)(()=>{W&&(Re.current?.("pages"),x(!1))},[W]);let k=W?"pages":e.face??le,oe=n.schema.kinds,T=e.routing==="address",Q=(0,c.useMemo)(()=>e.at?ft.settleAt(e,v.seenBy(l??{kind:"human"}),D.places()):void 0,[]),$=(0,c.useMemo)(()=>Mn(D,n.schema),[D,n.schema]),ue=(0,c.useMemo)(()=>{let y=Q?.stop??(T?er(e.basePath):void 0)??a;return k==="scene"&&y===void 0&&$===void 0&&(e.path===void 0||zt(e.path))?Wt(void 0):Mr(k,y,oe,D.places(),$)},[]),[ve]=(0,c.useState)(k);(0,c.useEffect)(()=>{ve!=="pages"&&Ln(D)},[ve,D]);let N=(0,c.useRef)(void 0),q=y=>y===void 0||zt(y)?"/":y;N.current??={path:q(Q?.path??(T?k==="pages"?(Ot(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==N.current.asked&&(N.current={path:q(e.path),asked:e.path});let I=(0,c.useRef)(e.onNavigate);I.current=e.onNavigate;let ae=(0,c.useCallback)((y,H)=>{N.current.path=y,I.current?.(y,H)},[]),{at:M,setAt:Te,steering:K,steer:te}=pr(N.current.path),C=(0,c.useContext)(Vr);C&&(C.pages=()=>N.current.path);let fe=(0,c.useRef)(void 0),pe=(0,c.useCallback)(y=>void(N.current.path=y),[]),de=zn(p),[Z,Ge]=(0,c.useState)(!1),xe=e.pagesBelow!==void 0&&de!==null&&de<e.pagesBelow&&(k==="scene"||k==="graview")&&!Z,A=xe?"pages":k,$e=(0,c.useRef)(!1);$e.current=Z&&e.pagesBelow!==void 0&&de!==null&&de<e.pagesBelow&&(k==="scene"||k==="graview"),C&&(C.shown=A);let ne=(0,c.useRef)(k==="graview"?"graview":"scene");(A==="scene"||A==="graview")&&(ne.current=A),(0,c.useState)(()=>{if(!T||typeof window>"u"||A==="pages"||A==="picture")return;let{pathname:y,search:H,hash:V}=window.location;Ot(y,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${Y(ke)}${H}${V}`)}),sr(p,A,e.onIntrinsicHeight),go(A,de);let ce=mr(e.onError,A),be=hr(e.onReady,A),Ne=(0,c.useRef)(e.onFaceDrawn);Ne.current=e.onFaceDrawn;let He=(0,c.useCallback)((y,H)=>{be(H),Ne.current?.(y)},[be]),[yt,gt]=(0,c.useState)(null),Ue=D.places(),_=(0,c.useRef)({shown:A,onFace:e.onFace});_.current={shown:A,onFace:e.onFace};let re=(0,c.useCallback)((y,H,V)=>{if(T){fe.current?.(y,H,V);return}_.current.onFace?.(y),I.current?.(y==="pages"?H??N.current.path:ke,"push")},[T]),[X,Oe]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{A==="pages"&&Oe(void 0)},[A]);let Se=(0,c.useRef)(a);(0,c.useEffect)(()=>{Se.current!==a&&(Se.current=a,Oe(void 0))},[a]);let Ke=(0,c.useCallback)(y=>{if(_.current.shown==="pages"){if(Ge(!0),Oe(y),k==="scene"||k==="graview"){kr(k,()=>{T?window.history.pushState(null,"",`${Y(ke)}${y??""}`):I.current?.(ke,"push")});return}kr(ne.current,()=>re(ne.current,void 0,y))}},[T,k,e.basePath,re]),Pe=(0,c.useCallback)(y=>{if(_.current.shown==="pages"){K.go.current||(N.current.path=y),te(y);return}if(N.current.path=y,Te(y),$e.current){Ge(!1),T?window.history.pushState(null,"",Y(y)):I.current?.(y,"push");return}re("pages",y)},[K,te,Te,re,T,e.basePath]),Fe=D.arrangement?.(),me=A==="pages",Ve=e.hrefOf,z=Ve??(T?Y:void 0),Ce=(0,c.useMemo)(()=>({open:Pe,...Ve?{href:Ve}:T?{href:y=>xt(y,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[Pe,T,e.basePath,Ve]);return(0,h.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":A,"data-graview-scheme":O,...xe?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:j,minHeight:P?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,h.jsx)("style",{children:R}),(0,h.jsxs)(qn.Provider,{value:ce,children:[(0,h.jsx)(cr,{rootRef:p,board:U}),(0,h.jsx)(ar,{rootRef:p,firstLook:e.firstLook,app:Jn(L??{name:n.name},n.schema)}),(0,h.jsx)(je,{module:"@graview/react",report:ce,content:!0,children:(0,h.jsx)(Dn.Provider,{value:ee,children:(0,h.jsx)(Cn,{store:v,views:D,initialView:ue,scheme:O,...lr(e,E,L),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,h.jsxs)(Gn.Provider,{value:U,children:[(0,h.jsx)(Ao,{face:A,stop:X??a,kinds:oe,places:Ue,opens:$}),C?(0,h.jsx)(Po,{into:C}):null,(0,h.jsx)(ko,{rootRef:p,face:k,shown:A,path:M,stop:a,draft:se.n,onDrawn:e.onDrawn,parts:ee}),T?(0,h.jsx)(tr,{pagesWere:Q?.path,basePath:e.basePath,shown:A,onFace:e.onFace,toggle:fe,kinds:oe,places:Ue,opens:$,landed:pe}):null,s&&A!=="picture"?(0,h.jsx)(je,{module:"@graview/embed",report:ce,children:(0,h.jsx)(ur,{name:L?.name??n.name,heading:S,named:$t(s).name!==!1,faces:$t(s).faces===!1?void 0:{scene:{label:En(Fe),current:!me,go:()=>Ke(),reach:()=>void Me(ne.current)},pages:{label:An(Fe),current:me,go:()=>Pe(N.current.path),reach:()=>void Me("pages")}},at:me?M:null,without:e.pages?.without(),home:{...z?.("/")!==void 0?{href:z("/")}:{},go:()=>Pe("/"),current:me&&M.split("?")[0]==="/"},reach:{...z?{href:z}:{},go:y=>Pe(y.path)},standing:d,hostActions:e.hostActions,keeping:me?void 0:(0,h.jsx)(Ro,{app:n,studio:e.studio,report:ce}),onFind:gt,switch:e.switch})}):null,(0,h.jsx)(Kn.Provider,{value:yt,children:(0,h.jsx)(je,{module:A==="pages"||A==="picture"?"@graview/pages":"@graview/react",report:ce,content:!0,children:(0,h.jsxs)(c.Suspense,{fallback:(0,h.jsx)(vo,{auto:P,scene:A!=="pages"&&A!=="picture"}),children:[A==="picture"?(0,h.jsx)(mo,{scope:w,store:v,views:D,as:(a?ot(a).within?.view:void 0)??""}):A==="pages"?(0,h.jsx)(po,{store:v,views:D,presence:E,auto:P,brand:L,steering:K,overview:Ke,scope:w,titleLevel:fr(S),quickAsk:st(e.quickAsk),props:{...e,onNavigate:ae,...T?{}:{path:N.current.path}}}):(0,h.jsx)(jn.Provider,{value:Ce,children:(0,h.jsx)(uo,{address:T,auto:P,scheme:O,scope:w,quickAsk:st(e.quickAsk)})}),(0,h.jsx)(wo,{asked:k,shown:A,onDrawn:He})]})},A)})]})})})})]})]})}var zt=e=>e.split(/[?#]/)[0]===ke,Vr=(0,c.createContext)(null);function Po({into:e}){return e.view=at().view,null}function ko({rootRef:e,face:n,shown:a,path:s,stop:d,draft:l,onDrawn:S,parts:p}){let{view:w}=at(),R=a==="scene"||a==="graview",O=Lt(w),v={face:n,path:R?ke:a==="picture"?d??"#":s,stop:O};return vr(e,`${a} ${R?O:v.path} ${l}`,v,S,p),null}var ft,Eo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.7UXDIEPK.js","./chunk.AI2HBKVP.js","./chunk.Q5IAXTF5.js","./chunk.SDO3U72B.js","./chunk.VOHRQXCF.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.NWK4E7TJ.js"))),Kt=()=>Eo().then(e=>void(ft=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(a),e()},a=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Kt));function Ao({face:e,stop:n,kinds:a,places:s,opens:d}){let{view:l,go:S}=at(),p=(0,c.useRef)({face:e,stop:n});return(0,c.useLayoutEffect)(()=>{let w=p.current.stop!==n,R=p.current.face!==e,O=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!R||e==="pages"||e==="picture")return;let v=(w||O)&&n!==void 0?Mr(e,n,a,s):O&&rr(l)?Bt(e,Wt(d),a):e==="graview"?Mt(l,!0):l.overview?On(Mt(l,!1),Yn(l,a)):l;S(v)},[e,n,a,l,S,d]),null}function Ro({app:e,studio:n,report:a}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(fo,{})}),n!==!1?(0,h.jsx)(je,{module:"@graview/studio",report:a,children:(0,h.jsx)(To,{app:e,studio:n})}):null]})}function To({app:e,studio:n}){let a={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},s=n?.place;return s?(0,h.jsx)(s,{...a}):(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(bo,{...a})})}function xo({path:e,stop:n,...a},s){return{...a,app:s.app,at:s.at,remote:s.remote,...s.remote.presence?{presence:s.remote.presence}:{}}}function Jt(e,n){let a=n.store??n.remote?.store??or(n.app,n.seed),s=n.notices??it(),d=null,l={},S=0,p=n.label,w=n.app,R=Promise.resolve(),O=n.at?.face??n.face,v=O===void 0?void 0:Dt({...n,face:O}),E=v??Ut(n.stop),L=null,P=[],j=f=>{if(L=f,f!==E)return;let B=P;P=[];for(let U of B)U()};function se(){let[f,B]=(0,c.useState)(v),[U,Y]=(0,c.useState)(n.stop),[F,le]=(0,c.useState)(n.path),[W,x]=(0,c.useState)(n.scheme??"auto"),[Re,k]=(0,c.useState)(n.principal),[oe,T]=(0,c.useState)(n.seats),[Q,$]=(0,c.useState)(n.quickAsk),[ue,ve]=(0,c.useState)(n.people),[N,q]=(0,c.useState)(n.hostContext),[I,ae]=(0,c.useState)(n.brand),[M,Te]=(0,c.useState)(n.label),[K,te]=(0,c.useState)(n.hostActions),[C,fe]=(0,c.useState)(void 0),[pe,de]=(0,c.useState)(n.draftView);return d={app:Z=>{fe(Z),le(void 0),Y(void 0)},face:B,stop:Y,path:le,scheme:x,seat:k,seats:T,quickAsk:$,people:ve,hostContext:q,brand:ae,label:Te,hostActions:te,draft:de},(0,h.jsx)(Vr.Provider,{value:l,children:(0,h.jsx)(Hr,{...C?xo(n,C):n,store:a,notices:s,...f!==void 0?{face:f}:{},onOpening:Z=>{E=Z},...U!==void 0?{stop:U}:{},...F!==void 0?{path:F}:{},...Re?{principal:Re}:{},...oe?{seats:oe}:{},...Q!==void 0?{quickAsk:Q}:{},...ue?{people:ue}:{},...N?{hostContext:N}:{},...I?{brand:I}:{},label:M,hostActions:K,draftView:pe,scheme:W,onFace:Z=>{E=Z,B(Z)},onSeat:k,onFaceDrawn:j},C?.n??0)})}let D=()=>{let f=l.view?.focusId,B=f?a.graph.getNode(f)?.kind:void 0,U=(l.shown??E)==="scene"||(l.shown??E)==="graview";return{face:E,path:U?ke:l.pages?.()??n.path??"/",stop:l.view?Lt(l.view):n.stop??"#",...B?{kind:B}:{}}},ee=(0,Ar.createRoot)(e);return(0,G.flushSync)(()=>ee.render((0,h.jsx)(se,{}))),{get store(){return a},where:D,setApp:(f,B,U)=>{let Y="graph"in B?{store:B}:B,F=()=>{let le=D();a=Y.store,p=U?.label??(p===w.name?f.name:p),w=f,(0,G.flushSync)(()=>{d?.label(p),d?.app({app:f,remote:Y,at:le,n:++S})})};ft?F():R=R.then(Kt).then(F)},setFace:f=>{E=f,(0,G.flushSync)(()=>d?.face(f))},setStop:f=>(0,G.flushSync)(()=>d?.stop(f)),setPath:f=>(0,G.flushSync)(()=>{if(zt(f)){(E==="pages"||E==="picture")&&(E="scene",d?.face("scene"));return}d?.path(f),E!=="pages"&&(E="pages",d?.face("pages"))}),setScheme:f=>(0,G.flushSync)(()=>d?.scheme(f)),setSeat:f=>(0,G.flushSync)(()=>d?.seat(f)),setSeats:f=>(0,G.flushSync)(()=>d?.seats(f)),setQuickAsk:f=>(0,G.flushSync)(()=>d?.quickAsk(f)),setPeople:f=>(0,G.flushSync)(()=>d?.people(f)),setHostContext:f=>(0,G.flushSync)(()=>d?.hostContext(f)),setBrand:f=>(0,G.flushSync)(()=>d?.brand(f)),setDraftView:f=>(0,G.flushSync)(()=>d?.draft(f)),setLabel:f=>{p=f,(0,G.flushSync)(()=>d?.label(f))},setHostActions:f=>(0,G.flushSync)(()=>d?.hostActions(f)),drawn:()=>R.then(()=>L===E?void 0:new Promise(f=>P.push(f))),notify:f=>{let B;return(0,G.flushSync)(()=>{B=s.notify(f)}),B},unmount:()=>ee.unmount()}}var pt=e=>`s${(e+1).toString(36)}`;var Dr="/graview/live",Yt="graview.ship",Qt=`${Yt}.${tt}`;var ge={seat:"x-graview-seat",roles:"x-graview-roles",kind:"x-graview-kind",name:"x-graview-name",for:"x-graview-for",forRoles:"x-graview-for-roles",forName:"x-graview-for-name",via:"x-graview-via"};var Be=class extends Error{constructor(n){super(n),this.name="Superseded"}},Ae=e=>e?.lineage?{lineage:e.lineage}:{},Oo=(e,n)=>`${e.calls.map(a=>a.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
2
+ `)[0]??"":String(n)})`;function Fo(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let a=JSON.parse(n);return Array.isArray(a)?a.filter(s=>!!s&&Array.isArray(s.calls)):[]}catch{return[]}}var We=class extends Error{constructor(a){super(a.sentence);this.refusal=a;this.name="RemoteRefusedError"}},Co={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},we=class extends Error{constructor(a,s){super(a);this.conflicts=s;this.name="StaleWrite"}},ze=class extends Error{constructor(n){super(n),this.name="Unreached"}},Lo=new Set([502,503,504]);async function Mo(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function Ho(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Vo=1,Do=()=>({refusals:new Set,conflicts:new Set,statuses:new Set,helds:new Set,builds:new Set,who:new Set,declarations:new Set,tally:{reconnects:0,rebases:0,conflicts:0,resyncs:0}});async function mt(e){return(await Br(e,Fo(e.carry),"This app was updated while your changes were on the way.",Do())).remote}async function Br(e,n,a,s){let d=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},S={...ht(e.principal),[ge.via]:e.via??"web"};Object.assign(l,S);let p=e.live===!0,w=e.presenceEveryMs,R=e.visible??$o,O="connecting",v=s.statuses,E=s.tally,L=[],P,j=[],se=()=>O==="online"&&P!==void 0?"held":O,D=()=>{let t=se();if(s.told!==t){s.told=t;for(let r of[...v])r(t)}},ee=t=>{if(!(t===O||ie)&&(O==="offline"&&t==="online"&&E.reconnects++,O=t,D(),t==="online"))for(let r of L.splice(0))r.again()},f=t=>{if(ie)return;let r=typeof t=="string"&&t.length>0?t:void 0,i=r!==P;if(P=r,B(),!!i&&(D(),r===void 0)){for(let o of j.splice(0))o();V&&clearTimeout(V),nn()}},B=()=>{if(s.toldHeld!==P){s.toldHeld=P;for(let t of[...s.helds])t(P??null)}},U=async(t,r)=>{let i;try{i=await d(t,r)}catch(o){throw z()||ee("offline"),new ze(o instanceof Error?o.message:String(o))}if(i.status===503&&await Mo(i))return ee("online"),i;if(Lo.has(i.status))throw z()||ee("offline"),new ze(`The server is away (${i.status})`);return ee("online"),i},Y=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${_e.op}`,i=t?await d(r,{headers:l}):await U(r,{headers:l});if(!i.ok)throw new Error((await i.json().catch(()=>({}))).error??`The server refused (${i.status})`);return await i.json()},F=e.state??await Y(!0);p||(O="online"),P=typeof F.held=="string"&&F.held.length>0?F.held:void 0,B();let le=F.enabledModules??e.enabledModules,W=e.localApp?e.localApp(e.app):e.app,x=new kn({schema:W.schema,mutations:W.mutations??[],invariants:W.invariants??[],...W.policy?{policy:W.policy}:{},...W.publishing?{publishing:W.publishing}:{},...W.modules?{modules:W.modules}:{},...le?{enabledModules:le}:{},...W.intelligence?{intelligence:W.intelligence}:{},...W.brand?.timeZone?{timeZone:W.brand.timeZone}:{},snapshot:F.snapshot,log:F.log,...F.horizon!==void 0?{horizon:F.horizon}:{},ids:Ho(),...e.storeOptions??{}});bn.served.add(x);let Re=Sn(x),k=F.log.at(-1)?.seq??(F.horizon??0)-1,oe=Tt.of(F.log,{horizon:F.horizon??0}),T=null,Q,$=new Map,ue=s.who,ve=!1,N=t=>{if(ie)return;ve=!0;let r=Rn(new Map,t,Date.now(),Ft,T?.participant);Q!==void 0&&r.delete(Q);let i=r.size!==$.size;if(!i)for(let[o,u]of r)Ct(u,$.get(o))||(i=!0);if($=r,!!i)for(let o of[...ue])o([...$.values()])},q=[],I=new Set,ae=t=>{let r=q.indexOf(t);r>=0&&q.splice(r,1)},M=new Map,Te=(t,r)=>{let i=M.get(t);i&&(M.delete(t),i.resolve({ops:r.filter(o=>o.batch===t),batch:t}))},K,te=[],C=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(K)return te.push({ops:t,drop:r}),[];let i=Math.min(...t.filter(g=>g.seq>k).map(g=>g.seq));if(Number.isFinite(i)&&i>k+1)return te.push({ops:t,drop:r}),fe(),[];let o=q.filter(g=>t.some(J=>J.batch===g)),u=[...new Set([...r,...o])].filter(g=>I.has(g)),m,b=q.filter(g=>!o.includes(g));try{m=x.rebase({confirmed:t,pending:b,drop:u}).confirmed}catch(g){if(!(g instanceof Pn))throw g;return te.push({ops:t,drop:r}),fe(),[]}for(let g of o)ae(g);t.some(g=>g.seq>k)&&b.some(g=>!u.includes(g))&&E.rebases++,t.length>0&&(k=Math.max(k,...t.map(g=>g.seq)),oe.note(t));for(let g of u)I.delete(g);for(let g of o)Te(g,t);return m},fe=()=>{K||(K=be(Y().then(t=>{if(pe(t)){te=[];return}let r=new Set(t.log.map(u=>u.batch)),i=q.filter(u=>r.has(u));for(let u of i)ae(u);let o=x.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...q],drop:[...I].filter(u=>!q.includes(u))});I.clear();for(let u of o.pending)I.add(u.batch);k=t.log.at(-1)?.seq??(t.horizon??0)-1,oe=Tt.of(t.log,{horizon:t.horizon??0}),E.resyncs++;for(let u of i)Te(u,t.log)}).then(()=>{K=void 0;let t=te;te=[];for(let{ops:r,drop:i}of t)C(r,i)},()=>{K=void 0,te=[]})))},pe=t=>(typeof t.build=="string"&&on(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===F.version?!1:(bt(t.version),!0)),de=async t=>{let i=await(await U(`${e.url}/graview/since?seq=${pt(t)}&opFormat=${_e.op}`,{headers:l})).json();return pe(i)?[]:i.reset===!0?(fe(),[]):i.ops??[]},Z=async()=>{let t=await Ge();return K&&await K,t},Ge=async()=>{if(T&&!z()&&R()){let r=await(await U(`${e.url}/graview/here`,{method:"POST",headers:l,body:JSON.stringify({presence:T,seq:pt(k)})})).json();return pe(r)?[]:(typeof r.participant=="string"&&(Q=r.participant),N(r.who??[]),C(r.ops??[]))}return C(await de(k))},xe=new Map,A=new Map,$e=new Set,ne=new Map,ce=new Set,be=t=>(ce.add(t),t.finally(()=>ce.delete(t)).catch(()=>{}),t),Ne=Promise.resolve(),He=0,yt=(t,r)=>{let i=Ne.then(()=>Ue(t,r));return Ne=i.catch(()=>{}),i},gt=()=>new Promise((t,r)=>L.push({again:t,give:r})),Ue=async(t,r)=>{let i,o;for(;;){try{i=await U(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:_e.op})})}catch(g){if(!(g instanceof ze)||X)throw g;if(await gt(),z())return Je(t,r);continue}if(o=await i.json().catch(()=>({})),i.status===503&&o.reason==="unavailable"&&typeof o.held=="string"&&!X){if(typeof o.version=="number"?pe(o):(f(o.held),!1))break;if(P!==void 0&&(Et>0||p)){if(await new Promise(g=>j.push(g)),X)throw new Be("The client closed.");if(z())return Je(t,r);continue}}let b;if(i.status===503&&o.reason==="unavailable"&&!X)b=Zt(e.backoff,He++);else{if(He=0,i.status!==429||X)break;b=Bo(i.headers.get("retry-after"),o.retryAfter)}if(await new Promise(g=>setTimeout(g,b)),z())return Je(t,r)}if(ie||pe(o))throw new Be("The app was changed.");if(!i.ok){let b=o.error??`The server refused (${i.status})`;throw o.conflict?new we(b,o.conflicts??[]):new We({reason:o.reason??Co[i.status]??"invalid",sentence:b,...o.wouldNeed?.length?{wouldNeed:o.wouldNeed}:{}})}let u=o.ops??[],m=u[0]?.seq;return m!==void 0&&m>k+1&&(u=await de(k)),r!==void 0&&(o.batch&&xe.set(r,o.batch),ae(r)),C(u,r!==void 0?[r]:[]),{ops:o.ops??[],...o.batch?{batch:o.batch}:{}}},_,re=!1,X=!1,Oe=0,Se,Ke=0,Pe=0,Fe=null,me=()=>{},Ve=new Promise(t=>{me=t}),z=()=>p&&re&&_?.readyState===Vo,Ce=t=>{if(!z())return!1;try{return _.send(JSON.stringify(t)),!0}catch{return!1}},y=(t=!1)=>{!T||!z()||!R()||!t&&Fe&&Ct(T,Fe)&&(w===void 0||Date.now()-Pe<w)||Ce({t:"here",presence:T})&&(Fe=T,Pe=Date.now())},H=new Set,V,nn=()=>{if(V=void 0,P!==void 0)return;let t=[...M.entries()].filter(([r])=>H.has(r));H.clear();for(let[,r]of t)Ce(r.message)},rn=(t,r)=>{M.has(t)&&(H.add(t),V&&clearTimeout(V),V=setTimeout(nn,Math.max(0,r)))},Nr=t=>{M.has(t)&&H.add(t)},Je=(t,r)=>new Promise((i,o)=>{let u=r??`send-${++Ke}`,m=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...Ae(t)}:{t:"call",cid:u,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...Ae(t)};if(M.set(u,{message:m,...r!==void 0?{mine:r}:{},resolve:i,reject:o}),H.size>0||P!==void 0){H.add(u);return}Ce(m)}),Ye=(t,r)=>z()?Je(t,r):yt(t,r),Ir=t=>{switch(t.t){case"welcome":{if(on(t.build),typeof t.version=="number"&&t.version!==F.version){bt(t.version);return}if(re=!0,Oe=0,typeof t.participant=="string"&&(Q=t.participant),f(t.held),t.state?fe():C(t.ops??[]),H.clear(),V&&clearTimeout(V),V=void 0,P!==void 0)for(let r of M.keys())H.add(r);else for(let r of M.values())Ce(r.message);y(!0),ee("online"),me();return}case"ops":C(t.ops??[]);return;case"ack":{let r=M.get(t.cid);if(!r){C(t.ops??[]);return}M.delete(t.cid),He=0,r.mine!==void 0&&(xe.set(r.mine,t.batch),ae(r.mine)),C(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=M.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){P!==void 0?Nr(t.cid):rn(t.cid,Zt(e.backoff,He++));return}M.delete(t.cid),r.reject(t.t==="conflict"?new we(t.sentence,t.conflicts??[]):new We({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&rn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":N(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==F.version&&bt(t.version);return;case"reload":cn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&_){let r=_;un(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},ie=!1,wt=s.declarations,vt=s.builds,on=t=>{if(!(ie||s.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){s.otherBuild=t;for(let r of[...vt])r(t)}},an=()=>{let t=[],r=0;for(let i of q){let o=ne.get(i);o?t.push({calls:o.calls,...o.intent?{intent:o.intent}:{},...o.via?{via:o.via}:{},...Ae(o),batch:i}):r++}return{carried:t,undos:r}},sn=(t,r)=>`${r} while ${t===1?"an undo of yours was":"undos of yours were"} on the way; ${t===1?"it was":"they were"} not made.`,dn=t=>{ie=!0,T=null;let r=new Be(t);for(let o of M.values())o.reject(r);M.clear(),Xe&&clearInterval(Xe),X=!0,Se&&clearTimeout(Se),V&&clearTimeout(V),he&&clearTimeout(he);for(let o of L.splice(0))o.give(r);for(let o of j.splice(0))o();let i=_;_=void 0,re=!1;try{i?.close(1e3,t)}catch{}me()};async function bt(t){if(ie)return;if(!e.resolveApp){cn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:i}=an(),o=e.resolveApp,u=T;dn("The app was changed.");try{let m=await o(t),{state:b,...g}=e,J=await Br({...g,app:m},r,"The app was changed while your changes were on the way.",s);u&&J.remote.presence.here(u);for(let et of[...wt])et(J.remote,t);let Jr=[...i>0?[Qe(sn(i,"The app was changed"))]:[],...J.unheard()];for(let et of Jr)for(let Yr of De)Yr(et.sentence,et)}catch(m){let b=`The app was changed, but the new version could not be opened: ${m instanceof Error?m.message:String(m)}`;for(let g of De)g(b,Qe(b))}}function cn(t){if(ie)return;let{carried:r,undos:i}=an();dn(t);let o=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),o=!0}catch{}let u=[];!o&&r.length>0&&u.push(`${t} ${r.length===1?"A change of yours was":`${r.length} changes of yours were`} not sent; make ${r.length===1?"it":"them"} again after the page reloads.`),i>0&&u.push(sn(i,"This app was updated"));for(let m of u)for(let b of De)b(m,Qe(m));(e.reloadPage??Wo)()}let ln=()=>{if(X||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${Dr}`,{"content-type":r,...i}=l,o;try{o=e.socket?e.socket(t,i,[Qt]):Kr(t,i)}catch{return fn()}_=o,re=!1,o.onopen=()=>{_===o&&o.send(JSON.stringify({t:"hello",seq:pt(k),protocol:tt,wire:Yt,opFormat:_e.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},o.onmessage=u=>{if(_!==o)return;let m;try{m=JSON.parse(String(u.data))}catch{return}Ir(m)},o.onclose=()=>un(o),o.onerror=()=>{}},he,_r=()=>{ve=!1,he&&clearTimeout(he),he=setTimeout(()=>{if(he=void 0,ve||X)return;let t=new Map([...$].filter(([,r])=>r.held!=="socket"));if(t.size!==$.size){$=t;for(let r of ue)r([...$.values()])}},Ft),he.unref?.()};function un(t){if(_!==t)return;let r=re;_=void 0,re=!1,Fe=null,r&&(ee("offline"),_r()),fn()}let fn=()=>{if(X)return;let t=Zt(e.backoff,Oe);Oe++,Se=setTimeout(ln,t)},pn=x.applyAll.bind(x),jr=x.undo.bind(x),qr=x.previewAll.bind(x);x.previewAll=(t,r)=>qr(t,{...e.principal?{author:e.principal}:{},...r});let De=s.refusals,Ie=[],Qe=t=>({reason:"invalid",sentence:t}),Ze=s.conflicts,St=!1,mn,Pt=async(t,r)=>{if(r instanceof Be||ie)return;let i=r instanceof We?r.refusal:wn(r),o=i.sentence,u=r instanceof we?mn?.yoursOf(x,ne.get(t)?.calls??[]):void 0;ae(t);try{C([],[t])}catch{}let m=ne.get(t);if(ne.delete(t),r instanceof we&&E.conflicts++,r instanceof we&&!z()&&await Z().catch(()=>[]),r instanceof we&&K&&await K,r instanceof we&&Ze.size>0){let b=!1,g={sentence:o,conflicts:u?r.conflicts.map(J=>J.node===u.node&&J.field===u.field?{...J,yours:u.yours}:J):r.conflicts,keepTheirs(){b=!0},useMine(){if(!(b||!m)){b=!0,St=!0;try{x.applyAll(u?[u.over(k)]:m.calls,{...m.intent?{intent:m.intent}:{},...m.via?{via:m.via}:{},...Ae(m)})}finally{St=!1}}}};for(let J of Ze)J(g);return}for(let b of De)b(o,i)},zr=(t,r)=>t.flatMap(i=>i.mutation?.name===gn?[]:i.primitives.flatMap(o=>o.op==="splice-text"&&!r.has(o.id)&&!r.has(`${o.id}\0${o.field}`)?[{node:o.id,field:o.field,rev:k}]:[]));x.applyAll=(t,r)=>{let i=vn(x.log.all().filter(b=>I.has(b.batch))),o=pn(t,{...e.principal?{author:e.principal}:{},...r}),u=t.map((b,g)=>{let J=o.minted?.[g];return J===void 0||b.args?.id!==void 0?b:{...b,mintedHint:J}});q.push(o.batch),I.add(o.batch),ne.set(o.batch,{calls:u,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...Ae(r)});let m=St?[]:[...oe.baseFor(o.ops,i,(b,g)=>x.collaborative(b,g)),...zr(o.ops,i)];return A.set(o.batch,be(Ye({calls:u,...r?.intent?{intent:r.intent}:{},batch:o.batch,...m.length>0?{base:m}:{},...r?.via?{via:r.via}:{},...Ae(r)},o.batch).catch(b=>Pt(o.batch,b)))),o},x.apply=(t,r)=>x.applyAll([t],r),x.undo=(t,r)=>{let i=typeof t=="string"?[t]:t,o=jr(i.map(m=>xe.get(m)??m),{...e.principal?{author:e.principal}:{},...r});q.push(o.batch),I.add(o.batch);let u=Promise.allSettled(i.map(m=>A.get(m)));return A.set(o.batch,be(u.then(()=>{let m=i.filter(b=>!$e.has(b));if(m.length===0){ae(o.batch),ne.delete(o.batch),C([],[o.batch]);return}return Ye({undo:m.map(b=>xe.get(b)??b),...r?.intent?{intent:r.intent}:{},batch:o.batch,...r?.via?{via:r.via}:{},...Ae(r)},o.batch)}).catch(m=>Pt(o.batch,m)))),o};let Gr=async(t,r={})=>{kt++;try{return(await be(Ye({calls:t,...r}))).ops}finally{kt--}},kt=0,hn={here(t){T=t,y()},onWho(t){return ue.add(t),$.size>0&&t([...$.values()]),()=>{ue.delete(t)}},leave(){if(!T)return;let t=JSON.stringify({participant:Q??T.participant});if(T=null,Ce({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):d(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},Et=e.pollMs??800,Xe=Et>0&&typeof setInterval=="function"?setInterval(()=>{z()||Z().catch(()=>{})},Et):null;if(p){ln();let t;await Promise.race([Ve,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!ie){let t=[],r=new Set(x.log.all().map(i=>i.batch));for(let i of n)if(!(i.batch!==void 0&&r.has(i.batch)))try{x.applyAll(i.calls,{...i.intent?{intent:i.intent}:{},...i.batch?{batch:i.batch}:{},...i.via?{via:i.via}:{},...Ae(i)})}catch(o){t.push(Oo(i,o))}t.length>0&&Ie.push(Qe(`${a} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let yn=new Map,Ur=()=>({store:x,author:e.principal,appliedAll:pn,pending:q,provisional:I,asked:ne,answers:A,letGo:$e,sent:(t,r)=>be(Ye({calls:r,batch:t},t).catch(i=>Pt(t,i))),settle:ae,land:C,seen:()=>k,gone:()=>X||ie});return{remote:{store:x,typing(t,r){let i=`${t}\0${r}`,o=yn.get(i);return o||(o=(__graviewPreload(import.meta.url,["./chunk.R7ZZJOJW.js","./chunk.VOHRQXCF.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.C4UNAJWC.js")).then(u=>(mn=u,u.typingOf(t,r,u.wireOf(Ur())))),yn.set(i,o)),o},version:F.version,migrated:F.migrated??[],send:Gr,pull:Z,onRefusal(t){De.add(t);let r=Ie;Ie=[];for(let i of r)t(i.sentence,i);return()=>De.delete(t)},onDeclaration(t){return wt.add(t),()=>wt.delete(t)},onBuild(t){return vt.add(t),s.otherBuild!==void 0&&t(s.otherBuild),()=>vt.delete(t)},onConflict(t){return Ze.add(t),()=>Ze.delete(t)},revision:(t,r)=>oe.of(t,r),seq:()=>k,participant:()=>Q,transport:()=>z()?"socket":"poll",status:se,onStatus(t){return v.add(t),()=>v.delete(t)},held:()=>P,onHeld(t){return s.helds.add(t),P!==void 0&&t(P),()=>s.helds.delete(t)},counters:()=>({...E}),who:()=>[...$.values()],pending:()=>q.length+kt,async settled(){for(;ce.size>0;)await Promise.allSettled([...ce])},presence:hn,close(){Xe&&clearInterval(Xe),Re(),hn.leave(),X=!0,Se&&clearTimeout(Se),V&&clearTimeout(V),he&&clearTimeout(he);for(let r of L.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of j.splice(0))r();let t=_;_=void 0,re=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Ie;return Ie=[],t}};function Kr(t,r){let i=globalThis.WebSocket;if(!i)throw new Error("This runtime has no WebSocket; the client polls instead.");let o=typeof globalThis.document<"u",u=e.subprotocol?[Qt]:[];if(!o)try{return new i(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let m=new URL(t);for(let[b,g]of Object.entries(S))m.searchParams.set(b,g);return u.length>0?new i(m.toString(),u):new i(m.toString())}}function Bo(e,n,a=Date.now()){let s,d=e?.trim();if(d)if(/^\d+(\.\d+)?$/.test(d))s=Number(d)*1e3;else{let p=Date.parse(d);Number.isFinite(p)&&(s=Math.max(0,p-a))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,S=l!==void 0&&l<50&&s!==void 0&&Math.abs(l*1e3-s)<1e3;return l!==void 0&&!S?l:s??1e3}function Wo(){globalThis.location?.reload?.()}function $o(){return globalThis.document?.visibilityState!=="hidden"}function Zt(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:a=250,max:s=1e4,factor:d=2}=e??{};return Math.min(s,a*d**n)*(.75+Math.random()*.5)}function ht(e){let n={};if(!e)return n;e.id&&(n[ge.seat]=e.id),e.roles?.length&&(n[ge.roles]=e.roles.join(",")),e.kind!=="human"&&(n[ge.kind]=e.kind),e.name&&(n[ge.name]=encodeURIComponent(e.name));let a=e.onBehalfOf;return a?.id&&(n[ge.for]=a.id),a?.roles?.length&&(n[ge.forRoles]=a.roles.join(",")),a?.name&&(n[ge.forName]=encodeURIComponent(a.name)),n}var Wr="/graview/views";function Xt(e){let n=e.fetch??fetch,a=e.url.replace(/\/$/,""),s={"content-type":"application/json",...e.principal?ht(e.principal):{},...e.headers??{}},d=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??nt.may}:nt,l=new Set,S=v=>{if(JSON.stringify(v)!==JSON.stringify(d)){d=v;for(let E of l)E()}},p=async(v,E)=>{let L=await n(`${a}${e.path??Wr}`,{method:v,headers:s,...E!==void 0?{body:JSON.stringify(E)}:{}}),P=await L.json();if(!L.ok)throw new Error(P.error??`The store answered ${L.status}.`);S({hidden:P.hidden??[],removed:P.removed??[],may:P.may??nt.may})},w=()=>p("GET"),R=e.state?Promise.resolve():w().catch(()=>{}),O=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:R,refresh:w,close:()=>clearInterval(O),current:()=>d,onChange(v){return l.add(v),()=>void l.delete(v)},hide:v=>p("POST",{hide:v}),show:v=>p("POST",{show:v}),remove:(v,E)=>p("POST",{remove:v,...E?{about:E}:{}}),async restore(v){let E=d.removed.find(L=>L.name===v)?.lens;await p("POST",{restore:v}),E&&await e.onDeclaration?.()},async lens(v){await p("POST",{lens:v}),await e.onDeclaration?.()}}}var tn=document.getElementById("graview-app"),en=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),$r=en?(__graviewPreload(import.meta.url,["./chunk.D62V3TBW.js","./chunk.YUEOUV7G.js","./chunk.UGFDSE37.js","./chunk.W5UJLKIT.js","./chunk.7UJZP3YK.js","./chunk.R77TACXU.js","./chunk.6JERQFZI.js","./chunk.7XJ3XQZD.js","./chunk.52J42KR5.js","./chunk.T2Q3AAQI.js","./chunk.63SRVTG2.js","./chunk.C4EPMV7O.js","./chunk.G7XKQNOL.js","./chunk.7KZ44FEU.js","./chunk.LSL25VXW.js","./chunk.WWUMSCYC.js","./chunk.J2R55TM7.js","./chunk.KPUX27ZT.js","./chunk.DIS7JS7X.js","./chunk.D2T563AA.js","./chunk.JV7FLVUV.js","./chunk.GL3YVGAP.js","./chunk.XOZU4OFA.js","./chunk.C7EEYSAM.js","./chunk.MB7LKKUD.js","./chunk.M33LUF3Q.js","./chunk.HSGUXMAO.js","./chunk.WVUJXDXZ.js","./chunk.QRCTTDDQ.js","./chunk.3TME4BG3.js","./chunk.I43ONAEL.js","./chunk.73EKJ4JN.js","./chunk.INL4OZI7.js","./chunk.5WU2UTP7.js","./chunk.GZHZLJBF.js","./chunk.YKACMLLU.js","./chunk.OJGHDWI6.js","./chunk.337JMOTL.js","./chunk.CV4QA4ZF.js","./chunk.OYRZ2DEI.js","./chunk.7EA7THSM.js","./chunk.AI2HBKVP.js","./chunk.Q5IAXTF5.js","./chunk.SDO3U72B.js","./chunk.VOHRQXCF.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.FLNYLE6S.js")):Me("pages");try{en?await No(decodeURIComponent(en[1])):await Io()}catch(e){let n=document.createElement("pre");n.setAttribute("role","alert"),n.style.cssText="margin:2rem;font:14px/1.5 ui-monospace,monospace;white-space:pre-wrap",n.textContent=e instanceof Error?e.message:String(e),tn.replaceChildren(n),window.__graviewFailed=n.textContent}async function No(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),a=await n.json();if(!n.ok)throw new Error(a.error??`The preview server did not hand over the form (${n.status}).`);let s=await dt(a);if(!s.ok)throw new Error(rt(s.findings));let d=s.app,l=a.principal,S=await mt({app:d,url:location.origin,principal:l,...a.state?{state:a.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=d.forms?.[e]?.title??d.name;let{mount:p}=await $r;window.__graview=p(tn,{app:d,form:e,principal:l,remote:S,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Io(){let e=await fetch("/graview/document");if(!e.ok)throw new Error(`The preview server did not hand over the document (${e.status}).`);let n=await e.json(),s=await(async w=>{if(typeof w.module=="string")return(await import(w.module)).app;let R=await dt(w);if(!R.ok)throw new Error(rt(R.findings));return R.app})(n);if(!s||typeof s!="object"||!("schema"in s))throw new Error("The app module the preview server handed does not export an app.");let d=n.principal,l=await mt({app:s,url:location.origin,principal:d,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=s.name;let S,p=Xt({url:location.origin,principal:d,...n.views?{state:n.views}:{},onDeclaration:async()=>{let w=await(await fetch("/graview/document")).json();if(typeof w.module=="string")return;let R=await dt(w);R.ok&&S?.setApp(R.app,l)}});await Promise.all([$r,p.ready]),S=Jt(tn,{app:s,remote:l,principal:d,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:s.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=S,S.drawn().then(()=>{window.__graviewReady=!0})}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graview",
3
- "version": "0.1.51",
3
+ "version": "0.1.52",
4
4
  "type": "module",
5
5
  "description": "The Graview command line: start a product, check its declaration, write its agent docs, serve its store, preview a document with no product and photograph its places, say whether a product is on one release, host it for an agent over MCP, apply an act to it, sync its seed, install the authoring skills. The tool; @graview/* is the framework.",
6
6
  "keywords": [
@@ -29,11 +29,11 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@graview/core": "0.1.51",
33
- "@graview/ship": "0.1.51",
34
- "@graview/skills": "0.1.51",
35
- "@graview/guest": "0.1.51",
36
- "@graview/tools": "0.1.51"
32
+ "@graview/core": "0.1.52",
33
+ "@graview/ship": "0.1.52",
34
+ "@graview/tools": "0.1.52",
35
+ "@graview/guest": "0.1.52",
36
+ "@graview/skills": "0.1.52"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=22"
@@ -1 +0,0 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{Fa as o,G as k,T as n}from"./chunk.TMYGLXR6.js";import{a as t}from"./chunk.SDO3U72B.js";import{b as p}from"./chunk.AJZBJBMO.js";var f=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.E2R6VFZX.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.KOBCLWPC.js")))),I=d.part((e,r)=>e.drawLinkedRecord(r),{quiet:!0}),w=d.part((e,r)=>e.drawLinkedPicker(r),{what:"Picking a linked record"});var s=p(n(),1),m=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.CXC5FOIO.js")))),E=m.part((e,r)=>(0,s.jsx)(e.RepeatPicker,{...r}),{quiet:!0}),W=m.part((e,r)=>(0,s.jsx)(e.RepeatEditor,{...r}),{quiet:!0});var a=p(k(),1),i=p(n(),1),c=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.PPZ2TOB5.js")))),l=c.part((e,r)=>(0,i.jsx)(e.WhenInput,{...r}),{quiet:!0});function M(e){return(0,i.jsx)(a.Suspense,{fallback:(0,i.jsx)("span",{"data-graview-when-arriving":"",style:{display:"inline-block",minHeight:24}}),children:(0,i.jsx)(l,{...e})})}var N=()=>c.load().then(()=>{},()=>{});export{y as a,I as b,w as c,E as d,W as e,M as f,N as g};
@@ -1 +0,0 @@
1
- import{a as ee,b as H,c as ne}from"./chunk.KK46XLGU.js";import{A as _,C as U,E as J,I as Q,K as X,N as Y,a as O,i as K,l as G,p as q,s as z,t as W,x as j,y as Z}from"./chunk.GYTVL6GR.js";import{G as ae,Ga as D,Pa as $,T as M,aa as T,ca as N,ta as I}from"./chunk.TMYGLXR6.js";import{Bc as C}from"./chunk.P4CLT32V.js";import{b as k}from"./chunk.AJZBJBMO.js";var o=k(ae(),1);var y=k(M(),1),fe=e=>typeof e=="object"?e:{};function he({rootRef:e,firstLook:r,app:n}){let t=(0,o.useCallback)(()=>e.current,[e]);return r?(0,y.jsx)(Y,{firstLook:r,root:t,app:n}):null}function ge(e,r,n){let{app:t}=e,a=(0,o.useMemo)(()=>{let i=Q(r(t.schema,t.viewSpecs),t),d=n?ie(i,n):i,s=e.views?e.views(t.schema,d):i,c=s===d?i:I(i,s);return X(c,t.schema,U(e.brand??t.brand,t.schema)),n?n.register(c):c},[e.views,t.schema,t.viewSpecs,t.lenses,t.pages,t.home,n]);return D(a,e.keptViews)}function ie(e,r){let n={...e,register(t,a,i,d){return d?.name!==r.name&&e.register(t,a,i,d),n},...e.home?{home:t=>(r.home||e.home(t),n)}:{}};return n}var F=e=>e?e.getBoundingClientRect().height:0;function be(e,r,n){let t=(0,o.useRef)(n);t.current=n;let a=n!==void 0;(0,o.useLayoutEffect)(()=>{let i=e.current;if(!i||!a)return;let d=()=>{let m=[...i.children],h=m.find(b=>b.hasAttribute("data-graview-app-bar")),p=m.find(b=>b.hasAttribute("data-embed-content")),g=p?.querySelector("[data-embed-measure]")??null,l=m.find(b=>b.hasAttribute("data-graview-place-line"));return{strip:h,line:l,content:p,measure:g}},s=-1,c=()=>{let{strip:m,line:h,content:p,measure:g}=d(),l=Math.ceil(F(m)+F(h)+F(g||p));l!==s&&(s=l,t.current?.(l))};if(c(),typeof ResizeObserver>"u")return;let u=new ResizeObserver(c),R=()=>{u.disconnect();let{strip:m,line:h,content:p,measure:g}=d();for(let l of[i,m,h,p,g])l&&u.observe(l)};R();let w=new MutationObserver(()=>{R(),c()});return w.observe(i,{childList:!0}),()=>{u.disconnect(),w.disconnect()}},[e,r,a])}var we=480,se=0;function Se(e){let{app:r,seed:n,scheme:t="auto",brand:a=r.brand,fonts:i=!0,height:d="100%",label:s}=e,c=(0,o.useRef)(null);$(c);let u=d==="viewport"?"100dvh":d,R=G(typeof u=="string"&&/vh\b/.test(u)),w=(0,o.useMemo)(()=>`graview-embed-${++se}`,[]),m=(0,o.useMemo)(()=>e.store??e.remote?.store??H(r,n),[e.store,e.remote,r,n]),h=e.presence??e.remote?.presence,p=e.hostContext?.theme,g=ne(t==="auto"&&p===void 0,a?.scheme),l=t==="auto"?p??g:t,b=(0,o.useMemo)(()=>O(l,a,{scope:`.${w}`}),[l,a,w]);K(e.favicon?C(a):void 0),(0,o.useEffect)(()=>{if(!i||typeof document>"u")return;let v=ee(a);if(!v||document.querySelector(`link[href="${v}"]`))return;let f=document.createElement("link");f.rel="stylesheet",f.href=v,document.head.appendChild(f)},[a,i]);let x=(0,o.useRef)(void 0);(0,o.useLayoutEffect)(()=>{let v=c.current,f=x.current;if(x.current=s,!v||!s)return;let oe=S=>{let E=S.getAttribute("aria-label")??"",A=f&&f!==s?E.startsWith(`${f} \xB7 `)?E.slice(f.length+3):E===f?"":E:E;A===s&&(S.getAttribute("role")==="region"||S.tagName==="SECTION"&&!S.hasAttribute("role"))&&S.setAttribute("role","group");let V=A.startsWith(`${s} \xB7 `)||A===s?A:A?`${s} \xB7 ${A}`:s;V!==E&&S.setAttribute("aria-label",V)},B=()=>v.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(S=>{S.hasAttribute("data-graview-named-by-lens")||oe(S)});B();let P=new MutationObserver(B);return P.observe(v,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>P.disconnect()},[s]);let re=R?`${u}`.replace(/([\d.]+)[sdl]?vh\b/g,(v,f)=>`${+f*R/100}px`):u;return{rootRef:c,scope:w,css:b,scheme:l,store:m,presence:h,brand:a,auto:d==="auto",height:re}}function ve({rootRef:e,board:r}){let n=(0,o.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]);return(0,y.jsx)(q,{board:r,anchor:n})}function Re(e,r,n){return{brand:n,locale:e.locale,timeZone:e.timeZone,principal:e.principal,seats:e.seats,presence:r,typing:e.remote?.typing,people:e.people,memory:e.memory,presenceTtlMs:e.presenceTtlMs,onKeepLens:e.onKeepLens,ai:e.ai,files:e.files,resolveApp:e.resolveApp,history:e.history,linkedRecords:e.linkedRecords,subscriptions:e.subscriptions,dismissals:e.dismissals,whileAway:e.whileAway,keptViews:e.keptViews,signIn:e.signIn,menuSections:e.menuSections,app:e.app}}function Ee({name:e,heading:r,faces:n,at:t,without:a,home:i,reach:d,standing:s,hostActions:c,keeping:u,onFind:R,switch:w,named:m=!0}){let{brand:h,store:p,principal:g,views:l}=T();N();let b=a?.has("places")?[]:z({store:p,principal:g,views:l}),x=_();return(0,y.jsx)(j,{brand:h,name:e,named:m,description:h?.subtitle,heading:r,faces:n,home:i,places:b,current:t===null?null:W(b,t),reach:d,onFind:R,...w?{switch:w}:{},...n||t===null?{scenePlaces:x}:{},tools:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(J,{clean:s}),(0,y.jsx)(Z,{...c?{hostActions:c}:{},...u?{keeping:u}:{}})]})})}var Ae=e=>e===!1?2:Math.min(e+1,6);function xe(e){let[r,n]=(0,o.useState)(e),t=(0,o.useRef)(void 0),a=(0,o.useRef)(void 0),i=(0,o.useMemo)(()=>({go:t,at:n,pending:a}),[]),d=(0,o.useCallback)(s=>{if(t.current){t.current(s);return}a.current=s,n(s)},[]);return{at:r,setAt:n,steering:i,steer:d}}function de(e){let r=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof r=="string"&&r.length>0?r:typeof e=="object"?"Error":typeof e}}var L=()=>typeof performance<"u"?performance.now():Date.now();function Fe(e,r){let n=(0,o.useRef)({onError:e,face:r});return n.current={onError:e,face:r},(0,o.useCallback)((t,a)=>n.current.onError?.(de(t),{module:a.module,face:n.current.face}),[])}function ke(e,r){let n=(0,o.useRef)(null);n.current===null&&(n.current=L());let t=(0,o.useRef)({onReady:e,face:r});t.current={onReady:e,face:r};let a=(0,o.useRef)(!1);return(0,o.useCallback)(i=>{a.current||(a.current=!0,t.current.onReady?.({ms:Math.max(0,L()-(n.current??L())),face:i}))},[])}var te=class extends o.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(r,n){console.error(`[graview] ${this.props.module} threw while rendering`,r,n.componentStack),this.props.report(r,{module:this.props.module})}render(){return this.state.failed?(0,y.jsxs)("div",{role:"alert","data-graview-face-error":this.props.module,...this.props.content?{"data-embed-content":""}:{},style:this.props.content?{flex:"1 1 auto",display:"grid",alignContent:"center",justifyItems:"center",gap:8,padding:24,background:"var(--graview-ground)",color:"var(--graview-ink)",fontSize:"0.9375rem"}:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,y.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,y.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{fe as a,he as b,ge as c,be as d,we as e,Se as f,ve as g,Re as h,Ee as i,Ae as j,xe as k,Fe as l,ke as m,te as n};
@@ -1 +0,0 @@
1
- import{a as b,b as c,c as d,d as e,e as f}from"./chunk.JBR66TUP.js";import"./chunk.76QSPWSJ.js";import"./chunk.XCQ7ZPR5.js";import"./chunk.NVRK6A7T.js";import"./chunk.FKJ3HIA5.js";import{Ab as a}from"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{a as ActRefusal,e as compileDocumentWithoutCheck,d as effectsOf,f as inDocumentWords,c as kindShapes,b as readDocument};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk.MMVCZOEX.js";import"./chunk.OJ64WTLW.js";import"./chunk.GMAXA5GV.js";import"./chunk.Y5AMZBHA.js";import"./chunk.IBJBCZKG.js";import"./chunk.NQ26KMSQ.js";import"./chunk.GJQF7I22.js";import"./chunk.SPU3BVAO.js";import"./chunk.OPCBZNKF.js";import"./chunk.UK5F3S2N.js";import"./chunk.2VJ52LGS.js";import"./chunk.JI2UVZUU.js";import"./chunk.HJCQ6I3S.js";import"./chunk.7GAC7U34.js";import"./chunk.T3RTFTOZ.js";import"./chunk.W2DKFQ6R.js";import"./chunk.NZDHXREL.js";import"./chunk.TBSPEO2L.js";import"./chunk.5ON3JSAK.js";import"./chunk.3SBTQ66X.js";import"./chunk.SSAY4ITS.js";import"./chunk.3H7YIKKC.js";import"./chunk.ET3XJDPX.js";import"./chunk.3TVAE7LE.js";import"./chunk.JX2C3HVD.js";import"./chunk.Z7N3MJ36.js";import"./chunk.HVX7LFWR.js";import"./chunk.WVUJXDXZ.js";import"./chunk.GLTWLQ6L.js";import"./chunk.ACB4TD4W.js";import"./chunk.XCQ7ZPR5.js";import"./chunk.MY5OXSS7.js";import"./chunk.NVRK6A7T.js";import"./chunk.FKJ3HIA5.js";import"./chunk.GZHZLJBF.js";import"./chunk.OW72XZF4.js";import"./chunk.OJGHDWI6.js";import"./chunk.KRODTMGR.js";import"./chunk.VICCAWAN.js";import"./chunk.OU5TRY4N.js";import"./chunk.CQPNDJAC.js";import"./chunk.GYTVL6GR.js";import"./chunk.TMYGLXR6.js";import"./chunk.SDO3U72B.js";import"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{b as declaredLensView,a as formatFor};
@@ -1 +0,0 @@
1
- import{k as a,l as o}from"./chunk.IBJBCZKG.js";import"./chunk.NQ26KMSQ.js";import"./chunk.GJQF7I22.js";import"./chunk.SPU3BVAO.js";import"./chunk.UK5F3S2N.js";import"./chunk.2VJ52LGS.js";import"./chunk.JI2UVZUU.js";import"./chunk.NZDHXREL.js";import"./chunk.TBSPEO2L.js";import"./chunk.5ON3JSAK.js";import"./chunk.3SBTQ66X.js";import"./chunk.SSAY4ITS.js";import"./chunk.WVUJXDXZ.js";import"./chunk.GLTWLQ6L.js";import"./chunk.ACB4TD4W.js";import"./chunk.XCQ7ZPR5.js";import"./chunk.MY5OXSS7.js";import"./chunk.NVRK6A7T.js";import"./chunk.FKJ3HIA5.js";import"./chunk.GZHZLJBF.js";import"./chunk.OW72XZF4.js";import"./chunk.OJGHDWI6.js";import"./chunk.KRODTMGR.js";import"./chunk.VICCAWAN.js";import"./chunk.OU5TRY4N.js";import"./chunk.CQPNDJAC.js";import"./chunk.GYTVL6GR.js";import{sa as n}from"./chunk.TMYGLXR6.js";import"./chunk.SDO3U72B.js";import"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";var w=new WeakMap;function s(e,i){let t=w.get(e);t||w.set(e,t=new Map);let r=t.get(i);return r||t.set(i,r=a(o(e,n(e)),e,i)),r}export{s as frameworkViews};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk.W2DKFQ6R.js";import"./chunk.ET3XJDPX.js";import"./chunk.Z7N3MJ36.js";import"./chunk.GLTWLQ6L.js";import"./chunk.ACB4TD4W.js";import"./chunk.XCQ7ZPR5.js";import"./chunk.MY5OXSS7.js";import"./chunk.NVRK6A7T.js";import"./chunk.FKJ3HIA5.js";import"./chunk.OU5TRY4N.js";import"./chunk.CQPNDJAC.js";import"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{g as columnActs,d as columnChoices,c as columnMoves,b as columnOf,e as columnReach,f as columnSteps,j as describePlace,k as placeText,h as resolveFor,i as shadowedPageSlots,a as statusColumns};
@@ -1 +0,0 @@
1
- import{Dd as P,Ed as S,Fd as x,Id as A,Jd as N,ia as u,ld as w,md as v,nd as k,od as c,qd as $,rd as b,zd as f}from"./chunk.P4CLT32V.js";function H(s){if(!(s.attach==="home"||s.cardinality==="one"||!s.title))return{kind:s.attach,title:s.title,as:k(s.title),name:s.name,lens:"view",...s.hidden?{hidden:!0}:{}}}function V(s,r=[]){let a=[];for(let n of f(s).drawn)for(let i of n.kinds)a.push({kind:i,title:n.title,as:n.as,...n.across?{across:n.across}:{},...n.kinds.length>1?{over:n.kinds}:{},...n.hidden?{hidden:!0}:{}});for(let n of[...s.views?.places?.()??[],...r.flatMap(i=>H(i)??[])])a.some(i=>i.kind===n.kind&&i.as===n.as)||a.push(n);return a}function D(s,r={}){return E(s.schema,V(s,r.views),{...s.pages?{pages:s.pages}:{},lenses:f(s).drawn,home:(s.home?.length??0)>0})}function E(s,r,a={}){let{pages:n}=a,i=s.kinds,d=r.filter(e=>i.includes(e.kind)),o=N(n?.first,s,d),O=new Set(n?.hide??[]),p=A(i,n?.order,d),m=p.flatMap(e=>e.view?[]:[e.kind]),L=p.flatMap(e=>e.view?[e.view]:[]),h=[{slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#",...o?.to==="home"||o===void 0&&a.home?{first:!0}:{}},{slug:P,title:x(n),kind:null,cardinality:"many",address:S,stop:"#"}],G=v([...d].sort((e,t)=>m.indexOf(e.kind)-m.indexOf(t.kind))),g=e=>{let t=a.lenses?.find(l=>l.as===e.as&&l.kinds.includes(e.kind)),y=b(e,d);return{slug:e.as,title:e.title,kind:e.kind,...e.over?{over:e.over.filter(l=>i.includes(l))}:{},cardinality:"many",address:$(e.as,y?c(s,e.kind).slice(1):void 0),stop:y?`#focus=aggregate:${e.kind}&in.view=${encodeURIComponent(e.as)}`:`#view=${encodeURIComponent(e.as)}`,...t?{lens:t.lens}:{},...e.name!==void 0?{view:e.name}:{},...e.hidden?{hidden:!0}:{},...o?.to==="place"&&o.place.as===e.as&&(o.place.kind===e.kind||e.over?.includes(o.place.kind))?{first:!0}:{}}};for(let e of G)L.some(t=>w(t,e))||h.push(g(e));for(let e of p){if(e.view){h.push(g(e.view));continue}let t=e.kind;h.push({slug:c(s,t).slice(1),title:u(s,t),kind:t,cardinality:"many",address:c(s,t),stop:`#focus=aggregate:${t}`,...O.has(t)?{hidden:!0}:{},...o?.to==="kind"&&o.kind===t?{first:!0}:{}})}return h}export{D as a,E as b};
@@ -1 +0,0 @@
1
- import{G as l,N as p,U as k,W as y,c}from"./chunk.IE4ZJQV3.js";import"./chunk.TVWN5I4M.js";import"./chunk.7G4M2PX3.js";import"./chunk.UGFDSE37.js";import{b as m}from"./chunk.NNUUD26E.js";import"./chunk.OJ64WTLW.js";import"./chunk.GMAXA5GV.js";import"./chunk.IBJBCZKG.js";import"./chunk.NQ26KMSQ.js";import"./chunk.GJQF7I22.js";import"./chunk.SPU3BVAO.js";import"./chunk.OPCBZNKF.js";import"./chunk.UK5F3S2N.js";import"./chunk.2VJ52LGS.js";import"./chunk.JI2UVZUU.js";import"./chunk.CTOBNZLM.js";import"./chunk.34HGT7HQ.js";import"./chunk.TNL2BVCH.js";import"./chunk.NZDHXREL.js";import"./chunk.TBSPEO2L.js";import"./chunk.5ON3JSAK.js";import"./chunk.3SBTQ66X.js";import"./chunk.SSAY4ITS.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.GLTWLQ6L.js";import"./chunk.ACB4TD4W.js";import"./chunk.XCQ7ZPR5.js";import"./chunk.MY5OXSS7.js";import"./chunk.NVRK6A7T.js";import"./chunk.FKJ3HIA5.js";import"./chunk.GZHZLJBF.js";import"./chunk.OW72XZF4.js";import"./chunk.OJGHDWI6.js";import"./chunk.KRODTMGR.js";import"./chunk.VICCAWAN.js";import"./chunk.OU5TRY4N.js";import"./chunk.CQPNDJAC.js";import"./chunk.GYTVL6GR.js";import{G as S,H as s,I as d,T as f,ba as g}from"./chunk.TMYGLXR6.js";import"./chunk.SDO3U72B.js";import"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk.KYKHZZT7.js";import"./chunk.6KYWJXZR.js";import"./chunk.GYTVL6GR.js";import"./chunk.TMYGLXR6.js";import"./chunk.SDO3U72B.js";import"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};