graview 0.1.58 → 0.1.60

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/README.md +4 -2
  2. package/dist/preview/chunk.2K4TT2BV.js +1 -0
  3. package/dist/preview/{chunk.OHQ3JH65.js → chunk.2USDHXB4.js} +1 -1
  4. package/dist/preview/{chunk.F7SF6EP2.js → chunk.37TVS7CA.js} +1 -1
  5. package/dist/preview/chunk.3IZ3ABII.js +1 -0
  6. package/dist/preview/{chunk.NKC3JILT.js → chunk.3MOJF7BA.js} +1 -1
  7. package/dist/preview/{chunk.IDJPBWL2.js → chunk.3UOKUF5Z.js} +1 -1
  8. package/dist/preview/{chunk.2VYNNWW5.js → chunk.3V4WP7RY.js} +3 -3
  9. package/dist/preview/{chunk.WNSC3RWD.js → chunk.3XGA65Y3.js} +1 -1
  10. package/dist/preview/{chunk.D5KTGX7F.js → chunk.3ZT5WQYL.js} +1 -1
  11. package/dist/preview/{chunk.IULQRCEE.js → chunk.4LR64TPU.js} +1 -1
  12. package/dist/preview/chunk.4MP72LPR.js +25 -0
  13. package/dist/preview/{chunk.GQBJVCSM.js → chunk.4TCKEG6I.js} +1 -1
  14. package/dist/preview/chunk.5DD62IOW.js +21 -0
  15. package/dist/preview/{chunk.KJ264E6K.js → chunk.5YOLUDVO.js} +1 -1
  16. package/dist/preview/{chunk.EB4NVTJL.js → chunk.67U6M7OV.js} +1 -1
  17. package/dist/preview/{chunk.XU34T2H4.js → chunk.6C2MHWSX.js} +1 -1
  18. package/dist/preview/{chunk.ILRCNTGT.js → chunk.6HF6POIX.js} +1 -1
  19. package/dist/preview/{chunk.U6O3MMQR.js → chunk.6WHAWOO7.js} +1 -1
  20. package/dist/preview/{chunk.GKSUTAIX.js → chunk.6ZQAR5ZA.js} +1 -1
  21. package/dist/preview/{chunk.EPPXZZPK.js → chunk.7MHCGVGM.js} +1 -1
  22. package/dist/preview/{chunk.MQ5HBUBL.js → chunk.7N32AVIJ.js} +1 -1
  23. package/dist/preview/{chunk.7V23SXGJ.js → chunk.7OPM55I2.js} +1 -1
  24. package/dist/preview/chunk.7TFLRR7D.js +1 -0
  25. package/dist/preview/{chunk.LDAYDCUO.js → chunk.7VKSXGTX.js} +1 -1
  26. package/dist/preview/{chunk.KJHPDL4N.js → chunk.A3ZXDG6V.js} +1 -1
  27. package/dist/preview/{chunk.27CW6SCT.js → chunk.A5PDXNY6.js} +1 -1
  28. package/dist/preview/chunk.AVBTPSQF.js +1 -0
  29. package/dist/preview/{chunk.YZZONE4M.js → chunk.BF6S5UE4.js} +1 -1
  30. package/dist/preview/chunk.BLPYNNR4.js +1 -0
  31. package/dist/preview/{chunk.LRUNFSHP.js → chunk.BQIHNT7C.js} +1 -1
  32. package/dist/preview/{chunk.O4CVKTPJ.js → chunk.BRT27WON.js} +1 -1
  33. package/dist/preview/{chunk.HMFJT4KO.js → chunk.BXDM3UMN.js} +1 -1
  34. package/dist/preview/chunk.BYKD5RLA.js +1 -0
  35. package/dist/preview/chunk.C7OLSEWK.js +1 -0
  36. package/dist/preview/{chunk.3OYGXYQY.js → chunk.CC5BJH5A.js} +1 -1
  37. package/dist/preview/{chunk.GCBZ3WE2.js → chunk.CFKZXLXS.js} +1 -1
  38. package/dist/preview/chunk.CMN6BBAD.js +1 -0
  39. package/dist/preview/{chunk.YP2F5UGY.js → chunk.CQT3W2SF.js} +1 -1
  40. package/dist/preview/chunk.D7YSL3NK.js +2 -0
  41. package/dist/preview/chunk.DCHQHKSA.js +1 -0
  42. package/dist/preview/{chunk.H3BFHI3G.js → chunk.EL5ICOOM.js} +1 -1
  43. package/dist/preview/{chunk.PZG3B7F4.js → chunk.ENL2JJ47.js} +1 -1
  44. package/dist/preview/chunk.EQXB7LKI.js +1 -0
  45. package/dist/preview/{chunk.ELAMMS2V.js → chunk.ERFT54HT.js} +1 -1
  46. package/dist/preview/{chunk.XN2RVXOI.js → chunk.F6V7RWDK.js} +1 -1
  47. package/dist/preview/{chunk.64R3K2OE.js → chunk.FBJARKDT.js} +1 -1
  48. package/dist/preview/{chunk.SDLUWRGI.js → chunk.FC6AF6CC.js} +1 -1
  49. package/dist/preview/{chunk.GZB6A6KF.js → chunk.FFTYMBBT.js} +1 -1
  50. package/dist/preview/chunk.FLUK3UXF.js +1 -0
  51. package/dist/preview/{chunk.KFQSYCY3.js → chunk.FRYBMS3W.js} +1 -1
  52. package/dist/preview/chunk.G3R4BTI7.js +1 -0
  53. package/dist/preview/chunk.G4YJPKRG.js +5 -0
  54. package/dist/preview/{chunk.BB33TI4S.js → chunk.GLWSVSQL.js} +1 -1
  55. package/dist/preview/{chunk.SDVPJYVF.js → chunk.GNBIVVL3.js} +1 -1
  56. package/dist/preview/{chunk.ZN5HTWSI.js → chunk.GTKJJYQH.js} +1 -1
  57. package/dist/preview/{chunk.TUUVVO5U.js → chunk.H45Q3O4F.js} +1 -1
  58. package/dist/preview/{chunk.M34CS7DI.js → chunk.HDP3PS7N.js} +1 -1
  59. package/dist/preview/{chunk.CCWPF5PK.js → chunk.HDUO2USQ.js} +1 -1
  60. package/dist/preview/{chunk.PBCNOFQH.js → chunk.HUJ6YTWE.js} +1 -1
  61. package/dist/preview/{chunk.JB7TTJXQ.js → chunk.I4XQBQRC.js} +1 -1
  62. package/dist/preview/chunk.IBOKXVWN.js +1 -0
  63. package/dist/preview/{chunk.4HSH2UIK.js → chunk.IGJZ4UH3.js} +2 -2
  64. package/dist/preview/{chunk.WNQFHMNR.js → chunk.IGVASEZU.js} +1 -1
  65. package/dist/preview/{chunk.7SQAKSJD.js → chunk.IHBUBZQT.js} +1 -1
  66. package/dist/preview/chunk.IOK4GVJC.js +1 -0
  67. package/dist/preview/{chunk.I3WWCPQ2.js → chunk.JEYQBH33.js} +1 -1
  68. package/dist/preview/{chunk.S2H7B6RG.js → chunk.JJGCTGWA.js} +1 -1
  69. package/dist/preview/{chunk.E5MSFXL6.js → chunk.JPONLMU7.js} +1 -1
  70. package/dist/preview/{chunk.QPXXY2DL.js → chunk.KBVTLNS5.js} +3 -3
  71. package/dist/preview/{chunk.HS3GHAUR.js → chunk.KDRLUBVF.js} +1 -1
  72. package/dist/preview/{chunk.YIA2EDVF.js → chunk.KGW75Z5L.js} +1 -1
  73. package/dist/preview/{chunk.KWJWAIQJ.js → chunk.KI37ZEV3.js} +1 -1
  74. package/dist/preview/chunk.L6AWE76F.js +1 -0
  75. package/dist/preview/{chunk.LY3YOWKV.js → chunk.LGEA5257.js} +1 -1
  76. package/dist/preview/{chunk.TF5I4VHX.js → chunk.LLYRFVIN.js} +1 -1
  77. package/dist/preview/{chunk.WQOI6BLM.js → chunk.LQVAABPS.js} +1 -1
  78. package/dist/preview/{chunk.POBMGM3X.js → chunk.LSY256J4.js} +1 -1
  79. package/dist/preview/{chunk.HEWVPXRE.js → chunk.LZIBQ3VX.js} +1 -1
  80. package/dist/preview/{chunk.7MSFDD7J.js → chunk.M4UD4ARP.js} +1 -1
  81. package/dist/preview/chunk.MDJWK5W2.js +1 -0
  82. package/dist/preview/{chunk.4AFFPYOK.js → chunk.MJVYWLQQ.js} +1 -1
  83. package/dist/preview/{chunk.3YZHZGTM.js → chunk.MSWWWLEA.js} +1 -1
  84. package/dist/preview/{chunk.BTVBZ6KE.js → chunk.MVWC3VR3.js} +2 -2
  85. package/dist/preview/{chunk.B2GVJD6H.js → chunk.NC7FXY2H.js} +1 -1
  86. package/dist/preview/{chunk.LCPGZK7G.js → chunk.NGTRL5U4.js} +1 -1
  87. package/dist/preview/{chunk.NOFWGDOT.js → chunk.NHUQ2N6J.js} +1 -1
  88. package/dist/preview/{chunk.LL2MLSPH.js → chunk.OLFJH4RK.js} +1 -1
  89. package/dist/preview/{chunk.WXIEQZLY.js → chunk.P6RORYOT.js} +1 -1
  90. package/dist/preview/{chunk.SPXRLO5K.js → chunk.PFSYXD6Q.js} +1 -1
  91. package/dist/preview/chunk.PHJ6WPWH.js +1 -0
  92. package/dist/preview/{chunk.QGV7H7RQ.js → chunk.PI44XMY2.js} +1 -1
  93. package/dist/preview/{chunk.ZOHMWSHD.js → chunk.PNW5K7BW.js} +1 -1
  94. package/dist/preview/chunk.Q355UPFG.js +1 -0
  95. package/dist/preview/{chunk.GEB2DFBU.js → chunk.QBLKTFF4.js} +1 -1
  96. package/dist/preview/{chunk.HXRV3WVJ.js → chunk.QDSEVPF3.js} +1 -1
  97. package/dist/preview/chunk.QFUMFQJU.js +1 -0
  98. package/dist/preview/{chunk.B3WZHPM3.js → chunk.QHDCTAD7.js} +1 -1
  99. package/dist/preview/{chunk.UAP5M3CD.js → chunk.QI4SLPQ4.js} +2 -2
  100. package/dist/preview/{chunk.HZB5F476.js → chunk.RQOX5YDW.js} +1 -1
  101. package/dist/preview/{chunk.TBW7CU4G.js → chunk.RXYNW5QB.js} +1 -1
  102. package/dist/preview/{chunk.RE7DELSR.js → chunk.SB2PZKN5.js} +1 -1
  103. package/dist/preview/{chunk.INZQ6WZM.js → chunk.SRVQJZRT.js} +1 -1
  104. package/dist/preview/{chunk.TJ647W6J.js → chunk.T7LQD67N.js} +2 -2
  105. package/dist/preview/chunk.TAT2IQUR.js +1 -0
  106. package/dist/preview/chunk.TFWIG6LL.js +6 -0
  107. package/dist/preview/{chunk.GP7F3PEF.js → chunk.TKVLNBRD.js} +1 -1
  108. package/dist/preview/{chunk.YHTE34RN.js → chunk.TLJOZSDD.js} +1 -1
  109. package/dist/preview/{chunk.6W7O5YLL.js → chunk.TLWT67ON.js} +1 -1
  110. package/dist/preview/{chunk.KKNDX4JT.js → chunk.TY4GQJKC.js} +1 -1
  111. package/dist/preview/{chunk.EQTSV7BK.js → chunk.UITT6JWW.js} +1 -1
  112. package/dist/preview/{chunk.LO3U3P55.js → chunk.UJTE7UAP.js} +1 -1
  113. package/dist/preview/{chunk.DBZHRYBK.js → chunk.ULL6ZIJJ.js} +1 -1
  114. package/dist/preview/{chunk.VUPLFUUS.js → chunk.UQWTZJBV.js} +1 -1
  115. package/dist/preview/{chunk.NFX24NUI.js → chunk.URWAFZHF.js} +1 -1
  116. package/dist/preview/{chunk.A6C4AGJJ.js → chunk.VADQ7ZGA.js} +1 -1
  117. package/dist/preview/chunk.VDMDPZ6U.js +1 -0
  118. package/dist/preview/{chunk.2EDC63RI.js → chunk.VFOON3Z3.js} +1 -1
  119. package/dist/preview/{chunk.4444RPWW.js → chunk.VMV464JK.js} +1 -1
  120. package/dist/preview/{chunk.4KC35UNR.js → chunk.VNDKKTED.js} +4 -2
  121. package/dist/preview/chunk.VSCIXAHN.js +5 -0
  122. package/dist/preview/{chunk.34TW32TB.js → chunk.VUBNBTJP.js} +2 -2
  123. package/dist/preview/{chunk.JUNMJYH5.js → chunk.VWJGQDCE.js} +1 -1
  124. package/dist/preview/{chunk.KXPRILAO.js → chunk.VZJWJ5XM.js} +1 -1
  125. package/dist/preview/{chunk.5ICIMQE6.js → chunk.W3W54DSX.js} +1 -1
  126. package/dist/preview/{chunk.YD3TKV6P.js → chunk.WC3DENU4.js} +2 -2
  127. package/dist/preview/chunk.WQ6RCEUQ.js +1 -0
  128. package/dist/preview/{chunk.YS6GVLIP.js → chunk.WXUFATY5.js} +1 -1
  129. package/dist/preview/chunk.X6A4VSSD.js +1 -0
  130. package/dist/preview/{chunk.VHSWBFXB.js → chunk.XGASJAV2.js} +1 -1
  131. package/dist/preview/{chunk.RRKYJYZJ.js → chunk.XR6YR6RV.js} +1 -1
  132. package/dist/preview/chunk.XZPKBHJT.js +1 -0
  133. package/dist/preview/{chunk.GDOTG7YA.js → chunk.Y5C4RXG7.js} +1 -1
  134. package/dist/preview/{chunk.JES77WXG.js → chunk.Y7G3OGDE.js} +1 -1
  135. package/dist/preview/{chunk.E34OQVSR.js → chunk.YEBGI6ED.js} +1 -1
  136. package/dist/preview/{chunk.TWKXSLYY.js → chunk.YFSBVZTG.js} +1 -1
  137. package/dist/preview/chunk.YFVJUHAK.js +1 -0
  138. package/dist/preview/chunk.YH63KQ2G.js +1 -0
  139. package/dist/preview/{chunk.LMN4TSAP.js → chunk.YZ7FUKAL.js} +1 -1
  140. package/dist/preview/{chunk.JGKA5QBX.js → chunk.Z2ERZ4S6.js} +1 -1
  141. package/dist/preview/{chunk.VG7OWV2H.js → chunk.ZP5RT2EK.js} +1 -1
  142. package/dist/preview/{chunk.ETBFD76E.js → chunk.ZXOT3IXJ.js} +1 -1
  143. package/dist/preview/{chunk.TJOXNEFU.js → chunk.ZYM2SSGW.js} +1 -1
  144. package/dist/preview/index.html +51 -51
  145. package/dist/preview/page.js +2 -2
  146. package/package.json +6 -6
  147. package/dist/preview/chunk.32FMOHZK.js +0 -1
  148. package/dist/preview/chunk.3FCOFEGW.js +0 -1
  149. package/dist/preview/chunk.43OKZU73.js +0 -1
  150. package/dist/preview/chunk.47JQPYXL.js +0 -2
  151. package/dist/preview/chunk.4GGPPCMM.js +0 -1
  152. package/dist/preview/chunk.4Y2JTY6Q.js +0 -1
  153. package/dist/preview/chunk.6K7EN2YI.js +0 -1
  154. package/dist/preview/chunk.6VC6AGYV.js +0 -5
  155. package/dist/preview/chunk.7BBGRTXM.js +0 -5
  156. package/dist/preview/chunk.7ECBGIUK.js +0 -1
  157. package/dist/preview/chunk.ACYDJQRC.js +0 -1
  158. package/dist/preview/chunk.ARWBIBSI.js +0 -6
  159. package/dist/preview/chunk.BKVBX2YB.js +0 -1
  160. package/dist/preview/chunk.DM767F2Q.js +0 -21
  161. package/dist/preview/chunk.ELERUERU.js +0 -1
  162. package/dist/preview/chunk.GUEHKCWN.js +0 -1
  163. package/dist/preview/chunk.HT2BEOEV.js +0 -25
  164. package/dist/preview/chunk.JOAN54PN.js +0 -1
  165. package/dist/preview/chunk.L7V24JPO.js +0 -1
  166. package/dist/preview/chunk.LA4CPZ2N.js +0 -1
  167. package/dist/preview/chunk.MV3AJ7JH.js +0 -1
  168. package/dist/preview/chunk.MYNQWWCL.js +0 -1
  169. package/dist/preview/chunk.OASYYMG5.js +0 -1
  170. package/dist/preview/chunk.PM3SYXKB.js +0 -1
  171. package/dist/preview/chunk.QB25SMP6.js +0 -1
  172. package/dist/preview/chunk.R7LFO7KI.js +0 -1
  173. package/dist/preview/chunk.S5MGE2U5.js +0 -1
  174. package/dist/preview/chunk.TXGNPW76.js +0 -1
  175. package/dist/preview/chunk.UGFDSE37.js +0 -1
  176. package/dist/preview/chunk.UKMVJV6Q.js +0 -1
  177. package/dist/preview/chunk.UUG3BYVN.js +0 -1
  178. package/dist/preview/chunk.WJFQIE3Y.js +0 -1
@@ -1 +1 @@
1
- import{a as D}from"./chunk.PXQVXBNG.js";import{a as L,f as P,g as N,h as R,i as T}from"./chunk.B3WVCSW5.js";import{zd as E}from"./chunk.7BBGRTXM.js";var z=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),W=e=>e?._zod?.def;function I(e){let n=W(e);for(;n&&(n.type==="optional"||n.type==="default"||n.type==="nullable"||n.type==="prefault");)n=W(n.innerType);return n}function K(e){if(e?.type==="boolean")return["true","false"];if(e?.type==="enum")return(e.entries?Object.values(e.entries):e.values??[]).filter(n=>typeof n=="string")}var m=e=>e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]/g," ").replace(/^./,n=>n.toUpperCase());function J(e,n,i){let a=e.tryDefinition(n);if(!a)return[];let c=new Set(a.display?.hide??[]),o=[];for(let[s,l]of Object.entries(a.fields.shape??{})){if(s==="id"||s==="kind"||s==="label"||c.has(s))continue;let r=I(l);if(r?.type==="array"||r?.type==="object"||r?.type==="record")continue;let u=K(r);o.push({key:s,label:m(s),...u?{options:u}:{}})}let g=new Map;for(let[s,l]of Object.entries(a.edges??{}))g.set(s,l.to==="*"?[]:[...l.to]);for(let s of e.definitions)if(s.kind!==n)for(let[l,r]of Object.entries(s.edges??{}))!g.has(l)&&(r.to==="*"||r.to.includes(n))&&g.set(l,[s.kind]);let y=[];for(let[s,l]of g){o.push({key:s,label:m(s)});let r=i&&l.length===1&&l[0]!==n?e.tryDefinition(l[0]):void 0;for(let[u,f]of Object.entries(r?.fields.shape??{})){let p=I(f);p?.type==="enum"&&!r?.display?.hide?.includes(u)&&y.push({key:`${s}.${u}`,label:`${m(s)} \xB7 ${m(u)}`,options:K(p)})}}return o.push(...y),o.push({key:"is",label:"Is",options:a.lifecycle?["current","past","any","flagged","clear"]:["flagged","clear"]}),o}var G=e=>e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function q(e,n,i,a={}){if(i==null)return{ok:!0};if(!z(i))return{ok:!1,says:'A filter is an object of a field and the value it keeps, like { where: { stage: "building" } }.'};let c=Object.entries(i);if(c.length===0)return{ok:!0};let o=[];for(let l of n)for(let r of J(e,l,a.through===!0))o.some(u=>u.key===r.key)||o.push(r);let g=n[0]?e.tryDefinition(n[0]):void 0,y=g?g.plural??`${m(g.kind)}s`:"These",s=[];for(let[l,r]of c){let u=o.find(p=>p.key===l);if(!u)return{ok:!1,says:`${y.replace(/^./,p=>p.toUpperCase())} have no field "${l}" to filter by${o.length>0?`; they filter by ${G(o.map(p=>p.key))}`:""}.`};if(typeof r!="string"&&typeof r!="number"&&typeof r!="boolean")return{ok:!1,says:`The filter on "${l}" is ${Array.isArray(r)?"a list":r===null?"null":`a ${typeof r}`}; it keeps one value: a word, a number, or true or false.`};let f=String(r);if(f.trim().length===0)return{ok:!1,says:`The filter on "${l}" keeps nothing; give it a value, or leave "${l}" out.`};if(f.includes(","))return{ok:!1,says:`The filter on "${l}" holds a comma, which an address reads as a second filter; keep one value.`};if(u.options&&u.options.length>0&&!u.options.includes(f))return{ok:!1,says:`${u.label} has no choice "${f}"; its choices are ${G(u.options.map(p=>`"${p}"`))}.`};s.push(`${l}:${f}`)}return{ok:!0,filter:s.join(",")}}var C=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");function F(e,n){let i=e.find(o=>o.as===n);if(i)return i;let a=n.trim().toLowerCase(),c=C(n);return e.find(o=>o.title!==void 0&&o.title.trim().toLowerCase()===a)??(c?e.find(o=>o.as===c||o.title!==void 0&&C(o.title)===c):void 0)}function Q(e){let n=[];for(let i of e){if(typeof i!="object"||i===null)continue;let{as:a,slug:c,title:o,kind:g}=i,y=typeof a=="string"&&a.length>0?a:typeof c=="string"&&c.length>0?c:void 0;!y||n.some(s=>s.as===y)||n.push({as:y,title:typeof o=="string"?o:y,kind:typeof g=="string"?g:""})}return n}var M=e=>` Its places: ${e.map(n=>typeof n=="string"?`"${n}"`:n.title&&n.title!==n.as?`"${n.as}" (${n.title})`:`"${n.as}"`).join(", ")||"none"}.`;var b=e=>`"${e.length>80?`${e.slice(0,79)}\u2026`:e}"`,O=(e,n)=>`${"place"in e?`The place ${b(e.place)}`:`${b(e.record)} is no record this viewer may see and`} is no place of this app: it goes nowhere.${M(n)}`;function S(e){let n={};for(let i of e.split(",")){let a=i.indexOf(":");a>0&&(n[i.slice(0,a).trim()]=i.slice(a+1).trim())}return n}function oe(e,n=new Set){return e.kinds.filter(i=>!n.has(i)).map(i=>({slug:E(e,i).slice(1),kind:i}))}function V(e,n){let i=[...new Set(n.places.map(f=>f.as))],a=n.lists.map(f=>f.slug).filter(f=>!i.includes(f)),c;if(e.section!==void 0&&e.section!==null){if(typeof e.section!="string"||D(e.section).length===0||e.section.length>120)return{ok:!1,says:`The section ${typeof e.section=="string"?b(e.section):"asked for"} names nothing on a page: a section is a heading's words or an element's id, like "shipping-soon". It goes nowhere.`};c=e.section}let o=c!==void 0?{section:c}:{};if("record"in e&&n.sees(e.record))return e.where!==void 0&&e.where!==null?{ok:!1,says:`${b(e.record)} is one record, and a filter narrows a list or a place: it goes nowhere. Go to { place, where } for a list narrowed.`}:{ok:!0,arrival:{record:e.record,...o}};let g="place"in e?e.place:e.record,y=F(n.places,g),s=y?void 0:n.lists.find(f=>f.slug===g||f.kind===g);if(!y&&!s)return{ok:!1,says:`${O(e,n.places.filter((f,p,$)=>$.findIndex(t=>t.as===f.as)===p))}${_(a)}`};let l=y?[y.kind]:[s.kind],r;if(e.where!==void 0&&e.where!==null){if(!n.schema)return{ok:!1,says:`The place ${b(g)} cannot be narrowed here: it goes nowhere.`};let f=q(n.schema,l,e.where,{through:s!==void 0});if(!f.ok)return{ok:!1,says:`The filter on ${b(g)} goes nowhere: ${f.says}`};r=f.filter}let u=r?{filter:r}:{};return{ok:!0,arrival:y?{place:y.as,...u,...o}:{list:s.kind,...u,...o}}}var _=e=>e.length===0?"":` Its lists: ${e.slice(0,8).map(n=>`"${n}"`).join(", ")}${e.length>8?` and ${e.length-8} more`:""}.`,U="http://www.w3.org/1999/xhtml",H="http://www.w3.org/2000/svg",Z=e=>{let n=e;return n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||e.type==="click"&&typeof n.button=="number"&&n.button!==0};function se(e){let n=new WeakSet,i=new WeakSet,a=new WeakMap,c=new WeakMap,o=t=>V(t,{sees:e.sees,places:e.places(),lists:e.lists?.()??[],...e.schema?{schema:e.schema}:{}}),g=t=>{let d=o(t);return d.ok?e.onNavigate?.(d.arrival):e.onLost?.(d.says),d.ok},y=t=>{let d=t.getAttribute("data-record"),h=t.getAttribute("data-place"),k=t.getAttribute("data-filter"),w=t.getAttribute("data-section"),v={...k?{where:S(k)}:{},...w?{section:w}:{}};if(d)return{record:d,...v};if(h)return{place:h,...v}},s=t=>{if(!e.hrefOf)return;let d=y(t),h=d?o(d):void 0;return h?.ok?e.hrefOf(h.arrival):void 0},l=t=>t.hasAttribute("tabindex")?!1:(t.setAttribute("tabindex","0"),n.add(t),!0),r=t=>{n.delete(t)&&t.removeAttribute("tabindex")},u=t=>{i.delete(t)&&t.getAttribute("role")==="link"&&t.removeAttribute("role")},f=t=>{let d=a.get(t);d&&(a.delete(t),t.getAttribute("href")===d.href&&t.removeAttribute("href"),d.target!==null&&!t.hasAttribute("target")&&t.setAttribute("target",d.target))},p=t=>{let d=c.get(t);d&&(c.delete(t),r(d))},$={link(t){if(!N(t,[...t.querySelectorAll("input, select, textarea")].some(L))){if(!t.hasAttribute("data-graview-link"))return;t.removeAttribute("data-graview-link"),u(t),r(t),f(t),p(t);return}t.hasAttribute("data-graview-link")||t.setAttribute("data-graview-link","");let h=t.localName==="a"&&(t.namespaceURI===U||t.namespaceURI===H),k=t.getAttribute("href"),w=a.get(t),v=k!==null&&w?.href!==k,A=h&&!v?s(t):void 0;if(A!==void 0){k!==A&&t.setAttribute("href",A),a.set(t,{href:A,target:w?w.target:t.getAttribute("target")}),t.removeAttribute("target"),u(t),r(t);return}if(v?a.delete(t):f(t),R(t,t.querySelectorAll("a"))){u(t),r(t),p(t);return}if(!t.hasAttribute("role")&&(h||P(t))&&(t.setAttribute("role","link"),i.add(t)),t.localName==="tr"&&t.namespaceURI===U){r(t);let x=[...t.children].find(j=>j.localName==="td"||j.localName==="th");c.get(t)!==x&&p(t),x&&!c.has(t)&&l(x)&&c.set(t,x);return}t.localName!=="button"&&l(t)},refresh(t){for(let d of t.querySelectorAll("[data-record], [data-place], [data-graview-link]"))$.link(d)},pressed(t,d,h){if(t.type!=="click"&&!(t.type==="keydown"&&t.key==="Enter"))return!1;let k=T(d,h,w=>w.hasAttribute("data-graview-link"));return k?(t.stopPropagation(),a.has(k)&&Z(t)||(t.preventDefault(),$.follow(k)),!0):!1},follow(t){let d=y(t);d&&g(d)},go:g};return $}export{Q as a,M as b,b as c,O as d,S as e,oe as f,V as g,se as h};
1
+ import{a as D}from"./chunk.PXQVXBNG.js";import{a as L,f as P,g as N,h as R,i as T}from"./chunk.B3WVCSW5.js";import{Dd as E}from"./chunk.VSCIXAHN.js";var z=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),W=e=>e?._zod?.def;function I(e){let n=W(e);for(;n&&(n.type==="optional"||n.type==="default"||n.type==="nullable"||n.type==="prefault");)n=W(n.innerType);return n}function K(e){if(e?.type==="boolean")return["true","false"];if(e?.type==="enum")return(e.entries?Object.values(e.entries):e.values??[]).filter(n=>typeof n=="string")}var m=e=>e.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/[-_]/g," ").replace(/^./,n=>n.toUpperCase());function J(e,n,i){let a=e.tryDefinition(n);if(!a)return[];let c=new Set(a.display?.hide??[]),o=[];for(let[s,l]of Object.entries(a.fields.shape??{})){if(s==="id"||s==="kind"||s==="label"||c.has(s))continue;let r=I(l);if(r?.type==="array"||r?.type==="object"||r?.type==="record")continue;let u=K(r);o.push({key:s,label:m(s),...u?{options:u}:{}})}let g=new Map;for(let[s,l]of Object.entries(a.edges??{}))g.set(s,l.to==="*"?[]:[...l.to]);for(let s of e.definitions)if(s.kind!==n)for(let[l,r]of Object.entries(s.edges??{}))!g.has(l)&&(r.to==="*"||r.to.includes(n))&&g.set(l,[s.kind]);let y=[];for(let[s,l]of g){o.push({key:s,label:m(s)});let r=i&&l.length===1&&l[0]!==n?e.tryDefinition(l[0]):void 0;for(let[u,f]of Object.entries(r?.fields.shape??{})){let p=I(f);p?.type==="enum"&&!r?.display?.hide?.includes(u)&&y.push({key:`${s}.${u}`,label:`${m(s)} \xB7 ${m(u)}`,options:K(p)})}}return o.push(...y),o.push({key:"is",label:"Is",options:a.lifecycle?["current","past","any","flagged","clear"]:["flagged","clear"]}),o}var G=e=>e.length<=1?e[0]??"":`${e.slice(0,-1).join(", ")} and ${e.at(-1)}`;function q(e,n,i,a={}){if(i==null)return{ok:!0};if(!z(i))return{ok:!1,says:'A filter is an object of a field and the value it keeps, like { where: { stage: "building" } }.'};let c=Object.entries(i);if(c.length===0)return{ok:!0};let o=[];for(let l of n)for(let r of J(e,l,a.through===!0))o.some(u=>u.key===r.key)||o.push(r);let g=n[0]?e.tryDefinition(n[0]):void 0,y=g?g.plural??`${m(g.kind)}s`:"These",s=[];for(let[l,r]of c){let u=o.find(p=>p.key===l);if(!u)return{ok:!1,says:`${y.replace(/^./,p=>p.toUpperCase())} have no field "${l}" to filter by${o.length>0?`; they filter by ${G(o.map(p=>p.key))}`:""}.`};if(typeof r!="string"&&typeof r!="number"&&typeof r!="boolean")return{ok:!1,says:`The filter on "${l}" is ${Array.isArray(r)?"a list":r===null?"null":`a ${typeof r}`}; it keeps one value: a word, a number, or true or false.`};let f=String(r);if(f.trim().length===0)return{ok:!1,says:`The filter on "${l}" keeps nothing; give it a value, or leave "${l}" out.`};if(f.includes(","))return{ok:!1,says:`The filter on "${l}" holds a comma, which an address reads as a second filter; keep one value.`};if(u.options&&u.options.length>0&&!u.options.includes(f))return{ok:!1,says:`${u.label} has no choice "${f}"; its choices are ${G(u.options.map(p=>`"${p}"`))}.`};s.push(`${l}:${f}`)}return{ok:!0,filter:s.join(",")}}var C=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");function F(e,n){let i=e.find(o=>o.as===n);if(i)return i;let a=n.trim().toLowerCase(),c=C(n);return e.find(o=>o.title!==void 0&&o.title.trim().toLowerCase()===a)??(c?e.find(o=>o.as===c||o.title!==void 0&&C(o.title)===c):void 0)}function Q(e){let n=[];for(let i of e){if(typeof i!="object"||i===null)continue;let{as:a,slug:c,title:o,kind:g}=i,y=typeof a=="string"&&a.length>0?a:typeof c=="string"&&c.length>0?c:void 0;!y||n.some(s=>s.as===y)||n.push({as:y,title:typeof o=="string"?o:y,kind:typeof g=="string"?g:""})}return n}var M=e=>` Its places: ${e.map(n=>typeof n=="string"?`"${n}"`:n.title&&n.title!==n.as?`"${n.as}" (${n.title})`:`"${n.as}"`).join(", ")||"none"}.`;var b=e=>`"${e.length>80?`${e.slice(0,79)}\u2026`:e}"`,O=(e,n)=>`${"place"in e?`The place ${b(e.place)}`:`${b(e.record)} is no record this viewer may see and`} is no place of this app: it goes nowhere.${M(n)}`;function S(e){let n={};for(let i of e.split(",")){let a=i.indexOf(":");a>0&&(n[i.slice(0,a).trim()]=i.slice(a+1).trim())}return n}function oe(e,n=new Set){return e.kinds.filter(i=>!n.has(i)).map(i=>({slug:E(e,i).slice(1),kind:i}))}function V(e,n){let i=[...new Set(n.places.map(f=>f.as))],a=n.lists.map(f=>f.slug).filter(f=>!i.includes(f)),c;if(e.section!==void 0&&e.section!==null){if(typeof e.section!="string"||D(e.section).length===0||e.section.length>120)return{ok:!1,says:`The section ${typeof e.section=="string"?b(e.section):"asked for"} names nothing on a page: a section is a heading's words or an element's id, like "shipping-soon". It goes nowhere.`};c=e.section}let o=c!==void 0?{section:c}:{};if("record"in e&&n.sees(e.record))return e.where!==void 0&&e.where!==null?{ok:!1,says:`${b(e.record)} is one record, and a filter narrows a list or a place: it goes nowhere. Go to { place, where } for a list narrowed.`}:{ok:!0,arrival:{record:e.record,...o}};let g="place"in e?e.place:e.record,y=F(n.places,g),s=y?void 0:n.lists.find(f=>f.slug===g||f.kind===g);if(!y&&!s)return{ok:!1,says:`${O(e,n.places.filter((f,p,$)=>$.findIndex(t=>t.as===f.as)===p))}${_(a)}`};let l=y?[y.kind]:[s.kind],r;if(e.where!==void 0&&e.where!==null){if(!n.schema)return{ok:!1,says:`The place ${b(g)} cannot be narrowed here: it goes nowhere.`};let f=q(n.schema,l,e.where,{through:s!==void 0});if(!f.ok)return{ok:!1,says:`The filter on ${b(g)} goes nowhere: ${f.says}`};r=f.filter}let u=r?{filter:r}:{};return{ok:!0,arrival:y?{place:y.as,...u,...o}:{list:s.kind,...u,...o}}}var _=e=>e.length===0?"":` Its lists: ${e.slice(0,8).map(n=>`"${n}"`).join(", ")}${e.length>8?` and ${e.length-8} more`:""}.`,U="http://www.w3.org/1999/xhtml",H="http://www.w3.org/2000/svg",Z=e=>{let n=e;return n.metaKey||n.ctrlKey||n.shiftKey||n.altKey||e.type==="click"&&typeof n.button=="number"&&n.button!==0};function se(e){let n=new WeakSet,i=new WeakSet,a=new WeakMap,c=new WeakMap,o=t=>V(t,{sees:e.sees,places:e.places(),lists:e.lists?.()??[],...e.schema?{schema:e.schema}:{}}),g=t=>{let d=o(t);return d.ok?e.onNavigate?.(d.arrival):e.onLost?.(d.says),d.ok},y=t=>{let d=t.getAttribute("data-record"),h=t.getAttribute("data-place"),k=t.getAttribute("data-filter"),w=t.getAttribute("data-section"),v={...k?{where:S(k)}:{},...w?{section:w}:{}};if(d)return{record:d,...v};if(h)return{place:h,...v}},s=t=>{if(!e.hrefOf)return;let d=y(t),h=d?o(d):void 0;return h?.ok?e.hrefOf(h.arrival):void 0},l=t=>t.hasAttribute("tabindex")?!1:(t.setAttribute("tabindex","0"),n.add(t),!0),r=t=>{n.delete(t)&&t.removeAttribute("tabindex")},u=t=>{i.delete(t)&&t.getAttribute("role")==="link"&&t.removeAttribute("role")},f=t=>{let d=a.get(t);d&&(a.delete(t),t.getAttribute("href")===d.href&&t.removeAttribute("href"),d.target!==null&&!t.hasAttribute("target")&&t.setAttribute("target",d.target))},p=t=>{let d=c.get(t);d&&(c.delete(t),r(d))},$={link(t){if(!N(t,[...t.querySelectorAll("input, select, textarea")].some(L))){if(!t.hasAttribute("data-graview-link"))return;t.removeAttribute("data-graview-link"),u(t),r(t),f(t),p(t);return}t.hasAttribute("data-graview-link")||t.setAttribute("data-graview-link","");let h=t.localName==="a"&&(t.namespaceURI===U||t.namespaceURI===H),k=t.getAttribute("href"),w=a.get(t),v=k!==null&&w?.href!==k,A=h&&!v?s(t):void 0;if(A!==void 0){k!==A&&t.setAttribute("href",A),a.set(t,{href:A,target:w?w.target:t.getAttribute("target")}),t.removeAttribute("target"),u(t),r(t);return}if(v?a.delete(t):f(t),R(t,t.querySelectorAll("a"))){u(t),r(t),p(t);return}if(!t.hasAttribute("role")&&(h||P(t))&&(t.setAttribute("role","link"),i.add(t)),t.localName==="tr"&&t.namespaceURI===U){r(t);let x=[...t.children].find(j=>j.localName==="td"||j.localName==="th");c.get(t)!==x&&p(t),x&&!c.has(t)&&l(x)&&c.set(t,x);return}t.localName!=="button"&&l(t)},refresh(t){for(let d of t.querySelectorAll("[data-record], [data-place], [data-graview-link]"))$.link(d)},pressed(t,d,h){if(t.type!=="click"&&!(t.type==="keydown"&&t.key==="Enter"))return!1;let k=T(d,h,w=>w.hasAttribute("data-graview-link"));return k?(t.stopPropagation(),a.has(k)&&Z(t)||(t.preventDefault(),$.follow(k)),!0):!1},follow(t){let d=y(t);d&&g(d)},go:g};return $}export{Q as a,M as b,b as c,O as d,S as e,oe as f,V as g,se as h};
@@ -0,0 +1 @@
1
+ import{k as a,l as b,m as c,n as d,o as e,p as f,q as g,r as h,s as i}from"./chunk.D7YSL3NK.js";import"./chunk.BJUUSIQY.js";import"./chunk.ZP5RT2EK.js";import"./chunk.VZJWJ5XM.js";import"./chunk.6C2MHWSX.js";import"./chunk.XOZU4OFA.js";import"./chunk.GLWSVSQL.js";import"./chunk.HDUO2USQ.js";import"./chunk.TY4GQJKC.js";import"./chunk.MSWWWLEA.js";import"./chunk.UITT6JWW.js";import"./chunk.A5PDXNY6.js";import"./chunk.WC3DENU4.js";import"./chunk.VNDKKTED.js";import"./chunk.4MP72LPR.js";import"./chunk.SDO3U72B.js";import"./chunk.VSCIXAHN.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{i as GhostTray,h as InlineAiMenu,g as askAgain,c as askInline,a as askOf,b as drawPanel,d as heldSuggestion,e as suggestOnce,f as takeOffer};
@@ -1,4 +1,4 @@
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 ie}from"./chunk.R7LFO7KI.js";import{a as X,c as H,d as J,e as Q}from"./chunk.LMN4TSAP.js";import"./chunk.HS3GHAUR.js";import"./chunk.ZOHMWSHD.js";import"./chunk.PZG3B7F4.js";import"./chunk.LRUNFSHP.js";import"./chunk.43OKZU73.js";import"./chunk.WNSC3RWD.js";import"./chunk.S5MGE2U5.js";import"./chunk.KXPRILAO.js";import"./chunk.GZHZLJBF.js";import"./chunk.ELERUERU.js";import"./chunk.OJGHDWI6.js";import"./chunk.YHTE34RN.js";import"./chunk.3YZHZGTM.js";import"./chunk.EQTSV7BK.js";import"./chunk.27CW6SCT.js";import"./chunk.YD3TKV6P.js";import"./chunk.4KC35UNR.js";import{F as K,G as q,Ga as z,Ra as U,T as x,U as F,Va as Y,ba as b,c as j,x as V}from"./chunk.HT2BEOEV.js";import{a as N}from"./chunk.SDO3U72B.js";import{Za as _,_a as D,da as I,ga as G,ka as B,zb as W}from"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import{b as w}from"./chunk.AJZBJBMO.js";var ae=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 Z(){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=oe(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 oe(e,t){return e.kind===t.kind&&e.id===t.id}var E=w(q(),1),c=w(x(),1),se=`
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 ie}from"./chunk.X6A4VSSD.js";import{a as X,c as H,d as J,e as Q}from"./chunk.YZ7FUKAL.js";import"./chunk.KDRLUBVF.js";import"./chunk.PNW5K7BW.js";import"./chunk.ENL2JJ47.js";import"./chunk.BQIHNT7C.js";import"./chunk.TAT2IQUR.js";import"./chunk.3XGA65Y3.js";import"./chunk.2K4TT2BV.js";import"./chunk.VZJWJ5XM.js";import"./chunk.GZHZLJBF.js";import"./chunk.IOK4GVJC.js";import"./chunk.OJGHDWI6.js";import"./chunk.TLJOZSDD.js";import"./chunk.MSWWWLEA.js";import"./chunk.UITT6JWW.js";import"./chunk.A5PDXNY6.js";import"./chunk.WC3DENU4.js";import"./chunk.VNDKKTED.js";import{F as K,G as q,Ga as z,Ra as U,T as x,U as F,Va as Y,ba as b,c as j,x as V}from"./chunk.4MP72LPR.js";import{a as N}from"./chunk.SDO3U72B.js";import{Za as _,_a as D,da as I,ga as G,ka as B,zb as W}from"./chunk.VSCIXAHN.js";import"./chunk.FQLNBIQ5.js";import{b as w}from"./chunk.AJZBJBMO.js";var ae=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 Z(){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=oe(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 oe(e,t){return e.kind===t.kind&&e.id===t.id}var E=w(q(),1),c=w(x(),1),se=`
2
2
  .graview-here{display:flex;flex:none}
3
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
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)}
@@ -6,4 +6,4 @@ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=gl
6
6
  .graview-here-mark[data-agent]{border-radius:5px}
7
7
  .graview-here-mark[data-counted]{--graview-hue:0;border-color:var(--graview-edge)}
8
8
  .graview-here small{display:block;font-size:.75rem;color:var(--graview-ink-muted)}
9
- .graview-bar[data-finding] .graview-here{display:none}`,le={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function de(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 ee=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",te=e=>e===1?"1 viewer":`${e} viewers`;function pe(e){let t=e.map(ee).filter(Boolean),i=t.length<e.length?[...t,te(e.length-t.length)]:t,a=i.pop();return`${i.length>0?`${i.join(", ")} and ${a}`:a} ${e.length===1?"is":"are"} here`}function ce(e,t){let{store:i,hidden:a,pictures:l}=t,d=j(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=V(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)?G(i.schema.tryDefinition(h.kind),h):null}function ue(e,t){let i=o=>o.id!==void 0&&(o.id===t.principal.id||o.onBehalfOf?.id===t.principal.id),a=e.filter(o=>!W(o)&&_(o.author)!=="system"&&!i(o.author)),l=a[0];if(!l)return null;let d=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 ge(e,t,i){let a=ue(e,t);a&&(i(""),setTimeout(()=>i(a),50))}function he({scene:e,compact:t}){let{who:i,principal:a,store:l,views:d,hiddenKinds:s,follow:o}=b(),g=Y("here"),p=de(i,a),h=p.length===0?"":pe(p),[u,S]=(0,E.useState)("");if((0,E.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:se}),(0,c.jsx)("span",{role:"status","aria-live":"polite",style:le,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)(O,{one:r},r.participant))}):(0,c.jsx)(O,{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:U,children:[f.map(r=>{let v=ce(r.stop,{store:l,principal:a,hidden:s,pictures:T}),A=ee(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)(O,{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)(O,{count:k}),(0,c.jsxs)("span",{children:[te(k),(0,c.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function O({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 me(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 L(e,t,i,a,l,d){let s=me(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},ne=500,ye=10;function fe(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()},L(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?L(t,p,l,d):L(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)>ye&&(f=!0)};document.addEventListener("pointermove",y),setTimeout(()=>{document.removeEventListener("pointermove",y),!(f||s.at!==0&&s.at-S<ne)&&(R={on:t,at:Date.now()},t.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,once:!0}),L(t,p,l,d,h,u))},Math.max(0,ne-(Date.now()-S)))}var n=w(x(),1),Ge=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.YD3TKV6P.js","./chunk.4KC35UNR.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VHSWBFXB.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),ve=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.JUNMJYH5.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=X(i,e);return(0,n.jsx)(n.Fragment,{children:d.map((s,o)=>{let g=Q(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)(J,{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=>I(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:re,children:r.label}):(0,n.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{T.setOpen(!1),r.onSelect?.()},style:{...re,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)(Z,{})]}):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,K(m)?(0,n.jsx)(ae.Suspense,{fallback:null,children:(0,n.jsx)(ve,{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:we}}),"Graview"]})]}):null]})})}var we='<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>',re={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{ie as ActivityRail,he as Here,Be as ProblemRows,_e as ProfilePane,Ge as TidyFoot,fe as placeGesture,ge as sayTheirChange};
9
+ .graview-bar[data-finding] .graview-here{display:none}`,le={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"};function de(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 ee=e=>e.name&&e.onBehalfOfName?`${e.name}, for ${e.onBehalfOfName}`:e.name??"",te=e=>e===1?"1 viewer":`${e} viewers`;function pe(e){let t=e.map(ee).filter(Boolean),i=t.length<e.length?[...t,te(e.length-t.length)]:t,a=i.pop();return`${i.length>0?`${i.join(", ")} and ${a}`:a} ${e.length===1?"is":"are"} here`}function ce(e,t){let{store:i,hidden:a,pictures:l}=t,d=j(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=V(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)?G(i.schema.tryDefinition(h.kind),h):null}function ue(e,t){let i=o=>o.id!==void 0&&(o.id===t.principal.id||o.onBehalfOf?.id===t.principal.id),a=e.filter(o=>!W(o)&&_(o.author)!=="system"&&!i(o.author)),l=a[0];if(!l)return null;let d=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 ge(e,t,i){let a=ue(e,t);a&&(i(""),setTimeout(()=>i(a),50))}function he({scene:e,compact:t}){let{who:i,principal:a,store:l,views:d,hiddenKinds:s,follow:o}=b(),g=Y("here"),p=de(i,a),h=p.length===0?"":pe(p),[u,S]=(0,E.useState)("");if((0,E.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:se}),(0,c.jsx)("span",{role:"status","aria-live":"polite",style:le,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)(O,{one:r},r.participant))}):(0,c.jsx)(O,{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:U,children:[f.map(r=>{let v=ce(r.stop,{store:l,principal:a,hidden:s,pictures:T}),A=ee(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)(O,{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)(O,{count:k}),(0,c.jsxs)("span",{children:[te(k),(0,c.jsx)("small",{children:"Not signed in"})]})]})}):null]})]})}function O({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 me(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 L(e,t,i,a,l,d){let s=me(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},ne=500,ye=10;function fe(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()},L(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?L(t,p,l,d):L(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)>ye&&(f=!0)};document.addEventListener("pointermove",y),setTimeout(()=>{document.removeEventListener("pointermove",y),!(f||s.at!==0&&s.at-S<ne)&&(R={on:t,at:Date.now()},t.addEventListener("click",m=>{m.preventDefault(),m.stopPropagation()},{capture:!0,once:!0}),L(t,p,l,d,h,u))},Math.max(0,ne-(Date.now()-S)))}var n=w(x(),1),Ge=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.XGASJAV2.js")))).part((e,t)=>(0,n.jsx)(e.TidyGroups,{...t}),{quiet:!0}),ve=z(N(()=>(__graviewPreload(import.meta.url,["./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VWJGQDCE.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=X(i,e);return(0,n.jsx)(n.Fragment,{children:d.map((s,o)=>{let g=Q(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)(J,{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=>I(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:re,children:r.label}):(0,n.jsx)("button",{type:"button","data-testid":"host-action",className:"graview-host-action",onClick:()=>{T.setOpen(!1),r.onSelect?.()},style:{...re,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)(Z,{})]}):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,K(m)?(0,n.jsx)(ae.Suspense,{fallback:null,children:(0,n.jsx)(ve,{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:we}}),"Graview"]})]}):null]})})}var we='<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>',re={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{ie as ActivityRail,he as Here,Be as ProblemRows,_e as ProfilePane,Ge as TidyFoot,fe as placeGesture,ge as sayTheirChange};
@@ -1 +1 @@
1
- import{e as $}from"./chunk.7SQAKSJD.js";import{a as C}from"./chunk.VG7OWV2H.js";import{l as M}from"./chunk.EQTSV7BK.js";import{Eb as x,ga as k,ha as v,ia as j}from"./chunk.7BBGRTXM.js";function N(a,s){let c=a.tryDefinition(s),r=Object.keys(c?.fields?.shape??{}),m=[c?.lifecycle?.field,...r.filter(l=>/^(status|stage|state|phase)$/i.test(l))].filter(l=>l!==void 0&&r.includes(l));return[...new Set(m)].slice(0,1)}function P(a,s){return a.tryDefinition(s)?.fieldRoles?.title??"label"}function V(a,s,c={}){let r=s.map(e=>a.graph.getNode(e)).filter(e=>e!==void 0);if(r.length===0)return{acts:[],withheld:[]};let u=c.principal??{kind:"human"},m=C(a,r.map(e=>e.id),{...c.derive,principal:u,...c.context?{context:c.context}:{}}),l=new Map(a.allMutations().map(e=>[e.name,e])),g=[...new Set(r.map(e=>e.kind))],p=new Set(g.map(e=>P(a.schema,e))),h=new Set(m.affordances.filter(e=>e.provider==="schema").map(e=>e.mutation)),o=e=>{let n=l.get(e.mutation);if(!n?.subject)return;let t=r.length===1&&e.provider==="invariant"&&!h.has(e.mutation)&&e.args[n.subject.arg]===r[0].id;if(!(e.provider!=="schema"&&!t)&&!(r.length>1&&e.batch?.length!==r.length)&&n.derived?.act!=="edit"&&!e.open.some(i=>p.has(i.name)))return n},y=[],b=new Set;for(let e of m.affordances){let n=o(e);if(!n||b.has(n.name))continue;b.add(n.name);let{[n.subject.arg]:t,...i}=e.args;y.push({id:e.id,label:v(n),mutation:n.name,subject:n.subject.arg,args:i,open:e.open,...e.destructive||e.setsAside?{more:!0}:{},...e.destructive?{destructive:!0}:{},affordance:{...e,label:v(n)}})}if(g.length===1){let e=g[0];for(let n of N(a.schema,e))for(let t of $(a.schema,[...l.values()],e,n)){if(t.by==="none"||r.every(d=>d[n]===t.value))continue;let i=r.find(d=>d[n]!==t.value),f=t.acts.find(d=>{let D=t.by==="step"?{[d.subject.arg]:i.id}:{[d.subject.arg]:i.id,[n]:t.value};return a.permits({name:d.name,args:D},u).ok});if(!f)continue;let w=t.by==="step"?{}:{[n]:t.value};if(t.by==="step"&&y.some(d=>d.mutation===f.name))continue;let R=t.by==="step"?v(f):`Move to ${t.label}`,O=`set:${n}:${t.value}`;y.push({id:O,label:R,mutation:f.name,subject:f.subject.arg,args:w,open:[],affordance:{id:O,label:R,provider:"schema",mutation:f.name,args:{[f.subject.arg]:i.id,...w},open:[],score:0,why:`every one is ${e}`,nodeIds:r.map(d=>d.id)}})}}let S=[...y.filter(e=>!e.more),...y.filter(e=>e.more)],A=m.withheld.filter(e=>{let n=l.get(e.mutation);return n?.subject!==void 0&&n.derived?.act!=="edit"&&(r.length===1||e.batch?.length===r.length)}).map(e=>({label:v(l.get(e.mutation)),message:e.refusal.message}));return{acts:S,withheld:A}}function _(a,s,c,r={}){let u=r.author,m=a.allMutations().find(e=>e.name===s.mutation),l=e=>M(a.schema,a.allMutations(),e),g=e=>{let n=a.graph.getNode(e);return n?k(a.schema.tryDefinition(n.kind),n):e},p=[],h=[],o=[];for(let e of[...new Set(c)]){let n={name:s.mutation,args:{...s.args,[s.subject]:e}};if(!m){p.push({id:e,label:g(e),message:`There is no act \u201C${s.mutation}\u201D.`,reason:"invalid"});continue}let t=a.permits(n,u);if(!t.ok){p.push({id:e,label:g(e),message:t.refusal.message,reason:"forbidden"});continue}if(!a.wouldChange(n,u)){h.push(e);continue}o.push({id:e,call:n})}let y=e=>a.previewAll(e,{...u?{author:u}:{},...r.context?{context:r.context}:{}});for(let e=0;o.length>0;e+=1)try{y(o.map(n=>n.call));break}catch(n){let t=[];for(let i of o)try{y([i.call]),t.push(i)}catch(f){p.push({id:i.id,label:g(i.id),message:l(f),reason:x(f).reason})}if(t.length===o.length||e>o.length){for(let i of t)p.push({id:i.id,label:g(i.id),message:l(n),reason:x(n).reason});o=[];break}o=t}if(o.length===0)return{applied:[],unchanged:h,refused:p};let b=s.label??(m?v(m):s.mutation),S=[...new Set(o.map(e=>a.graph.getNode(e.id)?.kind))],A=`${b} \u2014 ${S.length===1&&S[0]?j(a.schema,S[0],o.length):`${o.length} records`}`;try{let e=a.applyAll(o.map(n=>n.call),{intent:A,...u?{author:u}:{},...r.via?{via:r.via}:{}});return{batch:e.batch,intent:A,applied:o.map(n=>n.id),unchanged:h,refused:p,result:e}}catch(e){let n=l(e),t=x(e).reason;return{applied:[],unchanged:h,refused:[...p,...o.map(i=>({id:i.id,label:g(i.id),message:n,reason:t}))],allOrNothing:!0}}}export{V as a,_ as b};
1
+ import{e as $}from"./chunk.IHBUBZQT.js";import{a as C}from"./chunk.ZP5RT2EK.js";import{l as M}from"./chunk.UITT6JWW.js";import{Eb as x,ga as k,ha as v,ia as j}from"./chunk.VSCIXAHN.js";function N(a,s){let c=a.tryDefinition(s),r=Object.keys(c?.fields?.shape??{}),m=[c?.lifecycle?.field,...r.filter(l=>/^(status|stage|state|phase)$/i.test(l))].filter(l=>l!==void 0&&r.includes(l));return[...new Set(m)].slice(0,1)}function P(a,s){return a.tryDefinition(s)?.fieldRoles?.title??"label"}function V(a,s,c={}){let r=s.map(e=>a.graph.getNode(e)).filter(e=>e!==void 0);if(r.length===0)return{acts:[],withheld:[]};let u=c.principal??{kind:"human"},m=C(a,r.map(e=>e.id),{...c.derive,principal:u,...c.context?{context:c.context}:{}}),l=new Map(a.allMutations().map(e=>[e.name,e])),g=[...new Set(r.map(e=>e.kind))],p=new Set(g.map(e=>P(a.schema,e))),h=new Set(m.affordances.filter(e=>e.provider==="schema").map(e=>e.mutation)),o=e=>{let n=l.get(e.mutation);if(!n?.subject)return;let t=r.length===1&&e.provider==="invariant"&&!h.has(e.mutation)&&e.args[n.subject.arg]===r[0].id;if(!(e.provider!=="schema"&&!t)&&!(r.length>1&&e.batch?.length!==r.length)&&n.derived?.act!=="edit"&&!e.open.some(i=>p.has(i.name)))return n},y=[],b=new Set;for(let e of m.affordances){let n=o(e);if(!n||b.has(n.name))continue;b.add(n.name);let{[n.subject.arg]:t,...i}=e.args;y.push({id:e.id,label:v(n),mutation:n.name,subject:n.subject.arg,args:i,open:e.open,...e.destructive||e.setsAside?{more:!0}:{},...e.destructive?{destructive:!0}:{},affordance:{...e,label:v(n)}})}if(g.length===1){let e=g[0];for(let n of N(a.schema,e))for(let t of $(a.schema,[...l.values()],e,n)){if(t.by==="none"||r.every(d=>d[n]===t.value))continue;let i=r.find(d=>d[n]!==t.value),f=t.acts.find(d=>{let D=t.by==="step"?{[d.subject.arg]:i.id}:{[d.subject.arg]:i.id,[n]:t.value};return a.permits({name:d.name,args:D},u).ok});if(!f)continue;let w=t.by==="step"?{}:{[n]:t.value};if(t.by==="step"&&y.some(d=>d.mutation===f.name))continue;let R=t.by==="step"?v(f):`Move to ${t.label}`,O=`set:${n}:${t.value}`;y.push({id:O,label:R,mutation:f.name,subject:f.subject.arg,args:w,open:[],affordance:{id:O,label:R,provider:"schema",mutation:f.name,args:{[f.subject.arg]:i.id,...w},open:[],score:0,why:`every one is ${e}`,nodeIds:r.map(d=>d.id)}})}}let S=[...y.filter(e=>!e.more),...y.filter(e=>e.more)],A=m.withheld.filter(e=>{let n=l.get(e.mutation);return n?.subject!==void 0&&n.derived?.act!=="edit"&&(r.length===1||e.batch?.length===r.length)}).map(e=>({label:v(l.get(e.mutation)),message:e.refusal.message}));return{acts:S,withheld:A}}function _(a,s,c,r={}){let u=r.author,m=a.allMutations().find(e=>e.name===s.mutation),l=e=>M(a.schema,a.allMutations(),e),g=e=>{let n=a.graph.getNode(e);return n?k(a.schema.tryDefinition(n.kind),n):e},p=[],h=[],o=[];for(let e of[...new Set(c)]){let n={name:s.mutation,args:{...s.args,[s.subject]:e}};if(!m){p.push({id:e,label:g(e),message:`There is no act \u201C${s.mutation}\u201D.`,reason:"invalid"});continue}let t=a.permits(n,u);if(!t.ok){p.push({id:e,label:g(e),message:t.refusal.message,reason:"forbidden"});continue}if(!a.wouldChange(n,u)){h.push(e);continue}o.push({id:e,call:n})}let y=e=>a.previewAll(e,{...u?{author:u}:{},...r.context?{context:r.context}:{}});for(let e=0;o.length>0;e+=1)try{y(o.map(n=>n.call));break}catch(n){let t=[];for(let i of o)try{y([i.call]),t.push(i)}catch(f){p.push({id:i.id,label:g(i.id),message:l(f),reason:x(f).reason})}if(t.length===o.length||e>o.length){for(let i of t)p.push({id:i.id,label:g(i.id),message:l(n),reason:x(n).reason});o=[];break}o=t}if(o.length===0)return{applied:[],unchanged:h,refused:p};let b=s.label??(m?v(m):s.mutation),S=[...new Set(o.map(e=>a.graph.getNode(e.id)?.kind))],A=`${b} \u2014 ${S.length===1&&S[0]?j(a.schema,S[0],o.length):`${o.length} records`}`;try{let e=a.applyAll(o.map(n=>n.call),{intent:A,...u?{author:u}:{},...r.via?{via:r.via}:{}});return{batch:e.batch,intent:A,applied:o.map(n=>n.id),unchanged:h,refused:p,result:e}}catch(e){let n=l(e),t=x(e).reason;return{applied:[],unchanged:h,refused:[...p,...o.map(i=>({id:i.id,label:g(i.id),message:n,reason:t}))],allOrNothing:!0}}}export{V as a,_ as b};
@@ -1,2 +1,2 @@
1
- import{a as Ge}from"./chunk.EB4NVTJL.js";import{c as Me,d as Oe,f as Be}from"./chunk.BB33TI4S.js";import{e as Pe,f as Ce,k as Re,l as re,n as Fe}from"./chunk.LDAYDCUO.js";import{f as Se}from"./chunk.QGV7H7RQ.js";import{d as _,e as je,k as ne}from"./chunk.EQTSV7BK.js";import{b as De,e as Ae}from"./chunk.27CW6SCT.js";import{$b as te,Ad as $e,Bc as he,C as Q,Dc as ye,Fc as we,Jb as fe,K as de,Kd as ke,Nc as U,Oc as be,Sd as xe,ac as ge,ba as ue,da as Z,fa as H,ga as T,ha as me,ia as ee,ja as pe,jd as ve,ma as q,oa as z}from"./chunk.7BBGRTXM.js";function ze(r,e,t){let o=r.tryDefinition(e)?.fields.shape,n=Q(o?.[t]),a=!1,s=!1;for(;n&&(n.type==="optional"||n.type==="default"||n.type==="nullable"||n.type==="prefault");)(n.type==="optional"||n.type==="nullable")&&(a=!0),(n.type==="default"||n.type==="prefault")&&(s=!0),n=Q(n.innerType);if(n?.type!=="enum")return;let p=(n.entries?Object.values(n.entries):n.values??[]).filter(m=>typeof m=="string");return p.length>0?{values:p,empty:a&&!s}:void 0}function E(r,e,t){let o=ze(r,e,t);if(!o)return[];let n=r.tryDefinition(e),a=o.values.map(s=>({value:s,label:De(n,t,s)}));return o.empty&&a.push({value:null,label:`No ${q(n,t).toLowerCase()}`}),a}function X(r,e,t){let o=r[e];return typeof o=="string"&&t.some(n=>n.value===o)?o:null}function se(r,e,t,o,n=E(r.schema,t.kind,o)){return Ie(r,e,t,o,n).flatMap(a=>a.move?[a.move]:[])}function Ie(r,e,t,o,n=E(r.schema,t.kind,o)){let a=Ne(r.schema,r.allMutations(),t.kind,o,n),s=X(t,o,n),p=z(r.schema.tryDefinition(t.kind),t.kind),m=[];for(let{value:A,label:C,by:R,acts:F}of a){if(A===s)continue;let x,I,N;for(let c of F){let w=R==="step"?{[c.subject.arg]:t.id}:{[c.subject.arg]:t.id,[o]:A},S={name:c.name,args:w};if(!c.input.safeParse(w).success){N??=`${c.title??c.name} asks for more than the ${p} itself.`;continue}let k=r.permits(S,e);if(!k.ok){I??=k.refusal?.message??`You may not ${c.title??c.name}.`;continue}try{fe(r.graph,c,w)}catch(f){I??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:c.title??c.name};break}m.push(x?{to:A,label:C,move:x}:{to:A,label:C,why:I??N??`Nothing in this app moves a ${p} to ${C}.`})}return m}function Ne(r,e,t,o,n=E(r,t,o)){let a=Ve(r,e,t,o),s=Ke(r,e,t,o);return n.flatMap(p=>{if(p.value===null)return[];let m=a.filter(A=>A.sets?.[o]===p.value);return[{value:p.value,label:p.label,by:m.length>0?"step":s.length>0?"value":"none",acts:m.length>0?m:s}]})}function Ve(r,e,t,o){return e.filter(n=>n.subject!==void 0&&n.derived===void 0&&typeof n.sets?.[o]=="string"&&te(r,n).includes(t))}function Ke(r,e,t,o){let n=r.tryDefinition(t);return n?e.filter(a=>{if(!a.subject||!te(r,a).includes(t)||!ge(a,n).includes(o))return!1;let s=a.input.shape;return s!==void 0&&o in s}).sort((a,s)=>+(a.derived!==void 0)-+(s.derived!==void 0)):[]}var oe=(r,e)=>e&&r[e]!==void 0?String(r[e]):"";function Xe(r,e,t){let o=c=>r.tryDefinition(c)?e.nodesOfKind(c).filter(w=>H(r.tryDefinition(c),w)):[],n=o(t.rows),a=o(t.columns),s=new Set(n.map(c=>c.id)),p=new Set(a.map(c=>c.id)),m=e.allEdges(),A=[],C=t.link;if(typeof C=="string"){let c=f=>r.tryDefinition(f)?.edges?.[C]?.to,w=(c(t.columns)??[]).some(f=>f===t.rows||f==="*"),S=(c(t.rows)??[]).some(f=>f===t.columns||f==="*"),k=w||!S;for(let f of m){if(f.kind!==C)continue;let j=k?f.to:f.from,i=k?f.from:f.to;s.has(j)&&p.has(i)&&A.push({rowId:j,columnId:i,via:[]})}}else{let c=new Map(C.path.map(S=>[S,new Map]));for(let S of m){let k=c.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let j=k.get(S.to);j?j.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of C.path){let j=[],i=new Set;for(let $ of k)for(let b of c.get(f).get($.id)??[])i.has(`${$.id}|${b}`)||(i.add(`${$.id}|${b}`),j.push({id:b,via:[...$.via,$.id]}));k=j}for(let f of k){let j=`${f.id}|${S.id}`;!s.has(f.id)||w.has(j)||(w.add(j),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let R=t.groupOrder??[],F=c=>R.indexOf(c)===-1?R.length:R.indexOf(c),x=(c,w)=>w==="label"?T(r.tryDefinition(c.kind),c):c[w],I=U(n,t.sort,x).map(c=>{let w=c;return{node:c,label:T(r.tryDefinition(c.kind),c),group:oe(w,t.rowGroup),ref:oe(w,t.rowRef)}}).sort((c,w)=>F(c.group)-F(w.group)||(t.sort!==void 0?0:c.ref<w.ref?-1:c.ref>w.ref?1:0)),N=U(a,t.columnSort,x).map(c=>({node:c,label:T(r.tryDefinition(c.kind),c),group:oe(c,t.columnGroup)})).sort((c,w)=>c.group<w.group?-1:c.group>w.group?1:t.columnSort!==void 0?0:c.node.id<w.node.id?-1:c.node.id>w.node.id?1:0);return{rows:I,columns:N,cells:A}}function We(r,e,t){let{rows:o,columns:n,cells:a}=Xe(r,e,t),s=(i,$)=>ee(r,i,$),p=i=>ee(r,i,1).replace(/^1 /,""),m=i=>({id:i.id,kind:i.kind,title:T(r.tryDefinition(i.kind),i),parts:[]}),A=i=>{let $=e.getNode(i);if(!$)return null;let b=r.tryDefinition($.kind),P=T(b,$),V=_($,b,{limit:3,said:[P],glance:!0}).map(K=>K.alone.startsWith(K.label)?`${K.label.toLowerCase()}${K.alone.slice(K.label.length)}`:K.alone);return[P,...V].join(", ")},C=typeof t.link=="string"?[]:t.link.path.slice(0,-1).flatMap((i,$,b)=>{let P=ve(r,t.columns,b.slice(0,$+1));return P.ok?[...P.reached]:[]}),R=be(r,t,{rows:o.length,columns:n.length,cells:a.length});if(R)return[{t:"text",text:`${s(t.rows,o.length)} against ${s(t.columns,n.length)}.`},{t:"text",text:R}];let F=[{t:"text",text:`${s(t.rows,o.length)} against ${s(t.columns,n.length)}${C.length>0?`, through ${[...new Set(C)].map(i=>s(i,2).replace(/^2 /,"")).join(" and ")}`:""}${n.length>0?`: ${n.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(n.map(i=>[i.node.id,i.label])),I=new Map(n.map((i,$)=>[i.node.id,$])),N=new Map,c=new Map;for(let i of a){let $=N.get(i.rowId);$?$.push(i):N.set(i.rowId,[i]);let b=c.get(i.columnId);b?b.add(i.rowId):c.set(i.columnId,new Set([i.rowId]))}for(let i of o){let b=[...N.get(i.node.id)??[]].sort((P,V)=>I.get(P.columnId)-I.get(V.columnId)).map(P=>{let V=P.via.map(A).filter(K=>K!==null);return`${x.get(P.columnId)}${V.length>0?` (${V.join("; ")})`:""}`});F.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}F.push({t:"list",as:"name",columns:1,groups:n.map(i=>{let $=c.get(i.node.id)??new Set,b=o.filter(P=>$.has(P.node.id)).map(P=>m(P.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=o.filter(i=>!w.has(i.node.id)),f=n.filter(i=>!S.has(i.node.id)),j=t.rows===t.columns;return k.length>0&&F.push({t:"text",text:`${j?`${k.length} with none across`:`${s(t.rows,k.length)} with no ${p(t.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&F.push({t:"text",text:`${j?`${f.length} with none down`:`${s(t.columns,f.length)} on no ${p(t.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),F}function ie(r,e,t,o={}){let{app:n,blocks:a=t?n?.viewSpecs?.[t.kind]?.[o.slot??"page"]:n?.home}=o;if(!a?.length)return[];let s=o.firstHeading??(t||o.blocks?void 0:1),p=Fe(r,e,t,{...o,money:o.money??n?.brand,firstHeading:s});return t&&!p.node?[]:Ce(typeof a[0]?.t=="string"?a:Pe(a),p)}function Y(r,e,t){let o=!(e.optional||e.control==="boolean"),n=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(s=>Z(z(r.tryDefinition(s),s))).join(" or "):t(e.name).label,a={name:e.name,label:n,required:o};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(s=>t(e.name).option(s))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${Y(r,e.item,t).input}`};case"group":return{...a,input:"group",fields:e.fields.map(s=>Y(r,s,t))};case"variant":return{...a,input:"one of",choices:e.options.map(s=>Z(s.value))};default:return{...a,input:"answer"}}}function Te(r,e,t){let o=Oe(r,e,t),n=r.schema,a=Me(n,t).filter(p=>p.name!==t.subject?.arg&&!o.has(p.name)),s=me(t);return{act:t.name,title:s,submit:s,fields:a.map(p=>Y(n,p,m=>ne(n,t,m)))}}function He(r,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(t=>Y(r,t,o=>ne(r,e.act,o)))}}function Ee(r,e,t){return r.permittedMutations(e).filter(o=>!o.derived&&!o.subject&&(o.creates??[]).includes(t))}function Le(r,e=""){let t=[`${e}Form "${r.title}" (${r.visitor?`the visitor form ${r.visitor}, running `:""}act ${r.act}), button "${r.submit}":`],o=(n,a)=>{for(let s of n){let p=s.choices?`${s.input}: ${s.choices.join(", ")}`:s.kinds?`${s.input} (${s.kinds.join(" or ")})`:s.input,m=s.min!==void 0||s.max!==void 0?`, ${s.min??"\u2026"} to ${s.max??"\u2026"}`:"";t.push(`${a}- ${s.label}${s.required?" *":""} (${s.name}) \u2014 ${p}${m}`),s.fields&&o(s.fields,`${a} `)}};return o(r.fields,`${e} `),r.fields.length===0&&t.push(`${e} (asks nothing)`),t}function Ue(r,e){let t=r.viewSpecs??{};return e.filter(o=>o.cardinality==="one"&&o.replaces==="page"&&(t[o.attach]?.page?.length??0)>0).map(o=>{let n=L(r.schema,o.attach,1);return{at:`views.${o.attach}.page`,says:`The view "${o.name}" replaces ${Ye(n)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Ye=r=>`${/^[aeiou]/i.test(r)?"an":"a"} ${r}`,Je=240,Ze=10,Qe=1160,et=40,_e=640,tt=3,nt=r=>Math.max(1,Math.floor((Math.min(r,Qe)-et+Ze)/(Je+Ze)));function rt(r,e,t,o){let{app:n}=o,a=o.width??1440,s=o.today??r.today()??de(n.brand?.timeZone),p=r.seenBy(e),m=p.schema,A=p.graph,C=Ge(n,o.views?{views:o.views}:{}),R=typeof t=="string"?t.trim():t.slug,F=typeof t=="string"?C.find(l=>l.slug===R||l.title===R||l.address===R):C.find(l=>l.slug===t.slug&&l.kind===t.kind)??t,x=!F&&typeof t=="string"?A.getNode(R):void 0,I=!F&&!x?/^\/?forms\/(.+)$/.exec(R)?.[1]:void 0,N=I!==void 0?Be(n,I):void 0;if(N)return{ok:!0,description:st(m,N,a)};if(!F&&!x)return{ok:!1,error:`"${R}" is not a place this app has, nor a record this seat can see.`,places:[...C.map(l=>l.slug),...Object.keys(n.forms??{}).map(l=>`forms/${l}`)]};let c=[],w=n.viewSpecs??{},S=nt(a),k=(l,h)=>ie(p,null,l,{app:n,today:s,...h}),f=(l,h,M)=>{let d=m.tryDefinition(l.kind),g=T(d,l);if(h==="name")return{id:l.id,kind:l.kind,title:g,parts:[]};if(w[l.kind]?.[h]){let G=k(l,{slot:h}),[B,...O]=G,y=B?.t==="title"||h==="row"&&B?.t==="headline";return{id:l.id,kind:l.kind,title:y?B.text:g,parts:j(y?O:G,M,`views.${l.kind}.${h}`,` (${l.id})`,y?1:0)}}if(h==="row")return{id:l.id,kind:l.kind,title:g,parts:[]};let u=d?.computed?re(m,A,l):l,W=_(u,d,{limit:3,said:[g],glance:!0,locale:n.brand?.locale,timeZone:n.brand?.timeZone});return{id:l.id,kind:l.kind,title:g,parts:W.map(G=>({t:"text",text:G.alone}))}};function j(l,h,M,d="",g=0){let v=[];return l.forEach((u,W)=>{let G=`${M}.${W+g}`;switch("problem"in u&&u.problem&&c.push({at:`${G}${d}`,says:u.problem}),u.t){case"title":v.push({t:"heading",level:3,text:u.text});return;case"text":v.push({t:"text",text:u.markdown?Ae(u.text):u.runs?it(u.runs):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":v.push({t:"badge",text:u.text});return;case"field":case"image":v.push({t:"field",label:u.label,text:u.text});return;case"progress":v.push({t:"progress",label:u.label,text:u.text});return;case"group":v.push(...j(u.blocks,h,`${G}.group`,d));return;case"when":v.push(...j(u.blocks,h,`${G}.show`,d));return;case"divider":case"figure":return;case"headline":v.push({t:"heading",level:u.level,text:u.text});return;case"number":v.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){v.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&v.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let B=h+1,O=B>tt?"name":u.as,y=(u.groups??[{value:null,members:u.members}]).map(D=>({..."heading"in D&&D.heading?{heading:D.heading,count:(u.everyGroup?.find(J=>J.value===D.value)??D).members.length}:{},items:D.members.map(J=>f(J,O,B))}));v.push({t:"list",as:O,columns:O==="card"?S:1,groups:y,...u.more>0?{more:u.more}:{}});return}}}),v}let i=[],$,b,P,V=[];if(x){b="record";let l=m.tryDefinition(x.kind),h=T(l,x);P={slug:x.id,title:h,kind:x.kind,address:$e(m,x.kind,x.id)};let M=w[x.kind]?.page,d=o.views?.find(g=>g.attach===x.kind&&g.cardinality==="one");if(d&&i.push({t:"view",name:d.name,...d.title?{title:d.title}:{},...d.replaces==="page"?{replaces:!0}:{},...d.parts?{parts:d.parts}:{}}),d?.replaces==="page")b=`view:${d.name}`,c.push(...Ue(n,[d]));else{M&&i.push(...j(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let g=l?.computed?re(m,A,x):x;for(let v of je(l,_(g,l,{said:[h],locale:n.brand?.locale,timeZone:n.brand?.timeZone}))){v.title&&i.push({t:"heading",level:2,text:v.title});for(let u of v.fields)i.push({t:"field",label:u.label,text:u.value,...u.long?{long:!0}:{},...u.markdown?{markdown:!0}:{}})}}}else{let l=F;P={slug:l.slug,title:l.title,kind:l.kind,address:l.address};let h=l.lens?ke(n).drawn.find(d=>d.as===l.slug&&(l.kind===null||d.kinds.includes(l.kind))):void 0,M=l.kind!==null&&l.view===void 0&&!h?o.views?.find(d=>d.attach===l.kind&&d.cardinality==="many"&&d.replaces==="page"&&!d.hidden):void 0;if(l.kind!==null&&h?.create!==!1&&l.view===void 0&&!M&&(V=Ee(r,e,l.kind).map(d=>Te(r,e,d))),l.view!==void 0&&!h){let d=o.views?.find(g=>g.name===l.view);b=`view:${l.view}`,i.push({t:"view",name:l.view,title:d?.title??l.title,...typeof d?.flows=="boolean"?{flows:d.flows}:{},...d?.parts?{parts:d.parts}:{}})}else if(l.kind===null){let d=n.brand,g=d?.name??n.name,v=we(d)?.light,u=v&&ye(v)?v:void 0;if($={name:g,...d?.subtitle&&d.subtitleDrawn!==!1?{subtitle:d.subtitle}:{},...u?{logo:{alt:d?.logoAlt??g,...he(u)?{drawn:"inline SVG"}:{drawn:"image",src:u}}}:{}},n.home)b="blocks",i=j(k(null,{}),0,"views.home");else{b="derived";let W=r.kindsKeptFrom(e),G=new Set([...n.pages?.hide??[],...W,...r.modules.disabledKinds]),B=xe(m.kinds,n.pages?.order).filter(O=>!G.has(O));i.push({t:"heading",level:1,text:n.name??"Home"});for(let O of B){let y=A.nodesOfKind(O).filter(D=>H(m.tryDefinition(O),D)).length;y>0&&i.push({t:"text",text:`${y} ${L(m,O,y)}`})}}}else if(h?.lens==="blocks")b="lens:blocks",i=j(k(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){b="lens:columns";let d=h.options.bindings??{};for(let g of Object.keys(d)){let v=d[g]?.column;if(!v)continue;let u=E(m,g,v),W=U(A.nodesOfKind(g).filter(y=>H(m.tryDefinition(g),y)),h.options.sort,(y,D)=>D==="label"?T(m.tryDefinition(y.kind),y):y[D]);Object.keys(d).length>1&&i.push({t:"heading",level:2,text:L(m,g,2).replace(/^./,y=>y.toUpperCase())}),i.push({t:"text",text:`${W.length} ${L(m,g,W.length)} in columns by ${q(m.tryDefinition(g),v).toLowerCase()}.`});let G=u.map(y=>({column:y,items:W.filter(D=>X(D,v,u)===y.value).map(D=>f(D,"card",1))})).filter(({column:y,items:D})=>y.value!==null||D.length>0).map(({column:y,items:D})=>({heading:`${y.label} (${D.length})`,items:D}));i.push({t:"list",as:"card",columns:1,groups:G});let B=new Map;for(let y of W)for(let D of se(r,e,y,v,u))B.set(D.to,(B.get(D.to)??new Set).add(`"${D.title}"`));let O=u.filter(y=>y.value!==null&&B.has(y.value)).map(y=>`to ${y.label} by ${[...B.get(y.value)].join(" or ")}`);i.push({t:"text",text:O.length>0?`Moves: ${O.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")b="lens:coverage",i=We(m,A,h.options);else if(h){b=`lens:${h.lens}`;let d=h.kinds.flatMap(g=>A.nodesOfKind(g).filter(v=>H(m.tryDefinition(g),v)));i.push({t:"text",text:`A ${h.lens} of ${d.length} ${h.kinds.map(g=>L(m,g,d.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:d.map(g=>f(g,"name",1))}]})}else if(M)b=`view:${M.name}`,i.push({t:"heading",level:1,text:l.title}),i.push({t:"view",name:M.name,...M.title?{title:M.title}:{},replaces:!0,...M.parts?{parts:M.parts}:{}});else{b="derived";let d=A.nodesOfKind(l.kind).filter(g=>H(m.tryDefinition(l.kind),g));i.push({t:"heading",level:1,text:l.title}),d.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${L(m,l.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:d.map(g=>f(g,"row",1))}]})}}let K=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,qe=a<_e?"phone":"wide",le=P.kind===null?ot(m,A):[],ce={...$?{masthead:$}:{},...le.length>0?{facts:le}:{},place:P,seat:K,width:a,variant:qe,drawnBy:b,parts:i,...V.length>0?{forms:V}:{},problems:c};return{ok:!0,description:{...ce,text:ae(ce)}}}function st(r,e,t){let o=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],n={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:t,variant:t<_e?"phone":"wide",drawnBy:"form",parts:o,forms:[He(r,e)],problems:[]};return{...n,text:ae(n)}}function ot(r,e){let t=Re(r,e,null),o=n=>Array.isArray(n)?n.map(o).join(", "):n===null?"nothing":typeof n=="boolean"?n?"yes":"no":typeof n=="object"?n.label:String(n);return[...Se(r)].map(([n,a])=>{let s=a.label??Z(n);return Object.hasOwn(t.values,n)?{name:n,label:s,value:o(t.values[n])}:{name:n,label:s,refused:t.refused[n]??"it could not be worked out"}})}function L(r,e,t){let o=r.tryDefinition(e);if(t===1)return o?.noun??e;let n=pe(r,e);return ue(n)}function ae(r){let e=[`${r.place.title} (${r.place.address}) \u2014 as ${r.seat}, ${r.width} wide (${r.variant}).`],t=r.masthead;t&&e.push(`Masthead: ${t.logo?`the logo ("${t.logo.alt}", ${t.logo.drawn==="image"?t.logo.src:"inline SVG"}), `:""}${t.name}${t.subtitle?` \u2014 ${t.subtitle}`:""}`);let o=(n,a)=>{for(let s of n)switch(s.t){case"heading":e.push(`${a}${"#".repeat(s.level)} ${s.text}`);break;case"text":e.push(`${a}${s.text}`);break;case"badge":e.push(`${a}[${s.text}]`);break;case"field":case"progress":e.push(`${a}${s.label}: ${s.text}`);break;case"figure":e.push(`${a}${s.text}${s.label?` \u2014 ${s.label}`:""}`);break;case"list":if(s.groups.length===0){s.empty&&e.push(`${a}(${s.empty})`);break}for(let p of s.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let m of p.items)e.push(`${a}${p.heading?" ":""}- ${m.title}`),o(m.parts,`${a}${p.heading?" ":" "}`)}s.as==="card"&&s.columns>1&&e.push(`${a}(cards, ${s.columns} across)`),s.more&&e.push(`${a}and ${s.more} more`);break;case"view":e.push(`${a}[the view "${s.title??s.name}"${s.replaces?", in place of the page":""}${s.flows===!0?", flowing with the page":s.flows===!1?", in a frame of its own":""}]`),s.parts&&o(s.parts,`${a} `);break}};o(r.parts,"");for(let n of r.forms??[])e.push(...Le(n));if(r.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let n of r.facts)e.push(`- ${n.label} (${n.name}): ${n.value??`not worked out \u2014 ${n.refused}`}`)}if(r.problems.length>0){e.push("Problems:");for(let n of r.problems)e.push(`- ${n.at}: ${n.says}`)}return e.join(`
1
+ import{a as Ge}from"./chunk.67U6M7OV.js";import{c as Me,d as Oe,f as Be}from"./chunk.GLWSVSQL.js";import{e as Pe,f as Ce,k as Re,l as re,n as Fe}from"./chunk.7VKSXGTX.js";import{f as Se}from"./chunk.PI44XMY2.js";import{d as _,e as je,k as ne}from"./chunk.UITT6JWW.js";import{b as De,e as Ae}from"./chunk.A5PDXNY6.js";import{C as Q,Ed as $e,Hc as he,Jc as ye,K as de,Lc as we,Ob as fe,Od as ke,Uc as U,Vc as be,Wd as xe,ba as ue,da as Z,fa as H,fc as te,ga as T,gc as ge,ha as me,ia as ee,ja as pe,ma as q,nd as ve,oa as z}from"./chunk.VSCIXAHN.js";function ze(r,e,t){let o=r.tryDefinition(e)?.fields.shape,n=Q(o?.[t]),a=!1,s=!1;for(;n&&(n.type==="optional"||n.type==="default"||n.type==="nullable"||n.type==="prefault");)(n.type==="optional"||n.type==="nullable")&&(a=!0),(n.type==="default"||n.type==="prefault")&&(s=!0),n=Q(n.innerType);if(n?.type!=="enum")return;let p=(n.entries?Object.values(n.entries):n.values??[]).filter(m=>typeof m=="string");return p.length>0?{values:p,empty:a&&!s}:void 0}function E(r,e,t){let o=ze(r,e,t);if(!o)return[];let n=r.tryDefinition(e),a=o.values.map(s=>({value:s,label:De(n,t,s)}));return o.empty&&a.push({value:null,label:`No ${q(n,t).toLowerCase()}`}),a}function X(r,e,t){let o=r[e];return typeof o=="string"&&t.some(n=>n.value===o)?o:null}function se(r,e,t,o,n=E(r.schema,t.kind,o)){return Ie(r,e,t,o,n).flatMap(a=>a.move?[a.move]:[])}function Ie(r,e,t,o,n=E(r.schema,t.kind,o)){let a=Ne(r.schema,r.allMutations(),t.kind,o,n),s=X(t,o,n),p=z(r.schema.tryDefinition(t.kind),t.kind),m=[];for(let{value:A,label:C,by:R,acts:F}of a){if(A===s)continue;let x,I,N;for(let c of F){let w=R==="step"?{[c.subject.arg]:t.id}:{[c.subject.arg]:t.id,[o]:A},S={name:c.name,args:w};if(!c.input.safeParse(w).success){N??=`${c.title??c.name} asks for more than the ${p} itself.`;continue}let k=r.permits(S,e);if(!k.ok){I??=k.refusal?.message??`You may not ${c.title??c.name}.`;continue}try{fe(r.graph,c,w)}catch(f){I??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:c.title??c.name};break}m.push(x?{to:A,label:C,move:x}:{to:A,label:C,why:I??N??`Nothing in this app moves a ${p} to ${C}.`})}return m}function Ne(r,e,t,o,n=E(r,t,o)){let a=Ve(r,e,t,o),s=Ke(r,e,t,o);return n.flatMap(p=>{if(p.value===null)return[];let m=a.filter(A=>A.sets?.[o]===p.value);return[{value:p.value,label:p.label,by:m.length>0?"step":s.length>0?"value":"none",acts:m.length>0?m:s}]})}function Ve(r,e,t,o){return e.filter(n=>n.subject!==void 0&&n.derived===void 0&&typeof n.sets?.[o]=="string"&&te(r,n).includes(t))}function Ke(r,e,t,o){let n=r.tryDefinition(t);return n?e.filter(a=>{if(!a.subject||!te(r,a).includes(t)||!ge(a,n).includes(o))return!1;let s=a.input.shape;return s!==void 0&&o in s}).sort((a,s)=>+(a.derived!==void 0)-+(s.derived!==void 0)):[]}var oe=(r,e)=>e&&r[e]!==void 0?String(r[e]):"";function Xe(r,e,t){let o=c=>r.tryDefinition(c)?e.nodesOfKind(c).filter(w=>H(r.tryDefinition(c),w)):[],n=o(t.rows),a=o(t.columns),s=new Set(n.map(c=>c.id)),p=new Set(a.map(c=>c.id)),m=e.allEdges(),A=[],C=t.link;if(typeof C=="string"){let c=f=>r.tryDefinition(f)?.edges?.[C]?.to,w=(c(t.columns)??[]).some(f=>f===t.rows||f==="*"),S=(c(t.rows)??[]).some(f=>f===t.columns||f==="*"),k=w||!S;for(let f of m){if(f.kind!==C)continue;let j=k?f.to:f.from,i=k?f.from:f.to;s.has(j)&&p.has(i)&&A.push({rowId:j,columnId:i,via:[]})}}else{let c=new Map(C.path.map(S=>[S,new Map]));for(let S of m){let k=c.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let j=k.get(S.to);j?j.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of C.path){let j=[],i=new Set;for(let $ of k)for(let b of c.get(f).get($.id)??[])i.has(`${$.id}|${b}`)||(i.add(`${$.id}|${b}`),j.push({id:b,via:[...$.via,$.id]}));k=j}for(let f of k){let j=`${f.id}|${S.id}`;!s.has(f.id)||w.has(j)||(w.add(j),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let R=t.groupOrder??[],F=c=>R.indexOf(c)===-1?R.length:R.indexOf(c),x=(c,w)=>w==="label"?T(r.tryDefinition(c.kind),c):c[w],I=U(n,t.sort,x).map(c=>{let w=c;return{node:c,label:T(r.tryDefinition(c.kind),c),group:oe(w,t.rowGroup),ref:oe(w,t.rowRef)}}).sort((c,w)=>F(c.group)-F(w.group)||(t.sort!==void 0?0:c.ref<w.ref?-1:c.ref>w.ref?1:0)),N=U(a,t.columnSort,x).map(c=>({node:c,label:T(r.tryDefinition(c.kind),c),group:oe(c,t.columnGroup)})).sort((c,w)=>c.group<w.group?-1:c.group>w.group?1:t.columnSort!==void 0?0:c.node.id<w.node.id?-1:c.node.id>w.node.id?1:0);return{rows:I,columns:N,cells:A}}function We(r,e,t){let{rows:o,columns:n,cells:a}=Xe(r,e,t),s=(i,$)=>ee(r,i,$),p=i=>ee(r,i,1).replace(/^1 /,""),m=i=>({id:i.id,kind:i.kind,title:T(r.tryDefinition(i.kind),i),parts:[]}),A=i=>{let $=e.getNode(i);if(!$)return null;let b=r.tryDefinition($.kind),P=T(b,$),V=_($,b,{limit:3,said:[P],glance:!0}).map(K=>K.alone.startsWith(K.label)?`${K.label.toLowerCase()}${K.alone.slice(K.label.length)}`:K.alone);return[P,...V].join(", ")},C=typeof t.link=="string"?[]:t.link.path.slice(0,-1).flatMap((i,$,b)=>{let P=ve(r,t.columns,b.slice(0,$+1));return P.ok?[...P.reached]:[]}),R=be(r,t,{rows:o.length,columns:n.length,cells:a.length});if(R)return[{t:"text",text:`${s(t.rows,o.length)} against ${s(t.columns,n.length)}.`},{t:"text",text:R}];let F=[{t:"text",text:`${s(t.rows,o.length)} against ${s(t.columns,n.length)}${C.length>0?`, through ${[...new Set(C)].map(i=>s(i,2).replace(/^2 /,"")).join(" and ")}`:""}${n.length>0?`: ${n.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(n.map(i=>[i.node.id,i.label])),I=new Map(n.map((i,$)=>[i.node.id,$])),N=new Map,c=new Map;for(let i of a){let $=N.get(i.rowId);$?$.push(i):N.set(i.rowId,[i]);let b=c.get(i.columnId);b?b.add(i.rowId):c.set(i.columnId,new Set([i.rowId]))}for(let i of o){let b=[...N.get(i.node.id)??[]].sort((P,V)=>I.get(P.columnId)-I.get(V.columnId)).map(P=>{let V=P.via.map(A).filter(K=>K!==null);return`${x.get(P.columnId)}${V.length>0?` (${V.join("; ")})`:""}`});F.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}F.push({t:"list",as:"name",columns:1,groups:n.map(i=>{let $=c.get(i.node.id)??new Set,b=o.filter(P=>$.has(P.node.id)).map(P=>m(P.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=o.filter(i=>!w.has(i.node.id)),f=n.filter(i=>!S.has(i.node.id)),j=t.rows===t.columns;return k.length>0&&F.push({t:"text",text:`${j?`${k.length} with none across`:`${s(t.rows,k.length)} with no ${p(t.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&F.push({t:"text",text:`${j?`${f.length} with none down`:`${s(t.columns,f.length)} on no ${p(t.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),F}function ie(r,e,t,o={}){let{app:n,blocks:a=t?n?.viewSpecs?.[t.kind]?.[o.slot??"page"]:n?.home}=o;if(!a?.length)return[];let s=o.firstHeading??(t||o.blocks?void 0:1),p=Fe(r,e,t,{...o,money:o.money??n?.brand,firstHeading:s});return t&&!p.node?[]:Ce(typeof a[0]?.t=="string"?a:Pe(a),p)}function Y(r,e,t){let o=!(e.optional||e.control==="boolean"),n=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(s=>Z(z(r.tryDefinition(s),s))).join(" or "):t(e.name).label,a={name:e.name,label:n,required:o};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(s=>t(e.name).option(s))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${Y(r,e.item,t).input}`};case"group":return{...a,input:"group",fields:e.fields.map(s=>Y(r,s,t))};case"variant":return{...a,input:"one of",choices:e.options.map(s=>Z(s.value))};default:return{...a,input:"answer"}}}function Te(r,e,t){let o=Oe(r,e,t),n=r.schema,a=Me(n,t).filter(p=>p.name!==t.subject?.arg&&!o.has(p.name)),s=me(t);return{act:t.name,title:s,submit:s,fields:a.map(p=>Y(n,p,m=>ne(n,t,m)))}}function He(r,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(t=>Y(r,t,o=>ne(r,e.act,o)))}}function Ee(r,e,t){return r.permittedMutations(e).filter(o=>!o.derived&&!o.subject&&(o.creates??[]).includes(t))}function Le(r,e=""){let t=[`${e}Form "${r.title}" (${r.visitor?`the visitor form ${r.visitor}, running `:""}act ${r.act}), button "${r.submit}":`],o=(n,a)=>{for(let s of n){let p=s.choices?`${s.input}: ${s.choices.join(", ")}`:s.kinds?`${s.input} (${s.kinds.join(" or ")})`:s.input,m=s.min!==void 0||s.max!==void 0?`, ${s.min??"\u2026"} to ${s.max??"\u2026"}`:"";t.push(`${a}- ${s.label}${s.required?" *":""} (${s.name}) \u2014 ${p}${m}`),s.fields&&o(s.fields,`${a} `)}};return o(r.fields,`${e} `),r.fields.length===0&&t.push(`${e} (asks nothing)`),t}function Ue(r,e){let t=r.viewSpecs??{};return e.filter(o=>o.cardinality==="one"&&o.replaces==="page"&&(t[o.attach]?.page?.length??0)>0).map(o=>{let n=L(r.schema,o.attach,1);return{at:`views.${o.attach}.page`,says:`The view "${o.name}" replaces ${Ye(n)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Ye=r=>`${/^[aeiou]/i.test(r)?"an":"a"} ${r}`,Je=240,Ze=10,Qe=1160,et=40,_e=640,tt=3,nt=r=>Math.max(1,Math.floor((Math.min(r,Qe)-et+Ze)/(Je+Ze)));function rt(r,e,t,o){let{app:n}=o,a=o.width??1440,s=o.today??r.today()??de(n.brand?.timeZone),p=r.seenBy(e),m=p.schema,A=p.graph,C=Ge(n,o.views?{views:o.views}:{}),R=typeof t=="string"?t.trim():t.slug,F=typeof t=="string"?C.find(l=>l.slug===R||l.title===R||l.address===R):C.find(l=>l.slug===t.slug&&l.kind===t.kind)??t,x=!F&&typeof t=="string"?A.getNode(R):void 0,I=!F&&!x?/^\/?forms\/(.+)$/.exec(R)?.[1]:void 0,N=I!==void 0?Be(n,I):void 0;if(N)return{ok:!0,description:st(m,N,a)};if(!F&&!x)return{ok:!1,error:`"${R}" is not a place this app has, nor a record this seat can see.`,places:[...C.map(l=>l.slug),...Object.keys(n.forms??{}).map(l=>`forms/${l}`)]};let c=[],w=n.viewSpecs??{},S=nt(a),k=(l,h)=>ie(p,null,l,{app:n,today:s,...h}),f=(l,h,M)=>{let d=m.tryDefinition(l.kind),g=T(d,l);if(h==="name")return{id:l.id,kind:l.kind,title:g,parts:[]};if(w[l.kind]?.[h]){let G=k(l,{slot:h}),[B,...O]=G,y=B?.t==="title"||h==="row"&&B?.t==="headline";return{id:l.id,kind:l.kind,title:y?B.text:g,parts:j(y?O:G,M,`views.${l.kind}.${h}`,` (${l.id})`,y?1:0)}}if(h==="row")return{id:l.id,kind:l.kind,title:g,parts:[]};let u=d?.computed?re(m,A,l):l,W=_(u,d,{limit:3,said:[g],glance:!0,locale:n.brand?.locale,timeZone:n.brand?.timeZone});return{id:l.id,kind:l.kind,title:g,parts:W.map(G=>({t:"text",text:G.alone}))}};function j(l,h,M,d="",g=0){let v=[];return l.forEach((u,W)=>{let G=`${M}.${W+g}`;switch("problem"in u&&u.problem&&c.push({at:`${G}${d}`,says:u.problem}),u.t){case"title":v.push({t:"heading",level:3,text:u.text});return;case"text":v.push({t:"text",text:u.markdown?Ae(u.text):u.runs?it(u.runs):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":v.push({t:"badge",text:u.text});return;case"field":case"image":v.push({t:"field",label:u.label,text:u.text});return;case"progress":v.push({t:"progress",label:u.label,text:u.text});return;case"group":v.push(...j(u.blocks,h,`${G}.group`,d));return;case"when":v.push(...j(u.blocks,h,`${G}.show`,d));return;case"divider":case"figure":return;case"headline":v.push({t:"heading",level:u.level,text:u.text});return;case"number":v.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){v.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&v.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let B=h+1,O=B>tt?"name":u.as,y=(u.groups??[{value:null,members:u.members}]).map(D=>({..."heading"in D&&D.heading?{heading:D.heading,count:(u.everyGroup?.find(J=>J.value===D.value)??D).members.length}:{},items:D.members.map(J=>f(J,O,B))}));v.push({t:"list",as:O,columns:O==="card"?S:1,groups:y,...u.more>0?{more:u.more}:{}});return}}}),v}let i=[],$,b,P,V=[];if(x){b="record";let l=m.tryDefinition(x.kind),h=T(l,x);P={slug:x.id,title:h,kind:x.kind,address:$e(m,x.kind,x.id)};let M=w[x.kind]?.page,d=o.views?.find(g=>g.attach===x.kind&&g.cardinality==="one");if(d&&i.push({t:"view",name:d.name,...d.title?{title:d.title}:{},...d.replaces==="page"?{replaces:!0}:{},...d.parts?{parts:d.parts}:{}}),d?.replaces==="page")b=`view:${d.name}`,c.push(...Ue(n,[d]));else{M&&i.push(...j(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let g=l?.computed?re(m,A,x):x;for(let v of je(l,_(g,l,{said:[h],locale:n.brand?.locale,timeZone:n.brand?.timeZone}))){v.title&&i.push({t:"heading",level:2,text:v.title});for(let u of v.fields)i.push({t:"field",label:u.label,text:u.value,...u.long?{long:!0}:{},...u.markdown?{markdown:!0}:{}})}}}else{let l=F;P={slug:l.slug,title:l.title,kind:l.kind,address:l.address};let h=l.lens?ke(n).drawn.find(d=>d.as===l.slug&&(l.kind===null||d.kinds.includes(l.kind))):void 0,M=l.kind!==null&&l.view===void 0&&!h?o.views?.find(d=>d.attach===l.kind&&d.cardinality==="many"&&d.replaces==="page"&&!d.hidden):void 0;if(l.kind!==null&&h?.create!==!1&&l.view===void 0&&!M&&(V=Ee(r,e,l.kind).map(d=>Te(r,e,d))),l.view!==void 0&&!h){let d=o.views?.find(g=>g.name===l.view);b=`view:${l.view}`,i.push({t:"view",name:l.view,title:d?.title??l.title,...typeof d?.flows=="boolean"?{flows:d.flows}:{},...d?.parts?{parts:d.parts}:{}})}else if(l.kind===null){let d=n.brand,g=d?.name??n.name,v=we(d)?.light,u=v&&ye(v)?v:void 0;if($={name:g,...d?.subtitle&&d.subtitleDrawn!==!1?{subtitle:d.subtitle}:{},...u?{logo:{alt:d?.logoAlt??g,...he(u)?{drawn:"inline SVG"}:{drawn:"image",src:u}}}:{}},n.home)b="blocks",i=j(k(null,{}),0,"views.home");else{b="derived";let W=r.kindsKeptFrom(e),G=new Set([...n.pages?.hide??[],...W,...r.modules.disabledKinds]),B=xe(m.kinds,n.pages?.order).filter(O=>!G.has(O));i.push({t:"heading",level:1,text:n.name??"Home"});for(let O of B){let y=A.nodesOfKind(O).filter(D=>H(m.tryDefinition(O),D)).length;y>0&&i.push({t:"text",text:`${y} ${L(m,O,y)}`})}}}else if(h?.lens==="blocks")b="lens:blocks",i=j(k(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){b="lens:columns";let d=h.options.bindings??{};for(let g of Object.keys(d)){let v=d[g]?.column;if(!v)continue;let u=E(m,g,v),W=U(A.nodesOfKind(g).filter(y=>H(m.tryDefinition(g),y)),h.options.sort,(y,D)=>D==="label"?T(m.tryDefinition(y.kind),y):y[D]);Object.keys(d).length>1&&i.push({t:"heading",level:2,text:L(m,g,2).replace(/^./,y=>y.toUpperCase())}),i.push({t:"text",text:`${W.length} ${L(m,g,W.length)} in columns by ${q(m.tryDefinition(g),v).toLowerCase()}.`});let G=u.map(y=>({column:y,items:W.filter(D=>X(D,v,u)===y.value).map(D=>f(D,"card",1))})).filter(({column:y,items:D})=>y.value!==null||D.length>0).map(({column:y,items:D})=>({heading:`${y.label} (${D.length})`,items:D}));i.push({t:"list",as:"card",columns:1,groups:G});let B=new Map;for(let y of W)for(let D of se(r,e,y,v,u))B.set(D.to,(B.get(D.to)??new Set).add(`"${D.title}"`));let O=u.filter(y=>y.value!==null&&B.has(y.value)).map(y=>`to ${y.label} by ${[...B.get(y.value)].join(" or ")}`);i.push({t:"text",text:O.length>0?`Moves: ${O.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")b="lens:coverage",i=We(m,A,h.options);else if(h){b=`lens:${h.lens}`;let d=h.kinds.flatMap(g=>A.nodesOfKind(g).filter(v=>H(m.tryDefinition(g),v)));i.push({t:"text",text:`A ${h.lens} of ${d.length} ${h.kinds.map(g=>L(m,g,d.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:d.map(g=>f(g,"name",1))}]})}else if(M)b=`view:${M.name}`,i.push({t:"heading",level:1,text:l.title}),i.push({t:"view",name:M.name,...M.title?{title:M.title}:{},replaces:!0,...M.parts?{parts:M.parts}:{}});else{b="derived";let d=A.nodesOfKind(l.kind).filter(g=>H(m.tryDefinition(l.kind),g));i.push({t:"heading",level:1,text:l.title}),d.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${L(m,l.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:d.map(g=>f(g,"row",1))}]})}}let K=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,qe=a<_e?"phone":"wide",le=P.kind===null?ot(m,A):[],ce={...$?{masthead:$}:{},...le.length>0?{facts:le}:{},place:P,seat:K,width:a,variant:qe,drawnBy:b,parts:i,...V.length>0?{forms:V}:{},problems:c};return{ok:!0,description:{...ce,text:ae(ce)}}}function st(r,e,t){let o=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],n={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:t,variant:t<_e?"phone":"wide",drawnBy:"form",parts:o,forms:[He(r,e)],problems:[]};return{...n,text:ae(n)}}function ot(r,e){let t=Re(r,e,null),o=n=>Array.isArray(n)?n.map(o).join(", "):n===null?"nothing":typeof n=="boolean"?n?"yes":"no":typeof n=="object"?n.label:String(n);return[...Se(r)].map(([n,a])=>{let s=a.label??Z(n);return Object.hasOwn(t.values,n)?{name:n,label:s,value:o(t.values[n])}:{name:n,label:s,refused:t.refused[n]??"it could not be worked out"}})}function L(r,e,t){let o=r.tryDefinition(e);if(t===1)return o?.noun??e;let n=pe(r,e);return ue(n)}function ae(r){let e=[`${r.place.title} (${r.place.address}) \u2014 as ${r.seat}, ${r.width} wide (${r.variant}).`],t=r.masthead;t&&e.push(`Masthead: ${t.logo?`the logo ("${t.logo.alt}", ${t.logo.drawn==="image"?t.logo.src:"inline SVG"}), `:""}${t.name}${t.subtitle?` \u2014 ${t.subtitle}`:""}`);let o=(n,a)=>{for(let s of n)switch(s.t){case"heading":e.push(`${a}${"#".repeat(s.level)} ${s.text}`);break;case"text":e.push(`${a}${s.text}`);break;case"badge":e.push(`${a}[${s.text}]`);break;case"field":case"progress":e.push(`${a}${s.label}: ${s.text}`);break;case"figure":e.push(`${a}${s.text}${s.label?` \u2014 ${s.label}`:""}`);break;case"list":if(s.groups.length===0){s.empty&&e.push(`${a}(${s.empty})`);break}for(let p of s.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let m of p.items)e.push(`${a}${p.heading?" ":""}- ${m.title}`),o(m.parts,`${a}${p.heading?" ":" "}`)}s.as==="card"&&s.columns>1&&e.push(`${a}(cards, ${s.columns} across)`),s.more&&e.push(`${a}and ${s.more} more`);break;case"view":e.push(`${a}[the view "${s.title??s.name}"${s.replaces?", in place of the page":""}${s.flows===!0?", flowing with the page":s.flows===!1?", in a frame of its own":""}]`),s.parts&&o(s.parts,`${a} `);break}};o(r.parts,"");for(let n of r.forms??[])e.push(...Le(n));if(r.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let n of r.facts)e.push(`- ${n.label} (${n.name}): ${n.value??`not worked out \u2014 ${n.refused}`}`)}if(r.problems.length>0){e.push("Problems:");for(let n of r.problems)e.push(`- ${n.at}: ${n.says}`)}return e.join(`
2
2
  `)}function it(r){return r.map((e,t)=>(t===0?"":e.field===void 0&&r[t-1].field===void 0?" \xB7 ":" ")+e.text).join("")}export{E as a,X as b,se as c,Ie as d,Ne as e,Ve as f,Ke as g,ie as h,Ue as i,rt as j,ae as k};
@@ -0,0 +1 @@
1
+ import{l as O}from"./chunk.OJGHDWI6.js";import{j as C}from"./chunk.UITT6JWW.js";import{G as b,La as K,T as M,ba as w,c as W,ca as I,da as H,x as G}from"./chunk.4MP72LPR.js";import{C as D,Gb as N,Pb as _,Xb as L,Xc as V,Yc as B,gc as j,rb as F}from"./chunk.VSCIXAHN.js";import{b as m}from"./chunk.AJZBJBMO.js";function U(n,e){let t=n.graph.getNode(e);if(!t)return[];let i=t.kind,a=n.schema.tryDefinition(i);if(!a)return[];let c=n.seenFor,u=c?N.keptFrom?.(n,c)?.(t):void 0,o=new Map;for(let r of n.allMutations()){let s=r.subject;if(!s||!(s.kinds==="*"||s.kinds.includes(i)))continue;let l=r.input.shape??{};for(let d of j(r,a)){if(u?.(d)||!_(r,n.schema,n.graph,e,d,c&&F(c).id))continue;let x=d in l,k=[];for(let h of Object.keys(l)){if(h===s.arg||h===d||ee(l[h]))continue;let v=L(r.input).find(S=>S.name===h);k.push({name:h,...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(Z=>Z.id))}:{},shape:C(r.input,h)})}let X={field:d,mutation:r.name,title:r.title??r.name,shape:x?C(r.input,d):{type:"unknown"},takesValue:x,alternatives:[],open:k,clearable:x&&(r.clearable?.includes(d)??!1),call:h=>({name:r.name,args:x?{[s.arg]:e,[d]:h}:{[s.arg]:e}})};o.set(d,[...o.get(d)??[],X])}}return[...o.values()].map(r=>{let s=[...r.filter(d=>d.takesValue),...r.filter(d=>!d.takesValue)],[f,...l]=s;return{...f,alternatives:l}})}function ee(n){let e=D(n)?.type;return e==="optional"||e==="default"||e==="nullable"}var R=m(b(),1);function Se(n){let{store:e,principal:t}=w(),i=H(),a=(0,R.useMemo)(()=>n===null?[]:U(e,n),[e,n,i]),c=(0,R.useCallback)((u,o,r={})=>{let s=u.call(o);e.apply({name:s.name,args:{...s.args,...r}},{author:t})},[e,t]);return{fields:a,commit:c}}var $=m(b(),1);function Xe(){let{brand:n}=w(),e=n?.kit;return(0,$.useMemo)(()=>V(e),[e])}function Ze(n,e){let t=B(n,e),i={...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:O(e,{[e]:i})}}var q=m(b(),1);var g=m(M(),1);function ne(n){let e=n?.hint;return typeof e=="string"&&e.length>0?e:void 0}function te(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 z=class extends q.Component{static contextType=K;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=ne(e);return(0,g.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,g.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.kind}),(0,g.jsx)("span",{children:te(e)}),t?(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:t}):null]})}};var y=m(b(),1);var Q=m(M(),1),A=(0,y.createContext)([]);function on({sections:n,children:e}){let t=(0,y.useContext)(A),i=(0,y.useMemo)(()=>[...t,...n.filter(a=>!t.includes(a))],[t,n]);return(0,Q.jsx)(A.Provider,{value:i,children:e})}function Y(){let n=(0,y.useContext)(A),e=I()?.menuSections;return(0,y.useMemo)(()=>e?[...n,...e.filter(t=>!n.includes(t))]:n,[n,e])}function an(){let n=Y();return(0,y.useCallback)(e=>{for(let t of n)try{t(e)?.prepare?.()}catch{}},[n])}function sn(n){let e=Y();if(n===null||e.length===0)return{start:[],end:[]};let t=e.flatMap(i=>{try{let a=i(n);return a&&((a.items?.length??0)>0||a.render)?[a]:[]}catch{return[]}});return{start:t.filter(i=>i.at==="start"),end:t.filter(i=>i.at!=="start")}}var re=m(b(),1);function un(){return w().activity}var P=(n,e)=>n.length*e*.58;var oe=156,ie=2,E=oe-18,ae=7.1,se=16;function ce(n,e){let t=0,i=E;for(let a of n.split(" ")){let c=e(a),u=i+e(" ")+c;if(u<=E)i=u;else{let o=Math.ceil(c/E)||1;t+=o,i=c-(o-1)*E}}return t}var de=16.25,J=27,ue=(n,e)=>{let t=Math.ceil(n.length*ae/E);return e?Math.max(J,Math.ceil(Math.max(t,ce(n,e))*de)+6):Math.max(J,t*se+6)};function fn(n,e,t){return n.length===0?0:10+n.reduce((i,a)=>i+ue(a,t),0)+(n.length-1)*ie}var le=27,pe=8,mn=4,fe=64,yn=n=>Math.max(1,Math.min(pe,n)),hn=n=>n*le+fe;var p=m(b(),1);function wn(n,{units:e,target:t=0,legibleAt:i=260}){let[a,c]=(0,p.useState)(e);(0,p.useEffect)(()=>{let o=n.current;if(o===null||typeof ResizeObserver>"u")return;let r=new ResizeObserver(([s])=>{let f=s?.contentRect.width??0;f>0&&c(f)});return r.observe(o),()=>r.disconnect()},[n]);let u=a/e;return{scale:u,width:a,touchable:u*t>=24,legible:a>=i}}function vn(n="--graview-font-body",e="sans-serif"){let t=(0,p.useRef)(void 0),i=(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?P:(c,u)=>{a.font=`${u}px ${i}`;let o=a.measureText(c).width;return o>0?o:P(c,u)}},[i])}var Sn=(0,p.createContext)(void 0);var T=3;function me(n){let e=W(n),t=e.focusId;if(!t)return null;if(e.within?.view){let[a]=G(t);if(a)return{at:`screen:${a}`,audience:!0}}return{at:t,audience:!1}}var ye=102,he=32;function Mn(n,e,t){let i=[],a=new Map,c=new Map,u=0;for(let o of n){let r=me(o.stop),s=r?e(r.at):null;if(!r||!s){o.name&&i.push({kind:"edge",presence:o,point:{x:t-8,y:ye+u++*he}});continue}if(!o.name){let k=c.get(r.at);c.set(r.at,{n:(k?.n??0)+1,box:s});continue}let f=a.get(r.at)??[];if(f.push(o),a.set(r.at,f),f.length>T)continue;let l=s,d=f.length-1,x=r.audience?{x:l.x+l.width*.5+(d-1)*26,y:l.y+Math.min(l.height,24)}:{x:l.x+l.width*.5-26-d*26,y:l.y+l.height-4};i.push({kind:"person",presence:o,point:x,at:r.at,index:d,of:f.length,audience:r.audience})}for(let[o,r]of a){if(r.length<=T)continue;let s=e(o);s&&i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+2*26+18,y:s.y+s.height-4},n:r.length-T})}for(let[o,{n:r,box:s}]of c)i.push({kind:"count",at:o,point:{x:s.x+s.width*.5+40,y:s.y+s.height-4},n:r});for(let o of n)if(o.name){if(o.robot?.at&&o.robot.mode!=="docked"){let r=e(o.robot.at);r&&i.push({kind:"robot",presence:o,point:{x:r.x+r.width/2+22,y:r.y+r.height-4},mode:o.robot.mode})}if(o.over){let r=e(o.over);r&&i.push({kind:"over",presence:o,box:r})}}return i}export{un as a,P as b,oe as c,ie as d,J as e,fn as f,le as g,mn as h,fe as i,yn as j,hn as k,wn as l,vn as m,Se as n,Xe as o,Ze as p,Mn as q,z as r,on as s,an as t,sn as u};
@@ -1,4 +1,4 @@
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 jt,b as qt,c as Ft,d as Gn}from"./chunk.BTVBZ6KE.js";import{a as Gt}from"./chunk.3OYGXYQY.js";import{a as Hn,b as Dt,c as Vn,d as zt,e as Bt,f as It}from"./chunk.UAP5M3CD.js";import{c as _t,g as Kt,h as Ut,i as Yt}from"./chunk.GCBZ3WE2.js";import{e as Lt}from"./chunk.KFQSYCY3.js";import{m as Nt}from"./chunk.WQOI6BLM.js";import{a as Pt,b as Tt}from"./chunk.LCPGZK7G.js";import{f as Et,h as Mt}from"./chunk.NKC3JILT.js";import{e as At}from"./chunk.HEWVPXRE.js";import{a as Wt,b as tn,c as Ht,d as Vt}from"./chunk.7SQAKSJD.js";import{b as Ct,c as pe,d as ke,e as ze}from"./chunk.WNSC3RWD.js";import{e as $t,l as Ot}from"./chunk.LDAYDCUO.js";import{l as Rt,m as Wn}from"./chunk.ELERUERU.js";import{f as Bn,g as In}from"./chunk.3YZHZGTM.js";import{d as kt}from"./chunk.EQTSV7BK.js";import{h as Fe,j as St}from"./chunk.YD3TKV6P.js";import{G as Ee,Na as xt,Oa as nn,T as te,W as wt,ba as oe,ca as vt,da as bt,l as en}from"./chunk.HT2BEOEV.js";import{$ as Xe,Hd as yt,Nc as Ze,Oc as ht,Ra as ut,Uc as Te,Va as gt,W as cn,Wa as mt,X as st,Xa as pt,Y as lt,Z as Tn,_ as dt,bc as ft,fa as Ve,ga as xe,ia as qe,ja as un,jd as zn,ka as gn,ma as Nn,na as ct,oa as mn,uc as be,wb as Dn}from"./chunk.7BBGRTXM.js";import{b as F}from"./chunk.AJZBJBMO.js";var Kr=F(Ee(),1);var jn=F(te(),1);function Be(e,t,n){let r=e.nodes?.length??0;if(e.total===void 0||e.total<=r)return n;let a=e.nodes?.[0]?.kind,i=a?un(t,a).toLowerCase():"more";return(0,jn.jsxs)("div",{style:{display:"grid",gridTemplateRows:"minmax(0, 1fr) auto",height:"100%",minHeight:0},children:[n,(0,jn.jsxs)("p",{"data-testid":"lens-more",style:{margin:"4px 0 0",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["+",e.total-r," more ",i]})]})}var tr=F(Ee(),1);var rn=F(Ee(),1);var Qt=e=>`place:${e}`;function Jt(e,t){(0,rn.useEffect)(()=>{if(e===void 0)return;let n=globalThis[Symbol.for("graview.shown-lists")]??=new Map;return n.set(e,()=>t),()=>void n.delete(e)})}var Xt=e=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(t=>t.saveShownList(e.read()));function Zt(e,t,n){let r={off:e,about:t,read:n,menu:(a,i,s)=>[...e?[]:[{id:"export-csv",label:"Export CSV",run:()=>void Xt(r)}],...a&&i?[{id:e?"export-on":"export-off",label:e?"Turn on export":"Turn off export",run:()=>void (__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(m=>m.switchExport(r,i,e,s))}]:[]]};return r}function er({said:e}){return(0,rn.createElement)("button",{type:"button",className:"graview-arrange-open","data-testid":"arrange-export","aria-label":"Export CSV",title:"Export CSV",onClick:()=>void Xt(e)},(0,rn.createElement)("span",{"aria-hidden":"true"},"\u2193"),"CSV")}var nr=F(Ee(),1),pn=(0,nr.createContext)(null);var qn=F(te(),1),Yr=(e,t)=>{if(e===!1||t===!1)return!1;let n=e===void 0||e===!0?{}:e,r=t===void 0||t===!0?{}:t;return{sort:n.sort!==!1&&r.sort!==!1,filter:n.filter!==!1&&r.filter!==!1,group:n.group!==!1&&r.group!==!1}},Qr=["sort","filter","group","q","archived"];function Ne(e,t={}){let{store:n,onExport:r}=oe(),a=(0,tr.useContext)(pn),{view:i,go:s}=nn(),c=Qr.some(M=>i.within?.[M]!==void 0)?Pt(i):t.arrangedBy??{},b=e.nodes??[],d=t.kind??b[0]?.kind??e.node?.kind,y=c.archived!==void 0&&c.archived!==!1&&d!==void 0&&!t.subject?n.graph.nodesOfKind(d,{archived:c.archived}):b,p=t.subject??(t.only?y.filter(t.only):y),o=t.subject?[]:t.only?y.filter(M=>!t.only(M)):[],l=t.kind??p[0]?.kind,k=Yr(t.allow,t.lensAllows),u=l?At(n.schema,String(l)):void 0,x=u?Et(c,u).arrangement:{},R=Mt(p,k===!1?{}:x,{schema:n.schema,graph:n.graph,flagged:new Set(e.flagged??[]),...t.search?{searchIn:t.search}:{}}),L=e.retired!==void 0&&e.retired>0&&(b[0]?.kind??l)===l?e.retired:0,T=e.fidelity==="full"&&e.budget===void 0,w=l!==void 0&&T&&t.exportable!==!1,O=Zt(a?.export===!1,{lens:a?.title??"",...a?.on!==void 0?{on:a.on}:{}},()=>({title:a?.title??gn(n.schema,String(l)),schema:n.schema,graph:n.graph,kind:String(l),groups:R.groups,grouped:R.grouped,onExport:r,words:{labelOf:xe,readableFields:kt,withComputed:Ot}}));Jt(a&&w?Qt(a.as):void 0,O);let g=l&&k!==!1&&T&&(p.length>1||L>0)?(0,qn.jsx)(Nt,{schema:n.schema,graph:n.graph,kind:String(l),arrangement:x,allow:k,query:t.query!==!1,...t.filters?{filters:t.filters,chips:{nodes:p,flagged:new Set(e.flagged??[])}}:{},onChange:M=>s(Tt(i,M)),kept:{shown:R.nodes.length,of:p.length},...L>0?{past:{count:L,widen:()=>s(Lt(i,!0))}}:{},...w&&!O.off?{end:(0,qn.jsx)(er,{said:O})}:{}}):null;return{nodes:[...o,...R.nodes],arranged:R,arrangement:x,bar:g}}function _e(e,t,n){let r=new Set((n??[]).map(i=>i.kind)),a=new Set((n??[]).map(i=>i.id));return e.allNodes().filter(i=>r.has(i.kind)?a.has(i.id):Ve(t.tryDefinition(i.kind),i))}var Ie=F(Ee(),1);var j=F(te(),1),Jr=["slots","x","y","fill"],fn=class extends Error{constructor(n,r){super(`${n}
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 jt,b as qt,c as Ft,d as Gn}from"./chunk.MVWC3VR3.js";import{a as Gt}from"./chunk.CC5BJH5A.js";import{a as Hn,b as Dt,c as Vn,d as zt,e as Bt,f as It}from"./chunk.QI4SLPQ4.js";import{c as _t,g as Kt,h as Ut,i as Yt}from"./chunk.CFKZXLXS.js";import{e as Lt}from"./chunk.FRYBMS3W.js";import{m as Nt}from"./chunk.LQVAABPS.js";import{a as Pt,b as Tt}from"./chunk.NGTRL5U4.js";import{f as Et,h as Mt}from"./chunk.3MOJF7BA.js";import{e as At}from"./chunk.LZIBQ3VX.js";import{a as Wt,b as tn,c as Ht,d as Vt}from"./chunk.IHBUBZQT.js";import{b as Ct,c as pe,d as ke,e as ze}from"./chunk.3XGA65Y3.js";import{e as $t,l as Ot}from"./chunk.7VKSXGTX.js";import{l as Rt,m as Wn}from"./chunk.IOK4GVJC.js";import{f as Bn,g as In}from"./chunk.MSWWWLEA.js";import{d as kt}from"./chunk.UITT6JWW.js";import{h as Fe,j as St}from"./chunk.WC3DENU4.js";import{G as Ee,Na as xt,Oa as nn,T as te,W as wt,ba as oe,ca as vt,da as bt,l as en}from"./chunk.4MP72LPR.js";import{$ as Xe,$c as Te,Ac as be,Ld as yt,Ra as ut,Uc as Ze,Va as gt,Vc as ht,W as cn,Wa as mt,X as st,Xa as pt,Y as lt,Z as Tn,_ as dt,fa as Ve,ga as xe,hc as ft,ia as qe,ja as un,ka as gn,ma as Nn,na as ct,nd as zn,oa as mn,ub as Dn}from"./chunk.VSCIXAHN.js";import{b as F}from"./chunk.AJZBJBMO.js";var Kr=F(Ee(),1);var jn=F(te(),1);function Be(e,t,n){let r=e.nodes?.length??0;if(e.total===void 0||e.total<=r)return n;let a=e.nodes?.[0]?.kind,i=a?un(t,a).toLowerCase():"more";return(0,jn.jsxs)("div",{style:{display:"grid",gridTemplateRows:"minmax(0, 1fr) auto",height:"100%",minHeight:0},children:[n,(0,jn.jsxs)("p",{"data-testid":"lens-more",style:{margin:"4px 0 0",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["+",e.total-r," more ",i]})]})}var tr=F(Ee(),1);var rn=F(Ee(),1);var Qt=e=>`place:${e}`;function Jt(e,t){(0,rn.useEffect)(()=>{if(e===void 0)return;let n=globalThis[Symbol.for("graview.shown-lists")]??=new Map;return n.set(e,()=>t),()=>void n.delete(e)})}var Xt=e=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(t=>t.saveShownList(e.read()));function Zt(e,t,n){let r={off:e,about:t,read:n,menu:(a,i,s)=>[...e?[]:[{id:"export-csv",label:"Export CSV",run:()=>void Xt(r)}],...a&&i?[{id:e?"export-on":"export-off",label:e?"Turn on export":"Turn off export",run:()=>void (__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(m=>m.switchExport(r,i,e,s))}]:[]]};return r}function er({said:e}){return(0,rn.createElement)("button",{type:"button",className:"graview-arrange-open","data-testid":"arrange-export","aria-label":"Export CSV",title:"Export CSV",onClick:()=>void Xt(e)},(0,rn.createElement)("span",{"aria-hidden":"true"},"\u2193"),"CSV")}var nr=F(Ee(),1),pn=(0,nr.createContext)(null);var qn=F(te(),1),Yr=(e,t)=>{if(e===!1||t===!1)return!1;let n=e===void 0||e===!0?{}:e,r=t===void 0||t===!0?{}:t;return{sort:n.sort!==!1&&r.sort!==!1,filter:n.filter!==!1&&r.filter!==!1,group:n.group!==!1&&r.group!==!1}},Qr=["sort","filter","group","q","archived"];function Ne(e,t={}){let{store:n,onExport:r}=oe(),a=(0,tr.useContext)(pn),{view:i,go:s}=nn(),c=Qr.some(M=>i.within?.[M]!==void 0)?Pt(i):t.arrangedBy??{},b=e.nodes??[],d=t.kind??b[0]?.kind??e.node?.kind,y=c.archived!==void 0&&c.archived!==!1&&d!==void 0&&!t.subject?n.graph.nodesOfKind(d,{archived:c.archived}):b,p=t.subject??(t.only?y.filter(t.only):y),o=t.subject?[]:t.only?y.filter(M=>!t.only(M)):[],l=t.kind??p[0]?.kind,k=Yr(t.allow,t.lensAllows),u=l?At(n.schema,String(l)):void 0,x=u?Et(c,u).arrangement:{},R=Mt(p,k===!1?{}:x,{schema:n.schema,graph:n.graph,flagged:new Set(e.flagged??[]),...t.search?{searchIn:t.search}:{}}),L=e.retired!==void 0&&e.retired>0&&(b[0]?.kind??l)===l?e.retired:0,T=e.fidelity==="full"&&e.budget===void 0,w=l!==void 0&&T&&t.exportable!==!1,O=Zt(a?.export===!1,{lens:a?.title??"",...a?.on!==void 0?{on:a.on}:{}},()=>({title:a?.title??gn(n.schema,String(l)),schema:n.schema,graph:n.graph,kind:String(l),groups:R.groups,grouped:R.grouped,onExport:r,words:{labelOf:xe,readableFields:kt,withComputed:Ot}}));Jt(a&&w?Qt(a.as):void 0,O);let g=l&&k!==!1&&T&&(p.length>1||L>0)?(0,qn.jsx)(Nt,{schema:n.schema,graph:n.graph,kind:String(l),arrangement:x,allow:k,query:t.query!==!1,...t.filters?{filters:t.filters,chips:{nodes:p,flagged:new Set(e.flagged??[])}}:{},onChange:M=>s(Tt(i,M)),kept:{shown:R.nodes.length,of:p.length},...L>0?{past:{count:L,widen:()=>s(Lt(i,!0))}}:{},...w&&!O.off?{end:(0,qn.jsx)(er,{said:O})}:{}}):null;return{nodes:[...o,...R.nodes],arranged:R,arrangement:x,bar:g}}function _e(e,t,n){let r=new Set((n??[]).map(i=>i.kind)),a=new Set((n??[]).map(i=>i.id));return e.allNodes().filter(i=>r.has(i.kind)?a.has(i.id):Ve(t.tryDefinition(i.kind),i))}var Ie=F(Ee(),1);var j=F(te(),1),Jr=["slots","x","y","fill"],fn=class extends Error{constructor(n,r){super(`${n}
2
2
  ${r}`);this.hint=r;this.name="BoardBindingError"}},rr=e=>Math.max(0,Math.min(1,e));function Fn(e,t,n,r){let a=l=>l,i=l=>r?xe(r.tryDefinition(l.kind),l):String(a(l).label??l.id);if(r&&r.tryDefinition(n.slots)===void 0)throw new fn(`No kind is declared for "${n.slots}".`,'Check the lens bindings: { slots: "<kind>", x: "<field>", y: "<field>", fill: "<edge kind>" }');let s=e.filter(l=>l.kind===n.slots);if(!r&&s.length===0)throw new fn(`Nothing to arrange: no "${n.slots}" nodes.`,'Check the lens bindings: { slots: "<kind>", x: "<field>", y: "<field>", fill: "<edge kind>" }');let m=t.filter(l=>l.kind===n.fill),c=new Map(e.map(l=>[l.id,l])),b=new Map(e.map((l,k)=>[l.id,k])),d=s.map(l=>{let k=a(l),u=n.fillFrom==="occupant",x=m.filter(R=>(u?R.to:R.from)===l.id).map(R=>c.get(u?R.from:R.to)).filter(R=>R!==void 0).sort((R,L)=>(b.get(R.id)??0)-(b.get(L.id)??0)).map(R=>({id:R.id,label:i(R)}));return{id:l.id,code:String(k[n.slotCode??""]??"").trim()||i(l),label:i(l),x:rr(Number(k[n.x]??.5)),y:rr(Number(k[n.y]??.5)),occupants:x}}).sort((l,k)=>l.y-k.y||l.x-k.x),y=new Set(d.flatMap(l=>l.occupants.map(k=>k.id))),p=new Set([...y].map(l=>c.get(l)?.kind).filter(l=>l!==void 0)),o=e.filter(l=>p.has(l.kind)&&!y.has(l.id)).map(l=>({id:l.id,label:i(l)})).sort((l,k)=>l.label<k.label?-1:l.label>k.label?1:0);return{slots:d,empty:d.filter(l=>l.occupants.length===0).map(l=>l.id),spare:o}}function Xr({nodes:e,occupants:t,label:n,fidelity:r,mode:a,options:i,schema:s,implicated:m=[],flagged:c=[]}){let{store:b}=oe(),d=_e(b.graph,b.schema,e),y=t?[...d.filter(f=>f.kind===i.slots),...t.map(f=>b.graph.getNode(f)).filter(f=>f!==void 0)]:d,p=Fn(y,b.graph.allEdges(),i,s),o=new Set(m),l=new Set(c),k=xt(),u=new Map;for(let f of k)for(let v of f.nodeIds)u.set(v,[...u.get(v)??[],f.message]);let x=f=>f?u.get(f)??[]:[];if(r==="glyph")return(0,j.jsx)(ke,{label:`${n??"Board"} \xB7 ${p.slots.length-p.empty.length}/${p.slots.length}`,hue:be("board")});if(r==="summary"){let f=p.slots.filter(v=>p.empty.includes(v.id));return(0,j.jsx)(pe,{title:n??"Board",meta:`${p.slots.length-p.empty.length}/${p.slots.length}`,tone:f.length>0?"warning":"muted",fit:!0,children:f.length>0?(0,j.jsx)(ze,{pick:!0,max:5,items:f.map(v=>({id:v.id,label:v.code}))}):(0,j.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"Every slot filled."})})}let R=i.aspect??.68,L=(0,Ie.useRef)(null),[T,w]=(0,Ie.useState)(!1),[O,g]=(0,Ie.useState)(null),M=160,[N,G]=(0,Ie.useState)(!1);(0,Ie.useEffect)(()=>{let f=L.current;if(!f||typeof ResizeObserver>"u")return;let v=new ResizeObserver(S=>{let A=S[0]?.contentRect;if(!A)return;let h=A.height<M;G(h),w(!h&&R<1&&A.width/A.height>1.3),g(h?null:A.height)});return v.observe(f),()=>v.disconnect()},[R]);let C=(f,v)=>T?{x:1-v,y:f}:{x:f,y:v},q=(()=>{let f=new Map,v=(S,A,h)=>{let $=f.get(h)??{ids:[],codes:[]};$.ids.includes(S)||($.ids.push(S),$.codes.includes(A)||$.codes.push(A)),f.set(h,$)};for(let S of p.slots){for(let A of x(S.id))v(S.id,S.code,A);for(let A of S.occupants)for(let h of x(A.id))v(A.id,A.label,h)}return[...f.entries()].map(([S,A])=>({id:A.ids[0],code:A.codes.join(", "),text:S}))})(),W=a==="fullscreen",ce=q.length===0?null:(0,j.jsxs)("ul",{"data-graview-primitive":"board-key",style:{margin:"2px 0 0",padding:0,listStyle:"none",display:"grid",gap:3,flex:"0 0 auto"},children:[q.slice(0,W?6:2).map(f=>(0,j.jsxs)("li",{"data-graview-pick":f.id,"data-graview-emphasis":o.size===0?"plain":o.has(f.id)?"lit":"dimmed",title:f.text,style:{display:W?"grid":"flex",gap:W?1:7,alignItems:W?"start":"baseline",fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",minHeight:24,width:"fit-content",maxWidth:"100%",padding:W?"2px 0":"3px 6px",marginLeft:W?0:-6,borderRadius:7,cursor:"pointer"},children:[(0,j.jsxs)("span",{style:{flex:"0 0 auto",fontWeight:600,color:"var(--graview-warn)",letterSpacing:"0.02em"},children:["\u26A0 ",f.code]}),(0,j.jsx)("span",{style:{minWidth:0,...W?{}:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},children:f.text})]},f.id)),q.length>(W?6:2)?(0,j.jsxs)("li",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:["+",q.length-(W?6:2)," more"]}):null]}),ae=i.arrange==="shelf",ne=p.slots.every(f=>f.code.length<=3&&!/\s/.test(f.code)),D=(f,v)=>{let S=f.occupants.length===0,A=o.size>0&&!o.has(f.id)&&!f.occupants.some(J=>o.has(J.id)),h=l.has(f.id),$=f.occupants.some(J=>l.has(J.id)),P=h,Z=[...x(f.id),...f.occupants.flatMap(J=>x(J.id))],H=f.occupants.length===1?f.occupants[0]:null,U=i.pickTarget==="slot"?f.id:H?H.id:f.id,Y=J=>H?{}:{"data-graview-pick":J.id,"data-graview-emphasis":o.size===0?"plain":A?"dimmed":"lit"},le=J=>l.has(J.id)?"var(--graview-warn)":"var(--graview-ink-muted)",ge=i.emptyLabel??"empty";return(0,j.jsxs)("div",{"data-graview-pick":U,"data-graview-slot":f.id,"data-graview-mark":ne?"disc":"token","data-graview-flagged":h&&$?"both":h?"slot":$?"occupant":void 0,"data-graview-emphasis":o.size===0?"plain":A?"dimmed":"lit",title:[S?`${f.label} \u2014 nobody in it`:`${f.occupants.map(J=>J.label).join(", ")} at ${f.label}`,...Z].join(`
3
3
  `),style:{...v,display:"grid",justifyItems:ne?"center":"start",gap:3,opacity:A?.5:1,transition:"opacity 160ms ease"},children:[ne?(0,j.jsxs)("span",{style:{position:"relative",width:34,height:34,borderRadius:999,display:"grid",placeItems:"center",fontSize:"0.75rem",letterSpacing:"0.02em",border:S?"1.5px dashed var(--graview-warn)":`1px solid ${P?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:S?"transparent":P?"var(--graview-panel-warning)":"var(--graview-panel)",color:S||P?"var(--graview-warn)":"var(--graview-ink)",boxShadow:S?void 0:"var(--graview-lift-low)"},children:[f.code,h&&!S?(0,j.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:-3,right:-3,fontSize:"0.6875rem",lineHeight:1,color:"var(--graview-warn)"},children:"\u26A0"}):null]}):(0,j.jsxs)("span",{style:{display:"grid",gap:1,minWidth:0,maxWidth:180,padding:"5px 10px 6px",borderRadius:8,border:S?"1.5px dashed var(--graview-warn)":`1px solid ${P?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:S?"transparent":P?"var(--graview-panel-warning)":"var(--graview-panel)",boxShadow:S?void 0:"var(--graview-lift-low)"},children:[(0,j.jsxs)("span",{style:{fontSize:"0.8125rem",fontWeight:550,lineHeight:1.25,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:S||P?"var(--graview-warn)":"var(--graview-ink)"},children:[f.code,h&&!S?" \u26A0":null]}),S?(0,j.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.3,color:"var(--graview-warn)"},children:ge}):(0,j.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:"0 8px",fontSize:"0.75rem",lineHeight:1.3},children:f.occupants.map(J=>(0,j.jsxs)("span",{...Y(J),style:{whiteSpace:"nowrap",color:le(J)},children:[J.label,l.has(J.id)?" \u26A0":""]},J.id))})]}),ne?S?(0,j.jsx)("span",{style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:"var(--graview-warn)"},children:ge}):f.occupants.map(J=>(0,j.jsxs)("span",{...Y(J),style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:le(J)},children:[J.label,l.has(J.id)?" \u26A0":""]},J.id)):null]},f.id)},Q=i.zones??[],ue=Q.map((f,v)=>({label:f.label,slots:p.slots.filter(S=>S.y>=f.from&&(S.y<f.to||v===Q.length-1&&S.y<=f.to))})),I=new Set(ue.flatMap(f=>f.slots.map(v=>v.id))),E=p.slots.filter(f=>!I.has(f.id));(E.length>0||ue.length===0)&&ue.push({label:"",slots:E});let K={boxSizing:"border-box",borderRadius:12,border:"1px solid var(--graview-edge)",background:"linear-gradient(var(--graview-panel-muted), var(--graview-panel-muted)), var(--graview-panel)",overflow:"hidden"};return(0,j.jsxs)(pe,{title:n??"Board",meta:p.slots.length===0?void 0:p.empty.length===0?`all ${p.slots.length} filled`:`${p.empty.length} unfilled`,...W?{style:{flex:"1 1 auto",minHeight:0,height:"100%"}}:{},children:[(0,j.jsxs)("div",{ref:L,style:{display:"flex",gap:28,alignItems:"stretch",justifyContent:"center",flex:"1 1 auto",minHeight:0},children:[W&&ce?(0,j.jsxs)("div",{style:{width:260,flex:"0 0 auto",alignSelf:"center",display:"grid",gap:8},children:[(0,j.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"What is marked"}),ce]}):null,ae?(0,j.jsx)("div",{"data-graview-primitive":"board","data-graview-arrange":"shelf",style:{...K,overflow:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"stretch",display:"grid",alignContent:"start"},children:ue.map((f,v)=>(0,j.jsxs)("section",{"data-graview-zone":f.label||void 0,style:{display:"grid",gap:8,padding:"10px 14px 14px",...v>0?{borderTop:"1px dashed var(--graview-edge)"}:{}},children:[f.label?(0,j.jsx)("span",{style:{fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:f.label}):null,f.slots.length>0?(0,j.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px 12px",alignItems:"flex-start"},children:f.slots.map(S=>D(S,{}))}):(0,j.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"nothing here"})]},f.label||`band-${v}`))}):(0,j.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"stretch",minWidth:0,...N?{flex:"1 1 auto",alignSelf:"flex-start"}:{}},children:[!T&&Q.length>0?(0,j.jsx)("div",{"aria-hidden":"true",style:{position:"relative",width:15,flex:"0 0 auto",alignSelf:"stretch"},children:Q.map(f=>(0,j.jsx)("span",{title:f.label,style:{position:"absolute",top:`${f.from*100}%`,height:`${(f.to-f.from)*100}%`,right:0,writingMode:"vertical-rl",transform:"rotate(180deg)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:f.label},f.label))}):null,(0,j.jsxs)("div",{"data-graview-primitive":"board","data-graview-arrange":"exact",style:{...K,position:"relative",aspectRatio:`${T?1/R:R}`,...N?{width:"100%",height:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"flex-start"}:{height:"100%",flex:"0 1 auto",...O!==null?{width:Math.round(O*(T?1/R:R))}:{}},maxWidth:"100%"},children:[Q.map(f=>(0,j.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",...T?{top:0,bottom:0,left:`${(1-f.to)*100}%`,width:`${(f.to-f.from)*100}%`,borderLeft:"1px dashed var(--graview-edge)"}:{left:0,right:0,top:`${f.from*100}%`,height:`${(f.to-f.from)*100}%`,borderBottom:"1px dashed var(--graview-edge)"}}},f.label)),T?Q.map(f=>(0,j.jsx)("span",{"aria-hidden":"true",title:f.label,style:{position:"absolute",bottom:3,left:`${(1-f.to)*100}%`,width:`${(f.to-f.from)*100}%`,textAlign:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:f.label},`label-${f.label}`)):null,p.slots.map(f=>D(f,{position:"absolute",left:`${C(f.x,f.y).x*100}%`,top:`${C(f.x,f.y).y*100}%`,transform:"translate(-50%, -50%)",width:"max-content",maxWidth:"100%"}))]})]}),p.spare.length>0?(0,j.jsxs)("div",{style:{display:"grid",gap:6,alignContent:"start",minWidth:0},children:[(0,j.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"Not in"}),(0,j.jsx)(ze,{pick:!0,max:10,items:p.spare.map(f=>({...f,emphasis:o.size===0?"plain":o.has(f.id)?"lit":"dimmed"}))})]}):null]}),W?null:ce]})}function ar(e){function t(n){let{store:r}=oe(),a=Fn(_e(r.graph,r.schema,n.nodes),r.graph.allEdges(),e,r.schema),s=[...a.slots.flatMap(d=>d.occupants.map(y=>y.id)),...a.spare.map(d=>d.id)].map(d=>r.graph.getNode(d)).filter(d=>d!==void 0),{arranged:m,bar:c}=Ne(n,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{group:!1},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},subject:s}),b=(0,j.jsx)(Xr,{schema:r.schema,...n,options:e,...e.arranging===!1?{}:{occupants:m.nodes.map(d=>d.id)}});return Be(n,r.schema,c?(0,j.jsxs)("div",{style:{display:"grid",gap:6,height:"100%",minHeight:0,gridTemplateRows:"auto 1fr"},children:[c,b]}):b)}return{name:"board",requiredRoles:[...Jr],options:e,View:t,build(n,r,a){return Fn(n,r,e,a)}}}var Cn=F(Ee(),1);var ir=864e5;function _n(e){if(typeof e!="string")return null;if(Bn(e))return In(e)?.day??null;let t=/^(\d{4}-\d{2}-\d{2})/.exec(e);return t?t[1]:null}function yn(e){if(typeof e!="string")return null;if(Bn(e))return In(e)?.minutes??null;let t=/^\d{4}-\d{2}-\d{2}[T ](\d{2}):(\d{2})/.exec(e);return t?Number(t[1])*60+Number(t[2]):null}var hn=e=>Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10))),wn=e=>new Date(e).toISOString().slice(0,10);function Re(e,t){return wn(hn(e)+t*ir)}function Ge(e,t){let n=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+t,a=Number(e.slice(8,10)),i=new Date(Date.UTC(n,r+1,0)).getUTCDate();return wn(Date.UTC(n,r,Math.min(a,i)))}var Kn=e=>new Date(hn(e)).getUTCDay();function Ke(e,t=1){let n=(Kn(e)-t+7)%7;return Re(e,-n)}var Un=e=>`${e.slice(0,7)}-01`;function we(e,t){return Math.round((hn(t)-hn(e))/ir)}function Ue(e,t){return Array.from({length:t},(n,r)=>Re(e,r))}var or=e=>dt(e,"short"),De=e=>st(e,{weekday:"short"}),Yn=e=>Xe(e);function je(e,t){let n=t?.fieldRoles?.when;return e&&!e.start&&n?{...e,start:n}:e}function sr(e,t){return t===void 0?!1:typeof t=="string"?e[t]===!0:t.is.includes(e[t.field])}var vn=["start"],Zr=["day","week","month","quarter","year","agenda"];function bn(e){return e.horizon?["day","week","month","quarter","year","years","agenda"]:Zr}function lr(e,t){return e==="years"?t?.title??"Years":`The ${e}`}function dr(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var Qn=class extends Error{constructor(n,r){super(`The calendar lens has no binding for ${r.map(a=>`"${a}"`).join(", ")} on "${n}". Bind them in the lens declaration: bindings: { ${n}: { start: "<field>" } }.`);this.kind=n;this.missing=r;this.name="CalendarBindingError"}};function xn(e,t,n){let r=je(t[e.kind],n?.tryDefinition(e.kind));if(!r)return null;let a=e,i=n?.tryDefinition(e.kind)?.fields.shape,s=vn.filter(y=>{let p=r[y];return p?i?!(p in i):!(p in a):!0});if(s.length>0)throw new Qn(e.kind,s);let m=_n(a[r.start]);if(m===null)return null;let c=(r.end?_n(a[r.end]):null)??m,b=yn(a[r.start]),d=r.label?a[r.label]:void 0;return{id:e.id,kind:e.kind,label:typeof d=="string"&&d.length>0?d:xe(n?.tryDefinition(e.kind),e),from:m,to:we(m,c)<0?m:c,at:r.allDay&&a[r.allDay]===!0?null:b,allDay:r.allDay&&a[r.allDay]===!0||b===null,done:sr(a,r.done)}}function cr(e,t,n,r){let a=xn(e,t,n);if(!a)return[];let i=je(t[e.kind],n?.tryDefinition(e.kind)).start,s=e,m=s[i],c=s[ut(i)];if(typeof m!="string"||!gt(c))return[a];let b=we(a.from,a.to);return("next"in r?[pt(m,c,r.next)]:mt(m,c,{from:Re(r.from,-b),to:r.to,limit:400})).map(y=>({...a,from:y.slice(0,10),to:Re(y.slice(0,10),b),repeats:!0}))}function Sn(e,t){return e.filter(n=>we(n.from,t)>=0&&we(t,n.to)>=0).sort((n,r)=>n.allDay!==r.allDay?n.allDay?-1:1:n.at!==r.at?(n.at??0)-(r.at??0):n.label.localeCompare(r.label))}function ur(e,t,n){let r=ft(e.schema,e.allMutations()).get(t)?.get(n)??[],a=new Map(e.allMutations().map(s=>[s.name,s]));for(let s of r){let m=a.get(s),c=m?.subject;if(!m||!c)continue;let b=m.input?.shape??{};if(n in b)return{name:m.name,arg:c.arg}}let i=e.allMutations().find(s=>s.derived?.act==="edit"&&s.derived.kind===t);return i?.subject?{name:i.name,arg:i.subject.arg}:null}var gr=(e,t)=>({from:Un(e),to:mr(e),label:Tn(e,{short:!0,year:t})});function mr(e){return wn(Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7)),0))}function ea(e){let t=Math.floor((Number(e.slice(5,7))-1)/3);return`${e.slice(0,4)}-${String(t*3+1).padStart(2,"0")}-01`}function pr(e,t,n={}){let r=n.weekStartsOn??1,a=(c,b)=>({from:c,to:c,label:String(Number(c.slice(8,10))),...b?{outside:!0}:{}});if(e==="day")return{title:De(t),grain:"day",columns:1,cells:[a(t)]};if(e==="week"){let c=Ke(t,r);return{title:`${De(c)} \u2013 ${De(Re(c,6))}`,grain:"day",columns:7,cells:Ue(c,7).map(b=>a(b))}}if(e==="agenda")return{title:`From ${De(t)}`,grain:"day",columns:1,cells:Ue(t,42).map(c=>a(c))};if(e==="quarter"){let c=ea(t),b=mr(Ge(c,2)),d=[];for(let y=Ke(c,r);we(y,b)>=0;y=Re(y,7))d.push({from:y,to:Re(y,6),label:lt(y),...we(y,c)>0&&we(Re(y,6),c)>0?{outside:!0}:{}});return{title:`Q${Math.floor((Number(t.slice(5,7))-1)/3)+1} ${t.slice(0,4)}`,grain:"week",columns:4,cells:d}}if(e==="year"){let c=t.slice(0,4);return{title:c,grain:"month",columns:4,cells:Array.from({length:12},(b,d)=>gr(`${c}-${String(d+1).padStart(2,"0")}-01`,!1))}}if(e==="years"){let c=Number(t.slice(0,4)),b=c+Math.max(1,n.horizon?.years??1)-1,d=n.horizon?.from!==void 0||n.horizon?.to!==void 0,y=d?n.horizon?.from??c:Math.min(c,n.fit?.first??c),o=(d?Math.max(y,n.horizon?.to??y+Math.max(1,n.horizon?.years??1)-1):Math.max(b,n.fit?.last??b))-y+1,l=Array.from({length:o},(k,u)=>String(y+u));return o>na?{title:`${n.horizon?.title??"Years"} \xB7 ${l[0]}\u2013${l[l.length-1]}`,grain:"year",columns:5,years:l,cells:l.map(k=>({from:`${k}-01-01`,to:`${k}-12-31`,label:k}))}:{title:`${n.horizon?.title??"Years"} \xB7 ${l[0]}\u2013${l[l.length-1]}`,grain:"month",columns:4,years:l,cells:l.flatMap(k=>Array.from({length:12},(u,x)=>gr(`${k}-${String(x+1).padStart(2,"0")}-01`,!0)))}}let i=Un(t),s=Ke(i,r),m=t.slice(0,7);return{title:Tn(t),grain:"day",columns:7,cells:Ue(s,42).map(c=>a(c,c.slice(0,7)!==m))}}function fr(e,t,n){return e.filter(r=>we(r.from,n)>=0&&we(t,r.to)>=0).sort((r,a)=>r.allDay!==a.allDay?r.allDay?-1:1:r.from!==a.from?r.from.localeCompare(a.from):r.at!==a.at?(r.at??0)-(a.at??0):r.label.localeCompare(a.label))}var na=10;function hr(e){return e==="year"?"year":e==="month"?"month":e==="week"?"week":"day"}var yr=F(Ee(),1);var ie=F(te(),1);function Jn({label:e,glyph:t,onPress:n}){return(0,ie.jsx)("button",{type:"button","aria-label":e,title:e,onClick:n,style:Ye,children:t})}var Ye={minHeight:24,minWidth:24,padding:"2px 9px",borderRadius:6,fontSize:"0.8125rem",borderWidth:1,borderStyle:"solid",borderColor:"transparent",color:"var(--graview-ink-muted)",background:"transparent"},wr={day:12,week:4,month:3,year:5};function vr({span:e,weekStartsOn:t,entries:n,today:r,perCell:a,emphasisOf:i,broken:s,hue:m,onOpen:c,onMove:b}){let d=(0,yr.useRef)(null),y=Fe(d),p=y===null?e.columns:Math.max(1,Math.floor(y/44)),o=p<e.columns,l=o?p:e.columns,k=!o&&e.grain==="day"&&e.columns===7?Ue(Ke(e.cells[0]?.from??r,t),7):e.grain==="day"&&e.columns===1?e.cells.map(u=>u.from):null;return o&&e.grain==="day"&&e.columns>1?(0,ie.jsx)("div",{ref:d,"data-calendar-shape":"agenda",style:{display:"grid",minHeight:0,flex:1},children:(0,ie.jsx)(kn,{days:e.cells.map(u=>u.from),entries:n,today:r,emphasisOf:i,broken:s,hue:m,onMove:(u,x)=>b(u,{from:x,to:x,label:x},"day")})}):(0,ie.jsxs)("div",{ref:d,"data-calendar-shape":o?"wrapped":"grid",style:{display:"grid",gap:4,gridTemplateRows:k?"auto 1fr":"1fr",minHeight:0,flex:1},children:[k?(0,ie.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`,gap:4},children:k.map(u=>(0,ie.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-muted)",textAlign:"center"},children:e.columns===7?or(Kn(u)):De(u)},u))}):null,(0,ie.jsx)("div",{tabIndex:0,"aria-label":`The days of ${e.title}`,style:{display:"grid",gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`,gridAutoRows:"max-content",gap:4,minHeight:0,overflow:"auto"},children:e.cells.map((u,x)=>{let R=fr(n,u.from,u.to),L=R.slice(0,a),T=R.slice(a),w=T.filter(g=>s.has(g.id)).length,O=we(u.from,r)>=0&&we(r,u.to)>=0;return(0,ie.jsxs)("div",{"data-calendar-day":e.grain==="day"?u.from:void 0,"data-calendar-cell":u.from,"data-calendar-grain":e.grain,"data-calendar-count":R.length,"data-calendar-outside":u.outside||void 0,onDragOver:g=>{g.dataTransfer.types.includes("text/graview-node")&&(g.preventDefault(),g.dataTransfer.dropEffect="move")},onDrop:g=>{let M=g.dataTransfer.getData("text/graview-node");M&&(g.preventDefault(),g.stopPropagation(),b(M,u,e.grain))},style:{minHeight:62,display:"flex",flexDirection:"column",gap:2,padding:4,borderRadius:7,border:"1px solid var(--graview-edge)",background:O?"var(--graview-panel)":u.outside?"var(--graview-panel-muted)":"transparent"},children:[(0,ie.jsxs)("span",{style:{display:"flex",alignItems:"baseline",gap:4},children:[(0,ie.jsx)("span",{style:{fontSize:"0.75rem",fontVariantNumeric:"tabular-nums",color:O?"var(--graview-accent)":"var(--graview-ink-faint)"},children:u.label}),e.grain!=="day"&&R.length>0?(0,ie.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",marginLeft:"auto"},children:R.length}):null]}),L.map(g=>(0,ie.jsx)(br,{entry:g,cell:u,rowStart:x%l===0,emphasis:i(g.id),flagged:s.has(g.id),hue:m(g)},`${g.id}:${g.from}:${u.from}`)),T.length>0?(0,ie.jsxs)("button",{type:"button","data-testid":`calendar-more-${u.from}`,onClick:()=>c(u),title:`Open ${u.label}`,style:{minHeight:24,padding:"1px 5px",fontSize:"0.75rem",borderRadius:5,border:"1px dashed var(--graview-edge)",background:"transparent",color:w>0?"var(--graview-warn)":"var(--graview-ink-muted)",textAlign:"left"},children:["+",T.length," more",w>0?` \xB7 ${w} flagged`:""]}):null]},u.from)})})]})}function kn({days:e,entries:t,today:n,emphasisOf:r,broken:a,hue:i,onMove:s}){let m=e.map(c=>({day:c,here:Sn(t,c)})).filter(({here:c})=>c.length>0);return m.length===0?(0,ie.jsx)("p",{"data-testid":"calendar-empty",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:"Nothing is scheduled in the next six weeks."}):(0,ie.jsx)("ol",{tabIndex:0,"aria-label":"What is scheduled",style:{margin:0,padding:0,listStyle:"none",display:"grid",alignContent:"start",gap:10,overflow:"auto",minHeight:0},children:m.map(({day:c,here:b})=>(0,ie.jsxs)("li",{"data-calendar-day":c,onDragOver:d=>{d.dataTransfer.types.includes("text/graview-node")&&(d.preventDefault(),d.dataTransfer.dropEffect="move")},onDrop:d=>{let y=d.dataTransfer.getData("text/graview-node");y&&(d.preventDefault(),d.stopPropagation(),s(y,c))},style:{display:"grid",gap:4},children:[(0,ie.jsxs)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:c===n?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[De(c),c===n?" \xB7 today":""]}),b.map(d=>(0,ie.jsx)(br,{entry:d,cell:{from:c,to:c,label:c},emphasis:r(d.id),flagged:a.has(d.id),hue:i(d)},`${d.id}:${d.from}:${c}`))]},c))})}function br({entry:e,cell:t,emphasis:n,flagged:r,hue:a,rowStart:i=!1}){let s=we(t.from,e.from)>=0,m=we(e.to,t.to)>=0,c=!(s&&m),b=e.at!==null&&s&&e.from===t.from?`${Yn(e.at)} ${e.label}`:e.label;return(0,ie.jsx)("span",{"data-graview-pick":e.id,"data-calendar-entry":e.id,"data-calendar-repeat":e.repeats?e.from:void 0,draggable:!e.repeats,onDragStart:d=>{d.dataTransfer.setData("text/graview-node",e.id),d.dataTransfer.effectAllowed="move"},"data-graview-emphasis":n,"data-calendar-part":c?s?"opens":m?"closes":"through":void 0,"data-calendar-in":t.from,title:c?`${e.label} \xB7 ${e.from} \u2013 ${e.to}`:`${e.label}${e.at===null?" \xB7 all day":` \xB7 ${Yn(e.at)}`}${e.repeats?" \xB7 repeats":""}`,style:{display:"block",minHeight:24,boxSizing:"border-box",padding:"3px 6px",fontSize:"0.75rem",lineHeight:1.35,borderRadius:c?s?"5px 0 0 5px":m?"0 5px 5px 0":0:5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:e.done?"line-through":"none",opacity:n==="dimmed"?.35:e.done?.6:1,background:`color-mix(in oklab, hsl(${Math.round(a)} 70% 55%) ${n==="lit"?38:20}%, transparent)`,color:"var(--graview-ink)",...n==="lit"?{outline:"1px solid var(--graview-accent)"}:{},...r?{borderLeft:"3px solid var(--graview-warn)",paddingLeft:4}:{}},children:s||i?e.repeats?(0,ie.jsxs)(ie.Fragment,{children:[(0,ie.jsx)("span",{"aria-hidden":"true",children:"\u21BB "}),b]}):b:" "})}var ee=F(te(),1);function ta(e){let t=1/0,n=-1/0;for(let r of e)r&&(t=Math.min(t,Number(r.from.slice(0,4))),n=Math.max(n,Number(r.to.slice(0,4))));return Number.isFinite(t)&&Number.isFinite(n)?{first:t,last:n}:void 0}function xr(e){let t=n=>function(a){let{store:i}=oe(),{view:s}=nn(),m=n?{...e,range:n}:e,c=s.within?.range??m.range??"month",b=Object.keys(e.bindings),{nodes:d,arranged:y,arrangement:p,bar:o}=Ne(a,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{sort:!1,group:c==="agenda"},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},...e.search?{search:e.search}:{},...e.filters?{filters:e.filters}:{},...b[0]?{kind:(a.nodes??[]).find(R=>b.includes(String(R.kind)))?.kind??b[0]}:{}}),l=c==="agenda"&&y.grouped&&p.group?y.groups.map(R=>({label:R.label,ids:new Set(R.nodes.map(L=>L.id))})):void 0,k=new Set((a.nodes??[]).map(R=>String(R.kind))),u=b.filter(R=>!k.has(R)&&i.schema.tryDefinition(R)!==void 0).flatMap(R=>{let L=i.schema.tryDefinition(R);return i.graph.nodesOfKind(R).filter(T=>s.past===!0||Ve(L,T))}),x=u.length===0?d:[...d,...a.budget!==void 0?u.slice(0,a.budget):u];return Be(a,i.schema,(0,ee.jsx)(ra,{schema:i.schema,...a,nodes:x,options:{...m,today:m.today??i.today()??dr()},...o?{bar:o}:{},...l?{groups:l}:{}}))};return{name:"calendar",requiredRoles:[...vn],bindings:e.bindings,options:e,View:t(),at:n=>t(n),ranges:()=>bn(e).map(n=>({range:n,title:lr(n,e.horizon)})),place:(n,r)=>n.map(a=>xn(a,e.bindings,r)).filter(a=>a!==null)}}function ra({nodes:e,label:t,fidelity:n,mode:r,options:a,schema:i,selectedIds:s=[],implicated:m=[],flagged:c=[],bar:b,groups:d}){let{view:y,go:p}=nn(),{store:o,principal:l}=oe(),k=y.within?.at??a.today,u=y.within?.range??a.range??"month",x=a.weekStartsOn??1,R=new Set([...m,...s]),L=E=>R.size===0?"plain":R.has(E)?"lit":"dimmed",T=new Set(c),w=u==="years"&&y.within?.at===void 0?ta((e??[]).map(E=>xn(E,a.bindings,i))):void 0,O=pr(u,k,{weekStartsOn:x,...a.horizon?{horizon:a.horizon}:{},...w?{fit:w}:{}}),M=n==="glyph"||n==="summary"?{next:a.today}:{from:O.cells[0]?.from??k,to:O.cells[O.cells.length-1]?.to??k},N=(e??[]).flatMap(E=>cr(E,a.bindings,i,M)),G=a.hueOf??(E=>be(E.kind));if(n==="glyph")return(0,ee.jsx)(ke,{label:`${t??"Calendar"} \xB7 ${N.length}`,hue:be("calendar")});if(n==="summary"){let E=Sn(N,a.today);return(0,ee.jsx)(pe,{title:t??"Calendar",meta:`${N.length} dated`,tone:"muted",children:(0,ee.jsx)(ze,{max:6,items:E.length>0?E.map(K=>({id:K.id,label:K.label,hue:G(K)})):N.filter(K=>we(a.today,K.from)>=0).sort((K,f)=>K.from.localeCompare(f.from)).slice(0,6).map(K=>({id:K.id,label:`${K.from.slice(5)} ${K.label}`,hue:G(K)}))})})}let C=r==="fullscreen",[q,W]=(0,Cn.useState)(null),ce=(E,K,f)=>{let v=o.graph.getNode(E);if(!v)return;let S=je(a.bindings[v.kind],o.schema.tryDefinition(v.kind));if(!S)return;let A=ur(o,v.kind,S.start);if(!A){W({text:`Nothing declared writes the ${Nn(o.schema.definitions.find(Y=>Y.kind===v.kind),S.start).toLowerCase()}, so this cannot be moved from here.`,tone:"refused"});return}let h=K.from,$=v[S.start],Z=yn($)===null?h:`${h}${String($).slice(10)}`,H={name:A.name,args:{[A.arg]:E,[S.start]:Z}},U=o.permits(H,l);if(!U.ok){W({text:U.refusal.message,tone:"refused"});return}try{o.apply(H,{author:l}),W(f==="day"?null:{text:`Moved to ${De(h)} \u2014 a ${f} is coarser than the ${Nn(o.schema.definitions.find(Y=>Y.kind===v.kind),S.start).toLowerCase()} holds, so it takes the first day of the cell. Undo puts it back.`,tone:"rounded"})}catch(Y){W({text:Y instanceof Error?Y.message:String(Y),tone:"refused"})}},ae=E=>{let K=u==="years"?Ge(`${O.years?.[0]??k.slice(0,4)}${k.slice(4)}`,E*12*Math.max(1,O.years?.length??a.horizon?.years??1)):u==="year"?Ge(k,E*12):u==="quarter"?Ge(k,E*3):u==="month"?Ge(k,E):u==="week"?Re(k,E*7):Re(k,E);p(en(y,"at",K))},ne=(E,K)=>{let f=en(y,"range",E);K!==void 0&&(f=en(f,"at",K)),p(f)},D=(0,Cn.useRef)(null),Q=Fe(D),ue=Q!==null&&Q<420,I=E=>E==="years"?a.horizon?.title??"years":E.charAt(0).toUpperCase()+E.slice(1);return(0,ee.jsx)(pe,{title:t??"Calendar",meta:O.title,style:{gap:10,...C?{flex:"1 1 auto",minHeight:0,height:"100%"}:{}},children:(0,ee.jsxs)("div",{ref:D,"data-testid":"calendar","data-calendar-range":u,"data-calendar-at":k,style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,gap:8},children:[(0,ee.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6},children:[(0,ee.jsxs)("nav",{"aria-label":"When",style:{display:"flex",gap:4},children:[(0,ee.jsx)(Jn,{label:"Previous",glyph:"\u2039",onPress:()=>ae(-1)}),(0,ee.jsx)("button",{type:"button","data-testid":"calendar-today",onClick:()=>p(en(y,"at",a.today)),style:Ye,children:"Today"}),(0,ee.jsx)(Jn,{label:"Next",glyph:"\u203A",onPress:()=>ae(1)})]}),ue?(0,ee.jsx)("select",{"aria-label":"Range","data-testid":"calendar-ranges",value:u,onChange:E=>ne(E.target.value),style:{...Ye,borderRadius:999,borderColor:"var(--graview-edge)",background:void 0,backgroundColor:"transparent",marginLeft:"auto",maxWidth:"50%",paddingRight:24,appearance:"none",WebkitAppearance:"none",backgroundImage:"linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%)",backgroundPosition:"calc(100% - 13px) 55%, calc(100% - 9px) 55%",backgroundSize:"4px 4px, 4px 4px",backgroundRepeat:"no-repeat"},children:bn(a).map(E=>(0,ee.jsx)("option",{value:E,children:I(E)},E))}):(0,ee.jsx)("div",{role:"group","aria-label":"Range","data-testid":"calendar-ranges",style:{display:"flex",flexWrap:"wrap",gap:4,marginLeft:"auto"},children:bn(a).map(E=>(0,ee.jsx)("button",{type:"button","aria-pressed":E===u,"data-testid":`calendar-range-${E}`,onClick:()=>ne(E),style:{...Ye,borderRadius:999,borderColor:"var(--graview-edge)",...E==="years"?{}:{textTransform:"capitalize"},...E===u?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)",background:"var(--graview-panel)"}:{}},children:E==="years"?a.horizon?.title??"years":E},E))})]}),q?(0,ee.jsx)("p",{"data-testid":q.tone==="refused"?"calendar-refused":"calendar-rounded",role:"status",style:{margin:0,fontSize:"0.8125rem",color:q.tone==="refused"?"var(--graview-warn)":"var(--graview-ink-muted)"},children:q.text}):null,O.years?(0,ee.jsx)("nav",{"aria-label":"Years","data-testid":"calendar-years",style:{display:"flex",flexWrap:"wrap",gap:4},children:O.years.map(E=>(0,ee.jsx)("button",{type:"button","data-testid":`calendar-year-${E}`,onClick:()=>ne("year",`${E}-01-01`),style:Ye,children:E},E))}):null,b,u==="agenda"&&d?(0,ee.jsx)("div",{"data-testid":"calendar-groups",style:{display:"grid",gap:10,minHeight:0,overflow:"auto"},children:d.map(E=>(0,ee.jsxs)("section",{"data-testid":"calendar-group",style:{display:"grid",gap:4},children:[(0,ee.jsxs)("h3",{style:{margin:0,fontSize:"0.8125rem",letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},children:[E.label," ",(0,ee.jsx)("span",{style:{fontWeight:400},children:E.ids.size})]}),(0,ee.jsx)(kn,{days:O.cells.map(K=>K.from),entries:N.filter(K=>E.ids.has(K.id)),today:a.today,emphasisOf:L,broken:T,hue:G,onMove:(K,f)=>ce(K,{from:f,to:f,label:f},"day")})]},E.label))}):u==="agenda"?(0,ee.jsx)(kn,{days:O.cells.map(E=>E.from),entries:N,today:a.today,emphasisOf:L,broken:T,hue:G,onMove:(E,K)=>ce(E,{from:K,to:K,label:K},"day")}):(0,ee.jsx)(vr,{span:O,weekStartsOn:x,entries:N,today:a.today,perCell:a.perCell??wr[O.grain],emphasisOf:L,broken:T,hue:G,onOpen:E=>ne(hr(O.grain),E.from),onMove:ce})]})})}var re=F(Ee(),1);var Qe=F(Ee(),1),Ae=F(te(),1),$n={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"};function Sr({choices:e,close:t}){let[n,r]=(0,Qe.useState)(!1),a=(0,Qe.useRef)(null);return(0,Qe.useLayoutEffect)(()=>{n&&a.current?.querySelector("button:not([disabled])")?.focus()},[n]),(0,Ae.jsxs)("div",{children:[(0,Ae.jsxs)("button",{type:"button","data-menu-item":"move-to","aria-expanded":n,onClick:()=>r(i=>!i),style:$n,children:["Move to ",(0,Ae.jsx)("span",{"aria-hidden":"true",children:"\u203A"})]}),n?(0,Ae.jsx)("ul",{ref:a,"aria-label":"Move to","data-testid":"move-to",style:{margin:"2px 0 0 12px",padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:e.map(i=>i.run?(0,Ae.jsx)("li",{children:(0,Ae.jsx)("button",{type:"button","data-move-to":i.to,onClick:()=>{t(),i.run()},style:$n,children:i.label})},i.to):(0,Ae.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,Ae.jsx)("button",{type:"button",disabled:!0,"data-move-to":i.to,"data-withheld":"",style:{...$n,borderStyle:"dashed"},children:(0,Ae.jsx)("s",{children:i.label})}),(0,Ae.jsx)("span",{"data-testid":"move-to-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:i.why})]},i.to))}):null]})}function kr({choose:e,close:t}){return(0,Ae.jsx)("button",{type:"button","data-menu-item":"choose-several",onClick:()=>{t(),e()},style:$n,children:"Choose several"})}var z=F(te(),1),aa=`
4
4
  .graview-columns { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
@@ -1 +1 @@
1
- import{a as ee,b as H,c as ne}from"./chunk.RRKYJYZJ.js";import{B as J,F as Q,H as X,K as Y,g as K,i as G,m as q,p as z,q as W,u as j,v as Z,x as _,z as U}from"./chunk.YD3TKV6P.js";import{a as O}from"./chunk.4KC35UNR.js";import{G as ae,Ha as D,Qa as $,T as M,ba as T,da as N,ua as I}from"./chunk.HT2BEOEV.js";import{Ec as C}from"./chunk.7BBGRTXM.js";import{b as k}from"./chunk.AJZBJBMO.js";var o=k(ae(),1);var y=k(M(),1),fe=e=>typeof e=="object"?e:{};function he({rootRef:e,firstLook:r,app:n}){let t=(0,o.useCallback)(()=>e.current,[e]);return r?(0,y.jsx)(Y,{firstLook:r,root:t,app:n}):null}function ge(e,r,n){let{app:t}=e,a=(0,o.useMemo)(()=>{let i=Q(r(t.schema,t.viewSpecs),t),d=n?ie(i,n):i,s=e.views?e.views(t.schema,d):i,c=s===d?i:I(i,s);return X(c,t.schema,U(e.brand??t.brand,t.schema)),n?n.register(c):c},[e.views,t.schema,t.viewSpecs,t.lenses,t.pages,t.home,n]);return D(a,e.keptViews)}function ie(e,r){let n={...e,register(t,a,i,d){return d?.name!==r.name&&e.register(t,a,i,d),n},...e.home?{home:(t,a)=>(r.home||e.home(t,a),n)}:{}};return n}var F=e=>e?e.getBoundingClientRect().height:0;function be(e,r,n){let t=(0,o.useRef)(n);t.current=n;let a=n!==void 0;(0,o.useLayoutEffect)(()=>{let i=e.current;if(!i||!a)return;let d=()=>{let m=[...i.children],h=m.find(b=>b.hasAttribute("data-graview-app-bar")),p=m.find(b=>b.hasAttribute("data-embed-content")),g=p?.querySelector("[data-embed-measure]")??null,l=m.find(b=>b.hasAttribute("data-graview-place-line"));return{strip:h,line:l,content:p,measure:g}},s=-1,c=()=>{let{strip:m,line:h,content:p,measure:g}=d(),l=Math.ceil(F(m)+F(h)+F(g||p));l!==s&&(s=l,t.current?.(l))};if(c(),typeof ResizeObserver>"u")return;let u=new ResizeObserver(c),E=()=>{u.disconnect();let{strip:m,line:h,content:p,measure:g}=d();for(let l of[i,m,h,p,g])l&&u.observe(l)};E();let w=new MutationObserver(()=>{E(),c()});return w.observe(i,{childList:!0}),()=>{u.disconnect(),w.disconnect()}},[e,r,a])}var we=480,se=0;function Se(e){let{app:r,seed:n,scheme:t="auto",brand:a=r.brand,fonts:i=!0,height:d="100%",label:s}=e,c=(0,o.useRef)(null);$(c);let u=d==="viewport"?"100dvh":d,E=G(typeof u=="string"&&/vh\b/.test(u)),w=(0,o.useMemo)(()=>`graview-embed-${++se}`,[]),m=(0,o.useMemo)(()=>e.store??e.remote?.store??H(r,n),[e.store,e.remote,r,n]),h=e.presence??e.remote?.presence,p=e.hostContext?.theme,g=ne(t==="auto"&&p===void 0,a?.scheme),l=t==="auto"?p??g:t,b=(0,o.useMemo)(()=>O(l,a,{scope:`.${w}`}),[l,a,w]);K(e.favicon?C(a):void 0),(0,o.useEffect)(()=>{if(!i||typeof document>"u")return;let v=ee(a);if(!v||document.querySelector(`link[href="${v}"]`))return;let f=document.createElement("link");f.rel="stylesheet",f.href=v,document.head.appendChild(f)},[a,i]);let A=(0,o.useRef)(void 0);(0,o.useLayoutEffect)(()=>{let v=c.current,f=A.current;if(A.current=s,!v||!s)return;let oe=S=>{let R=S.getAttribute("aria-label")??"",x=f&&f!==s?R.startsWith(`${f} \xB7 `)?R.slice(f.length+3):R===f?"":R:R;x===s&&(S.getAttribute("role")==="region"||S.tagName==="SECTION"&&!S.hasAttribute("role"))&&S.setAttribute("role","group");let V=x.startsWith(`${s} \xB7 `)||x===s?x:x?`${s} \xB7 ${x}`:s;V!==R&&S.setAttribute("aria-label",V)},B=()=>v.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(S=>{S.hasAttribute("data-graview-named-by-lens")||oe(S)});B();let P=new MutationObserver(B);return P.observe(v,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>P.disconnect()},[s]);let re=E?`${u}`.replace(/([\d.]+)[sdl]?vh\b/g,(v,f)=>`${+f*E/100}px`):u;return{rootRef:c,scope:w,css:b,scheme:l,store:m,presence:h,brand:a,auto:d==="auto",height:re}}function ve({rootRef:e,board:r}){let n=(0,o.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]);return(0,y.jsx)(q,{board:r,anchor:n})}function Ee(e,r,n){return{brand:n,locale:e.locale,timeZone:e.timeZone,principal:e.principal,seats:e.seats,presence:r,typing:e.remote?.typing,people:e.people,memory:e.memory,presenceTtlMs:e.presenceTtlMs,onKeepLens:e.onKeepLens,ai:e.ai,files:e.files,resolveApp:e.resolveApp,history:e.history,linkedRecords:e.linkedRecords,subscriptions:e.subscriptions,dismissals:e.dismissals,whileAway:e.whileAway,keptViews:e.keptViews,onExport:e.onExport,signIn:e.signIn,menuSections:e.menuSections,app:e.app}}function Re({name:e,heading:r,faces:n,at:t,without:a,home:i,reach:d,standing:s,hostActions:c,keeping:u,onFind:E,switch:w,named:m=!0}){let{brand:h,store:p,principal:g,views:l}=T();N();let b=a?.has("places")?[]:z({store:p,principal:g,views:l}),A=_();return(0,y.jsx)(j,{brand:h,name:e,named:m,description:h?.subtitle,heading:r,faces:n,home:i,places:b,current:t===null?null:W(b,t),reach:d,onFind:E,...w?{switch:w}:{},...n||t===null?{scenePlaces:A}:{},tools:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(J,{clean:s}),(0,y.jsx)(Z,{...c?{hostActions:c}:{},...u?{keeping:u}:{}})]})})}var xe=e=>e===!1?2:Math.min(e+1,6);function Ae(e){let[r,n]=(0,o.useState)(e),t=(0,o.useRef)(void 0),a=(0,o.useRef)(void 0),i=(0,o.useMemo)(()=>({go:t,at:n,pending:a}),[]),d=(0,o.useCallback)(s=>{if(t.current){t.current(s);return}a.current=s,n(s)},[]);return{at:r,setAt:n,steering:i,steer:d}}function de(e){let r=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof r=="string"&&r.length>0?r:typeof e=="object"?"Error":typeof e}}var L=()=>typeof performance<"u"?performance.now():Date.now();function Fe(e,r){let n=(0,o.useRef)({onError:e,face:r});return n.current={onError:e,face:r},(0,o.useCallback)((t,a)=>n.current.onError?.(de(t),{module:a.module,face:n.current.face}),[])}function ke(e,r){let n=(0,o.useRef)(null);n.current===null&&(n.current=L());let t=(0,o.useRef)({onReady:e,face:r});t.current={onReady:e,face:r};let a=(0,o.useRef)(!1);return(0,o.useCallback)(i=>{a.current||(a.current=!0,t.current.onReady?.({ms:Math.max(0,L()-(n.current??L())),face:i}))},[])}var te=class extends o.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(r,n){console.error(`[graview] ${this.props.module} threw while rendering`,r,n.componentStack),this.props.report(r,{module:this.props.module})}render(){return this.state.failed?(0,y.jsxs)("div",{role:"alert","data-graview-face-error":this.props.module,...this.props.content?{"data-embed-content":""}:{},style:this.props.content?{flex:"1 1 auto",display:"grid",alignContent:"center",justifyItems:"center",gap:8,padding:24,background:"var(--graview-ground)",color:"var(--graview-ink)",fontSize:"0.9375rem"}:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,y.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,y.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{fe as a,he as b,ge as c,be as d,we as e,Se as f,ve as g,Ee as h,Re as i,xe as j,Ae as k,Fe as l,ke as m,te as n};
1
+ import{a as ee,b as H,c as ne}from"./chunk.XR6YR6RV.js";import{B as J,F as Q,H as X,K as Y,g as K,i as G,m as q,p as z,q as W,u as j,v as Z,x as _,z as U}from"./chunk.WC3DENU4.js";import{a as O}from"./chunk.VNDKKTED.js";import{G as ae,Ha as D,Qa as $,T as M,ba as T,da as N,ua as I}from"./chunk.4MP72LPR.js";import{Kc as C}from"./chunk.VSCIXAHN.js";import{b as k}from"./chunk.AJZBJBMO.js";var o=k(ae(),1);var y=k(M(),1),fe=e=>typeof e=="object"?e:{};function he({rootRef:e,firstLook:r,app:n}){let t=(0,o.useCallback)(()=>e.current,[e]);return r?(0,y.jsx)(Y,{firstLook:r,root:t,app:n}):null}function ge(e,r,n){let{app:t}=e,a=(0,o.useMemo)(()=>{let i=Q(r(t.schema,t.viewSpecs),t),d=n?ie(i,n):i,s=e.views?e.views(t.schema,d):i,c=s===d?i:I(i,s);return X(c,t.schema,U(e.brand??t.brand,t.schema)),n?n.register(c):c},[e.views,t.schema,t.viewSpecs,t.lenses,t.pages,t.home,n]);return D(a,e.keptViews)}function ie(e,r){let n={...e,register(t,a,i,d){return d?.name!==r.name&&e.register(t,a,i,d),n},...e.home?{home:(t,a)=>(r.home||e.home(t,a),n)}:{}};return n}var F=e=>e?e.getBoundingClientRect().height:0;function be(e,r,n){let t=(0,o.useRef)(n);t.current=n;let a=n!==void 0;(0,o.useLayoutEffect)(()=>{let i=e.current;if(!i||!a)return;let d=()=>{let m=[...i.children],h=m.find(b=>b.hasAttribute("data-graview-app-bar")),p=m.find(b=>b.hasAttribute("data-embed-content")),g=p?.querySelector("[data-embed-measure]")??null,l=m.find(b=>b.hasAttribute("data-graview-place-line"));return{strip:h,line:l,content:p,measure:g}},s=-1,c=()=>{let{strip:m,line:h,content:p,measure:g}=d(),l=Math.ceil(F(m)+F(h)+F(g||p));l!==s&&(s=l,t.current?.(l))};if(c(),typeof ResizeObserver>"u")return;let u=new ResizeObserver(c),E=()=>{u.disconnect();let{strip:m,line:h,content:p,measure:g}=d();for(let l of[i,m,h,p,g])l&&u.observe(l)};E();let w=new MutationObserver(()=>{E(),c()});return w.observe(i,{childList:!0}),()=>{u.disconnect(),w.disconnect()}},[e,r,a])}var we=480,se=0;function Se(e){let{app:r,seed:n,scheme:t="auto",brand:a=r.brand,fonts:i=!0,height:d="100%",label:s}=e,c=(0,o.useRef)(null);$(c);let u=d==="viewport"?"100dvh":d,E=G(typeof u=="string"&&/vh\b/.test(u)),w=(0,o.useMemo)(()=>`graview-embed-${++se}`,[]),m=(0,o.useMemo)(()=>e.store??e.remote?.store??H(r,n),[e.store,e.remote,r,n]),h=e.presence??e.remote?.presence,p=e.hostContext?.theme,g=ne(t==="auto"&&p===void 0,a?.scheme),l=t==="auto"?p??g:t,b=(0,o.useMemo)(()=>O(l,a,{scope:`.${w}`}),[l,a,w]);K(e.favicon?C(a):void 0),(0,o.useEffect)(()=>{if(!i||typeof document>"u")return;let v=ee(a);if(!v||document.querySelector(`link[href="${v}"]`))return;let f=document.createElement("link");f.rel="stylesheet",f.href=v,document.head.appendChild(f)},[a,i]);let A=(0,o.useRef)(void 0);(0,o.useLayoutEffect)(()=>{let v=c.current,f=A.current;if(A.current=s,!v||!s)return;let oe=S=>{let R=S.getAttribute("aria-label")??"",x=f&&f!==s?R.startsWith(`${f} \xB7 `)?R.slice(f.length+3):R===f?"":R:R;x===s&&(S.getAttribute("role")==="region"||S.tagName==="SECTION"&&!S.hasAttribute("role"))&&S.setAttribute("role","group");let V=x.startsWith(`${s} \xB7 `)||x===s?x:x?`${s} \xB7 ${x}`:s;V!==R&&S.setAttribute("aria-label",V)},B=()=>v.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(S=>{S.hasAttribute("data-graview-named-by-lens")||oe(S)});B();let P=new MutationObserver(B);return P.observe(v,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>P.disconnect()},[s]);let re=E?`${u}`.replace(/([\d.]+)[sdl]?vh\b/g,(v,f)=>`${+f*E/100}px`):u;return{rootRef:c,scope:w,css:b,scheme:l,store:m,presence:h,brand:a,auto:d==="auto",height:re}}function ve({rootRef:e,board:r}){let n=(0,o.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]);return(0,y.jsx)(q,{board:r,anchor:n})}function Ee(e,r,n){return{brand:n,locale:e.locale,timeZone:e.timeZone,principal:e.principal,seats:e.seats,presence:r,typing:e.remote?.typing,people:e.people,memory:e.memory,presenceTtlMs:e.presenceTtlMs,onKeepLens:e.onKeepLens,ai:e.ai,files:e.files,resolveApp:e.resolveApp,history:e.history,linkedRecords:e.linkedRecords,subscriptions:e.subscriptions,dismissals:e.dismissals,whileAway:e.whileAway,keptViews:e.keptViews,onExport:e.onExport,signIn:e.signIn,menuSections:e.menuSections,app:e.app}}function Re({name:e,heading:r,faces:n,at:t,without:a,home:i,reach:d,standing:s,hostActions:c,keeping:u,onFind:E,switch:w,named:m=!0}){let{brand:h,store:p,principal:g,views:l}=T();N();let b=a?.has("places")?[]:z({store:p,principal:g,views:l}),A=_();return(0,y.jsx)(j,{brand:h,name:e,named:m,description:h?.subtitle,heading:r,faces:n,home:i,places:b,current:t===null?null:W(b,t),reach:d,onFind:E,...w?{switch:w}:{},...n||t===null?{scenePlaces:A}:{},tools:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(J,{clean:s}),(0,y.jsx)(Z,{...c?{hostActions:c}:{},...u?{keeping:u}:{}})]})})}var xe=e=>e===!1?2:Math.min(e+1,6);function Ae(e){let[r,n]=(0,o.useState)(e),t=(0,o.useRef)(void 0),a=(0,o.useRef)(void 0),i=(0,o.useMemo)(()=>({go:t,at:n,pending:a}),[]),d=(0,o.useCallback)(s=>{if(t.current){t.current(s);return}a.current=s,n(s)},[]);return{at:r,setAt:n,steering:i,steer:d}}function de(e){let r=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof r=="string"&&r.length>0?r:typeof e=="object"?"Error":typeof e}}var L=()=>typeof performance<"u"?performance.now():Date.now();function Fe(e,r){let n=(0,o.useRef)({onError:e,face:r});return n.current={onError:e,face:r},(0,o.useCallback)((t,a)=>n.current.onError?.(de(t),{module:a.module,face:n.current.face}),[])}function ke(e,r){let n=(0,o.useRef)(null);n.current===null&&(n.current=L());let t=(0,o.useRef)({onReady:e,face:r});t.current={onReady:e,face:r};let a=(0,o.useRef)(!1);return(0,o.useCallback)(i=>{a.current||(a.current=!0,t.current.onReady?.({ms:Math.max(0,L()-(n.current??L())),face:i}))},[])}var te=class extends o.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(r,n){console.error(`[graview] ${this.props.module} threw while rendering`,r,n.componentStack),this.props.report(r,{module:this.props.module})}render(){return this.state.failed?(0,y.jsxs)("div",{role:"alert","data-graview-face-error":this.props.module,...this.props.content?{"data-embed-content":""}:{},style:this.props.content?{flex:"1 1 auto",display:"grid",alignContent:"center",justifyItems:"center",gap:8,padding:24,background:"var(--graview-ground)",color:"var(--graview-ink)",fontSize:"0.9375rem"}:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,y.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,y.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{fe as a,he as b,ge as c,be as d,we as e,Se as f,ve as g,Ee as h,Re as i,xe as j,Ae as k,Fe as l,ke as m,te as n};
@@ -1 +1 @@
1
- import{a as U,b as Y,c as G,d as D}from"./chunk.HZB5F476.js";import"./chunk.YD3TKV6P.js";import"./chunk.4KC35UNR.js";import{G as ae,O as L,P as F,T as V,ca as _}from"./chunk.HT2BEOEV.js";import"./chunk.SDO3U72B.js";import{T as H,Vc as M,Za as K,_a as B}from"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";function O(n,t){let r=K(n);return r==="agent"?"agent":r!=="human"&&r!=="visitor"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var re=n=>n.ops.filter(t=>t.withheld!==!0);function X(n,t={}){let r=[];for(let e of n.batches()){let s=e.ops[0],d=e.ops.at(-1),l=re(e).length===0,h=l?void 0:Y(e.ops),c=r.at(-1);if(h&&c?.typed&&c.author&&U(c.author,e.author)&&c.typed.node===h.node&&c.typed.field===h.field){let S=G(c.typed,h);r[r.length-1]={...c,seq:d.seq+1,at:d.at,batch:e.id,batches:[...c.batches??[],e.id],typed:S,said:D(S,n.schema,n.graph,!1)};continue}r.push({seq:d.seq+1,from:s.seq,at:d.at,batch:e.id,maker:l?"person":O(e.author,t.me),author:l?void 0:e.author,said:h?D(h,n.schema,n.graph,!1):e.intent,declaration:!1,withheld:l,...h?{batches:[e.id],typed:h}:{}})}let 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(d=>d.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?O(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 J(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 Q(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?B(n.author,t):"the app"}var p=R(ae(),1);var o=R(V(),1),oe={kind:"human"},ie=[1,2,4,8],se=900,E={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 de(n,t,r){return[...new Set([...r,t,...n.map(i=>i.seq)])].sort((i,e)=>i-e)}function le(n,t){let r=n.withheld===!0;return{seq:n.seq+1,from:n.seq,at:n.at,batch:n.batch,maker:r?"person":O(n.author,t),author:r?void 0:n.author,said:n.batchIntent??n.intent,declaration:!1,withheld:r}}function ce(n,t){let r=0;for(let i=0;i<n.length;i++)n[i]<=t&&(r=i);return r}function pe(n,t,r){let i=J(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(d=>d.name));return e.ops.every(d=>d.mutation!==null&&s.has(d.mutation.name))?i:null}function we({face:n}){let t=L(),r=_(),i=r?.principal??oe,e=F(t.live,i),s=e.log.length,d=(0,p.useMemo)(()=>X(e,{me:i,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,i,t.host,s]),l=e.log.horizon,h=l>0&&t.host?.archived!==void 0,c=t.kept,S=(0,p.useMemo)(()=>h?c?.stops??Array.from({length:l},(a,g)=>g):[],[h,c,l]),m=(0,p.useMemo)(()=>de(d,l,S),[d,l,S]),f=t.archive,y=f?.seq??t.past?.seq??s,x=t.host?.kept&&(f?.behindKept||c!==void 0&&(y<=c.through||c.from>0&&y<=c.from))?t.host.kept:void 0,w=ce(m,y),b=m.length-1,j=y<l&&t.past?.seq===y?t.past.store.log.all().at(-1):void 0,q=j?le(j,i):y<l?void 0:[...d].reverse().find(a=>a.seq<=y&&a.seq>(m[w-1]??-1))??[...d].reverse().find(a=>a.seq<=y),[k,A]=(0,p.useState)(!1),[T,ee]=(0,p.useState)(1),[C,W]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(!k)return;if(w>=b){A(!1);return}let a=setTimeout(()=>t.show(m[w+1]),se/T);return()=>clearTimeout(a)},[k,w,b,T,m,t]);let z=(0,p.useMemo)(()=>t.past&&!f&&y>=l?pe(e,y,i):null,[t.past,f,e,y,l,i,s]),N=a=>Q(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),v=t.past?t.past.at?H(t.past.at,r?.locale):"the start":null,$=f?f.refused?"The archive could not be read":f.behindKept?"Nothing this far back is kept":"Reading the older changes from the archive\u2026":q?`${N(q)==="you"?"You":N(q)}: ${q.said}`:"Nothing had happened yet",I=(0,p.useRef)(null);(0,p.useLayoutEffect)(()=>{let a=I.current,g=a?.parentElement;if(n!=="scene"||!a||!g)return;let u=()=>g.style.setProperty("--graview-sheet",`${Math.ceil(a.getBoundingClientRect().height)+24}px`);u();let P=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return P?.observe(a),()=>{P?.disconnect(),g.style.removeProperty("--graview-sheet")}},[n]);let te=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:M("rail")}:{position:"sticky",top:0,zIndex:M("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,o.jsxs)("section",{ref:I,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...te,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:f?"Archived changes":v?`As of ${v}`:"Now"}),(0,o.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:$}),v?(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.jsxs)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:[h?(0,o.jsx)("span",{"data-testid":"timeline-archived",title:"Changes read from the archive as you scrub back",style:{position:"absolute",left:0,bottom:0,height:6,width:`${b===0?0:m.indexOf(l)/b*100}%`,borderRadius:2,background:"var(--graview-edge)"}}):null,m.slice(1).map((a,g)=>{let u=[...d].reverse().find(ne=>ne.seq===a);if(!u)return null;let P=b===0?0:(g+1)/b*100;return(0,o.jsx)("span",{"data-graview-tick":a,"data-maker":u.maker,...u.declaration?{"data-declaration":""}:{},title:`${E[u.maker]}: ${u.said}`,style:{position:"absolute",left:`calc(${P}% - 1px)`,bottom:0,width:u.declaration?4:2,height:u.declaration?22:12,borderRadius:2,background:u.declaration?"var(--graview-ink)":Z[u.maker],opacity:a<=y?1:.45}},`${a}:${u.batch??"declaration"}`)})]}),(0,o.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:b,step:1,value:w,"aria-valuetext":v?`As of ${v}. ${$}`:`Now. ${$}`,onChange:a=>{A(!1),t.show(m[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":k,onClick:()=>{!k&&w>=b&&t.show(m[0]),A(!k)},style:{minHeight:28,minWidth:64},children:k?"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:T,onChange:a=>ee(Number(a.currentTarget.value)),style:{minHeight:28},children:ie.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(E).filter(a=>d.some(g=>g.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]}}),E[a]]},a))}),(0,o.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[z?(0,o.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{W(null);try{e.undo([...z],{author:i,intent:v?`Restore to ${v}`:"Restore"}),t.show(null)}catch(a){W(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"})]})]}),C?(0,o.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:C}):null,f?.refused?(0,o.jsx)("span",{role:"alert","data-testid":"archive-refused",style:{color:"var(--graview-warn)"},children:f.refused}):null,x?(0,o.jsxs)("span",{"data-testid":"timeline-kept",style:{color:"var(--graview-ink-faint)"},children:[x.sentence,x.action?(0,o.jsxs)(o.Fragment,{children:[" ",(0,o.jsx)("a",{"data-testid":"timeline-kept-action",href:x.action.href,style:{color:"var(--graview-ink-muted)"},children:x.action.label})]}):null]}):null,l>0&&!h?(0,o.jsx)("span",{"data-testid":"timeline-horizon",style:{color:"var(--graview-ink-faint)"},children:"The changes before the timeline's start were archived."}):null]})}export{we as Timeline};
1
+ import{a as U,b as Y,c as G,d as D}from"./chunk.RQOX5YDW.js";import"./chunk.WC3DENU4.js";import"./chunk.VNDKKTED.js";import{G as ae,O as L,P as F,T as V,ca as _}from"./chunk.4MP72LPR.js";import"./chunk.SDO3U72B.js";import{T as H,Za as K,_a as B,ad as M}from"./chunk.VSCIXAHN.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";function O(n,t){let r=K(n);return r==="agent"?"agent":r!=="human"&&r!=="visitor"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var re=n=>n.ops.filter(t=>t.withheld!==!0);function X(n,t={}){let r=[];for(let e of n.batches()){let s=e.ops[0],d=e.ops.at(-1),l=re(e).length===0,h=l?void 0:Y(e.ops),c=r.at(-1);if(h&&c?.typed&&c.author&&U(c.author,e.author)&&c.typed.node===h.node&&c.typed.field===h.field){let S=G(c.typed,h);r[r.length-1]={...c,seq:d.seq+1,at:d.at,batch:e.id,batches:[...c.batches??[],e.id],typed:S,said:D(S,n.schema,n.graph,!1)};continue}r.push({seq:d.seq+1,from:s.seq,at:d.at,batch:e.id,maker:l?"person":O(e.author,t.me),author:l?void 0:e.author,said:h?D(h,n.schema,n.graph,!1):e.intent,declaration:!1,withheld:l,...h?{batches:[e.id],typed:h}:{}})}let 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(d=>d.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?O(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 J(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 Q(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?B(n.author,t):"the app"}var p=R(ae(),1);var o=R(V(),1),oe={kind:"human"},ie=[1,2,4,8],se=900,E={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 de(n,t,r){return[...new Set([...r,t,...n.map(i=>i.seq)])].sort((i,e)=>i-e)}function le(n,t){let r=n.withheld===!0;return{seq:n.seq+1,from:n.seq,at:n.at,batch:n.batch,maker:r?"person":O(n.author,t),author:r?void 0:n.author,said:n.batchIntent??n.intent,declaration:!1,withheld:r}}function ce(n,t){let r=0;for(let i=0;i<n.length;i++)n[i]<=t&&(r=i);return r}function pe(n,t,r){let i=J(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(d=>d.name));return e.ops.every(d=>d.mutation!==null&&s.has(d.mutation.name))?i:null}function we({face:n}){let t=L(),r=_(),i=r?.principal??oe,e=F(t.live,i),s=e.log.length,d=(0,p.useMemo)(()=>X(e,{me:i,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,i,t.host,s]),l=e.log.horizon,h=l>0&&t.host?.archived!==void 0,c=t.kept,S=(0,p.useMemo)(()=>h?c?.stops??Array.from({length:l},(a,g)=>g):[],[h,c,l]),m=(0,p.useMemo)(()=>de(d,l,S),[d,l,S]),f=t.archive,y=f?.seq??t.past?.seq??s,x=t.host?.kept&&(f?.behindKept||c!==void 0&&(y<=c.through||c.from>0&&y<=c.from))?t.host.kept:void 0,w=ce(m,y),b=m.length-1,j=y<l&&t.past?.seq===y?t.past.store.log.all().at(-1):void 0,q=j?le(j,i):y<l?void 0:[...d].reverse().find(a=>a.seq<=y&&a.seq>(m[w-1]??-1))??[...d].reverse().find(a=>a.seq<=y),[k,A]=(0,p.useState)(!1),[T,ee]=(0,p.useState)(1),[C,W]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(!k)return;if(w>=b){A(!1);return}let a=setTimeout(()=>t.show(m[w+1]),se/T);return()=>clearTimeout(a)},[k,w,b,T,m,t]);let z=(0,p.useMemo)(()=>t.past&&!f&&y>=l?pe(e,y,i):null,[t.past,f,e,y,l,i,s]),N=a=>Q(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),v=t.past?t.past.at?H(t.past.at,r?.locale):"the start":null,$=f?f.refused?"The archive could not be read":f.behindKept?"Nothing this far back is kept":"Reading the older changes from the archive\u2026":q?`${N(q)==="you"?"You":N(q)}: ${q.said}`:"Nothing had happened yet",I=(0,p.useRef)(null);(0,p.useLayoutEffect)(()=>{let a=I.current,g=a?.parentElement;if(n!=="scene"||!a||!g)return;let u=()=>g.style.setProperty("--graview-sheet",`${Math.ceil(a.getBoundingClientRect().height)+24}px`);u();let P=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return P?.observe(a),()=>{P?.disconnect(),g.style.removeProperty("--graview-sheet")}},[n]);let te=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:M("rail")}:{position:"sticky",top:0,zIndex:M("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,o.jsxs)("section",{ref:I,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...te,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:f?"Archived changes":v?`As of ${v}`:"Now"}),(0,o.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:$}),v?(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.jsxs)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:[h?(0,o.jsx)("span",{"data-testid":"timeline-archived",title:"Changes read from the archive as you scrub back",style:{position:"absolute",left:0,bottom:0,height:6,width:`${b===0?0:m.indexOf(l)/b*100}%`,borderRadius:2,background:"var(--graview-edge)"}}):null,m.slice(1).map((a,g)=>{let u=[...d].reverse().find(ne=>ne.seq===a);if(!u)return null;let P=b===0?0:(g+1)/b*100;return(0,o.jsx)("span",{"data-graview-tick":a,"data-maker":u.maker,...u.declaration?{"data-declaration":""}:{},title:`${E[u.maker]}: ${u.said}`,style:{position:"absolute",left:`calc(${P}% - 1px)`,bottom:0,width:u.declaration?4:2,height:u.declaration?22:12,borderRadius:2,background:u.declaration?"var(--graview-ink)":Z[u.maker],opacity:a<=y?1:.45}},`${a}:${u.batch??"declaration"}`)})]}),(0,o.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:b,step:1,value:w,"aria-valuetext":v?`As of ${v}. ${$}`:`Now. ${$}`,onChange:a=>{A(!1),t.show(m[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":k,onClick:()=>{!k&&w>=b&&t.show(m[0]),A(!k)},style:{minHeight:28,minWidth:64},children:k?"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:T,onChange:a=>ee(Number(a.currentTarget.value)),style:{minHeight:28},children:ie.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(E).filter(a=>d.some(g=>g.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]}}),E[a]]},a))}),(0,o.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[z?(0,o.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{W(null);try{e.undo([...z],{author:i,intent:v?`Restore to ${v}`:"Restore"}),t.show(null)}catch(a){W(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"})]})]}),C?(0,o.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:C}):null,f?.refused?(0,o.jsx)("span",{role:"alert","data-testid":"archive-refused",style:{color:"var(--graview-warn)"},children:f.refused}):null,x?(0,o.jsxs)("span",{"data-testid":"timeline-kept",style:{color:"var(--graview-ink-faint)"},children:[x.sentence,x.action?(0,o.jsxs)(o.Fragment,{children:[" ",(0,o.jsx)("a",{"data-testid":"timeline-kept-action",href:x.action.href,style:{color:"var(--graview-ink-muted)"},children:x.action.label})]}):null]}):null,l>0&&!h?(0,o.jsx)("span",{"data-testid":"timeline-horizon",style:{color:"var(--graview-ink-faint)"},children:"The changes before the timeline's start were archived."}):null]})}export{we as Timeline};