graview 0.1.67 → 0.1.68

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 (189) hide show
  1. package/dist/preview/{chunk.YCD4JSXD.js → chunk.2BMZPALF.js} +1 -1
  2. package/dist/preview/{chunk.SNHKYH72.js → chunk.2KCDLCB2.js} +1 -1
  3. package/dist/preview/{chunk.O2OL6RQQ.js → chunk.2ME4DVBI.js} +1 -1
  4. package/dist/preview/chunk.2TUEBU7X.js +8 -0
  5. package/dist/preview/{chunk.LYEGRY77.js → chunk.2U6HB4XU.js} +1 -1
  6. package/dist/preview/{chunk.7S6ZRMW4.js → chunk.32JE2WS7.js} +1 -1
  7. package/dist/preview/{chunk.RG5G6YQD.js → chunk.3DEWQDP7.js} +1 -1
  8. package/dist/preview/{chunk.GVT4UUQA.js → chunk.3JMQKANL.js} +1 -1
  9. package/dist/preview/{chunk.A5PSEU3W.js → chunk.3VEZ5MOC.js} +1 -1
  10. package/dist/preview/chunk.3WPCS6KP.js +1 -0
  11. package/dist/preview/{chunk.5R744JGZ.js → chunk.42C3FIKK.js} +1 -1
  12. package/dist/preview/{chunk.IAEGJDF3.js → chunk.42KHFGN6.js} +1 -1
  13. package/dist/preview/{chunk.DZMIYEHQ.js → chunk.4DXPPM6T.js} +1 -1
  14. package/dist/preview/chunk.4GVKKBQL.js +1 -0
  15. package/dist/preview/{chunk.KX5ZBHMA.js → chunk.4TT3ZHSJ.js} +1 -1
  16. package/dist/preview/{chunk.QXLJGHMC.js → chunk.4YAO3A5Q.js} +3 -3
  17. package/dist/preview/{chunk.Z4TY44CD.js → chunk.5JKUT2OM.js} +1 -1
  18. package/dist/preview/chunk.5L4ADKTW.js +1 -0
  19. package/dist/preview/{chunk.BKYZSV2Y.js → chunk.64LCHHZB.js} +1 -1
  20. package/dist/preview/{chunk.ZEZUKRC6.js → chunk.6AANHELP.js} +1 -1
  21. package/dist/preview/{chunk.ZAQ4IDX6.js → chunk.6DMCEBSO.js} +1 -1
  22. package/dist/preview/{chunk.NKLPL7QD.js → chunk.6IR5LBJU.js} +1 -1
  23. package/dist/preview/{chunk.X226YATK.js → chunk.6WB2TYK7.js} +1 -1
  24. package/dist/preview/chunk.6ZENHSTQ.js +1 -0
  25. package/dist/preview/{chunk.EJ2EZL2G.js → chunk.7K2V5FUB.js} +1 -1
  26. package/dist/preview/chunk.7OL6H4LF.js +1 -0
  27. package/dist/preview/{chunk.4W57E7AX.js → chunk.7TDML5YU.js} +1 -1
  28. package/dist/preview/{chunk.AJMVRFYX.js → chunk.7WPVLEX2.js} +2 -2
  29. package/dist/preview/{chunk.XSWSBTUO.js → chunk.7ZTGB4O7.js} +1 -1
  30. package/dist/preview/{chunk.FRQSLWP4.js → chunk.ACNOP2IU.js} +1 -1
  31. package/dist/preview/{chunk.N4ZKZ4GM.js → chunk.AENP662H.js} +1 -1
  32. package/dist/preview/{chunk.SFBHPYRD.js → chunk.AQ2PI6MR.js} +1 -1
  33. package/dist/preview/chunk.ARS4HJD2.js +1 -0
  34. package/dist/preview/{chunk.STPA7HBK.js → chunk.AWV57UBJ.js} +1 -1
  35. package/dist/preview/{chunk.D7NWMXSX.js → chunk.AYZL3LCR.js} +3 -3
  36. package/dist/preview/{chunk.URQTF5SY.js → chunk.BHJRT57H.js} +1 -1
  37. package/dist/preview/{chunk.7UHPHEH5.js → chunk.BPNW5KCP.js} +1 -1
  38. package/dist/preview/{chunk.TTSGCNPT.js → chunk.BQAFFEOA.js} +1 -1
  39. package/dist/preview/chunk.C2QKA6XY.js +1 -0
  40. package/dist/preview/{chunk.6KJGRM7A.js → chunk.CE3NKAF7.js} +1 -1
  41. package/dist/preview/{chunk.QRQ5WPZI.js → chunk.CFE3MHWZ.js} +1 -1
  42. package/dist/preview/{chunk.H6KIEDZN.js → chunk.CGBOPPNL.js} +1 -1
  43. package/dist/preview/{chunk.LP2ZMAT2.js → chunk.CNN32262.js} +1 -1
  44. package/dist/preview/{chunk.HJUZMOW2.js → chunk.DCLF4WWZ.js} +1 -1
  45. package/dist/preview/{chunk.GMLONS5L.js → chunk.DGDW54KE.js} +1 -1
  46. package/dist/preview/{chunk.3GNT5MKP.js → chunk.DLSS56EU.js} +1 -1
  47. package/dist/preview/{chunk.QAM76AXV.js → chunk.DMZRFXH7.js} +1 -1
  48. package/dist/preview/{chunk.Z2XUVJAL.js → chunk.DPHH5ZVL.js} +1 -1
  49. package/dist/preview/{chunk.Z27NSSYL.js → chunk.DZ6UDZOB.js} +2 -2
  50. package/dist/preview/{chunk.6W6XMLSF.js → chunk.E423JCOS.js} +1 -1
  51. package/dist/preview/{chunk.35KMZHB7.js → chunk.EB7PZJEO.js} +1 -1
  52. package/dist/preview/{chunk.V7H4BUEB.js → chunk.ECNGVD25.js} +1 -1
  53. package/dist/preview/{chunk.B7KZBT27.js → chunk.EGSOHTZZ.js} +1 -1
  54. package/dist/preview/{chunk.OCXY5DCD.js → chunk.EGVM24ND.js} +1 -1
  55. package/dist/preview/{chunk.UDHPMVC4.js → chunk.ENLIIZF2.js} +1 -1
  56. package/dist/preview/{chunk.H3EGBDW2.js → chunk.EP5JS7ZH.js} +1 -1
  57. package/dist/preview/{chunk.TI5FR2QQ.js → chunk.F5GNNVSQ.js} +1 -1
  58. package/dist/preview/chunk.FHQ25SWY.js +1 -0
  59. package/dist/preview/{chunk.F464JKHZ.js → chunk.FSW535EA.js} +1 -1
  60. package/dist/preview/{chunk.G5GVT6JY.js → chunk.FZELUSK5.js} +1 -1
  61. package/dist/preview/{chunk.UWS4RMM3.js → chunk.G2BDEWJC.js} +1 -1
  62. package/dist/preview/chunk.GF3ZCX46.js +2 -0
  63. package/dist/preview/{chunk.UW52CMGJ.js → chunk.GJTEV6CK.js} +1 -1
  64. package/dist/preview/{chunk.A7GVTE5Y.js → chunk.GKTQ5CZA.js} +2 -2
  65. package/dist/preview/{chunk.ZG5VGP5U.js → chunk.GONZB3J3.js} +1 -1
  66. package/dist/preview/{chunk.FLJXYESX.js → chunk.GRBWXTST.js} +1 -1
  67. package/dist/preview/{chunk.Z3O2VZAJ.js → chunk.GRTBEA7O.js} +1 -1
  68. package/dist/preview/{chunk.QNP5OR3P.js → chunk.H3IGXHZR.js} +2 -2
  69. package/dist/preview/{chunk.ILJDLBPJ.js → chunk.H3W5C3XQ.js} +1 -1
  70. package/dist/preview/{chunk.O5VFKVZS.js → chunk.H4VNIAHN.js} +1 -1
  71. package/dist/preview/{chunk.7ARRVNUR.js → chunk.HH4D3JEI.js} +1 -1
  72. package/dist/preview/{chunk.MUSMNKE4.js → chunk.HWFJQ42Y.js} +1 -1
  73. package/dist/preview/{chunk.37RFCHSS.js → chunk.HXTKBISQ.js} +1 -1
  74. package/dist/preview/{chunk.J2OPIS3H.js → chunk.I34BWUB4.js} +1 -1
  75. package/dist/preview/{chunk.ZAPS4J6G.js → chunk.I63462I3.js} +1 -1
  76. package/dist/preview/{chunk.6UQFV53C.js → chunk.IKKKHHRN.js} +1 -1
  77. package/dist/preview/{chunk.GRFD42WM.js → chunk.IPGLITWA.js} +1 -1
  78. package/dist/preview/{chunk.3NSV3WKM.js → chunk.IT5DVKXY.js} +2 -2
  79. package/dist/preview/{chunk.JQ2WNKDW.js → chunk.IXMIU4D4.js} +1 -1
  80. package/dist/preview/{chunk.JVB5KDSG.js → chunk.JCETQQ7J.js} +1 -1
  81. package/dist/preview/{chunk.M7KXQGQL.js → chunk.JGRSUTPJ.js} +1 -1
  82. package/dist/preview/{chunk.KFT7JIEH.js → chunk.JLDJZET2.js} +1 -1
  83. package/dist/preview/{chunk.JQ63N4MZ.js → chunk.JULD4XFB.js} +1 -1
  84. package/dist/preview/{chunk.LVOTLGJB.js → chunk.JV432T4Q.js} +1 -1
  85. package/dist/preview/{chunk.6SJEZWH3.js → chunk.KAM73WVF.js} +1 -1
  86. package/dist/preview/{chunk.AKJS2NUM.js → chunk.KUCBNMIY.js} +1 -1
  87. package/dist/preview/{chunk.DWM7AR5Y.js → chunk.L7XKYGV7.js} +1 -1
  88. package/dist/preview/{chunk.EP6Q32WT.js → chunk.LFFJB6D3.js} +1 -1
  89. package/dist/preview/{chunk.264PB572.js → chunk.LMTG5NPG.js} +1 -1
  90. package/dist/preview/{chunk.EGPCVMDU.js → chunk.LOKGUALC.js} +1 -1
  91. package/dist/preview/{chunk.FPHRAO3R.js → chunk.LZ6MSQ5O.js} +1 -1
  92. package/dist/preview/chunk.MBTEOF4R.js +1 -0
  93. package/dist/preview/{chunk.RJY7VJBH.js → chunk.MIOLBZBS.js} +1 -1
  94. package/dist/preview/{chunk.G3GFDVO2.js → chunk.MK5RPEB2.js} +1 -1
  95. package/dist/preview/{chunk.NSOPYIT4.js → chunk.MKL4THIV.js} +1 -1
  96. package/dist/preview/{chunk.FVQKSN33.js → chunk.MPWLDQOG.js} +1 -1
  97. package/dist/preview/chunk.MSUZAJ2K.js +4 -0
  98. package/dist/preview/{chunk.MSAYU25L.js → chunk.N5Z34V7U.js} +1 -1
  99. package/dist/preview/chunk.N64RVSH3.js +1 -0
  100. package/dist/preview/{chunk.HAOB6O72.js → chunk.ND3DEDWB.js} +1 -1
  101. package/dist/preview/{chunk.GFLH7RCI.js → chunk.NFTPJAMJ.js} +1 -1
  102. package/dist/preview/{chunk.QZQCQWQG.js → chunk.NRCWMYLH.js} +1 -1
  103. package/dist/preview/{chunk.47XEJZ3O.js → chunk.O2VXTYUJ.js} +1 -1
  104. package/dist/preview/{chunk.6N4PE3U5.js → chunk.O32F6LGK.js} +1 -1
  105. package/dist/preview/{chunk.PZ7KY6XH.js → chunk.O5FTWXA2.js} +1 -1
  106. package/dist/preview/{chunk.T2OUHRAA.js → chunk.ODYJEDIW.js} +1 -1
  107. package/dist/preview/{chunk.DKEIEH2D.js → chunk.OQ4ZO3YY.js} +1 -1
  108. package/dist/preview/chunk.PI4RFOBU.js +1 -0
  109. package/dist/preview/{chunk.E5PYNAYT.js → chunk.PIMAG4WT.js} +2 -2
  110. package/dist/preview/{chunk.EFVSZKB5.js → chunk.PLIV3IQK.js} +1 -1
  111. package/dist/preview/{chunk.77C556NM.js → chunk.PPCDPYYU.js} +1 -1
  112. package/dist/preview/{chunk.MW7R5G3C.js → chunk.PZQ5P6WK.js} +1 -1
  113. package/dist/preview/chunk.Q42R2KW4.js +1 -0
  114. package/dist/preview/{chunk.WEMUKZKH.js → chunk.Q4VFLLUT.js} +1 -1
  115. package/dist/preview/{chunk.SY5ID44D.js → chunk.Q6H5HESF.js} +1 -1
  116. package/dist/preview/chunk.QM54TGU6.js +3 -0
  117. package/dist/preview/{chunk.HN4ZJ4B4.js → chunk.QOQ26NXM.js} +1 -1
  118. package/dist/preview/{chunk.SJQPTDAT.js → chunk.QUETLFBJ.js} +1 -1
  119. package/dist/preview/{chunk.P2EKKKK2.js → chunk.QWLK3GKG.js} +1 -1
  120. package/dist/preview/{chunk.JEC5FDKX.js → chunk.QYPU444Y.js} +1 -1
  121. package/dist/preview/{chunk.TXZQEJ5T.js → chunk.QZP3ARLH.js} +1 -1
  122. package/dist/preview/{chunk.WALVW3KJ.js → chunk.R3GE37OI.js} +1 -1
  123. package/dist/preview/chunk.R66ZVMWB.js +1 -0
  124. package/dist/preview/{chunk.YZPESGCP.js → chunk.RQG672MJ.js} +1 -1
  125. package/dist/preview/chunk.RYA7A4NA.js +1 -0
  126. package/dist/preview/{chunk.LRNFE3UK.js → chunk.SADR3MQI.js} +1 -1
  127. package/dist/preview/{chunk.MJY4SLWA.js → chunk.SS6KL5NT.js} +1 -1
  128. package/dist/preview/chunk.SUG6LIOX.js +1 -0
  129. package/dist/preview/{chunk.SO6NT5K7.js → chunk.TFJA4QV4.js} +1 -1
  130. package/dist/preview/{chunk.D4WJ7OM5.js → chunk.TOUSIUJF.js} +1 -1
  131. package/dist/preview/{chunk.ARWO4WOV.js → chunk.TR4YFVZN.js} +1 -1
  132. package/dist/preview/{chunk.XFLGSUYO.js → chunk.TRNJKHIA.js} +1 -1
  133. package/dist/preview/{chunk.5AKZROMR.js → chunk.TVWK3SGD.js} +1 -1
  134. package/dist/preview/chunk.U7PAFLUM.js +1 -0
  135. package/dist/preview/{chunk.NKYWIGC7.js → chunk.UAMPR4MD.js} +1 -1
  136. package/dist/preview/{chunk.UGQYMN4J.js → chunk.UD7VLXPM.js} +1 -1
  137. package/dist/preview/{chunk.UQIPEMJ5.js → chunk.UFURYU4R.js} +1 -1
  138. package/dist/preview/{chunk.R6JBA7UK.js → chunk.UODTUBQ7.js} +1 -1
  139. package/dist/preview/{chunk.NRURQGXV.js → chunk.VES4XMZX.js} +1 -1
  140. package/dist/preview/{chunk.QWGWOEBZ.js → chunk.VLXLBGMY.js} +1 -1
  141. package/dist/preview/{chunk.IDALEKIW.js → chunk.VTDOWXCP.js} +1 -1
  142. package/dist/preview/{chunk.4EMKCKDB.js → chunk.VV5JAM5W.js} +1 -1
  143. package/dist/preview/{chunk.JU6UFWS3.js → chunk.VW632VNJ.js} +1 -1
  144. package/dist/preview/{chunk.25QFDTCU.js → chunk.WC5WE34A.js} +1 -1
  145. package/dist/preview/chunk.WN7SAAH6.js +1 -0
  146. package/dist/preview/{chunk.4UUJHLHR.js → chunk.WV45KLXC.js} +1 -1
  147. package/dist/preview/{chunk.NAXOXBOF.js → chunk.XDZDNZ7B.js} +1 -1
  148. package/dist/preview/{chunk.MAKCZ6B6.js → chunk.XFH6GHBQ.js} +1 -1
  149. package/dist/preview/{chunk.2VUX54XH.js → chunk.XRE7SHLD.js} +1 -1
  150. package/dist/preview/{chunk.J6HF7IRQ.js → chunk.XXCHO2A5.js} +1 -1
  151. package/dist/preview/{chunk.A4EZAGG7.js → chunk.Y7OGJOPA.js} +1 -1
  152. package/dist/preview/{chunk.6NG76MDA.js → chunk.YBQ5GVAX.js} +2 -2
  153. package/dist/preview/{chunk.QF5QB5YR.js → chunk.YL2RBZFE.js} +1 -1
  154. package/dist/preview/{chunk.RSQ432QN.js → chunk.YM6SWEUI.js} +1 -1
  155. package/dist/preview/{chunk.7BJRHPE3.js → chunk.Z2X7BFCB.js} +2 -2
  156. package/dist/preview/{chunk.VBLQJVQ5.js → chunk.Z67LBSQO.js} +1 -1
  157. package/dist/preview/{chunk.OHAO6KKH.js → chunk.ZKXIZBCN.js} +1 -1
  158. package/dist/preview/{chunk.BDNQMKDG.js → chunk.ZLEBOR5T.js} +1 -1
  159. package/dist/preview/{chunk.CKDCTFLU.js → chunk.ZLNUZ6LR.js} +1 -1
  160. package/dist/preview/chunk.ZMADWPJO.js +1 -0
  161. package/dist/preview/chunk.ZO6VMEPP.js +1 -0
  162. package/dist/preview/chunk.ZUG7U7AT.js +1 -0
  163. package/dist/preview/index.html +55 -55
  164. package/dist/preview/page.js +2 -2
  165. package/package.json +6 -6
  166. package/dist/preview/chunk.2FHIINXG.js +0 -2
  167. package/dist/preview/chunk.3ENPWZBG.js +0 -1
  168. package/dist/preview/chunk.3ZODN6BW.js +0 -1
  169. package/dist/preview/chunk.55G4IPOO.js +0 -1
  170. package/dist/preview/chunk.5J6DVR7S.js +0 -1
  171. package/dist/preview/chunk.7WHQWLL6.js +0 -1
  172. package/dist/preview/chunk.B5SJMCTT.js +0 -7
  173. package/dist/preview/chunk.CTUJZ3IV.js +0 -1
  174. package/dist/preview/chunk.CY7FFKEZ.js +0 -1
  175. package/dist/preview/chunk.DEKRFTRN.js +0 -4
  176. package/dist/preview/chunk.EBKH3ILT.js +0 -1
  177. package/dist/preview/chunk.FOUBDGL3.js +0 -1
  178. package/dist/preview/chunk.HB5NWHFP.js +0 -3
  179. package/dist/preview/chunk.HVBKI5ZO.js +0 -1
  180. package/dist/preview/chunk.I3SDKMQS.js +0 -1
  181. package/dist/preview/chunk.J5OLYVZ4.js +0 -1
  182. package/dist/preview/chunk.JKFVNQY7.js +0 -1
  183. package/dist/preview/chunk.KGMSSXZL.js +0 -1
  184. package/dist/preview/chunk.NXZL5CA2.js +0 -1
  185. package/dist/preview/chunk.PSNMZBVS.js +0 -1
  186. package/dist/preview/chunk.R7CRBRD4.js +0 -1
  187. package/dist/preview/chunk.RR25BGWP.js +0 -1
  188. package/dist/preview/chunk.T27QKVKP.js +0 -1
  189. package/dist/preview/chunk.T3WCRS6M.js +0 -1
@@ -1 +1 @@
1
- import{m}from"./chunk.QNP5OR3P.js";import{G as N,W as f,_ as y}from"./chunk.A5PSEU3W.js";import{b as g}from"./chunk.AJZBJBMO.js";var p=g(N(),1);var a=g(f(),1);var R={default:{background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)"},muted:{background:"var(--graview-panel-muted, #f7f5f1)",color:"var(--graview-ink, #1a1a1a)"},warning:{background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)"}},T={color:"var(--graview-ink-muted, #55514a)"},C={color:"var(--graview-ink-faint, #625d55)"};function H(e){let[l,o]=(0,p.useState)(z);return(0,p.useEffect)(()=>{let r=e.current;if(!r||typeof ResizeObserver>"u")return;let t=()=>{let i=W(r,parseFloat(getComputedStyle(r).paddingBottom)||0);o(s=>s.overflowing===i.overflowing&&s.above===i.above&&s.below===i.below?s:i)};t();let d=new ResizeObserver(t);d.observe(r);for(let i of r.children)d.observe(i);return r.addEventListener("scroll",t,{passive:!0}),()=>{d.disconnect(),r.removeEventListener("scroll",t)}}),l}var z={overflowing:!1,above:!1,below:!1};function W(e,l=0){let o=e.scrollHeight>e.clientHeight+1,r=e.scrollWidth>e.clientWidth+1;return{overflowing:o||r,above:o&&e.scrollTop>1,below:o&&e.scrollTop+e.clientHeight<e.scrollHeight-l-1}}var A=(0,p.createContext)(null),I=(0,p.createContext)(null);function O({level:e,said:l=!0,style:o,children:r}){if(e===void 0)return(0,a.jsx)("strong",{style:o,...l?{}:{"aria-hidden":!0},children:r});let t=`h${e}`;return(0,a.jsx)(t,{style:{margin:0,...o},children:r})}function E({title:e,subtitle:l,meta:o,selected:r,tone:t="default",children:d,style:i,fit:s=!1,variant:w,heading:b}){let c=(0,p.useRef)(null),{overflowing:v,above:x,below:S}=H(c),P=y(),n=(w??(P==="fullscreen"?"page":"card"))==="page",k=(0,p.useContext)(A),u=(0,p.useContext)(I);return(0,a.jsxs)("div",{"data-graview-primitive":"panel","data-graview-variant":n?"page":"card","data-selected":r||void 0,style:{display:"flex",flexDirection:"column",gap:n?12:"var(--graview-gap, 7px)",height:n||s?"auto":"100%",maxHeight:n?"none":"100%",padding:n?0:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:n?0:"var(--graview-radius, 12px)",border:n?"none":`1px solid ${r?"var(--graview-accent, #2f6f5e)":"var(--graview-edge, #e4e0d8)"}`,boxShadow:n?"none":r?"0 0 0 1px var(--graview-accent-dim), var(--graview-lift-low)":"var(--graview-lift-low)",overflow:n?"visible":"hidden",...R[t],...n?{background:"transparent"}:{},...i},children:[t==="warning"?(0,a.jsx)("span",{"data-graview-broken":"",style:m,children:"Implicated in a problem."}):null,e===void 0||e===k?null:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0},children:[t==="warning"?(0,a.jsx)("span",{"aria-hidden":"true",title:"Implicated in a problem",style:{color:"var(--graview-warn)",flex:"0 0 auto"},children:"\u26A0"}):null,(0,a.jsx)(O,{level:b,said:u===null||e!==u,style:{fontFamily:"var(--graview-font-display, inherit)",fontSize:n?"1.5625rem":"0.9375rem",lineHeight:n?1.15:1.25,fontWeight:n?600:560,letterSpacing:n?"-0.012em":"0.005em",minWidth:0,overflowWrap:"anywhere"},children:e}),o===void 0?null:(0,a.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",letterSpacing:"0.08em",textTransform:"uppercase",minWidth:0,overflowWrap:"anywhere",...C},children:o})]}),l===void 0?null:(0,a.jsx)("div",{style:{fontSize:n?"0.90625rem":"0.8125rem",lineHeight:1.5,...T},children:l}),(0,a.jsx)("div",{ref:c,className:n?void 0:"graview-scroll",...v&&!n?{tabIndex:0,role:"region",...typeof e=="string"?{"aria-label":e}:{}}:{},style:{display:"flex",flexDirection:"column",gap:n?22:"var(--graview-gap, 7px)",flex:"1 1 auto",...n?{overflow:"visible"}:{marginBottom:"calc(-1 * var(--graview-pad, 15px))",paddingBottom:"var(--graview-pad, 15px)"},...!n&&!v?{overflow:"hidden"}:{}},"data-graview-more-above":x&&!n?"":void 0,"data-graview-more-below":S&&!n?"":void 0,children:d})]})}function h({label:e,hue:l,selected:o,title:r,pickId:t,emphasis:d}){let i=typeof e=="string"?e:void 0,s=l===void 0?void 0:Math.round(l);return(0,a.jsxs)("span",{"data-graview-primitive":"chip","data-selected":o||void 0,"data-graview-pick":t,"data-graview-emphasis":d,title:r??i,style:{cursor:t?"pointer":void 0,display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",maxWidth:"min(28ch, 100%)",overflow:"hidden",letterSpacing:"0.01em",border:`1px solid ${o?"var(--graview-accent)":s===void 0?"var(--graview-edge)":`hsl(${s} 55% var(--graview-tint-lightness) / 0.45)`}`,background:s===void 0?"var(--graview-panel-muted)":`hsl(${s} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * 0.65))`,color:"var(--graview-ink, #1a1a1a)",boxShadow:o?"0 0 14px -4px var(--graview-accent)":void 0},children:[s===void 0?null:(0,a.jsx)("span",{"aria-hidden":"true",style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",marginRight:6,background:`hsl(${s} 55% var(--graview-tint-lightness) / 0.9)`}}),(0,a.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function L({items:e,max:l=8,selectedIds:o=[],pick:r=!1}){let t=e.slice(0,l),d=e.length-t.length;return(0,a.jsxs)("div",{"data-graview-primitive":"roster",style:{display:"flex",flexWrap:"wrap",gap:6,alignContent:"flex-start"},children:[t.map(i=>(0,a.jsx)(h,{label:i.label,...i.hue===void 0?{}:{hue:i.hue},...r?{pickId:i.id}:{},...i.emphasis===void 0?{}:{emphasis:i.emphasis},selected:o.includes(i.id)},i.id)),d>0?(0,a.jsx)(h,{label:`+${d} more`}):null]})}function F({label:e,count:l,items:o,onExpand:r,flagged:t,problems:d}){return(0,a.jsx)(E,{title:e,meta:d?(0,a.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[d,(0,a.jsx)("span",{children:l})]}):l,tone:t?"warning":"muted",style:r?{cursor:"zoom-in"}:void 0,children:o&&o.length>0?(0,a.jsx)(L,{items:o,max:6,pick:!0}):null})}export{A as a,I as b,E as c,h as d,L as e,F as f};
1
+ import{m}from"./chunk.H3IGXHZR.js";import{G as N,W as f,_ as y}from"./chunk.3VEZ5MOC.js";import{b as g}from"./chunk.AJZBJBMO.js";var p=g(N(),1);var a=g(f(),1);var R={default:{background:"var(--graview-panel, #ffffff)",color:"var(--graview-ink, #1a1a1a)"},muted:{background:"var(--graview-panel-muted, #f7f5f1)",color:"var(--graview-ink, #1a1a1a)"},warning:{background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)"}},T={color:"var(--graview-ink-muted, #55514a)"},C={color:"var(--graview-ink-faint, #625d55)"};function H(e){let[l,o]=(0,p.useState)(z);return(0,p.useEffect)(()=>{let r=e.current;if(!r||typeof ResizeObserver>"u")return;let t=()=>{let i=W(r,parseFloat(getComputedStyle(r).paddingBottom)||0);o(s=>s.overflowing===i.overflowing&&s.above===i.above&&s.below===i.below?s:i)};t();let d=new ResizeObserver(t);d.observe(r);for(let i of r.children)d.observe(i);return r.addEventListener("scroll",t,{passive:!0}),()=>{d.disconnect(),r.removeEventListener("scroll",t)}}),l}var z={overflowing:!1,above:!1,below:!1};function W(e,l=0){let o=e.scrollHeight>e.clientHeight+1,r=e.scrollWidth>e.clientWidth+1;return{overflowing:o||r,above:o&&e.scrollTop>1,below:o&&e.scrollTop+e.clientHeight<e.scrollHeight-l-1}}var A=(0,p.createContext)(null),I=(0,p.createContext)(null);function O({level:e,said:l=!0,style:o,children:r}){if(e===void 0)return(0,a.jsx)("strong",{style:o,...l?{}:{"aria-hidden":!0},children:r});let t=`h${e}`;return(0,a.jsx)(t,{style:{margin:0,...o},children:r})}function E({title:e,subtitle:l,meta:o,selected:r,tone:t="default",children:d,style:i,fit:s=!1,variant:w,heading:b}){let c=(0,p.useRef)(null),{overflowing:v,above:x,below:S}=H(c),P=y(),n=(w??(P==="fullscreen"?"page":"card"))==="page",k=(0,p.useContext)(A),u=(0,p.useContext)(I);return(0,a.jsxs)("div",{"data-graview-primitive":"panel","data-graview-variant":n?"page":"card","data-selected":r||void 0,style:{display:"flex",flexDirection:"column",gap:n?12:"var(--graview-gap, 7px)",height:n||s?"auto":"100%",maxHeight:n?"none":"100%",padding:n?0:"var(--graview-pad, 15px)",boxSizing:"border-box",borderRadius:n?0:"var(--graview-radius, 12px)",border:n?"none":`1px solid ${r?"var(--graview-accent, #2f6f5e)":"var(--graview-edge, #e4e0d8)"}`,boxShadow:n?"none":r?"0 0 0 1px var(--graview-accent-dim), var(--graview-lift-low)":"var(--graview-lift-low)",overflow:n?"visible":"hidden",...R[t],...n?{background:"transparent"}:{},...i},children:[t==="warning"?(0,a.jsx)("span",{"data-graview-broken":"",style:m,children:"Implicated in a problem."}):null,e===void 0||e===k?null:(0,a.jsxs)("div",{style:{display:"flex",alignItems:"baseline",flexWrap:"wrap",gap:8,minWidth:0},children:[t==="warning"?(0,a.jsx)("span",{"aria-hidden":"true",title:"Implicated in a problem",style:{color:"var(--graview-warn)",flex:"0 0 auto"},children:"\u26A0"}):null,(0,a.jsx)(O,{level:b,said:u===null||e!==u,style:{fontFamily:"var(--graview-font-display, inherit)",fontSize:n?"1.5625rem":"0.9375rem",lineHeight:n?1.15:1.25,fontWeight:n?600:560,letterSpacing:n?"-0.012em":"0.005em",minWidth:0,overflowWrap:"anywhere"},children:e}),o===void 0?null:(0,a.jsx)("span",{style:{marginLeft:"auto",fontSize:"0.75rem",letterSpacing:"0.08em",textTransform:"uppercase",minWidth:0,overflowWrap:"anywhere",...C},children:o})]}),l===void 0?null:(0,a.jsx)("div",{style:{fontSize:n?"0.90625rem":"0.8125rem",lineHeight:1.5,...T},children:l}),(0,a.jsx)("div",{ref:c,className:n?void 0:"graview-scroll",...v&&!n?{tabIndex:0,role:"region",...typeof e=="string"?{"aria-label":e}:{}}:{},style:{display:"flex",flexDirection:"column",gap:n?22:"var(--graview-gap, 7px)",flex:"1 1 auto",...n?{overflow:"visible"}:{marginBottom:"calc(-1 * var(--graview-pad, 15px))",paddingBottom:"var(--graview-pad, 15px)"},...!n&&!v?{overflow:"hidden"}:{}},"data-graview-more-above":x&&!n?"":void 0,"data-graview-more-below":S&&!n?"":void 0,children:d})]})}function h({label:e,hue:l,selected:o,title:r,pickId:t,emphasis:d}){let i=typeof e=="string"?e:void 0,s=l===void 0?void 0:Math.round(l);return(0,a.jsxs)("span",{"data-graview-primitive":"chip","data-selected":o||void 0,"data-graview-pick":t,"data-graview-emphasis":d,title:r??i,style:{cursor:t?"pointer":void 0,display:"inline-flex",alignItems:"center",alignSelf:"flex-start",minHeight:24,boxSizing:"border-box",padding:"3px 9px",borderRadius:6,fontSize:"0.8125rem",lineHeight:1.5,whiteSpace:"nowrap",maxWidth:"min(28ch, 100%)",overflow:"hidden",letterSpacing:"0.01em",border:`1px solid ${o?"var(--graview-accent)":s===void 0?"var(--graview-edge)":`hsl(${s} 55% var(--graview-tint-lightness) / 0.45)`}`,background:s===void 0?"var(--graview-panel-muted)":`hsl(${s} 55% var(--graview-tint-lightness) / calc(var(--graview-tint-alpha) * 0.65))`,color:"var(--graview-ink, #1a1a1a)",boxShadow:o?"0 0 14px -4px var(--graview-accent)":void 0},children:[s===void 0?null:(0,a.jsx)("span",{"aria-hidden":"true",style:{width:9,height:6,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",flex:"0 0 auto",marginRight:6,background:`hsl(${s} 55% var(--graview-tint-lightness) / 0.9)`}}),(0,a.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e})]})}function L({items:e,max:l=8,selectedIds:o=[],pick:r=!1}){let t=e.slice(0,l),d=e.length-t.length;return(0,a.jsxs)("div",{"data-graview-primitive":"roster",style:{display:"flex",flexWrap:"wrap",gap:6,alignContent:"flex-start"},children:[t.map(i=>(0,a.jsx)(h,{label:i.label,...i.hue===void 0?{}:{hue:i.hue},...r?{pickId:i.id}:{},...i.emphasis===void 0?{}:{emphasis:i.emphasis},selected:o.includes(i.id)},i.id)),d>0?(0,a.jsx)(h,{label:`+${d} more`}):null]})}function F({label:e,count:l,items:o,onExpand:r,flagged:t,problems:d}){return(0,a.jsx)(E,{title:e,meta:d?(0,a.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6},children:[d,(0,a.jsx)("span",{children:l})]}):l,tone:t?"warning":"muted",style:r?{cursor:"zoom-in"}:void 0,children:o&&o.length>0?(0,a.jsx)(L,{items:o,max:6,pick:!0}):null})}export{A as a,I as b,E as c,h as d,L as e,F as f};
@@ -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.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};
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.3VEZ5MOC.js";import{Z as i}from"./chunk.6AANHELP.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,3 @@
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 Ze,b as et}from"./chunk.EGVM24ND.js";import{a as _e,b as Ve,c as je,d as Ye,e as Ke,f as Ge,g as Xe,j as Qe,p as Je,q as xe,r as de,s as Ce}from"./chunk.2TUEBU7X.js";import{d as Ue}from"./chunk.H3W5C3XQ.js";import{A as qe,x as Fe}from"./chunk.CFE3MHWZ.js";import{m as ze}from"./chunk.H3IGXHZR.js";import{G as ke,La as Se,W as Y,ea as We}from"./chunk.3VEZ5MOC.js";import{a as ve}from"./chunk.SDO3U72B.js";import{la as $e,td as W}from"./chunk.6AANHELP.js";import{b as O}from"./chunk.AJZBJBMO.js";var f=O(ke(),1);var G=O(ke(),1);var K=O(Y(),1),N=e=>(e??"").replace(/\s+/g," ").trim();function Et(e){let t=[e];e.shadowRoot&&t.push(e.shadowRoot);for(let a of e.querySelectorAll("[data-worker-view]"))a.shadowRoot&&t.push(a.shadowRoot);return t}function Pt(e){return e instanceof HTMLElement?e.innerText??e.textContent??"":[...e.children].map(t=>t instanceof HTMLElement?t.innerText??t.textContent??"":t.textContent??"").join(" ")}var Tt="li, tr, article, [data-graview-listed], [data-graview-record], [data-record], [data-key]",Rt=/^[\s·•|,:;–—\-+…✓✔×↓↑▸▾☆★⋯]*$/u;function Dt(e,t,a=[]){let c=[],p=(e.ownerDocument??document).createTreeWalker(e,NodeFilter.SHOW_TEXT),l=new Map,i=[...e.querySelectorAll(Tt)].filter(o=>!o.contains(t)&&a.some(s=>o.contains(s)));for(let o=p.nextNode();o;o=p.nextNode()){let s=o.parentElement;if(!s||t.contains(s)||i.some(d=>d.contains(s))||s.closest("button, input, select, textarea, [role='button'], nav, [hidden], [aria-hidden='true'], script, style"))continue;let r=s.closest("a[href]");r&&!r.contains(t)||l.set(s,(l.get(s)??"")+(o.textContent??""))}for(let[o,s]of[...l].flatMap(([r,d])=>d.split(/\s+·\s+/).map(n=>[r,n]))){let r=N(s);if(!(!r||r.length>40||Rt.test(r)||!/[\p{L}\p{N}]/u.test(r)||o.getClientRects().length===0)&&(c.includes(r)||c.push(r),c.length>=6))break}return c}var Mt=/^[\s\p{So}\p{Sk}\p{Sm}\uFE0F·•|–—✓✔×▸▾…-]+|[\s\p{So}\p{Sk}\p{Sm}\uFE0F·•|–—✓✔×▸▾…-]+$/gu,tt=e=>N(e).replace(Mt,"").toLowerCase();function At(e){let t=[],a=(e.ownerDocument??document).createTreeWalker(e,NodeFilter.SHOW_TEXT);for(let c=a.nextNode();c;c=a.nextNode()){let p=N(c.textContent);p&&!c.parentElement?.closest("button, script, style, [hidden], [aria-hidden='true']")&&t.push(p)}return t}function nt(e,t){if(!e)return[];let a=[],c=p=>{let l=N(p);l.length>1&&l.length<80&&!a.some(i=>i.toLowerCase()===l.toLowerCase())&&a.push(l)};for(let p of e.querySelectorAll("[data-key], [data-record]")){let l=p.getAttribute("data-record")??p.getAttribute("data-key")??"",i=At(p),o=l&&t?t(l):void 0;if(o&&i.join(" ").toLowerCase().includes(N(o).toLowerCase()))c(o);else{if(!p.hasAttribute("data-record")&&p.querySelector("[data-record]"))continue;i.length===1&&c(i[0])}}return a.slice(0,40)}function rt(e){let t=[];for(let a of e)for(let c of[a,...a.querySelectorAll("*")]){if(!c.matches("h1, h2, h3, h4, h5, h6, [role='heading']"))continue;let p=c.cloneNode(!0);for(let i of p.querySelectorAll("span"))/^[\s·\d]+$/.test(i.textContent??"")&&i.remove();let l=N(p.textContent).replace(/^[▸▾]\s*/,"");l&&!t.includes(l)&&t.push(l)}return t}function ce(e,t){if(!e?.isConnected)return{headings:[],records:[],text:""};let a=Et(e),c=[],p=[];for(let r of a)for(let d of r.querySelectorAll("h1, h2, h3, [role='heading']")){if(d.closest("[data-graview-popover], [hidden], [aria-hidden='true'], nav"))continue;let n=d.cloneNode(!0);for(let b of n.querySelectorAll("span"))/^[\s·\d]+$/.test(b.textContent??"")&&b.remove();let h=N(n.textContent).replace(/^[▸▾]\s*/,"");h&&(c.push(h),p.push({element:d,said:h}))}let l=new Map,i=new Map;for(let r of t){let d=tt(r);if(!d||l.has(r))continue;let n,h=[];for(let b of a)for(let u of b.querySelectorAll("a, li, p, span, h2, h3, h4, h5, h6, strong, div, button, td"))tt(u.textContent)===d&&(h.push(u),(!n||n.contains(u))&&(n=u));n&&(l.set(r,n),i.set(r,h))}let o=[...l.values()],s=[];for(let[r,d]of l){let n=d;for(let w=d.parentElement;w&&w!==e&&!(w instanceof HTMLBodyElement)&&!(o.some(D=>D!==d&&w.contains(D))||w.matches("main, section, ul, ol, table, tbody, [data-graview-page]"));w=w.parentElement)n=w;let h,b=new Set(t.map(w=>N(w).toLowerCase()));for(let w of p)w.element.getRootNode()!==d.getRootNode()||n.contains(w.element)||w.element.contains(d)||b.has(w.said.toLowerCase())||w.element.compareDocumentPosition(d)&Node.DOCUMENT_POSITION_FOLLOWING&&(h=w.said);let u=d.getBoundingClientRect(),E=Number.parseFloat(getComputedStyle(d).fontSize)||16,q=[...i].flatMap(([w,D])=>w===r?[]:D),B=n;for(let w=n.parentElement;w&&w!==e&&!(w instanceof HTMLBodyElement)&&!(q.some(D=>w.contains(D))||w.matches("main, [data-graview-page], [data-graview-view-root]"));w=w.parentElement)B=w;let te=B instanceof HTMLElement?B.innerText??B.textContent??"":B.textContent??"",v=d.matches("h1, [data-graview-page-title]")||d.closest("h1, [data-graview-page-title]")!==null,$=!v&&n!==d&&[...n.querySelectorAll("button, [role='button'], [role='checkbox'], [aria-pressed], input[type='checkbox'], [data-act]")].some(w=>!w.contains(d)&&!d.contains(w)),A=!v&&d.closest("a[href], [data-record]")!==null;s.push({label:r,top:Math.round(u.top),left:Math.round(u.left),size:E,facts:v?[]:Dt(n,d,q),row:N(te),...h?{under:h}:{},...$?{presses:$}:{},...A?{opens:A}:{}})}return s.sort((r,d)=>r.top-d.top||r.left-d.left),{headings:c,records:s,text:a.map(Pt).join(" ")}}function Ht(e,t,a=0){(0,G.useLayoutEffect)(()=>{let c=0,p=()=>{let l=t.current,i=e?.isConnected?de([e]):null;if(l&&i){let o=Math.max(i.top,0),s=Math.min(i.bottom,innerHeight);l.style.display=s>o?"grid":"none",l.style.left=`${Math.round(i.left-a)}px`,l.style.top=`${Math.round(o-a)}px`,l.style.width=`${Math.round(i.width+2*a)}px`,l.style.height=`${Math.round(s-o+2*a)}px`}c=requestAnimationFrame(p)};return p(),()=>cancelAnimationFrame(c)},[e,t,a])}var It=`@keyframes graview-redesign{0%{background-position:100% 0}100%{background-position:-100% 0}}
2
+ [data-graview-redesigning]{background:linear-gradient(90deg,var(--graview-ground) 0%,color-mix(in srgb,var(--graview-panel) 70%,var(--graview-accent) 6%) 50%,var(--graview-ground) 100%);background-size:200% 100%;animation:graview-redesign 1.6s linear infinite}
3
+ @media (prefers-reduced-motion: reduce){[data-graview-redesigning]{animation:none}}`;function ot({over:e,name:t,said:a}){let c=(0,G.useRef)(null);return Ht(e,c,2),(0,K.jsxs)("div",{ref:c,"data-graview-redesigning":"","data-testid":"redesigning","data-graview-popover":"",style:Lt,children:[(0,K.jsx)("style",{children:It}),(0,K.jsxs)("p",{role:"status","aria-live":"polite",style:Ot,children:[(0,K.jsx)("span",{"aria-hidden":"true",style:Nt,children:"\u2726"})," ",a??`Graview is redesigning \u201C${t}\u201D\u2026`]})]})}var Lt={position:"fixed",display:"none",placeItems:"center",boxSizing:"border-box",borderRadius:12,zIndex:W("popover"),pointerEvents:"auto",overflow:"hidden"},Ot={margin:0,padding:"8px 14px",borderRadius:999,fontSize:"0.9375rem",color:"var(--graview-ink)",background:"var(--graview-float, var(--graview-panel))",border:"1px solid var(--graview-edge)",boxShadow:"var(--graview-lift-low)",position:"sticky",top:16},Nt={color:"var(--graview-accent)"},Pn={position:"fixed",left:"max(12px, calc(50% - 440px))",right:"max(12px, calc(50% - 440px))",bottom:12,zIndex:W("popover"),boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:14,border:"1px solid var(--graview-edge)",background:"var(--graview-float, var(--graview-panel))",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",fontSize:"0.875rem"};var ue={minHeight:34,padding:"0 12px",font:"inherit",borderRadius:8,cursor:"pointer"},Tn={...ue,color:"var(--graview-accent-ink, #fff)",background:"var(--graview-accent)",border:"1px solid var(--graview-accent)"},Rn={...ue,color:"var(--graview-ink)",background:"transparent",border:"1px solid var(--graview-edge)"};var Dn={...ue,minHeight:28,padding:"0 10px",borderRadius:999,border:0,color:"var(--graview-accent-ink, #fff)",background:"var(--graview-accent)"},Mn={...ue,minHeight:28,padding:"0 10px",borderRadius:999,border:0,color:"var(--graview-ink)",background:"transparent"};var P=O(ke(),1);var m=O(Y(),1),Bt=640,Ee=372,$t=1100,at=()=>typeof innerWidth!="number"||innerWidth>=$t?"side":innerWidth>=Bt?"drawer":"sheet";function Wt(){let e=document.querySelector('[data-testid="app-bar"]');return e||([...document.querySelectorAll("header")].find(t=>{let a=t.getBoundingClientRect();return a.top<=1&&a.width>=innerWidth*.8&&a.height>0})??null)}function zt(e){let t=document.querySelector("[data-graview-page-main], main");for(;t?.parentElement&&t.parentElement!==document.body&&!(e&&t.parentElement.contains(e));)t=t.parentElement;return t}function Ft(e){let[t,a]=(0,P.useState)(at);return(0,P.useLayoutEffect)(()=>{let c=document.body.style,p=c.paddingBottom,l=null,i="",o=0,s=(d,n)=>{l&&l!==d&&(l.style.paddingRight=i),d&&d!==l&&(i=d.style.paddingRight),l=d,l&&(l.style.paddingRight=n?`${Ee}px`:i)},r=()=>{let d=at();a(d);let n=Wt(),h=Math.max(0,Math.round(n?.getBoundingClientRect().bottom??0));e.current&&d!=="sheet"&&(e.current.style.top=`${h}px`),s(zt(n),d==="side"),c.paddingBottom=d==="sheet"?`${Math.round((e.current?.getBoundingClientRect().height??0)+16)}px`:p,o=requestAnimationFrame(r)};return r(),()=>{cancelAnimationFrame(o),s(null,!1),c.paddingBottom=p}},[e]),t}var qt=e=>`${Math.floor(e/6e4)}:${String(Math.floor(e%6e4/1e3)).padStart(2,"0")}`;function lt(e){let t=(0,P.useRef)(null),a=(0,P.useRef)(null),c=(0,P.useRef)(null),[p,l]=(0,P.useState)(""),[,i]=(0,P.useState)(0),o=Ft(t);(0,P.useEffect)(()=>{if(!e.working)return;let n=setInterval(()=>i(h=>h+1),1e3);return()=>clearInterval(n)},[e.working]),(0,P.useEffect)(()=>{a.current&&(a.current.scrollTop=a.current.scrollHeight)},[e.talk.length,e.steps.length]),(0,P.useEffect)(()=>{e.working||c.current?.focus({preventScroll:!0})},[e.working,e.phase]);let s=e.talk.map(n=>n.who).lastIndexOf("person"),r=e.steps.length>0?(0,m.jsx)("li",{"data-testid":"better-steps",style:Xt,children:(0,m.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:3},children:e.steps.map((n,h)=>{let b=e.working&&h===e.steps.length-1;return(0,m.jsxs)("li",{"data-testid":"better-step","data-step-kind":n.kind,style:{display:"flex",gap:6,alignItems:"baseline",color:b?"var(--graview-ink)":"var(--graview-ink-muted)"},children:[(0,m.jsx)("span",{"aria-hidden":"true",style:{width:14,flex:"none",color:n.kind==="check"||n.kind==="stuck"?"var(--graview-warn)":"var(--graview-accent)"},children:b?"\u2026":n.kind==="check"||n.kind==="stuck"?"!":"\u2713"}),(0,m.jsx)("span",{children:n.text})]},`s${h}`)})})}):null,d=e.talk.length===0;return(0,m.jsxs)("aside",{ref:t,role:"complementary","aria-label":`Change how \u201C${e.name}\u201D looks`,"data-testid":"better-panel","data-better-phase":e.phase,"data-better-dock":o,"data-graview-popover":"",style:o==="sheet"?_t:o==="drawer"?Ut:ct,children:[(0,m.jsxs)("header",{style:jt,children:[(0,m.jsxs)("p",{style:{margin:0,fontWeight:600},children:["Change how \u201C",e.name,"\u201D looks"]}),(0,m.jsx)("button",{type:"button","data-testid":"better-close","aria-label":"Close",onClick:e.close,style:Qt,children:"\xD7"})]}),(0,m.jsx)("p",{"data-testid":"better-scope",style:it,children:e.scope}),e.about?(0,m.jsxs)("p",{"data-testid":"better-about",style:Vt,children:["About: ",e.about]}):null,(0,m.jsxs)("ol",{ref:a,"data-testid":"better-talk",style:Yt,children:[e.talk.map((n,h)=>(0,m.jsxs)(P.Fragment,{children:[(0,m.jsx)("li",{"data-testid":"better-message","data-who":n.who,style:n.who==="person"?Kt:Gt,children:n.said}),h===s?r:null]},`t${h}`)),s<0?r:null]}),e.working?(0,m.jsxs)("div",{style:ee,children:[(0,m.jsxs)("p",{role:"status","aria-live":"polite","data-testid":"better-working",style:{margin:0,flex:1,color:"var(--graview-ink-muted)"},children:["Graview is working on \u201C",e.name,"\u201D \xB7 ",(0,m.jsx)("span",{"data-testid":"better-time",children:qt(Date.now()-e.since)})]}),(0,m.jsx)("button",{type:"button","data-testid":"better-stop",onClick:e.stop,style:z,children:"Stop"})]}):null,e.draft&&!e.working?(0,m.jsxs)("div",{"data-testid":"better-draft",style:{flexShrink:0,display:"grid",gap:6},children:[(0,m.jsx)("p",{"data-testid":"better-changed",style:{margin:0},children:e.draft.said}),(0,m.jsxs)("div",{style:ee,children:[(0,m.jsx)("div",{role:"group","aria-label":"Compare",style:Zt,children:["Before","After"].map(n=>{let h=n==="Before"?e.draft.before:!e.draft.before;return(0,m.jsx)("button",{type:"button","data-testid":`better-${n.toLowerCase()}`,"aria-pressed":h,onClick:()=>e.compare(n==="Before"),style:h?en:tn,children:n},n)})}),(0,m.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:6},children:[(0,m.jsx)("button",{type:"button","data-testid":"better-keep",onClick:e.keep,style:st,children:"Keep"}),(0,m.jsx)("button",{type:"button","data-testid":"better-discard",onClick:e.discard,style:z,children:"Discard"})]})]})]}):null,e.stuck&&!e.working?(0,m.jsxs)("div",{"data-testid":"better-stuck",style:ee,children:[e.stuck.keepAnyway?(0,m.jsx)("button",{type:"button","data-testid":"better-keep-anyway",onClick:e.stuck.keepAnyway,style:z,children:"Keep anyway"}):null,(0,m.jsx)("button",{type:"button","data-testid":"better-stuck-stop",onClick:e.stuck.stop,style:z,children:"Stop"})]}):null,e.children,e.kept&&!e.working?(0,m.jsxs)("div",{"data-testid":"better-kept",style:ee,children:[(0,m.jsx)("p",{style:{margin:0,flex:1},children:e.kept.note?/^kept\b/i.test(e.kept.note.trim())?e.kept.note.trim():`Kept. ${e.kept.note}`:"Kept."}),e.kept.undo?(0,m.jsx)("button",{type:"button","data-testid":"better-undo",onClick:e.kept.undo,style:z,children:"Undo"}):null]}):null,d&&!e.working?(0,m.jsxs)("div",{style:ee,children:[(0,m.jsx)("button",{type:"button","data-testid":"better-just",onClick:e.just,style:z,children:"Make it easier to read"}),(0,m.jsx)("button",{type:"button","data-testid":"better-point",onClick:e.point,style:z,children:"Point at a part\u2026"})]}):null,e.pointed&&!e.working?(0,m.jsxs)("p",{"data-testid":"better-pointed",style:it,children:["You pointed at ",e.pointed,"."]}):null,(0,m.jsxs)("form",{onSubmit:n=>{n.preventDefault(),!(!p.trim()||e.working)&&(e.ask(p.trim()),l(""))},style:{flexShrink:0,display:"flex",gap:6},children:[(0,m.jsx)("label",{htmlFor:"graview-better-panel-words",style:ze,children:"Tell Graview what to change"}),(0,m.jsx)("input",{id:"graview-better-panel-words",ref:c,"data-testid":"better-words",value:p,disabled:e.working,onChange:n=>l(n.target.value),placeholder:d?"What should change?":"Tell Graview what to change\u2026",style:Jt}),(0,m.jsx)("button",{type:"submit",disabled:e.working||!p.trim(),"data-testid":"better-send",style:st,children:"Send"})]})]})}var dt={position:"fixed",zIndex:W("popover"),boxSizing:"border-box",display:"flex",flexDirection:"column",gap:10,padding:14,margin:0,fontSize:"0.875rem",lineHeight:1.45,color:"var(--graview-ink)",background:"var(--graview-panel)",overflow:"hidden"},ct={...dt,top:0,right:0,bottom:0,width:Ee,borderLeft:"1px solid var(--graview-edge)"},Ut={...ct,width:`min(${Ee}px, 86vw)`,boxShadow:"var(--graview-lift-high, -12px 0 32px rgba(0,0,0,0.18))"},_t={...dt,left:0,right:0,bottom:0,maxHeight:"55vh",borderTop:"1px solid var(--graview-edge)",borderRadius:"14px 14px 0 0",boxShadow:"var(--graview-lift-high, 0 -12px 32px rgba(0,0,0,0.18))"},Vt={flexShrink:0,margin:0,justifySelf:"start",alignSelf:"flex-start",padding:"2px 10px",borderRadius:999,fontSize:"0.8125rem",color:"var(--graview-ink)",background:"var(--graview-ground)",border:"1px solid var(--graview-edge)"},jt={flexShrink:0,display:"flex",alignItems:"center",gap:8,justifyContent:"space-between"},it={flexShrink:0,margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},Yt={margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:8,overflowY:"auto",flex:"1 1 0",minHeight:0},ut={padding:"7px 10px",borderRadius:10,maxWidth:"88%",whiteSpace:"pre-wrap",flex:"none"},Kt={...ut,alignSelf:"flex-end",background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))"},Gt={...ut,alignSelf:"flex-start",background:"var(--graview-ground)"},Xt={flex:"none",padding:"6px 10px",borderRadius:10,border:"1px dashed var(--graview-edge)",fontSize:"0.8125rem"},ee={flexShrink:0,display:"flex",flexWrap:"wrap",alignItems:"center",gap:6},ge={minHeight:32,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem",cursor:"pointer"},st={...ge,color:"var(--graview-accent-ink, #fff)",background:"var(--graview-accent)",border:"1px solid var(--graview-accent)"},z={...ge,color:"var(--graview-ink)",background:"transparent",border:"1px solid var(--graview-edge)"},Qt={...z,minHeight:28,padding:"0 9px",fontSize:"1rem",lineHeight:1},Jt={flex:"1 1 auto",minWidth:0,minHeight:34,padding:"0 10px",borderRadius:8,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",fontSize:"0.875rem"},Zt={display:"inline-flex",border:"1px solid var(--graview-edge)",borderRadius:999,padding:2},en={...ge,minHeight:28,borderRadius:999,border:"none",color:"var(--graview-accent-ink, #fff)",background:"var(--graview-accent)"},tn={...ge,minHeight:28,borderRadius:999,border:"none",color:"var(--graview-ink)",background:"transparent"};var C=O(Y(),1);var Pe=Se(ve(()=>(__graviewPreload(import.meta.url,["./chunk.6WB2TYK7.js","./chunk.BJUUSIQY.js","./chunk.CE3NKAF7.js","./chunk.GRTBEA7O.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZLNUZ6LR.js")))),nn=Pe.part((e,t)=>(0,C.jsx)(e.RateTelling,{...t}),{quiet:!0});function Yn({ask:e,open:t,close:a}){return e?.part?(0,C.jsx)(on,{ask:e,close:a},e.at):e?.section?(0,C.jsx)(un,{ask:e,close:a},e.at):t?(0,C.jsx)(Ce,{elements:t}):null}var rn=Se(ve(()=>(__graviewPreload(import.meta.url,["./chunk.QM54TGU6.js","./chunk.EGVM24ND.js","./chunk.2TUEBU7X.js","./chunk.NYLKG25K.js","./chunk.TBY5IR7C.js","./chunk.H3W5C3XQ.js","./chunk.6WB2TYK7.js","./chunk.BJUUSIQY.js","./chunk.JGRSUTPJ.js","./chunk.XOZU4OFA.js","./chunk.EP5JS7ZH.js","./chunk.CE3NKAF7.js","./chunk.MIE4TJRW.js","./chunk.CFE3MHWZ.js","./chunk.RD2FSSLV.js","./chunk.HXTKBISQ.js","./chunk.TFJA4QV4.js","./chunk.HWFJQ42Y.js","./chunk.QUETLFBJ.js","./chunk.JULD4XFB.js","./chunk.GRTBEA7O.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.GF3ZCX46.js")))),on=rn.part((e,t)=>(0,C.jsx)(e.PageCard,{...t}),{what:"Make this better"}),an=360,R=12;function Kn(e,t){let a={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},c=Math.min(an,a.width-2*R),p=e.getBoundingClientRect().height,l=s=>Math.max(R,Math.min(s,a.height-p-R)),i=(a.width-c)/2,o=l(72);t&&t.width>0&&(t.right+R+c<=a.width-R?[i,o]=[t.right+R,l(t.top)]:t.left-R-c>=R?[i,o]=[t.left-R-c,l(t.top)]:(i=Math.max(R,Math.min(t.left,a.width-c-R)),o=t.bottom+R+p<=a.height-R?t.bottom+R:l(t.top-R-p))),e.style.left=`${Math.round(i)}px`,e.style.top=`${Math.round(o)}px`,e.style.width=`${Math.round(c)}px`}var sn=e=>e.map(t=>t.innerText??t.textContent??"").join(" ").replace(/\s+/g," ").trim(),gt=e=>{let t=e.getBoundingClientRect();return{tag:(e.getAttribute("data-graview-as")??e.localName).toLowerCase(),classes:[...e.classList],text:e.textContent??"",box:{left:t.left,top:t.top,width:t.width,height:t.height}}};function ln(e,t,a){let c=[...e.querySelectorAll("*")].filter(i=>{let o=i.getBoundingClientRect();return o.width>0&&o.height>0});if(a){let i=c.filter(r=>{let d=r.getBoundingClientRect();return t.left>=d.left&&t.left<=d.right&&t.top>=d.top&&t.top<=d.bottom}),s=i.filter(r=>!i.some(d=>d!==r&&r.contains(d)))[0];if(!s)return[];for(let r=s;r&&r!==e;r=r.parentElement)if(r.classList.length>0||/^(h[1-6]|li|a|button|img|p|article|section)$/.test(r.localName))return[r];return[s]}let p=c.filter(i=>{let o=i.getBoundingClientRect();return o.left>=t.left-2&&o.right<=t.right+2&&o.top>=t.top-2&&o.bottom<=t.bottom+2}),l=p.filter(i=>!p.some(o=>o!==i&&o.contains(i)));for(;l.length===1;){let i=[...l[0].children].filter(o=>p.includes(o));if(i.length<2)break;l=i}return l}function dn(e,t,a={}){let c=s=>({source:s.source,css:s.css,...s.root?{drawing:s.root}:{},...s.height!==void 0?{height:s.height}:{}}),p=et(c(e),c(t)),l=[];for(let s of p.unstyled)l.push(`The class \u201C${s.class}\u201D is still drawn and no rule styles it now.`);let i=s=>s.root?Ze(s.root).map(r=>r.name):[],o=e.root&&t.root?Ke(p.sectionsMissing.map(s=>s.name),i(e),i(t),a):p.sectionsMissing.map(s=>s.name);for(let s of o)l.push(`\u201C${s}\u201D is not drawn any more.`);return l}function cn(e,t,a,c,p,l){let i=c.drawing(),o=dn({source:e,css:t.css,root:t.root,height:t.height},{source:p,css:i.css,root:i.root,height:i.height},l);for(let s of c.refused())a.includes(s)||o.push(s);return o}function un({ask:e,close:t}){let{ai:a,aiDesk:c,aiHere:p,session:l,principal:i,keptViews:o,store:s}=We(),[r,d]=(0,f.useState)(e.section),n=_e(e.section),h=(0,f.useRef)(Fe(n)),b=(0,f.useRef)(null),[u,E]=(0,f.useState)(e.mode==="highlight"?{at:"highlighting"}:{at:"open"}),q=(0,f.useRef)(void 0),B=(0,f.useRef)(null),te=(0,f.useRef)(null),v=(0,f.useRef)([]),$=(0,f.useRef)([]),A=(0,f.useRef)([]),w=(0,f.useRef)(Date.now()),D=(0,f.useRef)(null),ne=(0,f.useRef)(null),re=(0,f.useRef)(null),[mt,fe]=(0,f.useState)(!1),[me,oe]=(0,f.useState)(!1),[,ht]=(0,f.useState)(0),ae=(0,f.useCallback)(()=>ht(g=>g+1),[]),[Te,yt]=(0,f.useState)(null),Re=(0,f.useRef)(null),I=(0,f.useCallback)(g=>{let y=Re.current;y&&a.told&&Pe.load().then(k=>k.changeTelling(a.told,y.id,{outcome:g}),()=>{})},[a.told]),De=(0,f.useCallback)((g,y,k,H,S,ye)=>{let se=a.told;se&&Pe.load().then(L=>{let Z=L.keepTelling(se,{words:g,target:{on:"place",place:y.view},decided:k?{type:"refusal"}:{type:"view",section:y.name},slot:"full",stages:H.map(F=>({stage:F.stage==="thinking"?"full":"light",ms:F.ms,model:F.model})),ms:S,outcome:k?"abandoned":"previewed",interaction:ye},i);Re.current=Z??null,yt(Z??null)},()=>{})},[a.told,i]);(0,f.useEffect)(()=>()=>{D.current?.abort(),b.current?.dispose(),b.current=null},[]);let Me=u.at==="working";(0,f.useEffect)(()=>{if(Me)return p({participant:`agent:graview-for-${i.id??"anyone"}:${l}`,kind:"agent",name:"Graview",...i.id?{onBehalfOf:i.id}:{},over:null,robot:{at:null,mode:"thinking"}}),()=>p(null)},[Me]);let X=(0,f.useCallback)((g,y,k,H={})=>({id:Ue(),at:new Date().toISOString(),by:i,target:{on:"place",place:r.view},targetLabel:h.current?.title??r.view,ask:{kind:"section",said:g},offered:[],outcome:y,stages:k.map(S=>({stage:S.stage,ms:S.ms,model:S.model})),usage:k.flatMap(S=>S.usage?[{tier:S.stage==="light"?"fast":"thinking",model:S.model,inputTokens:S.usage.inputTokens,outputTokens:S.usage.outputTokens}]:[]),...H}),[i,r.view]),U=(0,f.useCallback)(async g=>{b.current?.dispose();let k=h.current.draft(g);return b.current=k,await k.drawn,k},[]),_=(0,f.useCallback)(async()=>{let g=v.current.at(-1);oe(!1),g?await U(g.source):(b.current?.dispose(),b.current=null)},[U]),T=(0,f.useCallback)((g,y)=>{$.current.push({who:g,said:y}),ae()},[ae]),Q=()=>$.current.filter(g=>g.who==="person").map(g=>g.said).join(" "),ie=(0,f.useCallback)(async g=>{let y=h.current;if(!y||u.at==="working")return;let k=ne.current;ne.current=null,k&&(re.current=k),T("person",g),A.current=[],w.current=Date.now(),E({at:"working"});let H=await y.source();if(H===void 0)return T("graview","This view can't be changed here."),E({at:"open"});q.current??=H;let S=y.drawing(),ye=y.refused(),se=x=>{let V=s.graph.getNode(x);return V?$e(s.schema.tryDefinition(V.kind),V):void 0};B.current??=ce(S.root?.parentElement??S.root??n,nt(S.root,se)),te.current??=rt(r.elements);let L=B.current,Z=te.current,F=new AbortController;D.current=F;let St=Date.now(),xt=v.current.length,M=await Je({ai:a,part:{name:r.name,slot:"place"},manifest:{name:y.name,attach:"view",cardinality:"many"},talk:$.current,keep:{title:"",headings:L.headings,records:L.records.map(x=>x.label),says:Object.fromEntries(L.records.flatMap(x=>x.facts?.length||x.under?[[x.label,{...x.facts?.length?{shows:x.facts}:{},...x.under?{under:x.under}:{}}]]:[]))},current:v.current.at(-1)?.source??H,section:r.name,rewordable:Z,noun:"records",...re.current?{about:re.current}:{},host:{look:()=>xe(ce(y.drawing().root?.parentElement??n,L.records.map(x=>x.label))),read:()=>({shows:sn(r.elements)}),draft:async x=>{fe(!0);try{let V=await y.check(x);if(V.length>0)return await _(),{findings:V,drew:void 0};let we=await U(x),{failed:Le}=await we.drawn;if(Le)return await _(),{findings:[`The view did not draw: ${Le}`],drew:void 0};await new Promise(j=>requestAnimationFrame(()=>requestAnimationFrame(j)));let Oe=we.drawing().root,be=ce(Oe?.parentElement??Oe,L.records.map(j=>j.label)),Ct=y.presses?await y.presses(x).catch(()=>{}):void 0,Ne={asked:Q(),mayReword:Z},Be=[...cn(q.current,S,ye,we,x,Ne),...Ge(L,be,Ne),...(Ct?.problems??[]).slice(0,5).map(j=>`${j.control}: ${j.says}`)];return Be.length>0?await _():(v.current.push({source:x,said:Xe(r.name,L,be)??`\u201C${r.name}\u201D has changed. Compare Before and After.`,entry:X(`Make \u201C${r.name}\u201D better: ${Q()}`,"offered",[])}),oe(!1)),{findings:Be,drew:xe(be)}}finally{fe(!1)}}},onEvent:x=>{A.current.at(-1)?.kind==="streaming"&&A.current.pop(),A.current.push(x),ae()},signal:F.signal});if(D.current!==F)return;D.current=null,A.current.at(-1)?.kind==="streaming"&&A.current.pop();let le=v.current.length>xt,Ie=X(`Make \u201C${r.name}\u201D better: ${Q()}`,le?"offered":"failed",M.stages,le?{}:{failed:M.last?.findings.join(" ")??M.said});if(c.record(Ie),De(Q(),r,!le,M.stages,Date.now()-St,Ie.id),T("graview",M.passed&&Qe.test(M.said)?"Here it is on the page.":M.said),M.ended==="stuck"&&!le)return E({at:"stuck",...M.keepable&&M.last?{source:M.last.source}:{}});E(v.current.length>0?{at:"draft"}:{at:"open"})},[a,c,U,X,u.at,n,ae,T,r,_,s,De]),he=(0,f.useCallback)(()=>{if(u.at!=="working")return;let g=D.current;D.current=null,g?.abort(),fe(!1);let y=new Date(w.current).toISOString();v.current=v.current.filter(k=>k.entry.at<y),_(),T("graview","Stopped. The view is as it was."),E(v.current.length>0?{at:"draft"}:{at:"open"})},[u.at,T,_]),Ae=(0,f.useRef)(!1);(0,f.useEffect)(()=>{Ae.current||!(e.mode==="just"||e.mode==="describe"&&e.words)||(Ae.current=!0,ie(e.mode==="just"?"Make it easier to read at a glance":e.words))},[e.mode,e.words,ie]);let J=v.current.at(-1),wt=(0,f.useCallback)(async g=>{!J||g===me||(oe(g),g?(b.current?.dispose(),b.current=null):await U(J.source))},[J,me,U]),He=(0,f.useCallback)(async g=>{g!==void 0&&u.at==="stuck"&&v.current.push({source:g,said:`\u201C${r.name}\u201D kept as it was last drafted.`,entry:X(`Make \u201C${r.name}\u201D better: ${Q()}`,"offered",[])});let y=v.current.at(-1);if(u.at!=="draft"&&!(g!==void 0&&u.at==="stuck")||!y||!o?.revise||!h.current)return;let k=h.current,H=await k.source()??"";E({at:"keeping"});try{let S=await o.revise({name:k.name,title:k.title,source:y.source,before:H,section:r.name,said:y.said});b.current?.dispose(),b.current=null,k.draw(y.source),c.record({...y.entry,outcome:"accepted"}),I("accepted"),v.current=[],E({at:"kept",source:H,...S&&S.note?{note:S.note}:{},answer:S,entry:y.entry})}catch{if(T("graview","It couldn't be kept."),g!==void 0)return v.current.pop(),E(v.current.length>0?{at:"draft"}:{at:"open"});E({at:"draft"})}},[u,o,c,r.name,I,T,X]),bt=(0,f.useCallback)(()=>{T("graview","Stopped. The view is as it was."),E(v.current.length>0?{at:"draft"}:{at:"open"})},[T]),vt=(0,f.useCallback)(()=>{b.current?.dispose(),b.current=null;let g=v.current.at(-1);g&&(c.record({...g.entry,outcome:"dismissed"}),I("declined")),v.current=[],oe(!1),T("graview","Put back as it was."),E({at:"open"})},[c,I,T]),kt=(0,f.useCallback)(async()=>{if(u.at!=="kept"||!h.current)return;let g=h.current,y=await g.source()??"";try{u.answer&&typeof u.answer.undo=="function"?await u.answer.undo():await o?.revise?.({name:g.name,title:g.title,source:u.source,before:y,section:r.name,said:"Put back as it was.",undoes:!0}),g.draw(u.source===q.current?void 0:u.source),c.record({...u.entry,outcome:"dismissed"}),I("undone"),T("graview","Undone. The view is as it was."),E({at:"undone"})}catch{T("graview","It couldn't be put back.")}},[u,o,c,r.name,I,T]);return(0,f.useEffect)(()=>{let g=y=>{if(!(y.key!=="Escape"||u.at==="highlighting")){if(y.preventDefault(),u.at==="working")return he();v.current.length>0&&I("declined"),t(),e.returnTo?.focus?.()}};return document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[u.at,he,t,I,e.returnTo]),u.at==="highlighting"?(0,C.jsx)(gn,{box:n,root:n?.querySelector("[data-worker-view]")?.shadowRoot?.querySelector("[data-graview-view-root]")??void 0,whole:r.elements,cancel:()=>E({at:"open"}),chose:g=>{let y=g[0],k=y?qe(y):void 0;d(k??r),ne.current={name:Ye(g)??Ve(g.map(gt)),lines:je(g.map(gt))},E({at:"open"})}}):(0,C.jsxs)(C.Fragment,{children:[r.elements.length>0&&u.at==="open"&&$.current.length===0?(0,C.jsx)(Ce,{elements:r.elements}):null,mt?(0,C.jsx)(ot,{over:n,name:r.name,said:`Graview is drafting \u201C${r.name}\u201D\u2026`}):null,(0,C.jsx)(lt,{name:r.name,scope:`This changes how \u201C${r.name}\u201D looks for everyone in this app.`,phase:u.at,talk:$.current,steps:A.current,since:w.current,working:u.at==="working"||u.at==="keeping",...J&&u.at==="draft"?{draft:{said:J.said,before:me}}:{},...u.at==="kept"?{kept:{...u.note?{note:u.note}:{},undo:()=>void kt()}}:{},...u.at==="stuck"?{stuck:{...u.source!==void 0?{keepAnyway:()=>void He(u.source)}:{},stop:bt}}:{},about:(ne.current??re.current)?.name??r.name,ask:g=>void ie(g),just:()=>void ie("Make it easier to read at a glance"),point:()=>E({at:"highlighting"}),stop:he,compare:g=>void wt(g),keep:()=>void He(),discard:vt,close:()=>{D.current?.abort(),v.current.length>0&&I("declined"),t()},children:Te&&a.told&&u.at!=="working"?(0,C.jsx)(nn,{told:a.told,telling:Te}):null})]})}function gn({box:e,root:t,whole:a,wholeSaid:c="The whole section",cancel:p,chose:l}){let i=(0,f.useRef)(null),[o,s]=(0,f.useState)(null);(0,f.useLayoutEffect)(()=>{let n=0,h=()=>{let b=e?de([e]):null,u=i.current;u&&b&&(u.style.left=`${Math.round(b.left-pe)}px`,u.style.top=`${Math.round(b.top-pe)}px`,u.style.width=`${Math.round(b.width+2*pe)}px`,u.style.height=`${Math.round(b.height+2*pe)}px`),n=requestAnimationFrame(h)};return h(),()=>cancelAnimationFrame(n)},[e]),(0,f.useEffect)(()=>{i.current?.focus()},[]);let r=n=>{if(!o||!t)return s(null);let h=Math.hypot(n.clientX-o.x0,n.clientY-o.y0)>4,b={left:Math.min(o.x0,n.clientX),top:Math.min(o.y0,n.clientY),right:Math.max(o.x0,n.clientX),bottom:Math.max(o.y0,n.clientY)};s(null);let u=ln(t,b,!h);u.length>0&&l(u)},d=o?{left:Math.min(o.x0,o.x1),top:Math.min(o.y0,o.y1),width:Math.abs(o.x1-o.x0),height:Math.abs(o.y1-o.y0)}:null;return(0,C.jsxs)("div",{ref:i,tabIndex:-1,role:"application","aria-label":"Highlight the area to change: drag over it, or click one part","data-testid":"section-highlighter","data-graview-popover":"",onKeyDown:n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),p())},onMouseDown:n=>n.preventDefault(),onPointerDown:n=>{n.preventDefault(),n.currentTarget.setPointerCapture?.(n.pointerId),s({x0:n.clientX,y0:n.clientY,x1:n.clientX,y1:n.clientY})},onPointerMove:n=>s(h=>h&&{...h,x1:n.clientX,y1:n.clientY}),onPointerUp:r,onPointerCancel:()=>s(null),style:kn,children:[(0,C.jsxs)("p",{style:Sn,children:["Drag over the part to change, or click one \xB7"," ",(0,C.jsx)("button",{type:"button",onPointerDown:n=>n.stopPropagation(),onClick:()=>l(a),style:pt,children:c})," ","\xB7"," ",(0,C.jsx)("button",{type:"button",onPointerDown:n=>n.stopPropagation(),onClick:p,style:pt,children:"Cancel"})]}),d?(0,C.jsx)("div",{"data-testid":"section-drag",style:{...xn,left:d.left-(i.current?.getBoundingClientRect().left??0),top:d.top-(i.current?.getBoundingClientRect().top??0),width:d.width,height:d.height}}):null]})}var pn={position:"fixed",zIndex:W("popover"),boxSizing:"border-box",display:"grid",gap:10,padding:12,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float, var(--graview-panel))",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",maxHeight:"calc(100dvh - 24px)",overflowY:"auto",fontSize:"0.875rem"},fn={margin:0,fontSize:"0.9375rem"},mn={margin:0,color:"var(--graview-ink-muted)"},hn={margin:0,color:"var(--graview-ink)",fontStyle:"italic"},yn={display:"flex",flexWrap:"wrap",gap:8},wn={boxSizing:"border-box",width:"100%",height:36,padding:"0 10px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8},ft={minHeight:36,padding:"0 14px",font:"inherit",borderRadius:8,cursor:"pointer"},bn={...ft,color:"var(--graview-accent-ink, #fff)",background:"var(--graview-accent)",border:"1px solid var(--graview-accent)"},vn={...ft,color:"var(--graview-ink)",background:"transparent",border:"1px solid var(--graview-edge)"},pt={font:"inherit",color:"inherit",background:"none",border:0,padding:0,textDecoration:"underline",cursor:"pointer"},pe=12,kn={userSelect:"none",WebkitUserSelect:"none",position:"fixed",zIndex:W("popover"),boxSizing:"border-box",cursor:"crosshair",touchAction:"none",outline:"2px dashed var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 6%, transparent)"},Sn={position:"absolute",left:8,top:8,margin:0,padding:"4px 10px",borderRadius:999,fontSize:"0.8125rem",color:"var(--graview-ink)",background:"var(--graview-float, var(--graview-panel))",border:"1px solid var(--graview-edge)",boxShadow:"var(--graview-lift-low)",cursor:"default"},xn={position:"absolute",border:"2px solid var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 14%, transparent)",borderRadius:4,pointerEvents:"none"},Gn={CARD:pn,HEAD:fn,MUTED:mn,THINKING:hn,ROW:yn,FIELD:wn,PRIMARY:bn,QUIET:vn};export{ce as a,ot as b,lt as c,Yn as d,Kn as e,gt as f,dn as g,un as h,gn as i,Gn as j};
@@ -1 +1 @@
1
- import"./chunk.WVUJXDXZ.js";import{a as F,b as K,c as pe}from"./chunk.DWM7AR5Y.js";import"./chunk.6KJGRM7A.js";import"./chunk.WALVW3KJ.js";import"./chunk.SNHKYH72.js";import"./chunk.UGQYMN4J.js";import"./chunk.RG5G6YQD.js";import"./chunk.MIE4TJRW.js";import{o as me}from"./chunk.QRQ5WPZI.js";import"./chunk.RD2FSSLV.js";import"./chunk.37RFCHSS.js";import"./chunk.SO6NT5K7.js";import"./chunk.MUSMNKE4.js";import"./chunk.SJQPTDAT.js";import"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{G as Te,N as C,R as ue,W as ce,ea as ge,ha as he}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{Aa as E,Ba as se,Ca as Y,ra as oe,sd as de,va as x,xa as le,za as W}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as q}from"./chunk.AJZBJBMO.js";var g=q(Te(),1);async function ye(e,t){let a=await createImageBitmap(e);try{let i=Math.min(1,t/Math.max(a.width,a.height)),r=document.createElement("canvas");r.width=Math.max(1,Math.round(a.width*i)),r.height=Math.max(1,Math.round(a.height*i));let l=r.getContext("2d");if(l===null)throw new Error("This browser will not give us a canvas to resize with.");return l.drawImage(a,0,0,r.width,r.height),r}finally{a.close()}}var n=q(ce(),1),He=2048,Ie=.85;function T(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function H(e){if(e.type==="application/pdf")return"PDF";let t=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return t?t.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ke(e){let t=[...new Set(e.map(a=>a==="image/*"?"pictures":a==="video/*"?"videos":a==="*/*"||a==="*"?"any file":`${H({type:a})} files`))];return t.length<=1?t[0]??"no files":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function xe(e,t){if(e.length===0)return!0;let a=`${t.split("/")[0]}/*`;return e.some(i=>i==="*"||i==="*/*"||i===t||i===a)}var fe=/^image\/hei[cf]$|\.hei[cf]$/i,be=e=>fe.test(e.type)||fe.test(e.name),De={mov:"video/quicktime",mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",ogv:"video/ogg"},Be=e=>De[/\.([a-z0-9]{2,4})$/i.exec(e)?.[1]?.toLowerCase()??""];async function je(e,t,a){let i=e.name||(a.camera?"photo.jpg":"file"),r=e.type||(be({type:"",name:i})?"image/heic":Be(i)??"application/octet-stream"),l=be({type:r,name:i}),u=r.startsWith("image/")||l;if(a.image&&!u)return{refused:`\u201C${i}\u201D isn\u2019t a picture.`};if(a.video)return r.startsWith("video/")?J({blob:e,name:i,type:r},t):{refused:`\u201C${i}\u201D isn\u2019t a video.`};if(l||u&&/^image\/(jpeg|webp)$/.test(r)&&(a.camera||e.size>t.maxBytes||e.size>15e5))try{let c=await ye(e,He),b=await new Promise(m=>c.toBlob(m,"image/jpeg",Ie));if(b)return J({blob:b,name:l?i.replace(/\.hei[cf]$/i,"")+".jpg":i,type:"image/jpeg",width:c.width,height:c.height},t)}catch{if(l&&!xe(t.kinds,r))return{refused:`\u201C${i}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let p={};if(u&&!l)try{let c=await createImageBitmap(e);p={width:c.width,height:c.height},c.close()}catch{}return J({blob:e,name:i,type:r,...p},t)}function J(e,t){return xe(t.kinds,e.type)?e.blob.size>t.maxBytes?{refused:`\u201C${e.name}\u201D is ${T(e.blob.size)}; this host takes files up to ${T(t.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${H(e)} file; this host takes ${ke(t.kinds)}.`}}async function _e(e,t,a,i=!1){let r;try{r=await t.upload(e.blob,e.name)}catch(u){let s=u instanceof Error&&u.message.trim()?u.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${s}`}}return le(r)?a&&!W(r)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:i&&!E(r)?{refused:`The host kept \u201C${e.name}\u201D as ${H(r)}, not as a video.`}:{...r,...r.width===void 0&&e.width?{width:e.width}:{},...r.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var $="var(--graview-radius, 8px)",P={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function ee(e){let t=C(),a=ue()?.past!=null,[i,r]=(0,g.useState)(!1),l=t?.kept?ze(t,e.href):!0,[,u]=(0,g.useState)(0);return(0,g.useEffect)(()=>{if(typeof l!="object")return;let s=!0;return l.then(()=>s&&u(p=>p+1)),()=>void(s=!1)},[l]),[l===!1||a&&i,()=>r(!0)]}var Q=new WeakMap;function ze(e,t){let a=Q.get(e)?.get(t);if(a!==void 0)return a;let i;try{i=e.kept(t)}catch{return!0}if(typeof i=="boolean")return i;let r=Q.get(e)??new Map;Q.set(e,r);let l=Promise.resolve(i).then(u=>u!==!1,()=>!0);return r.set(t,l),l.then(u=>r.set(t,u)),l}function te({file:e,style:t}){return(0,n.jsx)("span",{role:"img","aria-label":`${F(e)}, removed later`,"data-graview-removed-later":e.href,style:{display:"grid",placeItems:"center",textAlign:"center",padding:4,boxSizing:"border-box",fontSize:"0.6875rem",lineHeight:1.2,color:"var(--graview-ink-muted)",border:"1px dashed var(--graview-edge-bright)",borderRadius:$,...t},children:"removed later"})}function X({file:e,size:t=56,style:a}){let i=C(),[r,l]=ee(e);return r?(0,n.jsx)(te,{file:e,style:{width:t,height:t,flex:"none",...a}}):E(e)?(0,n.jsx)(Ae,{file:e,size:t,...a?{style:a}:{},onError:l}):(0,n.jsx)("img",{onError:l,src:x(i,e.href),alt:F(e),width:t,height:t,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:t,height:t,objectFit:"cover",borderRadius:$,display:"block",flex:"none",background:"var(--graview-edge)",...a}})}function Fe(e){let[t,a]=(0,g.useState)({}),i=e.duration??t.duration;return[{...i!==void 0?{duration:i}:{},width:e.width??t.width,height:e.height??t.height},u=>{let s=u.currentTarget;a({...Number.isFinite(s.duration)&&s.duration>0?{duration:s.duration}:{},...s.videoWidth>0&&s.videoHeight>0?{width:s.videoWidth,height:s.videoHeight}:{}})}]}var Ne=320,$e=(e,t)=>`${F(e)}, ${se({...t!==void 0?{duration:t}:{}})}`,Oe=(0,n.jsx)("span",{"data-graview-play-glyph":"","aria-hidden":"true",style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,n.jsxs)("svg",{viewBox:"0 0 24 24",width:"40%",height:"40%",style:{maxWidth:40,maxHeight:40,filter:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.5))"},children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"11",fill:"rgb(0 0 0 / 0.55)"}),(0,n.jsx)("path",{d:"M9.5 7.5v9l7-4.5z",fill:"#fff"})]})});function Ae({file:e,size:t,style:a,onError:i}){let r=C(),[l,u]=Fe(e),s={width:t,height:t,objectFit:"cover",display:"block",borderRadius:$,background:"var(--graview-edge)"};return(0,n.jsxs)("span",{role:"img","aria-label":$e(e,l.duration),"data-graview-thumb":e.href,"data-graview-video-thumb":"",style:{position:"relative",display:"block",width:t,height:t,flex:"none",...a},children:[e.poster?(0,n.jsx)("img",{src:x(r,e.poster),alt:"",width:t,height:t,loading:"lazy",decoding:"async",onError:i,style:s}):(0,n.jsx)("video",{src:x(r,e.href),preload:"metadata",muted:!0,playsInline:!0,"aria-hidden":"true",tabIndex:-1,width:t,height:t,onLoadedMetadata:u,onError:i,style:s}),Oe,l.duration!==void 0?(0,n.jsx)("span",{"data-graview-video-clock":"","aria-hidden":"true",style:{position:"absolute",right:3,bottom:3,padding:"0 4px",borderRadius:4,background:"rgb(0 0 0 / 0.65)",color:"#fff",fontSize:"0.6875rem",lineHeight:"16px",fontVariantNumeric:"tabular-nums"},children:K(l.duration)}):null]})}function Ge(){let e=()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):void 0,[t,a]=(0,g.useState)(()=>e()?.matches===!0);return(0,g.useEffect)(()=>{let i=e();if(!i)return;let r=()=>a(i.matches);return r(),i.addEventListener?.("change",r),()=>i.removeEventListener?.("change",r)},[]),t}function Ue({file:e,autoplay:t=!1,cover:a=!1}){let i=C(),[r,l]=ee(e),[u,s]=Fe(e),p=Ge(),c=t&&p,b=(0,g.useRef)(null),m=(0,g.useRef)(c);if((0,g.useEffect)(()=>{let d=b.current;!d||!t||(c?d.pause():m.current&&d.play?.()?.catch?.(()=>{}),m.current=c)},[t,c]),r)return(0,n.jsx)(te,{file:e,style:{width:"100%",aspectRatio:"16 / 9"}});let v=u.width!==void 0&&u.height!==void 0,w=a?{display:"block",width:"100%",height:"100%",objectFit:"cover",background:"#000"}:{display:"block",width:"100%",maxWidth:v?Math.max(u.width,Ne):"100%",height:"auto",maxHeight:"80vh",aspectRatio:v?`${u.width} / ${u.height}`:"16 / 9",borderRadius:$,background:"#000"};return(0,n.jsxs)("figure",{"data-graview-video-figure":e.href,style:{margin:0,display:"grid",gap:4,minWidth:0,...a?{height:"100%"}:{}},children:[(0,n.jsx)("video",{ref:b,"data-graview-video":e.href,...t?{"data-graview-video-autoplay":""}:{},...a?{"data-graview-video-cover":""}:{},...c?{"data-graview-video-still":""}:{},src:x(i,e.href),...e.poster?{poster:x(i,e.poster)}:{},...t?{muted:!0,loop:!0,...c?{}:{autoPlay:!0}}:{controls:!0},preload:t&&!c?"auto":"metadata",playsInline:!0,...v?{width:u.width,height:u.height}:{},"aria-label":$e(e,u.duration),onLoadedMetadata:s,onError:l,style:w,children:e.captions?(0,n.jsx)("track",{kind:"captions",src:x(i,e.captions),srcLang:"en",label:"Captions",default:!0}):null}),t?null:(0,n.jsx)("figcaption",{"data-graview-video-said":"",style:P,children:[e.caption??e.name,...u.duration!==void 0?[K(u.duration)]:[]].join(" \xB7 ")})]})}function qe({file:e,onOpen:t}){let a=C(),[i,r]=ee(e);return i?(0,n.jsx)(te,{file:e,style:{width:"100%",aspectRatio:"1"}}):(0,n.jsx)("button",{type:"button","aria-label":`Open ${F(e)} full size`,onClick:l=>t(l.currentTarget),style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:$},children:(0,n.jsx)("img",{src:x(a,e.href),alt:F(e),loading:"lazy",decoding:"async",onError:r,style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:$,display:"block",background:"var(--graview-edge)"}})})}function Ye({src:e,file:t}){let[a,i]=(0,g.useState)(!1);return(0,n.jsx)("object",{data:e,type:"application/pdf","aria-label":F(t),"data-graview-pdf":a?"shown":"waiting",onLoad:()=>i(!0),style:a?{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:$}:{width:"100%",height:0,display:"block"}})}function Z({files:e,label:t,autoplay:a,cover:i}){let r=C(),l=d=>x(r,d.href),u=e.filter(W),s=e.filter(E),p=e.filter(d=>!W(d)&&!E(d)),[c,b]=(0,g.useState)(null),m=(0,g.useRef)(null),v=(0,g.useRef)(null);(0,g.useEffect)(()=>{let d=m.current;c!==null&&d&&!d.open&&d.showModal?.()},[c]);let w=c===null?void 0:u[c];return(0,n.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[u.length>0?(0,n.jsx)("ul",{"data-graview-gallery":"","aria-label":t,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:u.map((d,I)=>(0,n.jsx)("li",{style:{minWidth:0},children:(0,n.jsx)(qe,{file:d,onOpen:M=>{v.current=M,b(I)}})},d.href))}):null,s.length>0?(0,n.jsx)("ul",{"data-graview-videos":"","aria-label":t,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:12},children:s.map(d=>(0,n.jsx)("li",{style:{minWidth:0},children:(0,n.jsx)(Ue,{file:d,...a?{autoplay:a}:{},...i?{cover:i}:{}})},d.href))}):null,p.length>0?(0,n.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:p.map(d=>(0,n.jsxs)("li",{"data-graview-document":d.type,style:{display:"grid",gap:6,minWidth:0},children:[d.type==="application/pdf"?(0,n.jsx)(Ye,{src:l(d),file:d}):null,d.type==="application/pdf"?(0,n.jsxs)("span",{"data-graview-file-line":"",style:{minWidth:0,overflowWrap:"anywhere",lineHeight:1.5},children:[d.name," ",(0,n.jsxs)("span",{style:P,children:["\xB7 ",H(d)," \xB7 ",T(d.bytes)," \u2014"]})," ",(0,n.jsx)("a",{href:l(d),target:"_blank",rel:"noopener",children:"Open"})," ",(0,n.jsx)("span",{style:P,"aria-hidden":"true",children:"/"})," ",(0,n.jsx)("a",{href:l(d),download:d.name,children:"Download"})]}):(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,n.jsx)("a",{href:l(d),download:d.name,children:d.name}),(0,n.jsxs)("span",{style:P,children:[H(d)," \xB7 ",T(d.bytes)]})]}),d.caption?(0,n.jsx)("span",{style:P,children:d.caption}):null]},d.href))}):null,w?(0,n.jsx)("dialog",{ref:m,"data-graview-full":w.href,"aria-label":F(w),onClose:()=>{b(null),v.current?.focus()},onClick:d=>{d.target===d.currentTarget&&d.currentTarget.close()},style:{padding:0,border:0,borderRadius:$,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,n.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,n.jsx)("img",{src:l(w),alt:F(w),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,n.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,n.jsx)("span",{children:w.caption??w.name}),(0,n.jsx)("form",{method:"dialog",style:{margin:0},children:(0,n.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function Se({value:e,onChange:t,several:a,image:i,video:r=!1,label:l,thumbs:u=!0}){let s=C(),p=(0,g.useId)(),c=(0,g.useRef)(null),b=(0,g.useRef)(null),[m,v]=(0,g.useState)(null),[w,d]=(0,g.useState)(null),[I,M]=(0,g.useState)([]),[O,A]=(0,g.useState)(!1),L=i?"image/":r?"video/":void 0,R=s?L?s.kinds.filter(o=>o.startsWith(L)||o==="*"||o==="*/*"):s.kinds:[],Pe=s?s.kinds.length===0||R.length>0:!1,We=!r&&(s?s.kinds.length===0||(i?R:s.kinds).some(o=>o.startsWith("image/")||o.startsWith("*")):!1),ne=!!s&&s.maxBytes>0,D=ne&&(!L||Pe),B=i?"picture":r?"video":"file",ae=a?`${B}s`:`a ${B}`,ie=L?R.length>0?R.join(","):`${L}*`:s?.kinds.join(",")||void 0,Me=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,G=(0,g.useRef)(e);G.current=e;let re=(0,g.useRef)(null),j=(0,g.useRef)(null);(0,g.useEffect)(()=>{let o=j.current;if(!o||o.from===e)return;j.current=null;let h=re.current?.children,f=h?.[Math.min(o.at,h.length-1)];((o.what==="move"?f?.querySelector("[data-graview-file-move]"):null)??f?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let _=async(o,h)=>{if(!s||o.length===0)return;let f=a?o:o.slice(0,1),y=[],S=[];f.length<o.length&&S.push(`${l} holds one ${B}, so ${o.slice(1).map(k=>`\u201C${k.name||"the photo"}\u201D`).join(", ")} ${o.length>2?"were":"was"} left out.`),M([]),d(null);for(let k of f){v(`Sending ${k.name||"the photo"}\u2026`);let U=await je(k,s,{image:i,video:r,camera:h==="camera"});if("refused"in U){S.push(U.refused);continue}let V=await _e(U,s,i,r);"refused"in V?S.push(V.refused):[...a?G.current:[],...y].some(Ve=>Ve.href===V.href)?S.push(`\u201C${V.name}\u201D is already here.`):y.push(V)}if(v(null),M(S),y.length!==0)try{t(a?[...G.current,...y]:y.slice(-1)),d(`Added ${y.map(k=>k.name).join(", ")}.`)}catch(k){M([...S,k instanceof Error?k.message:String(k)])}},z=(o,h,f)=>{try{j.current=f?{...f,from:e}:null,t(o),d(h)}catch(y){j.current=null,M([y instanceof Error?y.message:String(y)])}},N=o=>o?Array.from(o):[],Re=o=>{let h=N(o.clipboardData?.files);!D||h.length===0||(o.preventDefault(),_(h,"pasted"))},Le=o=>{A(!1),D&&(o.preventDefault(),_(N(o.dataTransfer?.files),"dropped"))};return(0,n.jsxs)("div",{role:"group","aria-labelledby":`${p}-label`,"data-graview-file-editor":"","data-graview-dropping":O?"":void 0,onPaste:Re,onDragOver:o=>{D&&(o.preventDefault(),A(!0))},onDragLeave:()=>A(!1),onDrop:Le,style:{display:"grid",gap:8,minWidth:0,padding:O?6:0,outline:O?"2px dashed var(--graview-accent)":"none",borderRadius:$},children:[(0,n.jsx)("span",{id:`${p}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:l}),e.length>0&&(a||e.length>1)?(0,n.jsx)("ul",{ref:re,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((o,h)=>(0,n.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[u&&(W(o)||E(o))?(0,n.jsx)(X,{file:o,size:40}):null,(0,n.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:o.name}),(0,n.jsx)(we,{file:o,onCaption:f=>z(e.map((y,S)=>S===h?ve(y,f):y),f?`${o.name} now says \u201C${f}\u201D.`:`${o.name} says its name again.`)}),a&&h>0?(0,n.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${o.name} earlier`,onClick:()=>z(e.map((f,y)=>y===h-1?o:y===h?e[h-1]:f),`Moved ${o.name} earlier.`,{at:h-1,what:"move"}),children:"\u2191"}):null,a?(0,n.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${o.name}`,onClick:()=>z(e.filter((f,y)=>y!==h),`Removed ${o.name}.`,{at:h,what:"remove"}),children:"Remove"}):null]},`${h}:${o.href}`))}):e.length===1?(0,n.jsx)(we,{file:e[0],onCaption:o=>z([ve(e[0],o)],o?`${e[0].name} now says \u201C${o}\u201D.`:`${e[0].name} says its name again.`)}):null,D?(0,n.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,n.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:a,...ie?{accept:ie}:{},"data-graview-file-input":"","aria-label":`Choose ${ae}`,onChange:o=>{let h=N(o.currentTarget.files);o.currentTarget.value="",_(h,"picked")}}),(0,n.jsx)("button",{type:"button",disabled:m!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!a?`Replace the ${B}`:`Choose ${ae}`}),We?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("input",{ref:b,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:o=>{let h=N(o.currentTarget.files);o.currentTarget.value="",_(h,"camera")}}),Me?(0,n.jsx)("button",{type:"button",disabled:m!==null,onClick:()=>b.current?.click(),children:"Take a photo"}):null]}):null,(0,n.jsxs)("span",{style:P,"data-graview-file-takes":"",children:["or drop or paste ",a?"them":"it"," here \xB7 ",s.kinds.length>0?ke(R.length>0?R:s.kinds):"any file",", up to ",T(s.maxBytes)]})]}):(0,n.jsx)("p",{style:{...P,margin:0},"data-graview-file-none":"",children:ne?`This host doesn\u2019t take ${r?"videos":"pictures"}, so none can be added here.`:"This host doesn\u2019t take files, so none can be added here."}),(0,n.jsx)("p",{"aria-live":"polite",style:{...P,margin:0,minHeight:m||w?void 0:0},"data-graview-file-status":"",children:m??w??""}),I.length>0?(0,n.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:I.map((o,h)=>(0,n.jsx)("p",{style:{margin:0},children:o},h))}):null]})}var ve=(e,t)=>{let{caption:a,...i}=e;return t?{...i,caption:t}:i};function we({file:e,onCaption:t}){let[a,i]=(0,g.useState)(e.caption??"");(0,g.useEffect)(()=>i(e.caption??""),[e.caption]);let r=()=>{let l=a.trim().slice(0,500);l!==(e.caption??"")&&t(l)};return(0,n.jsx)("input",{type:"text",value:a,placeholder:W(e)||E(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${W(e)||E(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:l=>i(l.target.value),onBlur:r,onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),r())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function Ee({field:e,label:t,labelStyle:a,valueStyle:i,style:r,children:l}){return(0,n.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...r},children:[(0,n.jsx)("dt",{style:a,children:t}),(0,n.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...i},children:l})]})}function Ce(e){let{nodeId:t,field:a,label:i,files:r}=e,{fields:l,commit:u}=me(t),s=l.find(m=>m.field===a&&m.takesValue),p=s?.shape,c=p?.type==="several"?p.of:p,b=p?.type==="several";return r.length===0&&c?.type!=="file"?null:(0,n.jsxs)(Ee,{...e,children:[(0,n.jsx)(Z,{files:r,label:i}),s&&c?.type==="file"?(0,n.jsx)(Se,{value:r,thumbs:!1,several:b,image:c.image===!0,video:c.video===!0,label:i,onChange:m=>{let v=b?m:m[m.length-1];v!==void 0&&u(s,v)}}):null]})}function nt(e){switch(e.as){case"field":{if(!e.read)return(0,n.jsx)(Ce,{...e});let{autoplay:t,cover:a,...i}=e;return e.files.length>0?(0,n.jsx)(Ee,{...i,children:(0,n.jsx)(Z,{files:e.files,label:e.label,...t?{autoplay:t}:{},...a?{cover:a}:{}})}):null}case"unfilled":return(0,n.jsx)(Ke,{...e});case"thumb":return(0,n.jsx)(X,{...e});case"block":return e.files.length>0?(0,n.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:de.raised}:{}},children:e.view==="thumb"?(0,n.jsx)(X,{file:e.files[0],size:72}):(0,n.jsx)(Z,{files:e.files,label:e.label,...e.autoplay?{autoplay:!0}:{},...e.cover?{cover:!0}:{}})}):null;case"control":{let t=(0,n.jsx)(Se,{value:Y(e.value),several:e.several,image:e.image,video:e.video===!0,label:e.label,onChange:a=>e.onChange(e.several?a:a[a.length-1])});return e.title===void 0?t:(0,n.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,n.jsx)("legend",{"data-graview-part":"label",children:e.title}),t]})}}}function Ke({nodeId:e,skip:t,labels:a,labelStyle:i,style:r}){let{store:l}=ge(),u=he(e),s=u?l.schema.tryDefinition(u.kind):void 0,p=pe(s).filter(c=>!t.includes(c)&&!(s?.display?.hide??[]).includes(c)&&Y(u?.[c]).length===0);return p.length===0?null:(0,n.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:p.map(c=>(0,n.jsx)(Ce,{nodeId:e,field:c,label:a?.[c]??oe(s,c),files:[],...i?{labelStyle:i}:{},...r?{style:r}:{}},c))})}export{Se as FilesEditor,He as SEND_EDGE,nt as drawFiles,ke as kindsWords,je as prepare,_e as send,T as sizeWords,xe as takes,H as typeWords};
1
+ import"./chunk.WVUJXDXZ.js";import{a as F,b as K,c as pe}from"./chunk.L7XKYGV7.js";import"./chunk.CE3NKAF7.js";import"./chunk.R3GE37OI.js";import"./chunk.2KCDLCB2.js";import"./chunk.UD7VLXPM.js";import"./chunk.3DEWQDP7.js";import"./chunk.MIE4TJRW.js";import{o as me}from"./chunk.CFE3MHWZ.js";import"./chunk.RD2FSSLV.js";import"./chunk.HXTKBISQ.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as Te,N as C,R as ue,W as ce,ea as ge,ha as he}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{Aa as E,Ba as se,Ca as Y,ra as oe,sd as de,va as x,xa as le,za as W}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as q}from"./chunk.AJZBJBMO.js";var g=q(Te(),1);async function ye(e,t){let a=await createImageBitmap(e);try{let i=Math.min(1,t/Math.max(a.width,a.height)),r=document.createElement("canvas");r.width=Math.max(1,Math.round(a.width*i)),r.height=Math.max(1,Math.round(a.height*i));let l=r.getContext("2d");if(l===null)throw new Error("This browser will not give us a canvas to resize with.");return l.drawImage(a,0,0,r.width,r.height),r}finally{a.close()}}var n=q(ce(),1),He=2048,Ie=.85;function T(e){return e<1e3?`${e} bytes`:e<1e6?`${Math.round(e/1e3)} KB`:`${(e/1e6).toFixed(e<1e7?1:0)} MB`}function H(e){if(e.type==="application/pdf")return"PDF";let t=/\.([a-z0-9]{2,5})$/i.exec(e.name??"")?.[1];return t?t.toUpperCase():(e.type.split("/")[1]??e.type).replace(/^x-|^vnd\./,"").split(/[.+-]/)[0].toUpperCase()}function ke(e){let t=[...new Set(e.map(a=>a==="image/*"?"pictures":a==="video/*"?"videos":a==="*/*"||a==="*"?"any file":`${H({type:a})} files`))];return t.length<=1?t[0]??"no files":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`}function xe(e,t){if(e.length===0)return!0;let a=`${t.split("/")[0]}/*`;return e.some(i=>i==="*"||i==="*/*"||i===t||i===a)}var fe=/^image\/hei[cf]$|\.hei[cf]$/i,be=e=>fe.test(e.type)||fe.test(e.name),De={mov:"video/quicktime",mp4:"video/mp4",m4v:"video/mp4",webm:"video/webm",ogv:"video/ogg"},Be=e=>De[/\.([a-z0-9]{2,4})$/i.exec(e)?.[1]?.toLowerCase()??""];async function je(e,t,a){let i=e.name||(a.camera?"photo.jpg":"file"),r=e.type||(be({type:"",name:i})?"image/heic":Be(i)??"application/octet-stream"),l=be({type:r,name:i}),u=r.startsWith("image/")||l;if(a.image&&!u)return{refused:`\u201C${i}\u201D isn\u2019t a picture.`};if(a.video)return r.startsWith("video/")?J({blob:e,name:i,type:r},t):{refused:`\u201C${i}\u201D isn\u2019t a video.`};if(l||u&&/^image\/(jpeg|webp)$/.test(r)&&(a.camera||e.size>t.maxBytes||e.size>15e5))try{let c=await ye(e,He),b=await new Promise(m=>c.toBlob(m,"image/jpeg",Ie));if(b)return J({blob:b,name:l?i.replace(/\.hei[cf]$/i,"")+".jpg":i,type:"image/jpeg",width:c.width,height:c.height},t)}catch{if(l&&!xe(t.kinds,r))return{refused:`\u201C${i}\u201D is a HEIC photo, which this browser can\u2019t turn into a JPEG and this host doesn\u2019t take. Save it as a JPEG and try again.`}}let p={};if(u&&!l)try{let c=await createImageBitmap(e);p={width:c.width,height:c.height},c.close()}catch{}return J({blob:e,name:i,type:r,...p},t)}function J(e,t){return xe(t.kinds,e.type)?e.blob.size>t.maxBytes?{refused:`\u201C${e.name}\u201D is ${T(e.blob.size)}; this host takes files up to ${T(t.maxBytes)}.`}:e:{refused:`\u201C${e.name}\u201D is a ${H(e)} file; this host takes ${ke(t.kinds)}.`}}async function _e(e,t,a,i=!1){let r;try{r=await t.upload(e.blob,e.name)}catch(u){let s=u instanceof Error&&u.message.trim()?u.message.trim():"the host refused it";return{refused:`\u201C${e.name}\u201D wasn\u2019t kept: ${s}`}}return le(r)?a&&!W(r)?{refused:`\u201C${e.name}\u201D isn\u2019t a picture.`}:i&&!E(r)?{refused:`The host kept \u201C${e.name}\u201D as ${H(r)}, not as a video.`}:{...r,...r.width===void 0&&e.width?{width:e.width}:{},...r.height===void 0&&e.height?{height:e.height}:{}}:{refused:`The host\u2019s answer for \u201C${e.name}\u201D isn\u2019t a file a record can keep.`}}var $="var(--graview-radius, 8px)",P={color:"var(--graview-ink-muted)",fontSize:"0.8125rem"};function ee(e){let t=C(),a=ue()?.past!=null,[i,r]=(0,g.useState)(!1),l=t?.kept?ze(t,e.href):!0,[,u]=(0,g.useState)(0);return(0,g.useEffect)(()=>{if(typeof l!="object")return;let s=!0;return l.then(()=>s&&u(p=>p+1)),()=>void(s=!1)},[l]),[l===!1||a&&i,()=>r(!0)]}var Q=new WeakMap;function ze(e,t){let a=Q.get(e)?.get(t);if(a!==void 0)return a;let i;try{i=e.kept(t)}catch{return!0}if(typeof i=="boolean")return i;let r=Q.get(e)??new Map;Q.set(e,r);let l=Promise.resolve(i).then(u=>u!==!1,()=>!0);return r.set(t,l),l.then(u=>r.set(t,u)),l}function te({file:e,style:t}){return(0,n.jsx)("span",{role:"img","aria-label":`${F(e)}, removed later`,"data-graview-removed-later":e.href,style:{display:"grid",placeItems:"center",textAlign:"center",padding:4,boxSizing:"border-box",fontSize:"0.6875rem",lineHeight:1.2,color:"var(--graview-ink-muted)",border:"1px dashed var(--graview-edge-bright)",borderRadius:$,...t},children:"removed later"})}function X({file:e,size:t=56,style:a}){let i=C(),[r,l]=ee(e);return r?(0,n.jsx)(te,{file:e,style:{width:t,height:t,flex:"none",...a}}):E(e)?(0,n.jsx)(Ae,{file:e,size:t,...a?{style:a}:{},onError:l}):(0,n.jsx)("img",{onError:l,src:x(i,e.href),alt:F(e),width:t,height:t,loading:"lazy",decoding:"async","data-graview-thumb":e.href,style:{width:t,height:t,objectFit:"cover",borderRadius:$,display:"block",flex:"none",background:"var(--graview-edge)",...a}})}function Fe(e){let[t,a]=(0,g.useState)({}),i=e.duration??t.duration;return[{...i!==void 0?{duration:i}:{},width:e.width??t.width,height:e.height??t.height},u=>{let s=u.currentTarget;a({...Number.isFinite(s.duration)&&s.duration>0?{duration:s.duration}:{},...s.videoWidth>0&&s.videoHeight>0?{width:s.videoWidth,height:s.videoHeight}:{}})}]}var Ne=320,$e=(e,t)=>`${F(e)}, ${se({...t!==void 0?{duration:t}:{}})}`,Oe=(0,n.jsx)("span",{"data-graview-play-glyph":"","aria-hidden":"true",style:{position:"absolute",inset:0,display:"grid",placeItems:"center",pointerEvents:"none"},children:(0,n.jsxs)("svg",{viewBox:"0 0 24 24",width:"40%",height:"40%",style:{maxWidth:40,maxHeight:40,filter:"drop-shadow(0 1px 2px rgb(0 0 0 / 0.5))"},children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"11",fill:"rgb(0 0 0 / 0.55)"}),(0,n.jsx)("path",{d:"M9.5 7.5v9l7-4.5z",fill:"#fff"})]})});function Ae({file:e,size:t,style:a,onError:i}){let r=C(),[l,u]=Fe(e),s={width:t,height:t,objectFit:"cover",display:"block",borderRadius:$,background:"var(--graview-edge)"};return(0,n.jsxs)("span",{role:"img","aria-label":$e(e,l.duration),"data-graview-thumb":e.href,"data-graview-video-thumb":"",style:{position:"relative",display:"block",width:t,height:t,flex:"none",...a},children:[e.poster?(0,n.jsx)("img",{src:x(r,e.poster),alt:"",width:t,height:t,loading:"lazy",decoding:"async",onError:i,style:s}):(0,n.jsx)("video",{src:x(r,e.href),preload:"metadata",muted:!0,playsInline:!0,"aria-hidden":"true",tabIndex:-1,width:t,height:t,onLoadedMetadata:u,onError:i,style:s}),Oe,l.duration!==void 0?(0,n.jsx)("span",{"data-graview-video-clock":"","aria-hidden":"true",style:{position:"absolute",right:3,bottom:3,padding:"0 4px",borderRadius:4,background:"rgb(0 0 0 / 0.65)",color:"#fff",fontSize:"0.6875rem",lineHeight:"16px",fontVariantNumeric:"tabular-nums"},children:K(l.duration)}):null]})}function Ge(){let e=()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia("(prefers-reduced-motion: reduce)"):void 0,[t,a]=(0,g.useState)(()=>e()?.matches===!0);return(0,g.useEffect)(()=>{let i=e();if(!i)return;let r=()=>a(i.matches);return r(),i.addEventListener?.("change",r),()=>i.removeEventListener?.("change",r)},[]),t}function Ue({file:e,autoplay:t=!1,cover:a=!1}){let i=C(),[r,l]=ee(e),[u,s]=Fe(e),p=Ge(),c=t&&p,b=(0,g.useRef)(null),m=(0,g.useRef)(c);if((0,g.useEffect)(()=>{let d=b.current;!d||!t||(c?d.pause():m.current&&d.play?.()?.catch?.(()=>{}),m.current=c)},[t,c]),r)return(0,n.jsx)(te,{file:e,style:{width:"100%",aspectRatio:"16 / 9"}});let v=u.width!==void 0&&u.height!==void 0,w=a?{display:"block",width:"100%",height:"100%",objectFit:"cover",background:"#000"}:{display:"block",width:"100%",maxWidth:v?Math.max(u.width,Ne):"100%",height:"auto",maxHeight:"80vh",aspectRatio:v?`${u.width} / ${u.height}`:"16 / 9",borderRadius:$,background:"#000"};return(0,n.jsxs)("figure",{"data-graview-video-figure":e.href,style:{margin:0,display:"grid",gap:4,minWidth:0,...a?{height:"100%"}:{}},children:[(0,n.jsx)("video",{ref:b,"data-graview-video":e.href,...t?{"data-graview-video-autoplay":""}:{},...a?{"data-graview-video-cover":""}:{},...c?{"data-graview-video-still":""}:{},src:x(i,e.href),...e.poster?{poster:x(i,e.poster)}:{},...t?{muted:!0,loop:!0,...c?{}:{autoPlay:!0}}:{controls:!0},preload:t&&!c?"auto":"metadata",playsInline:!0,...v?{width:u.width,height:u.height}:{},"aria-label":$e(e,u.duration),onLoadedMetadata:s,onError:l,style:w,children:e.captions?(0,n.jsx)("track",{kind:"captions",src:x(i,e.captions),srcLang:"en",label:"Captions",default:!0}):null}),t?null:(0,n.jsx)("figcaption",{"data-graview-video-said":"",style:P,children:[e.caption??e.name,...u.duration!==void 0?[K(u.duration)]:[]].join(" \xB7 ")})]})}function qe({file:e,onOpen:t}){let a=C(),[i,r]=ee(e);return i?(0,n.jsx)(te,{file:e,style:{width:"100%",aspectRatio:"1"}}):(0,n.jsx)("button",{type:"button","aria-label":`Open ${F(e)} full size`,onClick:l=>t(l.currentTarget),style:{padding:0,border:0,background:"none",cursor:"zoom-in",display:"block",width:"100%",borderRadius:$},children:(0,n.jsx)("img",{src:x(a,e.href),alt:F(e),loading:"lazy",decoding:"async",onError:r,style:{width:"100%",aspectRatio:"1",objectFit:"cover",borderRadius:$,display:"block",background:"var(--graview-edge)"}})})}function Ye({src:e,file:t}){let[a,i]=(0,g.useState)(!1);return(0,n.jsx)("object",{data:e,type:"application/pdf","aria-label":F(t),"data-graview-pdf":a?"shown":"waiting",onLoad:()=>i(!0),style:a?{width:"100%",height:420,border:"1px solid var(--graview-edge)",borderRadius:$}:{width:"100%",height:0,display:"block"}})}function Z({files:e,label:t,autoplay:a,cover:i}){let r=C(),l=d=>x(r,d.href),u=e.filter(W),s=e.filter(E),p=e.filter(d=>!W(d)&&!E(d)),[c,b]=(0,g.useState)(null),m=(0,g.useRef)(null),v=(0,g.useRef)(null);(0,g.useEffect)(()=>{let d=m.current;c!==null&&d&&!d.open&&d.showModal?.()},[c]);let w=c===null?void 0:u[c];return(0,n.jsxs)("div",{style:{display:"grid",gap:10,minWidth:0},children:[u.length>0?(0,n.jsx)("ul",{"data-graview-gallery":"","aria-label":t,style:{listStyle:"none",margin:0,padding:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(96px, 1fr))",gap:8},children:u.map((d,I)=>(0,n.jsx)("li",{style:{minWidth:0},children:(0,n.jsx)(qe,{file:d,onOpen:M=>{v.current=M,b(I)}})},d.href))}):null,s.length>0?(0,n.jsx)("ul",{"data-graview-videos":"","aria-label":t,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:12},children:s.map(d=>(0,n.jsx)("li",{style:{minWidth:0},children:(0,n.jsx)(Ue,{file:d,...a?{autoplay:a}:{},...i?{cover:i}:{}})},d.href))}):null,p.length>0?(0,n.jsx)("ul",{"data-graview-documents":"",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:10},children:p.map(d=>(0,n.jsxs)("li",{"data-graview-document":d.type,style:{display:"grid",gap:6,minWidth:0},children:[d.type==="application/pdf"?(0,n.jsx)(Ye,{src:l(d),file:d}):null,d.type==="application/pdf"?(0,n.jsxs)("span",{"data-graview-file-line":"",style:{minWidth:0,overflowWrap:"anywhere",lineHeight:1.5},children:[d.name," ",(0,n.jsxs)("span",{style:P,children:["\xB7 ",H(d)," \xB7 ",T(d.bytes)," \u2014"]})," ",(0,n.jsx)("a",{href:l(d),target:"_blank",rel:"noopener",children:"Open"})," ",(0,n.jsx)("span",{style:P,"aria-hidden":"true",children:"/"})," ",(0,n.jsx)("a",{href:l(d),download:d.name,children:"Download"})]}):(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",gap:"2px 10px",alignItems:"baseline",minWidth:0,overflowWrap:"anywhere"},children:[(0,n.jsx)("a",{href:l(d),download:d.name,children:d.name}),(0,n.jsxs)("span",{style:P,children:[H(d)," \xB7 ",T(d.bytes)]})]}),d.caption?(0,n.jsx)("span",{style:P,children:d.caption}):null]},d.href))}):null,w?(0,n.jsx)("dialog",{ref:m,"data-graview-full":w.href,"aria-label":F(w),onClose:()=>{b(null),v.current?.focus()},onClick:d=>{d.target===d.currentTarget&&d.currentTarget.close()},style:{padding:0,border:0,borderRadius:$,maxWidth:"min(96vw, 1600px)",maxHeight:"94vh",background:"var(--graview-panel)",color:"var(--graview-ink)"},children:(0,n.jsxs)("figure",{style:{margin:0,display:"grid",gap:8,padding:10},children:[(0,n.jsx)("img",{src:l(w),alt:F(w),style:{maxWidth:"100%",maxHeight:"80vh",objectFit:"contain",display:"block",margin:"0 auto"}}),(0,n.jsxs)("figcaption",{style:{display:"flex",gap:12,alignItems:"center",justifyContent:"space-between"},children:[(0,n.jsx)("span",{children:w.caption??w.name}),(0,n.jsx)("form",{method:"dialog",style:{margin:0},children:(0,n.jsx)("button",{type:"submit",autoFocus:!0,children:"Close"})})]})]})}):null]})}function Se({value:e,onChange:t,several:a,image:i,video:r=!1,label:l,thumbs:u=!0}){let s=C(),p=(0,g.useId)(),c=(0,g.useRef)(null),b=(0,g.useRef)(null),[m,v]=(0,g.useState)(null),[w,d]=(0,g.useState)(null),[I,M]=(0,g.useState)([]),[O,A]=(0,g.useState)(!1),L=i?"image/":r?"video/":void 0,R=s?L?s.kinds.filter(o=>o.startsWith(L)||o==="*"||o==="*/*"):s.kinds:[],Pe=s?s.kinds.length===0||R.length>0:!1,We=!r&&(s?s.kinds.length===0||(i?R:s.kinds).some(o=>o.startsWith("image/")||o.startsWith("*")):!1),ne=!!s&&s.maxBytes>0,D=ne&&(!L||Pe),B=i?"picture":r?"video":"file",ae=a?`${B}s`:`a ${B}`,ie=L?R.length>0?R.join(","):`${L}*`:s?.kinds.join(",")||void 0,Me=typeof matchMedia=="function"&&matchMedia("(pointer: coarse)").matches,G=(0,g.useRef)(e);G.current=e;let re=(0,g.useRef)(null),j=(0,g.useRef)(null);(0,g.useEffect)(()=>{let o=j.current;if(!o||o.from===e)return;j.current=null;let h=re.current?.children,f=h?.[Math.min(o.at,h.length-1)];((o.what==="move"?f?.querySelector("[data-graview-file-move]"):null)??f?.querySelector("[data-graview-file-remove]")??c.current?.parentElement?.querySelector("[data-graview-file-choose]"))?.focus()});let _=async(o,h)=>{if(!s||o.length===0)return;let f=a?o:o.slice(0,1),y=[],S=[];f.length<o.length&&S.push(`${l} holds one ${B}, so ${o.slice(1).map(k=>`\u201C${k.name||"the photo"}\u201D`).join(", ")} ${o.length>2?"were":"was"} left out.`),M([]),d(null);for(let k of f){v(`Sending ${k.name||"the photo"}\u2026`);let U=await je(k,s,{image:i,video:r,camera:h==="camera"});if("refused"in U){S.push(U.refused);continue}let V=await _e(U,s,i,r);"refused"in V?S.push(V.refused):[...a?G.current:[],...y].some(Ve=>Ve.href===V.href)?S.push(`\u201C${V.name}\u201D is already here.`):y.push(V)}if(v(null),M(S),y.length!==0)try{t(a?[...G.current,...y]:y.slice(-1)),d(`Added ${y.map(k=>k.name).join(", ")}.`)}catch(k){M([...S,k instanceof Error?k.message:String(k)])}},z=(o,h,f)=>{try{j.current=f?{...f,from:e}:null,t(o),d(h)}catch(y){j.current=null,M([y instanceof Error?y.message:String(y)])}},N=o=>o?Array.from(o):[],Re=o=>{let h=N(o.clipboardData?.files);!D||h.length===0||(o.preventDefault(),_(h,"pasted"))},Le=o=>{A(!1),D&&(o.preventDefault(),_(N(o.dataTransfer?.files),"dropped"))};return(0,n.jsxs)("div",{role:"group","aria-labelledby":`${p}-label`,"data-graview-file-editor":"","data-graview-dropping":O?"":void 0,onPaste:Re,onDragOver:o=>{D&&(o.preventDefault(),A(!0))},onDragLeave:()=>A(!1),onDrop:Le,style:{display:"grid",gap:8,minWidth:0,padding:O?6:0,outline:O?"2px dashed var(--graview-accent)":"none",borderRadius:$},children:[(0,n.jsx)("span",{id:`${p}-label`,style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap"},children:l}),e.length>0&&(a||e.length>1)?(0,n.jsx)("ul",{ref:re,style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:6},children:e.map((o,h)=>(0,n.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"center",flexWrap:"wrap",minWidth:0},children:[u&&(W(o)||E(o))?(0,n.jsx)(X,{file:o,size:40}):null,(0,n.jsx)("span",{style:{flex:"1 1 8rem",minWidth:0,overflowWrap:"anywhere"},children:o.name}),(0,n.jsx)(we,{file:o,onCaption:f=>z(e.map((y,S)=>S===h?ve(y,f):y),f?`${o.name} now says \u201C${f}\u201D.`:`${o.name} says its name again.`)}),a&&h>0?(0,n.jsx)("button",{type:"button","data-graview-file-move":"","aria-label":`Move ${o.name} earlier`,onClick:()=>z(e.map((f,y)=>y===h-1?o:y===h?e[h-1]:f),`Moved ${o.name} earlier.`,{at:h-1,what:"move"}),children:"\u2191"}):null,a?(0,n.jsx)("button",{type:"button","data-graview-file-remove":"","aria-label":`Remove ${o.name}`,onClick:()=>z(e.filter((f,y)=>y!==h),`Removed ${o.name}.`,{at:h,what:"remove"}),children:"Remove"}):null]},`${h}:${o.href}`))}):e.length===1?(0,n.jsx)(we,{file:e[0],onCaption:o=>z([ve(e[0],o)],o?`${e[0].name} now says \u201C${o}\u201D.`:`${e[0].name} says its name again.`)}):null,D?(0,n.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:8,alignItems:"center"},children:[(0,n.jsx)("input",{ref:c,type:"file",hidden:!0,multiple:a,...ie?{accept:ie}:{},"data-graview-file-input":"","aria-label":`Choose ${ae}`,onChange:o=>{let h=N(o.currentTarget.files);o.currentTarget.value="",_(h,"picked")}}),(0,n.jsx)("button",{type:"button",disabled:m!==null,onClick:()=>c.current?.click(),"data-graview-file-choose":"",children:e.length>0&&!a?`Replace the ${B}`:`Choose ${ae}`}),We?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("input",{ref:b,type:"file",hidden:!0,accept:"image/*",capture:"environment","data-graview-photo-input":"","aria-label":"Take a photo",onChange:o=>{let h=N(o.currentTarget.files);o.currentTarget.value="",_(h,"camera")}}),Me?(0,n.jsx)("button",{type:"button",disabled:m!==null,onClick:()=>b.current?.click(),children:"Take a photo"}):null]}):null,(0,n.jsxs)("span",{style:P,"data-graview-file-takes":"",children:["or drop or paste ",a?"them":"it"," here \xB7 ",s.kinds.length>0?ke(R.length>0?R:s.kinds):"any file",", up to ",T(s.maxBytes)]})]}):(0,n.jsx)("p",{style:{...P,margin:0},"data-graview-file-none":"",children:ne?`This host doesn\u2019t take ${r?"videos":"pictures"}, so none can be added here.`:"This host doesn\u2019t take files, so none can be added here."}),(0,n.jsx)("p",{"aria-live":"polite",style:{...P,margin:0,minHeight:m||w?void 0:0},"data-graview-file-status":"",children:m??w??""}),I.length>0?(0,n.jsx)("div",{role:"alert","data-graview-file-refused":"",style:{color:"var(--graview-warn)",fontSize:"0.875rem",display:"grid",gap:2},children:I.map((o,h)=>(0,n.jsx)("p",{style:{margin:0},children:o},h))}):null]})}var ve=(e,t)=>{let{caption:a,...i}=e;return t?{...i,caption:t}:i};function we({file:e,onCaption:t}){let[a,i]=(0,g.useState)(e.caption??"");(0,g.useEffect)(()=>i(e.caption??""),[e.caption]);let r=()=>{let l=a.trim().slice(0,500);l!==(e.caption??"")&&t(l)};return(0,n.jsx)("input",{type:"text",value:a,placeholder:W(e)||E(e)?"What it shows":"What it is","aria-label":`What ${e.name} ${W(e)||E(e)?"shows":"is"}`,"data-graview-file-caption":e.href,onChange:l=>i(l.target.value),onBlur:r,onKeyDown:l=>{l.key==="Enter"&&(l.preventDefault(),r())},style:{flex:"1 1 10rem",minWidth:0,font:"inherit",fontSize:"0.875rem",minHeight:24}})}function Ee({field:e,label:t,labelStyle:a,valueStyle:i,style:r,children:l}){return(0,n.jsxs)("div",{"data-graview-files":e,style:{display:"grid",gap:6,minWidth:0,gridColumn:"1 / -1",...r},children:[(0,n.jsx)("dt",{style:a,children:t}),(0,n.jsx)("dd",{style:{margin:0,minWidth:0,display:"grid",gap:10,...i},children:l})]})}function Ce(e){let{nodeId:t,field:a,label:i,files:r}=e,{fields:l,commit:u}=me(t),s=l.find(m=>m.field===a&&m.takesValue),p=s?.shape,c=p?.type==="several"?p.of:p,b=p?.type==="several";return r.length===0&&c?.type!=="file"?null:(0,n.jsxs)(Ee,{...e,children:[(0,n.jsx)(Z,{files:r,label:i}),s&&c?.type==="file"?(0,n.jsx)(Se,{value:r,thumbs:!1,several:b,image:c.image===!0,video:c.video===!0,label:i,onChange:m=>{let v=b?m:m[m.length-1];v!==void 0&&u(s,v)}}):null]})}function nt(e){switch(e.as){case"field":{if(!e.read)return(0,n.jsx)(Ce,{...e});let{autoplay:t,cover:a,...i}=e;return e.files.length>0?(0,n.jsx)(Ee,{...i,children:(0,n.jsx)(Z,{files:e.files,label:e.label,...t?{autoplay:t}:{},...a?{cover:a}:{}})}):null}case"unfilled":return(0,n.jsx)(Ke,{...e});case"thumb":return(0,n.jsx)(X,{...e});case"block":return e.files.length>0?(0,n.jsx)("span",{className:"graview-spec-image","data-graview-field":e.field,"data-graview-image":e.view,style:{display:"block",minWidth:0,...e.view==="gallery"?{position:"relative",zIndex:de.raised}:{}},children:e.view==="thumb"?(0,n.jsx)(X,{file:e.files[0],size:72}):(0,n.jsx)(Z,{files:e.files,label:e.label,...e.autoplay?{autoplay:!0}:{},...e.cover?{cover:!0}:{}})}):null;case"control":{let t=(0,n.jsx)(Se,{value:Y(e.value),several:e.several,image:e.image,video:e.video===!0,label:e.label,onChange:a=>e.onChange(e.several?a:a[a.length-1])});return e.title===void 0?t:(0,n.jsxs)("fieldset",{"data-graview-part":"group","data-graview-field":e.several?"files":"file",children:[(0,n.jsx)("legend",{"data-graview-part":"label",children:e.title}),t]})}}}function Ke({nodeId:e,skip:t,labels:a,labelStyle:i,style:r}){let{store:l}=ge(),u=he(e),s=u?l.schema.tryDefinition(u.kind):void 0,p=pe(s).filter(c=>!t.includes(c)&&!(s?.display?.hide??[]).includes(c)&&Y(u?.[c]).length===0);return p.length===0?null:(0,n.jsx)("dl",{style:{margin:0,display:"grid",gap:14,minWidth:0},children:p.map(c=>(0,n.jsx)(Ce,{nodeId:e,field:c,label:a?.[c]??oe(s,c),files:[],...i?{labelStyle:i}:{},...r?{style:r}:{}},c))})}export{Se as FilesEditor,He as SEND_EDGE,nt as drawFiles,ke as kindsWords,je as prepare,_e as send,T as sizeWords,xe as takes,H as typeWords};
@@ -1,2 +1,2 @@
1
- import{a as P,c as pe,f as me,g as ge,h as he,i as ke,j as be}from"./chunk.JQ63N4MZ.js";import{a as ue}from"./chunk.Z3O2VZAJ.js";import{$ as C,$a as le,$b as O,Aa as oe,Ba as re,C as W,Ca as ie,Da as se,Ga as U,H as v,J as E,K as Y,L as q,La as de,Na as V,Pb as ce,T as S,Va as G,W as J,X as Q,Za as ae,ba as ee,bb as fe,bc as ye,cc as K,ea as ne,ha as I,la as M,ra as R,ua as te}from"./chunk.ZEZUKRC6.js";var ve=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,Se={day:"day",week:"week",month:"month",year:"year"},N=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function Oe(t,e,n){let r=e.interval??1,d=Se[e.every],a=t.slice(0,10),l=r===1?`Every ${d}`:r===2?`Every other ${d}`:`Every ${r} ${d}s`,s;if(e.every==="week"){let c=(e.on?.length?e.on:[G[new Date(`${a}T00:00:00Z`).getUTCDay()]]).map(i=>ee(G.indexOf(i),"long",n));s=r===1?`Every ${N(c)}`:r===2?`Every other ${N(c)}`:`${l} on ${N(c)}`}else if(e.every==="month"){let c=(e.on?.length?e.on:[+a.slice(8,10)]).map(i=>i===-1?"the last day":`the ${ve(Number(i))}`);s=`${l} on ${N(c)}`}else e.every==="year"?s=`${l} on ${C(a,n)}`:s=l;return E.test(t)&&(s+=` at ${Q(t,n)}`),e.until&&(s+=`, until ${S(e.until,n)}`),e.count&&(s+=`, ${e.count===1?"once":`${e.count} times`}`),s}function we(t,e,n={}){if(!le(e)||typeof t!="string")return;let r=n.today??q(),d=fe(t,e,r),a=Oe(t,e,n.locale),l=d.slice(0,4)===r.slice(0,4)?C(d.slice(0,10),n.locale):S(d.slice(0,10),n.locale);return d.slice(0,10)<r?`${a}, last ${l}`:`${a}, next ${l}`}function ln(t,e){let n=new Map,r=new Map;for(let d of t){let a=M(e(d.kind),d).trim().toLowerCase();r.set(a,[...r.get(a)??[],d])}for(let d of r.values()){if(d.length<2)continue;let a=new Map;for(let l of d)a.set(l.kind,[...a.get(l.kind)??[],l]);for(let[l,s]of a){if(s.length===1){n.set(s[0].id,te(e(l),l));continue}let c=s.map(o=>new Map(Ne(o,e(o.kind)).map(p=>[p.key,p.alone]))),i=[...new Set(c.flatMap(o=>[...o.keys()]))],u=o=>c.every(p=>!/\d/.test(p.get(o)??"")),g=[...i.filter(u),...i.filter(o=>!u(o))],h=(o,p)=>p.map(y=>c[o].get(y)??"").filter(Boolean).join(" \xB7 "),z=o=>new Set(s.map((p,y)=>h(y,o))).size===s.length&&s.every((p,y)=>h(y,o)!==""),$=g.find(o=>z([o])),f=$?void 0:g.flatMap((o,p)=>g.slice(p+1).map(y=>[o,y])).find(o=>z(o));s.forEach((o,p)=>{if($||f)return void n.set(o.id,h(p,$?[$]:f));let y=g.find(k=>{let b=c[p].get(k);return b!==void 0&&b!==""&&c.every((_,x)=>x===p||_.get(k)!==b)});n.set(o.id,y?c[p].get(y):`${p+1} of ${s.length}`)})}}return n}function fn(t,e){return t?.describe?t.describe(e):`${e.kind} ${M(t,e)}`}var Ee=new Set(["id","kind","label"]);function Me(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function Ne(t,e,n={}){let r=e?.display,d=new Set([...Ee,...r?.hide??[]]);typeof t.label=="string"&&e?.label&&!M(e,t).includes(t.label)&&d.delete("label");let a=(n.said??[]).filter(f=>!!f),l=a.filter(f=>f.endsWith("\u2026")).map(f=>f.replace(/…$/,"").trim()).filter(f=>f.length>12),s=[],c=e?.fields?.shape,i=e?.fieldRoles,u=n.glance?r?.glance??[i?.who,i?.when].filter(f=>!!f):Ae(r?.page),g=n.glance&&r?.glance!==void 0,h=new Set(n.glance?[]:n.blanks??[]),$=[...new Set(g?u:[...u,...je(e),...Object.keys(t)])].filter(f=>Object.hasOwn(t,f)||h.has(f)).map(f=>[f,t[f]]);for(let[f,o]of $){if(d.has(f)||ge(e,f))continue;let p=c?.[f];if(h.has(f)&&!U(p)&&!V(p)&&(o==null||o===""||Array.isArray(o)&&o.length===0)){s.push({key:f,label:R(e,f),value:"",stored:"",alone:"",long:!1,blank:!0});continue}if(o==null)continue;let y=r?.format?.[f],k=y?[]:ie(o);if(k[0]&&n.glance)continue;let b=e?.fields?.shape?.[f],_=!y&&typeof o=="string"&&U(b)?o:void 0,x=!y&&typeof o=="string"&&ue(b);if(_&&n.glance)continue;let D=y?void 0:V(b),w=D?{relation:D,refs:de(o,D)}:void 0;if(w&&(n.glance||w.refs.length===0)||!k[0]&&typeof o=="object"&&(!Array.isArray(o)||o.some(m=>typeof m=="object"&&m!==null))&&y===void 0)continue;let Z=typeof o=="string"&&!y?we(o,t[`${f}Repeat`],{locale:n.locale}):void 0,F=k[0]?k.map(m=>`${m.caption?`${m.name} \u2014 ${m.caption}`:m.name}${oe(m)?` (${re(m)})`:""}`).join(", "):Array.isArray(o)?o.join(", "):typeof o=="boolean"?o?"Yes":"No":String(o),T=y?void 0:he(e,f),B=be(T,o),H=!y&&!T&&typeof o=="number"?O(e?.fields?.shape?.[f])??me(e,f):void 0,j=w?w.refs.length>1?`${w.refs.length} linked records`:"linked record":y?y(o):H?ye(o,H):ke(T,o,n.locale)??(Array.isArray(o)||typeof o=="boolean"?F:typeof o=="string"&&Z!==void 0?Z:typeof o=="string"&&v.test(o)&&(o.length===10||Fe(e,f))?S(o,n.locale):typeof o=="string"&&E.test(o)?J(o,n.locale,n.timeZone):typeof o=="string"&&Te(e,f)?P(e,f,o):F),X=typeof o=="string"&&Ie(e,f,j),A=(n.glance||n.excerpt)&&!y&&(X||x)?pe(j,{markdown:x}):j;if(a.includes(A)||l.some(m=>A.startsWith(m))||n.glance&&(typeof o=="string"||typeof o=="number")&&a.some(m=>Me(m,A)))continue;let L=R(e,f),xe=typeof o=="number"?`${L} ${A}`:typeof o=="boolean"&&!y?`${L}: ${A.toLowerCase()}`:A;if(s.push({key:f,label:L,value:A,stored:F,alone:xe,long:X,...x?{markdown:!0}:{},...k[0]?{files:k}:{},..._?{app:_}:{},...w?{linked:w}:{},...B?{href:B}:{},...ae(c?.[`${f}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&s.length>=n.limit)break}return ze(s,e)}function ze(t,e){let n=new Map;for(let r of t){let d=De(e,r.key);d&&n.set(r.key,new Set(d.map(a=>P(e,r.key,a).toLowerCase())))}return n.size<2?t:t.map(r=>{let d=n.get(r.key);return d!==void 0&&[...n].some(([l,s])=>l!==r.key&&[...d].some(c=>s.has(c)))?{...r,alone:`${r.label}: ${r.value.toLowerCase()}`}:r})}function De(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function Fe(t,e){let n=t?.fields?.shape?.[e]?._zod?.def;for(let r=0;r<6&&n?.innerType!==void 0;r++)n=n.innerType._zod?.def;return n?.type==="string"&&(n.checks??[]).some(r=>r._zod?.def?.pattern?.source===v.source)}function Te(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function je(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function Ae(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Le=500,We=160;function Ce(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function Ie(t,e,n){return Ce(t?.fields?.shape?.[e])?.checks?.some(d=>d._zod?.def?.check==="max_length"&&(d._zod.def.maximum??0)>Le)?!0:typeof n=="string"&&(n.includes(`
1
+ import{a as P,c as pe,f as me,g as ge,h as he,i as ke,j as be}from"./chunk.JULD4XFB.js";import{a as ue}from"./chunk.GRTBEA7O.js";import{$ as C,$a as le,$b as O,Aa as oe,Ba as re,C as W,Ca as ie,Da as se,Ga as U,H as v,J as E,K as Y,L as q,La as de,Na as V,Pb as ce,T as S,Va as G,W as J,X as Q,Za as ae,ba as ee,bb as fe,bc as ye,cc as K,ea as ne,ha as I,la as M,ra as R,ua as te}from"./chunk.6AANHELP.js";var ve=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,Se={day:"day",week:"week",month:"month",year:"year"},N=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function Oe(t,e,n){let r=e.interval??1,d=Se[e.every],a=t.slice(0,10),l=r===1?`Every ${d}`:r===2?`Every other ${d}`:`Every ${r} ${d}s`,s;if(e.every==="week"){let c=(e.on?.length?e.on:[G[new Date(`${a}T00:00:00Z`).getUTCDay()]]).map(i=>ee(G.indexOf(i),"long",n));s=r===1?`Every ${N(c)}`:r===2?`Every other ${N(c)}`:`${l} on ${N(c)}`}else if(e.every==="month"){let c=(e.on?.length?e.on:[+a.slice(8,10)]).map(i=>i===-1?"the last day":`the ${ve(Number(i))}`);s=`${l} on ${N(c)}`}else e.every==="year"?s=`${l} on ${C(a,n)}`:s=l;return E.test(t)&&(s+=` at ${Q(t,n)}`),e.until&&(s+=`, until ${S(e.until,n)}`),e.count&&(s+=`, ${e.count===1?"once":`${e.count} times`}`),s}function we(t,e,n={}){if(!le(e)||typeof t!="string")return;let r=n.today??q(),d=fe(t,e,r),a=Oe(t,e,n.locale),l=d.slice(0,4)===r.slice(0,4)?C(d.slice(0,10),n.locale):S(d.slice(0,10),n.locale);return d.slice(0,10)<r?`${a}, last ${l}`:`${a}, next ${l}`}function ln(t,e){let n=new Map,r=new Map;for(let d of t){let a=M(e(d.kind),d).trim().toLowerCase();r.set(a,[...r.get(a)??[],d])}for(let d of r.values()){if(d.length<2)continue;let a=new Map;for(let l of d)a.set(l.kind,[...a.get(l.kind)??[],l]);for(let[l,s]of a){if(s.length===1){n.set(s[0].id,te(e(l),l));continue}let c=s.map(o=>new Map(Ne(o,e(o.kind)).map(p=>[p.key,p.alone]))),i=[...new Set(c.flatMap(o=>[...o.keys()]))],u=o=>c.every(p=>!/\d/.test(p.get(o)??"")),g=[...i.filter(u),...i.filter(o=>!u(o))],h=(o,p)=>p.map(y=>c[o].get(y)??"").filter(Boolean).join(" \xB7 "),z=o=>new Set(s.map((p,y)=>h(y,o))).size===s.length&&s.every((p,y)=>h(y,o)!==""),$=g.find(o=>z([o])),f=$?void 0:g.flatMap((o,p)=>g.slice(p+1).map(y=>[o,y])).find(o=>z(o));s.forEach((o,p)=>{if($||f)return void n.set(o.id,h(p,$?[$]:f));let y=g.find(k=>{let b=c[p].get(k);return b!==void 0&&b!==""&&c.every((_,x)=>x===p||_.get(k)!==b)});n.set(o.id,y?c[p].get(y):`${p+1} of ${s.length}`)})}}return n}function fn(t,e){return t?.describe?t.describe(e):`${e.kind} ${M(t,e)}`}var Ee=new Set(["id","kind","label"]);function Me(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function Ne(t,e,n={}){let r=e?.display,d=new Set([...Ee,...r?.hide??[]]);typeof t.label=="string"&&e?.label&&!M(e,t).includes(t.label)&&d.delete("label");let a=(n.said??[]).filter(f=>!!f),l=a.filter(f=>f.endsWith("\u2026")).map(f=>f.replace(/…$/,"").trim()).filter(f=>f.length>12),s=[],c=e?.fields?.shape,i=e?.fieldRoles,u=n.glance?r?.glance??[i?.who,i?.when].filter(f=>!!f):Ae(r?.page),g=n.glance&&r?.glance!==void 0,h=new Set(n.glance?[]:n.blanks??[]),$=[...new Set(g?u:[...u,...je(e),...Object.keys(t)])].filter(f=>Object.hasOwn(t,f)||h.has(f)).map(f=>[f,t[f]]);for(let[f,o]of $){if(d.has(f)||ge(e,f))continue;let p=c?.[f];if(h.has(f)&&!U(p)&&!V(p)&&(o==null||o===""||Array.isArray(o)&&o.length===0)){s.push({key:f,label:R(e,f),value:"",stored:"",alone:"",long:!1,blank:!0});continue}if(o==null)continue;let y=r?.format?.[f],k=y?[]:ie(o);if(k[0]&&n.glance)continue;let b=e?.fields?.shape?.[f],_=!y&&typeof o=="string"&&U(b)?o:void 0,x=!y&&typeof o=="string"&&ue(b);if(_&&n.glance)continue;let D=y?void 0:V(b),w=D?{relation:D,refs:de(o,D)}:void 0;if(w&&(n.glance||w.refs.length===0)||!k[0]&&typeof o=="object"&&(!Array.isArray(o)||o.some(m=>typeof m=="object"&&m!==null))&&y===void 0)continue;let Z=typeof o=="string"&&!y?we(o,t[`${f}Repeat`],{locale:n.locale}):void 0,F=k[0]?k.map(m=>`${m.caption?`${m.name} \u2014 ${m.caption}`:m.name}${oe(m)?` (${re(m)})`:""}`).join(", "):Array.isArray(o)?o.join(", "):typeof o=="boolean"?o?"Yes":"No":String(o),T=y?void 0:he(e,f),B=be(T,o),H=!y&&!T&&typeof o=="number"?O(e?.fields?.shape?.[f])??me(e,f):void 0,j=w?w.refs.length>1?`${w.refs.length} linked records`:"linked record":y?y(o):H?ye(o,H):ke(T,o,n.locale)??(Array.isArray(o)||typeof o=="boolean"?F:typeof o=="string"&&Z!==void 0?Z:typeof o=="string"&&v.test(o)&&(o.length===10||Fe(e,f))?S(o,n.locale):typeof o=="string"&&E.test(o)?J(o,n.locale,n.timeZone):typeof o=="string"&&Te(e,f)?P(e,f,o):F),X=typeof o=="string"&&Ie(e,f,j),A=(n.glance||n.excerpt)&&!y&&(X||x)?pe(j,{markdown:x}):j;if(a.includes(A)||l.some(m=>A.startsWith(m))||n.glance&&(typeof o=="string"||typeof o=="number")&&a.some(m=>Me(m,A)))continue;let L=R(e,f),xe=typeof o=="number"?`${L} ${A}`:typeof o=="boolean"&&!y?`${L}: ${A.toLowerCase()}`:A;if(s.push({key:f,label:L,value:A,stored:F,alone:xe,long:X,...x?{markdown:!0}:{},...k[0]?{files:k}:{},..._?{app:_}:{},...w?{linked:w}:{},...B?{href:B}:{},...ae(c?.[`${f}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&s.length>=n.limit)break}return ze(s,e)}function ze(t,e){let n=new Map;for(let r of t){let d=De(e,r.key);d&&n.set(r.key,new Set(d.map(a=>P(e,r.key,a).toLowerCase())))}return n.size<2?t:t.map(r=>{let d=n.get(r.key);return d!==void 0&&[...n].some(([l,s])=>l!==r.key&&[...d].some(c=>s.has(c)))?{...r,alone:`${r.label}: ${r.value.toLowerCase()}`}:r})}function De(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function Fe(t,e){let n=t?.fields?.shape?.[e]?._zod?.def;for(let r=0;r<6&&n?.innerType!==void 0;r++)n=n.innerType._zod?.def;return n?.type==="string"&&(n.checks??[]).some(r=>r._zod?.def?.pattern?.source===v.source)}function Te(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function je(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function Ae(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Le=500,We=160;function Ce(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function Ie(t,e,n){return Ce(t?.fields?.shape?.[e])?.checks?.some(d=>d._zod?.def?.check==="max_length"&&(d._zod.def.maximum??0)>Le)?!0:typeof n=="string"&&(n.includes(`
2
2
  `)||n.length>We)}function un(t,e){let n=t?.display?.page,r=n?.groups??[],d=new Map(e.map(i=>[i.key,i])),a=new Set(Ae(n)),l=i=>i.flatMap(u=>d.has(u)?[d.get(u)]:[]),s=e.filter(i=>!a.has(i.key));return[{fields:[...l(n?.fields??[]),...r.length>0?[]:s]},...r.map(i=>({title:i.title,fields:l(i.fields)})),...r.length>0?[{title:"Details",fields:s}]:[]].filter(i=>i.fields.length>0)}function Ue(t,e,n){let r=[...e?.creates??[],...e?.subject&&e.subject.kinds!=="*"?e.subject.kinds:[]];for(let d of r){let a=t.tryDefinition(d),l=a?.fields?.shape??{};if(!a||!(n in l))continue;let s=a.display?.format?.[n];return{label:a.display?.labels?.[n]??R(a,n),option:i=>s?s(i):I(i)}}return{label:R(void 0,n),option:d=>I(d)}}function gn(t,e,n){if(n instanceof ce){let r=e.find(a=>a.name===n.mutation);return`Not yet: ${n.issues.map(a=>{let l=a.path.length>0?Ue(t,r,String(a.path[0])).label:void 0;return l?`${l} \u2014 ${ne(a.message)}`:a.message}).join("; ")}.`}return n instanceof Error?n.message:String(n)}var Ve=t=>/^[A-Z]{3}$/.test(t??"");function $e(t){let{format:e,unit:n,currency:r,locale:d,places:a}=t,l=Ve(n),s=e==="money"||!e&&l,c=s?l?n:r:void 0;return{...s?{format:"money"}:e?{format:e}:{},...n&&!(s&&l)?{unit:n}:{},...c?{currency:c}:{},...d?{locale:d}:{},...s&&a===0?{places:a}:{}}}function kn(t){switch(t.format){case"money":return t.currency?`An amount of money in ${t.currency}: a plain number, 1250.5 for 1,250.50 ${t.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return t.unit?`A number of ${t.unit}.`:"A number."}}function Re(t){let e=W(t)?.innerType;return e===void 0?t:Re(e)}var Ge={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ke=t=>(t?._zod?.def?.checks??[]).map(e=>e._zod?.def).filter(e=>e!==void 0);function _e(t){let e=Re(t),n=W(e),r=n?.type,d=Ke(e);if(r==="enum")return{type:"choice",options:Object.keys(n?.entries??{})};let a=se(e);if(a)return a==="image"?{type:"file",image:!0}:a==="video"?{type:"file",video:!0}:{type:"file"};if(r==="boolean")return{type:"boolean"};if(r==="array"){let l=_e(n?.element);return l.type==="unknown"?{type:"unknown"}:{type:"several",of:l}}if(r==="number"){let l,s,c;for(let i of d){i.check==="multiple_of"&&typeof i.value=="number"?c=i.value:i.check==="number_format"&&(i.format==="safeint"||i.format==="int32"||i.format==="uint32")&&(c??=1);let u=i.check==="number_format"&&i.format?Ge[i.format]:void 0,g=u?u[0]:i.check==="greater_than"&&i.inclusive&&typeof i.value=="number"?i.value:void 0,h=u?u[1]:i.check==="less_than"&&i.inclusive&&typeof i.value=="number"?i.value:void 0;g!==void 0&&(l=l===void 0?g:Math.max(l,g)),h!==void 0&&(s=s===void 0?h:Math.min(s,h))}return{type:"number",...l===void 0?{}:{min:l},...s===void 0?{}:{max:s},...c===void 0?{}:{step:c},...K(e)==="duration"?{duration:!0}:{},...O(t)?{amount:$e(O(t))}:{}}}if(r==="string"){if(d.some(u=>u.fn===Y||u.format==="datetime")||n?.format==="datetime")return{type:"date",time:!0,instant:!0};let s=[n?.pattern,...d.map(u=>u.pattern)].filter(u=>u instanceof RegExp).map(u=>u.source);if(s.some(u=>u.includes("\\d{4}")))return s.some(u=>u.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:s.includes(v.source)?{type:"date",partial:!0}:{type:"date"};let c=d.some(u=>u.check==="max_length"&&typeof u.maximum=="number"&&u.maximum>500),i=K(e);return c?{type:"text",long:!0}:i==="phone"||i==="place"?{type:"text",holds:i}:{type:"text"}}return{type:"unknown"}}function vn(t,e){let n=t?.shape;return!n||!(e in n)?{type:"unknown"}:_e(n[e])}export{Oe as a,ln as b,fn as c,Ne as d,un as e,$e as f,kn as g,Re as h,_e as i,vn as j,Ue as k,gn as l};
@@ -1 +1 @@
1
- import{G as A,Ua as H,W as F,Wa as M}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as x}from"./chunk.AJZBJBMO.js";var t=x(A(),1),f=x(F(),1),q={faces:'[data-testid="app-menu-open"][data-scene]',problems:'[data-testid="standing"], [data-testid="standing-link"]',activity:'[data-testid="inbox-button"]',ask:'[data-testid="app-find"], [data-testid="app-find-open"]',find:'[data-testid="app-find"], [data-testid="app-find-open"]',profile:'[data-testid="profile-button"]',home:'[data-testid="app-home"]'};function D(e){if(!e.isConnected||e.closest("[hidden], [inert], [aria-hidden='true']"))return!1;if(typeof e.checkVisibility!="function")return!0;if(!e.checkVisibility({visibilityProperty:!0}))return!1;let a=e.getBoundingClientRect();return a.width>1&&a.height>1}function E(e,a){if(!e||a==="ask"&&!e.querySelector("[data-graview-quick-ask]"))return null;for(let c of e.querySelectorAll(q[a]))if(D(c))return c;return null}function W(e){let a=(u,h,d)=>e.querySelector(u)?.getAttribute(h)?.trim()||d,c=a('[data-testid="app-menu-open"]',"data-scene","Scene"),n=a('[data-testid="app-menu-open"]',"data-pages","Pages");return[{anchor:"faces",title:`${c} or ${n}`,words:`One app, two ways to see it, in the app menu: ${c} draws every record as one picture, ${n} as lists and pages to read and change.`},{anchor:"problems",title:"Whether all is in order",words:"The dot is green while every rule holds. When one is broken it counts what is wrong, and pressing it shows each one and where."},{anchor:"activity",title:"Inbox",words:"What waits for you, what has happened here and who did it \u2014 each change with its way back \u2014 and what you asked."},{anchor:"ask",title:"Tell Graview",words:"Press \u2318K (Ctrl+K) to tell Graview what to do about what you have selected, or right-click it and type. The answer stands beside it, and a change it proposes waits for you to accept it."}]}var R=300,O=1200,$=15e3;function _({root:e,steps:a,onEnd:c}){let[n,u]=(0,t.useState)(null),h=(0,t.useRef)(null),d=(0,t.useRef)(!1),p=(0,t.useRef)(c);p.current=c,(0,t.useEffect)(()=>{let r=Date.now(),o=Date.now(),s=null,i,k=new MutationObserver(()=>o=Date.now());k.observe(document.body,{childList:!0,subtree:!0});let v=()=>{let L=e(),S=Date.now();if(L?.querySelector('[data-testid="app-bar"]')){if(s??=S,S-o>=R||S-s>=O){let T=[...W(L),...a].filter(C=>E(L,C.anchor)!==null);if(T.length===0){d.current=!0,p.current(null);return}h.current=document.activeElement,u({list:T,at:0});return}}else if(S-r>=$){d.current=!0,p.current(null);return}i=setTimeout(v,100)};return i=setTimeout(v,100),()=>{clearTimeout(i),k.disconnect()}},[]);let y=(0,t.useCallback)(()=>{let r=h.current;(r instanceof HTMLElement&&r!==document.body&&r.isConnected?r:e()?.querySelector('[data-testid="app-home"]'))?.focus({preventScroll:!0})},[e]),m=(0,t.useCallback)((r,o)=>{if(d.current)return;d.current=!0;let s=document.querySelector("[data-testid='first-look']"),i=document.activeElement,k=i===null||i===document.body||s!==null&&s.contains(i);u(null),p.current(r),!(!o&&!k)&&(y(),requestAnimationFrame(()=>{let v=document.activeElement;(v===null||v===document.body)&&y()}))},[y]),w=(0,t.useCallback)((r,o)=>{let s=e();for(let i=o;i<r.length;i++)if(E(s,r[i].anchor))return i;return-1},[e]),b=(0,t.useCallback)(()=>{if(!n)return;let r=w(n.list,n.at+1);r<0?m("finished",!0):u({list:n.list,at:r})},[n,w,m]);if((0,t.useEffect)(()=>{if(!n)return;let r=e();if(!r)return;let o=0,s=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{E(e(),n.list[n.at].anchor)||b()})},i=new MutationObserver(s);return i.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class"]}),()=>{cancelAnimationFrame(o),i.disconnect()}},[n,e,b]),!n)return null;let g=n.list[n.at],l=w(n.list,n.at+1)<0;return(0,f.jsx)(N,{root:e,step:g,position:n.at+1,total:n.list.length,last:l,onNext:b,onEnd:m},n.at)}var I={...H,width:"min(320px, calc(100vw - 24px))",maxHeight:"min(70vh, 420px)",overflow:"auto",padding:"12px 14px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:"0.875rem",lineHeight:1.45,overflowWrap:"anywhere"},P={minHeight:32,padding:"0 12px",borderRadius:8,font:"inherit",fontWeight:600,cursor:"pointer"};function N({root:e,step:a,position:c,total:n,last:u,onNext:h,onEnd:d}){let p=(0,t.useRef)(null),y=(0,t.useRef)(null),m=(0,t.useId)().replace(/:/g,""),w=(0,t.useMemo)(()=>({get current(){return E(e(),a.anchor)}}),[e,a.anchor]),[b]=(0,t.useState)(()=>{let l=w.current?.getBoundingClientRect(),r=typeof document>"u"?0:document.documentElement.clientWidth||innerWidth;return l&&l.left+l.width/2<r/2?"start":"end"});M(p,!0,w,{align:b}),(0,t.useLayoutEffect)(()=>{y.current?.focus({preventScroll:!0})},[]);let g=(0,t.useRef)(d);return g.current=d,(0,t.useEffect)(()=>{let l=o=>{o.target instanceof Node&&p.current?.contains(o.target)||g.current("dismissed",!1)},r=o=>{if(o.key!=="Escape"||o.defaultPrevented)return;let s=o.target;s instanceof Node&&p.current?.contains(s)||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||[...document.querySelectorAll("[data-graview-overlay]:not([hidden])")].some(i=>i!==p.current)||g.current("dismissed",!0)};return document.addEventListener("pointerdown",l,!0),document.addEventListener("keydown",r),()=>{document.removeEventListener("pointerdown",l,!0),document.removeEventListener("keydown",r)}},[]),(0,f.jsxs)("div",{ref:p,popover:"manual",role:"dialog","aria-modal":"false","aria-labelledby":`${m}-title`,"aria-describedby":`${m}-words`,tabIndex:-1,"data-testid":"first-look","data-first-look-anchor":a.anchor,"data-graview-overlay":"",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),d("dismissed",!0))},style:I,children:[(0,f.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},"data-testid":"first-look-count",children:[c," of ",n]}),(0,f.jsx)("p",{id:`${m}-title`,style:{margin:"2px 0 4px",fontWeight:600,fontSize:"0.9375rem"},"data-testid":"first-look-title",children:a.title}),(0,f.jsx)("p",{id:`${m}-words`,style:{margin:0},"data-testid":"first-look-words",children:a.words}),(0,f.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,marginTop:12},children:[u?null:(0,f.jsx)("button",{type:"button","data-testid":"first-look-skip",onClick:()=>d("dismissed",!0),style:{...P,fontWeight:500,border:"1px solid transparent",background:"none",color:"var(--graview-ink-muted)"},children:"Skip"}),(0,f.jsx)("button",{ref:y,type:"button","data-testid":u?"first-look-done":"first-look-next",onClick:()=>u?d("finished",!0):h(),style:{...P,border:"1px solid var(--graview-accent)",background:"var(--graview-accent)",color:"var(--graview-accent-ink)"},children:u?"Done":"Next"})]})]})}export{_ as FirstLookHints,E as firstLookAnchor};
1
+ import{G as A,Ua as H,W as F,Wa as M}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as x}from"./chunk.AJZBJBMO.js";var t=x(A(),1),f=x(F(),1),q={faces:'[data-testid="app-menu-open"][data-scene]',problems:'[data-testid="standing"], [data-testid="standing-link"]',activity:'[data-testid="inbox-button"]',ask:'[data-testid="app-find"], [data-testid="app-find-open"]',find:'[data-testid="app-find"], [data-testid="app-find-open"]',profile:'[data-testid="profile-button"]',home:'[data-testid="app-home"]'};function D(e){if(!e.isConnected||e.closest("[hidden], [inert], [aria-hidden='true']"))return!1;if(typeof e.checkVisibility!="function")return!0;if(!e.checkVisibility({visibilityProperty:!0}))return!1;let a=e.getBoundingClientRect();return a.width>1&&a.height>1}function E(e,a){if(!e||a==="ask"&&!e.querySelector("[data-graview-quick-ask]"))return null;for(let c of e.querySelectorAll(q[a]))if(D(c))return c;return null}function W(e){let a=(u,h,d)=>e.querySelector(u)?.getAttribute(h)?.trim()||d,c=a('[data-testid="app-menu-open"]',"data-scene","Scene"),n=a('[data-testid="app-menu-open"]',"data-pages","Pages");return[{anchor:"faces",title:`${c} or ${n}`,words:`One app, two ways to see it, in the app menu: ${c} draws every record as one picture, ${n} as lists and pages to read and change.`},{anchor:"problems",title:"Whether all is in order",words:"The dot is green while every rule holds. When one is broken it counts what is wrong, and pressing it shows each one and where."},{anchor:"activity",title:"Inbox",words:"What waits for you, what has happened here and who did it \u2014 each change with its way back \u2014 and what you asked."},{anchor:"ask",title:"Tell Graview",words:"Press \u2318K (Ctrl+K) to tell Graview what to do about what you have selected, or right-click it and type. The answer stands beside it, and a change it proposes waits for you to accept it."}]}var R=300,O=1200,$=15e3;function _({root:e,steps:a,onEnd:c}){let[n,u]=(0,t.useState)(null),h=(0,t.useRef)(null),d=(0,t.useRef)(!1),p=(0,t.useRef)(c);p.current=c,(0,t.useEffect)(()=>{let r=Date.now(),o=Date.now(),s=null,i,k=new MutationObserver(()=>o=Date.now());k.observe(document.body,{childList:!0,subtree:!0});let v=()=>{let L=e(),S=Date.now();if(L?.querySelector('[data-testid="app-bar"]')){if(s??=S,S-o>=R||S-s>=O){let T=[...W(L),...a].filter(C=>E(L,C.anchor)!==null);if(T.length===0){d.current=!0,p.current(null);return}h.current=document.activeElement,u({list:T,at:0});return}}else if(S-r>=$){d.current=!0,p.current(null);return}i=setTimeout(v,100)};return i=setTimeout(v,100),()=>{clearTimeout(i),k.disconnect()}},[]);let y=(0,t.useCallback)(()=>{let r=h.current;(r instanceof HTMLElement&&r!==document.body&&r.isConnected?r:e()?.querySelector('[data-testid="app-home"]'))?.focus({preventScroll:!0})},[e]),m=(0,t.useCallback)((r,o)=>{if(d.current)return;d.current=!0;let s=document.querySelector("[data-testid='first-look']"),i=document.activeElement,k=i===null||i===document.body||s!==null&&s.contains(i);u(null),p.current(r),!(!o&&!k)&&(y(),requestAnimationFrame(()=>{let v=document.activeElement;(v===null||v===document.body)&&y()}))},[y]),w=(0,t.useCallback)((r,o)=>{let s=e();for(let i=o;i<r.length;i++)if(E(s,r[i].anchor))return i;return-1},[e]),b=(0,t.useCallback)(()=>{if(!n)return;let r=w(n.list,n.at+1);r<0?m("finished",!0):u({list:n.list,at:r})},[n,w,m]);if((0,t.useEffect)(()=>{if(!n)return;let r=e();if(!r)return;let o=0,s=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{E(e(),n.list[n.at].anchor)||b()})},i=new MutationObserver(s);return i.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class"]}),()=>{cancelAnimationFrame(o),i.disconnect()}},[n,e,b]),!n)return null;let g=n.list[n.at],l=w(n.list,n.at+1)<0;return(0,f.jsx)(N,{root:e,step:g,position:n.at+1,total:n.list.length,last:l,onNext:b,onEnd:m},n.at)}var I={...H,width:"min(320px, calc(100vw - 24px))",maxHeight:"min(70vh, 420px)",overflow:"auto",padding:"12px 14px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:"0.875rem",lineHeight:1.45,overflowWrap:"anywhere"},P={minHeight:32,padding:"0 12px",borderRadius:8,font:"inherit",fontWeight:600,cursor:"pointer"};function N({root:e,step:a,position:c,total:n,last:u,onNext:h,onEnd:d}){let p=(0,t.useRef)(null),y=(0,t.useRef)(null),m=(0,t.useId)().replace(/:/g,""),w=(0,t.useMemo)(()=>({get current(){return E(e(),a.anchor)}}),[e,a.anchor]),[b]=(0,t.useState)(()=>{let l=w.current?.getBoundingClientRect(),r=typeof document>"u"?0:document.documentElement.clientWidth||innerWidth;return l&&l.left+l.width/2<r/2?"start":"end"});M(p,!0,w,{align:b}),(0,t.useLayoutEffect)(()=>{y.current?.focus({preventScroll:!0})},[]);let g=(0,t.useRef)(d);return g.current=d,(0,t.useEffect)(()=>{let l=o=>{o.target instanceof Node&&p.current?.contains(o.target)||g.current("dismissed",!1)},r=o=>{if(o.key!=="Escape"||o.defaultPrevented)return;let s=o.target;s instanceof Node&&p.current?.contains(s)||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||[...document.querySelectorAll("[data-graview-overlay]:not([hidden])")].some(i=>i!==p.current)||g.current("dismissed",!0)};return document.addEventListener("pointerdown",l,!0),document.addEventListener("keydown",r),()=>{document.removeEventListener("pointerdown",l,!0),document.removeEventListener("keydown",r)}},[]),(0,f.jsxs)("div",{ref:p,popover:"manual",role:"dialog","aria-modal":"false","aria-labelledby":`${m}-title`,"aria-describedby":`${m}-words`,tabIndex:-1,"data-testid":"first-look","data-first-look-anchor":a.anchor,"data-graview-overlay":"",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),d("dismissed",!0))},style:I,children:[(0,f.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},"data-testid":"first-look-count",children:[c," of ",n]}),(0,f.jsx)("p",{id:`${m}-title`,style:{margin:"2px 0 4px",fontWeight:600,fontSize:"0.9375rem"},"data-testid":"first-look-title",children:a.title}),(0,f.jsx)("p",{id:`${m}-words`,style:{margin:0},"data-testid":"first-look-words",children:a.words}),(0,f.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,marginTop:12},children:[u?null:(0,f.jsx)("button",{type:"button","data-testid":"first-look-skip",onClick:()=>d("dismissed",!0),style:{...P,fontWeight:500,border:"1px solid transparent",background:"none",color:"var(--graview-ink-muted)"},children:"Skip"}),(0,f.jsx)("button",{ref:y,type:"button","data-testid":u?"first-look-done":"first-look-next",onClick:()=>u?d("finished",!0):h(),style:{...P,border:"1px solid var(--graview-accent)",background:"var(--graview-accent)",color:"var(--graview-accent-ink)"},children:u?"Done":"Next"})]})]})}export{_ as FirstLookHints,E as firstLookAnchor};
@@ -1 +1 @@
1
- import{a as me,b as z}from"./chunk.ZRBGYXAO.js";import{a as ue}from"./chunk.CEQQIW7Z.js";import{a as de,e as ce}from"./chunk.G3GFDVO2.js";import{b as te,c as oe,d as ae,e as ie,f as se,g as le}from"./chunk.D4WJ7OM5.js";import"./chunk.QDVGHI7R.js";import"./chunk.AKJS2NUM.js";import{a as J,b as U,d as Q}from"./chunk.5AKZROMR.js";import"./chunk.MIE4TJRW.js";import{w as D}from"./chunk.QRQ5WPZI.js";import"./chunk.RD2FSSLV.js";import"./chunk.37RFCHSS.js";import"./chunk.SO6NT5K7.js";import"./chunk.MUSMNKE4.js";import"./chunk.SJQPTDAT.js";import"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import{G as re,N as O,Na as _,P as E,R as L,W as N,fa as A,la as $,oa as P,ra as x,sa as K,ua as F,wa as q}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as S}from"./chunk.AJZBJBMO.js";var i=S(re(),1);var a=S(N(),1);function fe(e,r){let n=e?.logo;if(!r||!n)return e;let s=o=>o.startsWith("/graview/assets/")?r(o):o;return{...e,logo:typeof n=="string"?s(n):{...n,light:s(n.light),...n.dark?{dark:s(n.dark)}:{}}}}var we=e=>({...e.node?{node:{id:e.node.id}}:{},...e.nodes?{nodes:e.nodes.map(r=>({id:r.id}))}:{},...e.label!==void 0?{label:e.label}:{},fidelity:e.fidelity,cardinality:e.cardinality,mode:e.mode,selected:e.selected,...e.implicated?{implicated:e.implicated}:{},...e.flagged?{flagged:e.flagged}:{}});function Y(e){let r=L(),n=r?.past?.seq,s=r?.host?.viewAt,o=(0,i.useMemo)(()=>n===void 0||!s||e.draft?void 0:s(e.manifest.name,n),[s,n,e]);return(0,i.useMemo)(()=>o===null?null:o===void 0?e:{...e,worker:o},[o,e])}var H=new WeakMap,T=new Set,pe=e=>(T.add(e),()=>void T.delete(e));function ye(e,r){r===void 0?H.delete(e):H.set(e,r);for(let n of[...T])n()}function Z({definition:e,store:r,principal:n,input:s,goTo:o,places:l,arrangement:d,scheme:c,brand:f,onFailure:m,drawsItsOwn:w,tick:p}){let y=(0,i.useSyncExternalStore)(pe,()=>H.get(e),()=>{}),t=(0,i.useMemo)(()=>y===void 0?e:{...e,worker:{source:y}},[e,y]),V=(0,i.useRef)(null),k=(0,i.useRef)(null),v=O(),b=E(),I=(0,i.useContext)($),C=(0,i.useMemo)(()=>fe(f,b),[f,b]),u=(0,i.useRef)({input:s,goTo:o,places:l,arrangement:d,onFailure:m,brand:C,hostFiles:v,hostAssets:b,told:I});u.current={input:s,goTo:o,places:l,arrangement:d,onFailure:m,brand:C,hostFiles:v,hostAssets:b,told:I},(0,i.useEffect)(()=>{let W=V.current;if(!W)return;let j=t.file??(u.current.hostFiles?.src?g=>u.current.hostFiles?.src?.(g)??g:void 0);typeof t.worker=="function"&&z(t.worker).catch(()=>{});let B=g=>({manifest:t.manifest,worker:g,store:r,principal:n,input:()=>u.current.input?.()??{},goTo:()=>u.current.goTo,places:()=>u.current.places?.()??[],arrangement:()=>u.current.arrangement?.(),brand:()=>u.current.brand,onFailure:(h,ne)=>u.current.onFailure(h,ne),...w?{fallback:!1}:{},...t.limits?{limits:t.limits}:{},...t.author?{author:t.author}:{},...t.onProblem?{onProblem:t.onProblem}:{},...t.asset?{asset:t.asset}:u.current.hostAssets?{asset:h=>u.current.hostAssets?.(h)??h}:{},...j?{file:j}:{},...t.images?{images:t.images}:{},...t.links?{links:t.links}:{},files:()=>u.current.hostFiles,onContentHeight:h=>u.current.told?.(h)}),ee=U(J,g=>{k.current=g.mountWorkerView(W,B(t.worker)),D(W,g.viewPlaceHandle({element:W,definition:t,mounted:()=>k.current,optionsFor:B,draw:h=>ye(e,h),mount:g.mountWorkerView,pressing:Q}))});return()=>{ee(),D(W,null),k.current?.dispose(),k.current=null}},[t,r,n]),(0,i.useEffect)(()=>k.current?.update(),[c,C,p]);let M=(0,a.jsx)("div",{ref:V,"data-worker-view-place":t.manifest.name,style:{minWidth:0}});if(!t.draft)return M;let R=t.manifest.title??t.manifest.name;return(0,a.jsxs)("div",{role:"group","aria-label":`Draft: ${R}`,"data-graview-draft-view":t.manifest.name,style:{display:"grid",gap:8,alignContent:"start",minWidth:0},children:[(0,a.jsxs)("p",{"data-testid":"draft-view-line",style:ke,children:[(0,a.jsxs)("span",{children:["Draft \u2014 ",(0,a.jsx)("span",{style:{color:"var(--graview-ink)",fontWeight:600},children:R})]}),(0,a.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,a.jsx)("span",{children:"Not kept"})]}),M]})}var ke={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};function X({view:e,props:r,fellBack:n}){return(0,a.jsx)("div",{"data-worker-view-fallback":"",...n?{"data-worker-view-fell-back":n.name,"data-worker-view-failed":n.reason}:{},style:{display:"contents"},children:(0,a.jsx)(e,{...r})})}function ge({name:e,reason:r,children:n}){return(0,a.jsx)("div",{"data-worker-view-fell-back":e,"data-worker-view-failed":r,style:{display:"contents"},children:n})}function G(e,r={}){let n=r.fallback,s=e.manifest.replaces==="page";function o(l){let d=A(),c=P(),f=(0,i.useContext)(_),[m,w]=(0,i.useState)(null),p=(0,i.useRef)(l);p.current=l;let y=Y(e);if(!d)return null;if(y===null)return n&&!(f&&x(n)&&!s)?(0,a.jsx)(X,{view:n,props:l}):null;if(m&&n)return f&&x(n)&&!s?null:(0,a.jsx)(X,{view:n,props:l,fellBack:{name:e.manifest.name,reason:m}});let t=r.beside&&!(f&&x(r.beside))?r.beside:void 0,V=(0,a.jsx)(Z,{definition:y,store:d.store,principal:d.principal,input:()=>we(p.current),goTo:c,places:()=>d.views.places(),arrangement:()=>d.views.arrangement?.(),scheme:d.scheme,brand:d.brand,tick:l,drawsItsOwn:n!==void 0,onFailure:(k,v)=>{w(k),e.onFailure?.(k,v)}});return t?(0,a.jsxs)("div",{"data-worker-view-beside":e.manifest.name,style:{display:"grid",gap:12,minWidth:0},children:[V,(0,a.jsx)(t,{...l})]}):V}return o.displayName=`WorkerView(${e.manifest.name})`,o}function he(e,r){let{manifest:n}=r;if(n.attach==="home"){if(!e.home)throw new Error(`The worker view "${n.name}" is the home's body: draw it with workerHome, on the home.`);let m=e.homes?.(),w=r.draft?void 0:m?m.filter(y=>y.name===void 0).at(-1)?.view:e.homeView?.(),p=G(r,w?{fallback:w}:{});return e.home(n.bleed===!0?F(p):p,r.draft?void 0:{name:n.name}),e}let s={cardinality:n.cardinality,fidelity:"full"},o=e.lookup(n.attach,s)??e.resolve(n.attach,s)?.view,l=n.cardinality==="one",d=r.draft===!0,c=G(r,{...o&&!d?{fallback:o}:{},...l&&n.replaces!=="page"&&o?{beside:o}:{}});n.replaces==="page"&&K(c);let f=o?.says;return l&&n.replaces!=="page"&&typeof f=="function"&&(c.says=f),n.bleed===!0&&F(c),c.flows=n.flows!==!1,n.heading==="own"&&(c.ownHeading=!0),q(c,n.scene?.maxHeight!==void 0?{maxHeight:n.scene.maxHeight}:{}),e.register(n.attach,s,c,n.title?{title:n.title,...d?{}:{name:n.name},lens:"view",...n.reads?.kinds?.length?{reads:n.reads.kinds}:{}}:d?void 0:{name:n.name}),e}function Ve(e,r={}){let n=r.fallback;function s({context:o}){let l=A(),d=P(),[c,f]=(0,i.useState)(null),m=Y(e);return c&&n?(0,a.jsx)(ge,{name:e.manifest.name,reason:c,children:(0,a.jsx)(n,{context:o})}):m===null&&n?(0,a.jsx)(n,{context:o}):m===null?null:(0,a.jsx)(Z,{definition:m,store:o.store,principal:o.principal??l?.principal??{kind:"human"},goTo:d,...l?{places:()=>l.views.places(),arrangement:()=>l.views.arrangement?.(),scheme:l.scheme,brand:l.brand}:{},drawsItsOwn:n!==void 0,onFailure:(w,p)=>{f(w),e.onFailure?.(w,p)}})}return s.displayName=`WorkerHome(${e.manifest.name})`,s}export{oe as checkManifest,ue as checkViewSource,ce as judgeCodeAct,te as manifestActs,se as readsComputed,he as registerWorkerView,de as sightIsTotal,ae as unreadEdges,ie as unreadEdgesSentence,me as viewScript,Ve as workerHome,G as workerView,le as workerViewProps};
1
+ import{a as me,b as z}from"./chunk.ZRBGYXAO.js";import{a as ue}from"./chunk.CEQQIW7Z.js";import{a as de,e as ce}from"./chunk.MK5RPEB2.js";import{b as te,c as oe,d as ae,e as ie,f as se,g as le}from"./chunk.TOUSIUJF.js";import"./chunk.QDVGHI7R.js";import"./chunk.KUCBNMIY.js";import{a as J,b as U,d as Q}from"./chunk.TVWK3SGD.js";import"./chunk.MIE4TJRW.js";import{w as D}from"./chunk.CFE3MHWZ.js";import"./chunk.RD2FSSLV.js";import"./chunk.HXTKBISQ.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import{G as re,N as O,Na as _,P as E,R as L,W as N,fa as A,la as $,oa as P,ra as x,sa as K,ua as F,wa as q}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as S}from"./chunk.AJZBJBMO.js";var i=S(re(),1);var a=S(N(),1);function fe(e,r){let n=e?.logo;if(!r||!n)return e;let s=o=>o.startsWith("/graview/assets/")?r(o):o;return{...e,logo:typeof n=="string"?s(n):{...n,light:s(n.light),...n.dark?{dark:s(n.dark)}:{}}}}var we=e=>({...e.node?{node:{id:e.node.id}}:{},...e.nodes?{nodes:e.nodes.map(r=>({id:r.id}))}:{},...e.label!==void 0?{label:e.label}:{},fidelity:e.fidelity,cardinality:e.cardinality,mode:e.mode,selected:e.selected,...e.implicated?{implicated:e.implicated}:{},...e.flagged?{flagged:e.flagged}:{}});function Y(e){let r=L(),n=r?.past?.seq,s=r?.host?.viewAt,o=(0,i.useMemo)(()=>n===void 0||!s||e.draft?void 0:s(e.manifest.name,n),[s,n,e]);return(0,i.useMemo)(()=>o===null?null:o===void 0?e:{...e,worker:o},[o,e])}var H=new WeakMap,T=new Set,pe=e=>(T.add(e),()=>void T.delete(e));function ye(e,r){r===void 0?H.delete(e):H.set(e,r);for(let n of[...T])n()}function Z({definition:e,store:r,principal:n,input:s,goTo:o,places:l,arrangement:d,scheme:c,brand:f,onFailure:m,drawsItsOwn:w,tick:p}){let y=(0,i.useSyncExternalStore)(pe,()=>H.get(e),()=>{}),t=(0,i.useMemo)(()=>y===void 0?e:{...e,worker:{source:y}},[e,y]),V=(0,i.useRef)(null),k=(0,i.useRef)(null),v=O(),b=E(),I=(0,i.useContext)($),C=(0,i.useMemo)(()=>fe(f,b),[f,b]),u=(0,i.useRef)({input:s,goTo:o,places:l,arrangement:d,onFailure:m,brand:C,hostFiles:v,hostAssets:b,told:I});u.current={input:s,goTo:o,places:l,arrangement:d,onFailure:m,brand:C,hostFiles:v,hostAssets:b,told:I},(0,i.useEffect)(()=>{let W=V.current;if(!W)return;let j=t.file??(u.current.hostFiles?.src?g=>u.current.hostFiles?.src?.(g)??g:void 0);typeof t.worker=="function"&&z(t.worker).catch(()=>{});let B=g=>({manifest:t.manifest,worker:g,store:r,principal:n,input:()=>u.current.input?.()??{},goTo:()=>u.current.goTo,places:()=>u.current.places?.()??[],arrangement:()=>u.current.arrangement?.(),brand:()=>u.current.brand,onFailure:(h,ne)=>u.current.onFailure(h,ne),...w?{fallback:!1}:{},...t.limits?{limits:t.limits}:{},...t.author?{author:t.author}:{},...t.onProblem?{onProblem:t.onProblem}:{},...t.asset?{asset:t.asset}:u.current.hostAssets?{asset:h=>u.current.hostAssets?.(h)??h}:{},...j?{file:j}:{},...t.images?{images:t.images}:{},...t.links?{links:t.links}:{},files:()=>u.current.hostFiles,onContentHeight:h=>u.current.told?.(h)}),ee=U(J,g=>{k.current=g.mountWorkerView(W,B(t.worker)),D(W,g.viewPlaceHandle({element:W,definition:t,mounted:()=>k.current,optionsFor:B,draw:h=>ye(e,h),mount:g.mountWorkerView,pressing:Q}))});return()=>{ee(),D(W,null),k.current?.dispose(),k.current=null}},[t,r,n]),(0,i.useEffect)(()=>k.current?.update(),[c,C,p]);let M=(0,a.jsx)("div",{ref:V,"data-worker-view-place":t.manifest.name,style:{minWidth:0}});if(!t.draft)return M;let R=t.manifest.title??t.manifest.name;return(0,a.jsxs)("div",{role:"group","aria-label":`Draft: ${R}`,"data-graview-draft-view":t.manifest.name,style:{display:"grid",gap:8,alignContent:"start",minWidth:0},children:[(0,a.jsxs)("p",{"data-testid":"draft-view-line",style:ke,children:[(0,a.jsxs)("span",{children:["Draft \u2014 ",(0,a.jsx)("span",{style:{color:"var(--graview-ink)",fontWeight:600},children:R})]}),(0,a.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,a.jsx)("span",{children:"Not kept"})]}),M]})}var ke={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};function X({view:e,props:r,fellBack:n}){return(0,a.jsx)("div",{"data-worker-view-fallback":"",...n?{"data-worker-view-fell-back":n.name,"data-worker-view-failed":n.reason}:{},style:{display:"contents"},children:(0,a.jsx)(e,{...r})})}function ge({name:e,reason:r,children:n}){return(0,a.jsx)("div",{"data-worker-view-fell-back":e,"data-worker-view-failed":r,style:{display:"contents"},children:n})}function G(e,r={}){let n=r.fallback,s=e.manifest.replaces==="page";function o(l){let d=A(),c=P(),f=(0,i.useContext)(_),[m,w]=(0,i.useState)(null),p=(0,i.useRef)(l);p.current=l;let y=Y(e);if(!d)return null;if(y===null)return n&&!(f&&x(n)&&!s)?(0,a.jsx)(X,{view:n,props:l}):null;if(m&&n)return f&&x(n)&&!s?null:(0,a.jsx)(X,{view:n,props:l,fellBack:{name:e.manifest.name,reason:m}});let t=r.beside&&!(f&&x(r.beside))?r.beside:void 0,V=(0,a.jsx)(Z,{definition:y,store:d.store,principal:d.principal,input:()=>we(p.current),goTo:c,places:()=>d.views.places(),arrangement:()=>d.views.arrangement?.(),scheme:d.scheme,brand:d.brand,tick:l,drawsItsOwn:n!==void 0,onFailure:(k,v)=>{w(k),e.onFailure?.(k,v)}});return t?(0,a.jsxs)("div",{"data-worker-view-beside":e.manifest.name,style:{display:"grid",gap:12,minWidth:0},children:[V,(0,a.jsx)(t,{...l})]}):V}return o.displayName=`WorkerView(${e.manifest.name})`,o}function he(e,r){let{manifest:n}=r;if(n.attach==="home"){if(!e.home)throw new Error(`The worker view "${n.name}" is the home's body: draw it with workerHome, on the home.`);let m=e.homes?.(),w=r.draft?void 0:m?m.filter(y=>y.name===void 0).at(-1)?.view:e.homeView?.(),p=G(r,w?{fallback:w}:{});return e.home(n.bleed===!0?F(p):p,r.draft?void 0:{name:n.name}),e}let s={cardinality:n.cardinality,fidelity:"full"},o=e.lookup(n.attach,s)??e.resolve(n.attach,s)?.view,l=n.cardinality==="one",d=r.draft===!0,c=G(r,{...o&&!d?{fallback:o}:{},...l&&n.replaces!=="page"&&o?{beside:o}:{}});n.replaces==="page"&&K(c);let f=o?.says;return l&&n.replaces!=="page"&&typeof f=="function"&&(c.says=f),n.bleed===!0&&F(c),c.flows=n.flows!==!1,n.heading==="own"&&(c.ownHeading=!0),q(c,n.scene?.maxHeight!==void 0?{maxHeight:n.scene.maxHeight}:{}),e.register(n.attach,s,c,n.title?{title:n.title,...d?{}:{name:n.name},lens:"view",...n.reads?.kinds?.length?{reads:n.reads.kinds}:{}}:d?void 0:{name:n.name}),e}function Ve(e,r={}){let n=r.fallback;function s({context:o}){let l=A(),d=P(),[c,f]=(0,i.useState)(null),m=Y(e);return c&&n?(0,a.jsx)(ge,{name:e.manifest.name,reason:c,children:(0,a.jsx)(n,{context:o})}):m===null&&n?(0,a.jsx)(n,{context:o}):m===null?null:(0,a.jsx)(Z,{definition:m,store:o.store,principal:o.principal??l?.principal??{kind:"human"},goTo:d,...l?{places:()=>l.views.places(),arrangement:()=>l.views.arrangement?.(),scheme:l.scheme,brand:l.brand}:{},drawsItsOwn:n!==void 0,onFailure:(w,p)=>{f(w),e.onFailure?.(w,p)}})}return s.displayName=`WorkerHome(${e.manifest.name})`,s}export{oe as checkManifest,ue as checkViewSource,ce as judgeCodeAct,te as manifestActs,se as readsComputed,he as registerWorkerView,de as sightIsTotal,ae as unreadEdges,ie as unreadEdgesSentence,me as viewScript,Ve as workerHome,G as workerView,le as workerViewProps};
@@ -1,4 +1,4 @@
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)}
1
+ import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{W as o,ea as n}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.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{a as O,b,c as w,d as R,e as V}from"./chunk.UGQYMN4J.js";import{h as d,i as S}from"./chunk.RG5G6YQD.js";import{Qa as $,Ra as F}from"./chunk.ZEZUKRC6.js";var E=["card","row","page"],j=["good","warn","bad","neutral","accent"],U=["money","percent","date","time","datetime","relative","count"],_=4,T=40,I=120,L=["number","money","percent"],B=["large"],C=["card","row"],M=1e3,ce=100;function X(e){let n=/^\s*(out|in)\(\s*['"]([A-Za-z][A-Za-z0-9_-]*)['"]\s*\)\s*$/.exec(e);return n?{edge:n[2],way:n[1]}:/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?{edge:e}:void 0}var v={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone","lines"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label","emphasis"]},Z=Object.keys(v),G=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?, "emphasis"?: "large"}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?, "lines"?: 0-12}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,Y=e=>/^(image|video|file)$/.test(e?.of??e?.type??"");function ge(e){return Object.fromEntries(Object.entries(e.views??{}).filter(([,n])=>!Array.isArray(n)))}function ye(e){let n=e.views?.home;return Array.isArray(n)?n:void 0}var q={field:()=>!1,relation:()=>!1,figure:!1},z=e=>e.kind??"the home",m=(e,n)=>e!==void 0&&Object.hasOwn(e,n),g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function W(e,n,t){let s=O(e);for(let a of s.unknownFunctions)t.findings.push(d("unknown-function",n,`"${a}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let a of s.names){if(t.kind===null){t.findings.push(d("view-name",n,`"${a}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}a==="id"||t.spec.field(a)||t.spec.relation(a)||t.findings.push(d("view-name",n,`${t.kind} has no field or relation called "${a}"`))}for(let a of s.edges)t.edges.has(a)||t.findings.push(d("view-edge",n,`"${a}" is not a relation any kind declares`));for(let a of s.sweeps)t.kinds.has(a)||t.findings.push(d("view-kind",n,`"${a}" is not a kind this document declares`))}function k(e,n,t){if(typeof e!="string"||e.length===0||e.length>2e3){t.findings.push(d("view-expression",n,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{W(w(e),n,t)}catch(s){if(!(s instanceof b))throw s;t.findings.push(d("expression",n,`${s.sentence} (at character ${s.at+1})`))}}function A(e,n,t,s,a=!1){let l=s==="text";if(typeof e!="string"||e.length===0||e.length>300){t.findings.push(d("view-template",n,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let r;try{r=V(e)}catch(i){if(i instanceof R||i instanceof b){t.findings.push(d("template",n,i.sentence));return}throw i}for(let i of r)if(i.expr){if(W(i.expr,n,t),l&&!a&&!i.format&&i.expr.t==="ident"&&(t.slot==="card"||t.slot==="row")&&t.spec.prose?.(i.expr.name)){let o=i.expr.name;t.findings.push(S("view-whole-text",n,`${t.kind} ${t.slot} shows ${o} whole; it will be clamped. Use {${o}|excerpt} or move it to the page.`,`write {${o}|excerpt}, or {${o}|excerpt: 80} for fewer characters`))}if(s==="headline"&&!i.format&&i.expr.t==="ident"&&t.spec.prose?.(i.expr.name)){let o=i.expr.name;t.findings.push(S("view-headline-long",n,`${z(t)}${t.slot?` ${t.slot}`:""} heads it with ${o}, a long text, drawn at a headline's size; a headline is a few words.`,`say it in a text block, {"text": "{${o}}"}, or head it with {${o}|excerpt: 60}`))}}}var K=12;function J(e,n,t){typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=K||t.findings.push(d("view-lines",n,`lines is ${JSON.stringify(e)}, and a text block's lines is a whole number from 1 to ${K}, or 0 to show it whole`,'{"text": "{awards}", "lines": 6}, or "lines": 0 for no cut at all'))}function Q(e,n,t){if(typeof e=="string"){j.includes(e)||t.findings.push(d("view-tone",n,`"${e}" is not a tone`,`use one of ${j.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(g(e)&&Object.keys(e).length===1&&"expr"in e){k(e.expr,`${n}.expr`,t);return}t.findings.push(d("view-tone",n,'a tone is a word or {"expr": \u2026}',`one of ${j.join(", ")}`))}function x(e,n,t,s){if(!Array.isArray(e)){s.findings.push(d("view-shape",n,"a view is a list of blocks"));return}if(t>_){s.findings.push(d("view-depth",n,`blocks nest at most ${_} deep`,"flatten a group or a condition"));return}e.forEach((a,l)=>ee(a,`${n}.${l}`,t,s))}function ee(e,n,t,s){if(t===1&&s.count++,s.all++,!g(e)){s.findings.push(d("view-block",n,"a block is an object naming what it shows",`one of ${G}`));return}let a=Object.keys(e),l=a.filter(o=>Z.includes(o)&&!(o==="group"&&a.includes("list")));if(l.length===0){s.findings.push(d("view-block",n,`${a.length>0?a.map(o=>`"${o}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${G}`));return}if(l.length>1){s.findings.push(d("view-block",n,`a block is one thing, and this says ${l.map(o=>`"${o}"`).join(" and ")}`,"split it into two blocks"));return}let r=l[0];for(let o of a)o!==r&&o!="key"&&!v[r].includes(o)&&s.findings.push(d("unknown-key",`${n}.${o}`,`"${o}" is not part of a ${r} block`,v[r].length>0?`a ${r} block may also say ${v[r].map(f=>`"${f}"`).join(", ")}`:`a ${r} block says nothing else`));let i=e[r];switch(r){case"title":case"headline":case"text":case"badge":A(i,`${n}.${r}`,s,r==="text"||r==="headline"?r:void 0,r==="text"&&"lines"in e),"tone"in e&&Q(e.tone,`${n}.tone`,s),r==="text"&&"lines"in e&&J(e.lines,`${n}.lines`,s);return;case"image":case"field":{let o=r==="image";if(typeof i!="string"||!(o?s.spec.files?.(i):s.spec.field(i))){let u=typeof i=="string"&&s.spec.relation(i);s.findings.push(d(`view-${r}`,`${n}.${r}`,`${s.kind} has no ${o?"image, video or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,u?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let f=o?["thumb","gallery"]:U;"as"in e&&!f.includes(e.as)&&s.findings.push(d("view-format",`${n}.as`,`"${String(e.as)}" is not a way to show ${o?"pictures":"a field"}`,`use one of ${f.join(", ")}`)),o||D(e,n,s,"field"),"label"in e&&oe(e.label,`${n}.label`,s);return}case"progress":{!g(i)||Object.keys(i).some(o=>o!=="value"&&o!=="max")||!("value"in i)||!("max"in i)?s.findings.push(d("view-progress",`${n}.progress`,'progress is {"value": expression, "max": expression}')):(k(i.value,`${n}.progress.value`,s),k(i.max,`${n}.progress.max`,s)),"label"in e&&A(e.label,`${n}.label`,s);return}case"group":"direction"in e&&e.direction!=="row"&&e.direction!=="column"&&s.findings.push(d("view-direction",`${n}.direction`,`a group runs "row" or "column", not "${String(e.direction)}"`)),x(i,`${n}.group`,t+1,s);return;case"when":k(i,`${n}.when`,s),"show"in e?x(e.show,`${n}.show`,t+1,s):s.findings.push(d("view-when",n,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return ne(e,n,s);for(let o of["as","currency","label","emphasis"])o in e&&s.findings.push(d("unknown-key",`${n}.${o}`,`"${o}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?s.findings.push(d("view-block",`${n}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):s.spec.figure||s.findings.push(d("view-figure",`${n}.figure`,`${z(s)} has no figure to show`,s.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return te(e,n,s);case"divider":i!==!0&&s.findings.push(d("view-block",`${n}.${r}`,`write {"${r}": true}`));return}}function ne(e,n,t){k(e.figure,`${n}.figure`,t),"as"in e&&!L.includes(e.as)&&t.findings.push(d("view-format",`${n}.as`,`"${String(e.as)}" is not a way to say a figure`,`use one of ${L.join(", ")}`)),D(e,n,t,"figure"),"label"in e&&A(e.label,`${n}.label`,t),"emphasis"in e&&!B.includes(e.emphasis)&&t.findings.push(d("view-emphasis",`${n}.emphasis`,`"${String(e.emphasis)}" is not how loudly a figure is said`,`use ${B.map(s=>`"${s}"`).join(", ")}, or leave it out for the figure's own size`))}function D(e,n,t,s){"currency"in e&&(typeof e.currency!="string"||!/^[A-Z]{3}$/.test(e.currency)?t.findings.push(d("view-currency",`${n}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):e.as!=="money"&&t.findings.push(d("view-currency",`${n}.currency`,`a currency belongs on a ${s} shown as money`,'add "as": "money"')))}function ie(e,n){let t=[...n.kinds],s=(l,r)=>{let i=new Set;for(let o of l){let f=n.vocabulary.namesOf(o)?.targets?.(r);if(f==="*")return t;for(let u of f??[])i.add(u)}return i.size>0?[...i]:void 0},a=l=>{switch(l.t){case"ident":return n.kind!==null&&n.spec.relation(l.name)?s([n.kind],l.name):void 0;case"member":{let r=a(l.object);return r?s(r,l.name):void 0}case"where":return a(l.set);case"call":{let r=l.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(l.fn==="all")return i!==void 0&&n.kinds.has(i)?[i]:void 0;let o=l.args.length===2&&l.args[1]?.t==="lit"&&typeof l.args[1].value=="string"?l.args[1].value:void 0;if(l.fn==="out"&&o!==void 0){let f=a(r);return f?s(f,o):void 0}if(l.fn==="out")return i!==void 0&&n.kind!==null?s([n.kind],i):void 0;if(l.fn==="in"){let f=o??i,u=o!==void 0?a(r):n.kind!==null?[n.kind]:void 0,c=f!==void 0?n.vocabulary.sources(f).filter(p=>{let y=n.vocabulary.namesOf(p)?.targets?.(f);return!u||y==="*"||u.some(h=>y?.includes(h))}):[];return c.length>0?c:void 0}if((l.fn==="sort"||l.fn==="first")&&r)return a(r);if(l.fn==="either"){let f=l.args.map(a);return f.every(u=>u!==void 0)?[...new Set(f.flatMap(u=>u??[]))]:void 0}return}default:return}};return a(e)}function N(e,n,t,s){let a;try{a=w(e)}catch(r){if(!(r instanceof b))throw r;s.findings.push(d("expression",n,`${r.sentence} (at character ${r.at+1})`));return}let l=O(a);for(let r of l.unknownFunctions)s.findings.push(d("unknown-function",n,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of l.edges)s.edges.has(r)||s.findings.push(d("view-edge",n,`"${r}" is not a relation any kind declares`));if(t)for(let r of l.names)r==="id"||t.some(i=>s.vocabulary.namesOf(i)?.field(r)||s.vocabulary.namesOf(i)?.relation(r))||s.findings.push(d("view-name",n,`${t.join(" and ")} ${t.length===1?"has":"have"} no field or relation called "${r}"`))}function te(e,n,t){let s=e.list;k(s,`${n}.list`,t);let a;if(typeof s=="string")try{a=ie(w(s),t)}catch{a=void 0}let l=i=>{if(!a)return[...t.kinds].map(f=>t.vocabulary.namesOf(f)?.choices?.(i)).find(f=>f!==void 0);let o=a.map(f=>t.vocabulary.namesOf(f)?.choices?.(i));return o.every(f=>f!==void 0)?[...new Set(o.flatMap(f=>f??[]))]:void 0},r=a?a.join(" and "):"any kind";if("sort"in e){let i=e.sort;if(typeof i=="string")N(i,`${n}.sort`,a,t);else if(g(i)&&typeof i.by=="string"&&Object.keys(i).every(o=>o==="by"||o==="direction")){let o=i.direction;o!==void 0&&o!=="asc"&&o!=="desc"&&o!=="choices"?t.findings.push(d("list-sort",`${n}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(o)}"`,'"choices" puts a choice field in the order its choices are declared')):o==="choices"?l(i.by)===void 0&&t.findings.push(d("list-sort",`${n}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):N(i.by,`${n}.sort.by`,a,t)}else t.findings.push(d("list-sort",`${n}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in e){let i=e.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>M)&&t.findings.push(d("list-limit",`${n}.limit`,`a limit is a whole number from 1 to ${M}`))}if("group"in e){let i=e.group,o=typeof i=="string"?i:g(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||g(i)&&Object.keys(i).every(u=>u==="by"||u==="headings"))||o===void 0)t.findings.push(d("list-group",`${n}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}} \u2014 or a relation, like "inGenre", a heading per linked record'));else{let u=l(o),c=u===void 0?X(o):void 0,p=c!==void 0&&(c.way!==void 0?t.edges.has(c.edge):a?a.every(y=>t.vocabulary.namesOf(y)?.relation(c.edge)):t.edges.has(c.edge));if(u===void 0&&!p&&t.findings.push(d("list-group",`${n}.group`,`"${o}" is not a choice field or a relation of ${r}, so it has nothing to group by`,'group by a field whose type is enum, or by a relation of the kind listed, like "inGenre"')),g(i)&&"headings"in i){let y=i.headings;if(!g(y)||Object.values(y).some(h=>typeof h!="string"||h.length===0||h.length>80))t.findings.push(d("list-group",`${n}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(u)for(let h of Object.keys(y))u.includes(h)||t.findings.push(d("list-group",`${n}.group.headings.${h}`,`"${h}" is not one of ${o}'s choices`,`use ${u.join(", ")}`))}}}"empty"in e&&(typeof e.empty!="string"||e.empty.length===0||e.empty.length>200)&&t.findings.push(d("list-empty",`${n}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in e&&!C.includes(e.as)&&t.findings.push(d("list-as",`${n}.as`,`a list draws each record as its "card" or its "row", not "${String(e.as)}"`))}function oe(e,n,t){(typeof e!="string"||e.length===0||e.length>60)&&t.findings.push(d("view-label",n,"a label is a few words, at most 60 characters"))}function P(e,n,t,s,a,l,r){let i={kind:null,spec:q,kinds:s,edges:a,vocabulary:t,findings:l,count:0,all:0};Array.isArray(e)&&e.length===0&&l.push(d("view-shape",n,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),x(e,n,1,i),H(i,n,r,"show less")}function H(e,n,t,s){e.count>T?e.findings.push(d("view-size",n,`${t} has ${e.count} blocks at its top; a view has at most ${T} there, a group or a condition counting as one`,`${s}, or gather some into a group`)):e.all>I&&e.findings.push(d("view-size",n,`${t} has ${e.all} blocks counting the ones inside its groups and conditions; a view has at most ${I} in all`,s))}function se(e,n,t,s,a){Array.isArray(e)&&e.forEach((l,r)=>{if(!g(l)||l.name!=="blocks"||!g(l.options)||!("blocks"in l.options))return;let i=[];P(l.options.blocks,`lenses.${r}.options.blocks`,n,t,s,i,`the lens "${String(l.title??r)}"`);for(let o of i)a.push({...o,severity:"warning"})})}function re(e,n,t,s,a,l,r){let i=[];if(e===void 0)return i;if(!g(e))return i.push(d("view-shape",n,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[o,f]of Object.entries(e)){if(o==="home"&&Array.isArray(f)){P(f,`${n}.home`,r,s,a,i,"the home");continue}let u=t(o);if(!u){i.push(d("view-kind",`${n}.${o}`,`"${o}" is not a kind this ${l} declares`));continue}if(!g(f)){i.push(d("view-shape",`${n}.${o}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(f))E.includes(c)||i.push(d("view-slot",`${n}.${o}.${c}`,`"${c}" is not a place a view is drawn`,`use ${E.map(p=>`"${p}"`).join(", ")}`));for(let c of E){let p=f[c];if(p===void 0)continue;let y={kind:o,spec:u,kinds:s,edges:a,vocabulary:r,findings:i,count:0,all:0,slot:c};x(p,`${n}.${o}.${c}`,1,y),H(y,`${n}.${o}.${c}`,`this ${c}`,"show less, or move detail to the page")}}return i}function he(e){let n=new Set(Object.keys(e.kinds)),t=new Set(Object.values(e.kinds).flatMap(r=>Object.keys($(r.edges)))),s=r=>{let i=m(e.kinds,r)?e.kinds[r]:void 0;return i?{field:o=>m(i.fields,o)||m(i.computed,o)||F(i.edges).has(o),relation:o=>m($(i.edges),o),figure:i.figure!==void 0,files:o=>m(i.fields,o)&&Y(i.fields[o]),choices:o=>m(i.fields,o)&&i.fields[o].type==="enum"?i.fields[o].options:void 0,targets:o=>m($(i.edges),o)?i.edges[o].to:void 0,prose:o=>m(i.fields,o)&&i.fields[o].type==="text"}:void 0},a={namesOf:s,sources:r=>Object.keys(e.kinds).filter(i=>m(e.kinds[i].edges,r))},l=re(e.views,"views",s,n,t,"document",a);return se(e.lenses,a,n,t,l),l}export{j as a,U as b,L as c,B as d,M as e,ce as f,X as g,ge as h,ye as i,he as j};
1
+ import{a as O,b,c as w,d as R,e as V}from"./chunk.UD7VLXPM.js";import{h as d,i as S}from"./chunk.3DEWQDP7.js";import{Qa as $,Ra as F}from"./chunk.6AANHELP.js";var E=["card","row","page"],j=["good","warn","bad","neutral","accent"],U=["money","percent","date","time","datetime","relative","count"],_=4,T=40,I=120,L=["number","money","percent"],B=["large"],C=["card","row"],M=1e3,ce=100;function X(e){let n=/^\s*(out|in)\(\s*['"]([A-Za-z][A-Za-z0-9_-]*)['"]\s*\)\s*$/.exec(e);return n?{edge:n[2],way:n[1]}:/^[A-Za-z][A-Za-z0-9_-]*$/.test(e)?{edge:e}:void 0}var v={title:[],headline:[],list:["sort","limit","group","empty","as"],text:["tone","lines"],badge:["tone"],field:["as","currency","label"],image:["as","label"],progress:["label"],group:["direction"],when:["show"],divider:[],figure:["as","currency","label","emphasis"]},Z=Object.keys(v),G=`{"title": "{name}"}, {"headline": "{count(all('offer'))} offers"}, {"figure": expr, "as"?: "number"|"money"|"percent", "currency"?, "label"?, "emphasis"?: "large"}, {"list": expr, "sort"?, "limit"?, "group"?, "empty"?, "as"?: "card"|"row"}, {"text": "\u2026", "tone"?, "lines"?: 0-12}, {"badge": "{status}", "tone"?}, {"field": "quote", "as"?, "currency"?, "label"?}, {"image": "photos", "as"?: "thumb"|"gallery"}, {"progress": {"value": expr, "max": expr}, "label"?}, {"group": [blocks], "direction"?: "row"|"column"}, {"when": expr, "show": [blocks]}, {"divider": true}, {"figure": true}`,Y=e=>/^(image|video|file)$/.test(e?.of??e?.type??"");function ge(e){return Object.fromEntries(Object.entries(e.views??{}).filter(([,n])=>!Array.isArray(n)))}function ye(e){let n=e.views?.home;return Array.isArray(n)?n:void 0}var q={field:()=>!1,relation:()=>!1,figure:!1},z=e=>e.kind??"the home",m=(e,n)=>e!==void 0&&Object.hasOwn(e,n),g=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function W(e,n,t){let s=O(e);for(let a of s.unknownFunctions)t.findings.push(d("unknown-function",n,`"${a}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let a of s.names){if(t.kind===null){t.findings.push(d("view-name",n,`"${a}" names nothing here: these blocks are about no one record`,"reach records with all('<kind>'), like count(all('offer')) or first(all('party') where role == 'client').name"));continue}a==="id"||t.spec.field(a)||t.spec.relation(a)||t.findings.push(d("view-name",n,`${t.kind} has no field or relation called "${a}"`))}for(let a of s.edges)t.edges.has(a)||t.findings.push(d("view-edge",n,`"${a}" is not a relation any kind declares`));for(let a of s.sweeps)t.kinds.has(a)||t.findings.push(d("view-kind",n,`"${a}" is not a kind this document declares`))}function k(e,n,t){if(typeof e!="string"||e.length===0||e.length>2e3){t.findings.push(d("view-expression",n,`an expression is a line of the rule language, like "status == 'booked'"`));return}try{W(w(e),n,t)}catch(s){if(!(s instanceof b))throw s;t.findings.push(d("expression",n,`${s.sentence} (at character ${s.at+1})`))}}function A(e,n,t,s,a=!1){let l=s==="text";if(typeof e!="string"||e.length===0||e.length>300){t.findings.push(d("view-template",n,'a template is words with {field} in braces, like "{name}" or "{quote|money}", at most 300 characters'));return}let r;try{r=V(e)}catch(i){if(i instanceof R||i instanceof b){t.findings.push(d("template",n,i.sentence));return}throw i}for(let i of r)if(i.expr){if(W(i.expr,n,t),l&&!a&&!i.format&&i.expr.t==="ident"&&(t.slot==="card"||t.slot==="row")&&t.spec.prose?.(i.expr.name)){let o=i.expr.name;t.findings.push(S("view-whole-text",n,`${t.kind} ${t.slot} shows ${o} whole; it will be clamped. Use {${o}|excerpt} or move it to the page.`,`write {${o}|excerpt}, or {${o}|excerpt: 80} for fewer characters`))}if(s==="headline"&&!i.format&&i.expr.t==="ident"&&t.spec.prose?.(i.expr.name)){let o=i.expr.name;t.findings.push(S("view-headline-long",n,`${z(t)}${t.slot?` ${t.slot}`:""} heads it with ${o}, a long text, drawn at a headline's size; a headline is a few words.`,`say it in a text block, {"text": "{${o}}"}, or head it with {${o}|excerpt: 60}`))}}}var K=12;function J(e,n,t){typeof e=="number"&&Number.isInteger(e)&&e>=0&&e<=K||t.findings.push(d("view-lines",n,`lines is ${JSON.stringify(e)}, and a text block's lines is a whole number from 1 to ${K}, or 0 to show it whole`,'{"text": "{awards}", "lines": 6}, or "lines": 0 for no cut at all'))}function Q(e,n,t){if(typeof e=="string"){j.includes(e)||t.findings.push(d("view-tone",n,`"${e}" is not a tone`,`use one of ${j.join(", ")}, or {"expr": "if(status == 'booked', 'good', 'neutral')"}`));return}if(g(e)&&Object.keys(e).length===1&&"expr"in e){k(e.expr,`${n}.expr`,t);return}t.findings.push(d("view-tone",n,'a tone is a word or {"expr": \u2026}',`one of ${j.join(", ")}`))}function x(e,n,t,s){if(!Array.isArray(e)){s.findings.push(d("view-shape",n,"a view is a list of blocks"));return}if(t>_){s.findings.push(d("view-depth",n,`blocks nest at most ${_} deep`,"flatten a group or a condition"));return}e.forEach((a,l)=>ee(a,`${n}.${l}`,t,s))}function ee(e,n,t,s){if(t===1&&s.count++,s.all++,!g(e)){s.findings.push(d("view-block",n,"a block is an object naming what it shows",`one of ${G}`));return}let a=Object.keys(e),l=a.filter(o=>Z.includes(o)&&!(o==="group"&&a.includes("list")));if(l.length===0){s.findings.push(d("view-block",n,`${a.length>0?a.map(o=>`"${o}"`).join(", "):"an empty object"} is not a block Graview knows`,`one of ${G}`));return}if(l.length>1){s.findings.push(d("view-block",n,`a block is one thing, and this says ${l.map(o=>`"${o}"`).join(" and ")}`,"split it into two blocks"));return}let r=l[0];for(let o of a)o!==r&&o!="key"&&!v[r].includes(o)&&s.findings.push(d("unknown-key",`${n}.${o}`,`"${o}" is not part of a ${r} block`,v[r].length>0?`a ${r} block may also say ${v[r].map(f=>`"${f}"`).join(", ")}`:`a ${r} block says nothing else`));let i=e[r];switch(r){case"title":case"headline":case"text":case"badge":A(i,`${n}.${r}`,s,r==="text"||r==="headline"?r:void 0,r==="text"&&"lines"in e),"tone"in e&&Q(e.tone,`${n}.tone`,s),r==="text"&&"lines"in e&&J(e.lines,`${n}.lines`,s);return;case"image":case"field":{let o=r==="image";if(typeof i!="string"||!(o?s.spec.files?.(i):s.spec.field(i))){let u=typeof i=="string"&&s.spec.relation(i);s.findings.push(d(`view-${r}`,`${n}.${r}`,`${s.kind} has no ${o?"image, video or file ":""}field ${typeof i=="string"?`"${i}"`:"by that name"}`,u?`"${i}" is a relation; show it with {"text": "{${i}.name}"}`:void 0))}let f=o?["thumb","gallery"]:U;"as"in e&&!f.includes(e.as)&&s.findings.push(d("view-format",`${n}.as`,`"${String(e.as)}" is not a way to show ${o?"pictures":"a field"}`,`use one of ${f.join(", ")}`)),o||D(e,n,s,"field"),"label"in e&&oe(e.label,`${n}.label`,s);return}case"progress":{!g(i)||Object.keys(i).some(o=>o!=="value"&&o!=="max")||!("value"in i)||!("max"in i)?s.findings.push(d("view-progress",`${n}.progress`,'progress is {"value": expression, "max": expression}')):(k(i.value,`${n}.progress.value`,s),k(i.max,`${n}.progress.max`,s)),"label"in e&&A(e.label,`${n}.label`,s);return}case"group":"direction"in e&&e.direction!=="row"&&e.direction!=="column"&&s.findings.push(d("view-direction",`${n}.direction`,`a group runs "row" or "column", not "${String(e.direction)}"`)),x(i,`${n}.group`,t+1,s);return;case"when":k(i,`${n}.when`,s),"show"in e?x(e.show,`${n}.show`,t+1,s):s.findings.push(d("view-when",n,'a condition says what it shows: {"when": expr, "show": [blocks]}'));return;case"figure":if(typeof i=="string")return ne(e,n,s);for(let o of["as","currency","label","emphasis"])o in e&&s.findings.push(d("unknown-key",`${n}.${o}`,`"${o}" belongs to a figure that works a number out; {"figure": true} is the kind's picture`,`write {"figure": "count(all('offer'))", "as": "number"}`));i!==!0?s.findings.push(d("view-block",`${n}.figure`,`a figure is a number worked out, {"figure": "sum(all('offer'), net)", "as": "money"}, or the kind's picture, {"figure": true}`)):s.spec.figure||s.findings.push(d("view-figure",`${n}.figure`,`${z(s)} has no figure to show`,s.kind===null?`work a number out: {"figure": "count(all('offer'))"}`:'give the kind a "figure", or leave this block out'));return;case"list":return te(e,n,s);case"divider":i!==!0&&s.findings.push(d("view-block",`${n}.${r}`,`write {"${r}": true}`));return}}function ne(e,n,t){k(e.figure,`${n}.figure`,t),"as"in e&&!L.includes(e.as)&&t.findings.push(d("view-format",`${n}.as`,`"${String(e.as)}" is not a way to say a figure`,`use one of ${L.join(", ")}`)),D(e,n,t,"figure"),"label"in e&&A(e.label,`${n}.label`,t),"emphasis"in e&&!B.includes(e.emphasis)&&t.findings.push(d("view-emphasis",`${n}.emphasis`,`"${String(e.emphasis)}" is not how loudly a figure is said`,`use ${B.map(s=>`"${s}"`).join(", ")}, or leave it out for the figure's own size`))}function D(e,n,t,s){"currency"in e&&(typeof e.currency!="string"||!/^[A-Z]{3}$/.test(e.currency)?t.findings.push(d("view-currency",`${n}.currency`,'a currency is its three-letter code, like "USD" or "EUR"')):e.as!=="money"&&t.findings.push(d("view-currency",`${n}.currency`,`a currency belongs on a ${s} shown as money`,'add "as": "money"')))}function ie(e,n){let t=[...n.kinds],s=(l,r)=>{let i=new Set;for(let o of l){let f=n.vocabulary.namesOf(o)?.targets?.(r);if(f==="*")return t;for(let u of f??[])i.add(u)}return i.size>0?[...i]:void 0},a=l=>{switch(l.t){case"ident":return n.kind!==null&&n.spec.relation(l.name)?s([n.kind],l.name):void 0;case"member":{let r=a(l.object);return r?s(r,l.name):void 0}case"where":return a(l.set);case"call":{let r=l.args[0],i=r?.t==="lit"&&typeof r.value=="string"?r.value:void 0;if(l.fn==="all")return i!==void 0&&n.kinds.has(i)?[i]:void 0;let o=l.args.length===2&&l.args[1]?.t==="lit"&&typeof l.args[1].value=="string"?l.args[1].value:void 0;if(l.fn==="out"&&o!==void 0){let f=a(r);return f?s(f,o):void 0}if(l.fn==="out")return i!==void 0&&n.kind!==null?s([n.kind],i):void 0;if(l.fn==="in"){let f=o??i,u=o!==void 0?a(r):n.kind!==null?[n.kind]:void 0,c=f!==void 0?n.vocabulary.sources(f).filter(p=>{let y=n.vocabulary.namesOf(p)?.targets?.(f);return!u||y==="*"||u.some(h=>y?.includes(h))}):[];return c.length>0?c:void 0}if((l.fn==="sort"||l.fn==="first")&&r)return a(r);if(l.fn==="either"){let f=l.args.map(a);return f.every(u=>u!==void 0)?[...new Set(f.flatMap(u=>u??[]))]:void 0}return}default:return}};return a(e)}function N(e,n,t,s){let a;try{a=w(e)}catch(r){if(!(r instanceof b))throw r;s.findings.push(d("expression",n,`${r.sentence} (at character ${r.at+1})`));return}let l=O(a);for(let r of l.unknownFunctions)s.findings.push(d("unknown-function",n,`"${r}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));for(let r of l.edges)s.edges.has(r)||s.findings.push(d("view-edge",n,`"${r}" is not a relation any kind declares`));if(t)for(let r of l.names)r==="id"||t.some(i=>s.vocabulary.namesOf(i)?.field(r)||s.vocabulary.namesOf(i)?.relation(r))||s.findings.push(d("view-name",n,`${t.join(" and ")} ${t.length===1?"has":"have"} no field or relation called "${r}"`))}function te(e,n,t){let s=e.list;k(s,`${n}.list`,t);let a;if(typeof s=="string")try{a=ie(w(s),t)}catch{a=void 0}let l=i=>{if(!a)return[...t.kinds].map(f=>t.vocabulary.namesOf(f)?.choices?.(i)).find(f=>f!==void 0);let o=a.map(f=>t.vocabulary.namesOf(f)?.choices?.(i));return o.every(f=>f!==void 0)?[...new Set(o.flatMap(f=>f??[]))]:void 0},r=a?a.join(" and "):"any kind";if("sort"in e){let i=e.sort;if(typeof i=="string")N(i,`${n}.sort`,a,t);else if(g(i)&&typeof i.by=="string"&&Object.keys(i).every(o=>o==="by"||o==="direction")){let o=i.direction;o!==void 0&&o!=="asc"&&o!=="desc"&&o!=="choices"?t.findings.push(d("list-sort",`${n}.sort.direction`,`a list is sorted "asc", "desc" or "choices", not "${String(o)}"`,'"choices" puts a choice field in the order its choices are declared')):o==="choices"?l(i.by)===void 0&&t.findings.push(d("list-sort",`${n}.sort.by`,`"${i.by}" is not a choice field of ${r}, so it has no declared order`,'sort by a choice field, or say "asc" or "desc"')):N(i.by,`${n}.sort.by`,a,t)}else t.findings.push(d("list-sort",`${n}.sort`,'a sort is a key, like "net", or {"by": key, "direction": "asc" | "desc" | "choices"}'))}if("limit"in e){let i=e.limit;(typeof i!="number"||!Number.isInteger(i)||i<1||i>M)&&t.findings.push(d("list-limit",`${n}.limit`,`a limit is a whole number from 1 to ${M}`))}if("group"in e){let i=e.group,o=typeof i=="string"?i:g(i)&&typeof i.by=="string"?i.by:void 0;if(!(typeof i=="string"||g(i)&&Object.keys(i).every(u=>u==="by"||u==="headings"))||o===void 0)t.findings.push(d("list-group",`${n}.group`,'a group is a choice field, like "type", or {"by": "type", "headings": {"pain": "What hurts"}} \u2014 or a relation, like "inGenre", a heading per linked record'));else{let u=l(o),c=u===void 0?X(o):void 0,p=c!==void 0&&(c.way!==void 0?t.edges.has(c.edge):a?a.every(y=>t.vocabulary.namesOf(y)?.relation(c.edge)):t.edges.has(c.edge));if(u===void 0&&!p&&t.findings.push(d("list-group",`${n}.group`,`"${o}" is not a choice field or a relation of ${r}, so it has nothing to group by`,'group by a field whose type is enum, or by a relation of the kind listed, like "inGenre"')),g(i)&&"headings"in i){let y=i.headings;if(!g(y)||Object.values(y).some(h=>typeof h!="string"||h.length===0||h.length>80))t.findings.push(d("list-group",`${n}.group.headings`,'headings are words per choice, like {"pain": "What hurts"}, at most 80 characters each'));else if(u)for(let h of Object.keys(y))u.includes(h)||t.findings.push(d("list-group",`${n}.group.headings.${h}`,`"${h}" is not one of ${o}'s choices`,`use ${u.join(", ")}`))}}}"empty"in e&&(typeof e.empty!="string"||e.empty.length===0||e.empty.length>200)&&t.findings.push(d("list-empty",`${n}.empty`,"what an empty list says is a sentence, at most 200 characters")),"as"in e&&!C.includes(e.as)&&t.findings.push(d("list-as",`${n}.as`,`a list draws each record as its "card" or its "row", not "${String(e.as)}"`))}function oe(e,n,t){(typeof e!="string"||e.length===0||e.length>60)&&t.findings.push(d("view-label",n,"a label is a few words, at most 60 characters"))}function P(e,n,t,s,a,l,r){let i={kind:null,spec:q,kinds:s,edges:a,vocabulary:t,findings:l,count:0,all:0};Array.isArray(e)&&e.length===0&&l.push(d("view-shape",n,`${r} has no blocks`,'give it one: {"headline": "\u2026"}')),x(e,n,1,i),H(i,n,r,"show less")}function H(e,n,t,s){e.count>T?e.findings.push(d("view-size",n,`${t} has ${e.count} blocks at its top; a view has at most ${T} there, a group or a condition counting as one`,`${s}, or gather some into a group`)):e.all>I&&e.findings.push(d("view-size",n,`${t} has ${e.all} blocks counting the ones inside its groups and conditions; a view has at most ${I} in all`,s))}function se(e,n,t,s,a){Array.isArray(e)&&e.forEach((l,r)=>{if(!g(l)||l.name!=="blocks"||!g(l.options)||!("blocks"in l.options))return;let i=[];P(l.options.blocks,`lenses.${r}.options.blocks`,n,t,s,i,`the lens "${String(l.title??r)}"`);for(let o of i)a.push({...o,severity:"warning"})})}function re(e,n,t,s,a,l,r){let i=[];if(e===void 0)return i;if(!g(e))return i.push(d("view-shape",n,'views are an object of kinds, each with a "card", a "row" or a "page"')),i;for(let[o,f]of Object.entries(e)){if(o==="home"&&Array.isArray(f)){P(f,`${n}.home`,r,s,a,i,"the home");continue}let u=t(o);if(!u){i.push(d("view-kind",`${n}.${o}`,`"${o}" is not a kind this ${l} declares`));continue}if(!g(f)){i.push(d("view-shape",`${n}.${o}`,`a kind's views are {"card": [blocks], "row": [blocks], "page": [blocks]}`));continue}for(let c of Object.keys(f))E.includes(c)||i.push(d("view-slot",`${n}.${o}.${c}`,`"${c}" is not a place a view is drawn`,`use ${E.map(p=>`"${p}"`).join(", ")}`));for(let c of E){let p=f[c];if(p===void 0)continue;let y={kind:o,spec:u,kinds:s,edges:a,vocabulary:r,findings:i,count:0,all:0,slot:c};x(p,`${n}.${o}.${c}`,1,y),H(y,`${n}.${o}.${c}`,`this ${c}`,"show less, or move detail to the page")}}return i}function he(e){let n=new Set(Object.keys(e.kinds)),t=new Set(Object.values(e.kinds).flatMap(r=>Object.keys($(r.edges)))),s=r=>{let i=m(e.kinds,r)?e.kinds[r]:void 0;return i?{field:o=>m(i.fields,o)||m(i.computed,o)||F(i.edges).has(o),relation:o=>m($(i.edges),o),figure:i.figure!==void 0,files:o=>m(i.fields,o)&&Y(i.fields[o]),choices:o=>m(i.fields,o)&&i.fields[o].type==="enum"?i.fields[o].options:void 0,targets:o=>m($(i.edges),o)?i.edges[o].to:void 0,prose:o=>m(i.fields,o)&&i.fields[o].type==="text"}:void 0},a={namesOf:s,sources:r=>Object.keys(e.kinds).filter(i=>m(e.kinds[i].edges,r))},l=re(e.views,"views",s,n,t,"document",a);return se(e.lenses,a,n,t,l),l}export{j as a,U as b,L as c,B as d,M as e,ce as f,X as g,ge as h,ye as i,he as j};
@@ -0,0 +1 @@
1
+ import{b as f}from"./chunk.4YAO3A5Q.js";import"./chunk.4DXPPM6T.js";import"./chunk.DLSS56EU.js";import"./chunk.7WPVLEX2.js";import"./chunk.Q355UPFG.js";import{o as g}from"./chunk.DGDW54KE.js";import"./chunk.LMTG5NPG.js";import"./chunk.YBQ5GVAX.js";import"./chunk.EB7PZJEO.js";import"./chunk.42KHFGN6.js";import"./chunk.RQG672MJ.js";import"./chunk.Q6H5HESF.js";import"./chunk.3JMQKANL.js";import"./chunk.42C3FIKK.js";import"./chunk.2ME4DVBI.js";import"./chunk.XXCHO2A5.js";import"./chunk.SADR3MQI.js";import"./chunk.MB7LKKUD.js";import"./chunk.ODYJEDIW.js";import"./chunk.IPGLITWA.js";import"./chunk.LFFJB6D3.js";import"./chunk.DMZRFXH7.js";import"./chunk.DZ6UDZOB.js";import"./chunk.O5FTWXA2.js";import"./chunk.Q4VFLLUT.js";import"./chunk.6ZENHSTQ.js";import"./chunk.CNN32262.js";import"./chunk.BJUUSIQY.js";import"./chunk.N5Z34V7U.js";import"./chunk.LOKGUALC.js";import"./chunk.XOZU4OFA.js";import"./chunk.EP5JS7ZH.js";import"./chunk.WVUJXDXZ.js";import"./chunk.L7XKYGV7.js";import"./chunk.CE3NKAF7.js";import"./chunk.R3GE37OI.js";import"./chunk.2KCDLCB2.js";import"./chunk.UD7VLXPM.js";import"./chunk.3DEWQDP7.js";import"./chunk.MIE4TJRW.js";import"./chunk.CFE3MHWZ.js";import"./chunk.RD2FSSLV.js";import"./chunk.HXTKBISQ.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as b,W as h}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{ue as n}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as t}from"./chunk.AJZBJBMO.js";var m=t(b(),1),a=t(h(),1);function P({store:c,auto:y,brand:i,views:u,presence:s,steering:r,overview:o,scope:d,titleLevel:w=2,quickAsk:l,props:e}){let v=(0,m.useMemo)(()=>g({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:y?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:v}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(f,{context:{store:c,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...o?{overview:o}:{},titleLevel:w,views:u,settings:e.app.settings??[],app:e.app,...s?{presence:s}:{},...i?{brand:i}:{},...e.locale?{locale:e.locale}:{},...e.timeZone?{timeZone:e.timeZone}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{},...e.subscriptions?{subscriptions:e.subscriptions}:{},dismissals:e.dismissals,whileAway:e.whileAway,...e.signIn?{signIn:e.signIn}:{},...l!==void 0?{quickAsk:l}:{}},...e.pages?{registry:e.pages}:{},...r?{steering:r}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.hrefOf?{hrefOf:e.hrefOf}:e.routing==="address"?{}:{hrefOf:!1},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{P as PagesContent};
@@ -1,4 +1,4 @@
1
- import{sd as e}from"./chunk.ZEZUKRC6.js";var i=`
1
+ import{sd as e}from"./chunk.6AANHELP.js";var i=`
2
2
  .graview-spec{display:flex;flex-direction:column;gap:6px;min-width:0;color:var(--graview-ink)}
3
3
 
4
4
  .graview-spec-row{flex-direction:row;flex-wrap:wrap;align-items:center;gap:4px 10px;box-sizing:border-box;max-width:100%;padding:5px 10px;border:1px solid var(--graview-edge);border-radius:var(--graview-radius-sm,8px);background:var(--graview-panel);font-size:.875rem}
@@ -0,0 +1 @@
1
+ import{a,b,c,d,e,f,g,h,i}from"./chunk.AQ2PI6MR.js";import"./chunk.H3W5C3XQ.js";import"./chunk.6WB2TYK7.js";import"./chunk.BJUUSIQY.js";import"./chunk.N5Z34V7U.js";import"./chunk.YL2RBZFE.js";import"./chunk.LOKGUALC.js";import"./chunk.JGRSUTPJ.js";import"./chunk.XOZU4OFA.js";import"./chunk.EP5JS7ZH.js";import"./chunk.CE3NKAF7.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{i as GhostTray,h as InlineAiMenu,g as askAgain,c as askInline,a as askOf,b as drawPanel,d as heldSuggestion,e as suggestOnce,f as takeOffer};