graview 0.1.58 → 0.1.60
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/README.md +4 -2
- package/dist/preview/chunk.2K4TT2BV.js +1 -0
- package/dist/preview/{chunk.OHQ3JH65.js → chunk.2USDHXB4.js} +1 -1
- package/dist/preview/{chunk.F7SF6EP2.js → chunk.37TVS7CA.js} +1 -1
- package/dist/preview/chunk.3IZ3ABII.js +1 -0
- package/dist/preview/{chunk.NKC3JILT.js → chunk.3MOJF7BA.js} +1 -1
- package/dist/preview/{chunk.IDJPBWL2.js → chunk.3UOKUF5Z.js} +1 -1
- package/dist/preview/{chunk.2VYNNWW5.js → chunk.3V4WP7RY.js} +3 -3
- package/dist/preview/{chunk.WNSC3RWD.js → chunk.3XGA65Y3.js} +1 -1
- package/dist/preview/{chunk.D5KTGX7F.js → chunk.3ZT5WQYL.js} +1 -1
- package/dist/preview/{chunk.IULQRCEE.js → chunk.4LR64TPU.js} +1 -1
- package/dist/preview/chunk.4MP72LPR.js +25 -0
- package/dist/preview/{chunk.GQBJVCSM.js → chunk.4TCKEG6I.js} +1 -1
- package/dist/preview/chunk.5DD62IOW.js +21 -0
- package/dist/preview/{chunk.KJ264E6K.js → chunk.5YOLUDVO.js} +1 -1
- package/dist/preview/{chunk.EB4NVTJL.js → chunk.67U6M7OV.js} +1 -1
- package/dist/preview/{chunk.XU34T2H4.js → chunk.6C2MHWSX.js} +1 -1
- package/dist/preview/{chunk.ILRCNTGT.js → chunk.6HF6POIX.js} +1 -1
- package/dist/preview/{chunk.U6O3MMQR.js → chunk.6WHAWOO7.js} +1 -1
- package/dist/preview/{chunk.GKSUTAIX.js → chunk.6ZQAR5ZA.js} +1 -1
- package/dist/preview/{chunk.EPPXZZPK.js → chunk.7MHCGVGM.js} +1 -1
- package/dist/preview/{chunk.MQ5HBUBL.js → chunk.7N32AVIJ.js} +1 -1
- package/dist/preview/{chunk.7V23SXGJ.js → chunk.7OPM55I2.js} +1 -1
- package/dist/preview/chunk.7TFLRR7D.js +1 -0
- package/dist/preview/{chunk.LDAYDCUO.js → chunk.7VKSXGTX.js} +1 -1
- package/dist/preview/{chunk.KJHPDL4N.js → chunk.A3ZXDG6V.js} +1 -1
- package/dist/preview/{chunk.27CW6SCT.js → chunk.A5PDXNY6.js} +1 -1
- package/dist/preview/chunk.AVBTPSQF.js +1 -0
- package/dist/preview/{chunk.YZZONE4M.js → chunk.BF6S5UE4.js} +1 -1
- package/dist/preview/chunk.BLPYNNR4.js +1 -0
- package/dist/preview/{chunk.LRUNFSHP.js → chunk.BQIHNT7C.js} +1 -1
- package/dist/preview/{chunk.O4CVKTPJ.js → chunk.BRT27WON.js} +1 -1
- package/dist/preview/{chunk.HMFJT4KO.js → chunk.BXDM3UMN.js} +1 -1
- package/dist/preview/chunk.BYKD5RLA.js +1 -0
- package/dist/preview/chunk.C7OLSEWK.js +1 -0
- package/dist/preview/{chunk.3OYGXYQY.js → chunk.CC5BJH5A.js} +1 -1
- package/dist/preview/{chunk.GCBZ3WE2.js → chunk.CFKZXLXS.js} +1 -1
- package/dist/preview/chunk.CMN6BBAD.js +1 -0
- package/dist/preview/{chunk.YP2F5UGY.js → chunk.CQT3W2SF.js} +1 -1
- package/dist/preview/chunk.D7YSL3NK.js +2 -0
- package/dist/preview/chunk.DCHQHKSA.js +1 -0
- package/dist/preview/{chunk.H3BFHI3G.js → chunk.EL5ICOOM.js} +1 -1
- package/dist/preview/{chunk.PZG3B7F4.js → chunk.ENL2JJ47.js} +1 -1
- package/dist/preview/chunk.EQXB7LKI.js +1 -0
- package/dist/preview/{chunk.ELAMMS2V.js → chunk.ERFT54HT.js} +1 -1
- package/dist/preview/{chunk.XN2RVXOI.js → chunk.F6V7RWDK.js} +1 -1
- package/dist/preview/{chunk.64R3K2OE.js → chunk.FBJARKDT.js} +1 -1
- package/dist/preview/{chunk.SDLUWRGI.js → chunk.FC6AF6CC.js} +1 -1
- package/dist/preview/{chunk.GZB6A6KF.js → chunk.FFTYMBBT.js} +1 -1
- package/dist/preview/chunk.FLUK3UXF.js +1 -0
- package/dist/preview/{chunk.KFQSYCY3.js → chunk.FRYBMS3W.js} +1 -1
- package/dist/preview/chunk.G3R4BTI7.js +1 -0
- package/dist/preview/chunk.G4YJPKRG.js +5 -0
- package/dist/preview/{chunk.BB33TI4S.js → chunk.GLWSVSQL.js} +1 -1
- package/dist/preview/{chunk.SDVPJYVF.js → chunk.GNBIVVL3.js} +1 -1
- package/dist/preview/{chunk.ZN5HTWSI.js → chunk.GTKJJYQH.js} +1 -1
- package/dist/preview/{chunk.TUUVVO5U.js → chunk.H45Q3O4F.js} +1 -1
- package/dist/preview/{chunk.M34CS7DI.js → chunk.HDP3PS7N.js} +1 -1
- package/dist/preview/{chunk.CCWPF5PK.js → chunk.HDUO2USQ.js} +1 -1
- package/dist/preview/{chunk.PBCNOFQH.js → chunk.HUJ6YTWE.js} +1 -1
- package/dist/preview/{chunk.JB7TTJXQ.js → chunk.I4XQBQRC.js} +1 -1
- package/dist/preview/chunk.IBOKXVWN.js +1 -0
- package/dist/preview/{chunk.4HSH2UIK.js → chunk.IGJZ4UH3.js} +2 -2
- package/dist/preview/{chunk.WNQFHMNR.js → chunk.IGVASEZU.js} +1 -1
- package/dist/preview/{chunk.7SQAKSJD.js → chunk.IHBUBZQT.js} +1 -1
- package/dist/preview/chunk.IOK4GVJC.js +1 -0
- package/dist/preview/{chunk.I3WWCPQ2.js → chunk.JEYQBH33.js} +1 -1
- package/dist/preview/{chunk.S2H7B6RG.js → chunk.JJGCTGWA.js} +1 -1
- package/dist/preview/{chunk.E5MSFXL6.js → chunk.JPONLMU7.js} +1 -1
- package/dist/preview/{chunk.QPXXY2DL.js → chunk.KBVTLNS5.js} +3 -3
- package/dist/preview/{chunk.HS3GHAUR.js → chunk.KDRLUBVF.js} +1 -1
- package/dist/preview/{chunk.YIA2EDVF.js → chunk.KGW75Z5L.js} +1 -1
- package/dist/preview/{chunk.KWJWAIQJ.js → chunk.KI37ZEV3.js} +1 -1
- package/dist/preview/chunk.L6AWE76F.js +1 -0
- package/dist/preview/{chunk.LY3YOWKV.js → chunk.LGEA5257.js} +1 -1
- package/dist/preview/{chunk.TF5I4VHX.js → chunk.LLYRFVIN.js} +1 -1
- package/dist/preview/{chunk.WQOI6BLM.js → chunk.LQVAABPS.js} +1 -1
- package/dist/preview/{chunk.POBMGM3X.js → chunk.LSY256J4.js} +1 -1
- package/dist/preview/{chunk.HEWVPXRE.js → chunk.LZIBQ3VX.js} +1 -1
- package/dist/preview/{chunk.7MSFDD7J.js → chunk.M4UD4ARP.js} +1 -1
- package/dist/preview/chunk.MDJWK5W2.js +1 -0
- package/dist/preview/{chunk.4AFFPYOK.js → chunk.MJVYWLQQ.js} +1 -1
- package/dist/preview/{chunk.3YZHZGTM.js → chunk.MSWWWLEA.js} +1 -1
- package/dist/preview/{chunk.BTVBZ6KE.js → chunk.MVWC3VR3.js} +2 -2
- package/dist/preview/{chunk.B2GVJD6H.js → chunk.NC7FXY2H.js} +1 -1
- package/dist/preview/{chunk.LCPGZK7G.js → chunk.NGTRL5U4.js} +1 -1
- package/dist/preview/{chunk.NOFWGDOT.js → chunk.NHUQ2N6J.js} +1 -1
- package/dist/preview/{chunk.LL2MLSPH.js → chunk.OLFJH4RK.js} +1 -1
- package/dist/preview/{chunk.WXIEQZLY.js → chunk.P6RORYOT.js} +1 -1
- package/dist/preview/{chunk.SPXRLO5K.js → chunk.PFSYXD6Q.js} +1 -1
- package/dist/preview/chunk.PHJ6WPWH.js +1 -0
- package/dist/preview/{chunk.QGV7H7RQ.js → chunk.PI44XMY2.js} +1 -1
- package/dist/preview/{chunk.ZOHMWSHD.js → chunk.PNW5K7BW.js} +1 -1
- package/dist/preview/chunk.Q355UPFG.js +1 -0
- package/dist/preview/{chunk.GEB2DFBU.js → chunk.QBLKTFF4.js} +1 -1
- package/dist/preview/{chunk.HXRV3WVJ.js → chunk.QDSEVPF3.js} +1 -1
- package/dist/preview/chunk.QFUMFQJU.js +1 -0
- package/dist/preview/{chunk.B3WZHPM3.js → chunk.QHDCTAD7.js} +1 -1
- package/dist/preview/{chunk.UAP5M3CD.js → chunk.QI4SLPQ4.js} +2 -2
- package/dist/preview/{chunk.HZB5F476.js → chunk.RQOX5YDW.js} +1 -1
- package/dist/preview/{chunk.TBW7CU4G.js → chunk.RXYNW5QB.js} +1 -1
- package/dist/preview/{chunk.RE7DELSR.js → chunk.SB2PZKN5.js} +1 -1
- package/dist/preview/{chunk.INZQ6WZM.js → chunk.SRVQJZRT.js} +1 -1
- package/dist/preview/{chunk.TJ647W6J.js → chunk.T7LQD67N.js} +2 -2
- package/dist/preview/chunk.TAT2IQUR.js +1 -0
- package/dist/preview/chunk.TFWIG6LL.js +6 -0
- package/dist/preview/{chunk.GP7F3PEF.js → chunk.TKVLNBRD.js} +1 -1
- package/dist/preview/{chunk.YHTE34RN.js → chunk.TLJOZSDD.js} +1 -1
- package/dist/preview/{chunk.6W7O5YLL.js → chunk.TLWT67ON.js} +1 -1
- package/dist/preview/{chunk.KKNDX4JT.js → chunk.TY4GQJKC.js} +1 -1
- package/dist/preview/{chunk.EQTSV7BK.js → chunk.UITT6JWW.js} +1 -1
- package/dist/preview/{chunk.LO3U3P55.js → chunk.UJTE7UAP.js} +1 -1
- package/dist/preview/{chunk.DBZHRYBK.js → chunk.ULL6ZIJJ.js} +1 -1
- package/dist/preview/{chunk.VUPLFUUS.js → chunk.UQWTZJBV.js} +1 -1
- package/dist/preview/{chunk.NFX24NUI.js → chunk.URWAFZHF.js} +1 -1
- package/dist/preview/{chunk.A6C4AGJJ.js → chunk.VADQ7ZGA.js} +1 -1
- package/dist/preview/chunk.VDMDPZ6U.js +1 -0
- package/dist/preview/{chunk.2EDC63RI.js → chunk.VFOON3Z3.js} +1 -1
- package/dist/preview/{chunk.4444RPWW.js → chunk.VMV464JK.js} +1 -1
- package/dist/preview/{chunk.4KC35UNR.js → chunk.VNDKKTED.js} +4 -2
- package/dist/preview/chunk.VSCIXAHN.js +5 -0
- package/dist/preview/{chunk.34TW32TB.js → chunk.VUBNBTJP.js} +2 -2
- package/dist/preview/{chunk.JUNMJYH5.js → chunk.VWJGQDCE.js} +1 -1
- package/dist/preview/{chunk.KXPRILAO.js → chunk.VZJWJ5XM.js} +1 -1
- package/dist/preview/{chunk.5ICIMQE6.js → chunk.W3W54DSX.js} +1 -1
- package/dist/preview/{chunk.YD3TKV6P.js → chunk.WC3DENU4.js} +2 -2
- package/dist/preview/chunk.WQ6RCEUQ.js +1 -0
- package/dist/preview/{chunk.YS6GVLIP.js → chunk.WXUFATY5.js} +1 -1
- package/dist/preview/chunk.X6A4VSSD.js +1 -0
- package/dist/preview/{chunk.VHSWBFXB.js → chunk.XGASJAV2.js} +1 -1
- package/dist/preview/{chunk.RRKYJYZJ.js → chunk.XR6YR6RV.js} +1 -1
- package/dist/preview/chunk.XZPKBHJT.js +1 -0
- package/dist/preview/{chunk.GDOTG7YA.js → chunk.Y5C4RXG7.js} +1 -1
- package/dist/preview/{chunk.JES77WXG.js → chunk.Y7G3OGDE.js} +1 -1
- package/dist/preview/{chunk.E34OQVSR.js → chunk.YEBGI6ED.js} +1 -1
- package/dist/preview/{chunk.TWKXSLYY.js → chunk.YFSBVZTG.js} +1 -1
- package/dist/preview/chunk.YFVJUHAK.js +1 -0
- package/dist/preview/chunk.YH63KQ2G.js +1 -0
- package/dist/preview/{chunk.LMN4TSAP.js → chunk.YZ7FUKAL.js} +1 -1
- package/dist/preview/{chunk.JGKA5QBX.js → chunk.Z2ERZ4S6.js} +1 -1
- package/dist/preview/{chunk.VG7OWV2H.js → chunk.ZP5RT2EK.js} +1 -1
- package/dist/preview/{chunk.ETBFD76E.js → chunk.ZXOT3IXJ.js} +1 -1
- package/dist/preview/{chunk.TJOXNEFU.js → chunk.ZYM2SSGW.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.32FMOHZK.js +0 -1
- package/dist/preview/chunk.3FCOFEGW.js +0 -1
- package/dist/preview/chunk.43OKZU73.js +0 -1
- package/dist/preview/chunk.47JQPYXL.js +0 -2
- package/dist/preview/chunk.4GGPPCMM.js +0 -1
- package/dist/preview/chunk.4Y2JTY6Q.js +0 -1
- package/dist/preview/chunk.6K7EN2YI.js +0 -1
- package/dist/preview/chunk.6VC6AGYV.js +0 -5
- package/dist/preview/chunk.7BBGRTXM.js +0 -5
- package/dist/preview/chunk.7ECBGIUK.js +0 -1
- package/dist/preview/chunk.ACYDJQRC.js +0 -1
- package/dist/preview/chunk.ARWBIBSI.js +0 -6
- package/dist/preview/chunk.BKVBX2YB.js +0 -1
- package/dist/preview/chunk.DM767F2Q.js +0 -21
- package/dist/preview/chunk.ELERUERU.js +0 -1
- package/dist/preview/chunk.GUEHKCWN.js +0 -1
- package/dist/preview/chunk.HT2BEOEV.js +0 -25
- package/dist/preview/chunk.JOAN54PN.js +0 -1
- package/dist/preview/chunk.L7V24JPO.js +0 -1
- package/dist/preview/chunk.LA4CPZ2N.js +0 -1
- package/dist/preview/chunk.MV3AJ7JH.js +0 -1
- package/dist/preview/chunk.MYNQWWCL.js +0 -1
- package/dist/preview/chunk.OASYYMG5.js +0 -1
- package/dist/preview/chunk.PM3SYXKB.js +0 -1
- package/dist/preview/chunk.QB25SMP6.js +0 -1
- package/dist/preview/chunk.R7LFO7KI.js +0 -1
- package/dist/preview/chunk.S5MGE2U5.js +0 -1
- package/dist/preview/chunk.TXGNPW76.js +0 -1
- package/dist/preview/chunk.UGFDSE37.js +0 -1
- package/dist/preview/chunk.UKMVJV6Q.js +0 -1
- package/dist/preview/chunk.UUG3BYVN.js +0 -1
- package/dist/preview/chunk.WJFQIE3Y.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.
|
|
12
|
-
<link rel="modulepreload" href="/chunk.
|
|
13
|
-
<link rel="modulepreload" href="/chunk.
|
|
14
|
-
<link rel="modulepreload" href="/chunk.
|
|
15
|
-
<link rel="modulepreload" href="/chunk.
|
|
16
|
-
<link rel="modulepreload" href="/chunk.
|
|
8
|
+
<link rel="modulepreload" href="/chunk.HUJ6YTWE.js">
|
|
9
|
+
<link rel="modulepreload" href="/chunk.JJGCTGWA.js">
|
|
10
|
+
<link rel="modulepreload" href="/chunk.XR6YR6RV.js">
|
|
11
|
+
<link rel="modulepreload" href="/chunk.NHUQ2N6J.js">
|
|
12
|
+
<link rel="modulepreload" href="/chunk.7TFLRR7D.js">
|
|
13
|
+
<link rel="modulepreload" href="/chunk.KGW75Z5L.js">
|
|
14
|
+
<link rel="modulepreload" href="/chunk.WC3DENU4.js">
|
|
15
|
+
<link rel="modulepreload" href="/chunk.VNDKKTED.js">
|
|
16
|
+
<link rel="modulepreload" href="/chunk.4MP72LPR.js">
|
|
17
17
|
<link rel="modulepreload" href="/chunk.SDO3U72B.js">
|
|
18
|
-
<link rel="modulepreload" href="/chunk.
|
|
18
|
+
<link rel="modulepreload" href="/chunk.VSCIXAHN.js">
|
|
19
19
|
<link rel="modulepreload" href="/chunk.FQLNBIQ5.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.
|
|
27
|
-
<link rel="modulepreload" href="/chunk.
|
|
21
|
+
<link rel="modulepreload" href="/chunk.L6AWE76F.js">
|
|
22
|
+
<link rel="modulepreload" href="/chunk.3V4WP7RY.js">
|
|
23
|
+
<link rel="modulepreload" href="/chunk.LLYRFVIN.js">
|
|
24
|
+
<link rel="modulepreload" href="/chunk.YFSBVZTG.js">
|
|
25
|
+
<link rel="modulepreload" href="/chunk.G4YJPKRG.js">
|
|
26
|
+
<link rel="modulepreload" href="/chunk.3UOKUF5Z.js">
|
|
27
|
+
<link rel="modulepreload" href="/chunk.Q355UPFG.js">
|
|
28
28
|
<link rel="modulepreload" href="/chunk.PXQVXBNG.js">
|
|
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.
|
|
35
|
-
<link rel="modulepreload" href="/chunk.
|
|
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.
|
|
29
|
+
<link rel="modulepreload" href="/chunk.MVWC3VR3.js">
|
|
30
|
+
<link rel="modulepreload" href="/chunk.CC5BJH5A.js">
|
|
31
|
+
<link rel="modulepreload" href="/chunk.CFKZXLXS.js">
|
|
32
|
+
<link rel="modulepreload" href="/chunk.Y5C4RXG7.js">
|
|
33
|
+
<link rel="modulepreload" href="/chunk.7MHCGVGM.js">
|
|
34
|
+
<link rel="modulepreload" href="/chunk.FRYBMS3W.js">
|
|
35
|
+
<link rel="modulepreload" href="/chunk.LQVAABPS.js">
|
|
36
|
+
<link rel="modulepreload" href="/chunk.NGTRL5U4.js">
|
|
37
|
+
<link rel="modulepreload" href="/chunk.3MOJF7BA.js">
|
|
38
|
+
<link rel="modulepreload" href="/chunk.LZIBQ3VX.js">
|
|
39
|
+
<link rel="modulepreload" href="/chunk.YZ7FUKAL.js">
|
|
40
|
+
<link rel="modulepreload" href="/chunk.KDRLUBVF.js">
|
|
41
|
+
<link rel="modulepreload" href="/chunk.BQIHNT7C.js">
|
|
42
|
+
<link rel="modulepreload" href="/chunk.TAT2IQUR.js">
|
|
43
|
+
<link rel="modulepreload" href="/chunk.3XGA65Y3.js">
|
|
44
|
+
<link rel="modulepreload" href="/chunk.BYKD5RLA.js">
|
|
45
|
+
<link rel="modulepreload" href="/chunk.2K4TT2BV.js">
|
|
46
|
+
<link rel="modulepreload" href="/chunk.VUBNBTJP.js">
|
|
47
47
|
<link rel="modulepreload" href="/chunk.BJUUSIQY.js">
|
|
48
|
-
<link rel="modulepreload" href="/chunk.
|
|
49
|
-
<link rel="modulepreload" href="/chunk.
|
|
48
|
+
<link rel="modulepreload" href="/chunk.ZP5RT2EK.js">
|
|
49
|
+
<link rel="modulepreload" href="/chunk.VZJWJ5XM.js">
|
|
50
50
|
<link rel="modulepreload" href="/chunk.XOZU4OFA.js">
|
|
51
|
-
<link rel="modulepreload" href="/chunk.
|
|
51
|
+
<link rel="modulepreload" href="/chunk.GLWSVSQL.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.7VKSXGTX.js">
|
|
55
|
+
<link rel="modulepreload" href="/chunk.TY4GQJKC.js">
|
|
56
|
+
<link rel="modulepreload" href="/chunk.6ZQAR5ZA.js">
|
|
57
|
+
<link rel="modulepreload" href="/chunk.W3W54DSX.js">
|
|
58
|
+
<link rel="modulepreload" href="/chunk.PI44XMY2.js">
|
|
59
59
|
<link rel="modulepreload" href="/chunk.GZHZLJBF.js">
|
|
60
|
-
<link rel="modulepreload" href="/chunk.
|
|
60
|
+
<link rel="modulepreload" href="/chunk.IOK4GVJC.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.TLJOZSDD.js">
|
|
63
|
+
<link rel="modulepreload" href="/chunk.MSWWWLEA.js">
|
|
64
|
+
<link rel="modulepreload" href="/chunk.UITT6JWW.js">
|
|
65
|
+
<link rel="modulepreload" href="/chunk.A5PDXNY6.js">
|
|
66
|
+
<link rel="modulepreload" href="/chunk.3IZ3ABII.js">
|
|
67
|
+
<link rel="modulepreload" href="/chunk.KI37ZEV3.js">
|
|
68
|
+
<script>(()=>{const later=["/chunk.WQ6RCEUQ.js","/chunk.JEYQBH33.js","/chunk.QI4SLPQ4.js","/chunk.HJCQ6I3S.js","/chunk.QDSEVPF3.js","/chunk.7N32AVIJ.js","/chunk.IHBUBZQT.js","/chunk.OLFJH4RK.js","/chunk.67U6M7OV.js","/chunk.VFOON3Z3.js","/chunk.BLPYNNR4.js","/chunk.CQT3W2SF.js","/chunk.IGJZ4UH3.js","/chunk.X6A4VSSD.js","/chunk.PNW5K7BW.js","/chunk.ENL2JJ47.js","/chunk.QHDCTAD7.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 ro}from"./chunk.PBCNOFQH.js";import{a as Wt,b as lr,c as ur,d as fr,e as It,f as pr,g as mr,h as hr,i as yr,j as gr,k as wr,l as vr,m as br,n as Ue}from"./chunk.S2H7B6RG.js";import{b as dr}from"./chunk.RRKYJYZJ.js";import{a as Bt,b as or,c as ar,d as ir,e as sr,f as $t,g as cr,h as Nt}from"./chunk.NOFWGDOT.js";import{a as Rt,g as Ln}from"./chunk.GUEHKCWN.js";import{k as it}from"./chunk.YIA2EDVF.js";import{E as tr,I as nr,J as rr,h as Yn,k as Dt,l as Qn,n as Zn,r as Xn,w as Vt,z as er}from"./chunk.YD3TKV6P.js";import{c as no}from"./chunk.4KC35UNR.js";import{Aa as qn,Ca as zn,Da as Gn,Fa as Un,G as Mt,Ga as Ht,Ka as Kn,La as Jn,Oa as dt,T as Dn,Z as Vn,a as Mn,b as st,c as ct,ga as Bn,ha as $n,j as Hn,m as Lt,va as Nn,wa as Wn,xa as In,ya as _n,za as jn}from"./chunk.HT2BEOEV.js";import{a as Te}from"./chunk.SDO3U72B.js";import{$d as Cn,Eb as Sn,Pd as Re,Qd as Fn,Rd as On,Wd as xt,Xc as kn,Xd as Ft,Yd as Ot,ae as Ct,fb as _e,hc as Tt,hd as An,ic as Pn,id as En,nd as Rn,pd as Tn,qb as ot,qd as xn,rb as bn,sd as at}from"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import{b as De}from"./chunk.AJZBJBMO.js";function _t(e){if(Array.isArray(e))return e.map(_t);if(e&&typeof e=="object"){let n={};for(let o of Object.keys(e).sort()){let i=e[o];i!==void 0&&(n[o]=_t(i))}return n}return e}function jt(e){return JSON.stringify(_t(e))??"undefined"}async function lt(e,n={}){let o=e.compiled===void 0||!ao(e.compiled,e.document)?void 0:Ln(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await oo();return i(e.document,n)}var Sr,oo=()=>Sr??=(__graviewPreload(import.meta.url,["./chunk.GUEHKCWN.js","./chunk.GKSUTAIX.js","./chunk.QGV7H7RQ.js","./chunk.YIA2EDVF.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.WJFQIE3Y.js")).catch(e=>{throw Sr=void 0,e});function ao(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,i=n;if(typeof i=="string")try{i=JSON.parse(i)}catch{return!1}return o!==void 0&&jt(Rt(o).document)===jt(Rt(i).document)}var d=De(Mt(),1);var ft=De(Mt(),1),qt="data-graview-drawn",io=200,Pr=50,so=1e4,ut=()=>typeof performance<"u"?performance.now():Date.now();function co(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 lo(e,n){if(e.ownerDocument.fonts?.status==="loading"||Wn()>0||qn(n)>0||e.querySelector('[aria-busy="true"]')||co(e).some(i=>!i.complete&&i.loading!=="lazy"))return!1;for(let i of e.querySelectorAll("[data-worker-view-place]"))if(!i.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function kr(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(i=>`${i.offsetWidth}x${i.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function uo(e,n,o,i){e.removeAttribute(qt);let c=e.ownerDocument.defaultView;if(!c)return()=>{};let l=ut(),S=l,p=kr(e),w=!1,E,T=typeof MutationObserver>"u"?void 0:new MutationObserver(v=>{v.some(_=>!(_.target===e&&_.attributeName===qt))&&(S=ut())});T?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let P=()=>{w=!0,T?.disconnect(),E!==void 0&&clearTimeout(E)},k=v=>{let _=!1,de=()=>{_||(_=!0,v())};typeof c.requestAnimationFrame=="function"&&c.requestAnimationFrame(()=>setTimeout(de,0)),setTimeout(de,100)},F=()=>{if(w)return;let v=kr(e);v!==p&&(p=v,S=ut());let _=ut();if(lo(e,i)&&_-S>=io||_-l>=so){k(()=>{w||(P(),e.setAttribute(qt,n),Gn(),o())});return}E=setTimeout(F,Pr)};return E=setTimeout(F,Pr),P}function Ar(e,n,o,i,c){zn();let l=(0,ft.useRef)({place:o,onDrawn:i});l.current={place:o,onDrawn:i},(0,ft.useLayoutEffect)(()=>{c&&jn(c);let S=E=>uo(E,l.current.place.path,()=>l.current.onDrawn?.(l.current.place),c);if(e.current)return S(e.current);let p,w=!1;return queueMicrotask(()=>{!w&&e.current&&(p=S(e.current))}),()=>{w=!0,p?.()}},[n,e,c])}var ve=De(Mt(),1),Ke,fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.5IEFTFKQ.js","./chunk.O4CVKTPJ.js","./chunk.3FCOFEGW.js","./chunk.TBW7CU4G.js","./chunk.SPXRLO5K.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.GQBJVCSM.js"))),Er=()=>fo().then(e=>void(Ke=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Er)),zt=Nn(Er),Rr=e=>!!e&&Ke===void 0;function Gt({onReady:e,fetch:n}){return(0,ve.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var po=0;function Tr(e){let[n,o]=(0,ve.useState)(()=>Ke);(0,ve.useEffect)(()=>{if(!e||n)return;let l=!1;return zt().then(()=>{l||o(Ke)}),()=>{l=!0}},[e,n]);let i=(0,ve.useMemo)(()=>po+=1,[e]);return{over:(0,ve.useMemo)(()=>{let l=n??Ke;if(!e||!l)return;let{source:S,worker:p,...w}=e,E={...w,worker:p??{source:S},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:T=>l.registerWorkerView(T,E)}},[e,n]),n:i}}var Or=De(ro(),1),I=De(no(),1);var g=De(Dn(),1);function pt(e,n={}){let o=Ht(e);return{Face:o.part((c,l)=>(0,d.createElement)(c,l),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var Jt=e=>Promise.all([e,nr()]).then(([n])=>n),Cr=Te(()=>(__graviewPreload(import.meta.url,["./chunk.IDJPBWL2.js","./chunk.3OYGXYQY.js","./chunk.UAP5M3CD.js","./chunk.GDOTG7YA.js","./chunk.KFQSYCY3.js","./chunk.NKC3JILT.js","./chunk.HEWVPXRE.js","./chunk.HJCQ6I3S.js","./chunk.HXRV3WVJ.js","./chunk.MQ5HBUBL.js","./chunk.R7LFO7KI.js","./chunk.HS3GHAUR.js","./chunk.ZOHMWSHD.js","./chunk.PZG3B7F4.js","./chunk.LRUNFSHP.js","./chunk.WNSC3RWD.js","./chunk.S5MGE2U5.js","./chunk.LL2MLSPH.js","./chunk.EB4NVTJL.js","./chunk.VG7OWV2H.js","./chunk.KXPRILAO.js","./chunk.S2H7B6RG.js","./chunk.RRKYJYZJ.js","./chunk.2EDC63RI.js","./chunk.GZHZLJBF.js","./chunk.ELERUERU.js","./chunk.OJGHDWI6.js","./chunk.YHTE34RN.js","./chunk.3YZHZGTM.js","./chunk.EQTSV7BK.js","./chunk.27CW6SCT.js","./chunk.YD3TKV6P.js","./chunk.4KC35UNR.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QPXXY2DL.js"))),mo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.2VYNNWW5.js","./chunk.TF5I4VHX.js","./chunk.TWKXSLYY.js","./chunk.6VC6AGYV.js","./chunk.IDJPBWL2.js","./chunk.UGFDSE37.js","./chunk.PXQVXBNG.js","./chunk.BTVBZ6KE.js","./chunk.3OYGXYQY.js","./chunk.GCBZ3WE2.js","./chunk.GDOTG7YA.js","./chunk.EPPXZZPK.js","./chunk.KFQSYCY3.js","./chunk.WQOI6BLM.js","./chunk.LCPGZK7G.js","./chunk.NKC3JILT.js","./chunk.HEWVPXRE.js","./chunk.LMN4TSAP.js","./chunk.HS3GHAUR.js","./chunk.LRUNFSHP.js","./chunk.43OKZU73.js","./chunk.WNSC3RWD.js","./chunk.ACYDJQRC.js","./chunk.S5MGE2U5.js","./chunk.34TW32TB.js","./chunk.BJUUSIQY.js","./chunk.VG7OWV2H.js","./chunk.KXPRILAO.js","./chunk.XOZU4OFA.js","./chunk.BB33TI4S.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.LDAYDCUO.js","./chunk.KKNDX4JT.js","./chunk.GKSUTAIX.js","./chunk.5ICIMQE6.js","./chunk.QGV7H7RQ.js","./chunk.YIA2EDVF.js","./chunk.GZHZLJBF.js","./chunk.ELERUERU.js","./chunk.OJGHDWI6.js","./chunk.YHTE34RN.js","./chunk.3YZHZGTM.js","./chunk.EQTSV7BK.js","./chunk.27CW6SCT.js","./chunk.YD3TKV6P.js","./chunk.4KC35UNR.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.32FMOHZK.js"))),ho=Te(()=>(__graviewPreload(import.meta.url,["./chunk.2VYNNWW5.js","./chunk.TF5I4VHX.js","./chunk.TWKXSLYY.js","./chunk.6VC6AGYV.js","./chunk.IDJPBWL2.js","./chunk.UGFDSE37.js","./chunk.PXQVXBNG.js","./chunk.BTVBZ6KE.js","./chunk.3OYGXYQY.js","./chunk.GCBZ3WE2.js","./chunk.GDOTG7YA.js","./chunk.EPPXZZPK.js","./chunk.KFQSYCY3.js","./chunk.WQOI6BLM.js","./chunk.LCPGZK7G.js","./chunk.NKC3JILT.js","./chunk.HEWVPXRE.js","./chunk.LMN4TSAP.js","./chunk.HS3GHAUR.js","./chunk.LRUNFSHP.js","./chunk.43OKZU73.js","./chunk.WNSC3RWD.js","./chunk.ACYDJQRC.js","./chunk.S5MGE2U5.js","./chunk.34TW32TB.js","./chunk.BJUUSIQY.js","./chunk.VG7OWV2H.js","./chunk.KXPRILAO.js","./chunk.XOZU4OFA.js","./chunk.BB33TI4S.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.LDAYDCUO.js","./chunk.KKNDX4JT.js","./chunk.GKSUTAIX.js","./chunk.5ICIMQE6.js","./chunk.QGV7H7RQ.js","./chunk.YIA2EDVF.js","./chunk.GZHZLJBF.js","./chunk.ELERUERU.js","./chunk.OJGHDWI6.js","./chunk.YHTE34RN.js","./chunk.3YZHZGTM.js","./chunk.EQTSV7BK.js","./chunk.27CW6SCT.js","./chunk.YD3TKV6P.js","./chunk.4KC35UNR.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.MYNQWWCL.js"))),Lr=pt(()=>Jt(Cr().then(e=>e.SceneFace)),{what:"This view"}),Mr=pt(()=>Cr().then(e=>e.SceneKeeping),{quiet:!0}),Hr=pt(()=>Jt(mo().then(e=>e.PagesContent)),{what:"This page"}),Dr=pt(()=>Jt(ho().then(e=>e.PictureFace)),{what:"This picture"}),yo=Lr.Face,go=Mr.Face,wo=Hr.Face,vo=Dr.Face;function Ve(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Vr));return Promise.all([...[...o].map(i=>i.fetch()),Zn()]).then(()=>{},()=>{})}var Vr=e=>e==="pages"?[Hr]:e==="picture"?[Dr]:[Lr,Mr],Br=e=>Vr(e).every(n=>n.here()),bo=150,Ut=0;function xr(e,n){if(Br(e))return n();let o=++Ut,i=()=>{o===Ut&&(Ut+=1,n())};Ve(e).then(i),setTimeout(i,bo)}var So=768;function Po(e,n){let o=n!==null&&n>=So;(0,d.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(Br(i))return;let c=globalThis,l=()=>void Ve(i),S=()=>{},p=Un(()=>{if(c.requestIdleCallback&&c.cancelIdleCallback){let w=c.requestIdleCallback(l,{timeout:4e3});S=()=>c.cancelIdleCallback?.(w)}else{let w=setTimeout(l,1500);S=()=>clearTimeout(w)}});return()=>(p(),S())},[e,o])}function ko({asked:e,shown:n,onDrawn:o}){return(0,d.useLayoutEffect)(()=>o(e,n),[e,n,o]),null}function Ao({auto:e,scene:n}){return(0,g.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${It}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var Eo=Ht(Te(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,g.jsx)(e.StudioPlace,{...n}),{quiet:!0});function $r(e,n,o,i,c){return $t(e,sr(n?ct(n):c??Mn,i),o)}function Yt(e){return e&&ct(e).overview?"graview":"scene"}function Fr(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 Nr(e){let[,n]=(0,d.useState)(!1),o=(0,d.useCallback)(()=>n(!0),[]),i=(0,d.useRef)(!1);return e.at&&!mt?(0,g.jsx)(Gt,{onReady:o,fetch:Qt}):!i.current&&Rr(e.draftView)?(0,g.jsx)(Gt,{onReady:o,fetch:zt}):(i.current=!0,(0,g.jsx)(Ro,{...e}))}function Ro(e){let{app:n,stop:o,bar:i=!0,standing:c="Everything is in order",principal:l,heading:S=2}=e,{rootRef:p,scope:w,css:E,scheme:T,store:P,presence:k,brand:F,auto:v,height:_}=pr(e),de=Tr(e.draftView),D=ur(e,rr,de.over),[ie]=(0,d.useState)(_n),f=e.basePath===void 0?{}:{basePath:e.basePath},[V]=(0,d.useState)(Dt),j=e.notices??V,Z=h=>xt(h,f),x={...e.routing?{routing:e.routing}:{},...f},[me]=(0,d.useState)(()=>{let h=e.at?.face;if(h)return h;let Q=o===void 0&&Fr(n,D)?"pages":Yt(o),K=Bt({...x,face:Q});return e.face===void 0&&e.onOpening?.(K),K}),[B,R]=(0,d.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&or(x)&&Fr(n,D)),he=(0,d.useRef)(e.onFace);he.current=e.onFace,(0,d.useLayoutEffect)(()=>{B&&(he.current?.("pages"),R(!1))},[B]);let L=B?"pages":e.face??me,O=n.schema.kinds,C=e.routing==="address",H=(0,d.useMemo)(()=>e.at?mt.settleAt(e,P.seenBy(l??{kind:"human"}),D.places()):void 0,[]),X=(0,d.useMemo)(()=>$n(D,n.schema),[D,n.schema]),q=(0,d.useMemo)(()=>{let h=H?.stop??(C?ar(e.basePath):void 0)??o;return L==="scene"&&h===void 0&&X===void 0&&(e.path===void 0||Kt(e.path))?Nt(void 0):$r(L,h,O,D.places(),X)},[]),[ye]=(0,d.useState)(L);(0,d.useEffect)(()=>{ye!=="pages"&&Bn(D)},[ye,D]);let $=(0,d.useRef)(void 0),Fe=h=>h===void 0||Kt(h)?"/":h;$.current??={path:Fe(H?.path??(C?L==="pages"?(Ft(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==$.current.asked&&($.current={path:Fe(e.path),asked:e.path});let M=(0,d.useRef)(e.onNavigate);M.current=e.onNavigate;let ee=(0,d.useCallback)((h,Q)=>{$.current.path=h,M.current?.(h,Q)},[]),{at:te,setAt:N,steering:Se,steer:J}=wr($.current.path),z=(0,d.useContext)(Wr);z&&(z.pages=()=>$.current.path);let G=(0,d.useRef)(void 0),le=(0,d.useCallback)(h=>void($.current.path=h),[]),ne=Yn(p),[Oe,Pe]=(0,d.useState)(!1),se=e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview")&&!Oe,A=se?"pages":L,Ce=(0,d.useRef)(!1);Ce.current=Oe&&e.pagesBelow!==void 0&&ne!==null&&ne<e.pagesBelow&&(L==="scene"||L==="graview"),z&&(z.shown=A);let Le=(0,d.useRef)(L==="graview"?"graview":"scene");(A==="scene"||A==="graview")&&(Le.current=A),(0,d.useState)(()=>{if(!C||typeof window>"u"||A==="pages"||A==="picture")return;let{pathname:h,search:Q,hash:K}=window.location;Ft(h,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${Z(Re)}${Q}${K}`)}),fr(p,A,e.onIntrinsicHeight),Po(A,ne);let re=vr(e.onError,A),Me=br(e.onReady,A),ke=(0,d.useRef)(e.onFaceDrawn);ke.current=e.onFaceDrawn;let Ye=(0,d.useCallback)((h,Q)=>{Me(Q),ke.current?.(h)},[Me]),[Be,wt]=(0,d.useState)(null),Qe=D.places(),$e=(0,d.useRef)({shown:A,onFace:e.onFace});$e.current={shown:A,onFace:e.onFace};let W=(0,d.useCallback)((h,Q,K)=>{if(C){G.current?.(h,Q,K);return}$e.current.onFace?.(h),M.current?.(h==="pages"?Q??$.current.path:Re,"push")},[C]),[ge,U]=(0,d.useState)(void 0);(0,d.useEffect)(()=>{A==="pages"&&U(void 0)},[A]);let Ne=(0,d.useRef)(o);(0,d.useEffect)(()=>{Ne.current!==o&&(Ne.current=o,U(void 0))},[o]);let Ae=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){if(Pe(!0),U(h),L==="scene"||L==="graview"){xr(L,()=>{C?window.history.pushState(null,"",`${Z(Re)}${h??""}`):M.current?.(Re,"push")});return}xr(Le.current,()=>W(Le.current,void 0,h))}},[C,L,e.basePath,W]),He=(0,d.useCallback)(h=>{if($e.current.shown==="pages"){Se.go.current||($.current.path=h),J(h);return}if($.current.path=h,N(h),Ce.current){Pe(!1),C?window.history.pushState(null,"",Z(h)):M.current?.(h,"push");return}W("pages",h)},[Se,J,N,W,C,e.basePath]),ze=D.arrangement?.(),ue=A==="pages",Ee=e.hrefOf,We=Ee??(C?Z:void 0),Y=(0,d.useMemo)(()=>({open:He,...Ee?{href:Ee}:C?{href:h=>xt(h,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[He,C,e.basePath,Ee]);return(0,g.jsxs)("section",{ref:p,className:w,"aria-label":e.label??n.name,"data-graview-embed":A,"data-graview-scheme":T,...se?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:_,minHeight:v?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,g.jsx)("style",{children:E}),(0,g.jsxs)(Jn.Provider,{value:re,children:[(0,g.jsx)(mr,{rootRef:p,board:j}),(0,g.jsx)(lr,{rootRef:p,firstLook:e.firstLook,app:er(F??{name:n.name},n.schema)}),(0,g.jsx)(Ue,{module:"@graview/react",report:re,content:!0,children:(0,g.jsx)(In.Provider,{value:ie,children:(0,g.jsx)(Vn,{store:P,views:D,initialView:q,scheme:T,...hr(e,k,F),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,g.jsxs)(Qn.Provider,{value:j,children:[(0,g.jsx)(Oo,{face:A,stop:ge??o,kinds:O,places:Qe,opens:X}),z?(0,g.jsx)(To,{into:z}):null,(0,g.jsx)(xo,{rootRef:p,face:L,shown:A,path:te,stop:o,draft:de.n,onDrawn:e.onDrawn,parts:ie}),C?(0,g.jsx)(ir,{pagesWere:H?.path,basePath:e.basePath,shown:A,onFace:e.onFace,toggle:G,kinds:O,places:Qe,opens:X,landed:le}):null,i&&A!=="picture"?(0,g.jsx)(Ue,{module:"@graview/embed",report:re,children:(0,g.jsx)(yr,{name:F?.name??n.name,heading:S,named:Wt(i).name!==!1,faces:Wt(i).faces===!1?void 0:{scene:{label:Fn(ze),current:!ue,go:()=>Ae(),reach:()=>void Ve(Le.current)},pages:{label:On(ze),current:ue,go:()=>He($.current.path),reach:()=>void Ve("pages")}},at:ue?te:null,without:e.pages?.without(),home:{...We?.("/")!==void 0?{href:We("/")}:{},go:()=>He("/"),current:ue&&te.split("?")[0]==="/"},reach:{...We?{href:We}:{},go:h=>He(h.path)},standing:c,hostActions:e.hostActions,keeping:ue?void 0:(0,g.jsx)(Co,{app:n,studio:e.studio,report:re}),onFind:wt,switch:e.switch})}):null,(0,g.jsx)(Xn.Provider,{value:Be,children:(0,g.jsx)(Ue,{module:A==="pages"||A==="picture"?"@graview/pages":"@graview/react",report:re,content:!0,children:(0,g.jsxs)(d.Suspense,{fallback:(0,g.jsx)(Ao,{auto:v,scene:A!=="pages"&&A!=="picture"}),children:[A==="picture"?(0,g.jsx)(vo,{scope:w,store:P,views:D,as:(o?ct(o).within?.view:void 0)??""}):A==="pages"?(0,g.jsx)(wo,{store:P,views:D,presence:k,auto:v,brand:F,steering:Se,overview:Ae,scope:w,titleLevel:gr(S),quickAsk:Vt(e.quickAsk),props:{...e,onNavigate:ee,...C?{}:{path:$.current.path}}}):(0,g.jsx)(Kn.Provider,{value:Y,children:(0,g.jsx)(yo,{address:C,auto:v,scheme:T,scope:w,quickAsk:Vt(e.quickAsk)})}),(0,g.jsx)(ko,{asked:L,shown:A,onDrawn:Ye})]})},A)})]})})})})]})]})}var Kt=e=>e.split(/[?#]/)[0]===Re,Wr=(0,d.createContext)(null);function To({into:e}){return e.view=dt().view,null}function xo({rootRef:e,face:n,shown:o,path:i,stop:c,draft:l,onDrawn:S,parts:p}){let{view:w}=dt(),E=o==="scene"||o==="graview",T=st(w),{pan:P,...k}=w,F=w.pan?st(k):T,v={face:n,path:E?Re:o==="picture"?c??"#":i,stop:T};return Ar(e,`${o} ${E?F:v.path} ${l}`,v,S,p),null}var mt,Fo=Te(()=>(__graviewPreload(import.meta.url,["./chunk.NOFWGDOT.js","./chunk.YD3TKV6P.js","./chunk.4KC35UNR.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.HMFJT4KO.js"))),Qt=()=>Fo().then(e=>void(mt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(Qt));function Oo({face:e,stop:n,kinds:o,places:i,opens:c}){let{view:l,go:S}=dt(),p=(0,d.useRef)({face:e,stop:n});return(0,d.useLayoutEffect)(()=>{let w=p.current.stop!==n,E=p.current.face!==e,T=p.current.face==="pages";if(p.current={face:e,stop:n},!w&&!E||e==="pages"||e==="picture")return;let P=(w||T)&&n!==void 0?$r(e,n,o,i):T&&cr(l)?$t(e,Nt(c),o):e==="graview"?Lt(l,!0):l.overview?Hn(Lt(l,!1),tr(l,o)):l;S(P)},[e,n,o,l,S,c]),null}function Co({app:e,studio:n,report:o}){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(d.Suspense,{fallback:null,children:(0,g.jsx)(go,{})}),n!==!1?(0,g.jsx)(Ue,{module:"@graview/studio",report:o,children:(0,g.jsx)(Lo,{app:e,studio:n})}):null]})}function Lo({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}:{}},i=n?.place;return i?(0,g.jsx)(i,{...o}):(0,g.jsx)(d.Suspense,{fallback:null,children:(0,g.jsx)(Eo,{...o})})}function Mo({path:e,stop:n,...o},i){return{...o,app:i.app,at:i.at,remote:i.remote,...i.remote.presence?{presence:i.remote.presence}:{}}}function Zt(e,n){let o=n.store??n.remote?.store??dr(n.app,n.seed),i=n.notices??Dt(),c=null,l={},S=0,p=n.label,w=n.app,E=Promise.resolve(),T=n.at?.face??n.face,P=T===void 0?void 0:Bt({...n,face:T}),k=P??Yt(n.stop),F=null,v=[],_=f=>{if(F=f,f!==k)return;let V=v;v=[];for(let j of V)j()};function de(){let[f,V]=(0,d.useState)(P),[j,Z]=(0,d.useState)(n.stop),[x,me]=(0,d.useState)(n.path),[B,R]=(0,d.useState)(n.scheme??"auto"),[he,L]=(0,d.useState)(n.principal),[O,C]=(0,d.useState)(n.seats),[H,X]=(0,d.useState)(n.quickAsk),[q,ye]=(0,d.useState)(n.people),[$,Fe]=(0,d.useState)(n.hostContext),[M,ee]=(0,d.useState)(n.brand),[te,N]=(0,d.useState)(n.whileAway),[Se,J]=(0,d.useState)(n.label),[z,G]=(0,d.useState)(n.hostActions),[le,ne]=(0,d.useState)(void 0),[Oe,Pe]=(0,d.useState)(n.draftView);return c={app:se=>{ne(se),me(void 0),Z(void 0)},face:V,stop:Z,path:me,scheme:R,seat:L,seats:C,quickAsk:X,people:ye,hostContext:Fe,brand:ee,whileAway:N,label:J,hostActions:G,draft:Pe},(0,g.jsx)(Wr.Provider,{value:l,children:(0,g.jsx)(Nr,{...le?Mo(n,le):n,store:o,notices:i,...f!==void 0?{face:f}:{},onOpening:se=>{k=se},...j!==void 0?{stop:j}:{},...x!==void 0?{path:x}:{},...he?{principal:he}:{},...O?{seats:O}:{},...H!==void 0?{quickAsk:H}:{},...q?{people:q}:{},...$?{hostContext:$}:{},...M?{brand:M}:{},whileAway:te,label:Se,hostActions:z,draftView:Oe,scheme:B,onFace:se=>{k=se,V(se)},onSeat:L,onFaceDrawn:_},le?.n??0)})}let D=()=>{let f=l.view?.focusId,V=f?o.graph.getNode(f)?.kind:void 0,j=(l.shown??k)==="scene"||(l.shown??k)==="graview";return{face:k,path:j?Re:l.pages?.()??n.path??"/",stop:l.view?st(l.view):n.stop??"#",...V?{kind:V}:{}}},ie=(0,Or.createRoot)(e);return(0,I.flushSync)(()=>ie.render((0,g.jsx)(de,{}))),{get store(){return o},where:D,setApp:(f,V,j)=>{let Z="graph"in V?{store:V}:V,x=()=>{let me=D();o=Z.store,p=j?.label??(p===w.name?f.name:p),w=f,(0,I.flushSync)(()=>{c?.label(p),c?.app({app:f,remote:Z,at:me,n:++S})})};mt?x():E=E.then(Qt).then(x)},setFace:f=>{k=f,(0,I.flushSync)(()=>c?.face(f))},setStop:f=>(0,I.flushSync)(()=>c?.stop(f)),setPath:f=>(0,I.flushSync)(()=>{if(Kt(f)){(k==="pages"||k==="picture")&&(k="scene",c?.face("scene"));return}c?.path(f),k!=="pages"&&(k="pages",c?.face("pages"))}),setScheme:f=>(0,I.flushSync)(()=>c?.scheme(f)),setSeat:f=>(0,I.flushSync)(()=>c?.seat(f)),setSeats:f=>(0,I.flushSync)(()=>c?.seats(f)),setQuickAsk:f=>(0,I.flushSync)(()=>c?.quickAsk(f)),setPeople:f=>(0,I.flushSync)(()=>c?.people(f)),setHostContext:f=>(0,I.flushSync)(()=>c?.hostContext(f)),setBrand:f=>(0,I.flushSync)(()=>c?.brand(f)),setWhileAway:f=>(0,I.flushSync)(()=>c?.whileAway(f)),setDraftView:f=>(0,I.flushSync)(()=>c?.draft(f)),setLabel:f=>{p=f,(0,I.flushSync)(()=>c?.label(f))},setHostActions:f=>(0,I.flushSync)(()=>c?.hostActions(f)),drawn:()=>E.then(()=>F===k?void 0:new Promise(f=>v.push(f))),notify:f=>{let V;return(0,I.flushSync)(()=>{V=i.notify(f)}),V},unmount:()=>ie.unmount()}}var ht=e=>`s${(e+1).toString(36)}`;var Ir="/graview/friction";var _r="/graview/live",Xt="graview.ship",en=`${Xt}.${ot}`;var be={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 je=class extends Error{constructor(n){super(n),this.name="Superseded"}},xe=e=>e?.lineage?{lineage:e.lineage}:{},Ho=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
|
|
2
|
-
`)[0]??"":String(n)})`;function Do(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(i=>!!i&&Array.isArray(i.calls)):[]}catch{return[]}}var qe=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Vo={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},pe=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},Je=class extends Error{constructor(n){super(n),this.name="Unreached"}},Bo=new Set([502,503,504]);async function $o(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function No(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var Wo=1,Io=()=>({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 yt(e){return(await jr(e,Do(e.carry),"This app was updated while your changes were on the way.",Io())).remote}async function jr(e,n,o,i){let c=e.fetch??fetch,l={"content-type":"application/json",...e.headers??{}},S={...gt(e.principal),[be.via]:e.via??"web"};Object.assign(l,S);let p=e.live===!0,w=e.presenceEveryMs,E=e.visible??qo,T="connecting",P=i.statuses,k=i.tally,F=[],v,_=[],de=()=>T==="online"&&v!==void 0?"held":T,D=()=>{let t=de();if(i.told!==t){i.told=t;for(let r of[...P])r(t)}},ie=t=>{if(!(t===T||ce)&&(T==="offline"&&t==="online"&&k.reconnects++,T=t,D(),t==="online"))for(let r of F.splice(0))r.again()},f=t=>{if(ce)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==v;if(v=r,V(),!!s&&(D(),r===void 0)){for(let a of _.splice(0))a();oe&&clearTimeout(oe),an()}},V=()=>{if(i.toldHeld!==v){i.toldHeld=v;for(let t of[...i.helds])t(v??null)}},j=async(t,r)=>{let s;try{s=await c(t,r)}catch(a){throw Y()||ie("offline"),new Je(a instanceof Error?a.message:String(a))}if(s.status===503&&await $o(s))return ie("online"),s;if(Bo.has(s.status))throw Y()||ie("offline"),new Je(`The server is away (${s.status})`);return ie("online"),s},Z=async(t=!1)=>{let r=`${e.url}/graview/state?opFormat=${_e.op}`,s=t?await c(r,{headers:l}):await j(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 Z(!0);p||(T="online"),v=typeof x.held=="string"&&x.held.length>0?x.held:void 0,V();let me=x.enabledModules??e.enabledModules,B=e.localApp?e.localApp(e.app):e.app,R=new xn({schema:B.schema,mutations:B.mutations??[],invariants:B.invariants??[],...B.policy?{policy:B.policy}:{},...B.publishing?{publishing:B.publishing}:{},...B.modules?{modules:B.modules}:{},...me?{enabledModules:me}:{},...B.intelligence?{intelligence:B.intelligence}:{},...B.brand?.timeZone?{timeZone:B.brand.timeZone}:{},snapshot:x.snapshot,log:x.log,...x.horizon!==void 0?{horizon:x.horizon}:{},ids:No(),...e.storeOptions??{}});kn.served.add(R);let he=e.friction!==!1&&e.principal?.kind!=="visitor";he&&An(R,t=>{he&&c(`${e.url}${Ir}`,{method:"POST",headers:l,body:JSON.stringify({event:t})}).then(r=>void(he=r.status!==404&&r.status!==410),()=>{})});let L=Rn(R),O=x.log.at(-1)?.seq??(x.horizon??0)-1,C=Tt.of(x.log,{horizon:x.horizon??0}),H=null,X,q=new Map,ye=i.who,$=!1,Fe=t=>{if(ce)return;$=!0;let r=Cn(new Map,t,Date.now(),Ot,H?.participant);X!==void 0&&r.delete(X);let s=r.size!==q.size;if(!s)for(let[a,u]of r)Ct(u,q.get(a))||(s=!0);if(q=r,!!s)for(let a of[...ye])a([...q.values()])},M=[],ee=new Set,te=t=>{let r=M.indexOf(t);r>=0&&M.splice(r,1)},N=new Map,Se=(t,r)=>{let s=N.get(t);s&&(N.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},J,z=[],G=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(J)return z.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(m=>m.seq>O).map(m=>m.seq));if(Number.isFinite(s)&&s>O+1)return z.push({ops:t,drop:r}),le(),[];let a=M.filter(m=>t.some(ae=>ae.batch===m)),u=[...new Set([...r,...a])].filter(m=>ee.has(m)),y,b=M.filter(m=>!a.includes(m));try{y=R.rebase({confirmed:t,pending:b,drop:u}).confirmed}catch(m){if(!(m instanceof Tn))throw m;return z.push({ops:t,drop:r}),le(),[]}for(let m of a)te(m);t.some(m=>m.seq>O)&&b.some(m=>!u.includes(m))&&k.rebases++,t.length>0&&(O=Math.max(O,...t.map(m=>m.seq)),C.note(t));for(let m of u)ee.delete(m);for(let m of a)Se(m,t);return y},le=()=>{J||(J=ke(Z().then(t=>{if(ne(t)){z=[];return}let r=new Set(t.log.map(u=>u.batch)),s=M.filter(u=>r.has(u));for(let u of s)te(u);let a=R.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[...M],drop:[...ee].filter(u=>!M.includes(u))});ee.clear();for(let u of a.pending)ee.add(u.batch);O=t.log.at(-1)?.seq??(t.horizon??0)-1,C=Tt.of(t.log,{horizon:t.horizon??0}),k.resyncs++;for(let u of s)Se(u,t.log)}).then(()=>{J=void 0;let t=z;z=[];for(let{ops:r,drop:s}of t)G(r,s)},()=>{J=void 0,z=[]})))},ne=t=>(typeof t.build=="string"&&cn(t.build),typeof t.version=="number"&&f(t.held),typeof t.version!="number"||t.version===x.version?!1:(St(t.version),!0)),Oe=async t=>{let s=await(await j(`${e.url}/graview/since?seq=${ht(t)}&opFormat=${_e.op}`,{headers:l})).json();return ne(s)?[]:s.reset===!0?(le(),[]):s.ops??[]},Pe=async()=>{let t=await se();return J&&await J,t},se=async()=>{if(H&&!Y()&&E()){let r=await(await j(`${e.url}/graview/here?opFormat=${_e.op}`,{method:"POST",headers:l,body:JSON.stringify({presence:H,seq:ht(O)})})).json();return ne(r)?[]:(typeof r.participant=="string"&&(X=r.participant),Fe(r.who??[]),G(r.ops??[]))}return G(await Oe(O))},A=new Map,Ce=new Map,Le=new Set,re=new Map,Me=new Set,ke=t=>(Me.add(t),t.finally(()=>Me.delete(t)).catch(()=>{}),t),Ye=Promise.resolve(),Be=0,wt=(t,r)=>{let s=Ye.then(()=>$e(t,r));return Ye=s.catch(()=>{}),s},Qe=()=>new Promise((t,r)=>F.push({again:t,give:r})),$e=async(t,r)=>{let s,a;for(;;){try{s=await j(`${e.url}/graview/ops`,{method:"POST",headers:l,body:JSON.stringify({...t,opFormat:_e.op})})}catch(m){if(!(m instanceof Je)||U)throw m;if(await Qe(),Y())return Ze(t,r);continue}if(a=await s.json().catch(()=>({})),s.status===503&&a.reason==="unavailable"&&typeof a.held=="string"&&!U){if(typeof a.version=="number"?ne(a):(f(a.held),!1))break;if(v!==void 0&&(Et>0||p)){if(await new Promise(m=>_.push(m)),U)throw new je("The client closed.");if(Y())return Ze(t,r);continue}}let b;if(s.status===503&&a.reason==="unavailable"&&!U)b=tn(e.backoff,Be++);else{if(Be=0,s.status!==429||U)break;b=_o(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(m=>setTimeout(m,b)),Y())return Ze(t,r)}if(ce||ne(a))throw new je("The app was changed.");if(!s.ok){let b=a.error??`The server refused (${s.status})`;throw a.conflict?new pe(b,a.conflicts??[]):new qe({reason:a.reason??Vo[s.status]??"invalid",sentence:b,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let u=a.ops??[],y=u[0]?.seq;return y!==void 0&&y>O+1&&(u=await Oe(O)),r!==void 0&&(a.batch&&A.set(r,a.batch),te(r)),G(u,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},W,ge=!1,U=!1,Ne=0,Ae,He=0,ze=0,ue=null,Ee=()=>{},We=new Promise(t=>{Ee=t}),Y=()=>p&&ge&&W?.readyState===Wo,h=t=>{if(!Y())return!1;try{return W.send(JSON.stringify(t)),!0}catch{return!1}},Q=(t=!1)=>{!H||!Y()||!E()||!t&&ue&&Ct(H,ue)&&(w===void 0||Date.now()-ze<w)||h({t:"here",presence:H})&&(ue=H,ze=Date.now())},K=new Set,oe,an=()=>{if(oe=void 0,v!==void 0)return;let t=[...N.entries()].filter(([r])=>K.has(r));K.clear();for(let[,r]of t)h(r.message)},sn=(t,r)=>{N.has(t)&&(K.add(t),oe&&clearTimeout(oe),oe=setTimeout(an,Math.max(0,r)))},Gr=t=>{N.has(t)&&K.add(t)},Ze=(t,r)=>new Promise((s,a)=>{let u=r??`send-${++He}`,y=t.undo?{t:"undo",cid:u,batches:t.undo,...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.via?{via:t.via}:{},...xe(t)}:{t:"call",cid:u,calls:t.calls??[],...t.intent?{intent:t.intent}:{},...t.batch?{batch:t.batch}:{},...t.base?.length?{base:t.base}:{},...t.via?{via:t.via}:{},...xe(t)};if(N.set(u,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),K.size>0||v!==void 0){K.add(u);return}h(y)}),Xe=(t,r)=>Y()?Ze(t,r):wt(t,r),Ur=t=>{switch(t.t){case"welcome":{if(cn(t.build),typeof t.version=="number"&&t.version!==x.version){St(t.version);return}if(ge=!0,Ne=0,typeof t.participant=="string"&&(X=t.participant),f(t.held),t.state?le():G(t.ops??[]),K.clear(),oe&&clearTimeout(oe),oe=void 0,v!==void 0)for(let r of N.keys())K.add(r);else for(let r of N.values())h(r.message);Q(!0),ie("online"),Ee();return}case"ops":G(t.ops??[]);return;case"ack":{let r=N.get(t.cid);if(!r){G(t.ops??[]);return}N.delete(t.cid),Be=0,r.mine!==void 0&&(A.set(r.mine,t.batch),te(r.mine)),G(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=N.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){v!==void 0?Gr(t.cid):sn(t.cid,tn(e.backoff,Be++));return}N.delete(t.cid),r.reject(t.t==="conflict"?new pe(t.sentence,t.conflicts??[]):new qe({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&sn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":Fe(t.who??[]);return;case"held":f(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==x.version&&St(t.version);return;case"reload":fn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&W){let r=W;mn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},ce=!1,vt=i.declarations,bt=i.builds,cn=t=>{if(!(ce||i.otherBuild!==void 0||!e.build||typeof t!="string"||t.length===0||t===e.build)){i.otherBuild=t;for(let r of[...bt])r(t)}},dn=()=>{let t=[],r=0;for(let s of M){let a=re.get(s);a?t.push({calls:a.calls,...a.intent?{intent:a.intent}:{},...a.via?{via:a.via}:{},...xe(a),batch:s}):r++}return{carried:t,undos:r}},ln=(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.`,un=t=>{ce=!0,H=null;let r=new je(t);for(let a of N.values())a.reject(r);N.clear(),nt&&clearInterval(nt),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let a of F.splice(0))a.give(r);for(let a of _.splice(0))a();let s=W;W=void 0,ge=!1;try{s?.close(1e3,t)}catch{}Ee()};async function St(t){if(ce)return;if(!e.resolveApp){fn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=dn(),a=e.resolveApp,u=H;un("The app was changed.");try{let y=await a(t),{state:b,...m}=e,ae=await jr({...m,app:y},r,"The app was changed while your changes were on the way.",i);u&&ae.remote.presence.here(u);for(let rt of[...vt])rt(ae.remote,t);let fe=[...s>0?[et(ln(s,"The app was changed"))]:[],...ae.unheard()];for(let rt of fe)for(let to of Ie)to(rt.sentence,rt)}catch(y){let b=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let m of Ie)m(b,et(b))}}function fn(t){if(ce)return;let{carried:r,undos:s}=dn();un(t);let a=!1;if(e.carry&&r.length>0)try{e.carry.storage.setItem(e.carry.key,JSON.stringify(r)),a=!0}catch{}let u=[];!a&&r.length>0&&u.push(`${t} ${r.length===1?"A change of yours was":`${r.length} changes of yours were`} not sent; make ${r.length===1?"it":"them"} again after the page reloads.`),s>0&&u.push(ln(s,"This app was updated"));for(let y of u)for(let b of Ie)b(y,et(y));(e.reloadPage??jo)()}let pn=()=>{if(U||!p)return;let t=`${e.url.replace(/^http/,"ws").replace(/\/$/,"")}${_r}`,{"content-type":r,...s}=l,a;try{a=e.socket?e.socket(t,s,[en]):eo(t,s)}catch{return hn()}W=a,ge=!1,a.onopen=()=>{W===a&&a.send(JSON.stringify({t:"hello",seq:ht(O),protocol:ot,wire:Xt,opFormat:_e.op,...e.build?{build:e.build.slice(0,64)}:{},...e.hostProtocol!==void 0?{hostProtocol:e.hostProtocol}:{}}))},a.onmessage=u=>{if(W!==a)return;let y;try{y=JSON.parse(String(u.data))}catch{return}Ur(y)},a.onclose=()=>mn(a),a.onerror=()=>{}},we,Kr=()=>{$=!1,we&&clearTimeout(we),we=setTimeout(()=>{if(we=void 0,$||U)return;let t=new Map([...q].filter(([,r])=>r.held!=="socket"));if(t.size!==q.size){q=t;for(let r of ye)r([...q.values()])}},Ot),we.unref?.()};function mn(t){if(W!==t)return;let r=ge;W=void 0,ge=!1,ue=null,r&&(ie("offline"),Kr()),hn()}let hn=()=>{if(U)return;let t=tn(e.backoff,Ne);Ne++,Ae=setTimeout(pn,t)},yn=R.applyAll.bind(R),Jr=R.undo.bind(R),Yr=R.previewAll.bind(R);R.previewAll=(t,r)=>Yr(t,{...e.principal?{author:e.principal}:{},...r});let Ie=i.refusals,Ge=[],et=t=>({reason:"invalid",sentence:t}),tt=i.conflicts,Pt=!1,gn,kt=async(t,r)=>{if(r instanceof je||ce)return;let s=r instanceof qe?r.refusal:Sn(r),a=s.sentence,u=r instanceof pe?gn?.yoursOf(R,re.get(t)?.calls??[]):void 0;te(t);try{G([],[t])}catch{}let y=re.get(t);re.delete(t);let b=y?.calls[0];if(b&&!(r instanceof pe)){let m=R.allMutations().find(fe=>fe.name===b.name)?.subject?.arg,ae=m&&R.graph.getNode(b.args[m])?.kind;En(R,{type:"refused",act:b.name,code:s.reason,...ae?{kind:ae}:{}},e.principal)}if(r instanceof pe&&k.conflicts++,r instanceof pe&&!Y()&&await Pe().catch(()=>[]),r instanceof pe&&J&&await J,r instanceof pe&&tt.size>0){let m=!1,ae={sentence:a,conflicts:u?r.conflicts.map(fe=>fe.node===u.node&&fe.field===u.field?{...fe,yours:u.yours}:fe):r.conflicts,keepTheirs(){m=!0},useMine(){if(!(m||!y)){m=!0,Pt=!0;try{R.applyAll(u?[u.over(O)]:y.calls,{...y.intent?{intent:y.intent}:{},...y.via?{via:y.via}:{},...xe(y)})}finally{Pt=!1}}}};for(let fe of tt)fe(ae);return}for(let m of Ie)m(a,s)},Qr=(t,r)=>t.flatMap(s=>s.mutation?.name===bn?[]:s.primitives.flatMap(a=>a.op==="splice-text"&&!r.has(a.id)&&!r.has(`${a.id}\0${a.field}`)?[{node:a.id,field:a.field,rev:O}]:[]));R.applyAll=(t,r)=>{let s=Pn(R.log.all().filter(b=>ee.has(b.batch))),a=yn(t,{...e.principal?{author:e.principal}:{},...r}),u=t.map((b,m)=>{let ae=a.minted?.[m];return ae===void 0||b.args?.id!==void 0?b:{...b,mintedHint:ae}});M.push(a.batch),ee.add(a.batch),re.set(a.batch,{calls:u,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...xe(r)});let y=Pt?[]:[...C.baseFor(a.ops,s,(b,m)=>R.collaborative(b,m)),...Qr(a.ops,s)];return Ce.set(a.batch,ke(Xe({calls:u,...r?.intent?{intent:r.intent}:{},batch:a.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...xe(r)},a.batch).catch(b=>kt(a.batch,b)))),a},R.apply=(t,r)=>R.applyAll([t],r),R.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=Jr(s.map(y=>A.get(y)??y),{...e.principal?{author:e.principal}:{},...r});M.push(a.batch),ee.add(a.batch);let u=Promise.allSettled(s.map(y=>Ce.get(y)));return Ce.set(a.batch,ke(u.then(()=>{let y=s.filter(b=>!Le.has(b));if(y.length===0){te(a.batch),re.delete(a.batch),G([],[a.batch]);return}return Xe({undo:y.map(b=>A.get(b)??b),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...xe(r)},a.batch)}).catch(y=>kt(a.batch,y)))),a};let Zr=async(t,r={})=>{At++;try{return(await ke(Xe({calls:t,...r}))).ops}finally{At--}},At=0,wn={here(t){H=t,Q()},onWho(t){return ye.add(t),q.size>0&&t([...q.values()]),()=>{ye.delete(t)}},leave(){if(!H)return;let t=JSON.stringify({participant:X??H.participant});if(H=null,h({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${e.url}/graview/leave`,t):c(`${e.url}/graview/leave`,{method:"POST",headers:l,body:t}).catch(()=>{})}},Et=e.pollMs??800,nt=Et>0&&typeof setInterval=="function"?setInterval(()=>{Y()||Pe().catch(()=>{})},Et):null;if(p){pn();let t;await Promise.race([We,new Promise(r=>t=setTimeout(r,e.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!ce){let t=[],r=new Set(R.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{R.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...xe(s)})}catch(a){t.push(Ho(s,a))}t.length>0&&Ge.push(et(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let vn=new Map,Xr=()=>({store:R,author:e.principal,appliedAll:yn,pending:M,provisional:ee,asked:re,answers:Ce,letGo:Le,sent:(t,r)=>ke(Xe({calls:r,batch:t},t).catch(s=>kt(t,s))),settle:te,land:G,seen:()=>O,gone:()=>U||ce});return{remote:{store:R,typing(t,r){let s=`${t}\0${r}`,a=vn.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.HZB5F476.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.OASYYMG5.js")).then(u=>(gn=u,u.typingOf(t,r,u.wireOf(Xr())))),vn.set(s,a)),a},version:x.version,migrated:x.migrated??[],send:Zr,pull:Pe,onRefusal(t){Ie.add(t);let r=Ge;Ge=[];for(let s of r)t(s.sentence,s);return()=>Ie.delete(t)},onDeclaration(t){return vt.add(t),()=>vt.delete(t)},onBuild(t){return bt.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>bt.delete(t)},onConflict(t){return tt.add(t),()=>tt.delete(t)},revision:(t,r)=>C.of(t,r),seq:()=>O,participant:()=>X,transport:()=>Y()?"socket":"poll",status:de,onStatus(t){return P.add(t),()=>P.delete(t)},held:()=>v,onHeld(t){return i.helds.add(t),v!==void 0&&t(v),()=>i.helds.delete(t)},counters:()=>({...k}),who:()=>[...q.values()],pending:()=>M.length+At,async settled(){for(;Me.size>0;)await Promise.allSettled([...Me])},presence:wn,close(){nt&&clearInterval(nt),L(),wn.leave(),U=!0,Ae&&clearTimeout(Ae),oe&&clearTimeout(oe),we&&clearTimeout(we);for(let r of F.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of _.splice(0))r();let t=W;W=void 0,ge=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Ge;return Ge=[],t}};function eo(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let a=typeof globalThis.document<"u",u=e.subprotocol?[en]:[];if(!a)try{return new s(t,{headers:r,...u.length>0?{protocols:u}:{}})}catch{}let y=new URL(t);for(let[b,m]of Object.entries(S))y.searchParams.set(b,m);return u.length>0?new s(y.toString(),u):new s(y.toString())}}function _o(e,n,o=Date.now()){let i,c=e?.trim();if(c)if(/^\d+(\.\d+)?$/.test(c))i=Number(c)*1e3;else{let p=Date.parse(c);Number.isFinite(p)&&(i=Math.max(0,p-o))}let l=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,S=l!==void 0&&l<50&&i!==void 0&&Math.abs(l*1e3-i)<1e3;return l!==void 0&&!S?l:i??1e3}function jo(){globalThis.location?.reload?.()}function qo(){return globalThis.document?.visibilityState!=="hidden"}function tn(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:c=2}=e??{};return Math.min(i,o*c**n)*(.75+Math.random()*.5)}function gt(e){let n={};if(!e)return n;e.id&&(n[be.seat]=e.id),e.roles?.length&&(n[be.roles]=e.roles.join(",")),e.kind!=="human"&&(n[be.kind]=e.kind),e.name&&(n[be.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[be.for]=o.id),o?.roles?.length&&(n[be.forRoles]=o.roles.join(",")),o?.name&&(n[be.forName]=encodeURIComponent(o.name)),n}var qr="/graview/views";function nn(e){let n=e.fetch??fetch,o=e.url.replace(/\/$/,""),i={"content-type":"application/json",...e.principal?gt(e.principal):{},...e.headers??{}},c=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??at.may}:at,l=new Set,S=P=>{if(JSON.stringify(P)!==JSON.stringify(c)){c=P;for(let k of l)k()}},p=async(P,k)=>{let F=await n(`${o}${e.path??qr}`,{method:P,headers:i,...k!==void 0?{body:JSON.stringify(k)}:{}}),v=await F.json();if(!F.ok)throw new Error(v.error??`The store answered ${F.status}.`);S({hidden:v.hidden??[],removed:v.removed??[],may:v.may??at.may})},w=()=>p("GET"),E=e.state?Promise.resolve():w().catch(()=>{}),T=e.pollMs?setInterval(()=>void w().catch(()=>{}),e.pollMs):void 0;return{ready:E,refresh:w,close:()=>clearInterval(T),current:()=>c,onChange(P){return l.add(P),()=>void l.delete(P)},hide:P=>p("POST",{hide:P}),show:P=>p("POST",{show:P}),remove:(P,k)=>p("POST",{remove:P,...k?{about:k}:{}}),async restore(P){let k=c.removed.find(F=>F.name===P)?.lens;await p("POST",{restore:P}),k&&await e.onDeclaration?.()},async lens(P){await p("POST",{lens:P}),await e.onDeclaration?.()}}}var on=document.getElementById("graview-app"),rn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),zr=rn?(__graviewPreload(import.meta.url,["./chunk.TF5I4VHX.js","./chunk.S5MGE2U5.js","./chunk.XOZU4OFA.js","./chunk.BB33TI4S.js","./chunk.PBCNOFQH.js","./chunk.RRKYJYZJ.js","./chunk.3YZHZGTM.js","./chunk.EQTSV7BK.js","./chunk.27CW6SCT.js","./chunk.4KC35UNR.js","./chunk.HT2BEOEV.js","./chunk.SDO3U72B.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.JGKA5QBX.js")):Ve("pages");try{rn?await zo(decodeURIComponent(rn[1])):await Go()}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),on.replaceChildren(n),window.__graviewFailed=n.textContent}async function zo(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 i=await lt(o);if(!i.ok)throw new Error(it(i.findings));let c=i.app,l=o.principal,S=await yt({app:c,url:location.origin,principal:l,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=c.forms?.[e]?.title??c.name;let{mount:p}=await zr;window.__graview=p(on,{app:c,form:e,principal:l,remote:S,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Go(){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(),i=await(async w=>{if(typeof w.module=="string")return(await import(w.module)).app;let E=await lt(w);if(!E.ok)throw new Error(it(E.findings));return E.app})(n);if(!i||typeof i!="object"||!("schema"in i))throw new Error("The app module the preview server handed does not export an app.");let c=n.principal,l=await yt({app:i,url:location.origin,principal:c,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let S,p=nn({url:location.origin,principal:c,...n.views?{state:n.views}:{},onDeclaration:async()=>{let w=await(await fetch("/graview/document")).json();if(typeof w.module=="string")return;let E=await lt(w);E.ok&&S?.setApp(E.app,l)}});await Promise.all([zr,p.ready]),S=Zt(on,{app:i,remote:l,principal:c,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:p,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=S,S.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 co}from"./chunk.HUJ6YTWE.js";import{a as qt,b as hr,c as yr,d as gr,e as zt,f as wr,g as vr,h as br,i as Sr,j as kr,k as Pr,l as Ar,m as Er,n as Ze}from"./chunk.JJGCTGWA.js";import{b as mr}from"./chunk.XR6YR6RV.js";import{a as It,b as cr,c as lr,d as ur,e as fr,f as _t,g as pr,h as jt}from"./chunk.NHUQ2N6J.js";import{a as Ot,g as $n}from"./chunk.7TFLRR7D.js";import{k as ct}from"./chunk.KGW75Z5L.js";import{E as ir,I as sr,J as dr,h as tr,k as Nt,l as nr,n as rr,r as or,w as Wt,z as ar}from"./chunk.WC3DENU4.js";import{c as so}from"./chunk.VNDKKTED.js";import{Aa as Jn,Ca as Yn,Da as Qn,Fa as Zn,G as $t,Ga as Bt,Ka as Xn,La as er,Oa as ft,T as Wn,Z as In,a as Bn,b as lt,c as ut,ga as _n,ha as jn,j as Nn,m as Dt,va as qn,wa as zn,xa as Gn,ya as Un,za as Kn}from"./chunk.4MP72LPR.js";import{a as Re}from"./chunk.SDO3U72B.js";import{$d as Mt,Eb as Rn,Gb as Tn,Td as Ee,Ud as Hn,Vd as Vn,_d as Lt,ae as Ht,de as Dn,ee as Vt,fb as je,ld as Fn,md as On,nc as Ct,oc as xn,qb as st,rd as Cn,td as Ln,ud as Mn,vb as En,wd as dt}from"./chunk.VSCIXAHN.js";import"./chunk.FQLNBIQ5.js";import{b as Me}from"./chunk.AJZBJBMO.js";function Gt(e){if(Array.isArray(e))return e.map(Gt);if(e&&typeof e=="object"){let n={};for(let o of Object.keys(e).sort()){let i=e[o];i!==void 0&&(n[o]=Gt(i))}return n}return e}function Ut(e){return JSON.stringify(Gt(e))??"undefined"}async function pt(e,n={}){let o=e.compiled===void 0||!uo(e.compiled,e.document)?void 0:$n(e.compiled,n);if(o?.ok)return o;let{compileDocumentWithoutCheck:i}=await lo();return i(e.document,n)}var Rr,lo=()=>Rr??=(__graviewPreload(import.meta.url,["./chunk.7TFLRR7D.js","./chunk.6ZQAR5ZA.js","./chunk.PI44XMY2.js","./chunk.KGW75Z5L.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.C7OLSEWK.js")).catch(e=>{throw Rr=void 0,e});function uo(e,n){let o=typeof e=="object"&&e!==null?e.document:void 0,i=n;if(typeof i=="string")try{i=JSON.parse(i)}catch{return!1}return o!==void 0&&Ut(Ot(o).document)===Ut(Ot(i).document)}var c=Me($t(),1);var ht=Me($t(),1),Kt="data-graview-drawn",fo=200,Tr=50,po=1e4,mt=()=>typeof performance<"u"?performance.now():Date.now();function mo(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 ho(e,n){if(e.ownerDocument.fonts?.status==="loading"||zn()>0||Jn(n)>0||e.querySelector('[aria-busy="true"]')||mo(e).some(i=>!i.complete&&i.loading!=="lazy"))return!1;for(let i of e.querySelectorAll("[data-worker-view-place]"))if(!i.querySelector("[data-worker-view][data-worker-view-drawn], [data-worker-view][data-worker-view-failed]"))return!1;return!0}function xr(e){let n=e.querySelector("[data-embed-content]"),o=[...e.querySelectorAll("[data-worker-view]")].map(i=>`${i.offsetWidth}x${i.offsetHeight}`);return`${e.scrollWidth}x${e.scrollHeight}|${n?`${n.scrollWidth}x${n.scrollHeight}`:""}|${o.join(",")}`}function yo(e,n,o,i){e.removeAttribute(Kt);let l=e.ownerDocument.defaultView;if(!l)return()=>{};let u=mt(),d=u,w=xr(e),m=!1,P,F=typeof MutationObserver>"u"?void 0:new MutationObserver(x=>{x.some(O=>!(O.target===e&&O.attributeName===Kt))&&(d=mt())});F?.observe(e,{childList:!0,subtree:!0,characterData:!0,attributes:!0});let B=()=>{m=!0,F?.disconnect(),P!==void 0&&clearTimeout(P)},b=x=>{let O=!1,ne=()=>{O||(O=!0,x())};typeof l.requestAnimationFrame=="function"&&l.requestAnimationFrame(()=>setTimeout(ne,0)),setTimeout(ne,100)},T=()=>{if(m)return;let x=xr(e);x!==w&&(w=x,d=mt());let O=mt();if(ho(e,i)&&O-d>=fo||O-u>=po){b(()=>{m||(B(),e.setAttribute(Kt,n),Qn(),o())});return}P=setTimeout(T,Tr)};return P=setTimeout(T,Tr),B}function Fr(e,n,o,i,l){Yn();let u=(0,ht.useRef)({place:o,onDrawn:i});u.current={place:o,onDrawn:i},(0,ht.useLayoutEffect)(()=>{l&&Kn(l);let d=P=>yo(P,u.current.place.path,()=>u.current.onDrawn?.(u.current.place),l);if(e.current)return d(e.current);let w,m=!1;return queueMicrotask(()=>{!m&&e.current&&(w=d(e.current))}),()=>{m=!0,w?.()}},[n,e,l])}var we=Me($t(),1),Xe,go=Re(()=>(__graviewPreload(import.meta.url,["./chunk.5IEFTFKQ.js","./chunk.BRT27WON.js","./chunk.DCHQHKSA.js","./chunk.RXYNW5QB.js","./chunk.PFSYXD6Q.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.4TCKEG6I.js"))),Or=()=>go().then(e=>void(Xe=e),()=>new Promise(e=>setTimeout(e,2e3)).then(Or)),Jt=qn(Or),Cr=e=>!!e&&Xe===void 0;function Yt({onReady:e,fetch:n}){return(0,we.useLayoutEffect)(()=>void n().then(e),[e,n]),null}var wo=0;function Lr(e){let[n,o]=(0,we.useState)(()=>Xe);(0,we.useEffect)(()=>{if(!e||n)return;let u=!1;return Jt().then(()=>{u||o(Xe)}),()=>{u=!0}},[e,n]);let i=(0,we.useMemo)(()=>wo+=1,[e]);return{over:(0,we.useMemo)(()=>{let u=n??Xe;if(!e||!u)return;let{source:d,worker:w,...m}=e,P={...m,worker:w??{source:d},draft:!0};return{name:e.manifest.name,home:e.manifest.attach==="home",register:F=>u.registerWorkerView(F,P)}},[e,n]),n:i}}var Vr=Me(co(),1),I=Me(so(),1);var g=Me(Wn(),1);function yt(e,n={}){let o=Bt(e);return{Face:o.part((l,u)=>(0,c.createElement)(l,u),n),fetch:()=>o.load().then(()=>{}),here:()=>o.current!==void 0||o.failed}}var Xt=e=>Promise.all([e,sr()]).then(([n])=>n),Dr=Re(()=>(__graviewPreload(import.meta.url,["./chunk.3UOKUF5Z.js","./chunk.CC5BJH5A.js","./chunk.QI4SLPQ4.js","./chunk.Y5C4RXG7.js","./chunk.FRYBMS3W.js","./chunk.3MOJF7BA.js","./chunk.LZIBQ3VX.js","./chunk.HJCQ6I3S.js","./chunk.QDSEVPF3.js","./chunk.7N32AVIJ.js","./chunk.X6A4VSSD.js","./chunk.KDRLUBVF.js","./chunk.PNW5K7BW.js","./chunk.ENL2JJ47.js","./chunk.BQIHNT7C.js","./chunk.3XGA65Y3.js","./chunk.2K4TT2BV.js","./chunk.OLFJH4RK.js","./chunk.67U6M7OV.js","./chunk.ZP5RT2EK.js","./chunk.VZJWJ5XM.js","./chunk.JJGCTGWA.js","./chunk.XR6YR6RV.js","./chunk.VFOON3Z3.js","./chunk.GZHZLJBF.js","./chunk.IOK4GVJC.js","./chunk.OJGHDWI6.js","./chunk.TLJOZSDD.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KBVTLNS5.js"))),vo=Re(()=>(__graviewPreload(import.meta.url,["./chunk.3V4WP7RY.js","./chunk.LLYRFVIN.js","./chunk.YFSBVZTG.js","./chunk.G4YJPKRG.js","./chunk.3UOKUF5Z.js","./chunk.Q355UPFG.js","./chunk.PXQVXBNG.js","./chunk.MVWC3VR3.js","./chunk.CC5BJH5A.js","./chunk.CFKZXLXS.js","./chunk.Y5C4RXG7.js","./chunk.7MHCGVGM.js","./chunk.FRYBMS3W.js","./chunk.LQVAABPS.js","./chunk.NGTRL5U4.js","./chunk.3MOJF7BA.js","./chunk.LZIBQ3VX.js","./chunk.YZ7FUKAL.js","./chunk.KDRLUBVF.js","./chunk.BQIHNT7C.js","./chunk.TAT2IQUR.js","./chunk.3XGA65Y3.js","./chunk.BYKD5RLA.js","./chunk.2K4TT2BV.js","./chunk.VUBNBTJP.js","./chunk.BJUUSIQY.js","./chunk.ZP5RT2EK.js","./chunk.VZJWJ5XM.js","./chunk.XOZU4OFA.js","./chunk.GLWSVSQL.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.7VKSXGTX.js","./chunk.TY4GQJKC.js","./chunk.6ZQAR5ZA.js","./chunk.W3W54DSX.js","./chunk.PI44XMY2.js","./chunk.KGW75Z5L.js","./chunk.GZHZLJBF.js","./chunk.IOK4GVJC.js","./chunk.OJGHDWI6.js","./chunk.TLJOZSDD.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.L6AWE76F.js"))),bo=Re(()=>(__graviewPreload(import.meta.url,["./chunk.3V4WP7RY.js","./chunk.LLYRFVIN.js","./chunk.YFSBVZTG.js","./chunk.G4YJPKRG.js","./chunk.3UOKUF5Z.js","./chunk.Q355UPFG.js","./chunk.PXQVXBNG.js","./chunk.MVWC3VR3.js","./chunk.CC5BJH5A.js","./chunk.CFKZXLXS.js","./chunk.Y5C4RXG7.js","./chunk.7MHCGVGM.js","./chunk.FRYBMS3W.js","./chunk.LQVAABPS.js","./chunk.NGTRL5U4.js","./chunk.3MOJF7BA.js","./chunk.LZIBQ3VX.js","./chunk.YZ7FUKAL.js","./chunk.KDRLUBVF.js","./chunk.BQIHNT7C.js","./chunk.TAT2IQUR.js","./chunk.3XGA65Y3.js","./chunk.BYKD5RLA.js","./chunk.2K4TT2BV.js","./chunk.VUBNBTJP.js","./chunk.BJUUSIQY.js","./chunk.ZP5RT2EK.js","./chunk.VZJWJ5XM.js","./chunk.XOZU4OFA.js","./chunk.GLWSVSQL.js","./chunk.MB7LKKUD.js","./chunk.WVUJXDXZ.js","./chunk.7VKSXGTX.js","./chunk.TY4GQJKC.js","./chunk.6ZQAR5ZA.js","./chunk.W3W54DSX.js","./chunk.PI44XMY2.js","./chunk.KGW75Z5L.js","./chunk.GZHZLJBF.js","./chunk.IOK4GVJC.js","./chunk.OJGHDWI6.js","./chunk.TLJOZSDD.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.MDJWK5W2.js"))),$r=yt(()=>Xt(Dr().then(e=>e.SceneFace)),{what:"This view"}),Br=yt(()=>Dr().then(e=>e.SceneKeeping),{quiet:!0}),Nr=yt(()=>Xt(vo().then(e=>e.PagesContent)),{what:"This page"}),Wr=yt(()=>Xt(bo().then(e=>e.PictureFace)),{what:"This picture"}),So=$r.Face,ko=Br.Face,Po=Nr.Face,Ao=Wr.Face;function He(...e){let n=e.length>0?e:["scene","pages","picture"],o=new Set(n.flatMap(Ir));return Promise.all([...[...o].map(i=>i.fetch()),rr()]).then(()=>{},()=>{})}var Ir=e=>e==="pages"?[Nr]:e==="picture"?[Wr]:[$r,Br],_r=e=>Ir(e).every(n=>n.here()),Eo=150,Qt=0;function Mr(e,n){if(_r(e))return n();let o=++Qt,i=()=>{o===Qt&&(Qt+=1,n())};He(e).then(i),setTimeout(i,Eo)}var Ro=768;function To(e,n){let o=n!==null&&n>=Ro;(0,c.useEffect)(()=>{if(!o||e==="picture")return;let i=e==="pages"?"scene":"pages";if(_r(i))return;let l=globalThis,u=()=>void He(i),d=()=>{},w=Zn(()=>{if(l.requestIdleCallback&&l.cancelIdleCallback){let m=l.requestIdleCallback(u,{timeout:4e3});d=()=>l.cancelIdleCallback?.(m)}else{let m=setTimeout(u,1500);d=()=>clearTimeout(m)}});return()=>(w(),d())},[e,o])}function xo({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,g.jsx)("div",{"data-embed-content":"","aria-busy":"true",style:{flex:e?n?`0 0 ${zt}px`:"0 0 auto":"1 1 auto",minHeight:0,background:"var(--graview-ground)"}})}var Oo=Bt(Re(()=>(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.5JNXQHN4.js")))).part((e,n)=>(0,g.jsx)(e.StudioPlace,{...n}),{quiet:!0});function jr(e,n,o,i,l){return _t(e,fr(n?ut(n):l??Bn,i),o)}function en(e){return e&&ut(e).overview?"graview":"scene"}function Hr(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 qr(e){let[,n]=(0,c.useState)(!1),o=(0,c.useCallback)(()=>n(!0),[]),i=(0,c.useRef)(!1);return e.at&&!gt?(0,g.jsx)(Yt,{onReady:o,fetch:tn}):!i.current&&Cr(e.draftView)?(0,g.jsx)(Yt,{onReady:o,fetch:Jt}):(i.current=!0,(0,g.jsx)(Co,{...e}))}function Co(e){let{app:n,stop:o,bar:i=!0,standing:l="Everything is in order",principal:u,heading:d=2}=e,{rootRef:w,scope:m,css:P,scheme:F,store:B,presence:b,brand:T,auto:x,height:O}=wr(e),ne=Lr(e.draftView),E=yr(e,dr,ne.over),[de]=(0,c.useState)(Un),p=e.basePath===void 0?{}:{basePath:e.basePath},[D]=(0,c.useState)(Nt),N=e.notices??D,U=v=>Lt(v,p),oe={...e.routing?{routing:e.routing}:{},...p},[ae]=(0,c.useState)(()=>{let v=e.at?.face;if(v)return v;let X=o===void 0&&Hr(n,E)?"pages":en(o),$=It({...oe,face:X});return e.face===void 0&&e.onOpening?.($),$}),[be,H]=(0,c.useState)(()=>e.face!==void 0&&e.face!=="pages"&&!e.at&&o===void 0&&cr(oe)&&Hr(n,E)),Se=(0,c.useRef)(e.onFace);Se.current=e.onFace,(0,c.useLayoutEffect)(()=>{be&&(Se.current?.("pages"),H(!1))},[be]);let A=be?"pages":e.face??ae,k=n.schema.kinds,V=e.routing==="address",ke=(0,c.useMemo)(()=>e.at?gt.settleAt(e,B.seenBy(u??{kind:"human"}),E.places()):void 0,[]),L=(0,c.useMemo)(()=>jn(E,n.schema),[E,n.schema]),pe=(0,c.useMemo)(()=>{let v=ke?.stop??(V?lr(e.basePath):void 0)??o;return A==="scene"&&v===void 0&&L===void 0&&(e.path===void 0||Zt(e.path))?jt(void 0):jr(A,v,k,E.places(),L)},[]),[W]=(0,c.useState)(A);(0,c.useEffect)(()=>{W!=="pages"&&_n(E)},[W,E]);let M=(0,c.useRef)(void 0),q=v=>v===void 0||Zt(v)?"/":v;M.current??={path:q(ke?.path??(V?A==="pages"?(Mt(window.location.pathname,e.basePath)??"/")+window.location.search:"/":e.path)),asked:e.path},e.path!==M.current.asked&&(M.current={path:q(e.path),asked:e.path});let Z=(0,c.useRef)(e.onNavigate);Z.current=e.onNavigate;let xe=(0,c.useCallback)((v,X)=>{M.current.path=v,Z.current?.(v,X)},[]),{at:Pe,setAt:_,steering:K,steer:re}=Pr(M.current.path),C=(0,c.useContext)(zr);C&&(C.pages=()=>M.current.path);let Fe=(0,c.useRef)(void 0),J=(0,c.useCallback)(v=>void(M.current.path=v),[]),Y=tr(w),[z,me]=(0,c.useState)(!1),Q=e.pagesBelow!==void 0&&Y!==null&&Y<e.pagesBelow&&(A==="scene"||A==="graview")&&!z,R=Q?"pages":A,Ve=(0,c.useRef)(!1);Ve.current=z&&e.pagesBelow!==void 0&&Y!==null&&Y<e.pagesBelow&&(A==="scene"||A==="graview"),C&&(C.shown=R);let De=(0,c.useRef)(A==="graview"?"graview":"scene");(R==="scene"||R==="graview")&&(De.current=R),(0,c.useState)(()=>{if(!V||typeof window>"u"||R==="pages"||R==="picture")return;let{pathname:v,search:X,hash:$}=window.location;Mt(v,e.basePath)==="/"&&window.history.replaceState(window.history.state,"",`${U(Ee)}${X}${$}`)}),gr(w,R,e.onIntrinsicHeight),To(R,Y);let ce=Ar(e.onError,R),Oe=Er(e.onReady,R),Ue=(0,c.useRef)(e.onFaceDrawn);Ue.current=e.onFaceDrawn;let he=(0,c.useCallback)((v,X)=>{Oe(X),Ue.current?.(v)},[Oe]),[$e,Ce]=(0,c.useState)(null),Ke=E.places(),ye=(0,c.useRef)({shown:R,onFace:e.onFace});ye.current={shown:R,onFace:e.onFace};let Be=(0,c.useCallback)((v,X,$)=>{if(V){Fe.current?.(v,X,$);return}ye.current.onFace?.(v),Z.current?.(v==="pages"?X??M.current.path:Ee,"push")},[V]),[kt,Je]=(0,c.useState)(void 0);(0,c.useEffect)(()=>{R==="pages"&&Je(void 0)},[R]);let G=(0,c.useRef)(o);(0,c.useEffect)(()=>{G.current!==o&&(G.current=o,Je(void 0))},[o]);let le=(0,c.useCallback)(v=>{if(ye.current.shown==="pages"){if(me(!0),Je(v),A==="scene"||A==="graview"){Mr(A,()=>{V?window.history.pushState(null,"",`${U(Ee)}${v??""}`):Z.current?.(Ee,"push")});return}Mr(De.current,()=>Be(De.current,void 0,v))}},[V,A,e.basePath,Be]),j=(0,c.useCallback)(v=>{if(ye.current.shown==="pages"){K.go.current||(M.current.path=v),re(v);return}if(M.current.path=v,_(v),Ve.current){me(!1),V?window.history.pushState(null,"",U(v)):Z.current?.(v,"push");return}Be("pages",v)},[K,re,_,Be,V,e.basePath]),Ne=E.arrangement?.(),ie=R==="pages",We=e.hrefOf,Le=We??(V?U:void 0),Ie=(0,c.useMemo)(()=>({open:j,...We?{href:We}:V?{href:v=>Lt(v,e.basePath===void 0?{}:{basePath:e.basePath})}:{}}),[j,V,e.basePath,We]);return(0,g.jsxs)("section",{ref:w,className:m,"aria-label":e.label??n.name,"data-graview-embed":R,"data-graview-scheme":F,...Q?{"data-graview-embed-narrow":""}:{},style:{position:"relative",isolation:"isolate",height:O,minHeight:x?0:320,display:"flex",flexDirection:"column",overflow:"hidden",borderRadius:"var(--graview-radius, 12px)"},children:[(0,g.jsx)("style",{children:P}),(0,g.jsxs)(er.Provider,{value:ce,children:[(0,g.jsx)(vr,{rootRef:w,board:N}),(0,g.jsx)(hr,{rootRef:w,firstLook:e.firstLook,app:ar(T??{name:n.name},n.schema)}),(0,g.jsx)(Ze,{module:"@graview/react",report:ce,content:!0,children:(0,g.jsx)(Gn.Provider,{value:de,children:(0,g.jsx)(In,{store:B,views:E,initialView:pe,scheme:F,...br(e,b,T),...e.onSeat?{onSeat:e.onSeat}:{},children:(0,g.jsxs)(nr.Provider,{value:N,children:[(0,g.jsx)(Vo,{face:R,stop:kt??o,kinds:k,places:Ke,opens:L}),C?(0,g.jsx)(Lo,{into:C}):null,(0,g.jsx)(Mo,{rootRef:w,face:A,shown:R,path:Pe,stop:o,draft:ne.n,onDrawn:e.onDrawn,parts:de}),V?(0,g.jsx)(ur,{pagesWere:ke?.path,basePath:e.basePath,shown:R,onFace:e.onFace,toggle:Fe,kinds:k,places:Ke,opens:L,landed:J}):null,i&&R!=="picture"?(0,g.jsx)(Ze,{module:"@graview/embed",report:ce,children:(0,g.jsx)(Sr,{name:T?.name??n.name,heading:d,named:qt(i).name!==!1,faces:qt(i).faces===!1?void 0:{scene:{label:Hn(Ne),current:!ie,go:()=>le(),reach:()=>void He(De.current)},pages:{label:Vn(Ne),current:ie,go:()=>j(M.current.path),reach:()=>void He("pages")}},at:ie?Pe:null,without:e.pages?.without(),home:{...Le?.("/")!==void 0?{href:Le("/")}:{},go:()=>j("/"),current:ie&&Pe.split("?")[0]==="/"},reach:{...Le?{href:Le}:{},go:v=>j(v.path)},standing:l,hostActions:e.hostActions,keeping:ie?void 0:(0,g.jsx)(Do,{app:n,studio:e.studio,report:ce}),onFind:Ce,switch:e.switch})}):null,(0,g.jsx)(or.Provider,{value:$e,children:(0,g.jsx)(Ze,{module:R==="pages"||R==="picture"?"@graview/pages":"@graview/react",report:ce,content:!0,children:(0,g.jsxs)(c.Suspense,{fallback:(0,g.jsx)(Fo,{auto:x,scene:R!=="pages"&&R!=="picture"}),children:[R==="picture"?(0,g.jsx)(Ao,{scope:m,store:B,views:E,as:(o?ut(o).within?.view:void 0)??""}):R==="pages"?(0,g.jsx)(Po,{store:B,views:E,presence:b,auto:x,brand:T,steering:K,overview:le,scope:m,titleLevel:kr(d),quickAsk:Wt(e.quickAsk),props:{...e,onNavigate:xe,...V?{}:{path:M.current.path}}}):(0,g.jsx)(Xn.Provider,{value:Ie,children:(0,g.jsx)(So,{address:V,auto:x,scheme:F,scope:m,quickAsk:Wt(e.quickAsk)})}),(0,g.jsx)(xo,{asked:A,shown:R,onDrawn:he})]})},R)})]})})})})]})]})}var Zt=e=>e.split(/[?#]/)[0]===Ee,zr=(0,c.createContext)(null);function Lo({into:e}){return e.view=ft().view,null}function Mo({rootRef:e,face:n,shown:o,path:i,stop:l,draft:u,onDrawn:d,parts:w}){let{view:m}=ft(),P=o==="scene"||o==="graview",F=lt(m),{pan:B,...b}=m,T=m.pan?lt(b):F,x={face:n,path:P?Ee:o==="picture"?l??"#":i,stop:F};return Fr(e,`${o} ${P?T:x.path} ${u}`,x,d,w),null}var gt,Ho=Re(()=>(__graviewPreload(import.meta.url,["./chunk.NHUQ2N6J.js","./chunk.WC3DENU4.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BXDM3UMN.js"))),tn=()=>Ho().then(e=>void(gt=e),()=>new Promise(e=>{let n=()=>{window.removeEventListener("online",n),clearTimeout(o),e()},o=setTimeout(n,1e4);window.addEventListener("online",n)}).then(tn));function Vo({face:e,stop:n,kinds:o,places:i,opens:l}){let{view:u,go:d}=ft(),w=(0,c.useRef)({face:e,stop:n});return(0,c.useLayoutEffect)(()=>{let m=w.current.stop!==n,P=w.current.face!==e,F=w.current.face==="pages";if(w.current={face:e,stop:n},!m&&!P||e==="pages"||e==="picture")return;let B=(m||F)&&n!==void 0?jr(e,n,o,i):F&&pr(u)?_t(e,jt(l),o):e==="graview"?Dt(u,!0):u.overview?Nn(Dt(u,!1),ir(u,o)):u;d(B)},[e,n,o,u,d,l]),null}function Do({app:e,studio:n,report:o}){return(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(c.Suspense,{fallback:null,children:(0,g.jsx)(ko,{})}),n!==!1?(0,g.jsx)(Ze,{module:"@graview/studio",report:o,children:(0,g.jsx)($o,{app:e,studio:n})}):null]})}function $o({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}:{}},i=n?.place;return i?(0,g.jsx)(i,{...o}):(0,g.jsx)(c.Suspense,{fallback:null,children:(0,g.jsx)(Oo,{...o})})}function Bo({path:e,stop:n,...o},i){return{...o,app:i.app,at:i.at,remote:i.remote,...i.remote.presence?{presence:i.remote.presence}:{}}}function nn(e,n){let o=n.store??n.remote?.store??mr(n.app,n.seed),i=n.notices??Nt(),l=null,u={},d=0,w=n.label,m=n.app,P=Promise.resolve(),F=n.at?.face??n.face,B=F===void 0?void 0:It({...n,face:F}),b=B??en(n.stop),T=null,x=[],O=p=>{if(T=p,p!==b)return;let D=x;x=[];for(let N of D)N()};function ne(){let[p,D]=(0,c.useState)(B),[N,U]=(0,c.useState)(n.stop),[oe,ae]=(0,c.useState)(n.path),[be,H]=(0,c.useState)(n.scheme??"auto"),[Se,A]=(0,c.useState)(n.principal),[k,V]=(0,c.useState)(n.seats),[ke,L]=(0,c.useState)(n.quickAsk),[pe,W]=(0,c.useState)(n.people),[M,q]=(0,c.useState)(n.hostContext),[Z,xe]=(0,c.useState)(n.brand),[Pe,_]=(0,c.useState)(n.whileAway),[K,re]=(0,c.useState)(n.label),[C,Fe]=(0,c.useState)(n.hostActions),[J,Y]=(0,c.useState)(void 0),[z,me]=(0,c.useState)(n.draftView);return l={app:Q=>{Y(Q),ae(void 0),U(void 0)},face:D,stop:U,path:ae,scheme:H,seat:A,seats:V,quickAsk:L,people:W,hostContext:q,brand:xe,whileAway:_,label:re,hostActions:Fe,draft:me},(0,g.jsx)(zr.Provider,{value:u,children:(0,g.jsx)(qr,{...J?Bo(n,J):n,store:o,notices:i,...p!==void 0?{face:p}:{},onOpening:Q=>{b=Q},...N!==void 0?{stop:N}:{},...oe!==void 0?{path:oe}:{},...Se?{principal:Se}:{},...k?{seats:k}:{},...ke!==void 0?{quickAsk:ke}:{},...pe?{people:pe}:{},...M?{hostContext:M}:{},...Z?{brand:Z}:{},whileAway:Pe,label:K,hostActions:C,draftView:z,scheme:be,onFace:Q=>{b=Q,D(Q)},onSeat:A,onFaceDrawn:O},J?.n??0)})}let E=()=>{let p=u.view?.focusId,D=p?o.graph.getNode(p)?.kind:void 0,N=(u.shown??b)==="scene"||(u.shown??b)==="graview";return{face:b,path:N?Ee:u.pages?.()??n.path??"/",stop:u.view?lt(u.view):n.stop??"#",...D?{kind:D}:{}}},de=(0,Vr.createRoot)(e);return(0,I.flushSync)(()=>de.render((0,g.jsx)(ne,{}))),{get store(){return o},where:E,setApp:(p,D,N)=>{let U="graph"in D?{store:D}:D,oe=()=>{let ae=E();o=U.store,w=N?.label??(w===m.name?p.name:w),m=p,(0,I.flushSync)(()=>{l?.label(w),l?.app({app:p,remote:U,at:ae,n:++d})})};gt?oe():P=P.then(tn).then(oe)},setFace:p=>{b=p,(0,I.flushSync)(()=>l?.face(p))},setStop:p=>(0,I.flushSync)(()=>l?.stop(p)),setPath:p=>(0,I.flushSync)(()=>{if(Zt(p)){(b==="pages"||b==="picture")&&(b="scene",l?.face("scene"));return}l?.path(p),b!=="pages"&&(b="pages",l?.face("pages"))}),setScheme:p=>(0,I.flushSync)(()=>l?.scheme(p)),setSeat:p=>(0,I.flushSync)(()=>l?.seat(p)),setSeats:p=>(0,I.flushSync)(()=>l?.seats(p)),setQuickAsk:p=>(0,I.flushSync)(()=>l?.quickAsk(p)),setPeople:p=>(0,I.flushSync)(()=>l?.people(p)),setHostContext:p=>(0,I.flushSync)(()=>l?.hostContext(p)),setBrand:p=>(0,I.flushSync)(()=>l?.brand(p)),setWhileAway:p=>(0,I.flushSync)(()=>l?.whileAway(p)),setDraftView:p=>(0,I.flushSync)(()=>l?.draft(p)),setLabel:p=>{w=p,(0,I.flushSync)(()=>l?.label(p))},setHostActions:p=>(0,I.flushSync)(()=>l?.hostActions(p)),drawn:()=>P.then(()=>T===b?void 0:new Promise(p=>x.push(p))),notify:p=>{let D;return(0,I.flushSync)(()=>{D=i.notify(p)}),D},unmount:()=>de.unmount()}}var wt=e=>`s${(e+1).toString(36)}`;var ve={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"},qe={header:"x-graview-key",param:"graview_key",cookie:"graview_key"};function vt(e,n={}){try{let o=new URL(e),i=o.searchParams.get(qe.param);if(i)return o.searchParams.delete(qe.param),{url:o.origin+o.pathname.replace(/\/$/,"")+o.search,key:i,headers:{[qe.header]:i,...n}}}catch{}return{url:e.replace(/\/$/,""),headers:n}}var Gr="/graview/friction";var Ur="/graview/live",rn="graview.ship",on=`${rn}.${st}`;var ze=class extends Error{constructor(n){super(n),this.name="Superseded"}},Te=e=>e?.lineage?{lineage:e.lineage}:{},No=(e,n)=>`${e.calls.map(o=>o.name.replace(/-/g," ")).join(", ")} (${n instanceof Error?n.message.split(`
|
|
2
|
+
`)[0]??"":String(n)})`;function Wo(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(i=>!!i&&Array.isArray(i.calls)):[]}catch{return[]}}var Ge=class extends Error{constructor(o){super(o.sentence);this.refusal=o;this.name="RemoteRefusedError"}},Io={401:"forbidden",403:"forbidden",404:"missing",413:"limit"},fe=class extends Error{constructor(o,i){super(o);this.conflicts=i;this.name="StaleWrite"}},et=class extends Error{constructor(n){super(n),this.name="Unreached"}},_o=new Set([502,503,504]);async function jo(e){try{return(await e.clone().json()).reason==="unavailable"}catch{return!1}}function qo(){let e=Math.random().toString(36).slice(2,8),n=0;return()=>`local-${e}-${++n}`}var zo=1,Go=()=>({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 bt(e){return(await Kr(e,Wo(e.carry),"This app was updated while your changes were on the way.",Go())).remote}async function Kr(e,n,o,i){let{key:l,...u}=vt(e.url,e.headers),d={...e,...u},w=d.fetch??fetch,m={"content-type":"application/json",...d.headers??{}},P={...St(d.principal),[ve.via]:d.via??"web"};Object.assign(m,P);let F=d.live===!0,B=d.presenceEveryMs,b=d.visible??Jo,T="connecting",x=i.statuses,O=i.tally,ne=[],E,de=[],p=()=>T==="online"&&E!==void 0?"held":T,D=()=>{let t=p();if(i.told!==t){i.told=t;for(let r of[...x])r(t)}},N=t=>{if(!(t===T||se)&&(T==="offline"&&t==="online"&&O.reconnects++,T=t,D(),t==="online"))for(let r of ne.splice(0))r.again()},U=t=>{if(se)return;let r=typeof t=="string"&&t.length>0?t:void 0,s=r!==E;if(E=r,oe(),!!s&&(D(),r===void 0)){for(let a of de.splice(0))a();ee&&clearTimeout(ee),un()}},oe=()=>{if(i.toldHeld!==E){i.toldHeld=E;for(let t of[...i.helds])t(E??null)}},ae=async(t,r)=>{let s;try{s=await w(t,r)}catch(a){throw $()||N("offline"),new et(a instanceof Error?a.message:String(a))}if(s.status===503&&await jo(s))return N("online"),s;if(_o.has(s.status))throw $()||N("offline"),new et(`The server is away (${s.status})`);return N("online"),s},be=async(t=!1)=>{let r=`${d.url}/graview/state?opFormat=${je.op}`,s=t?await w(r,{headers:m}):await ae(r,{headers:m});if(!s.ok)throw new Error((await s.json().catch(()=>({}))).error??`The server refused (${s.status})`);return await s.json()},H=d.state??await be(!0);F||(T="online"),E=typeof H.held=="string"&&H.held.length>0?H.held:void 0,oe();let Se=H.enabledModules??d.enabledModules,A=d.localApp?d.localApp(d.app):d.app,k=new Mn({schema:A.schema,mutations:A.mutations??[],invariants:A.invariants??[],...A.policy?{policy:A.policy}:{},...A.publishing?{publishing:A.publishing}:{},...A.modules?{modules:A.modules}:{},...Se?{enabledModules:Se}:{},...A.intelligence?{intelligence:A.intelligence}:{},...A.brand?.timeZone?{timeZone:A.brand.timeZone}:{},snapshot:H.snapshot,log:H.log,...H.horizon!==void 0?{horizon:H.horizon}:{},ids:qo(),...d.storeOptions??{}});Tn.served.add(k);let V=d.friction!==!1&&d.principal?.kind!=="visitor";V&&Fn(k,t=>{V&&w(`${d.url}${Gr}`,{method:"POST",headers:m,body:JSON.stringify({event:t})}).then(r=>void(V=r.status!==404&&r.status!==410),()=>{})});let ke=Cn(k),L=H.log.at(-1)?.seq??(H.horizon??0)-1,pe=Ct.of(H.log,{horizon:H.horizon??0}),W=null,M,q=new Map,Z=i.who,xe=!1,Pe=t=>{if(se)return;xe=!0;let r=Dn(new Map,t,Date.now(),Ht,W?.participant);M!==void 0&&r.delete(M);let s=r.size!==q.size;if(!s)for(let[a,f]of r)Vt(f,q.get(a))||(s=!0);if(q=r,!!s)for(let a of[...Z])a([...q.values()])},_=[],K=new Set,re=t=>{let r=_.indexOf(t);r>=0&&_.splice(r,1)},C=new Map,Fe=(t,r)=>{let s=C.get(t);s&&(C.delete(t),s.resolve({ops:r.filter(a=>a.batch===t),batch:t}))},J,Y=[],z=(t,r=[])=>{if(t.length===0&&r.length===0)return[];if(J)return Y.push({ops:t,drop:r}),[];let s=Math.min(...t.filter(h=>h.seq>L).map(h=>h.seq));if(Number.isFinite(s)&&s>L+1)return Y.push({ops:t,drop:r}),me(),[];let a=_.filter(h=>t.some(te=>te.batch===h)),f=[...new Set([...r,...a])].filter(h=>K.has(h)),y,S=_.filter(h=>!a.includes(h));try{y=k.rebase({confirmed:t,pending:S,drop:f}).confirmed}catch(h){if(!(h instanceof Ln))throw h;return Y.push({ops:t,drop:r}),me(),[]}for(let h of a)re(h);t.some(h=>h.seq>L)&&S.some(h=>!f.includes(h))&&O.rebases++,t.length>0&&(L=Math.max(L,...t.map(h=>h.seq)),pe.note(t));for(let h of f)K.delete(h);for(let h of a)Fe(h,t);return y},me=()=>{J||(J=Ce(be().then(t=>{if(Q(t)){Y=[];return}let r=new Set(t.log.map(f=>f.batch)),s=_.filter(f=>r.has(f));for(let f of s)re(f);let a=k.adopt({snapshot:t.snapshot,log:t.log,...t.horizon!==void 0?{horizon:t.horizon}:{},pending:[..._],drop:[...K].filter(f=>!_.includes(f))});K.clear();for(let f of a.pending)K.add(f.batch);L=t.log.at(-1)?.seq??(t.horizon??0)-1,pe=Ct.of(t.log,{horizon:t.horizon??0}),O.resyncs++;for(let f of s)Fe(f,t.log)}).then(()=>{J=void 0;let t=Y;Y=[];for(let{ops:r,drop:s}of t)z(r,s)},()=>{J=void 0,Y=[]})))},Q=t=>(typeof t.build=="string"&&pn(t.build),typeof t.version=="number"&&U(t.held),typeof t.version!="number"||t.version===H.version?!1:(Et(t.version),!0)),R=async t=>{let s=await(await ae(`${d.url}/graview/since?seq=${wt(t)}&opFormat=${je.op}`,{headers:m})).json();return Q(s)?[]:s.reset===!0?(me(),[]):s.ops??[]},Ve=async()=>{let t=await De();return J&&await J,t},De=async()=>{if(W&&!$()&&b()){let r=await(await ae(`${d.url}/graview/here?opFormat=${je.op}`,{method:"POST",headers:m,body:JSON.stringify({presence:W,seq:wt(L)})})).json();return Q(r)?[]:(typeof r.participant=="string"&&(M=r.participant),Pe(r.who??[]),z(r.ops??[]))}return z(await R(L))},ce=new Map,Oe=new Map,Ue=new Set,he=new Map,$e=new Set,Ce=t=>($e.add(t),t.finally(()=>$e.delete(t)).catch(()=>{}),t),Ke=Promise.resolve(),ye=0,Be=(t,r)=>{let s=Ke.then(()=>Je(t,r));return Ke=s.catch(()=>{}),s},kt=()=>new Promise((t,r)=>ne.push({again:t,give:r})),Je=async(t,r)=>{let s,a;for(;;){try{s=await ae(`${d.url}/graview/ops`,{method:"POST",headers:m,body:JSON.stringify({...t,opFormat:je.op})})}catch(h){if(!(h instanceof et)||j)throw h;if(await kt(),$())return tt(t,r);continue}if(a=await s.json().catch(()=>({})),s.status===503&&a.reason==="unavailable"&&typeof a.held=="string"&&!j){if(typeof a.version=="number"?Q(a):(U(a.held),!1))break;if(E!==void 0&&(Ft>0||F)){if(await new Promise(h=>de.push(h)),j)throw new ze("The client closed.");if($())return tt(t,r);continue}}let S;if(s.status===503&&a.reason==="unavailable"&&!j)S=an(d.backoff,ye++);else{if(ye=0,s.status!==429||j)break;S=Uo(s.headers.get("retry-after"),a.retryAfter)}if(await new Promise(h=>setTimeout(h,S)),$())return tt(t,r)}if(se||Q(a))throw new ze("The app was changed.");if(!s.ok){let S=a.error??`The server refused (${s.status})`;throw a.conflict?new fe(S,a.conflicts??[]):new Ge({reason:a.reason??Io[s.status]??"invalid",sentence:S,...a.wouldNeed?.length?{wouldNeed:a.wouldNeed}:{}})}let f=a.ops??[],y=f[0]?.seq;return y!==void 0&&y>L+1&&(f=await R(L)),r!==void 0&&(a.batch&&ce.set(r,a.batch),re(r)),z(f,r!==void 0?[r]:[]),{ops:a.ops??[],...a.batch?{batch:a.batch}:{}}},G,le=!1,j=!1,Ne=0,ie,We=0,Le=0,Ie=null,v=()=>{},X=new Promise(t=>{v=t}),$=()=>F&&le&&G?.readyState===zo,Ye=t=>{if(!$())return!1;try{return G.send(JSON.stringify(t)),!0}catch{return!1}},ln=(t=!1)=>{!W||!$()||!b()||!t&&Ie&&Vt(W,Ie)&&(B===void 0||Date.now()-Le<B)||Ye({t:"here",presence:W})&&(Ie=W,Le=Date.now())},Ae=new Set,ee,un=()=>{if(ee=void 0,E!==void 0)return;let t=[...C.entries()].filter(([r])=>Ae.has(r));Ae.clear();for(let[,r]of t)Ye(r.message)},fn=(t,r)=>{C.has(t)&&(Ae.add(t),ee&&clearTimeout(ee),ee=setTimeout(un,Math.max(0,r)))},Qr=t=>{C.has(t)&&Ae.add(t)},tt=(t,r)=>new Promise((s,a)=>{let f=r??`send-${++We}`,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}:{},...Te(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}:{},...Te(t)};if(C.set(f,{message:y,...r!==void 0?{mine:r}:{},resolve:s,reject:a}),Ae.size>0||E!==void 0){Ae.add(f);return}Ye(y)}),nt=(t,r)=>$()?tt(t,r):Be(t,r),Zr=t=>{switch(t.t){case"welcome":{if(pn(t.build),typeof t.version=="number"&&t.version!==H.version){Et(t.version);return}if(le=!0,Ne=0,typeof t.participant=="string"&&(M=t.participant),U(t.held),t.state?me():z(t.ops??[]),Ae.clear(),ee&&clearTimeout(ee),ee=void 0,E!==void 0)for(let r of C.keys())Ae.add(r);else for(let r of C.values())Ye(r.message);ln(!0),N("online"),v();return}case"ops":z(t.ops??[]);return;case"ack":{let r=C.get(t.cid);if(!r){z(t.ops??[]);return}C.delete(t.cid),ye=0,r.mine!==void 0&&(ce.set(r.mine,t.batch),re(r.mine)),z(t.ops??[],r.mine!==void 0?[r.mine]:[]),r.resolve({ops:t.ops??[],batch:t.batch});return}case"refused":case"conflict":{let r=C.get(t.cid);if(!r)return;if(t.t==="refused"&&t.reason==="unavailable"){E!==void 0?Qr(t.cid):fn(t.cid,an(d.backoff,ye++));return}C.delete(t.cid),r.reject(t.t==="conflict"?new fe(t.sentence,t.conflicts??[]):new Ge({reason:t.reason??"invalid",sentence:t.sentence,...t.wouldNeed?.length?{wouldNeed:[...t.wouldNeed]}:{}}));return}case"busy":typeof t.cid=="string"&&fn(t.cid,typeof t.retryAfter=="number"?t.retryAfter:1e3);return;case"presence":Pe(t.who??[]);return;case"held":U(t.sentence);return;case"declaration":typeof t.version=="number"&&t.version!==H.version&&Et(t.version);return;case"reload":gn(typeof t.reason=="string"?t.reason:"This app was updated.");return;case"error":if(t.reopen===!0&&G){let r=G;vn(r);try{r.close(1e3,"Opening again.")}catch{}}return;default:return}},se=!1,Pt=i.declarations,At=i.builds,pn=t=>{if(!(se||i.otherBuild!==void 0||!d.build||typeof t!="string"||t.length===0||t===d.build)){i.otherBuild=t;for(let r of[...At])r(t)}},mn=()=>{let t=[],r=0;for(let s of _){let a=he.get(s);a?t.push({calls:a.calls,...a.intent?{intent:a.intent}:{},...a.via?{via:a.via}:{},...Te(a),batch:s}):r++}return{carried:t,undos:r}},hn=(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.`,yn=t=>{se=!0,W=null;let r=new ze(t);for(let a of C.values())a.reject(r);C.clear(),at&&clearInterval(at),j=!0,ie&&clearTimeout(ie),ee&&clearTimeout(ee),ge&&clearTimeout(ge);for(let a of ne.splice(0))a.give(r);for(let a of de.splice(0))a();let s=G;G=void 0,le=!1;try{s?.close(1e3,t)}catch{}v()};async function Et(t){if(se)return;if(!d.resolveApp){gn(`This app was changed on its server (version ${t}); reload the page to carry on.`);return}let{carried:r,undos:s}=mn(),a=d.resolveApp,f=W;yn("The app was changed.");try{let y=await a(t),{state:S,...h}=d,te=await Kr({...h,app:y},r,"The app was changed while your changes were on the way.",i);f&&te.remote.presence.here(f);for(let it of[...Pt])it(te.remote,t);let ue=[...s>0?[rt(hn(s,"The app was changed"))]:[],...te.unheard()];for(let it of ue)for(let io of _e)io(it.sentence,it)}catch(y){let S=`The app was changed, but the new version could not be opened: ${y instanceof Error?y.message:String(y)}`;for(let h of _e)h(S,rt(S))}}function gn(t){if(se)return;let{carried:r,undos:s}=mn();yn(t);let a=!1;if(d.carry&&r.length>0)try{d.carry.storage.setItem(d.carry.key,JSON.stringify(r)),a=!0}catch{}let f=[];!a&&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(hn(s,"This app was updated"));for(let y of f)for(let S of _e)S(y,rt(y));(d.reloadPage??Ko)()}let wn=()=>{if(j||!F)return;let t=`${d.url.replace(/^http/,"ws").replace(/\/$/,"")}${Ur}`,{"content-type":r,...s}=m,a;try{a=d.socket?d.socket(t,s,[on]):ao(t,s)}catch{return bn()}G=a,le=!1,a.onopen=()=>{G===a&&a.send(JSON.stringify({t:"hello",seq:wt(L),protocol:st,wire:rn,opFormat:je.op,...d.build?{build:d.build.slice(0,64)}:{},...d.hostProtocol!==void 0?{hostProtocol:d.hostProtocol}:{}}))},a.onmessage=f=>{if(G!==a)return;let y;try{y=JSON.parse(String(f.data))}catch{return}Zr(y)},a.onclose=()=>vn(a),a.onerror=()=>{}},ge,Xr=()=>{xe=!1,ge&&clearTimeout(ge),ge=setTimeout(()=>{if(ge=void 0,xe||j)return;let t=new Map([...q].filter(([,r])=>r.held!=="socket"));if(t.size!==q.size){q=t;for(let r of Z)r([...q.values()])}},Ht),ge.unref?.()};function vn(t){if(G!==t)return;let r=le;G=void 0,le=!1,Ie=null,r&&(N("offline"),Xr()),bn()}let bn=()=>{if(j)return;let t=an(d.backoff,Ne);Ne++,ie=setTimeout(wn,t)},Sn=k.applyAll.bind(k),eo=k.undo.bind(k),to=k.previewAll.bind(k);k.previewAll=(t,r)=>to(t,{...d.principal?{author:d.principal}:{},...r});let _e=i.refusals,Qe=[],rt=t=>({reason:"invalid",sentence:t}),ot=i.conflicts,Rt=!1,kn,Tt=async(t,r)=>{if(r instanceof ze||se)return;let s=r instanceof Ge?r.refusal:Rn(r),a=s.sentence,f=r instanceof fe?kn?.yoursOf(k,he.get(t)?.calls??[]):void 0;re(t);try{z([],[t])}catch{}let y=he.get(t);he.delete(t);let S=y?.calls[0];if(S&&!(r instanceof fe)){let h=k.allMutations().find(ue=>ue.name===S.name)?.subject?.arg,te=h&&k.graph.getNode(S.args[h])?.kind;On(k,{type:"refused",act:S.name,code:s.reason,...te?{kind:te}:{}},d.principal)}if(r instanceof fe&&O.conflicts++,r instanceof fe&&!$()&&await Ve().catch(()=>[]),r instanceof fe&&J&&await J,r instanceof fe&&ot.size>0){let h=!1,te={sentence:a,conflicts:f?r.conflicts.map(ue=>ue.node===f.node&&ue.field===f.field?{...ue,yours:f.yours}:ue):r.conflicts,keepTheirs(){h=!0},useMine(){if(!(h||!y)){h=!0,Rt=!0;try{k.applyAll(f?[f.over(L)]:y.calls,{...y.intent?{intent:y.intent}:{},...y.via?{via:y.via}:{},...Te(y)})}finally{Rt=!1}}}};for(let ue of ot)ue(te);return}for(let h of _e)h(a,s)},no=(t,r)=>t.flatMap(s=>s.mutation?.name===En?[]:s.primitives.flatMap(a=>a.op==="splice-text"&&!r.has(a.id)&&!r.has(`${a.id}\0${a.field}`)?[{node:a.id,field:a.field,rev:L}]:[]));k.applyAll=(t,r)=>{let s=xn(k.log.all().filter(S=>K.has(S.batch))),a=Sn(t,{...d.principal?{author:d.principal}:{},...r}),f=t.map((S,h)=>{let te=a.minted?.[h];return te===void 0||S.args?.id!==void 0?S:{...S,mintedHint:te}});_.push(a.batch),K.add(a.batch),he.set(a.batch,{calls:f,...r?.intent?{intent:r.intent}:{},...r?.via?{via:r.via}:{},...Te(r)});let y=Rt?[]:[...pe.baseFor(a.ops,s,(S,h)=>k.collaborative(S,h)),...no(a.ops,s)];return Oe.set(a.batch,Ce(nt({calls:f,...r?.intent?{intent:r.intent}:{},batch:a.batch,...y.length>0?{base:y}:{},...r?.via?{via:r.via}:{},...Te(r)},a.batch).catch(S=>Tt(a.batch,S)))),a},k.apply=(t,r)=>k.applyAll([t],r),k.undo=(t,r)=>{let s=typeof t=="string"?[t]:t,a=eo(s.map(y=>ce.get(y)??y),{...d.principal?{author:d.principal}:{},...r});_.push(a.batch),K.add(a.batch);let f=Promise.allSettled(s.map(y=>Oe.get(y)));return Oe.set(a.batch,Ce(f.then(()=>{let y=s.filter(S=>!Ue.has(S));if(y.length===0){re(a.batch),he.delete(a.batch),z([],[a.batch]);return}return nt({undo:y.map(S=>ce.get(S)??S),...r?.intent?{intent:r.intent}:{},batch:a.batch,...r?.via?{via:r.via}:{},...Te(r)},a.batch)}).catch(y=>Tt(a.batch,y)))),a};let ro=async(t,r={})=>{xt++;try{return(await Ce(nt({calls:t,...r}))).ops}finally{xt--}},xt=0,Pn={here(t){W=t,ln()},onWho(t){return Z.add(t),q.size>0&&t([...q.values()]),()=>{Z.delete(t)}},leave(){if(!W)return;let t=JSON.stringify({participant:M??W.participant});if(W=null,Ye({t:"bye"}))return;let r=globalThis.navigator?.sendBeacon;r?r.call(globalThis.navigator,`${d.url}/graview/leave${l!==void 0?`?${qe.param}=${encodeURIComponent(l)}`:""}`,t):w(`${d.url}/graview/leave`,{method:"POST",headers:m,body:t}).catch(()=>{})}},Ft=d.pollMs??800,at=Ft>0&&typeof setInterval=="function"?setInterval(()=>{$()||Ve().catch(()=>{})},Ft):null;if(F){wn();let t;await Promise.race([X,new Promise(r=>t=setTimeout(r,d.openTimeoutMs??3e3))]),clearTimeout(t)}if(n.length>0&&!se){let t=[],r=new Set(k.log.all().map(s=>s.batch));for(let s of n)if(!(s.batch!==void 0&&r.has(s.batch)))try{k.applyAll(s.calls,{...s.intent?{intent:s.intent}:{},...s.batch?{batch:s.batch}:{},...s.via?{via:s.via}:{},...Te(s)})}catch(a){t.push(No(s,a))}t.length>0&&Qe.push(rt(`${o} ${t.length===1?"One no longer fits and was not made":`${t.length} no longer fit and were not made`}: ${t.join("; ")}.`))}let An=new Map,oo=()=>({store:k,author:d.principal,appliedAll:Sn,pending:_,provisional:K,asked:he,answers:Oe,letGo:Ue,sent:(t,r)=>Ce(nt({calls:r,batch:t},t).catch(s=>Tt(t,s))),settle:re,land:z,seen:()=>L,gone:()=>j||se});return{remote:{store:k,typing(t,r){let s=`${t}\0${r}`,a=An.get(s);return a||(a=(__graviewPreload(import.meta.url,["./chunk.RQOX5YDW.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.AVBTPSQF.js")).then(f=>(kn=f,f.typingOf(t,r,f.wireOf(oo())))),An.set(s,a)),a},version:H.version,migrated:H.migrated??[],send:ro,pull:Ve,onRefusal(t){_e.add(t);let r=Qe;Qe=[];for(let s of r)t(s.sentence,s);return()=>_e.delete(t)},onDeclaration(t){return Pt.add(t),()=>Pt.delete(t)},onBuild(t){return At.add(t),i.otherBuild!==void 0&&t(i.otherBuild),()=>At.delete(t)},onConflict(t){return ot.add(t),()=>ot.delete(t)},revision:(t,r)=>pe.of(t,r),seq:()=>L,participant:()=>M,transport:()=>$()?"socket":"poll",status:p,onStatus(t){return x.add(t),()=>x.delete(t)},held:()=>E,onHeld(t){return i.helds.add(t),E!==void 0&&t(E),()=>i.helds.delete(t)},counters:()=>({...O}),who:()=>[...q.values()],pending:()=>_.length+xt,async settled(){for(;$e.size>0;)await Promise.allSettled([...$e])},presence:Pn,close(){at&&clearInterval(at),ke(),Pn.leave(),j=!0,ie&&clearTimeout(ie),ee&&clearTimeout(ee),ge&&clearTimeout(ge);for(let r of ne.splice(0))r.give(new Error("The client closed before the server could be reached."));for(let r of de.splice(0))r();let t=G;G=void 0,le=!1;try{t?.close(1e3,"Closed.")}catch{}}},unheard(){let t=Qe;return Qe=[],t}};function ao(t,r){let s=globalThis.WebSocket;if(!s)throw new Error("This runtime has no WebSocket; the client polls instead.");let a=typeof globalThis.document<"u",f=d.subprotocol?[on]:[];if(!a)try{return new s(t,{headers:r,...f.length>0?{protocols:f}:{}})}catch{}let y=new URL(t);for(let[S,h]of Object.entries(P))y.searchParams.set(S,h);return l!==void 0&&y.searchParams.set(qe.param,l),f.length>0?new s(y.toString(),f):new s(y.toString())}}function Uo(e,n,o=Date.now()){let i,l=e?.trim();if(l)if(/^\d+(\.\d+)?$/.test(l))i=Number(l)*1e3;else{let w=Date.parse(l);Number.isFinite(w)&&(i=Math.max(0,w-o))}let u=typeof n=="number"&&Number.isFinite(n)&&n>=0?n:void 0,d=u!==void 0&&u<50&&i!==void 0&&Math.abs(u*1e3-i)<1e3;return u!==void 0&&!d?u:i??1e3}function Ko(){globalThis.location?.reload?.()}function Jo(){return globalThis.document?.visibilityState!=="hidden"}function an(e,n){if(typeof e=="function")return Math.max(0,e(n));let{min:o=250,max:i=1e4,factor:l=2}=e??{};return Math.min(i,o*l**n)*(.75+Math.random()*.5)}function St(e){let n={};if(!e)return n;e.id&&(n[ve.seat]=e.id),e.roles?.length&&(n[ve.roles]=e.roles.join(",")),e.kind!=="human"&&(n[ve.kind]=e.kind),e.name&&(n[ve.name]=encodeURIComponent(e.name));let o=e.onBehalfOf;return o?.id&&(n[ve.for]=o.id),o?.roles?.length&&(n[ve.forRoles]=o.roles.join(",")),o?.name&&(n[ve.forName]=encodeURIComponent(o.name)),n}var Jr="/graview/views";function sn(e){let n=e.fetch??fetch,o=vt(e.url,e.headers),i=o.url,l={"content-type":"application/json",...e.principal?St(e.principal):{},...o.headers},u=e.state?{hidden:e.state.hidden??[],removed:e.state.removed??[],may:e.state.may??dt.may}:dt,d=new Set,w=b=>{if(JSON.stringify(b)!==JSON.stringify(u)){u=b;for(let T of d)T()}},m=async(b,T)=>{let x=await n(`${i}${e.path??Jr}`,{method:b,headers:l,...T!==void 0?{body:JSON.stringify(T)}:{}}),O=await x.json();if(!x.ok)throw new Error(O.error??`The store answered ${x.status}.`);w({hidden:O.hidden??[],removed:O.removed??[],may:O.may??dt.may})},P=()=>m("GET"),F=e.state?Promise.resolve():P().catch(()=>{}),B=e.pollMs?setInterval(()=>void P().catch(()=>{}),e.pollMs):void 0;return{ready:F,refresh:P,close:()=>clearInterval(B),current:()=>u,onChange(b){return d.add(b),()=>void d.delete(b)},hide:b=>m("POST",{hide:b}),show:b=>m("POST",{show:b}),remove:(b,T)=>m("POST",{remove:b,...T?{about:T}:{}}),async restore(b){let T=u.removed.find(x=>x.name===b)?.lens;await m("POST",{restore:b}),T&&await e.onDeclaration?.()},async lens(b){await m("POST",{lens:b}),await e.onDeclaration?.()}}}var cn=document.getElementById("graview-app"),dn=/^\/forms\/([^/]+)\/?$/.exec(location.pathname),Yr=dn?(__graviewPreload(import.meta.url,["./chunk.LLYRFVIN.js","./chunk.2K4TT2BV.js","./chunk.XOZU4OFA.js","./chunk.GLWSVSQL.js","./chunk.HUJ6YTWE.js","./chunk.XR6YR6RV.js","./chunk.MSWWWLEA.js","./chunk.UITT6JWW.js","./chunk.A5PDXNY6.js","./chunk.VNDKKTED.js","./chunk.4MP72LPR.js","./chunk.SDO3U72B.js","./chunk.VSCIXAHN.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.Z2ERZ4S6.js")):He("pages");try{dn?await Yo(decodeURIComponent(dn[1])):await Qo()}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),cn.replaceChildren(n),window.__graviewFailed=n.textContent}async function Yo(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 i=await pt(o);if(!i.ok)throw new Error(ct(i.findings));let l=i.app,u=o.principal,d=await bt({app:l,url:location.origin,principal:u,...o.state?{state:o.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=l.forms?.[e]?.title??l.name;let{mount:w}=await Yr;window.__graview=w(cn,{app:l,form:e,principal:u,remote:d,height:"100dvh",onSubmitted:()=>window.__graviewSubmitted=!0}),window.__graviewReady=!0}async function Qo(){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(),i=await(async m=>{if(typeof m.module=="string")return(await import(m.module)).app;let P=await pt(m);if(!P.ok)throw new Error(ct(P.findings));return P.app})(n);if(!i||typeof i!="object"||!("schema"in i))throw new Error("The app module the preview server handed does not export an app.");let l=n.principal,u=await bt({app:i,url:location.origin,principal:l,live:!0,subprotocol:!0,pollMs:1200,...n.state?{state:n.state,openTimeoutMs:0}:{openTimeoutMs:3e3}});document.title=i.name;let d,w=sn({url:location.origin,principal:l,...n.views?{state:n.views}:{},onDeclaration:async()=>{let m=await(await fetch("/graview/document")).json();if(typeof m.module=="string")return;let P=await pt(m);P.ok&&d?.setApp(P.app,u)}});await Promise.all([Yr,w.ready]),d=nn(cn,{app:i,remote:u,principal:l,studio:!1,face:"pages",routing:"address",bar:!0,height:"100dvh",label:i.name,heading:1,keptViews:w,...n.draftView?{draftView:n.draftView}:{}}),window.__graview=d,d.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.60",
|
|
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/skills": "0.1.
|
|
36
|
-
"@graview/tools": "0.1.
|
|
32
|
+
"@graview/core": "0.1.60",
|
|
33
|
+
"@graview/guest": "0.1.60",
|
|
34
|
+
"@graview/ship": "0.1.60",
|
|
35
|
+
"@graview/skills": "0.1.60",
|
|
36
|
+
"@graview/tools": "0.1.60"
|
|
37
37
|
},
|
|
38
38
|
"engines": {
|
|
39
39
|
"node": ">=22"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as f}from"./chunk.2VYNNWW5.js";import"./chunk.TF5I4VHX.js";import"./chunk.TWKXSLYY.js";import"./chunk.6VC6AGYV.js";import{l as g}from"./chunk.IDJPBWL2.js";import"./chunk.UGFDSE37.js";import"./chunk.PXQVXBNG.js";import"./chunk.BTVBZ6KE.js";import"./chunk.3OYGXYQY.js";import"./chunk.GCBZ3WE2.js";import"./chunk.GDOTG7YA.js";import"./chunk.EPPXZZPK.js";import"./chunk.KFQSYCY3.js";import"./chunk.WQOI6BLM.js";import"./chunk.LCPGZK7G.js";import"./chunk.NKC3JILT.js";import"./chunk.HEWVPXRE.js";import"./chunk.LMN4TSAP.js";import"./chunk.HS3GHAUR.js";import"./chunk.LRUNFSHP.js";import"./chunk.43OKZU73.js";import"./chunk.WNSC3RWD.js";import"./chunk.ACYDJQRC.js";import"./chunk.S5MGE2U5.js";import"./chunk.34TW32TB.js";import"./chunk.BJUUSIQY.js";import"./chunk.VG7OWV2H.js";import"./chunk.KXPRILAO.js";import"./chunk.XOZU4OFA.js";import"./chunk.BB33TI4S.js";import"./chunk.MB7LKKUD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.LDAYDCUO.js";import"./chunk.KKNDX4JT.js";import"./chunk.GKSUTAIX.js";import"./chunk.5ICIMQE6.js";import"./chunk.QGV7H7RQ.js";import"./chunk.YIA2EDVF.js";import"./chunk.GZHZLJBF.js";import"./chunk.ELERUERU.js";import"./chunk.OJGHDWI6.js";import"./chunk.YHTE34RN.js";import"./chunk.3YZHZGTM.js";import"./chunk.EQTSV7BK.js";import"./chunk.27CW6SCT.js";import"./chunk.YD3TKV6P.js";import"./chunk.4KC35UNR.js";import{G as b,T as h}from"./chunk.HT2BEOEV.js";import"./chunk.SDO3U72B.js";import{Vd as n}from"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import{b as t}from"./chunk.AJZBJBMO.js";var m=t(b(),1),a=t(h(),1);function P({store:c,auto:y,brand:i,views:u,presence:s,steering:r,overview:o,scope:d,titleLevel:w=2,quickAsk:l,props:e}){let v=(0,m.useMemo)(()=>g({scope:`.${d}`}),[d]);return(0,a.jsxs)("div",{"data-embed-content":"",style:y?{flex:"0 0 auto",background:"var(--graview-ground)"}:{flex:"1 1 auto",minHeight:0,overflow:"auto",background:"var(--graview-ground)"},children:[(0,a.jsx)("style",{children:v}),(0,a.jsx)("div",{"data-embed-measure":"",style:{display:"flow-root"},children:(0,a.jsx)(f,{context:{store:c,embedded:!0,...e.bar!==!1?{barAbove:!0}:{},...o?{overview:o}:{},titleLevel:w,views:u,settings:e.app.settings??[],app:e.app,...s?{presence:s}:{},...i?{brand:i}:{},...e.locale?{locale:e.locale}:{},...e.timeZone?{timeZone:e.timeZone}:{},...e.principal?{principal:e.principal}:{},...e.seats?{seats:e.seats}:{},...e.people?{people:e.people}:{},...e.subscriptions?{subscriptions:e.subscriptions}:{},dismissals:e.dismissals,whileAway:e.whileAway,...e.signIn?{signIn:e.signIn}:{},...l!==void 0?{quickAsk:l}:{}},...e.pages?{registry:e.pages}:{},...r?{steering:r}:{},...e.routing==="address"?n(e.basePath)===""?{}:{basename:n(e.basePath)}:{initialPath:e.path??"/"},...e.path!==void 0?{path:e.path}:{},...e.hrefOf?{hrefOf:e.hrefOf}:e.routing==="address"?{}:{hrefOf:!1},...e.onNavigate?{onNavigate:e.onNavigate}:{}})})]})}export{P as PagesContent};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{e as c}from"./chunk.TBW7CU4G.js";import{fc as m}from"./chunk.7BBGRTXM.js";function k(e){let n=e.policy?.sees??[];return n.length===0?!0:e.schema.kinds.every(r=>n.some(o=>o.roles==="*"&&!o.own&&!o.via&&o.kinds.includes(r)))}function A(e){let n=e;for(let r=0;r<8&&n?._zod?.def;r+=1){let o=n._zod.def;if(o.type==="enum")return Object.values(o.entries);if(o.type==="literal")return o.values;if(!("innerType"in o))return;n=o.innerType}}var h=(e,n)=>({ok:!1,reason:e,message:n});function b(e,n){return c(e).find(r=>(r.as??r.act)===n)??c(e).find(r=>r.act===n&&r.as===void 0)}var w=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&"href"in e;function S(e,n,r,o,f){let l=b(n,r);if(!l)return h("undeclared",`This view may not ask for \u201C${r}\u201D: its manifest does not name it.`);let u={},g=0;for(let[y,i]of Object.entries(o)){let d=a=>{if(!w(a))return a;let s=typeof a.href=="string"?f?.file(a.href):void 0;if(!s)throw h("malformed",`\u201C${y}\u201D is a file the host did not hand this view: a view hands an act a file the person dropped (event.files), or one a record it was shown holds, as it was handed.`);return f?.dropped(s.href)&&(g+=1),s};try{u[y]=Array.isArray(i)?i.map(d):d(i)}catch(a){return a}}if(!k(e)){let i=e.allMutations().find(s=>s.name===l.act)?.input?.shape??{},d=(s,t)=>w(t)&&typeof t.href=="string"&&f?.dropped(t.href)===!0||m(t)||typeof t=="string"&&f?.shown.has(t)===!0||(A(i[s])?.some(p=>p===t)??!1);if(!(g>0&&Object.entries(u).every(([s,t])=>Array.isArray(t)?t.every(p=>d(s,p)):d(s,t))))return h("press-only","In this app some members may not see some records, so a view's act applies only when you press it.")}return{ok:!0,name:l.act,args:{...u,...l.constants??{}}}}export{k as a,A as b,h as c,b as d,S as e};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as p}from"./chunk.YD3TKV6P.js";import{T as c}from"./chunk.HT2BEOEV.js";import{uc as u}from"./chunk.7BBGRTXM.js";import{b as h}from"./chunk.AJZBJBMO.js";var s={person:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><circle cx="11.6" cy="5.4" r="2.5"/><path d="M7.9 12.4c0-2.1 1.7-3.8 3.7-3.8s3.7 1.7 3.7 3.8v3.2H7.9z"/><path d="M8 12.6 6.4 17.2"/><path d="M15.2 12.6 16.8 17.2"/><path d="M9.8 15.6v5"/><path d="M13.4 15.6v5"/></svg>',plot:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.6 9.4 12 4.6l9.4 4.8-9.4 4.8z"/><path d="M2.6 9.4v4.4l9.4 4.8 9.4-4.8V9.4"/><path d="M12 14.2v4.4"/><path d="M7 11.9v3"/><path d="M17 11.9v3"/></svg>',box:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.4 7.9 12 3.6l8.6 4.3-8.6 4.3z"/><path d="M3.4 7.9v8.2L12 20.4l8.6-4.3V7.9"/><path d="M12 12.2v8.2"/></svg>',task:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4.4 6.6 12 2.9l7.6 3.7v9.5L12 19.8 4.4 16.1z"/><path d="M12 12.4v7.4"/><path d="M4.4 6.6 12 10.3l7.6-3.7"/><path d="M8 9.6l2.4 2.4L16 8.4"/></svg>',shift:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M3.2 8.2 12 4l8.8 4.2-8.8 4.2z"/><path d="M3.2 8.2v7.2L12 19.6l8.8-4.2V8.2"/><path d="M12 12.4v7.2"/><path d="M6.6 10.8v3.4"/><path d="M9.3 12v3.4"/></svg>',list:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 10.4 12 6l9.2 4.4-9.2 4.4z"/><path d="M2.8 10.4v3.2L12 18l9.2-4.4v-3.2"/><path d="M6.6 8.6 15.8 13"/><path d="M9.4 7.2 18.6 11.6"/></svg>',vehicle:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M2.8 14.2 5 9.4l8.6-1.6 5.4 3-1 3.6z"/><path d="M2.8 14.2v2.2h2.4"/><path d="M18 16.4h1.9l.1-2.2"/><circle cx="7.6" cy="16.6" r="1.9"/><circle cx="16.1" cy="16.6" r="1.9"/><path d="M8.6 8.2 9.8 12l7.2-1"/></svg>',rule:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5.4 19.4V6.6l12 12.8z"/><path d="M5.4 6.6 7.6 5.5l12 12.8-2.2 1.1"/><path d="M5.4 19.4 7.6 18.3h12"/><path d="M5.4 10.1h1.7"/><path d="M5.4 13.3h1.7"/><path d="M5.4 16.5h1.7"/></svg>',note:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M6.2 6.2 14.8 10.5v9L6.2 15.2z"/><path d="M12.4 9.3 14.8 10.5l-.6 2.3"/><path d="M8.2 10.6 12.8 12.9"/><path d="M8.2 13.2 11.4 14.8"/></svg>'},v=Object.keys(s);function i(e){if(e)return s[e]??(e.trimStart().startsWith("<svg")?e:void 0)}var a=h(c(),1);function B({kind:e,schema:o,brand:n,size:r=16,title:t}){let f=o?.tryDefinition?.(e)?.figure,d=i(n?.figures?.[e]??f),l=Math.round(u(e,n?.accents)),g=p(d);return d?(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"figure",dangerouslySetInnerHTML:g,style:{display:"inline-flex",alignItems:"center",justifyContent:"center",width:r,height:r,flex:"0 0 auto",color:`hsl(${l} 55% 52%)`,"--graview-figure-size":`${r}px`}}):(0,a.jsx)("span",{"aria-hidden":t===void 0?"true":void 0,...t===void 0?{}:{role:"img","aria-label":t},"data-graview-figure":e,"data-graview-figure-kind":"dot",style:{display:"inline-block",width:Math.round(r*.8),height:Math.round(r*.5),flex:"0 0 auto",background:`hsl(${l} 55% 52%)`,clipPath:"polygon(50% 0, 100% 50%, 50% 100%, 0 50%)"}})}function A(e,o,n){return i(n?.figures?.[e]??o?.tryDefinition?.(e)?.figure)!==void 0}export{B as a,A as b};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Ge}from"./chunk.BJUUSIQY.js";import{a as Ke}from"./chunk.VG7OWV2H.js";import{a as Ve}from"./chunk.XU34T2H4.js";import{a as Je}from"./chunk.CCWPF5PK.js";import{a as ue}from"./chunk.KKNDX4JT.js";import{c as fe}from"./chunk.YD3TKV6P.js";import{E as Oe,G as hn,J as _e,P as We,T as Ue,ba as ze}from"./chunk.HT2BEOEV.js";import{$b as ce,Rb as De,Vc as He,bc as Le,da as B,ga as le,gd as qe,id as Be,ja as W,ma as Ne,oa as G,zb as je}from"./chunk.7BBGRTXM.js";import{j as Z}from"./chunk.FQLNBIQ5.js";import{b as xe}from"./chunk.AJZBJBMO.js";var kn=["search-miss","unanswered","refused","tool-invalid"];var _n=new RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2066-\\u2069]","g");var pe=e=>e.onBehalfOf?pe(e.onBehalfOf):e.id!==void 0?`${e.kind}:${e.id}`:`${e.kind}:?`,ve=e=>e.toLowerCase().replace(/\s+/g," ").replace(/^[\s\p{P}]+|[\s\p{P}]+$/gu,"");var bn=new Set("a an and are at be by can do does for from has have how i in is it me my of on or our the their there this to was we what when where which who why will with you your".split(" "));function ee(e,n,t,i,o){let r=new Map;for(let c of e){let d=n(c);if(d===void 0)continue;let s=r.get(d)??{first:c,people:new Set,times:0,last:c};s.people.add(pe(c.by)),s.times+=1,s.last=c,r.set(d,s)}return[...r.entries()].filter(([,c])=>c.people.size>=i).sort(([c,d],[s,f])=>f.people.size-d.people.size||f.times-d.times||c.localeCompare(s)).slice(0,o).map(([c,d])=>({...t(d.last,c),people:d.people.size,times:d.times}))}function wn(e,n={}){let t=Math.max(1,n.minPeople??2),i=n.most??12,o=e.filter(s=>!qe(s.by)),r=Object.fromEntries(kn.map(s=>{let f=o.filter(a=>a.type===s);return[s,{events:f.length,people:new Set(f.map(a=>pe(a.by))).size}]})),c=[],d=new Map;for(let s of o){let f=s.type==="search-miss"?s.words:s.type==="unanswered"?s.question:void 0;if(f!==void 0)for(let a of new Set(ve(f).split(/[^\p{L}\p{N}]+/u))){if(a.length<3||bn.has(a))continue;let p={...s,id:`${s.id}:${a}`};c.push(p),d.set(p,a)}}return{events:o.length,people:new Set(o.map(s=>pe(s.by))).size,byType:r,searches:ee(o,s=>s.type==="search-miss"&&ve(s.words)||void 0,(s,f)=>({words:f}),t,i),questions:ee(o,s=>s.type==="unanswered"&&ve(s.question)||void 0,(s,f)=>({question:f}),t,i),words:ee(c,s=>d.get(s),(s,f)=>({word:f}),t,i),refusals:ee(o,s=>s.type==="refused"?`${s.act}|${s.code}`:void 0,s=>({act:s.act,code:s.code}),t,i),tools:ee(o,s=>s.type==="tool-invalid"?`${s.tool}|${s.act??""}`:void 0,s=>{let f=s;return{tool:f.tool,...f.act?{act:f.act}:{},...f.then?{then:f.then}:{}}},1,i)}}var Ye=e=>e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e;function An(e){let n=new Set,t=i=>{for(let o of i.toLowerCase().split(/[^\p{L}\p{N}]+/u))o.length>0&&n.add(Ye(o))};for(let i of e.kinds){let o=e.tryDefinition(i);t(i),t(G(o,i)),t(W(e,i));for(let r of[...o?.aliases??[],...Object.values(o?.fieldAliases??{}).flat()])t(r);for(let r of Object.keys(o?.fields?.shape??{}))t(r),t(B(r))}return n}function Qe(e,n,t={}){let i=wn(e,{most:8,...t}),o=An(n),r=i.searches.filter(a=>!a.words.split(/[^\p{L}\p{N}]+/u).some(p=>p.length>0&&o.has(Ye(p)))).map(a=>({words:a.words,people:a.people})),c=i.questions.map(a=>({question:a.question,people:a.people})),d=i.tools.map(a=>({tool:a.tool,...a.act?{act:a.act}:{},...a.then?{then:a.then}:{},times:a.times})),s=a=>`${a} ${a===1?"person":"people"}`;return{said:[...r.length>0?[`Searched for, found nothing, and nothing here is called it: ${r.map(a=>`\u201C${a.words}\u201D (${s(a.people)})`).join(", ")}.`]:[],...c.length>0?[`Asked and not answered: ${c.map(a=>`\u201C${a.question}\u201D (${s(a.people)})`).join(", ")}.`]:[],...d.length>0?[`Tool calls refused as invalid: ${d.map(a=>`${a.tool}${a.act?` (${a.act})`:""} ${a.times===1?"once":`${a.times} times`}${a.then?`, then worked as ${a.then}`:""}`).join("; ")}.`]:[]].join(`
|
|
2
|
-
`),unknownWords:r,questions:c,toolMistakes:d}}var Sn=e=>/^(?:aggregate|kind):([^,]+)$/.exec(e)?.[1];function Xe(e,n){let t=e.about??[];if(e.field!==void 0&&e.on!==void 0&&n(e.on))return{on:"field",id:e.on,field:e.field};let i=t.filter(n);if(i.length>1)return{on:"selection",ids:i};if(e.on!==void 0&&n(e.on))return{on:"record",id:e.on};if(i.length===1)return{on:"record",id:i[0]};let o=[e.on,...t].map(r=>r===void 0?void 0:Sn(r)).find(r=>r!==void 0);return e.place!==void 0?{on:"lens",place:e.place,...o?{kind:o}:{}}:o!==void 0?{on:"list",kind:o}:{on:"place",place:"home"}}var Y=e=>e.on==="record"||e.on==="field"?[e.id]:e.on==="selection"?e.ids:e.on==="act"&&e.id!==void 0?[e.id]:[],ye=(e,n)=>e.tryDefinition(n)?.fields?.shape??{},V=(e,n)=>e.tryDefinition(n)?.edges??{},ge=(e,n)=>new Set(e.tryDefinition(n)?.display?.hide??[]),L=(e,n)=>le(e.tryDefinition(n.kind),n),$e=(e,n,t)=>Ne(e.tryDefinition(n),t)||B(t),Ce=e=>typeof e=="boolean"?e?"yes":"no":String(e);function me(e,n){let t=e.kindsKeptFrom(n);return new Set(e.schema.kinds.filter(i=>!t.has(i)))}function Re(e,n,t,i){if(!e.permits(n,t).ok)return!1;if(!i)return!0;try{return e.previewAll([n],{author:t}).ops.length>0}catch{return!1}}function he(e,n,t){let i=e,{principal:o}=t,r=t.each??8,c=Z(i)?.store??i,d=c.seenBy(o),s=c.schema,f=me(c,o),a=l=>{let m=d.graph.getNode(l);return m&&f.has(m.kind)?m:void 0},p=c.allMutations(),h=new Map(p.map(l=>[l.name,l])),b=[],C=new Set,A=l=>{C.has(l.id)||(C.add(l.id),b.push(l))},g=l=>l.slice(0,r),x=Y(n).filter(l=>a(l)!==void 0);if(Y(n).length>0&&x.length===0)return{target:n,candidates:[]};let O=x.length===1?a(x[0]):void 0,k=O?.kind??(n.on==="list"?n.kind:n.on==="lens"?n.kind??t.places?.find(l=>l.as===n.place)?.kind:void 0)??(n.on==="selection"?a(x[0])?.kind:void 0);if(k!==void 0&&!f.has(k))return{target:n,candidates:[]};let u=(l,m)=>`act:${l}${Object.keys(m).length>0?`:${Object.values(m).map(R=>String(R)).join(",")}`:""}`,w=(l,m,R,E,$)=>{l.destructive||Object.values(m).some(y=>typeof y=="string"&&c.graph.has(y)&&a(y)===void 0)||Re(c,{name:l.name,args:{...m}},o,E.length===0)&&A({type:"act",id:u(l.name,m),label:R,description:$??l.description??R,mutation:l.name,args:m,asks:E})};if(n.on!=="place"||t.acts)if(t.acts)for(let l of t.acts){let m=h.get(l.mutation);!m||l.destructive||n.on==="act"&&l.mutation!==n.act||w(m,l.args,l.label,(l.open??[]).filter(R=>!R.optional).map(R=>R.name),l.why)}else{let l=O?[O]:[];for(let m of p){if(n.on==="act"&&m.name!==n.act)continue;let R=m.input.shape??{},E=$=>Object.entries(R).filter(([y,v])=>y!==$&&v.safeParse?.(void 0).success===!1).map(([y])=>y);if(m.subject)for(let $ of l)ce(s,m).includes($.kind)&&w(m,{[m.subject.arg]:$.id},`${m.title??B(m.name)}: ${L(s,$)}`,E(m.subject.arg));else k!==void 0&&(m.creates??[]).includes(k)&&w(m,{},m.title??B(m.name),E(void 0))}}let T=b.filter(l=>l.type==="act");b.splice(0,b.length,...g(T));let F=(l,m)=>{let R=Le(s,p).get(l.kind),E=ye(s,l.kind),$=ge(s,l.kind),y=[];for(let[v,j]of Object.entries(E)){if(m!==void 0?v!==m:$.has(v)||l[v]!==void 0)continue;let D=ue(j),J=D?.type==="enum"?D.options??[]:D?.type==="boolean"?[!0,!1]:[];if(J.length===0)continue;let _=(R?.get(v)??[]).map(N=>h.get(N)).find(N=>N?.subject!==void 0&&Re(c,{name:N.name,args:{[N.subject.arg]:l.id,[v]:J.find(Se=>Se!==l[v])??J[0]}},o,!0));if(_?.subject)for(let N of J)l[v]!==N&&y.push({type:"fill",id:`fill:${l.id}:${v}:${Ce(N)}`,label:`${$e(s,l.kind,v)}: ${Ce(N)}`,description:`Set ${$e(s,l.kind,v).toLowerCase()} of ${L(s,l)} to ${Ce(N)}`,record:l.id,field:v,value:N,call:{name:_.name,args:{[_.subject.arg]:l.id,[v]:N}}})}for(let[v,j]of Object.entries(V(s,l.kind))){if(m!==void 0&&v!==m)continue;let D=j.to==="*"?[...f]:j.to.filter(I=>f.has(I)),J=new Set(d.graph.out(l.id,v).map(I=>I.id)),_=p.find(I=>(I.connects??[]).includes(v)&&I.subject!==void 0&&ce(s,I).includes(l.kind));if(!_?.subject)continue;let N=De(_.input).find(I=>I.name!==_.subject.arg);if(!N)continue;let Se=D.flatMap(I=>N.kinds.length===0||N.kinds.includes(I)?d.graph.nodesOfKind(I):[]).filter(I=>I.id!==l.id&&!J.has(I.id)&&a(I.id)!==void 0);for(let I of g(Se)){let Me={name:_.name,args:{[_.subject.arg]:l.id,[N.name]:I.id}};Re(c,Me,o,!0)&&y.push({type:"fill",id:`fill:${l.id}:${v}:${I.id}`,label:`${B(v)}: ${L(s,I)}`,description:`Link ${L(s,l)} to ${L(s,I)}${j.description?` as ${j.description}`:""}`,record:l.id,field:v,value:I.id,call:Me})}}return y};if(n.on==="field"&&O)for(let l of F(O,n.field))A(l);else if(O&&n.on==="record")for(let l of g(F(O)))A(l);let q=l=>{let m=W(s,l).toLowerCase(),R=[{type:"panel",id:`panel:${l}:list`,label:`A list of ${m}`,description:`Every ${G(s.tryDefinition(l),l).toLowerCase()} this viewer may see, as a list`,panel:{lens:"blocks",kind:l}}],E=ge(s,l);for(let[$,y]of Object.entries(ye(s,l))){if(E.has($))continue;let v=ue(y),j=$e(s,l,$).toLowerCase();if(v?.type==="enum")R.push({type:"panel",id:`panel:${l}:group:${$}`,label:`${K(m)} by ${j}`,description:`A list of ${m} grouped by ${j}`,panel:{lens:"blocks",kind:l,group:$}}),R.push({type:"panel",id:`panel:${l}:columns:${$}`,label:`Columns of ${m} by ${j}`,description:`${K(m)} in a column for each ${j}`,panel:{lens:"columns",kind:l,column:$}});else if(v?.type==="number"||v?.type==="integer"||v?.type==="date"||v?.type==="datetime"){let D=v.type==="date"||v.type==="datetime";R.push({type:"panel",id:`panel:${l}:sort:${$}`,label:`${K(m)} by ${j}`,description:`A list of ${m}, the ${D?"latest":"highest"} ${j} first`,panel:{lens:"blocks",kind:l,sort:{by:$,direction:"desc"}}}),D&&R.push({type:"panel",id:`panel:${l}:calendar:${$}`,label:`A calendar of ${m}`,description:`${K(m)} on a calendar by ${j}`,panel:{lens:"calendar",kind:l,start:$}})}}return R},H=n.on==="place"?[...f]:k!==void 0?[k]:[];for(let l of H)for(let m of g(q(l)))A(m);for(let l of g((t.places??[]).filter(m=>m.kind===void 0?n.on==="place":f.has(m.kind)&&(n.on==="place"||m.kind===k))))n.on==="lens"&&l.as===n.place||A({type:"place",id:`place:${l.as}`,label:l.title,description:`Go to ${l.title}`,place:l.as});if(O){let l=[];for(let[m,R]of Object.entries(V(s,O.kind)))for(let E of d.graph.out(O.id,m))a(E.id)&&l.push({type:"record",id:`record:${E.id}`,label:L(s,E),description:`${K(R.description??B(m))}: ${L(s,E)}`,record:E.id,relation:m});for(let m of s.kinds)for(let[R,E]of Object.entries(V(s,m)))if(!(E.to!=="*"&&!E.to.includes(O.kind)))for(let $ of d.graph.in(O.id,R))$.kind===m&&a($.id)&&l.push({type:"record",id:`record:${$.id}`,label:L(s,$),description:`${K(E.inverse??B(R))}: ${L(s,$)}`,record:$.id,relation:R});for(let m of g(l))A(m)}else if(n.on==="list"||n.on==="lens")for(let l of g(k!==void 0?d.graph.nodesOfKind(k):[]))a(l.id)&&A({type:"record",id:`record:${l.id}`,label:L(s,l),description:`Open ${L(s,l)}`,record:l.id});else if(n.on==="selection")for(let l of x){let m=a(l);A({type:"record",id:`record:${l}`,label:L(s,m),description:`Open ${L(s,m)}`,record:l})}return{target:n,candidates:b}}var K=e=>e&&`${e[0].toUpperCase()}${e.slice(1)}`,xn={columns:["board","kanban","column","lane","pipeline","stage","funnel"],board:["board","map","floor","layout","seat","slot"],calendar:["calendar","schedule","date","due","month","week","agenda","deadline","day"],timeline:["timeline","gantt","schedule","roadmap","span"],coverage:["coverage","matrix","grid","gap"],plan:["plan","floor","map","region","area"],blocks:["list","table","summary","overview","dashboard","card"]},On=new Set(["a","an","the","of","for","my","our","me","us","to","with","and","in","on","by","that","which","i","we","want","need","show","open","go","draw","make","new","view","views","panel","panels","page","lens","please","all","every","some","see","can","could","would","like","one","what","is","are","do","does","here","there","how","it","this","these","those"]),ne=e=>e.length>3&&e.endsWith("ies")?`${e.slice(0,-3)}y`:e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e,Te=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^a-z0-9]+/).filter(Boolean);function Ze(e,n,t){let i=e,o=Z(i)?.store??i,r=o.schema,c=me(o,t.principal),d=o.seenBy(t.principal),s=Y(n),f=new Set;for(let u of s){let w=d.graph.getNode(u)?.kind;w!==void 0&&c.has(w)&&f.add(w)}if(s.length>0&&f.size===0)return[];if(n.on==="list"&&f.add(n.kind),n.on==="lens"){let u=n.kind??t.places.find(w=>w.as===n.place)?.kind;u!==void 0&&f.add(u)}let a=new Map;for(let u of r.kinds){if(!c.has(u))continue;let w=r.tryDefinition(u);for(let T of[u,G(w,u),W(r,u)])for(let F of Te(T))a.set(ne(F),u)}let p=Te(t.said??"").filter(u=>!On.has(u)),h=new Set,b=[];for(let u of p){let w=a.get(ne(u));w!==void 0?h.add(w):b.push(ne(u))}let C=h.size>0?h:f;if((t.said??"").trim()!==""&&p.length===0)return[];if(C.size===0&&p.length===0)return[];let A=[];t.places.forEach((u,w)=>{if(u.hidden||n.on==="lens"&&u.as===n.place)return;let T=u.over??(u.kind!==void 0?[u.kind]:[]);if(T.length>0&&!T.some(H=>c.has(H)))return;let F=T.some(H=>C.has(H)),q=!F&&(u.reads??[]).some(H=>C.has(H));C.size>0&&!F&&!q||A.push({place:u,own:F,reads:q,at:w})});let g=u=>new Set(Te(u.title).map(ne)),x=new Set(b.filter(u=>A.some(({place:w})=>g(w).has(u)))),O=[];for(let{place:u,own:w,reads:T,at:F}of A){let q=g(u),H=new Set((xn[u.lens??""]??[]).map(ne)),l=b.filter($=>q.has($)||H.has($)&&!x.has($)).length,m=b.length-l;if(b.length>0&&l===0)continue;let R=!T&&m===0?"full":"partial",E=(w?4:T?2:1)+l*2-m+(R==="full"?1:0);O.push({view:{place:u.as,title:u.title,...u.kind!==void 0?{kind:u.kind}:{},fit:R},score:E,at:F})}return O.filter((u,w)=>!O.slice(0,w).some(T=>T.view.place===u.view.place&&T.view.title===u.view.title)).sort((u,w)=>w.score-u.score||u.at-w.at).slice(0,t.most??3).map(u=>u.view)}var Ee=new WeakMap;function vn(e){let n=2166136261;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)>>>0;return n.toString(36)}function $n(e,n){let t=e,i=Z(t)?.store??t,o=i.schema,r=me(i,n),d=i.allMutations().filter(A=>!A.destructive&&i.permits({name:A.name,args:{}},n).ok!==!1),s=`${[...r].join(",")}|${d.map(A=>A.name).join(",")}`,f=Ee.get(o)?.get(s);if(f)return f;let a=[...r].map(A=>{let g=ge(o,A),x={};for(let[w,T]of Object.entries(ye(o,A))){if(g.has(w))continue;let F=ue(T);F&&(x[w]=F.type==="enum"?`enum:${(F.options??[]).join("|")}`:F.type)}let O={};for(let[w,T]of Object.entries(V(o,A)))O[w]=T.to==="*"?[...r]:T.to.filter(F=>r.has(F));let k=o.tryDefinition(A),u=Object.entries(k?.fieldAliases??{}).filter(([w,T])=>w in x&&T.length>0);return{kind:A,noun:G(o.tryDefinition(A),A),plural:W(o,A),fields:x,relations:O,...k?.aliases&&k.aliases.length>0?{aliases:k.aliases}:{},...u.length>0?{fieldAliases:Object.fromEntries(u)}:{}}}),p=d.map(A=>({name:A.name,title:A.title??B(A.name),...A.subject?{on:ce(o,A).filter(g=>r.has(g))}:{}})),h={kinds:a,acts:p},b={version:vn(JSON.stringify(h)),...h},C=Ee.get(o)??new Map;return C.set(s,b),Ee.set(o,C),b}var Cn=e=>e.name??e.id??e.kind;function en(e,n,t){let i=e,{principal:o}=t,r=Z(i)?.store??i,c=r.seenBy(o),d=r.schema,s=me(r,o),f=u=>{let w=c.graph.getNode(u);return w&&s.has(w.kind)?w:void 0},a=u=>({id:u.id,kind:u.kind,label:L(d,u)}),p=Y(n),h=p.length===1?f(p[0]):void 0,b=h?Object.fromEntries(Object.keys(ye(d,h.kind)).filter(u=>!ge(d,h.kind).has(u)&&h[u]!==void 0&&u!=="label").map(u=>[u,h[u]])):{},C={on:n.on,...h?{record:{...a(h),fields:b}}:{},...n.on==="field"&&h?{field:n.field}:{},...n.on==="list"&&s.has(n.kind)?{kind:n.kind}:{},...n.on==="lens"?{place:n.place,...n.kind&&s.has(n.kind)?{kind:n.kind}:{}}:{},...n.on==="place"?{place:n.place}:{},...n.on==="act"?{act:n.act}:{}},A=[...new Set([...n.on==="selection"?n.ids:[],...t.selection??[]])].flatMap(u=>{let w=f(u);return w?[a(w)]:[]}),g=[];if(h){for(let u of Object.keys(V(d,h.kind)))for(let w of c.graph.out(h.id,u))f(w.id)&&g.push({...a(w),relation:u,direction:"out"});for(let u of d.kinds)for(let w of Object.keys(V(d,u)))for(let T of c.graph.in(h.id,w))T.kind===u&&f(T.id)&&g.push({...a(T),relation:w,direction:"in"})}let x=c.batches().filter(u=>!u.ops.every(je)).slice(-(t.recent??6)).reverse().map(u=>({intent:u.intent,at:u.at,by:Cn(u.author)})),O=(t.purpose?.jobs??[]).filter(u=>Ge(u,o.roles)&&s.has(u.kind)).map(u=>({name:u.name,ask:u.ask,kind:u.kind})),k=t.purpose&&(t.purpose.for!==void 0||O.length>0)?{...t.purpose.for!==void 0?{for:t.purpose.for}:{},jobs:O}:void 0;return{...t.place!==void 0?{place:t.place}:{},target:C,selection:A,neighbors:g.slice(0,24),recent:x,schema:$n(r,o),...k?{purpose:k}:{},...t.friction?{friction:Qe(t.friction,d)}:{}}}function te(e){if(!e.off)return e.fast??(e.decide?{model:e.name??"decide",decide:e.decide}:void 0)}function U(e){if(e.off)return;if(e.thinking)return e.thinking;let n=e.name??"model";if(e.complete){let t=e.complete;return{model:n,think:({system:i,prompt:o})=>t({prompt:o,system:i})}}if(e.turn){let t=e.turn;return{model:n,think:async({system:i,prompt:o})=>({text:await t({system:i,messages:[{role:"user",content:o}],tools:[],call:async()=>({error:"No tools here."})})})}}}var Pe=(e,n,t)=>e?n/1e6*(e.inputPerMillion??0)+t/1e6*(e.outputPerMillion??0):void 0,Ie=()=>`ai-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`;function Rn(e,n,t=[]){let i=o=>{let r=e.graph.getNode(o);return r?le(e.schema.tryDefinition(r.kind),r):"a record"};switch(n.on){case"record":return i(n.id);case"field":return`${i(n.id)} \xB7 ${n.field}`;case"selection":return`${n.ids.length} records`;case"list":return e.schema.tryDefinition(n.kind)?W(e.schema,n.kind):n.kind;case"lens":case"place":return t.find(o=>o.as===n.place)?.title??(n.place==="home"?"Home":n.place);case"act":return n.act}}var nn=e=>e.type!=="act"||e.asks.length===0,be=(e,n)=>({id:e.id,type:e.type,label:e.label,...n!==void 0?{confidence:n}:{}});function Q(e,n){let t=n.interaction??Ie(),i=he(n.store,n.target,{principal:n.principal,...n.acts?{acts:n.acts}:{},...n.places?{places:n.places}:{}}),o=en(n.store,n.target,{principal:n.principal,...n.place?{place:n.place}:{},...n.selection?{selection:n.selection}:{},...n.purpose?{purpose:n.purpose}:{}}),r=[];return{id:t,catalog:i,state:o,entry:{id:t,at:new Date().toISOString(),by:n.by??n.principal,target:n.target,targetLabel:Rn(n.store,n.target,n.places)},usage:r,meter:c=>{r.push(c),e.meter?.({...c,interaction:t})}}}async function ie(e,n,t,i){let o=await e.decide(n,t),{inputTokens:r,outputTokens:c}=o.usage,d=Pe(e.price,r,c);return i({tier:"fast",model:e.model,inputTokens:r,outputTokens:c,...d!==void 0?{costUsd:d}:{}}),o.answers}async function oe(e,n,t,i,o){let r=await e.think({system:n,prompt:t,state:i.state,catalog:i.catalog}),c=r.usage?.inputTokens,d=r.usage?.outputTokens,s=r.usage?.costUsd??(c!==void 0?Pe(e.price,c,d??0):void 0);return o({tier:"thinking",model:e.model,...c!==void 0?{inputTokens:c}:{},...d!==void 0?{outputTokens:d}:{},...s!==void 0?{costUsd:s}:{}}),Ve(r.text)}function re(e,n){let t=new Map(e.map((i,o)=>[`c${o+1}`,i]));return{question:{type:"choice",instructions:n,criteria:Object.fromEntries([...t].map(([i,o])=>[i,`${o.label} \u2014 ${o.description}`]))},of:i=>t.get(i)}}function se(e,n,t){if(e?.type!=="choice")return[];let i=e,o=Object.entries(i.probabilities).sort((r,c)=>c[1]-r[1]);return o.some(([r])=>r===i.choice)||o.unshift([i.choice,i.confidence]),o.flatMap(([r,c])=>{let d=n(r);return d?[{candidate:d,confidence:c}]:[]}).slice(0,t)}var M=(e,n,t,i)=>({interaction:{...e.entry,ask:{kind:t,said:n??""},offered:[],outcome:"failed",failed:i,usage:[...e.usage]},offers:[]}),X="AI isn't on here.";async function tn(e,n,t=3){let i=Q(e,n),o=n.said??"Suggest",r=i.catalog.candidates.filter(nn).slice(0,24);if(r.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let c=te(e),d=U(e),s=[];try{if(c){let{question:f,of:a}=re(r,"Which of these would the person most likely want to do next, here?"),p=await ie(c,{...i.state,candidates:r.map(h=>({id:h.id,type:h.type,says:h.description}))},{next:f},i.meter);s=se(p.next,a,t)}else if(d){let f=await oe(d,'You suggest what a person most likely wants to do next in an app. Answer only JSON: {"pick": [candidate ids, best first]}. Pick only ids from the candidates.',JSON.stringify({state:i.state,candidates:r.map(p=>({id:p.id,says:p.description}))}),i,i.meter);s=(Array.isArray(f?.pick)?f.pick.filter(p=>typeof p=="string"):[]).flatMap(p=>r.filter(h=>h.id===p)).slice(0,t).map(p=>({candidate:p}))}else return M(i,o,"suggest",X)}catch(f){return M(i,o,"suggest",f instanceof Error?f.message:String(f))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:s.map(({candidate:f,confidence:a})=>be(f,a)),outcome:"offered",usage:[...i.usage]},offers:s.map(({candidate:f})=>f)}}var Tn=e=>`several:${e}`;async function it(e,n,t=2){let i=Q(e,{...n,acts:[]}),o=n.said??"Suggest for the chosen",r=n.target.on==="selection"?n.target.ids.length:1,d=[...n.shared.map(a=>({type:"act",id:Tn(a.id),label:a.label,description:`${a.label}, for all ${r} chosen`,mutation:a.mutation,args:a.args,asks:[]})),...i.catalog.candidates.filter(a=>a.type==="panel"||a.type==="place")].slice(0,24),s=te(e);if(!s)return M(i,o,"suggest",X);if(d.length===0)return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:[],outcome:"offered",usage:[]},offers:[]};let f;try{let{question:a,of:p}=re(d,`Which of these would the person most likely want to do next with the ${r} records they chose together?`),h=await ie(s,{...i.state,candidates:d.map(b=>({id:b.id,type:b.type,says:b.description}))},{next:a},i.meter);f=se(h.next,p,t).filter((b,C)=>C===0||b.confidence>=En)}catch(a){return M(i,o,"suggest",a instanceof Error?a.message:String(a))}return{interaction:{...i.entry,ask:{kind:"suggest",said:o},offered:f.map(({candidate:a,confidence:p})=>be(a,p)),outcome:"offered",usage:[...i.usage]},offers:f.map(({candidate:a})=>a)}}var En=.25;async function on(e,n){let t=Q(e,n),i=n.said??"Fill in",o=t.catalog.candidates.filter(p=>p.type==="fill"),r=new Map;for(let p of o)r.set(p.field,[...r.get(p.field)??[],p]);if(r.size===0)return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:[],outcome:"offered",usage:[]},offers:[]};let c=te(e),d=U(e),s=[];try{if(c){let p=[...r].map(([b,C],A)=>({key:`f${A+1}`,field:b,...re(C,`Which value fits "${b}" best for this record?`)})),h=await ie(c,t.state,Object.fromEntries(p.map(b=>[b.key,b.question])),t.meter);for(let b of p){let C=!Pn(n.store,n.target,b.field)&&In(n.store,n.target,b.field)!=="one";s.push(...se(h[b.key],b.of,C?3:1).filter((A,g)=>g===0||A.confidence>=.4))}}else if(d){let p=await oe(d,`You fill in a record's fields in an app. Answer only JSON: {"fills": [candidate ids]}, at most one per field, only ids from the candidates.`,JSON.stringify({state:t.state,candidates:o.map(C=>({id:C.id,says:C.description}))}),t,t.meter),h=Array.isArray(p?.fills)?p.fills.filter(C=>typeof C=="string"):[],b=new Set;for(let C of h){let A=o.find(g=>g.id===C);A?.type==="fill"&&!b.has(A.field)&&(b.add(A.field),s.push({candidate:A}))}}else return M(t,i,"fill",X)}catch(p){return M(t,i,"fill",p instanceof Error?p.message:String(p))}let f=t.usage.at(-1)?.model,a=ae(n.store,{interaction:t.id,target:n.target,basis:i,...f?{model:f}:{},proposals:s.flatMap(({candidate:p,confidence:h})=>p.type==="fill"?[{id:p.id,label:p.label,said:p.description,call:p.call,record:p.record,field:p.field,...h!==void 0?{confidence:h}:{}}]:[])},n.principal);return{interaction:{...t.entry,ask:{kind:"fill",said:i},offered:a.proposals.map(p=>({id:p.id,type:"fill",label:p.label,...p.confidence!==void 0?{confidence:p.confidence}:{}})),outcome:"offered",usage:[...t.usage]},offers:[],...a.proposals.length>0?{ghost:a}:{}}}function Pn(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0,r=(o?e.schema.tryDefinition(o)?.fields?.shape:void 0)??{};return t in r}function In(e,n,t){let i=n.on==="record"||n.on==="field"?n.id:void 0,o=i?e.graph.getNode(i)?.kind:void 0;return o?e.schema.tryDefinition(o)?.edges?.[t]?.cardinality:void 0}async function rn(e,n){let t=Q(e,n),i=n.said??"Add one",o=new Set(n.store.allMutations().filter(a=>(a.creates??[]).length>0).map(a=>a.name)),r=t.catalog.candidates.filter(a=>a.type==="act"&&a.asks.length>0&&o.has(a.mutation));if(r.length===0)return M(t,i,"record","Nothing here makes a record.");let c=U(e);if(!c)return M(t,i,"record",X);let d;try{let a=await oe(c,'You propose one new record for an app by filling in an act. Answer only JSON: {"act": a candidate id, "args": {argument: value}}. Use only the candidates, and fill every argument the act asks for with a value that fits the state.',JSON.stringify({ask:i,state:t.state,candidates:r.map(b=>({id:b.id,says:b.description,asks:b.asks}))}),t,t.meter),p=r.find(b=>b.id===a?.act),h=typeof a?.args=="object"&&a.args!==null?a.args:{};p&&(d={act:p,args:Object.fromEntries(Object.entries(h).filter(([b])=>p.asks.includes(b)))})}catch(a){return M(t,i,"record",a instanceof Error?a.message:String(a))}if(!d)return M(t,i,"record","The model named no act this app has here.");let s=t.usage.at(-1)?.model,f=ae(n.store,{interaction:t.id,target:n.target,basis:i,...s?{model:s}:{},proposals:[{id:d.act.id,label:d.act.label,said:d.act.description,call:{name:d.act.mutation,args:{...d.act.args,...d.args}}}]},n.principal);return f.proposals.length===0?M(t,i,"record","What the model proposed could not be made here."):{interaction:{...t.entry,ask:{kind:"record",said:i},offered:f.proposals.map(a=>({id:a.id,type:"act",label:a.said})),outcome:"offered",usage:[...t.usage]},offers:[d.act],ghost:f}}async function sn(e,n){let t=Q(e,n),i=n.said??"Make a panel",o=t.catalog.candidates.filter(a=>a.type==="panel");if(o.length===0)return M(t,i,"panel","Nothing here can be drawn as a panel.");let r=te(e),c=U(e),d;try{if(c){let a=await oe(c,'You choose a panel to draw in an app. Answer only JSON: {"panel": a candidate id, "title": a short title}. Choose only among the candidates.',JSON.stringify({ask:i,state:t.state,candidates:o.map(h=>({id:h.id,says:h.description}))}),t,t.meter),p=o.find(h=>h.id===a?.panel);p&&(d={panel:p,...typeof a?.title=="string"&&a.title.trim()?{title:a.title.trim().slice(0,60)}:{}})}else if(r){let{question:a,of:p}=re(o,`Which panel answers this best: ${i}`),h=se((await ie(r,t.state,{panel:a},t.meter)).panel,p,1)[0];h?.candidate.type==="panel"&&(d={panel:h.candidate,confidence:h.confidence})}else return M(t,i,"panel",X)}catch(a){return M(t,i,"panel",a instanceof Error?a.message:String(a))}if(!d)return M(t,i,"panel","The model named no panel this app can draw.");let s=d.title??d.panel.label,f={title:s,recipe:{...d.panel.panel,title:s}};return{interaction:{...t.entry,ask:{kind:"panel",said:i},offered:[be(d.panel,d.confidence)],outcome:"drawn",panel:f,usage:[...t.usage]},offers:[d.panel],panel:f}}function Fn(e){return e.off?void 0:e.answer}var Mn=`You answer a person's question about what they are looking at in an app, from the state given and nothing else. Answer only JSON: {"answer": one to three short sentences, "pick": [candidate ids that act on the answer, best first, at most three]}. Pick only ids from the candidates, and none when nothing fits. Never say an id to the person.`;async function ot(e,n){let t=Q(e,n),i=n.said.trim(),o=t.catalog.candidates.filter(g=>nn(g)||g.type==="panel"||g.type==="place"||g.type==="record").slice(0,32),r=Fn(e),c=U(e),d=te(e),s="",f=[],a=g=>g.flatMap(x=>o.filter(O=>O.id===x)).slice(0,3).map(x=>({candidate:x}));try{if(r){let g=await r.answer({said:i,target:n.target,targetLabel:t.entry.targetLabel,state:t.state,catalog:{target:t.catalog.target,candidates:o},...n.follows?{follows:n.follows}:{}}),x=g.usage?.inputTokens,O=g.usage?.outputTokens,k=g.usage?.costUsd??(x!==void 0?Pe(r.price,x,O??0):void 0);t.meter({tier:"thinking",model:r.model,...x!==void 0?{inputTokens:x}:{},...O!==void 0?{outputTokens:O}:{},...k!==void 0?{costUsd:k}:{}}),s=typeof g.text=="string"?g.text.trim():"",f=a(g.pick??[])}else if(c){let g=await oe(c,Mn,JSON.stringify({ask:i,about:t.entry.targetLabel,...n.follows?{follows:n.follows}:{},state:t.state,candidates:o.map(x=>({id:x.id,says:x.description}))}),t,t.meter);s=typeof g?.answer=="string"?g.answer.trim():"",f=a(Array.isArray(g?.pick)?g.pick:[])}else if(d&&o.length>0){let{question:g,of:x}=re(o,`Which of these best answers, or acts on: ${i}`),O=await ie(d,{...t.state,asked:i,candidates:o.map(k=>({id:k.id,type:k.type,says:k.description}))},{answer:g},t.meter);f=se(O.answer,x,3),s=f.length>0?`These fit \u201C${i}\u201D.`:""}else return M(t,i,"ask",X)}catch(g){return M(t,i,"ask",g instanceof Error?g.message:String(g))}if(!s&&f.length===0){let g=n.target.on==="place"||n.target.on==="lens"?n.target.place:void 0,x=n.target.on==="list"||n.target.on==="lens"?n.target.kind:void 0;return Be(n.store,{type:"unanswered",question:i,...g?{place:g}:{},...x?{kind:x}:{}},n.principal),M(t,i,"ask","The AI had no answer to that here.")}let p=t.usage.at(-1)?.model,h=f.flatMap(({candidate:g,confidence:x})=>{let O=ke(g);return O?[{...O,...x!==void 0?{confidence:x}:{}}]:[]}),b=h.length>0?ae(n.store,{interaction:t.id,target:n.target,basis:i,...p?{model:p}:{},proposals:h},n.principal):void 0,C=f.map(({candidate:g})=>g).filter(g=>ke(g)===void 0),A=[...C.map(g=>be(g,f.find(x=>x.candidate===g)?.confidence)),...(b?.proposals??[]).map(g=>({id:g.id,type:g.field!==void 0?"fill":"act",label:g.label,...g.confidence!==void 0?{confidence:g.confidence}:{}}))];return{interaction:{...t.entry,ask:{kind:"ask",said:i},offered:A,outcome:"offered",...s?{answer:s}:{},usage:[...t.usage]},offers:C,...b&&b.proposals.length>0?{ghost:b}:{},...s?{answer:s}:{}}}function ae(e,n,t){let i=n.proposals.flatMap(o=>{try{let r=e.previewAll([o.call],{author:t}),c=r.ops.map(d=>d.intent).join("; ");return r.ops.length>0?[{...o,said:c||o.said}]:[]}catch{return[]}});return{...n,proposals:i}}function ke(e){if(e.type==="fill")return{id:e.id,label:e.label,said:e.description,call:e.call,record:e.record,field:e.field};if(e.type==="act"&&e.asks.length===0)return{id:e.id,label:e.label,said:e.description,call:{name:e.mutation,args:{...e.args}}}}function an(e,n,t){let i=n.proposals.filter(r=>t.ids===void 0||t.ids.includes(r.id));if(i.length===0)return{ok:!1,refused:"Nothing was chosen."};let o=i.flatMap(r=>r.confidence===void 0?[]:[r.confidence]);try{let c=e.applyAll(i.map(d=>d.call),{author:t.author,via:`ai:${n.interaction}`,intent:n.basis,lineage:{basis:`Asked \u201C${n.basis}\u201D`,...n.model?{model:n.model}:{},...o.length>0?{confidence:Math.min(...o)}:{},interaction:n.interaction}}).ops[0]?.batch;return c?{ok:!0,batch:c,accepted:i.map(d=>d.id)}:{ok:!1,refused:"That changes nothing now."}}catch(r){return{ok:!1,refused:r instanceof Error?r.message:String(r)}}}function dn(e,n,t){let i=e.ask.kind==="suggest"?n.length>0:e.offered.length>0&&e.offered.every(o=>n.includes(o.id));return{...e,outcome:i?"accepted":"partly",accepted:n,batches:[...e.batches??[],t]}}var ln=e=>({...e,outcome:"dismissed"});var P=xe(hn(),1);var S=xe(Ue(),1);function fn(e,n,t){let i=n.on==="selection"?n.ids:n.on==="record"||n.on==="field"?[n.id]:[],o=i.length>0?Ke(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(r=>({mutation:r.mutation,label:r.label,args:r.args,open:r.open,why:r.why,...r.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:n,principal:e.principal,interaction:Ie(),places:e.places,selection:e.selection,...o?{acts:o}:{},...e.place?{place:e.place}:{},...t?{said:t}:{},...e.app.purpose?{purpose:e.app.purpose}:{}}}async function un(e,n,t){let i=await (__graviewPreload(import.meta.url,["./chunk.LY3YOWKV.js","./chunk.G4JJXA63.js","./chunk.LL2MLSPH.js","./chunk.EB4NVTJL.js","./chunk.XU34T2H4.js","./chunk.XOZU4OFA.js","./chunk.BB33TI4S.js","./chunk.2EDC63RI.js","./chunk.WVUJXDXZ.js","./chunk.LDAYDCUO.js","./chunk.KKNDX4JT.js","./chunk.GKSUTAIX.js","./chunk.5ICIMQE6.js","./chunk.QGV7H7RQ.js","./chunk.YIA2EDVF.js","./chunk.3YZHZGTM.js","./chunk.EQTSV7BK.js","./chunk.27CW6SCT.js","./chunk.7BBGRTXM.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.L7V24JPO.js")),o=i.recipeDraft(n.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(o))return o.failed;t?.(),e.seatTalk.setDraft(o,null),e.goTo.draft?.(),pn()}function pn(e=180){if(typeof document>"u")return;let n=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(n){i&&n.focus();return}e>0&&requestAnimationFrame(()=>pn(e-1))}async function de(e,n,t,i,o){let r=fn(e,t,i),c=n==="suggest"?await tn(e.ai,r):n==="fill"?await on(e.ai,r):n==="record"?await rn(e.ai,r):await sn(e.ai,r);if(c.interaction.outcome==="failed")return n!=="suggest"&&e.desk.record(c.interaction),c;let d=s=>{let f={...c.interaction,outcome:"failed",failed:s};return e.desk.record(f),{...c,interaction:f}};if(n==="fill"||n==="record"){if(!c.ghost||c.ghost.proposals.length===0)return d("Nothing here could be filled in.");o?.(),e.desk.setGhost({ghost:c.ghost}),e.desk.record(c.interaction)}if(n==="panel"&&c.panel){let s=await un(e,c.panel,o);if(s)return d(s);e.desk.record(c.interaction)}return c}var Fe=new WeakMap,Nn=64,cn=new WeakMap;function jn(e){let n=cn.get(e);if(!n){let t=n={n:0};cn.set(e,t),e.subscribe(()=>void(t.n+=1))}return n.n}var yn=(e,n)=>{let t=Y(n);return t.length>0?t.map(i=>e.graph.getNode(i)):[jn(e)]},gn=(e,n,t)=>JSON.stringify({target:n,seat:e.principal,by:t}),mn=(e,n,t)=>{let i=yn(e.store,n);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((o,r)=>o===t.depends[r])};function Dn(e,n,t="menu"){let i=Fe.get(e.store)?.get(gn(e,n,t));return i?.result!==void 0&&mn(e,n,i)?i.result:void 0}function Ln(e,n,t){let i=Fe.get(e.store);i||Fe.set(e.store,i=new Map);let o=gn(e,n,t?.by??"menu"),r=i.get(o);if(r&&mn(e,n,r))return r.result?Promise.resolve(r.result):r.asked;let c=t?t.ask():de(e,"suggest",n),d={schema:e.store.schema,ai:e.ai,depends:yn(e.store,n),asked:c};i.delete(o),i.set(o,d),i.size>Nn&&i.delete(i.keys().next().value);let s=i;return c.then(f=>{f.interaction.outcome!=="failed"?d.result=f:s.get(o)===d&&s.delete(o)}),c}async function Hn(e,n,t,i){let o=n.interaction,r=ke(t);if(r){let c=o.usage?.at(-1)?.model,d=o.offered.find(f=>f.id===t.id)?.confidence,s=ae(e.store,{interaction:o.id,target:o.target,basis:`${o.ask.said}: ${t.label}`,...c?{model:c}:{},proposals:[{...r,...d!==void 0?{confidence:d}:{}}]},e.principal);if(s.proposals.length===0){let f="That can't be done now.";return e.desk.record({...o,outcome:"failed",failed:f}),f}i?.(),e.desk.setGhost({ghost:s}),e.desk.record(o);return}if(t.type==="panel"){let c=t.label,d={title:c,recipe:{...t.panel,title:c}},s=await un(e,d,i);return e.desk.record(s?{...o,outcome:"failed",failed:s}:{...o,outcome:"drawn",accepted:[t.id],panel:d}),s}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...o,outcome:"accepted",accepted:[t.id]})}async function yt(e,n){if(n.ask.kind==="ask")return fe(e.desk,{target:n.target,asked:n.ask.said}),null;let t=n.ask.kind==="panel"||n.ask.kind==="record"?n.ask.kind:"fill";return de(e,t,n.target,n.ask.said)}var z={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},we={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function gt({target:e,close:n}){let t=Je(),i=(0,P.useMemo)(()=>Xe(e,y=>t.store.graph.has(y)),[e,t.store]),o=(0,P.useMemo)(()=>{let y=fn(t,i);return he(t.store,i,{principal:t.principal,places:t.places,...y.acts?{acts:y.acts}:{}})},[t,i]),r=o.candidates.some(y=>y.type==="fill"),c=o.candidates.some(y=>y.type==="panel"),d=(0,P.useMemo)(()=>c?Ze(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[c,t,i]),s=(0,P.useMemo)(()=>new Set(t.store.allMutations().filter(y=>(y.creates??[]).length>0).map(y=>y.name)),[t.store]),f=U(t.ai)!==void 0&&o.candidates.some(y=>y.type==="act"&&y.asks.length>0&&s.has(y.mutation)),a=Oe(t.ai),p=Dn(t,i),h=JSON.stringify(i),[b,C]=(0,P.useState)(!1),[A,g]=(0,P.useState)(null),[x,O]=(0,P.useState)(a&&p===void 0);(0,P.useEffect)(()=>{if(p!==void 0||!(a||b))return;let y=!0;return O(!0),Ln(t,i).then(v=>{y&&(g(v),O(!1))}),()=>{y=!1}},[h,b]);let k=p??A,u=(k?.offers??[]).filter(y=>!(y.type==="place"&&d.some(v=>v.place===y.place))).slice(0,Math.max(0,3-d.length)),w=k?.interaction.outcome==="failed"?k.interaction.failed??"The AI could not suggest anything here.":null,T=(0,P.useRef)(!1),F=(0,P.useRef)(null);(0,P.useLayoutEffect)(()=>{k===null||!T.current||(T.current=!1,F.current?.querySelector("button")?.focus())},[k]);let q=(0,P.useRef)(!0);(0,P.useEffect)(()=>()=>{q.current=!1},[]);let[H,l]=(0,P.useState)(!1),[m,R]=(0,P.useState)(null),E=y=>{if(H)return;l(!0),R(null);let v=!1;y(()=>{v=!0,n()}).then(D=>{q.current&&(l(!1),D?R(D):v||n())},D=>{q.current&&(l(!1),R(D instanceof Error?D.message:String(D)))})},$=y=>y.interaction.outcome==="failed"?y.interaction.failed??"The AI could not do that here.":void 0;return(0,S.jsxs)("div",{ref:F,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[x&&!b?(0,S.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:we,children:"Thinking\u2026"}):H?(0,S.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:we,children:"Asking\u2026"}):m?(0,S.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...we,color:"var(--graview-warn)"},children:m}):w?(0,S.jsx)("p",{role:"status",style:we,children:w}):null,(0,S.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[u.map(y=>(0,S.jsx)("li",{children:(0,S.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${y.id}`,"data-ai-offer":y.id,"data-ai-offer-type":y.type,onClick:()=>E(v=>Hn(t,k,y,v)),style:z,children:[y.label,(0,S.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",y.type==="panel"?"a panel":y.type==="place"?"go there":y.type==="record"?"open it":"suggested"]})]})},y.id)),!a&&k===null?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":b||void 0,onClick:y=>{b||(T.current=document.activeElement===y.currentTarget,C(!0))},style:z,children:b?"Thinking\u2026":"Suggest\u2026"})}):null,r?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>E(async y=>$(await de(t,"fill",i,"Fill in",y))),style:z,children:"Fill in with AI"})}):null,f?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>E(async y=>$(await de(t,"record",i,"Add one",y))),style:z,children:"Add one with AI"})}):null,d.map(y=>(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":`ai-open:${y.place}`,"data-ai-existing":y.fit,onClick:()=>{n(),t.goTo.place(y.place),y.fit==="partial"&&fe(t.desk,{target:{on:"lens",place:y.place,...y.kind?{kind:y.kind}:{}}})},style:z,children:y.fit==="full"?`Open ${y.title}`:`Open and adjust ${y.title}`})},y.place)),c?(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>E(async y=>$(await de(t,"panel",i,"Draw a panel",y))),style:z,children:d.length>0?"Draw a new view":"Draw a panel"})}):null,(0,S.jsx)("li",{children:(0,S.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let y=document.activeElement;n(),fe(t.desk,{target:i,returnTo:y instanceof HTMLElement&&y!==document.body?y:null})},style:z,children:"Ask about this\u2026"})})]})]})}var Ae={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function mt({placement:e="picture"}){let{store:n,principal:t,aiDesk:i}=ze(),o=We(n,t),{ghost:r,entries:c}=_e(i),[d,s]=(0,P.useState)(new Set);(0,P.useEffect)(()=>s(new Set),[r?.ghost.interaction]);let f=(0,P.useRef)(null),a=(0,P.useRef)(null),p=r?.batch;if((0,P.useEffect)(()=>{p!==void 0&&a.current?.focus()},[p]),!r)return null;let{ghost:h}=r,b=c.find(k=>k.id===h.interaction),C=()=>{let k=h.target.on==="record"||h.target.on==="field"?h.target.id:void 0,u=f.current?.closest("[data-graview-face], main")?.parentElement??document,w=(k?u.querySelector(`[data-graview-view="${CSS.escape(k)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??f.current?.closest("main")??document.querySelector("main");w&&!w.hasAttribute("tabindex")&&w.setAttribute("tabindex","-1"),w?.focus({preventScroll:!0}),i.setGhost(null)},A=h.proposals.filter(k=>!d.has(k.id)).map(k=>k.id),g=()=>{let k=an(o,h,{author:t,ids:A});if(!k.ok){i.setGhost({...r,refused:k.refused});return}b&&i.record(dn(b,k.accepted,k.batch)),i.setGhost({ghost:h,batch:k.batch,took:k.accepted.length,...r.onCard?{onCard:!0}:{}})},x=()=>{b&&r.batch===void 0&&i.record(ln(b)),C()},O=()=>{if(r.batch!==void 0)try{o.undo(r.batch,{author:t}),C()}catch(k){i.setGhost({...r,refused:k instanceof Error?k.message:String(k)})}};return(0,S.jsxs)("section",{ref:f,"data-testid":"ai-ghost","data-interaction":h.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:He("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,S.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:r.batch!==void 0?`Done: ${r.took===1?"one change":`${r.took} changes`}, as one.`:`Proposed by AI \xB7 ${h.basis}`}),r.batch===void 0?(0,S.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:h.proposals.map(k=>(0,S.jsx)("li",{"data-ghost-proposal":k.id,children:(0,S.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,S.jsx)("input",{type:"checkbox",checked:!d.has(k.id),onChange:u=>{let w=new Set(d);u.target.checked?w.delete(k.id):w.add(k.id),s(w)}}),(0,S.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:k.said}),k.confidence!==void 0?(0,S.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(k.confidence*100),"% sure"]}):null]})},k.id))}):null,r.refused?(0,S.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:r.refused}):null,(0,S.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:r.batch===void 0?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:A.length===0,onClick:g,style:Ae,children:A.length===h.proposals.length?"Accept":`Accept ${A.length} of ${h.proposals.length}`}),(0,S.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:x,style:Ae,children:"Dismiss"})]}):(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)("button",{type:"button",ref:a,"data-testid":"ghost-undo",onClick:O,style:Ae,children:"Undo"}),(0,S.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:C,style:Ae,children:"Close"})]})})]})}export{Xe as a,Y as b,he as c,Ze as d,te as e,Ie as f,Rn as g,Tn as h,it as i,ot as j,fn as k,un as l,de as m,Dn as n,Ln as o,Hn as p,yt as q,gt as r,mt as s};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a,b}from"./chunk.E34OQVSR.js";import"./chunk.CCWPF5PK.js";import"./chunk.YD3TKV6P.js";import"./chunk.4KC35UNR.js";import"./chunk.HT2BEOEV.js";import"./chunk.SDO3U72B.js";import"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as _}from"./chunk.34TW32TB.js";import"./chunk.YD3TKV6P.js";import"./chunk.4KC35UNR.js";import{G as se,T as U,ba as H,ea as Y}from"./chunk.HT2BEOEV.js";import"./chunk.SDO3U72B.js";import{Zd as $,rb as z}from"./chunk.7BBGRTXM.js";import"./chunk.FQLNBIQ5.js";import{b as D}from"./chunk.AJZBJBMO.js";var u=D(se(),1);function L(e,t,s=!1){if(e<t.at||e===t.at&&s)return e;let i=t.at+t.removed.length;return e>=i?e+t.inserted.length-t.removed.length:s?t.at:t.at+t.inserted.length}var X=e=>e>=55296&&e<=56319,G=e=>e>=56320&&e<=57343;function V(e,t,s){let i=Math.min(e.length,t.length),n=0,l=Math.max(0,Math.min(i,t.length-s));for(;n<l&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;let r=0;for(;r<i-n&&e.charCodeAt(r)===t.charCodeAt(r);)r++;return r>0&&X(e.charCodeAt(r-1))&&r--,n>0&&G(e.charCodeAt(e.length-n))&&n--,{at:r,removed:e.slice(r,e.length-n),inserted:t.slice(r,t.length-n)}}function M(e,t){let s=Math.min(e.length,t.length),i=0;for(;i<s&&e.charCodeAt(i)===t.charCodeAt(i);)i++;i>0&&X(e.charCodeAt(i-1))&&i--;let n=0;for(;n<s-i&&e.charCodeAt(e.length-1-n)===t.charCodeAt(t.length-1-n);)n++;return n>0&&G(e.charCodeAt(e.length-n))&&n--,{at:i,removed:e.slice(i,e.length-n),inserted:t.slice(i,t.length-n)}}function q(e,t){let s=c=>c.at+c.removed.length;if(s(e)<t.at)return e;if(e.at>s(t))return{...e,at:e.at+t.inserted.length-t.removed.length};let i=Math.min(e.at,t.at),n=s(e)-s(t),l=e.removed.slice(0,t.at-i)+t.inserted+(n>0?e.removed.slice(e.removed.length-n):""),r=t.at<=e.at?t.inserted+e.inserted:e.inserted+t.inserted,d=M(l,r);return{...d,at:i+d.at}}function I(e,t){let s=L(e.start,t,!0),i=e.end===e.start?s:L(e.end,t);return{start:s,end:Math.max(s,i)}}function ce(e,t){let{kind:s,id:i,session:n}=e.author,l=`${s}:${i??""}:`;return t.startsWith(l)&&(!n||t.slice(l.length)===n)}function Z(e,t,s,i){let n=e.anchor,l=e.head;for(let d of s)if(!(d.seq<e.rev||ce(d,t)))for(let c of d.primitives)c.op!=="splice-text"||c.id!==e.node||c.field!==e.field||(n=L(n,c),l=L(l,c));let r=d=>Math.max(0,Math.min(i,d));return{start:r(n),end:r(l)}}var O=(e,t,s)=>e.ops.length>0&&e.ops.every(i=>{let n=i.mutation?.args;return i.mutation?.name===z&&n?.node===t&&n.field===s}),le=(e,t,s,i)=>t.ops.length>0&&t.ops.every(n=>n.undoes!==void 0)&&e.batches().some(n=>t.ops.some(l=>l.undoes===n.id||l.undoes===n.ops[0]?.id)&&O(n,s,i)),J=(e,t)=>e.author.kind==="human"&&(t?.id===void 0||e.author.id===void 0||e.author.id===t.id);function Q(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(!(!J(r,t)||r.undone||!O(r,s,i))&&e.canUndo(r.id).ok)return r.id}}function j(e,t,s,i){let n=e.batches();for(let l=n.length-1;l>=0;l--){let r=n[l];if(J(r,t)){if(O(r,s,i))return;if(le(e,r,s,i))return r.undone?void 0:r.id}}}var p=D(U(),1);function de(e){let{store:t}=H(),{live:s,nodeId:i,field:n}=e,[l,r]=(0,u.useState)(null);return(0,u.useEffect)(()=>{let d=!0;return s.typing(i,n).then(c=>d&&r(c)),()=>{d=!1}},[i,n]),l&&!t.collaborative(i,n)?(0,p.jsx)(p.Fragment,{children:e.writtenWhole}):(0,p.jsx)(ue,{...e,typing:l})}function ue({nodeId:e,field:t,label:s,markdown:i,live:n,onDone:l,typing:r}){let{store:d,principal:c}=H(),m=Y(e),f=te(m?.[t]),[x,oe]=(0,u.useState)(!1),y=(0,u.useRef)(null),R=(0,u.useRef)(f),E=(0,u.useRef)(!1),B=(0,u.useRef)(n);B.current=n;let N=()=>te(d.graph.getNode(e)?.[t]);(0,u.useEffect)(()=>y.current?.focus(),[x,r]);let b=(0,u.useRef)(void 0),C=()=>{b.current===void 0&&(b.current=setTimeout(()=>{b.current=void 0;let o=y.current;if(!o||o.ownerDocument.activeElement!==o)return;let a=o.selectionDirection==="backward";B.current.sayCaret({node:e,field:t,anchor:a?o.selectionEnd:o.selectionStart,head:a?o.selectionStart:o.selectionEnd,rev:d.log.length})},fe))};(0,u.useEffect)(()=>()=>{clearTimeout(b.current),B.current.sayCaret(null)},[]);let W=o=>{let a=y.current;if(a){if(a.value!==o){let h=I({start:a.selectionStart,end:a.selectionEnd},M(a.value,o)),g=a.selectionDirection??"none";a.value=o,a.setSelectionRange(h.start,h.end,g)}R.current=o}},K=()=>{let o=y.current;if(!o||!r||E.current)return;let a=R.current,h=N(),g=V(a,o.value,o.selectionEnd);if(g.removed===""&&g.inserted==="")return W(h);let v=a===h?g:q(g,M(a,h));try{r.splice(v.at,v.removed.length,v.inserted)}catch{}let w=N();if(o.value!==w){o.value=w;let S=Math.min(w.length,v.at+v.inserted.length);o.setSelectionRange(S,S)}R.current=w,C()};(0,u.useLayoutEffect)(()=>{E.current||W(f)},[f]);let ie=async o=>{if(!r)return;r.flush();for(let h=0;r.waiting()>0&&h<100;h++)await new Promise(g=>setTimeout(g,30));let a=o?j(d,c,e,t):Q(d,c,e,t);if(a)try{o?d.redo(a,{author:c}):d.undo(a,{author:c})}catch{}},T=o=>{r?.flush(),n.sayCaret(null),l(o)},k=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>k.current?.(),[]);let ae=o=>{k.current?.();let a=o.ownerDocument,h=y.current?.closest("[data-graview-live]"),g=A=>{let P=A.target;if(P instanceof Node&&h?.contains(P))return S();P instanceof Element&&P.closest(ee)||(S(),T(!0))},v=()=>{let A=a.activeElement;A!==null&&A!==a.body||o.isConnected&&he(o)||(S(),y.current?.focus({preventScroll:!0}))},w=new MutationObserver(v);w.observe(a.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["open","hidden"]}),a.addEventListener("focusin",g),a.addEventListener("toggle",v,!0);let S=()=>{k.current=void 0,w.disconnect(),a.removeEventListener("focusin",g),a.removeEventListener("toggle",v,!0)};k.current=S},F=[...n.who.values()].filter(o=>o.caret?.node===e&&o.caret.field===t);return(0,p.jsxs)("div",{style:{display:"grid",gap:8,minWidth:0},"data-graview-live":t,children:[x?(0,p.jsx)("div",{"data-graview-preview":t,"aria-label":`${s}, as it will read`,role:"region",style:me,children:(0,p.jsx)(_,{text:f,markdown:!0})}):(0,p.jsxs)("div",{style:{position:"relative",minWidth:0},children:[(0,p.jsx)("textarea",{ref:y,"aria-label":s,"data-graview-field":t,defaultValue:f,readOnly:!r,rows:3,onInput:K,onCompositionStart:()=>{E.current=!0},onCompositionEnd:()=>{E.current=!1,K()},onSelect:C,onFocus:C,onPointerDown:()=>r?.flush(),onKeyDown:o=>{let a=o.key;a==="Escape"?(o.preventDefault(),T(!1)):(o.metaKey||o.ctrlKey)&&!o.altKey&&a.toLowerCase()==="z"?(o.preventDefault(),ie(o.shiftKey)):(o.metaKey||o.ctrlKey)&&a==="Enter"?(o.preventDefault(),T(!1)):(a==="Enter"||ge.has(a))&&r?.flush()},onKeyUp:C,onBlur:o=>{r?.flush(),n.sayCaret(null);let a=o.relatedTarget;if(a instanceof Node&&o.currentTarget.closest("[data-graview-live]")?.contains(a))return;let h=a instanceof Element?a.closest(ee):null;if(h)return ae(h);T(!0)},style:ve}),F.length>0?(0,p.jsx)(pe,{text:f,others:F,area:y,log:d.log.all()}):null]}),(0,p.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,p.jsx)("button",{type:"button",onClick:()=>T(!1),style:ne,children:"Done"}),i?(0,p.jsx)("button",{type:"button","aria-pressed":x,onClick:()=>oe(!x),style:ne,children:x?"Write":"Preview"}):null,(0,p.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Saved as you type \xB7 Ctrl or \u2318 Z takes back your typing"})]})]})}function pe({text:e,others:t,area:s,log:i}){let n=(0,u.useRef)(null);(0,u.useLayoutEffect)(()=>{let c=s.current,m=n.current;if(!c||!m)return;let f=()=>{m.scrollTop=c.scrollTop};return f(),c.addEventListener("scroll",f),()=>c.removeEventListener("scroll",f)});let l=t.map(c=>({one:c,at:Z(c.caret,c.participant,i,e.length).end})).sort((c,m)=>c.at-m.at),r=[],d=0;for(let{one:c,at:m}of l){r.push(e.slice(d,m)),d=m;let f=$(c)||"Somebody";r.push((0,p.jsx)("span",{"data-graview-caret":c.participant,title:`${f} is typing here`,style:{borderLeft:`2px solid hsl(${Math.round(c.hue)} 55% 52%)`,marginLeft:-1,marginRight:-1,pointerEvents:"auto"}},c.participant))}return r.push(`${e.slice(d)}\u200B`),(0,p.jsx)("div",{ref:n,"aria-hidden":"true",style:ye,children:r})}var ee='[data-graview-overlay], dialog, [role="dialog"], [role="alertdialog"], [popover]',he=e=>{if(e.hasAttribute("hidden")||e instanceof HTMLDialogElement&&!e.open)return!1;if(e.hasAttribute("popover"))try{return e.matches(":popover-open")}catch{}return!0},fe=120,te=e=>typeof e=="string"?e:"",ge=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]),me={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},ne={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},re={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",borderRadius:6},ve={...re,resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)"},ye={...re,position:"absolute",inset:0,height:"100%",border:"1px solid transparent",color:"transparent",whiteSpace:"pre-wrap",overflowWrap:"break-word",overflow:"hidden",pointerEvents:"none"};export{de as default};
|