graview 0.1.65 → 0.1.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/preview/{chunk.3IZEZPJB.js → chunk.25QFDTCU.js} +1 -1
- package/dist/preview/{chunk.SOMRYDDH.js → chunk.264PB572.js} +1 -1
- package/dist/preview/chunk.2FHIINXG.js +2 -0
- package/dist/preview/chunk.2VUX54XH.js +1 -0
- package/dist/preview/chunk.32SHA3EY.js +1 -0
- package/dist/preview/{chunk.ZDUTEM3Z.js → chunk.35KMZHB7.js} +1 -1
- package/dist/preview/{chunk.74B6KQF4.js → chunk.37RFCHSS.js} +1 -1
- package/dist/preview/chunk.3ENPWZBG.js +1 -0
- package/dist/preview/chunk.3GNT5MKP.js +50 -0
- package/dist/preview/chunk.3NSV3WKM.js +22 -0
- package/dist/preview/chunk.3ZODN6BW.js +1 -0
- package/dist/preview/{chunk.7VQ3C7F4.js → chunk.47XEJZ3O.js} +1 -1
- package/dist/preview/{chunk.KIQXTQDU.js → chunk.4EMKCKDB.js} +1 -1
- package/dist/preview/{chunk.LKK5YF2H.js → chunk.4UUJHLHR.js} +1 -1
- package/dist/preview/{chunk.L6FGKJ5H.js → chunk.4W57E7AX.js} +1 -1
- package/dist/preview/chunk.55G4IPOO.js +1 -0
- package/dist/preview/chunk.5AKZROMR.js +1 -0
- package/dist/preview/chunk.5J6DVR7S.js +1 -0
- package/dist/preview/chunk.5R744JGZ.js +19 -0
- package/dist/preview/{chunk.64FCAUAJ.js → chunk.6KJGRM7A.js} +1 -1
- package/dist/preview/{chunk.INTJD5WG.js → chunk.6N4PE3U5.js} +1 -1
- package/dist/preview/{chunk.44ZHHPPJ.js → chunk.6NG76MDA.js} +2 -2
- package/dist/preview/chunk.6SJEZWH3.js +1 -0
- package/dist/preview/chunk.6UQFV53C.js +1 -0
- package/dist/preview/chunk.6W6XMLSF.js +1 -0
- package/dist/preview/chunk.77C556NM.js +1 -0
- package/dist/preview/{chunk.7E4CSXBT.js → chunk.7ARRVNUR.js} +1 -1
- package/dist/preview/chunk.7BJRHPE3.js +23 -0
- package/dist/preview/{chunk.TY74U3EI.js → chunk.7S6ZRMW4.js} +1 -1
- package/dist/preview/{chunk.F5VEHAP2.js → chunk.7UHPHEH5.js} +1 -1
- package/dist/preview/chunk.7WHQWLL6.js +1 -0
- package/dist/preview/{chunk.NSO6RUKW.js → chunk.A4EZAGG7.js} +1 -1
- package/dist/preview/chunk.A5PSEU3W.js +25 -0
- package/dist/preview/{chunk.2TZSLREX.js → chunk.A7GVTE5Y.js} +2 -2
- package/dist/preview/chunk.AJMVRFYX.js +5 -0
- package/dist/preview/chunk.AKJS2NUM.js +1 -0
- package/dist/preview/chunk.ARWO4WOV.js +1 -0
- package/dist/preview/chunk.B5SJMCTT.js +7 -0
- package/dist/preview/{chunk.2QQ37RCZ.js → chunk.B7KZBT27.js} +1 -1
- package/dist/preview/chunk.BDNQMKDG.js +35 -0
- package/dist/preview/chunk.BKYZSV2Y.js +2 -0
- package/dist/preview/chunk.CEQQIW7Z.js +1 -0
- package/dist/preview/chunk.CKDCTFLU.js +1 -0
- package/dist/preview/chunk.CTUJZ3IV.js +1 -0
- package/dist/preview/chunk.CY7FFKEZ.js +1 -0
- package/dist/preview/chunk.D4WJ7OM5.js +1 -0
- package/dist/preview/{chunk.AB4RZSYW.js → chunk.D7NWMXSX.js} +16 -16
- package/dist/preview/chunk.DEKRFTRN.js +4 -0
- package/dist/preview/{chunk.6YDC6IDA.js → chunk.DKEIEH2D.js} +1 -1
- package/dist/preview/{chunk.S2DOVJRL.js → chunk.DWM7AR5Y.js} +1 -1
- package/dist/preview/{chunk.FHHVW2WB.js → chunk.DZMIYEHQ.js} +1 -1
- package/dist/preview/chunk.E5PYNAYT.js +21 -0
- package/dist/preview/chunk.EBKH3ILT.js +1 -0
- package/dist/preview/chunk.EFVSZKB5.js +1 -0
- package/dist/preview/chunk.EG7OOJH5.js +1 -0
- package/dist/preview/chunk.EGPCVMDU.js +1 -0
- package/dist/preview/{chunk.C437FVD7.js → chunk.EJ2EZL2G.js} +1 -1
- package/dist/preview/{chunk.IR4OW67N.js → chunk.EP6Q32WT.js} +1 -1
- package/dist/preview/{chunk.G3Q5IMM3.js → chunk.F464JKHZ.js} +1 -1
- package/dist/preview/{chunk.IFBGYFS4.js → chunk.FLJXYESX.js} +1 -1
- package/dist/preview/chunk.FOUBDGL3.js +1 -0
- package/dist/preview/chunk.FPHRAO3R.js +1 -0
- package/dist/preview/chunk.FRQSLWP4.js +1 -0
- package/dist/preview/chunk.FVQKSN33.js +1 -0
- package/dist/preview/{chunk.CGQ6KXVK.js → chunk.G3GFDVO2.js} +1 -1
- package/dist/preview/{chunk.4O3C2LJF.js → chunk.G5GVT6JY.js} +1 -1
- package/dist/preview/chunk.GFLH7RCI.js +1 -0
- package/dist/preview/chunk.GG47EIKO.js +1 -0
- package/dist/preview/chunk.GMLONS5L.js +1 -0
- package/dist/preview/{chunk.RFVOXX3P.js → chunk.GRFD42WM.js} +1 -1
- package/dist/preview/{chunk.2PK335JQ.js → chunk.GVT4UUQA.js} +1 -1
- package/dist/preview/{chunk.5M34BJIQ.js → chunk.H3EGBDW2.js} +1 -1
- package/dist/preview/chunk.H6KIEDZN.js +1 -0
- package/dist/preview/chunk.HAOB6O72.js +1 -0
- package/dist/preview/chunk.HB5NWHFP.js +3 -0
- package/dist/preview/{chunk.GPCKOYSF.js → chunk.HJUZMOW2.js} +1 -1
- package/dist/preview/chunk.HN4ZJ4B4.js +1 -0
- package/dist/preview/chunk.HVBKI5ZO.js +1 -0
- package/dist/preview/chunk.I3SDKMQS.js +1 -0
- package/dist/preview/chunk.IAEGJDF3.js +1 -0
- package/dist/preview/{chunk.CS72MISN.js → chunk.IDALEKIW.js} +1 -1
- package/dist/preview/chunk.ILJDLBPJ.js +1 -0
- package/dist/preview/chunk.J2OPIS3H.js +111 -0
- package/dist/preview/chunk.J5OLYVZ4.js +1 -0
- package/dist/preview/{chunk.3KUYB5ZT.js → chunk.J6HF7IRQ.js} +1 -1
- package/dist/preview/chunk.JEC5FDKX.js +1 -0
- package/dist/preview/chunk.JKFVNQY7.js +1 -0
- package/dist/preview/chunk.JO2X52D4.js +1 -0
- package/dist/preview/{chunk.LVD3V77M.js → chunk.JQ2WNKDW.js} +1 -1
- package/dist/preview/{chunk.NBVPWLRY.js → chunk.JQ63N4MZ.js} +1 -1
- package/dist/preview/{chunk.7Q43N5JS.js → chunk.JU6UFWS3.js} +1 -1
- package/dist/preview/chunk.JVB5KDSG.js +1 -0
- package/dist/preview/chunk.KFT7JIEH.js +1 -0
- package/dist/preview/chunk.KGMSSXZL.js +1 -0
- package/dist/preview/chunk.KX5ZBHMA.js +2 -0
- package/dist/preview/{chunk.XTTESA7X.js → chunk.LP2ZMAT2.js} +1 -1
- package/dist/preview/{chunk.IMKD6QQG.js → chunk.LRNFE3UK.js} +1 -1
- package/dist/preview/{chunk.BUQKRXI6.js → chunk.LVOTLGJB.js} +1 -1
- package/dist/preview/chunk.LYEGRY77.js +3 -0
- package/dist/preview/{chunk.B3WVCSW5.js → chunk.M5FP4Y4Q.js} +1 -1
- package/dist/preview/{chunk.MH46V556.js → chunk.M7KXQGQL.js} +1 -1
- package/dist/preview/{chunk.LY5CY7GE.js → chunk.MAKCZ6B6.js} +1 -1
- package/dist/preview/{chunk.5THLLSS4.js → chunk.MJY4SLWA.js} +1 -1
- package/dist/preview/{chunk.J6KNEI5R.js → chunk.MSAYU25L.js} +1 -1
- package/dist/preview/chunk.MUSMNKE4.js +1 -0
- package/dist/preview/chunk.MW7R5G3C.js +1 -0
- package/dist/preview/chunk.N4ZKZ4GM.js +6 -0
- package/dist/preview/chunk.NAXOXBOF.js +1 -0
- package/dist/preview/{chunk.LGRQDILY.js → chunk.NKLPL7QD.js} +1 -1
- package/dist/preview/chunk.NKYWIGC7.js +3 -0
- package/dist/preview/{chunk.35E75QJ7.js → chunk.NRURQGXV.js} +1 -1
- package/dist/preview/chunk.NSOPYIT4.js +1 -0
- package/dist/preview/chunk.NXZL5CA2.js +1 -0
- package/dist/preview/chunk.NYLKG25K.js +4 -0
- package/dist/preview/{chunk.BU5PVRX7.js → chunk.O2OL6RQQ.js} +1 -1
- package/dist/preview/chunk.O5VFKVZS.js +1 -0
- package/dist/preview/chunk.OCXY5DCD.js +6 -0
- package/dist/preview/chunk.OHAO6KKH.js +1 -0
- package/dist/preview/{chunk.CXDGE5ZS.js → chunk.OWO3OV62.js} +1 -1
- package/dist/preview/chunk.P2EKKKK2.js +1 -0
- package/dist/preview/chunk.PSNMZBVS.js +1 -0
- package/dist/preview/{chunk.NKYYDFIX.js → chunk.PZ7KY6XH.js} +1 -1
- package/dist/preview/chunk.QAM76AXV.js +1 -0
- package/dist/preview/chunk.QDVGHI7R.js +1 -0
- package/dist/preview/{chunk.HJS3LTSR.js → chunk.QF5QB5YR.js} +1 -1
- package/dist/preview/chunk.QNP5OR3P.js +93 -0
- package/dist/preview/chunk.QRQ5WPZI.js +1 -0
- package/dist/preview/chunk.QWGWOEBZ.js +90 -0
- package/dist/preview/chunk.QXLJGHMC.js +23 -0
- package/dist/preview/{chunk.3RFAUIGT.js → chunk.QZQCQWQG.js} +1 -1
- package/dist/preview/chunk.R6JBA7UK.js +1 -0
- package/dist/preview/chunk.R7CRBRD4.js +1 -0
- package/dist/preview/chunk.RD2FSSLV.js +1 -0
- package/dist/preview/{chunk.CD6YWH6T.js → chunk.RG5G6YQD.js} +1 -1
- package/dist/preview/{chunk.T3KNLP7C.js → chunk.RJY7VJBH.js} +1 -1
- package/dist/preview/chunk.RR25BGWP.js +1 -0
- package/dist/preview/chunk.RSMCTI2N.js +1 -0
- package/dist/preview/{chunk.ZYNC73DJ.js → chunk.RSQ432QN.js} +1 -1
- package/dist/preview/chunk.SFBHPYRD.js +1 -0
- package/dist/preview/{chunk.FOSY7MZF.js → chunk.SJQPTDAT.js} +1 -1
- package/dist/preview/{chunk.TUCSUZNO.js → chunk.SNHKYH72.js} +1 -1
- package/dist/preview/chunk.SO6NT5K7.js +1 -0
- package/dist/preview/{chunk.FDWRH5P2.js → chunk.STPA7HBK.js} +3 -3
- package/dist/preview/{chunk.R2TSTDS3.js → chunk.SY5ID44D.js} +1 -1
- package/dist/preview/chunk.T27QKVKP.js +1 -0
- package/dist/preview/{chunk.FXG5AJF6.js → chunk.T2OUHRAA.js} +1 -1
- package/dist/preview/chunk.T3WCRS6M.js +1 -0
- package/dist/preview/chunk.TI5FR2QQ.js +1 -0
- package/dist/preview/{chunk.N2FNHRI2.js → chunk.TTSGCNPT.js} +1 -1
- package/dist/preview/{chunk.P6TZGR3A.js → chunk.TXZQEJ5T.js} +1 -1
- package/dist/preview/chunk.U6QXLNHF.js +15 -0
- package/dist/preview/{chunk.DICM56FT.js → chunk.UDHPMVC4.js} +1 -1
- package/dist/preview/{chunk.ZMWAZACO.js → chunk.UGQYMN4J.js} +1 -1
- package/dist/preview/chunk.UJPX3BUV.js +1 -0
- package/dist/preview/{chunk.CPYBJNHP.js → chunk.UQIPEMJ5.js} +1 -1
- package/dist/preview/{chunk.XSWR5LI4.js → chunk.URQTF5SY.js} +1 -1
- package/dist/preview/{chunk.7IGD2K4M.js → chunk.UW52CMGJ.js} +1 -1
- package/dist/preview/chunk.UWS4RMM3.js +1 -0
- package/dist/preview/{chunk.KHAVEYT7.js → chunk.V7H4BUEB.js} +1 -1
- package/dist/preview/{chunk.KHRS2SKB.js → chunk.VBHV4TLG.js} +1 -1
- package/dist/preview/chunk.VBLQJVQ5.js +1 -0
- package/dist/preview/{chunk.SPCAMQJE.js → chunk.WALVW3KJ.js} +1 -1
- package/dist/preview/{chunk.6RZHKQP3.js → chunk.WEMUKZKH.js} +1 -1
- package/dist/preview/chunk.X226YATK.js +2 -0
- package/dist/preview/{chunk.IJ3YDBWI.js → chunk.XFLGSUYO.js} +1 -1
- package/dist/preview/{chunk.ZTN7BS5O.js → chunk.XSWSBTUO.js} +1 -1
- package/dist/preview/{chunk.ZJFXM3LE.js → chunk.YCD4JSXD.js} +1 -1
- package/dist/preview/{chunk.QSDBF7VL.js → chunk.YZPESGCP.js} +1 -1
- package/dist/preview/{chunk.QO5RXOCS.js → chunk.Z27NSSYL.js} +2 -2
- package/dist/preview/chunk.Z2XUVJAL.js +1 -0
- package/dist/preview/{chunk.S3EEY7T3.js → chunk.Z3O2VZAJ.js} +1 -1
- package/dist/preview/chunk.Z4TY44CD.js +1 -0
- package/dist/preview/{chunk.O2W5JTWA.js → chunk.ZAPS4J6G.js} +1 -1
- package/dist/preview/{chunk.F2TWV4TX.js → chunk.ZAQ4IDX6.js} +1 -1
- package/dist/preview/chunk.ZEZUKRC6.js +5 -0
- package/dist/preview/{chunk.PTQPS2FJ.js → chunk.ZG5VGP5U.js} +1 -1
- package/dist/preview/chunk.ZRBGYXAO.js +6 -0
- package/dist/preview/index.html +57 -55
- package/dist/preview/page.js +2 -2
- package/dist/preview/splash.js +17 -14
- package/package.json +6 -6
- package/dist/preview/chunk.2P34ML3O.js +0 -111
- package/dist/preview/chunk.2UW5CRHF.js +0 -1
- package/dist/preview/chunk.2YMO7ZVX.js +0 -1
- package/dist/preview/chunk.33ULA3CG.js +0 -1
- package/dist/preview/chunk.3CJLAJXP.js +0 -25
- package/dist/preview/chunk.3IJSB5ET.js +0 -1
- package/dist/preview/chunk.3KO35VN4.js +0 -1
- package/dist/preview/chunk.3L37FY3G.js +0 -4
- package/dist/preview/chunk.3WP66LB5.js +0 -1
- package/dist/preview/chunk.4GJ7F4SP.js +0 -35
- package/dist/preview/chunk.4IJTPV5X.js +0 -1
- package/dist/preview/chunk.4JFBLVXJ.js +0 -1
- package/dist/preview/chunk.4PCVQEVI.js +0 -1
- package/dist/preview/chunk.5FQSYMAE.js +0 -1
- package/dist/preview/chunk.5NCLZ4NZ.js +0 -1
- package/dist/preview/chunk.5YNLFOBJ.js +0 -5
- package/dist/preview/chunk.77XQEDT5.js +0 -1
- package/dist/preview/chunk.7HPQI5SY.js +0 -1
- package/dist/preview/chunk.A4VA3DU5.js +0 -1
- package/dist/preview/chunk.ABSY3UZF.js +0 -1
- package/dist/preview/chunk.ARHAD5IS.js +0 -1
- package/dist/preview/chunk.BOC2EOGB.js +0 -9
- package/dist/preview/chunk.BR6TINGU.js +0 -1
- package/dist/preview/chunk.CDEAAWPS.js +0 -1
- package/dist/preview/chunk.CXJJB3MK.js +0 -1
- package/dist/preview/chunk.CXLQPE4J.js +0 -1
- package/dist/preview/chunk.DA4RSHLW.js +0 -1
- package/dist/preview/chunk.DJMSXXP4.js +0 -90
- package/dist/preview/chunk.DJPNVXBQ.js +0 -6
- package/dist/preview/chunk.DJVHKBEI.js +0 -1
- package/dist/preview/chunk.DVSTLVIH.js +0 -15
- package/dist/preview/chunk.E5WJSTOV.js +0 -1
- package/dist/preview/chunk.FEGSYSA7.js +0 -1
- package/dist/preview/chunk.HJUXC5GM.js +0 -1
- package/dist/preview/chunk.HNMSYQRA.js +0 -1
- package/dist/preview/chunk.HWLRKOI3.js +0 -1
- package/dist/preview/chunk.IHUMKFYH.js +0 -10
- package/dist/preview/chunk.IQ54QTA5.js +0 -1
- package/dist/preview/chunk.IQC3GOXO.js +0 -1
- package/dist/preview/chunk.ISN2QTVL.js +0 -2
- package/dist/preview/chunk.J24YPQ5I.js +0 -5
- package/dist/preview/chunk.J545NAMY.js +0 -1
- package/dist/preview/chunk.K2HDEL7I.js +0 -1
- package/dist/preview/chunk.K3JARAWU.js +0 -1
- package/dist/preview/chunk.KROR65KD.js +0 -2
- package/dist/preview/chunk.KV7GZBJ6.js +0 -50
- package/dist/preview/chunk.L7NJLZWV.js +0 -1
- package/dist/preview/chunk.LON75VHP.js +0 -1
- package/dist/preview/chunk.LQWVJQ5X.js +0 -18
- package/dist/preview/chunk.M5W2RHC6.js +0 -1
- package/dist/preview/chunk.M6BTLH24.js +0 -1
- package/dist/preview/chunk.MAGKI4PD.js +0 -1
- package/dist/preview/chunk.MD36ZSM5.js +0 -74
- package/dist/preview/chunk.MFZJVHWP.js +0 -1
- package/dist/preview/chunk.MHTA4HYB.js +0 -19
- package/dist/preview/chunk.N2YM247R.js +0 -1
- package/dist/preview/chunk.N35SJWAM.js +0 -1
- package/dist/preview/chunk.NJSK3UO2.js +0 -6
- package/dist/preview/chunk.OHMHPTEW.js +0 -1
- package/dist/preview/chunk.OJGHDWI6.js +0 -1
- package/dist/preview/chunk.PV2I4UPH.js +0 -1
- package/dist/preview/chunk.QFQSSZN7.js +0 -1
- package/dist/preview/chunk.RSS6OHXG.js +0 -1
- package/dist/preview/chunk.SBCAYTMT.js +0 -1
- package/dist/preview/chunk.SMTGRCMG.js +0 -3
- package/dist/preview/chunk.TCZIZ2PU.js +0 -1
- package/dist/preview/chunk.U74PTRHJ.js +0 -1
- package/dist/preview/chunk.UAORKZLO.js +0 -1
- package/dist/preview/chunk.UDVTPI2W.js +0 -1
- package/dist/preview/chunk.UETLP5KC.js +0 -1
- package/dist/preview/chunk.UHI3X2YD.js +0 -1
- package/dist/preview/chunk.UL62ELNR.js +0 -1
- package/dist/preview/chunk.VRYSZYAD.js +0 -1
- package/dist/preview/chunk.VUZFLDOX.js +0 -1
- package/dist/preview/chunk.X2NGFOAF.js +0 -1
- package/dist/preview/chunk.XE762VL2.js +0 -2
- package/dist/preview/chunk.Y2RZ5B4U.js +0 -1
- package/dist/preview/chunk.YKMBXMZE.js +0 -1
- package/dist/preview/chunk.Z34KASY7.js +0 -1
- package/dist/preview/chunk.ZMGKWMID.js +0 -1
- package/dist/preview/chunk.ZT5YQSSP.js +0 -21
- package/dist/preview/chunk.ZZM75ZTN.js +0 -4
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import{a as I,j as M,k as O}from"./chunk.5R744JGZ.js";import"./chunk.O2OL6RQQ.js";import{g as P}from"./chunk.J6HF7IRQ.js";import{l as D}from"./chunk.LRNFE3UK.js";import"./chunk.SO6NT5K7.js";import"./chunk.MUSMNKE4.js";import"./chunk.SJQPTDAT.js";import{a as C}from"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{G as q,W as F}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{la as L,sd as E}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as N}from"./chunk.AJZBJBMO.js";var f=N(q(),1);var n=N(F(),1),R=40,B=60;function T(l,o,s){return l.allNodes().filter(i=>i.kind===o).map(i=>i[s])}function Y(l){if(l.length<2)return[];let o=[...l].sort((a,d)=>a-d),s=o[o.length-1]-o[0];if(s<=0)return[];let i=Math.max(1,10**Math.floor(Math.log10(s/4))),e=s/4>=i*5?i*5:i,t=a=>Math.round(a/e)*e;return[...new Set([.2,.4,.6,.8].map(a=>t(o[Math.floor(a*(o.length-1))])))].filter(a=>a>0)}function _(l,o,s){let i=new Set(s.far??[]),e=new Map;for(let t of o.allNodes())i.has(t.kind)&&e.set(t.id,L(l.tryDefinition(t.kind),t));return[...e.entries()].map(([t,a])=>({id:t,label:a}))}function K(l,o,s){let i=_(l,o,s);return(i.length<=R?i:i.map(t=>({end:t,ties:o.out(t.id).length+o.in(t.id).length})).sort((t,a)=>a.ties-t.ties||t.end.label.localeCompare(a.end.label)).slice(0,R).map(t=>t.end)).sort((t,a)=>t.label.localeCompare(a.label))}function U(l,o,s){let i=[];for(let e of s.filters){let t=i.length;if(e.about==="is")for(let a of e.options??[])i.push({value:`is:${a}`,label:a,group:e.label,condition:{key:"is",value:a}});else if(e.about==="edge"){i.push({value:`${e.key}:*`,label:"anything",group:e.label,condition:{key:e.key,value:"*"}}),i.push({value:`${e.key}:none`,label:"nothing",group:e.label,condition:{key:e.key,value:"none"}});for(let a of K(l,o,e))i.push({value:`${e.key}:${a.id}`,label:a.label,group:e.label,condition:{key:e.key,value:a.id}})}else if(e.type==="date")for(let a of["before","after","on"])i.push({value:`${e.key}:${a}`,label:`${a}\u2026`,group:e.label,ask:{key:e.key,op:a,label:e.label}});else if(e.type==="number"){let a=l.tryDefinition(s.kind),d=Y(T(o,s.kind,e.key).filter(p=>typeof p=="number"));for(let p of["at-most","at-least"])for(let v of p==="at-most"?d:[...d].reverse())i.push({value:`${e.key}:${p}:${v}`,label:`${p==="at-most"?"at most":"at least"} ${C(a,e.key,v)}`,group:e.label,condition:{key:e.key,value:`${p}:${v}`}})}else if(e.type==="text"){let a=[...new Set(T(o,s.kind,e.key).filter(d=>typeof d=="string"&&d.length>0&&!d.includes(",")))].sort((d,p)=>d.localeCompare(p));if(a.length>=2&&a.length<=B)for(let d of a)i.push({value:`${e.key}:${d}`,label:d,group:e.label,condition:{key:e.key,value:d}})}else if(e.type==="boolean")i.push({value:`${e.key}:true`,label:"yes",group:e.label,condition:{key:e.key,value:"true"}}),i.push({value:`${e.key}:false`,label:"no",group:e.label,condition:{key:e.key,value:"false"}});else if(e.about==="via"){let a=l.tryDefinition(e.far?.[0]??"");for(let d of e.options??[])i.push({value:`${e.key}:${d}`,label:C(a,e.key.split(".")[1],d),group:e.label,condition:{key:e.key,value:d}})}else for(let a of e.options??[])i.push({value:`${e.key}:${a}`,label:C(l.tryDefinition(s.kind),e.key,a),group:e.label,condition:{key:e.key,value:a}});for(let a=t;a<i.length;a++)i[a]={...i[a],key:e.key}}return i}function V(l,o,s,i){let e=l.tryDefinition(o);return["at-most","at-least"].map(t=>({value:`${s.key}:${t}:${i}`,label:`${t==="at-most"?"at most":"at least"} ${C(e,s.key,i)}`,group:s.label,key:s.key,condition:{key:s.key,value:`${t}:${i}`}}))}function G(l){let o=l.trim().replace(/(?<=\d),(?=\d{3}\b)/g,"");return/^-?\d+(\.\d+)?$/.test(o)?Number(o):null}function j(l,o,s){let i=U(l,o,s);return s.filters.flatMap(e=>{let t=i.filter(d=>d.key===e.key);if(e.type==="number"&&e.about!=="edge")return[{key:e.key,label:e.label,entries:t,atNumber:d=>V(l,s.kind,e,d)}];if(t.length===0)return[];if(e.about!=="edge")return[{key:e.key,label:e.label,entries:t}];let a=_(l,o,e);return a.length<I?[{key:e.key,label:e.label,entries:t}]:[{key:e.key,label:e.label,entries:t.filter(d=>d.value===`${e.key}:*`||d.value===`${e.key}:none`),typed:[...a].sort((d,p)=>d.label.localeCompare(p.label))}]})}var z=8;function H(l,o){let s=o.trim().toLocaleLowerCase();if(!s)return{shown:[],more:0};let e=[...l.filter(t=>t.label.toLocaleLowerCase().includes(s))].sort((t,a)=>+!t.label.toLocaleLowerCase().startsWith(s)-+!a.label.toLocaleLowerCase().startsWith(s));return{shown:e.slice(0,z),more:Math.max(0,e.length-z)}}var J=["day","week","month","year","decade"];function ie(l){let{which:o,schema:s,graph:i,offers:e,arrangement:t,set:a,toggle:d,has:p,done:v}=l,m=l.testId,A=(0,f.useRef)(null);(0,f.useEffect)(()=>{let u=A.current?.closest("[data-graview-popover]");!u||document.activeElement!==u||(u.querySelector('[aria-pressed="true"]')??u.querySelector("button, input"))?.focus({preventScroll:!0})},[]);let y=t.sort?e.sorts.find(u=>u.key===t.sort.by):void 0,S=t.group?e.groups.find(u=>u.key===t.group.by):void 0,b=O(y),r=e.natural?e.sorts.find(u=>u.key===e.natural.by):void 0,k=o==="filter"||o==="all"&&l.parts?.filter?j(s,i,e):[],w=u=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{children:"Sort by"}),(0,n.jsx)($,{testId:`${m}-sort-default`,value:"",on:!t.sort,onPress:()=>(a({sort:void 0}),u()),children:r?`As declared (${M(r.label)})`:"As they were added"}),e.sorts.map(g=>(0,n.jsx)($,{value:g.key,on:t.sort?.by===g.key,onPress:()=>(a({sort:{by:g.key,direction:t.sort?.direction??"asc"}}),u()),children:g.label},g.key)),t.sort?(0,n.jsxs)("div",{role:"group","aria-label":"Order","data-testid":`${m}-direction`,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:"Order"}),["asc","desc"].map(g=>(0,n.jsx)($,{testId:`${m}-direction-${g}`,value:g,on:t.sort.direction===g,onPress:()=>(a({sort:{by:t.sort.by,direction:g}}),u()),children:b[g]},g))]}):null]}),c=u=>(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("p",{children:"Group by"}),(0,n.jsx)($,{testId:`${m}-group-none`,value:"",on:!t.group,onPress:()=>(a({group:void 0}),u()),children:"Not grouped"}),e.groups.map(g=>(0,n.jsx)($,{value:g.key,on:t.group?.by===g.key,onPress:()=>(a({group:{by:g.key}}),u()),children:g.label},g.key)),t.group&&S?.buckets?(0,n.jsxs)("div",{role:"group","aria-label":"How wide a group is","data-testid":`${m}-bucket`,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:"Each group"}),J.map(g=>(0,n.jsx)($,{testId:`${m}-bucket-${g}`,value:g,on:(t.group.bucket??"day")===g,onPress:()=>(a({group:{by:t.group.by,bucket:g}}),u()),children:`A ${g}`},g))]}):null]}),x=u=>(0,n.jsx)(Q,{sections:k,has:p,testId:m,onToggle:g=>(d(g),u())}),h=l.parts??{sort:!0,group:!0,filter:!0};return(0,n.jsxs)("div",{ref:A,style:{display:"contents"},children:[(0,n.jsx)("style",{children:Z}),o==="sort"?w(v):o==="group"?c(v):o==="filter"?x(v):(0,n.jsxs)(n.Fragment,{children:[h.sort?(0,n.jsx)("div",{role:"group","aria-label":"Sort",children:w(v)}):null,h.group?(0,n.jsx)("div",{role:"group","aria-label":"Group",children:c(v)}):null,h.filter?(0,n.jsx)("div",{role:"group","aria-label":"Filter",children:x(v)}):null]})]})}function $({value:l,on:o,onPress:s,testId:i,children:e}){return(0,n.jsx)("button",{type:"button",className:"graview-arrange-item",value:l,"data-value":l,"aria-pressed":o,onClick:s,...i?{"data-testid":i}:{},children:e})}function Q({sections:l,has:o,testId:s,onToggle:i}){let[e,t]=(0,f.useState)(null),[a,d]=(0,f.useState)(""),[p,v]=(0,f.useState)(()=>new Set(l.length===1?[l[0].key]:[])),[m,A]=(0,f.useState)({});if(e)return(0,n.jsx)(X,{ask:e,testId:s,onDay:r=>i({key:e.key,value:`${e.op}:${r}`}),onCancel:()=>t(null)});let y=r=>(0,n.jsx)($,{value:r.value,on:r.condition?o(r.condition):!1,onPress:()=>r.condition?i(r.condition):t(r.ask),children:r.label},r.value),S=(r,k)=>{let w=(r.typed??[]).filter(h=>o({key:r.key,value:h.id})),c=H(r.typed??[],k),x=[...w,...c.shown.filter(h=>!w.includes(h))];return(0,n.jsxs)(n.Fragment,{children:[x.map(h=>y({value:`${r.key}:${h.id}`,label:h.label,group:r.label,key:r.key,condition:{key:r.key,value:h.id}})),k.trim()&&c.shown.length===0?(0,n.jsx)("span",{className:"graview-arrange-none",children:"None is called that."}):null,c.more>0?(0,n.jsx)("span",{className:"graview-arrange-none",children:`${c.more} more \u2014 type more of the name`}):null]})},b=a.trim().toLocaleLowerCase();return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("label",{className:"graview-arrange-find",children:[(0,n.jsx)("span",{style:{position:"absolute",width:1,height:1,overflow:"hidden",clip:"rect(0 0 0 0)"},children:"Find a filter"}),(0,n.jsx)("input",{type:"search","data-testid":`${s}-filter-find`,value:a,placeholder:"Find a filter, a name or a number\u2026",onChange:r=>d(r.target.value)})]}),l.map(r=>{let k=r.entries.filter(c=>c.condition&&o(c.condition)).length+(r.typed??[]).filter(c=>o({key:r.key,value:c.id})).length;if(b){let c=r.label.toLocaleLowerCase().includes(b),x=r.atNumber&&G(b)!==null?r.atNumber(G(b)):[],h=[...x,...c?r.entries:r.entries.filter(g=>g.label.toLocaleLowerCase().includes(b)&&!x.some(W=>W.value===g.value))],u=r.typed?H(r.typed,b):{shown:[],more:0};return h.length===0&&u.shown.length===0?null:(0,n.jsxs)("div",{role:"group","aria-label":r.label,"data-section":r.key,children:[(0,n.jsx)("p",{"aria-hidden":"true",children:r.label}),h.map(y),r.typed?S(r,b):null]},r.key)}if(r.entries.length===0&&!r.typed)return null;let w=p.has(r.key);return(0,n.jsxs)("div",{role:"group","aria-label":r.label,"data-section":r.key,children:[(0,n.jsxs)("button",{type:"button",className:"graview-arrange-section","data-testid":`${s}-section`,"data-key":r.key,"aria-expanded":w,onClick:()=>v(c=>c.has(r.key)?new Set([...c].filter(x=>x!==r.key)):new Set([...c,r.key])),children:[(0,n.jsx)("span",{children:r.label}),k>0?(0,n.jsx)("span",{className:"graview-arrange-on",children:`${k} on`}):null]}),w?(0,n.jsxs)(n.Fragment,{children:[r.typed?(0,n.jsx)("input",{type:"search",className:"graview-arrange-far","data-testid":`${s}-far-find`,"data-key":r.key,"aria-label":`${r.label}: type a name`,placeholder:`Type a name (${r.typed.length})\u2026`,autoFocus:!0,value:m[r.key]??"",onChange:c=>A({...m,[r.key]:c.target.value})}):null,r.entries.map(y),r.typed?S(r,m[r.key]??""):null]}):null]},r.key)})]})}function X({ask:l,testId:o,onDay:s,onCancel:i}){let[e,t]=(0,f.useState)(""),a=/^\d{4}-\d{2}-\d{2}$/.test(e)&&Number(e.slice(0,4))>=1e3,d=()=>{a&&s(e)};return(0,n.jsxs)("div",{role:"group","aria-label":`${l.label} ${l.op} which day`,"data-testid":`${o}-ask-day`,className:"graview-arrange-ask",children:[(0,n.jsx)("p",{"aria-hidden":"true",children:`${l.label} ${l.op}`}),(0,n.jsx)("input",{type:"date","data-testid":`${o}-day`,"aria-label":`${l.label} ${l.op} which day`,autoFocus:!0,value:e,onChange:p=>t(p.target.value),onKeyDown:p=>{p.key==="Enter"?(p.preventDefault(),d()):p.key==="Escape"&&(p.preventDefault(),p.stopPropagation(),p.nativeEvent.stopImmediatePropagation(),i())}}),(0,n.jsxs)("span",{children:[(0,n.jsx)("button",{type:"button","data-testid":`${o}-day-add`,disabled:!a,onClick:d,children:"Add"}),(0,n.jsx)("button",{type:"button",onClick:i,children:"Never mind"})]})]})}var Z=`
|
|
2
|
+
.graview-arrange-list{display:grid;align-content:start;width:min(300px,calc(100vw - 24px));height:auto;max-height:min(70vh,520px);overflow:auto;overscroll-behavior:contain;margin:0;padding:0 6px 6px;border-radius:10px;border:1px solid var(--graview-edge);background:linear-gradient(var(--graview-float),var(--graview-float)),var(--graview-panel);box-shadow:var(--graview-lift-high);color:var(--graview-ink);font-size:.875rem;line-height:1.3}
|
|
3
|
+
.graview-arrange-list>*:first-child:not(.graview-arrange-find){margin-top:6px}
|
|
4
|
+
@media (max-width:519px){.graview-arrange-list{left:0!important;right:0!important;top:auto!important;bottom:0!important;width:100%!important;max-height:min(80dvh,560px)!important;border-radius:14px 14px 0 0;padding-bottom:calc(10px + env(safe-area-inset-bottom))}}
|
|
5
|
+
.graview-arrange-find{position:sticky;top:0;z-index:${E.raised};display:block;margin:0 -6px 2px;padding:6px;background:linear-gradient(var(--graview-float),var(--graview-float)),var(--graview-panel);border-bottom:1px solid var(--graview-edge)}
|
|
6
|
+
.graview-arrange-find input,.graview-arrange-far{box-sizing:border-box;width:100%;min-height:32px;margin:0;padding:0 8px;border:1px solid var(--graview-edge);border-radius:7px;background:var(--graview-panel);font:inherit;color:var(--graview-ink)}
|
|
7
|
+
.graview-arrange-far{width:calc(100% - 16px);margin:2px 8px 4px}
|
|
8
|
+
.graview-arrange-section{display:flex;align-items:center;justify-content:space-between;gap:8px;width:100%;min-height:32px;margin:0;padding:6px 8px;border:0;border-radius:7px;background:none;font:inherit;font-weight:600;text-align:left;color:var(--graview-ink);cursor:pointer}
|
|
9
|
+
.graview-arrange-section::after{content:"";flex:0 0 7px;height:7px;margin-left:auto;border:solid var(--graview-ink-muted);border-width:0 1.5px 1.5px 0;transform:rotate(-45deg)}
|
|
10
|
+
.graview-arrange-section[aria-expanded=true]::after{transform:rotate(45deg)}
|
|
11
|
+
.graview-arrange-section:hover{background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
|
|
12
|
+
.graview-arrange-on{font-weight:400;color:var(--graview-accent)}
|
|
13
|
+
.graview-arrange-none{display:block;padding:4px 8px 6px 28px;color:var(--graview-ink-muted)}
|
|
14
|
+
.graview-arrange-list [role=group]{display:grid}
|
|
15
|
+
.graview-arrange-list p{margin:8px 8px 2px;font-size:.6875rem;font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--graview-ink-muted)}
|
|
16
|
+
.graview-arrange-item{display:flex;align-items:flex-start;gap:8px;width:100%;min-height:30px;margin:0;padding:6px 8px;border:0;border-radius:7px;background:none;font:inherit;text-align:left;color:var(--graview-ink);cursor:pointer;overflow-wrap:anywhere}
|
|
17
|
+
.graview-arrange-item::before{content:"";flex:0 0 12px}
|
|
18
|
+
.graview-arrange-item[aria-pressed=true]{font-weight:600}
|
|
19
|
+
.graview-arrange-item[aria-pressed=true]::before{content:"\u2713";color:var(--graview-accent)}
|
|
20
|
+
.graview-arrange-item:hover{background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
|
|
21
|
+
.graview-arrange-ask{display:grid;gap:8px;padding:0 8px 8px}
|
|
22
|
+
.graview-arrange-ask p{margin:8px 0 0}
|
|
23
|
+
.graview-arrange-ask input{box-sizing:border-box;width:100%;min-height:32px;padding:0 8px;border:1px solid var(--graview-edge);border-radius:7px;background:var(--graview-panel);font:inherit;color:var(--graview-ink)}
|
|
24
|
+
.graview-arrange-ask span{display:flex;gap:8px}
|
|
25
|
+
.graview-arrange-ask button{min-height:30px;padding:0 12px;border:1px solid var(--graview-edge);border-radius:7px;background:var(--graview-panel);font:inherit;color:var(--graview-ink);cursor:pointer}
|
|
26
|
+
.graview-arrange-ask button:disabled{opacity:.5;cursor:default}
|
|
27
|
+
`;function le({offers:l,chips:o,schema:s,graph:i,kind:e,arrangement:t,has:a,choose:d,testId:p}){return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("style",{children:re}),(0,n.jsx)(ee,{offers:l,chips:o,schema:s,graph:i,kind:e,arrangement:t,has:a,choose:d,testId:p})]})}function ee({offers:l,chips:o,schema:s,graph:i,kind:e,arrangement:t,has:a,choose:d,testId:p}){let v={schema:s,graph:i,...o.flagged?{flagged:o.flagged}:{},...o.today?{today:o.today}:{}},m=s.tryDefinition(e),A=o.nodes.filter(y=>!t.query||P(v,y,t.query));return(0,n.jsx)("div",{className:"graview-arrange-chips","data-testid":`${p}-chips`,children:l.map(y=>{let S=(t.filter??[]).filter(r=>r.key!==y.key),b=new Map;for(let r of A){if(!S.every(w=>D(v,r,w)))continue;let k=String(r[y.key]);b.set(k,(b.get(k)??0)+1)}return(0,n.jsxs)("div",{role:"group","aria-label":y.label,className:"graview-arrange-chip-row","data-field":y.key,children:[(0,n.jsx)("span",{className:"graview-arrange-chip-label","aria-hidden":"true",children:y.label}),(y.options??[]).filter(r=>(b.get(r)??0)>0||a({key:y.key,value:r})).map(r=>{let k=C(m,y.key,r),w=b.get(r)??0;return(0,n.jsxs)("button",{type:"button",className:"graview-arrange-chip","data-testid":`${p}-chip`,"data-value":`${y.key}:${r}`,"aria-pressed":a({key:y.key,value:r}),"aria-label":`${y.label}: ${k}, ${w}`,onClick:()=>d(y.key,r),children:[k,(0,n.jsx)("span",{className:"graview-arrange-chip-count","aria-hidden":"true",children:w})]},r)})]},y.key)})})}var re=`
|
|
28
|
+
.graview-arrange-chips,.graview-arrange-chip-row{display:contents}
|
|
29
|
+
@container (max-width:519px){.graview-arrange-chips{display:flex;flex:1 1 10rem;align-items:center;gap:6px;min-width:0;overflow-x:auto;scrollbar-width:none}.graview-arrange-chip-label{margin:0}.graview-arrange-chip{flex:0 0 auto;white-space:nowrap}}
|
|
30
|
+
.graview-arrange-chip-label{margin:0 0 0 8px;font-size:.8125rem;color:var(--graview-ink-muted)}
|
|
31
|
+
.graview-arrange-chip{display:inline-flex;align-items:center;gap:6px;min-height:28px;max-width:100%;box-sizing:border-box;margin:0;padding:0 10px;border:1px solid var(--graview-edge);border-radius:999px;background:var(--graview-panel);font:inherit;font-size:.8125rem;line-height:1.2;color:var(--graview-ink);cursor:pointer;overflow-wrap:anywhere;text-align:left}
|
|
32
|
+
.graview-arrange-chip:hover{border-color:var(--graview-edge-bright,var(--graview-edge))}
|
|
33
|
+
.graview-arrange-chip[aria-pressed=true]{border-color:var(--graview-accent);background:color-mix(in srgb,var(--graview-accent) 12%,var(--graview-panel));font-weight:600}
|
|
34
|
+
.graview-arrange-chip-count{color:var(--graview-ink-muted);font-variant-numeric:tabular-nums;font-weight:400}
|
|
35
|
+
`;export{le as ArrangeChips,ie as ArrangeLists,R as FAR_ENDS,z as TYPED_MATCHES,U as filterEntries,j as filterSections,Y as roundSteps,H as typedMatches,G as typedNumber};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{b as Ve}from"./chunk.LP2ZMAT2.js";import{c as Be,d as Ie,f as Ge}from"./chunk.H3EGBDW2.js";import{e as Re,f as Fe,k as Me,l as ne,n as Oe}from"./chunk.DWM7AR5Y.js";import{f as Ae}from"./chunk.UGQYMN4J.js";import{d as z,e as Ce,k as te}from"./chunk.SJQPTDAT.js";import{a as je,d as Pe}from"./chunk.JQ63N4MZ.js";import{C as J,Gd as ke,L as ce,Yb as he,Yc as we,_c as be,_d as xe,ad as $e,ea as de,ga as U,ha as ue,ie as Se,ka as H,la as W,ld as Z,ma as me,md as ve,na as Q,oa as pe,pc as ee,qc as ye,ra as fe,re as De,sa as ge,ua as _}from"./chunk.ZEZUKRC6.js";function Ye(t,e,n){let o=t.tryDefinition(e)?.fields.shape,r=J(o?.[n]),a=!1,s=!1;for(;r&&(r.type==="optional"||r.type==="default"||r.type==="nullable"||r.type==="prefault");)(r.type==="optional"||r.type==="nullable")&&(a=!0),(r.type==="default"||r.type==="prefault")&&(s=!0),r=J(r.innerType);if(r?.type!=="enum")return;let p=(r.entries?Object.values(r.entries):r.values??[]).filter(m=>typeof m=="string");return p.length>0?{values:p,empty:a&&!s}:void 0}function E(t,e,n){let o=Ye(t,e,n);if(!o)return[];let r=t.tryDefinition(e),a=o.values.map(s=>({value:s,label:je(r,n,s)}));return o.empty&&a.push({value:null,label:`No ${ge(r,n)}`}),a}function q(t,e,n){let o=t[e];return typeof o=="string"&&n.some(r=>r.value===o)?o:null}function re(t,e,n,o,r=E(t.schema,n.kind,o)){return Ne(t,e,n,o,r).flatMap(a=>a.move?[a.move]:[])}function Ne(t,e,n,o,r=E(t.schema,n.kind,o)){let a=Ke(t.schema,t.allMutations(),n.kind,o,r),s=q(n,o,r),p=_(t.schema.tryDefinition(n.kind),n.kind),m=[];for(let{value:A,label:C,by:R,acts:F}of a){if(A===s)continue;let x,G,V;for(let c of F){let w=R==="step"?{[c.subject.arg]:n.id}:{[c.subject.arg]:n.id,[o]:A},S={name:c.name,args:w};if(!c.input.safeParse(w).success){V??=`${c.title??c.name} asks for more than the ${p} itself.`;continue}let k=t.permits(S,e);if(!k.ok){G??=k.refusal?.message??`You may not ${c.title??c.name}.`;continue}try{he(t.graph,c,w)}catch(f){G??=f instanceof Error?f.message:String(f);continue}x={to:A,call:S,title:c.title??c.name};break}m.push(x?{to:A,label:C,move:x}:{to:A,label:C,why:G??V??`Nothing in this app moves a ${p} to ${C}.`})}return m}function Ke(t,e,n,o,r=E(t,n,o)){let a=Te(t,e,n,o),s=We(t,e,n,o);return r.flatMap(p=>{if(p.value===null)return[];let m=a.filter(A=>A.sets?.[o]===p.value);return[{value:p.value,label:p.label,by:m.length>0?"step":s.length>0?"value":"none",acts:m.length>0?m:s}]})}function Te(t,e,n,o){return e.filter(r=>r.subject!==void 0&&r.derived===void 0&&typeof r.sets?.[o]=="string"&&ee(t,r).includes(n))}function We(t,e,n,o){let r=t.tryDefinition(n);return r?e.filter(a=>{if(!a.subject||!ee(t,a).includes(n)||!ye(a,r).includes(o))return!1;let s=a.input.shape;return s!==void 0&&o in s}).sort((a,s)=>+(a.derived!==void 0)-+(s.derived!==void 0)):[]}var se=(t,e)=>e&&t[e]!==void 0?String(t[e]):"";function Je(t,e,n){let o=c=>t.tryDefinition(c)?e.nodesOfKind(c).filter(w=>H(t.tryDefinition(c),w)):[],r=o(n.rows),a=o(n.columns),s=new Set(r.map(c=>c.id)),p=new Set(a.map(c=>c.id)),m=e.allEdges(),A=[],C=n.link;if(typeof C=="string"){let c=f=>t.tryDefinition(f)?.edges?.[C]?.to,w=(c(n.columns)??[]).some(f=>f===n.rows||f==="*"),S=(c(n.rows)??[]).some(f=>f===n.columns||f==="*"),k=w||!S;for(let f of m){if(f.kind!==C)continue;let j=k?f.to:f.from,i=k?f.from:f.to;s.has(j)&&p.has(i)&&A.push({rowId:j,columnId:i,via:[]})}}else{let c=new Map(C.path.map(S=>[S,new Map]));for(let S of m){let k=c.get(S.kind);if(!k)continue;let f=k.get(S.from);f?f.push(S.to):k.set(S.from,[S.to]);let j=k.get(S.to);j?j.push(S.from):k.set(S.to,[S.from])}let w=new Set;for(let S of a){let k=[{id:S.id,via:[]}];for(let f of C.path){let j=[],i=new Set;for(let v of k)for(let b of c.get(f).get(v.id)??[])i.has(`${v.id}|${b}`)||(i.add(`${v.id}|${b}`),j.push({id:b,via:[...v.via,v.id]}));k=j}for(let f of k){let j=`${f.id}|${S.id}`;!s.has(f.id)||w.has(j)||(w.add(j),A.push({rowId:f.id,columnId:S.id,via:f.via.slice(1)}))}}}let R=n.groupOrder??[],F=c=>R.indexOf(c)===-1?R.length:R.indexOf(c),x=(c,w)=>w==="label"?W(t.tryDefinition(c.kind),c):c[w],G=Z(r,n.sort,x).map(c=>{let w=c;return{node:c,label:W(t.tryDefinition(c.kind),c),group:se(w,n.rowGroup),ref:se(w,n.rowRef)}}).sort((c,w)=>F(c.group)-F(w.group)||(n.sort!==void 0?0:c.ref<w.ref?-1:c.ref>w.ref?1:0)),V=Z(a,n.columnSort,x).map(c=>({node:c,label:W(t.tryDefinition(c.kind),c),group:se(c,n.columnGroup)})).sort((c,w)=>c.group<w.group?-1:c.group>w.group?1:n.columnSort!==void 0?0:c.node.id<w.node.id?-1:c.node.id>w.node.id?1:0);return{rows:G,columns:V,cells:A}}function He(t,e,n){let{rows:o,columns:r,cells:a}=Je(t,e,n),s=(i,v)=>Q(t,i,v),p=i=>Q(t,i,1).replace(/^1 /,""),m=i=>({id:i.id,kind:i.kind,title:W(t.tryDefinition(i.kind),i),parts:[]}),A=i=>{let v=e.getNode(i);if(!v)return null;let b=t.tryDefinition(v.kind),P=W(b,v),N=z(v,b,{limit:3,said:[P],glance:!0}).map(K=>K.alone.startsWith(K.label)?`${K.label.toLowerCase()}${K.alone.slice(K.label.length)}`:K.alone);return[P,...N].join(", ")},C=typeof n.link=="string"?[]:n.link.path.slice(0,-1).flatMap((i,v,b)=>{let P=ke(t,n.columns,b.slice(0,v+1));return P.ok?[...P.reached]:[]}),R=ve(t,n,{rows:o.length,columns:r.length,cells:a.length});if(R)return[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}.`},{t:"text",text:R}];let F=[{t:"text",text:`${s(n.rows,o.length)} against ${s(n.columns,r.length)}${C.length>0?`, through ${[...new Set(C)].map(i=>s(i,2).replace(/^2 /,"")).join(" and ")}`:""}${r.length>0?`: ${r.map(i=>i.label).join(", ")}`:""}.`}],x=new Map(r.map(i=>[i.node.id,i.label])),G=new Map(r.map((i,v)=>[i.node.id,v])),V=new Map,c=new Map;for(let i of a){let v=V.get(i.rowId);v?v.push(i):V.set(i.rowId,[i]);let b=c.get(i.columnId);b?b.add(i.rowId):c.set(i.columnId,new Set([i.rowId]))}for(let i of o){let b=[...V.get(i.node.id)??[]].sort((P,N)=>G.get(P.columnId)-G.get(N.columnId)).map(P=>{let N=P.via.map(A).filter(K=>K!==null);return`${x.get(P.columnId)}${N.length>0?` (${N.join("; ")})`:""}`});F.push({t:"field",label:i.label,text:b.length>0?b.join(", "):"none"})}F.push({t:"list",as:"name",columns:1,groups:r.map(i=>{let v=c.get(i.node.id)??new Set,b=o.filter(P=>v.has(P.node.id)).map(P=>m(P.node));return{heading:`${i.label} (${b.length})`,items:b}})});let w=new Set(a.map(i=>i.rowId)),S=new Set(a.map(i=>i.columnId)),k=o.filter(i=>!w.has(i.node.id)),f=r.filter(i=>!S.has(i.node.id)),j=n.rows===n.columns;return k.length>0&&F.push({t:"text",text:`${j?`${k.length} with none across`:`${s(n.rows,k.length)} with no ${p(n.columns)}`}: ${k.map(i=>i.label).join(", ")}.`}),f.length>0&&F.push({t:"text",text:`${j?`${f.length} with none down`:`${s(n.columns,f.length)} on no ${p(n.rows)}`}: ${f.map(i=>i.label).join(", ")}.`}),F}function oe(t,e,n,o={}){let{app:r,blocks:a=n?r?.viewSpecs?.[n.kind]?.[o.slot??"page"]:r?.home}=o;if(!a?.length)return[];let s=o.firstHeading??(n||o.blocks?void 0:1),p=Oe(t,e,n,{...o,money:o.money??r?.brand,firstHeading:s});return n&&!p.node?[]:Fe(typeof a[0]?.t=="string"?a:Re(a),p)}function X(t,e,n){let o=!(e.optional||e.control==="boolean"),r=e.control==="node"&&!e.kinds.includes("*")?e.kinds.map(s=>U(_(t.tryDefinition(s),s))).join(" or "):n(e.name).label,a={name:e.name,label:r,required:o};switch(e.control){case"text":return{...a,input:e.holds==="duration"?"length of time":e.holds??(e.markdown?"Markdown text":e.long?"long text":e.app?"app address":"text")};case"date":return{...a,input:e.time||e.instant?"date and time":"date"};case"number":return{...a,input:e.amount?"amount":"number",...e.min===void 0?{}:{min:e.min},...e.max===void 0?{}:{max:e.max}};case"choice":return{...a,input:"choice",choices:(e.options??[]).map(s=>n(e.name).option(s))};case"boolean":return{...a,input:"yes or no"};case"node":return{...a,input:"record",kinds:e.kinds};case"linked":return{...a,input:"record in another app"};case"file":return{...a,input:e.image?"picture":e.video?"video":"file"};case"repeat":return{...a,input:"how it repeats"};case"list":return{...a,input:`list of ${X(t,e.item,n).input}`};case"group":return{...a,input:"group",fields:e.fields.map(s=>X(t,s,n))};case"variant":return{...a,input:"one of",choices:e.options.map(s=>ue(s.value))};default:return{...a,input:"answer"}}}function Ee(t,e,n){let o=Ie(t,e,n),r=t.schema,a=Be(r,n).filter(p=>p.name!==n.subject?.arg&&!o.has(p.name)),s=me(n);return{act:n.name,title:s,submit:s,fields:a.map(p=>X(r,p,m=>te(r,n,m)))}}function Le(t,e){return{act:e.act.name,title:e.title,submit:e.submit,visitor:e.name,fields:e.fields.map(n=>X(t,n,o=>te(t,e.act,o)))}}function Ze(t,e,n){return t.permittedMutations(e).filter(o=>!o.derived&&!o.subject&&(o.creates??[]).includes(n))}function ze(t,e=""){let n=[`${e}Form "${t.title}" (${t.visitor?`the visitor form ${t.visitor}, running `:""}act ${t.act}), button "${t.submit}":`],o=(r,a)=>{for(let s of r){let p=s.choices?`${s.input}: ${s.choices.join(", ")}`:s.kinds?`${s.input} (${s.kinds.join(" or ")})`:s.input,m=s.min!==void 0||s.max!==void 0?`, ${s.min??"\u2026"} to ${s.max??"\u2026"}`:"";n.push(`${a}- ${s.label}${s.required?" *":""} (${s.name}) \u2014 ${p}${m}`),s.fields&&o(s.fields,`${a} `)}};return o(t.fields,`${e} `),t.fields.length===0&&n.push(`${e} (asks nothing)`),n}function _e(t,e){let n=t.viewSpecs??{};return e.filter(o=>o.cardinality==="one"&&o.replaces==="page"&&(n[o.attach]?.page?.length??0)>0).map(o=>{let r=L(t.schema,o.attach,1);return{at:`views.${o.attach}.page`,says:`The view "${o.name}" replaces ${Qe(r)}'s page, so its page slot is never drawn: leave out replaces to draw the slot under the view, or draw what the slot says in the view.`}})}var Qe=t=>`${/^[aeiou]/i.test(t)?"an":"a"} ${t}`,et=240,Ue=10,tt=1160,nt=40,qe=640,rt=3,st=t=>Math.max(1,Math.floor((Math.min(t,tt)-nt+Ue)/(et+Ue)));function ot(t,e,n,o){let{app:r}=o,a=o.width??1440,s=o.today??t.today()??ce(r.brand?.timeZone),p=t.seenBy(e),m=p.schema,A=p.graph,C=Ve(r,o.views?{views:o.views}:{}),R=typeof n=="string"?n.trim():n.slug,F=typeof n=="string"?C.find(l=>l.slug===R||l.title===R||l.address===R):C.find(l=>l.slug===n.slug&&l.kind===n.kind)??n,x=!F&&typeof n=="string"?A.getNode(R):void 0,G=!F&&!x?/^\/?forms\/(.+)$/.exec(R)?.[1]:void 0,V=G!==void 0?Ge(r,G):void 0;if(V)return{ok:!0,description:it(m,V,a)};if(!F&&!x)return{ok:!1,error:`"${R}" is not a place this app has, nor a record this seat can see.`,places:[...C.map(l=>l.slug),...Object.keys(r.forms??{}).map(l=>`forms/${l}`)]};let c=[],w=r.viewSpecs??{},S=st(a),k=(l,h)=>oe(p,null,l,{app:r,today:s,...h}),f=(l,h,M)=>{let d=m.tryDefinition(l.kind),g=W(d,l);if(h==="name")return{id:l.id,kind:l.kind,title:g,parts:[]};if(w[l.kind]?.[h]){let I=k(l,{slot:h}),[B,...O]=I,y=B?.t==="title"||h==="row"&&B?.t==="headline";return{id:l.id,kind:l.kind,title:y?B.text:g,parts:j(y?O:I,M,`views.${l.kind}.${h}`,` (${l.id})`,y?1:0)}}if(h==="row")return{id:l.id,kind:l.kind,title:g,parts:[]};let u=d?.computed?ne(m,A,l):l,T=z(u,d,{limit:3,said:[g],glance:!0,locale:r.brand?.locale,timeZone:r.brand?.timeZone});return{id:l.id,kind:l.kind,title:g,parts:T.map(I=>({t:"text",text:I.alone}))}};function j(l,h,M,d="",g=0){let $=[];return l.forEach((u,T)=>{let I=`${M}.${T+g}`;switch("problem"in u&&u.problem&&c.push({at:`${I}${d}`,says:u.problem}),u.t){case"title":$.push({t:"heading",level:3,text:u.text});return;case"text":$.push({t:"text",text:u.markdown?Pe(u.text):u.runs?ct(u.runs):u.text,...u.tone?{tone:u.tone}:{}});return;case"badge":$.push({t:"badge",text:u.text});return;case"field":case"image":$.push({t:"field",label:u.label,text:u.text});return;case"progress":$.push({t:"progress",label:u.label,text:u.text});return;case"group":$.push(...j(u.blocks,h,`${I}.group`,d));return;case"when":$.push(...j(u.blocks,h,`${I}.show`,d));return;case"divider":case"figure":return;case"headline":$.push({t:"heading",level:u.level,text:u.text});return;case"number":$.push({t:"figure",text:u.text,...u.label?{label:u.label}:{}});return;case"list":{if(u.failed){$.push({t:"text",text:"\u2014"});return}if(u.members.length===0){u.empty&&$.push({t:"list",as:u.as,columns:1,groups:[],empty:u.empty});return}let B=h+1,O=B>rt?"name":u.as,y=(u.groups??[{value:null,members:u.members}]).map(D=>({..."heading"in D&&D.heading?{heading:D.heading,count:(u.everyGroup?.find(Y=>Y.value===D.value)??D).members.length}:{},items:D.members.map(Y=>f(Y,O,B))}));$.push({t:"list",as:O,columns:O==="card"?S:1,groups:y,...u.more>0?{more:u.more}:{}});return}}}),$}let i=[],v,b,P,N=[];if(x){b="record";let l=m.tryDefinition(x.kind),h=W(l,x);P={slug:x.id,title:h,kind:x.kind,address:xe(m,x.kind,x.id)};let M=w[x.kind]?.page,d=o.views?.find(g=>g.attach===x.kind&&g.cardinality==="one");if(d&&i.push({t:"view",name:d.name,...d.title?{title:d.title}:{},...d.replaces==="page"?{replaces:!0}:{},...d.parts?{parts:d.parts}:{}}),d?.replaces==="page")b=`view:${d.name}`,c.push(..._e(r,[d]));else{M&&i.push(...j(k(x,{slot:"page"}),1,`views.${x.kind}.page`));let g=l?.computed?ne(m,A,x):x;for(let $ of Ce(l,z(g,l,{said:[h],locale:r.brand?.locale,timeZone:r.brand?.timeZone}))){$.title&&i.push({t:"heading",level:2,text:$.title});for(let u of $.fields)i.push({t:"field",label:u.label,text:u.value,...u.long?{long:!0}:{},...u.markdown?{markdown:!0}:{}})}}}else{let l=F;P={slug:l.slug,title:l.title,kind:l.kind,address:l.address};let h=l.lens?Se(r).drawn.find(d=>d.as===l.slug&&(l.kind===null||d.kinds.includes(l.kind))):void 0,M=l.kind!==null&&l.view===void 0&&!h?o.views?.find(d=>d.attach===l.kind&&d.cardinality==="many"&&d.replaces==="page"&&!d.hidden):void 0;if(l.kind!==null&&h?.create!==!1&&l.view===void 0&&!M&&(N=Ze(t,e,l.kind).map(d=>Ee(t,e,d))),l.view!==void 0&&!h){let d=o.views?.find(g=>g.name===l.view);b=`view:${l.view}`,i.push({t:"view",name:l.view,title:d?.title??l.title,...typeof d?.flows=="boolean"?{flows:d.flows}:{},...d?.parts?{parts:d.parts}:{}})}else if(l.kind===null){let d=r.brand,g=d?.name??r.name,$=$e(d)?.light,u=$&&be($)?$:void 0;if(v={name:g,...d?.subtitle&&d.subtitleDrawn!==!1?{subtitle:d.subtitle}:{},...u?{logo:{alt:d?.logoAlt??g,...we(u)?{drawn:"inline SVG"}:{drawn:"image",src:u}}}:{}},r.home)b="blocks",i=j(k(null,{}),0,"views.home");else{b="derived";let T=t.kindsKeptFrom(e),I=new Set([...r.pages?.hide??[],...T,...t.modules.disabledKinds]),B=De(m.kinds,r.pages?.order).filter(O=>!I.has(O));i.push({t:"heading",level:1,text:r.name??"Home"});for(let O of B){let y=A.nodesOfKind(O).filter(D=>H(m.tryDefinition(O),D)).length;y>0&&i.push({t:"text",text:`${y} ${L(m,O,y)}`})}}}else if(h?.lens==="blocks")b="lens:blocks",i=j(k(null,{blocks:h.options.blocks??[]}),0,`lenses.${h.index}.options.blocks`);else if(h?.lens==="columns"){b="lens:columns";let d=h.options.bindings??{};for(let g of Object.keys(d)){let $=d[g]?.column;if(!$)continue;let u=E(m,g,$),T=Z(A.nodesOfKind(g).filter(y=>H(m.tryDefinition(g),y)),h.options.sort,(y,D)=>D==="label"?W(m.tryDefinition(y.kind),y):y[D]);Object.keys(d).length>1&&i.push({t:"heading",level:2,text:L(m,g,2).replace(/^./,y=>y.toUpperCase())}),i.push({t:"text",text:`${T.length} ${L(m,g,T.length)} in columns by ${fe(m.tryDefinition(g),$).toLowerCase()}.`});let I=u.map(y=>({column:y,items:T.filter(D=>q(D,$,u)===y.value).map(D=>f(D,"card",1))})).filter(({column:y,items:D})=>y.value!==null||D.length>0).map(({column:y,items:D})=>({heading:`${y.label} (${D.length})`,items:D}));i.push({t:"list",as:"card",columns:1,groups:I});let B=new Map;for(let y of T)for(let D of re(t,e,y,$,u))B.set(D.to,(B.get(D.to)??new Set).add(`"${D.title}"`));let O=u.filter(y=>y.value!==null&&B.has(y.value)).map(y=>`to ${y.label} by ${[...B.get(y.value)].join(" or ")}`);i.push({t:"text",text:O.length>0?`Moves: ${O.join("; ")}.`:"Moves: none for this seat."})}}else if(h?.lens==="coverage")b="lens:coverage",i=He(m,A,h.options);else if(h){b=`lens:${h.lens}`;let d=h.kinds.flatMap(g=>A.nodesOfKind(g).filter($=>H(m.tryDefinition(g),$)));i.push({t:"text",text:`A ${h.lens} of ${d.length} ${h.kinds.map(g=>L(m,g,d.length)).join(" and ")}.`}),i.push({t:"list",as:"name",columns:1,groups:[{items:d.map(g=>f(g,"name",1))}]})}else if(M)b=`view:${M.name}`,i.push({t:"heading",level:1,text:l.title}),i.push({t:"view",name:M.name,...M.title?{title:M.title}:{},replaces:!0,...M.parts?{parts:M.parts}:{}});else{b="derived";let d=A.nodesOfKind(l.kind).filter(g=>H(m.tryDefinition(l.kind),g));i.push({t:"heading",level:1,text:l.title}),d.length===0?i.push({t:"list",as:"row",columns:1,groups:[],empty:`No ${L(m,l.kind,0)} yet.`}):i.push({t:"list",as:"row",columns:1,groups:[{items:d.map(g=>f(g,"row",1))}]})}}let K=e.kind==="system"?"the system":(e.roles??[]).length>0?(e.roles??[]).join(", "):e.kind,Xe=a<qe?"phone":"wide",ae=P.kind===null?at(m,A):[],le={...v?{masthead:v}:{},...ae.length>0?{facts:ae}:{},place:P,seat:K,width:a,variant:Xe,drawnBy:b,parts:i,...N.length>0?{forms:N}:{},problems:c};return{ok:!0,description:{...le,text:ie(le)}}}function it(t,e,n){let o=[{t:"heading",level:1,text:e.title},...e.intro?[{t:"text",text:e.intro}]:[]],r={place:{slug:`forms/${e.name}`,title:e.title,kind:null,address:`/forms/${e.name}`},seat:`a visitor (${e.role})`,width:n,variant:n<qe?"phone":"wide",drawnBy:"form",parts:o,forms:[Le(t,e)],problems:[]};return{...r,text:ie(r)}}function at(t,e){let n=Me(t,e,null),o=r=>Array.isArray(r)?r.map(o).join(", "):r===null?"nothing":typeof r=="boolean"?r?"yes":"no":typeof r=="object"?r.label:String(r);return[...Ae(t)].map(([r,a])=>{let s=a.label??U(r);return Object.hasOwn(n.values,r)?{name:r,label:s,value:o(n.values[r])}:{name:r,label:s,refused:n.refused[r]??"it could not be worked out"}})}function L(t,e,n){let o=t.tryDefinition(e);if(n===1)return o?.noun??e;let r=pe(t,e);return de(r)}function ie(t){let e=[`${t.place.title} (${t.place.address}) \u2014 as ${t.seat}, ${t.width} wide (${t.variant}).`],n=t.masthead;n&&e.push(`Masthead: ${n.logo?`the logo ("${n.logo.alt}", ${n.logo.drawn==="image"?n.logo.src:"inline SVG"}), `:""}${n.name}${n.subtitle?` \u2014 ${n.subtitle}`:""}`);let o=(r,a)=>{for(let s of r)switch(s.t){case"heading":e.push(`${a}${"#".repeat(s.level)} ${s.text}`);break;case"text":e.push(`${a}${s.text}`);break;case"badge":e.push(`${a}[${s.text}]`);break;case"field":case"progress":e.push(`${a}${s.label}: ${s.text}`);break;case"figure":e.push(`${a}${s.text}${s.label?` \u2014 ${s.label}`:""}`);break;case"list":if(s.groups.length===0){s.empty&&e.push(`${a}(${s.empty})`);break}for(let p of s.groups){p.heading&&e.push(`${a}${p.heading}${p.count!==void 0?` (${p.count})`:""}:`);for(let m of p.items)e.push(`${a}${p.heading?" ":""}- ${m.title}`),o(m.parts,`${a}${p.heading?" ":" "}`)}s.as==="card"&&s.columns>1&&e.push(`${a}(cards, ${s.columns} across)`),s.more&&e.push(`${a}and ${s.more} more`);break;case"view":e.push(`${a}[the view "${s.title??s.name}"${s.replaces?", in place of the page":""}${s.flows===!0?", flowing with the page":s.flows===!1?", in a frame of its own":""}]`),s.parts&&o(s.parts,`${a} `);break}};o(t.parts,"");for(let r of t.forms??[])e.push(...ze(r));if(t.facts){e.push("Facts of the whole graph (what fact('<name>') reads):");for(let r of t.facts)e.push(`- ${r.label} (${r.name}): ${r.value??`not worked out \u2014 ${r.refused}`}`)}if(t.videos&&t.videos.length>0){e.push("Videos:");for(let r of t.videos)e.push(`- ${lt(r)}`)}if(t.problems.length>0){e.push("Problems:");for(let r of t.problems)e.push(`- ${r.at}: ${r.says}`)}return e.join(`
|
|
2
|
+
`)}function lt(t){let e=t.autoplay?"plays as a background, muted and looping, with no controls":"plays with the browser's controls";return`${t.text} (${t.field} of ${t.record}): ${t.source}${t.duration!==void 0?`, ${Math.round(t.duration)} s`:""}, ${t.poster?"with a poster":"no poster"}; ${e}${t.cover?", filling its box":""}; ${t.playable?"playable":`not playable: ${t.why??"it is not a video a browser plays"}`}.`}function ct(t){return t.map((e,n)=>(n===0?"":e.field===void 0&&t[n-1].field===void 0?" \xB7 ":" ")+e.text).join("")}export{E as a,q as b,re as c,Ne as d,Ke as e,Te as f,We as g,oe as h,_e as i,ot as j,ie as k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(t){let i=[];return typeof t!="string"?["A view's source is text."]:(/\bimport\b/.test(t)&&i.push("It says import: a view loads nothing, so the word may not appear in it at all, even in a string or a comment."),/\bimportScripts\b/.test(t)&&i.push("It names importScripts: a view loads nothing."),/^\s*export\b/m.test(t)&&i.push("It exports something: a view is a plain script that draws through the graview global, not a module."),/\brequire\s*\(/.test(t)&&i.push("It calls require(): a view has no modules to require."),i)}export{e as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as te}from"./chunk.X226YATK.js";import"./chunk.BJUUSIQY.js";import"./chunk.6KJGRM7A.js";import"./chunk.Z3O2VZAJ.js";import"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{G as ne,W as N}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{eb as Z,la as Q,oa as X,td as ee,xd as $}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as P}from"./chunk.AJZBJBMO.js";var D=new WeakMap,we=5e3;function I(n){let e=D.get(n);if(e&&Date.now()-e.at<we)return e.list;let t={at:Date.now(),list:Promise.resolve([])};return t.list=Promise.resolve().then(()=>n.list()).catch(()=>[]).then(o=>t.value=[...o,...(t.value??[]).filter(i=>!o.some(l=>l.id===i.id))]),e?.value&&(t.value=e.value),D.set(n,t),t.list}var oe=n=>D.get(n)?.value;function re(n,e){let t=D.get(n);if(!t)return;let o=i=>[...i.filter(l=>l.id!==e.id),e];t.value&&(t.value=o(t.value)),D.set(n,{at:t.at,list:t.list.then(o),...t.value?{value:t.value}:{}})}function A(n,e){let t=$(n,e);return o=>n.graph.getNode(o)!==void 0&&t(o)}var z=["previewed","accepted","declined","undone","abandoned"],ve=["graph","light","full"],S={words:300,should:300,name:80,records:200,people:20,stages:8,examples:5},Se=365,xe=5e3,be=new RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2066-\\u2069]","g");function ie(n,e){if(typeof n!="string")return;let t=n.replace(be," ").replace(/\s+/g," ").trim();return t.length===0?void 0:t.slice(0,e).trimEnd()}function h(n){return typeof n=="string"&&n.length>0&&n.length<=S.name&&/^[\p{L}\p{N}_][\p{L}\p{N}_.:/-]*$/u.test(n)?n:void 0}var W=(n,e)=>Array.isArray(n)?[...new Set(n.flatMap(t=>h(t)??[]))].slice(0,e):[];function ae(n){let e=typeof n.id=="string"?n.id.slice(0,S.name):void 0;return{kind:n.kind,...e!==void 0?{id:e}:{},...n.onBehalfOf?{onBehalfOf:ae(n.onBehalfOf)}:{}}}var le=n=>n?.kind==="visitor"||n?.onBehalfOf?.kind==="visitor",ke=()=>`tl-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`,Oe=new Set(["record","field","selection","list","lens","place","act"]);function Pe(n){let e=n,t=o=>typeof o=="number"&&Number.isFinite(o)&&o>=0?Math.min(1e4,Math.round(o)):0;switch(e?.type){case"act":{let o=h(e.act);return o?{type:"act",act:o,records:t(e.records)}:void 0}case"plan":return{type:"plan",edits:t(e.edits)};case"answer":return{type:"answer"};case"refusal":return{type:"refusal"};case"view":{let o=typeof e.section=="string"?e.section.replace(/\s+/g," ").trim().slice(0,S.name):"";return o?{type:"view",section:o}:void 0}default:return}}function se(n,e,t={}){if(!n||typeof n!="object"||!e||le(e))return;let o=n,i=ie(o.words,S.words),l=Pe(o.decided),d=o.target;if(!i||!l||!d||!Oe.has(String(d.on)))return;let s={on:d.on,...h(d.kind)?{kind:h(d.kind)}:{},...h(d.id)?{id:h(d.id)}:{},...h(d.place)?{place:h(d.place)}:{}},c=o.reading,a=c&&(c.which==="itself"||c.which==="held")&&h(c.kind)?{which:c.which,kind:h(c.kind),records:W(c.records,S.records)}:void 0,g=W(o.people,S.people),f=Array.isArray(o.stages)?o.stages.flatMap(Te=>{let L=Te,V=h(L?.stage),E=L?.ms;return V&&typeof E=="number"&&Number.isFinite(E)&&E>=0?[{stage:V,ms:Math.round(E),...h(L.model)?{model:h(L.model)}:{}}]:[]}).slice(0,S.stages):[],w=z.includes(o.outcome)?o.outcome:"previewed",y=ve.includes(o.slot)?o.slot:void 0,b=o.rating==="up"||o.rating==="down"?o.rating:void 0,k=b==="down"?ie(o.should,S.should):void 0,O=typeof o.ms=="number"&&Number.isFinite(o.ms)&&o.ms>=0?Math.round(o.ms):void 0,r=t.id??h(o.id)??ke(),p=h(o.conversation)??r,m=h(o.follows),Y=h(o.interaction),J=W(o.examples,S.examples);return{id:r,at:t.at??new Date().toISOString(),by:ae(e),words:i,target:s,...a?{reading:a}:{},...g.length>0?{people:g}:{},decided:l,...y?{slot:y}:{},...f.length>0?{stages:f}:{},...O!==void 0?{ms:O}:{},outcome:w,...b?{rating:b}:{},...k?{should:k}:{},conversation:p,...m?{follows:m}:{},...Y?{interaction:Y}:{},...J.length>0?{examples:J}:{}}}function Ae(n,e){let t=e.outcome===void 0||e.outcome==="previewed"||n.outcome==="accepted"&&e.outcome!=="undone"||n.outcome==="undone"||(n.outcome==="declined"||n.outcome==="abandoned")&&e.outcome==="abandoned"?n.outcome:e.outcome,o=e.rating===void 0?n.rating:e.rating??void 0,i=o!=="down"?void 0:e.should===void 0?n.should:e.should??void 0,{rating:l,should:d,...s}=n;return{...s,outcome:t,...o?{rating:o}:{},...i?{should:i}:{},...e.examples?{examples:e.examples}:{},...e.pinned!==void 0?{pinned:e.pinned}:{},...e.excluded!==void 0?{excluded:e.excluded}:{}}}function Ce(n,e={}){let t=(e.now??Date.now())-(e.retentionDays??Se)*864e5,o=new Map;for(let d of n){let s=Date.parse(d.at);Number.isFinite(s)&&s>=t&&!le(d.by)&&o.set(d.id,d)}let i=[...o.values()],l=e.most??xe;return i.length>l?i.slice(i.length-l):i}function H(n,e,t={}){return"add"in e?Ce([...n,e.add],t):"remove"in e?n.filter(o=>o.id!==e.remove):n.map(o=>o.id===e.change?Ae(o,e.with):o)}var C=n=>n.onBehalfOf?C(n.onBehalfOf):n.id!==void 0?`${n.kind}:${n.id}`:`${n.kind}:?`,Re=n=>[...new Set([...n.target.id?[n.target.id]:[],...n.reading?.records??[],...n.people??[]])];function R(n,e){return n.filter(t=>Re(t).every(e))}var B=n=>!n.excluded&&n.rating!=="down"&&n.outcome!=="undone"&&(n.outcome==="accepted"||n.rating==="up"),U=n=>{let e=n.reading?.kind??n.target.kind??"";return n.decided.type==="act"?`act:${n.decided.act}:${e}:${n.reading?.which??""}`:n.decided.type==="plan"?`plan:${e}`:void 0};function De(n,e={}){let t=Math.max(1,e.minPeople??2),o=e.reader?C(e.reader):void 0,i=new Map;for(let l of n){let d=U(l);!d||!B(l)||C(l.by)===o||i.set(d,(i.get(d)??new Set).add(C(l.by)))}return new Set([...i].filter(([,l])=>l.size>=t).map(([l])=>l))}function ce(n,e){return n.filter(t=>(e.rating===void 0||(e.rating==="none"?t.rating===void 0:t.rating===e.rating))&&(e.outcome===void 0||t.outcome===e.outcome)&&(e.kind===void 0||(t.reading?.kind??t.target.kind)===e.kind))}var Le=n=>n.filter(e=>B(e)&&U(e)!==void 0);function ue(n){let e=Le(n).length;return e===0?"Nothing told here teaches suggestions yet: a telling that is accepted or rated \u{1F44D} will.":`Suggestions come from ${e} rated ${e===1?"telling":"tellings"} in this app.`}function ge(n,e=t=>t){switch(n.decided.type){case"act":return`${e(n.decided.act)}, over ${n.decided.records} ${n.decided.records===1?"record":"records"}`;case"plan":return`A plan of ${n.decided.edits} ${n.decided.edits===1?"change":"changes"} to the app`;case"answer":return"An open answer";case"refusal":return"Nothing it could do";case"view":return`A revision of \u201C${n.decided.section}\u201D`}}var G={previewed:"Previewed",accepted:"Accepted",declined:"Declined",undone:"Undone",abandoned:"Closed with nothing done"},Ee=new Set("a an and are as at be by can do does for from has have how i in is it its me my of on or our please the their them these they this those to was we what when where which who why will with you your all each every".split(" "));function de(n){return[...new Set(n.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^\p{L}\p{N}]+/u).filter(e=>e.length>1&&!Ee.has(e)).map(e=>e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e))]}function M(n,e,t={}){let o=de(e.words);if(o.length===0)return[];let i=t.reader?C(t.reader):void 0,l=De(n,{...t.reader?{reader:t.reader}:{},...t.minPeople!==void 0?{minPeople:t.minPeople}:{}}),d=n.flatMap(a=>{let g=U(a);if(!g||!B(a)||t.rated&&a.rating!=="up")return[];if(!(i!==void 0&&C(a.by)===i)&&!l.has(g))return[];let w=de(a.words),y=o.filter(p=>w.some(m=>m===p||p.length>=3&&m.startsWith(p))).length;if(y===0)return[];let b=y/new Set([...o,...w]).size,k=e.kind!==void 0&&(a.target.kind===e.kind||a.reading?.kind===e.kind)?.25:e.kind!==void 0?-.25:0,O=e.act!==void 0&&a.decided.type==="act"&&a.decided.act===e.act?.15:0,r=Math.max(0,Math.min(1,b*.6+.25+k+O+(a.pinned?.1:0)));return r>=(t.floor??.35)?[{telling:a,score:r,lesson:g}]:[]});d.sort((a,g)=>g.score-a.score||Number(g.telling.pinned??!1)-Number(a.telling.pinned??!1)||(a.telling.at<g.telling.at?1:-1));let s=new Set,c=[];for(let a of d)if(!s.has(a.lesson)&&(s.add(a.lesson),c.push({telling:a.telling,score:a.score}),c.length>=(t.most??2)))break;return c}function pe(n){return n.map(({telling:e})=>({said:e.words,did:e.decided.type==="act"?`act ${e.decided.act} over ${e.reading?.which==="itself"?"the record itself":"each record it holds"}`:e.decided.type==="plan"?"a plan that changes the app":e.decided.type==="view"?"a revision of a view's section":e.decided.type,...e.reading?{reading:e.reading.which}:{}}))}var x=P(ne(),1),T=P(N(),1);function ye(n,e){if(e.on==="list"||e.on==="lens")return e.kind;let t=te(e)[0];return t?n.graph.getNode(t)?.kind:void 0}function $e(n,e,t,o,i){let l=n?oe(n):void 0;if(!l)return{examples:[],ids:[]};let d=ye(e,i),s=M(R(l,A(e,t)),{words:o,...d?{kind:d}:{}},{reader:t,rated:!0,most:3});return{examples:pe(s),ids:s.map(c=>c.telling.id)}}function Ne(n){let e=new Set((n.stages??[]).map(t=>t.stage));return e.has("thinking")?"full":e.has("light")?"light":e.has("fast")?"graph":(n.usage??[]).some(t=>t.tier==="thinking")?"full":void 0}function Ie(n,e){if(n.interaction.outcome==="failed"||e&&"refused"in e)return{type:"refusal"};if(e&&"question"in e)return e.proposal?{type:"plan",edits:e.parts.length}:{type:"refusal"};let t=n.ghost?.proposals??[];return t.length>0?{type:"act",act:t[0].call.name,records:new Set(t.map(i=>i.record??i.id)).size}:{type:"answer"}}function Me(n,e){let t=new Set;for(let o of e.ghost?.proposals??[])for(let i of Object.values(o.call.args))typeof i=="string"&&i!==o.record&&n.graph.getNode(i)&&t.add(i);return[...t]}function _e(n,e){let{target:t,result:o}=e,i=ye(n,t),l=t.on==="record"||t.on==="field"?t.id:void 0,d=t.on==="lens"||t.on==="place"?t.place:void 0,s=o.reading?{which:o.reading.which,kind:o.reading.kind,records:o.reading.records}:void 0,c=Me(n,o),a=Ne(o.interaction),g=Ie(o,e.plan);return{words:e.words,target:{on:t.on,...i?{kind:i}:{},...l?{id:l}:{},...d?{place:d}:{}},...s?{reading:s}:{},...c.length>0?{people:c}:{},decided:g,...a?{slot:a}:{},...o.interaction.stages?{stages:o.interaction.stages}:{},ms:e.ms,outcome:"previewed",...e.conversation?{conversation:e.conversation}:{},...e.follows?{follows:e.follows}:{},interaction:o.interaction.id,...e.examples&&e.examples.length>0?{examples:e.examples}:{}}}function Fe(n,e,t){if(!n)return;let o=se(e,t);if(o)return re(n,o),Promise.resolve().then(()=>n.add(o)).catch(()=>{}),o}function _(n,e,t){n&&Promise.resolve().then(()=>n.change(e,t)).catch(()=>{})}var We={accepted:"accepted",partly:"accepted",drawn:"accepted",dismissed:"declined"};function ze(n,e,t){let o,i=()=>{let c=n.get().entries.find(g=>g.id===t.interaction);if(!c)return;let a=c.undone?"undone":We[c.outcome];!a||a===o||(o=a,_(e,t.id,{outcome:a}),a==="undone"&&s())},l=n.subscribe(i),d=setTimeout(()=>s(),30*6e4),s=()=>{l(),clearTimeout(d)};return s}function He({told:n,telling:e}){let[t,o]=(0,x.useState)(e.rating),[i,l]=(0,x.useState)(""),[d,s]=(0,x.useState)(!1),c=(0,x.useId)();(0,x.useEffect)(()=>{o(e.rating),l(""),s(!1)},[e.id,e.rating]);let a=f=>{let w=t===f?void 0:f;o(w),s(!1),_(n,e.id,{rating:w??null})},g=()=>{let f=i.trim();!f||t!=="down"||(_(n,e.id,{should:f}),s(!0))};return(0,T.jsxs)("div",{"data-testid":"quick-ask-rating","data-rating":t??"",style:{display:"grid",gap:6},children:[(0,T.jsxs)("div",{role:"group","aria-label":"Was this right?",style:{display:"flex",gap:4,justifyContent:"flex-end"},children:[(0,T.jsx)("button",{type:"button","data-testid":"quick-ask-right","aria-label":"This was right",title:"This was right","aria-pressed":t==="up",onClick:()=>a("up"),style:t==="up"?fe:K,children:(0,T.jsx)("span",{"aria-hidden":"true",children:"\u{1F44D}"})}),(0,T.jsx)("button",{type:"button","data-testid":"quick-ask-wrong","aria-label":"This was wrong",title:"This was wrong","aria-pressed":t==="down",onClick:()=>a("down"),style:t==="down"?fe:K,children:(0,T.jsx)("span",{"aria-hidden":"true",children:"\u{1F44E}"})})]}),t==="down"?(0,T.jsxs)("div",{style:{display:"grid",gap:2},children:[(0,T.jsxs)("label",{htmlFor:c,style:{fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:["What should it have done? ",(0,T.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"(optional)"})]}),(0,T.jsx)("input",{id:c,type:"text","data-testid":"quick-ask-should",value:i,maxLength:300,autoComplete:"off",enterKeyHint:"done",onChange:f=>{l(f.target.value),s(!1)},onKeyDown:f=>{f.key==="Enter"&&(f.preventDefault(),g())},onBlur:g,style:Be}),d?(0,T.jsx)("span",{role:"status","data-testid":"quick-ask-should-kept",style:{fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:n.keptSays?.trim()||"Kept, to learn from."}):null]}):null]})}var K={display:"inline-grid",placeItems:"center",width:30,height:28,padding:0,font:"inherit",fontSize:"0.875rem",lineHeight:1,background:"transparent",border:"1px solid transparent",borderRadius:6,boxShadow:"none",cursor:"pointer",opacity:.7},fe={...K,opacity:1,borderColor:"var(--graview-accent)",background:"var(--graview-panel)"},Be={boxSizing:"border-box",width:"100%",height:32,padding:"0 8px",font:"inherit",fontSize:"max(1rem,16px)",color:"var(--graview-ink)",background:"var(--graview-panel)",border:"1px solid var(--graview-edge)",borderRadius:8};var j=n=>n.charAt(0).toUpperCase()+n.slice(1);function me(n,e){if(!e)return;let t=n.graph.getNode(e);if(t)return t.kind;let o=/^(?:kind|aggregate):(.+)$/.exec(e)?.[1];return o&&n.schema.tryDefinition(o)?o:void 0}function he(n,e,t){let o=n.schema;if(e.decided.type==="plan")return j(e.words);if(e.decided.type!=="act")return;let i=e.decided.act,l=n.allMutations().find(y=>y.name===i);if(!l)return;let d=l.title??l.name,s=y=>/\b(?:it|this|them)\b/i.test(d)?d.replace(/\b(?:it|this|them)\b/i,y):`${d} ${y}`,c=t?n.graph.getNode(t):void 0,a=c?Q(o.tryDefinition(c.kind),c):void 0,g=e.reading?.kind??e.target.kind;if(!g||!o.tryDefinition(g))return;if(e.reading?.which==="itself"||!e.reading&&c?.kind===g)return c&&c.kind===g&&a?j(s(a)):void 0;let f=c?new Set([...n.graph.in(c.id),...n.graph.out(c.id)].filter(y=>y.kind===g).map(y=>y.id)).size:me(n,t)===g?n.graph.allNodes().filter(y=>y.kind===g).length:0;if(f===0)return;let w=f===1?(o.tryDefinition(g)?.noun??g).toLowerCase():X(o,g).toLowerCase();return j(s(`the ${f} ${w}${a?` in ${a}`:""}`))}async function Ue(n,e,t){return R(await I(n),A(e,t))}function Ge(n,e,t,o,i,l=4){if(o.trim()==="")return[];let d=me(e,i);return M(n,{words:o,...d?{kind:d}:{}},{reader:t,most:l}).flatMap(({telling:s})=>{let c=he(e,s,i);return c?[{key:`told:${s.id}`,telling:s,label:c}]:[]})}function Ke(n,e,t,o,i=3){let l=new Set,d=[];for(let s of[...n].reverse()){if(d.length>=i)break;if(!(s.rating==="up"||s.outcome==="accepted")||s.by!==void 0&&t.id!==void 0&&s.by.id!==void 0&&s.by.id!==t.id)continue;let c=he(e,s,o);!c||l.has(c.toLowerCase())||(l.add(c.toLowerCase()),d.push({key:`told:${s.id}`,telling:s,label:c}))}return d}var v=P(ne(),1),u=P(N(),1);function je({told:n,store:e,principal:t,onClose:o}){let[i,l]=(0,v.useState)(null),[d,s]=(0,v.useState)({}),c=(0,v.useRef)(null);(0,v.useEffect)(()=>{let r=!0;return Promise.resolve().then(()=>n.list()).then(p=>r&&l(p),()=>r&&l([])),c.current?.focus({preventScroll:!0}),()=>{r=!1}},[n]);let a=(0,v.useMemo)(()=>i?R(i,$(e,t)):[],[i,e,t]),g=(0,v.useMemo)(()=>[...ce(a,d)].sort((r,p)=>r.at<p.at?1:-1),[a,d]),f=(0,v.useMemo)(()=>[...new Set(a.flatMap(r=>r.reading?.kind??r.target.kind??[]))].sort(),[a]),w=r=>e.allMutations().find(p=>p.name===r)?.title??r,y=r=>e.schema.tryDefinition(r)?.plural??r,b=r=>{try{return Z(r.by,{graph:e.graph,schema:e.schema})}catch{return r.by.id??r.by.kind}},k=(r,p)=>{l(m=>m&&H(m,{change:r,with:p})),Promise.resolve().then(()=>n.change(r,p)).catch(()=>{})},O=r=>{l(p=>p&&H(p,{remove:r})),Promise.resolve().then(()=>n.remove(r)).catch(()=>{})};return(0,u.jsxs)("section",{ref:c,tabIndex:-1,"data-testid":"told-panel","data-graview-overlay":"","aria-label":"What Graview has been told",onKeyDown:r=>{r.key==="Escape"&&(r.stopPropagation(),o())},style:qe,children:[(0,u.jsxs)("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[(0,u.jsx)("h2",{style:{margin:0,fontSize:"1rem",fontWeight:600,flex:"1 1 auto"},children:"What Graview has been told"}),(0,u.jsx)("button",{type:"button","data-testid":"told-close",onClick:o,style:F,children:"Close"})]}),(0,u.jsx)("p",{"data-testid":"told-teaching",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:i===null?"Reading what was told\u2026":ue(a)}),(0,u.jsxs)("div",{role:"group","aria-label":"Show only",style:{display:"flex",flexWrap:"wrap",gap:8,fontSize:"0.8125rem"},children:[(0,u.jsxs)("label",{style:q,children:["Rating",(0,u.jsxs)("select",{"data-testid":"told-filter-rating",value:d.rating??"",onChange:r=>s(({rating:p,...m})=>r.target.value?{...m,rating:r.target.value}:m),children:[(0,u.jsx)("option",{value:"",children:"Any"}),(0,u.jsx)("option",{value:"up",children:"\u{1F44D} Right"}),(0,u.jsx)("option",{value:"down",children:"\u{1F44E} Wrong"}),(0,u.jsx)("option",{value:"none",children:"Not rated"})]})]}),(0,u.jsxs)("label",{style:q,children:["Outcome",(0,u.jsxs)("select",{"data-testid":"told-filter-outcome",value:d.outcome??"",onChange:r=>s(({outcome:p,...m})=>r.target.value?{...m,outcome:r.target.value}:m),children:[(0,u.jsx)("option",{value:"",children:"Any"}),z.map(r=>(0,u.jsx)("option",{value:r,children:G[r]},r))]})]}),(0,u.jsxs)("label",{style:q,children:["Kind",(0,u.jsxs)("select",{"data-testid":"told-filter-kind",value:d.kind??"",onChange:r=>s(({kind:p,...m})=>r.target.value?{...m,kind:r.target.value}:m),children:[(0,u.jsx)("option",{value:"",children:"Any"}),f.map(r=>(0,u.jsx)("option",{value:r,children:y(r)},r))]})]})]}),i!==null&&g.length===0?(0,u.jsx)("p",{"data-testid":"told-none",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:a.length===0?"Nothing has been told here yet.":"Nothing told here fits these."}):null,(0,u.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,overflowY:"auto"},children:g.map(r=>(0,u.jsxs)("li",{"data-testid":"told-entry","data-telling":r.id,"data-outcome":r.outcome,"data-rating":r.rating??"","data-excluded":r.excluded?"":void 0,"data-pinned":r.pinned?"":void 0,style:Ye,children:[(0,u.jsxs)("p",{style:{margin:0,fontWeight:550,overflowWrap:"anywhere"},children:["\u201C",r.words,"\u201D"]}),(0,u.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem"},children:[ge(r,w)," \xB7 ",G[r.outcome],r.rating?` \xB7 ${r.rating==="up"?"\u{1F44D} right":"\u{1F44E} wrong"}`:"",r.pinned?" \xB7 a good example":"",r.excluded?" \xB7 excluded from suggestions":""]}),r.should?(0,u.jsxs)("p",{style:{margin:0,fontSize:"0.8125rem",fontStyle:"italic"},children:["Should have: ",r.should]}):null,(0,u.jsxs)("p",{style:{margin:0,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:[b(r)," \xB7 ",(0,u.jsx)("time",{dateTime:r.at,children:new Date(r.at).toLocaleString()}),r.ms!==void 0?` \xB7 ${r.ms<1e3?`${r.ms} ms`:`${(r.ms/1e3).toFixed(1)} s`}`:""]}),(0,u.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:[(0,u.jsx)("button",{type:"button","data-testid":"told-pin","aria-pressed":r.pinned===!0,onClick:()=>k(r.id,{pinned:!r.pinned}),style:F,children:r.pinned?"Not a good example":"A good example"}),(0,u.jsx)("button",{type:"button","data-testid":"told-exclude","aria-pressed":r.excluded===!0,onClick:()=>k(r.id,{excluded:!r.excluded}),style:F,children:r.excluded?"Suggest it again":"Exclude from suggestions"}),(0,u.jsx)("button",{type:"button","data-testid":"told-delete",onClick:()=>O(r.id),style:F,children:"Delete"})]})]},r.id))})]})}var qe={position:"absolute",insetBlock:"60px 12px",insetInlineEnd:12,width:"min(440px, calc(100% - 24px))",boxSizing:"border-box",display:"flex",flexDirection:"column",gap:10,padding:14,borderRadius:12,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)",zIndex:ee("popover"),overflow:"hidden"},Ye={display:"grid",gap:4,padding:10,borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)"},F={padding:"2px 10px",minHeight:28,font:"inherit",fontSize:"0.8125rem",borderRadius:8},q={display:"inline-flex",alignItems:"center",gap:4};export{He as RateTelling,je as ToldPanel,_ as changeTelling,$e as examplesHere,Fe as keepTelling,Ue as readToldHere,A as seenOnThisPage,_e as tellingDraftOf,Ke as toldForHere,I as toldListed,Ge as toldSuggestionsFrom,ze as watchTelling};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{T as k,V as y,c,h as l,o as p}from"./chunk.3GNT5MKP.js";import"./chunk.AJMVRFYX.js";import"./chunk.Q355UPFG.js";import{b as m}from"./chunk.GMLONS5L.js";import"./chunk.6NG76MDA.js";import"./chunk.35KMZHB7.js";import"./chunk.IAEGJDF3.js";import"./chunk.YZPESGCP.js";import"./chunk.SY5ID44D.js";import"./chunk.GVT4UUQA.js";import"./chunk.5R744JGZ.js";import"./chunk.O2OL6RQQ.js";import"./chunk.J6HF7IRQ.js";import"./chunk.LRNFE3UK.js";import"./chunk.MB7LKKUD.js";import"./chunk.T2OUHRAA.js";import"./chunk.GRFD42WM.js";import"./chunk.EP6Q32WT.js";import"./chunk.QAM76AXV.js";import"./chunk.Z27NSSYL.js";import"./chunk.PZ7KY6XH.js";import"./chunk.WEMUKZKH.js";import"./chunk.T27QKVKP.js";import"./chunk.WVUJXDXZ.js";import"./chunk.DWM7AR5Y.js";import"./chunk.6KJGRM7A.js";import"./chunk.WALVW3KJ.js";import"./chunk.SNHKYH72.js";import"./chunk.UGQYMN4J.js";import"./chunk.RG5G6YQD.js";import"./chunk.MIE4TJRW.js";import"./chunk.QRQ5WPZI.js";import"./chunk.RD2FSSLV.js";import"./chunk.37RFCHSS.js";import"./chunk.SO6NT5K7.js";import"./chunk.MUSMNKE4.js";import"./chunk.SJQPTDAT.js";import"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{G as S,H as s,I as d,W as f,fa as g}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as n}from"./chunk.AJZBJBMO.js";var u=n(S(),1);var t=n(f(),1);function D({context:a}){let r=l(),h=g(),[w]=(0,u.useState)(()=>s(null)),o=d(h?.seatTalk??w),P=()=>{(window.history.state?.idx??0)>0?r(-1):r("/")};return(0,t.jsxs)(k,{context:a,"data-testid":"draft-page",children:[(0,t.jsx)(y,{context:a,...o.draft?{"data-testid":"draft-title"}:{},children:o.draft?o.draft.title:"Nothing drawn"}),o.draft?(0,t.jsx)(m,{page:!0,go:e=>r(e.address),onPick:e=>{let i=a.store.graph.getNode(e);i&&r(c(a.store.schema,i.kind,e))},onDiscard:P}):(0,t.jsxs)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:["Ask for a way of seeing \u2014 \u201Ca board of tasks by status\u201D \u2014 and it is drawn here."," ",(0,t.jsx)(p,{to:"/",style:{color:"var(--graview-accent)"},children:"Home \u2192"})]})]})}export{D as DraftPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as le,b as ce}from"./chunk.25VJPUDH.js";import{a as ue}from"./chunk.HJUZMOW2.js";import{e as oe,f as ie,g as re,h as O,i as ae,j as de,k as P}from"./chunk.NAXOXBOF.js";import{b as ge}from"./chunk.6W6XMLSF.js";import"./chunk.PZ7KY6XH.js";import"./chunk.WEMUKZKH.js";import"./chunk.T27QKVKP.js";import"./chunk.SO6NT5K7.js";import"./chunk.MUSMNKE4.js";import"./chunk.SJQPTDAT.js";import"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import{m as M}from"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{G as te,W as H,ea as I,ga as ne,oa as se}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{Dc as ee,eb as J,fc as X,ha as Y,la as _,na as F,oa as Q,sa as Z,yb as K}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";function pe(e){let n=e.basis.trim(),r=/^[^:]{1,40}: (?:\d(?:\.\d+)?|none|no)\b/i.test(n)?/\(([^()]+)\)\s*$/.exec(n)?.[1]??"":n;if(!r||/^[\d.\s%]+$/.test(r))return"No reason was kept.";let o=r.charAt(0).toUpperCase()+r.slice(1);return/[.!?]$/.test(o)?o:`${o}.`}var ke=new Set(["in","into","on","onto","under","at","within","inside","near","beside","behind","over","after","before"]),$e=new Set(["for","to","on","in","with","by","from","of","after","before","into","about","under"]),xe=e=>/ies$/.test(e)?e.replace(/ies$/,"y"):/(ch|sh|x|ss|o)es$/.test(e)?e.replace(/es$/,""):e.replace(/s$/,""),We=e=>/^[A-Z][a-z]/.test(e)?e.charAt(0).toLowerCase()+e.slice(1):e;function U(e,n){let a=e.schema,r=s=>typeof s=="string"?e.graph.getNode(s):void 0,o=(s,y=!1)=>({record:s.id,label:_(a.tryDefinition(s.kind),s),...y?{quoted:!0}:{}}),i=(s,y,w)=>({parts:s,text:s.map(S=>typeof S=="string"?S:S.quoted?`\u201C${S.label}\u201D`:S.label).join(""),group:y,many:w}),c=i([n.intent],`intent:${n.intent}`,s=>`${s} suggestions`);if(n.calls.length!==1)return c;let m=n.calls[0],$=m.args,u=e.allMutations().find(s=>s.name===m.name),f=u?.subject?.arg,d=f?r($[f]):void 0;if(!u||!d)return c;let v=s=>F(a,d.kind,s),b=s=>`${m.name}:${s}`,k=()=>{let s=X(u.input).filter(y=>y.name!==f&&$[y.name]!==void 0);return s.length===1?r($[s[0].name]):void 0},x=r($.into);if(m.name===`merge-${d.kind}`&&x)return i(["Merge ",o(d,!0)," into ",o(x),"?"],b("merge"),s=>`${v(s)} to merge`);if(m.name===`archive-${d.kind}`)return i(["Set ",o(d,!0)," aside?"],b("archive"),s=>`${v(s)} to set aside`);let h=k(),p=u.connects?.find(s=>a.tryDefinition(d.kind)?.edges?.[s]!==void 0);if(h&&p){let s=a.tryDefinition(d.kind).edges[p],y=Z(a.tryDefinition(d.kind),p).split(" "),[w,S]=y,C=We(Q(a,h.kind));if(w&&ke.has(w))return i(["Put ",o(d,!0),` ${w} `,o(h),"?"],b(`put:${w}`),W=>`${v(W)} to put ${w} ${C}`);if(w&&S&&$e.has(S)&&/[^s]s$/.test(w))return i(["Should ",o(d,!0),` ${[xe(w),...y.slice(1)].join(" ")} `,o(h),"?"],b("verb"),W=>`${v(W)} to link`);let z=y.join(" ");return s.cardinality==="one"?i(["Make ",o(h),` the ${z} of `,o(d,!0),"?"],b("one"),W=>`${v(W)} to give ${/^[aeiou]/i.test(z)?"an":"a"} ${z}`):i(["Add ",o(h),` to the ${z} of `,o(d,!0),"?"],b("many"),W=>`${v(W)} to link`)}let T=Object.entries($).filter(([s,y])=>s!==f&&typeof y=="string"&&!r(y));return n.lineage?.actor==="categorize"&&T.length===1?i(["Mark ",o(d,!0),` as ${Y(String(T[0][1]))}?`],b("mark"),s=>`${v(s)} to mark`):c}function me(e,n){let a=new Map;for(let r of n){let o=U(e,r),i=r.calls.length===1?o.group:`one:${a.size}`,c=a.get(i);c?c.suggestions.push(r):a.set(i,{sentence:o,suggestions:[r]})}return[...a.values()].map(({sentence:r,suggestions:o})=>o.length>1?{words:r.many(o.length),suggestions:o}:{suggestions:o})}var g=R(te(),1);var fe=R(te(),1),A=R(H(),1),ye={minWidth:0,overflowWrap:"anywhere"};function he({suggestion:e,decides:n,heard:a}){let{store:r,principal:o}=I(),[i,c]=(0,fe.useState)(null),m=e.items;if(m.length<2)return null;let $=(u,f)=>{c(null);try{O(r,e.id,{author:o,items:[u]}),a("Accepted that change; the rest still wait."),requestAnimationFrame(()=>{let d=document.querySelector(`[data-suggestion="${CSS.escape(e.id)}"]`);(d?.querySelectorAll('[data-testid="suggestion-item-accept"]')[f]??d?.querySelectorAll('[data-testid="suggestion-item-accept"]')[f-1]??d?.querySelector('[data-testid="suggestion-accept"]'))?.focus()})}catch(d){c(d instanceof Error?d.message:String(d))}};return(0,A.jsxs)("details",{"data-testid":"suggestion-items",style:{minWidth:0},children:[(0,A.jsx)("summary",{style:{cursor:"pointer",fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:`Show the ${m.length} changes`}),(0,A.jsx)("ol",{style:{margin:"6px 0 0",padding:0,listStyle:"none",display:"grid",gap:4,minWidth:0},children:m.map((u,f)=>(0,A.jsxs)("li",{"data-testid":"suggestion-item","data-item":u.at,style:{display:"flex",alignItems:"baseline",gap:6,minWidth:0,fontSize:"0.75rem"},children:[(0,A.jsx)("span",{style:{...ye,flex:"1 1 auto"},children:u.intent}),n?(0,A.jsx)("button",{type:"button","data-testid":"suggestion-item-accept","aria-label":`Accept: ${u.intent}`,onClick:()=>$(u.at,f),style:{minHeight:24,padding:"1px 8px",fontSize:"0.75rem",flex:"0 0 auto"},children:"Accept"}):null]},u.at))}),i?(0,A.jsx)("span",{"data-testid":"suggestion-item-refused",role:"alert",style:{...ye,display:"block",fontSize:"0.75rem",color:"var(--graview-warn)"},children:i}):null]})}var t=R(H(),1);function Ae(e,n,a=0){let r=[e>0?`${e===1?"one suggestion":`${e} suggestions`} waiting`:"",e>0&&a>0?`${a===1?"a reader agrees":`${a} readers agree`} with one that waits`:"",n>0?`tidied ${n===1?"one thing":`${n} things`} while you were away`:""].filter(Boolean);return r.length>0?r.join(" \xB7 ").replace(/^./,o=>o.toUpperCase()):void 0}function Se(){let{store:e,principal:n,dismissals:a,app:r}=I(),o=ne(),i=(0,g.useMemo)(()=>ce(a,r?.name??"app",n),[a,r?.name,n]),[c,m]=(0,g.useReducer)(u=>u+1,0);return(0,g.useEffect)(()=>i.onChange?.(m),[i]),(0,g.useEffect)(()=>e.subscribe((u,f)=>f.some(d=>d.vote!==void 0)&&m()),[e]),{waiting:(0,g.useMemo)(()=>oe(e,n,{dismissed:i.list()}),[e,n,o,i,c]),notNow:i}}function Ye({onCount:e}){let{waiting:n}=Se();return(0,g.useEffect)(()=>e(n.length),[e,n.length]),null}function _e({close:e,done:n}){let{store:a,whileAway:r}=I(),{waiting:o,notNow:i}=Se(),[c,m]=(0,g.useState)(""),$=se(),u=k=>a.graph.has(k)?x=>{e(),$.record(x)}:null,f=r?.tidied??0,d=r?Ae(o.length,f,r.agreed):void 0,v=k=>{if(m(k),o.length>1){requestAnimationFrame(()=>document.querySelector('[data-testid="suggested"] [data-testid="suggestion-accept"]')?.focus());return}n()},b=(0,t.jsx)("span",{role:"status","data-testid":"suggestion-heard",style:M,children:c});return o.length===0&&!d?b:(0,t.jsxs)("div",{"data-testid":"suggested",style:{display:"flex",flexDirection:"column",gap:9,minWidth:0},children:[d?(0,t.jsxs)("p",{"data-testid":"while-away",style:{margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)"},children:[d,"."]}):null,o.length===0?(0,t.jsx)("p",{style:{margin:0,fontSize:"0.75rem",lineHeight:1.45,color:"var(--graview-ink-faint)"},children:"What it did is in Activity."}):null,[o.filter(P),o.filter(k=>!P(k))].map((k,x)=>k.length===0?null:(0,t.jsxs)("div",{style:{display:"grid",gap:6,minWidth:0},children:[o.some(P)?(0,t.jsx)("h3",{style:{margin:0,fontSize:"0.75rem",fontWeight:600,color:"var(--graview-ink-muted)"},children:x===0?"Proposed":"Suggested by the app"}):null,(0,t.jsx)("ol",{"data-testid":x===0?"proposals":"suggestions",style:we,children:me(a,k).map(h=>h.words?(0,t.jsxs)("li",{"data-testid":"suggestion-group",style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:6,minWidth:0},children:[(0,t.jsx)("span",{style:{...N,fontSize:"0.75rem",fontWeight:600,color:"var(--graview-ink-muted)"},children:h.words}),(0,t.jsx)("ol",{style:we,children:h.suggestions.map(p=>(0,t.jsx)(ve,{suggestion:p,notNow:i,settled:v,heard:m,goes:u},p.id))})]},h.suggestions[0].id):h.suggestions.map(p=>(0,t.jsx)(ve,{suggestion:p,notNow:i,settled:v,heard:m,goes:u},p.id)))})]},x)),b]})}var N={minWidth:0,overflowWrap:"anywhere"},we={margin:0,padding:0,listStyle:"none",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:10,fontSize:"0.8125rem",minWidth:0},E={minHeight:24,padding:"1px 10px",fontSize:"0.75rem"},j={...E,border:"1px solid transparent",background:"transparent",boxShadow:"none",color:"var(--graview-ink-muted)"};function Te({part:e,go:n}){let a={display:"inline-block",maxWidth:"min(24ch, 100%)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",verticalAlign:"bottom"},r=n?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-record","data-record":e.record,title:`Go to ${e.label}`,onClick:()=>n(e.record),className:"graview-activity-record",style:{all:"unset",...a,cursor:"pointer",fontWeight:600,color:"var(--graview-ink)",textDecoration:"underline",textDecorationColor:"color-mix(in srgb, var(--graview-ink) 35%, transparent)",textUnderlineOffset:2},children:e.label}):(0,t.jsx)("span",{title:e.label,style:{...a,fontWeight:600},children:e.label});return e.quoted?(0,t.jsxs)(t.Fragment,{children:["\u201C",r,"\u201D"]}):r}var Ce={accept:"Accepted.",decline:"Declined: it will not be suggested again.",later:"Hidden from you until tomorrow.",withdraw:"Withdrawn."},G={recorded:"Your vote was recorded.",withdrawn:"Your vote was withdrawn."},ze=(e,n)=>n.startsWith(`${e}: `)?n.slice(e.length+2):n,De=e=>{let n=`${e.for} for, ${e.against} against`,a=Re(e.advisory);return a?`${n} \xB7 ${a}`:n};function Re(e){if(!e)return"";let n=e.for===0?"":e.for===1?"a visitor agrees":`${e.for} visitors agree`,a=e.against===0?"":e.against===1?`${n?"one":"a visitor"} disagrees`:`${e.against}${n?"":" visitors"} disagree`;return[n,a].filter(Boolean).join(", ")}function ve({suggestion:e,notNow:n,settled:a,heard:r,goes:o}){let{store:i,principal:c,seats:m,people:$,signIn:u}=I(),[f,d]=(0,g.useState)(null),[v,b]=(0,g.useState)(null),k=(0,g.useId)(),x=(0,g.useId)(),h=J(e.author,{graph:i.graph,schema:i.schema,seats:m,people:$}),p=(0,g.useMemo)(()=>ie(i,e,c),[i,e,c]),T=(0,g.useMemo)(()=>p||i.permits({name:ee,args:{suggestion:e.id,vote:"for"}},c).ok,[p,i,e.id,c]),{tally:s}=e,y=P(e),w=y&&c!==void 0&&!p&&K(c).id===e.lineage.proposedBy,S=async l=>{d(null);try{if(l==="withdraw")de(i,e.id,{author:c});else if(l==="accept"||l==="decline"){if((l==="accept"?O(i,e.id,{author:c}):ae(i,e.id,{author:c})).voted!==void 0){b(G.recorded),r(G.recorded);return}}else if(l==="unvote"){re(i,e.id,null,{author:c}),b(G.withdrawn),r(G.withdrawn);return}else await n.dismiss({suggestion:e.id,at:new Date().toISOString(),until:le()});a(Ce[l])}catch(D){d(D instanceof Error?D.message:String(D))}},C=e.items.length>1,z=(0,g.useMemo)(()=>U(i,e),[i,e]),W=new Set(z.parts.flatMap(l=>typeof l=="string"?[]:[l.record])),L=e.lineage&&!(y&&e.lineage.basis.startsWith("Proposed by "))?pe(e.lineage):void 0,[V,be]=(0,g.useState)(!1),q=(0,g.useId)(),B=(0,g.useId)();return(0,t.jsxs)("li",{"data-testid":"suggestion","data-suggestion":e.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:4,lineHeight:1.45,minWidth:0},children:[(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",columnGap:10,rowGap:4,minWidth:0},children:[(0,t.jsxs)("span",{id:q,"data-graview-suggestion-words":"",style:{...N,flex:"1 1 14em"},children:[y?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{"data-testid":"proposed-by",style:{color:"var(--graview-ink-muted)"},children:["Proposed by ",(0,t.jsx)("strong",{style:{fontWeight:600,color:"var(--graview-ink)"},children:w?"you":h}),":"]})," "]}):C?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("strong",{style:{fontWeight:600},children:h})," ",(0,t.jsx)("span",{style:{color:"var(--graview-ink-muted)"},children:"suggests"})," "]}):null,C?ze(h,e.headline??e.intent):z.parts.map((l,D)=>typeof l=="string"?l:(0,t.jsx)(Te,{part:l,go:o(l.record)},D))]}),(0,t.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:4,marginInlineStart:"auto",minWidth:0},children:[L?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-why","aria-expanded":V,"aria-controls":B,onClick:()=>be(l=>!l),style:{...j,padding:"1px 6px"},children:"Why?"}):null,w?(0,t.jsx)("button",{type:"button","data-testid":"proposal-withdraw",onClick:()=>void S("withdraw"),style:E,children:"Withdraw"}):T?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-accept",onClick:()=>void S("accept"),...p?{"aria-describedby":q}:{"aria-pressed":s.mine==="for","aria-describedby":x},style:E,children:p&&C?"Accept all":"Yes"}):u?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-sign-in",onClick:()=>u.run(),style:E,children:"Sign in to vote"}):null,T&&!w?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-decline",onClick:()=>void S("decline"),...p?{"aria-describedby":q}:{"aria-pressed":s.mine==="against","aria-describedby":x},style:E,children:"No"}):null,!p&&T&&!w&&s.mine!==void 0?(0,t.jsx)("button",{type:"button","data-testid":"suggestion-withdraw-vote",onClick:()=>void S("unvote"),style:j,children:"Withdraw vote"}):null,(0,t.jsx)("button",{type:"button","data-testid":"suggestion-not-now",onClick:()=>void S("later"),title:"Hide it from you until tomorrow. It still waits for everyone else.","aria-describedby":k,style:j,children:"Later"})]})]}),(0,t.jsx)("span",{id:k,style:M,children:"Hides it from you until tomorrow; it still waits for everyone else."}),!p&&T&&!w?(0,t.jsx)("span",{id:x,style:M,children:"Counts as your vote; somebody who may make it decides."}):null,L?(0,t.jsx)("span",{id:B,"data-graview-lineage":"",hidden:!V,style:{...N,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:L}):null,C?(0,t.jsx)(he,{suggestion:e,decides:p,heard:r}):null,e.about.some(l=>!W.has(l))&&(C||W.size===0)?(0,t.jsx)("div",{"data-graview-suggestion-records":"",style:{display:"flex",flexWrap:"wrap",gap:4,minWidth:0},children:e.about.filter(l=>!W.has(l)).slice(0,4).map(l=>(0,t.jsx)(ue,{id:l,label:ge(i,l),go:o(l),testId:"suggestion-record"},l))}):null,p&&s.for+s.against+(s.advisory?s.advisory.for+s.advisory.against:0)>0?(0,t.jsx)("span",{"data-testid":"suggestion-tally",style:{...N,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:De(s)}):null,v?(0,t.jsx)("span",{"data-testid":"suggestion-voted",role:"status",style:{...N,fontSize:"0.75rem",color:"var(--graview-ink-muted)"},children:v}):null,f?(0,t.jsx)("span",{"data-testid":"suggestion-refused",role:"alert",style:{...N,fontSize:"0.75rem",color:"var(--graview-warn)"},children:f}):null]})}export{Ye as SuggestedCount,_e as SuggestedList,Re as advisoryWords,Ae as awayWords,De as tallyWords};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as A}from"./chunk.QDVGHI7R.js";import{a as x,c as T,d as w}from"./chunk.AKJS2NUM.js";import{L as S,P as v,S as $}from"./chunk.ZEZUKRC6.js";function M(e,t,n){let r=e.schema.tryDefinition(t)?.fields?.shape?.[n];return r===void 0?void 0:A(r)}function I(e,t){if(e===void 0)return[];if(!Array.isArray(e))return[`The view's accepts is a list of { "kind": <a kind>, "field": <its image, video or file field> }.`];let n=[],i=new Set(t.schema.kinds);for(let r of e){let{kind:c,field:o}=r??{};typeof c!="string"||typeof o!="string"?n.push(`Each of the view's accepts is { "kind": <a kind>, "field": <its image, video or file field> }.`):i.has(c)?M(t,c,o)?t.allMutations().some(a=>(a.creates??[]).includes(c)&&Object.hasOwn(a.input?.shape??{},o))||n.push(`No act of this app makes a "${c}" with its "${o}", so a file dropped could become nothing.`):n.push(`The view accepts files into ${c}'s "${o}", which holds no picture, video or file.`):n.push(`The view accepts files for "${c}", which is no kind of this app.`)}return n}function E(e,t,n){if(e===void 0||e===!0)return[];let i=`The view's pictures is true; the kinds whose pictures it draws, ["circuit"]; or { "width": <the widest it draws a picture, in pixels> } with the fields it draws them from, by kind, { "circuit": "photo" }.`;if(typeof e!="object"||e===null)return[i];let r=new Set([...n.attach==="home"?[]:[n.attach],...n.reads?.kinds??[]]),c=new Set(t.schema.kinds),o=[],a=d=>{if(!c.has(d))return void o.push(`The view's pictures chooses "${d}", which is no kind of this app.`);r.has(d)||o.push(`The view's pictures chooses "${d}", whose records it is not handed: add "${d}" to its reads.kinds.`)};if(Array.isArray(e)){if(e.length===0||!e.every(d=>typeof d=="string"))return[i];for(let d of e)a(d);return o}for(let[d,l]of Object.entries(e)){if(d==="width"&&typeof l!="string"&&!Array.isArray(l)){Number.isInteger(l)&&l>=16&&l<=4096||o.push("The view's pictures width is a whole number of pixels from 16 to 4096.");continue}let f=typeof l=="string"?[l]:Array.isArray(l)&&l.length>0&&l.every(u=>typeof u=="string")?l:void 0;if(!f){o.push(`The view's pictures says "${d}": beside "width", it names a kind and the field it draws pictures from, "circuit": "photo", or its fields, "circuit": ["photo", "map"].`);continue}let y=o.length;if(a(d),!(o.length>y))for(let u of f){let p=M(t,d,u);p?p.as==="video"&&o.push(`The view's pictures chooses ${d}'s "${u}", which holds videos: the host plays a video where the view places it, and hands no picture of it.`):o.push(`The view's pictures chooses ${d}'s "${u}", which holds no picture.`)}}return o}function F(e){if(e===void 0)return[];if(typeof e!="object"||e===null||Array.isArray(e))return[`The view's scene is { "maxHeight": <the tallest its preview on the Scene is drawn, in pixels> }.`];let{maxHeight:t,...n}=e,i=[];return Object.keys(n).length>0&&i.push(`The view's scene says ${Object.keys(n).map(r=>`"${r}"`).join(", ")}: only "maxHeight" is read.`),t!==void 0&&!(Number.isInteger(t)&&t>=80&&t<=4e3)&&i.push("The view's scene maxHeight is a whole number of pixels from 80 to 4000."),i}function j(e){return(e.acts??[]).map(t=>typeof t=="string"?{act:t}:t)}function C(e,t){let n=[],i=new Set(t.schema.kinds),r=new Set(t.schema.edgeKinds),c=new Set(t.allMutations().map(a=>a.name));(typeof e.name!="string"||!/^[a-z0-9][a-z0-9-]{0,62}$/.test(e.name))&&n.push(`The view's name "${String(e.name)}" is not lower-case letters, digits and hyphens.`),e.title!==void 0&&(typeof e.title!="string"||e.title.trim()===""||e.title.length>80)&&n.push("The view's title is empty or longer than 80 characters."),e.attach!=="home"&&!i.has(e.attach)&&n.push(`The view attaches to "${e.attach}", which is no kind of this app.`),e.cardinality!=="one"&&e.cardinality!=="many"&&n.push(`The view's cardinality is "${String(e.cardinality)}", not one or many.`),e.attach==="home"&&e.cardinality!=="many"&&n.push("A view of the home draws many records: its cardinality is many."),e.replaces!==void 0&&e.replaces!=="page"?n.push(`The view's replaces is "${String(e.replaces)}": the one thing a view replaces is "page", or leave it out to draw the view above the record's own fields.`):e.replaces==="page"&&e.attach==="home"&&n.push(`The home's view is the home already: replaces "page" is for a view of a kind, of one record (its page) or of many (its list).`),e.gestures!==void 0&&typeof e.gestures!="boolean"&&n.push(`The view's gestures is "${String(e.gestures)}": it is true, or left out.`),e.bleed!==void 0&&typeof e.bleed!="boolean"&&n.push(`The view's bleed is "${String(e.bleed)}": it is true, or left out.`),e.heading!==void 0&&(e.heading!=="own"||e.attach==="home"||e.cardinality!=="many"||e.title===void 0)&&n.push(`The view's heading is "${String(e.heading)}": it is "own" on a view that is a place (a title, cardinality many), or left out.`),e.flows!==void 0&&typeof e.flows!="boolean"?n.push(`The view's flows is "${String(e.flows)}": it is false for a view that keeps its place's frame, or left out.`):e.flows===!1&&(e.attach==="home"||e.cardinality!=="many"||e.title===void 0)&&n.push("Only a view that is a place keeps a frame: flows false needs a title and cardinality many on a kind."),n.push(...F(e.scene)),e.scene!==void 0&&(e.attach==="home"||e.cardinality!=="many")&&n.push("Only a view of a kind's members is drawn on the Scene as a card: scene needs cardinality many on a kind."),n.push(...E(e.pictures,t,e)),n.push(...I(e.accepts,t));for(let a of e.reads?.kinds??[])i.has(a)||n.push(`The view reads "${a}", which is no kind of this app.`);for(let a of e.reads?.edges??[])r.has(a)||n.push(`The view reads the edge "${a}", which no kind of this app declares.`);let o=new Set;for(let a of j(e)){c.has(a.act)||n.push(`The view asks for the act "${a.act}", which this app does not declare.`);let d=a.as??a.act;o.has(d)&&n.push(`Two of the view's acts are called "${d}".`),o.add(d)}return n}function H(e,t,n){let i=[...new Set([...t.attach==="home"?[]:[t.attach],...t.reads?.kinds??[]])];if(i.length<2)return[];let r=new Set(t.reads?.edges??[]),c=o=>new RegExp(`(["'\`])${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\1`).test(n);return e.schema.edgeKinds.filter(o=>{let a=e.schema.edge(o);return!r.has(o)&&a!==void 0&&a.from.some(d=>i.includes(d))&&(a.to==="*"||a.to.some(d=>i.includes(d)))&&c(o)})}function z(e,t,n){let i=H(e,t,n);if(i.length===0)return;let r=(c,o)=>c.length<2?c[0]??"":`${c.slice(0,-1).join(", ")} ${o} ${c[c.length-1]}`;return`"${t.name}" names ${r(i,"and")} but does not read ${i.length>1?"them":"it"}, so the view is handed no such links: add ${r(i.map(c=>`"${c}"`),"and")} to its manifest's reads.edges.`}function D(e,t){return[...t.attach==="home"?[]:[t.attach],...t.reads?.kinds??[]].some(i=>Object.keys(e.schema.tryDefinition(i)?.computed??{}).length>0)}function Z(e,t,n){let{manifest:i}=n,r=n.input??{},o=e.seenBy(t).graph,a=i.attach==="home"?void 0:i.attach,d=a&&i.cardinality==="one"&&r.node?o.getNode(r.node.id):void 0,l=d&&d.kind===a?[d]:[],f=a&&i.cardinality==="many"?r.nodes?r.nodes.flatMap(s=>{let h=o.getNode(s.id);return h&&h.kind===a?[h]:[]}):o.nodesOfKind(a):[],y=new Set([...l,...f].map(s=>s.id)),u=x(o,y,{kinds:(i.reads?.kinds??[]).filter(s=>s!==a||i.cardinality==="one"),edges:i.reads?.edges??[]}),p=new Map;for(let s of[...f,...u.nodes])l.some(h=>h.id===s.id)||p.set(s.id,s);let P=new Set([...l.map(s=>s.id),...p.keys()]),G=[...u.edges],O=new Set(j(i).map(s=>s.act)),V=e.permittedMutations(t).filter(s=>O.has(s.name)).map(s=>({name:s.name,title:s.title??s.name,...s.description!==void 0?{description:s.description}:{},...s.subject?{subject:{kinds:s.subject.kinds,arg:s.subject.arg}}:{}})),m=s=>s?.filter(h=>P.has(h)),k=n.computed,b=s=>k?{...w(e,s),...k(o,s)}:w(e,s);return{view:i.name,...l[0]?{node:b(l[0])}:{},nodes:[...p.values()].map(b),edges:G,...i.title!==void 0?{label:i.title}:r.label!==void 0?{label:r.label}:{},cardinality:i.cardinality,...r.fidelity!==void 0?{fidelity:r.fidelity}:{},...r.mode!==void 0?{mode:r.mode}:{},...r.selected!==void 0?{selected:r.selected}:{},...r.implicated?{implicated:m(r.implicated)}:{},...r.flagged?{flagged:m(r.flagged)}:{},acts:V,...n.theme?{theme:n.theme}:{},locale:v(),timeZone:$(),today:e.today()??S(),...T(e.schema,[...l,...p.values()]),...n.places?{places:n.places.filter((s,h,g)=>g.findIndex(W=>W.as===s.as)===h).map(({as:s,title:h,kind:g})=>({as:s,title:h,kind:g}))}:{}}}export{M as a,j as b,C as c,H as d,z as e,D as f,Z as g};
|