graview 0.1.61 → 0.1.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/preview/{chunk.SAYAFOF6.js → chunk.22BZU7ME.js} +1 -1
- package/dist/preview/chunk.2AT3GRXM.js +1 -0
- package/dist/preview/chunk.2B6P4GPS.js +1 -0
- package/dist/preview/{chunk.XZUHFXME.js → chunk.2GEJNG2U.js} +1 -1
- package/dist/preview/{chunk.R3N73BJO.js → chunk.2N4Z5K5S.js} +1 -1
- package/dist/preview/{chunk.3HFUO3DC.js → chunk.3FON2Y72.js} +1 -1
- package/dist/preview/chunk.3L37FY3G.js +4 -0
- package/dist/preview/{chunk.CRCJ3TAG.js → chunk.4HEFUOLV.js} +1 -1
- package/dist/preview/chunk.4HRYB7HF.js +1 -0
- package/dist/preview/{chunk.GQNSNJTJ.js → chunk.4TX6VCBT.js} +1 -1
- package/dist/preview/{chunk.4LG34OC2.js → chunk.5HGD6OWL.js} +2 -2
- package/dist/preview/{chunk.6VLCMBRE.js → chunk.5J3O2FVG.js} +1 -1
- package/dist/preview/{chunk.DP5DUV6F.js → chunk.5MZYCELA.js} +1 -1
- package/dist/preview/{chunk.F4VHCQNP.js → chunk.5ODHHH35.js} +1 -1
- package/dist/preview/{chunk.D5Q64GA4.js → chunk.5STU3KYG.js} +1 -1
- package/dist/preview/{chunk.PYVWGTQS.js → chunk.5YAOKOGV.js} +1 -1
- package/dist/preview/{chunk.E6RNMWFN.js → chunk.66P5IDTH.js} +1 -1
- package/dist/preview/{chunk.EN2ABVIP.js → chunk.6AKW7TXM.js} +1 -1
- package/dist/preview/{chunk.GI6XQF5X.js → chunk.6JO5HQDR.js} +1 -1
- package/dist/preview/{chunk.SIYBHZDD.js → chunk.75GVFX7L.js} +1 -1
- package/dist/preview/{chunk.E7UDVC4V.js → chunk.7KVUUEZA.js} +1 -1
- package/dist/preview/{chunk.W5TVQYAI.js → chunk.7M4HNKDR.js} +1 -1
- package/dist/preview/chunk.7OBIBPYH.js +1 -0
- package/dist/preview/chunk.7V56P2A7.js +1 -0
- package/dist/preview/{chunk.A2ZQASQV.js → chunk.7XLS6XTY.js} +1 -1
- package/dist/preview/chunk.7YOAW7ED.js +1 -0
- package/dist/preview/{chunk.3SMNWZ3M.js → chunk.A3OL2BI2.js} +1 -1
- package/dist/preview/{chunk.WS7LAT4Z.js → chunk.A3ZC2JBO.js} +1 -1
- package/dist/preview/{chunk.HZHNM2KI.js → chunk.ACTXR2MI.js} +1 -1
- package/dist/preview/chunk.AFNSAQEQ.js +1 -0
- package/dist/preview/{chunk.AVFOTYZR.js → chunk.AI34V6WV.js} +4 -4
- package/dist/preview/{chunk.VN7I7XIO.js → chunk.AJSUHPBE.js} +1 -1
- package/dist/preview/chunk.AQRB7LDA.js +1 -0
- package/dist/preview/{chunk.3FUUYYR5.js → chunk.B23WZQXQ.js} +1 -1
- package/dist/preview/chunk.BIDL7GQD.js +0 -0
- package/dist/preview/chunk.BLUKSGI4.js +1 -0
- package/dist/preview/chunk.BZMQDEIY.js +1 -0
- package/dist/preview/chunk.CAKFNKN5.js +1 -0
- package/dist/preview/chunk.CGALLZ54.js +1 -0
- package/dist/preview/{chunk.65KFZV3A.js → chunk.CHHYIMB7.js} +1 -1
- package/dist/preview/chunk.CXDGE5ZS.js +1 -0
- package/dist/preview/{chunk.KRFRREEW.js → chunk.CY3ELWCM.js} +1 -1
- package/dist/preview/chunk.DC35FJAB.js +1 -0
- package/dist/preview/{chunk.ZJCM62GH.js → chunk.DD2NKFDX.js} +1 -1
- package/dist/preview/{chunk.DHY7KOBV.js → chunk.DDO3GLEJ.js} +1 -1
- package/dist/preview/{chunk.6HZY5NRX.js → chunk.DDUCIUVW.js} +1 -1
- package/dist/preview/chunk.DEAP3H2L.js +1 -0
- package/dist/preview/chunk.DHJ3FQTR.js +1 -0
- package/dist/preview/{chunk.R5547CJ7.js → chunk.DNVWSWL2.js} +1 -1
- package/dist/preview/chunk.DPEIT3TW.js +1 -0
- package/dist/preview/chunk.DVSTLVIH.js +15 -0
- package/dist/preview/chunk.DZZL5IDD.js +5 -0
- package/dist/preview/{chunk.U2ISOUM2.js → chunk.ELOFPE25.js} +1 -1
- package/dist/preview/{chunk.7LZ6JDJA.js → chunk.ELTV44HU.js} +2 -2
- package/dist/preview/chunk.EVBCEEQ4.js +1 -0
- package/dist/preview/{chunk.HQNE4I4M.js → chunk.F7YXLYLX.js} +1 -1
- package/dist/preview/{chunk.MK72IRIY.js → chunk.FULEUL34.js} +1 -1
- package/dist/preview/{chunk.HOQMD6WQ.js → chunk.G4ULQK64.js} +14 -14
- package/dist/preview/{chunk.UXOBUK3C.js → chunk.GX4G4BX3.js} +1 -1
- package/dist/preview/chunk.H24OC6OE.js +1 -0
- package/dist/preview/chunk.H5S7OL2U.js +1 -0
- package/dist/preview/chunk.H73ZPYUX.js +1 -0
- package/dist/preview/{chunk.FJIXSGYU.js → chunk.H7N7WN4U.js} +1 -1
- package/dist/preview/chunk.HANJZ6FA.js +1 -0
- package/dist/preview/chunk.HIMQ65QT.js +1 -0
- package/dist/preview/chunk.I77ZGIFE.js +1 -0
- package/dist/preview/{chunk.ZC3FRCJQ.js → chunk.ILIIBSGA.js} +1 -1
- package/dist/preview/{chunk.66IKLMYX.js → chunk.IQ3PRWGO.js} +1 -1
- package/dist/preview/{chunk.DLDP6OWD.js → chunk.IQMD7DG3.js} +1 -1
- package/dist/preview/chunk.IQPILSV3.js +18 -0
- package/dist/preview/chunk.IYBEXENQ.js +1 -0
- package/dist/preview/{chunk.5S7IGASX.js → chunk.J7Q2WAF4.js} +1 -1
- package/dist/preview/{chunk.PJ5AO7CK.js → chunk.JT3MFPRD.js} +1 -1
- package/dist/preview/chunk.JYFZCJ4N.js +2 -0
- package/dist/preview/chunk.K2HDEL7I.js +1 -0
- package/dist/preview/chunk.KDXU5DT3.js +1 -0
- package/dist/preview/chunk.KL7E4YHJ.js +1 -0
- package/dist/preview/{chunk.SBLYBRDU.js → chunk.KMV6PJFL.js} +1 -1
- package/dist/preview/{chunk.DHJI7LIW.js → chunk.L3WTKQQL.js} +1 -1
- package/dist/preview/{chunk.REH6RXNH.js → chunk.LAYQ5PFS.js} +1 -1
- package/dist/preview/{chunk.UACSX64H.js → chunk.LGRLVJGS.js} +3 -3
- package/dist/preview/chunk.LTZUF5VG.js +1 -0
- package/dist/preview/{chunk.WD4VPMEE.js → chunk.M4AYA2PL.js} +1 -1
- package/dist/preview/chunk.M7RESZB6.js +25 -0
- package/dist/preview/{chunk.CUTLO6DA.js → chunk.MAKODQO3.js} +1 -1
- package/dist/preview/{chunk.SKQO467Y.js → chunk.MDEX6ZVE.js} +1 -1
- package/dist/preview/chunk.MGALQLRW.js +1 -0
- package/dist/preview/{chunk.PZXTSWDH.js → chunk.MYNMBOLD.js} +1 -1
- package/dist/preview/{chunk.YGIJDHAV.js → chunk.N6EJXXQK.js} +2 -2
- package/dist/preview/chunk.NAD7ZXYP.js +1 -0
- package/dist/preview/chunk.NHTGAP3G.js +3 -0
- package/dist/preview/{chunk.5IEFTFKQ.js → chunk.NJSK3UO2.js} +1 -1
- package/dist/preview/{chunk.ISRQQVS4.js → chunk.NOGGSLVG.js} +1 -1
- package/dist/preview/chunk.NUWDMH47.js +1 -0
- package/dist/preview/chunk.NUYA4BWI.js +1 -0
- package/dist/preview/{chunk.BDTT4ENI.js → chunk.O2BHPYA4.js} +2 -2
- package/dist/preview/chunk.O75HWF3F.js +1 -0
- package/dist/preview/chunk.OFWNMTGB.js +21 -0
- package/dist/preview/chunk.OKZT2QBM.js +2 -0
- package/dist/preview/{chunk.MBPOYZ3J.js → chunk.OUDATENL.js} +1 -1
- package/dist/preview/chunk.OUPURRDE.js +1 -0
- package/dist/preview/{chunk.GIW657OR.js → chunk.OWOOKLIU.js} +2 -1
- package/dist/preview/{chunk.7R727IKU.js → chunk.OWT3VVOT.js} +1 -1
- package/dist/preview/{chunk.VYFMUCBT.js → chunk.PCDUV3WP.js} +1 -1
- package/dist/preview/chunk.PD2DECOP.js +1 -0
- package/dist/preview/{chunk.2WZAFKJ2.js → chunk.PKWQKFPE.js} +1 -1
- package/dist/preview/{chunk.747OH3EE.js → chunk.PLTH2LW5.js} +1 -1
- package/dist/preview/{chunk.5POG3G2C.js → chunk.PZQNR4KZ.js} +1 -1
- package/dist/preview/chunk.Q5WEOX3Q.js +1 -0
- package/dist/preview/chunk.QDWSU47A.js +1 -0
- package/dist/preview/{chunk.U3JK2DNC.js → chunk.QGU5QTR6.js} +1 -1
- package/dist/preview/{chunk.6DOOLVT4.js → chunk.QHY5NVYH.js} +1 -1
- package/dist/preview/{chunk.BI6DS3PZ.js → chunk.QIPASE42.js} +1 -1
- package/dist/preview/{chunk.EVEHSENK.js → chunk.RD2X25XB.js} +1 -1
- package/dist/preview/{chunk.D4TA5XDC.js → chunk.RMR24LFJ.js} +3 -3
- package/dist/preview/chunk.ROZTJ6IY.js +6 -0
- package/dist/preview/{chunk.6SO64TUI.js → chunk.RPDH32XV.js} +1 -1
- package/dist/preview/chunk.RRKI24WY.js +1 -0
- package/dist/preview/{chunk.FWUG7Y6C.js → chunk.RYRQ66JN.js} +1 -1
- package/dist/preview/chunk.SEHRPTNA.js +7 -0
- package/dist/preview/{chunk.MBU7UH6J.js → chunk.SGCW2XRC.js} +1 -1
- package/dist/preview/{chunk.4G32374Q.js → chunk.SS7234R6.js} +1 -1
- package/dist/preview/{chunk.WICFQROI.js → chunk.SVPKUWZU.js} +1 -1
- package/dist/preview/{chunk.2LNSENPV.js → chunk.SWMDFXUX.js} +1 -1
- package/dist/preview/{chunk.XFSGB6EU.js → chunk.T3UQ7ZQK.js} +1 -1
- package/dist/preview/chunk.T6PU3NKP.js +1 -0
- package/dist/preview/{chunk.ZVG3DR5G.js → chunk.T6WHGKWR.js} +1 -1
- package/dist/preview/{chunk.JEQO24GS.js → chunk.THVC2BEC.js} +1 -1
- package/dist/preview/{chunk.SJALH7IX.js → chunk.TIALD6SC.js} +1 -1
- package/dist/preview/{chunk.ULHB3RYK.js → chunk.TM4EPUNO.js} +1 -1
- package/dist/preview/chunk.U6ZRJKVM.js +1 -0
- package/dist/preview/chunk.UFDJXQQQ.js +32 -0
- package/dist/preview/{chunk.Y7H5O2SL.js → chunk.UKQUUPKE.js} +1 -1
- package/dist/preview/{chunk.IA5ZBMRD.js → chunk.UQQKDBIH.js} +1 -1
- package/dist/preview/{chunk.NUEPFPRA.js → chunk.UVA7AALY.js} +1 -1
- package/dist/preview/chunk.UXMPFPFH.js +20 -0
- package/dist/preview/chunk.VACKSKGJ.js +1 -0
- package/dist/preview/{chunk.ZQHCNFJK.js → chunk.VC3V7HLL.js} +1 -1
- package/dist/preview/{chunk.N5WDQAIM.js → chunk.VIH5AX7S.js} +2 -2
- package/dist/preview/{chunk.ZKAZA6UJ.js → chunk.VJBBVLGZ.js} +1 -1
- package/dist/preview/chunk.VN23AGIY.js +1 -0
- package/dist/preview/{chunk.2XSIJH5J.js → chunk.W4BKYSZX.js} +1 -1
- package/dist/preview/{chunk.XZWXDQ3N.js → chunk.WEOVK2T4.js} +1 -1
- package/dist/preview/chunk.WKI5INH7.js +1 -0
- package/dist/preview/chunk.WPXPVD33.js +88 -0
- package/dist/preview/chunk.X6KYRBL6.js +1 -0
- package/dist/preview/{chunk.LA2DMHZC.js → chunk.Y2YYH3JN.js} +1 -1
- package/dist/preview/{chunk.MU3XII7I.js → chunk.Y4FZKUOK.js} +1 -1
- package/dist/preview/chunk.Y4S7CDRB.js +1 -0
- package/dist/preview/{chunk.C634A6ZC.js → chunk.YP2QSPXU.js} +1 -1
- package/dist/preview/{chunk.JHAFQNGC.js → chunk.Z2TDZSMN.js} +1 -1
- package/dist/preview/{chunk.2QFKNTAZ.js → chunk.ZN3PUM2I.js} +1 -1
- package/dist/preview/index.html +53 -51
- package/dist/preview/page.js +2 -2
- package/dist/preview/splash.js +57 -0
- package/package.json +6 -6
- package/dist/preview/chunk.2AWVQ5SW.js +0 -1
- package/dist/preview/chunk.3ICWPRRJ.js +0 -1
- package/dist/preview/chunk.3RW677X6.js +0 -1
- package/dist/preview/chunk.4OEWFPH3.js +0 -1
- package/dist/preview/chunk.4STDIZVI.js +0 -2
- package/dist/preview/chunk.5T53SF2K.js +0 -1
- package/dist/preview/chunk.5X22RKB3.js +0 -1
- package/dist/preview/chunk.644FUGSX.js +0 -1
- package/dist/preview/chunk.7CETF4A6.js +0 -1
- package/dist/preview/chunk.BFDJTWGX.js +0 -88
- package/dist/preview/chunk.BJI2C3IZ.js +0 -1
- package/dist/preview/chunk.DKXVEVDG.js +0 -1
- package/dist/preview/chunk.DXWTM4SH.js +0 -1
- package/dist/preview/chunk.F7IQ4B6A.js +0 -1
- package/dist/preview/chunk.F7PIW2EM.js +0 -5
- package/dist/preview/chunk.G4VMRYS4.js +0 -1
- package/dist/preview/chunk.GPWYWALF.js +0 -1
- package/dist/preview/chunk.HGVBGSRS.js +0 -6
- package/dist/preview/chunk.ISXNAFRC.js +0 -20
- package/dist/preview/chunk.JU3BCCQM.js +0 -1
- package/dist/preview/chunk.K2AC536Q.js +0 -21
- package/dist/preview/chunk.K3UOXAZS.js +0 -1
- package/dist/preview/chunk.KNYLY7MH.js +0 -1
- package/dist/preview/chunk.LQAT7FA6.js +0 -3
- package/dist/preview/chunk.LTI5PKTS.js +0 -1
- package/dist/preview/chunk.MBP7VDYM.js +0 -1
- package/dist/preview/chunk.MH6CCHEX.js +0 -1
- package/dist/preview/chunk.MNRTA2CB.js +0 -1
- package/dist/preview/chunk.MYVED5LU.js +0 -1
- package/dist/preview/chunk.N7T7VB77.js +0 -25
- package/dist/preview/chunk.ODVRO2BJ.js +0 -1
- package/dist/preview/chunk.OVPFROL3.js +0 -1
- package/dist/preview/chunk.PGA5TUSN.js +0 -1
- package/dist/preview/chunk.PHC2MI4C.js +0 -1
- package/dist/preview/chunk.PXQVXBNG.js +0 -1
- package/dist/preview/chunk.Q5I5M3FR.js +0 -1
- package/dist/preview/chunk.QATUGE34.js +0 -1
- package/dist/preview/chunk.QL77K3D4.js +0 -1
- package/dist/preview/chunk.QUJS63OJ.js +0 -13
- package/dist/preview/chunk.RZ5PPQBV.js +0 -1
- package/dist/preview/chunk.SCGF4ZPP.js +0 -1
- package/dist/preview/chunk.SLAZFFCQ.js +0 -1
- package/dist/preview/chunk.SLPJWOKC.js +0 -1
- package/dist/preview/chunk.TKLYUVMR.js +0 -32
- package/dist/preview/chunk.TMAZNDA6.js +0 -1
- package/dist/preview/chunk.UDCDK7XJ.js +0 -4
- package/dist/preview/chunk.UO544PZH.js +0 -1
- package/dist/preview/chunk.VKHAAH32.js +0 -1
- package/dist/preview/chunk.VOOOIECX.js +0 -1
- package/dist/preview/chunk.VS6NT5C4.js +0 -1
- package/dist/preview/chunk.VUAOCYG2.js +0 -1
- package/dist/preview/chunk.VX65S2FA.js +0 -1
- package/dist/preview/chunk.X2I3XH2E.js +0 -2
- package/dist/preview/chunk.XWWSW3ZV.js +0 -7
- package/dist/preview/chunk.YOT7ESDG.js +0 -18
- package/dist/preview/chunk.ZYNUMVEC.js +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{a as k}from"./chunk.G4JJXA63.js";import{a as Q}from"./chunk.H5S7OL2U.js";import{a as Z}from"./chunk.T6WHGKWR.js";import{a as Y}from"./chunk.ZN3PUM2I.js";import{c as V}from"./chunk.OWT3VVOT.js";import{Sd as P,Ud as H,Vd as T,Wd as U,vb as z,wb as B}from"./chunk.DZZL5IDD.js";var N=n=>"failed"in n;function fn(n,e){let s=n.schema.kinds,t=n.policy?.sees;if(!t?.length||B(e))return{kinds:s};let o=z(e).roles??[],r=new Set(t.filter(i=>i.roles==="*"||o.some(a=>i.roles.includes(a))).flatMap(i=>i.kinds));return{kinds:s.filter(i=>r.has(i))}}function O(n,e){if(!e)return n;let s=new Set(e.kinds.filter(r=>n.tryDefinition(r)!==void 0));if(s.size===n.kinds.length)return n;let t=new Map,o=r=>{if(s.has(r)){if(!t.has(r)){let i=n.tryDefinition(r),a=Object.fromEntries(Object.entries(i?.edges??{}).flatMap(([l,d])=>{if(d.to==="*")return[[l,d]];let c=d.to.filter(u=>s.has(u));return c.length>0?[[l,{...d,to:c}]]:[]}));t.set(r,{...i,edges:a})}return t.get(r)}};return{...n,definitions:n.definitions.filter(r=>s.has(r.kind)),kinds:n.kinds.filter(r=>s.has(r)),tryDefinition:o,definition:r=>{let i=o(r);if(!i)throw new Error(`Unknown node kind "${r}"`);return i}}}var gn=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),m=n=>gn(n).replace(/[-_]+/g," ").trim();function j(n){let e=[];for(let t of n.kinds){let o=n.tryDefinition(t);if(!o)continue;let r=o.display?.labels??{},i=Object.entries(o.fields?.shape??{}).filter(([d])=>d!=="id"&&d!=="kind").map(([d,c])=>{let u=Y(c);return{name:d,type:u?.type==="enum"&&u.multiple?"list":u?.type,...u?.options?{options:u.options}:{},words:(r[d]??m(d)).toLowerCase()}}),a=Object.entries(o.edges??{}).map(([d,c])=>({name:d,from:t,to:c.to==="*"?n.kinds.filter(u=>u!==t):c.to,words:m(d)})),l=(o.plural??`${m(t)}s`).toLowerCase();e.push({kind:t,plural:l,noun:(o.noun??m(t)).toLowerCase(),fields:i,roles:o.fieldRoles??{},edges:a})}let s=new Map(e.map(t=>[t.kind,t]));return{schema:n,kinds:e,info:t=>s.get(t)}}var $=(n,e)=>e===void 0?void 0:n.fields.find(s=>s.name===e),R=n=>n?.type==="date"||n?.type==="datetime",K=n=>n?.type==="number"||n?.type==="integer"||n?.type==="duration",sn=n=>` ${n.toLowerCase().replace(/[“”"’‘]/g,"'").replace(/[^\p{L}\p{N}' -]+/gu," ").replace(/\s+/g," ").trim()} `,A=(n,e)=>n.includes(` ${e} `),L=n=>n.endsWith("ies")?`${n.slice(0,-3)}y`:n.endsWith("ses")?n.slice(0,-2):n.endsWith("s")?n.slice(0,-1):n;function yn(n,e){let s=[];for(let t of e.kinds){let o=new Set([t.plural,t.noun,`${t.noun}s`,m(t.kind),`${m(t.kind)}s`]),r=-1;for(let i of o){let a=n.indexOf(` ${i} `);a>=0&&(r<0||a<r)&&(r=a)}r>=0&&s.push({info:t,at:r})}return s.sort((t,o)=>t.at-o.at).map(t=>t.info)}function I(n,e,s){let t=e.trim().toLowerCase();if(t.length===0)return;let o=n.fields.filter(r=>!s||s(r));return o.find(r=>r.words===t||m(r.name)===t||r.name.toLowerCase()===t)??o.find(r=>r.words===L(t)||m(r.name)===L(t))??o.find(r=>t.split(" ").some(i=>i.length>2&&(r.words.split(" ").includes(i)||r.words.split(" ").includes(L(i)))))}function rn(n,e,s){let t=e.trim().toLowerCase();if(t.length!==0)return n.edges.find(o=>o.words===t||o.name.toLowerCase()===t)??n.edges.find(o=>o.to.some(r=>{let i=s.info(r);return i!==void 0&&(i.noun===L(t)||i.plural===t||m(r)===L(t))}))??n.edges.find(o=>t.split(" ").some(r=>r.length>2&&o.words.split(" ").includes(r)))}function W(n){return/ (?:grouped |group |split |sorted |organi[sz]ed )?by ([\p{L}\p{N}' -]+?)(?= (?:and|with|for|in|on|only|where|from|this|that|as|sorted|grouped) |\s*$)/u.exec(n)?.[1]?.trim()}var bn=/\bwho\b.*\b(covers?|cover|tends?|owns?|handles?|does|works? on|looks? after|is on|is assigned|staffs?|runs?)\b|\bcoverage\b|\bmatrix\b|\bwho covers\b/,mn=/\bcalendar\b|\bmonth\b|\bagenda\b|\bschedule\b|\bdue\b|\bdeadlines?\b|\bdates?\b|\bwhen\b/,hn=/\btimeline\b|\bover time\b|\bgantt\b|\bspans?\b|\bweek\b/,pn=/\bboard\b|\bkanban\b|\bcolumns?\b|\bpipeline\b|\bstages?\b|\bstatus\b/,wn=/\blaid out\b|\blayout\b|\bseating\b|\bwhere (?:they|it|each) (?:sits?|lies?|stands?)\b|\bfloor\b/,kn=/\bplan\b|\bmap\b|\bregions?\b/,$n=/\blist\b|\btable\b|\bgroup(?:ed)? by\b|\bsort(?:ed)? by\b|\bonly\b|\bjust the\b/;function Sn(n){let e=[];return/\blist\b|\btable\b/.test(n)&&e.push("blocks"),bn.test(n)&&e.push("coverage"),wn.test(n)&&e.push("board"),(/\bfloor plan\b/.test(n)||kn.test(n))&&e.push("plan"),hn.test(n)&&e.push("timeline"),mn.test(n)&&e.push("calendar"),pn.test(n)&&e.push("columns"),$n.test(n)&&!e.includes("blocks")&&e.push("blocks"),e.length===0&&W(n)&&e.push("columns"),e}var on=n=>{let e=s=>s?` and not ${s}`:"";if(/\boverdue\b|\blate\b|\bpast due\b/.test(n))return{cond:(s,t)=>`days(today(), ${s}) < 0${e(t)}`,says:s=>`overdue by ${s.words}`};if(/\btoday\b/.test(n))return{range:"day",cond:s=>`days(today(), ${s}) == 0`,says:s=>`with ${s.words} today`};if(/\bthis week\b|\bnext 7 days\b|\bnext week\b/.test(n))return{range:"week",cond:s=>`days(today(), ${s}) >= 0 and days(today(), ${s}) <= 6`,says:s=>`with ${s.words} in the next week`};if(/\bthis month\b|\bnext 30 days\b|\bnext month\b/.test(n))return{range:"month",cond:s=>`days(today(), ${s}) >= 0 and days(today(), ${s}) <= 30`,says:s=>`with ${s.words} in the next month`};if(/\blast month\b|\bpast month\b/.test(n))return{range:"month",cond:s=>`days(today(), ${s}) >= -30 and days(today(), ${s}) <= 0`,says:s=>`with ${s.words} in the last month`};if(/\bthis year\b/.test(n))return{range:"year",cond:s=>`days(today(), ${s}) >= 0 and days(today(), ${s}) <= 365`,says:s=>`with ${s.words} in the next year`};if(/\bquarter\b/.test(n))return{range:"quarter",cond:s=>`days(today(), ${s}) >= 0 and days(today(), ${s}) <= 91`,says:s=>`with ${s.words} in the next quarter`}},_=n=>{if(/\bagenda\b|\bin order\b/.test(n))return"agenda";if(/\btoday\b|\bday\b/.test(n))return"day";if(/\bweek\b/.test(n))return"week";if(/\bquarter\b/.test(n))return"quarter";if(/\byears\b/.test(n))return"years";if(/\byear\b/.test(n))return"year";if(/\bmonth\b/.test(n))return"month"},X=/^(user|person|people|member|staff|gardener|volunteer|owner|agent|employee|worker|team|player|customer|client|contact|party|attendee|guest)s?$/,x=class extends Error{},h=n=>{throw new x(n)};function Dn(n,e){let s=n.fields.filter(r=>r.type==="enum");if(e){let r=I(n,e);if(r&&r.type==="enum")return r;r&&h(`${n.plural}' ${r.words} is not a choice, so it has no columns`)}let t=$(n,n.roles.status??n.roles.column);if(t?.type==="enum")return t;let o=s.find(r=>/^(status|stage|state|phase)$/.test(r.name));return o||(s[0]?s[0]:h(`${n.plural} have no choice field to put in columns`))}function nn(n,e){let s=n.fields.filter(R),t=l=>{let d=$(n,n.roles[l]);return R(d)?d:void 0},r=s.find(l=>A(e,l.words)||A(e,m(l.name)))??t("start")??s.find(l=>/^(due|date|on|at|start|starts|begins|from|sown|when)/i.test(l.name))??s[0];if(!r)return h(`no date field on ${n.plural}`);let i=t("end")??s.find(l=>l!==r&&/^(end|ends|until|to|finish|finished|harvested|due|closes|through)/i.test(l.name)),a=n.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));return{start:r,...i&&i!==r?{end:i}:{},...a?{done:a}:{}}}function an(n){let e=$(n,n.roles.start),s=$(n,n.roles.end),t=$(n,n.roles.column??n.roles.day??n.roles.columns);if(K(e)&&K(s)&&t?.type==="enum")return{start:e,end:s,column:t}}function vn(n,e,s,t){let o=[];for(let i of n.kinds)for(let a of i.edges)for(let l of a.to){let d=n.info(l);if(!d||d.kind===i.kind)continue;let c=0;e.includes(i)&&(c+=4),e.includes(d)&&(c+=4),(X.test(d.kind)||X.test(d.noun))&&(c+=3),t&&(a.words.includes(t)||d.noun===L(t))&&(c+=5),a.words.split(" ").some(u=>u.length>2&&s.includes(` ${u}`))&&(c+=2),o.push({rows:i,across:d,link:a,score:c})}let r=o.sort((i,a)=>a.score-i.score)[0];return r||h(e[0]?`${e[0].plural} are joined to nothing else, so there is no who-covers-what to draw`:"nothing here is joined to anything else, so there is no who-covers-what to draw")}function dn(n,e,s,t,o){let r=W(t);switch(n){case"columns":{if(r){let i=I(e,r);if(!i||i.type!=="enum"){let a=rn(e,r,s);if(a){let l=s.info(a.to[0]);return{lens:"coverage",kind:e.kind,across:l.kind,link:a.name}}}}return{lens:"columns",kind:e.kind,column:Dn(e,r).name}}case"calendar":{let i=nn(e,t),a=_(t);return{lens:"calendar",kind:e.kind,start:i.start.name,...i.end?{end:i.end.name}:{},...i.done?{done:i.done.name}:{},...a?{range:a}:{}}}case"timeline":{let i=an(e);if(i&&!/\bdates?\b|\bdue\b|\bdeadlines?\b|\bmonths?\b|\byears?\b/.test(t))return{lens:"timeline",kind:e.kind,start:i.start.name,end:i.end.name,column:i.column.name};let a=nn(e,t);return{lens:"calendar",kind:e.kind,start:a.start.name,...a.end?{end:a.end.name}:{},...a.done?{done:a.done.name}:{},range:_(t)??"quarter"}}case"coverage":{let i=vn(s,o,t,r);return{lens:"coverage",kind:i.rows.kind,across:i.across.kind,link:i.link.name}}case"board":{let i=$(e,e.roles.x)??e.fields.find(c=>c.name==="x"),a=$(e,e.roles.y)??e.fields.find(c=>c.name==="y");if(!K(i)||!K(a))return h(`${e.plural} have no x and y to be laid out by`);let d=s.kinds.flatMap(c=>c.edges.filter(u=>u.to.includes(e.kind)&&c.kind!==e.kind))[0]??e.edges[0];return d?{lens:"board",kind:e.kind,x:i.name,y:a.name,fill:d.name,...d.from!==e.kind?{fillFrom:"occupant"}:{}}:h(`nothing is joined to ${e.plural} to fill them`)}case"plan":{let i=$(e,e.roles.outline)??e.fields.find(a=>a.name==="outline");return i?{lens:"plan",kind:e.kind,outline:i.name}:h(`${e.plural} have no outline to draw a plan from`)}case"blocks":{let i={lens:"blocks",kind:e.kind,as:/\bcards?\b/.test(t)?"card":"row"},a=/ group(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|sorted|with)|\s*$)/u.exec(t)?.[1]??(r&&!/ sort(?:ed)? by /.test(t)?r:void 0);if(a){let c=I(e,a);if(!c||c.type!=="enum")return h(c?`${e.plural}' ${c.words} is not a choice, so they cannot be grouped by it`:`${e.plural} have nothing called ${a} to group by`);i.group=c.name}let l=/ sort(?:ed)? by ([\p{L}\p{N} -]+?)(?= (?:and|only|grouped|with)|\s*$)/u.exec(t)?.[1];if(l){let c=I(e,l);if(!c)return h(`${e.plural} have nothing called ${l} to sort by`);i.sort={by:c.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}let d=q(e,t);return d.length>0&&(i.where=d),i}}}function q(n,e){let s=[],t=on(e);if(t){let o=n.fields.filter(R),r=$(n,n.roles.start),i=o.find(l=>A(e,l.words))??(R(r)?r:void 0)??o[0];(!i||!R(i))&&h(`no date field on ${n.plural}`);let a=n.fields.find(l=>l.type==="boolean"&&/^(done|finished|complete|completed|closed)$/.test(l.name));s.push({expr:t.cond(i.name,/\boverdue\b|\blate\b|\bpast due\b/.test(e)?a?.name:void 0),says:t.says(i)})}if(/\bonly\b|\bjust\b|\bthat are\b|\bwhich are\b/.test(e)){for(let o of n.fields){if(o.type!=="enum")continue;let r=o.options?.find(i=>A(e,i.toLowerCase())||A(e,m(i)));r&&s.push({expr:`${o.name} == '${r.replace(/'/g,"")}'`,says:`that are ${m(r)}`})}if(/\bnot done\b|\bundone\b|\bunfinished\b|\bopen ones\b|\bstill to do\b/.test(e)){let o=n.fields.find(r=>r.type==="boolean"&&/^(done|finished|complete|completed)$/.test(r.name));o&&s.push({expr:`not ${o.name}`,says:`not ${o.words}`})}}return s}var J={columns:"A board",calendar:"A calendar",timeline:"A timeline",coverage:"A grid",board:"A layout",plan:"A plan",blocks:"A list",reach:"A picture"};function Rn(n,e){let s=e.info(n.kind),t=o=>o?$(s,o)?.words??m(o):"";switch(n.lens){case"columns":return{title:`${k(s.plural)} by ${t(n.column)}`,detail:`of ${s.plural} by ${t(n.column)}`};case"calendar":{let o=n.range??"month";if(o==="agenda")return{title:`${k(s.plural)} in date order`,detail:`of ${s.plural} in order of ${t(n.start)}`};let r=o==="years"?"year":o;return{title:`${k(s.plural)} by ${r}`,detail:`of ${s.plural} by ${t(n.start)}, a ${r} at a time`}}case"timeline":return{title:`${k(s.plural)} over the ${t(n.column)}`,detail:`of ${s.plural} from ${t(n.start)} to ${t(n.end)}, by ${t(n.column)}`};case"coverage":{let o=e.info(n.across);return{title:`${k(s.plural)} by ${o.noun}`,detail:`of which ${o.noun} covers which ${s.noun}`}}case"board":return{title:`${k(s.plural)} where they stand`,detail:`of ${s.plural} where they stand`};case"plan":return{title:`${k(s.plural)} on a plan`,detail:`of ${s.plural}`};default:{let o=[n.where?.map(r=>r.says).join(" and "),n.group?`by ${t(n.group)}`:void 0,n.sort?`in order of ${t(n.sort.by)}`:void 0].filter(r=>!!r);return{title:[k(s.plural),...o].join(" "),detail:[`of ${s.plural}`,...o].join(" ")}}}}function An(n,e){let s={title:e,on:n.kind};switch(n.lens){case"columns":return{name:"columns",...s,bindings:{[n.kind]:{column:n.column}}};case"calendar":return{name:"calendar",...s,bindings:{[n.kind]:{start:n.start,...n.end?{end:n.end}:{},...n.done?{done:n.done}:{}}},...n.range?{options:{range:n.range}}:{}};case"timeline":return{name:"timeline",...s,bindings:{[n.kind]:{start:n.start,end:n.end,column:n.column}}};case"coverage":return{name:"coverage",...s,bindings:{rows:{kind:n.kind},columns:{kind:n.across},link:{edge:n.link}}};case"board":return{name:"board",...s,bindings:{slots:{kind:n.kind},x:{field:n.x,on:"slots"},y:{field:n.y,on:"slots"},fill:{edge:n.fill}},...n.fillFrom?{options:{fillFrom:n.fillFrom}}:{}};case"plan":return{name:"plan",...s,bindings:{regions:{kind:n.kind},outline:{field:n.outline,on:"regions"}}};default:{let t=n.where?.length?` where ${n.where.map(r=>n.where.length>1?`(${r.expr})`:r.expr).join(" and ")}`:"",o={list:`all('${n.kind}')${t}`,as:n.as??"row"};return n.group&&(o.group=n.group),n.sort&&(o.sort=n.sort.direction?{by:n.sort.by,direction:n.sort.direction}:n.sort.by),o.empty="Nothing here yet.",{name:"blocks",...s,options:{blocks:[o]}}}}}function F(n,e){let{app:s}=e,t=r=>r.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,"-").replace(/^-+|-+$/g,""),o=new Set(["home","overview",...Q(s,e.views?{views:e.views}:{}).map(r=>r.slug),...(s.lenses??[]).flatMap(r=>r.title?[t(r.title)]:[])]);if(!o.has(t(n)))return n;for(let r=2;;r++)if(!o.has(t(`${n} ${r}`)))return`${n} ${r}`}var en={title:[],headline:[],text:["tone"],figure:["as","currency","label"],list:["sort","limit","group","empty","as"],progress:["label"],group:["direction"],when:["show"],divider:[]};function Ln(n,e){if(!Array.isArray(e)||e.length===0)return"it has no blocks to draw";if(e.length>40)return"it has more blocks than a place draws";let s=(i,a)=>{if(typeof i!="string"||i.trim()==="")return`its ${a} says nothing`;try{return V(i)}catch(l){return`its ${a} does not read: ${l instanceof Error?l.message.replace(/ \(at character.*$/,""):String(l)}`}},t=i=>{if(i.t==="where")return t(i.set);if(i.t==="call"&&i.fn==="all"){let a=i.args[0];return a?.t==="lit"&&typeof a.value=="string"?n.info(a.value)??null:void 0}},o=(i,a)=>{switch(i.t){case"lit":return;case"ident":return a&&!a.fields.some(l=>l.name===i.name)&&!a.edges.some(l=>l.name===i.name)?`${a.plural} have nothing called ${i.name}`:void 0;case"member":return o(i.object,a);case"list":return i.items.map(l=>o(l,a)).find(Boolean);case"unary":return o(i.operand,a);case"binary":return o(i.left,a)??o(i.right,a);case"where":{let l=t(i.set);return l===null?"Nothing by that name here":o(i.set,a)??o(i.filter,l??void 0)}case"call":return i.fn==="all"?t(i)===null?"Nothing by that name here":void 0:i.args.map(l=>o(l,a)).find(Boolean)}},r=(i,a)=>{if(a>4)return"its blocks nest deeper than a place draws";for(let l of i){if(!w(l))return"a block is not an object";let d=Object.keys(en).find(g=>g in l);if(!d)return`"${Object.keys(l)[0]??""}" is not a block a place draws`;let c=Object.keys(l).find(g=>g!==d&&g!=="key"&&!en[d].includes(g));if(c)return`a ${d} block takes no "${c}"`;let u=l[d];if(d==="list"||d==="figure"||d==="when"){if(d==="figure"&&u===!0)continue;let g=s(u,d);if(typeof g=="string")return g;let b=o(g,void 0);if(b)return b;if(d==="list"){let f=t(g);if(f==null)return f===null?"Nothing by that name here":"its list does not say which records it lists, like all('task')";for(let y of["group","sort"]){let p=l[y],S=typeof p=="string"?p:w(p)&&typeof p.by=="string"?p.by:void 0;if(p===void 0)continue;let D=S?f.fields.find(un=>un.name===S):void 0;if(!D)return`${f.plural} have nothing called ${String(S??p)} to ${y} by`;if(y==="group"&&D.type!=="enum")return`${f.plural}' ${D.words} is not a choice, so they cannot be grouped by it`}}if(d==="when"){let f=l.show;if(!Array.isArray(f))return"a when block shows a list of blocks";let y=r(f,a+1);if(y)return y}}else if(d==="group"){if(!Array.isArray(u))return"a group block holds a list of blocks";let g=r(u,a+1);if(g)return g}else{if(d!=="divider"&&typeof u!="string")return`a ${d} block says words`;if(typeof u=="string")for(let g of u.matchAll(/\{([^{}]*)\}/g)){let b=g[1].split(/\|(?![|])/)[0],f=s(b,`${d}'s braces`);if(typeof f=="string")return f;let y=o(f,void 0);if(y)return y}}}};return r(e,1)}function E(n,e,s){let t=O(n.schema,s),o=f=>({ok:!1,failed:`Couldn't draw that: ${f.replace(/\.$/,"")}.`});if(!T(e.name)||e.name==="reach")return o(`"${String(e.name)}" is not a picture the seat can draw; it draws ${H.filter(f=>f!=="reach").join(", ")}`);if(typeof e.title!="string"||e.title.trim().length===0||e.title.length>80)return o("it needs a title of a few words");if(typeof e.on!="string"||!t.tryDefinition(e.on))return o("Nothing by that name here");let r=P[e.name],i=e.bindings??{};if(r.binds==="fields")for(let[f,y]of Object.entries(i)){if(!t.tryDefinition(f))return o("Nothing by that name here");let p=Object.keys(t.tryDefinition(f).fields?.shape??{});for(let[S,D]of Object.entries(y??{}))if(typeof D!="string"||!p.includes(D))return o(`${m(f)} has no field "${String(D)}" for its ${S}`);for(let S of r.requiredRoles)if(!(S in(y??{})))return o(`a ${e.name} needs ${m(f)}'s ${S}`)}else if(r.binds==="entities")for(let f of r.requiredRoles){let y=i[f];if(!y)return o(`a ${e.name} needs its ${f}`);if(typeof y.kind=="string"&&!t.tryDefinition(y.kind))return o("Nothing by that name here")}let a={...n,schema:t,lenses:[...n.lenses??[],e]},l=a.lenses.length-1,d=U(a),c=`lenses.${l}`,u=d.findings.find(f=>f.path===c||f.path.startsWith(`${c}.`));if(u)return o(u.message.replace(/^"[^"]*" /,"it "));let g=d.undrawn.find(f=>f.index===l);if(g)return o(g.why);let b=d.drawn.find(f=>f.index===l);if(!b)return o("its bindings name something the app does not have");if(b.as==="overview")return o(`"${e.title}" is the scene's own address; give it another title`);if(e.name==="blocks"){let f=Ln(j(t),e.options?.blocks);if(f)return o(f)}return{ok:!0,drawn:b}}function G(n){return{op:"add-lens",title:n.title,lens:n.name,on:n.on,...n.bindings?{bindings:n.bindings}:{},...n.options?{options:n.options}:{}}}function In(n){return{op:"remove-lens",title:n.title,on:n.on}}var w=n=>typeof n=="object"&&n!==null&&!Array.isArray(n);function ln(n){let e=w(n)?n:{},s=String(e.lens??e.name??""),t=e.bindings,o=typeof e.on=="string"?e.on:w(t)&&P[s]?.binds==="fields"?Object.keys(t)[0]??"":"";return{name:s,title:typeof e.title=="string"?e.title.trim():"",on:o,...w(t)?{bindings:t}:{},...w(e.options)?{options:e.options}:{}}}function On(n){let e=o=>w(n.bindings?.[o])?n.bindings[o]:{},s=o=>typeof o=="string"?o:void 0,t=e(n.on);switch(n.name){case"columns":return s(t.column)?{lens:"columns",kind:n.on,column:t.column}:void 0;case"calendar":{let o=s(n.options?.range);return s(t.start)?{lens:"calendar",kind:n.on,start:t.start,...s(t.end)?{end:t.end}:{},...s(t.done)?{done:t.done}:{},...o?{range:o}:{}}:void 0}case"timeline":return s(t.start)&&s(t.end)&&s(t.column)?{lens:"timeline",kind:n.on,start:t.start,end:t.end,column:t.column}:void 0;case"coverage":{let o=w(n.bindings?.columns)?s(n.bindings.columns.kind):void 0,r=w(n.bindings?.link)?s(n.bindings.link.edge):void 0;return o&&r?{lens:"coverage",kind:n.on,across:o,link:r}:void 0}case"blocks":{let o=n.options?.blocks;if(!Array.isArray(o)||o.length!==1||!w(o[0]))return;let r=o[0],i=new RegExp(`^all\\('${n.on}'\\)(?: where (.+))?$`).exec(String(r.list??""));if(!i)return;let a=r.sort;return{lens:"blocks",kind:n.on,as:r.as==="card"?"card":"row",...typeof r.group=="string"?{group:r.group}:{},...typeof a=="string"?{sort:{by:a}}:w(a)&&typeof a.by=="string"?{sort:{by:a.by,...a.direction==="desc"?{direction:"desc"}:{}}}:{},...i[1]?{where:[{expr:i[1],says:"as asked"}]}:{}}}default:return}}function M(n,e,s,t,o){let r=j(O(n.schema,t)).info(e.on),i=On(e);return{title:e.title,said:`${J[e.name]??"A picture"} of ${r?.plural??m(e.on)}.`,kind:e.on,lens:e,drawn:s,edit:G(e),by:o,asks:[],...i?{recipe:i}:{}}}function tn(n){return{title:n.title,said:n.said,lens:{title:n.lens.title,lens:n.lens.name,on:n.lens.on,...n.lens.bindings?{bindings:n.lens.bindings}:{},...n.lens.options?{options:n.lens.options}:{}},edit:n.edit,by:n.by,check:"It draws, and graview check would take it."}}function C(n,e,s,t,o){let r=Rn(n,e),i=n.title??o??F(r.title,s),a=An(n,i),l=E(s.app,a,s.sight);return l.ok?{title:i,said:`${J[n.lens]} ${r.detail}.`,kind:n.kind,lens:a,drawn:l.drawn,edit:G(a),by:"template",asks:t,recipe:n}:{failed:l.failed,...s.lastGood?{lastGood:s.lastGood}:{}}}function Jn(n,e){let s=j(O(e.app.schema,e.sight)),t=s.info(n.kind);if(!t)return{failed:"Couldn't draw that: Nothing by that name here."};let o=n.lens==="blocks"&&!n.group&&!n.sort&&!n.where?.length&&n.title===void 0;return C(o?{...n,title:F(`Every ${t.noun}`,e)}:n,s,e,[])}function jn(n,e,s,t){if(s.length>0)return s;let o=i=>{switch(n){case"columns":return i.fields.some(a=>a.type==="enum");case"calendar":return i.fields.some(R);case"timeline":return an(i)!==void 0||i.fields.some(R);case"coverage":return i.edges.some(a=>a.to.some(l=>l!==i.kind));case"board":return i.fields.some(a=>a.name==="x")&&i.fields.some(a=>a.name==="y");case"plan":return i.fields.some(a=>a.name==="outline")||i.roles.outline!==void 0;default:return!0}};return[...e.kinds.filter(o)].sort((i,a)=>Number(a.fields.some(l=>A(t,l.words)))-Number(i.fields.some(l=>A(t,l.words))))}function Nn(n,e){let s=j(O(e.app.schema,e.sight)),t=sn(n),o=Sn(t);if(o.length===0)return;let r=yn(t,s),i;for(let a of o){let l=a==="coverage"?[r[0]??s.kinds[0]].filter(d=>!!d):jn(a,s,r,t);for(let d of l)try{let c=dn(a,d,s,t,r),u=C(c,s,e,[n]);if(!N(u))return u;i??=u.failed}catch(c){if(!(c instanceof x))throw c;i??=`Couldn't draw that: ${c.message}.`}l.length===0&&r.length===0&&(i??=`Couldn't draw that: nothing here has what ${J[a].toLowerCase()} needs.`)}return{failed:i??"Couldn't draw that: Nothing by that name here.",...e.lastGood?{lastGood:e.lastGood}:{}}}async function xn(n,e){let s=e.lastGood?{lastGood:e.lastGood}:{};if(n.trim().length===0)return{failed:"Say what you would like to see, like \u201Ca board of tasks by status\u201D.",...s};let t=Nn(n,e);if(t&&!N(t))return t;if(!e.complete)return t??{failed:"Couldn't draw that: drawing freely needs AI, which isn't on here. Ask for a board, a calendar, a timeline, a list or who covers what.",...s};let o=await cn(n,e,void 0);return N(o)&&t?t:o}async function En(n,e,s){let t={lastGood:n},o={...s,lastGood:n},r=j(O(s.app.schema,s.sight)),i=sn(e),a=r.info(n.kind),l=[...n.asks,e];if(!a)return{failed:"Couldn't change that: Nothing by that name here.",...t};let d=n.recipe,c=/^ (?:call|name|title) (?:it|this)? ?(.+?) $/.exec(i)??/ (?:call|name) it (.+?) $/.exec(i);try{if(c){let b=e.replace(/^.*?\b(?:call|name|title)\b\s*(?:it|this)?\s*/i,"").replace(/^["“']|["”']$/g,"").trim();if(b.length===0)return{failed:"Couldn't change that: say what to call it.",...t};let f={...n.lens,title:F(b,s)},y=E(s.app,f,s.sight);return y.ok?{...n,title:f.title,lens:f,drawn:y.drawn,edit:G(f),asks:l,...d?{recipe:{...d,title:f.title}}:{}}:{failed:y.failed,...t}}let g=/ as (?:a |an )?(board|kanban|calendar|timeline|list|table|cards|rows|grid|plan|layout)\b/.exec(i);if(g){let b=g[1]==="board"||g[1]==="kanban"?"columns":g[1]==="calendar"?"calendar":g[1]==="timeline"?"timeline":g[1]==="grid"?"coverage":g[1]==="plan"?"plan":g[1]==="layout"?"board":"blocks",f=dn(b,a,r,i,[a]),y=g[1]==="cards"?"card":g[1]==="rows"?"row":void 0,p=b==="blocks"&&d?.lens==="blocks"?{...d,...y?{as:y}:{}}:b==="blocks"&&d?.lens==="columns"?{...f,group:d.column,...y?{as:y}:{}}:f;return C(v(p),r,o,l)}if(d){let b=Kn(d,a,r,i);if(b)return C(b,r,o,l)}}catch(g){if(!(g instanceof x))throw g;return{failed:`Couldn't change that: ${g.message}.`,...t}}if(!s.complete)return{failed:"Couldn't change that: changing it freely needs AI, which isn't on here. Try \u201Cgroup by status\u201D, \u201Conly this month\u201D or \u201Cas a calendar\u201D.",...t};let u=await cn(e,o,n);return N(u)?u:{...u,asks:l}}var v=n=>{let{title:e,...s}=n;return s};function Kn(n,e,s,t){let o=/ (?:group(?:ed)?|split|organi[sz]ed?|put them|columns) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1]??(/^ by /.test(t)?W(t):void 0);if(o){let d=I(e,o);if(d?.type==="enum")return n.lens==="blocks"?{...v(n),group:d.name}:{lens:"columns",kind:n.kind,column:d.name};let c=rn(e,o,s);return c?{lens:"coverage",kind:n.kind,across:c.to[0],link:c.name}:h(d?`${e.plural}' ${d.words} is not a choice, so they cannot be grouped by it`:`${e.plural} have nothing called ${o} to group by`)}let r=/ (?:sort(?:ed)?|order(?:ed)?) by ([\p{L}\p{N} -]+?)(?= (?:and|only|with)|\s*$)/u.exec(t)?.[1];if(r){let d=I(e,r);return d?{...n.lens==="blocks"?v(n):{lens:"blocks",kind:n.kind,as:"row",...n.lens==="columns"?{group:n.column}:{}},sort:{by:d.name,.../\b(newest|latest|desc|descending|most)\b/.test(t)?{direction:"desc"}:{}}}:h(`${e.plural} have nothing called ${r} to sort by`)}if(/\b(?:all of them|everything|show all|clear the filter|no filter|without the filter)\b/.test(t)){if(n.lens!=="blocks"||!n.where)return h("it already shows all of them");let{where:d,...c}=v(n);return c}let i=on(t);if(i&&n.lens==="calendar"&&i.range)return{...v(n),range:i.range};if(i&&n.lens==="calendar"&&!i.range)return{lens:"blocks",kind:n.kind,as:"row",sort:{by:n.start},where:q(e,t)};let a=q(e,t);if(a.length>0){let d=n.lens==="blocks"?v(n):{lens:"blocks",kind:n.kind,as:"row",...n.lens==="columns"?{group:n.column}:{}};return{...d,where:[...d.where??[],...a]}}let l=n.lens==="calendar"?_(t):void 0;if(l)return{...v(n),range:l}}function Cn(n){return n.kinds.map(e=>{let s=e.fields.map(r=>`${r.name} (${r.type??"value"}${r.options?`: ${r.options.join(" | ")}`:""})`).join(", "),t=e.edges.map(r=>`${r.name} \u2192 ${r.to.join(" | ")}`).join(", "),o=Object.entries(e.roles).map(([r,i])=>`${r}=${i}`).join(", ");return`- ${e.kind} ("${e.plural}"): ${s}${t?`; relations: ${t}`:""}${o?`; roles: ${o}`:""}`}).join(`
|
|
2
|
+
`)}var Fn=['columns \u2014 a board, records in columns by one choice field: {"lens": "columns", "on": K, "bindings": {K: {"column": "<enum field>"}}}','calendar \u2014 records on a calendar by a date: {"lens": "calendar", "on": K, "bindings": {K: {"start": "<date field>", "end"?: "<date field>", "done"?: "<boolean field>"}}, "options": {"range"?: "day" | "week" | "month" | "quarter" | "year" | "agenda"}}','timeline \u2014 minutes of a day in columns: {"lens": "timeline", "on": K, "bindings": {K: {"start": "<number field>", "end": "<number field>", "column": "<enum field>"}}}','coverage \u2014 who covers what, a grid of two kinds joined by a relation: {"lens": "coverage", "on": K, "bindings": {"rows": {"kind": K}, "columns": {"kind": J}, "link": {"edge": "<relation of K to J>"}}}',`blocks \u2014 anything else, as blocks: {"lens": "blocks", "on": K, "options": {"blocks": [{"headline": "words"}, {"list": "all('K') where <condition>", "group"?: "<enum field>", "sort"?: "<field>" | {"by": "<field>", "direction": "desc"}, "as"?: "row" | "card", "empty"?: "words"}, {"figure": "count(all('K'))", "label": "words"}]}}. Conditions read a record's own fields: status == 'open', not done, days(today(), due) <= 7.`].join(`
|
|
3
|
+
`);function Gn(n,e,s){return["You draw a view of an app's data as JSON \u2014 never code. The app's kinds, their fields (with types) and relations:",Cn(e),"","The lenses you may use (prefer the first four; use blocks only when none of them fits):",Fn,"",s?`The view on screen now:
|
|
4
|
+
${JSON.stringify(s.lens)}
|
|
5
|
+
Change it as asked, and keep everything not asked about.`:"",`Asked: ${JSON.stringify(n)}`,'Answer with ONE JSON object: {"title": "<a few words, like Deliverables by status>", "lens": \u2026, "on": \u2026, "bindings"?: \u2026, "options"?: \u2026}. Name only the kinds, fields and relations listed above. If it cannot be drawn from them, answer {"failed": "<one sentence saying why>"}.'].filter(t=>t!=="").join(`
|
|
6
|
+
`)}async function cn(n,e,s){let t=e.lastGood?{lastGood:e.lastGood}:{},o=j(O(e.app.schema,e.sight)),r;try{r=(await e.complete({prompt:Gn(n,o,s)})).text}catch{return{failed:"Couldn't draw that: the model did not answer.",...t}}let i=Z(r);if(typeof i!="object"||i===null||Array.isArray(i))return{failed:"Couldn't draw that: the model's answer was not a view.",...t};let a=i;if(typeof a.failed=="string")return{failed:`Couldn't draw that: ${a.failed.replace(/^Couldn't draw that:\s*/i,"").replace(/\.$/,"")}.`,...t};let l=ln(a);if(!T(l.name))return{failed:`Couldn't draw that: "${l.name}" is not a picture the seat can draw.`,...t};let d=l.title?l.title.slice(0,80):s?.title??k(n.trim()).slice(0,80),c={...l,title:s&&s.title===d?d:F(d,e)},u=E(e.app,c,e.sight);return u.ok?{...M(e.app,c,u.drawn,e.sight,"model"),asks:[n]}:{failed:u.failed,...t}}function zn(n,e,s){let t=[...n.lenses??[]];for(let o of e){let r={name:o.lens,title:o.title,on:o.on,...o.bindings?{bindings:o.bindings}:{},...o.options?{options:o.options}:{}};if(t.some(a=>a.title===r.title))continue;E({...n,lenses:t},r,s).ok&&(t=[...t,r])}return t.length===(n.lenses??[]).length?n:{...n,lenses:t}}async function Bn(n,e,s){let{app:t,drafts:o}=s,r=fn(t,s.principal),i=c=>{let u=ln(c);return{lens:u,verdict:E(t,u,r)}};if(n==="keep_lens"){let{lens:c,verdict:u}=i(e);if(!u.ok)return{ok:!1,error:u.failed,reason:"invalid"};if(!o?.keep)return{ok:!1,error:"This app's declaration cannot be written from here."};let g=G(c),b=await o.keep(g);return b.ok?{ok:!0,data:{kept:g,said:b.said??`Adds \u201C${g.title}\u201D to the places.`,undo:In(g)}}:{ok:!1,error:b.error}}if(e.lens!==void 0){let{lens:c,verdict:u}=i(e.lens);return u.ok?{ok:!0,data:tn(M(t,c,u.drawn,r,"model"))}:{ok:!1,error:u.failed,reason:"invalid"}}let a={app:t,sight:r,...o?.complete?{complete:o.complete}:{},...o?.views?{views:o.views}:{}},l=String(e.ask??""),d;if(e.current!==void 0){let{lens:c,verdict:u}=i(e.current);if(!u.ok)return{ok:!1,error:u.failed,reason:"invalid"};d=await En(M(t,c,u.drawn,r,"model"),l,a)}else d=await xn(l,a);return N(d)?{ok:!1,error:d.failed,reason:"invalid"}:{ok:!0,data:tn(d)}}export{N as a,fn as b,E as c,G as d,In as e,ln as f,On as g,M as h,tn as i,Jn as j,Nn as k,xn as l,En as m,zn as n,Bn as o};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ja as l,pa as p,zb as a}from"./chunk.DZZL5IDD.js";import{c}from"./chunk.FQLNBIQ5.js";function m(e){if(e.withheld===!0||e.undoes!==void 0||e.mutation?.name!==a)return;let{node:n,field:r}=e.mutation.args??{};return typeof n=="string"&&typeof r=="string"?{node:n,field:r}:void 0}function R(e,n){return e.kind!==n.kind?!1:e.id!==void 0||n.id!==void 0?e.id===n.id&&e.onBehalfOf===n.onBehalfOf:(e.name??"")===(n.name??"")}var f=e=>{let n=0;for(let r of e)n++;return n};function k(e){if(e.length===0)return;let n=m(e[0]);if(!n)return;let r=0,o=0;for(let i of e){let d=m(i);if(!d||d.node!==n.node||d.field!==n.field)return;for(let t of i.primitives)if(t.op==="splice-text"&&t.id===n.node&&t.field===n.field)r+=f(t.inserted),o+=f(t.removed);else if(t.op==="patch-node"&&t.id===n.node&&Object.prototype.hasOwnProperty.call(t.after,n.field)){let s=t.before[n.field],u=t.after[n.field];r+=typeof u=="string"?f(u):0,o+=typeof s=="string"&&!c(s)?f(s):0}}return{...n,inserted:r,removed:o}}var T=(e,n)=>({node:e.node,field:e.field,inserted:e.inserted+n.inserted,removed:e.removed+n.removed});function y(e){return`(${[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]].join(" ")})`}function w(e,n,r,o=!0){let i=r?.getNode(e.node),d=i?n.tryDefinition(i.kind):void 0,t=p(d,e.field);return`Wrote in ${i&&o?`${l(d,i)}'s ${t.toLowerCase()}`:t} ${y(e)}`}export{R as a,k as b,T as c,w as d};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a}from"./chunk.Y4FZKUOK.js";import"./chunk.TIALD6SC.js";import"./chunk.QHY5NVYH.js";import"./chunk.U6ZRJKVM.js";import"./chunk.PLTH2LW5.js";import"./chunk.66P5IDTH.js";import"./chunk.AJSUHPBE.js";import"./chunk.KDXU5DT3.js";import"./chunk.W4BKYSZX.js";import{b as n}from"./chunk.7XLS6XTY.js";import"./chunk.U5P23GO7.js";import"./chunk.5STU3KYG.js";import"./chunk.GZHZLJBF.js";import"./chunk.UKQUUPKE.js";import"./chunk.OJGHDWI6.js";import"./chunk.DDUCIUVW.js";import"./chunk.NUYA4BWI.js";import"./chunk.OKZT2QBM.js";import"./chunk.ACTXR2MI.js";import"./chunk.AI34V6WV.js";import"./chunk.G4ULQK64.js";import{T as i}from"./chunk.M7RESZB6.js";import"./chunk.SDO3U72B.js";import"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import{b as o}from"./chunk.AJZBJBMO.js";var e=o(i(),1);function m({entries:d,style:l,headingStyle:p,className:r}){return(0,e.jsxs)("section",{...r?{className:r}:{},"data-testid":"record-ai","aria-label":"What AI did here",style:{display:"grid",gap:10,...l},children:[(0,e.jsx)("h2",{style:p??{margin:0,fontSize:"1rem"},children:"What AI did here"}),(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,fontSize:"0.875rem"},children:d.slice(0,8).map(t=>(0,e.jsx)(n,{entry:t,undo:s=>(0,e.jsx)(a,{batch:s})},t.id))})]})}export{m as RecordInteractions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.
|
|
1
|
+
import"./chunk.AI34V6WV.js";import"./chunk.G4ULQK64.js";import{G as W,T as x}from"./chunk.M7RESZB6.js";import"./chunk.SDO3U72B.js";import"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import{b as D}from"./chunk.AJZBJBMO.js";var g=D(W(),1);var o=D(x(),1),v=864e5,l=t=>Date.UTC(+t.slice(0,4),+t.slice(5,7)-1,+t.slice(8,10)),I=t=>new Date(t).toISOString().slice(0,10),s=(t,i)=>I(l(t)+i*v),m=(t,i)=>{let a=new Date(l(t)),u=a.getUTCMonth()+i,d=Date.UTC(a.getUTCFullYear(),u,1),w=new Date(Date.UTC(a.getUTCFullYear(),u+1,0)).getUTCDate();return I(d+(Math.min(a.getUTCDate(),w)-1)*v)};function p(t,i,a){try{return new Intl.DateTimeFormat(t??"en-US",{...i,timeZone:"UTC"}).format(a)}catch{return new Intl.DateTimeFormat("en-US",{...i,timeZone:"UTC"}).format(a)}}function F(t){try{let i=new Intl.Locale(t??"en-US"),a=i.getWeekInfo?.().firstDay??i.weekInfo?.firstDay;if(a!==void 0)return a%7}catch{return 0}return/^en-US|^en$|-(US|CA|JP|BR|IL|MX|PH)$/.test(t??"en-US")?0:1}function H({id:t,label:i,selected:a,today:u,locale:d,onPick:w,onClose:T}){let[r,f]=(0,g.useState)(a??u),U=(0,g.useRef)(null),y=F(d),b=`${r.slice(0,7)}-01`,M=(new Date(l(b)).getUTCDay()-y+7)%7,P=s(b,-M),A=Array.from({length:6},(e,n)=>Array.from({length:7},(S,c)=>s(P,n*7+c))),$=p(d,{month:"long",year:"numeric"},l(b)),h=(0,g.useRef)(!0);(0,g.useEffect)(()=>{h.current&&U.current?.querySelector(`[data-day="${r}"]`)?.focus(),h.current=!1},[r]);let E=e=>{let n={ArrowLeft:()=>s(r,-1),ArrowRight:()=>s(r,1),ArrowUp:()=>s(r,-7),ArrowDown:()=>s(r,7),PageUp:()=>m(r,e.shiftKey?-12:-1),PageDown:()=>m(r,e.shiftKey?12:1),Home:()=>s(r,-((new Date(l(r)).getUTCDay()-y+7)%7)),End:()=>s(r,6-(new Date(l(r)).getUTCDay()-y+7)%7)};n[e.key]?(e.preventDefault(),h.current=!0,f(n[e.key]())):e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),T())},R=Array.from({length:7},(e,n)=>l("1970-01-04")+(y+n)%7*v),C={minWidth:32,minHeight:32,padding:"0 8px",borderRadius:6};return(0,o.jsxs)("div",{id:t,role:"group","aria-label":`Pick a date for ${i}`,"data-graview-part":"when-month",onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),T())},style:{flexBasis:"100%",width:"min(100%, 20rem)",boxSizing:"border-box",padding:8,border:"1px solid var(--graview-edge)",borderRadius:8,background:"var(--graview-panel)",color:"var(--graview-ink)"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:6,marginBottom:6},children:[(0,o.jsx)("button",{type:"button","aria-label":"Previous month",onClick:()=>f(m(r,-1)),style:C,children:"\u2039"}),(0,o.jsx)("span",{id:`${t}-title`,"aria-live":"polite",style:{fontWeight:600,fontSize:"0.875rem"},children:$}),(0,o.jsx)("button",{type:"button","aria-label":"Next month",onClick:()=>f(m(r,1)),style:C,children:"\u203A"})]}),(0,o.jsxs)("table",{ref:U,role:"grid","aria-labelledby":`${t}-title`,onKeyDown:E,style:{width:"100%",borderCollapse:"collapse",tableLayout:"fixed",fontSize:"0.8125rem"},children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:R.map(e=>(0,o.jsx)("th",{scope:"col",abbr:p(d,{weekday:"long"},e),style:{fontWeight:500,color:"var(--graview-ink-faint)",padding:"2px 0"},children:p(d,{weekday:"narrow"},e)},e))})}),(0,o.jsx)("tbody",{children:A.map(e=>(0,o.jsx)("tr",{children:e.map(n=>{let S=n.slice(0,7)===b.slice(0,7),c=n===a,k=n===u;return(0,o.jsx)("td",{role:"gridcell","aria-selected":c||void 0,style:{padding:1,textAlign:"center"},children:(0,o.jsx)("button",{type:"button","data-day":n,tabIndex:n===r?0:-1,"aria-label":`${p(d,{weekday:"long",year:"numeric",month:"long",day:"numeric"},l(n))}${k?", today":""}${c?", selected":""}`,...k?{"aria-current":"date"}:{},onClick:()=>w(n),onFocus:()=>n!==r&&f(n),style:{width:"100%",minHeight:36,padding:0,borderRadius:6,border:k?"1px solid var(--graview-accent)":"1px solid transparent",background:c?"var(--graview-accent)":"transparent",color:c?"var(--graview-accent-ink)":S?"var(--graview-ink)":"var(--graview-ink-faint)",fontWeight:c?600:400},children:Number(n.slice(8,10))})},n)})},e[0]))})]})]})}export{H as WhenMonth};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{n as K}from"./chunk.AI34V6WV.js";import"./chunk.G4ULQK64.js";import{G as R,T as x,ba as N,ca as $}from"./chunk.M7RESZB6.js";import"./chunk.SDO3U72B.js";import{Dd as v,Ed as b,Fd as f,Ld as h,Nd as k,na as g}from"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import{b as w}from"./chunk.AJZBJBMO.js";var u=w(R(),1);var o=w(x(),1),E=()=>()=>{};function C(e){let n=(0,u.useMemo)(()=>e?.onChange?i=>e.onChange(i):E,[e]),t=()=>e?.current()??b;return(0,u.useSyncExternalStore)(n,t,t)}var D=(e,n)=>e.lens?n.may.lenses:n.may.views;async function p(e,n,t){try{return await n(),!0}catch(i){let r=i?.code,d=typeof r=="string"?r:void 0;return e?.notify({kind:"toast",tone:"bad",sentence:i instanceof Error&&i.message?i.message:t,...d?{code:d}:{}}),!1}}function H(e,n,t,i,r){let d=e.name;return p(r,()=>n==="view"&&d!==void 0?i?t.hide(d):t.show(d):t.lens?.({op:"set-lens-hidden",title:e.title,on:e.kind,hidden:i}),i?`\u201C${e.title}\u201D could not be hidden.`:`\u201C${e.title}\u201D could not be shown.`)}function L(e,n,t,i,r){return p(r,()=>t.lens?.({op:"set-lens-hidden",title:e,hidden:i}),i?`\u201C${n}\u201D could not be hidden.`:`\u201C${n}\u201D could not be shown.`)}function V(e,n,t){return p(t,()=>n.restore(e.name),`\u201C${e.title}\u201D could not be restored.`)}async function A(e,n,t,i){let r=n==="view"&&e.name!==void 0?e.name:v(e.title),d=await p(i,()=>n==="view"&&e.name!==void 0?t.remove(e.name,{title:e.title,kind:e.kind}):t.lens?.({op:"remove-lens",title:e.title,on:e.kind}),`\u201C${e.title}\u201D could not be deleted.`);return d&&i?.notify({kind:"toast",id:`deleted-view-${r}`,sentence:`Deleted \u201C${e.title}\u201D. It is under Recently deleted in the places for ${30} days.`,action:{label:"Restore",onSelect:()=>void V({name:r,title:e.title},t,i)}}),d}function G(){let e=$(),n=e?.keptViews,t=C(n),i=e?.views;return(0,u.useMemo)(()=>{if(!n||!i)return null;let r=s=>f(s,t,n),d=new Set,c=i.places().filter(s=>{if(!s.hidden||r(s)===null)return!1;let m=`${s.name??""}|${s.title}`;return d.has(m)?!1:(d.add(m),!0)}),l=e?.store.schema,y=t.may.lenses&&n.lens&&l?(i.arrangement?.()?.hide??[]).filter(s=>l.tryDefinition(s)!==void 0).map(s=>({kind:s,title:g(l,s),path:h(l,s)})):[];return{keeper:n,hidden:c,lists:y,removed:t.removed.filter(s=>D(s,t)),how:r}},[n,t,i,e?.store.schema])}function T(e,n){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(n??"en-US",{month:"short",day:"numeric"})}var I=`.graview-bar-list li.graview-bar-tidied{display:flex;align-items:flex-start;gap:8px;padding:0 0 0 2px}
|
|
2
|
+
.graview-bar-tidied>.graview-bar-item,.graview-bar-gone{flex:1 1 auto;min-width:0}
|
|
3
|
+
.graview-bar-gone{display:grid;gap:1px;padding:7px 8px;font-size:.875rem;line-height:1.3;overflow-wrap:anywhere;color:var(--graview-ink-muted)}
|
|
4
|
+
.graview-bar-gone small{font-size:.75rem}
|
|
5
|
+
.graview-bar-tidy{flex:0 0 auto;margin:3px 2px;padding:4px 10px;border:1px solid var(--graview-edge);border-radius:6px;background:none;font:inherit;font-size:.8125rem;color:var(--graview-ink);cursor:pointer}
|
|
6
|
+
.graview-bar-tidy:hover{background:color-mix(in srgb,var(--graview-ink) 7%,transparent)}
|
|
7
|
+
.graview-bar-tidy:focus-visible{outline:2px solid var(--graview-accent);outline-offset:1px}`;function P({place:e,scene:n,reach:t,done:i}){if(n)return(0,o.jsx)("span",{className:"graview-bar-gone",children:e.title});let r="as"in e?{key:`place:${e.kind}:${e.as}`,label:e.title,path:k(e.as),group:"pictures",kind:e.kind}:{key:`kind:${e.kind}`,label:e.title,path:e.path,group:"lists",kind:e.kind},d=t.href?.(r.path);return(0,o.jsx)(d!==void 0?"a":"button",{className:"graview-bar-item","data-testid":"app-view-hidden-place",...d!==void 0?{href:d}:{type:"button"},onClick:l=>{i(),!(!t.go||d!==void 0&&(l.button!==0||l.metaKey||l.ctrlKey||l.shiftKey||l.altKey))&&(l.preventDefault(),t.go(r))},children:e.title})}function M({id:e,scene:n,reach:t,done:i}){let r=G(),{locale:d}=N(),c=(0,u.useContext)(K);if(!r||r.hidden.length===0&&r.lists.length===0&&r.removed.length===0)return null;let{keeper:l,hidden:y,lists:s,removed:m,how:S}=r;return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("style",{children:I}),y.length>0||s.length>0?(0,o.jsxs)("div",{role:"group","aria-labelledby":`${e}-hidden`,"data-place-group":"hidden",children:[(0,o.jsx)("p",{id:`${e}-hidden`,children:"Hidden"}),(0,o.jsxs)("ul",{children:[s.map(a=>(0,o.jsxs)("li",{className:"graview-bar-tidied",children:[(0,o.jsx)(P,{place:a,scene:n,reach:t,done:i}),(0,o.jsx)("button",{type:"button",className:"graview-bar-tidy","data-testid":"app-list-show","data-kind":a.kind,"aria-label":`Show \u201C${a.title}\u201D`,onClick:()=>void L(a.kind,a.title,l,!1,c),children:"Show"})]},`kind:${a.kind}`)),y.map(a=>(0,o.jsxs)("li",{className:"graview-bar-tidied",children:[(0,o.jsx)(P,{place:a,scene:n,reach:t,done:i}),(0,o.jsx)("button",{type:"button",className:"graview-bar-tidy","data-testid":"app-view-show","data-view":a.name??a.title,"aria-label":`Show \u201C${a.title}\u201D`,onClick:()=>void H(a,S(a),l,!1,c),children:"Show"})]},`${a.kind}:${a.as}`))]})]}):null,m.length>0?(0,o.jsxs)("div",{role:"group","aria-labelledby":`${e}-removed`,"data-place-group":"removed",children:[(0,o.jsx)("p",{id:`${e}-removed`,children:"Recently deleted"}),(0,o.jsx)("ul",{children:m.map(a=>(0,o.jsxs)("li",{className:"graview-bar-tidied",children:[(0,o.jsxs)("span",{className:"graview-bar-gone",children:[(0,o.jsx)("span",{children:a.title}),(0,o.jsxs)("small",{children:["until ",T(a.until,d)]})]}),(0,o.jsx)("button",{type:"button",className:"graview-bar-tidy","data-testid":"app-view-restore","data-view":a.name,"aria-label":`Restore \u201C${a.title}\u201D`,onClick:()=>void V(a,l,c),children:"Restore"})]},a.name))})]}):null]})}export{M as TidyGroups,A as remove,V as restore,H as setHidden,L as setListHidden,C as useKeptViewsState,G as useTidied};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as I}from"./chunk.2QFKNTAZ.js";import{a as ie,b as de,c as se,d as le,e as V,f as L,g as ue}from"./chunk.BI6DS3PZ.js";import{a as ye}from"./chunk.PGA5TUSN.js";import{c as T,e as ae,f as fe}from"./chunk.7R727IKU.js";import{a as j,b as ee,c as ne,d as re,f as E,m as te,n as b,o as oe,p as B,q as P}from"./chunk.LQAT7FA6.js";import{b as x,d as pe,e as me,g as ce,i as ge,j as he,k as be}from"./chunk.HZHNM2KI.js";import{C as v,Fa as Y,K as H,Rb as q,Sb as Q,T as K,Tb as C,W as F,aa as J,ga as X,ma as N,oa as Z,ta as G,ua as A,va as z,wa as O,xa as M}from"./chunk.F7PIW2EM.js";var we=e=>e.caption?.trim()||e.name,_=e=>A(e)?`${we(e)}, ${z(e)}`:we(e);function tn(e){let n=Math.max(0,Math.round(e)),t=a=>String(a).padStart(2,"0"),r=Math.floor(n/3600),o=Math.floor(n%3600/60);return r>0?`${r}:${t(o)}:${t(n%60)}`:`${o}:${t(n%60)}`}function ve(e){let n=e?.fields?.shape??{};return Object.keys(n).filter(t=>{let r=v(n[t]);for(;r?.innerType;)r=v(r.innerType);return M(n[t])!==void 0||r?.type==="array"&&M(r.element)!==void 0})}function on(e,n){for(let t of ve(n)){let r=O(e[t]).find(o=>G(o)||A(o));if(r)return r}}var k=e=>{try{return e()}catch{return null}},Te=e=>typeof e=="string"&&ie.includes(e);function Fe(e){if(e!==void 0)return Te(e)?e:e&&typeof e=="object"&&typeof e.expr=="string"?{expr:k(()=>T(e.expr))}:"neutral"}var Ne=4;function Me(e){let n=typeof e.list=="string"?k(()=>T(e.list)):null,t=e.sort,r=typeof t=="string"?t:t&&typeof t=="object"&&typeof t.by=="string"?t.by:void 0,o=t&&typeof t=="object"?t.direction:void 0,a=n,d;if(n&&r!==void 0)if(o==="choices")d=r;else{let y=k(()=>T(r));a=y?{t:"call",fn:"sort",args:[n,y,{t:"lit",value:o==="desc"?"desc":"asc",at:0}],at:0}:null}let l=typeof e.limit=="number"&&Number.isInteger(e.limit)&&e.limit>=1?Math.min(e.limit,V):void 0,i=e.group,s=typeof i=="string"?i:i&&typeof i=="object"&&typeof i.by=="string"?i.by:void 0,f=i&&typeof i=="object"&&i.headings&&typeof i.headings=="object"?i.headings:{};return{t:"list",source:a,...d?{choiceOrder:d}:{},...l?{limit:l}:{},...s?{group:{by:s,headings:Object.fromEntries(Object.entries(f).filter(y=>typeof y[1]=="string"))}}:{},...typeof e.empty=="string"?{empty:e.empty}:{},as:e.as==="card"?"card":"row"}}function Se(e,n=1,t=""){if(!Array.isArray(e)||n>Ne)return[];let r={};return e.flatMap(o=>{if(!o||typeof o!="object"||Array.isArray(o))return[];let a=o,d=p=>typeof p=="string"?k(()=>ae(p)):null,l=p=>typeof p=="string"?k(()=>T(p)):null,i=Fe(a.tone),s=typeof a.label=="string"?a.label:void 0,f=p=>Object.hasOwn(a,p),y=typeof a.currency=="string"&&/^[A-Z]{3}$/.test(a.currency)?a.currency:void 0,u=f("list")?"list":f("headline")?"headline":typeof a.figure=="string"?"number":Ce.find(f);if(!u)return[];let m=r[u]=(r[u]??0)+1,c=a.key,R=typeof c=="string"&&c?c:`${t}${u}.${m}`;return[{...(()=>{switch(u){case"list":return Me(a);case"number":{let p=se.includes(a.as)?a.as:void 0,W=le.includes(a.emphasis)?a.emphasis:void 0;return{t:u,value:l(a.figure),...p?{as:p}:{},...y?{currency:y}:{},...s?{label:d(s)}:{},...W?{emphasis:W}:{}}}case"headline":case"title":return{t:u,parts:d(a[u])};case"text":{let p=a.lines;return{t:u,parts:d(a[u]),...i?{tone:i}:{},...typeof p=="number"&&Number.isInteger(p)&&p>=0?{lines:p}:{}}}case"badge":return{t:u,parts:d(a[u]),...i?{tone:i}:{}};case"field":{let p=de.includes(a.as)?a.as:void 0;return{t:u,field:String(a.field),...p?{as:p}:{},...y?{currency:y}:{},...s?{label:s}:{}}}case"image":return{t:u,field:String(a.image),as:a.as==="gallery"?"gallery":"thumb",...s?{label:s}:{}};case"progress":{let p=a.progress??{};return{t:u,value:l(p.value),max:l(p.max),...s?{label:d(s)}:{}}}case"group":return{t:u,blocks:Se(a.group,n+1,`${R}.`),direction:a.direction==="row"?"row":"column"};case"when":return{t:u,when:l(a.when),show:Se(a.show,n+1,`${R}.`)};default:return{t:u}}})(),key:R}]})}var Ce=["title","text","badge","field","image","progress","group","when","divider","figure"],g="\u2014",Ve=500;function w(e,n){if(!e)return{ok:!1,problem:"an expression that does not parse"};try{return{ok:!0,value:E(e,{graph:n.graph??te,subject:n.node,kinds:n.kinds,today:n.today,budget:n.budget??Ve})}}catch(t){return{ok:!1,problem:t instanceof Error?t.message:String(t)}}}var Le=(e,n,t)=>!e.format&&e.expr?.t==="ident"&&typeof t=="string"&&n.fields[e.expr.name]?.format==="markdown";function S(e,n,t){if(!e)return{text:g,problem:"a template that does not parse"};let r,o;return{text:e.map(d=>{if(d.text!==void 0)return d.text;let l=w(d.expr??null,n);if(!l.ok)return r??=`{${d.source??""}}: ${l.problem}`,g;if(Le(d,n,l.value))return n.glance?pe(l.value,{markdown:!0}):t&&e.length===1?(o=!0,l.value):me(l.value);let i=!d.format&&d.expr?.t==="ident"&&typeof l.value=="number"?Ge(n,d.expr.name):void 0;return oe(d,i?C(l.value,i):b(l.value,d.format,n.today,d.formatArgs,n.money,P(n.schema)))}).join(""),...r?{problem:r}:{},...o?{markdown:o}:{}}}var Ie=" \xB7 ";function _e(e,n){if(!e||!n.node)return;let t=[[]];for(let d of e){if(d.text===void 0){t[t.length-1].push(d);continue}d.text.split(Ie).forEach((i,s)=>{s>0&&t.push([]),i!==""&&t[t.length-1].push({text:i})})}if(t.length<2)return;let r=d=>{let[l]=d;if(!(d.length!==1||!l||l.format||l.expr?.t!=="ident"))return n.fields[l.expr.name]?.type==="enum"?l.expr.name:void 0},o=0,a=t.flatMap(d=>{let l=r(d);if(l){let s=Object.hasOwn(n.node,l)?n.node[l]:void 0;return s==null||s===""?[]:(o++,[{text:x(n.definition,l,s),field:l}])}let i=S(d,n).text.trim();return i===""||i===g?[]:[{text:i}]});return o>0?a:void 0}function Re(e,n){if(e===void 0)return;if(typeof e=="string")return e;let t=w(e.expr,n);return t.ok&&Te(t.value)?t.value:"neutral"}function De(e){if(typeof e=="string")try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"?n.href:void 0}catch{return}}var xe=(e,n)=>{let t=e.fields[n]?.type;return t==="phone"||t==="place"||t==="duration"?t:ge(e.definition,n)},Ge=(e,n)=>q(e.definition?.fields?.shape?.[n])??ce(e.definition,n);function $e(e,n,t,r,o){if(n==null||n==="")return g;if(typeof n=="boolean")return n?"yes":"no";if(r)return b(n,r,t.today,[],o?{...t.money,currency:o}:t.money);let a=t.fields[e];if(t.definition?.display?.format?.[e])return x(t.definition,e,n);let d=he(xe(t,e),n,t.money?.locale);if(d!==void 0)return d;if(a?.type==="date")return b(n,"date",t.today,[],t.money);if(a?.type==="datetime"&&typeof n=="string")return K(n,t.money?.locale,t.money?.timeZone);if(a?.type==="enum"&&(typeof n=="string"||Array.isArray(n)))return x(t.definition,e,n);let l=typeof n=="number"?Ge(t,e):void 0;if(l)return C(n,l);if(typeof n=="number")return F(n,t.money?.locale,{});let i=O(n);return i[0]?i.map(_).join(", "):Array.isArray(n)?n.map(s=>String(s)).join(", "):typeof n=="object"?g:String(n)}function Ue(e,n,t,r,o){return typeof e!="number"?String(e):n==="money"?Q(e,t?{...o,currency:t}:o):n==="percent"?b(e,n,r,[],o):F(e,o?.locale)}var h=(e,n)=>n?{...e,problem:n}:e;function ke(e){return e.firstHeading===void 0?e:{...e,firstHeading:void 0}}function We(e,n,t){switch(e.t){case"title":{let r=S(e.parts,n);return h({t:"title",text:r.text},r.problem)}case"text":{let r=S(e.parts,n,!0),o=Re(e.tone,n),a=n.glance&&!r.problem?_e(e.parts,n):void 0;return h({t:"text",text:r.text,...o?{tone:o}:{},...e.lines!==void 0?{lines:e.lines}:{},...r.markdown?{markdown:r.markdown}:{},...a?{runs:a}:{}},r.problem)}case"badge":{let r=S(e.parts,n);return h({t:"badge",text:r.text,tone:Re(e.tone,n)??"neutral"},r.problem)}case"field":{let r=e.label??N(n.definition,e.field);if(!n.node)return{t:"field",field:e.field,label:r,text:g,problem:`"${e.field}" names a field, and these blocks are about no one record`};let o=e.as===void 0?n.kinds.get(n.node.kind)?.linked?.get(e.field):void 0;if(o){let y=Y(Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0,o);return{t:"field",field:e.field,label:r,text:y.length>0?"linked record":g,...y.length>0?{linked:{relation:o,refs:y}}:{}}}let a=n.kinds.get(n.node.kind)?.computed?.has(e.field),d,l;if(a){let y=w({t:"ident",name:e.field,at:0},n);y.ok?d=y.value!==null&&typeof y.value=="object"?b(y.value,void 0,n.today,[],n.money,P(n.schema)):y.value:l=y.problem}else d=Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0;let i=e.as!==void 0?void 0:n.fields[e.field]?.type==="url"?De(d):be(xe(n,e.field),d),s=k(()=>$e(e.field,d,n,e.as,e.currency))??g,f=n.fields[e.field]?.type==="app-link"&&e.as===void 0&&typeof d=="string"?d:void 0;return h({t:"field",field:e.field,label:r,text:s,...i?{href:i}:{},...f?{app:f}:{}},l)}case"image":{let r=O(n.node&&Object.hasOwn(n.node,e.field)?n.node[e.field]:null),o=e.as==="gallery"?r:r.filter(a=>G(a)||A(a)).slice(0,1);return{t:"image",field:e.field,label:e.label??N(n.definition,e.field),as:e.as,files:o,text:o.map(_).join(", ")||g}}case"progress":{let r=w(e.value,n),o=w(e.max,n),a=e.label?S(e.label,n):{text:"Progress"},d=e.label?B(e.label,a.text):a.text,l=r.ok?o.ok?a.problem:o.problem:r.problem;return r.ok&&o.ok&&typeof r.value=="number"&&typeof o.value=="number"&&Number.isFinite(r.value)&&Number.isFinite(o.value)&&o.value>0?h({t:"progress",label:d,value:r.value,max:o.value,text:`${b(r.value,void 0,n.today)} of ${b(o.value,void 0,n.today)}`},l):h({t:"progress",label:d,text:g},l)}case"group":return{t:"group",direction:e.direction,blocks:Ae(e.blocks,ke(n))};case"when":{let r=w(e.when,n),o=r.ok&&r.value===!0;return h({t:"when",shown:o,blocks:o?Ae(e.show,ke(n)):[]},r.ok?void 0:r.problem)}case"divider":return{t:"divider"};case"figure":return{t:"figure"};case"headline":{let r=S(e.parts,n),o=Math.min(6,Math.max(1,(t?n.firstHeading:void 0)??n.heading??3));return h({t:"headline",level:o,text:e.parts?B(e.parts,r.text):r.text},r.problem)}case"number":{let r=w(e.value,n),o=!r.ok||r.value===null||typeof r.value=="object"?g:Ue(r.value,e.as,e.currency,n.today,n.money),a=e.label?S(e.label,n):void 0;return h({t:"number",text:o,...a&&e.label?{label:B(e.label,a.text)}:{},...e.emphasis?{emphasis:e.emphasis}:{}},r.ok?a?.problem:r.problem)}case"list":return Ke(e,n)}}function Ae(e,n){let t=e.findIndex(r=>r.t==="headline");return e.map((r,o)=>({...We(r,n,o===t),key:r.key}))}function Oe(e,n){let t=n.trim().toLowerCase();return e.some(r=>{switch(r.t){case"title":case"headline":return r.text.trim()!=="";case"text":case"badge":return t!==""&&r.text.toLowerCase().includes(t);case"group":return Oe(r.blocks,n);case"when":return r.shown&&Oe(r.blocks,n);default:return!1}})}var He=new Set(["every","some","sum","min","max","sort"]);function jn(e,n){let t=new Set,r=new Set,o=i=>{if(i)switch(i.t){case"ident":t.add(i.name);return;case"list":i.items.forEach(o);return;case"member":return o(i.object);case"unary":return o(i.operand);case"binary":return o(i.left),o(i.right);case"where":return o(i.set);case"call":i.args.forEach((s,f)=>{f===1&&He.has(i.fn)||o(s)});return;default:return}},a=i=>{for(let s of i??[])o(s.expr)},d=(i,s)=>{i.forEach((f,y)=>{let u=s[y];if(u)switch(f.t){case"field":case"image":t.add(f.field);return;case"title":case"text":case"badge":case"headline":a(f.parts);return;case"number":o(f.value),a(f.label);return;case"progress":o(f.value),o(f.max);return;case"group":u.t==="group"&&d(f.blocks,u.blocks);return;case"when":u.t==="when"&&u.shown&&d(f.show,u.blocks);return;case"list":if(u.t==="list")for(let m of u.members)r.add(m.id);return;default:return}})};d(e,n);let l=n[0];return{fields:t,records:r,...e[0]?.t==="title"&&l?.t==="title"?{title:l.text}:{}}}function Ke(e,n){let t=Math.min(6,(n.heading??3)+1),r=w(e.source,n);if(!r.ok)return{t:"list",as:e.as,failed:!0,members:[],headingLevel:t,more:0,problem:r.problem};let o=r.value,a=o instanceof j?o.nodes:o!==null&&typeof o=="object"&&!Array.isArray(o)?[o]:[];e.choiceOrder&&n.schema&&(a=Je(a,e.choiceOrder,n.schema));let d=a.length,l=a.slice(0,e.limit??V),i=l.slice(0,L),s=l.slice(L),f=(e.limit===void 0?d:l.length)-i.length,y=c=>e.group&&n.schema&&c.length>0?Xe(c,e.group,n.schema,n.graph):void 0,u=y(i),m=s.length>0?y(l):void 0;return{t:"list",as:e.as,failed:!1,members:i,...s.length>0?{rest:s}:{},...u?{groups:u}:{},...m?{everyGroup:m}:{},headingLevel:t,...i.length===0&&e.empty?{empty:e.empty}:{},more:f,total:d}}function D(e,n,t){let r=e.tryDefinition(n)?.fields?.shape,o=r&&Object.hasOwn(r,t)?I(r[t]):void 0;return o?.type==="enum"?o.options??[]:[]}var $=(e,n)=>Object.hasOwn(e,n)?e[n]:void 0;function Je(e,n,t){let r=o=>{let a=D(t,o.kind,n).indexOf(String($(o,n)));return a<0?Number.MAX_SAFE_INTEGER:a};return e.map((o,a)=>({node:o,i:a,rank:r(o)})).sort((o,a)=>o.rank-a.rank||o.i-a.i).map(o=>o.node)}function Xe(e,n,t,r){let o=e.some(i=>D(t,i.kind,n.by).length>0)?void 0:ue(n.by);if(o&&r)return Ze(e,o,n.headings,t,r);let a=[];for(let i of e)for(let s of D(t,i.kind,n.by))a.includes(s)||a.push(s);let d=[];for(let i of a){let s=e.filter(y=>$(y,n.by)===i);if(s.length===0)continue;let f=t.tryDefinition(s[0].kind);d.push({value:i,heading:n.headings[i]??J(x(f,n.by,i)),members:s})}let l=e.filter(i=>!a.includes(String($(i,n.by))));return l.length>0&&d.push({value:null,members:l}),d}function Ze(e,n,t,r,o){let a=u=>n.way??(Object.hasOwn(r.tryDefinition(u.kind)?.edges??{},n.edge)?"out":"in"),d=new Map,l=[],i=P(r),s;for(let u of e){let m=a(u)==="out"?o.out(u.id,n.edge):o.in(u.id,n.edge);m.length===0&&l.push(u);for(let c of m){s??=c.kind;let R=d.get(c.id)??{node:c,members:[]};R.members.push(u),d.set(c.id,R)}}let f=[...d.values()].map(({node:u,members:m})=>({value:u.id,heading:t[u.id]??i(u),members:m})).sort((u,m)=>u.heading.localeCompare(m.heading,void 0,{numeric:!0}));!s&&e[0]&&a(e[0])==="out"&&(s=(r.tryDefinition(e[0].kind)?.edges??{})[n.edge]?.to?.[0]);let y=s&&s!=="*"?Z(r.tryDefinition(s),s):void 0;return l.length>0&&f.push({value:null,...y?{heading:`No ${y}`}:{},members:l}),f}function je(e){return e.t==="list"||e.t==="headline"||e.t==="number"||e.t==="image"&&e.as==="gallery"?!0:e.t==="group"?e.blocks.some(je):e.t==="when"?e.show.some(je):!1}function Ee(e,n){let t=e.tryDefinition(n)?.fields?.shape??{},r={};for(let[o,a]of Object.entries(t)){let d=I(a);d&&(r[o]=d)}return r}var Be=new WeakMap;function U(e){let n=Be.get(e);return n||Be.set(e,n=ye(e)),n}function ze(e,n,t,r={}){let o=U(e),a={},d={},l=i=>{if(i instanceof j)return i.nodes.map(s=>l(s));if(Array.isArray(i))return i.map(s=>l(s));if(i!==null&&typeof i=="object"){let s=i;return{id:s.id,kind:s.kind,label:X(e.tryDefinition(s.kind),s)}}return i};for(let[i,s]of o.get(t?t.kind:ne)?.computed??[])try{let f=[],y=E(s,{graph:n,subject:t,kinds:o,...r.today?{today:r.today}:{},...r.budget?{budget:r.budget}:{},...r.linked?{linked:r.linked}:{},onUnread:u=>f.push(u)});f.length>0&&(y===null||y instanceof j&&y.nodes.length===0)?d[i]=ee(f[0]):a[i]=l(y)}catch(f){if(!(f instanceof re))throw f;d[i]=f.sentence}return{values:a,refused:d}}function Pn(e,n,t){let{values:r}=ze(e,n,t);if(Object.keys(r).length===0)return t;let o=a=>Array.isArray(a)?a.map(o):a!==null&&typeof a=="object"?a.label:a;return{...t,...Object.fromEntries(Object.entries(r).map(([a,d])=>[a,o(d)]))}}function vn(e,n){return[...fe(e.tryDefinition(n)).keys()]}var Ye=500,qe=2e4,Pe=new WeakMap;function Qe(e,n){let t=Pe.get(e);t||Pe.set(e,t=new Map);let r=t.get(n);return r||t.set(n,r=Ee(e,n)),r}function Vn(e,n,t,r={}){if(n&&typeof e.seenBy!="function")throw new TypeError("blockContextFor: a seat is read from a store (its `seenBy`); a bare { graph, schema } is read as it is handed, with no principal");let o=n?e.seenBy(n):e,a=n&&t?o.graph.getNode(t.id)??null:t,d=o.schema,l=a&&d.tryDefinition(a.kind),i=!a||(r.slot??"page")==="page",{money:s,firstHeading:f}=r;return{node:a,graph:o.graph,schema:d,kinds:U(d),fields:a?Qe(d,a.kind):{},definition:l||void 0,today:r.today??o.today?.()??H(s?.timeZone),money:s,heading:r.heading??(i?2:3),firstHeading:f,budget:r.budget??(i?qe:Ye),...i?{}:{glance:!0}}}export{we as a,tn as b,ve as c,on as d,Se as e,Ae as f,Oe as g,jn as h,je as i,U as j,ze as k,Pn as l,vn as m,Vn as n};
|
|
1
|
+
import{a as I}from"./chunk.ZN3PUM2I.js";import{a as ie,b as de,c as se,d as le,e as V,f as L,g as ue}from"./chunk.QIPASE42.js";import{a as ye}from"./chunk.EVBCEEQ4.js";import{c as T,e as ae,f as fe}from"./chunk.OWT3VVOT.js";import{a as j,b as ee,c as ne,d as re,f as E,m as te,n as b,o as oe,p as B,q as P}from"./chunk.NHTGAP3G.js";import{b as x,d as pe,e as me,g as ce,i as ge,j as he,k as be}from"./chunk.ACTXR2MI.js";import{Aa as M,C as v,Ia as Y,L as H,Vb as q,W as K,Wb as Q,Xb as C,Z as F,da as J,ja as X,pa as N,ra as Z,wa as G,xa as A,ya as z,za as O}from"./chunk.DZZL5IDD.js";var we=e=>e.caption?.trim()||e.name,_=e=>A(e)?`${we(e)}, ${z(e)}`:we(e);function tn(e){let n=Math.max(0,Math.round(e)),t=a=>String(a).padStart(2,"0"),r=Math.floor(n/3600),o=Math.floor(n%3600/60);return r>0?`${r}:${t(o)}:${t(n%60)}`:`${o}:${t(n%60)}`}function ve(e){let n=e?.fields?.shape??{};return Object.keys(n).filter(t=>{let r=v(n[t]);for(;r?.innerType;)r=v(r.innerType);return M(n[t])!==void 0||r?.type==="array"&&M(r.element)!==void 0})}function on(e,n){for(let t of ve(n)){let r=O(e[t]).find(o=>G(o)||A(o));if(r)return r}}var k=e=>{try{return e()}catch{return null}},Te=e=>typeof e=="string"&&ie.includes(e);function Fe(e){if(e!==void 0)return Te(e)?e:e&&typeof e=="object"&&typeof e.expr=="string"?{expr:k(()=>T(e.expr))}:"neutral"}var Ne=4;function Me(e){let n=typeof e.list=="string"?k(()=>T(e.list)):null,t=e.sort,r=typeof t=="string"?t:t&&typeof t=="object"&&typeof t.by=="string"?t.by:void 0,o=t&&typeof t=="object"?t.direction:void 0,a=n,d;if(n&&r!==void 0)if(o==="choices")d=r;else{let y=k(()=>T(r));a=y?{t:"call",fn:"sort",args:[n,y,{t:"lit",value:o==="desc"?"desc":"asc",at:0}],at:0}:null}let l=typeof e.limit=="number"&&Number.isInteger(e.limit)&&e.limit>=1?Math.min(e.limit,V):void 0,i=e.group,s=typeof i=="string"?i:i&&typeof i=="object"&&typeof i.by=="string"?i.by:void 0,f=i&&typeof i=="object"&&i.headings&&typeof i.headings=="object"?i.headings:{};return{t:"list",source:a,...d?{choiceOrder:d}:{},...l?{limit:l}:{},...s?{group:{by:s,headings:Object.fromEntries(Object.entries(f).filter(y=>typeof y[1]=="string"))}}:{},...typeof e.empty=="string"?{empty:e.empty}:{},as:e.as==="card"?"card":"row"}}function Se(e,n=1,t=""){if(!Array.isArray(e)||n>Ne)return[];let r={};return e.flatMap(o=>{if(!o||typeof o!="object"||Array.isArray(o))return[];let a=o,d=p=>typeof p=="string"?k(()=>ae(p)):null,l=p=>typeof p=="string"?k(()=>T(p)):null,i=Fe(a.tone),s=typeof a.label=="string"?a.label:void 0,f=p=>Object.hasOwn(a,p),y=typeof a.currency=="string"&&/^[A-Z]{3}$/.test(a.currency)?a.currency:void 0,u=f("list")?"list":f("headline")?"headline":typeof a.figure=="string"?"number":Ce.find(f);if(!u)return[];let m=r[u]=(r[u]??0)+1,c=a.key,R=typeof c=="string"&&c?c:`${t}${u}.${m}`;return[{...(()=>{switch(u){case"list":return Me(a);case"number":{let p=se.includes(a.as)?a.as:void 0,W=le.includes(a.emphasis)?a.emphasis:void 0;return{t:u,value:l(a.figure),...p?{as:p}:{},...y?{currency:y}:{},...s?{label:d(s)}:{},...W?{emphasis:W}:{}}}case"headline":case"title":return{t:u,parts:d(a[u])};case"text":{let p=a.lines;return{t:u,parts:d(a[u]),...i?{tone:i}:{},...typeof p=="number"&&Number.isInteger(p)&&p>=0?{lines:p}:{}}}case"badge":return{t:u,parts:d(a[u]),...i?{tone:i}:{}};case"field":{let p=de.includes(a.as)?a.as:void 0;return{t:u,field:String(a.field),...p?{as:p}:{},...y?{currency:y}:{},...s?{label:s}:{}}}case"image":return{t:u,field:String(a.image),as:a.as==="gallery"?"gallery":"thumb",...s?{label:s}:{}};case"progress":{let p=a.progress??{};return{t:u,value:l(p.value),max:l(p.max),...s?{label:d(s)}:{}}}case"group":return{t:u,blocks:Se(a.group,n+1,`${R}.`),direction:a.direction==="row"?"row":"column"};case"when":return{t:u,when:l(a.when),show:Se(a.show,n+1,`${R}.`)};default:return{t:u}}})(),key:R}]})}var Ce=["title","text","badge","field","image","progress","group","when","divider","figure"],g="\u2014",Ve=500;function w(e,n){if(!e)return{ok:!1,problem:"an expression that does not parse"};try{return{ok:!0,value:E(e,{graph:n.graph??te,subject:n.node,kinds:n.kinds,today:n.today,budget:n.budget??Ve})}}catch(t){return{ok:!1,problem:t instanceof Error?t.message:String(t)}}}var Le=(e,n,t)=>!e.format&&e.expr?.t==="ident"&&typeof t=="string"&&n.fields[e.expr.name]?.format==="markdown";function S(e,n,t){if(!e)return{text:g,problem:"a template that does not parse"};let r,o;return{text:e.map(d=>{if(d.text!==void 0)return d.text;let l=w(d.expr??null,n);if(!l.ok)return r??=`{${d.source??""}}: ${l.problem}`,g;if(Le(d,n,l.value))return n.glance?pe(l.value,{markdown:!0}):t&&e.length===1?(o=!0,l.value):me(l.value);let i=!d.format&&d.expr?.t==="ident"&&typeof l.value=="number"?Ge(n,d.expr.name):void 0;return oe(d,i?C(l.value,i):b(l.value,d.format,n.today,d.formatArgs,n.money,P(n.schema)))}).join(""),...r?{problem:r}:{},...o?{markdown:o}:{}}}var Ie=" \xB7 ";function _e(e,n){if(!e||!n.node)return;let t=[[]];for(let d of e){if(d.text===void 0){t[t.length-1].push(d);continue}d.text.split(Ie).forEach((i,s)=>{s>0&&t.push([]),i!==""&&t[t.length-1].push({text:i})})}if(t.length<2)return;let r=d=>{let[l]=d;if(!(d.length!==1||!l||l.format||l.expr?.t!=="ident"))return n.fields[l.expr.name]?.type==="enum"?l.expr.name:void 0},o=0,a=t.flatMap(d=>{let l=r(d);if(l){let s=Object.hasOwn(n.node,l)?n.node[l]:void 0;return s==null||s===""?[]:(o++,[{text:x(n.definition,l,s),field:l}])}let i=S(d,n).text.trim();return i===""||i===g?[]:[{text:i}]});return o>0?a:void 0}function Re(e,n){if(e===void 0)return;if(typeof e=="string")return e;let t=w(e.expr,n);return t.ok&&Te(t.value)?t.value:"neutral"}function De(e){if(typeof e=="string")try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"?n.href:void 0}catch{return}}var xe=(e,n)=>{let t=e.fields[n]?.type;return t==="phone"||t==="place"||t==="duration"?t:ge(e.definition,n)},Ge=(e,n)=>q(e.definition?.fields?.shape?.[n])??ce(e.definition,n);function $e(e,n,t,r,o){if(n==null||n==="")return g;if(typeof n=="boolean")return n?"yes":"no";if(r)return b(n,r,t.today,[],o?{...t.money,currency:o}:t.money);let a=t.fields[e];if(t.definition?.display?.format?.[e])return x(t.definition,e,n);let d=he(xe(t,e),n,t.money?.locale);if(d!==void 0)return d;if(a?.type==="date")return b(n,"date",t.today,[],t.money);if(a?.type==="datetime"&&typeof n=="string")return K(n,t.money?.locale,t.money?.timeZone);if(a?.type==="enum"&&(typeof n=="string"||Array.isArray(n)))return x(t.definition,e,n);let l=typeof n=="number"?Ge(t,e):void 0;if(l)return C(n,l);if(typeof n=="number")return F(n,t.money?.locale,{});let i=O(n);return i[0]?i.map(_).join(", "):Array.isArray(n)?n.map(s=>String(s)).join(", "):typeof n=="object"?g:String(n)}function Ue(e,n,t,r,o){return typeof e!="number"?String(e):n==="money"?Q(e,t?{...o,currency:t}:o):n==="percent"?b(e,n,r,[],o):F(e,o?.locale)}var h=(e,n)=>n?{...e,problem:n}:e;function ke(e){return e.firstHeading===void 0?e:{...e,firstHeading:void 0}}function We(e,n,t){switch(e.t){case"title":{let r=S(e.parts,n);return h({t:"title",text:r.text},r.problem)}case"text":{let r=S(e.parts,n,!0),o=Re(e.tone,n),a=n.glance&&!r.problem?_e(e.parts,n):void 0;return h({t:"text",text:r.text,...o?{tone:o}:{},...e.lines!==void 0?{lines:e.lines}:{},...r.markdown?{markdown:r.markdown}:{},...a?{runs:a}:{}},r.problem)}case"badge":{let r=S(e.parts,n);return h({t:"badge",text:r.text,tone:Re(e.tone,n)??"neutral"},r.problem)}case"field":{let r=e.label??N(n.definition,e.field);if(!n.node)return{t:"field",field:e.field,label:r,text:g,problem:`"${e.field}" names a field, and these blocks are about no one record`};let o=e.as===void 0?n.kinds.get(n.node.kind)?.linked?.get(e.field):void 0;if(o){let y=Y(Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0,o);return{t:"field",field:e.field,label:r,text:y.length>0?"linked record":g,...y.length>0?{linked:{relation:o,refs:y}}:{}}}let a=n.kinds.get(n.node.kind)?.computed?.has(e.field),d,l;if(a){let y=w({t:"ident",name:e.field,at:0},n);y.ok?d=y.value!==null&&typeof y.value=="object"?b(y.value,void 0,n.today,[],n.money,P(n.schema)):y.value:l=y.problem}else d=Object.hasOwn(n.node,e.field)?n.node[e.field]:void 0;let i=e.as!==void 0?void 0:n.fields[e.field]?.type==="url"?De(d):be(xe(n,e.field),d),s=k(()=>$e(e.field,d,n,e.as,e.currency))??g,f=n.fields[e.field]?.type==="app-link"&&e.as===void 0&&typeof d=="string"?d:void 0;return h({t:"field",field:e.field,label:r,text:s,...i?{href:i}:{},...f?{app:f}:{}},l)}case"image":{let r=O(n.node&&Object.hasOwn(n.node,e.field)?n.node[e.field]:null),o=e.as==="gallery"?r:r.filter(a=>G(a)||A(a)).slice(0,1);return{t:"image",field:e.field,label:e.label??N(n.definition,e.field),as:e.as,files:o,text:o.map(_).join(", ")||g}}case"progress":{let r=w(e.value,n),o=w(e.max,n),a=e.label?S(e.label,n):{text:"Progress"},d=e.label?B(e.label,a.text):a.text,l=r.ok?o.ok?a.problem:o.problem:r.problem;return r.ok&&o.ok&&typeof r.value=="number"&&typeof o.value=="number"&&Number.isFinite(r.value)&&Number.isFinite(o.value)&&o.value>0?h({t:"progress",label:d,value:r.value,max:o.value,text:`${b(r.value,void 0,n.today)} of ${b(o.value,void 0,n.today)}`},l):h({t:"progress",label:d,text:g},l)}case"group":return{t:"group",direction:e.direction,blocks:Ae(e.blocks,ke(n))};case"when":{let r=w(e.when,n),o=r.ok&&r.value===!0;return h({t:"when",shown:o,blocks:o?Ae(e.show,ke(n)):[]},r.ok?void 0:r.problem)}case"divider":return{t:"divider"};case"figure":return{t:"figure"};case"headline":{let r=S(e.parts,n),o=Math.min(6,Math.max(1,(t?n.firstHeading:void 0)??n.heading??3));return h({t:"headline",level:o,text:e.parts?B(e.parts,r.text):r.text},r.problem)}case"number":{let r=w(e.value,n),o=!r.ok||r.value===null||typeof r.value=="object"?g:Ue(r.value,e.as,e.currency,n.today,n.money),a=e.label?S(e.label,n):void 0;return h({t:"number",text:o,...a&&e.label?{label:B(e.label,a.text)}:{},...e.emphasis?{emphasis:e.emphasis}:{}},r.ok?a?.problem:r.problem)}case"list":return Ke(e,n)}}function Ae(e,n){let t=e.findIndex(r=>r.t==="headline");return e.map((r,o)=>({...We(r,n,o===t),key:r.key}))}function Oe(e,n){let t=n.trim().toLowerCase();return e.some(r=>{switch(r.t){case"title":case"headline":return r.text.trim()!=="";case"text":case"badge":return t!==""&&r.text.toLowerCase().includes(t);case"group":return Oe(r.blocks,n);case"when":return r.shown&&Oe(r.blocks,n);default:return!1}})}var He=new Set(["every","some","sum","min","max","sort"]);function jn(e,n){let t=new Set,r=new Set,o=i=>{if(i)switch(i.t){case"ident":t.add(i.name);return;case"list":i.items.forEach(o);return;case"member":return o(i.object);case"unary":return o(i.operand);case"binary":return o(i.left),o(i.right);case"where":return o(i.set);case"call":i.args.forEach((s,f)=>{f===1&&He.has(i.fn)||o(s)});return;default:return}},a=i=>{for(let s of i??[])o(s.expr)},d=(i,s)=>{i.forEach((f,y)=>{let u=s[y];if(u)switch(f.t){case"field":case"image":t.add(f.field);return;case"title":case"text":case"badge":case"headline":a(f.parts);return;case"number":o(f.value),a(f.label);return;case"progress":o(f.value),o(f.max);return;case"group":u.t==="group"&&d(f.blocks,u.blocks);return;case"when":u.t==="when"&&u.shown&&d(f.show,u.blocks);return;case"list":if(u.t==="list")for(let m of u.members)r.add(m.id);return;default:return}})};d(e,n);let l=n[0];return{fields:t,records:r,...e[0]?.t==="title"&&l?.t==="title"?{title:l.text}:{}}}function Ke(e,n){let t=Math.min(6,(n.heading??3)+1),r=w(e.source,n);if(!r.ok)return{t:"list",as:e.as,failed:!0,members:[],headingLevel:t,more:0,problem:r.problem};let o=r.value,a=o instanceof j?o.nodes:o!==null&&typeof o=="object"&&!Array.isArray(o)?[o]:[];e.choiceOrder&&n.schema&&(a=Je(a,e.choiceOrder,n.schema));let d=a.length,l=a.slice(0,e.limit??V),i=l.slice(0,L),s=l.slice(L),f=(e.limit===void 0?d:l.length)-i.length,y=c=>e.group&&n.schema&&c.length>0?Xe(c,e.group,n.schema,n.graph):void 0,u=y(i),m=s.length>0?y(l):void 0;return{t:"list",as:e.as,failed:!1,members:i,...s.length>0?{rest:s}:{},...u?{groups:u}:{},...m?{everyGroup:m}:{},headingLevel:t,...i.length===0&&e.empty?{empty:e.empty}:{},more:f,total:d}}function D(e,n,t){let r=e.tryDefinition(n)?.fields?.shape,o=r&&Object.hasOwn(r,t)?I(r[t]):void 0;return o?.type==="enum"?o.options??[]:[]}var $=(e,n)=>Object.hasOwn(e,n)?e[n]:void 0;function Je(e,n,t){let r=o=>{let a=D(t,o.kind,n).indexOf(String($(o,n)));return a<0?Number.MAX_SAFE_INTEGER:a};return e.map((o,a)=>({node:o,i:a,rank:r(o)})).sort((o,a)=>o.rank-a.rank||o.i-a.i).map(o=>o.node)}function Xe(e,n,t,r){let o=e.some(i=>D(t,i.kind,n.by).length>0)?void 0:ue(n.by);if(o&&r)return Ze(e,o,n.headings,t,r);let a=[];for(let i of e)for(let s of D(t,i.kind,n.by))a.includes(s)||a.push(s);let d=[];for(let i of a){let s=e.filter(y=>$(y,n.by)===i);if(s.length===0)continue;let f=t.tryDefinition(s[0].kind);d.push({value:i,heading:n.headings[i]??J(x(f,n.by,i)),members:s})}let l=e.filter(i=>!a.includes(String($(i,n.by))));return l.length>0&&d.push({value:null,members:l}),d}function Ze(e,n,t,r,o){let a=u=>n.way??(Object.hasOwn(r.tryDefinition(u.kind)?.edges??{},n.edge)?"out":"in"),d=new Map,l=[],i=P(r),s;for(let u of e){let m=a(u)==="out"?o.out(u.id,n.edge):o.in(u.id,n.edge);m.length===0&&l.push(u);for(let c of m){s??=c.kind;let R=d.get(c.id)??{node:c,members:[]};R.members.push(u),d.set(c.id,R)}}let f=[...d.values()].map(({node:u,members:m})=>({value:u.id,heading:t[u.id]??i(u),members:m})).sort((u,m)=>u.heading.localeCompare(m.heading,void 0,{numeric:!0}));!s&&e[0]&&a(e[0])==="out"&&(s=(r.tryDefinition(e[0].kind)?.edges??{})[n.edge]?.to?.[0]);let y=s&&s!=="*"?Z(r.tryDefinition(s),s):void 0;return l.length>0&&f.push({value:null,...y?{heading:`No ${y}`}:{},members:l}),f}function je(e){return e.t==="list"||e.t==="headline"||e.t==="number"||e.t==="image"&&e.as==="gallery"?!0:e.t==="group"?e.blocks.some(je):e.t==="when"?e.show.some(je):!1}function Ee(e,n){let t=e.tryDefinition(n)?.fields?.shape??{},r={};for(let[o,a]of Object.entries(t)){let d=I(a);d&&(r[o]=d)}return r}var Be=new WeakMap;function U(e){let n=Be.get(e);return n||Be.set(e,n=ye(e)),n}function ze(e,n,t,r={}){let o=U(e),a={},d={},l=i=>{if(i instanceof j)return i.nodes.map(s=>l(s));if(Array.isArray(i))return i.map(s=>l(s));if(i!==null&&typeof i=="object"){let s=i;return{id:s.id,kind:s.kind,label:X(e.tryDefinition(s.kind),s)}}return i};for(let[i,s]of o.get(t?t.kind:ne)?.computed??[])try{let f=[],y=E(s,{graph:n,subject:t,kinds:o,...r.today?{today:r.today}:{},...r.budget?{budget:r.budget}:{},...r.linked?{linked:r.linked}:{},onUnread:u=>f.push(u)});f.length>0&&(y===null||y instanceof j&&y.nodes.length===0)?d[i]=ee(f[0]):a[i]=l(y)}catch(f){if(!(f instanceof re))throw f;d[i]=f.sentence}return{values:a,refused:d}}function Pn(e,n,t){let{values:r}=ze(e,n,t);if(Object.keys(r).length===0)return t;let o=a=>Array.isArray(a)?a.map(o):a!==null&&typeof a=="object"?a.label:a;return{...t,...Object.fromEntries(Object.entries(r).map(([a,d])=>[a,o(d)]))}}function vn(e,n){return[...fe(e.tryDefinition(n)).keys()]}var Ye=500,qe=2e4,Pe=new WeakMap;function Qe(e,n){let t=Pe.get(e);t||Pe.set(e,t=new Map);let r=t.get(n);return r||t.set(n,r=Ee(e,n)),r}function Vn(e,n,t,r={}){if(n&&typeof e.seenBy!="function")throw new TypeError("blockContextFor: a seat is read from a store (its `seenBy`); a bare { graph, schema } is read as it is handed, with no principal");let o=n?e.seenBy(n):e,a=n&&t?o.graph.getNode(t.id)??null:t,d=o.schema,l=a&&d.tryDefinition(a.kind),i=!a||(r.slot??"page")==="page",{money:s,firstHeading:f}=r;return{node:a,graph:o.graph,schema:d,kinds:U(d),fields:a?Qe(d,a.kind):{},definition:l||void 0,today:r.today??o.today?.()??H(s?.timeZone),money:s,heading:r.heading??(i?2:3),firstHeading:f,budget:r.budget??(i?qe:Ye),...i?{}:{glance:!0}}}export{we as a,tn as b,ve as c,on as d,Se as e,Ae as f,Oe as g,jn as h,je as i,U as j,ze as k,Pn as l,vn as m,Vn as n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as U,b as Y,c as G,d as D}from"./chunk.
|
|
1
|
+
import{a as U,b as Y,c as G,d as D}from"./chunk.RPDH32XV.js";import"./chunk.AI34V6WV.js";import"./chunk.G4ULQK64.js";import{G as ae,O as L,P as F,T as V,ca as _}from"./chunk.M7RESZB6.js";import"./chunk.SDO3U72B.js";import{W as H,ab as K,bb as B,id as M}from"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";function O(n,t){let r=K(n);return r==="agent"?"agent":r!=="human"&&r!=="visitor"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var re=n=>n.ops.filter(t=>t.withheld!==!0);function X(n,t={}){let r=[];for(let e of n.batches()){let s=e.ops[0],d=e.ops.at(-1),l=re(e).length===0,h=l?void 0:Y(e.ops),c=r.at(-1);if(h&&c?.typed&&c.author&&U(c.author,e.author)&&c.typed.node===h.node&&c.typed.field===h.field){let S=G(c.typed,h);r[r.length-1]={...c,seq:d.seq+1,at:d.at,batch:e.id,batches:[...c.batches??[],e.id],typed:S,said:D(S,n.schema,n.graph,!1)};continue}r.push({seq:d.seq+1,from:s.seq,at:d.at,batch:e.id,maker:l?"person":O(e.author,t.me),author:l?void 0:e.author,said:h?D(h,n.schema,n.graph,!1):e.intent,declaration:!1,withheld:l,...h?{batches:[e.id],typed:h}:{}})}let i=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of i){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let s=r.findIndex(d=>d.seq===e.seq);if(s>=0&&!r[s].withheld){r[s]={...r[s],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?O(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,s)=>e.seq-s.seq||+(e.batch!==void 0)-+(s.batch!==void 0))}function J(n,t){let r=n.log.all(),i=new Map(r.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(s=>s.undoes!==void 0&&(i.get(s.undoes)??-1)>=t)).map(e=>e.id)}function Q(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?B(n.author,t):"the app"}var p=R(ae(),1);var o=R(V(),1),oe={kind:"human"},ie=[1,2,4,8],se=900,E={you:"You",person:"A person",agent:"An agent",app:"The app"},Z={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function de(n,t,r){return[...new Set([...r,t,...n.map(i=>i.seq)])].sort((i,e)=>i-e)}function le(n,t){let r=n.withheld===!0;return{seq:n.seq+1,from:n.seq,at:n.at,batch:n.batch,maker:r?"person":O(n.author,t),author:r?void 0:n.author,said:n.batchIntent??n.intent,declaration:!1,withheld:r}}function ce(n,t){let r=0;for(let i=0;i<n.length;i++)n[i]<=t&&(r=i);return r}function pe(n,t,r){let i=J(n,t);if(i.length===0)return null;let e=n.canUndo(i);if(!e.ok)return null;let s=new Set(n.permittedMutations(r).map(d=>d.name));return e.ops.every(d=>d.mutation!==null&&s.has(d.mutation.name))?i:null}function we({face:n}){let t=L(),r=_(),i=r?.principal??oe,e=F(t.live,i),s=e.log.length,d=(0,p.useMemo)(()=>X(e,{me:i,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,i,t.host,s]),l=e.log.horizon,h=l>0&&t.host?.archived!==void 0,c=t.kept,S=(0,p.useMemo)(()=>h?c?.stops??Array.from({length:l},(a,g)=>g):[],[h,c,l]),m=(0,p.useMemo)(()=>de(d,l,S),[d,l,S]),f=t.archive,y=f?.seq??t.past?.seq??s,x=t.host?.kept&&(f?.behindKept||c!==void 0&&(y<=c.through||c.from>0&&y<=c.from))?t.host.kept:void 0,w=ce(m,y),b=m.length-1,j=y<l&&t.past?.seq===y?t.past.store.log.all().at(-1):void 0,q=j?le(j,i):y<l?void 0:[...d].reverse().find(a=>a.seq<=y&&a.seq>(m[w-1]??-1))??[...d].reverse().find(a=>a.seq<=y),[k,A]=(0,p.useState)(!1),[T,ee]=(0,p.useState)(1),[C,W]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(!k)return;if(w>=b){A(!1);return}let a=setTimeout(()=>t.show(m[w+1]),se/T);return()=>clearTimeout(a)},[k,w,b,T,m,t]);let z=(0,p.useMemo)(()=>t.past&&!f&&y>=l?pe(e,y,i):null,[t.past,f,e,y,l,i,s]),N=a=>Q(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),v=t.past?t.past.at?H(t.past.at,r?.locale):"the start":null,$=f?f.refused?"The archive could not be read":f.behindKept?"Nothing this far back is kept":"Reading the older changes from the archive\u2026":q?`${N(q)==="you"?"You":N(q)}: ${q.said}`:"Nothing had happened yet",I=(0,p.useRef)(null);(0,p.useLayoutEffect)(()=>{let a=I.current,g=a?.parentElement;if(n!=="scene"||!a||!g)return;let u=()=>g.style.setProperty("--graview-sheet",`${Math.ceil(a.getBoundingClientRect().height)+24}px`);u();let P=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return P?.observe(a),()=>{P?.disconnect(),g.style.removeProperty("--graview-sheet")}},[n]);let te=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:M("rail")}:{position:"sticky",top:0,zIndex:M("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,o.jsxs)("section",{ref:I,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...te,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,o.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:f?"Archived changes":v?`As of ${v}`:"Now"}),(0,o.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:$}),v?(0,o.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,o.jsxs)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:[h?(0,o.jsx)("span",{"data-testid":"timeline-archived",title:"Changes read from the archive as you scrub back",style:{position:"absolute",left:0,bottom:0,height:6,width:`${b===0?0:m.indexOf(l)/b*100}%`,borderRadius:2,background:"var(--graview-edge)"}}):null,m.slice(1).map((a,g)=>{let u=[...d].reverse().find(ne=>ne.seq===a);if(!u)return null;let P=b===0?0:(g+1)/b*100;return(0,o.jsx)("span",{"data-graview-tick":a,"data-maker":u.maker,...u.declaration?{"data-declaration":""}:{},title:`${E[u.maker]}: ${u.said}`,style:{position:"absolute",left:`calc(${P}% - 1px)`,bottom:0,width:u.declaration?4:2,height:u.declaration?22:12,borderRadius:2,background:u.declaration?"var(--graview-ink)":Z[u.maker],opacity:a<=y?1:.45}},`${a}:${u.batch??"declaration"}`)})]}),(0,o.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:b,step:1,value:w,"aria-valuetext":v?`As of ${v}. ${$}`:`Now. ${$}`,onChange:a=>{A(!1),t.show(m[Number(a.currentTarget.value)]??s)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,o.jsx)("button",{type:"button","data-testid":"play","aria-pressed":k,onClick:()=>{!k&&w>=b&&t.show(m[0]),A(!k)},style:{minHeight:28,minWidth:64},children:k?"Pause":"Play"}),(0,o.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,o.jsx)("select",{"data-testid":"speed",value:T,onChange:a=>ee(Number(a.currentTarget.value)),style:{minHeight:28},children:ie.map(a=>(0,o.jsxs)("option",{value:a,children:[a,"\xD7"]},a))})]}),(0,o.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(E).filter(a=>d.some(g=>g.maker===a)).map(a=>(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:Z[a]}}),E[a]]},a))}),(0,o.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[z?(0,o.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{W(null);try{e.undo([...z],{author:i,intent:v?`Restore to ${v}`:"Restore"}),t.show(null)}catch(a){W(a instanceof Error?a.message:String(a))}},style:{minHeight:28},children:"Restore to here"}):null,(0,o.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),C?(0,o.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:C}):null,f?.refused?(0,o.jsx)("span",{role:"alert","data-testid":"archive-refused",style:{color:"var(--graview-warn)"},children:f.refused}):null,x?(0,o.jsxs)("span",{"data-testid":"timeline-kept",style:{color:"var(--graview-ink-faint)"},children:[x.sentence,x.action?(0,o.jsxs)(o.Fragment,{children:[" ",(0,o.jsx)("a",{"data-testid":"timeline-kept-action",href:x.action.href,style:{color:"var(--graview-ink-muted)"},children:x.action.label})]}):null]}):null,l>0&&!h?(0,o.jsx)("span",{"data-testid":"timeline-horizon",style:{color:"var(--graview-ink-faint)"},children:"The changes before the timeline's start were archived."}):null]})}export{we as Timeline};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as I,c as x}from"./chunk.
|
|
1
|
+
import{a as I,c as x}from"./chunk.3FON2Y72.js";import"./chunk.AI34V6WV.js";import"./chunk.G4ULQK64.js";import{b,c as A,j as v,q as w,s as O,v as G}from"./chunk.M7RESZB6.js";import"./chunk.SDO3U72B.js";import{Ld as k,ae as E,he as S,ie as W}from"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var F=(e,i)=>k(e,i).slice(1);function j(e,i){let l=e.split("/").filter(Boolean);return l.length===i.length&&l.every((s,h)=>s.startsWith(":")||s==="*"||s===i[h])}var $=["problems","search","map","places"];function R(e,i,l,s,h=[]){let{schema:r}=i,o=r.kinds,f=t=>{if(t.startsWith(w))return(t.slice(w.length).split("|")[0]??"").split("+").every(V=>o.includes(V));let y=O(t);return y!==null?o.includes(y):t.startsWith("edge:")||l.graph.getNode(t)!==void 0},[p="/",u]=e.path.split("?"),n=p.split("/").filter(Boolean),m=u?`?${u}`:"",d=n.length>0&&!$.includes(n[0])?o.find(t=>F(r,t)===n[0]):void 0,c=e.path;if(n[0]==="places"&&n.length===2)`/places/${n[1]}`!==E&&!s.some(t=>t.as===decodeURIComponent(n[1]))&&(c="/");else if(d){let t=n[1]===void 0?void 0:decodeURIComponent(n[1]);c=`/${F(r,d)}${t!==void 0&&l.graph.getNode(t)?.kind===d?`/${n[1]}`:""}${m}`}else n.length>0&&n.length<=2&&!$.includes(n[0])&&!h.some(t=>j(t.path,n))&&(c="/");let g=A(e.stop),P=g.within?.view,U=P!==void 0&&!s.some(t=>t.as===P),a=g;if(U){let{view:t,...y}=g.within??{};a={...a,within:y}}if(g.focusId&&!f(g.focusId)){let t=e.kind&&o.includes(e.kind)?G(e.kind):null;a={...v(a,t),zoom:!1}}return a={...a,relation:a.relation&&(o.includes(a.relation)||r.edgeKinds.includes(a.relation))?a.relation:null,expanded:a.expanded.filter(f),pins:Object.fromEntries(Object.entries(a.pins).filter(([t])=>f(t))),...a.selection?{selection:a.selection.filter(f)}:{}},{face:e.face,path:c,stop:b(a),...e.kind?{kind:e.kind}:{}}}function B(e,i,l){let s=e.at,h=e.pages?.routes()??[];if(e.routing!=="address"||typeof window>"u")return R(s,e.app,i,l,h);let{pathname:r,search:o,hash:f}=window.location,p=W(r,e.basePath),u=I({routing:"address",...e.basePath===void 0?{}:{basePath:e.basePath},face:s.face}),n=u==="pages",m={...s,face:u,...p===null?{}:n?{path:p+o}:{stop:x(e.basePath)??s.stop}},d=R(m,e.app,i,l,h),c=n?d.path===m.path?null:S(d.path,e.basePath===void 0?{}:{basePath:e.basePath}):d.stop===b(A(m.stop))?null:r+o+d.stop;return p!==null&&c!==null&&c!==r+o+f&&window.history.replaceState(window.history.state,"",c),d}export{R as settle,B as settleAt};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{d as C,e as re}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{d as C,e as re}from"./chunk.NAD7ZXYP.js";import{e as ee}from"./chunk.2GEJNG2U.js";import{b as S}from"./chunk.ACTXR2MI.js";import{j as X}from"./chunk.AI34V6WV.js";import{G as se,Ia as V,Ra as J,T as Z,Va as Q}from"./chunk.M7RESZB6.js";import{a as K}from"./chunk.SDO3U72B.js";import{T as Y,Z as M,ja as U}from"./chunk.DZZL5IDD.js";import{b as D}from"./chunk.AJZBJBMO.js";var h=D(se(),1);var n=D(Z(),1),Re=9,le=40,ge=2;function de(e){let r=new Map;for(let i of e.allNodes())r.set(i.kind,(r.get(i.kind)??0)+1);return r}var ue=(e,r)=>(e.far??[]).reduce((i,a)=>i+(r.get(a)??0),0);function ce(e,r,i){if(i)return i.flatMap(s=>e.filters.filter(u=>u.key===s));let a=de(r),o=new Set(e.filters.filter(s=>s.about==="edge"&&ue(s,a)>le).map(s=>s.key));return e.filters.filter(s=>s.about==="edge"?!o.has(s.key):s.about==="via"?o.has(s.key.split(".")[0]):!0)}function pe(e,r){let i=e.filter(a=>a.about==="field"&&a.type==="choice"&&(a.options?.length??0)>0);return r?i:i.slice(0,ge)}var fe=520;function ye(e,r,i,a){let o=i.filters.find(s=>s.key===a.key);if(!o)return`${a.key}: ${a.value}`;if(o.about==="is")return a.value.charAt(0).toUpperCase()+a.value.slice(1);if(o.about==="via")return`${o.label}: ${S(e.tryDefinition(o.far?.[0]??""),o.key.split(".")[1],a.value)}`;if(o.about==="edge"){if(a.value==="*")return`${o.label}: anything`;if(a.value==="none")return`${o.label}: nothing`;let s=r.getNode(a.value);return`${o.label}: ${s?U(e.tryDefinition(s.kind),s):a.value}`}if(o.type==="date"){let[s,u]=a.value.split(":");return`${o.label} ${s} ${u?Y(u):""}`.trim()}if(o.type==="boolean")return`${o.label}: ${a.value==="true"?"yes":"no"}`;if(o.type==="number"){let s=a.value.lastIndexOf(":"),u=a.value.slice(0,Math.max(0,s));if(u==="at-most"||u==="at-least")return`${o.label}: ${u==="at-most"?"at most":"at least"} ${S(e.tryDefinition(i.kind),o.key,Number(a.value.slice(s+1)))}`}return o.type==="text"?`${o.label}: ${a.value}`:`${o.label}: ${S(e.tryDefinition(i.kind),o.key,a.value)}`}var P=e=>/^[A-Z][a-z]/.test(e)?e.charAt(0).toLowerCase()+e.slice(1):e;function me(e){return e?.type==="date"?{asc:"Earliest first",desc:"Latest first"}:e?.type==="number"?{asc:"Lowest first",desc:"Highest first"}:e?.type==="boolean"?{asc:"No first",desc:"Yes first"}:e?.type==="choice"?{asc:"In their order",desc:"In reverse order"}:{asc:"A to Z",desc:"Z to A"}}var x=V(K(()=>(__graviewPreload(import.meta.url,["./chunk.SWMDFXUX.js","./chunk.A3ZC2JBO.js","./chunk.NAD7ZXYP.js","./chunk.2GEJNG2U.js","./chunk.NUYA4BWI.js","./chunk.OKZT2QBM.js","./chunk.ACTXR2MI.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.WEOVK2T4.js")))),N=x.part((e,r)=>(0,n.jsx)(e.ArrangeLists,{...r}),{what:"This list",quiet:!0}),he=x.part((e,r)=>(0,n.jsx)(e.ArrangeChips,{...r}),{what:"This list",quiet:!0}),Oe=()=>x.load(),q=new Map;function Te(e){let{schema:r,graph:i,kind:a,arrangement:o,onChange:s}=e,u=e.offers??ee(r,a),g=e.testId??"arrange",y=C(e.allow,"sort")&&u.sorts.length>1,m=C(e.allow,"group")&&u.groups.length>0,F=C(e.allow,"filter")?ce(u,i,e.filters):[],L=e.chips?pe(F,e.filters):[],H=F.filter(t=>!L.includes(t)),G=H.length>0,_=e.query!==!1&&e.allow!==!1,w=we(e.noun,e.kept),v=e.past&&e.past.count>0?e.past:null;if(!y&&!m&&!G&&!_&&!w&&!v)return null;let z=t=>JSON.stringify(re(t)),R=`${g}|${a}`,p={current:q.get(R)??{words:new Set,latest:null,at:0}};q.set(R,p.current),p.current.latest&&Date.now()-p.current.at>1500&&!p.current.words.has(z(o))&&(p.current={words:new Set,latest:null,at:0},q.set(R,p.current));let d=p.current.latest??o,b=t=>{let l={...p.current.latest??o,...t};for(let c of Object.keys(l))l[c]===void 0&&delete l[c];p.current.latest=l,p.current.at=Date.now(),p.current.words.add(z(l)),s(l)},f=d.filter??[],O=t=>{let l=f.filter((c,I)=>I!==t);b({filter:l.length>0?l:void 0})},A=t=>f.some(l=>l.key===t.key&&l.value===t.value),te=t=>A(t)?O(f.findIndex(l=>l.key===t.key&&l.value===t.value)):b({filter:[...f,t]}),T=d.sort?u.sorts.find(t=>t.key===d.sort.by):void 0,j=d.group?u.groups.find(t=>t.key===d.group.by):void 0,ne=me(T),k={schema:r,graph:i,offers:{...u,filters:H},arrangement:d,set:b,toggle:te,has:A,testId:g},ae=(t,l)=>A({key:t,value:l})?O(f.findIndex(c=>c.key===t&&c.value===l)):b({filter:[...f.filter(c=>c.key!==t),{key:t,value:l}]}),oe=d.sort?(0,n.jsxs)(n.Fragment,{children:["Sorted by ",P(T?.label??d.sort.by),(0,n.jsx)("span",{"aria-hidden":"true",children:d.sort.direction==="desc"?" \u2193":" \u2191"})]}):"Sort",ie=d.group?.bucket&&j?.buckets?`, a ${d.group.bucket} each`:"",B=d.group?`Grouped by ${P(j?.label??d.group.by)}${ie}`:"Group";return(0,n.jsxs)("div",{"data-testid":`${g}-bar`,role:"group","aria-label":"Arrange",className:"graview-arrange",style:e.style,onPointerEnter:x.prefetch,onFocus:x.prefetch,children:[(0,n.jsx)("style",{children:xe}),(0,n.jsxs)("div",{className:"graview-arrange-line",children:[w?(0,n.jsxs)("span",{className:"graview-arrange-count","data-testid":`${g}-count`,children:[w.kept?(0,n.jsx)("span",{"data-testid":`${g}-kept`,children:w.kept}):null,w.words]}):null,v?(0,n.jsxs)("button",{type:"button",className:"graview-arrange-open","data-testid":`${g}-past`,title:`${M(v.count)} more behind the horizon \u2014 press to widen the view to the past`,onClick:t=>{let l=t.currentTarget.closest("[data-graview-view]"),c=t.currentTarget;v.widen();let I=0,W=()=>{if(document.activeElement!==c&&document.activeElement!==document.body&&c.isConnected)return;let $=l?.querySelector('[role="group"][aria-label="Arrange"] :is(button, input)');if($&&$!==c&&$.isConnected)return $.focus({preventScroll:!0});++I<120&&requestAnimationFrame(W)};requestAnimationFrame(W)},children:["+",M(v.count)," past"]}):null,f.map((t,l)=>{let c=ye(r,i,u,t);return(0,n.jsxs)("span",{className:"graview-arrange-token","data-testid":`${g}-condition`,children:[c,(0,n.jsx)("button",{type:"button","aria-label":`Remove: ${c}`,title:"Remove",onClick:()=>O(l),children:"\xD7"})]},`${t.key}:${t.value}`)}),y?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,n.jsx)(E,{testId:`${g}-sort`,value:d.sort?.by??"",set:d.sort!==void 0,label:"Sort",name:d.sort?`Sorted by ${P(T?.label??d.sort.by)}, ${ne[d.sort.direction].toLowerCase()}`:"Sort",list:t=>(0,n.jsx)(N,{which:"sort",done:t,...k}),children:oe})}):null,m?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-one",children:(0,n.jsx)(E,{testId:`${g}-group`,value:d.group?.by??"",set:d.group!==void 0,label:"Group",name:B,list:t=>(0,n.jsx)(N,{which:"group",done:t,...k}),children:B})}):null,G?(0,n.jsx)("span",{className:"graview-arrange-part",children:(0,n.jsx)(E,{testId:`${g}-add`,value:"",set:!1,label:"Filter",name:f.length>0?`Filter \u2014 ${f.length} on`:"Filter",list:t=>(0,n.jsx)(N,{which:"filter",done:t,...k}),children:"Filter"})}):null,y||m?(0,n.jsx)("span",{className:"graview-arrange-part graview-arrange-all",children:(0,n.jsx)(E,{testId:`${g}-all`,value:"",set:!1,label:"Arrange",name:"Arrange: sort and group",list:t=>(0,n.jsx)(N,{which:"all",done:t,parts:{sort:y,group:m,filter:!1},...k}),children:"Arrange"})}):null,_?(0,n.jsxs)("label",{className:"graview-arrange-words-at",children:[(0,n.jsx)("span",{style:X,children:"Find"}),(0,n.jsx)("input",{type:"search",className:"graview-arrange-words","data-testid":`${g}-query`,value:d.query??"",placeholder:"Find\u2026",onChange:t=>b({query:t.target.value.length>0?t.target.value:void 0})})]}):null,L.length>0&&e.chips?(0,n.jsx)(h.Suspense,{fallback:null,children:(0,n.jsx)(he,{offers:L,chips:e.chips,schema:r,graph:i,kind:a,arrangement:d,has:A,choose:ae,testId:g})}):null,e.end]})]})}function we(e,r){if(!r)return null;let i=r.shown!==r.of;if(!e)return i?{words:"",kept:`${r.shown} of ${r.of}`}:null;let a=r.of===1?e.one:e.many;return i?{words:` ${a}`,kept:`${r.shown} of ${r.of}`}:{words:`${r.of} ${a}`}}function E({testId:e,value:r,set:i,label:a,name:o,list:s,children:u}){let g=Q("arrange",{align:"start"}),y=(0,h.useRef)(null);return(0,h.useEffect)(()=>{g.open&&y.current?.querySelector('[aria-pressed="true"]')?.focus({preventScroll:!0})},[g.open]),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("button",{type:"button",className:"graview-arrange-open","data-testid":e,"data-set":i?"":void 0,value:r,"aria-label":o,...g.trigger,onClick:g.toggle,children:[u,(0,n.jsx)(be,{})]}),g.open?(0,n.jsx)("div",{...g.pane,ref:m=>{g.pane.ref(m),y.current=m},role:"group","aria-label":a,"data-testid":"arrange-list","data-arrange":e,className:"graview-arrange-list",style:J,onKeyDown:ve,children:s(()=>g.setOpen(!1))}):null]})}function ve(e){if(!["ArrowDown","ArrowUp","Home","End"].includes(e.key))return;let r=[...e.currentTarget.querySelectorAll("button:not([disabled]), input")];if(r.length===0)return;let i=r.indexOf(document.activeElement);if(document.activeElement instanceof HTMLInputElement&&document.activeElement.type==="date"&&(e.key==="ArrowUp"||e.key==="ArrowDown"))return;e.preventDefault();let a=e.key==="Home"?0:e.key==="End"?r.length-1:e.key==="ArrowDown"?(i+1)%r.length:(i-1+r.length)%r.length;r[a].focus()}function be(){return(0,n.jsx)("svg",{width:"9",height:"9",viewBox:"0 0 10 10","aria-hidden":"true",focusable:"false",style:{flex:"0 0 auto",opacity:.7},children:(0,n.jsx)("path",{d:"M2 3.5 L5 6.5 L8 3.5",fill:"none",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})})}var xe=`
|
|
2
2
|
.graview-arrange{container-type:inline-size;box-sizing:border-box;width:100%;min-width:0;max-width:100%}
|
|
3
3
|
.graview-arrange-line{display:flex;flex-wrap:wrap;align-items:center;gap:2px 6px;min-width:0;font-size:.875rem;line-height:1.35;color:var(--graview-ink-muted)}
|
|
4
4
|
.graview-arrange-count{margin-right:2px;color:var(--graview-ink-muted)}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n,m as o,n as p}from"./chunk.
|
|
1
|
+
import{a as c,b as d,c as e,d as f,e as g,f as h,g as i,h as j,i as k,j as l,k as m,l as n,m as o,n as p}from"./chunk.SWMDFXUX.js";import{a,b}from"./chunk.A3ZC2JBO.js";import"./chunk.NAD7ZXYP.js";import"./chunk.2GEJNG2U.js";import"./chunk.NUYA4BWI.js";import"./chunk.OKZT2QBM.js";import"./chunk.ACTXR2MI.js";import"./chunk.AI34V6WV.js";import"./chunk.G4ULQK64.js";import"./chunk.M7RESZB6.js";import"./chunk.SDO3U72B.js";import"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{j as ARRANGE_NARROW,o as ArrangeBar,e as CHIP_FIELDS,d as MANY_AT_THE_FAR_END,c as TYPED_FROM,p as arrangementCaption,a as arrangementOf,i as chipOffers,m as directionWords,g as farCount,f as farCounts,l as inSentence,h as offeredFilters,n as preloadArrangeLists,k as sayCondition,b as withArrangement};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var s=new Set(["tell","me","about","what","how","show","describe","the","a","an","and","please"]),r=new Set([...s,"where","is","are","was","find","any","anything","something","things","called","named","which","who","of","for","with","to","in","on","i","my","do","does","have","has","can","you","it","that","this","there","we","our","got","be"]);function a(t){return t.flatMap(n=>{let e=n.repairs.find(o=>!o.missing?.length);return e?[{mutation:e.mutation,args:{...e.args},why:n.message}]:[]})}var i="(?:january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|jun|jul|aug|sept|sep|oct|nov|dec)";var d=new RegExp(`(?<![\\w\\-/])(${i}\\.? (?:1\\d|20)\\d{2}|(?:1\\d|20)\\d{2}-(?:0[1-9]|1[0-2])|(?:0?[1-9]|1[0-2])/(?:1\\d|20)\\d{2})(?![\\w\\-/:])`);export{a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as f}from"./chunk.
|
|
1
|
+
import{a as f}from"./chunk.Y2YYH3JN.js";import{ja as d}from"./chunk.DZZL5IDD.js";function S(e){let o=e.indexOf("{"),a=e.indexOf("["),t=a!==-1&&(o===-1||a<o)?a:o;if(t===-1)return;let n=e[t],r=n==="["?"]":"}",i=0,u=!1,l=!1;for(let s=t;s<e.length;s++){let c=e[s];if(u){l?l=!1:c==="\\"?l=!0:c==='"'&&(u=!1);continue}if(c==='"')u=!0;else if(c===n)i+=1;else if(c===r&&(i-=1,i===0))try{return JSON.parse(e.slice(t,s+1))}catch{return}}}function w(e,o){let a;try{a=e.mutation(o.mutation)}catch{return o}let t={...o.args},n=!1;for(let r of f(a.input)){if(r.control!=="node")continue;let i=t[r.name];if(typeof i!="string"||i.length===0||e.graph.getNode(i))continue;let u=i.trim().toLowerCase(),l=[...e.graph.allNodes()].filter(s=>(r.kinds.includes("*")||r.kinds.includes(s.kind))&&d(e.schema.tryDefinition(s.kind),s).trim().toLowerCase()===u);l.length===1&&(t[r.name]=l[0].id,n=!0)}return n?{...o,args:t}:o}function x(e,o,a){let t=a===void 0?null:new Set(a),n=[];for(let r of o){if(typeof r.mutation!="string")continue;let i=!0;try{e.mutation(r.mutation)}catch{i=!1}i?t&&!t.has(r.mutation)&&n.push({proposal:r,why:"not-allowed"}):n.push({proposal:r,why:"unknown"})}return n}function v(e,o,a){let t=a===void 0?null:new Set(a);return o.filter(n=>{if(typeof n.mutation!="string"||t&&!t.has(n.mutation))return!1;try{e.mutation(n.mutation)}catch{return!1}return n.args!==null&&typeof n.args=="object"})}export{S as a,w as b,x as c,v as d};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import"./chunk.
|
|
1
|
+
import"./chunk.RMR24LFJ.js";import{a as _,b as ge,c as me,e as fe}from"./chunk.RD2X25XB.js";import"./chunk.KMV6PJFL.js";import"./chunk.NAD7ZXYP.js";import"./chunk.2GEJNG2U.js";import"./chunk.HJCQ6I3S.js";import{a as ve,d as ye}from"./chunk.22BZU7ME.js";import"./chunk.2N4Z5K5S.js";import{a as de}from"./chunk.AJSUHPBE.js";import{d as he}from"./chunk.LAYQ5PFS.js";import"./chunk.KDXU5DT3.js";import"./chunk.O2BHPYA4.js";import"./chunk.M4AYA2PL.js";import"./chunk.H5S7OL2U.js";import"./chunk.PZQNR4KZ.js";import"./chunk.W4BKYSZX.js";import"./chunk.NOGGSLVG.js";import"./chunk.WVUJXDXZ.js";import"./chunk.SGCW2XRC.js";import"./chunk.ZN3PUM2I.js";import"./chunk.QIPASE42.js";import"./chunk.EVBCEEQ4.js";import"./chunk.OWT3VVOT.js";import"./chunk.NHTGAP3G.js";import"./chunk.GZHZLJBF.js";import{o as ue,r as K}from"./chunk.UKQUUPKE.js";import"./chunk.OJGHDWI6.js";import{a as ce}from"./chunk.DDUCIUVW.js";import"./chunk.NUYA4BWI.js";import"./chunk.OKZT2QBM.js";import{c as le}from"./chunk.ACTXR2MI.js";import{q as pe}from"./chunk.AI34V6WV.js";import"./chunk.G4ULQK64.js";import{G as xe,K as I,Na as se,Oa as W,T as re,W as ie,ba as T,da as R,j as M,l as ne,m as B,oa as G,r as P,v as ae,z as oe}from"./chunk.M7RESZB6.js";import"./chunk.SDO3U72B.js";import{Z as D,ia as $,id as te,ja as F,la as q,na as L,ra as ee}from"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import{b as V}from"./chunk.AJZBJBMO.js";var l=V(xe(),1);var e=V(re(),1),Se=pe.part((t,u)=>(0,e.jsx)(t.ProblemRows,{...u}),{what:"The problems",as:"li"}),A="var(--graview-gap, 8px)",ke=720;function Fe({showing:t}){return t.what==="lens"?(0,e.jsx)(Ae,{kind:t.kind},`lens:${t.kind}`):t.what==="record"?(0,e.jsx)(Pe,{id:t.id},`record:${t.id}`):(0,e.jsx)(Ne,{kind:t.kind},`district:${t.kind}`)}function Y({label:t,wide:u,testId:a,head:o,onClose:s,children:d,sheetHeight:p}){let i=(0,l.useRef)(null),[h,m]=(0,l.useState)(!1);(0,l.useLayoutEffect)(()=>{let r=i.current?.parentElement;if(!r)return;let f=()=>m(r.getBoundingClientRect().width<ke);if(f(),typeof ResizeObserver>"u")return;let x=new ResizeObserver(f);return x.observe(r),()=>x.disconnect()},[]);let v=(0,l.useRef)(s);return v.current=s,(0,l.useEffect)(()=>{let r=k=>{if(k.key!=="Escape"||k.defaultPrevented)return;let y=document.activeElement;y instanceof HTMLInputElement||y instanceof HTMLTextAreaElement||document.querySelector("[data-graview-popover]:popover-open")||f||v.current()},f=!1,x=()=>{f=document.querySelector('[data-testid="following-who"]')!==null};return window.addEventListener("keydown",x,!0),document.addEventListener("keydown",r),()=>{window.removeEventListener("keydown",x,!0),document.removeEventListener("keydown",r)}},[]),(0,e.jsxs)("section",{ref:i,"aria-label":t,"data-testid":a,"data-graview-map-panel":h?"sheet":"dock","data-graview-overlay":"","data-graview-offstage":"",className:"graview-map-panel",style:{position:"absolute",zIndex:te("rail"),boxSizing:"border-box",display:"flex",flexDirection:"column",background:"var(--graview-panel)",color:"var(--graview-ink)",overflow:"hidden",border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",boxShadow:"var(--graview-lift-high)",...h?{left:A,right:A,bottom:`calc(${A} + env(safe-area-inset-bottom, 0px))`,height:p}:{top:A,right:A,bottom:A,width:u}},children:[h?(0,e.jsx)("style",{children:`:has(> [data-graview-map-panel="sheet"]) { --graview-sheet: calc(${p} + 2 * ${A} + env(safe-area-inset-bottom, 0px)); }`}):(0,e.jsx)("style",{children:`:has(> [data-graview-map-panel="dock"]) { --graview-dock: calc(${u} + 2 * ${A}); }`}),(0,e.jsxs)("header",{style:{display:"flex",alignItems:"flex-start",gap:10,padding:"14px 14px 10px 18px",borderBottom:"1px solid var(--graview-edge)"},children:[(0,e.jsx)("div",{style:{flex:"1 1 auto",minWidth:0},children:o}),(0,e.jsx)("button",{type:"button","data-testid":"map-panel-close","aria-label":"Close",title:"Close (Escape)",onClick:s,style:{flex:"0 0 auto",minWidth:32,height:32,borderRadius:8,fontSize:"1.1rem",lineHeight:1},children:"\xD7"})]}),(0,e.jsx)("div",{style:{flex:"1 1 auto",minHeight:0,overflow:"auto"},children:d})]})}var U={fontSize:"0.75rem",letterSpacing:"0.09em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},J={margin:"2px 0 0",fontSize:"1.125rem",fontWeight:600,lineHeight:1.3,overflowWrap:"anywhere"},Q={margin:"4px 0 0",fontSize:"0.875rem",color:"var(--graview-ink-muted)"},j={margin:"14px 18px 6px",fontSize:"0.8125rem",fontWeight:600,color:"var(--graview-ink-muted)"},z={listStyle:"none",margin:0,padding:"0 10px 6px"},X={all:"unset",outline:"revert-layer",boxSizing:"border-box",display:"flex",alignItems:"baseline",gap:8,width:"100%",padding:"6px 8px",borderRadius:6,cursor:"pointer",fontSize:"0.875rem"},H={minHeight:30,padding:"0 12px",borderRadius:8,fontSize:"0.8125rem"};function Z(){let{setSelection:t,setMenuAt:u}=T();return(a,o)=>{a.preventDefault(),t([o]),u({x:a.clientX,y:a.clientY,on:o})}}function we({on:t,about:u}){let{setSelection:a,setMenuAt:o}=T();return(0,e.jsx)("button",{type:"button","data-testid":"map-panel-acts","aria-label":`What can be done with ${u}`,"aria-haspopup":"menu",style:H,onClick:s=>{let d=s.currentTarget.getBoundingClientRect();a([t]),o({x:Math.round(d.left),y:Math.round(d.bottom+4),on:t})},children:"Acts\u2026"})}var be=(t,u)=>({...M(B(t,!1),u),relation:null});function Ee(t,u){let a=`[data-graview-stage] [data-graview-view="${CSS.escape(t)}"][tabindex]`,o=null;for(let i=u?.parentElement??null;i&&!o;i=i.parentElement)o=i.querySelector(".graview-ground");o??=document.querySelector(".graview-ground");let s=o!==null&&!o.hasAttribute("tabindex");o&&s&&(o.setAttribute("tabindex","-1"),o.addEventListener("focusout",i=>{i.target===o&&o.removeAttribute("tabindex")},{once:!0})),o?.focus({preventScroll:!0});let d=performance.now()+5e3,p=()=>{let i=document.activeElement;if(!(i===null||i===document.body||i===document.documentElement||i===u||i===o))return;let m=document.querySelector(a);if(m&&m.isConnected&&!m.closest("[inert]"))return m.focus({preventScroll:!0});performance.now()<d&&requestAnimationFrame(p)};requestAnimationFrame(p)}function Ae({kind:t}){let u=Z(),{store:a,views:o,view:s,selection:d,setSelection:p}=T(),{go:i}=W(),h=R(),m=s.within?.view,v=o.places().filter(w=>w.kind===t),r=(m!==void 0?v.find(w=>w.as===m):void 0)??v.at(-1),f=o.resolve(t,{cardinality:"many",fidelity:"full"},r?.as??m),x=f?.view,k=a.schema.tryDefinition(t),y=(0,l.useMemo)(()=>a.graph.nodesOfKind(t).filter(w=>s.past===!0||$(k,w)),[a,t,h,s.past,k]),E=f?.title??r?.title??L(a.schema,t),C=x!==void 0&&G(x),c=d.filter(w=>a.graph.getNode(w)!==void 0),g=ce();return(0,e.jsxs)(Y,{label:E,testId:"lens-panel",wide:"min(max(440px, 46%), 760px)",sheetHeight:"60%",onClose:()=>i(ne(M(s,null),"view",null)),head:C?null:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:U,children:L(a.schema,t)}),(0,e.jsx)("h2",{style:J,"data-testid":"lens-panel-title",children:E}),(0,e.jsxs)("p",{style:Q,children:[q(a.schema,t,y.length),k?.description?` \xB7 ${k.description}`:""]}),r?(0,e.jsx)("div",{style:{marginTop:10},children:(0,e.jsx)("button",{type:"button","data-testid":"lens-panel-open",style:H,title:`Open ${E} on its own`,onClick:()=>i(oe(s,t,r.as)),children:"Open \u2197"})}):null]}),children:[(0,e.jsx)("style",{children:`.graview-ground[data-graview-altitude] .graview-plot:not([data-graview-plot="${P(t)}"]) { opacity: 0.35; }
|
|
2
2
|
.graview-ground[data-graview-altitude] [data-graview-view^="kind:"]:not([data-graview-view="${P(t)}"]) { opacity: 0.4; }`}),(0,e.jsx)("div",{"data-graview-lens":r?.as??"",style:{padding:"8px 12px 16px",minHeight:"100%",boxSizing:"border-box",display:"grid",gridTemplateRows:"1fr",gridTemplateColumns:"minmax(0, 1fr)",alignItems:"start"},onClick:w=>{let n=I(w.target);if(!n||a.graph.getNode(n)===void 0)return;let b=w.target.closest("button, a, input, select, textarea, [contenteditable='true']");b&&!b.hasAttribute("data-graview-pick")||p([n])},onDoubleClick:w=>{let n=I(w.target);!n||a.graph.getNode(n)===void 0||i(be(s,n))},onContextMenu:w=>{let n=I(w.target);!n||a.graph.getNode(n)===void 0||u(w,n)},children:x?(0,e.jsx)(de.Provider,{value:E,children:(0,e.jsx)(ie,{mode:"fullscreen",children:(0,e.jsx)(K,{kind:t,...f?.title?{view:f.title}:{},children:(0,e.jsx)(x,{nodes:y,label:E,fidelity:"full",cardinality:"many",mode:"fullscreen",selected:!1,...c.length>0?{implicated:c}:{},...g.length>0?{flagged:g}:{}})})})}):null})]})}function Ce(t,u,a,o){let s=o(a),d=new Map;for(let p of u){let i=p.from===a;if(!i&&p.to!==a)continue;let h=i?p.to:p.from,m=o(h);if(m===void 0||s===void 0)continue;let v=`${p.kind}|${i?"out":"in"}|${m}`,r=d.get(v);if(r){r.others.includes(h)||r.others.push(h);continue}d.set(v,{key:v,edge:p.kind,words:le(t,i?s:m,p.kind,i?"out":"in"),kind:m,others:[h]})}return[...d.values()]}function Pe({id:t}){let u=Z(),{store:a,views:o,view:s,setSelection:d}=T(),{go:p}=W(),i=R(),h=a.graph.getNode(t),m=c=>a.graph.getNode(c)?.kind,v=(0,l.useMemo)(()=>Ce(a.schema,a.graph.allEdges(),t,m),[a,t,i]);if(!h)return null;let r=h.kind,f=c=>{let g=a.graph.getNode(c);return g?F(a.schema.tryDefinition(g.kind),g):c},x=ee(a.schema.tryDefinition(r),r),y=o.resolve(r,{cardinality:"one",fidelity:"full"})?.view,E=y!==void 0&&!G(y),C=()=>s.focusId===t?p({...M(s,null),selection:[]}):d([]);return(0,e.jsxs)(Y,{label:`${f(t)}: its links`,testId:"record-panel",wide:E?"min(max(440px, 46%), 760px)":"min(360px, 40%)",sheetHeight:"52%",onClose:C,head:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:U,children:x}),(0,e.jsx)("h2",{style:J,"data-testid":"record-panel-title",children:f(t)}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:10},children:[(0,e.jsx)("button",{type:"button","data-testid":"record-panel-go",style:H,onClick:c=>{p(be(s,t)),Ee(t,c.currentTarget)},children:"Go to it"}),(0,e.jsx)(we,{on:t,about:f(t)}),(0,e.jsxs)("button",{type:"button","data-testid":"record-panel-district",style:H,onClick:()=>d([P(r)]),children:["All ",L(a.schema,r).toLowerCase()]})]})]}),children:[(0,e.jsx)("div",{"data-graview-record-card":t,style:{padding:"8px 18px 0"},children:E?(0,e.jsx)(K,{kind:r,children:(0,e.jsx)(y,{node:h,fidelity:"full",cardinality:"one",mode:"fullscreen",selected:!1})}):(0,e.jsx)(he,{id:t,shown:[f(t)]})}),v.length===0?(0,e.jsx)("p",{style:{...Q,margin:"14px 18px"},children:"No links yet."}):null,v.map(c=>(0,e.jsxs)("section",{"aria-label":c.words,"data-graview-links":c.edge,children:[(0,e.jsxs)("h3",{style:j,children:[c.words.charAt(0).toUpperCase()+c.words.slice(1)," ",(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-faint)"},children:["\xB7 ",c.others.length]})]}),(0,e.jsx)("ul",{style:z,children:c.others.map(g=>(0,e.jsx)("li",{children:(0,e.jsxs)("button",{type:"button",className:"graview-map-panel-row","data-graview-record":g,style:X,onClick:()=>d([g]),onContextMenu:N=>u(N,g),children:[(0,e.jsx)("span",{style:{flex:"1 1 auto",minWidth:0,overflowWrap:"anywhere"},children:f(g)}),c.kind!==r?null:(0,e.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:x})]})},g))})]},c.key))]})}var Te=24;function Ne({kind:t}){let u=Z(),{store:a,view:o,setSelection:s,setEmphasis:d}=T(),{go:p}=W(),i=R(),[h,m]=(0,l.useState)(""),v=a.schema.tryDefinition(t),r=(0,l.useMemo)(()=>a.graph.nodesOfKind(t).filter(n=>o.past===!0||$(v,n)).map(n=>({id:n.id,name:F(v,n)})).sort((n,b)=>n.name.localeCompare(b.name)),[a,t,i,o.past,v]),f=(0,l.useMemo)(()=>{let n=S=>{let O=a.graph.getNode(S);return O!==void 0&&(o.past===!0||$(a.schema.tryDefinition(O.kind),O))},b=a.graph.allEdges().filter(S=>n(S.from)&&n(S.to));return ve(b,S=>a.graph.getNode(S)?.kind).filter(S=>S.from===t||S.to===t)},[a,t,i,o.past]);(0,l.useEffect)(()=>()=>d(null),[d]);let x=se(),k=ue().marks.flag,y=(0,l.useMemo)(()=>{let n=new Set(r.map(b=>b.id));return x.filter(b=>b.nodeIds.some(S=>n.has(S)))},[x,r]),E=(0,l.useMemo)(()=>[...new Set(y.flatMap(n=>n.nodeIds))].filter(n=>a.graph.getNode(n)?.kind===t).slice(0,300),[y,a,t]),C=(0,l.useRef)(null),c=(0,l.useSyncExternalStore)(ge,_,_);(0,l.useEffect)(()=>{c?.kind!==t||y.length===0||(C.current?.scrollIntoView?.({block:"start"}),C.current?.focus({preventScroll:!0}))},[c?.n,c?.kind,t,y.length>0]),(0,l.useEffect)(()=>()=>{me(),setTimeout(()=>{let n=document.activeElement;if(n&&n!==document.body)return;let b=CSS.escape(t);document.querySelector(`[data-testid="district-problems-${b}"]`)?.focus({preventScroll:!0})??document.querySelector(`[data-graview-view="${P(t).replace(/["\\]/g,"\\$&")}"]`)?.focus({preventScroll:!0})},0)},[t]);let g=L(a.schema,t),N=h.trim().toLowerCase(),w=N?r.filter(n=>n.name.toLowerCase().includes(N)):r;return(0,e.jsxs)(Y,{label:g,testId:"district-panel",wide:"min(360px, 40%)",sheetHeight:"52%",onClose:()=>s([]),head:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{style:U,children:"District"}),(0,e.jsx)("h2",{style:J,"data-testid":"district-panel-title",children:g}),(0,e.jsxs)("p",{style:Q,children:[q(a.schema,t,r.length),v?.description?` \xB7 ${v.description}`:""]}),(0,e.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap",marginTop:10},children:[(0,e.jsx)("button",{type:"button","data-testid":"district-panel-go",style:H,onClick:()=>p({...M(B(o,!1),ae(t)),relation:null}),children:"Go in"}),(0,e.jsx)(we,{on:P(t),about:`the ${g.toLowerCase()}`})]})]}),children:[y.length>0?(0,e.jsxs)("section",{"aria-label":"Problems","data-testid":"district-problems","data-graview-problems":y.length,children:[(0,e.jsx)("style",{children:`${E.map(n=>`.graview-ground[data-graview-altitude] .graview-building[data-graview-building="${CSS.escape(n)}"] polygon`).join(`,
|
|
3
3
|
`)} { stroke: var(--graview-accent); stroke-width: 2.2; stroke-opacity: 1; }`}),(0,e.jsxs)("h3",{ref:C,tabIndex:-1,"data-testid":"district-problems-heading",style:{display:"flex",alignItems:"baseline",gap:8,margin:0,padding:"14px 18px 8px",fontSize:"0.9375rem",fontWeight:600,color:"var(--graview-warn)",borderTop:"1px solid var(--graview-edge)",scrollMarginTop:0,outlineOffset:-2},children:[(0,e.jsx)("span",{"aria-hidden":"true",children:k}),(0,e.jsx)("span",{style:{color:"var(--graview-ink)"},children:fe(y.length,g)})]}),(0,e.jsx)("ol",{style:z,"data-testid":"district-problem-rows",children:(0,e.jsx)(l.Suspense,{fallback:null,children:(0,e.jsx)(Se,{violations:y,pick:n=>{let b=n.subjectId??n.nodeIds[0];b!==void 0&&s([b])}})})})]}):null,f.length>0?(0,e.jsxs)("section",{"aria-label":"Relations",children:[(0,e.jsx)("h3",{style:j,children:"Relations"}),(0,e.jsx)("ul",{style:z,children:f.map(n=>(0,e.jsx)("li",{children:(0,e.jsxs)("div",{"data-graview-relation-said":n.edge,tabIndex:0,style:{...X,cursor:"default"},onPointerEnter:()=>d(n.edge),onPointerLeave:()=>d(null),onFocus:()=>d(n.edge),onBlur:()=>d(null),children:[(0,e.jsx)("span",{style:{flex:"1 1 auto",minWidth:0},children:ye(a.schema,n)}),(0,e.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontVariantNumeric:"tabular-nums"},title:`${D(n.links)} links`,children:D(n.links)})]})},n.key))})]}):null,(0,e.jsxs)("div",{role:"group","aria-label":g,children:[(0,e.jsxs)("h3",{style:j,children:[g," ",(0,e.jsxs)("span",{style:{fontWeight:400,color:"var(--graview-ink-faint)"},children:["\xB7 ",r.length]})]}),r.length>Te?(0,e.jsx)("div",{style:{padding:"0 18px 6px"},children:(0,e.jsx)("input",{type:"search","data-testid":"district-panel-narrow","aria-label":`Narrow the ${g.toLowerCase()} by name`,placeholder:"Narrow by name",value:h,onChange:n=>m(n.target.value),style:{width:"100%",boxSizing:"border-box",minHeight:32}})}):null,(0,e.jsx)("ul",{style:z,children:w.map(n=>(0,e.jsx)("li",{children:(0,e.jsx)("button",{type:"button",className:"graview-map-panel-row","data-graview-record":n.id,style:X,onClick:()=>s([n.id]),onContextMenu:b=>u(b,n.id),children:(0,e.jsx)("span",{style:{flex:"1 1 auto",minWidth:0,overflowWrap:"anywhere"},children:n.name})})},n.id))})]})]})}export{Fe as MapPanelFor};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{s as P}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{s as P}from"./chunk.UKQUUPKE.js";import{G as M,Ia as S,O as w,T as y,ba as m,ca as I,s as b,w as T,x as A}from"./chunk.M7RESZB6.js";import{a as p}from"./chunk.SDO3U72B.js";import{b as f}from"./chunk.AJZBJBMO.js";var C=f(M(),1),h=f(y(),1),x=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.RPDH32XV.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.SS7234R6.js")))),O=x.part((e,n)=>(0,h.jsx)(e.Timeline,{...n}),{what:"The timeline"}),q=()=>x.prefetch();function K({face:e}){return w()?.open?(0,h.jsx)(C.Suspense,{fallback:null,children:(0,h.jsx)(O,{face:e})}):null}var i=f(M(),1),u=f(y(),1),v=new WeakMap,D=e=>{let n=v.get(e);return n||v.set(e,n={ask:null,doors:[],listeners:new Set}),n},k=e=>{for(let n of e.listeners)n()};function g(e,n){let t=D(e);t.ask=n,k(t)}var N=S(p(()=>(__graviewPreload(import.meta.url,["./chunk.MDEX6ZVE.js","./chunk.RPDH32XV.js","./chunk.EVBCEEQ4.js","./chunk.OWT3VVOT.js","./chunk.NHTGAP3G.js","./chunk.AI34V6WV.js","./chunk.G4ULQK64.js","./chunk.M7RESZB6.js","./chunk.SDO3U72B.js","./chunk.DZZL5IDD.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VJBBVLGZ.js")))),B=N.part((e,n)=>{let t=e.NotifySheet;return(0,u.jsx)(t,{...n})},{what:"Notify me"}),W=N.part((e,n)=>{let t=e.NotifiedList;return(0,u.jsx)(t,{...n})},{quiet:!0}),E=(e,n)=>n===void 0&&(e.onBehalfOf??e).id!==void 0;function F(e,n,t){let c=d=>t.tryDefinition(d)?.noun??d.replace(/[-_]+/g," "),o=e.on!==void 0?e.on:e.about.length===1?e.about[0]:void 0;if(e.act!==void 0){let d=o!==void 0&&n(o)!==void 0?o:void 0;return{label:"Notify me when someone does this\u2026",choices:[{on:"act",act:e.act,...d!==void 0?{record:d}:{}},...d!==void 0?[{on:"act",act:e.act}]:[]]}}if(o===void 0)return null;let s=n(o);if(s!==void 0)return{label:"Notify me when this changes\u2026",choices:[{on:"changed",record:o},{on:"act",record:o},{on:"reaches",kind:s,condition:"",record:o}]};let r=b(o)!==null?[b(o)]:T(o)?A(o):[];if(r.length!==1||!t.kinds.includes(r[0]))return null;let l=r[0],a=c(l);return{label:`Notify me when ${/^[aeiou]/i.test(a)?"an":"a"} ${a} is added\u2026`,choices:[{on:"created",kind:l},{on:"changed",kind:l},{on:"reaches",kind:l,condition:""}]}}function L(){let{store:e,principal:n,subscriptions:t,signIn:c}=m(),o=E(n,c);return(0,i.useMemo)(()=>o?s=>{let r=F(s,a=>e.graph.getNode(a)?.kind,e.schema);return r?{id:"notify",items:[{id:"notify-me",label:r.label,run:()=>g(t,{choices:r.choices,returnTo:s.element??null})}],prepare:()=>N.prefetch()}:null}:null,[o,e,t])}var z=[];function U({children:e}){let n=L(),t=(0,i.useMemo)(()=>n?[n]:z,[n]);return(0,u.jsx)(P,{sections:t,children:e})}function V(){let{subscriptions:e}=m(),n=(0,i.useId)(),t=D(e);(0,i.useEffect)(()=>(t.doors.push(n),k(t),()=>{t.doors.splice(t.doors.indexOf(n),1),k(t)}),[t,n]);let c=(0,i.useMemo)(()=>r=>(t.listeners.add(r),()=>void t.listeners.delete(r)),[t]),o=(0,i.useSyncExternalStore)(c,()=>t.ask,()=>null),s=(0,i.useSyncExternalStore)(c,()=>t.doors[0]===n,()=>!1);return!o||!s?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(B,{ask:o,close:()=>g(e,null)})})}function X({choices:e,label:n="Notify me",style:t,className:c,testId:o="notify-me"}){let{principal:s,subscriptions:r,signIn:l}=m();return E(s,l)?(0,u.jsx)("button",{type:"button","data-testid":o,className:c,onClick:a=>g(r,{choices:e,returnTo:a.currentTarget}),style:t,children:n}):null}function G(){let e=I(),n=e?.subscriptions,t=e?(e.principal.onBehalfOf??e.principal).id:void 0,[c,o]=(0,i.useState)(0);return(0,i.useEffect)(()=>{if(t===void 0||!n)return;let s=!0,r=()=>void Promise.resolve(n.list(t)).then(a=>s&&o(a.length),()=>s&&o(0));r();let l=n.onChange?.(r);return()=>{s=!1,l?.()}},[n,t]),c}function Y({style:e}){return G()===0?null:(0,u.jsx)(i.Suspense,{fallback:null,children:(0,u.jsx)(W,{...e?{style:e}:{}})})}export{q as a,K as b,L as c,U as d,V as e,X as f,G as g,Y as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as M}from"./chunk.
|
|
1
|
+
import{a as M}from"./chunk.IQ3PRWGO.js";import"./chunk.KDXU5DT3.js";import"./chunk.XOZU4OFA.js";import{f as H,g as x,h as R}from"./chunk.Y2YYH3JN.js";import{a as $}from"./chunk.75GVFX7L.js";import{a as T,b as A,c as C}from"./chunk.2B6P4GPS.js";import"./chunk.NUYA4BWI.js";import"./chunk.OKZT2QBM.js";import"./chunk.ACTXR2MI.js";import{a as P,c as O}from"./chunk.G4ULQK64.js";import{G as k,Q as E,T as g}from"./chunk.M7RESZB6.js";import"./chunk.SDO3U72B.js";import"./chunk.DZZL5IDD.js";import"./chunk.FQLNBIQ5.js";import{b as l}from"./chunk.AJZBJBMO.js";var s=l(k());var n=l(g()),V={maxWidth:560,margin:"0 auto",padding:"40px 20px 64px",display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:16};function B({app:r,store:e,form:o,principal:i,heading:c=1,onSubmitted:a}){let t=(0,s.useMemo)(()=>H(r,o,e.allMutations()),[r,o,e]),d=E(e),v=(0,s.useMemo)(()=>d?e.seenBy(i):e,[d,e,i]),[p,b]=(0,s.useState)(!1),u=(0,s.useRef)(null);(0,s.useEffect)(()=>{p&&u.current?.focus()},[p]);let y=`h${c}`;if(!d)return null;if(!t)return(0,n.jsx)("main",{"data-graview-visitor-form":o,style:V,children:(0,n.jsx)("p",{role:"alert",children:"There is no form here."})});let S=R(t);return(0,n.jsxs)("main",{"data-graview-visitor-form":o,"aria-labelledby":"graview-visitor-form-title",style:V,children:[(0,n.jsx)(y,{id:"graview-visitor-form-title",style:{margin:0,fontSize:"var(--graview-text-title)"},children:t.title}),p?(0,n.jsxs)("div",{ref:u,role:"status",tabIndex:-1,"data-graview-part":"received",style:{display:"grid",gap:8,outline:"none"},children:[(0,n.jsx)("p",{style:{margin:0,fontWeight:600},children:S.said}),S.next?(0,n.jsx)("p",{style:{margin:0},children:S.next}):null]}):(0,n.jsxs)(n.Fragment,{children:[t.intro?(0,n.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:t.intro}):null,(0,n.jsx)(M,{store:v,mutation:t.act,principal:i,only:t.fields.map(h=>h.name),label:t.submit,onDone:()=>{b(!0),a?.(o)}})]})]})}var m=l(k()),F=l(O()),G=l($());var f=l(g());function D(r){let{app:e,form:o,principal:i,scheme:c="auto",brand:a=e.brand,fonts:t=!0,height:d}=r,v=(0,m.useMemo)(()=>typeof i!="string"?i:e.forms?.[o]?x(e,o,i):{kind:"human",id:i,roles:[]},[e,o,i]),p=(0,m.useMemo)(()=>r.store??r.remote?.store??A(e,r.seed),[r.store,r.remote,e,r.seed]),b=C(c==="auto",a?.scheme),u=c==="auto"?b:c,y=`graview-form-${(0,m.useId)().replace(/[^a-zA-Z0-9_-]/g,"")}`,S=(0,m.useMemo)(()=>P(u,a,{scope:`.${y}`}),[u,a,y]);return(0,m.useEffect)(()=>{if(!t||typeof document>"u")return;let h=T(a);if(!h||document.querySelector(`link[href="${h}"]`))return;let w=document.createElement("link");w.rel="stylesheet",w.href=h,document.head.appendChild(w)},[a,t]),(0,f.jsxs)("section",{className:y,"aria-label":r.label??e.forms?.[o]?.title??e.name,"data-graview-embed":"form","data-graview-scheme":u,style:{position:"relative",isolation:"isolate",...d===void 0?{}:{minHeight:d},background:"var(--graview-ground)",color:"var(--graview-ink)",fontFamily:"var(--graview-font-body, system-ui)"},children:[(0,f.jsx)("style",{children:S}),(0,f.jsx)(B,{app:e,store:p,form:o,principal:v,heading:r.heading??1,...r.onSubmitted?{onSubmitted:r.onSubmitted}:{}})]})}function K(r,e){e.app.forms?.[e.form]||x(e.app,e.form,"form:");let o=e.store??e.remote?.store??A(e.app,e.seed),i=null;function c(){let[t,d]=(0,m.useState)(e.scheme??"auto");return i=d,(0,f.jsx)(D,{...e,store:o,scheme:t})}let a=(0,G.createRoot)(r);return(0,F.flushSync)(()=>a.render((0,f.jsx)(c,{}))),{store:o,setScheme:t=>(0,F.flushSync)(()=>i?.(t)),unmount:()=>a.unmount()}}export{D as FormEmbed,K as mount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$ as E,Cc as x,Fc as D,L as j,R as N,U as B,Y as b,lb as K,mb as m,pa as $,qc as O,tc as L,uc as _,vb as W,wc as F,xc as I,zb as C}from"./chunk.DZZL5IDD.js";import{j as f}from"./chunk.FQLNBIQ5.js";var G=e=>W(e).id??e.session;function T(e){let o=O(e),n=new Map;for(let t of e){if(t.vote===void 0||t.withheld||o.has(t.id))continue;let i=G(t.author);if(i===void 0)continue;let s=n.get(t.vote.suggestion);s||n.set(t.vote.suggestion,s=new Map),t.vote.vote===null?s.delete(i):s.set(i,t.vote.vote)}return n}function U(e,o){let n=0,t=0;for(let r of e?.values()??[])r==="for"?n++:t++;let i=o&&G(o),s=i!==void 0?e?.get(i):void 0;return{for:n,against:t,...s!==void 0?{mine:s}:{}}}var k=(e,o)=>e.expiresAt!==void 0&&Date.parse(e.expiresAt)<=Date.parse(o),X=(e,o,n)=>(e??[]).some(t=>t.suggestion===o&&(t.until===void 0||Date.parse(t.until)>Date.parse(n)));function Y(e,o=()=>!0,n={}){let t=O(e),i=new Set(e.map(a=>a.lineage?.suggestion)),s=n.now??new Date().toISOString(),r;return e.filter(a=>a.suggests&&!a.withheld&&!t.has(a.id)&&!i.has(a.id)&&!k(a,s)&&!X(n.dismissed,a.id,s)).map(({id:a,batch:l,suggests:d,intent:g,author:u,lineage:c,at:h,expiresAt:p})=>{let R=new Set;return JSON.stringify(d.map(V=>V.args),(V,A)=>(typeof A=="string"&&o(A)&&R.add(A),A)),{id:a,batch:l,calls:d,intent:g,author:u,...c?{lineage:c}:{},at:h,expiresAt:p,about:[...R],tally:U((r??=T(e)).get(a),n.voter)}})}function q(e,o){return e.ops.length>0&&e.ops.every(n=>n.suggests!==void 0||n.undoes!==void 0&&o(n.undoes)?.suggests!==void 0)}var P=e=>[...e].length;function Z(e){let o,n=0,t=0;for(let i of e.ops){let s=i.mutation?.name===C&&i.withheld!==!0&&i.undoes===void 0?i.mutation.args:void 0;if(typeof s?.node!="string"||typeof s.field!="string"||o&&(o.node!==s.node||o.field!==s.field))return;o={node:s.node,field:s.field};for(let r of i.primitives)r.op==="splice-text"?(n+=P(r.inserted),t+=P(r.removed)):r.op==="patch-node"&&typeof r.after[s.field]=="string"&&(n+=P(r.after[s.field]))}return o&&{...o,inserted:n,removed:t}}function H(e,o,n){let t=n.getNode(e.node)?.kind,i=[...e.inserted>0||e.removed===0?[`+${e.inserted}`]:[],...e.removed>0?[`\u2212${e.removed}`]:[]];return`Wrote in ${$(t?o.tryDefinition(t):void 0,e.field)} (${i.join(" ")})`}var S=e=>JSON.stringify([e.kind,e.id??"",e.name??""]),Q=e=>e.ops.find(o=>o.lineage?.run!==void 0)?.lineage?.run;function ee(e,o=()=>{}){let n=[];for(let t of e){if(q(t,o))continue;if(!x(t.author)){let g=Z(t),u=n.at(-1),c=g&&u&&"batch"in u&&S(u.batch.author)===S(t.author)&&u.typed?.node===g.node&&u.typed.field===g.field?u.typed:void 0;c?n[n.length-1]={batch:t,typed:{...c,batches:[...c.batches,t],inserted:c.inserted+g.inserted,removed:c.removed+g.removed}}:n.push(g?{batch:t,typed:{batches:[t],...g}}:{batch:t});continue}let i=Q(t),s=S(t.author),r=i!==void 0?n.findIndex(g=>"digest"in g&&g.digest.run===i&&S(g.digest.author)===s):n.length-1,a=n[r],l=a!==void 0&&"digest"in a&&S(a.digest.author)===s&&a.digest.run===i?a.digest:void 0,d=[...l?.batches??[],t];l&&n.splice(r,1),n.push({digest:{author:t.author,batches:d,things:ne(d),at:t.at,...i!==void 0?{run:i}:{}}})}return n}var ne=e=>e.reduce((o,n)=>o+(n.undone?0:n.ops.length),0),te=e=>{let o=Date.parse(e);if(Number.isNaN(o))return!1;let{minutes:n}=B(o,N());return n<6*60||n>=21*60};function ie(e,o=b(new Date().toISOString())??j()){let n=b(e.at)??e.at.slice(0,10),i=e.run!==void 0&&n===o&&[e.at,...(e.batches??[]).map(s=>s.at)].every(te)?"overnight":n===o?"today":`on ${E(n)}`;return`Tidied ${e.things===1?"one thing":`${e.things} things`} ${i}`}var y=e=>e,w=(e,o)=>o===void 0?{}:{[e]:o};function we(e,o,n){let t=f(e)?.store??e,i=y(t),s=_(n.lineage);if(s===void 0)throw new m("A suggestion says what it is based on: { basis, confidence? }");let r=n.author??i.by;if(n.expiresAt!==void 0&&Number.isNaN(Date.parse(n.expiresAt)))throw new m(`A suggestion expires at a time: "${n.expiresAt}" is not one (an ISO time, like 2026-10-23T06:00:00Z).`);let a=i.actMeanings(),l=D(o,a),d=M(t).find(p=>D(p.calls,a)===l);if(d)return t.log.get(d.id);i.refuseDeclined(o,r);let g=i.rehearsal();g.suggesting=!0;let u=g.applying(o,{author:r,lineage:s,...w("via",n.via)});if(u.ops.length===0)return;let c=[...new Set(u.ops.flatMap(p=>p.described??[]))],h={id:i.nextId(),seq:t.log.length,batch:i.mintBatch("batch"),author:r,intent:u.ops.map(p=>p.intent).join("; "),...w("batchIntent",n.intent),mutation:null,primitives:[],reads:[],writes:[],...c.length>0?{described:c}:{},at:i.now(),...w("via",n.via),lineage:s,suggests:o,...w("expiresAt",n.expiresAt)};return t.log.append(h),t.notify(K,[h]),h}function M(e,o,n={}){let t=f(e),i=t?.store??e,s=o??t?.principal,r=(s!==void 0?i.seenBy(s):i).log.all();return Y(r,a=>i.graph.has(a),{now:y(i).now(),dismissed:n.dismissed,voter:s})}function J(e,o,n){let t=f(e),i=t?.store??e,s=n??t?.principal??y(i).by;return o.calls.every(r=>i.permits(r,s).ok)}function z(e,o,n,t={}){let i=f(e)?.store??e,s=t.author??y(i).by;v(i,o,s);let r=i.applyAll([{name:F,args:{suggestion:o,vote:n}}],{...t,author:s});return n===null?r:{...r,voted:n}}function v(e,o,n){let t=M(e,n).find(s=>s.id===o),i=t?void 0:e.log.get(o);if(i?.suggests&&k(i,y(e).now()))throw new m(`That suggestion expired on ${i.expiresAt.slice(0,10)}.`);if(!t)throw new m("That suggestion is no longer waiting: it was accepted or declined, or it is not one you can see.");return t}function ve(e,o,n={}){let t=f(e)?.store??e,i=n.author??y(t).by,s=v(t,o,i);return J(t,s,i)?t.applyAll(s.calls,{...n,author:i,lineage:{...s.lineage,suggestion:o}}):z(t,o,"for",{...n,author:i})}function be(e,o,n={}){let t=f(e)?.store??e,i=n.author??y(t).by,s=v(t,o,i);return J(t,s,i)?t.undo(s.batch,{...n,author:i}):z(t,o,"against",{...n,author:i})}var oe={kind:"system",id:"tidying",name:"Graview, tidying",automated:!0};I.op=(e,o,n,t,i,s)=>{let r=e,{suggestion:a,vote:l}=n.args,d=v(r,a,i),g=l==="for"?`For: ${d.intent}`:l==="against"?`Against: ${d.intent}`:`Withdraws a vote on: ${d.intent}`;return{id:o.id,seq:r.log.length,batch:t,author:i,intent:g,mutation:n,primitives:[],reads:[],writes:[],...d.about.length>0?{described:d.about}:{},at:o.at,...s.via!==void 0?{via:s.via}:{},vote:{suggestion:a,vote:l}}};I.accepting=(e,o)=>{let n=e,t=n.tidying?.autoAcceptAt;if(t===void 0||o.vote?.vote!=="for")return;let i=o.vote.suggestion,s=M(n).find(d=>d.id===i);if(!s)return;let a=[...T(n.log.all()).get(i)??[]].filter(([,d])=>d==="for").map(([d])=>d);if(a.length<t)return;let l=x(s.author)?s.author:oe;return{calls:s.calls,author:l,lineage:{...s.lineage,suggestion:i,voters:a.slice(0,L)}}};export{H as a,ee as b,ie as c,we as d,M as e,J as f,z as g,ve as h,be as i};
|