graview 0.1.50 → 0.1.52

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 (195) hide show
  1. package/dist/preview/chunk.2EB7COX5.js +1 -0
  2. package/dist/preview/{chunk.FKUVIG6D.js → chunk.2K3YQJW3.js} +1 -1
  3. package/dist/preview/{chunk.2P66HH5Y.js → chunk.2X3UZJWI.js} +1 -1
  4. package/dist/preview/chunk.337JMOTL.js +1 -0
  5. package/dist/preview/{chunk.YEKHDZ45.js → chunk.3FKP32RG.js} +2 -2
  6. package/dist/preview/{chunk.MQISKON2.js → chunk.3TME4BG3.js} +1 -1
  7. package/dist/preview/chunk.3ZQAPPJ5.js +18 -0
  8. package/dist/preview/{chunk.KZ3UPV2L.js → chunk.4LI73QOY.js} +1 -1
  9. package/dist/preview/{chunk.T4UYLB3Y.js → chunk.4VI3EYDL.js} +1 -1
  10. package/dist/preview/chunk.4ZLCMATU.js +2 -0
  11. package/dist/preview/{chunk.ETWREHXF.js → chunk.52J42KR5.js} +1 -1
  12. package/dist/preview/{chunk.ETX4QMM2.js → chunk.5DDHFNZM.js} +1 -1
  13. package/dist/preview/chunk.5LWPNOJA.js +1 -0
  14. package/dist/preview/{chunk.KFHXTHIY.js → chunk.5WU2UTP7.js} +1 -1
  15. package/dist/preview/{chunk.OUNLAMBA.js → chunk.63SRVTG2.js} +2 -2
  16. package/dist/preview/chunk.6BA6RUK7.js +1 -0
  17. package/dist/preview/{chunk.QZMBEG4E.js → chunk.6CY3EA6U.js} +1 -1
  18. package/dist/preview/chunk.6JERQFZI.js +1 -0
  19. package/dist/preview/chunk.6NIE3ILA.js +1 -0
  20. package/dist/preview/{chunk.OB7XLVK6.js → chunk.6QNBUBGD.js} +1 -1
  21. package/dist/preview/chunk.6YGRRXJB.js +2 -0
  22. package/dist/preview/{chunk.IDQHSAAQ.js → chunk.7354O67H.js} +1 -1
  23. package/dist/preview/{chunk.LJXAZ5TF.js → chunk.73EKJ4JN.js} +1 -1
  24. package/dist/preview/{chunk.O6SKKF4V.js → chunk.7EA7THSM.js} +1 -1
  25. package/dist/preview/{chunk.F7AFJRPP.js → chunk.7FMS57QO.js} +1 -1
  26. package/dist/preview/{chunk.L5MDUZLQ.js → chunk.7FZY5E2U.js} +1 -1
  27. package/dist/preview/chunk.7IOC6U3C.js +1 -0
  28. package/dist/preview/{chunk.7VX6TBNY.js → chunk.7KZ44FEU.js} +1 -1
  29. package/dist/preview/chunk.7OAXW7QF.js +1 -0
  30. package/dist/preview/chunk.7SNIX56B.js +1 -0
  31. package/dist/preview/{chunk.GZEZMU2T.js → chunk.7UJZP3YK.js} +2 -2
  32. package/dist/preview/{chunk.YUV7HZYG.js → chunk.7UXDIEPK.js} +1 -1
  33. package/dist/preview/{chunk.ZITDUHX3.js → chunk.7XJ3XQZD.js} +1 -1
  34. package/dist/preview/chunk.AI2HBKVP.js +359 -0
  35. package/dist/preview/chunk.BDQ4FUKO.js +1 -0
  36. package/dist/preview/{chunk.IMFAPZ6J.js → chunk.BHPZK4WJ.js} +2 -2
  37. package/dist/preview/{chunk.AXMC6XVT.js → chunk.BJL6EL6B.js} +1 -1
  38. package/dist/preview/{chunk.HGP3Q7QX.js → chunk.C4EPMV7O.js} +1 -1
  39. package/dist/preview/chunk.C4UNAJWC.js +1 -0
  40. package/dist/preview/{chunk.CR5MQMOL.js → chunk.C7EEYSAM.js} +1 -1
  41. package/dist/preview/{chunk.LGHMUUTG.js → chunk.CBGKWYGI.js} +1 -1
  42. package/dist/preview/chunk.CC7E6NUQ.js +1 -0
  43. package/dist/preview/chunk.CHMUL36A.js +1 -0
  44. package/dist/preview/{chunk.TT6QBWRA.js → chunk.CV4QA4ZF.js} +1 -1
  45. package/dist/preview/chunk.D2T563AA.js +1 -0
  46. package/dist/preview/{chunk.UDTBFAS5.js → chunk.D62V3TBW.js} +1 -1
  47. package/dist/preview/{chunk.ECSWXLBI.js → chunk.DC7M56NM.js} +2 -2
  48. package/dist/preview/chunk.DGWNVDZB.js +1 -0
  49. package/dist/preview/{chunk.73BJYIYS.js → chunk.DIS7JS7X.js} +1 -1
  50. package/dist/preview/{chunk.A53G42QO.js → chunk.DVLWSCIC.js} +1 -1
  51. package/dist/preview/{chunk.LDE5HLTM.js → chunk.DXZ5VYCQ.js} +1 -1
  52. package/dist/preview/{chunk.GPJFNLEJ.js → chunk.EHOEMVQP.js} +1 -1
  53. package/dist/preview/chunk.EIWTZC4A.js +1 -0
  54. package/dist/preview/chunk.EME5HQ3H.js +1 -0
  55. package/dist/preview/{chunk.JJP5OL5E.js → chunk.FEBCIEI3.js} +1 -1
  56. package/dist/preview/{chunk.CDZVUCEK.js → chunk.FJC6PMOG.js} +1 -1
  57. package/dist/preview/{chunk.U2M4SGUU.js → chunk.FJEXINFF.js} +1 -1
  58. package/dist/preview/{chunk.UOC3SIYT.js → chunk.FLNYLE6S.js} +1 -1
  59. package/dist/preview/{chunk.QSZLY62B.js → chunk.G7XKQNOL.js} +1 -1
  60. package/dist/preview/{chunk.MRUDTYOL.js → chunk.GL3YVGAP.js} +2 -2
  61. package/dist/preview/{chunk.UGJ32SEL.js → chunk.GZHEGKPF.js} +1 -1
  62. package/dist/preview/{chunk.S64LCR23.js → chunk.HSGUXMAO.js} +1 -1
  63. package/dist/preview/{chunk.ODHCSYXX.js → chunk.HST7BYFW.js} +1 -1
  64. package/dist/preview/{chunk.TY6VILZB.js → chunk.I2W7HSBU.js} +1 -1
  65. package/dist/preview/{chunk.GQX57JIE.js → chunk.I43ONAEL.js} +1 -1
  66. package/dist/preview/{chunk.QFI4L2HK.js → chunk.INL4OZI7.js} +1 -1
  67. package/dist/preview/{chunk.ZBBCUK2K.js → chunk.IVI3HRSF.js} +1 -1
  68. package/dist/preview/{chunk.JYJNRCK5.js → chunk.J263VQF5.js} +1 -1
  69. package/dist/preview/{chunk.GTUBIJTP.js → chunk.J2R55TM7.js} +1 -1
  70. package/dist/preview/{chunk.MCPLU2U4.js → chunk.J6IB2HUZ.js} +1 -1
  71. package/dist/preview/{chunk.TL7UGUY4.js → chunk.JOWJNIWH.js} +2 -2
  72. package/dist/preview/{chunk.XWLGHTH6.js → chunk.JQBP6QWQ.js} +1 -1
  73. package/dist/preview/chunk.JV7FLVUV.js +1 -0
  74. package/dist/preview/{chunk.KOPRZLJH.js → chunk.KFTZLNHY.js} +2 -2
  75. package/dist/preview/{chunk.DUIKIJKC.js → chunk.KPUX27ZT.js} +1 -1
  76. package/dist/preview/chunk.KSJ3J5UN.js +1 -0
  77. package/dist/preview/chunk.LESRQN3Y.js +32 -0
  78. package/dist/preview/{chunk.FFPG4PHX.js → chunk.LSL25VXW.js} +1 -1
  79. package/dist/preview/{chunk.VVRI7DNK.js → chunk.LTJYKQJG.js} +1 -1
  80. package/dist/preview/chunk.LXJW2Z2M.js +1 -0
  81. package/dist/preview/{chunk.AXCRFJDL.js → chunk.M33LUF3Q.js} +1 -1
  82. package/dist/preview/chunk.MBNZ2HK7.js +1 -0
  83. package/dist/preview/chunk.MYKRJ4SV.js +1 -0
  84. package/dist/preview/{chunk.L2AV6JRA.js → chunk.N7D5LKBI.js} +1 -1
  85. package/dist/preview/{chunk.WGRF6EHC.js → chunk.NAPTE3S6.js} +1 -1
  86. package/dist/preview/{chunk.BBNF52IB.js → chunk.NHIPVAGR.js} +1 -1
  87. package/dist/preview/chunk.NICCIJV4.js +1 -0
  88. package/dist/preview/{chunk.UJTRKSCK.js → chunk.NQPNK6I5.js} +1 -1
  89. package/dist/preview/{chunk.JLPBXG4P.js → chunk.NVNQSZ43.js} +1 -1
  90. package/dist/preview/{chunk.7QW6JYGP.js → chunk.NWK4E7TJ.js} +1 -1
  91. package/dist/preview/chunk.NZB5S5UO.js +1 -0
  92. package/dist/preview/{chunk.53BGPCM6.js → chunk.OS3WZV6C.js} +1 -1
  93. package/dist/preview/{chunk.UCS3CBT4.js → chunk.OYRZ2DEI.js} +1 -1
  94. package/dist/preview/{chunk.KGGWFL54.js → chunk.P5PXWOHI.js} +1 -1
  95. package/dist/preview/chunk.PFXGWY3P.js +1 -0
  96. package/dist/preview/chunk.PRCWGE7A.js +1 -0
  97. package/dist/preview/{chunk.4SHSEIHT.js → chunk.PXHBPLTQ.js} +1 -1
  98. package/dist/preview/chunk.PXVJBL2C.js +1 -0
  99. package/dist/preview/chunk.Q3XKNZQW.js +1 -0
  100. package/dist/preview/chunk.Q5IAXTF5.js +25 -0
  101. package/dist/preview/{chunk.V5IWJ3ZV.js → chunk.QPP3OJVR.js} +1 -1
  102. package/dist/preview/{chunk.6SHF6IL5.js → chunk.QRCTTDDQ.js} +1 -1
  103. package/dist/preview/{chunk.ZOQ3OKKI.js → chunk.QWQBPJ4U.js} +1 -1
  104. package/dist/preview/chunk.QXCYAFRT.js +1 -0
  105. package/dist/preview/chunk.R6FHEEJ7.js +1 -0
  106. package/dist/preview/chunk.R77TACXU.js +1 -0
  107. package/dist/preview/{chunk.RK6BK5FD.js → chunk.R7CRV2FE.js} +1 -1
  108. package/dist/preview/chunk.R7ZZJOJW.js +1 -0
  109. package/dist/preview/{chunk.4BQNG3W3.js → chunk.RBWYXVUW.js} +1 -1
  110. package/dist/preview/chunk.RMRO5JZX.js +1 -0
  111. package/dist/preview/{chunk.4XOSDCCE.js → chunk.RWCWRJJC.js} +1 -1
  112. package/dist/preview/{chunk.M55U47A6.js → chunk.S4ZWBCYC.js} +1 -1
  113. package/dist/preview/{chunk.ZKDJQDKX.js → chunk.SELLAVIQ.js} +1 -1
  114. package/dist/preview/chunk.SLBWPVIY.js +1 -0
  115. package/dist/preview/{chunk.GDYI5QDS.js → chunk.SM6HTPYF.js} +1 -1
  116. package/dist/preview/chunk.SZCZD2GM.js +1 -0
  117. package/dist/preview/{chunk.YZ6UKKEL.js → chunk.T2Q3AAQI.js} +1 -1
  118. package/dist/preview/{chunk.YCJ74LZS.js → chunk.T6KKNWZT.js} +1 -1
  119. package/dist/preview/{chunk.BJAQRV2R.js → chunk.U6PCKJ26.js} +1 -1
  120. package/dist/preview/chunk.UEPVA6IS.js +1 -0
  121. package/dist/preview/{chunk.JC5NXMG3.js → chunk.ULAMIQ52.js} +1 -1
  122. package/dist/preview/chunk.UMS7XRPO.js +1 -0
  123. package/dist/preview/{chunk.FDFVGHQE.js → chunk.VGIWQNJB.js} +1 -1
  124. package/dist/preview/{chunk.64TFAR5Z.js → chunk.VGTEEANA.js} +1 -1
  125. package/dist/preview/{chunk.BORCUDGS.js → chunk.VKOCD5CL.js} +1 -1
  126. package/dist/preview/chunk.VOHRQXCF.js +5 -0
  127. package/dist/preview/chunk.W5UJLKIT.js +1 -0
  128. package/dist/preview/chunk.WUEU3QBL.js +1 -0
  129. package/dist/preview/chunk.WWUMSCYC.js +1 -0
  130. package/dist/preview/{chunk.Q7RI4SI4.js → chunk.XLM4ONUB.js} +1 -1
  131. package/dist/preview/{chunk.QAUZDLDA.js → chunk.XPR3QFF4.js} +1 -1
  132. package/dist/preview/{chunk.UN2OB6OD.js → chunk.XZLKTOJE.js} +1 -1
  133. package/dist/preview/chunk.Y37DXEHG.js +1 -0
  134. package/dist/preview/chunk.YKACMLLU.js +1 -0
  135. package/dist/preview/{chunk.DUJUJN35.js → chunk.YKXUDACI.js} +1 -1
  136. package/dist/preview/{chunk.3SY6WWWQ.js → chunk.YUEOUV7G.js} +2 -2
  137. package/dist/preview/chunk.YYWLYVAW.js +1 -0
  138. package/dist/preview/chunk.Z2JMTRF4.js +1 -0
  139. package/dist/preview/chunk.Z2UFPOAN.js +88 -0
  140. package/dist/preview/chunk.ZEKKIMKI.js +1 -0
  141. package/dist/preview/{chunk.SVH3OMU2.js → chunk.ZJXUWOG3.js} +1 -1
  142. package/dist/preview/{chunk.SWLDDQJS.js → chunk.ZK42LPF5.js} +1 -1
  143. package/dist/preview/{chunk.SRU2YDTJ.js → chunk.ZZGXVYW2.js} +1 -1
  144. package/dist/preview/index.html +51 -51
  145. package/dist/preview/page.js +2 -2
  146. package/package.json +6 -6
  147. package/dist/preview/chunk.24MUPV4Y.js +0 -1
  148. package/dist/preview/chunk.2VZSC2MB.js +0 -1
  149. package/dist/preview/chunk.3L5USMQD.js +0 -1
  150. package/dist/preview/chunk.3O3H37WD.js +0 -1
  151. package/dist/preview/chunk.4VJARLJ5.js +0 -1
  152. package/dist/preview/chunk.5DZR46YG.js +0 -1
  153. package/dist/preview/chunk.5RNB6IC5.js +0 -1
  154. package/dist/preview/chunk.6BMCZPT6.js +0 -1
  155. package/dist/preview/chunk.6VA5XFRR.js +0 -1
  156. package/dist/preview/chunk.7PJVMADH.js +0 -2
  157. package/dist/preview/chunk.ATWNWPME.js +0 -1
  158. package/dist/preview/chunk.AVCW7C6V.js +0 -1
  159. package/dist/preview/chunk.BLS2G3CD.js +0 -5
  160. package/dist/preview/chunk.BNQL37AC.js +0 -88
  161. package/dist/preview/chunk.CBJHYNNT.js +0 -1
  162. package/dist/preview/chunk.EF3UB7US.js +0 -1
  163. package/dist/preview/chunk.EJUZGIQ5.js +0 -1
  164. package/dist/preview/chunk.F5FJHKWV.js +0 -1
  165. package/dist/preview/chunk.GQI53L5P.js +0 -1
  166. package/dist/preview/chunk.HG34MT7C.js +0 -1
  167. package/dist/preview/chunk.IATLUWAD.js +0 -1
  168. package/dist/preview/chunk.JLR74UFP.js +0 -1
  169. package/dist/preview/chunk.K4ITS63T.js +0 -1
  170. package/dist/preview/chunk.KT2LXHSI.js +0 -1
  171. package/dist/preview/chunk.M5RHVUZ6.js +0 -1
  172. package/dist/preview/chunk.MBZ6N5SO.js +0 -1
  173. package/dist/preview/chunk.N7FIUTVY.js +0 -1
  174. package/dist/preview/chunk.NPU4WYRB.js +0 -1
  175. package/dist/preview/chunk.OHAWUOUN.js +0 -1
  176. package/dist/preview/chunk.OKQ4JXTW.js +0 -1
  177. package/dist/preview/chunk.OYQ6ZA6T.js +0 -1
  178. package/dist/preview/chunk.Q7UQ5OXA.js +0 -1
  179. package/dist/preview/chunk.ROJZLOKZ.js +0 -1
  180. package/dist/preview/chunk.RXJBYP7B.js +0 -1
  181. package/dist/preview/chunk.S7OFTGBQ.js +0 -18
  182. package/dist/preview/chunk.SGMVLKZO.js +0 -25
  183. package/dist/preview/chunk.SJRXBTGP.js +0 -1
  184. package/dist/preview/chunk.THTHNY4N.js +0 -1
  185. package/dist/preview/chunk.U6FGWVGB.js +0 -1
  186. package/dist/preview/chunk.UEL7FLL7.js +0 -1
  187. package/dist/preview/chunk.VM43YREJ.js +0 -1
  188. package/dist/preview/chunk.YAS6LXQ7.js +0 -1
  189. package/dist/preview/chunk.YEMNR4WU.js +0 -1
  190. package/dist/preview/chunk.YG3BLY67.js +0 -32
  191. package/dist/preview/chunk.YYS45ZGQ.js +0 -1
  192. package/dist/preview/chunk.ZI66HRES.js +0 -1
  193. package/dist/preview/chunk.ZK446PSX.js +0 -359
  194. package/dist/preview/chunk.ZVETGRUM.js +0 -1
  195. package/dist/preview/chunk.ZVOP2HHI.js +0 -1
@@ -1 +0,0 @@
1
- import{a as ve,b as qe,c as Ie,d as pe,e as R,f as fe,h as Ve}from"./chunk.BJAQRV2R.js";import{h as Le,i as Ue,j as We}from"./chunk.GQX57JIE.js";import{a as se,b as ie,c as H,d as Be,e as J,g as ne,h as Ze}from"./chunk.QFI4L2HK.js";import{c as _e,h as y,i as Ne,j as le}from"./chunk.KFHXTHIY.js";import{A as Re,Aa as Fe,Ha as De,Ia as ee,Ja as ce,Ob as Ke,Pb as de,Qb as Me,Rb as Pe,Sb as Te,b as W,c as L,e as xe,ec as Ge,f as Ee,fc as Ce,g as q,h as O,k as C,l as X,m as _,n as Ae,o as U,p as K,r as $,s as Q,t as x,u as E,v as I,w as P,x as n,y as M,z as Z}from"./chunk.BLS2G3CD.js";var ue=e=>Object.entries(e).map(([s,r])=>[s,Object.keys(ee(r?.edges))]),me=(e,s)=>Me(e,ue(s));function Ye(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(s=>Ke(s)),...Pe(ue(e.kinds))]}var V=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function He(e){if(!V(e)||!V(e.kinds))return e;let s;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([z,i])=>[z,V(i)&&V(i.edges)?{edges:i.edges}:{}]));s=Ye({acts:V(e.acts)?e.acts:{},kinds:f})}catch{return e}let r=new Set(s),t=!1,a=f=>{if(typeof f!="string"||r.has(f))return f;let z=Ge(f,s);return z===void 0?f:(t=!0,z)},d=V(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>V(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(a)}:f)}:void 0,u=V(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,z])=>[f,V(z)&&Array.isArray(z.repairs)?{...z,repairs:z.repairs.map(i=>V(i)?{...i,act:a(i.act)}:i)}:z])):void 0;return t?{...e,...d?{policy:d}:{},...u?{rules:u}:{}}:e}function ge(e,s){let r=Ce(e,Ye(s));return r&&r!==e?`did you mean "${r}"?`:void 0}var he="graview-document",be=1,ke=256*1024,te=64*1024,ze=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ye=/^[a-z][A-Za-z0-9]*$/,zn=new Set(["id","kind"]),yn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,hn=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function bn(){let e=k=>k in Object.prototype,s=Z(k=>!e(k),"every object already has this name \u2014 choose another"),r=(k,N)=>[...k===void 0?[]:[Ee(k)],...N===void 0?[]:[xe(N)]],t=(k,N)=>O().check(...r(k,N)),a=(k,N,gn)=>K(k).check(...r(N,gn)),d=k=>O().check(q(ze,`${k} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=O().check(q(yn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=O().check(q(ye,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Z(k=>!zn.has(k),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),z=t(1,500),i=t(1,2e3),o=t(1,300),p=$({type:I(hn),required:n(_()),description:n(z),label:n(t(1,60)),options:n(a(t(1,80),1,100)),of:n(I(["string","number","date","image","video","file"])),default:n(U()),unit:n(t(void 0,12)),format:n(I(["money","percent","duration","markdown"])),min:n(C()),max:n(C()),step:n(C()),renamedFrom:n(O().check(q(ye))),repeats:n(_()),collaborative:n(_())}).check(Re((k,N)=>{k.type==="enum"&&!k.options&&N.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),k.type!=="enum"&&k.options&&N.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),k.type!=="list"&&k.of&&N.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),k.repeats&&k.type!=="date"&&k.type!=="datetime"&&N.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),w=O().check(q(new RegExp(`${ze.source}|${Fe.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),m=$({to:x([a(w,1),P("*")]),cardinality:n(I(["one","many"])),description:n(z),inverse:n(t(1,80)),appendOnly:n(_()),renamedFrom:n(O()),tidying:n(P("never"))}),l=x([i,$({expr:i,label:n(t(1,60)),description:n(z)})]),c=$({noun:n(t(1,40)),plural:n(t(1,40)),description:n(z),fields:E(f,p).check(Z(k=>Object.keys(k).length>0,"a kind has at least one field")),label:n(o),describe:n(o),lifecycle:n($({field:f,retired:a(x([O(),C(),_()]),1)})),figure:n(t(void 0,2e4)),glance:n(a(f,1,20)),page:n($({fields:n(a(f,1,40)),groups:n(a($({title:t(1,60),fields:a(f,1,40)}),1,12))})),edges:n(E(u,m)),computed:n(E(O(),l).check(Z(k=>Object.keys(k).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:n(E(O(),O())),renamedFrom:n(O().check(q(ze))),people:n(_()),archives:n(P(!1)),tidying:n(I(["never","no-links"]))}),j=x([O(),C(),_(),Ae(),K(U()),$({expr:i})]),h=O().check(q(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),S=x([$({create:d("kind"),as:n(O().check(q(ye))),set:n(E(f,j))}),$({set:E(f,j),target:n(h)}),$({connect:u,from:h,to:h}),$({sever:u,from:h,to:h}),$({remove:h})]),A=$({title:n(t(1,80)),description:n(z),fromTheOtherEnd:n(t(1,80)),on:n(x([d("kind"),a(d("kind"),1)])),creates:n(d("kind")),sets:n(E(f,j)),writes:n(a(f,1)),connects:n(u),severs:n(u),setsOther:n(E(f,j)),replaces:n(x([P(!0),a(u,1,10)])),removes:n(P(!0)),args:n(E(f,p)),effects:n(a(S,1,20)),allowedWhen:n(i),refusal:n(o),destructive:n(_())}),b=$({act:d("act"),label:n(t(1,80)),args:n(E(O(),j))}),G=$({title:n(t(1,120)),description:n(z),over:x([P("graph"),d("kind")]),when:n(i),require:i,says:n(o),repairs:n(a(b,void 0,10))}),F=$({roles:x([a(d("role"),1),P("*")]),mutations:x([a(d("act"),1),P("*")]),kinds:n(x([K(d("kind")),P("*")])),describe:n(z),self:n(_()),ownEnd:n(_())}),g=n(a(d("field"),1)),v=$({roles:x([a(d("role"),1),P("*")]),kinds:a(d("kind"),1),own:n(_()),via:n(u),fields:g,hide:g}),D=$({grants:K(F),sees:n(K(v))}),oe=$({accent:n(O().check(q(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),name:n(t(1,60)),currency:n(O().check(q(/^[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(x([t(1,te),$({src:t(1,te),alt:n(t(1,120))}),$({light:t(1,te),dark:n(t(1,te)),alt:n(t(1,120)),darkFallback:n(P("invert"))})])),favicon:n(x([t(1,te),$({emoji:O()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(C().check(L(0),W(32))),density:n(C().check(L(.75),W(1.5)))})),accents:n(E(O(),C().check(L(0),W(360)))),scheme:n(I(["light","dark","auto"])),subtitle:n(P(!1))}),B=E(O(),U()),Y=x([t(1,120),$({by:t(1,120),direction:n(I(["asc","desc"]))})]),je=C().check(X(),L(1),W(9999)),dn=Q({create:n(_()),options:n(Q({sort:n(Y),columnSort:n(Y),search:n(a(t(1,120),void 0,40)),filters:n(a(t(1,120),void 0,40)),horizon:n(x([C().check(X(),L(1),W(200)),Q({years:C().check(X(),L(1),W(200)),title:t(1,80),from:n(je),to:n(je)})]))}))}),ln=$({card:n(K(U())),row:n(K(U())),page:n(K(U()))}),pn=()=>{let k=n(I(["asc","desc"]));return x([t(1,120),$({by:t(1,120),direction:k,then:n(x([t(1,120),$({by:t(1,120),direction:k})]))})])},fn=()=>x([t(1,120),$({by:t(1,120),order:n(a(t(1,80),void 0,40)),closed:n(a(t(1,80),void 0,40))})]),Oe=Q({order:n(K(O())),hide:n(K(O())),first:n(O()),primary:n(a(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(E(O(),$({filters:n(a(t(1,120),void 0,40)),sort:n(pn()),group:n(fn())})))}),un=$({act:d("act"),title:n(t(1,80)),intro:n(z),fields:n(a(f,1,40)),say:n(z),submit:n(t(1,80)),role:n(d("role"))}),mn=$({$schema:n(O()),format:P(he),formatVersion:P(be),name:t(1,80),description:n(z),version:n(C().check(X(),L(1))),kinds:E(d("kind"),c).check(Z(k=>Object.keys(k).length>0,"a document declares at least one kind"),Z(k=>Object.keys(k).length<=40,"a document declares at most 40 kinds")),computed:n(E(O(),l)),acts:n(E(d("act"),A)),rules:n(E(d("rule"),G)),roles:n(K(d("role"))),policy:n(D),modules:n(B),lenses:n(K(dn)),pages:n(Oe),views:n(E(O(),x([ln,K(U())]))),brand:n(oe),settings:n(K(B)),migrations:n(K(B)),connections:n(E(d("connection"),B)),forms:n(E(d("form"),un)),publishing:n($({mode:I(["live","on-publish"]),working:a(d("role"),void 0,40),publishers:n(a(d("role"),1,40))}))});return{FieldSpec:p,EdgeSpec:m,ComputedSpec:l,KindSpec:c,ValueSpec:j,EffectSpec:S,ActSpec:A,RepairSpec:b,RuleSpec:G,GrantSpec:F,SightSpec:v,PolicySpec:D,BrandSpec:oe,PagesSpec:Oe,DocumentSpec:mn}}var kn,T=()=>kn??=bn(),_n=M(()=>T().FieldSpec),Nn=M(()=>T().EdgeSpec),qn=M(()=>T().ComputedSpec),In=M(()=>T().KindSpec),Vn=M(()=>T().ValueSpec),Bn=M(()=>T().EffectSpec),Ln=M(()=>T().ActSpec),Un=M(()=>T().RepairSpec),Wn=M(()=>T().RuleSpec),Zn=M(()=>T().GrantSpec),Yn=M(()=>T().SightSpec),Hn=M(()=>T().PolicySpec),Jn=M(()=>T().BrandSpec),Xn=M(()=>T().PagesSpec),Je=M(()=>T().DocumentSpec);var $n={};function Xe(e,s=$n,r=be){let{document:t,respelled:a}=ve(e),d=a.length>0?{respelled:a}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==he||typeof u.formatVersion!="number"||u.formatVersion>=r)return{document:t,...d};let f=u.formatVersion,z=structuredClone(u);for(let i=f;i<r;i++){let o=s[i];if(!o)throw new Error(`there is no upgrade from format ${i} to ${i+1}`);z={...o(z),formatVersion:i+1}}return{document:z,from:f,...d}}function Qe(e,s,r){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let a=t.map(f=>e[f].edges[s].to),d=a.some(f=>f==="*")?"*":[...new Set(a.flatMap(f=>f))];if(r.length===0||r.some(f=>t.includes(f)))return{reversed:!1,kinds:d};let u=t.filter(f=>{let z=e[f].edges[s].to;return z==="*"||r.every(i=>z.includes(i))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:d}}var tn=(e,s)=>{let r=e?.fields[s];return r!==void 0&&(r.type==="duration"||(r.type==="number"||r.type==="integer")&&r.format==="duration")};function en(e,s,r,t){if(t==="out"){let a=e[s]?.edges?.[r]?.to;return a===void 0?[]:a==="*"?Object.keys(e):a}return Object.entries(e).filter(([,a])=>{let d=a.edges?.[r]?.to;return d!==void 0&&(d==="*"||d.includes(s))}).map(([a])=>a)}function $e(e,s,r){if(r.t==="ident")return e[s]?.edges?.[r.name]?en(e,s,r.name,"out"):void 0;if(r.t==="where")return $e(e,s,r.set);if(r.t==="call"&&(r.fn==="out"||r.fn==="in")&&r.args[0]?.t==="lit"&&typeof r.args[0].value=="string")return en(e,s,r.args[0].value,r.fn)}var nn=(e,s,r)=>{let t=s.filter(a=>e[a]?.fields[r]!==void 0);return t.length>0&&t.every(a=>tn(e[a],r))};function on(e,s,r){let t=e.kinds,a=t[s],d=new Map(r),u=new Map,f=(i,o)=>{if(o>8)return!1;switch(i.t){case"ident":return tn(a,i.name)||z(i.name,o+1);case"member":{let p=$e(t,s,i.object);return p!==void 0&&nn(t,p,i.name)}case"call":{if(i.fn!=="sum"&&i.fn!=="min"&&i.fn!=="max")return!1;let[p,w]=i.args,m=p&&$e(t,s,p);return m!==void 0&&w?.t==="ident"&&nn(t,m,w.name)}case"binary":return(i.op==="+"||i.op==="-")&&f(i.left,o)&&f(i.right,o);case"unary":return i.op==="-"&&f(i.operand,o);default:return!1}},z=(i,o)=>{if(a?.computed?.[i]===void 0)return!1;if(u.has(i))return u.get(i);u.set(i,!1);let p=d.get(i),w=p!==void 0&&f(p,o);return u.set(i,w),w};return r.map(([i])=>i).filter(i=>z(i,0))}function sn(e,s,r=`kinds.${e}.page`){let t=s.page;if(!t)return[];let a=[],d=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(i,o)=>{d.includes(i)?u.has(i)&&a.push(y("page-field-twice",o,`"${i}" is on ${e}'s page twice; name each field once`)):a.push(y("page-field",o,`${e}'s page is to show "${i}", and ${e} has no field or computed field called that`,`use one of: ${d.join(", ")}`)),u.add(i)};(t.fields??[]).forEach((i,o)=>f(i,`${r}.fields.${o}`));let z=new Set;return(t.groups??[]).forEach((i,o)=>{let p=i.title.trim().toLowerCase();z.has(p)&&a.push(y("page-group-twice",`${r}.groups.${o}.title`,`${e}'s page has two groups called "${i.title}"; give each its own title`)),z.add(p),i.fields.forEach((w,m)=>f(w,`${r}.groups.${o}.fields.${m}`))}),a}function rn(e,s=[]){return Te({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(r=>r.fields)],must:r=>!!e.fields[r].required&&e.fields[r].default===void 0,naming:s})}var wn=new Set(["subject","now","today","me"]);function Sn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>ke)return{findings:[y("too-large","",`a document may be at most ${ke/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=Xe(e).document}catch(t){return{findings:[y("format","formatVersion",t.message)]}}e=He(e);let s=Je.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let a=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return y("unknown-key",a,`${t.keys.map(d=>`"${d}"`).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(a))return y("effect-shape",a,"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 d=t.issues?.[0]?.message;return y("shape",a,`the name "${String(t.path.at(-1))}" is not allowed here${d?`: ${d}`:""}`)}return y("shape",a,t.message)})};let r=s.data;return{document:r,findings:jn(r)}}var ae=e=>[e??[]].flat();function an(e){let s=new Map;for(let[r,t]of Object.entries(e.kinds))for(let[a,d]of Object.entries(ee(t.edges))){let u=s.get(a);s.set(a,{name:a,from:[...u?.from??[],r],to:d.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...d.to])],cardinality:d.cardinality??"many"})}return s}function Et(e){let s=new Map;for(let[t,a]of Object.entries(e.kinds)){let d=ne(a),u=ce(a.edges);s.set(t,{fields:new Set([...Object.keys(a.fields),...u.keys()]),edges:new Map(Object.entries(ee(a.edges)).map(([f,z])=>[f,z.cardinality??"many"])),...d?{computed:d}:{},...u.size>0?{linked:u}:{}})}let r=ne(e);return r&&s.set(_e,{computed:r}),s}function cn(e,s){let r=[],t=ae(e.on),a=(d,u)=>{let f=Qe(s.kinds,d,t)?.reversed===!0,[z,i]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:d,from:z,to:i}:{sever:d,from:z,to:i}};if(e.creates){let d=s.kinds[e.creates],u={};for(let f of Object.keys(d?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&R(f.target)==="new"&&Object.assign(u,f.set);r.push({create:e.creates,as:"new",set:u})}return e.sets&&r.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&r.push({set:Object.fromEntries(e.writes.map(d=>[d,`$${d}`]))}),e.connects&&(e.replaces&&r.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),r.push(a(e.connects,"connect"))),e.severs&&r.push(a(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&r.push({set:e.setsOther,target:"$to"}),e.removes&&r.push({remove:"$subject"}),e.effects&&r.push(...e.effects.filter(d=>!(e.creates&&"set"in d&&!("create"in d)&&R(d.target)==="new"))),r}function we(e,s,r){try{let t=H(e),a=se(t);for(let d of a.unknownFunctions)r.push(y("unknown-function",s,`"${d}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return t}catch(t){if(t instanceof ie){r.push(y("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function Se(e,s,r){try{return J(e)}catch(t){if(t instanceof Be||t instanceof ie){r.push(y("template",s,(t instanceof ie,t.sentence)));return}throw t}}function jn(e){let s=[],r=new Set(Object.keys(e.kinds)),t=an(e),a=e.acts??{},d=new Set(e.roles??[]),u=(i,o)=>ce(e.kinds[i]?.edges).has(o),f=i=>Object.keys(e.kinds).some(o=>u(o,i));for(let[i,o]of Object.entries(e.kinds)){let p=`kinds.${i}`;for(let[m,l]of Object.entries(o.edges??{})){if(!De(l)&&l.to!=="*")for(let c of l.to)r.has(c)||s.push(y("edge-target",`${p}.edges.${m}.to`,`"${c}" is not a kind this document declares`));o.fields[m]&&s.push(y("edge-field-clash",`${p}.edges.${m}`,`"${m}" is both a field and a relation of ${i}`,"rename one of them"))}o.lifecycle&&!o.fields[o.lifecycle.field]&&s.push(y("lifecycle-field",`${p}.lifecycle.field`,`${i} has no field "${o.lifecycle.field}"`));let w=m=>o.computed!==void 0&&Object.hasOwn(o.computed,m);for(let m of o.glance??[])!o.fields[m]&&!w(m)&&s.push(y("glance-field",`${p}.glance`,`a glance at ${i} is to say "${m}", and ${i} has no field or computed field called that`,`use one of: ${[...Object.keys(o.fields),...Object.keys(o.computed??{})].join(", ")}`));s.push(...sn(i,o));for(let m of["label","describe"]){let l=o[m];if(!l)continue;let c=Se(l,`${p}.${m}`,s);for(let j of c??[])if(j.expr){for(let h of se(j.expr).names)if(!o.fields[h]){if(w(h)){Ze(o,h)||s.push(y("template-field",`${p}.${m}`,`${i}'s ${h} 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 ${i}'s own fields`));continue}s.push(y("template-field",`${p}.${m}`,`${i} has no field "${h}" 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,l]of Object.entries(o.fields)){l.default!==void 0&&l.type==="enum"&&!l.options?.includes(String(l.default))&&s.push(y("default-option",`${p}.fields.${m}.default`,`"${String(l.default)}" is not one of ${m}'s options`));let c=`${m}Repeat`;l.repeats&&(o.fields[c]||o.edges?.[c]||o.computed?.[c])&&s.push(y("repeat-clash",`${p}.fields.${m}.repeats`,`${i} already has "${c}", where how ${m} repeats is kept`))}}for(let[i,o]of Object.entries(a)){let p=`acts.${i}`;for(let c of ae(o.on))r.has(c)||s.push(y("act-kind",`${p}.on`,`"${c}" is not a kind this document declares`));let w=ae(o.on),m=cn(o,e);if(o.creates&&o.on===void 0&&o.writes&&r.has(o.creates)){for(let c of o.writes)if(!e.kinds[o.creates].fields[c])if(e.kinds[o.creates].computed?.[c]!==void 0)s.push(y("computed-written",`${p}.writes`,`${o.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(o.creates,c))continue;s.push(y("act-field",`${p}.writes`,`${o.creates} has no field "${c}"`))}}m.length===0&&s.push(y("act-empty",p,`"${i}" does nothing`,"give it effects or a shorthand such as sets or creates"));let l=new Map;m.forEach((c,j)=>{let h=m.length-(o.effects?.length??0),S=o.effects&&j>=h?`${p}.effects.${j-h}`:p;if("create"in c){if(!r.has(c.create))s.push(y("act-kind",`${S}.create`,`"${c.create}" is not a kind this document declares`));else for(let b of Object.keys(c.set??{}))e.kinds[c.create].fields[b]||(e.kinds[c.create].computed?.[b]!==void 0?s.push(y("computed-written",`${S}.set.${b}`,`${c.create}'s ${b} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(y("act-field",`${S}.set.${b}`,`${c.create} has no field "${b}"`)));c.as&&l.set(c.as,c.create)}else if("connect"in c||"sever"in c){let b="connect"in c?c.connect:c.sever;!t.has(b)&&!f(b)&&s.push(y("act-edge",`${S}.${"connect"in c?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),R(c.from)==="subject"&&w.length===0&&s.push(y("act-subject",`${p}.on`,`"${i}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in c){let b=R(c.target??"$subject"),G=b==="subject"?w:l.has(b??"")?[l.get(b)]:[];b==="subject"&&w.length===0&&s.push(y("act-subject",`${p}.on`,`"${i}" changes "$subject" but does not say which kinds it is "on"`));for(let F of Object.keys(c.set))for(let g of G)if(!(!r.has(g)||e.kinds[g].fields[F]))if(e.kinds[g].computed?.[F]!==void 0)s.push(y("computed-written",`${S}.set.${F}`,`${g}'s ${F} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(g,F))continue;s.push(y("act-field",`${S}.set.${F}`,`${g} has no field "${F}"`))}}else"remove"in c&&R(c.remove)==="subject"&&w.length===0&&s.push(y("act-subject",`${p}.on`,`"${i}" removes "$subject" but does not say which kinds it is "on"`));("set"in c&&c.set?Object.values(c.set):[]).forEach(b=>{b&&typeof b=="object"&&!Array.isArray(b)&&"expr"in b&&we(b.expr,`${S}.set`,s)})}),o.allowedWhen&&we(o.allowedWhen,`${p}.allowedWhen`,s),o.refusal&&Se(o.refusal,`${p}.refusal`,s)}for(let[i,o]of Object.entries(e.rules??{})){let p=`rules.${i}`;o.over!=="graph"&&!r.has(o.over)&&s.push(y("rule-kind",`${p}.over`,`"${o.over}" is not a kind this document declares`));let w=o.over==="graph"?void 0:e.kinds[o.over];for(let m of["when","require"]){let l=o[m];if(!l)continue;let c=we(l,`${p}.${m}`,s);if(!c)continue;let j=se(c);for(let h of j.names)if(o.over==="graph")s.push(y("rule-name",`${p}.${m}`,`"${h}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(w&&!w.fields[h]&&!w.edges?.[h]&&w.computed?.[h]===void 0){let S=Object.keys(w.edges??{}).find(A=>A.includes("-")&&A.split("-").includes(h));s.push(y("rule-name",`${p}.${m}`,`${o.over} has no field or relation called "${h}"`,S?`"${S}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${S.replace(/-([a-z0-9])/g,(A,b)=>b.toUpperCase())}"`:void 0))}for(let h of j.edges)!t.has(h)&&!f(h)&&s.push(y("rule-edge",`${p}.${m}`,`"${h}" is not a relation any kind declares`));for(let h of j.sweeps)r.has(h)?o.over!=="graph"&&s.push(Ne("rule-cost",`${p}.${m}`,`this rule looks at every ${h} for every ${o.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(y("rule-kind",`${p}.${m}`,`"${h}" is not a kind this document declares`))}o.says&&Se(o.says,`${p}.says`,s),(o.repairs??[]).forEach((m,l)=>{!a[m.act]&&!de(m.act)&&!me(m.act,e.kinds)&&s.push(y("repair-act",`${p}.repairs.${l}.act`,`"${m.act}" is not an act this document declares`,ge(m.act,e)))})}let z=e.policy;return z&&(z.grants.forEach((i,o)=>{if(i.roles!=="*"&&d.size>0)for(let p of i.roles)d.has(p)||s.push(y("grant-role",`policy.grants.${o}.roles`,`"${p}" is not one of the document's roles`));if(i.mutations!=="*")for(let p of i.mutations)!a[p]&&!de(p)&&!me(p,e.kinds)&&s.push(y("grant-act",`policy.grants.${o}.mutations`,`"${p}" is not an act this document declares`,ge(p,e)))}),(z.sees??[]).forEach((i,o)=>{for(let p of i.kinds)r.has(p)||s.push(y("sight-kind",`policy.sees.${o}.kinds`,`"${p}" is not a kind this document declares`));if(i.roles!=="*"&&d.size>0)for(let p of i.roles)d.has(p)||s.push(y("sight-role",`policy.sees.${o}.roles`,`"${p}" is not one of the document's roles`))})),s.push(...We(e)),s}function On(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[fe(e)??[]].flat()}function vn(e,s,r,t){let a=new Map,d=ae(e.on),u=new Map,f=new Map;(d.length>0||s.some(l=>"remove"in l&&R(l.remove)==="subject"||"from"in l&&(R(l.from)==="subject"||R(l.to)==="subject")||"set"in l&&!("create"in l)&&R(l.target??"$subject")==="subject"))&&a.set(pe,{ref:d.length>0?d:"*",required:!0});let i=e.args??{},o=e.writes?.length===1,p=(l,c)=>c&&l.type===c.type&&l.min===void 0&&l.max===void 0&&l.step===void 0?{...l,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:l,w=(l,c)=>c&&l.type===c.type&&l.format===void 0&&l.unit===void 0?{...p(l,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:p(l,c),m=(l,c,j)=>{if(l===pe||wn.has(l)||u.has(l)||a.has(l))return;let h=i[l]?w(i[l],j):void 0;a.set(l,h?{field:h,optional:!h.required,required:!!h.required}:c())};for(let l of s)if("create"in l){let c=r.kinds[l.create],j=c?rn(c,On(c)):[],h=S=>j.includes(S)?j.indexOf(S):j.length;for(let[S,A]of Object.entries(l.set??{}).sort(([b],[G])=>h(b)-h(G))){let b=R(A),G=c?.fields[S];if(b&&G){let F=!!G.required&&G.default===void 0;m(b,()=>({field:G,optional:!F,required:F}),G)}}l.as&&u.set(l.as,l.create)}else if("connect"in l||"sever"in l){let c=t.get("connect"in l?l.connect:l.sever);for(let[j,h]of[["from",l.from],["to",l.to]]){let S=R(h);if(!S)continue;let A=j==="to"?c?.to??"*":c?.from??"*";A!=="*"&&!f.has(S)&&f.set(S,A),m(S,()=>({ref:A,required:!0}))}}else if("set"in l){let c=R(l.target??"$subject"),j=c==="subject"?d[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[h,S]of Object.entries(l.set)){let A=R(S);if(!A)continue;let b=j?r.kinds[j]?.fields[h]:void 0;m(A,()=>b?{field:b,optional:!o,required:o}:{any:!0,required:!1},b)}}else if("remove"in l){let c=R(l.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[l,c]of Object.entries(i))a.has(l)||a.set(l,{field:c,optional:!c.required,required:!!c.required});return a}function At(e,s={}){let r=Sn(e);if(!r.document||le(r.findings))return{ok:!1,findings:r.findings};let t=r.document,a=[...r.findings];s.previous&&a.push(...En(t,s.previous));let d=xn(t,a);return le(d.findings)?{ok:!1,findings:d.findings}:Ve(d,s)}function re(e,s){return e.map(r=>{let t=!r.format&&r.expr?.t==="ident"?s?.[r.expr.name]?.format:void 0;return t==="money"||t==="percent"?{...r,format:t}:r})}function xn(e,s){let r=an(e),t={};for(let[i,o]of Object.entries(e.kinds)){let p=fe(o),w=o.label??(p?`{${p}}`:void 0),m=ne(o),l=m?on(e,i,[...m]):[];t[i]={...w?{label:re(J(w),o.fields)}:{},...o.describe?{describe:re(J(o.describe),o.fields)}:{},...m?{computed:[...m]}:{},...l.length>0?{durations:l}:{}}}let a={};for(let[i,o]of Object.entries(e.acts??{})){let p=cn(o,e),w=vn(o,p,e,r),m=o.destructive??p.some(g=>"remove"in g||"sever"in g||"replace"in g),l=[...new Set(p.flatMap(g=>"create"in g?[g.create]:[]))],c=[...new Set(p.flatMap(g=>"connect"in g?[g.connect]:[]))],j=[...new Set(p.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],h=[...new Set(p.flatMap(g=>"set"in g&&!("create"in g)&&R(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],S=new Map;for(let g of p){if(!("connect"in g)&&!("sever"in g))continue;let v=r.get("connect"in g?g.connect:g.sever);for(let[D,oe]of[["from",g.from],["to",g.to]]){let B=R(oe),Y=D==="to"?v?.to:v?.from;B&&B!=="subject"&&Y&&Y!=="*"&&S.set(B,[...new Set([...S.get(B)??[],...Y])])}}let A={};for(let g of p){if(!("set"in g)||"create"in g)continue;let v=R(g.target??"$subject");for(let D of v&&v!=="subject"&&S.get(v)||[])A[D]=[...new Set([...A[D]??[],...Object.keys(g.set)])]}let b={};for(let g of p)if(!(!("set"in g)||"create"in g||R(g.target??"$subject")!=="subject"))for(let[v,D]of Object.entries(g.set??{}))typeof D=="string"&&R(D)===void 0||typeof D=="number"||typeof D=="boolean"?b[v]=typeof D=="string"&&D.startsWith("$$")?D.slice(1):D:delete b[v];let G=l.length===0&&p.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(v=>!(v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v))),F=new Map;for(let g of p)if(!(!("set"in g)||!g.set))for(let v of Object.values(g.set))v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v&&F.set(v.expr,H(v.expr));a[i]={title:o.title??i.replace(/-/g," "),effects:p,args:[...w],...o.allowedWhen?{guard:H(o.allowedWhen)}:{},...o.refusal?{refusal:re(J(o.refusal),e.kinds[[o.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...F],destructive:m,idempotent:G,creates:l,connects:c,severs:j,writes:h,writesOther:A,sets:b}}let d={};for(let[i,o]of Object.entries(e.rules??{}))d[i]={title:o.title??i.replace(/-/g," "),require:H(o.require),...o.when?{when:H(o.when)}:{},...o.says?{says:re(J(o.says),e.kinds[o.over]?.fields)}:{}};let u=qe(e,s),f=Le(e),z=Ue(e);return{format:Ie,document:e,findings:s,kinds:t,...e.computed?{facts:[...ne(e)??[]]}:{},edges:[...r].map(([i,{from:o,to:p,cardinality:w}])=>[i,{from:o,to:p,cardinality:w}]),acts:a,rules:d,brand:u,...Object.keys(f).length>0?{viewSpecs:f}:{},...z?{home:z}:{}}}function Rt(e,s,r){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],a=t?r.kinds[t]:void 0;if(!t||!a)return e;let d=Object.keys(a.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${d.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function En(e,s){let r=[],t=new Set(Object.values(s.kinds).flatMap(a=>Object.keys(a.edges??{})));for(let[a,d]of Object.entries(e.kinds)){let u=d.renamedFrom;u&&!s.kinds[u]&&r.push(y("renamed-from-nothing",`kinds.${a}.renamedFrom`,`${a} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??a];for(let[z,i]of Object.entries(d.fields)){let o=i.renamedFrom;o&&!f?.fields[o]&&r.push(y("renamed-from-nothing",`kinds.${a}.fields.${z}.renamedFrom`,`${z} says it was ${o}, and the previous ${u??a} has no field called ${o}`,"name the field it was, or drop renamedFrom"))}for(let[z,i]of Object.entries(d.edges??{})){let o=i.renamedFrom;o&&!t.has(o)&&r.push(y("renamed-from-nothing",`kinds.${a}.edges.${z}.renamedFrom`,`${z} says it was ${o}, and the previous version has no relation called ${o}`,"name the relation it was, or drop renamedFrom"))}}return r}export{Sn as a,Et as b,cn as c,At as d,Rt as e};
@@ -1,18 +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{A as zt,B as Re,C as ri,D as Ze,E as me,F as Wn,G as De,H as Ue,I as ii,J as Kn,K as Le,L as oi,M as si,N as O,O as pt,P as wt,Q as li,R as vt,S as Qt,T as di,U as te,V as Zt,W as ie,X as Bn,a as U,b as ve,c as _,d as jt,e as Hn,f as In,g as ct,h as X,i as we,j as re,k as C,l as ee,m as G,n as qe,o as Se,p as _t,q as ke,r as ce,s as ti,t as ht,u as ni,v as Fn,w as Dn,x as Y,y as Fe,z as ai}from"./chunk.CDZVUCEK.js";import{a as Ie}from"./chunk.UDTBFAS5.js";import{a as Qe,b as Yt,d as Q}from"./chunk.QAUZDLDA.js";import{b as Nn,c as Jr,d as ei}from"./chunk.3SY6WWWQ.js";import{a as Qr,d as Zr,e as Xr}from"./chunk.UGFDSE37.js";import{a as Ur,c as Vr,f as jr,g as _r,i as zr,j as Yr}from"./chunk.ATWNWPME.js";import{a as Nr,b as Hr,c as Ir,d as On}from"./chunk.GZEZMU2T.js";import{b as Or}from"./chunk.4VJARLJ5.js";import{a as Fr,b as Dr,d as Gt,e as Wr,f as Kr,g as Br,j as qt}from"./chunk.5RNB6IC5.js";import{a as Ut,b as Vt}from"./chunk.PXQVXBNG.js";import{a as Ht,b as za,c as Ya,d as It,e as Qa}from"./chunk.FFPG4PHX.js";import{b as ar,c as mr,e as fr,f as Tn}from"./chunk.3L5USMQD.js";import{a as Ln,b as gr}from"./chunk.GTUBIJTP.js";import{a as Kt,b as Bt,c as Mr,e as Er}from"./chunk.OKQ4JXTW.js";import{a as dt,b as pr,e as ur}from"./chunk.M5RHVUZ6.js";import{m as $r}from"./chunk.OUNLAMBA.js";import{a as hr,b as wr,c as vr,e as Tr,f as $n,h as Wt}from"./chunk.QSZLY62B.js";import{d as br,e as xr,f as Pr,g as Cr,n as Ar,o as Rr,q as Lr,s as Dt}from"./chunk.7VX6TBNY.js";import{a as Mn}from"./chunk.L5MDUZLQ.js";import{a as An,b as tr,c as nr}from"./chunk.IDQHSAAQ.js";import{a as yr}from"./chunk.CR5MQMOL.js";import{c as ir,d as or,e as sr,f as lr,k as yt,l as dr}from"./chunk.6SHF6IL5.js";import{a as rr}from"./chunk.MQISKON2.js";import{r as Rn,s as cr}from"./chunk.JLR74UFP.js";import{b as Za,c as Xa,d as Ja,e as er,l as Ft}from"./chunk.UCS3CBT4.js";import{C as En,K as Gr,N as qr,e as ja,f as _a,j as Zi,u as Sr,v as kr}from"./chunk.ZK446PSX.js";import{$ as Ka,G as He,L as Ha,N as Ia,Oa as Va,R as Fa,S as B,T as Cn,W as Da,X as Wa,aa as de,da as Ba,ea as Ga,ga as qa,ka as lt,ma as Ua,oa as Ot,r as Na,v as Ne,za as Nt}from"./chunk.SGMVLKZO.js";import{a as Oa}from"./chunk.SDO3U72B.js";import{$a as Pa,Dd as $a,Hc as Ta,J as wa,U as ft,Za as xa,ca as st,da as ge,dc as Aa,fa as ze,ga as Tt,gd as xn,ia as Ge,ic as Ra,ka as va,kb as bn,kc as La,la as Sa,lb as Ca,ld as Et,ma as Ye,md as Ma,od as $t,tb as Mt,xa as ka,xd as Pn,ya as ba,yd as Ea}from"./chunk.BLS2G3CD.js";import{b as H}from"./chunk.AJZBJBMO.js";function ci(e,t,n={}){let a=e.graph.getNode(t);if(!a)return;let r=e.schema.tryDefinition(a.kind),i=l=>ge(e.schema.tryDefinition(l.kind),l),d=new Map;for(let l of e.graph.allEdges()){let s=l.from===t?"out":l.to===t?"in":null;if(!s)continue;let c=s==="out"?l.to:l.from,m=e.graph.getNode(c);if(!m)continue;let w=(s==="out"?r:e.schema.tryDefinition(m.kind))?.edges?.[l.kind],g=s==="in"?w?.inverse??w?.description:w?.description,x=`${l.kind}|${s}|${g??""}`;(d.get(x)??(()=>{let q={edgeKind:l.kind,direction:s,...g?{description:g}:{},targets:[]};return d.set(x,q),q})()).targets.push({id:m.id,kind:m.kind,label:i(m)})}return{id:t,kind:a.kind,label:i(a),fields:Ja(yt(e.schema,e.graph,a),r),violations:bn(e.violations(n.context),[t]),actions:Mn(e,[t],{focus:t,...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}}),links:[...d.values()].map(l=>{let s=Za(l.targets.flatMap(c=>{let m=e.graph.getNode(c.id);return m?[m]:[]}),c=>e.schema.tryDefinition(c));return{...l,targets:[...l.targets].map(c=>s.has(c.id)?{...c,apart:s.get(c.id)}:c).sort((c,m)=>c.label.localeCompare(m.label))}})}}function Xe(e,t,n={}){return{kind:t,members:e.graph.nodesOfKind(t),actions:Mn(e,[],{kindSelection:[t],...n.principal?{principal:n.principal}:{},...n.context?{context:n.context}:{}})}}function pi(e,t){let n=(i,d)=>`${i}|${JSON.stringify(d)}`,a=new Map;for(let i of[...e.affordances,...e.withheld]){if(i.provider!=="invariant")continue;let d=n(i.mutation,i.args);a.has(d)||a.set(d,i.rank??Number.MAX_SAFE_INTEGER)}let r=Number.MAX_SAFE_INTEGER;return[...t].map((i,d)=>({repair:i,declared:d})).sort((i,d)=>(a.get(n(i.repair.mutation,i.repair.args??{}))??r)-(a.get(n(d.repair.mutation,d.repair.args??{}))??r)||i.declared-d.declared).map(i=>i.repair)}function Je(e){let t=e.schema.kinds.map(r=>({kind:r,plural:Ge(e.schema,r),count:e.graph.nodesOfKind(r).length})),n=new Map;for(let r of e.graph.allEdges()){let i=e.graph.getNode(r.from),d=e.graph.getNode(r.to);if(!i||!d)continue;let l=`${r.kind}|${i.kind}|${d.kind}`;n.set(l,(n.get(l)??0)+1)}let a=[];for(let{kind:r}of t){let i=e.schema.tryDefinition(r)?.edges??{};for(let[d,l]of Object.entries(i)){let s=l.to==="*"||l.to===void 0?(()=>{let c=[...n.keys()].filter(m=>m.startsWith(`${d}|${r}|`)).map(m=>m.split("|")[2]);return c.length>0?c:["*"]})():l.to;for(let c of s)a.push({edgeKind:d,from:r,to:c,...l.description?{description:l.description}:{},...l.inverse?{inverse:l.inverse}:{},count:n.get(`${d}|${r}|${c}`)??0})}}return{kinds:t,relations:a}}var We=H(He(),1);var St=H(He(),1);var Te=H(B(),1),Ji={problems:"Problems",search:"Search",map:"Connections",places:"Pictures","~draft":"A view drawn"},eo=e=>{try{return decodeURIComponent(e)}catch{return e}};function to(e,t,n={}){let{store:a}=e,r=a.schema,i=(n.base??"").replace(/\/$/,""),[d="/",l=""]=t.split("#")[0].split("?"),s=(u,M,j)=>({label:u,href:`${i}${M}`,path:M,...j?{current:j}:{}}),c=u=>{let M=n.registry?.sectionOf(u);return M?[M.path===void 0?{label:M.label}:s(M.label,M.path)]:[]},m=u=>n.registry?.sectionOf(u)?.label,v=u=>{let M=m(u);return M===void 0?{}:{section:M}},[w,g,...x]=d.split("/").filter(Boolean).map(eo);if(w===void 0)return{as:"home",label:"Home",trail:[s("Home","/",!0)]};if(w==="places"&&g!==void 0&&x.length===0){let u=new URLSearchParams(l).get("of"),M=new Set(Fe(a,e.principal)),j=e.views?.places()??[],P=j.find(D=>M.has(D.kind)&&D.as===g&&(!u||U(r,D.kind)===u));if(P){let D=jt(P.as,Et(P,j)?U(r,P.kind):void 0);return{as:"place",kind:P.kind,label:P.title,...v(P.kind),trail:[...c(P.kind),s(P.title,D,!0)]}}}let N=x.length===0?ve(r,w):void 0;if(N!==void 0){let u=s(Ge(r,N),`/${U(r,N)}`);if(g===void 0)return{as:"list",kind:N,label:u.label,...v(N),trail:[...c(N),{...u,current:!0}]};let M=a.graph.getNode(g),j=M&&M.kind===N?ge(r.tryDefinition(N),M):"Nothing lives here";return{as:"record",kind:N,id:g,label:j,...v(N),trail:[...c(N),u,s(j,_(r,N,g),!0)]}}let q=Ji[w]??no((x.at(-1)??g??w).replace(/[-_]+/g," "));return{as:"page",label:q,trail:[s(q,d,!0)]}}var no=e=>e.charAt(0).toUpperCase()+e.slice(1),Gn=(0,St.createContext)(null);function ao(e){let t=me(),n=Ze("/");return Q(e.context.store),to(e.context,`${t.pathname}${t.search}`,{registry:e.registry,base:n})}var ro={position:"absolute",width:1,height:1,margin:-1,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(50%)",whiteSpace:"nowrap",border:0},ui={display:"flex",alignItems:"center",gap:6,minWidth:0},gi={display:"block",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0,lineHeight:"24px"};function ut({context:e,style:t}){let n=(0,St.useContext)(Gn),a=(0,St.useContext)(wt);return vt(a??oo,"trail")||n?.registry?.without().has("trail")?null:(0,Te.jsx)(io,{root:n??{context:e,registry:void 0},context:e,...t?{style:t}:{}})}function io({root:e,context:t,style:n}){let a=ao(e);return a.trail.length<2?null:(0,Te.jsx)(so,{here:a,mark:a.as==="record"?{kind:a.kind,context:t}:void 0,...n?{style:n}:{},"data-testid":"page-trail"})}var oo={count:()=>0,place:()=>()=>{},subscribe:()=>()=>{}};function so({here:e,mark:t,style:n,...a}){let r=e.as==="record"?e.trail.length-2:-1;return(0,Te.jsx)("nav",{"aria-label":"You are here","data-graview-trail":"",style:{minWidth:0,...n},...a,children:(0,Te.jsx)("ol",{style:{...we,listStyle:"none",padding:0,display:"flex",alignItems:"center",gap:6,minWidth:0,overflow:"hidden"},children:e.trail.map((i,d)=>(0,Te.jsxs)("li",{style:i.current?ro:{...ui,flexShrink:d===e.trail.length-2?0:1,maxWidth:"100%"},...i.current?{"aria-current":"page"}:{},children:[d>0&&!i.current?(0,Te.jsx)("span",{"aria-hidden":"true",children:"\u203A"}):null,i.current?i.label:i.path!==void 0?(0,Te.jsxs)(O,{to:i.path,style:{...Se,...ui},...d===r?{"data-testid":"trail-list"}:{},children:[d===r&&t?(0,Te.jsx)(ce,{kind:t.kind,brand:t.context.brand,schema:t.context.store.schema,size:8}):null,(0,Te.jsx)("span",{style:gi,children:i.label})]}):(0,Te.jsx)("span",{style:gi,children:i.label})]},`${d}:${i.label}`))})})}var A=H(B(),1);function $e(e){let t=e.views;if(!t)return[];let n=new Set(Fe(e.store,e.principal));return t.places().filter(a=>n.has(a.kind))}function Xt(e,t){if(!t.over)return[t.kind];let n=new Set(Fe(e.store,e.principal));return t.over.filter(a=>a===t.kind||n.has(a))}var et=e=>`place:${e.kind}:${e.as}`;function fe(e,t){return jt(t.as,Et(t,e.views?.places()??[])?U(e.store.schema,t.kind):void 0)}function kt(e,t){let n=e.schema.tryDefinition(t);return e.graph.nodesOfKind(t).filter(a=>st(n,a))}function qn(e,t,n){let a=(i,d)=>Tt(e.schema,d,i),r=(typeof t=="string"?[t]:t).map(i=>a(kt(e,i).length,i)).join(" and ");return n?`${r} across ${a(kt(e,n).length,n)}`:r}function Un({context:e,place:t,chosen:n,filter:a}){let{store:r,views:i,invariantContext:d}=e,s=i?.resolve(t.kind,{cardinality:"many",fidelity:"full"},t.as)?.view,c=[...new Set(r.violations(d).flatMap(w=>w.nodeIds))],m=Xt(e,t).flatMap(w=>kt(r,w));if(!s)return null;let v=lo(r,m,a,c);return(0,A.jsx)(Rn,{kind:t.kind,view:t.title,children:(0,A.jsx)(s,{nodes:v,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...n&&n.length>0?{implicated:n}:{},...c.length>0?{flagged:c}:{}})})}function lo(e,t,n,a){let r=n?$t({filter:n}).filter??[]:[];return r.length===0?t:Wt(t,{filter:r},{schema:e.schema,graph:e.graph,flagged:new Set(a)}).nodes}function co({store:e,views:t,as:n,invariantContext:a}){Q(e);let r={store:e,views:t,...a?{invariantContext:a}:{}},i=t.places().find(d=>d.as===n);return i?(0,A.jsx)(Un,{context:r,place:i}):null}function po({context:e,kind:t}){let{store:n,views:a,invariantContext:r}=e,i=kt(n,t),d=n.schema.tryDefinition(t),l=Y(n,t),c=a?.resolve(t,{cardinality:"many",fidelity:"full"})?.view,m=[...new Set(n.violations(r).flatMap(x=>x.nodeIds))];if(c&&!lt(c))return(0,A.jsx)(Rn,{kind:t,children:(0,A.jsx)(c,{nodes:i,label:l,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...m.length>0?{flagged:m}:{}})});let v=a?.resolve(t,{cardinality:"one",fidelity:"summary"})?.view,w=8,g=i.slice(0,w);return(0,A.jsxs)("div",{"data-testid":"kind-sheet",style:v?{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gridAutoRows:"max-content",alignContent:"center",gap:12,padding:24}:{display:"flex",flexWrap:"wrap",alignContent:"center",justifyContent:"center",gap:10,padding:24},children:[g.map(x=>v?(0,A.jsx)(v,{node:x,fidelity:"summary",cardinality:"one",mode:"fullscreen",selected:!1,...m.includes(x.id)?{flagged:[x.id]}:{}},x.id):(0,A.jsx)("span",{style:{padding:"8px 14px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:ge(d,x)},x.id)),i.length>w?(0,A.jsxs)("span",{style:{...C,alignSelf:"center",padding:"0 6px"},children:["+",i.length-w," more ",l.toLowerCase()]}):null]})}function Vn(e){let{store:t}=e,n=ai(e),a=$e(e),r=e.views?.arrangement?.()?.order??[],i=s=>{let c=s.name===void 0?-1:r.indexOf(`view:${s.name}`);return c>=0?c-r.length:n.indexOf(s.kind)},d=xn([...a].sort((s,c)=>i(s)-i(c))).filter(s=>!s.hidden),l=new Set(d.flatMap(s=>s.over??[s.kind]));return[...d.map(s=>({key:et(s),kind:s.kind,title:Ma(s,a,t.schema),to:fe(e,s),place:s})),...zt(e).filter(s=>!l.has(s)).map(s=>({key:`kind:${s}`,kind:s,title:Y(t,s),to:`/${U(t.schema,s)}`}))]}var mi=.72,uo=540,fi=16/10;function go(e){let t=(0,We.useRef)(null),[n,a]=(0,We.useState)(e);return(0,We.useLayoutEffect)(()=>{let r=t.current;if(!r||typeof ResizeObserver>"u")return;let i=()=>{let l=r.getBoundingClientRect().width;l>0&&a(s=>Math.abs(s-l)<.5?s:l)};i();let d=new ResizeObserver(i);return d.observe(r),()=>d.disconnect()},[]),{ref:t,width:n}}function mo(e){for(let t=e.parentElement;t;t=t.parentElement)if(/(auto|scroll)/.test(getComputedStyle(t).overflowY))return t;return null}function fo(e){let[t,n]=(0,We.useState)(()=>typeof IntersectionObserver>"u");return(0,We.useLayoutEffect)(()=>{let a=e.current;if(t||!a)return;let r=new IntersectionObserver(i=>{i.some(d=>d.isIntersecting)&&(r.disconnect(),n(!0))},{root:mo(a),rootMargin:"50% 0px"});return r.observe(a),()=>r.disconnect()},[t,e]),t}function jn({context:e,entry:t}){let{store:n,brand:a,principal:r}=e,{ref:i,width:d}=go(uo),l=fo(i),s=d/mi,c=kt(n,t.kind),m=n.schema.tryDefinition(t.kind),v=c.length===0?Xe(n,t.kind,{...r?{principal:r}:{},...e.invariantContext?{context:e.invariantContext}:{}}).actions.affordances[0]:void 0,w=t.place!==void 0;return(0,A.jsxs)(O,{to:t.to,"data-testid":w?"place-card":"kind-card",className:"graview-gallery-card",style:{...Se,display:"grid",gap:10,alignContent:"start",minWidth:0},children:[(0,A.jsxs)("span",{ref:i,"data-testid":w?"place-picture":"kind-picture","aria-hidden":"true",inert:!0,style:{display:"block",position:"relative",width:"100%",aspectRatio:`${fi}`,overflow:"hidden",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",pointerEvents:"none"},children:[(0,A.jsx)("span",{style:{position:"absolute",left:0,top:0,width:s,height:s/fi,display:"grid",gridTemplateRows:"minmax(0, 1fr)",transform:`scale(${mi})`,transformOrigin:"0 0"},children:l?(0,A.jsx)(Gt.Provider,{value:null,children:t.place?(0,A.jsx)(Un,{context:e,place:t.place}):(0,A.jsx)(po,{context:e,kind:t.kind})}):null}),c.length===0?(0,A.jsx)("span",{"data-testid":"picture-empty",style:{position:"absolute",inset:0,display:"grid",placeContent:"center",justifyItems:"center",gap:2,padding:20,textAlign:"center"},children:(0,A.jsxs)("span",{style:{display:"grid",gap:2,padding:"10px 16px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-ground)",color:"var(--graview-ink)"},children:[(0,A.jsxs)("span",{style:{fontFamily:In,fontWeight:"var(--graview-weight-display)"},children:["No ",Y(n,t.kind).toLowerCase()," yet"]}),v?(0,A.jsxs)("span",{style:C,children:["Begin with \u201C",v.label,"\u201D"]}):null]})}):null]}),(0,A.jsxs)("span",{style:{display:"grid",gap:2,minWidth:0},children:[(0,A.jsxs)("span",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[w?null:(0,A.jsx)(ce,{kind:t.kind,brand:a,schema:n.schema,size:8}),(0,A.jsx)("span",{style:{fontFamily:In,fontSize:"var(--graview-text-heading)",fontWeight:"var(--graview-weight-display)",lineHeight:1.3,overflowWrap:"anywhere",textWrap:"balance"},children:t.title})]}),(0,A.jsxs)("span",{style:C,children:[t.place?qn(n,Xt(e,t.place),t.place.across):qn(n,t.kind),!w&&m?.description?` \xB7 ${m.description}`:null]})]})]})}var yi={display:"grid",gap:"32px 28px",gridTemplateColumns:"repeat(auto-fill, minmax(min(420px, 100%), 1fr))"},yo=`
2
- .graview-gallery-card > span:first-child { transition: border-color 160ms ease, box-shadow 160ms ease; }
3
- .graview-gallery-card:hover > span:first-child,
4
- .graview-gallery-card:focus-visible > span:first-child { border-color: var(--graview-edge-bright); box-shadow: 0 1px 0 var(--graview-edge), 0 10px 30px -18px var(--graview-ink); }
5
- `;function _n({context:e}){Q(e.store);let t=Vn(e);return t.length===0?null:(0,A.jsxs)("section",{style:yi,"data-testid":"gallery",children:[(0,A.jsx)("style",{children:yo}),t.map(n=>(0,A.jsx)(jn,{context:e,entry:n},n.key))]})}function zn({context:e}){let{store:t}=e;Q(t);let n=xn($e(e)).filter(r=>!r.hidden),a=Vn(e);return(0,A.jsxs)(te,{context:e,style:ct,children:[(0,A.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,A.jsx)("p",{style:we,children:n.length===0?"None of its own yet":`${n.length} ${n.length===1?"picture":"pictures"}`}),(0,A.jsx)(ie,{context:e,children:"Pictures"}),(0,A.jsx)("p",{style:re,children:n.length===0?"Nothing here has a picture of its own yet, so each kind is drawn as the scene draws it. Title a group view and it appears here by name.":"The ways this installation looks at what it holds \u2014 each one the same picture the scene shows, here as a page."})]}),a.length>0?(0,A.jsx)("div",{style:yi,"data-testid":"places",children:a.map(r=>(0,A.jsx)(jn,{context:e,entry:r},r.key))}):null]})}var ho={lede:!0},wo={lede:!1},vo={...re,textWrap:"pretty"};function So(e,t){if(t===void 0)return;let[n]=lr(sr([t]),dr(e.store,null,null,e.brand?{money:e.brand}:{}));return n?.t==="headline"&&!n.problem&&n.text.trim()!==""?n.text:void 0}function Yn({context:e}){let{store:t,principal:n}=e;Q(t);let a=Ue(),r=De(),[i]=pt(),d=decodeURIComponent(a.as??""),[l,s]=(0,We.useState)(null),c=i.get("of"),m=i.get("filter"),w=$e(e).find(P=>P.as===d&&(!c||U(t.schema,P.kind)===c));if(!w)return(0,A.jsxs)(te,{context:e,children:[(0,A.jsx)(ie,{context:e,children:"No picture is called that."}),(0,A.jsx)("p",{style:re,children:(0,A.jsx)(O,{to:"/places",style:qe,children:(0,A.jsx)(Qe,{children:"The pictures there are"})})})]});let g=Y(t,w.kind),x=e.views?.resolve(w.kind,{cardinality:"many",fidelity:"full"},w.as)?.view,N=x?.flows===!0,q=x?.creates!==!1,u=So(e,x?.lede),M=Xe(t,w.kind,{...n?{principal:n}:{},...e.invariantContext?{context:e.invariantContext}:{}}),j=q?M.actions.affordances.map(P=>({affordance:P,mutation:t.allMutations().find(D=>D.name===P.mutation)})).filter(P=>P.mutation!==void 0):[];return(0,A.jsxs)(te,{context:e,style:{...ct,gap:"var(--graview-space-6, 32px)"},children:[(0,A.jsxs)("header",{style:{display:"grid",gap:"var(--graview-space-2, 8px)"},children:[(0,A.jsx)(ut,{context:e}),(0,A.jsx)(ie,{context:e,children:w.title}),(0,A.jsx)("p",{style:vo,"data-testid":"place-lede",...u!==void 0?{"data-graview-lede":"headline"}:{},children:u??`${qn(t,Xt(e,w),w.across)}.`}),m&&!N?(0,A.jsxs)("p",{style:{...C,margin:0},"data-testid":"place-narrowed",children:[`Only those where ${m.split(",").map(P=>P.replace(":"," is ")).join(" and ")}. `,(0,A.jsx)(O,{to:`?${(()=>{let P=new URLSearchParams(i);return P.delete("filter"),P.toString()})()}`,style:{...G,...C},children:"Show all"})]}):null,(0,A.jsx)("p",{style:{...C,margin:0,display:"flex",flexWrap:"wrap",gap:"4px 16px"},children:Xt(e,w).map((P,D)=>(0,A.jsx)(O,{to:`/${U(t.schema,P)}`,style:{...qe,...C},...D===0?{"data-testid":"place-as-list"}:{},children:(0,A.jsxs)(Qe,{children:["All ",(P===w.kind?g:Y(t,P)).toLowerCase()," as a list"]})},P))})]}),(0,A.jsx)("div",{"data-testid":"place-lens","data-flows":N?"":void 0,...N?{}:{role:"group","aria-label":w.title,tabIndex:0},style:N?{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",maxWidth:"100%"}:{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",maxWidth:"100%",borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},onClick:P=>{let D=P.target?.closest("[data-graview-pick]"),ae=D?.getAttribute("data-graview-pick"),oe=D?.getAttribute("data-graview-joins");if(oe)try{let J=JSON.parse(oe);if(Array.isArray(J)&&J.every(ue=>typeof ue=="string")){P.preventDefault(),s({at:et(w),ids:J});return}}catch{}if(!ae)return;let he=t.graph.getNode(ae);he&&(P.preventDefault(),r(_(t.schema,he.kind,ae)))},children:(0,A.jsx)(Br.Provider,{value:u!==void 0?ho:wo,children:(0,A.jsx)(Un,{context:e,place:w,filter:m,...l?.at===et(w)?{chosen:l.ids}:{}})})}),j.length>0?(0,A.jsx)("div",{style:{maxWidth:760,display:"grid",gap:40},"data-testid":"place-creators",children:j.map(({affordance:P,mutation:D})=>(0,A.jsxs)("section",{style:{...ee,display:"grid",gap:14},children:[(0,A.jsx)("h2",{style:X,children:D.title??D.name}),D.description?(0,A.jsx)("p",{style:{...C,margin:0,maxWidth:"58ch"},children:D.description}):null,(0,A.jsx)(Ie,{store:t,mutation:D,prefilled:P.args,open:P.open,label:P.label,...n?{principal:n}:{}})]},P.id))}):null]})}function ko(e,t=document){let n=Ut(e);if(!n)return null;let a=[t,...[...t.querySelectorAll("[data-worker-view]")].flatMap(r=>r.shadowRoot?[r.shadowRoot]:[])];for(let r of a)for(let i of r.querySelectorAll("[id], [data-section]")){let d=i.getAttribute("data-section")??i.id;if(d===e||Ut(d)===n)return i}for(let r of a)for(let i of r.querySelectorAll("h1, h2, h3, h4, h5, h6, [role=heading]"))if(Ut(i.textContent??"")===n)return i;return null}function hi(e,t={}){if(typeof document>"u"||typeof requestAnimationFrame>"u")return()=>{};let n=t.frames??120,a=0,r=()=>{let i=ko(e,t.root??document);if(i){i.hasAttribute("tabindex")||i.setAttribute("tabindex","-1"),i.scrollIntoView?.({block:"start"}),i.focus({preventScroll:!0});return}n-=1,n>0&&(a=requestAnimationFrame(r))};return a=requestAnimationFrame(()=>{a=requestAnimationFrame(r)}),()=>cancelAnimationFrame(a)}var K=H(He(),1);var Jt=H(He(),1);var tt=H(B(),1);function wi({context:e}){return de()?(0,tt.jsxs)(tt.Fragment,{children:[(0,tt.jsx)(bo,{context:e}),(0,tt.jsx)(Vr,{face:"pages",on:e.quickAsk??!0})]}):null}function bo({context:e}){let{store:t}=e,n=de(),{pathname:a}=me(),r=(0,Jt.useRef)(n?.setSelection);return r.current=n?.setSelection,(0,Jt.useEffect)(()=>{let i=r.current;if(!i)return;let[,d,l]=a.split("/"),s=(()=>{if(d==="places"){let m=e.views?.places().find(v=>v.as===decodeURIComponent(l??""));return m?[Ne(m.kind)]:[]}let c=d?ve(t.schema,d):void 0;return c&&l?[decodeURIComponent(l)]:c?[Na(c)]:[]})();i(c=>c.length===s.length&&c.every((m,v)=>m===s[v])?c:s)},[a]),null}var be=H(He(),1);var Si=H(Zi(),1);var pe=H(B(),1);var xo=Nt(Oa(()=>(__graviewPreload(import.meta.url,["./chunk.QAUZDLDA.js","./chunk.3SY6WWWQ.js","./chunk.UGFDSE37.js","./chunk.ATWNWPME.js","./chunk.GZEZMU2T.js","./chunk.4VJARLJ5.js","./chunk.5RNB6IC5.js","./chunk.ZITDUHX3.js","./chunk.ETWREHXF.js","./chunk.YZ6UKKEL.js","./chunk.FFPG4PHX.js","./chunk.3L5USMQD.js","./chunk.GTUBIJTP.js","./chunk.DUIKIJKC.js","./chunk.73BJYIYS.js","./chunk.OKQ4JXTW.js","./chunk.M5RHVUZ6.js","./chunk.MRUDTYOL.js","./chunk.OUNLAMBA.js","./chunk.HGP3Q7QX.js","./chunk.QSZLY62B.js","./chunk.7VX6TBNY.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.6SHF6IL5.js","./chunk.MQISKON2.js","./chunk.GQX57JIE.js","./chunk.LJXAZ5TF.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.GZHZLJBF.js","./chunk.JLR74UFP.js","./chunk.OJGHDWI6.js","./chunk.HG34MT7C.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.RK6BK5FD.js")).then(e=>({default:e.TakeBack}))));function Po({context:e,docked:t,at:n,...a}){let{store:r}=e,i=Q(r),[d]=(0,be.useState)(()=>r.batches().length),l=(0,be.useRef)(!1);return l.current||=i>0||!t&&d>0,l.current?(0,pe.jsx)(be.Suspense,{fallback:null,children:(0,pe.jsx)(xo,{context:e,docked:t,at:n,since:d,...a})}):null}function Co(e,t,n){let{store:a,principal:r,embedded:i}=e;(0,be.useEffect)(()=>{if(!n)return;let d=l=>{if(!Xr(l))return;let s=l.target,c=s instanceof Node&&t.current?.contains(s),m=s===document.body||s===document.documentElement||s===document;if(!(!c&&!(m&&!i))&&Qr(a,r)){l.preventDefault();try{Zr(a,r)}catch{}}};return document.addEventListener("keydown",d),()=>document.removeEventListener("keydown",d)},[a,r,i,t,n])}function ki({context:e,registry:t,root:n,children:a}){let r=(0,be.useMemo)(li,[]),i=t?.without()??new Set;return Co(e,n,!i.has("undo")),(0,pe.jsxs)(wt.Provider,{value:r,children:[(0,pe.jsx)(Ao,{context:e,placed:r,without:i}),a]})}function Ao({context:e,placed:t,without:n}){let[a,r]=(0,be.useState)(!1);(0,be.useLayoutEffect)(()=>r(!0),[]);let i=vt(t,"find"),d=vt(t,"undo"),l=me(),s=kr();if(!a)return null;let c=l.pathname.split("/").filter(Boolean),v=(c.length===1?ve(e.store.schema,c[0]):void 0)!==void 0;return(0,pe.jsxs)(pe.Fragment,{children:[!i&&!n.has("find")&&s?(0,Si.createPortal)((0,pe.jsx)(vi,{context:e,narrowsLists:v}),s.slot):null,!i&&!n.has("find")&&!s?(0,pe.jsx)("div",{"data-testid":"face-find-bar",style:{display:"flex",alignItems:"center",padding:"8px 16px",borderBottom:"1px solid var(--graview-edge)",background:"var(--graview-bar)",minWidth:0},children:(0,pe.jsx)(vi,{context:e,narrowsLists:v})}):null,!d&&!n.has("undo")?(0,pe.jsx)(Po,{context:e,docked:!0,at:l.pathname+l.search}):null,s?.own&&!n.has("undo")?(0,pe.jsx)(ri,{context:e,own:s.own}):null]})}function vi({context:e,narrowsLists:t}){return(0,pe.jsx)(wt.Provider,{value:null,children:(0,pe.jsx)(Bn,{context:e,narrowsLists:t})})}var Z=H(He(),1);var xe=H(B(),1),Ro=500,Lo=10;function en(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function To(e){let t=typeof getSelection=="function"?getSelection():null;return t!==null&&!t.isCollapsed&&t.containsNode(e,!0)}function bi(e){let t=e.closest('a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])');if(t)return t;let n=document.activeElement;return n instanceof HTMLElement&&n!==document.body?n:null}function xi({context:e,root:t,children:n}){return de()===null?(0,xe.jsx)(xe.Fragment,{children:n}):(0,xe.jsx)(Mo,{context:e,root:t,children:n})}function Mo({context:e,root:t,children:n}){let{setMenuAt:a}=Ka(),{store:r}=e,i=r.schema,d=De(),{pathname:l,search:s}=me(),c=Ze("/").replace(/\/$/,""),m=(0,Z.useCallback)((S,f)=>e.views?.places().find(R=>R.as===S&&(f===null||R.kind===f)),[e.views]),v=(0,Z.useCallback)((S,f)=>{let[R="",E,ne]=S.split("/").filter(Boolean).map(p=>{try{return decodeURIComponent(p)}catch{return p}});if(ne!==void 0)return null;if(R==="places"&&E!==void 0){let p=m(E,new URLSearchParams(f).get("of"));return p?{face:"pages",place:p.as,about:[Ne(p.kind)],title:p.title}:null}let z=ve(i,R);return z?E===void 0?{face:"pages",about:[Ne(z)],title:Ge(i,z)}:r.graph.getNode(E)?{face:"pages",on:E,about:[E]}:null:null},[i,r,m]),w=(0,Z.useCallback)(S=>{let f=S.href;try{let R=new URL(f,location.href);if(R.origin===location.origin&&(c===""||R.pathname===c||R.pathname.startsWith(`${c}/`))){let E=v(R.pathname.slice(c.length),R.search);if(E)return{...E,href:f}}}catch{}return{face:"pages",about:[],href:f}},[c,v]),g=(0,Z.useCallback)(()=>v(l,s)??{face:"pages",about:[]},[v,l,s]),x=(0,Z.useCallback)(S=>{let f=g(),R=S.closest("[data-graview-field]")?.getAttribute("data-graview-field");if(R&&f.on!==void 0&&S.closest("[data-graview-pick], a[href]")===null)return{...f,field:R};let E=S.closest("[data-graview-act]")?.getAttribute("data-graview-act");if(E)return{...f,act:E};let ne=S.closest("a[href]"),z=S.closest("[data-graview-listed]"),p=[S.closest("[data-graview-pick]")?.getAttribute("data-graview-pick"),z&&(!ne||z.contains(ne)&&ne.classList.contains("graview-spec-item-link"))?z.getAttribute("data-graview-listed"):null].map(V=>V?r.graph.getNode(V):void 0).find(Boolean);if(p)return{face:"pages",on:p.id,about:[p.id],href:`${c}${_(i,p.kind,p.id)}`};if(ne)return w(ne);let L=S.closest("[data-graview-record]")?.getAttribute("data-graview-record");return L&&r.graph.getNode(L)?{face:"pages",on:L,about:[L]}:f},[g,w,r,i,c]),N=(0,Z.useCallback)(S=>{let f=t.current;if(f===null||!f.contains(S)||en(S)||S.closest("[data-graview-popover]"))return null;let R=x(S);return{face:"pages",on:R.on,about:R.about??[],field:R.field,place:R.place,href:R.href,act:R.act,element:bi(S)}},[x,t]),q=(0,Z.useCallback)((S,f,R)=>{let E=x(S);a({...E,x:Math.round(f),y:Math.round(R),returnTo:bi(S)})},[x,a]),u=(0,Z.useCallback)(S=>{let f=S.getBoundingClientRect();q(S,f.left+Math.min(16,f.width/2),Math.min(f.bottom,f.top+36))},[q]),M=(0,Z.useRef)(0),j=(0,Z.useRef)(null),P=(0,Z.useRef)(!1),D=()=>{j.current&&clearTimeout(j.current.timer),j.current=null};(0,Z.useEffect)(()=>D,[]),(0,Z.useEffect)(()=>{let S=f=>{if(f.defaultPrevented||!(f.key==="ContextMenu"||f.key==="F10"&&f.shiftKey))return;let R=t.current,E=f.target instanceof Element?f.target:null,ne=E===null||E===document.body||E===document.documentElement,z=R!==null&&E!==null&&R.contains(E);if(!z&&!(ne&&document.querySelector("[data-graview-face='pages']")===R)||en(E)||E?.closest("[data-graview-popover]"))return;f.preventDefault(),M.current=Date.now();let p=z&&E instanceof HTMLElement?E:R?.querySelector("[data-graview-page-title], main h1, main")??null;p&&u(p)};return document.addEventListener("keydown",S),()=>document.removeEventListener("keydown",S)},[t,u]),(0,Z.useEffect)(()=>{let S=t.current;if(!S)return;let f=R=>{let E=R.detail;E&&a({...E,face:"pages"})};return S.addEventListener(Cn,f),()=>S.removeEventListener(Cn,f)},[t,a]);let ae=(0,Z.useMemo)(()=>S=>{if(S.face!=="pages")return null;let f=[],R=S.on===void 0?void 0:r.graph.getNode(S.on),E=S.place===void 0?void 0:e.views?.places().find(se=>se.as===S.place),ne=R?void 0:S.about.length===1&&S.about[0].startsWith("aggregate:")&&!E?Eo(S.about[0]):void 0,z=R?_(i,R.kind,R.id):E?fe(e,E):ne?`/${U(i,ne)}`:void 0,p=z!==void 0&&l===z.split("?")[0];z!==void 0&&!p&&f.push({id:"open",label:"Open",run:()=>d(z)});let L=z!==void 0?`${c}${z}`:S.href;L!==void 0&&f.push({id:"open-in-a-new-tab",label:"Open in a new tab",run:()=>void window.open(L,"_blank","noopener")});let V=R?`#focus=${encodeURIComponent(R.id)}`:E?`#focus=${encodeURIComponent(Ne(E.kind))}&view=${encodeURIComponent(E.as)}`:ne?`#focus=${encodeURIComponent(Ne(ne))}`:void 0;if(V!==void 0&&(e.overview||!e.embedded)){let se=e.overview;f.push({id:"in-the-scene",label:"Show in the scene",run:()=>se?se(V):location.assign(`${e.sceneHref??"/"}${V}`)})}return R===void 0&&S.href===void 0&&f.push({id:"find",label:"Find\u2026",run:()=>{let se=t.current?.querySelector('[data-testid="nav-find"]')??document.querySelector('[data-testid="nav-find"]');se&&se.offsetParent!==null?se.focus():d("/search")}}),f.length>0?{id:"pages",items:f}:null},[r,i,e,l,c,d,t]),oe=(0,Z.useMemo)(()=>S=>{if(S.face!=="pages"||S.field===void 0||S.on===void 0)return null;let f=r.graph.getNode(S.on),R=S.element?.closest("[data-graview-field]")??t.current?.querySelector(`[data-graview-field="${CSS.escape(S.field)}"]`);return!f||!(R instanceof HTMLElement)||!R.hasAttribute("data-graview-editable")?null:{id:"field",at:"start",items:[{id:"change-field",label:`Change \u201C${va(i.tryDefinition(f.kind),S.field)}\u201D`,run:()=>R.click()}]}},[r,i,t]),he=_r(),J=mr(),ue=Or(),Ke=(0,Z.useCallback)((S,f)=>{l===fe(e,S).split("?")[0]&&d(f?fe(e,f):"/")},[l,e,d]),Pe=Yr(Ke),Ce=(0,Z.useMemo)(()=>[oe,ue,ae,...Pe?[Pe]:[],...J?[J]:[],...he?[he]:[]],[oe,ue,ae,Pe,J,he]);return(0,xe.jsxs)(cr,{sections:Ce,children:[(0,xe.jsx)("div",{"data-graview-menu-ground":"",style:{display:"contents"},onContextMenu:S=>{let f=S.target;S.shiftKey||en(f)||To(f)||(S.preventDefault(),!f.closest("[data-graview-popover]")&&(Date.now()-M.current<700||(S.clientX===0&&S.clientY===0&&f instanceof HTMLElement?u(f):q(f,S.clientX,S.clientY))))},onPointerDown:S=>{if(P.current=!1,S.pointerType==="mouse"||!S.isPrimary)return;let f=S.target;if(en(f)||f.closest("[data-graview-choose], [data-graview-popover]"))return;D();let{clientX:R,clientY:E}=S;j.current={x:R,y:E,timer:setTimeout(()=>{j.current=null,P.current=!0,M.current=Date.now(),q(f,R,E)},Ro)}},onPointerMove:S=>{let f=j.current;f&&Math.hypot(S.clientX-f.x,S.clientY-f.y)>Lo&&D()},onPointerUp:D,onPointerCancel:D,onClickCapture:S=>{P.current&&(P.current=!1,S.preventDefault(),S.stopPropagation())},children:n}),(0,xe.jsx)($o,{openAt:u,readyAt:N}),(0,xe.jsx)(zr,{placement:"page"}),(0,xe.jsx)(fr,{})]})}function Eo(e){let t=e.slice(10).split("+");return t.length===1&&t[0]?t[0]:void 0}function $o({openAt:e,readyAt:t}){return(0,xe.jsx)("span",{"data-graview-menu-home":"",tabIndex:-1,onFocus:n=>{if(n.target!==n.currentTarget)return;let a=n.currentTarget.closest("[data-graview-face]"),r=a?.querySelector("[data-graview-page-title]")??a?.querySelector("main h1, main")??null;r&&(r.hasAttribute("tabindex")||r.setAttribute("tabindex","-1"),r.focus({preventScroll:!0}))},style:{position:"absolute",width:0,height:0,overflow:"hidden"},children:(0,xe.jsx)(Ur,{placement:"menu",openActs:e,aimAt:t})})}var F=H(B(),1);function Pi(e,t){return t==="*"?{label:"anything",path:null}:{label:Y(e,t),path:`/${U(e.schema,t)}`}}function Oo({context:e,relation:t}){let{store:n}=e,a=Pi(n,t.from),r=Pi(n,t.to),i=d=>d.path?(0,F.jsx)(O,{to:d.path,style:{...Se,fontWeight:550},children:d.label}):(0,F.jsx)("span",{children:d.label});return(0,F.jsxs)("li",{"data-testid":"relation","data-relation":t.edgeKind,style:{display:"grid",gridTemplateColumns:"30px minmax(0, 1fr) auto",gap:12,alignItems:"baseline"},children:[(0,F.jsx)(jr,{edgeKind:t.edgeKind,...e.brand?.kit?{kit:e.brand.kit}:{}}),(0,F.jsxs)("span",{style:{display:"grid",gap:1},children:[(0,F.jsxs)("span",{children:[i(a)," ",(0,F.jsxs)("span",{style:C,"data-graview-speaks-ids":"",children:[ze(t.edgeKind)," \u2192"]})," ",i(r)]}),t.description||t.inverse?(0,F.jsxs)("span",{style:C,children:[t.description?Re(t.description):null,t.description&&t.inverse?" \xB7 ":null,t.inverse?`from the other end, ${t.inverse}`:null]}):null]}),r.path?(0,F.jsx)(O,{to:`${r.path}?with=${encodeURIComponent(t.edgeKind)}`,style:{...G,...C,fontVariantNumeric:"tabular-nums",display:"inline-block",minWidth:24,minHeight:24,textAlign:"center"},title:`The ${r.label.toLowerCase()} that have this`,children:t.count}):(0,F.jsx)("span",{style:{...C,fontVariantNumeric:"tabular-nums"},children:t.count})]})}function Ci({context:e,heading:t=!0}){let{store:n}=e,a=new Set(Fe(n,e.principal)),r=Je(n).relations.filter(i=>a.has(i.from)&&(i.to==="*"||a.has(i.to)));return r.length===0?null:(0,F.jsxs)("section",{style:{...ee,display:"grid",gap:12},"data-testid":"kind-map",children:[t?(0,F.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,F.jsx)("h2",{style:X,children:(0,F.jsx)(O,{to:"/map",style:Se,children:"Connections"})}),(0,F.jsx)("span",{style:C,children:r.length===1?"1 relation":`${r.length} relations`})]}):null,(0,F.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:r.map(i=>(0,F.jsx)(Oo,{context:e,relation:i},`${i.edgeKind}|${i.from}|${i.to}`))})]})}function Qn({context:e}){let{store:t}=e;Q(t);let n=new Set(Fe(t,e.principal)),a=Je(t),r=a.relations.filter(i=>n.has(i.from));return(0,F.jsxs)(te,{context:e,children:[(0,F.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,F.jsx)("p",{style:we,children:r.length===0?"No relations":`${r.length} ${r.length===1?"relation":"relations"}`}),(0,F.jsx)(ie,{context:e,children:"Connections"}),(0,F.jsx)("p",{style:re,children:r.length===0?"Nothing here is declared to relate to anything else yet.":"The kinds this installation holds, and the relations declared between them \u2014 each in the declaration's own words, with how many of it there are."})]}),(0,F.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},"data-testid":"map-kinds",children:a.kinds.filter(i=>n.has(i.kind)).map(i=>(0,F.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[(0,F.jsx)(ce,{kind:i.kind,brand:e.brand,schema:t.schema,size:7}),(0,F.jsx)(O,{to:`/${U(t.schema,i.kind)}`,style:G,children:i.plural}),(0,F.jsx)("span",{style:C,children:i.count})]},i.kind))}),(0,F.jsx)(Ci,{context:e,heading:!1})]})}function Ai({context:e}){let n=[...de()?.robots.values()??[]].filter(r=>r.mode==="asking"&&r.say);if(n.length===0)return null;let{store:a}=e;return(0,F.jsxs)("section",{style:{...ee,display:"grid",gap:10},"data-testid":"seat-questions",children:[(0,F.jsx)("h2",{style:X,children:n.length===1?"The seat asked something":`The seat asked ${n.length} things`}),(0,F.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8},children:n.map(r=>{let i=r.at?a.graph.getNode(r.at):void 0;return(0,F.jsxs)("li",{style:{display:"grid",gap:2},children:[(0,F.jsx)("span",{children:r.say}),i?(0,F.jsxs)(O,{to:_(a.schema,i.kind,i.id),style:{...G,...C},children:[ge(a.schema.tryDefinition(i.kind),i)," \u2192"]}):null]},r.participant)})})]})}var W=H(B(),1);function Zn({context:e}){let{principal:t}=e,{store:n,brand:a,invariantContext:r}=e;Q(n);let i=n.violations(r),d=`${i.length===1?"A rule is broken":"Rules are broken"} \u2014 see what, and what would fix it`,l=[...n.log.all()].slice(-5).reverse(),c=zt(e).map(u=>({kind:u,members:n.graph.nodesOfKind(u).filter(M=>st(n.schema.tryDefinition(u),M))})),m=c.filter(u=>u.members.length>0),v=c.map(u=>({entry:u,creator:n.allMutations().find(M=>(M.creates??[]).includes(u.kind)&&n.permits({name:M.name,args:{}},e.principal).ok)})).find(u=>u.creator!==void 0),w=m.length===0?"Nothing here yet.":`${m.map(u=>Tt(n.schema,u.kind,u.members.length)).join(", ").replace(/, ([^,]*)$/," and $1")}.`,g=e.views?.homeView?.(),x=n.schema.kinds.some(u=>n.graph.nodesOfKind(u).length>0);if(g&&x){let u=a?.subtitle&&a.subtitleDrawn!==!1?(0,W.jsx)("p",{style:{...C,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,M=g[Symbol.for("graview.home-blocks")]===!0;return(0,W.jsx)(te,{context:e,style:ct,children:(0,W.jsxs)("div",{style:{display:"grid",gap:12},"data-testid":"home-view",children:[M?null:u,i.length>0?(0,W.jsx)(O,{to:"/problems",style:{...G,color:"var(--graview-warn)"},children:d}):null,(0,W.jsx)(Kr.Provider,{value:M?u:null,children:(0,W.jsx)(Zt,{when:Ot(g),children:(0,W.jsx)(g,{cardinality:"many",fidelity:"full",mode:"fullscreen",selected:!1})})})]})})}let N=new Set(Fe(n,e.principal)),q=Je(n).relations.filter(u=>N.has(u.from)&&(u.to==="*"||N.has(u.to)));return(0,W.jsxs)(te,{context:e,style:ct,children:[(0,W.jsxs)("header",{style:{display:"grid",gap:12},children:[a?.subtitle&&a.subtitleDrawn!==!1?(0,W.jsx)("p",{style:{...C,margin:0},"data-testid":"app-subtitle",children:a.subtitle}):null,(0,W.jsx)(ie,{context:e,"data-testid":"standing",children:w}),(0,W.jsxs)("p",{style:{...re,display:"grid",gap:4},"data-testid":"standing-card",children:[m.length===0&&v?(0,W.jsxs)("span",{children:["Begin with \u201C",v.creator?.title??v.creator?.name,"\u201D, under"," ",(0,W.jsx)(O,{to:`/${U(n.schema,v.entry.kind)}`,style:G,children:Y(n,v.entry.kind)}),"."]}):null,i.length===0?(0,W.jsx)("span",{children:"All rules hold."}):(0,W.jsx)(O,{to:"/problems",style:{...G,color:"var(--graview-warn)"},children:d})]})]}),(0,W.jsx)(_n,{context:e}),(0,W.jsxs)("section",{style:{...ee,display:"grid",gap:14},"data-testid":"kinds",children:[(0,W.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:10,flexWrap:"wrap"},children:[(0,W.jsx)("h2",{style:X,children:"What is here"}),q.length>0?(0,W.jsx)(O,{to:"/map",style:{...qe,...C,marginLeft:"auto"},"data-testid":"map-link",children:(0,W.jsxs)(Qe,{children:["Connections \xB7 ",q.length===1?"1 relation":`${q.length} relations`]})}):null]}),(0,W.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"8px 10px"},children:c.map(({kind:u,members:M})=>(0,W.jsx)("li",{style:{maxWidth:"100%"},children:(0,W.jsxs)(O,{to:`/${U(n.schema,u)}`,style:{...Se,flexWrap:"wrap",gap:8,padding:"6px 14px 6px 10px",borderRadius:8,border:"1px solid var(--graview-edge-bright)",background:"var(--graview-panel)"},children:[(0,W.jsx)(ce,{kind:u,brand:a,schema:n.schema,size:7}),(0,W.jsx)("span",{style:{fontWeight:550,overflowWrap:"anywhere"},children:Y(n,u)}),(0,W.jsx)("span",{style:{...C,fontVariantNumeric:"tabular-nums"},children:M.length===0?"none yet":ft(M.length)})]})},u))})]}),l.length>0?(0,W.jsxs)("section",{style:{...ee,display:"grid",gap:10},children:[(0,W.jsx)("h2",{style:X,children:"Recently"}),(0,W.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:l.map(u=>(0,W.jsxs)("li",{style:C,children:[(0,W.jsx)("span",{style:{color:"var(--graview-ink)"},children:u.intent})," \u2014 ",ht(u,t,{graph:n.graph,schema:n.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},u.id))})]}):null]})}var Me=H(He(),1);var nt=H(B(),1);function tn({context:e,withheld:t,style:n,testId:a}){let r=de(),i=La(t,e.signIn??r?.signIn);return i?(0,nt.jsx)("p",{style:{...n,margin:0},children:(0,nt.jsx)("button",{type:"button","data-testid":"sign-in",onClick:()=>i.run(),style:ke,children:i.label})}):t.length===0?null:(0,nt.jsx)("ul",{style:{...n,margin:0,padding:0,listStyle:"none",display:"grid",gap:4},...a?{"data-testid":a}:{},children:t.map(d=>(0,nt.jsxs)("li",{style:C,children:[(0,nt.jsx)("s",{children:d.label})," \u2014 ",d.refusal.message]},d.id))})}var T=H(B(),1);function Xn({context:e}){let{store:t,brand:n,principal:a,invariantContext:r}=e;Q(t);let[i]=pt(),d=i.get("q")??"",l=typeof r?.today=="string"?r.today:void 0,s=Lr(t,d,{...a?{principal:a}:{},places:$e(e),flagged:new Set(t.violations(r).flatMap(g=>g.nodeIds)),...l?{today:l}:{},limit:200}),c=s.hits.filter(g=>g.about==="node"),m=s.hits.filter(g=>g.about==="kind"||g.about==="place"||g.about==="rule"),v=[...new Set(c.map(g=>g.kind))],w=d.trim();return(0,T.jsxs)(te,{context:e,children:[(0,T.jsx)("style",{children:_t}),(0,T.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,T.jsx)("p",{style:we,children:"Search"}),(0,T.jsx)(ie,{context:e,"data-testid":"search-heading",children:w.length===0?"Find anything by its name":s.hits.length===0?(0,T.jsxs)(T.Fragment,{children:["Nothing here is called \u201C",w,"\u201D."]}):(0,T.jsxs)(T.Fragment,{children:[No(t,s.byKind)," for \u201C",w,"\u201D"]})}),w.length>0?(0,T.jsxs)("p",{style:{...C,margin:0},"data-testid":"search-searched",children:[Dt(t.schema,s.searched),s.conditions.filter(g=>g.key!=="is"&&g.admittedBy.length<s.searched.kinds.length).map(g=>(0,T.jsxs)("span",{children:[" ",g.key,":",g.value," narrows"," ",g.admittedBy.length===0?"nothing here":g.admittedBy.map(x=>Y(t,x).toLowerCase()).join(" and "),"."]},`${g.key}:${g.value}`))]}):(0,T.jsxs)("p",{style:re,children:["Type in the box above. Words find the start of words in names and in what each record says;"," ",(0,T.jsx)("code",{children:"done:false"})," and the like narrow as a list does, and ",(0,T.jsx)("code",{children:"is:any"})," includes what is past."]})]}),m.length>0?(0,T.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},"data-testid":"search-named",children:m.map(g=>(0,T.jsx)("li",{"data-testid":"search-hit","data-about":g.about,children:g.about==="kind"?(0,T.jsxs)(O,{to:`/${U(t.schema,g.kind)}`,style:G,children:[g.label,g.count>0?(0,T.jsxs)("span",{style:C,children:[" \xB7 ",g.count," match"]}):null]}):g.about==="place"?(0,T.jsxs)(O,{to:fe(e,g),style:G,children:["Go to ",g.title]}):g.about==="rule"?(0,T.jsxs)(O,{to:"/problems",style:G,children:["The rule \u201C",g.label,"\u201D"]}):null},`${g.about}:${g.about==="rule"?g.name:g.about==="place"?g.as:g.kind}`))}):null,v.map(g=>(0,T.jsxs)("section",{className:"graview-list",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",minWidth:0},"data-testid":"search-group","data-kind":g,children:[(0,T.jsxs)("h2",{className:"graview-group-head",style:{alignItems:"center"},children:[(0,T.jsx)(ce,{kind:g,brand:n,schema:t.schema,size:8}),(0,T.jsx)(O,{to:`/${U(t.schema,g)}?${new URLSearchParams({q:w}).toString()}`,style:G,"data-testid":"search-kind-link",children:Y(t,g)}),(0,T.jsx)("span",{children:s.byKind[g]})]}),(0,T.jsx)("ul",{className:"graview-rows",children:c.filter(x=>x.kind===g).map(x=>(0,T.jsxs)("li",{"data-testid":"search-hit","data-about":"node",className:"graview-row",children:[(0,T.jsxs)(O,{to:_(t.schema,g,x.id),className:"graview-row-title",...x.label.length>60?{title:x.label}:{},children:[x.flagged?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,x.label]}),x.apart||!x.current?(0,T.jsx)("span",{className:"graview-row-glance",children:[x.apart,x.current?"":"past"].filter(Boolean).join(" \xB7 ")}):null,(0,T.jsx)(nn,{why:x.why})]},x.id))})]},g)),w.length>0?(0,T.jsx)(Ho,{asked:w}):null,w.length>0&&s.hits.length===0?(0,T.jsx)(Li,{store:t,kinds:s.searched.kinds,words:s.words,...a?{principal:a}:{},...r?{invariantContext:r}:{}}):null]})}function nn({why:e}){return e.strength==="near"?(0,T.jsxs)("span",{style:C,"data-testid":"search-why","data-near":"",children:["Near \u201C",e.asked,"\u201D",e.field==="label"?"":` \u2014 ${e.reading}: ${e.fragment}`]}):e.field==="label"?null:(0,T.jsxs)("span",{style:C,"data-testid":"search-why",children:[e.reading,": ",e.fragment]})}function No(e,t){let n=Object.entries(t).map(([a,r])=>`${r} ${r===1?Ye(e.schema.tryDefinition(a),a):Y(e,a).toLowerCase()}`);return n.length===0?"Found":n.length===1?Re(n[0]):Re(`${n.slice(0,-1).join(", ")} and ${n[n.length-1]}`)}function Ri(e,t,n={}){let a=[];for(let r of t){let i=Xe(e,r,{...n.principal?{principal:n.principal}:{},...n.invariantContext?{context:n.invariantContext}:{}});for(let d of an(e,r,i.actions.affordances))a.some(l=>l.mutation.name===d.mutation.name)||a.push(d)}return a}function an(e,t,n){let a=e.schema.tryDefinition(t)?.fieldRoles?.label,r=[];for(let i of n){let d=e.allMutations().find(c=>c.name===i.mutation);if(!d||!d.creates?.includes(t)||r.some(c=>c.mutation.name===d.name))continue;let l=yr(d.input).map(c=>c.name),s=l.includes("label")?"label":a&&l.includes(a)?a:void 0;!s||i.args[s]!==void 0||r.push({kind:t,affordance:i,mutation:d,arg:s})}return r}function Li({store:e,kinds:t,words:n,principal:a,invariantContext:r}){let i=Ri(e,t,{...a?{principal:a}:{},...r?{invariantContext:r}:{}});return i.length===0||n.trim().length===0?null:(0,T.jsx)("div",{style:{display:"grid",gap:24},"data-testid":"search-to-create",children:i.map(({kind:d,affordance:l,mutation:s,arg:c})=>(0,T.jsxs)("section",{style:{...ee,display:"grid",gap:14},children:[(0,T.jsxs)("h2",{style:X,children:[Re(Sa(Ye(e.schema.tryDefinition(d),d)))," called \u201C",n,"\u201D"]}),(0,T.jsx)(Ie,{store:e,mutation:s,prefilled:l.args,open:l.open,initial:{[c]:n},...a?{principal:a}:{}})]},`${l.id}|${n}`))})}function Ho({asked:e}){let t=de();return t?(0,T.jsx)(Io,{asked:e,desk:t.aiDesk}):null}function Io({asked:e,desk:t}){return _a(t)?(0,T.jsx)("p",{style:{margin:0},children:(0,T.jsxs)("button",{type:"button","data-testid":"search-ask",onClick:a=>ja(t,{pointed:{about:[]},asked:e,returnTo:a.currentTarget}),style:{...G,font:"inherit",padding:0,border:0,background:"transparent",cursor:"pointer",textAlign:"start"},children:["Ask: \u2018",e,"\u2019"]})}):null}var h=H(B(),1),Mi=8,Ei=40;function Fo(e,t){let n=t?.fields?.shape??{},a=Object.keys(n).find(r=>ba(n[r])&&ka(e[r]));return a===void 0?void 0:e[a]}function Jn({context:e}){let t=Ue(),n=ve(e.store.schema,t.slug??"");return n?(0,h.jsx)($i,{context:e,kind:n}):(0,h.jsx)(te,{context:e,children:(0,h.jsx)(ie,{context:e,children:"No such kind of thing here."})})}function $i({context:e,kind:t,opening:n,row:a,layout:r="list",description:i,bare:d}){let{store:l,brand:s,invariantContext:c}=e;Q(l);let[m,v]=pt(),w=`list-${(0,Me.useId)().replace(/:/g,"")}`,g=l.schema.tryDefinition(t),x=Pa(m.get("archived")),N=l.graph.nodesOfKind(t,{archived:x}),q=Je(l).relations.filter(o=>o.from===t||o.to===t),u=new Set(l.violations(c).flatMap(o=>o.nodeIds)),M=Cr(l.schema,Pr(l.schema,xr(l.schema,t))),j=q.map(o=>o.edgeKind),P=qo(m,M,j),D=["sort","filter","group","q","by","with","past","archived",...j].some(o=>m.has(o)),ae=N.length>=Ei,oe=g?.fieldRoles?.when,he=e.views?.arrangement?.()?.lists?.[t],J=wr(he),ue=hr(he?.group),Ke=Go(ae,oe),Pe=n??(J?{...Ke,...J}:Ke),Ce=D?P.arrangement:$n(Pe,M).arrangement,S=J?.sort,f=Ce.sort&&S?.then&&Ce.sort.by===S.by&&Ce.sort.direction===S.direction?{...Ce,sort:S}:Ce,R=Ar(f.query??""),E=[...f.filter??[],...R.conditions].some(o=>o.key==="is"&&(o.value==="past"||o.value==="any"))||br(g,[...f.filter??[],...R.conditions]),ne=E||!g?.lifecycle?f:{...f,filter:[...f.filter??[],{key:"is",value:"current"}]},z=new Map,p=Wt(N,ne,{schema:l.schema,graph:l.graph,flagged:u,...typeof c?.today=="string"?{today:c.today}:{},read:(o,y)=>{let $=z.get(o.id);return $||z.set(o.id,$=yt(l.schema,l.graph,o)),$[y]}}),L=ue&&f.group?.by===ue.by&&!f.group.bucket?M.groups.find(o=>o.key===ue.by):void 0,V=ue&&L&&(L.type==="choice"||L.type==="boolean")?vr(p.groups,ue,{type:L.type,...L.options?{options:L.options}:{}}):p.groups.map(o=>({...o,closed:!1})),se=new Set((m.get("open")??"").split(",").filter(Boolean)),Wi=!!f.query||(f.filter??[]).some(o=>o.key===ue?.by),aa=o=>L?.type==="boolean"?o==="1"?"true":"false":o,ra=o=>o.closed&&!Wi&&!se.has(aa(o.key)),Ki=o=>{let y=new URLSearchParams(m),$=new Set(se);$.has(o)?$.delete(o):$.add(o),$.size>0?y.set("open",[...$].join(",")):y.delete("open"),v(y,{replace:!0})},Ae=p.nodes,rt=g?.lifecycle&&!E?N.filter(o=>st(g,o)):N,ia=N.length-rt.length,sn=f.group?.by??null,Bi=o=>{let y=new URLSearchParams(m);for(let le of["sort","filter","group","q","by","with","past","archived",...q.map(Rt=>Rt.edgeKind)])y.delete(le);let $=Tr(o);for(let le of["sort","filter","group","q","archived"])$[le]&&y.set(le,$[le]);![...y.keys()].some(le=>["sort","filter","group","q"].includes(le))&&(n||J||ae||oe)&&y.set("sort",""),v(y)},{principal:it}=e,ln=Xe(l,t,{...it?{principal:it}:{},...e.invariantContext?{context:e.invariantContext}:{}}),Be=ln.actions.affordances.map(o=>({affordance:o,mutation:l.allMutations().find(y=>y.name===o.mutation)})).filter(o=>o.mutation!==void 0),Gi=ln.actions.withheld,dn=()=>new Set(Ae.length===0?Be.map(({mutation:o})=>o.name):[]),[cn,oa]=(0,Me.useState)(()=>({kind:t,open:dn()}));cn.kind!==t&&oa({kind:t,open:dn()});let sa=o=>(cn.kind===t?cn.open:dn()).has(o),la=(o,y)=>oa($=>{let le=new Set($.open);return y?le.add(o):le.delete(o),{kind:$.kind,open:le}}),da=`begin-${(0,Me.useId)().replace(/:/g,"")}`,ca=R.words&&Ae.length===0?Object.fromEntries(an(l,t,ln.actions.affordances).map(o=>[o.mutation.name,o.arg])):{},je=Y(l,t),xt=e.views?.lookup(t,{cardinality:"one",fidelity:"glyph"}),pn=xt!==void 0&&!lt(xt)?xt:void 0,un=(f.group?.bucket??"day")==="day"?f.group?.by:void 0,gn=(f.filter??[]).map(o=>o.key),qi=gn.filter(o=>gn.indexOf(o)===gn.lastIndexOf(o)&&/choice|boolean/.test(M.filters.find(y=>y.key===o)?.type??"")),mn=o=>{let y={...g?.computed?yt(l.schema,l.graph,o):o};un&&!String(y[un]).includes("T")&&delete y[un];for(let $ of qi)delete y[$];return y},pa=o=>rr(g?.fields?.shape?.[o])?.type==="enum",Pt=o=>{let y=ge(g,o);if(a)return(0,h.jsxs)("li",{"data-testid":"record-row","data-graview-record":o.id,style:{minWidth:0},...Sn(o.id),children:[vn(o,y),a(o,{label:y,href:_(l.schema,t,o.id),flagged:u.has(o.id),glance:ni(mn(o),g,y)})]},o.id);if(pn){let kn=qt(xt,o,l.graph),Yi=Object.fromEntries(Object.entries(mn(o)).filter(([Qi])=>!kn?.fields.has(Qi))),ha=kn?Fn(Yi,g,kn.title??y,pa):[];return(0,h.jsxs)("li",{"data-testid":"record-row","data-graview-record":o.id,style:{position:"relative",display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:16,rowGap:2,paddingBlock:10,borderTop:"1px solid var(--graview-edge)"},...Sn(o.id),children:[vn(o,y),(0,h.jsx)("div",{style:{flex:"1 1 14rem",minWidth:0},children:(0,h.jsx)(pn,{node:o,cardinality:"one",fidelity:"glyph",mode:"fullscreen",selected:!1,...u.has(o.id)?{flagged:[o.id]}:{}})}),ha.length>0?(0,h.jsx)("span",{style:{...C,flex:"0 1 auto",minWidth:0,overflowWrap:"anywhere"},"data-testid":"record-glance",children:(0,h.jsx)(Dn,{runs:ha})}):null,(0,h.jsx)(jo,{to:_(l.schema,t,o.id),label:u.has(o.id)?`${y} \u2014 implicated in a problem`:y})]},o.id)}let $=Fn(mn(o),g,y,pa),le=$.length>0,Rt=R.words?Rr(g,o,R.words):void 0,fa=ae?void 0:or(o,g),Lt=Fo(o,g),ya=(0,h.jsxs)(O,{to:_(l.schema,t,o.id),className:"graview-row-title",...y.length>60?{title:y}:{},children:[u.has(o.id)?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("span",{role:"img","aria-label":"Breaks a rule:",style:{color:"var(--graview-warn)"},children:"\u26A0"})," "]}):null,y]});return(0,h.jsxs)("li",{className:"graview-row","data-graview-record":o.id,...Sn(o.id),children:[vn(o,y),fa?(0,h.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:14,minWidth:0},children:[(0,h.jsx)(dt,{as:"thumb",file:fa}),ya]}):ya,le||Lt?(0,h.jsxs)("span",{className:"graview-row-glance",children:[(0,h.jsx)(Dn,{runs:$}),le&&Lt?" \xB7 ":null,Lt?(0,h.jsx)(Kt,{address:Lt}):null]}):null,Rt?(0,h.jsx)(nn,{why:Rt}):null]},o.id)},fn=$e(e).filter(o=>o.kind===t&&!o.hidden),ua=he?.filters,Ui=(f.filter??[]).some(o=>o.key!=="is"||o.value!=="any"),Vi=!!(f.sort||f.group||f.query||Ui),ji=rt.length>=Mi||D&&Vi,Oe=f.sort?M.sorts.find(o=>o.key===f.sort.by):void 0,yn=Oe?.type==="date"||Oe!==void 0&&Oe.key===oe,ga=ae&&!p.grouped&&Oe&&(Oe.about==="label"||Oe.type==="text"||yn)?o=>{let y=Oe.about==="label"?ge(g,o):o[Oe.key];if(typeof y!="string"||y.length===0)return yn?"No date":"#";if(yn)return y.slice(0,4);let $=y.trim().charAt(0).toLocaleUpperCase();return/\p{L}/u.test($)?$:"#"}:void 0,_e=ga?Ae.reduce((o,y)=>{let $=ga(y);return o.at(-1)?.key===$?o.at(-1).nodes.push(y):o.push({key:$,nodes:[y]}),o},[]):void 0,ma=p.grouped&&sn?V.flatMap(o=>ra(o)?[]:o.nodes):_e&&_e.length>1?_e.flatMap(o=>o.nodes):Ae,hn=(0,Me.useMemo)(()=>ma.map(o=>o.id),[ma.map(o=>o.id).join(`
6
- `)]),Ee=Nr(hn),wn=(0,Me.useId)(),gt=(it?l.permittedMutations(it):l.permittedMutations()).some(o=>{let y=o.subject?.kinds;return y!==void 0&&(y==="*"||y.includes(t))}),vn=(o,y)=>gt?(0,h.jsx)("span",{className:"graview-choose-at",children:(0,h.jsx)("input",{...Ee.boxProps(o.id,y),onPointerEnter:On,onFocus:On})}):null,Sn=o=>gt?{"data-graview-choose":o}:{},_i=(0,Me.useCallback)(o=>{Ee.choose(o),requestAnimationFrame(()=>{let y=Ee.list.current;((o[0]===void 0?null:y?.querySelector(`[data-graview-choose-box="${CSS.escape(o[0])}"]`))??y)?.focus({preventScroll:!0})})},[Ee]),ot=r==="grid"?{margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(min(100%, 15rem), 1fr))",alignItems:"start",gap:12}:a||pn?{margin:0,padding:0,listStyle:"none",display:"grid",gap:a&&r==="list"?6:0}:void 0,Ct=ot?void 0:"graview-rows",mt=o=>`list-at-${o.replace(/[^\p{L}\p{N}]/gu,"_")}`,At=q.map(o=>{let y=o.from===t?o.to:o.from,$=o.from===t?o.description:o.inverse??o.description;return{relation:o,far:y,words:$}}),zi=new Set(At.map(o=>(o.words??"").toLowerCase()).filter((o,y,$)=>o&&$.indexOf(o)!==y));return(0,h.jsxs)(d?Bo:te,{context:e,children:[(0,h.jsxs)("div",{style:{display:"grid",gap:12},children:[(0,h.jsxs)("header",{style:{display:"grid",gap:4},children:[d?null:(0,h.jsx)(ut,{context:e}),(0,h.jsxs)("div",{style:{display:"flex",alignItems:"center",flexWrap:"wrap",columnGap:10,rowGap:4,minWidth:0},children:[(0,h.jsx)(ce,{kind:t,brand:s,schema:l.schema,size:8}),(0,h.jsx)(ie,{context:e,children:je}),Be.length>0?(0,h.jsx)("span",{style:{marginLeft:"auto",display:"flex",flexWrap:"wrap",columnGap:14,rowGap:8},"data-testid":"beginnings-open",children:Be.map(({affordance:o,mutation:y})=>(0,h.jsx)(Uo,{name:y.name,title:y.title??y.name,panel:`${da}-${y.name}`,open:sa(y.name),onOpen:$=>la(y.name,$)},o.id))}):null]}),Ae.length>0?(0,h.jsx)(Jr,{place:"here",to:[{label:`Skip to the ${Ae.length===1?Ye(g,t):`${Ae.length} ${je.toLowerCase()}`}`,testid:"records",go:()=>{let o=document.querySelector(`[data-graview-skip-target="${CSS.escape(wn)}"]`);Nn(o?.querySelector('[data-graview-choose-box][tabindex="0"]')??o)}},...rt.length>0?[{label:"Skip to arranging them",testid:"arranging",go:()=>{let o=document.querySelector(`[data-graview-skip-target="${CSS.escape(wn)}"]`)?.parentElement?.querySelector('[role="group"][aria-label="Arrange"]');Nn(o?.querySelector('button[data-testid$="-add"], button[data-testid$="-all"]')??o)}}]:[]]}):null,i??g?.description?(0,h.jsx)("p",{style:re,children:i??g?.description}):null,At.length>0||fn.length>0?(0,h.jsxs)("p",{style:{...C,margin:0,display:"flex",flexWrap:"wrap",columnGap:18,rowGap:2},"data-testid":"kind-related",children:[At.length>0?(0,h.jsxs)("span",{"data-testid":"kind-relations",children:["Related:"," ",At.map(({relation:o,far:y,words:$},le)=>(0,h.jsxs)("span",{"data-relation":o.edgeKind,children:[le>0?(0,h.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,y==="*"?Re($??ze(o.edgeKind)):(0,h.jsx)(O,{to:`/${U(l.schema,y)}`,style:G,title:Y(l,y),children:$&&zi.has($.toLowerCase())?`${Re($)}: ${Y(l,y).toLowerCase()}`:Re($??Y(l,y))})]},`${o.edgeKind}|${o.from}|${o.to}`))]}):null,fn.length>0?(0,h.jsxs)("span",{"data-testid":"kind-pictures",children:["Also as:"," ",fn.map((o,y)=>(0,h.jsxs)("span",{children:[y>0?(0,h.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,h.jsx)(O,{to:fe(e,o),style:G,children:o.title})]},et(o)))]}):null]}):null]}),Be.length>0?(0,h.jsx)("div",{style:{display:"contents"},"data-testid":"beginnings",children:Be.map(({affordance:o,mutation:y})=>{let $=!!(ca[y.name]&&Ae.length===0);return(0,h.jsx)(Vo,{name:y.name,id:`${da}-${y.name}`,description:y.description,open:sa(y.name),onClose:()=>la(y.name,!1),children:(0,h.jsx)(Ie,{store:l,mutation:y,prefilled:o.args,open:o.open,...$?{initial:{[ca[y.name]]:R.words}}:{},...e.principal?{principal:e.principal}:{}},$?`${y.name}|${R.words}`:y.name)},o.id)})}):null,P.dropped.length>0?(0,h.jsxs)("p",{style:{...C,margin:0},"data-testid":"list-dropped",children:["This link asked for ",P.dropped.join(", "),", which ",je.toLowerCase()," cannot be arranged by; the rest is shown."]}):null,rt.length>0?(0,h.jsx)($r,{schema:l.schema,graph:l.graph,kind:t,arrangement:f,onChange:Bi,kept:{shown:Ae.length,of:rt.length},noun:{one:Ye(g,t),many:je.toLowerCase()},...ji?{}:{allow:!1},...ua?{filters:ua}:{},offers:M,chips:{nodes:rt,flagged:u,...typeof c?.today=="string"?{today:c.today}:{}},query:e.framed===!0&&e.barAbove!==!0}):null,(0,h.jsx)("style",{children:_t}),gt?(0,h.jsx)("style",{children:Hr+Ko}):null,(0,h.jsx)("div",{className:"graview-list","data-graview-skip-target":wn,...gt?{...Ee.listProps,ref:Ee.list,tabIndex:-1,"data-graview-choosable":"","aria-label":Ee.chosen.length>0?`${je}, ${Ee.chosen.length} chosen`:je,role:"group"}:{},children:Ae.length===0&&R.words?(0,h.jsxs)("p",{style:re,"data-testid":"none-yet",children:["Nothing here is called \u201C",R.words,"\u201D."," ",(0,h.jsx)("span",{style:C,"data-testid":"list-searched",children:Dt(l.schema,{kinds:[t],past:E})})," ",(0,h.jsx)(O,{to:"?",style:G,children:"Show every one"})]}):Ae.length===0?(0,h.jsxs)("p",{style:re,"data-testid":"none-yet",children:[f.filter?.length||f.query?"None of them.":"None yet",!f.filter?.length&&!f.query&&Be.length>0?` \u2014 the first one starts above, with \u201C${Be[0]?.mutation.title??Be[0]?.mutation.name}\u201D.`:!f.filter?.length&&!f.query?".":"",f.filter?.length||f.query?(0,h.jsxs)(h.Fragment,{children:[" ",(0,h.jsx)(O,{to:"?",style:G,children:"Show every one"})]}):null]}):p.grouped&&sn?(0,h.jsx)("div",{style:{display:"grid",gap:"1rem"},"data-testid":"records","data-grouped":sn,children:V.map(o=>{if(!o.closed)return(0,h.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group",children:[(0,h.jsxs)("h2",{className:"graview-group-head",children:[o.label," ",(0,h.jsx)("span",{children:o.nodes.length})]}),(0,h.jsx)("ul",{style:ot,className:Ct,"data-graview-rows":"",children:o.nodes.map(Pt)})]},o.key||"-");let y=ra(o),$=`${w}-${mt(o.key||"none")}`;return(0,h.jsxs)("section",{style:{display:"grid",gap:0},"data-testid":"list-group","data-closed":y?"shut":"open",children:[(0,h.jsx)("h2",{className:"graview-group-head",children:(0,h.jsxs)("button",{type:"button",className:"graview-group-toggle","aria-expanded":!y,"aria-controls":$,"data-testid":"list-group-toggle",onClick:()=>Ki(aa(o.key)),children:[(0,h.jsx)("span",{"aria-hidden":"true",children:y?"\u25B8":"\u25BE"}),o.label," ",(0,h.jsxs)("span",{children:["\xB7 ",o.nodes.length]}),(0,h.jsxs)("span",{style:Do,children:[" ",o.nodes.length===1?Ye(g,t):je.toLowerCase()]})]})}),(0,h.jsx)("ul",{id:$,style:y?{...ot,display:"none"}:ot,className:Ct,"data-graview-rows":"",hidden:y,children:y?null:o.nodes.map(Pt)})]},o.key||"-")})}):_e&&_e.length>1?(0,h.jsxs)("div",{style:{display:"grid",gap:14},"data-testid":"records","data-sectioned":Oe?.type==="date"?"year":"letter",children:[(0,h.jsx)("nav",{"aria-label":"Jump to","data-testid":"list-index",style:{...C,display:"flex",flexWrap:"wrap",gap:Oe?.type==="date"?"0 10px":"0 4px",lineHeight:1.3},children:_e.map(o=>(0,h.jsx)("a",{href:`#${mt(o.key)}`,onClick:y=>{y.preventDefault(),document.getElementById(mt(o.key))?.scrollIntoView({block:"start"})},style:{...Se,minWidth:24,justifyContent:"center"},children:o.key},o.key))}),_e.map(o=>(0,h.jsxs)("section",{"data-testid":"list-section","aria-labelledby":mt(o.key),style:{display:"grid",gap:0},children:[(0,h.jsx)("h2",{id:mt(o.key),className:"graview-group-head",children:o.key}),(0,h.jsx)("ul",{style:ot,className:Ct,"data-graview-rows":"",children:o.nodes.map(Pt)})]},o.key))]}):(0,h.jsx)("ul",{style:ot,className:Ct,"data-testid":"records","data-graview-rows":"",children:Ae.map(Pt)})}),gt?(0,h.jsx)(Ir,{store:l,chosen:Ee.chosen,...it?{principal:it}:{},...c?{context:c}:{},anchor:Wo,of:hn.length,onChooseAll:()=>Ee.choose(hn),onClear:Ee.clear,onActed:_i}):null,ia>0?(0,h.jsxs)(O,{to:Ti(m,"filter","is:any"),style:{...G,...C,justifySelf:"start"},"data-testid":"past-link",children:["+",ia," past"]}):null,x===!1&&l.graph.count(t,{archived:!0})>0?(0,h.jsxs)(O,{to:Ti(m,"archived","true"),style:{...G,...C,justifySelf:"start"},"data-testid":"archived-link",children:["+",l.graph.count(t,{archived:!0})," archived"]}):null]}),(0,h.jsx)(tn,{context:e,withheld:Gi,style:ee,testId:"withheld"})]})}var Do={position:"absolute",width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0 0 0 0)",whiteSpace:"nowrap",border:0},Wo=()=>document.querySelector("[data-graview-choosable]")?.closest("[data-embed-content]")??null,Ko=`
7
- .graview-list[data-graview-choosable]{outline:none}
8
- .graview-list [data-graview-choose]{position:relative;padding-left:34px}
9
- .graview-choose-at{position:absolute;left:2px;top:0;bottom:0;z-index:${Ta.raised};display:flex;align-items:center}
10
- @media (min-width: 900px) and (pointer: fine){
11
- .graview-list [data-graview-choose]{padding-left:0}
12
- .graview-choose-at{left:-34px}
13
- }
14
- @media (pointer: coarse){
15
- .graview-list:not([data-graview-choosing]) [data-graview-choose]{padding-left:0}
16
- .graview-list:not([data-graview-choosing]) .graview-choose-at{display:none}
17
- }
18
- `;function Bo({children:e}){return(0,h.jsx)("div",{style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:40,minWidth:0},children:e})}var Go=(e,t)=>t?{sort:{by:t,direction:"desc"}}:e?{sort:{by:"label",direction:"asc"}}:{};function qo(e,t,n){let a=$t({...e.get("sort")?{sort:e.get("sort")}:{},...e.get("filter")?{filter:e.get("filter")}:{},...e.get("group")?{group:e.get("group")}:{},...e.get("q")?{q:e.get("q")}:{},...e.get("archived")?{archived:e.get("archived")}:{}}),r=[...a.filter??[]],i=e.get("by"),d=a.group??(i?{by:i}:void 0);for(let s of n){let c=e.get(s);c&&r.push({key:s,value:c})}let l=e.get("with");return l&&r.push({key:l,value:"*"}),e.get("past")==="1"&&!r.some(s=>s.key==="is")&&r.push({key:"is",value:"any"}),$n({...a.sort?{sort:a.sort}:{},...a.query?{query:a.query}:{},...r.length>0?{filter:r}:{},...d?{group:d}:{},...a.archived!==void 0?{archived:a.archived}:{}},t)}function Ti(e,t,n){let a=new URLSearchParams(e);return a.set(t,n),a.delete("past"),`?${a.toString()}`}function Uo({name:e,title:t,panel:n,open:a,onOpen:r}){return(0,h.jsxs)("button",{type:"button","data-testid":`act-open-${e}`,"data-graview-act":e,"aria-expanded":a,"aria-controls":n,onClick:()=>{r(!a),a||requestAnimationFrame(()=>document.getElementById(n)?.querySelector("input, select, textarea, button")?.focus())},style:{...Se,minHeight:28,margin:"-4px 0",padding:"0 2px",border:0,background:"none",font:"inherit",fontWeight:600,color:"var(--graview-ink)",cursor:"pointer"},children:[(0,h.jsx)("span",{"aria-hidden":"true",style:{marginRight:6},children:a?"\u2212":"+"}),t]})}function Vo({name:e,id:t,description:n,open:a,onClose:r,children:i}){return(0,h.jsxs)("div",{"data-testid":`act-${e}`,id:t,hidden:!a,onKeyDown:d=>{d.key==="Escape"&&(d.preventDefault(),r(),document.querySelector(`[aria-controls="${t}"]`)?.focus())},style:a?{display:"grid",gap:12,padding:"4px 0 12px"}:void 0,children:[n?(0,h.jsx)("p",{style:{...C,margin:0,maxWidth:"58ch"},children:n}):null,i]})}function jo({to:e,label:t}){let n=(0,Me.useRef)(null);return Fr(n),(0,h.jsx)(O,{ref:n,to:e,"aria-label":t,style:{position:"absolute",inset:0,borderRadius:6}})}var at=H(He(),1);var bt=H(He(),1);var I=H(B(),1);function ea({context:e}){let{store:t,brand:n,invariantContext:a,principal:r}=e;Q(t);let i=t.violations(a),d=t.allInvariants(),l=Ht(t,i),s=za(t.schema,d);return(0,I.jsxs)(te,{context:e,children:[(0,I.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,I.jsx)(ie,{context:e,children:i.length===0?"All rules hold":"What is broken"}),(0,I.jsx)("p",{style:re,"data-testid":"problems-count",children:i.length===0?"Every declared rule is satisfied by what is here.":Ca(i)})]}),(0,I.jsx)(Ai,{context:e}),l.map((c,m)=>{let v=c.nodeIds[0],w=v?t.graph.getNode(v):void 0;return(0,I.jsxs)("section",{style:{display:"grid",gap:10,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:[c.line?null:(0,I.jsx)(rn,{violation:c,schema:t.schema,...n?{brand:n}:{}}),w?(0,I.jsxs)("p",{style:{margin:0,display:"inline-flex",alignItems:"center",gap:8},children:[(0,I.jsx)(ce,{kind:w.kind,brand:n,schema:t.schema,size:7}),(0,I.jsx)(O,{to:_(t.schema,w.kind,w.id),style:G,children:ge(t.schema.tryDefinition(w.kind),w)})]}):null,c.line?(0,I.jsx)(rn,{violation:c,schema:t.schema,...n?{brand:n}:{}}):null,(0,I.jsx)(on,{store:t,repairs:c.repairs,...r?{principal:r}:{}})]},m)}),d.length>0?(0,I.jsxs)("section",{style:{...ee,display:"grid",gap:12},"data-testid":"rules",children:[(0,I.jsx)("h2",{style:X,children:"The rules"}),(0,I.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10},children:d.map(c=>{let m=i.filter(g=>g.invariant===c.name).length,v=s.get(c.name),w=c.label??c.name;return(0,I.jsxs)("li",{"data-graview-rule":c.name,style:{display:"grid",gap:2},children:[(0,I.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",columnGap:12,rowGap:2},children:[v?(0,I.jsx)(It,{line:v,schema:t.schema,...n?{brand:n}:{},style:{flex:"1 1 18rem"}}):(0,I.jsx)("span",{style:{flex:"1 1 18rem",fontWeight:550},children:w}),(0,I.jsx)("span",{style:{...C,color:m>0?"var(--graview-warn)":"var(--graview-ink-faint)"},children:m===0?"holds":`broken in ${m} ${m===1?"place":"places"}`})]}),v&&w.trim().length>0?(0,I.jsx)("span",{style:C,children:w}):null]},c.name)})})]}):null]})}function rn({violation:e,schema:t,brand:n}){if(!e.line)return(0,I.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},children:e.message});let a=Qa(e),r=Ya(e);return r?(0,I.jsxs)("div",{style:{display:"grid",gap:4},"data-testid":"problem-line",children:[(0,I.jsx)("p",{style:{margin:0,color:"var(--graview-warn)",fontWeight:550},"data-testid":"problem-says",children:r}),a?(0,I.jsx)("span",{style:C,children:a}):null,(0,I.jsxs)("details",{"data-testid":"problem-judged",style:C,children:[(0,I.jsx)("summary",{style:{cursor:"pointer",width:"fit-content",minHeight:24},children:"How it is judged"}),(0,I.jsx)(It,{line:e.line,schema:t,...n?{brand:n}:{},lead:"none"})]})]}):(0,I.jsxs)("div",{style:{display:"grid",gap:2},"data-testid":"problem-line",children:[(0,I.jsx)(It,{line:e.line,schema:t,...n?{brand:n}:{},lead:"none",style:{color:"var(--graview-warn)"}}),a?(0,I.jsx)("span",{style:C,children:a}):null]})}function on({store:e,repairs:t,principal:n}){let[a,r]=(0,bt.useState)(null),[i,d]=(0,bt.useState)(null),l=(0,bt.useRef)([]);if(t.length===0)return null;let s=a===null?null:t[a],c=s&&(s.missing??[]).length>0?e.allMutations().find(m=>m.name===s.mutation):void 0;return(0,I.jsxs)("div",{style:{display:"grid",gap:10},"data-testid":"repairs",children:[(0,I.jsx)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:t.map((m,v)=>{let w=(m.missing??[]).length>0,g=e.permits({name:m.mutation,args:{...m.args}},n);return g.ok?(0,I.jsx)("button",{ref:x=>{l.current[v]=x},type:"button","data-graview-repair":m.mutation,"data-graview-asks":w||void 0,"aria-expanded":w?a===v:void 0,onClick:()=>{if(d(null),w){r(a===v?null:v);return}r(null);try{e.apply({name:m.mutation,args:{...m.args}},n?{author:n}:{})}catch(x){d(Ft(e.schema,e.allMutations(),x))}},style:ke,children:w?`${m.label} \u2026`:m.label},v):(0,I.jsxs)("p",{"data-testid":"withheld","data-withheld":g.refusal.wouldNeed.join(",")||"nobody",style:{...C,margin:0},children:[(0,I.jsx)("s",{children:m.label})," \u2014 ",g.refusal.message]},v)})}),c&&s?(0,I.jsx)(Ie,{store:e,mutation:c,prefilled:{...s.args},only:s.missing??[],label:s.label,autoFocus:!0,onDone:()=>{let m=a;r(null),requestAnimationFrame(()=>{let v=m===null?null:l.current[m];if(v?.isConnected){v.focus();return}let w=document.querySelector("[data-graview-page-title]")??document.querySelector("main h1, main h2");w&&(w.hasAttribute("tabindex")||(w.tabIndex=-1),w.focus())})},...n?{principal:n}:{}}):null,s&&!c&&(s.missing??[]).length>0?(0,I.jsxs)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:Hn},children:["\u201C",s.label,"\u201D names ",s.mutation,", which this app does not declare."]}):null,i?(0,I.jsx)("p",{"data-testid":"refused",role:"alert",style:{margin:0,color:"var(--graview-warn)",fontSize:Hn},children:i}):null]})}var ta=H(He(),1);var Ve=H(B(),1);function Oi({store:e,link:t,principal:n}){let[a,r]=(0,ta.useState)(!1),[i,d]=(0,ta.useState)(null),l=tr(t);return(0,Ve.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:6,flexWrap:"wrap"},children:[(0,Ve.jsx)("button",{type:"button","data-graview-provisional":"",title:l,"aria-label":`Unsure link: ${l}`,"aria-expanded":a,onClick:()=>r(!a),style:{border:"1px dashed var(--graview-ink-muted)",borderRadius:999,background:"transparent",color:"var(--graview-ink-muted)",font:"inherit",fontSize:"0.75rem",lineHeight:1,padding:"2px 6px",cursor:"pointer"},children:"unsure"}),a?(0,Ve.jsxs)("span",{style:{...C,display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,Ve.jsx)("span",{children:l}),(0,Ve.jsx)("button",{type:"button",style:{...ke,padding:"4px 10px"},onClick:()=>{try{e.apply({name:Aa,args:{kind:t.edge.kind,from:t.edge.from,to:t.edge.to}},n?{author:n}:{}),r(!1)}catch(s){d(Ft(e.schema,e.allMutations(),s))}},children:"Keep this link"}),i?(0,Ve.jsx)("span",{role:"alert",children:i}):null]}):null]})}var ye=H(B(),1);function Ni({nodeId:e,node:t,field:n,inPlace:a,labelStyle:r=we}){return n.files?(0,ye.jsx)(dt,{as:"field",read:!a,nodeId:e,field:n.key,label:n.label,files:n.files,labelStyle:r,style:{gap:4}}):n.long?(0,ye.jsx)(Er,{nodeId:e,field:n.key,label:n.label,value:n.value,markdown:n.markdown,style:{gridColumn:"1 / -1",gap:4},labelStyle:r,valueStyle:{lineHeight:1.6}}):(0,ye.jsxs)("div",{style:{display:"grid",gap:2,minWidth:0,alignContent:"start"},children:[(0,ye.jsx)("dt",{style:r,children:n.label}),(0,ye.jsx)("dd",{style:{margin:0,overflowWrap:"anywhere",minWidth:0},children:n.linked?(0,ye.jsx)(pr,{relation:n.linked.relation,refs:n.linked.refs,...a?{nodeId:e,field:n.key}:{}}):n.app?(0,ye.jsx)(Kt,{address:n.app,as:"record",...a?{nodeId:e,field:n.key}:{}}):n.href?(0,ye.jsx)(Mr,{href:n.href,field:n.key,value:n.value,stored:n.stored,...a?{nodeId:e}:{}}):a?(0,ye.jsxs)(ye.Fragment,{children:[(0,ye.jsx)(Bt,{nodeId:e,field:n.key,value:n.value,stored:n.stored}),n.repeats?(0,ye.jsx)(ur,{nodeId:e,field:n.key,start:t?.[n.key],value:t?.[`${n.key}Repeat`],label:`${n.label} repeats`}):null]}):n.value})]})}var k=H(B(),1),_o=[];function na({context:e}){let{store:t,brand:n,principal:a,invariantContext:r}=e;Q(t);let i=de()!==null,d=Ue(),l=decodeURIComponent(d.id??""),s=ci(t,l,{...a?{principal:a}:{},...r?{context:r}:{}}),c=Ht(t,s?.violations??_o),[m,v]=(0,at.useState)(null),[w,g]=(0,at.useState)(!1),[x,N]=(0,at.useState)(null),q=(0,at.useRef)(null),u=(0,at.useRef)(null),M=gr({flow:"both",letters:!0}),j=p=>{(q.current?.parentElement?.querySelector(`[data-affordance="${p.replace(/["\\]/g,"\\$&")}"]`)??q.current)?.focus()};if(!s)return(0,k.jsx)(te,{context:e,children:(0,k.jsx)(ie,{context:e,children:"Nothing lives at this address."})});let P=t.graph.getNode(l),D=t.schema.tryDefinition(s.kind),ae=D?.describe&&P?Xa(D,P):null,oe=[...t.log.all()].filter(p=>!Mt(p)&&(p.writes.includes(l)||p.reads.includes(l))).slice(-8).reverse(),he=t.log.all().find(p=>!Mt(p)&&p.undoes===void 0&&p.primitives.some(L=>L.op==="add-node"&&L.node.id===l)),J=s.actions.affordances.filter(p=>p.provider!=="invariant"),ue=J.filter(p=>p.destructive||p.setsAside),Ke=w||ue.length<2?J:J.filter(p=>!ue.includes(p)),Pe=e.views?.lookup(s.kind,{cardinality:"one",fidelity:"full"}),Ce=Pe!==void 0&&!lt(Pe)?Pe:void 0,S=Ce&&P?qt(Pe,P,t.graph):void 0,f=S?s.fields.filter(p=>!S.fields.has(p.key)):s.fields,R=S?s.links.flatMap(p=>{let L=p.targets.filter(V=>!S.records.has(V.id));return L.length>0?[{...p,targets:L}]:[]}):s.links,E=Ce!==void 0&&Ua(Pe),ne=i&&ir(D).length>0,z=$e(e).filter(p=>!p.hidden&&(p.kind===s.kind||p.across===s.kind));return(0,k.jsxs)(te,{context:e,children:[(0,k.jsxs)("header",{style:{display:"grid",gap:12},children:[(0,k.jsx)(ut,{context:e}),(0,k.jsx)(ie,{context:e,children:i&&P?.label===s.label?(0,k.jsx)(Bt,{nodeId:l,field:"label",value:s.label,said:s.label}):s.label}),ae&&ae!==s.label?(0,k.jsx)("p",{style:re,children:ae}):null,he?.lineage?(0,k.jsxs)("p",{style:{...C,margin:0},"data-testid":"record-lineage",children:["Made by ",ht(he,a,{graph:t.graph,schema:t.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}}),", ",An(he.lineage)]}):null,(0,k.jsx)(Yt,{context:e,stop:`#focus=${encodeURIComponent(l)}`,style:{...qe,...C},"data-testid":"spatial-link"}),i&&P?(0,k.jsx)(Tn,{choices:[{on:"changed",record:l},{on:"act",record:l},{on:"reaches",kind:s.kind,condition:"",record:l}],label:"Notify me when this changes",testId:"record-notify",style:{...ke,...C,justifySelf:"start"}}):null,z.length>0?(0,k.jsxs)("p",{style:{...C,margin:0},"data-testid":"seen-in",children:["Seen in:"," ",z.map((p,L)=>(0,k.jsxs)("span",{children:[L>0?(0,k.jsx)("span",{"aria-hidden":"true",children:" \xB7 "}):null,(0,k.jsx)(O,{to:fe(e,p),style:G,children:p.title})," ",(0,k.jsx)(Yt,{context:e,stop:`#view=${encodeURIComponent(p.as)}`,style:{...G,...C,display:"inline-block",minWidth:24,textAlign:"center"},title:`${p.title}, in the scene`,label:`${p.title}, in the scene`,children:(0,k.jsx)("span",{"aria-hidden":"true",children:"\u2197"})})]},et(p)))]}):null]}),P&&xa(P)?(0,k.jsx)(Yo,{context:e,id:l,kind:s.kind}):null,P&&Ra(t,l)?(0,k.jsx)(zo,{context:e,id:l,kind:s.kind}):null,Ce&&P?(0,k.jsx)("section",{"data-testid":"record-view",style:{display:"grid",minWidth:0},children:(0,k.jsx)(Dr,{children:(0,k.jsx)(Zt,{when:Ot(Pe),children:(0,k.jsx)(Ce,{node:P,cardinality:"one",fidelity:"full",mode:"fullscreen",selected:!1,...s.violations.length>0?{flagged:[l]}:{}})})})}):null,s.violations.length>0?(0,k.jsx)("section",{"data-testid":"record-violations",style:{display:"grid",gap:12,padding:"16px 18px",borderLeft:"3px solid var(--graview-warn)",background:"var(--graview-panel-warning)",borderRadius:"0 var(--graview-radius, 12px) var(--graview-radius, 12px) 0"},children:c.map((p,L)=>(0,k.jsxs)("div",{style:{display:"grid",gap:8},children:[(0,k.jsx)(rn,{violation:p,schema:t.schema,...n?{brand:n}:{}}),(0,k.jsx)(on,{store:t,repairs:pi(s.actions,p.repairs),...a?{principal:a}:{}})]},L))}):null,!E&&(f.length>0||ne)?(0,k.jsxs)("section",{style:{...ee,display:"grid",gap:14},"data-testid":"record-fields",children:[(0,k.jsx)("h2",{style:X,children:"The facts"}),er(D,f).map((p,L)=>{let V=(0,k.jsx)("dl",{style:{margin:0,display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(200px, 1fr))",gap:"14px 24px"},children:p.fields.map(se=>(0,k.jsx)(Ni,{nodeId:l,node:P,field:se,inPlace:i},se.key))});return p.title?(0,k.jsxs)("section",{style:{display:"grid",gap:10,minWidth:0},children:[(0,k.jsx)("h3",{"data-graview-field-group":p.title,style:{...X,fontSize:"inherit"},children:p.title}),V]},L):(0,k.jsx)("div",{children:V},L)}),ne?(0,k.jsx)(dt,{as:"unfilled",nodeId:l,skip:[...S?.fields??[]],labelStyle:we,style:{gap:4}}):null]}):null,(E?[]:R).map(p=>(0,k.jsxs)("section",{style:{...ee,display:"grid",gap:10},children:[(0,k.jsx)("p",{style:we,children:ti(t,p)}),p.description?(0,k.jsx)("h2",{style:X,children:Re(p.description)}):(0,k.jsxs)("h2",{style:X,"aria-label":ze(p.edgeKind),children:[p.direction==="in"?"\u2190 ":"\u2192 ",ze(p.edgeKind)]}),(0,k.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexWrap:"wrap",gap:"6px 18px"},children:p.targets.map(L=>{let V=nr(t,p.direction==="in"?{kind:p.edgeKind,from:L.id,to:l}:{kind:p.edgeKind,from:l,to:L.id});return(0,k.jsxs)("li",{style:{display:"inline-flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[(0,k.jsx)(ce,{kind:L.kind,brand:n,schema:t.schema,size:7}),(0,k.jsxs)(O,{to:_(t.schema,L.kind,L.id),style:G,children:[L.label,L.apart?(0,k.jsxs)("span",{style:C,children:[" \xB7 ",L.apart]}):null]}),V?.provisional?(0,k.jsx)(Oi,{store:t,link:V,...a?{principal:a}:{}}):null]},L.id)})}),(p.direction==="out"&&t.schema.edge(p.edgeKind)?.cardinality==="one"?[]:[...new Set(p.targets.map(L=>L.kind))]).map(L=>(0,k.jsx)(O,{to:`/${U(t.schema,L)}?${encodeURIComponent(p.edgeKind)}=${encodeURIComponent(l)}`,style:{...qe,...C},"data-testid":"related-all",children:(0,k.jsxs)(Qe,{children:["Sort and filter ",p.description??`these ${Y(t,L).toLowerCase()}`,p.targets.some(V=>V.kind!==L)?` (${Y(t,L).toLowerCase()})`:""]})},L))]},`${p.edgeKind}|${p.direction}|${p.description??""}`)),!E&&(J.length>0||s.actions.withheld.length>0)?(0,k.jsxs)("section",{style:{...ee,display:"grid",gap:14},"data-testid":"record-actions",children:[(0,k.jsx)("h2",{style:X,ref:q,tabIndex:-1,children:"What can be done"}),(0,k.jsxs)("div",{role:"toolbar","aria-label":"What can be done",...M,style:{display:"flex",flexWrap:"wrap",gap:8},children:[Ke.map(p=>{let L=m===p.id;return(0,k.jsx)("button",{type:"button","data-affordance":p.id,"data-rank":p.rank,"data-graview-act":p.mutation,[Ln]:"",autoFocus:w&&p===ue[0],"aria-expanded":L,onClick:()=>v(L?null:p.id),style:{...ke,...L?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},children:p.label},p.id)}),Ke.length<J.length?(0,k.jsxs)("button",{type:"button","aria-expanded":!1,onClick:()=>g(!0),style:{...ke,...C},"data-testid":"record-actions-more",[Ln]:"",children:["Show ",J.length-Ke.length," more"]}):null]}),J.map(p=>{if(m!==p.id)return null;let L=t.allMutations().find(V=>V.name===p.mutation);return L?(0,k.jsxs)("div",{ref:u,onKeyDown:V=>{if(V.key!=="Escape"||V.defaultPrevented)return;V.preventDefault(),v(null);let se=p.id;requestAnimationFrame(()=>j(se))},style:{display:"grid",gap:10,padding:18,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,k.jsx)("h3",{style:X,children:p.label}),L.description?(0,k.jsx)("p",{style:{...C,margin:0},children:L.description}):null,(0,k.jsx)(Ie,{store:t,mutation:L,prefilled:p.args,open:p.open,label:p.label,autoFocus:!0,onDone:()=>{v(null),N(p.mutation);let V=p.id;requestAnimationFrame(()=>j(V))},...a?{principal:a}:{}})]},p.id):null}),i&&x!==null&&m===null?(0,k.jsx)(Tn,{choices:[{on:"act",act:x,record:l},{on:"act",act:x}],label:"Notify me when someone else does this",testId:"notify-after-act",style:{...ke,...C,justifySelf:"start"}}):null,(0,k.jsx)(tn,{context:e,withheld:s.actions.withheld})]}):null,i?(0,k.jsx)(ei,{id:l,style:ee,headingStyle:X}):null,oe.length>0?(0,k.jsxs)("section",{style:{...ee,display:"grid",gap:10},"data-testid":"record-history",children:[(0,k.jsx)("h2",{style:X,children:"What has happened"}),(0,k.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:6},children:oe.map(p=>(0,k.jsxs)("li",{style:C,children:[(0,k.jsx)("span",{style:{color:"var(--graview-ink)"},children:p.intent}),p.lineage?(0,k.jsxs)("span",{"data-graview-lineage":"",children:[" \xB7 ",An(p.lineage)]}):null," \u2014 ",ht(p,a,{graph:t.graph,schema:t.schema,...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{}})]},p.id))})]}):null]})}function zo({context:e,id:t,kind:n}){let{store:a,principal:r}=e,i={name:`allow-tidying-${n}`,args:{id:t}},d=a.allMutations().some(l=>l.name===i.name)&&a.permits(i,r).ok;return(0,k.jsxs)("section",{"data-testid":"record-left-alone",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,k.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,k.jsx)("strong",{children:"Left alone."})," Nothing automated changes it; tidying passes it by."]}),d?(0,k.jsx)("button",{type:"button",style:ke,"data-testid":"allow-tidying",onClick:()=>a.apply(i,r?{author:r}:{}),children:"Allow tidying again"}):null]})}function Yo({context:e,id:t,kind:n}){let{store:a,principal:r}=e,i={name:`unarchive-${n}`,args:{id:t}},d=a.allMutations().some(c=>c.name===i.name)&&a.permits(i,r).ok,l=[...a.log.all()].reverse().find(c=>!Mt(c)&&c.mergedInto!==void 0&&c.writes.includes(t)),s=l?.mergedInto!==void 0?a.graph.getNode(l.mergedInto):void 0;return(0,k.jsxs)("section",{"data-testid":"record-archived",style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:12,padding:"12px 16px",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)"},children:[(0,k.jsxs)("p",{style:{margin:0,flex:"1 1 16rem"},children:[(0,k.jsx)("strong",{children:"Archived."})," Kept with its ties and history, and out of lists, counts and rules.",s?(0,k.jsxs)(k.Fragment,{children:[" ","Merged into ",(0,k.jsx)(O,{to:_(a.schema,s.kind,s.id),style:G,children:ge(a.schema.tryDefinition(s.kind),s)}),"."]}):null]}),d?(0,k.jsx)("button",{type:"button",style:ke,"data-testid":"bring-it-back",onClick:()=>a.apply(i,r?{author:r}:{}),children:"Bring it back"}):null]})}var b=H(B(),1),Qo=Nt(()=>(__graviewPreload(import.meta.url,["./chunk.CDZVUCEK.js","./chunk.QAUZDLDA.js","./chunk.3SY6WWWQ.js","./chunk.UGFDSE37.js","./chunk.ATWNWPME.js","./chunk.GZEZMU2T.js","./chunk.4VJARLJ5.js","./chunk.5RNB6IC5.js","./chunk.ZITDUHX3.js","./chunk.ETWREHXF.js","./chunk.YZ6UKKEL.js","./chunk.FFPG4PHX.js","./chunk.3L5USMQD.js","./chunk.GTUBIJTP.js","./chunk.DUIKIJKC.js","./chunk.73BJYIYS.js","./chunk.OKQ4JXTW.js","./chunk.M5RHVUZ6.js","./chunk.MRUDTYOL.js","./chunk.OUNLAMBA.js","./chunk.HGP3Q7QX.js","./chunk.QSZLY62B.js","./chunk.7VX6TBNY.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.6SHF6IL5.js","./chunk.MQISKON2.js","./chunk.GQX57JIE.js","./chunk.LJXAZ5TF.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.GZHZLJBF.js","./chunk.JLR74UFP.js","./chunk.OJGHDWI6.js","./chunk.HG34MT7C.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.24MUPV4Y.js")).then(e=>({default:e.DraftPage}))),Zo={kind:"human"};function Xo({list:e,store:t}){let n=new Set(e.members.map(d=>d.kind)),a=e.total-e.members.length,r=n.size===1?[...n][0]:void 0;if(!r)return(0,b.jsx)("p",{className:"graview-spec-text graview-spec-more",children:`and ${a} more`});let i=Ge(t.schema,r).toLowerCase();return(0,b.jsx)("p",{className:"graview-spec-text graview-spec-more",children:(0,b.jsx)(O,{to:`/${U(t.schema,r)}`,className:"graview-spec-link graview-spec-see-all","data-testid":"see-all",children:e.total===t.graph.nodesOfKind(r).length?`See all ${ft(e.total)} ${i}`:`${ft(a)} more \xB7 all ${i}`})})}function Jo({context:e,children:t}){let n=De(),a=e.store.schema,r=Ze("/").replace(/\/$/,""),i=(0,K.useMemo)(()=>({href:d=>`${r}${_(a,d.kind,d.id)}`,go:d=>n(_(a,d.kind,d.id)),more:d=>(0,b.jsx)(Xo,{list:d,store:e.store})}),[r,a,n,e.store]);return(0,b.jsx)(Gt.Provider,{value:i,children:(0,b.jsx)(Wr.Provider,{value:(e.titleLevel??(e.framed&&!e.barAbove?1:2))-1,children:t})})}var Ii=(0,K.createContext)(void 0);function es({steering:e}){let t=me(),n=De(),a=`${t.pathname}${t.search}`;return(0,K.useLayoutEffect)(()=>e.at(a),[a,e]),(0,K.useLayoutEffect)(()=>{let r=d=>{d!==a&&n(d)};e.go.current=r;let i=e.pending?.current;return i!==void 0&&(e.pending.current=void 0,r(i)),()=>{e.go.current===r&&(e.go.current=void 0)}},[a,n,e]),null}function ts({context:e,to:t}){let{pathname:n}=me(),a=de(),r=(t??a)?.sayWhere,i=ns(e,n);return(0,K.useEffect)(()=>(r?.(i),()=>r?.(null)),[r,i]),null}function ns(e,t){let[n="",a,r]=t.split("/").filter(Boolean).map(d=>{try{return decodeURIComponent(d)}catch{return d}});if(r!==void 0)return"#";if(n==="places"&&a!==void 0){if(a===Pn)return"#overview=1";let d=e.views?.places().find(l=>l.as===a);return d?`#focus=${encodeURIComponent(Ne(d.kind))}&view=${encodeURIComponent(d.as)}`:"#"}let i=ve(e.store.schema,n);return i?`#focus=${encodeURIComponent(a??Ne(i))}`:"#"}function as({onNavigate:e,path:t}){let n=me(),a=Wn(),r=De(),i=n.hash&&!n.hash.includes("=")?n.hash:"",d=`${n.pathname}${n.search}${i}`,l=(0,K.useRef)(e);l.current=e;let s=(0,K.useRef)(null);(0,K.useEffect)(()=>{let m=s.current;s.current=d,m!==null&&(d===m&&a!=="PUSH"||l.current?.(d,a==="POP"?"pop":a==="REPLACE"?"replace":"push"))},[n.key]);let c=(0,K.useRef)(t);return(0,K.useEffect)(()=>{t===void 0||t===c.current||(c.current=t,t!==d&&r(t))},[t]),null}function Hi({context:e,registry:t,page:n}){let a=Ue(),r=ve(e.store.schema,a.slug??""),i=n==="list"?Jn:na,l=(r?t?.lookup(r,n):void 0)??i;return(0,b.jsx)(l,{context:e})}function rs({context:e,registry:t,children:n}){let a=(0,K.useRef)(null);return Va(a),(0,b.jsx)("div",{ref:a,"data-graview-face":"pages",style:{display:"contents"},children:(0,b.jsx)(ki,{context:e,registry:t,root:a,children:(0,b.jsx)(xi,{context:e,root:a,children:n})})})}function is(e){return e instanceof HTMLElement?e.isContentEditable||e.tagName==="TEXTAREA"||e.tagName==="SELECT"?!0:e.tagName==="INPUT"&&!["button","submit","reset","checkbox","radio","image","file","color","range"].includes(e.type):!1}function os(){let{pathname:e}=me(),t=Wn(),n=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{if(t!=="POP"){for(let i=n.current?.parentElement;i;i=i.parentElement){let{overflowY:d}=getComputedStyle(i);if((d==="auto"||d==="scroll")&&i.scrollHeight>i.clientHeight){i.scrollTop=0;return}}window.scrollTo(0,0)}},[e]);let a=(0,K.useRef)(e),r=(0,K.useRef)(!1);return(0,K.useEffect)(()=>{if(!r.current&&e===a.current)return;r.current=!0;let i=document.activeElement;if(is(i))return;let d=n.current?.closest("main")??document.querySelector("main"),s=n.current?.closest("[data-graview-face]")?.querySelector("[data-graview-page-title]")??d?.querySelector("h1, h2")??null??d??null;s&&(s.hasAttribute("tabindex")||s.setAttribute("tabindex","-1"),s.focus({preventScroll:!0}))},[e]),(0,b.jsx)("span",{ref:n,hidden:!0,"data-graview-scroll-reset":""})}function Fi({context:e,children:t}){let n=De(),a=Ze("/").replace(/\/$/,""),r=(0,K.useContext)(Ii),i=(0,K.useMemo)(()=>{let d=(s,c)=>{if("record"in s){let m=e.store.graph.getNode(s.record);return m?Vt(_(e.store.schema,m.kind,s.record),{section:c?.section}):void 0}if("place"in s){let m=e.views?.places().find(v=>v.as===s.place);return m?Vt(fe(e,m),c):void 0}return e.store.schema.tryDefinition(s.list)?Vt(`/${U(e.store.schema,s.list)}`,c):void 0},l=s=>{s!==void 0&&n(s)};return{record:(s,c)=>l(d({record:s},c)),place:(s,c)=>l(d({place:s},c)),list:(s,c)=>l(d({list:s},c)),draft:()=>n("/~draft"),href:(s,c)=>{let m=r===!1?void 0:d(s,c);if(m!==void 0)return r?r(m):`${a}${m}`}}},[e,n,a,r]);return(0,b.jsx)(qa.Provider,{value:i,children:t})}function ss(){let{pathname:e,search:t,hash:n}=me();return(0,K.useEffect)(()=>{let a=decodeURIComponent(n.replace(/^#/,""));if(!(!a||a.includes("=")))return hi(a)},[e,t,n]),null}function ls({context:e,Home:t}){let n=me(),a=e.views,r=n.key==="default"&&!(a&&Ba(a));(0,K.useEffect)(()=>{a&&Ga(a)},[a]);let i=r?$a(e.views?.arrangement?.()?.first,e.store.schema,e.views?.places()??[]):void 0,d=i?.to==="place"?fe(e,i.place):i?.to==="kind"?`/${U(e.store.schema,i.kind)}`:void 0;return d?(0,b.jsx)(Kn,{to:d,replace:!0}):(0,b.jsx)(t,{context:e})}function Di({context:e,registry:t}){let n=t?.lookupSurface("shell"),a=n!==void 0,r=a&&(t?.without().has("bar")??!1),i=a&&!r&&!e.embedded?{...e,barAbove:!0}:e,d=N=>n===void 0?(0,b.jsx)(Qt,{context:e,children:N}):r?(0,b.jsx)(n,{context:e,children:N}):(0,b.jsx)(Qt,{context:e,children:(0,b.jsx)(n,{context:i,children:N})}),l=t?.lookupSurface("home")??Zn,s=t?.lookupSurface("problems")??ea,c=a?{...i,framed:!0}:e,[m,v]=(0,K.useState)(null),w=(0,K.useMemo)(()=>({context:c,registry:t}),[c,t]),g=(0,K.useMemo)(()=>({onFind:v,find:!(t?.without().has("find")??!1),places:!(t?.without().has("places")??!1)}),[t]),x=(0,b.jsx)(Gn.Provider,{value:w,children:(0,b.jsx)(Fi,{context:e,children:(0,b.jsx)(rs,{context:e,registry:t,children:d((0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(ar,{face:"pages"}),(0,b.jsxs)(Jo,{context:c,children:[(0,b.jsx)(os,{}),(0,b.jsx)(ss,{}),(0,b.jsxs)(oi,{children:[(t?.routes()??[]).map(({path:N,component:q})=>(0,b.jsx)(Le,{path:N,element:(0,b.jsx)(q,{context:c})},N)),(0,b.jsx)(Le,{path:"/",element:(0,b.jsx)(ls,{context:c,Home:l})}),(0,b.jsx)(Le,{path:"/problems",element:(0,b.jsx)(s,{context:c})}),(0,b.jsx)(Le,{path:"/~draft",element:(0,b.jsx)(K.Suspense,{fallback:null,children:(0,b.jsx)(Qo,{context:c})})}),(0,b.jsx)(Le,{path:"/search",element:(0,b.jsx)(Xn,{context:c})}),(0,b.jsx)(Le,{path:"/map",element:(0,b.jsx)(Qn,{context:c})}),(0,b.jsx)(Le,{path:"/places",element:(0,b.jsx)(zn,{context:c})}),$e(c).some(N=>N.as===Pn)?null:(0,b.jsx)(Le,{path:Ea,element:(0,b.jsx)(Kn,{to:"/",replace:!0})}),(0,b.jsx)(Le,{path:"/places/:as",element:(0,b.jsx)(Yn,{context:c})}),(0,b.jsx)(Le,{path:"/:slug",element:(0,b.jsx)(Hi,{context:c,registry:t,page:"list"})}),(0,b.jsx)(Le,{path:"/:slug/:id",element:(0,b.jsx)(Hi,{context:c,registry:t,page:"record"})})]})]})]}))})})});return e.embedded||!a||r?x:(0,b.jsx)(di.Provider,{value:g,children:(0,b.jsx)(Sr.Provider,{value:m,children:x})})}var ds=()=>typeof document>"u"?null:document.body;function cs({context:e,registry:t,basename:n,initialPath:a,onNavigate:r,path:i,steering:d,firstLook:l,hrefOf:s}){let[c,m]=(0,K.useState)(void 0),v=c!==void 0&&c.from===e.principal?{...e,principal:c.seat}:e;(0,K.useState)(()=>v.views?Gr(v.views,v.store.schema,En(v.brand,v.store.schema)):void 0);let w=de();wa({reader:v.locale??w?.locale,app:v.brand?.locale??v.app?.brand?.locale,readerTimeZone:v.timeZone??w?.timeZone,appTimeZone:v.brand?.timeZone??v.app?.brand?.timeZone});let g=v.principal??Zo,x=Fa(v.store,g,v.history),q=(x.past&&x.live===v.store?x.past.store:v.store).seenBy(g),u=q===v.store?v:{...v,store:q};Da(v.store,v.principal);let M=(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(as,{onNavigate:r,path:i}),d?(0,b.jsx)(es,{steering:d}):null,u.presence||w?(0,b.jsx)(ts,{context:u,to:w}):null,(0,b.jsx)(Di,{context:u,...t?{registry:t}:{}}),l?(0,b.jsx)(qr,{firstLook:l,root:ds,app:En(v.brand,v.store.schema)}):null]}),j=u.views?(0,b.jsxs)(Wa,{store:u.store,views:u.views,...u.principal?{principal:u.principal}:{},...u.brand?{brand:u.brand}:{},...u.locale?{locale:u.locale}:{},...u.timeZone?{timeZone:u.timeZone}:{},...u.settings?{settings:u.settings}:{},...u.presence&&!w?{presence:u.presence}:{},...u.people?{people:u.people}:{},...u.seats?{seats:u.seats}:{},onSeat:oe=>w?w.takeSeat(oe):m({from:e.principal,seat:oe}),...u.onKeepLens?{onKeepLens:u.onKeepLens}:{},...u.ai?{ai:u.ai}:{},...u.subscriptions?{subscriptions:u.subscriptions}:{},dismissals:u.dismissals,whileAway:u.whileAway,...u.signIn?{signIn:u.signIn}:{},resolveApp:u.resolveApp??w?.resolveApp,linkedRecords:u.linkedRecords??w?.linkedRecords,...u.app?{app:u.app}:{},...u.menuSections?{menuSections:u.menuSections}:{},children:[M,(0,b.jsx)(Fi,{context:u,children:(0,b.jsx)(wi,{context:u})})]}):M,P=(0,b.jsx)(Ia.Provider,{value:x,children:j}),D=u.files?(0,b.jsx)(Ha.Provider,{value:u.files,children:P}):P,ae=s===void 0?D:(0,b.jsx)(Ii.Provider,{value:s,children:D});if(a!==void 0){let oe=n===void 0?a:`${n.replace(/\/$/,"")}${a}`;return(0,b.jsx)(ii,{initialEntries:[oe],...n===void 0?{}:{basename:n},children:ae})}return(0,b.jsx)(si,{...n===void 0?{}:{basename:n},children:ae})}export{co as a,cs as b};
@@ -1,25 +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{a as Ke}from"./chunk.SDO3U72B.js";import{Dd as eo,Ga as Bn,Hd as to,Ic as Un,J as Kn,Jd as Fe,Ka as bt,Kd as xt,Ma as qn,Sc as Yn,Uc as Zn,Xc as Xn,Ya as zn,_c as Jn,lc as $n,nd as Qn}from"./chunk.BLS2G3CD.js";import{a as Ge,b as _}from"./chunk.AJZBJBMO.js";var bo=Ge(w=>{"use strict";var Ot=Symbol.for("react.transitional.element"),$r=Symbol.for("react.portal"),Ur=Symbol.for("react.fragment"),Yr=Symbol.for("react.strict_mode"),Zr=Symbol.for("react.profiler"),Xr=Symbol.for("react.consumer"),Jr=Symbol.for("react.context"),Qr=Symbol.for("react.forward_ref"),ei=Symbol.for("react.suspense"),ti=Symbol.for("react.memo"),mo=Symbol.for("react.lazy"),ni=Symbol.for("react.activity"),co=Symbol.iterator;function oi(e){return e===null||typeof e!="object"?null:(e=co&&e[co]||e["@@iterator"],typeof e=="function"?e:null)}var go={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},ho=Object.assign,So={};function ge(e,t,n){this.props=e,this.context=t,this.refs=So,this.updater=n||go}ge.prototype.isReactComponent={};ge.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};ge.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function wo(){}wo.prototype=ge.prototype;function Vt(e,t,n){this.props=e,this.context=t,this.refs=So,this.updater=n||go}var Ct=Vt.prototype=new wo;Ct.constructor=Vt;ho(Ct,ge.prototype);Ct.isPureReactComponent=!0;var fo=Array.isArray;function Mt(){}var O={H:null,A:null,T:null,S:null},vo=Object.prototype.hasOwnProperty;function It(e,t,n){var o=n.ref;return{$$typeof:Ot,type:e,key:t,ref:o!==void 0?o:null,props:n}}function ri(e,t){return It(e.type,t,e.props)}function _t(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ot}function ii(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var po=/\/+/g;function Tt(e,t){return typeof e=="object"&&e!==null&&e.key!=null?ii(""+e.key):t.toString(36)}function ai(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(Mt,Mt):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function me(e,t,n,o,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Ot:case $r:a=!0;break;case mo:return a=e._init,me(a(e._payload),t,n,o,r)}}if(a)return r=r(e),a=o===""?"."+Tt(e,0):o,fo(r)?(n="",a!=null&&(n=a.replace(po,"$&/")+"/"),me(r,t,n,"",function(c){return c})):r!=null&&(_t(r)&&(r=ri(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(po,"$&/")+"/")+a)),t.push(r)),1;a=0;var s=o===""?".":o+":";if(fo(e))for(var l=0;l<e.length;l++)o=e[l],i=s+Tt(o,l),a+=me(o,t,n,i,r);else if(l=oi(e),typeof l=="function")for(e=l.call(e),l=0;!(o=e.next()).done;)o=o.value,i=s+Tt(o,l++),a+=me(o,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return me(ai(e),t,n,o,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function Xe(e,t,n){if(e==null)return e;var o=[],r=0;return me(e,o,"","",function(i){return t.call(n,i,r++)}),o}function si(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var yo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},li={map:Xe,forEach:function(e,t,n){Xe(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return Xe(e,function(){t++}),t},toArray:function(e){return Xe(e,function(t){return t})||[]},only:function(e){if(!_t(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};w.Activity=ni;w.Children=li;w.Component=ge;w.Fragment=Ur;w.Profiler=Zr;w.PureComponent=Vt;w.StrictMode=Yr;w.Suspense=ei;w.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O;w.__COMPILER_RUNTIME={__proto__:null,c:function(e){return O.H.useMemoCache(e)}};w.cache=function(e){return function(){return e.apply(null,arguments)}};w.cacheSignal=function(){return null};w.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=ho({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!vo.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(o[i]=t[i]);var i=arguments.length-2;if(i===1)o.children=n;else if(1<i){for(var a=Array(i),s=0;s<i;s++)a[s]=arguments[s+2];o.children=a}return It(e.type,r,o)};w.createContext=function(e){return e={$$typeof:Jr,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Xr,_context:e},e};w.createElement=function(e,t,n){var o,r={},i=null;if(t!=null)for(o in t.key!==void 0&&(i=""+t.key),t)vo.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(r[o]=t[o]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var s=Array(a),l=0;l<a;l++)s[l]=arguments[l+2];r.children=s}if(e&&e.defaultProps)for(o in a=e.defaultProps,a)r[o]===void 0&&(r[o]=a[o]);return It(e,i,r)};w.createRef=function(){return{current:null}};w.forwardRef=function(e){return{$$typeof:Qr,render:e}};w.isValidElement=_t;w.lazy=function(e){return{$$typeof:mo,_payload:{_status:-1,_result:e},_init:si}};w.memo=function(e,t){return{$$typeof:ti,type:e,compare:t===void 0?null:t}};w.startTransition=function(e){var t=O.T,n={};O.T=n;try{var o=e(),r=O.S;r!==null&&r(n,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then(Mt,yo)}catch(i){yo(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),O.T=t}};w.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()};w.use=function(e){return O.H.use(e)};w.useActionState=function(e,t,n){return O.H.useActionState(e,t,n)};w.useCallback=function(e,t){return O.H.useCallback(e,t)};w.useContext=function(e){return O.H.useContext(e)};w.useDebugValue=function(){};w.useDeferredValue=function(e,t){return O.H.useDeferredValue(e,t)};w.useEffect=function(e,t){return O.H.useEffect(e,t)};w.useEffectEvent=function(e){return O.H.useEffectEvent(e)};w.useId=function(){return O.H.useId()};w.useImperativeHandle=function(e,t,n){return O.H.useImperativeHandle(e,t,n)};w.useInsertionEffect=function(e,t){return O.H.useInsertionEffect(e,t)};w.useLayoutEffect=function(e,t){return O.H.useLayoutEffect(e,t)};w.useMemo=function(e,t){return O.H.useMemo(e,t)};w.useOptimistic=function(e,t){return O.H.useOptimistic(e,t)};w.useReducer=function(e,t,n){return O.H.useReducer(e,t,n)};w.useRef=function(e){return O.H.useRef(e)};w.useState=function(e){return O.H.useState(e)};w.useSyncExternalStore=function(e,t,n){return O.H.useSyncExternalStore(e,t,n)};w.useTransition=function(){return O.H.useTransition()};w.version="19.2.8"});var N=Ge((za,xo)=>{"use strict";xo.exports=bo()});var Co=Ge(et=>{"use strict";var Si=Symbol.for("react.transitional.element"),wi=Symbol.for("react.fragment");function Vo(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:Si,type:e,key:o,ref:t!==void 0?t:null,props:n}}et.Fragment=wi;et.jsx=Vo;et.jsxs=Vo});var Ie=Ge((ts,Io)=>{"use strict";Io.exports=Co()});var fe={focusId:null,relation:null,expanded:[],pins:{}},Be=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function ee(e){let t=new URLSearchParams;e.focusId&&t.set("focus",e.focusId),e.relation&&t.set("relation",e.relation),e.overview&&t.set("overview","1"),e.zoom&&t.set("zoom","1"),e.past&&t.set("past","1"),e.shown&&e.shown.length>0&&t.set("show",[...e.shown].sort().join(",")),e.selection!==void 0&&e.selection.length>0&&t.set("sel",[...e.selection].sort().join(",")),e.expanded.length>0&&t.set("expand",[...e.expanded].sort().join(","));for(let o of Object.keys(e.pins).sort()){let r=e.pins[o];t.set(`pin.${o}`,`${qe(r.x)},${qe(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${qe(e.pan.x)},${qe(e.pan.y)}`);for(let o of Object.keys(e.within??{}).sort()){let r=e.within[o];r.length>0&&t.set(`in.${o}`,r)}e.q&&e.q.trim().length>0&&t.set("q",e.q);let n=t.toString();return n?`#${n}`:"#"}function Gr(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function ze(e){let t=e.includes("#")?e.slice(e.indexOf("#")+1):e,n=new URLSearchParams(t),o=Object.create(null);for(let[m,p]of n){if(!m.startsWith("pin."))continue;let[g,x]=p.split(","),P=g===void 0?null:Be(g),y=x===void 0?null:Be(x);P===null||y===null||(o[m.slice(4)]={x:P,y})}let r=Object.create(null);for(let[m,p]of n)!m.startsWith("in.")||p.length===0||(r[m.slice(3)]=p);let i=n.get("view");i&&i.length>0&&r.view===void 0&&(r.view=i);let a=n.get("pan")?.split(",")??[],s=a[0]===void 0?null:Be(a[0]),l=a[1]===void 0?null:Be(a[1]),c=(n.get("sel")??"").split(",").filter(m=>m.length>0).sort(),u=n.get("overview")==="1";return{...c.length>0?{selection:c}:{},...u?{overview:!0}:{},...n.get("zoom")==="1"?{zoom:!0}:{},...n.get("past")==="1"?{past:!0}:{},...n.get("show")?{shown:[...new Set(n.get("show").split(",").filter(Boolean))].sort()}:{},...s!==null&&l!==null?{pan:{x:s,y:l}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:Gr(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(m=>m.length>0&&(u||!m.startsWith("kind:"))).sort(),pins:o}}function Ma(e){let t=ze(e);return ee(t)==="#"?{...t,overview:!0}:t}function Oa(e){let t=ee(e);return t==="#overview=1"?"":t}function qe(e){return Math.round(e*100)/100}function oo(e,t){return ee(e)===ee(t)}var no="edge:";function ro(e){if(!e.startsWith(no))return null;let t=e.slice(no.length).split(":");if(t.length!==3)return null;let[n,o,r]=t;if(!n||!o||!r)return null;try{return{kind:decodeURIComponent(n),from:decodeURIComponent(o),to:decodeURIComponent(r)}}catch{return null}}function Et(e){let{pan:t,...n}=e;return{...n,pins:{}}}function q(e,t){if(t===e.focusId)return{...e,focusId:t};let n=Et(e);return{...n.within?.q!==void 0?ae(n,"q",null):n,focusId:t}}function io(e,t){return{...e,relation:t}}function ae(e,t,n){let o={...e.within??{}};if(n===null?delete o[t]:o[t]=n,Object.keys(o).length===0){let{within:r,...i}=e;return i}return{...e,within:o}}function pe(e,t){if(t!==e.overview&&(e=Et(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function $e(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function Ve(e,t){if(t!==(e.zoom===!0)&&(e=Et(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function Ue(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}var Ze="aggregate:",Ye="kind:";function At(e){return`${Ye}${e}`}function ye(e){return e.startsWith(Ye)?e.slice(Ye.length):null}var Ia="kinds:beyond";function Fr(e){let t=ye(e);return t?[t]:se(e)}function te(...e){return`${Ze}${[...e].sort().join("+")}`}function ao(e){return e.startsWith(Ze)}function se(e){return!ao(e)||e.includes("|")?[]:e.slice(Ze.length).split("+").filter(Boolean)}function so(e,t,n={}){let o=ye(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return Ue(e,t);let r=o!==null?te(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return Ve(e,!1);if(o!==null&&n.carry){let i=pe({...q(e,r),relation:null},!1);return ae(Ve(i,!0),"q",n.carry)}return Ve({...q(e,r),relation:null},!0)}function Kr(e,t,n){return ae(pe(q(e,te(t)),!1),"view",n)}function _a(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var lo="aggregate:";function Pt(e){return e.startsWith(lo)&&e.includes("|")}var kt=e=>e?.off===!0,Br=e=>e!==void 0&&!kt(e)&&(e.fast!==void 0||e.thinking!==void 0||e.answer!==void 0||e.decide!==void 0||e.complete!==void 0||e.turn!==void 0),uo=e=>e!==void 0&&!kt(e)&&(e.fast!==void 0||e.decide!==void 0),qr=e=>e?.suggestOnOpen!==!1&&uo(e),zr=e=>e?.hoverChips===!0&&uo(e);var Rt={};var Eo=_(N(),1),di={turns:[],outcomes:new Map,busy:!1,pending:null,draft:null,draftNote:null},Ao=e=>`graview:seat:${e}`;function ui(e){if(!e)return{};try{let t=sessionStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return{...Array.isArray(n.turns)?{turns:n.turns}:{},...Array.isArray(n.outcomes)?{outcomes:new Map(n.outcomes)}:{},...n.draft?.drawn?{draft:n.draft}:{}}}catch{return{}}}function ci(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],draft:t.draft}))}catch{}}function Lt(e){let t=e===null?null:Ao(e),n={...di,...ui(t)},o=new Set,r=(i,a=!0)=>{n=i,a&&ci(t,n);for(let s of[...o])s()};return{get:()=>n,subscribe(i){return o.add(i),()=>void o.delete(i)},setTurns:i=>r({...n,turns:i(n.turns)}),settle:(i,a)=>r({...n,outcomes:new Map(n.outcomes).set(i,a)}),setBusy:i=>r({...n,busy:i},!1),ask:i=>r({...n,pending:i.trim()||null}),takePending(){let i=n.pending;return i!==null&&r({...n,pending:null},!1),i},setDraft:(i,a=null)=>r({...n,draft:i,draftNote:a})}}function fi(e){return(0,Eo.useSyncExternalStore)(e.subscribe,e.get,e.get)}var ko=_(N(),1),pi={entries:[],ghost:null,loaded:!1};function Po(e,t){let n=new Map(e.map(o=>[o.id,o]));for(let o of t)n.set(o.id,{...n.get(o.id),...o});return[...n.values()].sort((o,r)=>o.at<r.at?1:o.at>r.at?-1:0)}function Ht(e){let t=pi,n=new Set,o=r=>{t=r;for(let i of[...n])i()};return{get:()=>t,subscribe:r=>(n.add(r),()=>n.delete(r)),record:r=>{o({...t,entries:Po(t.entries,[r])}),Promise.resolve(e()?.keep?.(r)).catch(i=>{console.warn("The host did not keep an AI interaction:",i)})},setGhost:r=>o({...t,ghost:r}),load:()=>{if(t.loaded)return;o({...t,loaded:!0});let r=e()?.load;r&&Promise.resolve(r()).then(i=>o({...t,entries:Po(t.entries,i)})).catch(i=>{console.warn("The host's AI interactions could not be read:",i)})}}}function yi(e){return(0,ko.useSyncExternalStore)(e.subscribe,e.get,e.get)}function Ro(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}var Je=_(N(),1),Qe=(0,Je.createContext)(void 0),mi=()=>(0,Je.useContext)(Qe);var A=_(N(),1),Ce=(0,A.createContext)(null);function Mo(){return(0,A.useContext)(Ce)}function gi(e,t){let n=Mo(),o=(0,A.useMemo)(()=>n?n.live.seenBy(t):e,[n,e,t]),r=(0,A.useRef)(0),i=(0,A.useCallback)(a=>o.subscribe(()=>{r.current+=1,a()}),[o]);return(0,A.useSyncExternalStore)(i,()=>r.current,()=>0),o}var Oo=Ke(()=>(__graviewPreload(import.meta.url,["./chunk.SVH3OMU2.js","./chunk.TI4OSTQV.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.OYQ6ZA6T.js")));function Dt(e){let[,t]=(0,A.useReducer)(o=>o+1,0),n=e.publishing?.mode==="on-publish"&&!Yn();return(0,A.useEffect)(()=>{n&&Oo().then(t,()=>{})},[n]),!n}var To,hi=400;function Nt(e,t,n){let o=(0,A.useContext)(Ce),r=o!==null&&o.owns(e,t),[i,a]=(0,A.useState)(null),[s,l]=(0,A.useState)(To);(0,A.useEffect)(()=>{if(s||r||i===null)return;let b=!0;return Oo().then(I=>{To=I,b&&l(I)},()=>{}),()=>{b=!1}},[s,r,i]);let[c,u]=(0,A.useState)(0),m=(0,A.useMemo)(()=>r||i===null||i>=e.log.length||!s?void 0:s.askArchived(e,i,n)??s.askDeclaration(n,i),[r,e,i,n,s,c]),p=m&&"waiting"in m?m.waiting:void 0,g=m&&"seq"in m?m:null,[x,P]=(0,A.useState)(void 0);(0,A.useEffect)(()=>{if(!p)return;let b=!0,I=setTimeout(()=>b&&P(p),hi);return p.then(()=>b&&u(C=>C+1)),()=>{b=!1,clearTimeout(I)}},[p]);let y=p!==void 0&&x!==p||g!==null,v=(0,A.useMemo)(()=>{if(r||i===null||i>=e.log.length||!s||y)return null;try{let b=s.pastAt(e,i,n);return{seq:i,at:b.past?.at,store:b}}catch{return null}},[r,e,i,n,s,y,c]),S=(0,A.useRef)(null),E=y?S.current:v;(0,A.useEffect)(()=>{S.current=E},[E]);let k=(0,A.useCallback)(b=>a(b===null?null:b>=e.log.length?Number.POSITIVE_INFINITY:b),[e]),W=(0,A.useCallback)((b,I)=>[e,E?.store].some(C=>C!==void 0&&(C===b||C.seenBy(I)===b)),[e,E]),H=i!==null,j=(0,A.useMemo)(()=>({past:E,open:H,show:k,live:e,host:n,owns:W,archive:g}),[E,H,k,e,n,W,g]);return r?o:j}var _o=e=>`graview:setting:${e}`;function Lo(){return localStorage}function Ho(e,t){try{let n=(t??Lo()).getItem(_o(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function Do(e,t,n){try{(n??Lo()).setItem(_o(e.name),t)}catch{}}function No(e,t){if(typeof document>"u")return;let n=document.documentElement;if(e.honored==="root-font-size"){n.style.fontSize=t===e.initial?"":t;return}let o=`graview${e.name.replace(/-([a-z0-9])/g,(r,i)=>i.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}`;t===e.initial?delete n.dataset[o]:n.dataset[o]=t}var L=_(N(),1);function Wt(e){return Fe(e)}var vi=12,bi=4;function xi(e,t,n){let o=Wt(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var tt=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-vi);function Wo(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=bi)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?At([...o][0]):n[0]}function jt(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[a,s]of e)s.mode!=="asking"&&s.mode!=="docked"&&t.at-s.since>=t.holdMs&&o.set(a,{...s,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=xi(e,t.author,t.at),i=a=>o.set(r.participant,{...r,...a,since:t.at});switch(t.type){case"read":{let a=Wo(t.ids,n);return i({at:a,mode:"reading",trail:tt(r.trail,a)}),o}case"about-to-write":case"write":{let a=Wo(t.ids,n);return i({at:a,mode:"writing",trail:tt(r.trail,a),say:void 0,confidence:void 0}),o}case"refused":return i({at:t.where,mode:"refused",say:t.say,confidence:void 0,trail:tt(r.trail,t.where)}),o;case"asking":return i({at:t.where??r.at,mode:"asking",say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},trail:tt(r.trail,t.where)}),o;case"said":return i({say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},...t.caption?{caption:t.caption}:{}}),o;case"over":return i({over:t.over}),o;case"home":return i({at:null,mode:"docked",trail:[],say:void 0,confidence:void 0,over:null}),o;default:return o}}var jo="graview:session";function Go(e){let t=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);try{let n=e??sessionStorage,o=n.getItem(jo);if(o)return o;let r=t();return n.setItem(jo,r),r}catch{return t()}}var Gt={name:"share-where",title:"Where you are",description:"Whether the others here see which stop you are on.",honored:"root-attribute",options:[{value:"shared",label:"Shown"},{value:"private",label:"Hidden"}],initial:"shared"},Ft={name:"share-over",title:"What you point at",description:"Whether the others see the thing under your pointer, outlined in your color.",honored:"root-attribute",options:[{value:"private",label:"Kept to yourself"},{value:"shared",label:"Outlined for others"}],initial:"private"},Fo=[Gt,Ft],Ei=800;function Ko(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:a,seatWho:s,settingValues:l,setView:c,ttlMs:u=to,people:m,seats:p}=e,[g,x]=(0,L.useState)(()=>new Map),[P,y]=(0,L.useState)(null),[v,S]=(0,L.useState)(null),[E,k]=(0,L.useState)(null),W=typeof r.id=="string"&&r.id.length>0,H=W&&(l[Gt.name]??Gt.initial)==="shared",j=H&&(l[Ft.name]??Ft.initial)==="shared",b=Wt({kind:r.kind,...r.id?{id:r.id}:{},session:i}),I=W?zn(r,{graph:n.graph,schema:n.schema,...p?{seats:p}:{},...m?{people:m}:{}}):"",C=s?a.get(`agent:${s}:${i}`):void 0,F=(0,L.useMemo)(()=>!t||!H?null:{participant:b,kind:r.kind,name:I,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:$n(r.id??"nobody"),stop:E??ee(o),...j?{over:P}:{},...C?{robot:{at:C.at,mode:C.mode}}:{},at:new Date().toISOString()},[t,H,j,b,I,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,E,P,C?.at,C?.mode]);(0,L.useEffect)(()=>{if(!t||!F)return;t.here(F);let V=setInterval(()=>t.here({...F,at:new Date().toISOString()}),Ei);return()=>clearInterval(V)},[t,F]),(0,L.useEffect)(()=>t?t.onWho(K=>x(xt(new Map,K,Date.now(),u))):void 0,[t,u]);let Ee=g.size>0;(0,L.useEffect)(()=>{if(!Ee)return;let V=setInterval(()=>{x(K=>{let J=xt(K,[],Date.now(),u);return J.size===K.size?K:J})},Math.max(250,Math.min(1e3,u/4)));return()=>clearInterval(V)},[Ee,u]),(0,L.useEffect)(()=>{if(!t||typeof window>"u")return;let V=()=>t.leave();return window.addEventListener("pagehide",V),()=>window.removeEventListener("pagehide",V)},[t]),(0,L.useEffect)(()=>{if(!j||typeof document>"u")return;let V=null,K=J=>{let de=Ro(J.target);de!==V&&(V=de,y(de))};return document.addEventListener("pointermove",K,{passive:!0}),()=>document.removeEventListener("pointermove",K)},[j]);let oe=(0,L.useRef)(null),Y=v?g.get(v)??null:null,Z=(0,L.useCallback)(V=>{oe.current=null,S(V)},[]);return(0,L.useEffect)(()=>{if(v){if(!Y){S(null);return}Y.stop!==oe.current?.stop&&(oe.current={stop:Y.stop,at:Date.now()},c(ze(Y.stop)))}},[v,Y,c]),(0,L.useEffect)(()=>{let V=oe.current;!v||V===null||Date.now()-V.at<400||oo(o,ze(V.stop))||S(null)},[o,v]),(0,L.useEffect)(()=>{if(!v||typeof document>"u")return;let V=K=>{K.key==="Escape"&&S(null)};return document.addEventListener("keydown",V),()=>document.removeEventListener("keydown",V)},[v]),(0,L.useMemo)(()=>({who:g,sharing:F?{participant:b,name:I}:null,following:Y,follow:Z,sayWhere:k}),[g,F,b,I,Y,Z])}var $=_(N(),1);function Bo(e){return Fe(e.author)}function Ai(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function qo(e,t,n,o,r){let i=new Map;for(let[l,c]of e)o-c.at<r&&i.set(l,c);let a=new Set(n.flatMap(l=>l.nodeIds)),s=(l,c,u)=>{let m=i.get(l),p=m?.participants.includes(Bo(c))?m.participants:[...m?.participants??[],Bo(c)];i.set(l,{at:o,manner:Ai(p,c.author.kind),intent:c.intent,wrote:(m?.wrote??!1)||(u.wrote??!1),read:(m?.read??!1)||(u.read??!1),broke:(m?.broke??!1)||a.has(l),participants:p})};for(let l of t){for(let c of l.writes)s(c,l,{wrote:!0});for(let c of l.reads)l.writes.includes(c)||s(c,l,{read:!0})}for(let l of n)for(let c of l.nodeIds){let u=i.get(c);i.set(c,{at:o,manner:u?.manner??"rule",intent:u?.intent??l.message,wrote:u?.wrote??!1,read:u?.read??!1,broke:!0,participants:u?.participants??["rule::"]})}return i}var Pi=2600;function zo(e,t=Pi){let[n,o]=(0,$.useState)(()=>new Map),r=(0,$.useRef)(n);r.current=n;let i=(0,$.useRef)(null),a=(0,$.useCallback)(l=>{r.current=l,o(l),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,$.useEffect)(()=>{let l=e.violations(),c=e.subscribe((u,m)=>{let p=e.violations(),g=Jn(e.allInvariants(),l,p).introduces;l=p,a(qo(r.current,m,g.map(x=>({nodeIds:x.nodeIds,message:x.message})),Date.now(),t))});return()=>{c(),i.current&&clearTimeout(i.current)}},[e,t,a]);let s=(0,$.useCallback)(l=>{l.reads.length!==0&&a(qo(r.current,[ki(l)],[],Date.now(),t))},[t,a]);return{activity:n,noteAttention:s}}function ki(e){return{id:`attention:${e.intent}`,seq:-1,batch:"attention",author:e.author,intent:e.intent,mutation:null,primitives:[],reads:e.reads,writes:[],at:new Date().toISOString()}}var d=_(N(),1);function $o(){let e=null,t=new Set,n=new Set,o=r=>{for(let i of n)i(r)};return{subscribe(r){return t.add(r),t.size===1&&o(!0),()=>{t.delete(r),t.size===0&&(e=null,o(!1))}},snapshot:()=>e,set(r){if(!(e===r||e&&r&&e.x===r.x&&e.y===r.y)){e=r;for(let i of t)i()}},get listeners(){return t.size},onActive(r){return n.add(r),()=>void n.delete(r)}}}var nt=_(N(),1),Ri=e=>e.definitions.some(t=>Bn(t).size>0);function Uo(e,t,n){let[o,r]=(0,nt.useState)(void 0),i=(n.roles??[]).join("\0");return(0,nt.useEffect)(()=>{if(!t||!Ri(e.schema)){r(void 0);return}let a=!0,s=!1,l=e.graph,c=()=>{s||(s=!0,queueMicrotask(()=>{s=!1,a&&e.reread()}))},u=qn(t,{kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{}},c);return bt(l,u.read),r(u),e.reread(),()=>{a=!1,bt(l,void 0)}},[e,t,n.kind,n.id,i]),o}function Yo(){let e=!1,t=new Set;return{moving:()=>e,set(n){if(n!==e){e=n;for(let o of t)o()}},subscribe(n){return t.add(n),()=>t.delete(n)}}}var le=_(Ie(),1),Ti="graview:place-menu",_e=(0,d.createContext)(null),Qo=(0,d.createContext)("scene");function Mi({mode:e,children:t}){return(0,le.jsx)(Qo.Provider,{value:e,children:t})}function Oi(){return(0,d.useContext)(Qo)}var er={kind:"human"},Vi=[],Ci=[],Ii=[],Kt=[];function tr(e,t){let n=(0,d.useId)();(0,d.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??er,r=()=>Xn(e,o,n);r();let i,a=e.subscribe(()=>{clearTimeout(i),i=setTimeout(r,250)});return()=>{clearTimeout(i),a(),globalThis.__graviewWatch?.unseen?.({words:[],from:n,gone:!0})}},[e,t,n])}var _i=()=>{try{return typeof location<"u"&&new URLSearchParams(location.search).get("as")==="published"?"published":void 0}catch{return}},Li={off:!0};function Hi({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,as:a,seats:s=Vi,onSeat:l,people:c=Ci,memory:u,presenceTtlMs:m,app:p,settings:g=p?.settings??Ii,presence:x,brand:P,locale:y,timeZone:v,onKeepLens:S,providers:E,ai:k,files:W,resolveApp:H,history:j,linkedRecords:b,menuSections:I,keptViews:C,subscriptions:F,dismissals:Ee,whileAway:oe,signIn:Y,view:Z,onViewChange:V,children:K}){let J=(0,d.useContext)(_e),de=I??J?.menuSections,sn=Y??J?.signIn,pt=C??J?.keptViews,[Rr,Tr]=(0,d.useState)(null),ue=Rr??i??s[0]?.principal??er,He=Nt(e,ue,j),ln=He.past&&He.live===e?He.past.store:e,yt=a??_i(),mt=!Dt(e),D=(0,d.useMemo)(()=>mt?e:ln.seenBy(ue,yt?{as:yt}:void 0),[mt,e,ln,ue,yt]);tr(e,ue);let[re]=(0,d.useState)(()=>Go(u)),[dn,Mr]=(0,d.useState)(!1),un=(0,d.useCallback)(()=>Mr(!0),[]),ie=(0,d.useMemo)(()=>x?[...g,...Fo]:g,[g,x]),[gt]=(0,d.useState)(()=>n??$t(t,e.schema)),[Or,cn]=(0,d.useState)(()=>$e(gt??fe,r??gt?.selection??[])),Ae=(0,d.useRef)(gt??fe).current,[fn,Vr]=(0,d.useState)(null),[pn,Cr]=(0,d.useState)(null),X=(0,d.useContext)(_e),[yn]=(0,d.useState)(()=>X?.seatTalk??Lt(P?.name??e.schema.kinds.join(","))),ht=k??X?.ai??Rt,De=(0,d.useMemo)(()=>ht.off?Li:ht,[ht]),mn=(0,d.useRef)(De.interactions);mn.current=De.interactions;let[gn]=(0,d.useState)(()=>X?.aiDesk??Ht(()=>mn.current)),[Ir]=(0,d.useState)(()=>X?.subscriptions??Zn()),hn=F??X?.subscriptions??Ir,St=S??X?.onKeepLens,Ne=p??X?.app,We=y??X?.locale,_r=P?.locale??Ne?.brand?.locale,je=v??X?.timeZone;Kn({reader:We,app:_r,readerTimeZone:je,appTimeZone:P?.timeZone??Ne?.brand?.timeZone});let Sn=(0,d.useRef)(null),wn=(0,d.useCallback)(f=>{Sn.current=f},[]),vn=(0,d.useCallback)(f=>Sn.current?.whereIs(f)??null,[]),[bn]=(0,d.useState)(()=>$o()),[xn]=(0,d.useState)(()=>Yo()),[wt,Lr]=(0,d.useState)(null),[Pe,En]=(0,d.useState)(()=>new Map),ke=(0,d.useRef)(Pe);ke.current=Pe;let Re=(0,d.useRef)(null),vt=(0,d.useCallback)(f=>D.graph.getNode(f)?.kind,[D]),Q=(0,d.useCallback)(f=>{let h=jt(ke.current,f,vt);ke.current=h,En(h),Re.current&&clearTimeout(Re.current),[...h.values()].some(M=>M.mode!=="docked"&&M.mode!=="asking")&&(Re.current=setTimeout(()=>{let M=jt(ke.current,{type:"rest",at:Date.now(),holdMs:zt},vt);ke.current=M,En(M)},zt+20))},[vt]),An=(0,d.useCallback)(f=>Q({...f,at:f.at??Date.now()}),[Q]),Pn=(0,d.useCallback)(f=>{Lr(f),f&&Q({type:"home",author:{kind:"agent",id:f,session:re},at:Date.now()})},[Q,re]);(0,d.useEffect)(()=>D.subscribe((f,h)=>{for(let R of h)R.author.kind==="agent"&&Q({type:"write",author:R.author,ids:R.writes,at:Date.now()})}),[D,Q]),(0,d.useEffect)(()=>()=>{Re.current&&clearTimeout(Re.current)},[]);let z=(0,d.useMemo)(()=>({...ue,session:re}),[ue,re]),kn=Uo(D,b,z),Rn=(0,d.useCallback)(f=>{Tr(f),l?.(f)},[l]),[Te,Hr]=(0,d.useState)(()=>Object.fromEntries(ie.map(f=>[f.name,Ho(f,u)])));(0,d.useEffect)(()=>{for(let f of ie)No(f,Te[f.name]??f.initial)},[ie,Te]);let Tn=(0,d.useCallback)((f,h)=>{let R=ie.find(M=>M.name===f);!R||!R.options.some(M=>M.value===h)||(Do(R,h,u),Hr(M=>({...M,[f]:h})))},[ie,u]),[Mn,Dr]=(0,d.useState)(null),{activity:On,noteAttention:Vn}=zo(D),Cn=(0,d.useCallback)(f=>{Vn(f),Q({type:"read",author:f.author,ids:f.reads,at:Date.now()})},[Vn,Q]),ce=(0,d.useCallback)(f=>{if(ye(f)!==null||se(f).length>0||Pt(f))return!0;let h=ro(f);return h?D.graph.allEdges().some(R=>R.kind===h.kind&&R.from===h.from&&R.to===h.to):D.graph.getNode(f)!==void 0},[D]),In=(0,d.useCallback)(f=>{let h=f.selection??Kt,R=h.filter(ce),M=R.length===h.length?f:$e(f,R);return M.focusId!==null&&!ce(M.focusId)&&(M=q(M,null)),M},[ce]),Me=(0,d.useCallback)(f=>{let h=In(f),R=Jo(D,z,h.shown);if(h.focusId!==null&&R.size>0){let M=se(h.focusId),Fn=D.graph.getNode(h.focusId);(M.length>0?M.every(jr=>R.has(jr)):Fn?R.has(Fn.kind):!1)&&(h={...h,focusId:null})}if(!h.overview&&h.focusId===null){let M=Ae.focusId!==null&&!ce(Ae.focusId)?$t(t,e.schema)??{...fe,overview:!0}:Ae;M.focusId!==null&&ce(M.focusId)?h={...h,focusId:M.focusId}:M.overview===!0&&(h={...h,overview:!0})}return h},[In,ce,D,Ae,z,t,e.schema]),B=Me(Z??Or),_n=(0,d.useMemo)(()=>Jo(D,z,B.shown),[D,z,B.shown]),Ln=(0,d.useMemo)(()=>[...D.modules.administered.entries()].map(([f,h])=>{let R=D.mayAdminister(f,z);return{name:f,...h.description?{description:h.description}:{},kinds:h.kinds??[],canShow:R,shown:R&&(B.shown??[]).includes(f)}}),[D,z,B.shown]),Oe=(0,d.useCallback)(f=>{let h=R=>Me(typeof f=="function"?f(R):f);if(Z!==void 0){V?.(h(Z));return}V&&V(h(B)),cn(R=>h(R))},[B,V,Z,Me]);(0,d.useEffect)(()=>{Z===void 0&&cn(f=>{let h=Me(f);return h===f?f:h})},[B,Z,Me]);let Hn=B.selection??Kt,Dn=(0,d.useCallback)(f=>{Oe(h=>$e(h,typeof f=="function"?f(h.selection??Kt):f))},[Oe]),{who:Nn,following:Wn,follow:jn,sayWhere:Nr,sharing:Gn}=Ko({channel:x,store:D,view:B,principal:z,session:re,robots:Pe,seatWho:wt,settingValues:Te,setView:Oe,seats:s,people:c,...m!==void 0?{ttlMs:m}:{}}),Wr=(0,d.useMemo)(()=>({store:D,scheme:o,views:t,view:B,setView:Oe,homeView:Ae,selection:Hn,setSelection:Dn,menuAt:fn,setMenuAt:Vr,whereIs:vn,pointer:bn,motion:xn,registerScene:wn,robots:Pe,noteSeat:An,seatWho:wt,registerSeatWho:Pn,actsDoor:pn,registerActsDoor:Cr,seatTalk:yn,aiDesk:gn,...u?{memory:u}:{},who:Nn,following:Wn,follow:jn,sayWhere:Nr,sharing:Gn,session:re,ai:De,resolveApp:H,linkedRecords:b,menuSections:de,...pt?{keptViews:pt}:{},subscriptions:hn,dismissals:Ee,whileAway:oe,signIn:sn,linkedReads:kn,movedByHand:dn,noteMoved:un,emphasis:Mn,setEmphasis:Dr,activity:On,noteAttention:Cn,principal:z,seats:s,people:c,takeSeat:Rn,settings:ie,settingValues:Te,chooseSetting:Tn,hiddenKinds:_n,administered:Ln,...E?{providers:E}:{},...P?{brand:P}:{},...St?{onKeepLens:St}:{},app:Ne,...We?{locale:We}:{},...je?{timeZone:je}:{}}),[D,o,t,B,Oe,Hn,Dn,fn,vn,bn,xn,wn,Pe,An,wt,Pn,pn,yn,gn,u,Nn,Wn,jn,Gn,re,De,H,b,de,pt,hn,Ee,oe,sn,kn,dn,un,Mn,On,Cn,z,s,c,Rn,ie,Te,Tn,_n,Ln,E,P,St,Ne,We,je]);return(0,le.jsx)(_e.Provider,{value:Wr,children:(0,le.jsx)(Ce.Provider,{value:He,children:(0,le.jsx)(Gi,{children:mt?null:W?(0,le.jsx)(Qe.Provider,{value:W,children:K}):K})})})}var nr=(0,d.createContext)(null),Bt,qt=new Set,Di=e=>(qt.add(e),()=>void qt.delete(e)),Zo=()=>Bt;function Ni(e){if(!Bt){Bt=e;for(let t of[...qt])t()}}var Wi=300;function ji(e){let t=0;return async(n,o)=>{let r=++t;return await new Promise(i=>setTimeout(i,Wi)),r===t?e(n,o):[]}}function Gi({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:a,ai:s}=ne(),l=ot(),c=n.q,u=n.focusId,m=!!(c&&c.trim().length>0),p=(0,d.useSyncExternalStore)(Di,Zo,Zo),g=(0,d.useMemo)(()=>m&&p?{flagged:new Set(t.violations().flatMap(E=>E.nodeIds)),touched:p.touchWeights(t.log.all())}:null,[t,l,m,p]),x=u?t.graph.getNode(u)?.kind??ye(u)??(se(u).length===1?se(u)[0]:void 0):void 0,P=(0,d.useMemo)(()=>s.near&&ji(s.near),[s.near]),y=(0,d.useMemo)(()=>!c||!g||!p?null:p.search(t,c,{...x?{inKind:x}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(E=>!i.has(E)),from:[...a,...u&&t.graph.has(u)?[u]:[]],flagged:g.flagged,touched:g.touched,limit:200,rank:P}),[t,c,r,o,i,a,u,x,g,P]),[v,S]=(0,d.useState)();return(0,d.useEffect)(()=>void y?.later?.then(E=>S([y,E])),[y]),(0,le.jsx)(nr.Provider,{value:v?.[0]===y?v[1]:y,children:e})}var Xo=new WeakMap;function Vs(e){let t=Xo.get(e);return t||Xo.set(e,t=new Set(e.matched)),t}function Fi(){return(0,d.useContext)(nr)}function ne(){let e=(0,d.useContext)(_e);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function Ut(){return(0,d.useContext)(_e)??null}function ot(){let{store:e}=ne(),t=(0,d.useRef)(null),n=(0,d.useRef)(null),o=(0,d.useCallback)(()=>(n.current!==e&&(n.current=e,t.current=null),t.current??=e.graph.allNodes(),t.current),[e]),r=(0,d.useCallback)(i=>e.subscribe(()=>{t.current=null,i()}),[e]);return(0,d.useSyncExternalStore)(r,o,o)}function Ki(e){let{store:t}=ne(),n=(0,d.useCallback)(r=>t.subscribe(r),[t]),o=(0,d.useCallback)(()=>e===null?void 0:t.graph.getNode(e),[t,e]);return(0,d.useSyncExternalStore)(n,o,o)}function Jo(e,t,n){let o=new Set(e.modules.disabledKinds);for(let r of e.kindsKeptFrom(t))o.add(r);for(let[r,i]of e.modules.administered)if(!(e.mayAdminister(r,t)&&(n??[]).includes(r)))for(let a of i.kinds??[])o.add(a);return o}var zt=2600;var or=new WeakSet,Bi=e=>or.has(e),qi=e=>void or.add(e);function $t(e,t){let n=eo(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...fe,focusId:te(n.place.kind),within:{view:n.place.as}}:{...fe,focusId:te(n.kind)}}var rr=_(N(),1),zi=(0,rr.createContext)(!1);var rt=Symbol.for("graview.default-view");function ir(e){return Object.defineProperty(e,rt,{value:!0,enumerable:!1}),e}function ar(e){return typeof e=="function"&&e[rt]===!0}var it=Symbol.for("graview.replaces-page");function sr(e){return Object.defineProperty(e,it,{value:!0,enumerable:!1}),e}function lr(e){return typeof e=="function"&&e[it]===!0}var at=Symbol.for("graview.bleeds");function dr(e){return Object.defineProperty(e,at,{value:!0,enumerable:!1}),e}function ur(e){return typeof e=="function"&&e[at]===!0}var st=Symbol.for("graview.previews");function cr(e,t={}){return Object.defineProperty(e,st,{value:t,enumerable:!1}),e}function fr(e){return typeof e=="function"?e[st]:void 0}function $i(e){return Qn(e)}function Ui(e,t){if(t===e)return e;for(let r of t.registrations())e.register(r.kind,r,r.view,r);let n=t.arrangement?.();n&&e.arrange?.(n);let o=t.homeView?.();return o&&e.home?.(o),e}var T=_(N(),1),U=_(Ie(),1),Yt=new Set,lt=0;function Zt(e){return()=>{lt+=1;let t=e();return t.then(()=>void(lt-=1),()=>void(lt-=1)),t}}var Yi=()=>lt,ut=(0,T.createContext)(null);function Zi(){return{waiting:new Map,at:0}}function Xi(e){for(let[t,n]of e.waiting)n<e.at&&e.waiting.delete(t);e.at+=1}var Ji=e=>e?.waiting.size??0;function mr(e,t){e?.waiting.set(t,e.at)}function gr(e){let t=(0,T.useContext)(ut);(0,T.useLayoutEffect)(()=>{t?.waiting.delete(e)},[t,e])}function Qi(e){let t={},n=!1,o=new Set,r=(0,T.lazy)(Zt(()=>e().then(a=>{n=!0;let s=a.default;function l(c){return gr(t),(0,T.createElement)(s,c)}return{default:l}},a=>{for(let s of o)s.waiting.delete(t);throw a})));function i(a){let s=(0,T.useContext)(ut);return!n&&s&&(o.add(s),mr(s,t)),(0,T.createElement)(r,a)}return i}var hr=!1,Sr=!1,dt=new Set;function ea(){hr=!0}function ta(){Sr=!0;for(let e of[...dt])e();dt.clear()}var wr=()=>Sr||!hr;function na(e){return wr()?(e(),()=>{}):(dt.add(e),()=>void dt.delete(e))}var pr=!1;function Xt(){for(let e of[...Yt])e()}function oa(){pr||typeof window>"u"||(pr=!0,window.addEventListener("online",Xt))}function Jt(e){let t,n=!1,o=!1,r,i=0,a=new Set,s=()=>{i+=1;for(let p of[...a])p()},l=p=>(a.add(p),()=>void a.delete(p)),c=()=>i,u=()=>void m().catch(()=>{});function m(){if(n)return Promise.resolve(t);if(r)return r;let p=e().then(g=>(t=g,n=!0,o=!1,r=void 0,Yt.delete(u),s(),g),g=>{throw r=void 0,o=!0,Yt.add(u),oa(),s(),g});return p.catch(()=>{}),r=p,p}return{load:m,prefetch:u,get current(){return t},get failed(){return o},part(p,g={}){let x=g.what??"This part",P={};function y(E){(0,T.useSyncExternalStore)(l,c,c),gr(P);let k=(0,T.useRef)(null),W=(0,T.useRef)(null),H=(0,T.useRef)(!1);return(0,T.useEffect)(()=>{o&&r===void 0&&u()},[]),n&&typeof document<"u"&&k.current!==null&&document.activeElement===k.current&&(H.current=!0),(0,T.useLayoutEffect)(()=>{if(!(!n||!H.current)){H.current=!1;for(let j=W.current?.nextElementSibling??null;j!==null;j=j.nextElementSibling){let b=j.matches(yr)?j:j.querySelector(yr);if(b instanceof HTMLElement){b.focus();return}}}}),n?(0,U.jsxs)(U.Fragment,{children:[H.current?(0,U.jsx)("span",{ref:W,hidden:!0}):null,p(t,E)]}):g.quiet?null:(0,U.jsx)(ra,{what:x,button:k,...g.as?{as:g.as}:{}})}let v=(0,T.lazy)(Zt(()=>m().then(()=>({default:y}),()=>({default:y}))));function S(E){let k=(0,T.useContext)(ut),[W]=(0,T.useState)(()=>n||o);return!n&&!o&&mr(k,P),(0,T.createElement)(W?y:v,E)}return S}}}var yr="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function ra({what:e,button:t,as:n="p"}){let r=typeof navigator<"u"&&navigator.onLine===!1?`${e} will load when you're back online.`:`${e} didn't load.`;return(0,U.jsxs)(n,{"data-testid":"lazy-part-missing",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,U.jsx)("span",{role:"status",children:r})," ",(0,U.jsx)("button",{ref:t,type:"button","data-testid":"lazy-part-retry",onClick:Xt,style:{font:"inherit",fontWeight:600,color:"var(--graview-ink)",background:"none",border:"1px solid var(--graview-edge)",borderRadius:6,padding:"2px 10px"},children:"Try again"})]})}var Se=_(N(),1);function ia(){let{selection:e,setSelection:t}=ne();return(0,Se.useMemo)(()=>({selection:e,set:n=>t(n),clear:()=>t([]),toggle:n=>t(o=>o.includes(n)?o.filter(r=>r!==n):[...o,n]),isSelected:n=>e.includes(n)}),[e,t])}function aa(){let{store:e}=ne(),t=ot();return(0,Se.useMemo)(()=>sa(e),[e,t])}var vr=new WeakMap;function sa(e){let t=vr.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),vr.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function la(){let{view:e,setView:t}=ne();return(0,Se.useMemo)(()=>({view:e,url:ee(e),focus:n=>t(o=>q(o,n)),show:n=>t(o=>io(o,n)),toggle:n=>t(o=>Ue(o,n)),go:n=>t(n)}),[e,t])}var he={at:0,depth:0,listeners:new Set,tell(){for(let e of this.listeners)e()}};typeof window<"u"&&window.addEventListener("popstate",e=>{let t=e.state;he.at=typeof t?.graview=="number"?t.graview:0,he.at>he.depth&&(he.depth=he.at),he.tell()});var G=_(N(),1),en={profile:{trigger:"profile-button",pane:"profile",opens:"press",focus:"into",drawn:["shell","embed"]},problems:{trigger:"standing",pane:"problems",opens:"press",focus:"into",drawn:["shell","embed"]},places:{trigger:"app-places-open",pane:"app-places",opens:"press",focus:"into",drawn:["embed"]},here:{trigger:"here-open",pane:"here-list",opens:"press",focus:"into",drawn:["shell","embed","pages"]},suggested:{trigger:"suggested-button",pane:"suggested",opens:"press",focus:"into",drawn:["shell","embed","pages"]},activity:{trigger:"activity-button",pane:"activity",opens:"press",focus:"into",drawn:["shell","embed","pages"]},find:{trigger:"find-box",pane:"find-strip",opens:"typing",focus:"stays",drawn:["shell"]},districts:{trigger:"beyond-more",pane:"beyond-list",opens:"press",focus:"into",drawn:["shell","embed"]},acts:{trigger:null,pane:"context-menu",opens:"context-menu",focus:"into",drawn:["shell","embed","pages"]},arrange:{trigger:"arrange-add",pane:"arrange-list",opens:"press",focus:"into",drawn:["pages"]},"studio-ask":{trigger:"studio-agent",pane:"studio-agent-panel",opens:"press",focus:"into",drawn:["studio"]}},da={position:"fixed",inset:"auto",margin:0,zIndex:Un("popover"),boxSizing:"border-box"},ct=6,we=8,ua=e=>typeof e.showPopover=="function";function ft(e){try{return e.matches(":popover-open")}catch{return!1}}function ca(e){if(typeof e=="function"){let o=e();return o?{left:o.x,right:o.x,top:o.y,bottom:o.y}:null}let t=e.current;if(!t||!t.isConnected)return null;let n=t.getBoundingClientRect();return{left:n.left,right:n.right,top:n.top,bottom:n.bottom}}function tn(e,t,n={}){let o=ca(t);if(!o)return;let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},i=e.dataset.graviewDesignedHeight??=e.style.maxHeight;e.style.maxHeight=i;let a=e.getBoundingClientRect(),s=r.height-o.bottom-ct-we,l=o.top-ct-we,c=a.height<=s||s>=l,u=Math.max(96,Math.floor(c?s:l)),m=Math.min(a.height,u);a.height>u&&(e.style.maxHeight=i?`min(${i}, ${u}px)`:`${u}px`);let p=a.width,g=n.align==="start"?o.left:o.right-p,x=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();x&&p<=x.right-x.left&&(g<x.left?g=o.left+p<=x.right?o.left:x.left:g+p>x.right&&(g=o.right-p>=x.left?o.right-p:x.right-p));let P=p>=r.width-2*we?Math.max(0,(r.width-p)/2):Math.max(we,Math.min(g,r.width-we-p)),y=c?o.bottom+ct:Math.max(we,o.top-ct-m);e.style.left=`${Math.round(P)}px`,e.style.top=`${Math.round(y)}px`}function br(e,t,n,o={}){let r=o.align??"end";(0,G.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(ua(i)&&!ft(i))try{i.showPopover(),pa()}catch{}let a=0,s=c=>{c?.target instanceof Node&&i.contains(c.target)||(cancelAnimationFrame(a),a=requestAnimationFrame(()=>tn(i,n,{align:r})))};tn(i,n,{align:r}),addEventListener("resize",s),addEventListener("scroll",s,!0);let l=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>s());return l?.observe(i),()=>{if(cancelAnimationFrame(a),removeEventListener("resize",s),removeEventListener("scroll",s,!0),l?.disconnect(),i.isConnected&&ft(i))try{i.hidePopover()}catch{}}},[t,e,r])}var nn=new Set;function fa(e){return nn.add(e),()=>nn.delete(e)}function pa(){for(let e of nn)if(!(!e.isConnected||!ft(e)))try{e.hidePopover(),e.showPopover()}catch{}}var ve=null,ya='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function ma(e){for(let t of e.querySelectorAll(ya))if(t.closest("[hidden]")===null&&getComputedStyle(t).visibility!=="hidden")return t;return e}var Qt=()=>{let e=document.activeElement;return e===null||e===document.body};function ga(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[a,s]=(0,G.useState)(!1),l=t.open??a,c=(0,G.useRef)(null),u=(0,G.useRef)(null),m=(0,G.useCallback)(S=>{c.current=S},[]),p=(0,G.useCallback)(S=>{u.current=S},[]),g=`graview-popover-${(0,G.useId)().replace(/:/g,"")}`,x=(0,G.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});x.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let P=(0,G.useCallback)(S=>{x.current.controlled||s(S),x.current.onOpenChange?.(S)},[]),y=(0,G.useCallback)(()=>{(document.querySelector(`[aria-controls="${g}"]`)??c.current??x.current.returnTo?.()??null)?.focus({preventScroll:!0})},[g]),v=(0,G.useCallback)(S=>{let E=u.current,k=typeof document>"u"?null:document.activeElement,W=k===null||k===document.body||E!==null&&E.contains(k);P(!1),!(!S||!W)&&(y(),requestAnimationFrame(()=>{Qt()&&y()}))},[P,y]);return br(u,i&&l,n??c,t.align?{align:t.align}:{}),(0,G.useEffect)(()=>{if(!i||!l)return;let S={name:e,close:()=>v(!1)};if(ve&&ve.close!==S.close&&ve.close(),ve=S,en[e].focus==="into"){let b=u.current;b&&!b.contains(document.activeElement)&&ma(b).focus({preventScroll:!0})}let E=b=>{b.key==="Escape"&&v(!0)},k=b=>{let I=b.target;if(!(I instanceof Node))return;let C=u.current;if(C?.contains(I)||c.current?.contains(I))return;let F=I instanceof Element?I.closest('[role="dialog"], [role="alertdialog"]'):null;F&&!(C&&F.contains(C))||(v(!1),en[e].focus==="into"&&requestAnimationFrame(()=>{(Qt()||C!==null&&C.contains(document.activeElement))&&y()}))},W=null,H=null,j=b=>{let I=b.target;if(!(I instanceof Element))return;let C=u.current,F=I.closest('[role="dialog"], [role="alertdialog"]');!F||C&&(C.contains(F)||F.contains(C))||(W=F,v(!1))};return document.addEventListener("keydown",E),document.addEventListener("pointerdown",k,!0),document.addEventListener("focusin",j),()=>{document.removeEventListener("keydown",E),document.removeEventListener("pointerdown",k,!0),document.removeEventListener("focusin",j);let b=W;b&&typeof MutationObserver<"u"&&(H?.disconnect(),H=new MutationObserver(()=>{b.isConnected||(H?.disconnect(),requestAnimationFrame(()=>{(Qt()||document.activeElement.closest("[hidden]")!==null)&&y()}))}),H.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>H?.disconnect(),10*6e4)),ve?.close===S.close&&(ve=null)}},[i,l,e,v,y]),{open:l,setOpen:S=>S?P(!0):v(!0),toggle:()=>l?v(!0):P(!0),trigger:{ref:m,"aria-expanded":l,"aria-controls":g,"data-graview-popover-trigger":e},pane:{ref:p,id:g,popover:"manual",tabIndex:-1,"data-graview-popover":e,"data-graview-overlay":""}}}var be=_(N(),1);var xr=(0,be.createContext)(null);function ha(){let e=(0,be.useContext)(xr),t=Ut(),n=(o,r,i)=>t?.setView(a=>ae(ae(pe(q(a,te(o)),!1),"view",r),"filter",i?.filter??null));return(0,be.useMemo)(()=>e??{record:o=>{t&&(t.setView(r=>q(pe(r,!1),o)),t.setSelection([o]))},place:(o,r)=>{let i=t?.views.places().find(a=>a.as===o);i&&n(i.kind,i.as,r)},list:(o,r)=>n(o,null,r)},[e,t])}var xe=_(N(),1);var Sa=Jt(Ke(()=>(__graviewPreload(import.meta.url,["./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ODHCSYXX.js"))));function wa(e,t,n){let o,r=!1,i=()=>{let{hidden:s,removed:l}=t.current();o||r||s.length+l.length===0||(o=()=>{},Sa.load().then(c=>{r||(o=c.watchTidied(e,t,n))},String))};i();let a=t.onChange?.(i);return()=>{r=!0,a?.(),o?.()}}function va(e,t){let[n,o]=(0,xe.useState)();return(0,xe.useEffect)(()=>t?wa(e,t,r=>o([e,r])):void 0,[e,t]),n?.[0]===e?n[1]:e}var Er=_(N(),1),ba=(0,Er.createContext)(!1);var on=_(N(),1),xa=(0,on.createContext)(null),Ea=(0,on.createContext)(null);var Ar=_(N(),1),Aa=(0,Ar.createContext)(null);var Pr=_(N(),1),rn='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',an=e=>e instanceof HTMLElement&&(e.matches(rn)||e.hasAttribute("tabindex")),Le=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function Pa(e,t){let n=l=>l.replace(/["\\]/g,"\\$&"),o=t.getAttribute("data-testid"),r=t.getAttribute("data-graview-pick"),i=t.getAttribute("aria-label"),a=o?`[data-testid="${n(o)}"]`:r?`[data-graview-pick="${n(r)}"]`:i?`${t.tagName.toLowerCase()}[aria-label="${n(i)}"]`:null;if(!a)return null;let s=e.querySelector(a);return s&&an(s)&&Le(s)?s:null}var ka=e=>e.isConnected&&an(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&Le(e);function kr(e,t){let n=t?Pa(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&Le(o))return o;for(let r of e.querySelectorAll(rn))if(Le(r))return r;return an(e)&&Le(e)?e:null}function Ra(e){(0,Pr.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=y=>{let v=y.target;if(v instanceof Element){n=[];for(let S=v;S&&S!==t.parentElement;S=S.parentElement)n.push(S)}},r=!1,i=!1,a=t.ownerDocument,s=()=>!i&&a.defaultView!==null,l=(y,v)=>void setTimeout(()=>s()&&v(),y),c=y=>void requestAnimationFrame(()=>s()&&y()),u=y=>{if(r=!1,i)return;let v=a.activeElement;if(!(!(v===null||v===a.body||v===a.documentElement)||n.length===0)){if(ka(n[0])){y&&n[0]instanceof HTMLElement&&n[0].focus({preventScroll:!0});return}for(let E of n.slice(1)){if(!E.isConnected)continue;let k=kr(E,n[0]);if(k){k.focus({preventScroll:!0}),n=[];return}}}},m=(y,v=Date.now()+2500)=>{l(100,()=>{u(y);let S=a.activeElement;(S===null||S===a.body||S===a.documentElement)&&n.length>0&&Date.now()<v&&m(y,v)})},p=()=>{r||n.length===0||(r=!0,l(60,()=>c(()=>{u(!1),m(!1)})))},g=y=>{if(!(y instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(y.key))){if(!(y instanceof KeyboardEvent)){let v=y.target instanceof Element?y.target.closest(rn):null,S=a.activeElement,E=S===null||S===a.body||S===a.documentElement;if(v&&E&&t.contains(v)){n=[];for(let k=v;k&&k!==t.parentElement;k=k.parentElement)n.push(k);l(150,()=>c(()=>{u(!1),m(!1)}));return}}!(y instanceof KeyboardEvent)&&!(y.target instanceof Node&&n[0]?.contains(y.target))||l(150,()=>c(()=>{u(!0),m(!0)}))}},x=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&p()}),P=y=>{y.relatedTarget===null&&p()};return t.addEventListener("focusin",o),t.addEventListener("focusout",P),t.addEventListener("click",g),t.addEventListener("keydown",g),x.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",P),t.removeEventListener("click",g),t.removeEventListener("keydown",g),x.disconnect()}},[e])}export{fe as a,ee as b,ze as c,Ma as d,Oa as e,oo as f,no as g,ro as h,Et as i,q as j,io as k,ae as l,pe as m,$e as n,Ve as o,Ue as p,Ze as q,At as r,ye as s,Ia as t,Fr as u,te as v,ao as w,se as x,so as y,Kr as z,_a as A,lo as B,Pt as C,Br as D,qr as E,zr as F,N as G,Lt as H,fi as I,yi as J,Ro as K,Qe as L,mi as M,Ce as N,Mo as O,gi as P,Dt as Q,Nt as R,Ie as S,Ti as T,Mi as U,Oi as V,tr as W,Hi as X,Ni as Y,Vs as Z,Fi as _,ne as $,Ut as aa,ot as ba,Ki as ca,Bi as da,qi as ea,$t as fa,xr as ga,ha,zi as ia,ir as ja,ar as ka,sr as la,lr as ma,dr as na,ur as oa,cr as pa,fr as qa,$i as ra,Ui as sa,Zt as ta,Yi as ua,ut as va,Zi as wa,Xi as xa,Ji as ya,Qi as za,ea as Aa,ta as Ba,wr as Ca,na as Da,Jt as Ea,va as Fa,ba as Ga,xa as Ha,Ea as Ia,Aa as Ja,ia as Ka,aa as La,la as Ma,he as Na,Ra as Oa,da as Pa,ft as Qa,br as Ra,fa as Sa,ga as Ta};
2
- /*! Bundled license information:
3
-
4
- react/cjs/react.production.js:
5
- (**
6
- * @license React
7
- * react.production.js
8
- *
9
- * Copyright (c) Meta Platforms, Inc. and affiliates.
10
- *
11
- * This source code is licensed under the MIT license found in the
12
- * LICENSE file in the root directory of this source tree.
13
- *)
14
-
15
- react/cjs/react-jsx-runtime.production.js:
16
- (**
17
- * @license React
18
- * react-jsx-runtime.production.js
19
- *
20
- * Copyright (c) Meta Platforms, Inc. and affiliates.
21
- *
22
- * This source code is licensed under the MIT license found in the
23
- * LICENSE file in the root directory of this source tree.
24
- *)
25
- */