graview 0.1.48 → 0.1.50
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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/preview/chunk.24MUPV4Y.js +1 -0
- package/dist/preview/chunk.25VJPUDH.js +1 -0
- package/dist/preview/{chunk.PTXLOFQW.js → chunk.2P66HH5Y.js} +1 -1
- package/dist/preview/chunk.2VZSC2MB.js +1 -0
- package/dist/preview/chunk.3L5USMQD.js +1 -0
- package/dist/preview/chunk.3O3H37WD.js +1 -0
- package/dist/preview/{chunk.Y4MQGEUS.js → chunk.3SY6WWWQ.js} +2 -2
- package/dist/preview/{chunk.HC5N3CT2.js → chunk.4BQNG3W3.js} +1 -1
- package/dist/preview/chunk.4SHSEIHT.js +1 -0
- package/dist/preview/{chunk.NTLHEHOM.js → chunk.4VJARLJ5.js} +1 -1
- package/dist/preview/{chunk.I5TOMBIF.js → chunk.4XOSDCCE.js} +1 -1
- package/dist/preview/{chunk.CH5ROV7N.js → chunk.53BGPCM6.js} +1 -1
- package/dist/preview/{chunk.NQZ73QV7.js → chunk.5DZR46YG.js} +1 -1
- package/dist/preview/{chunk.GNBN3BK7.js → chunk.5RNB6IC5.js} +1 -1
- package/dist/preview/{chunk.E5GM2SMO.js → chunk.64TFAR5Z.js} +1 -1
- package/dist/preview/chunk.6BMCZPT6.js +1 -0
- package/dist/preview/chunk.6SHF6IL5.js +1 -0
- package/dist/preview/{chunk.RLXKDXPB.js → chunk.6VA5XFRR.js} +1 -1
- package/dist/preview/{chunk.GUMJEVVP.js → chunk.73BJYIYS.js} +1 -1
- package/dist/preview/chunk.7PJVMADH.js +2 -0
- package/dist/preview/{chunk.YVOABA2U.js → chunk.7QW6JYGP.js} +1 -1
- package/dist/preview/{chunk.NR5ODXMO.js → chunk.7VX6TBNY.js} +1 -1
- package/dist/preview/{chunk.5IM645XQ.js → chunk.A53G42QO.js} +1 -1
- package/dist/preview/chunk.ATWNWPME.js +1 -0
- package/dist/preview/chunk.AVCW7C6V.js +1 -0
- package/dist/preview/{chunk.V4BCB7N2.js → chunk.AXCRFJDL.js} +1 -1
- package/dist/preview/chunk.AXMC6XVT.js +2 -0
- package/dist/preview/{chunk.DAUC2DFY.js → chunk.BBNF52IB.js} +1 -1
- package/dist/preview/chunk.BJAQRV2R.js +1 -0
- package/dist/preview/chunk.BLS2G3CD.js +5 -0
- package/dist/preview/chunk.BNQL37AC.js +88 -0
- package/dist/preview/{chunk.QGE6YKSU.js → chunk.BORCUDGS.js} +1 -1
- package/dist/preview/{chunk.MVRG75ZD.js → chunk.CBJHYNNT.js} +1 -1
- package/dist/preview/{chunk.I7QIHN66.js → chunk.CDZVUCEK.js} +1 -1
- package/dist/preview/chunk.CR5MQMOL.js +1 -0
- package/dist/preview/{chunk.2GLJH253.js → chunk.DUIKIJKC.js} +1 -1
- package/dist/preview/{chunk.GT3F6FQ6.js → chunk.DUJUJN35.js} +1 -1
- package/dist/preview/chunk.ECSWXLBI.js +9 -0
- package/dist/preview/{chunk.KW65F4WA.js → chunk.EF3UB7US.js} +1 -1
- package/dist/preview/chunk.EJUZGIQ5.js +1 -0
- package/dist/preview/{chunk.NLBIX7LH.js → chunk.ETWREHXF.js} +1 -1
- package/dist/preview/{chunk.3BAHAK6W.js → chunk.ETX4QMM2.js} +1 -1
- package/dist/preview/{chunk.VQAQQW4Q.js → chunk.F5FJHKWV.js} +1 -1
- package/dist/preview/{chunk.D5ETRTAF.js → chunk.F7AFJRPP.js} +1 -1
- package/dist/preview/{chunk.TKMQROXF.js → chunk.FDFVGHQE.js} +1 -1
- package/dist/preview/{chunk.UJRBOUGC.js → chunk.FFPG4PHX.js} +1 -1
- package/dist/preview/{chunk.CJ23XTSW.js → chunk.FKUVIG6D.js} +1 -1
- package/dist/preview/chunk.GDYI5QDS.js +1 -0
- package/dist/preview/{chunk.OFRGDJYX.js → chunk.GPJFNLEJ.js} +1 -1
- package/dist/preview/chunk.GQI53L5P.js +1 -0
- package/dist/preview/{chunk.X7JMJSLU.js → chunk.GQX57JIE.js} +1 -1
- package/dist/preview/{chunk.ZH4NWRWB.js → chunk.GTUBIJTP.js} +1 -1
- package/dist/preview/{chunk.X7N3JUO4.js → chunk.GZEZMU2T.js} +2 -2
- package/dist/preview/{chunk.6VAFNCR4.js → chunk.HG34MT7C.js} +1 -1
- package/dist/preview/{chunk.DUWYF7BO.js → chunk.HGP3Q7QX.js} +1 -1
- package/dist/preview/chunk.IATLUWAD.js +1 -0
- package/dist/preview/chunk.IDQHSAAQ.js +1 -0
- package/dist/preview/chunk.IMFAPZ6J.js +21 -0
- package/dist/preview/{chunk.PQVUQVRL.js → chunk.JC5NXMG3.js} +1 -1
- package/dist/preview/chunk.JJP5OL5E.js +1 -0
- package/dist/preview/{chunk.QQTRAY5W.js → chunk.JLPBXG4P.js} +1 -1
- package/dist/preview/chunk.JLR74UFP.js +1 -0
- package/dist/preview/{chunk.2VTMTW7K.js → chunk.JYJNRCK5.js} +1 -1
- package/dist/preview/chunk.K4ITS63T.js +1 -0
- package/dist/preview/{chunk.KTFUVR4V.js → chunk.KFHXTHIY.js} +1 -1
- package/dist/preview/{chunk.QQCDCRR2.js → chunk.KGGWFL54.js} +1 -1
- package/dist/preview/{chunk.5A4AOFOA.js → chunk.KHRS2SKB.js} +1 -1
- package/dist/preview/{chunk.NWT5FPEK.js → chunk.KOPRZLJH.js} +18 -18
- package/dist/preview/{chunk.Z4UM4CMT.js → chunk.KQSD5MLY.js} +1 -1
- package/dist/preview/{chunk.DFK2NA6L.js → chunk.KT2LXHSI.js} +1 -1
- package/dist/preview/{chunk.ETR6AV47.js → chunk.KVEDMKUN.js} +1 -1
- package/dist/preview/{chunk.7LL7OSBY.js → chunk.KZ3UPV2L.js} +2 -2
- package/dist/preview/{chunk.J2V76Z6G.js → chunk.L2AV6JRA.js} +1 -1
- package/dist/preview/chunk.L5MDUZLQ.js +1 -0
- package/dist/preview/chunk.LDE5HLTM.js +1 -0
- package/dist/preview/{chunk.IRHSTUZM.js → chunk.LGHMUUTG.js} +1 -1
- package/dist/preview/{chunk.PPRSGM64.js → chunk.LJXAZ5TF.js} +1 -1
- package/dist/preview/{chunk.OZGETOTK.js → chunk.M55U47A6.js} +1 -1
- package/dist/preview/chunk.M5RHVUZ6.js +1 -0
- package/dist/preview/chunk.MBZ6N5SO.js +1 -0
- package/dist/preview/chunk.MCFLCC42.js +12 -0
- package/dist/preview/{chunk.MVSV7T6E.js → chunk.MCPLU2U4.js} +1 -1
- package/dist/preview/chunk.MQISKON2.js +1 -0
- package/dist/preview/{chunk.DHAK6PPX.js → chunk.MRUDTYOL.js} +2 -2
- package/dist/preview/chunk.N7FIUTVY.js +1 -0
- package/dist/preview/chunk.NPU4WYRB.js +1 -0
- package/dist/preview/{chunk.DPHTUTOS.js → chunk.O6SKKF4V.js} +1 -1
- package/dist/preview/{chunk.SKJJBLXF.js → chunk.OB7XLVK6.js} +1 -1
- package/dist/preview/{chunk.P6FQAILU.js → chunk.ODHCSYXX.js} +1 -1
- package/dist/preview/chunk.OHAWUOUN.js +1 -0
- package/dist/preview/chunk.OKQ4JXTW.js +1 -0
- package/dist/preview/{chunk.YDL5BSTG.js → chunk.OUNLAMBA.js} +1 -1
- package/dist/preview/chunk.OYQ6ZA6T.js +1 -0
- package/dist/preview/chunk.Q7RI4SI4.js +1 -0
- package/dist/preview/chunk.Q7UQ5OXA.js +1 -0
- package/dist/preview/{chunk.PMJUGHW4.js → chunk.QAUZDLDA.js} +1 -1
- package/dist/preview/{chunk.5Y3Q7ONN.js → chunk.QFI4L2HK.js} +1 -1
- package/dist/preview/{chunk.UGJSMNVO.js → chunk.QSZLY62B.js} +1 -1
- package/dist/preview/{chunk.LXCJVZF3.js → chunk.QZMBEG4E.js} +1 -1
- package/dist/preview/{chunk.TBRJOKIK.js → chunk.RK6BK5FD.js} +1 -1
- package/dist/preview/{chunk.76W2FXEC.js → chunk.ROJZLOKZ.js} +1 -1
- package/dist/preview/chunk.RXJBYP7B.js +1 -0
- package/dist/preview/chunk.S64LCR23.js +1 -0
- package/dist/preview/{chunk.TMDI7KRS.js → chunk.S7OFTGBQ.js} +4 -4
- package/dist/preview/chunk.SGMVLKZO.js +25 -0
- package/dist/preview/chunk.SJRXBTGP.js +1 -0
- package/dist/preview/{chunk.GH2SWMCW.js → chunk.SRU2YDTJ.js} +1 -1
- package/dist/preview/chunk.SVH3OMU2.js +1 -0
- package/dist/preview/{chunk.SFAAM4KE.js → chunk.SWLDDQJS.js} +1 -1
- package/dist/preview/{chunk.ENPCLMP2.js → chunk.T4UYLB3Y.js} +1 -1
- package/dist/preview/chunk.THTHNY4N.js +1 -0
- package/dist/preview/{chunk.V2GSBYDK.js → chunk.TL7UGUY4.js} +2 -2
- package/dist/preview/{chunk.N4M54YK6.js → chunk.TT6QBWRA.js} +1 -1
- package/dist/preview/{chunk.7VT3TRHR.js → chunk.TY6VILZB.js} +1 -1
- package/dist/preview/{chunk.DOBQ4LO4.js → chunk.U2M4SGUU.js} +1 -1
- package/dist/preview/chunk.U6FGWVGB.js +1 -0
- package/dist/preview/{chunk.KVJFY7N5.js → chunk.UCS3CBT4.js} +1 -1
- package/dist/preview/{chunk.2QNGGF55.js → chunk.UDTBFAS5.js} +2 -2
- package/dist/preview/chunk.UEL7FLL7.js +1 -0
- package/dist/preview/{chunk.ODRL5OWR.js → chunk.UGJ32SEL.js} +1 -1
- package/dist/preview/{chunk.HKA5T7DL.js → chunk.UJTRKSCK.js} +1 -1
- package/dist/preview/{chunk.QII2C5OV.js → chunk.UN2OB6OD.js} +1 -1
- package/dist/preview/chunk.UOC3SIYT.js +1 -0
- package/dist/preview/{chunk.HDE2MGGU.js → chunk.V5IWJ3ZV.js} +1 -1
- package/dist/preview/{chunk.LPD74WBI.js → chunk.VM43YREJ.js} +1 -1
- package/dist/preview/chunk.VVRI7DNK.js +1 -0
- package/dist/preview/{chunk.MZLWLIKR.js → chunk.WGRF6EHC.js} +1 -1
- package/dist/preview/{chunk.KVEDIBXS.js → chunk.XWLGHTH6.js} +1 -1
- package/dist/preview/chunk.YAS6LXQ7.js +1 -0
- package/dist/preview/{chunk.EMQ5POGB.js → chunk.YCJ74LZS.js} +1 -1
- package/dist/preview/chunk.YEKHDZ45.js +20 -0
- package/dist/preview/chunk.YEMNR4WU.js +1 -0
- package/dist/preview/{chunk.44G5A53D.js → chunk.YG3BLY67.js} +1 -1
- package/dist/preview/{chunk.J6ANRF6E.js → chunk.YUV7HZYG.js} +1 -1
- package/dist/preview/{chunk.5IPH2SCE.js → chunk.YYS45ZGQ.js} +1 -1
- package/dist/preview/{chunk.GACKGEUY.js → chunk.YZ6UKKEL.js} +1 -1
- package/dist/preview/{chunk.GVNYPFIM.js → chunk.ZBBCUK2K.js} +1 -1
- package/dist/preview/chunk.ZI66HRES.js +1 -0
- package/dist/preview/{chunk.XTMOFRHL.js → chunk.ZITDUHX3.js} +1 -1
- package/dist/preview/{chunk.2UIUMG23.js → chunk.ZK446PSX.js} +3 -3
- package/dist/preview/{chunk.6TKILWRM.js → chunk.ZKDJQDKX.js} +1 -1
- package/dist/preview/{chunk.QPICKSSM.js → chunk.ZOQ3OKKI.js} +1 -1
- package/dist/preview/chunk.ZVETGRUM.js +1 -0
- package/dist/preview/{chunk.G7WDMUDV.js → chunk.ZVOP2HHI.js} +1 -1
- package/dist/preview/index.html +51 -51
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2AZTW66C.js +0 -1
- package/dist/preview/chunk.37CJSWLL.js +0 -1
- package/dist/preview/chunk.3RP3N2JP.js +0 -1
- package/dist/preview/chunk.3UD7GG5B.js +0 -1
- package/dist/preview/chunk.4GQA3AJU.js +0 -1
- package/dist/preview/chunk.4KX53HCV.js +0 -9
- package/dist/preview/chunk.4TJOS4C7.js +0 -5
- package/dist/preview/chunk.4VW6THJF.js +0 -1
- package/dist/preview/chunk.664PBQAQ.js +0 -1
- package/dist/preview/chunk.72OZLWJL.js +0 -1
- package/dist/preview/chunk.72W6S746.js +0 -1
- package/dist/preview/chunk.7FRPNQU4.js +0 -1
- package/dist/preview/chunk.7QZYFLBS.js +0 -1
- package/dist/preview/chunk.B2IIEVBF.js +0 -21
- package/dist/preview/chunk.BDHKWVNX.js +0 -1
- package/dist/preview/chunk.DQ7M3LFV.js +0 -1
- package/dist/preview/chunk.DWPU56S5.js +0 -1
- package/dist/preview/chunk.E2AJ7U5Z.js +0 -1
- package/dist/preview/chunk.EXEZBZGW.js +0 -1
- package/dist/preview/chunk.EZJNUFNQ.js +0 -1
- package/dist/preview/chunk.FOP5RBGF.js +0 -1
- package/dist/preview/chunk.FPYL6REZ.js +0 -1
- package/dist/preview/chunk.FQYOTK34.js +0 -1
- package/dist/preview/chunk.GTPC6JOW.js +0 -2
- package/dist/preview/chunk.HG4DDNPG.js +0 -1
- package/dist/preview/chunk.ILZYRJDS.js +0 -1
- package/dist/preview/chunk.KA44WNB4.js +0 -25
- package/dist/preview/chunk.LGSFGNWE.js +0 -1
- package/dist/preview/chunk.LNON6P7K.js +0 -1
- package/dist/preview/chunk.MAFFUPCR.js +0 -1
- package/dist/preview/chunk.MTXEURFE.js +0 -1
- package/dist/preview/chunk.NFDLCUCC.js +0 -1
- package/dist/preview/chunk.NX7IIZLO.js +0 -1
- package/dist/preview/chunk.O45VO36H.js +0 -1
- package/dist/preview/chunk.OAIWGWGU.js +0 -3
- package/dist/preview/chunk.OVO6L5IP.js +0 -88
- package/dist/preview/chunk.PCEYZQAW.js +0 -1
- package/dist/preview/chunk.PVEPU6EA.js +0 -1
- package/dist/preview/chunk.QO7MDWID.js +0 -1
- package/dist/preview/chunk.RQBEQYB2.js +0 -1
- package/dist/preview/chunk.SA34Y3X5.js +0 -2
- package/dist/preview/chunk.SAHNXAV3.js +0 -1
- package/dist/preview/chunk.SUPWMV2F.js +0 -1
- package/dist/preview/chunk.TPG6IY4M.js +0 -1
- package/dist/preview/chunk.UT6642FC.js +0 -1
- package/dist/preview/chunk.V3N34DSU.js +0 -1
- package/dist/preview/chunk.W72TTRLX.js +0 -20
- package/dist/preview/chunk.X5G7FOPY.js +0 -12
- package/dist/preview/chunk.YEVA72L2.js +0 -1
- package/dist/preview/chunk.YLWON7X3.js +0 -1
- package/dist/preview/chunk.YUH43J2K.js +0 -1
- package/dist/preview/chunk.ZXZNAG35.js +0 -1
package/dist/preview/index.html
CHANGED
|
@@ -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.
|
|
9
|
-
<link rel="modulepreload" href="/chunk.
|
|
10
|
-
<link rel="modulepreload" href="/chunk.
|
|
11
|
-
<link rel="modulepreload" href="/chunk.
|
|
8
|
+
<link rel="modulepreload" href="/chunk.YUV7HZYG.js">
|
|
9
|
+
<link rel="modulepreload" href="/chunk.AXCRFJDL.js">
|
|
10
|
+
<link rel="modulepreload" href="/chunk.UEL7FLL7.js">
|
|
11
|
+
<link rel="modulepreload" href="/chunk.S64LCR23.js">
|
|
12
12
|
<link rel="modulepreload" href="/chunk.Q5WEOX3Q.js">
|
|
13
|
-
<link rel="modulepreload" href="/chunk.
|
|
14
|
-
<link rel="modulepreload" href="/chunk.
|
|
15
|
-
<link rel="modulepreload" href="/chunk.
|
|
16
|
-
<link rel="modulepreload" href="/chunk.
|
|
13
|
+
<link rel="modulepreload" href="/chunk.BJAQRV2R.js">
|
|
14
|
+
<link rel="modulepreload" href="/chunk.KFHXTHIY.js">
|
|
15
|
+
<link rel="modulepreload" href="/chunk.ZK446PSX.js">
|
|
16
|
+
<link rel="modulepreload" href="/chunk.SGMVLKZO.js">
|
|
17
17
|
<link rel="modulepreload" href="/chunk.SDO3U72B.js">
|
|
18
|
-
<link rel="modulepreload" href="/chunk.
|
|
19
|
-
<link rel="modulepreload" href="/chunk.
|
|
18
|
+
<link rel="modulepreload" href="/chunk.BLS2G3CD.js">
|
|
19
|
+
<link rel="modulepreload" href="/chunk.EJUZGIQ5.js">
|
|
20
20
|
<link rel="modulepreload" href="/chunk.AJZBJBMO.js">
|
|
21
|
-
<link rel="modulepreload" href="/chunk.
|
|
22
|
-
<link rel="modulepreload" href="/chunk.
|
|
23
|
-
<link rel="modulepreload" href="/chunk.
|
|
24
|
-
<link rel="modulepreload" href="/chunk.
|
|
25
|
-
<link rel="modulepreload" href="/chunk.
|
|
26
|
-
<link rel="modulepreload" href="/chunk.
|
|
21
|
+
<link rel="modulepreload" href="/chunk.Q7UQ5OXA.js">
|
|
22
|
+
<link rel="modulepreload" href="/chunk.S7OFTGBQ.js">
|
|
23
|
+
<link rel="modulepreload" href="/chunk.CDZVUCEK.js">
|
|
24
|
+
<link rel="modulepreload" href="/chunk.UDTBFAS5.js">
|
|
25
|
+
<link rel="modulepreload" href="/chunk.QAUZDLDA.js">
|
|
26
|
+
<link rel="modulepreload" href="/chunk.3SY6WWWQ.js">
|
|
27
27
|
<link rel="modulepreload" href="/chunk.UGFDSE37.js">
|
|
28
|
-
<link rel="modulepreload" href="/chunk.
|
|
29
|
-
<link rel="modulepreload" href="/chunk.
|
|
30
|
-
<link rel="modulepreload" href="/chunk.
|
|
31
|
-
<link rel="modulepreload" href="/chunk.
|
|
32
|
-
<link rel="modulepreload" href="/chunk.
|
|
33
|
-
<link rel="modulepreload" href="/chunk.
|
|
34
|
-
<link rel="modulepreload" href="/chunk.
|
|
28
|
+
<link rel="modulepreload" href="/chunk.ATWNWPME.js">
|
|
29
|
+
<link rel="modulepreload" href="/chunk.GZEZMU2T.js">
|
|
30
|
+
<link rel="modulepreload" href="/chunk.4VJARLJ5.js">
|
|
31
|
+
<link rel="modulepreload" href="/chunk.5RNB6IC5.js">
|
|
32
|
+
<link rel="modulepreload" href="/chunk.ZITDUHX3.js">
|
|
33
|
+
<link rel="modulepreload" href="/chunk.ETWREHXF.js">
|
|
34
|
+
<link rel="modulepreload" href="/chunk.YZ6UKKEL.js">
|
|
35
35
|
<link rel="modulepreload" href="/chunk.PXQVXBNG.js">
|
|
36
|
-
<link rel="modulepreload" href="/chunk.
|
|
37
|
-
<link rel="modulepreload" href="/chunk.
|
|
38
|
-
<link rel="modulepreload" href="/chunk.
|
|
39
|
-
<link rel="modulepreload" href="/chunk.
|
|
40
|
-
<link rel="modulepreload" href="/chunk.
|
|
41
|
-
<link rel="modulepreload" href="/chunk.
|
|
42
|
-
<link rel="modulepreload" href="/chunk.
|
|
43
|
-
<link rel="modulepreload" href="/chunk.
|
|
44
|
-
<link rel="modulepreload" href="/chunk.
|
|
45
|
-
<link rel="modulepreload" href="/chunk.
|
|
46
|
-
<link rel="modulepreload" href="/chunk.
|
|
47
|
-
<link rel="modulepreload" href="/chunk.
|
|
48
|
-
<link rel="modulepreload" href="/chunk.
|
|
49
|
-
<link rel="modulepreload" href="/chunk.
|
|
36
|
+
<link rel="modulepreload" href="/chunk.FFPG4PHX.js">
|
|
37
|
+
<link rel="modulepreload" href="/chunk.3L5USMQD.js">
|
|
38
|
+
<link rel="modulepreload" href="/chunk.GTUBIJTP.js">
|
|
39
|
+
<link rel="modulepreload" href="/chunk.DUIKIJKC.js">
|
|
40
|
+
<link rel="modulepreload" href="/chunk.73BJYIYS.js">
|
|
41
|
+
<link rel="modulepreload" href="/chunk.OKQ4JXTW.js">
|
|
42
|
+
<link rel="modulepreload" href="/chunk.M5RHVUZ6.js">
|
|
43
|
+
<link rel="modulepreload" href="/chunk.MRUDTYOL.js">
|
|
44
|
+
<link rel="modulepreload" href="/chunk.OUNLAMBA.js">
|
|
45
|
+
<link rel="modulepreload" href="/chunk.HGP3Q7QX.js">
|
|
46
|
+
<link rel="modulepreload" href="/chunk.QSZLY62B.js">
|
|
47
|
+
<link rel="modulepreload" href="/chunk.7VX6TBNY.js">
|
|
48
|
+
<link rel="modulepreload" href="/chunk.L5MDUZLQ.js">
|
|
49
|
+
<link rel="modulepreload" href="/chunk.IDQHSAAQ.js">
|
|
50
50
|
<link rel="modulepreload" href="/chunk.XOZU4OFA.js">
|
|
51
|
-
<link rel="modulepreload" href="/chunk.
|
|
51
|
+
<link rel="modulepreload" href="/chunk.CR5MQMOL.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.
|
|
55
|
-
<link rel="modulepreload" href="/chunk.
|
|
56
|
-
<link rel="modulepreload" href="/chunk.
|
|
57
|
-
<link rel="modulepreload" href="/chunk.
|
|
58
|
-
<link rel="modulepreload" href="/chunk.
|
|
54
|
+
<link rel="modulepreload" href="/chunk.6SHF6IL5.js">
|
|
55
|
+
<link rel="modulepreload" href="/chunk.MQISKON2.js">
|
|
56
|
+
<link rel="modulepreload" href="/chunk.GQX57JIE.js">
|
|
57
|
+
<link rel="modulepreload" href="/chunk.LJXAZ5TF.js">
|
|
58
|
+
<link rel="modulepreload" href="/chunk.QFI4L2HK.js">
|
|
59
59
|
<link rel="modulepreload" href="/chunk.GZHZLJBF.js">
|
|
60
|
-
<link rel="modulepreload" href="/chunk.
|
|
60
|
+
<link rel="modulepreload" href="/chunk.JLR74UFP.js">
|
|
61
61
|
<link rel="modulepreload" href="/chunk.OJGHDWI6.js">
|
|
62
|
-
<link rel="modulepreload" href="/chunk.
|
|
63
|
-
<link rel="modulepreload" href="/chunk.
|
|
64
|
-
<link rel="modulepreload" href="/chunk.
|
|
65
|
-
<link rel="modulepreload" href="/chunk.
|
|
66
|
-
<link rel="modulepreload" href="/chunk.
|
|
67
|
-
<link rel="modulepreload" href="/chunk.
|
|
68
|
-
<script>(()=>{const later=["/chunk.
|
|
62
|
+
<link rel="modulepreload" href="/chunk.HG34MT7C.js">
|
|
63
|
+
<link rel="modulepreload" href="/chunk.TT6QBWRA.js">
|
|
64
|
+
<link rel="modulepreload" href="/chunk.UCS3CBT4.js">
|
|
65
|
+
<link rel="modulepreload" href="/chunk.O6SKKF4V.js">
|
|
66
|
+
<link rel="modulepreload" href="/chunk.ZI66HRES.js">
|
|
67
|
+
<link rel="modulepreload" href="/chunk.YCJ74LZS.js">
|
|
68
|
+
<script>(()=>{const later=["/chunk.YAS6LXQ7.js","/chunk.YG3BLY67.js","/chunk.TL7UGUY4.js","/chunk.HJCQ6I3S.js","/chunk.XWLGHTH6.js","/chunk.TY6VILZB.js","/chunk.AXMC6XVT.js","/chunk.64TFAR5Z.js","/chunk.5DZR46YG.js","/chunk.JJP5OL5E.js","/chunk.THTHNY4N.js","/chunk.A53G42QO.js","/chunk.ECSWXLBI.js","/chunk.F5FJHKWV.js","/chunk.GQI53L5P.js","/chunk.LDE5HLTM.js","/chunk.TI4OSTQV.js","/chunk.2P66HH5Y.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>
|
package/dist/preview/page.js
CHANGED
|
@@ -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.J6ANRF6E.js";import{a as zr}from"./chunk.V4BCB7N2.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.QO7MDWID.js";import{b as Qn}from"./chunk.FOP5RBGF.js";import{a as kt}from"./chunk.Q5WEOX3Q.js";import{a as Et,g as bn}from"./chunk.HG4DDNPG.js";import{k as tt}from"./chunk.KTFUVR4V.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.2UIUMG23.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.KA44WNB4.js";import{a as be}from"./chunk.SDO3U72B.js";import{Ad as xt,Pc as mn,Rc as hn,Sc as yn,Uc as et,Vb as At,Wb as fn,jb as Ie,kb as Xe,od as ve,pd as gn,qd as wn,vd as Rt,wb as un,wd as Tt,zc as pn,zd as vn}from"./chunk.4TJOS4C7.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.4GQA3AJU.js","./chunk.HG4DDNPG.js","./chunk.X7JMJSLU.js","./chunk.5Y3Q7ONN.js","./chunk.KTFUVR4V.js","./chunk.4TJOS4C7.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.7QZYFLBS.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.2VTMTW7K.js","./chunk.ETR6AV47.js","./chunk.I5TOMBIF.js","./chunk.QQTRAY5W.js","./chunk.DOBQ4LO4.js","./chunk.KA44WNB4.js","./chunk.SDO3U72B.js","./chunk.4TJOS4C7.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.PCEYZQAW.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.EXEZBZGW.js","./chunk.NTLHEHOM.js","./chunk.V2GSBYDK.js","./chunk.NLBIX7LH.js","./chunk.GACKGEUY.js","./chunk.HJCQ6I3S.js","./chunk.KVEDIBXS.js","./chunk.7VT3TRHR.js","./chunk.VQAQQW4Q.js","./chunk.DWPU56S5.js","./chunk.7FRPNQU4.js","./chunk.BDHKWVNX.js","./chunk.ZH4NWRWB.js","./chunk.GUMJEVVP.js","./chunk.SAHNXAV3.js","./chunk.UGJSMNVO.js","./chunk.NR5ODXMO.js","./chunk.E5GM2SMO.js","./chunk.NQZ73QV7.js","./chunk.O45VO36H.js","./chunk.UT6642FC.js","./chunk.QO7MDWID.js","./chunk.FOP5RBGF.js","./chunk.TI4OSTQV.js","./chunk.MAFFUPCR.js","./chunk.GZHZLJBF.js","./chunk.RQBEQYB2.js","./chunk.OJGHDWI6.js","./chunk.6VAFNCR4.js","./chunk.N4M54YK6.js","./chunk.KVJFY7N5.js","./chunk.DPHTUTOS.js","./chunk.2UIUMG23.js","./chunk.KA44WNB4.js","./chunk.SDO3U72B.js","./chunk.4TJOS4C7.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.NWT5FPEK.js"))),to=be(()=>(__graviewPreload(import.meta.url,["./chunk.TMDI7KRS.js","./chunk.I7QIHN66.js","./chunk.2QNGGF55.js","./chunk.PMJUGHW4.js","./chunk.Y4MQGEUS.js","./chunk.UGFDSE37.js","./chunk.EXEZBZGW.js","./chunk.X7N3JUO4.js","./chunk.NTLHEHOM.js","./chunk.GNBN3BK7.js","./chunk.XTMOFRHL.js","./chunk.NLBIX7LH.js","./chunk.GACKGEUY.js","./chunk.PXQVXBNG.js","./chunk.UJRBOUGC.js","./chunk.DWPU56S5.js","./chunk.ZH4NWRWB.js","./chunk.2GLJH253.js","./chunk.GUMJEVVP.js","./chunk.4VW6THJF.js","./chunk.SAHNXAV3.js","./chunk.DHAK6PPX.js","./chunk.YDL5BSTG.js","./chunk.DUWYF7BO.js","./chunk.UGJSMNVO.js","./chunk.NR5ODXMO.js","./chunk.O45VO36H.js","./chunk.UT6642FC.js","./chunk.XOZU4OFA.js","./chunk.SUPWMV2F.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.TPG6IY4M.js","./chunk.NFDLCUCC.js","./chunk.X7JMJSLU.js","./chunk.PPRSGM64.js","./chunk.5Y3Q7ONN.js","./chunk.KTFUVR4V.js","./chunk.GZHZLJBF.js","./chunk.RQBEQYB2.js","./chunk.OJGHDWI6.js","./chunk.6VAFNCR4.js","./chunk.N4M54YK6.js","./chunk.KVJFY7N5.js","./chunk.DPHTUTOS.js","./chunk.2UIUMG23.js","./chunk.KA44WNB4.js","./chunk.SDO3U72B.js","./chunk.4TJOS4C7.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.664PBQAQ.js"))),no=be(()=>(__graviewPreload(import.meta.url,["./chunk.TMDI7KRS.js","./chunk.I7QIHN66.js","./chunk.2QNGGF55.js","./chunk.PMJUGHW4.js","./chunk.Y4MQGEUS.js","./chunk.UGFDSE37.js","./chunk.EXEZBZGW.js","./chunk.X7N3JUO4.js","./chunk.NTLHEHOM.js","./chunk.GNBN3BK7.js","./chunk.XTMOFRHL.js","./chunk.NLBIX7LH.js","./chunk.GACKGEUY.js","./chunk.PXQVXBNG.js","./chunk.UJRBOUGC.js","./chunk.DWPU56S5.js","./chunk.ZH4NWRWB.js","./chunk.2GLJH253.js","./chunk.GUMJEVVP.js","./chunk.4VW6THJF.js","./chunk.SAHNXAV3.js","./chunk.DHAK6PPX.js","./chunk.YDL5BSTG.js","./chunk.DUWYF7BO.js","./chunk.UGJSMNVO.js","./chunk.NR5ODXMO.js","./chunk.O45VO36H.js","./chunk.UT6642FC.js","./chunk.XOZU4OFA.js","./chunk.SUPWMV2F.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.TPG6IY4M.js","./chunk.NFDLCUCC.js","./chunk.X7JMJSLU.js","./chunk.PPRSGM64.js","./chunk.5Y3Q7ONN.js","./chunk.KTFUVR4V.js","./chunk.GZHZLJBF.js","./chunk.RQBEQYB2.js","./chunk.OJGHDWI6.js","./chunk.6VAFNCR4.js","./chunk.N4M54YK6.js","./chunk.KVJFY7N5.js","./chunk.DPHTUTOS.js","./chunk.2UIUMG23.js","./chunk.KA44WNB4.js","./chunk.SDO3U72B.js","./chunk.4TJOS4C7.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.YUH43J2K.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.J6ANRF6E.js","./chunk.2UIUMG23.js","./chunk.KA44WNB4.js","./chunk.SDO3U72B.js","./chunk.4TJOS4C7.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.YVOABA2U.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.2QNGGF55.js","./chunk.Y4MQGEUS.js","./chunk.UGFDSE37.js","./chunk.EXEZBZGW.js","./chunk.X7N3JUO4.js","./chunk.NTLHEHOM.js","./chunk.GNBN3BK7.js","./chunk.XTMOFRHL.js","./chunk.NLBIX7LH.js","./chunk.GACKGEUY.js","./chunk.UJRBOUGC.js","./chunk.DWPU56S5.js","./chunk.ZH4NWRWB.js","./chunk.2GLJH253.js","./chunk.GUMJEVVP.js","./chunk.4VW6THJF.js","./chunk.SAHNXAV3.js","./chunk.DHAK6PPX.js","./chunk.YDL5BSTG.js","./chunk.DUWYF7BO.js","./chunk.UGJSMNVO.js","./chunk.NR5ODXMO.js","./chunk.XOZU4OFA.js","./chunk.SUPWMV2F.js","./chunk.MB7LKKUD.js","./chunk.V4BCB7N2.js","./chunk.FOP5RBGF.js","./chunk.WVUJXDXZ.js","./chunk.TPG6IY4M.js","./chunk.NFDLCUCC.js","./chunk.X7JMJSLU.js","./chunk.PPRSGM64.js","./chunk.5Y3Q7ONN.js","./chunk.KTFUVR4V.js","./chunk.GZHZLJBF.js","./chunk.RQBEQYB2.js","./chunk.OJGHDWI6.js","./chunk.6VAFNCR4.js","./chunk.N4M54YK6.js","./chunk.KVJFY7N5.js","./chunk.DPHTUTOS.js","./chunk.2UIUMG23.js","./chunk.KA44WNB4.js","./chunk.SDO3U72B.js","./chunk.4TJOS4C7.js","./chunk.2AZTW66C.js","./chunk.AJZBJBMO.js"]),import("./chunk.FPYL6REZ.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 Vt,b as Kn,c as Jn,d as Yn,e as Qn,f as Dt,g as Zn,h as Bt}from"./chunk.YUV7HZYG.js";import{a as Gr}from"./chunk.AXCRFJDL.js";import{a as Wt,b as er,c as tr,d as nr,e as Nt,f as rr,g as or,h as ar,i as ir,j as sr,k as dr,l as cr,m as lr,n as _e}from"./chunk.UEL7FLL7.js";import{b as Xn}from"./chunk.S64LCR23.js";import{a as Et}from"./chunk.Q5WEOX3Q.js";import{a as At,g as Pn}from"./chunk.BJAQRV2R.js";import{k as tt}from"./chunk.KFHXTHIY.js";import{C as qn,H as zn,L as Gn,M as Un,j as zr,k as $n,n as ot,o as In,q as _n,u as jn,z as at}from"./chunk.ZK446PSX.js";import{Aa as Vn,Ba as Dn,Da as Bn,Ea as Ht,G as Mt,Ia as Wn,Ja as Nn,Ma as rt,S as An,X as Rn,a as kn,b as Ct,c as nt,ea as xn,fa as Tn,j as En,m as Lt,ta as Fn,ua as On,va as Cn,wa as Ln,xa as Mn,ya as Hn}from"./chunk.SGMVLKZO.js";import{a as Pe}from"./chunk.SDO3U72B.js";import{$c as gn,Ad as bn,Fd as xt,Gd as Tt,Hd as Ft,Kc as hn,Kd as Sn,Ld as Ot,Zc as yn,ac as Rt,ad as wn,bc as mn,cb as Ie,cd as et,mb as Xe,yb as pn,yd as Se,zd as vn}from"./chunk.BLS2G3CD.js";import"./chunk.EJUZGIQ5.js";import{b as Oe}from"./chunk.AJZBJBMO.js";async function it(e,n={}){let o=e.compiled===void 0||!Kr(e.compiled,e.document)?void 0:Pn(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:a}=await Ur();return a(e.document,n)}var ur,Ur=()=>ur??=(__graviewPreload(import.meta.url,["./chunk.RXJBYP7B.js","./chunk.BJAQRV2R.js","./chunk.GQX57JIE.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.6BMCZPT6.js")).catch(e=>{throw ur=void 0,e});function Kr(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&&Et(At(o).document)===Et(At(a).document)}var c=Oe(Mt(),1);var dt=Oe(Mt(),1),$t="data-graview-drawn",Jr=200,fr=50,Yr=1e4,st=()=>typeof performance<"u"?performance.now():Date.now();function Qr(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 Zr(e,n){if(e.ownerDocument.fonts?.status==="loading"||On()>0||Hn(n)>0||e.querySelector('[aria-busy="true"]')||Qr(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 pr(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 Xr(e,n,o,a){e.removeAttribute($t);let d=e.ownerDocument.defaultView;if(!d)return()=>{};let l=st(),b=l,p=pr(e),w=!1,A,T=typeof MutationObserver>"u"?void 0:new MutationObserver(S=>{S.some($=>!($.target===e&&$.attributeName===$t))&&(b=st())});T?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let v=()=>{w=!0,T?.disconnect(),A!==void 0&&clearTimeout(A)},P=S=>{let $=!1,ne=()=>{$||($=!0,S())};typeof d.requestAnimationFrame=="function"&&d.requestAnimationFrame(()=>setTimeout(ne,0)),setTimeout(ne,100)},L=()=>{if(w)return;let S=pr(e);S!==p&&(p=S,b=st());let $=st();if(Zr(e,a)&&$-b>=Jr||$-l>=Yr){P(()=>{w||(v(),e.setAttribute($t,n),Dn(),o())});return}A=setTimeout(L,fr)};return A=setTimeout(L,fr),v}function mr(e,n,o,a,d){Vn();let l=(0,dt.useRef)({place:o,onDrawn:a});l.current={place:o,onDrawn:a},(0,dt.useLayoutEffect)(()=>{d&&Mn(d);let b=A=>Xr(A,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),d);if(e.current)return b(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=b(e.current))}),()=>{w=!0,p?.()}},[n,e,d])}var ge=Oe(Mt(),1),je,eo=Pe(()=>(__graviewPreload(import.meta.url,["./chunk.JYJNRCK5.js","./chunk.KVEDMKUN.js","./chunk.4XOSDCCE.js","./chunk.JLPBXG4P.js","./chunk.U2M4SGUU.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4SHSEIHT.js"))),hr=()=>eo().then(e=>void(je=e),()=>new Promise(e=>setTimeout(e,2e3)).then(hr)),It=Fn(hr),yr=e=>!!e&&je===void 0;function _t({onReady:e,fetch:n}){return(0,ge.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var to=0;function gr(e){let[n,o]=(0,ge.useState)(()=>je);(0,ge.useEffect)(()=>{if(!e||n)return;let l=!1;return It().then(()=>{l||o(je)}),()=>{l=!0}},[e,n]);let a=(0,ge.useMemo)(()=>to+=1,[e]);return{over:(0,ge.useMemo)(()=>{let l=n??je;if(!e||!l)return;let{source:b,worker:p,...w}=e,A={...w,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 br=Oe(Gr(),1),j=Oe(zr(),1);var h=Oe(An(),1);function ct(e,n={}){let o=Ht(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 zt=e=>Promise.all([e,Gn()]).then(([n])=>n),Sr=Pe(()=>(__graviewPreload(import.meta.url,["./chunk.ATWNWPME.js","./chunk.4VJARLJ5.js","./chunk.TL7UGUY4.js","./chunk.ETWREHXF.js","./chunk.YZ6UKKEL.js","./chunk.HJCQ6I3S.js","./chunk.XWLGHTH6.js","./chunk.TY6VILZB.js","./chunk.F5FJHKWV.js","./chunk.3L5USMQD.js","./chunk.GQI53L5P.js","./chunk.LDE5HLTM.js","./chunk.GTUBIJTP.js","./chunk.73BJYIYS.js","./chunk.M5RHVUZ6.js","./chunk.QSZLY62B.js","./chunk.7VX6TBNY.js","./chunk.64TFAR5Z.js","./chunk.5DZR46YG.js","./chunk.L5MDUZLQ.js","./chunk.IDQHSAAQ.js","./chunk.UEL7FLL7.js","./chunk.S64LCR23.js","./chunk.TI4OSTQV.js","./chunk.JJP5OL5E.js","./chunk.GZHZLJBF.js","./chunk.JLR74UFP.js","./chunk.OJGHDWI6.js","./chunk.HG34MT7C.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KOPRZLJH.js"))),no=Pe(()=>(__graviewPreload(import.meta.url,["./chunk.S7OFTGBQ.js","./chunk.CDZVUCEK.js","./chunk.UDTBFAS5.js","./chunk.QAUZDLDA.js","./chunk.3SY6WWWQ.js","./chunk.UGFDSE37.js","./chunk.ATWNWPME.js","./chunk.GZEZMU2T.js","./chunk.4VJARLJ5.js","./chunk.5RNB6IC5.js","./chunk.ZITDUHX3.js","./chunk.ETWREHXF.js","./chunk.YZ6UKKEL.js","./chunk.PXQVXBNG.js","./chunk.FFPG4PHX.js","./chunk.3L5USMQD.js","./chunk.GTUBIJTP.js","./chunk.DUIKIJKC.js","./chunk.73BJYIYS.js","./chunk.OKQ4JXTW.js","./chunk.M5RHVUZ6.js","./chunk.MRUDTYOL.js","./chunk.OUNLAMBA.js","./chunk.HGP3Q7QX.js","./chunk.QSZLY62B.js","./chunk.7VX6TBNY.js","./chunk.L5MDUZLQ.js","./chunk.IDQHSAAQ.js","./chunk.XOZU4OFA.js","./chunk.CR5MQMOL.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.6SHF6IL5.js","./chunk.MQISKON2.js","./chunk.GQX57JIE.js","./chunk.LJXAZ5TF.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.GZHZLJBF.js","./chunk.JLR74UFP.js","./chunk.OJGHDWI6.js","./chunk.HG34MT7C.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.Q7UQ5OXA.js"))),ro=Pe(()=>(__graviewPreload(import.meta.url,["./chunk.S7OFTGBQ.js","./chunk.CDZVUCEK.js","./chunk.UDTBFAS5.js","./chunk.QAUZDLDA.js","./chunk.3SY6WWWQ.js","./chunk.UGFDSE37.js","./chunk.ATWNWPME.js","./chunk.GZEZMU2T.js","./chunk.4VJARLJ5.js","./chunk.5RNB6IC5.js","./chunk.ZITDUHX3.js","./chunk.ETWREHXF.js","./chunk.YZ6UKKEL.js","./chunk.PXQVXBNG.js","./chunk.FFPG4PHX.js","./chunk.3L5USMQD.js","./chunk.GTUBIJTP.js","./chunk.DUIKIJKC.js","./chunk.73BJYIYS.js","./chunk.OKQ4JXTW.js","./chunk.M5RHVUZ6.js","./chunk.MRUDTYOL.js","./chunk.OUNLAMBA.js","./chunk.HGP3Q7QX.js","./chunk.QSZLY62B.js","./chunk.7VX6TBNY.js","./chunk.L5MDUZLQ.js","./chunk.IDQHSAAQ.js","./chunk.XOZU4OFA.js","./chunk.CR5MQMOL.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.6SHF6IL5.js","./chunk.MQISKON2.js","./chunk.GQX57JIE.js","./chunk.LJXAZ5TF.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.GZHZLJBF.js","./chunk.JLR74UFP.js","./chunk.OJGHDWI6.js","./chunk.HG34MT7C.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.OHAWUOUN.js"))),Pr=ct(()=>zt(Sr().then(e=>e.SceneFace)),{what:"This view"}),kr=ct(()=>Sr().then(e=>e.SceneKeeping),{quiet:!0}),Er=ct(()=>zt(no().then(e=>e.PagesContent)),{what:"This page"}),Ar=ct(()=>zt(ro().then(e=>e.PictureFace)),{what:"This picture"}),oo=Pr.Face,ao=kr.Face,io=Er.Face,so=Ar.Face;function Ce(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Rr));return Promise.all([...[...o].map(a=>a.fetch()),_n()]).then(()=>{},()=>{})}var Rr=e=>e==="pages"?[Er]:e==="picture"?[Ar]:[Pr,kr],xr=e=>Rr(e).every(n=>n.here()),co=150,jt=0;function wr(e,n){if(xr(e))return n();let o=++jt,a=()=>{o===jt&&(jt+=1,n())};Ce(e).then(a),setTimeout(a,co)}var lo=768;function uo(e,n){let o=n!==null&&n>=lo;(0,c.useEffect)(()=>{if(!o||e==="picture")return;let a=e==="pages"?"scene":"pages";if(xr(a))return;let d=globalThis,l=()=>void Ce(a),b=()=>{},p=Bn(()=>{if(d.requestIdleCallback&&d.cancelIdleCallback){let w=d.requestIdleCallback(l,{timeout:4e3});b=()=>d.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);b=()=>clearTimeout(w)}});return()=>(p(),b())},[e,o])}function fo({asked:e,shown:n,onDrawn:o}){return(0,c.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function po({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 mo=Ht(Pe(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,h.jsx)(e.StudioPlace,{...n}),{quiet:!0});function Tr(e,n,o,a,d){return Dt(e,Qn(n?nt(n):d??kn,a),o)}function Gt(e){return e&&nt(e).overview?"graview":"scene"}function vr(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 Fr(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:Ut}):!a.current&&yr(e.draftView)?(0,h.jsx)(_t,{onReady:o,fetch:It}):(a.current=!0,(0,h.jsx)(ho,{...e}))}function ho(e){let{app:n,stop:o,bar:a=!0,standing:d="Everything is in order",principal:l,heading:b=2}=e,{rootRef:p,scope:w,css:A,scheme:T,store:v,presence:P,brand:L,auto:S,height:$}=rr(e),ne=gr(e.draftView),V=tr(e,Un,ne.over),[Z]=(0,c.useState)(Ln),u=e.basePath===void 0?{}:{basePath:e.basePath},[D]=(0,c.useState)(ot),q=e.notices??D,K=m=>xt(m,u),F={...e.routing?{routing:e.routing}:{},...u},[de]=(0,c.useState)(()=>{let m=e.at?.face;if(m)return m;let C=o===void 0&&vr(n,V)?"pages":Gt(o),he=Vt({...F,face:C});return e.face===void 0&&e.onOpening?.(he),he}),[B,O]=(0,c.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&Kn(F)&&vr(n,V)),Ee=(0,c.useRef)(e.onFace);Ee.current=e.onFace,(0,c.useLayoutEffect)(()=>{B&&(Ee.current?.("pages"),O(!1))},[B]);let k=B?"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,[]),W=(0,c.useMemo)(()=>Tn(V,n.schema),[V,n.schema]),ce=(0,c.useMemo)(()=>{let m=J?.stop??(R?Jn(e.basePath):void 0)??o;return k==="scene"&&m===void 0&&W===void 0&&(e.path===void 0||qt(e.path))?Bt(void 0):Tr(k,m,te,V.places(),W)},[]),[ve]=(0,c.useState)(k);(0,c.useEffect)(()=>{ve!=="pages"&&xn(V)},[ve,V]);let N=(0,c.useRef)(void 0),z=m=>m===void 0||qt(m)?"/":m;N.current??={path:z(J?.path??(R?k==="pages"?(Tt(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==N.current.asked&&(N.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,C)=>{N.current.path=m,I.current?.(m,C)},[]),{at:M,setAt:Ae,steering:Y,steer:X}=dr(N.current.path),H=(0,c.useContext)(Or);H&&(H.pages=()=>N.current.path);let ue=(0,c.useRef)(void 0),fe=(0,c.useCallback)(m=>void(N.current.path=m),[]),re=$n(p),[Q,ze]=(0,c.useState)(!1),Re=e.pagesBelow!==void 0&&re!==null&&re<e.pagesBelow&&(k==="scene"||k==="graview")&&!Q,E=Re?"pages":k,xe=(0,c.useRef)(!1);xe.current=Q&&e.pagesBelow!==void 0&&re!==null&&re<e.pagesBelow&&(k==="scene"||k==="graview"),H&&(H.shown=E);let pe=(0,c.useRef)(k==="graview"?"graview":"scene");(E==="scene"||E==="graview")&&(pe.current=E),(0,c.useState)(()=>{if(!R||typeof window>"u"||E==="pages"||E==="picture")return;let{pathname:m,search:C,hash:he}=window.location;Tt(m,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${K(Se)}${C}${he}`)}),nr(p,E,e.onIntrinsicHeight),uo(E,re);let oe=cr(e.onError,E),Be=lr(e.onReady,E),Te=(0,c.useRef)(e.onFaceDrawn);Te.current=e.onFaceDrawn;let mt=(0,c.useCallback)((m,C)=>{Be(C),Te.current?.(m)},[Be]),[ht,yt]=(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,C,he)=>{if(R){ue.current?.(m,C,he);return}ee.current.onFace?.(m),I.current?.(m==="pages"?C??N.current.path:Se,"push")},[R]),[We,me]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{E==="pages"&&me(void 0)},[E]);let Ge=(0,c.useRef)(o);(0,c.useEffect)(()=>{Ge.current!==o&&(Ge.current=o,me(void 0))},[o]);let Ne=(0,c.useCallback)(m=>{if(ee.current.shown==="pages"){if(ze(!0),me(m),k==="scene"||k==="graview"){wr(k,()=>{R?window.history.pushState(null,"",`${K(Se)}${m??""}`):I.current?.(Se,"push")});return}wr(pe.current,()=>U(pe.current,void 0,m))}},[R,k,e.basePath,U]),ae=(0,c.useCallback)(m=>{if(ee.current.shown==="pages"){Y.go.current||(N.current.path=m),X(m);return}if(N.current.path=m,Ae(m),xe.current){ze(!1),R?window.history.pushState(null,"",K(m)):I.current?.(m,"push");return}U("pages",m)},[Y,X,Ae,U,R,e.basePath]),Me=V.arrangement?.(),Fe=E==="pages",_=e.hrefOf,ie=_??(R?K:void 0),Ue=(0,c.useMemo)(()=>({open:ae,..._?{href:_}:R?{href:m=>xt(m,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[ae,R,e.basePath,_]);return(0,h.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":E,"data-graview-scheme":T,...Re?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:$,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)(Nn.Provider,{value:oe,children:[(0,h.jsx)(or,{rootRef:p,board:q}),(0,h.jsx)(er,{rootRef:p,firstLook:e.firstLook,app:qn(L??{name:n.name},n.schema)}),(0,h.jsx)(_e,{module:"@graview/react",report:oe,content:!0,children:(0,h.jsx)(Cn.Provider,{value:Z,children:(0,h.jsx)(Rn,{store:v,views:V,initialView:ce,scheme:T,...ar(e,P,L),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,h.jsxs)(In.Provider,{value:q,children:[(0,h.jsx)(vo,{face:E,stop:We??o,kinds:te,places:G,opens:W}),H?(0,h.jsx)(yo,{into:H}):null,(0,h.jsx)(go,{rootRef:p,face:k,shown:E,path:M,stop:o,draft:ne.n,onDrawn:e.onDrawn,parts:Z}),R?(0,h.jsx)(Yn,{pagesWere:J?.path,basePath:e.basePath,shown:E,onFace:e.onFace,toggle:ue,kinds:te,places:G,opens:W,landed:fe}):null,a&&E!=="picture"?(0,h.jsx)(_e,{module:"@graview/embed",report:oe,children:(0,h.jsx)(ir,{name:L?.name??n.name,heading:b,named:Wt(a).name!==!1,faces:Wt(a).faces===!1?void 0:{scene:{label:vn(Me),current:!Fe,go:()=>Ne(),reach:()=>void Ce(pe.current)},pages:{label:bn(Me),current:Fe,go:()=>ae(N.current.path),reach:()=>void Ce("pages")}},at:Fe?M:null,without:e.pages?.without(),home:{...ie?.("/")!==void 0?{href:ie("/")}:{},go:()=>ae("/"),current:Fe&&M.split("?")[0]==="/"},reach:{...ie?{href:ie}:{},go:m=>ae(m.path)},standing:d,hostActions:e.hostActions,keeping:Fe?void 0:(0,h.jsx)(bo,{app:n,studio:e.studio,report:oe}),onFind:yt,switch:e.switch})}):null,(0,h.jsx)(jn.Provider,{value:ht,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)(po,{auto:S,scene:E!=="pages"&&E!=="picture"}),children:[E==="picture"?(0,h.jsx)(so,{scope:w,store:v,views:V,as:(o?nt(o).within?.view:void 0)??""}):E==="pages"?(0,h.jsx)(io,{store:v,views:V,presence:P,auto:S,brand:L,steering:Y,overview:Ne,scope:w,titleLevel:sr(b),quickAsk:at(e.quickAsk),props:{...e,onNavigate:le,...R?{}:{path:N.current.path}}}):(0,h.jsx)(Wn.Provider,{value:Ue,children:(0,h.jsx)(oo,{address:R,auto:S,scheme:T,scope:w,quickAsk:at(e.quickAsk)})}),(0,h.jsx)(fo,{asked:k,shown:E,onDrawn:mt})]})},E)})]})})})})]})]})}var qt=e=>e.split(/[?#]/)[0]===Se,Or=(0,c.createContext)(null);function yo({into:e}){return e.view=rt().view,null}function go({rootRef:e,face:n,shown:o,path:a,stop:d,draft:l,onDrawn:b,parts:p}){let{view:w}=rt(),A=o==="scene"||o==="graview",T=Ct(w),v={face:n,path:A?Se:o==="picture"?d??"#":a,stop:T};return mr(e,`${o} ${A?T:v.path} ${l}`,v,b,p),null}var lt,wo=Pe(()=>(__graviewPreload(import.meta.url,["./chunk.YUV7HZYG.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.7QW6JYGP.js"))),Ut=()=>wo().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(Ut));function vo({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 w=p.current.stop!==n,A=p.current.face!==e,T=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!A||e==="pages"||e==="picture")return;let v=(w||T)&&n!==void 0?Tr(e,n,o,a):T&&Zn(l)?Dt(e,Bt(d),o):e==="graview"?Lt(l,!0):l.overview?En(Lt(l,!1),zn(l,o)):l;b(v)},[e,n,o,l,b,d]),null}function bo({app:e,studio:n,report:o}){return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(c.Suspense,{fallback:null,children:(0,h.jsx)(ao,{})}),n!==!1?(0,h.jsx)(_e,{module:"@graview/studio",report:o,children:(0,h.jsx)(So,{app:e,studio:n})}):null]})}function So({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)(mo,{...o})})}function Po({path:e,stop:n,...o},a){return{...o,app:a.app,at:a.at,...a.remote.presence?{presence:a.remote.presence}:{}}}function Kt(e,n){let o=n.store??n.remote?.store??Xn(n.app,n.seed),a=n.notices??ot(),d=null,l={},b=0,p=n.label,w=n.app,A=Promise.resolve(),T=n.at?.face??n.face,v=T===void 0?void 0:Vt({...n,face:T}),P=v??Gt(n.stop),L=null,S=[],$=u=>{if(L=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),[F,de]=(0,c.useState)(n.path),[B,O]=(0,c.useState)(n.scheme??"auto"),[Ee,k]=(0,c.useState)(n.principal),[te,R]=(0,c.useState)(n.seats),[J,W]=(0,c.useState)(n.quickAsk),[ce,ve]=(0,c.useState)(n.people),[N,z]=(0,c.useState)(n.hostContext),[I,le]=(0,c.useState)(n.brand),[M,Ae]=(0,c.useState)(n.label),[Y,X]=(0,c.useState)(n.hostActions),[H,ue]=(0,c.useState)(void 0),[fe,re]=(0,c.useState)(n.draftView);return d={app:Q=>{ue(Q),de(void 0),K(void 0)},face:D,stop:K,path:de,scheme:O,seat:k,seats:R,quickAsk:W,people:ve,hostContext:z,brand:le,label:Ae,hostActions:X,draft:re},(0,h.jsx)(Or.Provider,{value:l,children:(0,h.jsx)(Fr,{...H?Po(n,H):n,store:o,notices:a,...u!==void 0?{face:u}:{},onOpening:Q=>{P=Q},...q!==void 0?{stop:q}:{},...F!==void 0?{path:F}:{},...Ee?{principal:Ee}:{},...te?{seats:te}:{},...J!==void 0?{quickAsk:J}:{},...ce?{people:ce}:{},...N?{hostContext:N}:{},...I?{brand:I}:{},label:M,hostActions:Y,draftView:fe,scheme:B,onFace:Q=>{P=Q,D(Q)},onSeat:k,onFaceDrawn:$},H?.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?Se:l.pages?.()??n.path??"/",stop:l.view?Ct(l.view):n.stop??"#",...D?{kind:D}:{}}},Z=(0,br.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,F=()=>{let de=V();o=K.store,p=q?.label??(p===w.name?u.name:p),w=u,(0,j.flushSync)(()=>{d?.label(p),d?.app({app:u,remote:K,at:de,n:++b})})};lt?F():A=A.then(Ut).then(F)},setFace:u=>{P=u,(0,j.flushSync)(()=>d?.face(u))},setStop:u=>(0,j.flushSync)(()=>d?.stop(u)),setPath:u=>(0,j.flushSync)(()=>{if(qt(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(()=>L===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 ut=e=>`s${(e+1).toString(36)}`;var Cr="/graview/live",Jt="graview.ship",Yt=`${Jt}.${Xe}`;var we={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"}},ke=e=>e?.lineage?{lineage:e.lineage}:{},ko=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
|
|
2
|
+
`)[0]??"":String(n)})`;function Eo(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"}},Ao={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},Le=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"}},Ro=new Set([502,503,504]);async function xo(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 Fo=1,Oo=()=>({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 ft(e){return(await Lr(e,Eo(e.carry),"This app was updated while your changes were on the way.",Oo())).remote}async function Lr(e,n,o,a){let d=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},b={...pt(e.principal),[we.via]:e.via??"web"};Object.assign(l,b);let p=e.live===!0,w=e.presenceEveryMs,A=e.visible??Mo,T="connecting",v=a.statuses,P=a.tally,L=[],S,$=[],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 L.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 $.splice(0))i();C&&clearTimeout(C),he()}},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 xo(s))return Z("online"),s;if(Ro.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()},F=e.state??await K(!0);p||(T="online"),S=typeof F.held=="string"&&F.held.length>0?F.held:void 0,D();let de=F.enabledModules??e.enabledModules,B=e.localApp?e.localApp(e.app):e.app,O=new wn({schema:B.schema,mutations:B.mutations??[],invariants:B.invariants??[],...B.policy?{policy:B.policy}:{},...B.publishing?{publishing:B.publishing}:{},...B.modules?{modules:B.modules}:{},...de?{enabledModules:de}:{},...B.intelligence?{intelligence:B.intelligence}:{},...B.brand?.timeZone?{timeZone:B.brand.timeZone}:{},snapshot:F.snapshot,log:F.log,...F.horizon!==void 0?{horizon:F.horizon}:{},ids:To(),...e.storeOptions??{}});hn.served.add(O);let Ee=yn(O),k=F.log.at(-1)?.seq??(F.horizon??0)-1,te=Rt.of(F.log,{horizon:F.horizon??0}),R=null,J,W=new Map,ce=a.who,ve=!1,N=t=>{if(se)return;ve=!0;let r=Sn(new Map,t,Date.now(),Ft,R?.participant);J!==void 0&&r.delete(J);let s=r.size!==W.size;if(!s)for(let[i,f]of r)Ot(f,W.get(i))||(s=!0);if(W=r,!!s)for(let i of[...ce])i([...W.values()])},z=[],I=new Set,le=t=>{let r=z.indexOf(t);r>=0&&z.splice(r,1)},M=new Map,Ae=(t,r)=>{let s=M.get(t);s&&(M.delete(t),s.resolve({ops:r.filter(i=>i.batch===t),batch:t}))},Y,X=[],H=(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(g=>g.seq>k).map(g=>g.seq));if(Number.isFinite(s)&&s>k+1)return X.push({ops:t,drop:r}),ue(),[];let i=z.filter(g=>t.some(be=>be.batch===g)),f=[...new Set([...r,...i])].filter(g=>I.has(g)),y,x=z.filter(g=>!i.includes(g));try{y=O.rebase({confirmed:t,pending:x,drop:f}).confirmed}catch(g){if(!(g instanceof gn))throw g;return X.push({ops:t,drop:r}),ue(),[]}for(let g of i)le(g);t.some(g=>g.seq>k)&&x.some(g=>!f.includes(g))&&P.rebases++,t.length>0&&(k=Math.max(k,...t.map(g=>g.seq)),te.note(t));for(let g of f)I.delete(g);for(let g of i)Ae(g,t);return y},ue=()=>{Y||(Y=oe(K().then(t=>{if(fe(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=Rt.of(t.log,{horizon:t.horizon??0}),P.resyncs++;for(let f of s)Ae(f,t.log)}).then(()=>{Y=void 0;let t=X;X=[];for(let{ops:r,drop:s}of t)H(r,s)},()=>{Y=void 0,X=[]})))},fe=t=>(typeof t.build=="string"&&nn(t.build),typeof t.version=="number"&&u(t.held),typeof t.version!="number"||t.version===F.version?!1:(bt(t.version),!0)),re=async t=>{let s=await(await q(`${e.url}/graview/since?seq=${ut(t)}&opFormat=${Ie.op}`,{headers:l})).json();return fe(s)?[]:s.reset===!0?(ue(),[]):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:ut(k)})})).json();return fe(r)?[]:(typeof r.participant=="string"&&(J=r.participant),N(r.who??[]),H(r.ops??[]))}return H(await re(k))},Re=new Map,E=new Map,xe=new Map,pe=new Set,oe=t=>(pe.add(t),t.finally(()=>pe.delete(t)).catch(()=>{}),t),Be=Promise.resolve(),Te=0,mt=(t,r)=>{let s=Be.then(()=>yt(t,r));return Be=s.catch(()=>{}),s},ht=()=>new Promise((t,r)=>L.push({again:t,give:r})),yt=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(g){if(!(g instanceof qe)||U)throw g;if(await ht(),_())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"?fe(i):(u(i.held),!1))break;if(S!==void 0&&(kt>0||p)){if(await new Promise(g=>$.push(g)),U)throw new Ve("The client closed.");if(_())return Ke(t,r);continue}}let x;if(s.status===503&&i.reason==="unavailable"&&!U)x=Qt(e.backoff,Te++);else{if(Te=0,s.status!==429||U)break;x=Co(s.headers.get("retry-after"),i.retryAfter)}if(await new Promise(g=>setTimeout(g,x)),_())return Ke(t,r)}if(se||fe(i))throw new Ve("The app was changed.");if(!s.ok){let x=i.error??`The server refused (${s.status})`;throw i.conflict?new Le(x,i.conflicts??[]):new De({reason:i.reason??Ao[s.status]??"invalid",sentence:x,...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&&Re.set(r,i.batch),le(r)),H(f,r!==void 0?[r]:[]),{ops:i.ops??[],...i.batch?{batch:i.batch}:{}}},G,ee=!1,U=!1,We=0,me,Ge=0,Ne=0,ae=null,Me=()=>{},Fe=new Promise(t=>{Me=t}),_=()=>p&&ee&&G?.readyState===Fo,ie=t=>{if(!_())return!1;try{return G.send(JSON.stringify(t)),!0}catch{return!1}},Ue=(t=!1)=>{!R||!_()||!A()||!t&&ae&&Ot(R,ae)&&(w===void 0||Date.now()-Ne<w)||ie({t:"here",presence:R})&&(ae=R,Ne=Date.now())},m=new Set,C,he=()=>{if(C=void 0,S!==void 0)return;let t=[...M.entries()].filter(([r])=>m.has(r));m.clear();for(let[,r]of t)ie(r.message)},tn=(t,r)=>{M.has(t)&&(m.add(t),C&&clearTimeout(C),C=setTimeout(he,Math.max(0,r)))},Vr=t=>{M.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}:{},...ke(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}:{},...ke(t)};if(M.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)}),gt=(t,r)=>_()?Ke(t,r):mt(t,r),Dr=t=>{switch(t.t){case"welcome":{if(nn(t.build),typeof t.version=="number"&&t.version!==F.version){bt(t.version);return}if(ee=!0,We=0,typeof t.participant=="string"&&(J=t.participant),u(t.held),t.state?ue():H(t.ops??[]),m.clear(),C&&clearTimeout(C),C=void 0,S!==void 0)for(let r of M.keys())m.add(r);else for(let r of M.values())ie(r.message);Ue(!0),Z("online"),Me();return}case"ops":H(t.ops??[]);return;case"ack":{let r=M.get(t.cid);if(!r){H(t.ops??[]);return}M.delete(t.cid),Te=0,r.mine!==void 0&&(Re.set(r.mine,t.batch),le(r.mine)),H(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"){S!==void 0?Vr(t.cid):tn(t.cid,Qt(e.backoff,Te++));return}M.delete(t.cid),r.reject(t.t==="conflict"?new Le(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"&&tn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":N(t.who??[]);return;case"held":u(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==F.version&&bt(t.version);return;case"reload":sn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&G){let r=G;cn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},se=!1,wt=a.declarations,vt=a.builds,nn=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[...vt])r(t)}},rn=()=>{let t=[],r=0;for(let s of z){let i=xe.get(s);i?t.push({calls:i.calls,...i.intent?{intent:i.intent}:{},...i.via?{via:i.via}:{},...ke(i),batch:s}):r++}return{carried:t,undos:r}},on=(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.`,an=t=>{se=!0,R=null;let r=new Ve(t);for(let i of M.values())i.reject(r);M.clear(),Qe&&clearInterval(Qe),U=!0,me&&clearTimeout(me),C&&clearTimeout(C),ye&&clearTimeout(ye);for(let i of L.splice(0))i.give(r);for(let i of $.splice(0))i();let s=G;G=void 0,ee=!1;try{s?.close(1e3,t)}catch{}Me()};async function bt(t){if(se)return;if(!e.resolveApp){sn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=rn(),i=e.resolveApp,f=R;an("The app was changed.");try{let y=await i(t),{state:x,...g}=e,be=await Lr({...g,app:y},r,"The app was changed while your changes were on the way.",a);f&&be.remote.presence.here(f);for(let Ze of[...wt])Ze(be.remote,t);let jr=[...s>0?[Je(on(s,"The app was changed"))]:[],...be.unheard()];for(let Ze of jr)for(let qr of He)qr(Ze.sentence,Ze)}catch(y){let x=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let g of He)g(x,Je(x))}}function sn(t){if(se)return;let{carried:r,undos:s}=rn();an(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(on(s,"This app was updated"));for(let y of f)for(let x of He)x(y,Je(y));(e.reloadPage??Lo)()}let dn=()=>{if(U||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${Cr}`,{"content-type":r,...s}=l,i;try{i=e.socket?e.socket(t,s,[Yt]):_r(t,s)}catch{return ln()}G=i,ee=!1,i.onopen=()=>{G===i&&i.send(JSON.stringify({t:"hello",seq:ut(k),protocol:Xe,wire:Jt,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=()=>cn(i),i.onerror=()=>{}},ye,Br=()=>{ve=!1,ye&&clearTimeout(ye),ye=setTimeout(()=>{if(ye=void 0,ve||U)return;let t=new Map([...W].filter(([,r])=>r.held!=="socket"));if(t.size!==W.size){W=t;for(let r of ce)r([...W.values()])}},Ft),ye.unref?.()};function cn(t){if(G!==t)return;let r=ee;G=void 0,ee=!1,ae=null,r&&(Z("offline"),Br()),ln()}let ln=()=>{if(U)return;let t=Qt(e.backoff,We);We++,me=setTimeout(dn,t)},Wr=O.applyAll.bind(O),Nr=O.undo.bind(O),$r=O.previewAll.bind(O);O.previewAll=(t,r)=>$r(t,{...e.principal?{author:e.principal}:{},...r});let He=a.refusals,$e=[],Je=t=>({reason:"invalid",sentence:t}),Ye=a.conflicts,St=!1,un=async(t,r)=>{if(r instanceof Ve||se)return;let s=r instanceof De?r.refusal:pn(r),i=s.sentence;le(t);try{H([],[t])}catch{}let f=xe.get(t);if(xe.delete(t),r instanceof Le&&P.conflicts++,r instanceof Le&&!_()&&await Q().catch(()=>[]),r instanceof Le&&Ye.size>0){let y=!1,x={sentence:i,conflicts:r.conflicts,keepTheirs(){y=!0},useMine(){if(!(y||!f)){y=!0,St=!0;try{O.applyAll(f.calls,{...f.intent?{intent:f.intent}:{},...f.via?{via:f.via}:{},...ke(f)})}finally{St=!1}}}};for(let g of Ye)g(x);return}for(let y of He)y(i,s)};O.applyAll=(t,r)=>{let s=mn(O.log.all().filter(x=>I.has(x.batch))),i=Wr(t,{...e.principal?{author:e.principal}:{},...r}),f=t.map((x,g)=>{let be=i.minted?.[g];return be===void 0||x.args?.id!==void 0?x:{...x,mintedHint:be}});z.push(i.batch),I.add(i.batch),xe.set(i.batch,{calls:f,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...ke(r)});let y=St?[]:te.baseFor(i.ops,s,(x,g)=>O.collaborative(x,g));return E.set(i.batch,oe(gt({calls:f,...r?.intent?{intent:r.intent}:{},batch:i.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...ke(r)},i.batch).catch(x=>un(i.batch,x)))),i},O.apply=(t,r)=>O.applyAll([t],r),O.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,i=Nr(s.map(y=>Re.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(()=>gt({undo:s.map(y=>Re.get(y)??y),...r?.intent?{intent:r.intent}:{},batch:i.batch,...r?.via?{via:r.via}:{},...ke(r)},i.batch)).catch(y=>un(i.batch,y)))),i};let Ir=async(t,r={})=>{Pt++;try{return(await oe(gt({calls:t,...r}))).ops}finally{Pt--}},Pt=0,fn={here(t){R=t,Ue()},onWho(t){return ce.add(t),W.size>0&&t([...W.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(()=>{})}},kt=e.pollMs??800,Qe=kt>0&&typeof setInterval=="function"?setInterval(()=>{_()||Q().catch(()=>{})},kt):null;if(p){dn();let t;await Promise.race([Fe,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}:{},...ke(s)})}catch(i){t.push(ko(s,i))}t.length>0&&$e.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:F.version,migrated:F.migrated??[],send:Ir,pull:Q,onRefusal(t){He.add(t);let r=$e;$e=[];for(let s of r)t(s.sentence,s);return()=>He.delete(t)},onDeclaration(t){return wt.add(t),()=>wt.delete(t)},onBuild(t){return vt.add(t),a.otherBuild!==void 0&&t(a.otherBuild),()=>vt.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:()=>[...W.values()],pending:()=>z.length+Pt,async settled(){for(;pe.size>0;)await Promise.allSettled([...pe])},presence:fn,close(){Qe&&clearInterval(Qe),Ee(),fn.leave(),U=!0,me&&clearTimeout(me),C&&clearTimeout(C),ye&&clearTimeout(ye);for(let r of L.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of $.splice(0))r();let t=G;G=void 0,ee=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=$e;return $e=[],t}};function _r(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?[Yt]:[];if(!i)try{return new s(t,{headers:r,...f.length>0?{protocols:f}:{}})}catch{}let y=new URL(t);for(let[x,g]of Object.entries(b))y.searchParams.set(x,g);return f.length>0?new s(y.toString(),f):new s(y.toString())}}function Co(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 Lo(){globalThis.location?.reload?.()}function Mo(){return globalThis.document?.visibilityState!=="hidden"}function Qt(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 pt(e){let n={};if(!e)return n;e.id&&(n[we.seat]=e.id),e.roles?.length&&(n[we.roles]=e.roles.join(",")),e.kind!=="human"&&(n[we.kind]=e.kind),e.name&&(n[we.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[we.for]=o.id),o?.roles?.length&&(n[we.forRoles]=o.roles.join(",")),o?.name&&(n[we.forName]=encodeURIComponent(o.name)),n}var Mr="/graview/views";function Zt(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),a={"content-type":"application/json",...e.principal?pt(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 L=await n(`${o}${e.path??Mr}`,{method:v,headers:a,...P!==void 0?{body:JSON.stringify(P)}:{}}),S=await L.json();if(!L.ok)throw new Error(S.error??`The store answered ${L.status}.`);b({hidden:S.hidden??[],removed:S.removed??[],may:S.may??et.may})},w=()=>p("GET"),A=e.state?Promise.resolve():w().catch(()=>{}),T=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:A,refresh:w,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(L=>L.name===v)?.lens;await p("POST",{restore:v}),P&&await e.onDeclaration?.()},async lens(v){await p("POST",{lens:v}),await e.onDeclaration?.()}}}var en=document.getElementById("graview-app"),Xt=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),Hr=Xt?(__graviewPreload(import.meta.url,["./chunk.UDTBFAS5.js","./chunk.3SY6WWWQ.js","./chunk.UGFDSE37.js","./chunk.ATWNWPME.js","./chunk.GZEZMU2T.js","./chunk.4VJARLJ5.js","./chunk.5RNB6IC5.js","./chunk.ZITDUHX3.js","./chunk.ETWREHXF.js","./chunk.YZ6UKKEL.js","./chunk.FFPG4PHX.js","./chunk.3L5USMQD.js","./chunk.GTUBIJTP.js","./chunk.DUIKIJKC.js","./chunk.73BJYIYS.js","./chunk.OKQ4JXTW.js","./chunk.M5RHVUZ6.js","./chunk.MRUDTYOL.js","./chunk.OUNLAMBA.js","./chunk.HGP3Q7QX.js","./chunk.QSZLY62B.js","./chunk.7VX6TBNY.js","./chunk.XOZU4OFA.js","./chunk.CR5MQMOL.js","./chunk.MB7LKKUD.js","./chunk.AXCRFJDL.js","./chunk.S64LCR23.js","./chunk.WVUJXDXZ.js","./chunk.6SHF6IL5.js","./chunk.MQISKON2.js","./chunk.GQX57JIE.js","./chunk.LJXAZ5TF.js","./chunk.QFI4L2HK.js","./chunk.KFHXTHIY.js","./chunk.GZHZLJBF.js","./chunk.JLR74UFP.js","./chunk.OJGHDWI6.js","./chunk.HG34MT7C.js","./chunk.TT6QBWRA.js","./chunk.UCS3CBT4.js","./chunk.O6SKKF4V.js","./chunk.ZK446PSX.js","./chunk.SGMVLKZO.js","./chunk.SDO3U72B.js","./chunk.BLS2G3CD.js","./chunk.EJUZGIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.UOC3SIYT.js")):Ce("pages");try{Xt?await Ho(decodeURIComponent(Xt[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),en.replaceChildren(n),window.__graviewFailed=n.textContent}async function Ho(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 ft({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 Hr;window.__graview=p(en,{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 w=>{if(typeof w.module=="string")return(await import(w.module)).app;let A=await it(w);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 ft({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=Zt({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 A=await it(w);A.ok&&b?.setApp(A.app,l)}});await Promise.all([Hr,p.ready]),b=Kt(en,{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})}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graview",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.50",
|
|
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.
|
|
33
|
-
"@graview/
|
|
34
|
-
"@graview/
|
|
35
|
-
"@graview/
|
|
36
|
-
"@graview/
|
|
32
|
+
"@graview/core": "0.1.50",
|
|
33
|
+
"@graview/guest": "0.1.50",
|
|
34
|
+
"@graview/ship": "0.1.50",
|
|
35
|
+
"@graview/skills": "0.1.50",
|
|
36
|
+
"@graview/tools": "0.1.50"
|
|
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"./chunk.5A4AOFOA.js";import"./chunk.NB6WN4DO.js";import"./chunk.MTXEURFE.js";import{a as L,b as R,c as E}from"./chunk.5IPH2SCE.js";import{b as T}from"./chunk.44G5A53D.js";import"./chunk.X7N3JUO4.js";import"./chunk.NTLHEHOM.js";import"./chunk.V2GSBYDK.js";import"./chunk.GNBN3BK7.js";import"./chunk.XTMOFRHL.js";import"./chunk.NLBIX7LH.js";import"./chunk.GACKGEUY.js";import"./chunk.HJCQ6I3S.js";import"./chunk.KVEDIBXS.js";import"./chunk.7VT3TRHR.js";import"./chunk.DAUC2DFY.js";import"./chunk.GTPC6JOW.js";import"./chunk.7FRPNQU4.js";import"./chunk.BDHKWVNX.js";import"./chunk.ZH4NWRWB.js";import"./chunk.2GLJH253.js";import"./chunk.GUMJEVVP.js";import"./chunk.4VW6THJF.js";import"./chunk.SAHNXAV3.js";import"./chunk.DHAK6PPX.js";import"./chunk.YDL5BSTG.js";import"./chunk.DUWYF7BO.js";import"./chunk.UGJSMNVO.js";import"./chunk.NR5ODXMO.js";import"./chunk.E5GM2SMO.js";import"./chunk.NQZ73QV7.js";import"./chunk.O45VO36H.js";import"./chunk.UT6642FC.js";import"./chunk.NX7IIZLO.js";import"./chunk.XOZU4OFA.js";import"./chunk.SUPWMV2F.js";import"./chunk.TI4OSTQV.js";import"./chunk.MAFFUPCR.js";import"./chunk.WVUJXDXZ.js";import"./chunk.TPG6IY4M.js";import"./chunk.NFDLCUCC.js";import"./chunk.X7JMJSLU.js";import"./chunk.PPRSGM64.js";import"./chunk.5Y3Q7ONN.js";import"./chunk.KTFUVR4V.js";import"./chunk.GZHZLJBF.js";import{r as C}from"./chunk.RQBEQYB2.js";import"./chunk.OJGHDWI6.js";import"./chunk.6VAFNCR4.js";import"./chunk.N4M54YK6.js";import"./chunk.KVJFY7N5.js";import"./chunk.DPHTUTOS.js";import"./chunk.2UIUMG23.js";import{G as S,I as $,R as p,_ as x,aa as A}from"./chunk.KA44WNB4.js";import"./chunk.SDO3U72B.js";import{ca as h,xc as k}from"./chunk.4TJOS4C7.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"./chunk.2UIUMG23.js";import{$ as H,G as U,O as N,P as I,R as B}from"./chunk.KA44WNB4.js";import"./chunk.SDO3U72B.js";import{R as W,Xa as z,xc as $}from"./chunk.4TJOS4C7.js";import"./chunk.2AZTW66C.js";import{b as O}from"./chunk.AJZBJBMO.js";function x(n,t){return n.kind==="agent"?"agent":n.kind!=="human"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var X=n=>n.ops.filter(t=>t.withheld!==!0);function L(n,t={}){let r=n.batches().map(e=>{let o=e.ops[0],l=e.ops.at(-1),c=X(e).length===0;return{seq:l.seq+1,from:o.seq,at:l.at,batch:e.id,maker:c?"person":x(e.author,t.me),author:c?void 0:e.author,said:e.intent,declaration:!1,withheld:c}}),s=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of s){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let o=r.findIndex(l=>l.seq===e.seq);if(o>=0&&!r[o].withheld){r[o]={...r[o],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?x(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,o)=>e.seq-o.seq||+(e.batch!==void 0)-+(o.batch!==void 0))}function V(n,t){let r=n.log.all(),s=new Map(r.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(o=>o.undoes!==void 0&&(s.get(o.undoes)??-1)>=t)).map(e=>e.id)}function _(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?z(n.author,t):"the app"}var d=O(U(),1);var i=O(B(),1),J={kind:"human"},Q=[1,2,4,8],Z=900,T={you:"You",person:"A person",agent:"An agent",app:"The app"},F={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function ee(n,t,r){let s=r?Array.from({length:t},(e,o)=>o):[];return[...new Set([...s,t,...n.map(e=>e.seq)])].sort((e,o)=>e-o)}function te(n,t){let r=n.withheld===!0;return{seq:n.seq+1,from:n.seq,at:n.at,batch:n.batch,maker:r?"person":x(n.author,t),author:r?void 0:n.author,said:n.batchIntent??n.intent,declaration:!1,withheld:r}}function ne(n,t){let r=0;for(let s=0;s<n.length;s++)n[s]<=t&&(r=s);return r}function ae(n,t,r){let s=V(n,t);if(s.length===0)return null;let e=n.canUndo(s);if(!e.ok)return null;let o=new Set(n.permittedMutations(r).map(l=>l.name));return e.ops.every(l=>l.mutation!==null&&o.has(l.mutation.name))?s:null}function ce({face:n}){let t=N(),r=H(),s=r?.principal??J,e=I(t.live,s),o=e.log.length,l=(0,d.useMemo)(()=>L(e,{me:s,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,s,t.host,o]),c=e.log.horizon,b=c>0&&t.host?.archived!==void 0,h=(0,d.useMemo)(()=>ee(l,c,b),[l,c,b]),f=t.archive,p=f?.seq??t.past?.seq??o,v=ne(h,p),m=h.length-1,D=p<c&&t.past?.seq===p?t.past.store.log.all().at(-1):void 0,w=D?te(D,s):p<c?void 0:[...l].reverse().find(a=>a.seq<=p&&a.seq>(h[v-1]??-1))??[...l].reverse().find(a=>a.seq<=p),[k,P]=(0,d.useState)(!1),[q,K]=(0,d.useState)(1),[R,M]=(0,d.useState)(null);(0,d.useEffect)(()=>{if(!k)return;if(v>=m){P(!1);return}let a=setTimeout(()=>t.show(h[v+1]),Z/q);return()=>clearTimeout(a)},[k,v,m,q,h,t]);let E=(0,d.useMemo)(()=>t.past&&!f&&p>=c?ae(e,p,s):null,[t.past,f,e,p,c,s,o]),j=a=>_(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),y=t.past?t.past.at?W(t.past.at,r?.locale):"the start":null,A=f?f.refused?"The archive could not be read":"Reading the older changes from the archive\u2026":w?`${j(w)==="you"?"You":j(w)}: ${w.said}`:"Nothing had happened yet",C=(0,d.useRef)(null);(0,d.useLayoutEffect)(()=>{let a=C.current,g=a?.parentElement;if(n!=="scene"||!a||!g)return;let u=()=>g.style.setProperty("--graview-sheet",`${Math.ceil(a.getBoundingClientRect().height)+24}px`);u();let S=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return S?.observe(a),()=>{S?.disconnect(),g.style.removeProperty("--graview-sheet")}},[n]);let Y=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:$("rail")}:{position:"sticky",top:0,zIndex:$("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,i.jsxs)("section",{ref:C,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...Y,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,i.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:f?"Archived changes":y?`As of ${y}`:"Now"}),(0,i.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:A}),y?(0,i.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,i.jsxs)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:[b?(0,i.jsx)("span",{"data-testid":"timeline-archived",title:"Changes read from the archive as you scrub back",style:{position:"absolute",left:0,bottom:0,height:6,width:`${m===0?0:h.indexOf(c)/m*100}%`,borderRadius:2,background:"var(--graview-edge)"}}):null,h.slice(1).map((a,g)=>{let u=[...l].reverse().find(G=>G.seq===a);if(!u)return null;let S=m===0?0:(g+1)/m*100;return(0,i.jsx)("span",{"data-graview-tick":a,"data-maker":u.maker,...u.declaration?{"data-declaration":""}:{},title:`${T[u.maker]}: ${u.said}`,style:{position:"absolute",left:`calc(${S}% - 1px)`,bottom:0,width:u.declaration?4:2,height:u.declaration?22:12,borderRadius:2,background:u.declaration?"var(--graview-ink)":F[u.maker],opacity:a<=p?1:.45}},`${a}:${u.batch??"declaration"}`)})]}),(0,i.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:m,step:1,value:v,"aria-valuetext":y?`As of ${y}. ${A}`:`Now. ${A}`,onChange:a=>{P(!1),t.show(h[Number(a.currentTarget.value)]??o)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,i.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,i.jsx)("button",{type:"button","data-testid":"play","aria-pressed":k,onClick:()=>{!k&&v>=m&&t.show(h[0]),P(!k)},style:{minHeight:28,minWidth:64},children:k?"Pause":"Play"}),(0,i.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,i.jsx)("select",{"data-testid":"speed",value:q,onChange:a=>K(Number(a.currentTarget.value)),style:{minHeight:28},children:Q.map(a=>(0,i.jsxs)("option",{value:a,children:[a,"\xD7"]},a))})]}),(0,i.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(T).filter(a=>l.some(g=>g.maker===a)).map(a=>(0,i.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,i.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:F[a]}}),T[a]]},a))}),(0,i.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[E?(0,i.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{M(null);try{e.undo([...E],{author:s,intent:y?`Restore to ${y}`:"Restore"}),t.show(null)}catch(a){M(a instanceof Error?a.message:String(a))}},style:{minHeight:28},children:"Restore to here"}):null,(0,i.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),R?(0,i.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:R}):null,f?.refused?(0,i.jsx)("span",{role:"alert","data-testid":"archive-refused",style:{color:"var(--graview-warn)"},children:f.refused}):null,c>0&&!b?(0,i.jsx)("span",{"data-testid":"timeline-horizon",style:{color:"var(--graview-ink-faint)"},children:"The changes before the timeline's start were archived."}):null]})}export{ce as Timeline};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import"./chunk.GZHZLJBF.js";import{n as P}from"./chunk.RQBEQYB2.js";import"./chunk.OJGHDWI6.js";import"./chunk.6VAFNCR4.js";import"./chunk.N4M54YK6.js";import"./chunk.KVJFY7N5.js";import"./chunk.DPHTUTOS.js";import"./chunk.2UIUMG23.js";import{$ as b,G as A,R as S}from"./chunk.KA44WNB4.js";import"./chunk.SDO3U72B.js";import{Ba as w,oa as L,wc as x}from"./chunk.4TJOS4C7.js";import"./chunk.2AZTW66C.js";import{b as R}from"./chunk.AJZBJBMO.js";var u=R(A(),1);var n=R(S(),1),C={kind:"human"},p={color:"var(--graview-ink-muted)"};function I(e){if(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}return L(e)?e:void 0}}function z(e){let o=b(),t=o?.linkedReads,[i,a]=(0,u.useState)(()=>t?t.answered(e)??"asking":null);return(0,u.useEffect)(()=>{if(!t){a(o?.linkedRecords?"asking":null);return}let d=t.answered(e);if(a(d===void 0?"asking":d),d!==void 0)return;let s=!0;return t.ask(e).then(l=>s&&a(l)),()=>{s=!1}},[t,o?.linkedRecords,e.address,e.kind,e.id]),i}function V({reference:e,as:o}){let t=b(),i=z(e),a={position:"relative",zIndex:x.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%"};if(i==="asking")return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"asking","aria-busy":"true",style:{...p,...a},children:"Linked record"});if(i&&"denied"in i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"denied",style:{...p,fontStyle:"italic",...a},children:"linked record (no access)"});if(!i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"missing",style:{...p,fontStyle:"italic",...a},children:"linked record (not found)"});let d=I(i.href),s=t?.linkedRecords,l=t?.principal??C,g=s?.open?c=>{c.metaKey||c.ctrlKey||(c.preventDefault(),s.open(e,l))}:void 0,k=(0,n.jsx)("a",{"data-graview-linked-title":"",...d?{href:d}:{role:"link",tabIndex:0},...g?{onClick:g,onKeyDown:c=>!d&&(c.key==="Enter"||c.key===" ")?g(c):void 0}:{},style:{fontWeight:600,color:"inherit",textUnderlineOffset:3,cursor:d||g?"pointer":"default"},children:i.label});return o==="chip"?(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"found",title:i.describe,style:{display:"inline-flex",alignItems:"center",minHeight:24,...a},children:k}):(0,n.jsx)(D,{record:i,title:k,base:a})}function D({record:e,title:o,base:t}){return(0,n.jsxs)("span",{"data-graview-linked":"","data-graview-linked-state":"found",style:{display:"grid",gap:2,padding:"8px 10px",border:"1px solid var(--graview-line)",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-surface)",...t},children:[(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"2px 8px"},children:[o,e.app?(0,n.jsxs)("span",{"data-graview-linked-app":"",style:{...p,fontSize:"0.75rem"},children:["in ",e.app]}):null]}),e.describe?(0,n.jsx)("span",{"data-graview-linked-describe":"",style:{...p,fontSize:"0.8125rem"},children:e.describe}):null,e.card&&e.card.length>0?(0,n.jsx)("span",{"data-graview-linked-card":"",style:{display:"flex",flexWrap:"wrap",gap:"2px 12px",fontSize:"0.8125rem"},children:e.card.map(i=>(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{style:p,children:i.label})," ",i.text]},i.label))}):null]})}function H({relation:e,refs:o,as:t="record",nodeId:i,field:a,style:d}){let s=(0,n.jsx)("span",{"data-graview-linked-list":"",style:{display:"grid",gap:6,minWidth:0,...d},children:o.map(l=>(0,n.jsx)(V,{reference:l,as:t},w(l)))});return i&&a?(0,n.jsx)(K,{nodeId:i,field:a,relation:e,refs:o,drawn:s}):s}function K({nodeId:e,field:o,relation:t,refs:i,drawn:a}){let{fields:d,commit:s}=P(e),l=d.find(f=>f.field===o),[g,k]=(0,u.useState)(!1);if(!l)return a;let c=t.cardinality==="one"?i[0]?w(i[0]):void 0:i.map(w);return(0,n.jsxs)("span",{style:{display:"grid",gap:6,minWidth:0},children:[a,g?(0,n.jsx)(N,{relation:t,value:c,label:"Link another record",onChange:f=>{s(l,f),k(!1)},onCancel:()=>k(!1)}):(0,n.jsx)("button",{type:"button","data-graview-linked-change":"",onClick:()=>k(!0),style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-accent)",cursor:"pointer",minHeight:24},children:"Change"})]})}function N({relation:e,value:o,onChange:t,onCancel:i,label:a}){let d=b(),s=d?.linkedRecords,l=d?.principal??C,g=(0,u.useId)(),[k,c]=(0,u.useState)(""),[f,m]=(0,u.useState)("asking");(0,u.useEffect)(()=>{if(!s)return;let r=!0;m("asking");let y=setTimeout(()=>{Promise.resolve().then(()=>s.find({address:e.address,kinds:e.kinds,query:k,limit:20},l)).then(h=>r&&m(Array.isArray(h)?h:"denied"),()=>r&&m([]))},150);return()=>{r=!1,clearTimeout(y)}},[s,e.address,e.kinds.join(","),k,l.kind,l.id]);let v=new Set([o].flat().filter(r=>typeof r=="string")),W=r=>{let y=w(r);if(e.cardinality==="one")return t(y);t(v.has(y)?[...v].filter(h=>h!==y):[...v,y])};return s?(0,n.jsxs)("span",{"data-graview-linked-picker":"",style:{display:"grid",gap:6,minWidth:0},children:[(0,n.jsx)("label",{htmlFor:g,style:{...p,fontSize:"0.8125rem"},children:a}),(0,n.jsx)("input",{id:g,type:"search",value:k,placeholder:`Find one in ${e.address}`,onChange:r=>c(r.target.value),style:{font:"inherit",minHeight:32,padding:"4px 8px",border:"1px solid var(--graview-line)",borderRadius:6,background:"var(--graview-surface)",color:"inherit",minWidth:0}}),f==="asking"?(0,n.jsx)("span",{"aria-busy":"true",style:p,children:"Looking\u2026"}):f==="denied"?(0,n.jsx)("span",{"data-graview-linked-state":"denied",style:{...p,fontStyle:"italic"},children:"linked record (no access)"}):f.length===0?(0,n.jsx)("span",{style:p,children:"Nothing there matches."}):(0,n.jsx)("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:4},children:f.map(r=>{let y=v.has(w(r));return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-graview-linked-candidate":w(r),"aria-pressed":y,onClick:()=>W(r),style:{display:"grid",gap:2,width:"100%",textAlign:"start",font:"inherit",padding:"6px 8px",minHeight:32,border:"1px solid var(--graview-line)",borderRadius:6,background:y?"var(--graview-accent-soft, var(--graview-surface))":"var(--graview-surface)",color:"inherit",cursor:"pointer"},children:[(0,n.jsx)("span",{style:{fontWeight:600},children:r.label}),r.describe?(0,n.jsx)("span",{style:{...p,fontSize:"0.8125rem"},children:r.describe}):null]})},w(r))})}),i?(0,n.jsx)("button",{type:"button",onClick:i,style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-ink-muted)",cursor:"pointer",minHeight:24},children:"Keep it as it is"}):null]}):(0,n.jsxs)("span",{"data-graview-linked-picker":"","data-graview-linked-state":"no-host",style:p,children:["This page cannot read ",e.address,", so nothing there can be linked here."]})}var U=e=>(0,n.jsx)(H,{...e}),j=e=>(0,n.jsx)(N,{...e});export{N as LinkedPicker,H as LinkedRecordView,j as drawLinkedPicker,U as drawLinkedRecord};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as Se,b as Ke,c as Me,d as le,e as R,f as pe,h as Te}from"./chunk.HG4DDNPG.js";import{h as Ge,i as Ce,j as _e}from"./chunk.X7JMJSLU.js";import{a as oe,b as se,c as H,d as Pe,e as Y,g as ee,h as Ne}from"./chunk.5Y3Q7ONN.js";import{c as Fe,h as z,i as De,j as de}from"./chunk.KTFUVR4V.js";import{A as xe,Aa as Ee,Ha as Ae,Ia as Q,Ja as ae,Mb as ce,Nb as Re,b as U,c as B,e as je,f as Oe,g as q,h as O,k as C,l as J,m as _,n as ve,o as L,p as K,r as $,s as X,t as x,u as E,v as V,w as T,x as n,y as M,z as W}from"./chunk.4TJOS4C7.js";var rn=e=>Object.entries(e).map(([s,r])=>[s,Object.keys(Q(r?.edges))]),fe=(e,s)=>Re(e,rn(s));var ge="graview-document",ze=1,ye=256*1024,ne=64*1024,ue=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,me=/^[a-z][A-Za-z0-9]*$/,an=new Set(["id","kind"]),cn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,dn=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function ln(){let e=k=>k in Object.prototype,s=W(k=>!e(k),"every object already has this name \u2014 choose another"),r=(k,N)=>[...k===void 0?[]:[Oe(k)],...N===void 0?[]:[je(N)]],t=(k,N)=>O().check(...r(k,N)),a=(k,N,sn)=>K(k).check(...r(N,sn)),d=k=>O().check(q(ue,`${k} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=O().check(q(cn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=O().check(q(me,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),W(k=>!an.has(k),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),h=t(1,500),i=t(1,2e3),o=t(1,300),p=$({type:V(dn),required:n(_()),description:n(h),label:n(t(1,60)),options:n(a(t(1,80),1,100)),of:n(V(["string","number","date","image","video","file"])),default:n(L()),unit:n(t(void 0,12)),format:n(V(["money","percent","duration","markdown"])),min:n(C()),max:n(C()),step:n(C()),renamedFrom:n(O().check(q(me))),repeats:n(_())}).check(xe((k,N)=>{k.type==="enum"&&!k.options&&N.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),k.type!=="enum"&&k.options&&N.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),k.type!=="list"&&k.of&&N.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),k.repeats&&k.type!=="date"&&k.type!=="datetime"&&N.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),w=O().check(q(new RegExp(`${ue.source}|${Ee.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),m=$({to:x([a(w,1),T("*")]),cardinality:n(V(["one","many"])),description:n(h),inverse:n(t(1,80)),appendOnly:n(_()),renamedFrom:n(O()),tidying:n(T("never"))}),l=x([i,$({expr:i,label:n(t(1,60)),description:n(h)})]),c=$({noun:n(t(1,40)),plural:n(t(1,40)),description:n(h),fields:E(f,p).check(W(k=>Object.keys(k).length>0,"a kind has at least one field")),label:n(o),describe:n(o),lifecycle:n($({field:f,retired:a(x([O(),C(),_()]),1)})),figure:n(t(void 0,2e4)),glance:n(a(f,1,20)),page:n($({fields:n(a(f,1,40)),groups:n(a($({title:t(1,60),fields:a(f,1,40)}),1,12))})),edges:n(E(u,m)),computed:n(E(O(),l).check(W(k=>Object.keys(k).length<=20,"a kind works out at most 20 computed fields"))),fieldRoles:n(E(O(),O())),renamedFrom:n(O().check(q(ue))),people:n(_()),archives:n(T(!1)),tidying:n(V(["never","no-links"]))}),j=x([O(),C(),_(),ve(),K(L()),$({expr:i})]),y=O().check(q(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),S=x([$({create:d("kind"),as:n(O().check(q(me))),set:n(E(f,j))}),$({set:E(f,j),target:n(y)}),$({connect:u,from:y,to:y}),$({sever:u,from:y,to:y}),$({remove:y})]),A=$({title:n(t(1,80)),description:n(h),fromTheOtherEnd:n(t(1,80)),on:n(x([d("kind"),a(d("kind"),1)])),creates:n(d("kind")),sets:n(E(f,j)),writes:n(a(f,1)),connects:n(u),severs:n(u),setsOther:n(E(f,j)),replaces:n(x([T(!0),a(u,1,10)])),removes:n(T(!0)),args:n(E(f,p)),effects:n(a(S,1,20)),allowedWhen:n(i),refusal:n(o),destructive:n(_())}),b=$({act:d("act"),label:n(t(1,80)),args:n(E(O(),j))}),G=$({title:n(t(1,120)),description:n(h),over:x([T("graph"),d("kind")]),when:n(i),require:i,says:n(o),repairs:n(a(b,void 0,10))}),F=$({roles:x([a(d("role"),1),T("*")]),mutations:x([a(d("act"),1),T("*")]),kinds:n(x([K(d("kind")),T("*")])),describe:n(h),self:n(_()),ownEnd:n(_())}),g=n(a(d("field"),1)),v=$({roles:x([a(d("role"),1),T("*")]),kinds:a(d("kind"),1),own:n(_()),via:n(u),fields:g,hide:g}),D=$({grants:K(F),sees:n(K(v))}),te=$({accent:n(O().check(q(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),name:n(t(1,60)),currency:n(O().check(q(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(t(2,35)),timeZone:n(t(1,64)),logo:n(x([t(1,ne),$({src:t(1,ne),alt:n(t(1,120))}),$({light:t(1,ne),dark:n(t(1,ne)),alt:n(t(1,120)),darkFallback:n(T("invert"))})])),favicon:n(x([t(1,ne),$({emoji:O()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(C().check(B(0),U(32))),density:n(C().check(B(.75),U(1.5)))})),accents:n(E(O(),C().check(B(0),U(360)))),scheme:n(V(["light","dark","auto"])),subtitle:n(T(!1))}),I=E(O(),L()),Z=x([t(1,120),$({by:t(1,120),direction:n(V(["asc","desc"]))})]),$e=C().check(J(),B(1),U(9999)),Xe=X({create:n(_()),options:n(X({sort:n(Z),columnSort:n(Z),search:n(a(t(1,120),void 0,40)),filters:n(a(t(1,120),void 0,40)),horizon:n(x([C().check(J(),B(1),U(200)),X({years:C().check(J(),B(1),U(200)),title:t(1,80),from:n($e),to:n($e)})]))}))}),Qe=$({card:n(K(L())),row:n(K(L())),page:n(K(L()))}),en=()=>{let k=n(V(["asc","desc"]));return x([t(1,120),$({by:t(1,120),direction:k,then:n(x([t(1,120),$({by:t(1,120),direction:k})]))})])},nn=()=>x([t(1,120),$({by:t(1,120),order:n(a(t(1,80),void 0,40)),closed:n(a(t(1,80),void 0,40))})]),we=X({order:n(K(O())),hide:n(K(O())),first:n(O()),primary:n(a(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(E(O(),$({filters:n(a(t(1,120),void 0,40)),sort:n(en()),group:n(nn())})))}),tn=$({act:d("act"),title:n(t(1,80)),intro:n(h),fields:n(a(f,1,40)),say:n(h),submit:n(t(1,80)),role:n(d("role"))}),on=$({$schema:n(O()),format:T(ge),formatVersion:T(ze),name:t(1,80),description:n(h),version:n(C().check(J(),B(1))),kinds:E(d("kind"),c).check(W(k=>Object.keys(k).length>0,"a document declares at least one kind"),W(k=>Object.keys(k).length<=40,"a document declares at most 40 kinds")),computed:n(E(O(),l)),acts:n(E(d("act"),A)),rules:n(E(d("rule"),G)),roles:n(K(d("role"))),policy:n(D),modules:n(I),lenses:n(K(Xe)),pages:n(we),views:n(E(O(),x([Qe,K(L())]))),brand:n(te),settings:n(K(I)),migrations:n(K(I)),connections:n(E(d("connection"),I)),forms:n(E(d("form"),tn))});return{FieldSpec:p,EdgeSpec:m,ComputedSpec:l,KindSpec:c,ValueSpec:j,EffectSpec:S,ActSpec:A,RepairSpec:b,RuleSpec:G,GrantSpec:F,SightSpec:v,PolicySpec:D,BrandSpec:te,PagesSpec:we,DocumentSpec:on}}var pn,P=()=>pn??=ln(),vn=M(()=>P().FieldSpec),xn=M(()=>P().EdgeSpec),En=M(()=>P().ComputedSpec),An=M(()=>P().KindSpec),Rn=M(()=>P().ValueSpec),Fn=M(()=>P().EffectSpec),Dn=M(()=>P().ActSpec),Kn=M(()=>P().RepairSpec),Mn=M(()=>P().RuleSpec),Tn=M(()=>P().GrantSpec),Pn=M(()=>P().SightSpec),Gn=M(()=>P().PolicySpec),Cn=M(()=>P().BrandSpec),_n=M(()=>P().PagesSpec),qe=M(()=>P().DocumentSpec);var fn={};function Ie(e,s=fn,r=ze){let{document:t,respelled:a}=Se(e),d=a.length>0?{respelled:a}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==ge||typeof u.formatVersion!="number"||u.formatVersion>=r)return{document:t,...d};let f=u.formatVersion,h=structuredClone(u);for(let i=f;i<r;i++){let o=s[i];if(!o)throw new Error(`there is no upgrade from format ${i} to ${i+1}`);h={...o(h),formatVersion:i+1}}return{document:h,from:f,...d}}function Ve(e,s,r){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let a=t.map(f=>e[f].edges[s].to),d=a.some(f=>f==="*")?"*":[...new Set(a.flatMap(f=>f))];if(r.length===0||r.some(f=>t.includes(f)))return{reversed:!1,kinds:d};let u=t.filter(f=>{let h=e[f].edges[s].to;return h==="*"||r.every(i=>h.includes(i))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:d}}var Ue=(e,s)=>{let r=e?.fields[s];return r!==void 0&&(r.type==="duration"||(r.type==="number"||r.type==="integer")&&r.format==="duration")};function Be(e,s,r,t){if(t==="out"){let a=e[s]?.edges?.[r]?.to;return a===void 0?[]:a==="*"?Object.keys(e):a}return Object.entries(e).filter(([,a])=>{let d=a.edges?.[r]?.to;return d!==void 0&&(d==="*"||d.includes(s))}).map(([a])=>a)}function he(e,s,r){if(r.t==="ident")return e[s]?.edges?.[r.name]?Be(e,s,r.name,"out"):void 0;if(r.t==="where")return he(e,s,r.set);if(r.t==="call"&&(r.fn==="out"||r.fn==="in")&&r.args[0]?.t==="lit"&&typeof r.args[0].value=="string")return Be(e,s,r.args[0].value,r.fn)}var Le=(e,s,r)=>{let t=s.filter(a=>e[a]?.fields[r]!==void 0);return t.length>0&&t.every(a=>Ue(e[a],r))};function We(e,s,r){let t=e.kinds,a=t[s],d=new Map(r),u=new Map,f=(i,o)=>{if(o>8)return!1;switch(i.t){case"ident":return Ue(a,i.name)||h(i.name,o+1);case"member":{let p=he(t,s,i.object);return p!==void 0&&Le(t,p,i.name)}case"call":{if(i.fn!=="sum"&&i.fn!=="min"&&i.fn!=="max")return!1;let[p,w]=i.args,m=p&&he(t,s,p);return m!==void 0&&w?.t==="ident"&&Le(t,m,w.name)}case"binary":return(i.op==="+"||i.op==="-")&&f(i.left,o)&&f(i.right,o);case"unary":return i.op==="-"&&f(i.operand,o);default:return!1}},h=(i,o)=>{if(a?.computed?.[i]===void 0)return!1;if(u.has(i))return u.get(i);u.set(i,!1);let p=d.get(i),w=p!==void 0&&f(p,o);return u.set(i,w),w};return r.map(([i])=>i).filter(i=>h(i,0))}function Ze(e,s,r=`kinds.${e}.page`){let t=s.page;if(!t)return[];let a=[],d=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(i,o)=>{d.includes(i)?u.has(i)&&a.push(z("page-field-twice",o,`"${i}" is on ${e}'s page twice; name each field once`)):a.push(z("page-field",o,`${e}'s page is to show "${i}", and ${e} has no field or computed field called that`,`use one of: ${d.join(", ")}`)),u.add(i)};(t.fields??[]).forEach((i,o)=>f(i,`${r}.fields.${o}`));let h=new Set;return(t.groups??[]).forEach((i,o)=>{let p=i.title.trim().toLowerCase();h.has(p)&&a.push(z("page-group-twice",`${r}.groups.${o}.title`,`${e}'s page has two groups called "${i.title}"; give each its own title`)),h.add(p),i.fields.forEach((w,m)=>f(w,`${r}.groups.${o}.fields.${m}`))}),a}function He(e,s=[]){let r=Object.keys(e.fields),t=[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(f=>f.fields)].filter(f=>Object.hasOwn(e.fields,f)),a=[...new Set([...t,...r])],d=f=>!!e.fields[f].required&&e.fields[f].default===void 0,u=s.filter(f=>Object.hasOwn(e.fields,f));return[...new Set([...u,...a.filter(d),...a])]}var un=new Set(["subject","now","today","me"]);function mn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>ye)return{findings:[z("too-large","",`a document may be at most ${ye/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[z("not-json","",`this is not JSON: ${t.message}`)]}}try{e=Ie(e).document}catch(t){return{findings:[z("format","formatVersion",t.message)]}}let s=qe.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let a=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return z("unknown-key",a,`${t.keys.map(d=>`"${d}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(a))return z("effect-shape",a,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let d=t.issues?.[0]?.message;return z("shape",a,`the name "${String(t.path.at(-1))}" is not allowed here${d?`: ${d}`:""}`)}return z("shape",a,t.message)})};let r=s.data;return{document:r,findings:gn(r)}}var re=e=>[e??[]].flat();function Ye(e){let s=new Map;for(let[r,t]of Object.entries(e.kinds))for(let[a,d]of Object.entries(Q(t.edges))){let u=s.get(a);s.set(a,{name:a,from:[...u?.from??[],r],to:d.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...d.to])],cardinality:d.cardinality??"many"})}return s}function ut(e){let s=new Map;for(let[t,a]of Object.entries(e.kinds)){let d=ee(a),u=ae(a.edges);s.set(t,{fields:new Set([...Object.keys(a.fields),...u.keys()]),edges:new Map(Object.entries(Q(a.edges)).map(([f,h])=>[f,h.cardinality??"many"])),...d?{computed:d}:{},...u.size>0?{linked:u}:{}})}let r=ee(e);return r&&s.set(Fe,{computed:r}),s}function Je(e,s){let r=[],t=re(e.on),a=(d,u)=>{let f=Ve(s.kinds,d,t)?.reversed===!0,[h,i]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:d,from:h,to:i}:{sever:d,from:h,to:i}};if(e.creates){let d=s.kinds[e.creates],u={};for(let f of Object.keys(d?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&R(f.target)==="new"&&Object.assign(u,f.set);r.push({create:e.creates,as:"new",set:u})}return e.sets&&r.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&r.push({set:Object.fromEntries(e.writes.map(d=>[d,`$${d}`]))}),e.connects&&(e.replaces&&r.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),r.push(a(e.connects,"connect"))),e.severs&&r.push(a(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&r.push({set:e.setsOther,target:"$to"}),e.removes&&r.push({remove:"$subject"}),e.effects&&r.push(...e.effects.filter(d=>!(e.creates&&"set"in d&&!("create"in d)&&R(d.target)==="new"))),r}function be(e,s,r){try{let t=H(e),a=oe(t);for(let d of a.unknownFunctions)r.push(z("unknown-function",s,`"${d}" is not a function the rule language knows`,"see docs/declaration-document.md#expression-language"));return t}catch(t){if(t instanceof se){r.push(z("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function ke(e,s,r){try{return Y(e)}catch(t){if(t instanceof Pe||t instanceof se){r.push(z("template",s,(t instanceof se,t.sentence)));return}throw t}}function gn(e){let s=[],r=new Set(Object.keys(e.kinds)),t=Ye(e),a=e.acts??{},d=new Set(e.roles??[]),u=(i,o)=>ae(e.kinds[i]?.edges).has(o),f=i=>Object.keys(e.kinds).some(o=>u(o,i));for(let[i,o]of Object.entries(e.kinds)){let p=`kinds.${i}`;for(let[m,l]of Object.entries(o.edges??{})){if(!Ae(l)&&l.to!=="*")for(let c of l.to)r.has(c)||s.push(z("edge-target",`${p}.edges.${m}.to`,`"${c}" is not a kind this document declares`));o.fields[m]&&s.push(z("edge-field-clash",`${p}.edges.${m}`,`"${m}" is both a field and a relation of ${i}`,"rename one of them"))}o.lifecycle&&!o.fields[o.lifecycle.field]&&s.push(z("lifecycle-field",`${p}.lifecycle.field`,`${i} has no field "${o.lifecycle.field}"`));let w=m=>o.computed!==void 0&&Object.hasOwn(o.computed,m);for(let m of o.glance??[])!o.fields[m]&&!w(m)&&s.push(z("glance-field",`${p}.glance`,`a glance at ${i} is to say "${m}", and ${i} has no field or computed field called that`,`use one of: ${[...Object.keys(o.fields),...Object.keys(o.computed??{})].join(", ")}`));s.push(...Ze(i,o));for(let m of["label","describe"]){let l=o[m];if(!l)continue;let c=ke(l,`${p}.${m}`,s);for(let j of c??[])if(j.expr){for(let y of oe(j.expr).names)if(!o.fields[y]){if(w(y)){Ne(o,y)||s.push(z("template-field",`${p}.${m}`,`${i}'s ${y} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${i}'s own fields`));continue}s.push(z("template-field",`${p}.${m}`,`${i} has no field "${y}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,l]of Object.entries(o.fields)){l.default!==void 0&&l.type==="enum"&&!l.options?.includes(String(l.default))&&s.push(z("default-option",`${p}.fields.${m}.default`,`"${String(l.default)}" is not one of ${m}'s options`));let c=`${m}Repeat`;l.repeats&&(o.fields[c]||o.edges?.[c]||o.computed?.[c])&&s.push(z("repeat-clash",`${p}.fields.${m}.repeats`,`${i} already has "${c}", where how ${m} repeats is kept`))}}for(let[i,o]of Object.entries(a)){let p=`acts.${i}`;for(let c of re(o.on))r.has(c)||s.push(z("act-kind",`${p}.on`,`"${c}" is not a kind this document declares`));let w=re(o.on),m=Je(o,e);if(o.creates&&o.on===void 0&&o.writes&&r.has(o.creates)){for(let c of o.writes)if(!e.kinds[o.creates].fields[c])if(e.kinds[o.creates].computed?.[c]!==void 0)s.push(z("computed-written",`${p}.writes`,`${o.creates}'s ${c} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(o.creates,c))continue;s.push(z("act-field",`${p}.writes`,`${o.creates} has no field "${c}"`))}}m.length===0&&s.push(z("act-empty",p,`"${i}" does nothing`,"give it effects or a shorthand such as sets or creates"));let l=new Map;m.forEach((c,j)=>{let y=m.length-(o.effects?.length??0),S=o.effects&&j>=y?`${p}.effects.${j-y}`:p;if("create"in c){if(!r.has(c.create))s.push(z("act-kind",`${S}.create`,`"${c.create}" is not a kind this document declares`));else for(let b of Object.keys(c.set??{}))e.kinds[c.create].fields[b]||(e.kinds[c.create].computed?.[b]!==void 0?s.push(z("computed-written",`${S}.set.${b}`,`${c.create}'s ${b} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(z("act-field",`${S}.set.${b}`,`${c.create} has no field "${b}"`)));c.as&&l.set(c.as,c.create)}else if("connect"in c||"sever"in c){let b="connect"in c?c.connect:c.sever;!t.has(b)&&!f(b)&&s.push(z("act-edge",`${S}.${"connect"in c?"connect":"sever"}`,`"${b}" is not a relation any kind declares`)),R(c.from)==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" acts on "$subject" but does not say which kinds it is "on"`))}else if("set"in c){let b=R(c.target??"$subject"),G=b==="subject"?w:l.has(b??"")?[l.get(b)]:[];b==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" changes "$subject" but does not say which kinds it is "on"`));for(let F of Object.keys(c.set))for(let g of G)if(!(!r.has(g)||e.kinds[g].fields[F]))if(e.kinds[g].computed?.[F]!==void 0)s.push(z("computed-written",`${S}.set.${F}`,`${g}'s ${F} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(g,F))continue;s.push(z("act-field",`${S}.set.${F}`,`${g} has no field "${F}"`))}}else"remove"in c&&R(c.remove)==="subject"&&w.length===0&&s.push(z("act-subject",`${p}.on`,`"${i}" removes "$subject" but does not say which kinds it is "on"`));("set"in c&&c.set?Object.values(c.set):[]).forEach(b=>{b&&typeof b=="object"&&!Array.isArray(b)&&"expr"in b&&be(b.expr,`${S}.set`,s)})}),o.allowedWhen&&be(o.allowedWhen,`${p}.allowedWhen`,s),o.refusal&&ke(o.refusal,`${p}.refusal`,s)}for(let[i,o]of Object.entries(e.rules??{})){let p=`rules.${i}`;o.over!=="graph"&&!r.has(o.over)&&s.push(z("rule-kind",`${p}.over`,`"${o.over}" is not a kind this document declares`));let w=o.over==="graph"?void 0:e.kinds[o.over];for(let m of["when","require"]){let l=o[m];if(!l)continue;let c=be(l,`${p}.${m}`,s);if(!c)continue;let j=oe(c);for(let y of j.names)if(o.over==="graph")s.push(z("rule-name",`${p}.${m}`,`"${y}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(w&&!w.fields[y]&&!w.edges?.[y]&&w.computed?.[y]===void 0){let S=Object.keys(w.edges??{}).find(A=>A.includes("-")&&A.split("-").includes(y));s.push(z("rule-name",`${p}.${m}`,`${o.over} has no field or relation called "${y}"`,S?`"${S}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${S.replace(/-([a-z0-9])/g,(A,b)=>b.toUpperCase())}"`:void 0))}for(let y of j.edges)!t.has(y)&&!f(y)&&s.push(z("rule-edge",`${p}.${m}`,`"${y}" is not a relation any kind declares`));for(let y of j.sweeps)r.has(y)?o.over!=="graph"&&s.push(De("rule-cost",`${p}.${m}`,`this rule looks at every ${y} for every ${o.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(z("rule-kind",`${p}.${m}`,`"${y}" is not a kind this document declares`))}o.says&&ke(o.says,`${p}.says`,s),(o.repairs??[]).forEach((m,l)=>{!a[m.act]&&!ce(m.act)&&!fe(m.act,e.kinds)&&s.push(z("repair-act",`${p}.repairs.${l}.act`,`"${m.act}" is not an act this document declares`))})}let h=e.policy;return h&&(h.grants.forEach((i,o)=>{if(i.roles!=="*"&&d.size>0)for(let p of i.roles)d.has(p)||s.push(z("grant-role",`policy.grants.${o}.roles`,`"${p}" is not one of the document's roles`));if(i.mutations!=="*")for(let p of i.mutations)!a[p]&&!ce(p)&&!fe(p,e.kinds)&&s.push(z("grant-act",`policy.grants.${o}.mutations`,`"${p}" is not an act this document declares`))}),(h.sees??[]).forEach((i,o)=>{for(let p of i.kinds)r.has(p)||s.push(z("sight-kind",`policy.sees.${o}.kinds`,`"${p}" is not a kind this document declares`));if(i.roles!=="*"&&d.size>0)for(let p of i.roles)d.has(p)||s.push(z("sight-role",`policy.sees.${o}.roles`,`"${p}" is not one of the document's roles`))})),s.push(..._e(e)),s}function zn(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[pe(e)??[]].flat()}function yn(e,s,r,t){let a=new Map,d=re(e.on),u=new Map,f=new Map;(d.length>0||s.some(l=>"remove"in l&&R(l.remove)==="subject"||"from"in l&&(R(l.from)==="subject"||R(l.to)==="subject")||"set"in l&&!("create"in l)&&R(l.target??"$subject")==="subject"))&&a.set(le,{ref:d.length>0?d:"*",required:!0});let i=e.args??{},o=e.writes?.length===1,p=(l,c)=>c&&l.type===c.type&&l.min===void 0&&l.max===void 0&&l.step===void 0?{...l,...c.min===void 0?{}:{min:c.min},...c.max===void 0?{}:{max:c.max},...c.step===void 0?{}:{step:c.step}}:l,w=(l,c)=>c&&l.type===c.type&&l.format===void 0&&l.unit===void 0?{...p(l,c),...c.format?{format:c.format}:{},...c.unit?{unit:c.unit}:{}}:p(l,c),m=(l,c,j)=>{if(l===le||un.has(l)||u.has(l)||a.has(l))return;let y=i[l]?w(i[l],j):void 0;a.set(l,y?{field:y,optional:!y.required,required:!!y.required}:c())};for(let l of s)if("create"in l){let c=r.kinds[l.create],j=c?He(c,zn(c)):[],y=S=>j.includes(S)?j.indexOf(S):j.length;for(let[S,A]of Object.entries(l.set??{}).sort(([b],[G])=>y(b)-y(G))){let b=R(A),G=c?.fields[S];if(b&&G){let F=!!G.required&&G.default===void 0;m(b,()=>({field:G,optional:!F,required:F}),G)}}l.as&&u.set(l.as,l.create)}else if("connect"in l||"sever"in l){let c=t.get("connect"in l?l.connect:l.sever);for(let[j,y]of[["from",l.from],["to",l.to]]){let S=R(y);if(!S)continue;let A=j==="to"?c?.to??"*":c?.from??"*";A!=="*"&&!f.has(S)&&f.set(S,A),m(S,()=>({ref:A,required:!0}))}}else if("set"in l){let c=R(l.target??"$subject"),j=c==="subject"?d[0]:u.get(c??"")??f.get(c??"")?.[0];c&&c!=="subject"&&!u.has(c)&&m(c,()=>({ref:"*",required:!0}));for(let[y,S]of Object.entries(l.set)){let A=R(S);if(!A)continue;let b=j?r.kinds[j]?.fields[y]:void 0;m(A,()=>b?{field:b,optional:!o,required:o}:{any:!0,required:!1},b)}}else if("remove"in l){let c=R(l.remove);c&&m(c,()=>({ref:"*",required:!0}))}for(let[l,c]of Object.entries(i))a.has(l)||a.set(l,{field:c,optional:!c.required,required:!!c.required});return a}function mt(e,s={}){let r=mn(e);if(!r.document||de(r.findings))return{ok:!1,findings:r.findings};let t=r.document,a=[...r.findings];s.previous&&a.push(...bn(t,s.previous));let d=hn(t,a);return de(d.findings)?{ok:!1,findings:d.findings}:Te(d,s)}function ie(e,s){return e.map(r=>{let t=!r.format&&r.expr?.t==="ident"?s?.[r.expr.name]?.format:void 0;return t==="money"||t==="percent"?{...r,format:t}:r})}function hn(e,s){let r=Ye(e),t={};for(let[i,o]of Object.entries(e.kinds)){let p=pe(o),w=o.label??(p?`{${p}}`:void 0),m=ee(o),l=m?We(e,i,[...m]):[];t[i]={...w?{label:ie(Y(w),o.fields)}:{},...o.describe?{describe:ie(Y(o.describe),o.fields)}:{},...m?{computed:[...m]}:{},...l.length>0?{durations:l}:{}}}let a={};for(let[i,o]of Object.entries(e.acts??{})){let p=Je(o,e),w=yn(o,p,e,r),m=o.destructive??p.some(g=>"remove"in g||"sever"in g||"replace"in g),l=[...new Set(p.flatMap(g=>"create"in g?[g.create]:[]))],c=[...new Set(p.flatMap(g=>"connect"in g?[g.connect]:[]))],j=[...new Set(p.flatMap(g=>"sever"in g?[g.sever]:"replace"in g?g.replace:[]))],y=[...new Set(p.flatMap(g=>"set"in g&&!("create"in g)&&R(g.target??"$subject")==="subject"?Object.keys(g.set):[]))],S=new Map;for(let g of p){if(!("connect"in g)&&!("sever"in g))continue;let v=r.get("connect"in g?g.connect:g.sever);for(let[D,te]of[["from",g.from],["to",g.to]]){let I=R(te),Z=D==="to"?v?.to:v?.from;I&&I!=="subject"&&Z&&Z!=="*"&&S.set(I,[...new Set([...S.get(I)??[],...Z])])}}let A={};for(let g of p){if(!("set"in g)||"create"in g)continue;let v=R(g.target??"$subject");for(let D of v&&v!=="subject"&&S.get(v)||[])A[D]=[...new Set([...A[D]??[],...Object.keys(g.set)])]}let b={};for(let g of p)if(!(!("set"in g)||"create"in g||R(g.target??"$subject")!=="subject"))for(let[v,D]of Object.entries(g.set??{}))typeof D=="string"&&R(D)===void 0||typeof D=="number"||typeof D=="boolean"?b[v]=typeof D=="string"&&D.startsWith("$$")?D.slice(1):D:delete b[v];let G=l.length===0&&p.every(g=>!("set"in g)||!g.set||Object.values(g.set).every(v=>!(v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v))),F=new Map;for(let g of p)if(!(!("set"in g)||!g.set))for(let v of Object.values(g.set))v&&typeof v=="object"&&!Array.isArray(v)&&"expr"in v&&F.set(v.expr,H(v.expr));a[i]={title:o.title??i.replace(/-/g," "),effects:p,args:[...w],...o.allowedWhen?{guard:H(o.allowedWhen)}:{},...o.refusal?{refusal:ie(Y(o.refusal),e.kinds[[o.on??[]].flat()[0]??""]?.fields)}:{},exprs:[...F],destructive:m,idempotent:G,creates:l,connects:c,severs:j,writes:y,writesOther:A,sets:b}}let d={};for(let[i,o]of Object.entries(e.rules??{}))d[i]={title:o.title??i.replace(/-/g," "),require:H(o.require),...o.when?{when:H(o.when)}:{},...o.says?{says:ie(Y(o.says),e.kinds[o.over]?.fields)}:{}};let u=Ke(e,s),f=Ge(e),h=Ce(e);return{format:Me,document:e,findings:s,kinds:t,...e.computed?{facts:[...ee(e)??[]]}:{},edges:[...r].map(([i,{from:o,to:p,cardinality:w}])=>[i,{from:o,to:p,cardinality:w}]),acts:a,rules:d,brand:u,...Object.keys(f).length>0?{viewSpecs:f}:{},...h?{home:h}:{}}}function gt(e,s,r){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],a=t?r.kinds[t]:void 0;if(!t||!a)return e;let d=Object.keys(a.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${d.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function bn(e,s){let r=[],t=new Set(Object.values(s.kinds).flatMap(a=>Object.keys(a.edges??{})));for(let[a,d]of Object.entries(e.kinds)){let u=d.renamedFrom;u&&!s.kinds[u]&&r.push(z("renamed-from-nothing",`kinds.${a}.renamedFrom`,`${a} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??a];for(let[h,i]of Object.entries(d.fields)){let o=i.renamedFrom;o&&!f?.fields[o]&&r.push(z("renamed-from-nothing",`kinds.${a}.fields.${h}.renamedFrom`,`${h} says it was ${o}, and the previous ${u??a} has no field called ${o}`,"name the field it was, or drop renamedFrom"))}for(let[h,i]of Object.entries(d.edges??{})){let o=i.renamedFrom;o&&!t.has(o)&&r.push(z("renamed-from-nothing",`kinds.${a}.edges.${h}.renamedFrom`,`${h} says it was ${o}, and the previous version has no relation called ${o}`,"name the relation it was, or drop renamedFrom"))}}return r}export{mn as a,ut as b,Je as c,mt as d,gt as e};
|