graview 0.1.62 → 0.1.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (202) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/index.js +6 -6
  3. package/dist/index.js.map +1 -1
  4. package/dist/preview/chunk.2D7K2IJQ.js +4 -0
  5. package/dist/preview/{chunk.UFDJXQQQ.js → chunk.2DH42I7L.js} +6 -6
  6. package/dist/preview/chunk.2E62YCMZ.js +1 -0
  7. package/dist/preview/{chunk.GX4G4BX3.js → chunk.2G5WLG3Z.js} +1 -1
  8. package/dist/preview/chunk.2HV5FF6O.js +1 -0
  9. package/dist/preview/{chunk.LGRLVJGS.js → chunk.2JDAUKSN.js} +3 -3
  10. package/dist/preview/{chunk.ZN3PUM2I.js → chunk.2JEN2RCB.js} +1 -1
  11. package/dist/preview/{chunk.66P5IDTH.js → chunk.2TCOLAL2.js} +1 -1
  12. package/dist/preview/{chunk.OWOOKLIU.js → chunk.2V7QTIAV.js} +1 -1
  13. package/dist/preview/{chunk.IQ3PRWGO.js → chunk.2VIS2NAT.js} +2 -2
  14. package/dist/preview/{chunk.UQQKDBIH.js → chunk.2VYGDY5Z.js} +1 -1
  15. package/dist/preview/{chunk.WEOVK2T4.js → chunk.37I45R6V.js} +1 -1
  16. package/dist/preview/chunk.3FKKH2XU.js +74 -0
  17. package/dist/preview/chunk.3J7XLJP2.js +1 -0
  18. package/dist/preview/chunk.3OEODIHB.js +1 -0
  19. package/dist/preview/{chunk.WPXPVD33.js → chunk.3RD4JHVG.js} +1 -1
  20. package/dist/preview/{chunk.CHHYIMB7.js → chunk.3RUV4HE4.js} +1 -1
  21. package/dist/preview/chunk.3SAESG6X.js +1 -0
  22. package/dist/preview/{chunk.4HEFUOLV.js → chunk.47N2G7A5.js} +1 -1
  23. package/dist/preview/{chunk.A3ZC2JBO.js → chunk.4DZOAB4D.js} +1 -1
  24. package/dist/preview/chunk.4HTB6TX2.js +1 -0
  25. package/dist/preview/chunk.4Q5PCMGZ.js +18 -0
  26. package/dist/preview/{chunk.DPEIT3TW.js → chunk.4U45EY5M.js} +1 -1
  27. package/dist/preview/{chunk.2B6P4GPS.js → chunk.4VRX7FCO.js} +1 -1
  28. package/dist/preview/{chunk.JT3MFPRD.js → chunk.4XCYZRZ3.js} +1 -1
  29. package/dist/preview/chunk.52MBXPEK.js +1 -0
  30. package/dist/preview/chunk.5AD2QHWH.js +3 -0
  31. package/dist/preview/{chunk.MDEX6ZVE.js → chunk.5B7NG6WH.js} +1 -1
  32. package/dist/preview/chunk.5HJ2GTKZ.js +1 -0
  33. package/dist/preview/chunk.5IEZF433.js +2 -0
  34. package/dist/preview/{chunk.QGU5QTR6.js → chunk.5PPCK7QT.js} +1 -1
  35. package/dist/preview/chunk.6NRWLCIZ.js +5 -0
  36. package/dist/preview/chunk.75JQCTR6.js +1 -0
  37. package/dist/preview/{chunk.KMV6PJFL.js → chunk.77JI5T4F.js} +1 -1
  38. package/dist/preview/chunk.77MLXWZV.js +35 -0
  39. package/dist/preview/chunk.7AOEZJRM.js +1 -0
  40. package/dist/preview/{chunk.QIPASE42.js → chunk.7CLKGKSF.js} +1 -1
  41. package/dist/preview/{chunk.BZMQDEIY.js → chunk.7SRSE5IS.js} +1 -1
  42. package/dist/preview/{chunk.2GEJNG2U.js → chunk.7VAHHEDX.js} +1 -1
  43. package/dist/preview/{chunk.VJBBVLGZ.js → chunk.7ZG77OI3.js} +1 -1
  44. package/dist/preview/chunk.7ZHH7WBN.js +1 -0
  45. package/dist/preview/chunk.AJEK3I5X.js +6 -0
  46. package/dist/preview/chunk.APRWUIE3.js +1 -0
  47. package/dist/preview/{chunk.QHY5NVYH.js → chunk.APUQIELA.js} +1 -1
  48. package/dist/preview/{chunk.Y4FZKUOK.js → chunk.ATHLE33D.js} +1 -1
  49. package/dist/preview/chunk.B2YTHEX5.js +1 -0
  50. package/dist/preview/{chunk.ELOFPE25.js → chunk.B6JR7EQO.js} +1 -1
  51. package/dist/preview/{chunk.5ODHHH35.js → chunk.BN42H3C6.js} +1 -1
  52. package/dist/preview/{chunk.DD2NKFDX.js → chunk.BVIJXL4J.js} +1 -1
  53. package/dist/preview/{chunk.5HGD6OWL.js → chunk.CC7P435K.js} +2 -2
  54. package/dist/preview/{chunk.IQMD7DG3.js → chunk.CJHYGRWV.js} +1 -1
  55. package/dist/preview/chunk.CM65MCHA.js +1 -0
  56. package/dist/preview/{chunk.MYNMBOLD.js → chunk.D2XLECMP.js} +1 -1
  57. package/dist/preview/chunk.DJIF7IAQ.js +2 -0
  58. package/dist/preview/{chunk.G4ULQK64.js → chunk.DLWFULWE.js} +1 -1
  59. package/dist/preview/{chunk.QDWSU47A.js → chunk.DMENNIHT.js} +1 -1
  60. package/dist/preview/{chunk.L3WTKQQL.js → chunk.DN7UCBOA.js} +1 -1
  61. package/dist/preview/{chunk.22BZU7ME.js → chunk.DQAMVVE6.js} +1 -1
  62. package/dist/preview/chunk.DUP2CGVH.js +1 -0
  63. package/dist/preview/{chunk.TM4EPUNO.js → chunk.DYRULRFX.js} +1 -1
  64. package/dist/preview/{chunk.AFNSAQEQ.js → chunk.E4TXLT25.js} +1 -1
  65. package/dist/preview/{chunk.DDUCIUVW.js → chunk.F6BNFLQM.js} +1 -1
  66. package/dist/preview/chunk.FN34P4IS.js +1 -0
  67. package/dist/preview/{chunk.AJSUHPBE.js → chunk.FUPYIOXZ.js} +1 -1
  68. package/dist/preview/{chunk.7KVUUEZA.js → chunk.FXRYMT3U.js} +1 -1
  69. package/dist/preview/{chunk.DEAP3H2L.js → chunk.G5BVZLCM.js} +1 -1
  70. package/dist/preview/{chunk.Y2YYH3JN.js → chunk.G7YLK4PX.js} +1 -1
  71. package/dist/preview/chunk.GF62K25C.js +1 -0
  72. package/dist/preview/chunk.GFQPO3NC.js +1 -0
  73. package/dist/preview/{chunk.5STU3KYG.js → chunk.GH5UBSQI.js} +1 -1
  74. package/dist/preview/chunk.GHHKRFPD.js +1 -0
  75. package/dist/preview/{chunk.THVC2BEC.js → chunk.GP5DAA4P.js} +1 -1
  76. package/dist/preview/{chunk.VN23AGIY.js → chunk.HPG6CNKM.js} +1 -1
  77. package/dist/preview/chunk.HSJEOM3W.js +1 -0
  78. package/dist/preview/{chunk.H5S7OL2U.js → chunk.HZPRMHSL.js} +1 -1
  79. package/dist/preview/chunk.IQGSEAQ2.js +5 -0
  80. package/dist/preview/{chunk.PCDUV3WP.js → chunk.ITBG37WJ.js} +1 -1
  81. package/dist/preview/{chunk.SVPKUWZU.js → chunk.JHUCKEJS.js} +1 -1
  82. package/dist/preview/{chunk.H7N7WN4U.js → chunk.JOM6MFVE.js} +1 -1
  83. package/dist/preview/{chunk.DNVWSWL2.js → chunk.JS2UZYGB.js} +1 -1
  84. package/dist/preview/{chunk.7XLS6XTY.js → chunk.K2PXP5H6.js} +1 -1
  85. package/dist/preview/{chunk.6AKW7TXM.js → chunk.K54ISAXN.js} +1 -1
  86. package/dist/preview/{chunk.3FON2Y72.js → chunk.K5YFUMRS.js} +1 -1
  87. package/dist/preview/chunk.KHXRJLLU.js +50 -0
  88. package/dist/preview/chunk.KMIFSPGQ.js +1 -0
  89. package/dist/preview/chunk.L4V5VLSM.js +1 -0
  90. package/dist/preview/{chunk.T6WHGKWR.js → chunk.LDMBJC3B.js} +1 -1
  91. package/dist/preview/{chunk.PLTH2LW5.js → chunk.LTOQ22ZJ.js} +1 -1
  92. package/dist/preview/{chunk.UVA7AALY.js → chunk.M5VHUIDB.js} +1 -1
  93. package/dist/preview/chunk.N643PVQA.js +1 -0
  94. package/dist/preview/{chunk.FULEUL34.js → chunk.NGRL3QOI.js} +1 -1
  95. package/dist/preview/{chunk.OFWNMTGB.js → chunk.NRPBTV6O.js} +2 -2
  96. package/dist/preview/{chunk.N6EJXXQK.js → chunk.O7HHNQK4.js} +2 -2
  97. package/dist/preview/{chunk.5YAOKOGV.js → chunk.OW3M4OBN.js} +1 -1
  98. package/dist/preview/{chunk.2N4Z5K5S.js → chunk.OXFDB5BB.js} +1 -1
  99. package/dist/preview/{chunk.4TX6VCBT.js → chunk.P4TAX3HE.js} +1 -1
  100. package/dist/preview/{chunk.RYRQ66JN.js → chunk.P6FNJR6E.js} +1 -1
  101. package/dist/preview/chunk.PR74PGLC.js +1 -0
  102. package/dist/preview/{chunk.F7YXLYLX.js → chunk.PVDDSBRG.js} +1 -1
  103. package/dist/preview/{chunk.OUDATENL.js → chunk.QROPDEJF.js} +1 -1
  104. package/dist/preview/{chunk.I77ZGIFE.js → chunk.QRT6BZR6.js} +1 -1
  105. package/dist/preview/{chunk.OWT3VVOT.js → chunk.R5MLRKAO.js} +2 -2
  106. package/dist/preview/chunk.RDA35HZB.js +2 -0
  107. package/dist/preview/{chunk.ROZTJ6IY.js → chunk.REXU6ARY.js} +1 -1
  108. package/dist/preview/chunk.S6QZBWCJ.js +1 -0
  109. package/dist/preview/{chunk.MAKODQO3.js → chunk.S7SHWDPR.js} +1 -1
  110. package/dist/preview/{chunk.SWMDFXUX.js → chunk.SADHOSRC.js} +1 -1
  111. package/dist/preview/chunk.SJHUC4TL.js +1 -0
  112. package/dist/preview/chunk.SL5FXE3R.js +1 -0
  113. package/dist/preview/{chunk.X6KYRBL6.js → chunk.T4JP6BGP.js} +1 -1
  114. package/dist/preview/{chunk.TIALD6SC.js → chunk.T4TRJDBF.js} +1 -1
  115. package/dist/preview/{chunk.M4AYA2PL.js → chunk.TA2JTUNX.js} +1 -1
  116. package/dist/preview/{chunk.EVBCEEQ4.js → chunk.TMHVYI5R.js} +1 -1
  117. package/dist/preview/chunk.TOLW64EO.js +1 -0
  118. package/dist/preview/chunk.TP3PZRHE.js +1 -0
  119. package/dist/preview/{chunk.PZQNR4KZ.js → chunk.TQ2G4AM4.js} +1 -1
  120. package/dist/preview/{chunk.5J3O2FVG.js → chunk.TUR2DA2M.js} +1 -1
  121. package/dist/preview/{chunk.B23WZQXQ.js → chunk.TYIBLD2D.js} +1 -1
  122. package/dist/preview/{chunk.DC35FJAB.js → chunk.UD2GGG7L.js} +1 -1
  123. package/dist/preview/chunk.UDU545CL.js +1 -0
  124. package/dist/preview/{chunk.RPDH32XV.js → chunk.UDYFGYJP.js} +1 -1
  125. package/dist/preview/{chunk.SEHRPTNA.js → chunk.UJNLT3L6.js} +1 -1
  126. package/dist/preview/chunk.UN2IAA5R.js +1 -0
  127. package/dist/preview/chunk.VLX7YWVH.js +25 -0
  128. package/dist/preview/{chunk.T3UQ7ZQK.js → chunk.VT4YBFZL.js} +1 -1
  129. package/dist/preview/{chunk.ELTV44HU.js → chunk.VZAF3452.js} +2 -2
  130. package/dist/preview/{chunk.O2BHPYA4.js → chunk.WFCE7NLK.js} +2 -2
  131. package/dist/preview/{chunk.CY3ELWCM.js → chunk.WHX47OJM.js} +1 -1
  132. package/dist/preview/{chunk.NUWDMH47.js → chunk.WMARJ5E3.js} +1 -1
  133. package/dist/preview/chunk.WPQP54FM.js +1 -0
  134. package/dist/preview/{chunk.6JO5HQDR.js → chunk.WX23K7ZU.js} +1 -1
  135. package/dist/preview/{chunk.W4BKYSZX.js → chunk.X36BYTEG.js} +1 -1
  136. package/dist/preview/{chunk.AQRB7LDA.js → chunk.XCLW4GP7.js} +1 -1
  137. package/dist/preview/{chunk.DDO3GLEJ.js → chunk.XEG7ZDRG.js} +1 -1
  138. package/dist/preview/{chunk.ILIIBSGA.js → chunk.XIVELWAM.js} +1 -1
  139. package/dist/preview/{chunk.75GVFX7L.js → chunk.XJWKIXPV.js} +1 -1
  140. package/dist/preview/{chunk.O75HWF3F.js → chunk.XQ5RTPEF.js} +1 -1
  141. package/dist/preview/{chunk.NOGGSLVG.js → chunk.YEXFVDRA.js} +1 -1
  142. package/dist/preview/{chunk.UXMPFPFH.js → chunk.YIZPW7IK.js} +2 -2
  143. package/dist/preview/chunk.YLOGIJOH.js +1 -0
  144. package/dist/preview/chunk.YMXWS4XN.js +3 -0
  145. package/dist/preview/{chunk.Z2TDZSMN.js → chunk.YSBTE3PX.js} +1 -1
  146. package/dist/preview/{chunk.RD2X25XB.js → chunk.Z26T5E76.js} +1 -1
  147. package/dist/preview/{chunk.A3OL2BI2.js → chunk.Z4XGEV34.js} +1 -1
  148. package/dist/preview/chunk.ZA5TDCBC.js +1 -0
  149. package/dist/preview/chunk.ZNDVJGTY.js +1 -0
  150. package/dist/preview/chunk.ZQGLPP7A.js +1 -0
  151. package/dist/preview/index.html +53 -52
  152. package/dist/preview/page.js +2 -2
  153. package/dist/preview/splash.js +7 -6
  154. package/package.json +6 -6
  155. package/dist/preview/chunk.2AT3GRXM.js +0 -1
  156. package/dist/preview/chunk.4HRYB7HF.js +0 -1
  157. package/dist/preview/chunk.5MZYCELA.js +0 -6
  158. package/dist/preview/chunk.7M4HNKDR.js +0 -1
  159. package/dist/preview/chunk.7OBIBPYH.js +0 -1
  160. package/dist/preview/chunk.7V56P2A7.js +0 -1
  161. package/dist/preview/chunk.7YOAW7ED.js +0 -1
  162. package/dist/preview/chunk.ACTXR2MI.js +0 -3
  163. package/dist/preview/chunk.AI34V6WV.js +0 -74
  164. package/dist/preview/chunk.BLUKSGI4.js +0 -1
  165. package/dist/preview/chunk.CAKFNKN5.js +0 -1
  166. package/dist/preview/chunk.CGALLZ54.js +0 -1
  167. package/dist/preview/chunk.DHJ3FQTR.js +0 -1
  168. package/dist/preview/chunk.DZZL5IDD.js +0 -5
  169. package/dist/preview/chunk.H24OC6OE.js +0 -1
  170. package/dist/preview/chunk.H73ZPYUX.js +0 -1
  171. package/dist/preview/chunk.HANJZ6FA.js +0 -1
  172. package/dist/preview/chunk.HIMQ65QT.js +0 -1
  173. package/dist/preview/chunk.IQPILSV3.js +0 -18
  174. package/dist/preview/chunk.IYBEXENQ.js +0 -1
  175. package/dist/preview/chunk.J7Q2WAF4.js +0 -28
  176. package/dist/preview/chunk.JYFZCJ4N.js +0 -2
  177. package/dist/preview/chunk.KDXU5DT3.js +0 -1
  178. package/dist/preview/chunk.KL7E4YHJ.js +0 -1
  179. package/dist/preview/chunk.LAYQ5PFS.js +0 -1
  180. package/dist/preview/chunk.LTZUF5VG.js +0 -1
  181. package/dist/preview/chunk.M7RESZB6.js +0 -25
  182. package/dist/preview/chunk.MGALQLRW.js +0 -1
  183. package/dist/preview/chunk.NAD7ZXYP.js +0 -1
  184. package/dist/preview/chunk.NHTGAP3G.js +0 -3
  185. package/dist/preview/chunk.NUYA4BWI.js +0 -1
  186. package/dist/preview/chunk.OKZT2QBM.js +0 -2
  187. package/dist/preview/chunk.OUPURRDE.js +0 -1
  188. package/dist/preview/chunk.PD2DECOP.js +0 -1
  189. package/dist/preview/chunk.PKWQKFPE.js +0 -2
  190. package/dist/preview/chunk.RMR24LFJ.js +0 -4
  191. package/dist/preview/chunk.RRKI24WY.js +0 -1
  192. package/dist/preview/chunk.SGCW2XRC.js +0 -1
  193. package/dist/preview/chunk.SS7234R6.js +0 -1
  194. package/dist/preview/chunk.TKUNRFDE.js +0 -1
  195. package/dist/preview/chunk.U6ZRJKVM.js +0 -1
  196. package/dist/preview/chunk.UKQUUPKE.js +0 -1
  197. package/dist/preview/chunk.VACKSKGJ.js +0 -1
  198. package/dist/preview/chunk.VC3V7HLL.js +0 -1
  199. package/dist/preview/chunk.VIH5AX7S.js +0 -5
  200. package/dist/preview/chunk.WKI5INH7.js +0 -1
  201. package/dist/preview/chunk.Y4S7CDRB.js +0 -1
  202. package/dist/preview/chunk.YP2QSPXU.js +0 -50
@@ -1 +0,0 @@
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{r as Ie}from"./chunk.2GEJNG2U.js";import{d as Je,e as Ee,h as je,i as ze}from"./chunk.U6ZRJKVM.js";import{a as He}from"./chunk.PZQNR4KZ.js";import{e as X}from"./chunk.Y2YYH3JN.js";import{a as z}from"./chunk.NOGGSLVG.js";import{f as Pe,g as Y,i as De}from"./chunk.OKZT2QBM.js";import{a as Se}from"./chunk.ACTXR2MI.js";import{$b as B,Ac as xe,Bc as Me,Cc as Ne,Da as me,Ga as K,Ia as he,Ib as ve,Ka as ye,La as Z,O as pe,Qb as Ae,Rb as Oe,Sa as ge,Ta as we,Vb as Re,Wa as be,Yb as _e,a as fe,bb as W,fb as ke,hc as Te,ka as G,yd as $e}from"./chunk.DZZL5IDD.js";var E=(n,e,t)=>{(n[e]===void 0||t>n[e])&&(n[e]=t)},j=(n,e,t)=>{(n[e]===void 0||t<n[e])&&(n[e]=t)},Q=(n,e)=>{n.format=e,e.includes("int")&&(n.isInt=!0)},Le=(n,e)=>{n.mime=n.mime?n.mime.filter(t=>e.includes(t)):[...e]},Fe=(n,e)=>{n.multipleOf??=[],n.multipleOf.includes(e)||n.multipleOf.push(e)},qe=(n,e)=>(n.patterns??=new Set).add(e),st={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]};function H(n){let e={},{def:t,bag:r}=n._zod,i=n._zod.traits.has("$ZodCheck")?[n,...t.checks??[]]:t.checks??[];for(let a of i){let o=a._zod.def;switch(o.check){case"greater_than":E(e,o.inclusive?"minimum":"exclusiveMinimum",o.value);break;case"less_than":j(e,o.inclusive?"maximum":"exclusiveMaximum",o.value);break;case"multiple_of":Fe(e,o.value);break;case"number_format":{Q(e,o.format);let d=st[o.format];d&&(E(e,"minimum",d[0]),j(e,"maximum",d[1]));break}case"bigint_format":Q(e,o.format);break;case"min_length":case"min_size":E(e,"minimum",o.minimum);break;case"max_length":case"max_size":j(e,"maximum",o.maximum);break;case"length_equals":E(e,"minimum",o.length),j(e,"maximum",o.length);break;case"size_equals":E(e,"minimum",o.size),j(e,"maximum",o.size);break;case"string_format":Q(e,o.format),o.pattern&&qe(e,o.pattern),(o.format==="base64"||o.format==="base64url")&&(e.contentEncoding=o.format),(o.local||o.precision===-1)&&(e.laxFormat=!0);break;case"mime_type":Le(e,o.mime);break}}r.minimum!==void 0&&E(e,"minimum",r.minimum),r.exclusiveMinimum!==void 0&&E(e,"exclusiveMinimum",r.exclusiveMinimum),r.maximum!==void 0&&j(e,"maximum",r.maximum),r.exclusiveMaximum!==void 0&&j(e,"exclusiveMaximum",r.exclusiveMaximum),r.multipleOf!==void 0&&Fe(e,r.multipleOf),r.format!==void 0&&(e.format??=r.format,r.format.includes("int")&&(e.isInt=!0)),r.mime&&Le(e,r.mime);for(let a of r.patterns??[])qe(e,a);return e}var dt={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""};function L(n){let e=n._zod.def;return e.type==="pipe"&&e.in._zod.traits.has("$ZodTransform")?L(e.out):e.type==="catch"?L(e.innerType):n._zod.optin}var ct=new Set(["promise","optional","nonoptional","nullable","readonly","default","prefault","catch"]);function T(n,e=new Set){if(e.has(n))return!1;e.add(n);let t=n._zod.def,r=t.type;return r==="transform"?!0:r==="array"?T(t.element,e):r==="set"?T(t.valueType,e):r==="lazy"?T(t.getter(),e):ct.has(r)?T(t.innerType,e):r==="intersection"?T(t.left,e)||T(t.right,e):r==="record"||r==="map"?T(t.keyType,e)||T(t.valueType,e):r==="pipe"?n._zod.traits.has("$ZodCodec")||T(t.in,e)||T(t.out,e):r==="object"?Object.values(t.shape).some(i=>T(i,e)):r==="union"?t.options.some(i=>T(i,e)):r==="tuple"?t.items.some(i=>T(i,e))||(t.rest?T(t.rest,e):!1):!1}function lt(n){let e=Object.values(n).filter(t=>typeof t=="number");return Object.entries(n).filter(([t])=>e.indexOf(+t)===-1).map(([,t])=>t)}function Ce(n){let e=n.anyOf;if(!Array.isArray(e)||e.length===0||n.type!==void 0)return;let t=[];for(let r of e){if(!r||typeof r!="object")return;Ce(r);let i=Object.keys(r);if(i.length!==1||i[0]!=="type")return;for(let a of[r.type].flat()){if(typeof a!="string")return;t.includes(a)||t.push(a)}}delete n.anyOf,n.type=t.length===1?t[0]:t}var Ue=new Set(["type","properties","required","additionalProperties"]),We=n=>{let e=n.additionalProperties;return e&&typeof e=="object"&&Object.keys(e).length?e:null},Be=(n,e)=>JSON.stringify(n)===JSON.stringify(e);function ee(n){for(let i of n){if(typeof i!="object"||i.type!=="object")return null;for(let a in i)if(!Ue.has(a))return null}let e={},t=new Set;for(let i of n){for(let a in i.properties){if(Object.prototype.hasOwnProperty.call(e,a))continue;let o=[];for(let d of n){let s=d.properties?.[a]??We(d);s&&!o.some(w=>Be(w,s))&&o.push(s)}e[a]=o.length===1?o[0]:ee(o)??{allOf:o}}for(let a of i.required??[])t.add(a)}let r={type:"object",properties:e};if(t.size&&(r.required=[...t]),n.every(i=>i.additionalProperties===!1))r.additionalProperties=!1;else{let i=[];for(let a of n){let o=We(a);o&&!i.some(d=>Be(d,o))&&i.push(o)}i.length===1?r.additionalProperties=i[0]:i.length>1&&(r.additionalProperties={allOf:i})}return r}function ut(n){let e=n.allOf;if(!Array.isArray(e)||e.length<2)return;for(let i of Ue)if(i in n)return;let t=e.filter(i=>Array.isArray(i.oneOf)||Array.isArray(i.anyOf)),r;if(!t.length)r=ee(e);else{let i=t[0],a=Array.isArray(i.oneOf)?"oneOf":"anyOf";if(Object.keys(i).length!==1)return;let o=e.filter(s=>s!==i),d=i[a].map(s=>ee([...o,s]));if(d.some(s=>!s))return;r={[a]:d}}r&&(delete n.allOf,Object.assign(n,r))}function Ve(n){let e=n;for(let y of["anyOf","oneOf"]){let _=e[y];if(!Array.isArray(_))continue;let O=_.map(Ve);O.some((v,m)=>v!==_[m])&&(e={...e,[y]:O})}let t=[e.type].flat(),r=!t.includes("string")&&t.some(y=>y==="number"||y==="integer"),i=e.enum??(e.const!==void 0?[e.const]:void 0);if(!r&&!i?.some(y=>typeof y=="number"))return e;let{minimum:a,maximum:o,exclusiveMinimum:d,exclusiveMaximum:s,multipleOf:w,format:p,id:b,...h}=e;return h.enum?h.enum=h.enum.map(y=>typeof y=="number"?String(y):y):typeof h.const=="number"&&(h.const=String(h.const)),r&&(h.type="string",i||(h.pattern=t.includes("number")?"^-?\\d+(?:\\.\\d+)?$":"^-?\\d+$")),h}var C=class{constructor(e,t){this.override=e;this.refs=t}done=new Map;path=[];cyclic=new Map;write(e,t=!1){let r=this.refs.get(e);if(r!==void 0&&!t)return{$ref:r};if(this.path.includes(e))return this.cyclic.has(e)||this.cyclic.set(e,""),{};let i=this.done.get(e);if(i)return i;this.path.push(e);try{let a=this.written(e);return this.done.set(e,a),a}finally{this.path.pop()}}written(e){let t={},r,i=e._zod.toJSONSchema?.();i?Object.assign(t,i):r=this.process(e,t);let a=fe.get(e);if(a)for(let d of Object.keys(a))t[d]=a[d];T(e)&&(delete t.examples,delete t.default),"_prefault"in t&&(t.default??=t._prefault,delete t._prefault);let o=t;if(r){let d=this.write(r);o={...t};for(let s of Object.keys(d))s in t||(o[s]=d[s])}return this.override({zodSchema:e,jsonSchema:o}),Ce(o),e._zod.def.type==="intersection"&&ut(o),o}process(e,t){let r=e._zod.def;switch(r.type){case"string":{t.type="string";let{minimum:i,maximum:a,format:o,patterns:d,contentEncoding:s,laxFormat:w}=H(e);if(typeof i=="number"&&(t.minLength=i),typeof a=="number"&&(t.maxLength=a),o&&(t.format=dt[o]??o,(t.format===""||o==="time"||w)&&delete t.format),s&&(t.contentEncoding=s),d&&d.size>0){let p=[...d];p.length===1?t.pattern=p[0].source:t.allOf=p.map(b=>({pattern:b.source}))}return}case"number":{let{minimum:i,maximum:a,multipleOf:o,exclusiveMinimum:d,exclusiveMaximum:s,isInt:w}=H(e);if(t.type=w?"integer":"number",typeof d=="number"&&d>=(i??Number.NEGATIVE_INFINITY)?t.exclusiveMinimum=d:typeof i=="number"&&(t.minimum=i),typeof s=="number"&&s<=(a??Number.POSITIVE_INFINITY)?t.exclusiveMaximum=s:typeof a=="number"&&(t.maximum=a),o){let[p,...b]=new Set(o.filter(h=>Number.isFinite(h)&&h!==0).map(Math.abs));p!==void 0&&(t.multipleOf=p),b.length&&(t.allOf=[...t.allOf??[],...b.map(h=>({multipleOf:h}))])}return}case"boolean":case"success":t.type="boolean";return;case"null":t.type="null";return;case"never":t.not={};return;case"enum":{let i=lt(r.entries);i.length===0?t.not={}:(i.every(a=>typeof a=="number")&&(t.type="number"),i.every(a=>typeof a=="string")&&(t.type="string"),t.enum=i);return}case"literal":{let i=r.values.filter(a=>a!==void 0).map(a=>typeof a=="bigint"?Number(a):a);if(r.values.length===0)t.not={};else if(i.length===1)t.type=i[0]===null?"null":typeof i[0],t.const=i[0];else if(i.length>1){for(let a of["number","string","boolean"])i.every(o=>typeof o===a)&&(t.type=a);i.every(a=>a===null)&&(t.type="null"),t.enum=i}return}case"template_literal":t.type="string",t.pattern=e._zod.pattern.source;return;case"file":{t.type="string",t.format="binary",t.contentEncoding="binary";let{minimum:i,maximum:a,mime:o}=H(e);i!==void 0&&(t.minLength=i),a!==void 0&&(t.maxLength=a),o&&(o.length===0?t.not={}:o.length===1?t.contentMediaType=o[0]:t.anyOf=o.map(d=>({contentMediaType:d})));return}case"array":{let{minimum:i,maximum:a}=H(e);typeof i=="number"&&(t.minItems=i),typeof a=="number"&&(t.maxItems=a),t.type="array",t.items=this.write(r.element);return}case"object":{let i=r.shape;t.type="object";let a={};t.properties=a;for(let d in i)Object.defineProperty(a,d,{value:this.write(i[d]),writable:!0,enumerable:!0,configurable:!0});let o=Object.keys(i).filter(d=>L(i[d])===void 0);o.length>0&&(t.required=o),r.catchall?._zod.def.type==="never"?t.additionalProperties=!1:r.catchall&&(t.additionalProperties=this.write(r.catchall));return}case"union":t[r.inclusive===!1?"oneOf":"anyOf"]=r.options.map(i=>this.write(i));return;case"intersection":{let i=d=>"allOf"in d&&Object.keys(d).length===1,a=this.write(r.left),o=this.write(r.right);t.allOf=[...i(a)?a.allOf:[a],...i(o)?o.allOf:[o]];return}case"tuple":{let i=r.items;t.type="array",t.prefixItems=i.map(s=>this.write(s)),r.rest?t.items=this.write(r.rest):t.items=!1;let a=i.length;for(;a>0&&L(i[a-1])!==void 0;)a-=1;a>0&&(t.minItems=a),r.rest||(t.maxItems=i.length);let{minimum:o,maximum:d}=H(e);typeof o=="number"&&(t.minItems=o),typeof d=="number"&&(t.maxItems=d);return}case"record":{let i=r.keyType;t.type="object";let a=H(i).patterns;if(r.mode==="loose"&&a&&a.size>0){let d=this.write(r.valueType),s={};for(let w of a)s[w.source]=d;t.patternProperties=s}else t.propertyNames=Ve(this.write(i)),t.additionalProperties=this.write(r.valueType);let o=i._zod.values;if(o&&!r.partial&&L(r.valueType)===void 0){let d=[...o].filter(s=>typeof s=="string"||typeof s=="number");d.length>0&&(t.required=d.map(String))}return}case"nullable":t.anyOf=[this.write(r.innerType),{type:"null"}];return;case"default":case"prefault":{let i=r.defaultValue,a,o=!1,d=JSON.stringify(i,(s,w)=>typeof w=="bigint"?(o=!0,null):w);return!o&&d!==void 0&&(a=JSON.parse(d)),o||(t[r.type==="default"?"default":"_prefault"]=a),r.innerType}case"catch":{try{t.default=r.catchValue(void 0)}catch{}return r.innerType}case"readonly":return t.readOnly=!0,r.innerType;case"pipe":return r.in._zod.traits.has("$ZodTransform")?r.out:r.in;case"lazy":return e._zod.innerType;case"optional":case"nonoptional":case"promise":return r.innerType;default:return}}};function Ge(n,e=()=>{}){let t=n,r=new C(e,new Map),i=r.write(t,!0);if(r.cyclic.size>0){let a=new Map,o=0,d=[];for(let w of r.cyclic.keys())if(w===t)a.set(w,"#");else{let p=`__schema${o++}`;a.set(w,`#/$defs/${p}`),d.push([w,p])}r=new C(e,a),i=r.write(t,!0);let s={};for(let[w,p]of d)s[p]=r.write(w,!0);d.length>0&&(i={...i,$defs:s})}return JSON.parse(JSON.stringify({$schema:"https://json-schema.org/draft/2020-12/schema",...i}))}function Ke(n){return Ge(n,mt)}var ft={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string"},pt={phone:"A phone number as it is written, like +1 555 123 4567 or 020 7946 0958 ext. 12.",place:"An address or a place's name, as a person would search a map for it.",duration:"A length of time in whole minutes: 90 is 1 h 30 min."};function mt(n){me(n.zodSchema)&&(n.jsonSchema["x-graview-app-link"]=!0);let e=ye(n.zodSchema);if(e&&(n.jsonSchema.type==="string"||n.jsonSchema.type==="array")){n.jsonSchema["x-graview-linked"]={address:e.address,kinds:[...e.kinds],cardinality:e.cardinality};let s=e.kinds.join(" or "),w=`${e.cardinality==="many"?"Records":"A record"}: a ${s} in the app ${e.address}, as "${e.kinds[0]}:<id>" \u2014 an id found there with find_linked. Linking never changes that app.`,p=n.jsonSchema.description;typeof p=="string"&&p.includes(w)||(n.jsonSchema.description=`${typeof p=="string"&&p?`${p.replace(/\.?$/,".")} `:""}${w}`)}if(be(n.zodSchema)&&(n.jsonSchema["x-graview-repeat"]=!0,!n.jsonSchema.type&&!n.jsonSchema.anyOf&&!n.jsonSchema.oneOf&&Object.assign(n.jsonSchema,ht())),Se(n.zodSchema)){n.jsonSchema.contentMediaType="text/markdown";let s=n.jsonSchema.description;typeof s=="string"&&s.endsWith("Written in Markdown.")||(n.jsonSchema.description=`${typeof s=="string"&&s?`${s.replace(/\.?$/,".")} `:""}Written in Markdown.`)}let t=_e(n.zodSchema);if(t){let s=n.jsonSchema;s["x-graview-type"]=t,t==="duration"&&(s["x-graview-unit"]="minutes"),s.description??=pt[t]}let r=Re(n.zodSchema,!1);if(r){let s=Pe(r);n.jsonSchema["x-graview-format"]=s.format??"unit",s.currency&&(n.jsonSchema["x-graview-currency"]=s.currency),s.unit&&s.format!=="money"&&(n.jsonSchema["x-graview-unit"]=s.unit);let w=n.jsonSchema.description;n.jsonSchema.description=typeof w=="string"&&w.length>0?`${w} ${Y(s)}`:Y(s)}let i=n.zodSchema._zod?.def;if(!i||i.type!=="string"||typeof i.format!="string"||i.format==="regex")return;let a=n.jsonSchema,o=(i.checks??[]).map(s=>s._zod?.def).filter(s=>s?.format==="regex"&&s.pattern instanceof RegExp).map(s=>s.pattern.source);delete a.pattern;let d=a.allOf;Array.isArray(d)&&d.every(s=>typeof s=="object"&&s!==null&&Object.keys(s).length===1&&"pattern"in s)&&delete a.allOf,a.format=ft[i.format]??i.format,o.length===1?a.pattern=o[0]:o.length>1&&(a.allOf=o.map(s=>({pattern:s})))}function te(n,e){let t=B(n.input),r=Ke(n.input);if(e&&r.properties){let a=o=>e.includes(o)?e.indexOf(o):e.length;r.properties=Object.fromEntries(Object.entries(r.properties).sort(([o],[d])=>a(o)-a(d)))}let i=r.properties??{};if(Ae(n)){let a=n.creates.join(" | ");i.id={type:"string",minLength:1,description:`Optional: the id for the ${a} this makes, beginning with its kind (${n.creates.map(o=>`"${o}:"`).join(" or ")}). Refused if the graph already has it; left out, one is minted from the label.`},r.properties=i}Oe(n)&&(r.additionalProperties=!1);for(let a of t){let o=i[a.name];if(!o)continue;let d=a.kinds.includes("*")?"any node kind":a.kinds.join(" | ");o.description=[o.description,`Id of a node (${d}).`].filter(Boolean).join(" ")}return{name:n.name,...n.title===void 0?{}:{title:n.title},description:n.description??n.title??n.name,inputSchema:r,nodeRefs:t}}function ht(){let n={type:"string",pattern:"^\\d{4}-\\d{2}-\\d{2}$"},e=(t,r)=>({type:"integer",minimum:t,maximum:r});return{type:"object",description:'How the date beside it repeats; the date is the first occurrence. "on" is weekdays for "week", days of the month (-1 the last) for "month".',properties:{every:{type:"string",enum:[...we]},interval:e(1,99),on:{type:"array",minItems:1,maxItems:31,items:{anyOf:[{type:"string",enum:[...ge]},e(-1,31)]}},until:n,count:e(1,1e3),except:{type:"array",maxItems:500,items:n},continues:{type:"string",maxLength:200}},required:["every"],additionalProperties:!1}}function Ze(n){let e=new Set;for(let t=n;t;t=t.onBehalfOf)t.id!==void 0&&e.add(`${t.kind}:${t.id}`);return e}function U(n,e){let t=Ze(e),r=p=>{if(p.kind==="rule")return!1;let b=Ze(p);if(b.size===0)return!1;for(let h of b)if(t.has(h))return!1;return!0},i,a=()=>{if(i)return i;i=new Map;for(let p of n.log.live()){if(p.undoes!==void 0)continue;let b=r(p.author)?p.author:void 0;for(let h of p.primitives){h.op==="remove-node"&&i.delete(h.node.id);let y=h.op==="add-node"?h.node.id:h.op==="patch-node"||h.op==="splice-text"?h.id:void 0;if(y===void 0)continue;let _=h.op==="add-node"?Object.keys(h.node):h.op==="splice-text"?[h.field]:Object.keys(h.after),O=i.get(y);(h.op==="add-node"||!O)&&i.set(y,O=new Map);for(let v of _)v==="id"||v==="kind"||(b?O.set(v,b):O.delete(v))}}return i},o=n.schema,d=new Map,s=(p,b)=>{let h=`${p}\0${b}`,y=d.get(h);if(y===void 0){let _=o.tryDefinition(p)?.fields?.shape;y=_!==void 0&&b in _&&De(_[b]).type==="text",d.set(h,y)}return y},w=p=>n.graph.getNode(p)?.kind;return{prose:s,say:p=>W(p,{graph:n.graph,schema:o}),fieldBy(p,b){let h=w(p);if(!(h===void 0||!s(h,b)))return a().get(p)?.get(b)},recordBy(p){let b=w(p),h=a().get(p);if(b===void 0||!h)return;let y;for(let[_,O]of h)s(b,_)&&(y=O);return y}}}var ne=(n,e,t)=>({untrusted:!0,authoredBy:t.say(e),text:n}),yt="the host's ranker";function Ye(n,e){return{...n,hits:n.hits.map(t=>{if(t.about!=="node")return t;t.why.by==="meaning"&&t.why.matched!==void 0&&(t={...t,why:{...t.why,matched:{untrusted:!0,authoredBy:yt,text:t.why.matched}}});let r=e.recordBy(t.id);if(!r)return t;let i=e.prose(t.kind,t.why.field)?e.fieldBy(t.id,t.why.field):r;return{...t,label:ne(t.label,r,e),...t.apart!==void 0?{apart:ne(t.apart,r,e)}:{},why:i?{...t.why,fragment:ne(t.why.fragment,i,e)}:t.why}})}}var ie=(n,e,t)=>({title:n,readOnlyHint:e,destructiveHint:!1,idempotentHint:t,openWorldHint:!1}),gt={name:"subscribe",title:"Notify me when something happens",description:`Subscribe the person you act for to be told when something happens in this app \u2014 their host delivers it (an email, a push). on is one of: "act" (an act runs; give act, its declared name, and/or record), "created" (a record of kind is added), "changed" (a record of kind, or the one record, changes), "reaches" (a record of kind, or the one record, comes to satisfy condition, an expression in the app's rule language such as done == true or amount > 100). They are told only of changes someone else made, unless alsoMine is true, and only of records they may see. Returns the subscription and its sentence. Changes nothing in the app.`,inputSchema:{type:"object",properties:{on:{type:"string",enum:["act","created","changed","reaches"],description:"What to be told of."},act:{type:"string",description:"An act's declared name, for on: act."},kind:{type:"string",description:"A kind, for created, changed and reaches."},record:{type:"string",description:"One record, by id or name: for act, changed and reaches."},condition:{type:"string",description:"For reaches: what the record should come to satisfy, in the rule language (done == true)."},alsoMine:{type:"boolean",description:"Also when the person themselves made the change; false when unsaid."}},required:["on"],additionalProperties:!1},mutating:!1,annotations:ie("Notify me when something happens",!1,!1)},wt={name:"unsubscribe",title:"Stop notifying me",description:"Take away one of the person's subscriptions, by the id list_subscriptions or subscribe answered. Changes nothing in the app.",inputSchema:{type:"object",properties:{id:{type:"string",description:"The subscription's id."}},required:["id"],additionalProperties:!1},mutating:!1,annotations:ie("Stop notifying me",!1,!0)},bt={name:"list_subscriptions",title:"What I am notified of",description:`List what the person you act for is told of in this app: each subscription's id and its sentence ("When someone else adds a task").`,inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:ie("What I am notified of",!0,!0)},re=[gt,wt,bt];var q=n=>{let e;return()=>e??=n().catch(t=>{throw e=void 0,t})},St=q(()=>(__graviewPreload(import.meta.url,["./chunk.JYFZCJ4N.js","./chunk.H5S7OL2U.js","./chunk.Y2YYH3JN.js","./chunk.SGCW2XRC.js","./chunk.ZN3PUM2I.js","./chunk.QIPASE42.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.LTZUF5VG.js"))),kt=()=>(__graviewPreload(import.meta.url,["./chunk.NOGGSLVG.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.AFNSAQEQ.js")).catch(()=>{}),vt=async()=>{(await kt())?.judgeWithLines()},F=q(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.SGCW2XRC.js","./chunk.ZN3PUM2I.js","./chunk.QIPASE42.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.ACTXR2MI.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5ODHHH35.js"))),At=q(()=>(__graviewPreload(import.meta.url,["./chunk.ROZTJ6IY.js","./chunk.BIDL7GQD.js","./chunk.G4JJXA63.js","./chunk.M4AYA2PL.js","./chunk.H5S7OL2U.js","./chunk.T6WHGKWR.js","./chunk.XOZU4OFA.js","./chunk.Y2YYH3JN.js","./chunk.Q5WEOX3Q.js","./chunk.CGALLZ54.js","./chunk.WKI5INH7.js","./chunk.NOGGSLVG.js","./chunk.WVUJXDXZ.js","./chunk.SGCW2XRC.js","./chunk.ZN3PUM2I.js","./chunk.QIPASE42.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.NUYA4BWI.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.MGALQLRW.js"))),Ot=q(()=>(__graviewPreload(import.meta.url,["./chunk.ELOFPE25.js","./chunk.JYFZCJ4N.js","./chunk.H5S7OL2U.js","./chunk.PZQNR4KZ.js","./chunk.W4BKYSZX.js","./chunk.Y2YYH3JN.js","./chunk.SGCW2XRC.js","./chunk.ZN3PUM2I.js","./chunk.QIPASE42.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.NUYA4BWI.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.7OBIBPYH.js"))),Rt=q(()=>(__graviewPreload(import.meta.url,["./chunk.MDEX6ZVE.js","./chunk.RPDH32XV.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.MAKODQO3.js"))),_t=n=>n.definitions.some(e=>Z(e).size>0),Xe=n=>({value:K(n),label:n.label,...n.describe?{describe:n.describe}:{},...n.card?{card:n.card}:{},fields:n.fields,...n.app?{app:n.app}:{}});async function Tt(n,e,t,r){let i=String(t.relation??""),[a,o]=i.includes(".")?i.split(".",2):[void 0,i],d=n.schema.definitions.flatMap(v=>[...Z(v)].map(([m,u])=>({kind:v.kind,name:m,relation:u}))),s=d.filter(v=>v.name===o&&(a===void 0||v.kind===a));if(s.length!==1){let v=d.map(m=>`${m.kind}.${m.name}`).join(", ")||"none";return{ok:!1,error:`${s.length===0?`No relation to another app is called "${i}"`:`"${i}" names a relation of several kinds`}. The relations to other apps are: ${v}.`}}let{kind:w,name:p,relation:b}=s[0];if(!r)return{ok:!1,error:`This seat cannot read ${b.address}: its host reads no other app's records. Nothing was changed.`};let h={kind:e.kind,...e.id===void 0?{}:{id:e.id},...e.roles?{roles:e.roles}:{},...e.onBehalfOf?{onBehalfOf:e.onBehalfOf}:{}},y=typeof t.of=="string"?t.of:void 0;if(y!==void 0){let v=n.graph.getNode(y);if(!v||v.kind!==w)return{ok:!1,error:`No ${w} "${y}".`};let m=he(v[p],b),u=await Promise.all(m.map(S=>Promise.resolve().then(()=>r.resolve(S,h)).catch(()=>null)));return{ok:!0,data:{relation:`${w}.${p}`,app:b.address,records:u.map((S,k)=>S===null?{value:K(m[k]),missing:!0}:"denied"in S?{denied:!0,said:"linked record (no access)"}:Xe(S))},reads:[y]}}let _=typeof t.limit=="number"&&t.limit>0?Math.min(t.limit,20):20,O=await Promise.resolve().then(()=>r.find({address:b.address,kinds:b.kinds,query:String(t.query??""),limit:_},h)).catch(()=>[]);return Array.isArray(O)?{ok:!0,data:{relation:`${w}.${p}`,app:b.address,records:O.map(Xe),link:`edit-${w} with ${p} set to a record's value`}}:{ok:!0,data:{relation:`${w}.${p}`,app:b.address,denied:!0,said:"linked record (no access)"}}}var N=n=>({title:n,readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}),Qe={description:'Which records: false (the default) the live ones, true only the archived ones, "all" both. An archived record is set aside, not gone: unarchive-<kind> brings it back.',anyOf:[{type:"boolean"},{type:"string",enum:["all"]}]},ae={type:"number",description:"Where the page starts; 0 when unsaid."},se=[{name:"search_graph",title:"Find by name",description:"Find things by name: records whose name or readable fields carry the words, and the kinds, places and rules the words name \u2014 each with why it matched. Reach for this before get_graph when you know what something is called. Words match the start of words, case and accents aside; key:value tokens narrow as a list's filter does (done:false, is:any for past records, kind:<kind>). Pass subject (a node id) to get the acts you may run on it as hits too. When few records match exactly, records with a near word follow \u2014 a typo, another form of the word, a meaning \u2014 each with near: true and why.matched, the record's own word that answered.",inputSchema:{type:"object",properties:{query:{type:"string",description:"Words, with optional key:value conditions."},limit:{type:"number",description:"Most hits to return; at most 20."},subject:{type:"string",description:"A node id whose acts to include."},archived:Qe},required:["query"],additionalProperties:!1},mutating:!1,annotations:N("Find by name")},{name:"get_graph",title:"Read the graph",description:"Read the graph, 25 nodes a page: their fields, the edges out of them, and how many more. Start here when you need the shape of the domain rather than one thing in it.",inputSchema:{type:"object",properties:{offset:ae,archived:Qe},additionalProperties:!1},mutating:!1,annotations:N("Read the graph")},{name:"get_node",title:"Read one node",description:"Read one node: its fields, its links (id, kind and label, 20 each way a page), the violations that implicate it, and its computed values: read-only fields worked out from what you can see, which no act sets. Use this to check a thing before you change it.",inputSchema:{type:"object",properties:{id:{type:"string",description:"A node's id, or its name."},offset:ae},required:["id"],additionalProperties:!1},mutating:!1,annotations:N("Read one node")},{name:"get_violations",title:"List the problems",description:"List the invariant violations the graph currently has, 20 a page, with the repairs that would resolve each one. Read this before proposing work: a rule that is already broken is more urgent than anything you could add.",inputSchema:{type:"object",properties:{offset:ae,context:{type:"object",description:"Evaluation context, e.g. { weekStart }."}},additionalProperties:!1},mutating:!1,annotations:N("List the problems")},{name:"get_affordances",title:"Ask what can be done",description:"Ask what can legally be done with a selection, ranked. Prefer these over composing a mutation by hand: they are derived from the schema, the invariants and the shape of the graph, so they cannot name an action that does not exist.",inputSchema:{type:"object",properties:{selection:{type:"array",items:{type:"string"},description:"Node ids."},context:{type:"object"}},required:["selection"],additionalProperties:!1},mutating:!1,annotations:N("Ask what can be done")},{name:"describe_place",title:"Say what a place shows",description:`Say what one place of the app shows you, as a person in your seat would see it: its headings, its figures as drawn, its lists with each record's title and what its card or row says, the headings a list is grouped under, what an empty list says, the forms it offers (each field in the order asked, its label, whether it must be answered, what it takes and its choices), and any block that could not be worked out. Pass a place's slug ("home", a lens's address like "the-offers", a kind's like "offers"), a record's id, or a visitor form's "forms/<name>", and width 390 for a phone. Use it after a change to check what somebody now sees, instead of guessing.`,inputSchema:{type:"object",properties:{place:{type:"string",description:`"home", a place's slug, a record's id, or "forms/<name>" for a visitor form.`},width:{type:"number",description:"The screen's width in CSS pixels; 390 is a phone, 1440 when unsaid."}},required:["place"],additionalProperties:!1},mutating:!1,annotations:N("Say what a place shows")},{name:"preview_mutation",title:"Try an act without applying it",description:"Try a mutation without applying it: get back the diff it would produce and any invariant it would break. Do this when you are unsure, rather than applying and undoing.",inputSchema:{type:"object",properties:{mutation:{type:"string"},args:{type:"object"}},required:["mutation","args"],additionalProperties:!1},mutating:!1,annotations:N("Try an act without applying it")},{name:"undo_batch",title:"Undo a batch",description:"Undo one batch of operations. Fails, naming the blocking operation, when a later operation read what it wrote.",inputSchema:{type:"object",properties:{batch:{type:"string"},include:{type:"array",items:{type:"string"}}},required:["batch"],additionalProperties:!1},mutating:!0,annotations:{title:"Undo a batch",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}},{name:"list_suggestions",title:"List what is suggested",description:"List the suggestions waiting for a person: changes the app's own actor proposed and did not make, each with its id, what it would do, who suggested it, what it was based on and how sure (0 to 1), and the votes on it (tally: for, against, and this seat's own as mine). Nothing changes until one is accepted (accept_suggestion) or declined (decline_suggestion); a declined one is never suggested again.",inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:N("List what is suggested")},{name:"accept_suggestion",title:"Accept a suggestion",description:`Make a waiting suggestion's change, as this seat, carrying what it was based on. Returns the batch (undo_batch takes it back). From a seat that may see the suggestion and may not make the change, it records this seat's vote for it instead (voted: "for"; a later vote replaces it) and the suggestion still waits for someone who may.`,inputSchema:{type:"object",properties:{suggestion:{type:"string",description:"The suggestion's id, from list_suggestions."}},required:["suggestion"],additionalProperties:!1},mutating:!0,annotations:{title:"Accept a suggestion",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!1,openWorldHint:!1}},{name:"decline_suggestion",title:"Decline a suggestion",description:`Decline a waiting suggestion: nothing changes, the decline is kept in the log, and the same change is never suggested or made by the app's own actor again. From a seat that may not make the change, it records this seat's vote against it instead (voted: "against") and the suggestion still waits.`,inputSchema:{type:"object",properties:{suggestion:{type:"string",description:"The suggestion's id, from list_suggestions."}},required:["suggestion"],additionalProperties:!1},mutating:!0,annotations:{title:"Decline a suggestion",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}}],tt={name:"act_on_several",title:"Do one act to several records",description:`Run one act on several records at once, as one change with one undo. act is the act (its tool name or its declared name), records the records it runs on (ids or names; each goes in the act's subject), args what every call shares ("Set stage to Declined" is args { stage: "declined" }). Each record is judged on its own: one this seat may not change is named with why, and the rest still apply. Returns the batch (undo_batch takes it all back), the records changed, those already so, and those refused.`,inputSchema:{type:"object",properties:{act:{type:"string",description:"The act to run on each record."},records:{type:"array",items:{type:"string"},minItems:1,maxItems:200,description:"Ids or names of the records."},args:{type:"object",description:"Arguments every call shares, besides the record."}},required:["act","records"],additionalProperties:!1},mutating:!0,annotations:{title:"Do one act to several records",readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!1}},ue={name:"suggest_changes",title:"Suggest changes",description:"Keep calls ({ act, args }) as one suggestion a person accepts or declines, with its basis and confidence (0 to 1). Changes nothing; a declined change is refused.",inputSchema:{type:"object",properties:{calls:{type:"array",items:{type:"object"}},basis:{type:"string"},confidence:{type:"number"}},required:["calls","basis"]},mutating:!0,annotations:{title:"Suggest changes",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},de={type:"object",description:"A lens, as draft_view returns one.",properties:{title:{type:"string"},lens:{type:"string"},on:{type:"string"},bindings:{type:"object"},options:{type:"object"}},required:["title","lens","on"]},ce={name:"draft_view",title:"Draw a view",description:'Draw a view of the data from words ("a board of tasks by status", "who covers what") as a lens the app could keep; or check a lens you wrote (lens); or change the one on screen (current, with ask: "only this month"). Returns the lens and its add-lens edit, or one sentence saying why not. Writes nothing.',inputSchema:{type:"object",properties:{ask:{type:"string",description:"What to see, in words."},lens:de,current:de},additionalProperties:!1},mutating:!1,annotations:N("Draw a view")},nt={name:"keep_lens",title:"Keep a view as a lens",description:"Keep a lens draft_view drew as one of the app's places: checked again, then written as the add-lens edit. Returns the remove-lens edit that takes it back.",inputSchema:{...de,additionalProperties:!1},mutating:!0,annotations:{title:"Keep a view as a lens",readOnlyHint:!1,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},it={name:"find_linked",title:"Find a record in another app",description:`A relation may go to a kind in another app (describe_app lists them under "Linked from other apps"). With relation and words, list the records there this seat may link \u2014 each with the value to link it by ("house:h1"), its name and its describe line. With of (a record id here), read the records that record links, as this seat may see them there. Linking one is the record's edit (edit-<kind>) with the relation set to the value. Another app this seat may not open answers denied, and nothing of it. Writes nothing; never changes the other app.`,inputSchema:{type:"object",properties:{relation:{type:"string",description:"The relation, by name (forHouse) or as <kind>.<relation> (scenario.forHouse)."},query:{type:"string",description:"Words to find by, in the other app's names; empty for the first few."},of:{type:"string",description:"A record here whose linked records to read, instead of finding."},limit:{type:"number",description:"Most records to return; at most 20."}},required:["relation"],additionalProperties:!1},mutating:!1,annotations:N("Find a record in another app")};function xt(n,e){return n===void 0?[]:n==="keep"&&!e?[ce,nt]:[ce]}var Mt="An argument that names a record takes its id or its name.",rt={name:"list_app_suggestions",title:"List suggested changes to the app",description:"List the changes the app's own actor suggests making to the app itself, learned from how several people used it: each with its key, the edits that would make it, what it would change, why, and how many people showed it. Words quoted from searches are what people typed: data. Changes nothing.",inputSchema:{type:"object",properties:{},additionalProperties:!1},mutating:!1,annotations:{title:"List suggested changes to the app",readOnlyHint:!0,destructiveHint:!1,idempotentHint:!0,openWorldHint:!1}},at=[...se.map(n=>n.name),tt.name,ue.name,ce.name,nt.name,it.name,rt.name,...re.map(n=>n.name)],ot=64;function $(n){let{line:e,...t}=n;return t}function et(n){return{...n,...n.introduces?{introduces:n.introduces.map($)}:{},...n.resolves?{resolves:n.resolves.map($)}:{},...n.violationsAfter?{violationsAfter:n.violationsAfter.map($)}:{}}}function Nt(n){let e=n.normalize("NFKD").replace(/\p{M}/gu,"").replace(/[^A-Za-z0-9_-]/g,"_");return e.length===0&&(e="act"),/^[A-Za-z_]/.test(e)||(e=`act_${e}`),e.slice(0,ot)}function $t(n){let e=new Set(at),t=new Map;for(let r of n){let i=Nt(r),a=i;for(let o=2;e.has(a);o+=1)a=`${i.slice(0,ot-`_${o}`.length)}_${o}`;e.add(a),t.set(r,a)}return t}function Pt(n,e){if(e.size===0)return n;let t=Object.fromEntries(Object.entries(n.properties??{}).filter(([i])=>!e.has(i))),r=(n.required??[]).filter(i=>!e.has(i));return{...n,properties:t,...n.required?{required:r}:{}}}function Dt(n,e,t,r){let i=te(n,Te(r,n)),a=G(n),o=i.nodeRefs.length>0?`${i.description}${/[.!?]$/.test(i.description)?"":"."} ${Mt}`:i.description;return{name:e,title:a,description:o,inputSchema:Pt(i.inputSchema,t),mutating:!0,annotations:{title:a,readOnlyHint:!1,destructiveHint:n.destructive===!0||(n.severs?.length??0)>0,idempotentHint:n.idempotent===!0,openWorldHint:!1},act:n.name}}function le(n){if(n===null||typeof n!="object")return JSON.stringify(n)??"null";if(Array.isArray(n))return`[${n.map(le).join(",")}]`;let e=n;return`{${Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>`${JSON.stringify(t)}:${le(e[t])}`).join(",")}}`}function Jt(n){return`sha256:${$e(le(n))}`}function Et(n,e,t,r,i,a=!1,o=!1,d=!1,s,w=!1){let p=$t(n.map(y=>y.name)),b=[...xt(r,t),...a?[it]:[],...o?re:[],...w?[rt]:[]];return{definitions:t?[...se.filter(y=>!y.mutating),...b]:[...se,tt,...d?[ue]:[],...b,...n.filter(y=>e.has(y.name)).map(y=>Dt(y,p.get(y.name),i(y),s))],names:p}}function On(n,e={}){let t=e.author??{kind:"agent"},r=n.allMutations(),i=new Set(n.permittedMutations(t).map(m=>m.name)),{definitions:a,names:o}=Et(r,i,e.readOnly===!0,e.drafts?e.drafts.keep?"keep":"draw":void 0,m=>X(n.schema,n.policy,t,m),_t(n.schema),e.subscriptions!==void 0,Ne(t),n.schema,e.learned!==void 0),d=Jt(a),s={app:e.app?.brand?.locale,appTimeZone:e.app?.brand?.timeZone},w=m=>pe(s,m),p=m=>{if(!at.includes(m)){for(let[u,S]of o)if(S===m)return u;return o.has(m)?m:xe(m,o.keys())}},b=m=>{let u=Me(m,o.keys());return u?` Did you mean "${u}"?`:""},h=m=>{let u=a.find(k=>k.name===m)??a.find(k=>k.act===m);if(u)return u;let S=p(m);return S===void 0?void 0:a.find(k=>k.act===S)},y=(m,u)=>{let S=r.find(c=>c.name===m);if(!S)return{args:u,resolved:[]};let k={...u},l=[];for(let c of B(S.input)){let f=k[c.name];if(typeof f!="string"||f.trim()==="")continue;let g=n.resolveRef(c,f,t);if(!g.ok){let A=g.reason==="none"?` Nothing was changed. Use search_graph to look it up, then pass its id as ${c.name}.`:" Nothing was changed.";return{ok:!1,error:`${g.message}${A}`,argument:c.name,candidates:g.candidates}}g.by!=="id"&&(k[c.name]=g.id,l.push({argument:c.name,given:f,id:g.id,label:g.label}))}return{args:k,resolved:l}},_=async(m,u)=>{try{await vt();let S=h(m);if(!S&&m===ue.name)return{ok:!1,error:"Only the app's own actor (automated: true) suggests changes.",reason:"forbidden"};if(!S){let l=p(m);if(l){let c=n.permits({name:l,args:u},t);if(!c.ok)return{ok:!1,error:c.refusal.message,reason:"forbidden"}}return{ok:!1,error:`Unknown tool "${m}".${b(m)} Available: ${a.map(c=>c.name).join(", ")}`}}if(S.mutating&&e.readOnly)return{ok:!1,error:`"${m}" changes the graph, and this seat is read-only.`,reason:"forbidden"};if(S.act!==void 0){let l=y(S.act,u);if("ok"in l)return l;let c=S.act,f=w(()=>z(n,t,n.apply({name:c,args:l.args},{...e.author?{author:e.author}:{},...V(e.via)})));return{ok:!0,data:{batch:f.batch,intent:f.intent,introduces:f.introduces.map($),resolves:f.resolves.map($),...l.resolved.length>0?{resolved:l.resolved}:{}},diff:f.diff}}let k=n.seenBy(t);switch(S.name){case"search_graph":{let l=typeof e.places=="function"?e.places():e.places,c=typeof u.subject=="string"?u.subject:void 0,f=Ie(k,String(u.query??""),{principal:t,rank:e.near,archived:ke(u.archived),limit:typeof u.limit=="number"&&u.limit>0?Math.min(u.limit,20):20,...l?{places:l}:{},...c?{subject:c,from:[c]}:{}}),g=f.later?await f.later:f;return{ok:!0,data:(await F()).searchRead(g,Ye(g,U(k,t))),reads:g.hits.flatMap(A=>A.about==="node"?[A.id]:[])}}case"get_graph":return{ok:!0,...(await F()).graphRead(k,U(k,t),u)};case"get_node":{let l=String(u.id??""),c=l,f;if(!k.graph.getNode(l)){let A=l.trim()===""?void 0:n.resolveRef({name:"id",kinds:["*"]},l,t);if(A?.ok)c=A.id,f={argument:"id",given:l,id:c,label:A.label};else return A?.reason==="ambiguous"?{ok:!1,error:A.message,argument:"id",candidates:A.candidates}:{ok:!1,error:`No node "${l}".`}}let g=(await F()).nodeRead(k,U(k,t),c,u);return{ok:!0,data:f?{...g.data,resolved:[f]}:g.data,reads:g.reads}}case"describe_place":{let l=e.app??{name:"",schema:n.schema},c=typeof u.width=="number"&&Number.isFinite(u.width)&&u.width>0?u.width:1440,{describePlace:f}=await St(),g=f(n,t,String(u.place??""),{app:l,width:c});if(!g.ok)return{ok:!1,error:`${g.error} The places are: ${g.places.join(", ")}.`};let A=new Set,M=I=>{for(let D of I)for(let x of D.groups??[])for(let P of x.items)A.add(P.id),M(P.parts)};return M(g.description.parts),{ok:!0,data:g.description,reads:[...A]}}case"find_linked":return Tt(k,t,u,e.linked);case"draft_view":case"keep_lens":{let l=e.app??{name:"",schema:n.schema};return(await At()).runDraftTool(S.name,u,{app:l,principal:t,...e.drafts?{drafts:e.drafts}:{}})}case"get_violations":{let l=k.violations(u.context);return{ok:!0,...(await F()).violationsRead(l,u)}}case"get_affordances":{let l=u.selection??[];return{ok:!0,data:He(k,l,{...typeof e.derive=="function"?e.derive():e.derive,...e.author?{principal:e.author}:{},...u.context?{context:u.context}:{}}),reads:l.filter(f=>k.graph.has(f))}}case"preview_mutation":{let l=String(u.mutation),c=p(l)??l,f=y(c,u.args??{});if("ok"in f)return f;let g=n.missingFor({name:c,args:f.args},t);if(g)return{ok:!1,error:g.message,reason:"missing"};let A=z(n,t,n.preview({name:c,args:f.args},void 0,{author:t})),M=et(A);return{ok:!0,data:f.resolved.length>0?{...M,resolved:f.resolved}:M}}case"act_on_several":{let l=String(u.act??""),c=p(l)??l,f=r.find(R=>R.name===c);if(!f||!i.has(c)){let R=f?n.permits({name:c,args:{}},t):void 0;return R&&!R.ok?{ok:!1,error:R.refusal.message,reason:"forbidden"}:{ok:!1,error:`There is no act "${l}" this seat may run.${b(l)} Nothing was changed.`,reason:"invalid"}}let g=f.subject;if(!g)return{ok:!1,error:`"${G(f)}" does not act on a record, so it cannot be run on several. Nothing was changed.`,reason:"invalid"};let A=Array.isArray(u.records)?u.records.filter(R=>typeof R=="string"&&R.trim()!==""):[];if(A.length===0)return{ok:!1,error:"Name at least one record. Nothing was changed.",reason:"invalid"};let M=[],I=[];for(let R of A.slice(0,200)){let J=n.resolveRef({name:g.arg,kinds:g.kinds},R,t);if(!J.ok)return{ok:!1,error:`${J.message} Nothing was changed.`,argument:"records",candidates:J.candidates};M.push(J.id),J.by!=="id"&&I.push({argument:"records",given:R,id:J.id,label:J.label})}let D=y(c,{...u.args??{}});if("ok"in D)return D;let x=(await Ot()).actOnSeveral(n,{mutation:c,subject:g.arg,args:D.args},M,{author:t,...V(e.via)}),P=x.result?z(n,t,x.result):void 0;return{ok:!0,data:{...x.batch?{batch:x.batch,intent:x.intent}:{},applied:x.applied,unchanged:x.unchanged,refused:x.refused.map(R=>({record:R.id,label:R.label,error:R.message,reason:R.reason})),...x.allOrNothing?{keptNone:!0}:{},...P?{introduces:P.introduces.map($),resolves:P.resolves.map($)}:{},...I.length>0||D.resolved.length>0?{resolved:[...I,...D.resolved]}:{}},...P?{diff:P.diff}:{}}}case"subscribe":case"unsubscribe":case"list_subscriptions":{let l=await(await Rt()).runSubscriptionTool(S.name,u,{store:n,principal:e.subscriber??t,app:e.app?.name??"app",subscriptions:e.subscriptions});return l.ok?{ok:!0,data:l.data}:{ok:!1,error:l.error}}case"list_app_suggestions":return{ok:!0,data:{suggestions:(await e.learned()).map(({key:c,said:f,why:g,edits:A,evidence:M})=>({key:c,said:f,why:g,edits:A,evidence:M}))}};case"list_suggestions":{let l=Ee(n,t).map(c=>{let f=W(c.author,{graph:k.graph,schema:n.schema});return{id:c.id,intent:c.intent,by:f,at:c.at,about:c.about,tally:c.tally,...c.lineage?{basis:{untrusted:!0,authoredBy:f,text:c.lineage.basis},...c.lineage.confidence!==void 0?{confidence:c.lineage.confidence}:{}}:{}}});return{ok:!0,data:{suggestions:l},reads:[...new Set(l.flatMap(c=>c.about))]}}case"suggest_changes":{let l=u.calls.map(f=>({name:p(f.act)??f.act,args:f.args}));return{ok:!0,data:{suggestion:Je(n,l,{author:t,lineage:{basis:u.basis,confidence:u.confidence},...V(e.via)})?.id??null}}}case"accept_suggestion":case"decline_suggestion":{let l=String(u.suggestion??""),c={author:t,...V(e.via)},f=S.name==="accept_suggestion"?je(n,l,c):ze(n,l,c),g=z(n,t,f);return{ok:!0,data:{batch:g.batch,intent:g.intent,...f.voted?{voted:f.voted}:{},introduces:g.introduces.map($),resolves:g.resolves.map($)},diff:g.diff}}case"undo_batch":{let l=String(u.batch),c=u.include??[],f=k.canUndo([l,...c]);if(!f.ok)return{ok:!1,error:f.message};let g=z(n,t,n.undo([l,...c],{...e.author?{author:e.author}:{}}));return{ok:!0,data:et(g),diff:g.diff}}default:return{ok:!1,error:`Unknown tool "${m}".`}}}catch(S){let{reason:k,wouldNeed:l}=ve(S);return{ok:!1,error:S instanceof Error?S.message:String(S),reason:k,...l?{wouldNeed:l}:{}}}},O=new Set,v=m=>{for(let u of O)u(m)};return{definitions:a,hash:d,...e.author?{author:e.author}:{},onDiff(m){return n.subscribe(m)},onCall(m){return O.add(m),()=>O.delete(m)},async call(m,u){let S=h(m)?.mutating??!1,k={name:m,args:u,mutating:S,at:new Date().toISOString()};v({...k,phase:"running"});let l=f=>(v(f.ok?{...k,phase:"ok",...!S&&f.reads?{reads:f.reads}:{}}:{...k,phase:"failed",error:f.error}),f),c=await _(m,u);return l(c.ok&&!S?{...c,data:(await F()).withinReadChars(m,c.data)}:c)}}}function V(n){let e=typeof n=="function"?n():n;return e?{via:e}:{}}export{le as a,On as b};
@@ -1,6 +0,0 @@
1
- import{h as z,i as D,j as H}from"./chunk.VIH5AX7S.js";import{a as P,b as A,c as p,d as W}from"./chunk.Q355UPFG.js";import"./chunk.VC3V7HLL.js";import"./chunk.ELTV44HU.js";import"./chunk.CY3ELWCM.js";import"./chunk.I77ZGIFE.js";import"./chunk.OWOOKLIU.js";import"./chunk.RD2X25XB.js";import"./chunk.KMV6PJFL.js";import"./chunk.SWMDFXUX.js";import"./chunk.A3ZC2JBO.js";import"./chunk.NAD7ZXYP.js";import"./chunk.2GEJNG2U.js";import"./chunk.4TX6VCBT.js";import"./chunk.TIALD6SC.js";import"./chunk.66P5IDTH.js";import"./chunk.UQQKDBIH.js";import"./chunk.AJSUHPBE.js";import"./chunk.LAYQ5PFS.js";import"./chunk.KDXU5DT3.js";import"./chunk.O2BHPYA4.js";import{a as C,b as O}from"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.SGCW2XRC.js";import"./chunk.ZN3PUM2I.js";import"./chunk.QIPASE42.js";import"./chunk.EVBCEEQ4.js";import"./chunk.OWT3VVOT.js";import"./chunk.NHTGAP3G.js";import"./chunk.GZHZLJBF.js";import"./chunk.UKQUUPKE.js";import"./chunk.OJGHDWI6.js";import"./chunk.DDUCIUVW.js";import"./chunk.NUYA4BWI.js";import"./chunk.OKZT2QBM.js";import"./chunk.ACTXR2MI.js";import"./chunk.AI34V6WV.js";import"./chunk.G4ULQK64.js";import{G as B,Sa as k,T as L}from"./chunk.M7RESZB6.js";import"./chunk.SDO3U72B.js";import{id as R}from"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import{b as E}from"./chunk.AJZBJBMO.js";var r=E(B(),1);var s=E(L(),1);function M(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let n=c??document,o=n.querySelector("main")??n.querySelector("[data-graview-page]")??null,t=n.querySelector("[data-graview-page-title]")??o?.querySelector("h1, h2")??o;t instanceof HTMLElement&&(t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}))}var I=1500;function N(c,e,n){let{store:o,principal:t}=c,l=z(o),g=(0,r.useMemo)(()=>P(o,t),[o,t,l]),w=(0,r.useRef)(n),[b,d]=(0,r.useState)(),[y,u]=(0,r.useState)("");(0,r.useEffect)(()=>{let a=A(o,t,w.current);w.current=o.batches().length,a&&(d({batch:a.batch,at:e,when:Date.now()}),u(""))},[o,t,l]),(0,r.useEffect)(()=>{d(a=>!a||a.at===e?a:Date.now()-a.when<I?{...a,at:e}:void 0)},[e]);let[x,i]=(0,r.useState)(null),v=(0,r.useCallback)(()=>{d(void 0),i(null)},[]),f=(0,r.useCallback)(()=>{i(null);try{let a=W(o,t);a&&u(`Took back \u201C${a.intent}\u201D`)}catch(a){i(a instanceof Error?a.message:String(a))}},[o,t]),S=g&&b?.batch===g.batch&&b.at===e?g:void 0;return{change:g,offered:S,close:v,takeBack:f,refused:x,said:y}}function ee({context:c,docked:e,at:n,since:o,compact:t=!1,className:l,size:g}){let{change:w,offered:b,close:d,takeBack:y,refused:u,said:x}=N(c,n,o),i=e?b:w,v=(0,r.useRef)(null),f=e&&(i!==void 0||u!==null);j(v,f),(0,r.useEffect)(()=>{if(!f)return;let m,h=()=>m=setTimeout(()=>v.current?.matches(":hover, :focus-within")?h():d(),1e4);return h(),()=>clearTimeout(m)},[f,i?.batch,u,d]);let S=x||(e&&i?p(i):""),a=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:R("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...f?{}:{display:"none"}}:{},T=i?(0,s.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${p(i)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:m=>{let h=m.currentTarget.closest("[data-graview-face]");y(),requestAnimationFrame(()=>M(h))},...e?{style:U}:{className:H("graview-undo",l),...D(g),...t?{"data-compact":"","aria-label":p(i)}:{}},children:[(0,s.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),e?(0,s.jsx)("span",{style:K,children:p(i)}):(0,s.jsx)("span",{className:"graview-undo-words",children:t?"Undo":p(i)})]}):null;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{role:"status","aria-live":"polite",style:V,children:S}),(0,s.jsxs)("div",{ref:v,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",...e?{style:{...F,...a}}:{className:"graview-undo-place"},children:[e?null:(0,s.jsx)("style",{children:q}),e&&i?(0,s.jsxs)("div",{"data-testid":"page-undo-notice",style:Z,children:[T,(0,s.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${p(i)}`,title:"Dismiss",onClick:m=>{let h=m.currentTarget.closest("[data-graview-face]");d(),requestAnimationFrame(()=>M(h))},style:$,children:"\xD7"})]}):T,u?(0,s.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",className:"graview-undo-refused",...e?{style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",borderRadius:6,background:"var(--graview-float)",padding:"4px 8px"}}:{},children:u}):null]})]})}function j(c,e){(0,r.useLayoutEffect)(()=>{let n=c.current;if(!n||!e)return;if(typeof n.showPopover=="function"&&!k(n))try{n.showPopover()}catch{}let o=()=>n.parentElement?.closest("[data-embed-content]")??null,t=()=>{O(n,o()),dispatchEvent(new Event(C))};t(),addEventListener("resize",t),addEventListener("scroll",t,!0);let l=typeof ResizeObserver=="function"?new ResizeObserver(t):null;return l?.observe(n),()=>{if(l?.disconnect(),removeEventListener("resize",t),removeEventListener("scroll",t,!0),n.isConnected&&k(n))try{n.hidePopover()}catch{}dispatchEvent(new Event(C))}},[c,e])}var q=`:where(.graview-undo-place){display:grid;justify-items:end;gap:4px;max-width:100%;min-width:0}
2
- :where(.graview-undo){box-sizing:border-box;display:inline-flex;align-items:center;gap:6px;min-height:var(--graview-control-height,36px);max-width:min(100%,var(--graview-undo-widest,18rem));min-width:0;padding:0 14px;border-radius:999px;border:1px solid var(--graview-edge);background:var(--graview-float);color:var(--graview-ink);font:inherit;font-size:.875rem;cursor:pointer}
3
- :where(.graview-undo[data-size=sm]){--graview-control-height:30px}
4
- :where(.graview-undo[data-compact]){padding:0 10px}
5
- :where(.graview-undo-words){min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
6
- :where(.graview-undo-refused){font-size:.8125rem;line-height:1.4;color:var(--graview-warn);border-radius:6px}`,F={display:"grid",justifyItems:"end",gap:4,maxWidth:"100%",minWidth:0},U={display:"inline-flex",alignItems:"center",gap:6,minHeight:36,maxWidth:"100%",minWidth:0,borderRadius:999,font:"inherit",fontSize:"0.875rem",cursor:"pointer",textAlign:"start",lineHeight:1.4,padding:"8px 4px 8px 14px",border:"none",background:"none",color:"inherit"},Z={display:"flex",alignItems:"center",gap:2,maxWidth:"100%",minWidth:0,paddingRight:6,borderRadius:"var(--graview-radius, 12px)",border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},$={flex:"0 0 auto",minWidth:28,minHeight:28,padding:0,border:"none",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"1rem",cursor:"pointer"},K={minWidth:0,overflow:"hidden",overflowWrap:"anywhere",display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:4},V={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0};export{ee as TakeBack};
@@ -1 +0,0 @@
1
- import{r as ce}from"./chunk.2GEJNG2U.js";import{a as Z,b as C,c as ee,d as te,g as oe,j as re,k as P,l as se,p as le,s as de}from"./chunk.N6EJXXQK.js";import"./chunk.BJUUSIQY.js";import{a as ie,b as ne,c as ae}from"./chunk.PZQNR4KZ.js";import"./chunk.W4BKYSZX.js";import"./chunk.T6WHGKWR.js";import"./chunk.XOZU4OFA.js";import"./chunk.Y2YYH3JN.js";import{a as X}from"./chunk.5STU3KYG.js";import"./chunk.ZN3PUM2I.js";import"./chunk.NUYA4BWI.js";import"./chunk.OKZT2QBM.js";import"./chunk.ACTXR2MI.js";import{c as _,j as J}from"./chunk.AI34V6WV.js";import"./chunk.G4ULQK64.js";import{G as me,J as U,T as V,ba as j}from"./chunk.M7RESZB6.js";import"./chunk.SDO3U72B.js";import{id as Y,ma as B}from"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import{b as O}from"./chunk.AJZBJBMO.js";var a=O(me(),1);var d=O(V(),1),ke=new Set(["show","go","to","open","the","a","an","me"]),ge=r=>r.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,""),W=(r,p)=>{let s=ge(r);return p.every(t=>s.includes(t))},pe=r=>r&&!/^.\p{Lu}/u.test(r)?`${r[0].toLowerCase()}${r.slice(1)}`:r,L={act:4,show:3,place:3,record:4},we=360,h=12;function De({face:r,opening:p,close:s}){let t=X(),{setMenuAt:v}=j(),n=(0,a.useMemo)(()=>p.target??Z(p.pointed??{about:[]},e=>t.store.graph.has(e)),[p,t.store]),f=(0,a.useMemo)(()=>oe(t.store,n,t.places),[t.store,n,t.places]),[u,y]=(0,a.useState)(""),[b,m]=(0,a.useState)(-1),[l,$]=(0,a.useState)(null),[A,I]=(0,a.useState)(null),E=(0,a.useRef)(null),z=(0,a.useRef)(null),T=(0,a.useId)(),R=(0,a.useRef)(!0),{ghost:G}=U(t.desk);(0,a.useEffect)(()=>()=>{R.current=!1;let e=t.desk.get().ghost;e?.onCard&&t.desk.setGhost({...e,onCard:!1})},[t.desk]);let M=(0,a.useMemo)(()=>{let e=P(t,n);return ee(t.store,n,{principal:t.principal,places:t.places,...e.acts?{acts:e.acts}:{}})},[t,n]),K=(0,a.useMemo)(()=>{let e=C(n);if(e.length===0)return[];let i=new Set(M.candidates.flatMap(c=>c.type==="act"?[c.mutation]:[]));return ie(t.store,e,{principal:t.principal,...e.length===1?{focus:e[0]}:{}}).affordances.filter(c=>!c.destructive&&i.has(c.mutation))},[t.store,t.principal,n,M]),q=(0,a.useCallback)(()=>{let e=p.returnTo,i=ue(E.current,n,r);s(),requestAnimationFrame(()=>{if(e?.isConnected&&!e.closest("[inert]"))return e.focus({preventScroll:!0});let c=(i&&i.tabIndex>=0?i:null)??document.querySelector("[data-graview-page-title]")??document.querySelector("main");c&&c.tabIndex<0&&!c.hasAttribute("tabindex")&&c.setAttribute("tabindex","-1"),c?.focus({preventScroll:!0})})},[p.returnTo,n,r,s]),F=(0,a.useCallback)(e=>{if(e.open.length>0){let i=E.current?.getBoundingClientRect();s(),v({x:i?.left??0,y:i?.top??0,on:e.args.id??C(n)[0],about:C(n)});return}try{ae(t.store,e,{},{pressed:t.principal?{author:t.principal}:{}}),ne(t.store,e,{},{author:t.principal}),q()}catch(i){I(i instanceof Error?i.message:String(i))}},[t.store,t.principal,s,q,v,n]),H=(0,a.useCallback)(async e=>{let i=e.trim();if(!i)return;let c=l?.result?.answer?{said:l.said,answer:l.result.answer}:void 0;y(""),m(-1),I(null),$({said:i,result:null});let S=await re(t.ai,{...P(t,n,i),said:i,...c?{follows:c}:{}});t.desk.record(S.interaction),S.ghost&&S.ghost.proposals.length>0&&t.desk.setGhost({ghost:S.ghost,onCard:!0}),R.current&&$({said:i,result:S})},[l,t,n]),N=(0,a.useRef)(p.asked);(0,a.useEffect)(()=>{let e=N.current;N.current=void 0,e&&H(e)},[]);let k=(0,a.useMemo)(()=>{let e=u.trim();if(!e&&l)return[];let i=ge(e).split(/\s+/).filter(o=>o&&!ke.has(o)),c=/^show\b/i.test(e),S=/^(go|open)\b/i.test(e),x=[];if(!c&&!S)for(let o of K.filter(g=>W(g.label,i)).slice(0,L.act))x.push({id:`act:${o.id}`,kind:"act",label:o.label,hint:o.open.length>0?"asks more":"do it",take:()=>F(o)});let Q=e&&!/\?\s*$/.test(e)?te(t.store,n,{principal:t.principal,places:t.places,said:e}):[];for(let o of Q)x.push({id:`place:${o.place}`,kind:"place",label:o.fit==="full"?`Open ${o.title}`:`Open and adjust ${o.title}`,hint:o.fit==="full"?"a view you have":"adjust it",take:()=>{s(),t.goTo.place(o.place),o.fit==="partial"&&_(t.desk,{target:{on:"lens",place:o.place,...o.kind?{kind:o.kind}:{}},asked:e})}});if(!S){let o=M.candidates.filter(g=>g.type==="panel");for(let g of o.filter(D=>W(`show ${D.label}`,i)).slice(0,L.show))x.push({id:g.id,kind:"show",label:`Show ${pe(g.label)}`,hint:"a panel",take:()=>{s(),se(t,{title:g.label,recipe:{...g.panel,title:g.label}})}})}if(!c){for(let o of t.places.filter(g=>W(g.title,i)&&!Q.some(D=>D.place===g.as)).slice(0,L.place))x.push({id:`place:${o.as}`,kind:"place",label:`Go to ${o.title}`,take:()=>(s(),t.goTo.place(o.as))});if(i.length>0){let o=ce(t.store,e.replace(/^(go to|open)\s+/i,""),{principal:t.principal,from:C(n),limit:L.record}).hits;for(let g of o)g.about==="node"&&x.push({id:`record:${g.id}`,kind:"record",label:g.label,hint:B(t.store.schema,g.kind),take:()=>(s(),t.goTo.record(g.id))})}}return e&&x.push({id:"ask",kind:"ask",label:e,take:()=>void H(e)}),x},[u,K,M,t,n,F,H,s,l]);(0,a.useEffect)(()=>m(u.trim()?0:-1),[u]),(0,a.useLayoutEffect)(()=>{let e=E.current;if(!e)return;if(typeof e.showPopover=="function")try{e.showPopover()}catch{}z.current?.focus({preventScroll:!0});let i=0,c=()=>{be(e,ue(e,n,r)),i=requestAnimationFrame(c)};return c(),()=>cancelAnimationFrame(i)},[n,r]),(0,a.useEffect)(()=>{if(l)return;let e=i=>{i.target instanceof Node&&E.current?.contains(i.target)||s()};return document.addEventListener("pointerdown",e,!0),()=>document.removeEventListener("pointerdown",e,!0)},[l,s]);let fe=e=>{if(e.key==="ArrowDown"&&k.length>0)e.preventDefault(),m(i=>Math.min(k.length-1,i+1));else if(e.key==="ArrowUp"&&k.length>0)e.preventDefault(),m(i=>Math.max(0,i-1));else if(e.key==="Enter"){e.preventDefault();let i=k[b];i?i.take():u.trim()&&H(u)}},w=l?.result??null,he=k[b];return(0,d.jsxs)("section",{ref:E,popover:"manual",role:"region","aria-label":l?`Answer about ${f}`:`Ask about ${f}`,"data-testid":"quick-ask","data-quick-ask":l?"answer":"bar","data-quick-ask-face":r,"data-graview-offstage":"","data-graview-overlay":"",onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),q())},onMouseDown:e=>e.stopPropagation(),style:ve,children:[(0,d.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[(0,d.jsxs)("p",{"data-testid":"quick-ask-about",style:{margin:0,flex:"1 1 auto",minWidth:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},children:["About ",f]}),(0,d.jsx)("button",{type:"button","data-testid":"quick-ask-close","aria-label":"Close",title:"Close",onClick:q,style:ye,children:(0,d.jsx)("span",{"aria-hidden":"true",children:"\u2715"})})]}),l?(0,d.jsxs)("div",{"data-testid":"quick-answer",style:{display:"grid",gap:8},children:[(0,d.jsxs)("p",{"data-testid":"quick-answer-asked",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)",fontStyle:"italic",overflowWrap:"anywhere"},children:["\u201C",l.said,"\u201D"]}),(0,d.jsx)("p",{"data-testid":"quick-answer-text","aria-live":"polite",style:{margin:0,fontSize:"0.9375rem",lineHeight:1.45,color:w?.interaction.outcome==="failed"?"var(--graview-warn)":"var(--graview-ink)",overflowWrap:"anywhere"},children:w===null?"Thinking\u2026":w.interaction.outcome==="failed"?w.interaction.failed??"The AI could not answer that here.":w.answer??""}),w&&w.offers.length>0?(0,d.jsx)("ul",{"aria-label":"What acts on it",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:6},children:w.offers.map(e=>(0,d.jsx)("li",{children:(0,d.jsx)("button",{type:"button","data-testid":"quick-answer-offer","data-ai-offer":e.id,"data-ai-offer-type":e.type,onClick:()=>{le(t,w,e,s).then(i=>{i&&R.current&&I(i)})},style:xe,children:e.type==="panel"?`Show ${pe(e.label)}`:e.type==="place"?`Go to ${e.label}`:e.label})},e.id))}):null,G?.onCard&&G.ghost.interaction===w?.interaction.id?(0,d.jsx)(de,{placement:"card"}):null]}):null,(0,d.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,d.jsx)("input",{ref:z,type:"text",role:"combobox","data-testid":"quick-ask-input","aria-label":l?`Ask a follow-up about ${f}`:`Ask about ${f}, or go somewhere`,"aria-expanded":k.length>0,"aria-controls":T,"aria-autocomplete":"list",...he?{"aria-activedescendant":`${T}-${b}`}:{},autoComplete:"off",enterKeyHint:"go",placeholder:l?"Ask a follow-up\u2026":"Ask, or go to\u2026",value:u,readOnly:l!==null&&w===null,"aria-busy":l!==null&&w===null,onChange:e=>y(e.target.value),onKeyDown:fe,style:Ae}),(0,d.jsx)("div",{id:T,role:"listbox","aria-label":u.trim()?`What \u201C${u.trim()}\u201D finds here`:"What can be done here",hidden:k.length===0,style:{display:k.length===0?"none":"grid",gap:1,maxHeight:280,overflowY:"auto"},children:k.map((e,i)=>(0,d.jsx)("div",{id:`${T}-${i}`,role:"option","aria-selected":i===b,"data-testid":"quick-ask-option","data-quick-ask-kind":e.kind,"data-quick-ask-row":e.id,onMouseEnter:()=>m(i),onMouseDown:c=>c.preventDefault(),onClick:e.take,style:{...Se,background:i===b?"var(--graview-panel-muted)":"transparent",...e.kind==="ask"?{borderTop:"1px solid var(--graview-edge)",marginTop:2}:{}},children:e.kind==="ask"?(0,d.jsxs)("span",{children:["Ask: ",(0,d.jsxs)("span",{style:{fontWeight:600},children:["\u2018",e.label,"\u2019"]})]}):(0,d.jsxs)("span",{children:[e.label,e.hint?(0,d.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",e.hint]}):null]})},e.id))})]}),A?(0,d.jsx)("p",{role:"alert","data-testid":"quick-ask-refused",style:{margin:0,fontSize:"0.8125rem",color:"var(--graview-warn)"},children:A}):null,(0,d.jsx)("span",{style:J,"aria-live":"polite",children:k.length>0&&u.trim()?`${k.length} ${k.length===1?"way":"ways"} to go on`:""})]})}function ue(r,p,s){let t=r?.closest("[data-graview-embed]")??document,v=p.on==="list"?[`aggregate:${p.kind}`,`kind:${p.kind}`]:p.on==="lens"&&p.kind?[`aggregate:${p.kind}`]:C(p);for(let n of v)for(let f of t.querySelectorAll(`[data-graview-view="${CSS.escape(n)}"], [data-graview-pick="${CSS.escape(n)}"]`)){if(r?.contains(f))continue;let u=f.getBoundingClientRect();if(u.width>0&&u.height>0)return f}return s==="pages"?t.querySelector("main [data-graview-page-title]")??t.querySelector("main h1"):null}function be(r,p){let s={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},t=Math.min(we,s.width-2*h),v=r.getBoundingClientRect().height,n=p?.getBoundingClientRect(),f,u,y,b=A=>Math.max(h,Math.min(A,s.height-v-h));if(n&&n.width>0&&n.bottom>0&&n.top<s.height)if(n.right+h+t<=s.width-h)f=n.right+h,u=b(n.top),y="right";else if(n.left-h-t>=h)f=n.left-h-t,u=b(n.top),y="left";else{f=Math.max(h,Math.min(n.left,s.width-t-h));let A=n.bottom+h;u=A+v<=s.height-h?A:b(n.top-h-v),y=A+v<=s.height-h?"below":"above"}else f=(s.width-t)/2,u=b(72),y="top";let m=r.style,l={left:`${Math.round(f)}px`,top:`${Math.round(u)}px`,width:`${Math.round(t)}px`};m.left!==l.left&&(m.left=l.left),m.top!==l.top&&(m.top=l.top),m.width!==l.width&&(m.width=l.width);let $=p?.getAttribute("data-graview-view")??p?.getAttribute("data-graview-pick")??(p?"page":"");r.getAttribute("data-quick-ask-beside")!==$&&r.setAttribute("data-quick-ask-beside",$),r.getAttribute("data-quick-ask-side")!==y&&r.setAttribute("data-quick-ask-side",y)}var ve={position:"fixed",inset:"auto",margin:0,zIndex:Y("popover"),boxSizing:"border-box",display:"grid",gap:10,padding:12,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",maxHeight:"calc(100dvh - 24px)",overflowY:"auto",fontSize:"0.875rem"},ye={display:"inline-grid",placeItems:"center",width:28,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,color:"var(--graview-ink-muted)",background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer"},Ae={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},Se={display:"flex",alignItems:"center",minHeight:30,padding:"4px 8px",borderRadius:6,cursor:"pointer",overflowWrap:"anywhere"},xe={display:"inline-flex",alignItems:"center",minHeight:30,padding:"2px 10px",font:"inherit",fontSize:"0.8125rem",borderRadius:8};export{De as QuickAskCard};
@@ -1 +0,0 @@
1
- import{a,b}from"./chunk.ELOFPE25.js";import"./chunk.JYFZCJ4N.js";import"./chunk.H5S7OL2U.js";import"./chunk.PZQNR4KZ.js";import"./chunk.W4BKYSZX.js";import"./chunk.Y2YYH3JN.js";import"./chunk.SGCW2XRC.js";import"./chunk.ZN3PUM2I.js";import"./chunk.QIPASE42.js";import"./chunk.EVBCEEQ4.js";import"./chunk.OWT3VVOT.js";import"./chunk.NHTGAP3G.js";import"./chunk.NUYA4BWI.js";import"./chunk.OKZT2QBM.js";import"./chunk.ACTXR2MI.js";import"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{b as actOnSeveral,a as actsForSeveral};
@@ -1 +0,0 @@
1
- import{a as ne,b as B,c as re}from"./chunk.2B6P4GPS.js";import{B as J,D as Q,H as X,J as Y,M as ee,g as G,i as q,o as z,r as W,s as j,w as Z,x as _,z as U}from"./chunk.AI34V6WV.js";import{a as N}from"./chunk.G4ULQK64.js";import{G as ae,Ja as $,Qa as K,T as M,ba as T,da as I,wa as D}from"./chunk.M7RESZB6.js";import{Rc as V}from"./chunk.DZZL5IDD.js";import{b as P}from"./chunk.AJZBJBMO.js";var o=P(ae(),1);var y=P(M(),1),fe=e=>typeof e=="object"?e:{};function he({rootRef:e,firstLook:r,app:n}){let t=(0,o.useCallback)(()=>e.current,[e]);return r?(0,y.jsx)(ee,{firstLook:r,root:t,app:n}):null}function ge(e,r,n){let{app:t}=e,a=(0,o.useMemo)(()=>{let i=X(r(t.schema,t.viewSpecs),t),d=n?ie(i,n):i,s=e.views?e.views(t.schema,d):i,c=s===d?i:D(i,s);return Y(c,t.schema,J(e.brand??t.brand,t.schema)),n?n.register(c):c},[e.views,t.schema,t.viewSpecs,t.lenses,t.pages,t.home,n]);return $(a,e.keptViews)}function ie(e,r){let n={...e,register(t,a,i,d){return d?.name!==r.name&&e.register(t,a,i,d),n},...e.home?{home:(t,a)=>(r.home||e.home(t,a),n)}:{}};return n}var k=e=>e?e.getBoundingClientRect().height:0;function be(e,r,n){let t=(0,o.useRef)(n);t.current=n;let a=n!==void 0;(0,o.useLayoutEffect)(()=>{let i=e.current;if(!i||!a)return;let d=()=>{let u=[...i.children],g=u.find(b=>b.hasAttribute("data-graview-app-bar")),p=u.find(b=>b.hasAttribute("data-embed-content")),h=p?.querySelector("[data-embed-measure]")??null,l=u.find(b=>b.hasAttribute("data-graview-place-line"));return{strip:g,line:l,content:p,measure:h}},s=-1,c=()=>{let{strip:u,line:g,content:p,measure:h}=d(),l=Math.ceil(k(u)+k(g)+k(h||p));l!==s&&(s=l,t.current?.(l))};if(c(),typeof ResizeObserver>"u")return;let m=new ResizeObserver(c),S=()=>{m.disconnect();let{strip:u,line:g,content:p,measure:h}=d();for(let l of[i,u,g,p,h])l&&m.observe(l)};S();let v=new MutationObserver(()=>{S(),c()});return v.observe(i,{childList:!0}),()=>{m.disconnect(),v.disconnect()}},[e,r,a])}var we=480,se=0;function Se(e){let{app:r,seed:n,scheme:t="auto",brand:a=r.brand,fonts:i=!0,height:d="100%",label:s}=e,c=(0,o.useRef)(null);K(c);let m=d==="viewport"?"100dvh":d,S=q(typeof m=="string"&&/vh\b/.test(m)),v=(0,o.useMemo)(()=>`graview-embed-${++se}`,[]),u=(0,o.useMemo)(()=>e.store??e.remote?.store??B(r,n),[e.store,e.remote,r,n]),g=e.presence??e.remote?.presence,p=e.hostContext?.theme,h=re(t==="auto"&&p===void 0,a?.scheme),l=t==="auto"?p??h:t,b=(0,o.useMemo)(()=>N(l,a,{scope:`.${v}`}),[l,a,v]);G(e.favicon?V(a):void 0),(0,o.useEffect)(()=>{if(!i||typeof document>"u")return;let R=ne(a);if(!R||document.querySelector(`link[href="${R}"]`))return;let f=document.createElement("link");f.rel="stylesheet",f.href=R,document.head.appendChild(f)},[a,i]);let A=(0,o.useRef)(void 0);(0,o.useLayoutEffect)(()=>{let R=c.current,f=A.current;if(A.current=s,!R||!s)return;let oe=w=>{let E=w.getAttribute("aria-label")??"",x=f&&f!==s?E.startsWith(`${f} \xB7 `)?E.slice(f.length+3):E===f?"":E:E;x===s&&(w.getAttribute("role")==="region"||w.tagName==="SECTION"&&!w.hasAttribute("role"))&&w.setAttribute("role","group");let O=x.startsWith(`${s} \xB7 `)||x===s?x:x?`${s} \xB7 ${x}`:s;O!==E&&w.setAttribute("aria-label",O)},C=()=>R.querySelectorAll("aside, nav, main, header, footer, section[aria-label]:not([role]), [role=region], [role=complementary], [role=navigation], [role=search]").forEach(w=>{w.hasAttribute("data-graview-named-by-lens")||oe(w)});C();let L=new MutationObserver(C);return L.observe(R,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["aria-label"]}),()=>L.disconnect()},[s]);let F=S?`${m}`.replace(/([\d.]+)[sdl]?vh\b/g,(R,f)=>`${+f*S/100}px`):m;return{rootRef:c,scope:v,css:b,scheme:l,store:u,presence:g,brand:a,auto:d==="auto",height:F}}function ve({rootRef:e,board:r,onReport:n,where:t}){let a=(0,o.useCallback)(()=>e.current?.querySelector("[data-embed-content]")??e.current,[e]),i=(0,o.useRef)(t);i.current=t;let d=(0,o.useMemo)(()=>n?{tell:n,where:()=>i.current()}:void 0,[n]);return(0,y.jsx)(z,{board:r,anchor:a,report:d})}function Re(e){let r=e.split(/[?#]/)[0].split("/").filter(Boolean).map(n=>{try{return decodeURIComponent(n)}catch{return n}});return r.length===0?{place:"home"}:r[0]==="places"?{place:r[1]??"places"}:{place:r[0],...r[1]!==void 0?{record:r[1]}:{}}}function Ee(e,r,n){return{brand:n,locale:e.locale,timeZone:e.timeZone,principal:e.principal,seats:e.seats,presence:r,typing:e.remote?.typing,people:e.people,memory:e.memory,presenceTtlMs:e.presenceTtlMs,onKeepLens:e.onKeepLens,onProposeChange:e.onProposeChange,ai:e.ai,files:e.files,resolveApp:e.resolveApp,history:e.history,linkedRecords:e.linkedRecords,subscriptions:e.subscriptions,dismissals:e.dismissals,whileAway:e.whileAway,keptViews:e.keptViews,onExport:e.onExport,signIn:e.signIn,menuSections:e.menuSections,app:e.app}}function xe({name:e,heading:r,faces:n,at:t,without:a,home:i,reach:d,standing:s,hostActions:c,barActions:m,keeping:S,onFind:v,switch:u,named:g=!0}){let{brand:p,store:h,principal:l,views:b}=T();I();let A=a?.has("places")?[]:W({store:h,principal:l,views:b}),F=U();return(0,y.jsx)(Z,{brand:p,name:e,named:g,description:p?.subtitle,heading:r,faces:n,home:i,places:A,current:t===null?null:j(A,t),reach:d,onFind:v,...u?{switch:u}:{},...n||t===null?{scenePlaces:F}:{},...m?{actions:m}:{},tools:(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(Q,{clean:s}),(0,y.jsx)(_,{...c?{hostActions:c}:{},...S?{keeping:S}:{}})]})})}var Ae=e=>e===!1?2:Math.min(e+1,6);function ke(e){let[r,n]=(0,o.useState)(e),t=(0,o.useRef)(void 0),a=(0,o.useRef)(void 0),i=(0,o.useMemo)(()=>({go:t,at:n,pending:a}),[]),d=(0,o.useCallback)(s=>{if(t.current){t.current(s);return}a.current=s,n(s)},[]);return{at:r,setAt:n,steering:i,steer:d}}function de(e){let r=typeof e=="object"&&e!==null?e.name:void 0;return{name:typeof r=="string"&&r.length>0?r:typeof e=="object"?"Error":typeof e}}var H=()=>typeof performance<"u"?performance.now():Date.now();function Fe(e,r){let n=(0,o.useRef)({onError:e,face:r});return n.current={onError:e,face:r},(0,o.useCallback)((t,a)=>n.current.onError?.(de(t),{module:a.module,face:n.current.face}),[])}function Pe(e,r){let n=(0,o.useRef)(null);n.current===null&&(n.current=H());let t=(0,o.useRef)({onReady:e,face:r});t.current={onReady:e,face:r};let a=(0,o.useRef)(!1);return(0,o.useCallback)(i=>{a.current||(a.current=!0,t.current.onReady?.({ms:Math.max(0,H()-(n.current??H())),face:i}))},[])}var te=class extends o.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(r,n){console.error(`[graview] ${this.props.module} threw while rendering`,r,n.componentStack),this.props.report(r,{module:this.props.module})}render(){return this.state.failed?(0,y.jsxs)("div",{role:"alert","data-graview-face-error":this.props.module,...this.props.content?{"data-embed-content":""}:{},style:this.props.content?{flex:"1 1 auto",display:"grid",alignContent:"center",justifyItems:"center",gap:8,padding:24,background:"var(--graview-ground)",color:"var(--graview-ink)",fontSize:"0.9375rem"}:{display:"inline-flex",alignItems:"center",gap:6,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:[(0,y.jsx)("span",{children:this.props.content?"This part of the app could not draw.":"Could not draw."}),(0,y.jsx)("button",{type:"button",onClick:()=>this.setState({failed:!1}),style:{padding:"3px 11px",fontSize:"0.8125rem"},children:"Try again"})]}):this.props.children}};export{fe as a,he as b,ge as c,be as d,we as e,Se as f,ve as g,Re as h,Ee as i,xe as j,Ae as k,ke as l,Fe as m,Pe as n,te as o};
@@ -1 +0,0 @@
1
- import{i}from"./chunk.I77ZGIFE.js";import"./chunk.OWOOKLIU.js";import"./chunk.RD2X25XB.js";import"./chunk.KMV6PJFL.js";import"./chunk.A3ZC2JBO.js";import"./chunk.NAD7ZXYP.js";import"./chunk.2GEJNG2U.js";import"./chunk.UQQKDBIH.js";import"./chunk.AJSUHPBE.js";import"./chunk.LAYQ5PFS.js";import"./chunk.KDXU5DT3.js";import"./chunk.O2BHPYA4.js";import"./chunk.WVUJXDXZ.js";import{e as l}from"./chunk.SGCW2XRC.js";import"./chunk.ZN3PUM2I.js";import"./chunk.QIPASE42.js";import"./chunk.EVBCEEQ4.js";import"./chunk.OWT3VVOT.js";import"./chunk.NHTGAP3G.js";import"./chunk.GZHZLJBF.js";import"./chunk.UKQUUPKE.js";import"./chunk.OJGHDWI6.js";import"./chunk.DDUCIUVW.js";import"./chunk.NUYA4BWI.js";import"./chunk.OKZT2QBM.js";import"./chunk.ACTXR2MI.js";import"./chunk.AI34V6WV.js";import"./chunk.G4ULQK64.js";import{T as m}from"./chunk.M7RESZB6.js";import"./chunk.SDO3U72B.js";import"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import{b as g}from"./chunk.AJZBJBMO.js";var a=g(m(),1),r=new WeakMap;function c(n){let o=r.get(n);if(!o){let t=l(n);o=e=>e.mode==="fullscreen"?(0,a.jsx)(i,{blocks:t,slot:"home",heading:2,firstHeading:1,...e.flagged?{flagged:e.flagged}:{}}):(0,a.jsx)(i,{blocks:t,slot:"home",heading:3,firstHeading:2,...e.flagged?{flagged:e.flagged}:{}}),r.set(n,o)}return o}export{c as homeView};
@@ -1,3 +0,0 @@
1
- import{C as h,P as $,Yb as k,Z as g,ac as w,ga as m}from"./chunk.DZZL5IDD.js";function G(t,n,e){let r=t?.display?.format?.[n];return r?r(e):typeof e=="string"?m(e):String(e)}function Q(t,n,e,r){let s=t.tryDefinition(n)?.edges,i=s&&Object.hasOwn(s,e)?s[e]:void 0;return(r==="out"?i?.description:i?.inverse)??m(e).toLowerCase()}var A=Symbol.for("@graview/core:markdown");function S(t){let n=h(t);return!!n&&(n[A]===1||S(n.innerType))}var x=/^ {0,3}#{1,6}(?:[ \t]+|$)/,y=/^[ \t]*(?:[-*+•]|\d{1,9}[.)])[ \t]+(?:\[[ xX]\][ \t]+)?/,R=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,O=/^ {0,3}(?:`{3,}|~{3,})/,F=/^ {0,3}(?:>[ \t]?)+/,M=/^\|?\s*:?-{2,}:?\s*(?:\|\s*:?-{2,}:?\s*)*\|?$/,W={amp:"&",lt:"<",gt:">",quot:'"',"#39":"'",nbsp:" "};function _(t){return t.replace(/!?\[([^\]\n]{0,500})\]\([^)\n]{0,500}\)/g,"$1").replace(/<((?:https?:|mailto:)[^>\s]*)>/gi,"$1").replace(/<\/?[A-Za-z][^<>\n]*>/g,"").replace(/`+([^`\n]*)`+/g,"$1").replace(/(\*\*|__|~~)(?=\S)([^\n]{0,500}?\S)\1/g,"$2").replace(/(^|[^\w*])\*(?=\S)([^*\n]{0,500}?\S)\*(?![\w*])/g,"$1$2").replace(/(^|\W)_(?=\S)([^_\n]{0,500}?\S)_(?!\w)/g,"$1$2").replace(/\\([\\`*_{}[\]()#+\-.!>|~])/g,"$1").replace(/&(amp|lt|gt|quot|#39|nbsp);/g,(n,e)=>W[e]??"")}function N(t,n,e){let r=t.replace(/\r\n?/g,`
2
- `).split(`
3
- `),s=[],i=[],u=0,d=!1,a=()=>{let o=i.join(" ").replace(/\s+/g," ").trim();o&&(s.push(o),u+=o.length),i=[]},c=0;for(;c<r.length&&u<=e;){let o=r[c++];if(n&&O.test(o)){d=!d,d||a();continue}if(!d&&(o.trim().length===0||n&&(R.test(o)||M.test(o.trim())))){a();continue}let f=!d&&n&&x.test(o),l=!d&&y.test(o);if((f||l)&&a(),n&&!d?(o=o.replace(F,""),f&&(o=o.replace(x,"").replace(/[ \t]+#+[ \t]*$/,"")),l&&(o=o.replace(y,"")),o.includes("|")&&(o=o.replace(/^[ \t]*\||\|[ \t]*$/g,"").split("|").map(p=>p.trim()).filter(Boolean).join(" \xB7 ")),o=_(Number.isFinite(e)?o.slice(0,e*2+200):o)):l&&(o=o.replace(y,"")),i.push(o),f&&a(),i.reduce((p,T)=>p+T.length,0)>e)break}return a(),{blocks:s,more:r.slice(c).some(o=>o.trim().length>0&&!(n&&(O.test(o)||R.test(o))))}}function j(t,n){return`${(t.slice(0,n+1).replace(/\s+\S*$/,"")||t.slice(0,n)).replace(/[\s,;:.—-]+$/,"")}\u2026`}function J(t,n={}){let e=n.most??160,{blocks:r,more:s}=N(t,n.markdown===!0,e),i=r[0]??"";if(i.length<=e)return(s||r.length>1)&&i.length>0&&!/[.!?…:]$/.test(i)?`${i}\u2026`:i;let u=w(i);return u&&u.length<=e?u:j(i,e)}var K=t=>N(t,!0,Number.POSITIVE_INFINITY).blocks.join(" ");var E={d:1440,h:60,m:1};function tn(t){if(typeof t=="number")return Number.isFinite(t)&&t>=0?Math.round(t):void 0;if(typeof t!="string")return;let n=t.trim().toLowerCase();if(/^\d+$/.test(n))return Number(n);let e=/^(\d+):([0-5]\d)(?::([0-5]\d))?$/.exec(n);if(e)return Number(e[1])*60+Number(e[2])+Math.round(Number(e[3]??0)/60);let r=0,s=!1,i=n.replace(/(\d*[.,]?\d+) *(days?|d|hours?|hrs?|hr|h|minutes?|mins?|min|m)(?![a-z])/g,(u,d,a)=>(s=!0,r+=Number(d.replace(",","."))*E[a[0]]," "));return s&&/^[\s,+]*(?:and[\s,+]*)*$/.test(i)?Math.round(r):void 0}function I(t,n){if(!Number.isFinite(t))return String(t);let e=Math.round(Math.abs(t)),r=Math.floor(e/60),s=e%60,i=[r?`${g(r,n)} h`:"",s||!r?`${g(s,n)} min`:""].filter(Boolean).join(" ");return t<0?`\u2212${i}`:i}var D=/^(\+?1[ .-]?)?\(?([2-9]\d\d)\)?[ .-]?(\d{3})[ .-]?(\d{4})(?: *(?:ext\.?|x|#) *(\d+))?$/i;function P(t,n){let e=t.trim(),r=/[-_](US|CA)\b/i.test($(n))?D.exec(e):null;if(!r)return e;let[,s,i,u,d,a]=r;return`${s?.startsWith("+")?"+1 ":""}(${i}) ${u}-${d}${a?` ext. ${a}`:""}`}function L(t){let[,n="",e]=/^(.*?)(?: *(?:ext\.?|x|#) *(\d+))?$/i.exec(t.trim())??[],r=n.replace(/\D/g,"");return r.length<3?void 0:`tel:${n.startsWith("+")?"+":""}${r}${e?`;ext=${e}`:""}`}var q=()=>/Mac|iPhone|iPad|iPod/.test(globalThis.navigator?.userAgent??"");function C(t,n=q()){let e=encodeURIComponent(t.trim());return n?`https://maps.apple.com/?q=${e}`:`https://www.google.com/maps/search/?api=1&query=${e}`}var H=t=>t?.fields?.shape??{},U=(t,n)=>{let e=H(t);return Object.hasOwn(e,n)?k(e[n]):void 0},b=(t,n)=>{let e=t?.computed,r=e&&Object.hasOwn(e,n)?e[n]:void 0;return typeof r=="object"?r:void 0},z=(t,n)=>{let e=b(t,n);return e?.as??(e?.format==="duration"?"duration":void 0)};function rn(t,n){let e=b(t,n);if(!e)return;if(e.amount)return e.amount;let r=e.format==="money"||e.format==="percent"?e.format:void 0;return r||!e.format&&e.unit?{...r?{format:r}:{},...e.unit?{unit:e.unit}:{}}:void 0}function on(t,n){return b(t,n)?.hidden===!0}function sn(t,n){return U(t,n)??(t&&z(t,n)==="duration"?"duration":void 0)}function dn(t,n,e){return t==="duration"?typeof n=="number"?I(n,e):void 0:t==="phone"?typeof n=="string"?P(n,e):void 0:t==="place"&&typeof n=="string"?n.trim():void 0}function un(t,n){if(!(typeof n!="string"||!n.trim()))return t==="phone"?L(n):t==="place"?C(n):void 0}export{S as a,G as b,Q as c,J as d,K as e,tn as f,rn as g,on as h,sn as i,dn as j,un as k};
@@ -1,74 +0,0 @@
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{c as ur}from"./chunk.G4ULQK64.js";import{G as R,Ia as O,Ma as hn,Na as vn,Oa as bn,Ra as q,T as P,Va as j,a as Ae,ba as ue,ca as Z,e as Ne,l as un,m as fn,na as yn,s as gn,v as oe,va as wn,z as mn}from"./chunk.M7RESZB6.js";import{a as C}from"./chunk.SDO3U72B.js";import{$d as cn,Hc as Ze,Hd as pe,Id as ae,Jd as rn,Ld as Le,Nd as tn,Oc as $,Od as an,Pc as Je,Pd as Q,Qc as Xe,Sc as en,Uc as nn,Wd as on,Xd as sn,Yd as ln,Zd as dn,ae as Ee,bb as Ue,ee as pn,ja as qe,na as je,oa as Ye,tb as Qe}from"./chunk.DZZL5IDD.js";import{b as v}from"./chunk.AJZBJBMO.js";var Te=v(R(),1),kn=new WeakMap,fe=e=>{let n=kn.get(e);return n||kn.set(e,n={open:null,drawn:0,listeners:new Set}),n},fr=e=>{for(let n of[...e.listeners])n()},gr=0;function Tt(e,n){let t=fe(e);t.open=n?{...n,at:++gr}:null,fr(t)}var xn=e=>n=>{let t=fe(e);return t.listeners.add(n),()=>void t.listeners.delete(n)};function Sn(e){let n=()=>e?fe(e).drawn>0:!1;return(0,Te.useSyncExternalStore)(e?xn(e):mr,n,n)}var mr=()=>()=>{};function Ht(e){let n=()=>fe(e).open;return(0,Te.useSyncExternalStore)(xn(e),n,n)}var V=v(R(),1),Pn=v(ur(),1);function yr(e){let[n,t]=(0,V.useState)(null),[r,i]=(0,V.useState)(null);return(0,V.useLayoutEffect)(()=>{e.current!==r&&i(e.current)}),(0,V.useLayoutEffect)(()=>{if(!r||typeof ResizeObserver>"u")return;let a=()=>Math.round(r.getBoundingClientRect().width),s=a();t(s);let p=new ResizeObserver(()=>{let c=a();c!==s&&(s=c,(0,Pn.flushSync)(()=>t(c)))});return p.observe(r),()=>p.disconnect()},[r]),n}function wr(e=!0){let[n,t]=(0,V.useState)();return(0,V.useEffect)(()=>{if(!e)return t(void 0);let r=0,i=()=>t(innerHeight),a=()=>{i(),clearTimeout(r),r=window.setTimeout(i,300)},s=p=>{for(let[c,d]of[[window,"resize"],[window,"orientationchange"],[window.visualViewport,"resize"]])c?.[p](d,a)};return s("addEventListener"),i(),()=>{clearTimeout(r),s("removeEventListener")}},[e]),n}var ge={position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap"};var A=v(R(),1);var H=v(P(),1),Ln=6e3;function hr(e){return{...e,notify:n=>e.notify({...n,from:"framework"})}}var vr=e=>({place:"overview",...e&&!/^(aggregate|kind):/.test(e)?{record:e}:{}});function br(){let e=[],n=0,t=new Set,r=new Map,i,a=()=>{for(let d of[...t])d()},s=d=>{if(clearTimeout(r.get(d.id)),r.delete(d.id),d.kind!=="toast")return;let u=(d.actions?.length??0)+(d.action?1:0),l=d.timeout??(u>0?!1:Ln);l!==!1&&r.set(d.id,setTimeout(()=>i?.()?s(d):p(d.id),l))},p=d=>{clearTimeout(r.get(d)),r.delete(d),e.some(u=>u.id===d)&&(e=e.filter(u=>u.id!==d),a())},c=d=>{e=e.some(u=>u.id===d.id)?e.map(u=>u.id===d.id?d:u):[...e,d],s(d),a()};return{notify(d){let u=d.id??`notice-${++n}`;return c({...d,id:u,said:++n}),{id:u,dismiss:()=>p(u),update:l=>{let m=e.find(w=>w.id===u);m&&c({...m,...l,id:u,kind:m.kind,said:l.sentence!==void 0&&l.sentence!==m.sentence?++n:m.said})}}},dismiss:p,hold(d){i=d},list:()=>e,subscribe(d){return t.add(d),()=>t.delete(d)}}}function kr({notices:e}){let n=e.reduce((p,c)=>!p||c.said>p.said?c:p,void 0),[t,r]=(0,A.useState)(""),[i,a]=(0,A.useState)(""),s=(0,A.useRef)(0);return(0,A.useEffect)(()=>{if(!n||n.said===s.current)return;s.current=n.said;let p=n.tone==="bad";(p?a:r)("");let c=setTimeout(()=>(p?a:r)(n.sentence),50);return()=>clearTimeout(c)},[n]),(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)("div",{role:"status","aria-live":"polite","data-testid":"notices-said",style:ge,children:t}),(0,H.jsx)("div",{role:"alert","data-testid":"notices-alarm",style:ge,children:i})]})}var xr=(0,A.createContext)(null);function Sr({board:e,anchor:n,report:t}){let r=(0,A.useSyncExternalStore)(e.subscribe,e.list,e.list);return(0,A.useEffect)(()=>Er(He.prefetch),[]),(0,H.jsxs)(H.Fragment,{children:[r.length>0?(0,H.jsx)(A.Suspense,{fallback:null,children:(0,H.jsx)(Lr,{notices:r,anchor:n,board:e,...t?{report:t}:{}})}):null,(0,H.jsx)(kr,{notices:r})]})}var He=O(C(()=>(__graviewPreload(import.meta.url,["./chunk.MB7LKKUD.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.DPEIT3TW.js")))),Pr=()=>He.load().then(()=>{},()=>{}),Lr=He.part((e,n)=>(0,H.jsx)(e.NoticeStacks,{...n}),{quiet:!0});function Er(e){let n=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&e()},t=globalThis;if(t.requestIdleCallback){let i=t.requestIdleCallback(n,{timeout:5e3});return()=>t.cancelIdleCallback?.(i)}let r=setTimeout(n,2500);return()=>clearTimeout(r)}var M=O(C(()=>(__graviewPreload(import.meta.url,["./chunk.Y4FZKUOK.js","./chunk.4TX6VCBT.js","./chunk.TIALD6SC.js","./chunk.QHY5NVYH.js","./chunk.U6ZRJKVM.js","./chunk.PLTH2LW5.js","./chunk.66P5IDTH.js","./chunk.UQQKDBIH.js","./chunk.AJSUHPBE.js","./chunk.KDXU5DT3.js","./chunk.W4BKYSZX.js","./chunk.U5P23GO7.js","./chunk.GZHZLJBF.js","./chunk.UKQUUPKE.js","./chunk.OJGHDWI6.js","./chunk.DDUCIUVW.js","./chunk.NUYA4BWI.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5HGD6OWL.js"))));var y=v(R(),1);var Nn=v(R(),1);var En=v(R(),1);function ie(e){return(0,En.useMemo)(()=>e===void 0||e===""?void 0:{__html:e},[e])}var _=v(P(),1);function Be({brand:e,size:n=22}){let t=en(e),r=An(t?.light),i=r?An(t?.dark):void 0,a=ie(r!==void 0&&$(r)?r:void 0),s=ie(i!==void 0&&$(i)?i:void 0),p={display:"inline-flex",flex:"0 0 auto",height:n,color:"var(--graview-accent)"},c=nn(e);if(c)return(0,_.jsx)("span",{className:"graview-logo graview-emoji-mark","data-testid":"app-mark","aria-hidden":!0,style:{...p,alignItems:"center",fontSize:`${n*.86/16}rem`,lineHeight:1},children:c});if(!r)return null;let d=e?.logoAlt??e?.name??"",u=d!==""&&d!==e?.name,l=u?{role:"img","aria-label":d}:{"aria-hidden":!0};if(i){let w=(h,S,b)=>$(h)?(0,_.jsx)("span",{className:"graview-logo-face","data-graview-scheme-only":b,dangerouslySetInnerHTML:S}):(0,_.jsx)("img",{className:"graview-logo-face","data-graview-scheme-only":b,src:h,alt:""});return(0,_.jsxs)("span",{className:"graview-logo","data-testid":"app-mark",style:p,...l,children:[w(r,a,"light"),w(i,s,"dark")]})}let m=t?.darkFallback==="invert"?{"data-graview-logo-fallback":"invert"}:{};return $(r)?(0,_.jsx)("span",{className:"graview-logo","data-testid":"app-mark",style:p,...m,...l,dangerouslySetInnerHTML:a}):(0,_.jsx)("img",{className:"graview-logo","data-testid":"app-mark",src:r,alt:u?d:"",...m,style:{...p,width:"auto"}})}function An(e){if(!(!e||!Xe(e)))return $(e)&&Je(e)!==null?void 0:e}function Ar(e){(0,Nn.useEffect)(()=>{if(!e||typeof document>"u")return;let n=[...document.querySelectorAll('link[rel~="icon"]')],t=n.map(i=>i.getAttribute("href")),r;n.length===0&&(r=document.createElement("link"),r.rel="icon",r.setAttribute("data-graview-favicon",""),document.head.appendChild(r),n.push(r));for(let i of n)i.href=e;return()=>{r&&r.remove(),n.forEach((i,a)=>{i!==r&&t[a]!==null&&t[a]!==void 0&&i.setAttribute("href",t[a])})}},[e])}var o=v(P(),1),Nr=M.part((e,n)=>(0,o.jsx)(e.TidyFoot,{...n}),{quiet:!0}),Tr=M.part((e,n)=>(0,o.jsx)(e.Here,{...n}),{quiet:!0});function Hr(){let e=Z(),[n,t]=(0,y.useState)("");return(0,y.useEffect)(()=>e?.store.subscribe((r,i)=>{i.some(a=>a.author.id!==e.principal.id)&&M.load().then(a=>a.sayTheirChange(i,e,t),String)}),[e]),(0,o.jsx)("span",{role:"status",className:"graview-bar-said",children:n})}var Tn="home",Hn="/",Y="scene:whole";function Br(e){let{store:n,principal:t,views:r}=e,i=n.kindsKeptFrom(t),a=n.schema.kinds.filter(f=>!n.modules.disabledKinds.has(f)&&!i.has(f)),s=r?.arrangement?.(),p=r?.places()??[],c=dn(s,n.schema,p),d=ln(n.schema,s,[...n.modules.administered.values()].flatMap(f=>f.kinds??[])),u=(f,x)=>(!n.graph.size.nodes||n.graph.count(f)>0)&&(c?x?c.places.has(`${f}|${x}`):c.kinds.has(f):!d.has(f)),l=[{key:Tn,label:"Home",path:Hn,group:"home",primary:!0}],m=p.filter(f=>a.includes(f.kind)&&f.as!==cn),w=m.filter(f=>!f.hidden),h=new Set(ae(w).map(f=>Q(f,p,n.schema).toLowerCase())),S=f=>tn(f.as,an(f,p)?Le(n.schema,f.kind).slice(1):void 0),b=new Set(s?.hide??[]),L=pn(a,s?.order,w);for(let{kind:f,view:x}of L){if(x){l.push({key:`place:${x.kind}:${x.as}`,label:Q(x,p,n.schema),path:S(x),group:"lists",kind:f,primary:c?c.places.has(`${f}|${x.as}`):!0});continue}let U=je(n.schema,f),T=h.has(U.toLowerCase());l.push({key:`kind:${f}`,label:T?Ye(n.schema,f):U,path:Le(n.schema,f),group:"lists",kind:f,primary:T||b.has(f)?!1:u(f),...b.has(f)?{hidden:!0}:{}})}for(let f of ae(m)){if(L.some(T=>T.view&&pe(T.view,f)))continue;let x=S(f),U=[f.kind,...f.over??[]].some(T=>a.includes(T)&&u(T,f.as));l.some(T=>T.path===x)||l.push({key:`place:${f.kind}:${f.as}`,label:Q(f,p,n.schema),path:x,group:"pictures",kind:f.kind,primary:U,hidden:f.hidden})}return a.some(f=>Object.keys(n.schema.tryDefinition(f)?.edges??{}).length>0)&&l.push({key:"connections",label:"Connections",path:"/map",group:"pictures",primary:!1}),l}function Mr(e,n){let[t="/",r=""]=n.split("?"),i=e.find(s=>s.path===(r?`${t}?${r}`:t))??e.find(s=>s.path===t);if(i)return i.key;let a=`/${t.split("/").filter(Boolean)[0]??""}`;return e.find(s=>s.group==="lists"&&s.path===a)?.key??null}var Bn=(0,y.createContext)(null),Cr=()=>(0,y.useContext)(Bn),W=30,Mn=48,J=640,Ce=4,Me=2;function Cn(e){let{widths:n,current:t,room:r,more:i,gap:a=Ce,primary:s,most:p=sn}=e;if(n.length===0||!(r>0)||!(i>0)||n.some(l=>!(l>0)))return null;let c=(l,m)=>l.reduce((w,h)=>w+n[h],0)+a*Math.max(0,l.length-1)+(m?a+i:0),d=(l,m)=>t<0||!l.includes(t)||l.slice(0,m).includes(t)?l.slice(0,m):[...l.filter(w=>w!==t).slice(0,m-1),t].sort((w,h)=>w-h),u=d(n.map((l,m)=>m).filter(l=>s?.[l]!==!1||l===t),p);if(c(u,u.length<n.length)<=r)return u.length>=Me?u:null;for(let l=u.length-1;l>=Me;l--){let m=d(u,l);if(c(m,!0)<=r)return m}return null}var Rr=`
2
- .graview-bar{display:block;margin:0;padding:0;container:graview-bar/inline-size;flex:0 0 auto;position:relative;background:var(--graview-bar);border-bottom:1px solid var(--graview-edge);color:var(--graview-ink);font-family:var(--graview-font-body,system-ui)}
3
- .graview-bar-row{display:flex;flex-wrap:nowrap;align-items:center;gap:16px;height:${Mn-1}px;margin:0;padding:0 16px}
4
- .graview-bar-home,.graview-bar-face,.graview-bar-place,.graview-bar-item,.graview-bar-at{display:inline-flex;align-items:center;box-sizing:border-box;min-width:0;margin:0;border:0;background:none;box-shadow:none;font:inherit;letter-spacing:normal;text-transform:none;text-decoration:none;color:var(--graview-ink);cursor:pointer;text-align:left}
5
- .graview-bar-app{display:flex;flex:0 1 auto;max-width:50%}
6
- .graview-bar-app::after{content:"";flex:0 100000 auto;width:2px;min-width:0}
7
- .graview-bar-name{margin:0;display:flex;font-family:var(--graview-font-display,var(--graview-font-body,system-ui));font-size:.9375rem;font-weight:600;line-height:1.25}
8
- .graview-bar-home{gap:8px;min-width:auto;min-height:30px;padding:0;letter-spacing:-.005em}
9
- .graview-bar-app-name{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-overflow:ellipsis;overflow-wrap:normal;word-break:normal}
10
- .graview-bar-faces{display:inline-flex;flex:0 0 auto;box-sizing:border-box;height:30px;margin:0;padding:2px;gap:2px;border:1px solid var(--graview-edge);border-radius:8px}
11
- .graview-bar-face{gap:6px;padding:0 10px;border-radius:6px;font-size:.8125rem;white-space:nowrap;color:var(--graview-ink-muted)}
12
- .graview-bar-face span{min-width:0;max-width:11em;overflow:hidden;text-overflow:ellipsis}
13
- .graview-bar-face[aria-pressed=true]{color:var(--graview-ink);font-weight:600;background:color-mix(in srgb,var(--graview-accent) 16%,transparent)}
14
- [data-switch-drawn=icons] .graview-bar-face{padding:0 8px}
15
- .graview-bar-said,[data-switch-drawn=icons] .graview-bar-face span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
16
- .graview-bar-mid{display:flex;flex:1 100 0;min-width:0}
17
- .graview-bar-mid[data-place]{min-width:9em;flex-basis:auto}
18
- .graview-bar-place-at{position:relative;display:inline-flex;min-width:0;max-width:100%}
19
- .graview-bar-place{gap:6px;height:30px;max-width:100%;padding:0 8px;border:1px solid transparent;border-radius:8px;font-size:.875rem;font-weight:600}
20
- .graview-bar-face:hover,.graview-bar-place:hover{border-color:var(--graview-edge);color:var(--graview-ink)}
21
- .graview-bar-place-words{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
22
- .graview-bar-mid[data-places=standing]{flex:0 0 auto}
23
- .graview-bar-places{display:flex;align-items:center;gap:${Ce}px;min-width:0;margin:0;padding:0}
24
- .graview-bar-at{gap:6px;flex:0 0 auto;height:30px;padding:0 8px;border-block:2px solid transparent;border-radius:0;font-size:.875rem;font-weight:500;white-space:nowrap;color:var(--graview-ink-muted)}
25
- .graview-bar-at:is(:hover,[aria-current],[aria-expanded=true]){color:var(--graview-ink)}
26
- .graview-bar-at[aria-current]{font-weight:600;border-bottom-color:var(--graview-accent)}
27
- .graview-bar-ruler{position:absolute;left:0;top:0;display:flex;width:0;height:0;overflow:hidden;visibility:hidden;pointer-events:none}
28
- .graview-bar-ruler .graview-bar-at{font-weight:600}
29
- .graview-bar-ruler>.graview-bar-name{flex:none;white-space:nowrap;letter-spacing:-.005em}
30
- .graview-bar-list{display:grid;align-content:start;width:min(320px,calc(100vw - 24px));height:auto;max-height:min(70vh,560px);overflow:auto;margin:0;padding:6px;border-radius:10px;border:1px solid var(--graview-edge);background:var(--graview-float);box-shadow:var(--graview-lift-high);color:var(--graview-ink)}
31
- .graview-bar-list[hidden]{display:none}
32
- .graview-bar-list p{margin:8px 8px 2px;font-size:.6875rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--graview-ink-muted)}
33
- .graview-bar-list ul,.graview-bar-list li{display:grid;margin:0;padding:0;list-style:none}
34
- .graview-bar-item{align-items:flex-start;gap:10px;width:100%;padding:7px 8px;border-radius:7px;font-size:.875rem;line-height:1.3;overflow-wrap:anywhere}
35
- .graview-bar-item:hover{background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
36
- .graview-bar-item[aria-current]{font-weight:600;background:color-mix(in srgb,var(--graview-accent) 14%,transparent)}
37
- .graview-bar-mark{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:14px;height:1.3em;color:var(--graview-ink-muted)}
38
- .graview-bar :focus-visible{outline:2px solid var(--graview-accent);outline-offset:1px}
39
- .graview-bar-tools{display:contents}
40
- .graview-bar-tools>*{margin-left:-8px}
41
- .graview-bar-tools>:is(.graview-bar-find,.graview-bar-find-open){margin-left:auto}
42
- .graview-bar-own{display:flex;align-items:center;flex:0 0 auto}
43
- .graview-bar-own:empty{display:none}
44
- .graview-bar-host{display:flex;align-items:center;gap:2px;flex:0 0 auto}
45
- .graview-bar-host-action{display:inline-flex;align-items:center;gap:6px;box-sizing:border-box;min-width:${W}px;height:${W}px;margin:0;padding:0 10px;border-radius:8px;border:1px solid transparent;background:none;box-shadow:none;font:inherit;font-size:.875rem;font-weight:500;letter-spacing:normal;text-transform:none;white-space:nowrap;color:var(--graview-ink-muted);cursor:pointer}
46
- .graview-bar-host-action:is(:hover,[aria-expanded=true]){border-color:var(--graview-edge);color:var(--graview-ink)}
47
- .graview-bar-host-action[data-folded]{padding:0}
48
- .graview-bar-host-mark{display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;width:16px;height:16px;font-size:.9375rem;line-height:1}
49
- .graview-bar-host-mark svg{width:16px;height:16px}
50
- .graview-bar-list .graview-bar-host-action{width:100%;justify-content:flex-start;white-space:normal;overflow-wrap:anywhere}
51
- .graview-bar-find{position:relative;display:flex;min-width:7.5rem;flex:0 600 9rem;--graview-bar-find-end:3.25em}
52
- .graview-bar-find-slot{display:flex;flex:1;min-width:0}
53
- .graview-bar-find-keys{position:absolute;right:10px;line-height:30px;pointer-events:none;font-size:.75rem;color:var(--graview-ink-faint)}
54
- .graview-bar-find:is(:focus-within,:has(input:not(:placeholder-shown))){flex-basis:16rem;--graview-bar-find-end:10px}
55
- :is(:focus-within,:has(input:not(:placeholder-shown)))>.graview-bar-find-keys,.graview-bar-find-open{display:none}
56
- .graview-bar-line{display:flex;flex:0 0 auto;padding:6px 8px;background:var(--graview-ground);border-bottom:1px solid var(--graview-edge);font-family:var(--graview-font-body,system-ui)}
57
- .graview-bar-line .graview-bar-place{height:auto;min-height:32px}
58
- .graview-bar-line .graview-bar-place-words{white-space:normal}
59
- @media (pointer:coarse){.graview-bar-find-keys{display:none}}
60
- @container graview-bar (max-width: ${J-1}px){
61
- .graview-bar-row{gap:10px;padding:0 12px}
62
- .graview-bar-app,.graview-bar-home{max-width:none;flex:1 1 auto;min-width:28px}
63
- .graview-bar-name,.graview-bar-app-name{min-width:0}
64
- .graview-bar-mid,.graview-bar-find{display:none}
65
- .graview-bar-find-open{display:inline-flex}
66
- .graview-bar-own{--graview-activity-mark:inline}
67
- .graview-bar-own .graview-activity-word{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
68
- .graview-bar[data-finding] :is(.graview-bar-app,.graview-bar-faces,.graview-bar-find-open){display:none}
69
- .graview-bar[data-finding] .graview-bar-find{display:flex;flex:1 1 auto;min-width:0}
70
- }
71
- @container graview-bar (max-width: 300px){
72
- .graview-bar-row{gap:4px;padding:0 10px}
73
- }`,X={display:"inline-flex",alignItems:"center",justifyContent:"center",gap:6,minWidth:W,height:W,padding:0,borderRadius:8,border:"1px solid transparent",background:"none",boxShadow:"none",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.875rem",cursor:"pointer",flex:"0 0 auto"};function Or({brand:e,name:n,heading:t=1,home:r,faces:i,places:a,current:s,reach:p,tools:c,find:d=!0,description:u,findBox:l,onFind:m,switch:w="words",scenePlaces:h,skips:S,named:b=!0,actions:L}){let se=(0,y.useRef)(null),f=Z()?.who.size,[x,U]=(0,y.useState)(null),[T,Qn]=(0,y.useState)(null),[E,Zn]=(0,y.useState)(!1),[Jn,Ie]=(0,y.useState)(!1),[Xn,er]=(0,y.useState)(!0),[$e,nr]=(0,y.useState)(null),[rr,tr]=(0,y.useState)(!0),le=i?i.pages.current:!h,re=le?{places:a,current:s,reach:p}:h,ke=re&&{...re,places:rn(re.places),here:re.places.find(g=>g.key===re.current)?.label},k=ke&&ke.places.length>0?ke:null,xe=k?k.places.findIndex(g=>g.key===k.current):-1,_e=!!i&&w==="words",We=k?k.places.map(g=>g.primary===!1?"0":"1").join(""):"",I=(0,y.useCallback)(()=>{let g=se.current;if(!g)return;let B=Yr(g,xe,_e,We);B!==void 0&&nr(B);let G=B?!0:Vr(g);G!==null&&er(G)},[xe,_e,We]);(0,y.useLayoutEffect)(()=>{let g=se.current;if(!g)return;let B=()=>{let te=g.getBoundingClientRect().width;Zn(te<J);let pr=g.querySelector("[data-graview-bar-host-ruler]");tr(te>=J+(pr?.getBoundingClientRect().width??0)),g.style.setProperty("--graview-bar-width",`${Math.round(te)}px`),I()};B();let G=typeof document>"u"?void 0:document.fonts;if(G?.ready.then(I),G?.addEventListener?.("loadingdone",I),typeof ResizeObserver>"u")return()=>G?.removeEventListener?.("loadingdone",I);let Pe=new ResizeObserver(B);Pe.observe(g);for(let te of g.querySelectorAll(".graview-bar-tools > *"))Pe.observe(te);return()=>{Pe.disconnect(),G?.removeEventListener?.("loadingdone",I)}},[I]);let Se=(0,y.useRef)(m);Se.current=m,(0,y.useLayoutEffect)(()=>{Se.current?.(d&&x?{slot:x,compact:E,own:T}:null)},[d,x,E,T]),(0,y.useLayoutEffect)(()=>()=>Se.current?.(null),[]);let ar=(0,y.useCallback)(()=>{Ie(!0),requestAnimationFrame(()=>x?.querySelector("input")?.focus())},[x]),Ke=(0,y.useRef)(null),de=(0,y.useRef)(!1),ze=(0,y.useCallback)(()=>{Ie(!1),de.current&&(de.current=!1,requestAnimationFrame(()=>Ke.current?.focus()))},[]),or=t===!1?"span":`h${t}`,ir=r.href!==void 0?"a":"button",sr=g=>B=>{!g||!On(B)||(B.preventDefault(),g())},lr=!le,Ge=k&&!E&&$e!==null&&!(xe<0&&k.here)?$e.split(",").map(Number).filter(g=>g<k.places.length):null,ce=k?(0,o.jsx)(qr,{places:k.places,current:k.current,here:k.here,reach:k.reach,scene:lr,stands:Ge}):null,dr=k?k.places.map(g=>g.label).join(`
74
- `):"";(0,y.useLayoutEffect)(I,[I,n,e,dr,k?.current,le,E,w,d]);let cr=w==="icons"||!Xn||E?"icons":"words";return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("header",{ref:se,className:"graview-bar","data-testid":"app-bar","data-graview-app-bar":"",...Jn&&E?{"data-finding":""}:{},children:[(0,o.jsx)("style",{children:Rr}),S,(0,o.jsxs)("div",{className:"graview-bar-row",children:[b?(0,o.jsx)("div",{className:"graview-bar-app",children:(0,o.jsx)(or,{className:"graview-bar-name",children:(0,o.jsxs)(ir,{...r.href!==void 0?{href:r.href,onClick:sr(r.go)}:{type:"button",onClick:r.go},"data-testid":"app-home",...r.current?{"aria-current":"page"}:{},title:u?`${n} \u2014 ${u}`:`${n} \u2014 home`,className:"graview-bar-home",children:[(0,o.jsx)(Be,{brand:e,size:20}),(0,o.jsx)("span",{className:"graview-bar-app-name","data-testid":"app-name",children:n})]})})}):null,i?(0,o.jsx)(Fr,{faces:i,form:w,drawn:cr}):null,(0,o.jsx)("div",{className:"graview-bar-mid",...Ge?{"data-places":"standing"}:!E&&ce?{"data-place":""}:{},children:E?null:ce}),!E&&k&&k.places.length>1?(0,o.jsxs)("span",{className:"graview-bar-ruler","aria-hidden":"true","data-graview-bar-ruler":"",children:[k.places.map(g=>(0,o.jsx)("span",{className:"graview-bar-at",children:g.label},g.key)),(0,o.jsxs)("span",{className:"graview-bar-at",children:[me,(0,o.jsx)(Vn,{})]})]}):null,L&&L.length>0?(0,o.jsx)("span",{className:"graview-bar-ruler","aria-hidden":"true","data-graview-bar-host-ruler":"",children:(0,o.jsx)("span",{className:"graview-bar-host",children:L.map(g=>(0,o.jsxs)("span",{className:"graview-bar-host-action",children:[g.icon?(0,o.jsx)(Dn,{icon:g.icon}):null,(0,o.jsx)("span",{children:g.label})]},g.label))})}):null,b?(0,o.jsx)("span",{className:"graview-bar-ruler","aria-hidden":"true",children:(0,o.jsx)("span",{className:"graview-bar-name",children:n})}):null,(0,o.jsxs)("div",{className:"graview-bar-tools",children:[d?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button",className:"graview-bar-find-open",ref:Ke,"data-testid":"app-find-open","aria-label":"Find",title:"Find",onClick:ar,style:{...X,display:void 0},children:(0,o.jsx)(_r,{})}),(0,o.jsxs)("div",{className:"graview-bar-find","data-testid":"app-find",onBlur:g=>{let B=g.relatedTarget;B instanceof Node&&g.currentTarget.contains(B)||g.currentTarget.querySelector("input")?.value||ze()},onKeyDownCapture:g=>{g.key==="Escape"&&E&&(de.current=!0)},onKeyDown:g=>{g.key!=="Escape"||!E||(!g.defaultPrevented||!g.currentTarget.querySelector("input")?.value?ze():de.current=!1)},children:[(0,o.jsx)("div",{ref:U,className:"graview-bar-find-slot",children:l}),(0,o.jsx)(Ir,{})]})]}):null,(0,o.jsx)("div",{ref:Qn,className:"graview-bar-own","data-graview-bar-own":""}),f?(0,o.jsx)(y.Suspense,{fallback:null,children:(0,o.jsx)(Tr,{scene:!le,compact:E})}):null,(0,o.jsx)(Hr,{}),L&&L.length>0?(0,o.jsx)(zr,{actions:L,folded:E||!rr}):null,c]})]})]}),E&&ce?(0,o.jsx)("div",{className:"graview-bar-line","data-graview-place-line":"","data-testid":"app-place-line",children:ce}):null]})}function Fr({faces:e,form:n,drawn:t}){let r=i=>{let a=e[i];return(0,o.jsxs)("button",{type:"button",className:"graview-bar-face","data-testid":`app-face-${i}`,"aria-pressed":a.current,title:a.label,...a.reach&&!a.current?{onPointerEnter:a.reach,onPointerDown:a.reach,onFocus:a.reach}:{},onClick:()=>{a.current||a.go()},children:[i==="scene"?(0,o.jsx)(Fn,{}):(0,o.jsx)($r,{}),(0,o.jsx)("span",{children:a.label})]})};return(0,o.jsxs)("div",{className:"graview-bar-faces",role:"group","aria-label":`${e.scene.label} or ${e.pages.label}`,"data-testid":"app-faces","data-switch":n,"data-switch-drawn":t,children:[r("scene"),r("pages")]})}function Vr(e){let n=e.querySelector(".graview-bar-faces"),t=e.querySelector(".graview-bar-mid"),r=e.querySelector(".graview-bar-find");if(!n||!t||r?.matches(":focus-within")||e.getBoundingClientRect().width<J)return null;let a=$n(n),s=t.querySelector(".graview-bar-place-words"),p=s?parseFloat(getComputedStyle(s).fontSize)||14:0,c=s?Math.min(s.scrollWidth+34,14*p):0,d=Rn(e);if(d===null)return!1;let u=t.getBoundingClientRect().width-c-d;if(r&&r.getBoundingClientRect().width>0){let l=parseFloat(getComputedStyle(r).flexBasis);isFinite(l)&&(u-=Math.max(0,l-r.getBoundingClientRect().width))}return n.getAttribute("data-switch-drawn")==="icons"?u>=a+2:u>=-1}function Rn(e){let n=e.querySelector(".graview-bar-app"),t=e.querySelector(".graview-bar-ruler>.graview-bar-name");if(!n||!t)return 0;let r=s=>s?.getBoundingClientRect().width??0,i=r(n.firstElementChild)-r(e.querySelector(".graview-bar-app-name"))+r(t)+2,a=parseFloat(getComputedStyle(n).maxWidth)/100*(n.parentElement.clientWidth-2*n.offsetLeft)||1/0;return i>a+.5?null:Math.max(0,i-r(n))}var On=e=>e.button===0&&!(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey);function Dr(){let e=globalThis.navigator?.platform??"";return/Mac|iPhone|iPad|iPod/.test(e)?"\u2318K":"Ctrl K"}function Ir(){let e=Sn(Z()?.aiDesk);return(0,o.jsx)("span",{className:"graview-bar-find-keys","data-testid":"app-find-keys","aria-hidden":"true",children:e?"/":Dr()})}function ee({size:e,box:n=e,children:t}){return(0,o.jsx)("svg",{width:e,height:e,viewBox:`0 0 ${n} ${n}`,"aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto"},children:t})}function Fn(){return(0,o.jsxs)(ee,{size:14,children:[(0,o.jsx)("path",{d:"M7 1.5 L12.5 4.5 L7 7.5 L1.5 4.5 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"}),(0,o.jsx)("path",{d:"M1.5 7.5 L7 10.5 L12.5 7.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round",strokeLinecap:"round"})]})}function $r(){return(0,o.jsxs)(ee,{size:14,children:[(0,o.jsx)("rect",{x:"2.25",y:"1.75",width:"9.5",height:"10.5",rx:"1.5",fill:"none",stroke:"currentColor",strokeWidth:"1.3"}),(0,o.jsx)("path",{d:"M4.5 5 H9.5 M4.5 7.25 H9.5 M4.5 9.5 H7.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]})}function Vn(){return(0,o.jsx)(ee,{size:10,children:(0,o.jsx)("path",{d:"M2 3.5 L5 6.5 L8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}function _r(){return(0,o.jsxs)(ee,{size:16,children:[(0,o.jsx)("circle",{cx:"7",cy:"7",r:"4.75",fill:"none",stroke:"currentColor",strokeWidth:"1.5"}),(0,o.jsx)("path",{d:"M10.5 10.5 L14 14",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function Wr({place:e}){if(e.key===Y)return(0,o.jsx)(Fn,{});if(e.group==="home")return(0,o.jsx)(ee,{size:13,box:14,children:(0,o.jsx)("path",{d:"M2 6.5 L7 2 L12 6.5 V12 H2 Z",fill:"none",stroke:"currentColor",strokeWidth:"1.3",strokeLinejoin:"round"})});let n=e.kind?`hsl(${Math.round(Ze(e.kind))} 55% 52%`:"rgb(128 128 128";return(0,o.jsx)("span",{"aria-hidden":"true",style:{display:"inline-block",width:12,height:8,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)",background:e.group==="lists"?`${n})`:`linear-gradient(${n}), ${n})) center / 6px 4px no-repeat, ${n} / 0.35)`}})}var Kr=[{group:"home"},{group:"lists",heading:"Lists"},{group:"pictures",heading:"Pictures"}],me="More";function zr({actions:e,folded:n}){let t=j("host-actions",{popover:n}),r=e.map(a=>a.label).join(", "),i=a=>e.map(s=>(0,o.jsxs)("button",{type:"button",className:n?"graview-bar-host-action graview-bar-item":"graview-bar-host-action","data-testid":"host-bar-action",onClick:()=>{a(),s.onSelect()},children:[s.icon?(0,o.jsx)(Dn,{icon:s.icon}):null,(0,o.jsx)("span",{children:s.label})]},s.label));return n?(0,o.jsxs)("div",{className:"graview-bar-host",children:[(0,o.jsx)("button",{type:"button",className:"graview-bar-host-action","data-testid":"host-bar-actions-open","data-folded":"",...t.trigger,onClick:t.toggle,"aria-label":`${me} \u2014 ${r}`,title:r,children:(0,o.jsxs)(ee,{size:16,children:[(0,o.jsx)("circle",{cx:"3",cy:"8",r:"1.4",fill:"currentColor"}),(0,o.jsx)("circle",{cx:"8",cy:"8",r:"1.4",fill:"currentColor"}),(0,o.jsx)("circle",{cx:"13",cy:"8",r:"1.4",fill:"currentColor"})]})}),(0,o.jsx)("div",{...t.pane,"data-testid":"host-bar-actions",hidden:!t.open,className:"graview-bar-list",style:q,"aria-label":"From the host",children:i(()=>t.setOpen(!1))})]}):(0,o.jsx)("div",{className:"graview-bar-host","data-testid":"host-bar-actions-standing",role:"group","aria-label":"From the host",children:i(()=>{})})}function Dn({icon:e}){let n=ie($(e)?e:void 0);return n?(0,o.jsx)("span",{className:"graview-bar-host-mark","aria-hidden":"true",dangerouslySetInnerHTML:n}):(0,o.jsx)("span",{className:"graview-bar-host-mark","aria-hidden":"true",children:e})}function In({place:e,current:n,reach:t,standing:r,done:i}){let a=e.key===n,s=t.href?.(e.path);return(0,o.jsxs)(s!==void 0?"a":"button",{className:r?"graview-bar-at":"graview-bar-item","data-testid":`app-place-${e.key}`,"data-place-path":e.path,...a?{"aria-current":"page"}:{},...s!==void 0?{href:s}:{type:"button"},onClick:c=>{i(),t.go&&(s!==void 0&&!On(c)||(c.preventDefault(),t.go(e)))},children:[r?null:(0,o.jsx)("span",{className:"graview-bar-mark",children:(0,o.jsx)(Wr,{place:e})}),r&&a?(0,o.jsx)("span",{"data-testid":"app-place-current",children:e.label}):(0,o.jsx)("span",{children:e.label})]})}function Gr({places:e,current:n,reach:t,id:r,done:i}){return(0,o.jsx)(o.Fragment,{children:Kr.map(({group:a,heading:s})=>{let p=e.filter(d=>d.group===a);if(p.length===0)return null;let c=`${r}-${a}`;return(0,o.jsxs)("div",{role:"group",...s?{"aria-labelledby":c}:{"aria-label":p[0].label},"data-place-group":a,children:[s?(0,o.jsx)("p",{id:c,children:s}):null,(0,o.jsx)("ul",{children:p.map(d=>(0,o.jsx)("li",{children:(0,o.jsx)(In,{place:d,current:n,reach:t,standing:!1,done:i})},d.key))})]},a)})})}function qr({places:e,current:n,here:t,reach:r,scene:i,stands:a}){let s=j("places"),p=(0,y.useRef)(a);s.open||(p.current=a);let c=p.current,u=e.find(b=>b.key===n)?.label??t??"Places",l=c?e.filter((b,L)=>!c.includes(L)):e,m=jr(e,n,i),w=Z(),h=w?.keptViews?.current(),S=!!(h&&(h.removed.length>0||w.views.places().some(b=>b.hidden)||h.may.lenses&&(w.views.arrangement?.()?.hide?.length??0)>0));return(0,o.jsxs)("nav",{className:c?"graview-bar-places":"graview-bar-place-at","aria-label":i?"What the scene shows":"The app\u2019s places",...c?{"data-testid":"app-places-standing"}:{},...m,children:[c?.map(b=>(0,o.jsx)(In,{place:e[b],current:n,reach:r,standing:!0,done:()=>{}},e[b].key)),l.length>0||S?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("button",{type:"button",className:c?"graview-bar-at":"graview-bar-place","data-testid":"app-places-open",...s.trigger,onClick:s.toggle,"aria-label":c?`${me} \u2014 ${l.length} more ${i?"pictures":"places"}`:`${u} \u2014 ${i?"everything the scene shows":"every place"}`,title:c?l.map(b=>b.label).join(", "):u,children:[c?me:(0,o.jsx)("span",{className:"graview-bar-place-words","data-testid":"app-place-current",children:u}),(0,o.jsx)(Vn,{})]}),(0,o.jsxs)("div",{...s.pane,"data-testid":"app-places",hidden:!s.open,className:"graview-bar-list",style:q,children:[(0,o.jsx)(Gr,{places:l,current:n,reach:r,id:s.pane.id,done:()=>s.setOpen(!1)}),S&&s.open?(0,o.jsx)(y.Suspense,{fallback:null,children:(0,o.jsx)(Nr,{id:s.pane.id,scene:i,reach:r,done:()=>s.setOpen(!1)})}):null]})]}):null]})}function jr(e,n,t){let r=Z()?.setMenuAt,i=a=>{let s=a.target.closest?.("[data-place-path],[data-testid=app-places-open]");if(!s||!r)return;let p={at:0};a.type==="pointerdown"?document.addEventListener("pointerup",()=>p.at||=Date.now(),{once:!0}):a.preventDefault();let c=a.nativeEvent;M.load().then(d=>d.placeGesture(c,s,e,n,t,r,p),String)};return{onContextMenu:a=>a.shiftKey||i(a),onKeyDown:a=>(a.key==="ContextMenu"||a.key==="F10"&&a.shiftKey)&&i(a),onPointerDown:a=>a.pointerType!=="mouse"&&a.isPrimary&&i(a)}}function Yr(e,n,t,r){let i=e.querySelector("[data-graview-bar-ruler]"),a=e.querySelector(".graview-bar-mid");if(!i||!a)return null;let s=e.querySelector(".graview-bar-find");if(s?.matches(":focus-within"))return;if(e.getBoundingClientRect().width<J)return null;let p=Rn(e);if(p===null)return null;let c=[...i.children].map(L=>L.getBoundingClientRect().width),d=c.pop()??0,u=e.querySelector(".graview-bar-faces"),l=u&&t?$n(u):0,m=u?.getAttribute("data-switch-drawn")==="words"?l:0,w=a.getBoundingClientRect().left+p,h=s?.getBoundingClientRect(),S=h&&h.width>0?h.right-w-(parseFloat(getComputedStyle(s).minWidth)||0)-16:a.getBoundingClientRect().width-p,b=[...r].map(L=>L!=="0");return Cn({widths:c,current:n,room:Math.floor(S+m-l),more:d,primary:b})?.join(",")??null}function $n(e){return[...e.querySelectorAll(".graview-bar-face span")].reduce((n,t)=>n+t.scrollWidth+10,0)}var Ur=e=>`graview:lenses:${e}`,Qr=(e,n)=>e?.name??n.kinds.join(",");function Re(e){try{let n=JSON.parse(localStorage.getItem(Ur(e))??"[]");return Array.isArray(n)?n.filter(t=>typeof t?.title=="string"&&typeof t.lens=="string"):[]}catch{return[]}}var K=v(R(),1);var N=v(P(),1);function Zr({scheme:e,onScheme:n,profileHref:t,keeping:r,hostActions:i=Jr,signature:a=!1}){let{store:s,principal:p,seats:c,people:d}=ue(),u=j("profile"),l=u.open,[m,w]=(0,K.useState)(!1);(0,K.useEffect)(()=>nt(ye),[]),l&&!m&&w(!0),(0,K.useEffect)(()=>{l&&ye()},[l]);let h=p.id===void 0?void 0:s.graph.getNode(p.id),S=h===void 0?p.id===void 0?"Nobody in particular":Ue(p,{graph:s.graph,schema:s.schema,seats:c,people:d}):qe(s.schema.tryDefinition(h.kind),h);return(0,N.jsxs)("div",{style:{position:"relative"},children:[(0,N.jsx)("button",{type:"button","data-testid":"profile-button",...u.trigger,onClick:u.toggle,onPointerEnter:ye,onFocus:ye,"aria-label":`${S} \u2014 you, your seat and your settings`,title:`${S} \u2014 you, your seat and your settings`,style:{...X,borderRadius:999},children:(0,N.jsx)("span",{"aria-hidden":"true","data-testid":"profile-mark",style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:W-4,height:W-4,borderRadius:999,fontSize:"0.8125rem",fontWeight:600,background:"var(--graview-panel-muted)",color:"var(--graview-ink)",border:"1px solid var(--graview-edge)"},children:rt(S)})}),(0,N.jsxs)("section",{...u.pane,"aria-label":"Profile","data-testid":"profile","data-graview-offstage":"",hidden:!l,style:{...q,width:280,maxWidth:"calc(100vw - 32px)",maxHeight:"min(62cqh, 520px)",overflowY:"auto",overflowX:"hidden",display:l?"grid":"none",gap:12,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[m?(0,N.jsx)(K.Suspense,{fallback:null,children:(0,N.jsx)(Xr,{part:"top",name:S,me:h,profileHref:t,hostActions:i,close:()=>u.setOpen(!1)})}):null,(0,N.jsxs)("div",{className:"graview-profile-keeping","data-testid":"profile-keeping",style:at,children:[(0,N.jsx)("span",{style:tt,children:"Keeping this app"}),r]}),m?(0,N.jsx)(K.Suspense,{fallback:null,children:(0,N.jsx)(et,{part:"rest",name:S,me:h,scheme:e,onScheme:n,hostActions:i,signature:a,close:()=>u.setOpen(!1)})}):null]})]})}var Jr=[],ye=()=>M.prefetch(),Xr=M.part((e,n)=>(0,N.jsx)(e.ProfilePane,{...n}),{what:"The rest of your menu"}),et=M.part((e,n)=>(0,N.jsx)(e.ProfilePane,{...n}),{quiet:!0});function nt(e){let n=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&e()},t=globalThis;if(t.requestIdleCallback){let i=t.requestIdleCallback(n,{timeout:5e3});return()=>t.cancelIdleCallback?.(i)}let r=setTimeout(n,2500);return()=>clearTimeout(r)}function rt(e){return(e.trim()[0]??"?").toUpperCase()}var tt={fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},at={paddingTop:10,borderTop:"1px solid var(--graview-edge)"};function ot(e){return!(e==="hidden"||e===!1)}var Oe=v(R(),1);var _n="The whole thing",we=e=>`scene:${e.kind}:${e.as}`;function Wn(e){let{view:n}=e,t=e.places.filter(l=>!e.hidden.has(l.kind)),r=ae(t),i=(l,m)=>{if(l===Y)return un(fn(m,!0),"view",null);let w=r.find(h=>we(h)===l);return w?mn(m,w.over?.find(h=>m.focusId===oe(h))??w.kind,w.as):null},a=n.within?.view,s=l=>n.focusId===oe(l.kind)&&(a===void 0?t.filter(m=>m.kind===l.kind).at(-1)===l:a===l.as),p=t.find(l=>s(l)&&(a!==void 0||!n.overview)),c=p?r.find(l=>pe(l,p)):void 0,d=r.filter(l=>!l.hidden||l===c);return{places:[{key:Y,label:_n,path:`${Ee}${Ne(i(Y,Ae))}`,group:"home"},...d.map(l=>({key:we(l),label:Q(l,t,e.schema),path:`${Ee}${Ne(i(we(l),Ae))}`,group:"pictures",kind:l.kind,hidden:l.hidden}))],current:c?we(c):Y,to:i}}function it(){let{store:e,views:n,hiddenKinds:t}=ue(),{view:r,go:i}=bn(),a=n.places(),s=(0,Oe.useMemo)(()=>Wn({places:a,hidden:t,view:r,schema:e.schema}),[a,t,r,e.schema]),p=(0,Oe.useMemo)(()=>({go:c=>{let d=s.to(c.key,r);d&&i(d)}}),[s,r,i]);return{places:s.places,current:s.current,reach:p}}var ne=v(R(),1);var F=v(P(),1),st=M.part((e,n)=>(0,F.jsx)(e.ProblemRows,{...n}),{what:"The problems",as:"li"}),Fe=()=>M.prefetch();function lt({clean:e="All rules hold"}){let n=vn(),{set:t}=hn(),r=n.length,[i,a]=(0,ne.useState)(!1),s=j("problems",{open:i&&r>0,onOpenChange:a}),p=s.open,c=zn(n,e);return(0,ne.useEffect)(()=>{if(r===0)return;let d=setTimeout(Fe,1500);return()=>clearTimeout(d)},[r>0]),(0,F.jsxs)("div",{style:{position:"relative",display:"inline-flex"},children:[(0,F.jsxs)("button",{type:"button","data-testid":"standing",...s.trigger,"aria-disabled":r===0?!0:void 0,"aria-label":c,onClick:r===0?void 0:s.toggle,onPointerEnter:r===0?void 0:Fe,onFocus:r===0?void 0:Fe,title:c,style:{...X,padding:r===0?0:"0 8px",cursor:r===0?"default":"pointer",color:r===0?"var(--graview-ink-muted)":Kn(n),fontVariantNumeric:"tabular-nums",fontWeight:600},children:[(0,F.jsx)(Gn,{tone:r===0?"var(--graview-good)":Kn(n)}),r>0?(0,F.jsx)("span",{"aria-hidden":"true",children:r}):null]}),p?(0,F.jsx)("ol",{...s.pane,"data-testid":"problems",style:{...q,width:300,maxHeight:"min(48cqh, 420px)",overflow:"auto",margin:0,padding:4,listStyle:"none",display:"grid",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:(0,F.jsx)(ne.Suspense,{fallback:null,children:(0,F.jsx)(st,{violations:n,pick:d=>{t(d.nodeIds),s.setOpen(!1)}})})}):null]})}function zn(e,n){return e.length===0?n:`${Qe(e)} \u2014 open what is broken, and what would fix it`}var Kn=e=>e.some(n=>n.status==="could-not-judge"||n.status==="over-budget")?"var(--graview-bad)":"var(--graview-warn)";function Gn({tone:e}){return(0,F.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:999,flex:"0 0 auto",background:e}})}function dt(e,n,t=[]){if(e.focusId)return e.focusId;let i=(e.selection??[]).map(gn).find(a=>a!==null)??t.find(a=>n.includes(a))??n[0]??null;return i===null?null:oe(i)}var ve=v(P(),1),he=O(C(()=>(__graviewPreload(import.meta.url,["./chunk.I77ZGIFE.js","./chunk.OWOOKLIU.js","./chunk.RD2X25XB.js","./chunk.KMV6PJFL.js","./chunk.A3ZC2JBO.js","./chunk.NAD7ZXYP.js","./chunk.2GEJNG2U.js","./chunk.UQQKDBIH.js","./chunk.AJSUHPBE.js","./chunk.LAYQ5PFS.js","./chunk.KDXU5DT3.js","./chunk.O2BHPYA4.js","./chunk.WVUJXDXZ.js","./chunk.SGCW2XRC.js","./chunk.ZN3PUM2I.js","./chunk.QIPASE42.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.GZHZLJBF.js","./chunk.UKQUUPKE.js","./chunk.OJGHDWI6.js","./chunk.DDUCIUVW.js","./chunk.NUYA4BWI.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.HANJZ6FA.js"))));function ct(){return he.load().then(()=>{})}var pt=[{cardinality:"one",fidelity:"full",slot:"page"},{cardinality:"one",fidelity:"summary",slot:"card"},{cardinality:"one",fidelity:"glyph",slot:"row"},{cardinality:"many",fidelity:"full"},{cardinality:"many",fidelity:"summary"},{cardinality:"many",fidelity:"glyph"}];function ut({schema:e,specs:n,kind:t,view:r}){let i=he.current.frameworkViews(e,n).lookup(t,{cardinality:r.cardinality,fidelity:r.fidelity});return i?(0,ve.jsx)(i,{...r}):null}var ft=he.part((e,n)=>(0,ve.jsx)(ut,{...n}),{what:"This view"});function qn(e,n,t){for(let r of n.kinds){let i=t?.[r];for(let a of pt){let s=c=>(0,ve.jsx)(ft,{schema:n,specs:t,kind:r,view:c}),p=a.slot!==void 0&&i?.[a.slot]!==void 0;p&&(s.says=(c,d)=>he.current?.frameworkViews(n,t).lookup(r,{cardinality:a.cardinality,fidelity:a.fidelity})?.says?.(c,d)),e.register(r,{cardinality:a.cardinality,fidelity:a.fidelity},p?s:yn(s))}}return e}function gt(e,n){return qn(wn(e),e,n)}var Ve=v(R(),1);var D=v(P(),1),jn=O(C(()=>(__graviewPreload(import.meta.url,["./chunk.UFDJXQQQ.js","./chunk.ELTV44HU.js","./chunk.CY3ELWCM.js","./chunk.RMR24LFJ.js","./chunk.I77ZGIFE.js","./chunk.OWOOKLIU.js","./chunk.RD2X25XB.js","./chunk.KMV6PJFL.js","./chunk.SWMDFXUX.js","./chunk.A3ZC2JBO.js","./chunk.NAD7ZXYP.js","./chunk.2GEJNG2U.js","./chunk.HJCQ6I3S.js","./chunk.22BZU7ME.js","./chunk.2N4Z5K5S.js","./chunk.JYFZCJ4N.js","./chunk.UQQKDBIH.js","./chunk.AJSUHPBE.js","./chunk.LAYQ5PFS.js","./chunk.KDXU5DT3.js","./chunk.O2BHPYA4.js","./chunk.M4AYA2PL.js","./chunk.H5S7OL2U.js","./chunk.PZQNR4KZ.js","./chunk.W4BKYSZX.js","./chunk.Y2YYH3JN.js","./chunk.NOGGSLVG.js","./chunk.WVUJXDXZ.js","./chunk.SGCW2XRC.js","./chunk.ZN3PUM2I.js","./chunk.QIPASE42.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.GZHZLJBF.js","./chunk.UKQUUPKE.js","./chunk.OJGHDWI6.js","./chunk.DDUCIUVW.js","./chunk.NUYA4BWI.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KL7E4YHJ.js"))));function mt({lens:e,view:n}){let t=jn.current.declaredLensView(e);return(0,D.jsx)(t,{...n})}var yt=jn.part((e,n)=>(0,D.jsx)(mt,{...n}),{what:"This picture"});function wt(e){let n=r=>(0,D.jsx)(Ve.Suspense,{fallback:null,children:(0,D.jsx)(yt,{lens:e,view:r})});e.lens==="blocks"&&(n.flows=!0);let t=e.lens==="blocks"?e.options.blocks?.[0]:void 0;return typeof t?.headline=="string"&&(n.lede=t),e.create===!1&&(n.creates=!1),n}var Yn=O(C(()=>(__graviewPreload(import.meta.url,["./chunk.I77ZGIFE.js","./chunk.OWOOKLIU.js","./chunk.RD2X25XB.js","./chunk.KMV6PJFL.js","./chunk.A3ZC2JBO.js","./chunk.NAD7ZXYP.js","./chunk.2GEJNG2U.js","./chunk.UQQKDBIH.js","./chunk.AJSUHPBE.js","./chunk.LAYQ5PFS.js","./chunk.KDXU5DT3.js","./chunk.O2BHPYA4.js","./chunk.WVUJXDXZ.js","./chunk.SGCW2XRC.js","./chunk.ZN3PUM2I.js","./chunk.QIPASE42.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.GZHZLJBF.js","./chunk.UKQUUPKE.js","./chunk.OJGHDWI6.js","./chunk.DDUCIUVW.js","./chunk.NUYA4BWI.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.7YOAW7ED.js"))));function ht({blocks:e,view:n}){let t=Yn.current.homeView(e);return(0,D.jsx)(t,{...n})}var vt=Yn.part((e,n)=>(0,D.jsx)(ht,{...n}),{what:"The home"});function bt(e){let n=t=>(0,D.jsx)(Ve.Suspense,{fallback:null,children:(0,D.jsx)(vt,{blocks:e,view:t})});return Object.defineProperty(n,Symbol.for("graview.home-blocks"),{value:!0}),n}function kt(e,n){return n.home&&n.home.length>0&&e.home?.(bt(n.home)),Un(e,n),e.arrange?.(n.pages),e}function Un(e,n,t){for(let r of on(n).drawn){if(t&&e.places().some(s=>s.title===r.title))continue;let i=wt(r),a={title:r.title,lens:r.lens,...r.across?{across:r.across}:{},...t?{beside:t}:{},...r.hidden?{hidden:!0}:{},over:r.kinds,...t?{}:{declared:!0}};for(let s of r.kinds)e.register(s,{cardinality:"many",fidelity:"full"},i,a),e.register(s,{cardinality:"many",fidelity:"summary"},i,a)}}function xt(e,n,t){t.length>0&&Un(e,{schema:n,lenses:t.map(({lens:r,...i})=>({...i,name:r}))},!0)}function St(e,n,t){xt(e,n,Re(t))}var z=v(R(),1),be=v(P(),1);var De=e=>`graview:first-look:${e}`;function Pt(e,n){if(e.seen!==void 0)try{return typeof e.seen=="function"?e.seen():e.seen}catch{return!0}try{return window.localStorage.getItem(De(n))!==null}catch{return!1}}function Lt(e,n){if(e.seen===void 0)try{window.localStorage.setItem(De(n),"seen")}catch{}}var Et=O(C(()=>(__graviewPreload(import.meta.url,["./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QGU5QTR6.js")))),At=Et.part((e,n)=>{let t=e.FirstLookHints;return(0,be.jsx)(t,{...n})},{quiet:!0});function Nt({firstLook:e,root:n,app:t}){let r=(0,z.useRef)(null);r.current=e===!0?{}:e||null;let[i,a]=(0,z.useState)(()=>r.current!==null&&typeof window<"u"&&!Pt(r.current,t)),s=(0,z.useCallback)(p=>{if(a(!1),p===null)return;let c=r.current??{};Lt(c,t),c.onDone?.(p)},[t]);return!i||r.current===null?null:(0,be.jsx)(z.Suspense,{fallback:null,children:(0,be.jsx)(At,{root:n,steps:r.current.steps??[],onEnd:s})})}export{fe as a,fr as b,Tt as c,Sn as d,Ht as e,ie as f,Ar as g,yr as h,wr as i,ge as j,hr as k,vr as l,br as m,xr as n,Sr as o,Pr as p,M as q,Br as r,Mr as s,Bn as t,Cr as u,X as v,Or as w,Zr as x,ot as y,it as z,Ur as A,Qr as B,Re as C,lt as D,zn as E,Gn as F,dt as G,kt as H,xt as I,St as J,ct as K,gt as L,Nt as M};
@@ -1 +0,0 @@
1
- import{A as v,B as C,C as S,I as G,n as O}from"./chunk.AI34V6WV.js";import{G as I,ba as m,c as V,j as y,l as p,m as g,n as u,o as D,v as B,z as E}from"./chunk.M7RESZB6.js";import{Kd as P,Ld as k,Nd as R,Od as T,na as M}from"./chunk.DZZL5IDD.js";import{b as A}from"./chunk.AJZBJBMO.js";var W=A(I(),1);function j(e,t){try{t.length===0?localStorage.removeItem(v(e)):localStorage.setItem(v(e),JSON.stringify(t))}catch{}}function F(e,t){j(e,[...S(e).filter(n=>n.title!==t.title),t])}function H(e,t){j(e,S(e).filter(n=>n.title!==t))}function J(e,t){for(let n of e.places().filter(o=>o.title===t))e.forget?.(n.kind,n.as)}var U=e=>e===!0?{written:!0}:typeof e=="object"&&e!==null?{written:e.kept===!0,...e.said?{said:e.said}:{}}:{written:!1},N=e=>({title:e.title,lens:e.lens,on:e.on,...e.bindings?{bindings:e.bindings}:{},...e.options?{options:e.options}:{}});function Z(e,t){let n=o=>t.some(r=>r.title===o||r.as===P(o));if(!n(e))return e;for(let o=2;;o++)if(!n(`${e} ${o}`))return`${e} ${o}`}function ie(e){let{store:t,views:n,brand:o,seatTalk:r,onKeepLens:d}=m(),h=(0,W.useContext)(O),L=C(o,t.schema),b=async f=>{let{edit:i}=f;if(f.written&&d)try{await d({op:"remove-lens",title:i.title,on:i.on})}catch{}H(L,i.title),J(n,i.title),h?.dismiss(`kept:${i.title}`),r.setTurns(l=>[...l.map(s=>s.kept&&s.kept.edit.title===i.title&&!s.kept.taken?{...s,kept:{...s.kept,taken:!0}}:s),{role:"seat",text:`Took \u201C${i.title}\u201D back out of the places.`}]);let a=M(t.schema,i.on);e({to:"kind",kind:i.on,title:a,address:k(t.schema,i.on),said:`Went to ${a}.`})};return{keep:async f=>{let i=Z(f.edit.title,n.places()),a={...f.edit,title:i},l=!1,s;if(d)try{({written:l,said:s}=U(await d(a)))}catch{l=!1}l||F(L,N(a)),G(n,t.schema,[N(a)]);let K=n.places(),c=K.find(w=>w.title===i),x=s??(l?`Kept \u201C${i}\u201D as a lens: it is in the places now.`:d?`Kept \u201C${i}\u201D as your own lens. Ask the owner to keep it for everyone.`:`Kept \u201C${i}\u201D as your own lens.`),$={edit:a,written:l};r.setDraft(null),r.setTurns(w=>[...w,{role:"seat",text:x,kept:$}]),h?.notify({kind:"toast",id:`kept:${i}`,sentence:x,timeout:1e4,action:{label:"Take back",onSelect:()=>void b($)}}),c&&e({to:"picture",kind:c.kind,as:c.as,title:i,address:R(c.as,T(c,K)?k(t.schema,c.kind).slice(1):void 0),said:`Went to ${i}.`})},takeBack:b}}var q=A(I(),1);function _(e,t){switch(t.to){case"place":return{view:V("#")};case"picture":return{view:u(E(p(e,"filter",null),t.kind,t.as),[])};case"kind":{let n=D(g({...y(e,B(t.kind)),relation:null},!1),!0);return{view:u(p(p(n,"view",null),"filter",t.filter??null),[])}}case"record":return{view:u(y(g(p(p(e,"view",null),"filter",null),!1),t.id),[t.id])};case"problems":return{pane:"problems"}}}function z(e){let t=typeof document>"u"?null:document.querySelector('[data-testid="standing"]');t&&t.getAttribute("aria-expanded")==="true"!==e&&t.click()}function ae(){let{setView:e,seatTalk:t}=m();return(0,q.useCallback)(n=>{t.get().draft&&t.setDraft(null),z(n.to==="problems"),n.to!=="problems"&&e(o=>{let r=_(o,n);return"view"in r?r.view:o})},[e,t])}export{ie as a,z as b,ae as c};
@@ -1 +0,0 @@
1
- import{G as l,N as p,U as k,W as y,c}from"./chunk.YP2QSPXU.js";import"./chunk.VIH5AX7S.js";import"./chunk.Q355UPFG.js";import{b as m}from"./chunk.VC3V7HLL.js";import"./chunk.ELTV44HU.js";import"./chunk.CY3ELWCM.js";import"./chunk.I77ZGIFE.js";import"./chunk.OWOOKLIU.js";import"./chunk.RD2X25XB.js";import"./chunk.KMV6PJFL.js";import"./chunk.SWMDFXUX.js";import"./chunk.A3ZC2JBO.js";import"./chunk.NAD7ZXYP.js";import"./chunk.2GEJNG2U.js";import"./chunk.4TX6VCBT.js";import"./chunk.TIALD6SC.js";import"./chunk.66P5IDTH.js";import"./chunk.UQQKDBIH.js";import"./chunk.AJSUHPBE.js";import"./chunk.LAYQ5PFS.js";import"./chunk.KDXU5DT3.js";import"./chunk.O2BHPYA4.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.SGCW2XRC.js";import"./chunk.ZN3PUM2I.js";import"./chunk.QIPASE42.js";import"./chunk.EVBCEEQ4.js";import"./chunk.OWT3VVOT.js";import"./chunk.NHTGAP3G.js";import"./chunk.GZHZLJBF.js";import"./chunk.UKQUUPKE.js";import"./chunk.OJGHDWI6.js";import"./chunk.DDUCIUVW.js";import"./chunk.NUYA4BWI.js";import"./chunk.OKZT2QBM.js";import"./chunk.ACTXR2MI.js";import"./chunk.AI34V6WV.js";import"./chunk.G4ULQK64.js";import{G as S,H as s,I as d,T as f,ca as g}from"./chunk.M7RESZB6.js";import"./chunk.SDO3U72B.js";import"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
@@ -1 +0,0 @@
1
- import{a as Te,c as Ue,d as He,e as ze,f as F,g as ye,i as Ze}from"./chunk.WKI5INH7.js";import{h as We,i as Je,j as Xe}from"./chunk.QIPASE42.js";import{a as re,b as ae,c as X,d as Ye,e as Q,g as se,h as Qe}from"./chunk.OWT3VVOT.js";import{c as Ve,h as y,i as Be,j as me,s as ge}from"./chunk.NHTGAP3G.js";import{A as pe,Ac as Ge,Bc as qe,Fa as Me,Ma as Ie,Na as oe,Oa as fe,b as H,c as U,cc as Ke,dc as ue,e as de,ec as Pe,f as Ne,fc as Le,g as K,gc as Ce,h as v,k as L,l as J,m as _,n as _e,o as Z,p as M,r as $,s as te,t as R,u as A,v as G,w as P,x as n,y as T,z as W}from"./chunk.DZZL5IDD.js";var he=e=>Object.entries(e).map(([o,s])=>[o,Object.keys(oe(s?.edges))]),ke=(e,o)=>Pe(e,he(o));function en(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(o=>Ke(o)),...Le(he(e.kinds))]}var q=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function nn(e){if(!q(e)||!q(e.kinds))return e;let o;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([z,c])=>[z,q(c)&&q(c.edges)?{edges:c.edges}:{}]));o=en({acts:q(e.acts)?e.acts:{},kinds:f})}catch{return e}let s=new Set(o),t=!1,r=f=>{if(typeof f!="string"||s.has(f))return f;let z=Ge(f,o);return z===void 0?f:(t=!0,z)},p=q(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>q(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(r)}:f)}:void 0,u=q(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,z])=>[f,q(z)&&Array.isArray(z.repairs)?{...z,repairs:z.repairs.map(c=>q(c)?{...c,act:r(c.act)}:c)}:z])):void 0;return t?{...e,...p?{policy:p}:{},...u?{rules:u}:{}}:e}function be(e,o){let s=qe(e,en(o));return s&&s!==e?`did you mean "${s}"?`:void 0}var Se="graview-document",ve=1,Oe=256*1024,ee=64*1024,wn=["plain","editorial","shader","ascii"];var $e=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,we=/^[a-z][A-Za-z0-9]*$/,Sn=/^[a-z0-9\u00df-\u00ff'-]+( [a-z0-9\u00df-\u00ff'-]+){0,2}$/,tn=12,vn=new Set(["id","kind"]),On=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,jn=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function xn(){let e=b=>b in Object.prototype,o=W(b=>!e(b),"every object already has this name \u2014 choose another"),s=(b,D)=>[...b===void 0?[]:[Ne(b)],...D===void 0?[]:[de(D)]],t=(b,D)=>v().check(...s(b,D)),r=(b,D,ne)=>M(b).check(...s(D,ne)),p=b=>v().check(K($e,`${b} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=v().check(K(On,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),o),f=v().check(K(we,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),W(b=>!vn.has(b),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),o),z=t(1,500),c=v().check(de(40),K(Sn,'an alias is up to three lower-case words, like "supplier"')),i=t(1,2e3),l=t(1,300),h=$({type:G(jn),required:n(_()),description:n(z),label:n(t(1,60)),aliases:n(r(c,1,tn)),options:n(r(t(1,80),1,100)),multiple:n(_()),optionLabels:n(A(t(1,80),t(1,80))),of:n(G(["string","number","date","image","video","file"])),default:n(Z()),unit:n(t(void 0,12)),format:n(G(["money","percent","duration","markdown"])),min:n(L()),max:n(L()),step:n(L()),renamedFrom:n(v().check(K(we))),repeats:n(_()),collaborative:n(_())}).check(pe((b,D)=>{b.type==="enum"&&!b.options&&D.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),b.type!=="enum"&&b.options&&D.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),b.type!=="enum"&&b.multiple!==void 0&&D.addIssue({code:"custom",message:'"multiple" belongs only on an enum field: a choice that takes several of its options',path:["multiple"]});for(let ne of Object.keys(b.optionLabels??{}))b.options?.includes(ne)||D.addIssue({code:"custom",message:`"${ne}" is labeled, and is none of the field's options`,path:["optionLabels",ne]});b.type!=="list"&&b.of&&D.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),b.repeats&&b.type!=="date"&&b.type!=="datetime"&&D.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),m=v().check(K(new RegExp(`${$e.source}|${Me.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),d=$({to:R([r(m,1),P("*")]),cardinality:n(G(["one","many"])),description:n(z),inverse:n(t(1,80)),appendOnly:n(_()),renamedFrom:n(v()),tidying:n(P("never"))}),a=R([i,$({expr:i,label:n(t(1,60)),description:n(z),format:n(G(["money","percent","duration"])),unit:n(t(1,12)),hidden:n(_())})]),O=$({noun:n(t(1,40)),plural:n(t(1,40)),aliases:n(r(c,1,tn)),description:n(z),fields:A(f,h).check(W(b=>Object.keys(b).length>0,"a kind has at least one field")),label:n(l),describe:n(l),lifecycle:n($({field:f,retired:r(R([v(),L(),_()]),1)})),figure:n(t(void 0,2e4)),glance:n(r(f,1,20)),page:n($({fields:n(r(f,1,40)),groups:n(r($({title:t(1,60),fields:r(f,1,40)}),1,12))})),edges:n(A(u,d)),computed:n(A(v(),a).check(W(b=>Object.keys(b).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:n(A(v(),v())),renamedFrom:n(v().check(K($e))),people:n(_()),archives:n(P(!1)),tidying:n(G(["never","no-links"]))}),k=R([v(),L(),_(),_e(),M(Z()),$({expr:i})]),w=v().check(K(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),j=R([$({create:p("kind"),as:n(v().check(K(we))),set:n(A(f,k))}),$({set:A(f,k),target:n(w)}),$({connect:u,from:w,to:w}),$({sever:u,from:w,to:w}),$({remove:w})]),E=$({title:n(t(1,80)),description:n(z),fromTheOtherEnd:n(t(1,80)),on:n(R([p("kind"),r(p("kind"),1)])),creates:n(p("kind")),sets:n(A(f,k)),writes:n(r(f,1)),connects:n(u),severs:n(u),setsOther:n(A(f,k)),setsLinked:n(A(u,A(f,k))),replaces:n(R([P(!0),r(u,1,10)])),removes:n(P(!0)),args:n(A(f,h)),effects:n(r(j,1,20)),allowedWhen:n(i),refusal:n(l),destructive:n(_())}),S=$({act:p("act"),label:n(t(1,80)),args:n(A(v(),k))}),V=$({every:p("kind"),through:u,via:n(u)}),C=$({title:n(t(1,120)),description:n(z),over:R([P("graph"),p("kind")]),when:n(i),require:n(i),covers:n(V),says:n(l),repairs:n(r(S,void 0,10))}).check(pe((b,D)=>{!b.require&&!b.covers&&D.addIssue({code:"custom",message:'a rule says what must hold in "require", or what each record must be linked to in "covers"',path:["require"]}),b.require&&b.covers&&D.addIssue({code:"custom",message:'a rule is judged by "require" or by "covers", not both',path:["covers"]}),b.covers&&b.over==="graph"&&D.addIssue({code:"custom",message:'a coverage rule is over a kind, whose records it follows through their links; name the kind in "over"',path:["over"]})})),g=$({roles:R([r(p("role"),1),P("*")]),mutations:R([r(p("act"),1),P("*")]),kinds:n(R([M(p("kind")),P("*")])),describe:n(z),self:n(_()),ownEnd:n(_())}),x=n(r(f,1)),N=$({roles:R([r(p("role"),1),P("*")]),kinds:r(p("kind"),1),own:n(_()),via:n(u),fields:x,hide:x}),ie=$({grants:M(g),sees:n(M(N))}),Y=$({accent:n(v().check(K(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),ground:n(R([v().check(K(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"')),$({light:n(v().check(K(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"'))),dark:n(v().check(K(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#101826"')))})])),name:n(t(1,60)),currency:n(v().check(K(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(t(2,35)),timeZone:n(t(1,64)),logo:n(R([t(1,ee),$({src:t(1,ee),alt:n(t(1,120))}),$({light:t(1,ee),dark:n(t(1,ee)),alt:n(t(1,120)),darkFallback:n(P("invert"))})])),favicon:n(R([t(1,ee),$({emoji:v()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(L().check(U(0),H(32))),density:n(L().check(U(.75),H(1.5)))})),accents:n(A(v(),L().check(U(0),H(360)))),scheme:n(G(["light","dark","auto"])),subtitle:n(P(!1)),splash:n($({style:G(wn),image:n(t(1,ee)),title:n(t(1,80)),kicker:n(t(1,80)),shader:n(t(1,40))})),views:n($({css:n(t(1)),motion:n(G(["none","fade"]))}))}),B=A(v(),Z()),Re=R([t(1,120),$({by:t(1,120),direction:n(G(["asc","desc"]))})]),Fe=L().check(J(),U(1),H(9999)),zn=te({create:n(_()),options:n(te({sort:n(Re),columnSort:n(Re),search:n(r(t(1,120),void 0,40)),filters:n(r(t(1,120),void 0,40)),horizon:n(R([L().check(J(),U(1),H(200)),te({years:L().check(J(),U(1),H(200)),title:t(1,80),from:n(Fe),to:n(Fe)})]))}))}),yn=$({card:n(M(Z())),row:n(M(Z())),page:n(M(Z()))}),hn=()=>{let b=n(G(["asc","desc"]));return R([t(1,120),$({by:t(1,120),direction:b,then:n(R([t(1,120),$({by:t(1,120),direction:b})]))})])},kn=()=>R([t(1,120),$({by:t(1,120),order:n(r(t(1,80),void 0,40)),closed:n(r(t(1,80),void 0,40))})]),De=te({order:n(M(v())),hide:n(M(v())),first:n(v()),primary:n(r(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(A(v(),$({filters:n(r(t(1,120),void 0,40)),sort:n(hn()),group:n(kn()),export:n(_())})))}),bn=$({act:p("act"),title:n(t(1,80)),intro:n(z),fields:n(r(f,1,40)),say:n(z),submit:n(t(1,80)),role:n(p("role"))}),$n=$({$schema:n(v()),format:P(Se),formatVersion:P(ve),name:t(1,80),description:n(z),version:n(L().check(J(),U(1))),kinds:A(p("kind"),O).check(W(b=>Object.keys(b).length>0,"a document declares at least one kind"),W(b=>Object.keys(b).length<=40,"a document declares at most 40 kinds")),computed:n(A(v(),a)),acts:n(A(p("act"),E)),rules:n(A(p("rule"),C)),roles:n(M(p("role"))),policy:n(ie),modules:n(B),lenses:n(M(zn)),pages:n(De),views:n(A(v(),R([yn,M(Z())]))),brand:n(Y),settings:n(M(B)),migrations:n(M(B)),connections:n(A(p("connection"),B)),purpose:n(B),forms:n(A(p("form"),bn)),publishing:n($({mode:G(["live","on-publish"]),working:r(p("role"),void 0,40),publishers:n(r(p("role"),1,40))})),tidying:n($({autoAcceptAt:n(L().check(J(),U(1),H(1e4)))}))});return{FieldSpec:h,EdgeSpec:d,ComputedSpec:a,KindSpec:O,ValueSpec:k,EffectSpec:j,ActSpec:E,RepairSpec:S,CoverSpec:V,RuleSpec:C,GrantSpec:g,SightSpec:N,PolicySpec:ie,BrandSpec:Y,PagesSpec:De,DocumentSpec:$n}}var An,I=()=>An??=xn(),Yn=T(()=>I().FieldSpec),Wn=T(()=>I().EdgeSpec),Jn=T(()=>I().ComputedSpec),Xn=T(()=>I().KindSpec),Qn=T(()=>I().ValueSpec),et=T(()=>I().EffectSpec),nt=T(()=>I().ActSpec),tt=T(()=>I().RepairSpec),ot=T(()=>I().CoverSpec),st=T(()=>I().RuleSpec),it=T(()=>I().GrantSpec),rt=T(()=>I().SightSpec),at=T(()=>I().PolicySpec),ct=T(()=>I().BrandSpec),lt=T(()=>I().PagesSpec),on=T(()=>I().DocumentSpec);var En={};function sn(e,o=En,s=ve){let{document:t,respelled:r}=Te(e),p=r.length>0?{respelled:r}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==Se||typeof u.formatVersion!="number"||u.formatVersion>=s)return{document:t,...p};let f=u.formatVersion,z=structuredClone(u);for(let c=f;c<s;c++){let i=o[c];if(!i)throw new Error(`there is no upgrade from format ${c} to ${c+1}`);z={...i(z),formatVersion:c+1}}return{document:z,from:f,...p}}function je(e,o,s){let t=Object.keys(e).filter(f=>e[f].edges?.[o]!==void 0);if(t.length===0)return;let r=t.map(f=>e[f].edges[o].to),p=r.some(f=>f==="*")?"*":[...new Set(r.flatMap(f=>f))];if(s.length===0||s.some(f=>t.includes(f)))return{reversed:!1,kinds:p};let u=t.filter(f=>{let z=e[f].edges[o].to;return z==="*"||s.every(c=>z.includes(c))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:p}}var cn=(e,o)=>{let s=e?.fields[o];return s!==void 0&&(s.type==="duration"||(s.type==="number"||s.type==="integer")&&s.format==="duration")};function rn(e,o,s,t){if(t==="out"){let r=e[o]?.edges?.[s]?.to;return r===void 0?[]:r==="*"?Object.keys(e):r}return Object.entries(e).filter(([,r])=>{let p=r.edges?.[s]?.to;return p!==void 0&&(p==="*"||p.includes(o))}).map(([r])=>r)}function xe(e,o,s){if(s.t==="ident")return e[o]?.edges?.[s.name]?rn(e,o,s.name,"out"):void 0;if(s.t==="where")return xe(e,o,s.set);if(s.t==="call"&&(s.fn==="out"||s.fn==="in")&&s.args[0]?.t==="lit"&&typeof s.args[0].value=="string")return rn(e,o,s.args[0].value,s.fn)}var an=(e,o,s)=>{let t=o.filter(r=>e[r]?.fields[s]!==void 0);return t.length>0&&t.every(r=>cn(e[r],s))};function ln(e,o,s){let t=e.kinds,r=t[o],p=new Map(s),u=new Map,f=(c,i)=>{if(i>8)return!1;switch(c.t){case"ident":return cn(r,c.name)||z(c.name,i+1);case"member":{let l=xe(t,o,c.object);return l!==void 0&&an(t,l,c.name)}case"call":{if(c.fn!=="sum"&&c.fn!=="min"&&c.fn!=="max")return!1;let[l,h]=c.args,m=l&&xe(t,o,l);return m!==void 0&&h?.t==="ident"&&an(t,m,h.name)}case"binary":return(c.op==="+"||c.op==="-")&&f(c.left,i)&&f(c.right,i);case"unary":return c.op==="-"&&f(c.operand,i);default:return!1}},z=(c,i)=>{if(r?.computed?.[c]===void 0)return!1;if(u.has(c))return u.get(c);u.set(c,!1);let l=p.get(c),h=l!==void 0&&f(l,i);return u.set(c,h),h};return s.map(([c])=>c).filter(c=>z(c,0))}var Rn="several choices";var Fn={title:["string","text"],rich_text:["string","text"],number:["number","integer"],select:["enum","string"],status:["enum","string"],multi_select:["list",Rn],date:["date","datetime"],checkbox:["boolean"],url:["url","string"],email:["email","string"],phone_number:["phone","string"],people:["string","text","list"]};var dn=new Set(Object.values(Fn).flat());function pn(e,o){let s=new Map;if(!e||typeof e!="object")return new Map;for(let t of Object.values(e)){if(!t||typeof t!="object"||typeof t.kind!="string")continue;let r=o[t.kind]?.fields;if(!r)continue;let p=[];t.system==="google-calendar"&&t.fields&&typeof t.fields=="object"?p=Object.values(t.fields).filter(f=>typeof f=="string"):t.system==="notion"&&(p=t.properties&&typeof t.properties=="object"?Object.keys(t.properties):Object.keys(r).filter(f=>dn.has(r[f].type)));let u=s.get(t.kind)??new Set;for(let f of p)Object.hasOwn(r,f)&&u.add(f);s.set(t.kind,u)}return new Map([...s].filter(([,t])=>t.size>0).map(([t,r])=>[t,Object.keys(o[t].fields).filter(p=>r.has(p))]))}function fn(e,o,s=`kinds.${e}.page`){let t=o.page;if(!t)return[];let r=[],p=[...Object.keys(o.fields),...Object.keys(o.computed??{})],u=new Set,f=(c,i)=>{p.includes(c)?u.has(c)&&r.push(y("page-field-twice",i,`"${c}" is on ${e}'s page twice; name each field once`)):r.push(y("page-field",i,`${e}'s page is to show "${c}", and ${e} has no field or computed field called that`,`use one of: ${p.join(", ")}`)),u.add(c)};(t.fields??[]).forEach((c,i)=>f(c,`${s}.fields.${i}`));let z=new Set;return(t.groups??[]).forEach((c,i)=>{let l=c.title.trim().toLowerCase();z.has(l)&&r.push(y("page-group-twice",`${s}.groups.${i}.title`,`${e}'s page has two groups called "${c.title}"; give each its own title`)),z.add(l),c.fields.forEach((h,m)=>f(h,`${s}.groups.${i}.fields.${m}`))}),r}function un(e,o=[]){return Ce({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(s=>s.fields)],must:s=>!!e.fields[s].required&&e.fields[s].default===void 0,naming:o})}var Dn=new Set(["subject","now","today","me"]);function Tn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>Oe)return{findings:[y("too-large","",`a document may be at most ${Oe/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[y("not-json","",`this is not JSON: ${t.message}`)]}}try{e=sn(e).document}catch(t){return{findings:[y("format","formatVersion",t.message)]}}e=nn(e);let o=on.safeParse(e);if(!o.success)return{findings:o.error.issues.map(t=>{let r=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return y("unknown-key",r,`${t.keys.map(p=>`"${p}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(r))return y("effect-shape",r,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let p=t.issues?.[0]?.message;return y("shape",r,`the name "${String(t.path.at(-1))}" is not allowed here${p?`: ${p}`:""}`)}return y("shape",r,t.message)})};let s=o.data;return{document:s,findings:Nn(s)}}var le=e=>[e??[]].flat();function mn(e){let o=new Map;for(let[s,t]of Object.entries(e.kinds))for(let[r,p]of Object.entries(oe(t.edges))){let u=o.get(r);o.set(r,{name:r,from:[...u?.from??[],s],to:p.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...p.to])],cardinality:p.cardinality??"many"})}return o}function Vt(e){let o=new Map;for(let[t,r]of Object.entries(e.kinds)){let p=se(r),u=fe(r.edges);o.set(t,{fields:new Set([...Object.keys(r.fields),...u.keys()]),edges:new Map(Object.entries(oe(r.edges)).map(([f,z])=>[f,z.cardinality??"many"])),...p?{computed:p}:{},...u.size>0?{linked:u}:{}})}let s=se(e);return s&&o.set(Ve,{computed:s}),o}function gn(e,o){let s=[],t=le(e.on),r=(p,u)=>{let f=je(o.kinds,p,t)?.reversed===!0,[z,c]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:p,from:z,to:c}:{sever:p,from:z,to:c}};if(e.creates){let p=o.kinds[e.creates],u={};for(let f of Object.keys(p?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&F(f.target)==="new"&&Object.assign(u,f.set);s.push({create:e.creates,as:"new",set:u})}if(e.sets&&s.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&s.push({set:Object.fromEntries(e.writes.map(p=>[p,`$${p}`]))}),e.connects&&(e.replaces&&s.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),s.push(r(e.connects,"connect"))),e.severs&&s.push(r(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&s.push({set:e.setsOther,target:"$to"}),e.setsLinked&&t.length>0)for(let[p,u]of Object.entries(e.setsLinked))s.push({set:u,through:p});return e.removes&&s.push({remove:"$subject"}),e.effects&&s.push(...e.effects.filter(p=>!(e.creates&&"set"in p&&!("create"in p)&&F(p.target)==="new"))),s}function Ae(e,o,s){try{let t=X(e),r=re(t);for(let p of r.unknownFunctions)s.push(y("unknown-function",o,`"${p}" is not a function the rule language knows`,"see the rule language in the graview-invariant skill"));return t}catch(t){if(t instanceof ae){s.push(y("expression",o,t.sentence+` (at character ${t.at+1})`));return}throw t}}function Ee(e,o,s){try{return Q(e)}catch(t){if(t instanceof Ye||t instanceof ae){s.push(y("template",o,(t instanceof ae,t.sentence)));return}throw t}}function Nn(e){let o=[],s=new Set(Object.keys(e.kinds)),t=mn(e),r=e.acts??{},p=new Set(e.roles??[]),u=(c,i)=>fe(e.kinds[c]?.edges).has(i),f=c=>Object.keys(e.kinds).some(i=>u(i,c));for(let[c,i]of Object.entries(e.kinds)){let l=`kinds.${c}`;for(let[m,d]of Object.entries(i.edges??{})){if(!Ie(d)&&d.to!=="*")for(let a of d.to)s.has(a)||o.push(y("edge-target",`${l}.edges.${m}.to`,`"${a}" is not a kind this document declares`));i.fields[m]&&o.push(y("edge-field-clash",`${l}.edges.${m}`,`"${m}" is both a field and a relation of ${c}`,"rename one of them"))}i.lifecycle&&!i.fields[i.lifecycle.field]&&o.push(y("lifecycle-field",`${l}.lifecycle.field`,`${c} has no field "${i.lifecycle.field}"`));let h=m=>i.computed!==void 0&&Object.hasOwn(i.computed,m);for(let m of i.glance??[])!i.fields[m]&&!h(m)&&o.push(y("glance-field",`${l}.glance`,`a glance at ${c} is to say "${m}", and ${c} has no field or computed field called that`,`use one of: ${[...Object.keys(i.fields),...Object.keys(i.computed??{})].join(", ")}`));o.push(...fn(c,i));for(let m of["label","describe"]){let d=i[m];if(!d)continue;let a=Ee(d,`${l}.${m}`,o);for(let O of a??[])if(O.expr){for(let k of re(O.expr).names)if(!i.fields[k]){if(h(k)){Qe(i,k)||o.push(y("template-field",`${l}.${m}`,`${c}'s ${k} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${c}'s own fields`));continue}o.push(y("template-field",`${l}.${m}`,`${c} has no field "${k}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,d]of Object.entries(i.fields)){if(d.default!==void 0&&d.type==="enum"){let k=(d.multiple?Array.isArray(d.default)?d.default:[d.default]:[d.default]).find(w=>!d.options?.includes(String(w)));(k!==void 0||!d.multiple&&Array.isArray(d.default))&&o.push(y("default-option",`${l}.fields.${m}.default`,`"${String(k??d.default)}" is not one of ${m}'s options`))}let a=`${m}Repeat`;d.repeats&&(i.fields[a]||i.edges?.[a]||i.computed?.[a])&&o.push(y("repeat-clash",`${l}.fields.${m}.repeats`,`${c} already has "${a}", where how ${m} repeats is kept`))}}for(let[c,i]of Object.entries(r)){let l=`acts.${c}`;for(let a of le(i.on))s.has(a)||o.push(y("act-kind",`${l}.on`,`"${a}" is not a kind this document declares`));let h=le(i.on),m=gn(i,e);if(i.creates&&i.on===void 0&&i.writes&&s.has(i.creates)){for(let a of i.writes)if(!e.kinds[i.creates].fields[a])if(e.kinds[i.creates].computed?.[a]!==void 0)o.push(y("computed-written",`${l}.writes`,`${i.creates}'s ${a} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(i.creates,a))continue;o.push(y("act-field",`${l}.writes`,`${i.creates} has no field "${a}"`))}}m.length===0&&o.push(y("act-empty",l,`"${c}" does nothing`,"give it effects or a shorthand such as sets or creates"));let d=new Map;m.forEach((a,O)=>{let k=m.length-(i.effects?.length??0),w=i.effects&&O>=k?`${l}.effects.${O-k}`:l;if("create"in a){if(!s.has(a.create))o.push(y("act-kind",`${w}.create`,`"${a.create}" is not a kind this document declares`));else for(let S of Object.keys(a.set??{}))e.kinds[a.create].fields[S]||(e.kinds[a.create].computed?.[S]!==void 0?o.push(y("computed-written",`${w}.set.${S}`,`${a.create}'s ${S} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):o.push(y("act-field",`${w}.set.${S}`,`${a.create} has no field "${S}"`)));a.as&&d.set(a.as,a.create)}else if("connect"in a||"sever"in a){let S="connect"in a?a.connect:a.sever;!t.has(S)&&!f(S)&&o.push(y("act-edge",`${w}.${"connect"in a?"connect":"sever"}`,`"${S}" is not a relation any kind declares`)),F(a.from)==="subject"&&h.length===0&&o.push(y("act-subject",`${l}.on`,`"${c}" acts on "$subject" but does not say which kinds it is "on"`))}else if(!("through"in a))if("set"in a){let S=F(a.target??"$subject"),V=S==="subject"?h:d.has(S??"")?[d.get(S)]:[];S==="subject"&&h.length===0&&o.push(y("act-subject",`${l}.on`,`"${c}" changes "$subject" but does not say which kinds it is "on"`));for(let C of Object.keys(a.set))for(let g of V)if(!(!s.has(g)||e.kinds[g].fields[C]))if(e.kinds[g].computed?.[C]!==void 0)o.push(y("computed-written",`${w}.set.${C}`,`${g}'s ${C} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(g,C))continue;o.push(y("act-field",`${w}.set.${C}`,`${g} has no field "${C}"`))}}else"remove"in a&&F(a.remove)==="subject"&&h.length===0&&o.push(y("act-subject",`${l}.on`,`"${c}" removes "$subject" but does not say which kinds it is "on"`));let j="set"in a&&a.set?Object.values(a.set):[],E="through"in a?`${l}.setsLinked.${a.through}`:`${w}.set`;j.forEach(S=>{S&&typeof S=="object"&&!Array.isArray(S)&&"expr"in S&&Ae(S.expr,E,o)})}),i.allowedWhen&&Ae(i.allowedWhen,`${l}.allowedWhen`,o),i.refusal&&Ee(i.refusal,`${l}.refusal`,o)}for(let[c,i]of Object.entries(e.rules??{})){let l=`rules.${c}`;i.over!=="graph"&&!s.has(i.over)&&o.push(y("rule-kind",`${l}.over`,`"${i.over}" is not a kind this document declares`));let h=i.over==="graph"?void 0:e.kinds[i.over];if(i.covers&&h){let m=ge(i.over,i.covers,d=>t.get(d),d=>s.has(d));if("problem"in m){let{key:d,message:a,fix:O}=m.problem;d==="every"?o.push(y("rule-kind",`${l}.covers.every`,a,O)):o.push(y("rule-covers-relation",`${l}.covers.${d}`,a,O))}}for(let m of["when","require"]){let d=i[m];if(!d)continue;let a=Ae(d,`${l}.${m}`,o);if(!a)continue;let O=re(a);for(let k of O.names)if(i.over==="graph")o.push(y("rule-name",`${l}.${m}`,`"${k}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(h&&!h.fields[k]&&!h.edges?.[k]&&h.computed?.[k]===void 0){let w=Object.keys(h.edges??{}).find(j=>j.includes("-")&&j.split("-").includes(k));o.push(y("rule-name",`${l}.${m}`,`${i.over} has no field or relation called "${k}"`,w?`"${w}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${w.replace(/-([a-z0-9])/g,(j,E)=>E.toUpperCase())}"`:void 0))}for(let k of O.edges)!t.has(k)&&!f(k)&&o.push(y("rule-edge",`${l}.${m}`,`"${k}" is not a relation any kind declares`));for(let k of O.sweeps)s.has(k)?i.over!=="graph"&&o.push(Be("rule-cost",`${l}.${m}`,`this rule looks at every ${k} for every ${i.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):o.push(y("rule-kind",`${l}.${m}`,`"${k}" is not a kind this document declares`))}i.says&&Ee(i.says,`${l}.says`,o),(i.repairs??[]).forEach((m,d)=>{!r[m.act]&&!ue(m.act)&&!ke(m.act,e.kinds)&&o.push(y("repair-act",`${l}.repairs.${d}.act`,`"${m.act}" is not an act this document declares`,be(m.act,e)))})}let z=e.policy;return z&&(z.grants.forEach((c,i)=>{if(c.roles!=="*"&&p.size>0)for(let l of c.roles)p.has(l)||o.push(y("grant-role",`policy.grants.${i}.roles`,`"${l}" is not one of the document's roles`));if(c.mutations!=="*")for(let l of c.mutations)!r[l]&&!ue(l)&&!ke(l,e.kinds)&&o.push(y("grant-act",`policy.grants.${i}.mutations`,`"${l}" is not an act this document declares`,be(l,e)))}),(z.sees??[]).forEach((c,i)=>{for(let l of c.kinds)s.has(l)||o.push(y("sight-kind",`policy.sees.${i}.kinds`,`"${l}" is not a kind this document declares`));if(c.roles!=="*"&&p.size>0)for(let l of c.roles)p.has(l)||o.push(y("sight-role",`policy.sees.${i}.roles`,`"${l}" is not one of the document's roles`))})),o.push(...Xe(e)),o}function _n(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(o=>o[1]):[ye(e)??[]].flat()}function Mn(e,o,s,t){let r=new Map,p=le(e.on),u=new Map,f=new Map;(p.length>0||o.some(d=>"remove"in d&&F(d.remove)==="subject"||"from"in d&&(F(d.from)==="subject"||F(d.to)==="subject")||"set"in d&&!("create"in d)&&!("through"in d)&&F(d.target??"$subject")==="subject"||"through"in d))&&r.set(ze,{ref:p.length>0?p:"*",required:!0});let c=e.args??{},i=e.writes?.length===1,l=(d,a)=>a&&d.type===a.type&&d.min===void 0&&d.max===void 0&&d.step===void 0?{...d,...a.min===void 0?{}:{min:a.min},...a.max===void 0?{}:{max:a.max},...a.step===void 0?{}:{step:a.step}}:d,h=(d,a)=>a&&d.type===a.type&&d.format===void 0&&d.unit===void 0?{...l(d,a),...a.format?{format:a.format}:{},...a.unit?{unit:a.unit}:{}}:l(d,a),m=(d,a,O)=>{if(d===ze||Dn.has(d)||u.has(d)||r.has(d))return;let k=c[d]?h(c[d],O):void 0;r.set(d,k?{field:k,optional:!k.required,required:!!k.required}:a())};for(let d of o)if("create"in d){let a=s.kinds[d.create],O=a?un(a,_n(a)):[],k=w=>O.includes(w)?O.indexOf(w):O.length;for(let[w,j]of Object.entries(d.set??{}).sort(([E],[S])=>k(E)-k(S))){let E=F(j),S=a?.fields[w];if(E&&S){let V=!!S.required&&S.default===void 0;m(E,()=>({field:S,optional:!V,required:V}),S)}}d.as&&u.set(d.as,d.create)}else if("connect"in d||"sever"in d){let a=t.get("connect"in d?d.connect:d.sever);for(let[O,k]of[["from",d.from],["to",d.to]]){let w=F(k);if(!w)continue;let j=O==="to"?a?.to??"*":a?.from??"*";j!=="*"&&!f.has(w)&&f.set(w,j),m(w,()=>({ref:j,required:!0}))}}else if("through"in d){let a=je(s.kinds,d.through,p),O=a&&a.kinds!=="*"?a.kinds[0]:void 0;for(let[k,w]of Object.entries(d.set)){let j=F(w);if(!j||j==="to")continue;let E=O?s.kinds[O]?.fields[k]:void 0;m(j,()=>E?{field:E,optional:!0,required:!1}:{any:!0,required:!1},E)}}else if("set"in d){let a=F(d.target??"$subject"),O=a==="subject"?p[0]:u.get(a??"")??f.get(a??"")?.[0];a&&a!=="subject"&&!u.has(a)&&m(a,()=>({ref:"*",required:!0}));for(let[k,w]of Object.entries(d.set)){let j=F(w);if(!j)continue;let E=O?s.kinds[O]?.fields[k]:void 0;m(j,()=>E?{field:E,optional:!i,required:i}:{any:!0,required:!1},E)}}else if("remove"in d){let a=F(d.remove);a&&m(a,()=>({ref:"*",required:!0}))}for(let[d,a]of Object.entries(c))r.has(d)||r.set(d,{field:a,optional:!a.required,required:!!a.required});return r}function Bt(e,o={}){let s=Tn(e);if(!s.document||me(s.findings))return{ok:!1,findings:s.findings};let t=s.document,r=[...s.findings];o.previous&&r.push(...Kn(t,o.previous));let p=In(t,r);return me(p.findings)?{ok:!1,findings:p.findings}:Ze(p,o)}function ce(e,o){return e.map(s=>{let t=!s.format&&s.expr?.t==="ident"?o?.[s.expr.name]?.format:void 0;return t==="money"||t==="percent"?{...s,format:t}:s})}function In(e,o){let s=mn(e),t={},r=pn(e.connections,e.kinds);for(let[i,l]of Object.entries(e.kinds)){let h=ye(l),m=l.label??(h?`{${h}}`:void 0),d=se(l),a=d?ln(e,i,[...d]):[];t[i]={...m?{label:ce(Q(m),l.fields)}:{},...l.describe?{describe:ce(Q(l.describe),l.fields)}:{},...d?{computed:[...d]}:{},...a.length>0?{durations:a}:{},...r.has(i)?{keptInStep:r.get(i)}:{}}}let p={};for(let[i,l]of Object.entries(e.acts??{})){let h=gn(l,e),m=Mn(l,h,e,s),d=l.destructive??h.some(g=>"remove"in g||"sever"in g||"replace"in g),a=[...new Set(h.flatMap(g=>"create"in g?[g.create]:[]))],O=[...new Set(h.flatMap(g=>"connect"in g?[g.connect]:[]))],k=[...new Set(h.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],w=[...new Set(h.flatMap(g=>"set"in g&&!("create"in g)&&!("through"in g)&&F(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],j=new Map;for(let g of h){if(!("connect"in g)&&!("sever"in g))continue;let x=s.get("connect"in g?g.connect:g.sever);for(let[N,ie]of[["from",g.from],["to",g.to]]){let Y=F(ie),B=N==="to"?x?.to:x?.from;Y&&Y!=="subject"&&B&&B!=="*"&&j.set(Y,[...new Set([...j.get(Y)??[],...B])])}}let E={};for(let g of h){if(!("set"in g)||"create"in g||"through"in g)continue;let x=F(g.target??"$subject");for(let N of x&&x!=="subject"&&j.get(x)||[])E[N]=[...new Set([...E[N]??[],...Object.keys(g.set)])]}let S={};for(let g of h)if(!(!("set"in g)||"create"in g||"through"in g||F(g.target??"$subject")!=="subject"))for(let[x,N]of Object.entries(g.set??{}))typeof N=="string"&&F(N)===void 0||typeof N=="number"||typeof N=="boolean"?S[x]=typeof N=="string"&&N.startsWith("$$")?N.slice(1):N:delete S[x];let V=a.length===0&&h.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(x=>!(x&&typeof x=="object"&&!Array.isArray(x)&&"expr"in x))),C=new Map;for(let g of h)if(!(!("set"in g)||!g.set))for(let x of Object.values(g.set))x&&typeof x=="object"&&!Array.isArray(x)&&"expr"in x&&C.set(x.expr,X(x.expr));p[i]={title:l.title??i.replace(/-/g," "),effects:h,args:[...m],...l.allowedWhen?{guard:X(l.allowedWhen)}:{},...l.refusal?{refusal:ce(Q(l.refusal),e.kinds[[l.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...C],destructive:d,idempotent:V,creates:a,connects:O,severs:k,writes:w,writesOther:E,sets:S}}let u={};for(let[i,l]of Object.entries(e.rules??{})){let h=l.covers&&l.over!=="graph"?ge(l.over,l.covers,m=>s.get(m),m=>m in e.kinds):void 0;u[i]={title:l.title??i.replace(/-/g," "),...l.require?{require:X(l.require)}:{},...h&&"plan"in h?{covers:h.plan}:{},...l.when?{when:X(l.when)}:{},...l.says?{says:ce(Q(l.says),e.kinds[l.over]?.fields)}:{}}}let f=Ue(e,o),z=We(e),c=Je(e);return{format:He,document:e,findings:o,kinds:t,...e.computed?{facts:[...se(e)??[]]}:{},edges:[...s].map(([i,{from:l,to:h,cardinality:m}])=>[i,{from:l,to:h,cardinality:m}]),acts:p,rules:u,brand:f,...Object.keys(z).length>0?{viewSpecs:z}:{},...c?{home:c}:{}}}function Ut(e,o,s){let t=/^defineNode\("([^"]+)"\)/.exec(o)?.[1],r=t?s.kinds[t]:void 0;if(!t||!r)return e;let p=Object.keys(r.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${p.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function Kn(e,o){let s=[],t=new Set(Object.values(o.kinds).flatMap(r=>Object.keys(r.edges??{})));for(let[r,p]of Object.entries(e.kinds)){let u=p.renamedFrom;u&&!o.kinds[u]&&s.push(y("renamed-from-nothing",`kinds.${r}.renamedFrom`,`${r} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=o.kinds[u??r];for(let[z,c]of Object.entries(p.fields)){let i=c.renamedFrom;i&&!f?.fields[i]&&s.push(y("renamed-from-nothing",`kinds.${r}.fields.${z}.renamedFrom`,`${z} says it was ${i}, and the previous ${u??r} has no field called ${i}`,"name the field it was, or drop renamedFrom"))}for(let[z,c]of Object.entries(p.edges??{})){let i=c.renamedFrom;i&&!t.has(i)&&s.push(y("renamed-from-nothing",`kinds.${r}.edges.${z}.renamedFrom`,`${z} says it was ${i}, and the previous version has no relation called ${i}`,"name the relation it was, or drop renamedFrom"))}}return s}export{Tn as a,Vt as b,gn as c,Bt as d,Ut as e};
@@ -1 +0,0 @@
1
- import"./chunk.KHRS2SKB.js";import"./chunk.4HRYB7HF.js";import"./chunk.25VJPUDH.js";import"./chunk.T6PU3NKP.js";import"./chunk.ELOFPE25.js";import{a as x,b as P,c as L}from"./chunk.BLUKSGI4.js";import{b as R}from"./chunk.UFDJXQQQ.js";import"./chunk.ELTV44HU.js";import"./chunk.CY3ELWCM.js";import"./chunk.RMR24LFJ.js";import"./chunk.I77ZGIFE.js";import"./chunk.OWOOKLIU.js";import"./chunk.RD2X25XB.js";import"./chunk.KMV6PJFL.js";import"./chunk.SWMDFXUX.js";import"./chunk.A3ZC2JBO.js";import"./chunk.NAD7ZXYP.js";import"./chunk.2GEJNG2U.js";import"./chunk.HJCQ6I3S.js";import"./chunk.22BZU7ME.js";import"./chunk.2N4Z5K5S.js";import"./chunk.JYFZCJ4N.js";import"./chunk.U6ZRJKVM.js";import"./chunk.PLTH2LW5.js";import"./chunk.66P5IDTH.js";import"./chunk.UQQKDBIH.js";import"./chunk.AJSUHPBE.js";import"./chunk.LAYQ5PFS.js";import"./chunk.KDXU5DT3.js";import"./chunk.O2BHPYA4.js";import"./chunk.M4AYA2PL.js";import"./chunk.H5S7OL2U.js";import"./chunk.PZQNR4KZ.js";import"./chunk.W4BKYSZX.js";import"./chunk.T6WHGKWR.js";import"./chunk.XOZU4OFA.js";import"./chunk.Y2YYH3JN.js";import"./chunk.YFVJUHAK.js";import"./chunk.NOGGSLVG.js";import"./chunk.WVUJXDXZ.js";import"./chunk.SGCW2XRC.js";import"./chunk.ZN3PUM2I.js";import"./chunk.QIPASE42.js";import"./chunk.EVBCEEQ4.js";import"./chunk.OWT3VVOT.js";import"./chunk.NHTGAP3G.js";import"./chunk.GZHZLJBF.js";import{r as T}from"./chunk.UKQUUPKE.js";import"./chunk.OJGHDWI6.js";import"./chunk.DDUCIUVW.js";import"./chunk.NUYA4BWI.js";import"./chunk.OKZT2QBM.js";import"./chunk.ACTXR2MI.js";import"./chunk.AI34V6WV.js";import"./chunk.G4ULQK64.js";import{G as S,I as $,T as p,ba as C,da as A}from"./chunk.M7RESZB6.js";import"./chunk.SDO3U72B.js";import{ia as v,id as k}from"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import{b as i}from"./chunk.AJZBJBMO.js";var r=i(S(),1);var l=i(S(),1);var g=i(p(),1);var m={font:"inherit",fontSize:"0.875rem",minHeight:24,padding:0,border:0,borderRadius:2,background:"transparent",boxShadow:"none",color:"var(--graview-accent)",textDecoration:"underline",textUnderlineOffset:3,textAlign:"start",cursor:"pointer"};var e=i(p(),1);function Q({page:n=!1,go:E,onPick:y,onDiscard:N}){let{store:d,seatTalk:c}=C(),u=$(c),D=L(),h=E??D,{keep:M}=x(h),[H,f]=(0,r.useState)(!1);A();let t=u.draft;(0,r.useEffect)(()=>f(!1),[t]),(0,r.useEffect)(()=>{n||P(!1)},[n]);let w=(0,r.useRef)(null),b=t!==null&&!n;if((0,r.useLayoutEffect)(()=>{let s=w.current;if(!b||!s?.parentElement)return;let o=[];for(let a=s.previousElementSibling;a;a=a.previousElementSibling)a instanceof HTMLElement&&!a.inert&&a.tagName!=="STYLE"&&(a.inert=!0,o.push(a));return()=>{for(let a of o)a.inert=!1}},[b]),!t)return null;let G=R(t.drawn),F=d.schema.tryDefinition(t.kind),O=d.graph.nodesOfKind(t.kind).filter(s=>v(F,s)),q=()=>{c.setDraft(null),N?.()};return(0,e.jsxs)("section",{ref:w,"data-testid":"draft-frame","data-graview-draft-frame":n?"page":"scene","aria-label":`Draft: ${t.title}`,style:n?{display:"grid",gap:12,minWidth:0}:{position:"absolute",inset:12,zIndex:k("rail"),display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:12,boxShadow:"var(--graview-lift-high)",overflow:"hidden",minHeight:0},children:[(0,e.jsxs)("p",{"data-testid":"draft-line",style:{...z,...n?{}:{padding:"10px 16px"}},children:[n?(0,e.jsx)("span",{children:"Draft"}):(0,e.jsxs)("span",{children:["Draft \u2014 ",(0,e.jsx)("span",{"data-testid":"draft-title",style:{color:"var(--graview-ink)",fontWeight:600},children:t.title})]}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-keep",disabled:H,title:`Keep \u201C${t.title}\u201D as a lens: a place of its own`,onClick:()=>{f(!0),M(t).finally(()=>f(!1))},style:m,children:"Keep as a lens"}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-discard",onClick:q,style:m,children:"Discard"})]}),u.draftNote?(0,e.jsx)("p",{"data-testid":"draft-note",role:"status",style:{margin:0,padding:n?0:"0 16px 8px",fontSize:"0.8125rem",color:"var(--graview-warn)"},children:u.draftNote}):(0,e.jsx)("span",{}),(0,e.jsx)("div",{"data-testid":"draft-lens","data-graview-draft":t.lens.name,role:"group","aria-label":t.title,tabIndex:0,style:n?{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",scrollbarGutter:"stable",border:"1px solid var(--graview-edge)",borderRadius:12,background:"var(--graview-panel)"}:{minHeight:0,overflow:"auto",scrollbarGutter:"stable",display:"grid",gridTemplateRows:"minmax(0, 1fr)"},onClick:s=>{let o=s.target?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(!o||!d.graph.getNode(o))return;s.preventDefault();let a=d.graph.getNode(o);y?(c.setDraft(null),y(o)):h({to:"record",id:o,kind:a.kind,label:o,address:"",said:""})},children:(0,e.jsx)(T,{kind:t.kind,view:t.title,children:(0,e.jsx)(G,{nodes:O,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})]})}var z={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};export{Q as DraftFrame};