graview 0.1.66 → 0.1.68
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.OJY7VJ7D.js → chunk.2BMZPALF.js} +1 -1
- package/dist/preview/{chunk.OTV5XTBB.js → chunk.2KCDLCB2.js} +1 -1
- package/dist/preview/{chunk.WVLEGCRI.js → chunk.2ME4DVBI.js} +1 -1
- package/dist/preview/chunk.2TUEBU7X.js +8 -0
- package/dist/preview/{chunk.QHMHUL6B.js → chunk.2U6HB4XU.js} +1 -1
- package/dist/preview/{chunk.ZQR2SN65.js → chunk.32JE2WS7.js} +1 -1
- package/dist/preview/{chunk.OEIWIZCP.js → chunk.3DEWQDP7.js} +1 -1
- package/dist/preview/{chunk.2VR7YEJ6.js → chunk.3JMQKANL.js} +1 -1
- package/dist/preview/chunk.3VEZ5MOC.js +25 -0
- package/dist/preview/chunk.3WPCS6KP.js +1 -0
- package/dist/preview/{chunk.FXT5CN32.js → chunk.42C3FIKK.js} +1 -1
- package/dist/preview/{chunk.QQAZQDRW.js → chunk.42KHFGN6.js} +1 -1
- package/dist/preview/{chunk.ANS2IEEV.js → chunk.4DXPPM6T.js} +1 -1
- package/dist/preview/chunk.4GVKKBQL.js +1 -0
- package/dist/preview/{chunk.5CXIEYHY.js → chunk.4TT3ZHSJ.js} +2 -2
- package/dist/preview/{chunk.OMT4QUZY.js → chunk.4YAO3A5Q.js} +4 -4
- package/dist/preview/{chunk.M2JCFNHJ.js → chunk.5JKUT2OM.js} +1 -1
- package/dist/preview/chunk.5L4ADKTW.js +1 -0
- package/dist/preview/{chunk.YNEHJWJV.js → chunk.64LCHHZB.js} +1 -1
- package/dist/preview/{chunk.6HY6ZGEE.js → chunk.6AANHELP.js} +1 -1
- package/dist/preview/{chunk.6TLXFMX2.js → chunk.6DMCEBSO.js} +1 -1
- package/dist/preview/{chunk.IWYMKGZZ.js → chunk.6IR5LBJU.js} +1 -1
- package/dist/preview/{chunk.YIPXZUTT.js → chunk.6WB2TYK7.js} +1 -1
- package/dist/preview/chunk.6ZENHSTQ.js +1 -0
- package/dist/preview/{chunk.7ZKBYXUM.js → chunk.7K2V5FUB.js} +1 -1
- package/dist/preview/chunk.7OL6H4LF.js +1 -0
- package/dist/preview/{chunk.FBILPNGH.js → chunk.7TDML5YU.js} +1 -1
- package/dist/preview/{chunk.45JP6VGJ.js → chunk.7WPVLEX2.js} +2 -2
- package/dist/preview/{chunk.W4YDPHCQ.js → chunk.7ZTGB4O7.js} +1 -1
- package/dist/preview/{chunk.4FDVINRJ.js → chunk.ACNOP2IU.js} +1 -1
- package/dist/preview/{chunk.AK7NGFEX.js → chunk.AENP662H.js} +1 -1
- package/dist/preview/{chunk.MWGZKZD6.js → chunk.AQ2PI6MR.js} +1 -1
- package/dist/preview/chunk.ARS4HJD2.js +1 -0
- package/dist/preview/{chunk.FDZE5LTJ.js → chunk.AWV57UBJ.js} +2 -2
- package/dist/preview/{chunk.C2C3AXGI.js → chunk.AYZL3LCR.js} +3 -3
- package/dist/preview/{chunk.FIFUMX5X.js → chunk.BHJRT57H.js} +1 -1
- package/dist/preview/{chunk.IAEHUSQQ.js → chunk.BPNW5KCP.js} +1 -1
- package/dist/preview/{chunk.HOCD7KIR.js → chunk.BQAFFEOA.js} +1 -1
- package/dist/preview/chunk.C2QKA6XY.js +1 -0
- package/dist/preview/{chunk.NJRLJEJY.js → chunk.CE3NKAF7.js} +1 -1
- package/dist/preview/{chunk.5LJVOLKR.js → chunk.CFE3MHWZ.js} +1 -1
- package/dist/preview/{chunk.DQFHIJFN.js → chunk.CGBOPPNL.js} +1 -1
- package/dist/preview/{chunk.V7W5AQKL.js → chunk.CNN32262.js} +1 -1
- package/dist/preview/{chunk.6EHHMWPP.js → chunk.DCLF4WWZ.js} +1 -1
- package/dist/preview/{chunk.OO2OP76C.js → chunk.DGDW54KE.js} +1 -1
- package/dist/preview/{chunk.XMQG2PSM.js → chunk.DLSS56EU.js} +1 -1
- package/dist/preview/{chunk.WSO7JOW5.js → chunk.DMZRFXH7.js} +1 -1
- package/dist/preview/{chunk.DEHIR4EG.js → chunk.DPHH5ZVL.js} +1 -1
- package/dist/preview/{chunk.XOE4KNP2.js → chunk.DZ6UDZOB.js} +2 -2
- package/dist/preview/{chunk.WAB3L3ZI.js → chunk.E423JCOS.js} +1 -1
- package/dist/preview/{chunk.CTASTRQN.js → chunk.EB7PZJEO.js} +1 -1
- package/dist/preview/{chunk.QPF4KSAW.js → chunk.ECNGVD25.js} +1 -1
- package/dist/preview/{chunk.JXNVNFV4.js → chunk.EGSOHTZZ.js} +1 -1
- package/dist/preview/{chunk.CEVGND3Y.js → chunk.EGVM24ND.js} +3 -3
- package/dist/preview/{chunk.6LXIEM6B.js → chunk.ENLIIZF2.js} +1 -1
- package/dist/preview/{chunk.GME63ZHI.js → chunk.EP5JS7ZH.js} +1 -1
- package/dist/preview/{chunk.QGIM2WAY.js → chunk.F5GNNVSQ.js} +1 -1
- package/dist/preview/chunk.FHQ25SWY.js +1 -0
- package/dist/preview/{chunk.OOSIKCOS.js → chunk.FSW535EA.js} +1 -1
- package/dist/preview/{chunk.ZD7T234N.js → chunk.FZELUSK5.js} +1 -1
- package/dist/preview/{chunk.LINSO5PN.js → chunk.G2BDEWJC.js} +1 -1
- package/dist/preview/chunk.GF3ZCX46.js +2 -0
- package/dist/preview/{chunk.J7W2OFHY.js → chunk.GJTEV6CK.js} +1 -1
- package/dist/preview/{chunk.VKZIEZ5C.js → chunk.GKTQ5CZA.js} +2 -2
- package/dist/preview/{chunk.GEFXU4VO.js → chunk.GONZB3J3.js} +1 -1
- package/dist/preview/{chunk.VGHO3VCB.js → chunk.GRBWXTST.js} +1 -1
- package/dist/preview/{chunk.YXEO3Y65.js → chunk.GRTBEA7O.js} +1 -1
- package/dist/preview/chunk.H3IGXHZR.js +93 -0
- package/dist/preview/{chunk.QFHWG4LN.js → chunk.H3W5C3XQ.js} +1 -1
- package/dist/preview/{chunk.TGEL6EUA.js → chunk.H4VNIAHN.js} +1 -1
- package/dist/preview/{chunk.IGK7EZCX.js → chunk.HH4D3JEI.js} +1 -1
- package/dist/preview/{chunk.F4VB6Q2W.js → chunk.HWFJQ42Y.js} +1 -1
- package/dist/preview/{chunk.OWFS2YDQ.js → chunk.HXTKBISQ.js} +1 -1
- package/dist/preview/{chunk.ZR2TP3BF.js → chunk.I34BWUB4.js} +1 -1
- package/dist/preview/{chunk.EXYCN4WI.js → chunk.I63462I3.js} +1 -1
- package/dist/preview/{chunk.7VADSNPZ.js → chunk.IKKKHHRN.js} +1 -1
- package/dist/preview/{chunk.FK722SHI.js → chunk.IPGLITWA.js} +1 -1
- package/dist/preview/{chunk.BXBEGMPO.js → chunk.IT5DVKXY.js} +2 -2
- package/dist/preview/{chunk.LLIURXFP.js → chunk.IXMIU4D4.js} +1 -1
- package/dist/preview/{chunk.INHS3KTK.js → chunk.JCETQQ7J.js} +1 -1
- package/dist/preview/{chunk.PPSYUOH7.js → chunk.JGRSUTPJ.js} +1 -1
- package/dist/preview/{chunk.4U4D7WOI.js → chunk.JLDJZET2.js} +1 -1
- package/dist/preview/{chunk.Z7Y3R3YR.js → chunk.JULD4XFB.js} +1 -1
- package/dist/preview/{chunk.PAGEGBUD.js → chunk.JV432T4Q.js} +1 -1
- package/dist/preview/{chunk.4FCFNAA4.js → chunk.KAM73WVF.js} +1 -1
- package/dist/preview/{chunk.6P6NGZ6D.js → chunk.KUCBNMIY.js} +1 -1
- package/dist/preview/{chunk.I2737CPF.js → chunk.L7XKYGV7.js} +1 -1
- package/dist/preview/{chunk.7VP6Y6D2.js → chunk.LFFJB6D3.js} +1 -1
- package/dist/preview/{chunk.BFAFCVL4.js → chunk.LMTG5NPG.js} +1 -1
- package/dist/preview/{chunk.QOS5T46W.js → chunk.LOKGUALC.js} +1 -1
- package/dist/preview/chunk.LZ6MSQ5O.js +1 -0
- package/dist/preview/chunk.MBTEOF4R.js +1 -0
- package/dist/preview/{chunk.PFQBCHQA.js → chunk.MIOLBZBS.js} +1 -1
- package/dist/preview/{chunk.PDDIQ6PK.js → chunk.MK5RPEB2.js} +1 -1
- package/dist/preview/{chunk.FV72U33M.js → chunk.MKL4THIV.js} +1 -1
- package/dist/preview/{chunk.2MHNPBHC.js → chunk.MPWLDQOG.js} +1 -1
- package/dist/preview/chunk.MSUZAJ2K.js +4 -0
- package/dist/preview/{chunk.EMFOMSMI.js → chunk.N5Z34V7U.js} +1 -1
- package/dist/preview/chunk.N64RVSH3.js +1 -0
- package/dist/preview/{chunk.5B5SRTUK.js → chunk.ND3DEDWB.js} +1 -1
- package/dist/preview/{chunk.3L4JMM3P.js → chunk.NFTPJAMJ.js} +1 -1
- package/dist/preview/{chunk.J2MM6BUW.js → chunk.NRCWMYLH.js} +1 -1
- package/dist/preview/{chunk.OPTYYIGC.js → chunk.O2VXTYUJ.js} +1 -1
- package/dist/preview/{chunk.4AC2QM7T.js → chunk.O32F6LGK.js} +1 -1
- package/dist/preview/{chunk.W53YNBSM.js → chunk.O5FTWXA2.js} +1 -1
- package/dist/preview/{chunk.U6TEW6YD.js → chunk.ODYJEDIW.js} +1 -1
- package/dist/preview/{chunk.E7EWNWAN.js → chunk.OQ4ZO3YY.js} +1 -1
- package/dist/preview/chunk.PI4RFOBU.js +1 -0
- package/dist/preview/{chunk.BMENTGDC.js → chunk.PIMAG4WT.js} +2 -2
- package/dist/preview/{chunk.DTCAUPLC.js → chunk.PLIV3IQK.js} +1 -1
- package/dist/preview/{chunk.4JULYKGD.js → chunk.PPCDPYYU.js} +1 -1
- package/dist/preview/{chunk.BGAC3B7X.js → chunk.PZQ5P6WK.js} +1 -1
- package/dist/preview/chunk.Q42R2KW4.js +1 -0
- package/dist/preview/{chunk.2KFZHUAC.js → chunk.Q4VFLLUT.js} +1 -1
- package/dist/preview/{chunk.ONYBW45K.js → chunk.Q6H5HESF.js} +1 -1
- package/dist/preview/chunk.QM54TGU6.js +3 -0
- package/dist/preview/{chunk.6MQ5NT7S.js → chunk.QOQ26NXM.js} +1 -1
- package/dist/preview/{chunk.FFOD5B4B.js → chunk.QUETLFBJ.js} +1 -1
- package/dist/preview/{chunk.DSYP43NN.js → chunk.QWLK3GKG.js} +1 -1
- package/dist/preview/{chunk.RWIN3POV.js → chunk.QYPU444Y.js} +1 -1
- package/dist/preview/{chunk.ES63XSIM.js → chunk.QZP3ARLH.js} +1 -1
- package/dist/preview/{chunk.CVPMSPCH.js → chunk.R3GE37OI.js} +1 -1
- package/dist/preview/chunk.R66ZVMWB.js +1 -0
- package/dist/preview/chunk.RD2FSSLV.js +1 -0
- package/dist/preview/{chunk.72ZCLEQC.js → chunk.RQG672MJ.js} +1 -1
- package/dist/preview/chunk.RYA7A4NA.js +1 -0
- package/dist/preview/{chunk.BUVTUAB5.js → chunk.SADR3MQI.js} +1 -1
- package/dist/preview/{chunk.EQ4OODGO.js → chunk.SS6KL5NT.js} +1 -1
- package/dist/preview/chunk.SUG6LIOX.js +1 -0
- package/dist/preview/{chunk.WSDJPXJD.js → chunk.TFJA4QV4.js} +1 -1
- package/dist/preview/{chunk.3PBTN7RO.js → chunk.TOUSIUJF.js} +1 -1
- package/dist/preview/{chunk.CU2WCYMK.js → chunk.TR4YFVZN.js} +1 -1
- package/dist/preview/{chunk.GNEOSHQ6.js → chunk.TRNJKHIA.js} +1 -1
- package/dist/preview/{chunk.72XP2ARZ.js → chunk.TVWK3SGD.js} +1 -1
- package/dist/preview/chunk.U7PAFLUM.js +1 -0
- package/dist/preview/{chunk.QU52E5RG.js → chunk.UAMPR4MD.js} +1 -1
- package/dist/preview/{chunk.KBPJ7X7W.js → chunk.UD7VLXPM.js} +1 -1
- package/dist/preview/{chunk.M6ZN2KUO.js → chunk.UFURYU4R.js} +1 -1
- package/dist/preview/{chunk.6FQW6FNL.js → chunk.UODTUBQ7.js} +1 -1
- package/dist/preview/{chunk.KHRS2SKB.js → chunk.VBHV4TLG.js} +1 -1
- package/dist/preview/{chunk.KSIEO5W7.js → chunk.VES4XMZX.js} +1 -1
- package/dist/preview/chunk.VLXLBGMY.js +90 -0
- package/dist/preview/{chunk.QWNSHISU.js → chunk.VTDOWXCP.js} +1 -1
- package/dist/preview/{chunk.5FNFRVTL.js → chunk.VV5JAM5W.js} +1 -1
- package/dist/preview/{chunk.DZFM6GSY.js → chunk.VW632VNJ.js} +1 -1
- package/dist/preview/{chunk.LSN2IPAI.js → chunk.WC5WE34A.js} +1 -1
- package/dist/preview/chunk.WN7SAAH6.js +1 -0
- package/dist/preview/{chunk.B6JRTW3A.js → chunk.WV45KLXC.js} +1 -1
- package/dist/preview/{chunk.TXHYGFIZ.js → chunk.XDZDNZ7B.js} +1 -1
- package/dist/preview/{chunk.7BIPZTJB.js → chunk.XFH6GHBQ.js} +1 -1
- package/dist/preview/{chunk.HSSIMVVM.js → chunk.XRE7SHLD.js} +1 -1
- package/dist/preview/{chunk.LETAQTLJ.js → chunk.XXCHO2A5.js} +1 -1
- package/dist/preview/{chunk.KACSYPEV.js → chunk.Y7OGJOPA.js} +1 -1
- package/dist/preview/{chunk.LGRVEHXT.js → chunk.YBQ5GVAX.js} +2 -2
- package/dist/preview/{chunk.PSQYDCVM.js → chunk.YL2RBZFE.js} +1 -1
- package/dist/preview/{chunk.BZ7QWHAE.js → chunk.YM6SWEUI.js} +1 -1
- package/dist/preview/{chunk.CBXS23YH.js → chunk.Z2X7BFCB.js} +2 -2
- package/dist/preview/{chunk.U3ED7W2U.js → chunk.Z67LBSQO.js} +1 -1
- package/dist/preview/chunk.ZKXIZBCN.js +1 -0
- package/dist/preview/{chunk.E3UL4MCD.js → chunk.ZLEBOR5T.js} +1 -1
- package/dist/preview/{chunk.5BX66FBP.js → chunk.ZLNUZ6LR.js} +1 -1
- package/dist/preview/chunk.ZMADWPJO.js +1 -0
- package/dist/preview/chunk.ZO6VMEPP.js +1 -0
- package/dist/preview/chunk.ZUG7U7AT.js +1 -0
- 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,3 +1,3 @@
|
|
|
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{G as f,Ga as u,W as m}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{G as f,Ga as u,W as m}from"./chunk.3VEZ5MOC.js";import{b as d}from"./chunk.AJZBJBMO.js";var g=d(f(),1),n=d(m(),1),c=/^\s*(\d{1,6})[.)]\s+(.*)$/s,S=/^\s*[-*•]\s+(.*)$/s;function h(o){let s=[];for(let p of o.replace(/\r\n?/g,`
|
|
2
2
|
`).split(/\n[ \t]*\n+/)){let t=null,a=()=>{t&&(t.t==="p"?t.lines.length>0:t.items.length>0)&&s.push(t),t=null};for(let e of p.split(`
|
|
3
|
-
`)){let i=c.exec(e),l=i?null:S.exec(e);if(i)t?.t!=="ol"&&(a(),t={t:"ol",start:Number(i[1]),items:[]}),t.items.push(i[2]);else if(l)t?.t!=="ul"&&(a(),t={t:"ul",items:[]}),t.items.push(l[1]);else if(t&&t.t!=="p"&&/^\s+\S/.test(e)){let r=t.items;r[r.length-1]=`${r[r.length-1]} ${e.trim()}`}else e.trim().length>0&&(t?.t!=="p"&&(a(),t={t:"p",lines:[]}),t.lines.push(e.trim()))}a()}return s}function P(o){return/[\r\n]/.test(o)}var k={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},x={margin:0},y={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"},B=u(()=>(__graviewPreload(import.meta.url,["./chunk.
|
|
3
|
+
`)){let i=c.exec(e),l=i?null:S.exec(e);if(i)t?.t!=="ol"&&(a(),t={t:"ol",start:Number(i[1]),items:[]}),t.items.push(i[2]);else if(l)t?.t!=="ul"&&(a(),t={t:"ul",items:[]}),t.items.push(l[1]);else if(t&&t.t!=="p"&&/^\s+\S/.test(e)){let r=t.items;r[r.length-1]=`${r[r.length-1]} ${e.trim()}`}else e.trim().length>0&&(t?.t!=="p"&&(a(),t={t:"p",lines:[]}),t.lines.push(e.trim()))}a()}return s}function P(o){return/[\r\n]/.test(o)}var k={display:"grid",gap:"0.7em",minWidth:0,overflowWrap:"anywhere"},x={margin:0},y={margin:0,paddingInlineStart:"1.6em",display:"grid",gap:"0.3em"},B=u(()=>(__graviewPreload(import.meta.url,["./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.GJTEV6CK.js")));function b({text:o,className:s,style:p,markdown:t,headingsFrom:a}){return t?(0,n.jsx)(g.Suspense,{fallback:(0,n.jsx)(b,{text:o,...s?{className:s}:{},...p?{style:p}:{}}),children:(0,n.jsx)(B,{text:o,...s?{className:s}:{},...p?{style:p}:{},...a?{headingsFrom:a}:{}})}):(0,n.jsx)("div",{"data-graview-text-body":"",...s?{className:s}:{},style:{...k,...p},children:h(o).map((e,i)=>e.t==="p"?(0,n.jsx)("p",{style:x,children:e.lines.map((l,r)=>(0,n.jsxs)("span",{children:[r>0?(0,n.jsx)("br",{}):null,l]},r))},i):e.t==="ol"?(0,n.jsx)("ol",{start:e.start,style:y,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i):(0,n.jsx)("ul",{style:y,children:e.items.map((l,r)=>(0,n.jsx)("li",{children:l},r))},i))})}export{P as a,b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as B,b as ve}from"./chunk.
|
|
1
|
+
import{a as B,b as ve}from"./chunk.O5FTWXA2.js";import{a as ye,c as he,d as be,f as we}from"./chunk.6ZENHSTQ.js";import{b as S,c as fe,d as me}from"./chunk.TFJA4QV4.js";import{k as ce,l as ge}from"./chunk.HWFJQ42Y.js";import{b as pe,k as q}from"./chunk.QUETLFBJ.js";import{b as de,e as ue}from"./chunk.JULD4XFB.js";import{G as Re,W as se,fa as le,h as ae,u as ie}from"./chunk.3VEZ5MOC.js";import{Na as te,Ya as re,Za as oe,ga as Z,la as ee,ua as ne}from"./chunk.6AANHELP.js";import{b as W}from"./chunk.AJZBJBMO.js";var l=W(Re(),1);var i=W(se(),1);function qe({affordance:n,onApply:a,onCancel:u,store:w}){let y=le(),s=w??y?.store,[x,_]=(0,l.useState)({}),[p,D]=(0,l.useState)(""),[I,F]=(0,l.useState)(G),[J,V]=(0,l.useState)(void 0),U=(0,l.useId)(),L=(0,l.useRef)(null),A=n.open.filter(e=>!(e.name in x)),o=A[0],v=s.allMutations().find(e=>e.name===n.mutation),P=(0,l.useMemo)(()=>De(v,s,n.args??{}),[v,s,n.args]),d=o?P[o.name]:void 0,E=ge(n.open.filter(e=>e.shape?.type==="date").map(e=>e.name)),Se=(()=>{if(!E||o?.name!==E.end||o.shape?.type!=="date")return;let e=x[E.start];if(typeof e!="string")return;let r=P[E.start];return ce(typeof r=="string"?r:void 0,e,typeof d=="string"?d:void 0,{time:o.shape.time===!0,instant:o.shape.instant===!0})})();(0,l.useEffect)(()=>{D(Se??ke(d,o?.shape)),F(Array.isArray(d)?d:G),V(d)},[o?.name]),(0,l.useEffect)(()=>{L.current?.scrollIntoView?.({block:"nearest",inline:"nearest"})},[o?.name]),(0,l.useLayoutEffect)(()=>{let e=L.current,r=typeof document>"u"?null:document.activeElement,f=r instanceof HTMLElement&&r.getAttribute("data-affordance")===n.id;if(!e||r&&r!==document.body&&!e.contains(r)&&!f)return;let b=e.querySelector('[data-testid="ask-filter"], form input, [role=group] button:not([disabled])');b&&b!==r&&b.focus()},[o?.name]);let Y=ve({flow:"both",letters:!0});if(!o)return null;let h=e=>{let r=d!==void 0&&JSON.stringify(e)===JSON.stringify(d)?void 0:e,f={...x,[o.name]:r};if(n.open.filter(R=>!(R.name in f)).length===0){let R=a(Object.fromEntries(Object.entries(f).filter(([,M])=>M!==void 0)));R&&R.length>0&&_(Object.fromEntries(Object.entries(f).filter(([M])=>!R.includes(M))))}else _(f)},O=o.optional?(0,i.jsx)("button",{type:"button",onClick:()=>h(void 0),style:{fontSize:"0.8125rem"},children:"Skip"}):null,t=o.shape??{type:"unknown"},c=t.type==="number"?t.amount:void 0,g=Ee(o,t),m=q(s.schema,v,o.name),Q=te((v?.input?.shape??{})[o.name]),xe=oe((v?.input?.shape??{})[o.name]),N=re(o.name),Ae=typeof d=="boolean"?d?"yes":"no":d,[T,Oe]=(0,l.useState)(""),X=(0,l.useMemo)(()=>{let e=g.map(r=>s.graph.getNode(r)).filter(r=>r!==void 0);return pe(e,r=>s.schema.tryDefinition(r))},[g,s]),j=e=>{let r=Ce(s,t,e),f=t.type==="choice"||t.type==="several"&&t.of.type==="choice"?m.option(e):r,b=X.get(e);return b?`${f} \xB7 ${b}`:f},$=(0,l.useMemo)(()=>{let e=T.trim().toLowerCase();return e===""?g:g.filter(r=>j(r).toLowerCase().includes(e))},[g,T,s,t,X]),k=t.type==="several",H=t.type==="file"?t:t.type==="several"&&t.of.type==="file"?t.of:void 0,K=k&&g.length===0,C=o.kinds&&o.kinds.length>0&&!o.kinds.includes("*")?o.kinds.map(e=>Z(ne(s.schema.tryDefinition(e),e))).join(" or "):m.label,Ne=n.open.length>1?`${C} \xB7 ${n.open.length-A.length+1} of ${n.open.length}`:C;return(0,i.jsxs)("div",{ref:L,"data-graview-asking":n.id,style:{display:"grid",gridTemplateColumns:"minmax(0, 1fr)",gap:4,padding:"5px 0 2px"},children:[n.open.length>1||g.length>0?(0,i.jsx)("span",{id:U,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:Ne}):null,g.length>z?(0,i.jsx)("input",{type:"search",value:T,onChange:e=>Oe(e.target.value),placeholder:`Filter ${g.length}\u2026`,"aria-label":`Filter ${C}`,"data-testid":"ask-filter",onKeyDown:e=>{if(e.key!=="ArrowDown"||e.metaKey||e.ctrlKey||e.altKey)return;let r=Y.ref.current?.querySelector(`[${B}][tabindex="0"]`);r&&(e.preventDefault(),r.focus())},style:{font:"inherit",fontSize:"0.8125rem",minWidth:0,padding:"3px 7px"}}):null,xe?(0,i.jsxs)("form",{style:{display:"grid",gap:4},onSubmit:e=>{e.preventDefault(),h(J??(d===void 0?void 0:null))},children:[(0,i.jsx)(be,{value:J,onChange:V,start:N?x[N]??P[N]:void 0,label:`${N?q(s.schema,v,N).label:m.label} repeats`,name:o.name}),(0,i.jsxs)("span",{style:{display:"flex",gap:4},children:[(0,i.jsx)("button",{type:"submit",style:{fontSize:"0.8125rem"},children:A.length>1?"Next":"Apply"}),O]})]}):Q?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(he,{relation:Q,value:d,onChange:h,label:m.label}),O]}):H?(0,i.jsxs)("div",{style:{display:"grid",gap:4},children:[(0,i.jsx)(ye,{as:"control",value:d,onChange:h,several:k,image:H.image===!0,video:H.video===!0,label:m.label}),O]}):g.length>0?(0,i.jsxs)("div",{...Y,role:"group","aria-labelledby":U,style:{display:"flex",flexWrap:"wrap",gap:4},children:[$.slice(0,z).map(e=>{let r=k?I.includes(e):e===Ae;return(0,i.jsx)("button",{type:"button",[B]:"","aria-label":`${C}: ${j(e)}`,...k?{"aria-pressed":r}:r?{"aria-current":!0}:{},style:{padding:"3px 9px",fontSize:"0.8125rem",...r?{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"}:{}},onClick:()=>k?F(f=>f.includes(e)?f.filter(b=>b!==e):[...f,e]):h(t.type==="boolean"?e==="yes":e),children:j(e)},e)}),$.length>z?(0,i.jsxs)("span",{"data-testid":"ask-more",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:[$.length-z," more \u2014 type to narrow"]}):null,$.length===0?(0,i.jsxs)("span",{"data-testid":"ask-none",style:{alignSelf:"center",fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:["None of the ",g.length," match that."]}):null,k?(0,i.jsx)("button",{type:"button",disabled:I.length===0,style:{fontSize:"0.8125rem"},onClick:()=>{let e=I;F(G),h(e)},children:A.length>1?"Next":"Apply"}):null,O]}):(0,i.jsxs)("form",{style:{display:"flex",flexWrap:"wrap",gap:4},onSubmit:e=>{if(e.preventDefault(),d!==void 0&&p===ke(d,t)){h(void 0);return}if(K){h(p.split(/[,\n]/).map(r=>r.trim()).filter(Boolean));return}if(p.trim().length!==0){if(c){let r=me(p,c);r!==void 0&&h(r);return}h(t.type==="number"?t.duration?ue(p)??p:Number(p):p)}},children:[t.type==="text"&&t.long?(0,i.jsx)("textarea",{autoFocus:!0,name:o.name,"aria-label":m.label,placeholder:m.label,value:p,rows:4,onChange:e=>D(e.target.value),onKeyDown:e=>{e.key==="Escape"?u():e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),e.currentTarget.form?.requestSubmit())},style:{flex:"1 1 100%",minWidth:0,font:"inherit",fontSize:"0.875rem",lineHeight:1.45,padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)",resize:"vertical",fieldSizing:"content",minHeight:"5.5em",maxHeight:"40vh"}}):t.type==="date"?(0,i.jsx)(we,{autoFocus:!0,name:o.name,label:m.label,value:p===""?void 0:p,time:t.time===!0,instant:t.instant===!0,partial:t.partial===!0,onChange:e=>D(e??""),onCancel:u,boxStyle:{fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}):(0,i.jsx)("input",{autoFocus:!0,type:t.type==="number"&&!t.duration&&!c?"number":t.type==="text"&&t.holds==="phone"?"tel":"text",...c?{inputMode:"decimal","data-graview-amount":c.format??"unit"}:{},name:o.name,"aria-label":m.label,placeholder:K?`${m.label}, separated by commas`:c?`${m.label}, ${S(c).hint} \u2014 ${S(c).prefix??""}${S(c).placeholder}${S(c).suffix?` ${S(c).suffix}`:""}`:m.label,value:p,...t.type==="number"&&t.min!==void 0?{min:t.min}:{},...t.type==="number"&&t.max!==void 0?{max:t.max}:{},...t.type==="number"&&t.step!==void 0?{step:t.step}:{},onChange:e=>D(e.target.value),onKeyDown:e=>{e.key==="Escape"&&u()},style:{flex:1,minWidth:0,font:"inherit",fontSize:"0.875rem",padding:"5px 8px",borderRadius:7,border:"1px solid var(--graview-edge)",background:"var(--graview-panel)",color:"var(--graview-ink)"}}),(0,i.jsx)("button",{type:"submit",disabled:!K&&p.trim().length===0,style:{fontSize:"0.8125rem"},children:A.length>1?"Next":"Apply"}),O]})]})}var G=[];function De(n,a,u){let w=n?.derived?.act==="edit"&&n.subject?u[n.subject.arg]:void 0,y=typeof w=="string"?a.graph.getNode(w):void 0;return y?Object.fromEntries((n.writes??[]).filter(s=>y[s]!==void 0&&y[s]!==null).map(s=>[s,y[s]])):{}}function ke(n,a){return typeof n=="number"?a?.type==="number"&&a.amount?fe(n,a.amount):String(n):Array.isArray(n)?n.every(u=>typeof u=="string")?n.join(", "):"":typeof n!="string"?"":n}var z=10;function Ee(n,a){return n.candidates&&n.candidates.length>0?n.candidates:a.type==="choice"?a.options:a.type==="several"&&a.of.type==="choice"?a.of.options:a.type==="boolean"?$e:[]}var $e=["yes","no"];function Ce(n,a,u){return a.type==="boolean"||a.type==="choice"||a.type==="several"&&a.of.type==="choice"?u:ze(n,u)}function ze(n,a){let u=ae(a);if(u){let s=de(n.schema,n.graph.getNode(u.from)?.kind??"",u.kind,"out");return s.charAt(0).toUpperCase()+s.slice(1)}let w=ie(a);if(w.length>0)return w.map(s=>n.schema.tryDefinition(s)?.plural??`${s}s`).join(" + ");let y=n.graph.getNode(a);return y?ee(n.schema.tryDefinition(y.kind),y):a}export{qe as a,ze as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as a}from"./chunk.
|
|
1
|
+
import{t as a}from"./chunk.CFE3MHWZ.js";import{G as f,W as s,ea as l}from"./chunk.3VEZ5MOC.js";import{b as i}from"./chunk.AJZBJBMO.js";var d=i(f(),1),p=i(s(),1),c=new Set;function B(e){return c.add(e),()=>void c.delete(e)}function S(){let{store:e,principal:o}=l();return(0,d.useMemo)(()=>n=>{let t=n.on===void 0?void 0:e.graph.getNode(n.on);if(!t)return null;let u=[...c].filter(r=>r.store===e&&r.kind===t.kind);return(n.element?u.find(r=>r.root()?.contains(n.element)??!1):u[0])?.section(t.id,o)??null},[e,o])}function v({children:e}){let o=S(),n=(0,d.useMemo)(()=>[o],[o]);return(0,p.jsx)(a,{sections:n,children:e})}export{B as a,S as b,v as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as yt}from"./chunk.JXNVNFV4.js";import{a as mt}from"./chunk.OTV5XTBB.js";import{f as pt}from"./chunk.KBPJ7X7W.js";import{a as C,f as J}from"./chunk.OEIWIZCP.js";import{F as X,J as k,L as tt,Od as dt,T as q,W as nt,Y as et,Z as rt,bc as ct,ea as ot,ga as V,la as F,oa as at,ra as st,rb as ut,ua as it,ub as ft}from"./chunk.6HY6ZGEE.js";import{e as lt}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function z(t){let e=[],n=!0;for(let r of t){if(r.text.length===0)continue;let o=r.as==="close"||r.text===","||r.text===":"||r.text.startsWith("'")||n;e.push({part:r,space:!o}),n=r.as==="open"}return e}function D(t,e){return z(t).map(({part:n,space:r})=>`${r?" ":""}${e?n.said??n.text:n.text}`).join("")}function Pt(t){return D(t,!1)}function Lt(t){return D(t,!0)}function gt(t,e=!1){let n=e?t.said:t.text;return t.record!==void 0?`${t.record} \u2014 ${n}`:n}function G(t){let e=l=>z(l).map(({part:a,space:s})=>({...a,space:s})),n=e(t.parts),r=t.when&&t.when.length>0?e(t.when):void 0,o=l=>`${D(n,l)}${r?`, when ${D(r,l)}`:""}`;return{...t,parts:n,...r?{when:r}:{},text:o(!1),said:o(!0)}}function jt(t,e=!1){return t.line?gt(t.line,e):t.message}var ht=60,b=t=>({text:t,as:"name"}),f=(t,e)=>e===void 0?{text:t,as:"word"}:{text:t,as:"word",said:e},P=(t,e)=>e===void 0||e===t?{text:t,as:"value"}:{text:t,as:"value",said:e},v=(t,e)=>({text:t,as:"op",said:e}),R={text:"(",as:"open"},w={text:")",as:"close"},W={text:"\u2014",as:"value",said:"empty"},M={">=":["\u2265","at least"],"<=":["\u2264","at most"],"<":["<","less than"],">":[">","more than"],"==":["=","is"],"!=":["\u2260","is not"]},B={">=":"<","<=":">","<":">=",">":"<=","==":"!=","!=":"=="},At={"+":["+","plus"],"-":["\u2212","minus"],"*":["\xD7","times"],"/":["\xF7","divided by"],"%":["mod","modulo"]},bt=t=>t.t==="binary"&&t.op in M;function T(t){return ot(t)}function vt(t){let{schema:e}=t,n=i=>i===null?void 0:e.tryDefinition(i),r=(i,d)=>{let y=n(i)?.edges;return y&&Object.hasOwn(y,d)?y[d]:void 0},o=(i,d)=>{let y=r(i,d)?.to;return Array.isArray(y)&&y.length===1?y[0]:null},l=(i,d)=>{let y=(e.edge(d)?.from??[]).filter(j=>{let $=r(j,d)?.to;return i===null||$==="*"||Array.isArray($)&&$.includes(i)});return y.length===1?y[0]:null},a=(i,d)=>r(i,d)?V(d).toLowerCase():T(st(n(i),d)),s=i=>T(at(e,i)),m=i=>T(pt(e).get(i)?.label??V(i)),g=i=>T(it(n(i),i)),S=(i,d)=>{let y=i===null?void 0:t.formatOf?.(i,d);if(y?.format)return y;let j=t.said?.get(d);return j?{...y,format:j}:y},u=i=>F(e.tryDefinition(i.kind),i),p=t.money?.locale,h=(i,d)=>{if(i==null)return W;if(i instanceof C){if(i.nodes.length===0)return W;let L=i.nodes.slice(0,3).map(u),Q=i.nodes.length-L.length;return P(Q>0?`${L.join(", ")} and ${Q} more`:L.length>1?`${L.slice(0,-1).join(", ")} and ${L[L.length-1]}`:L[0])}if(Array.isArray(i))return P(`{${i.map(L=>h(L,d).text).join(", ")}}`,i.map(L=>h(L,d).text).join(" or "));if(typeof i=="object")return P(u(i));if(typeof i=="boolean")return P(i?"yes":"no");let y=d?.format??(d?S(d.kind,d.key):void 0);if(typeof i=="number")return P(y&&y.format!=="date"?ct(i,{...t.money,...y}):rt(i,p));if(X.test(i)||y?.format==="date")return P(q(et(i,t.money?.timeZone)??i.slice(0,10),p));if(k.test(i))return P(nt(i,p,t.money?.timeZone));let j=d&&d.kind!==null?n(d.kind)?.display?.format?.[d.key]:void 0;if(j)return P(j(i));let $=i.length>ht?`${i.slice(0,ht-1).trimEnd()}\u2026`:i;return P(/^[a-z][a-z0-9]*([-_][a-z0-9]+)*$/.test($)?$.replace(/[-_]+/g," "):$)};return{definition:n,relation:r,farOf:o,nearOf:l,fieldName:a,plural:s,noun:g,factName:m,formatOf:S,valueWords:h,locale:p}}function E(t,e,n){if(t.t==="ident")return{kind:e,key:t.name};if(t.t==="member")return{kind:O(t.object,e,n),key:t.name};if(t.t==="call"&&(t.fn==="sum"||t.fn==="min"||t.fn==="max")&&t.args.length===2){let r=O(t.args[0],e,n),o=t.args[1];if(o.t==="ident")return{kind:r,key:o.name};if(o.t==="lit"&&typeof o.value=="string")return{kind:r,key:o.value}}if(t.t==="binary"&&(t.op==="+"||t.op==="-"))return E(t.left,e,n)??E(t.right,e,n);if(t.t==="call"&&t.fn==="if"&&t.args.length===3)return E(t.args[1],e,n)??E(t.args[2],e,n)}function O(t,e,n){switch(t.t){case"ident":return n.relation(e,t.name)?n.farOf(e,t.name):null;case"member":return n.farOf(O(t.object,e,n),t.name);case"where":return O(t.set,e,n);case"binary":return t.op==="|"||t.op==="&"||t.op==="-"?O(t.left,e,n):null;case"call":{let r=o=>{let l=t.args[o];return l?.t==="lit"&&typeof l.value=="string"?l.value:void 0};return t.fn==="all"?r(0)??null:t.fn==="out"?t.args.length===2?n.farOf(O(t.args[0],e,n),r(1)??""):n.farOf(e,r(0)??""):t.fn==="in"?t.args.length===2?n.nearOf(O(t.args[0],e,n),r(1)??""):n.nearOf(e,r(0)??""):(t.fn==="first"||t.fn==="sort")&&t.args[0]?O(t.args[0],e,n):null}default:return null}}function A(t){return t.t==="binary"?t.op==="||"?U(t)?4:1:t.op==="&&"?2:t.op in M||t.op==="in"?4:t.op==="+"||t.op==="-"?5:t.op==="*"||t.op==="/"||t.op==="%"?6:4.5:t.t==="unary"&&t.op==="!"?3:t.t==="where"?3.5:9}var K=t=>t.t==="lit",x=(t,e)=>t.t==="call"&&t.fn===e;function I(t,e){return t.t==="binary"&&t.op===e?[...I(t.left,e),...I(t.right,e)]:[t]}function U(t){if(t.t!=="binary"||t.op!=="||")return;let e=[];e.push(...I(t,"||"));let n,r=[];for(let o of e){if(o.t!=="binary"||o.op!=="=="||!K(o.right)||typeof o.right.value!="string"||n&&JSON.stringify(xt(n))!==JSON.stringify(xt(o.left)))return;n=o.left,r.push(o.right)}return n?{subject:n,values:r}:void 0}var xt=t=>JSON.parse(JSON.stringify(t,(e,n)=>e==="at"?void 0:n));function c(t,e,n,r){let o=(l,a,s=e)=>A(l)<a?[R,...c(l,s,n),w]:c(l,s,n);switch(t.t){case"lit":return[n.valueWords(t.value,r)];case"list":return[n.valueWords(t.items.map(l=>l.t==="lit"?l.value:null),r)];case"ident":return[b(n.fieldName(e,t.name))];case"member":{let l=x(t.object,"first")&&t.object.args[0]&&x(t.object.args[0],"all"),a=O(t.object,e,n);if(l&&a)return e!==null&&n.fieldName(e,t.name)===n.fieldName(a,t.name)&&n.definition(e)?.fields?.shape&&Object.prototype.hasOwnProperty.call(n.definition(e).fields.shape,t.name)?[b(`${n.noun(a)}'s ${n.fieldName(a,t.name)}`)]:[b(n.fieldName(a,t.name))];let s=c(t.object,e,n),m=s[s.length-1];return s.length===1&&m?.as==="name"?[b(`${m.text}'s ${n.fieldName(a,t.name)}`)]:[...s,f("'s"),b(n.fieldName(a,t.name))]}case"unary":return t.op==="-"?[v("\u2212","minus"),...o(t.operand,7)]:_(t.operand,e,n);case"where":{let l=O(t.set,e,n),a=c(t.filter,l,n),s=a.every(m=>m.as==="name"||m.as==="word"&&m.text==="not");return[...o(t.set,4),...s?[]:[f("with")],...A(t.filter)<=2?[R,...a,w]:a]}case"binary":return Rt(t,e,n);case"call":return St(t,e,n)}}function _(t,e,n){return bt(t)?Rt({...t,op:B[t.op]},e,n):x(t,"present")||x(t,"exists")?[...c(t.args[0],e,n),v("=","is"),W]:t.t==="ident"?[f("not"),b(n.fieldName(e,t.name))]:[f("not"),R,...c(t,e,n),w]}function Rt(t,e,n){let r=(a,s)=>A(a)<s?[R,...c(a,e,n),w]:c(a,e,n);if(t.op==="&&"||t.op==="||"){let a=U(t);if(a){let m=E(a.subject,e,n);return[...c(a.subject,e,n),v("\u2208","is one of"),n.valueWords(a.values.map(g=>g.value),m)]}let s=t.op==="&&"?2:1;return[...r(t.left,s),f(t.op==="&&"?"and":"or"),...r(t.right,s+.5)]}if(t.op in M){if(K(t.right)&&typeof t.right.value=="boolean"&&(t.op==="=="||t.op==="!="))return t.op==="=="===t.right.value?c(t.left,e,n):_(t.left,e,n);let[a,s]=M[t.op],m=E(t.left,e,n),g=E(t.right,e,n);return[...N(t.left,e,n,g),v(a,s),...N(t.right,e,n,m)]}if(t.op==="in")return[...r(t.left,5),v("\u2208","is one of"),...N(t.right,e,n,E(t.left,e,n))];let o=At[t.op];if(o){let a=A(t);return[...r(t.left,a),v(o[0],o[1]),...r(t.right,a+.5)]}let l={"|":"or","&":"and also","-":"except"};return[...r(t.left,5),f(l[t.op]??t.op),...r(t.right,5)]}function N(t,e,n,r){return t.t==="lit"||t.t==="list"?c(t,e,n,r):A(t)<5?[R,...c(t,e,n),w]:c(t,e,n)}function St(t,e,n){let r=a=>t.args[a],o=a=>{let s=t.args[a];return s?.t==="lit"&&typeof s.value=="string"?s.value:void 0},l=a=>{let s=r(a);return A(s)<9&&s.t!=="where"?[R,...c(s,e,n),w]:c(s,e,n)};switch(t.fn){case"out":{let a=o(t.args.length-1)??"",s=b(V(a).toLowerCase());return t.args.length===2?[s,f("of"),...l(0)]:[s]}case"in":{let a=o(t.args.length-1)??"",s=t.args.length===2?n.nearOf(O(r(0),e,n),a):n.nearOf(e,a),m=b(s?n.plural(s):V(a).toLowerCase());return t.args.length===2?[m,f("of"),...l(0)]:[m]}case"all":{let a=o(0),s=t.args[1]?.t==="lit"?t.args[1].value:void 0,m=s===!0?[f("archived")]:s==="all"?[f("archived or not")]:[];return s===!0?[...m,b(a?n.plural(a):"everything")]:[b(a?n.plural(a):"everything"),...m]}case"fact":{let a=o(0);return[b(a?n.factName(a):"fact")]}case"count":return[f("number of"),...l(0)];case"exists":return[...l(0),v("\u2260","is not"),W];case"present":return[...c(r(0),e,n),v("\u2260","is not"),W];case"some":case"every":{let a=O(r(0),e,n),s=r(1);return[...t.fn==="some"?[f("some")]:[],...l(0),f(t.fn==="some"?"with":"all with"),...A(s)<=2?[R,...c(s,a,n),w]:c(s,a,n)]}case"sum":case"min":case"max":{let a=O(r(0),e,n),s=r(1),m=s.t==="lit"&&typeof s.value=="string"?[b(n.fieldName(a,s.value))]:A(s)<9?[R,...c(s,a,n),w]:c(s,a,n);return[f(t.fn==="sum"?"total":t.fn==="min"?"least":"most"),...m,f("of"),...l(0)]}case"first":{let a=r(0);if(x(a,"all")){let s=a.args[0]?.value;if(typeof s=="string")return[b(`the ${n.noun(s)}`)]}return[f("first of"),...l(0)]}case"sort":return[...l(0),f("by"),...c(r(1),O(r(0),e,n),n)];case"len":return[f("length of"),...c(r(0),e,n)];case"lower":return c(r(0),e,n);case"round":return[...c(r(0),e,n),f(t.args.length===2&&K(r(1))?`rounded to ${String(r(1).value)} places`:"rounded")];case"contains":case"startsWith":return[...c(r(0),e,n),f(t.fn==="contains"?"contains":"starts with"),...N(r(1),e,n,E(r(0),e,n))];case"today":return[P("today")];case"now":return[P("now")];case"date":return K(r(0))&&typeof r(0).value=="string"?[P(q(String(r(0).value),n.locale))]:c(r(0),e,n);case"days":case"hours":{let a=t.fn,[s,m]=[r(0),r(1)];return x(m,"today")||x(m,"now")?[f(`${a} since`),...c(s,e,n)]:x(s,"today")||x(s,"now")?[f(`${a} until`),...c(m,e,n)]:[f(`${a} from`),...c(s,e,n),f("to"),...c(m,e,n)]}case"if":return[R,...c(r(1),e,n),f("if"),...c(r(0),e,n),f(","),f("else"),...c(r(2),e,n),w];case"either":return t.args.flatMap((a,s)=>s===0?c(a,e,n):[f(","),f("else"),...c(a,e,n)]);default:return[f(t.fn),R,...t.args.flatMap((a,s)=>s===0?c(a,e,n):[f(","),...c(a,e,n)]),w]}}function H(t){let e=n=>b(V(n).toLowerCase());return[f("through"),e(t.through.relation),...t.via?[f(","),f("then"),e(t.via.relation)]:[]]}function Z(t,e){let n=vt(e),r=t.over==="graph"?null:t.over,o=t.covers?[f("reaches every"),b(n.noun(t.covers.every)),...H(t.covers)]:c(t.require,r,n);return G({...r===null?{}:{kind:r},parts:o,...t.when?{when:c(t.when,r,n)}:{}})}function Y(t,e,n,r){let o=vt(e),l=t.over==="graph"?null:t.over,a=n.subject;if(t.covers)return G({...l===null?{}:{kind:l},parts:r?[f("does not reach"),o.valueWords(r),...H(t.covers)]:[f("does not reach every"),b(o.noun(t.covers.every)),...H(t.covers)],...a?{record:F(e.schema.tryDefinition(a.kind),a)}:{}});let s=u=>{try{return J(u,{...n,budget:2e3})}catch{return}},m=(u,p)=>{let h=N(u,l,o,p);if(u.t==="lit"||u.t==="list"||x(u,"today")||x(u,"now")||x(u,"date"))return h;let i=s(u);if(i===void 0)return h;let d=E(u,l,o),y=o.valueWords(i,d?{...d,format:o.formatOf(d.kind,d.key)??(p?o.formatOf(p.kind,p.key):void 0)}:p);return i instanceof C?[...h,f(":"),y]:[...h,y]},g=u=>{if(u.t==="binary"&&u.op==="&&"){let p=[];p.push(...I(u,"&&"));let h=p.filter(i=>s(i)!==!0);return(h.length>0?h:p).flatMap((i,d)=>[...d>0?[f("and")]:[],...A(i)<=2?[R,...g(i),w]:g(i)])}if(u.t==="binary"&&u.op==="||"){let p=U(u);if(p){let i=E(p.subject,l,o);return[...m(p.subject),v("\u2209","is not one of"),o.valueWords(p.values.map(d=>d.value),i)]}let h=[];return h.push(...I(u,"||")),h.flatMap((i,d)=>[...d>0?[f("and")]:[],...A(i)<=2?[R,...g(i),w]:g(i)])}if(u.t==="binary"&&u.op in M){if(K(u.right)&&typeof u.right.value=="boolean"&&(u.op==="=="||u.op==="!="))return u.op==="=="===u.right.value?_(u.left,l,o):c(u.left,l,o);let p=B[u.op],[h,i]=M[p],d=E(u.left,l,o),y=E(u.right,l,o);if(K(u.right)&&u.right.value===null)return[...p==="=="?N(u.left,l,o,y):m(u.left,y),v(h,i),W];let j=p==="=="&&(K(u.right)||K(u.left));return[...j?N(u.left,l,o,y):m(u.left,y),v(h,i),...j?N(u.right,l,o,d):m(u.right,d)]}if(u.t==="binary"&&u.op==="in")return[...m(u.left),v("\u2209","is not one of"),...N(u.right,l,o,E(u.left,l,o))];if(u.t==="unary"&&u.op==="!"){let p=u.operand;return bt(p)?g({...p,op:B[p.op]}):x(p,"present")||x(p,"exists")?[...m(p.args[0]),v("\u2260","is not"),W]:p.t==="ident"?c(p,l,o):[f("not"),R,..._(p,l,o),w]}if(x(u,"present")||x(u,"exists"))return[...c(u.args[0],l,o),v("=","is"),W];if(x(u,"some"))return[...c(u,l,o).slice(1),v("=","is"),W];if(x(u,"every")&&u.args.length===2){let p=s(u.args[0]);if(p instanceof C){let h=p.nodes.filter(i=>{try{return J(u.args[1],{...n,subject:i,budget:2e3})!==!0}catch{return!0}});return[...c(u,l,o),f(","),f("not"),o.valueWords(new C(h))]}}return u.t==="ident"?[f("not"),b(o.fieldName(l,u.name))]:[f("not"),R,...c(u,l,o),w]},S;try{S=g(t.require)}catch{S=[f("not"),R,...c(t.require,l,o),w]}return G({...l===null?{}:{kind:l},parts:S,...a?{record:F(e.schema.tryDefinition(a.kind),a)}:{}})}function wt(t){let e=new Map;for(let n of t??[])n.expr?.t==="ident"&&n.format&&(n.format==="money"||n.format==="percent"||n.format==="date")&&e.set(n.expr.name,n.format);return e}function Nt(t){return(e,n)=>{let r=t[e]?.fields?.[n],o=r?.format??(r?.type==="date"?"date":void 0);return o||r?.unit?{...o?{format:o}:{},...r?.unit?{unit:r.unit}:{}}:void 0}}function Et(t,e){return{schema:e,said:wt(t.says),...t.declared?{formatOf:Nt(t.declared)}:{},...t.money?{money:t.money}:{}}}function Xt(t,e){return t.shape?Z(t.shape,Et(t.shape,e)):void 0}var Ot=new WeakMap;function Wt(t,e){let n=new Map(t.allInvariants().map(r=>[r.name,r]));return e.map(r=>{let o=Vt(r),l=n.get(o.invariant)?.shape;if(!l||o.status&&o.status!=="violated")return o;let a=o.subjectId?t.graph.getNode(o.subjectId):void 0;if(l.over!=="graph"&&!a)return o;let s=l.kinds;s||(s=Ot.get(t.schema),s||Ot.set(t.schema,s=mt(t.schema)));try{let m=t.today?.()??l.today?.()??tt(),g=l.covers?o.nodeIds.find(p=>p!==o.subjectId):void 0,S=g?t.graph.getNode(g):void 0,u=Y(l,Et(l,t.schema),{graph:t.graph,subject:a??null,kinds:s,today:m},S);return{...o,line:u,...l.says||l.covers?{}:{message:`${o.message} \u2014 ${u.text}`}}}catch{return o}})}function $t(){ft((t,e,n,r)=>Wt({graph:t,schema:t.schema,allInvariants:()=>e,today:()=>r},n)),yt(Kt)}function Kt(t,e,n,r){let o=e.graph,l=ut.from(t.schema,o.snapshot(),{validate:!1});for(let g of n?[...r].reverse().map(lt):r)try{l.applyPrimitives([g],{restoring:!0})}catch{}let a=g=>t.violations(void 0,g),s=a(n?l:o),m=a(n?o:l);return{...dt(t.allInvariants(),s,m),violationsAfter:m}}function Vt(t){if(!t.line)return t;let{line:e,...n}=t,r=` \u2014 ${e.text}`;return n.message.endsWith(r)?{...n,message:n.message.slice(0,-r.length)}:n}$t();export{Y as brokenLineOf,$t as judgeWithLines,Kt as judgedForASeat,jt as problemWords,Xt as ruleLine,Z as ruleLineOf,gt as ruleLineWords,z as ruleSpacing,Lt as ruleSpoken,Pt as ruleText,Vt as unlined,Wt as withLines};
|
|
1
|
+
import{b as yt}from"./chunk.EGSOHTZZ.js";import{a as mt}from"./chunk.2KCDLCB2.js";import{f as pt}from"./chunk.UD7VLXPM.js";import{a as C,f as J}from"./chunk.3DEWQDP7.js";import{F as X,J as k,L as tt,Od as dt,T as q,W as nt,Y as et,Z as rt,bc as ct,ea as ot,ga as V,la as F,oa as at,ra as st,rb as ut,ua as it,ub as ft}from"./chunk.6AANHELP.js";import{e as lt}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function z(t){let e=[],n=!0;for(let r of t){if(r.text.length===0)continue;let o=r.as==="close"||r.text===","||r.text===":"||r.text.startsWith("'")||n;e.push({part:r,space:!o}),n=r.as==="open"}return e}function D(t,e){return z(t).map(({part:n,space:r})=>`${r?" ":""}${e?n.said??n.text:n.text}`).join("")}function Pt(t){return D(t,!1)}function Lt(t){return D(t,!0)}function gt(t,e=!1){let n=e?t.said:t.text;return t.record!==void 0?`${t.record} \u2014 ${n}`:n}function G(t){let e=l=>z(l).map(({part:a,space:s})=>({...a,space:s})),n=e(t.parts),r=t.when&&t.when.length>0?e(t.when):void 0,o=l=>`${D(n,l)}${r?`, when ${D(r,l)}`:""}`;return{...t,parts:n,...r?{when:r}:{},text:o(!1),said:o(!0)}}function jt(t,e=!1){return t.line?gt(t.line,e):t.message}var ht=60,b=t=>({text:t,as:"name"}),f=(t,e)=>e===void 0?{text:t,as:"word"}:{text:t,as:"word",said:e},P=(t,e)=>e===void 0||e===t?{text:t,as:"value"}:{text:t,as:"value",said:e},v=(t,e)=>({text:t,as:"op",said:e}),R={text:"(",as:"open"},w={text:")",as:"close"},W={text:"\u2014",as:"value",said:"empty"},M={">=":["\u2265","at least"],"<=":["\u2264","at most"],"<":["<","less than"],">":[">","more than"],"==":["=","is"],"!=":["\u2260","is not"]},B={">=":"<","<=":">","<":">=",">":"<=","==":"!=","!=":"=="},At={"+":["+","plus"],"-":["\u2212","minus"],"*":["\xD7","times"],"/":["\xF7","divided by"],"%":["mod","modulo"]},bt=t=>t.t==="binary"&&t.op in M;function T(t){return ot(t)}function vt(t){let{schema:e}=t,n=i=>i===null?void 0:e.tryDefinition(i),r=(i,d)=>{let y=n(i)?.edges;return y&&Object.hasOwn(y,d)?y[d]:void 0},o=(i,d)=>{let y=r(i,d)?.to;return Array.isArray(y)&&y.length===1?y[0]:null},l=(i,d)=>{let y=(e.edge(d)?.from??[]).filter(j=>{let $=r(j,d)?.to;return i===null||$==="*"||Array.isArray($)&&$.includes(i)});return y.length===1?y[0]:null},a=(i,d)=>r(i,d)?V(d).toLowerCase():T(st(n(i),d)),s=i=>T(at(e,i)),m=i=>T(pt(e).get(i)?.label??V(i)),g=i=>T(it(n(i),i)),S=(i,d)=>{let y=i===null?void 0:t.formatOf?.(i,d);if(y?.format)return y;let j=t.said?.get(d);return j?{...y,format:j}:y},u=i=>F(e.tryDefinition(i.kind),i),p=t.money?.locale,h=(i,d)=>{if(i==null)return W;if(i instanceof C){if(i.nodes.length===0)return W;let L=i.nodes.slice(0,3).map(u),Q=i.nodes.length-L.length;return P(Q>0?`${L.join(", ")} and ${Q} more`:L.length>1?`${L.slice(0,-1).join(", ")} and ${L[L.length-1]}`:L[0])}if(Array.isArray(i))return P(`{${i.map(L=>h(L,d).text).join(", ")}}`,i.map(L=>h(L,d).text).join(" or "));if(typeof i=="object")return P(u(i));if(typeof i=="boolean")return P(i?"yes":"no");let y=d?.format??(d?S(d.kind,d.key):void 0);if(typeof i=="number")return P(y&&y.format!=="date"?ct(i,{...t.money,...y}):rt(i,p));if(X.test(i)||y?.format==="date")return P(q(et(i,t.money?.timeZone)??i.slice(0,10),p));if(k.test(i))return P(nt(i,p,t.money?.timeZone));let j=d&&d.kind!==null?n(d.kind)?.display?.format?.[d.key]:void 0;if(j)return P(j(i));let $=i.length>ht?`${i.slice(0,ht-1).trimEnd()}\u2026`:i;return P(/^[a-z][a-z0-9]*([-_][a-z0-9]+)*$/.test($)?$.replace(/[-_]+/g," "):$)};return{definition:n,relation:r,farOf:o,nearOf:l,fieldName:a,plural:s,noun:g,factName:m,formatOf:S,valueWords:h,locale:p}}function E(t,e,n){if(t.t==="ident")return{kind:e,key:t.name};if(t.t==="member")return{kind:O(t.object,e,n),key:t.name};if(t.t==="call"&&(t.fn==="sum"||t.fn==="min"||t.fn==="max")&&t.args.length===2){let r=O(t.args[0],e,n),o=t.args[1];if(o.t==="ident")return{kind:r,key:o.name};if(o.t==="lit"&&typeof o.value=="string")return{kind:r,key:o.value}}if(t.t==="binary"&&(t.op==="+"||t.op==="-"))return E(t.left,e,n)??E(t.right,e,n);if(t.t==="call"&&t.fn==="if"&&t.args.length===3)return E(t.args[1],e,n)??E(t.args[2],e,n)}function O(t,e,n){switch(t.t){case"ident":return n.relation(e,t.name)?n.farOf(e,t.name):null;case"member":return n.farOf(O(t.object,e,n),t.name);case"where":return O(t.set,e,n);case"binary":return t.op==="|"||t.op==="&"||t.op==="-"?O(t.left,e,n):null;case"call":{let r=o=>{let l=t.args[o];return l?.t==="lit"&&typeof l.value=="string"?l.value:void 0};return t.fn==="all"?r(0)??null:t.fn==="out"?t.args.length===2?n.farOf(O(t.args[0],e,n),r(1)??""):n.farOf(e,r(0)??""):t.fn==="in"?t.args.length===2?n.nearOf(O(t.args[0],e,n),r(1)??""):n.nearOf(e,r(0)??""):(t.fn==="first"||t.fn==="sort")&&t.args[0]?O(t.args[0],e,n):null}default:return null}}function A(t){return t.t==="binary"?t.op==="||"?U(t)?4:1:t.op==="&&"?2:t.op in M||t.op==="in"?4:t.op==="+"||t.op==="-"?5:t.op==="*"||t.op==="/"||t.op==="%"?6:4.5:t.t==="unary"&&t.op==="!"?3:t.t==="where"?3.5:9}var K=t=>t.t==="lit",x=(t,e)=>t.t==="call"&&t.fn===e;function I(t,e){return t.t==="binary"&&t.op===e?[...I(t.left,e),...I(t.right,e)]:[t]}function U(t){if(t.t!=="binary"||t.op!=="||")return;let e=[];e.push(...I(t,"||"));let n,r=[];for(let o of e){if(o.t!=="binary"||o.op!=="=="||!K(o.right)||typeof o.right.value!="string"||n&&JSON.stringify(xt(n))!==JSON.stringify(xt(o.left)))return;n=o.left,r.push(o.right)}return n?{subject:n,values:r}:void 0}var xt=t=>JSON.parse(JSON.stringify(t,(e,n)=>e==="at"?void 0:n));function c(t,e,n,r){let o=(l,a,s=e)=>A(l)<a?[R,...c(l,s,n),w]:c(l,s,n);switch(t.t){case"lit":return[n.valueWords(t.value,r)];case"list":return[n.valueWords(t.items.map(l=>l.t==="lit"?l.value:null),r)];case"ident":return[b(n.fieldName(e,t.name))];case"member":{let l=x(t.object,"first")&&t.object.args[0]&&x(t.object.args[0],"all"),a=O(t.object,e,n);if(l&&a)return e!==null&&n.fieldName(e,t.name)===n.fieldName(a,t.name)&&n.definition(e)?.fields?.shape&&Object.prototype.hasOwnProperty.call(n.definition(e).fields.shape,t.name)?[b(`${n.noun(a)}'s ${n.fieldName(a,t.name)}`)]:[b(n.fieldName(a,t.name))];let s=c(t.object,e,n),m=s[s.length-1];return s.length===1&&m?.as==="name"?[b(`${m.text}'s ${n.fieldName(a,t.name)}`)]:[...s,f("'s"),b(n.fieldName(a,t.name))]}case"unary":return t.op==="-"?[v("\u2212","minus"),...o(t.operand,7)]:_(t.operand,e,n);case"where":{let l=O(t.set,e,n),a=c(t.filter,l,n),s=a.every(m=>m.as==="name"||m.as==="word"&&m.text==="not");return[...o(t.set,4),...s?[]:[f("with")],...A(t.filter)<=2?[R,...a,w]:a]}case"binary":return Rt(t,e,n);case"call":return St(t,e,n)}}function _(t,e,n){return bt(t)?Rt({...t,op:B[t.op]},e,n):x(t,"present")||x(t,"exists")?[...c(t.args[0],e,n),v("=","is"),W]:t.t==="ident"?[f("not"),b(n.fieldName(e,t.name))]:[f("not"),R,...c(t,e,n),w]}function Rt(t,e,n){let r=(a,s)=>A(a)<s?[R,...c(a,e,n),w]:c(a,e,n);if(t.op==="&&"||t.op==="||"){let a=U(t);if(a){let m=E(a.subject,e,n);return[...c(a.subject,e,n),v("\u2208","is one of"),n.valueWords(a.values.map(g=>g.value),m)]}let s=t.op==="&&"?2:1;return[...r(t.left,s),f(t.op==="&&"?"and":"or"),...r(t.right,s+.5)]}if(t.op in M){if(K(t.right)&&typeof t.right.value=="boolean"&&(t.op==="=="||t.op==="!="))return t.op==="=="===t.right.value?c(t.left,e,n):_(t.left,e,n);let[a,s]=M[t.op],m=E(t.left,e,n),g=E(t.right,e,n);return[...N(t.left,e,n,g),v(a,s),...N(t.right,e,n,m)]}if(t.op==="in")return[...r(t.left,5),v("\u2208","is one of"),...N(t.right,e,n,E(t.left,e,n))];let o=At[t.op];if(o){let a=A(t);return[...r(t.left,a),v(o[0],o[1]),...r(t.right,a+.5)]}let l={"|":"or","&":"and also","-":"except"};return[...r(t.left,5),f(l[t.op]??t.op),...r(t.right,5)]}function N(t,e,n,r){return t.t==="lit"||t.t==="list"?c(t,e,n,r):A(t)<5?[R,...c(t,e,n),w]:c(t,e,n)}function St(t,e,n){let r=a=>t.args[a],o=a=>{let s=t.args[a];return s?.t==="lit"&&typeof s.value=="string"?s.value:void 0},l=a=>{let s=r(a);return A(s)<9&&s.t!=="where"?[R,...c(s,e,n),w]:c(s,e,n)};switch(t.fn){case"out":{let a=o(t.args.length-1)??"",s=b(V(a).toLowerCase());return t.args.length===2?[s,f("of"),...l(0)]:[s]}case"in":{let a=o(t.args.length-1)??"",s=t.args.length===2?n.nearOf(O(r(0),e,n),a):n.nearOf(e,a),m=b(s?n.plural(s):V(a).toLowerCase());return t.args.length===2?[m,f("of"),...l(0)]:[m]}case"all":{let a=o(0),s=t.args[1]?.t==="lit"?t.args[1].value:void 0,m=s===!0?[f("archived")]:s==="all"?[f("archived or not")]:[];return s===!0?[...m,b(a?n.plural(a):"everything")]:[b(a?n.plural(a):"everything"),...m]}case"fact":{let a=o(0);return[b(a?n.factName(a):"fact")]}case"count":return[f("number of"),...l(0)];case"exists":return[...l(0),v("\u2260","is not"),W];case"present":return[...c(r(0),e,n),v("\u2260","is not"),W];case"some":case"every":{let a=O(r(0),e,n),s=r(1);return[...t.fn==="some"?[f("some")]:[],...l(0),f(t.fn==="some"?"with":"all with"),...A(s)<=2?[R,...c(s,a,n),w]:c(s,a,n)]}case"sum":case"min":case"max":{let a=O(r(0),e,n),s=r(1),m=s.t==="lit"&&typeof s.value=="string"?[b(n.fieldName(a,s.value))]:A(s)<9?[R,...c(s,a,n),w]:c(s,a,n);return[f(t.fn==="sum"?"total":t.fn==="min"?"least":"most"),...m,f("of"),...l(0)]}case"first":{let a=r(0);if(x(a,"all")){let s=a.args[0]?.value;if(typeof s=="string")return[b(`the ${n.noun(s)}`)]}return[f("first of"),...l(0)]}case"sort":return[...l(0),f("by"),...c(r(1),O(r(0),e,n),n)];case"len":return[f("length of"),...c(r(0),e,n)];case"lower":return c(r(0),e,n);case"round":return[...c(r(0),e,n),f(t.args.length===2&&K(r(1))?`rounded to ${String(r(1).value)} places`:"rounded")];case"contains":case"startsWith":return[...c(r(0),e,n),f(t.fn==="contains"?"contains":"starts with"),...N(r(1),e,n,E(r(0),e,n))];case"today":return[P("today")];case"now":return[P("now")];case"date":return K(r(0))&&typeof r(0).value=="string"?[P(q(String(r(0).value),n.locale))]:c(r(0),e,n);case"days":case"hours":{let a=t.fn,[s,m]=[r(0),r(1)];return x(m,"today")||x(m,"now")?[f(`${a} since`),...c(s,e,n)]:x(s,"today")||x(s,"now")?[f(`${a} until`),...c(m,e,n)]:[f(`${a} from`),...c(s,e,n),f("to"),...c(m,e,n)]}case"if":return[R,...c(r(1),e,n),f("if"),...c(r(0),e,n),f(","),f("else"),...c(r(2),e,n),w];case"either":return t.args.flatMap((a,s)=>s===0?c(a,e,n):[f(","),f("else"),...c(a,e,n)]);default:return[f(t.fn),R,...t.args.flatMap((a,s)=>s===0?c(a,e,n):[f(","),...c(a,e,n)]),w]}}function H(t){let e=n=>b(V(n).toLowerCase());return[f("through"),e(t.through.relation),...t.via?[f(","),f("then"),e(t.via.relation)]:[]]}function Z(t,e){let n=vt(e),r=t.over==="graph"?null:t.over,o=t.covers?[f("reaches every"),b(n.noun(t.covers.every)),...H(t.covers)]:c(t.require,r,n);return G({...r===null?{}:{kind:r},parts:o,...t.when?{when:c(t.when,r,n)}:{}})}function Y(t,e,n,r){let o=vt(e),l=t.over==="graph"?null:t.over,a=n.subject;if(t.covers)return G({...l===null?{}:{kind:l},parts:r?[f("does not reach"),o.valueWords(r),...H(t.covers)]:[f("does not reach every"),b(o.noun(t.covers.every)),...H(t.covers)],...a?{record:F(e.schema.tryDefinition(a.kind),a)}:{}});let s=u=>{try{return J(u,{...n,budget:2e3})}catch{return}},m=(u,p)=>{let h=N(u,l,o,p);if(u.t==="lit"||u.t==="list"||x(u,"today")||x(u,"now")||x(u,"date"))return h;let i=s(u);if(i===void 0)return h;let d=E(u,l,o),y=o.valueWords(i,d?{...d,format:o.formatOf(d.kind,d.key)??(p?o.formatOf(p.kind,p.key):void 0)}:p);return i instanceof C?[...h,f(":"),y]:[...h,y]},g=u=>{if(u.t==="binary"&&u.op==="&&"){let p=[];p.push(...I(u,"&&"));let h=p.filter(i=>s(i)!==!0);return(h.length>0?h:p).flatMap((i,d)=>[...d>0?[f("and")]:[],...A(i)<=2?[R,...g(i),w]:g(i)])}if(u.t==="binary"&&u.op==="||"){let p=U(u);if(p){let i=E(p.subject,l,o);return[...m(p.subject),v("\u2209","is not one of"),o.valueWords(p.values.map(d=>d.value),i)]}let h=[];return h.push(...I(u,"||")),h.flatMap((i,d)=>[...d>0?[f("and")]:[],...A(i)<=2?[R,...g(i),w]:g(i)])}if(u.t==="binary"&&u.op in M){if(K(u.right)&&typeof u.right.value=="boolean"&&(u.op==="=="||u.op==="!="))return u.op==="=="===u.right.value?_(u.left,l,o):c(u.left,l,o);let p=B[u.op],[h,i]=M[p],d=E(u.left,l,o),y=E(u.right,l,o);if(K(u.right)&&u.right.value===null)return[...p==="=="?N(u.left,l,o,y):m(u.left,y),v(h,i),W];let j=p==="=="&&(K(u.right)||K(u.left));return[...j?N(u.left,l,o,y):m(u.left,y),v(h,i),...j?N(u.right,l,o,d):m(u.right,d)]}if(u.t==="binary"&&u.op==="in")return[...m(u.left),v("\u2209","is not one of"),...N(u.right,l,o,E(u.left,l,o))];if(u.t==="unary"&&u.op==="!"){let p=u.operand;return bt(p)?g({...p,op:B[p.op]}):x(p,"present")||x(p,"exists")?[...m(p.args[0]),v("\u2260","is not"),W]:p.t==="ident"?c(p,l,o):[f("not"),R,..._(p,l,o),w]}if(x(u,"present")||x(u,"exists"))return[...c(u.args[0],l,o),v("=","is"),W];if(x(u,"some"))return[...c(u,l,o).slice(1),v("=","is"),W];if(x(u,"every")&&u.args.length===2){let p=s(u.args[0]);if(p instanceof C){let h=p.nodes.filter(i=>{try{return J(u.args[1],{...n,subject:i,budget:2e3})!==!0}catch{return!0}});return[...c(u,l,o),f(","),f("not"),o.valueWords(new C(h))]}}return u.t==="ident"?[f("not"),b(o.fieldName(l,u.name))]:[f("not"),R,...c(u,l,o),w]},S;try{S=g(t.require)}catch{S=[f("not"),R,...c(t.require,l,o),w]}return G({...l===null?{}:{kind:l},parts:S,...a?{record:F(e.schema.tryDefinition(a.kind),a)}:{}})}function wt(t){let e=new Map;for(let n of t??[])n.expr?.t==="ident"&&n.format&&(n.format==="money"||n.format==="percent"||n.format==="date")&&e.set(n.expr.name,n.format);return e}function Nt(t){return(e,n)=>{let r=t[e]?.fields?.[n],o=r?.format??(r?.type==="date"?"date":void 0);return o||r?.unit?{...o?{format:o}:{},...r?.unit?{unit:r.unit}:{}}:void 0}}function Et(t,e){return{schema:e,said:wt(t.says),...t.declared?{formatOf:Nt(t.declared)}:{},...t.money?{money:t.money}:{}}}function Xt(t,e){return t.shape?Z(t.shape,Et(t.shape,e)):void 0}var Ot=new WeakMap;function Wt(t,e){let n=new Map(t.allInvariants().map(r=>[r.name,r]));return e.map(r=>{let o=Vt(r),l=n.get(o.invariant)?.shape;if(!l||o.status&&o.status!=="violated")return o;let a=o.subjectId?t.graph.getNode(o.subjectId):void 0;if(l.over!=="graph"&&!a)return o;let s=l.kinds;s||(s=Ot.get(t.schema),s||Ot.set(t.schema,s=mt(t.schema)));try{let m=t.today?.()??l.today?.()??tt(),g=l.covers?o.nodeIds.find(p=>p!==o.subjectId):void 0,S=g?t.graph.getNode(g):void 0,u=Y(l,Et(l,t.schema),{graph:t.graph,subject:a??null,kinds:s,today:m},S);return{...o,line:u,...l.says||l.covers?{}:{message:`${o.message} \u2014 ${u.text}`}}}catch{return o}})}function $t(){ft((t,e,n,r)=>Wt({graph:t,schema:t.schema,allInvariants:()=>e,today:()=>r},n)),yt(Kt)}function Kt(t,e,n,r){let o=e.graph,l=ut.from(t.schema,o.snapshot(),{validate:!1});for(let g of n?[...r].reverse().map(lt):r)try{l.applyPrimitives([g],{restoring:!0})}catch{}let a=g=>t.violations(void 0,g),s=a(n?l:o),m=a(n?o:l);return{...dt(t.allInvariants(),s,m),violationsAfter:m}}function Vt(t){if(!t.line)return t;let{line:e,...n}=t,r=` \u2014 ${e.text}`;return n.message.endsWith(r)?{...n,message:n.message.slice(0,-r.length)}:n}$t();export{Y as brokenLineOf,$t as judgeWithLines,Kt as judgedForASeat,jt as problemWords,Xt as ruleLine,Z as ruleLineOf,gt as ruleLineWords,z as ruleSpacing,Lt as ruleSpoken,Pt as ruleText,Vt as unlined,Wt as withLines};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Hb as O,Ib as P,Kb as h,Lb as j,Ub as x,vd as E,wd as G,yb as k,yd as F,zd as J}from"./chunk.
|
|
1
|
+
import{Hb as O,Ib as P,Kb as h,Lb as j,Ub as x,vd as E,wd as G,yb as k,yd as F,zd as J}from"./chunk.6AANHELP.js";var W=(o,a)=>{let t=o.kindOf(a);return t===void 0?void 0:o.kept?.({id:a,kind:t})};function w(o,a){return o.flatMap(t=>{if(t.op==="splice-text")return W(a,t.id)?.(t.field)?[]:[t];if(t.op!=="patch-node")return[t];let i=W(a,t.id);if(!i||!Object.keys(t.after).some(i))return[t];let c=r=>Object.fromEntries(Object.entries(r).filter(([f])=>!i(f))),n=c(t.after);return Object.keys(n).length===0?[]:[{op:"patch-node",id:t.id,before:c(t.before),after:n}]})}function _(o,a,t){if(!G(o,a))return t;let i=F(o,a),c=r=>o.graph.getNode(r)!==void 0||x(o.log).kindOf(r)!==void 0,n={...t};if(t.diff){let r=t.diff,f=E(o.log),l=o.log.length??o.log.all().length,u=t.ops?.[0]?.seq??l,M=k(a).id,y=(e,s)=>d=>f.writerAt(e,d,s),m=(e,s)=>i.shows(e.id)?i.servedWith(e,s):void 0,b=(e,s)=>e.flatMap(d=>m(d,s(d.id))??[]),S=e=>i.shows(e.from)&&i.shows(e.to)&&!h(e,i.sees),v=(e,s)=>t.ops?y(e,l):d=>s===void 0||s.includes(d)?M:f.writerAt(e,d,l),D=r.changedNodes.flatMap(e=>{let s=m(e.before,y(e.before.id,u)),d=m(e.after,v(e.after.id,e.fields));return s&&d?[{before:s,after:d,fields:e.fields.filter(p=>p in s||p in d)}]:[]}),B=new Set(r.changedNodes.map(e=>e.after.id)),g=new Map;for(let e of t.ops?.flatMap(s=>s.primitives)??t.primitives??[])e.op!=="patch-node"&&e.op!=="splice-text"||B.has(e.id)||g.set(e.id,[...g.get(e.id)??[],...e.op==="splice-text"?[e.field]:Object.keys(e.after)]);let I=[...g].flatMap(([e,s])=>{let d=o.graph.getNode(e);if(!d)return[];let p=m(d,y(e,u)),N=m(d,v(e,s));return p&&N&&JSON.stringify(p)!==JSON.stringify(N)?[{before:p,after:N,fields:s}]:[]});n.diff={addedNodes:b(r.addedNodes,e=>v(e)),removedNodes:b(r.removedNodes,e=>y(e,u)),changedNodes:[...D,...I],addedEdges:r.addedEdges.filter(S),removedEdges:r.removedEdges.filter(S),touched:[...r.touched.filter(i.shows),...[...g.keys()].filter(e=>i.shows(e)&&!r.touched.includes(e))]}}if(t.ops&&(n.ops=j(t.ops,i)),t.primitives){let r=n.ops;n.primitives=r?r.flatMap(f=>f.primitives):i.timeline?O(t.primitives,i.timeline,{served:(f,l)=>i.servedWith(f,l),edgeClean:f=>!h(f,i.sees),sees:i.sees},k(a).id):j([{id:"",seq:0,batch:"",author:{kind:"system"},intent:"",mutation:null,primitives:t.primitives,reads:[],writes:[],at:""}],i)[0].primitives}return i.kept&&n.primitives&&(n.primitives=w(n.primitives,i)),t.reads&&(n.reads=t.reads.filter(r=>i.shows(r)&&c(r))),t.writes&&(n.writes=t.writes.filter(i.shows)),t.intent!==void 0&&h(t.intent,i.sees)&&(n.intent=P),t.violationsAfter&&Object.assign(n,A?A(o,J(o,a),!!t.ops,n.primitives??[]):{introduces:[],resolves:[],violationsAfter:[]}),n}var A,z=o=>void(A=o);export{_ as a,z as b};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as O}from"./chunk.HWFJQ42Y.js";import{_ as N}from"./chunk.6AANHELP.js";var H=/^h([1-6])$/,D={section:null,article:null,form:null,region:null,nav:"navigation",navigation:"navigation",main:"main content",header:"header",banner:"header",footer:"footer",contentinfo:"footer",aside:"aside",complementary:"aside",search:"search"},G=e=>typeof e=="object"&&e!==null&&typeof e.getAttribute=="function"&&(e.nodeType===void 0||e.nodeType===1),$=e=>(e??"").replace(/\s+/g," ").trim();function*x(e){yield e;for(let r of Array.from(e.childNodes))G(r)&&(yield*x(r))}var P=e=>(e.getAttribute("data-graview-as")??e.localName??"").toLowerCase();function C(e){let r=H.exec(P(e));return r?Number(r[1]):e.getAttribute("role")==="heading"?Number(e.getAttribute("aria-level")??2):void 0}function R(e){let r=[...x(e)],i=new Map;for(let n of r){let d=n.getAttribute("id");d&&i.set(d,n)}let t=[],g=new Set,a=(n,d)=>{let s=n.toLowerCase();!n||g.has(s)||(g.add(s),t.push({name:n.length>80?`${n.slice(0,79)}\u2026`:n,as:d}))};for(let n of r){if(n.getAttribute("aria-hidden")==="true"||n.getAttribute("hidden")!==null)continue;if(C(n)!==void 0){a($(n.textContent),"heading");continue}let s=P(n),f=(n.getAttribute("role")??"").toLowerCase(),l=f in D?f:s in D?s:void 0;if(!l)continue;let m=(n.getAttribute("aria-labelledby")??"").split(/\s+/).flatMap(u=>i.get(u)?[$(i.get(u).textContent)]:[]).join(" "),c=[...x(n)].find(u=>u!==n&&C(u)!==void 0),o=$(n.getAttribute("aria-label"))||m||(c?$(c.textContent):"")||D[l]||"";a(o,l==="region"?"section":l)}return t}var v="\0";function _(e){let r=[],i=e.length,t=0,g="",a=l=>l.replace(/\\(u\{[0-9a-fA-F]+\}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{2}|.)/gs,(m,c)=>c==="n"?`
|
|
2
2
|
`:c==="t"?" ":c[0]==="u"||c[0]==="x"?String.fromCodePoint(parseInt(c.replace(/[ux{}]/g,""),16)):c),n=l=>{let m=++t;for(;t<i&&e[t]!==l&&e[t]!==`
|
|
3
3
|
`;)t+=e[t]==="\\"?2:1;let c=e.slice(m,t);return t++,a(c)},d=()=>{t++;let l=!1;for(;t<i&&e[t]!==`
|
|
4
4
|
`;){let m=e[t];if(m==="\\")t+=2;else if(m==="[")l=!0,t++;else if(m==="]")l=!1,t++;else{if(m==="/"&&!l)break;t++}}for(t++;t<i&&/[a-z]/i.test(e[t]);)t++},s=()=>{t++;let l="";for(;t<i;){let m=e[t];if(m==="\\")l+=a(e.slice(t,t+2)),t+=2;else{if(m==="`")return t++,l;m==="$"&&e[t+1]==="{"?(t+=2,f(!0),l+=v):(l+=m,t++)}}return l};function f(l){let m=0;for(;t<i;){let c=e[t];if(c==="/"&&e[t+1]==="/"){let o=e.indexOf(`
|
|
5
|
-
`,t);t=o<0?i:o}else if(c==="/"&&e[t+1]==="*"){let o=e.indexOf("*/",t+2);t=o<0?i:o+2}else if(c==='"'||c==="'")r.push(n(c)),g="a";else if(c==="`")r.push(s()),g="a";else if(c==="/"&&(g===""||"(,=:[!&|?{};+-*%<>~^".includes(g)))d(),g="a";else{if(c==="{"&&m++,c==="}"){if(l&&m===0){t++;return}m--}/\s/.test(c)||(g=c),t++}}}return f(!1),r}var F=e=>e.replace(/\s+/g," ").replace(/\s*([>+~,])\s*/g,"$1").trim();function J(e){let r=[],i=0,t=0;for(let g=0;g<e.length;g++){let a=e[g];a==="("||a==="["?i++:a===")"||a==="]"?i--:a===","&&i===0&&(r.push(e.slice(t,g)),t=g+1)}return r.push(e.slice(t)),r.map(F).filter(Boolean)}var K=new Set(["media","supports","container","layer","scope","document"]);function
|
|
6
|
-
`).length}`;function ie(e,r){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(r.today))return[];let{today:i}=r,t=r.title?.trim()||"This view",g=
|
|
5
|
+
`,t);t=o<0?i:o}else if(c==="/"&&e[t+1]==="*"){let o=e.indexOf("*/",t+2);t=o<0?i:o+2}else if(c==='"'||c==="'")r.push(n(c)),g="a";else if(c==="`")r.push(s()),g="a";else if(c==="/"&&(g===""||"(,=:[!&|?{};+-*%<>~^".includes(g)))d(),g="a";else{if(c==="{"&&m++,c==="}"){if(l&&m===0){t++;return}m--}/\s/.test(c)||(g=c),t++}}}return f(!1),r}var F=e=>e.replace(/\s+/g," ").replace(/\s*([>+~,])\s*/g,"$1").trim();function J(e){let r=[],i=0,t=0;for(let g=0;g<e.length;g++){let a=e[g];a==="("||a==="["?i++:a===")"||a==="]"?i--:a===","&&i===0&&(r.push(e.slice(t,g)),t=g+1)}return r.push(e.slice(t)),r.map(F).filter(Boolean)}var K=new Set(["media","supports","container","layer","scope","document"]);function k(e){let r=e.replace(/\/\*[\s\S]*?\*\//g,""),i=[],t=n=>{let d=r[n],s=n+1;for(;s<r.length&&r[s]!==d;)s+=r[s]==="\\"?2:1;return s+1},g=n=>{let d=1,s=n;for(;s<r.length&&d>0;){let f=r[s];if(f==='"'||f==="'"){s=t(s);continue}f==="{"?d++:f==="}"&&d--,s++}return s},a=n=>{let d="",s=n;for(;s<r.length;){let f=r[s];if(f==='"'||f==="'"){let l=t(s);d+=r.slice(s,l),s=l}else{if(f==="}")return s+1;if(f===";")d="",s++;else if(f==="{"){let l=d.trim();if(d="",l.startsWith("@")){let m=(/^@([\w-]+)/.exec(l)?.[1]??"").toLowerCase();s=K.has(m)?a(s+1):g(s+1)}else i.push(...J(l)),s=g(s+1)}else d+=f,s++}}return s};return a(0),[...new Set(i)]}function A(e){let r=e.replace(/\[[^\]]*\]/g,"").replace(/"[^"]*"|'[^']*'/g,"");return[...new Set([...r.matchAll(/([.#])(-?[_a-zA-Z -][\w --]*)/g)].map(i=>`${i[1]}${i[2]}`))]}var z=e=>!e.includes(v)&&e.length<300&&!/[<;!@]|=>|^\d/.test(e)&&/^[\w\s.#:>+~*()[\]="'^$|,\\%-]+$/u.test(e),Y=/\b(?:class|className)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,q=/\bid\s*=\s*(?:"([^"]*)"|'([^']*)')/g,Z=/<h([1-6])\b[^>]*>([\s\S]*?)<\/h\1\s*>/gi,Q=/<(section|nav|main|aside|header|footer|article|form)\b[^>]*?\baria-label\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;function T(e){let r=e.css===void 0||e.drawing===void 0&&e.classes===void 0?_(e.source):[],i=e.css!==void 0?k(e.css):[...new Set(r.filter(a=>a.includes("{")&&a.includes("}")).flatMap(a=>k(a)).filter(z))],t=new Set,g;if(e.drawing){for(let a of x(e.drawing)){for(let d of(a.getAttribute("class")??"").split(/\s+/))d&&t.add(`.${d}`);let n=a.getAttribute("id");n&&t.add(`#${n}`)}g=R(e.drawing)}else{let a=s=>(s[1]??s[2]??"").split(/\s+/).filter(f=>f&&!f.includes(v));for(let s of r){for(let f of s.matchAll(Y))for(let l of a(f))t.add(`.${l}`);for(let f of s.matchAll(q))for(let l of a(f))t.add(`#${l}`)}let n=new Set;g=[];let d=(s,f)=>{let l=s.replace(/\s+/g," ").trim();!l||l.includes(v)||n.has(l.toLowerCase())||(n.add(l.toLowerCase()),g.push({name:l,as:f}))};for(let s of r){for(let f of s.matchAll(Q))d(f[2]??f[3]??"",f[1].toLowerCase());for(let f of s.matchAll(Z))d(f[2].replace(/<[^>]*>/g,""),"heading")}}for(let a of e.classes??[])t.add(`.${a}`);return{from:e.drawing||e.classes?"drawing":"source",selectors:i,drawn:t,sections:g}}var E=8,M=e=>e.length<=E?e.join(", "):`${e.slice(0,E).join(", ")} and ${e.length-E} more`,I=e=>`${Math.round(e).toLocaleString("en-US")}px`;function X(e,r){let i=T(e),t=T(r),g=new Set(t.selectors.flatMap(A)),a=new Map;for(let h of i.selectors)for(let y of A(h))y.startsWith(".")&&a.set(y,[...a.get(y)??[],h]);let n=[...a].filter(([h])=>t.drawn.has(h)&&!g.has(h)).map(([h,y])=>({class:h.slice(1),styledBy:y})),d=new Set(n.map(h=>`.${h.class}`)),s=new Set(t.selectors),f=i.selectors.filter(h=>!s.has(h)).map(h=>({selector:h,names:A(h)})).filter(h=>h.names.length>0&&h.names.every(y=>t.drawn.has(y)&&(i.from==="source"||i.drawn.has(y)))),l=new Set(t.sections.map(h=>h.name.toLowerCase())),m=i.sections.filter(h=>!l.has(h.name.toLowerCase())),c=e.height!==void 0&&r.height!==void 0&&e.height>0?{before:e.height,after:r.height,change:r.height-e.height,ratio:Math.round((r.height-e.height)/e.height*1e3)/1e3}:void 0,o=c!==void 0&&Math.abs(c.ratio)>=.1&&Math.abs(c.change)>=50,u=[];if(n.length>0){let h=n.map(y=>`.${y.class}`);u.push(`${n.length===1?"A class":`${n.length} classes`} it still draws lost every rule that styled ${n.length===1?"it":"them"} before: ${M(h)}. Put back the rules for ${n.length===1?"it":"them"}, or stop drawing ${n.length===1?"it":"them"}.`)}let p=f.filter(h=>!h.names.some(y=>d.has(y)));p.length>0&&u.push(`${p.length===1?"A rule was":`${p.length} rules were`} taken out while the markup ${p.length===1?"it":"they"} styled is still drawn: ${M(p.map(h=>`"${h.selector}"`))}.`),m.length>0&&u.push(`${m.length===1?"A section":`${m.length} sections`} drawn before ${m.length===1?"is":"are"} not drawn now: ${M(m.map(h=>`"${h.name}"`))}.`),c&&o&&u.push(`The page is ${I(c.after)} tall, ${c.change<0?"down":"up"} from ${I(c.before)} (${c.change<0?"\u2212":"+"}${Math.round(Math.abs(c.ratio)*100)}%).`);let w=u.length>0;return{regressed:w,unstyled:n,selectorsRemoved:f,sectionsMissing:m,...c?{height:c}:{},read:{before:i.from,after:t.from},said:u,text:w?u.join(" "):`Nothing it drew before lost its style, and no section it drew is gone${c?"; the page is about as tall":""}.`}}var j=String.raw`(?:Mon(?:day)?|Tue(?:s(?:day)?)?|Wed(?:nesday)?|Thu(?:r(?:s(?:day)?)?)?|Fri(?:day)?|Sat(?:urday)?|Sun(?:day)?)\.?`,ee=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],V=String.raw`(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|June?|July?|Aug(?:ust)?|Sept?(?:ember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\.?`,U=String.raw`(?:st|nd|rd|th)?`,te=[/\b(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})\b/g,new RegExp(String.raw`\b(?:${j},?\s+)?(?<day>\d{1,2})${U}\s+(?<name>${V})(?![a-z])(?:,?\s+(?<year>\d{4})\b)?`,"g"),new RegExp(String.raw`\b(?:${j},?\s+)?(?<name>${V})\s+(?<day>\d{1,2})${U}(?!\d)\b(?:,?\s+(?<year>\d{4})\b)?`,"g")],ne=/^(?:.*today.*|now|current_?(?:day|date))$/i,se=/\b([A-Za-z_$][\w$]*)\s*[:=]\s*(?:new\s+Date\(\s*)?(["'`])(\d{4}-\d{2}-\d{2})[^"'`\n]*\2/g,B=String.raw`(?:today|tomorrow|yesterday|tonight)`,W=String.raw`[\s·•|,:()\-–—]{1,5}`;function re(e,r){let i=e.month!==void 0?Number(e.month):ee.indexOf(e.name.slice(0,3))+1,t=Number(e.day);if(!(i>=1&&i<=12&&t>=1&&t<=31))return;let g=d=>`${d}-${String(i).padStart(2,"0")}-${String(t).padStart(2,"0")}`;if(e.year!==void 0)return g(Number(e.year));let a=Number(r.slice(0,4)),n=d=>Math.abs(Date.parse(d)-Date.parse(r));return[a-1,a,a+1].map(g).sort((d,s)=>n(d)-n(s))[0]}function oe(e,r){let i=[];for(let t of te)for(let g of e.matchAll(t)){let a=g.index,n=a+g[0].length;if(i.some(s=>a<s.to&&n>s.from))continue;let d=re(g.groups??{},r);d!==void 0&&!Number.isNaN(Date.parse(d))&&i.push({from:a,to:n,day:d})}return i.sort((t,g)=>t.from-g.from)}var L=(e,r)=>`source line ${e.slice(0,r).split(`
|
|
6
|
+
`).length}`;function ie(e,r){if(typeof e!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(r.today))return[];let{today:i}=r,t=r.title?.trim()||"This view",g=N(i,{weekday:"short",year:!1},r.locale),a=o=>`${t} may be out of date: it says \u201C${o}\u201D and today is ${g}. Read today from graview instead.`,n=[],d=(o,u)=>n.some(p=>o<p.to&&u>p.from);for(let o of e.matchAll(se)){if(!ne.test(o[1]))continue;let u=`${o[1]} = "${o[3]}"`;n.push({at:L(e,o.index),phrase:u,why:"today",says:a(u),from:o.index,to:o.index+o[0].length})}let s=new RegExp(String.raw`\b${B}${W}$`,"i"),f=new RegExp(String.raw`^${W}${B}\b`,"i"),l=/\b(?:due|by|until|on)\s+$/i,m=O(i,-(r.pastDays??31));for(let o of oe(e,i)){if(d(o.from,o.to)||/fromToday\(\s*["'`]$/.test(e.slice(Math.max(0,o.from-24),o.from)))continue;let u=e.slice(Math.max(0,o.from-16),o.from),p=e.slice(o.to,o.to+16),w=s.exec(u),h=f.exec(p);if(w||h){let y=w?o.from-w[0].length:o.from,b=h?o.to+h[0].length:o.to,S=e.slice(y,b).replace(/\s+/g," ").trim();n.push({at:L(e,y),phrase:S,why:"day-words",says:a(S),from:y,to:b});continue}if(o.day<i&&o.day>=m){let y=l.exec(u),b=y?o.from-y[0].length:o.from,S=e.slice(b,o.to).replace(/\s+/g," ").trim();n.push({at:L(e,b),phrase:S,why:"past",says:a(S),from:b,to:o.to})}}let c=new Set;return n.sort((o,u)=>o.from-u.from).filter(o=>!c.has(o.phrase)&&c.add(o.phrase)).map(({at:o,phrase:u,why:p,says:w})=>({at:o,phrase:u,why:p,says:w}))}export{R as a,X as b,ie as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{K as $}from"./chunk.
|
|
1
|
+
import{K as $}from"./chunk.H3IGXHZR.js";import{G as L,Ra as U,a as I,b as R,c as E,d as f,e as k,j as W,m as F,v as j}from"./chunk.3VEZ5MOC.js";import{oe as s,ve as b,we as r}from"./chunk.6AANHELP.js";import{b as H}from"./chunk.AJZBJBMO.js";var u=H(L(),1),_=e=>typeof e=="object"&&e!==null&&"idx"in e;function S(e){let n=r(window.location.pathname,e);return n===null?null:n!==s&&n!=="/"?"pages":n===s||window.location.href.includes("#")?f(window.location.hash).overview?"graview":"scene":_(window.history.state)?"pages":null}function K(e){let n=e.face??(e.stop&&E(e.stop).overview?"graview":"scene");return e.routing!=="address"||typeof window>"u"?n:S(e.basePath)??n}function Q(e){return e.routing!=="address"||typeof window>"u"?!1:r(window.location.pathname,e.basePath)==="/"&&S(e.basePath)===null}function X(e){if(typeof window>"u")return;let n=r(window.location.pathname,e);return n===s||n==="/"&&window.location.href.includes("#")?R(f(window.location.hash)):void 0}function Z({basePath:e,pagesWere:n,shown:t,onFace:i,toggle:l,kinds:N,places:w,opens:B,landed:V}){let{view:O,go:p}=U(),g=(0,u.useRef)({shown:t,view:O,onFace:i,landed:V});g.current={shown:t,view:O,onFace:i,landed:V};let m=(0,u.useRef)(n??"/"),P=()=>{m.current=`${r(window.location.pathname,e)??"/"}${window.location.search}`};return l.current=(o,c,a)=>{let{shown:d,view:h,onFace:A}=g.current;if(o==="pages"&&d!=="pages")window.history.pushState(null,"",b(c??m.current,{basePath:e}));else if(o!=="pages"&&d==="pages"){P();let y=a===void 0?h:M(E(a),w),v=q(y)?z(B):y,T=v!==y&&v.overview?"graview":o,x=Y(T,v,N);p(x),window.history.pushState(null,"",`${b(s,{basePath:e})}${k(x)}`),A?.(T);return}A?.(o)},(0,u.useEffect)(()=>{let o=()=>{if(r(window.location.pathname,e)===null)return;let c=S(e)??"pages",{shown:a,onFace:d,landed:h}=g.current;if(c==="pages"){P(),h?.(m.current),a!=="pages"&&d?.("pages");return}a==="pages"&&(p(M(f(window.location.hash),w)),d?.(c))};return window.addEventListener("popstate",o),()=>window.removeEventListener("popstate",o)},[e,p,w]),null}function M(e,n){let t=e.within?.view,i=t!==void 0&&!e.focusId?n.find(l=>l.as===t):void 0;return i?{...e,focusId:j(i.kind)}:e}function Y(e,n,t){return e==="graview"?F(n,!0):n.overview?W(F(n,!1),$(n,t)):n}function q(e){return e.focusId===null&&e.overview!==!0}function z(e){return e??{...I,overview:!0}}export{K as a,Q as b,X as c,Z as d,M as e,Y as f,q as g,z as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h,i as E}from"./chunk.
|
|
1
|
+
import{h,i as E}from"./chunk.QUETLFBJ.js";import{e as z}from"./chunk.JULD4XFB.js";import{a as M}from"./chunk.GRTBEA7O.js";import{Ab as g,C as y,Da as R,Ga as j,Na as O,Qb as N,Rb as k,Ya as P,Za as D,ec as T,ga as S,jb as L,nc as Z,oc as q,pc as K,qc as v,yb as V,zb as I}from"./chunk.6AANHELP.js";var J=n=>n.safeParse?.(void 0).success??!1,C=n=>h(n).shape,A=n=>{let r=h(n);if(y(r)?.type!=="literal")return;let o=y(r)?.values;return o&&o.length===1&&typeof o[0]=="string"?o[0]:void 0};function F(n,r){let o=J(r),e=h(r),t=y(e)?.type,c=T(r);if(c)return{control:"node",name:n,optional:o,kinds:c};let m=O(r);if(m)return{control:"linked",name:n,optional:o,relation:m};if(D(r)){let d=P(n);return{control:"repeat",name:n,optional:o,...d?{of:d}:{}}}if(t==="boolean")return{control:"boolean",name:n,optional:o};let f=R(e);if(f)return{control:"file",name:n,optional:o,...f==="image"?{image:!0}:f==="video"?{video:!0}:{}};if(t==="object"){let d=e.shape??{};return{control:"group",name:n,optional:o,fields:Object.entries(d).map(([a,l])=>F(a,l))}}if(t==="union"){let d=y(e)?.options??[],a=d.map(s=>C(s));if(a.every(s=>s!==void 0)){let s=Object.keys(a[0]??{}).find(u=>a.every(p=>A(p?.[u])!==void 0));if(s)return{control:"variant",name:n,optional:o,tag:s,options:d.map((u,p)=>({value:A(a[p]?.[s])??"",fields:Object.entries(a[p]??{}).filter(([w])=>w!==s).map(([w,B])=>F(w,B))}))}}let l=d.map(s=>A(s));return l.every(s=>s!==void 0)?{control:"choice",name:n,optional:o,options:l}:{control:"opaque",name:n,optional:o}}if(t==="array"){let d=y(e)?.element,a=d===void 0?void 0:F(n,d);return a?.control==="choice"?{...a,optional:o,multiple:!0}:a!==void 0?{control:"list",name:n,optional:o,item:a}:{control:"opaque",name:n,optional:o}}let i=E(r);return i.type==="text"?{control:"text",name:n,optional:o,...i.long?{long:!0}:{},...j(e)?{app:!0}:{},...M(e)?{markdown:!0}:{},...i.holds?{holds:i.holds}:{}}:i.type==="number"&&i.duration?{control:"text",name:n,optional:o,holds:"duration"}:i.type==="date"?{control:"date",name:n,optional:o,...i.time?{time:!0}:{},...i.instant?{instant:!0}:{},...i.partial?{partial:!0}:{}}:i.type==="number"?{control:"number",name:n,optional:o,...i.min===void 0?{}:{min:i.min},...i.max===void 0?{}:{max:i.max},...i.step===void 0?{}:{step:i.step},...i.amount?{amount:i.amount}:{}}:i.type==="choice"?{control:"choice",name:n,optional:o,options:i.options}:{control:"opaque",name:n,optional:o}}function H(n){let r=n.shape;return r?Object.entries(r).map(([o,e])=>F(o,e)):[]}function W(n,r){let o={...r};for(let e of n){let t=r[e.name];t===void 0&&!e.optional&&(e.control==="list"||e.control==="boolean")&&(o[e.name]=e.control==="list"?[]:!1),e.control==="text"&&e.holds&&typeof t=="string"&&(o[e.name]=t.trim()===""?void 0:e.holds==="duration"?z(t)??t:t.trim()),e.control==="group"&&t!==void 0&&typeof t=="object"&&t!==null&&(o[e.name]=W(e.fields,t))}return o}function G(n,r){return q(H(r.input),Z(n,r))}var x="visitor";function gn(n,r,o,e){let t=N.keptFrom?.(n,r),c=new Set;if(!t)return c;let m=Object.keys(o.input.shape??{});for(let a of o.creates??[]){let l=t({id:"\0new",kind:a});for(let s of m)l?.(s)&&c.add(s)}let f=e===void 0?void 0:n.graph.getNode(e),i=f&&n.schema.tryDefinition(f.kind),d=f&&t(f);if(i&&d)for(let a of v(o,i))d(a)&&m.includes(a)&&c.add(a);return c}function _(n,r,o,e){let t=new Set,c=r?.sees??[];if(I(o)||!c.some(k))return t;let m=V(o),f=(l,s)=>{let u=c.filter(p=>p.kinds.includes(l)&&g(p,m));return u.some(k)?L.has(s)||u.some(p=>!k(p)||(p.fields===void 0||p.fields.includes(s))&&!p.hide?.includes(s)):!0},i=Object.keys(e.input.shape??{}),d=new Map,a=(l,s)=>d.set(l,d.get(l)===!0||s);for(let l of e.creates??[]){let s=Object.keys(n.tryDefinition(l)?.fields.shape??{});for(let u of i)s.includes(u)&&a(u,f(l,u))}for(let l of K(n,e)){let s=n.tryDefinition(l);if(s)for(let u of v(e,s))i.includes(u)&&a(u,f(l,u))}for(let[l,s]of d)s||t.add(l);return t}var $=(n,r)=>r.title??S(n);function Q(n,r,o){let e=n?.sees;return!e||e.length===0?!0:e.some(t=>t.kinds.includes(o)&&g(t,r)&&!t.own&&!t.via)}function b(n){switch(n.control){case"node":return[n];case"group":return n.fields.flatMap(b);case"variant":return n.options.flatMap(r=>r.fields.flatMap(b));case"list":return b(n.item);default:return[]}}function U(n,r,o,e){return e.has(o.name)?!1:b(o).every(t=>t.kinds.some(c=>c!=="*"&&Q(n,r,c)))}var X=n=>({kind:"human",id:"form:",roles:[n]});function vn(n,r,o=n.mutations??[]){let e=n.forms?.[r];if(!e)return;let t=o.find(a=>a.name===e.act);if(!t)return;let c=e.role??x,m=X(c),f=_(n.schema,n.policy,m,t),i=G(n.schema,t),d=e.fields?e.fields.flatMap(a=>i.find(l=>l.name===a)??[]):i.filter(a=>U(n.policy,m,a,f));return{name:r,title:$(r,e),...e.intro?{intro:e.intro}:{},...e.say?{say:e.say}:{},submit:e.submit??t.title??S(t.name),role:c,act:t,fields:d}}function An(n,r,o){let e=n.forms?.[r];if(!e)throw new Error(`There is no form called "${r}"${n.forms?`: the forms are ${Object.keys(n.forms).join(", ")}`:": the app declares none"}.`);return{kind:"visitor",id:o,name:`a visitor via the ${$(r,e)} form`,roles:[e.role??x]}}function xn(n){return{said:"Received \u2014 thank you.",...n.say?{next:n.say}:{}}}export{H as a,W as b,G as c,gn as d,_ as e,vn as f,An as g,xn as h};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as O,b}from"./chunk.
|
|
1
|
+
import{a as O,b}from"./chunk.SS6KL5NT.js";import"./chunk.WV45KLXC.js";import"./chunk.2KCDLCB2.js";import"./chunk.UD7VLXPM.js";import"./chunk.3DEWQDP7.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as z,W as M,ea as S}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{Bd as A}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as v}from"./chunk.AJZBJBMO.js";var o=v(z(),1);var t=v(M(),1);function G(i){for(let d of i)for(let[r,s]of Object.entries(d))if(s===!1)return`${r} == true`;return""}var w={margin:0,fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function $({ask:i,close:d}){let{store:r,principal:s,subscriptions:h,app:f}=S(),c=(0,o.useRef)(null),p=(0,o.useId)(),[n,u]=(0,o.useState)(0),[l,y]=(0,o.useState)(!0),[m,P]=(0,o.useState)(()=>{let e=i.choices.find(g=>g.on==="reaches");if(!e)return"";let a=e.record!==void 0?r.graph.getNode(e.record):void 0;return G(a?[a]:r.graph.nodesOfKind(e.kind).slice(0,5))}),[x,C]=(0,o.useState)(null),[W,k]=(0,o.useState)(!1);(0,o.useEffect)(()=>{let e=c.current;e&&!e.open&&e.showModal()},[]);let T=()=>{let e=i.returnTo;d(),requestAnimationFrame(()=>{e?.isConnected?e.focus():document.querySelector("[data-graview-page-title], main h1, [data-testid='inbox-button']")?.focus()})},N=e=>e.on==="reaches"?{...e,condition:m}:e,E=e=>b(r,{when:N(e),alsoMine:!l}),L=async()=>{let e=N(i.choices[n]),a=O(r,e);if(a){C(a);return}k(!0);try{await h.add({who:A(s),app:f?.name??"app",when:e,...l?{}:{alsoMine:!0}}),T()}catch(g){k(!1),C(g instanceof Error?g.message:String(g))}};return(0,t.jsx)("dialog",{ref:c,"aria-labelledby":p,"data-testid":"notify-sheet",onClose:T,onClick:e=>{e.target===e.currentTarget&&e.currentTarget.close()},style:{width:"min(92vw, 420px)",padding:0,border:"1px solid var(--graview-edge)",borderRadius:"var(--graview-radius, 12px)",background:"var(--graview-panel)",color:"var(--graview-ink)",boxShadow:"var(--graview-lift-high)"},children:(0,t.jsxs)("form",{method:"dialog",onSubmit:e=>{e.preventDefault(),L()},style:{display:"grid",gap:12,padding:18},children:[(0,t.jsx)("h2",{id:p,style:{margin:0,fontSize:"1.0625rem"},children:"Notify me"}),(0,t.jsxs)("fieldset",{style:{margin:0,padding:0,border:0,display:"grid",gap:6},children:[(0,t.jsx)("legend",{style:{...w,marginBottom:6},children:"Tell me"}),i.choices.map((e,a)=>(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"baseline",cursor:"pointer"},children:[(0,t.jsx)("input",{type:"radio",name:`${p}-when`,checked:n===a,onChange:()=>u(a),"data-notify-choice":e.on}),(0,t.jsx)("span",{children:e.on==="reaches"?`When ${e.record!==void 0?"it":"one"} reaches a condition`:E(e)})]},a))]}),i.choices[n]?.on==="reaches"?(0,t.jsxs)("label",{style:{display:"grid",gap:4},children:[(0,t.jsx)("span",{style:w,children:"The condition, in the app's own words (done == true, amount > 100)"}),(0,t.jsx)("input",{value:m,onChange:e=>P(e.target.value),"data-testid":"notify-condition",autoComplete:"off",spellCheck:!1})]}):null,(0,t.jsxs)("label",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,t.jsx)("input",{type:"checkbox",checked:l,onChange:e=>y(e.target.checked),"data-testid":"notify-others-only"}),"Only when someone else does it"]}),(0,t.jsxs)("p",{style:w,"data-testid":"notify-said",children:[E(i.choices[n]),"."]}),x?(0,t.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-danger, var(--graview-ink))"},children:x}):null,(0,t.jsxs)("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[(0,t.jsx)("button",{type:"button",onClick:()=>c.current?.close(),children:"Cancel"}),(0,t.jsx)("button",{type:"submit",autoFocus:!0,disabled:W,"data-testid":"notify-keep",style:{borderColor:"var(--graview-accent)",color:"var(--graview-accent)"},children:"Notify me"})]})]})})}function j({style:i}){let{store:d,principal:r,subscriptions:s,app:h}=S(),f=(r.onBehalfOf??r).id,[c,p]=(0,o.useState)([]);return(0,o.useEffect)(()=>{if(f===void 0)return;let n=!0,u=()=>void Promise.resolve(s.list(f)).then(y=>n&&p(y.filter(m=>m.app===(h?.name??"app"))),()=>n&&p([]));u();let l=s.onChange?.(u);return()=>{n=!1,l?.()}},[s,f,h]),c.length===0?null:(0,t.jsxs)("section",{"aria-label":"What you are told of","data-testid":"notified",style:{display:"grid",gap:6,...i},children:[(0,t.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.14em",textTransform:"uppercase",color:"var(--graview-ink-faint)"},children:"You are told"}),(0,t.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:c.map(n=>(0,t.jsxs)("li",{style:{display:"flex",gap:8,alignItems:"baseline",justifyContent:"space-between"},"data-subscription":n.id,children:[(0,t.jsx)("span",{style:{fontSize:"0.8125rem"},children:b(d,n)}),(0,t.jsx)("button",{type:"button","data-testid":"notify-stop","aria-label":`Stop: ${b(d,n)}`,onClick:u=>{let l=u.currentTarget.closest("li"),y=(l?.nextElementSibling??l?.previousElementSibling)?.querySelector("button");Promise.resolve(s.remove(n.id)).then(()=>(y??document.querySelector("[data-testid='inbox-button']"))?.focus())},style:{padding:"1px 8px",fontSize:"0.8125rem"},children:"Stop"})]},n.id))})]})}export{j as NotifiedList,$ as NotifySheet};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as b,e as c,f as d,g as e,h as f,i as g,j as h}from"./chunk.QM54TGU6.js";import"./chunk.EGVM24ND.js";import{s as a}from"./chunk.2TUEBU7X.js";import"./chunk.NYLKG25K.js";import"./chunk.TBY5IR7C.js";import"./chunk.H3W5C3XQ.js";import"./chunk.6WB2TYK7.js";import"./chunk.BJUUSIQY.js";import"./chunk.JGRSUTPJ.js";import"./chunk.XOZU4OFA.js";import"./chunk.EP5JS7ZH.js";import"./chunk.CE3NKAF7.js";import"./chunk.MIE4TJRW.js";import"./chunk.CFE3MHWZ.js";import"./chunk.RD2FSSLV.js";import"./chunk.HXTKBISQ.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{g as Highlighter,h as LOOK,f as SectionCard,b as SectionDrawn,a as SectionOutline,e as drawingFindings,c as placeBeside,d as readPart};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{q as K}from"./chunk.
|
|
1
|
+
import{q as K}from"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as R,W as x,ea as N,fa as $}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{$d as k,Rd as v,Sd as b,Td as f,Zd as h,pa as g}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as w}from"./chunk.AJZBJBMO.js";var u=w(R(),1);var o=w(x(),1),E=()=>()=>{};function C(e){let n=(0,u.useMemo)(()=>e?.onChange?i=>e.onChange(i):E,[e]),t=()=>e?.current()??b;return(0,u.useSyncExternalStore)(n,t,t)}var D=(e,n)=>e.lens?n.may.lenses:n.may.views;async function p(e,n,t){try{return await n(),!0}catch(i){let r=i?.code,d=typeof r=="string"?r:void 0;return e?.notify({kind:"toast",tone:"bad",sentence:i instanceof Error&&i.message?i.message:t,...d?{code:d}:{}}),!1}}function H(e,n,t,i,r){let d=e.name;return p(r,()=>n==="view"&&d!==void 0?i?t.hide(d):t.show(d):t.lens?.({op:"set-lens-hidden",title:e.title,on:e.kind,hidden:i}),i?`\u201C${e.title}\u201D could not be hidden.`:`\u201C${e.title}\u201D could not be shown.`)}function L(e,n,t,i,r){return p(r,()=>t.lens?.({op:"set-lens-hidden",title:e,hidden:i}),i?`\u201C${n}\u201D could not be hidden.`:`\u201C${n}\u201D could not be shown.`)}function V(e,n,t){return p(t,()=>n.restore(e.name),`\u201C${e.title}\u201D could not be restored.`)}async function A(e,n,t,i){let r=n==="view"&&e.name!==void 0?e.name:v(e.title),d=await p(i,()=>n==="view"&&e.name!==void 0?t.remove(e.name,{title:e.title,kind:e.kind}):t.lens?.({op:"remove-lens",title:e.title,on:e.kind}),`\u201C${e.title}\u201D could not be deleted.`);return d&&i?.notify({kind:"toast",id:`deleted-view-${r}`,sentence:`Deleted \u201C${e.title}\u201D. It is under Recently deleted in the places for ${30} days.`,action:{label:"Restore",onSelect:()=>void V({name:r,title:e.title},t,i)}}),d}function G(){let e=$(),n=e?.keptViews,t=C(n),i=e?.views;return(0,u.useMemo)(()=>{if(!n||!i)return null;let r=s=>f(s,t,n),d=new Set,c=i.places().filter(s=>{if(!s.hidden||r(s)===null)return!1;let m=`${s.name??""}|${s.title}`;return d.has(m)?!1:(d.add(m),!0)}),l=e?.store.schema,y=t.may.lenses&&n.lens&&l?(i.arrangement?.()?.hide??[]).filter(s=>l.tryDefinition(s)!==void 0).map(s=>({kind:s,title:g(l,s),path:h(l,s)})):[];return{keeper:n,hidden:c,lists:y,removed:t.removed.filter(s=>D(s,t)),how:r}},[n,t,i,e?.store.schema])}function T(e,n){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(n??"en-US",{month:"short",day:"numeric"})}var I=`.graview-bar-list li.graview-bar-tidied{display:flex;align-items:flex-start;gap:8px;padding:0 0 0 2px}
|
|
2
2
|
.graview-bar-tidied>.graview-bar-item,.graview-bar-gone{flex:1 1 auto;min-width:0}
|
|
3
3
|
.graview-bar-gone{display:grid;gap:1px;padding:7px 8px;font-size:.875rem;line-height:1.3;overflow-wrap:anywhere;color:var(--graview-ink-muted)}
|
|
4
4
|
.graview-bar-gone small{font-size:.75rem}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.
|
|
1
|
+
import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as W,W as x}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as D}from"./chunk.AJZBJBMO.js";var g=D(W(),1);var o=D(x(),1),v=864e5,l=t=>Date.UTC(+t.slice(0,4),+t.slice(5,7)-1,+t.slice(8,10)),I=t=>new Date(t).toISOString().slice(0,10),s=(t,i)=>I(l(t)+i*v),m=(t,i)=>{let a=new Date(l(t)),u=a.getUTCMonth()+i,d=Date.UTC(a.getUTCFullYear(),u,1),w=new Date(Date.UTC(a.getUTCFullYear(),u+1,0)).getUTCDate();return I(d+(Math.min(a.getUTCDate(),w)-1)*v)};function p(t,i,a){try{return new Intl.DateTimeFormat(t??"en-US",{...i,timeZone:"UTC"}).format(a)}catch{return new Intl.DateTimeFormat("en-US",{...i,timeZone:"UTC"}).format(a)}}function F(t){try{let i=new Intl.Locale(t??"en-US"),a=i.getWeekInfo?.().firstDay??i.weekInfo?.firstDay;if(a!==void 0)return a%7}catch{return 0}return/^en-US|^en$|-(US|CA|JP|BR|IL|MX|PH)$/.test(t??"en-US")?0:1}function H({id:t,label:i,selected:a,today:u,locale:d,onPick:w,onClose:T}){let[r,f]=(0,g.useState)(a??u),U=(0,g.useRef)(null),y=F(d),b=`${r.slice(0,7)}-01`,M=(new Date(l(b)).getUTCDay()-y+7)%7,P=s(b,-M),A=Array.from({length:6},(e,n)=>Array.from({length:7},(S,c)=>s(P,n*7+c))),$=p(d,{month:"long",year:"numeric"},l(b)),h=(0,g.useRef)(!0);(0,g.useEffect)(()=>{h.current&&U.current?.querySelector(`[data-day="${r}"]`)?.focus(),h.current=!1},[r]);let E=e=>{let n={ArrowLeft:()=>s(r,-1),ArrowRight:()=>s(r,1),ArrowUp:()=>s(r,-7),ArrowDown:()=>s(r,7),PageUp:()=>m(r,e.shiftKey?-12:-1),PageDown:()=>m(r,e.shiftKey?12:1),Home:()=>s(r,-((new Date(l(r)).getUTCDay()-y+7)%7)),End:()=>s(r,6-(new Date(l(r)).getUTCDay()-y+7)%7)};n[e.key]?(e.preventDefault(),h.current=!0,f(n[e.key]())):e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),T())},R=Array.from({length:7},(e,n)=>l("1970-01-04")+(y+n)%7*v),C={minWidth:32,minHeight:32,padding:"0 8px",borderRadius:6};return(0,o.jsxs)("div",{id:t,role:"group","aria-label":`Pick a date for ${i}`,"data-graview-part":"when-month",onKeyDown:e=>{e.key==="Escape"&&(e.preventDefault(),e.stopPropagation(),T())},style:{flexBasis:"100%",width:"min(100%, 20rem)",boxSizing:"border-box",padding:8,border:"1px solid var(--graview-edge)",borderRadius:8,background:"var(--graview-panel)",color:"var(--graview-ink)"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:6,marginBottom:6},children:[(0,o.jsx)("button",{type:"button","aria-label":"Previous month",onClick:()=>f(m(r,-1)),style:C,children:"\u2039"}),(0,o.jsx)("span",{id:`${t}-title`,"aria-live":"polite",style:{fontWeight:600,fontSize:"0.875rem"},children:$}),(0,o.jsx)("button",{type:"button","aria-label":"Next month",onClick:()=>f(m(r,1)),style:C,children:"\u203A"})]}),(0,o.jsxs)("table",{ref:U,role:"grid","aria-labelledby":`${t}-title`,onKeyDown:E,style:{width:"100%",borderCollapse:"collapse",tableLayout:"fixed",fontSize:"0.8125rem"},children:[(0,o.jsx)("thead",{children:(0,o.jsx)("tr",{children:R.map(e=>(0,o.jsx)("th",{scope:"col",abbr:p(d,{weekday:"long"},e),style:{fontWeight:500,color:"var(--graview-ink-faint)",padding:"2px 0"},children:p(d,{weekday:"narrow"},e)},e))})}),(0,o.jsx)("tbody",{children:A.map(e=>(0,o.jsx)("tr",{children:e.map(n=>{let S=n.slice(0,7)===b.slice(0,7),c=n===a,k=n===u;return(0,o.jsx)("td",{role:"gridcell","aria-selected":c||void 0,style:{padding:1,textAlign:"center"},children:(0,o.jsx)("button",{type:"button","data-day":n,tabIndex:n===r?0:-1,"aria-label":`${p(d,{weekday:"long",year:"numeric",month:"long",day:"numeric"},l(n))}${k?", today":""}${c?", selected":""}`,...k?{"aria-current":"date"}:{},onClick:()=>w(n),onFocus:()=>n!==r&&f(n),style:{width:"100%",minHeight:36,padding:0,borderRadius:6,border:k?"1px solid var(--graview-accent)":"1px solid transparent",background:c?"var(--graview-accent)":"transparent",color:c?"var(--graview-accent-ink)":S?"var(--graview-ink)":"var(--graview-ink-faint)",fontWeight:c?600:400},children:Number(n.slice(8,10))})},n)})},e[0]))})]})]})}export{H as WhenMonth};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{b as Z}from"./chunk.JO2X52D4.js";import{a as K,b as J,d as X,e as Y,f as H,g as D,h as Q,i as W}from"./chunk.M5FP4Y4Q.js";import{Oc as z,Pc as G,Qc as j}from"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var le={r:255,g:255,b:255,a:1},ue={r:18,g:18,b:18,a:1},M=t=>t.parentElement??t.getRootNode().host??null,C;function B(t,i){if(t==="transparent")return{r:0,g:0,b:0,a:0};let[a]=z(t);if(a)return a;if(C===void 0&&(C=i.createElement("canvas").getContext("2d",{willReadFrequently:!0})),!C)return;C.clearRect(0,0,1,1),C.fillStyle="#000",C.fillStyle=t,C.fillRect(0,0,1,1);let[n,c,r,u]=C.getImageData(0,0,1,1).data;return{r:n,g:c,b:r,a:u/255}}function ee(t){let i=t.ownerDocument,a=i.defaultView,n=[];for(let r=t;r;r=M(r)){let u=a.getComputedStyle(r);if(u.backgroundImage&&u.backgroundImage!=="none")return;let f=B(u.backgroundColor,i);if(!f)return;if(f.a>0&&n.push(f),f.a>=1)break}let c=a.getComputedStyle(i.documentElement).colorScheme.includes("dark")&&a.matchMedia?.("(prefers-color-scheme: dark)").matches;return n.reverse().reduce((r,u)=>G(u,r),c?ue:le)}var te=t=>`${Math.floor(t*100)/100}:1`;function ae(t,i){let a={},n=s=>a[s]=(a[s]??0)+1,c=t.filter(s=>typeof s.getBoundingClientRect=="function"),r=c[0];if(!r)return{unmeasured:a,measured:{contrast:0,"focus-visible":0}};let u=r.ownerDocument,f=u.defaultView,p=s=>{let N=s.getBoundingClientRect();return N.width>1&&N.height>1},l=0;for(let s of c){if(l>=i.limit)break;if(!Array.from(s.childNodes).some(d=>d.nodeType===3&&(d.textContent??"").trim()!=="")||s.namespaceURI!=="http://www.w3.org/1999/xhtml"||s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true")continue;let E=f.getComputedStyle(s);if(E.visibility!=="visible"||E.display==="none"||!p(s))continue;l+=1;let m=B(E.color,u),x=ee(s);if(!m||!x){n("contrast");continue}let v=j(G(m,x),x),$=Number.parseFloat(E.fontSize),O=Number.parseInt(E.fontWeight,10),e=$>=24||$>=18.66&&O>=700,o=e?3:4.5;v+.005<o&&i.say("contrast",s,"serious",`Its words are at ${te(v)} against their ground; ${o}:1 is the least ${e?"large ":""}text may be.`,"Give it a color further from its ground: --graview-ink and --graview-ink-muted are held to the app's grounds.")}let w=u.activeElement,S=0;for(let s of c){if(S>=i.limit)break;if(!i.tabbable(s)||!p(s))continue;if(S+=1,s.focus({preventScroll:!0,focusVisible:!0}),s.getRootNode().activeElement!==s||!s.matches(":focus-visible")){n("focus-visible");continue}let m=f.getComputedStyle(s),x=Number.parseFloat(m.outlineWidth)||0,v=!1;for(let o=s;o;o=M(o))o.hasAttribute("data-graview-view-root")&&(v=!0);if(m.outlineStyle==="auto"){n("focus-visible");continue}if(m.outlineStyle==="none"||x===0){m.boxShadow&&m.boxShadow!=="none"?n("focus-visible"):i.say("focus-visible",s,"serious","It shows no ring when it has the keyboard: a person cannot see where they are.","Leave the outline on :focus-visible (in a view the host draws it; restyle it with --graview-focus-color).","2.4.7",v);continue}if(x+.01<2){i.say("focus-visible",s,"serious",`Its ring is ${x}px: at least 2px is seen.`,"Give the outline 2px or more (--graview-focus-width in a view).","2.4.7",v);continue}let $=B(m.outlineColor,u),O=M(s)?ee(M(s)):void 0;if(!$||!O){n("focus-visible");continue}let e=j(G($,O),O);e+.005<3&&i.say("focus-visible",s,"serious",`Its ring is at ${te(e)} against what is around it; 3:1 is the least a ring may be.`,"Give the ring a color at 3:1 against the ground (--graview-focus-color in a view; the app's accent is held to it).","1.4.11",v)}S>0&&(u.activeElement?.blur?.(),w&&w!==u.body&&w.focus?.({preventScroll:!0}));for(let s of c){let N=f.getComputedStyle(s);if(!(/(auto|scroll)/.test(N.overflowX)||/(auto|scroll)/.test(N.overflowY)))continue;let m=s;(m.scrollHeight>m.clientHeight+1||m.scrollWidth>m.clientWidth+1)&&i.scrollsOnPage(s)}return{unmeasured:a,measured:{contrast:l,"focus-visible":S}}}var q={keyboard:{wcag:"2.1.1",says:"What a person can click is reached by the keyboard.",needs:"structure"},role:{wcag:"4.1.2",says:"What takes the keyboard says what it is.",needs:"structure"},name:{wcag:"4.1.2",says:"Every control and link has a name.",needs:"structure"},"toggle-state":{wcag:"4.1.2",says:"A toggle says whether it is on, open or chosen.",needs:"structure"},"nested-interactive":{wcag:"4.1.2",says:"No control or link is inside another.",needs:"structure"},"img-alt":{wcag:"1.1.1",says:'Every image says what it shows, or says it is decoration (alt="").',needs:"structure"},"svg-name":{wcag:"1.1.1",says:'A picture drawn in SVG that means something is role="img" with a name; one that does not is hidden.',needs:"structure"},"scroll-region":{wcag:"2.1.1",says:"A box that scrolls by itself takes the keyboard and has a name.",needs:"structure"},"focus-visible":{wcag:"2.4.7",says:"Whatever has the keyboard shows a ring at least 2px wide, at 3:1 against its ground.",needs:"layout"},contrast:{wcag:"1.4.3",says:"Text is at 4.5:1 against its ground, 3:1 when large.",needs:"layout"},"keyboard-trap":{wcag:"2.1.2",says:"Tab leaves the view: the keyboard is never held inside it.",needs:"keys"}};var se="http://www.w3.org/1999/xhtml",U="http://www.w3.org/2000/svg",b=(t,...i)=>t.namespaceURI===se&&i.includes(t.localName),oe=t=>t.nodeType===1,T=t=>Array.from(t.childNodes).filter(oe),de=new Set(["button","link","checkbox","switch","radio","tab","menuitem","menuitemcheckbox","menuitemradio","option","slider","spinbutton","textbox","searchbox","combobox","treeitem"]),ce=new Set(["button","link","checkbox","switch","radio","tab","menuitem","menuitemcheckbox","menuitemradio","option","img","slider","progressbar","scrollbar","separator"]),he={checkbox:"aria-checked",switch:"aria-checked",radio:"aria-checked",menuitemcheckbox:"aria-checked",menuitemradio:"aria-checked",tab:"aria-selected",option:"aria-selected"},ie=new Set(["true","false","mixed"]),be=/^(show|hide|expand|collapse)?\s*(more|less|all|details|everything)?$/i;function I(t){let i=[],a=n=>{for(let c of T(n))i.push(c),a(c)};return a(t),i}function ne(t){for(let i=t;i;i=i.parentElement)if(i.getAttribute("aria-hidden")==="true"||i.hasAttribute("hidden"))return!0;return!1}var P=t=>t.getAttribute("role")?.trim().split(/\s+/)[0]?.toLowerCase()??null,fe=t=>{let i=t.getAttribute("tabindex");if(i===null)return;let a=Number.parseInt(i,10);return Number.isNaN(a)?void 0:a},me=t=>t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true",R=t=>b(t,"input")&&(t.getAttribute("type")??"").toLowerCase()==="hidden"||b(t,"button","input","select","textarea")&&t.hasAttribute("disabled")?!1:H(t)&&(fe(t)??0)>=0,F=t=>b(t,"button","select","textarea","summary")||b(t,"input")&&(t.getAttribute("type")??"").toLowerCase()!=="hidden"||t.localName==="a"&&t.hasAttribute("href"),re=t=>F(t)||t.hasAttribute("data-graview-link")||t.hasAttribute("data-graview-press")?!0:de.has(P(t)??""),ge=t=>t.hasAttribute("role")||!D(t);function Ae(t){let i=[],a=n=>JSON.stringify(n);for(let n=t;n&&!n.hasAttribute("data-graview-view-root");n=n.parentElement){let c=n.getAttribute("data-key");if(c!==null){i.unshift(`[data-key=${a(c)}]`);break}let r=n.getAttribute("id");if(r){i.unshift(`[id=${a(r)}]`);break}let u=n.getAttribute("class")?.trim().split(/\s+/)[0],f=`${n.localName}${u?`.${u}`:""}`,p=n.parentElement;if(p){let l=T(p).filter(w=>w.localName===n.localName);l.length>1&&(f+=`:nth-of-type(${l.indexOf(n)+1})`)}i.unshift(f)}return i.join(" > ")}var ye=t=>{for(let i=t;i;i=i.parentElement){let a=i.getAttribute("data-key");if(a!==null)return a}};function k(t){if(t.nodeType===3)return t.textContent??"";if(!oe(t)||t.getAttribute("aria-hidden")==="true"||t.hasAttribute("hidden"))return"";let i=t.getAttribute("aria-label")?.trim();if(i)return` ${i} `;if(t.localName==="img")return` ${t.getAttribute("alt")??""} `;if(t.namespaceURI===U&&t.localName==="svg"){let a=T(t).find(n=>n.localName==="title");return a?` ${k(a)} `:""}return b(t,"input","select","textarea")?"":Array.from(t.childNodes).map(k).join("")}var A=t=>t.replace(/\s+/g," ").trim();function we(t,i,a){let n=t.getAttribute("aria-labelledby");if(n){let r=A(n.split(/\s+/).map(u=>i.get(u)?k(i.get(u)):"").join(" "));if(r)return r}let c=A(t.getAttribute("aria-label")??"");if(c)return c;if(b(t,"input","select","textarea")){let r=(t.getAttribute("type")??"").toLowerCase();if(b(t,"input")&&["submit","reset","button"].includes(r))return A(t.getAttribute("value")??(r==="submit"?"Submit":r==="reset"?"Reset":""));if(b(t,"input")&&r==="image")return A(t.getAttribute("alt")??"");let u=t.getAttribute("id"),f=u?a.find(l=>l.getAttribute("for")===u):void 0;if(f&&A(k(f)))return A(k(f));for(let l=t.parentElement;l;l=l.parentElement)if(b(l,"label")&&A(k(l)))return A(k(l));let p=A(t.getAttribute("placeholder")??"");return p||A(t.getAttribute("title")??"")}return t.localName==="img"?A(t.getAttribute("alt")??t.getAttribute("title")??""):A(k(t))||A(t.getAttribute("title")??"")}function pe(t){let i=I(t);for(let a of i){let n=I(a).some(K);if(!Q(a,n)||(a.setAttribute("data-graview-link",""),W(a,I(a))))continue;let c=a.localName==="a";if(!a.hasAttribute("role")&&(c||D(a))&&a.setAttribute("role","link"),b(a,"tr")){let r=T(a).find(u=>u.localName==="td"||u.localName==="th");r&&!r.hasAttribute("tabindex")&&r.setAttribute("tabindex","0");continue}!b(a,"button")&&!a.hasAttribute("tabindex")&&a.setAttribute("tabindex","0")}for(let a of i){let n=X(a)&&!J(a)&&!b(a,"input","select","textarea"),c=!n&&Y(a);!n&&!c||(H(a)||a.setAttribute("tabindex","0"),n&&D(a)&&a.setAttribute("role","button"),a.setAttribute("data-graview-press",""))}for(let a of i.filter(n=>n.namespaceURI===U&&n.localName==="svg")){let n=a.hasAttribute("role")||a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||T(a).some(r=>r.localName==="title"),c=[a,...I(a)].some(r=>r.hasAttribute("tabindex")||r.hasAttribute("data-graview-link")||r.hasAttribute("data-graview-press")||r.localName==="a");!n&&!c&&!a.hasAttribute("aria-hidden")&&a.setAttribute("aria-hidden","true")}}function ve(t,i){let a=t;return typeof a.querySelectorAll!="function"?[]:i.flatMap(n=>{try{return Array.from(a.querySelectorAll(n))}catch{return[]}})}function _(t){for(let i of T(t)){if(R(i)||_(i))return!0;let a=i.shadowRoot;if(a&&_(a))return!0}return!1}function ke(t){let i=t.ownerDocument?.defaultView;if(!i||typeof i.getComputedStyle!="function")return!1;let n=(t.host??t).getBoundingClientRect?.();return!!(n&&(n.width>0||n.height>0))}function Oe(t,i={}){i.host==="pending"&&pe(t);let a=I(t),n=new Map(a.flatMap(e=>e.getAttribute("id")?[[e.getAttribute("id"),e]]:[])),c=a.filter(e=>b(e,"label")),r=i.clicked?Array.from(i.clicked):[...Z(t)??[]],u=new Set([...r.filter(e=>typeof e=="object"),...ve(t,r.filter(e=>typeof e=="string"))]),f=i.chrome===!0,p=[],l=(e,o,d,g,h,y=!1,L=q[e].wcag)=>{let V=ye(o);p.push({rule:e,wcag:L,impact:d,at:Ae(o),...V!==void 0?{key:V}:{},says:g,fix:h,automatic:y||f})},w=a.filter(e=>!ne(e)),S=e=>we(e,n,c)!=="",s=new Set(w.filter(e=>e.hasAttribute("data-graview-link")&&W(e,I(e))));for(let e of w){if(me(e))continue;let o=e.hasAttribute("data-graview-link"),d=e.hasAttribute("data-graview-press"),g=u.has(e);if(!o&&!d&&!g||F(e)&&R(e)||s.has(e)&&!g||b(e,"tr")&&T(e).some(y=>(y.localName==="td"||y.localName==="th")&&R(y)))continue;if(!(R(e)||g&&I(e).some(y=>R(y)&&(F(y)||y.hasAttribute("data-graview-press")||y.hasAttribute("data-graview-link"))))){o||d?l("keyboard",e,"serious","It is a link or a press the host makes, and Tab does not reach it.","The host gives it the keyboard when it draws the view; audit the view as the host drew it.",!0):l("keyboard",e,"serious",`A <${e.localName}> the view hears a click on, which Tab does not reach: a mouse can press it and a keyboard cannot.`,'Draw it as a <button type="button"> (the host resets its look), or give it role="button" and the host gives it the keyboard, Enter and Space.');continue}R(e)&&!ge(e)&&!(e.localName==="a"&&e.hasAttribute("href"))&&l("role",e,"serious",`A <${e.localName}> that takes the keyboard says nothing of what it is: a screen reader says "group" or nothing.`,'Draw it as a <button type="button">, or give it role="button" (or role="link" when it goes somewhere).',o||d)}for(let e of w){if(!re(e)||s.has(e)||S(e))continue;let o=P(e),d=b(e,"button")||o==="button"||e.hasAttribute("data-graview-press"),g=b(e,"input","select","textarea")||["textbox","searchbox","combobox","slider","spinbutton"].includes(o??""),h=g?"field":d?"button":e.hasAttribute("data-graview-link")||e.localName==="a"||o==="link"?"link":"control";l("name",e,d||g?"critical":"serious",`A ${h} with no name: a screen reader says only "${h}".`,g?'Give it a <label for> or aria-label="\u2026".':'Put words in it \u2014 a .graview-sr span when it shows only an icon \u2014 or aria-label="\u2026".')}for(let e of w){let o=P(e),d=o&&!b(e,"input")?he[o]:void 0;if(d&&!e.hasAttribute(d)){l("toggle-state",e,"serious",`It is role="${o}" and says no ${d}: a screen reader cannot say whether it is ${d==="aria-checked"?"on":"chosen"}.`,`Give it ${d}="true" or "false", and draw it again as it changes.`);continue}for(let[h,y]of[["aria-checked",ie],["aria-pressed",ie],["aria-expanded",new Set(["true","false"])],["aria-selected",new Set(["true","false"])]]){let L=e.getAttribute(h);L!==null&&!y.has(L)&&l("toggle-state",e,"serious",`${h}="${L}" is no state a screen reader can say.`,`Give ${h} "true" or "false"${y.has("mixed")?' (or "mixed")':""}.`)}!(b(e,"button")||o==="button"||e.hasAttribute("data-graview-press"))||e.hasAttribute("aria-expanded")||e.hasAttribute("aria-pressed")||(e.hasAttribute("aria-controls")?l("toggle-state",e,"serious","A button that says what it controls (aria-controls) and not whether that is open.",'Give it aria-expanded="true" or "false", and draw it again as it opens and closes.'):u.has(e)&&A(k(e))!==""&&be.test(A(k(e)))&&l("toggle-state",e,"moderate",`A button the view hears that reads "${A(k(e))}" \u2014 it opens and closes something \u2014 and says no state.`,'Give it aria-expanded="true" or "false" (or aria-pressed for a toggle), and draw it again as it changes.'))}for(let e of w){let o=P(e)??(b(e,"button")?"button":e.localName==="a"&&e.hasAttribute("href")?"link":null);if(!o||!ce.has(o)||o==="img")continue;let d=I(e).find(h=>!ne(h)&&(R(h)||re(h)));if(!d)continue;let g=e.hasAttribute("data-graview-link")&&!b(e,"a");l("nested-interactive",e,"serious",`A ${o} holds a <${d.localName}> a person presses on its own: a screen reader reads the ${o} as one thing and never reaches what is inside.`,g?"Put an <a> to the card's own record or place on its heading: the card is then a bigger target for a pointer, and the <a> the keyboard's way in.":`Move the <${d.localName}> out of the ${o}, beside it.`)}for(let e of w){if(e.localName==="img"&&e.namespaceURI===se){if(e.hasAttribute("alt")||e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")||["none","presentation"].includes(P(e)??""))continue;l("img-alt",e,"critical","An image with no alt: a screen reader reads its address, or nothing.",'Give it alt="what it shows", or alt="" when it is decoration.');continue}if(e.namespaceURI!==U||e.localName!=="svg"||e.parentElement?.namespaceURI===U||[e,...I(e)].some(h=>R(h)||h.hasAttribute("data-graview-link")||h.hasAttribute("data-graview-press")||h.localName==="a"))continue;let d=P(e);if(d==="none"||d==="presentation")continue;let g=S(e)&&(e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")||T(e).some(h=>h.localName==="title"));!d&&!g?l("svg-name",e,"minor","An SVG that says nothing, which a screen reader still meets.","The host hides an SVG that says nothing when it draws the view.",!0):d!=="img"&&d!=="graphics-document"?l("svg-name",e,"minor","An SVG with a name and no role: some screen readers skip it.",'Give it role="img" beside its aria-label.'):g||l("svg-name",e,"serious",'An SVG that is role="img" with no name: a screen reader says "image" and nothing more.','Give it aria-label="what it shows", or a <title> first inside it.')}let N=e=>/overflow(-[xy])?\s*:\s*(auto|scroll)/i.test(e.getAttribute("style")??""),E=e=>{R(e)&&S(e)||_(e)||l("scroll-region",e,"serious","A box that scrolls by itself and holds nothing Tab reaches: the keyboard cannot scroll it, and what is past its edge is out of reach.",'Give it tabindex="0", role="region" and aria-label="what it holds", or let it flow with the page.')},m=i.measure!==!1&&ke(t);if(!m)for(let e of w)N(e)&&E(e);let x=["keyboard","role","name","toggle-state","nested-interactive","img-alt","svg-name","scroll-region"],v=[],$={},O={};if(m){let e=ae(w,{limit:i.limit??400,tabbable:R,scrollsOnPage:E,say:(o,d,g,h,y,L,V)=>l(o,d,g,h,y,V===!0,L)});x.push("focus-visible","contrast"),Object.assign($,e.unmeasured),Object.assign(O,e.measured)}else{let e=i.measure===!1?"Asked not to measure.":"Nothing here is laid out (a headless run, or a DOM with no layout): it needs a browser's styles and boxes.";v.push({rule:"focus-visible",why:e},{rule:"contrast",why:e})}return v.push({rule:"keyboard-trap",why:"It needs keys pressed in a browser: a harness's Tab walk presses them (pnpm verify a11y)."}),{problems:p,ran:x,skipped:v,unmeasured:$,measured:O}}export{q as AUDIT_RULES,Oe as auditView,pe as markAsTheHost};
|
|
1
|
+
import{b as Z}from"./chunk.JO2X52D4.js";import{a as K,b as J,d as X,e as Y,f as H,g as D,h as Q,i as W}from"./chunk.M5FP4Y4Q.js";import{Oc as z,Pc as G,Qc as j}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var le={r:255,g:255,b:255,a:1},ue={r:18,g:18,b:18,a:1},M=t=>t.parentElement??t.getRootNode().host??null,C;function B(t,i){if(t==="transparent")return{r:0,g:0,b:0,a:0};let[a]=z(t);if(a)return a;if(C===void 0&&(C=i.createElement("canvas").getContext("2d",{willReadFrequently:!0})),!C)return;C.clearRect(0,0,1,1),C.fillStyle="#000",C.fillStyle=t,C.fillRect(0,0,1,1);let[n,c,r,u]=C.getImageData(0,0,1,1).data;return{r:n,g:c,b:r,a:u/255}}function ee(t){let i=t.ownerDocument,a=i.defaultView,n=[];for(let r=t;r;r=M(r)){let u=a.getComputedStyle(r);if(u.backgroundImage&&u.backgroundImage!=="none")return;let f=B(u.backgroundColor,i);if(!f)return;if(f.a>0&&n.push(f),f.a>=1)break}let c=a.getComputedStyle(i.documentElement).colorScheme.includes("dark")&&a.matchMedia?.("(prefers-color-scheme: dark)").matches;return n.reverse().reduce((r,u)=>G(u,r),c?ue:le)}var te=t=>`${Math.floor(t*100)/100}:1`;function ae(t,i){let a={},n=s=>a[s]=(a[s]??0)+1,c=t.filter(s=>typeof s.getBoundingClientRect=="function"),r=c[0];if(!r)return{unmeasured:a,measured:{contrast:0,"focus-visible":0}};let u=r.ownerDocument,f=u.defaultView,p=s=>{let N=s.getBoundingClientRect();return N.width>1&&N.height>1},l=0;for(let s of c){if(l>=i.limit)break;if(!Array.from(s.childNodes).some(d=>d.nodeType===3&&(d.textContent??"").trim()!=="")||s.namespaceURI!=="http://www.w3.org/1999/xhtml"||s.hasAttribute("disabled")||s.getAttribute("aria-disabled")==="true")continue;let E=f.getComputedStyle(s);if(E.visibility!=="visible"||E.display==="none"||!p(s))continue;l+=1;let m=B(E.color,u),x=ee(s);if(!m||!x){n("contrast");continue}let v=j(G(m,x),x),$=Number.parseFloat(E.fontSize),O=Number.parseInt(E.fontWeight,10),e=$>=24||$>=18.66&&O>=700,o=e?3:4.5;v+.005<o&&i.say("contrast",s,"serious",`Its words are at ${te(v)} against their ground; ${o}:1 is the least ${e?"large ":""}text may be.`,"Give it a color further from its ground: --graview-ink and --graview-ink-muted are held to the app's grounds.")}let w=u.activeElement,S=0;for(let s of c){if(S>=i.limit)break;if(!i.tabbable(s)||!p(s))continue;if(S+=1,s.focus({preventScroll:!0,focusVisible:!0}),s.getRootNode().activeElement!==s||!s.matches(":focus-visible")){n("focus-visible");continue}let m=f.getComputedStyle(s),x=Number.parseFloat(m.outlineWidth)||0,v=!1;for(let o=s;o;o=M(o))o.hasAttribute("data-graview-view-root")&&(v=!0);if(m.outlineStyle==="auto"){n("focus-visible");continue}if(m.outlineStyle==="none"||x===0){m.boxShadow&&m.boxShadow!=="none"?n("focus-visible"):i.say("focus-visible",s,"serious","It shows no ring when it has the keyboard: a person cannot see where they are.","Leave the outline on :focus-visible (in a view the host draws it; restyle it with --graview-focus-color).","2.4.7",v);continue}if(x+.01<2){i.say("focus-visible",s,"serious",`Its ring is ${x}px: at least 2px is seen.`,"Give the outline 2px or more (--graview-focus-width in a view).","2.4.7",v);continue}let $=B(m.outlineColor,u),O=M(s)?ee(M(s)):void 0;if(!$||!O){n("focus-visible");continue}let e=j(G($,O),O);e+.005<3&&i.say("focus-visible",s,"serious",`Its ring is at ${te(e)} against what is around it; 3:1 is the least a ring may be.`,"Give the ring a color at 3:1 against the ground (--graview-focus-color in a view; the app's accent is held to it).","1.4.11",v)}S>0&&(u.activeElement?.blur?.(),w&&w!==u.body&&w.focus?.({preventScroll:!0}));for(let s of c){let N=f.getComputedStyle(s);if(!(/(auto|scroll)/.test(N.overflowX)||/(auto|scroll)/.test(N.overflowY)))continue;let m=s;(m.scrollHeight>m.clientHeight+1||m.scrollWidth>m.clientWidth+1)&&i.scrollsOnPage(s)}return{unmeasured:a,measured:{contrast:l,"focus-visible":S}}}var q={keyboard:{wcag:"2.1.1",says:"What a person can click is reached by the keyboard.",needs:"structure"},role:{wcag:"4.1.2",says:"What takes the keyboard says what it is.",needs:"structure"},name:{wcag:"4.1.2",says:"Every control and link has a name.",needs:"structure"},"toggle-state":{wcag:"4.1.2",says:"A toggle says whether it is on, open or chosen.",needs:"structure"},"nested-interactive":{wcag:"4.1.2",says:"No control or link is inside another.",needs:"structure"},"img-alt":{wcag:"1.1.1",says:'Every image says what it shows, or says it is decoration (alt="").',needs:"structure"},"svg-name":{wcag:"1.1.1",says:'A picture drawn in SVG that means something is role="img" with a name; one that does not is hidden.',needs:"structure"},"scroll-region":{wcag:"2.1.1",says:"A box that scrolls by itself takes the keyboard and has a name.",needs:"structure"},"focus-visible":{wcag:"2.4.7",says:"Whatever has the keyboard shows a ring at least 2px wide, at 3:1 against its ground.",needs:"layout"},contrast:{wcag:"1.4.3",says:"Text is at 4.5:1 against its ground, 3:1 when large.",needs:"layout"},"keyboard-trap":{wcag:"2.1.2",says:"Tab leaves the view: the keyboard is never held inside it.",needs:"keys"}};var se="http://www.w3.org/1999/xhtml",U="http://www.w3.org/2000/svg",b=(t,...i)=>t.namespaceURI===se&&i.includes(t.localName),oe=t=>t.nodeType===1,T=t=>Array.from(t.childNodes).filter(oe),de=new Set(["button","link","checkbox","switch","radio","tab","menuitem","menuitemcheckbox","menuitemradio","option","slider","spinbutton","textbox","searchbox","combobox","treeitem"]),ce=new Set(["button","link","checkbox","switch","radio","tab","menuitem","menuitemcheckbox","menuitemradio","option","img","slider","progressbar","scrollbar","separator"]),he={checkbox:"aria-checked",switch:"aria-checked",radio:"aria-checked",menuitemcheckbox:"aria-checked",menuitemradio:"aria-checked",tab:"aria-selected",option:"aria-selected"},ie=new Set(["true","false","mixed"]),be=/^(show|hide|expand|collapse)?\s*(more|less|all|details|everything)?$/i;function I(t){let i=[],a=n=>{for(let c of T(n))i.push(c),a(c)};return a(t),i}function ne(t){for(let i=t;i;i=i.parentElement)if(i.getAttribute("aria-hidden")==="true"||i.hasAttribute("hidden"))return!0;return!1}var P=t=>t.getAttribute("role")?.trim().split(/\s+/)[0]?.toLowerCase()??null,fe=t=>{let i=t.getAttribute("tabindex");if(i===null)return;let a=Number.parseInt(i,10);return Number.isNaN(a)?void 0:a},me=t=>t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true",R=t=>b(t,"input")&&(t.getAttribute("type")??"").toLowerCase()==="hidden"||b(t,"button","input","select","textarea")&&t.hasAttribute("disabled")?!1:H(t)&&(fe(t)??0)>=0,F=t=>b(t,"button","select","textarea","summary")||b(t,"input")&&(t.getAttribute("type")??"").toLowerCase()!=="hidden"||t.localName==="a"&&t.hasAttribute("href"),re=t=>F(t)||t.hasAttribute("data-graview-link")||t.hasAttribute("data-graview-press")?!0:de.has(P(t)??""),ge=t=>t.hasAttribute("role")||!D(t);function Ae(t){let i=[],a=n=>JSON.stringify(n);for(let n=t;n&&!n.hasAttribute("data-graview-view-root");n=n.parentElement){let c=n.getAttribute("data-key");if(c!==null){i.unshift(`[data-key=${a(c)}]`);break}let r=n.getAttribute("id");if(r){i.unshift(`[id=${a(r)}]`);break}let u=n.getAttribute("class")?.trim().split(/\s+/)[0],f=`${n.localName}${u?`.${u}`:""}`,p=n.parentElement;if(p){let l=T(p).filter(w=>w.localName===n.localName);l.length>1&&(f+=`:nth-of-type(${l.indexOf(n)+1})`)}i.unshift(f)}return i.join(" > ")}var ye=t=>{for(let i=t;i;i=i.parentElement){let a=i.getAttribute("data-key");if(a!==null)return a}};function k(t){if(t.nodeType===3)return t.textContent??"";if(!oe(t)||t.getAttribute("aria-hidden")==="true"||t.hasAttribute("hidden"))return"";let i=t.getAttribute("aria-label")?.trim();if(i)return` ${i} `;if(t.localName==="img")return` ${t.getAttribute("alt")??""} `;if(t.namespaceURI===U&&t.localName==="svg"){let a=T(t).find(n=>n.localName==="title");return a?` ${k(a)} `:""}return b(t,"input","select","textarea")?"":Array.from(t.childNodes).map(k).join("")}var A=t=>t.replace(/\s+/g," ").trim();function we(t,i,a){let n=t.getAttribute("aria-labelledby");if(n){let r=A(n.split(/\s+/).map(u=>i.get(u)?k(i.get(u)):"").join(" "));if(r)return r}let c=A(t.getAttribute("aria-label")??"");if(c)return c;if(b(t,"input","select","textarea")){let r=(t.getAttribute("type")??"").toLowerCase();if(b(t,"input")&&["submit","reset","button"].includes(r))return A(t.getAttribute("value")??(r==="submit"?"Submit":r==="reset"?"Reset":""));if(b(t,"input")&&r==="image")return A(t.getAttribute("alt")??"");let u=t.getAttribute("id"),f=u?a.find(l=>l.getAttribute("for")===u):void 0;if(f&&A(k(f)))return A(k(f));for(let l=t.parentElement;l;l=l.parentElement)if(b(l,"label")&&A(k(l)))return A(k(l));let p=A(t.getAttribute("placeholder")??"");return p||A(t.getAttribute("title")??"")}return t.localName==="img"?A(t.getAttribute("alt")??t.getAttribute("title")??""):A(k(t))||A(t.getAttribute("title")??"")}function pe(t){let i=I(t);for(let a of i){let n=I(a).some(K);if(!Q(a,n)||(a.setAttribute("data-graview-link",""),W(a,I(a))))continue;let c=a.localName==="a";if(!a.hasAttribute("role")&&(c||D(a))&&a.setAttribute("role","link"),b(a,"tr")){let r=T(a).find(u=>u.localName==="td"||u.localName==="th");r&&!r.hasAttribute("tabindex")&&r.setAttribute("tabindex","0");continue}!b(a,"button")&&!a.hasAttribute("tabindex")&&a.setAttribute("tabindex","0")}for(let a of i){let n=X(a)&&!J(a)&&!b(a,"input","select","textarea"),c=!n&&Y(a);!n&&!c||(H(a)||a.setAttribute("tabindex","0"),n&&D(a)&&a.setAttribute("role","button"),a.setAttribute("data-graview-press",""))}for(let a of i.filter(n=>n.namespaceURI===U&&n.localName==="svg")){let n=a.hasAttribute("role")||a.hasAttribute("aria-label")||a.hasAttribute("aria-labelledby")||T(a).some(r=>r.localName==="title"),c=[a,...I(a)].some(r=>r.hasAttribute("tabindex")||r.hasAttribute("data-graview-link")||r.hasAttribute("data-graview-press")||r.localName==="a");!n&&!c&&!a.hasAttribute("aria-hidden")&&a.setAttribute("aria-hidden","true")}}function ve(t,i){let a=t;return typeof a.querySelectorAll!="function"?[]:i.flatMap(n=>{try{return Array.from(a.querySelectorAll(n))}catch{return[]}})}function _(t){for(let i of T(t)){if(R(i)||_(i))return!0;let a=i.shadowRoot;if(a&&_(a))return!0}return!1}function ke(t){let i=t.ownerDocument?.defaultView;if(!i||typeof i.getComputedStyle!="function")return!1;let n=(t.host??t).getBoundingClientRect?.();return!!(n&&(n.width>0||n.height>0))}function Oe(t,i={}){i.host==="pending"&&pe(t);let a=I(t),n=new Map(a.flatMap(e=>e.getAttribute("id")?[[e.getAttribute("id"),e]]:[])),c=a.filter(e=>b(e,"label")),r=i.clicked?Array.from(i.clicked):[...Z(t)??[]],u=new Set([...r.filter(e=>typeof e=="object"),...ve(t,r.filter(e=>typeof e=="string"))]),f=i.chrome===!0,p=[],l=(e,o,d,g,h,y=!1,L=q[e].wcag)=>{let V=ye(o);p.push({rule:e,wcag:L,impact:d,at:Ae(o),...V!==void 0?{key:V}:{},says:g,fix:h,automatic:y||f})},w=a.filter(e=>!ne(e)),S=e=>we(e,n,c)!=="",s=new Set(w.filter(e=>e.hasAttribute("data-graview-link")&&W(e,I(e))));for(let e of w){if(me(e))continue;let o=e.hasAttribute("data-graview-link"),d=e.hasAttribute("data-graview-press"),g=u.has(e);if(!o&&!d&&!g||F(e)&&R(e)||s.has(e)&&!g||b(e,"tr")&&T(e).some(y=>(y.localName==="td"||y.localName==="th")&&R(y)))continue;if(!(R(e)||g&&I(e).some(y=>R(y)&&(F(y)||y.hasAttribute("data-graview-press")||y.hasAttribute("data-graview-link"))))){o||d?l("keyboard",e,"serious","It is a link or a press the host makes, and Tab does not reach it.","The host gives it the keyboard when it draws the view; audit the view as the host drew it.",!0):l("keyboard",e,"serious",`A <${e.localName}> the view hears a click on, which Tab does not reach: a mouse can press it and a keyboard cannot.`,'Draw it as a <button type="button"> (the host resets its look), or give it role="button" and the host gives it the keyboard, Enter and Space.');continue}R(e)&&!ge(e)&&!(e.localName==="a"&&e.hasAttribute("href"))&&l("role",e,"serious",`A <${e.localName}> that takes the keyboard says nothing of what it is: a screen reader says "group" or nothing.`,'Draw it as a <button type="button">, or give it role="button" (or role="link" when it goes somewhere).',o||d)}for(let e of w){if(!re(e)||s.has(e)||S(e))continue;let o=P(e),d=b(e,"button")||o==="button"||e.hasAttribute("data-graview-press"),g=b(e,"input","select","textarea")||["textbox","searchbox","combobox","slider","spinbutton"].includes(o??""),h=g?"field":d?"button":e.hasAttribute("data-graview-link")||e.localName==="a"||o==="link"?"link":"control";l("name",e,d||g?"critical":"serious",`A ${h} with no name: a screen reader says only "${h}".`,g?'Give it a <label for> or aria-label="\u2026".':'Put words in it \u2014 a .graview-sr span when it shows only an icon \u2014 or aria-label="\u2026".')}for(let e of w){let o=P(e),d=o&&!b(e,"input")?he[o]:void 0;if(d&&!e.hasAttribute(d)){l("toggle-state",e,"serious",`It is role="${o}" and says no ${d}: a screen reader cannot say whether it is ${d==="aria-checked"?"on":"chosen"}.`,`Give it ${d}="true" or "false", and draw it again as it changes.`);continue}for(let[h,y]of[["aria-checked",ie],["aria-pressed",ie],["aria-expanded",new Set(["true","false"])],["aria-selected",new Set(["true","false"])]]){let L=e.getAttribute(h);L!==null&&!y.has(L)&&l("toggle-state",e,"serious",`${h}="${L}" is no state a screen reader can say.`,`Give ${h} "true" or "false"${y.has("mixed")?' (or "mixed")':""}.`)}!(b(e,"button")||o==="button"||e.hasAttribute("data-graview-press"))||e.hasAttribute("aria-expanded")||e.hasAttribute("aria-pressed")||(e.hasAttribute("aria-controls")?l("toggle-state",e,"serious","A button that says what it controls (aria-controls) and not whether that is open.",'Give it aria-expanded="true" or "false", and draw it again as it opens and closes.'):u.has(e)&&A(k(e))!==""&&be.test(A(k(e)))&&l("toggle-state",e,"moderate",`A button the view hears that reads "${A(k(e))}" \u2014 it opens and closes something \u2014 and says no state.`,'Give it aria-expanded="true" or "false" (or aria-pressed for a toggle), and draw it again as it changes.'))}for(let e of w){let o=P(e)??(b(e,"button")?"button":e.localName==="a"&&e.hasAttribute("href")?"link":null);if(!o||!ce.has(o)||o==="img")continue;let d=I(e).find(h=>!ne(h)&&(R(h)||re(h)));if(!d)continue;let g=e.hasAttribute("data-graview-link")&&!b(e,"a");l("nested-interactive",e,"serious",`A ${o} holds a <${d.localName}> a person presses on its own: a screen reader reads the ${o} as one thing and never reaches what is inside.`,g?"Put an <a> to the card's own record or place on its heading: the card is then a bigger target for a pointer, and the <a> the keyboard's way in.":`Move the <${d.localName}> out of the ${o}, beside it.`)}for(let e of w){if(e.localName==="img"&&e.namespaceURI===se){if(e.hasAttribute("alt")||e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")||["none","presentation"].includes(P(e)??""))continue;l("img-alt",e,"critical","An image with no alt: a screen reader reads its address, or nothing.",'Give it alt="what it shows", or alt="" when it is decoration.');continue}if(e.namespaceURI!==U||e.localName!=="svg"||e.parentElement?.namespaceURI===U||[e,...I(e)].some(h=>R(h)||h.hasAttribute("data-graview-link")||h.hasAttribute("data-graview-press")||h.localName==="a"))continue;let d=P(e);if(d==="none"||d==="presentation")continue;let g=S(e)&&(e.hasAttribute("aria-label")||e.hasAttribute("aria-labelledby")||T(e).some(h=>h.localName==="title"));!d&&!g?l("svg-name",e,"minor","An SVG that says nothing, which a screen reader still meets.","The host hides an SVG that says nothing when it draws the view.",!0):d!=="img"&&d!=="graphics-document"?l("svg-name",e,"minor","An SVG with a name and no role: some screen readers skip it.",'Give it role="img" beside its aria-label.'):g||l("svg-name",e,"serious",'An SVG that is role="img" with no name: a screen reader says "image" and nothing more.','Give it aria-label="what it shows", or a <title> first inside it.')}let N=e=>/overflow(-[xy])?\s*:\s*(auto|scroll)/i.test(e.getAttribute("style")??""),E=e=>{R(e)&&S(e)||_(e)||l("scroll-region",e,"serious","A box that scrolls by itself and holds nothing Tab reaches: the keyboard cannot scroll it, and what is past its edge is out of reach.",'Give it tabindex="0", role="region" and aria-label="what it holds", or let it flow with the page.')},m=i.measure!==!1&&ke(t);if(!m)for(let e of w)N(e)&&E(e);let x=["keyboard","role","name","toggle-state","nested-interactive","img-alt","svg-name","scroll-region"],v=[],$={},O={};if(m){let e=ae(w,{limit:i.limit??400,tabbable:R,scrollsOnPage:E,say:(o,d,g,h,y,L,V)=>l(o,d,g,h,y,V===!0,L)});x.push("focus-visible","contrast"),Object.assign($,e.unmeasured),Object.assign(O,e.measured)}else{let e=i.measure===!1?"Asked not to measure.":"Nothing here is laid out (a headless run, or a DOM with no layout): it needs a browser's styles and boxes.";v.push({rule:"focus-visible",why:e},{rule:"contrast",why:e})}return v.push({rule:"keyboard-trap",why:"It needs keys pressed in a browser: a harness's Tab walk presses them (pnpm verify a11y)."}),{problems:p,ran:x,skipped:v,unmeasured:$,measured:O}}export{q as AUDIT_RULES,Oe as auditView,pe as markAsTheHost};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Q,b as Ge,c as Ve,f as ue,i as Ke}from"./chunk.QM54TGU6.js";import"./chunk.EGVM24ND.js";import{b as je,c as qe,d as Me,f as se,g as Be,h as ie,i as de,j as Fe,k as ce,m as Ne,n as Ie,o as Le,p as He,q as le}from"./chunk.2TUEBU7X.js";import"./chunk.NYLKG25K.js";import{a as Ee}from"./chunk.TBY5IR7C.js";import{d as De}from"./chunk.H3W5C3XQ.js";import"./chunk.6WB2TYK7.js";import"./chunk.BJUUSIQY.js";import"./chunk.JGRSUTPJ.js";import"./chunk.XOZU4OFA.js";import"./chunk.EP5JS7ZH.js";import"./chunk.CE3NKAF7.js";import"./chunk.MIE4TJRW.js";import{x as xe}from"./chunk.CFE3MHWZ.js";import"./chunk.RD2FSSLV.js";import"./chunk.HXTKBISQ.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as it,W as Ce,ea as $e}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{la as Re}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as ae}from"./chunk.AJZBJBMO.js";var g=ae(it(),1);var N=ae(Ce(),1),T=n=>(n??"").replace(/\s+/g," ").trim(),fe=()=>new Promise(n=>requestAnimationFrame(()=>n())),dt=n=>new Promise(r=>setTimeout(r,n));function ct(n){let r=n.cloneNode(!0);for(let o of r.querySelectorAll("span"))o.remove();return T(r.textContent).replace(/^[▸▾]\s*/,"")}function _e(n){if(!n||!n.isConnected)return"";let r=n.innerText??n.textContent??"";return`${n.querySelectorAll("*").length}|${T(r)}`}function lt(n,r=80){if(!n)return"";let o=[],i=new Set,d="li, tr, article, [data-graview-listed], [data-graview-record], [data-graview-field]";for(let c of n.querySelectorAll(`h1, h2, h3, h4, ${d}`)){if(o.length>=r)break;if([...i].some(u=>u.contains(c))||c.closest("[data-graview-popover], [hidden], nav, [aria-hidden='true']"))continue;let l=/^h([1-4])$/i.exec(c.localName),s=(l?ct(c):T(c.innerText??c.textContent)).slice(0,140);if(s)if(l)o.push(`${"#".repeat(Number(l[1]))} ${s}`);else{let u=c.getAttribute("data-graview-field");o.push(u?`${u}: ${s}`:`- ${s}`),i.add(c)}}return o.join(`
|
|
2
|
+
`)}function ut(n,r){let{store:o}=n,i=c=>Object.fromEntries(Object.entries(c).filter(([,l])=>l!==void 0&&typeof l!="object").map(([l,s])=>[l,typeof s=="string"?s.slice(0,80):s]));return{kinds:(r.kind?[r.kind]:o.schema.kinds.slice(0,6)).map(c=>{let l=o.graph.nodesOfKind(c),s=o.schema.tryDefinition(c);return{kind:c,count:l.length,fields:Object.keys(s?.fields?.shape??{}),relations:Object.keys(s?.edges??{}),some:(r.record?l.filter(u=>u.id===r.record):l.slice(0,3)).map(i)}})}}function ft(n,r){let o=n.store.schema,i=new Set,d=new Set;for(let c of o.definitions)for(let[l,s]of Object.entries(c.edges??{})){let u=Array.isArray(s?.to)?s.to:[];if(r.kind===void 0||c.kind===r.kind||u.includes(r.kind)){d.add(l);for(let P of[c.kind,...u])P!==r.kind&&o.tryDefinition(P)&&i.add(P)}}if(r.kind===void 0)for(let c of o.kinds)i.add(c);return{kinds:[...i],edges:[...d]}}var Ue={manifest:"The view could not start: what it reads is not this app's.",source:"The script is too long: make it shorter.",start:"The script did not start: it must be one plain script, with no syntax errors, that calls graview.onProps and graview.render.",error:"The script threw while drawing: read only what props gives (props.nodes for a list, props.node for one record), guard each value that may be missing, and call no function that does not exist."};async function We(n,r,o=15e3){let i=Date.now()+o;for(;Date.now()<i;){for(let c of document.querySelectorAll("[data-worker-view-place]")){let l=xe(c),s=l?.name===n?l.drawing().root:void 0;if(l&&c.isConnected&&s?.isConnected&&s.childElementCount>0&&(r===void 0||await l.source()===r))return{element:c,handle:l}}let d=document.querySelector(`[data-worker-view-fell-back="${CSS.escape(n)}"]`);if(d)return{failed:Ue[d.getAttribute("data-worker-view-failed")??""]??Ue.error};await dt(80)}return{failed:"The view did not draw in time: keep it simple and quick to draw."}}var pe=new Map,pt=(n,r)=>{let o=pe.get(n);return o||pe.set(n,o={phase:r(),steps:[],before:!1,putBack:null,began:!1,original:null,markup:null,talk:[],events:[],since:Date.now(),stop:null,covering:!1,pointed:null,about:null,kept:null,pressed:null,version:0,heard:new Set}),o};function he(n,r){return r.record?[n.graph.getNode(r.record)].filter(o=>o!==void 0):r.kind?n.graph.nodesOfKind(r.kind):n.schema.kinds.flatMap(o=>n.graph.nodesOfKind(o))}var Y=(n,r)=>r?Re(n.schema.tryDefinition(r.kind),r):"";function gt(n,r,o){let i=T(o).toLowerCase();return he(n,r).map(d=>Y(n,d)).filter(d=>d.length>1&&i.includes(T(d).toLowerCase())).slice(0,40)}function ze(n,r){let o=r.kind?[r.kind]:n.schema.kinds,i=[...new Set(o.flatMap(c=>Object.keys(n.schema.tryDefinition(c)?.fields?.shape??{})))],d={};for(let c of he(n,r).slice(0,400))for(let l of i){let s=c[l];if(s==null||typeof s=="object")continue;let u=d[l]??=[];u.length<60&&!u.includes(s)&&u.push(s)}return{fields:i,values:d}}function $t({ask:n,close:r}){let o=$e(),{ai:i,aiDesk:d,aiHere:c,session:l,principal:s,keptViews:u,store:D,onProposeChange:P,composeChange:w,onDraftChange:O,app:q}=o,a=n.part,e=(0,g.useMemo)(()=>pt(n.at,()=>n.mode==="highlight"?{at:"highlighting"}:{at:"open"}),[n]),H=(0,g.useCallback)(t=>(e.heard.add(t),()=>void e.heard.delete(t)),[e]),S=(0,g.useSyncExternalStore)(H,()=>e.phase,()=>e.phase),Ye=(0,g.useSyncExternalStore)(H,()=>e.version,()=>e.version),A=(0,g.useCallback)(()=>{e.version+=1,e.heard.forEach(t=>t())},[e]),k=(0,g.useCallback)(t=>{e.phase=t,A()},[e,A]),C=(0,g.useCallback)(async()=>{let t=e.putBack;e.putBack=null,t&&await t()},[e]),Z=(0,g.useCallback)(()=>{e.stop?.abort(),e.stop=null,C(),pe.delete(n.at),r()},[C,n.at,r,e]),b=(0,g.useCallback)(()=>a.main?.isConnected?a.main:yt(),[a]),G={name:a.name,slot:a.slot,...a.kind?{kind:a.kind}:{},...a.group?{group:a.group}:{}},me=a.place??(a.kind?`${a.kind}-${a.slot}`:"home"),Ze=n.fromScene?`From the scene: Better UI changes how \u201C${a.name}\u201D looks on its page here, for everyone in this app.`:`This changes how ${a.name} looks for everyone in this app.`,M=(0,g.useCallback)((t,f,p,h={})=>({id:De(),at:new Date().toISOString(),by:s,target:{on:"place",place:me},targetLabel:a.name,ask:{kind:"section",said:t},offered:[],outcome:f,stages:p.map(m=>({stage:m.stage,ms:m.ms,model:m.model})),usage:p.flatMap(m=>m.usage?[{tier:m.stage==="light"?"fast":"thinking",model:m.model,inputTokens:m.usage.inputTokens,outputTokens:m.usage.outputTokens}]:[]),...h}),[s,me,a.name]),we=P!==void 0&&w!==void 0&&Ee(D,s),B=(0,g.useMemo)(()=>kt(o,a),[o,a]),$=Le(G,ft(o,a),B.map(t=>t.act)),ke=$!==void 0&&typeof u?.fork=="function"&&typeof u.draftFork=="function"&&u.current().may.views===!0,ye=a.slot==="record"?{page:"record",kind:a.kind}:a.slot==="home"?{page:"home"}:{page:"list",kind:a.kind??""},V=(0,g.useCallback)(t=>({manifest:$,source:t,from:ye,said:""}),[$,ye]),ve=S.at==="working";(0,g.useEffect)(()=>{if(!ve)return;let t=a.record??(a.kind?`kind:${a.kind}`:null);return c({participant:`agent:graview-for-${s.id??"anyone"}:${l}`,kind:"agent",name:"Graview",...s.id?{onBehalfOf:s.id}:{},over:t,robot:{at:t,mode:"thinking"}}),()=>c(null)},[ve]);let x=(0,g.useCallback)(()=>{if(e.original)return e.original;let t=b(),f=t?.innerText??"";return e.original=Q(X(t),gt(o.store,a,f||(t?.textContent??""))),e.original},[e,b,o,a]),I=(0,g.useCallback)(()=>Q(X(b()),x().records.map(t=>t.label)),[b,x]),K=(0,g.useCallback)(async t=>{if(await C(),t.kind==="spec"){let f=await O(Je(t.edits,t.said,i.name));e.putBack=f.undo}else u.draftFork(V(t.source)),e.putBack=()=>u.draftFork(null)},[C,O,e,u,V,i.name]),L=(0,g.useCallback)(async()=>{let t=e.steps.at(-1);e.before=!1,t?await K(t):await C()},[e,K,C]),v=(0,g.useCallback)((t,f)=>{e.talk.push({who:t,said:f}),A()},[e,A]),F=(0,g.useCallback)(t=>{e.events.at(-1)?.kind==="streaming"&&e.events.pop(),e.events.push(t),A()},[e,A]),U=()=>e.talk.filter(t=>t.who==="person").map(t=>t.said).join(" "),be=(0,g.useCallback)(async t=>{if(!we||!O)return!1;let p=(await (__graviewPreload(import.meta.url,["./chunk.7ZTGB4O7.js","./chunk.TBY5IR7C.js","./chunk.BIDL7GQD.js","./chunk.Q5WEOX3Q.js","./chunk.KAM73WVF.js","./chunk.O32F6LGK.js","./chunk.R3GE37OI.js","./chunk.2KCDLCB2.js","./chunk.UD7VLXPM.js","./chunk.3DEWQDP7.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZMADWPJO.js"))).documentOfApp(q??{});if(!p)return!1;let h=e.steps.at(-1);if(h&&h.kind!=="spec")return!1;let m=h?.edits??[],y=m.length>0?w({document:p,edits:m}):void 0,j=y?.ok?y.document:p;if(!(t.mode==="just"?{can:!0}:await Ne(i,t.words,G)).can)return!1;F({kind:"look",text:`Looking at how ${a.name} is set up`});let E=[],ne=await Ie({ai:i,document:j,part:G,mode:t.mode==="choose"?"just":t.mode,...t.words?{words:t.words}:{},...t.pointed?{highlighted:[t.pointed.name,...t.pointed.lines]}:{},shows:lt(b(),30),judge:async W=>{let _=w({document:p,edits:[...m,...W]});return _.ok?(E=_.said,[]):[_.refused]}});if(!ne.ok)return!1;let at=[...m,...ne.edits],Oe=M(`Make \u201C${a.name}\u201D better: ${t.words}`,"offered",ne.stages),oe=_e(b()),re={kind:"spec",edits:at,said:E[E.length-1]??E[0]??`${a.name} changed.`,entry:Oe};e.covering=!0,A();try{await K(re);let W=oe;for(let st=Date.now()+1500;Date.now()<st&&W===oe;)await fe(),W=_e(b());let _=W===oe?["nothing changed"]:se(x(),I(),{...ze(o.store,a),asked:U()});if(_.length>0)return await L(),d.record({...Oe,outcome:"failed",failed:_.join(" ")}),!1}catch{return await L(),!1}finally{e.covering=!1,A()}return e.steps.push(re),e.before=!1,F({kind:"passed",text:"Changed its settings \u2014 it's on the page"}),v("graview",`Done: ${re.said.replace(/\.$/,"")}.`),!0},[i,d,q,w,M,e,o,b,O,x,I,a,G,K,L,we,F,v,A]),Se=(0,g.useCallback)(async t=>{if(!$||!u?.draftFork)return{findings:["This page cannot be drawn anew here."],drew:void 0};let f=x();e.covering=!0,A();try{u.draftFork(V(t)),e.putBack=()=>u.draftFork(null);let p=await We($.name,t),h;if("failed"in p)h=[p.failed];else{let y=[...await p.handle.check(t),...p.handle.refused().filter(j=>!/^Refused a rule of the stylesheet\b/.test(j))];if(y.length>0)h=y;else{await fe(),await fe();let j=p.element.closest("[data-graview-page-main], main")??X(b());h=se(f,Q(j,f.records.map(E=>E.label)),{...ze(o.store,a),asked:U()});let R=p.handle.presses?await p.handle.presses(t).catch(()=>{}):void 0;R&&(e.pressed=R,h=[...h,...ie(R,Xe(f,ge(o,a,f)),B.filter(E=>E.toggle).map(E=>E.act),z(a))])}}let m=le(I());if(h.length===0){let y=M(`Draw \u201C${a.name}\u201D anew: ${U()}`,"offered",[]);e.steps.push({kind:"view",source:t,said:Be(a.name,f,I())??`${a.name} has a new design. Compare Before and After.`,entry:y}),e.before=!1}else await L();return{findings:h,drew:m}}finally{e.covering=!1,A()}},[$,u,x,e,A,V,I,o,a,M,L]),Pe=(0,g.useCallback)(async(t=[])=>{if(!$||!ke){v("graview","Its settings can't do that, and a new design can't be drawn for it here.");return}let f=new AbortController;e.stop=f,e.markup??=Qe(b());let p=e.steps.length,h=[...e.steps].reverse().find(y=>y.kind==="view"),m=await He({ai:i,part:G,manifest:$,talk:e.talk,keep:ht(x(),b(),a.name,o,a),...e.markup?{markup:e.markup}:{},...h?{current:h.source}:e.kept?{current:e.kept}:{},host:{look:()=>le(I()),read:()=>ut(o,a),draft:Se},onEvent:y=>F(y),...e.about?{about:e.about}:{},acts:B,...t.length>0?{pressed:t}:{},noun:z(a),signal:f.signal});if(e.stop===f){if(e.stop=null,e.events.at(-1)?.kind==="streaming"&&e.events.pop(),d.record(M(`Draw \u201C${a.name}\u201D anew: ${U()}`,e.steps.length>p?"offered":"failed",m.stages,e.steps.length>p?{}:{failed:m.last?.findings.join(" ")??m.said})),m.passed){let y=e.pressed?de(e.pressed,B,z(a)):void 0,j=Fe.test(m.said)?void 0:m.said;v("graview",[j??(y?void 0:"Here it is on the page."),y].filter(Boolean).join(" "))}else v("graview",m.said);m.ended==="stuck"&&k({at:"stuck",...m.keepable&&m.last?{source:m.last.source}:{}})}},[i,d,B,I,M,ke,e,o,Se,b,$,x,a,G,v,k,F]),Ae=(0,g.useCallback)(async()=>{let f=[...e.steps].reverse().find(R=>R.kind==="view")?.source??e.kept;if(!f||!$)return[];F({kind:"look",text:"Pressing every control on the page"});let p=await We($.name);if("failed"in p||!p.handle.presses)return[];let h=await p.handle.presses(f).catch(()=>{});if(!h)return[];e.pressed=h;let m=x(),y=ie(h,Xe(m,ge(o,a,m)),B.filter(R=>R.toggle).map(R=>R.act),z(a)),j=y.length>0?y:h.controls.slice(0,8).map(R=>`${R.control}: ${R.says}`);return F(y.length>0?{kind:"check",text:`Check: ${y.length} ${y.length===1?"control doesn't":"controls don't"} work \u2014 fixing`}:{kind:"passed",text:"Check: every control works"}),v("graview",y.length>0?`I pressed every control: ${y.join(" ")}`:`I pressed every control. ${de(h,B,z(a))??"Each one did what it says."}`),j},[B,e,o,$,x,a,v,F]),J=(0,g.useCallback)(async(t,f="describe")=>{if(e.phase.at==="working")return;let p=e.pointed;e.pointed=null;let h={mode:f,words:t,...p?{pointed:p}:{}};e.about=p??e.about,v("person",t),e.events=[],e.since=Date.now(),k({at:"working"}),x(),e.markup??=Qe(b());let m=ce.test(t)?await Ae().catch(()=>[]):[];!ce.test(t)&&await be(h).catch(()=>!1)||await Pe(m),e.phase.at==="working"&&k(e.steps.length>0?{at:"draft"}:{at:"open"})},[Pe,be,e,b,x,Ae,v,k]),ee=(0,g.useCallback)(()=>{if(e.phase.at!=="working")return;let t=e.stop;e.stop=null,t?.abort(),e.covering=!1,e.steps=e.steps.filter(f=>f.entry.at<new Date(e.since).toISOString()),L(),v("graview","Stopped. The page is as it was."),k(e.steps.length>0?{at:"draft"}:{at:"open"})},[e,v,k,L]),et=(0,g.useCallback)(async t=>{let f=e.steps.at(-1);!f||t===e.before||(e.before=t,A(),t?await C():await K(f))},[e,C,K,A]),te=(0,g.useCallback)(async()=>{let t=e.steps.at(-1);if(!(!t||e.phase.at!=="draft")){k({at:"keeping"});try{let f,p;if(t.kind==="spec"){await C();let h=await P(Je(t.edits,t.said,i.name));if(h==="declined")return v("graview","It wasn't kept."),k({at:"draft"});typeof h=="object"&&([f,p]=[h.undo,h.note])}else{let h=await u.fork(V(t.source));e.putBack=null,u.draftFork?.(null),e.kept=t.source,h&&([f,p]=[h.undo,h.note])}d.record({...t.entry,outcome:"accepted"}),e.steps=[],e.before=!1,k({at:"kept",...f?{undo:f}:{},...p?{note:p}:{}})}catch{v("graview","It couldn't be kept."),k({at:"draft"})}}},[e,k,C,P,i.name,u,V,d,v]),tt=(0,g.useCallback)(async t=>{if(e.phase.at!=="stuck")return;let f={kind:"view",source:t,said:`${a.name} kept as it was last drafted.`,entry:M(`Draw \u201C${a.name}\u201D anew: ${U()}`,"offered",[])};e.steps.push(f),e.phase={at:"draft"},await te(),e.steps.at(-1)===f&&(e.steps.pop(),k(e.steps.length>0?{at:"draft"}:{at:"open"}))},[e,a.name,M,te,k]),nt=(0,g.useCallback)(()=>{v("graview","Stopped. The page is as it was."),k(e.steps.length>0?{at:"draft"}:{at:"open"})},[e,v,k]),ot=(0,g.useCallback)(()=>{let t=e.steps.at(-1);t&&d.record({...t.entry,outcome:"dismissed"}),e.steps=[],e.before=!1,C(),v("graview","Put back as it was."),k({at:"open"})},[e,d,C,v,k]),rt=(0,g.useCallback)(async()=>{if(!(e.phase.at!=="kept"||!e.phase.undo))try{await e.phase.undo(),e.kept=null,v("graview","Undone. The page is as it was."),k({at:"undone"})}catch{v("graview","It couldn't be put back.")}},[e,v,k]);if((0,g.useEffect)(()=>{e.began||!(n.mode==="just"||n.mode==="describe"&&n.words)||(e.began=!0,J(n.mode==="just"?"Make it easier to read at a glance":n.words,n.mode))},[e,n.mode,n.words,J]),(0,g.useEffect)(()=>{let t=f=>{if(f.key!=="Escape"||e.phase.at==="highlighting")return;if(f.preventDefault(),e.phase.at==="working")return ee();Z();let p=n.returnTo?.isConnected?n.returnTo:document.querySelector("[data-graview-page-title], main h1");p&&!p.hasAttribute("tabindex")&&!p.matches("a[href], button, input, select, textarea")&&p.setAttribute("tabindex","-1"),p?.focus?.()};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[e,Z,ee,n.returnTo]),S.at==="highlighting")return(0,N.jsx)(Ke,{box:b(),root:b(),whole:a.elements,wholeSaid:"The whole page",cancel:()=>k({at:"open"}),chose:t=>{e.pointed={name:Me(t)??je(t.map(ue)),lines:qe(t.map(ue))},k({at:"open"})}});let Te=e.steps.at(-1);return(0,N.jsxs)(N.Fragment,{children:[e.covering?(0,N.jsx)(Ge,{over:b(),name:a.name,said:`Graview is drafting \u201C${a.name}\u201D\u2026`}):null,(0,N.jsx)(Ve,{name:a.name,scope:Ze,phase:S.at,talk:e.talk,steps:e.events,since:e.since,working:S.at==="working"||S.at==="keeping",...Te&&S.at==="draft"?{draft:{said:Te.said,before:e.before}}:{},...S.at==="kept"?{kept:{...S.note?{note:S.note}:{},...S.undo?{undo:()=>void rt()}:{}}}:{},...S.at==="stuck"?{stuck:{...S.source!==void 0?{keepAnyway:()=>void tt(S.source)}:{},stop:nt}}:{},about:(e.pointed??e.about)?.name??a.name,ask:t=>void J(t),just:()=>void J("Make it easier to read at a glance","just"),point:()=>k({at:"highlighting"}),stop:ee,compare:t=>void et(t),keep:()=>void te(),discard:ot,close:Z})]})}function Je(n,r,o){return{said:r,add:[],drop:[],card:{said:r,adds:[],keeps:[],drops:[],breaking:[]},edits:n,via:`ai:${o??"model"}`}}function ht(n,r,o,i,d){let c=X(r),l=d.slot==="home"?[...r?.querySelectorAll("h1")??[]].find(w=>c!==r&&!c?.contains(w)):void 0,s=T(l?.textContent)||T(c?.querySelector("[data-graview-page-title]")?.textContent)||(d.slot==="home"?"":T(c?.querySelector("h1")?.textContent))||(d.record?T(Y(i.store,i.store.graph.getNode(d.record))):"")||o,u=ge(i,d,n),D=Object.fromEntries(n.records.flatMap(w=>w.facts?.length||w.under&&w.under!==s?[[w.label,{...u[w.label]?{id:u[w.label]}:{},...w.facts?.length?{shows:w.facts}:{},...w.under&&w.under!==s?{under:w.under}:{}}]]:[])),P=wt(i,n,u,s);return{title:s,headings:n.headings.filter(w=>w!==s),records:n.records.map(w=>w.label),...Object.keys(D).length>0?{says:D}:{},...P?{grouping:P}:{}}}function mt(n,r,o){let i=he(n,r),d={};for(let c of o.records){let l=i.find(s=>T(Y(n,s))===T(c.label));l&&(d[c.label]=l.id)}return d}var ge=(n,r,o)=>mt(n.store,r,o);function wt(n,r,o,i){let{store:d}=n,c=r.records.filter(O=>O.under&&O.under!==i&&o[O.label]);if(c.length<2)return;let l=d.graph.allEdges(),s=new Map;for(let O of c){let q=o[O.label];for(let a of l){let e=a.from===q?a.to:a.to===q?a.from:void 0,H=e!==void 0?d.graph.getNode(e):void 0;if(!H||T(Y(d,H))!==T(O.under))continue;let S=`${a.kind}\0${H.kind}\0${a.from===q?"from":"to"}`;s.set(S,(s.get(S)??0)+1)}}let u=[...s].sort((O,q)=>q[1]-O[1])[0];if(!u||u[1]<c.length/2)return;let[D,P,w]=u[0].split("\0");return{edge:D,kind:P,record:w}}var X=n=>n?.querySelector("main")??n;function Qe(n){if(!n?.isConnected)return null;let r=(n.querySelector("main")??n).cloneNode(!0);for(let i of r.querySelectorAll("[data-graview-listed], [data-graview-record]")){let d=i.querySelector("a[href]");d&&d.setAttribute("data-record",i.getAttribute("data-graview-listed")??i.getAttribute("data-graview-record")??"")}for(let i of r.querySelectorAll("a[aria-label]"))T(i.textContent)||(i.textContent=i.getAttribute("aria-label"));for(let i of r.querySelectorAll("script, style, svg, button, input, select, textarea, [hidden], [aria-hidden='true'], [data-graview-popover]"))i.remove();for(let i of[r,...r.querySelectorAll("*")])for(let d of[...i.getAttributeNames()])d==="data-record"&&i.localName==="a"||i.removeAttribute(d);let o=r.outerHTML.replace(/\s+/g," ").replace(/<(div|span)>\s*<\/\1>/g,"").trim();return o.length>6e3?o.slice(0,6e3):o}var z=n=>n.slot==="list"||n.slot==="group"?n.name.toLowerCase():n.slot==="record"?"parts":"records";function Xe(n,r){return n.records.flatMap(o=>r[o.label]?[{label:o.label,id:r[o.label],...o.presses?{presses:!0}:{},...o.opens?{opens:!0}:{}}]:[])}function kt(n,r){let{store:o}=n,i=r.kind?[r.kind]:o.schema.kinds,d=l=>o.schema.tryDefinition(l)?.fields?.shape??{},c=l=>{let s=l?._zod?.def;for(let u=0;u<6&&s&&s.type!=="boolean"&&s.innerType!==void 0;u++)s=s.innerType._zod?.def;return s?.type==="boolean"};return o.allMutations().flatMap(l=>{let s=l.subject;if(!s||l.creates?.length)return[];let u=i.find(w=>s.kinds==="*"||s.kinds.includes(w));if(!u)return[];let D=l.writes??[],P=D.length===1&&c(d(u)[D[0]])?D[0]:void 0;return[{act:l.name,title:String(l.title??l.name),record:s.arg,...P?{toggle:P}:{}}]}).slice(0,24)}function yt(){return document.querySelector("[data-graview-page-main], main")??document.querySelector("[data-graview-face]")}export{$t as PageCard,_e as drawnSignature,ze as fieldsShownOf,gt as labelsShown,Qe as markupOf,lt as outlineOf,mt as recordIdsOf};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import"./chunk.
|
|
1
|
+
import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{W as T}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as A}from"./chunk.AJZBJBMO.js";var F=/^ {0,3}(`{3,}|~{3,})[ \t]*([^`\s]*)/,D=/^ {0,3}(#{1,6})(?:[ \t]+|$)/,R=/^ {0,3}(?:(?:-[ \t]*){3,}|(?:\*[ \t]*){3,}|(?:_[ \t]*){3,})$/,v=/^ {0,3}>[ \t]?/,_=/^([ \t]*)([-*+]|(\d{1,9})[.)])(?:[ \t]+|$)/,K=/^\|?\s*:?-+:?\s*(?:\|\s*:?-+:?\s*)+\|?$|^\|\s*:?-+:?\s*\|$/,w=/^[ \t]*$/;function O(t){let n=F.exec(t);if(!(!n||n[1][0]==="`"&&t.indexOf("`",n[0].length)>=0))return{mark:n[1],lang:n[2]}}function U(t,n){let r=t.trim().slice(n).trim(),e=r.length;for(;e>0&&r[e-1]==="#";)e--;return(e===0||r[e-1]===" "||r[e-1]===" ")&&(r=r.slice(0,e).trim()),r}var $=t=>O(t)!==void 0||D.test(t)||R.test(t)||v.test(t)||_.test(t),b=t=>[...t].reduce((n,r)=>r===" "?n+4-n%4:n+1,0);function E(t){let n=t.trim().replace(/^\|/,"").replace(/(?<!\\)\|$/,""),r=[],e="",l=!1;for(let c=0;c<n.length;c++){let h=n[c];h==="\\"&&n[c+1]==="|"?(e+="|",c++):h==="`"?(l=!l,e+=h):h==="|"&&!l?(r.push(e.trim()),e=""):e+=h}return r.push(e.trim()),r}function W(t){return B(t.replace(/\r\n?/g,`
|
|
2
2
|
`).replace(/\0/g,"\uFFFD").split(`
|
|
3
3
|
`),0)}function B(t,n){let r=[],e=0;for(;e<t.length;){let l=t[e];if(w.test(l)){e++;continue}let c=O(l);if(c){let o=new RegExp(`^ {0,3}${c.mark[0]==="`"?"`":"~"}{${c.mark.length},}[ \\t]*$`),a=[];for(e++;e<t.length&&!o.test(t[e]);)a.push(t[e++]);e++,r.push({t:"code",text:a.join(`
|
|
4
4
|
`),...c.lang?{lang:c.lang}:{}});continue}let h=D.exec(l);if(h){r.push({t:"heading",level:h[1].length,children:k(U(l,h[1].length),0)}),e++;continue}if(R.test(l)){r.push({t:"rule"}),e++;continue}if(v.test(l)){let o=[];for(;e<t.length&&(v.test(t[e])||o.length>0&&!w.test(t[e])&&!$(t[e])&&!w.test(o[o.length-1]));)o.push(t[e++].replace(v,""));r.push(n<8?{t:"quote",blocks:B(o,n+1)}:{t:"p",children:k(o.join(`
|