graview 0.1.66 → 0.1.67

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 (197) hide show
  1. package/dist/preview/{chunk.LSN2IPAI.js → chunk.25QFDTCU.js} +1 -1
  2. package/dist/preview/{chunk.BFAFCVL4.js → chunk.264PB572.js} +1 -1
  3. package/dist/preview/chunk.2FHIINXG.js +2 -0
  4. package/dist/preview/{chunk.HSSIMVVM.js → chunk.2VUX54XH.js} +1 -1
  5. package/dist/preview/{chunk.CTASTRQN.js → chunk.35KMZHB7.js} +1 -1
  6. package/dist/preview/{chunk.OWFS2YDQ.js → chunk.37RFCHSS.js} +1 -1
  7. package/dist/preview/chunk.3ENPWZBG.js +1 -0
  8. package/dist/preview/{chunk.XMQG2PSM.js → chunk.3GNT5MKP.js} +1 -1
  9. package/dist/preview/{chunk.BXBEGMPO.js → chunk.3NSV3WKM.js} +2 -2
  10. package/dist/preview/chunk.3ZODN6BW.js +1 -0
  11. package/dist/preview/{chunk.OPTYYIGC.js → chunk.47XEJZ3O.js} +1 -1
  12. package/dist/preview/{chunk.5FNFRVTL.js → chunk.4EMKCKDB.js} +1 -1
  13. package/dist/preview/{chunk.B6JRTW3A.js → chunk.4UUJHLHR.js} +1 -1
  14. package/dist/preview/{chunk.FBILPNGH.js → chunk.4W57E7AX.js} +1 -1
  15. package/dist/preview/chunk.55G4IPOO.js +1 -0
  16. package/dist/preview/{chunk.72XP2ARZ.js → chunk.5AKZROMR.js} +1 -1
  17. package/dist/preview/chunk.5J6DVR7S.js +1 -0
  18. package/dist/preview/{chunk.FXT5CN32.js → chunk.5R744JGZ.js} +1 -1
  19. package/dist/preview/{chunk.NJRLJEJY.js → chunk.6KJGRM7A.js} +1 -1
  20. package/dist/preview/{chunk.4AC2QM7T.js → chunk.6N4PE3U5.js} +1 -1
  21. package/dist/preview/{chunk.LGRVEHXT.js → chunk.6NG76MDA.js} +2 -2
  22. package/dist/preview/{chunk.4FCFNAA4.js → chunk.6SJEZWH3.js} +1 -1
  23. package/dist/preview/{chunk.7VADSNPZ.js → chunk.6UQFV53C.js} +1 -1
  24. package/dist/preview/{chunk.WAB3L3ZI.js → chunk.6W6XMLSF.js} +1 -1
  25. package/dist/preview/{chunk.4JULYKGD.js → chunk.77C556NM.js} +1 -1
  26. package/dist/preview/{chunk.IGK7EZCX.js → chunk.7ARRVNUR.js} +1 -1
  27. package/dist/preview/{chunk.CBXS23YH.js → chunk.7BJRHPE3.js} +2 -2
  28. package/dist/preview/{chunk.ZQR2SN65.js → chunk.7S6ZRMW4.js} +1 -1
  29. package/dist/preview/{chunk.IAEHUSQQ.js → chunk.7UHPHEH5.js} +1 -1
  30. package/dist/preview/chunk.7WHQWLL6.js +1 -0
  31. package/dist/preview/{chunk.KACSYPEV.js → chunk.A4EZAGG7.js} +1 -1
  32. package/dist/preview/chunk.A5PSEU3W.js +25 -0
  33. package/dist/preview/{chunk.VKZIEZ5C.js → chunk.A7GVTE5Y.js} +2 -2
  34. package/dist/preview/{chunk.45JP6VGJ.js → chunk.AJMVRFYX.js} +2 -2
  35. package/dist/preview/{chunk.6P6NGZ6D.js → chunk.AKJS2NUM.js} +1 -1
  36. package/dist/preview/{chunk.CU2WCYMK.js → chunk.ARWO4WOV.js} +1 -1
  37. package/dist/preview/chunk.B5SJMCTT.js +7 -0
  38. package/dist/preview/{chunk.JXNVNFV4.js → chunk.B7KZBT27.js} +1 -1
  39. package/dist/preview/{chunk.E3UL4MCD.js → chunk.BDNQMKDG.js} +1 -1
  40. package/dist/preview/{chunk.YNEHJWJV.js → chunk.BKYZSV2Y.js} +1 -1
  41. package/dist/preview/{chunk.5BX66FBP.js → chunk.CKDCTFLU.js} +1 -1
  42. package/dist/preview/chunk.CTUJZ3IV.js +1 -0
  43. package/dist/preview/chunk.CY7FFKEZ.js +1 -0
  44. package/dist/preview/{chunk.3PBTN7RO.js → chunk.D4WJ7OM5.js} +1 -1
  45. package/dist/preview/{chunk.C2C3AXGI.js → chunk.D7NWMXSX.js} +3 -3
  46. package/dist/preview/chunk.DEKRFTRN.js +4 -0
  47. package/dist/preview/{chunk.E7EWNWAN.js → chunk.DKEIEH2D.js} +1 -1
  48. package/dist/preview/{chunk.I2737CPF.js → chunk.DWM7AR5Y.js} +1 -1
  49. package/dist/preview/{chunk.ANS2IEEV.js → chunk.DZMIYEHQ.js} +1 -1
  50. package/dist/preview/{chunk.BMENTGDC.js → chunk.E5PYNAYT.js} +2 -2
  51. package/dist/preview/chunk.EBKH3ILT.js +1 -0
  52. package/dist/preview/{chunk.DTCAUPLC.js → chunk.EFVSZKB5.js} +1 -1
  53. package/dist/preview/{chunk.QOS5T46W.js → chunk.EGPCVMDU.js} +1 -1
  54. package/dist/preview/{chunk.7ZKBYXUM.js → chunk.EJ2EZL2G.js} +1 -1
  55. package/dist/preview/{chunk.7VP6Y6D2.js → chunk.EP6Q32WT.js} +1 -1
  56. package/dist/preview/{chunk.OOSIKCOS.js → chunk.F464JKHZ.js} +1 -1
  57. package/dist/preview/{chunk.VGHO3VCB.js → chunk.FLJXYESX.js} +1 -1
  58. package/dist/preview/chunk.FOUBDGL3.js +1 -0
  59. package/dist/preview/chunk.FPHRAO3R.js +1 -0
  60. package/dist/preview/{chunk.4FDVINRJ.js → chunk.FRQSLWP4.js} +1 -1
  61. package/dist/preview/{chunk.2MHNPBHC.js → chunk.FVQKSN33.js} +1 -1
  62. package/dist/preview/{chunk.PDDIQ6PK.js → chunk.G3GFDVO2.js} +1 -1
  63. package/dist/preview/{chunk.ZD7T234N.js → chunk.G5GVT6JY.js} +1 -1
  64. package/dist/preview/{chunk.3L4JMM3P.js → chunk.GFLH7RCI.js} +1 -1
  65. package/dist/preview/{chunk.OO2OP76C.js → chunk.GMLONS5L.js} +1 -1
  66. package/dist/preview/{chunk.FK722SHI.js → chunk.GRFD42WM.js} +1 -1
  67. package/dist/preview/{chunk.2VR7YEJ6.js → chunk.GVT4UUQA.js} +1 -1
  68. package/dist/preview/{chunk.GME63ZHI.js → chunk.H3EGBDW2.js} +1 -1
  69. package/dist/preview/{chunk.DQFHIJFN.js → chunk.H6KIEDZN.js} +1 -1
  70. package/dist/preview/{chunk.5B5SRTUK.js → chunk.HAOB6O72.js} +1 -1
  71. package/dist/preview/chunk.HB5NWHFP.js +3 -0
  72. package/dist/preview/{chunk.6EHHMWPP.js → chunk.HJUZMOW2.js} +1 -1
  73. package/dist/preview/{chunk.6MQ5NT7S.js → chunk.HN4ZJ4B4.js} +1 -1
  74. package/dist/preview/chunk.HVBKI5ZO.js +1 -0
  75. package/dist/preview/chunk.I3SDKMQS.js +1 -0
  76. package/dist/preview/{chunk.QQAZQDRW.js → chunk.IAEGJDF3.js} +1 -1
  77. package/dist/preview/{chunk.QWNSHISU.js → chunk.IDALEKIW.js} +1 -1
  78. package/dist/preview/{chunk.QFHWG4LN.js → chunk.ILJDLBPJ.js} +1 -1
  79. package/dist/preview/{chunk.ZR2TP3BF.js → chunk.J2OPIS3H.js} +1 -1
  80. package/dist/preview/chunk.J5OLYVZ4.js +1 -0
  81. package/dist/preview/{chunk.LETAQTLJ.js → chunk.J6HF7IRQ.js} +1 -1
  82. package/dist/preview/{chunk.RWIN3POV.js → chunk.JEC5FDKX.js} +1 -1
  83. package/dist/preview/chunk.JKFVNQY7.js +1 -0
  84. package/dist/preview/{chunk.LLIURXFP.js → chunk.JQ2WNKDW.js} +1 -1
  85. package/dist/preview/{chunk.Z7Y3R3YR.js → chunk.JQ63N4MZ.js} +1 -1
  86. package/dist/preview/{chunk.DZFM6GSY.js → chunk.JU6UFWS3.js} +1 -1
  87. package/dist/preview/{chunk.INHS3KTK.js → chunk.JVB5KDSG.js} +1 -1
  88. package/dist/preview/{chunk.4U4D7WOI.js → chunk.KFT7JIEH.js} +1 -1
  89. package/dist/preview/chunk.KGMSSXZL.js +1 -0
  90. package/dist/preview/{chunk.5CXIEYHY.js → chunk.KX5ZBHMA.js} +2 -2
  91. package/dist/preview/{chunk.V7W5AQKL.js → chunk.LP2ZMAT2.js} +1 -1
  92. package/dist/preview/{chunk.BUVTUAB5.js → chunk.LRNFE3UK.js} +1 -1
  93. package/dist/preview/{chunk.PAGEGBUD.js → chunk.LVOTLGJB.js} +1 -1
  94. package/dist/preview/{chunk.QHMHUL6B.js → chunk.LYEGRY77.js} +1 -1
  95. package/dist/preview/{chunk.PPSYUOH7.js → chunk.M7KXQGQL.js} +1 -1
  96. package/dist/preview/{chunk.7BIPZTJB.js → chunk.MAKCZ6B6.js} +1 -1
  97. package/dist/preview/{chunk.EQ4OODGO.js → chunk.MJY4SLWA.js} +1 -1
  98. package/dist/preview/{chunk.EMFOMSMI.js → chunk.MSAYU25L.js} +1 -1
  99. package/dist/preview/{chunk.F4VB6Q2W.js → chunk.MUSMNKE4.js} +1 -1
  100. package/dist/preview/{chunk.BGAC3B7X.js → chunk.MW7R5G3C.js} +1 -1
  101. package/dist/preview/{chunk.AK7NGFEX.js → chunk.N4ZKZ4GM.js} +1 -1
  102. package/dist/preview/{chunk.TXHYGFIZ.js → chunk.NAXOXBOF.js} +1 -1
  103. package/dist/preview/{chunk.IWYMKGZZ.js → chunk.NKLPL7QD.js} +1 -1
  104. package/dist/preview/{chunk.QU52E5RG.js → chunk.NKYWIGC7.js} +1 -1
  105. package/dist/preview/{chunk.KSIEO5W7.js → chunk.NRURQGXV.js} +1 -1
  106. package/dist/preview/{chunk.FV72U33M.js → chunk.NSOPYIT4.js} +1 -1
  107. package/dist/preview/chunk.NXZL5CA2.js +1 -0
  108. package/dist/preview/{chunk.WVLEGCRI.js → chunk.O2OL6RQQ.js} +1 -1
  109. package/dist/preview/{chunk.TGEL6EUA.js → chunk.O5VFKVZS.js} +1 -1
  110. package/dist/preview/{chunk.CEVGND3Y.js → chunk.OCXY5DCD.js} +3 -3
  111. package/dist/preview/chunk.OHAO6KKH.js +1 -0
  112. package/dist/preview/{chunk.DSYP43NN.js → chunk.P2EKKKK2.js} +1 -1
  113. package/dist/preview/chunk.PSNMZBVS.js +1 -0
  114. package/dist/preview/{chunk.W53YNBSM.js → chunk.PZ7KY6XH.js} +1 -1
  115. package/dist/preview/{chunk.WSO7JOW5.js → chunk.QAM76AXV.js} +1 -1
  116. package/dist/preview/{chunk.PSQYDCVM.js → chunk.QF5QB5YR.js} +1 -1
  117. package/dist/preview/chunk.QNP5OR3P.js +93 -0
  118. package/dist/preview/{chunk.5LJVOLKR.js → chunk.QRQ5WPZI.js} +1 -1
  119. package/dist/preview/chunk.QWGWOEBZ.js +90 -0
  120. package/dist/preview/{chunk.OMT4QUZY.js → chunk.QXLJGHMC.js} +4 -4
  121. package/dist/preview/{chunk.J2MM6BUW.js → chunk.QZQCQWQG.js} +1 -1
  122. package/dist/preview/{chunk.6FQW6FNL.js → chunk.R6JBA7UK.js} +1 -1
  123. package/dist/preview/chunk.R7CRBRD4.js +1 -0
  124. package/dist/preview/chunk.RD2FSSLV.js +1 -0
  125. package/dist/preview/{chunk.OEIWIZCP.js → chunk.RG5G6YQD.js} +1 -1
  126. package/dist/preview/{chunk.PFQBCHQA.js → chunk.RJY7VJBH.js} +1 -1
  127. package/dist/preview/chunk.RR25BGWP.js +1 -0
  128. package/dist/preview/{chunk.BZ7QWHAE.js → chunk.RSQ432QN.js} +1 -1
  129. package/dist/preview/{chunk.MWGZKZD6.js → chunk.SFBHPYRD.js} +1 -1
  130. package/dist/preview/{chunk.FFOD5B4B.js → chunk.SJQPTDAT.js} +1 -1
  131. package/dist/preview/{chunk.OTV5XTBB.js → chunk.SNHKYH72.js} +1 -1
  132. package/dist/preview/{chunk.WSDJPXJD.js → chunk.SO6NT5K7.js} +1 -1
  133. package/dist/preview/{chunk.FDZE5LTJ.js → chunk.STPA7HBK.js} +2 -2
  134. package/dist/preview/{chunk.ONYBW45K.js → chunk.SY5ID44D.js} +1 -1
  135. package/dist/preview/chunk.T27QKVKP.js +1 -0
  136. package/dist/preview/{chunk.U6TEW6YD.js → chunk.T2OUHRAA.js} +1 -1
  137. package/dist/preview/chunk.T3WCRS6M.js +1 -0
  138. package/dist/preview/{chunk.QGIM2WAY.js → chunk.TI5FR2QQ.js} +1 -1
  139. package/dist/preview/{chunk.HOCD7KIR.js → chunk.TTSGCNPT.js} +1 -1
  140. package/dist/preview/{chunk.ES63XSIM.js → chunk.TXZQEJ5T.js} +1 -1
  141. package/dist/preview/{chunk.6LXIEM6B.js → chunk.UDHPMVC4.js} +1 -1
  142. package/dist/preview/{chunk.KBPJ7X7W.js → chunk.UGQYMN4J.js} +1 -1
  143. package/dist/preview/{chunk.M6ZN2KUO.js → chunk.UQIPEMJ5.js} +1 -1
  144. package/dist/preview/{chunk.FIFUMX5X.js → chunk.URQTF5SY.js} +1 -1
  145. package/dist/preview/{chunk.J7W2OFHY.js → chunk.UW52CMGJ.js} +1 -1
  146. package/dist/preview/{chunk.LINSO5PN.js → chunk.UWS4RMM3.js} +1 -1
  147. package/dist/preview/{chunk.QPF4KSAW.js → chunk.V7H4BUEB.js} +1 -1
  148. package/dist/preview/{chunk.KHRS2SKB.js → chunk.VBHV4TLG.js} +1 -1
  149. package/dist/preview/{chunk.U3ED7W2U.js → chunk.VBLQJVQ5.js} +1 -1
  150. package/dist/preview/{chunk.CVPMSPCH.js → chunk.WALVW3KJ.js} +1 -1
  151. package/dist/preview/{chunk.2KFZHUAC.js → chunk.WEMUKZKH.js} +1 -1
  152. package/dist/preview/{chunk.YIPXZUTT.js → chunk.X226YATK.js} +1 -1
  153. package/dist/preview/{chunk.GNEOSHQ6.js → chunk.XFLGSUYO.js} +1 -1
  154. package/dist/preview/{chunk.W4YDPHCQ.js → chunk.XSWSBTUO.js} +1 -1
  155. package/dist/preview/{chunk.OJY7VJ7D.js → chunk.YCD4JSXD.js} +1 -1
  156. package/dist/preview/{chunk.72ZCLEQC.js → chunk.YZPESGCP.js} +1 -1
  157. package/dist/preview/{chunk.XOE4KNP2.js → chunk.Z27NSSYL.js} +2 -2
  158. package/dist/preview/{chunk.DEHIR4EG.js → chunk.Z2XUVJAL.js} +1 -1
  159. package/dist/preview/{chunk.YXEO3Y65.js → chunk.Z3O2VZAJ.js} +1 -1
  160. package/dist/preview/{chunk.M2JCFNHJ.js → chunk.Z4TY44CD.js} +1 -1
  161. package/dist/preview/{chunk.EXYCN4WI.js → chunk.ZAPS4J6G.js} +1 -1
  162. package/dist/preview/{chunk.6TLXFMX2.js → chunk.ZAQ4IDX6.js} +1 -1
  163. package/dist/preview/{chunk.6HY6ZGEE.js → chunk.ZEZUKRC6.js} +1 -1
  164. package/dist/preview/{chunk.GEFXU4VO.js → chunk.ZG5VGP5U.js} +1 -1
  165. package/dist/preview/index.html +56 -56
  166. package/dist/preview/page.js +2 -2
  167. package/package.json +6 -6
  168. package/dist/preview/chunk.4WGYUYWU.js +0 -2
  169. package/dist/preview/chunk.5EMIWORS.js +0 -1
  170. package/dist/preview/chunk.6EVMXBNB.js +0 -1
  171. package/dist/preview/chunk.BCQWAFGD.js +0 -1
  172. package/dist/preview/chunk.BOCVLC7X.js +0 -1
  173. package/dist/preview/chunk.DPJNGFEZ.js +0 -4
  174. package/dist/preview/chunk.E4VRRWFP.js +0 -1
  175. package/dist/preview/chunk.EUAO4QNV.js +0 -1
  176. package/dist/preview/chunk.F7672TKJ.js +0 -1
  177. package/dist/preview/chunk.FA42HCPW.js +0 -1
  178. package/dist/preview/chunk.FBJAQPZ6.js +0 -1
  179. package/dist/preview/chunk.GAFMWOME.js +0 -1
  180. package/dist/preview/chunk.I4Z7HVRT.js +0 -1
  181. package/dist/preview/chunk.JMXXA4YG.js +0 -1
  182. package/dist/preview/chunk.JMYUQNXN.js +0 -6
  183. package/dist/preview/chunk.K6DFXDPZ.js +0 -1
  184. package/dist/preview/chunk.KF27ME27.js +0 -1
  185. package/dist/preview/chunk.L25DCT5S.js +0 -1
  186. package/dist/preview/chunk.MODLZJD4.js +0 -25
  187. package/dist/preview/chunk.OJGHDWI6.js +0 -1
  188. package/dist/preview/chunk.SSF47GUY.js +0 -1
  189. package/dist/preview/chunk.T6DPWW2K.js +0 -3
  190. package/dist/preview/chunk.TA36WBHK.js +0 -1
  191. package/dist/preview/chunk.TTGKX7LT.js +0 -1
  192. package/dist/preview/chunk.U3HERHAI.js +0 -88
  193. package/dist/preview/chunk.V5I4GZEY.js +0 -1
  194. package/dist/preview/chunk.VT2YGDK2.js +0 -1
  195. package/dist/preview/chunk.XK65Y2KX.js +0 -1
  196. package/dist/preview/chunk.Z274CL7J.js +0 -1
  197. package/dist/preview/chunk.ZBVYD4OX.js +0 -90
@@ -1,6 +1,6 @@
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 Ft,b as _t,c as Kt,d as Gn}from"./chunk.LGRVEHXT.js";import{a as qt}from"./chunk.CTASTRQN.js";import{a as Hn,b as It,c as Vn,d as Bt,e as Wt,f as Ht}from"./chunk.DPJNGFEZ.js";import{a as Vt,b as tn,c as Gt,d as jt}from"./chunk.YNEHJWJV.js";import{c as Ut,g as Yt,h as Qt,i as Jt}from"./chunk.QQAZQDRW.js";import{e as Tt}from"./chunk.2VR7YEJ6.js";import{m as zt}from"./chunk.FXT5CN32.js";import{a as Nt,b as Dt}from"./chunk.WVLEGCRI.js";import{f as Lt,h as Pt}from"./chunk.LETAQTLJ.js";import{e as Mt}from"./chunk.BUVTUAB5.js";import{b as $t,c as me,d as ke,e as ze}from"./chunk.2KFZHUAC.js";import{e as At,l as Rt}from"./chunk.I2737CPF.js";import{l as Et,m as Wn}from"./chunk.5LJVOLKR.js";import{g as In,h as Bn}from"./chunk.F4VB6Q2W.js";import{d as Ot}from"./chunk.FFOD5B4B.js";import{k as Fe,m as Ct}from"./chunk.U3HERHAI.js";import{G as Ee,Qa as kt,Ra as nn,W as te,Z as bt,ea as oe,fa as xt,ga as St,l as en}from"./chunk.MODLZJD4.js";import{$ as ct,$a as pt,Bb as Dn,G as st,Gd as zn,I as lt,Rc as be,Xa as mt,Z as cn,_ as dt,aa as Tn,ab as ft,ba as ut,bb as ht,ca as Xe,fe as vt,ka as Ge,la as xe,ld as Ze,md as wt,na as qe,oa as un,pa as gn,ra as Nn,rc as yt,sd as Te,ta as gt,ua as mn}from"./chunk.6HY6ZGEE.js";import{b as q}from"./chunk.AJZBJBMO.js";var Qr=q(Ee(),1);var jn=q(te(),1);function Ie(e,t,n){let r=e.nodes?.length??0;if(e.total===void 0||e.total<=r)return n;let a=e.nodes?.[0]?.kind,i=a?un(t,a).toLowerCase():"more";return(0,jn.jsxs)("div",{style:{display:"grid",gridTemplateRows:"minmax(0, 1fr) auto",height:"100%",minHeight:0},children:[n,(0,jn.jsxs)("p",{"data-testid":"lens-more",style:{margin:"4px 0 0",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["+",e.total-r," more ",i]})]})}var ar=q(Ee(),1);var rn=q(Ee(),1);var Xt=e=>`place:${e}`;function Zt(e,t){(0,rn.useEffect)(()=>{if(e===void 0)return;let n=globalThis[Symbol.for("graview.shown-lists")]??=new Map;return n.set(e,()=>t),()=>void n.delete(e)})}var er=e=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(t=>t.saveShownList(e.read()));function nr(e,t,n){let r={off:e,about:t,read:n,menu:(a,i,s)=>[...e?[]:[{id:"export-csv",label:"Export CSV",run:()=>void er(r)}],...a&&i?[{id:e?"export-on":"export-off",label:e?"Turn on export":"Turn off export",run:()=>void (__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(p=>p.switchExport(r,i,e,s))}]:[]]};return r}function tr({said:e}){return(0,rn.createElement)("button",{type:"button",className:"graview-arrange-open","data-testid":"arrange-export","aria-label":"Export CSV",title:"Export CSV",onClick:()=>void er(e)},(0,rn.createElement)("span",{"aria-hidden":"true"},"\u2193"),"CSV")}var rr=q(Ee(),1),pn=(0,rr.createContext)(null);var qn=q(te(),1),Xr=(e,t)=>{if(e===!1||t===!1)return!1;let n=e===void 0||e===!0?{}:e,r=t===void 0||t===!0?{}:t;return{sort:n.sort!==!1&&r.sort!==!1,filter:n.filter!==!1&&r.filter!==!1,group:n.group!==!1&&r.group!==!1}},Zr=["sort","filter","group","q","archived"];function Ne(e,t={}){let{store:n,onExport:r}=oe(),a=(0,ar.useContext)(pn),{view:i,go:s}=nn(),c=Zr.some(E=>i.within?.[E]!==void 0)?Nt(i):t.arrangedBy??{},b=e.nodes??[],u=t.kind??b[0]?.kind??e.node?.kind,w=c.archived!==void 0&&c.archived!==!1&&u!==void 0&&!t.subject?n.graph.nodesOfKind(u,{archived:c.archived}):b,h=t.subject??(t.only?w.filter(t.only):w),o=t.subject?[]:t.only?w.filter(E=>!t.only(E)):[],l=t.kind??h[0]?.kind,C=Xr(t.allow,t.lensAllows),g=l?Mt(n.schema,String(l)):void 0,S=g?Lt(c,g).arrangement:{},A=Pt(h,C===!1?{}:S,{schema:n.schema,graph:n.graph,flagged:new Set(e.flagged??[]),...t.search?{searchIn:t.search}:{}}),L=e.retired!==void 0&&e.retired>0&&(b[0]?.kind??l)===l?e.retired:0,T=e.fidelity==="full"&&e.budget===void 0,v=l!==void 0&&T&&t.exportable!==!1,O=nr(a?.export===!1,{lens:a?.title??"",...a?.on!==void 0?{on:a.on}:{}},()=>({title:a?.title??gn(n.schema,String(l)),schema:n.schema,graph:n.graph,kind:String(l),groups:A.groups,grouped:A.grouped,onExport:r,words:{labelOf:xe,readableFields:Ot,withComputed:Rt}}));Zt(a&&v?Xt(a.as):void 0,O);let m=l&&C!==!1&&T&&(h.length>1||L>0)?(0,qn.jsx)(zt,{schema:n.schema,graph:n.graph,kind:String(l),arrangement:S,allow:C,query:t.query!==!1,...t.filters?{filters:t.filters,chips:{nodes:h,flagged:new Set(e.flagged??[])}}:{},onChange:E=>s(Dt(i,E)),kept:{shown:A.nodes.length,of:h.length},...L>0?{past:{count:L,widen:()=>s(Tt(i,!0))}}:{},...v&&!O.off?{end:(0,qn.jsx)(tr,{said:O})}:{}}):null;return{nodes:[...o,...A.nodes],arranged:A,arrangement:S,bar:m}}function _e(e,t,n){let r=new Set((n??[]).map(i=>i.kind)),a=new Set((n??[]).map(i=>i.id));return e.allNodes().filter(i=>r.has(i.kind)?a.has(i.id):Ge(t.tryDefinition(i.kind),i))}var Be=q(Ee(),1);var j=q(te(),1),ea=["slots","x","y","fill"],fn=class extends Error{constructor(n,r){super(`${n}
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ft,b as _t,c as Kt,d as Gn}from"./chunk.6NG76MDA.js";import{a as qt}from"./chunk.35KMZHB7.js";import{a as Hn,b as It,c as Vn,d as Bt,e as Wt,f as Ht}from"./chunk.DEKRFTRN.js";import{a as Vt,b as tn,c as Gt,d as jt}from"./chunk.BKYZSV2Y.js";import{c as Ut,g as Yt,h as Qt,i as Jt}from"./chunk.IAEGJDF3.js";import{e as Tt}from"./chunk.GVT4UUQA.js";import{m as zt}from"./chunk.5R744JGZ.js";import{a as Nt,b as Dt}from"./chunk.O2OL6RQQ.js";import{f as Lt,h as Pt}from"./chunk.J6HF7IRQ.js";import{e as Mt}from"./chunk.LRNFE3UK.js";import{b as $t,c as me,d as ke,e as ze}from"./chunk.WEMUKZKH.js";import{e as At,l as Rt}from"./chunk.DWM7AR5Y.js";import{l as Et,m as Wn}from"./chunk.QRQ5WPZI.js";import{g as In,h as Bn}from"./chunk.MUSMNKE4.js";import{d as Ot}from"./chunk.SJQPTDAT.js";import{k as Fe,m as Ct}from"./chunk.QNP5OR3P.js";import{G as Ee,Qa as kt,Ra as nn,W as te,Z as bt,ea as oe,fa as xt,ga as St,l as en}from"./chunk.A5PSEU3W.js";import{$ as ct,$a as pt,Bb as Dn,G as st,Gd as zn,I as lt,Rc as be,Xa as mt,Z as cn,_ as dt,aa as Tn,ab as ft,ba as ut,bb as ht,ca as Xe,fe as vt,ka as Ge,la as xe,ld as Ze,md as wt,na as qe,oa as un,pa as gn,ra as Nn,rc as yt,sd as Te,ta as gt,ua as mn}from"./chunk.ZEZUKRC6.js";import{b as q}from"./chunk.AJZBJBMO.js";var Qr=q(Ee(),1);var jn=q(te(),1);function Ie(e,t,n){let r=e.nodes?.length??0;if(e.total===void 0||e.total<=r)return n;let a=e.nodes?.[0]?.kind,i=a?un(t,a).toLowerCase():"more";return(0,jn.jsxs)("div",{style:{display:"grid",gridTemplateRows:"minmax(0, 1fr) auto",height:"100%",minHeight:0},children:[n,(0,jn.jsxs)("p",{"data-testid":"lens-more",style:{margin:"4px 0 0",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:["+",e.total-r," more ",i]})]})}var ar=q(Ee(),1);var rn=q(Ee(),1);var Xt=e=>`place:${e}`;function Zt(e,t){(0,rn.useEffect)(()=>{if(e===void 0)return;let n=globalThis[Symbol.for("graview.shown-lists")]??=new Map;return n.set(e,()=>t),()=>void n.delete(e)})}var er=e=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(t=>t.saveShownList(e.read()));function nr(e,t,n){let r={off:e,about:t,read:n,menu:(a,i,s)=>[...e?[]:[{id:"export-csv",label:"Export CSV",run:()=>void er(r)}],...a&&i?[{id:e?"export-on":"export-off",label:e?"Turn on export":"Turn off export",run:()=>void (__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.6YGRRXJB.js")).then(p=>p.switchExport(r,i,e,s))}]:[]]};return r}function tr({said:e}){return(0,rn.createElement)("button",{type:"button",className:"graview-arrange-open","data-testid":"arrange-export","aria-label":"Export CSV",title:"Export CSV",onClick:()=>void er(e)},(0,rn.createElement)("span",{"aria-hidden":"true"},"\u2193"),"CSV")}var rr=q(Ee(),1),pn=(0,rr.createContext)(null);var qn=q(te(),1),Xr=(e,t)=>{if(e===!1||t===!1)return!1;let n=e===void 0||e===!0?{}:e,r=t===void 0||t===!0?{}:t;return{sort:n.sort!==!1&&r.sort!==!1,filter:n.filter!==!1&&r.filter!==!1,group:n.group!==!1&&r.group!==!1}},Zr=["sort","filter","group","q","archived"];function Ne(e,t={}){let{store:n,onExport:r}=oe(),a=(0,ar.useContext)(pn),{view:i,go:s}=nn(),c=Zr.some(E=>i.within?.[E]!==void 0)?Nt(i):t.arrangedBy??{},b=e.nodes??[],u=t.kind??b[0]?.kind??e.node?.kind,w=c.archived!==void 0&&c.archived!==!1&&u!==void 0&&!t.subject?n.graph.nodesOfKind(u,{archived:c.archived}):b,h=t.subject??(t.only?w.filter(t.only):w),o=t.subject?[]:t.only?w.filter(E=>!t.only(E)):[],l=t.kind??h[0]?.kind,C=Xr(t.allow,t.lensAllows),g=l?Mt(n.schema,String(l)):void 0,S=g?Lt(c,g).arrangement:{},A=Pt(h,C===!1?{}:S,{schema:n.schema,graph:n.graph,flagged:new Set(e.flagged??[]),...t.search?{searchIn:t.search}:{}}),L=e.retired!==void 0&&e.retired>0&&(b[0]?.kind??l)===l?e.retired:0,T=e.fidelity==="full"&&e.budget===void 0,v=l!==void 0&&T&&t.exportable!==!1,O=nr(a?.export===!1,{lens:a?.title??"",...a?.on!==void 0?{on:a.on}:{}},()=>({title:a?.title??gn(n.schema,String(l)),schema:n.schema,graph:n.graph,kind:String(l),groups:A.groups,grouped:A.grouped,onExport:r,words:{labelOf:xe,readableFields:Ot,withComputed:Rt}}));Zt(a&&v?Xt(a.as):void 0,O);let m=l&&C!==!1&&T&&(h.length>1||L>0)?(0,qn.jsx)(zt,{schema:n.schema,graph:n.graph,kind:String(l),arrangement:S,allow:C,query:t.query!==!1,...t.filters?{filters:t.filters,chips:{nodes:h,flagged:new Set(e.flagged??[])}}:{},onChange:E=>s(Dt(i,E)),kept:{shown:A.nodes.length,of:h.length},...L>0?{past:{count:L,widen:()=>s(Tt(i,!0))}}:{},...v&&!O.off?{end:(0,qn.jsx)(tr,{said:O})}:{}}):null;return{nodes:[...o,...A.nodes],arranged:A,arrangement:S,bar:m}}function _e(e,t,n){let r=new Set((n??[]).map(i=>i.kind)),a=new Set((n??[]).map(i=>i.id));return e.allNodes().filter(i=>r.has(i.kind)?a.has(i.id):Ge(t.tryDefinition(i.kind),i))}var Be=q(Ee(),1);var j=q(te(),1),ea=["slots","x","y","fill"],fn=class extends Error{constructor(n,r){super(`${n}
2
2
  ${r}`);this.hint=r;this.name="BoardBindingError"}},ir=e=>Math.max(0,Math.min(1,e));function Fn(e,t,n,r){let a=l=>l,i=l=>r?xe(r.tryDefinition(l.kind),l):String(a(l).label??l.id);if(r&&r.tryDefinition(n.slots)===void 0)throw new fn(`No kind is declared for "${n.slots}".`,'Check the lens bindings: { slots: "<kind>", x: "<field>", y: "<field>", fill: "<edge kind>" }');let s=e.filter(l=>l.kind===n.slots);if(!r&&s.length===0)throw new fn(`Nothing to arrange: no "${n.slots}" nodes.`,'Check the lens bindings: { slots: "<kind>", x: "<field>", y: "<field>", fill: "<edge kind>" }');let p=t.filter(l=>l.kind===n.fill),c=new Map(e.map(l=>[l.id,l])),b=new Map(e.map((l,C)=>[l.id,C])),u=s.map(l=>{let C=a(l),g=n.fillFrom==="occupant",S=p.filter(A=>(g?A.to:A.from)===l.id).map(A=>c.get(g?A.from:A.to)).filter(A=>A!==void 0).sort((A,L)=>(b.get(A.id)??0)-(b.get(L.id)??0)).map(A=>({id:A.id,label:i(A)}));return{id:l.id,code:String(C[n.slotCode??""]??"").trim()||i(l),label:i(l),x:ir(Number(C[n.x]??.5)),y:ir(Number(C[n.y]??.5)),occupants:S}}).sort((l,C)=>l.y-C.y||l.x-C.x),w=new Set(u.flatMap(l=>l.occupants.map(C=>C.id))),h=new Set([...w].map(l=>c.get(l)?.kind).filter(l=>l!==void 0)),o=e.filter(l=>h.has(l.kind)&&!w.has(l.id)).map(l=>({id:l.id,label:i(l)})).sort((l,C)=>l.label<C.label?-1:l.label>C.label?1:0);return{slots:u,empty:u.filter(l=>l.occupants.length===0).map(l=>l.id),spare:o}}function na({nodes:e,occupants:t,label:n,fidelity:r,mode:a,options:i,schema:s,implicated:p=[],flagged:c=[]}){let{store:b}=oe(),u=_e(b.graph,b.schema,e),w=t?[...u.filter(d=>d.kind===i.slots),...t.map(d=>b.graph.getNode(d)).filter(d=>d!==void 0)]:u,h=Fn(w,b.graph.allEdges(),i,s),o=new Set(p),l=new Set(c),C=kt(),g=new Map;for(let d of C)for(let y of d.nodeIds)g.set(y,[...g.get(y)??[],d.message]);let S=d=>d?g.get(d)??[]:[];if(r==="glyph")return(0,j.jsx)(ke,{label:`${n??"Board"} \xB7 ${h.slots.length-h.empty.length}/${h.slots.length}`,hue:be("board")});if(r==="summary"){let d=h.slots.filter(y=>h.empty.includes(y.id));return(0,j.jsx)(me,{title:n??"Board",meta:`${h.slots.length-h.empty.length}/${h.slots.length}`,tone:d.length>0?"warning":"muted",fit:!0,children:d.length>0?(0,j.jsx)(ze,{pick:!0,max:5,items:d.map(y=>({id:y.id,label:y.code}))}):(0,j.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:"Every slot filled."})})}let A=i.aspect??.68,L=(0,Be.useRef)(null),[T,v]=(0,Be.useState)(!1),[O,m]=(0,Be.useState)(null),E=160,[D,G]=(0,Be.useState)(!1);(0,Be.useEffect)(()=>{let d=L.current;if(!d||typeof ResizeObserver>"u")return;let y=new ResizeObserver(x=>{let R=x[0]?.contentRect;if(!R)return;let f=R.height<E;G(f),v(!f&&A<1&&R.width/R.height>1.3),m(f?null:R.height)});return y.observe(d),()=>y.disconnect()},[A]);let k=(d,y)=>T?{x:1-y,y:d}:{x:d,y},_=(()=>{let d=new Map,y=(x,R,f)=>{let $=d.get(f)??{ids:[],codes:[]};$.ids.includes(x)||($.ids.push(x),$.codes.includes(R)||$.codes.push(R)),d.set(f,$)};for(let x of h.slots){for(let R of S(x.id))y(x.id,x.code,R);for(let R of x.occupants)for(let f of S(R.id))y(R.id,R.label,f)}return[...d.entries()].map(([x,R])=>({id:R.ids[0],code:R.codes.join(", "),text:x}))})(),W=a==="fullscreen",le=_.length===0?null:(0,j.jsxs)("ul",{"data-graview-primitive":"board-key",style:{margin:"2px 0 0",padding:0,listStyle:"none",display:"grid",gap:3,flex:"0 0 auto"},children:[_.slice(0,W?6:2).map(d=>(0,j.jsxs)("li",{"data-graview-pick":d.id,"data-graview-emphasis":o.size===0?"plain":o.has(d.id)?"lit":"dimmed",title:d.text,style:{display:W?"grid":"flex",gap:W?1:7,alignItems:W?"start":"baseline",fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",minHeight:24,width:"fit-content",maxWidth:"100%",padding:W?"2px 0":"3px 6px",marginLeft:W?0:-6,borderRadius:7,cursor:"pointer"},children:[(0,j.jsxs)("span",{style:{flex:"0 0 auto",fontWeight:600,color:"var(--graview-warn)",letterSpacing:"0.02em"},children:["\u26A0 ",d.code]}),(0,j.jsx)("span",{style:{minWidth:0,...W?{}:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},children:d.text})]},d.id)),_.length>(W?6:2)?(0,j.jsxs)("li",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-faint)"},children:["+",_.length-(W?6:2)," more"]}):null]}),ee=i.arrange==="shelf",ie=h.slots.every(d=>d.code.length<=3&&!/\s/.test(d.code)),N=(d,y)=>{let x=d.occupants.length===0,R=o.size>0&&!o.has(d.id)&&!d.occupants.some(Q=>o.has(Q.id)),f=l.has(d.id),$=d.occupants.some(Q=>l.has(Q.id)),P=f,ne=[...S(d.id),...d.occupants.flatMap(Q=>S(Q.id))],H=d.occupants.length===1?d.occupants[0]:null,K=i.pickTarget==="slot"?d.id:H?H.id:d.id,J=Q=>H?{}:{"data-graview-pick":Q.id,"data-graview-emphasis":o.size===0?"plain":R?"dimmed":"lit"},Y=Q=>l.has(Q.id)?"var(--graview-warn)":"var(--graview-ink-muted)",ue=i.emptyLabel??"empty";return(0,j.jsxs)("div",{"data-graview-pick":K,"data-graview-slot":d.id,"data-graview-mark":ie?"disc":"token","data-graview-flagged":f&&$?"both":f?"slot":$?"occupant":void 0,"data-graview-emphasis":o.size===0?"plain":R?"dimmed":"lit",title:[x?`${d.label} \u2014 nobody in it`:`${d.occupants.map(Q=>Q.label).join(", ")} at ${d.label}`,...ne].join(`
3
- `),style:{...y,display:"grid",justifyItems:ie?"center":"start",gap:3,opacity:R?.5:1,transition:"opacity 160ms ease"},children:[ie?(0,j.jsxs)("span",{style:{position:"relative",width:34,height:34,borderRadius:999,display:"grid",placeItems:"center",fontSize:"0.75rem",letterSpacing:"0.02em",border:x?"1.5px dashed var(--graview-warn)":`1px solid ${P?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:x?"transparent":P?"var(--graview-panel-warning)":"var(--graview-panel)",color:x||P?"var(--graview-warn)":"var(--graview-ink)",boxShadow:x?void 0:"var(--graview-lift-low)"},children:[d.code,f&&!x?(0,j.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:-3,right:-3,fontSize:"0.6875rem",lineHeight:1,color:"var(--graview-warn)"},children:"\u26A0"}):null]}):(0,j.jsxs)("span",{style:{display:"grid",gap:1,minWidth:0,maxWidth:180,padding:"5px 10px 6px",borderRadius:8,border:x?"1.5px dashed var(--graview-warn)":`1px solid ${P?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:x?"transparent":P?"var(--graview-panel-warning)":"var(--graview-panel)",boxShadow:x?void 0:"var(--graview-lift-low)"},children:[(0,j.jsxs)("span",{style:{fontSize:"0.8125rem",fontWeight:550,lineHeight:1.25,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:x||P?"var(--graview-warn)":"var(--graview-ink)"},children:[d.code,f&&!x?" \u26A0":null]}),x?(0,j.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.3,color:"var(--graview-warn)"},children:ue}):(0,j.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:"0 8px",fontSize:"0.75rem",lineHeight:1.3},children:d.occupants.map(Q=>(0,j.jsxs)("span",{...J(Q),style:{whiteSpace:"nowrap",color:Y(Q)},children:[Q.label,l.has(Q.id)?" \u26A0":""]},Q.id))})]}),ie?x?(0,j.jsx)("span",{style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:"var(--graview-warn)"},children:ue}):d.occupants.map(Q=>(0,j.jsxs)("span",{...J(Q),style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:Y(Q)},children:[Q.label,l.has(Q.id)?" \u26A0":""]},Q.id)):null]},d.id)},U=i.zones??[],de=U.map((d,y)=>({label:d.label,slots:h.slots.filter(x=>x.y>=d.from&&(x.y<d.to||y===U.length-1&&x.y<=d.to))})),B=new Set(de.flatMap(d=>d.slots.map(y=>y.id))),we=h.slots.filter(d=>!B.has(d.id));(we.length>0||de.length===0)&&de.push({label:"",slots:we});let M={boxSizing:"border-box",borderRadius:12,border:"1px solid var(--graview-edge)",background:"linear-gradient(var(--graview-panel-muted), var(--graview-panel-muted)), var(--graview-panel)",overflow:"hidden"};return(0,j.jsxs)(me,{title:n??"Board",meta:h.slots.length===0?void 0:h.empty.length===0?`all ${h.slots.length} filled`:`${h.empty.length} unfilled`,...W?{style:{flex:"1 1 auto",minHeight:0,height:"100%"}}:{},children:[(0,j.jsxs)("div",{ref:L,style:{display:"flex",gap:28,alignItems:"stretch",justifyContent:"center",flex:"1 1 auto",minHeight:0},children:[W&&le?(0,j.jsxs)("div",{style:{width:260,flex:"0 0 auto",alignSelf:"center",display:"grid",gap:8},children:[(0,j.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"What is marked"}),le]}):null,ee?(0,j.jsx)("div",{"data-graview-primitive":"board","data-graview-arrange":"shelf",style:{...M,overflow:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"stretch",display:"grid",alignContent:"start"},children:de.map((d,y)=>(0,j.jsxs)("section",{"data-graview-zone":d.label||void 0,style:{display:"grid",gap:8,padding:"10px 14px 14px",...y>0?{borderTop:"1px dashed var(--graview-edge)"}:{}},children:[d.label?(0,j.jsx)("span",{style:{fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:d.label}):null,d.slots.length>0?(0,j.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px 12px",alignItems:"flex-start"},children:d.slots.map(x=>N(x,{}))}):(0,j.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"nothing here"})]},d.label||`band-${y}`))}):(0,j.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"stretch",minWidth:0,...D?{flex:"1 1 auto",alignSelf:"flex-start"}:{}},children:[!T&&U.length>0?(0,j.jsx)("div",{"aria-hidden":"true",style:{position:"relative",width:15,flex:"0 0 auto",alignSelf:"stretch"},children:U.map(d=>(0,j.jsx)("span",{title:d.label,style:{position:"absolute",top:`${d.from*100}%`,height:`${(d.to-d.from)*100}%`,right:0,writingMode:"vertical-rl",transform:"rotate(180deg)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:d.label},d.label))}):null,(0,j.jsxs)("div",{"data-graview-primitive":"board","data-graview-arrange":"exact",style:{...M,position:"relative",aspectRatio:`${T?1/A:A}`,...D?{width:"100%",height:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"flex-start"}:{height:"100%",flex:"0 1 auto",...O!==null?{width:Math.round(O*(T?1/A:A))}:{}},maxWidth:"100%"},children:[U.map(d=>(0,j.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",...T?{top:0,bottom:0,left:`${(1-d.to)*100}%`,width:`${(d.to-d.from)*100}%`,borderLeft:"1px dashed var(--graview-edge)"}:{left:0,right:0,top:`${d.from*100}%`,height:`${(d.to-d.from)*100}%`,borderBottom:"1px dashed var(--graview-edge)"}}},d.label)),T?U.map(d=>(0,j.jsx)("span",{"aria-hidden":"true",title:d.label,style:{position:"absolute",bottom:3,left:`${(1-d.to)*100}%`,width:`${(d.to-d.from)*100}%`,textAlign:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:d.label},`label-${d.label}`)):null,h.slots.map(d=>N(d,{position:"absolute",left:`${k(d.x,d.y).x*100}%`,top:`${k(d.x,d.y).y*100}%`,transform:"translate(-50%, -50%)",width:"max-content",maxWidth:"100%"}))]})]}),h.spare.length>0?(0,j.jsxs)("div",{style:{display:"grid",gap:6,alignContent:"start",minWidth:0},children:[(0,j.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"Not in"}),(0,j.jsx)(ze,{pick:!0,max:10,items:h.spare.map(d=>({...d,emphasis:o.size===0?"plain":o.has(d.id)?"lit":"dimmed"}))})]}):null]}),W?null:le]})}function or(e){function t(n){let{store:r}=oe(),a=Fn(_e(r.graph,r.schema,n.nodes),r.graph.allEdges(),e,r.schema),s=[...a.slots.flatMap(u=>u.occupants.map(w=>w.id)),...a.spare.map(u=>u.id)].map(u=>r.graph.getNode(u)).filter(u=>u!==void 0),{arranged:p,bar:c}=Ne(n,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{group:!1},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},subject:s}),b=(0,j.jsx)(na,{schema:r.schema,...n,options:e,...e.arranging===!1?{}:{occupants:p.nodes.map(u=>u.id)}});return Ie(n,r.schema,c?(0,j.jsxs)("div",{style:{display:"grid",gap:6,height:"100%",minHeight:0,gridTemplateRows:"auto 1fr"},children:[c,b]}):b)}return{name:"board",requiredRoles:[...ea],options:e,View:t,build(n,r,a){return Fn(n,r,e,a)}}}var Cn=q(Ee(),1);var sr=864e5;function ta(e){if(typeof e!="string")return null;if(In(e))return Bn(e)?.day??null;let t=/^(\d{4}-\d{2}-\d{2})/.exec(e);return t?t[1]:null}function _n(e){if(typeof e=="string"&&st.test(e))return e.length===4?null:lt(e)??null;let t=ta(e);return t===null?null:{from:t,to:t}}var lr=e=>typeof e=="string"&&/^\d{4}$/.test(e);function yn(e){if(typeof e!="string")return null;if(In(e))return Bn(e)?.minutes??null;let t=/^\d{4}-\d{2}-\d{2}[T ](\d{2}):(\d{2})/.exec(e);return t?Number(t[1])*60+Number(t[2]):null}var hn=e=>Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10))),wn=e=>new Date(e).toISOString().slice(0,10);function Ae(e,t){return wn(hn(e)+t*sr)}function je(e,t){let n=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+t,a=Number(e.slice(8,10)),i=new Date(Date.UTC(n,r+1,0)).getUTCDate();return wn(Date.UTC(n,r,Math.min(a,i)))}var Kn=e=>new Date(hn(e)).getUTCDay();function Ke(e,t=1){let n=(Kn(e)-t+7)%7;return Ae(e,-n)}var Un=e=>`${e.slice(0,7)}-01`;function ye(e,t){return Math.round((hn(t)-hn(e))/sr)}function Ue(e,t){return Array.from({length:t},(n,r)=>Ae(e,r))}var dr=e=>ut(e,"short"),De=e=>dt(e,{weekday:"short"}),Yn=e=>Xe(e);function We(e,t){let n=t?.fieldRoles?.when;return e&&!e.start&&n?{...e,start:n}:e}function cr(e,t){return t===void 0?!1:typeof t=="string"?e[t]===!0:t.is.includes(e[t.field])}var vn=["start"],ra=["day","week","month","quarter","year","agenda"];function bn(e){return e.horizon?["day","week","month","quarter","year","years","agenda"]:ra}function ur(e,t){return e==="years"?t?.title??"Years":`The ${e}`}function gr(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var Qn=class extends Error{constructor(n,r){super(`The calendar lens has no binding for ${r.map(a=>`"${a}"`).join(", ")} on "${n}". Bind them in the lens declaration: bindings: { ${n}: { start: "<field>" } }.`);this.kind=n;this.missing=r;this.name="CalendarBindingError"}};function xn(e,t,n){let r=We(t[e.kind],n?.tryDefinition(e.kind));if(!r)return null;let a=e,i=n?.tryDefinition(e.kind)?.fields.shape,s=vn.filter(h=>{let o=r[h];return o?i?!(o in i):!(o in a):!0});if(s.length>0)throw new Qn(e.kind,s);let p=_n(a[r.start]);if(p===null)return null;let c=p.from,b=(r.end?_n(a[r.end])?.to:null)??p.to,u=yn(a[r.start]),w=r.label?a[r.label]:void 0;return{id:e.id,kind:e.kind,label:typeof w=="string"&&w.length>0?w:xe(n?.tryDefinition(e.kind),e),from:c,to:ye(c,b)<0?c:b,at:r.allDay&&a[r.allDay]===!0?null:u,allDay:r.allDay&&a[r.allDay]===!0||u===null,done:cr(a,r.done)}}function mr(e,t,n,r){let a=xn(e,t,n);if(!a)return[];let i=We(t[e.kind],n?.tryDefinition(e.kind)).start,s=e,p=s[i],c=s[mt(i)];if(typeof p!="string"||!pt(c))return[a];let b=ye(a.from,a.to);return("next"in r?[ht(p,c,r.next)]:ft(p,c,{from:Ae(r.from,-b),to:r.to,limit:400})).map(w=>({...a,from:w.slice(0,10),to:Ae(w.slice(0,10),b),repeats:!0}))}function Sn(e,t){return e.filter(n=>ye(n.from,t)>=0&&ye(t,n.to)>=0).sort((n,r)=>n.allDay!==r.allDay?n.allDay?-1:1:n.at!==r.at?(n.at??0)-(r.at??0):n.label.localeCompare(r.label))}function pr(e,t,n){let r=yt(e.schema,e.allMutations()).get(t)?.get(n)??[],a=new Map(e.allMutations().map(s=>[s.name,s]));for(let s of r){let p=a.get(s),c=p?.subject;if(!p||!c)continue;let b=p.input?.shape??{};if(n in b)return{name:p.name,arg:c.arg}}let i=e.allMutations().find(s=>s.derived?.act==="edit"&&s.derived.kind===t);return i?.subject?{name:i.name,arg:i.subject.arg}:null}var fr=(e,t)=>({from:Un(e),to:hr(e),label:Tn(e,{short:!0,year:t})});function hr(e){return wn(Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7)),0))}function aa(e){let t=Math.floor((Number(e.slice(5,7))-1)/3);return`${e.slice(0,4)}-${String(t*3+1).padStart(2,"0")}-01`}function yr(e,t,n={}){let r=n.weekStartsOn??1,a=(c,b)=>({from:c,to:c,label:String(Number(c.slice(8,10))),...b?{outside:!0}:{}});if(e==="day")return{title:De(t),grain:"day",columns:1,cells:[a(t)]};if(e==="week"){let c=Ke(t,r);return{title:`${De(c)} \u2013 ${De(Ae(c,6))}`,grain:"day",columns:7,cells:Ue(c,7).map(b=>a(b))}}if(e==="agenda")return{title:`From ${De(t)}`,grain:"day",columns:1,cells:Ue(t,42).map(c=>a(c))};if(e==="quarter"){let c=aa(t),b=hr(je(c,2)),u=[];for(let w=Ke(c,r);ye(w,b)>=0;w=Ae(w,7))u.push({from:w,to:Ae(w,6),label:ct(w),...ye(w,c)>0&&ye(Ae(w,6),c)>0?{outside:!0}:{}});return{title:`Q${Math.floor((Number(t.slice(5,7))-1)/3)+1} ${t.slice(0,4)}`,grain:"week",columns:4,cells:u}}if(e==="year"){let c=t.slice(0,4);return{title:c,grain:"month",columns:4,cells:Array.from({length:12},(b,u)=>fr(`${c}-${String(u+1).padStart(2,"0")}-01`,!1))}}if(e==="years"){let c=Number(t.slice(0,4)),b=c+Math.max(1,n.horizon?.years??1)-1,u=n.horizon?.from!==void 0||n.horizon?.to!==void 0,w=u?n.horizon?.from??c:Math.min(c,n.fit?.first??c),o=(u?Math.max(w,n.horizon?.to??w+Math.max(1,n.horizon?.years??1)-1):Math.max(b,n.fit?.last??b))-w+1,l=Array.from({length:o},(C,g)=>String(w+g));return o>ia?{title:`${n.horizon?.title??"Years"} \xB7 ${l[0]}\u2013${l[l.length-1]}`,grain:"year",columns:5,years:l,cells:l.map(C=>({from:`${C}-01-01`,to:`${C}-12-31`,label:C}))}:{title:`${n.horizon?.title??"Years"} \xB7 ${l[0]}\u2013${l[l.length-1]}`,grain:"month",columns:4,years:l,cells:l.flatMap(C=>Array.from({length:12},(g,S)=>fr(`${C}-${String(S+1).padStart(2,"0")}-01`,!0)))}}let i=Un(t),s=Ke(i,r),p=t.slice(0,7);return{title:Tn(t),grain:"day",columns:7,cells:Ue(s,42).map(c=>a(c,c.slice(0,7)!==p))}}function wr(e,t,n){return e.filter(r=>ye(r.from,n)>=0&&ye(t,r.to)>=0).sort((r,a)=>r.allDay!==a.allDay?r.allDay?-1:1:r.from!==a.from?r.from.localeCompare(a.from):r.at!==a.at?(r.at??0)-(a.at??0):r.label.localeCompare(a.label))}var ia=10;function vr(e){return e==="year"?"year":e==="month"?"month":e==="week"?"week":"day"}var br=q(Ee(),1);var ae=q(te(),1);function Jn({label:e,glyph:t,onPress:n}){return(0,ae.jsx)("button",{type:"button","aria-label":e,title:e,onClick:n,style:Ye,children:t})}var Ye={minHeight:24,minWidth:24,padding:"2px 9px",borderRadius:6,fontSize:"0.8125rem",borderWidth:1,borderStyle:"solid",borderColor:"transparent",color:"var(--graview-ink-muted)",background:"transparent"},xr={day:12,week:4,month:3,year:5};function Sr({span:e,weekStartsOn:t,entries:n,today:r,perCell:a,emphasisOf:i,broken:s,hue:p,onOpen:c,onMove:b}){let u=(0,br.useRef)(null),w=Fe(u),h=w===null?e.columns:Math.max(1,Math.floor(w/44)),o=h<e.columns,l=o?h:e.columns,C=!o&&e.grain==="day"&&e.columns===7?Ue(Ke(e.cells[0]?.from??r,t),7):e.grain==="day"&&e.columns===1?e.cells.map(g=>g.from):null;return o&&e.grain==="day"&&e.columns>1?(0,ae.jsx)("div",{ref:u,"data-calendar-shape":"agenda",style:{display:"grid",minHeight:0,flex:1},children:(0,ae.jsx)(kn,{days:e.cells.map(g=>g.from),entries:n,today:r,emphasisOf:i,broken:s,hue:p,onMove:(g,S)=>b(g,{from:S,to:S,label:S},"day")})}):(0,ae.jsxs)("div",{ref:u,"data-calendar-shape":o?"wrapped":"grid",style:{display:"grid",gap:4,gridTemplateRows:C?"auto 1fr":"1fr",minHeight:0,flex:1},children:[C?(0,ae.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`,gap:4},children:C.map(g=>(0,ae.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-muted)",textAlign:"center"},children:e.columns===7?dr(Kn(g)):De(g)},g))}):null,(0,ae.jsx)("div",{tabIndex:0,"aria-label":`The days of ${e.title}`,style:{display:"grid",gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`,gridAutoRows:"max-content",gap:4,minHeight:0,overflow:"auto"},children:e.cells.map((g,S)=>{let A=wr(n,g.from,g.to),L=A.slice(0,a),T=A.slice(a),v=T.filter(m=>s.has(m.id)).length,O=ye(g.from,r)>=0&&ye(r,g.to)>=0;return(0,ae.jsxs)("div",{"data-calendar-day":e.grain==="day"?g.from:void 0,"data-calendar-cell":g.from,"data-calendar-grain":e.grain,"data-calendar-count":A.length,"data-calendar-outside":g.outside||void 0,onDragOver:m=>{m.dataTransfer.types.includes("text/graview-node")&&(m.preventDefault(),m.dataTransfer.dropEffect="move")},onDrop:m=>{let E=m.dataTransfer.getData("text/graview-node");E&&(m.preventDefault(),m.stopPropagation(),b(E,g,e.grain))},style:{minHeight:62,display:"flex",flexDirection:"column",gap:2,padding:4,borderRadius:7,border:"1px solid var(--graview-edge)",background:O?"var(--graview-panel)":g.outside?"var(--graview-panel-muted)":"transparent"},children:[(0,ae.jsxs)("span",{style:{display:"flex",alignItems:"baseline",gap:4},children:[(0,ae.jsx)("span",{style:{fontSize:"0.75rem",fontVariantNumeric:"tabular-nums",color:O?"var(--graview-accent)":"var(--graview-ink-faint)"},children:g.label}),e.grain!=="day"&&A.length>0?(0,ae.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",marginLeft:"auto"},children:A.length}):null]}),L.map(m=>(0,ae.jsx)(kr,{entry:m,cell:g,rowStart:S%l===0,emphasis:i(m.id),flagged:s.has(m.id),hue:p(m)},`${m.id}:${m.from}:${g.from}`)),T.length>0?(0,ae.jsxs)("button",{type:"button","data-testid":`calendar-more-${g.from}`,onClick:()=>c(g),title:`Open ${g.label}`,style:{minHeight:24,padding:"1px 5px",fontSize:"0.75rem",borderRadius:5,border:"1px dashed var(--graview-edge)",background:"transparent",color:v>0?"var(--graview-warn)":"var(--graview-ink-muted)",textAlign:"left"},children:["+",T.length," more",v>0?` \xB7 ${v} flagged`:""]}):null]},g.from)})})]})}function kn({days:e,entries:t,today:n,emphasisOf:r,broken:a,hue:i,onMove:s}){let p=e.map(c=>({day:c,here:Sn(t,c)})).filter(({here:c})=>c.length>0);return p.length===0?(0,ae.jsx)("p",{"data-testid":"calendar-empty",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:"Nothing is scheduled in the next six weeks."}):(0,ae.jsx)("ol",{tabIndex:0,"aria-label":"What is scheduled",style:{margin:0,padding:0,listStyle:"none",display:"grid",alignContent:"start",gap:10,overflow:"auto",minHeight:0},children:p.map(({day:c,here:b})=>(0,ae.jsxs)("li",{"data-calendar-day":c,onDragOver:u=>{u.dataTransfer.types.includes("text/graview-node")&&(u.preventDefault(),u.dataTransfer.dropEffect="move")},onDrop:u=>{let w=u.dataTransfer.getData("text/graview-node");w&&(u.preventDefault(),u.stopPropagation(),s(w,c))},style:{display:"grid",gap:4},children:[(0,ae.jsxs)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:c===n?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[De(c),c===n?" \xB7 today":""]}),b.map(u=>(0,ae.jsx)(kr,{entry:u,cell:{from:c,to:c,label:c},emphasis:r(u.id),flagged:a.has(u.id),hue:i(u)},`${u.id}:${u.from}:${c}`))]},c))})}function kr({entry:e,cell:t,emphasis:n,flagged:r,hue:a,rowStart:i=!1}){let s=ye(t.from,e.from)>=0,p=ye(e.to,t.to)>=0,c=!(s&&p),b=e.at!==null&&s&&e.from===t.from?`${Yn(e.at)} ${e.label}`:e.label;return(0,ae.jsx)("span",{"data-graview-pick":e.id,"data-calendar-entry":e.id,"data-calendar-repeat":e.repeats?e.from:void 0,draggable:!e.repeats,onDragStart:u=>{u.dataTransfer.setData("text/graview-node",e.id),u.dataTransfer.effectAllowed="move"},"data-graview-emphasis":n,"data-calendar-part":c?s?"opens":p?"closes":"through":void 0,"data-calendar-in":t.from,title:c?`${e.label} \xB7 ${e.from} \u2013 ${e.to}`:`${e.label}${e.at===null?" \xB7 all day":` \xB7 ${Yn(e.at)}`}${e.repeats?" \xB7 repeats":""}`,style:{display:"block",minHeight:24,boxSizing:"border-box",padding:"3px 6px",fontSize:"0.75rem",lineHeight:1.35,borderRadius:c?s?"5px 0 0 5px":p?"0 5px 5px 0":0:5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",textDecoration:e.done?"line-through":"none",opacity:n==="dimmed"?.35:e.done?.6:1,background:`color-mix(in oklab, hsl(${Math.round(a)} 70% 55%) ${n==="lit"?38:20}%, transparent)`,color:"var(--graview-ink)",...n==="lit"?{outline:"1px solid var(--graview-accent)"}:{},...r?{borderLeft:"3px solid var(--graview-warn)",paddingLeft:4}:{}},children:s||i?e.repeats?(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)("span",{"aria-hidden":"true",children:"\u21BB "}),b]}):b:" "})}var Z=q(te(),1);function oa(e){let t=1/0,n=-1/0;for(let r of e)r&&(t=Math.min(t,Number(r.from.slice(0,4))),n=Math.max(n,Number(r.to.slice(0,4))));return Number.isFinite(t)&&Number.isFinite(n)?{first:t,last:n}:void 0}function Cr(e){let t=n=>function(a){let{store:i}=oe(),{view:s}=nn(),p=n?{...e,range:n}:e,c=s.within?.range??p.range??"month",b=Object.keys(e.bindings),{nodes:u,arranged:w,arrangement:h,bar:o}=Ne(a,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{sort:!1,group:c==="agenda"},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},...e.search?{search:e.search}:{},...e.filters?{filters:e.filters}:{},...b[0]?{kind:(a.nodes??[]).find(A=>b.includes(String(A.kind)))?.kind??b[0]}:{}}),l=c==="agenda"&&w.grouped&&h.group?w.groups.map(A=>({label:A.label,ids:new Set(A.nodes.map(L=>L.id))})):void 0,C=new Set((a.nodes??[]).map(A=>String(A.kind))),g=b.filter(A=>!C.has(A)&&i.schema.tryDefinition(A)!==void 0).flatMap(A=>{let L=i.schema.tryDefinition(A);return i.graph.nodesOfKind(A).filter(T=>s.past===!0||Ge(L,T))}),S=g.length===0?u:[...u,...a.budget!==void 0?g.slice(0,a.budget):g];return Ie(a,i.schema,(0,Z.jsx)(sa,{schema:i.schema,...a,nodes:S,options:{...p,today:p.today??i.today()??gr()},...o?{bar:o}:{},...l?{groups:l}:{}}))};return{name:"calendar",requiredRoles:[...vn],bindings:e.bindings,options:e,View:t(),at:n=>t(n),ranges:()=>bn(e).map(n=>({range:n,title:ur(n,e.horizon)})),place:(n,r)=>n.map(a=>xn(a,e.bindings,r)).filter(a=>a!==null)}}function sa({nodes:e,label:t,fidelity:n,mode:r,options:a,schema:i,selectedIds:s=[],implicated:p=[],flagged:c=[],bar:b,groups:u}){let{view:w,go:h}=nn(),{store:o,principal:l}=oe(),C=w.within?.at??a.today,g=w.within?.range??a.range??"month",S=a.weekStartsOn??1,A=new Set([...p,...s]),L=M=>A.size===0?"plain":A.has(M)?"lit":"dimmed",T=new Set(c),v=g==="years"&&w.within?.at===void 0?oa((e??[]).map(M=>xn(M,a.bindings,i))):void 0,O=yr(g,C,{weekStartsOn:S,...a.horizon?{horizon:a.horizon}:{},...v?{fit:v}:{}}),E=n==="glyph"||n==="summary"?{next:a.today}:{from:O.cells[0]?.from??C,to:O.cells[O.cells.length-1]?.to??C},D=(e??[]).flatMap(M=>mr(M,a.bindings,i,E)),G=a.hueOf??(M=>be(M.kind)),k=(e??[]).filter(M=>{let d=We(a.bindings[M.kind],i?.tryDefinition(M.kind));return d!==void 0&&lr(M[d.start])}).length;if(n==="glyph")return(0,Z.jsx)(ke,{label:`${t??"Calendar"} \xB7 ${D.length}`,hue:be("calendar")});if(n==="summary"){let M=Sn(D,a.today);return(0,Z.jsx)(me,{title:t??"Calendar",meta:`${D.length} dated`,tone:"muted",children:(0,Z.jsx)(ze,{max:6,items:M.length>0?M.map(d=>({id:d.id,label:d.label,hue:G(d)})):D.filter(d=>ye(a.today,d.from)>=0).sort((d,y)=>d.from.localeCompare(y.from)).slice(0,6).map(d=>({id:d.id,label:`${d.from.slice(5)} ${d.label}`,hue:G(d)}))})})}let _=r==="fullscreen",[W,le]=(0,Cn.useState)(null),ee=(M,d,y)=>{let x=o.graph.getNode(M);if(!x)return;let R=We(a.bindings[x.kind],o.schema.tryDefinition(x.kind));if(!R)return;let f=pr(o,x.kind,R.start);if(!f){le({text:`Nothing declared writes the ${Nn(o.schema.definitions.find(Y=>Y.kind===x.kind),R.start).toLowerCase()}, so this cannot be moved from here.`,tone:"refused"});return}let $=d.from,P=x[R.start],H=yn(P)===null?$:`${$}${String(P).slice(10)}`,K={name:f.name,args:{[f.arg]:M,[R.start]:H}},J=o.permits(K,l);if(!J.ok){le({text:J.refusal.message,tone:"refused"});return}try{o.apply(K,{author:l}),le(y==="day"?null:{text:`Moved to ${De($)} \u2014 a ${y} is coarser than the ${Nn(o.schema.definitions.find(Y=>Y.kind===x.kind),R.start).toLowerCase()} holds, so it takes the first day of the cell. Undo puts it back.`,tone:"rounded"})}catch(Y){le({text:Y instanceof Error?Y.message:String(Y),tone:"refused"})}},ie=M=>{let d=g==="years"?je(`${O.years?.[0]??C.slice(0,4)}${C.slice(4)}`,M*12*Math.max(1,O.years?.length??a.horizon?.years??1)):g==="year"?je(C,M*12):g==="quarter"?je(C,M*3):g==="month"?je(C,M):g==="week"?Ae(C,M*7):Ae(C,M);h(en(w,"at",d))},N=(M,d)=>{let y=en(w,"range",M);d!==void 0&&(y=en(y,"at",d)),h(y)},U=(0,Cn.useRef)(null),de=Fe(U),B=de!==null&&de<420,we=M=>M==="years"?a.horizon?.title??"years":M.charAt(0).toUpperCase()+M.slice(1);return(0,Z.jsx)(me,{title:t??"Calendar",meta:O.title,style:{gap:10,..._?{flex:"1 1 auto",minHeight:0,height:"100%"}:{}},children:(0,Z.jsxs)("div",{ref:U,"data-testid":"calendar","data-calendar-range":g,"data-calendar-at":C,style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,gap:8},children:[(0,Z.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6},children:[(0,Z.jsxs)("nav",{"aria-label":"When",style:{display:"flex",gap:4},children:[(0,Z.jsx)(Jn,{label:"Previous",glyph:"\u2039",onPress:()=>ie(-1)}),(0,Z.jsx)("button",{type:"button","data-testid":"calendar-today",onClick:()=>h(en(w,"at",a.today)),style:Ye,children:"Today"}),(0,Z.jsx)(Jn,{label:"Next",glyph:"\u203A",onPress:()=>ie(1)})]}),B?(0,Z.jsx)("select",{"aria-label":"Range","data-testid":"calendar-ranges",value:g,onChange:M=>N(M.target.value),style:{...Ye,borderRadius:999,borderColor:"var(--graview-edge)",background:void 0,backgroundColor:"transparent",marginLeft:"auto",maxWidth:"50%",paddingRight:24,appearance:"none",WebkitAppearance:"none",backgroundImage:"linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%)",backgroundPosition:"calc(100% - 13px) 55%, calc(100% - 9px) 55%",backgroundSize:"4px 4px, 4px 4px",backgroundRepeat:"no-repeat"},children:bn(a).map(M=>(0,Z.jsx)("option",{value:M,children:we(M)},M))}):(0,Z.jsx)("div",{role:"group","aria-label":"Range","data-testid":"calendar-ranges",style:{display:"flex",flexWrap:"wrap",gap:4,marginLeft:"auto"},children:bn(a).map(M=>(0,Z.jsx)("button",{type:"button","aria-pressed":M===g,"data-testid":`calendar-range-${M}`,onClick:()=>N(M),style:{...Ye,borderRadius:999,borderColor:"var(--graview-edge)",...M==="years"?{}:{textTransform:"capitalize"},...M===g?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)",background:"var(--graview-panel)"}:{}},children:M==="years"?a.horizon?.title??"years":M},M))})]}),k>0?(0,Z.jsx)("p",{"data-testid":"calendar-year-only",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:k===1?"1 knows only its year, so it is not placed.":`${k} know only their year, so they are not placed.`}):null,W?(0,Z.jsx)("p",{"data-testid":W.tone==="refused"?"calendar-refused":"calendar-rounded",role:"status",style:{margin:0,fontSize:"0.8125rem",color:W.tone==="refused"?"var(--graview-warn)":"var(--graview-ink-muted)"},children:W.text}):null,O.years?(0,Z.jsx)("nav",{"aria-label":"Years","data-testid":"calendar-years",style:{display:"flex",flexWrap:"wrap",gap:4},children:O.years.map(M=>(0,Z.jsx)("button",{type:"button","data-testid":`calendar-year-${M}`,onClick:()=>N("year",`${M}-01-01`),style:Ye,children:M},M))}):null,b,g==="agenda"&&u?(0,Z.jsx)("div",{"data-testid":"calendar-groups",style:{display:"grid",gap:10,minHeight:0,overflow:"auto"},children:u.map(M=>(0,Z.jsxs)("section",{"data-testid":"calendar-group",style:{display:"grid",gap:4},children:[(0,Z.jsxs)("h3",{style:{margin:0,fontSize:"0.8125rem",letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},children:[M.label," ",(0,Z.jsx)("span",{style:{fontWeight:400},children:M.ids.size})]}),(0,Z.jsx)(kn,{days:O.cells.map(d=>d.from),entries:D.filter(d=>M.ids.has(d.id)),today:a.today,emphasisOf:L,broken:T,hue:G,onMove:(d,y)=>ee(d,{from:y,to:y,label:y},"day")})]},M.label))}):g==="agenda"?(0,Z.jsx)(kn,{days:O.cells.map(M=>M.from),entries:D,today:a.today,emphasisOf:L,broken:T,hue:G,onMove:(M,d)=>ee(M,{from:d,to:d,label:d},"day")}):(0,Z.jsx)(Sr,{span:O,weekStartsOn:S,entries:D,today:a.today,perCell:a.perCell??xr[O.grain],emphasisOf:L,broken:T,hue:G,onOpen:M=>N(vr(O.grain),M.from),onMove:ee})]})})}var re=q(Ee(),1);var Qe=q(Ee(),1),Re=q(te(),1),$n={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"};function $r({choices:e,close:t}){let[n,r]=(0,Qe.useState)(!1),a=(0,Qe.useRef)(null);return(0,Qe.useLayoutEffect)(()=>{n&&a.current?.querySelector("button:not([disabled])")?.focus()},[n]),(0,Re.jsxs)("div",{children:[(0,Re.jsxs)("button",{type:"button","data-menu-item":"move-to","aria-expanded":n,onClick:()=>r(i=>!i),style:$n,children:["Move to ",(0,Re.jsx)("span",{"aria-hidden":"true",children:"\u203A"})]}),n?(0,Re.jsx)("ul",{ref:a,"aria-label":"Move to","data-testid":"move-to",style:{margin:"2px 0 0 12px",padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:e.map(i=>i.run?(0,Re.jsx)("li",{children:(0,Re.jsx)("button",{type:"button","data-move-to":i.to,onClick:()=>{t(),i.run()},style:$n,children:i.label})},i.to):(0,Re.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,Re.jsx)("button",{type:"button",disabled:!0,"data-move-to":i.to,"data-withheld":"",style:{...$n,borderStyle:"dashed"},children:(0,Re.jsx)("s",{children:i.label})}),(0,Re.jsx)("span",{"data-testid":"move-to-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:i.why})]},i.to))}):null]})}function Or({choose:e,close:t}){return(0,Re.jsx)("button",{type:"button","data-menu-item":"choose-several",onClick:()=>{t(),e()},style:$n,children:"Choose several"})}var z=q(te(),1),la=`
3
+ `),style:{...y,display:"grid",justifyItems:ie?"center":"start",gap:3,opacity:R?.5:1,transition:"opacity 160ms ease"},children:[ie?(0,j.jsxs)("span",{style:{position:"relative",width:34,height:34,borderRadius:999,display:"grid",placeItems:"center",fontSize:"0.75rem",letterSpacing:"0.02em",border:x?"1.5px dashed var(--graview-warn)":`1px solid ${P?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:x?"transparent":P?"var(--graview-panel-warning)":"var(--graview-panel)",color:x||P?"var(--graview-warn)":"var(--graview-ink)",boxShadow:x?void 0:"var(--graview-lift-low)"},children:[d.code,f&&!x?(0,j.jsx)("span",{"aria-hidden":"true",style:{position:"absolute",top:-3,right:-3,fontSize:"0.6875rem",lineHeight:1,color:"var(--graview-warn)"},children:"\u26A0"}):null]}):(0,j.jsxs)("span",{style:{display:"grid",gap:1,minWidth:0,maxWidth:180,padding:"5px 10px 6px",borderRadius:8,border:x?"1.5px dashed var(--graview-warn)":`1px solid ${P?"var(--graview-warn)":"var(--graview-edge-bright)"}`,background:x?"transparent":P?"var(--graview-panel-warning)":"var(--graview-panel)",boxShadow:x?void 0:"var(--graview-lift-low)"},children:[(0,j.jsxs)("span",{style:{fontSize:"0.8125rem",fontWeight:550,lineHeight:1.25,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:x||P?"var(--graview-warn)":"var(--graview-ink)"},children:[d.code,f&&!x?" \u26A0":null]}),x?(0,j.jsx)("span",{style:{fontSize:"0.75rem",lineHeight:1.3,color:"var(--graview-warn)"},children:ue}):(0,j.jsx)("span",{style:{display:"flex",flexWrap:"wrap",gap:"0 8px",fontSize:"0.75rem",lineHeight:1.3},children:d.occupants.map(Q=>(0,j.jsxs)("span",{...J(Q),style:{whiteSpace:"nowrap",color:Y(Q)},children:[Q.label,l.has(Q.id)?" \u26A0":""]},Q.id))})]}),ie?x?(0,j.jsx)("span",{style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:"var(--graview-warn)"},children:ue}):d.occupants.map(Q=>(0,j.jsxs)("span",{...J(Q),style:{fontSize:"0.75rem",whiteSpace:"nowrap",color:Y(Q)},children:[Q.label,l.has(Q.id)?" \u26A0":""]},Q.id)):null]},d.id)},U=i.zones??[],de=U.map((d,y)=>({label:d.label,slots:h.slots.filter(x=>x.y>=d.from&&(x.y<d.to||y===U.length-1&&x.y<=d.to))})),B=new Set(de.flatMap(d=>d.slots.map(y=>y.id))),we=h.slots.filter(d=>!B.has(d.id));(we.length>0||de.length===0)&&de.push({label:"",slots:we});let M={boxSizing:"border-box",borderRadius:12,border:"1px solid var(--graview-edge)",background:"linear-gradient(var(--graview-panel-muted), var(--graview-panel-muted)), var(--graview-panel)",overflow:"hidden"};return(0,j.jsxs)(me,{title:n??"Board",meta:h.slots.length===0?void 0:h.empty.length===0?`all ${h.slots.length} filled`:`${h.empty.length} unfilled`,...W?{style:{flex:"1 1 auto",minHeight:0,height:"100%"}}:{},children:[(0,j.jsxs)("div",{ref:L,style:{display:"flex",gap:28,alignItems:"stretch",justifyContent:"center",flex:"1 1 auto",minHeight:0},children:[W&&le?(0,j.jsxs)("div",{style:{width:260,flex:"0 0 auto",alignSelf:"center",display:"grid",gap:8},children:[(0,j.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"What is marked"}),le]}):null,ee?(0,j.jsx)("div",{"data-graview-primitive":"board","data-graview-arrange":"shelf",style:{...M,overflow:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"stretch",display:"grid",alignContent:"start"},children:de.map((d,y)=>(0,j.jsxs)("section",{"data-graview-zone":d.label||void 0,style:{display:"grid",gap:8,padding:"10px 14px 14px",...y>0?{borderTop:"1px dashed var(--graview-edge)"}:{}},children:[d.label?(0,j.jsx)("span",{style:{fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:d.label}):null,d.slots.length>0?(0,j.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:"10px 12px",alignItems:"flex-start"},children:d.slots.map(x=>N(x,{}))}):(0,j.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"nothing here"})]},d.label||`band-${y}`))}):(0,j.jsxs)("div",{style:{display:"flex",gap:5,alignItems:"stretch",minWidth:0,...D?{flex:"1 1 auto",alignSelf:"flex-start"}:{}},children:[!T&&U.length>0?(0,j.jsx)("div",{"aria-hidden":"true",style:{position:"relative",width:15,flex:"0 0 auto",alignSelf:"stretch"},children:U.map(d=>(0,j.jsx)("span",{title:d.label,style:{position:"absolute",top:`${d.from*100}%`,height:`${(d.to-d.from)*100}%`,right:0,writingMode:"vertical-rl",transform:"rotate(180deg)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:d.label},d.label))}):null,(0,j.jsxs)("div",{"data-graview-primitive":"board","data-graview-arrange":"exact",style:{...M,position:"relative",aspectRatio:`${T?1/A:A}`,...D?{width:"100%",height:"auto",flex:"1 1 auto",minWidth:0,alignSelf:"flex-start"}:{height:"100%",flex:"0 1 auto",...O!==null?{width:Math.round(O*(T?1/A:A))}:{}},maxWidth:"100%"},children:[U.map(d=>(0,j.jsx)("div",{"aria-hidden":"true",style:{position:"absolute",...T?{top:0,bottom:0,left:`${(1-d.to)*100}%`,width:`${(d.to-d.from)*100}%`,borderLeft:"1px dashed var(--graview-edge)"}:{left:0,right:0,top:`${d.from*100}%`,height:`${(d.to-d.from)*100}%`,borderBottom:"1px dashed var(--graview-edge)"}}},d.label)),T?U.map(d=>(0,j.jsx)("span",{"aria-hidden":"true",title:d.label,style:{position:"absolute",bottom:3,left:`${(1-d.to)*100}%`,width:`${(d.to-d.from)*100}%`,textAlign:"center",fontSize:"0.6875rem",letterSpacing:"0.14em",textTransform:"uppercase",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis",color:"var(--graview-ink-faint)"},children:d.label},`label-${d.label}`)):null,h.slots.map(d=>N(d,{position:"absolute",left:`${k(d.x,d.y).x*100}%`,top:`${k(d.x,d.y).y*100}%`,transform:"translate(-50%, -50%)",width:"max-content",maxWidth:"100%"}))]})]}),h.spare.length>0?(0,j.jsxs)("div",{style:{display:"grid",gap:6,alignContent:"start",minWidth:0},children:[(0,j.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"Not in"}),(0,j.jsx)(ze,{pick:!0,max:10,items:h.spare.map(d=>({...d,emphasis:o.size===0?"plain":o.has(d.id)?"lit":"dimmed"}))})]}):null]}),W?null:le]})}function or(e){function t(n){let{store:r}=oe(),a=Fn(_e(r.graph,r.schema,n.nodes),r.graph.allEdges(),e,r.schema),s=[...a.slots.flatMap(u=>u.occupants.map(w=>w.id)),...a.spare.map(u=>u.id)].map(u=>r.graph.getNode(u)).filter(u=>u!==void 0),{arranged:p,bar:c}=Ne(n,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{group:!1},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},subject:s}),b=(0,j.jsx)(na,{schema:r.schema,...n,options:e,...e.arranging===!1?{}:{occupants:p.nodes.map(u=>u.id)}});return Ie(n,r.schema,c?(0,j.jsxs)("div",{style:{display:"grid",gap:6,height:"100%",minHeight:0,gridTemplateRows:"auto 1fr"},children:[c,b]}):b)}return{name:"board",requiredRoles:[...ea],options:e,View:t,build(n,r,a){return Fn(n,r,e,a)}}}var Cn=q(Ee(),1);var sr=864e5;function ta(e){if(typeof e!="string")return null;if(In(e))return Bn(e)?.day??null;let t=/^(\d{4}-\d{2}-\d{2})/.exec(e);return t?t[1]:null}function _n(e){if(typeof e=="string"&&st.test(e))return e.length===4?null:lt(e)??null;let t=ta(e);return t===null?null:{from:t,to:t}}var lr=e=>typeof e=="string"&&/^\d{4}$/.test(e);function yn(e){if(typeof e!="string")return null;if(In(e))return Bn(e)?.minutes??null;let t=/^\d{4}-\d{2}-\d{2}[T ](\d{2}):(\d{2})/.exec(e);return t?Number(t[1])*60+Number(t[2]):null}var hn=e=>Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7))-1,Number(e.slice(8,10))),wn=e=>new Date(e).toISOString().slice(0,10);function Ae(e,t){return wn(hn(e)+t*sr)}function je(e,t){let n=Number(e.slice(0,4)),r=Number(e.slice(5,7))-1+t,a=Number(e.slice(8,10)),i=new Date(Date.UTC(n,r+1,0)).getUTCDate();return wn(Date.UTC(n,r,Math.min(a,i)))}var Kn=e=>new Date(hn(e)).getUTCDay();function Ke(e,t=1){let n=(Kn(e)-t+7)%7;return Ae(e,-n)}var Un=e=>`${e.slice(0,7)}-01`;function ye(e,t){return Math.round((hn(t)-hn(e))/sr)}function Ue(e,t){return Array.from({length:t},(n,r)=>Ae(e,r))}var dr=e=>ut(e,"short"),De=e=>dt(e,{weekday:"short"}),Yn=e=>Xe(e);function We(e,t){let n=t?.fieldRoles?.when;return e&&!e.start&&n?{...e,start:n}:e}function cr(e,t){return t===void 0?!1:typeof t=="string"?e[t]===!0:t.is.includes(e[t.field])}var vn=["start"],ra=["day","week","month","quarter","year","agenda"];function bn(e){return e.horizon?["day","week","month","quarter","year","years","agenda"]:ra}function ur(e,t){return e==="years"?t?.title??"Years":`The ${e}`}function gr(){let e=new Date;return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}var Qn=class extends Error{constructor(n,r){super(`The calendar lens has no binding for ${r.map(a=>`"${a}"`).join(", ")} on "${n}". Bind them in the lens declaration: bindings: { ${n}: { start: "<field>" } }.`);this.kind=n;this.missing=r;this.name="CalendarBindingError"}};function xn(e,t,n){let r=We(t[e.kind],n?.tryDefinition(e.kind));if(!r)return null;let a=e,i=n?.tryDefinition(e.kind)?.fields.shape,s=vn.filter(h=>{let o=r[h];return o?i?!(o in i):!(o in a):!0});if(s.length>0)throw new Qn(e.kind,s);let p=_n(a[r.start]);if(p===null)return null;let c=p.from,b=(r.end?_n(a[r.end])?.to:null)??p.to,u=yn(a[r.start]),w=r.label?a[r.label]:void 0;return{id:e.id,kind:e.kind,label:typeof w=="string"&&w.length>0?w:xe(n?.tryDefinition(e.kind),e),from:c,to:ye(c,b)<0?c:b,at:r.allDay&&a[r.allDay]===!0?null:u,allDay:r.allDay&&a[r.allDay]===!0||u===null,done:cr(a,r.done)}}function mr(e,t,n,r){let a=xn(e,t,n);if(!a)return[];let i=We(t[e.kind],n?.tryDefinition(e.kind)).start,s=e,p=s[i],c=s[mt(i)];if(typeof p!="string"||!pt(c))return[a];let b=ye(a.from,a.to);return("next"in r?[ht(p,c,r.next)]:ft(p,c,{from:Ae(r.from,-b),to:r.to,limit:400})).map(w=>({...a,from:w.slice(0,10),to:Ae(w.slice(0,10),b),repeats:!0}))}function Sn(e,t){return e.filter(n=>ye(n.from,t)>=0&&ye(t,n.to)>=0).sort((n,r)=>n.allDay!==r.allDay?n.allDay?-1:1:n.at!==r.at?(n.at??0)-(r.at??0):n.label.localeCompare(r.label))}function pr(e,t,n){let r=yt(e.schema,e.allMutations()).get(t)?.get(n)??[],a=new Map(e.allMutations().map(s=>[s.name,s]));for(let s of r){let p=a.get(s),c=p?.subject;if(!p||!c)continue;let b=p.input?.shape??{};if(n in b)return{name:p.name,arg:c.arg}}let i=e.allMutations().find(s=>s.derived?.act==="edit"&&s.derived.kind===t);return i?.subject?{name:i.name,arg:i.subject.arg}:null}var fr=(e,t)=>({from:Un(e),to:hr(e),label:Tn(e,{short:!0,year:t})});function hr(e){return wn(Date.UTC(Number(e.slice(0,4)),Number(e.slice(5,7)),0))}function aa(e){let t=Math.floor((Number(e.slice(5,7))-1)/3);return`${e.slice(0,4)}-${String(t*3+1).padStart(2,"0")}-01`}function yr(e,t,n={}){let r=n.weekStartsOn??1,a=(c,b)=>({from:c,to:c,label:String(Number(c.slice(8,10))),...b?{outside:!0}:{}});if(e==="day")return{title:De(t),grain:"day",columns:1,cells:[a(t)]};if(e==="week"){let c=Ke(t,r);return{title:`${De(c)} \u2013 ${De(Ae(c,6))}`,grain:"day",columns:7,cells:Ue(c,7).map(b=>a(b))}}if(e==="agenda")return{title:`From ${De(t)}`,grain:"day",columns:1,cells:Ue(t,42).map(c=>a(c))};if(e==="quarter"){let c=aa(t),b=hr(je(c,2)),u=[];for(let w=Ke(c,r);ye(w,b)>=0;w=Ae(w,7))u.push({from:w,to:Ae(w,6),label:ct(w),...ye(w,c)>0&&ye(Ae(w,6),c)>0?{outside:!0}:{}});return{title:`Q${Math.floor((Number(t.slice(5,7))-1)/3)+1} ${t.slice(0,4)}`,grain:"week",columns:4,cells:u}}if(e==="year"){let c=t.slice(0,4);return{title:c,grain:"month",columns:4,cells:Array.from({length:12},(b,u)=>fr(`${c}-${String(u+1).padStart(2,"0")}-01`,!1))}}if(e==="years"){let c=Number(t.slice(0,4)),b=c+Math.max(1,n.horizon?.years??1)-1,u=n.horizon?.from!==void 0||n.horizon?.to!==void 0,w=u?n.horizon?.from??c:Math.min(c,n.fit?.first??c),o=(u?Math.max(w,n.horizon?.to??w+Math.max(1,n.horizon?.years??1)-1):Math.max(b,n.fit?.last??b))-w+1,l=Array.from({length:o},(C,g)=>String(w+g));return o>ia?{title:`${n.horizon?.title??"Years"} \xB7 ${l[0]}\u2013${l[l.length-1]}`,grain:"year",columns:5,years:l,cells:l.map(C=>({from:`${C}-01-01`,to:`${C}-12-31`,label:C}))}:{title:`${n.horizon?.title??"Years"} \xB7 ${l[0]}\u2013${l[l.length-1]}`,grain:"month",columns:4,years:l,cells:l.flatMap(C=>Array.from({length:12},(g,S)=>fr(`${C}-${String(S+1).padStart(2,"0")}-01`,!0)))}}let i=Un(t),s=Ke(i,r),p=t.slice(0,7);return{title:Tn(t),grain:"day",columns:7,cells:Ue(s,42).map(c=>a(c,c.slice(0,7)!==p))}}function wr(e,t,n){return e.filter(r=>ye(r.from,n)>=0&&ye(t,r.to)>=0).sort((r,a)=>r.allDay!==a.allDay?r.allDay?-1:1:r.from!==a.from?r.from.localeCompare(a.from):r.at!==a.at?(r.at??0)-(a.at??0):r.label.localeCompare(a.label))}var ia=10;function vr(e){return e==="year"?"year":e==="month"?"month":e==="week"?"week":"day"}var br=q(Ee(),1);var ae=q(te(),1);function Jn({label:e,glyph:t,onPress:n}){return(0,ae.jsx)("button",{type:"button","aria-label":e,title:e,onClick:n,style:Ye,children:t})}var Ye={minHeight:24,minWidth:24,padding:"2px 9px",borderRadius:6,fontSize:"0.8125rem",borderWidth:1,borderStyle:"solid",borderColor:"transparent",color:"var(--graview-ink-muted)",background:"transparent"},xr={day:12,week:4,month:3,year:5};function Sr({span:e,weekStartsOn:t,entries:n,today:r,perCell:a,emphasisOf:i,broken:s,hue:p,onOpen:c,onMove:b}){let u=(0,br.useRef)(null),w=Fe(u),h=w===null?e.columns:Math.max(1,Math.floor(w/44)),o=h<e.columns,l=o?h:e.columns,C=!o&&e.grain==="day"&&e.columns===7?Ue(Ke(e.cells[0]?.from??r,t),7):e.grain==="day"&&e.columns===1?e.cells.map(g=>g.from):null;return o&&e.grain==="day"&&e.columns>1?(0,ae.jsx)("div",{ref:u,"data-calendar-shape":"agenda",style:{display:"grid",minHeight:0,flex:1},children:(0,ae.jsx)(kn,{days:e.cells.map(g=>g.from),entries:n,today:r,emphasisOf:i,broken:s,hue:p,onMove:(g,S)=>b(g,{from:S,to:S,label:S},"day")})}):(0,ae.jsxs)("div",{ref:u,"data-calendar-shape":o?"wrapped":"grid",style:{display:"grid",gap:4,gridTemplateRows:C?"auto 1fr":"1fr",minHeight:0,flex:1},children:[C?(0,ae.jsx)("div",{style:{display:"grid",gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`,gap:4},children:C.map(g=>(0,ae.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-muted)",textAlign:"center"},children:e.columns===7?dr(Kn(g)):De(g)},g))}):null,(0,ae.jsx)("div",{tabIndex:0,"aria-label":`The days of ${e.title}`,style:{display:"grid",gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`,gridAutoRows:"max-content",gap:4,minHeight:0,overflow:"auto"},children:e.cells.map((g,S)=>{let A=wr(n,g.from,g.to),L=A.slice(0,a),T=A.slice(a),v=T.filter(m=>s.has(m.id)).length,O=ye(g.from,r)>=0&&ye(r,g.to)>=0;return(0,ae.jsxs)("div",{"data-calendar-day":e.grain==="day"?g.from:void 0,"data-calendar-cell":g.from,"data-calendar-grain":e.grain,"data-calendar-count":A.length,"data-calendar-outside":g.outside||void 0,onDragOver:m=>{m.dataTransfer.types.includes("text/graview-node")&&(m.preventDefault(),m.dataTransfer.dropEffect="move")},onDrop:m=>{let E=m.dataTransfer.getData("text/graview-node");E&&(m.preventDefault(),m.stopPropagation(),b(E,g,e.grain))},style:{minHeight:62,display:"flex",flexDirection:"column",gap:2,padding:4,borderRadius:7,border:"1px solid var(--graview-edge)",background:O?"var(--graview-panel)":g.outside?"var(--graview-panel-muted)":"transparent"},children:[(0,ae.jsxs)("span",{style:{display:"flex",alignItems:"baseline",gap:4},children:[(0,ae.jsx)("span",{style:{fontSize:"0.75rem",fontVariantNumeric:"tabular-nums",color:O?"var(--graview-accent)":"var(--graview-ink-faint)"},children:g.label}),e.grain!=="day"&&A.length>0?(0,ae.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",marginLeft:"auto"},children:A.length}):null]}),L.map(m=>(0,ae.jsx)(kr,{entry:m,cell:g,rowStart:S%l===0,emphasis:i(m.id),flagged:s.has(m.id),hue:p(m)},`${m.id}:${m.from}:${g.from}`)),T.length>0?(0,ae.jsxs)("button",{type:"button","data-testid":`calendar-more-${g.from}`,onClick:()=>c(g),title:`Open ${g.label}`,style:{minHeight:24,padding:"1px 5px",fontSize:"0.75rem",borderRadius:5,border:"1px dashed var(--graview-edge)",background:"transparent",color:v>0?"var(--graview-warn)":"var(--graview-ink-muted)",textAlign:"left"},children:["+",T.length," more",v>0?` \xB7 ${v} flagged`:""]}):null]},g.from)})})]})}function kn({days:e,entries:t,today:n,emphasisOf:r,broken:a,hue:i,onMove:s}){let p=e.map(c=>({day:c,here:Sn(t,c)})).filter(({here:c})=>c.length>0);return p.length===0?(0,ae.jsx)("p",{"data-testid":"calendar-empty",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:"Nothing is scheduled in the next six weeks."}):(0,ae.jsx)("ol",{tabIndex:0,"aria-label":"What is scheduled",style:{margin:0,padding:0,listStyle:"none",display:"grid",alignContent:"start",gap:10,overflow:"auto",minHeight:0},children:p.map(({day:c,here:b})=>(0,ae.jsxs)("li",{"data-calendar-day":c,onDragOver:u=>{u.dataTransfer.types.includes("text/graview-node")&&(u.preventDefault(),u.dataTransfer.dropEffect="move")},onDrop:u=>{let w=u.dataTransfer.getData("text/graview-node");w&&(u.preventDefault(),u.stopPropagation(),s(w,c))},style:{display:"grid",gap:4},children:[(0,ae.jsxs)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:c===n?"var(--graview-accent)":"var(--graview-ink-muted)"},children:[De(c),c===n?" \xB7 today":""]}),b.map(u=>(0,ae.jsx)(kr,{entry:u,cell:{from:c,to:c,label:c},emphasis:r(u.id),flagged:a.has(u.id),hue:i(u)},`${u.id}:${u.from}:${c}`))]},c))})}function kr({entry:e,cell:t,emphasis:n,flagged:r,hue:a,rowStart:i=!1}){let s=ye(t.from,e.from)>=0,p=ye(e.to,t.to)>=0,c=!(s&&p),b=e.at!==null&&s&&e.from===t.from?`${Yn(e.at)} ${e.label}`:e.label;return(0,ae.jsx)("span",{"data-graview-pick":e.id,"data-calendar-entry":e.id,"data-calendar-repeat":e.repeats?e.from:void 0,draggable:!e.repeats,onDragStart:u=>{u.dataTransfer.setData("text/graview-node",e.id),u.dataTransfer.effectAllowed="move"},"data-graview-emphasis":n,"data-calendar-part":c?s?"opens":p?"closes":"through":void 0,"data-calendar-in":t.from,title:c?`${e.label} \xB7 ${e.from} \u2013 ${e.to}`:`${e.label}${e.at===null?" \xB7 all day":` \xB7 ${Yn(e.at)}`}${e.repeats?" \xB7 repeats":""}`,style:{display:"block",minHeight:24,boxSizing:"border-box",padding:"3px 6px",fontSize:"0.75rem",lineHeight:1.35,borderRadius:c?s?"5px 0 0 5px":p?"0 5px 5px 0":0:5,whiteSpace:"normal",overflowWrap:"anywhere",hyphens:"auto",textDecoration:e.done?"line-through":"none",opacity:n==="dimmed"?.35:e.done?.6:1,background:`color-mix(in oklab, hsl(${Math.round(a)} 70% 55%) ${n==="lit"?38:20}%, transparent)`,color:"var(--graview-ink)",...n==="lit"?{outline:"1px solid var(--graview-accent)"}:{},...r?{borderLeft:"3px solid var(--graview-warn)",paddingLeft:4}:{}},children:s||i?e.repeats?(0,ae.jsxs)(ae.Fragment,{children:[(0,ae.jsx)("span",{"aria-hidden":"true",children:"\u21BB "}),b]}):b:" "})}var Z=q(te(),1);function oa(e){let t=1/0,n=-1/0;for(let r of e)r&&(t=Math.min(t,Number(r.from.slice(0,4))),n=Math.max(n,Number(r.to.slice(0,4))));return Number.isFinite(t)&&Number.isFinite(n)?{first:t,last:n}:void 0}function Cr(e){let t=n=>function(a){let{store:i}=oe(),{view:s}=nn(),p=n?{...e,range:n}:e,c=s.within?.range??p.range??"month",b=Object.keys(e.bindings),{nodes:u,arranged:w,arrangement:h,bar:o}=Ne(a,{...e.arranging!==void 0?{allow:e.arranging}:{},lensAllows:{sort:!1,group:c==="agenda"},...e.arrangedBy?{arrangedBy:e.arrangedBy}:{},...e.search?{search:e.search}:{},...e.filters?{filters:e.filters}:{},...b[0]?{kind:(a.nodes??[]).find(A=>b.includes(String(A.kind)))?.kind??b[0]}:{}}),l=c==="agenda"&&w.grouped&&h.group?w.groups.map(A=>({label:A.label,ids:new Set(A.nodes.map(L=>L.id))})):void 0,C=new Set((a.nodes??[]).map(A=>String(A.kind))),g=b.filter(A=>!C.has(A)&&i.schema.tryDefinition(A)!==void 0).flatMap(A=>{let L=i.schema.tryDefinition(A);return i.graph.nodesOfKind(A).filter(T=>s.past===!0||Ge(L,T))}),S=g.length===0?u:[...u,...a.budget!==void 0?g.slice(0,a.budget):g];return Ie(a,i.schema,(0,Z.jsx)(sa,{schema:i.schema,...a,nodes:S,options:{...p,today:p.today??i.today()??gr()},...o?{bar:o}:{},...l?{groups:l}:{}}))};return{name:"calendar",requiredRoles:[...vn],bindings:e.bindings,options:e,View:t(),at:n=>t(n),ranges:()=>bn(e).map(n=>({range:n,title:ur(n,e.horizon)})),place:(n,r)=>n.map(a=>xn(a,e.bindings,r)).filter(a=>a!==null)}}function sa({nodes:e,label:t,fidelity:n,mode:r,options:a,schema:i,selectedIds:s=[],implicated:p=[],flagged:c=[],bar:b,groups:u}){let{view:w,go:h}=nn(),{store:o,principal:l}=oe(),C=w.within?.at??a.today,g=w.within?.range??a.range??"month",S=a.weekStartsOn??1,A=new Set([...p,...s]),L=M=>A.size===0?"plain":A.has(M)?"lit":"dimmed",T=new Set(c),v=g==="years"&&w.within?.at===void 0?oa((e??[]).map(M=>xn(M,a.bindings,i))):void 0,O=yr(g,C,{weekStartsOn:S,...a.horizon?{horizon:a.horizon}:{},...v?{fit:v}:{}}),E=n==="glyph"||n==="summary"?{next:a.today}:{from:O.cells[0]?.from??C,to:O.cells[O.cells.length-1]?.to??C},D=(e??[]).flatMap(M=>mr(M,a.bindings,i,E)),G=a.hueOf??(M=>be(M.kind)),k=(e??[]).filter(M=>{let d=We(a.bindings[M.kind],i?.tryDefinition(M.kind));return d!==void 0&&lr(M[d.start])}).length;if(n==="glyph")return(0,Z.jsx)(ke,{label:`${t??"Calendar"} \xB7 ${D.length}`,hue:be("calendar")});if(n==="summary"){let M=Sn(D,a.today);return(0,Z.jsx)(me,{title:t??"Calendar",meta:`${D.length} dated`,tone:"muted",children:(0,Z.jsx)(ze,{max:6,items:M.length>0?M.map(d=>({id:d.id,label:d.label,hue:G(d)})):D.filter(d=>ye(a.today,d.from)>=0).sort((d,y)=>d.from.localeCompare(y.from)).slice(0,6).map(d=>({id:d.id,label:`${d.from.slice(5)} ${d.label}`,hue:G(d)}))})})}let _=r==="fullscreen",[W,le]=(0,Cn.useState)(null),ee=(M,d,y)=>{let x=o.graph.getNode(M);if(!x)return;let R=We(a.bindings[x.kind],o.schema.tryDefinition(x.kind));if(!R)return;let f=pr(o,x.kind,R.start);if(!f){le({text:`Nothing declared writes the ${Nn(o.schema.definitions.find(Y=>Y.kind===x.kind),R.start).toLowerCase()}, so this cannot be moved from here.`,tone:"refused"});return}let $=d.from,P=x[R.start],H=yn(P)===null?$:`${$}${String(P).slice(10)}`,K={name:f.name,args:{[f.arg]:M,[R.start]:H}},J=o.permits(K,l);if(!J.ok){le({text:J.refusal.message,tone:"refused"});return}try{o.apply(K,{author:l}),le(y==="day"?null:{text:`Moved to ${De($)} \u2014 a ${y} is coarser than the ${Nn(o.schema.definitions.find(Y=>Y.kind===x.kind),R.start).toLowerCase()} holds, so it takes the first day of the cell. Undo puts it back.`,tone:"rounded"})}catch(Y){le({text:Y instanceof Error?Y.message:String(Y),tone:"refused"})}},ie=M=>{let d=g==="years"?je(`${O.years?.[0]??C.slice(0,4)}${C.slice(4)}`,M*12*Math.max(1,O.years?.length??a.horizon?.years??1)):g==="year"?je(C,M*12):g==="quarter"?je(C,M*3):g==="month"?je(C,M):g==="week"?Ae(C,M*7):Ae(C,M);h(en(w,"at",d))},N=(M,d)=>{let y=en(w,"range",M);d!==void 0&&(y=en(y,"at",d)),h(y)},U=(0,Cn.useRef)(null),de=Fe(U),B=de!==null&&de<420,we=M=>M==="years"?a.horizon?.title??"years":M.charAt(0).toUpperCase()+M.slice(1);return(0,Z.jsx)(me,{title:t??"Calendar",meta:O.title,style:{gap:10,..._?{flex:"1 1 auto",minHeight:0,height:"100%"}:{}},children:(0,Z.jsxs)("div",{ref:U,"data-testid":"calendar","data-calendar-range":g,"data-calendar-at":C,style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,gap:8},children:[(0,Z.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:6},children:[(0,Z.jsxs)("nav",{"aria-label":"When",style:{display:"flex",gap:4},children:[(0,Z.jsx)(Jn,{label:"Previous",glyph:"\u2039",onPress:()=>ie(-1)}),(0,Z.jsx)("button",{type:"button","data-testid":"calendar-today",onClick:()=>h(en(w,"at",a.today)),style:Ye,children:"Today"}),(0,Z.jsx)(Jn,{label:"Next",glyph:"\u203A",onPress:()=>ie(1)})]}),B?(0,Z.jsx)("select",{"aria-label":"Range","data-testid":"calendar-ranges",value:g,onChange:M=>N(M.target.value),style:{...Ye,borderRadius:999,borderColor:"var(--graview-edge)",background:void 0,backgroundColor:"transparent",marginLeft:"auto",maxWidth:"50%",paddingRight:24,appearance:"none",WebkitAppearance:"none",backgroundImage:"linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%)",backgroundPosition:"calc(100% - 13px) 55%, calc(100% - 9px) 55%",backgroundSize:"4px 4px, 4px 4px",backgroundRepeat:"no-repeat"},children:bn(a).map(M=>(0,Z.jsx)("option",{value:M,children:we(M)},M))}):(0,Z.jsx)("div",{role:"group","aria-label":"Range","data-testid":"calendar-ranges",style:{display:"flex",flexWrap:"wrap",gap:4,marginLeft:"auto"},children:bn(a).map(M=>(0,Z.jsx)("button",{type:"button","aria-pressed":M===g,"data-testid":`calendar-range-${M}`,onClick:()=>N(M),style:{...Ye,borderRadius:999,borderColor:"var(--graview-edge)",...M==="years"?{}:{textTransform:"capitalize"},...M===g?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)",background:"var(--graview-panel)"}:{}},children:M==="years"?a.horizon?.title??"years":M},M))})]}),k>0?(0,Z.jsx)("p",{"data-testid":"calendar-year-only",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:k===1?"1 knows only its year, so it is not placed.":`${k} know only their year, so they are not placed.`}):null,W?(0,Z.jsx)("p",{"data-testid":W.tone==="refused"?"calendar-refused":"calendar-rounded",role:"status",style:{margin:0,fontSize:"0.8125rem",color:W.tone==="refused"?"var(--graview-warn)":"var(--graview-ink-muted)"},children:W.text}):null,O.years?(0,Z.jsx)("nav",{"aria-label":"Years","data-testid":"calendar-years",style:{display:"flex",flexWrap:"wrap",gap:4},children:O.years.map(M=>(0,Z.jsx)("button",{type:"button","data-testid":`calendar-year-${M}`,onClick:()=>N("year",`${M}-01-01`),style:Ye,children:M},M))}):null,b,g==="agenda"&&u?(0,Z.jsx)("div",{"data-testid":"calendar-groups",style:{display:"grid",gap:10,minHeight:0,overflow:"auto"},children:u.map(M=>(0,Z.jsxs)("section",{"data-testid":"calendar-group",style:{display:"grid",gap:4},children:[(0,Z.jsxs)("h3",{style:{margin:0,fontSize:"0.8125rem",letterSpacing:"0.08em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},children:[M.label," ",(0,Z.jsx)("span",{style:{fontWeight:400},children:M.ids.size})]}),(0,Z.jsx)(kn,{days:O.cells.map(d=>d.from),entries:D.filter(d=>M.ids.has(d.id)),today:a.today,emphasisOf:L,broken:T,hue:G,onMove:(d,y)=>ee(d,{from:y,to:y,label:y},"day")})]},M.label))}):g==="agenda"?(0,Z.jsx)(kn,{days:O.cells.map(M=>M.from),entries:D,today:a.today,emphasisOf:L,broken:T,hue:G,onMove:(M,d)=>ee(M,{from:d,to:d,label:d},"day")}):(0,Z.jsx)(Sr,{span:O,weekStartsOn:S,entries:D,today:a.today,perCell:a.perCell??xr[O.grain],emphasisOf:L,broken:T,hue:G,onOpen:M=>N(vr(O.grain),M.from),onMove:ee})]})})}var re=q(Ee(),1);var Qe=q(Ee(),1),Re=q(te(),1),$n={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"};function $r({choices:e,close:t}){let[n,r]=(0,Qe.useState)(!1),a=(0,Qe.useRef)(null);return(0,Qe.useLayoutEffect)(()=>{n&&a.current?.querySelector("button:not([disabled])")?.focus()},[n]),(0,Re.jsxs)("div",{children:[(0,Re.jsxs)("button",{type:"button","data-menu-item":"move-to","aria-expanded":n,onClick:()=>r(i=>!i),style:$n,children:["Move to ",(0,Re.jsx)("span",{"aria-hidden":"true",children:"\u203A"})]}),n?(0,Re.jsx)("ul",{ref:a,"aria-label":"Move to","data-testid":"move-to",style:{margin:"2px 0 0 12px",padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:e.map(i=>i.run?(0,Re.jsx)("li",{children:(0,Re.jsx)("button",{type:"button","data-move-to":i.to,onClick:()=>{t(),i.run()},style:$n,children:i.label})},i.to):(0,Re.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,Re.jsx)("button",{type:"button",disabled:!0,"data-move-to":i.to,"data-withheld":"",style:{...$n,borderStyle:"dashed"},children:(0,Re.jsx)("s",{children:i.label})}),(0,Re.jsx)("span",{"data-testid":"move-to-why",style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-ink-muted)",padding:"0 10px"},children:i.why})]},i.to))}):null]})}function Or({choose:e,close:t}){return(0,Re.jsx)("button",{type:"button","data-menu-item":"choose-several",onClick:()=>{t(),e()},style:$n,children:"Choose several"})}var z=q(te(),1),la=`
4
4
  .graview-columns { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-start; }
5
5
  .graview-columns-column { flex: 1 1 13rem; min-width: 0; display: flex; flex-direction: column; gap: 8px; padding: 8px; border-radius: 10px; border: 1px solid var(--graview-edge); background: color-mix(in srgb, var(--graview-panel) 60%, transparent); }
6
6
  .graview-columns-column[data-droppable="true"] { border-color: var(--graview-accent); }
@@ -1 +1 @@
1
- import{Pa as y,Ra as k,W as w,j as c,l as h,m as b,r as f}from"./chunk.MODLZJD4.js";import{Z as i}from"./chunk.6HY6ZGEE.js";import{b as g}from"./chunk.AJZBJBMO.js";var s=null,a=new Set,v=e=>{s={kind:e,n:(s?.n??0)+1};for(let t of a)t()},A=()=>s,C=e=>(a.add(e),()=>a.delete(e)),V=()=>{s=null};var d=g(w(),1);function T(e,t){if(e.length===0||t.length===0)return[];let o=new Set(t.map(n=>n.id));return e.filter(n=>n.nodeIds.some(l=>o.has(l)))}var x=(e,t)=>`${i(e)} ${e===1?"problem":"problems"} in ${t}`;function q({kind:e,plural:t,problems:o,flag:n,listed:l=!1}){let{view:p,go:P}=k(),{set:$}=y();if(o.length===0)return null;let u=x(o.length,t),m=o.length===1?"it":"them";return(0,d.jsx)("button",{type:"button",className:"graview-district-problems","data-testid":`district-problems-${e}`,"data-graview-problems":o.length,"aria-expanded":l,"aria-label":u,title:`${u} \u2014 ${o[0].message}${o.length>1?` (and ${i(o.length-1)} more)`:""}. Press to see ${m} and how to fix ${m}.`,onClick:r=>{r.stopPropagation(),p.overview||P(h(c(b(p,!0),null),"view",null)),$([f(e)]),v(e)},onDoubleClick:r=>r.stopPropagation(),onPointerDown:r=>r.stopPropagation(),children:(0,d.jsx)("span",{"aria-hidden":"true",children:`${n} ${i(o.length)}`})})}export{A as a,C as b,V as c,T as d,x as e,q as f};
1
+ import{Pa as y,Ra as k,W as w,j as c,l as h,m as b,r as f}from"./chunk.A5PSEU3W.js";import{Z as i}from"./chunk.ZEZUKRC6.js";import{b as g}from"./chunk.AJZBJBMO.js";var s=null,a=new Set,v=e=>{s={kind:e,n:(s?.n??0)+1};for(let t of a)t()},A=()=>s,C=e=>(a.add(e),()=>a.delete(e)),V=()=>{s=null};var d=g(w(),1);function T(e,t){if(e.length===0||t.length===0)return[];let o=new Set(t.map(n=>n.id));return e.filter(n=>n.nodeIds.some(l=>o.has(l)))}var x=(e,t)=>`${i(e)} ${e===1?"problem":"problems"} in ${t}`;function q({kind:e,plural:t,problems:o,flag:n,listed:l=!1}){let{view:p,go:P}=k(),{set:$}=y();if(o.length===0)return null;let u=x(o.length,t),m=o.length===1?"it":"them";return(0,d.jsx)("button",{type:"button",className:"graview-district-problems","data-testid":`district-problems-${e}`,"data-graview-problems":o.length,"aria-expanded":l,"aria-label":u,title:`${u} \u2014 ${o[0].message}${o.length>1?` (and ${i(o.length-1)} more)`:""}. Press to see ${m} and how to fix ${m}.`,onClick:r=>{r.stopPropagation(),p.overview||P(h(c(b(p,!0),null),"view",null)),$([f(e)]),v(e)},onDoubleClick:r=>r.stopPropagation(),onPointerDown:r=>r.stopPropagation(),children:(0,d.jsx)("span",{"aria-hidden":"true",children:`${n} ${i(o.length)}`})})}export{A as a,C as b,V as c,T as d,x as e,q as f};
@@ -0,0 +1 @@
1
+ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{G as k,La as o,W as n}from"./chunk.A5PSEU3W.js";import{a as t}from"./chunk.SDO3U72B.js";import{b as p}from"./chunk.AJZBJBMO.js";var f=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.DWM7AR5Y.js","./chunk.6KJGRM7A.js","./chunk.WALVW3KJ.js","./chunk.SNHKYH72.js","./chunk.UGQYMN4J.js","./chunk.RG5G6YQD.js","./chunk.MIE4TJRW.js","./chunk.QRQ5WPZI.js","./chunk.RD2FSSLV.js","./chunk.37RFCHSS.js","./chunk.SO6NT5K7.js","./chunk.MUSMNKE4.js","./chunk.SJQPTDAT.js","./chunk.JQ63N4MZ.js","./chunk.Z3O2VZAJ.js","./chunk.QNP5OR3P.js","./chunk.4W57E7AX.js","./chunk.A5PSEU3W.js","./chunk.SDO3U72B.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.HN4ZJ4B4.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.MIE4TJRW.js","./chunk.QRQ5WPZI.js","./chunk.RD2FSSLV.js","./chunk.37RFCHSS.js","./chunk.SO6NT5K7.js","./chunk.MUSMNKE4.js","./chunk.SJQPTDAT.js","./chunk.JQ63N4MZ.js","./chunk.Z3O2VZAJ.js","./chunk.QNP5OR3P.js","./chunk.4W57E7AX.js","./chunk.A5PSEU3W.js","./chunk.SDO3U72B.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.FRQSLWP4.js")))),I=d.part((e,r)=>e.drawLinkedRecord(r),{quiet:!0}),w=d.part((e,r)=>e.drawLinkedPicker(r),{what:"Picking a linked record"});var s=p(n(),1),m=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.MIE4TJRW.js","./chunk.QRQ5WPZI.js","./chunk.RD2FSSLV.js","./chunk.37RFCHSS.js","./chunk.SO6NT5K7.js","./chunk.MUSMNKE4.js","./chunk.SJQPTDAT.js","./chunk.JQ63N4MZ.js","./chunk.Z3O2VZAJ.js","./chunk.QNP5OR3P.js","./chunk.4W57E7AX.js","./chunk.A5PSEU3W.js","./chunk.SDO3U72B.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.Z2XUVJAL.js")))),g=m.part((e,r)=>(0,s.jsx)(e.RepeatPicker,{...r}),{quiet:!0}),E=m.part((e,r)=>(0,s.jsx)(e.RepeatEditor,{...r}),{quiet:!0});var a=p(k(),1),i=p(n(),1),c=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.SO6NT5K7.js","./chunk.MUSMNKE4.js","./chunk.SJQPTDAT.js","./chunk.JQ63N4MZ.js","./chunk.Z3O2VZAJ.js","./chunk.QNP5OR3P.js","./chunk.4W57E7AX.js","./chunk.A5PSEU3W.js","./chunk.SDO3U72B.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ARWO4WOV.js")))),l=c.part((e,r)=>(0,i.jsx)(e.WhenInput,{...r}),{quiet:!0});function M(e){return(0,i.jsx)(a.Suspense,{fallback:(0,i.jsx)("span",{"data-graview-when-arriving":"",style:{display:"inline-block",minHeight:24}}),children:(0,i.jsx)(l,{...e})})}var N=()=>c.load().then(()=>{},()=>{});export{y as a,I as b,w as c,g as d,E as e,M as f,N as g};
@@ -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 y}from"./chunk.7VP6Y6D2.js";import{m as g}from"./chunk.U3HERHAI.js";import{G as R,La as m,W as c}from"./chunk.MODLZJD4.js";import{a as f}from"./chunk.SDO3U72B.js";import{ua as p}from"./chunk.6HY6ZGEE.js";import{b as u}from"./chunk.AJZBJBMO.js";var o=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>(__graviewPreload(import.meta.url,["./chunk.JXNVNFV4.js","./chunk.OTV5XTBB.js","./chunk.KBPJ7X7W.js","./chunk.OEIWIZCP.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QPF4KSAW.js"))));function L(e){let[n,t]=(0,o.useState)(()=>h().current);return(0,o.useEffect)(()=>{if(!e||n)return;let i=!0;return h().load().then(a=>i&&t(a),()=>{}),()=>{i=!1}},[e,n]),n}function D(e,n){let t=L(n.length>0);return(0,o.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,o.useMemo)(()=>{let i=new Map;if(!t)return i;for(let a of n){let l=t.ruleLine(a,e);l&&i.set(a.name,l)}return i},[t,e,n])}function M(e){let n=e.line;if(!(!n||e.message.endsWith(` \u2014 ${n.text}`)||e.message===b(e)))return e.message}function b(e){let n=e.line;return n?n.record!==void 0?`${n.record} \u2014 ${n.text}`:n.text:e.message}var P={name:{},op:{color:"var(--graview-ink-muted)",fontWeight:500},value:{fontWeight:600,fontVariantNumeric:"tabular-nums"},word:{color:"var(--graview-ink-muted)"},open:{color:"var(--graview-ink-faint)"},close:{color:"var(--graview-ink-faint)"}};function w({parts:e}){return(0,r.jsx)(r.Fragment,{children:e.map((n,t)=>(0,r.jsxs)("span",{children:[n.space?" ":"",(0,r.jsx)("span",{"data-graview-rule-part":n.as,style:P[n.as],children:n.text})]},t))})}function x(e,n){let t=p(e?.tryDefinition(n),n);return t.charAt(0).toUpperCase()+t.slice(1)}function C({line:e,schema:n,brand:t,lead:i=e.record===void 0?"kind":"record",stacked:a=!1,style:l}){let d=e.kind,s=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&s?`${s}: ${e.said}`:i==="record"&&s?`${s} \u2014 ${e.said}`:e.said;return(0,r.jsxs)("span",{"data-graview-rule-line":"",style:{overflowWrap:"anywhere",...l},children:[(0,r.jsx)("span",{style:g,children:k}),(0,r.jsxs)("span",{"aria-hidden":"true",children:[i!=="none"&&d?(0,r.jsx)("span",{style:{display:"inline-flex",verticalAlign:"-0.1em",marginRight:"0.4em"},children:(0,r.jsx)(y,{kind:d,...n?{schema:n}:{},...t?{brand:t}:{},size:13})}):null,s?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[s,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&s?(0,r.jsx)("br",{}):null,(0,r.jsx)(w,{parts:e.parts}),e.when&&e.when.length>0?(0,r.jsxs)("span",{"data-graview-rule-when":"",style:{color:"var(--graview-ink-faint)"},children:[", when ",(0,r.jsx)(w,{parts:e.when})]}):null]})]})}function z(e){return e.line?e.label&&e.label.trim().length>0?e.label:void 0:e.label&&e.label!==e.message&&!e.message.startsWith(e.label)?e.label:void 0}export{D as a,I as b,M as c,C as d,z as e};
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 y}from"./chunk.EP6Q32WT.js";import{m as g}from"./chunk.QNP5OR3P.js";import{G as R,La as m,W as c}from"./chunk.A5PSEU3W.js";import{a as f}from"./chunk.SDO3U72B.js";import{ua as p}from"./chunk.ZEZUKRC6.js";import{b as u}from"./chunk.AJZBJBMO.js";var o=u(R(),1);var r=u(c(),1),S,h=()=>S??=m(f(()=>(__graviewPreload(import.meta.url,["./chunk.B7KZBT27.js","./chunk.SNHKYH72.js","./chunk.UGQYMN4J.js","./chunk.RG5G6YQD.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.V7H4BUEB.js"))));function L(e){let[n,t]=(0,o.useState)(()=>h().current);return(0,o.useEffect)(()=>{if(!e||n)return;let i=!0;return h().load().then(a=>i&&t(a),()=>{}),()=>{i=!1}},[e,n]),n}function D(e,n){let t=L(n.length>0);return(0,o.useMemo)(()=>t?t.withLines(e,n):n,[t,e,n])}function I(e,n){let t=L(n.some(i=>i.shape));return(0,o.useMemo)(()=>{let i=new Map;if(!t)return i;for(let a of n){let l=t.ruleLine(a,e);l&&i.set(a.name,l)}return i},[t,e,n])}function M(e){let n=e.line;if(!(!n||e.message.endsWith(` \u2014 ${n.text}`)||e.message===b(e)))return e.message}function b(e){let n=e.line;return n?n.record!==void 0?`${n.record} \u2014 ${n.text}`:n.text:e.message}var P={name:{},op:{color:"var(--graview-ink-muted)",fontWeight:500},value:{fontWeight:600,fontVariantNumeric:"tabular-nums"},word:{color:"var(--graview-ink-muted)"},open:{color:"var(--graview-ink-faint)"},close:{color:"var(--graview-ink-faint)"}};function w({parts:e}){return(0,r.jsx)(r.Fragment,{children:e.map((n,t)=>(0,r.jsxs)("span",{children:[n.space?" ":"",(0,r.jsx)("span",{"data-graview-rule-part":n.as,style:P[n.as],children:n.text})]},t))})}function x(e,n){let t=p(e?.tryDefinition(n),n);return t.charAt(0).toUpperCase()+t.slice(1)}function C({line:e,schema:n,brand:t,lead:i=e.record===void 0?"kind":"record",stacked:a=!1,style:l}){let d=e.kind,s=i==="kind"?d?x(n,d):void 0:i==="record"?e.record:void 0,k=i==="kind"&&s?`${s}: ${e.said}`:i==="record"&&s?`${s} \u2014 ${e.said}`:e.said;return(0,r.jsxs)("span",{"data-graview-rule-line":"",style:{overflowWrap:"anywhere",...l},children:[(0,r.jsx)("span",{style:g,children:k}),(0,r.jsxs)("span",{"aria-hidden":"true",children:[i!=="none"&&d?(0,r.jsx)("span",{style:{display:"inline-flex",verticalAlign:"-0.1em",marginRight:"0.4em"},children:(0,r.jsx)(y,{kind:d,...n?{schema:n}:{},...t?{brand:t}:{},size:13})}):null,s?(0,r.jsxs)("span",{"data-graview-rule-head":"",style:{fontWeight:600,marginRight:i==="record"||a?0:"0.6em"},children:[s,i==="record"&&!a?(0,r.jsx)("span",{style:{color:"var(--graview-ink-faint)",fontWeight:400},children:" \u2014 "}):null]}):null,a&&s?(0,r.jsx)("br",{}):null,(0,r.jsx)(w,{parts:e.parts}),e.when&&e.when.length>0?(0,r.jsxs)("span",{"data-graview-rule-when":"",style:{color:"var(--graview-ink-faint)"},children:[", when ",(0,r.jsx)(w,{parts:e.when})]}):null]})]})}function z(e){return e.line?e.label&&e.label.trim().length>0?e.label:void 0:e.label&&e.label!==e.message&&!e.message.startsWith(e.label)?e.label:void 0}export{D as a,I as b,M as c,C as d,z as e};
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk.EFVSZKB5.js";import"./chunk.G3GFDVO2.js";import"./chunk.D4WJ7OM5.js";import"./chunk.QDVGHI7R.js";import"./chunk.AKJS2NUM.js";import"./chunk.M5FP4Y4Q.js";import"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{d as SAVE_DEBOUNCE_MS,i as accepts,a as createPressReader,f as createSaver,g as fillPrefills,h as judgePress,b as markPresses,k as prefillOf,c as quietPictures,e as saveDebounceOf,j as writesBack};
@@ -1 +1 @@
1
- import{a as O,b}from"./chunk.EQ4OODGO.js";import"./chunk.B6JRTW3A.js";import"./chunk.OTV5XTBB.js";import"./chunk.KBPJ7X7W.js";import"./chunk.OEIWIZCP.js";import"./chunk.U3HERHAI.js";import"./chunk.FBILPNGH.js";import{G as z,W as M,ea as S}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import{Bd as A}from"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as v}from"./chunk.AJZBJBMO.js";var o=v(z(),1);var t=v(M(),1);function G(i){for(let d of i)for(let[r,s]of Object.entries(d))if(s===!1)return`${r} == true`;return""}var w={margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function $({ask:i,close:d}){let{store:r,principal:s,subscriptions:h,app:f}=S(),c=(0,o.useRef)(null),p=(0,o.useId)(),[n,u]=(0,o.useState)(0),[l,y]=(0,o.useState)(!0),[m,P]=(0,o.useState)(()=>{let e=i.choices.find(g=>g.on==="reaches");if(!e)return"";let a=e.record!==void 0?r.graph.getNode(e.record):void 0;return G(a?[a]:r.graph.nodesOfKind(e.kind).slice(0,5))}),[x,C]=(0,o.useState)(null),[W,k]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=c.current;e&&!e.open&&e.showModal()},[]);let T=()=>{let e=i.returnTo;d(),requestAnimationFrame(()=>{e?.isConnected?e.focus():document.querySelector("[data-graview-page-title], main h1, [data-testid='inbox-button']")?.focus()})},N=e=>e.on==="reaches"?{...e,condition:m}:e,E=e=>b(r,{when:N(e),alsoMine:!l}),L=async()=>{let e=N(i.choices[n]),a=O(r,e);if(a){C(a);return}k(!0);try{await h.add({who:A(s),app:f?.name??"app",when:e,...l?{}:{alsoMine:!0}}),T()}catch(g){k(!1),C(g instanceof Error?g.message:String(g))}};return(0,t.jsx)("dialog",{ref:c,"aria-labelledby":p,"data-testid":"notify-sheet",onClose:T,onClick:e=>{e.target===e.currentTarget&&e.currentTarget.close()},style:{width:"min(92vw, 420px)",padding:0,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)"},children:(0,t.jsxs)("form",{method:"dialog",onSubmit:e=>{e.preventDefault(),L()},style:{display:"grid",gap:12,padding:18},children:[(0,t.jsx)("h2",{id:p,style:{margin:0,fontSize:"1.0625rem"},children:"Notify me"}),(0,t.jsxs)("fieldset",{style:{margin:0,padding:0,border:0,display:"grid",gap:6},children:[(0,t.jsx)("legend",{style:{...w,marginBottom:6},children:"Tell me"}),i.choices.map((e,a)=>(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"baseline",cursor:"pointer"},children:[(0,t.jsx)("input",{type:"radio",name:`${p}-when`,checked:n===a,onChange:()=>u(a),"data-notify-choice":e.on}),(0,t.jsx)("span",{children:e.on==="reaches"?`When ${e.record!==void 0?"it":"one"} reaches a condition`:E(e)})]},a))]}),i.choices[n]?.on==="reaches"?(0,t.jsxs)("label",{style:{display:"grid",gap:4},children:[(0,t.jsx)("span",{style:w,children:"The condition, in the app's own words (done == true, amount > 100)"}),(0,t.jsx)("input",{value:m,onChange:e=>P(e.target.value),"data-testid":"notify-condition",autoComplete:"off",spellCheck:!1})]}):null,(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{type:"checkbox",checked:l,onChange:e=>y(e.target.checked),"data-testid":"notify-others-only"}),"Only when someone else does it"]}),(0,t.jsxs)("p",{style:w,"data-testid":"notify-said",children:[E(i.choices[n]),"."]}),x?(0,t.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-danger, var(--graview-ink))"},children:x}):null,(0,t.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[(0,t.jsx)("button",{type:"button",onClick:()=>c.current?.close(),children:"Cancel"}),(0,t.jsx)("button",{type:"submit",autoFocus:!0,disabled:W,"data-testid":"notify-keep",style:{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"},children:"Notify me"})]})]})})}function j({style:i}){let{store:d,principal:r,subscriptions:s,app:h}=S(),f=(r.onBehalfOf??r).id,[c,p]=(0,o.useState)([]);return(0,o.useEffect)(()=>{if(f===void 0)return;let n=!0,u=()=>void Promise.resolve(s.list(f)).then(y=>n&&p(y.filter(m=>m.app===(h?.name??"app"))),()=>n&&p([]));u();let l=s.onChange?.(u);return()=>{n=!1,l?.()}},[s,f,h]),c.length===0?null:(0,t.jsxs)("section",{"aria-label":"What you are told of","data-testid":"notified",style:{display:"grid",gap:6,...i},children:[(0,t.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"You are told"}),(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:c.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"baseline",justifyContent:"space-between"},"data-subscription":n.id,children:[(0,t.jsx)("span",{style:{fontSize:"0.8125rem"},children:b(d,n)}),(0,t.jsx)("button",{type:"button","data-testid":"notify-stop","aria-label":`Stop: ${b(d,n)}`,onClick:u=>{let l=u.currentTarget.closest("li"),y=(l?.nextElementSibling??l?.previousElementSibling)?.querySelector("button");Promise.resolve(s.remove(n.id)).then(()=>(y??document.querySelector("[data-testid='inbox-button']"))?.focus())},style:{padding:"1px 8px",fontSize:"0.8125rem"},children:"Stop"})]},n.id))})]})}export{j as NotifiedList,$ as NotifySheet};
1
+ import{a as O,b}from"./chunk.MJY4SLWA.js";import"./chunk.4UUJHLHR.js";import"./chunk.SNHKYH72.js";import"./chunk.UGQYMN4J.js";import"./chunk.RG5G6YQD.js";import"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{G as z,W as M,ea as S}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{Bd as A}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as v}from"./chunk.AJZBJBMO.js";var o=v(z(),1);var t=v(M(),1);function G(i){for(let d of i)for(let[r,s]of Object.entries(d))if(s===!1)return`${r} == true`;return""}var w={margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function $({ask:i,close:d}){let{store:r,principal:s,subscriptions:h,app:f}=S(),c=(0,o.useRef)(null),p=(0,o.useId)(),[n,u]=(0,o.useState)(0),[l,y]=(0,o.useState)(!0),[m,P]=(0,o.useState)(()=>{let e=i.choices.find(g=>g.on==="reaches");if(!e)return"";let a=e.record!==void 0?r.graph.getNode(e.record):void 0;return G(a?[a]:r.graph.nodesOfKind(e.kind).slice(0,5))}),[x,C]=(0,o.useState)(null),[W,k]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=c.current;e&&!e.open&&e.showModal()},[]);let T=()=>{let e=i.returnTo;d(),requestAnimationFrame(()=>{e?.isConnected?e.focus():document.querySelector("[data-graview-page-title], main h1, [data-testid='inbox-button']")?.focus()})},N=e=>e.on==="reaches"?{...e,condition:m}:e,E=e=>b(r,{when:N(e),alsoMine:!l}),L=async()=>{let e=N(i.choices[n]),a=O(r,e);if(a){C(a);return}k(!0);try{await h.add({who:A(s),app:f?.name??"app",when:e,...l?{}:{alsoMine:!0}}),T()}catch(g){k(!1),C(g instanceof Error?g.message:String(g))}};return(0,t.jsx)("dialog",{ref:c,"aria-labelledby":p,"data-testid":"notify-sheet",onClose:T,onClick:e=>{e.target===e.currentTarget&&e.currentTarget.close()},style:{width:"min(92vw, 420px)",padding:0,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)"},children:(0,t.jsxs)("form",{method:"dialog",onSubmit:e=>{e.preventDefault(),L()},style:{display:"grid",gap:12,padding:18},children:[(0,t.jsx)("h2",{id:p,style:{margin:0,fontSize:"1.0625rem"},children:"Notify me"}),(0,t.jsxs)("fieldset",{style:{margin:0,padding:0,border:0,display:"grid",gap:6},children:[(0,t.jsx)("legend",{style:{...w,marginBottom:6},children:"Tell me"}),i.choices.map((e,a)=>(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"baseline",cursor:"pointer"},children:[(0,t.jsx)("input",{type:"radio",name:`${p}-when`,checked:n===a,onChange:()=>u(a),"data-notify-choice":e.on}),(0,t.jsx)("span",{children:e.on==="reaches"?`When ${e.record!==void 0?"it":"one"} reaches a condition`:E(e)})]},a))]}),i.choices[n]?.on==="reaches"?(0,t.jsxs)("label",{style:{display:"grid",gap:4},children:[(0,t.jsx)("span",{style:w,children:"The condition, in the app's own words (done == true, amount > 100)"}),(0,t.jsx)("input",{value:m,onChange:e=>P(e.target.value),"data-testid":"notify-condition",autoComplete:"off",spellCheck:!1})]}):null,(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{type:"checkbox",checked:l,onChange:e=>y(e.target.checked),"data-testid":"notify-others-only"}),"Only when someone else does it"]}),(0,t.jsxs)("p",{style:w,"data-testid":"notify-said",children:[E(i.choices[n]),"."]}),x?(0,t.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-danger, var(--graview-ink))"},children:x}):null,(0,t.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[(0,t.jsx)("button",{type:"button",onClick:()=>c.current?.close(),children:"Cancel"}),(0,t.jsx)("button",{type:"submit",autoFocus:!0,disabled:W,"data-testid":"notify-keep",style:{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"},children:"Notify me"})]})]})})}function j({style:i}){let{store:d,principal:r,subscriptions:s,app:h}=S(),f=(r.onBehalfOf??r).id,[c,p]=(0,o.useState)([]);return(0,o.useEffect)(()=>{if(f===void 0)return;let n=!0,u=()=>void Promise.resolve(s.list(f)).then(y=>n&&p(y.filter(m=>m.app===(h?.name??"app"))),()=>n&&p([]));u();let l=s.onChange?.(u);return()=>{n=!1,l?.()}},[s,f,h]),c.length===0?null:(0,t.jsxs)("section",{"aria-label":"What you are told of","data-testid":"notified",style:{display:"grid",gap:6,...i},children:[(0,t.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"You are told"}),(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:c.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"baseline",justifyContent:"space-between"},"data-subscription":n.id,children:[(0,t.jsx)("span",{style:{fontSize:"0.8125rem"},children:b(d,n)}),(0,t.jsx)("button",{type:"button","data-testid":"notify-stop","aria-label":`Stop: ${b(d,n)}`,onClick:u=>{let l=u.currentTarget.closest("li"),y=(l?.nextElementSibling??l?.previousElementSibling)?.querySelector("button");Promise.resolve(s.remove(n.id)).then(()=>(y??document.querySelector("[data-testid='inbox-button']"))?.focus())},style:{padding:"1px 8px",fontSize:"0.8125rem"},children:"Stop"})]},n.id))})]})}export{j as NotifiedList,$ as NotifySheet};
@@ -1 +1 @@
1
- import{E as v,F as C,G as S,M as G,q as O}from"./chunk.U3HERHAI.js";import{G as I,c as V,ea as m,j as y,l as p,m as g,n as u,o as D,v as B,z as E}from"./chunk.MODLZJD4.js";import{$d as R,Yd as P,Zd as k,ae as T,pa as M}from"./chunk.6HY6ZGEE.js";import{b as A}from"./chunk.AJZBJBMO.js";var W=A(I(),1);function j(e,t){try{t.length===0?localStorage.removeItem(v(e)):localStorage.setItem(v(e),JSON.stringify(t))}catch{}}function F(e,t){j(e,[...S(e).filter(n=>n.title!==t.title),t])}function H(e,t){j(e,S(e).filter(n=>n.title!==t))}function J(e,t){for(let n of e.places().filter(o=>o.title===t))e.forget?.(n.kind,n.as)}var U=e=>e===!0?{written:!0}:typeof e=="object"&&e!==null?{written:e.kept===!0,...e.said?{said:e.said}:{}}:{written:!1},N=e=>({title:e.title,lens:e.lens,on:e.on,...e.bindings?{bindings:e.bindings}:{},...e.options?{options:e.options}:{}});function Z(e,t){let n=o=>t.some(r=>r.title===o||r.as===P(o));if(!n(e))return e;for(let o=2;;o++)if(!n(`${e} ${o}`))return`${e} ${o}`}function ie(e){let{store:t,views:n,brand:o,seatTalk:r,onKeepLens:d}=m(),h=(0,W.useContext)(O),L=C(o,t.schema),b=async f=>{let{edit:i}=f;if(f.written&&d)try{await d({op:"remove-lens",title:i.title,on:i.on})}catch{}H(L,i.title),J(n,i.title),h?.dismiss(`kept:${i.title}`),r.setTurns(l=>[...l.map(s=>s.kept&&s.kept.edit.title===i.title&&!s.kept.taken?{...s,kept:{...s.kept,taken:!0}}:s),{role:"seat",text:`Took \u201C${i.title}\u201D back out of the places.`}]);let a=M(t.schema,i.on);e({to:"kind",kind:i.on,title:a,address:k(t.schema,i.on),said:`Went to ${a}.`})};return{keep:async f=>{let i=Z(f.edit.title,n.places()),a={...f.edit,title:i},l=!1,s;if(d)try{({written:l,said:s}=U(await d(a)))}catch{l=!1}l||F(L,N(a)),G(n,t.schema,[N(a)]);let K=n.places(),c=K.find(w=>w.title===i),x=s??(l?`Kept \u201C${i}\u201D as a lens: it is in the places now.`:d?`Kept \u201C${i}\u201D as your own lens. Ask the owner to keep it for everyone.`:`Kept \u201C${i}\u201D as your own lens.`),$={edit:a,written:l};r.setDraft(null),r.setTurns(w=>[...w,{role:"seat",text:x,kept:$}]),h?.notify({kind:"toast",id:`kept:${i}`,sentence:x,timeout:1e4,action:{label:"Take back",onSelect:()=>void b($)}}),c&&e({to:"picture",kind:c.kind,as:c.as,title:i,address:R(c.as,T(c,K)?k(t.schema,c.kind).slice(1):void 0),said:`Went to ${i}.`})},takeBack:b}}var q=A(I(),1);function _(e,t){switch(t.to){case"place":return{view:V("#")};case"picture":return{view:u(E(p(e,"filter",null),t.kind,t.as),[])};case"kind":{let n=D(g({...y(e,B(t.kind)),relation:null},!1),!0);return{view:u(p(p(n,"view",null),"filter",t.filter??null),[])}}case"record":return{view:u(y(g(p(p(e,"view",null),"filter",null),!1),t.id),[t.id])};case"problems":return{pane:"problems"}}}function z(e){let t=typeof document>"u"?null:document.querySelector('[data-testid="standing"]');t&&t.getAttribute("aria-expanded")==="true"!==e&&t.click()}function ae(){let{setView:e,seatTalk:t}=m();return(0,q.useCallback)(n=>{t.get().draft&&t.setDraft(null),z(n.to==="problems"),n.to!=="problems"&&e(o=>{let r=_(o,n);return"view"in r?r.view:o})},[e,t])}export{ie as a,z as b,ae as c};
1
+ import{E as v,F as C,G as S,M as G,q as O}from"./chunk.QNP5OR3P.js";import{G as I,c as V,ea as m,j as y,l as p,m as g,n as u,o as D,v as B,z as E}from"./chunk.A5PSEU3W.js";import{$d as R,Yd as P,Zd as k,ae as T,pa as M}from"./chunk.ZEZUKRC6.js";import{b as A}from"./chunk.AJZBJBMO.js";var W=A(I(),1);function j(e,t){try{t.length===0?localStorage.removeItem(v(e)):localStorage.setItem(v(e),JSON.stringify(t))}catch{}}function F(e,t){j(e,[...S(e).filter(n=>n.title!==t.title),t])}function H(e,t){j(e,S(e).filter(n=>n.title!==t))}function J(e,t){for(let n of e.places().filter(o=>o.title===t))e.forget?.(n.kind,n.as)}var U=e=>e===!0?{written:!0}:typeof e=="object"&&e!==null?{written:e.kept===!0,...e.said?{said:e.said}:{}}:{written:!1},N=e=>({title:e.title,lens:e.lens,on:e.on,...e.bindings?{bindings:e.bindings}:{},...e.options?{options:e.options}:{}});function Z(e,t){let n=o=>t.some(r=>r.title===o||r.as===P(o));if(!n(e))return e;for(let o=2;;o++)if(!n(`${e} ${o}`))return`${e} ${o}`}function ie(e){let{store:t,views:n,brand:o,seatTalk:r,onKeepLens:d}=m(),h=(0,W.useContext)(O),L=C(o,t.schema),b=async f=>{let{edit:i}=f;if(f.written&&d)try{await d({op:"remove-lens",title:i.title,on:i.on})}catch{}H(L,i.title),J(n,i.title),h?.dismiss(`kept:${i.title}`),r.setTurns(l=>[...l.map(s=>s.kept&&s.kept.edit.title===i.title&&!s.kept.taken?{...s,kept:{...s.kept,taken:!0}}:s),{role:"seat",text:`Took \u201C${i.title}\u201D back out of the places.`}]);let a=M(t.schema,i.on);e({to:"kind",kind:i.on,title:a,address:k(t.schema,i.on),said:`Went to ${a}.`})};return{keep:async f=>{let i=Z(f.edit.title,n.places()),a={...f.edit,title:i},l=!1,s;if(d)try{({written:l,said:s}=U(await d(a)))}catch{l=!1}l||F(L,N(a)),G(n,t.schema,[N(a)]);let K=n.places(),c=K.find(w=>w.title===i),x=s??(l?`Kept \u201C${i}\u201D as a lens: it is in the places now.`:d?`Kept \u201C${i}\u201D as your own lens. Ask the owner to keep it for everyone.`:`Kept \u201C${i}\u201D as your own lens.`),$={edit:a,written:l};r.setDraft(null),r.setTurns(w=>[...w,{role:"seat",text:x,kept:$}]),h?.notify({kind:"toast",id:`kept:${i}`,sentence:x,timeout:1e4,action:{label:"Take back",onSelect:()=>void b($)}}),c&&e({to:"picture",kind:c.kind,as:c.as,title:i,address:R(c.as,T(c,K)?k(t.schema,c.kind).slice(1):void 0),said:`Went to ${i}.`})},takeBack:b}}var q=A(I(),1);function _(e,t){switch(t.to){case"place":return{view:V("#")};case"picture":return{view:u(E(p(e,"filter",null),t.kind,t.as),[])};case"kind":{let n=D(g({...y(e,B(t.kind)),relation:null},!1),!0);return{view:u(p(p(n,"view",null),"filter",t.filter??null),[])}}case"record":return{view:u(y(g(p(p(e,"view",null),"filter",null),!1),t.id),[t.id])};case"problems":return{pane:"problems"}}}function z(e){let t=typeof document>"u"?null:document.querySelector('[data-testid="standing"]');t&&t.getAttribute("aria-expanded")==="true"!==e&&t.click()}function ae(){let{setView:e,seatTalk:t}=m();return(0,q.useCallback)(n=>{t.get().draft&&t.setDraft(null),z(n.to==="problems"),n.to!=="problems"&&e(o=>{let r=_(o,n);return"view"in r?r.view:o})},[e,t])}export{ie as a,z as b,ae as c};
@@ -1,4 +1,4 @@
1
- import"./chunk.U3HERHAI.js";import"./chunk.FBILPNGH.js";import{W as o,ea as n}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as t}from"./chunk.AJZBJBMO.js";var a=t(o(),1),d=[["waiting","Waiting"],["active","Under way: darker and taller"],["done","Done: flat and pale"],["flagged","A problem, or past its due date"],["recent","Changed since you were last here"],["own","Yours"]],g=i=>{let e=r=>`color-mix(in oklab,var(--graview-ink) ${r}%,var(--graview-panel))`;return`.graview-map-key{display:grid;gap:4px;padding:2px 4px 8px;margin-bottom:6px;border-bottom:1px solid var(--graview-edge);font-size:.8125rem;color:var(--graview-ink-muted)}
1
+ import"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{W as o,ea as n}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as t}from"./chunk.AJZBJBMO.js";var a=t(o(),1),d=[["waiting","Waiting"],["active","Under way: darker and taller"],["done","Done: flat and pale"],["flagged","A problem, or past its due date"],["recent","Changed since you were last here"],["own","Yours"]],g=i=>{let e=r=>`color-mix(in oklab,var(--graview-ink) ${r}%,var(--graview-panel))`;return`.graview-map-key{display:grid;gap:4px;padding:2px 4px 8px;margin-bottom:6px;border-bottom:1px solid var(--graview-edge);font-size:.8125rem;color:var(--graview-ink-muted)}
2
2
  .graview-map-key>div{display:flex;align-items:center;gap:8px}
3
3
  .graview-map-key>div:first-child{color:var(--graview-ink)}
4
4
  .graview-map-key i{flex:none;width:14px;height:10px;border-radius:2px;background:${e(i?34:42)}}
@@ -1 +1 @@
1
- import{K as $}from"./chunk.U3HERHAI.js";import{G as L,Ra as U,a as I,b as R,c as E,d as f,e as k,j as W,m as F,v as j}from"./chunk.MODLZJD4.js";import{oe as s,ve as b,we as r}from"./chunk.6HY6ZGEE.js";import{b as H}from"./chunk.AJZBJBMO.js";var u=H(L(),1),_=e=>typeof e=="object"&&e!==null&&"idx"in e;function S(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":_(window.history.state)?"pages":null}function K(e){let n=e.face??(e.stop&&E(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:S(e.basePath)??n}function Q(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&S(e.basePath)===null}function X(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?R(f(window.location.hash)):void 0}function Z({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:N,places:w,opens:B,landed:V}){let{view:O,go:p}=U(),g=(0,u.useRef)({shown:t,view:O,onFace:i,landed:V});g.current={shown:t,view:O,onFace:i,landed:V};let m=(0,u.useRef)(n??"/"),P=()=>{m.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:h,onFace:A}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",b(c??m.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){P();let y=a===void 0?h:M(E(a),w),v=q(y)?z(B):y,T=v!==y&&v.overview?"graview":o,x=Y(T,v,N);p(x),window.history.pushState(null,"",`${b(s,{basePath:e})}${k(x)}`),A?.(T);return}A?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=S(e)??"pages",{shown:a,onFace:d,landed:h}=g.current;if(c==="pages"){P(),h?.(m.current),a!=="pages"&&d?.("pages");return}a==="pages"&&(p(M(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function M(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:j(i.kind)}:e}function Y(e,n,t){return e==="graview"?F(n,!0):n.overview?W(F(n,!1),$(n,t)):n}function q(e){return e.focusId===null&&e.overview!==!0}function z(e){return e??{...I,overview:!0}}export{K as a,Q as b,X as c,Z as d,M as e,Y as f,q as g,z as h};
1
+ import{K as $}from"./chunk.QNP5OR3P.js";import{G as L,Ra as U,a as I,b as R,c as E,d as f,e as k,j as W,m as F,v as j}from"./chunk.A5PSEU3W.js";import{oe as s,ve as b,we as r}from"./chunk.ZEZUKRC6.js";import{b as H}from"./chunk.AJZBJBMO.js";var u=H(L(),1),_=e=>typeof e=="object"&&e!==null&&"idx"in e;function S(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":_(window.history.state)?"pages":null}function K(e){let n=e.face??(e.stop&&E(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:S(e.basePath)??n}function Q(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&S(e.basePath)===null}function X(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?R(f(window.location.hash)):void 0}function Z({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:N,places:w,opens:B,landed:V}){let{view:O,go:p}=U(),g=(0,u.useRef)({shown:t,view:O,onFace:i,landed:V});g.current={shown:t,view:O,onFace:i,landed:V};let m=(0,u.useRef)(n??"/"),P=()=>{m.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:h,onFace:A}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",b(c??m.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){P();let y=a===void 0?h:M(E(a),w),v=q(y)?z(B):y,T=v!==y&&v.overview?"graview":o,x=Y(T,v,N);p(x),window.history.pushState(null,"",`${b(s,{basePath:e})}${k(x)}`),A?.(T);return}A?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=S(e)??"pages",{shown:a,onFace:d,landed:h}=g.current;if(c==="pages"){P(),h?.(m.current),a!=="pages"&&d?.("pages");return}a==="pages"&&(p(M(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function M(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:j(i.kind)}:e}function Y(e,n,t){return e==="graview"?F(n,!0):n.overview?W(F(n,!1),$(n,t)):n}function q(e){return e.focusId===null&&e.overview!==!0}function z(e){return e??{...I,overview:!0}}export{K as a,Q as b,X as c,Z as d,M as e,Y as f,q as g,z as h};
@@ -1,2 +1,2 @@
1
- import{g as F,l as b}from"./chunk.OEIWIZCP.js";function L(t,o){return o===1&&["every","some","sum","min","max","sort"].includes(t.fn)}function M(t){let o=new Set,e=new Set,r=[],s=[],a=new Set(F),i=(l,f)=>{switch(l.t){case"lit":return;case"ident":f||o.add(l.name);return;case"list":l.items.forEach(c=>i(c,f));return;case"member":i(l.object,f);return;case"unary":i(l.operand,f);return;case"binary":i(l.left,f),i(l.right,f);return;case"where":i(l.set,f),i(l.filter,!0);return;case"call":{e.add(l.fn);let c=(l.fn==="out"||l.fn==="in")&&l.args.length===2?l.args[1]:l.args[0],g=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&g&&r.push(g),(l.fn==="out"||l.fn==="in")&&g&&s.push(g),l.args.forEach((v,k)=>i(v,f||L(l,k)));return}}};return i(t,!1),{names:o,functions:e,unknownFunctions:[...e].filter(l=>!a.has(l)),sweeps:r,edges:s}}var p=class extends Error{constructor(e,r,s){super(`${e} (at character ${r+1} of "${s}")`);this.sentence=e;this.at=r;this.source=s}},D=["||","&&","==","!=","<=",">=","<",">","!","|","&","+","-","*","/","%","(",")","[","]",",","."],j={and:"&&",or:"||",not:"!"},T=2e3;function H(t){let o=[],e=0;for(;e<t.length;){let r=t[e];if(r===" "||r===" "||r===`
1
+ import{g as F,l as b}from"./chunk.RG5G6YQD.js";function L(t,o){return o===1&&["every","some","sum","min","max","sort"].includes(t.fn)}function M(t){let o=new Set,e=new Set,r=[],s=[],a=new Set(F),i=(l,f)=>{switch(l.t){case"lit":return;case"ident":f||o.add(l.name);return;case"list":l.items.forEach(c=>i(c,f));return;case"member":i(l.object,f);return;case"unary":i(l.operand,f);return;case"binary":i(l.left,f),i(l.right,f);return;case"where":i(l.set,f),i(l.filter,!0);return;case"call":{e.add(l.fn);let c=(l.fn==="out"||l.fn==="in")&&l.args.length===2?l.args[1]:l.args[0],g=c?.t==="lit"&&typeof c.value=="string"?c.value:void 0;l.fn==="all"&&g&&r.push(g),(l.fn==="out"||l.fn==="in")&&g&&s.push(g),l.args.forEach((v,k)=>i(v,f||L(l,k)));return}}};return i(t,!1),{names:o,functions:e,unknownFunctions:[...e].filter(l=>!a.has(l)),sweeps:r,edges:s}}var p=class extends Error{constructor(e,r,s){super(`${e} (at character ${r+1} of "${s}")`);this.sentence=e;this.at=r;this.source=s}},D=["||","&&","==","!=","<=",">=","<",">","!","|","&","+","-","*","/","%","(",")","[","]",",","."],j={and:"&&",or:"||",not:"!"},T=2e3;function H(t){let o=[],e=0;for(;e<t.length;){let r=t[e];if(r===" "||r===" "||r===`
2
2
  `||r==="\r"){e++;continue}if(r>="0"&&r<="9"){let a=e;for(;e<t.length&&/[0-9.]/.test(t[e]);)e++;let i=t.slice(a,e),l=Number(i);if(!Number.isFinite(l)||i.split(".").length>2)throw new p(`"${i}" is not a number`,a,t);o.push({k:"num",v:l,at:a});continue}if(r==="'"||r==='"'){let a=e++,i="";for(;e<t.length&&t[e]!==r;)t[e]==="\\"&&e+1<t.length&&e++,i+=t[e++];if(e>=t.length)throw new p("a quoted word is never closed",a,t);e++,o.push({k:"str",v:i,at:a});continue}if(/[A-Za-z_]/.test(r)){let a=e;for(;e<t.length&&/[A-Za-z0-9_]/.test(t[e]);)e++;let i=t.slice(a,e),l=Object.hasOwn(j,i)?j[i]:void 0;o.push(l?{k:"op",v:l,at:a}:{k:"id",v:i,at:a});continue}let s=D.find(a=>t.startsWith(a,e));if(!s)throw new p(`"${r}" is not part of the rule language`,e,t);o.push({k:"op",v:s,at:e}),e+=s.length}return o.push({k:"end",at:t.length}),o}function w(t){if(t.length>T)throw new p(`an expression may be at most ${T} characters`,0,t.slice(0,40));let o=H(t),e=0,r=()=>o[e],s=n=>{let d=r();return d.k==="op"&&d.v===n},a=n=>{let d=r();return d.k==="id"&&d.v===n},i=(n,d)=>{if(!s(n))throw new p(`expected ${d}`,r().at,t);e++},l=0,f=(n,d)=>{if(++l>64)throw new p("the expression nests too deeply",n,t);try{return d()}finally{l--}},c=(n,d)=>()=>{let m=d();for(;;){let y=r(),S=y.k==="op"?n.find(q=>q===y.v):y.k==="id"&&y.v==="in"&&n.includes("in")?"in":void 0;if(!S)return m;e++,m={t:"binary",op:S,left:m,right:d(),at:y.at}}},g=()=>{let n=r();if(n.k==="num")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="str")return e++,{t:"lit",value:n.v,at:n.at};if(n.k==="id"){if(e++,n.v==="true"||n.v==="false")return{t:"lit",value:n.v==="true",at:n.at};if(n.v==="null")return{t:"lit",value:null,at:n.at};if(s("(")){e++;let d=[];if(!s(")"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i(")",`")" to close ${n.v}(\u2026)`),{t:"call",fn:n.v,args:d,at:n.at}}return{t:"ident",name:n.v,at:n.at}}if(n.k==="op"&&n.v==="("){e++;let d=f(n.at,h);return i(")",'a ")"'),d}if(n.k==="op"&&n.v==="["){e++;let d=[];if(!s("]"))for(;;){if(d.push(h()),s(",")){e++;continue}break}return i("]",'a "]" to close the list'),{t:"list",items:d,at:n.at}}throw n.k==="end"?new p("the expression ends too soon",n.at,t):new p(`"${n.k==="op"?n.v:""}" cannot start a value here`,n.at,t)},v=()=>{let n=g();for(;;){if(s(".")){let d=r();e++;let m=r();if(m.k!=="id")throw new p('expected a field name after "."',m.at,t);e++,n={t:"member",object:n,name:m.v,at:d.at};continue}if(a("where")){let d=r().at;e++,n={t:"where",set:n,filter:f(d,h),at:d};continue}return n}},k=()=>{let n=r();return n.k==="op"&&(n.v==="!"||n.v==="-")?(e++,{t:"unary",op:n.v,operand:f(n.at,k),at:n.at}):v()},P=c(["*","/","%"],k),z=c(["+","-"],P),N=c(["&"],z),R=c(["|"],N),_=()=>{let n=R(),d=r(),m=d.k==="op"&&["==","!=","<","<=",">",">="].includes(d.v)?d.v:d.k==="id"&&d.v==="in"?"in":void 0;return m?(e++,{t:"binary",op:m,left:n,right:R(),at:d.at}):n},O=()=>{let n=r();return n.k==="op"&&n.v==="!"?(e++,{t:"unary",op:"!",operand:f(n.at,O),at:n.at}):_()},B=c(["&&"],O),I=c(["||"],B);function h(){return I()}let K=h();if(r().k!=="end")throw new p("there is more after the end of the expression",r().at,t);return K}function E(t){let o,e=-1,r=0;for(let s=0;s<t.length;s++){let a=t[s];if(o){a==="\\"?s++:a===o&&(o=void 0);continue}a==="'"||a==='"'?o=a:a==="("||a==="["?r++:a===")"||a==="]"?r--:a==="|"&&r===0&&(t[s+1]==="|"?s++:e=s)}if(e>0&&t.slice(e+1).trim()===x){let s=E(t.slice(0,e));if(s>=0)return s}return e}var x="capital",$=/\s*(?:'((?:[^'\\]|\\.)*)'|"((?:[^"\\]|\\.)*)")\s*(,|$)/y;function U(t){let o=E(t);if(o>=0){if(t.slice(o+1).trim()!==x)throw new u('only "capital" may follow another formatter, like {n | words | capital}');let e=t.slice(0,o);if(e.trim()===x)throw new u('"capital" is said once');return{...C(e),capital:!0}}return t.trim()===x?{args:[],capital:!0}:C(t)}function C(t){let o=t.indexOf(":"),e=(o>=0?t.slice(0,o):t).trim();if(!b.includes(e))throw new u(`"${e}" is not a formatter; use one of ${[...b,x].join(", ")}`);let r=[];if(o>=0&&e==="excerpt"){let s=t.slice(o+1).trim();if(!/^\d+$/.test(s)||Number(s)<20||Number(s)>1e3)throw new u("excerpt is told at most how many characters, 20 to 1000: {summary | excerpt: 80}");r.push(s)}else if(o>=0&&e==="money"){if(t.slice(o+1).trim()!=="0")throw new u("money is told 0 for whole units, rounded \u2014 {total | money: 0} \u2014 or nothing, for cents only where a sum has them");r.push("0")}else if(o>=0){let s=t.slice(o+1),a=0;for(;a<s.length;){$.lastIndex=a;let i=$.exec(s);if(!i)throw new u(`"${e}" is told quoted words, like ${e}: 'offer'`);if(r.push((i[1]??i[2]??"").replace(/\\(.)/g,"$1")),a=$.lastIndex,i[3]==="")break}}if(e==="plural"&&(r.length<1||r.length>2))throw new u("plural is told its noun, like {count | plural: 'offer'}, and its plural where English does not make it: plural: 'person', 'people'");if(e!=="plural"&&e!=="excerpt"&&e!=="money"&&r.length>0)throw new u(`"${e}" takes nothing after it`);return{format:e,args:r}}var u=class extends Error{constructor(e){super(e);this.sentence=e}};function Y(t){let o=[],e=0;for(;e<t.length;){let r=t.indexOf("{",e);if(r<0){o.push({text:t.slice(e)});break}r>e&&o.push({text:t.slice(e,r)});let s=t.indexOf("}",r);if(s<0)throw new u(`a "{" at character ${r+1} is never closed`);let a=t.slice(r+1,s),i=E(a),l=(i>=0?a.slice(0,i):a).trim(),f=i>=0?U(a.slice(i+1)):void 0,c=E(l);if(c>=0&&b.includes(l.slice(c+1).split(":")[0].trim()))throw new u('only "capital" may follow another formatter, like {n | words | capital}');o.push({expr:w(l),source:l,...f?.format?{format:f.format}:{},...f&&f.args.length>0?{formatArgs:f.args}:{},...f?.capital?{capital:!0}:{}}),e=s+1}return o}function A(t){let o=new Map;for(let[e,r]of Object.entries(t?.computed??{}))o.set(e,typeof r=="string"?{expr:r}:r);return o}function re(t){let o=A(t);if(o.size===0)return;let e=new Map;for(let[r,s]of o)try{e.set(r,w(s.expr))}catch(a){if(!(a instanceof p))throw a}return e}function Z(t,o,e=new Set){let r=A(t).get(o);if(!r||e.has(o))return!1;let s;try{s=w(r.expr)}catch{return!1}let a=M(s);if(a.edges.length>0||a.sweeps.length>0||[...a.functions].some(c=>c==="out"||c==="in"||c==="all"))return!1;let i=t.fields,l=c=>i instanceof Set?i.has(c):Object.hasOwn(i,c),f=new Set([...e,o]);return[...a.names].every(c=>l(c)||Z(t,c,f))}export{M as a,p as b,w as c,u as d,Y as e,A as f,re as g,Z as h};
@@ -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{F as g,G as T,La as C,W as v,fa as S}from"./chunk.MODLZJD4.js";import{a as m}from"./chunk.SDO3U72B.js";import"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as c}from"./chunk.AJZBJBMO.js";var n=c(T(),1),r=c(v(),1),s=null,u=null,f=new Set,a=()=>{for(let e of f)e()},y=e=>(f.add(e),()=>void f.delete(e)),E=300,d=()=>{u!==null&&clearTimeout(u),u=null};function q(e,t){d(),x.prefetch(),!(s?.element===t&&s.target.on===e.on)&&(s={target:e,element:t},a())}function M(e=!1){if(d(),s!==null){if(e){s=null,a();return}u=setTimeout(()=>{u=null,s=null,a()},E)}}var R=()=>d(),P=()=>s,b="graview:hover-chips",h;function A(e){if(h!==void 0)return h;try{return(e??localStorage).getItem(b)!=="off"}catch{return!0}}function I(e,t){h=e;try{(t??localStorage).setItem(b,e?"on":"off")}catch{}e||(s=null),a()}function w(){let e=S(),t=g(e?.ai),o=e?.memory,l=(0,n.useSyncExternalStore)(y,()=>A(o),()=>!1),i=(0,n.useCallback)(H=>I(H,o),[o]);return{offered:t,on:t&&l,set:i}}function z({legend:e,style:t,choice:o}){let l=w();return l.offered?(0,r.jsxs)("fieldset",{"data-testid":"setting-hover-chips",style:{border:0,margin:0,padding:0,display:"grid",gap:5,...t},children:[(0,r.jsx)("legend",{style:{...e,padding:0},children:"AI suggestions on hover"}),(0,r.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:"A quiet suggestion beside a record the pointer rests on, when the AI is sure of one."}),(0,r.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[!0,!1].map(i=>(0,r.jsx)("button",{type:"button","aria-pressed":l.on===i,"data-testid":`setting-hover-chips-${i?"on":"off"}`,onClick:()=>l.set(i),style:o(l.on===i),children:i?"On":"Off"},String(i)))})]}):null}var x=C(m(()=>(__graviewPreload(import.meta.url,["./chunk.MWGZKZD6.js","./chunk.QFHWG4LN.js","./chunk.YIPXZUTT.js","./chunk.BJUUSIQY.js","./chunk.EMFOMSMI.js","./chunk.PSQYDCVM.js","./chunk.QOS5T46W.js","./chunk.PPSYUOH7.js","./chunk.XOZU4OFA.js","./chunk.GME63ZHI.js","./chunk.NJRLJEJY.js","./chunk.WSDJPXJD.js","./chunk.F4VB6Q2W.js","./chunk.FFOD5B4B.js","./chunk.Z7Y3R3YR.js","./chunk.YXEO3Y65.js","./chunk.U3HERHAI.js","./chunk.FBILPNGH.js","./chunk.MODLZJD4.js","./chunk.SDO3U72B.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.INHS3KTK.js")))),k=x.part((e,t)=>{let o=e.HoverChip;return(0,r.jsx)(o,{...t})},{quiet:!0}),p=null,O=()=>p;function L(){let{on:e}=w(),t=(0,n.useSyncExternalStore)(y,P,()=>null),[o]=(0,n.useState)(()=>Symbol("hover-chip")),l=(0,n.useSyncExternalStore)(y,O,()=>null);return(0,n.useEffect)(()=>{if(e)return p===null&&(p=o,a()),()=>{p===o&&(p=null,s=null,d(),a())}},[e,o,l]),!e||t===null||l!==o||!t.element.isConnected?null:(0,r.jsx)(n.Suspense,{fallback:null,children:(0,r.jsx)(k,{rest:t,hold:R,leave:M})})}export{L as HoverChipDoor,z as HoverChipsSwitch,R as holdRest,A as hoverChipsWanted,M as leaveRest,q as restOn,I as setHoverChipsWanted,w as useHoverChipsSetting};
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{F as g,G as T,La as C,W as v,fa as S}from"./chunk.A5PSEU3W.js";import{a as m}from"./chunk.SDO3U72B.js";import"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as c}from"./chunk.AJZBJBMO.js";var n=c(T(),1),r=c(v(),1),s=null,u=null,f=new Set,a=()=>{for(let e of f)e()},y=e=>(f.add(e),()=>void f.delete(e)),E=300,d=()=>{u!==null&&clearTimeout(u),u=null};function q(e,t){d(),x.prefetch(),!(s?.element===t&&s.target.on===e.on)&&(s={target:e,element:t},a())}function M(e=!1){if(d(),s!==null){if(e){s=null,a();return}u=setTimeout(()=>{u=null,s=null,a()},E)}}var R=()=>d(),P=()=>s,b="graview:hover-chips",h;function A(e){if(h!==void 0)return h;try{return(e??localStorage).getItem(b)!=="off"}catch{return!0}}function I(e,t){h=e;try{(t??localStorage).setItem(b,e?"on":"off")}catch{}e||(s=null),a()}function w(){let e=S(),t=g(e?.ai),o=e?.memory,l=(0,n.useSyncExternalStore)(y,()=>A(o),()=>!1),i=(0,n.useCallback)(H=>I(H,o),[o]);return{offered:t,on:t&&l,set:i}}function z({legend:e,style:t,choice:o}){let l=w();return l.offered?(0,r.jsxs)("fieldset",{"data-testid":"setting-hover-chips",style:{border:0,margin:0,padding:0,display:"grid",gap:5,...t},children:[(0,r.jsx)("legend",{style:{...e,padding:0},children:"AI suggestions on hover"}),(0,r.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:"A quiet suggestion beside a record the pointer rests on, when the AI is sure of one."}),(0,r.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[!0,!1].map(i=>(0,r.jsx)("button",{type:"button","aria-pressed":l.on===i,"data-testid":`setting-hover-chips-${i?"on":"off"}`,onClick:()=>l.set(i),style:o(l.on===i),children:i?"On":"Off"},String(i)))})]}):null}var x=C(m(()=>(__graviewPreload(import.meta.url,["./chunk.SFBHPYRD.js","./chunk.ILJDLBPJ.js","./chunk.X226YATK.js","./chunk.BJUUSIQY.js","./chunk.MSAYU25L.js","./chunk.QF5QB5YR.js","./chunk.EGPCVMDU.js","./chunk.M7KXQGQL.js","./chunk.XOZU4OFA.js","./chunk.H3EGBDW2.js","./chunk.6KJGRM7A.js","./chunk.SO6NT5K7.js","./chunk.MUSMNKE4.js","./chunk.SJQPTDAT.js","./chunk.JQ63N4MZ.js","./chunk.Z3O2VZAJ.js","./chunk.QNP5OR3P.js","./chunk.4W57E7AX.js","./chunk.A5PSEU3W.js","./chunk.SDO3U72B.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.JVB5KDSG.js")))),k=x.part((e,t)=>{let o=e.HoverChip;return(0,r.jsx)(o,{...t})},{quiet:!0}),p=null,O=()=>p;function L(){let{on:e}=w(),t=(0,n.useSyncExternalStore)(y,P,()=>null),[o]=(0,n.useState)(()=>Symbol("hover-chip")),l=(0,n.useSyncExternalStore)(y,O,()=>null);return(0,n.useEffect)(()=>{if(e)return p===null&&(p=o,a()),()=>{p===o&&(p=null,s=null,d(),a())}},[e,o,l]),!e||t===null||l!==o||!t.element.isConnected?null:(0,r.jsx)(n.Suspense,{fallback:null,children:(0,r.jsx)(k,{rest:t,hold:R,leave:M})})}export{L as HoverChipDoor,z as HoverChipsSwitch,R as holdRest,A as hoverChipsWanted,M as leaveRest,q as restOn,I as setHoverChipsWanted,w as useHoverChipsSetting};
@@ -1 +1 @@
1
- import{fc as w,sc as S}from"./chunk.6HY6ZGEE.js";function v(s){return[...s.mutations??[],...S(s.schema,s.mutations??[])]}function B(s){let i=[...s.schema.kinds],a=v(s),d=new Map,c=new Map;for(let e of a){c.set(e.name,e.creates??[]);let n=w(e.input).filter(t=>!t.optional&&!t.kinds.includes("*")).flatMap(t=>t.kinds);d.set(e.name,[...new Set(n)])}let g=new Map;for(let e of i)g.set(e,[]);for(let e of a)for(let n of c.get(e.name)??[])g.get(n)?.push(e.name);let p=new Map,l=new Set;for(let e=0;;e+=1){let n=[];for(let t of a)if((d.get(t.name)??[]).every(o=>l.has(o)))for(let o of c.get(t.name)??[])l.has(o)||n.push(o);if(n.length===0)break;for(let t of n)l.add(t),p.set(t,e)}let h=e=>{let n=g.get(e)??[];if(n.length===0)return[];let t=n.map(r=>d.get(r)??[]).sort((r,o)=>r.length-o.length)[0];return[...new Set(t)].filter(r=>r!==e)},y=new Map,u=e=>{let n=y.get(e);if(n)return n;let t=new Set;y.set(e,t);for(let r of h(e)){t.add(r);for(let o of u(r))t.add(o)}return t.delete(e),t},f=new Map(i.map(e=>[e,0]));for(let e of i)for(let n of u(e))f.set(n,(f.get(n)??0)+1);let m=i.map(e=>({kind:e,madeBy:[...g.get(e)??[]].sort(),needs:[...h(e)].sort(),depth:p.get(e)??null})).sort((e,n)=>(e.depth??Number.MAX_SAFE_INTEGER)-(n.depth??Number.MAX_SAFE_INTEGER)||(f.get(n.kind)??0)-(f.get(e.kind)??0)||e.kind.localeCompare(n.kind)),k=m.filter(e=>e.depth===0).map(e=>e.kind),A=[...new Set(a.filter(e=>(d.get(e.name)??[]).length===0).filter(e=>(c.get(e.name)??[]).length>0).map(e=>e.name))].sort(),M=m.filter(e=>e.depth===null).map(e=>({kind:e.kind,why:e.madeBy.length===0?"no act declares that it creates this kind":`every act that makes it needs ${e.needs.map(n=>`"${n}"`).join(", ")}, which nothing can make first`}));return{order:m,roots:k,doors:A,unreachable:M}}export{B as a};
1
+ import{fc as w,sc as S}from"./chunk.ZEZUKRC6.js";function v(s){return[...s.mutations??[],...S(s.schema,s.mutations??[])]}function B(s){let i=[...s.schema.kinds],a=v(s),d=new Map,c=new Map;for(let e of a){c.set(e.name,e.creates??[]);let n=w(e.input).filter(t=>!t.optional&&!t.kinds.includes("*")).flatMap(t=>t.kinds);d.set(e.name,[...new Set(n)])}let g=new Map;for(let e of i)g.set(e,[]);for(let e of a)for(let n of c.get(e.name)??[])g.get(n)?.push(e.name);let p=new Map,l=new Set;for(let e=0;;e+=1){let n=[];for(let t of a)if((d.get(t.name)??[]).every(o=>l.has(o)))for(let o of c.get(t.name)??[])l.has(o)||n.push(o);if(n.length===0)break;for(let t of n)l.add(t),p.set(t,e)}let h=e=>{let n=g.get(e)??[];if(n.length===0)return[];let t=n.map(r=>d.get(r)??[]).sort((r,o)=>r.length-o.length)[0];return[...new Set(t)].filter(r=>r!==e)},y=new Map,u=e=>{let n=y.get(e);if(n)return n;let t=new Set;y.set(e,t);for(let r of h(e)){t.add(r);for(let o of u(r))t.add(o)}return t.delete(e),t},f=new Map(i.map(e=>[e,0]));for(let e of i)for(let n of u(e))f.set(n,(f.get(n)??0)+1);let m=i.map(e=>({kind:e,madeBy:[...g.get(e)??[]].sort(),needs:[...h(e)].sort(),depth:p.get(e)??null})).sort((e,n)=>(e.depth??Number.MAX_SAFE_INTEGER)-(n.depth??Number.MAX_SAFE_INTEGER)||(f.get(n.kind)??0)-(f.get(e.kind)??0)||e.kind.localeCompare(n.kind)),k=m.filter(e=>e.depth===0).map(e=>e.kind),A=[...new Set(a.filter(e=>(d.get(e.name)??[]).length===0).filter(e=>(c.get(e.name)??[]).length>0).map(e=>e.name))].sort(),M=m.filter(e=>e.depth===null).map(e=>({kind:e.kind,why:e.madeBy.length===0?"no act declares that it creates this kind":`every act that makes it needs ${e.needs.map(n=>`"${n}"`).join(", ")}, which nothing can make first`}));return{order:m,roots:k,doors:A,unreachable:M}}export{B as a};
@@ -1,4 +1,4 @@
1
- import"./chunk.U3HERHAI.js";import"./chunk.FBILPNGH.js";import{W as T}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as A}from"./chunk.AJZBJBMO.js";var F=/^ {0,3}(`{3,}|~{3,})[ \t]*([^`\s]*)/,D=/^ {0,3}(#{1,6})(?:[ \t]+|$)/,R=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,v=/^ {0,3}>[ \t]?/,_=/^([ \t]*)([-*+]|(\d{1,9})[.)])(?:[ \t]+|$)/,K=/^\|?\s*:?-+:?\s*(?:\|\s*:?-+:?\s*)+\|?$|^\|\s*:?-+:?\s*\|$/,w=/^[ \t]*$/;function O(t){let n=F.exec(t);if(!(!n||n[1][0]==="`"&&t.indexOf("`",n[0].length)>=0))return{mark:n[1],lang:n[2]}}function U(t,n){let r=t.trim().slice(n).trim(),e=r.length;for(;e>0&&r[e-1]==="#";)e--;return(e===0||r[e-1]===" "||r[e-1]===" ")&&(r=r.slice(0,e).trim()),r}var $=t=>O(t)!==void 0||D.test(t)||R.test(t)||v.test(t)||_.test(t),b=t=>[...t].reduce((n,r)=>r===" "?n+4-n%4:n+1,0);function E(t){let n=t.trim().replace(/^\|/,"").replace(/(?<!\\)\|$/,""),r=[],e="",l=!1;for(let c=0;c<n.length;c++){let h=n[c];h==="\\"&&n[c+1]==="|"?(e+="|",c++):h==="`"?(l=!l,e+=h):h==="|"&&!l?(r.push(e.trim()),e=""):e+=h}return r.push(e.trim()),r}function W(t){return B(t.replace(/\r\n?/g,`
1
+ import"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{W as T}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as A}from"./chunk.AJZBJBMO.js";var F=/^ {0,3}(`{3,}|~{3,})[ \t]*([^`\s]*)/,D=/^ {0,3}(#{1,6})(?:[ \t]+|$)/,R=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,v=/^ {0,3}>[ \t]?/,_=/^([ \t]*)([-*+]|(\d{1,9})[.)])(?:[ \t]+|$)/,K=/^\|?\s*:?-+:?\s*(?:\|\s*:?-+:?\s*)+\|?$|^\|\s*:?-+:?\s*\|$/,w=/^[ \t]*$/;function O(t){let n=F.exec(t);if(!(!n||n[1][0]==="`"&&t.indexOf("`",n[0].length)>=0))return{mark:n[1],lang:n[2]}}function U(t,n){let r=t.trim().slice(n).trim(),e=r.length;for(;e>0&&r[e-1]==="#";)e--;return(e===0||r[e-1]===" "||r[e-1]===" ")&&(r=r.slice(0,e).trim()),r}var $=t=>O(t)!==void 0||D.test(t)||R.test(t)||v.test(t)||_.test(t),b=t=>[...t].reduce((n,r)=>r===" "?n+4-n%4:n+1,0);function E(t){let n=t.trim().replace(/^\|/,"").replace(/(?<!\\)\|$/,""),r=[],e="",l=!1;for(let c=0;c<n.length;c++){let h=n[c];h==="\\"&&n[c+1]==="|"?(e+="|",c++):h==="`"?(l=!l,e+=h):h==="|"&&!l?(r.push(e.trim()),e=""):e+=h}return r.push(e.trim()),r}function W(t){return B(t.replace(/\r\n?/g,`
2
2
  `).replace(/\0/g,"\uFFFD").split(`
3
3
  `),0)}function B(t,n){let r=[],e=0;for(;e<t.length;){let l=t[e];if(w.test(l)){e++;continue}let c=O(l);if(c){let o=new RegExp(`^ {0,3}${c.mark[0]==="`"?"`":"~"}{${c.mark.length},}[ \\t]*$`),a=[];for(e++;e<t.length&&!o.test(t[e]);)a.push(t[e++]);e++,r.push({t:"code",text:a.join(`
4
4
  `),...c.lang?{lang:c.lang}:{}});continue}let h=D.exec(l);if(h){r.push({t:"heading",level:h[1].length,children:k(U(l,h[1].length),0)}),e++;continue}if(R.test(l)){r.push({t:"rule"}),e++;continue}if(v.test(l)){let o=[];for(;e<t.length&&(v.test(t[e])||o.length>0&&!w.test(t[e])&&!$(t[e])&&!w.test(o[o.length-1]));)o.push(t[e++].replace(v,""));r.push(n<8?{t:"quote",blocks:B(o,n+1)}:{t:"p",children:k(o.join(`
@@ -1 +1 @@
1
- import{b as Z}from"./chunk.JO2X52D4.js";import{a as K,b as J,d as X,e as Y,f as H,g as D,h as Q,i as W}from"./chunk.M5FP4Y4Q.js";import{Oc as z,Pc as G,Qc as j}from"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var le={r:255,g:255,b:255,a:1},ue={r:18,g:18,b:18,a:1},M=t=>t.parentElement??t.getRootNode().host??null,C;function B(t,i){if(t==="transparent")return{r:0,g:0,b:0,a:0};let[a]=z(t);if(a)return a;if(C===void 0&&(C=i.createElement("canvas").getContext("2d",{willReadFrequently:!0})),!C)return;C.clearRect(0,0,1,1),C.fillStyle="#000",C.fillStyle=t,C.fillRect(0,0,1,1);let[n,c,r,u]=C.getImageData(0,0,1,1).data;return{r:n,g:c,b:r,a:u/255}}function ee(t){let i=t.ownerDocument,a=i.defaultView,n=[];for(let r=t;r;r=M(r)){let u=a.getComputedStyle(r);if(u.backgroundImage&&u.backgroundImage!=="none")return;let f=B(u.backgroundColor,i);if(!f)return;if(f.a>0&&n.push(f),f.a>=1)break}let c=a.getComputedStyle(i.documentElement).colorScheme.includes("dark")&&a.matchMedia?.("(prefers-color-scheme: dark)").matches;return n.reverse().reduce((r,u)=>G(u,r),c?ue:le)}var te=t=>`${Math.floor(t*100)/100}:1`;function ae(t,i){let a={},n=s=>a[s]=(a[s]??0)+1,c=t.filter(s=>typeof s.getBoundingClientRect=="function"),r=c[0];if(!r)return{unmeasured:a,measured:{contrast:0,"focus-visible":0}};let u=r.ownerDocument,f=u.defaultView,p=s=>{let N=s.getBoundingClientRect();return N.width>1&&N.height>1},l=0;for(let s of c){if(l>=i.limit)break;if(!Array.from(s.childNodes).some(d=>d.nodeType===3&&(d.textContent??"").trim()!=="")||s.namespaceURI!=="http://www.w3.org/1999/xhtml"||s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true")continue;let E=f.getComputedStyle(s);if(E.visibility!=="visible"||E.display==="none"||!p(s))continue;l+=1;let m=B(E.color,u),x=ee(s);if(!m||!x){n("contrast");continue}let v=j(G(m,x),x),$=Number.parseFloat(E.fontSize),O=Number.parseInt(E.fontWeight,10),e=$>=24||$>=18.66&&O>=700,o=e?3:4.5;v+.005<o&&i.say("contrast",s,"serious",`Its words are at ${te(v)} against their ground; ${o}:1 is the least ${e?"large ":""}text may be.`,"Give it a color further from its ground: --graview-ink and --graview-ink-muted are held to the app's grounds.")}let w=u.activeElement,S=0;for(let s of c){if(S>=i.limit)break;if(!i.tabbable(s)||!p(s))continue;if(S+=1,s.focus({preventScroll:!0,focusVisible:!0}),s.getRootNode().activeElement!==s||!s.matches(":focus-visible")){n("focus-visible");continue}let m=f.getComputedStyle(s),x=Number.parseFloat(m.outlineWidth)||0,v=!1;for(let o=s;o;o=M(o))o.hasAttribute("data-graview-view-root")&&(v=!0);if(m.outlineStyle==="auto"){n("focus-visible");continue}if(m.outlineStyle==="none"||x===0){m.boxShadow&&m.boxShadow!=="none"?n("focus-visible"):i.say("focus-visible",s,"serious","It shows no ring when it has the keyboard: a person cannot see where they are.","Leave the outline on :focus-visible (in a view the host draws it; restyle it with --graview-focus-color).","2.4.7",v);continue}if(x+.01<2){i.say("focus-visible",s,"serious",`Its ring is ${x}px: at least 2px is seen.`,"Give the outline 2px or more (--graview-focus-width in a view).","2.4.7",v);continue}let $=B(m.outlineColor,u),O=M(s)?ee(M(s)):void 0;if(!$||!O){n("focus-visible");continue}let e=j(G($,O),O);e+.005<3&&i.say("focus-visible",s,"serious",`Its ring is at ${te(e)} against what is around it; 3:1 is the least a ring may be.`,"Give the ring a color at 3:1 against the ground (--graview-focus-color in a view; the app's accent is held to it).","1.4.11",v)}S>0&&(u.activeElement?.blur?.(),w&&w!==u.body&&w.focus?.({preventScroll:!0}));for(let s of c){let N=f.getComputedStyle(s);if(!(/(auto|scroll)/.test(N.overflowX)||/(auto|scroll)/.test(N.overflowY)))continue;let m=s;(m.scrollHeight>m.clientHeight+1||m.scrollWidth>m.clientWidth+1)&&i.scrollsOnPage(s)}return{unmeasured:a,measured:{contrast:l,"focus-visible":S}}}var q={keyboard:{wcag:"2.1.1",says:"What a person can click is reached by the keyboard.",needs:"structure"},role:{wcag:"4.1.2",says:"What takes the keyboard says what it is.",needs:"structure"},name:{wcag:"4.1.2",says:"Every control and link has a name.",needs:"structure"},"toggle-state":{wcag:"4.1.2",says:"A toggle says whether it is on, open or chosen.",needs:"structure"},"nested-interactive":{wcag:"4.1.2",says:"No control or link is inside another.",needs:"structure"},"img-alt":{wcag:"1.1.1",says:'Every image says what it shows, or says it is decoration (alt="").',needs:"structure"},"svg-name":{wcag:"1.1.1",says:'A picture drawn in SVG that means something is role="img" with a name; one that does not is hidden.',needs:"structure"},"scroll-region":{wcag:"2.1.1",says:"A box that scrolls by itself takes the keyboard and has a name.",needs:"structure"},"focus-visible":{wcag:"2.4.7",says:"Whatever has the keyboard shows a ring at least 2px wide, at 3:1 against its ground.",needs:"layout"},contrast:{wcag:"1.4.3",says:"Text is at 4.5:1 against its ground, 3:1 when large.",needs:"layout"},"keyboard-trap":{wcag:"2.1.2",says:"Tab leaves the view: the keyboard is never held inside it.",needs:"keys"}};var se="http://www.w3.org/1999/xhtml",U="http://www.w3.org/2000/svg",b=(t,...i)=>t.namespaceURI===se&&i.includes(t.localName),oe=t=>t.nodeType===1,T=t=>Array.from(t.childNodes).filter(oe),de=new Set(["button","link","checkbox","switch","radio","tab","menuitem","menuitemcheckbox","menuitemradio","option","slider","spinbutton","textbox","searchbox","combobox","treeitem"]),ce=new Set(["button","link","checkbox","switch","radio","tab","menuitem","menuitemcheckbox","menuitemradio","option","img","slider","progressbar","scrollbar","separator"]),he={checkbox:"aria-checked",switch:"aria-checked",radio:"aria-checked",menuitemcheckbox:"aria-checked",menuitemradio:"aria-checked",tab:"aria-selected",option:"aria-selected"},ie=new Set(["true","false","mixed"]),be=/^(show|hide|expand|collapse)?\s*(more|less|all|details|everything)?$/i;function I(t){let i=[],a=n=>{for(let c of T(n))i.push(c),a(c)};return a(t),i}function ne(t){for(let i=t;i;i=i.parentElement)if(i.getAttribute("aria-hidden")==="true"||i.hasAttribute("hidden"))return!0;return!1}var P=t=>t.getAttribute("role")?.trim().split(/\s+/)[0]?.toLowerCase()??null,fe=t=>{let i=t.getAttribute("tabindex");if(i===null)return;let a=Number.parseInt(i,10);return Number.isNaN(a)?void 0:a},me=t=>t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true",R=t=>b(t,"input")&&(t.getAttribute("type")??"").toLowerCase()==="hidden"||b(t,"button","input","select","textarea")&&t.hasAttribute("disabled")?!1:H(t)&&(fe(t)??0)>=0,F=t=>b(t,"button","select","textarea","summary")||b(t,"input")&&(t.getAttribute("type")??"").toLowerCase()!=="hidden"||t.localName==="a"&&t.hasAttribute("href"),re=t=>F(t)||t.hasAttribute("data-graview-link")||t.hasAttribute("data-graview-press")?!0:de.has(P(t)??""),ge=t=>t.hasAttribute("role")||!D(t);function Ae(t){let i=[],a=n=>JSON.stringify(n);for(let n=t;n&&!n.hasAttribute("data-graview-view-root");n=n.parentElement){let c=n.getAttribute("data-key");if(c!==null){i.unshift(`[data-key=${a(c)}]`);break}let r=n.getAttribute("id");if(r){i.unshift(`[id=${a(r)}]`);break}let u=n.getAttribute("class")?.trim().split(/\s+/)[0],f=`${n.localName}${u?`.${u}`:""}`,p=n.parentElement;if(p){let l=T(p).filter(w=>w.localName===n.localName);l.length>1&&(f+=`:nth-of-type(${l.indexOf(n)+1})`)}i.unshift(f)}return i.join(" > ")}var ye=t=>{for(let i=t;i;i=i.parentElement){let a=i.getAttribute("data-key");if(a!==null)return a}};function k(t){if(t.nodeType===3)return t.textContent??"";if(!oe(t)||t.getAttribute("aria-hidden")==="true"||t.hasAttribute("hidden"))return"";let i=t.getAttribute("aria-label")?.trim();if(i)return` ${i} `;if(t.localName==="img")return` ${t.getAttribute("alt")??""} `;if(t.namespaceURI===U&&t.localName==="svg"){let a=T(t).find(n=>n.localName==="title");return a?` ${k(a)} `:""}return b(t,"input","select","textarea")?"":Array.from(t.childNodes).map(k).join("")}var A=t=>t.replace(/\s+/g," ").trim();function we(t,i,a){let n=t.getAttribute("aria-labelledby");if(n){let r=A(n.split(/\s+/).map(u=>i.get(u)?k(i.get(u)):"").join(" "));if(r)return r}let c=A(t.getAttribute("aria-label")??"");if(c)return c;if(b(t,"input","select","textarea")){let r=(t.getAttribute("type")??"").toLowerCase();if(b(t,"input")&&["submit","reset","button"].includes(r))return A(t.getAttribute("value")??(r==="submit"?"Submit":r==="reset"?"Reset":""));if(b(t,"input")&&r==="image")return A(t.getAttribute("alt")??"");let u=t.getAttribute("id"),f=u?a.find(l=>l.getAttribute("for")===u):void 0;if(f&&A(k(f)))return A(k(f));for(let l=t.parentElement;l;l=l.parentElement)if(b(l,"label")&&A(k(l)))return A(k(l));let p=A(t.getAttribute("placeholder")??"");return p||A(t.getAttribute("title")??"")}return t.localName==="img"?A(t.getAttribute("alt")??t.getAttribute("title")??""):A(k(t))||A(t.getAttribute("title")??"")}function pe(t){let i=I(t);for(let a of i){let n=I(a).some(K);if(!Q(a,n)||(a.setAttribute("data-graview-link",""),W(a,I(a))))continue;let c=a.localName==="a";if(!a.hasAttribute("role")&&(c||D(a))&&a.setAttribute("role","link"),b(a,"tr")){let r=T(a).find(u=>u.localName==="td"||u.localName==="th");r&&!r.hasAttribute("tabindex")&&r.setAttribute("tabindex","0");continue}!b(a,"button")&&!a.hasAttribute("tabindex")&&a.setAttribute("tabindex","0")}for(let a of i){let n=X(a)&&!J(a)&&!b(a,"input","select","textarea"),c=!n&&Y(a);!n&&!c||(H(a)||a.setAttribute("tabindex","0"),n&&D(a)&&a.setAttribute("role","button"),a.setAttribute("data-graview-press",""))}for(let a of i.filter(n=>n.namespaceURI===U&&n.localName==="svg")){let n=a.hasAttribute("role")||a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||T(a).some(r=>r.localName==="title"),c=[a,...I(a)].some(r=>r.hasAttribute("tabindex")||r.hasAttribute("data-graview-link")||r.hasAttribute("data-graview-press")||r.localName==="a");!n&&!c&&!a.hasAttribute("aria-hidden")&&a.setAttribute("aria-hidden","true")}}function ve(t,i){let a=t;return typeof a.querySelectorAll!="function"?[]:i.flatMap(n=>{try{return Array.from(a.querySelectorAll(n))}catch{return[]}})}function _(t){for(let i of T(t)){if(R(i)||_(i))return!0;let a=i.shadowRoot;if(a&&_(a))return!0}return!1}function ke(t){let i=t.ownerDocument?.defaultView;if(!i||typeof i.getComputedStyle!="function")return!1;let n=(t.host??t).getBoundingClientRect?.();return!!(n&&(n.width>0||n.height>0))}function Oe(t,i={}){i.host==="pending"&&pe(t);let a=I(t),n=new Map(a.flatMap(e=>e.getAttribute("id")?[[e.getAttribute("id"),e]]:[])),c=a.filter(e=>b(e,"label")),r=i.clicked?Array.from(i.clicked):[...Z(t)??[]],u=new Set([...r.filter(e=>typeof e=="object"),...ve(t,r.filter(e=>typeof e=="string"))]),f=i.chrome===!0,p=[],l=(e,o,d,g,h,y=!1,L=q[e].wcag)=>{let V=ye(o);p.push({rule:e,wcag:L,impact:d,at:Ae(o),...V!==void 0?{key:V}:{},says:g,fix:h,automatic:y||f})},w=a.filter(e=>!ne(e)),S=e=>we(e,n,c)!=="",s=new Set(w.filter(e=>e.hasAttribute("data-graview-link")&&W(e,I(e))));for(let e of w){if(me(e))continue;let o=e.hasAttribute("data-graview-link"),d=e.hasAttribute("data-graview-press"),g=u.has(e);if(!o&&!d&&!g||F(e)&&R(e)||s.has(e)&&!g||b(e,"tr")&&T(e).some(y=>(y.localName==="td"||y.localName==="th")&&R(y)))continue;if(!(R(e)||g&&I(e).some(y=>R(y)&&(F(y)||y.hasAttribute("data-graview-press")||y.hasAttribute("data-graview-link"))))){o||d?l("keyboard",e,"serious","It is a link or a press the host makes, and Tab does not reach it.","The host gives it the keyboard when it draws the view; audit the view as the host drew it.",!0):l("keyboard",e,"serious",`A <${e.localName}> the view hears a click on, which Tab does not reach: a mouse can press it and a keyboard cannot.`,'Draw it as a <button type="button"> (the host resets its look), or give it role="button" and the host gives it the keyboard, Enter and Space.');continue}R(e)&&!ge(e)&&!(e.localName==="a"&&e.hasAttribute("href"))&&l("role",e,"serious",`A <${e.localName}> that takes the keyboard says nothing of what it is: a screen reader says "group" or nothing.`,'Draw it as a <button type="button">, or give it role="button" (or role="link" when it goes somewhere).',o||d)}for(let e of w){if(!re(e)||s.has(e)||S(e))continue;let o=P(e),d=b(e,"button")||o==="button"||e.hasAttribute("data-graview-press"),g=b(e,"input","select","textarea")||["textbox","searchbox","combobox","slider","spinbutton"].includes(o??""),h=g?"field":d?"button":e.hasAttribute("data-graview-link")||e.localName==="a"||o==="link"?"link":"control";l("name",e,d||g?"critical":"serious",`A ${h} with no name: a screen reader says only "${h}".`,g?'Give it a <label for> or aria-label="\u2026".':'Put words in it \u2014 a .graview-sr span when it shows only an icon \u2014 or aria-label="\u2026".')}for(let e of w){let o=P(e),d=o&&!b(e,"input")?he[o]:void 0;if(d&&!e.hasAttribute(d)){l("toggle-state",e,"serious",`It is role="${o}" and says no ${d}: a screen reader cannot say whether it is ${d==="aria-checked"?"on":"chosen"}.`,`Give it ${d}="true" or "false", and draw it again as it changes.`);continue}for(let[h,y]of[["aria-checked",ie],["aria-pressed",ie],["aria-expanded",new Set(["true","false"])],["aria-selected",new Set(["true","false"])]]){let L=e.getAttribute(h);L!==null&&!y.has(L)&&l("toggle-state",e,"serious",`${h}="${L}" is no state a screen reader can say.`,`Give ${h} "true" or "false"${y.has("mixed")?' (or "mixed")':""}.`)}!(b(e,"button")||o==="button"||e.hasAttribute("data-graview-press"))||e.hasAttribute("aria-expanded")||e.hasAttribute("aria-pressed")||(e.hasAttribute("aria-controls")?l("toggle-state",e,"serious","A button that says what it controls (aria-controls) and not whether that is open.",'Give it aria-expanded="true" or "false", and draw it again as it opens and closes.'):u.has(e)&&A(k(e))!==""&&be.test(A(k(e)))&&l("toggle-state",e,"moderate",`A button the view hears that reads "${A(k(e))}" \u2014 it opens and closes something \u2014 and says no state.`,'Give it aria-expanded="true" or "false" (or aria-pressed for a toggle), and draw it again as it changes.'))}for(let e of w){let o=P(e)??(b(e,"button")?"button":e.localName==="a"&&e.hasAttribute("href")?"link":null);if(!o||!ce.has(o)||o==="img")continue;let d=I(e).find(h=>!ne(h)&&(R(h)||re(h)));if(!d)continue;let g=e.hasAttribute("data-graview-link")&&!b(e,"a");l("nested-interactive",e,"serious",`A ${o} holds a <${d.localName}> a person presses on its own: a screen reader reads the ${o} as one thing and never reaches what is inside.`,g?"Put an <a> to the card's own record or place on its heading: the card is then a bigger target for a pointer, and the <a> the keyboard's way in.":`Move the <${d.localName}> out of the ${o}, beside it.`)}for(let e of w){if(e.localName==="img"&&e.namespaceURI===se){if(e.hasAttribute("alt")||e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")||["none","presentation"].includes(P(e)??""))continue;l("img-alt",e,"critical","An image with no alt: a screen reader reads its address, or nothing.",'Give it alt="what it shows", or alt="" when it is decoration.');continue}if(e.namespaceURI!==U||e.localName!=="svg"||e.parentElement?.namespaceURI===U||[e,...I(e)].some(h=>R(h)||h.hasAttribute("data-graview-link")||h.hasAttribute("data-graview-press")||h.localName==="a"))continue;let d=P(e);if(d==="none"||d==="presentation")continue;let g=S(e)&&(e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")||T(e).some(h=>h.localName==="title"));!d&&!g?l("svg-name",e,"minor","An SVG that says nothing, which a screen reader still meets.","The host hides an SVG that says nothing when it draws the view.",!0):d!=="img"&&d!=="graphics-document"?l("svg-name",e,"minor","An SVG with a name and no role: some screen readers skip it.",'Give it role="img" beside its aria-label.'):g||l("svg-name",e,"serious",'An SVG that is role="img" with no name: a screen reader says "image" and nothing more.','Give it aria-label="what it shows", or a <title> first inside it.')}let N=e=>/overflow(-[xy])?\s*:\s*(auto|scroll)/i.test(e.getAttribute("style")??""),E=e=>{R(e)&&S(e)||_(e)||l("scroll-region",e,"serious","A box that scrolls by itself and holds nothing Tab reaches: the keyboard cannot scroll it, and what is past its edge is out of reach.",'Give it tabindex="0", role="region" and aria-label="what it holds", or let it flow with the page.')},m=i.measure!==!1&&ke(t);if(!m)for(let e of w)N(e)&&E(e);let x=["keyboard","role","name","toggle-state","nested-interactive","img-alt","svg-name","scroll-region"],v=[],$={},O={};if(m){let e=ae(w,{limit:i.limit??400,tabbable:R,scrollsOnPage:E,say:(o,d,g,h,y,L,V)=>l(o,d,g,h,y,V===!0,L)});x.push("focus-visible","contrast"),Object.assign($,e.unmeasured),Object.assign(O,e.measured)}else{let e=i.measure===!1?"Asked not to measure.":"Nothing here is laid out (a headless run, or a DOM with no layout): it needs a browser's styles and boxes.";v.push({rule:"focus-visible",why:e},{rule:"contrast",why:e})}return v.push({rule:"keyboard-trap",why:"It needs keys pressed in a browser: a harness's Tab walk presses them (pnpm verify a11y)."}),{problems:p,ran:x,skipped:v,unmeasured:$,measured:O}}export{q as AUDIT_RULES,Oe as auditView,pe as markAsTheHost};
1
+ import{b as Z}from"./chunk.JO2X52D4.js";import{a as K,b as J,d as X,e as Y,f as H,g as D,h as Q,i as W}from"./chunk.M5FP4Y4Q.js";import{Oc as z,Pc as G,Qc as j}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var le={r:255,g:255,b:255,a:1},ue={r:18,g:18,b:18,a:1},M=t=>t.parentElement??t.getRootNode().host??null,C;function B(t,i){if(t==="transparent")return{r:0,g:0,b:0,a:0};let[a]=z(t);if(a)return a;if(C===void 0&&(C=i.createElement("canvas").getContext("2d",{willReadFrequently:!0})),!C)return;C.clearRect(0,0,1,1),C.fillStyle="#000",C.fillStyle=t,C.fillRect(0,0,1,1);let[n,c,r,u]=C.getImageData(0,0,1,1).data;return{r:n,g:c,b:r,a:u/255}}function ee(t){let i=t.ownerDocument,a=i.defaultView,n=[];for(let r=t;r;r=M(r)){let u=a.getComputedStyle(r);if(u.backgroundImage&&u.backgroundImage!=="none")return;let f=B(u.backgroundColor,i);if(!f)return;if(f.a>0&&n.push(f),f.a>=1)break}let c=a.getComputedStyle(i.documentElement).colorScheme.includes("dark")&&a.matchMedia?.("(prefers-color-scheme: dark)").matches;return n.reverse().reduce((r,u)=>G(u,r),c?ue:le)}var te=t=>`${Math.floor(t*100)/100}:1`;function ae(t,i){let a={},n=s=>a[s]=(a[s]??0)+1,c=t.filter(s=>typeof s.getBoundingClientRect=="function"),r=c[0];if(!r)return{unmeasured:a,measured:{contrast:0,"focus-visible":0}};let u=r.ownerDocument,f=u.defaultView,p=s=>{let N=s.getBoundingClientRect();return N.width>1&&N.height>1},l=0;for(let s of c){if(l>=i.limit)break;if(!Array.from(s.childNodes).some(d=>d.nodeType===3&&(d.textContent??"").trim()!=="")||s.namespaceURI!=="http://www.w3.org/1999/xhtml"||s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true")continue;let E=f.getComputedStyle(s);if(E.visibility!=="visible"||E.display==="none"||!p(s))continue;l+=1;let m=B(E.color,u),x=ee(s);if(!m||!x){n("contrast");continue}let v=j(G(m,x),x),$=Number.parseFloat(E.fontSize),O=Number.parseInt(E.fontWeight,10),e=$>=24||$>=18.66&&O>=700,o=e?3:4.5;v+.005<o&&i.say("contrast",s,"serious",`Its words are at ${te(v)} against their ground; ${o}:1 is the least ${e?"large ":""}text may be.`,"Give it a color further from its ground: --graview-ink and --graview-ink-muted are held to the app's grounds.")}let w=u.activeElement,S=0;for(let s of c){if(S>=i.limit)break;if(!i.tabbable(s)||!p(s))continue;if(S+=1,s.focus({preventScroll:!0,focusVisible:!0}),s.getRootNode().activeElement!==s||!s.matches(":focus-visible")){n("focus-visible");continue}let m=f.getComputedStyle(s),x=Number.parseFloat(m.outlineWidth)||0,v=!1;for(let o=s;o;o=M(o))o.hasAttribute("data-graview-view-root")&&(v=!0);if(m.outlineStyle==="auto"){n("focus-visible");continue}if(m.outlineStyle==="none"||x===0){m.boxShadow&&m.boxShadow!=="none"?n("focus-visible"):i.say("focus-visible",s,"serious","It shows no ring when it has the keyboard: a person cannot see where they are.","Leave the outline on :focus-visible (in a view the host draws it; restyle it with --graview-focus-color).","2.4.7",v);continue}if(x+.01<2){i.say("focus-visible",s,"serious",`Its ring is ${x}px: at least 2px is seen.`,"Give the outline 2px or more (--graview-focus-width in a view).","2.4.7",v);continue}let $=B(m.outlineColor,u),O=M(s)?ee(M(s)):void 0;if(!$||!O){n("focus-visible");continue}let e=j(G($,O),O);e+.005<3&&i.say("focus-visible",s,"serious",`Its ring is at ${te(e)} against what is around it; 3:1 is the least a ring may be.`,"Give the ring a color at 3:1 against the ground (--graview-focus-color in a view; the app's accent is held to it).","1.4.11",v)}S>0&&(u.activeElement?.blur?.(),w&&w!==u.body&&w.focus?.({preventScroll:!0}));for(let s of c){let N=f.getComputedStyle(s);if(!(/(auto|scroll)/.test(N.overflowX)||/(auto|scroll)/.test(N.overflowY)))continue;let m=s;(m.scrollHeight>m.clientHeight+1||m.scrollWidth>m.clientWidth+1)&&i.scrollsOnPage(s)}return{unmeasured:a,measured:{contrast:l,"focus-visible":S}}}var q={keyboard:{wcag:"2.1.1",says:"What a person can click is reached by the keyboard.",needs:"structure"},role:{wcag:"4.1.2",says:"What takes the keyboard says what it is.",needs:"structure"},name:{wcag:"4.1.2",says:"Every control and link has a name.",needs:"structure"},"toggle-state":{wcag:"4.1.2",says:"A toggle says whether it is on, open or chosen.",needs:"structure"},"nested-interactive":{wcag:"4.1.2",says:"No control or link is inside another.",needs:"structure"},"img-alt":{wcag:"1.1.1",says:'Every image says what it shows, or says it is decoration (alt="").',needs:"structure"},"svg-name":{wcag:"1.1.1",says:'A picture drawn in SVG that means something is role="img" with a name; one that does not is hidden.',needs:"structure"},"scroll-region":{wcag:"2.1.1",says:"A box that scrolls by itself takes the keyboard and has a name.",needs:"structure"},"focus-visible":{wcag:"2.4.7",says:"Whatever has the keyboard shows a ring at least 2px wide, at 3:1 against its ground.",needs:"layout"},contrast:{wcag:"1.4.3",says:"Text is at 4.5:1 against its ground, 3:1 when large.",needs:"layout"},"keyboard-trap":{wcag:"2.1.2",says:"Tab leaves the view: the keyboard is never held inside it.",needs:"keys"}};var se="http://www.w3.org/1999/xhtml",U="http://www.w3.org/2000/svg",b=(t,...i)=>t.namespaceURI===se&&i.includes(t.localName),oe=t=>t.nodeType===1,T=t=>Array.from(t.childNodes).filter(oe),de=new Set(["button","link","checkbox","switch","radio","tab","menuitem","menuitemcheckbox","menuitemradio","option","slider","spinbutton","textbox","searchbox","combobox","treeitem"]),ce=new Set(["button","link","checkbox","switch","radio","tab","menuitem","menuitemcheckbox","menuitemradio","option","img","slider","progressbar","scrollbar","separator"]),he={checkbox:"aria-checked",switch:"aria-checked",radio:"aria-checked",menuitemcheckbox:"aria-checked",menuitemradio:"aria-checked",tab:"aria-selected",option:"aria-selected"},ie=new Set(["true","false","mixed"]),be=/^(show|hide|expand|collapse)?\s*(more|less|all|details|everything)?$/i;function I(t){let i=[],a=n=>{for(let c of T(n))i.push(c),a(c)};return a(t),i}function ne(t){for(let i=t;i;i=i.parentElement)if(i.getAttribute("aria-hidden")==="true"||i.hasAttribute("hidden"))return!0;return!1}var P=t=>t.getAttribute("role")?.trim().split(/\s+/)[0]?.toLowerCase()??null,fe=t=>{let i=t.getAttribute("tabindex");if(i===null)return;let a=Number.parseInt(i,10);return Number.isNaN(a)?void 0:a},me=t=>t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true",R=t=>b(t,"input")&&(t.getAttribute("type")??"").toLowerCase()==="hidden"||b(t,"button","input","select","textarea")&&t.hasAttribute("disabled")?!1:H(t)&&(fe(t)??0)>=0,F=t=>b(t,"button","select","textarea","summary")||b(t,"input")&&(t.getAttribute("type")??"").toLowerCase()!=="hidden"||t.localName==="a"&&t.hasAttribute("href"),re=t=>F(t)||t.hasAttribute("data-graview-link")||t.hasAttribute("data-graview-press")?!0:de.has(P(t)??""),ge=t=>t.hasAttribute("role")||!D(t);function Ae(t){let i=[],a=n=>JSON.stringify(n);for(let n=t;n&&!n.hasAttribute("data-graview-view-root");n=n.parentElement){let c=n.getAttribute("data-key");if(c!==null){i.unshift(`[data-key=${a(c)}]`);break}let r=n.getAttribute("id");if(r){i.unshift(`[id=${a(r)}]`);break}let u=n.getAttribute("class")?.trim().split(/\s+/)[0],f=`${n.localName}${u?`.${u}`:""}`,p=n.parentElement;if(p){let l=T(p).filter(w=>w.localName===n.localName);l.length>1&&(f+=`:nth-of-type(${l.indexOf(n)+1})`)}i.unshift(f)}return i.join(" > ")}var ye=t=>{for(let i=t;i;i=i.parentElement){let a=i.getAttribute("data-key");if(a!==null)return a}};function k(t){if(t.nodeType===3)return t.textContent??"";if(!oe(t)||t.getAttribute("aria-hidden")==="true"||t.hasAttribute("hidden"))return"";let i=t.getAttribute("aria-label")?.trim();if(i)return` ${i} `;if(t.localName==="img")return` ${t.getAttribute("alt")??""} `;if(t.namespaceURI===U&&t.localName==="svg"){let a=T(t).find(n=>n.localName==="title");return a?` ${k(a)} `:""}return b(t,"input","select","textarea")?"":Array.from(t.childNodes).map(k).join("")}var A=t=>t.replace(/\s+/g," ").trim();function we(t,i,a){let n=t.getAttribute("aria-labelledby");if(n){let r=A(n.split(/\s+/).map(u=>i.get(u)?k(i.get(u)):"").join(" "));if(r)return r}let c=A(t.getAttribute("aria-label")??"");if(c)return c;if(b(t,"input","select","textarea")){let r=(t.getAttribute("type")??"").toLowerCase();if(b(t,"input")&&["submit","reset","button"].includes(r))return A(t.getAttribute("value")??(r==="submit"?"Submit":r==="reset"?"Reset":""));if(b(t,"input")&&r==="image")return A(t.getAttribute("alt")??"");let u=t.getAttribute("id"),f=u?a.find(l=>l.getAttribute("for")===u):void 0;if(f&&A(k(f)))return A(k(f));for(let l=t.parentElement;l;l=l.parentElement)if(b(l,"label")&&A(k(l)))return A(k(l));let p=A(t.getAttribute("placeholder")??"");return p||A(t.getAttribute("title")??"")}return t.localName==="img"?A(t.getAttribute("alt")??t.getAttribute("title")??""):A(k(t))||A(t.getAttribute("title")??"")}function pe(t){let i=I(t);for(let a of i){let n=I(a).some(K);if(!Q(a,n)||(a.setAttribute("data-graview-link",""),W(a,I(a))))continue;let c=a.localName==="a";if(!a.hasAttribute("role")&&(c||D(a))&&a.setAttribute("role","link"),b(a,"tr")){let r=T(a).find(u=>u.localName==="td"||u.localName==="th");r&&!r.hasAttribute("tabindex")&&r.setAttribute("tabindex","0");continue}!b(a,"button")&&!a.hasAttribute("tabindex")&&a.setAttribute("tabindex","0")}for(let a of i){let n=X(a)&&!J(a)&&!b(a,"input","select","textarea"),c=!n&&Y(a);!n&&!c||(H(a)||a.setAttribute("tabindex","0"),n&&D(a)&&a.setAttribute("role","button"),a.setAttribute("data-graview-press",""))}for(let a of i.filter(n=>n.namespaceURI===U&&n.localName==="svg")){let n=a.hasAttribute("role")||a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||T(a).some(r=>r.localName==="title"),c=[a,...I(a)].some(r=>r.hasAttribute("tabindex")||r.hasAttribute("data-graview-link")||r.hasAttribute("data-graview-press")||r.localName==="a");!n&&!c&&!a.hasAttribute("aria-hidden")&&a.setAttribute("aria-hidden","true")}}function ve(t,i){let a=t;return typeof a.querySelectorAll!="function"?[]:i.flatMap(n=>{try{return Array.from(a.querySelectorAll(n))}catch{return[]}})}function _(t){for(let i of T(t)){if(R(i)||_(i))return!0;let a=i.shadowRoot;if(a&&_(a))return!0}return!1}function ke(t){let i=t.ownerDocument?.defaultView;if(!i||typeof i.getComputedStyle!="function")return!1;let n=(t.host??t).getBoundingClientRect?.();return!!(n&&(n.width>0||n.height>0))}function Oe(t,i={}){i.host==="pending"&&pe(t);let a=I(t),n=new Map(a.flatMap(e=>e.getAttribute("id")?[[e.getAttribute("id"),e]]:[])),c=a.filter(e=>b(e,"label")),r=i.clicked?Array.from(i.clicked):[...Z(t)??[]],u=new Set([...r.filter(e=>typeof e=="object"),...ve(t,r.filter(e=>typeof e=="string"))]),f=i.chrome===!0,p=[],l=(e,o,d,g,h,y=!1,L=q[e].wcag)=>{let V=ye(o);p.push({rule:e,wcag:L,impact:d,at:Ae(o),...V!==void 0?{key:V}:{},says:g,fix:h,automatic:y||f})},w=a.filter(e=>!ne(e)),S=e=>we(e,n,c)!=="",s=new Set(w.filter(e=>e.hasAttribute("data-graview-link")&&W(e,I(e))));for(let e of w){if(me(e))continue;let o=e.hasAttribute("data-graview-link"),d=e.hasAttribute("data-graview-press"),g=u.has(e);if(!o&&!d&&!g||F(e)&&R(e)||s.has(e)&&!g||b(e,"tr")&&T(e).some(y=>(y.localName==="td"||y.localName==="th")&&R(y)))continue;if(!(R(e)||g&&I(e).some(y=>R(y)&&(F(y)||y.hasAttribute("data-graview-press")||y.hasAttribute("data-graview-link"))))){o||d?l("keyboard",e,"serious","It is a link or a press the host makes, and Tab does not reach it.","The host gives it the keyboard when it draws the view; audit the view as the host drew it.",!0):l("keyboard",e,"serious",`A <${e.localName}> the view hears a click on, which Tab does not reach: a mouse can press it and a keyboard cannot.`,'Draw it as a <button type="button"> (the host resets its look), or give it role="button" and the host gives it the keyboard, Enter and Space.');continue}R(e)&&!ge(e)&&!(e.localName==="a"&&e.hasAttribute("href"))&&l("role",e,"serious",`A <${e.localName}> that takes the keyboard says nothing of what it is: a screen reader says "group" or nothing.`,'Draw it as a <button type="button">, or give it role="button" (or role="link" when it goes somewhere).',o||d)}for(let e of w){if(!re(e)||s.has(e)||S(e))continue;let o=P(e),d=b(e,"button")||o==="button"||e.hasAttribute("data-graview-press"),g=b(e,"input","select","textarea")||["textbox","searchbox","combobox","slider","spinbutton"].includes(o??""),h=g?"field":d?"button":e.hasAttribute("data-graview-link")||e.localName==="a"||o==="link"?"link":"control";l("name",e,d||g?"critical":"serious",`A ${h} with no name: a screen reader says only "${h}".`,g?'Give it a <label for> or aria-label="\u2026".':'Put words in it \u2014 a .graview-sr span when it shows only an icon \u2014 or aria-label="\u2026".')}for(let e of w){let o=P(e),d=o&&!b(e,"input")?he[o]:void 0;if(d&&!e.hasAttribute(d)){l("toggle-state",e,"serious",`It is role="${o}" and says no ${d}: a screen reader cannot say whether it is ${d==="aria-checked"?"on":"chosen"}.`,`Give it ${d}="true" or "false", and draw it again as it changes.`);continue}for(let[h,y]of[["aria-checked",ie],["aria-pressed",ie],["aria-expanded",new Set(["true","false"])],["aria-selected",new Set(["true","false"])]]){let L=e.getAttribute(h);L!==null&&!y.has(L)&&l("toggle-state",e,"serious",`${h}="${L}" is no state a screen reader can say.`,`Give ${h} "true" or "false"${y.has("mixed")?' (or "mixed")':""}.`)}!(b(e,"button")||o==="button"||e.hasAttribute("data-graview-press"))||e.hasAttribute("aria-expanded")||e.hasAttribute("aria-pressed")||(e.hasAttribute("aria-controls")?l("toggle-state",e,"serious","A button that says what it controls (aria-controls) and not whether that is open.",'Give it aria-expanded="true" or "false", and draw it again as it opens and closes.'):u.has(e)&&A(k(e))!==""&&be.test(A(k(e)))&&l("toggle-state",e,"moderate",`A button the view hears that reads "${A(k(e))}" \u2014 it opens and closes something \u2014 and says no state.`,'Give it aria-expanded="true" or "false" (or aria-pressed for a toggle), and draw it again as it changes.'))}for(let e of w){let o=P(e)??(b(e,"button")?"button":e.localName==="a"&&e.hasAttribute("href")?"link":null);if(!o||!ce.has(o)||o==="img")continue;let d=I(e).find(h=>!ne(h)&&(R(h)||re(h)));if(!d)continue;let g=e.hasAttribute("data-graview-link")&&!b(e,"a");l("nested-interactive",e,"serious",`A ${o} holds a <${d.localName}> a person presses on its own: a screen reader reads the ${o} as one thing and never reaches what is inside.`,g?"Put an <a> to the card's own record or place on its heading: the card is then a bigger target for a pointer, and the <a> the keyboard's way in.":`Move the <${d.localName}> out of the ${o}, beside it.`)}for(let e of w){if(e.localName==="img"&&e.namespaceURI===se){if(e.hasAttribute("alt")||e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")||["none","presentation"].includes(P(e)??""))continue;l("img-alt",e,"critical","An image with no alt: a screen reader reads its address, or nothing.",'Give it alt="what it shows", or alt="" when it is decoration.');continue}if(e.namespaceURI!==U||e.localName!=="svg"||e.parentElement?.namespaceURI===U||[e,...I(e)].some(h=>R(h)||h.hasAttribute("data-graview-link")||h.hasAttribute("data-graview-press")||h.localName==="a"))continue;let d=P(e);if(d==="none"||d==="presentation")continue;let g=S(e)&&(e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")||T(e).some(h=>h.localName==="title"));!d&&!g?l("svg-name",e,"minor","An SVG that says nothing, which a screen reader still meets.","The host hides an SVG that says nothing when it draws the view.",!0):d!=="img"&&d!=="graphics-document"?l("svg-name",e,"minor","An SVG with a name and no role: some screen readers skip it.",'Give it role="img" beside its aria-label.'):g||l("svg-name",e,"serious",'An SVG that is role="img" with no name: a screen reader says "image" and nothing more.','Give it aria-label="what it shows", or a <title> first inside it.')}let N=e=>/overflow(-[xy])?\s*:\s*(auto|scroll)/i.test(e.getAttribute("style")??""),E=e=>{R(e)&&S(e)||_(e)||l("scroll-region",e,"serious","A box that scrolls by itself and holds nothing Tab reaches: the keyboard cannot scroll it, and what is past its edge is out of reach.",'Give it tabindex="0", role="region" and aria-label="what it holds", or let it flow with the page.')},m=i.measure!==!1&&ke(t);if(!m)for(let e of w)N(e)&&E(e);let x=["keyboard","role","name","toggle-state","nested-interactive","img-alt","svg-name","scroll-region"],v=[],$={},O={};if(m){let e=ae(w,{limit:i.limit??400,tabbable:R,scrollsOnPage:E,say:(o,d,g,h,y,L,V)=>l(o,d,g,h,y,V===!0,L)});x.push("focus-visible","contrast"),Object.assign($,e.unmeasured),Object.assign(O,e.measured)}else{let e=i.measure===!1?"Asked not to measure.":"Nothing here is laid out (a headless run, or a DOM with no layout): it needs a browser's styles and boxes.";v.push({rule:"focus-visible",why:e},{rule:"contrast",why:e})}return v.push({rule:"keyboard-trap",why:"It needs keys pressed in a browser: a harness's Tab walk presses them (pnpm verify a11y)."}),{problems:p,ran:x,skipped:v,unmeasured:$,measured:O}}export{q as AUDIT_RULES,Oe as auditView,pe as markAsTheHost};