graview 0.1.49 → 0.1.51

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 (205) hide show
  1. package/dist/preview/{chunk.THENABJU.js → chunk.2534FLZZ.js} +1 -1
  2. package/dist/preview/chunk.25VJPUDH.js +1 -0
  3. package/dist/preview/{chunk.AGVFW6WC.js → chunk.2VJ52LGS.js} +1 -1
  4. package/dist/preview/{chunk.KDTNKKOY.js → chunk.2W2YVB6X.js} +1 -1
  5. package/dist/preview/chunk.2W45NM7Q.js +9 -0
  6. package/dist/preview/chunk.32BOL7OL.js +1 -0
  7. package/dist/preview/chunk.34HGT7HQ.js +1 -0
  8. package/dist/preview/{chunk.CXIIRL67.js → chunk.353CGK6C.js} +1 -1
  9. package/dist/preview/{chunk.NQ7SRWXA.js → chunk.3H7YIKKC.js} +1 -1
  10. package/dist/preview/{chunk.PBCT33FF.js → chunk.3MU37W5D.js} +1 -1
  11. package/dist/preview/chunk.3SBTQ66X.js +1 -0
  12. package/dist/preview/{chunk.3NEALGMI.js → chunk.3TVAE7LE.js} +1 -1
  13. package/dist/preview/{chunk.6RLFO5GA.js → chunk.4EZFOZBA.js} +1 -1
  14. package/dist/preview/chunk.4N5R4K6O.js +1 -0
  15. package/dist/preview/{chunk.NUUT37ER.js → chunk.4T67XS2D.js} +1 -1
  16. package/dist/preview/chunk.5ON3JSAK.js +1 -0
  17. package/dist/preview/{chunk.RMWLV3PR.js → chunk.5ZAK57JA.js} +2 -2
  18. package/dist/preview/chunk.6KYWJXZR.js +1 -0
  19. package/dist/preview/chunk.76QSPWSJ.js +1 -0
  20. package/dist/preview/{chunk.VSWEKNKS.js → chunk.7G4M2PX3.js} +2 -2
  21. package/dist/preview/{chunk.DFGXNFFE.js → chunk.7GAC7U34.js} +1 -1
  22. package/dist/preview/chunk.7NQROWHU.js +1 -0
  23. package/dist/preview/{chunk.7SGQ3HFG.js → chunk.7RIFDWDF.js} +1 -1
  24. package/dist/preview/chunk.ACB4TD4W.js +1 -0
  25. package/dist/preview/chunk.AJAMTRZ3.js +1 -0
  26. package/dist/preview/chunk.AL45OI4A.js +1 -0
  27. package/dist/preview/{chunk.7JLYEZW4.js → chunk.AL7LFNOS.js} +1 -1
  28. package/dist/preview/{chunk.OS75HEZP.js → chunk.ALCH5H7U.js} +1 -1
  29. package/dist/preview/chunk.APFRPN5S.js +1 -0
  30. package/dist/preview/{chunk.MUHFZXPS.js → chunk.AZOW57MT.js} +1 -1
  31. package/dist/preview/chunk.B4PUI3GO.js +1 -0
  32. package/dist/preview/chunk.B6LKLV32.js +1 -0
  33. package/dist/preview/{chunk.QWX2N2VD.js → chunk.B7LBG4UP.js} +1 -1
  34. package/dist/preview/{chunk.B2BLZDBD.js → chunk.BV6HKTHK.js} +1 -1
  35. package/dist/preview/{chunk.2QKSWK4U.js → chunk.BYY7YXBI.js} +1 -1
  36. package/dist/preview/{chunk.REANMQ6K.js → chunk.CI4DEKPX.js} +1 -1
  37. package/dist/preview/{chunk.DSNHE4MZ.js → chunk.CMEETACI.js} +1 -1
  38. package/dist/preview/{chunk.EJAVIZ7Y.js → chunk.CQPNDJAC.js} +1 -1
  39. package/dist/preview/{chunk.4SEY7VWZ.js → chunk.CTOBNZLM.js} +1 -1
  40. package/dist/preview/chunk.CUB4IAUJ.js +1 -0
  41. package/dist/preview/chunk.CUN4VN42.js +1 -0
  42. package/dist/preview/chunk.CV55N3Y6.js +1 -0
  43. package/dist/preview/{chunk.4OTESF7W.js → chunk.CXC5FOIO.js} +1 -1
  44. package/dist/preview/{chunk.BNU3KXKL.js → chunk.DEH6O3K4.js} +1 -1
  45. package/dist/preview/chunk.DQNN5FE5.js +1 -0
  46. package/dist/preview/chunk.DUY27OJV.js +1 -0
  47. package/dist/preview/chunk.E2R6VFZX.js +1 -0
  48. package/dist/preview/{chunk.GEY4MA4D.js → chunk.EA2NMVRE.js} +1 -1
  49. package/dist/preview/chunk.ESK3UZRC.js +1 -0
  50. package/dist/preview/{chunk.KJBXNMIU.js → chunk.ESSENNHM.js} +2 -2
  51. package/dist/preview/{chunk.AOEXSQDG.js → chunk.ET3XJDPX.js} +1 -1
  52. package/dist/preview/chunk.FEIJ7ETK.js +1 -0
  53. package/dist/preview/{chunk.FUMQLGNM.js → chunk.FFCUZPTC.js} +1 -1
  54. package/dist/preview/chunk.FG5ZFYYL.js +1 -0
  55. package/dist/preview/{chunk.TABIRLQS.js → chunk.FKJ3HIA5.js} +1 -1
  56. package/dist/preview/chunk.FTBH7CPZ.js +1 -0
  57. package/dist/preview/chunk.FU4YSVWX.js +1 -0
  58. package/dist/preview/{chunk.XMOIMPUC.js → chunk.FYDDFOSD.js} +1 -1
  59. package/dist/preview/{chunk.N2S3TMBC.js → chunk.GJQF7I22.js} +1 -1
  60. package/dist/preview/{chunk.NQDGUIUQ.js → chunk.GLTWLQ6L.js} +1 -1
  61. package/dist/preview/chunk.GMAXA5GV.js +1 -0
  62. package/dist/preview/{chunk.BTORFVKO.js → chunk.GRYS6VSF.js} +1 -1
  63. package/dist/preview/{chunk.423SZS7C.js → chunk.GYTVL6GR.js} +3 -3
  64. package/dist/preview/chunk.HASVT7IC.js +1 -0
  65. package/dist/preview/{chunk.IQHVVQEA.js → chunk.HFKGND5Q.js} +1 -1
  66. package/dist/preview/chunk.HVX7LFWR.js +1 -0
  67. package/dist/preview/chunk.IBJBCZKG.js +1 -0
  68. package/dist/preview/{chunk.7MJGZHTS.js → chunk.IE4ZJQV3.js} +1 -1
  69. package/dist/preview/chunk.IFL2MYTQ.js +1 -0
  70. package/dist/preview/{chunk.2N6RQ427.js → chunk.IUIDDNN3.js} +1 -1
  71. package/dist/preview/chunk.JBR66TUP.js +1 -0
  72. package/dist/preview/chunk.JG2FGZF2.js +18 -0
  73. package/dist/preview/{chunk.SIVMZNHZ.js → chunk.JI2UVZUU.js} +1 -1
  74. package/dist/preview/{chunk.D25QV6DK.js → chunk.JMDKAP23.js} +1 -1
  75. package/dist/preview/chunk.JX2C3HVD.js +1 -0
  76. package/dist/preview/{chunk.MU5WUTVF.js → chunk.K7ECYKZL.js} +1 -1
  77. package/dist/preview/{chunk.X4MTZKL3.js → chunk.K7RKWB2K.js} +1 -1
  78. package/dist/preview/chunk.KK46XLGU.js +1 -0
  79. package/dist/preview/chunk.KOBCLWPC.js +1 -0
  80. package/dist/preview/chunk.KRODTMGR.js +1 -0
  81. package/dist/preview/chunk.KYKHZZT7.js +1 -0
  82. package/dist/preview/chunk.LYIHPVDZ.js +1 -0
  83. package/dist/preview/{chunk.BVXOLZQ3.js → chunk.MG3DMURZ.js} +1 -1
  84. package/dist/preview/{chunk.ERWBI2NK.js → chunk.MMVCZOEX.js} +1 -1
  85. package/dist/preview/{chunk.FIS27KW4.js → chunk.MN6WHE4B.js} +1 -1
  86. package/dist/preview/{chunk.4D26JY5U.js → chunk.MRXQBEPQ.js} +1 -1
  87. package/dist/preview/{chunk.NB6WN4DO.js → chunk.MX3Y3LPH.js} +1 -1
  88. package/dist/preview/{chunk.AVDXG57A.js → chunk.MY5OXSS7.js} +1 -1
  89. package/dist/preview/chunk.N5XONWU2.js +1 -0
  90. package/dist/preview/chunk.NNUUD26E.js +1 -0
  91. package/dist/preview/{chunk.6EHE26ZS.js → chunk.NQ26KMSQ.js} +1 -1
  92. package/dist/preview/{chunk.LD6S2FL5.js → chunk.NVRK6A7T.js} +1 -1
  93. package/dist/preview/{chunk.MJ4XTNTL.js → chunk.NZDHXREL.js} +1 -1
  94. package/dist/preview/chunk.OHDJYGH7.js +2 -0
  95. package/dist/preview/{chunk.2OXXGN7C.js → chunk.OJ64WTLW.js} +2 -2
  96. package/dist/preview/{chunk.EM5CGFNB.js → chunk.OPCBZNKF.js} +1 -1
  97. package/dist/preview/{chunk.GRLPNTUW.js → chunk.OU5TRY4N.js} +1 -1
  98. package/dist/preview/chunk.OW72XZF4.js +1 -0
  99. package/dist/preview/chunk.P4CLT32V.js +5 -0
  100. package/dist/preview/chunk.PFXGWY3P.js +1 -0
  101. package/dist/preview/{chunk.QQE7N7LB.js → chunk.PMV6XVVZ.js} +1 -1
  102. package/dist/preview/{chunk.PCVU3LY3.js → chunk.PPZ2TOB5.js} +1 -1
  103. package/dist/preview/{chunk.QBHVBL42.js → chunk.PYRJDTVS.js} +1 -1
  104. package/dist/preview/chunk.QEQQXWYU.js +1 -0
  105. package/dist/preview/chunk.QPAJCRFB.js +1 -0
  106. package/dist/preview/chunk.R5R7CLOU.js +1 -0
  107. package/dist/preview/{chunk.TBA4GF34.js → chunk.RMMJQYJJ.js} +1 -1
  108. package/dist/preview/{chunk.2CO2EJQA.js → chunk.RNOBACJ6.js} +1 -1
  109. package/dist/preview/{chunk.ZILULTJJ.js → chunk.S32AGJ3W.js} +1 -1
  110. package/dist/preview/chunk.S4CKKT3C.js +1 -0
  111. package/dist/preview/{chunk.4Q5KWYVY.js → chunk.SJKHVIHA.js} +2 -2
  112. package/dist/preview/chunk.SJYQ72EC.js +1 -0
  113. package/dist/preview/chunk.SKG4IHT5.js +88 -0
  114. package/dist/preview/chunk.SLBWPVIY.js +1 -0
  115. package/dist/preview/{chunk.7JW5SHRR.js → chunk.SPU3BVAO.js} +1 -1
  116. package/dist/preview/chunk.SRFZKDQ6.js +1 -0
  117. package/dist/preview/{chunk.RSR2M7ZO.js → chunk.SSAY4ITS.js} +2 -2
  118. package/dist/preview/{chunk.XN7PIWVC.js → chunk.T3RTFTOZ.js} +1 -1
  119. package/dist/preview/{chunk.AP22NNIM.js → chunk.TBSPEO2L.js} +1 -1
  120. package/dist/preview/chunk.TMYGLXR6.js +25 -0
  121. package/dist/preview/{chunk.D53IGR45.js → chunk.TNL2BVCH.js} +1 -1
  122. package/dist/preview/{chunk.BJR6E2CT.js → chunk.TVWN5I4M.js} +1 -1
  123. package/dist/preview/{chunk.RI624PFK.js → chunk.U7SNDY3F.js} +1 -1
  124. package/dist/preview/chunk.UCUWEYKM.js +1 -0
  125. package/dist/preview/{chunk.ON35FJ5H.js → chunk.UIWI4GKW.js} +1 -1
  126. package/dist/preview/{chunk.N2S45SSL.js → chunk.UK5F3S2N.js} +1 -1
  127. package/dist/preview/{chunk.H42WBU5C.js → chunk.UVAWWCFW.js} +1 -1
  128. package/dist/preview/{chunk.UL43GFVC.js → chunk.UWFEXEY3.js} +1 -1
  129. package/dist/preview/chunk.V4GAOZAW.js +1 -0
  130. package/dist/preview/{chunk.A7HMVWMG.js → chunk.VICCAWAN.js} +1 -1
  131. package/dist/preview/{chunk.EYSQPXVE.js → chunk.W2DKFQ6R.js} +1 -1
  132. package/dist/preview/{chunk.TSHBXCMU.js → chunk.WESWDXRW.js} +1 -1
  133. package/dist/preview/{chunk.O3ONLQUF.js → chunk.WFHFWJ6E.js} +1 -1
  134. package/dist/preview/{chunk.YECMUK4X.js → chunk.WQLAIEWJ.js} +1 -1
  135. package/dist/preview/{chunk.G3Q5CYEM.js → chunk.XCCBUWMC.js} +1 -1
  136. package/dist/preview/{chunk.3EW6L5DY.js → chunk.XCQ7ZPR5.js} +1 -1
  137. package/dist/preview/chunk.XWXYC3BJ.js +1 -0
  138. package/dist/preview/chunk.XZVPVAIS.js +1 -0
  139. package/dist/preview/chunk.Y2ZBVWII.js +1 -0
  140. package/dist/preview/chunk.Y3LTHEN7.js +1 -0
  141. package/dist/preview/{chunk.WQN7EFW3.js → chunk.Y5AMZBHA.js} +2 -2
  142. package/dist/preview/{chunk.35FUGOSG.js → chunk.Z7N3MJ36.js} +1 -1
  143. package/dist/preview/chunk.ZJXUWOG3.js +1 -0
  144. package/dist/preview/{chunk.OFBESPHJ.js → chunk.ZZODDJYK.js} +1 -1
  145. package/dist/preview/index.html +51 -51
  146. package/dist/preview/page.js +2 -2
  147. package/package.json +6 -6
  148. package/dist/preview/chunk.2AZTW66C.js +0 -1
  149. package/dist/preview/chunk.2OLZ6BYI.js +0 -1
  150. package/dist/preview/chunk.4K7I7WYF.js +0 -1
  151. package/dist/preview/chunk.4QINLTDZ.js +0 -1
  152. package/dist/preview/chunk.4XKACWLT.js +0 -1
  153. package/dist/preview/chunk.52QB4YW2.js +0 -1
  154. package/dist/preview/chunk.54PZWX23.js +0 -1
  155. package/dist/preview/chunk.5YFO6D7J.js +0 -1
  156. package/dist/preview/chunk.6EGHJCEM.js +0 -1
  157. package/dist/preview/chunk.6WRA3Y7D.js +0 -1
  158. package/dist/preview/chunk.7C4IR4S7.js +0 -1
  159. package/dist/preview/chunk.7MWLDDFL.js +0 -1
  160. package/dist/preview/chunk.B445DZOY.js +0 -1
  161. package/dist/preview/chunk.BH365UJ5.js +0 -1
  162. package/dist/preview/chunk.BU6V76EF.js +0 -1
  163. package/dist/preview/chunk.C75I24Z5.js +0 -1
  164. package/dist/preview/chunk.D4IKO5YA.js +0 -18
  165. package/dist/preview/chunk.D4K23FUB.js +0 -1
  166. package/dist/preview/chunk.D66RI4QS.js +0 -1
  167. package/dist/preview/chunk.DTRNDSMS.js +0 -1
  168. package/dist/preview/chunk.DV4GSLGX.js +0 -9
  169. package/dist/preview/chunk.E2AJ7U5Z.js +0 -1
  170. package/dist/preview/chunk.EPTUOPPC.js +0 -1
  171. package/dist/preview/chunk.FNK2ZZ5E.js +0 -1
  172. package/dist/preview/chunk.FOYVTN5B.js +0 -1
  173. package/dist/preview/chunk.G25JEYCC.js +0 -1
  174. package/dist/preview/chunk.IVHPJUFM.js +0 -1
  175. package/dist/preview/chunk.IWEPDTVG.js +0 -1
  176. package/dist/preview/chunk.IYLOA3MV.js +0 -1
  177. package/dist/preview/chunk.JBG5UQLM.js +0 -1
  178. package/dist/preview/chunk.KLAEKRCA.js +0 -1
  179. package/dist/preview/chunk.LUL6PFIQ.js +0 -1
  180. package/dist/preview/chunk.NBJ4C33P.js +0 -1
  181. package/dist/preview/chunk.OKHEZJBX.js +0 -1
  182. package/dist/preview/chunk.OL5D7YTW.js +0 -1
  183. package/dist/preview/chunk.OTF3NNTI.js +0 -1
  184. package/dist/preview/chunk.P2AC6JRL.js +0 -88
  185. package/dist/preview/chunk.PFEKS3KO.js +0 -5
  186. package/dist/preview/chunk.PFR3FQBR.js +0 -1
  187. package/dist/preview/chunk.Q4KNNJFL.js +0 -1
  188. package/dist/preview/chunk.QPNFWP4Z.js +0 -1
  189. package/dist/preview/chunk.QQRLUBWQ.js +0 -1
  190. package/dist/preview/chunk.R5IRHCLZ.js +0 -1
  191. package/dist/preview/chunk.SGJSJGSR.js +0 -1
  192. package/dist/preview/chunk.SPZVEQC5.js +0 -1
  193. package/dist/preview/chunk.SR2345SW.js +0 -1
  194. package/dist/preview/chunk.ST4JHXPS.js +0 -1
  195. package/dist/preview/chunk.TM6JVVGW.js +0 -25
  196. package/dist/preview/chunk.UT6642FC.js +0 -1
  197. package/dist/preview/chunk.UTRIPGW6.js +0 -1
  198. package/dist/preview/chunk.VV3PNZPI.js +0 -1
  199. package/dist/preview/chunk.W6CGAPNQ.js +0 -1
  200. package/dist/preview/chunk.XJ7YGW6Y.js +0 -1
  201. package/dist/preview/chunk.XXZFWZ4C.js +0 -1
  202. package/dist/preview/chunk.YSFNPYCD.js +0 -2
  203. package/dist/preview/chunk.YXOJKGRC.js +0 -1
  204. package/dist/preview/chunk.ZBL47SFK.js +0 -1
  205. /package/dist/preview/{chunk.4HUB3N7I.js → chunk.KHRS2SKB.js} +0 -0
@@ -1 +1 @@
1
- import{a as ot}from"./chunk.NB6WN4DO.js";import"./chunk.AGVFW6WC.js";import{e as V,l as ue,m as G,q as st}from"./chunk.SIVMZNHZ.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.NQ7SRWXA.js";import{b as nt}from"./chunk.AOEXSQDG.js";import{d as tt}from"./chunk.PBCT33FF.js";import"./chunk.XOZU4OFA.js";import"./chunk.35FUGOSG.js";import"./chunk.D4K23FUB.js";import"./chunk.A7HMVWMG.js";import{d as et}from"./chunk.GRLPNTUW.js";import{c as Ze}from"./chunk.EJAVIZ7Y.js";import{I as ze,V as Je,da as Ye,gd as Ne,ha as qe,hd as Xe,ib as Ve,jb as Qe,la as Ae,ma as F}from"./chunk.PFEKS3KO.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";var At="Nothing by that name here.",$=o=>o.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[’']/g,"'").replace(/[^\p{L}\p{N}' ]+/gu," ").replace(/\s+/g," ").trim(),Nt=/^(?:(?:can you |could you |please )?(?:go|take me|bring me|head|jump|navigate|switch|get me)(?: back)? to|(?:please )?(?:open|show(?: me)?|bring up|let me see|view)) (.+)$/,St=/^(?:(?:can you |could you |please )?tell me (?:about|of)|what(?: is|'s| are) (?:in |on )?|describe|explain|who(?: is|'s)) (.+)$/,Ot=/^(?:what(?: is|'s| am i looking at| do i see)(?: (?:here|this|on (?:this|the) (?:page|screen)|in view|this place|this page))?|where am i|describe (?:this|here|this place|this page)|tell me about (?:this|here|this place|this page))$/,rt=new Set(["here","this","this place","this page","on this page","on the page","on this screen","in view"]),Ct=/^(?:date|day|when|on|at|the date|the day)$/,jt=/^(?:what(?: is|'s) (?:wrong|broken|the (?:problem|matter|trouble))|what needs (?:fixing|attention|doing)|any (?:problems|issues|trouble)|(?:show(?: me)? |go to |open )?(?:the )?(?:problems|issues|trouble|standing|what's wrong)|is (?:anything|something) (?:wrong|broken)|are there (?:any )?(?:problems|issues))(?: (?:with|about|on|in) (.+))?$/,z=o=>o.replace(/^(?:the|a|an|my|our) /,""),te=new Set(["the","a","an","my","our","all","any","of","that","which","who","are","is","be","what","whats","what's","with","me","show","list","every","there","do","i","have","we","due","for","please","were","was","by","from","in","on"]),ft=864e5,he=o=>Date.UTC(Number(o.slice(0,4)),Number(o.slice(5,7))-1,Number(o.slice(8,10))),xe=o=>new Date(o).toISOString().slice(0,10),C=(o,i)=>xe(he(o)+i*ft),xt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wt="(monday|tuesday|tues|wednesday|thursday|thurs|friday|saturday|sunday)",it="(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sept|sep|oct|nov|dec)",at="(\\d{1,2})(?:st|nd|rd|th)?",Dt=o=>xt.findIndex(i=>i.startsWith(o.slice(0,3))),dt=o=>Mt.findIndex(i=>o.startsWith(i.toLowerCase()));function Rt(o,i){return Je(o,{year:o.slice(0,4)!==i.slice(0,4)})}function Se(o,i,y){if(o<0||i<1||i>31)return;let f=Number(y.slice(0,4)),c=k=>{let j=Date.UTC(k,o,i);return new Date(j).getUTCMonth()===o?xe(j):void 0},p=c(f);if(p)return he(p)<he(y)-183*ft?c(f+1):p}function Oe(o,i,y){let f=new Date(he(i)).getUTCDay(),c=u=>{let S=(f-y+7)%7,w=C(i,-S+u*7);return{from:w,to:C(w,6)}},p=()=>{let u=`${i.slice(0,8)}01`,S=new Date(Date.UTC(Number(i.slice(0,4)),Number(i.slice(5,7)),1));return{from:u,to:C(xe(S.getTime()),-1)}},k=u=>u?{from:u,to:u,day:Rt(u,i)}:void 0,j=(u,S)=>{let w=Dt(S);return k(u==="this"||u==="next"?C(c(u==="next"?1:0).from,(w-y+7)%7):u==="last"?C(i,-((f-w+6)%7+1)):C(i,(w-f+7)%7))},J=u=>{let S=C(i,f===0?-1:6-f);return{from:C(S,u*7),to:C(S,u*7+1)}},B="\\b(?:(?:due |for |on |by )(?:the )?)?",P=[[/\b(?:overdue|past due|late)\b/,()=>({overdue:!0,to:C(i,-1)})],[/\b(?:due |for |on )?today\b/,()=>({from:i,to:i})],[/\b(?:due |for |on )?tomorrow\b/,()=>k(C(i,1))],[/\b(?:due |for |on )?yesterday\b/,()=>k(C(i,-1))],[/\b(?:due |for |on )?this week\b/,()=>c(0)],[/\b(?:due |for |on )?next week\b/,()=>c(1)],[/\b(?:due |for |on )?(?:last|previous) week\b/,()=>c(-1)],[/\b(?:due |for |on )?next weekend\b/,()=>J(1)],[/\b(?:due |for |on )?(?:this |the )?weekend\b/,()=>J(0)],[/\b(?:due |for |on )?this month\b/,()=>p()],[new RegExp(`${B}(\\d{4}) (\\d{2}) (\\d{2})\\b`),u=>k(Se(Number(u[2])-1,Number(u[3]),`${u[1]}-01-01`))],[new RegExp(`${B}${at} (?:of )?${it}\\b`),u=>k(Se(dt(u[2]),Number(u[1]),i))],[new RegExp(`${B}${it} (?:the )?${at}\\b`),u=>k(Se(dt(u[1]),Number(u[2]),i))],[new RegExp(`${B}(?:(this|next|last|coming) )?${Wt}\\b`),u=>j(u[1],u[2])]];for(let[u,S]of P){let w=o.match(u);if(!w)continue;let N=S(w);if(N)return{ask:{words:w[0],...N},rest:o.replace(w[0]," ").replace(/\s+/g," ").trim()}}}function ht(o,i,y={}){let f=y.principal??{kind:"human"},c=o.seenBy(f),p=c.schema,k=y.today??o.today?.()??ze(),j=y.weekStartsOn??1,J=o.kindsKeptFrom(f),B=o.modules.disabledKinds,P=p.kinds.filter(e=>!J.has(e)&&!B.has(e)),u=new Set(P),S=(y.places??[]).filter(e=>e.kind===null||u.has(e.kind)),w=c.graph,N=$(i).replace(/[?.!]+$/,"").trim();if(N.length===0)return{unresolved:!0};let M=e=>p.tryDefinition(e),H=e=>Ye(M(e.kind),e),I=e=>qe(p,e),se=e=>S.find(t=>t.kind===e&&t.address===Ne(p,e))?.address??Ne(p,e),ge=e=>Xe(p,e.kind,e.id),Me=e=>({to:"record",id:e.id,kind:e.kind,label:H(e),address:ge(e),said:`Went to ${H(e)}.`}),We=e=>{let t=`Went to ${e.title}.`;return e.kind===null?{to:"place",slug:e.slug,title:e.title,address:e.address,...e.slug==="overview"?{face:"scene"}:{},said:t}:e.lens||e.address.startsWith("/places/")?{to:"picture",kind:e.kind,as:e.slug,title:e.title,address:e.address,said:t}:{to:"kind",kind:e.kind,title:e.title,address:e.address,said:t}},De=()=>({unresolved:!0,say:At}),oe=e=>{let t=M(e.kind),s=et(e,t,{limit:3,excerpt:!0}).map(r=>r.alone.startsWith(r.label)?r.alone:`${r.label.toLowerCase()} ${r.alone}`).join(", "),n=c.violations().filter(r=>r.nodeIds.includes(e.id));return[`${H(e)} \u2014 ${Ae(F(t,e.kind))}${s?` (${s})`:""}.`,n.length>0?`Trouble: ${n.map(r=>r.message).join("; ")}.`:""].filter(Boolean).join(" ")},re=e=>{let t=new Set([G(e),G(z(e))]);for(let n of[" page"," view"," lens"," place"," picture"," list"])e.endsWith(n)&&(t.add(G(e.slice(0,-n.length))),t.add(G(z(e.slice(0,-n.length)))));t.delete("");let s=n=>t.has(G(n.title))||t.has(G(z($(n.title))))||t.has(G(n.slug));return S.find(n=>n.kind!==null&&n.address.startsWith("/places/")&&s(n))??S.find(s)},pe=e=>{let t=st(o,e,{principal:f,today:k,limit:6,near:!1,...y.selection?{from:y.selection}:{}}),s=t.hits.filter(r=>r.about==="node"&&u.has(r.kind)&&w.getNode(r.id)!==void 0),n=s.filter(r=>r.why.field==="label"&&r.why.strength==="exact");return n.length===1?{one:w.getNode(n[0].id),picks:s}:n.length>1?{picks:n}:s.length===1&&t.total===1?{one:w.getNode(s[0].id),picks:s}:{picks:s}},Re=e=>{let t=e.map(s=>`${s.label} (${F(M(s.kind),s.kind)})`);return`${e.length===1?"One thing matches":`${e.length} things match`}: ${t.join("; ")}.`},Ee=(e,t)=>{if(rt.has(e))return Le();let s=t?pe(z(e)||e):void 0,n=s?.one&&$(H(s.one))===$(z(e)||e)?void 0:re(e);if(n){let l=We(n);return{about:"place",say:t?`${l.said} ${me(n)}`:l.said,moves:[l],subject:n.slug}}let r=pe(z(e)||e);if(r.one){let l=Me(r.one);return{about:t?"describe":"record",say:t?`${l.said} ${oe(r.one)}`:l.said,moves:[l],subject:r.one.id}}if(r.picks.length>0)return{about:"picks",say:Re(r.picks),moves:[],picks:r.picks};let h=ae(e);if(h)return h;let d=Pe(e);if(d){if(d.rest.split(" ").every(l=>l===""||te.has(l))){let l=I(d.kind),v={to:"kind",kind:d.kind,title:l,address:se(d.kind),said:`Went to the ${l.toLowerCase()}.`};return{about:"kind",say:v.said,moves:[v]}}return{unresolved:!0}}return De()},me=e=>{if(e.kind===null){let h=P.map(l=>({kind:l,count:w.nodesOfKind(l).length})).filter(l=>l.count>0).map(l=>`${l.count} ${(l.count===1?F(M(l.kind),l.kind):I(l.kind)).toLowerCase()}`),d=c.violations().length;return[h.length>0?`It holds ${fe(h)}.`:"It holds nothing yet.",d>0?`${d===1?"One problem":`${d} problems`} to see to.`:""].filter(Boolean).join(" ")}let t=w.nodesOfKind(e.kind).length,s=I(e.kind).toLowerCase(),n=new Set(c.violations().flatMap(h=>h.nodeIds)),r=w.nodesOfKind(e.kind).filter(h=>n.has(h.id)).length;return[e.lens?`It draws the ${s} as ${Ae(e.lens)}${t>0?` \u2014 ${t} of them`:""}.`:`${t===0?"No":t} ${t===1?F(M(e.kind),e.kind):s} ${t===1?"is":"are"} here.`,r>0?`${r} ${r===1?"has":"have"} a problem.`:""].filter(Boolean).join(" ")},Le=()=>{let e=(y.selection??[]).map(s=>w.getNode(s)).find(s=>s!==void 0);if(e)return{about:"here",say:oe(e),moves:[],subject:e.id};let t=S.find(s=>s.slug===y.place)??S.find(s=>s.slug==="home");return t?{about:"here",say:`${t.title}. ${me(t)}`,moves:[],subject:t.slug}:{about:"here",say:me({slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#"}),moves:[]}},Pe=e=>{let t=P.flatMap(s=>[I(s),F(M(s),s),s].map(n=>({kind:s,name:$(n)}))).filter(s=>s.name.length>0).sort((s,n)=>n.name.length-s.name.length);for(let{kind:s,name:n}of t)if(!(` ${e} `.indexOf(` ${n} `)<0))return{kind:s,rest:` ${e} `.replace(` ${n} `," ").replace(/\s+/g," ").trim()}},ie=(e,t)=>{let s=V(p,e).filters.filter(d=>d.about==="field"&&d.type==="date");if(s.length===0)return;let n=s.find(d=>t.some(l=>$(d.key)===l||$(d.label)===l));if(n)return n;let r=M(e)?.fieldRoles??{};for(let d of["due","deadline","date","when","start","end"]){let l=r[d],v=l?s.find(x=>x.key===l):void 0;if(v)return v}return s.find(d=>["due","deadline","date","when","on","at"].includes(d.key.toLowerCase()))??(s.length===1?s[0]:void 0)},He=e=>{let t=M(e),s=V(p,e).filters;if(t?.lifecycle)return{conditions:[{key:"is",value:"current"}],holds:d=>ue(be,d,{key:"is",value:"current"})};let r=s.find(d=>d.about==="field"&&d.type==="boolean"&&ne.has($(d.key)));if(r)return{conditions:[{key:r.key,value:"false"}],holds:d=>d[r.key]!==!0};let h=s.find(d=>d.about==="field"&&d.type==="choice"&&(d.options??[]).some(l=>ne.has($(l))));if(h){let d=new Set((h.options??[]).filter(v=>ne.has($(v)))),l=(h.options??[]).filter(v=>!d.has(v));return l.length===1?{conditions:[{key:h.key,value:l[0]}],holds:v=>v[h.key]===l[0]}:"unsayable"}return{conditions:[],holds:()=>!0}},Ie=(e,t)=>{let s=e.words.startsWith("due")||$(t.key)==="due",n=Ct.test($(t.label));if(e.day)return s?`due ${e.day}`:n?`on ${e.day}`:`${t.label.toLowerCase()} on ${e.day}`;let r=e.words.replace(/^(?:due|for|on|by) (?:the )?/,"");return s?`due ${r}`:n?r:`${t.label.toLowerCase()} ${r}`},ye=new Set(c.violations().flatMap(e=>e.nodeIds)),be={schema:p,graph:c.graph,flagged:ye,today:k},ae=e=>{let t=Oe(e,k,j),s=Pe(t?.rest??e),n=s?.kind,r=(s?.rest??t?.rest??e).split(" ").filter(Boolean);if(!n&&t){let g=e.split(" "),m=P.filter(L=>ie(L,g)!==void 0),E=m.filter(L=>{let b=ie(L,g);return g.some(O=>$(b.key)===O||$(b.label)===O)}),U=m.length===1?m:E;if(U.length!==1)return;n=U[0]}if(!n)return;let h=V(p,n).filters,d=[],l=[],v=[],x=[],q=!1,de=[];for(let g=0;g<r.length;g++){let m=r[g],E=g>0&&(r[g-1]==="not"||r[g-1]==="un"),U=h.find(b=>b.about==="field"&&b.type==="choice"&&(b.options??[]).some(O=>$(O)===m));if(U&&!E){let b=(U.options??[]).find(O=>$(O)===m);d.push({key:U.key,value:b}),l.push(b);continue}let L=h.find(b=>b.about==="field"&&b.type==="boolean"&&[$(b.key),$(b.label)].some(O=>O===m||O===m.replace(/^un/,"")));if(L){let b=!E&&!(m.startsWith("un")&&!$(L.key).startsWith("un"));d.push({key:L.key,value:String(b)}),l.push(b?m:`not ${m.replace(/^un/,"")}`);continue}if(Pt.has(m)&&!E){let b=He(n);b==="unsayable"?(q=!0,x.push(O=>!ut(p,O))):(d.push(...b.conditions),x.push(b.holds)),l.push(m);continue}m==="not"||m==="un"||t&&h.some(b=>b.type==="date"&&($(b.key)===m||$(b.label)===m))||de.push(m)}if(r=de,r.some(g=>!te.has(g))||!t&&d.length===0&&x.length===0)return;let T=I(n).toLowerCase(),Q=I(n);if(t){let g=ie(n,e.split(" "));if(!g){let m={to:"kind",kind:n,title:Q,address:se(n),said:`Went to the ${T}.`};return{about:"kind",say:`${ee(Q)} carry no date, so I can't tell which are ${/^(?:due|for|on|overdue|past due|late)\b/.test(t.ask.words)?t.ask.words:`due ${t.ask.words}`}. ${m.said}`,moves:[m]}}if(t.ask.from&&d.push({key:g.key,value:`after:${C(t.ask.from,-1)}`}),t.ask.to&&d.push({key:g.key,value:`before:${C(t.ask.to,1)}`}),t.ask.overdue){let m=He(n);m==="unsayable"?(q=!0,x.push(E=>!ut(p,E))):(d.push(...m.conditions),x.push(m.holds))}t.ask.overdue?l.push("overdue"):v.push(Ie(t.ask,g))}let R=w.nodesOfKind(n).filter(g=>d.every(m=>ue(be,g,m))&&x.every(m=>m(g))),K=[...l,...v].join(" and "),Y=[...l,T,...v].join(" "),W=R.slice(0,6).map(g=>({about:"node",id:g.id,kind:n,label:H(g),why:{field:d[0]?.key??"label",reading:d[0]?.key??"Name",fragment:K,strength:"field"},current:!0,flagged:ye.has(g.id),address:ge(g)})),X=R.length===0?`No ${T} are ${K}.`:`${R.length===1?`One ${F(M(n),n)} is`:`${R.length} ${T} are`} ${K}: ${fe(R.slice(0,6).map(H))}${R.length>6?`, and ${R.length-6} more`:""}.`;if(q)return{about:"kind",say:X,moves:[],picks:W,offer:{draft:Y,label:"Show as a view"}};let Z=d.map(g=>`${g.key}:${g.value}`).join(","),we=`${se(n)}?${new URLSearchParams({filter:Z}).toString()}`,_={to:"kind",kind:n,title:ee(Y),filter:Z,address:we,said:`Went to the ${Y}.`};return{about:"kind",say:`${_.said} ${X}`,moves:[_],picks:W}},Te=e=>M(e)?.figure==="person"?!0:[e,F(M(e),e),I(e)].some(s=>$(s).split(" ").some(n=>Et.has(n))),pt=e=>{let t=[],s=n=>M(n)?.edges??{};for(let[n,r]of Object.entries(s(e)))for(let h of r.to??[])u.has(h)&&t.push({key:n,direction:"out",far:h,words:ct(`${r.description??""} ${n}`)});for(let n of P)for(let[r,h]of Object.entries(s(n)))(h.to??[]).includes(e)&&t.push({key:r,direction:"in",far:n,words:ct(`${h.inverse??""} ${r}`)});return t},mt=e=>{let t=e.match(/^(who|which|what)\b/)?.[1];if(!t)return;let s=Oe(e,k,j);if(!s||s.ask.overdue)return;let n=s.rest.split(" ").filter(Boolean),r=P.flatMap(a=>[I(a),F(M(a),a),a].map(A=>({kind:a,name:$(A)}))).filter(a=>a.name.length>0).sort((a,A)=>A.name.length-a.name.length),h=` ${n.join(" ")} `,d=[];for(let{kind:a,name:A}of r)h.includes(` ${A} `)&&(h=h.replace(` ${A} `," "),d.includes(a)||d.push(a));let l=h.match(/\b(?:is|are|was|were)\b|'s\b/)?.[0],v=h.replace(/'s\b/g," ").split(" ").filter(a=>a.length>0&&!te.has(a)&&!Ce.has(a)),x=t==="who"?d.find(Te):d[0];if(!x&&t!=="who")return;let q=d.find(a=>a!==x),de=v.flatMap(a=>[je(a),...lt.has(je(a))?[...lt]:[]]),T=P.filter(a=>q?a===q:a!==x).flatMap(a=>{let A=ie(a,e.split(" "))??V(p,a).filters.find(D=>D.about==="field"&&D.type==="date");return A?pt(a).filter(D=>(x?D.far===x:Te(D.far))&&D.far!==a).map(D=>({kind:a,field:A,relation:D,said:v.length===0||de.some(ve=>D.words.some(vt=>Lt(vt,ve)))})):[]}).filter(a=>a.said);if(T.length===0)return;let Q=T.filter(a=>n.some(A=>$(a.field.key)===A||$(a.field.label)===A)),R=T.length===1?T[0]:Q.length===1?Q[0]:void 0;if(!R)return;let{kind:K,field:Y,relation:W}=R,X=[...s.ask.from?[{key:Y.key,value:`after:${C(s.ask.from,-1)}`}]:[],...s.ask.to?[{key:Y.key,value:`before:${C(s.ask.to,1)}`}]:[]],Z=w.nodesOfKind(K).filter(a=>X.every(A=>ue(be,a,A))),we=a=>(W.direction==="out"?c.graph.out(a.id,W.key):c.graph.in(a.id,W.key)).filter(A=>A.kind===W.far&&u.has(W.far)),_=[],g=[];for(let a of Z){let A=we(a);A.length===0&&g.push(a);for(let D of A)_.some(ve=>ve.id===D.id)||_.push(D)}let m=Ie(s.ask,Y),E=s.ask.day?`On ${s.ask.day}`:ee(s.ask.words.replace(/^(?:due|for|on|by) (?:the )?/,"")),U=I(K).toLowerCase(),L=X.map(a=>`${a.key}:${a.value}`).join(","),b=`${U} ${m}`,O={to:"kind",kind:K,title:ee(b),filter:L,address:`${se(K)}?${new URLSearchParams({filter:L}).toString()}`,said:`Went to the ${b}.`};if(Z.length===0)return{about:"related",say:`No ${b}. ${O.said}`,moves:[O]};let le=v.join(" "),yt=l==="was"||l==="were",Ge=a=>yt?a===1?"was":"were":a===1?"is":"are",ce=_.map(H),bt=ce.length>8?[...ce.slice(0,8),`${ce.length-8} more`]:ce,kt=_.length===0?`${E}: nobody ${Ge(1)}${le?` ${le}`:""}.`:`${E}: ${fe(bt)}${le?` ${Ge(_.length)} ${le}`:""}.`,$t=t==="who"&&g.length>0?`${fe(g.slice(0,4).map(H))}${g.length>4?` and ${g.length-4} more`:""} ${g.length===1?"has":"have"} nobody.`:"",wt=_.slice(0,8).map(a=>({about:"node",id:a.id,kind:a.kind,label:H(a),why:{field:W.key,reading:Ze(p,W.direction==="out"?K:W.far,W.key,W.direction==="out"?"out":"in"),fragment:m,strength:"field"},current:!0,flagged:ye.has(a.id),address:ge(a)}));return{about:"related",say:[kt,$t,O.said].filter(Boolean).join(" "),moves:[O],picks:wt}},Ke=N.match(jt);if(Ke){let e=Ke[1];if(e&&!rt.has(e)&&!/^(?:it|this|that)$/.test(e)){let n=re(e),r=n?void 0:pe(z(e)||e);if(r?.one){let h=Me(r.one);return{about:"describe",say:`${h.said} ${oe(r.one)}`,moves:[h],subject:r.one.id}}if(!n)return r&&r.picks.length>0?{about:"picks",say:Re(r.picks),moves:[],picks:r.picks}:De()}if(e&&/^(?:it|this|that)$|^(?:here|this place|this page)$/.test(e)){let n=(y.selection??[]).map(r=>w.getNode(r)).find(r=>r!==void 0);if(n)return{about:"describe",say:oe(n),moves:[],subject:n.id}}let t=c.violations();if(t.length===0)return{about:"problems",say:"Nothing is wrong \u2014 every rule holds.",moves:[]};let s={to:"problems",address:"/problems",said:"Went to the problems."};return{about:"problems",say:`${s.said} ${Qe(t)}: ${t.slice(0,4).map(n=>n.message).join("; ")}${t.length>4?"\u2026":"."}`,moves:[s]}}if(Ot.test(N))return Le();let _e=mt(N);if(_e)return _e;let ke=Oe(N,k,j);if(ke&&!re(z(ke.ask.words))&&ke.rest.replace(/'s\b/g,"").split(" ").every(e=>e===""||te.has(e)||Ce.has(e))){let e=ae(N);if(e)return e}if(/^open /.test(N)){let e=ae(N);if(e)return e}let Fe=N.match(Nt)??N.match(/^(?:go|take me|head|get me)(?: back)? (home)$/);if(Fe)return Ee(Fe[1].trim(),!1);let Be=N.match(St);if(Be){let e=Ee(Be[1].trim(),!0);return"unresolved"in e&&e.unresolved&&!/^tell me|^describe/.test(N)?{unresolved:!0}:e}let $e=re(N);if($e){let e=We($e);return{about:"place",say:e.said,moves:[e],subject:$e.slug}}let Ue=ae(N);return Ue||{unresolved:!0}}var Ce=new Set(["who","whom","whose","which","what","whats","what's","who's"]),Et=new Set(["person","people","user","users","member","members","volunteer","volunteers","gardener","gardeners","player","players","staff","worker","workers","employee","employees","owner","owners","assignee","assignees","helper","helpers","student","students","teacher","teachers","customer","customers","client","clients","contact","contacts","author","authors"]),lt=new Set(["work","cover","staff","assign","do","run","schedul","roster","book","duty","serv","help"]);function je(o){let i=o.toLowerCase().replace(/'s$/,"");for(let y of["ing","ed","es","s"])if(i.length>y.length+2&&i.endsWith(y)){let f=i.slice(0,-y.length);return f.length>3&&f[f.length-1]===f[f.length-2]?f.slice(0,-1):f}return i}function ct(o){return o.toLowerCase().split(/[^a-z']+/).filter(i=>i.length>1&&!te.has(i)&&!Ce.has(i)&&!["it","they","them","their","its","this","here","to","at"].includes(i)).map(je)}var Lt=(o,i)=>o===i||o.length>=4&&i.length>=4&&(o.startsWith(i)||i.startsWith(o)),ne=new Set(["done","finished","complete","completed","closed","resolved","agreed","canceled","archived","shipped","delivered"]),Pt=new Set(["open","unfinished","outstanding","pending","remaining","undone","incomplete"]);function ut(o,i){return V(o,i.kind).filters.some(f=>f.about==="field"&&(f.type==="boolean"&&ne.has(f.key.toLowerCase())&&i[f.key]===!0||f.type==="choice"&&typeof i[f.key]=="string"&&ne.has(String(i[f.key]).toLowerCase())))}function fe(o){return o.length<=1?o[0]??"":`${o.slice(0,-1).join(", ")} and ${o[o.length-1]}`}function zt(o,i,y={}){let f=y.scene!==void 0?{...y.pages,scene:y.scene}:y.pages;return[...nt(o,i,f?{pages:f}:{})].map(({first:c,hidden:p,lens:k,...j})=>j)}function gt(o,i){return{...o.principal?{principal:o.principal}:{},...o.places?{places:o.places}:{},...o.selection?{selection:o.selection}:{},...o.place?{place:o.place}:{},...i??o.today?{today:i??o.today}:{},...o.weekStartsOn!==void 0?{weekStartsOn:o.weekStartsOn}:{}}}function Jt(o,i,y,f){let c=ht(o,i,gt(y,f));if(c.unresolved)return c.say?{reply:{say:c.say,proposals:[],grounded:!0}}:{};if(c.about==="picks")return{};let p=c.moves.length>0?{moves:c.moves}:{},k=c.subject?o.graph.getNode(c.subject):void 0;if(c.about==="problems")return{...p,problems:!0};if(k&&(c.about==="describe"||c.about==="here"))return{...p,told:k.id};let j=k?tt(o,ot(Ve(o.violations(),[k.id])).slice(0,3)):[];return{reply:{say:c.say,proposals:j,grounded:!0,...p,...c.picks&&c.picks.length>0?{picks:c.picks}:{},...c.offer?{offer:c.offer}:{}}}}function Yt(o,i,y={}){let f=gt(y),c=[];for(let p of i){let k=typeof p=="string"?p:typeof p=="object"&&p!==null&&typeof p.to=="string"?p.to:void 0;if(!k||k.trim().length===0)continue;let j=ht(o,/^(?:go|take me|open|show)\b/i.test(k.trim())?k:`go to ${k}`,f);if("moves"in j)for(let J of j.moves)c.some(B=>B.address===J.address)||c.push(J)}return c}export{At as NOTHING_BY_THAT_NAME,gt as askContextOf,Jt as goingFrom,Yt as movesFromNames,zt as placesFromViews,ht as resolveAsk};
1
+ import{a as ot}from"./chunk.MX3Y3LPH.js";import"./chunk.2VJ52LGS.js";import{e as V,l as ue,m as G,q as st}from"./chunk.JI2UVZUU.js";import{a as ee}from"./chunk.G4JJXA63.js";import"./chunk.3H7YIKKC.js";import{b as nt}from"./chunk.ET3XJDPX.js";import{d as tt}from"./chunk.3MU37W5D.js";import"./chunk.XOZU4OFA.js";import"./chunk.Z7N3MJ36.js";import"./chunk.HVX7LFWR.js";import"./chunk.VICCAWAN.js";import{d as et}from"./chunk.OU5TRY4N.js";import{c as Ze}from"./chunk.CQPNDJAC.js";import{I as ze,V as Je,da as Ye,ha as qe,la as Ae,lb as Ve,ma as F,mb as Qe,od as Ne,pd as Xe}from"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import"./chunk.AJZBJBMO.js";var At="Nothing by that name here.",$=o=>o.normalize("NFD").replace(/\p{M}+/gu,"").toLowerCase().replace(/[’']/g,"'").replace(/[^\p{L}\p{N}' ]+/gu," ").replace(/\s+/g," ").trim(),Nt=/^(?:(?:can you |could you |please )?(?:go|take me|bring me|head|jump|navigate|switch|get me)(?: back)? to|(?:please )?(?:open|show(?: me)?|bring up|let me see|view)) (.+)$/,St=/^(?:(?:can you |could you |please )?tell me (?:about|of)|what(?: is|'s| are) (?:in |on )?|describe|explain|who(?: is|'s)) (.+)$/,Ot=/^(?:what(?: is|'s| am i looking at| do i see)(?: (?:here|this|on (?:this|the) (?:page|screen)|in view|this place|this page))?|where am i|describe (?:this|here|this place|this page)|tell me about (?:this|here|this place|this page))$/,rt=new Set(["here","this","this place","this page","on this page","on the page","on this screen","in view"]),Ct=/^(?:date|day|when|on|at|the date|the day)$/,jt=/^(?:what(?: is|'s) (?:wrong|broken|the (?:problem|matter|trouble))|what needs (?:fixing|attention|doing)|any (?:problems|issues|trouble)|(?:show(?: me)? |go to |open )?(?:the )?(?:problems|issues|trouble|standing|what's wrong)|is (?:anything|something) (?:wrong|broken)|are there (?:any )?(?:problems|issues))(?: (?:with|about|on|in) (.+))?$/,z=o=>o.replace(/^(?:the|a|an|my|our) /,""),te=new Set(["the","a","an","my","our","all","any","of","that","which","who","are","is","be","what","whats","what's","with","me","show","list","every","there","do","i","have","we","due","for","please","were","was","by","from","in","on"]),ft=864e5,he=o=>Date.UTC(Number(o.slice(0,4)),Number(o.slice(5,7))-1,Number(o.slice(8,10))),xe=o=>new Date(o).toISOString().slice(0,10),C=(o,i)=>xe(he(o)+i*ft),xt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Mt=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Wt="(monday|tuesday|tues|wednesday|thursday|thurs|friday|saturday|sunday)",it="(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sept|sep|oct|nov|dec)",at="(\\d{1,2})(?:st|nd|rd|th)?",Dt=o=>xt.findIndex(i=>i.startsWith(o.slice(0,3))),dt=o=>Mt.findIndex(i=>o.startsWith(i.toLowerCase()));function Rt(o,i){return Je(o,{year:o.slice(0,4)!==i.slice(0,4)})}function Se(o,i,y){if(o<0||i<1||i>31)return;let f=Number(y.slice(0,4)),c=k=>{let j=Date.UTC(k,o,i);return new Date(j).getUTCMonth()===o?xe(j):void 0},p=c(f);if(p)return he(p)<he(y)-183*ft?c(f+1):p}function Oe(o,i,y){let f=new Date(he(i)).getUTCDay(),c=u=>{let S=(f-y+7)%7,w=C(i,-S+u*7);return{from:w,to:C(w,6)}},p=()=>{let u=`${i.slice(0,8)}01`,S=new Date(Date.UTC(Number(i.slice(0,4)),Number(i.slice(5,7)),1));return{from:u,to:C(xe(S.getTime()),-1)}},k=u=>u?{from:u,to:u,day:Rt(u,i)}:void 0,j=(u,S)=>{let w=Dt(S);return k(u==="this"||u==="next"?C(c(u==="next"?1:0).from,(w-y+7)%7):u==="last"?C(i,-((f-w+6)%7+1)):C(i,(w-f+7)%7))},J=u=>{let S=C(i,f===0?-1:6-f);return{from:C(S,u*7),to:C(S,u*7+1)}},B="\\b(?:(?:due |for |on |by )(?:the )?)?",P=[[/\b(?:overdue|past due|late)\b/,()=>({overdue:!0,to:C(i,-1)})],[/\b(?:due |for |on )?today\b/,()=>({from:i,to:i})],[/\b(?:due |for |on )?tomorrow\b/,()=>k(C(i,1))],[/\b(?:due |for |on )?yesterday\b/,()=>k(C(i,-1))],[/\b(?:due |for |on )?this week\b/,()=>c(0)],[/\b(?:due |for |on )?next week\b/,()=>c(1)],[/\b(?:due |for |on )?(?:last|previous) week\b/,()=>c(-1)],[/\b(?:due |for |on )?next weekend\b/,()=>J(1)],[/\b(?:due |for |on )?(?:this |the )?weekend\b/,()=>J(0)],[/\b(?:due |for |on )?this month\b/,()=>p()],[new RegExp(`${B}(\\d{4}) (\\d{2}) (\\d{2})\\b`),u=>k(Se(Number(u[2])-1,Number(u[3]),`${u[1]}-01-01`))],[new RegExp(`${B}${at} (?:of )?${it}\\b`),u=>k(Se(dt(u[2]),Number(u[1]),i))],[new RegExp(`${B}${it} (?:the )?${at}\\b`),u=>k(Se(dt(u[1]),Number(u[2]),i))],[new RegExp(`${B}(?:(this|next|last|coming) )?${Wt}\\b`),u=>j(u[1],u[2])]];for(let[u,S]of P){let w=o.match(u);if(!w)continue;let N=S(w);if(N)return{ask:{words:w[0],...N},rest:o.replace(w[0]," ").replace(/\s+/g," ").trim()}}}function ht(o,i,y={}){let f=y.principal??{kind:"human"},c=o.seenBy(f),p=c.schema,k=y.today??o.today?.()??ze(),j=y.weekStartsOn??1,J=o.kindsKeptFrom(f),B=o.modules.disabledKinds,P=p.kinds.filter(e=>!J.has(e)&&!B.has(e)),u=new Set(P),S=(y.places??[]).filter(e=>e.kind===null||u.has(e.kind)),w=c.graph,N=$(i).replace(/[?.!]+$/,"").trim();if(N.length===0)return{unresolved:!0};let M=e=>p.tryDefinition(e),H=e=>Ye(M(e.kind),e),I=e=>qe(p,e),se=e=>S.find(t=>t.kind===e&&t.address===Ne(p,e))?.address??Ne(p,e),ge=e=>Xe(p,e.kind,e.id),Me=e=>({to:"record",id:e.id,kind:e.kind,label:H(e),address:ge(e),said:`Went to ${H(e)}.`}),We=e=>{let t=`Went to ${e.title}.`;return e.kind===null?{to:"place",slug:e.slug,title:e.title,address:e.address,...e.slug==="overview"?{face:"scene"}:{},said:t}:e.lens||e.address.startsWith("/places/")?{to:"picture",kind:e.kind,as:e.slug,title:e.title,address:e.address,said:t}:{to:"kind",kind:e.kind,title:e.title,address:e.address,said:t}},De=()=>({unresolved:!0,say:At}),oe=e=>{let t=M(e.kind),s=et(e,t,{limit:3,excerpt:!0}).map(r=>r.alone.startsWith(r.label)?r.alone:`${r.label.toLowerCase()} ${r.alone}`).join(", "),n=c.violations().filter(r=>r.nodeIds.includes(e.id));return[`${H(e)} \u2014 ${Ae(F(t,e.kind))}${s?` (${s})`:""}.`,n.length>0?`Trouble: ${n.map(r=>r.message).join("; ")}.`:""].filter(Boolean).join(" ")},re=e=>{let t=new Set([G(e),G(z(e))]);for(let n of[" page"," view"," lens"," place"," picture"," list"])e.endsWith(n)&&(t.add(G(e.slice(0,-n.length))),t.add(G(z(e.slice(0,-n.length)))));t.delete("");let s=n=>t.has(G(n.title))||t.has(G(z($(n.title))))||t.has(G(n.slug));return S.find(n=>n.kind!==null&&n.address.startsWith("/places/")&&s(n))??S.find(s)},pe=e=>{let t=st(o,e,{principal:f,today:k,limit:6,near:!1,...y.selection?{from:y.selection}:{}}),s=t.hits.filter(r=>r.about==="node"&&u.has(r.kind)&&w.getNode(r.id)!==void 0),n=s.filter(r=>r.why.field==="label"&&r.why.strength==="exact");return n.length===1?{one:w.getNode(n[0].id),picks:s}:n.length>1?{picks:n}:s.length===1&&t.total===1?{one:w.getNode(s[0].id),picks:s}:{picks:s}},Re=e=>{let t=e.map(s=>`${s.label} (${F(M(s.kind),s.kind)})`);return`${e.length===1?"One thing matches":`${e.length} things match`}: ${t.join("; ")}.`},Ee=(e,t)=>{if(rt.has(e))return Le();let s=t?pe(z(e)||e):void 0,n=s?.one&&$(H(s.one))===$(z(e)||e)?void 0:re(e);if(n){let l=We(n);return{about:"place",say:t?`${l.said} ${me(n)}`:l.said,moves:[l],subject:n.slug}}let r=pe(z(e)||e);if(r.one){let l=Me(r.one);return{about:t?"describe":"record",say:t?`${l.said} ${oe(r.one)}`:l.said,moves:[l],subject:r.one.id}}if(r.picks.length>0)return{about:"picks",say:Re(r.picks),moves:[],picks:r.picks};let h=ae(e);if(h)return h;let d=Pe(e);if(d){if(d.rest.split(" ").every(l=>l===""||te.has(l))){let l=I(d.kind),v={to:"kind",kind:d.kind,title:l,address:se(d.kind),said:`Went to the ${l.toLowerCase()}.`};return{about:"kind",say:v.said,moves:[v]}}return{unresolved:!0}}return De()},me=e=>{if(e.kind===null){let h=P.map(l=>({kind:l,count:w.nodesOfKind(l).length})).filter(l=>l.count>0).map(l=>`${l.count} ${(l.count===1?F(M(l.kind),l.kind):I(l.kind)).toLowerCase()}`),d=c.violations().length;return[h.length>0?`It holds ${fe(h)}.`:"It holds nothing yet.",d>0?`${d===1?"One problem":`${d} problems`} to see to.`:""].filter(Boolean).join(" ")}let t=w.nodesOfKind(e.kind).length,s=I(e.kind).toLowerCase(),n=new Set(c.violations().flatMap(h=>h.nodeIds)),r=w.nodesOfKind(e.kind).filter(h=>n.has(h.id)).length;return[e.lens?`It draws the ${s} as ${Ae(e.lens)}${t>0?` \u2014 ${t} of them`:""}.`:`${t===0?"No":t} ${t===1?F(M(e.kind),e.kind):s} ${t===1?"is":"are"} here.`,r>0?`${r} ${r===1?"has":"have"} a problem.`:""].filter(Boolean).join(" ")},Le=()=>{let e=(y.selection??[]).map(s=>w.getNode(s)).find(s=>s!==void 0);if(e)return{about:"here",say:oe(e),moves:[],subject:e.id};let t=S.find(s=>s.slug===y.place)??S.find(s=>s.slug==="home");return t?{about:"here",say:`${t.title}. ${me(t)}`,moves:[],subject:t.slug}:{about:"here",say:me({slug:"home",title:"Home",kind:null,cardinality:"many",address:"/",stop:"#"}),moves:[]}},Pe=e=>{let t=P.flatMap(s=>[I(s),F(M(s),s),s].map(n=>({kind:s,name:$(n)}))).filter(s=>s.name.length>0).sort((s,n)=>n.name.length-s.name.length);for(let{kind:s,name:n}of t)if(!(` ${e} `.indexOf(` ${n} `)<0))return{kind:s,rest:` ${e} `.replace(` ${n} `," ").replace(/\s+/g," ").trim()}},ie=(e,t)=>{let s=V(p,e).filters.filter(d=>d.about==="field"&&d.type==="date");if(s.length===0)return;let n=s.find(d=>t.some(l=>$(d.key)===l||$(d.label)===l));if(n)return n;let r=M(e)?.fieldRoles??{};for(let d of["due","deadline","date","when","start","end"]){let l=r[d],v=l?s.find(x=>x.key===l):void 0;if(v)return v}return s.find(d=>["due","deadline","date","when","on","at"].includes(d.key.toLowerCase()))??(s.length===1?s[0]:void 0)},He=e=>{let t=M(e),s=V(p,e).filters;if(t?.lifecycle)return{conditions:[{key:"is",value:"current"}],holds:d=>ue(be,d,{key:"is",value:"current"})};let r=s.find(d=>d.about==="field"&&d.type==="boolean"&&ne.has($(d.key)));if(r)return{conditions:[{key:r.key,value:"false"}],holds:d=>d[r.key]!==!0};let h=s.find(d=>d.about==="field"&&d.type==="choice"&&(d.options??[]).some(l=>ne.has($(l))));if(h){let d=new Set((h.options??[]).filter(v=>ne.has($(v)))),l=(h.options??[]).filter(v=>!d.has(v));return l.length===1?{conditions:[{key:h.key,value:l[0]}],holds:v=>v[h.key]===l[0]}:"unsayable"}return{conditions:[],holds:()=>!0}},Ie=(e,t)=>{let s=e.words.startsWith("due")||$(t.key)==="due",n=Ct.test($(t.label));if(e.day)return s?`due ${e.day}`:n?`on ${e.day}`:`${t.label.toLowerCase()} on ${e.day}`;let r=e.words.replace(/^(?:due|for|on|by) (?:the )?/,"");return s?`due ${r}`:n?r:`${t.label.toLowerCase()} ${r}`},ye=new Set(c.violations().flatMap(e=>e.nodeIds)),be={schema:p,graph:c.graph,flagged:ye,today:k},ae=e=>{let t=Oe(e,k,j),s=Pe(t?.rest??e),n=s?.kind,r=(s?.rest??t?.rest??e).split(" ").filter(Boolean);if(!n&&t){let g=e.split(" "),m=P.filter(L=>ie(L,g)!==void 0),E=m.filter(L=>{let b=ie(L,g);return g.some(O=>$(b.key)===O||$(b.label)===O)}),U=m.length===1?m:E;if(U.length!==1)return;n=U[0]}if(!n)return;let h=V(p,n).filters,d=[],l=[],v=[],x=[],q=!1,de=[];for(let g=0;g<r.length;g++){let m=r[g],E=g>0&&(r[g-1]==="not"||r[g-1]==="un"),U=h.find(b=>b.about==="field"&&b.type==="choice"&&(b.options??[]).some(O=>$(O)===m));if(U&&!E){let b=(U.options??[]).find(O=>$(O)===m);d.push({key:U.key,value:b}),l.push(b);continue}let L=h.find(b=>b.about==="field"&&b.type==="boolean"&&[$(b.key),$(b.label)].some(O=>O===m||O===m.replace(/^un/,"")));if(L){let b=!E&&!(m.startsWith("un")&&!$(L.key).startsWith("un"));d.push({key:L.key,value:String(b)}),l.push(b?m:`not ${m.replace(/^un/,"")}`);continue}if(Pt.has(m)&&!E){let b=He(n);b==="unsayable"?(q=!0,x.push(O=>!ut(p,O))):(d.push(...b.conditions),x.push(b.holds)),l.push(m);continue}m==="not"||m==="un"||t&&h.some(b=>b.type==="date"&&($(b.key)===m||$(b.label)===m))||de.push(m)}if(r=de,r.some(g=>!te.has(g))||!t&&d.length===0&&x.length===0)return;let T=I(n).toLowerCase(),Q=I(n);if(t){let g=ie(n,e.split(" "));if(!g){let m={to:"kind",kind:n,title:Q,address:se(n),said:`Went to the ${T}.`};return{about:"kind",say:`${ee(Q)} carry no date, so I can't tell which are ${/^(?:due|for|on|overdue|past due|late)\b/.test(t.ask.words)?t.ask.words:`due ${t.ask.words}`}. ${m.said}`,moves:[m]}}if(t.ask.from&&d.push({key:g.key,value:`after:${C(t.ask.from,-1)}`}),t.ask.to&&d.push({key:g.key,value:`before:${C(t.ask.to,1)}`}),t.ask.overdue){let m=He(n);m==="unsayable"?(q=!0,x.push(E=>!ut(p,E))):(d.push(...m.conditions),x.push(m.holds))}t.ask.overdue?l.push("overdue"):v.push(Ie(t.ask,g))}let R=w.nodesOfKind(n).filter(g=>d.every(m=>ue(be,g,m))&&x.every(m=>m(g))),K=[...l,...v].join(" and "),Y=[...l,T,...v].join(" "),W=R.slice(0,6).map(g=>({about:"node",id:g.id,kind:n,label:H(g),why:{field:d[0]?.key??"label",reading:d[0]?.key??"Name",fragment:K,strength:"field"},current:!0,flagged:ye.has(g.id),address:ge(g)})),X=R.length===0?`No ${T} are ${K}.`:`${R.length===1?`One ${F(M(n),n)} is`:`${R.length} ${T} are`} ${K}: ${fe(R.slice(0,6).map(H))}${R.length>6?`, and ${R.length-6} more`:""}.`;if(q)return{about:"kind",say:X,moves:[],picks:W,offer:{draft:Y,label:"Show as a view"}};let Z=d.map(g=>`${g.key}:${g.value}`).join(","),we=`${se(n)}?${new URLSearchParams({filter:Z}).toString()}`,_={to:"kind",kind:n,title:ee(Y),filter:Z,address:we,said:`Went to the ${Y}.`};return{about:"kind",say:`${_.said} ${X}`,moves:[_],picks:W}},Te=e=>M(e)?.figure==="person"?!0:[e,F(M(e),e),I(e)].some(s=>$(s).split(" ").some(n=>Et.has(n))),pt=e=>{let t=[],s=n=>M(n)?.edges??{};for(let[n,r]of Object.entries(s(e)))for(let h of r.to??[])u.has(h)&&t.push({key:n,direction:"out",far:h,words:ct(`${r.description??""} ${n}`)});for(let n of P)for(let[r,h]of Object.entries(s(n)))(h.to??[]).includes(e)&&t.push({key:r,direction:"in",far:n,words:ct(`${h.inverse??""} ${r}`)});return t},mt=e=>{let t=e.match(/^(who|which|what)\b/)?.[1];if(!t)return;let s=Oe(e,k,j);if(!s||s.ask.overdue)return;let n=s.rest.split(" ").filter(Boolean),r=P.flatMap(a=>[I(a),F(M(a),a),a].map(A=>({kind:a,name:$(A)}))).filter(a=>a.name.length>0).sort((a,A)=>A.name.length-a.name.length),h=` ${n.join(" ")} `,d=[];for(let{kind:a,name:A}of r)h.includes(` ${A} `)&&(h=h.replace(` ${A} `," "),d.includes(a)||d.push(a));let l=h.match(/\b(?:is|are|was|were)\b|'s\b/)?.[0],v=h.replace(/'s\b/g," ").split(" ").filter(a=>a.length>0&&!te.has(a)&&!Ce.has(a)),x=t==="who"?d.find(Te):d[0];if(!x&&t!=="who")return;let q=d.find(a=>a!==x),de=v.flatMap(a=>[je(a),...lt.has(je(a))?[...lt]:[]]),T=P.filter(a=>q?a===q:a!==x).flatMap(a=>{let A=ie(a,e.split(" "))??V(p,a).filters.find(D=>D.about==="field"&&D.type==="date");return A?pt(a).filter(D=>(x?D.far===x:Te(D.far))&&D.far!==a).map(D=>({kind:a,field:A,relation:D,said:v.length===0||de.some(ve=>D.words.some(vt=>Lt(vt,ve)))})):[]}).filter(a=>a.said);if(T.length===0)return;let Q=T.filter(a=>n.some(A=>$(a.field.key)===A||$(a.field.label)===A)),R=T.length===1?T[0]:Q.length===1?Q[0]:void 0;if(!R)return;let{kind:K,field:Y,relation:W}=R,X=[...s.ask.from?[{key:Y.key,value:`after:${C(s.ask.from,-1)}`}]:[],...s.ask.to?[{key:Y.key,value:`before:${C(s.ask.to,1)}`}]:[]],Z=w.nodesOfKind(K).filter(a=>X.every(A=>ue(be,a,A))),we=a=>(W.direction==="out"?c.graph.out(a.id,W.key):c.graph.in(a.id,W.key)).filter(A=>A.kind===W.far&&u.has(W.far)),_=[],g=[];for(let a of Z){let A=we(a);A.length===0&&g.push(a);for(let D of A)_.some(ve=>ve.id===D.id)||_.push(D)}let m=Ie(s.ask,Y),E=s.ask.day?`On ${s.ask.day}`:ee(s.ask.words.replace(/^(?:due|for|on|by) (?:the )?/,"")),U=I(K).toLowerCase(),L=X.map(a=>`${a.key}:${a.value}`).join(","),b=`${U} ${m}`,O={to:"kind",kind:K,title:ee(b),filter:L,address:`${se(K)}?${new URLSearchParams({filter:L}).toString()}`,said:`Went to the ${b}.`};if(Z.length===0)return{about:"related",say:`No ${b}. ${O.said}`,moves:[O]};let le=v.join(" "),yt=l==="was"||l==="were",Ge=a=>yt?a===1?"was":"were":a===1?"is":"are",ce=_.map(H),bt=ce.length>8?[...ce.slice(0,8),`${ce.length-8} more`]:ce,kt=_.length===0?`${E}: nobody ${Ge(1)}${le?` ${le}`:""}.`:`${E}: ${fe(bt)}${le?` ${Ge(_.length)} ${le}`:""}.`,$t=t==="who"&&g.length>0?`${fe(g.slice(0,4).map(H))}${g.length>4?` and ${g.length-4} more`:""} ${g.length===1?"has":"have"} nobody.`:"",wt=_.slice(0,8).map(a=>({about:"node",id:a.id,kind:a.kind,label:H(a),why:{field:W.key,reading:Ze(p,W.direction==="out"?K:W.far,W.key,W.direction==="out"?"out":"in"),fragment:m,strength:"field"},current:!0,flagged:ye.has(a.id),address:ge(a)}));return{about:"related",say:[kt,$t,O.said].filter(Boolean).join(" "),moves:[O],picks:wt}},Ke=N.match(jt);if(Ke){let e=Ke[1];if(e&&!rt.has(e)&&!/^(?:it|this|that)$/.test(e)){let n=re(e),r=n?void 0:pe(z(e)||e);if(r?.one){let h=Me(r.one);return{about:"describe",say:`${h.said} ${oe(r.one)}`,moves:[h],subject:r.one.id}}if(!n)return r&&r.picks.length>0?{about:"picks",say:Re(r.picks),moves:[],picks:r.picks}:De()}if(e&&/^(?:it|this|that)$|^(?:here|this place|this page)$/.test(e)){let n=(y.selection??[]).map(r=>w.getNode(r)).find(r=>r!==void 0);if(n)return{about:"describe",say:oe(n),moves:[],subject:n.id}}let t=c.violations();if(t.length===0)return{about:"problems",say:"Nothing is wrong \u2014 every rule holds.",moves:[]};let s={to:"problems",address:"/problems",said:"Went to the problems."};return{about:"problems",say:`${s.said} ${Qe(t)}: ${t.slice(0,4).map(n=>n.message).join("; ")}${t.length>4?"\u2026":"."}`,moves:[s]}}if(Ot.test(N))return Le();let _e=mt(N);if(_e)return _e;let ke=Oe(N,k,j);if(ke&&!re(z(ke.ask.words))&&ke.rest.replace(/'s\b/g,"").split(" ").every(e=>e===""||te.has(e)||Ce.has(e))){let e=ae(N);if(e)return e}if(/^open /.test(N)){let e=ae(N);if(e)return e}let Fe=N.match(Nt)??N.match(/^(?:go|take me|head|get me)(?: back)? (home)$/);if(Fe)return Ee(Fe[1].trim(),!1);let Be=N.match(St);if(Be){let e=Ee(Be[1].trim(),!0);return"unresolved"in e&&e.unresolved&&!/^tell me|^describe/.test(N)?{unresolved:!0}:e}let $e=re(N);if($e){let e=We($e);return{about:"place",say:e.said,moves:[e],subject:$e.slug}}let Ue=ae(N);return Ue||{unresolved:!0}}var Ce=new Set(["who","whom","whose","which","what","whats","what's","who's"]),Et=new Set(["person","people","user","users","member","members","volunteer","volunteers","gardener","gardeners","player","players","staff","worker","workers","employee","employees","owner","owners","assignee","assignees","helper","helpers","student","students","teacher","teachers","customer","customers","client","clients","contact","contacts","author","authors"]),lt=new Set(["work","cover","staff","assign","do","run","schedul","roster","book","duty","serv","help"]);function je(o){let i=o.toLowerCase().replace(/'s$/,"");for(let y of["ing","ed","es","s"])if(i.length>y.length+2&&i.endsWith(y)){let f=i.slice(0,-y.length);return f.length>3&&f[f.length-1]===f[f.length-2]?f.slice(0,-1):f}return i}function ct(o){return o.toLowerCase().split(/[^a-z']+/).filter(i=>i.length>1&&!te.has(i)&&!Ce.has(i)&&!["it","they","them","their","its","this","here","to","at"].includes(i)).map(je)}var Lt=(o,i)=>o===i||o.length>=4&&i.length>=4&&(o.startsWith(i)||i.startsWith(o)),ne=new Set(["done","finished","complete","completed","closed","resolved","agreed","canceled","archived","shipped","delivered"]),Pt=new Set(["open","unfinished","outstanding","pending","remaining","undone","incomplete"]);function ut(o,i){return V(o,i.kind).filters.some(f=>f.about==="field"&&(f.type==="boolean"&&ne.has(f.key.toLowerCase())&&i[f.key]===!0||f.type==="choice"&&typeof i[f.key]=="string"&&ne.has(String(i[f.key]).toLowerCase())))}function fe(o){return o.length<=1?o[0]??"":`${o.slice(0,-1).join(", ")} and ${o[o.length-1]}`}function zt(o,i,y={}){let f=y.scene!==void 0?{...y.pages,scene:y.scene}:y.pages;return[...nt(o,i,f?{pages:f}:{})].map(({first:c,hidden:p,lens:k,...j})=>j)}function gt(o,i){return{...o.principal?{principal:o.principal}:{},...o.places?{places:o.places}:{},...o.selection?{selection:o.selection}:{},...o.place?{place:o.place}:{},...i??o.today?{today:i??o.today}:{},...o.weekStartsOn!==void 0?{weekStartsOn:o.weekStartsOn}:{}}}function Jt(o,i,y,f){let c=ht(o,i,gt(y,f));if(c.unresolved)return c.say?{reply:{say:c.say,proposals:[],grounded:!0}}:{};if(c.about==="picks")return{};let p=c.moves.length>0?{moves:c.moves}:{},k=c.subject?o.graph.getNode(c.subject):void 0;if(c.about==="problems")return{...p,problems:!0};if(k&&(c.about==="describe"||c.about==="here"))return{...p,told:k.id};let j=k?tt(o,ot(Ve(o.violations(),[k.id])).slice(0,3)):[];return{reply:{say:c.say,proposals:j,grounded:!0,...p,...c.picks&&c.picks.length>0?{picks:c.picks}:{},...c.offer?{offer:c.offer}:{}}}}function Yt(o,i,y={}){let f=gt(y),c=[];for(let p of i){let k=typeof p=="string"?p:typeof p=="object"&&p!==null&&typeof p.to=="string"?p.to:void 0;if(!k||k.trim().length===0)continue;let j=ht(o,/^(?:go|take me|open|show)\b/i.test(k.trim())?k:`go to ${k}`,f);if("moves"in j)for(let J of j.moves)c.some(B=>B.address===J.address)||c.push(J)}return c}export{At as NOTHING_BY_THAT_NAME,gt as askContextOf,Jt as goingFrom,Yt as movesFromNames,zt as placesFromViews,ht as resolveAsk};
@@ -5,67 +5,67 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <title>Graview preview</title>
7
7
  <link rel="preload" href="/graview/document" as="fetch" crossorigin="anonymous">
8
- <link rel="modulepreload" href="/chunk.CXIIRL67.js">
9
- <link rel="modulepreload" href="/chunk.YECMUK4X.js">
10
- <link rel="modulepreload" href="/chunk.IWEPDTVG.js">
11
- <link rel="modulepreload" href="/chunk.2OLZ6BYI.js">
8
+ <link rel="modulepreload" href="/chunk.353CGK6C.js">
9
+ <link rel="modulepreload" href="/chunk.WQLAIEWJ.js">
10
+ <link rel="modulepreload" href="/chunk.4N5R4K6O.js">
11
+ <link rel="modulepreload" href="/chunk.KK46XLGU.js">
12
12
  <link rel="modulepreload" href="/chunk.Q5WEOX3Q.js">
13
- <link rel="modulepreload" href="/chunk.54PZWX23.js">
14
- <link rel="modulepreload" href="/chunk.TABIRLQS.js">
15
- <link rel="modulepreload" href="/chunk.423SZS7C.js">
16
- <link rel="modulepreload" href="/chunk.TM6JVVGW.js">
13
+ <link rel="modulepreload" href="/chunk.76QSPWSJ.js">
14
+ <link rel="modulepreload" href="/chunk.FKJ3HIA5.js">
15
+ <link rel="modulepreload" href="/chunk.GYTVL6GR.js">
16
+ <link rel="modulepreload" href="/chunk.TMYGLXR6.js">
17
17
  <link rel="modulepreload" href="/chunk.SDO3U72B.js">
18
- <link rel="modulepreload" href="/chunk.PFEKS3KO.js">
19
- <link rel="modulepreload" href="/chunk.2AZTW66C.js">
18
+ <link rel="modulepreload" href="/chunk.P4CLT32V.js">
19
+ <link rel="modulepreload" href="/chunk.SLBWPVIY.js">
20
20
  <link rel="modulepreload" href="/chunk.AJZBJBMO.js">
21
- <link rel="modulepreload" href="/chunk.6WRA3Y7D.js">
22
- <link rel="modulepreload" href="/chunk.D4IKO5YA.js">
23
- <link rel="modulepreload" href="/chunk.7MJGZHTS.js">
24
- <link rel="modulepreload" href="/chunk.QWX2N2VD.js">
25
- <link rel="modulepreload" href="/chunk.BJR6E2CT.js">
26
- <link rel="modulepreload" href="/chunk.VSWEKNKS.js">
21
+ <link rel="modulepreload" href="/chunk.Y2ZBVWII.js">
22
+ <link rel="modulepreload" href="/chunk.JG2FGZF2.js">
23
+ <link rel="modulepreload" href="/chunk.IE4ZJQV3.js">
24
+ <link rel="modulepreload" href="/chunk.TVWN5I4M.js">
25
+ <link rel="modulepreload" href="/chunk.B7LBG4UP.js">
26
+ <link rel="modulepreload" href="/chunk.7G4M2PX3.js">
27
27
  <link rel="modulepreload" href="/chunk.UGFDSE37.js">
28
- <link rel="modulepreload" href="/chunk.SGJSJGSR.js">
29
- <link rel="modulepreload" href="/chunk.2OXXGN7C.js">
30
- <link rel="modulepreload" href="/chunk.Q4KNNJFL.js">
31
- <link rel="modulepreload" href="/chunk.BH365UJ5.js">
32
- <link rel="modulepreload" href="/chunk.6EHE26ZS.js">
33
- <link rel="modulepreload" href="/chunk.N2S3TMBC.js">
34
- <link rel="modulepreload" href="/chunk.7JW5SHRR.js">
28
+ <link rel="modulepreload" href="/chunk.NNUUD26E.js">
35
29
  <link rel="modulepreload" href="/chunk.PXQVXBNG.js">
36
- <link rel="modulepreload" href="/chunk.4SEY7VWZ.js">
37
- <link rel="modulepreload" href="/chunk.IVHPJUFM.js">
38
- <link rel="modulepreload" href="/chunk.D53IGR45.js">
39
- <link rel="modulepreload" href="/chunk.MJ4XTNTL.js">
40
- <link rel="modulepreload" href="/chunk.AP22NNIM.js">
41
- <link rel="modulepreload" href="/chunk.SPZVEQC5.js">
42
- <link rel="modulepreload" href="/chunk.FNK2ZZ5E.js">
43
- <link rel="modulepreload" href="/chunk.RSR2M7ZO.js">
44
- <link rel="modulepreload" href="/chunk.EM5CGFNB.js">
45
- <link rel="modulepreload" href="/chunk.N2S45SSL.js">
46
- <link rel="modulepreload" href="/chunk.AGVFW6WC.js">
47
- <link rel="modulepreload" href="/chunk.SIVMZNHZ.js">
48
- <link rel="modulepreload" href="/chunk.3NEALGMI.js">
49
- <link rel="modulepreload" href="/chunk.UT6642FC.js">
30
+ <link rel="modulepreload" href="/chunk.OJ64WTLW.js">
31
+ <link rel="modulepreload" href="/chunk.GMAXA5GV.js">
32
+ <link rel="modulepreload" href="/chunk.IBJBCZKG.js">
33
+ <link rel="modulepreload" href="/chunk.NQ26KMSQ.js">
34
+ <link rel="modulepreload" href="/chunk.GJQF7I22.js">
35
+ <link rel="modulepreload" href="/chunk.SPU3BVAO.js">
36
+ <link rel="modulepreload" href="/chunk.OPCBZNKF.js">
37
+ <link rel="modulepreload" href="/chunk.UK5F3S2N.js">
38
+ <link rel="modulepreload" href="/chunk.2VJ52LGS.js">
39
+ <link rel="modulepreload" href="/chunk.JI2UVZUU.js">
40
+ <link rel="modulepreload" href="/chunk.CTOBNZLM.js">
41
+ <link rel="modulepreload" href="/chunk.34HGT7HQ.js">
42
+ <link rel="modulepreload" href="/chunk.TNL2BVCH.js">
43
+ <link rel="modulepreload" href="/chunk.NZDHXREL.js">
44
+ <link rel="modulepreload" href="/chunk.TBSPEO2L.js">
45
+ <link rel="modulepreload" href="/chunk.5ON3JSAK.js">
46
+ <link rel="modulepreload" href="/chunk.3SBTQ66X.js">
47
+ <link rel="modulepreload" href="/chunk.SSAY4ITS.js">
48
+ <link rel="modulepreload" href="/chunk.3TVAE7LE.js">
49
+ <link rel="modulepreload" href="/chunk.JX2C3HVD.js">
50
50
  <link rel="modulepreload" href="/chunk.XOZU4OFA.js">
51
- <link rel="modulepreload" href="/chunk.35FUGOSG.js">
51
+ <link rel="modulepreload" href="/chunk.Z7N3MJ36.js">
52
52
  <link rel="modulepreload" href="/chunk.MB7LKKUD.js">
53
53
  <link rel="modulepreload" href="/chunk.WVUJXDXZ.js">
54
- <link rel="modulepreload" href="/chunk.NQDGUIUQ.js">
55
- <link rel="modulepreload" href="/chunk.DTRNDSMS.js">
56
- <link rel="modulepreload" href="/chunk.3EW6L5DY.js">
57
- <link rel="modulepreload" href="/chunk.AVDXG57A.js">
58
- <link rel="modulepreload" href="/chunk.LD6S2FL5.js">
54
+ <link rel="modulepreload" href="/chunk.GLTWLQ6L.js">
55
+ <link rel="modulepreload" href="/chunk.ACB4TD4W.js">
56
+ <link rel="modulepreload" href="/chunk.XCQ7ZPR5.js">
57
+ <link rel="modulepreload" href="/chunk.MY5OXSS7.js">
58
+ <link rel="modulepreload" href="/chunk.NVRK6A7T.js">
59
59
  <link rel="modulepreload" href="/chunk.GZHZLJBF.js">
60
- <link rel="modulepreload" href="/chunk.FOYVTN5B.js">
60
+ <link rel="modulepreload" href="/chunk.OW72XZF4.js">
61
61
  <link rel="modulepreload" href="/chunk.OJGHDWI6.js">
62
- <link rel="modulepreload" href="/chunk.OTF3NNTI.js">
63
- <link rel="modulepreload" href="/chunk.A7HMVWMG.js">
64
- <link rel="modulepreload" href="/chunk.GRLPNTUW.js">
65
- <link rel="modulepreload" href="/chunk.EJAVIZ7Y.js">
66
- <link rel="modulepreload" href="/chunk.OKHEZJBX.js">
67
- <link rel="modulepreload" href="/chunk.B2BLZDBD.js">
68
- <script>(()=>{const later=["/chunk.PFR3FQBR.js","/chunk.ERWBI2NK.js","/chunk.WQN7EFW3.js","/chunk.HJCQ6I3S.js","/chunk.DFGXNFFE.js","/chunk.XN7PIWVC.js","/chunk.EYSQPXVE.js","/chunk.NQ7SRWXA.js","/chunk.AOEXSQDG.js","/chunk.D4K23FUB.js","/chunk.B445DZOY.js","/chunk.XMOIMPUC.js","/chunk.DV4GSLGX.js","/chunk.C75I24Z5.js","/chunk.W6CGAPNQ.js","/chunk.7C4IR4S7.js","/chunk.TI4OSTQV.js","/chunk.PCVU3LY3.js"],first=[...document.querySelectorAll('link[rel="modulepreload"]')];let left=first.length;const go=()=>{for(const href of later){const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};if(left===0)return go();const one=()=>{if(--left===0)go()};for(const link of first){link.addEventListener("load",one,{once:true});link.addEventListener("error",one,{once:true})}})()</script>
62
+ <link rel="modulepreload" href="/chunk.KRODTMGR.js">
63
+ <link rel="modulepreload" href="/chunk.VICCAWAN.js">
64
+ <link rel="modulepreload" href="/chunk.OU5TRY4N.js">
65
+ <link rel="modulepreload" href="/chunk.CQPNDJAC.js">
66
+ <link rel="modulepreload" href="/chunk.CUB4IAUJ.js">
67
+ <link rel="modulepreload" href="/chunk.BV6HKTHK.js">
68
+ <script>(()=>{const later=["/chunk.AL45OI4A.js","/chunk.MMVCZOEX.js","/chunk.Y5AMZBHA.js","/chunk.HJCQ6I3S.js","/chunk.7GAC7U34.js","/chunk.T3RTFTOZ.js","/chunk.W2DKFQ6R.js","/chunk.3H7YIKKC.js","/chunk.ET3XJDPX.js","/chunk.HVX7LFWR.js","/chunk.Y3LTHEN7.js","/chunk.FYDDFOSD.js","/chunk.2W45NM7Q.js","/chunk.FEIJ7ETK.js","/chunk.LYIHPVDZ.js","/chunk.FU4YSVWX.js","/chunk.TI4OSTQV.js","/chunk.PPZ2TOB5.js"],first=[...document.querySelectorAll('link[rel="modulepreload"]')];let left=first.length;const go=()=>{for(const href of later){const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};if(left===0)return go();const one=()=>{if(--left===0)go()};for(const link of first){link.addEventListener("load",one,{once:true});link.addEventListener("error",one,{once:true})}})()</script>
69
69
  <style>html,body{margin:0;height:100%}#graview-app{min-height:100dvh}</style>
70
70
  </head>
71
71
  <body>
@@ -1,2 +1,2 @@
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 Mt,b as Gn,c as Un,d as Kn,e as Jn,f as Vt,g as Yn,h as Dt}from"./chunk.CXIIRL67.js";import{a as zr}from"./chunk.YECMUK4X.js";import{a as Ht,b as Zn,c as Xn,d as er,e as Bt,f as tr,g as nr,h as rr,i as or,j as ar,k as ir,l as sr,m as dr,n as _e}from"./chunk.IWEPDTVG.js";import{b as Qn}from"./chunk.2OLZ6BYI.js";import{a as kt}from"./chunk.Q5WEOX3Q.js";import{a as Et,g as bn}from"./chunk.54PZWX23.js";import{k as tt}from"./chunk.TABIRLQS.js";import{C as _n,H as jn,L as qn,M as zn,j as qr,k as Wn,n as ot,o as Nn,q as $n,u as In,z as at}from"./chunk.423SZS7C.js";import{Aa as Vn,Ca as Dn,Da as Lt,G as Ct,Ha as Hn,Ia as Bn,La as rt,R as kn,W as En,a as Sn,b as Ft,c as nt,da as An,ea as Rn,j as Pn,m as Ot,sa as Tn,ta as xn,ua as Fn,va as On,wa as Cn,xa as Ln,za as Mn}from"./chunk.TM6JVVGW.js";import{a as be}from"./chunk.SDO3U72B.js";import{$b as At,Dd as Rt,Ed as Tt,Hd as vn,Id as xt,Jc as pn,Xc as mn,Zc as hn,_c as yn,ac as fn,ad as et,kb as Ie,lb as Xe,wd as ve,xb as un,xd as gn,yd as wn}from"./chunk.PFEKS3KO.js";import"./chunk.2AZTW66C.js";import{b as Fe}from"./chunk.AJZBJBMO.js";async function it(e,n={}){let o=e.compiled===void 0||!Ur(e.compiled,e.document)?void 0:bn(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:a}=await Gr();return a(e.document,n)}var cr,Gr=()=>cr??=(__graviewPreload(import.meta.url,["./chunk.JBG5UQLM.js","./chunk.54PZWX23.js","./chunk.3EW6L5DY.js","./chunk.LD6S2FL5.js","./chunk.TABIRLQS.js","./chunk.PFEKS3KO.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.VV3PNZPI.js")).catch(e=>{throw cr=void 0,e});function Ur(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,a=n;if(typeof a=="string")try{a=JSON.parse(a)}catch{return!1}return o!==void 0&&kt(Et(o).document)===kt(Et(a).document)}var c=Fe(Ct(),1);var dt=Fe(Ct(),1),Wt="data-graview-drawn",Kr=200,lr=50,Jr=1e4,st=()=>typeof performance<"u"?performance.now():Date.now();function Yr(e){let n=[...e.querySelectorAll("img")];for(let o of e.querySelectorAll("[data-worker-view]"))o.shadowRoot&&n.push(...o.shadowRoot.querySelectorAll("img"));return n}function Qr(e,n){if(e.ownerDocument.fonts?.status==="loading"||xn()>0||Ln(n)>0||e.querySelector('[aria-busy="true"]')||Yr(e).some(a=>!a.complete&&a.loading!=="lazy"))return!1;for(let a of e.querySelectorAll("[data-worker-view-place]"))if(!a.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function ur(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(a=>`${a.offsetWidth}x${a.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function Zr(e,n,o,a){e.removeAttribute(Wt);let d=e.ownerDocument.defaultView;if(!d)return()=>{};let l=st(),b=l,p=ur(e),g=!1,A,T=typeof MutationObserver>"u"?void 0:new MutationObserver(S=>{S.some(N=>!(N.target===e&&N.attributeName===Wt))&&(b=st())});T?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let v=()=>{g=!0,T?.disconnect(),A!==void 0&&clearTimeout(A)},P=S=>{let N=!1,ne=()=>{N||(N=!0,S())};typeof d.requestAnimationFrame=="function"&&d.requestAnimationFrame(()=>setTimeout(ne,0)),setTimeout(ne,100)},C=()=>{if(g)return;let S=ur(e);S!==p&&(p=S,b=st());let N=st();if(Qr(e,a)&&N-b>=Kr||N-l>=Jr){P(()=>{g||(v(),e.setAttribute(Wt,n),Vn(),o())});return}A=setTimeout(C,lr)};return A=setTimeout(C,lr),v}function fr(e,n,o,a,d){Mn();let l=(0,dt.useRef)({place:o,onDrawn:a});l.current={place:o,onDrawn:a},(0,dt.useLayoutEffect)(()=>{d&&Cn(d);let b=A=>Zr(A,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),d);if(e.current)return b(e.current);let p,g=!1;return queueMicrotask(()=>{!g&&e.current&&(p=b(e.current))}),()=>{g=!0,p?.()}},[n,e,d])}var ye=Fe(Ct(),1),je,Xr=be(()=>(__graviewPreload(import.meta.url,["./chunk.G3Q5CYEM.js","./chunk.KVEDMKUN.js","./chunk.FUMQLGNM.js","./chunk.BVXOLZQ3.js","./chunk.KDTNKKOY.js","./chunk.TM6JVVGW.js","./chunk.SDO3U72B.js","./chunk.PFEKS3KO.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.NBJ4C33P.js"))),pr=()=>Xr().then(e=>void(je=e),()=>new Promise(e=>setTimeout(e,2e3)).then(pr)),Nt=Tn(pr),mr=e=>!!e&&je===void 0;function $t({onReady:e,fetch:n}){return(0,ye.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var eo=0;function hr(e){let[n,o]=(0,ye.useState)(()=>je);(0,ye.useEffect)(()=>{if(!e||n)return;let l=!1;return Nt().then(()=>{l||o(je)}),()=>{l=!0}},[e,n]);let a=(0,ye.useMemo)(()=>eo+=1,[e]);return{over:(0,ye.useMemo)(()=>{let l=n??je;if(!e||!l)return;let{source:b,worker:p,...g}=e,A={...g,worker:p??{source:b},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:T=>l.registerWorkerView(T,A)}},[e,n]),n:a}}var wr=Fe(zr(),1),j=Fe(qr(),1);var h=Fe(kn(),1);function ct(e,n={}){let o=Lt(e);return{Face:o.part((d,l)=>(0,c.createElement)(d,l),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var jt=e=>Promise.all([e,qn()]).then(([n])=>n),vr=be(()=>(__graviewPreload(import.meta.url,["./chunk.SGJSJGSR.js","./chunk.Q4KNNJFL.js","./chunk.WQN7EFW3.js","./chunk.N2S3TMBC.js","./chunk.7JW5SHRR.js","./chunk.HJCQ6I3S.js","./chunk.DFGXNFFE.js","./chunk.XN7PIWVC.js","./chunk.C75I24Z5.js","./chunk.IVHPJUFM.js","./chunk.W6CGAPNQ.js","./chunk.7C4IR4S7.js","./chunk.D53IGR45.js","./chunk.AP22NNIM.js","./chunk.FNK2ZZ5E.js","./chunk.AGVFW6WC.js","./chunk.SIVMZNHZ.js","./chunk.NQ7SRWXA.js","./chunk.AOEXSQDG.js","./chunk.3NEALGMI.js","./chunk.UT6642FC.js","./chunk.IWEPDTVG.js","./chunk.2OLZ6BYI.js","./chunk.TI4OSTQV.js","./chunk.D4K23FUB.js","./chunk.GZHZLJBF.js","./chunk.FOYVTN5B.js","./chunk.OJGHDWI6.js","./chunk.OTF3NNTI.js","./chunk.A7HMVWMG.js","./chunk.GRLPNTUW.js","./chunk.EJAVIZ7Y.js","./chunk.423SZS7C.js","./chunk.TM6JVVGW.js","./chunk.SDO3U72B.js","./chunk.PFEKS3KO.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.4Q5KWYVY.js"))),to=be(()=>(__graviewPreload(import.meta.url,["./chunk.D4IKO5YA.js","./chunk.7MJGZHTS.js","./chunk.QWX2N2VD.js","./chunk.BJR6E2CT.js","./chunk.VSWEKNKS.js","./chunk.UGFDSE37.js","./chunk.SGJSJGSR.js","./chunk.2OXXGN7C.js","./chunk.Q4KNNJFL.js","./chunk.BH365UJ5.js","./chunk.6EHE26ZS.js","./chunk.N2S3TMBC.js","./chunk.7JW5SHRR.js","./chunk.PXQVXBNG.js","./chunk.4SEY7VWZ.js","./chunk.IVHPJUFM.js","./chunk.D53IGR45.js","./chunk.MJ4XTNTL.js","./chunk.AP22NNIM.js","./chunk.SPZVEQC5.js","./chunk.FNK2ZZ5E.js","./chunk.RSR2M7ZO.js","./chunk.EM5CGFNB.js","./chunk.N2S45SSL.js","./chunk.AGVFW6WC.js","./chunk.SIVMZNHZ.js","./chunk.3NEALGMI.js","./chunk.UT6642FC.js","./chunk.XOZU4OFA.js","./chunk.35FUGOSG.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.NQDGUIUQ.js","./chunk.DTRNDSMS.js","./chunk.3EW6L5DY.js","./chunk.AVDXG57A.js","./chunk.LD6S2FL5.js","./chunk.TABIRLQS.js","./chunk.GZHZLJBF.js","./chunk.FOYVTN5B.js","./chunk.OJGHDWI6.js","./chunk.OTF3NNTI.js","./chunk.A7HMVWMG.js","./chunk.GRLPNTUW.js","./chunk.EJAVIZ7Y.js","./chunk.423SZS7C.js","./chunk.TM6JVVGW.js","./chunk.SDO3U72B.js","./chunk.PFEKS3KO.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.6WRA3Y7D.js"))),no=be(()=>(__graviewPreload(import.meta.url,["./chunk.D4IKO5YA.js","./chunk.7MJGZHTS.js","./chunk.QWX2N2VD.js","./chunk.BJR6E2CT.js","./chunk.VSWEKNKS.js","./chunk.UGFDSE37.js","./chunk.SGJSJGSR.js","./chunk.2OXXGN7C.js","./chunk.Q4KNNJFL.js","./chunk.BH365UJ5.js","./chunk.6EHE26ZS.js","./chunk.N2S3TMBC.js","./chunk.7JW5SHRR.js","./chunk.PXQVXBNG.js","./chunk.4SEY7VWZ.js","./chunk.IVHPJUFM.js","./chunk.D53IGR45.js","./chunk.MJ4XTNTL.js","./chunk.AP22NNIM.js","./chunk.SPZVEQC5.js","./chunk.FNK2ZZ5E.js","./chunk.RSR2M7ZO.js","./chunk.EM5CGFNB.js","./chunk.N2S45SSL.js","./chunk.AGVFW6WC.js","./chunk.SIVMZNHZ.js","./chunk.3NEALGMI.js","./chunk.UT6642FC.js","./chunk.XOZU4OFA.js","./chunk.35FUGOSG.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.NQDGUIUQ.js","./chunk.DTRNDSMS.js","./chunk.3EW6L5DY.js","./chunk.AVDXG57A.js","./chunk.LD6S2FL5.js","./chunk.TABIRLQS.js","./chunk.GZHZLJBF.js","./chunk.FOYVTN5B.js","./chunk.OJGHDWI6.js","./chunk.OTF3NNTI.js","./chunk.A7HMVWMG.js","./chunk.GRLPNTUW.js","./chunk.EJAVIZ7Y.js","./chunk.423SZS7C.js","./chunk.TM6JVVGW.js","./chunk.SDO3U72B.js","./chunk.PFEKS3KO.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.6EGHJCEM.js"))),br=ct(()=>jt(vr().then(e=>e.SceneFace)),{what:"This view"}),Sr=ct(()=>vr().then(e=>e.SceneKeeping),{quiet:!0}),Pr=ct(()=>jt(to().then(e=>e.PagesContent)),{what:"This page"}),kr=ct(()=>jt(no().then(e=>e.PictureFace)),{what:"This picture"}),ro=br.Face,oo=Sr.Face,ao=Pr.Face,io=kr.Face;function Oe(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Er));return Promise.all([...[...o].map(a=>a.fetch()),$n()]).then(()=>{},()=>{})}var Er=e=>e==="pages"?[Pr]:e==="picture"?[kr]:[br,Sr],Ar=e=>Er(e).every(n=>n.here()),so=150,It=0;function yr(e,n){if(Ar(e))return n();let o=++It,a=()=>{o===It&&(It+=1,n())};Oe(e).then(a),setTimeout(a,so)}var co=768;function lo(e,n){let o=n!==null&&n>=co;(0,c.useEffect)(()=>{if(!o||e==="picture")return;let a=e==="pages"?"scene":"pages";if(Ar(a))return;let d=globalThis,l=()=>void Oe(a),b=()=>{},p=Dn(()=>{if(d.requestIdleCallback&&d.cancelIdleCallback){let g=d.requestIdleCallback(l,{timeout:4e3});b=()=>d.cancelIdleCallback?.(g)}else{let g=setTimeout(l,1500);b=()=>clearTimeout(g)}});return()=>(p(),b())},[e,o])}function uo({asked:e,shown:n,onDrawn:o}){return(0,c.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function fo({auto:e,scene:n}){return(0,h.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${Bt}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var po=Lt(be(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,h.jsx)(e.StudioPlace,{...n}),{quiet:!0});function Rr(e,n,o,a,d){return Vt(e,Jn(n?nt(n):d??Sn,a),o)}function qt(e){return e&&nt(e).overview?"graview":"scene"}function gr(e,n){if(n.homeView?.()===void 0)return!1;let o=e.pages?.first?.trim();return o===void 0||o===""||o==="/"||o.toLowerCase()==="home"}function Tr(e){let[,n]=(0,c.useState)(!1),o=(0,c.useCallback)(()=>n(!0),[]),a=(0,c.useRef)(!1);return e.at&&!lt?(0,h.jsx)($t,{onReady:o,fetch:zt}):!a.current&&mr(e.draftView)?(0,h.jsx)($t,{onReady:o,fetch:Nt}):(a.current=!0,(0,h.jsx)(mo,{...e}))}function mo(e){let{app:n,stop:o,bar:a=!0,standing:d="Everything is in order",principal:l,heading:b=2}=e,{rootRef:p,scope:g,css:A,scheme:T,store:v,presence:P,brand:C,auto:S,height:N}=tr(e),ne=hr(e.draftView),V=Xn(e,zn,ne.over),[Z]=(0,c.useState)(On),u=e.basePath===void 0?{}:{basePath:e.basePath},[D]=(0,c.useState)(ot),q=e.notices??D,K=m=>Rt(m,u),x={...e.routing?{routing:e.routing}:{},...u},[de]=(0,c.useState)(()=>{let m=e.at?.face;if(m)return m;let F=o===void 0&&gr(n,V)?"pages":qt(o),me=Mt({...x,face:F});return e.face===void 0&&e.onOpening?.(me),me}),[$,O]=(0,c.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&Gn(x)&&gr(n,V)),Pe=(0,c.useRef)(e.onFace);Pe.current=e.onFace,(0,c.useLayoutEffect)(()=>{$&&(Pe.current?.("pages"),O(!1))},[$]);let k=$?"pages":e.face??de,te=n.schema.kinds,R=e.routing==="address",J=(0,c.useMemo)(()=>e.at?lt.settleAt(e,v.seenBy(l??{kind:"human"}),V.places()):void 0,[]),B=(0,c.useMemo)(()=>Rn(V,n.schema),[V,n.schema]),ce=(0,c.useMemo)(()=>{let m=J?.stop??(R?Un(e.basePath):void 0)??o;return k==="scene"&&m===void 0&&B===void 0&&(e.path===void 0||_t(e.path))?Dt(void 0):Rr(k,m,te,V.places(),B)},[]),[we]=(0,c.useState)(k);(0,c.useEffect)(()=>{we!=="pages"&&An(V)},[we,V]);let W=(0,c.useRef)(void 0),z=m=>m===void 0||_t(m)?"/":m;W.current??={path:z(J?.path??(R?k==="pages"?(Tt(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==W.current.asked&&(W.current={path:z(e.path),asked:e.path});let I=(0,c.useRef)(e.onNavigate);I.current=e.onNavigate;let le=(0,c.useCallback)((m,F)=>{W.current.path=m,I.current?.(m,F)},[]),{at:L,setAt:ke,steering:Y,steer:X}=ir(W.current.path),M=(0,c.useContext)(xr);M&&(M.pages=()=>W.current.path);let Ee=(0,c.useRef)(void 0),ue=(0,c.useCallback)(m=>void(W.current.path=m),[]),re=Wn(p),[Q,ze]=(0,c.useState)(!1),Ae=e.pagesBelow!==void 0&&re!==null&&re<e.pagesBelow&&(k==="scene"||k==="graview")&&!Q,E=Ae?"pages":k,Re=(0,c.useRef)(!1);Re.current=Q&&e.pagesBelow!==void 0&&re!==null&&re<e.pagesBelow&&(k==="scene"||k==="graview"),M&&(M.shown=E);let fe=(0,c.useRef)(k==="graview"?"graview":"scene");(E==="scene"||E==="graview")&&(fe.current=E),(0,c.useState)(()=>{if(!R||typeof window>"u"||E==="pages"||E==="picture")return;let{pathname:m,search:F,hash:me}=window.location;Tt(m,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${K(ve)}${F}${me}`)}),er(p,E,e.onIntrinsicHeight),lo(E,re);let oe=sr(e.onError,E),He=dr(e.onReady,E),Te=(0,c.useRef)(e.onFaceDrawn);Te.current=e.onFaceDrawn;let pt=(0,c.useCallback)((m,F)=>{He(F),Te.current?.(m)},[He]),[mt,ht]=(0,c.useState)(null),G=V.places(),ee=(0,c.useRef)({shown:E,onFace:e.onFace});ee.current={shown:E,onFace:e.onFace};let U=(0,c.useCallback)((m,F,me)=>{if(R){Ee.current?.(m,F,me);return}ee.current.onFace?.(m),I.current?.(m==="pages"?F??W.current.path:ve,"push")},[R]),[Be,pe]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{E==="pages"&&pe(void 0)},[E]);let Ge=(0,c.useRef)(o);(0,c.useEffect)(()=>{Ge.current!==o&&(Ge.current=o,pe(void 0))},[o]);let We=(0,c.useCallback)(m=>{if(ee.current.shown==="pages"){if(ze(!0),pe(m),k==="scene"||k==="graview"){yr(k,()=>{R?window.history.pushState(null,"",`${K(ve)}${m??""}`):I.current?.(ve,"push")});return}yr(fe.current,()=>U(fe.current,void 0,m))}},[R,k,e.basePath,U]),ae=(0,c.useCallback)(m=>{if(ee.current.shown==="pages"){Y.go.current||(W.current.path=m),X(m);return}if(W.current.path=m,ke(m),Re.current){ze(!1),R?window.history.pushState(null,"",K(m)):I.current?.(m,"push");return}U("pages",m)},[Y,X,ke,U,R,e.basePath]),Le=V.arrangement?.(),xe=E==="pages",_=e.hrefOf,ie=_??(R?K:void 0),Ue=(0,c.useMemo)(()=>({open:ae,..._?{href:_}:R?{href:m=>Rt(m,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[ae,R,e.basePath,_]);return(0,h.jsxs)("section",{ref:p,className:g,"aria-label":e.label??n.name,"data-graview-embed":E,"data-graview-scheme":T,...Ae?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:N,minHeight:S?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,h.jsx)("style",{children:A}),(0,h.jsxs)(Bn.Provider,{value:oe,children:[(0,h.jsx)(nr,{rootRef:p,board:q}),(0,h.jsx)(Zn,{rootRef:p,firstLook:e.firstLook,app:_n(C??{name:n.name},n.schema)}),(0,h.jsx)(_e,{module:"@graview/react",report:oe,content:!0,children:(0,h.jsx)(Fn.Provider,{value:Z,children:(0,h.jsx)(En,{store:v,views:V,initialView:ce,scheme:T,...rr(e,P,C),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,h.jsxs)(Nn.Provider,{value:q,children:[(0,h.jsx)(wo,{face:E,stop:Be??o,kinds:te,places:G,opens:B}),M?(0,h.jsx)(ho,{into:M}):null,(0,h.jsx)(yo,{rootRef:p,face:k,shown:E,path:L,stop:o,draft:ne.n,onDrawn:e.onDrawn,parts:Z}),R?(0,h.jsx)(Kn,{pagesWere:J?.path,basePath:e.basePath,shown:E,onFace:e.onFace,toggle:Ee,kinds:te,places:G,opens:B,landed:ue}):null,a&&E!=="picture"?(0,h.jsx)(_e,{module:"@graview/embed",report:oe,children:(0,h.jsx)(or,{name:C?.name??n.name,heading:b,named:Ht(a).name!==!1,faces:Ht(a).faces===!1?void 0:{scene:{label:gn(Le),current:!xe,go:()=>We(),reach:()=>void Oe(fe.current)},pages:{label:wn(Le),current:xe,go:()=>ae(W.current.path),reach:()=>void Oe("pages")}},at:xe?L:null,without:e.pages?.without(),home:{...ie?.("/")!==void 0?{href:ie("/")}:{},go:()=>ae("/"),current:xe&&L.split("?")[0]==="/"},reach:{...ie?{href:ie}:{},go:m=>ae(m.path)},standing:d,hostActions:e.hostActions,keeping:xe?void 0:(0,h.jsx)(vo,{app:n,studio:e.studio,report:oe}),onFind:ht,switch:e.switch})}):null,(0,h.jsx)(In.Provider,{value:mt,children:(0,h.jsx)(_e,{module:E==="pages"||E==="picture"?"@graview/pages":"@graview/react",report:oe,content:!0,children:(0,h.jsxs)(c.Suspense,{fallback:(0,h.jsx)(fo,{auto:S,scene:E!=="pages"&&E!=="picture"}),children:[E==="picture"?(0,h.jsx)(io,{scope:g,store:v,views:V,as:(o?nt(o).within?.view:void 0)??""}):E==="pages"?(0,h.jsx)(ao,{store:v,views:V,presence:P,auto:S,brand:C,steering:Y,overview:We,scope:g,titleLevel:ar(b),quickAsk:at(e.quickAsk),props:{...e,onNavigate:le,...R?{}:{path:W.current.path}}}):(0,h.jsx)(Hn.Provider,{value:Ue,children:(0,h.jsx)(ro,{address:R,auto:S,scheme:T,scope:g,quickAsk:at(e.quickAsk)})}),(0,h.jsx)(uo,{asked:k,shown:E,onDrawn:pt})]})},E)})]})})})})]})]})}var _t=e=>e.split(/[?#]/)[0]===ve,xr=(0,c.createContext)(null);function ho({into:e}){return e.view=rt().view,null}function yo({rootRef:e,face:n,shown:o,path:a,stop:d,draft:l,onDrawn:b,parts:p}){let{view:g}=rt(),A=o==="scene"||o==="graview",T=Ft(g),v={face:n,path:A?ve:o==="picture"?d??"#":a,stop:T};return fr(e,`${o} ${A?T:v.path} ${l}`,v,b,p),null}var lt,go=be(()=>(__graviewPreload(import.meta.url,["./chunk.CXIIRL67.js","./chunk.423SZS7C.js","./chunk.TM6JVVGW.js","./chunk.SDO3U72B.js","./chunk.PFEKS3KO.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.REANMQ6K.js"))),zt=()=>go().then(e=>void(lt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(zt));function wo({face:e,stop:n,kinds:o,places:a,opens:d}){let{view:l,go:b}=rt(),p=(0,c.useRef)({face:e,stop:n});return(0,c.useLayoutEffect)(()=>{let g=p.current.stop!==n,A=p.current.face!==e,T=p.current.face==="pages";if(p.current={face:e,stop:n},!g&&!A||e==="pages"||e==="picture")return;let v=(g||T)&&n!==void 0?Rr(e,n,o,a):T&&Yn(l)?Vt(e,Dt(d),o):e==="graview"?Ot(l,!0):l.overview?Pn(Ot(l,!1),jn(l,o)):l;b(v)},[e,n,o,l,b,d]),null}function vo({app:e,studio:n,report:o}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(oo,{})}),n!==!1?(0,h.jsx)(_e,{module:"@graview/studio",report:o,children:(0,h.jsx)(bo,{app:e,studio:n})}):null]})}function bo({app:e,studio:n}){let o={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},a=n?.place;return a?(0,h.jsx)(a,{...o}):(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(po,{...o})})}function So({path:e,stop:n,...o},a){return{...o,app:a.app,at:a.at,...a.remote.presence?{presence:a.remote.presence}:{}}}function Gt(e,n){let o=n.store??n.remote?.store??Qn(n.app,n.seed),a=n.notices??ot(),d=null,l={},b=0,p=n.label,g=n.app,A=Promise.resolve(),T=n.at?.face??n.face,v=T===void 0?void 0:Mt({...n,face:T}),P=v??qt(n.stop),C=null,S=[],N=u=>{if(C=u,u!==P)return;let D=S;S=[];for(let q of D)q()};function ne(){let[u,D]=(0,c.useState)(v),[q,K]=(0,c.useState)(n.stop),[x,de]=(0,c.useState)(n.path),[$,O]=(0,c.useState)(n.scheme??"auto"),[Pe,k]=(0,c.useState)(n.principal),[te,R]=(0,c.useState)(n.seats),[J,B]=(0,c.useState)(n.quickAsk),[ce,we]=(0,c.useState)(n.people),[W,z]=(0,c.useState)(n.hostContext),[I,le]=(0,c.useState)(n.brand),[L,ke]=(0,c.useState)(n.label),[Y,X]=(0,c.useState)(n.hostActions),[M,Ee]=(0,c.useState)(void 0),[ue,re]=(0,c.useState)(n.draftView);return d={app:Q=>{Ee(Q),de(void 0),K(void 0)},face:D,stop:K,path:de,scheme:O,seat:k,seats:R,quickAsk:B,people:we,hostContext:z,brand:le,label:ke,hostActions:X,draft:re},(0,h.jsx)(xr.Provider,{value:l,children:(0,h.jsx)(Tr,{...M?So(n,M):n,store:o,notices:a,...u!==void 0?{face:u}:{},onOpening:Q=>{P=Q},...q!==void 0?{stop:q}:{},...x!==void 0?{path:x}:{},...Pe?{principal:Pe}:{},...te?{seats:te}:{},...J!==void 0?{quickAsk:J}:{},...ce?{people:ce}:{},...W?{hostContext:W}:{},...I?{brand:I}:{},label:L,hostActions:Y,draftView:ue,scheme:$,onFace:Q=>{P=Q,D(Q)},onSeat:k,onFaceDrawn:N},M?.n??0)})}let V=()=>{let u=l.view?.focusId,D=u?o.graph.getNode(u)?.kind:void 0,q=(l.shown??P)==="scene"||(l.shown??P)==="graview";return{face:P,path:q?ve:l.pages?.()??n.path??"/",stop:l.view?Ft(l.view):n.stop??"#",...D?{kind:D}:{}}},Z=(0,wr.createRoot)(e);return(0,j.flushSync)(()=>Z.render((0,h.jsx)(ne,{}))),{get store(){return o},where:V,setApp:(u,D,q)=>{let K="graph"in D?{store:D}:D,x=()=>{let de=V();o=K.store,p=q?.label??(p===g.name?u.name:p),g=u,(0,j.flushSync)(()=>{d?.label(p),d?.app({app:u,remote:K,at:de,n:++b})})};lt?x():A=A.then(zt).then(x)},setFace:u=>{P=u,(0,j.flushSync)(()=>d?.face(u))},setStop:u=>(0,j.flushSync)(()=>d?.stop(u)),setPath:u=>(0,j.flushSync)(()=>{if(_t(u)){(P==="pages"||P==="picture")&&(P="scene",d?.face("scene"));return}d?.path(u),P!=="pages"&&(P="pages",d?.face("pages"))}),setScheme:u=>(0,j.flushSync)(()=>d?.scheme(u)),setSeat:u=>(0,j.flushSync)(()=>d?.seat(u)),setSeats:u=>(0,j.flushSync)(()=>d?.seats(u)),setQuickAsk:u=>(0,j.flushSync)(()=>d?.quickAsk(u)),setPeople:u=>(0,j.flushSync)(()=>d?.people(u)),setHostContext:u=>(0,j.flushSync)(()=>d?.hostContext(u)),setBrand:u=>(0,j.flushSync)(()=>d?.brand(u)),setDraftView:u=>(0,j.flushSync)(()=>d?.draft(u)),setLabel:u=>{p=u,(0,j.flushSync)(()=>d?.label(u))},setHostActions:u=>(0,j.flushSync)(()=>d?.hostActions(u)),drawn:()=>A.then(()=>C===P?void 0:new Promise(u=>S.push(u))),notify:u=>{let D;return(0,j.flushSync)(()=>{D=a.notify(u)}),D},unmount:()=>Z.unmount()}}var Fr="/graview/live",Ut="graview.ship",Kt=`${Ut}.${Xe}`;var ge={seat:"x-graview-seat",roles:"x-graview-roles",kind:"x-graview-kind",name:"x-graview-name",for:"x-graview-for",forRoles:"x-graview-for-roles",forName:"x-graview-for-name",via:"x-graview-via"};var Ve=class extends Error{constructor(n){super(n),this.name="Superseded"}},Se=e=>e?.lineage?{lineage:e.lineage}:{},Po=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
2
- `)[0]??"":String(n)})`;function ko(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let o=JSON.parse(n);return Array.isArray(o)?o.filter(a=>!!a&&Array.isArray(a.calls)):[]}catch{return[]}}var De=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Eo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},Ce=class extends Error{constructor(o,a){super(o);this.conflicts=a;this.name="StaleWrite"}},qe=class extends Error{constructor(n){super(n),this.name="Unreached"}},Ao=new Set([502,503,504]);async function Ro(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function To(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var xo=1,Fo=()=>({refusals:new Set,conflicts:new Set,statuses:new Set,helds:new Set,builds:new Set,who:new Set,declarations:new Set,tally:{reconnects:0,rebases:0,conflicts:0,resyncs:0}});async function ut(e){return(await Cr(e,ko(e.carry),"This app was updated while your changes were on the way.",Fo())).remote}async function Cr(e,n,o,a){let d=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},b={...ft(e.principal),[ge.via]:e.via??"web"};Object.assign(l,b);let p=e.live===!0,g=e.presenceEveryMs,A=e.visible??Lo,T="connecting",v=a.statuses,P=a.tally,C=[],S,N=[],ne=()=>T==="online"&&S!==void 0?"held":T,V=()=>{let t=ne();if(a.told!==t){a.told=t;for(let r of[...v])r(t)}},Z=t=>{if(!(t===T||se)&&(T==="offline"&&t==="online"&&P.reconnects++,T=t,V(),t==="online"))for(let r of C.splice(0))r.again()},u=t=>{if(se)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==S;if(S=r,D(),!!s&&(V(),r===void 0)){for(let i of N.splice(0))i();F&&clearTimeout(F),me()}},D=()=>{if(a.toldHeld!==S){a.toldHeld=S;for(let t of[...a.helds])t(S??null)}},q=async(t,r)=>{let s;try{s=await d(t,r)}catch(i){throw _()||Z("offline"),new qe(i instanceof Error?i.message:String(i))}if(s.status===503&&await Ro(s))return Z("online"),s;if(Ao.has(s.status))throw _()||Z("offline"),new qe(`The server is away (${s.status})`);return Z("online"),s},K=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${Ie.op}`,s=t?await d(r,{headers:l}):await q(r,{headers:l});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},x=e.state??await K(!0);p||(T="online"),S=typeof x.held=="string"&&x.held.length>0?x.held:void 0,D();let de=x.enabledModules??e.enabledModules,$=e.localApp?e.localApp(e.app):e.app,O=new yn({schema:$.schema,mutations:$.mutations??[],invariants:$.invariants??[],...$.policy?{policy:$.policy}:{},...$.modules?{modules:$.modules}:{},...de?{enabledModules:de}:{},...$.intelligence?{intelligence:$.intelligence}:{},...$.brand?.timeZone?{timeZone:$.brand.timeZone}:{},snapshot:x.snapshot,log:x.log,...x.horizon!==void 0?{horizon:x.horizon}:{},ids:To(),...e.storeOptions??{}});pn.served.add(O);let Pe=mn(O),k=x.log.at(-1)?.seq??(x.horizon??0)-1,te=At.of(x.log,{horizon:x.horizon??0}),R=null,J,B=new Map,ce=a.who,we=!1,W=t=>{if(se)return;we=!0;let r=vn(new Map,t,Date.now(),1e4,R?.participant);J!==void 0&&r.delete(J);let s=r.size!==B.size;if(!s)for(let[i,f]of r)xt(f,B.get(i))||(s=!0);if(B=r,!!s)for(let i of[...ce])i([...B.values()])},z=[],I=new Set,le=t=>{let r=z.indexOf(t);r>=0&&z.splice(r,1)},L=new Map,ke=(t,r)=>{let s=L.get(t);s&&(L.delete(t),s.resolve({ops:r.filter(i=>i.batch===t),batch:t}))},Y,X=[],M=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(Y)return X.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(w=>w.seq>k).map(w=>w.seq));if(Number.isFinite(s)&&s>k+1)return X.push({ops:t,drop:r}),Ee(),[];let i=z.filter(w=>t.some($e=>$e.batch===w)),f=[...new Set([...r,...i])].filter(w=>I.has(w)),y,H=z.filter(w=>!i.includes(w));try{y=O.rebase({confirmed:t,pending:H,drop:f}).confirmed}catch(w){if(!(w instanceof hn))throw w;return X.push({ops:t,drop:r}),Ee(),[]}for(let w of i)le(w);t.some(w=>w.seq>k)&&H.some(w=>!f.includes(w))&&P.rebases++,t.length>0&&(k=Math.max(k,...t.map(w=>w.seq)),te.note(t));for(let w of f)I.delete(w);for(let w of i)ke(w,t);return y},Ee=()=>{Y||(Y=oe(K().then(t=>{if(ue(t)){X=[];return}let r=new Set(t.log.map(f=>f.batch)),s=z.filter(f=>r.has(f));for(let f of s)le(f);let i=O.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...z],drop:[...I].filter(f=>!z.includes(f))});I.clear();for(let f of i.pending)I.add(f.batch);k=t.log.at(-1)?.seq??(t.horizon??0)-1,te=At.of(t.log,{horizon:t.horizon??0}),P.resyncs++;for(let f of s)ke(f,t.log)}).then(()=>{Y=void 0;let t=X;X=[];for(let{ops:r,drop:s}of t)M(r,s)},()=>{Y=void 0,X=[]})))},ue=t=>(typeof t.build=="string"&&en(t.build),typeof t.version=="number"&&u(t.held),typeof t.version!="number"||t.version===x.version?!1:(vt(t.version),!0)),re=async t=>{let s=await(await q(`${e.url}/graview/since?seq=${t}&opFormat=${Ie.op}`,{headers:l})).json();return ue(s)?[]:s.ops??[]},Q=async()=>{let t=await ze();return Y&&await Y,t},ze=async()=>{if(R&&!_()&&A()){let r=await(await q(`${e.url}/graview/here`,{method:"POST",headers:l,body:JSON.stringify({presence:R,seq:k})})).json();return ue(r)?[]:(typeof r.participant=="string"&&(J=r.participant),W(r.who??[]),M(r.ops??[]))}return M(await re(k))},Ae=new Map,E=new Map,Re=new Map,fe=new Set,oe=t=>(fe.add(t),t.finally(()=>fe.delete(t)).catch(()=>{}),t),He=Promise.resolve(),Te=0,pt=(t,r)=>{let s=He.then(()=>ht(t,r));return He=s.catch(()=>{}),s},mt=()=>new Promise((t,r)=>C.push({again:t,give:r})),ht=async(t,r)=>{let s,i;for(;;){try{s=await q(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:Ie.op})})}catch(w){if(!(w instanceof qe)||U)throw w;if(await mt(),_())return Ke(t,r);continue}if(i=await s.json().catch(()=>({})),s.status===503&&i.reason==="unavailable"&&typeof i.held=="string"&&!U){if(typeof i.version=="number"?ue(i):(u(i.held),!1))break;if(S!==void 0&&(Pt>0||p)){if(await new Promise(w=>N.push(w)),U)throw new Ve("The client closed.");if(_())return Ke(t,r);continue}}let H;if(s.status===503&&i.reason==="unavailable"&&!U)H=Jt(e.backoff,Te++);else{if(Te=0,s.status!==429||U)break;H=Oo(s.headers.get("retry-after"),i.retryAfter)}if(await new Promise(w=>setTimeout(w,H)),_())return Ke(t,r)}if(se||ue(i))throw new Ve("The app was changed.");if(!s.ok){let H=i.error??`The server refused (${s.status})`;throw i.conflict?new Ce(H,i.conflicts??[]):new De({reason:i.reason??Eo[s.status]??"invalid",sentence:H,...i.wouldNeed?.length?{wouldNeed:i.wouldNeed}:{}})}let f=i.ops??[],y=f[0]?.seq;return y!==void 0&&y>k+1&&(f=await re(k)),r!==void 0&&(i.batch&&Ae.set(r,i.batch),le(r)),M(f,r!==void 0?[r]:[]),{ops:i.ops??[],...i.batch?{batch:i.batch}:{}}},G,ee=!1,U=!1,Be=0,pe,Ge=0,We=0,ae=null,Le=()=>{},xe=new Promise(t=>{Le=t}),_=()=>p&&ee&&G?.readyState===xo,ie=t=>{if(!_())return!1;try{return G.send(JSON.stringify(t)),!0}catch{return!1}},Ue=(t=!1)=>{!R||!_()||!A()||!t&&ae&&xt(R,ae)&&(g===void 0||Date.now()-We<g)||ie({t:"here",presence:R})&&(ae=R,We=Date.now())},m=new Set,F,me=()=>{if(F=void 0,S!==void 0)return;let t=[...L.entries()].filter(([r])=>m.has(r));m.clear();for(let[,r]of t)ie(r.message)},Xt=(t,r)=>{L.has(t)&&(m.add(t),F&&clearTimeout(F),F=setTimeout(me,Math.max(0,r)))},Vr=t=>{L.has(t)&&m.add(t)},Ke=(t,r)=>new Promise((s,i)=>{let f=r??`send-${++Ge}`,y=t.undo?{t:"undo",cid:f,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...Se(t)}:{t:"call",cid:f,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...Se(t)};if(L.set(f,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:i}),m.size>0||S!==void 0){m.add(f);return}ie(y)}),yt=(t,r)=>_()?Ke(t,r):pt(t,r),Dr=t=>{switch(t.t){case"welcome":{if(en(t.build),typeof t.version=="number"&&t.version!==x.version){vt(t.version);return}if(ee=!0,Be=0,typeof t.participant=="string"&&(J=t.participant),u(t.held),M(t.ops??[]),m.clear(),F&&clearTimeout(F),F=void 0,S!==void 0)for(let r of L.keys())m.add(r);else for(let r of L.values())ie(r.message);Ue(!0),Z("online"),Le();return}case"ops":M(t.ops??[]);return;case"ack":{let r=L.get(t.cid);if(!r){M(t.ops??[]);return}L.delete(t.cid),Te=0,r.mine!==void 0&&(Ae.set(r.mine,t.batch),le(r.mine)),M(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=L.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){S!==void 0?Vr(t.cid):Xt(t.cid,Jt(e.backoff,Te++));return}L.delete(t.cid),r.reject(t.t==="conflict"?new Ce(t.sentence,t.conflicts??[]):new De({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&Xt(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":W(t.who??[]);return;case"held":u(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==x.version&&vt(t.version);return;case"reload":on(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&G){let r=G;sn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},se=!1,gt=a.declarations,wt=a.builds,en=t=>{if(!(se||a.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){a.otherBuild=t;for(let r of[...wt])r(t)}},tn=()=>{let t=[],r=0;for(let s of z){let i=Re.get(s);i?t.push({calls:i.calls,...i.intent?{intent:i.intent}:{},...i.via?{via:i.via}:{},...Se(i),batch:s}):r++}return{carried:t,undos:r}},nn=(t,r)=>`${r} while ${t===1?"an undo of yours was":"undos of yours were"} on the way; ${t===1?"it was":"they were"} not made.`,rn=t=>{se=!0,R=null;let r=new Ve(t);for(let i of L.values())i.reject(r);L.clear(),Qe&&clearInterval(Qe),U=!0,pe&&clearTimeout(pe),F&&clearTimeout(F),he&&clearTimeout(he);for(let i of C.splice(0))i.give(r);for(let i of N.splice(0))i();let s=G;G=void 0,ee=!1;try{s?.close(1e3,t)}catch{}Le()};async function vt(t){if(se)return;if(!e.resolveApp){on(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=tn(),i=e.resolveApp,f=R;rn("The app was changed.");try{let y=await i(t),{state:H,...w}=e,$e=await Cr({...w,app:y},r,"The app was changed while your changes were on the way.",a);f&&$e.remote.presence.here(f);for(let Ze of[...gt])Ze($e.remote,t);let _r=[...s>0?[Je(nn(s,"The app was changed"))]:[],...$e.unheard()];for(let Ze of _r)for(let jr of Me)jr(Ze.sentence,Ze)}catch(y){let H=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let w of Me)w(H,Je(H))}}function on(t){if(se)return;let{carried:r,undos:s}=tn();rn(t);let i=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),i=!0}catch{}let f=[];!i&&r.length>0&&f.push(`${t} ${r.length===1?"A change of yours was":`${r.length} changes of yours were`} not sent; make ${r.length===1?"it":"them"} again after the page reloads.`),s>0&&f.push(nn(s,"This app was updated"));for(let y of f)for(let H of Me)H(y,Je(y));(e.reloadPage??Co)()}let an=()=>{if(U||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${Fr}`,{"content-type":r,...s}=l,i;try{i=e.socket?e.socket(t,s,[Kt]):Ir(t,s)}catch{return dn()}G=i,ee=!1,i.onopen=()=>{G===i&&i.send(JSON.stringify({t:"hello",seq:k,protocol:Xe,wire:Ut,opFormat:Ie.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},i.onmessage=f=>{if(G!==i)return;let y;try{y=JSON.parse(String(f.data))}catch{return}Dr(y)},i.onclose=()=>sn(i),i.onerror=()=>{}},he,Hr=()=>{we=!1,he&&clearTimeout(he),he=setTimeout(()=>{if(he=void 0,we||U)return;let t=new Map([...B].filter(([,r])=>r.held!=="socket"));if(t.size!==B.size){B=t;for(let r of ce)r([...B.values()])}},1e4),he.unref?.()};function sn(t){if(G!==t)return;let r=ee;G=void 0,ee=!1,ae=null,r&&(Z("offline"),Hr()),dn()}let dn=()=>{if(U)return;let t=Jt(e.backoff,Be);Be++,pe=setTimeout(an,t)},Br=O.applyAll.bind(O),Wr=O.undo.bind(O),Nr=O.previewAll.bind(O);O.previewAll=(t,r)=>Nr(t,{...e.principal?{author:e.principal}:{},...r});let Me=a.refusals,Ne=[],Je=t=>({reason:"invalid",sentence:t}),Ye=a.conflicts,bt=!1,cn=async(t,r)=>{if(r instanceof Ve||se)return;let s=r instanceof De?r.refusal:un(r),i=s.sentence;le(t);try{M([],[t])}catch{}let f=Re.get(t);if(Re.delete(t),r instanceof Ce&&P.conflicts++,r instanceof Ce&&!_()&&await Q().catch(()=>[]),r instanceof Ce&&Ye.size>0){let y=!1,H={sentence:i,conflicts:r.conflicts,keepTheirs(){y=!0},useMine(){if(!(y||!f)){y=!0,bt=!0;try{O.applyAll(f.calls,{...f.intent?{intent:f.intent}:{},...f.via?{via:f.via}:{},...Se(f)})}finally{bt=!1}}}};for(let w of Ye)w(H);return}for(let y of Me)y(i,s)};O.applyAll=(t,r)=>{let s=fn(O.log.all().filter(y=>I.has(y.batch))),i=Br(t,{...e.principal?{author:e.principal}:{},...r});z.push(i.batch),I.add(i.batch),Re.set(i.batch,{calls:t,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...Se(r)});let f=bt?[]:te.baseFor(i.ops,s);return E.set(i.batch,oe(yt({calls:t,...r?.intent?{intent:r.intent}:{},batch:i.batch,...f.length>0?{base:f}:{},...r?.via?{via:r.via}:{},...Se(r)},i.batch).catch(y=>cn(i.batch,y)))),i},O.apply=(t,r)=>O.applyAll([t],r),O.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,i=Wr(s.map(y=>Ae.get(y)??y),{...e.principal?{author:e.principal}:{},...r});z.push(i.batch),I.add(i.batch);let f=Promise.allSettled(s.map(y=>E.get(y)));return E.set(i.batch,oe(f.then(()=>yt({undo:s.map(y=>Ae.get(y)??y),...r?.intent?{intent:r.intent}:{},batch:i.batch,...r?.via?{via:r.via}:{},...Se(r)},i.batch)).catch(y=>cn(i.batch,y)))),i};let $r=async(t,r={})=>{St++;try{return(await oe(yt({calls:t,...r}))).ops}finally{St--}},St=0,ln={here(t){R=t,Ue()},onWho(t){return ce.add(t),B.size>0&&t([...B.values()]),()=>{ce.delete(t)}},leave(){if(!R)return;let t=JSON.stringify({participant:J??R.participant});if(R=null,ie({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):d(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},Pt=e.pollMs??800,Qe=Pt>0&&typeof setInterval=="function"?setInterval(()=>{_()||Q().catch(()=>{})},Pt):null;if(p){an();let t;await Promise.race([xe,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!se){let t=[],r=new Set(O.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{O.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...Se(s)})}catch(i){t.push(Po(s,i))}t.length>0&&Ne.push(Je(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}return{remote:{store:O,version:x.version,migrated:x.migrated??[],send:$r,pull:Q,onRefusal(t){Me.add(t);let r=Ne;Ne=[];for(let s of r)t(s.sentence,s);return()=>Me.delete(t)},onDeclaration(t){return gt.add(t),()=>gt.delete(t)},onBuild(t){return wt.add(t),a.otherBuild!==void 0&&t(a.otherBuild),()=>wt.delete(t)},onConflict(t){return Ye.add(t),()=>Ye.delete(t)},revision:(t,r)=>te.of(t,r),seq:()=>k,participant:()=>J,transport:()=>_()?"socket":"poll",status:ne,onStatus(t){return v.add(t),()=>v.delete(t)},held:()=>S,onHeld(t){return a.helds.add(t),S!==void 0&&t(S),()=>a.helds.delete(t)},counters:()=>({...P}),who:()=>[...B.values()],pending:()=>z.length+St,async settled(){for(;fe.size>0;)await Promise.allSettled([...fe])},presence:ln,close(){Qe&&clearInterval(Qe),Pe(),ln.leave(),U=!0,pe&&clearTimeout(pe),F&&clearTimeout(F),he&&clearTimeout(he);for(let r of C.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of N.splice(0))r();let t=G;G=void 0,ee=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Ne;return Ne=[],t}};function Ir(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let i=typeof globalThis.document<"u",f=e.subprotocol?[Kt]:[];if(!i)try{return new s(t,{headers:r,...f.length>0?{protocols:f}:{}})}catch{}let y=new URL(t);for(let[H,w]of Object.entries(b))y.searchParams.set(H,w);return f.length>0?new s(y.toString(),f):new s(y.toString())}}function Oo(e,n,o=Date.now()){let a,d=e?.trim();if(d)if(/^\d+(\.\d+)?$/.test(d))a=Number(d)*1e3;else{let p=Date.parse(d);Number.isFinite(p)&&(a=Math.max(0,p-o))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,b=l!==void 0&&l<50&&a!==void 0&&Math.abs(l*1e3-a)<1e3;return l!==void 0&&!b?l:a??1e3}function Co(){globalThis.location?.reload?.()}function Lo(){return globalThis.document?.visibilityState!=="hidden"}function Jt(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:a=1e4,factor:d=2}=e??{};return Math.min(a,o*d**n)*(.75+Math.random()*.5)}function ft(e){let n={};if(!e)return n;e.id&&(n[ge.seat]=e.id),e.roles?.length&&(n[ge.roles]=e.roles.join(",")),e.kind!=="human"&&(n[ge.kind]=e.kind),e.name&&(n[ge.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[ge.for]=o.id),o?.roles?.length&&(n[ge.forRoles]=o.roles.join(",")),o?.name&&(n[ge.forName]=encodeURIComponent(o.name)),n}var Lr="/graview/views";function Yt(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),a={"content-type":"application/json",...e.principal?ft(e.principal):{},...e.headers??{}},d=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??et.may}:et,l=new Set,b=v=>{if(JSON.stringify(v)!==JSON.stringify(d)){d=v;for(let P of l)P()}},p=async(v,P)=>{let C=await n(`${o}${e.path??Lr}`,{method:v,headers:a,...P!==void 0?{body:JSON.stringify(P)}:{}}),S=await C.json();if(!C.ok)throw new Error(S.error??`The store answered ${C.status}.`);b({hidden:S.hidden??[],removed:S.removed??[],may:S.may??et.may})},g=()=>p("GET"),A=e.state?Promise.resolve():g().catch(()=>{}),T=e.pollMs?setInterval(()=>void g().catch(()=>{}),e.pollMs):void 0;return{ready:A,refresh:g,close:()=>clearInterval(T),current:()=>d,onChange(v){return l.add(v),()=>void l.delete(v)},hide:v=>p("POST",{hide:v}),show:v=>p("POST",{show:v}),remove:(v,P)=>p("POST",{remove:v,...P?{about:P}:{}}),async restore(v){let P=d.removed.find(C=>C.name===v)?.lens;await p("POST",{restore:v}),P&&await e.onDeclaration?.()},async lens(v){await p("POST",{lens:v}),await e.onDeclaration?.()}}}var Zt=document.getElementById("graview-app"),Qt=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),Mr=Qt?(__graviewPreload(import.meta.url,["./chunk.QWX2N2VD.js","./chunk.VSWEKNKS.js","./chunk.UGFDSE37.js","./chunk.SGJSJGSR.js","./chunk.2OXXGN7C.js","./chunk.Q4KNNJFL.js","./chunk.BH365UJ5.js","./chunk.6EHE26ZS.js","./chunk.N2S3TMBC.js","./chunk.7JW5SHRR.js","./chunk.4SEY7VWZ.js","./chunk.IVHPJUFM.js","./chunk.D53IGR45.js","./chunk.MJ4XTNTL.js","./chunk.AP22NNIM.js","./chunk.SPZVEQC5.js","./chunk.FNK2ZZ5E.js","./chunk.RSR2M7ZO.js","./chunk.EM5CGFNB.js","./chunk.N2S45SSL.js","./chunk.AGVFW6WC.js","./chunk.SIVMZNHZ.js","./chunk.XOZU4OFA.js","./chunk.35FUGOSG.js","./chunk.MB7LKKUD.js","./chunk.YECMUK4X.js","./chunk.2OLZ6BYI.js","./chunk.WVUJXDXZ.js","./chunk.NQDGUIUQ.js","./chunk.DTRNDSMS.js","./chunk.3EW6L5DY.js","./chunk.AVDXG57A.js","./chunk.LD6S2FL5.js","./chunk.TABIRLQS.js","./chunk.GZHZLJBF.js","./chunk.FOYVTN5B.js","./chunk.OJGHDWI6.js","./chunk.OTF3NNTI.js","./chunk.A7HMVWMG.js","./chunk.GRLPNTUW.js","./chunk.EJAVIZ7Y.js","./chunk.423SZS7C.js","./chunk.TM6JVVGW.js","./chunk.SDO3U72B.js","./chunk.PFEKS3KO.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.5YFO6D7J.js")):Oe("pages");try{Qt?await Mo(decodeURIComponent(Qt[1])):await Vo()}catch(e){let n=document.createElement("pre");n.setAttribute("role","alert"),n.style.cssText="margin:2rem;font:14px/1.5 ui-monospace,monospace;white-space:pre-wrap",n.textContent=e instanceof Error?e.message:String(e),Zt.replaceChildren(n),window.__graviewFailed=n.textContent}async function Mo(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),o=await n.json();if(!n.ok)throw new Error(o.error??`The preview server did not hand over the form (${n.status}).`);let a=await it(o);if(!a.ok)throw new Error(tt(a.findings));let d=a.app,l=o.principal,b=await ut({app:d,url:location.origin,principal:l,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=d.forms?.[e]?.title??d.name;let{mount:p}=await Mr;window.__graview=p(Zt,{app:d,form:e,principal:l,remote:b,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Vo(){let e=await fetch("/graview/document");if(!e.ok)throw new Error(`The preview server did not hand over the document (${e.status}).`);let n=await e.json(),a=await(async g=>{if(typeof g.module=="string")return(await import(g.module)).app;let A=await it(g);if(!A.ok)throw new Error(tt(A.findings));return A.app})(n);if(!a||typeof a!="object"||!("schema"in a))throw new Error("The app module the preview server handed does not export an app.");let d=n.principal,l=await ut({app:a,url:location.origin,principal:d,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=a.name;let b,p=Yt({url:location.origin,principal:d,...n.views?{state:n.views}:{},onDeclaration:async()=>{let g=await(await fetch("/graview/document")).json();if(typeof g.module=="string")return;let A=await it(g);A.ok&&b?.setApp(A.app,l)}});await Promise.all([Mr,p.ready]),b=Gt(Zt,{app:a,remote:l,principal:d,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:a.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=b,b.drawn().then(()=>{window.__graviewReady=!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 Dt,b as Xn,c as er,d as tr,e as nr,f as Bt,g as rr,h as Wt}from"./chunk.353CGK6C.js";import{a as Zr}from"./chunk.WQLAIEWJ.js";import{a as $t,b as ar,c as ir,d as sr,e as Nt,f as dr,g as cr,h as lr,i as ur,j as fr,k as pr,l as mr,m as hr,n as je}from"./chunk.4N5R4K6O.js";import{b as or}from"./chunk.KK46XLGU.js";import{a as At}from"./chunk.Q5WEOX3Q.js";import{a as Rt,g as Tn}from"./chunk.76QSPWSJ.js";import{k as rt}from"./chunk.FKJ3HIA5.js";import{C as Jn,H as Yn,L as Qn,M as Zn,j as Qr,k as zn,n as it,o as Gn,q as Un,u as Kn,z as st}from"./chunk.GYTVL6GR.js";import{Ba as Nn,Ca as In,Ea as _n,Fa as Vt,G as Ht,Ja as jn,Ka as qn,Na as at,T as Fn,Y as Cn,a as xn,b as Lt,c as ot,fa as Ln,ga as Mn,j as On,m as Mt,ua as Hn,va as Vn,wa as Dn,xa as Bn,ya as Wn,za as $n}from"./chunk.TMYGLXR6.js";import{a as Ee}from"./chunk.SDO3U72B.js";import{Bb as wn,Ed as ke,Fd as En,Gd as An,Ld as xt,Md as Ot,Nd as Ft,Qc as bn,Qd as Rn,Rd as Ct,cb as _e,dd as Sn,ec as Tt,fc as vn,fd as Pn,gd as kn,id as nt,nb as tt,ob as gn}from"./chunk.P4CLT32V.js";import"./chunk.SLBWPVIY.js";import{b as Le}from"./chunk.AJZBJBMO.js";async function dt(e,n={}){let a=e.compiled===void 0||!eo(e.compiled,e.document)?void 0:Tn(e.compiled,n);if(a?.ok)return a;let{compileDocumentWithoutCheck:s}=await Xr();return s(e.document,n)}var yr,Xr=()=>yr??=(__graviewPreload(import.meta.url,["./chunk.JBR66TUP.js","./chunk.76QSPWSJ.js","./chunk.XCQ7ZPR5.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.AJAMTRZ3.js")).catch(e=>{throw yr=void 0,e});function eo(e,n){let a=typeof e=="object"&&e!==null?e.document:void 0,s=n;if(typeof s=="string")try{s=JSON.parse(s)}catch{return!1}return a!==void 0&&At(Rt(a).document)===At(Rt(s).document)}var c=Le(Ht(),1);var lt=Le(Ht(),1),It="data-graview-drawn",to=200,gr=50,no=1e4,ct=()=>typeof performance<"u"?performance.now():Date.now();function ro(e){let n=[...e.querySelectorAll("img")];for(let a of e.querySelectorAll("[data-worker-view]"))a.shadowRoot&&n.push(...a.shadowRoot.querySelectorAll("img"));return n}function oo(e,n){if(e.ownerDocument.fonts?.status==="loading"||Vn()>0||$n(n)>0||e.querySelector('[aria-busy="true"]')||ro(e).some(s=>!s.complete&&s.loading!=="lazy"))return!1;for(let s of e.querySelectorAll("[data-worker-view-place]"))if(!s.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function wr(e){let n=e.querySelector("[data-embed-content]"),a=[...e.querySelectorAll("[data-worker-view]")].map(s=>`${s.offsetWidth}x${s.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${a.join(",")}`}function ao(e,n,a,s){e.removeAttribute(It);let d=e.ownerDocument.defaultView;if(!d)return()=>{};let l=ct(),S=l,p=wr(e),w=!1,R,O=typeof MutationObserver>"u"?void 0:new MutationObserver(P=>{P.some(j=>!(j.target===e&&j.attributeName===It))&&(S=ct())});O?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let v=()=>{w=!0,O?.disconnect(),R!==void 0&&clearTimeout(R)},E=P=>{let j=!1,se=()=>{j||(j=!0,P())};typeof d.requestAnimationFrame=="function"&&d.requestAnimationFrame(()=>setTimeout(se,0)),setTimeout(se,100)},L=()=>{if(w)return;let P=wr(e);P!==p&&(p=P,S=ct());let j=ct();if(oo(e,s)&&j-S>=to||j-l>=no){E(()=>{w||(v(),e.setAttribute(It,n),In(),a())});return}R=setTimeout(L,gr)};return R=setTimeout(L,gr),v}function vr(e,n,a,s,d){Nn();let l=(0,lt.useRef)({place:a,onDrawn:s});l.current={place:a,onDrawn:s},(0,lt.useLayoutEffect)(()=>{d&&Wn(d);let S=R=>ao(R,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),d);if(e.current)return S(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=S(e.current))}),()=>{w=!0,p?.()}},[n,e,d])}var ye=Le(Ht(),1),qe,io=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.KVEDMKUN.js","./chunk.XCCBUWMC.js","./chunk.FFCUZPTC.js","./chunk.MG3DMURZ.js","./chunk.2W2YVB6X.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.DUY27OJV.js"))),br=()=>io().then(e=>void(qe=e),()=>new Promise(e=>setTimeout(e,2e3)).then(br)),_t=Hn(br),Sr=e=>!!e&&qe===void 0;function jt({onReady:e,fetch:n}){return(0,ye.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var so=0;function Pr(e){let[n,a]=(0,ye.useState)(()=>qe);(0,ye.useEffect)(()=>{if(!e||n)return;let l=!1;return _t().then(()=>{l||a(qe)}),()=>{l=!0}},[e,n]);let s=(0,ye.useMemo)(()=>so+=1,[e]);return{over:(0,ye.useMemo)(()=>{let l=n??qe;if(!e||!l)return;let{source:S,worker:p,...w}=e,R={...w,worker:p??{source:S},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:O=>l.registerWorkerView(O,R)}},[e,n]),n:s}}var Ar=Le(Zr(),1),G=Le(Qr(),1);var h=Le(Fn(),1);function ut(e,n={}){let a=Vt(e);return{Face:a.part((d,l)=>(0,c.createElement)(d,l),n),fetch:()=>a.load().then(()=>{}),here:()=>a.current!==void 0||a.failed}}var Gt=e=>Promise.all([e,Qn()]).then(([n])=>n),Rr=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.NNUUD26E.js","./chunk.GMAXA5GV.js","./chunk.Y5AMZBHA.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.HJCQ6I3S.js","./chunk.7GAC7U34.js","./chunk.T3RTFTOZ.js","./chunk.FEIJ7ETK.js","./chunk.34HGT7HQ.js","./chunk.LYIHPVDZ.js","./chunk.FU4YSVWX.js","./chunk.TNL2BVCH.js","./chunk.TBSPEO2L.js","./chunk.3SBTQ66X.js","./chunk.3H7YIKKC.js","./chunk.ET3XJDPX.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.4N5R4K6O.js","./chunk.KK46XLGU.js","./chunk.TI4OSTQV.js","./chunk.HVX7LFWR.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.SJKHVIHA.js"))),co=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.JG2FGZF2.js","./chunk.IE4ZJQV3.js","./chunk.TVWN5I4M.js","./chunk.B7LBG4UP.js","./chunk.7G4M2PX3.js","./chunk.UGFDSE37.js","./chunk.NNUUD26E.js","./chunk.PXQVXBNG.js","./chunk.OJ64WTLW.js","./chunk.GMAXA5GV.js","./chunk.IBJBCZKG.js","./chunk.NQ26KMSQ.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.OPCBZNKF.js","./chunk.UK5F3S2N.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.CTOBNZLM.js","./chunk.34HGT7HQ.js","./chunk.TNL2BVCH.js","./chunk.NZDHXREL.js","./chunk.TBSPEO2L.js","./chunk.5ON3JSAK.js","./chunk.3SBTQ66X.js","./chunk.SSAY4ITS.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.Y2ZBVWII.js"))),lo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.JG2FGZF2.js","./chunk.IE4ZJQV3.js","./chunk.TVWN5I4M.js","./chunk.B7LBG4UP.js","./chunk.7G4M2PX3.js","./chunk.UGFDSE37.js","./chunk.NNUUD26E.js","./chunk.PXQVXBNG.js","./chunk.OJ64WTLW.js","./chunk.GMAXA5GV.js","./chunk.IBJBCZKG.js","./chunk.NQ26KMSQ.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.OPCBZNKF.js","./chunk.UK5F3S2N.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.CTOBNZLM.js","./chunk.34HGT7HQ.js","./chunk.TNL2BVCH.js","./chunk.NZDHXREL.js","./chunk.TBSPEO2L.js","./chunk.5ON3JSAK.js","./chunk.3SBTQ66X.js","./chunk.SSAY4ITS.js","./chunk.3TVAE7LE.js","./chunk.JX2C3HVD.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.QEQQXWYU.js"))),Tr=ut(()=>Gt(Rr().then(e=>e.SceneFace)),{what:"This view"}),xr=ut(()=>Rr().then(e=>e.SceneKeeping),{quiet:!0}),Or=ut(()=>Gt(co().then(e=>e.PagesContent)),{what:"This page"}),Fr=ut(()=>Gt(lo().then(e=>e.PictureFace)),{what:"This picture"}),uo=Tr.Face,fo=xr.Face,po=Or.Face,mo=Fr.Face;function Me(...e){let n=e.length>0?e:["scene","pages","picture"],a=new Set(n.flatMap(Cr));return Promise.all([...[...a].map(s=>s.fetch()),Un()]).then(()=>{},()=>{})}var Cr=e=>e==="pages"?[Or]:e==="picture"?[Fr]:[Tr,xr],Lr=e=>Cr(e).every(n=>n.here()),ho=150,qt=0;function kr(e,n){if(Lr(e))return n();let a=++qt,s=()=>{a===qt&&(qt+=1,n())};Me(e).then(s),setTimeout(s,ho)}var yo=768;function go(e,n){let a=n!==null&&n>=yo;(0,c.useEffect)(()=>{if(!a||e==="picture")return;let s=e==="pages"?"scene":"pages";if(Lr(s))return;let d=globalThis,l=()=>void Me(s),S=()=>{},p=_n(()=>{if(d.requestIdleCallback&&d.cancelIdleCallback){let w=d.requestIdleCallback(l,{timeout:4e3});S=()=>d.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);S=()=>clearTimeout(w)}});return()=>(p(),S())},[e,a])}function wo({asked:e,shown:n,onDrawn:a}){return(0,c.useLayoutEffect)(()=>a(e,n),[e,n,a]),null}function vo({auto:e,scene:n}){return(0,h.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${Nt}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var bo=Vt(Ee(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,h.jsx)(e.StudioPlace,{...n}),{quiet:!0});function Mr(e,n,a,s,d){return Bt(e,nr(n?ot(n):d??xn,s),a)}function Ut(e){return e&&ot(e).overview?"graview":"scene"}function Er(e,n){if(n.homeView?.()===void 0)return!1;let a=e.pages?.first?.trim();return a===void 0||a===""||a==="/"||a.toLowerCase()==="home"}function Hr(e){let[,n]=(0,c.useState)(!1),a=(0,c.useCallback)(()=>n(!0),[]),s=(0,c.useRef)(!1);return e.at&&!ft?(0,h.jsx)(jt,{onReady:a,fetch:Kt}):!s.current&&Sr(e.draftView)?(0,h.jsx)(jt,{onReady:a,fetch:_t}):(s.current=!0,(0,h.jsx)(So,{...e}))}function So(e){let{app:n,stop:a,bar:s=!0,standing:d="Everything is in order",principal:l,heading:S=2}=e,{rootRef:p,scope:w,css:R,scheme:O,store:v,presence:E,brand:L,auto:P,height:j}=dr(e),se=Pr(e.draftView),D=ir(e,Zn,se.over),[ee]=(0,c.useState)(Bn),f=e.basePath===void 0?{}:{basePath:e.basePath},[B]=(0,c.useState)(it),U=e.notices??B,Y=y=>xt(y,f),F={...e.routing?{routing:e.routing}:{},...f},[le]=(0,c.useState)(()=>{let y=e.at?.face;if(y)return y;let H=a===void 0&&Er(n,D)?"pages":Ut(a),V=Dt({...F,face:H});return e.face===void 0&&e.onOpening?.(V),V}),[W,x]=(0,c.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&a===void 0&&Xn(F)&&Er(n,D)),Re=(0,c.useRef)(e.onFace);Re.current=e.onFace,(0,c.useLayoutEffect)(()=>{W&&(Re.current?.("pages"),x(!1))},[W]);let k=W?"pages":e.face??le,oe=n.schema.kinds,T=e.routing==="address",Q=(0,c.useMemo)(()=>e.at?ft.settleAt(e,v.seenBy(l??{kind:"human"}),D.places()):void 0,[]),$=(0,c.useMemo)(()=>Mn(D,n.schema),[D,n.schema]),ue=(0,c.useMemo)(()=>{let y=Q?.stop??(T?er(e.basePath):void 0)??a;return k==="scene"&&y===void 0&&$===void 0&&(e.path===void 0||zt(e.path))?Wt(void 0):Mr(k,y,oe,D.places(),$)},[]),[ve]=(0,c.useState)(k);(0,c.useEffect)(()=>{ve!=="pages"&&Ln(D)},[ve,D]);let N=(0,c.useRef)(void 0),q=y=>y===void 0||zt(y)?"/":y;N.current??={path:q(Q?.path??(T?k==="pages"?(Ot(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==N.current.asked&&(N.current={path:q(e.path),asked:e.path});let I=(0,c.useRef)(e.onNavigate);I.current=e.onNavigate;let ae=(0,c.useCallback)((y,H)=>{N.current.path=y,I.current?.(y,H)},[]),{at:M,setAt:Te,steering:K,steer:te}=pr(N.current.path),C=(0,c.useContext)(Vr);C&&(C.pages=()=>N.current.path);let fe=(0,c.useRef)(void 0),pe=(0,c.useCallback)(y=>void(N.current.path=y),[]),de=zn(p),[Z,Ge]=(0,c.useState)(!1),xe=e.pagesBelow!==void 0&&de!==null&&de<e.pagesBelow&&(k==="scene"||k==="graview")&&!Z,A=xe?"pages":k,$e=(0,c.useRef)(!1);$e.current=Z&&e.pagesBelow!==void 0&&de!==null&&de<e.pagesBelow&&(k==="scene"||k==="graview"),C&&(C.shown=A);let ne=(0,c.useRef)(k==="graview"?"graview":"scene");(A==="scene"||A==="graview")&&(ne.current=A),(0,c.useState)(()=>{if(!T||typeof window>"u"||A==="pages"||A==="picture")return;let{pathname:y,search:H,hash:V}=window.location;Ot(y,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${Y(ke)}${H}${V}`)}),sr(p,A,e.onIntrinsicHeight),go(A,de);let ce=mr(e.onError,A),be=hr(e.onReady,A),Ne=(0,c.useRef)(e.onFaceDrawn);Ne.current=e.onFaceDrawn;let He=(0,c.useCallback)((y,H)=>{be(H),Ne.current?.(y)},[be]),[yt,gt]=(0,c.useState)(null),Ue=D.places(),_=(0,c.useRef)({shown:A,onFace:e.onFace});_.current={shown:A,onFace:e.onFace};let re=(0,c.useCallback)((y,H,V)=>{if(T){fe.current?.(y,H,V);return}_.current.onFace?.(y),I.current?.(y==="pages"?H??N.current.path:ke,"push")},[T]),[X,Oe]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{A==="pages"&&Oe(void 0)},[A]);let Se=(0,c.useRef)(a);(0,c.useEffect)(()=>{Se.current!==a&&(Se.current=a,Oe(void 0))},[a]);let Ke=(0,c.useCallback)(y=>{if(_.current.shown==="pages"){if(Ge(!0),Oe(y),k==="scene"||k==="graview"){kr(k,()=>{T?window.history.pushState(null,"",`${Y(ke)}${y??""}`):I.current?.(ke,"push")});return}kr(ne.current,()=>re(ne.current,void 0,y))}},[T,k,e.basePath,re]),Pe=(0,c.useCallback)(y=>{if(_.current.shown==="pages"){K.go.current||(N.current.path=y),te(y);return}if(N.current.path=y,Te(y),$e.current){Ge(!1),T?window.history.pushState(null,"",Y(y)):I.current?.(y,"push");return}re("pages",y)},[K,te,Te,re,T,e.basePath]),Fe=D.arrangement?.(),me=A==="pages",Ve=e.hrefOf,z=Ve??(T?Y:void 0),Ce=(0,c.useMemo)(()=>({open:Pe,...Ve?{href:Ve}:T?{href:y=>xt(y,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[Pe,T,e.basePath,Ve]);return(0,h.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":A,"data-graview-scheme":O,...xe?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:j,minHeight:P?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,h.jsx)("style",{children:R}),(0,h.jsxs)(qn.Provider,{value:ce,children:[(0,h.jsx)(cr,{rootRef:p,board:U}),(0,h.jsx)(ar,{rootRef:p,firstLook:e.firstLook,app:Jn(L??{name:n.name},n.schema)}),(0,h.jsx)(je,{module:"@graview/react",report:ce,content:!0,children:(0,h.jsx)(Dn.Provider,{value:ee,children:(0,h.jsx)(Cn,{store:v,views:D,initialView:ue,scheme:O,...lr(e,E,L),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,h.jsxs)(Gn.Provider,{value:U,children:[(0,h.jsx)(Ao,{face:A,stop:X??a,kinds:oe,places:Ue,opens:$}),C?(0,h.jsx)(Po,{into:C}):null,(0,h.jsx)(ko,{rootRef:p,face:k,shown:A,path:M,stop:a,draft:se.n,onDrawn:e.onDrawn,parts:ee}),T?(0,h.jsx)(tr,{pagesWere:Q?.path,basePath:e.basePath,shown:A,onFace:e.onFace,toggle:fe,kinds:oe,places:Ue,opens:$,landed:pe}):null,s&&A!=="picture"?(0,h.jsx)(je,{module:"@graview/embed",report:ce,children:(0,h.jsx)(ur,{name:L?.name??n.name,heading:S,named:$t(s).name!==!1,faces:$t(s).faces===!1?void 0:{scene:{label:En(Fe),current:!me,go:()=>Ke(),reach:()=>void Me(ne.current)},pages:{label:An(Fe),current:me,go:()=>Pe(N.current.path),reach:()=>void Me("pages")}},at:me?M:null,without:e.pages?.without(),home:{...z?.("/")!==void 0?{href:z("/")}:{},go:()=>Pe("/"),current:me&&M.split("?")[0]==="/"},reach:{...z?{href:z}:{},go:y=>Pe(y.path)},standing:d,hostActions:e.hostActions,keeping:me?void 0:(0,h.jsx)(Ro,{app:n,studio:e.studio,report:ce}),onFind:gt,switch:e.switch})}):null,(0,h.jsx)(Kn.Provider,{value:yt,children:(0,h.jsx)(je,{module:A==="pages"||A==="picture"?"@graview/pages":"@graview/react",report:ce,content:!0,children:(0,h.jsxs)(c.Suspense,{fallback:(0,h.jsx)(vo,{auto:P,scene:A!=="pages"&&A!=="picture"}),children:[A==="picture"?(0,h.jsx)(mo,{scope:w,store:v,views:D,as:(a?ot(a).within?.view:void 0)??""}):A==="pages"?(0,h.jsx)(po,{store:v,views:D,presence:E,auto:P,brand:L,steering:K,overview:Ke,scope:w,titleLevel:fr(S),quickAsk:st(e.quickAsk),props:{...e,onNavigate:ae,...T?{}:{path:N.current.path}}}):(0,h.jsx)(jn.Provider,{value:Ce,children:(0,h.jsx)(uo,{address:T,auto:P,scheme:O,scope:w,quickAsk:st(e.quickAsk)})}),(0,h.jsx)(wo,{asked:k,shown:A,onDrawn:He})]})},A)})]})})})})]})]})}var zt=e=>e.split(/[?#]/)[0]===ke,Vr=(0,c.createContext)(null);function Po({into:e}){return e.view=at().view,null}function ko({rootRef:e,face:n,shown:a,path:s,stop:d,draft:l,onDrawn:S,parts:p}){let{view:w}=at(),R=a==="scene"||a==="graview",O=Lt(w),v={face:n,path:R?ke:a==="picture"?d??"#":s,stop:O};return vr(e,`${a} ${R?O:v.path} ${l}`,v,S,p),null}var ft,Eo=Ee(()=>(__graviewPreload(import.meta.url,["./chunk.353CGK6C.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.CI4DEKPX.js"))),Kt=()=>Eo().then(e=>void(ft=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(a),e()},a=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Kt));function Ao({face:e,stop:n,kinds:a,places:s,opens:d}){let{view:l,go:S}=at(),p=(0,c.useRef)({face:e,stop:n});return(0,c.useLayoutEffect)(()=>{let w=p.current.stop!==n,R=p.current.face!==e,O=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!R||e==="pages"||e==="picture")return;let v=(w||O)&&n!==void 0?Mr(e,n,a,s):O&&rr(l)?Bt(e,Wt(d),a):e==="graview"?Mt(l,!0):l.overview?On(Mt(l,!1),Yn(l,a)):l;S(v)},[e,n,a,l,S,d]),null}function Ro({app:e,studio:n,report:a}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(fo,{})}),n!==!1?(0,h.jsx)(je,{module:"@graview/studio",report:a,children:(0,h.jsx)(To,{app:e,studio:n})}):null]})}function To({app:e,studio:n}){let a={app:e,within:"box",...n?{onApply:n.onApply}:{},...n?.landmark?{landmark:n.landmark}:{},...n?.offered!==void 0?{offered:n.offered}:{}},s=n?.place;return s?(0,h.jsx)(s,{...a}):(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(bo,{...a})})}function xo({path:e,stop:n,...a},s){return{...a,app:s.app,at:s.at,remote:s.remote,...s.remote.presence?{presence:s.remote.presence}:{}}}function Jt(e,n){let a=n.store??n.remote?.store??or(n.app,n.seed),s=n.notices??it(),d=null,l={},S=0,p=n.label,w=n.app,R=Promise.resolve(),O=n.at?.face??n.face,v=O===void 0?void 0:Dt({...n,face:O}),E=v??Ut(n.stop),L=null,P=[],j=f=>{if(L=f,f!==E)return;let B=P;P=[];for(let U of B)U()};function se(){let[f,B]=(0,c.useState)(v),[U,Y]=(0,c.useState)(n.stop),[F,le]=(0,c.useState)(n.path),[W,x]=(0,c.useState)(n.scheme??"auto"),[Re,k]=(0,c.useState)(n.principal),[oe,T]=(0,c.useState)(n.seats),[Q,$]=(0,c.useState)(n.quickAsk),[ue,ve]=(0,c.useState)(n.people),[N,q]=(0,c.useState)(n.hostContext),[I,ae]=(0,c.useState)(n.brand),[M,Te]=(0,c.useState)(n.label),[K,te]=(0,c.useState)(n.hostActions),[C,fe]=(0,c.useState)(void 0),[pe,de]=(0,c.useState)(n.draftView);return d={app:Z=>{fe(Z),le(void 0),Y(void 0)},face:B,stop:Y,path:le,scheme:x,seat:k,seats:T,quickAsk:$,people:ve,hostContext:q,brand:ae,label:Te,hostActions:te,draft:de},(0,h.jsx)(Vr.Provider,{value:l,children:(0,h.jsx)(Hr,{...C?xo(n,C):n,store:a,notices:s,...f!==void 0?{face:f}:{},onOpening:Z=>{E=Z},...U!==void 0?{stop:U}:{},...F!==void 0?{path:F}:{},...Re?{principal:Re}:{},...oe?{seats:oe}:{},...Q!==void 0?{quickAsk:Q}:{},...ue?{people:ue}:{},...N?{hostContext:N}:{},...I?{brand:I}:{},label:M,hostActions:K,draftView:pe,scheme:W,onFace:Z=>{E=Z,B(Z)},onSeat:k,onFaceDrawn:j},C?.n??0)})}let D=()=>{let f=l.view?.focusId,B=f?a.graph.getNode(f)?.kind:void 0,U=(l.shown??E)==="scene"||(l.shown??E)==="graview";return{face:E,path:U?ke:l.pages?.()??n.path??"/",stop:l.view?Lt(l.view):n.stop??"#",...B?{kind:B}:{}}},ee=(0,Ar.createRoot)(e);return(0,G.flushSync)(()=>ee.render((0,h.jsx)(se,{}))),{get store(){return a},where:D,setApp:(f,B,U)=>{let Y="graph"in B?{store:B}:B,F=()=>{let le=D();a=Y.store,p=U?.label??(p===w.name?f.name:p),w=f,(0,G.flushSync)(()=>{d?.label(p),d?.app({app:f,remote:Y,at:le,n:++S})})};ft?F():R=R.then(Kt).then(F)},setFace:f=>{E=f,(0,G.flushSync)(()=>d?.face(f))},setStop:f=>(0,G.flushSync)(()=>d?.stop(f)),setPath:f=>(0,G.flushSync)(()=>{if(zt(f)){(E==="pages"||E==="picture")&&(E="scene",d?.face("scene"));return}d?.path(f),E!=="pages"&&(E="pages",d?.face("pages"))}),setScheme:f=>(0,G.flushSync)(()=>d?.scheme(f)),setSeat:f=>(0,G.flushSync)(()=>d?.seat(f)),setSeats:f=>(0,G.flushSync)(()=>d?.seats(f)),setQuickAsk:f=>(0,G.flushSync)(()=>d?.quickAsk(f)),setPeople:f=>(0,G.flushSync)(()=>d?.people(f)),setHostContext:f=>(0,G.flushSync)(()=>d?.hostContext(f)),setBrand:f=>(0,G.flushSync)(()=>d?.brand(f)),setDraftView:f=>(0,G.flushSync)(()=>d?.draft(f)),setLabel:f=>{p=f,(0,G.flushSync)(()=>d?.label(f))},setHostActions:f=>(0,G.flushSync)(()=>d?.hostActions(f)),drawn:()=>R.then(()=>L===E?void 0:new Promise(f=>P.push(f))),notify:f=>{let B;return(0,G.flushSync)(()=>{B=s.notify(f)}),B},unmount:()=>ee.unmount()}}var pt=e=>`s${(e+1).toString(36)}`;var Dr="/graview/live",Yt="graview.ship",Qt=`${Yt}.${tt}`;var ge={seat:"x-graview-seat",roles:"x-graview-roles",kind:"x-graview-kind",name:"x-graview-name",for:"x-graview-for",forRoles:"x-graview-for-roles",forName:"x-graview-for-name",via:"x-graview-via"};var Be=class extends Error{constructor(n){super(n),this.name="Superseded"}},Ae=e=>e?.lineage?{lineage:e.lineage}:{},Oo=(e,n)=>`${e.calls.map(a=>a.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
2
+ `)[0]??"":String(n)})`;function Fo(e){if(!e)return[];try{let n=e.storage.getItem(e.key);if(n===null)return[];e.storage.removeItem(e.key);let a=JSON.parse(n);return Array.isArray(a)?a.filter(s=>!!s&&Array.isArray(s.calls)):[]}catch{return[]}}var We=class extends Error{constructor(a){super(a.sentence);this.refusal=a;this.name="RemoteRefusedError"}},Co={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},we=class extends Error{constructor(a,s){super(a);this.conflicts=s;this.name="StaleWrite"}},ze=class extends Error{constructor(n){super(n),this.name="Unreached"}},Lo=new Set([502,503,504]);async function Mo(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function Ho(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Vo=1,Do=()=>({refusals:new Set,conflicts:new Set,statuses:new Set,helds:new Set,builds:new Set,who:new Set,declarations:new Set,tally:{reconnects:0,rebases:0,conflicts:0,resyncs:0}});async function mt(e){return(await Br(e,Fo(e.carry),"This app was updated while your changes were on the way.",Do())).remote}async function Br(e,n,a,s){let d=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},S={...ht(e.principal),[ge.via]:e.via??"web"};Object.assign(l,S);let p=e.live===!0,w=e.presenceEveryMs,R=e.visible??$o,O="connecting",v=s.statuses,E=s.tally,L=[],P,j=[],se=()=>O==="online"&&P!==void 0?"held":O,D=()=>{let t=se();if(s.told!==t){s.told=t;for(let r of[...v])r(t)}},ee=t=>{if(!(t===O||ie)&&(O==="offline"&&t==="online"&&E.reconnects++,O=t,D(),t==="online"))for(let r of L.splice(0))r.again()},f=t=>{if(ie)return;let r=typeof t=="string"&&t.length>0?t:void 0,i=r!==P;if(P=r,B(),!!i&&(D(),r===void 0)){for(let o of j.splice(0))o();V&&clearTimeout(V),nn()}},B=()=>{if(s.toldHeld!==P){s.toldHeld=P;for(let t of[...s.helds])t(P??null)}},U=async(t,r)=>{let i;try{i=await d(t,r)}catch(o){throw z()||ee("offline"),new ze(o instanceof Error?o.message:String(o))}if(i.status===503&&await Mo(i))return ee("online"),i;if(Lo.has(i.status))throw z()||ee("offline"),new ze(`The server is away (${i.status})`);return ee("online"),i},Y=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${_e.op}`,i=t?await d(r,{headers:l}):await U(r,{headers:l});if(!i.ok)throw new Error((await i.json().catch(()=>({}))).error??`The server refused (${i.status})`);return await i.json()},F=e.state??await Y(!0);p||(O="online"),P=typeof F.held=="string"&&F.held.length>0?F.held:void 0,B();let le=F.enabledModules??e.enabledModules,W=e.localApp?e.localApp(e.app):e.app,x=new kn({schema:W.schema,mutations:W.mutations??[],invariants:W.invariants??[],...W.policy?{policy:W.policy}:{},...W.publishing?{publishing:W.publishing}:{},...W.modules?{modules:W.modules}:{},...le?{enabledModules:le}:{},...W.intelligence?{intelligence:W.intelligence}:{},...W.brand?.timeZone?{timeZone:W.brand.timeZone}:{},snapshot:F.snapshot,log:F.log,...F.horizon!==void 0?{horizon:F.horizon}:{},ids:Ho(),...e.storeOptions??{}});bn.served.add(x);let Re=Sn(x),k=F.log.at(-1)?.seq??(F.horizon??0)-1,oe=Tt.of(F.log,{horizon:F.horizon??0}),T=null,Q,$=new Map,ue=s.who,ve=!1,N=t=>{if(ie)return;ve=!0;let r=Rn(new Map,t,Date.now(),Ft,T?.participant);Q!==void 0&&r.delete(Q);let i=r.size!==$.size;if(!i)for(let[o,u]of r)Ct(u,$.get(o))||(i=!0);if($=r,!!i)for(let o of[...ue])o([...$.values()])},q=[],I=new Set,ae=t=>{let r=q.indexOf(t);r>=0&&q.splice(r,1)},M=new Map,Te=(t,r)=>{let i=M.get(t);i&&(M.delete(t),i.resolve({ops:r.filter(o=>o.batch===t),batch:t}))},K,te=[],C=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(K)return te.push({ops:t,drop:r}),[];let i=Math.min(...t.filter(g=>g.seq>k).map(g=>g.seq));if(Number.isFinite(i)&&i>k+1)return te.push({ops:t,drop:r}),fe(),[];let o=q.filter(g=>t.some(J=>J.batch===g)),u=[...new Set([...r,...o])].filter(g=>I.has(g)),m,b=q.filter(g=>!o.includes(g));try{m=x.rebase({confirmed:t,pending:b,drop:u}).confirmed}catch(g){if(!(g instanceof Pn))throw g;return te.push({ops:t,drop:r}),fe(),[]}for(let g of o)ae(g);t.some(g=>g.seq>k)&&b.some(g=>!u.includes(g))&&E.rebases++,t.length>0&&(k=Math.max(k,...t.map(g=>g.seq)),oe.note(t));for(let g of u)I.delete(g);for(let g of o)Te(g,t);return m},fe=()=>{K||(K=be(Y().then(t=>{if(pe(t)){te=[];return}let r=new Set(t.log.map(u=>u.batch)),i=q.filter(u=>r.has(u));for(let u of i)ae(u);let o=x.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...q],drop:[...I].filter(u=>!q.includes(u))});I.clear();for(let u of o.pending)I.add(u.batch);k=t.log.at(-1)?.seq??(t.horizon??0)-1,oe=Tt.of(t.log,{horizon:t.horizon??0}),E.resyncs++;for(let u of i)Te(u,t.log)}).then(()=>{K=void 0;let t=te;te=[];for(let{ops:r,drop:i}of t)C(r,i)},()=>{K=void 0,te=[]})))},pe=t=>(typeof t.build=="string"&&on(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===F.version?!1:(bt(t.version),!0)),de=async t=>{let i=await(await U(`${e.url}/graview/since?seq=${pt(t)}&opFormat=${_e.op}`,{headers:l})).json();return pe(i)?[]:i.reset===!0?(fe(),[]):i.ops??[]},Z=async()=>{let t=await Ge();return K&&await K,t},Ge=async()=>{if(T&&!z()&&R()){let r=await(await U(`${e.url}/graview/here`,{method:"POST",headers:l,body:JSON.stringify({presence:T,seq:pt(k)})})).json();return pe(r)?[]:(typeof r.participant=="string"&&(Q=r.participant),N(r.who??[]),C(r.ops??[]))}return C(await de(k))},xe=new Map,A=new Map,$e=new Set,ne=new Map,ce=new Set,be=t=>(ce.add(t),t.finally(()=>ce.delete(t)).catch(()=>{}),t),Ne=Promise.resolve(),He=0,yt=(t,r)=>{let i=Ne.then(()=>Ue(t,r));return Ne=i.catch(()=>{}),i},gt=()=>new Promise((t,r)=>L.push({again:t,give:r})),Ue=async(t,r)=>{let i,o;for(;;){try{i=await U(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:_e.op})})}catch(g){if(!(g instanceof ze)||X)throw g;if(await gt(),z())return Je(t,r);continue}if(o=await i.json().catch(()=>({})),i.status===503&&o.reason==="unavailable"&&typeof o.held=="string"&&!X){if(typeof o.version=="number"?pe(o):(f(o.held),!1))break;if(P!==void 0&&(Et>0||p)){if(await new Promise(g=>j.push(g)),X)throw new Be("The client closed.");if(z())return Je(t,r);continue}}let b;if(i.status===503&&o.reason==="unavailable"&&!X)b=Zt(e.backoff,He++);else{if(He=0,i.status!==429||X)break;b=Bo(i.headers.get("retry-after"),o.retryAfter)}if(await new Promise(g=>setTimeout(g,b)),z())return Je(t,r)}if(ie||pe(o))throw new Be("The app was changed.");if(!i.ok){let b=o.error??`The server refused (${i.status})`;throw o.conflict?new we(b,o.conflicts??[]):new We({reason:o.reason??Co[i.status]??"invalid",sentence:b,...o.wouldNeed?.length?{wouldNeed:o.wouldNeed}:{}})}let u=o.ops??[],m=u[0]?.seq;return m!==void 0&&m>k+1&&(u=await de(k)),r!==void 0&&(o.batch&&xe.set(r,o.batch),ae(r)),C(u,r!==void 0?[r]:[]),{ops:o.ops??[],...o.batch?{batch:o.batch}:{}}},_,re=!1,X=!1,Oe=0,Se,Ke=0,Pe=0,Fe=null,me=()=>{},Ve=new Promise(t=>{me=t}),z=()=>p&&re&&_?.readyState===Vo,Ce=t=>{if(!z())return!1;try{return _.send(JSON.stringify(t)),!0}catch{return!1}},y=(t=!1)=>{!T||!z()||!R()||!t&&Fe&&Ct(T,Fe)&&(w===void 0||Date.now()-Pe<w)||Ce({t:"here",presence:T})&&(Fe=T,Pe=Date.now())},H=new Set,V,nn=()=>{if(V=void 0,P!==void 0)return;let t=[...M.entries()].filter(([r])=>H.has(r));H.clear();for(let[,r]of t)Ce(r.message)},rn=(t,r)=>{M.has(t)&&(H.add(t),V&&clearTimeout(V),V=setTimeout(nn,Math.max(0,r)))},Nr=t=>{M.has(t)&&H.add(t)},Je=(t,r)=>new Promise((i,o)=>{let u=r??`send-${++Ke}`,m=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...Ae(t)}:{t:"call",cid:u,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...Ae(t)};if(M.set(u,{message:m,...r!==void 0?{mine:r}:{},resolve:i,reject:o}),H.size>0||P!==void 0){H.add(u);return}Ce(m)}),Ye=(t,r)=>z()?Je(t,r):yt(t,r),Ir=t=>{switch(t.t){case"welcome":{if(on(t.build),typeof t.version=="number"&&t.version!==F.version){bt(t.version);return}if(re=!0,Oe=0,typeof t.participant=="string"&&(Q=t.participant),f(t.held),t.state?fe():C(t.ops??[]),H.clear(),V&&clearTimeout(V),V=void 0,P!==void 0)for(let r of M.keys())H.add(r);else for(let r of M.values())Ce(r.message);y(!0),ee("online"),me();return}case"ops":C(t.ops??[]);return;case"ack":{let r=M.get(t.cid);if(!r){C(t.ops??[]);return}M.delete(t.cid),He=0,r.mine!==void 0&&(xe.set(r.mine,t.batch),ae(r.mine)),C(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=M.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){P!==void 0?Nr(t.cid):rn(t.cid,Zt(e.backoff,He++));return}M.delete(t.cid),r.reject(t.t==="conflict"?new we(t.sentence,t.conflicts??[]):new We({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&rn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":N(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==F.version&&bt(t.version);return;case"reload":cn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&_){let r=_;un(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},ie=!1,wt=s.declarations,vt=s.builds,on=t=>{if(!(ie||s.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){s.otherBuild=t;for(let r of[...vt])r(t)}},an=()=>{let t=[],r=0;for(let i of q){let o=ne.get(i);o?t.push({calls:o.calls,...o.intent?{intent:o.intent}:{},...o.via?{via:o.via}:{},...Ae(o),batch:i}):r++}return{carried:t,undos:r}},sn=(t,r)=>`${r} while ${t===1?"an undo of yours was":"undos of yours were"} on the way; ${t===1?"it was":"they were"} not made.`,dn=t=>{ie=!0,T=null;let r=new Be(t);for(let o of M.values())o.reject(r);M.clear(),Xe&&clearInterval(Xe),X=!0,Se&&clearTimeout(Se),V&&clearTimeout(V),he&&clearTimeout(he);for(let o of L.splice(0))o.give(r);for(let o of j.splice(0))o();let i=_;_=void 0,re=!1;try{i?.close(1e3,t)}catch{}me()};async function bt(t){if(ie)return;if(!e.resolveApp){cn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:i}=an(),o=e.resolveApp,u=T;dn("The app was changed.");try{let m=await o(t),{state:b,...g}=e,J=await Br({...g,app:m},r,"The app was changed while your changes were on the way.",s);u&&J.remote.presence.here(u);for(let et of[...wt])et(J.remote,t);let Jr=[...i>0?[Qe(sn(i,"The app was changed"))]:[],...J.unheard()];for(let et of Jr)for(let Yr of De)Yr(et.sentence,et)}catch(m){let b=`The app was changed, but the new version could not be opened: ${m instanceof Error?m.message:String(m)}`;for(let g of De)g(b,Qe(b))}}function cn(t){if(ie)return;let{carried:r,undos:i}=an();dn(t);let o=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),o=!0}catch{}let u=[];!o&&r.length>0&&u.push(`${t} ${r.length===1?"A change of yours was":`${r.length} changes of yours were`} not sent; make ${r.length===1?"it":"them"} again after the page reloads.`),i>0&&u.push(sn(i,"This app was updated"));for(let m of u)for(let b of De)b(m,Qe(m));(e.reloadPage??Wo)()}let ln=()=>{if(X||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${Dr}`,{"content-type":r,...i}=l,o;try{o=e.socket?e.socket(t,i,[Qt]):Kr(t,i)}catch{return fn()}_=o,re=!1,o.onopen=()=>{_===o&&o.send(JSON.stringify({t:"hello",seq:pt(k),protocol:tt,wire:Yt,opFormat:_e.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},o.onmessage=u=>{if(_!==o)return;let m;try{m=JSON.parse(String(u.data))}catch{return}Ir(m)},o.onclose=()=>un(o),o.onerror=()=>{}},he,_r=()=>{ve=!1,he&&clearTimeout(he),he=setTimeout(()=>{if(he=void 0,ve||X)return;let t=new Map([...$].filter(([,r])=>r.held!=="socket"));if(t.size!==$.size){$=t;for(let r of ue)r([...$.values()])}},Ft),he.unref?.()};function un(t){if(_!==t)return;let r=re;_=void 0,re=!1,Fe=null,r&&(ee("offline"),_r()),fn()}let fn=()=>{if(X)return;let t=Zt(e.backoff,Oe);Oe++,Se=setTimeout(ln,t)},pn=x.applyAll.bind(x),jr=x.undo.bind(x),qr=x.previewAll.bind(x);x.previewAll=(t,r)=>qr(t,{...e.principal?{author:e.principal}:{},...r});let De=s.refusals,Ie=[],Qe=t=>({reason:"invalid",sentence:t}),Ze=s.conflicts,St=!1,mn,Pt=async(t,r)=>{if(r instanceof Be||ie)return;let i=r instanceof We?r.refusal:wn(r),o=i.sentence,u=r instanceof we?mn?.yoursOf(x,ne.get(t)?.calls??[]):void 0;ae(t);try{C([],[t])}catch{}let m=ne.get(t);if(ne.delete(t),r instanceof we&&E.conflicts++,r instanceof we&&!z()&&await Z().catch(()=>[]),r instanceof we&&K&&await K,r instanceof we&&Ze.size>0){let b=!1,g={sentence:o,conflicts:u?r.conflicts.map(J=>J.node===u.node&&J.field===u.field?{...J,yours:u.yours}:J):r.conflicts,keepTheirs(){b=!0},useMine(){if(!(b||!m)){b=!0,St=!0;try{x.applyAll(u?[u.over(k)]:m.calls,{...m.intent?{intent:m.intent}:{},...m.via?{via:m.via}:{},...Ae(m)})}finally{St=!1}}}};for(let J of Ze)J(g);return}for(let b of De)b(o,i)},zr=(t,r)=>t.flatMap(i=>i.mutation?.name===gn?[]:i.primitives.flatMap(o=>o.op==="splice-text"&&!r.has(o.id)&&!r.has(`${o.id}\0${o.field}`)?[{node:o.id,field:o.field,rev:k}]:[]));x.applyAll=(t,r)=>{let i=vn(x.log.all().filter(b=>I.has(b.batch))),o=pn(t,{...e.principal?{author:e.principal}:{},...r}),u=t.map((b,g)=>{let J=o.minted?.[g];return J===void 0||b.args?.id!==void 0?b:{...b,mintedHint:J}});q.push(o.batch),I.add(o.batch),ne.set(o.batch,{calls:u,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...Ae(r)});let m=St?[]:[...oe.baseFor(o.ops,i,(b,g)=>x.collaborative(b,g)),...zr(o.ops,i)];return A.set(o.batch,be(Ye({calls:u,...r?.intent?{intent:r.intent}:{},batch:o.batch,...m.length>0?{base:m}:{},...r?.via?{via:r.via}:{},...Ae(r)},o.batch).catch(b=>Pt(o.batch,b)))),o},x.apply=(t,r)=>x.applyAll([t],r),x.undo=(t,r)=>{let i=typeof t=="string"?[t]:t,o=jr(i.map(m=>xe.get(m)??m),{...e.principal?{author:e.principal}:{},...r});q.push(o.batch),I.add(o.batch);let u=Promise.allSettled(i.map(m=>A.get(m)));return A.set(o.batch,be(u.then(()=>{let m=i.filter(b=>!$e.has(b));if(m.length===0){ae(o.batch),ne.delete(o.batch),C([],[o.batch]);return}return Ye({undo:m.map(b=>xe.get(b)??b),...r?.intent?{intent:r.intent}:{},batch:o.batch,...r?.via?{via:r.via}:{},...Ae(r)},o.batch)}).catch(m=>Pt(o.batch,m)))),o};let Gr=async(t,r={})=>{kt++;try{return(await be(Ye({calls:t,...r}))).ops}finally{kt--}},kt=0,hn={here(t){T=t,y()},onWho(t){return ue.add(t),$.size>0&&t([...$.values()]),()=>{ue.delete(t)}},leave(){if(!T)return;let t=JSON.stringify({participant:Q??T.participant});if(T=null,Ce({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):d(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},Et=e.pollMs??800,Xe=Et>0&&typeof setInterval=="function"?setInterval(()=>{z()||Z().catch(()=>{})},Et):null;if(p){ln();let t;await Promise.race([Ve,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!ie){let t=[],r=new Set(x.log.all().map(i=>i.batch));for(let i of n)if(!(i.batch!==void 0&&r.has(i.batch)))try{x.applyAll(i.calls,{...i.intent?{intent:i.intent}:{},...i.batch?{batch:i.batch}:{},...i.via?{via:i.via}:{},...Ae(i)})}catch(o){t.push(Oo(i,o))}t.length>0&&Ie.push(Qe(`${a} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let yn=new Map,Ur=()=>({store:x,author:e.principal,appliedAll:pn,pending:q,provisional:I,asked:ne,answers:A,letGo:$e,sent:(t,r)=>be(Ye({calls:r,batch:t},t).catch(i=>Pt(t,i))),settle:ae,land:C,seen:()=>k,gone:()=>X||ie});return{remote:{store:x,typing(t,r){let i=`${t}\0${r}`,o=yn.get(i);return o||(o=(__graviewPreload(import.meta.url,["./chunk.XWXYC3BJ.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.DQNN5FE5.js")).then(u=>(mn=u,u.typingOf(t,r,u.wireOf(Ur())))),yn.set(i,o)),o},version:F.version,migrated:F.migrated??[],send:Gr,pull:Z,onRefusal(t){De.add(t);let r=Ie;Ie=[];for(let i of r)t(i.sentence,i);return()=>De.delete(t)},onDeclaration(t){return wt.add(t),()=>wt.delete(t)},onBuild(t){return vt.add(t),s.otherBuild!==void 0&&t(s.otherBuild),()=>vt.delete(t)},onConflict(t){return Ze.add(t),()=>Ze.delete(t)},revision:(t,r)=>oe.of(t,r),seq:()=>k,participant:()=>Q,transport:()=>z()?"socket":"poll",status:se,onStatus(t){return v.add(t),()=>v.delete(t)},held:()=>P,onHeld(t){return s.helds.add(t),P!==void 0&&t(P),()=>s.helds.delete(t)},counters:()=>({...E}),who:()=>[...$.values()],pending:()=>q.length+kt,async settled(){for(;ce.size>0;)await Promise.allSettled([...ce])},presence:hn,close(){Xe&&clearInterval(Xe),Re(),hn.leave(),X=!0,Se&&clearTimeout(Se),V&&clearTimeout(V),he&&clearTimeout(he);for(let r of L.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of j.splice(0))r();let t=_;_=void 0,re=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Ie;return Ie=[],t}};function Kr(t,r){let i=globalThis.WebSocket;if(!i)throw new Error("This runtime has no WebSocket; the client polls instead.");let o=typeof globalThis.document<"u",u=e.subprotocol?[Qt]:[];if(!o)try{return new i(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let m=new URL(t);for(let[b,g]of Object.entries(S))m.searchParams.set(b,g);return u.length>0?new i(m.toString(),u):new i(m.toString())}}function Bo(e,n,a=Date.now()){let s,d=e?.trim();if(d)if(/^\d+(\.\d+)?$/.test(d))s=Number(d)*1e3;else{let p=Date.parse(d);Number.isFinite(p)&&(s=Math.max(0,p-a))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,S=l!==void 0&&l<50&&s!==void 0&&Math.abs(l*1e3-s)<1e3;return l!==void 0&&!S?l:s??1e3}function Wo(){globalThis.location?.reload?.()}function $o(){return globalThis.document?.visibilityState!=="hidden"}function Zt(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:a=250,max:s=1e4,factor:d=2}=e??{};return Math.min(s,a*d**n)*(.75+Math.random()*.5)}function ht(e){let n={};if(!e)return n;e.id&&(n[ge.seat]=e.id),e.roles?.length&&(n[ge.roles]=e.roles.join(",")),e.kind!=="human"&&(n[ge.kind]=e.kind),e.name&&(n[ge.name]=encodeURIComponent(e.name));let a=e.onBehalfOf;return a?.id&&(n[ge.for]=a.id),a?.roles?.length&&(n[ge.forRoles]=a.roles.join(",")),a?.name&&(n[ge.forName]=encodeURIComponent(a.name)),n}var Wr="/graview/views";function Xt(e){let n=e.fetch??fetch,a=e.url.replace(/\/$/,""),s={"content-type":"application/json",...e.principal?ht(e.principal):{},...e.headers??{}},d=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??nt.may}:nt,l=new Set,S=v=>{if(JSON.stringify(v)!==JSON.stringify(d)){d=v;for(let E of l)E()}},p=async(v,E)=>{let L=await n(`${a}${e.path??Wr}`,{method:v,headers:s,...E!==void 0?{body:JSON.stringify(E)}:{}}),P=await L.json();if(!L.ok)throw new Error(P.error??`The store answered ${L.status}.`);S({hidden:P.hidden??[],removed:P.removed??[],may:P.may??nt.may})},w=()=>p("GET"),R=e.state?Promise.resolve():w().catch(()=>{}),O=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:R,refresh:w,close:()=>clearInterval(O),current:()=>d,onChange(v){return l.add(v),()=>void l.delete(v)},hide:v=>p("POST",{hide:v}),show:v=>p("POST",{show:v}),remove:(v,E)=>p("POST",{remove:v,...E?{about:E}:{}}),async restore(v){let E=d.removed.find(L=>L.name===v)?.lens;await p("POST",{restore:v}),E&&await e.onDeclaration?.()},async lens(v){await p("POST",{lens:v}),await e.onDeclaration?.()}}}var tn=document.getElementById("graview-app"),en=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),$r=en?(__graviewPreload(import.meta.url,["./chunk.B7LBG4UP.js","./chunk.7G4M2PX3.js","./chunk.UGFDSE37.js","./chunk.NNUUD26E.js","./chunk.OJ64WTLW.js","./chunk.GMAXA5GV.js","./chunk.IBJBCZKG.js","./chunk.NQ26KMSQ.js","./chunk.GJQF7I22.js","./chunk.SPU3BVAO.js","./chunk.OPCBZNKF.js","./chunk.UK5F3S2N.js","./chunk.2VJ52LGS.js","./chunk.JI2UVZUU.js","./chunk.CTOBNZLM.js","./chunk.34HGT7HQ.js","./chunk.TNL2BVCH.js","./chunk.NZDHXREL.js","./chunk.TBSPEO2L.js","./chunk.5ON3JSAK.js","./chunk.3SBTQ66X.js","./chunk.SSAY4ITS.js","./chunk.XOZU4OFA.js","./chunk.Z7N3MJ36.js","./chunk.MB7LKKUD.js","./chunk.WQLAIEWJ.js","./chunk.KK46XLGU.js","./chunk.WVUJXDXZ.js","./chunk.GLTWLQ6L.js","./chunk.ACB4TD4W.js","./chunk.XCQ7ZPR5.js","./chunk.MY5OXSS7.js","./chunk.NVRK6A7T.js","./chunk.FKJ3HIA5.js","./chunk.GZHZLJBF.js","./chunk.OW72XZF4.js","./chunk.OJGHDWI6.js","./chunk.KRODTMGR.js","./chunk.VICCAWAN.js","./chunk.OU5TRY4N.js","./chunk.CQPNDJAC.js","./chunk.GYTVL6GR.js","./chunk.TMYGLXR6.js","./chunk.SDO3U72B.js","./chunk.P4CLT32V.js","./chunk.SLBWPVIY.js","./chunk.AJZBJBMO.js"]),import("./chunk.APFRPN5S.js")):Me("pages");try{en?await No(decodeURIComponent(en[1])):await Io()}catch(e){let n=document.createElement("pre");n.setAttribute("role","alert"),n.style.cssText="margin:2rem;font:14px/1.5 ui-monospace,monospace;white-space:pre-wrap",n.textContent=e instanceof Error?e.message:String(e),tn.replaceChildren(n),window.__graviewFailed=n.textContent}async function No(e){let n=await fetch(`/graview/document?form=${encodeURIComponent(e)}`),a=await n.json();if(!n.ok)throw new Error(a.error??`The preview server did not hand over the form (${n.status}).`);let s=await dt(a);if(!s.ok)throw new Error(rt(s.findings));let d=s.app,l=a.principal,S=await mt({app:d,url:location.origin,principal:l,...a.state?{state:a.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=d.forms?.[e]?.title??d.name;let{mount:p}=await $r;window.__graview=p(tn,{app:d,form:e,principal:l,remote:S,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Io(){let e=await fetch("/graview/document");if(!e.ok)throw new Error(`The preview server did not hand over the document (${e.status}).`);let n=await e.json(),s=await(async w=>{if(typeof w.module=="string")return(await import(w.module)).app;let R=await dt(w);if(!R.ok)throw new Error(rt(R.findings));return R.app})(n);if(!s||typeof s!="object"||!("schema"in s))throw new Error("The app module the preview server handed does not export an app.");let d=n.principal,l=await mt({app:s,url:location.origin,principal:d,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=s.name;let S,p=Xt({url:location.origin,principal:d,...n.views?{state:n.views}:{},onDeclaration:async()=>{let w=await(await fetch("/graview/document")).json();if(typeof w.module=="string")return;let R=await dt(w);R.ok&&S?.setApp(R.app,l)}});await Promise.all([$r,p.ready]),S=Jt(tn,{app:s,remote:l,principal:d,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:s.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=S,S.drawn().then(()=>{window.__graviewReady=!0})}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "graview",
3
- "version": "0.1.49",
3
+ "version": "0.1.51",
4
4
  "type": "module",
5
5
  "description": "The Graview command line: start a product, check its declaration, write its agent docs, serve its store, preview a document with no product and photograph its places, say whether a product is on one release, host it for an agent over MCP, apply an act to it, sync its seed, install the authoring skills. The tool; @graview/* is the framework.",
6
6
  "keywords": [
@@ -29,11 +29,11 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@graview/core": "0.1.49",
33
- "@graview/ship": "0.1.49",
34
- "@graview/skills": "0.1.49",
35
- "@graview/tools": "0.1.49",
36
- "@graview/guest": "0.1.49"
32
+ "@graview/core": "0.1.51",
33
+ "@graview/ship": "0.1.51",
34
+ "@graview/skills": "0.1.51",
35
+ "@graview/guest": "0.1.51",
36
+ "@graview/tools": "0.1.51"
37
37
  },
38
38
  "engines": {
39
39
  "node": ">=22"
@@ -1 +0,0 @@
1
- var t="\0graview:unset",u=e=>e===void 0||e===t;function d(e){if(e.op!=="patch-node")return e;let r=n=>Object.fromEntries(Object.entries(n).map(([f,o])=>[f,o===void 0?t:o]));return{...e,before:r(e.before),after:r(e.after)}}function a(e){switch(e.op){case"add-node":return{op:"remove-node",node:e.node};case"remove-node":return{op:"add-node",node:e.node};case"patch-node":return{op:"patch-node",id:e.id,before:e.after,after:e.before};case"add-edge":return{op:"remove-edge",edge:e.edge};case"remove-edge":return{op:"add-edge",edge:e.edge}}}function p(e){switch(e.op){case"add-node":case"remove-node":return[e.node.id];case"patch-node":return[e.id];case"add-edge":case"remove-edge":return[e.edge.from,e.edge.to]}}var i=new WeakMap;function s(e){return[...e].reverse().map(d).map(a)}function l(e){if(e.inverse)return e.inverse;let r=i.get(e);return r||i.set(e,r=s(e.primitives)),r}function c(e,r){if(e.length!==r.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==r[n]&&JSON.stringify(e[n])!==JSON.stringify(r[n]))return!1;return!0}function m(e){if(e.inverse===void 0||!c(e.inverse,s(e.primitives)))return e;let{inverse:r,...n}=e;return n}export{t as a,u as b,d as c,a as d,p as e,l as f,m as g};
@@ -1 +0,0 @@
1
- import{G as h}from"./chunk.TM6JVVGW.js";import{_c as u,lc as a,xc as m}from"./chunk.PFEKS3KO.js";import{b as l}from"./chunk.AJZBJBMO.js";function f(e){let t=[e?.typography?.body,e?.typography?.display,e?.typography?.mono],o=[];for(let i of t){let n=i?.split(",")[0]?.trim().replace(/^["']|["']$/g,"");!n||m(n)||n.toLowerCase()!==a.toLowerCase()&&(o.includes(n)||o.push(n))}return o}function p(e){let t=f(e);return t.length===0?null:`https://fonts.googleapis.com/css2?${t.map(i=>`family=${encodeURIComponent(i).replace(/%20/g,"+")}:wght@400;500;600;700`).join("&")}&display=swap`}var r=l(h(),1);function k(e,t){return new u({schema:e.schema,mutations:e.mutations??[],invariants:e.invariants??[],...t?{snapshot:t}:{},...e.policy?{policy:e.policy}:{},...e.intelligence?{intelligence:e.intelligence}:{},...e.brand?.timeZone?{timeZone:e.brand.timeZone}:{}})}function d(e){if(typeof document>"u")return e==="dark"?"dark":"light";let t=document.documentElement.dataset.theme;return t==="dark"||t==="light"?t:e==="dark"||e==="light"?e:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function v(e,t){let[o,i]=(0,r.useState)(()=>d(t));return(0,r.useEffect)(()=>{if(!e||typeof document>"u")return;let n=()=>i(d(t));n();let s=new MutationObserver(n);s.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]});let c=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):null;return c?.addEventListener?.("change",n),()=>{s.disconnect(),c?.removeEventListener?.("change",n)}},[e,t]),o}export{p as a,k as b,v as c};
@@ -1 +0,0 @@
1
- import{G as l,N as p,U as k,W as y,c}from"./chunk.7MJGZHTS.js";import"./chunk.BJR6E2CT.js";import"./chunk.VSWEKNKS.js";import"./chunk.UGFDSE37.js";import{b as m}from"./chunk.SGJSJGSR.js";import"./chunk.2OXXGN7C.js";import"./chunk.Q4KNNJFL.js";import"./chunk.BH365UJ5.js";import"./chunk.6EHE26ZS.js";import"./chunk.N2S3TMBC.js";import"./chunk.7JW5SHRR.js";import"./chunk.4SEY7VWZ.js";import"./chunk.IVHPJUFM.js";import"./chunk.D53IGR45.js";import"./chunk.MJ4XTNTL.js";import"./chunk.AP22NNIM.js";import"./chunk.SPZVEQC5.js";import"./chunk.FNK2ZZ5E.js";import"./chunk.RSR2M7ZO.js";import"./chunk.EM5CGFNB.js";import"./chunk.N2S45SSL.js";import"./chunk.AGVFW6WC.js";import"./chunk.SIVMZNHZ.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.NQDGUIUQ.js";import"./chunk.DTRNDSMS.js";import"./chunk.3EW6L5DY.js";import"./chunk.AVDXG57A.js";import"./chunk.LD6S2FL5.js";import"./chunk.TABIRLQS.js";import"./chunk.GZHZLJBF.js";import"./chunk.FOYVTN5B.js";import"./chunk.OJGHDWI6.js";import"./chunk.OTF3NNTI.js";import"./chunk.A7HMVWMG.js";import"./chunk.GRLPNTUW.js";import"./chunk.EJAVIZ7Y.js";import"./chunk.423SZS7C.js";import{$ as g,G as S,H as s,I as d,R as f}from"./chunk.TM6JVVGW.js";import"./chunk.SDO3U72B.js";import"./chunk.PFEKS3KO.js";import"./chunk.2AZTW66C.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
@@ -1 +0,0 @@
1
- import{d as k,e as x,f as H}from"./chunk.W6CGAPNQ.js";import{b as A}from"./chunk.7C4IR4S7.js";import"./chunk.D53IGR45.js";import{d as E}from"./chunk.AP22NNIM.js";import"./chunk.FNK2ZZ5E.js";import{a as b}from"./chunk.UT6642FC.js";import"./chunk.TI4OSTQV.js";import"./chunk.A7HMVWMG.js";import"./chunk.GRLPNTUW.js";import"./chunk.EJAVIZ7Y.js";import{m as S}from"./chunk.423SZS7C.js";import{G as L,Oa as v,R as h,Sa as w,_ as p,aa as f}from"./chunk.TM6JVVGW.js";import"./chunk.SDO3U72B.js";import{Xa as m}from"./chunk.PFEKS3KO.js";import"./chunk.2AZTW66C.js";import{b as g}from"./chunk.AJZBJBMO.js";var l=g(L(),1);var e=g(h(),1);function I(){let{store:t,principal:r}=p(),a=f(),i=(0,l.useMemo)(()=>k(t,r),[t,r,a]),n=w("suggested");return i.length===0?null:(0,e.jsxs)("div",{style:{position:"relative"},children:[(0,e.jsxs)("button",{type:"button","data-testid":"suggested-button",...n.trigger,onClick:n.toggle,title:"What tidying suggests, waiting for you",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:30,padding:"0 8px",borderRadius:8,border:"1px solid transparent",background:"transparent",boxShadow:"none",fontSize:"0.875rem",whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:[i.length,(0,e.jsxs)("svg",{className:"graview-activity-mark",width:"15",height:"15",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",style:{display:"var(--graview-activity-mark, none)"},children:[(0,e.jsx)("path",{d:"M3 4.5 H13 M3 8 H10 M3 11.5 H8",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"}),(0,e.jsx)("circle",{cx:"12.25",cy:"11.5",r:"1.6",fill:"none",stroke:"currentColor",strokeWidth:"1.3"})]}),(0,e.jsx)("span",{className:"graview-activity-word",children:" Suggested"})]}),n.open?(0,e.jsxs)("section",{...n.pane,"aria-label":"Suggested","data-testid":"suggested","data-graview-offstage":"",style:{...v,width:320,maxHeight:"min(52cqh, 460px)",overflow:"auto",display:"flex",flexDirection:"column",gap:9,padding:12,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[(0,e.jsx)("h2",{style:{...S,margin:0},children:"Suggested"}),(0,e.jsx)("p",{style:{margin:0,fontSize:"0.75rem",lineHeight:1.45,color:"var(--graview-ink-faint)"},children:"Not made yet: each waits for you."}),(0,e.jsx)("ol",{"data-testid":"suggestions",style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:10,fontSize:"0.8125rem"},children:i.map(s=>(0,e.jsx)(O,{suggestion:s,...i.length===1?{settled:()=>{n.setOpen(!1),document.querySelector('[data-testid="activity-button"]')?.focus()}}:{}},s.id))})]}):null]})}function O({suggestion:t,settled:r}){let{store:a,principal:i,seats:n,people:s}=p(),[c,u]=(0,l.useState)(null),T=m(t.author,{graph:a.graph,schema:a.schema,seats:n,people:s}),y=o=>{u(null);try{o==="accept"?x(a,t.id,{author:i}):H(a,t.id,{author:i}),r?.()}catch(d){u(d instanceof Error?d.message:String(d))}};return(0,e.jsxs)("li",{"data-testid":"suggestion","data-suggestion":t.id,style:{display:"grid",gap:5,lineHeight:1.45},children:[(0,e.jsxs)("span",{children:[(0,e.jsx)("strong",{style:{fontWeight:600},children:T})," ",(0,e.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," ",t.intent]}),t.lineage?(0,e.jsx)("span",{"data-graview-lineage":"",style:{color:"var(--graview-ink-faint)"},children:b(t.lineage)}):null,t.about.length>0?(0,e.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:t.about.slice(0,4).map(o=>(0,e.jsx)(E,{label:A(a,o),pickId:o},o))}):null,(0,e.jsxs)("div",{style:{display:"flex",gap:6},children:[(0,e.jsx)("button",{type:"button","data-testid":"suggestion-accept",onClick:()=>y("accept"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Accept"}),(0,e.jsx)("button",{type:"button","data-testid":"suggestion-decline",onClick:()=>y("decline"),style:{minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},children:"Decline"})]}),c?(0,e.jsx)("span",{"data-testid":"suggestion-refused",role:"alert",style:{fontSize:"0.75rem",color:"var(--graview-warn)"},children:c}):null]})}export{I as SuggestedTray};
@@ -1 +0,0 @@
1
- import"./chunk.4HUB3N7I.js";import"./chunk.NB6WN4DO.js";import"./chunk.SR2345SW.js";import{a as L,b as R,c as E}from"./chunk.UTRIPGW6.js";import{b as T}from"./chunk.ERWBI2NK.js";import"./chunk.2OXXGN7C.js";import"./chunk.Q4KNNJFL.js";import"./chunk.WQN7EFW3.js";import"./chunk.BH365UJ5.js";import"./chunk.6EHE26ZS.js";import"./chunk.N2S3TMBC.js";import"./chunk.7JW5SHRR.js";import"./chunk.HJCQ6I3S.js";import"./chunk.DFGXNFFE.js";import"./chunk.XN7PIWVC.js";import"./chunk.FIS27KW4.js";import"./chunk.EYSQPXVE.js";import"./chunk.W6CGAPNQ.js";import"./chunk.7C4IR4S7.js";import"./chunk.D53IGR45.js";import"./chunk.MJ4XTNTL.js";import"./chunk.AP22NNIM.js";import"./chunk.SPZVEQC5.js";import"./chunk.FNK2ZZ5E.js";import"./chunk.RSR2M7ZO.js";import"./chunk.EM5CGFNB.js";import"./chunk.N2S45SSL.js";import"./chunk.AGVFW6WC.js";import"./chunk.SIVMZNHZ.js";import"./chunk.NQ7SRWXA.js";import"./chunk.AOEXSQDG.js";import"./chunk.3NEALGMI.js";import"./chunk.UT6642FC.js";import"./chunk.PBCT33FF.js";import"./chunk.XOZU4OFA.js";import"./chunk.35FUGOSG.js";import"./chunk.TI4OSTQV.js";import"./chunk.D4K23FUB.js";import"./chunk.WVUJXDXZ.js";import"./chunk.NQDGUIUQ.js";import"./chunk.DTRNDSMS.js";import"./chunk.3EW6L5DY.js";import"./chunk.AVDXG57A.js";import"./chunk.LD6S2FL5.js";import"./chunk.TABIRLQS.js";import"./chunk.GZHZLJBF.js";import{r as C}from"./chunk.FOYVTN5B.js";import"./chunk.OJGHDWI6.js";import"./chunk.OTF3NNTI.js";import"./chunk.A7HMVWMG.js";import"./chunk.GRLPNTUW.js";import"./chunk.EJAVIZ7Y.js";import"./chunk.423SZS7C.js";import{G as S,I as $,R as p,_ as x,aa as A}from"./chunk.TM6JVVGW.js";import"./chunk.SDO3U72B.js";import{Hc as k,ca as h}from"./chunk.PFEKS3KO.js";import"./chunk.2AZTW66C.js";import{b as i}from"./chunk.AJZBJBMO.js";var r=i(S(),1);var l=i(S(),1);var g=i(p(),1);var m={font:"inherit",fontSize:"0.875rem",minHeight:24,padding:0,border:0,borderRadius:2,background:"transparent",boxShadow:"none",color:"var(--graview-accent)",textDecoration:"underline",textUnderlineOffset:3,textAlign:"start",cursor:"pointer"};var e=i(p(),1);function Y({page:n=!1,go:D,onPick:y,onDiscard:M}){let{store:d,seatTalk:c}=x(),u=$(c),N=E(),b=D??N,{keep:P}=L(b),[H,f]=(0,r.useState)(!1);A();let t=u.draft;(0,r.useEffect)(()=>f(!1),[t]),(0,r.useEffect)(()=>{n||R(!1)},[n]);let v=(0,r.useRef)(null),w=t!==null&&!n;if((0,r.useLayoutEffect)(()=>{let s=v.current;if(!w||!s?.parentElement)return;let o=[];for(let a=s.previousElementSibling;a;a=a.previousElementSibling)a instanceof HTMLElement&&!a.inert&&a.tagName!=="STYLE"&&(a.inert=!0,o.push(a));return()=>{for(let a of o)a.inert=!1}},[w]),!t)return null;let G=T(t.drawn),F=d.schema.tryDefinition(t.kind),q=d.graph.nodesOfKind(t.kind).filter(s=>h(F,s)),z=()=>{c.setDraft(null),M?.()};return(0,e.jsxs)("section",{ref:v,"data-testid":"draft-frame","data-graview-draft-frame":n?"page":"scene","aria-label":`Draft: ${t.title}`,style:n?{display:"grid",gap:12,minWidth:0}:{position:"absolute",inset:12,zIndex:k("rail"),display:"grid",gridTemplateRows:"auto auto minmax(0, 1fr)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:12,boxShadow:"var(--graview-lift-high)",overflow:"hidden",minHeight:0},children:[(0,e.jsxs)("p",{"data-testid":"draft-line",style:{...K,...n?{}:{padding:"10px 16px"}},children:[n?(0,e.jsx)("span",{children:"Draft"}):(0,e.jsxs)("span",{children:["Draft \u2014 ",(0,e.jsx)("span",{"data-testid":"draft-title",style:{color:"var(--graview-ink)",fontWeight:600},children:t.title})]}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-keep",disabled:H,title:`Keep \u201C${t.title}\u201D as a lens: a place of its own`,onClick:()=>{f(!0),P(t).finally(()=>f(!1))},style:m,children:"Keep as a lens"}),(0,e.jsx)("span",{"aria-hidden":"true",children:"\xB7"}),(0,e.jsx)("button",{type:"button","data-testid":"draft-discard",onClick:z,style:m,children:"Discard"})]}),u.draftNote?(0,e.jsx)("p",{"data-testid":"draft-note",role:"status",style:{margin:0,padding:n?0:"0 16px 8px",fontSize:"0.8125rem",color:"var(--graview-warn)"},children:u.draftNote}):(0,e.jsx)("span",{}),(0,e.jsx)("div",{"data-testid":"draft-lens","data-graview-draft":t.lens.name,role:"group","aria-label":t.title,tabIndex:0,style:n?{height:"min(72vh, 760px)",display:"grid",gridTemplateRows:"minmax(0, 1fr)",overflow:"auto",scrollbarGutter:"stable",border:"1px solid var(--graview-edge)",borderRadius:12,background:"var(--graview-panel)"}:{minHeight:0,overflow:"auto",scrollbarGutter:"stable",display:"grid",gridTemplateRows:"minmax(0, 1fr)"},onClick:s=>{let o=s.target?.closest("[data-graview-pick]")?.getAttribute("data-graview-pick");if(!o||!d.graph.getNode(o))return;s.preventDefault();let a=d.graph.getNode(o);y?(c.setDraft(null),y(o)):b({to:"record",id:o,kind:a.kind,label:o,address:"",said:""})},children:(0,e.jsx)(C,{kind:t.kind,view:t.title,children:(0,e.jsx)(G,{nodes:q,label:t.title,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1})})})]})}var K={margin:0,display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 8px",fontSize:"0.875rem",color:"var(--graview-ink-muted)",borderBottom:"1px solid var(--graview-edge)",paddingBottom:8};export{Y as DraftFrame};
@@ -1 +0,0 @@
1
- import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk.EYSQPXVE.js";import"./chunk.AOEXSQDG.js";import"./chunk.35FUGOSG.js";import"./chunk.NQDGUIUQ.js";import"./chunk.DTRNDSMS.js";import"./chunk.3EW6L5DY.js";import"./chunk.AVDXG57A.js";import"./chunk.LD6S2FL5.js";import"./chunk.TABIRLQS.js";import"./chunk.GRLPNTUW.js";import"./chunk.EJAVIZ7Y.js";import"./chunk.PFEKS3KO.js";import"./chunk.2AZTW66C.js";import"./chunk.AJZBJBMO.js";export{g as columnActs,d as columnChoices,c as columnMoves,b as columnOf,e as columnReach,f as columnSteps,j as describePlace,k as placeText,h as resolveFor,i as shadowedPageSlots,a as statusColumns};