graview 0.1.48 → 0.1.50

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 (202) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +6 -6
  3. package/dist/index.js.map +1 -1
  4. package/dist/preview/chunk.24MUPV4Y.js +1 -0
  5. package/dist/preview/chunk.25VJPUDH.js +1 -0
  6. package/dist/preview/{chunk.PTXLOFQW.js → chunk.2P66HH5Y.js} +1 -1
  7. package/dist/preview/chunk.2VZSC2MB.js +1 -0
  8. package/dist/preview/chunk.3L5USMQD.js +1 -0
  9. package/dist/preview/chunk.3O3H37WD.js +1 -0
  10. package/dist/preview/{chunk.Y4MQGEUS.js → chunk.3SY6WWWQ.js} +2 -2
  11. package/dist/preview/{chunk.HC5N3CT2.js → chunk.4BQNG3W3.js} +1 -1
  12. package/dist/preview/chunk.4SHSEIHT.js +1 -0
  13. package/dist/preview/{chunk.NTLHEHOM.js → chunk.4VJARLJ5.js} +1 -1
  14. package/dist/preview/{chunk.I5TOMBIF.js → chunk.4XOSDCCE.js} +1 -1
  15. package/dist/preview/{chunk.CH5ROV7N.js → chunk.53BGPCM6.js} +1 -1
  16. package/dist/preview/{chunk.NQZ73QV7.js → chunk.5DZR46YG.js} +1 -1
  17. package/dist/preview/{chunk.GNBN3BK7.js → chunk.5RNB6IC5.js} +1 -1
  18. package/dist/preview/{chunk.E5GM2SMO.js → chunk.64TFAR5Z.js} +1 -1
  19. package/dist/preview/chunk.6BMCZPT6.js +1 -0
  20. package/dist/preview/chunk.6SHF6IL5.js +1 -0
  21. package/dist/preview/{chunk.RLXKDXPB.js → chunk.6VA5XFRR.js} +1 -1
  22. package/dist/preview/{chunk.GUMJEVVP.js → chunk.73BJYIYS.js} +1 -1
  23. package/dist/preview/chunk.7PJVMADH.js +2 -0
  24. package/dist/preview/{chunk.YVOABA2U.js → chunk.7QW6JYGP.js} +1 -1
  25. package/dist/preview/{chunk.NR5ODXMO.js → chunk.7VX6TBNY.js} +1 -1
  26. package/dist/preview/{chunk.5IM645XQ.js → chunk.A53G42QO.js} +1 -1
  27. package/dist/preview/chunk.ATWNWPME.js +1 -0
  28. package/dist/preview/chunk.AVCW7C6V.js +1 -0
  29. package/dist/preview/{chunk.V4BCB7N2.js → chunk.AXCRFJDL.js} +1 -1
  30. package/dist/preview/chunk.AXMC6XVT.js +2 -0
  31. package/dist/preview/{chunk.DAUC2DFY.js → chunk.BBNF52IB.js} +1 -1
  32. package/dist/preview/chunk.BJAQRV2R.js +1 -0
  33. package/dist/preview/chunk.BLS2G3CD.js +5 -0
  34. package/dist/preview/chunk.BNQL37AC.js +88 -0
  35. package/dist/preview/{chunk.QGE6YKSU.js → chunk.BORCUDGS.js} +1 -1
  36. package/dist/preview/{chunk.MVRG75ZD.js → chunk.CBJHYNNT.js} +1 -1
  37. package/dist/preview/{chunk.I7QIHN66.js → chunk.CDZVUCEK.js} +1 -1
  38. package/dist/preview/chunk.CR5MQMOL.js +1 -0
  39. package/dist/preview/{chunk.2GLJH253.js → chunk.DUIKIJKC.js} +1 -1
  40. package/dist/preview/{chunk.GT3F6FQ6.js → chunk.DUJUJN35.js} +1 -1
  41. package/dist/preview/chunk.ECSWXLBI.js +9 -0
  42. package/dist/preview/{chunk.KW65F4WA.js → chunk.EF3UB7US.js} +1 -1
  43. package/dist/preview/chunk.EJUZGIQ5.js +1 -0
  44. package/dist/preview/{chunk.NLBIX7LH.js → chunk.ETWREHXF.js} +1 -1
  45. package/dist/preview/{chunk.3BAHAK6W.js → chunk.ETX4QMM2.js} +1 -1
  46. package/dist/preview/{chunk.VQAQQW4Q.js → chunk.F5FJHKWV.js} +1 -1
  47. package/dist/preview/{chunk.D5ETRTAF.js → chunk.F7AFJRPP.js} +1 -1
  48. package/dist/preview/{chunk.TKMQROXF.js → chunk.FDFVGHQE.js} +1 -1
  49. package/dist/preview/{chunk.UJRBOUGC.js → chunk.FFPG4PHX.js} +1 -1
  50. package/dist/preview/{chunk.CJ23XTSW.js → chunk.FKUVIG6D.js} +1 -1
  51. package/dist/preview/chunk.GDYI5QDS.js +1 -0
  52. package/dist/preview/{chunk.OFRGDJYX.js → chunk.GPJFNLEJ.js} +1 -1
  53. package/dist/preview/chunk.GQI53L5P.js +1 -0
  54. package/dist/preview/{chunk.X7JMJSLU.js → chunk.GQX57JIE.js} +1 -1
  55. package/dist/preview/{chunk.ZH4NWRWB.js → chunk.GTUBIJTP.js} +1 -1
  56. package/dist/preview/{chunk.X7N3JUO4.js → chunk.GZEZMU2T.js} +2 -2
  57. package/dist/preview/{chunk.6VAFNCR4.js → chunk.HG34MT7C.js} +1 -1
  58. package/dist/preview/{chunk.DUWYF7BO.js → chunk.HGP3Q7QX.js} +1 -1
  59. package/dist/preview/chunk.IATLUWAD.js +1 -0
  60. package/dist/preview/chunk.IDQHSAAQ.js +1 -0
  61. package/dist/preview/chunk.IMFAPZ6J.js +21 -0
  62. package/dist/preview/{chunk.PQVUQVRL.js → chunk.JC5NXMG3.js} +1 -1
  63. package/dist/preview/chunk.JJP5OL5E.js +1 -0
  64. package/dist/preview/{chunk.QQTRAY5W.js → chunk.JLPBXG4P.js} +1 -1
  65. package/dist/preview/chunk.JLR74UFP.js +1 -0
  66. package/dist/preview/{chunk.2VTMTW7K.js → chunk.JYJNRCK5.js} +1 -1
  67. package/dist/preview/chunk.K4ITS63T.js +1 -0
  68. package/dist/preview/{chunk.KTFUVR4V.js → chunk.KFHXTHIY.js} +1 -1
  69. package/dist/preview/{chunk.QQCDCRR2.js → chunk.KGGWFL54.js} +1 -1
  70. package/dist/preview/{chunk.5A4AOFOA.js → chunk.KHRS2SKB.js} +1 -1
  71. package/dist/preview/{chunk.NWT5FPEK.js → chunk.KOPRZLJH.js} +18 -18
  72. package/dist/preview/{chunk.Z4UM4CMT.js → chunk.KQSD5MLY.js} +1 -1
  73. package/dist/preview/{chunk.DFK2NA6L.js → chunk.KT2LXHSI.js} +1 -1
  74. package/dist/preview/{chunk.ETR6AV47.js → chunk.KVEDMKUN.js} +1 -1
  75. package/dist/preview/{chunk.7LL7OSBY.js → chunk.KZ3UPV2L.js} +2 -2
  76. package/dist/preview/{chunk.J2V76Z6G.js → chunk.L2AV6JRA.js} +1 -1
  77. package/dist/preview/chunk.L5MDUZLQ.js +1 -0
  78. package/dist/preview/chunk.LDE5HLTM.js +1 -0
  79. package/dist/preview/{chunk.IRHSTUZM.js → chunk.LGHMUUTG.js} +1 -1
  80. package/dist/preview/{chunk.PPRSGM64.js → chunk.LJXAZ5TF.js} +1 -1
  81. package/dist/preview/{chunk.OZGETOTK.js → chunk.M55U47A6.js} +1 -1
  82. package/dist/preview/chunk.M5RHVUZ6.js +1 -0
  83. package/dist/preview/chunk.MBZ6N5SO.js +1 -0
  84. package/dist/preview/chunk.MCFLCC42.js +12 -0
  85. package/dist/preview/{chunk.MVSV7T6E.js → chunk.MCPLU2U4.js} +1 -1
  86. package/dist/preview/chunk.MQISKON2.js +1 -0
  87. package/dist/preview/{chunk.DHAK6PPX.js → chunk.MRUDTYOL.js} +2 -2
  88. package/dist/preview/chunk.N7FIUTVY.js +1 -0
  89. package/dist/preview/chunk.NPU4WYRB.js +1 -0
  90. package/dist/preview/{chunk.DPHTUTOS.js → chunk.O6SKKF4V.js} +1 -1
  91. package/dist/preview/{chunk.SKJJBLXF.js → chunk.OB7XLVK6.js} +1 -1
  92. package/dist/preview/{chunk.P6FQAILU.js → chunk.ODHCSYXX.js} +1 -1
  93. package/dist/preview/chunk.OHAWUOUN.js +1 -0
  94. package/dist/preview/chunk.OKQ4JXTW.js +1 -0
  95. package/dist/preview/{chunk.YDL5BSTG.js → chunk.OUNLAMBA.js} +1 -1
  96. package/dist/preview/chunk.OYQ6ZA6T.js +1 -0
  97. package/dist/preview/chunk.Q7RI4SI4.js +1 -0
  98. package/dist/preview/chunk.Q7UQ5OXA.js +1 -0
  99. package/dist/preview/{chunk.PMJUGHW4.js → chunk.QAUZDLDA.js} +1 -1
  100. package/dist/preview/{chunk.5Y3Q7ONN.js → chunk.QFI4L2HK.js} +1 -1
  101. package/dist/preview/{chunk.UGJSMNVO.js → chunk.QSZLY62B.js} +1 -1
  102. package/dist/preview/{chunk.LXCJVZF3.js → chunk.QZMBEG4E.js} +1 -1
  103. package/dist/preview/{chunk.TBRJOKIK.js → chunk.RK6BK5FD.js} +1 -1
  104. package/dist/preview/{chunk.76W2FXEC.js → chunk.ROJZLOKZ.js} +1 -1
  105. package/dist/preview/chunk.RXJBYP7B.js +1 -0
  106. package/dist/preview/chunk.S64LCR23.js +1 -0
  107. package/dist/preview/{chunk.TMDI7KRS.js → chunk.S7OFTGBQ.js} +4 -4
  108. package/dist/preview/chunk.SGMVLKZO.js +25 -0
  109. package/dist/preview/chunk.SJRXBTGP.js +1 -0
  110. package/dist/preview/{chunk.GH2SWMCW.js → chunk.SRU2YDTJ.js} +1 -1
  111. package/dist/preview/chunk.SVH3OMU2.js +1 -0
  112. package/dist/preview/{chunk.SFAAM4KE.js → chunk.SWLDDQJS.js} +1 -1
  113. package/dist/preview/{chunk.ENPCLMP2.js → chunk.T4UYLB3Y.js} +1 -1
  114. package/dist/preview/chunk.THTHNY4N.js +1 -0
  115. package/dist/preview/{chunk.V2GSBYDK.js → chunk.TL7UGUY4.js} +2 -2
  116. package/dist/preview/{chunk.N4M54YK6.js → chunk.TT6QBWRA.js} +1 -1
  117. package/dist/preview/{chunk.7VT3TRHR.js → chunk.TY6VILZB.js} +1 -1
  118. package/dist/preview/{chunk.DOBQ4LO4.js → chunk.U2M4SGUU.js} +1 -1
  119. package/dist/preview/chunk.U6FGWVGB.js +1 -0
  120. package/dist/preview/{chunk.KVJFY7N5.js → chunk.UCS3CBT4.js} +1 -1
  121. package/dist/preview/{chunk.2QNGGF55.js → chunk.UDTBFAS5.js} +2 -2
  122. package/dist/preview/chunk.UEL7FLL7.js +1 -0
  123. package/dist/preview/{chunk.ODRL5OWR.js → chunk.UGJ32SEL.js} +1 -1
  124. package/dist/preview/{chunk.HKA5T7DL.js → chunk.UJTRKSCK.js} +1 -1
  125. package/dist/preview/{chunk.QII2C5OV.js → chunk.UN2OB6OD.js} +1 -1
  126. package/dist/preview/chunk.UOC3SIYT.js +1 -0
  127. package/dist/preview/{chunk.HDE2MGGU.js → chunk.V5IWJ3ZV.js} +1 -1
  128. package/dist/preview/{chunk.LPD74WBI.js → chunk.VM43YREJ.js} +1 -1
  129. package/dist/preview/chunk.VVRI7DNK.js +1 -0
  130. package/dist/preview/{chunk.MZLWLIKR.js → chunk.WGRF6EHC.js} +1 -1
  131. package/dist/preview/{chunk.KVEDIBXS.js → chunk.XWLGHTH6.js} +1 -1
  132. package/dist/preview/chunk.YAS6LXQ7.js +1 -0
  133. package/dist/preview/{chunk.EMQ5POGB.js → chunk.YCJ74LZS.js} +1 -1
  134. package/dist/preview/chunk.YEKHDZ45.js +20 -0
  135. package/dist/preview/chunk.YEMNR4WU.js +1 -0
  136. package/dist/preview/{chunk.44G5A53D.js → chunk.YG3BLY67.js} +1 -1
  137. package/dist/preview/{chunk.J6ANRF6E.js → chunk.YUV7HZYG.js} +1 -1
  138. package/dist/preview/{chunk.5IPH2SCE.js → chunk.YYS45ZGQ.js} +1 -1
  139. package/dist/preview/{chunk.GACKGEUY.js → chunk.YZ6UKKEL.js} +1 -1
  140. package/dist/preview/{chunk.GVNYPFIM.js → chunk.ZBBCUK2K.js} +1 -1
  141. package/dist/preview/chunk.ZI66HRES.js +1 -0
  142. package/dist/preview/{chunk.XTMOFRHL.js → chunk.ZITDUHX3.js} +1 -1
  143. package/dist/preview/{chunk.2UIUMG23.js → chunk.ZK446PSX.js} +3 -3
  144. package/dist/preview/{chunk.6TKILWRM.js → chunk.ZKDJQDKX.js} +1 -1
  145. package/dist/preview/{chunk.QPICKSSM.js → chunk.ZOQ3OKKI.js} +1 -1
  146. package/dist/preview/chunk.ZVETGRUM.js +1 -0
  147. package/dist/preview/{chunk.G7WDMUDV.js → chunk.ZVOP2HHI.js} +1 -1
  148. package/dist/preview/index.html +51 -51
  149. package/dist/preview/page.js +2 -2
  150. package/package.json +6 -6
  151. package/dist/preview/chunk.2AZTW66C.js +0 -1
  152. package/dist/preview/chunk.37CJSWLL.js +0 -1
  153. package/dist/preview/chunk.3RP3N2JP.js +0 -1
  154. package/dist/preview/chunk.3UD7GG5B.js +0 -1
  155. package/dist/preview/chunk.4GQA3AJU.js +0 -1
  156. package/dist/preview/chunk.4KX53HCV.js +0 -9
  157. package/dist/preview/chunk.4TJOS4C7.js +0 -5
  158. package/dist/preview/chunk.4VW6THJF.js +0 -1
  159. package/dist/preview/chunk.664PBQAQ.js +0 -1
  160. package/dist/preview/chunk.72OZLWJL.js +0 -1
  161. package/dist/preview/chunk.72W6S746.js +0 -1
  162. package/dist/preview/chunk.7FRPNQU4.js +0 -1
  163. package/dist/preview/chunk.7QZYFLBS.js +0 -1
  164. package/dist/preview/chunk.B2IIEVBF.js +0 -21
  165. package/dist/preview/chunk.BDHKWVNX.js +0 -1
  166. package/dist/preview/chunk.DQ7M3LFV.js +0 -1
  167. package/dist/preview/chunk.DWPU56S5.js +0 -1
  168. package/dist/preview/chunk.E2AJ7U5Z.js +0 -1
  169. package/dist/preview/chunk.EXEZBZGW.js +0 -1
  170. package/dist/preview/chunk.EZJNUFNQ.js +0 -1
  171. package/dist/preview/chunk.FOP5RBGF.js +0 -1
  172. package/dist/preview/chunk.FPYL6REZ.js +0 -1
  173. package/dist/preview/chunk.FQYOTK34.js +0 -1
  174. package/dist/preview/chunk.GTPC6JOW.js +0 -2
  175. package/dist/preview/chunk.HG4DDNPG.js +0 -1
  176. package/dist/preview/chunk.ILZYRJDS.js +0 -1
  177. package/dist/preview/chunk.KA44WNB4.js +0 -25
  178. package/dist/preview/chunk.LGSFGNWE.js +0 -1
  179. package/dist/preview/chunk.LNON6P7K.js +0 -1
  180. package/dist/preview/chunk.MAFFUPCR.js +0 -1
  181. package/dist/preview/chunk.MTXEURFE.js +0 -1
  182. package/dist/preview/chunk.NFDLCUCC.js +0 -1
  183. package/dist/preview/chunk.NX7IIZLO.js +0 -1
  184. package/dist/preview/chunk.O45VO36H.js +0 -1
  185. package/dist/preview/chunk.OAIWGWGU.js +0 -3
  186. package/dist/preview/chunk.OVO6L5IP.js +0 -88
  187. package/dist/preview/chunk.PCEYZQAW.js +0 -1
  188. package/dist/preview/chunk.PVEPU6EA.js +0 -1
  189. package/dist/preview/chunk.QO7MDWID.js +0 -1
  190. package/dist/preview/chunk.RQBEQYB2.js +0 -1
  191. package/dist/preview/chunk.SA34Y3X5.js +0 -2
  192. package/dist/preview/chunk.SAHNXAV3.js +0 -1
  193. package/dist/preview/chunk.SUPWMV2F.js +0 -1
  194. package/dist/preview/chunk.TPG6IY4M.js +0 -1
  195. package/dist/preview/chunk.UT6642FC.js +0 -1
  196. package/dist/preview/chunk.V3N34DSU.js +0 -1
  197. package/dist/preview/chunk.W72TTRLX.js +0 -20
  198. package/dist/preview/chunk.X5G7FOPY.js +0 -12
  199. package/dist/preview/chunk.YEVA72L2.js +0 -1
  200. package/dist/preview/chunk.YLWON7X3.js +0 -1
  201. package/dist/preview/chunk.YUH43J2K.js +0 -1
  202. package/dist/preview/chunk.ZXZNAG35.js +0 -1
@@ -0,0 +1 @@
1
+ import"./chunk.25VJPUDH.js";import"./chunk.KHRS2SKB.js";import"./chunk.NB6WN4DO.js";import"./chunk.N7FIUTVY.js";import{a as L,b as R,c as N}from"./chunk.YYS45ZGQ.js";import{b as T}from"./chunk.YG3BLY67.js";import"./chunk.GZEZMU2T.js";import"./chunk.4VJARLJ5.js";import"./chunk.TL7UGUY4.js";import"./chunk.5RNB6IC5.js";import"./chunk.ZITDUHX3.js";import"./chunk.ETWREHXF.js";import"./chunk.YZ6UKKEL.js";import"./chunk.HJCQ6I3S.js";import"./chunk.XWLGHTH6.js";import"./chunk.TY6VILZB.js";import"./chunk.BBNF52IB.js";import"./chunk.AXMC6XVT.js";import"./chunk.GQI53L5P.js";import"./chunk.LDE5HLTM.js";import"./chunk.GTUBIJTP.js";import"./chunk.DUIKIJKC.js";import"./chunk.73BJYIYS.js";import"./chunk.OKQ4JXTW.js";import"./chunk.M5RHVUZ6.js";import"./chunk.MRUDTYOL.js";import"./chunk.OUNLAMBA.js";import"./chunk.HGP3Q7QX.js";import"./chunk.QSZLY62B.js";import"./chunk.7VX6TBNY.js";import"./chunk.64TFAR5Z.js";import"./chunk.5DZR46YG.js";import"./chunk.L5MDUZLQ.js";import"./chunk.IDQHSAAQ.js";import"./chunk.Q7RI4SI4.js";import"./chunk.XOZU4OFA.js";import"./chunk.CR5MQMOL.js";import"./chunk.SVH3OMU2.js";import"./chunk.TI4OSTQV.js";import"./chunk.JJP5OL5E.js";import"./chunk.WVUJXDXZ.js";import"./chunk.6SHF6IL5.js";import"./chunk.MQISKON2.js";import"./chunk.GQX57JIE.js";import"./chunk.LJXAZ5TF.js";import"./chunk.QFI4L2HK.js";import"./chunk.KFHXTHIY.js";import"./chunk.GZHZLJBF.js";import{r as C}from"./chunk.JLR74UFP.js";import"./chunk.OJGHDWI6.js";import"./chunk.HG34MT7C.js";import"./chunk.TT6QBWRA.js";import"./chunk.UCS3CBT4.js";import"./chunk.O6SKKF4V.js";import"./chunk.ZK446PSX.js";import{$ as x,G as S,I as $,S as p,ba as A}from"./chunk.SGMVLKZO.js";import"./chunk.SDO3U72B.js";import{Ic as k,ca as h}from"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import{b as i}from"./chunk.AJZBJBMO.js";var r=i(S(),1);var l=i(S(),1);var g=i(p(),1);var m={font:"inherit",fontSize:"0.875rem",minHeight:24,padding:0,border:0,borderRadius:2,background:"transparent",boxShadow:"none",color:"var(--graview-accent)",textDecoration:"underline",textUnderlineOffset:3,textAlign:"start",cursor:"pointer"};var e=i(p(),1);function Y({page:n=!1,go:E,onPick:y,onDiscard:D}){let{store:d,seatTalk:c}=x(),u=$(c),M=N(),b=E??M,{keep:P}=L(b),[H,f]=(0,r.useState)(!1);A();let t=u.draft;(0,r.useEffect)(()=>f(!1),[t]),(0,r.useEffect)(()=>{n||R(!1)},[n]);let v=(0,r.useRef)(null),w=t!==null&&!n;if((0,r.useLayoutEffect)(()=>{let s=v.current;if(!w||!s?.parentElement)return;let o=[];for(let a=s.previousElementSibling;a;a=a.previousElementSibling)a instanceof HTMLElement&&!a.inert&&a.tagName!=="STYLE"&&(a.inert=!0,o.push(a));return()=>{for(let a of o)a.inert=!1}},[w]),!t)return null;let G=T(t.drawn),F=d.schema.tryDefinition(t.kind),q=d.graph.nodesOfKind(t.kind).filter(s=>h(F,s)),z=()=>{c.setDraft(null),D?.()};return(0,e.jsxs)("section",{ref:v,"data-testid":"draft-frame","data-graview-draft-frame":n?"page":"scene","aria-label":`Draft: ${t.title}`,style:n?{display:"grid",gap:12,minWidth:0}:{position:"absolute",inset:12,zIndex:k("rail"),display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:12,boxShadow:"var(--graview-lift-high)",overflow:"hidden",minHeight:0},children:[(0,e.jsxs)("p",{"data-testid":"draft-line",style:{...K,...n?{}:{padding:"10px 16px"}},children:[n?(0,e.jsx)("span",{children:"Draft"}):(0,e.jsxs)("span",{children:["Draft \u2014 ",(0,e.jsx)("span",{"data-testid":"draft-title",style:{color:"var(--graview-ink)",fontWeight:600},children:t.title})]}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-keep",disabled:H,title:`Keep \u201C${t.title}\u201D as a lens: a place of its own`,onClick:()=>{f(!0),P(t).finally(()=>f(!1))},style:m,children:"Keep as a lens"}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-discard",onClick:z,style:m,children:"Discard"})]}),u.draftNote?(0,e.jsx)("p",{"data-testid":"draft-note",role:"status",style:{margin:0,padding:n?0:"0 16px 8px",fontSize:"0.8125rem",color:"var(--graview-warn)"},children:u.draftNote}):(0,e.jsx)("span",{}),(0,e.jsx)("div",{"data-testid":"draft-lens","data-graview-draft":t.lens.name,role:"group","aria-label":t.title,tabIndex:0,style:n?{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",scrollbarGutter:"stable",border:"1px solid var(--graview-edge)",borderRadius:12,background:"var(--graview-panel)"}:{minHeight:0,overflow:"auto",scrollbarGutter:"stable",display:"grid",gridTemplateRows:"minmax(0, 1fr)"},onClick:s=>{let o=s.target?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(!o||!d.graph.getNode(o))return;s.preventDefault();let a=d.graph.getNode(o);y?(c.setDraft(null),y(o)):b({to:"record",id:o,kind:a.kind,label:o,address:"",said:""})},children:(0,e.jsx)(C,{kind:t.kind,view:t.title,children:(0,e.jsx)(G,{nodes:q,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})]})}var K={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};export{Y as DraftFrame};
@@ -0,0 +1 @@
1
+ import{Xa as g}from"./chunk.BLS2G3CD.js";function y(e){return[`based on \u201C${e.basis}\u201D`,...e.confidence!==void 0?[`${Math.round(e.confidence*100)}% sure`]:[],...e.model?[e.model]:[]].join(" \xB7 ")}var u=e=>`Not yet kept by a person. ${e.by.name??e.by.id??"Something"} made it${e.lineage?`, ${y(e.lineage)}`:""}.`,p=e=>`${e.kind}\0${e.from}\0${e.to}`;function k(e,o){let r=new Map;for(let n of e){if(n.undoes!==void 0||o.has(n.id)||n.withheld)continue;let l=g(n.author),s=l==="human"||l==="visitor",c=new Map;for(let t of n.primitives){if(t.op!=="add-edge"&&t.op!=="remove-edge")continue;let i=p(t.edge),a=r.get(i)??c.get(i);if(r.delete(i),t.op==="remove-edge")a&&c.set(i,a);else if(a&&(s||!n.lineage))r.set(i,s?{...a,provisional:!1,keptBy:n.id}:a);else{let d=n.lineage;r.set(i,{edge:t.edge,made:n.id,by:n.author,...d?{lineage:d}:{},provisional:!s&&(d?.confidence??1)<1})}}}return r}var f=new WeakMap;function v({log:e}){let o=e.all(),r=`${e.horizon}:${o.length}:${o.at(-1)?.id}`,n=f.get(e);return n?.at!==r&&f.set(e,n={at:r,links:k(o,e.undoneIds())}),n.links}var L=(e,o)=>v(e).get(p(o));var m=e=>[...v(e).values()].filter(o=>o.provisional);export{y as a,u as b,L as c,m as d};
@@ -0,0 +1,21 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as dt,b as gt,c as mt,d as yt,e as ht,f as wt,g as vt}from"./chunk.ZBBCUK2K.js";import{a as ft,b as Se,c as bt}from"./chunk.KVEDMKUN.js";import{g as lt}from"./chunk.BRDAO2OF.js";import{e as pt}from"./chunk.4XOSDCCE.js";import{c as ut,f as ct,g as xe}from"./chunk.JLPBXG4P.js";import{b as ie,d as ae}from"./chunk.U2M4SGUU.js";import{a as ke,e as at}from"./chunk.BBLIT7S7.js";import{a as se,f as st,h as it}from"./chunk.ZKDJQDKX.js";import"./chunk.PXQVXBNG.js";import"./chunk.G446PWV6.js";import{a as H}from"./chunk.SDO3U72B.js";import"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import"./chunk.AJZBJBMO.js";var kt=["good","warn","bad","neutral","accent"],xt=["value","max","aria-label","placeholder","disabled"],St=["click","change"],Te=["_blank","_self"],Tt=["section","div","span","strong","p","hr","a","button","input","progress"],de={type:{oneOf:kt}},Me={"gv-card":{host:"section",properties:{tone:de},events:{},children:"any"},"gv-group":{host:"div",properties:{direction:{type:{oneOf:["row","column"]}}},events:{},children:"any"},"gv-title":{host:"strong",properties:{},events:{},children:"text"},"gv-text":{host:"p",properties:{tone:de},events:{},children:"text"},"gv-badge":{host:"span",properties:{tone:de},events:{},children:"text"},"gv-field":{host:"div",properties:{label:{type:"string"}},events:{},children:"text"},"gv-progress":{host:"progress",properties:{value:{type:"number",as:"value"},max:{type:"number",as:"max"},label:{type:"string",as:"aria-label"}},events:{},children:"none"},"gv-divider":{host:"hr",properties:{},events:{},children:"none"},"gv-link":{host:"a",properties:{href:{type:"url"}},events:{},children:"text"},"gv-button":{host:"button",properties:{tone:de,disabled:{type:"boolean",as:"disabled"}},events:{press:{from:"click"}},children:"text"},"gv-input":{host:"input",properties:{label:{type:"string",as:"aria-label"},value:{type:"string",as:"value"},placeholder:{type:"string",as:"placeholder"}},events:{change:{from:"change",detail:"value"}},children:"none"}},Ee=1e4;var jt=0,Bt=1,Ut=2,$t=3,Mt=1,Ft=2,zt=3,qt=1,Xt=3,Yt=8,Re="~",Ke=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),J=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function Et(n,e){return e.type==="url"?"href":e.as??`data-gv-${n.toLowerCase()}`}var Jt=2e3;function Rt(n,e){if(e==null)return{ok:!0,value:null};let d=n.type;if(d==="boolean")return typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,reason:"value"};if(d==="number")return typeof e=="number"&&Number.isFinite(e)?{ok:!0,value:String(e)}:{ok:!1,reason:"value"};if(typeof e!="string"||e.length>Jt)return{ok:!1,reason:d==="url"?"url":"value"};if(typeof d=="object")return d.oneOf.includes(e)?{ok:!0,value:e}:{ok:!1,reason:"value"};if(d==="url"){let m;try{m=new URL(e)}catch{return{ok:!1,reason:"url"}}return m.protocol!=="https:"||m.hostname===""||!/^https:\/\//i.test(e)?{ok:!1,reason:"url"}:{ok:!0,value:m.href}}return{ok:!0,value:e}}function Qt(n){let e=n.host==="a";return Tt.includes(n.host)&&(n.target===void 0||e&&Te.includes(n.target))&&Object.values(n.properties).every(d=>d.type!=="url"||e)&&Object.values(n.properties).every(d=>d.as===void 0||d.type!=="url"&&xt.includes(d.as))&&Object.values(n.events).every(d=>St.includes(d.from))}function Ge(n,e){let d=e.kit??Me,m=e.maxNodes??2e3,o=n.ownerDocument,y=[],w=new Map,W={dom:n,name:Re,component:{host:"div",properties:{},events:{},children:"any"},children:[],listeners:new Map,id:Re};w.set(Re,W);let K=e.links?new Set(e.links.origins.flatMap(r=>{try{let l=new URL(r);return l.protocol==="https:"&&l.hostname!==""?[l.origin]:[]}catch{return[]}})):void 0,_=0,E=0,O=!1,p=r=>{y.push(r),y.length>200&&y.shift()},R=()=>({dom:o.createComment(""),children:[],refused:!0,listeners:new Map}),M=(r,l,h)=>{let u=r.component;if(!Ke(u.properties,l))return p({reason:"property",element:r.name,name:l});let i=u.properties[l],g=Rt(i,h),v=g.ok&&i.type==="url"&&K&&typeof g.value=="string"&&!K.has(new URL(g.value).origin)?{ok:!1,reason:"url"}:g,T=r.dom,f=Et(l,i);if(!v.ok)return T.removeAttribute(f),p({reason:v.reason,element:r.name,name:l});let L=v.value;L===null||L===!1?T.removeAttribute(f):T.setAttribute(f,L===!0?"":L),f==="value"&&"value"in T&&(T.value=typeof L=="string"?L:""),f==="disabled"&&"disabled"in T&&(T.disabled=L!==null&&L!==!1)},k=(r,l,h)=>{let u=r.component;if(!Ke(u.events,l))return p({reason:"event",element:r.name,name:l});let i=r.listeners.get(l);if(i&&(i(),r.listeners.delete(l),E-=1),h==null)return;if(!J(h)||typeof h.listener!="number")return p({reason:"value",element:r.name,name:l});let g=h.listener,v=u.events[l],T=r.dom,f=()=>e.onEvent(g,v.detail==="value"?String(T.value??""):void 0);T.addEventListener(v.from,f),r.listeners.set(l,()=>T.removeEventListener(v.from,f)),E+=1},x=r=>{if(!r.refused){_-=1,r.id!==void 0&&w.delete(r.id);for(let l of r.listeners.values())l();E-=r.listeners.size,r.listeners.clear();for(let l of r.children)x(l)}},A=(r,l)=>{if(!J(r)||typeof r.id!="string"||w.has(r.id))return p({reason:"record"}),R();if(_>=m)return p({reason:"budget"}),O||(O=!0,e.onOverBudget?.()),R();let h=r.id,u=l.component.children;if(r.type===Yt)return R();if(r.type===Xt){if(u==="none")return p({reason:"child",element:l.name}),R();let f={dom:o.createTextNode(String(r.data??"").slice(0,Ee)),children:[],text:!0,listeners:new Map,id:h};return w.set(h,f),_+=1,f}if(r.type!==qt)return p({reason:"record"}),R();let i=String(r.element);if(!Ke(d,i)||!Qt(d[i]))return p({reason:"element",element:i}),R();if(u!=="any")return p({reason:"child",element:i}),R();let g=d[i],v=o.createElement(g.host);v.setAttribute("data-gv",i.replace(/^gv-/,"")),v.className=`graview-guest-${i.replace(/^gv-/,"")}`,g.host==="a"&&(v.setAttribute("rel","noopener noreferrer"),v.setAttribute("target",g.target??"_blank"),v.setAttribute("referrerpolicy","no-referrer")),g.host==="button"&&v.setAttribute("type","button");let T={dom:v,name:i,component:g,children:[],listeners:new Map,id:h};if(w.set(h,T),_+=1,J(r.properties))for(let[f,L]of Object.entries(r.properties))M(T,f,L);if(J(r.attributes))for(let f of Object.keys(r.attributes))p({reason:"attribute",element:i,name:f});if(J(r.eventListeners))for(let[f,L]of Object.entries(r.eventListeners))k(T,f,L);if(Array.isArray(r.children))for(let f of r.children){let L=A(f,T);T.children.push(L),v.appendChild(L.dom)}return T},N=r=>{if(!Array.isArray(r))return p({reason:"record"});let[l,h]=r,u=typeof h=="string"?w.get(h):void 0;if(!u)return p({reason:"record"});switch(l){case jt:{if(u.text)return p({reason:"record"});let i=Number(r[3]),g=Number.isInteger(i)&&i>=0&&i<=u.children.length?i:u.children.length,v=A(r[2],u);u.dom.insertBefore(v.dom,u.children[g]?.dom??null),u.children.splice(g,0,v);return}case Bt:{let i=Number(r[2]),g=u.children[i];if(!g)return p({reason:"record"});u.children.splice(i,1),g.dom.parentNode?.removeChild(g.dom),x(g);return}case Ut:if(!u.text)return p({reason:"record"});u.dom.data=String(r[2]??"").slice(0,Ee);return;case $t:{if(u===W||u.text)return p({reason:"record"});let i=String(r[2]),g=r[4]??Mt;return g===Mt?M(u,i,r[3]):g===zt?k(u,i,r[3]):p(g===Ft?{reason:"attribute",element:u.name,name:i}:{reason:"record"})}default:return p({reason:"record"})}};return{apply(r,l){if(!Array.isArray(r))return p({reason:"record"}),!0;for(let h=0;h<r.length;h+=1){if(l&&h%32===0&&l())return!1;N(r[h])}return!0},get refused(){return y},get size(){return _},get listening(){return E},dispose(){for(let r of W.children)x(r);W.children.length=0,n.replaceChildren()}}}var We=`
2
+ .graview-guest { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: var(--graview-ink, inherit); font: inherit; }
3
+ .graview-guest-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--graview-edge, #d0d0d0); border-radius: 10px; background: var(--graview-panel, transparent); }
4
+ .graview-guest-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
5
+ .graview-guest-group[data-gv-direction="row"] { flex-direction: row; flex-wrap: wrap; align-items: center; }
6
+ .graview-guest-title { font-weight: 600; font-size: 1rem; overflow-wrap: anywhere; }
7
+ .graview-guest-text { margin: 0; font-size: 0.875rem; line-height: 1.45; overflow-wrap: anywhere; }
8
+ .graview-guest-badge { align-self: flex-start; padding: 1px 8px; border: 1px solid currentColor; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; }
9
+ .graview-guest-field { font-size: 0.875rem; overflow-wrap: anywhere; }
10
+ .graview-guest-field[data-gv-label]::before { content: attr(data-gv-label) " "; color: var(--graview-ink-muted, inherit); }
11
+ .graview-guest-progress { width: 100%; }
12
+ .graview-guest-divider { width: 100%; margin: 2px 0; border: 0; border-top: 1px solid var(--graview-edge, #d0d0d0); }
13
+ .graview-guest-link { color: var(--graview-accent, inherit); text-decoration: underline; }
14
+ .graview-guest-button { align-self: flex-start; font: inherit; padding: 4px 12px; border-radius: 8px; border: 1px solid var(--graview-edge, #d0d0d0); background: var(--graview-panel, transparent); color: inherit; cursor: pointer; }
15
+ .graview-guest-input { font: inherit; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--graview-edge, #d0d0d0); }
16
+ .graview-guest [data-gv-tone="good"] { color: var(--graview-good, inherit); }
17
+ .graview-guest [data-gv-tone="bad"] { color: var(--graview-bad, inherit); }
18
+ .graview-guest [data-gv-tone="warn"] { color: var(--graview-warn, inherit); }
19
+ .graview-guest [data-gv-tone="accent"] { color: var(--graview-accent, inherit); }
20
+ .graview-guest [data-gv-tone="neutral"] { color: var(--graview-ink-muted, inherit); }
21
+ `;var Kt=new WeakSet;function Zt(n,e){if(n.startsWith("blob:"))return"blob:";try{return new URL(n,e.location.href).origin}catch{return n}}function Gt(n,e,d){let m=Zt(e,n),o=`this page's Content-Security-Policy${d?` (${d})`:""} does not allow a worker from ${m}: it needs worker-src ${m}`;return Kt.has(n)||(Kt.add(n),n.console?.warn?.(`Graview: worker views cannot start on this page, because ${o}. A host that will not allow ${m} serves each view's whole script from its own origin and passes worker: { url } (the @graview/guest README, "What the host page allows").`)),o}function er(n,e){return n===""?!0:e.startsWith("blob:")?n.startsWith("blob"):e.startsWith(n)||n.startsWith(e)}function le(n,e){let d="script"in e.source?n.URL.createObjectURL(new n.Blob([e.source.script],{type:"text/javascript"})):void 0,m="script"in e.source?d:e.source.url,o,y,w=!1,W=!1,K=0,_=0,E="",O=0,p=0,R=n.performance,M=R.now(),k,x=u=>{let i=u,g=String(i.effectiveDirective||i.violatedDirective||"").split(" ")[0];/^(worker-src|script-src|script-src-elem|child-src|default-src)$/.test(g)&&er(String(i.blockedURI??""),m)&&(k=g)},A=n.document;A?.addEventListener("securitypolicyviolation",x);let N=()=>A?.removeEventListener("securitypolicyviolation",x),r=()=>{W||(W=!0,y?.close(),o?.terminate(),o=void 0,n.clearTimeout(K),n.clearInterval(_),N(),d&&n.URL.revokeObjectURL(d))},l=(u,i)=>{W||(r(),e.onStop(u,i))},h=()=>{n.clearTimeout(K),N(),E=dt();let u=new n.MessageChannel;y=u.port1;let i=Math.max(1,e.silentMs),g=Math.max(10,Math.min(1e3,Math.floor(i/4)));M=R.now();let v=M;_=n.setInterval(()=>{let f=R.now();if(f-v>g*2&&(M+=f-v-g),v=f,f-M>=i)return l("silent");O+=1,u.port1.postMessage({type:"heartbeat",beat:O})},g);let T={graview:"host-hello",protocol:1,nonce:E,view:e.name};o.postMessage(T,[u.port2]),e.onReady(E,u.port1)};try{o=new n.Worker(m,{name:e.name})}catch(u){o=void 0;let i=u,g=i?.name==="SecurityError"?Gt(n,m,k):`the worker could not be made: ${String(i?.message??u)}`;queueMicrotask(()=>l("start",g))}return o&&(K=n.setTimeout(()=>l("start",`it never said it was ready in ${e.readyMs.toLocaleString("en-US")} ms`),e.readyMs),o.onerror=u=>{let i=typeof u.message=="string"&&u.message!==""?u.message:void 0;if(w)return void e.onError?.(i??"an error");n.clearTimeout(K),n.setTimeout(()=>!w&&l("start",k?Gt(n,m,k):i?`it failed before it said ready: ${i}`:"it failed before it said ready, and the engine gave no reason (a page policy that refuses it, or a script that does not load)"),0)},o.onmessage=u=>{if(!e.limiter.message()||w||!at(u.data)||u.data.protocol!==1){e.onDropped();return}w=!0,h()}),{get worker(){return o},answer(u){let i=u;return typeof i!="object"||i===null||i.type!=="heartbeat"||i.nonce!==E?!1:(typeof i.beat=="number"&&i.beat>p&&i.beat<=O&&(p=i.beat,M=R.now()),!0)},stop:r}}function ue(n,e){let d=e(),m=0;return{draw(o){let y=e();y-d>=1e3&&(d=y,m=0);let w=o(()=>m+(e()-y)>=n);return m+=e()-y,w&&m<n}}}var tr=Symbol.for("graview.view.clicked");function Wt(n,e){n[tr]=Object.freeze([...e])}var rr=H(()=>(__graviewPreload(import.meta.url,["./chunk.BRDAO2OF.js","./chunk.AJZBJBMO.js"]),import("./chunk.MCFLCC42.js"))),nr=H(()=>(__graviewPreload(import.meta.url,["./chunk.4XOSDCCE.js","./chunk.JLPBXG4P.js","./chunk.U2M4SGUU.js","./chunk.G446PWV6.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QZMBEG4E.js"))),or=H(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.SHNYYBNW.js"))),sr=H(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.6SHF6IL5.js","./chunk.MQISKON2.js","./chunk.GQX57JIE.js","./chunk.LJXAZ5TF.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.O6SKKF4V.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.F7AFJRPP.js"))),ir=H(()=>(__graviewPreload(import.meta.url,["./chunk.JLPBXG4P.js","./chunk.U2M4SGUU.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.L2AV6JRA.js"))),ar=H(()=>(__graviewPreload(import.meta.url,["./chunk.BBLIT7S7.js","./chunk.AJZBJBMO.js"]),import("./chunk.RRCPEHM4.js")));function dr(n,e,d){switch(n){case"manifest":return d??"Its manifest names something this app does not have.";case"source":return d??`Its code is longer than the ${e.maxSourceBytes.toLocaleString("en-US")} bytes a view may be.`;case"start":return`It could not start${d?`: ${d}.`:"."}`;case"error":return`It failed before it drew anything${d?`: ${d}`:"."}`;case"silent":return`It stopped answering for ${e.silentMs.toLocaleString("en-US")} ms.`;case"nodes":return`It drew more than the ${e.maxNodes.toLocaleString("en-US")} things a view may draw.`;case"flood":return`It sent more than ${e.messages} messages in ${e.messageWindowMs.toLocaleString("en-US")} ms.`;case"slow":return`It took longer than ${e.pushMs.toLocaleString("en-US")} ms to draw what it was shown.`}}function lr(n,e){let d=n.ownerDocument,m=d.defaultView,{manifest:o}=e,y=d.createElement("div");y.className="graview-worker-view",y.setAttribute("role","region"),y.setAttribute("aria-label",o.title??o.name),y.setAttribute("data-worker-view",o.name),y.style.cssText="display:block;position:relative;contain:layout paint style;isolation:isolate;overflow:clip;min-width:0",n.appendChild(y);let w=y.attachShadow({mode:"open"}),W=e.author?d.createElement("p"):void 0;W&&(W.className="graview-worker-view-author",W.setAttribute("data-worker-view-author",o.name),W.style.cssText="margin:4px 0 0;font-size:0.75rem;color:var(--graview-ink-muted, inherit)",W.textContent=e.author,n.appendChild(W));let K={applied:0,refused:0,dropped:0},_=ie(e.limits),E={maxSourceBytes:e.limits?.maxSourceBytes??256e3,maxNodes:e.limits?.maxNodes??5e3,messages:e.limits?.messages??120,messageWindowMs:e.limits?.messageWindowMs??1e3,pushMs:e.limits?.pushMs??1e3,silentMs:e.limits?.silentMs??5e3,drawMs:e.limits?.drawMs??100},O,p,R,M,k=!1,x={applied:0,refused:0,dropped:0},A=[],N=()=>{if(!p)return;let t=p.stats;K.applied+=t.applied-x.applied,K.refused+=t.refused-x.refused,K.dropped+=t.dropped-x.dropped,x={...t}},r=()=>{},l,h,u=()=>{let t=w.querySelector("[data-graview-view-root]"),c=m.ResizeObserver;h||!t||typeof c!="function"||(h=new c(b=>{let S=b[b.length-1]?.borderBoxSize?.[0],s=Math.ceil(S?S.blockSize:t.offsetHeight);s!==l&&(l=s,y.setAttribute("data-graview-content-height",String(s)),e.onContentHeight?.(s))}),h.observe(t))},i=()=>{h&&(h.disconnect(),h=void 0,l=void 0,y.removeAttribute("data-graview-content-height"),e.onContentHeight?.(void 0))},g=0,v=()=>{},T=()=>{v(),v=()=>{},N(),p?.dispose(),p=void 0,R?.stop(),r(),m.clearInterval(g)},f=(t,c)=>{if(k)return;k=!0,T(),i(),M?.dispose();let b=dr(t,E,c);y.removeAttribute("data-worker-view-drawn"),y.setAttribute("data-worker-view-failed",t),e.fallback!==!1&&(e.fallback??L)(y,t,b),e.onFailure?.(t,b)},L=(t,c,b)=>{let S=O??(()=>{try{return xe(e.store,e.principal,{manifest:o,...e.input?{input:e.input()}:{}})}catch{return}})(),s=d.createElement("div");s.setAttribute("data-graview-fallback",c),s.style.cssText="padding:12px;display:grid;gap:6px;color:var(--graview-ink, inherit);font-family:var(--graview-font-body, inherit)";let I=d.createElement("strong");I.textContent=o.title??o.name;let C=d.createElement("ul");C.style.cssText="margin:0;padding-left:1.2em";for(let re of[...S?.node?[S.node]:[],...S?.nodes??[]]){let ne=d.createElement("li");ne.textContent=re.label??re.id,C.appendChild(ne)}let U=d.createElement("p");U.style.cssText="margin:0;font-size:0.8125rem;color:var(--graview-ink-muted, inherit)",U.textContent=`This view was stopped. ${b}`,s.append(I,C,U),w.replaceChildren(s)},Oe=ct(o,e.store);if(Oe.length>0)return queueMicrotask(()=>f("manifest",Oe.join(" "))),he();let Ae=t=>{if(("source"in t?new TextEncoder().encode(t.source).length:"script"in t?new TextEncoder().encode(t.script).length:0)>E.maxSourceBytes)return["source"];let b="source"in t?ft(t.source):[];return b.length>0?["source",b.join(" ")]:void 0},$=e.worker,Le=typeof $=="function"?void 0:Ae($);if(Le)return queueMicrotask(()=>f(...Le)),he();let _e=vt(m,()=>Ne(),"blob"),ce=()=>wt(()=>e.theme?.()??yt(y),e.brand,_e),Ie="",pe=()=>{Ie=JSON.stringify(ce()),p?.push()},Ne=()=>{p&&JSON.stringify(ce())!==Ie&&pe()},At=ht(d,Ne),j,B,Pe=o.pictures?or().then(({createGuestPictures:t})=>{k||(j=t(m,{as:"blob",view:`"${o.title??o.name}"`,pictures:o.pictures,...e.limits?{limits:e.limits}:{},...e.file?{file:e.file}:{},moved:()=>p?.push(),onLeft:c=>{V?.postMessage({type:"notice",text:c}),e.onProblem?.(c)}}))}):Promise.resolve();r=()=>{At(),_e.dispose(),j?.dispose(),X?.dispose(),B?.dispose(),te?.dispose()};let V,Q=t=>V?.postMessage(t),Ce=!1,Ve=!1,Z=()=>y.toggleAttribute("data-worker-view-drawn",!k&&Ve&&M!==void 0&&A.length===0&&z.size===0&&!j?.waiting()&&!(B?.waiting??0)),F=m.performance,z=new Map,ee=F.now(),fe=Math.max(10,Math.min(250,Math.floor(E.pushMs/4))),Lt=()=>{g||(ee=F.now(),g=m.setInterval(()=>{let t=F.now(),c=t-ee>fe*2?t-ee-fe:0;ee=t;for(let[b,S]of z){let s=S+c;if(z.set(b,s),t-s>=E.pushMs)return f("slow")}},fe))},_t=ue(E.drawMs,()=>F.now()),De=()=>{},ge=t=>{if(k)return;if(!M)return void A.push(t);let c=M;if(!_t.draw(S=>t[0]==="render"?c.apply(t[1],S):(c.style(t[1]),!0)))return f("slow");t[0]==="render"&&De()},He=()=>st(e.store.schema,new Set([...e.store.kindsKeptFrom(e.principal),...e.store.modules.disabledKinds])),q=it({sees:t=>e.store.seenBy(e.principal).graph.has(t),places:()=>se(e.places?.()??[]),lists:He,schema:e.store.schema,...e.onNavigate?{onNavigate:e.onNavigate}:e.goTo?{onNavigate:t=>gt(e.goTo(),t)}:{},...e.hrefOf?{hrefOf:e.hrefOf}:!e.onNavigate&&e.goTo?{hrefOf:t=>mt(e.goTo(),t)}:{},onLost:t=>{V?.postMessage({type:"notice",text:t}),e.onProblem?.(t)}}),D=new Set,je=new Set,X,Be=!1,Ue=()=>{Be||(Be=!0,sr().then(({createGuestMedia:t})=>{k||(X=t(m,{view:`"${o.title??o.name}"`,pictures:o.pictures!==void 0,shown:()=>O,...e.file?{file:e.file}:{},onProblem:c=>{V?.postMessage({type:"notice",text:c}),e.onProblem?.(c)}}),X.refresh(w))},()=>e.onProblem?.(`The view "${o.title??o.name}" places a video or a full-screen viewer, and the host's player could not be loaded.`)))},$e=!1,Fe=!1,me=new Map,ze=()=>{$e||!o.accepts?.length||($e=!0,ir().then(({createGuestDrops:t})=>{k||(B=t(m,{shadow:w,manifest:o,store:e.store,principal:e.principal,files:()=>e.files?.(),shown:()=>D,hears:()=>Fe,idOf:c=>M?.renderer.idOf(c),send:Q,change:(c,b)=>{if(!p)return{ok:!1,reason:"refused",message:"The view has gone."};let S=p.change(c,b);return N(),S},handed:c=>me.set(c.href,c),onProblem:c=>{V?.postMessage({type:"notice",text:c}),e.onProblem?.(c)},onBusy:()=>Z()}),B.refresh())},()=>e.onProblem?.(`The view "${o.title??o.name}" takes files, and the host's drop could not be loaded.`)))},te,qe=[],Xe=!1,It=t=>{qe=t,te?.bind(t),!(Xe||t.length===0)&&(Xe=!0,ar().then(({createGuestGestures:c,unheardWords:b})=>{if(!k){if(o.gestures!==!0){let S=b(o.title??o.name);return V?.postMessage({type:"notice",text:S}),e.onProblem?.(S)}te=c(w,{root:()=>w.querySelector("[data-graview-view-root]")??void 0,idOf:S=>M?.renderer.idOf(S),send:Q}),te.bind(qe)}},()=>{}))},Nt=t=>{let c=e.store.seenBy(e.principal).graph;for(let b of D){let S=c.getNode(b);for(let s of Object.values(S??{}))for(let I of ut(s))if(I.href===t)return I}},Ye=t=>{if(t.localName==="graview-video")return Ue();t.hasAttribute("data-lightbox")&&(t.setAttribute("aria-haspopup","dialog"),Ue())};Promise.all([rr(),nr()]).then(([{createOpenDrawing:t,handedLinks:c,judgeLink:b,linkRefusedWords:S},{createPressReader:s,createSaver:I,fillPrefills:C,judgePress:U,markPresses:re,prefillOf:ne,quietPictures:Pt}])=>{if(k)return;let Y=s(),Qe=(a,G)=>{let P=M?.renderer.idOf(a);P!==void 0&&Q({type:"dom-event",target:P,event:"acted",pressed:G})},we=I({reader:Y,save:(a,G)=>{if(!p)return;let P=p.pressed(U(e.store,o,D,a));N(),Qe(G,{as:a.as,...P})}}),Ze=()=>we.flush();m.addEventListener("pagehide",Ze),v=()=>{m.removeEventListener("pagehide",Ze),we.flush()};let Ct=new WeakSet;De=()=>{q.refresh(w),re(w),Pt(w),C(w,Y,Ct,a=>ne(e.store,e.principal,o,D,a)),X?.refresh(w),B?.refresh()};let et,tt=new Set,Vt=()=>(et!==O&&([et,tt]=[O,c(O)]),tt),rt=new Set;M=t(w,{origin:e.origin??m.location.origin,link:a=>b(a,{handed:Vt(),...e.links?{origins:e.links.origins}:{}}),...e.asset?{asset:e.asset}:{},...e.images?{imageOrigins:e.images.origins}:{},...o.pictures?{picture:a=>j?.drawn(a)}:{},onRefused:a=>{if(a.reason==="url"&&a.element==="a"&&a.address!==void 0&&!rt.has(a.address)){rt.add(a.address);let P=S(a.address,e.links?.origins);return V?.postMessage({type:"notice",text:P}),e.onProblem?.(P)}if(a.reason!=="url"||a.element!=="img"||a.address===void 0||je.has(a.address))return;je.add(a.address);let G=lt(a.address,{...e.images?{origins:e.images.origins}:{},assets:e.asset!==void 0},a.length);V?.postMessage({type:"notice",text:G}),e.onProblem?.(G)},...e.limits?.maxNodes!==void 0?{maxNodes:e.limits.maxNodes}:{},onOverBudget:()=>f("nodes"),send:Q,onFieldSet:a=>Y.filled(a),onAttribute:(a,G)=>{(G==="data-record"||G==="data-place")&&q.link(a),G==="data-lightbox"&&Ye(a),G==="data-drop"&&ze()},decorate:a=>{(a.hasAttribute("data-record")||a.hasAttribute("data-place"))&&q.link(a),Ye(a),a.hasAttribute("data-drop")&&ze()},before:(a,G,P)=>{Y.heard(a,G),we.heard(a,G,P),q.pressed(a,G,P);let ve=G.closest("a[href]");ve&&P.contains(ve)&&!ve.hasAttribute("data-graview-link")&&a.type==="click"&&a.stopPropagation();let oe=G.closest("[data-lightbox]"),nt=a.type==="keydown"?a.key:void 0;if(oe&&P.contains(oe)&&a.isTrusted&&(a.type==="click"||(nt==="Enter"||nt===" ")&&oe.localName!=="button")&&(a.preventDefault(),a.stopPropagation(),X?.open(oe)),B?.before(a,G,P))return!1;let be=Y.press(a,G,P);if(!be||!p)return;a.stopPropagation(),a.type==="keydown"&&a.preventDefault();let Dt=p.pressed(U(e.store,o,D,be));N();let ot={as:be.as,...Dt},Ht=G.closest("[data-act]");return queueMicrotask(()=>Qe(Ht,ot)),{pressed:ot}}});for(let a of A.splice(0))ge(a);u(),Z()},()=>f("start","the view's drawing could not be loaded"));let ye=t=>R=le(m,{source:t,name:o.name,limiter:_,readyMs:e.limits?.readyMs??5e3,silentMs:e.limits?.silentMs??5e3,onDropped:()=>K.dropped+=1,onStop:(c,b)=>f(c,b),onError:c=>{Ce||f("error",c)},onReady:(c,b)=>{V=b,Lt();let S=ae({store:e.store,principal:e.principal,view:o.name,nonce:c,send:s=>{s.type==="props"&&typeof s.push=="number"&&(z.set(s.push,F.now()),Z()),b.postMessage(s)},props:()=>{let s=xe(e.store,e.principal,{manifest:o,...e.input?{input:e.input()}:{},theme:ce(),...e.places?{places:se(e.places())}:{}});return D=new Set([...s.node?[s.node.id]:[],...(s.nodes??[]).map(I=>I.id)]),O=s,s},...j?{hand:j.hand}:{},judgeAct:(s,I)=>pt(e.store,o,s,I,{shown:D,file:C=>me.get(C)??Nt(C),dropped:C=>me.has(C)}),onHears:s=>{s.includes("drop")&&(Fe=!0)},onGestures:It,onClicks:s=>Wt(y,s),onRender:s=>{Ce=!0,ge(["render",s])},onPushed:(s,I)=>{if(z.delete(s),I>=E.pushMs)return f("slow");Ve=!0,Z()},onFlood:()=>f("flood"),onStyle:s=>ge(["style",s]),places:()=>[...new Set([...se(e.places?.()??[]).map(s=>s.as),...He().map(s=>s.slug)])],...e.limits?{limits:e.limits}:{},limiter:_});p=S,b.onmessage=({data:s})=>{if(!R?.answer(s)&&(S.receive(s),N(),!k&&s?.nonce===c&&s.type==="navigate")){let I={...s.where!==void 0?{where:s.where}:{},...s.section!==void 0?{section:s.section}:{}},C=typeof s.place=="string"?{place:s.place,...I}:typeof s.to=="string"&&{record:s.to,...I};C&&q.go(C)}},pe()}}),Je=t=>{"source"in t?(o.pictures?Promise.all([Se(t.source),Pe]).then(([c])=>c):Se(t.source)).then(c=>{k||ye({script:c})},()=>f("start","the view's runtime could not be loaded")):o.pictures?Pe.then(()=>{k||ye(t)},()=>f("start","the view's pictures could not be loaded")):ye(t)};return typeof $=="function"?bt($).then(t=>{if(k)return;let c=Ae(t);c?f(...c):Je(t)},t=>f("source",`Its code did not arrive${t instanceof Error&&t.message?`: ${t.message}`:""}.`)):Je($),he();function he(){return{element:y,shadow:w,get worker(){return R?.worker},update:()=>{p&&pe()},get stats(){return N(),K},get refused(){return M?.refused??[]},get contentHeight(){return l},dispose(){k=!0,T(),h?.disconnect(),M?.dispose(),y.remove(),W?.remove()}}}}var Ot="graview-guest-kit";function Vr(n,e){let d=n.ownerDocument,m=d.defaultView;if(!d.getElementById(Ot)){let x=d.createElement("style");x.id=Ot,x.textContent=We,d.head.appendChild(x)}let o=d.createElement("div");o.className="graview-guest",o.setAttribute("role","group"),o.setAttribute("aria-label",e.title??e.view),o.setAttribute("data-guest-view",e.view),n.appendChild(o);let y={applied:0,refused:0,dropped:0},w=ie(e.limits),W=ue(e.limits?.drawMs??100,()=>m.performance.now()),K,_,E,O=!1,p={applied:0,refused:0,dropped:0},R=()=>{if(!K)return;let x=K.stats;y.applied+=x.applied-p.applied,y.refused+=x.refused-p.refused,y.dropped+=x.dropped-p.dropped,p={...x}},M=()=>{R(),K?.dispose(),K=void 0,E?.stop()},k=(x,A)=>{O||(O=!0,M(),_?.dispose(),e.onFailure?.(x,A))};return E=le(m,{source:e.worker,name:e.view,limiter:w,readyMs:e.limits?.readyMs??5e3,silentMs:e.limits?.silentMs??5e3,onDropped:()=>y.dropped+=1,onStop:(x,A)=>k(x,A),onReady:(x,A)=>{let N=Ge(o,{...e.kit?{kit:e.kit}:{},...e.links?{links:e.links}:{},onEvent:(l,h)=>A.postMessage({type:"event",listener:l,...h!==void 0?{detail:h}:{}}),...e.limits?.maxNodes!==void 0?{maxNodes:e.limits.maxNodes}:{},onOverBudget:()=>k("budget")});_=N;let r=ae({store:e.store,principal:e.principal,view:e.view,nonce:x,send:l=>A.postMessage(l),onRender:l=>{W.draw(h=>N.apply(l,h))||k("slow")},...e.input?{input:e.input}:{},...e.onNavigate?{onNavigate:e.onNavigate}:{},onSize:e.onSize??(l=>o.style.minHeight=`${l}px`),...e.limits?{limits:e.limits}:{},limiter:w});K=r,A.onmessage=l=>{E?.answer(l.data)||(r.receive(l.data),R())},r.push()}}),{element:o,get worker(){return E?.worker},update:()=>K?.push(),get stats(){return R(),y},get refused(){return _?.refused??[]},dispose(){O=!0,M(),_?.dispose(),o.remove()}}}export{Me as GUEST_KIT,We as GUEST_KIT_CSS,Te as KIT_LINK_TARGETS,kt as KIT_TONES,Ge as createKitRenderer,Et as hostAttribute,Rt as kitValue,Vr as mountGuestWorker,lr as mountWorkerView};
@@ -1 +1 @@
1
- import{b as mt}from"./chunk.MAFFUPCR.js";import{a as pt}from"./chunk.PPRSGM64.js";import{f as dt}from"./chunk.5Y3Q7ONN.js";import{a as F,f as q}from"./chunk.KTFUVR4V.js";import{$ as rt,F as Q,Fb as ft,G as X,I as k,O as G,Qc as ct,R as tt,T as nt,U as et,da as _,db as lt,fa as M,gb as ut,ha as ot,ka as at,ma as st}from"./chunk.4TJOS4C7.js";import{d as it}from"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";function J(t){let e=[],n=!0;for(let r of t){if(r.text.length===0)continue;let s=r.as==="close"||r.text===","||r.text===":"||r.text.startsWith("'")||n;e.push({part:r,space:!s}),n=r.as==="open"}return e}function D(t,e){return J(t).map(({part:n,space:r})=>`${r?" ":""}${e?n.said??n.text:n.text}`).join("")}function Et(t){return D(t,!1)}function Pt(t){return D(t,!0)}function yt(t,e=!1){let n=e?t.said:t.text;return t.record!==void 0?`${t.record} \u2014 ${n}`:n}function z(t){let e=u=>J(u).map(({part:o,space:a})=>({...o,space:a})),n=e(t.parts),r=t.when&&t.when.length>0?e(t.when):void 0,s=u=>`${D(n,u)}${r?`, when ${D(r,u)}`:""}`;return{...t,parts:n,...r?{when:r}:{},text:s(!1),said:s(!0)}}function Lt(t,e=!1){return t.line?yt(t.line,e):t.message}var gt=60,O=t=>({text:t,as:"name"}),c=(t,e)=>e===void 0?{text:t,as:"word"}:{text:t,as:"word",said:e},L=(t,e)=>e===void 0||e===t?{text:t,as:"value"}:{text:t,as:"value",said:e},R=(t,e)=>({text:t,as:"op",said:e}),v={text:"(",as:"open"},w={text:")",as:"close"},N={text:"\u2014",as:"value",said:"empty"},V={">=":["\u2265","at least"],"<=":["\u2264","at most"],"<":["<","less than"],">":[">","more than"],"==":["=","is"],"!=":["\u2260","is not"]},B={">=":"<","<=":">","<":">=",">":"<=","==":"!=","!=":"=="},At={"+":["+","plus"],"-":["\u2212","minus"],"*":["\xD7","times"],"/":["\xF7","divided by"],"%":["mod","modulo"]},xt=t=>t.t==="binary"&&t.op in V;function I(t){return rt(t)}function bt(t){let{schema:e}=t,n=l=>l===null?void 0:e.tryDefinition(l),r=(l,m)=>{let g=n(l)?.edges;return g&&Object.hasOwn(g,m)?g[m]:void 0},s=(l,m)=>{let g=r(l,m)?.to;return Array.isArray(g)&&g.length===1?g[0]:null},u=(l,m)=>{let g=(e.edge(m)?.from??[]).filter(W=>{let K=r(W,m)?.to;return l===null||K==="*"||Array.isArray(K)&&K.includes(l)});return g.length===1?g[0]:null},o=(l,m)=>r(l,m)?M(m).toLowerCase():I(at(n(l),m)),a=l=>I(ot(e,l)),d=l=>I(dt(e).get(l)?.label??M(l)),b=l=>I(st(n(l),l)),i=(l,m)=>{let g=l===null?void 0:t.formatOf?.(l,m);if(g?.format)return g;let W=t.said?.get(m);return W?{...g,format:W}:g},p=l=>_(e.tryDefinition(l.kind),l),h=t.money?.locale,y=(l,m)=>{if(l==null)return N;if(l instanceof F){if(l.nodes.length===0)return N;let A=l.nodes.slice(0,3).map(p),Y=l.nodes.length-A.length;return L(Y>0?`${A.join(", ")} and ${Y} more`:A.length>1?`${A.slice(0,-1).join(", ")} and ${A[A.length-1]}`:A[0])}if(Array.isArray(l))return L(`{${l.map(A=>y(A,m).text).join(", ")}}`,l.map(A=>y(A,m).text).join(" or "));if(typeof l=="object")return L(p(l));if(typeof l=="boolean")return L(l?"yes":"no");let g=m?.format??(m?i(m.kind,m.key):void 0);if(typeof l=="number")return L(g&&g.format!=="date"?ft(l,{...t.money,...g}):et(l,h));if(Q.test(l)||g?.format==="date")return L(G(nt(l,t.money?.timeZone)??l.slice(0,10),h));if(X.test(l))return L(tt(l,h,t.money?.timeZone));let W=m&&m.kind!==null?n(m.kind)?.display?.format?.[m.key]:void 0;if(W)return L(W(l));let K=l.length>gt?`${l.slice(0,gt-1).trimEnd()}\u2026`:l;return L(/^[a-z][a-z0-9]*([-_][a-z0-9]+)*$/.test(K)?K.replace(/[-_]+/g," "):K)};return{definition:n,relation:r,farOf:s,nearOf:u,fieldName:o,plural:a,noun:b,factName:d,formatOf:i,valueWords:y,locale:h}}function P(t,e,n){if(t.t==="ident")return{kind:e,key:t.name};if(t.t==="member")return{kind:E(t.object,e,n),key:t.name};if(t.t==="call"&&(t.fn==="sum"||t.fn==="min"||t.fn==="max")&&t.args.length===2){let r=E(t.args[0],e,n),s=t.args[1];if(s.t==="ident")return{kind:r,key:s.name};if(s.t==="lit"&&typeof s.value=="string")return{kind:r,key:s.value}}if(t.t==="binary"&&(t.op==="+"||t.op==="-"))return P(t.left,e,n)??P(t.right,e,n);if(t.t==="call"&&t.fn==="if"&&t.args.length===3)return P(t.args[1],e,n)??P(t.args[2],e,n)}function E(t,e,n){switch(t.t){case"ident":return n.relation(e,t.name)?n.farOf(e,t.name):null;case"member":return n.farOf(E(t.object,e,n),t.name);case"where":return E(t.set,e,n);case"binary":return t.op==="|"||t.op==="&"||t.op==="-"?E(t.left,e,n):null;case"call":{let r=s=>{let u=t.args[s];return u?.t==="lit"&&typeof u.value=="string"?u.value:void 0};return t.fn==="all"?r(0)??null:t.fn==="out"?t.args.length===2?n.farOf(E(t.args[0],e,n),r(1)??""):n.farOf(e,r(0)??""):t.fn==="in"?t.args.length===2?n.nearOf(E(t.args[0],e,n),r(1)??""):n.nearOf(e,r(0)??""):(t.fn==="first"||t.fn==="sort")&&t.args[0]?E(t.args[0],e,n):null}default:return null}}function j(t){return t.t==="binary"?t.op==="||"?H(t)?4:1:t.op==="&&"?2:t.op in V||t.op==="in"?4:t.op==="+"||t.op==="-"?5:t.op==="*"||t.op==="/"||t.op==="%"?6:4.5:t.t==="unary"&&t.op==="!"?3:t.t==="where"?3.5:9}var $=t=>t.t==="lit",x=(t,e)=>t.t==="call"&&t.fn===e;function C(t,e){return t.t==="binary"&&t.op===e?[...C(t.left,e),...C(t.right,e)]:[t]}function H(t){if(t.t!=="binary"||t.op!=="||")return;let e=[];e.push(...C(t,"||"));let n,r=[];for(let s of e){if(s.t!=="binary"||s.op!=="=="||!$(s.right)||typeof s.right.value!="string"||n&&JSON.stringify(ht(n))!==JSON.stringify(ht(s.left)))return;n=s.left,r.push(s.right)}return n?{subject:n,values:r}:void 0}var ht=t=>JSON.parse(JSON.stringify(t,(e,n)=>e==="at"?void 0:n));function f(t,e,n,r){let s=(u,o,a=e)=>j(u)<o?[v,...f(u,a,n),w]:f(u,a,n);switch(t.t){case"lit":return[n.valueWords(t.value,r)];case"list":return[n.valueWords(t.items.map(u=>u.t==="lit"?u.value:null),r)];case"ident":return[O(n.fieldName(e,t.name))];case"member":{let u=x(t.object,"first")&&t.object.args[0]&&x(t.object.args[0],"all"),o=E(t.object,e,n);if(u&&o)return e!==null&&n.fieldName(e,t.name)===n.fieldName(o,t.name)&&n.definition(e)?.fields?.shape&&Object.prototype.hasOwnProperty.call(n.definition(e).fields.shape,t.name)?[O(`${n.noun(o)}'s ${n.fieldName(o,t.name)}`)]:[O(n.fieldName(o,t.name))];let a=f(t.object,e,n),d=a[a.length-1];return a.length===1&&d?.as==="name"?[O(`${d.text}'s ${n.fieldName(o,t.name)}`)]:[...a,c("'s"),O(n.fieldName(o,t.name))]}case"unary":return t.op==="-"?[R("\u2212","minus"),...s(t.operand,7)]:T(t.operand,e,n);case"where":{let u=E(t.set,e,n),o=f(t.filter,u,n),a=o.every(d=>d.as==="name"||d.as==="word"&&d.text==="not");return[...s(t.set,4),...a?[]:[c("with")],...j(t.filter)<=2?[v,...o,w]:o]}case"binary":return Rt(t,e,n);case"call":return jt(t,e,n)}}function T(t,e,n){return xt(t)?Rt({...t,op:B[t.op]},e,n):x(t,"present")||x(t,"exists")?[...f(t.args[0],e,n),R("=","is"),N]:t.t==="ident"?[c("not"),O(n.fieldName(e,t.name))]:[c("not"),v,...f(t,e,n),w]}function Rt(t,e,n){let r=(o,a)=>j(o)<a?[v,...f(o,e,n),w]:f(o,e,n);if(t.op==="&&"||t.op==="||"){let o=H(t);if(o){let d=P(o.subject,e,n);return[...f(o.subject,e,n),R("\u2208","is one of"),n.valueWords(o.values.map(b=>b.value),d)]}let a=t.op==="&&"?2:1;return[...r(t.left,a),c(t.op==="&&"?"and":"or"),...r(t.right,a+.5)]}if(t.op in V){if($(t.right)&&typeof t.right.value=="boolean"&&(t.op==="=="||t.op==="!="))return t.op==="=="===t.right.value?f(t.left,e,n):T(t.left,e,n);let[o,a]=V[t.op],d=P(t.left,e,n),b=P(t.right,e,n);return[...S(t.left,e,n,b),R(o,a),...S(t.right,e,n,d)]}if(t.op==="in")return[...r(t.left,5),R("\u2208","is one of"),...S(t.right,e,n,P(t.left,e,n))];let s=At[t.op];if(s){let o=j(t);return[...r(t.left,o),R(s[0],s[1]),...r(t.right,o+.5)]}let u={"|":"or","&":"and also","-":"except"};return[...r(t.left,5),c(u[t.op]??t.op),...r(t.right,5)]}function S(t,e,n,r){return t.t==="lit"||t.t==="list"?f(t,e,n,r):j(t)<5?[v,...f(t,e,n),w]:f(t,e,n)}function jt(t,e,n){let r=o=>t.args[o],s=o=>{let a=t.args[o];return a?.t==="lit"&&typeof a.value=="string"?a.value:void 0},u=o=>{let a=r(o);return j(a)<9&&a.t!=="where"?[v,...f(a,e,n),w]:f(a,e,n)};switch(t.fn){case"out":{let o=s(t.args.length-1)??"",a=O(M(o).toLowerCase());return t.args.length===2?[a,c("of"),...u(0)]:[a]}case"in":{let o=s(t.args.length-1)??"",a=t.args.length===2?n.nearOf(E(r(0),e,n),o):n.nearOf(e,o),d=O(a?n.plural(a):M(o).toLowerCase());return t.args.length===2?[d,c("of"),...u(0)]:[d]}case"all":{let o=s(0),a=t.args[1]?.t==="lit"?t.args[1].value:void 0,d=a===!0?[c("archived")]:a==="all"?[c("archived or not")]:[];return a===!0?[...d,O(o?n.plural(o):"everything")]:[O(o?n.plural(o):"everything"),...d]}case"fact":{let o=s(0);return[O(o?n.factName(o):"fact")]}case"count":return[c("number of"),...u(0)];case"exists":return[...u(0),R("\u2260","is not"),N];case"present":return[...f(r(0),e,n),R("\u2260","is not"),N];case"some":case"every":{let o=E(r(0),e,n),a=r(1);return[...t.fn==="some"?[c("some")]:[],...u(0),c(t.fn==="some"?"with":"all with"),...j(a)<=2?[v,...f(a,o,n),w]:f(a,o,n)]}case"sum":case"min":case"max":{let o=E(r(0),e,n),a=r(1),d=a.t==="lit"&&typeof a.value=="string"?[O(n.fieldName(o,a.value))]:j(a)<9?[v,...f(a,o,n),w]:f(a,o,n);return[c(t.fn==="sum"?"total":t.fn==="min"?"least":"most"),...d,c("of"),...u(0)]}case"first":{let o=r(0);if(x(o,"all")){let a=o.args[0]?.value;if(typeof a=="string")return[O(`the ${n.noun(a)}`)]}return[c("first of"),...u(0)]}case"sort":return[...u(0),c("by"),...f(r(1),E(r(0),e,n),n)];case"len":return[c("length of"),...f(r(0),e,n)];case"lower":return f(r(0),e,n);case"contains":case"startsWith":return[...f(r(0),e,n),c(t.fn==="contains"?"contains":"starts with"),...S(r(1),e,n,P(r(0),e,n))];case"today":return[L("today")];case"now":return[L("now")];case"date":return $(r(0))&&typeof r(0).value=="string"?[L(G(String(r(0).value),n.locale))]:f(r(0),e,n);case"days":case"hours":{let o=t.fn,[a,d]=[r(0),r(1)];return x(d,"today")||x(d,"now")?[c(`${o} since`),...f(a,e,n)]:x(a,"today")||x(a,"now")?[c(`${o} until`),...f(d,e,n)]:[c(`${o} from`),...f(a,e,n),c("to"),...f(d,e,n)]}case"if":return[v,...f(r(1),e,n),c("if"),...f(r(0),e,n),c(","),c("else"),...f(r(2),e,n),w];case"either":return t.args.flatMap((o,a)=>a===0?f(o,e,n):[c(","),c("else"),...f(o,e,n)]);default:return[c(t.fn),v,...t.args.flatMap((o,a)=>a===0?f(o,e,n):[c(","),...f(o,e,n)]),w]}}function U(t,e){let n=bt(e),r=t.over==="graph"?null:t.over;return z({...r===null?{}:{kind:r},parts:f(t.require,r,n),...t.when?{when:f(t.when,r,n)}:{}})}function Z(t,e,n){let r=bt(e),s=t.over==="graph"?null:t.over,u=n.subject,o=i=>{try{return q(i,{...n,budget:2e3})}catch{return}},a=(i,p)=>{let h=S(i,s,r,p);if(i.t==="lit"||i.t==="list"||x(i,"today")||x(i,"now")||x(i,"date"))return h;let y=o(i);if(y===void 0)return h;let l=P(i,s,r),m=r.valueWords(y,l?{...l,format:r.formatOf(l.kind,l.key)??(p?r.formatOf(p.kind,p.key):void 0)}:p);return y instanceof F?[...h,c(":"),m]:[...h,m]},d=i=>{if(i.t==="binary"&&i.op==="&&"){let p=[];p.push(...C(i,"&&"));let h=p.filter(y=>o(y)!==!0);return(h.length>0?h:p).flatMap((y,l)=>[...l>0?[c("and")]:[],...j(y)<=2?[v,...d(y),w]:d(y)])}if(i.t==="binary"&&i.op==="||"){let p=H(i);if(p){let y=P(p.subject,s,r);return[...a(p.subject),R("\u2209","is not one of"),r.valueWords(p.values.map(l=>l.value),y)]}let h=[];return h.push(...C(i,"||")),h.flatMap((y,l)=>[...l>0?[c("and")]:[],...j(y)<=2?[v,...d(y),w]:d(y)])}if(i.t==="binary"&&i.op in V){if($(i.right)&&typeof i.right.value=="boolean"&&(i.op==="=="||i.op==="!="))return i.op==="=="===i.right.value?T(i.left,s,r):f(i.left,s,r);let p=B[i.op],[h,y]=V[p],l=P(i.left,s,r),m=P(i.right,s,r);if($(i.right)&&i.right.value===null)return[...p==="=="?S(i.left,s,r,m):a(i.left,m),R(h,y),N];let g=p==="=="&&($(i.right)||$(i.left));return[...g?S(i.left,s,r,m):a(i.left,m),R(h,y),...g?S(i.right,s,r,l):a(i.right,l)]}if(i.t==="binary"&&i.op==="in")return[...a(i.left),R("\u2209","is not one of"),...S(i.right,s,r,P(i.left,s,r))];if(i.t==="unary"&&i.op==="!"){let p=i.operand;return xt(p)?d({...p,op:B[p.op]}):x(p,"present")||x(p,"exists")?[...a(p.args[0]),R("\u2260","is not"),N]:p.t==="ident"?f(p,s,r):[c("not"),v,...T(p,s,r),w]}if(x(i,"present")||x(i,"exists"))return[...f(i.args[0],s,r),R("=","is"),N];if(x(i,"some"))return[...f(i,s,r).slice(1),R("=","is"),N];if(x(i,"every")&&i.args.length===2){let p=o(i.args[0]);if(p instanceof F){let h=p.nodes.filter(y=>{try{return q(i.args[1],{...n,subject:y,budget:2e3})!==!0}catch{return!0}});return[...f(i,s,r),c(","),c("not"),r.valueWords(new F(h))]}}return i.t==="ident"?[c("not"),O(r.fieldName(s,i.name))]:[c("not"),v,...f(i,s,r),w]},b;try{b=d(t.require)}catch{b=[c("not"),v,...f(t.require,s,r),w]}return z({...s===null?{}:{kind:s},parts:b,...u?{record:_(e.schema.tryDefinition(u.kind),u)}:{}})}function vt(t){let e=new Map;for(let n of t??[])n.expr?.t==="ident"&&n.format&&(n.format==="money"||n.format==="percent"||n.format==="date")&&e.set(n.expr.name,n.format);return e}function St(t){return(e,n)=>{let r=t[e]?.fields?.[n],s=r?.format??(r?.type==="date"?"date":void 0);return s||r?.unit?{...s?{format:s}:{},...r?.unit?{unit:r.unit}:{}}:void 0}}function Ot(t,e){return{schema:e,said:vt(t.says),...t.declared?{formatOf:St(t.declared)}:{},...t.money?{money:t.money}:{}}}function Xt(t,e){return t.shape?U(t.shape,Ot(t.shape,e)):void 0}var wt=new WeakMap;function Nt(t,e){let n=new Map(t.allInvariants().map(r=>[r.name,r]));return e.map(r=>{let s=$t(r),u=n.get(s.invariant)?.shape;if(!u||s.status&&s.status!=="violated")return s;let o=s.subjectId?t.graph.getNode(s.subjectId):void 0;if(u.over!=="graph"&&!o)return s;let a=u.kinds;a||(a=wt.get(t.schema),a||wt.set(t.schema,a=pt(t.schema)));try{let d=t.today?.()??u.today?.()??k(),b=Z(u,Ot(u,t.schema),{graph:t.graph,subject:o??null,kinds:a,today:d});return{...s,line:b,...u.says?{}:{message:`${s.message} \u2014 ${b.text}`}}}catch{return s}})}function Wt(){ut((t,e,n,r)=>Nt({graph:t,schema:t.schema,allInvariants:()=>e,today:()=>r},n)),mt(Kt)}function Kt(t,e,n,r){let s=e.graph,u=lt.from(t.schema,s.snapshot(),{validate:!1});for(let b of n?[...r].reverse().map(it):r)try{u.applyPrimitives([b],{restoring:!0})}catch{}let o=b=>t.violations(void 0,b),a=o(n?u:s),d=o(n?s:u);return{...ct(t.allInvariants(),a,d),violationsAfter:d}}function $t(t){if(!t.line)return t;let{line:e,...n}=t,r=` \u2014 ${e.text}`;return n.message.endsWith(r)?{...n,message:n.message.slice(0,-r.length)}:n}Wt();export{Z as brokenLineOf,Wt as judgeWithLines,Kt as judgedForASeat,Lt as problemWords,Xt as ruleLine,U as ruleLineOf,yt as ruleLineWords,J as ruleSpacing,Pt as ruleSpoken,Et as ruleText,$t as unlined,Nt as withLines};
1
+ import{b as mt}from"./chunk.JJP5OL5E.js";import{a as pt}from"./chunk.LJXAZ5TF.js";import{f as dt}from"./chunk.QFI4L2HK.js";import{a as F,f as q}from"./chunk.KFHXTHIY.js";import{$ as rt,F as Q,G as X,Hb as ft,I as k,O as G,R as tt,T as nt,U as et,_c as ct,da as _,fa as M,gb as lt,ha as ot,jb as ut,ka as at,ma as st}from"./chunk.BLS2G3CD.js";import{e as it}from"./chunk.EJUZGIQ5.js";import"./chunk.AJZBJBMO.js";function J(t){let e=[],n=!0;for(let r of t){if(r.text.length===0)continue;let s=r.as==="close"||r.text===","||r.text===":"||r.text.startsWith("'")||n;e.push({part:r,space:!s}),n=r.as==="open"}return e}function D(t,e){return J(t).map(({part:n,space:r})=>`${r?" ":""}${e?n.said??n.text:n.text}`).join("")}function Et(t){return D(t,!1)}function Pt(t){return D(t,!0)}function yt(t,e=!1){let n=e?t.said:t.text;return t.record!==void 0?`${t.record} \u2014 ${n}`:n}function z(t){let e=u=>J(u).map(({part:o,space:a})=>({...o,space:a})),n=e(t.parts),r=t.when&&t.when.length>0?e(t.when):void 0,s=u=>`${D(n,u)}${r?`, when ${D(r,u)}`:""}`;return{...t,parts:n,...r?{when:r}:{},text:s(!1),said:s(!0)}}function Lt(t,e=!1){return t.line?yt(t.line,e):t.message}var gt=60,O=t=>({text:t,as:"name"}),c=(t,e)=>e===void 0?{text:t,as:"word"}:{text:t,as:"word",said:e},L=(t,e)=>e===void 0||e===t?{text:t,as:"value"}:{text:t,as:"value",said:e},R=(t,e)=>({text:t,as:"op",said:e}),v={text:"(",as:"open"},w={text:")",as:"close"},N={text:"\u2014",as:"value",said:"empty"},V={">=":["\u2265","at least"],"<=":["\u2264","at most"],"<":["<","less than"],">":[">","more than"],"==":["=","is"],"!=":["\u2260","is not"]},B={">=":"<","<=":">","<":">=",">":"<=","==":"!=","!=":"=="},At={"+":["+","plus"],"-":["\u2212","minus"],"*":["\xD7","times"],"/":["\xF7","divided by"],"%":["mod","modulo"]},xt=t=>t.t==="binary"&&t.op in V;function I(t){return rt(t)}function bt(t){let{schema:e}=t,n=l=>l===null?void 0:e.tryDefinition(l),r=(l,m)=>{let g=n(l)?.edges;return g&&Object.hasOwn(g,m)?g[m]:void 0},s=(l,m)=>{let g=r(l,m)?.to;return Array.isArray(g)&&g.length===1?g[0]:null},u=(l,m)=>{let g=(e.edge(m)?.from??[]).filter(W=>{let K=r(W,m)?.to;return l===null||K==="*"||Array.isArray(K)&&K.includes(l)});return g.length===1?g[0]:null},o=(l,m)=>r(l,m)?M(m).toLowerCase():I(at(n(l),m)),a=l=>I(ot(e,l)),d=l=>I(dt(e).get(l)?.label??M(l)),b=l=>I(st(n(l),l)),i=(l,m)=>{let g=l===null?void 0:t.formatOf?.(l,m);if(g?.format)return g;let W=t.said?.get(m);return W?{...g,format:W}:g},p=l=>_(e.tryDefinition(l.kind),l),h=t.money?.locale,y=(l,m)=>{if(l==null)return N;if(l instanceof F){if(l.nodes.length===0)return N;let A=l.nodes.slice(0,3).map(p),Y=l.nodes.length-A.length;return L(Y>0?`${A.join(", ")} and ${Y} more`:A.length>1?`${A.slice(0,-1).join(", ")} and ${A[A.length-1]}`:A[0])}if(Array.isArray(l))return L(`{${l.map(A=>y(A,m).text).join(", ")}}`,l.map(A=>y(A,m).text).join(" or "));if(typeof l=="object")return L(p(l));if(typeof l=="boolean")return L(l?"yes":"no");let g=m?.format??(m?i(m.kind,m.key):void 0);if(typeof l=="number")return L(g&&g.format!=="date"?ft(l,{...t.money,...g}):et(l,h));if(Q.test(l)||g?.format==="date")return L(G(nt(l,t.money?.timeZone)??l.slice(0,10),h));if(X.test(l))return L(tt(l,h,t.money?.timeZone));let W=m&&m.kind!==null?n(m.kind)?.display?.format?.[m.key]:void 0;if(W)return L(W(l));let K=l.length>gt?`${l.slice(0,gt-1).trimEnd()}\u2026`:l;return L(/^[a-z][a-z0-9]*([-_][a-z0-9]+)*$/.test(K)?K.replace(/[-_]+/g," "):K)};return{definition:n,relation:r,farOf:s,nearOf:u,fieldName:o,plural:a,noun:b,factName:d,formatOf:i,valueWords:y,locale:h}}function P(t,e,n){if(t.t==="ident")return{kind:e,key:t.name};if(t.t==="member")return{kind:E(t.object,e,n),key:t.name};if(t.t==="call"&&(t.fn==="sum"||t.fn==="min"||t.fn==="max")&&t.args.length===2){let r=E(t.args[0],e,n),s=t.args[1];if(s.t==="ident")return{kind:r,key:s.name};if(s.t==="lit"&&typeof s.value=="string")return{kind:r,key:s.value}}if(t.t==="binary"&&(t.op==="+"||t.op==="-"))return P(t.left,e,n)??P(t.right,e,n);if(t.t==="call"&&t.fn==="if"&&t.args.length===3)return P(t.args[1],e,n)??P(t.args[2],e,n)}function E(t,e,n){switch(t.t){case"ident":return n.relation(e,t.name)?n.farOf(e,t.name):null;case"member":return n.farOf(E(t.object,e,n),t.name);case"where":return E(t.set,e,n);case"binary":return t.op==="|"||t.op==="&"||t.op==="-"?E(t.left,e,n):null;case"call":{let r=s=>{let u=t.args[s];return u?.t==="lit"&&typeof u.value=="string"?u.value:void 0};return t.fn==="all"?r(0)??null:t.fn==="out"?t.args.length===2?n.farOf(E(t.args[0],e,n),r(1)??""):n.farOf(e,r(0)??""):t.fn==="in"?t.args.length===2?n.nearOf(E(t.args[0],e,n),r(1)??""):n.nearOf(e,r(0)??""):(t.fn==="first"||t.fn==="sort")&&t.args[0]?E(t.args[0],e,n):null}default:return null}}function j(t){return t.t==="binary"?t.op==="||"?H(t)?4:1:t.op==="&&"?2:t.op in V||t.op==="in"?4:t.op==="+"||t.op==="-"?5:t.op==="*"||t.op==="/"||t.op==="%"?6:4.5:t.t==="unary"&&t.op==="!"?3:t.t==="where"?3.5:9}var $=t=>t.t==="lit",x=(t,e)=>t.t==="call"&&t.fn===e;function C(t,e){return t.t==="binary"&&t.op===e?[...C(t.left,e),...C(t.right,e)]:[t]}function H(t){if(t.t!=="binary"||t.op!=="||")return;let e=[];e.push(...C(t,"||"));let n,r=[];for(let s of e){if(s.t!=="binary"||s.op!=="=="||!$(s.right)||typeof s.right.value!="string"||n&&JSON.stringify(ht(n))!==JSON.stringify(ht(s.left)))return;n=s.left,r.push(s.right)}return n?{subject:n,values:r}:void 0}var ht=t=>JSON.parse(JSON.stringify(t,(e,n)=>e==="at"?void 0:n));function f(t,e,n,r){let s=(u,o,a=e)=>j(u)<o?[v,...f(u,a,n),w]:f(u,a,n);switch(t.t){case"lit":return[n.valueWords(t.value,r)];case"list":return[n.valueWords(t.items.map(u=>u.t==="lit"?u.value:null),r)];case"ident":return[O(n.fieldName(e,t.name))];case"member":{let u=x(t.object,"first")&&t.object.args[0]&&x(t.object.args[0],"all"),o=E(t.object,e,n);if(u&&o)return e!==null&&n.fieldName(e,t.name)===n.fieldName(o,t.name)&&n.definition(e)?.fields?.shape&&Object.prototype.hasOwnProperty.call(n.definition(e).fields.shape,t.name)?[O(`${n.noun(o)}'s ${n.fieldName(o,t.name)}`)]:[O(n.fieldName(o,t.name))];let a=f(t.object,e,n),d=a[a.length-1];return a.length===1&&d?.as==="name"?[O(`${d.text}'s ${n.fieldName(o,t.name)}`)]:[...a,c("'s"),O(n.fieldName(o,t.name))]}case"unary":return t.op==="-"?[R("\u2212","minus"),...s(t.operand,7)]:T(t.operand,e,n);case"where":{let u=E(t.set,e,n),o=f(t.filter,u,n),a=o.every(d=>d.as==="name"||d.as==="word"&&d.text==="not");return[...s(t.set,4),...a?[]:[c("with")],...j(t.filter)<=2?[v,...o,w]:o]}case"binary":return Rt(t,e,n);case"call":return jt(t,e,n)}}function T(t,e,n){return xt(t)?Rt({...t,op:B[t.op]},e,n):x(t,"present")||x(t,"exists")?[...f(t.args[0],e,n),R("=","is"),N]:t.t==="ident"?[c("not"),O(n.fieldName(e,t.name))]:[c("not"),v,...f(t,e,n),w]}function Rt(t,e,n){let r=(o,a)=>j(o)<a?[v,...f(o,e,n),w]:f(o,e,n);if(t.op==="&&"||t.op==="||"){let o=H(t);if(o){let d=P(o.subject,e,n);return[...f(o.subject,e,n),R("\u2208","is one of"),n.valueWords(o.values.map(b=>b.value),d)]}let a=t.op==="&&"?2:1;return[...r(t.left,a),c(t.op==="&&"?"and":"or"),...r(t.right,a+.5)]}if(t.op in V){if($(t.right)&&typeof t.right.value=="boolean"&&(t.op==="=="||t.op==="!="))return t.op==="=="===t.right.value?f(t.left,e,n):T(t.left,e,n);let[o,a]=V[t.op],d=P(t.left,e,n),b=P(t.right,e,n);return[...S(t.left,e,n,b),R(o,a),...S(t.right,e,n,d)]}if(t.op==="in")return[...r(t.left,5),R("\u2208","is one of"),...S(t.right,e,n,P(t.left,e,n))];let s=At[t.op];if(s){let o=j(t);return[...r(t.left,o),R(s[0],s[1]),...r(t.right,o+.5)]}let u={"|":"or","&":"and also","-":"except"};return[...r(t.left,5),c(u[t.op]??t.op),...r(t.right,5)]}function S(t,e,n,r){return t.t==="lit"||t.t==="list"?f(t,e,n,r):j(t)<5?[v,...f(t,e,n),w]:f(t,e,n)}function jt(t,e,n){let r=o=>t.args[o],s=o=>{let a=t.args[o];return a?.t==="lit"&&typeof a.value=="string"?a.value:void 0},u=o=>{let a=r(o);return j(a)<9&&a.t!=="where"?[v,...f(a,e,n),w]:f(a,e,n)};switch(t.fn){case"out":{let o=s(t.args.length-1)??"",a=O(M(o).toLowerCase());return t.args.length===2?[a,c("of"),...u(0)]:[a]}case"in":{let o=s(t.args.length-1)??"",a=t.args.length===2?n.nearOf(E(r(0),e,n),o):n.nearOf(e,o),d=O(a?n.plural(a):M(o).toLowerCase());return t.args.length===2?[d,c("of"),...u(0)]:[d]}case"all":{let o=s(0),a=t.args[1]?.t==="lit"?t.args[1].value:void 0,d=a===!0?[c("archived")]:a==="all"?[c("archived or not")]:[];return a===!0?[...d,O(o?n.plural(o):"everything")]:[O(o?n.plural(o):"everything"),...d]}case"fact":{let o=s(0);return[O(o?n.factName(o):"fact")]}case"count":return[c("number of"),...u(0)];case"exists":return[...u(0),R("\u2260","is not"),N];case"present":return[...f(r(0),e,n),R("\u2260","is not"),N];case"some":case"every":{let o=E(r(0),e,n),a=r(1);return[...t.fn==="some"?[c("some")]:[],...u(0),c(t.fn==="some"?"with":"all with"),...j(a)<=2?[v,...f(a,o,n),w]:f(a,o,n)]}case"sum":case"min":case"max":{let o=E(r(0),e,n),a=r(1),d=a.t==="lit"&&typeof a.value=="string"?[O(n.fieldName(o,a.value))]:j(a)<9?[v,...f(a,o,n),w]:f(a,o,n);return[c(t.fn==="sum"?"total":t.fn==="min"?"least":"most"),...d,c("of"),...u(0)]}case"first":{let o=r(0);if(x(o,"all")){let a=o.args[0]?.value;if(typeof a=="string")return[O(`the ${n.noun(a)}`)]}return[c("first of"),...u(0)]}case"sort":return[...u(0),c("by"),...f(r(1),E(r(0),e,n),n)];case"len":return[c("length of"),...f(r(0),e,n)];case"lower":return f(r(0),e,n);case"contains":case"startsWith":return[...f(r(0),e,n),c(t.fn==="contains"?"contains":"starts with"),...S(r(1),e,n,P(r(0),e,n))];case"today":return[L("today")];case"now":return[L("now")];case"date":return $(r(0))&&typeof r(0).value=="string"?[L(G(String(r(0).value),n.locale))]:f(r(0),e,n);case"days":case"hours":{let o=t.fn,[a,d]=[r(0),r(1)];return x(d,"today")||x(d,"now")?[c(`${o} since`),...f(a,e,n)]:x(a,"today")||x(a,"now")?[c(`${o} until`),...f(d,e,n)]:[c(`${o} from`),...f(a,e,n),c("to"),...f(d,e,n)]}case"if":return[v,...f(r(1),e,n),c("if"),...f(r(0),e,n),c(","),c("else"),...f(r(2),e,n),w];case"either":return t.args.flatMap((o,a)=>a===0?f(o,e,n):[c(","),c("else"),...f(o,e,n)]);default:return[c(t.fn),v,...t.args.flatMap((o,a)=>a===0?f(o,e,n):[c(","),...f(o,e,n)]),w]}}function U(t,e){let n=bt(e),r=t.over==="graph"?null:t.over;return z({...r===null?{}:{kind:r},parts:f(t.require,r,n),...t.when?{when:f(t.when,r,n)}:{}})}function Z(t,e,n){let r=bt(e),s=t.over==="graph"?null:t.over,u=n.subject,o=i=>{try{return q(i,{...n,budget:2e3})}catch{return}},a=(i,p)=>{let h=S(i,s,r,p);if(i.t==="lit"||i.t==="list"||x(i,"today")||x(i,"now")||x(i,"date"))return h;let y=o(i);if(y===void 0)return h;let l=P(i,s,r),m=r.valueWords(y,l?{...l,format:r.formatOf(l.kind,l.key)??(p?r.formatOf(p.kind,p.key):void 0)}:p);return y instanceof F?[...h,c(":"),m]:[...h,m]},d=i=>{if(i.t==="binary"&&i.op==="&&"){let p=[];p.push(...C(i,"&&"));let h=p.filter(y=>o(y)!==!0);return(h.length>0?h:p).flatMap((y,l)=>[...l>0?[c("and")]:[],...j(y)<=2?[v,...d(y),w]:d(y)])}if(i.t==="binary"&&i.op==="||"){let p=H(i);if(p){let y=P(p.subject,s,r);return[...a(p.subject),R("\u2209","is not one of"),r.valueWords(p.values.map(l=>l.value),y)]}let h=[];return h.push(...C(i,"||")),h.flatMap((y,l)=>[...l>0?[c("and")]:[],...j(y)<=2?[v,...d(y),w]:d(y)])}if(i.t==="binary"&&i.op in V){if($(i.right)&&typeof i.right.value=="boolean"&&(i.op==="=="||i.op==="!="))return i.op==="=="===i.right.value?T(i.left,s,r):f(i.left,s,r);let p=B[i.op],[h,y]=V[p],l=P(i.left,s,r),m=P(i.right,s,r);if($(i.right)&&i.right.value===null)return[...p==="=="?S(i.left,s,r,m):a(i.left,m),R(h,y),N];let g=p==="=="&&($(i.right)||$(i.left));return[...g?S(i.left,s,r,m):a(i.left,m),R(h,y),...g?S(i.right,s,r,l):a(i.right,l)]}if(i.t==="binary"&&i.op==="in")return[...a(i.left),R("\u2209","is not one of"),...S(i.right,s,r,P(i.left,s,r))];if(i.t==="unary"&&i.op==="!"){let p=i.operand;return xt(p)?d({...p,op:B[p.op]}):x(p,"present")||x(p,"exists")?[...a(p.args[0]),R("\u2260","is not"),N]:p.t==="ident"?f(p,s,r):[c("not"),v,...T(p,s,r),w]}if(x(i,"present")||x(i,"exists"))return[...f(i.args[0],s,r),R("=","is"),N];if(x(i,"some"))return[...f(i,s,r).slice(1),R("=","is"),N];if(x(i,"every")&&i.args.length===2){let p=o(i.args[0]);if(p instanceof F){let h=p.nodes.filter(y=>{try{return q(i.args[1],{...n,subject:y,budget:2e3})!==!0}catch{return!0}});return[...f(i,s,r),c(","),c("not"),r.valueWords(new F(h))]}}return i.t==="ident"?[c("not"),O(r.fieldName(s,i.name))]:[c("not"),v,...f(i,s,r),w]},b;try{b=d(t.require)}catch{b=[c("not"),v,...f(t.require,s,r),w]}return z({...s===null?{}:{kind:s},parts:b,...u?{record:_(e.schema.tryDefinition(u.kind),u)}:{}})}function vt(t){let e=new Map;for(let n of t??[])n.expr?.t==="ident"&&n.format&&(n.format==="money"||n.format==="percent"||n.format==="date")&&e.set(n.expr.name,n.format);return e}function St(t){return(e,n)=>{let r=t[e]?.fields?.[n],s=r?.format??(r?.type==="date"?"date":void 0);return s||r?.unit?{...s?{format:s}:{},...r?.unit?{unit:r.unit}:{}}:void 0}}function Ot(t,e){return{schema:e,said:vt(t.says),...t.declared?{formatOf:St(t.declared)}:{},...t.money?{money:t.money}:{}}}function Xt(t,e){return t.shape?U(t.shape,Ot(t.shape,e)):void 0}var wt=new WeakMap;function Nt(t,e){let n=new Map(t.allInvariants().map(r=>[r.name,r]));return e.map(r=>{let s=$t(r),u=n.get(s.invariant)?.shape;if(!u||s.status&&s.status!=="violated")return s;let o=s.subjectId?t.graph.getNode(s.subjectId):void 0;if(u.over!=="graph"&&!o)return s;let a=u.kinds;a||(a=wt.get(t.schema),a||wt.set(t.schema,a=pt(t.schema)));try{let d=t.today?.()??u.today?.()??k(),b=Z(u,Ot(u,t.schema),{graph:t.graph,subject:o??null,kinds:a,today:d});return{...s,line:b,...u.says?{}:{message:`${s.message} \u2014 ${b.text}`}}}catch{return s}})}function Wt(){ut((t,e,n,r)=>Nt({graph:t,schema:t.schema,allInvariants:()=>e,today:()=>r},n)),mt(Kt)}function Kt(t,e,n,r){let s=e.graph,u=lt.from(t.schema,s.snapshot(),{validate:!1});for(let b of n?[...r].reverse().map(it):r)try{u.applyPrimitives([b],{restoring:!0})}catch{}let o=b=>t.violations(void 0,b),a=o(n?u:s),d=o(n?s:u);return{...ct(t.allInvariants(),a,d),violationsAfter:d}}function $t(t){if(!t.line)return t;let{line:e,...n}=t,r=` \u2014 ${e.text}`;return n.message.endsWith(r)?{...n,message:n.message.slice(0,-r.length)}:n}Wt();export{Z as brokenLineOf,Wt as judgeWithLines,Kt as judgedForASeat,Lt as problemWords,Xt as ruleLine,U as ruleLineOf,yt as ruleLineWords,J as ruleSpacing,Pt as ruleSpoken,Et as ruleText,$t as unlined,Nt as withLines};
@@ -0,0 +1 @@
1
+ import{Mc as x,Nc as E,Oc as G,Qc as F,Rc as J,nb as k,rb as O,sb as P,ub as h,vb as j}from"./chunk.BLS2G3CD.js";var W=(o,a)=>{let t=o.kindOf(a);return t===void 0?void 0:o.kept?.({id:a,kind:t})};function w(o,a){return o.flatMap(t=>{if(t.op==="splice-text")return W(a,t.id)?.(t.field)?[]:[t];if(t.op!=="patch-node")return[t];let i=W(a,t.id);if(!i||!Object.keys(t.after).some(i))return[t];let c=r=>Object.fromEntries(Object.entries(r).filter(([f])=>!i(f))),n=c(t.after);return Object.keys(n).length===0?[]:[{op:"patch-node",id:t.id,before:c(t.before),after:n}]})}function _(o,a,t){if(!G(o,a))return t;let i=F(o,a),c=r=>o.graph.getNode(r)!==void 0||x(o.log).kindOf(r)!==void 0,n={...t};if(t.diff){let r=t.diff,f=E(o.log),l=o.log.length??o.log.all().length,u=t.ops?.[0]?.seq??l,M=k(a).id,y=(e,s)=>d=>f.writerAt(e,d,s),m=(e,s)=>i.shows(e.id)?i.servedWith(e,s):void 0,b=(e,s)=>e.flatMap(d=>m(d,s(d.id))??[]),S=e=>i.shows(e.from)&&i.shows(e.to)&&!h(e,i.sees),v=(e,s)=>t.ops?y(e,l):d=>s===void 0||s.includes(d)?M:f.writerAt(e,d,l),D=r.changedNodes.flatMap(e=>{let s=m(e.before,y(e.before.id,u)),d=m(e.after,v(e.after.id,e.fields));return s&&d?[{before:s,after:d,fields:e.fields.filter(p=>p in s||p in d)}]:[]}),B=new Set(r.changedNodes.map(e=>e.after.id)),g=new Map;for(let e of t.ops?.flatMap(s=>s.primitives)??t.primitives??[])e.op!=="patch-node"&&e.op!=="splice-text"||B.has(e.id)||g.set(e.id,[...g.get(e.id)??[],...e.op==="splice-text"?[e.field]:Object.keys(e.after)]);let I=[...g].flatMap(([e,s])=>{let d=o.graph.getNode(e);if(!d)return[];let p=m(d,y(e,u)),N=m(d,v(e,s));return p&&N&&JSON.stringify(p)!==JSON.stringify(N)?[{before:p,after:N,fields:s}]:[]});n.diff={addedNodes:b(r.addedNodes,e=>v(e)),removedNodes:b(r.removedNodes,e=>y(e,u)),changedNodes:[...D,...I],addedEdges:r.addedEdges.filter(S),removedEdges:r.removedEdges.filter(S),touched:[...r.touched.filter(i.shows),...[...g.keys()].filter(e=>i.shows(e)&&!r.touched.includes(e))]}}if(t.ops&&(n.ops=j(t.ops,i)),t.primitives){let r=n.ops;n.primitives=r?r.flatMap(f=>f.primitives):i.timeline?O(t.primitives,i.timeline,{served:(f,l)=>i.servedWith(f,l),edgeClean:f=>!h(f,i.sees),sees:i.sees},k(a).id):j([{id:"",seq:0,batch:"",author:{kind:"system"},intent:"",mutation:null,primitives:t.primitives,reads:[],writes:[],at:""}],i)[0].primitives}return i.kept&&n.primitives&&(n.primitives=w(n.primitives,i)),t.reads&&(n.reads=t.reads.filter(r=>i.shows(r)&&c(r))),t.writes&&(n.writes=t.writes.filter(i.shows)),t.intent!==void 0&&h(t.intent,i.sees)&&(n.intent=P),t.violationsAfter&&Object.assign(n,A?A(o,J(o,a),!!t.ops,n.primitives??[]):{introduces:[],resolves:[],violationsAfter:[]}),n}var A,z=o=>void(A=o);export{_ as a,z as b};
@@ -1 +1 @@
1
- import{a as v,c as h}from"./chunk.DOBQ4LO4.js";import{L as b,N as S}from"./chunk.4TJOS4C7.js";var P=Symbol.for("@graview/core:file"),T=Symbol.for("@graview/core:node-ref"),p=e=>typeof e=="object"&&e!==null?e._zod?.def:void 0;function w(e){let i=p(e);return i?.[P]??(i?.innerType?w(i.innerType):void 0)}function x(e){let i=w(e);if(i)return{as:i,list:!1};let n=p(e);for(;n?.innerType;)n=p(n.innerType);let s=n?.type==="array"?w(n.element):void 0;return s?{as:s,list:!0}:void 0}function A(e){if(typeof e!="object"||e===null)return;let i=e[T];if(i)return i;let n=p(e);return n?.[T]??(n?.innerType?A(n.innerType):void 0)}function H(e){let i=e?.shape??{};return Object.entries(i).flatMap(([n,s])=>{let r=A(s);return r?[{name:n,kinds:r}]:[]})}var K=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.href=="string"&&typeof e.name=="string"&&typeof e.type=="string"&&typeof e.bytes=="number",W=e=>(Array.isArray(e)?e:[e]).filter(K);function I(e,i,n){let r=e.schema.tryDefinition(i)?.fields?.shape?.[n];return r===void 0?void 0:x(r)}function N(e,i){if(e===void 0)return[];if(!Array.isArray(e))return[`The view's accepts is a list of { "kind": <a kind>, "field": <its image, video or file field> }.`];let n=[],s=new Set(i.schema.kinds);for(let r of e){let{kind:l,field:a}=r??{};typeof l!="string"||typeof a!="string"?n.push(`Each of the view's accepts is { "kind": <a kind>, "field": <its image, video or file field> }.`):s.has(l)?I(i,l,a)?i.allMutations().some(o=>(o.creates??[]).includes(l)&&Object.hasOwn(o.input?.shape??{},a))||n.push(`No act of this app makes a "${l}" with its "${a}", so a file dropped could become nothing.`):n.push(`The view accepts files into ${l}'s "${a}", which holds no picture, video or file.`):n.push(`The view accepts files for "${l}", which is no kind of this app.`)}return n}function D(e){if(e===void 0||e===!0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's pictures is true, or { "width": <the widest it draws a picture, in pixels> }.`];let{width:i,...n}=e,s=[];return Object.keys(n).length>0&&s.push(`The view's pictures says ${Object.keys(n).map(r=>`"${r}"`).join(", ")}: only "width" is read.`),i!==void 0&&!(Number.isInteger(i)&&i>=16&&i<=4096)&&s.push("The view's pictures width is a whole number of pixels from 16 to 4096."),s}function E(e){if(e===void 0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's scene is { "maxHeight": <the tallest its preview on the Scene is drawn, in pixels> }.`];let{maxHeight:i,...n}=e,s=[];return Object.keys(n).length>0&&s.push(`The view's scene says ${Object.keys(n).map(r=>`"${r}"`).join(", ")}: only "maxHeight" is read.`),i!==void 0&&!(Number.isInteger(i)&&i>=80&&i<=4e3)&&s.push("The view's scene maxHeight is a whole number of pixels from 80 to 4000."),s}function F(e){return(e.acts??[]).map(i=>typeof i=="string"?{act:i}:i)}function B(e,i){let n=[],s=new Set(i.schema.kinds),r=new Set(i.schema.edgeKinds),l=new Set(i.allMutations().map(o=>o.name));(typeof e.name!="string"||!/^[a-z0-9][a-z0-9-]{0,62}$/.test(e.name))&&n.push(`The view's name "${String(e.name)}" is not lower-case letters, digits and hyphens.`),e.title!==void 0&&(typeof e.title!="string"||e.title.trim()===""||e.title.length>80)&&n.push("The view's title is empty or longer than 80 characters."),e.attach!=="home"&&!s.has(e.attach)&&n.push(`The view attaches to "${e.attach}", which is no kind of this app.`),e.cardinality!=="one"&&e.cardinality!=="many"&&n.push(`The view's cardinality is "${String(e.cardinality)}", not one or many.`),e.attach==="home"&&e.cardinality!=="many"&&n.push("A view of the home draws many records: its cardinality is many."),e.replaces!==void 0&&e.replaces!=="page"?n.push(`The view's replaces is "${String(e.replaces)}": the one thing a view replaces is "page", or leave it out to draw the view above the record's own fields.`):e.replaces==="page"&&(e.attach==="home"||e.cardinality!=="one")&&n.push('Only a view of one record replaces its page: replaces "page" needs cardinality one on a kind.'),e.gestures!==void 0&&typeof e.gestures!="boolean"&&n.push(`The view's gestures is "${String(e.gestures)}": it is true, or left out.`),e.bleed!==void 0&&typeof e.bleed!="boolean"&&n.push(`The view's bleed is "${String(e.bleed)}": it is true, or left out.`),e.flows!==void 0&&typeof e.flows!="boolean"?n.push(`The view's flows is "${String(e.flows)}": it is false for a view that keeps its place's frame, or left out.`):e.flows===!1&&(e.attach==="home"||e.cardinality!=="many"||e.title===void 0)&&n.push("Only a view that is a place keeps a frame: flows false needs a title and cardinality many on a kind."),n.push(...E(e.scene)),e.scene!==void 0&&(e.attach==="home"||e.cardinality!=="many")&&n.push("Only a view of a kind's members is drawn on the Scene as a card: scene needs cardinality many on a kind."),n.push(...D(e.pictures)),n.push(...N(e.accepts,i));for(let o of e.reads?.kinds??[])s.has(o)||n.push(`The view reads "${o}", which is no kind of this app.`);for(let o of e.reads?.edges??[])r.has(o)||n.push(`The view reads the edge "${o}", which no kind of this app declares.`);let a=new Set;for(let o of F(e)){l.has(o.act)||n.push(`The view asks for the act "${o.act}", which this app does not declare.`);let c=o.as??o.act;a.has(c)&&n.push(`Two of the view's acts are called "${c}".`),a.add(c)}return n}function L(e,i,n){let{manifest:s}=n,r=n.input??{},a=e.seenBy(i).graph,o=s.attach==="home"?void 0:s.attach,c=o&&s.cardinality==="one"&&r.node?a.getNode(r.node.id):void 0,f=c&&c.kind===o?[c]:[],g=o&&s.cardinality==="many"?r.nodes?r.nodes.flatMap(t=>{let d=a.getNode(t.id);return d&&d.kind===o?[d]:[]}):a.nodesOfKind(o):[],$=new Set([...f,...g].map(t=>t.id)),m=v(a,$,{kinds:(s.reads?.kinds??[]).filter(t=>t!==o||s.cardinality==="one"),edges:s.reads?.edges??[]}),u=new Map;for(let t of[...g,...m.nodes])f.some(d=>d.id===t.id)||u.set(t.id,t);let j=new Set([...f.map(t=>t.id),...u.keys()]),O=[...m.edges],M=new Set(F(s).map(t=>t.act)),V=e.permittedMutations(i).filter(t=>M.has(t.name)).map(t=>({name:t.name,title:t.title??t.name,...t.description!==void 0?{description:t.description}:{},...t.subject?{subject:{kinds:t.subject.kinds,arg:t.subject.arg}}:{}})),k=t=>t?.filter(d=>j.has(d));return{view:s.name,...f[0]?{node:h(e,f[0])}:{},nodes:[...u.values()].map(t=>h(e,t)),edges:O,...s.title!==void 0?{label:s.title}:r.label!==void 0?{label:r.label}:{},cardinality:s.cardinality,...r.fidelity!==void 0?{fidelity:r.fidelity}:{},...r.mode!==void 0?{mode:r.mode}:{},...r.selected!==void 0?{selected:r.selected}:{},...r.implicated?{implicated:k(r.implicated)}:{},...r.flagged?{flagged:k(r.flagged)}:{},acts:V,...n.theme?{theme:n.theme}:{},locale:b(),timeZone:S(),...n.places?{places:n.places.filter((t,d,y)=>y.findIndex(G=>G.as===t.as)===d).map(({as:t,title:d,kind:y})=>({as:t,title:d,kind:y}))}:{}}}export{H as a,K as b,W as c,I as d,F as e,B as f,L as g};
1
+ import{a as v,c as h}from"./chunk.U2M4SGUU.js";import{L as b,N as S}from"./chunk.BLS2G3CD.js";var P=Symbol.for("@graview/core:file"),T=Symbol.for("@graview/core:node-ref"),p=e=>typeof e=="object"&&e!==null?e._zod?.def:void 0;function w(e){let i=p(e);return i?.[P]??(i?.innerType?w(i.innerType):void 0)}function x(e){let i=w(e);if(i)return{as:i,list:!1};let n=p(e);for(;n?.innerType;)n=p(n.innerType);let s=n?.type==="array"?w(n.element):void 0;return s?{as:s,list:!0}:void 0}function A(e){if(typeof e!="object"||e===null)return;let i=e[T];if(i)return i;let n=p(e);return n?.[T]??(n?.innerType?A(n.innerType):void 0)}function H(e){let i=e?.shape??{};return Object.entries(i).flatMap(([n,s])=>{let r=A(s);return r?[{name:n,kinds:r}]:[]})}var K=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e.href=="string"&&typeof e.name=="string"&&typeof e.type=="string"&&typeof e.bytes=="number",W=e=>(Array.isArray(e)?e:[e]).filter(K);function I(e,i,n){let r=e.schema.tryDefinition(i)?.fields?.shape?.[n];return r===void 0?void 0:x(r)}function N(e,i){if(e===void 0)return[];if(!Array.isArray(e))return[`The view's accepts is a list of { "kind": <a kind>, "field": <its image, video or file field> }.`];let n=[],s=new Set(i.schema.kinds);for(let r of e){let{kind:l,field:a}=r??{};typeof l!="string"||typeof a!="string"?n.push(`Each of the view's accepts is { "kind": <a kind>, "field": <its image, video or file field> }.`):s.has(l)?I(i,l,a)?i.allMutations().some(o=>(o.creates??[]).includes(l)&&Object.hasOwn(o.input?.shape??{},a))||n.push(`No act of this app makes a "${l}" with its "${a}", so a file dropped could become nothing.`):n.push(`The view accepts files into ${l}'s "${a}", which holds no picture, video or file.`):n.push(`The view accepts files for "${l}", which is no kind of this app.`)}return n}function D(e){if(e===void 0||e===!0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's pictures is true, or { "width": <the widest it draws a picture, in pixels> }.`];let{width:i,...n}=e,s=[];return Object.keys(n).length>0&&s.push(`The view's pictures says ${Object.keys(n).map(r=>`"${r}"`).join(", ")}: only "width" is read.`),i!==void 0&&!(Number.isInteger(i)&&i>=16&&i<=4096)&&s.push("The view's pictures width is a whole number of pixels from 16 to 4096."),s}function E(e){if(e===void 0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's scene is { "maxHeight": <the tallest its preview on the Scene is drawn, in pixels> }.`];let{maxHeight:i,...n}=e,s=[];return Object.keys(n).length>0&&s.push(`The view's scene says ${Object.keys(n).map(r=>`"${r}"`).join(", ")}: only "maxHeight" is read.`),i!==void 0&&!(Number.isInteger(i)&&i>=80&&i<=4e3)&&s.push("The view's scene maxHeight is a whole number of pixels from 80 to 4000."),s}function F(e){return(e.acts??[]).map(i=>typeof i=="string"?{act:i}:i)}function B(e,i){let n=[],s=new Set(i.schema.kinds),r=new Set(i.schema.edgeKinds),l=new Set(i.allMutations().map(o=>o.name));(typeof e.name!="string"||!/^[a-z0-9][a-z0-9-]{0,62}$/.test(e.name))&&n.push(`The view's name "${String(e.name)}" is not lower-case letters, digits and hyphens.`),e.title!==void 0&&(typeof e.title!="string"||e.title.trim()===""||e.title.length>80)&&n.push("The view's title is empty or longer than 80 characters."),e.attach!=="home"&&!s.has(e.attach)&&n.push(`The view attaches to "${e.attach}", which is no kind of this app.`),e.cardinality!=="one"&&e.cardinality!=="many"&&n.push(`The view's cardinality is "${String(e.cardinality)}", not one or many.`),e.attach==="home"&&e.cardinality!=="many"&&n.push("A view of the home draws many records: its cardinality is many."),e.replaces!==void 0&&e.replaces!=="page"?n.push(`The view's replaces is "${String(e.replaces)}": the one thing a view replaces is "page", or leave it out to draw the view above the record's own fields.`):e.replaces==="page"&&(e.attach==="home"||e.cardinality!=="one")&&n.push('Only a view of one record replaces its page: replaces "page" needs cardinality one on a kind.'),e.gestures!==void 0&&typeof e.gestures!="boolean"&&n.push(`The view's gestures is "${String(e.gestures)}": it is true, or left out.`),e.bleed!==void 0&&typeof e.bleed!="boolean"&&n.push(`The view's bleed is "${String(e.bleed)}": it is true, or left out.`),e.flows!==void 0&&typeof e.flows!="boolean"?n.push(`The view's flows is "${String(e.flows)}": it is false for a view that keeps its place's frame, or left out.`):e.flows===!1&&(e.attach==="home"||e.cardinality!=="many"||e.title===void 0)&&n.push("Only a view that is a place keeps a frame: flows false needs a title and cardinality many on a kind."),n.push(...E(e.scene)),e.scene!==void 0&&(e.attach==="home"||e.cardinality!=="many")&&n.push("Only a view of a kind's members is drawn on the Scene as a card: scene needs cardinality many on a kind."),n.push(...D(e.pictures)),n.push(...N(e.accepts,i));for(let o of e.reads?.kinds??[])s.has(o)||n.push(`The view reads "${o}", which is no kind of this app.`);for(let o of e.reads?.edges??[])r.has(o)||n.push(`The view reads the edge "${o}", which no kind of this app declares.`);let a=new Set;for(let o of F(e)){l.has(o.act)||n.push(`The view asks for the act "${o.act}", which this app does not declare.`);let c=o.as??o.act;a.has(c)&&n.push(`Two of the view's acts are called "${c}".`),a.add(c)}return n}function L(e,i,n){let{manifest:s}=n,r=n.input??{},a=e.seenBy(i).graph,o=s.attach==="home"?void 0:s.attach,c=o&&s.cardinality==="one"&&r.node?a.getNode(r.node.id):void 0,f=c&&c.kind===o?[c]:[],g=o&&s.cardinality==="many"?r.nodes?r.nodes.flatMap(t=>{let d=a.getNode(t.id);return d&&d.kind===o?[d]:[]}):a.nodesOfKind(o):[],$=new Set([...f,...g].map(t=>t.id)),m=v(a,$,{kinds:(s.reads?.kinds??[]).filter(t=>t!==o||s.cardinality==="one"),edges:s.reads?.edges??[]}),u=new Map;for(let t of[...g,...m.nodes])f.some(d=>d.id===t.id)||u.set(t.id,t);let j=new Set([...f.map(t=>t.id),...u.keys()]),O=[...m.edges],M=new Set(F(s).map(t=>t.act)),V=e.permittedMutations(i).filter(t=>M.has(t.name)).map(t=>({name:t.name,title:t.title??t.name,...t.description!==void 0?{description:t.description}:{},...t.subject?{subject:{kinds:t.subject.kinds,arg:t.subject.arg}}:{}})),k=t=>t?.filter(d=>j.has(d));return{view:s.name,...f[0]?{node:h(e,f[0])}:{},nodes:[...u.values()].map(t=>h(e,t)),edges:O,...s.title!==void 0?{label:s.title}:r.label!==void 0?{label:r.label}:{},cardinality:s.cardinality,...r.fidelity!==void 0?{fidelity:r.fidelity}:{},...r.mode!==void 0?{mode:r.mode}:{},...r.selected!==void 0?{selected:r.selected}:{},...r.implicated?{implicated:k(r.implicated)}:{},...r.flagged?{flagged:k(r.flagged)}:{},acts:V,...n.theme?{theme:n.theme}:{},locale:b(),timeZone:S(),...n.places?{places:n.places.filter((t,d,y)=>y.findIndex(G=>G.as===t.as)===d).map(({as:t,title:d,kind:y})=>({as:t,title:d,kind:y}))}:{}}}export{H as a,K as b,W as c,I as d,F as e,B as f,L as g};
@@ -0,0 +1 @@
1
+ import{l as O}from"./chunk.OJGHDWI6.js";import{j as C}from"./chunk.UCS3CBT4.js";import{$ as w,G as x,Ja as G,S as M,aa as I,ba as W,c as V,x as B}from"./chunk.SGMVLKZO.js";import{C as D,Dc as _,Ec as L,Kc as j,Lb as F,Wb as N}from"./chunk.BLS2G3CD.js";import{b as m}from"./chunk.AJZBJBMO.js";function H(t,e){let n=t.graph.getNode(e);if(!n)return[];let i=n.kind,a=t.schema.tryDefinition(i);if(!a)return[];let c=t.seenFor,u=c?j.keptFrom?.(t,c)?.(n):void 0,o=new Map;for(let r of t.allMutations()){let s=r.subject;if(!s||!(s.kinds==="*"||s.kinds.includes(i)))continue;let l=r.input.shape??{};for(let d of N(r,a)){if(u?.(d))continue;let b=d in l,k=[];for(let h of Object.keys(l)){if(h===s.arg||h===d||X(l[h]))continue;let v=F(r.input).find(S=>S.name===h);k.push({name:h,...v?{kinds:v.kinds}:{},...v?{candidates:v.kinds.includes("*")?t.graph.allNodes().map(S=>S.id):v.kinds.flatMap(S=>t.graph.nodesOfKind(S).map(J=>J.id))}:{},shape:C(r.input,h)})}let Q={field:d,mutation:r.name,title:r.title??r.name,shape:b?C(r.input,d):{type:"unknown"},takesValue:b,alternatives:[],open:k,call:h=>({name:r.name,args:b?{[s.arg]:e,[d]:h}:{[s.arg]:e}})};o.set(d,[...o.get(d)??[],Q])}}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 X(t){let e=D(t)?.type;return e==="optional"||e==="default"||e==="nullable"}var R=m(x(),1);function be(t){let{store:e,principal:n}=w(),i=W(),a=(0,R.useMemo)(()=>t===null?[]:H(e,t),[e,t,i]),c=(0,R.useCallback)((u,o,r={})=>{let s=u.call(o);e.apply({name:s.name,args:{...s.args,...r}},{author:n})},[e,n]);return{fields:a,commit:c}}var K=m(x(),1);function Qe(){let{brand:t}=w(),e=t?.kit;return(0,K.useMemo)(()=>_(e),[e])}function Je(t,e){let n=L(t,e),i={...n.color!==void 0?{color:n.color}:{},...n.pattern!==void 0?{pattern:n.pattern}:{},...n.width!==void 0?{width:n.width}:{},...n.cap!==void 0?{cap:n.cap}:{},...n.opacity!==void 0?{opacity:n.opacity}:{}};return{connector:n,style:O(e,{[e]:i})}}var $=m(x(),1);var g=m(M(),1);function Z(t){let e=t?.hint;return typeof e=="string"&&e.length>0?e:void 0}function ee(t){if(t instanceof Error&&t.message)return t.message;let e=String(t);return e==="[object Object]"?"The view threw without a message.":e}var U=class extends $.Component{static contextType=G;state={};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,n){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,e,n.componentStack),this.context?.(e,{module:"@graview/react"})}render(){let{error:e}=this.state;if(!e)return this.props.children;let n=Z(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:ee(e)}),n?(0,g.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:n}):null]})}};var y=m(x(),1);var q=m(M(),1),A=(0,y.createContext)([]);function nt({sections:t,children:e}){let n=(0,y.useContext)(A),i=(0,y.useMemo)(()=>[...n,...t.filter(a=>!n.includes(a))],[n,t]);return(0,q.jsx)(A.Provider,{value:i,children:e})}function z(){let t=(0,y.useContext)(A),e=I()?.menuSections;return(0,y.useMemo)(()=>e?[...t,...e.filter(n=>!t.includes(n))]:t,[t,e])}function rt(){let t=z();return(0,y.useCallback)(e=>{for(let n of t)try{n(e)?.prepare?.()}catch{}},[t])}function ot(t){let e=z();if(t===null||e.length===0)return{start:[],end:[]};let n=e.flatMap(i=>{try{let a=i(t);return a&&((a.items?.length??0)>0||a.render)?[a]:[]}catch{return[]}});return{start:n.filter(i=>i.at==="start"),end:n.filter(i=>i.at!=="start")}}var te=m(x(),1);function st(){return w().activity}var P=(t,e)=>t.length*e*.58;var ne=156,re=2,E=ne-18,oe=7.1,ie=16;function ae(t,e){let n=0,i=E;for(let a of t.split(" ")){let c=e(a),u=i+e(" ")+c;if(u<=E)i=u;else{let o=Math.ceil(c/E)||1;n+=o,i=c-(o-1)*E}}return n}var se=16.25,Y=27,ce=(t,e)=>{let n=Math.ceil(t.length*oe/E);return e?Math.max(Y,Math.ceil(Math.max(n,ae(t,e))*se)+6):Math.max(Y,n*ie+6)};function ut(t,e,n){return t.length===0?0:10+t.reduce((i,a)=>i+ce(a,n),0)+(t.length-1)*re}var de=27,ue=8,lt=4,le=64,pt=t=>Math.max(1,Math.min(ue,t)),ft=t=>t*de+le;var p=m(x(),1);function gt(t,{units:e,target:n=0,legibleAt:i=260}){let[a,c]=(0,p.useState)(e);(0,p.useEffect)(()=>{let o=t.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()},[t]);let u=a/e;return{scale:u,width:a,touchable:u*n>=24,legible:a>=i}}function xt(t="--graview-font-body",e="sans-serif"){let n=(0,p.useRef)(void 0),i=(0,p.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return e;let a=getComputedStyle(document.documentElement).getPropertyValue(t).trim();return a.length>0?a:e},[t,e]);return(0,p.useMemo)(()=>{n.current===void 0&&(n.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let a=n.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 wt=(0,p.createContext)(void 0);var T=3;function pe(t){let e=V(t),n=e.focusId;if(!n)return null;if(e.within?.view){let[a]=B(n);if(a)return{at:`screen:${a}`,audience:!0}}return{at:n,audience:!1}}var fe=102,me=32;function St(t,e,n){let i=[],a=new Map,c=new Map,u=0;for(let o of t){let r=pe(o.stop),s=r?e(r.at):null;if(!r||!s){o.name&&i.push({kind:"edge",presence:o,point:{x:n-8,y:fe+u++*me}});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,b=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:b,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 t)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{st as a,P as b,ne as c,re as d,Y as e,ut as f,de as g,lt as h,le as i,pt as j,ft as k,gt as l,xt as m,be as n,Qe as o,Je as p,St as q,U as r,nt as s,rt as t,ot as u};
@@ -1 +1 @@
1
- var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as t}from"./chunk.SDO3U72B.js";var d=t(()=>(__graviewPreload(import.meta.url,["./chunk.GVNYPFIM.js","./chunk.ETR6AV47.js","./chunk.BRDAO2OF.js","./chunk.I5TOMBIF.js","./chunk.QQTRAY5W.js","./chunk.DOBQ4LO4.js","./chunk.BBLIT7S7.js","./chunk.6TKILWRM.js","./chunk.PXQVXBNG.js","./chunk.G446PWV6.js","./chunk.SDO3U72B.js","./chunk.4TJOS4C7.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.B2IIEVBF.js")));function v(i,r){let e=!1,n=()=>{window.removeEventListener("online",n),e||o()},o=()=>void i().then(m=>{e||r(m)},()=>{e||window.addEventListener("online",n)});return o(),()=>{e=!0,window.removeEventListener("online",n)}}export{d as a,v as b};
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 t}from"./chunk.SDO3U72B.js";var d=t(()=>(__graviewPreload(import.meta.url,["./chunk.ZBBCUK2K.js","./chunk.KVEDMKUN.js","./chunk.BRDAO2OF.js","./chunk.4XOSDCCE.js","./chunk.JLPBXG4P.js","./chunk.U2M4SGUU.js","./chunk.BBLIT7S7.js","./chunk.ZKDJQDKX.js","./chunk.PXQVXBNG.js","./chunk.G446PWV6.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.IMFAPZ6J.js")));function v(i,r){let e=!1,n=()=>{window.removeEventListener("online",n),e||o()},o=()=>void i().then(m=>{e||r(m)},()=>{e||window.addEventListener("online",n)});return o(),()=>{e=!0,window.removeEventListener("online",n)}}export{d as a,v as b};
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o}from"./chunk.KZ3UPV2L.js";import"./chunk.G4JJXA63.js";import"./chunk.64TFAR5Z.js";import"./chunk.5DZR46YG.js";import"./chunk.Q7RI4SI4.js";import"./chunk.XOZU4OFA.js";import"./chunk.CR5MQMOL.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.RXJBYP7B.js";import"./chunk.BJAQRV2R.js";import"./chunk.JJP5OL5E.js";import"./chunk.WVUJXDXZ.js";import"./chunk.6SHF6IL5.js";import"./chunk.MQISKON2.js";import"./chunk.GQX57JIE.js";import"./chunk.LJXAZ5TF.js";import"./chunk.QFI4L2HK.js";import"./chunk.KFHXTHIY.js";import"./chunk.TT6QBWRA.js";import"./chunk.UCS3CBT4.js";import"./chunk.O6SKKF4V.js";import"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import"./chunk.AJZBJBMO.js";export{i as draftAnswer,h as draftFromLens,b as draftSight,l as draftView,a as isDraftFailure,c as judgeLens,d as lensEditOf,f as lensFromSpec,j as recipeDraft,g as recipeOfLens,m as refineDraft,o as runDraftTool,e as takeBackEditOf,k as templateDraft,n as withReaderLenses};
@@ -1,2 +1,2 @@
1
- import{Da as Q,Eb as I,F,G as B,I as L,La as X,Lb as en,O,R as j,S as J,T as U,U as K,Wa as v,Ya as nn,_ as P,aa as Z,la as z}from"./chunk.4TJOS4C7.js";var un=1e4,g=class{constructor(s){this.nodes=s}},rn=Symbol.for("@graview/core:far-record"),fn=e=>typeof e=="object"&&e!==null&&e[rn]===!0;function cn(e){let s={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(s,rn,{value:!0}),s}function Nn(e){let s=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${s} is not one this viewer may open`:`${s} has not been read`}var pn="",f=class extends Error{constructor(c,l){super(c);this.sentence=c;this.at=l}},W=class extends f{},V=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof g)&&typeof e.id=="string",tn=e=>{let s=new Set;return new g(e.filter(c=>!s.has(c.id)&&s.add(c.id)))},w=e=>e===null?"nothing":e instanceof g?"a set of records":Array.isArray(e)?"a list":V(e)?"a record":typeof e=="string"?"a word":typeof e;function on(e,s){let c=s.budget??un,l=(n,a)=>{if(c-=n,c<0)throw new W("this rule looks at too much of the graph to judge in one go",a)},u=s.today??L(),b=s.now??new Date().toISOString(),k=new Map,N=new Set,A=s.bindings,H=(n,a,t,o)=>{let d=`${n?.id}\0${a}`;if(k.has(d))return k.get(d);if(N.has(d))throw new f(`"${a}"${n?` of ${z(n.kind)}`:""} depends on itself`,o);N.add(d);let r=A;A=void 0;try{let i=$(t,n);return k.set(d,i),i}finally{A=r,N.delete(d)}},E=(n,a,t)=>{l(1,t);let o=s.kinds.get(n.kind),d=o?.computed?.get(a);if(d)return H(n,a,d,t);let r=o?.linked?.get(a);if(r){let y=Q(Object.hasOwn(n,a)?n[a]:void 0,r);l(y.length,t);let m=s.linked??X(s.graph),h=y.flatMap(x=>{let C=m?m(x):{unread:!0};return"record"in C?[cn(C.record)]:(s.onUnread?.({relation:a,ref:x,reason:"denied"in C?"denied":"unread"}),[])});return r.cardinality==="one"?h[0]??null:new g(h)}let i=Object.hasOwn(n,a);if(o?.fields.has(a)||i){let y=i?v(n,a,u):void 0;return y===void 0?null:y}let p=o?.edges.get(a);if(p){let y=s.graph.out(n.id,a);return l(y.length,t),p==="one"?y[0]??null:new g(y)}if(a==="id")return n.id;if(fn(n))return null;throw new f(`${z(n.kind)} has no field or relation called "${a}"`,t)},S=(n,a,t)=>{if(n instanceof g)return n;if(n===null)return new g([]);if(V(n))return new g([n]);throw new f(`${t}(\u2026) needs a set of records, and was given ${w(n)}`,a)},G=(n,a,t)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new f(`${t}(\u2026) needs a word, and was given ${w(n)}`,a)},_=(n,a,t)=>{let o=G(n,a,t);if(o===null)return null;let d=Date.parse(o.length===10?`${o}T00:00:00Z`:o);if(Number.isNaN(d))throw new f(`${t}(\u2026) needs a date, and "${o}" is not one`,a);return d},M=(n,a)=>V(n)&&V(a)?n.id===a.id:V(n)&&typeof a=="string"?n.id===a:typeof n=="string"&&V(a)?n===a.id:Array.isArray(n)&&Array.isArray(a)?n.length===a.length&&n.every((t,o)=>M(t,a[o])):n===a,R=(n,a,t)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new f(`${t} must be true or false, and was ${w(n)}`,a)},T=(n,a)=>$(a,n);function $(n,a){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(t=>$(t,a));case"ident":{let t=A&&Object.hasOwn(A,n.name)?A[n.name]:void 0;if(t!==void 0)return t;if(a)return E(a,n.name,n.at);throw new f(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let t=$(n.object,a);if(t===null)return null;if(V(t))return E(t,n.name,n.at);throw new f(`".${n.name}" needs a record before it, and was given ${w(t)}`,n.at)}case"unary":{let t=$(n.operand,a);if(n.op==="!")return!R(t,n.at,"what follows not");if(t===null)return null;if(typeof t!="number")throw new f(`"-" needs a number, and was given ${w(t)}`,n.at);return-t}case"where":{let t=S($(n.set,a),n.at,"where");return l(t.nodes.length,n.at),new g(t.nodes.filter(o=>R(T(o,n.filter),n.at,"a where condition")))}case"binary":return dn(n,a);case"call":return ln(n,a)}}function dn(n,a){if(n.op==="&&")return R($(n.left,a),n.at,"each side of and")&&R($(n.right,a),n.at,"each side of and");if(n.op==="||")return R($(n.left,a),n.at,"each side of or")||R($(n.right,a),n.at,"each side of or");let t=$(n.left,a),o=$(n.right,a);if(n.op==="&"||n.op==="|"||n.op==="-"&&(t instanceof g||o instanceof g)){let d=S(t,n.at,n.op).nodes,r=S(o,n.at,n.op).nodes;l(d.length+r.length,n.at);let i=new Set(r.map(p=>p.id));return tn(n.op==="|"?[...d,...r]:d.filter(p=>i.has(p.id)===(n.op==="&")))}switch(n.op){case"==":return M(t,o);case"!=":return!M(t,o);case"in":{if(o===null)return!1;if(o instanceof g)return o.nodes.some(d=>M(t,d));if(Array.isArray(o))return o.some(d=>M(t,d));if(typeof o=="string"&&typeof t=="string")return o.includes(t);throw new f(`"in" needs a list or a set on its right, and was given ${w(o)}`,n.at)}case"<":case"<=":case">":case">=":{if(t===null||o===null)return!1;if(!(typeof t=="number"&&typeof o=="number"||typeof t=="string"&&typeof o=="string"))throw new f(`cannot compare ${w(t)} with ${w(o)}`,n.at);return n.op==="<"?t<o:n.op==="<="?t<=o:n.op===">"?t>o:t>=o}default:{if(t===null||o===null)return null;if(n.op==="+"&&(typeof t=="string"||typeof o=="string")){let d=`${G(t,n.at,"+")}${G(o,n.at,"+")}`;if(d.length>1e4)throw new f("that makes a word too long",n.at);return d}if(typeof t!="number"||typeof o!="number")throw new f(`"${n.op}" needs numbers, and was given ${w(t)} and ${w(o)}`,n.at);return(n.op==="/"||n.op==="%")&&o===0?null:n.op==="+"?t+o:n.op==="-"?t-o:n.op==="*"?t*o:n.op==="/"?t/o:t%o}}}function ln(n,a){let t=(r,i=r)=>{if(n.args.length<r||n.args.length>i)throw new f(`${n.fn}(\u2026) takes ${r===i?r:`${r} to ${i}`} argument${i===1?"":"s"}`,n.at)},o=r=>$(n.args[r],a),d=r=>{let i=o(r);if(typeof i!="string")throw new f(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return i};switch(n.fn){case"out":case"in":{t(1,2);let r=(y,m)=>n.fn==="out"?s.graph.out(y,m):s.graph.in(y,m);if(n.args.length===2){let y=S(o(0),n.at,n.fn).nodes,m=d(1);return tn(y.flatMap(h=>{let x=r(h.id,m);return l(x.length+1,n.at),x}))}let i=d(0);if(!a)throw new f(`${n.fn}('${i}') needs a record to start from`,n.at);let p=r(a.id,i);return l(p.length,n.at),new g(p)}case"all":{t(1,2);let r=s.graph.nodesOfKind(d(0),{archived:n.args.length===2?o(1):!1});return l(r.length,n.at),new g(r)}case"archived":return t(0,1),nn(n.args.length===1?o(0):a);case"count":return t(1),S(o(0),n.at,"count").nodes.length;case"exists":return t(1),S(o(0),n.at,"exists").nodes.length>0;case"every":case"some":{t(2);let r=S(o(0),n.at,n.fn);l(r.nodes.length,n.at);let i=p=>R(T(p,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(i):r.nodes.some(i)}case"sum":case"min":case"max":{t(2);let r=S(o(0),n.at,n.fn);l(r.nodes.length,n.at);let i=n.args[1],p=i.t==="lit"&&typeof i.value=="string"?i.value:void 0,y=i.t==="ident"?`'${i.name}'`:p!==void 0?`'${p}'`:"\u2026",m=r.nodes.map(h=>i.t==="ident"?E(h,i.name,n.at):p!==void 0?E(h,p,n.at):T(h,i)).filter(h=>{if(h===null)return!1;if(typeof h!="number")throw new f(`${n.fn}(\u2026, ${y}) needs a number for each member, and found ${w(h)}`,n.at);return!0});return n.fn==="sum"?m.reduce((h,x)=>h+x,0):m.length===0?null:n.fn==="min"?Math.min(...m):Math.max(...m)}case"fact":{t(1);let r=d(0),i=s.kinds.get(pn)?.computed?.get(r);if(!i)throw new f(`no fact is called "${r}"`,n.at);return H(null,r,i,n.at)}case"first":return t(1),S(o(0),n.at,"first").nodes[0]??null;case"sort":{t(2,3);let r=S(o(0),n.at,"sort"),i=n.args.length===3?o(2):"asc";if(i!=="asc"&&i!=="desc")throw new f("sort(\u2026) goes 'asc' or 'desc'",n.at);let p=r.nodes.length;l(p+p*Math.ceil(Math.log2(p+1)),n.at);let y=r.nodes.map((h,x)=>({node:h,i:x,key:T(h,n.args[1])})),m=i==="desc"?-1:1;return y.sort((h,x)=>Y(h.key,x.key,m,n.at)||h.i-x.i),new g(y.map(h=>h.node))}case"either":{if(n.args.length<1)throw new f("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let i=o(r);if(i!==null&&!(i instanceof g&&i.nodes.length===0))return i}return null}case"present":{t(1);let r=o(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof g?r.nodes.length>0:!0}case"len":{t(1);let r=o(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof g)return r.nodes.length;throw new f(`len(\u2026) needs a word or a list, and was given ${w(r)}`,n.at)}case"contains":case"startsWith":{t(2);let r=o(0),i=o(1);if(r===null||i===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(m=>M(m,i));let p=G(r,n.at,n.fn),y=G(i,n.at,n.fn);return n.fn==="contains"?p.toLowerCase().includes(y.toLowerCase()):p.startsWith(y)}case"lower":{t(1);let r=G(o(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"today":return t(0),u;case"now":return t(0),b;case"date":{t(1);let r=_(o(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{t(2);let r=_(o(0),n.at,n.fn),i=_(o(1),n.at,n.fn);if(r===null||i===null)return null;let p=(i-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(p):p}case"if":return t(3),R(o(0),n.at,"the condition in if(\u2026)")?o(1):o(2);default:throw new f(`"${n.fn}" is not a function the rule language knows`,n.at)}}function Y(n,a,t,o){if(n===null||a===null)return n===a?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(a)){for(let r=0;r<Math.max(n.length,a.length);r++){let i=Y(n[r]??null,a[r]??null,t,o);if(i!==0)return i}return 0}let d=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:w(r);if(d(n)!==d(a)||typeof n=="object"||typeof a=="object")throw new f(`sort(\u2026) cannot put ${w(n)} and ${w(a)} in order`,o);return typeof n=="string"?t*(n<a?-1:n>a?1:0):t*(Number(n)-Number(a))}return $(e,s.subject)}var Rn=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact","archived"];var Gn=(e,s,c,l)=>({severity:"error",code:e,path:s,message:c,...l?{fix:l}:{}}),Mn=(e,s,c,l)=>({severity:"warning",code:e,path:s,message:c,...l?{fix:l}:{}}),On=e=>e.some(s=>s.severity==="error");function En(e){return e.map(s=>`${s.severity==="error"?"\u2717":s.severity==="warning"?"!":"\xB7"} ${s.path||"(document)"}: ${s.message}${s.fix?` \u2014 ${s.fix}`:""}`).join(`
1
+ import{Da as Q,F,G as B,Gb as I,I as L,La as X,Nb as en,O,R as j,S as J,T as U,U as K,Wa as v,Za as nn,_ as P,aa as Z,la as z}from"./chunk.BLS2G3CD.js";var un=1e4,g=class{constructor(s){this.nodes=s}},rn=Symbol.for("@graview/core:far-record"),fn=e=>typeof e=="object"&&e!==null&&e[rn]===!0;function cn(e){let s={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(s,rn,{value:!0}),s}function Nn(e){let s=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${s} is not one this viewer may open`:`${s} has not been read`}var pn="",f=class extends Error{constructor(c,l){super(c);this.sentence=c;this.at=l}},W=class extends f{},V=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof g)&&typeof e.id=="string",tn=e=>{let s=new Set;return new g(e.filter(c=>!s.has(c.id)&&s.add(c.id)))},w=e=>e===null?"nothing":e instanceof g?"a set of records":Array.isArray(e)?"a list":V(e)?"a record":typeof e=="string"?"a word":typeof e;function on(e,s){let c=s.budget??un,l=(n,a)=>{if(c-=n,c<0)throw new W("this rule looks at too much of the graph to judge in one go",a)},u=s.today??L(),b=s.now??new Date().toISOString(),k=new Map,N=new Set,A=s.bindings,H=(n,a,t,o)=>{let d=`${n?.id}\0${a}`;if(k.has(d))return k.get(d);if(N.has(d))throw new f(`"${a}"${n?` of ${z(n.kind)}`:""} depends on itself`,o);N.add(d);let r=A;A=void 0;try{let i=$(t,n);return k.set(d,i),i}finally{A=r,N.delete(d)}},E=(n,a,t)=>{l(1,t);let o=s.kinds.get(n.kind),d=o?.computed?.get(a);if(d)return H(n,a,d,t);let r=o?.linked?.get(a);if(r){let y=Q(Object.hasOwn(n,a)?n[a]:void 0,r);l(y.length,t);let m=s.linked??X(s.graph),h=y.flatMap(x=>{let C=m?m(x):{unread:!0};return"record"in C?[cn(C.record)]:(s.onUnread?.({relation:a,ref:x,reason:"denied"in C?"denied":"unread"}),[])});return r.cardinality==="one"?h[0]??null:new g(h)}let i=Object.hasOwn(n,a);if(o?.fields.has(a)||i){let y=i?v(n,a,u):void 0;return y===void 0?null:y}let p=o?.edges.get(a);if(p){let y=s.graph.out(n.id,a);return l(y.length,t),p==="one"?y[0]??null:new g(y)}if(a==="id")return n.id;if(fn(n))return null;throw new f(`${z(n.kind)} has no field or relation called "${a}"`,t)},S=(n,a,t)=>{if(n instanceof g)return n;if(n===null)return new g([]);if(V(n))return new g([n]);throw new f(`${t}(\u2026) needs a set of records, and was given ${w(n)}`,a)},G=(n,a,t)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new f(`${t}(\u2026) needs a word, and was given ${w(n)}`,a)},_=(n,a,t)=>{let o=G(n,a,t);if(o===null)return null;let d=Date.parse(o.length===10?`${o}T00:00:00Z`:o);if(Number.isNaN(d))throw new f(`${t}(\u2026) needs a date, and "${o}" is not one`,a);return d},M=(n,a)=>V(n)&&V(a)?n.id===a.id:V(n)&&typeof a=="string"?n.id===a:typeof n=="string"&&V(a)?n===a.id:Array.isArray(n)&&Array.isArray(a)?n.length===a.length&&n.every((t,o)=>M(t,a[o])):n===a,R=(n,a,t)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new f(`${t} must be true or false, and was ${w(n)}`,a)},T=(n,a)=>$(a,n);function $(n,a){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(t=>$(t,a));case"ident":{let t=A&&Object.hasOwn(A,n.name)?A[n.name]:void 0;if(t!==void 0)return t;if(a)return E(a,n.name,n.at);throw new f(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let t=$(n.object,a);if(t===null)return null;if(V(t))return E(t,n.name,n.at);throw new f(`".${n.name}" needs a record before it, and was given ${w(t)}`,n.at)}case"unary":{let t=$(n.operand,a);if(n.op==="!")return!R(t,n.at,"what follows not");if(t===null)return null;if(typeof t!="number")throw new f(`"-" needs a number, and was given ${w(t)}`,n.at);return-t}case"where":{let t=S($(n.set,a),n.at,"where");return l(t.nodes.length,n.at),new g(t.nodes.filter(o=>R(T(o,n.filter),n.at,"a where condition")))}case"binary":return dn(n,a);case"call":return ln(n,a)}}function dn(n,a){if(n.op==="&&")return R($(n.left,a),n.at,"each side of and")&&R($(n.right,a),n.at,"each side of and");if(n.op==="||")return R($(n.left,a),n.at,"each side of or")||R($(n.right,a),n.at,"each side of or");let t=$(n.left,a),o=$(n.right,a);if(n.op==="&"||n.op==="|"||n.op==="-"&&(t instanceof g||o instanceof g)){let d=S(t,n.at,n.op).nodes,r=S(o,n.at,n.op).nodes;l(d.length+r.length,n.at);let i=new Set(r.map(p=>p.id));return tn(n.op==="|"?[...d,...r]:d.filter(p=>i.has(p.id)===(n.op==="&")))}switch(n.op){case"==":return M(t,o);case"!=":return!M(t,o);case"in":{if(o===null)return!1;if(o instanceof g)return o.nodes.some(d=>M(t,d));if(Array.isArray(o))return o.some(d=>M(t,d));if(typeof o=="string"&&typeof t=="string")return o.includes(t);throw new f(`"in" needs a list or a set on its right, and was given ${w(o)}`,n.at)}case"<":case"<=":case">":case">=":{if(t===null||o===null)return!1;if(!(typeof t=="number"&&typeof o=="number"||typeof t=="string"&&typeof o=="string"))throw new f(`cannot compare ${w(t)} with ${w(o)}`,n.at);return n.op==="<"?t<o:n.op==="<="?t<=o:n.op===">"?t>o:t>=o}default:{if(t===null||o===null)return null;if(n.op==="+"&&(typeof t=="string"||typeof o=="string")){let d=`${G(t,n.at,"+")}${G(o,n.at,"+")}`;if(d.length>1e4)throw new f("that makes a word too long",n.at);return d}if(typeof t!="number"||typeof o!="number")throw new f(`"${n.op}" needs numbers, and was given ${w(t)} and ${w(o)}`,n.at);return(n.op==="/"||n.op==="%")&&o===0?null:n.op==="+"?t+o:n.op==="-"?t-o:n.op==="*"?t*o:n.op==="/"?t/o:t%o}}}function ln(n,a){let t=(r,i=r)=>{if(n.args.length<r||n.args.length>i)throw new f(`${n.fn}(\u2026) takes ${r===i?r:`${r} to ${i}`} argument${i===1?"":"s"}`,n.at)},o=r=>$(n.args[r],a),d=r=>{let i=o(r);if(typeof i!="string")throw new f(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return i};switch(n.fn){case"out":case"in":{t(1,2);let r=(y,m)=>n.fn==="out"?s.graph.out(y,m):s.graph.in(y,m);if(n.args.length===2){let y=S(o(0),n.at,n.fn).nodes,m=d(1);return tn(y.flatMap(h=>{let x=r(h.id,m);return l(x.length+1,n.at),x}))}let i=d(0);if(!a)throw new f(`${n.fn}('${i}') needs a record to start from`,n.at);let p=r(a.id,i);return l(p.length,n.at),new g(p)}case"all":{t(1,2);let r=s.graph.nodesOfKind(d(0),{archived:n.args.length===2?o(1):!1});return l(r.length,n.at),new g(r)}case"archived":return t(0,1),nn(n.args.length===1?o(0):a);case"count":return t(1),S(o(0),n.at,"count").nodes.length;case"exists":return t(1),S(o(0),n.at,"exists").nodes.length>0;case"every":case"some":{t(2);let r=S(o(0),n.at,n.fn);l(r.nodes.length,n.at);let i=p=>R(T(p,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(i):r.nodes.some(i)}case"sum":case"min":case"max":{t(2);let r=S(o(0),n.at,n.fn);l(r.nodes.length,n.at);let i=n.args[1],p=i.t==="lit"&&typeof i.value=="string"?i.value:void 0,y=i.t==="ident"?`'${i.name}'`:p!==void 0?`'${p}'`:"\u2026",m=r.nodes.map(h=>i.t==="ident"?E(h,i.name,n.at):p!==void 0?E(h,p,n.at):T(h,i)).filter(h=>{if(h===null)return!1;if(typeof h!="number")throw new f(`${n.fn}(\u2026, ${y}) needs a number for each member, and found ${w(h)}`,n.at);return!0});return n.fn==="sum"?m.reduce((h,x)=>h+x,0):m.length===0?null:n.fn==="min"?Math.min(...m):Math.max(...m)}case"fact":{t(1);let r=d(0),i=s.kinds.get(pn)?.computed?.get(r);if(!i)throw new f(`no fact is called "${r}"`,n.at);return H(null,r,i,n.at)}case"first":return t(1),S(o(0),n.at,"first").nodes[0]??null;case"sort":{t(2,3);let r=S(o(0),n.at,"sort"),i=n.args.length===3?o(2):"asc";if(i!=="asc"&&i!=="desc")throw new f("sort(\u2026) goes 'asc' or 'desc'",n.at);let p=r.nodes.length;l(p+p*Math.ceil(Math.log2(p+1)),n.at);let y=r.nodes.map((h,x)=>({node:h,i:x,key:T(h,n.args[1])})),m=i==="desc"?-1:1;return y.sort((h,x)=>Y(h.key,x.key,m,n.at)||h.i-x.i),new g(y.map(h=>h.node))}case"either":{if(n.args.length<1)throw new f("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let i=o(r);if(i!==null&&!(i instanceof g&&i.nodes.length===0))return i}return null}case"present":{t(1);let r=o(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof g?r.nodes.length>0:!0}case"len":{t(1);let r=o(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof g)return r.nodes.length;throw new f(`len(\u2026) needs a word or a list, and was given ${w(r)}`,n.at)}case"contains":case"startsWith":{t(2);let r=o(0),i=o(1);if(r===null||i===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(m=>M(m,i));let p=G(r,n.at,n.fn),y=G(i,n.at,n.fn);return n.fn==="contains"?p.toLowerCase().includes(y.toLowerCase()):p.startsWith(y)}case"lower":{t(1);let r=G(o(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"today":return t(0),u;case"now":return t(0),b;case"date":{t(1);let r=_(o(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{t(2);let r=_(o(0),n.at,n.fn),i=_(o(1),n.at,n.fn);if(r===null||i===null)return null;let p=(i-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(p):p}case"if":return t(3),R(o(0),n.at,"the condition in if(\u2026)")?o(1):o(2);default:throw new f(`"${n.fn}" is not a function the rule language knows`,n.at)}}function Y(n,a,t,o){if(n===null||a===null)return n===a?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(a)){for(let r=0;r<Math.max(n.length,a.length);r++){let i=Y(n[r]??null,a[r]??null,t,o);if(i!==0)return i}return 0}let d=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:w(r);if(d(n)!==d(a)||typeof n=="object"||typeof a=="object")throw new f(`sort(\u2026) cannot put ${w(n)} and ${w(a)} in order`,o);return typeof n=="string"?t*(n<a?-1:n>a?1:0):t*(Number(n)-Number(a))}return $(e,s.subject)}var Rn=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact","archived"];var Gn=(e,s,c,l)=>({severity:"error",code:e,path:s,message:c,...l?{fix:l}:{}}),Mn=(e,s,c,l)=>({severity:"warning",code:e,path:s,message:c,...l?{fix:l}:{}}),On=e=>e.some(s=>s.severity==="error");function En(e){return e.map(s=>`${s.severity==="error"?"\u2717":s.severity==="warning"?"!":"\xB7"} ${s.path||"(document)"}: ${s.message}${s.fix?` \u2014 ${s.fix}`:""}`).join(`
2
2
  `)}var jn=["money","percent","date","time","datetime","relative","upper","lower","count","words","and","plural","excerpt"],gn={getNode:()=>{},allNodes:()=>[],allEdges:()=>[],nodesOfKind:()=>[],edgesOfKind:()=>[],out:()=>[],in:()=>[],neighbors:()=>[],has:()=>!1};function Un(e,s,c,l=[],u,b=D){return q(e,s,c,l,u,b)}var yn=(e,s)=>e.capital?P(s):s,hn=new Set(["words","plural","relative"]);function Kn(e,s){let c=e[0];return!c||c.text!==void 0||!c.format||!hn.has(c.format)?s:/^[a-z][a-z'’-]*(?=\s|$|[,.;:!?])/.test(s)?P(s):s}function mn(e){return e?s=>{let c=e.tryDefinition(s.kind)?.label;return c?c(s):D(s)}:D}var an=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],sn=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function wn(e,s){return!Number.isInteger(e)||e<0||e>99?K(e,s):e<20?an[e]:e%10===0?sn[e/10]:`${sn[Math.floor(e/10)]}-${an[e%10]}`}function $n(e){return/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:`${e}s`}var D=e=>String(e.name??e.title??e.label??e.id);function q(e,s,c,l=[],u,b=D){if(s==="plural"){let k=e instanceof g?e.nodes.length:Array.isArray(e)?e.length:typeof e=="number"?e:null;return k===null||l[0]===void 0?"\u2014":k===1?l[0]:l[1]??$n(l[0])}if(e===null)return"\u2014";if(e instanceof g)return s==="count"?String(e.nodes.length):s==="and"?Z(e.nodes.map(b)):e.nodes.map(b).join(", ");if(Array.isArray(e)){if(s==="count")return String(e.length);let k=e.map(N=>q(N,void 0,c,[],u,b));return s==="and"?Z(k):k.join(", ")}if(typeof e=="object")return b(e);switch(s){case"words":return typeof e=="number"?wn(e,u?.locale):String(e);case"money":return typeof e=="number"?I(e,u):String(e);case"percent":return typeof e=="number"?K(e,u?.locale,{style:"percent",maximumFractionDigits:0}):String(e);case"upper":return String(e).toUpperCase();case"lower":return String(e).toLowerCase();case"excerpt":return en(String(e),Number(l[0])||void 0);case"date":return O(U(String(e),u?.timeZone)??String(e).slice(0,10),u?.locale);case"time":return typeof e=="string"&&F.test(e)?O(e,u?.locale):J(String(e),u?.locale,u?.timeZone);case"datetime":return typeof e=="string"&&F.test(e)?O(e,u?.locale):j(String(e),u?.locale,u?.timeZone);case"relative":{let k=U(String(e),u?.timeZone),N=k===void 0?Date.parse(String(e)):Date.parse(`${k}T00:00:00Z`);if(Number.isNaN(N))return String(e);let A=Math.round((N-Date.parse(`${c}T00:00:00Z`))/864e5);return A===0?"today":A===1?"tomorrow":A===-1?"yesterday":A>0?`in ${A} days`:`${-A} days ago`}default:return typeof e=="string"&&F.test(e)?O(e,u?.locale):typeof e=="string"&&B.test(e)?j(e,u?.locale,u?.timeZone):String(e)}}function Pn(e,s){let c=s.today??L(),l=s.name??mn(s.graph?.schema);return e.map(u=>{if(u.text!==void 0)return u.text;try{let b=on(u.expr,{graph:s.graph??gn,subject:s.node,kinds:s.kinds,today:c,budget:s.budget??500,...s.bindings?{bindings:s.bindings}:{}});return yn(u,q(b,u.format,c,u.formatArgs,s.money,l))}catch(b){if(b instanceof f)return"\u2014";throw b}}).join("")}export{g as a,Nn as b,pn as c,f as d,W as e,on as f,Rn as g,Gn as h,Mn as i,On as j,En as k,jn as l,gn as m,Un as n,yn as o,Kn as p,mn as q,Pn as r};
@@ -1,4 +1,4 @@
1
- import{a as k,b as A,c as L,d as _,e as E,r as B,s as V,t as H,u as N,v as q}from"./chunk.OJGHDWI6.js";import"./chunk.4TJOS4C7.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";var W=["drawElementImageToTexture","copyElementImageToTexture"],S=null,P=(r,e)=>r==="texture"?{texture:e}:{destination:{texture:e}};function Z(){return typeof globalThis>"u"?void 0:globalThis}function v(r,e){let t=[],n=Z(),o=!!(n?.navigator&&"gpu"in n.navigator);o||t.push("navigator.gpu is absent \u2014 WebGPU is unavailable.");let i=r??n?.GPUQueue?.prototype??void 0,a=null;if(i){for(let d of W)if(typeof i[d]=="function"){a=d;break}}a||t.push("No element-capture method on GPUQueue. Run Chromium 147+ with --enable-blink-features=CanvasDrawElement.");let c=e??n?.HTMLCanvasElement?.prototype??void 0,l=typeof c?.updateElementGeometry=="function";l||t.push("canvas.updateElementGeometry is absent \u2014 geometry cannot be reported.");let p=typeof c?.requestPaint=="function";p||t.push("canvas.requestPaint is absent \u2014 there is no capture-safe moment to hook.");let w=!1,h="unknown";if(typeof document<"u"){let d=document.createElement("canvas");w="layoutSubtree"in d||typeof d.captureElementImage=="function","layoutSubtree"in d?h="no":typeof d.captureElementImage=="function"&&(h="yes")}return{available:a!==null,captureMethod:a,geometrySync:l,hitTestFollowsGeometry:l?h:"no",layoutSubtree:w,paintEvents:p,webgpu:o,usable:o&&a!==null,notes:t}}var g=class extends Error{constructor(t){super(`HTML-in-Canvas is unavailable:
1
+ import{a as k,b as A,c as L,d as _,e as E,r as B,s as V,t as H,u as N,v as q}from"./chunk.OJGHDWI6.js";import"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import"./chunk.AJZBJBMO.js";var W=["drawElementImageToTexture","copyElementImageToTexture"],S=null,P=(r,e)=>r==="texture"?{texture:e}:{destination:{texture:e}};function Z(){return typeof globalThis>"u"?void 0:globalThis}function v(r,e){let t=[],n=Z(),o=!!(n?.navigator&&"gpu"in n.navigator);o||t.push("navigator.gpu is absent \u2014 WebGPU is unavailable.");let i=r??n?.GPUQueue?.prototype??void 0,a=null;if(i){for(let d of W)if(typeof i[d]=="function"){a=d;break}}a||t.push("No element-capture method on GPUQueue. Run Chromium 147+ with --enable-blink-features=CanvasDrawElement.");let c=e??n?.HTMLCanvasElement?.prototype??void 0,l=typeof c?.updateElementGeometry=="function";l||t.push("canvas.updateElementGeometry is absent \u2014 geometry cannot be reported.");let p=typeof c?.requestPaint=="function";p||t.push("canvas.requestPaint is absent \u2014 there is no capture-safe moment to hook.");let w=!1,h="unknown";if(typeof document<"u"){let d=document.createElement("canvas");w="layoutSubtree"in d||typeof d.captureElementImage=="function","layoutSubtree"in d?h="no":typeof d.captureElementImage=="function"&&(h="yes")}return{available:a!==null,captureMethod:a,geometrySync:l,hitTestFollowsGeometry:l?h:"no",layoutSubtree:w,paintEvents:p,webgpu:o,usable:o&&a!==null,notes:t}}var g=class extends Error{constructor(t){super(`HTML-in-Canvas is unavailable:
2
2
  ${t.notes.join(`
3
3
  `)}`);this.capabilities=t;this.name="PlatformUnavailableError"}};function G(r,e,t){let n=r;for(let o of W){let i=n[o];if(typeof i=="function"){if(S){i.call(n,{source:e},P(S,t));return}try{i.call(n,{source:e},P("texture",t)),S="texture"}catch(a){if(!(a instanceof TypeError)||!/texture/i.test(a.message))throw a;i.call(n,{source:e},P("destination",t)),S="destination"}return}}throw new g(v(r))}function M(r,e=!0){e?r.setAttribute("drawable",""):r.removeAttribute("drawable")}function F(r){let e=r.changedElements;return e?new Set(Array.from(e)):null}function ee(r,e){let t=r;if(typeof t.captureElementImage!="function")throw new g(v(void 0,r));return t.captureElementImage(e)}function O(r,e,t){let n=r;if(typeof n.updateElementGeometry!="function")throw new g(v(void 0,r));n.updateElementGeometry(e,t)}function te(r,e){r.clearElementGeometry?.(e)}function m(r){r.requestPaint?.()}function D(r,e=!0){let t=r;e?t.setAttribute("content","drawable"):t.removeAttribute("content"),"layoutSubtree"in t?t.layoutSubtree=e:e?t.setAttribute("layoutsubtree",""):t.removeAttribute("layoutsubtree")}var I=`
4
4
  struct Plane {
@@ -1 +1 @@
1
- var s="graview:pins",t={pinned:[],unpinned:[]},i=e=>Array.isArray(e)?e.filter(o=>typeof o=="string"):[];function f(){try{let e=globalThis.localStorage?.getItem(s);if(!e)return t;let o=JSON.parse(e);if(Array.isArray(o))return{pinned:i(o),unpinned:[]};if(typeof o=="object"&&o!==null){let n=o;return{pinned:i(n.pinned),unpinned:i(n.unpinned)}}return t}catch{return t}}function a(e){try{globalThis.localStorage?.setItem(s,JSON.stringify(e))}catch{}}function u(e,o,n=!1){let r=l=>l.filter(d=>d!==o),p=n?e.unpinned.includes(o)?{pinned:r(e.pinned),unpinned:r(e.unpinned)}:{pinned:r(e.pinned),unpinned:[...e.unpinned,o]}:e.pinned.includes(o)?{pinned:r(e.pinned),unpinned:r(e.unpinned)}:{pinned:[...e.pinned,o],unpinned:r(e.unpinned)};return a(p),p}export{f as a,u as b};
1
+ var s="graview:pins",t={pinned:[],unpinned:[]},p=e=>Array.isArray(e)?e.filter(o=>typeof o=="string"):[];function f(){try{let e=globalThis.localStorage?.getItem(s);if(!e)return t;let o=JSON.parse(e);if(Array.isArray(o))return{pinned:p(o),unpinned:[]};if(typeof o=="object"&&o!==null){let n=o;return{pinned:p(n.pinned),unpinned:p(n.unpinned)}}return t}catch{return t}}function a(e){try{globalThis.localStorage?.setItem(s,JSON.stringify(e))}catch{}}function u(e,o,n=!1){let r=l=>l.filter(d=>d!==o),i=n?e.unpinned.includes(o)?{pinned:r(e.pinned),unpinned:r(e.unpinned)}:{pinned:r(e.pinned),unpinned:[...e.unpinned,o]}:e.pinned.includes(o)?{pinned:r(e.pinned),unpinned:r(e.unpinned)}:{pinned:[...e.pinned,o],unpinned:r(e.unpinned)};return a(i),i}export{f as a,u as b};