graview 0.1.37 → 0.1.38

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.YFW5BF6J.js → chunk.2EJAIT33.js} +1 -1
  2. package/dist/preview/chunk.2HFRVWWM.js +1 -0
  3. package/dist/preview/chunk.2VIGF4FO.js +1 -0
  4. package/dist/preview/chunk.33GN2NUT.js +1 -0
  5. package/dist/preview/{chunk.5CLFTXP3.js → chunk.36SQJMEE.js} +1 -1
  6. package/dist/preview/{chunk.NOZEHLWG.js → chunk.3D5T3XIE.js} +1 -1
  7. package/dist/preview/chunk.3FW4QNGV.js +1 -0
  8. package/dist/preview/chunk.3RT2GUZ5.js +1 -0
  9. package/dist/preview/chunk.3ZRHHB7X.js +1 -0
  10. package/dist/preview/{chunk.YW2BZ2LH.js → chunk.4DEUD66C.js} +2 -2
  11. package/dist/preview/{chunk.VW6WGFL6.js → chunk.4EQSP7I3.js} +1 -1
  12. package/dist/preview/chunk.4Y6BCHV2.js +1 -0
  13. package/dist/preview/{chunk.UPBUF7KR.js → chunk.5MSO3KRO.js} +1 -1
  14. package/dist/preview/chunk.5VBBQ6Z3.js +1 -0
  15. package/dist/preview/chunk.5XJEGXDO.js +3 -0
  16. package/dist/preview/{chunk.BXWO6ILK.js → chunk.67WL7BGF.js} +1 -1
  17. package/dist/preview/{chunk.NWHFFOXW.js → chunk.6CKBIY7L.js} +1 -1
  18. package/dist/preview/{chunk.WNMLA4YW.js → chunk.6IHXTT6Z.js} +1 -1
  19. package/dist/preview/{chunk.QJYALCIW.js → chunk.6ONRWFA6.js} +1 -1
  20. package/dist/preview/{chunk.TSI4O3GH.js → chunk.6UCRL4OF.js} +1 -1
  21. package/dist/preview/{chunk.ENJKCSNX.js → chunk.6XJP7F3I.js} +1 -1
  22. package/dist/preview/{chunk.JDRM6XXD.js → chunk.74RMHUCX.js} +1 -1
  23. package/dist/preview/{chunk.YAXOIJVH.js → chunk.7H5KVW2F.js} +1 -1
  24. package/dist/preview/chunk.7RSZMIAL.js +1 -0
  25. package/dist/preview/{chunk.7MMNMZLF.js → chunk.AFY35RJP.js} +1 -1
  26. package/dist/preview/{chunk.SNKOPWAD.js → chunk.AZCFXPEL.js} +1 -1
  27. package/dist/preview/{chunk.JBRXGPPM.js → chunk.B5ILKGEF.js} +1 -1
  28. package/dist/preview/{chunk.BRBY5WJT.js → chunk.BRHRAVU2.js} +2 -2
  29. package/dist/preview/chunk.BUVAMSOZ.js +3 -0
  30. package/dist/preview/{chunk.ENEOGGFM.js → chunk.DFVVS6C5.js} +1 -1
  31. package/dist/preview/{chunk.YNJOLOFG.js → chunk.DL637Q3W.js} +1 -1
  32. package/dist/preview/chunk.DQJAEU4V.js +1 -0
  33. package/dist/preview/chunk.ESSQAMPM.js +1 -0
  34. package/dist/preview/{chunk.QYWBQ5NX.js → chunk.EUGWV3S6.js} +1 -1
  35. package/dist/preview/chunk.EV553KRT.js +1 -0
  36. package/dist/preview/{chunk.EHT4HBH5.js → chunk.EZP4FHDX.js} +1 -1
  37. package/dist/preview/chunk.F6PIK2J2.js +1 -0
  38. package/dist/preview/{chunk.AWRS6TUN.js → chunk.FMVWXSQ7.js} +1 -1
  39. package/dist/preview/{chunk.NZJZIYDK.js → chunk.FTJBW25J.js} +1 -1
  40. package/dist/preview/chunk.FUJM7GDV.js +1 -0
  41. package/dist/preview/{chunk.AZ333RB3.js → chunk.FYIQZMVF.js} +1 -1
  42. package/dist/preview/{chunk.UVLPVHID.js → chunk.GR5Q4HTW.js} +1 -1
  43. package/dist/preview/{chunk.KAWP4RNR.js → chunk.GZ3IXNA4.js} +1 -1
  44. package/dist/preview/chunk.HUSFMFXH.js +1 -0
  45. package/dist/preview/chunk.HVTGPEVW.js +1 -0
  46. package/dist/preview/chunk.I3SQJ2L2.js +1 -0
  47. package/dist/preview/{chunk.GMZAQGH7.js → chunk.IEDXW36H.js} +1 -1
  48. package/dist/preview/chunk.IM7LXLIB.js +2 -0
  49. package/dist/preview/chunk.IU6ISXXC.js +1 -0
  50. package/dist/preview/{chunk.XS3SAH6U.js → chunk.JWJQ2VXS.js} +1 -1
  51. package/dist/preview/chunk.K5KEECHL.js +88 -0
  52. package/dist/preview/{chunk.UR5TT4JH.js → chunk.KNJZ2YNJ.js} +1 -1
  53. package/dist/preview/chunk.L34FY7QQ.js +1 -0
  54. package/dist/preview/{chunk.HYAKRLPT.js → chunk.L73VUBXN.js} +3 -3
  55. package/dist/preview/{chunk.QOXTBRKE.js → chunk.L7JKEEMM.js} +1 -1
  56. package/dist/preview/chunk.LAW5PQEM.js +1 -0
  57. package/dist/preview/chunk.LDD3QX7G.js +1 -0
  58. package/dist/preview/chunk.LF7PU77M.js +7 -0
  59. package/dist/preview/chunk.LHO7L3CS.js +1 -0
  60. package/dist/preview/chunk.LU5LSXSW.js +1 -0
  61. package/dist/preview/{chunk.3V2M3S4U.js → chunk.MCVY6RRS.js} +1 -1
  62. package/dist/preview/chunk.MQ7FNHXG.js +25 -0
  63. package/dist/preview/{chunk.YX354FRV.js → chunk.MVNUWK5Y.js} +1 -1
  64. package/dist/preview/{chunk.7OLVQ2FZ.js → chunk.MWZK3HVG.js} +1 -1
  65. package/dist/preview/{chunk.QNGFBJWP.js → chunk.NH5TDAB2.js} +1 -1
  66. package/dist/preview/{chunk.7UQOXYJX.js → chunk.NORRCKGN.js} +1 -1
  67. package/dist/preview/{chunk.LJE5J3JK.js → chunk.NPX7SPXM.js} +1 -1
  68. package/dist/preview/chunk.NQQHOSOK.js +1 -0
  69. package/dist/preview/chunk.NWWMUOZM.js +1 -0
  70. package/dist/preview/{chunk.X2OLXTRL.js → chunk.OE4QOBJF.js} +1 -1
  71. package/dist/preview/chunk.OEF3GPRM.js +1 -0
  72. package/dist/preview/{chunk.LYJXX6BU.js → chunk.OS3L4ZOF.js} +1 -1
  73. package/dist/preview/chunk.OTL3Z345.js +1 -0
  74. package/dist/preview/{chunk.3KJQXYCA.js → chunk.P3UPCI23.js} +1 -1
  75. package/dist/preview/chunk.PGKIEDYV.js +9 -0
  76. package/dist/preview/{chunk.H4LFJPDV.js → chunk.PKUWET2F.js} +1 -1
  77. package/dist/preview/chunk.POHEWJKZ.js +1 -0
  78. package/dist/preview/chunk.PUBG2L6F.js +117 -0
  79. package/dist/preview/chunk.QT4XGC5Z.js +344 -0
  80. package/dist/preview/chunk.QTTBZJ6W.js +1 -0
  81. package/dist/preview/{chunk.FGYCYLUS.js → chunk.QYRPELLU.js} +1 -1
  82. package/dist/preview/chunk.RJDZOF2L.js +1 -0
  83. package/dist/preview/{chunk.MJLUAGEV.js → chunk.ROGYDMES.js} +1 -1
  84. package/dist/preview/{chunk.UCVZG7S4.js → chunk.RVJYEOFN.js} +1 -1
  85. package/dist/preview/{chunk.EKUAI5YL.js → chunk.RZVZG2BQ.js} +1 -1
  86. package/dist/preview/{chunk.CV4CBHFT.js → chunk.SGB6IMWN.js} +1 -1
  87. package/dist/preview/chunk.SGLJTSTD.js +1 -0
  88. package/dist/preview/{chunk.G7S7GLDK.js → chunk.SITFEJES.js} +1 -1
  89. package/dist/preview/{chunk.WVEKYJSI.js → chunk.SZWX56WR.js} +6 -6
  90. package/dist/preview/{chunk.5JPRRV47.js → chunk.TKSGC6XH.js} +1 -1
  91. package/dist/preview/chunk.TOWYHWPB.js +17 -0
  92. package/dist/preview/{chunk.TXS4I326.js → chunk.UF3L6FJO.js} +1 -1
  93. package/dist/preview/chunk.UXIFQIHA.js +2 -0
  94. package/dist/preview/{chunk.SZMWJHU2.js → chunk.V2NBJDAX.js} +1 -1
  95. package/dist/preview/{chunk.CGQLE7JW.js → chunk.V5ZT5NSJ.js} +1 -1
  96. package/dist/preview/chunk.VKHKYK5L.js +1 -0
  97. package/dist/preview/{chunk.TN4GY6LW.js → chunk.VNBR4DHD.js} +1 -1
  98. package/dist/preview/chunk.VSYHU5MA.js +1 -0
  99. package/dist/preview/{chunk.ELY2RMGE.js → chunk.VTWFVPKD.js} +1 -1
  100. package/dist/preview/chunk.VV4BPOIK.js +1 -0
  101. package/dist/preview/chunk.W2HCJQVK.js +32 -0
  102. package/dist/preview/{chunk.BA3REPV5.js → chunk.WERYQENC.js} +1 -1
  103. package/dist/preview/{chunk.6DYZBDWT.js → chunk.WG5NIR23.js} +1 -1
  104. package/dist/preview/{chunk.HBBVVALN.js → chunk.WLPTY4BF.js} +5 -5
  105. package/dist/preview/chunk.XHWL7QBF.js +1 -0
  106. package/dist/preview/chunk.XM3NPZLP.js +1 -0
  107. package/dist/preview/chunk.YAXZNQY6.js +1 -0
  108. package/dist/preview/chunk.YG423NEB.js +1 -0
  109. package/dist/preview/{chunk.74DXEKUV.js → chunk.YPY5BOEI.js} +1 -1
  110. package/dist/preview/{chunk.RPOYSIVQ.js → chunk.YUJG5SN5.js} +1 -1
  111. package/dist/preview/chunk.YVR3ZMTV.js +1 -0
  112. package/dist/preview/chunk.YXH3IWNR.js +1 -0
  113. package/dist/preview/{chunk.4NCXMVPY.js → chunk.Z3ZKYSPN.js} +1 -1
  114. package/dist/preview/{chunk.TRLVFHFT.js → chunk.ZLXPIEUC.js} +2 -2
  115. package/dist/preview/{chunk.UV2TSAB4.js → chunk.ZRQI5VJF.js} +1 -1
  116. package/dist/preview/chunk.ZYCNEOAQ.js +1 -0
  117. package/dist/preview/index.html +43 -42
  118. package/dist/preview/page.js +7 -7
  119. package/package.json +6 -6
  120. package/dist/preview/chunk.24E4R4ZH.js +0 -1
  121. package/dist/preview/chunk.2JF254FO.js +0 -9
  122. package/dist/preview/chunk.2TDB4D6Y.js +0 -1
  123. package/dist/preview/chunk.3IVVXVG7.js +0 -1
  124. package/dist/preview/chunk.57XTDW57.js +0 -1
  125. package/dist/preview/chunk.5EXYDBAL.js +0 -88
  126. package/dist/preview/chunk.67PVRVAC.js +0 -1
  127. package/dist/preview/chunk.6SK2K72G.js +0 -1
  128. package/dist/preview/chunk.76QUEWYD.js +0 -1
  129. package/dist/preview/chunk.AHC4EXLW.js +0 -3
  130. package/dist/preview/chunk.CYPTJNES.js +0 -1
  131. package/dist/preview/chunk.D2ILIAND.js +0 -1
  132. package/dist/preview/chunk.DLCFCMKX.js +0 -1
  133. package/dist/preview/chunk.DMUUYZ37.js +0 -1
  134. package/dist/preview/chunk.DNNL7F3P.js +0 -25
  135. package/dist/preview/chunk.FEPYKPZE.js +0 -1
  136. package/dist/preview/chunk.FFW6XWHB.js +0 -17
  137. package/dist/preview/chunk.GXPBRYSR.js +0 -1
  138. package/dist/preview/chunk.HCK4Y6C5.js +0 -1
  139. package/dist/preview/chunk.HSRGYZOR.js +0 -1
  140. package/dist/preview/chunk.IHBIRAC4.js +0 -2
  141. package/dist/preview/chunk.IWK5QL6P.js +0 -1
  142. package/dist/preview/chunk.J2HQEUYA.js +0 -1
  143. package/dist/preview/chunk.JFLUVZNW.js +0 -1
  144. package/dist/preview/chunk.LPJY6V5D.js +0 -1
  145. package/dist/preview/chunk.LVLAS5GL.js +0 -1
  146. package/dist/preview/chunk.LVNAB2BW.js +0 -27
  147. package/dist/preview/chunk.MKPJKZAP.js +0 -1
  148. package/dist/preview/chunk.MMBMVHIG.js +0 -1
  149. package/dist/preview/chunk.NNNVB6RV.js +0 -1
  150. package/dist/preview/chunk.NV6IZJKA.js +0 -1
  151. package/dist/preview/chunk.O6KNGFWH.js +0 -1
  152. package/dist/preview/chunk.PMK73A53.js +0 -1
  153. package/dist/preview/chunk.PQPZZ7ZW.js +0 -117
  154. package/dist/preview/chunk.QMZUKAPJ.js +0 -1
  155. package/dist/preview/chunk.QXARGANF.js +0 -341
  156. package/dist/preview/chunk.TX5QIZEP.js +0 -1
  157. package/dist/preview/chunk.U4URQDC5.js +0 -1
  158. package/dist/preview/chunk.VUKHDZNI.js +0 -1
  159. package/dist/preview/chunk.VX7MGVP5.js +0 -1
  160. package/dist/preview/chunk.WLV2QYTS.js +0 -1
  161. package/dist/preview/chunk.WNKRXL3O.js +0 -1
  162. package/dist/preview/chunk.XWJ2MRQF.js +0 -1
  163. package/dist/preview/chunk.Y44TR4WG.js +0 -1
  164. package/dist/preview/chunk.ZB7GV3IT.js +0 -1
  165. package/dist/preview/chunk.ZOT4V66Q.js +0 -3
  166. package/dist/preview/chunk.ZYPCE2LZ.js +0 -1
@@ -1,2 +1,2 @@
1
- import{a as J,b as We}from"./chunk.5A4AOFOA.js";import"./chunk.KSXB4LDF.js";import"./chunk.YNJOLOFG.js";import"./chunk.5JPRRV47.js";import{i as $e,j as Re,k as Le}from"./chunk.HYAKRLPT.js";import"./chunk.IHBIRAC4.js";import"./chunk.QJYALCIW.js";import"./chunk.6SK2K72G.js";import"./chunk.NNNVB6RV.js";import"./chunk.HJCQ6I3S.js";import"./chunk.AWRS6TUN.js";import"./chunk.KAWP4RNR.js";import"./chunk.UPBUF7KR.js";import"./chunk.FGYCYLUS.js";import"./chunk.NZJZIYDK.js";import"./chunk.3V2M3S4U.js";import"./chunk.EKUAI5YL.js";import"./chunk.GMZAQGH7.js";import{a as Pe,b as k}from"./chunk.57XTDW57.js";import"./chunk.WNMLA4YW.js";import"./chunk.VUKHDZNI.js";import{b as ze,c as Ee}from"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.SZMWJHU2.js";import"./chunk.YFW5BF6J.js";import"./chunk.QYWBQ5NX.js";import"./chunk.ENJKCSNX.js";import"./chunk.LJE5J3JK.js";import"./chunk.X2OLXTRL.js";import"./chunk.JDRM6XXD.js";import{u as Ie}from"./chunk.GXPBRYSR.js";import"./chunk.NV6IZJKA.js";import"./chunk.OJGHDWI6.js";import{g as Ce}from"./chunk.7OLVQ2FZ.js";import"./chunk.NOZEHLWG.js";import{c as Me}from"./chunk.UVLPVHID.js";import{m as He}from"./chunk.QXARGANF.js";import{F as tt,Q as Se,Y as N,i as xe,na as Q,sa as Ae,v as ke,wa as Te}from"./chunk.DNNL7F3P.js";import{Ub as ye,Vb as we,ja as K,ka as W,qc as be,tb as ve}from"./chunk.HBBVVALN.js";import{b as G}from"./chunk.AJZBJBMO.js";var o=G(tt(),1);var t=G(Se(),1);function mt(d,r,a){let p=r.on??r.about[r.about.length-1];$e(d,r.about,{...a,pins:J(),...p===void 0?{}:{focus:p}})}function ft({placement:d="float",chosen:r=!0}={}){let{menuAt:a}=N();return d==="menu"&&a===null?r?(0,t.jsx)(nt,{}):null:(0,t.jsx)(it,{placement:d})}function nt(){let{store:d,setMenuAt:r,view:a}=N(),{selection:p}=Q(),h=(0,o.useRef)(null),[H,v]=(0,o.useState)(null);(0,o.useLayoutEffect)(()=>{let b=h.current?.offsetParent??h.current?.parentElement;if(!b)return;let m=Math.round(b.getBoundingClientRect().width);m!==H&&v(m)});let y=p.length===1&&!a.overview?d.graph.getNode(p[0]):void 0;return!y||H===null||H>=De?(0,t.jsx)("span",{ref:h,hidden:!0}):(0,t.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${k(d,y.id)}`,"aria-haspopup":"menu",onClick:b=>{let m=b.currentTarget.getBoundingClientRect();r({x:Math.round(m.right),y:Math.round(m.bottom+4),on:y.id})},style:{position:"absolute",right:"calc(14px + var(--graview-dock, 0px))",top:98,zIndex:"var(--graview-layer-overview, 10)",minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var De=564;function it({placement:d}){let{store:r,menuAt:a,setMenuAt:p,view:h,signIn:H}=N(),v=(0,o.useRef)(null),y=(0,o.useRef)(null),b=(0,o.useRef)(null),m=(0,o.useRef)(null);a?.returnTo&&(m.current=a.returnTo);let Oe=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),n=e.getAttribute("data-pin-for"),g=i??e.getAttribute("data-affordance")??(n===null?null:`pin:${n}`)??e.getAttribute("data-menu-item");y.current=g===null?null:{key:g,element:e}};(0,o.useEffect)(()=>{let e=v.current,i=y.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let n=i.key;if(!e){y.current=null;let I=m.current;m.current=null,(I?.isConnected?I:b.current)?.focus();return}((n.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(n.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(n)}"]:not([disabled])`)??e).focus()});let[Fe,qe]=(0,o.useState)(null);(0,o.useLayoutEffect)(()=>{let e=v.current?.offsetParent??v.current?.parentElement;if(e instanceof HTMLElement&&(b.current=e),!e)return;let i=e.getBoundingClientRect();qe(n=>n&&n.left===i.left&&n.top===i.top&&n.width===i.width&&n.height===i.height?n:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Be,set:je,clear:_e}=Q(),s=a?.about??Be,[D,Ue]=(0,o.useState)(()=>J()),O=a?.on??s[s.length-1],F=a?.about,Ve=(0,o.useMemo)(()=>({pins:D,...O===void 0?{}:{focus:O},...F?{about:F}:{}}),[D,O,F]),Ye=(0,o.useMemo)(()=>new Set(r.allMutations().filter(e=>e.pinned).map(e=>e.name)),[r]),{affordances:c,withheld:X,observations:Z}=Re(Ve),M=we(X,H),f=M?rt:X,Ge=a===null?null:{face:a.face??"scene",on:a.on,about:s,field:a.field,place:a.place,href:a.href,act:a.act,element:a.returnTo},ee=Ie(Ge),te=Z.some(e=>e.id.startsWith("schema:waits:")),{apply:Ke,preview:Qe}=Le(),[C,z]=(0,o.useState)(null),[Je,ne]=(0,o.useState)(!1),[ie,re]=(0,o.useState)(!1),[P,$]=(0,o.useState)(""),[ae,q]=(0,o.useState)(null),B=(0,o.useRef)([]),j=(e,i)=>{try{return Qe(e,i),Ke(e,i),q(null),p(null),B.current=[],!0}catch(n){return q(Ce(r.schema,r.allMutations(),n)),B.current=n instanceof ve?n.issues.map(g=>String(g.path[0]??"")).filter(Boolean):[],!1}},R=[...new Set(s.flatMap(e=>{let i=r.graph.getNode(e);return i?[i.kind]:[]}))],x=R.length>0?R:[...new Set(s.flatMap(e=>ke(e)))],u=s.length===1?xe(s[0]):null,_=u?{from:r.graph.getNode(u.from),to:r.graph.getNode(u.to)}:null,oe=u?Ee(r,u):void 0,le=oe?.provisional?oe:void 0,se=u?(()=>{let e=r.schema.tryDefinition(r.graph.getNode(u.from)?.kind??"")?.edges?.[u.kind],i=r.graph.getNode(u.to);return e?.inverse&&i?`From ${k(r,i.id)}: ${e.inverse}`:null})():null;(0,o.useEffect)(()=>{z(null),ne(!1),re(!1),q(null),$("")},[s,a?.about]);let l=a!==null,Xe=d==="menu"&&!l,S=(0,o.useRef)(a);S.current=a;let de=Te("acts",{open:l&&d==="menu",onOpenChange:e=>{e||p(null)},at:()=>S.current?{x:S.current.x,y:S.current.y}:null,returnTo:()=>{let e=S.current?.returnTo;if(e?.isConnected)return e;let i=S.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),ue=(Fe?.width??Number.POSITIVE_INFINITY)<De;if((0,o.useLayoutEffect)(()=>{let e=v.current?.offsetParent;if(!e||!ue||l)return;let i=v.current?.getBoundingClientRect().height??0,n=`${Math.round(i)+20}px`;if(e.style.paddingBottom===n)return;let g=e.style.paddingBottom;return e.style.paddingBottom=n,()=>{e.style.paddingBottom=g}}),s.length===0&&!l)return null;let pe=a?.title!==void 0||s.length>0&&!(s.length===1&&s[0]===h.focusId),ce=Math.max(1,Math.min(9,c.length)),A=[...c.filter(e=>e.provider==="invariant"&&!e.destructive),...c.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...c.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...c.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...c.filter(e=>e.destructive)],ge=A.length>ce&&!l,he=P.trim().toLowerCase(),w=ge&&he.length>0?A.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(he)):null,U=w??(Je||l?A:A.slice(0,ce)),me=w?0:A.length-U.length,L=[];for(let e of U){let i=!l&&e.provider==="invariant",n=!l&&!i&&e.pinned!==void 0&&!e.destructive,g=!l&&!i&&!n&&e.ties===!0&&!e.destructive,I=i?e.why:n?"pinned":g?"its ties":null,et=i?"violation":n||g?"ties":null,Y=L[L.length-1];Y&&Y.heading===I?Y.items.push(e):L.push({heading:I,tone:et,items:[e]})}let V=c.find(e=>e.id===C),E=s.length===1?k(r,s[0]):null,fe=e=>{if(!E)return e;let i=e.startsWith(`"${E}"`)?e.slice(E.length+2):e.startsWith(E)?e.slice(E.length):null;if(i===null)return e;let n=i.trimStart();return n.length===0?e:n[0].toUpperCase()+n.slice(1)},Ze=new Set(l?[]:U.filter(e=>e.provider==="invariant").map(e=>e.why)),T=Z.filter(e=>!Ze.has(e.text)).map(e=>({...e,text:fe(e.text)}));return Xe?null:(0,t.jsxs)("section",{...l?de.pane:{},ref:e=>{v.current=e,l&&de.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":l?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>Oe(e.target),onBlur:e=>{e.relatedTarget!==null&&(y.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...l?Ae:{position:"absolute",zIndex:be("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...l?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:ue?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:h.overview?"min(296px, 38cqh)":44,width:236,maxHeight:h.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,t.jsx)("h2",{style:{...He,margin:0},children:"Inspector"}),(0,t.jsxs)("div",{style:{display:pe||!l?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:l?0:24},children:[pe?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:a?.title??(s.length===1?k(r,s[0]):`${s.length} selected`)}),R.length>0||u?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:u?"relation":R.map(e=>W(r.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,s.length===1&&!u&&a?.face!=="pages"?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:h.expanded.includes(s[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,t.jsx)("span",{style:{flex:"1 1 auto"}})]}),l?null:(0,t.jsx)("button",{type:"button",onClick:()=>{p(null),_e()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),u&&_?(0,t.jsxs)("div",{style:{display:"grid",gap:6},children:[se?(0,t.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:se}):null,le?(0,t.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:ze(le)}):null,(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",_.from],["to",_.to]].map(([e,i],n)=>(0,t.jsxs)(o.Fragment,{children:[n===1?(0,t.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,t.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>je([i.id]),title:`Select ${k(r,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:k(r,i.id)}):(0,t.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!u&&s.length===1&&ye(r,s[0])?(0,t.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,T.length>0?(0,t.jsx)("div",{"data-testid":"observations",title:T.map(e=>e.text).join(`
1
+ import{a as J,b as We}from"./chunk.5A4AOFOA.js";import"./chunk.KSXB4LDF.js";import"./chunk.DL637Q3W.js";import{i as $e,j as Re,k as Le}from"./chunk.L73VUBXN.js";import"./chunk.6ONRWFA6.js";import"./chunk.HJCQ6I3S.js";import"./chunk.GZ3IXNA4.js";import"./chunk.FMVWXSQ7.js";import"./chunk.TKSGC6XH.js";import"./chunk.IM7LXLIB.js";import"./chunk.IEDXW36H.js";import{a as Pe,b as k}from"./chunk.7RSZMIAL.js";import"./chunk.6IHXTT6Z.js";import"./chunk.OEF3GPRM.js";import"./chunk.33GN2NUT.js";import"./chunk.2VIGF4FO.js";import"./chunk.5MSO3KRO.js";import"./chunk.QYRPELLU.js";import"./chunk.FTJBW25J.js";import{b as ze,c as Ee}from"./chunk.UT6642FC.js";import"./chunk.MCVY6RRS.js";import"./chunk.RZVZG2BQ.js";import"./chunk.TI4OSTQV.js";import"./chunk.V2NBJDAX.js";import"./chunk.2EJAIT33.js";import"./chunk.EUGWV3S6.js";import"./chunk.6XJP7F3I.js";import"./chunk.NPX7SPXM.js";import"./chunk.OE4QOBJF.js";import"./chunk.74RMHUCX.js";import{u as Ie}from"./chunk.I3SQJ2L2.js";import"./chunk.OJGHDWI6.js";import"./chunk.FUJM7GDV.js";import{g as Ce}from"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import{c as Me}from"./chunk.GR5Q4HTW.js";import{m as He}from"./chunk.QT4XGC5Z.js";import{$ as N,Ba as Te,H as tt,S as Se,i as xe,sa as Q,v as ke,xa as Ae}from"./chunk.MQ7FNHXG.js";import{Ub as ye,Vb as we,ja as K,ka as W,qc as be,tb as ve}from"./chunk.WLPTY4BF.js";import{b as G}from"./chunk.AJZBJBMO.js";var o=G(tt(),1);var t=G(Se(),1);function mt(d,r,a){let p=r.on??r.about[r.about.length-1];$e(d,r.about,{...a,pins:J(),...p===void 0?{}:{focus:p}})}function ft({placement:d="float",chosen:r=!0}={}){let{menuAt:a}=N();return d==="menu"&&a===null?r?(0,t.jsx)(nt,{}):null:(0,t.jsx)(it,{placement:d})}function nt(){let{store:d,setMenuAt:r,view:a}=N(),{selection:p}=Q(),h=(0,o.useRef)(null),[H,v]=(0,o.useState)(null);(0,o.useLayoutEffect)(()=>{let b=h.current?.offsetParent??h.current?.parentElement;if(!b)return;let m=Math.round(b.getBoundingClientRect().width);m!==H&&v(m)});let y=p.length===1&&!a.overview?d.graph.getNode(p[0]):void 0;return!y||H===null||H>=De?(0,t.jsx)("span",{ref:h,hidden:!0}):(0,t.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${k(d,y.id)}`,"aria-haspopup":"menu",onClick:b=>{let m=b.currentTarget.getBoundingClientRect();r({x:Math.round(m.right),y:Math.round(m.bottom+4),on:y.id})},style:{position:"absolute",right:"calc(14px + var(--graview-dock, 0px))",top:98,zIndex:"var(--graview-layer-overview, 10)",minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)"},children:"Acts\u2026"})}var De=564;function it({placement:d}){let{store:r,menuAt:a,setMenuAt:p,view:h,signIn:H}=N(),v=(0,o.useRef)(null),y=(0,o.useRef)(null),b=(0,o.useRef)(null),m=(0,o.useRef)(null);a?.returnTo&&(m.current=a.returnTo);let Oe=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),n=e.getAttribute("data-pin-for"),g=i??e.getAttribute("data-affordance")??(n===null?null:`pin:${n}`)??e.getAttribute("data-menu-item");y.current=g===null?null:{key:g,element:e}};(0,o.useEffect)(()=>{let e=v.current,i=y.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let n=i.key;if(!e){y.current=null;let I=m.current;m.current=null,(I?.isConnected?I:b.current)?.focus();return}((n.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(n.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(n)}"]:not([disabled])`)??e).focus()});let[Fe,qe]=(0,o.useState)(null);(0,o.useLayoutEffect)(()=>{let e=v.current?.offsetParent??v.current?.parentElement;if(e instanceof HTMLElement&&(b.current=e),!e)return;let i=e.getBoundingClientRect();qe(n=>n&&n.left===i.left&&n.top===i.top&&n.width===i.width&&n.height===i.height?n:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Be,set:je,clear:_e}=Q(),s=a?.about??Be,[D,Ue]=(0,o.useState)(()=>J()),O=a?.on??s[s.length-1],F=a?.about,Ve=(0,o.useMemo)(()=>({pins:D,...O===void 0?{}:{focus:O},...F?{about:F}:{}}),[D,O,F]),Ye=(0,o.useMemo)(()=>new Set(r.allMutations().filter(e=>e.pinned).map(e=>e.name)),[r]),{affordances:c,withheld:X,observations:Z}=Re(Ve),M=we(X,H),f=M?rt:X,Ge=a===null?null:{face:a.face??"scene",on:a.on,about:s,field:a.field,place:a.place,href:a.href,act:a.act,element:a.returnTo},ee=Ie(Ge),te=Z.some(e=>e.id.startsWith("schema:waits:")),{apply:Ke,preview:Qe}=Le(),[C,z]=(0,o.useState)(null),[Je,ne]=(0,o.useState)(!1),[ie,re]=(0,o.useState)(!1),[P,$]=(0,o.useState)(""),[ae,q]=(0,o.useState)(null),B=(0,o.useRef)([]),j=(e,i)=>{try{return Qe(e,i),Ke(e,i),q(null),p(null),B.current=[],!0}catch(n){return q(Ce(r.schema,r.allMutations(),n)),B.current=n instanceof ve?n.issues.map(g=>String(g.path[0]??"")).filter(Boolean):[],!1}},R=[...new Set(s.flatMap(e=>{let i=r.graph.getNode(e);return i?[i.kind]:[]}))],x=R.length>0?R:[...new Set(s.flatMap(e=>ke(e)))],u=s.length===1?xe(s[0]):null,_=u?{from:r.graph.getNode(u.from),to:r.graph.getNode(u.to)}:null,oe=u?Ee(r,u):void 0,le=oe?.provisional?oe:void 0,se=u?(()=>{let e=r.schema.tryDefinition(r.graph.getNode(u.from)?.kind??"")?.edges?.[u.kind],i=r.graph.getNode(u.to);return e?.inverse&&i?`From ${k(r,i.id)}: ${e.inverse}`:null})():null;(0,o.useEffect)(()=>{z(null),ne(!1),re(!1),q(null),$("")},[s,a?.about]);let l=a!==null,Xe=d==="menu"&&!l,S=(0,o.useRef)(a);S.current=a;let de=Te("acts",{open:l&&d==="menu",onOpenChange:e=>{e||p(null)},at:()=>S.current?{x:S.current.x,y:S.current.y}:null,returnTo:()=>{let e=S.current?.returnTo;if(e?.isConnected)return e;let i=S.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),ue=(Fe?.width??Number.POSITIVE_INFINITY)<De;if((0,o.useLayoutEffect)(()=>{let e=v.current?.offsetParent;if(!e||!ue||l)return;let i=v.current?.getBoundingClientRect().height??0,n=`${Math.round(i)+20}px`;if(e.style.paddingBottom===n)return;let g=e.style.paddingBottom;return e.style.paddingBottom=n,()=>{e.style.paddingBottom=g}}),s.length===0&&!l)return null;let pe=a?.title!==void 0||s.length>0&&!(s.length===1&&s[0]===h.focusId),ce=Math.max(1,Math.min(9,c.length)),A=[...c.filter(e=>e.provider==="invariant"&&!e.destructive),...c.filter(e=>e.pinned&&e.provider!=="invariant"&&!e.destructive),...c.filter(e=>!e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...c.filter(e=>e.ties&&!e.destructive&&!e.pinned&&e.provider!=="invariant"),...c.filter(e=>e.destructive)],ge=A.length>ce&&!l,he=P.trim().toLowerCase(),w=ge&&he.length>0?A.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(he)):null,U=w??(Je||l?A:A.slice(0,ce)),me=w?0:A.length-U.length,L=[];for(let e of U){let i=!l&&e.provider==="invariant",n=!l&&!i&&e.pinned!==void 0&&!e.destructive,g=!l&&!i&&!n&&e.ties===!0&&!e.destructive,I=i?e.why:n?"pinned":g?"its ties":null,et=i?"violation":n||g?"ties":null,Y=L[L.length-1];Y&&Y.heading===I?Y.items.push(e):L.push({heading:I,tone:et,items:[e]})}let V=c.find(e=>e.id===C),E=s.length===1?k(r,s[0]):null,fe=e=>{if(!E)return e;let i=e.startsWith(`"${E}"`)?e.slice(E.length+2):e.startsWith(E)?e.slice(E.length):null;if(i===null)return e;let n=i.trimStart();return n.length===0?e:n[0].toUpperCase()+n.slice(1)},Ze=new Set(l?[]:U.filter(e=>e.provider==="invariant").map(e=>e.why)),T=Z.filter(e=>!Ze.has(e.text)).map(e=>({...e,text:fe(e.text)}));return Xe?null:(0,t.jsxs)("section",{...l?de.pane:{},ref:e=>{v.current=e,l&&de.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":l?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>Oe(e.target),onBlur:e=>{e.relatedTarget!==null&&(y.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...l?Ae:{position:"absolute",zIndex:be("rail")},boxSizing:"border-box",display:"flex",flexDirection:"column",gap:7,padding:"9px 12px",borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",...l?{width:300,maxHeight:"min(52cqh, 420px)",overflow:"auto"}:ue?{left:10,right:10,width:"auto",bottom:10,maxHeight:"min(42cqh, 300px)",overflow:"auto"}:{left:14,top:h.overview?"min(296px, 38cqh)":44,width:236,maxHeight:h.overview?"calc(100cqh - min(296px, 38cqh) - 20px)":"calc(68cqh - 94px)",overflow:"auto"}},children:[(0,t.jsx)("h2",{style:{...He,margin:0},children:"Inspector"}),(0,t.jsxs)("div",{style:{display:pe||!l?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:l?0:24},children:[pe?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:a?.title??(s.length===1?k(r,s[0]):`${s.length} selected`)}),R.length>0||u?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:u?"relation":R.map(e=>W(r.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,s.length===1&&!u&&a?.face!=="pages"?(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:h.expanded.includes(s[0])?"\xB7 double-click closes":"\xB7 double-click opens"}):null]}):null,(0,t.jsx)("span",{style:{flex:"1 1 auto"}})]}),l?null:(0,t.jsx)("button",{type:"button",onClick:()=>{p(null),_e()},"aria-label":"Clear selection",title:"Clear selection",style:{position:"absolute",top:6,right:6,flex:"0 0 auto",width:24,height:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.875rem",lineHeight:1,borderRadius:7},children:"\xD7"}),u&&_?(0,t.jsxs)("div",{style:{display:"grid",gap:6},children:[se?(0,t.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:se}):null,le?(0,t.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:ze(le)}):null,(0,t.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",_.from],["to",_.to]].map(([e,i],n)=>(0,t.jsxs)(o.Fragment,{children:[n===1?(0,t.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,t.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>je([i.id]),title:`Select ${k(r,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:k(r,i.id)}):(0,t.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!u&&s.length===1&&ye(r,s[0])?(0,t.jsx)("p",{"data-testid":"left-alone",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:"Left alone: nothing automated changes it."}):null,T.length>0?(0,t.jsx)("div",{"data-testid":"observations",title:T.map(e=>e.text).join(`
2
2
  `),style:{display:"grid",gap:3},children:T.slice(0,2).map(e=>(0,t.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===T[1]&&T.length>2?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",T.length-2]}):null]},e.id))}):null,l?ee.start.map(e=>(0,t.jsx)(Ne,{section:e,close:()=>p(null)},e.id)):null,ae?(0,t.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:ae}):null,ge?(0,t.jsx)("input",{"data-testid":"action-filter",value:P,onChange:e=>$(e.target.value),placeholder:`Filter ${A.length} actions\u2026`,"aria-label":"Filter actions",onKeyDown:e=>{if(e.key==="Escape"){e.stopPropagation(),P.length>0?$(""):e.currentTarget.blur();return}if(e.key==="Enter"&&w?.length===1){let i=w[0];if(i.destructive)return;i.open.length>0?z(i.id):j(i)&&$("")}},style:{font:"inherit",fontSize:"0.875rem",padding:"5px 9px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):null,w!==null&&w.length===0?(0,t.jsxs)("p",{"data-testid":"no-matches",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:["Nothing offered here matches \u201C",P.trim(),"\u201D."]}):null,M&&c.length===0||c.length===0&&!te&&s.length===0?null:c.length===0&&!te?(0,t.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:f.length>0?`Nothing you may do with ${u?"this relation":x.length===1?K(W(r.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} \u2014 ${f.length} action${f.length===1?"":"s"} withheld.`:u?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${Me(r.schema,r.graph.getNode(u.from)?.kind??"",u.kind,"out")}\u201D.`:`Nothing can be done with ${x.length===1?K(W(r.schema.tryDefinition(x[0]),x[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${x.length===1?"it":"them"}.`}):(0,t.jsxs)("ol",{"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[L.map((e,i)=>(0,t.jsxs)(o.Fragment,{children:[e.heading?(0,t.jsxs)("li",{"data-graview-heading":e.tone,style:{fontSize:"0.75rem",lineHeight:1.4,color:e.tone==="violation"?"var(--graview-warn)":"var(--graview-ink-faint)",...e.tone!=="violation"?{letterSpacing:"0.12em",textTransform:"uppercase",fontSize:"0.75rem"}:{},padding:"2px 2px 1px",marginTop:i>0?6:0},children:[e.tone==="violation"?"\u26A0 ":"",e.tone==="violation"?fe(e.heading):e.heading]}):i>0?(0,t.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},children:[(0,t.jsxs)("button",{type:"button","data-affordance":n.id,"data-rank":n.rank,"data-graview-destructive":n.destructive||void 0,"aria-pressed":C===n.id,title:n.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:C===n.id?"var(--graview-accent)":l?"transparent":"var(--graview-edge)",background:l?"none":"var(--graview-panel)",boxShadow:"none",...n.destructive?{color:"var(--graview-warn)"}:{},...C===n.id?{color:"var(--graview-accent)"}:{}},onClick:()=>{if(n.open.length>0){z(C===n.id?null:n.id);return}j(n)},children:[n.label,n.open.length>0?(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,w?.length===1&&w[0]?.id===n.id&&!n.destructive?(0,t.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,t.jsx)("button",{type:"button","data-testid":"pin-toggle","data-pin-for":n.mutation,"aria-pressed":n.pinned!==void 0,"aria-label":n.pinned!==void 0?`Unpin ${n.label}`:`Pin ${n.label}`,title:n.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":n.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>Ue(We(D,n.mutation,Ye.has(n.mutation))),style:{flex:"0 0 auto",width:24,minHeight:24,display:"grid",placeItems:"center",padding:0,fontSize:"0.75rem",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7,color:n.pinned==="user"?"var(--graview-accent)":n.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:n.pinned!==void 0?"\u2605":"\u2606"})]},n.id))]},`${e.heading??"plain"}-${i}`)),me>0?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button",onClick:()=>ne(!0),title:`Show all ${c.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",me," more"]})}):null]}),M?(0,t.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>{p(null),M.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left"},children:M.label}):null,f.length>0?(0,t.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[f.slice(0,l||ie?f.length:3).map(e=>(0,t.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,t.jsx)("button",{type:"button",disabled:!0,"data-affordance":e.id,"data-rank":e.rank,"data-withheld":e.refusal.wouldNeed.join(",")||"nobody",style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8,borderStyle:"dashed",width:"100%",textAlign:"left",background:"none"},children:(0,t.jsx)("s",{children:e.label})}),(0,t.jsx)("span",{"data-testid":"withheld-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:e.refusal.message})]},e.id)),!l&&!ie&&f.length>3?(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>re(!0),title:`Show all ${f.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",f.length-3," more withheld"]})}):null]}):null,l?ee.end.map(e=>(0,t.jsx)(Ne,{section:e,close:()=>p(null)},e.id)):null,V?(0,t.jsx)(Pe,{affordance:V,onApply:e=>{if(j(V,e))z(null);else return B.current},onCancel:()=>z(null)}):null]})}var rt=[];function Ne({section:d,close:r}){return(0,t.jsxs)("div",{"data-menu-section":d.id,...d.heading?{role:"group","aria-label":d.heading}:{},style:{display:"grid",gap:2,borderTop:"1px solid var(--graview-edge)",paddingTop:5},children:[d.heading?(0,t.jsx)("p",{"aria-hidden":"true",style:{margin:0,padding:"2px 2px 1px",fontSize:"0.75rem",lineHeight:1.4,letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:d.heading}):null,d.items&&d.items.length>0?(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:d.items.map(a=>(0,t.jsx)("li",{children:(0,t.jsxs)("button",{type:"button","data-menu-item":a.id,onClick:()=>{r(),a.run()},style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},children:[a.label,a.hint?(0,t.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",a.hint]}):null]})},a.id))}):null,d.render?.(r)]})}export{ft as InspectorPane,mt as prepareActs};
@@ -0,0 +1 @@
1
+ import{A as J,C as Q,E as X,I as Y,K as ee,N as ne,a as I,i as Z,l as z,p as D,s as W,t as _,x as j,y as U}from"./chunk.QT4XGC5Z.js";import{$ as T,H as se,S as N,ba as $,na as G,pa as K,wa as q}from"./chunk.MQ7FNHXG.js";import{Ic as V,Xb as M,ec as P,gc as O}from"./chunk.WLPTY4BF.js";import{b as A}from"./chunk.AJZBJBMO.js";var o=A(se(),1);function ce(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],n=[];for(let a of t){let r=a?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!r||O(r)||r.toLowerCase()!==M.toLowerCase()&&(n.includes(r)||n.push(r))}return n}function te(e){let t=ce(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(a=>`family=${encodeURIComponent(a).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var l=A(N(),1);function Se({rootRef:e,firstLook:t,app:n}){let a=(0,o.useCallback)(()=>e.current,[e]);return t?(0,l.jsx)(ne,{firstLook:t,root:a,app:n}):null}function ve(e,t){let{app:n}=e,a=(0,o.useMemo)(()=>{let r=Y(t(n.schema,n.viewSpecs),n),i=e.views?G(r,e.views(n.schema,r)):r;return ee(i,n.schema,Q(e.brand??n.brand,n.schema)),i},[e.views,n.schema,n.viewSpecs,n.lenses,n.pages,n.home]);return K(a,e.keptViews)}function de(e,t){return new V({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function re(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function le(e,t){let[n,a]=(0,o.useState)(()=>re(t));return(0,o.useEffect)(()=>{if(!e||typeof document>"u")return;let r=()=>a(re(t));r();let i=new MutationObserver(r);i.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let d=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return d?.addEventListener?.("change",r),()=>{i.disconnect(),d?.removeEventListener?.("change",r)}},[e,t]),n}var x=e=>e?e.getBoundingClientRect().height:0;function we(e,t,n){let a=(0,o.useRef)(n);a.current=n;let r=n!==void 0;(0,o.useLayoutEffect)(()=>{let i=e.current;if(!i||!r)return;let d=()=>{let u=[...i.children],b=u.find(S=>S.hasAttribute("data-graview-app-bar")),y=u.find(S=>S.hasAttribute("data-embed-content")),h=y?.querySelector("[data-embed-measure]")??null,c=u.find(S=>S.hasAttribute("data-graview-place-line"));return{strip:b,line:c,content:y,measure:h}},s=-1,f=()=>{let{strip:u,line:b,content:y,measure:h}=d(),c=Math.ceil(x(u)+x(b)+x(h||y));c!==s&&(s=c,a.current?.(c))};if(f(),typeof ResizeObserver>"u")return;let m=new ResizeObserver(f),E=()=>{m.disconnect();let{strip:u,line:b,content:y,measure:h}=d();for(let c of[i,u,b,y,h])c&&m.observe(c)};E();let g=new MutationObserver(()=>{E(),f()});return g.observe(i,{childList:!0}),()=>{m.disconnect(),g.disconnect()}},[e,t,r])}var Ee=480,ue=0;function Re(e){let{app:t,seed:n,scheme:a="auto",brand:r=t.brand,fonts:i=!0,height:d="100%",label:s}=e,f=(0,o.useRef)(null);q(f);let m=d==="viewport"?"100dvh":d,E=z(typeof m=="string"&&/vh\b/.test(m)),g=(0,o.useMemo)(()=>`graview-embed-${++ue}`,[]),u=(0,o.useMemo)(()=>e.store??e.remote?.store??de(t,n),[e.store,e.remote,t,n]),b=e.presence??e.remote?.presence,y=e.hostContext?.theme,h=le(a==="auto"&&y===void 0,r?.scheme),c=a==="auto"?y??h:a,S=(0,o.useMemo)(()=>I(c,r,{scope:`.${g}`}),[c,r,g]);Z(e.favicon?P(r):void 0),(0,o.useEffect)(()=>{if(!i||typeof document>"u")return;let w=te(r);if(!w||document.querySelector(`link[href="${w}"]`))return;let p=document.createElement("link");p.rel="stylesheet",p.href=w,document.head.appendChild(p)},[r,i]);let L=(0,o.useRef)(void 0);(0,o.useLayoutEffect)(()=>{let w=f.current,p=L.current;if(L.current=s,!w||!s)return;let ie=v=>{let R=v.getAttribute("aria-label")??"",k=p&&p!==s?R.startsWith(`${p} \xB7 `)?R.slice(p.length+3):R===p?"":R:R;k===s&&(v.getAttribute("role")==="region"||v.tagName==="SECTION"&&!v.hasAttribute("role"))&&v.setAttribute("role","group");let B=k.startsWith(`${s} \xB7 `)||k===s?k:k?`${s} \xB7 ${k}`:s;B!==R&&v.setAttribute("aria-label",B)},H=()=>w.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(v=>{v.hasAttribute("data-graview-named-by-lens")||ie(v)});H();let C=new MutationObserver(H);return C.observe(w,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>C.disconnect()},[s]);let ae=E?`${m}`.replace(/([\d.]+)[sdl]?vh\b/g,(w,p)=>`${+p*E/100}px`):m;return{rootRef:f,scope:g,css:S,scheme:c,store:u,presence:b,brand:r,auto:d==="auto",height:ae}}function ke({rootRef:e,board:t}){let n=(0,o.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]);return(0,l.jsx)(D,{board:t,anchor:n})}function xe(e,t,n){return{brand:n,locale:e.locale,timeZone:e.timeZone,principal:e.principal,seats:e.seats,presence:t,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,keptViews:e.keptViews,signIn:e.signIn,menuSections:e.menuSections,app:e.app}}function Ae({name:e,heading:t,faces:n,at:a,without:r,home:i,reach:d,standing:s,hostActions:f,keeping:m,onFind:E,switch:g}){let{brand:u,store:b,principal:y,views:h}=T();$();let c=r?.has("places")?[]:W({store:b,principal:y,views:h}),S=J();return(0,l.jsx)(j,{brand:u,name:e,description:u?.subtitle,heading:t,faces:n,home:i,places:c,current:a===null?null:_(c,a),reach:d,onFind:E,...g?{switch:g}:{},...n?{scenePlaces:S}:{},tools:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(X,{clean:s}),(0,l.jsx)(U,{...f?{hostActions:f}:{},...m?{keeping:m}:{}})]})})}var Fe=e=>e===!1?2:Math.min(e+1,6);function Le(e){let[t,n]=(0,o.useState)(e),a=(0,o.useRef)(void 0),r=(0,o.useRef)(void 0),i=(0,o.useMemo)(()=>({go:a,at:n,pending:r}),[]),d=(0,o.useCallback)(s=>{if(a.current){a.current(s);return}r.current=s,n(s)},[]);return{at:t,setAt:n,steering:i,steer:d}}function me(e){let t=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof t=="string"&&t.length>0?t:typeof e=="object"?"Error":typeof e}}var F=()=>typeof performance<"u"?performance.now():Date.now();function He(e,t){let n=(0,o.useRef)({onError:e,face:t});return n.current={onError:e,face:t},(0,o.useCallback)((a,r)=>n.current.onError?.(me(a),{module:r.module,face:n.current.face}),[])}function Ce(e,t){let n=(0,o.useRef)(null);n.current===null&&(n.current=F());let a=(0,o.useRef)({onReady:e,face:t});a.current={onReady:e,face:t};let r=(0,o.useRef)(!1);return(0,o.useCallback)(i=>{r.current||(r.current=!0,a.current.onReady?.({ms:Math.max(0,F()-(n.current??F())),face:i}))},[])}var oe=class extends o.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t,n){console.error(`[graview] ${this.props.module} threw while rendering`,t,n.componentStack),this.props.report(t,{module:this.props.module})}render(){return this.state.failed?(0,l.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,l.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,l.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{Se as a,ve as b,de as c,we as d,Ee as e,Re as f,ke as g,xe as h,Ae as i,Fe as j,Le as k,He as l,Ce as m,oe as n};
@@ -1 +1 @@
1
- import{a as r,b as m,d as k,e as h}from"./chunk.UGFDSE37.js";import"./chunk.QXARGANF.js";import"./chunk.DNNL7F3P.js";import"./chunk.HBBVVALN.js";import"./chunk.AJZBJBMO.js";var o="way-back",b='[data-testid="notices-toasts"]';function g(t){let a=document.activeElement;a!==null&&a!==document.body&&!a.closest(b)||(t??document).querySelector('[data-graview-app-bar] [data-testid="app-home"]')?.focus({preventScroll:!0})}function w(t,a,i,d,y){if(t.past)return i?.dismiss(o),()=>{};let c=y?.closest("[data-graview-embed]"),s,f=e=>{if(e!==void 0&&r(t,a)?.batch!==e)return!1;try{let n=k(t,a);return n&&i?.notify({kind:"toast",id:o,sentence:`Took back \u201C${n.intent}\u201D`}),n!==void 0}catch(n){return i?.notify({kind:"toast",id:o,tone:"warn",sentence:n instanceof Error?n.message:String(n)}),!0}},u=()=>{let e=m(t,a,d);if(d=t.batches().length,e){let n=s=e.batch;i?.notify({kind:"toast",id:o,sentence:e.intent,timeout:1e4,action:{label:"Take back",onSelect:()=>(g(c),f(n))}})}else s&&r(t,a)?.batch!==s&&(s=void 0,i?.dismiss(o))},l=e=>{h(e)&&(!c||c.contains(e.target))&&f()&&e.preventDefault()};u();let p=t.subscribe(u);return document.addEventListener("keydown",l),(e=!1)=>{p(),document.removeEventListener("keydown",l),e&&s&&i?.dismiss(o)}}export{w as sceneWay};
1
+ import{a as r,b as m,d as k,e as h}from"./chunk.UGFDSE37.js";import"./chunk.QT4XGC5Z.js";import"./chunk.MQ7FNHXG.js";import"./chunk.WLPTY4BF.js";import"./chunk.AJZBJBMO.js";var o="way-back",b='[data-testid="notices-toasts"]';function g(t){let a=document.activeElement;a!==null&&a!==document.body&&!a.closest(b)||(t??document).querySelector('[data-graview-app-bar] [data-testid="app-home"]')?.focus({preventScroll:!0})}function w(t,a,i,d,y){if(t.past)return i?.dismiss(o),()=>{};let c=y?.closest("[data-graview-embed]"),s,f=e=>{if(e!==void 0&&r(t,a)?.batch!==e)return!1;try{let n=k(t,a);return n&&i?.notify({kind:"toast",id:o,sentence:`Took back \u201C${n.intent}\u201D`}),n!==void 0}catch(n){return i?.notify({kind:"toast",id:o,tone:"warn",sentence:n instanceof Error?n.message:String(n)}),!0}},u=()=>{let e=m(t,a,d);if(d=t.batches().length,e){let n=s=e.batch;i?.notify({kind:"toast",id:o,sentence:e.intent,timeout:1e4,action:{label:"Take back",onSelect:()=>(g(c),f(n))}})}else s&&r(t,a)?.batch!==s&&(s=void 0,i?.dismiss(o))},l=e=>{h(e)&&(!c||c.contains(e.target))&&f()&&e.preventDefault()};u();let p=t.subscribe(u);return document.addEventListener("keydown",l),(e=!1)=>{p(),document.removeEventListener("keydown",l),e&&s&&i?.dismiss(o)}}export{w as sceneWay};
@@ -0,0 +1,9 @@
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{b as ae}from"./chunk.RJDZOF2L.js";import{a as Y,c as H,d as X,e as J}from"./chunk.AFY35RJP.js";import"./chunk.POHEWJKZ.js";import"./chunk.IEDXW36H.js";import"./chunk.7RSZMIAL.js";import"./chunk.ROGYDMES.js";import"./chunk.6IHXTT6Z.js";import"./chunk.OEF3GPRM.js";import"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.GZHZLJBF.js";import"./chunk.I3SQJ2L2.js";import"./chunk.OJGHDWI6.js";import"./chunk.FUJM7GDV.js";import"./chunk.MWZK3HVG.js";import"./chunk.3D5T3XIE.js";import"./chunk.GR5Q4HTW.js";import"./chunk.QT4XGC5Z.js";import{$ as b,Ba as U,G as V,H as q,S as x,T as F,a as N,d as W,oa as z,xa as K,y as j}from"./chunk.MQ7FNHXG.js";import{Ua as _,ba as I,da as G,ga as B,ob as D}from"./chunk.WLPTY4BF.js";import{b as w}from"./chunk.AJZBJBMO.js";var re=w(q(),1);function P(e){return{minHeight:24,padding:"3px 10px",borderRadius:6,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:e?"transparent":"var(--graview-edge)",color:e?"var(--graview-ink)":"var(--graview-ink-muted)",fontWeight:e?600:400,background:e?"color-mix(in srgb, var(--graview-accent) 16%, transparent)":"transparent"}}var M=w(x(),1);function Q(){let{seats:e,principal:t,takeSeat:i}=b();return e.length<2?null:(0,M.jsxs)("div",{role:"group","aria-label":"Seat","data-testid":"seats",style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6,rowGap:4},children:[(0,M.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.12em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"As"}),e.map(a=>{let l=ie(t,a.principal);return(0,M.jsx)("button",{type:"button","aria-pressed":l,"data-testid":`seat-${a.principal.id??a.label}`,title:`Sit down as ${a.label}: the acts, the kinds and the pages narrow to what this seat may do`,onClick:()=>i(a.principal),style:{...P(l),whiteSpace:"nowrap"},children:a.label},a.principal.id??a.label)})]})}function ie(e,t){return e.kind===t.kind&&e.id===t.id}var L=w(q(),1),c=w(x(),1),oe=`
2
+ .graview-here{display:flex;flex:none}
3
+ .graview-here>button{display:inline-flex;align-items:center;gap:4px;height:30px;margin:0;padding:0 4px;border:1px solid transparent;border-radius:8px;background:none;box-shadow:none;font:inherit;font-size:.75rem;color:var(--graview-ink-muted);cursor:pointer}
4
+ .graview-here-mark{display:inline-flex;align-items:center;justify-content:center;flex:none;box-sizing:border-box;width:24px;height:24px;border-radius:50%;border:1.5px solid hsl(var(--graview-hue) 50% 48%);background:var(--graview-panel-muted);color:var(--graview-ink);font-size:.75rem;font-weight:600;box-shadow:0 0 0 2px var(--graview-bar)}
5
+ .graview-here-mark+.graview-here-mark{margin-left:-10px}
6
+ .graview-here-mark[data-agent]{border-radius:5px}
7
+ .graview-here-mark[data-counted]{--graview-hue:0;border-color:var(--graview-edge)}
8
+ .graview-here small{display:block;font-size:.75rem;color:var(--graview-ink-muted)}
9
+ .graview-bar[data-finding] .graview-here{display:none}`,se={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function le(e,t){let i=t.id===void 0?null:`${t.kind}:${t.id}`,a=new Map;for(let l of e.values()){let d=l.participant.slice(0,l.participant.lastIndexOf(":"));if(d===i)continue;let s=d.endsWith(":")?l.participant:d,o=a.get(s);(!o||o.at<l.at)&&a.set(s,l)}return[...a.values()]}var Z=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",ee=e=>e===1?"1 viewer":`${e} viewers`;function de(e){let t=e.map(Z).filter(Boolean),i=t.length<e.length?[...t,ee(e.length-t.length)]:t,a=i.pop();return`${i.length>0?`${i.join(", ")} and ${a}`:a} ${e.length===1?"is":"are"} here`}function pe(e,t){let{store:i,hidden:a,pictures:l}=t,d=W(e),s=i.kindsKeptFrom(t.principal),o=u=>!a.has(u)&&!s.has(u)&&!i.modules.disabledKinds.has(u),g=l.find(u=>u.as===d.within?.view&&o(u.kind));if(g)return g.title;if(!d.focusId)return d.overview?"the whole thing":null;let p=j(d.focusId);if(p.length>0)return p.every(o)?p.map(u=>B(i.schema,u)).join(" and "):null;let h=i.graph.getNode(d.focusId);return h&&o(h.kind)?I(i.schema.tryDefinition(h.kind),h):null}function ce(e,t){let i=o=>o.id!==void 0&&(o.id===t.principal.id||o.onBehalfOf?.id===t.principal.id),a=e.filter(o=>!D(o)&&o.author.kind!=="system"&&!i(o.author)),l=a[0];if(!l)return null;let d=_(l.author,{graph:t.store.graph,schema:t.store.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),s=[...new Set(a.map(o=>o.intent))].join("; ");return`${d}: ${s}`}function ue(e,t,i){let a=ce(e,t);a&&(i(""),setTimeout(()=>i(a),50))}function ge({scene:e,compact:t}){let{who:i,principal:a,store:l,views:d,hiddenKinds:s,follow:o}=b(),g=U("here"),p=le(i,a),h=p.length===0?"":de(p),[u,S]=(0,L.useState)("");if((0,L.useEffect)(()=>S(h),[h]),p.length===0)return null;let f=p.filter(r=>r.name),y=f.slice(0,t?2:3),m=p.length-y.length,k=p.length-f.length,T=d.places();return(0,c.jsxs)("div",{className:"graview-here","data-testid":"here",children:[(0,c.jsx)("style",{children:oe}),(0,c.jsx)("span",{role:"status","aria-live":"polite",style:se,children:u}),(0,c.jsxs)("button",{type:"button","data-testid":"here-open",...g.trigger,onClick:g.toggle,"aria-label":`${h} \u2014 who and where`,title:h,children:[y.length>0?(0,c.jsx)("span",{style:{display:"flex"},children:y.map(r=>(0,c.jsx)(E,{one:r},r.participant))}):(0,c.jsx)(E,{count:m}),y.length>0&&m>0?(0,c.jsxs)("span",{"aria-hidden":"true",children:["+",m]}):null]}),(0,c.jsxs)("ul",{...g.pane,"aria-label":"Who is here","data-testid":"here-list",hidden:!g.open,className:"graview-bar-list",style:K,children:[f.map(r=>{let v=pe(r.stop,{store:l,principal:a,hidden:s,pictures:T}),A=Z(r);return(0,c.jsx)("li",{children:(0,c.jsxs)(e?"button":"span",{className:"graview-bar-item","data-testid":"here-one",...e?{type:"button",title:`Go where ${A} is`,onClick:()=>{g.setOpen(!1),o(r.participant)}}:{style:{cursor:"default"}},children:[(0,c.jsx)(E,{one:r}),(0,c.jsxs)("span",{children:[A,v?(0,c.jsxs)("small",{children:["On ",v]}):null]})]})},r.participant)}),k>0?(0,c.jsx)("li",{children:(0,c.jsxs)("span",{className:"graview-bar-item","data-testid":"here-viewers",style:{cursor:"default"},children:[(0,c.jsx)(E,{count:k}),(0,c.jsxs)("span",{children:[ee(k),(0,c.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function E({one:e,count:t}){return(0,c.jsx)("span",{className:"graview-here-mark","aria-hidden":"true",...e?{style:{"--graview-hue":Math.round(e.hue)}}:{"data-counted":""},...e?.kind==="agent"?{"data-agent":""}:{},children:e?(e.name??"").trim().charAt(0).toUpperCase():t})}function he(e){let t=/^(?:place|scene):([^:]+):(.+)$/.exec(e.key);return t?{place:t[2],about:[`aggregate:${t[1]}`],title:e.label}:{about:e.group==="lists"&&e.kind?[`aggregate:${e.kind}`]:[],title:e.label}}function O(e,t,i,a,l,d){let s=he(t),o=e.getBoundingClientRect(),g={...s,face:i?"scene":"pages",x:Math.round(l??o.left+Math.min(16,o.width/2)),y:Math.round(d??Math.min(o.bottom,o.top+36)),returnTo:e},p=i?null:e.closest("[data-graview-embed], [data-graview-shell]")?.querySelector("[data-graview-face='pages']")??document.querySelector("[data-graview-face='pages']");p?p.dispatchEvent(new CustomEvent(F,{detail:g})):a(g)}var R={on:null,at:0},te=500,me=10;function ye(e,t,i,a,l,d,s){let o=t.getAttribute("data-testid")??"",g=o==="app-places-open"?a:o.slice(10),p=i.find(m=>m.key===g);if(!p)return;if(e.type==="keydown")return R={on:t,at:Date.now()},O(t,p,l,d);let{clientX:h,clientY:u}=e;if(e.type==="contextmenu")return R.on===t&&Date.now()-R.at<700?void 0:h===0&&u===0?O(t,p,l,d):O(t,p,l,d,h,u);let S=Date.now()-Math.max(0,performance.now()-e.timeStamp),f=!1,y=m=>{Math.hypot(m.clientX-h,m.clientY-u)>me&&(f=!0)};document.addEventListener("pointermove",y),setTimeout(()=>{document.removeEventListener("pointermove",y),!(f||s.at!==0&&s.at-S<te)&&(R={on:t,at:Date.now()},t.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,once:!0}),O(t,p,l,d,h,u))},Math.max(0,te-(Date.now()-S)))}var n=w(x(),1),Ie=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.LF7PU77M.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),fe=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.DQJAEU4V.js")))).part((e,t)=>(0,n.jsx)(e.HoverChipsSwitch,{...t}),{quiet:!0});function Be({violations:e,pick:t}){let{store:i,brand:a,setMenuAt:l}=b(),d=Y(i,e);return(0,n.jsx)(n.Fragment,{children:d.map((s,o)=>{let g=J(s),p=s.repairs.length>0?`${s.repairs.length} ${s.repairs.length===1?"way":"ways"} to fix`:"";return(0,n.jsx)("li",{style:{borderTop:o===0?"none":"1px solid var(--graview-edge)"},children:(0,n.jsxs)("button",{type:"button",onClick:h=>{let u=h.currentTarget.closest("ol").getBoundingClientRect();t(s),l({x:u.left,y:u.top,on:s.subjectId})},...H(s)!==void 0?{title:H(s)}:{},style:{width:"100%",textAlign:"left",fontSize:"0.8125rem",lineHeight:1.4,padding:"7px 8px",border:"1px solid transparent",background:"none",boxShadow:"none",borderRadius:7},children:[s.line?(0,n.jsx)(X,{line:s.line,schema:i.schema,...a?{brand:a}:{},stacked:!0,style:{display:"block",color:"var(--graview-ink)"}}):(0,n.jsx)("span",{style:{display:"block",color:"var(--graview-ink)"},children:s.message}),g||p?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:[g,p].filter(Boolean).join(" \xB7 ")}):null]})},`${s.invariant}:${o}`)})})}function _e({name:e,me:t,scheme:i,onScheme:a,profileHref:l,hostActions:d,close:s,part:o,signature:g=!1}){let{principal:p,seats:h,settings:u,settingValues:S,chooseSetting:f,sharing:y,ai:m}=b(),k=p.roles??[],T={setOpen:r=>s()};return(0,n.jsx)(n.Fragment,{children:o==="top"?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{style:{display:"grid",gap:3},children:[(0,n.jsx)("span",{style:$,children:"Signed in as"}),(0,n.jsx)("strong",{style:{fontSize:"1rem",fontWeight:550},children:e}),(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:k.length>0?k.map(r=>G(r)).join(", "):t===void 0?"This app has no sign-in; everything here is yours.":"No role in particular"}),t!==void 0&&l!==void 0?(0,n.jsx)("a",{href:l(t.id),"data-testid":"profile-record",style:{display:"inline-flex",alignItems:"center",minHeight:24,justifySelf:"start",fontSize:"0.875rem",color:"var(--graview-accent)"},children:"Your record \u2197"}):null,y?(0,n.jsxs)("span",{"data-testid":"profile-seen-as",style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["Seen by others as ",y.name]}):null]}),d.length>0?(0,n.jsx)("ul",{role:"list","aria-label":"From the host","data-testid":"host-actions",style:{...C,margin:0,paddingLeft:0,listStyle:"none",display:"grid",gap:2},children:d.map(r=>(0,n.jsx)("li",{children:r.href!==void 0?(0,n.jsx)("a",{href:r.href,"data-testid":"host-action",className:"graview-host-action",...r.target?{target:r.target,rel:"noopener"}:{},onClick:()=>{r.onSelect?.(),T.setOpen(!1)},style:ne,children:r.label}):(0,n.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{T.setOpen(!1),r.onSelect?.()},style:{...ne,width:"100%",textAlign:"left",border:"none",background:"none",boxShadow:"none",font:"inherit",cursor:"pointer"},children:r.label})},r.label))}):null]}):(0,n.jsxs)(n.Fragment,{children:[h.length>1?(0,n.jsxs)("div",{style:{display:"grid",gap:6,...C},children:[(0,n.jsx)("span",{style:$,children:"Sit as somebody else"}),(0,n.jsx)(Q,{})]}):null,u.length>0?(0,n.jsx)("div",{style:{display:"grid",gap:10,...C},children:u.map(r=>(0,n.jsxs)("fieldset",{"data-testid":`setting-${r.name}`,style:{border:0,margin:0,padding:0,display:"grid",gap:5},children:[(0,n.jsx)("legend",{style:{...$,padding:0},children:r.title}),r.description?(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:r.description}):null,(0,n.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:r.options.map(v=>{let A=(S[r.name]??r.initial)===v.value;return(0,n.jsx)("button",{type:"button","aria-pressed":A,"data-testid":`setting-${r.name}-${v.value}`,onClick:()=>f(r.name,v.value),style:P(A),children:v.label},v.value)})})]},r.name))}):null,V(m)?(0,n.jsx)(re.Suspense,{fallback:null,children:(0,n.jsx)(fe,{legend:$,style:C,choice:P})}):null,i!==void 0&&a!==void 0?(0,n.jsxs)("div",{style:{display:"grid",gap:5,...C},children:[(0,n.jsx)("span",{style:$,children:"Scheme"}),(0,n.jsx)("div",{style:{display:"flex",gap:4},children:["light","dark"].map(r=>(0,n.jsx)("button",{type:"button","aria-pressed":i===r,"data-testid":`profile-scheme-${r}`,onClick:()=>a(r),style:P(i===r),children:r==="light"?"\u2600 Light":"\u263E Dark"},r))})]}):null,g?(0,n.jsxs)("p",{"data-testid":"graview-signature",style:{...C,margin:0,display:"flex",alignItems:"center",gap:6,fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["Built with",(0,n.jsxs)("a",{href:"https://graview.dev",target:"_blank",rel:"noopener",style:{display:"inline-flex",alignItems:"center",gap:4,minHeight:24,color:"var(--graview-ink-muted)",fontWeight:600,textDecoration:"none"},children:[(0,n.jsx)("span",{"data-testid":"graview-mark",style:{display:"inline-flex",lineHeight:0},dangerouslySetInnerHTML:{__html:ve}}),"Graview"]})]}):null]})})}var ve='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" width="14" height="14" aria-hidden="true" focusable="false"><g fill="none" stroke="currentColor" stroke-width="2.4" stroke-linejoin="round"><path d="M13 11 L3 8 L14 3 H29 L21 9"/><path d="M10 18 L3 23 L16.5 28 L29 21 L22 19"/><path d="M16.5 18.5 V23.5" stroke-linecap="round"/></g><circle cx="16.5" cy="13.5" r="2" fill="var(--graview-mark-point, currentColor)"/></svg>',ne={display:"flex",alignItems:"center",minHeight:28,padding:"2px 8px",borderRadius:7,fontSize:"0.875rem",color:"var(--graview-ink)",textDecoration:"none"},$={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},C={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};export{ae as ActivityRail,ge as Here,Be as ProblemRows,_e as ProfilePane,Ie as TidyFoot,ye as placeGesture,ue as sayTheirChange};
@@ -1 +1 @@
1
- import{a as I,c as x}from"./chunk.5CLFTXP3.js";import"./chunk.QXARGANF.js";import{c as b,d as A,k as v,r as w,t as O,w as G}from"./chunk.DNNL7F3P.js";import{$c as E,Mc as k,fd as S,gd as W}from"./chunk.HBBVVALN.js";import"./chunk.AJZBJBMO.js";var F=(e,i)=>k(e,i).slice(1);function j(e,i){let l=e.split("/").filter(Boolean);return l.length===i.length&&l.every((s,h)=>s.startsWith(":")||s==="*"||s===i[h])}var $=["problems","search","map","places"];function R(e,i,l,s,h=[]){let{schema:r}=i,o=r.kinds,f=t=>{if(t.startsWith(w))return(t.slice(w.length).split("|")[0]??"").split("+").every(V=>o.includes(V));let y=O(t);return y!==null?o.includes(y):t.startsWith("edge:")||l.graph.getNode(t)!==void 0},[p="/",u]=e.path.split("?"),n=p.split("/").filter(Boolean),m=u?`?${u}`:"",d=n.length>0&&!$.includes(n[0])?o.find(t=>F(r,t)===n[0]):void 0,c=e.path;if(n[0]==="places"&&n.length===2)`/places/${n[1]}`!==E&&!s.some(t=>t.as===decodeURIComponent(n[1]))&&(c="/");else if(d){let t=n[1]===void 0?void 0:decodeURIComponent(n[1]);c=`/${F(r,d)}${t!==void 0&&l.graph.getNode(t)?.kind===d?`/${n[1]}`:""}${m}`}else n.length>0&&n.length<=2&&!$.includes(n[0])&&!h.some(t=>j(t.path,n))&&(c="/");let g=A(e.stop),P=g.within?.view,U=P!==void 0&&!s.some(t=>t.as===P),a=g;if(U){let{view:t,...y}=g.within??{};a={...a,within:y}}if(g.focusId&&!f(g.focusId)){let t=e.kind&&o.includes(e.kind)?G(e.kind):null;a={...v(a,t),zoom:!1}}return a={...a,relation:a.relation&&(o.includes(a.relation)||r.edgeKinds.includes(a.relation))?a.relation:null,expanded:a.expanded.filter(f),pins:Object.fromEntries(Object.entries(a.pins).filter(([t])=>f(t))),...a.selection?{selection:a.selection.filter(f)}:{}},{face:e.face,path:c,stop:b(a),...e.kind?{kind:e.kind}:{}}}function B(e,i,l){let s=e.at,h=e.pages?.routes()??[];if(e.routing!=="address"||typeof window>"u")return R(s,e.app,i,l,h);let{pathname:r,search:o,hash:f}=window.location,p=W(r,e.basePath),u=I({routing:"address",...e.basePath===void 0?{}:{basePath:e.basePath},face:s.face}),n=u==="pages",m={...s,face:u,...p===null?{}:n?{path:p+o}:{stop:x(e.basePath)??s.stop}},d=R(m,e.app,i,l,h),c=n?d.path===m.path?null:S(d.path,e.basePath===void 0?{}:{basePath:e.basePath}):d.stop===b(A(m.stop))?null:r+o+d.stop;return p!==null&&c!==null&&c!==r+o+f&&window.history.replaceState(window.history.state,"",c),d}export{R as settle,B as settleAt};
1
+ import{a as I,c as x}from"./chunk.36SQJMEE.js";import"./chunk.QT4XGC5Z.js";import{c as b,d as A,k as v,r as w,t as O,w as G}from"./chunk.MQ7FNHXG.js";import{Qc as k,ed as E,kd as S,ld as W}from"./chunk.WLPTY4BF.js";import"./chunk.AJZBJBMO.js";var F=(e,i)=>k(e,i).slice(1);function j(e,i){let l=e.split("/").filter(Boolean);return l.length===i.length&&l.every((s,h)=>s.startsWith(":")||s==="*"||s===i[h])}var $=["problems","search","map","places"];function R(e,i,l,s,h=[]){let{schema:r}=i,o=r.kinds,f=t=>{if(t.startsWith(w))return(t.slice(w.length).split("|")[0]??"").split("+").every(V=>o.includes(V));let y=O(t);return y!==null?o.includes(y):t.startsWith("edge:")||l.graph.getNode(t)!==void 0},[p="/",u]=e.path.split("?"),n=p.split("/").filter(Boolean),m=u?`?${u}`:"",d=n.length>0&&!$.includes(n[0])?o.find(t=>F(r,t)===n[0]):void 0,c=e.path;if(n[0]==="places"&&n.length===2)`/places/${n[1]}`!==E&&!s.some(t=>t.as===decodeURIComponent(n[1]))&&(c="/");else if(d){let t=n[1]===void 0?void 0:decodeURIComponent(n[1]);c=`/${F(r,d)}${t!==void 0&&l.graph.getNode(t)?.kind===d?`/${n[1]}`:""}${m}`}else n.length>0&&n.length<=2&&!$.includes(n[0])&&!h.some(t=>j(t.path,n))&&(c="/");let g=A(e.stop),P=g.within?.view,U=P!==void 0&&!s.some(t=>t.as===P),a=g;if(U){let{view:t,...y}=g.within??{};a={...a,within:y}}if(g.focusId&&!f(g.focusId)){let t=e.kind&&o.includes(e.kind)?G(e.kind):null;a={...v(a,t),zoom:!1}}return a={...a,relation:a.relation&&(o.includes(a.relation)||r.edgeKinds.includes(a.relation))?a.relation:null,expanded:a.expanded.filter(f),pins:Object.fromEntries(Object.entries(a.pins).filter(([t])=>f(t))),...a.selection?{selection:a.selection.filter(f)}:{}},{face:e.face,path:c,stop:b(a),...e.kind?{kind:e.kind}:{}}}function B(e,i,l){let s=e.at,h=e.pages?.routes()??[];if(e.routing!=="address"||typeof window>"u")return R(s,e.app,i,l,h);let{pathname:r,search:o,hash:f}=window.location,p=W(r,e.basePath),u=I({routing:"address",...e.basePath===void 0?{}:{basePath:e.basePath},face:s.face}),n=u==="pages",m={...s,face:u,...p===null?{}:n?{path:p+o}:{stop:x(e.basePath)??s.stop}},d=R(m,e.app,i,l,h),c=n?d.path===m.path?null:S(d.path,e.basePath===void 0?{}:{basePath:e.basePath}):d.stop===b(A(m.stop))?null:r+o+d.stop;return p!==null&&c!==null&&c!==r+o+f&&window.history.replaceState(window.history.state,"",c),d}export{R as settle,B as settleAt};
@@ -0,0 +1 @@
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{s as P}from"./chunk.I3SQJ2L2.js";import{$ as m,H as M,P as w,S as y,a as p,aa as I,oa as S,t as b,x as T,y as A}from"./chunk.MQ7FNHXG.js";import{b as f}from"./chunk.AJZBJBMO.js";var C=f(M(),1),h=f(y(),1),x=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.LAW5PQEM.js")))),O=x.part((e,n)=>(0,h.jsx)(e.Timeline,{...n}),{what:"The timeline"}),q=()=>x.prefetch();function K({face:e}){return w()?.open?(0,h.jsx)(C.Suspense,{fallback:null,children:(0,h.jsx)(O,{face:e})}):null}var i=f(M(),1),u=f(y(),1),v=new WeakMap,D=e=>{let n=v.get(e);return n||v.set(e,n={ask:null,doors:[],listeners:new Set}),n},k=e=>{for(let n of e.listeners)n()};function g(e,n){let t=D(e);t.ask=n,k(t)}var N=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.SGB6IMWN.js","./chunk.NPX7SPXM.js","./chunk.OE4QOBJF.js","./chunk.74RMHUCX.js","./chunk.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.L7JKEEMM.js")))),B=N.part((e,n)=>{let t=e.NotifySheet;return(0,u.jsx)(t,{...n})},{what:"Notify me"}),W=N.part((e,n)=>{let t=e.NotifiedList;return(0,u.jsx)(t,{...n})},{quiet:!0}),E=(e,n)=>n===void 0&&(e.onBehalfOf??e).id!==void 0;function F(e,n,t){let c=d=>t.tryDefinition(d)?.noun??d.replace(/[-_]+/g," "),o=e.on!==void 0?e.on:e.about.length===1?e.about[0]:void 0;if(e.act!==void 0){let d=o!==void 0&&n(o)!==void 0?o:void 0;return{label:"Notify me when someone does this\u2026",choices:[{on:"act",act:e.act,...d!==void 0?{record:d}:{}},...d!==void 0?[{on:"act",act:e.act}]:[]]}}if(o===void 0)return null;let s=n(o);if(s!==void 0)return{label:"Notify me when this changes\u2026",choices:[{on:"changed",record:o},{on:"act",record:o},{on:"reaches",kind:s,condition:"",record:o}]};let r=b(o)!==null?[b(o)]:T(o)?A(o):[];if(r.length!==1||!t.kinds.includes(r[0]))return null;let l=r[0],a=c(l);return{label:`Notify me when ${/^[aeiou]/i.test(a)?"an":"a"} ${a} is added\u2026`,choices:[{on:"created",kind:l},{on:"changed",kind:l},{on:"reaches",kind:l,condition:""}]}}function L(){let{store:e,principal:n,subscriptions:t,signIn:c}=m(),o=E(n,c);return(0,i.useMemo)(()=>o?s=>{let r=F(s,a=>e.graph.getNode(a)?.kind,e.schema);return r?{id:"notify",items:[{id:"notify-me",label:r.label,run:()=>g(t,{choices:r.choices,returnTo:s.element??null})}],prepare:()=>N.prefetch()}:null}:null,[o,e,t])}var z=[];function U({children:e}){let n=L(),t=(0,i.useMemo)(()=>n?[n]:z,[n]);return(0,u.jsx)(P,{sections:t,children:e})}function V(){let{subscriptions:e}=m(),n=(0,i.useId)(),t=D(e);(0,i.useEffect)(()=>(t.doors.push(n),k(t),()=>{t.doors.splice(t.doors.indexOf(n),1),k(t)}),[t,n]);let c=(0,i.useMemo)(()=>r=>(t.listeners.add(r),()=>void t.listeners.delete(r)),[t]),o=(0,i.useSyncExternalStore)(c,()=>t.ask,()=>null),s=(0,i.useSyncExternalStore)(c,()=>t.doors[0]===n,()=>!1);return!o||!s?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(B,{ask:o,close:()=>g(e,null)})})}function X({choices:e,label:n="Notify me",style:t,className:c,testId:o="notify-me"}){let{principal:s,subscriptions:r,signIn:l}=m();return E(s,l)?(0,u.jsx)("button",{type:"button","data-testid":o,className:c,onClick:a=>g(r,{choices:e,returnTo:a.currentTarget}),style:t,children:n}):null}function G(){let e=I(),n=e?.subscriptions,t=e?(e.principal.onBehalfOf??e.principal).id:void 0,[c,o]=(0,i.useState)(0);return(0,i.useEffect)(()=>{if(t===void 0||!n)return;let s=!0,r=()=>void Promise.resolve(n.list(t)).then(a=>s&&o(a.length),()=>s&&o(0));r();let l=n.onChange?.(r);return()=>{s=!1,l?.()}},[n,t]),c}function Y({style:e}){return G()===0?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(W,{...e?{style:e}:{}})})}export{q as a,K as b,L as c,U as d,V as e,X as f,G as g,Y as h};
@@ -0,0 +1,117 @@
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,B as Pe,C as Ln,D as We,E as Ve,F as Xr,G as Tn,H as Re,I as Jr,J as ei,K as F,L as dt,M as Mn,N as ti,O as En,P as Gt,Q as ni,R as ne,S as re,T as Nn,a as Y,b as Ee,c as Z,d as jr,e as Cn,f as Rn,g as lt,h as J,i as ke,j as ae,k as C,l as ee,m as K,n as Se,o as Ht,p as xe,q as fe,r as _r,s as yt,t as Kt,u as Q,v as Ge,w as Yr,x as Bt,y as Ce,z as Qr}from"./chunk.WG5NIR23.js";import{b as zr,c as qt,e as te}from"./chunk.3ZRHHB7X.js";import{a as Gr,d as Vr,e as Ur}from"./chunk.UGFDSE37.js";import{a as Dr,c as Wr,f as Hr,g as Kr,i as Br,j as qr}from"./chunk.ZYCNEOAQ.js";import{a as Lr,b as Tr,c as Mr,d as An}from"./chunk.4DEUD66C.js";import{b as Rr}from"./chunk.LHO7L3CS.js";import{a as Er,b as Nr,d as Dt,e as $r,f as Or,i as Wt}from"./chunk.YG423NEB.js";import{a as Tt,b as Da,c as Wa,d as Mt,e as Ha}from"./chunk.AFY35RJP.js";import{b as Qa,c as ir,e as or,f as kn}from"./chunk.POHEWJKZ.js";import{a as Ft,b as It,c as Pr,e as Ar}from"./chunk.YXH3IWNR.js";import{a as qe,b as er,c as tr,d as nr,e as ar,f as rr}from"./chunk.OEF3GPRM.js";import{m as Cr}from"./chunk.VTWFVPKD.js";import{a as pr,b as ur,c as gr,e as xr,f as Pn,h as Ot}from"./chunk.33GN2NUT.js";import{d as yr,e as hr,f as wr,g as vr,n as br,o as kr,q as Sr,s as $t}from"./chunk.2VIGF4FO.js";import{a as Sn}from"./chunk.FTJBW25J.js";import{a as vn,b as _a,c as Ya}from"./chunk.UT6642FC.js";import{a as Nt,b as sr,c as lr,d as dr,e as cr}from"./chunk.RZVZG2BQ.js";import{c as Za,d as Xa,j as ft}from"./chunk.2EJAIT33.js";import{r as bn,s as Ja}from"./chunk.I3SQJ2L2.js";import{f as Ga,g as st,i as Va,j as Ua,k as wn,q as ja,r as za}from"./chunk.MWZK3HVG.js";import{b as Et,c as Ka,d as Ba,e as qa}from"./chunk.3D5T3XIE.js";import{C as xn,K as Fr,N as Ir,e as Fa,f as Ia,j as qi,u as mr,v as fr}from"./chunk.QT4XGC5Z.js";import{$ as Ta,H as Fe,M as Pa,O as Aa,R as Ca,S as j,T as hn,W as Ra,X as La,a as Sa,aa as de,da as Ma,ea as Ea,ga as Na,ka as ot,la as $a,s as xa,w as Oe,wa as Oa}from"./chunk.MQ7FNHXG.js";import{I as oa,Oc as fn,Rb as ma,T as mt,Tc as wa,Ub as fa,Uc as va,Va as pa,Vb as ya,Wc as Lt,Xa as ua,aa as rt,ba as me,da as be,dd as yn,ea as Ct,ed as ba,fb as mn,ga as it,gb as ga,ia as sa,id as ka,ja as la,ka as Be,ob as Rt,pc as ha,ua as da,va as ca}from"./chunk.WLPTY4BF.js";import{b as D}from"./chunk.AJZBJBMO.js";function ai(t,e,n={}){let a=t.graph.getNode(e);if(!a)return;let r=t.schema.tryDefinition(a.kind),i=l=>me(t.schema.tryDefinition(l.kind),l),o=new Map;for(let l of t.graph.allEdges()){let d=l.from===e?"out":l.to===e?"in":null;if(!d)continue;let c=d==="out"?l.to:l.from,p=t.graph.getNode(c);if(!p)continue;let f=(d==="out"?r:t.schema.tryDefinition(p.kind))?.edges?.[l.kind],u=d==="in"?f?.inverse??f?.description:f?.description,k=`${l.kind}|${d}|${u??""}`;(o.get(k)??(()=>{let h={edgeKind:l.kind,direction:d,...u?{description:u}:{},targets:[]};return o.set(k,h),h})()).targets.push({id:p.id,kind:p.kind,label:i(p)})}return{id:e,kind:a.kind,label:i(a),fields:Ba(ft(t.schema,t.graph,a),r),violations:mn(t.violations(n.context),[e]),actions:Sn(t,[e],{focus:e,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...o.values()].map(l=>{let d=Et(l.targets.flatMap(c=>{let p=t.graph.getNode(c.id);return p?[p]:[]}),c=>t.schema.tryDefinition(c));return{...l,targets:[...l.targets].map(c=>d.has(c.id)?{...c,apart:d.get(c.id)}:c).sort((c,p)=>c.label.localeCompare(p.label))}})}}function ze(t,e,n={}){return{kind:e,members:t.graph.nodesOfKind(e),actions:Sn(t,[],{kindSelection:[e],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function ri(t,e){let n=(i,o)=>`${i}|${JSON.stringify(o)}`,a=new Map;for(let i of[...t.affordances,...t.withheld]){if(i.provider!=="invariant")continue;let o=n(i.mutation,i.args);a.has(o)||a.set(o,i.rank??Number.MAX_SAFE_INTEGER)}let r=Number.MAX_SAFE_INTEGER;return[...e].map((i,o)=>({repair:i,declared:o})).sort((i,o)=>(a.get(n(i.repair.mutation,i.repair.args??{}))??r)-(a.get(n(o.repair.mutation,o.repair.args??{}))??r)||i.declared-o.declared).map(i=>i.repair)}function _e(t){let e=t.schema.kinds.map(r=>({kind:r,plural:it(t.schema,r),count:t.graph.nodesOfKind(r).length})),n=new Map;for(let r of t.graph.allEdges()){let i=t.graph.getNode(r.from),o=t.graph.getNode(r.to);if(!i||!o)continue;let l=`${r.kind}|${i.kind}|${o.kind}`;n.set(l,(n.get(l)??0)+1)}let a=[];for(let{kind:r}of e){let i=t.schema.tryDefinition(r)?.edges??{};for(let[o,l]of Object.entries(i)){let d=l.to==="*"||l.to===void 0?(()=>{let c=[...n.keys()].filter(p=>p.startsWith(`${o}|${r}|`)).map(p=>p.split("|")[2]);return c.length>0?c:["*"]})():l.to;for(let c of d)a.push({edgeKind:o,from:r,to:c,...l.description?{description:l.description}:{},...l.inverse?{inverse:l.inverse}:{},count:n.get(`${o}|${r}|${c}`)??0})}}return{kinds:e,relations:a}}var He=D(Fe(),1);var Ye=D(Fe(),1),x=D(j(),1),Gi=`
2
+ form:where([data-graview-part="form"]) {
3
+ /* A grid item of the section above it and a grid container for the
4
+ fields below: both halves are allowed to be narrower than what is in
5
+ them, or a big enough text size pushes the page sideways. See the note
6
+ on \`column\` in pages.tsx. */
7
+ display: grid;
8
+ grid-template-columns: minmax(0, 1fr);
9
+ min-width: 0;
10
+ gap: 12px;
11
+ }
12
+ label:where([data-graview-part="field"]),
13
+ div:where([data-graview-part="field"][data-graview-field="date"]) {
14
+ display: grid;
15
+ /* A track the width it was given: see the note on \`column\` in pages.tsx. */
16
+ grid-template-columns: minmax(0, 1fr);
17
+ min-width: 0;
18
+ gap: 4px;
19
+ }
20
+ label:where([data-graview-part="field"][data-graview-field="boolean"]) {
21
+ grid-auto-flow: column;
22
+ justify-content: start;
23
+ align-items: center;
24
+ }
25
+ span:where([data-graview-part="label"]),
26
+ legend:where([data-graview-part="label"]),
27
+ p:where([data-graview-part="unasked"]) {
28
+ font-size: 0.8125rem;
29
+ color: var(--graview-ink-muted);
30
+ }
31
+ p:where([data-graview-part="unasked"]) { margin: 0; }
32
+ input:where([data-graview-part="control"]:not([type="checkbox"])),
33
+ select:where([data-graview-part="control"]) {
34
+ font: inherit;
35
+ /* A TARGET IN EVERY ENGINE, not only in the one it was measured in.
36
+ Padding and line height alone came to 24 in Chromium and to 22 in
37
+ WebKit, which has its own intrinsic metrics for a \`select\` and rounds
38
+ nothing up for anybody. So every picker on the routed face was under
39
+ the WCAG 2.2 minimum in the browser iOS ships, and the check that says
40
+ so (\`verify-pages\`' \`bigEnoughToHit\`) only ever ran there through
41
+ \`pnpm engines\`. */
42
+ min-height: 24px;
43
+ /* NEVER WIDER THAN ITS FIELD. A select is as wide as its longest option,
44
+ and a picker over 320 vehicles ("2027 Mercedes-Benz GLE AMG 53 4MATIC+
45
+ Coupe") was 618 pixels on a 390 phone, and the whole page scrolled
46
+ sideways. It shrinks to its track and cuts the option inside its box. */
47
+ min-width: 0;
48
+ max-width: 100%;
49
+ text-overflow: ellipsis;
50
+ box-sizing: border-box;
51
+ padding: 7px 10px;
52
+ border-radius: 8px;
53
+ border: 1px solid var(--graview-edge);
54
+ background: var(--graview-panel);
55
+ color: var(--graview-ink);
56
+ }
57
+ /* A PICKER THAT STILL LOOKS LIKE ONE.
58
+ WebKit ignores an author's padding and minimum height on a \`select\`
59
+ while the native appearance is on \u2014 so every picker on the routed face
60
+ came out 22 pixels tall in the browser iOS ships, under the 24 WCAG 2.2
61
+ asks for, while the same element measured 35 in Chromium. Turning the
62
+ appearance off is what makes the box the size it was asked to be, and it
63
+ takes the platform's chevron with it; the chevron is put back, in the ink
64
+ the scheme is already using. */
65
+ span:where([data-graview-part="picker"]) {
66
+ position: relative;
67
+ display: grid;
68
+ min-width: 0;
69
+ }
70
+ span:where([data-graview-part="picker"]) > select:where([data-graview-part="control"]) {
71
+ appearance: none;
72
+ padding-right: 28px;
73
+ }
74
+ span:where([data-graview-part="chevron"]) {
75
+ position: absolute;
76
+ right: 10px;
77
+ top: 50%;
78
+ transform: translateY(-50%);
79
+ font-size: 0.75rem;
80
+ line-height: 1;
81
+ color: var(--graview-ink-muted);
82
+ pointer-events: none;
83
+ }
84
+ fieldset:where([data-graview-part="group"]) {
85
+ display: grid;
86
+ gap: 10px;
87
+ border: 1px solid var(--graview-edge);
88
+ border-radius: 10px;
89
+ padding: 12px;
90
+ }
91
+ fieldset:where([data-graview-part="group"][data-graview-field="list"]) { gap: 8px; }
92
+ div:where([data-graview-part="item"]) {
93
+ display: flex;
94
+ gap: 8px;
95
+ align-items: end;
96
+ }
97
+ button:where([data-graview-part="add"]),
98
+ button:where([data-graview-part="submit"]) { justify-self: start; }
99
+ p:where([data-graview-part="refused"]) {
100
+ margin: 0;
101
+ color: var(--graview-warn);
102
+ font-size: 0.875rem;
103
+ }
104
+ `;function Vi({title:t,name:e,optional:n,amount:a,value:r,onChange:i}){let o=Va(a),[l,d]=(0,Ye.useState)(()=>typeof r=="number"?Ua(r,a):""),c=l.trim()!==""&&wn(l,a)===void 0;return(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":"number","data-graview-amount":a.format??"unit",children:[(0,x.jsx)("span",{"data-graview-part":"label",children:t}),(0,x.jsxs)("span",{"data-graview-part":"amount",style:{display:"flex",alignItems:"center",gap:6},children:[o.prefix?(0,x.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:o.prefix}):null,(0,x.jsx)("input",{type:"text",inputMode:"decimal",name:e,required:!n,placeholder:o.placeholder,title:o.hint,"aria-invalid":c||void 0,value:l,onChange:p=>{d(p.target.value),i(wn(p.target.value,a))},"data-graview-part":"control",style:{flex:1,minWidth:0}}),o.suffix?(0,x.jsx)("span",{"data-graview-part":"amount-symbol","aria-hidden":"true",children:o.suffix}):null]}),c?(0,x.jsxs)("span",{"data-graview-part":"hint",role:"status",children:["Not an amount ",o.hint,": write it like ",o.prefix??"",o.placeholder,o.suffix?` ${o.suffix}`:""]}):null]})}function ii({children:t}){return(0,x.jsxs)("span",{"data-graview-part":"picker",children:[t,(0,x.jsx)("span",{"aria-hidden":"true","data-graview-part":"chevron",children:"\u25BE"})]})}var Ui=t=>({label:be(t),option:e=>e}),ji={phone:"+1 555 123 4567",place:"An address or a place's name",duration:"1h 30m, 90 or 1:30"};function Vt({store:t,spec:e,value:n,onChange:a,prefilled:r,open:i,words:o=Ui,values:l}){if(e.name in r&&e.control!=="group"&&e.control!=="variant")return null;let d=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(m=>be(Be(t.schema.tryDefinition(m),m))).join(" or "):o(e.name).label,c=!(e.optional||e.control==="boolean"),p=c?(0,x.jsxs)(x.Fragment,{children:[d,(0,x.jsx)("span",{"aria-hidden":"true",children:" *"})]}):d;switch(e.control){case"text":case"date":return e.control==="text"&&e.long?(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":"text",children:[(0,x.jsxs)("span",{"data-graview-part":"label",children:[p,e.markdown?(0,x.jsx)("span",{style:{fontWeight:"normal",color:"var(--graview-ink-faint)"},children:" \xB7 Markdown"}):null]}),(0,x.jsx)("textarea",{name:e.name,required:!e.optional,rows:6,value:typeof n=="string"?n:"",onChange:m=>a(m.target.value),"data-graview-part":"control",style:{fieldSizing:"content",minHeight:"7.5em",resize:"vertical",font:"inherit",lineHeight:1.5}})]}):e.control==="date"?(0,x.jsxs)("div",{"data-graview-part":"field","data-graview-field":"date",children:[(0,x.jsx)("span",{"data-graview-part":"label",children:p}),(0,x.jsx)(rr,{name:e.name,label:o(e.name).label,required:!e.optional,value:typeof n=="string"&&n!==""?n:void 0,time:e.time===!0,instant:e.instant===!0,onChange:a})]}):(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control==="text"&&e.holds?e.holds:e.control,children:[(0,x.jsx)("span",{"data-graview-part":"label",children:p}),(0,x.jsx)("input",{type:e.control==="text"&&e.holds==="phone"?"tel":"text",name:e.name,required:!e.optional,...e.control==="text"&&e.app?{placeholder:"@owner/app or https://\u2026"}:{},...e.control==="text"&&e.holds?{placeholder:ji[e.holds]}:{},...e.control==="text"&&e.holds==="phone"?{autoComplete:"tel"}:{},value:typeof n=="string"?n:typeof n=="number"?String(n):"",onChange:m=>a(m.target.value),"data-graview-part":"control"})]});case"number":return e.amount?(0,x.jsx)(Vi,{title:p,name:e.name,optional:e.optional,amount:e.amount,value:n,onChange:a}):(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,x.jsx)("span",{"data-graview-part":"label",children:p}),(0,x.jsx)("input",{type:"number",name:e.name,required:!e.optional,...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max},...e.step===void 0?{}:{step:e.step},value:typeof n=="number"?n:"",onChange:m=>a(m.target.value===""?void 0:Number(m.target.value)),"data-graview-part":"control"})]});case"boolean":return(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":"boolean",children:[(0,x.jsx)("input",{type:"checkbox",name:e.name,checked:n===!0,onChange:m=>a(m.target.checked),"data-graview-part":"control"}),(0,x.jsx)("span",{"data-graview-part":"label",children:p})]});case"choice":return(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,x.jsx)("span",{"data-graview-part":"label",children:p}),(0,x.jsx)(ii,{children:(0,x.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:m=>a(m.target.value||void 0),"data-graview-part":"control",children:[(0,x.jsx)("option",{value:"",children:"\u2014"}),(e.options??[]).map(m=>(0,x.jsx)("option",{value:m,children:o(e.name).option(m)},m))]})})]});case"node":{let m=i.find(h=>h.name===e.name)?.candidates,f=new Set(Object.values(r).filter(h=>typeof h=="string")),u=(e.kinds.includes("*")?[...t.graph.allNodes()]:e.kinds.flatMap(h=>t.graph.nodesOfKind(h))).filter(h=>!f.has(h.id)),k=m?m.map(h=>t.graph.getNode(h)).filter(h=>h!==void 0):u,q=Et(k,h=>t.schema.tryDefinition(h));return(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":e.control,children:[(0,x.jsx)("span",{"data-graview-part":"label",children:p}),(0,x.jsx)(ii,{children:(0,x.jsxs)("select",{name:e.name,required:!e.optional,value:typeof n=="string"?n:"",onChange:h=>a(h.target.value||void 0),"data-graview-part":"control",children:[(0,x.jsx)("option",{value:"",children:"\u2014"}),k.map(h=>{let R=q.get(h.id);return(0,x.jsxs)("option",{value:h.id,children:[me(t.schema.tryDefinition(h.kind),h),R?` \xB7 ${R}`:""]},h.id)})]})})]})}case"group":{let m=n??{};return(0,x.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,x.jsx)("legend",{"data-graview-part":"label",children:p}),e.fields.map(f=>(0,x.jsx)(Vt,{store:t,spec:f,value:m[f.name],onChange:u=>a({...m,[f.name]:u}),prefilled:r,open:i,words:o},f.name))]})}case"variant":{let m=n??{},f=typeof m[e.tag]=="string"?m[e.tag]:"",u=e.options.find(k=>k.value===f);return(0,x.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.control,children:[(0,x.jsx)("legend",{"data-graview-part":"label",children:p}),(0,x.jsxs)("label",{"data-graview-part":"field","data-graview-field":"choice",children:[(0,x.jsx)("span",{"data-graview-part":"label",children:be(e.tag)}),(0,x.jsxs)("select",{value:f,onChange:k=>a({[e.tag]:k.target.value}),"data-graview-part":"control",children:[(0,x.jsx)("option",{value:"",children:"\u2014"}),e.options.map(k=>(0,x.jsx)("option",{value:k.value,children:be(k.value)},k.value))]})]}),u?.fields.map(k=>(0,x.jsx)(Vt,{store:t,spec:k,value:m[k.name],onChange:q=>a({...m,[k.name]:q}),prefilled:r,open:i,words:o},k.name))]})}case"file":case"list":{let m=e.control==="file"?e:e.item.control==="file"?e.item:void 0;if(m||e.control==="file")return(0,x.jsx)(qe,{as:"control",title:c?`${d} *`:d,value:n,onChange:a,several:m!==e,image:m?.image===!0,video:m?.video===!0,label:d});let f=Array.isArray(n)?n:[];return(0,x.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":"list",children:[(0,x.jsx)("legend",{"data-graview-part":"label",children:p}),f.map((u,k)=>(0,x.jsxs)("div",{"data-graview-part":"item",children:[(0,x.jsx)("div",{style:{flex:1},children:(0,x.jsx)(Vt,{store:t,spec:{...e.item,optional:!1},value:u,onChange:q=>a(f.map((h,R)=>R===k?q:h)),prefilled:r,open:i,words:o})}),(0,x.jsx)("button",{type:"button","data-graview-part":"remove",onClick:()=>a(f.filter((q,h)=>h!==k)),children:"remove"})]},k)),(0,x.jsx)("button",{type:"button","data-graview-part":"add",onClick:()=>a([...f,void 0]),children:"add another"})]})}case"linked":return(0,x.jsx)("div",{"data-graview-part":"field","data-graview-field":"linked",children:(0,x.jsx)(tr,{relation:e.relation,value:n,onChange:a,label:d})});case"repeat":return(0,x.jsx)(nr,{value:n,onChange:a,start:e.of?l?.[e.of]:void 0,label:`${e.of?o(e.of).label:d} repeats`,name:e.name});case"opaque":return(0,x.jsxs)("p",{"data-graview-part":"unasked",children:["\u201C",be(e.name),"\u201D needs a structured answer this form cannot ask for yet."]})}}function Ie({store:t,mutation:e,prefilled:n={},open:a=[],onDone:r,principal:i,initial:o,label:l,only:d}){let c=()=>lr(e,t.graph,n),[p,m]=(0,Ye.useState)(c),[f,u]=(0,Ye.useState)(()=>({...p,...o})),[k,q]=(0,Ye.useState)(null),h=i??t.seenFor,R=e.subject&&n[e.subject.arg],G=h?cr(t,h,e,typeof R=="string"?R:void 0):void 0,M=Nt(e.input).filter(I=>(d===void 0||d.includes(I.name))&&!G?.has(I.name)),V=I=>Ga(t.schema,e,I),z=za(M.filter(I=>I.control==="date").map(I=>I.name)),oe=(0,Ye.useRef)(void 0),pe=(I,_)=>u(ie=>{let ve={...ie,[I.name]:_};if(z&&I.name===z.start&&I.control==="date"){let se=v=>typeof v=="string"&&v!==""?v:void 0,ue=se(ie[z.start])??oe.current;if(se(_)){oe.current=se(_);let v=ja(ue,se(_),se(ie[z.end]),{time:I.time===!0,instant:I.instant===!0});v!==void 0&&(ve[z.end]=v)}}return ve});return(0,x.jsxs)("form",{"data-testid":`form-${e.name}`,onSubmit:I=>{I.preventDefault();try{t.apply({name:e.name,args:{...dr(sr(M,f),p),...n}},i?{author:i}:{}),q(null);let _=c();m(_),u({..._}),r?.()}catch(_){q(st(t.schema,t.allMutations(),_))}},"data-graview-part":"form",children:[(0,x.jsx)("style",{children:Gi}),M.map(I=>(0,x.jsx)(Vt,{store:t,spec:I,value:f[I.name],values:f,onChange:_=>pe(I,_),prefilled:n,open:a,words:V},I.name)),k?(0,x.jsx)("p",{"data-testid":"refused","data-graview-part":"refused",role:"alert",children:k}):null,(0,x.jsx)("button",{type:"submit","data-graview-part":"submit",children:l??e.title??e.name})]})}var T=D(j(),1);function Le(t){let e=t.views;if(!e)return[];let n=new Set(Ge(t.store,t.principal));return e.places().filter(a=>n.has(a.kind))}function Ut(t,e){if(!e.over)return[e.kind];let n=new Set(Ge(t.store,t.principal));return e.over.filter(a=>a===e.kind||n.has(a))}var Qe=t=>`place:${t.kind}:${t.as}`;function ye(t,e){return jr(e.as,wa(e,t.views?.places()??[])?Y(t.store.schema,e.kind):void 0)}function ht(t,e){let n=t.schema.tryDefinition(e);return t.graph.nodesOfKind(e).filter(a=>rt(n,a))}function $n(t,e,n){let a=(i,o)=>Ct(t.schema,o,i),r=(typeof e=="string"?[e]:e).map(i=>a(ht(t,i).length,i)).join(" and ");return n?`${r} across ${a(ht(t,n).length,n)}`:r}function On({context:t,place:e,chosen:n,filter:a}){let{store:r,views:i,invariantContext:o}=t,d=i?.resolve(e.kind,{cardinality:"many",fidelity:"full"},e.as)?.view,c=[...new Set(r.violations(o).flatMap(f=>f.nodeIds))],p=Ut(t,e).flatMap(f=>ht(r,f));if(!d)return null;let m=zi(r,p,a,c);return(0,T.jsx)(bn,{kind:e.kind,view:e.title,children:(0,T.jsx)(d,{nodes:m,label:e.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...c.length>0?{flagged:c}:{}})})}function zi(t,e,n,a){let r=n?Lt({filter:n}).filter??[]:[];return r.length===0?e:Ot(e,{filter:r},{schema:t.schema,graph:t.graph,flagged:new Set(a)}).nodes}function _i({store:t,views:e,as:n,invariantContext:a}){te(t);let r={store:t,views:e,...a?{invariantContext:a}:{}},i=e.places().find(o=>o.as===n);return i?(0,T.jsx)(On,{context:r,place:i}):null}function Yi({context:t,kind:e}){let{store:n,views:a,invariantContext:r}=t,i=ht(n,e),o=n.schema.tryDefinition(e),l=Q(n,e),c=a?.resolve(e,{cardinality:"many",fidelity:"full"})?.view,p=[...new Set(n.violations(r).flatMap(k=>k.nodeIds))];if(c&&!ot(c))return(0,T.jsx)(bn,{kind:e,children:(0,T.jsx)(c,{nodes:i,label:l,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...p.length>0?{flagged:p}:{}})});let m=a?.resolve(e,{cardinality:"one",fidelity:"summary"})?.view,f=8,u=i.slice(0,f);return(0,T.jsxs)("div",{"data-testid":"kind-sheet",style:m?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gridAutoRows:"max-content",alignContent:"center",gap:12,padding:24}:{display:"flex",flexWrap:"wrap",alignContent:"center",justifyContent:"center",gap:10,padding:24},children:[u.map(k=>m?(0,T.jsx)(m,{node:k,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...p.includes(k.id)?{flagged:[k.id]}:{}},k.id):(0,T.jsx)("span",{style:{padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:me(o,k)},k.id)),i.length>f?(0,T.jsxs)("span",{style:{...C,alignSelf:"center",padding:"0 6px"},children:["+",i.length-f," more ",l.toLowerCase()]}):null]})}function Fn(t){let{store:e}=t,n=Yr(t),a=Le(t),r=fn([...a].sort((o,l)=>n.indexOf(o.kind)-n.indexOf(l.kind))).filter(o=>!o.hidden),i=new Set(r.flatMap(o=>o.over??[o.kind]));return[...r.map(o=>({key:Qe(o),kind:o.kind,title:va(o,a,e.schema),to:ye(t,o),place:o})),...Bt(t).filter(o=>!i.has(o)).map(o=>({key:`kind:${o}`,kind:o,title:Q(e,o),to:`/${Y(e.schema,o)}`}))]}var oi=.72,Qi=540,si=16/10;function Zi(t){let e=(0,He.useRef)(null),[n,a]=(0,He.useState)(t);return(0,He.useLayoutEffect)(()=>{let r=e.current;if(!r||typeof ResizeObserver>"u")return;let i=()=>{let l=r.getBoundingClientRect().width;l>0&&a(d=>Math.abs(d-l)<.5?d:l)};i();let o=new ResizeObserver(i);return o.observe(r),()=>o.disconnect()},[]),{ref:e,width:n}}function Xi(t){for(let e=t.parentElement;e;e=e.parentElement)if(/(auto|scroll)/.test(getComputedStyle(e).overflowY))return e;return null}function Ji(t){let[e,n]=(0,He.useState)(()=>typeof IntersectionObserver>"u");return(0,He.useLayoutEffect)(()=>{let a=t.current;if(e||!a)return;let r=new IntersectionObserver(i=>{i.some(o=>o.isIntersecting)&&(r.disconnect(),n(!0))},{root:Xi(a),rootMargin:"50% 0px"});return r.observe(a),()=>r.disconnect()},[e,t]),e}function In({context:t,entry:e}){let{store:n,brand:a,principal:r}=t,{ref:i,width:o}=Zi(Qi),l=Ji(i),d=o/oi,c=ht(n,e.kind),p=n.schema.tryDefinition(e.kind),m=c.length===0?ze(n,e.kind,{...r?{principal:r}:{},...t.invariantContext?{context:t.invariantContext}:{}}).actions.affordances[0]:void 0,f=e.place!==void 0;return(0,T.jsxs)(F,{to:e.to,"data-testid":f?"place-card":"kind-card",className:"graview-gallery-card",style:{...Se,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,T.jsxs)("span",{ref:i,"data-testid":f?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${si}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,T.jsx)("span",{style:{position:"absolute",left:0,top:0,width:d,height:d/si,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${oi})`,transformOrigin:"0 0"},children:l?(0,T.jsx)(Dt.Provider,{value:null,children:e.place?(0,T.jsx)(On,{context:t,place:e.place}):(0,T.jsx)(Yi,{context:t,kind:e.kind})}):null}),c.length===0?(0,T.jsx)("span",{"data-testid":"picture-empty",style:{position:"absolute",inset:0,display:"grid",placeContent:"center",justifyItems:"center",gap:2,padding:20,textAlign:"center"},children:(0,T.jsxs)("span",{style:{display:"grid",gap:2,padding:"10px 16px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:[(0,T.jsxs)("span",{style:{fontFamily:Rn,fontWeight:"var(--graview-weight-display)"},children:["No ",Q(n,e.kind).toLowerCase()," yet"]}),m?(0,T.jsxs)("span",{style:C,children:["Begin with \u201C",m.label,"\u201D"]}):null]})}):null]}),(0,T.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,T.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[f?null:(0,T.jsx)(fe,{kind:e.kind,brand:a,schema:n.schema,size:8}),(0,T.jsx)("span",{style:{fontFamily:Rn,fontSize:"var(--graview-text-heading)",fontWeight:"var(--graview-weight-display)",lineHeight:1.3,overflowWrap:"anywhere",textWrap:"balance"},children:e.title})]}),(0,T.jsxs)("span",{style:C,children:[e.place?$n(n,Ut(t,e.place),e.place.across):$n(n,e.kind),!f&&p?.description?` \xB7 ${p.description}`:null]})]})]})}var li={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},eo=`
105
+ .graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
106
+ .graview-gallery-card:hover > span:first-child,
107
+ .graview-gallery-card:focus-visible > span:first-child { border-color: var(--graview-edge-bright); box-shadow: 0 1px 0 var(--graview-edge), 0 10px 30px -18px var(--graview-ink); }
108
+ `;function Dn({context:t}){te(t.store);let e=Fn(t);return e.length===0?null:(0,T.jsxs)("section",{style:li,"data-testid":"gallery",children:[(0,T.jsx)("style",{children:eo}),e.map(n=>(0,T.jsx)(In,{context:t,entry:n},n.key))]})}function Wn({context:t}){let{store:e}=t;te(e);let n=fn(Le(t)).filter(r=>!r.hidden),a=Fn(t);return(0,T.jsxs)(ne,{context:t,style:lt,children:[(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)("p",{style:ke,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,T.jsx)(re,{context:t,children:"Pictures"}),(0,T.jsx)("p",{style:ae,children:n.length===0?"Nothing here has a picture of its own yet, so each kind is drawn as the scene draws it. Title a group view and it appears here by name.":"The ways this installation looks at what it holds \u2014 each one the same picture the scene shows, here as a page."})]}),a.length>0?(0,T.jsx)("div",{style:li,"data-testid":"places",children:a.map(r=>(0,T.jsx)(In,{context:t,entry:r},r.key))}):null]})}function Hn({context:t}){let{store:e,principal:n}=t;te(e);let a=Ve(),r=We(),[i]=dt(),o=decodeURIComponent(a.as??""),[l,d]=(0,He.useState)(null),c=i.get("of"),p=i.get("filter"),f=Le(t).find(M=>M.as===o&&(!c||Y(e.schema,M.kind)===c));if(!f)return(0,T.jsxs)(ne,{context:t,children:[(0,T.jsx)(re,{context:t,children:"No picture is called that."}),(0,T.jsx)("p",{style:ae,children:(0,T.jsxs)(F,{to:"/places",style:K,children:["The pictures there are ",(0,T.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]})})]});let u=Q(e,f.kind),k=t.views?.resolve(f.kind,{cardinality:"many",fidelity:"full"},f.as)?.view,q=k?.flows===!0,h=k?.creates!==!1,R=ze(e,f.kind,{...n?{principal:n}:{},...t.invariantContext?{context:t.invariantContext}:{}}),G=h?R.actions.affordances.map(M=>({affordance:M,mutation:e.allMutations().find(V=>V.name===M.mutation)})).filter(M=>M.mutation!==void 0):[];return(0,T.jsxs)(ne,{context:t,style:lt,children:[(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)(re,{context:t,children:f.title}),(0,T.jsxs)("p",{style:ae,"data-testid":"place-lede",children:[$n(e,Ut(t,f),f.across),"."]}),p&&!q?(0,T.jsxs)("p",{style:{...C,margin:0},"data-testid":"place-narrowed",children:[`Only those where ${p.split(",").map(M=>M.replace(":"," is ")).join(" and ")}. `,(0,T.jsx)(F,{to:`?${(()=>{let M=new URLSearchParams(i);return M.delete("filter"),M.toString()})()}`,style:{...K,...C},children:"Show all"})]}):null,(0,T.jsx)("p",{style:{...C,margin:0,display:"flex",flexWrap:"wrap",gap:"4px 16px"},children:Ut(t,f).map((M,V)=>(0,T.jsxs)(F,{to:`/${Y(e.schema,M)}`,style:{...K,...C},...V===0?{"data-testid":"place-as-list"}:{},children:["All ",(M===f.kind?u:Q(e,M)).toLowerCase()," as a list ",(0,T.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]},M))})]}),(0,T.jsx)("div",{"data-testid":"place-lens","data-flows":q?"":void 0,style:q?{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",maxWidth:"100%"}:{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",maxWidth:"100%",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},onClick:M=>{let V=M.target?.closest("[data-graview-pick]"),z=V?.getAttribute("data-graview-pick"),oe=V?.getAttribute("data-graview-joins");if(oe)try{let I=JSON.parse(oe);if(Array.isArray(I)&&I.every(_=>typeof _=="string")){M.preventDefault(),d({at:Qe(f),ids:I});return}}catch{}if(!z)return;let pe=e.graph.getNode(z);pe&&(M.preventDefault(),r(Z(e.schema,pe.kind,z)))},children:(0,T.jsx)(On,{context:t,place:f,filter:p,...l?.at===Qe(f)?{chosen:l.ids}:{}})}),G.length>0?(0,T.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},"data-testid":"place-creators",children:G.map(({affordance:M,mutation:V})=>(0,T.jsxs)("section",{style:{...ee,display:"grid",gap:14},children:[(0,T.jsx)("h2",{style:J,children:V.title??V.name}),V.description?(0,T.jsx)("p",{style:{...C,margin:0,maxWidth:"58ch"},children:V.description}):null,(0,T.jsx)(Ie,{store:e,mutation:V,prefilled:M.args,open:M.open,label:M.label,...n?{principal:n}:{}})]},M.id))}):null]})}function ct(t){return t.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-|-$/g,"")}function wt(t,e={}){let[n="/",a=""]=t.split("#")[0].split("?"),r=new URLSearchParams(a);e.filter&&r.set("filter",e.filter);let i=r.toString(),o=e.section?ct(e.section):"";return`${n}${i?`?${i}`:""}${o?`#${o}`:""}`}function to(t,e=document){let n=ct(t);if(!n)return null;let a=[e,...[...e.querySelectorAll("[data-worker-view]")].flatMap(r=>r.shadowRoot?[r.shadowRoot]:[])];for(let r of a)for(let i of r.querySelectorAll("[id], [data-section]")){let o=i.getAttribute("data-section")??i.id;if(o===t||ct(o)===n)return i}for(let r of a)for(let i of r.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=heading]"))if(ct(i.textContent??"")===n)return i;return null}function di(t,e={}){if(typeof document>"u"||typeof requestAnimationFrame>"u")return()=>{};let n=e.frames??120,a=0,r=()=>{let i=to(t,e.root??document);if(i){i.hasAttribute("tabindex")||i.setAttribute("tabindex","-1"),i.scrollIntoView?.({block:"start"}),i.focus({preventScroll:!0});return}n-=1,n>0&&(a=requestAnimationFrame(r))};return a=requestAnimationFrame(()=>{a=requestAnimationFrame(r)}),()=>cancelAnimationFrame(a)}var U=D(Fe(),1);var jt=D(Fe(),1);var Ze=D(j(),1);function ci({context:t}){return de()?(0,Ze.jsxs)(Ze.Fragment,{children:[(0,Ze.jsx)(no,{context:t}),(0,Ze.jsx)(Wr,{face:"pages",on:t.quickAsk??!0})]}):null}function no({context:t}){let{store:e}=t,n=de(),{pathname:a}=Pe(),r=(0,jt.useRef)(n?.setSelection);return r.current=n?.setSelection,(0,jt.useEffect)(()=>{let i=r.current;if(!i)return;let[,o,l]=a.split("/"),d=(()=>{if(o==="places"){let p=t.views?.places().find(m=>m.as===decodeURIComponent(l??""));return p?[Oe(p.kind)]:[]}let c=o?Ee(e.schema,o):void 0;return c&&l?[decodeURIComponent(l)]:c?[xa(c)]:[]})();i(c=>c.length===d.length&&c.every((p,m)=>p===d[m])?c:d)},[a]),null}var he=D(Fe(),1);var ui=D(qi(),1);var ce=D(j(),1);var ao=(0,he.lazy)(Sa(()=>(__graviewPreload(import.meta.url,["./chunk.3ZRHHB7X.js","./chunk.UGFDSE37.js","./chunk.ZYCNEOAQ.js","./chunk.4DEUD66C.js","./chunk.LHO7L3CS.js","./chunk.YG423NEB.js","./chunk.VNBR4DHD.js","./chunk.Z3ZKYSPN.js","./chunk.6ONRWFA6.js","./chunk.AFY35RJP.js","./chunk.POHEWJKZ.js","./chunk.ROGYDMES.js","./chunk.6IHXTT6Z.js","./chunk.YXH3IWNR.js","./chunk.OEF3GPRM.js","./chunk.BRHRAVU2.js","./chunk.VTWFVPKD.js","./chunk.ZRQI5VJF.js","./chunk.33GN2NUT.js","./chunk.2VIGF4FO.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.2EJAIT33.js","./chunk.EUGWV3S6.js","./chunk.6XJP7F3I.js","./chunk.NPX7SPXM.js","./chunk.OE4QOBJF.js","./chunk.74RMHUCX.js","./chunk.GZHZLJBF.js","./chunk.I3SQJ2L2.js","./chunk.OJGHDWI6.js","./chunk.FUJM7GDV.js","./chunk.MWZK3HVG.js","./chunk.3D5T3XIE.js","./chunk.GR5Q4HTW.js","./chunk.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.5VBBQ6Z3.js")).then(t=>({default:t.TakeBack}))));function ro({context:t,docked:e,at:n}){let{store:a}=t,r=te(a),[i]=(0,he.useState)(()=>a.batches().length),o=(0,he.useRef)(!1);return o.current||=r>0||!e&&i>0,o.current?(0,ce.jsx)(he.Suspense,{fallback:null,children:(0,ce.jsx)(ao,{context:t,docked:e,at:n,since:i})}):null}function io(t,e,n){let{store:a,principal:r,embedded:i}=t;(0,he.useEffect)(()=>{if(!n)return;let o=l=>{if(!Ur(l))return;let d=l.target,c=d instanceof Node&&e.current?.contains(d),p=d===document.body||d===document.documentElement||d===document;if(!(!c&&!(p&&!i))&&Gr(a,r)){l.preventDefault();try{Vr(a,r)}catch{}}};return document.addEventListener("keydown",o),()=>document.removeEventListener("keydown",o)},[a,r,i,e,n])}function gi({context:t,registry:e,root:n,children:a}){let r=(0,he.useMemo)(ti,[]),i=e?.without()??new Set;return io(t,n,!i.has("undo")),(0,ce.jsxs)(Mn.Provider,{value:r,children:[(0,ce.jsx)(oo,{context:t,placed:r,without:i}),a]})}function oo({context:t,placed:e,without:n}){let[a,r]=(0,he.useState)(!1);(0,he.useLayoutEffect)(()=>r(!0),[]);let i=En(e,"find"),o=En(e,"undo"),l=Pe(),d=fr();if(!a)return null;let c=l.pathname.split("/").filter(Boolean),m=(c.length===1?Ee(t.store.schema,c[0]):void 0)!==void 0;return(0,ce.jsxs)(ce.Fragment,{children:[!i&&!n.has("find")&&d?(0,ui.createPortal)((0,ce.jsx)(pi,{context:t,narrowsLists:m}),d.slot):null,!i&&!n.has("find")&&!d?(0,ce.jsx)("div",{"data-testid":"face-find-bar",style:{display:"flex",alignItems:"center",padding:"8px 16px",borderBottom:"1px solid var(--graview-edge)",background:"var(--graview-bar)",minWidth:0},children:(0,ce.jsx)(pi,{context:t,narrowsLists:m})}):null,!o&&!n.has("undo")?(0,ce.jsx)(ro,{context:t,docked:!0,at:l.pathname+l.search}):null,d?.own&&!n.has("undo")?(0,ce.jsx)(Qr,{context:t,own:d.own}):null]})}function pi({context:t,narrowsLists:e}){return(0,ce.jsx)(Mn.Provider,{value:null,children:(0,ce.jsx)(Nn,{context:t,narrowsLists:e})})}var X=D(Fe(),1);var Ae=D(j(),1),so=500,lo=10;function zt(t){return t instanceof HTMLElement?t.isContentEditable||t.tagName==="TEXTAREA"||t.tagName==="SELECT"?!0:t.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(t.type):!1}function co(t){let e=typeof getSelection=="function"?getSelection():null;return e!==null&&!e.isCollapsed&&e.containsNode(t,!0)}function mi(t){let e=t.closest('a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])');if(e)return e;let n=document.activeElement;return n instanceof HTMLElement&&n!==document.body?n:null}function fi({context:t,root:e,children:n}){return de()===null?(0,Ae.jsx)(Ae.Fragment,{children:n}):(0,Ae.jsx)(po,{context:t,root:e,children:n})}function po({context:t,root:e,children:n}){let{setMenuAt:a}=Ta(),{store:r}=t,i=r.schema,o=We(),{pathname:l,search:d}=Pe(),c=Zr("/").replace(/\/$/,""),p=(0,X.useCallback)((v,y)=>t.views?.places().find(L=>L.as===v&&(y===null||L.kind===y)),[t.views]),m=(0,X.useCallback)((v,y)=>{let[L="",$,g]=v.split("/").filter(Boolean).map(O=>{try{return decodeURIComponent(O)}catch{return O}});if(g!==void 0)return null;if(L==="places"&&$!==void 0){let O=p($,new URLSearchParams(y).get("of"));return O?{face:"pages",place:O.as,about:[Oe(O.kind)],title:O.title}:null}let A=Ee(i,L);return A?$===void 0?{face:"pages",about:[Oe(A)],title:it(i,A)}:r.graph.getNode($)?{face:"pages",on:$,about:[$]}:null:null},[i,r,p]),f=(0,X.useCallback)(v=>{let y=v.href;try{let L=new URL(y,location.href);if(L.origin===location.origin&&(c===""||L.pathname===c||L.pathname.startsWith(`${c}/`))){let $=m(L.pathname.slice(c.length),L.search);if($)return{...$,href:y}}}catch{}return{face:"pages",about:[],href:y}},[c,m]),u=(0,X.useCallback)(()=>m(l,d)??{face:"pages",about:[]},[m,l,d]),k=(0,X.useCallback)(v=>{let y=u(),L=v.closest("[data-graview-field]")?.getAttribute("data-graview-field");if(L&&y.on!==void 0&&v.closest("[data-graview-pick], a[href]")===null)return{...y,field:L};let $=v.closest("[data-graview-act]")?.getAttribute("data-graview-act");if($)return{...y,act:$};let g=v.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(g&&r.graph.getNode(g))return{face:"pages",on:g,about:[g],href:`${c}${Z(i,r.graph.getNode(g).kind,g)}`};let A=v.closest("a[href]");if(A)return f(A);let O=v.closest("[data-graview-record]")?.getAttribute("data-graview-record");return O&&r.graph.getNode(O)?{face:"pages",on:O,about:[O]}:y},[u,f,r,i,c]),q=(0,X.useCallback)(v=>{let y=e.current;if(y===null||!y.contains(v)||zt(v)||v.closest("[data-graview-popover]"))return null;let L=k(v);return{face:"pages",on:L.on,about:L.about??[],field:L.field,place:L.place,href:L.href,act:L.act,element:mi(v)}},[k,e]),h=(0,X.useCallback)((v,y,L)=>{let $=k(v);a({...$,x:Math.round(y),y:Math.round(L),returnTo:mi(v)})},[k,a]),R=(0,X.useCallback)(v=>{let y=v.getBoundingClientRect();h(v,y.left+Math.min(16,y.width/2),Math.min(y.bottom,y.top+36))},[h]),G=(0,X.useRef)(0),M=(0,X.useRef)(null),V=(0,X.useRef)(!1),z=()=>{M.current&&clearTimeout(M.current.timer),M.current=null};(0,X.useEffect)(()=>z,[]),(0,X.useEffect)(()=>{let v=y=>{if(y.defaultPrevented||!(y.key==="ContextMenu"||y.key==="F10"&&y.shiftKey))return;let L=e.current,$=y.target instanceof Element?y.target:null,g=$===null||$===document.body||$===document.documentElement,A=L!==null&&$!==null&&L.contains($);if(!A&&!(g&&document.querySelector("[data-graview-face='pages']")===L)||zt($)||$?.closest("[data-graview-popover]"))return;y.preventDefault(),G.current=Date.now();let O=A&&$ instanceof HTMLElement?$:L?.querySelector("[data-graview-page-title], main h1, main")??null;O&&R(O)};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[e,R]),(0,X.useEffect)(()=>{let v=e.current;if(!v)return;let y=L=>{let $=L.detail;$&&a({...$,face:"pages"})};return v.addEventListener(hn,y),()=>v.removeEventListener(hn,y)},[e,a]);let oe=(0,X.useMemo)(()=>v=>{if(v.face!=="pages")return null;let y=[],L=v.on===void 0?void 0:r.graph.getNode(v.on),$=v.place===void 0?void 0:t.views?.places().find(Te=>Te.as===v.place),g=L?void 0:v.about.length===1&&v.about[0].startsWith("aggregate:")&&!$?uo(v.about[0]):void 0,A=L?Z(i,L.kind,L.id):$?ye(t,$):g?`/${Y(i,g)}`:void 0,O=A!==void 0&&l===A.split("?")[0];A!==void 0&&!O&&y.push({id:"open",label:"Open",run:()=>o(A)});let ge=A!==void 0?`${c}${A}`:v.href;ge!==void 0&&y.push({id:"open-in-a-new-tab",label:"Open in a new tab",run:()=>void window.open(ge,"_blank","noopener")});let et=L?`#focus=${encodeURIComponent(L.id)}`:$?`#focus=${encodeURIComponent(Oe($.kind))}&view=${encodeURIComponent($.as)}`:g?`#focus=${encodeURIComponent(Oe(g))}`:void 0;if(et!==void 0&&(t.overview||!t.embedded)){let Te=t.overview;y.push({id:"in-the-scene",label:"Show in the scene",run:()=>Te?Te(et):location.assign(`${t.sceneHref??"/"}${et}`)})}return L===void 0&&v.href===void 0&&y.push({id:"find",label:"Find\u2026",run:()=>{let Te=e.current?.querySelector('[data-testid="nav-find"]')??document.querySelector('[data-testid="nav-find"]');Te&&Te.offsetParent!==null?Te.focus():o("/search")}}),y.length>0?{id:"pages",items:y}:null},[r,i,t,l,c,o,e]),pe=(0,X.useMemo)(()=>v=>{if(v.face!=="pages"||v.field===void 0||v.on===void 0)return null;let y=r.graph.getNode(v.on),L=v.element?.closest("[data-graview-field]")??e.current?.querySelector(`[data-graview-field="${CSS.escape(v.field)}"]`);return!y||!(L instanceof HTMLElement)||!L.hasAttribute("data-graview-editable")?null:{id:"field",at:"start",items:[{id:"change-field",label:`Change \u201C${sa(i.tryDefinition(y.kind),v.field)}\u201D`,run:()=>L.click()}]}},[r,i,e]),I=Kr(),_=ir(),ie=Rr(),ve=(0,X.useCallback)((v,y)=>{l===ye(t,v).split("?")[0]&&o(y?ye(t,y):"/")},[l,t,o]),se=qr(ve),ue=(0,X.useMemo)(()=>[pe,ie,oe,...se?[se]:[],..._?[_]:[],...I?[I]:[]],[pe,ie,oe,se,_,I]);return(0,Ae.jsxs)(Ja,{sections:ue,children:[(0,Ae.jsx)("div",{"data-graview-menu-ground":"",style:{display:"contents"},onContextMenu:v=>{let y=v.target;v.shiftKey||zt(y)||co(y)||(v.preventDefault(),!y.closest("[data-graview-popover]")&&(Date.now()-G.current<700||(v.clientX===0&&v.clientY===0&&y instanceof HTMLElement?R(y):h(y,v.clientX,v.clientY))))},onPointerDown:v=>{if(V.current=!1,v.pointerType==="mouse"||!v.isPrimary)return;let y=v.target;if(zt(y)||y.closest("[data-graview-choose], [data-graview-popover]"))return;z();let{clientX:L,clientY:$}=v;M.current={x:L,y:$,timer:setTimeout(()=>{M.current=null,V.current=!0,G.current=Date.now(),h(y,L,$)},so)}},onPointerMove:v=>{let y=M.current;y&&Math.hypot(v.clientX-y.x,v.clientY-y.y)>lo&&z()},onPointerUp:z,onPointerCancel:z,onClickCapture:v=>{V.current&&(V.current=!1,v.preventDefault(),v.stopPropagation())},children:n}),(0,Ae.jsx)(go,{openAt:R,readyAt:q}),(0,Ae.jsx)(Br,{placement:"page"}),(0,Ae.jsx)(or,{})]})}function uo(t){let e=t.slice(10).split("+");return e.length===1&&e[0]?e[0]:void 0}function go({openAt:t,readyAt:e}){return(0,Ae.jsx)("span",{"data-graview-menu-home":"",tabIndex:-1,onFocus:n=>{if(n.target!==n.currentTarget)return;let a=n.currentTarget.closest("[data-graview-face]"),r=a?.querySelector("[data-graview-page-title]")??a?.querySelector("main h1, main")??null;r&&(r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0}))},style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:(0,Ae.jsx)(Dr,{placement:"menu",openActs:t,aimAt:e})})}var H=D(j(),1);function yi(t,e){return e==="*"?{label:"anything",path:null}:{label:Q(t,e),path:`/${Y(t.schema,e)}`}}function mo({context:t,relation:e}){let{store:n}=t,a=yi(n,e.from),r=yi(n,e.to),i=o=>o.path?(0,H.jsx)(F,{to:o.path,style:{...Se,fontWeight:550},children:o.label}):(0,H.jsx)("span",{children:o.label});return(0,H.jsxs)("li",{"data-testid":"relation","data-relation":e.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,H.jsx)(Hr,{edgeKind:e.edgeKind,...t.brand?.kit?{kit:t.brand.kit}:{}}),(0,H.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,H.jsxs)("span",{children:[i(a)," ",(0,H.jsxs)("span",{style:C,"data-graview-speaks-ids":"",children:[be(e.edgeKind)," \u2192"]})," ",i(r)]}),e.description||e.inverse?(0,H.jsxs)("span",{style:C,children:[e.description?Ce(e.description):null,e.description&&e.inverse?" \xB7 ":null,e.inverse?`from the other end, ${e.inverse}`:null]}):null]}),r.path?(0,H.jsx)(F,{to:`${r.path}?with=${encodeURIComponent(e.edgeKind)}`,style:{...K,...C,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${r.label.toLowerCase()} that have this`,children:e.count}):(0,H.jsx)("span",{style:{...C,fontVariantNumeric:"tabular-nums"},children:e.count})]})}function hi({context:t,heading:e=!0}){let{store:n}=t,a=new Set(Ge(n,t.principal)),r=_e(n).relations.filter(i=>a.has(i.from)&&(i.to==="*"||a.has(i.to)));return r.length===0?null:(0,H.jsxs)("section",{style:{...ee,display:"grid",gap:12},"data-testid":"kind-map",children:[e?(0,H.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,H.jsx)("h2",{style:J,children:(0,H.jsx)(F,{to:"/map",style:Se,children:"Connections"})}),(0,H.jsx)("span",{style:C,children:r.length===1?"1 relation":`${r.length} relations`})]}):null,(0,H.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:r.map(i=>(0,H.jsx)(mo,{context:t,relation:i},`${i.edgeKind}|${i.from}|${i.to}`))})]})}function Kn({context:t}){let{store:e}=t;te(e);let n=new Set(Ge(e,t.principal)),a=_e(e),r=a.relations.filter(i=>n.has(i.from));return(0,H.jsxs)(ne,{context:t,children:[(0,H.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,H.jsx)("p",{style:ke,children:r.length===0?"No relations":`${r.length} ${r.length===1?"relation":"relations"}`}),(0,H.jsx)(re,{context:t,children:"Connections"}),(0,H.jsx)("p",{style:ae,children:r.length===0?"Nothing here is declared to relate to anything else yet.":"The kinds this installation holds, and the relations declared between them \u2014 each in the declaration's own words, with how many of it there are."})]}),(0,H.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:a.kinds.filter(i=>n.has(i.kind)).map(i=>(0,H.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,H.jsx)(fe,{kind:i.kind,brand:t.brand,schema:e.schema,size:7}),(0,H.jsx)(F,{to:`/${Y(e.schema,i.kind)}`,style:K,children:i.plural}),(0,H.jsx)("span",{style:C,children:i.count})]},i.kind))}),(0,H.jsx)(hi,{context:t,heading:!1})]})}function wi({context:t}){let n=[...de()?.robots.values()??[]].filter(r=>r.mode==="asking"&&r.say);if(n.length===0)return null;let{store:a}=t;return(0,H.jsxs)("section",{style:{...ee,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,H.jsx)("h2",{style:J,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,H.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(r=>{let i=r.at?a.graph.getNode(r.at):void 0;return(0,H.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,H.jsx)("span",{children:r.say}),i?(0,H.jsxs)(F,{to:Z(a.schema,i.kind,i.id),style:{...K,...C},children:[me(a.schema.tryDefinition(i.kind),i)," \u2192"]}):null]},r.participant)})})]})}var B=D(j(),1);function Bn({context:t}){let{principal:e}=t,{store:n,brand:a,invariantContext:r}=t;te(n);let i=n.violations(r),o=`${i.length===1?"A rule is broken":"Rules are broken"} \u2014 see what, and what would fix it`,l=[...n.log.all()].slice(-5).reverse(),c=Bt(t).map(R=>({kind:R,members:n.graph.nodesOfKind(R).filter(G=>rt(n.schema.tryDefinition(R),G))})),p=c.filter(R=>R.members.length>0),m=c.map(R=>({entry:R,creator:n.allMutations().find(G=>(G.creates??[]).includes(R.kind)&&n.permits({name:G.name,args:{}},t.principal).ok)})).find(R=>R.creator!==void 0),f=p.length===0?"Nothing here yet.":`${p.map(R=>Ct(n.schema,R.kind,R.members.length)).join(", ").replace(/, ([^,]*)$/," and $1")}.`,u=t.views?.homeView?.(),k=n.schema.kinds.some(R=>n.graph.nodesOfKind(R).length>0);if(u&&k){let R=a?.subtitle?(0,B.jsx)("p",{style:{...C,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,G=u[Symbol.for("graview.home-blocks")]===!0;return(0,B.jsx)(ne,{context:t,style:lt,children:(0,B.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[G?null:R,i.length>0?(0,B.jsx)(F,{to:"/problems",style:{...K,color:"var(--graview-warn)"},children:o}):null,(0,B.jsx)(Or.Provider,{value:G?R:null,children:(0,B.jsx)(u,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})]})})}let q=new Set(Ge(n,t.principal)),h=_e(n).relations.filter(R=>q.has(R.from)&&(R.to==="*"||q.has(R.to)));return(0,B.jsxs)(ne,{context:t,style:lt,children:[(0,B.jsxs)("header",{style:{display:"grid",gap:12},children:[a?.subtitle?(0,B.jsx)("p",{style:{...C,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,(0,B.jsx)(re,{context:t,"data-testid":"standing",children:f}),(0,B.jsxs)("p",{style:{...ae,display:"grid",gap:4},"data-testid":"standing-card",children:[p.length===0&&m?(0,B.jsxs)("span",{children:["Begin with \u201C",m.creator?.title??m.creator?.name,"\u201D, under"," ",(0,B.jsx)(F,{to:`/${Y(n.schema,m.entry.kind)}`,style:K,children:Q(n,m.entry.kind)}),"."]}):null,i.length===0?(0,B.jsx)("span",{children:"All rules hold."}):(0,B.jsx)(F,{to:"/problems",style:{...K,color:"var(--graview-warn)"},children:o})]})]}),(0,B.jsx)(Dn,{context:t}),(0,B.jsxs)("section",{style:{...ee,display:"grid",gap:14},"data-testid":"kinds",children:[(0,B.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,B.jsx)("h2",{style:J,children:"What is here"}),h.length>0?(0,B.jsxs)(F,{to:"/map",style:{...K,...C,marginLeft:"auto"},"data-testid":"map-link",children:["Connections \xB7 ",h.length===1?"1 relation":`${h.length} relations`," ",(0,B.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]}):null]}),(0,B.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:c.map(({kind:R,members:G})=>(0,B.jsx)("li",{style:{maxWidth:"100%"},children:(0,B.jsxs)(F,{to:`/${Y(n.schema,R)}`,style:{...Se,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,B.jsx)(fe,{kind:R,brand:a,schema:n.schema,size:7}),(0,B.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:Q(n,R)}),(0,B.jsx)("span",{style:{...C,fontVariantNumeric:"tabular-nums"},children:G.length===0?"none yet":mt(G.length)})]})},R))})]}),l.length>0?(0,B.jsxs)("section",{style:{...ee,display:"grid",gap:10},children:[(0,B.jsx)("h2",{style:J,children:"Recently"}),(0,B.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:l.map(R=>(0,B.jsxs)("li",{style:C,children:[(0,B.jsx)("span",{style:{color:"var(--graview-ink)"},children:R.intent})," \u2014 ",yt(R,e,{graph:n.graph,schema:n.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},R.id))})]}):null]})}var Ne=D(Fe(),1);var Xe=D(j(),1);function _t({context:t,withheld:e,style:n,testId:a}){let r=de(),i=ya(e,t.signIn??r?.signIn);return i?(0,Xe.jsx)("p",{style:{...n,margin:0},children:(0,Xe.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>i.run(),style:xe,children:i.label})}):e.length===0?null:(0,Xe.jsx)("ul",{style:{...n,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},...a?{"data-testid":a}:{},children:e.map(o=>(0,Xe.jsxs)("li",{style:C,children:[(0,Xe.jsx)("s",{children:o.label})," \u2014 ",o.refusal.message]},o.id))})}var E=D(j(),1);function qn({context:t}){let{store:e,brand:n,principal:a,invariantContext:r}=t;te(e);let[i]=dt(),o=i.get("q")??"",l=typeof r?.today=="string"?r.today:void 0,d=Sr(e,o,{...a?{principal:a}:{},places:Le(t),flagged:new Set(e.violations(r).flatMap(u=>u.nodeIds)),...l?{today:l}:{},limit:200}),c=d.hits.filter(u=>u.about==="node"),p=d.hits.filter(u=>u.about==="kind"||u.about==="place"||u.about==="rule"),m=[...new Set(c.map(u=>u.kind))],f=o.trim();return(0,E.jsxs)(ne,{context:t,children:[(0,E.jsx)("style",{children:Ht}),(0,E.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,E.jsx)("p",{style:ke,children:"Search"}),(0,E.jsx)(re,{context:t,"data-testid":"search-heading",children:f.length===0?"Find anything by its name":d.hits.length===0?(0,E.jsxs)(E.Fragment,{children:["Nothing here is called \u201C",f,"\u201D."]}):(0,E.jsxs)(E.Fragment,{children:[fo(e,d.byKind)," for \u201C",f,"\u201D"]})}),f.length>0?(0,E.jsxs)("p",{style:{...C,margin:0},"data-testid":"search-searched",children:[$t(e.schema,d.searched),d.conditions.filter(u=>u.key!=="is"&&u.admittedBy.length<d.searched.kinds.length).map(u=>(0,E.jsxs)("span",{children:[" ",u.key,":",u.value," narrows"," ",u.admittedBy.length===0?"nothing here":u.admittedBy.map(k=>Q(e,k).toLowerCase()).join(" and "),"."]},`${u.key}:${u.value}`))]}):(0,E.jsxs)("p",{style:ae,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,E.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,E.jsx)("code",{children:"is:any"})," includes what is past."]})]}),p.length>0?(0,E.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:p.map(u=>(0,E.jsx)("li",{"data-testid":"search-hit","data-about":u.about,children:u.about==="kind"?(0,E.jsxs)(F,{to:`/${Y(e.schema,u.kind)}`,style:K,children:[u.label,u.count>0?(0,E.jsxs)("span",{style:C,children:[" \xB7 ",u.count," match"]}):null]}):u.about==="place"?(0,E.jsxs)(F,{to:ye(t,u),style:K,children:["Go to ",u.title]}):u.about==="rule"?(0,E.jsxs)(F,{to:"/problems",style:K,children:["The rule \u201C",u.label,"\u201D"]}):null},`${u.about}:${u.about==="rule"?u.name:u.about==="place"?u.as:u.kind}`))}):null,m.map(u=>(0,E.jsxs)("section",{className:"graview-list",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",minWidth:0},"data-testid":"search-group","data-kind":u,children:[(0,E.jsxs)("h2",{className:"graview-group-head",style:{alignItems:"center"},children:[(0,E.jsx)(fe,{kind:u,brand:n,schema:e.schema,size:8}),(0,E.jsx)(F,{to:`/${Y(e.schema,u)}?${new URLSearchParams({q:f}).toString()}`,style:K,"data-testid":"search-kind-link",children:Q(e,u)}),(0,E.jsx)("span",{children:d.byKind[u]})]}),(0,E.jsx)("ul",{className:"graview-rows",children:c.filter(k=>k.kind===u).map(k=>(0,E.jsxs)("li",{"data-testid":"search-hit","data-about":"node",className:"graview-row",children:[(0,E.jsxs)(F,{to:Z(e.schema,u,k.id),className:"graview-row-title",...k.label.length>60?{title:k.label}:{},children:[k.flagged?(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,k.label]}),k.apart||!k.current?(0,E.jsx)("span",{className:"graview-row-glance",children:[k.apart,k.current?"":"past"].filter(Boolean).join(" \xB7 ")}):null,(0,E.jsx)(Yt,{why:k.why})]},k.id))})]},u)),f.length>0?(0,E.jsx)(yo,{asked:f}):null,f.length>0&&d.hits.length===0?(0,E.jsx)(bi,{store:e,kinds:d.searched.kinds,words:d.words,...a?{principal:a}:{},...r?{invariantContext:r}:{}}):null]})}function Yt({why:t}){return t.strength==="near"?(0,E.jsxs)("span",{style:C,"data-testid":"search-why","data-near":"",children:["Near \u201C",t.asked,"\u201D",t.field==="label"?"":` \u2014 ${t.reading}: ${t.fragment}`]}):t.field==="label"?null:(0,E.jsxs)("span",{style:C,"data-testid":"search-why",children:[t.reading,": ",t.fragment]})}function fo(t,e){let n=Object.entries(e).map(([a,r])=>`${r} ${r===1?Be(t.schema.tryDefinition(a),a):Q(t,a).toLowerCase()}`);return n.length===0?"Found":n.length===1?Ce(n[0]):Ce(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function vi(t,e,n={}){let a=[];for(let r of e){let i=ze(t,r,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let o of Qt(t,r,i.actions.affordances))a.some(l=>l.mutation.name===o.mutation.name)||a.push(o)}return a}function Qt(t,e,n){let a=t.schema.tryDefinition(e)?.fieldRoles?.label,r=[];for(let i of n){let o=t.allMutations().find(c=>c.name===i.mutation);if(!o||!o.creates?.includes(e)||r.some(c=>c.mutation.name===o.name))continue;let l=Nt(o.input).map(c=>c.name),d=l.includes("label")?"label":a&&l.includes(a)?a:void 0;!d||i.args[d]!==void 0||r.push({kind:e,affordance:i,mutation:o,arg:d})}return r}function bi({store:t,kinds:e,words:n,principal:a,invariantContext:r}){let i=vi(t,e,{...a?{principal:a}:{},...r?{invariantContext:r}:{}});return i.length===0||n.trim().length===0?null:(0,E.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:i.map(({kind:o,affordance:l,mutation:d,arg:c})=>(0,E.jsxs)("section",{style:{...ee,display:"grid",gap:14},children:[(0,E.jsxs)("h2",{style:J,children:[Ce(la(Be(t.schema.tryDefinition(o),o)))," called \u201C",n,"\u201D"]}),(0,E.jsx)(Ie,{store:t,mutation:d,prefilled:l.args,open:l.open,initial:{[c]:n},...a?{principal:a}:{}})]},`${l.id}|${n}`))})}function yo({asked:t}){let e=de();return e?(0,E.jsx)(ho,{asked:t,desk:e.aiDesk}):null}function ho({asked:t,desk:e}){return Ia(e)?(0,E.jsx)("p",{style:{margin:0},children:(0,E.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:a=>Fa(e,{pointed:{about:[]},asked:t,returnTo:a.currentTarget}),style:{...K,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",t,"\u2019"]})}):null}var b=D(j(),1),Si=8,xi=40;function wo(t,e){let n=e?.fields?.shape??{},a=Object.keys(n).find(r=>ca(n[r])&&da(t[r]));return a===void 0?void 0:t[a]}function Gn({context:t}){let e=Ve(),n=Ee(t.store.schema,e.slug??"");return n?(0,b.jsx)(Pi,{context:t,kind:n}):(0,b.jsx)(ne,{context:t,children:(0,b.jsx)(re,{context:t,children:"No such kind of thing here."})})}function Pi({context:t,kind:e,opening:n,row:a,layout:r="list",description:i,bare:o}){let{store:l,brand:d,invariantContext:c}=t;te(l);let[p,m]=dt(),f=`list-${(0,Ne.useId)().replace(/:/g,"")}`,u=l.schema.tryDefinition(e),k=ua(p.get("archived")),q=l.graph.nodesOfKind(e,{archived:k}),h=_e(l).relations.filter(s=>s.from===e||s.to===e),R=new Set(l.violations(c).flatMap(s=>s.nodeIds)),G=vr(l.schema,wr(l.schema,hr(l.schema,e))),M=h.map(s=>s.edgeKind),V=Po(p,G,M),z=["sort","filter","group","q","by","with","past","archived",...M].some(s=>p.has(s)),oe=q.length>=xi,pe=u?.fieldRoles?.when,I=t.views?.arrangement?.()?.lists?.[e],_=ur(I),ie=pr(I?.group),ve=xo(oe,pe),se=n??(_?{...ve,..._}:ve),ue=z?V.arrangement:Pn(se,G).arrangement,v=_?.sort,y=ue.sort&&v?.then&&ue.sort.by===v.by&&ue.sort.direction===v.direction?{...ue,sort:v}:ue,L=br(y.query??""),$=[...y.filter??[],...L.conditions].some(s=>s.key==="is"&&(s.value==="past"||s.value==="any"))||yr(u,[...y.filter??[],...L.conditions]),g=$||!u?.lifecycle?y:{...y,filter:[...y.filter??[],{key:"is",value:"current"}]},A=new Map,O=Ot(q,g,{schema:l.schema,graph:l.graph,flagged:R,...typeof c?.today=="string"?{today:c.today}:{},read:(s,w)=>{let N=A.get(s.id);return N||A.set(s.id,N=ft(l.schema,l.graph,s)),N[w]}}),ge=ie&&y.group?.by===ie.by&&!y.group.bucket?G.groups.find(s=>s.key===ie.by):void 0,et=ie&&ge&&(ge.type==="choice"||ge.type==="boolean")?gr(O.groups,ie,{type:ge.type,...ge.options?{options:ge.options}:{}}):O.groups.map(s=>({...s,closed:!1})),Te=new Set((p.get("open")??"").split(",").filter(Boolean)),Mi=!!y.query||(y.filter??[]).some(s=>s.key===ie?.by),zn=s=>ge?.type==="boolean"?s==="1"?"true":"false":s,_n=s=>s.closed&&!Mi&&!Te.has(zn(s.key)),Ei=s=>{let w=new URLSearchParams(p),N=new Set(Te);N.has(s)?N.delete(s):N.add(s),N.size>0?w.set("open",[...N].join(",")):w.delete("open"),m(w,{replace:!0})},De=O.nodes,pt=u?.lifecycle&&!$?q.filter(s=>rt(u,s)):q,Yn=q.length-pt.length,Jt=y.group?.by??null,Ni=s=>{let w=new URLSearchParams(p);for(let le of["sort","filter","group","q","by","with","past","archived",...h.map(Pt=>Pt.edgeKind)])w.delete(le);let N=xr(s);for(let le of["sort","filter","group","q","archived"])N[le]&&w.set(le,N[le]);![...w.keys()].some(le=>["sort","filter","group","q"].includes(le))&&(n||_||oe||pe)&&w.set("sort",""),m(w)},{principal:tt}=t,en=ze(l,e,{...tt?{principal:tt}:{},...t.invariantContext?{context:t.invariantContext}:{}}),Ke=en.actions.affordances.map(s=>({affordance:s,mutation:l.allMutations().find(w=>w.name===s.mutation)})).filter(s=>s.mutation!==void 0),$i=en.actions.withheld,tn=()=>new Set(De.length===0?Ke.map(({mutation:s})=>s.name):[]),[nn,Qn]=(0,Ne.useState)(()=>({kind:e,open:tn()}));nn.kind!==e&&Qn({kind:e,open:tn()});let Zn=s=>(nn.kind===e?nn.open:tn()).has(s),Xn=(s,w)=>Qn(N=>{let le=new Set(N.open);return w?le.add(s):le.delete(s),{kind:N.kind,open:le}}),Jn=`begin-${(0,Ne.useId)().replace(/:/g,"")}`,ea=L.words&&De.length===0?Object.fromEntries(Qt(l,e,en.actions.affordances).map(s=>[s.mutation.name,s.arg])):{},nt=Q(l,e),bt=t.views?.lookup(e,{cardinality:"one",fidelity:"glyph"}),an=bt!==void 0&&!ot(bt)?bt:void 0,rn=(y.group?.bucket??"day")==="day"?y.group?.by:void 0,on=(y.filter??[]).map(s=>s.key),Oi=on.filter(s=>on.indexOf(s)===on.lastIndexOf(s)&&/choice|boolean/.test(G.filters.find(w=>w.key===s)?.type??"")),sn=s=>{let w={...u?.computed?ft(l.schema,l.graph,s):s};rn&&!String(w[rn]).includes("T")&&delete w[rn];for(let N of Oi)delete w[N];return w},kt=s=>{let w=me(u,s);if(a)return(0,b.jsxs)("li",{"data-testid":"record-row","data-graview-record":s.id,style:{minWidth:0},...un(s.id),children:[pn(s,w),a(s,{label:w,href:Z(l.schema,e,s.id),flagged:R.has(s.id),glance:Kt(sn(s),u,w)})]},s.id);if(an){let gn=Wt(bt,s,l.graph),Ki=Object.fromEntries(Object.entries(sn(s)).filter(([Bi])=>!gn?.fields.has(Bi))),ia=gn?Kt(Ki,u,gn.title??w):"";return(0,b.jsxs)("li",{"data-testid":"record-row","data-graview-record":s.id,style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,paddingBlock:10,borderTop:"1px solid var(--graview-edge)"},...un(s.id),children:[pn(s,w),(0,b.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,b.jsx)(an,{node:s,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...R.has(s.id)?{flagged:[s.id]}:{}})}),ia?(0,b.jsx)("span",{style:{...C,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:ia}):null,(0,b.jsx)(Ro,{to:Z(l.schema,e,s.id),label:R.has(s.id)?`${w} \u2014 implicated in a problem`:w})]},s.id)}let N=Kt(sn(s),u,w),le=L.words?kr(u,s,L.words):void 0,Pt=oe?void 0:Xa(s,u),At=wo(s,u),ra=(0,b.jsxs)(F,{to:Z(l.schema,e,s.id),className:"graview-row-title",...w.length>60?{title:w}:{},children:[R.has(s.id)?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,w]});return(0,b.jsxs)("li",{className:"graview-row","data-graview-record":s.id,...un(s.id),children:[pn(s,w),Pt?(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:14,minWidth:0},children:[(0,b.jsx)(qe,{as:"thumb",file:Pt}),ra]}):ra,N||At?(0,b.jsxs)("span",{className:"graview-row-glance",children:[N,N&&At?" \xB7 ":null,At?(0,b.jsx)(Ft,{address:At}):null]}):null,le?(0,b.jsx)(Yt,{why:le}):null]},s.id)},ln=Le(t).filter(s=>s.kind===e),ta=I?.filters,Fi=(y.filter??[]).some(s=>s.key!=="is"||s.value!=="any"),Ii=!!(y.sort||y.group||y.query||Fi),Di=pt.length>=Si||z&&Ii,$e=y.sort?G.sorts.find(s=>s.key===y.sort.by):void 0,dn=$e?.type==="date"||$e!==void 0&&$e.key===pe,na=oe&&!O.grouped&&$e&&($e.about==="label"||$e.type==="text"||dn)?s=>{let w=$e.about==="label"?me(u,s):s[$e.key];if(typeof w!="string"||w.length===0)return dn?"No date":"#";if(dn)return w.slice(0,4);let N=w.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test(N)?N:"#"}:void 0,je=na?De.reduce((s,w)=>{let N=na(w);return s.at(-1)?.key===N?s.at(-1).nodes.push(w):s.push({key:N,nodes:[w]}),s},[]):void 0,aa=O.grouped&&Jt?et.flatMap(s=>_n(s)?[]:s.nodes):je&&je.length>1?je.flatMap(s=>s.nodes):De,cn=(0,Ne.useMemo)(()=>aa.map(s=>s.id),[aa.map(s=>s.id).join(`
109
+ `)]),Me=Lr(cn),ut=(tt?l.permittedMutations(tt):l.permittedMutations()).some(s=>{let w=s.subject?.kinds;return w!==void 0&&(w==="*"||w.includes(e))}),pn=(s,w)=>ut?(0,b.jsx)("span",{className:"graview-choose-at",children:(0,b.jsx)("input",{...Me.boxProps(s.id,w),onPointerEnter:An,onFocus:An})}):null,un=s=>ut?{"data-graview-choose":s}:{},Wi=(0,Ne.useCallback)(s=>{Me.choose(s),requestAnimationFrame(()=>{let w=Me.list.current;((s[0]===void 0?null:w?.querySelector(`[data-graview-choose-box="${CSS.escape(s[0])}"]`))??w)?.focus({preventScroll:!0})})},[Me]),at=r==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",alignItems:"start",gap:12}:a||an?{margin:0,padding:0,listStyle:"none",display:"grid",gap:a&&r==="list"?6:0}:void 0,St=at?void 0:"graview-rows",gt=s=>`list-at-${s.replace(/[^\p{L}\p{N}]/gu,"_")}`,xt=h.map(s=>{let w=s.from===e?s.to:s.from,N=s.from===e?s.description:s.inverse??s.description;return{relation:s,far:w,words:N}}),Hi=new Set(xt.map(s=>(s.words??"").toLowerCase()).filter((s,w,N)=>s&&N.indexOf(s)!==w));return(0,b.jsxs)(o?So:ne,{context:t,children:[(0,b.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,b.jsxs)("header",{style:{display:"grid",gap:4},children:[(0,b.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",columnGap:10,rowGap:4,minWidth:0},children:[(0,b.jsx)(fe,{kind:e,brand:d,schema:l.schema,size:8}),(0,b.jsx)(re,{context:t,children:nt}),Ke.length>0?(0,b.jsx)("span",{style:{marginLeft:"auto",display:"flex",flexWrap:"wrap",columnGap:14,rowGap:8},"data-testid":"beginnings-open",children:Ke.map(({affordance:s,mutation:w})=>(0,b.jsx)(Ao,{name:w.name,title:w.title??w.name,panel:`${Jn}-${w.name}`,open:Zn(w.name),onOpen:N=>Xn(w.name,N)},s.id))}):null]}),i??u?.description?(0,b.jsx)("p",{style:ae,children:i??u?.description}):null,xt.length>0||ln.length>0?(0,b.jsxs)("p",{style:{...C,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[xt.length>0?(0,b.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",xt.map(({relation:s,far:w,words:N},le)=>(0,b.jsxs)("span",{"data-relation":s.edgeKind,children:[le>0?(0,b.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,w==="*"?Ce(N??be(s.edgeKind)):(0,b.jsx)(F,{to:`/${Y(l.schema,w)}`,style:K,title:Q(l,w),children:N&&Hi.has(N.toLowerCase())?`${Ce(N)}: ${Q(l,w).toLowerCase()}`:Ce(N??Q(l,w))})]},`${s.edgeKind}|${s.from}|${s.to}`))]}):null,ln.length>0?(0,b.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",ln.map((s,w)=>(0,b.jsxs)("span",{children:[w>0?(0,b.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,b.jsx)(F,{to:ye(t,s),style:K,children:s.title})]},Qe(s)))]}):null]}):null]}),Ke.length>0?(0,b.jsx)("div",{style:{display:"contents"},"data-testid":"beginnings",children:Ke.map(({affordance:s,mutation:w})=>{let N=!!(ea[w.name]&&De.length===0);return(0,b.jsx)(Co,{name:w.name,id:`${Jn}-${w.name}`,description:w.description,open:Zn(w.name),onClose:()=>Xn(w.name,!1),children:(0,b.jsx)(Ie,{store:l,mutation:w,prefilled:s.args,open:s.open,...N?{initial:{[ea[w.name]]:L.words}}:{},...t.principal?{principal:t.principal}:{}},N?`${w.name}|${L.words}`:w.name)},s.id)})}):null,V.dropped.length>0?(0,b.jsxs)("p",{style:{...C,margin:0},"data-testid":"list-dropped",children:["This link asked for ",V.dropped.join(", "),", which ",nt.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,pt.length>0?(0,b.jsx)(Cr,{schema:l.schema,graph:l.graph,kind:e,arrangement:y,onChange:Ni,kept:{shown:De.length,of:pt.length},noun:{one:Be(u,e),many:nt.toLowerCase()},...Di?{}:{allow:!1},...ta?{filters:ta}:{},offers:G,chips:{nodes:pt,flagged:R,...typeof c?.today=="string"?{today:c.today}:{}},query:t.framed===!0&&t.barAbove!==!0}):null,(0,b.jsx)("style",{children:Ht}),ut?(0,b.jsx)("style",{children:Tr+ko}):null,(0,b.jsx)("div",{className:"graview-list",...ut?{...Me.listProps,ref:Me.list,tabIndex:-1,"data-graview-choosable":"","aria-label":Me.chosen.length>0?`${nt}, ${Me.chosen.length} chosen`:nt,role:"group"}:{},children:De.length===0&&L.words?(0,b.jsxs)("p",{style:ae,"data-testid":"none-yet",children:["Nothing here is called \u201C",L.words,"\u201D."," ",(0,b.jsx)("span",{style:C,"data-testid":"list-searched",children:$t(l.schema,{kinds:[e],past:$})})," ",(0,b.jsx)(F,{to:"?",style:K,children:"Show every one"})]}):De.length===0?(0,b.jsxs)("p",{style:ae,"data-testid":"none-yet",children:[y.filter?.length||y.query?"None of them.":"None yet",!y.filter?.length&&!y.query&&Ke.length>0?` \u2014 the first one starts above, with \u201C${Ke[0]?.mutation.title??Ke[0]?.mutation.name}\u201D.`:!y.filter?.length&&!y.query?".":"",y.filter?.length||y.query?(0,b.jsxs)(b.Fragment,{children:[" ",(0,b.jsx)(F,{to:"?",style:K,children:"Show every one"})]}):null]}):O.grouped&&Jt?(0,b.jsx)("div",{style:{display:"grid",gap:"1rem"},"data-testid":"records","data-grouped":Jt,children:et.map(s=>{if(!s.closed)return(0,b.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,b.jsxs)("h2",{className:"graview-group-head",children:[s.label," ",(0,b.jsx)("span",{children:s.nodes.length})]}),(0,b.jsx)("ul",{style:at,className:St,"data-graview-rows":"",children:s.nodes.map(kt)})]},s.key||"-");let w=_n(s),N=`${f}-${gt(s.key||"none")}`;return(0,b.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group","data-closed":w?"shut":"open",children:[(0,b.jsx)("h2",{className:"graview-group-head",children:(0,b.jsxs)("button",{type:"button",className:"graview-group-toggle","aria-expanded":!w,"aria-controls":N,"data-testid":"list-group-toggle",onClick:()=>Ei(zn(s.key)),children:[(0,b.jsx)("span",{"aria-hidden":"true",children:w?"\u25B8":"\u25BE"}),s.label," ",(0,b.jsxs)("span",{children:["\xB7 ",s.nodes.length]}),(0,b.jsxs)("span",{style:vo,children:[" ",s.nodes.length===1?Be(u,e):nt.toLowerCase()]})]})}),(0,b.jsx)("ul",{id:N,style:w?{...at,display:"none"}:at,className:St,"data-graview-rows":"",hidden:w,children:w?null:s.nodes.map(kt)})]},s.key||"-")})}):je&&je.length>1?(0,b.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":$e?.type==="date"?"year":"letter",children:[(0,b.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...C,display:"flex",flexWrap:"wrap",gap:$e?.type==="date"?"0 10px":"0 4px",lineHeight:1.3},children:je.map(s=>(0,b.jsx)("a",{href:`#${gt(s.key)}`,onClick:w=>{w.preventDefault(),document.getElementById(gt(s.key))?.scrollIntoView({block:"start"})},style:{...Se,minWidth:24,justifyContent:"center"},children:s.key},s.key))}),je.map(s=>(0,b.jsxs)("section",{"data-testid":"list-section","aria-labelledby":gt(s.key),style:{display:"grid",gap:0},children:[(0,b.jsx)("h2",{id:gt(s.key),className:"graview-group-head",children:s.key}),(0,b.jsx)("ul",{style:at,className:St,"data-graview-rows":"",children:s.nodes.map(kt)})]},s.key))]}):(0,b.jsx)("ul",{style:at,className:St,"data-testid":"records","data-graview-rows":"",children:De.map(kt)})}),ut?(0,b.jsx)(Mr,{store:l,chosen:Me.chosen,...tt?{principal:tt}:{},...c?{context:c}:{},anchor:bo,of:cn.length,onChooseAll:()=>Me.choose(cn),onClear:Me.clear,onActed:Wi}):null,Yn>0?(0,b.jsxs)(F,{to:ki(p,"filter","is:any"),style:{...K,...C,justifySelf:"start"},"data-testid":"past-link",children:["+",Yn," past"]}):null,k===!1&&l.graph.count(e,{archived:!0})>0?(0,b.jsxs)(F,{to:ki(p,"archived","true"),style:{...K,...C,justifySelf:"start"},"data-testid":"archived-link",children:["+",l.graph.count(e,{archived:!0})," archived"]}):null]}),(0,b.jsx)(_t,{context:t,withheld:$i,style:ee,testId:"withheld"})]})}var vo={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},bo=()=>document.querySelector("[data-graview-choosable]")?.closest("[data-embed-content]")??null,ko=`
110
+ .graview-list[data-graview-choosable]{outline:none}
111
+ .graview-list [data-graview-choose]{position:relative;padding-left:34px}
112
+ .graview-choose-at{position:absolute;left:2px;top:0;bottom:0;z-index:${ha.raised};display:flex;align-items:center}
113
+ @media (pointer: coarse){
114
+ .graview-list:not([data-graview-choosing]) [data-graview-choose]{padding-left:0}
115
+ .graview-list:not([data-graview-choosing]) .graview-choose-at{display:none}
116
+ }
117
+ `;function So({children:t}){return(0,b.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:t})}var xo=(t,e)=>e?{sort:{by:e,direction:"desc"}}:t?{sort:{by:"label",direction:"asc"}}:{};function Po(t,e,n){let a=Lt({...t.get("sort")?{sort:t.get("sort")}:{},...t.get("filter")?{filter:t.get("filter")}:{},...t.get("group")?{group:t.get("group")}:{},...t.get("q")?{q:t.get("q")}:{},...t.get("archived")?{archived:t.get("archived")}:{}}),r=[...a.filter??[]],i=t.get("by"),o=a.group??(i?{by:i}:void 0);for(let d of n){let c=t.get(d);c&&r.push({key:d,value:c})}let l=t.get("with");return l&&r.push({key:l,value:"*"}),t.get("past")==="1"&&!r.some(d=>d.key==="is")&&r.push({key:"is",value:"any"}),Pn({...a.sort?{sort:a.sort}:{},...a.query?{query:a.query}:{},...r.length>0?{filter:r}:{},...o?{group:o}:{},...a.archived!==void 0?{archived:a.archived}:{}},e)}function ki(t,e,n){let a=new URLSearchParams(t);return a.set(e,n),a.delete("past"),`?${a.toString()}`}function Ao({name:t,title:e,panel:n,open:a,onOpen:r}){return(0,b.jsxs)("button",{type:"button","data-testid":`act-open-${t}`,"data-graview-act":t,"aria-expanded":a,"aria-controls":n,onClick:()=>{r(!a),a||requestAnimationFrame(()=>document.getElementById(n)?.querySelector("input, select, textarea, button")?.focus())},style:{...Se,minHeight:28,margin:"-4px 0",padding:"0 2px",border:0,background:"none",font:"inherit",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,b.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),e]})}function Co({name:t,id:e,description:n,open:a,onClose:r,children:i}){return(0,b.jsxs)("div",{"data-testid":`act-${t}`,id:e,hidden:!a,onKeyDown:o=>{o.key==="Escape"&&(o.preventDefault(),r(),document.querySelector(`[aria-controls="${e}"]`)?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,b.jsx)("p",{style:{...C,margin:0,maxWidth:"58ch"},children:n}):null,i]})}function Ro({to:t,label:e}){let n=(0,Ne.useRef)(null);return Er(n),(0,b.jsx)(F,{ref:n,to:t,"aria-label":e,style:{position:"absolute",inset:0,borderRadius:6}})}var Je=D(Fe(),1);var vt=D(Fe(),1);var W=D(j(),1);function Vn({context:t}){let{store:e,brand:n,invariantContext:a,principal:r}=t;te(e);let i=e.violations(a),o=e.allInvariants(),l=Tt(e,i),d=Da(e.schema,o);return(0,W.jsxs)(ne,{context:t,children:[(0,W.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,W.jsx)(re,{context:t,children:i.length===0?"All rules hold":"What is broken"}),(0,W.jsx)("p",{style:ae,"data-testid":"problems-count",children:i.length===0?"Every declared rule is satisfied by what is here.":ga(i)})]}),(0,W.jsx)(wi,{context:t}),l.map((c,p)=>{let m=c.nodeIds[0],f=m?e.graph.getNode(m):void 0;return(0,W.jsxs)("section",{style:{display:"grid",gap:10,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:[c.line?null:(0,W.jsx)(Zt,{violation:c,schema:e.schema,...n?{brand:n}:{}}),f?(0,W.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,W.jsx)(fe,{kind:f.kind,brand:n,schema:e.schema,size:7}),(0,W.jsx)(F,{to:Z(e.schema,f.kind,f.id),style:K,children:me(e.schema.tryDefinition(f.kind),f)})]}):null,c.line?(0,W.jsx)(Zt,{violation:c,schema:e.schema,...n?{brand:n}:{}}):null,(0,W.jsx)(Xt,{store:e,repairs:c.repairs,...r?{principal:r}:{}})]},p)}),o.length>0?(0,W.jsxs)("section",{style:{...ee,display:"grid",gap:12},"data-testid":"rules",children:[(0,W.jsx)("h2",{style:J,children:"The rules"}),(0,W.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:o.map(c=>{let p=i.filter(u=>u.invariant===c.name).length,m=d.get(c.name),f=c.label??c.name;return(0,W.jsxs)("li",{"data-graview-rule":c.name,style:{display:"grid",gap:2},children:[(0,W.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[m?(0,W.jsx)(Mt,{line:m,schema:e.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,W.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:f}),(0,W.jsx)("span",{style:{...C,color:p>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:p===0?"holds":`broken in ${p} ${p===1?"place":"places"}`})]}),m&&f.trim().length>0?(0,W.jsx)("span",{style:C,children:f}):null]},c.name)})})]}):null]})}function Zt({violation:t,schema:e,brand:n}){if(!t.line)return(0,W.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:t.message});let a=Ha(t),r=Wa(t);return r?(0,W.jsxs)("div",{style:{display:"grid",gap:4},"data-testid":"problem-line",children:[(0,W.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},"data-testid":"problem-says",children:r}),a?(0,W.jsx)("span",{style:C,children:a}):null,(0,W.jsxs)("details",{"data-testid":"problem-judged",style:C,children:[(0,W.jsx)("summary",{style:{cursor:"pointer",width:"fit-content",minHeight:24},children:"How it is judged"}),(0,W.jsx)(Mt,{line:t.line,schema:e,...n?{brand:n}:{},lead:"none"})]})]}):(0,W.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",children:[(0,W.jsx)(Mt,{line:t.line,schema:e,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)"}}),a?(0,W.jsx)("span",{style:C,children:a}):null]})}function Xt({store:t,repairs:e,principal:n}){let[a,r]=(0,vt.useState)(null),[i,o]=(0,vt.useState)(null),l=(0,vt.useRef)([]);if(e.length===0)return null;let d=a===null?null:e[a],c=d&&(d.missing??[]).length>0?t.allMutations().find(p=>p.name===d.mutation):void 0;return(0,W.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,W.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:e.map((p,m)=>{let f=(p.missing??[]).length>0,u=t.permits({name:p.mutation,args:{...p.args}},n);return u.ok?(0,W.jsx)("button",{ref:k=>{l.current[m]=k},type:"button","data-graview-repair":p.mutation,"data-graview-asks":f||void 0,"aria-expanded":f?a===m:void 0,onClick:()=>{if(o(null),f){r(a===m?null:m);return}r(null);try{t.apply({name:p.mutation,args:{...p.args}},n?{author:n}:{})}catch(k){o(st(t.schema,t.allMutations(),k))}},style:xe,children:f?`${p.label} \u2026`:p.label},m):(0,W.jsxs)("p",{"data-testid":"withheld","data-withheld":u.refusal.wouldNeed.join(",")||"nobody",style:{...C,margin:0},children:[(0,W.jsx)("s",{children:p.label})," \u2014 ",u.refusal.message]},m)})}),c&&d?(0,W.jsx)(Ie,{store:t,mutation:c,prefilled:{...d.args},only:d.missing??[],label:d.label,onDone:()=>{let p=a;r(null),requestAnimationFrame(()=>{let m=p===null?null:l.current[p];if(m?.isConnected){m.focus();return}let f=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");f&&(f.hasAttribute("tabindex")||(f.tabIndex=-1),f.focus())})},...n?{principal:n}:{}}):null,d&&!c&&(d.missing??[]).length>0?(0,W.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:Cn},children:["\u201C",d.label,"\u201D names ",d.mutation,", which this app does not declare."]}):null,i?(0,W.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:Cn},children:i}):null]})}var Un=D(Fe(),1);var Ue=D(j(),1);function Ai({store:t,link:e,principal:n}){let[a,r]=(0,Un.useState)(!1),[i,o]=(0,Un.useState)(null),l=_a(e);return(0,Ue.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,Ue.jsx)("button",{type:"button","data-graview-provisional":"",title:l,"aria-label":`Unsure link: ${l}`,"aria-expanded":a,onClick:()=>r(!a),style:{border:"1px dashed var(--graview-ink-muted)",borderRadius:999,background:"transparent",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.75rem",lineHeight:1,padding:"2px 6px",cursor:"pointer"},children:"unsure"}),a?(0,Ue.jsxs)("span",{style:{...C,display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,Ue.jsx)("span",{children:l}),(0,Ue.jsx)("button",{type:"button",style:{...xe,padding:"4px 10px"},onClick:()=>{try{t.apply({name:ma,args:{kind:e.edge.kind,from:e.edge.from,to:e.edge.to}},n?{author:n}:{}),r(!1)}catch(d){o(st(t.schema,t.allMutations(),d))}},children:"Keep this link"}),i?(0,Ue.jsx)("span",{role:"alert",children:i}):null]}):null]})}var we=D(j(),1);function Ci({nodeId:t,node:e,field:n,inPlace:a,labelStyle:r=ke}){return n.files?(0,we.jsx)(qe,{as:"field",read:!a,nodeId:t,field:n.key,label:n.label,files:n.files,labelStyle:r,style:{gap:4}}):n.long?(0,we.jsx)(Ar,{nodeId:t,field:n.key,label:n.label,value:n.value,markdown:n.markdown,style:{gridColumn:"1 / -1",gap:4},labelStyle:r,valueStyle:{lineHeight:1.6}}):(0,we.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,we.jsx)("dt",{style:r,children:n.label}),(0,we.jsx)("dd",{style:{margin:0,overflowWrap:"anywhere",minWidth:0},children:n.linked?(0,we.jsx)(er,{relation:n.linked.relation,refs:n.linked.refs,...a?{nodeId:t,field:n.key}:{}}):n.app?(0,we.jsx)(Ft,{address:n.app,as:"record",...a?{nodeId:t,field:n.key}:{}}):n.href?(0,we.jsx)(Pr,{href:n.href,field:n.key,value:n.value,stored:n.stored,...a?{nodeId:t}:{}}):a?(0,we.jsxs)(we.Fragment,{children:[(0,we.jsx)(It,{nodeId:t,field:n.key,value:n.value,stored:n.stored}),n.repeats?(0,we.jsx)(ar,{nodeId:t,field:n.key,start:e?.[n.key],value:e?.[`${n.key}Repeat`],label:`${n.label} repeats`}):null]}):n.value})]})}var S=D(j(),1),Lo=[];function jn({context:t}){let{store:e,brand:n,principal:a,invariantContext:r}=t;te(e);let i=de()!==null,o=Ve(),l=decodeURIComponent(o.id??""),d=ai(e,l,{...a?{principal:a}:{},...r?{context:r}:{}}),c=Tt(e,d?.violations??Lo),[p,m]=(0,Je.useState)(null),[f,u]=(0,Je.useState)(!1),[k,q]=(0,Je.useState)(null),h=(0,Je.useRef)(null),R=(0,Je.useRef)(null),G=g=>{(h.current?.parentElement?.querySelector(`[data-affordance="${g.replace(/["\\]/g,"\\$&")}"]`)??h.current)?.focus()};if(!d)return(0,S.jsx)(ne,{context:t,children:(0,S.jsx)(re,{context:t,children:"Nothing lives at this address."})});let M=e.graph.getNode(l),V=e.schema.tryDefinition(d.kind),z=V?.describe&&M?Ka(V,M):null,oe=[...e.log.all()].filter(g=>!Rt(g)&&(g.writes.includes(l)||g.reads.includes(l))).slice(-8).reverse(),pe=e.log.all().find(g=>!Rt(g)&&g.undoes===void 0&&g.primitives.some(A=>A.op==="add-node"&&A.node.id===l)),I=d.actions.affordances.filter(g=>g.provider!=="invariant"),_=I.filter(g=>g.destructive||g.setsAside),ie=f||_.length<2?I:I.filter(g=>!_.includes(g)),ve=t.views?.lookup(d.kind,{cardinality:"one",fidelity:"full"}),se=ve!==void 0&&!ot(ve)?ve:void 0,ue=se&&M?Wt(ve,M,e.graph):void 0,v=ue?d.fields.filter(g=>!ue.fields.has(g.key)):d.fields,y=ue?d.links.flatMap(g=>{let A=g.targets.filter(O=>!ue.records.has(O.id));return A.length>0?[{...g,targets:A}]:[]}):d.links,L=se!==void 0&&$a(ve),$=i&&Za(V).length>0;return(0,S.jsxs)(ne,{context:t,children:[(0,S.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,S.jsxs)("p",{style:{...ke,display:"flex",alignItems:"center",gap:8},children:[(0,S.jsx)(fe,{kind:d.kind,brand:n,schema:e.schema,size:8}),(0,S.jsx)(F,{to:`/${Y(e.schema,d.kind)}`,style:Se,children:Q(e,d.kind)})]}),(0,S.jsx)(re,{context:t,children:i&&M?.label===d.label?(0,S.jsx)(It,{nodeId:l,field:"label",value:d.label,said:d.label}):d.label}),z&&z!==d.label?(0,S.jsx)("p",{style:ae,children:z}):null,pe?.lineage?(0,S.jsxs)("p",{style:{...C,margin:0},"data-testid":"record-lineage",children:["Made by ",yt(pe,a,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}}),", ",vn(pe.lineage)]}):null,(0,S.jsx)(qt,{context:t,stop:`#focus=${encodeURIComponent(l)}`,style:{...K,...C},"data-testid":"spatial-link"}),i&&M?(0,S.jsx)(kn,{choices:[{on:"changed",record:l},{on:"act",record:l},{on:"reaches",kind:d.kind,condition:"",record:l}],label:"Notify me when this changes",testId:"record-notify",style:{...xe,...C,justifySelf:"start"}}):null,Le(t).some(g=>g.kind===d.kind||g.across===d.kind)?(0,S.jsxs)("p",{style:{...C,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",Le(t).filter(g=>g.kind===d.kind||g.across===d.kind).map((g,A)=>(0,S.jsxs)("span",{children:[A>0?(0,S.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,S.jsx)(F,{to:ye(t,g),style:K,children:g.title})," ",(0,S.jsx)(qt,{context:t,stop:`#view=${encodeURIComponent(g.as)}`,style:{...K,...C,display:"inline-block",minWidth:24,textAlign:"center"},title:`${g.title}, in the scene`,label:`${g.title}, in the scene`,children:(0,S.jsx)("span",{"aria-hidden":"true",children:"\u2197"})})]},Qe(g)))]}):null]}),M&&pa(M)?(0,S.jsx)(Mo,{context:t,id:l,kind:d.kind}):null,M&&fa(e,l)?(0,S.jsx)(To,{context:t,id:l,kind:d.kind}):null,se&&M?(0,S.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,S.jsx)(Nr,{children:(0,S.jsx)(se,{node:M,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...d.violations.length>0?{flagged:[l]}:{}})})}):null,d.violations.length>0?(0,S.jsx)("section",{"data-testid":"record-violations",style:{display:"grid",gap:12,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:c.map((g,A)=>(0,S.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,S.jsx)(Zt,{violation:g,schema:e.schema,...n?{brand:n}:{}}),(0,S.jsx)(Xt,{store:e,repairs:ri(d.actions,g.repairs),...a?{principal:a}:{}})]},A))}):null,!L&&(v.length>0||$)?(0,S.jsxs)("section",{style:{...ee,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,S.jsx)("h2",{style:J,children:"The facts"}),qa(V,v).map((g,A)=>{let O=(0,S.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:g.fields.map(ge=>(0,S.jsx)(Ci,{nodeId:l,node:M,field:ge,inPlace:i},ge.key))});return g.title?(0,S.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,S.jsx)("h3",{"data-graview-field-group":g.title,style:{...J,fontSize:"inherit"},children:g.title}),O]},A):(0,S.jsx)("div",{children:O},A)}),$?(0,S.jsx)(qe,{as:"unfilled",nodeId:l,skip:[...ue?.fields??[]],labelStyle:ke,style:{gap:4}}):null]}):null,(L?[]:y).map(g=>(0,S.jsxs)("section",{style:{...ee,display:"grid",gap:10},children:[(0,S.jsx)("p",{style:ke,children:_r(e,g)}),g.description?(0,S.jsx)("h2",{style:J,children:Ce(g.description)}):(0,S.jsxs)("h2",{style:J,"aria-label":be(g.edgeKind),children:[g.direction==="in"?"\u2190 ":"\u2192 ",be(g.edgeKind)]}),(0,S.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:g.targets.map(A=>{let O=Ya(e,g.direction==="in"?{kind:g.edgeKind,from:A.id,to:l}:{kind:g.edgeKind,from:l,to:A.id});return(0,S.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,S.jsx)(fe,{kind:A.kind,brand:n,schema:e.schema,size:7}),(0,S.jsxs)(F,{to:Z(e.schema,A.kind,A.id),style:K,children:[A.label,A.apart?(0,S.jsxs)("span",{style:C,children:[" \xB7 ",A.apart]}):null]}),O?.provisional?(0,S.jsx)(Ai,{store:e,link:O,...a?{principal:a}:{}}):null]},A.id)})}),(g.direction==="out"&&e.schema.edge(g.edgeKind)?.cardinality==="one"?[]:[...new Set(g.targets.map(A=>A.kind))]).map(A=>(0,S.jsxs)(F,{to:`/${Y(e.schema,A)}?${encodeURIComponent(g.edgeKind)}=${encodeURIComponent(l)}`,style:{...K,...C},"data-testid":"related-all",children:["Sort and filter ",g.description??`these ${Q(e,A).toLowerCase()}`,g.targets.some(O=>O.kind!==A)?` (${Q(e,A).toLowerCase()})`:""," ",(0,S.jsx)("span",{"aria-hidden":"true",children:"\u2192"})]},A))]},`${g.edgeKind}|${g.direction}|${g.description??""}`)),!L&&(I.length>0||d.actions.withheld.length>0)?(0,S.jsxs)("section",{style:{...ee,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,S.jsx)("h2",{style:J,ref:h,tabIndex:-1,children:"What can be done"}),(0,S.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8},children:[ie.map(g=>{let A=p===g.id;return(0,S.jsx)("button",{type:"button","data-affordance":g.id,"data-rank":g.rank,"data-graview-act":g.mutation,autoFocus:f&&g===_[0],"aria-expanded":A,onClick:()=>{m(A?null:g.id),A||requestAnimationFrame(()=>R.current?.querySelector("input:not([type=hidden]), select, textarea, button")?.focus())},style:{...xe,...A?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:g.label},g.id)}),ie.length<I.length?(0,S.jsxs)("button",{type:"button","aria-expanded":!1,onClick:()=>u(!0),style:{...xe,...C},"data-testid":"record-actions-more",children:["Show ",I.length-ie.length," more"]}):null]}),I.map(g=>{if(p!==g.id)return null;let A=e.allMutations().find(O=>O.name===g.mutation);return A?(0,S.jsxs)("div",{ref:R,onKeyDown:O=>{if(O.key!=="Escape"||O.defaultPrevented)return;O.preventDefault(),m(null);let ge=g.id;requestAnimationFrame(()=>G(ge))},style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,S.jsx)("h3",{style:J,children:g.label}),A.description?(0,S.jsx)("p",{style:{...C,margin:0},children:A.description}):null,(0,S.jsx)(Ie,{store:e,mutation:A,prefilled:g.args,open:g.open,label:g.label,onDone:()=>{m(null),q(g.mutation);let O=g.id;requestAnimationFrame(()=>G(O))},...a?{principal:a}:{}})]},g.id):null}),i&&k!==null&&p===null?(0,S.jsx)(kn,{choices:[{on:"act",act:k,record:l},{on:"act",act:k}],label:"Notify me when someone else does this",testId:"notify-after-act",style:{...xe,...C,justifySelf:"start"}}):null,(0,S.jsx)(_t,{context:t,withheld:d.actions.withheld})]}):null,i?(0,S.jsx)(zr,{id:l,style:ee,headingStyle:J}):null,oe.length>0?(0,S.jsxs)("section",{style:{...ee,display:"grid",gap:10},"data-testid":"record-history",children:[(0,S.jsx)("h2",{style:J,children:"What has happened"}),(0,S.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:oe.map(g=>(0,S.jsxs)("li",{style:C,children:[(0,S.jsx)("span",{style:{color:"var(--graview-ink)"},children:g.intent}),g.lineage?(0,S.jsxs)("span",{"data-graview-lineage":"",children:[" \xB7 ",vn(g.lineage)]}):null," \u2014 ",yt(g,a,{graph:e.graph,schema:e.schema,...t.seats?{seats:t.seats}:{},...t.people?{people:t.people}:{}})]},g.id))})]}):null]})}function To({context:t,id:e,kind:n}){let{store:a,principal:r}=t,i={name:`allow-tidying-${n}`,args:{id:e}},o=a.allMutations().some(l=>l.name===i.name)&&a.permits(i,r).ok;return(0,S.jsxs)("section",{"data-testid":"record-left-alone",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,S.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,S.jsx)("strong",{children:"Left alone."})," Nothing automated changes it; tidying passes it by."]}),o?(0,S.jsx)("button",{type:"button",style:xe,"data-testid":"allow-tidying",onClick:()=>a.apply(i,r?{author:r}:{}),children:"Allow tidying again"}):null]})}function Mo({context:t,id:e,kind:n}){let{store:a,principal:r}=t,i={name:`unarchive-${n}`,args:{id:e}},o=a.allMutations().some(c=>c.name===i.name)&&a.permits(i,r).ok,l=[...a.log.all()].reverse().find(c=>!Rt(c)&&c.mergedInto!==void 0&&c.writes.includes(e)),d=l?.mergedInto!==void 0?a.graph.getNode(l.mergedInto):void 0;return(0,S.jsxs)("section",{"data-testid":"record-archived",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,S.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,S.jsx)("strong",{children:"Archived."})," Kept with its ties and history, and out of lists, counts and rules.",d?(0,S.jsxs)(S.Fragment,{children:[" ","Merged into ",(0,S.jsx)(F,{to:Z(a.schema,d.kind,d.id),style:K,children:me(a.schema.tryDefinition(d.kind),d)}),"."]}):null]}),o?(0,S.jsx)("button",{type:"button",style:xe,"data-testid":"bring-it-back",onClick:()=>a.apply(i,r?{author:r}:{}),children:"Bring it back"}):null]})}var P=D(j(),1),Eo=(0,U.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.WG5NIR23.js","./chunk.3ZRHHB7X.js","./chunk.UGFDSE37.js","./chunk.ZYCNEOAQ.js","./chunk.4DEUD66C.js","./chunk.LHO7L3CS.js","./chunk.YG423NEB.js","./chunk.VNBR4DHD.js","./chunk.Z3ZKYSPN.js","./chunk.6ONRWFA6.js","./chunk.AFY35RJP.js","./chunk.POHEWJKZ.js","./chunk.ROGYDMES.js","./chunk.6IHXTT6Z.js","./chunk.YXH3IWNR.js","./chunk.OEF3GPRM.js","./chunk.BRHRAVU2.js","./chunk.VTWFVPKD.js","./chunk.ZRQI5VJF.js","./chunk.33GN2NUT.js","./chunk.2VIGF4FO.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.2EJAIT33.js","./chunk.EUGWV3S6.js","./chunk.6XJP7F3I.js","./chunk.NPX7SPXM.js","./chunk.OE4QOBJF.js","./chunk.74RMHUCX.js","./chunk.GZHZLJBF.js","./chunk.I3SQJ2L2.js","./chunk.OJGHDWI6.js","./chunk.FUJM7GDV.js","./chunk.MWZK3HVG.js","./chunk.3D5T3XIE.js","./chunk.GR5Q4HTW.js","./chunk.QT4XGC5Z.js","./chunk.MQ7FNHXG.js","./chunk.WLPTY4BF.js","./chunk.AJZBJBMO.js"]),import("./chunk.L34FY7QQ.js")).then(t=>({default:t.DraftPage}))),No={kind:"human"};function $o({list:t,store:e}){let n=new Set(t.members.map(o=>o.kind)),a=t.total-t.members.length,r=n.size===1?[...n][0]:void 0;if(!r)return(0,P.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${a} more`});let i=it(e.schema,r).toLowerCase();return(0,P.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,P.jsx)(F,{to:`/${Y(e.schema,r)}`,className:"graview-spec-link graview-spec-see-all","data-testid":"see-all",children:t.total===e.graph.nodesOfKind(r).length?`See all ${mt(t.total)} ${i}`:`${mt(a)} more \xB7 all ${i}`})})}function Oo({context:t,children:e}){let n=We(),a=t.store.schema,r=(0,U.useMemo)(()=>({href:i=>Z(a,i.kind,i.id),go:i=>n(Z(a,i.kind,i.id)),more:i=>(0,P.jsx)($o,{list:i,store:t.store})}),[a,n,t.store]);return(0,P.jsx)(Dt.Provider,{value:r,children:(0,P.jsx)($r.Provider,{value:(t.titleLevel??(t.framed&&!t.barAbove?1:2))-1,children:e})})}function Fo({steering:t}){let e=Pe(),n=We(),a=`${e.pathname}${e.search}`;return(0,U.useLayoutEffect)(()=>t.at(a),[a,t]),(0,U.useLayoutEffect)(()=>{let r=o=>{o!==a&&n(o)};t.go.current=r;let i=t.pending?.current;return i!==void 0&&(t.pending.current=void 0,r(i)),()=>{t.go.current===r&&(t.go.current=void 0)}},[a,n,t]),null}function Io({context:t,to:e}){let{pathname:n}=Pe(),a=de(),r=(e??a)?.sayWhere,i=Do(t,n);return(0,U.useEffect)(()=>(r?.(i),()=>r?.(null)),[r,i]),null}function Do(t,e){let[n="",a,r]=e.split("/").filter(Boolean).map(o=>{try{return decodeURIComponent(o)}catch{return o}});if(r!==void 0)return"#";if(n==="places"&&a!==void 0){if(a===yn)return"#overview=1";let o=t.views?.places().find(l=>l.as===a);return o?`#focus=${encodeURIComponent(Oe(o.kind))}&view=${encodeURIComponent(o.as)}`:"#"}let i=Ee(t.store.schema,n);return i?`#focus=${encodeURIComponent(a??Oe(i))}`:"#"}function Wo({onNavigate:t,path:e}){let n=Pe(),a=Ln(),r=We(),i=n.hash&&!n.hash.includes("=")?n.hash:"",o=`${n.pathname}${n.search}${i}`,l=(0,U.useRef)(t);l.current=t;let d=(0,U.useRef)(null);(0,U.useEffect)(()=>{let p=d.current;d.current=o,p!==null&&(o===p&&a!=="PUSH"||l.current?.(o,a==="POP"?"pop":a==="REPLACE"?"replace":"push"))},[n.key]);let c=(0,U.useRef)(e);return(0,U.useEffect)(()=>{e===void 0||e===c.current||(c.current=e,e!==o&&r(e))},[e]),null}function Ri({context:t,registry:e,page:n}){let a=Ve(),r=Ee(t.store.schema,a.slug??""),i=n==="list"?Gn:jn,l=(r?e?.lookup(r,n):void 0)??i;return(0,P.jsx)(l,{context:t})}function Ho({context:t,registry:e,children:n}){let a=(0,U.useRef)(null);return Oa(a),(0,P.jsx)("div",{ref:a,"data-graview-face":"pages",style:{display:"contents"},children:(0,P.jsx)(gi,{context:t,registry:e,root:a,children:(0,P.jsx)(fi,{context:t,root:a,children:n})})})}function Ko(t){return t instanceof HTMLElement?t.isContentEditable||t.tagName==="TEXTAREA"||t.tagName==="SELECT"?!0:t.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(t.type):!1}function Bo(){let{pathname:t}=Pe(),e=Ln(),n=(0,U.useRef)(null);(0,U.useLayoutEffect)(()=>{if(e!=="POP"){for(let i=n.current?.parentElement;i;i=i.parentElement){let{overflowY:o}=getComputedStyle(i);if((o==="auto"||o==="scroll")&&i.scrollHeight>i.clientHeight){i.scrollTop=0;return}}window.scrollTo(0,0)}},[t]);let a=(0,U.useRef)(t),r=(0,U.useRef)(!1);return(0,U.useEffect)(()=>{if(!r.current&&t===a.current)return;r.current=!0;let i=document.activeElement;if(Ko(i))return;let o=n.current?.closest("main")??document.querySelector("main"),d=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??o?.querySelector("h1, h2")??null??o??null;d&&(d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1"),d.focus({preventScroll:!0}))},[t]),(0,P.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function Li({context:t,children:e}){let n=We(),a=(0,U.useMemo)(()=>({record:(r,i)=>{let o=t.store.graph.getNode(r);o&&n(wt(Z(t.store.schema,o.kind,r),{section:i?.section}))},place:(r,i)=>{let o=t.views?.places().find(l=>l.as===r);o&&n(wt(ye(t,o),i))},list:(r,i)=>{t.store.schema.tryDefinition(r)&&n(wt(`/${Y(t.store.schema,r)}`,i))},draft:()=>n("/~draft")}),[t,n]);return(0,P.jsx)(Na.Provider,{value:a,children:e})}function qo(){let{pathname:t,search:e,hash:n}=Pe();return(0,U.useEffect)(()=>{let a=decodeURIComponent(n.replace(/^#/,""));if(!(!a||a.includes("=")))return di(a)},[t,e,n]),null}function Go({context:t,Home:e}){let n=Pe(),a=t.views,r=n.key==="default"&&!(a&&Ma(a));(0,U.useEffect)(()=>{a&&Ea(a)},[a]);let i=r?ka(t.views?.arrangement?.()?.first,t.store.schema,t.views?.places()??[]):void 0,o=i?.to==="place"?ye(t,i.place):i?.to==="kind"?`/${Y(t.store.schema,i.kind)}`:void 0;return o?(0,P.jsx)(Tn,{to:o,replace:!0}):(0,P.jsx)(e,{context:t})}function Ti({context:t,registry:e}){let n=e?.lookupSurface("shell"),a=n!==void 0,r=a&&(e?.without().has("bar")??!1),i=a&&!r&&!t.embedded?{...t,barAbove:!0}:t,o=k=>n===void 0?(0,P.jsx)(Gt,{context:t,children:k}):r?(0,P.jsx)(n,{context:t,children:k}):(0,P.jsx)(Gt,{context:t,children:(0,P.jsx)(n,{context:i,children:k})}),l=e?.lookupSurface("home")??Bn,d=e?.lookupSurface("problems")??Vn,c=a?{...i,framed:!0}:t,[p,m]=(0,U.useState)(null),f=(0,U.useMemo)(()=>({onFind:m,find:!(e?.without().has("find")??!1),places:!(e?.without().has("places")??!1)}),[e]),u=(0,P.jsx)(Li,{context:t,children:(0,P.jsx)(Ho,{context:t,registry:e,children:o((0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(Qa,{face:"pages"}),(0,P.jsxs)(Oo,{context:c,children:[(0,P.jsx)(Bo,{}),(0,P.jsx)(qo,{}),(0,P.jsxs)(Jr,{children:[(e?.routes()??[]).map(({path:k,component:q})=>(0,P.jsx)(Re,{path:k,element:(0,P.jsx)(q,{context:c})},k)),(0,P.jsx)(Re,{path:"/",element:(0,P.jsx)(Go,{context:c,Home:l})}),(0,P.jsx)(Re,{path:"/problems",element:(0,P.jsx)(d,{context:c})}),(0,P.jsx)(Re,{path:"/~draft",element:(0,P.jsx)(U.Suspense,{fallback:null,children:(0,P.jsx)(Eo,{context:c})})}),(0,P.jsx)(Re,{path:"/search",element:(0,P.jsx)(qn,{context:c})}),(0,P.jsx)(Re,{path:"/map",element:(0,P.jsx)(Kn,{context:c})}),(0,P.jsx)(Re,{path:"/places",element:(0,P.jsx)(Wn,{context:c})}),Le(c).some(k=>k.as===yn)?null:(0,P.jsx)(Re,{path:ba,element:(0,P.jsx)(Tn,{to:"/",replace:!0})}),(0,P.jsx)(Re,{path:"/places/:as",element:(0,P.jsx)(Hn,{context:c})}),(0,P.jsx)(Re,{path:"/:slug",element:(0,P.jsx)(Ri,{context:c,registry:e,page:"list"})}),(0,P.jsx)(Re,{path:"/:slug/:id",element:(0,P.jsx)(Ri,{context:c,registry:e,page:"record"})})]})]})]}))})});return t.embedded||!a||r?u:(0,P.jsx)(ni.Provider,{value:f,children:(0,P.jsx)(mr.Provider,{value:p,children:u})})}var Vo=()=>typeof document>"u"?null:document.body;function Uo({context:t,registry:e,basename:n,initialPath:a,onNavigate:r,path:i,steering:o,firstLook:l}){let[d,c]=(0,U.useState)(void 0),p=d!==void 0&&d.from===t.principal?{...t,principal:d.seat}:t;(0,U.useState)(()=>p.views?Fr(p.views,p.store.schema,xn(p.brand,p.store.schema)):void 0);let m=de();oa({reader:p.locale??m?.locale,app:p.brand?.locale??p.app?.brand?.locale,readerTimeZone:p.timeZone??m?.timeZone,appTimeZone:p.brand?.timeZone??p.app?.brand?.timeZone});let f=p.principal??No,u=Ca(p.store,f,p.history),q=(u.past&&u.live===p.store?u.past.store:p.store).seenBy(f),h=q===p.store?p:{...p,store:q};Ra(p.store,p.principal);let R=(0,P.jsxs)(P.Fragment,{children:[r||i!==void 0?(0,P.jsx)(Wo,{onNavigate:r,path:i}):null,o?(0,P.jsx)(Fo,{steering:o}):null,h.presence||m?(0,P.jsx)(Io,{context:h,to:m}):null,(0,P.jsx)(Ti,{context:h,...e?{registry:e}:{}}),l?(0,P.jsx)(Ir,{firstLook:l,root:Vo,app:xn(p.brand,p.store.schema)}):null]}),G=h.views?(0,P.jsxs)(La,{store:h.store,views:h.views,...h.principal?{principal:h.principal}:{},...h.brand?{brand:h.brand}:{},...h.locale?{locale:h.locale}:{},...h.timeZone?{timeZone:h.timeZone}:{},...h.settings?{settings:h.settings}:{},...h.presence&&!m?{presence:h.presence}:{},...h.people?{people:h.people}:{},...h.seats?{seats:h.seats}:{},onSeat:z=>m?m.takeSeat(z):c({from:t.principal,seat:z}),...h.onKeepLens?{onKeepLens:h.onKeepLens}:{},...h.ai?{ai:h.ai}:{},...h.subscriptions?{subscriptions:h.subscriptions}:{},...h.signIn?{signIn:h.signIn}:{},resolveApp:h.resolveApp??m?.resolveApp,linkedRecords:h.linkedRecords??m?.linkedRecords,...h.app?{app:h.app}:{},...h.menuSections?{menuSections:h.menuSections}:{},children:[R,(0,P.jsx)(Li,{context:h,children:(0,P.jsx)(ci,{context:h})})]}):R,M=(0,P.jsx)(Aa.Provider,{value:u,children:G}),V=h.files?(0,P.jsx)(Pa.Provider,{value:h.files,children:M}):M;if(a!==void 0){let z=n===void 0?a:`${n.replace(/\/$/,"")}${a}`;return(0,P.jsx)(Xr,{initialEntries:[z],...n===void 0?{}:{basename:n},children:V})}return(0,P.jsx)(ei,{...n===void 0?{}:{basename:n},children:V})}export{_i as a,Uo as b};