graview 0.1.28 → 0.1.30

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 (178) hide show
  1. package/dist/preview/chunk.26CZTUY4.js +1 -0
  2. package/dist/preview/chunk.2CIBWZJG.js +1 -0
  3. package/dist/preview/chunk.2EXGG6BB.js +1 -0
  4. package/dist/preview/chunk.2NBYNZRD.js +1 -0
  5. package/dist/preview/chunk.2XAONC66.js +1 -0
  6. package/dist/preview/chunk.34ZMMURV.js +27 -0
  7. package/dist/preview/chunk.3ADPAGPY.js +28 -0
  8. package/dist/preview/chunk.3JGGBLRB.js +1 -0
  9. package/dist/preview/chunk.3JNMSOFG.js +1 -0
  10. package/dist/preview/chunk.3R4W2P5X.js +1 -0
  11. package/dist/preview/chunk.3SKKIHU3.js +4 -0
  12. package/dist/preview/{chunk.5BGA2VUS.js → chunk.3URFMWXZ.js} +4 -4
  13. package/dist/preview/chunk.3VL5WECB.js +1 -0
  14. package/dist/preview/chunk.42YX6NOY.js +2 -0
  15. package/dist/preview/chunk.4ALKPNXM.js +1 -0
  16. package/dist/preview/chunk.4HP7UWA2.js +1 -0
  17. package/dist/preview/chunk.4SJUTBDV.js +1 -0
  18. package/dist/preview/chunk.5U5J3ISK.js +1 -0
  19. package/dist/preview/chunk.6T2Q6NLO.js +1 -0
  20. package/dist/preview/chunk.6V2RG5JG.js +5 -0
  21. package/dist/preview/chunk.6XMEU2Q2.js +1 -0
  22. package/dist/preview/chunk.7BWT5L2L.js +1 -0
  23. package/dist/preview/chunk.AK3IHFCF.js +1 -0
  24. package/dist/preview/chunk.BPWNWE7N.js +1 -0
  25. package/dist/preview/chunk.C5CYZNSJ.js +1 -0
  26. package/dist/preview/chunk.CM6LOIQE.js +88 -0
  27. package/dist/preview/chunk.D3IECJ2S.js +17 -0
  28. package/dist/preview/chunk.DT7LHWU2.js +1 -0
  29. package/dist/preview/chunk.DZRTOURR.js +1 -0
  30. package/dist/preview/chunk.ERXSYPYL.js +84 -0
  31. package/dist/preview/chunk.EYZ7MHBZ.js +0 -0
  32. package/dist/preview/chunk.FDELO7NY.js +116 -0
  33. package/dist/preview/chunk.FGVKJWNS.js +6 -0
  34. package/dist/preview/chunk.FWCOJDOD.js +1 -0
  35. package/dist/preview/chunk.GFF2FB2J.js +25 -0
  36. package/dist/preview/chunk.GLBHQFJ2.js +1 -0
  37. package/dist/preview/chunk.HHI65WFZ.js +3 -0
  38. package/dist/preview/chunk.HHPGWJDO.js +2 -0
  39. package/dist/preview/chunk.HJCQ6I3S.js +1 -0
  40. package/dist/preview/chunk.HSCTWAUV.js +1 -0
  41. package/dist/preview/chunk.INZUEWC5.js +1 -0
  42. package/dist/preview/chunk.J2ITFGN3.js +1 -0
  43. package/dist/preview/chunk.JH6MU6TX.js +2 -0
  44. package/dist/preview/chunk.JISMMIMX.js +1 -0
  45. package/dist/preview/chunk.JN7DIFR3.js +1 -0
  46. package/dist/preview/chunk.JPHNKWTY.js +1 -0
  47. package/dist/preview/chunk.JTNWD2CN.js +1 -0
  48. package/dist/preview/chunk.K75FUIZI.js +1 -0
  49. package/dist/preview/chunk.K776HO42.js +2 -0
  50. package/dist/preview/chunk.KN3ULTGF.js +1 -0
  51. package/dist/preview/chunk.KOB6N3SL.js +1 -0
  52. package/dist/preview/chunk.KQT7WAQE.js +1 -0
  53. package/dist/preview/chunk.L4DECHXR.js +327 -0
  54. package/dist/preview/chunk.L6OMEYL6.js +10 -0
  55. package/dist/preview/chunk.LQ7V6KEE.js +1 -0
  56. package/dist/preview/chunk.MB7LKKUD.js +1 -0
  57. package/dist/preview/chunk.MD74YVRN.js +3 -0
  58. package/dist/preview/chunk.MGNP4LAM.js +1 -0
  59. package/dist/preview/chunk.NCTOBUCT.js +1 -0
  60. package/dist/preview/chunk.NDADLJE6.js +1 -0
  61. package/dist/preview/chunk.NO52VON3.js +1 -0
  62. package/dist/preview/chunk.O2LK2AO7.js +1 -0
  63. package/dist/preview/chunk.OAF7TUMI.js +1 -0
  64. package/dist/preview/chunk.OQ4KFN6W.js +1 -0
  65. package/dist/preview/chunk.OQDETV4X.js +1 -0
  66. package/dist/preview/chunk.OXQMNIRO.js +1 -0
  67. package/dist/preview/chunk.OZNW5W4Z.js +1 -0
  68. package/dist/preview/chunk.PAVR5TK5.js +1 -0
  69. package/dist/preview/chunk.PKK6FRZR.js +2 -0
  70. package/dist/preview/chunk.Q5WEOX3Q.js +1 -0
  71. package/dist/preview/chunk.QIAKO27D.js +1 -0
  72. package/dist/preview/chunk.QNGWEV47.js +1 -0
  73. package/dist/preview/{chunk.EYF6ONTA.js → chunk.QTA4ROAK.js} +1 -1
  74. package/dist/preview/chunk.QTMWHE5O.js +1 -0
  75. package/dist/preview/chunk.R26DREVU.js +1 -0
  76. package/dist/preview/chunk.RI3PYG5T.js +19 -0
  77. package/dist/preview/chunk.RIEHYQLK.js +1101 -0
  78. package/dist/preview/chunk.RRVIXV7W.js +1 -0
  79. package/dist/preview/chunk.RYT5U3QM.js +1 -0
  80. package/dist/preview/chunk.SE5SKFQH.js +1 -0
  81. package/dist/preview/chunk.SHPXD6FC.js +1 -0
  82. package/dist/preview/chunk.SOBC3CTN.js +47 -0
  83. package/dist/preview/chunk.SOD3PBJM.js +1 -0
  84. package/dist/preview/chunk.T3VPD7JQ.js +1 -0
  85. package/dist/preview/chunk.TI4OSTQV.js +1 -0
  86. package/dist/preview/chunk.UDSEJKCY.js +1 -0
  87. package/dist/preview/chunk.UGFDSE37.js +1 -0
  88. package/dist/preview/chunk.UT6642FC.js +1 -0
  89. package/dist/preview/chunk.UWGWXFWZ.js +1 -0
  90. package/dist/preview/{chunk.IKT7JQUW.js → chunk.UZWWDAGM.js} +1 -1
  91. package/dist/preview/chunk.V5ZYUVMH.js +1 -0
  92. package/dist/preview/chunk.V7BDAGDE.js +35 -0
  93. package/dist/preview/chunk.VG56IUIQ.js +9 -0
  94. package/dist/preview/chunk.VOAZBHCG.js +1 -0
  95. package/dist/preview/chunk.VS7K3SCD.js +9 -0
  96. package/dist/preview/chunk.VSZQXB4Q.js +3 -0
  97. package/dist/preview/chunk.W3S6UXNA.js +1 -0
  98. package/dist/preview/chunk.WAFDCOOG.js +3 -0
  99. package/dist/preview/chunk.WYTIOLPP.js +1 -0
  100. package/dist/preview/chunk.X37L5TN5.js +1 -0
  101. package/dist/preview/chunk.XDYAG276.js +1 -0
  102. package/dist/preview/chunk.XRJBLH4N.js +1 -0
  103. package/dist/preview/chunk.XS7YFNDU.js +1 -0
  104. package/dist/preview/chunk.XSTXV6FP.js +6 -0
  105. package/dist/preview/chunk.Y4UXEL6Y.js +1 -0
  106. package/dist/preview/chunk.YJUB4OD7.js +1 -0
  107. package/dist/preview/chunk.YLQB3KBA.js +1 -0
  108. package/dist/preview/chunk.YNQDVGZM.js +1 -0
  109. package/dist/preview/chunk.YV2LJFGS.js +1 -0
  110. package/dist/preview/chunk.Z2YUYZT4.js +1 -0
  111. package/dist/preview/chunk.ZYKAS4BT.js +1 -0
  112. package/dist/preview/page.js +6 -6
  113. package/package.json +6 -6
  114. package/dist/preview/chunk.22H4JXTH.js +0 -8
  115. package/dist/preview/chunk.25OYH6MY.js +0 -1
  116. package/dist/preview/chunk.2GBQJXJH.js +0 -19
  117. package/dist/preview/chunk.2VUG6EAN.js +0 -1
  118. package/dist/preview/chunk.337WDTG3.js +0 -2
  119. package/dist/preview/chunk.3HLLQ5CJ.js +0 -1
  120. package/dist/preview/chunk.46KUPBQC.js +0 -1
  121. package/dist/preview/chunk.4H7CQE56.js +0 -1
  122. package/dist/preview/chunk.4HGBVU5B.js +0 -1
  123. package/dist/preview/chunk.4RO5DA22.js +0 -1
  124. package/dist/preview/chunk.4TUNX4WM.js +0 -29
  125. package/dist/preview/chunk.6LJ66MB7.js +0 -1
  126. package/dist/preview/chunk.6R4EI47C.js +0 -1
  127. package/dist/preview/chunk.7S22MBNN.js +0 -1
  128. package/dist/preview/chunk.A73BXXE4.js +0 -3
  129. package/dist/preview/chunk.AHDOKM4O.js +0 -1
  130. package/dist/preview/chunk.ARE3MEDN.js +0 -1
  131. package/dist/preview/chunk.ASFZTYFO.js +0 -1
  132. package/dist/preview/chunk.BBJZ6O7J.js +0 -1
  133. package/dist/preview/chunk.BCBH6WJF.js +0 -1
  134. package/dist/preview/chunk.CAZAB352.js +0 -1
  135. package/dist/preview/chunk.CY7MDLRS.js +0 -1
  136. package/dist/preview/chunk.DAVRLRGB.js +0 -1
  137. package/dist/preview/chunk.DCIC3YHX.js +0 -1
  138. package/dist/preview/chunk.EW4JFOJY.js +0 -1
  139. package/dist/preview/chunk.FP27W5MU.js +0 -1
  140. package/dist/preview/chunk.G2OOBROL.js +0 -1040
  141. package/dist/preview/chunk.GCKSQ52O.js +0 -1
  142. package/dist/preview/chunk.GE5EAN36.js +0 -2
  143. package/dist/preview/chunk.HOPIZMJR.js +0 -2
  144. package/dist/preview/chunk.IBGO4BUF.js +0 -1
  145. package/dist/preview/chunk.IDI2BQ7Y.js +0 -9
  146. package/dist/preview/chunk.IH42QTOM.js +0 -1
  147. package/dist/preview/chunk.ISRS7GOT.js +0 -321
  148. package/dist/preview/chunk.J6CBMLGR.js +0 -1
  149. package/dist/preview/chunk.JRCV6HVV.js +0 -1
  150. package/dist/preview/chunk.KWW3YHQ4.js +0 -23
  151. package/dist/preview/chunk.MKNXV4TM.js +0 -8
  152. package/dist/preview/chunk.MRK6QJV5.js +0 -25
  153. package/dist/preview/chunk.MVNIKZIC.js +0 -1
  154. package/dist/preview/chunk.N2WTNKEV.js +0 -1
  155. package/dist/preview/chunk.N7HCALRK.js +0 -61
  156. package/dist/preview/chunk.NRRUGG22.js +0 -1
  157. package/dist/preview/chunk.OGL4PHTY.js +0 -1
  158. package/dist/preview/chunk.ONDILMIX.js +0 -1
  159. package/dist/preview/chunk.PFQFPJ5L.js +0 -16
  160. package/dist/preview/chunk.PN2H6X7O.js +0 -1
  161. package/dist/preview/chunk.PWHJHFC4.js +0 -1
  162. package/dist/preview/chunk.Q3HVA6L4.js +0 -1
  163. package/dist/preview/chunk.RZLNDVGN.js +0 -107
  164. package/dist/preview/chunk.SBHVVJY7.js +0 -1
  165. package/dist/preview/chunk.SNBIZ3B6.js +0 -1
  166. package/dist/preview/chunk.TBG2QBOS.js +0 -1
  167. package/dist/preview/chunk.VR735ZQL.js +0 -1
  168. package/dist/preview/chunk.VSXCXPK2.js +0 -1
  169. package/dist/preview/chunk.W3LDQ6B2.js +0 -1
  170. package/dist/preview/chunk.WCNONCTL.js +0 -6
  171. package/dist/preview/chunk.WHTNSETN.js +0 -1
  172. package/dist/preview/chunk.XG67BWH6.js +0 -1
  173. package/dist/preview/chunk.XRM6WXPW.js +0 -1
  174. package/dist/preview/chunk.Y5LPZLDE.js +0 -1
  175. package/dist/preview/chunk.YETBY2LM.js +0 -1
  176. package/dist/preview/chunk.YSYT3ASK.js +0 -1
  177. package/dist/preview/chunk.ZEUBAAVQ.js +0 -1
  178. package/dist/preview/chunk.ZJDRD6PO.js +0 -1
@@ -0,0 +1 @@
1
+ import{a as ne,b as ie,c as oe,d as re}from"./chunk.NO52VON3.js";import"./chunk.4ALKPNXM.js";import{a as te}from"./chunk.OQ4KFN6W.js";import"./chunk.YNQDVGZM.js";import"./chunk.3R4W2P5X.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.C5CYZNSJ.js";import"./chunk.JPHNKWTY.js";import"./chunk.XRJBLH4N.js";import{j as X,k as J}from"./chunk.3SKKIHU3.js";import"./chunk.HJCQ6I3S.js";import"./chunk.O2LK2AO7.js";import"./chunk.26CZTUY4.js";import"./chunk.3JNMSOFG.js";import"./chunk.PKK6FRZR.js";import"./chunk.OAF7TUMI.js";import"./chunk.J2ITFGN3.js";import{a as q,d as B}from"./chunk.V5ZYUVMH.js";import"./chunk.6XMEU2Q2.js";import{a as Q}from"./chunk.QIAKO27D.js";import"./chunk.UT6642FC.js";import"./chunk.QTA4ROAK.js";import"./chunk.2CIBWZJG.js";import"./chunk.7BWT5L2L.js";import"./chunk.SE5SKFQH.js";import"./chunk.W3S6UXNA.js";import"./chunk.4SJUTBDV.js";import"./chunk.TI4OSTQV.js";import"./chunk.6T2Q6NLO.js";import"./chunk.OZNW5W4Z.js";import"./chunk.NDADLJE6.js";import"./chunk.AK3IHFCF.js";import"./chunk.HHPGWJDO.js";import"./chunk.42YX6NOY.js";import"./chunk.EYZ7MHBZ.js";import"./chunk.KQT7WAQE.js";import"./chunk.PAVR5TK5.js";import"./chunk.OQDETV4X.js";import{g as G}from"./chunk.3VL5WECB.js";import"./chunk.JH6MU6TX.js";import"./chunk.WAFDCOOG.js";import{g as Z}from"./chunk.L4DECHXR.js";import{G as ye,J as U,R as K,Z as C,k as F,n as _,o as Y,pa as V}from"./chunk.GFF2FB2J.js";import{W as j,Z as P,_ as T,ca as N,da as W,vc as z}from"./chunk.6V2RG5JG.js";import{b as O}from"./chunk.AJZBJBMO.js";var M=3;function ae(e,n){return n.id?e.graph.getNode(n.id):void 0}function le(e){return e?/^(?:kind|aggregate):([^:]+)$/.exec(e)?.[1]:void 0}function de(e,n){if(n)return e.find(t=>t.nodeIds.includes(n)||t.subjectId===n)}var me=e=>{let n=e.trim();if(!n)return n;let t=n.charAt(0).toUpperCase()+n.slice(1);return/[.!?…]$/.test(t)?t:`${t}.`};function ce({store:e,subject:n,violations:t,place:i}){let s=ae(e,n),o=de(t,s?.id??null);if(o)return me(o.message);if(s){let l=s.kind;return`${j(e.schema.tryDefinition(l),s)}, ${N(W(e.schema.tryDefinition(l),l))}.`}let c=i?.kind??le(n.id);if(c){let l=e.graph.nodesOfKind(c).length,g=i?.title??n.name,u=T(e.schema,c),f=P(e.schema,c,l);return g.toLowerCase()===u.toLowerCase()?`${l===1?"There is":"There are"} ${f} here.`:`${g}: ${f}.`}let a=e.schema.kinds.map(l=>({kind:l,count:e.graph.nodesOfKind(l).length})).filter(l=>l.count>0).sort((l,g)=>g.count-l.count).slice(0,3);if(a.length===0)return"Nothing here yet.";let r=a.map(l=>P(e.schema,l.kind,l.count));return`The whole thing: ${r.length===1?r[0]:`${r.slice(0,-1).join(", ")} and ${r[r.length-1]}`}.`}function ue(e){let{store:n,subject:t,violations:i}=e,s=ae(n,t),o=[];s&&de(i,s.id)?o.push({ask:`What's wrong with ${t.name}?`,why:"problem"}):i.length>0&&o.push({ask:"What needs attention?",why:"problem"});let c=s?s.kind:e.place?.kind??le(t.id),a=ke(e,c);if(a)o.push(a);else{let l=be(e,c);l&&o.push(l)}let r=we(e,c);return r&&o.push(r),o.length<M&&(s?o.push({ask:`Tell me about ${t.name}`,why:"about"}):o.push({ask:"What is here?",why:"here"})),o.slice(0,M)}function pe(e,n){return e.schema.tryDefinition(n)?.fields?.shape??{}}function Se(e){let n=e;for(let t=0;t<4&&n;t++){let i=n;if(Array.isArray(i.options)&&i.options.every(s=>typeof s=="string"))return i.options;n=typeof i.unwrap=="function"?i.unwrap():i._def?.innerType}}var se=/^\d{4}-\d{2}-\d{2}/,ve=["due","deadline","date","when"];function ke(e,n){let{store:t}=e,i=e.today;if(!i||!se.test(i))return;let s=new Date(`${i.slice(0,10)}T00:00:00Z`);s.setUTCDate(s.getUTCDate()+6);let o=s.toISOString().slice(0,10),c=[...new Set([...n?[n]:[],...t.schema.kinds])];for(let a of c){let r=ve.find(u=>u in pe(t,a));if(!r||!t.graph.nodesOfKind(a).some(u=>{let f=u[r],S=u.done;return typeof f=="string"&&se.test(f)&&f.slice(0,10)>=i.slice(0,10)&&f.slice(0,10)<=o&&S!==!0}))continue;let g=T(t.schema,a);return{ask:`${ee(g)} due this week`,why:"due"}}}function be(e,n){let t=e.place?.title,i=(e.places??[]).find(s=>s.kind!==null&&s.picture===!0&&s.title!==t&&s.kind!==n);return i?{ask:`Go to ${i.title}`,why:"go"}:void 0}function we(e,n){let{store:t}=e,i=[...t.schema.kinds].sort((o,c)=>t.graph.nodesOfKind(c).length-t.graph.nodesOfKind(o).length),s=[...new Set([...n?[n]:[],...i])];for(let o of s){if(t.graph.nodesOfKind(o).length<2)continue;let c=pe(t,o),a=Object.keys(c).find(g=>(Se(c[g])?.length??0)>=2);if(!a)continue;let r=T(t.schema,o).toLowerCase(),l=a.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").toLowerCase();return{ask:`Show ${r} as a board by ${l}`,why:"draw"}}}function ge(e,{store:n,subject:t}){let i=a=>t.id!==null&&(a.nodeIds.includes(t.id)||Object.values(a.args).includes(t.id)),s=e.filter(a=>a.provider==="invariant"&&i(a)),o=e.filter(a=>a.pinned==="user"&&!s.includes(a));return[...s,...o].sort((a,r)=>Number(a.destructive??!1)-Number(r.destructive??!1)).slice(0,M).map(a=>({affordance:a,label:xe(a,{store:n,subject:t})}))}var Ae=e=>/^[a-z0-9]+(?:[-_][a-z0-9]+)+$|^[a-z]+[A-Z][A-Za-z0-9]*$/.test(e);function xe(e,{store:n,subject:t}){let i=e.label,s=Ae(i)||i===e.mutation;if(s){let r=i.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").toLowerCase();i=r.charAt(0).toUpperCase()+r.slice(1)}let o=t.id?n.graph.getNode(t.id):void 0,c=o!==void 0&&e.nodeIds.length<=1&&(e.nodeIds[0]??o.id)===o.id;if(c&&/\bit\b/.test(i))return i.replace(/\bit\b/,t.name);let a=n.allMutations().find(r=>r.name===e.mutation);if(e.open.length===0&&a?.describe&&(s||c))try{let r=a.describe(e.args,n.graph);if(r.trim())return r.trim()}catch{}return i}var y=O(ye(),1);var p=O(K(),1);function Ye({phone:e,side:n,name:t,onClose:i,respond:s,onCall:o,onPick:c,onMove:a,place:r,onDraft:l}){let{seatTalk:g}=C(),u=U(g),f=Te(c),S=[...u.turns].reverse().find(h=>h.role==="seat"),m=e&&u.draft!==null,b=(0,y.useRef)(null),w=(0,y.useRef)(!0);return(0,y.useLayoutEffect)(()=>{let h=b.current;if(!h)return;let A=m?[...h.querySelectorAll("ol > li")].pop():void 0;if(A){let v=A.getBoundingClientRect().top-h.getBoundingClientRect().top+h.scrollTop;h.style.maxHeight=`min(${Math.ceil(h.scrollHeight-v)}px, ${fe})`}let k=w.current?he.get(g):void 0;w.current=!1,h.scrollTop=k&&k.turns===u.turns.length&&!u.busy?k.top:h.scrollHeight},[u.turns.length,u.busy,m]),(0,p.jsxs)("div",{"data-testid":"seat-panel",...m?{"data-graview-seat-yields":""}:{},style:{display:"grid",gridTemplateRows:"auto minmax(0, 1fr)",gap:4,minHeight:0},children:[(0,p.jsxs)("div",{"data-testid":"seat-top",...e?{onPointerDown:h=>Le(h,i)}:{},style:{display:"flex",alignItems:"center",justifyContent:e?"center":"flex-end",gap:2,position:"relative",minHeight:28,...e?{touchAction:"none"}:{}},children:[e?(0,p.jsx)("button",{type:"button","data-testid":"seat-grab","aria-label":`Close Ask ${t}`,title:"Close",onClick:i,style:{...E,width:64},children:(0,p.jsx)("span",{"aria-hidden":"true",style:{display:"block",width:36,height:4,margin:"0 auto",borderRadius:2,background:"var(--graview-edge-strong, var(--graview-ink-faint))"}})}):(0,p.jsx)("button",{type:"button","data-testid":"seat-side","aria-label":n==="left"?"Move to the right":"Move to the left",title:n==="left"?"Move to the right":"Move to the left",onClick:()=>g.setSide(n==="left"?"right":"left"),style:E,children:(0,p.jsx)("span",{"aria-hidden":"true",children:"\u21C4"})}),(0,p.jsx)("button",{type:"button","data-testid":"seat-close","aria-label":`Close Ask ${t}`,title:"Close",onClick:i,style:e?{...E,position:"absolute",top:0,right:0}:E,children:(0,p.jsx)("span",{"aria-hidden":"true",children:"\u2715"})})]}),(0,p.jsx)("div",{ref:b,"data-testid":"seat-body",onScroll:h=>void he.set(g,{top:h.currentTarget.scrollTop,turns:u.turns.length}),style:{minHeight:0,maxHeight:m?fe:e?"calc(70cqh - 96px)":"min(520px, calc(100cqh - 112px))",overflowY:"auto",overflowX:"hidden",padding:"0 4px"},children:(0,p.jsx)(ie,{shared:!0,composer:!1,testId:"seat",onPick:f,...a?{onMove:a}:{},...r?{place:r}:{},...l?{onDraft:l}:{},empty:(0,p.jsx)(Ce,{...r?{here:r}:{}}),...s?{respond:s}:{},...o?{onCall:o}:{}})}),(0,p.jsx)("p",{"aria-live":"polite","data-testid":"seat-said",style:Z,children:u.busy?"":S?.text??""})]})}function Te(e){let{setView:n}=C();return(0,y.useCallback)(t=>e?e(t):n(i=>Y(F(_(i,!1),t),[t])),[e,n])}function Ce({here:e}){let{store:n,views:t,view:i,seatTalk:s}=C(),o=ne({hover:!1}),c=q(n,V()),a=(0,y.useMemo)(()=>c.map(d=>d.line?{...d,message:B(d)}:d),[c]),r=o.id?n.graph.getNode(o.id):void 0,l=e??i.within?.view,g=o.because==="place"&&o.id===null?t.places().find(d=>d.title===o.name):l?t.places().find(d=>d.as===l):void 0,u=n.today(),f={store:n,subject:{id:o.id,name:o.name},violations:a,place:g?{title:g.title,kind:g.kind}:null,places:z(t.places()).map(d=>({title:d.title,kind:d.kind,picture:!0})),...u?{today:u}:{}},S=ce(f),m=ue(f),b=(0,y.useMemo)(()=>({pins:te(),...r?{focus:r.id,about:[r.id]}:{}}),[r?.id]),{affordances:w}=X(b),h=r?ge(w,{store:n,subject:{id:o.id,name:o.name}}):[],{apply:A,preview:k}=J(),[v,$]=(0,y.useState)(null),[D,R]=(0,y.useState)(null),H=(d,x)=>{try{return k(d,x),A(d,x),R(null),!0}catch(I){return R(G(n.schema,n.allMutations(),I)),!1}};return(0,p.jsxs)("div",{"data-testid":"seat-here",style:{display:"grid",gap:10,padding:"2px 2px 6px"},children:[(0,p.jsx)("p",{"data-testid":"seat-where",style:{margin:0,fontSize:"0.9375rem",lineHeight:1.45,color:"var(--graview-ink)"},children:S}),h.length>0?(0,p.jsx)("ul",{"aria-label":"What you can do",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:6},children:h.map(({affordance:d,label:x})=>(0,p.jsx)("li",{children:(0,p.jsx)("button",{type:"button","data-testid":"seat-act","data-affordance":d.id,"aria-pressed":v?.id===d.id,title:d.why,onClick:()=>d.open.length>0?$(I=>I?.id===d.id?null:d):void H(d),style:{...oe,minHeight:30,textAlign:"start",...d.destructive?{color:"var(--graview-warn)"}:{}},children:x})},d.id))}):null,v?(0,p.jsx)(Q,{affordance:v,onApply:d=>{H(v,d)&&$(null)},onCancel:()=>$(null)}):null,D?(0,p.jsx)("p",{"data-testid":"seat-refused",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-warn)"},children:D}):null,m.length>0?(0,p.jsx)("ul",{"aria-label":"Things to ask",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:2,justifyItems:"start"},children:m.map(d=>(0,p.jsx)("li",{children:(0,p.jsx)("button",{type:"button","data-testid":"seat-suggestion","data-graview-why":d.why,onClick:()=>s.ask(d.ask),style:re,children:d.ask})},d.ask))}):null]})}var fe="min(5.5em, 22cqh)",he=new WeakMap,L={far:64,flick:.5,least:16,tap:6};function Le(e,n){if(e.button!==0)return;let t=e.currentTarget,i=t.closest('[data-testid="seat"]');if(!i)return;let s=e.pointerId,o=e.clientY,c={y:o,at:e.timeStamp},a=0,r=0;try{t.setPointerCapture(s)}catch{}let l=u=>{if(u.pointerId!==s)return;r=Math.max(0,u.clientY-o);let f=u.timeStamp-c.at;f>0&&(a=(u.clientY-c.y)/f),c={y:u.clientY,at:u.timeStamp},i.style.transition="none",i.style.transform=r>0?`translateY(${r}px)`:""},g=u=>{if(u.pointerId!==s)return;t.removeEventListener("pointermove",l),t.removeEventListener("pointerup",g),t.removeEventListener("pointercancel",g);let f=u.type==="pointerup"&&(r>=L.far||r>=L.least&&a>=L.flick);if(i.style.transition=f?"":"transform 160ms ease-out",i.style.transform="",r>L.tap){let S=m=>{m.preventDefault(),m.stopPropagation()};t.addEventListener("click",S,{capture:!0,once:!0}),setTimeout(()=>t.removeEventListener("click",S,{capture:!0}),0)}f&&n()};t.addEventListener("pointermove",l),t.addEventListener("pointerup",g),t.addEventListener("pointercancel",g)}var E={display:"inline-grid",placeItems:"center",width:28,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,color:"var(--graview-ink-muted)",background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer"};export{Ye as SeatPanel,Te as useSeatGo};
@@ -0,0 +1 @@
1
+ import{a as b,b as c,c as d,d as e,e as f}from"./chunk.VOAZBHCG.js";import"./chunk.QTMWHE5O.js";import"./chunk.NDADLJE6.js";import"./chunk.HHPGWJDO.js";import"./chunk.42YX6NOY.js";import{hb as a}from"./chunk.6V2RG5JG.js";import"./chunk.AJZBJBMO.js";export{a as ActRefusal,e as compileDocumentWithoutCheck,d as effectsOf,f as inDocumentWords,c as kindShapes,b as readDocument};
@@ -0,0 +1 @@
1
+ import{h as o,m as u}from"./chunk.GFF2FB2J.js";function c(t,n,i){let e=r=>encodeURIComponent(r);return`${o}${e(t)}:${e(n)}:${e(i)}`}function S(t,n,i){let e=new Set(t.shown??[]);if(i?e.add(n):e.delete(n),e.size===0){let{shown:r,...w}=t;return w}return{...t,shown:[...e].sort()}}function l(t,n){if(n===null||n.trim().length===0){let{q:i,...e}=t;return e}return{...t,q:n}}function p(t){let n=t.q!==void 0&&t.within?.q===t.q;return l(n?u(t,"q",null):t,null)}function h(t,n){if(!n){let{past:i,...e}=t;return e}return{...t,past:!0}}function f(t,n){if(n===null||n.x===0&&n.y===0){let{pan:i,...e}=t;return e}return{...t,pan:n}}function d(t,n,i){let e={...t.pins};return i===null?delete e[n]:e[n]=i,{...t,pins:e}}export{c as a,S as b,l as c,p as d,h as e,f,d as g};
@@ -0,0 +1,2 @@
1
+ import{a as ee,b as E,d as oe,g as se,h as re,i as ie}from"./chunk.WAFDCOOG.js";import{Aa as T,D as I,E as w,Ea as Q,G as P,Ga as V,Ia as X,J as b,K,L as Y,O as v,Q as H,W as $,ba as U,da as B,ha as G,la as Z,pb as ne,qa as q,rb as te,sa as J}from"./chunk.6V2RG5JG.js";var ce=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,fe={day:"day",week:"week",month:"month",year:"year"},R=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function ye(t,e,n){let o=e.interval??1,i=fe[e.every],a=t.slice(0,10),c=o===1?`Every ${i}`:o===2?`Every other ${i}`:`Every ${o} ${i}s`,d;if(e.every==="week"){let f=(e.on?.length?e.on:[T[new Date(`${a}T00:00:00Z`).getUTCDay()]]).map(l=>H(T.indexOf(l),"long",n));d=o===1?`Every ${R(f)}`:o===2?`Every other ${R(f)}`:`${c} on ${R(f)}`}else if(e.every==="month"){let f=(e.on?.length?e.on:[+a.slice(8,10)]).map(l=>l===-1?"the last day":`the ${ce(Number(l))}`);d=`${c} on ${R(f)}`}else e.every==="year"?d=`${c} on ${v(a,n)}`:d=c;return w.test(t)&&(d+=` at ${Y(t,n)}`),e.until&&(d+=`, until ${b(e.until,n)}`),e.count&&(d+=`, ${e.count===1?"once":`${e.count} times`}`),d}function de(t,e,n={}){if(!V(e)||typeof t!="string")return;let o=n.today??P(),i=X(t,e,o),a=ye(t,e,n.locale),c=i.slice(0,4)===o.slice(0,4)?v(i.slice(0,10),n.locale):b(i.slice(0,10),n.locale);return i.slice(0,10)<o?`${a}, last ${c}`:`${a}, next ${c}`}function Pe(t,e){let n=new Map,o=new Map;for(let i of t){let a=$(e(i.kind),i).trim().toLowerCase();o.set(a,[...o.get(a)??[],i])}for(let i of o.values()){if(i.length<2)continue;let a=new Map;for(let c of i)a.set(c.kind,[...a.get(c.kind)??[],c]);for(let[c,d]of a){if(d.length===1){n.set(d[0].id,B(e(c),c));continue}let f=d.map(y=>new Map(pe(y,e(y.kind)).map(r=>[r.key,r.alone]))),l=[...new Set(f.flatMap(y=>[...y.keys()]))],p=y=>f.every(r=>!/\d/.test(r.get(y)??"")),A=[...l.filter(p),...l.filter(y=>!p(y))].find(y=>new Set(f.map(r=>r.get(y)??"")).size===d.length);d.forEach((y,r)=>{let s=A?f[r].get(A):void 0;n.set(y.id,s??y.id)})}}return n}function Ke(t,e){return t?.describe?t.describe(e):`${e.kind} ${$(t,e)}`}var ue=new Set(["id","kind","label"]);function ge(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function pe(t,e,n={}){let o=e?.display,i=new Set([...ue,...o?.hide??[]]);typeof t.label=="string"&&e?.label&&!$(e,t).includes(t.label)&&i.delete("label");let a=(n.said??[]).filter(r=>!!r),c=a.filter(r=>r.endsWith("\u2026")).map(r=>r.replace(/…$/,"").trim()).filter(r=>r.length>12),d=[],f=e?.fields?.shape,l=e?.fieldRoles,p=n.glance?o?.glance??[l?.who,l?.when].filter(r=>!!r):ae(o?.page),M=n.glance&&o?.glance!==void 0,y=[...new Set(M?p:[...p,...be(e),...Object.keys(t)])].filter(r=>Object.hasOwn(t,r)).map(r=>[r,t[r]]);for(let[r,s]of y){if(i.has(r)||s===void 0||s===null)continue;let u=o?.format?.[r],k=u?[]:G(s);if(k[0]&&n.glance)continue;let O=e?.fields?.shape?.[r],_=!u&&typeof s=="string"&&Z(O)?s:void 0,x=!u&&typeof s=="string"&&ee(O);if(_&&n.glance)continue;let S=u?void 0:J(O),m=S?{relation:S,refs:q(s,S)}:void 0;if(m&&(n.glance||m.refs.length===0)||!k[0]&&typeof s=="object"&&(!Array.isArray(s)||s.some(g=>typeof g=="object"&&g!==null))&&u===void 0)continue;let j=typeof s=="string"&&!u?de(s,t[`${r}Repeat`],{locale:n.locale}):void 0,F=k[0]?k.map(g=>g.caption?`${g.name} \u2014 ${g.caption}`:g.name).join(", "):Array.isArray(s)?s.join(", "):typeof s=="boolean"?s?"Yes":"No":String(s),N=u?void 0:se(e,r),L=ie(N,s),W=!u&&!N&&typeof s=="number"?ne(e?.fields?.shape?.[r]):void 0,z=m?m.refs.length>1?`${m.refs.length} linked records`:"linked record":u?u(s):W?te(s,W):re(N,s,n.locale)??(Array.isArray(s)||typeof s=="boolean"?F:typeof s=="string"&&j!==void 0?j:typeof s=="string"&&I.test(s)?b(s,n.locale):typeof s=="string"&&w.test(s)?K(s,n.locale):typeof s=="string"&&ke(e,r)?E(e,r,s):F),C=typeof s=="string"&&Ae(e,r,z),h=(n.glance||n.excerpt)&&!u&&(C||x)?oe(z,{markdown:x}):z;if(a.includes(h)||c.some(g=>h.startsWith(g))||n.glance&&(typeof s=="string"||typeof s=="number")&&a.some(g=>ge(g,h)))continue;let D=U(e,r),le=typeof s=="number"?`${D} ${h}`:typeof s=="boolean"&&!u?`${D}: ${h.toLowerCase()}`:h;if(d.push({key:r,label:D,value:h,stored:F,alone:le,long:C,...x?{markdown:!0}:{},...k[0]?{files:k}:{},..._?{app:_}:{},...m?{linked:m}:{},...L?{href:L}:{},...Q(f?.[`${r}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&d.length>=n.limit)break}return me(d,e)}function me(t,e){let n=new Map;for(let o of t){let i=he(e,o.key);i&&n.set(o.key,new Set(i.map(a=>E(e,o.key,a).toLowerCase())))}return n.size<2?t:t.map(o=>{let i=n.get(o.key);return i!==void 0&&[...n].some(([c,d])=>c!==o.key&&[...i].some(f=>d.has(f)))?{...o,alone:`${o.label}: ${o.value.toLowerCase()}`}:o})}function he(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function ke(t,e){let n=t?.fields?.shape?.[e];for(let o=0;o<6&&n?._zod?.def?.innerType!==void 0;o++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function be(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function ae(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var we=500,$e=160;function Re(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function Ae(t,e,n){return Re(t?.fields?.shape?.[e])?.checks?.some(i=>i._zod?.def?.check==="max_length"&&(i._zod.def.maximum??0)>we)?!0:typeof n=="string"&&(n.includes(`
2
+ `)||n.length>$e)}function Ye(t,e){let n=t?.display?.page,o=n?.groups??[],i=new Map(e.map(l=>[l.key,l])),a=new Set(ae(n)),c=l=>l.flatMap(p=>i.has(p)?[i.get(p)]:[]),d=e.filter(l=>!a.has(l.key));return[{fields:[...c(n?.fields??[]),...o.length>0?[]:d]},...o.map(l=>({title:l.title,fields:c(l.fields)})),...o.length>0?[{title:"Details",fields:d}]:[]].filter(l=>l.fields.length>0)}export{ye as a,Pe as b,Ke as c,pe as d,Ye as e};
@@ -0,0 +1 @@
1
+ import"./chunk.L4DECHXR.js";import{G as F,O,P as R,R as j,_ as E}from"./chunk.GFF2FB2J.js";import{K as M,Ka as T,dc as x}from"./chunk.6V2RG5JG.js";import{b as S}from"./chunk.AJZBJBMO.js";function W(n,t){return n.kind==="agent"?"agent":n.kind!=="human"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var K=n=>n.ops.filter(t=>t.withheld!==!0);function C(n,t={}){let r=n.batches().map(e=>{let s=e.ops[0],l=e.ops.at(-1),d=K(e).length===0;return{seq:l.seq+1,from:s.seq,at:l.at,batch:e.id,maker:d?"person":W(e.author,t.me),author:d?void 0:e.author,said:e.intent,declaration:!1,withheld:d}}),i=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of i){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let s=r.findIndex(l=>l.seq===e.seq);if(s>=0&&!r[s].withheld){r[s]={...r[s],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?W(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,s)=>e.seq-s.seq||+(e.batch!==void 0)-+(s.batch!==void 0))}function N(n,t){let r=n.log.all(),i=new Map(r.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(s=>s.undoes!==void 0&&(i.get(s.undoes)??-1)>=t)).map(e=>e.id)}function I(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?T(n.author,t):"the app"}var c=S(F(),1);var o=S(j(),1),Y={kind:"human"},_=[1,2,4,8],G=900,P={you:"You",person:"A person",agent:"An agent",app:"The app"},z={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function U(n,t){return[...new Set([t,...n.map(r=>r.seq)])].sort((r,i)=>r-i)}function X(n,t){let r=0;for(let i=0;i<n.length;i++)n[i]<=t&&(r=i);return r}function J(n,t,r){let i=N(n,t);if(i.length===0)return null;let e=n.canUndo(i);if(!e.ok)return null;let s=new Set(n.permittedMutations(r).map(l=>l.name));return e.ops.every(l=>l.mutation!==null&&s.has(l.mutation.name))?i:null}function re({face:n}){let t=O(),r=E(),i=r?.principal??Y,e=R(t.live,i),s=e.log.length,l=(0,c.useMemo)(()=>C(e,{me:i,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,i,t.host,s]),d=(0,c.useMemo)(()=>U(l,e.log.horizon),[l,e]),m=t.past?.seq??s,h=X(d,m),f=d.length-1,g=[...l].reverse().find(a=>a.seq<=m&&a.seq>(d[h-1]??-1))??[...l].reverse().find(a=>a.seq<=m),[y,k]=(0,c.useState)(!1),[b,B]=(0,c.useState)(1),[q,A]=(0,c.useState)(null);(0,c.useEffect)(()=>{if(!y)return;if(h>=f){k(!1);return}let a=setTimeout(()=>t.show(d[h+1]),G/b);return()=>clearTimeout(a)},[y,h,f,b,d,t]);let $=(0,c.useMemo)(()=>t.past?J(e,m,i):null,[t.past,e,m,i,s]),D=a=>I(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),u=t.past?t.past.at?M(t.past.at,r?.locale):"the start":null,w=g?`${D(g)==="you"?"You":D(g)}: ${g.said}`:"Nothing had happened yet",H=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:x("rail")}:{position:"sticky",top:0,zIndex:x("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,o.jsxs)("section",{"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...H,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,o.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:u?`As of ${u}`:"Now"}),(0,o.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:w}),u?(0,o.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,o.jsx)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:d.slice(1).map((a,v)=>{let p=[...l].reverse().find(V=>V.seq===a),L=f===0?0:(v+1)/f*100;return(0,o.jsx)("span",{"data-graview-tick":a,"data-maker":p.maker,...p.declaration?{"data-declaration":""}:{},title:`${P[p.maker]}: ${p.said}`,style:{position:"absolute",left:`calc(${L}% - 1px)`,bottom:0,width:p.declaration?4:2,height:p.declaration?22:12,borderRadius:2,background:p.declaration?"var(--graview-ink)":z[p.maker],opacity:a<=m?1:.45}},`${a}:${p.batch??"declaration"}`)})}),(0,o.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:f,step:1,value:h,"aria-valuetext":u?`As of ${u}. ${w}`:`Now. ${w}`,onChange:a=>{k(!1),t.show(d[Number(a.currentTarget.value)]??s)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,o.jsx)("button",{type:"button","data-testid":"play","aria-pressed":y,onClick:()=>{!y&&h>=f&&t.show(d[0]),k(!y)},style:{minHeight:28,minWidth:64},children:y?"Pause":"Play"}),(0,o.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,o.jsx)("select",{"data-testid":"speed",value:b,onChange:a=>B(Number(a.currentTarget.value)),style:{minHeight:28},children:_.map(a=>(0,o.jsxs)("option",{value:a,children:[a,"\xD7"]},a))})]}),(0,o.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(P).filter(a=>l.some(v=>v.maker===a)).map(a=>(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:z[a]}}),P[a]]},a))}),(0,o.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[$?(0,o.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{A(null);try{e.undo([...$],{author:i,intent:u?`Restore to ${u}`:"Restore"}),t.show(null)}catch(a){A(a instanceof Error?a.message:String(a))}},style:{minHeight:28},children:"Restore to here"}):null,(0,o.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),q?(0,o.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:q}):null]})}export{re as Timeline};
@@ -0,0 +1 @@
1
+ import"./chunk.3VL5WECB.js";import"./chunk.JH6MU6TX.js";import{b as m}from"./chunk.WAFDCOOG.js";import"./chunk.L4DECHXR.js";import{R as p}from"./chunk.GFF2FB2J.js";import{M as l}from"./chunk.6V2RG5JG.js";import{b as f}from"./chunk.AJZBJBMO.js";var a=f(p(),1);function N({states:e,definition:v}){let s=e.values.reduce((t,n)=>t+n.count,0),u=t=>t===null?"with none":m(v,e.field,t).toLowerCase(),c=e.values.filter(t=>t.count>0).map(t=>`${l(t.count)} ${u(t.value)}`).join(", ");return s===0?null:(0,a.jsx)("div",{className:"graview-district-states",role:"img","aria-label":c,title:c,children:e.values.map((t,n)=>{if(t.count===0)return null;let y=e.values.filter(r=>r.count>0).length,w=t.count/s*(168-(y-1)),o=l(t.count),i=`${o} ${u(t.value)}`,d=r=>r.length*6.2+8<=w;return(0,a.jsx)("span",{"data-graview-tier":t.tier,style:{flexGrow:t.count},title:i,children:d(i)?i:d(o)?o:""},n)})})}export{N as StatesBar};
@@ -0,0 +1 @@
1
+ import{c as b,d as J}from"./chunk.3VL5WECB.js";import{a as O,f as q}from"./chunk.WAFDCOOG.js";import{$a as L,B as m,Da as j,Ea as A,Oa as v,_a as D,ab as N,fc as Z,gc as k,ia as R,la as x,sa as S,ub as M,yb as P,zb as w}from"./chunk.6V2RG5JG.js";var E=n=>n.safeParse?.(void 0).success??!1,T=n=>b(n).shape,F=n=>{let s=b(n);if(m(s)?.type!=="literal")return;let e=m(s)?.values;return e&&e.length===1&&typeof e[0]=="string"?e[0]:void 0};function g(n,s){let e=E(s),o=b(s),r=m(o)?.type,l=M(s);if(l)return{control:"node",name:n,optional:e,kinds:l};let y=S(s);if(y)return{control:"linked",name:n,optional:e,relation:y};if(A(s)){let a=j(n);return{control:"repeat",name:n,optional:e,...a?{of:a}:{}}}if(r==="boolean")return{control:"boolean",name:n,optional:e};let p=R(o);if(p)return{control:"file",name:n,optional:e,...p==="image"?{image:!0}:{}};if(r==="object"){let a=o.shape??{};return{control:"group",name:n,optional:e,fields:Object.entries(a).map(([c,d])=>g(c,d))}}if(r==="union"){let a=m(o)?.options??[],c=a.map(t=>T(t));if(c.every(t=>t!==void 0)){let t=Object.keys(c[0]??{}).find(f=>c.every(u=>F(u?.[f])!==void 0));if(t)return{control:"variant",name:n,optional:e,tag:t,options:a.map((f,u)=>({value:F(c[u]?.[t])??"",fields:Object.entries(c[u]??{}).filter(([h])=>h!==t).map(([h,z])=>g(h,z))}))}}let d=a.map(t=>F(t));return d.every(t=>t!==void 0)?{control:"choice",name:n,optional:e,options:d}:{control:"opaque",name:n,optional:e}}if(r==="array"){let a=m(o)?.element;return a!==void 0?{control:"list",name:n,optional:e,item:g(n,a)}:{control:"opaque",name:n,optional:e}}let i=J(s);return i.type==="text"?{control:"text",name:n,optional:e,...i.long?{long:!0}:{},...x(o)?{app:!0}:{},...O(o)?{markdown:!0}:{},...i.holds?{holds:i.holds}:{}}:i.type==="number"&&i.duration?{control:"text",name:n,optional:e,holds:"duration"}:i.type==="date"?{control:"date",name:n,optional:e,...i.time?{time:!0}:{}}:i.type==="number"?{control:"number",name:n,optional:e,...i.min===void 0?{}:{min:i.min},...i.max===void 0?{}:{max:i.max},...i.step===void 0?{}:{step:i.step},...i.amount?{amount:i.amount}:{}}:i.type==="choice"?{control:"choice",name:n,optional:e,options:i.options}:{control:"opaque",name:n,optional:e}}function B(n){let s=n.shape;return s?Object.entries(s).map(([e,o])=>g(e,o)):[]}function K(n,s){let e={...s};for(let o of n){let r=s[o.name];r===void 0&&!o.optional&&(o.control==="list"||o.control==="boolean")&&(e[o.name]=o.control==="list"?[]:!1),o.control==="text"&&o.holds&&typeof r=="string"&&(e[o.name]=r.trim()===""?void 0:o.holds==="duration"?q(r)??r:r.trim()),o.control==="group"&&r!==void 0&&typeof r=="object"&&r!==null&&(e[o.name]=K(o.fields,r))}return e}function C(n,s,e){let o=n.derived?.act==="edit"&&n.subject?e[n.subject.arg]:void 0,r=typeof o=="string"?s.getNode(o):void 0;return r?Object.fromEntries((n.writes??[]).filter(l=>r[l]!==void 0&&r[l]!==null).map(l=>[l,r[l]])):{}}function I(n,s){return Object.fromEntries(Object.entries(n).filter(([e,o])=>!Object.hasOwn(s,e)||JSON.stringify(o)!==JSON.stringify(s[e])))}function _(n,s,e,o){let r=Z.keptFrom?.(n,s),l=new Set;if(!r)return l;let y=Object.keys(e.input.shape??{});for(let c of e.creates??[]){let d=r({id:"\0new",kind:c});for(let t of y)d?.(t)&&l.add(t)}let p=o===void 0?void 0:n.graph.getNode(o),i=p&&n.schema.tryDefinition(p.kind),a=p&&r(p);if(i&&a)for(let c of w(e,i))a(c)&&y.includes(c)&&l.add(c);return l}function dn(n,s,e,o){let r=new Set,l=s?.sees??[];if(L(e)||!l.some(k))return r;let y=D(e),p=(d,t)=>{let f=l.filter(u=>u.kinds.includes(d)&&N(u,y));return f.some(k)?v.has(t)||f.some(u=>!k(u)||(u.fields===void 0||u.fields.includes(t))&&!u.hide?.includes(t)):!0},i=Object.keys(o.input.shape??{}),a=new Map,c=(d,t)=>a.set(d,a.get(d)===!0||t);for(let d of o.creates??[]){let t=Object.keys(n.tryDefinition(d)?.fields.shape??{});for(let f of i)t.includes(f)&&c(f,p(d,f))}for(let d of P(n,o)){let t=n.tryDefinition(d);if(t)for(let f of w(o,t))i.includes(f)&&c(f,p(d,f))}for(let[d,t]of a)t||r.add(d);return r}export{B as a,K as b,C as c,I as d,_ as e,dn as f};
@@ -0,0 +1 @@
1
+ import{a as I,c as x}from"./chunk.T3VPD7JQ.js";import"./chunk.L4DECHXR.js";import{c as b,d as A,k as v,r as w,t as O,w as G}from"./chunk.GFF2FB2J.js";import{Mc as E,Sc as S,Tc as W,xc as k}from"./chunk.6V2RG5JG.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
+ import{i as a,j as o}from"./chunk.YV2LJFGS.js";import"./chunk.QNGWEV47.js";import"./chunk.ERXSYPYL.js";import"./chunk.J2ITFGN3.js";import"./chunk.QTA4ROAK.js";import"./chunk.2CIBWZJG.js";import"./chunk.RRVIXV7W.js";import"./chunk.7BWT5L2L.js";import"./chunk.VSZQXB4Q.js";import"./chunk.UWGWXFWZ.js";import"./chunk.SE5SKFQH.js";import"./chunk.W3S6UXNA.js";import"./chunk.WVUJXDXZ.js";import"./chunk.OZNW5W4Z.js";import"./chunk.NDADLJE6.js";import"./chunk.AK3IHFCF.js";import"./chunk.HHPGWJDO.js";import"./chunk.42YX6NOY.js";import"./chunk.EYZ7MHBZ.js";import"./chunk.KQT7WAQE.js";import"./chunk.PAVR5TK5.js";import"./chunk.OQDETV4X.js";import"./chunk.3VL5WECB.js";import"./chunk.JH6MU6TX.js";import"./chunk.WAFDCOOG.js";import"./chunk.L4DECHXR.js";import{ka as n}from"./chunk.GFF2FB2J.js";import"./chunk.6V2RG5JG.js";import"./chunk.AJZBJBMO.js";var w=new WeakMap;function s(e,i){let t=w.get(e);t||w.set(e,t=new Map);let r=t.get(i);return r||t.set(i,r=a(o(e,n(e)),e,i)),r}export{s as frameworkViews};
@@ -0,0 +1,2 @@
1
+ import{a as Pe,b as $e}from"./chunk.OQ4KFN6W.js";import"./chunk.YNQDVGZM.js";import"./chunk.3R4W2P5X.js";import"./chunk.C5CYZNSJ.js";import"./chunk.JPHNKWTY.js";import"./chunk.XRJBLH4N.js";import{j as Ee,k as He}from"./chunk.3SKKIHU3.js";import"./chunk.HJCQ6I3S.js";import"./chunk.O2LK2AO7.js";import"./chunk.26CZTUY4.js";import"./chunk.3JNMSOFG.js";import"./chunk.PKK6FRZR.js";import"./chunk.OAF7TUMI.js";import"./chunk.J2ITFGN3.js";import"./chunk.6XMEU2Q2.js";import{a as ze,b as x}from"./chunk.QIAKO27D.js";import{b as Te,c as Me}from"./chunk.UT6642FC.js";import"./chunk.2CIBWZJG.js";import"./chunk.7BWT5L2L.js";import"./chunk.SE5SKFQH.js";import"./chunk.W3S6UXNA.js";import"./chunk.4SJUTBDV.js";import"./chunk.TI4OSTQV.js";import"./chunk.6T2Q6NLO.js";import"./chunk.OZNW5W4Z.js";import"./chunk.NDADLJE6.js";import"./chunk.AK3IHFCF.js";import"./chunk.HHPGWJDO.js";import"./chunk.42YX6NOY.js";import{u as Ce}from"./chunk.KQT7WAQE.js";import"./chunk.PAVR5TK5.js";import"./chunk.OQDETV4X.js";import{g as Ae}from"./chunk.3VL5WECB.js";import"./chunk.JH6MU6TX.js";import{c as Se}from"./chunk.WAFDCOOG.js";import{g as ke}from"./chunk.L4DECHXR.js";import{G as Ge,R as we,Z as W,i as ve,oa as Q,ta as be,v as ye,xa as xe}from"./chunk.GFF2FB2J.js";import{Ib as me,ca as K,da as L,dc as fe,jb as he}from"./chunk.6V2RG5JG.js";import{b as Y}from"./chunk.AJZBJBMO.js";var a=Y(Ge(),1);var n=Y(we(),1);function dt({placement:d="float",chosen:o=!0}={}){let{menuAt:r}=W();return d==="menu"&&r===null?o?(0,n.jsx)(Je,{}):null:(0,n.jsx)(Xe,{placement:d})}function Je(){let{store:d,setMenuAt:o,view:r}=W(),{selection:f}=Q(),h=(0,a.useRef)(null),[p,k]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let v=h.current?.offsetParent??h.current?.parentElement;if(!v)return;let w=Math.round(v.getBoundingClientRect().width);w!==p&&k(w)});let S=f.length===1&&!r.overview?d.graph.getNode(f[0]):void 0;return!S||p===null||p>=Re?(0,n.jsx)("span",{ref:h,hidden:!0}):(0,n.jsx)("button",{type:"button",ref:h,"data-testid":"chosen-acts","aria-label":`What can be done with ${x(d,S.id)}`,"aria-haspopup":"menu",onClick:v=>{let w=v.currentTarget.getBoundingClientRect();o({x:Math.round(w.right),y:Math.round(w.bottom+4),on:S.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 Re=564;function Xe({placement:d}){let{store:o,menuAt:r,setMenuAt:f,view:h}=W(),p=(0,a.useRef)(null),k=(0,a.useRef)(null),S=(0,a.useRef)(null),v=(0,a.useRef)(null);r?.returnTo&&(v.current=r.returnTo);let w=e=>{let i=e.closest("[data-graview-asking]")?.getAttribute("data-graview-asking"),t=e.getAttribute("data-pin-for"),g=i??e.getAttribute("data-affordance")??(t===null?null:`pin:${t}`)??e.getAttribute("data-menu-item");k.current=g===null?null:{key:g,element:e}};(0,a.useEffect)(()=>{let e=p.current,i=k.current;if(i===null||document.activeElement!==document.body||i.element.isConnected)return;let t=i.key;if(!e){k.current=null;let H=v.current;v.current=null,(H?.isConnected?H:S.current)?.focus();return}((t.startsWith("pin:")?e.querySelector(`[data-pin-for="${CSS.escape(t.slice(4))}"]`):null)??e.querySelector(`[data-affordance="${CSS.escape(t)}"]:not([disabled])`)??e).focus()});let[Le,We]=(0,a.useState)(null);(0,a.useLayoutEffect)(()=>{let e=p.current?.offsetParent??p.current?.parentElement;if(e instanceof HTMLElement&&(S.current=e),!e)return;let i=e.getBoundingClientRect();We(t=>t&&t.left===i.left&&t.top===i.top&&t.width===i.width&&t.height===i.height?t:{left:i.left,top:i.top,width:i.width,height:i.height})});let{selection:Ne,set:De,clear:Oe}=Q(),s=r?.about??Ne,[N,Fe]=(0,a.useState)(()=>Pe()),D=r?.on??s[s.length-1],O=r?.about,qe=(0,a.useMemo)(()=>({pins:N,...D===void 0?{}:{focus:D},...O?{about:O}:{}}),[N,D,O]),Be=(0,a.useMemo)(()=>new Set(o.allMutations().filter(e=>e.pinned).map(e=>e.name)),[o]),{affordances:c,withheld:m,observations:G}=Ee(qe),je=r===null?null:{face:r.face??"scene",on:r.on,about:s,field:r.field,place:r.place,href:r.href,element:r.returnTo},J=Ce(je),X=G.some(e=>e.id.startsWith("schema:waits:")),{apply:Ue,preview:_e}=He(),[C,z]=(0,a.useState)(null),[Ve,Z]=(0,a.useState)(!1),[ee,te]=(0,a.useState)(!1),[P,$]=(0,a.useState)(""),[ne,F]=(0,a.useState)(null),q=(0,a.useRef)([]),B=(e,i)=>{try{return _e(e,i),Ue(e,i),F(null),f(null),q.current=[],!0}catch(t){return F(Ae(o.schema,o.allMutations(),t)),q.current=t instanceof he?t.issues.map(g=>String(g.path[0]??"")).filter(Boolean):[],!1}},I=[...new Set(s.flatMap(e=>{let i=o.graph.getNode(e);return i?[i.kind]:[]}))],b=I.length>0?I:[...new Set(s.flatMap(e=>ye(e)))],u=s.length===1?ve(s[0]):null,j=u?{from:o.graph.getNode(u.from),to:o.graph.getNode(u.to)}:null,ie=u?Me(o,u):void 0,re=ie?.provisional?ie:void 0,ae=u?(()=>{let e=o.schema.tryDefinition(o.graph.getNode(u.from)?.kind??"")?.edges?.[u.kind],i=o.graph.getNode(u.to);return e?.inverse&&i?`From ${x(o,i.id)}: ${e.inverse}`:null})():null;(0,a.useEffect)(()=>{z(null),Z(!1),te(!1),F(null),$("")},[s,r?.about]);let l=r!==null,Ye=d==="menu"&&!l,A=(0,a.useRef)(r);A.current=r;let oe=xe("acts",{open:l&&d==="menu",onOpenChange:e=>{e||f(null)},at:()=>A.current?{x:A.current.x,y:A.current.y}:null,returnTo:()=>{let e=A.current?.returnTo;if(e?.isConnected)return e;let i=A.current?.on;return i?document.querySelector(`[data-graview-view="${CSS.escape(i)}"]`):null},align:"start"}),le=(Le?.width??Number.POSITIVE_INFINITY)<Re;if((0,a.useLayoutEffect)(()=>{let e=p.current?.offsetParent;if(!e||!le||l)return;let i=p.current?.getBoundingClientRect().height??0,t=`${Math.round(i)+20}px`;if(e.style.paddingBottom===t)return;let g=e.style.paddingBottom;return e.style.paddingBottom=t,()=>{e.style.paddingBottom=g}}),s.length===0&&!l)return null;let se=r?.title!==void 0||s.length>0&&!(s.length===1&&s[0]===h.focusId),de=Math.max(1,Math.min(9,c.length)),T=[...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)],ue=T.length>de&&!l,pe=P.trim().toLowerCase(),y=ue&&pe.length>0?T.filter(e=>`${e.label} ${e.why}`.toLowerCase().includes(pe)):null,U=y??(Ve||l?T:T.slice(0,de)),ce=y?0:T.length-U.length,R=[];for(let e of U){let i=!l&&e.provider==="invariant",t=!l&&!i&&e.pinned!==void 0&&!e.destructive,g=!l&&!i&&!t&&e.ties===!0&&!e.destructive,H=i?e.why:t?"pinned":g?"its ties":null,Qe=i?"violation":t||g?"ties":null,V=R[R.length-1];V&&V.heading===H?V.items.push(e):R.push({heading:H,tone:Qe,items:[e]})}let _=c.find(e=>e.id===C),E=s.length===1?x(o,s[0]):null,ge=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 t=i.trimStart();return t.length===0?e:t[0].toUpperCase()+t.slice(1)},Ke=new Set(l?[]:U.filter(e=>e.provider==="invariant").map(e=>e.why)),M=G.filter(e=>!Ke.has(e.text)).map(e=>({...e,text:ge(e.text)}));return Ye?null:(0,n.jsxs)("section",{...l?oe.pane:{},ref:e=>{p.current=e,l&&oe.pane.ref(e)},"aria-label":"Inspector","data-graview-offstage":"","data-testid":l?"context-menu":"inspector-strip",tabIndex:-1,onFocus:e=>w(e.target),onBlur:e=>{e.relatedTarget!==null&&(k.current=null)},onMouseDown:e=>e.stopPropagation(),style:{...l?be:{position:"absolute",zIndex:fe("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"}:le?{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,n.jsx)("h2",{style:{...ke,margin:0},children:"Inspector"}),(0,n.jsxs)("div",{style:{display:se||!l?"flex":"none",alignItems:"baseline",flexWrap:"wrap",gap:"2px 8px",minWidth:0,paddingRight:l?0:24},children:[se?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("strong",{style:{fontSize:"0.9375rem",whiteSpace:"nowrap"},children:r?.title??(s.length===1?x(o,s[0]):`${s.length} selected`)}),I.length>0||u?(0,n.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",whiteSpace:"nowrap"},children:u?"relation":I.map(e=>L(o.schema.tryDefinition(e),e)).join(" \xB7 ")}):null,s.length===1&&!u&&r?.face!=="pages"?(0,n.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,n.jsx)("span",{style:{flex:"1 1 auto"}})]}),l?null:(0,n.jsx)("button",{type:"button",onClick:()=>{f(null),Oe()},"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&&j?(0,n.jsxs)("div",{style:{display:"grid",gap:6},children:[ae?(0,n.jsx)("p",{"data-testid":"edge-said",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:ae}):null,re?(0,n.jsx)("p",{"data-testid":"edge-provisional",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:Te(re)}):null,(0,n.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[["from",j.from],["to",j.to]].map(([e,i],t)=>(0,n.jsxs)(a.Fragment,{children:[t===1?(0,n.jsx)("span",{"aria-hidden":"true",style:{color:"var(--graview-ink-faint)"},children:"\u2192"}):null,i?(0,n.jsx)("button",{type:"button","data-testid":`edge-${e}`,onClick:()=>De([i.id]),title:`Select ${x(o,i.id)}`,style:{fontSize:"0.8125rem",padding:"3px 9px",borderRadius:6},children:x(o,i.id)}):(0,n.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"gone"})]},e))})]}):null,!u&&s.length===1&&me(o,s[0])?(0,n.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,M.length>0?(0,n.jsx)("div",{"data-testid":"observations",title:M.map(e=>e.text).join(`
2
+ `),style:{display:"grid",gap:3},children:M.slice(0,2).map(e=>(0,n.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[e.text,e===M[1]&&M.length>2?(0,n.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" +",M.length-2]}):null]},e.id))}):null,l?J.start.map(e=>(0,n.jsx)(Ie,{section:e,close:()=>f(null)},e.id)):null,ne?(0,n.jsx)("p",{"data-testid":"refused",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-warn)"},children:ne}):null,ue?(0,n.jsx)("input",{"data-testid":"action-filter",value:P,onChange:e=>$(e.target.value),placeholder:`Filter ${T.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"&&y?.length===1){let i=y[0];if(i.destructive)return;i.open.length>0?z(i.id):B(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,y!==null&&y.length===0?(0,n.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,c.length===0&&!X&&s.length===0?null:c.length===0&&!X?(0,n.jsx)("p",{"data-testid":"no-affordances",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:m.length>0?`Nothing you may do with ${u?"this relation":b.length===1?K(L(o.schema.tryDefinition(b[0]),b[0])):"this mix of kinds"} \u2014 ${m.length} action${m.length===1?"":"s"} withheld.`:u?`Nothing can be done with this line yet \u2014 nothing this app declares makes or breaks \u201C${Se(o.schema,o.graph.getNode(u.from)?.kind??"",u.kind,"out")}\u201D.`:`Nothing can be done with ${b.length===1?K(L(o.schema.tryDefinition(b[0]),b[0])):"this mix of kinds"} yet \u2014 nothing this app declares acts on ${b.length===1?"it":"them"}.`}):(0,n.jsxs)("ol",{"data-testid":"affordances",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[R.map((e,i)=>(0,n.jsxs)(a.Fragment,{children:[e.heading?(0,n.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"?ge(e.heading):e.heading]}):i>0?(0,n.jsx)("li",{"aria-hidden":"true",style:{borderTop:"1px solid var(--graview-edge)",margin:"6px 0 3px"}}):null,e.items.map(t=>(0,n.jsxs)("li",{style:{display:"flex",gap:2,alignItems:"stretch"},children:[(0,n.jsxs)("button",{type:"button","data-affordance":t.id,"data-rank":t.rank,"data-graview-destructive":t.destructive||void 0,"aria-pressed":C===t.id,title:t.why,style:{padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:C===t.id?"var(--graview-accent)":l?"transparent":"var(--graview-edge)",background:l?"none":"var(--graview-panel)",boxShadow:"none",...t.destructive?{color:"var(--graview-warn)"}:{},...C===t.id?{color:"var(--graview-accent)"}:{}},onClick:()=>{if(t.open.length>0){z(C===t.id?null:t.id);return}B(t)},children:[t.label,t.open.length>0?(0,n.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:" \u2026"}):null,y?.length===1&&y[0]?.id===t.id&&!t.destructive?(0,n.jsx)("span",{"aria-hidden":"true",title:"Enter runs it",style:{float:"right",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},children:"\u21B5"}):null]}),(0,n.jsx)("button",{type:"button","data-testid":"pin-toggle","data-pin-for":t.mutation,"aria-pressed":t.pinned!==void 0,"aria-label":t.pinned!==void 0?`Unpin ${t.label}`:`Pin ${t.label}`,title:t.pinned==="declared"?"Pinned by the app \u2014 unpin it for yourself":t.pinned==="user"?"Unpin":"Pin to the top",onClick:()=>Fe($e(N,t.mutation,Be.has(t.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:t.pinned==="user"?"var(--graview-accent)":t.pinned==="declared"?"var(--graview-ink-muted)":"var(--graview-ink-faint)"},children:t.pinned!==void 0?"\u2605":"\u2606"})]},t.id))]},`${e.heading??"plain"}-${i}`)),ce>0?(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button",onClick:()=>Z(!0),title:`Show all ${c.length} actions`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",ce," more"]})}):null]}),m.length>0?(0,n.jsxs)("ul",{"data-testid":"withheld",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",flexWrap:"nowrap",gap:2},children:[m.slice(0,l||ee?m.length:3).map(e=>(0,n.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,n.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,n.jsx)("s",{children:e.label})}),(0,n.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&&!ee&&m.length>3?(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-testid":"withheld-more",onClick:()=>te(!0),title:`Show all ${m.length} actions this seat may not take`,style:{padding:"4px 10px",fontSize:"0.875rem",borderRadius:8},children:["Show ",m.length-3," more withheld"]})}):null]}):null,l?J.end.map(e=>(0,n.jsx)(Ie,{section:e,close:()=>f(null)},e.id)):null,_?(0,n.jsx)(ze,{affordance:_,onApply:e=>{if(B(_,e))z(null);else return q.current},onCancel:()=>z(null)}):null]})}function Ie({section:d,close:o}){return(0,n.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,n.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,n.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:d.items.map(r=>(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-menu-item":r.id,onClick:()=>{o(),r.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:[r.label,r.hint?(0,n.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",r.hint]}):null]})},r.id))}):null,d.render?.(o)]})}export{dt as InspectorPane};
@@ -0,0 +1 @@
1
+ import{h as x}from"./chunk.L4DECHXR.js";import{G as k,R as p}from"./chunk.GFF2FB2J.js";import{Nc as m}from"./chunk.6V2RG5JG.js";import{b as n}from"./chunk.AJZBJBMO.js";var S=n(p(),1),v=x.part(e=>(0,S.jsx)(e.ActivityRail,{calls:[]}),{quiet:!0});var a=n(k(),1),o=n(p(),1);function Ar({context:e,stop:r,title:t,label:i,style:l,className:s,children:g,...d}){let c=m(e.views?.arrangement?.()),y=g??(0,o.jsxs)(o.Fragment,{children:["In ",c==="Scene"?"the scene":c.replace(/^The /,"the ")," ",(0,o.jsx)("span",{"aria-hidden":"true",children:"\u2197"})]}),f=i?{"aria-label":i}:{};if(e.overview){let h=e.overview;return(0,o.jsx)("a",{href:r,...d,...f,...t?{title:t}:{},style:l,...s?{className:s}:{},onClick:u=>{u.preventDefault(),h(r)},children:y})}return e.embedded?null:(0,o.jsx)("a",{href:`${e.sceneHref??"/"}${r}`,...d,...f,...t?{title:t}:{},style:l,...s?{className:s}:{},children:y})}function Lr(){return(0,o.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:e=>{e.preventDefault();let r=new URL(window.location.href);r.searchParams.set("fresh","1"),window.location.assign(r.toString())},style:{color:"inherit",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24},children:"Start fresh"})}function Pr(e){let r=(0,a.useRef)(0),t=(0,a.useCallback)(i=>e.subscribe(()=>{r.current+=1,i()}),[e]);return(0,a.useSyncExternalStore)(t,()=>r.current,()=>0)}export{v as a,Ar as b,Lr as c,Pr as d};
@@ -0,0 +1 @@
1
+ import{a as T}from"./chunk.GLBHQFJ2.js";import{a as N,b as $}from"./chunk.6XMEU2Q2.js";import{b as f}from"./chunk.QIAKO27D.js";import{a as M}from"./chunk.UT6642FC.js";import{d as O}from"./chunk.2CIBWZJG.js";import{h as k}from"./chunk.3VL5WECB.js";import{g as E}from"./chunk.L4DECHXR.js";import{G,O as C,P as W,R as q,Z as v,fa as j,ta as B,xa as D}from"./chunk.GFF2FB2J.js";import{Ka as R,W as H,Y as z,eb as S}from"./chunk.6V2RG5JG.js";import{b as L}from"./chunk.AJZBJBMO.js";var m=L(G(),1);var e=L(q(),1),U=(a,n)=>({intent:n.intent,author:n.author.kind,...n.author.id?{authorId:n.author.id}:{},by:n.author,...n.ops[0]?.via?{via:n.ops[0].via}:{},...n.lineage?{basis:M(n.lineage)}:{},touched:[...new Set(n.ops.filter(i=>!S(i)).flatMap(i=>i.writes))],...V(a,n.ops.filter(i=>!S(i))),batch:n.id,seq:n.ops.at(-1).seq+1,...n.ops.every(S)?{withheld:!0}:{}});function P(a=4){let{store:n,principal:i}=v(),r=W(n,i),d=r.log.length;return(0,m.useMemo)(()=>N(r.batches(),l=>r.log.get(l)).reverse().slice(0,a).map(l=>{if("batch"in l)return U(r,l.batch);let o=[...l.digest.batches].reverse().map(g=>U(r,g));return{intent:$(l.digest,new Date().toISOString().slice(0,10)),author:l.digest.author.kind,...l.digest.author.id?{authorId:l.digest.author.id}:{},by:l.digest.author,touched:[...new Set(o.flatMap(g=>g.touched))],batch:"",seq:o[0]?.seq??0,digest:o}}),[r,d,a])}function V(a,n){let i={};for(let r of n)for(let d of r.primitives)d.op==="remove-node"&&d.node&&(i[d.node.id]=H(a.schema.tryDefinition(d.node.kind),d.node));return Object.keys(i).length>0?{removed:i}:{}}function Y({change:a}){let{store:n,principal:i,seats:r,people:d}=v();return(0,e.jsxs)("strong",{style:{fontWeight:600},children:[a.author==="human"&&a.by?.onBehalfOf===void 0&&(a.authorId===void 0||i.id===void 0||a.authorId===i.id)?"you":R(a.by??{kind:a.author,id:a.authorId},{graph:n.graph,schema:n.schema,seats:r,people:d}),k(a.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",k(a.via)]}):null]})}function _({change:a,goes:n}){let{store:i}=v(),[r,d]=(0,m.useState)(!1),l=a.digest??[];return(0,e.jsxs)("li",{"data-testid":"activity-digest",style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)(Y,{change:a})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:a.intent})]}),(0,e.jsx)("button",{type:"button","data-testid":"digest-toggle","aria-expanded":r,onClick:()=>d(o=>!o),style:{marginLeft:"auto",flex:"0 0 auto",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem"},children:r?"Hide":"Show each"})]}),r?(0,e.jsx)("ol",{"data-testid":"digest-changes",style:{margin:0,padding:"0 0 0 10px",listStyle:"none",display:"grid",gap:6,borderLeft:"1px solid var(--graview-edge)"},children:l.map(o=>(0,e.jsxs)("li",{"data-testid":"digest-change",style:{display:"grid",gap:3},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:o.intent}),o.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",o.basis]}):null]}),o.withheld?null:(0,e.jsx)(F,{batch:o.batch})]}),o.touched.length>0?(0,e.jsx)("div",{"data-touched":o.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:o.touched.slice(0,4).map(g=>(0,e.jsx)(A,{id:g,label:i.graph.has(g)?f(i,g):o.removed?.[g]??f(i,g),go:n(g)},g))}):null]},o.batch))}):null]})}function F({batch:a}){let{store:n,principal:i,noteSeat:r}=v(),d=W(n,i),l=C()?.open??!1,o=d.log.length,[g,p]=(0,m.useState)(null),u=(0,m.useMemo)(()=>d.canUndo(a),[d,a,o]);if(l||!u.ok&&u.ops.length===0)return null;let h=!u.ok,w=h?u.includeBatches:[];return(0,e.jsxs)("span",{style:{marginLeft:"auto",flex:"0 0 auto",display:"grid",justifyItems:"end",gap:2},children:[(0,e.jsx)("button",{type:"button","data-testid":"undo-turn",title:h?`${u.message} \u2014 undo those too`:"Take this back, keeping everything since",onClick:()=>{p(null);try{let y=d.log.all().find(b=>b.batch===a&&b.author.kind==="agent");d.undo(h?[a,...w]:a,{author:i}),y&&r({type:"home",author:y.author})}catch(y){p(y instanceof Error?y.message:String(y))}},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,padding:"1px 8px",fontSize:"0.75rem",...h?{borderColor:"var(--graview-warn)",color:"var(--graview-warn)"}:{}},children:h?`undo +${w.length}`:"undo"}),g?(0,e.jsx)("span",{"data-testid":"undo-refused",role:"alert",style:{fontSize:"0.75rem",lineHeight:1.4,color:"var(--graview-warn)",maxWidth:260,textAlign:"right"},children:g}):null]})}function J({seq:a,intent:n}){let i=C();if(!i)return null;let r=i.past?.seq===a;return(0,e.jsx)("button",{type:"button","data-testid":"show-past","aria-label":`Show the app as it was after \u201C${n}\u201D`,title:"Show the app as it was here","aria-pressed":r,onPointerEnter:T,onFocus:T,onClick:()=>i.show(a),style:{display:"inline-flex",alignItems:"center",justifyContent:"center",minHeight:24,minWidth:24,padding:"1px 6px",fontSize:"0.75rem",flex:"0 0 auto"},children:(0,e.jsxs)("svg",{width:"13",height:"13",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,e.jsx)("path",{d:"M2.5 8 a5.5 5.5 0 1 0 1.6-3.9",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),(0,e.jsx)("path",{d:"M2 2.5 V5.5 H5",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,e.jsx)("path",{d:"M8 5 V8 L10 9.25",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})})}function K(){let a=()=>{let n=new URL(window.location.href);return n.searchParams.set("fresh","1"),n.toString()};return(0,e.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:n=>{n.preventDefault(),window.location.assign(a())},style:{display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",textDecoration:"underline",textDecorationColor:"var(--graview-edge-bright)",textUnderlineOffset:3},children:"Start fresh"})}function A({id:a,label:n,go:i}){return i?(0,e.jsx)("button",{type:"button","data-testid":"activity-record","data-record":a,title:`Go to ${n}`,onClick:()=>i(a),style:{all:"unset",display:"inline-flex",cursor:"pointer",borderRadius:7},className:"graview-activity-record",children:(0,e.jsx)(O,{label:n})}):(0,e.jsx)(O,{label:n})}function re({calls:a,seat:n,remembers:i=!1}){let r=P(),{store:d,principal:l,seats:o,people:g}=v(),p=W(d,l),u=a.some(t=>t.phase==="running"),h=D("activity"),w=h.open,y=j(),b=C(),x=t=>p.graph.has(t)?c=>{h.setOpen(!1),b?.past&&b.show(null),y.record(c)}:null;return n===void 0&&a.length===0&&r.length===0&&!i?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"activity-button",...h.trigger,onClick:h.toggle,title:u?"An agent is working":"What has happened",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:u?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[u?(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,background:"var(--graview-accent)"}}):null,r.length>0?r.length:"",(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("circle",{cx:"8",cy:"8",r:"5.75",fill:"none",stroke:"currentColor",strokeWidth:"1.4"}),(0,e.jsx)("path",{d:"M8 4.75 V8 L10.25 9.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Activity"})]}),!w&&n!==void 0?(0,e.jsx)("div",{hidden:!0,"data-testid":"agent-seat-seated",children:n}):null,w?(0,e.jsxs)("section",{...h.pane,"aria-label":"Activity","data-testid":"activity","data-graview-offstage":"",style:{...B,width:300,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...E,margin:0},children:"Activity"}),n!==void 0?(0,e.jsxs)("div",{"data-testid":"agent-seat-row",style:{display:"grid",gap:5,paddingBottom:a.length>0||r.length>0?9:0,...a.length>0||r.length>0?{borderBottom:"1px solid var(--graview-edge)"}:{}},children:[(0,e.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"The agent's seat"}),n]}):null,a.length>0?(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:7},children:a.slice(0,6).map((t,c)=>(0,e.jsxs)("li",{style:{display:"grid",gap:2,fontSize:"0.8125rem",lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsx)("span",{"aria-hidden":"true",style:{width:6,height:6,borderRadius:999,flex:"0 0 auto",background:t.phase==="running"?"var(--graview-accent)":t.phase==="failed"?"var(--graview-warn)":"var(--graview-edge-bright)"}}),(0,e.jsxs)("span",{style:{color:"var(--graview-ink)"},children:[t.mutating?"changed":"read"," \xB7"," ",p.allMutations().find(s=>s.name===t.name)?.title??z(t.name)]})]}),!t.mutating&&t.reads&&t.reads.length>0?(0,e.jsxs)("div",{"data-testid":"activity-reads",style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:[[...new Set(t.reads)].slice(0,3).map(s=>(0,e.jsx)(A,{id:s,label:f(p,s),go:x(s)},s)),new Set(t.reads).size>3?(0,e.jsxs)("span",{style:{color:"var(--graview-ink-muted)"},children:["+",new Set(t.reads).size-3]}):null]}):Object.values(t.args).some(s=>typeof s=="string")?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4,paddingLeft:12},children:Object.entries(t.args).filter(s=>typeof s[1]=="string").slice(0,3).map(([s,I])=>(0,e.jsx)(A,{id:I,label:f(p,I),go:x(I)},s))}):null,t.error?(0,e.jsx)("div",{style:{paddingLeft:12,color:"var(--graview-warn)"},children:t.error}):null]},`${t.at}:${c}`))}):null,r.length>0?(0,e.jsx)("ol",{"data-testid":"diff-log",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6,fontSize:"0.8125rem"},children:r.map((t,c)=>t.digest?(0,e.jsx)(_,{change:t,goes:x},`digest:${t.digest[0]?.batch??c}`):t.withheld?(0,e.jsx)("li",{"data-testid":"withheld-change",style:{display:"grid",gap:3,lineHeight:1.45},children:(0,e.jsx)("span",{"data-touched":"",style:{color:"var(--graview-ink-muted)",fontStyle:"italic"},children:t.intent})},`change:${c}`):(0,e.jsxs)("li",{style:{display:"grid",gap:3,lineHeight:1.45},children:[(0,e.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:6},children:[(0,e.jsxs)("span",{style:{minWidth:0},children:[(0,e.jsxs)("strong",{style:{fontWeight:600},children:[t.author==="human"&&t.by?.onBehalfOf===void 0&&(t.authorId===void 0||l.id===void 0||t.authorId===l.id)?"you":R(t.by??{kind:t.author,id:t.authorId},{graph:p.graph,schema:p.schema,seats:o,people:g}),k(t.via)?(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-muted)"},children:[", ",k(t.via)]}):null]})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:t.intent}),t.basis?(0,e.jsxs)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",t.basis]}):null]}),t.batch?(0,e.jsx)(J,{seq:t.seq,intent:t.intent}):null,t.batch?(0,e.jsx)(F,{batch:t.batch}):null]}),(0,e.jsx)("div",{"data-touched":t.touched.join(" "),style:{display:"flex",flexWrap:"wrap",gap:4},children:t.touched.slice(0,4).map(s=>(0,e.jsx)(A,{id:s,label:p.graph.has(s)?f(p,s):t.removed?.[s]??f(p,s),go:x(s)},s))})]},`change:${c}`))}):null,i?(0,e.jsxs)("div",{"data-testid":"remembered",style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:10,paddingTop:8,borderTop:"1px solid var(--graview-edge)",fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:[(0,e.jsx)("span",{children:"Remembered in this browser"}),(0,e.jsx)(K,{})]}):null]}):null]})}export{re as a};
@@ -0,0 +1 @@
1
+ import{e as H}from"./chunk.OQDETV4X.js";import{e as O}from"./chunk.3VL5WECB.js";import{$ as j,G as b,R as E,Z as g,_ as V,d as _,na as $,y as B}from"./chunk.GFF2FB2J.js";import{$b as W,B as T,_b as N,fc as K,vb as F,zb as D}from"./chunk.6V2RG5JG.js";import{b as m}from"./chunk.AJZBJBMO.js";function L(n,e){let t=n.graph.getNode(e);if(!t)return[];let o=t.kind,a=n.schema.tryDefinition(o);if(!a)return[];let s=n.seenFor,c=s?K.keptFrom?.(n,s)?.(t):void 0,i=new Map;for(let r of n.allMutations()){let d=r.subject;if(!d||!(d.kinds==="*"||d.kinds.includes(o)))continue;let l=r.input.shape??{};for(let u of D(r,a)){if(c?.(u))continue;let w=u in l,M=[];for(let y of Object.keys(l)){if(y===d.arg||y===u||Y(l[y]))continue;let v=F(r.input).find(S=>S.name===y);M.push({name:y,...v?{kinds:v.kinds}:{},...v?{candidates:v.kinds.includes("*")?n.graph.allNodes().map(S=>S.id):v.kinds.flatMap(S=>n.graph.nodesOfKind(S).map(X=>X.id))}:{},shape:O(r.input,y)})}let J={field:u,mutation:r.name,title:r.title??r.name,shape:w?O(r.input,u):{type:"unknown"},takesValue:w,alternatives:[],open:M,call:y=>({name:r.name,args:w?{[d.arg]:e,[u]:y}:{[d.arg]:e}})};i.set(u,[...i.get(u)??[],J])}}return[...i.values()].map(r=>{let d=[...r.filter(u=>u.takesValue),...r.filter(u=>!u.takesValue)],[f,...l]=d;return{...f,alternatives:l}})}function Y(n){let e=T(n)?.type;return e==="optional"||e==="default"||e==="nullable"}var R=m(b(),1);function he(n){let{store:e,principal:t}=g(),o=j(),a=(0,R.useMemo)(()=>n===null?[]:L(e,n),[e,n,o]),s=(0,R.useCallback)((c,i,r={})=>{let d=c.call(i);e.apply({name:d.name,args:{...d.args,...r}},{author:t})},[e,t]);return{fields:a,commit:s}}var z=m(b(),1);function Se(){let{brand:n}=g(),e=n?.kit;return(0,z.useMemo)(()=>N(e),[e])}function ke(n,e){let t=W(n,e),o={...t.color!==void 0?{color:t.color}:{},...t.pattern!==void 0?{pattern:t.pattern}:{},...t.width!==void 0?{width:t.width}:{},...t.cap!==void 0?{cap:t.cap}:{},...t.opacity!==void 0?{opacity:t.opacity}:{}};return{connector:t,style:H(e,{[e]:o})}}var I=m(b(),1);var h=m(E(),1);function Z(n){let e=n?.hint;return typeof e=="string"&&e.length>0?e:void 0}function ee(n){if(n instanceof Error&&n.message)return n.message;let e=String(n);return e==="[object Object]"?"The view threw without a message.":e}var G=class extends I.Component{static contextType=$;state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,e,t.componentStack),this.context?.(e,{module:"@graview/react"})}render(){let{error:e}=this.state;if(!e)return this.props.children;let t=Z(e);return(0,h.jsxs)("div",{role:"alert","data-graview-view-error":this.props.kind,style:{display:"flex",flexDirection:"column",gap:"0.375rem",padding:"var(--graview-pad, 12px)",height:"100%",overflow:"auto",boxSizing:"border-box",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)",font:"var(--graview-font-body, 13px/1.45 system-ui)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,h.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),(0,h.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.kind}),(0,h.jsx)("span",{children:ee(e)}),t?(0,h.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:t}):null]})}};var x=m(b(),1);var U=m(E(),1),A=(0,x.createContext)([]);function Oe({sections:n,children:e}){let t=(0,x.useContext)(A),o=(0,x.useMemo)(()=>[...t,...n.filter(a=>!t.includes(a))],[t,n]);return(0,U.jsx)(A.Provider,{value:o,children:e})}function Ae(n){let e=(0,x.useContext)(A),t=V()?.menuSections,o=t?[...e,...t.filter(s=>!e.includes(s))]:e;if(n===null||o.length===0)return{start:[],end:[]};let a=o.flatMap(s=>{try{let c=s(n);return c&&((c.items?.length??0)>0||c.render)?[c]:[]}catch{return[]}});return{start:a.filter(s=>s.at==="start"),end:a.filter(s=>s.at!=="start")}}var q=m(b(),1);function Fe(){return g().activity}function De(n){let{noteAttention:e,noteSeat:t}=g();(0,q.useEffect)(()=>n.onCall(o=>{let a=n.author??{kind:"agent"},s=o.args?.said;o.phase==="ok"&&typeof s=="string"&&s.length>0&&t({type:"said",author:a,say:s}),!(o.phase!=="ok"||!o.reads||o.reads.length===0)&&e({reads:o.reads,author:a,intent:`read ${o.name}`})}),[n,e,t])}var C=(n,e)=>n.length*e*.58;var ne=156,te=2,k=ne-18,re=7.1,oe=16;function ie(n,e){let t=0,o=k;for(let a of n.split(" ")){let s=e(a),c=o+e(" ")+s;if(c<=k)o=c;else{let i=Math.ceil(s/k)||1;t+=i,o=s-(i-1)*k}}return t}var ae=16.25,Q=27,se=(n,e)=>{let t=Math.ceil(n.length*re/k);return e?Math.max(Q,Math.ceil(Math.max(t,ie(n,e))*ae)+6):Math.max(Q,t*oe+6)};function Ke(n,e,t){return n.length===0?0:10+n.reduce((o,a)=>o+se(a,t),0)+(n.length-1)*te}var de=27,ce=8,_e=4,ue=64,Be=n=>Math.max(1,Math.min(ce,n)),Ve=n=>n*de+ue;var p=m(b(),1);function Le(n,{units:e,target:t=0,legibleAt:o=260}){let[a,s]=(0,p.useState)(e);(0,p.useEffect)(()=>{let i=n.current;if(i===null||typeof ResizeObserver>"u")return;let r=new ResizeObserver(([d])=>{let f=d?.contentRect.width??0;f>0&&s(f)});return r.observe(i),()=>r.disconnect()},[n]);let c=a/e;return{scale:c,width:a,touchable:c*t>=24,legible:a>=o}}function ze(n="--graview-font-body",e="sans-serif"){let t=(0,p.useRef)(void 0),o=(0,p.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return e;let a=getComputedStyle(document.documentElement).getPropertyValue(n).trim();return a.length>0?a:e},[n,e]);return(0,p.useMemo)(()=>{t.current===void 0&&(t.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let a=t.current;return a===null?C:(s,c)=>{a.font=`${c}px ${o}`;let i=a.measureText(s).width;return i>0?i:C(s,c)}},[o])}var Ge=(0,p.createContext)(void 0);var P=3;function le(n){let e=_(n),t=e.focusId;if(!t)return null;if(e.within?.view){let[a]=B(t);if(a)return{at:`screen:${a}`,audience:!0}}return{at:t,audience:!1}}function qe(n,e,t){let o=[],a=new Map,s=new Map,c=0;for(let i of n){let r=le(i.stop),d=r?e(r.at):null;if(!r||!d){i.name&&o.push({kind:"edge",presence:i,point:{x:t-8,y:40+c++*28}});continue}if(!i.name){let M=s.get(r.at);s.set(r.at,{n:(M?.n??0)+1,box:d});continue}let f=a.get(r.at)??[];if(f.push(i),a.set(r.at,f),f.length>P)continue;let l=d,u=f.length-1,w=r.audience?{x:l.x+l.width*.5+(u-1)*26,y:l.y+Math.min(l.height,24)}:{x:l.x+l.width*.5-26-u*22,y:l.y+l.height-4};o.push({kind:"person",presence:i,point:w,at:r.at,index:u,of:f.length,audience:r.audience})}for(let[i,r]of a){if(r.length<=P)continue;let d=e(i);d&&o.push({kind:"count",at:i,point:{x:d.x+d.width*.5+2*26+18,y:d.y+d.height-4},n:r.length-P})}for(let[i,{n:r,box:d}]of s)o.push({kind:"count",at:i,point:{x:d.x+d.width*.5+40,y:d.y+d.height-4},n:r});for(let i of n)if(i.name){if(i.robot?.at&&i.robot.mode!=="docked"){let r=e(i.robot.at);r&&o.push({kind:"robot",presence:i,point:{x:r.x+r.width/2+22,y:r.y+r.height-4},mode:i.robot.mode})}if(i.over){let r=e(i.over);r&&o.push({kind:"over",presence:i,box:r})}}return o}export{Fe as a,De as b,C as c,ne as d,te as e,Q as f,Ke as g,de as h,_e as i,ue as j,Be as k,Ve as l,Le as m,ze as n,he as o,Se as p,ke as q,qe as r,G as s,Oe as t,Ae as u};