graview 0.1.66 → 0.1.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/preview/{chunk.LSN2IPAI.js → chunk.25QFDTCU.js} +1 -1
- package/dist/preview/{chunk.BFAFCVL4.js → chunk.264PB572.js} +1 -1
- package/dist/preview/chunk.2FHIINXG.js +2 -0
- package/dist/preview/{chunk.HSSIMVVM.js → chunk.2VUX54XH.js} +1 -1
- package/dist/preview/{chunk.CTASTRQN.js → chunk.35KMZHB7.js} +1 -1
- package/dist/preview/{chunk.OWFS2YDQ.js → chunk.37RFCHSS.js} +1 -1
- package/dist/preview/chunk.3ENPWZBG.js +1 -0
- package/dist/preview/{chunk.XMQG2PSM.js → chunk.3GNT5MKP.js} +1 -1
- package/dist/preview/{chunk.BXBEGMPO.js → chunk.3NSV3WKM.js} +2 -2
- package/dist/preview/chunk.3ZODN6BW.js +1 -0
- package/dist/preview/{chunk.OPTYYIGC.js → chunk.47XEJZ3O.js} +1 -1
- package/dist/preview/{chunk.5FNFRVTL.js → chunk.4EMKCKDB.js} +1 -1
- package/dist/preview/{chunk.B6JRTW3A.js → chunk.4UUJHLHR.js} +1 -1
- package/dist/preview/{chunk.FBILPNGH.js → chunk.4W57E7AX.js} +1 -1
- package/dist/preview/chunk.55G4IPOO.js +1 -0
- package/dist/preview/{chunk.72XP2ARZ.js → chunk.5AKZROMR.js} +1 -1
- package/dist/preview/chunk.5J6DVR7S.js +1 -0
- package/dist/preview/{chunk.FXT5CN32.js → chunk.5R744JGZ.js} +1 -1
- package/dist/preview/{chunk.NJRLJEJY.js → chunk.6KJGRM7A.js} +1 -1
- package/dist/preview/{chunk.4AC2QM7T.js → chunk.6N4PE3U5.js} +1 -1
- package/dist/preview/{chunk.LGRVEHXT.js → chunk.6NG76MDA.js} +2 -2
- package/dist/preview/{chunk.4FCFNAA4.js → chunk.6SJEZWH3.js} +1 -1
- package/dist/preview/{chunk.7VADSNPZ.js → chunk.6UQFV53C.js} +1 -1
- package/dist/preview/{chunk.WAB3L3ZI.js → chunk.6W6XMLSF.js} +1 -1
- package/dist/preview/{chunk.4JULYKGD.js → chunk.77C556NM.js} +1 -1
- package/dist/preview/{chunk.IGK7EZCX.js → chunk.7ARRVNUR.js} +1 -1
- package/dist/preview/{chunk.CBXS23YH.js → chunk.7BJRHPE3.js} +2 -2
- package/dist/preview/{chunk.ZQR2SN65.js → chunk.7S6ZRMW4.js} +1 -1
- package/dist/preview/{chunk.IAEHUSQQ.js → chunk.7UHPHEH5.js} +1 -1
- package/dist/preview/chunk.7WHQWLL6.js +1 -0
- package/dist/preview/{chunk.KACSYPEV.js → chunk.A4EZAGG7.js} +1 -1
- package/dist/preview/chunk.A5PSEU3W.js +25 -0
- package/dist/preview/{chunk.VKZIEZ5C.js → chunk.A7GVTE5Y.js} +2 -2
- package/dist/preview/{chunk.45JP6VGJ.js → chunk.AJMVRFYX.js} +2 -2
- package/dist/preview/{chunk.6P6NGZ6D.js → chunk.AKJS2NUM.js} +1 -1
- package/dist/preview/{chunk.CU2WCYMK.js → chunk.ARWO4WOV.js} +1 -1
- package/dist/preview/chunk.B5SJMCTT.js +7 -0
- package/dist/preview/{chunk.JXNVNFV4.js → chunk.B7KZBT27.js} +1 -1
- package/dist/preview/{chunk.E3UL4MCD.js → chunk.BDNQMKDG.js} +1 -1
- package/dist/preview/{chunk.YNEHJWJV.js → chunk.BKYZSV2Y.js} +1 -1
- package/dist/preview/{chunk.5BX66FBP.js → chunk.CKDCTFLU.js} +1 -1
- package/dist/preview/chunk.CTUJZ3IV.js +1 -0
- package/dist/preview/chunk.CY7FFKEZ.js +1 -0
- package/dist/preview/{chunk.3PBTN7RO.js → chunk.D4WJ7OM5.js} +1 -1
- package/dist/preview/{chunk.C2C3AXGI.js → chunk.D7NWMXSX.js} +3 -3
- package/dist/preview/chunk.DEKRFTRN.js +4 -0
- package/dist/preview/{chunk.E7EWNWAN.js → chunk.DKEIEH2D.js} +1 -1
- package/dist/preview/{chunk.I2737CPF.js → chunk.DWM7AR5Y.js} +1 -1
- package/dist/preview/{chunk.ANS2IEEV.js → chunk.DZMIYEHQ.js} +1 -1
- package/dist/preview/{chunk.BMENTGDC.js → chunk.E5PYNAYT.js} +2 -2
- package/dist/preview/chunk.EBKH3ILT.js +1 -0
- package/dist/preview/{chunk.DTCAUPLC.js → chunk.EFVSZKB5.js} +1 -1
- package/dist/preview/{chunk.QOS5T46W.js → chunk.EGPCVMDU.js} +1 -1
- package/dist/preview/{chunk.7ZKBYXUM.js → chunk.EJ2EZL2G.js} +1 -1
- package/dist/preview/{chunk.7VP6Y6D2.js → chunk.EP6Q32WT.js} +1 -1
- package/dist/preview/{chunk.OOSIKCOS.js → chunk.F464JKHZ.js} +1 -1
- package/dist/preview/{chunk.VGHO3VCB.js → chunk.FLJXYESX.js} +1 -1
- package/dist/preview/chunk.FOUBDGL3.js +1 -0
- package/dist/preview/chunk.FPHRAO3R.js +1 -0
- package/dist/preview/{chunk.4FDVINRJ.js → chunk.FRQSLWP4.js} +1 -1
- package/dist/preview/{chunk.2MHNPBHC.js → chunk.FVQKSN33.js} +1 -1
- package/dist/preview/{chunk.PDDIQ6PK.js → chunk.G3GFDVO2.js} +1 -1
- package/dist/preview/{chunk.ZD7T234N.js → chunk.G5GVT6JY.js} +1 -1
- package/dist/preview/{chunk.3L4JMM3P.js → chunk.GFLH7RCI.js} +1 -1
- package/dist/preview/{chunk.OO2OP76C.js → chunk.GMLONS5L.js} +1 -1
- package/dist/preview/{chunk.FK722SHI.js → chunk.GRFD42WM.js} +1 -1
- package/dist/preview/{chunk.2VR7YEJ6.js → chunk.GVT4UUQA.js} +1 -1
- package/dist/preview/{chunk.GME63ZHI.js → chunk.H3EGBDW2.js} +1 -1
- package/dist/preview/{chunk.DQFHIJFN.js → chunk.H6KIEDZN.js} +1 -1
- package/dist/preview/{chunk.5B5SRTUK.js → chunk.HAOB6O72.js} +1 -1
- package/dist/preview/chunk.HB5NWHFP.js +3 -0
- package/dist/preview/{chunk.6EHHMWPP.js → chunk.HJUZMOW2.js} +1 -1
- package/dist/preview/{chunk.6MQ5NT7S.js → chunk.HN4ZJ4B4.js} +1 -1
- package/dist/preview/chunk.HVBKI5ZO.js +1 -0
- package/dist/preview/chunk.I3SDKMQS.js +1 -0
- package/dist/preview/{chunk.QQAZQDRW.js → chunk.IAEGJDF3.js} +1 -1
- package/dist/preview/{chunk.QWNSHISU.js → chunk.IDALEKIW.js} +1 -1
- package/dist/preview/{chunk.QFHWG4LN.js → chunk.ILJDLBPJ.js} +1 -1
- package/dist/preview/{chunk.ZR2TP3BF.js → chunk.J2OPIS3H.js} +1 -1
- package/dist/preview/chunk.J5OLYVZ4.js +1 -0
- package/dist/preview/{chunk.LETAQTLJ.js → chunk.J6HF7IRQ.js} +1 -1
- package/dist/preview/{chunk.RWIN3POV.js → chunk.JEC5FDKX.js} +1 -1
- package/dist/preview/chunk.JKFVNQY7.js +1 -0
- package/dist/preview/{chunk.LLIURXFP.js → chunk.JQ2WNKDW.js} +1 -1
- package/dist/preview/{chunk.Z7Y3R3YR.js → chunk.JQ63N4MZ.js} +1 -1
- package/dist/preview/{chunk.DZFM6GSY.js → chunk.JU6UFWS3.js} +1 -1
- package/dist/preview/{chunk.INHS3KTK.js → chunk.JVB5KDSG.js} +1 -1
- package/dist/preview/{chunk.4U4D7WOI.js → chunk.KFT7JIEH.js} +1 -1
- package/dist/preview/chunk.KGMSSXZL.js +1 -0
- package/dist/preview/{chunk.5CXIEYHY.js → chunk.KX5ZBHMA.js} +2 -2
- package/dist/preview/{chunk.V7W5AQKL.js → chunk.LP2ZMAT2.js} +1 -1
- package/dist/preview/{chunk.BUVTUAB5.js → chunk.LRNFE3UK.js} +1 -1
- package/dist/preview/{chunk.PAGEGBUD.js → chunk.LVOTLGJB.js} +1 -1
- package/dist/preview/{chunk.QHMHUL6B.js → chunk.LYEGRY77.js} +1 -1
- package/dist/preview/{chunk.PPSYUOH7.js → chunk.M7KXQGQL.js} +1 -1
- package/dist/preview/{chunk.7BIPZTJB.js → chunk.MAKCZ6B6.js} +1 -1
- package/dist/preview/{chunk.EQ4OODGO.js → chunk.MJY4SLWA.js} +1 -1
- package/dist/preview/{chunk.EMFOMSMI.js → chunk.MSAYU25L.js} +1 -1
- package/dist/preview/{chunk.F4VB6Q2W.js → chunk.MUSMNKE4.js} +1 -1
- package/dist/preview/{chunk.BGAC3B7X.js → chunk.MW7R5G3C.js} +1 -1
- package/dist/preview/{chunk.AK7NGFEX.js → chunk.N4ZKZ4GM.js} +1 -1
- package/dist/preview/{chunk.TXHYGFIZ.js → chunk.NAXOXBOF.js} +1 -1
- package/dist/preview/{chunk.IWYMKGZZ.js → chunk.NKLPL7QD.js} +1 -1
- package/dist/preview/{chunk.QU52E5RG.js → chunk.NKYWIGC7.js} +1 -1
- package/dist/preview/{chunk.KSIEO5W7.js → chunk.NRURQGXV.js} +1 -1
- package/dist/preview/{chunk.FV72U33M.js → chunk.NSOPYIT4.js} +1 -1
- package/dist/preview/chunk.NXZL5CA2.js +1 -0
- package/dist/preview/{chunk.WVLEGCRI.js → chunk.O2OL6RQQ.js} +1 -1
- package/dist/preview/{chunk.TGEL6EUA.js → chunk.O5VFKVZS.js} +1 -1
- package/dist/preview/{chunk.CEVGND3Y.js → chunk.OCXY5DCD.js} +3 -3
- package/dist/preview/chunk.OHAO6KKH.js +1 -0
- package/dist/preview/{chunk.DSYP43NN.js → chunk.P2EKKKK2.js} +1 -1
- package/dist/preview/chunk.PSNMZBVS.js +1 -0
- package/dist/preview/{chunk.W53YNBSM.js → chunk.PZ7KY6XH.js} +1 -1
- package/dist/preview/{chunk.WSO7JOW5.js → chunk.QAM76AXV.js} +1 -1
- package/dist/preview/{chunk.PSQYDCVM.js → chunk.QF5QB5YR.js} +1 -1
- package/dist/preview/chunk.QNP5OR3P.js +93 -0
- package/dist/preview/{chunk.5LJVOLKR.js → chunk.QRQ5WPZI.js} +1 -1
- package/dist/preview/chunk.QWGWOEBZ.js +90 -0
- package/dist/preview/{chunk.OMT4QUZY.js → chunk.QXLJGHMC.js} +4 -4
- package/dist/preview/{chunk.J2MM6BUW.js → chunk.QZQCQWQG.js} +1 -1
- package/dist/preview/{chunk.6FQW6FNL.js → chunk.R6JBA7UK.js} +1 -1
- package/dist/preview/chunk.R7CRBRD4.js +1 -0
- package/dist/preview/chunk.RD2FSSLV.js +1 -0
- package/dist/preview/{chunk.OEIWIZCP.js → chunk.RG5G6YQD.js} +1 -1
- package/dist/preview/{chunk.PFQBCHQA.js → chunk.RJY7VJBH.js} +1 -1
- package/dist/preview/chunk.RR25BGWP.js +1 -0
- package/dist/preview/{chunk.BZ7QWHAE.js → chunk.RSQ432QN.js} +1 -1
- package/dist/preview/{chunk.MWGZKZD6.js → chunk.SFBHPYRD.js} +1 -1
- package/dist/preview/{chunk.FFOD5B4B.js → chunk.SJQPTDAT.js} +1 -1
- package/dist/preview/{chunk.OTV5XTBB.js → chunk.SNHKYH72.js} +1 -1
- package/dist/preview/{chunk.WSDJPXJD.js → chunk.SO6NT5K7.js} +1 -1
- package/dist/preview/{chunk.FDZE5LTJ.js → chunk.STPA7HBK.js} +2 -2
- package/dist/preview/{chunk.ONYBW45K.js → chunk.SY5ID44D.js} +1 -1
- package/dist/preview/chunk.T27QKVKP.js +1 -0
- package/dist/preview/{chunk.U6TEW6YD.js → chunk.T2OUHRAA.js} +1 -1
- package/dist/preview/chunk.T3WCRS6M.js +1 -0
- package/dist/preview/{chunk.QGIM2WAY.js → chunk.TI5FR2QQ.js} +1 -1
- package/dist/preview/{chunk.HOCD7KIR.js → chunk.TTSGCNPT.js} +1 -1
- package/dist/preview/{chunk.ES63XSIM.js → chunk.TXZQEJ5T.js} +1 -1
- package/dist/preview/{chunk.6LXIEM6B.js → chunk.UDHPMVC4.js} +1 -1
- package/dist/preview/{chunk.KBPJ7X7W.js → chunk.UGQYMN4J.js} +1 -1
- package/dist/preview/{chunk.M6ZN2KUO.js → chunk.UQIPEMJ5.js} +1 -1
- package/dist/preview/{chunk.FIFUMX5X.js → chunk.URQTF5SY.js} +1 -1
- package/dist/preview/{chunk.J7W2OFHY.js → chunk.UW52CMGJ.js} +1 -1
- package/dist/preview/{chunk.LINSO5PN.js → chunk.UWS4RMM3.js} +1 -1
- package/dist/preview/{chunk.QPF4KSAW.js → chunk.V7H4BUEB.js} +1 -1
- package/dist/preview/{chunk.KHRS2SKB.js → chunk.VBHV4TLG.js} +1 -1
- package/dist/preview/{chunk.U3ED7W2U.js → chunk.VBLQJVQ5.js} +1 -1
- package/dist/preview/{chunk.CVPMSPCH.js → chunk.WALVW3KJ.js} +1 -1
- package/dist/preview/{chunk.2KFZHUAC.js → chunk.WEMUKZKH.js} +1 -1
- package/dist/preview/{chunk.YIPXZUTT.js → chunk.X226YATK.js} +1 -1
- package/dist/preview/{chunk.GNEOSHQ6.js → chunk.XFLGSUYO.js} +1 -1
- package/dist/preview/{chunk.W4YDPHCQ.js → chunk.XSWSBTUO.js} +1 -1
- package/dist/preview/{chunk.OJY7VJ7D.js → chunk.YCD4JSXD.js} +1 -1
- package/dist/preview/{chunk.72ZCLEQC.js → chunk.YZPESGCP.js} +1 -1
- package/dist/preview/{chunk.XOE4KNP2.js → chunk.Z27NSSYL.js} +2 -2
- package/dist/preview/{chunk.DEHIR4EG.js → chunk.Z2XUVJAL.js} +1 -1
- package/dist/preview/{chunk.YXEO3Y65.js → chunk.Z3O2VZAJ.js} +1 -1
- package/dist/preview/{chunk.M2JCFNHJ.js → chunk.Z4TY44CD.js} +1 -1
- package/dist/preview/{chunk.EXYCN4WI.js → chunk.ZAPS4J6G.js} +1 -1
- package/dist/preview/{chunk.6TLXFMX2.js → chunk.ZAQ4IDX6.js} +1 -1
- package/dist/preview/{chunk.6HY6ZGEE.js → chunk.ZEZUKRC6.js} +1 -1
- package/dist/preview/{chunk.GEFXU4VO.js → chunk.ZG5VGP5U.js} +1 -1
- package/dist/preview/index.html +56 -56
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.4WGYUYWU.js +0 -2
- package/dist/preview/chunk.5EMIWORS.js +0 -1
- package/dist/preview/chunk.6EVMXBNB.js +0 -1
- package/dist/preview/chunk.BCQWAFGD.js +0 -1
- package/dist/preview/chunk.BOCVLC7X.js +0 -1
- package/dist/preview/chunk.DPJNGFEZ.js +0 -4
- package/dist/preview/chunk.E4VRRWFP.js +0 -1
- package/dist/preview/chunk.EUAO4QNV.js +0 -1
- package/dist/preview/chunk.F7672TKJ.js +0 -1
- package/dist/preview/chunk.FA42HCPW.js +0 -1
- package/dist/preview/chunk.FBJAQPZ6.js +0 -1
- package/dist/preview/chunk.GAFMWOME.js +0 -1
- package/dist/preview/chunk.I4Z7HVRT.js +0 -1
- package/dist/preview/chunk.JMXXA4YG.js +0 -1
- package/dist/preview/chunk.JMYUQNXN.js +0 -6
- package/dist/preview/chunk.K6DFXDPZ.js +0 -1
- package/dist/preview/chunk.KF27ME27.js +0 -1
- package/dist/preview/chunk.L25DCT5S.js +0 -1
- package/dist/preview/chunk.MODLZJD4.js +0 -25
- package/dist/preview/chunk.OJGHDWI6.js +0 -1
- package/dist/preview/chunk.SSF47GUY.js +0 -1
- package/dist/preview/chunk.T6DPWW2K.js +0 -3
- package/dist/preview/chunk.TA36WBHK.js +0 -1
- package/dist/preview/chunk.TTGKX7LT.js +0 -1
- package/dist/preview/chunk.U3HERHAI.js +0 -88
- package/dist/preview/chunk.V5I4GZEY.js +0 -1
- package/dist/preview/chunk.VT2YGDK2.js +0 -1
- package/dist/preview/chunk.XK65Y2KX.js +0 -1
- package/dist/preview/chunk.Z274CL7J.js +0 -1
- package/dist/preview/chunk.ZBVYD4OX.js +0 -90
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.WVUJXDXZ.js";import{k as x}from"./chunk.
|
|
1
|
+
import"./chunk.WVUJXDXZ.js";import{k as x}from"./chunk.DWM7AR5Y.js";import"./chunk.6KJGRM7A.js";import"./chunk.WALVW3KJ.js";import"./chunk.SNHKYH72.js";import"./chunk.UGQYMN4J.js";import"./chunk.RG5G6YQD.js";import"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import{gb as f,ib as N,la as S}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var k=(n,r,t)=>({untrusted:!0,authoredBy:t.say(r),text:n});function O(n,r){let t;for(let[a,e]of Object.entries(n)){if(typeof e!="string"||a==="id"||a==="kind")continue;let o=r.fieldBy(n.id,a);o&&(t??={...n},t[a]=k(e,o,r))}return t??n}function L(n,r,t){let a=e=>{if(Array.isArray(e))return e.map(a);if(e!==null&&typeof e=="object"&&"id"in e&&"label"in e){let o=e,i=t.recordBy(o.id);return i?{...o,label:k(o.label,i,t)}:o}if(typeof e=="string"){let o=t.recordBy(n);return o?k(e,o,t):e}return e};return Object.fromEntries(Object.entries(r).map(([e,o])=>[e,a(o)]))}function $(n,r){return n.map(t=>{let a=r.recordBy(t.id);return a?{...t,label:k(t.label,a,r)}:t})}function D(n,r){return{...n,nodes:n.nodes.map(t=>O(t,r))}}var E=n=>(JSON.stringify(n)??"null").length,R=n=>typeof n=="number"&&Number.isFinite(n)&&n>0?Math.floor(n):0;function w(n,r,t,a,e,o=""){let i=n-r-t;return i>0?`and ${i} more ${e}: call ${a} with ${o}offset ${r+t} for the next page.`:void 0}var j=({line:n,...r})=>r;function T(n){let r;for(let[t,a]of Object.entries(n))typeof a!="string"||a.length<=600||(r??={...n},r[t]=`${a.slice(0,600)}\u2026 (cut at ${600} of ${a.length} characters)`);return r??n}function B(n,r,t,a){let e=Math.min(t,Math.max(0,n.length-r)),o=n.slice(r,r+e),i=a(o);for(;e>1&&E(i)>8e3;)e=Math.max(1,Math.floor(e*.75)),o=n.slice(r,r+e),i=a(o);return{page:o,answer:i}}function C(n,r){let t=JSON.stringify(r)??"null";if(t.length<=8e3)return r;let a=`This answer was ${t.length} characters, more than the ${8e3} one read answers, so it is cut. Ask ${n} for less, or use search_graph and get_node to read one thing.`;for(let e=8e3-a.length-40;;){let o={cut:a,partial:t.slice(0,e)},i=E(o)-8e3;if(i<=0)return o;e=Math.max(0,e-i-8)}}function I(n,r){let{matched:t,later:a,...e}=r,o=n.hits.filter(i=>i.about==="node").length;return n.total>o?{...e,more:`and ${n.total-o} more records match: narrow the words, or add kind:<kind>.`}:e}function P(n,r,t){let a=N(t.archived),e={nodes:n.graph.allNodes({archived:a}),edges:n.graph.allEdges({archived:"all"})},o=R(t.offset),i=e.nodes.length,{page:h,answer:u}=B(e.nodes,o,25,d=>{let g=new Set(d.map(s=>s.id)),l=new Set(d.map(s=>s.id)),c=w(i,o,d.length,"get_graph","nodes"),p=s=>l.has(s)||(a==="all"?n.graph.has(s):n.graph.has(s)&&f(n.graph.getNode(s))===a);return{...D({nodes:d.map(T),edges:e.edges.filter(s=>g.has(s.from)&&p(s.to))},r),total:i,...c?{more:c}:{}}});return{data:u,reads:h.map(d=>d.id)}}function U(n,r,t,a){let e=n.graph.getNode(t),o=R(a.offset),i=n.graph.outEdges(t),h=n.graph.inEdges(t),u=i.slice(o,o+20),d=h.slice(o,o+20),g=(s,A)=>{let m=n.graph.getNode(A);return{kind:s,id:A,label:m?S(n.schema.tryDefinition(m.kind),m):A,...f(m)?{archived:!0}:{}}},l=x(n.schema,n.graph,e),c=n.violations().filter(s=>s.nodeIds.includes(t)),p=[w(i.length,o,u.length,"get_node","links out",`id "${t}" and `),w(h.length,o,d.length,"get_node","links in",`id "${t}" and `),c.length>20?`and ${c.length-20} more problems: get_violations lists them.`:void 0].filter(Boolean);return{data:{node:O(T(e),r),...f(e)?{archived:!0}:{},...Object.keys(l.values).length>0?{computed:L(t,l.values,r)}:{},...Object.keys(l.refused).length>0?{uncomputed:l.refused}:{},out:$(u.map(s=>g(s.kind,s.to)),r),in:$(d.map(s=>g(s.kind,s.from)),r),violations:c.slice(0,20).map(j),...p.length>0?{more:p.join(" ")}:{}},reads:[t,...u.map(s=>s.to),...d.map(s=>s.from)]}}function F(n,r){let t=R(r.offset),{page:a,answer:e}=B(n,t,20,o=>{let i=w(n.length,t,o.length,"get_violations","problems");return{violations:o.map(j),total:n.length,...i?{more:i}:{}}});return{data:e,reads:[...new Set(a.flatMap(o=>o.nodeIds))]}}export{P as graphRead,U as nodeRead,I as searchRead,F as violationsRead,C as withinReadChars};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.
|
|
1
|
+
import"./chunk.SO6NT5K7.js";import"./chunk.MUSMNKE4.js";import"./chunk.SJQPTDAT.js";import{a as m}from"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import"./chunk.QNP5OR3P.js";import"./chunk.4W57E7AX.js";import{W as p}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{Z as l}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import{b as f}from"./chunk.AJZBJBMO.js";var a=f(p(),1);function A({states:e,definition:v}){let s=e.values.reduce((t,n)=>t+n.count,0),u=t=>t===null?"with none":m(v,e.field,t).toLowerCase(),c=e.values.filter(t=>t.count>0).map(t=>`${l(t.count)} ${u(t.value)}`).join(", ");return s===0?null:(0,a.jsx)("div",{className:"graview-district-states",role:"img","aria-label":c,title:c,children:e.values.map((t,n)=>{if(t.count===0)return null;let y=e.values.filter(r=>r.count>0).length,w=t.count/s*(168-(y-1)),o=l(t.count),i=`${o} ${u(t.value)}`,d=r=>r.length*6.2+8<=w;return(0,a.jsx)("span",{"data-graview-tier":t.tier,style:{flexGrow:t.count},title:i,children:d(i)?i:d(o)?o:""},n)})})}export{A as StatesBar};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk.BKYZSV2Y.js";import"./chunk.LP2ZMAT2.js";import"./chunk.H3EGBDW2.js";import"./chunk.DWM7AR5Y.js";import"./chunk.6KJGRM7A.js";import"./chunk.WALVW3KJ.js";import"./chunk.SNHKYH72.js";import"./chunk.UGQYMN4J.js";import"./chunk.RG5G6YQD.js";import"./chunk.SJQPTDAT.js";import"./chunk.JQ63N4MZ.js";import"./chunk.Z3O2VZAJ.js";import"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{g as columnActs,d as columnChoices,c as columnMoves,b as columnOf,e as columnReach,f as columnSteps,j as describePlace,k as placeText,h as resolveFor,i as shadowedPageSlots,a as statusColumns};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function J(e){return e[3]===0&&e[7]===0&&e[11]===0&&e[15]===1}var Z=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];function v(e,t,n){return[e,0,0,0,0,e,0,0,0,0,1,0,t,n,0,1]}function ee(e=800){return[1,0,0,0,0,1,0,0,0,0,1,-1/e,0,0,0,1]}function te(e){if(typeof DOMMatrix>"u")throw new Error("DOMMatrix is unavailable outside a browser");return e instanceof DOMMatrix?e:new DOMMatrix([...e])}var R=["solid","dashed","dotted","double","tapered"],T=["arrow","none","dot","bar"];function Y(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function I(e,t={}){let n=Y(e);return{...{pattern:R[n%R.length],width:1.5+(n>>>3)%3*.75,cap:T[(n>>>7)%T.length],hue:(n>>>11)%360,opacity:.85},...t[e]}}var oe={solid:void 0,dashed:"7 5",dotted:"1 5",double:"12 3",tapered:"10 3 3 3"},ae="2 6",le=.6;function ie(e){return e.color??`hsl(${Math.round(e.hue)} 55% 62%)`}function de(e,t){return t?Math.max(1.6,e.width):Math.min(1.4,e.width)}var _={0:{scale:1,blur:0,falloff:0,shadow:.16,fidelity:"full"},1:{scale:.95,blur:.3,falloff:.26,shadow:.12,fidelity:"summary"},2:{scale:.9,blur:.3,falloff:.34,shadow:.07,fidelity:"glyph"}},B={0:{scale:1,blur:0,falloff:0,shadow:.34,fidelity:"full"},1:{scale:.95,blur:.45,falloff:.18,shadow:.24,fidelity:"summary"},2:{scale:.9,blur:.45,falloff:.26,shadow:.14,fidelity:"glyph"}};function p(e,t="dark"){let n=Math.max(0,Math.min(2,Math.round(e)));return(t==="light"?_:B)[n]}function G(e,t,n){let o=Math.max(0,Math.min(1,n)),r=(l,d)=>l+(d-l)*o;return{scale:r(e.scale,t.scale),blur:r(e.blur,t.blur),falloff:r(e.falloff,t.falloff),shadow:r(e.shadow,t.shadow),fidelity:o<.5?e.fidelity:t.fidelity}}function E(e,t,n,o,r){return v(e.scale,t,n)}function L(e,t="dark"){let n=e.onPlot?0:e.plane-(1-(e.depth??1))*.55,o=Math.max(0,Math.min(2,Math.floor(n))),r=Math.max(0,Math.min(2,Math.ceil(n)));return{style:o===r?p(o,t):G(p(o,t),p(r,t),n-o),blur:p(Math.max(0,Math.min(2,Math.round(n))),t).blur}}function ye(e){return 1-e.falloff*.55}var he="data-graview-outset";function be(e){return`${e.top} ${e.right} ${e.bottom} ${e.left}`}function ge(e){if(!e)return;let[t,n,o,r,...l]=e.trim().split(/\s+/).map(Number);if(!(l.length>0||[t,n,o,r].some(d=>d===void 0||!Number.isFinite(d)||d<0)))return{top:t,right:n,bottom:o,left:r}}function K(e){let t=e.outset;return t?{width:e.width+t.left+t.right,height:e.height+t.top+t.bottom}:{width:e.width,height:e.height}}var xe=32;function Pe(e,t,n){let o=n.capturedAt??{},r=[],l=[],d=[],s=[],f=[],h=[],m=new Map,A=[...e].sort((a,i)=>i.plane-a.plane);for(let a of A){let{style:i,blur:u}=L(a,n.scheme),V=a.outset?.left??0,N=a.outset?.top??0,c=E(i,a.x-V*i.scale,a.y-N*i.scale,n.canvasWidth,n.canvasHeight),y=K(a),P=y.width*i.scale,w=y.height*i.scale;m.set(a.id,{x:a.x+a.width*i.scale/2,y:a.y+a.height*i.scale/2});let M=c[12],S=c[13];if(M>=n.canvasWidth||S>=n.canvasHeight||M+P<=0||S+w<=0){l.push(a.id),a.dom||d.push({viewId:a.id,transform:c});continue}if(h.push({viewId:a.id,transform:c,width:y.width,height:y.height,depth:a.plane}),a.dom)continue;let C=U(a,i,o[a.id],n.changed);C&&r.push({viewId:a.id,reason:C,plane:a.plane}),s.push({viewId:a.id,transform:c,style:i,blur:u,width:P,height:w,opacity:a.opacity??1}),f.push({viewId:a.id,transform:c})}let D=n.captureBudget??Number.POSITIVE_INFINITY,H=new Set(r.filter(a=>a.reason!=="first").sort((a,i)=>a.plane-i.plane).slice(0,Math.max(0,D)).map(a=>a.viewId)),b=a=>a.reason==="first"||H.has(a.viewId),g=r.filter(b).map(({viewId:a,reason:i})=>({viewId:a,reason:i})),F=r.filter(a=>!b(a)),x=[];for(let a of t){let i=m.get(a.from),u=m.get(a.to);!i||!u||x.push({id:a.id,kind:a.kind,style:I(a.kind,n.connectorOverrides??{}),x1:i.x,y1:i.y,x2:u.x,y2:u.y,opacity:a.opacity??1})}return{captures:g,draws:s,connectors:x,geometry:f,placements:h,captureCount:g.length,deferred:F.map(a=>a.viewId),culled:l,offCanvas:d}}function U(e,t,n,o){if(n===void 0)return"first";if(e.opacity!==void 0&&e.opacity<1)return"changed";switch(t.fidelity){case"full":return o?e.dirty||o.has(e.id)?"live":null:"live";case"summary":case"glyph":return e.dirty||o?.has(e.id)?"changed":null}}function Me(e,t=new Set){let n=e.nodes.map(r=>({id:r.id,plane:r.plane,x:r.x,y:r.y,width:Math.round(r.width),height:Math.round(r.height),dirty:t.has(r.id)||"opacity"in r&&r.opacity<1,opacity:"opacity"in r?r.opacity:1,...r.depth!==void 0?{depth:r.depth}:{},...r.plot&&e.city&&Math.round(r.plane)===2?{onPlot:!0}:{}})),o=e.connectors.map(r=>({id:r.id,kind:r.kind,from:r.from,to:r.to,opacity:"opacity"in r?r.opacity:1}));return{views:n,connectors:o}}function X(e){let t=e[0],n=e[5];return t===0||n===0?null:{scaleX:1/t,scaleY:1/n,translateX:e[12],translateY:e[13]}}function j(e,t,n){let o=X(e.transform);if(!o)return null;let r=(t-o.translateX)*o.scaleX,l=(n-o.translateY)*o.scaleY;return r<0||l<0||r>e.width||l>e.height?null:{placement:e,x:r,y:l}}function W(e,t,n){let o=null;for(let r of e){let l=j(r,t,n);l&&(!o||r.depth<o.placement.depth)&&(o=l)}return o}var $=["pointerdown","pointerup","click","dblclick","contextmenu"],O=class{constructor(t,n={}){this.canvas=t;this.options=n}placements=[];detachers=[];replaying=!1;setPlacements(t){this.placements=t}attach(){if(this.options.platformHandlesHitTesting)return()=>{};for(let t of this.options.events??$){let n=o=>this.route(o);this.canvas.addEventListener(t,n,!0),this.detachers.push(()=>this.canvas.removeEventListener(t,n,!0))}return()=>this.detach()}detach(){for(let t of this.detachers.splice(0))t()}deepestAt(t){let n=t.placement.element,o=n.getBoundingClientRect(),r=o.left+t.x,l=o.top+t.y,d=typeof document.elementsFromPoint=="function"?document.elementsFromPoint(r,l):[document.elementFromPoint(r,l)].filter(s=>s!==null);for(let s of d)if(s===n||n.contains(s))return s;return n}route(t){if(this.replaying)return;let n=this.canvas.getBoundingClientRect(),o=W(this.placements,t.clientX-n.left,t.clientY-n.top);if(!o)return;let l=o.placement.element.getBoundingClientRect(),d=this.deepestAt(o);t.preventDefault(),t.stopPropagation(),this.replaying=!0;try{d.dispatchEvent(new PointerEvent(t.type,{bubbles:!0,cancelable:!0,composed:!0,clientX:l.left+o.x,clientY:l.top+o.y,pointerId:t.pointerId,pointerType:t.pointerType,button:t.button,buttons:t.buttons,ctrlKey:t.ctrlKey,shiftKey:t.shiftKey,altKey:t.altKey,metaKey:t.metaKey})),t.type==="pointerdown"&&d instanceof HTMLElement&&d.focus({preventScroll:!0})}finally{this.replaying=!1}}};var q=16.666666666666668,k=e=>e==="gpu"||e==="dom"?e:null;function ve(e=globalThis){let t=k(e.graviewRenderer);if(t)return t;let n=e.location?.search;return n?k(new URLSearchParams(n).get("renderer")):null}function Re(e=globalThis){if(!e.navigator||!("gpu"in e.navigator))return!1;let t=e.GPUQueue?.prototype;if(!t)return!1;let n=typeof t.drawElementImageToTexture=="function"||typeof t.copyElementImageToTexture=="function",o=e.HTMLCanvasElement?.prototype;return!n||!o||typeof o.requestPaint!="function"?!1:Q(o)}function Q(e){return typeof e.captureElementImage=="function"&&!("layoutSubtree"in e)}function Te(e,{operator:t=null,present:n}){return(e==="auto"?t??"gpu":e)==="gpu"&&n?"gpu":"dom"}function Ie({off:e=!1,reducedMotion:t=!1,reducedTransparency:n=!1}){return!e&&!t&&!n}function z(e,t){if(e.length===0)return 0;let n=[...e].sort((o,r)=>o-r);return n[Math.min(n.length-1,Math.floor(t*n.length))]}function Ee(e,t=q){return z(e,.95)<=t}export{J as a,Z as b,v as c,ee as d,te as e,B as f,p as g,G as h,E as i,L as j,ye as k,I as l,oe as m,ae as n,le as o,ie as p,de as q,he as r,be as s,ge as t,K as u,xe as v,Pe as w,Me as x,O as y,q as z,ve as A,Re as B,Te as C,Ie as D,Ee as E};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{F as W,G,H as sn,I as z,J as D,L as P,La as pn,M as dn,Q as ln,T as _,Ta as hn,U as un,V as fn,W as H,X as cn,Y,Z as q,ac as X,cb as mn,da as J,fa as B,gb as wn,ha as yn,hc as $n,ia as gn,ta as Q}from"./chunk.6HY6ZGEE.js";var zn=864e5,j=e=>String(e).padStart(2,"0"),v=e=>new Date(e).toISOString().slice(0,10),E=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),Hn=(e,t)=>v(E(e)+t*zn),An=e=>new Date(E(e)).getUTCDay(),Yn=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e),nn=["sun","mon","tue","wed","thu","fri","sat"],Nn=e=>dn(e)??"UTC";function Mn(e,t){if(W.test(e))return v(E(e))===e?{day:e}:void 0;if(G.test(e))return{day:e.length===4?`${e}-01-01`:`${e}-01`};if(D.test(e)&&!Yn(e)){let l=e.slice(0,10);return v(E(l))!==l?void 0:{day:l,minutes:Number(e.slice(11,13))*60+Number(e.slice(14,16))}}let a=Date.parse(e);if(!Number.isNaN(a))return{...un(a,t),stamp:a}}var bn=["EEEE","EEE","MMMM","MMM","yyyy","HH","mm","h","a","d"],kn=/[A-Za-z]+/y;function qn(e){let t=[],a=0;for(;a<e.length;){let l=e[a];if(l==="'"){let f="",y=a+1;for(;y<e.length;y++){if(e[y]==="'"){if(e[y+1]==="'"){f+="'",y++;continue}break}f+=e[y]}if(y>=e.length)return`the quoted words in "${e}" are never closed`;t.push({text:f}),a=y+1;continue}kn.lastIndex=a;let u=kn.exec(e);if(u){let f=u[0];for(;f.length>0;){let y=bn.find($=>f.startsWith($));if(!y)return`"${f}" is not a piece of a date pattern; the pieces are ${bn.map($=>`${$}`).join(", ")}, and other words go in single quotes`;t.push(y),f=f.slice(y.length)}a+=u[0].length;continue}t.push({text:l}),a++}return t}var xn="UTC",Sn=new Map;function Jn(e,t){let a=`${e}|${JSON.stringify(t)}`,l=Sn.get(a);if(!l){try{l=new Intl.DateTimeFormat(e,{...t,timeZone:xn})}catch{l=new Intl.DateTimeFormat("en-US",{...t,timeZone:xn})}Sn.set(a,l)}return l}var C=(e,t,a,l)=>Jn(e,t).formatToParts(a).find(u=>u.type===l)?.value??"";function Rn(e,t,a){let l=qn(t);if(typeof l=="string")return{problem:l};let u=ln(a),f=E(e.day),y=e.minutes,$=y===void 0?void 0:f+y*6e4;return l.map(x=>{if(typeof x!="string")return x.text;switch(x){case"EEEE":return C(u,{weekday:"long"},f,"weekday");case"EEE":return C(u,{weekday:"short"},f,"weekday");case"MMMM":return C(u,{month:"long"},f,"month");case"MMM":return C(u,{month:"short"},f,"month");case"yyyy":return e.day.slice(0,4);case"d":return String(Number(e.day.slice(8,10)));case"HH":return y===void 0?"":j(Math.floor(y/60));case"mm":return y===void 0?"":j(y%60);case"h":return y===void 0?"":String((Math.floor(y/60)+11)%12+1);case"a":return $===void 0?"":C(u,{hour:"numeric",hour12:!0},$,"dayPeriod")}}).join("")}var Bn=/^(\d{1,2}):(\d{2})$/;function On(e){let t=Bn.exec(e.trim());if(!t)return;let a=Number(t[1]),l=Number(t[2]);return a<=23&&l<=59?a*60+l:void 0}var En=e=>new Date(e).toISOString().replace(/\.\d{3}Z$/,"Z"),Qn=(e,t)=>`${e}T${j(Math.floor(t/60))}:${j(t%60)}`;function Tn(e,t,a){return En(fn(e.day,t,a))}function Fn(e,t){if(e.stamp!==void 0)return En(e.stamp+t*6e4);let a=E(e.day)+(e.minutes??0)*6e4+t*6e4,l=v(a);return Qn(l,Math.round((a-E(l))/6e4))}var Gn=e=>nn[An(e.day)];function Dn(e,t){let a=(An(e.day)-nn.indexOf(t)+7)%7;return Hn(e.day,-a)}var Vn=e=>typeof e=="string"&&nn.includes(e);var Wn=1e4,w=class{constructor(t){this.nodes=t}},Cn=Symbol.for("@graview/core:far-record"),Xn=e=>typeof e=="object"&&e!==null&&e[Cn]===!0;function ne(e){let t={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(t,Cn,{value:!0}),t}function be(e){let t=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${t} is not one this viewer may open`:`${t} has not been read`}var ee="",g=class extends Error{constructor(a,l){super(a);this.sentence=a;this.at=l}},en=class extends g{},T=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof w)&&typeof e.id=="string",_n=e=>{let t=new Set;return new w(e.filter(a=>!t.has(a.id)&&t.add(a.id)))},k=e=>e===null?"nothing":e instanceof w?"a set of records":Array.isArray(e)?"a list":T(e)?"a record":typeof e=="string"?"a word":typeof e;function te(e,t){if(!G.test(e)&&!G.test(t))return;let a=f=>z(D.test(f)?f.slice(0,10):f),l=a(e),u=a(t);return l&&u?[l,u]:void 0}function In(e,t){let a=t.budget??Wn,l=(n,d)=>{if(a-=n,a<0)throw new en("this rule looks at too much of the graph to judge in one go",d)},u=t.today??P(),f=t.now??new Date().toISOString(),y=Nn(t.timeZone),$=new Map,x=new Set,S=t.bindings,rn=(n,d,o,i)=>{let p=`${n?.id}\0${d}`;if($.has(p))return $.get(p);if(x.has(p))throw new g(`"${d}"${n?` of ${Q(n.kind)}`:""} depends on itself`,i);x.add(p);let r=S;S=void 0;let s=a;a=Math.max(s,Wn);try{let c=A(o,n);return $.set(p,c),c}finally{a=s,S=r,x.delete(p)}},I=(n,d,o)=>{l(1,o);let i=t.kinds.get(n.kind),p=i?.computed?.get(d);if(p)return rn(n,d,p,o);let r=i?.linked?.get(d);if(r){let h=pn(Object.hasOwn(n,d)?n[d]:void 0,r);l(h.length,o);let b=t.linked??hn(t.graph),m=h.flatMap(N=>{let K=b?b(N):{unread:!0};return"record"in K?[ne(K.record)]:(t.onUnread?.({relation:d,ref:N,reason:"denied"in K?"denied":"unread"}),[])});return r.cardinality==="one"?m[0]??null:new w(m)}let s=Object.hasOwn(n,d);if(i?.fields.has(d)||s){let h=s?mn(n,d,u):void 0;return h===void 0?null:h}let c=i?.edges.get(d);if(c){let h=t.graph.out(n.id,d);return l(h.length,o),c==="one"?h[0]??null:new w(h)}if(d==="id")return n.id;if(Xn(n))return null;throw new g(`${Q(n.kind)} has no field or relation called "${d}"`,o)},M=(n,d,o)=>{if(n instanceof w)return n;if(n===null)return new w([]);if(T(n))return new w([n]);throw new g(`${o}(\u2026) needs a set of records, and was given ${k(n)}`,d)},O=(n,d,o)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new g(`${o}(\u2026) needs a word, and was given ${k(n)}`,d)},Z=(n,d,o)=>{let i=O(n,d,o);if(i===null)return null;let p=G.test(i)?z(i).from:i,r=Date.parse(p.length===10?`${p}T00:00:00Z`:p);if(Number.isNaN(r))throw new g(`${o}(\u2026) needs a date, and "${i}" is not one`,d);return r},V=(n,d,o)=>{if(n===null)return null;if(typeof n!="string")throw new g(`${o}(\u2026) needs a date, and was given ${k(n)}`,d);let i=Mn(n,y);if(!i)throw new g(`${o}(\u2026) needs a date, and "${n}" is not one`,d);return i},F=(n,d)=>T(n)&&T(d)?n.id===d.id:T(n)&&typeof d=="string"?n.id===d:typeof n=="string"&&T(d)?n===d.id:Array.isArray(n)&&Array.isArray(d)?n.length===d.length&&n.every((o,i)=>F(o,d[i])):n===d,R=(n,d,o)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new g(`${o} must be true or false, and was ${k(n)}`,d)},L=(n,d)=>A(d,n);function A(n,d){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(o=>A(o,d));case"ident":{let o=S&&Object.hasOwn(S,n.name)?S[n.name]:void 0;if(o!==void 0)return o;if(d)return I(d,n.name,n.at);throw new g(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let o=A(n.object,d);if(o===null)return null;if(T(o))return I(o,n.name,n.at);throw new g(`".${n.name}" needs a record before it, and was given ${k(o)}`,n.at)}case"unary":{let o=A(n.operand,d);if(n.op==="!")return!R(o,n.at,"what follows not");if(o===null)return null;if(typeof o!="number")throw new g(`"-" needs a number, and was given ${k(o)}`,n.at);return-o}case"where":{let o=M(A(n.set,d),n.at,"where");return l(o.nodes.length,n.at),new w(o.nodes.filter(i=>R(L(i,n.filter),n.at,"a where condition")))}case"binary":return Zn(n,d);case"call":return Kn(n,d)}}function Zn(n,d){if(n.op==="&&")return R(A(n.left,d),n.at,"each side of and")&&R(A(n.right,d),n.at,"each side of and");if(n.op==="||")return R(A(n.left,d),n.at,"each side of or")||R(A(n.right,d),n.at,"each side of or");let o=A(n.left,d),i=A(n.right,d);if(n.op==="&"||n.op==="|"||n.op==="-"&&(o instanceof w||i instanceof w)){let p=M(o,n.at,n.op).nodes,r=M(i,n.at,n.op).nodes;l(p.length+r.length,n.at);let s=new Set(r.map(c=>c.id));return _n(n.op==="|"?[...p,...r]:p.filter(c=>s.has(c.id)===(n.op==="&")))}switch(n.op){case"==":return F(o,i);case"!=":return!F(o,i);case"in":{if(i===null)return!1;if(i instanceof w)return i.nodes.some(p=>F(o,p));if(Array.isArray(i))return i.some(p=>F(o,p));if(typeof i=="string"&&typeof o=="string")return i.includes(o);throw new g(`"in" needs a list or a set on its right, and was given ${k(i)}`,n.at)}case"<":case"<=":case">":case">=":{if(o===null||i===null)return!1;if(!(typeof o=="number"&&typeof i=="number"||typeof o=="string"&&typeof i=="string"))throw new g(`cannot compare ${k(o)} with ${k(i)}`,n.at);let r=typeof o=="string"&&typeof i=="string"?te(o,i):void 0;if(r){let[s,c]=r,h=s.to<c.from,b=s.from>c.to,m=s.from===c.from&&s.to===c.to;return n.op==="<"?h:n.op==="<="?h||m:n.op===">"?b:b||m}return n.op==="<"?o<i:n.op==="<="?o<=i:n.op===">"?o>i:o>=i}default:{if(o===null||i===null)return null;if(n.op==="+"&&(typeof o=="string"||typeof i=="string")){let p=`${O(o,n.at,"+")}${O(i,n.at,"+")}`;if(p.length>1e4)throw new g("that makes a word too long",n.at);return p}if(typeof o!="number"||typeof i!="number")throw new g(`"${n.op}" needs numbers, and was given ${k(o)} and ${k(i)}`,n.at);return(n.op==="/"||n.op==="%")&&i===0?null:n.op==="+"?o+i:n.op==="-"?o-i:n.op==="*"?o*i:n.op==="/"?o/i:o%i}}}function on(n,d){let o=n.t==="call"&&(n.fn==="in"||n.fn==="out")&&n.args.length===1?n.args[0]:void 0;if(!(!d||o?.t!=="lit"||typeof o.value!="string"))return l(1,n.at),n.fn==="out"?t.graph.out(d.id,o.value):t.graph.in(d.id,o.value)}function Kn(n,d){let o=(r,s=r)=>{if(n.args.length<r||n.args.length>s)throw new g(`${n.fn}(\u2026) takes ${r===s?r:`${r} to ${s}`} argument${s===1?"":"s"}`,n.at)},i=r=>A(n.args[r],d),p=r=>{let s=i(r);if(typeof s!="string")throw new g(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return s};switch(n.fn){case"out":case"in":{o(1,2);let r=(h,b)=>n.fn==="out"?t.graph.out(h,b):t.graph.in(h,b);if(n.args.length===2){let h=M(i(0),n.at,n.fn).nodes,b=p(1);return _n(h.flatMap(m=>{let N=r(m.id,b);return l(N.length+1,n.at),N}))}let s=p(0);if(!d)throw new g(`${n.fn}('${s}') needs a record to start from`,n.at);let c=r(d.id,s);return l(c.length,n.at),new w(c)}case"all":{o(1,2);let r=t.graph.nodesOfKind(p(0),{archived:n.args.length===2?i(1):!1});return l(r.length,n.at),new w(r)}case"archived":return o(0,1),wn(n.args.length===1?i(0):d);case"count":return o(1),(on(n.args[0],d)??M(i(0),n.at,"count").nodes).length;case"exists":return o(1),(on(n.args[0],d)??M(i(0),n.at,"exists").nodes).length>0;case"every":case"some":{o(2);let r=M(i(0),n.at,n.fn);l(r.nodes.length,n.at);let s=c=>R(L(c,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(s):r.nodes.some(s)}case"sum":case"min":case"max":{o(2);let r=M(i(0),n.at,n.fn);l(r.nodes.length,n.at);let s=n.args[1],c=s.t==="lit"&&typeof s.value=="string"?s.value:void 0,h=s.t==="ident"?`'${s.name}'`:c!==void 0?`'${c}'`:"\u2026",b=r.nodes.map(m=>s.t==="ident"?I(m,s.name,n.at):c!==void 0?I(m,c,n.at):L(m,s)).filter(m=>{if(m===null)return!1;if(typeof m!="number")throw new g(`${n.fn}(\u2026, ${h}) needs a number for each member, and found ${k(m)}`,n.at);return!0});return n.fn==="sum"?b.reduce((m,N)=>m+N,0):b.length===0?null:n.fn==="min"?Math.min(...b):Math.max(...b)}case"fact":{o(1);let r=p(0),s=t.kinds.get(ee)?.computed?.get(r);if(!s)throw new g(`no fact is called "${r}"`,n.at);return rn(null,r,s,n.at)}case"first":return o(1),M(i(0),n.at,"first").nodes[0]??null;case"sort":{o(2,3);let r=M(i(0),n.at,"sort"),s=n.args.length===3?i(2):"asc";if(s!=="asc"&&s!=="desc")throw new g("sort(\u2026) goes 'asc' or 'desc'",n.at);let c=r.nodes.length;l(c+c*Math.ceil(Math.log2(c+1)),n.at);let h=r.nodes.map((m,N)=>({node:m,i:N,key:L(m,n.args[1])})),b=s==="desc"?-1:1;return h.sort((m,N)=>an(m.key,N.key,b,n.at)||m.i-N.i),new w(h.map(m=>m.node))}case"either":{if(n.args.length<1)throw new g("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let s=i(r);if(s!==null&&!(s instanceof w&&s.nodes.length===0))return s}return null}case"present":{o(1);let r=i(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof w?r.nodes.length>0:!0}case"len":{o(1);let r=i(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof w)return r.nodes.length;throw new g(`len(\u2026) needs a word or a list, and was given ${k(r)}`,n.at)}case"contains":case"startsWith":{o(2);let r=i(0),s=i(1);if(r===null||s===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(b=>F(b,s));let c=O(r,n.at,n.fn),h=O(s,n.at,n.fn);return n.fn==="contains"?c.toLowerCase().includes(h.toLowerCase()):c.startsWith(h)}case"lower":{o(1);let r=O(i(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"concat":{if(n.args.length<1)throw new g("concat(\u2026) takes at least one argument",n.at);let r="";for(let s=0;s<n.args.length;s++)r+=O(i(s),n.at,"concat")??"";if(r.length>1e4)throw new g("that makes a word too long",n.at);return r}case"format":{o(2);let r=V(i(0),n.at,"format"),s=i(1);if(typeof s!="string")throw new g("format(\u2026) says its pattern in quotes, like format(start, 'EEE h:mm a')",n.at);if(r===null)return null;let c=Rn(r,s,t.locale);if(typeof c!="string")throw new g(c.problem,n.at);return c}case"datetime":case"at":{o(2);let r=V(i(0),n.at,n.fn),s=i(1);if(s===null||r===null)return null;let c=typeof s=="string"?On(s):void 0;if(c===void 0)throw new g(`${n.fn}(\u2026) needs a time of day written like '09:30', and was given ${typeof s=="string"?`"${s}"`:k(s)}`,n.at);return Tn(r,c,y)}case"addMinutes":{o(2);let r=V(i(0),n.at,"addMinutes"),s=i(1);if(r===null||s===null)return null;if(typeof s!="number"||!Number.isFinite(s))throw new g(`addMinutes(\u2026) needs a number of minutes, and was given ${k(s)}`,n.at);return Fn(r,Math.round(s))}case"weekday":{o(1);let r=V(i(0),n.at,"weekday");return r===null?null:Gn(r)}case"startOfWeek":{o(1,2);let r=V(i(0),n.at,"startOfWeek"),s=n.args.length===2?i(1):"mon";if(!Vn(s))throw new g("startOfWeek(\u2026) starts the week on a day said 'mon' to 'sun'",n.at);return r===null?null:Dn(r,s)}case"today":return o(0),u;case"now":return o(0),f;case"date":{o(1);let r=Z(i(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{o(2);let r=Z(i(0),n.at,n.fn),s=Z(i(1),n.at,n.fn);if(r===null||s===null)return null;let c=(s-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(c):c}case"round":{o(1,2);let r=i(0);if(r===null)return null;if(typeof r!="number")throw new g(`round(\u2026) needs a number, and was given ${k(r)}`,n.at);let s=n.args.length===2?i(1):0;if(typeof s!="number"||!Number.isInteger(s)||s<0||s>12)throw new g("round(\u2026, places) takes a whole number of places from 0 to 12",n.at);let c=10**s,h=Math.sign(r)*Math.round(Math.abs(r)*c*(1+Number.EPSILON))/c;return Object.is(h,-0)?0:h}case"if":return o(3),R(i(0),n.at,"the condition in if(\u2026)")?i(1):i(2);default:throw new g(`"${n.fn}" is not a function the rule language knows`,n.at)}}function an(n,d,o,i){if(n===null||d===null)return n===d?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(d)){for(let r=0;r<Math.max(n.length,d.length);r++){let s=an(n[r]??null,d[r]??null,o,i);if(s!==0)return s}return 0}let p=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:k(r);if(p(n)!==p(d)||typeof n=="object"||typeof d=="object")throw new g(`sort(\u2026) cannot put ${k(n)} and ${k(d)} in order`,i);return typeof n=="string"?o*(n<d?-1:n>d?1:0):o*(Number(n)-Number(d))}return A(e,t.subject)}var ke=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact","archived","round","concat","format","datetime","at","addMinutes","weekday","startOfWeek"];var re=(e,t,a,l,u)=>({severity:"error",code:e,path:t,message:a,...l?{fix:l}:{},...u}),Se=(e,t,a,l,u)=>({...re(e,t,a,l,u?.length?{edits:u}:void 0),severity:"warning"}),Ae=e=>e.some(t=>t.severity==="error");function oe(e,t){return[...(e.edits??[]).map(a=>`${t}edit: ${JSON.stringify(a)}`),...e.details?[`${t}details: ${e.details}`]:[],...(e.fixes??[]).flatMap(a=>[`${t}fix: ${a.label}`,...(a.edits??[]).map(l=>`${t} edit: ${JSON.stringify(l)}`)])].map(a=>`
|
|
1
|
+
import{F as W,G,H as sn,I as z,J as D,L as P,La as pn,M as dn,Q as ln,T as _,Ta as hn,U as un,V as fn,W as H,X as cn,Y,Z as q,ac as X,cb as mn,da as J,fa as B,gb as wn,ha as yn,hc as $n,ia as gn,ta as Q}from"./chunk.ZEZUKRC6.js";var zn=864e5,j=e=>String(e).padStart(2,"0"),v=e=>new Date(e).toISOString().slice(0,10),E=e=>Date.UTC(+e.slice(0,4),+e.slice(5,7)-1,+e.slice(8,10)),Hn=(e,t)=>v(E(e)+t*zn),An=e=>new Date(E(e)).getUTCDay(),Yn=e=>/T\d\d:\d\d(:[\d.]+)?(Z|[+-]\d\d:?\d\d)$/.test(e),nn=["sun","mon","tue","wed","thu","fri","sat"],Nn=e=>dn(e)??"UTC";function Mn(e,t){if(W.test(e))return v(E(e))===e?{day:e}:void 0;if(G.test(e))return{day:e.length===4?`${e}-01-01`:`${e}-01`};if(D.test(e)&&!Yn(e)){let l=e.slice(0,10);return v(E(l))!==l?void 0:{day:l,minutes:Number(e.slice(11,13))*60+Number(e.slice(14,16))}}let a=Date.parse(e);if(!Number.isNaN(a))return{...un(a,t),stamp:a}}var bn=["EEEE","EEE","MMMM","MMM","yyyy","HH","mm","h","a","d"],kn=/[A-Za-z]+/y;function qn(e){let t=[],a=0;for(;a<e.length;){let l=e[a];if(l==="'"){let f="",y=a+1;for(;y<e.length;y++){if(e[y]==="'"){if(e[y+1]==="'"){f+="'",y++;continue}break}f+=e[y]}if(y>=e.length)return`the quoted words in "${e}" are never closed`;t.push({text:f}),a=y+1;continue}kn.lastIndex=a;let u=kn.exec(e);if(u){let f=u[0];for(;f.length>0;){let y=bn.find($=>f.startsWith($));if(!y)return`"${f}" is not a piece of a date pattern; the pieces are ${bn.map($=>`${$}`).join(", ")}, and other words go in single quotes`;t.push(y),f=f.slice(y.length)}a+=u[0].length;continue}t.push({text:l}),a++}return t}var xn="UTC",Sn=new Map;function Jn(e,t){let a=`${e}|${JSON.stringify(t)}`,l=Sn.get(a);if(!l){try{l=new Intl.DateTimeFormat(e,{...t,timeZone:xn})}catch{l=new Intl.DateTimeFormat("en-US",{...t,timeZone:xn})}Sn.set(a,l)}return l}var C=(e,t,a,l)=>Jn(e,t).formatToParts(a).find(u=>u.type===l)?.value??"";function Rn(e,t,a){let l=qn(t);if(typeof l=="string")return{problem:l};let u=ln(a),f=E(e.day),y=e.minutes,$=y===void 0?void 0:f+y*6e4;return l.map(x=>{if(typeof x!="string")return x.text;switch(x){case"EEEE":return C(u,{weekday:"long"},f,"weekday");case"EEE":return C(u,{weekday:"short"},f,"weekday");case"MMMM":return C(u,{month:"long"},f,"month");case"MMM":return C(u,{month:"short"},f,"month");case"yyyy":return e.day.slice(0,4);case"d":return String(Number(e.day.slice(8,10)));case"HH":return y===void 0?"":j(Math.floor(y/60));case"mm":return y===void 0?"":j(y%60);case"h":return y===void 0?"":String((Math.floor(y/60)+11)%12+1);case"a":return $===void 0?"":C(u,{hour:"numeric",hour12:!0},$,"dayPeriod")}}).join("")}var Bn=/^(\d{1,2}):(\d{2})$/;function On(e){let t=Bn.exec(e.trim());if(!t)return;let a=Number(t[1]),l=Number(t[2]);return a<=23&&l<=59?a*60+l:void 0}var En=e=>new Date(e).toISOString().replace(/\.\d{3}Z$/,"Z"),Qn=(e,t)=>`${e}T${j(Math.floor(t/60))}:${j(t%60)}`;function Tn(e,t,a){return En(fn(e.day,t,a))}function Fn(e,t){if(e.stamp!==void 0)return En(e.stamp+t*6e4);let a=E(e.day)+(e.minutes??0)*6e4+t*6e4,l=v(a);return Qn(l,Math.round((a-E(l))/6e4))}var Gn=e=>nn[An(e.day)];function Dn(e,t){let a=(An(e.day)-nn.indexOf(t)+7)%7;return Hn(e.day,-a)}var Vn=e=>typeof e=="string"&&nn.includes(e);var Wn=1e4,w=class{constructor(t){this.nodes=t}},Cn=Symbol.for("@graview/core:far-record"),Xn=e=>typeof e=="object"&&e!==null&&e[Cn]===!0;function ne(e){let t={...e.fields,id:`@${e.address}/${e.kind}:${e.id}`,kind:`@${e.address}/${e.kind}`,label:e.label};return Object.defineProperty(t,Cn,{value:!0}),t}function be(e){let t=`the linked record in ${e.ref.address}`;return e.reason==="denied"?`${t} is not one this viewer may open`:`${t} has not been read`}var ee="",g=class extends Error{constructor(a,l){super(a);this.sentence=a;this.at=l}},en=class extends g{},T=e=>e!==null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof w)&&typeof e.id=="string",_n=e=>{let t=new Set;return new w(e.filter(a=>!t.has(a.id)&&t.add(a.id)))},k=e=>e===null?"nothing":e instanceof w?"a set of records":Array.isArray(e)?"a list":T(e)?"a record":typeof e=="string"?"a word":typeof e;function te(e,t){if(!G.test(e)&&!G.test(t))return;let a=f=>z(D.test(f)?f.slice(0,10):f),l=a(e),u=a(t);return l&&u?[l,u]:void 0}function In(e,t){let a=t.budget??Wn,l=(n,d)=>{if(a-=n,a<0)throw new en("this rule looks at too much of the graph to judge in one go",d)},u=t.today??P(),f=t.now??new Date().toISOString(),y=Nn(t.timeZone),$=new Map,x=new Set,S=t.bindings,rn=(n,d,o,i)=>{let p=`${n?.id}\0${d}`;if($.has(p))return $.get(p);if(x.has(p))throw new g(`"${d}"${n?` of ${Q(n.kind)}`:""} depends on itself`,i);x.add(p);let r=S;S=void 0;let s=a;a=Math.max(s,Wn);try{let c=A(o,n);return $.set(p,c),c}finally{a=s,S=r,x.delete(p)}},I=(n,d,o)=>{l(1,o);let i=t.kinds.get(n.kind),p=i?.computed?.get(d);if(p)return rn(n,d,p,o);let r=i?.linked?.get(d);if(r){let h=pn(Object.hasOwn(n,d)?n[d]:void 0,r);l(h.length,o);let b=t.linked??hn(t.graph),m=h.flatMap(N=>{let K=b?b(N):{unread:!0};return"record"in K?[ne(K.record)]:(t.onUnread?.({relation:d,ref:N,reason:"denied"in K?"denied":"unread"}),[])});return r.cardinality==="one"?m[0]??null:new w(m)}let s=Object.hasOwn(n,d);if(i?.fields.has(d)||s){let h=s?mn(n,d,u):void 0;return h===void 0?null:h}let c=i?.edges.get(d);if(c){let h=t.graph.out(n.id,d);return l(h.length,o),c==="one"?h[0]??null:new w(h)}if(d==="id")return n.id;if(Xn(n))return null;throw new g(`${Q(n.kind)} has no field or relation called "${d}"`,o)},M=(n,d,o)=>{if(n instanceof w)return n;if(n===null)return new w([]);if(T(n))return new w([n]);throw new g(`${o}(\u2026) needs a set of records, and was given ${k(n)}`,d)},O=(n,d,o)=>{if(n===null)return null;if(typeof n=="string")return n;if(typeof n=="number"||typeof n=="boolean")return String(n);throw new g(`${o}(\u2026) needs a word, and was given ${k(n)}`,d)},Z=(n,d,o)=>{let i=O(n,d,o);if(i===null)return null;let p=G.test(i)?z(i).from:i,r=Date.parse(p.length===10?`${p}T00:00:00Z`:p);if(Number.isNaN(r))throw new g(`${o}(\u2026) needs a date, and "${i}" is not one`,d);return r},V=(n,d,o)=>{if(n===null)return null;if(typeof n!="string")throw new g(`${o}(\u2026) needs a date, and was given ${k(n)}`,d);let i=Mn(n,y);if(!i)throw new g(`${o}(\u2026) needs a date, and "${n}" is not one`,d);return i},F=(n,d)=>T(n)&&T(d)?n.id===d.id:T(n)&&typeof d=="string"?n.id===d:typeof n=="string"&&T(d)?n===d.id:Array.isArray(n)&&Array.isArray(d)?n.length===d.length&&n.every((o,i)=>F(o,d[i])):n===d,R=(n,d,o)=>{if(n===null)return!1;if(typeof n=="boolean")return n;throw new g(`${o} must be true or false, and was ${k(n)}`,d)},L=(n,d)=>A(d,n);function A(n,d){switch(l(1,n.at),n.t){case"lit":return n.value;case"list":return n.items.map(o=>A(o,d));case"ident":{let o=S&&Object.hasOwn(S,n.name)?S[n.name]:void 0;if(o!==void 0)return o;if(d)return I(d,n.name,n.at);throw new g(`"${n.name}" means nothing in a rule over the whole graph`,n.at)}case"member":{let o=A(n.object,d);if(o===null)return null;if(T(o))return I(o,n.name,n.at);throw new g(`".${n.name}" needs a record before it, and was given ${k(o)}`,n.at)}case"unary":{let o=A(n.operand,d);if(n.op==="!")return!R(o,n.at,"what follows not");if(o===null)return null;if(typeof o!="number")throw new g(`"-" needs a number, and was given ${k(o)}`,n.at);return-o}case"where":{let o=M(A(n.set,d),n.at,"where");return l(o.nodes.length,n.at),new w(o.nodes.filter(i=>R(L(i,n.filter),n.at,"a where condition")))}case"binary":return Zn(n,d);case"call":return Kn(n,d)}}function Zn(n,d){if(n.op==="&&")return R(A(n.left,d),n.at,"each side of and")&&R(A(n.right,d),n.at,"each side of and");if(n.op==="||")return R(A(n.left,d),n.at,"each side of or")||R(A(n.right,d),n.at,"each side of or");let o=A(n.left,d),i=A(n.right,d);if(n.op==="&"||n.op==="|"||n.op==="-"&&(o instanceof w||i instanceof w)){let p=M(o,n.at,n.op).nodes,r=M(i,n.at,n.op).nodes;l(p.length+r.length,n.at);let s=new Set(r.map(c=>c.id));return _n(n.op==="|"?[...p,...r]:p.filter(c=>s.has(c.id)===(n.op==="&")))}switch(n.op){case"==":return F(o,i);case"!=":return!F(o,i);case"in":{if(i===null)return!1;if(i instanceof w)return i.nodes.some(p=>F(o,p));if(Array.isArray(i))return i.some(p=>F(o,p));if(typeof i=="string"&&typeof o=="string")return i.includes(o);throw new g(`"in" needs a list or a set on its right, and was given ${k(i)}`,n.at)}case"<":case"<=":case">":case">=":{if(o===null||i===null)return!1;if(!(typeof o=="number"&&typeof i=="number"||typeof o=="string"&&typeof i=="string"))throw new g(`cannot compare ${k(o)} with ${k(i)}`,n.at);let r=typeof o=="string"&&typeof i=="string"?te(o,i):void 0;if(r){let[s,c]=r,h=s.to<c.from,b=s.from>c.to,m=s.from===c.from&&s.to===c.to;return n.op==="<"?h:n.op==="<="?h||m:n.op===">"?b:b||m}return n.op==="<"?o<i:n.op==="<="?o<=i:n.op===">"?o>i:o>=i}default:{if(o===null||i===null)return null;if(n.op==="+"&&(typeof o=="string"||typeof i=="string")){let p=`${O(o,n.at,"+")}${O(i,n.at,"+")}`;if(p.length>1e4)throw new g("that makes a word too long",n.at);return p}if(typeof o!="number"||typeof i!="number")throw new g(`"${n.op}" needs numbers, and was given ${k(o)} and ${k(i)}`,n.at);return(n.op==="/"||n.op==="%")&&i===0?null:n.op==="+"?o+i:n.op==="-"?o-i:n.op==="*"?o*i:n.op==="/"?o/i:o%i}}}function on(n,d){let o=n.t==="call"&&(n.fn==="in"||n.fn==="out")&&n.args.length===1?n.args[0]:void 0;if(!(!d||o?.t!=="lit"||typeof o.value!="string"))return l(1,n.at),n.fn==="out"?t.graph.out(d.id,o.value):t.graph.in(d.id,o.value)}function Kn(n,d){let o=(r,s=r)=>{if(n.args.length<r||n.args.length>s)throw new g(`${n.fn}(\u2026) takes ${r===s?r:`${r} to ${s}`} argument${s===1?"":"s"}`,n.at)},i=r=>A(n.args[r],d),p=r=>{let s=i(r);if(typeof s!="string")throw new g(`${n.fn}(\u2026) needs a quoted name, like ${n.fn}('name')`,n.at);return s};switch(n.fn){case"out":case"in":{o(1,2);let r=(h,b)=>n.fn==="out"?t.graph.out(h,b):t.graph.in(h,b);if(n.args.length===2){let h=M(i(0),n.at,n.fn).nodes,b=p(1);return _n(h.flatMap(m=>{let N=r(m.id,b);return l(N.length+1,n.at),N}))}let s=p(0);if(!d)throw new g(`${n.fn}('${s}') needs a record to start from`,n.at);let c=r(d.id,s);return l(c.length,n.at),new w(c)}case"all":{o(1,2);let r=t.graph.nodesOfKind(p(0),{archived:n.args.length===2?i(1):!1});return l(r.length,n.at),new w(r)}case"archived":return o(0,1),wn(n.args.length===1?i(0):d);case"count":return o(1),(on(n.args[0],d)??M(i(0),n.at,"count").nodes).length;case"exists":return o(1),(on(n.args[0],d)??M(i(0),n.at,"exists").nodes).length>0;case"every":case"some":{o(2);let r=M(i(0),n.at,n.fn);l(r.nodes.length,n.at);let s=c=>R(L(c,n.args[1]),n.at,`the condition in ${n.fn}(\u2026)`);return n.fn==="every"?r.nodes.every(s):r.nodes.some(s)}case"sum":case"min":case"max":{o(2);let r=M(i(0),n.at,n.fn);l(r.nodes.length,n.at);let s=n.args[1],c=s.t==="lit"&&typeof s.value=="string"?s.value:void 0,h=s.t==="ident"?`'${s.name}'`:c!==void 0?`'${c}'`:"\u2026",b=r.nodes.map(m=>s.t==="ident"?I(m,s.name,n.at):c!==void 0?I(m,c,n.at):L(m,s)).filter(m=>{if(m===null)return!1;if(typeof m!="number")throw new g(`${n.fn}(\u2026, ${h}) needs a number for each member, and found ${k(m)}`,n.at);return!0});return n.fn==="sum"?b.reduce((m,N)=>m+N,0):b.length===0?null:n.fn==="min"?Math.min(...b):Math.max(...b)}case"fact":{o(1);let r=p(0),s=t.kinds.get(ee)?.computed?.get(r);if(!s)throw new g(`no fact is called "${r}"`,n.at);return rn(null,r,s,n.at)}case"first":return o(1),M(i(0),n.at,"first").nodes[0]??null;case"sort":{o(2,3);let r=M(i(0),n.at,"sort"),s=n.args.length===3?i(2):"asc";if(s!=="asc"&&s!=="desc")throw new g("sort(\u2026) goes 'asc' or 'desc'",n.at);let c=r.nodes.length;l(c+c*Math.ceil(Math.log2(c+1)),n.at);let h=r.nodes.map((m,N)=>({node:m,i:N,key:L(m,n.args[1])})),b=s==="desc"?-1:1;return h.sort((m,N)=>an(m.key,N.key,b,n.at)||m.i-N.i),new w(h.map(m=>m.node))}case"either":{if(n.args.length<1)throw new g("either(\u2026) takes at least one argument",n.at);for(let r=0;r<n.args.length;r++){let s=i(r);if(s!==null&&!(s instanceof w&&s.nodes.length===0))return s}return null}case"present":{o(1);let r=i(0);return r===null||r===""?!1:Array.isArray(r)?r.length>0:r instanceof w?r.nodes.length>0:!0}case"len":{o(1);let r=i(0);if(r===null)return 0;if(typeof r=="string"||Array.isArray(r))return r.length;if(r instanceof w)return r.nodes.length;throw new g(`len(\u2026) needs a word or a list, and was given ${k(r)}`,n.at)}case"contains":case"startsWith":{o(2);let r=i(0),s=i(1);if(r===null||s===null)return!1;if(n.fn==="contains"&&Array.isArray(r))return r.some(b=>F(b,s));let c=O(r,n.at,n.fn),h=O(s,n.at,n.fn);return n.fn==="contains"?c.toLowerCase().includes(h.toLowerCase()):c.startsWith(h)}case"lower":{o(1);let r=O(i(0),n.at,"lower");return r===null?null:r.toLowerCase()}case"concat":{if(n.args.length<1)throw new g("concat(\u2026) takes at least one argument",n.at);let r="";for(let s=0;s<n.args.length;s++)r+=O(i(s),n.at,"concat")??"";if(r.length>1e4)throw new g("that makes a word too long",n.at);return r}case"format":{o(2);let r=V(i(0),n.at,"format"),s=i(1);if(typeof s!="string")throw new g("format(\u2026) says its pattern in quotes, like format(start, 'EEE h:mm a')",n.at);if(r===null)return null;let c=Rn(r,s,t.locale);if(typeof c!="string")throw new g(c.problem,n.at);return c}case"datetime":case"at":{o(2);let r=V(i(0),n.at,n.fn),s=i(1);if(s===null||r===null)return null;let c=typeof s=="string"?On(s):void 0;if(c===void 0)throw new g(`${n.fn}(\u2026) needs a time of day written like '09:30', and was given ${typeof s=="string"?`"${s}"`:k(s)}`,n.at);return Tn(r,c,y)}case"addMinutes":{o(2);let r=V(i(0),n.at,"addMinutes"),s=i(1);if(r===null||s===null)return null;if(typeof s!="number"||!Number.isFinite(s))throw new g(`addMinutes(\u2026) needs a number of minutes, and was given ${k(s)}`,n.at);return Fn(r,Math.round(s))}case"weekday":{o(1);let r=V(i(0),n.at,"weekday");return r===null?null:Gn(r)}case"startOfWeek":{o(1,2);let r=V(i(0),n.at,"startOfWeek"),s=n.args.length===2?i(1):"mon";if(!Vn(s))throw new g("startOfWeek(\u2026) starts the week on a day said 'mon' to 'sun'",n.at);return r===null?null:Dn(r,s)}case"today":return o(0),u;case"now":return o(0),f;case"date":{o(1);let r=Z(i(0),n.at,"date");return r===null?null:new Date(r).toISOString().slice(0,10)}case"days":case"hours":{o(2);let r=Z(i(0),n.at,n.fn),s=Z(i(1),n.at,n.fn);if(r===null||s===null)return null;let c=(s-r)/(n.fn==="days"?864e5:36e5);return n.fn==="days"?Math.round(c):c}case"round":{o(1,2);let r=i(0);if(r===null)return null;if(typeof r!="number")throw new g(`round(\u2026) needs a number, and was given ${k(r)}`,n.at);let s=n.args.length===2?i(1):0;if(typeof s!="number"||!Number.isInteger(s)||s<0||s>12)throw new g("round(\u2026, places) takes a whole number of places from 0 to 12",n.at);let c=10**s,h=Math.sign(r)*Math.round(Math.abs(r)*c*(1+Number.EPSILON))/c;return Object.is(h,-0)?0:h}case"if":return o(3),R(i(0),n.at,"the condition in if(\u2026)")?i(1):i(2);default:throw new g(`"${n.fn}" is not a function the rule language knows`,n.at)}}function an(n,d,o,i){if(n===null||d===null)return n===d?0:n===null?1:-1;if(Array.isArray(n)&&Array.isArray(d)){for(let r=0;r<Math.max(n.length,d.length);r++){let s=an(n[r]??null,d[r]??null,o,i);if(s!==0)return s}return 0}let p=r=>typeof r=="number"||typeof r=="string"||typeof r=="boolean"?typeof r:k(r);if(p(n)!==p(d)||typeof n=="object"||typeof d=="object")throw new g(`sort(\u2026) cannot put ${k(n)} and ${k(d)} in order`,i);return typeof n=="string"?o*(n<d?-1:n>d?1:0):o*(Number(n)-Number(d))}return A(e,t.subject)}var ke=["out","in","all","count","exists","every","some","sum","min","max","present","len","contains","startsWith","lower","today","now","date","days","hours","if","first","sort","either","fact","archived","round","concat","format","datetime","at","addMinutes","weekday","startOfWeek"];var re=(e,t,a,l,u)=>({severity:"error",code:e,path:t,message:a,...l?{fix:l}:{},...u}),Se=(e,t,a,l,u)=>({...re(e,t,a,l,u?.length?{edits:u}:void 0),severity:"warning"}),Ae=e=>e.some(t=>t.severity==="error");function oe(e,t){return[...(e.edits??[]).map(a=>`${t}edit: ${JSON.stringify(a)}`),...e.details?[`${t}details: ${e.details}`]:[],...(e.fixes??[]).flatMap(a=>[`${t}fix: ${a.label}`,...(a.edits??[]).map(l=>`${t} edit: ${JSON.stringify(l)}`)])].map(a=>`
|
|
2
2
|
${a}`).join("")}function Ne(e){return e.map(t=>`${t.severity==="error"?"\u2717":t.severity==="warning"?"!":"\xB7"} ${t.path||"(document)"}: ${t.message}${t.fix?` \u2014 ${t.fix}`:""}${oe(t," ")}`).join(`
|
|
3
3
|
`)}var ie=(e,t)=>e.to==="*"||e.to.includes(t);function Ln(e,t,a){let l=a(e);if(l){if(t.some(u=>l.from.includes(u)))return{step:{relation:e,out:!0},far:l.to};if(t.some(u=>ie(l,u)))return{step:{relation:e,out:!1},far:l.from}}}function Re(e,t,a,l){if(!l(t.every))return{problem:{key:"every",message:`"${t.every}" is not a kind this document declares`}};let u=Ln(t.through,[e],a);if(!u){let S=a(t.through);return{problem:{key:"through",message:S?`"${t.through}" is a relation of ${S.from.join(", ")}, not of ${e}, so a ${e} cannot be followed through it`:`"${t.through}" is not a relation any kind declares`,fix:S?`name a relation ${e} declares, or one that points at ${e}`:void 0}}}let f=u.far==="*"?"*":u.far;if(!t.via)return f==="*"||f.includes(t.every)?{plan:{every:t.every,through:u.step}}:{problem:{key:"through",message:`"${t.through}" reaches ${f.join(", ")}, not ${t.every}`,fix:`add "via": the relation from ${f.join(" or ")} to ${t.every}, or name a relation that reaches ${t.every}`}};let y=f==="*"?[t.every]:f,$=Ln(t.via,y,a);if(!$){let S=a(t.via);return{problem:{key:"via",message:S?`"${t.via}" is a relation of ${S.from.join(", ")}, which "${t.through}" does not reach`:`"${t.via}" is not a relation any kind declares`,fix:S?`name a relation of ${y.join(" or ")}, or one that points at it`:void 0}}}let x=f==="*"?[t.every]:$.far;return x==="*"||x.includes(t.every)?{plan:{every:t.every,through:u.step,via:f==="*"?{relation:$.step.relation,out:!$.step.out}:$.step}}:{problem:{key:"via",message:`"${t.via}" reaches ${x.join(", ")}, not ${t.every}`,fix:`name a relation that reaches ${t.every}`}}}var Pn=(e,t,a)=>a.out?e.out(t,a.relation):e.in(t,a.relation);function Oe(e,t,a){let l=new Set;for(let u of Pn(e,t.id,a.through)){if(!a.via){l.add(u.id);continue}for(let f of Pn(e,u.id,a.via))l.add(f.id)}return e.nodesOfKind(a.every).filter(u=>!l.has(u.id))}var _e=["money","percent","date","time","datetime","relative","upper","lower","count","words","and","plural","excerpt"],ae={getNode:()=>{},allNodes:()=>[],allEdges:()=>[],nodesOfKind:()=>[],edgesOfKind:()=>[],out:()=>[],in:()=>[],neighbors:()=>[],has:()=>!1};function Ce(e,t,a,l=[],u,f=U){return tn(e,t,a,l,u,f)}var jn=(e,t)=>e.capital?J(t):t,se=new Set(["words","plural","relative"]);function Ie(e,t){let a=e[0];return!a||a.text!==void 0||!a.format||!se.has(a.format)?t:/^[a-z][a-z'’-]*(?=\s|$|[,.;:!?])/.test(t)?J(t):t}function de(e){return e?t=>{let a=e.tryDefinition(t.kind)?.label;return a?a(t):U(t)}:U}var vn=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen","eighteen","nineteen"],Un=["","","twenty","thirty","forty","fifty","sixty","seventy","eighty","ninety"];function le(e,t){return!Number.isInteger(e)||e<0||e>99?q(e,t):e<20?vn[e]:e%10===0?Un[e/10]:`${Un[Math.floor(e/10)]}-${vn[e%10]}`}function ue(e){return/[^aeiou]y$/i.test(e)?`${e.slice(0,-1)}ies`:/(s|x|z|ch|sh)$/i.test(e)?`${e}es`:`${e}s`}var U=e=>String(e.name??e.title??e.label??e.id);function tn(e,t,a,l=[],u,f=U){if(t==="plural"){let y=e instanceof w?e.nodes.length:Array.isArray(e)?e.length:typeof e=="number"?e:null;return y===null||l[0]===void 0?"\u2014":y===1?l[0]:l[1]??ue(l[0])}if(e===null)return"\u2014";if(e instanceof w)return t==="count"?String(e.nodes.length):t==="and"?B(e.nodes.map(f)):e.nodes.map(f).join(", ");if(Array.isArray(e)){if(t==="count")return String(e.length);let y=e.map($=>tn($,void 0,a,[],u,f));return t==="and"?B(y):y.join(", ")}if(typeof e=="object")return f(e);switch(t){case"words":return typeof e=="number"?le(e,u?.locale):String(e);case"money":return typeof e=="number"?X(e,u,l[0]==="0"?0:void 0):String(e);case"percent":return typeof e=="number"?q(e,u?.locale,{style:"percent",maximumFractionDigits:0}):String(e);case"upper":return String(e).toUpperCase();case"lower":return String(e).toLowerCase();case"excerpt":return $n(String(e),Number(l[0])||void 0);case"date":return _(Y(String(e),u?.timeZone)??String(e).slice(0,10),u?.locale);case"time":return typeof e=="string"&&W.test(e)?_(e,u?.locale):cn(String(e),u?.locale,u?.timeZone);case"datetime":return typeof e=="string"&&W.test(e)?_(e,u?.locale):H(String(e),u?.locale,u?.timeZone);case"relative":{let y=Y(String(e),u?.timeZone),$=y===void 0?Date.parse(String(e)):Date.parse(`${y}T00:00:00Z`);if(Number.isNaN($))return String(e);let x=Math.round(($-Date.parse(`${a}T00:00:00Z`))/864e5);return x===0?"today":x===1?"tomorrow":x===-1?"yesterday":x>0?`in ${x} days`:`${-x} days ago`}default:return typeof e=="string"&&sn.test(e)?_(e,u?.locale):typeof e=="string"&&D.test(e)?H(e,u?.locale,u?.timeZone):String(e)}}function fe(e,t,a){return(Array.isArray(e)?e:[e]).map(l=>t[String(l)]??(a?yn(String(l)):gn(String(l)))).join(", ")}function Le(e,t){let a=t.today??P(),l=t.name??de(t.graph?.schema);return e.map(u=>{if(u.text!==void 0)return u.text;try{let f=In(u.expr,{graph:t.graph??ae,subject:t.node,kinds:t.kinds,today:a,budget:t.budget??500,...t.bindings?{bindings:t.bindings}:{}}),y=!u.format&&u.expr.t==="ident"&&t.node?t.kinds.get(t.node.kind)?.choices?.get(u.expr.name):void 0;return y&&(typeof f=="string"||Array.isArray(f))?jn(u,fe(f,y,e.length===1)):jn(u,tn(f,u.format,a,u.formatArgs,t.money,l))}catch(f){if(f instanceof g)return"\u2014";throw f}}).join("")}export{w as a,be as b,ee as c,g as d,en as e,In as f,ke as g,re as h,Se as i,Ae as j,Ne as k,_e as l,ae as m,Ce as n,jn as o,Ie as p,de as q,fe as r,Le as s,Re as t,Oe as u};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as te}from"./chunk.
|
|
1
|
+
import{a as te}from"./chunk.D4WJ7OM5.js";import{b as H,c as ee}from"./chunk.QDVGHI7R.js";import"./chunk.AKJS2NUM.js";import{la as U,oa as X,ua as Y,uc as Q,ya as z}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function ue(t){let n=t?.indexOf(":")??-1;if(!(!t||n<=0||n===t.length-1))return{relation:t.slice(0,n),record:t.slice(n+1)}}function re(t,n){if(t.length===0)return!0;let d=`${n.split("/")[0]}/*`;return t.some(a=>a==="*"||a==="*/*"||a===n||a===d)}function ie(t,n){let d=n.startsWith("image/")?"image":n.startsWith("video/")?"video":"file";return t.find(a=>a.as===d)??t.find(a=>a.as==="file")}function pe(t,n){let d=new Set(t.map(w=>w.as==="image"?"image/":w.as==="video"?"video/":""));if(d.has("")||n.kinds.length===0)return n.kinds.join(",");let a=[];for(let w of d){let p=n.kinds.filter(l=>l.startsWith(w));a.push(...p.length>0?p:[`${w}*`])}return a.join(",")}var W=t=>t.input?.shape??{},ae=(t,n)=>W(t)[n]?.safeParse(void 0).success===!1;function se(t,n){let d=new Set(H(t.input).map(a=>a.name));return Object.keys(W(t)).filter(a=>!n.has(a)&&!d.has(a)&&ae(t,a)&&W(t)[a].safeParse("a name").success&&!W(t)[a].safeParse(1).success)}var me=t=>t.replace(/\.[a-z0-9]{1,5}$/i,"")||t,oe=(t,n)=>{let d=Number.isFinite(Date.parse(n))?new Date(Date.parse(n)).toISOString():n;return[n,d,d.replace(/\.\d{3}Z$/,"Z"),n.slice(0,10)].find(a=>t.safeParse(a).success)},ge="2026-01-01T00:00:00.000Z";function ne(t,n){let d=W(t),a=new Set(se(t,n)),w=Object.keys(d).filter(l=>!n.has(l)&&!a.has(l)&&ae(t,l)),p=w.filter(l=>oe(d[l],ge)!==void 0);return{timed:p,left:w.filter(l=>!p.includes(l))}}function de(t,n,d,a,w){let p=e=>({ok:!1,says:e}),{kind:l}=a,R=(d.accepts??[]).filter(e=>e.kind===l&&(a.field===void 0||e.field===a.field));if(R.length===0)return p(a.field===void 0?`The view's accepts names no field of "${l}", so nothing dropped there can become one.`:`The view's accepts does not name ${l}'s "${a.field}".`);let k=w.files;if(!k||!(k.maxBytes>0))return p("This host takes no files.");let O=R.flatMap(e=>{let r=te(t,e.kind,e.field);return r?[{field:e.field,...r}]:[]}),v=O.filter(e=>e.as==="file"||k.kinds.length===0||k.kinds.some(r=>r==="*"||r==="*/*"||r.startsWith(e.as==="image"?"image/":"video/")));if(v.length===0)return p(`This host takes none of what ${l}'s ${O.map(e=>`"${e.field}"`).join(" or ")} holds.`);let c=a.connect===void 0?void 0:ue(a.connect);if(a.connect!==void 0&&(!c||w.shown.has(a.connect)))return p(`data-drop-connect is "<relation>:<record id>", not "${a.connect}".`);if(c&&!w.shown.has(c.record))return p(`data-drop-connect names "${c.record}", which this view was not shown.`);let m=c?t.seenBy(n).graph.getNode(c.record):void 0;if(c&&!m)return p(`data-drop-connect names "${c.record}", which this seat does not see.`);let $=e=>Object.hasOwn(t.schema.tryDefinition(e)?.edges??{},c.relation),D=c?$(l):!1;if(c&&!D&&!$(m.kind))return p(`Neither a "${l}" nor a "${m.kind}" has the relation "${c.relation}".`);let K=t.allMutations(),S=e=>t.permits(e,n).ok,J=e=>v.every(r=>Object.hasOwn(W(e),r.field)),V=K.filter(e=>(e.creates??[]).includes(l)&&J(e)),F=Y(t.schema.tryDefinition(l),l),T=X(t.schema,l).toLowerCase(),E=m?U(t.schema.tryDefinition(m.kind),m):void 0,B=e=>`${e===1?`a ${F}`:`${e} ${T}`}${E?` to ${E}`:""}`,q=e=>`Add ${B(e)}`,C=e=>`Added ${B(e)}.`,N=`Drop to add ${T}${E?` to ${E}`:""}.`,I=(e,r,h,g)=>{let A=new Set(Object.keys(r)),b=z(h.at)??g??new Date().toISOString();for(let L of ne(e,A).timed)r[L]=oe(W(e)[L],b);for(let L of se(e,A))r[L]=me(h.name);return r},Z=(e,...r)=>new Set([...v.map(h=>h.field),...r,...H(e.input).map(h=>h.name)]),x=(e,...r)=>ne(e,Z(e,...r)).left,i=(e,r)=>p(`"${e.title??e.name}" asks for ${r.map(h=>`"${h}"`).join(" and ")}, which no dropped file says, so nothing dropped here can become a ${F}.`),o=(e,r)=>e.list?[r]:r,f={ok:!0,kind:l,fields:v,accept:pe(v,k),...c?{connect:c}:{},intent:q,invite:N,added:C};if(!c){let e=V.find(r=>!r.subject&&S({name:r.name,args:{}}));return e?x(e).length>0?i(e,x(e)):{...f,calls:r=>[{name:e.name,args:I(e,{[r.field]:o(v.find(h=>h.field===r.field),r.value)},r.value,r.at)}]}:p(`This seat may not make a "${l}" here.`)}let s=V.find(e=>e.subject&&(e.subject.kinds==="*"||e.subject.kinds.includes(m.kind))&&(e.connects??[]).includes(c.relation)&&S({name:e.name,args:{[e.subject.arg]:c.record}}));if(s){let e=s.subject.arg;return x(s,e).length>0?i(s,x(s,e)):{...f,calls:r=>[{name:s.name,args:I(s,{[e]:c.record,[r.field]:o(v.find(h=>h.field===r.field),r.value)},r.value,r.at)}]}}let u=V.find(e=>!e.subject&&S({name:e.name,args:{}}));if(!u)return p(`This seat may not make a "${l}" here.`);if(x(u).length>0)return i(u,x(u));let y=D?l:m.kind,P=D?m.kind:l,M=K.find(e=>{if(!(e.connects??[]).includes(c.relation)||!e.subject)return!1;let r=e.subject.kinds;if(r!=="*"&&!r.includes(y))return!1;let h=H(e.input).find(g=>g.name!==e.subject.arg&&(g.kinds.includes("*")||g.kinds.includes(P)));return h?S({name:e.name,args:D?{[h.name]:c.record}:{[e.subject.arg]:c.record}}):!1});if(!M)return p(`This seat may not link a "${l}" to ${c.record} by "${c.relation}".`);let G=M.subject.arg,_=H(M.input).find(e=>e.name!==G&&(e.kinds.includes("*")||e.kinds.includes(P))).name;return{...f,calls:(e,r)=>[{name:u.name,args:I(u,{[e.field]:o(v.find(h=>h.field===e.field),e.value)},e.value,e.at)},{name:M.name,args:D?{[G]:Q(r*2),[_]:c.record}:{[G]:c.record,[_]:Q(r*2)}}]}}var le=t=>t.type.startsWith("image/"),ye=t=>t.type.startsWith("video/"),he=`
|
|
2
2
|
[data-graview-drop-over] { outline: 2px dashed var(--graview-accent, Highlight) !important; outline-offset: 2px !important; background-color: color-mix(in srgb, var(--graview-accent, Highlight) 10%, transparent) !important; }
|
|
3
3
|
[data-graview-drop-status], [data-graview-drop-refused] { margin: 4px 0 0; font: 0.8125rem/1.4 var(--graview-font-body, system-ui, sans-serif); color: var(--graview-ink-muted, GrayText); }
|
|
4
4
|
[data-graview-drop-refused] { color: var(--graview-warn, var(--graview-ink, CanvasText)); }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f}from"./chunk.6SJEZWH3.js";import"./chunk.6N4PE3U5.js";import"./chunk.WALVW3KJ.js";import"./chunk.UGQYMN4J.js";import"./chunk.RG5G6YQD.js";import{Nb as a}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{a as ActRefusal,e as compileDocumentWithoutCheck,d as effectsOf,f as inDocumentWords,c as kindShapes,b as readDocument};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ia as V,ja as w}from"./chunk.
|
|
1
|
+
import{ia as V,ja as w}from"./chunk.A5PSEU3W.js";import"./chunk.SDO3U72B.js";import{Ud as u,Yd as h}from"./chunk.ZEZUKRC6.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var c=i=>[i,...u.filter(o=>o!==i)];function p(i,o){if(o.hidden.length===0&&o.removed.length===0)return i;let a=new Set(o.removed.filter(e=>!e.lens).map(e=>e.name)),f=new Set(o.hidden),r=e=>e?.name!==void 0&&(a.has(e.name)||e.title!==void 0&&f.has(e.name)),m=()=>(i.homes?.()??[]).filter(e=>e.name===void 0||!a.has(e.name)),l=(e,t,d)=>[...i.registrations()].reverse().find(n=>n.kind===e&&n.cardinality===t&&n.fidelity===d&&!n.beside&&!n.hidden&&!r(n)),y=(e,t)=>{for(let d of c(t.fidelity)){let n=l(e,t.cardinality,d);if(n)return n}if(t.cardinality==="one")for(let d of c(t.fidelity)){let n=l(e,"many",d);if(n)return n}},s={...i,register(e,t,d,n){return i.register(e,t,d,n),s},...i.home?{home(e,t){return i.home(e,t),s}}:{},...i.homes?{homes:m,homeView:()=>m().at(-1)?.view}:{},lookup(e,t){return i.lookup(e,t)===void 0?void 0:l(e,t.cardinality,t.fidelity)?.view},places:()=>i.places().filter(e=>!(e.name!==void 0&&a.has(e.name))).map(e=>e.name!==void 0&&f.has(e.name)&&!e.hidden?{...e,hidden:!0}:e),resolve(e,t,d){let n=i.resolve(e,t,d);return!n||!r(n)||d!==void 0&&n.name!==void 0&&!a.has(n.name)&&n.title!==void 0&&h(n.title)===d?n:y(e,t)},all:()=>i.all().filter(e=>!(e.name!==void 0&&a.has(e.name))),homes:()=>(i.homes?.()??[]).filter(e=>!(e.name!==void 0&&a.has(e.name))),homeView:()=>i.homes?s.homes().at(-1)?.view:i.homeView?.()};return V(i)&&w(s),s}function R(i,o,a){let f,r=()=>{let m=o.current();f&&m.hidden===f.hidden&&m.removed===f.removed||(f=m,a(p(i,m)))};return r(),o.onChange?.(r)??(()=>{})}export{p as tidyViews,R as watchTidied};
|
|
@@ -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{c as ae,d as se,f as oe,i as re,j as le,k as de,m as ce,n as ue,o as pe,p as ge,q as fe}from"./chunk.QFHWG4LN.js";import{b as Z,c as ee,d as te,e as ne}from"./chunk.YIPXZUTT.js";import{a as ie}from"./chunk.EMFOMSMI.js";import{a as Y}from"./chunk.PSQYDCVM.js";import{a as X,e as O}from"./chunk.U3HERHAI.js";import{E as K,G as Ie,J as Q,S as V,W as _,ea as j}from"./chunk.MODLZJD4.js";import{td as J}from"./chunk.6HY6ZGEE.js";import{b as N}from"./chunk.AJZBJBMO.js";var c=N(Ie(),1);var o=N(_(),1);function he(e,a,t){let i=a.on==="selection"?a.ids:a.on==="record"||a.on==="field"?[a.id]:[],l=i.length>0?ie(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(s=>({mutation:s.mutation,label:s.label,args:s.args,open:s.open,why:s.why,...s.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:a,principal:e.principal,interaction:se(),places:e.places,selection:e.selection,...l?{acts:l}:{},...e.place?{place:e.place}:{},...t?{said:t}:{},...e.app.purpose?{purpose:e.app.purpose}:{}}}async function be(e,a,t){let i=await (__graviewPreload(import.meta.url,["./chunk.QWNSHISU.js","./chunk.G4JJXA63.js","./chunk.TBY5IR7C.js","./chunk.FIFUMX5X.js","./chunk.BIDL7GQD.js","./chunk.V7W5AQKL.js","./chunk.PPSYUOH7.js","./chunk.XOZU4OFA.js","./chunk.GME63ZHI.js","./chunk.Q5WEOX3Q.js","./chunk.4FCFNAA4.js","./chunk.4AC2QM7T.js","./chunk.JXNVNFV4.js","./chunk.WVUJXDXZ.js","./chunk.I2737CPF.js","./chunk.NJRLJEJY.js","./chunk.CVPMSPCH.js","./chunk.OTV5XTBB.js","./chunk.KBPJ7X7W.js","./chunk.OEIWIZCP.js","./chunk.WSDJPXJD.js","./chunk.F4VB6Q2W.js","./chunk.FFOD5B4B.js","./chunk.Z7Y3R3YR.js","./chunk.YXEO3Y65.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KF27ME27.js")),l=i.recipeDraft(a.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(l))return l.failed;t?.(),e.seatTalk.setDraft(l,null),e.goTo.draft?.(),ke()}function ke(e=180){if(typeof document>"u")return;let a=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(a){i&&a.focus();return}e>0&&requestAnimationFrame(()=>ke(e-1))}async function T(e,a,t,i,l){let s=he(e,t,i),d=a==="suggest"?await oe(e.ai,s):a==="fill"?await re(e.ai,s):a==="record"?await le(e.ai,s):await de(e.ai,s);if(d.interaction.outcome==="failed")return a!=="suggest"&&e.desk.record(d.interaction),d;let u=g=>{let p={...d.interaction,outcome:"failed",failed:g};return e.desk.record(p),{...d,interaction:p}};if(a==="fill"||a==="record"){if(!d.ghost||d.ghost.proposals.length===0)return u("Nothing here could be filled in.");l?.(),e.desk.setGhost({ghost:d.ghost}),e.desk.record(d.interaction)}if(a==="panel"&&d.panel){let g=await be(e,d.panel,l);if(g)return u(g);e.desk.record(d.interaction)}return d}var W=new WeakMap,Te=64,me=new WeakMap;function Ee(e){let a=me.get(e);if(!a){let t=a={n:0};me.set(e,t),e.subscribe(()=>void(t.n+=1))}return a.n}var Se=(e,a)=>{let t=ee(a);return t.length>0?t.map(i=>e.graph.getNode(i)):[Ee(e)]},we=(e,a,t)=>JSON.stringify({target:a,seat:e.principal,by:t}),Ae=(e,a,t)=>{let i=Se(e.store,a);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((l,s)=>l===t.depends[s])};function Me(e,a,t="menu"){let i=W.get(e.store)?.get(we(e,a,t));return i?.result!==void 0&&Ae(e,a,i)?i.result:void 0}function Ce(e,a,t){let i=W.get(e.store);i||W.set(e.store,i=new Map);let l=we(e,a,t?.by??"menu"),s=i.get(l);if(s&&Ae(e,a,s))return s.result?Promise.resolve(s.result):s.asked;let d=t?t.ask():T(e,"suggest",a),u={schema:e.store.schema,ai:e.ai,depends:Se(e.store,a),asked:d};i.delete(l),i.set(l,u),i.size>Te&&i.delete(i.keys().next().value);let g=i;return d.then(p=>{p.interaction.outcome!=="failed"?u.result=p:g.get(l)===u&&g.delete(l)}),d}async function Oe(e,a,t,i,l={}){let s=a.interaction,d=ue(t);if(d){let u=s.usage?.at(-1)?.model,g=s.offered.find(h=>h.id===t.id)?.confidence,p=ce(e.store,{interaction:s.id,target:s.target,basis:`${s.ask.said}: ${t.label}`,...u?{model:u}:{},proposals:[{...d,...g!==void 0?{confidence:g}:{}}]},e.principal);if(p.proposals.length===0){let h="That can't be done now.";return e.desk.record({...s,outcome:"failed",failed:h}),h}l.onCard?e.desk.setGhost({ghost:p,onCard:!0}):(i?.(),e.desk.setGhost({ghost:p})),e.desk.record(s);return}if(t.type==="panel"){let u=t.label,g={title:u,recipe:{...t.panel,title:u}},p=await be(e,g,i);return e.desk.record(p?{...s,outcome:"failed",failed:p}:{...s,outcome:"drawn",accepted:[t.id],panel:g}),p}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...s,outcome:"accepted",accepted:[t.id]})}async function qe(e,a){if(a.ask.kind==="ask")return O(e.desk,{target:a.target,asked:a.ask.said}),null;let t=a.ask.kind==="panel"||a.ask.kind==="record"?a.ask.kind:"fill";return T(e,t,a.target,a.ask.said)}var k={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},ye=(0,o.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"aria-hidden":"true",style:{...k,visibility:"hidden"},children:"\xA0"}),P={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function ze({target:e,close:a}){let t=Y(),i=(0,c.useMemo)(()=>Z(e,n=>t.store.graph.has(n)),[e,t.store]),l=(0,c.useMemo)(()=>{let n=he(t,i);return te(t.store,i,{principal:t.principal,places:t.places,...n.acts?{acts:n.acts}:{}})},[t,i]),s=l.candidates.some(n=>n.type==="fill"),d=l.candidates.some(n=>n.type==="panel"),u=(0,c.useMemo)(()=>d?ne(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[d,t,i]),g=(0,c.useMemo)(()=>new Set(t.store.allMutations().filter(n=>(n.creates??[]).length>0).map(n=>n.name)),[t.store]),p=ae(t.ai)!==void 0&&l.candidates.some(n=>n.type==="act"&&n.asks.length>0&&g.has(n.mutation)),h=K(t.ai),S=Me(t,i),f=JSON.stringify(i),[m,I]=(0,c.useState)(!1),[A,R]=(0,c.useState)(null),[H,E]=(0,c.useState)(h&&S===void 0);(0,c.useEffect)(()=>{if(S!==void 0||!(h||m))return;let n=!0;return E(!0),Ce(t,i).then(y=>{n&&(R(y),E(!1))}),()=>{n=!1}},[f,m]);let r=S??A,w=(r?.offers??[]).filter(n=>!(n.type==="place"&&u.some(y=>y.place===n.place))).slice(0,Math.max(0,3-u.length)),b=r?.interaction.outcome==="failed"?r.interaction.failed??"The AI could not suggest anything here.":null,D=(0,c.useRef)(!1),F=(0,c.useRef)(null);(0,c.useLayoutEffect)(()=>{r===null||!D.current||(D.current=!1,F.current?.querySelector("button")?.focus())},[r]);let L=(0,c.useRef)(!0);(0,c.useEffect)(()=>()=>{L.current=!1},[]);let[U,G]=(0,c.useState)(!1),[B,$]=(0,c.useState)(null),M=n=>{if(U)return;G(!0),$(null);let y=!1;n(()=>{y=!0,a()}).then(x=>{L.current&&(G(!1),x?$(x):y||a())},x=>{L.current&&(G(!1),$(x instanceof Error?x.message:String(x)))})},q=n=>n.interaction.outcome==="failed"?n.interaction.failed??"The AI could not do that here.":void 0,C=H&&!m?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:P,children:"Thinking\u2026"}):U?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:P,children:"Asking\u2026"}):B?(0,o.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...P,color:"var(--graview-warn)"},children:B}):b?(0,o.jsx)("p",{role:"status",style:P,children:b}):null,z=(0,c.useRef)(0);z.current=Math.max(z.current,h&&S===void 0?Math.max(1,3-u.length):0,w.length+(C?1:0));let xe=Math.max(0,z.current-w.length-(C?1:0));return(0,o.jsxs)("div",{ref:F,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[(0,o.jsxs)("ul",{"data-testid":"inline-ai-room",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[C?(0,o.jsxs)("li",{style:{position:"relative"},children:[ye,(0,o.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center"},children:C})]}):null,w.map(n=>(0,o.jsx)("li",{children:(0,o.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${n.id}`,"data-ai-offer":n.id,"data-ai-offer-type":n.type,title:n.label,onClick:()=>M(y=>Oe(t,r,n,y)),style:{...k,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[n.label,(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",n.type==="panel"?"a panel":n.type==="place"?"go there":n.type==="record"?"open it":"suggested"]})]})},n.id)),Array.from({length:xe},(n,y)=>(0,o.jsx)("li",{"data-inline-ai-room":"",children:ye},`room-${y}`))]}),(0,o.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[!h&&r===null?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":m||void 0,onClick:n=>{m||(D.current=document.activeElement===n.currentTarget,I(!0))},style:k,children:m?"Thinking\u2026":"Suggest\u2026"})}):null,s?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>M(async n=>q(await T(t,"fill",i,"Fill in",n))),style:k,children:"Fill in with AI"})}):null,p?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>M(async n=>q(await T(t,"record",i,"Add one",n))),style:k,children:"Add one with AI"})}):null,u.map(n=>(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":`ai-open:${n.place}`,"data-ai-existing":n.fit,onClick:()=>{a(),t.goTo.place(n.place),n.fit==="partial"&&O(t.desk,{target:{on:"lens",place:n.place,...n.kind?{kind:n.kind}:{}}})},style:k,children:n.fit==="full"?`Open ${n.title}`:`Open and adjust ${n.title}`})},n.place)),d?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>M(async n=>q(await T(t,"panel",i,"Draw a panel",n))),style:k,children:u.length>0?"Draw a new view":"Draw a panel"})}):null,(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let n=document.activeElement,y=X(n instanceof Element?n.closest('[data-testid="context-menu"]'):null);a(),O(t.desk,{target:i,returnTo:n instanceof HTMLElement&&n!==document.body?n:null,...y?{from:y}:{}})},style:k,children:"Tell Graview\u2026"})})]})]})}var v={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function Ne({placement:e="picture"}){let{store:a,principal:t,aiDesk:i}=j(),l=V(a,t),{ghost:s,entries:d}=Q(i),[u,g]=(0,c.useState)(new Set);(0,c.useEffect)(()=>g(new Set),[s?.ghost.interaction]);let p=(0,c.useRef)(null),h=(0,c.useRef)(null),S=s?.batch;if((0,c.useEffect)(()=>{S!==void 0&&h.current?.focus()},[S]),!s)return null;let{ghost:f}=s,m=d.find(r=>r.id===f.interaction),I=()=>{let r=f.target.on==="record"||f.target.on==="field"?f.target.id:void 0,w=p.current?.closest("[data-graview-face], main")?.parentElement??document,b=(r?w.querySelector(`[data-graview-view="${CSS.escape(r)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??p.current?.closest("main")??document.querySelector("main");b&&!b.hasAttribute("tabindex")&&b.setAttribute("tabindex","-1"),b?.focus({preventScroll:!0}),i.setGhost(null)},A=f.proposals.filter(r=>!u.has(r.id)).map(r=>r.id),R=()=>{let r=pe(l,f,{author:t,ids:A});if(!r.ok){i.setGhost({...s,refused:r.refused});return}m&&i.record(ge(m,r.accepted,r.batch)),i.setGhost({ghost:f,batch:r.batch,took:r.accepted.length,...s.onCard?{onCard:!0}:{}})},H=()=>{m&&s.batch===void 0&&i.record(fe(m)),I()},E=()=>{if(s.batch!==void 0)try{l.undo(s.batch,{author:t}),m&&i.record({...m,undone:!0}),I()}catch(r){i.setGhost({...s,refused:r instanceof Error?r.message:String(r)})}};return(0,o.jsxs)("section",{ref:p,"data-testid":"ai-ghost","data-interaction":f.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:J("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,o.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:s.batch!==void 0?`Done: ${s.took===1?"one change":`${s.took} changes`}, as one.`:`Proposed by AI \xB7 ${f.basis}`}),s.batch===void 0?(0,o.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:f.proposals.map(r=>(0,o.jsx)("li",{"data-ghost-proposal":r.id,children:(0,o.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,o.jsx)("input",{type:"checkbox",checked:!u.has(r.id),onChange:w=>{let b=new Set(u);w.target.checked?b.delete(r.id):b.add(r.id),g(b)}}),(0,o.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:r.said}),r.confidence!==void 0?(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(r.confidence*100),"% sure"]}):null]})},r.id))}):null,s.refused?(0,o.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:s.refused}):null,(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.batch===void 0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:A.length===0,onClick:R,style:v,children:A.length===f.proposals.length?"Accept":`Accept ${A.length} of ${f.proposals.length}`}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:H,style:v,children:"Dismiss"})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button",ref:h,"data-testid":"ghost-undo",onClick:E,style:v,children:"Undo"}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:I,style:v,children:"Close"})]})})]})}export{he as a,be as b,T as c,Me as d,Ce as e,Oe as f,qe as g,ze as h,Ne as i};
|
|
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{c as ae,d as se,f as oe,i as re,j as le,k as de,m as ce,n as ue,o as pe,p as ge,q as fe}from"./chunk.ILJDLBPJ.js";import{b as Z,c as ee,d as te,e as ne}from"./chunk.X226YATK.js";import{a as ie}from"./chunk.MSAYU25L.js";import{a as Y}from"./chunk.QF5QB5YR.js";import{a as X,e as O}from"./chunk.QNP5OR3P.js";import{E as K,G as Ie,J as Q,S as V,W as _,ea as j}from"./chunk.A5PSEU3W.js";import{td as J}from"./chunk.ZEZUKRC6.js";import{b as N}from"./chunk.AJZBJBMO.js";var c=N(Ie(),1);var o=N(_(),1);function he(e,a,t){let i=a.on==="selection"?a.ids:a.on==="record"||a.on==="field"?[a.id]:[],l=i.length>0?ie(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(s=>({mutation:s.mutation,label:s.label,args:s.args,open:s.open,why:s.why,...s.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:a,principal:e.principal,interaction:se(),places:e.places,selection:e.selection,...l?{acts:l}:{},...e.place?{place:e.place}:{},...t?{said:t}:{},...e.app.purpose?{purpose:e.app.purpose}:{}}}async function be(e,a,t){let i=await (__graviewPreload(import.meta.url,["./chunk.IDALEKIW.js","./chunk.G4JJXA63.js","./chunk.TBY5IR7C.js","./chunk.URQTF5SY.js","./chunk.BIDL7GQD.js","./chunk.LP2ZMAT2.js","./chunk.M7KXQGQL.js","./chunk.XOZU4OFA.js","./chunk.H3EGBDW2.js","./chunk.Q5WEOX3Q.js","./chunk.6SJEZWH3.js","./chunk.6N4PE3U5.js","./chunk.B7KZBT27.js","./chunk.WVUJXDXZ.js","./chunk.DWM7AR5Y.js","./chunk.6KJGRM7A.js","./chunk.WALVW3KJ.js","./chunk.SNHKYH72.js","./chunk.UGQYMN4J.js","./chunk.RG5G6YQD.js","./chunk.SO6NT5K7.js","./chunk.MUSMNKE4.js","./chunk.SJQPTDAT.js","./chunk.JQ63N4MZ.js","./chunk.Z3O2VZAJ.js","./chunk.ZEZUKRC6.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.55G4IPOO.js")),l=i.recipeDraft(a.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(l))return l.failed;t?.(),e.seatTalk.setDraft(l,null),e.goTo.draft?.(),ke()}function ke(e=180){if(typeof document>"u")return;let a=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(a){i&&a.focus();return}e>0&&requestAnimationFrame(()=>ke(e-1))}async function T(e,a,t,i,l){let s=he(e,t,i),d=a==="suggest"?await oe(e.ai,s):a==="fill"?await re(e.ai,s):a==="record"?await le(e.ai,s):await de(e.ai,s);if(d.interaction.outcome==="failed")return a!=="suggest"&&e.desk.record(d.interaction),d;let u=g=>{let p={...d.interaction,outcome:"failed",failed:g};return e.desk.record(p),{...d,interaction:p}};if(a==="fill"||a==="record"){if(!d.ghost||d.ghost.proposals.length===0)return u("Nothing here could be filled in.");l?.(),e.desk.setGhost({ghost:d.ghost}),e.desk.record(d.interaction)}if(a==="panel"&&d.panel){let g=await be(e,d.panel,l);if(g)return u(g);e.desk.record(d.interaction)}return d}var W=new WeakMap,Te=64,me=new WeakMap;function Ee(e){let a=me.get(e);if(!a){let t=a={n:0};me.set(e,t),e.subscribe(()=>void(t.n+=1))}return a.n}var Se=(e,a)=>{let t=ee(a);return t.length>0?t.map(i=>e.graph.getNode(i)):[Ee(e)]},we=(e,a,t)=>JSON.stringify({target:a,seat:e.principal,by:t}),Ae=(e,a,t)=>{let i=Se(e.store,a);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((l,s)=>l===t.depends[s])};function Me(e,a,t="menu"){let i=W.get(e.store)?.get(we(e,a,t));return i?.result!==void 0&&Ae(e,a,i)?i.result:void 0}function Ce(e,a,t){let i=W.get(e.store);i||W.set(e.store,i=new Map);let l=we(e,a,t?.by??"menu"),s=i.get(l);if(s&&Ae(e,a,s))return s.result?Promise.resolve(s.result):s.asked;let d=t?t.ask():T(e,"suggest",a),u={schema:e.store.schema,ai:e.ai,depends:Se(e.store,a),asked:d};i.delete(l),i.set(l,u),i.size>Te&&i.delete(i.keys().next().value);let g=i;return d.then(p=>{p.interaction.outcome!=="failed"?u.result=p:g.get(l)===u&&g.delete(l)}),d}async function Oe(e,a,t,i,l={}){let s=a.interaction,d=ue(t);if(d){let u=s.usage?.at(-1)?.model,g=s.offered.find(h=>h.id===t.id)?.confidence,p=ce(e.store,{interaction:s.id,target:s.target,basis:`${s.ask.said}: ${t.label}`,...u?{model:u}:{},proposals:[{...d,...g!==void 0?{confidence:g}:{}}]},e.principal);if(p.proposals.length===0){let h="That can't be done now.";return e.desk.record({...s,outcome:"failed",failed:h}),h}l.onCard?e.desk.setGhost({ghost:p,onCard:!0}):(i?.(),e.desk.setGhost({ghost:p})),e.desk.record(s);return}if(t.type==="panel"){let u=t.label,g={title:u,recipe:{...t.panel,title:u}},p=await be(e,g,i);return e.desk.record(p?{...s,outcome:"failed",failed:p}:{...s,outcome:"drawn",accepted:[t.id],panel:g}),p}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...s,outcome:"accepted",accepted:[t.id]})}async function qe(e,a){if(a.ask.kind==="ask")return O(e.desk,{target:a.target,asked:a.ask.said}),null;let t=a.ask.kind==="panel"||a.ask.kind==="record"?a.ask.kind:"fill";return T(e,t,a.target,a.ask.said)}var k={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},ye=(0,o.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"aria-hidden":"true",style:{...k,visibility:"hidden"},children:"\xA0"}),P={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function ze({target:e,close:a}){let t=Y(),i=(0,c.useMemo)(()=>Z(e,n=>t.store.graph.has(n)),[e,t.store]),l=(0,c.useMemo)(()=>{let n=he(t,i);return te(t.store,i,{principal:t.principal,places:t.places,...n.acts?{acts:n.acts}:{}})},[t,i]),s=l.candidates.some(n=>n.type==="fill"),d=l.candidates.some(n=>n.type==="panel"),u=(0,c.useMemo)(()=>d?ne(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[d,t,i]),g=(0,c.useMemo)(()=>new Set(t.store.allMutations().filter(n=>(n.creates??[]).length>0).map(n=>n.name)),[t.store]),p=ae(t.ai)!==void 0&&l.candidates.some(n=>n.type==="act"&&n.asks.length>0&&g.has(n.mutation)),h=K(t.ai),S=Me(t,i),f=JSON.stringify(i),[m,I]=(0,c.useState)(!1),[A,R]=(0,c.useState)(null),[H,E]=(0,c.useState)(h&&S===void 0);(0,c.useEffect)(()=>{if(S!==void 0||!(h||m))return;let n=!0;return E(!0),Ce(t,i).then(y=>{n&&(R(y),E(!1))}),()=>{n=!1}},[f,m]);let r=S??A,w=(r?.offers??[]).filter(n=>!(n.type==="place"&&u.some(y=>y.place===n.place))).slice(0,Math.max(0,3-u.length)),b=r?.interaction.outcome==="failed"?r.interaction.failed??"The AI could not suggest anything here.":null,D=(0,c.useRef)(!1),F=(0,c.useRef)(null);(0,c.useLayoutEffect)(()=>{r===null||!D.current||(D.current=!1,F.current?.querySelector("button")?.focus())},[r]);let L=(0,c.useRef)(!0);(0,c.useEffect)(()=>()=>{L.current=!1},[]);let[U,G]=(0,c.useState)(!1),[B,$]=(0,c.useState)(null),M=n=>{if(U)return;G(!0),$(null);let y=!1;n(()=>{y=!0,a()}).then(x=>{L.current&&(G(!1),x?$(x):y||a())},x=>{L.current&&(G(!1),$(x instanceof Error?x.message:String(x)))})},q=n=>n.interaction.outcome==="failed"?n.interaction.failed??"The AI could not do that here.":void 0,C=H&&!m?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:P,children:"Thinking\u2026"}):U?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:P,children:"Asking\u2026"}):B?(0,o.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...P,color:"var(--graview-warn)"},children:B}):b?(0,o.jsx)("p",{role:"status",style:P,children:b}):null,z=(0,c.useRef)(0);z.current=Math.max(z.current,h&&S===void 0?Math.max(1,3-u.length):0,w.length+(C?1:0));let xe=Math.max(0,z.current-w.length-(C?1:0));return(0,o.jsxs)("div",{ref:F,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[(0,o.jsxs)("ul",{"data-testid":"inline-ai-room",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[C?(0,o.jsxs)("li",{style:{position:"relative"},children:[ye,(0,o.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center"},children:C})]}):null,w.map(n=>(0,o.jsx)("li",{children:(0,o.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${n.id}`,"data-ai-offer":n.id,"data-ai-offer-type":n.type,title:n.label,onClick:()=>M(y=>Oe(t,r,n,y)),style:{...k,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[n.label,(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",n.type==="panel"?"a panel":n.type==="place"?"go there":n.type==="record"?"open it":"suggested"]})]})},n.id)),Array.from({length:xe},(n,y)=>(0,o.jsx)("li",{"data-inline-ai-room":"",children:ye},`room-${y}`))]}),(0,o.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[!h&&r===null?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":m||void 0,onClick:n=>{m||(D.current=document.activeElement===n.currentTarget,I(!0))},style:k,children:m?"Thinking\u2026":"Suggest\u2026"})}):null,s?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>M(async n=>q(await T(t,"fill",i,"Fill in",n))),style:k,children:"Fill in with AI"})}):null,p?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>M(async n=>q(await T(t,"record",i,"Add one",n))),style:k,children:"Add one with AI"})}):null,u.map(n=>(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":`ai-open:${n.place}`,"data-ai-existing":n.fit,onClick:()=>{a(),t.goTo.place(n.place),n.fit==="partial"&&O(t.desk,{target:{on:"lens",place:n.place,...n.kind?{kind:n.kind}:{}}})},style:k,children:n.fit==="full"?`Open ${n.title}`:`Open and adjust ${n.title}`})},n.place)),d?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>M(async n=>q(await T(t,"panel",i,"Draw a panel",n))),style:k,children:u.length>0?"Draw a new view":"Draw a panel"})}):null,(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let n=document.activeElement,y=X(n instanceof Element?n.closest('[data-testid="context-menu"]'):null);a(),O(t.desk,{target:i,returnTo:n instanceof HTMLElement&&n!==document.body?n:null,...y?{from:y}:{}})},style:k,children:"Tell Graview\u2026"})})]})]})}var v={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function Ne({placement:e="picture"}){let{store:a,principal:t,aiDesk:i}=j(),l=V(a,t),{ghost:s,entries:d}=Q(i),[u,g]=(0,c.useState)(new Set);(0,c.useEffect)(()=>g(new Set),[s?.ghost.interaction]);let p=(0,c.useRef)(null),h=(0,c.useRef)(null),S=s?.batch;if((0,c.useEffect)(()=>{S!==void 0&&h.current?.focus()},[S]),!s)return null;let{ghost:f}=s,m=d.find(r=>r.id===f.interaction),I=()=>{let r=f.target.on==="record"||f.target.on==="field"?f.target.id:void 0,w=p.current?.closest("[data-graview-face], main")?.parentElement??document,b=(r?w.querySelector(`[data-graview-view="${CSS.escape(r)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??p.current?.closest("main")??document.querySelector("main");b&&!b.hasAttribute("tabindex")&&b.setAttribute("tabindex","-1"),b?.focus({preventScroll:!0}),i.setGhost(null)},A=f.proposals.filter(r=>!u.has(r.id)).map(r=>r.id),R=()=>{let r=pe(l,f,{author:t,ids:A});if(!r.ok){i.setGhost({...s,refused:r.refused});return}m&&i.record(ge(m,r.accepted,r.batch)),i.setGhost({ghost:f,batch:r.batch,took:r.accepted.length,...s.onCard?{onCard:!0}:{}})},H=()=>{m&&s.batch===void 0&&i.record(fe(m)),I()},E=()=>{if(s.batch!==void 0)try{l.undo(s.batch,{author:t}),m&&i.record({...m,undone:!0}),I()}catch(r){i.setGhost({...s,refused:r instanceof Error?r.message:String(r)})}};return(0,o.jsxs)("section",{ref:p,"data-testid":"ai-ghost","data-interaction":f.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:J("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,o.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:s.batch!==void 0?`Done: ${s.took===1?"one change":`${s.took} changes`}, as one.`:`Proposed by AI \xB7 ${f.basis}`}),s.batch===void 0?(0,o.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:f.proposals.map(r=>(0,o.jsx)("li",{"data-ghost-proposal":r.id,children:(0,o.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,o.jsx)("input",{type:"checkbox",checked:!u.has(r.id),onChange:w=>{let b=new Set(u);w.target.checked?b.delete(r.id):b.add(r.id),g(b)}}),(0,o.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:r.said}),r.confidence!==void 0?(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(r.confidence*100),"% sure"]}):null]})},r.id))}):null,s.refused?(0,o.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:s.refused}):null,(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.batch===void 0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:A.length===0,onClick:R,style:v,children:A.length===f.proposals.length?"Accept":`Accept ${A.length} of ${f.proposals.length}`}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:H,style:v,children:"Dismiss"})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button",ref:h,"data-testid":"ghost-undo",onClick:E,style:v,children:"Undo"}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:I,style:v,children:"Close"})]})})]})}export{he as a,be as b,T as c,Me as d,Ce as e,Oe as f,qe as g,ze as h,Ne as i};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as P,c as pe,f as me,g as ge,h as he,i as ke,j as be}from"./chunk.
|
|
1
|
+
import{a as P,c as pe,f as me,g as ge,h as he,i as ke,j as be}from"./chunk.JQ63N4MZ.js";import{a as ue}from"./chunk.Z3O2VZAJ.js";import{$ as C,$a as le,$b as O,Aa as oe,Ba as re,C as W,Ca as ie,Da as se,Ga as U,H as v,J as E,K as Y,L as q,La as de,Na as V,Pb as ce,T as S,Va as G,W as J,X as Q,Za as ae,ba as ee,bb as fe,bc as ye,cc as K,ea as ne,ha as I,la as M,ra as R,ua as te}from"./chunk.ZEZUKRC6.js";var ve=t=>`${t}${t%100>=11&&t%100<=13?"th":["th","st","nd","rd"][t%10]??"th"}`,Se={day:"day",week:"week",month:"month",year:"year"},N=t=>t.length<2?t[0]??"":`${t.slice(0,-1).join(", ")} and ${t[t.length-1]}`;function Oe(t,e,n){let r=e.interval??1,d=Se[e.every],a=t.slice(0,10),l=r===1?`Every ${d}`:r===2?`Every other ${d}`:`Every ${r} ${d}s`,s;if(e.every==="week"){let c=(e.on?.length?e.on:[G[new Date(`${a}T00:00:00Z`).getUTCDay()]]).map(i=>ee(G.indexOf(i),"long",n));s=r===1?`Every ${N(c)}`:r===2?`Every other ${N(c)}`:`${l} on ${N(c)}`}else if(e.every==="month"){let c=(e.on?.length?e.on:[+a.slice(8,10)]).map(i=>i===-1?"the last day":`the ${ve(Number(i))}`);s=`${l} on ${N(c)}`}else e.every==="year"?s=`${l} on ${C(a,n)}`:s=l;return E.test(t)&&(s+=` at ${Q(t,n)}`),e.until&&(s+=`, until ${S(e.until,n)}`),e.count&&(s+=`, ${e.count===1?"once":`${e.count} times`}`),s}function we(t,e,n={}){if(!le(e)||typeof t!="string")return;let r=n.today??q(),d=fe(t,e,r),a=Oe(t,e,n.locale),l=d.slice(0,4)===r.slice(0,4)?C(d.slice(0,10),n.locale):S(d.slice(0,10),n.locale);return d.slice(0,10)<r?`${a}, last ${l}`:`${a}, next ${l}`}function ln(t,e){let n=new Map,r=new Map;for(let d of t){let a=M(e(d.kind),d).trim().toLowerCase();r.set(a,[...r.get(a)??[],d])}for(let d of r.values()){if(d.length<2)continue;let a=new Map;for(let l of d)a.set(l.kind,[...a.get(l.kind)??[],l]);for(let[l,s]of a){if(s.length===1){n.set(s[0].id,te(e(l),l));continue}let c=s.map(o=>new Map(Ne(o,e(o.kind)).map(p=>[p.key,p.alone]))),i=[...new Set(c.flatMap(o=>[...o.keys()]))],u=o=>c.every(p=>!/\d/.test(p.get(o)??"")),g=[...i.filter(u),...i.filter(o=>!u(o))],h=(o,p)=>p.map(y=>c[o].get(y)??"").filter(Boolean).join(" \xB7 "),z=o=>new Set(s.map((p,y)=>h(y,o))).size===s.length&&s.every((p,y)=>h(y,o)!==""),$=g.find(o=>z([o])),f=$?void 0:g.flatMap((o,p)=>g.slice(p+1).map(y=>[o,y])).find(o=>z(o));s.forEach((o,p)=>{if($||f)return void n.set(o.id,h(p,$?[$]:f));let y=g.find(k=>{let b=c[p].get(k);return b!==void 0&&b!==""&&c.every((_,x)=>x===p||_.get(k)!==b)});n.set(o.id,y?c[p].get(y):`${p+1} of ${s.length}`)})}}return n}function fn(t,e){return t?.describe?t.describe(e):`${e.kind} ${M(t,e)}`}var Ee=new Set(["id","kind","label"]);function Me(t,e){if(e.length===0)return!1;let n=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`(^|[\\s\xB7,(/])${n}($|[\\s\xB7,)/])`).test(t)}function Ne(t,e,n={}){let r=e?.display,d=new Set([...Ee,...r?.hide??[]]);typeof t.label=="string"&&e?.label&&!M(e,t).includes(t.label)&&d.delete("label");let a=(n.said??[]).filter(f=>!!f),l=a.filter(f=>f.endsWith("\u2026")).map(f=>f.replace(/…$/,"").trim()).filter(f=>f.length>12),s=[],c=e?.fields?.shape,i=e?.fieldRoles,u=n.glance?r?.glance??[i?.who,i?.when].filter(f=>!!f):Ae(r?.page),g=n.glance&&r?.glance!==void 0,h=new Set(n.glance?[]:n.blanks??[]),$=[...new Set(g?u:[...u,...je(e),...Object.keys(t)])].filter(f=>Object.hasOwn(t,f)||h.has(f)).map(f=>[f,t[f]]);for(let[f,o]of $){if(d.has(f)||ge(e,f))continue;let p=c?.[f];if(h.has(f)&&!U(p)&&!V(p)&&(o==null||o===""||Array.isArray(o)&&o.length===0)){s.push({key:f,label:R(e,f),value:"",stored:"",alone:"",long:!1,blank:!0});continue}if(o==null)continue;let y=r?.format?.[f],k=y?[]:ie(o);if(k[0]&&n.glance)continue;let b=e?.fields?.shape?.[f],_=!y&&typeof o=="string"&&U(b)?o:void 0,x=!y&&typeof o=="string"&&ue(b);if(_&&n.glance)continue;let D=y?void 0:V(b),w=D?{relation:D,refs:de(o,D)}:void 0;if(w&&(n.glance||w.refs.length===0)||!k[0]&&typeof o=="object"&&(!Array.isArray(o)||o.some(m=>typeof m=="object"&&m!==null))&&y===void 0)continue;let Z=typeof o=="string"&&!y?we(o,t[`${f}Repeat`],{locale:n.locale}):void 0,F=k[0]?k.map(m=>`${m.caption?`${m.name} \u2014 ${m.caption}`:m.name}${oe(m)?` (${re(m)})`:""}`).join(", "):Array.isArray(o)?o.join(", "):typeof o=="boolean"?o?"Yes":"No":String(o),T=y?void 0:he(e,f),B=be(T,o),H=!y&&!T&&typeof o=="number"?O(e?.fields?.shape?.[f])??me(e,f):void 0,j=w?w.refs.length>1?`${w.refs.length} linked records`:"linked record":y?y(o):H?ye(o,H):ke(T,o,n.locale)??(Array.isArray(o)||typeof o=="boolean"?F:typeof o=="string"&&Z!==void 0?Z:typeof o=="string"&&v.test(o)&&(o.length===10||Fe(e,f))?S(o,n.locale):typeof o=="string"&&E.test(o)?J(o,n.locale,n.timeZone):typeof o=="string"&&Te(e,f)?P(e,f,o):F),X=typeof o=="string"&&Ie(e,f,j),A=(n.glance||n.excerpt)&&!y&&(X||x)?pe(j,{markdown:x}):j;if(a.includes(A)||l.some(m=>A.startsWith(m))||n.glance&&(typeof o=="string"||typeof o=="number")&&a.some(m=>Me(m,A)))continue;let L=R(e,f),xe=typeof o=="number"?`${L} ${A}`:typeof o=="boolean"&&!y?`${L}: ${A.toLowerCase()}`:A;if(s.push({key:f,label:L,value:A,stored:F,alone:xe,long:X,...x?{markdown:!0}:{},...k[0]?{files:k}:{},..._?{app:_}:{},...w?{linked:w}:{},...B?{href:B}:{},...ae(c?.[`${f}Repeat`])?{repeats:!0}:{}}),n.limit!==void 0&&s.length>=n.limit)break}return ze(s,e)}function ze(t,e){let n=new Map;for(let r of t){let d=De(e,r.key);d&&n.set(r.key,new Set(d.map(a=>P(e,r.key,a).toLowerCase())))}return n.size<2?t:t.map(r=>{let d=n.get(r.key);return d!==void 0&&[...n].some(([l,s])=>l!==r.key&&[...d].some(c=>s.has(c)))?{...r,alone:`${r.label}: ${r.value.toLowerCase()}`}:r})}function De(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"&&n._zod.def.entries?Object.values(n._zod.def.entries).map(String):void 0}function Fe(t,e){let n=t?.fields?.shape?.[e]?._zod?.def;for(let r=0;r<6&&n?.innerType!==void 0;r++)n=n.innerType._zod?.def;return n?.type==="string"&&(n.checks??[]).some(r=>r._zod?.def?.pattern?.source===v.source)}function Te(t,e){let n=t?.fields?.shape?.[e];for(let r=0;r<6&&n?._zod?.def?.innerType!==void 0;r++)n=n._zod.def.innerType;return n?._zod?.def?.type==="enum"}function je(t){let e=t?.fields?.shape;return[...Object.keys(e??{}),...Object.keys(t?.computed??{})]}function Ae(t){return[...t?.fields??[],...(t?.groups??[]).flatMap(e=>e.fields)]}var Le=500,We=160;function Ce(t){let e=t;for(let n=0;n<6&&e?._zod?.def?.innerType!==void 0;n++)e=e._zod.def.innerType;return e?._zod?.def?.type==="string"?e._zod.def:void 0}function Ie(t,e,n){return Ce(t?.fields?.shape?.[e])?.checks?.some(d=>d._zod?.def?.check==="max_length"&&(d._zod.def.maximum??0)>Le)?!0:typeof n=="string"&&(n.includes(`
|
|
2
2
|
`)||n.length>We)}function un(t,e){let n=t?.display?.page,r=n?.groups??[],d=new Map(e.map(i=>[i.key,i])),a=new Set(Ae(n)),l=i=>i.flatMap(u=>d.has(u)?[d.get(u)]:[]),s=e.filter(i=>!a.has(i.key));return[{fields:[...l(n?.fields??[]),...r.length>0?[]:s]},...r.map(i=>({title:i.title,fields:l(i.fields)})),...r.length>0?[{title:"Details",fields:s}]:[]].filter(i=>i.fields.length>0)}function Ue(t,e,n){let r=[...e?.creates??[],...e?.subject&&e.subject.kinds!=="*"?e.subject.kinds:[]];for(let d of r){let a=t.tryDefinition(d),l=a?.fields?.shape??{};if(!a||!(n in l))continue;let s=a.display?.format?.[n];return{label:a.display?.labels?.[n]??R(a,n),option:i=>s?s(i):I(i)}}return{label:R(void 0,n),option:d=>I(d)}}function gn(t,e,n){if(n instanceof ce){let r=e.find(a=>a.name===n.mutation);return`Not yet: ${n.issues.map(a=>{let l=a.path.length>0?Ue(t,r,String(a.path[0])).label:void 0;return l?`${l} \u2014 ${ne(a.message)}`:a.message}).join("; ")}.`}return n instanceof Error?n.message:String(n)}var Ve=t=>/^[A-Z]{3}$/.test(t??"");function $e(t){let{format:e,unit:n,currency:r,locale:d,places:a}=t,l=Ve(n),s=e==="money"||!e&&l,c=s?l?n:r:void 0;return{...s?{format:"money"}:e?{format:e}:{},...n&&!(s&&l)?{unit:n}:{},...c?{currency:c}:{},...d?{locale:d}:{},...s&&a===0?{places:a}:{}}}function kn(t){switch(t.format){case"money":return t.currency?`An amount of money in ${t.currency}: a plain number, 1250.5 for 1,250.50 ${t.currency}.`:"An amount of money, in no named currency: a plain number.";case"percent":return"A fraction said as a percent: 0.15 is 15%.";default:return t.unit?`A number of ${t.unit}.`:"A number."}}function Re(t){let e=W(t)?.innerType;return e===void 0?t:Re(e)}var Ge={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},Ke=t=>(t?._zod?.def?.checks??[]).map(e=>e._zod?.def).filter(e=>e!==void 0);function _e(t){let e=Re(t),n=W(e),r=n?.type,d=Ke(e);if(r==="enum")return{type:"choice",options:Object.keys(n?.entries??{})};let a=se(e);if(a)return a==="image"?{type:"file",image:!0}:a==="video"?{type:"file",video:!0}:{type:"file"};if(r==="boolean")return{type:"boolean"};if(r==="array"){let l=_e(n?.element);return l.type==="unknown"?{type:"unknown"}:{type:"several",of:l}}if(r==="number"){let l,s,c;for(let i of d){i.check==="multiple_of"&&typeof i.value=="number"?c=i.value:i.check==="number_format"&&(i.format==="safeint"||i.format==="int32"||i.format==="uint32")&&(c??=1);let u=i.check==="number_format"&&i.format?Ge[i.format]:void 0,g=u?u[0]:i.check==="greater_than"&&i.inclusive&&typeof i.value=="number"?i.value:void 0,h=u?u[1]:i.check==="less_than"&&i.inclusive&&typeof i.value=="number"?i.value:void 0;g!==void 0&&(l=l===void 0?g:Math.max(l,g)),h!==void 0&&(s=s===void 0?h:Math.min(s,h))}return{type:"number",...l===void 0?{}:{min:l},...s===void 0?{}:{max:s},...c===void 0?{}:{step:c},...K(e)==="duration"?{duration:!0}:{},...O(t)?{amount:$e(O(t))}:{}}}if(r==="string"){if(d.some(u=>u.fn===Y||u.format==="datetime")||n?.format==="datetime")return{type:"date",time:!0,instant:!0};let s=[n?.pattern,...d.map(u=>u.pattern)].filter(u=>u instanceof RegExp).map(u=>u.source);if(s.some(u=>u.includes("\\d{4}")))return s.some(u=>u.includes("\\d{2}:\\d{2}"))?{type:"date",time:!0}:s.includes(v.source)?{type:"date",partial:!0}:{type:"date"};let c=d.some(u=>u.check==="max_length"&&typeof u.maximum=="number"&&u.maximum>500),i=K(e);return c?{type:"text",long:!0}:i==="phone"||i==="place"?{type:"text",holds:i}:{type:"text"}}return{type:"unknown"}}function vn(t,e){let n=t?.shape;return!n||!(e in n)?{type:"unknown"}:_e(n[e])}export{Oe as a,ln as b,fn as c,Ne as d,un as e,$e as f,kn as g,Re as h,_e as i,vn as j,Ue as k,gn as l};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as a}from"./chunk.
|
|
1
|
+
import{g as a}from"./chunk.UGQYMN4J.js";import{c as l}from"./chunk.RG5G6YQD.js";import{Oa as d}from"./chunk.ZEZUKRC6.js";function m(n){let r=new Map;for(let i of n.kinds){let e=n.tryDefinition(i),o=a(e),s=d(e);r.set(i,{fields:new Set(Object.keys(e?.fields?.shape??{})),edges:new Map(Object.entries(e?.edges??{}).map(([p,y])=>[p,y.cardinality??"many"])),...o?{computed:o}:{},...s.size>0?{linked:s}:{}})}let t=a(n);return t&&r.set(l,{computed:t}),r}export{m as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as N,b as g,c as f,d as A,e as m,g as b,h as x}from"./chunk.
|
|
1
|
+
import{a as N,b as g,c as f,d as A,e as m,g as b,h as x}from"./chunk.MUSMNKE4.js";import{E as $,P as y,Z as c}from"./chunk.ZEZUKRC6.js";var E=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"],j=["sun","mon","tue","wed","thu","fri","sat"],h="(jan(?:uary)?|feb(?:ruary)?|mar(?:ch)?|apr(?:il)?|may|june?|july?|aug(?:ust)?|sept?(?:ember)?|oct(?:ober)?|nov(?:ember)?|dec(?:ember)?)",W="(sun(?:day)?|mon(?:day)?|tue(?:s|sday)?|wed(?:nesday)?|thu(?:r|rs|rsday)?|fri(?:day)?|sat(?:urday)?)",O=n=>E.indexOf(n.slice(0,3))+1,D=n=>n===void 0?void 0:n.length===2?2e3+Number(n):Number(n);function T(n){try{let r=new Intl.DateTimeFormat(n,{month:"numeric",day:"numeric"}).formatToParts(0).map(o=>o.type);return r.indexOf("month")<r.indexOf("day")}catch{return!0}}function R(n){let r=(e,i)=>({minutes:i,rest:`${n.slice(0,e.index)} ${n.slice(e.index+e[0].length)}`}),o=/\b(noon|midday)\b/.exec(n);if(o)return r(o,12*60);if(o=/\bmidnight\b/.exec(n),o)return r(o,0);if(o=/\b(\d{1,2})(?::(\d{2}))?\s*([ap])\.?m?\.?(?=\s|$)/.exec(n),o){let e=Number(o[1]),i=Number(o[2]??0);return e<1||e>12||i>59?{rest:n,bad:!0}:r(o,(e%12+(o[3]==="p"?12:0))*60+i)}if(o=/\b(\d{1,2}):(\d{2})\b/.exec(n),o){let e=Number(o[1]),i=Number(o[2]);return e>23||i>59?{rest:n,bad:!0}:r(o,e*60+i)}if(o=/\bat\s+(\d{1,2})\b/.exec(n),o){let e=Number(o[1]);return e>23?{rest:n,bad:!0}:r(o,(e>=1&&e<=7?e+12:e)*60)}let t=/\b(morning|afternoon|evening|tonight)\b/.exec(n);return t?{minutes:{morning:9,afternoon:15,evening:18,tonight:20}[t[1]]*60,rest:t[1]==="tonight"?`${n.slice(0,t.index)} today ${n.slice(t.index+t[0].length)}`:`${n.slice(0,t.index)} ${n.slice(t.index+t[0].length)}`}:{rest:n}}function M(n,r,o){let t=n.replace(/\b(on|at|the|of|this)\b/g," ").replace(/\s+/g," ").trim();if(t==="")return null;if(t==="today"||t==="now")return r;if(t==="tomorrow"||t==="tmrw"||t==="tmr")return f(r,1);if(t==="yesterday")return f(r,-1);if(t==="next week")return f(r,7);let e=/^in (\d{1,3}) (day|days|week|weeks)$/.exec(t);if(e)return f(r,Number(e[1])*(e[2].startsWith("week")?7:1));if(e=new RegExp(`^(next )?${W}$`).exec(t),e){let d=(j.indexOf(e[2].slice(0,3))-A(r)+7)%7;return f(r,e[1]&&d===0?7:d)}if(e=/^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(t),e)return m(Number(e[1]),Number(e[2]),Number(e[3]));let i=t.replace(new RegExp(`^${W} `),"");e=new RegExp(`^(\\d{1,2})(?:st|nd|rd|th)? ${h}(?: (\\d{4}))?$`).exec(i);let s=e?{date:e[1],month:e[2],year:e[3]}:void 0;e=new RegExp(`^${h} (\\d{1,2})(?:st|nd|rd|th)?(?: (\\d{4}))?$`).exec(i);let u=s??(e?{date:e[2],month:e[1],year:e[3]}:void 0);if(u)return I(r,D(u.year),O(u.month),Number(u.date));if(e=/^(\d{1,2})[/.-](\d{1,2})(?:[/.-](\d{2}|\d{4}))?$/.exec(i),e){let[a,d]=[Number(e[1]),Number(e[2])],[l,p]=T(o)?[a,d]:[d,a];return I(r,D(e[3]),l,p)}}function I(n,r,o,t){if(r!==void 0)return m(r,o,t);let e=Number(n.slice(0,4)),i=m(e,o,t);return i===void 0?m(e+1,o,t):g(n)-g(i)>183*N?m(e+1,o,t):i}function L(n){if(typeof n=="number")return Number.isInteger(n)&&n>=1e3&&n<=9999?String(n):void 0;let r=String(n).trim().toLowerCase().replace(/,/g," ").replace(/\s+/g," ");if(/^\d{4}$/.test(r))return Number(r)>=1e3?r:void 0;let o=(e,i)=>i>=1&&i<=12&&Number(e)>=1e3?`${e}-${String(i).padStart(2,"0")}`:void 0,t=/^(\d{4})[-/](\d{1,2})$/.exec(r);if(t)return o(t[1],Number(t[2]));if(t=/^(\d{1,2})\/(\d{4})$/.exec(r),t)return o(t[2],Number(t[1]));if(t=new RegExp(`^${h}\\.? (\\d{4})$`).exec(r),t)return o(t[2],O(t[1]))}function P(n,r){let o=n.trim();if(b(o)){let u=x(o);if(u)return r.time?u:{day:u.day}}let t=n.toLowerCase().replace(/,/g," ").replace(/(\d{4}-\d{2}-\d{2})t(\d\d:\d\d)(:\d\d(\.\d+)?)?/,"$1 $2").replace(/\s+/g," ").trim();if(t==="")return;let e=R(t);if(e.bad)return;let i=M(e.rest,r.today,r.locale??$);if(i===void 0||i===null&&e.minutes===void 0)return;let s=i??r.base?.day??r.today;return r.time?{day:s,minutes:e.minutes??r.base?.minutes??9*60}:{day:s}}function B(n){if(n===void 0||n==="web"||n.startsWith("ai:")||n.startsWith("app:"))return;if(n==="api")return"via the API";if(n==="cli")return"via the command line";let[r,...o]=n.split(":"),t=o.join(":");return(r==="mcp"||r==="view")&&t?`via ${t}`:r==="mcp"?"via an agent's tools":`via ${n}`}var S=n=>{if(!n.currency)return{before:!0};try{let r=y(n.locale),o=new Intl.NumberFormat(r,{style:"currency",currency:n.currency}).formatToParts(1),t=o.findIndex(s=>s.type==="currency"),e=o.findIndex(s=>s.type==="integer"),i;try{i=new Intl.DisplayNames([r],{type:"currency"}).of(n.currency)}catch{}return{...t>=0?{symbol:o[t].value}:{},before:t<e,...i?{name:i}:{}}}catch{return{symbol:n.currency,before:!0}}};function H(n){let r=n.locale;if(n.format==="money"){let{symbol:o,before:t,name:e}=S(n),i=c(1250,r,{minimumFractionDigits:2,maximumFractionDigits:2});return{...o?t?{prefix:o}:{suffix:o}:{},placeholder:i,hint:e?`in ${e}`:n.currency?`in ${n.currency}`:"an amount of money"}}return n.format==="percent"?{suffix:"%",placeholder:c(15,r),hint:"as a percent"}:{...n.unit?{suffix:n.unit}:{},placeholder:"",hint:n.unit?`in ${n.unit}`:"a number"}}function v(n,r){return n===void 0||!Number.isFinite(n)?"":r.format==="money"?c(n,r.locale,Number.isInteger(n)?{maximumFractionDigits:0}:{minimumFractionDigits:2,maximumFractionDigits:2}):r.format==="percent"?c(n*100,r.locale,{maximumFractionDigits:4}):c(n,r.locale,{maximumFractionDigits:6})}function C(n){try{let r=new Intl.NumberFormat(y(n)).formatToParts(12345.6);return{group:r.find(o=>o.type==="group")?.value??",",decimal:r.find(o=>o.type==="decimal")?.value??"."}}catch{return{group:",",decimal:"."}}}function K(n,r){let{group:o,decimal:t}=C(r),e=n.replace(/[\s ']/g,"").replace(/[−–]/g,"-");if(t!=="."&&!e.includes(t)&&/^-?\d+\.\d{1,2}$/.test(e))return Number(e);if(o&&(e=e.split(o).join("")),t!=="."&&(e=e.replace(t,".")),!/^-?(\d+\.?\d*|\.\d+)$/.test(e))return;let i=Number(e);return Number.isFinite(i)?i:void 0}function Y(n,r){let o=n.trim();if(o==="")return;let t=r?.format==="money"&&r.currency?S(r).symbol:void 0,e=o;t&&(e=e.split(t).join("")),r?.currency&&(e=e.replace(new RegExp(r.currency,"gi"),"")),e=e.replace(/^[$€£¥₹]|[$€£¥₹]$/g,""),/%\s*$/.test(e)&&(e=e.replace(/%\s*$/,"")),r?.unit&&r.format!=="money"&&(e=e.replace(new RegExp(`\\s*${r.unit.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*$`),""));let s=K(e,r?.locale);if(s!==void 0)return r?.format==="percent"?s/100:s}var w=/^[0-9a-f]{32}$/,F=n=>n.replace(/-/g,"").toLowerCase();function _(n,r,o){if(!(!n||typeof n!="object"))for(let[t,e]of Object.entries(n)){if(!e||typeof e!="object")continue;if(e.system==="google-calendar"&&e.kind===r)return{connection:t,system:"google-calendar",words:"Google Calendar"};if(e.system!=="notion")continue;let s=(Array.isArray(e.sources)?e.sources:[{kind:e.kind,source:e.source}]).find(p=>p&&p.kind===r);if(!s)continue;let u=typeof s.source=="string"&&!w.test(F(s.source))?s.source:void 0,a=o.startsWith(`${r}:${t}-`)?o.slice(`${r}:${t}-`.length):void 0,d=typeof e.database=="string"?F(e.database):void 0,l=a&&w.test(a)?a:d&&w.test(d)?d:void 0;return{connection:t,system:"notion",words:u?`Notion \xB7 ${u}`:"Notion",...l?{href:`https://www.notion.so/${l}`}:{}}}}export{B as a,H as b,v as c,Y as d,L as e,P as f,_ as g};
|