graview 0.1.70 → 0.1.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/preview/chunk.2IOJNFCR.js +1 -0
- package/dist/preview/{chunk.I7CSRZC2.js → chunk.2Q4ZXP7P.js} +1 -1
- package/dist/preview/{chunk.O2XPLDMM.js → chunk.2TTKQAWQ.js} +1 -1
- package/dist/preview/chunk.2YSE3SQN.js +23 -0
- package/dist/preview/{chunk.NZFO6BM3.js → chunk.2ZPR6FRI.js} +1 -1
- package/dist/preview/chunk.3BE4SHZD.js +1 -0
- package/dist/preview/{chunk.QODVFVWE.js → chunk.43HWCHBN.js} +1 -1
- package/dist/preview/{chunk.QILGAV7H.js → chunk.45OLF6BK.js} +1 -1
- package/dist/preview/{chunk.NTAC5NNE.js → chunk.47QWCVZD.js} +1 -1
- package/dist/preview/{chunk.7HNMG6LG.js → chunk.4A7BRBEA.js} +1 -1
- package/dist/preview/chunk.4EPCI6VY.js +1 -0
- package/dist/preview/{chunk.OXXZGPJZ.js → chunk.4PB5UFUJ.js} +1 -1
- package/dist/preview/{chunk.SWY6DIE4.js → chunk.4TDYDIIM.js} +3 -3
- package/dist/preview/{chunk.6VG2LCES.js → chunk.4VX7GPFS.js} +1 -1
- package/dist/preview/{chunk.TUVPQLFL.js → chunk.523X2YEQ.js} +1 -1
- package/dist/preview/{chunk.CHG522KL.js → chunk.53GQQETN.js} +1 -1
- package/dist/preview/{chunk.NBB5ALVJ.js → chunk.5MKZTHU2.js} +1 -1
- package/dist/preview/chunk.5OS4SYHE.js +1 -0
- package/dist/preview/{chunk.ZTHZHBVN.js → chunk.5ZT4R227.js} +1 -1
- package/dist/preview/{chunk.RIP2SAQ5.js → chunk.65SI77M7.js} +1 -1
- package/dist/preview/chunk.6ESAFTWB.js +1 -0
- package/dist/preview/chunk.6GUIFP2A.js +1 -0
- package/dist/preview/{chunk.M3HLZX6Q.js → chunk.6GZYKHEN.js} +1 -1
- package/dist/preview/{chunk.UVMHC6VM.js → chunk.6YKKZI4H.js} +1 -1
- package/dist/preview/{chunk.BBLA4PSP.js → chunk.73RMM4W7.js} +1 -1
- package/dist/preview/chunk.7DCBIMOI.js +1 -0
- package/dist/preview/chunk.7JE3J7H4.js +1 -0
- package/dist/preview/{chunk.YTRUZ56A.js → chunk.7QGDWAHH.js} +1 -1
- package/dist/preview/{chunk.JEQ6CA5M.js → chunk.7VCYVCYM.js} +2 -2
- package/dist/preview/{chunk.X7HMTN3Z.js → chunk.A4TBVXHQ.js} +1 -1
- package/dist/preview/{chunk.J4NY2K2A.js → chunk.A6LJPXJ3.js} +1 -1
- package/dist/preview/chunk.AAPXF6NP.js +1 -0
- package/dist/preview/chunk.APUICV5Z.js +1 -0
- package/dist/preview/chunk.ASNVH2G4.js +25 -0
- package/dist/preview/{chunk.CM7EDQ4E.js → chunk.CJHCUHVN.js} +1 -1
- package/dist/preview/chunk.CUEPNS3Z.js +1 -0
- package/dist/preview/{chunk.U3CV227I.js → chunk.CUJRWBPX.js} +1 -1
- package/dist/preview/{chunk.7TZXDPPO.js → chunk.D5PW6YWF.js} +3 -3
- package/dist/preview/chunk.DCIYOZYP.js +1 -0
- package/dist/preview/chunk.DEBW4FH6.js +1 -0
- package/dist/preview/{chunk.MR776WQ2.js → chunk.DYPSFTRP.js} +1 -1
- package/dist/preview/{chunk.BBMX3IIO.js → chunk.E6QZUT4L.js} +1 -1
- package/dist/preview/chunk.E7QZZRAQ.js +17 -0
- package/dist/preview/chunk.EHCMBAZO.js +3 -0
- package/dist/preview/chunk.EXTD5JWD.js +1 -0
- package/dist/preview/{chunk.KOVTQCHX.js → chunk.EZF2T3XQ.js} +1 -1
- package/dist/preview/chunk.EZSST3IU.js +1 -0
- package/dist/preview/{chunk.DIVANC3G.js → chunk.F2BZ4SC4.js} +1 -1
- package/dist/preview/chunk.F2I7ERGM.js +1 -0
- package/dist/preview/{chunk.UWEFODVV.js → chunk.FCV3NX6L.js} +1 -1
- package/dist/preview/{chunk.NZ5TJKPT.js → chunk.FFTBUXKX.js} +2 -2
- package/dist/preview/chunk.FILBI7XA.js +1 -0
- package/dist/preview/{chunk.MGG5DH2S.js → chunk.FKSI5522.js} +1 -1
- package/dist/preview/{chunk.I3ADXJQW.js → chunk.FQ2QUDZS.js} +1 -1
- package/dist/preview/{chunk.A5ENJJZN.js → chunk.G2ZDDO3C.js} +1 -1
- package/dist/preview/{chunk.IPKODEOZ.js → chunk.GAVEWSXU.js} +1 -1
- package/dist/preview/chunk.GH6QX7JR.js +87 -0
- package/dist/preview/chunk.GMHBAS45.js +1 -0
- package/dist/preview/{chunk.YCMMATFK.js → chunk.GOVRX2YX.js} +1 -1
- package/dist/preview/chunk.GXK5PI7I.js +1 -0
- package/dist/preview/{chunk.RECTEAG4.js → chunk.GYP3EF6Z.js} +1 -1
- package/dist/preview/chunk.H2RVMT4Y.js +111 -0
- package/dist/preview/chunk.HCHGKI64.js +1 -0
- package/dist/preview/chunk.HE7SAJKZ.js +1 -0
- package/dist/preview/{chunk.WAIIXXVI.js → chunk.HIIYDKFC.js} +2 -2
- package/dist/preview/chunk.HPDUGKEF.js +32 -0
- package/dist/preview/{chunk.DGDOZHYK.js → chunk.HQRPOGTS.js} +1 -1
- package/dist/preview/chunk.HUJLELZ3.js +1 -0
- package/dist/preview/chunk.HVRUHRXR.js +1 -0
- package/dist/preview/{chunk.6KYTCEIH.js → chunk.I46VNAMS.js} +1 -1
- package/dist/preview/{chunk.QAERSZVB.js → chunk.ID4GOKT6.js} +1 -1
- package/dist/preview/{chunk.RJ7UV3XI.js → chunk.IZKCTF2R.js} +1 -1
- package/dist/preview/chunk.IZUAZ6EV.js +1 -0
- package/dist/preview/{chunk.ZIGW5VOT.js → chunk.J3CUBMUZ.js} +1 -1
- package/dist/preview/{chunk.3HFBHLXC.js → chunk.J4D4BIB4.js} +1 -1
- package/dist/preview/{chunk.IRPMGHZN.js → chunk.J7GH2CGV.js} +1 -1
- package/dist/preview/{chunk.SSHEFQ4R.js → chunk.JE4RBRKH.js} +1 -1
- package/dist/preview/{chunk.4BSEYZMS.js → chunk.JJSZLCNU.js} +1 -1
- package/dist/preview/{chunk.KV3N6VRG.js → chunk.JKX4J3KG.js} +1 -1
- package/dist/preview/{chunk.FUTSLXWN.js → chunk.JMXBMLKH.js} +1 -1
- package/dist/preview/chunk.JOB3EKS6.js +1 -0
- package/dist/preview/{chunk.5IM2X3VT.js → chunk.JP33TNCH.js} +1 -1
- package/dist/preview/{chunk.BZXJKWNI.js → chunk.K6EN2YR4.js} +1 -1
- package/dist/preview/chunk.K6YKXTKC.js +1 -0
- package/dist/preview/{chunk.A7JORJJL.js → chunk.KAIZDIRK.js} +1 -1
- package/dist/preview/{chunk.7LAXSQQY.js → chunk.KAQGSLC6.js} +3 -3
- package/dist/preview/{chunk.QG3LV4RH.js → chunk.KFYSKZC4.js} +1 -1
- package/dist/preview/{chunk.VBHV4TLG.js → chunk.KHRS2SKB.js} +1 -1
- package/dist/preview/chunk.KHVW6Q3T.js +1 -0
- package/dist/preview/chunk.KMFH26SS.js +1 -0
- package/dist/preview/{chunk.2T24FYAO.js → chunk.L3ST2YKI.js} +1 -1
- package/dist/preview/{chunk.HIJ72QX6.js → chunk.L6BLZJ6K.js} +1 -1
- package/dist/preview/{chunk.NCBUECIW.js → chunk.LG2BQ5LB.js} +1 -1
- package/dist/preview/{chunk.LZ3HO3HM.js → chunk.LLYHHG67.js} +1 -1
- package/dist/preview/{chunk.VKQONZKR.js → chunk.LPWANRBL.js} +1 -1
- package/dist/preview/{chunk.3MPLUSVY.js → chunk.LSS64NAA.js} +1 -1
- package/dist/preview/{chunk.SUYYDJGZ.js → chunk.MFNWHXGL.js} +1 -1
- package/dist/preview/{chunk.UJF6YTEO.js → chunk.MNH3WUAB.js} +1 -1
- package/dist/preview/chunk.MQ7AB5N4.js +1 -0
- package/dist/preview/{chunk.CZUUFO6A.js → chunk.MU5JK5TK.js} +1 -1
- package/dist/preview/{chunk.RXUL6P7Y.js → chunk.N5CACZ5F.js} +1 -1
- package/dist/preview/{chunk.S6IKR6RD.js → chunk.NFC2TYA6.js} +1 -1
- package/dist/preview/{chunk.TD2V74XU.js → chunk.NKRDVOLJ.js} +1 -1
- package/dist/preview/{chunk.SGYZM6ZU.js → chunk.NNK2E2EP.js} +1 -1
- package/dist/preview/{chunk.J65CZJIC.js → chunk.NVPKYWMF.js} +1 -1
- package/dist/preview/{chunk.DWMFLLJO.js → chunk.NWJ7ELHN.js} +1 -1
- package/dist/preview/{chunk.NKUNCQB3.js → chunk.O5P6LXHF.js} +1 -1
- package/dist/preview/{chunk.2MWEYNVH.js → chunk.OFK6673S.js} +1 -1
- package/dist/preview/{chunk.C4LC2UEU.js → chunk.OG6FEP3K.js} +1 -1
- package/dist/preview/{chunk.CZI6J5CE.js → chunk.OHGAZ3D5.js} +1 -1
- package/dist/preview/{chunk.XJ4JYROM.js → chunk.ONVYKLRX.js} +1 -1
- package/dist/preview/chunk.OQ3FKUP2.js +1 -0
- package/dist/preview/chunk.OUJV4CYS.js +1 -0
- package/dist/preview/{chunk.T552MHMU.js → chunk.OWHH7JDV.js} +1 -1
- package/dist/preview/{chunk.SCN6IYDG.js → chunk.OXDCGGZV.js} +1 -1
- package/dist/preview/{chunk.YIDNZTON.js → chunk.P3Z4ZCL3.js} +1 -1
- package/dist/preview/chunk.PF7XQ5R5.js +1 -0
- package/dist/preview/{chunk.FSZQTX3K.js → chunk.PGT4ZQDG.js} +4 -4
- package/dist/preview/chunk.PH547SON.js +1 -0
- package/dist/preview/chunk.PS765ODQ.js +3 -0
- package/dist/preview/{chunk.MZSWWMX6.js → chunk.PVAYYFT2.js} +1 -1
- package/dist/preview/{chunk.F5STM4DX.js → chunk.Q6WOIE5I.js} +1 -1
- package/dist/preview/{chunk.55C7WO4X.js → chunk.QE257AXE.js} +1 -1
- package/dist/preview/chunk.QKNC5OUC.js +1 -0
- package/dist/preview/chunk.QMGBAKX6.js +2 -0
- package/dist/preview/{chunk.4QBW46XV.js → chunk.QNFX5VHW.js} +1 -1
- package/dist/preview/chunk.QPCDAQTW.js +1 -0
- package/dist/preview/{chunk.TS5APXWC.js → chunk.QPTQIGLX.js} +1 -1
- package/dist/preview/{chunk.LZNHTROY.js → chunk.R5YGW5ZX.js} +1 -1
- package/dist/preview/{chunk.4VTUC5TF.js → chunk.RJ6KEVZC.js} +1 -1
- package/dist/preview/{chunk.6QMRDSTD.js → chunk.RKVMRP7B.js} +1 -1
- package/dist/preview/{chunk.YBQUP3KE.js → chunk.S7U2CHHG.js} +1 -1
- package/dist/preview/{chunk.CLJKQLK2.js → chunk.SD2UYSV6.js} +2 -2
- package/dist/preview/chunk.SI5GGFQR.js +1 -0
- package/dist/preview/{chunk.7QWGIGHM.js → chunk.SMF5S4DQ.js} +1 -1
- package/dist/preview/{chunk.LEZGBHPZ.js → chunk.SNDFIJVX.js} +1 -1
- package/dist/preview/{chunk.F5756PXX.js → chunk.STHWM422.js} +2 -2
- package/dist/preview/{chunk.JIEBGUCA.js → chunk.SV75TRCH.js} +1 -1
- package/dist/preview/{chunk.U2DZE7A5.js → chunk.SXGPRFA4.js} +1 -1
- package/dist/preview/{chunk.ZGJUCVT5.js → chunk.T3RFZ66S.js} +1 -1
- package/dist/preview/{chunk.I6HIVTXU.js → chunk.T6ISUVUP.js} +1 -1
- package/dist/preview/{chunk.R65YX332.js → chunk.TBLOBXZ2.js} +1 -1
- package/dist/preview/{chunk.CVVNHQPO.js → chunk.TDWJU6GW.js} +1 -1
- package/dist/preview/{chunk.2QALBEWP.js → chunk.THLT6NVO.js} +1 -1
- package/dist/preview/{chunk.7FTATAH2.js → chunk.TQCVEKPH.js} +1 -1
- package/dist/preview/{chunk.PAIBRJVZ.js → chunk.TQF5XCUS.js} +1 -1
- package/dist/preview/{chunk.F5XWYO5W.js → chunk.TRP66PHK.js} +1 -1
- package/dist/preview/chunk.TWXYI5AP.js +2 -0
- package/dist/preview/{chunk.IQCMV5WD.js → chunk.UOUQZYVD.js} +1 -1
- package/dist/preview/{chunk.FJXKQZZS.js → chunk.UPL3D3ZO.js} +1 -1
- package/dist/preview/{chunk.U5Q7EVZQ.js → chunk.UXW43HNW.js} +1 -1
- package/dist/preview/{chunk.ZOSTOVXR.js → chunk.V4GSVXSV.js} +1 -1
- package/dist/preview/chunk.VCEDSOAK.js +1 -0
- package/dist/preview/{chunk.4O3STSC4.js → chunk.VE4AQFLW.js} +1 -1
- package/dist/preview/{chunk.HMV4ILAC.js → chunk.VGQDPEB5.js} +1 -1
- package/dist/preview/{chunk.5A5DI36V.js → chunk.VMYXBFPE.js} +1 -1
- package/dist/preview/{chunk.BQWMHHAZ.js → chunk.VNI6HZEF.js} +2 -2
- package/dist/preview/chunk.VQRY2NQ6.js +1 -0
- package/dist/preview/{chunk.K6EKSURO.js → chunk.VUE6ILQV.js} +1 -1
- package/dist/preview/{chunk.3KF5RYPW.js → chunk.W2VSEEKX.js} +1 -1
- package/dist/preview/{chunk.KP7HUXH5.js → chunk.WAPY4RCS.js} +1 -1
- package/dist/preview/chunk.WFRSGGU5.js +1 -0
- package/dist/preview/{chunk.XAN7QXMQ.js → chunk.WIVNFOQR.js} +1 -1
- package/dist/preview/chunk.WRIBFLVG.js +1 -0
- package/dist/preview/{chunk.TVNY7F64.js → chunk.WWD2TS47.js} +1 -1
- package/dist/preview/{chunk.5W7EGQCQ.js → chunk.WWFOQDPR.js} +2 -2
- package/dist/preview/{chunk.FBDCHJS2.js → chunk.X45EITTK.js} +1 -1
- package/dist/preview/{chunk.5FQHZVE3.js → chunk.X5MCAUFX.js} +1 -1
- package/dist/preview/{chunk.IJVR7ZL7.js → chunk.XBWFQ54R.js} +1 -1
- package/dist/preview/{chunk.JPJHM62B.js → chunk.XMBGT6UT.js} +1 -1
- package/dist/preview/chunk.XP4IVKKR.js +1 -0
- package/dist/preview/chunk.XYBWBMNU.js +1 -0
- package/dist/preview/{chunk.MYR36HW4.js → chunk.YC2IDHQX.js} +1 -1
- package/dist/preview/{chunk.ZQSV5XVB.js → chunk.YCYJHPWS.js} +1 -1
- package/dist/preview/{chunk.BJ3G7J2Z.js → chunk.YF5GCOSZ.js} +3 -2
- package/dist/preview/{chunk.3I2SGKKF.js → chunk.YGGBGHZU.js} +1 -1
- package/dist/preview/chunk.YRC6PKXP.js +1 -0
- package/dist/preview/{chunk.6NYSB6OZ.js → chunk.YRN67Z5K.js} +1 -1
- package/dist/preview/chunk.ZDUKVXBI.js +5 -0
- package/dist/preview/index.html +55 -55
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2QOB62XU.js +0 -1
- package/dist/preview/chunk.36FKQJFM.js +0 -2
- package/dist/preview/chunk.3A3DCALP.js +0 -1
- package/dist/preview/chunk.3GPYKWAD.js +0 -1
- package/dist/preview/chunk.3QPMFUMV.js +0 -1
- package/dist/preview/chunk.3ZP6IDUC.js +0 -1
- package/dist/preview/chunk.53HW224Y.js +0 -1
- package/dist/preview/chunk.AW74DZ5V.js +0 -17
- package/dist/preview/chunk.C67TMA4U.js +0 -111
- package/dist/preview/chunk.CCCSZRKU.js +0 -1
- package/dist/preview/chunk.CUA7F3YJ.js +0 -25
- package/dist/preview/chunk.DBSSCJQM.js +0 -1
- package/dist/preview/chunk.DW6KXAUM.js +0 -1
- package/dist/preview/chunk.DWPM7AWA.js +0 -1
- package/dist/preview/chunk.FXCKKVT5.js +0 -1
- package/dist/preview/chunk.HHQUCFN4.js +0 -1
- package/dist/preview/chunk.HPWMCS3H.js +0 -23
- package/dist/preview/chunk.HRLCDBMO.js +0 -1
- package/dist/preview/chunk.I7ODVOO5.js +0 -1
- package/dist/preview/chunk.IANOWT3Z.js +0 -1
- package/dist/preview/chunk.IFPJPJ4M.js +0 -1
- package/dist/preview/chunk.IUVRJDL3.js +0 -5
- package/dist/preview/chunk.J4CSY2D5.js +0 -2
- package/dist/preview/chunk.JJIKTTXB.js +0 -1
- package/dist/preview/chunk.KDOJC4FX.js +0 -1
- package/dist/preview/chunk.KJAOJTZZ.js +0 -1
- package/dist/preview/chunk.KLZPUTMU.js +0 -1
- package/dist/preview/chunk.LQ2PDW2M.js +0 -32
- package/dist/preview/chunk.M7DJJRFH.js +0 -1
- package/dist/preview/chunk.MNWP3TPN.js +0 -1
- package/dist/preview/chunk.MSWOETXN.js +0 -1
- package/dist/preview/chunk.NILR2BWR.js +0 -1
- package/dist/preview/chunk.NNYKLENL.js +0 -1
- package/dist/preview/chunk.PYGNO2AV.js +0 -87
- package/dist/preview/chunk.PZHCWMKT.js +0 -1
- package/dist/preview/chunk.QQUZ5RTQ.js +0 -1
- package/dist/preview/chunk.QVID5WHS.js +0 -1
- package/dist/preview/chunk.RHV73CBA.js +0 -3
- package/dist/preview/chunk.RP6C2IUM.js +0 -1
- package/dist/preview/chunk.RPHZY7N4.js +0 -1
- package/dist/preview/chunk.RSMCTI2N.js +0 -1
- package/dist/preview/chunk.S4QSZRKH.js +0 -1
- package/dist/preview/chunk.T4QRIJE4.js +0 -1
- package/dist/preview/chunk.UJM5EZDM.js +0 -3
- package/dist/preview/chunk.UJPX3BUV.js +0 -1
- package/dist/preview/chunk.UYBSVE2W.js +0 -1
- package/dist/preview/chunk.WMZ2BINI.js +0 -1
- package/dist/preview/chunk.X2RHBTJI.js +0 -1
- package/dist/preview/chunk.X3FPVFFB.js +0 -1
- package/dist/preview/chunk.X4PFLIXB.js +0 -1
- package/dist/preview/chunk.YR7DKU5T.js +0 -1
- package/dist/preview/chunk.ZBK3FCVE.js +0 -1
- package/dist/preview/chunk.ZH5L746C.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as yt}from"./chunk.MR776WQ2.js";import{a as mt}from"./chunk.LZNHTROY.js";import{f as pt}from"./chunk.36FKQJFM.js";import{a as C,f as J}from"./chunk.RHV73CBA.js";import{Cb as ut,F as X,Fb as ft,J as k,L as tt,T as q,Ud as dt,W as nt,Y as et,Z as rt,ea as ot,ha as V,lc as ct,ma as F,pa as at,sa as st,va as it}from"./chunk.IUVRJDL3.js";import{e as lt}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function z(t){let e=[],n=!0;for(let r of t){if(r.text.length===0)continue;let o=r.as==="close"||r.text===","||r.text===":"||r.text.startsWith("'")||n;e.push({part:r,space:!o}),n=r.as==="open"}return e}function D(t,e){return z(t).map(({part:n,space:r})=>`${r?" ":""}${e?n.said??n.text:n.text}`).join("")}function Pt(t){return D(t,!1)}function Lt(t){return D(t,!0)}function gt(t,e=!1){let n=e?t.said:t.text;return t.record!==void 0?`${t.record} \u2014 ${n}`:n}function G(t){let e=l=>z(l).map(({part:a,space:s})=>({...a,space:s})),n=e(t.parts),r=t.when&&t.when.length>0?e(t.when):void 0,o=l=>`${D(n,l)}${r?`, when ${D(r,l)}`:""}`;return{...t,parts:n,...r?{when:r}:{},text:o(!1),said:o(!0)}}function jt(t,e=!1){return t.line?gt(t.line,e):t.message}var ht=60,b=t=>({text:t,as:"name"}),f=(t,e)=>e===void 0?{text:t,as:"word"}:{text:t,as:"word",said:e},P=(t,e)=>e===void 0||e===t?{text:t,as:"value"}:{text:t,as:"value",said:e},v=(t,e)=>({text:t,as:"op",said:e}),R={text:"(",as:"open"},w={text:")",as:"close"},W={text:"\u2014",as:"value",said:"empty"},M={">=":["\u2265","at least"],"<=":["\u2264","at most"],"<":["<","less than"],">":[">","more than"],"==":["=","is"],"!=":["\u2260","is not"]},B={">=":"<","<=":">","<":">=",">":"<=","==":"!=","!=":"=="},At={"+":["+","plus"],"-":["\u2212","minus"],"*":["\xD7","times"],"/":["\xF7","divided by"],"%":["mod","modulo"]},bt=t=>t.t==="binary"&&t.op in M;function T(t){return ot(t)}function vt(t){let{schema:e}=t,n=i=>i===null?void 0:e.tryDefinition(i),r=(i,d)=>{let y=n(i)?.edges;return y&&Object.hasOwn(y,d)?y[d]:void 0},o=(i,d)=>{let y=r(i,d)?.to;return Array.isArray(y)&&y.length===1?y[0]:null},l=(i,d)=>{let y=(e.edge(d)?.from??[]).filter(j=>{let $=r(j,d)?.to;return i===null||$==="*"||Array.isArray($)&&$.includes(i)});return y.length===1?y[0]:null},a=(i,d)=>r(i,d)?V(d).toLowerCase():T(st(n(i),d)),s=i=>T(at(e,i)),m=i=>T(pt(e).get(i)?.label??V(i)),g=i=>T(it(n(i),i)),S=(i,d)=>{let y=i===null?void 0:t.formatOf?.(i,d);if(y?.format)return y;let j=t.said?.get(d);return j?{...y,format:j}:y},u=i=>F(e.tryDefinition(i.kind),i),p=t.money?.locale,h=(i,d)=>{if(i==null)return W;if(i instanceof C){if(i.nodes.length===0)return W;let L=i.nodes.slice(0,3).map(u),Q=i.nodes.length-L.length;return P(Q>0?`${L.join(", ")} and ${Q} more`:L.length>1?`${L.slice(0,-1).join(", ")} and ${L[L.length-1]}`:L[0])}if(Array.isArray(i))return P(`{${i.map(L=>h(L,d).text).join(", ")}}`,i.map(L=>h(L,d).text).join(" or "));if(typeof i=="object")return P(u(i));if(typeof i=="boolean")return P(i?"yes":"no");let y=d?.format??(d?S(d.kind,d.key):void 0);if(typeof i=="number")return P(y&&y.format!=="date"?ct(i,{...t.money,...y}):rt(i,p));if(X.test(i)||y?.format==="date")return P(q(et(i,t.money?.timeZone)??i.slice(0,10),p));if(k.test(i))return P(nt(i,p,t.money?.timeZone));let j=d&&d.kind!==null?n(d.kind)?.display?.format?.[d.key]:void 0;if(j)return P(j(i));let $=i.length>ht?`${i.slice(0,ht-1).trimEnd()}\u2026`:i;return P(/^[a-z][a-z0-9]*([-_][a-z0-9]+)*$/.test($)?$.replace(/[-_]+/g," "):$)};return{definition:n,relation:r,farOf:o,nearOf:l,fieldName:a,plural:s,noun:g,factName:m,formatOf:S,valueWords:h,locale:p}}function E(t,e,n){if(t.t==="ident")return{kind:e,key:t.name};if(t.t==="member")return{kind:O(t.object,e,n),key:t.name};if(t.t==="call"&&(t.fn==="sum"||t.fn==="min"||t.fn==="max")&&t.args.length===2){let r=O(t.args[0],e,n),o=t.args[1];if(o.t==="ident")return{kind:r,key:o.name};if(o.t==="lit"&&typeof o.value=="string")return{kind:r,key:o.value}}if(t.t==="binary"&&(t.op==="+"||t.op==="-"))return E(t.left,e,n)??E(t.right,e,n);if(t.t==="call"&&t.fn==="if"&&t.args.length===3)return E(t.args[1],e,n)??E(t.args[2],e,n)}function O(t,e,n){switch(t.t){case"ident":return n.relation(e,t.name)?n.farOf(e,t.name):null;case"member":return n.farOf(O(t.object,e,n),t.name);case"where":return O(t.set,e,n);case"binary":return t.op==="|"||t.op==="&"||t.op==="-"?O(t.left,e,n):null;case"call":{let r=o=>{let l=t.args[o];return l?.t==="lit"&&typeof l.value=="string"?l.value:void 0};return t.fn==="all"?r(0)??null:t.fn==="out"?t.args.length===2?n.farOf(O(t.args[0],e,n),r(1)??""):n.farOf(e,r(0)??""):t.fn==="in"?t.args.length===2?n.nearOf(O(t.args[0],e,n),r(1)??""):n.nearOf(e,r(0)??""):(t.fn==="first"||t.fn==="sort")&&t.args[0]?O(t.args[0],e,n):null}default:return null}}function A(t){return t.t==="binary"?t.op==="||"?U(t)?4:1:t.op==="&&"?2:t.op in M||t.op==="in"?4:t.op==="+"||t.op==="-"?5:t.op==="*"||t.op==="/"||t.op==="%"?6:4.5:t.t==="unary"&&t.op==="!"?3:t.t==="where"?3.5:9}var K=t=>t.t==="lit",x=(t,e)=>t.t==="call"&&t.fn===e;function I(t,e){return t.t==="binary"&&t.op===e?[...I(t.left,e),...I(t.right,e)]:[t]}function U(t){if(t.t!=="binary"||t.op!=="||")return;let e=[];e.push(...I(t,"||"));let n,r=[];for(let o of e){if(o.t!=="binary"||o.op!=="=="||!K(o.right)||typeof o.right.value!="string"||n&&JSON.stringify(xt(n))!==JSON.stringify(xt(o.left)))return;n=o.left,r.push(o.right)}return n?{subject:n,values:r}:void 0}var xt=t=>JSON.parse(JSON.stringify(t,(e,n)=>e==="at"?void 0:n));function c(t,e,n,r){let o=(l,a,s=e)=>A(l)<a?[R,...c(l,s,n),w]:c(l,s,n);switch(t.t){case"lit":return[n.valueWords(t.value,r)];case"list":return[n.valueWords(t.items.map(l=>l.t==="lit"?l.value:null),r)];case"ident":return[b(n.fieldName(e,t.name))];case"member":{let l=x(t.object,"first")&&t.object.args[0]&&x(t.object.args[0],"all"),a=O(t.object,e,n);if(l&&a)return e!==null&&n.fieldName(e,t.name)===n.fieldName(a,t.name)&&n.definition(e)?.fields?.shape&&Object.prototype.hasOwnProperty.call(n.definition(e).fields.shape,t.name)?[b(`${n.noun(a)}'s ${n.fieldName(a,t.name)}`)]:[b(n.fieldName(a,t.name))];let s=c(t.object,e,n),m=s[s.length-1];return s.length===1&&m?.as==="name"?[b(`${m.text}'s ${n.fieldName(a,t.name)}`)]:[...s,f("'s"),b(n.fieldName(a,t.name))]}case"unary":return t.op==="-"?[v("\u2212","minus"),...o(t.operand,7)]:_(t.operand,e,n);case"where":{let l=O(t.set,e,n),a=c(t.filter,l,n),s=a.every(m=>m.as==="name"||m.as==="word"&&m.text==="not");return[...o(t.set,4),...s?[]:[f("with")],...A(t.filter)<=2?[R,...a,w]:a]}case"binary":return Rt(t,e,n);case"call":return St(t,e,n)}}function _(t,e,n){return bt(t)?Rt({...t,op:B[t.op]},e,n):x(t,"present")||x(t,"exists")?[...c(t.args[0],e,n),v("=","is"),W]:t.t==="ident"?[f("not"),b(n.fieldName(e,t.name))]:[f("not"),R,...c(t,e,n),w]}function Rt(t,e,n){let r=(a,s)=>A(a)<s?[R,...c(a,e,n),w]:c(a,e,n);if(t.op==="&&"||t.op==="||"){let a=U(t);if(a){let m=E(a.subject,e,n);return[...c(a.subject,e,n),v("\u2208","is one of"),n.valueWords(a.values.map(g=>g.value),m)]}let s=t.op==="&&"?2:1;return[...r(t.left,s),f(t.op==="&&"?"and":"or"),...r(t.right,s+.5)]}if(t.op in M){if(K(t.right)&&typeof t.right.value=="boolean"&&(t.op==="=="||t.op==="!="))return t.op==="=="===t.right.value?c(t.left,e,n):_(t.left,e,n);let[a,s]=M[t.op],m=E(t.left,e,n),g=E(t.right,e,n);return[...N(t.left,e,n,g),v(a,s),...N(t.right,e,n,m)]}if(t.op==="in")return[...r(t.left,5),v("\u2208","is one of"),...N(t.right,e,n,E(t.left,e,n))];let o=At[t.op];if(o){let a=A(t);return[...r(t.left,a),v(o[0],o[1]),...r(t.right,a+.5)]}let l={"|":"or","&":"and also","-":"except"};return[...r(t.left,5),f(l[t.op]??t.op),...r(t.right,5)]}function N(t,e,n,r){return t.t==="lit"||t.t==="list"?c(t,e,n,r):A(t)<5?[R,...c(t,e,n),w]:c(t,e,n)}function St(t,e,n){let r=a=>t.args[a],o=a=>{let s=t.args[a];return s?.t==="lit"&&typeof s.value=="string"?s.value:void 0},l=a=>{let s=r(a);return A(s)<9&&s.t!=="where"?[R,...c(s,e,n),w]:c(s,e,n)};switch(t.fn){case"out":{let a=o(t.args.length-1)??"",s=b(V(a).toLowerCase());return t.args.length===2?[s,f("of"),...l(0)]:[s]}case"in":{let a=o(t.args.length-1)??"",s=t.args.length===2?n.nearOf(O(r(0),e,n),a):n.nearOf(e,a),m=b(s?n.plural(s):V(a).toLowerCase());return t.args.length===2?[m,f("of"),...l(0)]:[m]}case"all":{let a=o(0),s=t.args[1]?.t==="lit"?t.args[1].value:void 0,m=s===!0?[f("archived")]:s==="all"?[f("archived or not")]:[];return s===!0?[...m,b(a?n.plural(a):"everything")]:[b(a?n.plural(a):"everything"),...m]}case"fact":{let a=o(0);return[b(a?n.factName(a):"fact")]}case"count":return[f("number of"),...l(0)];case"exists":return[...l(0),v("\u2260","is not"),W];case"present":return[...c(r(0),e,n),v("\u2260","is not"),W];case"some":case"every":{let a=O(r(0),e,n),s=r(1);return[...t.fn==="some"?[f("some")]:[],...l(0),f(t.fn==="some"?"with":"all with"),...A(s)<=2?[R,...c(s,a,n),w]:c(s,a,n)]}case"sum":case"min":case"max":{let a=O(r(0),e,n),s=r(1),m=s.t==="lit"&&typeof s.value=="string"?[b(n.fieldName(a,s.value))]:A(s)<9?[R,...c(s,a,n),w]:c(s,a,n);return[f(t.fn==="sum"?"total":t.fn==="min"?"least":"most"),...m,f("of"),...l(0)]}case"first":{let a=r(0);if(x(a,"all")){let s=a.args[0]?.value;if(typeof s=="string")return[b(`the ${n.noun(s)}`)]}return[f("first of"),...l(0)]}case"sort":return[...l(0),f("by"),...c(r(1),O(r(0),e,n),n)];case"len":return[f("length of"),...c(r(0),e,n)];case"lower":return c(r(0),e,n);case"round":return[...c(r(0),e,n),f(t.args.length===2&&K(r(1))?`rounded to ${String(r(1).value)} places`:"rounded")];case"contains":case"startsWith":return[...c(r(0),e,n),f(t.fn==="contains"?"contains":"starts with"),...N(r(1),e,n,E(r(0),e,n))];case"today":return[P("today")];case"now":return[P("now")];case"date":return K(r(0))&&typeof r(0).value=="string"?[P(q(String(r(0).value),n.locale))]:c(r(0),e,n);case"days":case"hours":{let a=t.fn,[s,m]=[r(0),r(1)];return x(m,"today")||x(m,"now")?[f(`${a} since`),...c(s,e,n)]:x(s,"today")||x(s,"now")?[f(`${a} until`),...c(m,e,n)]:[f(`${a} from`),...c(s,e,n),f("to"),...c(m,e,n)]}case"if":return[R,...c(r(1),e,n),f("if"),...c(r(0),e,n),f(","),f("else"),...c(r(2),e,n),w];case"either":return t.args.flatMap((a,s)=>s===0?c(a,e,n):[f(","),f("else"),...c(a,e,n)]);default:return[f(t.fn),R,...t.args.flatMap((a,s)=>s===0?c(a,e,n):[f(","),...c(a,e,n)]),w]}}function H(t){let e=n=>b(V(n).toLowerCase());return[f("through"),e(t.through.relation),...t.via?[f(","),f("then"),e(t.via.relation)]:[]]}function Z(t,e){let n=vt(e),r=t.over==="graph"?null:t.over,o=t.covers?[f("reaches every"),b(n.noun(t.covers.every)),...H(t.covers)]:c(t.require,r,n);return G({...r===null?{}:{kind:r},parts:o,...t.when?{when:c(t.when,r,n)}:{}})}function Y(t,e,n,r){let o=vt(e),l=t.over==="graph"?null:t.over,a=n.subject;if(t.covers)return G({...l===null?{}:{kind:l},parts:r?[f("does not reach"),o.valueWords(r),...H(t.covers)]:[f("does not reach every"),b(o.noun(t.covers.every)),...H(t.covers)],...a?{record:F(e.schema.tryDefinition(a.kind),a)}:{}});let s=u=>{try{return J(u,{...n,budget:2e3})}catch{return}},m=(u,p)=>{let h=N(u,l,o,p);if(u.t==="lit"||u.t==="list"||x(u,"today")||x(u,"now")||x(u,"date"))return h;let i=s(u);if(i===void 0)return h;let d=E(u,l,o),y=o.valueWords(i,d?{...d,format:o.formatOf(d.kind,d.key)??(p?o.formatOf(p.kind,p.key):void 0)}:p);return i instanceof C?[...h,f(":"),y]:[...h,y]},g=u=>{if(u.t==="binary"&&u.op==="&&"){let p=[];p.push(...I(u,"&&"));let h=p.filter(i=>s(i)!==!0);return(h.length>0?h:p).flatMap((i,d)=>[...d>0?[f("and")]:[],...A(i)<=2?[R,...g(i),w]:g(i)])}if(u.t==="binary"&&u.op==="||"){let p=U(u);if(p){let i=E(p.subject,l,o);return[...m(p.subject),v("\u2209","is not one of"),o.valueWords(p.values.map(d=>d.value),i)]}let h=[];return h.push(...I(u,"||")),h.flatMap((i,d)=>[...d>0?[f("and")]:[],...A(i)<=2?[R,...g(i),w]:g(i)])}if(u.t==="binary"&&u.op in M){if(K(u.right)&&typeof u.right.value=="boolean"&&(u.op==="=="||u.op==="!="))return u.op==="=="===u.right.value?_(u.left,l,o):c(u.left,l,o);let p=B[u.op],[h,i]=M[p],d=E(u.left,l,o),y=E(u.right,l,o);if(K(u.right)&&u.right.value===null)return[...p==="=="?N(u.left,l,o,y):m(u.left,y),v(h,i),W];let j=p==="=="&&(K(u.right)||K(u.left));return[...j?N(u.left,l,o,y):m(u.left,y),v(h,i),...j?N(u.right,l,o,d):m(u.right,d)]}if(u.t==="binary"&&u.op==="in")return[...m(u.left),v("\u2209","is not one of"),...N(u.right,l,o,E(u.left,l,o))];if(u.t==="unary"&&u.op==="!"){let p=u.operand;return bt(p)?g({...p,op:B[p.op]}):x(p,"present")||x(p,"exists")?[...m(p.args[0]),v("\u2260","is not"),W]:p.t==="ident"?c(p,l,o):[f("not"),R,..._(p,l,o),w]}if(x(u,"present")||x(u,"exists"))return[...c(u.args[0],l,o),v("=","is"),W];if(x(u,"some"))return[...c(u,l,o).slice(1),v("=","is"),W];if(x(u,"every")&&u.args.length===2){let p=s(u.args[0]);if(p instanceof C){let h=p.nodes.filter(i=>{try{return J(u.args[1],{...n,subject:i,budget:2e3})!==!0}catch{return!0}});return[...c(u,l,o),f(","),f("not"),o.valueWords(new C(h))]}}return u.t==="ident"?[f("not"),b(o.fieldName(l,u.name))]:[f("not"),R,...c(u,l,o),w]},S;try{S=g(t.require)}catch{S=[f("not"),R,...c(t.require,l,o),w]}return G({...l===null?{}:{kind:l},parts:S,...a?{record:F(e.schema.tryDefinition(a.kind),a)}:{}})}function wt(t){let e=new Map;for(let n of t??[])n.expr?.t==="ident"&&n.format&&(n.format==="money"||n.format==="percent"||n.format==="date")&&e.set(n.expr.name,n.format);return e}function Nt(t){return(e,n)=>{let r=t[e]?.fields?.[n],o=r?.format??(r?.type==="date"?"date":void 0);return o||r?.unit?{...o?{format:o}:{},...r?.unit?{unit:r.unit}:{}}:void 0}}function Et(t,e){return{schema:e,said:wt(t.says),...t.declared?{formatOf:Nt(t.declared)}:{},...t.money?{money:t.money}:{}}}function Xt(t,e){return t.shape?Z(t.shape,Et(t.shape,e)):void 0}var Ot=new WeakMap;function Wt(t,e){let n=new Map(t.allInvariants().map(r=>[r.name,r]));return e.map(r=>{let o=Vt(r),l=n.get(o.invariant)?.shape;if(!l||o.status&&o.status!=="violated")return o;let a=o.subjectId?t.graph.getNode(o.subjectId):void 0;if(l.over!=="graph"&&!a)return o;let s=l.kinds;s||(s=Ot.get(t.schema),s||Ot.set(t.schema,s=mt(t.schema)));try{let m=t.today?.()??l.today?.()??tt(),g=l.covers?o.nodeIds.find(p=>p!==o.subjectId):void 0,S=g?t.graph.getNode(g):void 0,u=Y(l,Et(l,t.schema),{graph:t.graph,subject:a??null,kinds:s,today:m},S);return{...o,line:u,...l.says||l.covers?{}:{message:`${o.message} \u2014 ${u.text}`}}}catch{return o}})}function $t(){ft((t,e,n,r)=>Wt({graph:t,schema:t.schema,allInvariants:()=>e,today:()=>r},n)),yt(Kt)}function Kt(t,e,n,r){let o=e.graph,l=ut.from(t.schema,o.snapshot(),{validate:!1});for(let g of n?[...r].reverse().map(lt):r)try{l.applyPrimitives([g],{restoring:!0})}catch{}let a=g=>t.violations(void 0,g),s=a(n?l:o),m=a(n?o:l);return{...dt(t.allInvariants(),s,m),violationsAfter:m}}function Vt(t){if(!t.line)return t;let{line:e,...n}=t,r=` \u2014 ${e.text}`;return n.message.endsWith(r)?{...n,message:n.message.slice(0,-r.length)}:n}$t();export{Y as brokenLineOf,$t as judgeWithLines,Kt as judgedForASeat,jt as problemWords,Xt as ruleLine,Z as ruleLineOf,gt as ruleLineWords,z as ruleSpacing,Lt as ruleSpoken,Pt as ruleText,Vt as unlined,Wt as withLines};
|
|
1
|
+
import{b as yt}from"./chunk.DYPSFTRP.js";import{a as mt}from"./chunk.R5YGW5ZX.js";import{f as pt}from"./chunk.QMGBAKX6.js";import{d as C,i as J}from"./chunk.PS765ODQ.js";import{Cb as ut,F as X,Fb as ft,J as k,L as tt,T as q,Ud as dt,W as nt,Y as et,Z as rt,ea as ot,ha as V,lc as ct,ma as F,pa as at,sa as st,va as it}from"./chunk.ZDUKVXBI.js";import{e as lt}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function z(t){let e=[],n=!0;for(let r of t){if(r.text.length===0)continue;let o=r.as==="close"||r.text===","||r.text===":"||r.text.startsWith("'")||n;e.push({part:r,space:!o}),n=r.as==="open"}return e}function D(t,e){return z(t).map(({part:n,space:r})=>`${r?" ":""}${e?n.said??n.text:n.text}`).join("")}function Pt(t){return D(t,!1)}function Lt(t){return D(t,!0)}function gt(t,e=!1){let n=e?t.said:t.text;return t.record!==void 0?`${t.record} \u2014 ${n}`:n}function G(t){let e=l=>z(l).map(({part:a,space:s})=>({...a,space:s})),n=e(t.parts),r=t.when&&t.when.length>0?e(t.when):void 0,o=l=>`${D(n,l)}${r?`, when ${D(r,l)}`:""}`;return{...t,parts:n,...r?{when:r}:{},text:o(!1),said:o(!0)}}function jt(t,e=!1){return t.line?gt(t.line,e):t.message}var ht=60,b=t=>({text:t,as:"name"}),f=(t,e)=>e===void 0?{text:t,as:"word"}:{text:t,as:"word",said:e},P=(t,e)=>e===void 0||e===t?{text:t,as:"value"}:{text:t,as:"value",said:e},v=(t,e)=>({text:t,as:"op",said:e}),R={text:"(",as:"open"},w={text:")",as:"close"},W={text:"\u2014",as:"value",said:"empty"},M={">=":["\u2265","at least"],"<=":["\u2264","at most"],"<":["<","less than"],">":[">","more than"],"==":["=","is"],"!=":["\u2260","is not"]},B={">=":"<","<=":">","<":">=",">":"<=","==":"!=","!=":"=="},At={"+":["+","plus"],"-":["\u2212","minus"],"*":["\xD7","times"],"/":["\xF7","divided by"],"%":["mod","modulo"]},bt=t=>t.t==="binary"&&t.op in M;function T(t){return ot(t)}function vt(t){let{schema:e}=t,n=i=>i===null?void 0:e.tryDefinition(i),r=(i,d)=>{let y=n(i)?.edges;return y&&Object.hasOwn(y,d)?y[d]:void 0},o=(i,d)=>{let y=r(i,d)?.to;return Array.isArray(y)&&y.length===1?y[0]:null},l=(i,d)=>{let y=(e.edge(d)?.from??[]).filter(j=>{let $=r(j,d)?.to;return i===null||$==="*"||Array.isArray($)&&$.includes(i)});return y.length===1?y[0]:null},a=(i,d)=>r(i,d)?V(d).toLowerCase():T(st(n(i),d)),s=i=>T(at(e,i)),m=i=>T(pt(e).get(i)?.label??V(i)),g=i=>T(it(n(i),i)),S=(i,d)=>{let y=i===null?void 0:t.formatOf?.(i,d);if(y?.format)return y;let j=t.said?.get(d);return j?{...y,format:j}:y},u=i=>F(e.tryDefinition(i.kind),i),p=t.money?.locale,h=(i,d)=>{if(i==null)return W;if(i instanceof C){if(i.nodes.length===0)return W;let L=i.nodes.slice(0,3).map(u),Q=i.nodes.length-L.length;return P(Q>0?`${L.join(", ")} and ${Q} more`:L.length>1?`${L.slice(0,-1).join(", ")} and ${L[L.length-1]}`:L[0])}if(Array.isArray(i))return P(`{${i.map(L=>h(L,d).text).join(", ")}}`,i.map(L=>h(L,d).text).join(" or "));if(typeof i=="object")return P(u(i));if(typeof i=="boolean")return P(i?"yes":"no");let y=d?.format??(d?S(d.kind,d.key):void 0);if(typeof i=="number")return P(y&&y.format!=="date"?ct(i,{...t.money,...y}):rt(i,p));if(X.test(i)||y?.format==="date")return P(q(et(i,t.money?.timeZone)??i.slice(0,10),p));if(k.test(i))return P(nt(i,p,t.money?.timeZone));let j=d&&d.kind!==null?n(d.kind)?.display?.format?.[d.key]:void 0;if(j)return P(j(i));let $=i.length>ht?`${i.slice(0,ht-1).trimEnd()}\u2026`:i;return P(/^[a-z][a-z0-9]*([-_][a-z0-9]+)*$/.test($)?$.replace(/[-_]+/g," "):$)};return{definition:n,relation:r,farOf:o,nearOf:l,fieldName:a,plural:s,noun:g,factName:m,formatOf:S,valueWords:h,locale:p}}function E(t,e,n){if(t.t==="ident")return{kind:e,key:t.name};if(t.t==="member")return{kind:O(t.object,e,n),key:t.name};if(t.t==="call"&&(t.fn==="sum"||t.fn==="min"||t.fn==="max")&&t.args.length===2){let r=O(t.args[0],e,n),o=t.args[1];if(o.t==="ident")return{kind:r,key:o.name};if(o.t==="lit"&&typeof o.value=="string")return{kind:r,key:o.value}}if(t.t==="binary"&&(t.op==="+"||t.op==="-"))return E(t.left,e,n)??E(t.right,e,n);if(t.t==="call"&&t.fn==="if"&&t.args.length===3)return E(t.args[1],e,n)??E(t.args[2],e,n)}function O(t,e,n){switch(t.t){case"ident":return n.relation(e,t.name)?n.farOf(e,t.name):null;case"member":return n.farOf(O(t.object,e,n),t.name);case"where":return O(t.set,e,n);case"binary":return t.op==="|"||t.op==="&"||t.op==="-"?O(t.left,e,n):null;case"call":{let r=o=>{let l=t.args[o];return l?.t==="lit"&&typeof l.value=="string"?l.value:void 0};return t.fn==="all"?r(0)??null:t.fn==="out"?t.args.length===2?n.farOf(O(t.args[0],e,n),r(1)??""):n.farOf(e,r(0)??""):t.fn==="in"?t.args.length===2?n.nearOf(O(t.args[0],e,n),r(1)??""):n.nearOf(e,r(0)??""):(t.fn==="first"||t.fn==="sort")&&t.args[0]?O(t.args[0],e,n):null}default:return null}}function A(t){return t.t==="binary"?t.op==="||"?U(t)?4:1:t.op==="&&"?2:t.op in M||t.op==="in"?4:t.op==="+"||t.op==="-"?5:t.op==="*"||t.op==="/"||t.op==="%"?6:4.5:t.t==="unary"&&t.op==="!"?3:t.t==="where"?3.5:9}var K=t=>t.t==="lit",x=(t,e)=>t.t==="call"&&t.fn===e;function I(t,e){return t.t==="binary"&&t.op===e?[...I(t.left,e),...I(t.right,e)]:[t]}function U(t){if(t.t!=="binary"||t.op!=="||")return;let e=[];e.push(...I(t,"||"));let n,r=[];for(let o of e){if(o.t!=="binary"||o.op!=="=="||!K(o.right)||typeof o.right.value!="string"||n&&JSON.stringify(xt(n))!==JSON.stringify(xt(o.left)))return;n=o.left,r.push(o.right)}return n?{subject:n,values:r}:void 0}var xt=t=>JSON.parse(JSON.stringify(t,(e,n)=>e==="at"?void 0:n));function c(t,e,n,r){let o=(l,a,s=e)=>A(l)<a?[R,...c(l,s,n),w]:c(l,s,n);switch(t.t){case"lit":return[n.valueWords(t.value,r)];case"list":return[n.valueWords(t.items.map(l=>l.t==="lit"?l.value:null),r)];case"ident":return[b(n.fieldName(e,t.name))];case"member":{let l=x(t.object,"first")&&t.object.args[0]&&x(t.object.args[0],"all"),a=O(t.object,e,n);if(l&&a)return e!==null&&n.fieldName(e,t.name)===n.fieldName(a,t.name)&&n.definition(e)?.fields?.shape&&Object.prototype.hasOwnProperty.call(n.definition(e).fields.shape,t.name)?[b(`${n.noun(a)}'s ${n.fieldName(a,t.name)}`)]:[b(n.fieldName(a,t.name))];let s=c(t.object,e,n),m=s[s.length-1];return s.length===1&&m?.as==="name"?[b(`${m.text}'s ${n.fieldName(a,t.name)}`)]:[...s,f("'s"),b(n.fieldName(a,t.name))]}case"unary":return t.op==="-"?[v("\u2212","minus"),...o(t.operand,7)]:_(t.operand,e,n);case"where":{let l=O(t.set,e,n),a=c(t.filter,l,n),s=a.every(m=>m.as==="name"||m.as==="word"&&m.text==="not");return[...o(t.set,4),...s?[]:[f("with")],...A(t.filter)<=2?[R,...a,w]:a]}case"binary":return Rt(t,e,n);case"call":return St(t,e,n)}}function _(t,e,n){return bt(t)?Rt({...t,op:B[t.op]},e,n):x(t,"present")||x(t,"exists")?[...c(t.args[0],e,n),v("=","is"),W]:t.t==="ident"?[f("not"),b(n.fieldName(e,t.name))]:[f("not"),R,...c(t,e,n),w]}function Rt(t,e,n){let r=(a,s)=>A(a)<s?[R,...c(a,e,n),w]:c(a,e,n);if(t.op==="&&"||t.op==="||"){let a=U(t);if(a){let m=E(a.subject,e,n);return[...c(a.subject,e,n),v("\u2208","is one of"),n.valueWords(a.values.map(g=>g.value),m)]}let s=t.op==="&&"?2:1;return[...r(t.left,s),f(t.op==="&&"?"and":"or"),...r(t.right,s+.5)]}if(t.op in M){if(K(t.right)&&typeof t.right.value=="boolean"&&(t.op==="=="||t.op==="!="))return t.op==="=="===t.right.value?c(t.left,e,n):_(t.left,e,n);let[a,s]=M[t.op],m=E(t.left,e,n),g=E(t.right,e,n);return[...N(t.left,e,n,g),v(a,s),...N(t.right,e,n,m)]}if(t.op==="in")return[...r(t.left,5),v("\u2208","is one of"),...N(t.right,e,n,E(t.left,e,n))];let o=At[t.op];if(o){let a=A(t);return[...r(t.left,a),v(o[0],o[1]),...r(t.right,a+.5)]}let l={"|":"or","&":"and also","-":"except"};return[...r(t.left,5),f(l[t.op]??t.op),...r(t.right,5)]}function N(t,e,n,r){return t.t==="lit"||t.t==="list"?c(t,e,n,r):A(t)<5?[R,...c(t,e,n),w]:c(t,e,n)}function St(t,e,n){let r=a=>t.args[a],o=a=>{let s=t.args[a];return s?.t==="lit"&&typeof s.value=="string"?s.value:void 0},l=a=>{let s=r(a);return A(s)<9&&s.t!=="where"?[R,...c(s,e,n),w]:c(s,e,n)};switch(t.fn){case"out":{let a=o(t.args.length-1)??"",s=b(V(a).toLowerCase());return t.args.length===2?[s,f("of"),...l(0)]:[s]}case"in":{let a=o(t.args.length-1)??"",s=t.args.length===2?n.nearOf(O(r(0),e,n),a):n.nearOf(e,a),m=b(s?n.plural(s):V(a).toLowerCase());return t.args.length===2?[m,f("of"),...l(0)]:[m]}case"all":{let a=o(0),s=t.args[1]?.t==="lit"?t.args[1].value:void 0,m=s===!0?[f("archived")]:s==="all"?[f("archived or not")]:[];return s===!0?[...m,b(a?n.plural(a):"everything")]:[b(a?n.plural(a):"everything"),...m]}case"fact":{let a=o(0);return[b(a?n.factName(a):"fact")]}case"count":return[f("number of"),...l(0)];case"exists":return[...l(0),v("\u2260","is not"),W];case"present":return[...c(r(0),e,n),v("\u2260","is not"),W];case"some":case"every":{let a=O(r(0),e,n),s=r(1);return[...t.fn==="some"?[f("some")]:[],...l(0),f(t.fn==="some"?"with":"all with"),...A(s)<=2?[R,...c(s,a,n),w]:c(s,a,n)]}case"sum":case"min":case"max":{let a=O(r(0),e,n),s=r(1),m=s.t==="lit"&&typeof s.value=="string"?[b(n.fieldName(a,s.value))]:A(s)<9?[R,...c(s,a,n),w]:c(s,a,n);return[f(t.fn==="sum"?"total":t.fn==="min"?"least":"most"),...m,f("of"),...l(0)]}case"first":{let a=r(0);if(x(a,"all")){let s=a.args[0]?.value;if(typeof s=="string")return[b(`the ${n.noun(s)}`)]}return[f("first of"),...l(0)]}case"sort":return[...l(0),f("by"),...c(r(1),O(r(0),e,n),n)];case"len":return[f("length of"),...c(r(0),e,n)];case"lower":return c(r(0),e,n);case"round":return[...c(r(0),e,n),f(t.args.length===2&&K(r(1))?`rounded to ${String(r(1).value)} places`:"rounded")];case"contains":case"startsWith":return[...c(r(0),e,n),f(t.fn==="contains"?"contains":"starts with"),...N(r(1),e,n,E(r(0),e,n))];case"today":return[P("today")];case"now":return[P("now")];case"date":return K(r(0))&&typeof r(0).value=="string"?[P(q(String(r(0).value),n.locale))]:c(r(0),e,n);case"days":case"hours":{let a=t.fn,[s,m]=[r(0),r(1)];return x(m,"today")||x(m,"now")?[f(`${a} since`),...c(s,e,n)]:x(s,"today")||x(s,"now")?[f(`${a} until`),...c(m,e,n)]:[f(`${a} from`),...c(s,e,n),f("to"),...c(m,e,n)]}case"if":return[R,...c(r(1),e,n),f("if"),...c(r(0),e,n),f(","),f("else"),...c(r(2),e,n),w];case"either":return t.args.flatMap((a,s)=>s===0?c(a,e,n):[f(","),f("else"),...c(a,e,n)]);default:return[f(t.fn),R,...t.args.flatMap((a,s)=>s===0?c(a,e,n):[f(","),...c(a,e,n)]),w]}}function H(t){let e=n=>b(V(n).toLowerCase());return[f("through"),e(t.through.relation),...t.via?[f(","),f("then"),e(t.via.relation)]:[]]}function Z(t,e){let n=vt(e),r=t.over==="graph"?null:t.over,o=t.covers?[f("reaches every"),b(n.noun(t.covers.every)),...H(t.covers)]:c(t.require,r,n);return G({...r===null?{}:{kind:r},parts:o,...t.when?{when:c(t.when,r,n)}:{}})}function Y(t,e,n,r){let o=vt(e),l=t.over==="graph"?null:t.over,a=n.subject;if(t.covers)return G({...l===null?{}:{kind:l},parts:r?[f("does not reach"),o.valueWords(r),...H(t.covers)]:[f("does not reach every"),b(o.noun(t.covers.every)),...H(t.covers)],...a?{record:F(e.schema.tryDefinition(a.kind),a)}:{}});let s=u=>{try{return J(u,{...n,budget:2e3})}catch{return}},m=(u,p)=>{let h=N(u,l,o,p);if(u.t==="lit"||u.t==="list"||x(u,"today")||x(u,"now")||x(u,"date"))return h;let i=s(u);if(i===void 0)return h;let d=E(u,l,o),y=o.valueWords(i,d?{...d,format:o.formatOf(d.kind,d.key)??(p?o.formatOf(p.kind,p.key):void 0)}:p);return i instanceof C?[...h,f(":"),y]:[...h,y]},g=u=>{if(u.t==="binary"&&u.op==="&&"){let p=[];p.push(...I(u,"&&"));let h=p.filter(i=>s(i)!==!0);return(h.length>0?h:p).flatMap((i,d)=>[...d>0?[f("and")]:[],...A(i)<=2?[R,...g(i),w]:g(i)])}if(u.t==="binary"&&u.op==="||"){let p=U(u);if(p){let i=E(p.subject,l,o);return[...m(p.subject),v("\u2209","is not one of"),o.valueWords(p.values.map(d=>d.value),i)]}let h=[];return h.push(...I(u,"||")),h.flatMap((i,d)=>[...d>0?[f("and")]:[],...A(i)<=2?[R,...g(i),w]:g(i)])}if(u.t==="binary"&&u.op in M){if(K(u.right)&&typeof u.right.value=="boolean"&&(u.op==="=="||u.op==="!="))return u.op==="=="===u.right.value?_(u.left,l,o):c(u.left,l,o);let p=B[u.op],[h,i]=M[p],d=E(u.left,l,o),y=E(u.right,l,o);if(K(u.right)&&u.right.value===null)return[...p==="=="?N(u.left,l,o,y):m(u.left,y),v(h,i),W];let j=p==="=="&&(K(u.right)||K(u.left));return[...j?N(u.left,l,o,y):m(u.left,y),v(h,i),...j?N(u.right,l,o,d):m(u.right,d)]}if(u.t==="binary"&&u.op==="in")return[...m(u.left),v("\u2209","is not one of"),...N(u.right,l,o,E(u.left,l,o))];if(u.t==="unary"&&u.op==="!"){let p=u.operand;return bt(p)?g({...p,op:B[p.op]}):x(p,"present")||x(p,"exists")?[...m(p.args[0]),v("\u2260","is not"),W]:p.t==="ident"?c(p,l,o):[f("not"),R,..._(p,l,o),w]}if(x(u,"present")||x(u,"exists"))return[...c(u.args[0],l,o),v("=","is"),W];if(x(u,"some"))return[...c(u,l,o).slice(1),v("=","is"),W];if(x(u,"every")&&u.args.length===2){let p=s(u.args[0]);if(p instanceof C){let h=p.nodes.filter(i=>{try{return J(u.args[1],{...n,subject:i,budget:2e3})!==!0}catch{return!0}});return[...c(u,l,o),f(","),f("not"),o.valueWords(new C(h))]}}return u.t==="ident"?[f("not"),b(o.fieldName(l,u.name))]:[f("not"),R,...c(u,l,o),w]},S;try{S=g(t.require)}catch{S=[f("not"),R,...c(t.require,l,o),w]}return G({...l===null?{}:{kind:l},parts:S,...a?{record:F(e.schema.tryDefinition(a.kind),a)}:{}})}function wt(t){let e=new Map;for(let n of t??[])n.expr?.t==="ident"&&n.format&&(n.format==="money"||n.format==="percent"||n.format==="date")&&e.set(n.expr.name,n.format);return e}function Nt(t){return(e,n)=>{let r=t[e]?.fields?.[n],o=r?.format??(r?.type==="date"?"date":void 0);return o||r?.unit?{...o?{format:o}:{},...r?.unit?{unit:r.unit}:{}}:void 0}}function Et(t,e){return{schema:e,said:wt(t.says),...t.declared?{formatOf:Nt(t.declared)}:{},...t.money?{money:t.money}:{}}}function Xt(t,e){return t.shape?Z(t.shape,Et(t.shape,e)):void 0}var Ot=new WeakMap;function Wt(t,e){let n=new Map(t.allInvariants().map(r=>[r.name,r]));return e.map(r=>{let o=Vt(r),l=n.get(o.invariant)?.shape;if(!l||o.status&&o.status!=="violated")return o;let a=o.subjectId?t.graph.getNode(o.subjectId):void 0;if(l.over!=="graph"&&!a)return o;let s=l.kinds;s||(s=Ot.get(t.schema),s||Ot.set(t.schema,s=mt(t.schema)));try{let m=t.today?.()??l.today?.()??tt(),g=l.covers?o.nodeIds.find(p=>p!==o.subjectId):void 0,S=g?t.graph.getNode(g):void 0,u=Y(l,Et(l,t.schema),{graph:t.graph,subject:a??null,kinds:s,today:m},S);return{...o,line:u,...l.says||l.covers?{}:{message:`${o.message} \u2014 ${u.text}`}}}catch{return o}})}function $t(){ft((t,e,n,r)=>Wt({graph:t,schema:t.schema,allInvariants:()=>e,today:()=>r},n)),yt(Kt)}function Kt(t,e,n,r){let o=e.graph,l=ut.from(t.schema,o.snapshot(),{validate:!1});for(let g of n?[...r].reverse().map(lt):r)try{l.applyPrimitives([g],{restoring:!0})}catch{}let a=g=>t.violations(void 0,g),s=a(n?l:o),m=a(n?o:l);return{...dt(t.allInvariants(),s,m),violationsAfter:m}}function Vt(t){if(!t.line)return t;let{line:e,...n}=t,r=` \u2014 ${e.text}`;return n.message.endsWith(r)?{...n,message:n.message.slice(0,-r.length)}:n}$t();export{Y as brokenLineOf,$t as judgeWithLines,Kt as judgedForASeat,jt as problemWords,Xt as ruleLine,Z as ruleLineOf,gt as ruleLineWords,z as ruleSpacing,Lt as ruleSpoken,Pt as ruleText,Vt as unlined,Wt as withLines};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk.EZF2T3XQ.js";import"./chunk.U5P23GO7.js";import"./chunk.6YKKZI4H.js";import"./chunk.GH6QX7JR.js";import"./chunk.J4D4BIB4.js";import"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{a as ActivityFilter,b as InteractionRow};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h}from"./chunk.
|
|
1
|
+
import{c as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h}from"./chunk.73RMM4W7.js";import"./chunk.KFYSKZC4.js";import"./chunk.M5FP4Y4Q.js";import"./chunk.O5P6LXHF.js";import"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{h as createLinks,g as judgeDestination,e as listsOf,c as nowhere,f as placeVocabulary,a as placesSaid,b as quoted,d as whereOfWords};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as V}from"./chunk.
|
|
1
|
+
import{a as V}from"./chunk.Q6WOIE5I.js";import"./chunk.DCIYOZYP.js";import"./chunk.XOZU4OFA.js";import{f as C,g as x,h as R}from"./chunk.53GQQETN.js";import{a as D}from"./chunk.JE4RBRKH.js";import{a as T,b as A,c as M}from"./chunk.65SI77M7.js";import"./chunk.T3RFZ66S.js";import"./chunk.TDWJU6GW.js";import"./chunk.P3Z4ZCL3.js";import"./chunk.45OLF6BK.js";import"./chunk.T6ISUVUP.js";import{a as F,c as $}from"./chunk.J4D4BIB4.js";import{G as k,O as E,X as H,_ as g}from"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import{b as l}from"./chunk.AJZBJBMO.js";var m=l(k());var n=l(g()),B={maxWidth:560,margin:"0 auto",padding:"40px 20px 64px",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:16};function G({app:r,store:e,form:o,principal:i,heading:f=1,onSubmitted:a}){let t=(0,m.useMemo)(()=>C(r,o,e.allMutations()),[r,o,e]),d=H(e),v=(0,m.useMemo)(()=>d?e.seenBy(i):e,[d,e,i]),[p,b]=(0,m.useState)(!1),u=(0,m.useRef)(null);(0,m.useEffect)(()=>{p&&u.current?.focus()},[p]);let y=`h${f}`;if(!d)return null;if(!t)return(0,n.jsx)("main",{"data-graview-visitor-form":o,style:B,children:(0,n.jsx)("p",{role:"alert",children:"There is no form here."})});let S=R(t);return(0,n.jsxs)("main",{"data-graview-visitor-form":o,"aria-labelledby":"graview-visitor-form-title",style:B,children:[(0,n.jsx)(y,{id:"graview-visitor-form-title",style:{margin:0,fontSize:"var(--graview-text-title)"},children:t.title}),p?(0,n.jsxs)("div",{ref:u,role:"status",tabIndex:-1,"data-graview-part":"received",style:{display:"grid",gap:8,outline:"none"},children:[(0,n.jsx)("p",{style:{margin:0,fontWeight:600},children:S.said}),S.next?(0,n.jsx)("p",{style:{margin:0},children:S.next}):null]}):(0,n.jsxs)(n.Fragment,{children:[t.intro?(0,n.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:t.intro}):null,(0,n.jsx)(V,{store:v,mutation:t.act,principal:i,only:t.fields.map(h=>h.name),label:t.submit,onDone:()=>{b(!0),a?.(o)}})]})]})}var s=l(k()),P=l($()),O=l(D());var c=l(g());function L(r){let{app:e,form:o,principal:i,scheme:f="auto",brand:a=e.brand,fonts:t=!0,height:d}=r,v=(0,s.useMemo)(()=>typeof i!="string"?i:e.forms?.[o]?x(e,o,i):{kind:"human",id:i,roles:[]},[e,o,i]),p=(0,s.useMemo)(()=>r.store??r.remote?.store??A(e,r.seed),[r.store,r.remote,e,r.seed]),b=M(f==="auto",a?.scheme),u=f==="auto"?b:f,y=`graview-form-${(0,s.useId)().replace(/[^a-zA-Z0-9_-]/g,"")}`,S=(0,s.useMemo)(()=>F(u,a,{scope:`.${y}`}),[u,a,y]);return(0,s.useEffect)(()=>{if(!t||typeof document>"u")return;let h=T(a);if(!h||document.querySelector(`link[href="${h}"]`))return;let w=document.createElement("link");w.rel="stylesheet",w.href=h,document.head.appendChild(w)},[a,t]),(0,c.jsxs)("section",{className:y,"aria-label":r.label??e.forms?.[o]?.title??e.name,"data-graview-embed":"form","data-graview-scheme":u,style:{position:"relative",isolation:"isolate",...d===void 0?{}:{minHeight:d},background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)"},children:[(0,c.jsx)("style",{children:S}),(0,c.jsx)(E.Provider,{value:r.assetsAt,children:(0,c.jsx)(G,{app:e,store:p,form:o,principal:v,heading:r.heading??1,...r.onSubmitted?{onSubmitted:r.onSubmitted}:{}})})]})}function U(r,e){e.app.forms?.[e.form]||x(e.app,e.form,"form:");let o=e.store??e.remote?.store??A(e.app,e.seed),i=null;function f(){let[t,d]=(0,s.useState)(e.scheme??"auto");return i=d,(0,c.jsx)(L,{...e,store:o,scheme:t})}let a=(0,O.createRoot)(r);return(0,P.flushSync)(()=>a.render((0,c.jsx)(f,{}))),{store:o,setScheme:t=>(0,P.flushSync)(()=>i?.(t)),unmount:()=>a.unmount()}}export{L as FormEmbed,U as mount};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as I,c as x}from"./chunk.
|
|
1
|
+
import{a as I,c as x}from"./chunk.XBWFQ54R.js";import"./chunk.GH6QX7JR.js";import"./chunk.J4D4BIB4.js";import{b,c as A,j as v,q as w,s as O,v as G}from"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import{Be as S,Ce as W,de as k,ue as E}from"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var F=(e,i)=>k(e,i).slice(1);function j(e,i){let l=e.split("/").filter(Boolean);return l.length===i.length&&l.every((s,h)=>s.startsWith(":")||s==="*"||s===i[h])}var $=["problems","search","map","places"];function R(e,i,l,s,h=[]){let{schema:r}=i,o=r.kinds,f=t=>{if(t.startsWith(w))return(t.slice(w.length).split("|")[0]??"").split("+").every(V=>o.includes(V));let y=O(t);return y!==null?o.includes(y):t.startsWith("edge:")||l.graph.getNode(t)!==void 0},[p="/",u]=e.path.split("?"),n=p.split("/").filter(Boolean),m=u?`?${u}`:"",d=n.length>0&&!$.includes(n[0])?o.find(t=>F(r,t)===n[0]):void 0,c=e.path;if(n[0]==="places"&&n.length===2)`/places/${n[1]}`!==E&&!s.some(t=>t.as===decodeURIComponent(n[1]))&&(c="/");else if(d){let t=n[1]===void 0?void 0:decodeURIComponent(n[1]);c=`/${F(r,d)}${t!==void 0&&l.graph.getNode(t)?.kind===d?`/${n[1]}`:""}${m}`}else n.length>0&&n.length<=2&&!$.includes(n[0])&&!h.some(t=>j(t.path,n))&&(c="/");let g=A(e.stop),P=g.within?.view,U=P!==void 0&&!s.some(t=>t.as===P),a=g;if(U){let{view:t,...y}=g.within??{};a={...a,within:y}}if(g.focusId&&!f(g.focusId)){let t=e.kind&&o.includes(e.kind)?G(e.kind):null;a={...v(a,t),zoom:!1}}return a={...a,relation:a.relation&&(o.includes(a.relation)||r.edgeKinds.includes(a.relation))?a.relation:null,expanded:a.expanded.filter(f),pins:Object.fromEntries(Object.entries(a.pins).filter(([t])=>f(t))),...a.selection?{selection:a.selection.filter(f)}:{}},{face:e.face,path:c,stop:b(a),...e.kind?{kind:e.kind}:{}}}function B(e,i,l){let s=e.at,h=e.pages?.routes()??[];if(e.routing!=="address"||typeof window>"u")return R(s,e.app,i,l,h);let{pathname:r,search:o,hash:f}=window.location,p=W(r,e.basePath),u=I({routing:"address",...e.basePath===void 0?{}:{basePath:e.basePath},face:s.face}),n=u==="pages",m={...s,face:u,...p===null?{}:n?{path:p+o}:{stop:x(e.basePath)??s.stop}},d=R(m,e.app,i,l,h),c=n?d.path===m.path?null:S(d.path,e.basePath===void 0?{}:{basePath:e.basePath}):d.stop===b(A(m.stop))?null:r+o+d.stop;return p!==null&&c!==null&&c!==r+o+f&&window.history.replaceState(window.history.state,"",c),d}export{R as settle,B as settleAt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as m}from"./chunk.
|
|
1
|
+
import{c as m}from"./chunk.QMGBAKX6.js";import{ha as c,ma as u,na as p,pa as f,ua as h,va as l}from"./chunk.ZDUKVXBI.js";function M(t,e){let n=t.schema.kinds,r="kind"in e?e.kind:void 0;if(r!==void 0&&!n.includes(r))return`There is no kind "${r}" in this app. Its kinds are: ${n.join(", ")}.`;if(e.on==="act"&&e.act!==void 0&&t.allMutations&&!t.allMutations().some(i=>i.name===e.act))return`There is no act "${e.act}" in this app.`;let o="record"in e?e.record:void 0;if(o!==void 0&&t.graph&&!t.graph.getNode(o))return`No record "${o}" is here to be told about.`;if(o!==void 0&&r!==void 0&&t.graph&&t.graph.getNode(o)?.kind!==r)return`\u201C${o}\u201D is not ${h(r)}.`;if(e.on==="changed"&&e.kind===void 0&&e.record===void 0)return"Say which kind, or which record, to be told about.";if(e.on==="reaches"){if(e.condition.trim()==="")return"Say what it should reach: a condition like done == true.";try{m(e.condition)}catch(i){return`The condition does not read: ${i instanceof Error?i.message:String(i)}.`}}}function d(t,e){let n=t.graph?.getNode(e);return n?u(t.schema.tryDefinition(n.kind),n):e}function g(t,e){let n=t.allMutations?.().find(r=>r.name===e);return n?p(n):c(e)}function v(t,e){let{when:n}=e,r=e.alsoMine?"anyone":"someone else",o=s=>l(t.schema.tryDefinition(s),s),i=s=>{let a=o(s);return`${/^[aeiou]/i.test(a)?"an":"a"} ${a}`};switch(n.on){case"act":{let s=n.act!==void 0?`\u201C${g(t,n.act)}\u201D`:"an act";return`When ${r} runs ${s}${n.record!==void 0?` on \u201C${d(t,n.record)}\u201D`:""}`}case"created":return`When ${r} adds ${i(n.kind)}`;case"changed":return n.record!==void 0?`When ${r} changes \u201C${d(t,n.record)}\u201D`:`When ${r} changes any of the ${f(t.schema,n.kind)}`;case"reaches":return`When ${n.record!==void 0?`\u201C${d(t,n.record)}\u201D`:i(n.kind)} reaches ${n.condition}${e.alsoMine?"":" (by someone else)"}`}}export{M as a,v as b};
|
|
@@ -1,4 +1,4 @@
|
|
|
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)}};var t,i=()=>t??=(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.
|
|
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)}};var t,i=()=>t??=(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.GAVEWSXU.js")).catch(e=>{throw t=void 0,e});async function s(e){let{VIEW_RUNTIME:r}=await i();return`${r}
|
|
2
2
|
;(function () {
|
|
3
3
|
"use strict";
|
|
4
4
|
${e}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as L}from"./chunk.
|
|
1
|
+
import{b as L}from"./chunk.PGT4ZQDG.js";import{c as P}from"./chunk.4VX7GPFS.js";import{G as De,_ as U}from"./chunk.ASNVH2G4.js";import{zd as B}from"./chunk.ZDUKVXBI.js";import{b as C}from"./chunk.AJZBJBMO.js";var Q=e=>e===void 0||e.off?void 0:e.fast??(e.decide?{model:e.name??"decide",decide:e.decide}:void 0),Te=/\b(look|looks|looking|nicer|prettier|cleaner|ugly|layout|laid out|lay it out|design|style|styled|theme|colou?rs?|font|bigger|smaller|larger|wider|narrower|taller|shorter|spacing|space|padding|margin|compact|dense|denser|roomier|columns?|grid|cards?|rows?|show (?:the )?\S+ (?:on|in) (?:each|every|the)|sort(?:ed)? by|order(?:ed)? by|group(?:ed)? by|readable|easier to read|at a glance|icons?|badges?|headings?|bold|highlight)\b/i;async function Ae(e,t,r){let n=t.trim(),a=Q(e);if(a&&n)try{let o=await a.decide({typed:n,on:r},{about:{type:"choice",instructions:`Somebody right-clicked \u201C${r}\u201D in an app and typed \u201C${n}\u201D. Is it about how \u201C${r}\u201D looks or is laid out, or about the records in it?`,criteria:{look:"How it looks or is laid out: making it look better, its style, size or spacing, what each row, card or page shows, its order or grouping",records:"The records themselves: changing, closing, assigning, adding, deleting or moving them, or a question about them"}}});e?.meter?.({tier:"fast",model:a.model,inputTokens:o.usage.inputTokens,outputTokens:o.usage.outputTokens,interaction:"menu"});let s=o.answers.about;if(s?.type==="choice"&&(s.choice==="look"||s.choice==="records"))return{about:s.choice,by:"fast",confidence:s.confidence}}catch{}return{about:Te.test(n)?"look":"records",by:"words"}}var Pe=/\b(colou?rs?|font|typeface|bigger|smaller|larger|wider|narrower|taller|spacing|padding|margin|border|shadow|rounded|corners?|columns? side by side|side by side|grid|chart|graph|picture of|animation|background|gradient|icons?|css|kanban|calendar)\b/i,X=.6;async function Oe(e,t,r){let n=t.trim();if(!n)return{can:!0,by:"words"};let a=Q(e);if(a)try{let o=await a.decide({asked:n,on:r.name,page:r.slot},{can:{type:"choice",instructions:`Somebody asked of the page \u201C${r.name}\u201D: \u201C${n}\u201D. Can the app's view settings do it, or does it need drawing of its own?`,criteria:{spec:"The view settings can do it: which fields a card, a row or a page shows and in what order, a headline, a badge with a tone, a figure, a progress bar, a list of related records, how a list is sorted, grouped or filtered, a field's label or format",drawing:"It needs drawing the settings have no word for: colors, fonts, sizes, spacing, borders or shadows, a layout or columns side by side, a chart, a calendar, a board, or markup and styles of its own"}}});e?.meter?.({tier:"fast",model:a.model,inputTokens:o.usage.inputTokens,outputTokens:o.usage.outputTokens,interaction:"section"});let s=o.answers.can;if(s?.type==="choice"&&(s.choice==="spec"||s.choice==="drawing"))return{can:s.choice==="spec"||s.confidence<X,by:"fast",confidence:s.confidence}}catch{}return{can:!Pe.test(n),by:"words"}}var ee=["set-view","set-glance","set-page-fields","arrange-pages","set-label","set-format"],Ee=new Set(["sort","group","filters"]);function te(e){let t=[];e.length===0&&t.push("It changed nothing.");for(let r of e){let n=r?.op;if(typeof n!="string"||!ee.includes(n)){t.push(`\u201C${String(n)}\u201D is not a change to how a page reads.`);continue}if(n==="arrange-pages")for(let a of Object.keys(r))a!=="op"&&!Ee.has(a)&&t.push(`arrange-pages may say only sort, group and filters here, not \u201C${a}\u201D.`);n==="set-label"&&r.field===void 0&&t.push("set-label may name only a field's label here, not a kind's.")}return t}var ne=["You change how one page of a Graview app reads, by editing its view spec: data that says what a kind's card, row and page show, and how a list opens. Nothing in it is code: no CSS, no markup, no colors or sizes of your own.","You are told the page (a kind's list, one group of it, a record's page, or the home), what was asked, the kind's fields and relations, and its spec as it stands.",'Answer with one JSON object and nothing else: {"edits": [...], "said": "<one sentence to the person saying what will change>"}. Or, where the spec has no word for it (colors, fonts, sizes, spacing, layout, a chart), answer {"cannot": "<one sentence saying what it would need>"}.',"The edits you may use, and no others:",`{"op":"set-view","kind":K,"slot":"card"|"row"|"page","blocks":[...]} \u2014 a kind's card, its row on a list, the blocks over its record page; {"op":"set-view","slot":"home","blocks":[...]} \u2014 the home. Blocks: {"title":"{name}"}, {"headline":"{count(out('rel'))} things"}, {"text":"{field}","lines":2}, {"badge":"{field}","tone":"good"|"warn"|"bad"|"neutral"|"accent"}, {"field":"due","as":"date"|"time"|"datetime"|"relative"|"money"|"percent"|"count","label":"Due"}, {"figure":"expr","as":"number"|"money"|"percent","label":"..."}, {"progress":{"value":"done","max":"total"},"label":"..."}, {"list":"out('rel')" or "all('kind')","as":"row"|"card","sort":{"by":"f","direction":"asc"|"desc"},"limit":5,"group":{"by":"f"},"empty":"None yet."}, {"group":[...blocks],"direction":"row"|"column"}, {"when":"rule expression","show":[...blocks]}, {"divider":true}. Templates say {field}; a row always leads with {"title":"{name}"} or the record's label field.`,`{"op":"set-glance","kind":K,"fields":[...]} \u2014 the few facts said beside a record's name on a list.`,`{"op":"set-page-fields","kind":K,"fields":[...],"groups":[{"title":"...","fields":[...]}]} \u2014 the order and groups of a record page's facts.`,`{"op":"arrange-pages","sort":{K:{"by":"f","direction":"asc"|"desc"}},"group":{K:{"by":"f"}},"filters":{K:["f"]}} \u2014 how a kind's list opens. A list sorts by one of its kind's fields or computed values, and groups only by a choice or a yes-or-no field of its own: grouping by a relation or by the record that holds it is not the spec's to say.`,'{"op":"set-label","kind":K,"field":F,"label":"..."}, {"op":"set-format","kind":K,"field":F,"format":"money"|"percent"|"duration"|null}.',"Name only fields and relations the kind has. Change only what the ask needs, on this page's kind. Keep every fact the page shows now unless asked to drop one.","Do what was asked or answer cannot: never something else in its place (grouping by another field than the one asked for, say)."].join(`
|
|
2
2
|
`);function O(e){let t=e.part.kind,r=e.document,n=t?r.kinds[t]:void 0,a=e.mode==="just"?"Make this page better: easier to read at a glance, the facts a person needs first. Change no data.":(e.words??"").trim();return JSON.stringify({page:{name:e.part.name,is:e.part.slot==="list"?"a kind's list":e.part.slot==="group"?`one group of a kind's list (\u201C${e.part.group}\u201D)`:e.part.slot==="record"?"a record's page (every record of the kind)":e.part.slot==="home"?"the home":"a place",...t?{kind:t}:{}},asked:a,...e.highlighted?.length?{pointed_at:e.highlighted}:{},...n?{fields:n.fields,relations:n.edges??n.relations,computed:n.computed,glance:n.glance,pageFields:n.pageFields}:{kinds:Object.keys(r.kinds)},now:{...t?{views:r.views?.[t]??null,list:r.pages?.lists?.[t]??null}:{home:r.views?.home??null}},...e.shows?{shows:e.shows.slice(0,1500)}:{},...e.findings?.length?{your_last_answer:e.last,what_broke:e.findings,repair:"Your last answer was refused as said in what_broke. Answer again, fixing each one \u2014 or, where the spec cannot do what was asked, answer cannot."}:{}})}function re(e){let t=/```(?:json|js|javascript)?\s*([\s\S]*?)```/.exec(e)?.[1];for(let r of t?[t,e]:[e]){let n=r.indexOf("{"),a=r.lastIndexOf("}");if(!(n<0||a<=n))try{let o=JSON.parse(r.slice(n,a+1));if(o&&typeof o=="object"&&!Array.isArray(o))return o}catch{}}}function se(e){let t=re(e);if(t){if(typeof t.cannot=="string"&&t.cannot.trim())return{cannot:t.cannot.trim()};if(Array.isArray(t.edits))return{edits:t.edits,said:typeof t.said=="string"&&t.said.trim()?t.said.trim():"Changed how this page reads."}}}function je(e){return async(t,r,n,a)=>{let o=Date.now();try{let s=await t.think({system:n,prompt:a,state:{},catalog:{candidates:[]}});return e.push({stage:r,model:t.model,ms:Date.now()-o,...s.usage?{usage:s.usage}:{}}),s.text}catch{e.push({stage:r,model:t.model,ms:Date.now()-o});return}}}async function Ne(e){let t=[],r=e.ai.off?void 0:e.ai.light,n=P(e.ai),a=r??n;if(!a)return{ok:!1,refused:e.ai.withoutModel??"Changing a page needs AI, and none is on here.",stages:t};let o=je(t),s={part:e.part,document:e.document,mode:e.mode,...e.words?{words:e.words}:{},...e.highlighted?{highlighted:e.highlighted}:{},...e.shows?{shows:e.shows}:{}},i=async(u,k,S)=>{let f=await o(u,k,ne,S);return f===void 0?void 0:se(f)},c=await i(a,r?"light":"thinking",O(s));if(!c&&r&&(c=await i(r,"light",O(s))),!c)return{ok:!1,refused:"The model did not answer with a change to this page.",stages:t};if("cannot"in c)return{ok:!1,cannot:c.cannot,refused:c.cannot,stages:t};let l=async u=>{let k=te(u);return k.length>0?k:[...await e.judge(u)]},g=await l(c.edits);if(g.length===0)return{ok:!0,edits:c.edits,said:c.said,repaired:!1,stages:t};let m=a;e.repairing?.(g);let y=await i(m,m===r?"light":"thinking",O({...s,findings:g,last:c}));return y&&"cannot"in y?{ok:!1,cannot:y.cannot,refused:y.cannot,stages:t}:y?(g=await l(y.edits),g.length>0?{ok:!1,refused:`It could not be changed so: ${g.join(" ")}`,stages:t}:{ok:!0,edits:y.edits,said:y.said,repaired:!0,stages:t}):{ok:!1,refused:`It could not be changed so: ${g.join(" ")}`,stages:t}}var Z=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,40)||"page";function Ie(e,t,r=[]){let n={...t.kinds.length?{kinds:[...t.kinds]}:{},...t.edges.length?{edges:[...t.edges]}:{}},a={...Object.keys(n).length>0?{reads:n}:{},...r.length>0?{acts:[...r]}:{}};if((e.slot==="list"||e.slot==="group")&&e.kind)return{name:`${Z(e.kind)}-list`,attach:e.kind,cardinality:"many",replaces:"page",...a};if(e.slot==="record"&&e.kind)return{name:`${Z(e.kind)}-page`,attach:e.kind,cardinality:"one",replaces:"page",...a};if(e.slot==="home")return{name:"home-page",attach:"home",cardinality:"many",...a}}var K=["You write a Graview worker view: one plain script, no imports and no build, that draws one page of an app through the global `graview`, in place of the page the app drew by itself.","The global: graview.style(css) a stylesheet; graview.onProps((props) => \u2026) on every push of what it is shown; graview.render(graview.html`\u2026`) draws markup, every ${value} escaped; graview.html`` nests: a list is ${items.map((one) => graview.html`<li>\u2026</li>`)}. Never build HTML as a string or with join(): a string is drawn as its words.","props.nodes holds the records a view of many is drawn for and those it reads; props.node the record a view of one is drawn for. A record is plain data: id, kind, label, and each field by name. props.edges are {kind, from, to}. props.choices[kind][field][option] is a choice's label.",'Link to a record with <a data-record="${node.id}">\u2026</a>. Give repeated rows data-key="${node.id}". Name each part a person would name with a heading inside a <section aria-labelledby="x-h"> whose heading has id="x-h"; never aria-label.',"The page draws its own title above your view: never draw the page's title again. Draw each other heading the page had, with the same words, and every record the page showed: each record still says what its row said (its status, its dates, its counts, in words) and stays under the heading it was under, unless what was asked changes that.",'Say things in words a person reads: a date as the page said it (\u201CSep 3\u201D), never as stored (2026-09-03). A date kept as YYYY-MM-DD is a day, not an instant: read it as new Date(`${value}T00:00`) \u2014 new Date(value) alone is midnight in London and the day before here \u2014 then .toLocaleDateString(props.locale, { month: "short", day: "numeric" }); never show a field\'s own name (order, done, holds), an id, true, false, null or undefined. Leave out a value the page did not show unless asked for it.',`CSS the host keeps: plain rules on your own classes and elements, one level, and @media. Give your outer element a class (class="pg") and style that: never :host, ::slotted or ::part, no url(), @import, @font-face, @keyframes or nesting. Colors, type and corners only through var(--graview-ink), var(--graview-ink-muted), var(--graview-panel), var(--graview-edge), var(--graview-accent), var(--graview-ground), var(--graview-radius). position may be static, relative, absolute or sticky. Set no height; lay it out well at a phone's width and at a desk's.`,"Never write the words import, export or require, nor <script>, <style>, or on\u2026= attributes.",'Answer with one JSON object and nothing else: {"source": "<the whole script>", "said": "<a few words on what you changed>"}.'].join(`
|
|
3
3
|
`);function G(e){return e.records.map(t=>{let r=e.says?.[t];return{record:t,...r?.id?{id:r.id}:{},...r?.shows?.length?{must_show:r.shows}:{},...r?.under?{under:r.under}:{}}})}function F(e){let[t,r]=e.record==="from"?["from","to"]:["to","from"];return`Group the records as the page did: each record sits under a heading that is the label of the ${e.kind} it is linked to \u2014 find the edge in props.edges with kind "${e.edge}" whose ${t} is the record's id; the ${e.kind} is props.nodes' node whose id is the edge's ${r}. Draw the headings in keep_these_headings' order; never guess a record's group from its fields.`}function z(e){let t=re(e),r=t?.source,n=typeof r=="string"?r.trim().replace(/^```(?:js|javascript)?\s*/i,"").replace(/\s*```$/,"").replace(/^<script[^>]*>\s*/i,"").replace(/\s*<\/script>\s*$/i,""):void 0;if(!(typeof n!="string"||!/graview\.(render|onProps)/.test(n)))return{source:n,said:typeof t.said=="string"?t.said.trim():""}}var de=["look","read","edit","draft","done","ask"],ae=64e3,Me=e=>e.length>80?`${e.slice(0,79)}\u2026`:e;function le(e,t,r){let n=[],a=e;return t.forEach((o,s)=>{let i=`Edit ${s+1}: \u201C${Me(o.find)}\u201D`;if(!o.find)return void n.push(`${i} is no text to find: quote the text to change, exactly as it stands in ${r}.`);let c=0;for(let g=a.indexOf(o.find);g>=0&&c<2;g=a.indexOf(o.find,g+o.find.length))c+=1;if(c===0){let g=y=>y.replace(/\s+/g,""),m=g(o.find).length>0&&g(a).includes(g(o.find));return void n.push(`${i} is not in ${r}${m?" as written, but is there with other spacing":""}: quote it exactly as it stands there, spaces and quotes included.`)}if(c>1){let g=a.split(o.find).length-1;return void n.push(`${i} appears ${g} times in ${r}: quote more of the text around the place you mean, so it appears once.`)}let l=a.indexOf(o.find);a=`${a.slice(0,l)}${o.replace}${a.slice(l+o.find.length)}`}),n.length>0?{findings:n}:a===e?{findings:[`Your edits change nothing in ${r}: replace the text with something else, or say you are done.`]}:{source:a}}var ce=12,W=[K.split(`
|
|
4
4
|
`).filter(e=>!e.startsWith("Answer with one JSON object")).join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{G as A,
|
|
1
|
+
import{$a as M,G as A,Za as H,_ as F}from"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import{b as x}from"./chunk.AJZBJBMO.js";var t=x(A(),1),f=x(F(),1),q={faces:'[data-testid="app-menu-open"][data-scene]',problems:'[data-testid="standing"], [data-testid="standing-link"], [data-testid="inbox-button"]',activity:'[data-testid="inbox-button"]',ask:'[data-testid="app-find"], [data-testid="app-find-open"]',find:'[data-testid="app-find"], [data-testid="app-find-open"]',profile:'[data-testid="profile-button"]',home:'[data-testid="app-home"]'};function D(e){if(!e.isConnected||e.closest("[hidden], [inert], [aria-hidden='true']"))return!1;if(typeof e.checkVisibility!="function")return!0;if(!e.checkVisibility({visibilityProperty:!0}))return!1;let a=e.getBoundingClientRect();return a.width>1&&a.height>1}function E(e,a){if(!e||a==="ask"&&!e.querySelector("[data-graview-quick-ask]"))return null;for(let c of e.querySelectorAll(q[a]))if(D(c))return c;return null}function W(e){let a=(u,h,d)=>e.querySelector(u)?.getAttribute(h)?.trim()||d,c=a('[data-testid="app-menu-open"]',"data-scene","Scene"),n=a('[data-testid="app-menu-open"]',"data-pages","Pages");return[{anchor:"faces",title:`${c} or ${n}`,words:`One app, two ways to see it, in the app menu: ${c} draws every record as one picture, ${n} as lists and pages to read and change.`},{anchor:"problems",title:"Whether all is in order",words:"The dot is green while every rule holds. When one is broken the bell counts it, and says what is wrong and how to fix it."},{anchor:"activity",title:"Inbox",words:"What waits for you, what has happened here and who did it \u2014 each change with its way back \u2014 and what you asked."},{anchor:"ask",title:"Tell Graview",words:"Press \u2318K (Ctrl+K) to tell Graview what to do about what you have selected, or right-click it and type. The answer stands beside it, and a change it proposes waits for you to accept it."}]}var R=300,O=1200,$=15e3;function _({root:e,steps:a,onEnd:c}){let[n,u]=(0,t.useState)(null),h=(0,t.useRef)(null),d=(0,t.useRef)(!1),p=(0,t.useRef)(c);p.current=c,(0,t.useEffect)(()=>{let r=Date.now(),o=Date.now(),s=null,i,k=new MutationObserver(()=>o=Date.now());k.observe(document.body,{childList:!0,subtree:!0});let v=()=>{let L=e(),S=Date.now();if(L?.querySelector('[data-testid="app-bar"]')){if(s??=S,S-o>=R||S-s>=O){let T=[...W(L),...a].filter(C=>E(L,C.anchor)!==null);if(T.length===0){d.current=!0,p.current(null);return}h.current=document.activeElement,u({list:T,at:0});return}}else if(S-r>=$){d.current=!0,p.current(null);return}i=setTimeout(v,100)};return i=setTimeout(v,100),()=>{clearTimeout(i),k.disconnect()}},[]);let y=(0,t.useCallback)(()=>{let r=h.current;(r instanceof HTMLElement&&r!==document.body&&r.isConnected?r:e()?.querySelector('[data-testid="app-home"]'))?.focus({preventScroll:!0})},[e]),m=(0,t.useCallback)((r,o)=>{if(d.current)return;d.current=!0;let s=document.querySelector("[data-testid='first-look']"),i=document.activeElement,k=i===null||i===document.body||s!==null&&s.contains(i);u(null),p.current(r),!(!o&&!k)&&(y(),requestAnimationFrame(()=>{let v=document.activeElement;(v===null||v===document.body)&&y()}))},[y]),b=(0,t.useCallback)((r,o)=>{let s=e();for(let i=o;i<r.length;i++)if(E(s,r[i].anchor))return i;return-1},[e]),w=(0,t.useCallback)(()=>{if(!n)return;let r=b(n.list,n.at+1);r<0?m("finished",!0):u({list:n.list,at:r})},[n,b,m]);if((0,t.useEffect)(()=>{if(!n)return;let r=e();if(!r)return;let o=0,s=()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>{E(e(),n.list[n.at].anchor)||w()})},i=new MutationObserver(s);return i.observe(r,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["hidden","class"]}),()=>{cancelAnimationFrame(o),i.disconnect()}},[n,e,w]),!n)return null;let g=n.list[n.at],l=b(n.list,n.at+1)<0;return(0,f.jsx)(N,{root:e,step:g,position:n.at+1,total:n.list.length,last:l,onNext:w,onEnd:m},n.at)}var I={...H,width:"min(320px, calc(100vw - 24px))",maxHeight:"min(70vh, 420px)",overflow:"auto",padding:"12px 14px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)",fontSize:"0.875rem",lineHeight:1.45,overflowWrap:"anywhere"},P={minHeight:32,padding:"0 12px",borderRadius:8,font:"inherit",fontWeight:600,cursor:"pointer"};function N({root:e,step:a,position:c,total:n,last:u,onNext:h,onEnd:d}){let p=(0,t.useRef)(null),y=(0,t.useRef)(null),m=(0,t.useId)().replace(/:/g,""),b=(0,t.useMemo)(()=>({get current(){return E(e(),a.anchor)}}),[e,a.anchor]),[w]=(0,t.useState)(()=>{let l=b.current?.getBoundingClientRect(),r=typeof document>"u"?0:document.documentElement.clientWidth||innerWidth;return l&&l.left+l.width/2<r/2?"start":"end"});M(p,!0,b,{align:w}),(0,t.useLayoutEffect)(()=>{y.current?.focus({preventScroll:!0})},[]);let g=(0,t.useRef)(d);return g.current=d,(0,t.useEffect)(()=>{let l=o=>{o.target instanceof Node&&p.current?.contains(o.target)||g.current("dismissed",!1)},r=o=>{if(o.key!=="Escape"||o.defaultPrevented)return;let s=o.target;s instanceof Node&&p.current?.contains(s)||s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement||[...document.querySelectorAll("[data-graview-overlay]:not([hidden])")].some(i=>i!==p.current)||g.current("dismissed",!0)};return document.addEventListener("pointerdown",l,!0),document.addEventListener("keydown",r),()=>{document.removeEventListener("pointerdown",l,!0),document.removeEventListener("keydown",r)}},[]),(0,f.jsxs)("div",{ref:p,popover:"manual",role:"dialog","aria-modal":"false","aria-labelledby":`${m}-title`,"aria-describedby":`${m}-words`,tabIndex:-1,"data-testid":"first-look","data-first-look-anchor":a.anchor,"data-graview-overlay":"",onKeyDown:l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),d("dismissed",!0))},style:I,children:[(0,f.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},"data-testid":"first-look-count",children:[c," of ",n]}),(0,f.jsx)("p",{id:`${m}-title`,style:{margin:"2px 0 4px",fontWeight:600,fontSize:"0.9375rem"},"data-testid":"first-look-title",children:a.title}),(0,f.jsx)("p",{id:`${m}-words`,style:{margin:0},"data-testid":"first-look-words",children:a.words}),(0,f.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",justifyContent:"flex-end",gap:8,marginTop:12},children:[u?null:(0,f.jsx)("button",{type:"button","data-testid":"first-look-skip",onClick:()=>d("dismissed",!0),style:{...P,fontWeight:500,border:"1px solid transparent",background:"none",color:"var(--graview-ink-muted)"},children:"Skip"}),(0,f.jsx)("button",{ref:y,type:"button","data-testid":u?"first-look-done":"first-look-next",onClick:()=>u?d("finished",!0):h(),style:{...P,border:"1px solid var(--graview-accent)",background:"var(--graview-accent)",color:"var(--graview-accent-ink)"},children:u?"Done":"Next"})]})]})}export{_ as FirstLookHints,E as firstLookAnchor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$d as w,ae as $,ce as v,de as c,fe as k,ge as x,oe as f,qa as u,se as b,te as S,ue as P,ve as A,ye as L,ze as N}from"./chunk.
|
|
1
|
+
import{$d as w,ae as $,ce as v,de as c,fe as k,ge as x,oe as f,qa as u,se as b,te as S,ue as P,ve as A,ye as L,ze as N}from"./chunk.ZDUKVXBI.js";function H(s){if(!(s.attach==="home"||s.cardinality==="one"||!s.title))return{kind:s.attach,title:s.title,as:v(s.title),name:s.name,lens:"view",...s.hidden?{hidden:!0}:{}}}function G(s,r=[]){let a=[];for(let n of f(s).drawn)for(let i of n.kinds)a.push({kind:i,title:n.title,as:n.as,...n.across?{across:n.across}:{},...n.kinds.length>1?{over:n.kinds}:{},...n.hidden?{hidden:!0}:{}});for(let n of[...s.views?.places?.()??[],...r.flatMap(i=>H(i)??[])])a.some(i=>i.kind===n.kind&&i.as===n.as)||a.push(n);return a}function J(s,r={}){return V(s.schema,G(s,r.views),{...s.pages?{pages:s.pages}:{},lenses:f(s).drawn,home:(s.home?.length??0)>0})}function V(s,r,a={}){let{pages:n}=a,i=s.kinds,d=r.filter(e=>i.includes(e.kind)),o=N(n?.first,s,d),O=new Set(n?.hide??[]),p=L(i,n?.order,d),m=p.flatMap(e=>e.view?[]:[e.kind]),E=p.flatMap(e=>e.view?[e.view]:[]),l=[{slug:b,title:"Home",kind:null,cardinality:"many",address:"/",stop:"#",...o?.to==="home"||o===void 0&&a.home?{first:!0}:{}},{slug:S,title:A(n),kind:null,cardinality:"many",address:P,stop:"#"}],T=$([...d].sort((e,t)=>m.indexOf(e.kind)-m.indexOf(t.kind))),g=e=>{let t=a.lenses?.find(h=>h.as===e.as&&h.kinds.includes(e.kind)),y=x(e,d);return{slug:e.as,title:e.title,kind:e.kind,...e.over?{over:e.over.filter(h=>i.includes(h))}:{},cardinality:"many",address:k(e.as,y?c(s,e.kind).slice(1):void 0),stop:y?`#focus=aggregate:${e.kind}&in.view=${encodeURIComponent(e.as)}`:`#view=${encodeURIComponent(e.as)}`,...t?{lens:t.lens}:{},...e.name!==void 0?{view:e.name}:{},...e.hidden?{hidden:!0}:{},...o?.to==="place"&&o.place.as===e.as&&(o.place.kind===e.kind||e.over?.includes(o.place.kind))?{first:!0}:{}}};for(let e of T)E.some(t=>w(t,e))||l.push(g(e));for(let e of p){if(e.view){l.push(g(e.view));continue}let t=e.kind;l.push({slug:c(s,t).slice(1),title:u(s,t),kind:t,cardinality:"many",address:c(s,t),stop:`#focus=aggregate:${t}`,...O.has(t)?{hidden:!0}:{},...o?.to==="kind"&&o.kind===t?{first:!0}:{}})}return l}export{H as a,J as b,V as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as x}from"./chunk.
|
|
1
|
+
import{b as x}from"./chunk.L3ST2YKI.js";import"./chunk.7VCYVCYM.js";import"./chunk.DCIYOZYP.js";import"./chunk.WVUJXDXZ.js";import"./chunk.J7GH2CGV.js";import"./chunk.SMF5S4DQ.js";import"./chunk.XP4IVKKR.js";import"./chunk.R5YGW5ZX.js";import"./chunk.QMGBAKX6.js";import"./chunk.PS765ODQ.js";import"./chunk.MIE4TJRW.js";import{o as R}from"./chunk.DEBW4FH6.js";import"./chunk.RD2FSSLV.js";import"./chunk.OWHH7JDV.js";import"./chunk.T3RFZ66S.js";import"./chunk.TDWJU6GW.js";import"./chunk.P3Z4ZCL3.js";import"./chunk.45OLF6BK.js";import"./chunk.T6ISUVUP.js";import"./chunk.GH6QX7JR.js";import"./chunk.J4D4BIB4.js";import{G as A,_ as v,ja as g}from"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import{sa as y,xa as c,yd as k}from"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import{b as u}from"./chunk.AJZBJBMO.js";var f=u(A(),1);var L=u(A(),1),S=(0,L.createContext)(void 0);var i=u(v(),1),W=new WeakMap,m=new WeakMap,P=(e,n)=>`${n.kind}\0${n.id??""}\0${e}`;function b(e,n,a){let p=P(n,a),o=W.get(e);o||W.set(e,o=new Map);let t=o.get(p);return t||(t=Promise.resolve().then(()=>e(n,a)).then(r=>C(r)?r:null,()=>null).then(r=>{let s=m.get(e);return s||m.set(e,s=new Map),s.set(p,r),r}),o.set(p,t)),t}function C(e){if(e===null)return!0;if(typeof e!="object"||e===void 0)return!1;if(e.denied===!0)return!0;let n=e;return typeof n.name=="string"&&n.name.trim()!==""&&typeof n.href=="string"}function h(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}}var N=e=>h(e)??(c(e)?e:void 0),E=e=>h(e)??(e.startsWith("/")&&c(e)?e:void 0),I={kind:"human"},w={color:"var(--graview-ink-muted)"};function M({icon:e}){if(!e)return null;let n=E(e);if(n)return(0,i.jsx)("img",{src:n,alt:"",width:20,height:20,"data-graview-app-icon":"",style:{width:20,height:20,borderRadius:5,objectFit:"cover",flex:"0 0 auto"}});let a=[...e.trim()].slice(0,2).join("");return a?(0,i.jsx)("span",{"aria-hidden":"true","data-graview-app-icon":"",style:{flex:"0 0 auto",lineHeight:"20px"},children:a}):null}function V(e){let n=g(),a=(0,f.useContext)(S)??n?.resolveApp,p=n?.principal??I,o=()=>a?m.get(a)?.get(P(e,p))??"asking":null,[t,r]=(0,f.useState)(o);return(0,f.useEffect)(()=>{let s=o();if(r(s),s!=="asking"||!a)return;let l=!0;return b(a,e,p).then(d=>l&&r(d)),()=>{l=!1}},[a,e,p.kind,p.id]),t}function D({address:e,as:n="chip",nodeId:a,field:p,style:o}){let t=V(e),r={position:"relative",zIndex:k.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%",...o},s;if(t==="asking")s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"asking","aria-busy":"true",style:{...w,...r},children:"Linked app"});else if(t&&"denied"in t)s=(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"denied",style:{...w,fontStyle:"italic",...r},children:"linked app (no access)"});else if(t){let l=N(t.href),d=n==="record"?t.headline?.trim():void 0;s=(0,i.jsxs)(l?"a":"span",{"data-graview-app-link":"","data-graview-app-state":"found",...l?{href:l}:{},...!d&&t.headline?{title:t.headline}:{},style:{display:"inline-flex",alignItems:d?"flex-start":"center",minHeight:24,gap:8,color:"inherit",textUnderlineOffset:3,...r},children:[(0,i.jsx)(M,{icon:t.icon}),(0,i.jsxs)("span",{style:{display:"grid",minWidth:0},children:[(0,i.jsx)("span",{"data-graview-app-name":"",style:{fontWeight:600},children:t.name}),d?(0,i.jsx)("span",{"data-graview-app-headline":"",style:{...w,fontSize:"0.8125em",fontWeight:400},children:d}):null]})]})}else{let l=h(e);s=l?(0,i.jsx)("a",{"data-graview-app-link":"","data-graview-app-state":"plain",href:l,rel:"noopener noreferrer",target:"_blank",style:{color:"var(--graview-accent)",display:"inline-flex",alignItems:"center",minHeight:24,...r},children:e}):(0,i.jsx)("span",{"data-graview-app-link":"","data-graview-app-state":"plain",style:r,children:e})}return a&&p?(0,i.jsx)(H,{nodeId:a,field:p,address:e,drawn:s}):s}function H({nodeId:e,field:n,address:a,drawn:p}){let o=R(e).fields.some(s=>s.field===n),t=g()?.store;if(!o)return p;let r=y(t?t.schema.tryDefinition(String(t.graph.getNode(e)?.kind)):void 0,n).toLowerCase();return(0,i.jsxs)("span",{style:{display:"inline-flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px",maxWidth:"100%",minWidth:0},children:[p,(0,i.jsx)("span",{style:{fontSize:"0.8125rem"},children:(0,i.jsx)(x,{nodeId:e,field:n,value:"Change",stored:a,said:`Change the ${r}`})})]})}var Y=e=>(0,i.jsx)(D,{...e});export{D as AppLink,Y as drawAppLink};
|
|
@@ -1 +1 @@
|
|
|
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 L}from"./chunk.
|
|
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 L}from"./chunk.FQ2QUDZS.js";import"./chunk.BJUUSIQY.js";import"./chunk.SMF5S4DQ.js";import"./chunk.T6ISUVUP.js";import{Wd as I,pa as O,va as j}from"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var m=e=>e.charAt(0).toUpperCase()+e.slice(1),N=e=>/^(?:[aeio]|u(?![sn]i|se|ser))/i.test(e),q=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"one",D=(e,s)=>e===s?`step ${e}`:`steps ${e}\u2013${s}`;function G(e){let s=e.store.schema,t=Object.fromEntries(s.definitions.map(o=>[o.kind,{noun:j(o,o.kind),plural:O(s,o.kind),fields:Object.fromEntries(Object.keys(o.fields.shape??{}).map(c=>[c,{type:"string"}])),edges:o.edges??{}}]));return{name:e.app.name??"app",kinds:t,acts:{}}}function H(e){let s=(e.store.policy?.grants??[]).filter(o=>o.mutations==="*"&&!o.self&&o.roles!=="*").flatMap(o=>o.roles),t=[...new Set(s)];return t.length>0?`${N(t[0])?"an":"a"} ${t.join(" or ")}`:"whoever may change this app"}function K(e){let s=e.place?e.places.find(t=>t.as===e.place):void 0;return s?`in ${s.title}`:"here"}async function U(e,s){let{missing:t}=s;if(!t.need)return{refused:t.said};let o=await (__graviewPreload(import.meta.url,["./chunk.YGGBGHZU.js","./chunk.TBY5IR7C.js","./chunk.BIDL7GQD.js","./chunk.Q5WEOX3Q.js","./chunk.7DCBIMOI.js","./chunk.GXK5PI7I.js","./chunk.XP4IVKKR.js","./chunk.R5YGW5ZX.js","./chunk.QMGBAKX6.js","./chunk.PS765ODQ.js","./chunk.ZDUKVXBI.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KHVW6Q3T.js")),c=o.documentOfApp(e.app),k=c??G(e),a=L(k,t.need);if("refused"in a)return{refused:`${t.said} ${a.refused}`};let i=a.steps.map(n=>({part:"app",said:n})),b=i.length,C=n=>n.filter(r=>e.store.graph.getNode(r)?.kind===a.on),x=n=>[...e.store.graph.in(n),...e.store.graph.out(n)].filter(r=>r.kind===a.on).map(r=>r.id),f=C(s.members).length>0?C(s.members):[...new Set(s.members.flatMap(x))],p=[],y=f.length,w=n=>k.kinds[n]??void 0,P=n=>(w(n)?.plural??`${w(n)?.noun??n}s`).toLowerCase(),R=n=>(w(n)?.noun??n).toLowerCase(),S=s.where?`in ${s.where}`:K(e);if(y===0)return{refused:`${t.said} There is nothing here to do it to.`};let $=y===1?`the ${R(a.on)} ${S}`:`the ${y} ${P(a.on)} ${S}`,v=m(a.called);if(a.relation&&a.to){let n=t.who;if(!n)return{refused:`${t.said} Say whom to give them to.`};let r=a.made?m(a.edits[0].plural??"people"):m(P(a.to)),h=(a.made?void 0:e.store.graph.allNodes().find(d=>d.kind===a.to&&Object.values(d).some(l=>typeof l=="string"&&l.toLowerCase()===n.toLowerCase())))?.id;if(!h){h=`${a.to}-${q(n)}`;let d=a.makes??e.store.allMutations().find(l=>l.creates?.includes(a.to))?.name;if(!d){let l=e.store.graph.allNodes().filter(g=>g.kind===a.to).slice(0,3).map(g=>String(g.label??g.name??"")).filter(Boolean);return{refused:`${t.said} There is nobody called ${n} among the ${r.toLowerCase()} here${l.length>0?` (${l.join(", ")})`:""}, and no way to add one from here.`}}p.push({name:d,args:{name:n},mintedHint:h}),i.push({part:"record",said:`Add ${n} to ${r}.`})}for(let d of f)p.push({name:a.act,args:{id:d,[a.arg]:h}});let M=/^(\w+?)ed to$/i.exec(a.called)?.[1];i.push({part:"record",said:M?`${m(M.toLowerCase())} ${n} to ${$}.`:`Set \u201C${v}\u201D to ${n} on ${$}.`})}else if(a.field){let n=t.value;if(n===void 0)return{refused:`${t.said} Say what to set it to.`};for(let r of f)p.push({name:a.act,args:{id:r,[a.arg]:n}});i.push({part:"record",said:`Set \u201C${v}\u201D to ${n} on ${$}.`})}let A=i.length;if(!(!!c&&s.host&&s.compose!==void 0&&o.mayChangeDeclaration(e.store,e.principal))){let n=c?!s.host||!s.compose?"whoever hosts this app":H(e):"whoever develops this app";return{question:`${t.said} ${m(n)} would add ${D(1,b)}; then I can do ${D(b+1,A)}.`,parts:i,whoMay:n}}let E=s.compose({document:c,edits:a.edits});if(!E.ok)return{refused:`${t.said} That change could not be made here.`};let u=E.app;try{new I({schema:u.schema,mutations:u.mutations??[],invariants:u.invariants??[],...u.policy?{policy:u.policy}:{},snapshot:e.store.graph.snapshot()}).previewAll(p,{author:e.principal})}catch{return{refused:`${t.said} I could not make that work here.`}}return{question:`${t.said} I can do it in ${A} steps. Should I?`,parts:i,proposal:{said:s.said,add:[],drop:[],card:{said:i.map(n=>n.said).join(" "),adds:[],keeps:[],drops:[],breaking:[]},edits:a.edits,records:p,via:`ai:${e.ai.name??"model"}`}}}export{U as planFor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.MIE4TJRW.js";import{o as D}from"./chunk.
|
|
1
|
+
import"./chunk.MIE4TJRW.js";import{o as D}from"./chunk.DEBW4FH6.js";import"./chunk.RD2FSSLV.js";import"./chunk.OWHH7JDV.js";import"./chunk.T3RFZ66S.js";import"./chunk.TDWJU6GW.js";import{a as $}from"./chunk.P3Z4ZCL3.js";import"./chunk.45OLF6BK.js";import"./chunk.T6ISUVUP.js";import"./chunk.GH6QX7JR.js";import"./chunk.J4D4BIB4.js";import{G as P,_ as C}from"./chunk.ASNVH2G4.js";import"./chunk.SDO3U72B.js";import{Wa as w,Ya as R,ab as c,ba as S}from"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import{b as k}from"./chunk.AJZBJBMO.js";var m=k(P(),1);var e=k(C(),1),W=[["","Does not repeat"],["day","Daily"],["week","Weekly"],["month","Monthly"],["year","Yearly"]],E=r=>`${r}${r%100>=11&&r%100<=13?"th":["th","st","nd","rd"][r%10]??"th"}`,v={display:"flex",flexWrap:"wrap",gap:"6px 12px",alignItems:"center"};function N({value:r,onChange:d,start:p,label:s,name:l="repeat"}){let f=(0,m.useId)(),a=c(r)?r:void 0,i=typeof p=="string"&&/^\d{4}-\d{2}-\d{2}/.test(p)?p:void 0,u=i?w[new Date(`${i.slice(0,10)}T00:00:00Z`).getUTCDay()]:void 0,o=t=>{let n={...a??{every:"week"},...t};for(let b of Object.keys(n))n[b]===void 0&&delete n[b];d(n)},y=a?.every??"week",g=a?.on??(u?[u]:[]);return(0,e.jsxs)("fieldset",{"data-graview-part":"field","data-graview-field":"repeat","data-graview-repeat":l,style:{display:"grid",gap:8,border:"1px solid var(--graview-edge)",borderRadius:8,padding:"8px 12px",margin:0,minWidth:0},children:[(0,e.jsx)("legend",{"data-graview-part":"label",style:{padding:"0 4px"},children:s}),(0,e.jsxs)("div",{style:v,children:[(0,e.jsx)("label",{htmlFor:`${f}-every`,children:"Repeats"}),(0,e.jsx)("select",{id:`${f}-every`,name:`${l}.every`,value:a?.every??"",onChange:t=>{let n=t.target.value;d(n===""?void 0:{...a?.interval?{interval:a.interval}:{},...a?.until?{until:a.until}:{},every:n})},"data-graview-part":"control",children:W.map(([t,n])=>(0,e.jsx)("option",{value:t,children:n},t))}),a?(0,e.jsxs)("label",{style:v,children:["every",(0,e.jsx)("input",{type:"number",min:1,max:99,name:`${l}.interval`,"aria-label":`Every how many ${y}s`,value:a.interval??1,onChange:t=>o({interval:Number(t.target.value)>1?Math.min(99,Math.round(Number(t.target.value))):void 0}),style:{width:"4.5em"},"data-graview-part":"control"}),y,(a.interval??1)>1?"s":""]}):null]}),a?.every==="week"?(0,e.jsxs)("div",{role:"group","aria-label":"On",style:v,children:[(0,e.jsx)("span",{"aria-hidden":"true",children:"On"}),w.map((t,n)=>(0,e.jsxs)("label",{style:{display:"inline-flex",gap:4,alignItems:"center",minHeight:24},children:[(0,e.jsx)("input",{type:"checkbox",name:`${l}.on`,value:t,checked:g.includes(t),onChange:b=>{let h=w.filter(x=>x===t?b.target.checked:g.includes(x));o({on:h.length===0||h.length===1&&h[0]===u?void 0:h})}}),S(n,"short")]},t))]}):null,a?.every==="month"?(0,e.jsxs)("label",{style:v,children:["On",(0,e.jsxs)("select",{name:`${l}.on`,value:a.on?.[0]===-1?"last":"",onChange:t=>o({on:t.target.value==="last"?[-1]:void 0}),"data-graview-part":"control",children:[(0,e.jsx)("option",{value:"",children:i?`the ${E(Number(i.slice(8,10)))}`:"the same day"}),(0,e.jsx)("option",{value:"last",children:"the last day"})]})]}):null,a?(0,e.jsxs)("label",{style:v,children:["Until",(0,e.jsx)("input",{type:"date",name:`${l}.until`,value:a.until??"",onChange:t=>o({until:t.target.value||void 0}),"data-graview-part":"control"})]}):null,(0,e.jsx)("p",{"aria-live":"polite","data-graview-repeat-said":"",style:{margin:0,color:"var(--graview-ink-dim)",fontSize:"0.8125rem"},children:a?$(i??"",a):"Does not repeat"})]})}function K({nodeId:r,field:d,start:p,value:s,label:l}){let{fields:f,commit:a}=D(r),i=f.find(t=>t.field===R(d)&&t.takesValue&&t.open.length===0),[u,o]=(0,m.useState)(!1),[y,g]=(0,m.useState)(c(s)?s:void 0);return i?u?(0,e.jsxs)("form",{onSubmit:t=>{t.preventDefault(),o(!1),a(i,y??null)},style:{display:"grid",gap:6,marginTop:6},children:[(0,e.jsx)(N,{value:y,onChange:g,start:p,label:l,name:R(d)}),(0,e.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,e.jsx)("button",{type:"submit","data-graview-repeat-keep":d,children:"Keep"}),(0,e.jsx)("button",{type:"button",onClick:()=>o(!1),children:"Cancel"})]})]}):(0,e.jsx)("button",{type:"button","data-graview-repeat-open":d,onClick:()=>(g(c(s)?s:void 0),o(!0)),style:{marginInlineStart:8,fontSize:"0.75rem",padding:"1px 8px",borderRadius:999,minHeight:24},children:c(s)?"Change how it repeats":"Repeat\u2026"}):null}export{K as RepeatEditor,N as RepeatPicker};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f}from"./chunk.
|
|
1
|
+
import{a as f}from"./chunk.53GQQETN.js";import{ma as d}from"./chunk.ZDUKVXBI.js";function S(e){let o=e.indexOf("{"),a=e.indexOf("["),t=a!==-1&&(o===-1||a<o)?a:o;if(t===-1)return;let n=e[t],r=n==="["?"]":"}",i=0,u=!1,l=!1;for(let s=t;s<e.length;s++){let c=e[s];if(u){l?l=!1:c==="\\"?l=!0:c==='"'&&(u=!1);continue}if(c==='"')u=!0;else if(c===n)i+=1;else if(c===r&&(i-=1,i===0))try{return JSON.parse(e.slice(t,s+1))}catch{return}}}function w(e,o){let a;try{a=e.mutation(o.mutation)}catch{return o}let t={...o.args},n=!1;for(let r of f(a.input)){if(r.control!=="node")continue;let i=t[r.name];if(typeof i!="string"||i.length===0||e.graph.getNode(i))continue;let u=i.trim().toLowerCase(),l=[...e.graph.allNodes()].filter(s=>(r.kinds.includes("*")||r.kinds.includes(s.kind))&&d(e.schema.tryDefinition(s.kind),s).trim().toLowerCase()===u);l.length===1&&(t[r.name]=l[0].id,n=!0)}return n?{...o,args:t}:o}function x(e,o,a){let t=a===void 0?null:new Set(a),n=[];for(let r of o){if(typeof r.mutation!="string")continue;let i=!0;try{e.mutation(r.mutation)}catch{i=!1}i?t&&!t.has(r.mutation)&&n.push({proposal:r,why:"not-allowed"}):n.push({proposal:r,why:"unknown"})}return n}function v(e,o,a){let t=a===void 0?null:new Set(a);return o.filter(n=>{if(typeof n.mutation!="string"||t&&!t.has(n.mutation))return!1;try{e.mutation(n.mutation)}catch{return!1}return n.args!==null&&typeof n.args=="object"})}export{S as a,w as b,x as c,v as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var I=e=>Array.isArray(e),Z=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function H(e,t){let i=e===!0||I(e)?void 0:e.records;if(!Z(i))return()=>!0;let n=new Set(Array.isArray(i.ids)?i.ids:[]),d=t.node?.id;if(i.subject===!0&&d!==void 0){n.add(d);for(let u of t.edges??[])u.from===d&&n.add(u.to),u.to===d&&n.add(u.from)}return u=>n.has(u)}var ee=e=>e===!0||I(e)||typeof e.most!="number"?1/0:e.most,W=(e,t)=>`The view ${e} is handed at most ${R(t)} ${t===1?"picture":"pictures"} ("most"), so those after, in the order its records are handed, come without an address.`;function te(e){return e===!0||I(e)||typeof e.width!="number"?ne:e.width}function re(e){if(e===!0)return()=>!0;if(I(e)){let i=new Set(e);return n=>i.has(n)}let t=new Map;for(let[i,n]of Object.entries(e))typeof n=="string"?t.set(i,new Set([n])):Array.isArray(n)&&t.set(i,new Set(n));return t.size===0?()=>!0:(i,n)=>t.get(i)?.has(n)??!1}var ne=1200,ae="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",se=100,V=4e7,E=e=>/^image\//i.test(e.type)&&!/^image\/svg/i.test(e.type);function w(e,t={}){let i={name:e.name,type:e.type,bytes:e.bytes};return/^video\//i.test(e.type)?{...i,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.caption!==void 0?{caption:e.caption}:{},...e.duration!==void 0?{duration:e.duration}:{},...e.poster?{poster:!0}:{}}:E(e)?{...i,...e.width!==void 0?{width:e.width}:{},...e.height!==void 0?{height:e.height}:{},...e.caption!==void 0?{caption:e.caption}:{},...t.src!==void 0?{src:t.src}:{},...t.left!==void 0?{left:t.left}:{}}:i}var ie=new Set(["id","kind","label"]),z=e=>{let t=e;return typeof t=="object"&&t!==null&&typeof t.href=="string"&&typeof t.name=="string"&&typeof t.type=="string"&&typeof t.bytes=="number"};function _(e,t){let i=n=>{let d;for(let[u,c]of Object.entries(n)){if(ie.has(u))continue;let m=z(c)?t(c,n,u):Array.isArray(c)&&c.length>0&&c.every(z)?c.map(l=>t(l,n,u)):void 0;m!==void 0&&((d??={...n})[u]=m)}return d??n};return{...e,...e.node?{node:i(e.node)}:{},...e.nodes?{nodes:e.nodes.map(i)}:{}}}var R=e=>e.toLocaleString("en-US"),O=(e,t)=>`The picture "${e.name}" on ${t.label?`"${t.label}"`:"a record"}`;function D(e,t,i){let n=te(e),d=t?.pictureBytes??15e5,u=t?.picturesBytes??12e6,c=Math.round(n*Math.min(2,Math.max(1,i||1)));return{width:n,perFile:d,perView:u,need:c,reckon:l=>Math.min(d,Math.ceil(l.bytes*(l.width&&l.width>c?(c/l.width)**2:1))),chosen:re(e),most:ee(e)}}var K=(e,t)=>`${O(e,t)} is left out: at ${R(e.bytes)} bytes it is more than the host fetches for a view.`,q=(e,t,i,n)=>`${O(e,t)} is left out: the view ${i} is handed at most ${R(n)} bytes of pictures, and the pictures before it, in the order its records are handed, took them. A view that draws only some kinds' pictures says which ("pictures": ["<kind>"]), and one that draws only some records' says which ("records": { "subject": true }, or their "ids").`;function de(e,t){let{perView:i,reckon:n,chosen:d,most:u}=D(t.pictures,t.limits,2),c=H(t.pictures,e),m=[],l=0,v=0;return{props:_(e,(f,p,P)=>{if(!E(f)||!d(p.kind,P)||!c(p.id))return w(f);let y=B=>(m.includes(B)||m.push(B),w(f,{left:B}));if(f.bytes>V)return y(K(f,p));if(v>=u)return y(W(t.view,u));let k=n(f);return l+k>i?y(q(f,p,t.view,i)):(l+=k,v+=1,w(f,{src:t.standIn}))}),left:m}}function ue(e,t){let{width:i,perFile:n,perView:d,need:u,reckon:c,chosen:m,most:l}=D(t.pictures,t.limits,e.devicePixelRatio),v=t.shrink??((r,s,o)=>oe(e,r,s,o)),g=new Map,f=new Map,p=new Set,P=!1,y,k=-1/0,B=()=>{if(y!==void 0||P)return;let r=()=>{y=void 0,!P&&(k=e.performance.now(),t.moved())},s=k+se-e.performance.now();s<=0?(y=!0,queueMicrotask(r)):y=e.setTimeout(r,s)},T=r=>{p.has(r)||(p.add(r),t.onLeft?.(r))},L=r=>{r?.state==="ready"&&(f.delete(r.url),r.url.startsWith("blob:")&&e.URL.revokeObjectURL(r.url))},S=O,j,Q=r=>new Promise(s=>{let o=new e.Image;o.onload=()=>s(!0),o.onerror=()=>s(!1),e.setTimeout(()=>s(!1),2e3),o.src=r}),N=r=>new Promise((s,o)=>{let b=new e.FileReader;b.onload=()=>s(String(b.result)),b.onerror=o,b.readAsDataURL(r)}),Y=async r=>{if(t.as==="blob"){let o=e.URL.createObjectURL(r);return j??=Q(o),await j?{url:o,drawn:o}:{url:o,drawn:await N(r)}}let s=await N(r);return{url:s,drawn:s}},M=(r,s,o)=>({state:"left",said:`${S(r,s)} could not be loaded for the view ${t.view}${o?`: the host answered ${o}.`:"."}${o&&!t.file?" A host that serves the app under a base says where a record's files are (file, on the view's definition).":""}`}),J=async(r,s)=>{let o=M(r,s),b=t.file?t.file(r.href):r.href;if(b===void 0)return o;let $=new e.URL(b,e.document.baseURI);if($.origin!==e.location.origin||!/^https?:$/.test($.protocol))return o;let G=await e.fetch($.href,{credentials:"same-origin"}),a=(G.headers.get("content-type")??"").split(";")[0].trim();if(!G.ok)return M(r,s,String(G.status));if(!E({type:a}))return M(r,s,`${a||"no type"}, not a picture`);let h=new e.Blob([await G.arrayBuffer()],{type:a});if(h.size>V)return o;if(!(r.width!==void 0&&r.width<=u)||h.size>n){let x=await v(h,u,n).catch(()=>{});if(x)h=x;else if(h.size>n)return o}return h.size>n?{state:"left",said:`${S(r,s)} is left out: made as small as the ${R(i)} pixels across the view ${t.view} draws a picture at, it is still more than the ${R(n)} bytes one picture is handed.`}:{state:"ready",...await Y(h)}},X=(r,s)=>{g.set(r.href,{state:"pending"}),J(r,s).then(o=>U(r.href,o),()=>U(r.href,{state:"left",said:`${S(r,s)} could not be loaded for the view ${t.view}.`}))},U=(r,s)=>{if(P||g.get(r)?.state!=="pending")return L(s);g.set(r,s),s.state==="ready"&&f.set(s.url,s.drawn),s.state==="left"&&T(s.said),B()};return{hand(r){if(P)return _(r,a=>w(a));let s=0,o=0,b=new Set,$=H(t.pictures,r),G=_(r,(a,h,C)=>{if(!E(a)||!m(h.kind,C)||!$(h.id))return w(a);if(a.bytes>V){let A=K(a,h);return T(A),w(a,{left:A})}if(o>=l){let A=W(t.view,l);return T(A),w(a,{left:A})}let x=c(a);if(s+x>d){let A=q(a,h,t.view,d);return T(A),w(a,{left:A})}s+=x,o+=1,b.add(a.href);let F=g.get(a.href);return F?.state==="left"?w(a,{left:F.said}):(F||X(a,h),w(a,F?.state==="ready"?{src:F.url}:{}))});for(let[a,h]of g)b.has(a)||(L(h),g.delete(a));return G},drawn:r=>f.get(r),waiting:()=>y!==void 0||[...g.values()].some(r=>r.state==="pending"),dispose(){P=!0,y!==void 0&&y!==!0&&e.clearTimeout(y);for(let r of g.values())L(r);g.clear(),f.clear()}}}async function oe(e,t,i,n){if(typeof e.createImageBitmap!="function")return;let d=await e.createImageBitmap(t);try{if(d.width<=i&&t.size<=n)return t;let u=Math.min(1,i/d.width),c=Math.max(1,Math.round(d.width*u)),m=Math.max(1,Math.round(d.height*u)),l=e.document.createElement("canvas");l.width=c,l.height=m;let v=l.getContext("2d");if(!v)return;v.drawImage(d,0,0,c,m);let g=P=>new Promise(y=>l.toBlob(y,P,.85)),f=/^image\/(jpeg|webp|png)$/i.test(t.type)?t.type:"image/png",p=await g(f);return p&&p.size<=n?p:await g("image/jpeg")??p??void 0}finally{d.close()}}export{Z as a,H as b,te as c,re as d,ne as e,ae as f,se as g,V as h,E as i,w as j,_ as k,D as l,de as m,ue as n};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c}from"./chunk.JOB3EKS6.js";import"./chunk.GYP3EF6Z.js";import"./chunk.O5P6LXHF.js";import"./chunk.VGQDPEB5.js";import"./chunk.WIVNFOQR.js";import"./chunk.53GQQETN.js";import"./chunk.J7GH2CGV.js";import"./chunk.SMF5S4DQ.js";import"./chunk.XP4IVKKR.js";import"./chunk.R5YGW5ZX.js";import"./chunk.QMGBAKX6.js";import"./chunk.PS765ODQ.js";import"./chunk.T3RFZ66S.js";import"./chunk.TDWJU6GW.js";import"./chunk.P3Z4ZCL3.js";import"./chunk.45OLF6BK.js";import"./chunk.T6ISUVUP.js";import"./chunk.ZDUKVXBI.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{c as actOnSeveral,a as actsForSeveral,b as severalApplies};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{G as w,
|
|
1
|
+
import{G as w,Va as c,ha as f,ia as h,ka as g}from"./chunk.ASNVH2G4.js";import{b as m}from"./chunk.AJZBJBMO.js";var d=m(w(),1);function j(){let e=c();return(0,d.useMemo)(()=>[...new Set(e.flatMap(n=>n.nodeIds))],[e])}function x(){let e=I(),n=f();return(0,d.useMemo)(()=>{if(!n)return e;let t=n.matched;return t.length===0&&e.length===0?[k]:[...new Set([...e,...t])]},[n,e])}function I(){let{store:e,selection:n}=h(),t=g(),r=c();return(0,d.useMemo)(()=>{if(n.length===0)return v;let u=n.join(`
|
|
2
2
|
`),s=y.get(e);if(s&&s.violations===r&&s.key===u)return s.reached;let a=new Set(n),i=new Set(a);for(let o of e.graph.allEdges())a.has(o.from)&&i.add(o.to),a.has(o.to)&&i.add(o.from);for(let o of r)if(o.subjectId!==void 0&&a.has(o.subjectId))for(let p of o.nodeIds)i.add(p);let l=[...i];return y.set(e,{violations:r,key:u,reached:l}),l},[e,n,t,r])}var v=[],y=new WeakMap,k="search:nothing";export{j as a,x as b,I as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Ab as k,Ed as _,Gc as I,Jc as ue,Kc as le,Mb as de,Mc as ge,Nb as P,Nc as pe,Ob as D,Oc as V,Pc as L,Qc as U,Qd as O,Rb as h,Ub as ce,fb as N,ga as ee,gb as ie,ha as F,lb as se,mb as oe,nb as re,ob as ae,pa as ne,ta as te,tc as K,zb as T}from"./chunk.IUVRJDL3.js";import{j as m}from"./chunk.FQLNBIQ5.js";var ye=e=>N(e).id??e.session;function z(e,i={}){let o=I(e),n=new Map,t=i.advisory===!0;for(let s of e){if(s.vote===void 0||s.withheld||o.has(s.id)||s.vote.advisory===!0!==t)continue;let a=t?s.vote.voter:ye(s.author);if(a===void 0)continue;let d=n.get(s.vote.suggestion);d||n.set(s.vote.suggestion,d=new Map),s.vote.vote===null?d.delete(a):d.set(a,s.vote.vote)}return n}function fe(e){let i=0,o=0;for(let n of e?.values()??[])n==="for"?i++:o++;return{for:i,against:o}}function $e(e,i,o){let n=V(i)?L(i):void 0,t=i&&(n===void 0?ye(i):void 0),s=n!==void 0?o?.get(n):t!==void 0?e?.get(t):void 0,a=fe(o);return{...fe(e),...s!==void 0?{mine:s}:{},...a.for+a.against>0?{advisory:a}:{}}}var q=(e,i)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(i),Ce=(e,i,o)=>(e??[]).some(n=>n.suggestion===i&&(n.until===void 0||Date.parse(n.until)>Date.parse(o)));function me(e,i=()=>!0,o={}){let n=I(e),t=Ne(e),s=o.now??new Date().toISOString(),a,d;return e.filter(c=>c.suggests&&!c.withheld&&!n.has(c.id)&&t.get(c.id)!=="all"&&!q(c,s)&&!Ce(o.dismissed,c.id,s)).flatMap(({id:c,batch:r,suggests:u,suggestsSaid:g,intent:l,batchIntent:w,author:S,lineage:f,at:y,expiresAt:je})=>{let Z=t.get(c),C=Ee(u,g,l).filter(v=>!Z?.has(v.at));if(C.length===0)return[];let Q=C.map(v=>v.call),X=new Set;return JSON.stringify(Q.map(v=>v.args),(v,E)=>(typeof E=="string"&&i(E)&&X.add(E),E)),[{id:c,batch:r,calls:Q,intent:Z?C.map(v=>v.intent).join("; "):l,...w!==void 0?{headline:w}:{},items:C,author:S,...f?{lineage:f}:{},at:y,expiresAt:je,about:[...X],tally:$e((a??=z(e)).get(c),o.voter,(d??=z(e,{advisory:!0})).get(c))}]})}function Ee(e,i,o){let n=i&&i.length===e.length?i:void 0;return e.map((t,s)=>({at:s,call:t,intent:n?.[s]??(e.length===1?o:t.name)}))}function Ne(e){let i=new Map;for(let n of e){let t=n.lineage?.suggestion;if(t===void 0)continue;let s=n.lineage.items,a=i.get(t);if(a!=="all")if(s===void 0)i.set(t,"all");else{let d=a??new Set;for(let c of s)d.add(c);i.set(t,d)}}let o=new Map(e.filter(n=>n.suggests&&i.has(n.id)).map(n=>[n.id,n.suggests.length]));for(let[n,t]of i)t!=="all"&&o.has(n)&&t.size>=o.get(n)&&i.set(n,"all");return i}var B=e=>JSON.stringify(e,(i,o)=>o&&typeof o=="object"&&!Array.isArray(o)?Object.fromEntries(Object.entries(o).sort()):o);var Te=/^(archive|unarchive|remove|leave-alone|allow-tidying)$/;function Ve(e,i){let o=O(e.name),n=i?.act(e.name),t=e.args??{},s=n?n.derived:K(o),{id:a}=t;if(s&&typeof a=="string"){if(Te.test(s.act))return[s.act,a];if(s.act==="merge")return["merge",...[a,t.into].sort()];if(s.relation)return[s.act,s.relation,a,t.to]}let d=n?.subject?.arg??"id",[c,r]=Object.keys(t).filter(u=>u!==d);return n?.connects?.length===1&&c&&!r&&i.has(t[d])&&i.has(t[c])?["connect",n.connects[0],t[d],t[c]]:[o,n?.creates?.length&&typeof a=="string"&&!i.has(a)?{...t,id:0}:t]}var x=(e,i)=>`\u2248${B(e.map(o=>Ve(o,i)))}`;function A(e,i){let o=i?.act(e.name),n=o?.derived?.relation??(o?.connects?.length===1?o.connects[0]:void 0);if(n!==void 0)return`${R}${B([o?.derived?.act??"connect",n])}`;let t=O(e.name),s=o?.derived??K(t),a=o?.subject?.arg??"id",d=s?.act==="edit"?Object.keys(e.args??{}).filter(c=>c!==a).sort():void 0;return`${R}${B(d?[t,d]:[t])}`}var R="\u2200",he=e=>`\u2248${B([["connect",e.kind,e.from,e.to]])}`;function Se(e,i,o,n){let t=j(e,o,n);return[i,...i.map(s=>[s])].map(s=>t.get(x(s,o))).find(Boolean)}function W(e,i){return e.lineage?.liftedStop===!0&&e.undoes!==void 0&&e.mutation===null&&e.primitives.length===0&&!i(e.undoes)}function ve(e,i,o,n){if(i.length===0)return;let t=j(e,o,n),s=i.map(a=>t.get(A(a,o)));return s.every(Boolean)?s[0]:void 0}function j(e,i,o){let n=I(e),t=new Map(e.map(r=>[r.id,r])),s=new Map,a=new Set(e.map(r=>r.id)),d=new Set(e.filter(r=>W(r,u=>a.has(u))&&!n.has(r.id)).map(r=>r.undoes));for(let[r,u]of Object.entries(o??{}))!n.has(u.id)&&!d.has(u.id)&&s.set(r,u);let c=new Map;for(let r of e)r.lineage?.suggestion!==void 0&&r.lineage.items&&c.set(r.lineage.suggestion,[...c.get(r.lineage.suggestion)??[],...r.lineage.items]);for(let r of e){let u=!n.has(r.id)&&!r.withheld,g=r.author.kind==="human",l=r.undoes!==void 0&&u?t.get(r.undoes):void 0;if(l?.suggests&&l.author.kind===r.author.kind&&l.author.id===r.author.id)continue;let w=l?.mutation&&l.undoes===void 0&&(l.lineage||r.undoneLineage||g),S=l?.suggests?l.suggests.filter((f,y)=>!c.get(l.id)?.includes(y)):w?[l.mutation]:[];if(S.length>0)for(let f of[S,...S.map(y=>[y])])s.set(x(f,i),r);if(l?.suggests&&u&&D(r,l))for(let f of S)s.set(A(f,i),r);if(!(!u||!g||r.undoes!==void 0))for(let f of r.primitives)f.op==="remove-edge"?s.set(he(f.edge),r):f.op==="add-edge"&&s.delete(he(f.edge))}return s}function Ae(e,i=[],o){let n=new Map(i.map(s=>[s.id,s])),t=s=>{let a=s.stop;if(a)return a;let d=s;if(d.batch===void 0||s.undoes===void 0||!D(d,n.get(s.undoes)))return;let c=new Map((n.get(s.undoes)?.suggests??[]).map(r=>[A(r,o),r]));return{batch:d.batch,words:d.batchIntent??d.intent??"",calls:[...c.values()]}};return Object.fromEntries([...e].map(([s,a])=>{let d=t(a);return[s,{id:a.id,at:a.at,author:a.author,...a.undoes!==void 0&&{undoes:a.undoes},...d&&{stop:d}}]}))}h.declined=Se;h.kept=(e,i,o)=>Ae(j(e,i,o),e,i);h.stopped=ve;h.liftTold=(e,i)=>{let o=i,n=o.timeline?.log;if(!n?.get||!W(e,s=>n.get(s)!==void 0))return!1;if(o.actor!==void 0&&N(e.author).id===o.actor)return!0;let t=Object.values(n.horizonEpoch?.()?.declines??{}).find(s=>s.id===e.undoes)?.stop;return t!==void 0&&!H(t.calls,o)};function H(e,i){return e.some(o=>{let n=o.args??{};if(ce(n,i.sees))return!0;let t=n.id,s=typeof t=="string"?i.kindOf(t):void 0,a=s&&i.kept?.({id:t,kind:s});return a?Object.keys(n).some(d=>d!=="id"&&a(d)):!1})}h.lift=(e,i,o,n)=>{let t=e,s=Pe(t,i);return s&&ze(t,s,o,n)};h.liftRefusal=(e,i,o)=>{let n=e,t=Pe(n,i);if(!t)return;let s=Me(n,t,o);return s?{refusal:s}:{}};h.undoRefusal=(e,i,o)=>{let n=e;for(let t of i){if(W(t,r=>n.log.get(r)!==void 0))return{mutation:"undo",wouldNeed:[],message:`"${t.intent}" cannot be taken back: it may be suggested again now, and can be stopped again then.`};let s=t,a=!1;for(let r=t;r!==void 0;r=r.undoes===void 0?void 0:n.log.get(r.undoes))s=r,a||=D(r,r.undoes===void 0?void 0:n.log.get(r.undoes));if(!a)continue;let d=s.suggests??Object.values(n.log.horizonEpoch()?.declines??{}).find(r=>r.id===t.id||r.id===s.id)?.stop?.calls,c=d?xe(n,d,o):o.kind==="system"?void 0:{mutation:"undo",wouldNeed:[],message:"Only somebody who may make these changes can let them be suggested again."};if(c)return c}};var be=new WeakMap;function J(e,i,o){let n=be.get(e);return n?.length!==e.log.length&&be.set(e,n={length:e.log.length,held:new Map}),n.held.has(i)||n.held.set(i,o()),n.held.get(i)}var ke=e=>JSON.stringify([e.kind,e.id,e.roles,e.onBehalfOf?.id,e.onBehalfOf?.roles,e.shared,ie(e)?.id]),we="\0no-such-record",Le=new Set(["remove","archive","unarchive","merge"]);function _e(e,i,o,n){let t=p(e),s=t.mutations.get(i.name);return s?.subject?se(t.policy,n,i.name,o,t.viaOf(s,i,n),we,{},()=>[we],s.derived?()=>{}:void 0,s.derived!==void 0&&Le.has(s.derived.act)).ok:!0}function Oe(e,i,o){let n=p(e),t=n.actMeanings(),s=ke(o);return i.every(a=>e.permits(a,o).ok?J(e,`decides|${s}|${A(a,t)}`,()=>{let d=n.mutations.get(a.name)??n.mutations.get(O(a.name)),c=d?.subject;if(!c)return!0;let r=c.kinds==="*"?[void 0]:[c.kinds].flat();return r.every(g=>_e(e,a,g,o))?d.writesLinked!==void 0||_(e,o).hides?.()!==!1?r.every(g=>(g===void 0?[]:e.graph.nodesOfKind(g,{archived:"all"})).every(l=>e.permits({...a,args:{...a.args,[c.arg]:l.id}},o).ok)):!0:!1}):!1)}function xe(e,i,o){if(!Oe(e,i,o))return{mutation:"undo",wouldNeed:[],message:"Only somebody who may make these changes can let them be suggested again."}}function Me(e,i,o){let n=_(e,o);return n.hides?.()!==!1&&H(i.stop.calls,n)?{mutation:"undo",wouldNeed:[],message:"Only somebody who may make these changes can let them be suggested again."}:xe(e,i.stop.calls,o)}function Pe(e,i){if(i.length!==1)return;let o=e.stopsServed?.stops.find(s=>s.batch===i[0]);if(o&&!e.log.all().some(s=>s.batch===o.batch))return{id:`served:${o.batch}`,at:"",author:{kind:"system"},stop:{batch:o.batch,words:o.words,calls:[]}};let n=e.log.horizonEpoch()?.declines;if(!n)return;let t=new Set(e.log.all().flatMap(s=>s.undoes!==void 0?[s.undoes]:[]));return Object.values(n).find(s=>s.stop?.batch===i[0]&&!t.has(s.id)&&e.log.get(s.id)===void 0)}function ze(e,i,o,n){let t=p(e),s=Me(e,i,n);s&&t.refuse(s,n.id,!0);let a=e.violations(),d={id:t.nextId(),seq:e.log.length,batch:o.batch??t.mintBatch("undo"),author:n,intent:`Undo: ${i.stop.words}`,...b("batchIntent",o.intent),mutation:null,primitives:[],reads:[],writes:[],at:t.now(),undoes:i.id,...b("via",o.via),lineage:{basis:"A person let this kind of thing be suggested again",liftedStop:!0}};return e.log.append(d),e.stopsServed&&(e.stopsServed={...e.stopsServed,stops:e.stopsServed.stops.filter(c=>c.batch!==i.stop.batch)}),e.notify(T,[d]),{batch:d.batch,ops:[d],diff:T,primitives:[],reads:[],writes:[],intent:d.intent,...t.moved(a,a),violationsAfter:a}}h.stopRefusal=(e,i,o)=>{let n=e;if(i.length===0||i.some(t=>!t.suggests))return"Only a suggestion can be answered with not suggesting that kind of thing.";for(let t of i){let s=Re(n,t.suggests,t.author,t.lineage,o);if(s)return s}};var p=e=>e,b=(e,i)=>i===void 0?{}:{[e]:i};function wn(e,i,o){let n=m(e)?.store??e,t=p(n),s=le(o.lineage);if(s===void 0)throw new k("A suggestion says what it is based on: { basis, confidence? }");let a=o.author??t.by;if(o.expiresAt!==void 0&&Number.isNaN(Date.parse(o.expiresAt)))throw new k(`A suggestion expires at a time: "${o.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let d=t.actMeanings(),c=x(i,d),r=$(n).find(y=>x(y.calls,d)===c);if(r)return n.log.get(r.id);t.refuseDeclined(i,a),P(a)&&t.refuseStopped(i,a,!0);let u=t.rehearsal();u.suggesting=!0;let g=u.applying(i,{author:a,lineage:s,...b("via",o.via)});if(g.ops.length===0)return;let l=[...new Set(g.ops.flatMap(y=>y.described??[]))],w=g.ops.filter(y=>y.mutation!==null&&y.author===a),S=i.length>1&&w.length===i.length?w.map(y=>y.intent):void 0,f={id:t.nextId(),seq:n.log.length,batch:t.mintBatch("batch"),author:a,intent:g.ops.map(y=>y.intent).join("; "),...b("batchIntent",o.intent),mutation:null,primitives:[],reads:[],writes:[],...l.length>0?{described:l}:{},at:t.now(),...b("via",o.via),lineage:s,suggests:i,...b("suggestsSaid",S),...b("expiresAt",o.expiresAt)};return n.log.append(f),n.notify(T,[f]),f}function $(e,i,o={}){let n=m(e),t=n?.store??e,s=i??n?.principal,a=(s!==void 0?t.seenBy(s):t).log.all(),d=me(a,u=>t.graph.has(u),{now:p(t).now(),dismissed:o.dismissed,voter:s}),c=new Set(Ke(t).keys());for(let u of t.stopsServed?.kinds??[])c.add(u);for(let u of De(t))for(let g of u.kinds)c.add(g);if(c.size===0)return d;let r=p(t).actMeanings();return d.filter(u=>!P(u.author)||G(u)||!u.calls.every(g=>c.has(A(g,r))))}function De(e){let i=e.stopsServed?.stops??[];if(i.length===0)return i;let o=e.log.undoneIds();return i.filter(n=>!e.log.all().some(t=>t.batch===n.batch&&o.has(t.id)))}function Ke(e){let i=e.log.all(),o=e.log.horizonEpoch()?.declines;return!i.some(n=>n.lineage?.stopsKind===!0)&&!Object.keys(o??{}).some(n=>n.startsWith(R))?new Map:new Map([...j(i,p(e).actMeanings(),o)].filter(([n])=>n.startsWith(R)))}function kn(e,i){let o=m(e),n=o?.store??e,t=i??o?.principal,s=t!==void 0?n.seenBy(t):n,a=new Map(s.log.all().map(c=>[c.id,c])),d=new Map;for(let c of Ke(n).values()){let{stop:r}=c;if(r){(t===void 0||!H(r.calls,_(n,t)))&&d.set(r.batch,{batch:r.batch,words:r.words});continue}let u=a.get(c.id);u?.batch!==void 0&&!u.withheld&&d.set(u.batch,{batch:u.batch,words:u.batchIntent??u.intent})}for(let c of De(n))d.set(c.batch,{batch:c.batch,words:c.words});return[...d.values()]}function Y(e,i,o){let n=m(e),t=n?.store??e,s=o??n?.principal??p(t).by;return i.calls.every(a=>t.permits(a,s).ok)}function Ie(e,i,o,n={}){let t=m(e)?.store??e,s=n.author??p(t).by;M(t,i,s);let a=t.applyAll([{name:pe,args:{suggestion:i,vote:o}}],{...n,author:s});return o===null?a:{...a,voted:o}}function M(e,i,o){let n=$(e,o).find(s=>s.id===i),t=n?void 0:e.log.get(i);if(t?.suggests&&q(t,p(e).now()))throw new k(`That suggestion expired on ${t.expiresAt.slice(0,10)}.`);if(!n)throw new k("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return n}function On(e,i,o={}){let n=m(e)?.store??e,{items:t,...s}=o,a=s.author??p(n).by,d=M(n,i,a),c=t===void 0?d.items:d.items.filter(l=>t.includes(l.at));if(t!==void 0&&(t.length===0||c.length!==new Set(t).size))throw new k("Name the changes to accept by their place among those still waiting in the suggestion.");let r={...d,calls:c.map(l=>l.call)};if(!Y(n,r,a))return Ie(n,i,"for",{...s,author:a});let u=n.log.get(i)?.suggests?.length??c.length,g=c.length<u?{items:c.map(l=>l.at)}:{};return n.applyAll(r.calls,{...s,author:a,lineage:{...d.lineage,suggestion:i,...g}})}function xn(e,i,o={}){let n=m(e)?.store??e,t=o.author??p(n).by,s=M(n,i,t);if(!Y(n,s,t))return Ie(n,i,"against",{...o,author:t});let a=G(s)&&o.intent===void 0?{intent:`Declined ${Ue(Fe(s))} proposal: ${s.intent}`}:{};return n.undo(s.batch,{...o,...a,author:t})}function Be(e,i,o){let n=o.act(i.name),t=n?.derived?.relation??(n?.connects?.length===1?n.connects[0]:void 0);if(t!==void 0)return`\u201C${ee(F(t))}\u201D links`;let s=K(O(n?.name??i.name)),a=s&&e.schema.tryDefinition(s.kind);if(s&&a){let d=ne(e.schema,s.kind).toLowerCase();if(s.act==="edit"){let r=Object.keys(i.args??{}).filter(u=>u!=="id").map(u=>te(a,u));return`changes to the ${r.length>0?r.join(" and "):"details"} of ${d}`}let c={archive:`setting ${d} aside`,unarchive:`bringing ${d} back`,remove:`removing ${d}`,merge:`merging ${d}`};if(c[s.act])return c[s.act]}return`\u201C${n?.title??F(O(i.name))}\u201D`}function We(e,i){let o=m(e)?.store??e,n=p(o).actMeanings();return[...new Set(i.calls.map(t=>Be(o,t,n)))].join(", ")}function Re(e,i,o,n,t){if(n?.proposedBy!==void 0)return"A person proposed this: decline it, and they may propose again.";if(!P(o))return"Only what the app's own actor suggests can be stopped this way: decline this one.";let s=p(e).actMeanings(),a=[...new Set(i.map(c=>A(c,s)))].sort();if(J(e,`stops|${ke(t)}|${a.join("|")}`,()=>{let c=new Set(a),r=J(e,"waiting",()=>$(e)).filter(u=>P(u.author)&&!G(u)&&u.calls.some(g=>c.has(A(g,s))));return!(Oe(e,i,t)&&r.every(u=>Y(e,u,t)))}))return"Only somebody who may decide every suggestion of this kind can say not to suggest it."}function Mn(e,i,o){let n=m(e)?.store??e;return Re(n,i.calls,i.author,i.lineage,o??p(n).by)===void 0}function Pn(e,i,o={}){let n=m(e)?.store??e,t=o.author??p(n).by,s=M(n,i,t),a=o.intent??`Stopped suggesting ${We(n,s)}`;return n.undo(s.batch,{...o,author:t,intent:a,lineage:{basis:"A person said not to suggest this kind of thing",stopsKind:!0}})}function Dn(e,i,o={}){let n=m(e)?.store??e,t=o.author??p(n).by,s=M(n,i,t);if(s.author.kind!==t.kind||s.author.id!==t.id)throw new k("Only who made a suggestion withdraws it: a person declines it (declineSuggestion).");return n.undo(s.batch,{...o,author:t})}var Ge={kind:"system",id:"tidying",name:"Graview, tidying",automated:!0};U.op=(e,i,o,n,t,s)=>{let a=e,{suggestion:d,vote:c}=o.args,r=M(a,d,t),u=V(t)?L(t):void 0,g=c==="for"?`For: ${r.intent}`:c==="against"?`Against: ${r.intent}`:`Withdraws a vote on: ${r.intent}`;return{id:i.id,seq:a.log.length,batch:n,author:t,intent:g,mutation:o,primitives:[],reads:[],writes:[],...r.about.length>0?{described:r.about}:{},at:i.at,...s.via!==void 0?{via:s.via}:{},vote:{suggestion:d,vote:c,...u!==void 0?{advisory:!0,voter:u}:{}}}};U.accepting=(e,i)=>{let o=e,n=o.tidying?.autoAcceptAt;if(n===void 0||i.vote?.vote!=="for")return;let t=i.vote.suggestion,s=$(o).find(r=>r.id===t);if(!s)return;let d=[...z(o.log.all()).get(t)??[]].filter(([,r])=>r==="for").map(([r])=>r);if(d.length<n)return;let c=de(s.author)?s.author:Ge;return{calls:s.calls,author:c,lineage:{...s.lineage,suggestion:t,voters:d.slice(0,ue)}}};var G=e=>e.lineage?.proposedBy!==void 0,Fe=e=>e.author.name??e.author.id??"Somebody",Ue=e=>/s$/i.test(e)?`${e}'`:`${e}'s`;function Kn(e,i,o,n){let t=m(e)?.store??e,s=p(t).actMeanings(),a=x(o,s),d=$(t,i).find(r=>G(r)&&x(r.calls,s)===a);if(d)return t.log.get(d.id);let c={calls:o.map(({name:r,args:u})=>({name:r,args:u})),...b("intent",n)};return t.applyAll([{name:ge,args:c}],{author:i}).ops.find(r=>r.suggests!==void 0)}function In(e,i,o){if(!e||!e.grants.some(t=>t.propose!==void 0))return[];let n=new Set(oe(e,i,o));return o.filter(t=>!n.has(t)&&re(t).some(s=>ae(e,i,t.name,s)))}export{wn as a,$ as b,kn as c,Y as d,Ie as e,On as f,xn as g,We as h,Mn as i,Pn as j,Dn as k,G as l,Kn as m,In as n};
|
|
1
|
+
import{Ab as k,Ed as _,Gc as I,Jc as ue,Kc as le,Mb as de,Mc as ge,Nb as P,Nc as pe,Ob as D,Oc as V,Pc as L,Qc as U,Qd as O,Rb as h,Ub as ce,fb as N,ga as ee,gb as ie,ha as F,lb as se,mb as oe,nb as re,ob as ae,pa as ne,ta as te,tc as K,zb as T}from"./chunk.ZDUKVXBI.js";import{j as m}from"./chunk.FQLNBIQ5.js";var ye=e=>N(e).id??e.session;function z(e,i={}){let o=I(e),n=new Map,t=i.advisory===!0;for(let s of e){if(s.vote===void 0||s.withheld||o.has(s.id)||s.vote.advisory===!0!==t)continue;let a=t?s.vote.voter:ye(s.author);if(a===void 0)continue;let d=n.get(s.vote.suggestion);d||n.set(s.vote.suggestion,d=new Map),s.vote.vote===null?d.delete(a):d.set(a,s.vote.vote)}return n}function fe(e){let i=0,o=0;for(let n of e?.values()??[])n==="for"?i++:o++;return{for:i,against:o}}function $e(e,i,o){let n=V(i)?L(i):void 0,t=i&&(n===void 0?ye(i):void 0),s=n!==void 0?o?.get(n):t!==void 0?e?.get(t):void 0,a=fe(o);return{...fe(e),...s!==void 0?{mine:s}:{},...a.for+a.against>0?{advisory:a}:{}}}var q=(e,i)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(i),Ce=(e,i,o)=>(e??[]).some(n=>n.suggestion===i&&(n.until===void 0||Date.parse(n.until)>Date.parse(o)));function me(e,i=()=>!0,o={}){let n=I(e),t=Ne(e),s=o.now??new Date().toISOString(),a,d;return e.filter(c=>c.suggests&&!c.withheld&&!n.has(c.id)&&t.get(c.id)!=="all"&&!q(c,s)&&!Ce(o.dismissed,c.id,s)).flatMap(({id:c,batch:r,suggests:u,suggestsSaid:g,intent:l,batchIntent:w,author:S,lineage:f,at:y,expiresAt:je})=>{let Z=t.get(c),C=Ee(u,g,l).filter(v=>!Z?.has(v.at));if(C.length===0)return[];let Q=C.map(v=>v.call),X=new Set;return JSON.stringify(Q.map(v=>v.args),(v,E)=>(typeof E=="string"&&i(E)&&X.add(E),E)),[{id:c,batch:r,calls:Q,intent:Z?C.map(v=>v.intent).join("; "):l,...w!==void 0?{headline:w}:{},items:C,author:S,...f?{lineage:f}:{},at:y,expiresAt:je,about:[...X],tally:$e((a??=z(e)).get(c),o.voter,(d??=z(e,{advisory:!0})).get(c))}]})}function Ee(e,i,o){let n=i&&i.length===e.length?i:void 0;return e.map((t,s)=>({at:s,call:t,intent:n?.[s]??(e.length===1?o:t.name)}))}function Ne(e){let i=new Map;for(let n of e){let t=n.lineage?.suggestion;if(t===void 0)continue;let s=n.lineage.items,a=i.get(t);if(a!=="all")if(s===void 0)i.set(t,"all");else{let d=a??new Set;for(let c of s)d.add(c);i.set(t,d)}}let o=new Map(e.filter(n=>n.suggests&&i.has(n.id)).map(n=>[n.id,n.suggests.length]));for(let[n,t]of i)t!=="all"&&o.has(n)&&t.size>=o.get(n)&&i.set(n,"all");return i}var B=e=>JSON.stringify(e,(i,o)=>o&&typeof o=="object"&&!Array.isArray(o)?Object.fromEntries(Object.entries(o).sort()):o);var Te=/^(archive|unarchive|remove|leave-alone|allow-tidying)$/;function Ve(e,i){let o=O(e.name),n=i?.act(e.name),t=e.args??{},s=n?n.derived:K(o),{id:a}=t;if(s&&typeof a=="string"){if(Te.test(s.act))return[s.act,a];if(s.act==="merge")return["merge",...[a,t.into].sort()];if(s.relation)return[s.act,s.relation,a,t.to]}let d=n?.subject?.arg??"id",[c,r]=Object.keys(t).filter(u=>u!==d);return n?.connects?.length===1&&c&&!r&&i.has(t[d])&&i.has(t[c])?["connect",n.connects[0],t[d],t[c]]:[o,n?.creates?.length&&typeof a=="string"&&!i.has(a)?{...t,id:0}:t]}var x=(e,i)=>`\u2248${B(e.map(o=>Ve(o,i)))}`;function A(e,i){let o=i?.act(e.name),n=o?.derived?.relation??(o?.connects?.length===1?o.connects[0]:void 0);if(n!==void 0)return`${R}${B([o?.derived?.act??"connect",n])}`;let t=O(e.name),s=o?.derived??K(t),a=o?.subject?.arg??"id",d=s?.act==="edit"?Object.keys(e.args??{}).filter(c=>c!==a).sort():void 0;return`${R}${B(d?[t,d]:[t])}`}var R="\u2200",he=e=>`\u2248${B([["connect",e.kind,e.from,e.to]])}`;function Se(e,i,o,n){let t=j(e,o,n);return[i,...i.map(s=>[s])].map(s=>t.get(x(s,o))).find(Boolean)}function W(e,i){return e.lineage?.liftedStop===!0&&e.undoes!==void 0&&e.mutation===null&&e.primitives.length===0&&!i(e.undoes)}function ve(e,i,o,n){if(i.length===0)return;let t=j(e,o,n),s=i.map(a=>t.get(A(a,o)));return s.every(Boolean)?s[0]:void 0}function j(e,i,o){let n=I(e),t=new Map(e.map(r=>[r.id,r])),s=new Map,a=new Set(e.map(r=>r.id)),d=new Set(e.filter(r=>W(r,u=>a.has(u))&&!n.has(r.id)).map(r=>r.undoes));for(let[r,u]of Object.entries(o??{}))!n.has(u.id)&&!d.has(u.id)&&s.set(r,u);let c=new Map;for(let r of e)r.lineage?.suggestion!==void 0&&r.lineage.items&&c.set(r.lineage.suggestion,[...c.get(r.lineage.suggestion)??[],...r.lineage.items]);for(let r of e){let u=!n.has(r.id)&&!r.withheld,g=r.author.kind==="human",l=r.undoes!==void 0&&u?t.get(r.undoes):void 0;if(l?.suggests&&l.author.kind===r.author.kind&&l.author.id===r.author.id)continue;let w=l?.mutation&&l.undoes===void 0&&(l.lineage||r.undoneLineage||g),S=l?.suggests?l.suggests.filter((f,y)=>!c.get(l.id)?.includes(y)):w?[l.mutation]:[];if(S.length>0)for(let f of[S,...S.map(y=>[y])])s.set(x(f,i),r);if(l?.suggests&&u&&D(r,l))for(let f of S)s.set(A(f,i),r);if(!(!u||!g||r.undoes!==void 0))for(let f of r.primitives)f.op==="remove-edge"?s.set(he(f.edge),r):f.op==="add-edge"&&s.delete(he(f.edge))}return s}function Ae(e,i=[],o){let n=new Map(i.map(s=>[s.id,s])),t=s=>{let a=s.stop;if(a)return a;let d=s;if(d.batch===void 0||s.undoes===void 0||!D(d,n.get(s.undoes)))return;let c=new Map((n.get(s.undoes)?.suggests??[]).map(r=>[A(r,o),r]));return{batch:d.batch,words:d.batchIntent??d.intent??"",calls:[...c.values()]}};return Object.fromEntries([...e].map(([s,a])=>{let d=t(a);return[s,{id:a.id,at:a.at,author:a.author,...a.undoes!==void 0&&{undoes:a.undoes},...d&&{stop:d}}]}))}h.declined=Se;h.kept=(e,i,o)=>Ae(j(e,i,o),e,i);h.stopped=ve;h.liftTold=(e,i)=>{let o=i,n=o.timeline?.log;if(!n?.get||!W(e,s=>n.get(s)!==void 0))return!1;if(o.actor!==void 0&&N(e.author).id===o.actor)return!0;let t=Object.values(n.horizonEpoch?.()?.declines??{}).find(s=>s.id===e.undoes)?.stop;return t!==void 0&&!H(t.calls,o)};function H(e,i){return e.some(o=>{let n=o.args??{};if(ce(n,i.sees))return!0;let t=n.id,s=typeof t=="string"?i.kindOf(t):void 0,a=s&&i.kept?.({id:t,kind:s});return a?Object.keys(n).some(d=>d!=="id"&&a(d)):!1})}h.lift=(e,i,o,n)=>{let t=e,s=Pe(t,i);return s&&ze(t,s,o,n)};h.liftRefusal=(e,i,o)=>{let n=e,t=Pe(n,i);if(!t)return;let s=Me(n,t,o);return s?{refusal:s}:{}};h.undoRefusal=(e,i,o)=>{let n=e;for(let t of i){if(W(t,r=>n.log.get(r)!==void 0))return{mutation:"undo",wouldNeed:[],message:`"${t.intent}" cannot be taken back: it may be suggested again now, and can be stopped again then.`};let s=t,a=!1;for(let r=t;r!==void 0;r=r.undoes===void 0?void 0:n.log.get(r.undoes))s=r,a||=D(r,r.undoes===void 0?void 0:n.log.get(r.undoes));if(!a)continue;let d=s.suggests??Object.values(n.log.horizonEpoch()?.declines??{}).find(r=>r.id===t.id||r.id===s.id)?.stop?.calls,c=d?xe(n,d,o):o.kind==="system"?void 0:{mutation:"undo",wouldNeed:[],message:"Only somebody who may make these changes can let them be suggested again."};if(c)return c}};var be=new WeakMap;function J(e,i,o){let n=be.get(e);return n?.length!==e.log.length&&be.set(e,n={length:e.log.length,held:new Map}),n.held.has(i)||n.held.set(i,o()),n.held.get(i)}var ke=e=>JSON.stringify([e.kind,e.id,e.roles,e.onBehalfOf?.id,e.onBehalfOf?.roles,e.shared,ie(e)?.id]),we="\0no-such-record",Le=new Set(["remove","archive","unarchive","merge"]);function _e(e,i,o,n){let t=p(e),s=t.mutations.get(i.name);return s?.subject?se(t.policy,n,i.name,o,t.viaOf(s,i,n),we,{},()=>[we],s.derived?()=>{}:void 0,s.derived!==void 0&&Le.has(s.derived.act)).ok:!0}function Oe(e,i,o){let n=p(e),t=n.actMeanings(),s=ke(o);return i.every(a=>e.permits(a,o).ok?J(e,`decides|${s}|${A(a,t)}`,()=>{let d=n.mutations.get(a.name)??n.mutations.get(O(a.name)),c=d?.subject;if(!c)return!0;let r=c.kinds==="*"?[void 0]:[c.kinds].flat();return r.every(g=>_e(e,a,g,o))?d.writesLinked!==void 0||_(e,o).hides?.()!==!1?r.every(g=>(g===void 0?[]:e.graph.nodesOfKind(g,{archived:"all"})).every(l=>e.permits({...a,args:{...a.args,[c.arg]:l.id}},o).ok)):!0:!1}):!1)}function xe(e,i,o){if(!Oe(e,i,o))return{mutation:"undo",wouldNeed:[],message:"Only somebody who may make these changes can let them be suggested again."}}function Me(e,i,o){let n=_(e,o);return n.hides?.()!==!1&&H(i.stop.calls,n)?{mutation:"undo",wouldNeed:[],message:"Only somebody who may make these changes can let them be suggested again."}:xe(e,i.stop.calls,o)}function Pe(e,i){if(i.length!==1)return;let o=e.stopsServed?.stops.find(s=>s.batch===i[0]);if(o&&!e.log.all().some(s=>s.batch===o.batch))return{id:`served:${o.batch}`,at:"",author:{kind:"system"},stop:{batch:o.batch,words:o.words,calls:[]}};let n=e.log.horizonEpoch()?.declines;if(!n)return;let t=new Set(e.log.all().flatMap(s=>s.undoes!==void 0?[s.undoes]:[]));return Object.values(n).find(s=>s.stop?.batch===i[0]&&!t.has(s.id)&&e.log.get(s.id)===void 0)}function ze(e,i,o,n){let t=p(e),s=Me(e,i,n);s&&t.refuse(s,n.id,!0);let a=e.violations(),d={id:t.nextId(),seq:e.log.length,batch:o.batch??t.mintBatch("undo"),author:n,intent:`Undo: ${i.stop.words}`,...b("batchIntent",o.intent),mutation:null,primitives:[],reads:[],writes:[],at:t.now(),undoes:i.id,...b("via",o.via),lineage:{basis:"A person let this kind of thing be suggested again",liftedStop:!0}};return e.log.append(d),e.stopsServed&&(e.stopsServed={...e.stopsServed,stops:e.stopsServed.stops.filter(c=>c.batch!==i.stop.batch)}),e.notify(T,[d]),{batch:d.batch,ops:[d],diff:T,primitives:[],reads:[],writes:[],intent:d.intent,...t.moved(a,a),violationsAfter:a}}h.stopRefusal=(e,i,o)=>{let n=e;if(i.length===0||i.some(t=>!t.suggests))return"Only a suggestion can be answered with not suggesting that kind of thing.";for(let t of i){let s=Re(n,t.suggests,t.author,t.lineage,o);if(s)return s}};var p=e=>e,b=(e,i)=>i===void 0?{}:{[e]:i};function wn(e,i,o){let n=m(e)?.store??e,t=p(n),s=le(o.lineage);if(s===void 0)throw new k("A suggestion says what it is based on: { basis, confidence? }");let a=o.author??t.by;if(o.expiresAt!==void 0&&Number.isNaN(Date.parse(o.expiresAt)))throw new k(`A suggestion expires at a time: "${o.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let d=t.actMeanings(),c=x(i,d),r=$(n).find(y=>x(y.calls,d)===c);if(r)return n.log.get(r.id);t.refuseDeclined(i,a),P(a)&&t.refuseStopped(i,a,!0);let u=t.rehearsal();u.suggesting=!0;let g=u.applying(i,{author:a,lineage:s,...b("via",o.via)});if(g.ops.length===0)return;let l=[...new Set(g.ops.flatMap(y=>y.described??[]))],w=g.ops.filter(y=>y.mutation!==null&&y.author===a),S=i.length>1&&w.length===i.length?w.map(y=>y.intent):void 0,f={id:t.nextId(),seq:n.log.length,batch:t.mintBatch("batch"),author:a,intent:g.ops.map(y=>y.intent).join("; "),...b("batchIntent",o.intent),mutation:null,primitives:[],reads:[],writes:[],...l.length>0?{described:l}:{},at:t.now(),...b("via",o.via),lineage:s,suggests:i,...b("suggestsSaid",S),...b("expiresAt",o.expiresAt)};return n.log.append(f),n.notify(T,[f]),f}function $(e,i,o={}){let n=m(e),t=n?.store??e,s=i??n?.principal,a=(s!==void 0?t.seenBy(s):t).log.all(),d=me(a,u=>t.graph.has(u),{now:p(t).now(),dismissed:o.dismissed,voter:s}),c=new Set(Ke(t).keys());for(let u of t.stopsServed?.kinds??[])c.add(u);for(let u of De(t))for(let g of u.kinds)c.add(g);if(c.size===0)return d;let r=p(t).actMeanings();return d.filter(u=>!P(u.author)||G(u)||!u.calls.every(g=>c.has(A(g,r))))}function De(e){let i=e.stopsServed?.stops??[];if(i.length===0)return i;let o=e.log.undoneIds();return i.filter(n=>!e.log.all().some(t=>t.batch===n.batch&&o.has(t.id)))}function Ke(e){let i=e.log.all(),o=e.log.horizonEpoch()?.declines;return!i.some(n=>n.lineage?.stopsKind===!0)&&!Object.keys(o??{}).some(n=>n.startsWith(R))?new Map:new Map([...j(i,p(e).actMeanings(),o)].filter(([n])=>n.startsWith(R)))}function kn(e,i){let o=m(e),n=o?.store??e,t=i??o?.principal,s=t!==void 0?n.seenBy(t):n,a=new Map(s.log.all().map(c=>[c.id,c])),d=new Map;for(let c of Ke(n).values()){let{stop:r}=c;if(r){(t===void 0||!H(r.calls,_(n,t)))&&d.set(r.batch,{batch:r.batch,words:r.words});continue}let u=a.get(c.id);u?.batch!==void 0&&!u.withheld&&d.set(u.batch,{batch:u.batch,words:u.batchIntent??u.intent})}for(let c of De(n))d.set(c.batch,{batch:c.batch,words:c.words});return[...d.values()]}function Y(e,i,o){let n=m(e),t=n?.store??e,s=o??n?.principal??p(t).by;return i.calls.every(a=>t.permits(a,s).ok)}function Ie(e,i,o,n={}){let t=m(e)?.store??e,s=n.author??p(t).by;M(t,i,s);let a=t.applyAll([{name:pe,args:{suggestion:i,vote:o}}],{...n,author:s});return o===null?a:{...a,voted:o}}function M(e,i,o){let n=$(e,o).find(s=>s.id===i),t=n?void 0:e.log.get(i);if(t?.suggests&&q(t,p(e).now()))throw new k(`That suggestion expired on ${t.expiresAt.slice(0,10)}.`);if(!n)throw new k("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return n}function On(e,i,o={}){let n=m(e)?.store??e,{items:t,...s}=o,a=s.author??p(n).by,d=M(n,i,a),c=t===void 0?d.items:d.items.filter(l=>t.includes(l.at));if(t!==void 0&&(t.length===0||c.length!==new Set(t).size))throw new k("Name the changes to accept by their place among those still waiting in the suggestion.");let r={...d,calls:c.map(l=>l.call)};if(!Y(n,r,a))return Ie(n,i,"for",{...s,author:a});let u=n.log.get(i)?.suggests?.length??c.length,g=c.length<u?{items:c.map(l=>l.at)}:{};return n.applyAll(r.calls,{...s,author:a,lineage:{...d.lineage,suggestion:i,...g}})}function xn(e,i,o={}){let n=m(e)?.store??e,t=o.author??p(n).by,s=M(n,i,t);if(!Y(n,s,t))return Ie(n,i,"against",{...o,author:t});let a=G(s)&&o.intent===void 0?{intent:`Declined ${Ue(Fe(s))} proposal: ${s.intent}`}:{};return n.undo(s.batch,{...o,...a,author:t})}function Be(e,i,o){let n=o.act(i.name),t=n?.derived?.relation??(n?.connects?.length===1?n.connects[0]:void 0);if(t!==void 0)return`\u201C${ee(F(t))}\u201D links`;let s=K(O(n?.name??i.name)),a=s&&e.schema.tryDefinition(s.kind);if(s&&a){let d=ne(e.schema,s.kind).toLowerCase();if(s.act==="edit"){let r=Object.keys(i.args??{}).filter(u=>u!=="id").map(u=>te(a,u));return`changes to the ${r.length>0?r.join(" and "):"details"} of ${d}`}let c={archive:`setting ${d} aside`,unarchive:`bringing ${d} back`,remove:`removing ${d}`,merge:`merging ${d}`};if(c[s.act])return c[s.act]}return`\u201C${n?.title??F(O(i.name))}\u201D`}function We(e,i){let o=m(e)?.store??e,n=p(o).actMeanings();return[...new Set(i.calls.map(t=>Be(o,t,n)))].join(", ")}function Re(e,i,o,n,t){if(n?.proposedBy!==void 0)return"A person proposed this: decline it, and they may propose again.";if(!P(o))return"Only what the app's own actor suggests can be stopped this way: decline this one.";let s=p(e).actMeanings(),a=[...new Set(i.map(c=>A(c,s)))].sort();if(J(e,`stops|${ke(t)}|${a.join("|")}`,()=>{let c=new Set(a),r=J(e,"waiting",()=>$(e)).filter(u=>P(u.author)&&!G(u)&&u.calls.some(g=>c.has(A(g,s))));return!(Oe(e,i,t)&&r.every(u=>Y(e,u,t)))}))return"Only somebody who may decide every suggestion of this kind can say not to suggest it."}function Mn(e,i,o){let n=m(e)?.store??e;return Re(n,i.calls,i.author,i.lineage,o??p(n).by)===void 0}function Pn(e,i,o={}){let n=m(e)?.store??e,t=o.author??p(n).by,s=M(n,i,t),a=o.intent??`Stopped suggesting ${We(n,s)}`;return n.undo(s.batch,{...o,author:t,intent:a,lineage:{basis:"A person said not to suggest this kind of thing",stopsKind:!0}})}function Dn(e,i,o={}){let n=m(e)?.store??e,t=o.author??p(n).by,s=M(n,i,t);if(s.author.kind!==t.kind||s.author.id!==t.id)throw new k("Only who made a suggestion withdraws it: a person declines it (declineSuggestion).");return n.undo(s.batch,{...o,author:t})}var Ge={kind:"system",id:"tidying",name:"Graview, tidying",automated:!0};U.op=(e,i,o,n,t,s)=>{let a=e,{suggestion:d,vote:c}=o.args,r=M(a,d,t),u=V(t)?L(t):void 0,g=c==="for"?`For: ${r.intent}`:c==="against"?`Against: ${r.intent}`:`Withdraws a vote on: ${r.intent}`;return{id:i.id,seq:a.log.length,batch:n,author:t,intent:g,mutation:o,primitives:[],reads:[],writes:[],...r.about.length>0?{described:r.about}:{},at:i.at,...s.via!==void 0?{via:s.via}:{},vote:{suggestion:d,vote:c,...u!==void 0?{advisory:!0,voter:u}:{}}}};U.accepting=(e,i)=>{let o=e,n=o.tidying?.autoAcceptAt;if(n===void 0||i.vote?.vote!=="for")return;let t=i.vote.suggestion,s=$(o).find(r=>r.id===t);if(!s)return;let d=[...z(o.log.all()).get(t)??[]].filter(([,r])=>r==="for").map(([r])=>r);if(d.length<n)return;let c=de(s.author)?s.author:Ge;return{calls:s.calls,author:c,lineage:{...s.lineage,suggestion:t,voters:d.slice(0,ue)}}};var G=e=>e.lineage?.proposedBy!==void 0,Fe=e=>e.author.name??e.author.id??"Somebody",Ue=e=>/s$/i.test(e)?`${e}'`:`${e}'s`;function Kn(e,i,o,n){let t=m(e)?.store??e,s=p(t).actMeanings(),a=x(o,s),d=$(t,i).find(r=>G(r)&&x(r.calls,s)===a);if(d)return t.log.get(d.id);let c={calls:o.map(({name:r,args:u})=>({name:r,args:u})),...b("intent",n)};return t.applyAll([{name:ge,args:c}],{author:i}).ops.find(r=>r.suggests!==void 0)}function In(e,i,o){if(!e||!e.grants.some(t=>t.propose!==void 0))return[];let n=new Set(oe(e,i,o));return o.filter(t=>!n.has(t)&&re(t).some(s=>ae(e,i,t.name,s)))}export{wn as a,$ as b,kn as c,Y as d,Ie as e,On as f,xn as g,We as h,Mn as i,Pn as j,Dn as k,G as l,Kn as m,In as n};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as P,c as pe,f as me,g as ge,h as he,i as ke,j as be}from"./chunk.
|
|
1
|
+
import{a as P,c as pe,f as me,g as ge,h as he,i as ke,j as be}from"./chunk.45OLF6BK.js";import{a as ue}from"./chunk.T6ISUVUP.js";import{$ as C,Ba as oe,C as W,Ca as re,Da as ie,Ea as se,H as v,Ha as U,J as E,K as Y,L as q,Ma as de,Oa as V,T as S,W as J,Wa as G,X as Q,Zb as ce,_a as ae,ab as le,ba as ee,cb as fe,ea as ne,ia as I,jc as O,lc as ye,ma as M,mc as K,sa as R,va as te}from"./chunk.ZDUKVXBI.js";var ve=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,Se={day:"day",week:"week",month:"month",year:"year"},N=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function Oe(t,e,n){let r=e.interval??1,d=Se[e.every],a=t.slice(0,10),l=r===1?`Every ${d}`:r===2?`Every other ${d}`:`Every ${r} ${d}s`,s;if(e.every==="week"){let c=(e.on?.length?e.on:[G[new Date(`${a}T00:00:00Z`).getUTCDay()]]).map(i=>ee(G.indexOf(i),"long",n));s=r===1?`Every ${N(c)}`:r===2?`Every other ${N(c)}`:`${l} on ${N(c)}`}else if(e.every==="month"){let c=(e.on?.length?e.on:[+a.slice(8,10)]).map(i=>i===-1?"the last day":`the ${ve(Number(i))}`);s=`${l} on ${N(c)}`}else e.every==="year"?s=`${l} on ${C(a,n)}`:s=l;return E.test(t)&&(s+=` at ${Q(t,n)}`),e.until&&(s+=`, until ${S(e.until,n)}`),e.count&&(s+=`, ${e.count===1?"once":`${e.count} times`}`),s}function we(t,e,n={}){if(!le(e)||typeof t!="string")return;let r=n.today??q(),d=fe(t,e,r),a=Oe(t,e,n.locale),l=d.slice(0,4)===r.slice(0,4)?C(d.slice(0,10),n.locale):S(d.slice(0,10),n.locale);return d.slice(0,10)<r?`${a}, last ${l}`:`${a}, next ${l}`}function ln(t,e){let n=new Map,r=new Map;for(let d of t){let a=M(e(d.kind),d).trim().toLowerCase();r.set(a,[...r.get(a)??[],d])}for(let d of r.values()){if(d.length<2)continue;let a=new Map;for(let l of d)a.set(l.kind,[...a.get(l.kind)??[],l]);for(let[l,s]of a){if(s.length===1){n.set(s[0].id,te(e(l),l));continue}let c=s.map(o=>new Map(Ne(o,e(o.kind)).map(p=>[p.key,p.alone]))),i=[...new Set(c.flatMap(o=>[...o.keys()]))],u=o=>c.every(p=>!/\d/.test(p.get(o)??"")),g=[...i.filter(u),...i.filter(o=>!u(o))],h=(o,p)=>p.map(y=>c[o].get(y)??"").filter(Boolean).join(" \xB7 "),z=o=>new Set(s.map((p,y)=>h(y,o))).size===s.length&&s.every((p,y)=>h(y,o)!==""),$=g.find(o=>z([o])),f=$?void 0:g.flatMap((o,p)=>g.slice(p+1).map(y=>[o,y])).find(o=>z(o));s.forEach((o,p)=>{if($||f)return void n.set(o.id,h(p,$?[$]:f));let y=g.find(k=>{let b=c[p].get(k);return b!==void 0&&b!==""&&c.every((_,x)=>x===p||_.get(k)!==b)});n.set(o.id,y?c[p].get(y):`${p+1} of ${s.length}`)})}}return n}function fn(t,e){return t?.describe?t.describe(e):`${e.kind} ${M(t,e)}`}var Ee=new Set(["id","kind","label"]);function Me(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function Ne(t,e,n={}){let r=e?.display,d=new Set([...Ee,...r?.hide??[]]);typeof t.label=="string"&&e?.label&&!M(e,t).includes(t.label)&&d.delete("label");let a=(n.said??[]).filter(f=>!!f),l=a.filter(f=>f.endsWith("\u2026")).map(f=>f.replace(/…$/,"").trim()).filter(f=>f.length>12),s=[],c=e?.fields?.shape,i=e?.fieldRoles,u=n.glance?r?.glance??[i?.who,i?.when].filter(f=>!!f):Ae(r?.page),g=n.glance&&r?.glance!==void 0,h=new Set(n.glance?[]:n.blanks??[]),$=[...new Set(g?u:[...u,...je(e),...Object.keys(t)])].filter(f=>Object.hasOwn(t,f)||h.has(f)).map(f=>[f,t[f]]);for(let[f,o]of $){if(d.has(f)||ge(e,f))continue;let p=c?.[f];if(h.has(f)&&!U(p)&&!V(p)&&(o==null||o===""||Array.isArray(o)&&o.length===0)){s.push({key:f,label:R(e,f),value:"",stored:"",alone:"",long:!1,blank:!0});continue}if(o==null)continue;let y=r?.format?.[f],k=y?[]:ie(o);if(k[0]&&n.glance)continue;let b=e?.fields?.shape?.[f],_=!y&&typeof o=="string"&&U(b)?o:void 0,x=!y&&typeof o=="string"&&ue(b);if(_&&n.glance)continue;let D=y?void 0:V(b),w=D?{relation:D,refs:de(o,D)}:void 0;if(w&&(n.glance||w.refs.length===0)||!k[0]&&typeof o=="object"&&(!Array.isArray(o)||o.some(m=>typeof m=="object"&&m!==null))&&y===void 0)continue;let Z=typeof o=="string"&&!y?we(o,t[`${f}Repeat`],{locale:n.locale}):void 0,F=k[0]?k.map(m=>`${m.caption?`${m.name} \u2014 ${m.caption}`:m.name}${oe(m)?` (${re(m)})`:""}`).join(", "):Array.isArray(o)?o.join(", "):typeof o=="boolean"?o?"Yes":"No":String(o),T=y?void 0:he(e,f),B=be(T,o),H=!y&&!T&&typeof o=="number"?O(e?.fields?.shape?.[f])??me(e,f):void 0,j=w?w.refs.length>1?`${w.refs.length} linked records`:"linked record":y?y(o):H?ye(o,H):ke(T,o,n.locale)??(Array.isArray(o)||typeof o=="boolean"?F:typeof o=="string"&&Z!==void 0?Z:typeof o=="string"&&v.test(o)&&(o.length===10||Fe(e,f))?S(o,n.locale):typeof o=="string"&&E.test(o)?J(o,n.locale,n.timeZone):typeof o=="string"&&Te(e,f)?P(e,f,o):F),X=typeof o=="string"&&Ie(e,f,j),A=(n.glance||n.excerpt)&&!y&&(X||x)?pe(j,{markdown:x}):j;if(a.includes(A)||l.some(m=>A.startsWith(m))||n.glance&&(typeof o=="string"||typeof o=="number")&&a.some(m=>Me(m,A)))continue;let L=R(e,f),xe=typeof o=="number"?`${L} ${A}`:typeof o=="boolean"&&!y?`${L}: ${A.toLowerCase()}`:A;if(s.push({key:f,label:L,value:A,stored:F,alone:xe,long:X,...x?{markdown:!0}:{},...k[0]?{files:k}:{},..._?{app:_}:{},...w?{linked:w}:{},...B?{href:B}:{},...ae(c?.[`${f}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&s.length>=n.limit)break}return ze(s,e)}function ze(t,e){let n=new Map;for(let r of t){let d=De(e,r.key);d&&n.set(r.key,new Set(d.map(a=>P(e,r.key,a).toLowerCase())))}return n.size<2?t:t.map(r=>{let d=n.get(r.key);return d!==void 0&&[...n].some(([l,s])=>l!==r.key&&[...d].some(c=>s.has(c)))?{...r,alone:`${r.label}: ${r.value.toLowerCase()}`}:r})}function De(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function Fe(t,e){let n=t?.fields?.shape?.[e]?._zod?.def;for(let r=0;r<6&&n?.innerType!==void 0;r++)n=n.innerType._zod?.def;return n?.type==="string"&&(n.checks??[]).some(r=>r._zod?.def?.pattern?.source===v.source)}function Te(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function je(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function Ae(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Le=500,We=160;function Ce(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function Ie(t,e,n){return Ce(t?.fields?.shape?.[e])?.checks?.some(d=>d._zod?.def?.check==="max_length"&&(d._zod.def.maximum??0)>Le)?!0:typeof n=="string"&&(n.includes(`
|
|
2
2
|
`)||n.length>We)}function un(t,e){let n=t?.display?.page,r=n?.groups??[],d=new Map(e.map(i=>[i.key,i])),a=new Set(Ae(n)),l=i=>i.flatMap(u=>d.has(u)?[d.get(u)]:[]),s=e.filter(i=>!a.has(i.key));return[{fields:[...l(n?.fields??[]),...r.length>0?[]:s]},...r.map(i=>({title:i.title,fields:l(i.fields)})),...r.length>0?[{title:"Details",fields:s}]:[]].filter(i=>i.fields.length>0)}function Ue(t,e,n){let r=[...e?.creates??[],...e?.subject&&e.subject.kinds!=="*"?e.subject.kinds:[]];for(let d of r){let a=t.tryDefinition(d),l=a?.fields?.shape??{};if(!a||!(n in l))continue;let s=a.display?.format?.[n];return{label:a.display?.labels?.[n]??R(a,n),option:i=>s?s(i):I(i)}}return{label:R(void 0,n),option:d=>I(d)}}function gn(t,e,n){if(n instanceof ce){let r=e.find(a=>a.name===n.mutation);return`Not yet: ${n.issues.map(a=>{let l=a.path.length>0?Ue(t,r,String(a.path[0])).label:void 0;return l?`${l} \u2014 ${ne(a.message)}`:a.message}).join("; ")}.`}return n instanceof Error?n.message:String(n)}var Ve=t=>/^[A-Z]{3}$/.test(t??"");function $e(t){let{format:e,unit:n,currency:r,locale:d,places:a}=t,l=Ve(n),s=e==="money"||!e&&l,c=s?l?n:r:void 0;return{...s?{format:"money"}:e?{format:e}:{},...n&&!(s&&l)?{unit:n}:{},...c?{currency:c}:{},...d?{locale:d}:{},...s&&a===0?{places:a}:{}}}function kn(t){switch(t.format){case"money":return t.currency?`An amount of money in ${t.currency}: a plain number, 1250.5 for 1,250.50 ${t.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return t.unit?`A number of ${t.unit}.`:"A number."}}function Re(t){let e=W(t)?.innerType;return e===void 0?t:Re(e)}var Ge={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ke=t=>(t?._zod?.def?.checks??[]).map(e=>e._zod?.def).filter(e=>e!==void 0);function _e(t){let e=Re(t),n=W(e),r=n?.type,d=Ke(e);if(r==="enum")return{type:"choice",options:Object.keys(n?.entries??{})};let a=se(e);if(a)return a==="image"?{type:"file",image:!0}:a==="video"?{type:"file",video:!0}:{type:"file"};if(r==="boolean")return{type:"boolean"};if(r==="array"){let l=_e(n?.element);return l.type==="unknown"?{type:"unknown"}:{type:"several",of:l}}if(r==="number"){let l,s,c;for(let i of d){i.check==="multiple_of"&&typeof i.value=="number"?c=i.value:i.check==="number_format"&&(i.format==="safeint"||i.format==="int32"||i.format==="uint32")&&(c??=1);let u=i.check==="number_format"&&i.format?Ge[i.format]:void 0,g=u?u[0]:i.check==="greater_than"&&i.inclusive&&typeof i.value=="number"?i.value:void 0,h=u?u[1]:i.check==="less_than"&&i.inclusive&&typeof i.value=="number"?i.value:void 0;g!==void 0&&(l=l===void 0?g:Math.max(l,g)),h!==void 0&&(s=s===void 0?h:Math.min(s,h))}return{type:"number",...l===void 0?{}:{min:l},...s===void 0?{}:{max:s},...c===void 0?{}:{step:c},...K(e)==="duration"?{duration:!0}:{},...O(t)?{amount:$e(O(t))}:{}}}if(r==="string"){if(d.some(u=>u.fn===Y||u.format==="datetime")||n?.format==="datetime")return{type:"date",time:!0,instant:!0};let s=[n?.pattern,...d.map(u=>u.pattern)].filter(u=>u instanceof RegExp).map(u=>u.source);if(s.some(u=>u.includes("\\d{4}")))return s.some(u=>u.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:s.includes(v.source)?{type:"date",partial:!0}:{type:"date"};let c=d.some(u=>u.check==="max_length"&&typeof u.maximum=="number"&&u.maximum>500),i=K(e);return c?{type:"text",long:!0}:i==="phone"||i==="place"?{type:"text",holds:i}:{type:"text"}}return{type:"unknown"}}function vn(t,e){let n=t?.shape;return!n||!(e in n)?{type:"unknown"}:_e(n[e])}export{Oe as a,ln as b,fn as c,Ne as d,un as e,$e as f,kn as g,Re as h,_e as i,vn as j,Ue as k,gn as l};
|