graview 0.1.64 → 0.1.66
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/preview/chunk.2KFZHUAC.js +1 -0
- package/dist/preview/chunk.2MHNPBHC.js +1 -0
- package/dist/preview/{chunk.77JI5T4F.js → chunk.2VR7YEJ6.js} +1 -1
- package/dist/preview/chunk.32SHA3EY.js +1 -0
- package/dist/preview/chunk.3L4JMM3P.js +1 -0
- package/dist/preview/chunk.3PBTN7RO.js +1 -0
- package/dist/preview/chunk.45JP6VGJ.js +5 -0
- package/dist/preview/{chunk.DUP2CGVH.js → chunk.4AC2QM7T.js} +1 -1
- package/dist/preview/chunk.4FCFNAA4.js +1 -0
- package/dist/preview/chunk.4FDVINRJ.js +1 -0
- package/dist/preview/chunk.4JULYKGD.js +1 -0
- package/dist/preview/chunk.4U4D7WOI.js +1 -0
- package/dist/preview/chunk.4WGYUYWU.js +2 -0
- package/dist/preview/chunk.5B5SRTUK.js +1 -0
- package/dist/preview/chunk.5BX66FBP.js +1 -0
- package/dist/preview/chunk.5CXIEYHY.js +2 -0
- package/dist/preview/chunk.5EMIWORS.js +1 -0
- package/dist/preview/{chunk.D2XLECMP.js → chunk.5FNFRVTL.js} +1 -1
- package/dist/preview/chunk.5LJVOLKR.js +1 -0
- package/dist/preview/{chunk.APUQIELA.js → chunk.6EHHMWPP.js} +1 -1
- package/dist/preview/chunk.6EVMXBNB.js +1 -0
- package/dist/preview/chunk.6FQW6FNL.js +1 -0
- package/dist/preview/chunk.6HY6ZGEE.js +5 -0
- package/dist/preview/{chunk.K5YFUMRS.js → chunk.6LXIEM6B.js} +1 -1
- package/dist/preview/chunk.6MQ5NT7S.js +1 -0
- package/dist/preview/chunk.6P6NGZ6D.js +1 -0
- package/dist/preview/{chunk.XIVELWAM.js → chunk.6TLXFMX2.js} +1 -1
- package/dist/preview/chunk.72XP2ARZ.js +1 -0
- package/dist/preview/{chunk.2V7QTIAV.js → chunk.72ZCLEQC.js} +1 -1
- package/dist/preview/{chunk.ITBG37WJ.js → chunk.7BIPZTJB.js} +1 -1
- package/dist/preview/chunk.7VADSNPZ.js +1 -0
- package/dist/preview/{chunk.2VYGDY5Z.js → chunk.7VP6Y6D2.js} +1 -1
- package/dist/preview/{chunk.S7SHWDPR.js → chunk.7ZKBYXUM.js} +1 -1
- package/dist/preview/chunk.AK7NGFEX.js +6 -0
- package/dist/preview/{chunk.2VIS2NAT.js → chunk.ANS2IEEV.js} +1 -1
- package/dist/preview/{chunk.UDYFGYJP.js → chunk.B6JRTW3A.js} +1 -1
- package/dist/preview/chunk.BCQWAFGD.js +1 -0
- package/dist/preview/{chunk.7SRSE5IS.js → chunk.BFAFCVL4.js} +1 -1
- package/dist/preview/chunk.BGAC3B7X.js +1 -0
- package/dist/preview/chunk.BMENTGDC.js +21 -0
- package/dist/preview/chunk.BOCVLC7X.js +1 -0
- package/dist/preview/{chunk.7VAHHEDX.js → chunk.BUVTUAB5.js} +1 -1
- package/dist/preview/chunk.BXBEGMPO.js +22 -0
- package/dist/preview/{chunk.4XCYZRZ3.js → chunk.BZ7QWHAE.js} +1 -1
- package/dist/preview/chunk.C2C3AXGI.js +1141 -0
- package/dist/preview/chunk.CBXS23YH.js +23 -0
- package/dist/preview/chunk.CEQQIW7Z.js +1 -0
- package/dist/preview/chunk.CEVGND3Y.js +6 -0
- package/dist/preview/{chunk.WHX47OJM.js → chunk.CTASTRQN.js} +1 -1
- package/dist/preview/chunk.CU2WCYMK.js +1 -0
- package/dist/preview/{chunk.7CLKGKSF.js → chunk.CVPMSPCH.js} +1 -1
- package/dist/preview/chunk.DEHIR4EG.js +1 -0
- package/dist/preview/chunk.DPJNGFEZ.js +4 -0
- package/dist/preview/chunk.DQFHIJFN.js +1 -0
- package/dist/preview/chunk.DSYP43NN.js +1 -0
- package/dist/preview/chunk.DTCAUPLC.js +1 -0
- package/dist/preview/{chunk.4U45EY5M.js → chunk.DZFM6GSY.js} +1 -1
- package/dist/preview/chunk.E3UL4MCD.js +35 -0
- package/dist/preview/chunk.E4VRRWFP.js +1 -0
- package/dist/preview/chunk.E7EWNWAN.js +1 -0
- package/dist/preview/chunk.EG7OOJH5.js +1 -0
- package/dist/preview/{chunk.TQ2G4AM4.js → chunk.EMFOMSMI.js} +1 -1
- package/dist/preview/{chunk.5B7NG6WH.js → chunk.EQ4OODGO.js} +1 -1
- package/dist/preview/{chunk.CJHYGRWV.js → chunk.ES63XSIM.js} +1 -1
- package/dist/preview/chunk.EUAO4QNV.js +1 -0
- package/dist/preview/{chunk.47N2G7A5.js → chunk.EXYCN4WI.js} +1 -1
- package/dist/preview/chunk.F4VB6Q2W.js +1 -0
- package/dist/preview/chunk.F7672TKJ.js +1 -0
- package/dist/preview/chunk.FA42HCPW.js +1 -0
- package/dist/preview/{chunk.DLWFULWE.js → chunk.FBILPNGH.js} +1 -1
- package/dist/preview/chunk.FBJAQPZ6.js +1 -0
- package/dist/preview/{chunk.2DH42I7L.js → chunk.FDZE5LTJ.js} +2 -2
- package/dist/preview/chunk.FFOD5B4B.js +2 -0
- package/dist/preview/{chunk.TA2JTUNX.js → chunk.FIFUMX5X.js} +1 -1
- package/dist/preview/{chunk.T4TRJDBF.js → chunk.FK722SHI.js} +1 -1
- package/dist/preview/chunk.FV72U33M.js +1 -0
- package/dist/preview/chunk.FXT5CN32.js +19 -0
- package/dist/preview/chunk.GAFMWOME.js +1 -0
- package/dist/preview/{chunk.OXFDB5BB.js → chunk.GEFXU4VO.js} +1 -1
- package/dist/preview/chunk.GG47EIKO.js +1 -0
- package/dist/preview/chunk.GME63ZHI.js +1 -0
- package/dist/preview/{chunk.PVDDSBRG.js → chunk.GNEOSHQ6.js} +1 -1
- package/dist/preview/chunk.HOCD7KIR.js +1 -0
- package/dist/preview/chunk.HSSIMVVM.js +1 -0
- package/dist/preview/{chunk.ZA5TDCBC.js → chunk.I2737CPF.js} +1 -1
- package/dist/preview/chunk.I4Z7HVRT.js +1 -0
- package/dist/preview/chunk.IAEHUSQQ.js +1 -0
- package/dist/preview/chunk.IGK7EZCX.js +1 -0
- package/dist/preview/chunk.INHS3KTK.js +1 -0
- package/dist/preview/{chunk.JHUCKEJS.js → chunk.IWYMKGZZ.js} +1 -1
- package/dist/preview/chunk.J2MM6BUW.js +1 -0
- package/dist/preview/{chunk.JOM6MFVE.js → chunk.J7W2OFHY.js} +1 -1
- package/dist/preview/chunk.JMXXA4YG.js +1 -0
- package/dist/preview/chunk.JMYUQNXN.js +6 -0
- package/dist/preview/chunk.JO2X52D4.js +1 -0
- package/dist/preview/{chunk.YEXFVDRA.js → chunk.JXNVNFV4.js} +1 -1
- package/dist/preview/chunk.K6DFXDPZ.js +1 -0
- package/dist/preview/{chunk.WPQP54FM.js → chunk.KACSYPEV.js} +1 -1
- package/dist/preview/{chunk.R5MLRKAO.js → chunk.KBPJ7X7W.js} +1 -1
- package/dist/preview/chunk.KF27ME27.js +1 -0
- package/dist/preview/{chunk.WX23K7ZU.js → chunk.KSIEO5W7.js} +1 -1
- package/dist/preview/chunk.L25DCT5S.js +1 -0
- package/dist/preview/{chunk.UDU545CL.js → chunk.LETAQTLJ.js} +1 -1
- package/dist/preview/{chunk.VZAF3452.js → chunk.LGRVEHXT.js} +2 -2
- package/dist/preview/chunk.LINSO5PN.js +1 -0
- package/dist/preview/{chunk.XJWKIXPV.js → chunk.LLIURXFP.js} +1 -1
- package/dist/preview/{chunk.BVIJXL4J.js → chunk.LSN2IPAI.js} +1 -1
- package/dist/preview/chunk.M2JCFNHJ.js +1 -0
- package/dist/preview/{chunk.B3WVCSW5.js → chunk.M5FP4Y4Q.js} +1 -1
- package/dist/preview/{chunk.YSBTE3PX.js → chunk.M6ZN2KUO.js} +1 -1
- package/dist/preview/chunk.MODLZJD4.js +25 -0
- package/dist/preview/chunk.MWGZKZD6.js +1 -0
- package/dist/preview/{chunk.2JEN2RCB.js → chunk.NJRLJEJY.js} +1 -1
- package/dist/preview/chunk.NYLKG25K.js +4 -0
- package/dist/preview/{chunk.YMXWS4XN.js → chunk.OEIWIZCP.js} +1 -1
- package/dist/preview/{chunk.DQAMVVE6.js → chunk.OJY7VJ7D.js} +1 -1
- package/dist/preview/chunk.OMT4QUZY.js +23 -0
- package/dist/preview/{chunk.Z26T5E76.js → chunk.ONYBW45K.js} +1 -1
- package/dist/preview/chunk.OO2OP76C.js +1 -0
- package/dist/preview/{chunk.UJNLT3L6.js → chunk.OOSIKCOS.js} +1 -1
- package/dist/preview/{chunk.B6JR7EQO.js → chunk.OPTYYIGC.js} +1 -1
- package/dist/preview/{chunk.TMHVYI5R.js → chunk.OTV5XTBB.js} +1 -1
- package/dist/preview/{chunk.F6BNFLQM.js → chunk.OWFS2YDQ.js} +1 -1
- package/dist/preview/{chunk.CXDGE5ZS.js → chunk.OWO3OV62.js} +1 -1
- package/dist/preview/{chunk.4VRX7FCO.js → chunk.PAGEGBUD.js} +1 -1
- package/dist/preview/{chunk.NGRL3QOI.js → chunk.PDDIQ6PK.js} +1 -1
- package/dist/preview/{chunk.OW3M4OBN.js → chunk.PFQBCHQA.js} +1 -1
- package/dist/preview/{chunk.LDMBJC3B.js → chunk.PPSYUOH7.js} +1 -1
- package/dist/preview/{chunk.GH5UBSQI.js → chunk.PSQYDCVM.js} +1 -1
- package/dist/preview/chunk.QDVGHI7R.js +1 -0
- package/dist/preview/chunk.QFHWG4LN.js +1 -0
- package/dist/preview/chunk.QGIM2WAY.js +1 -0
- package/dist/preview/chunk.QHMHUL6B.js +3 -0
- package/dist/preview/chunk.QOS5T46W.js +1 -0
- package/dist/preview/{chunk.E4TXLT25.js → chunk.QPF4KSAW.js} +1 -1
- package/dist/preview/chunk.QQAZQDRW.js +1 -0
- package/dist/preview/chunk.QU52E5RG.js +3 -0
- package/dist/preview/{chunk.REXU6ARY.js → chunk.QWNSHISU.js} +2 -2
- package/dist/preview/chunk.RSMCTI2N.js +1 -0
- package/dist/preview/chunk.RWIN3POV.js +1 -0
- package/dist/preview/chunk.SSF47GUY.js +1 -0
- package/dist/preview/chunk.T6DPWW2K.js +3 -0
- package/dist/preview/chunk.TA36WBHK.js +1 -0
- package/dist/preview/chunk.TBY5IR7C.js +1 -0
- package/dist/preview/chunk.TGEL6EUA.js +1 -0
- package/dist/preview/chunk.TTGKX7LT.js +1 -0
- package/dist/preview/chunk.TXHYGFIZ.js +1 -0
- package/dist/preview/chunk.U3ED7W2U.js +1 -0
- package/dist/preview/chunk.U3HERHAI.js +88 -0
- package/dist/preview/chunk.U6QXLNHF.js +15 -0
- package/dist/preview/{chunk.P4TAX3HE.js → chunk.U6TEW6YD.js} +1 -1
- package/dist/preview/chunk.UJPX3BUV.js +1 -0
- package/dist/preview/chunk.V5I4GZEY.js +1 -0
- package/dist/preview/{chunk.HZPRMHSL.js → chunk.V7W5AQKL.js} +1 -1
- package/dist/preview/{chunk.77MLXWZV.js → chunk.VGHO3VCB.js} +1 -1
- package/dist/preview/{chunk.YIZPW7IK.js → chunk.VKZIEZ5C.js} +2 -2
- package/dist/preview/chunk.VT2YGDK2.js +1 -0
- package/dist/preview/{chunk.XCLW4GP7.js → chunk.W4YDPHCQ.js} +1 -1
- package/dist/preview/{chunk.2TCOLAL2.js → chunk.W53YNBSM.js} +1 -1
- package/dist/preview/chunk.WAB3L3ZI.js +1 -0
- package/dist/preview/chunk.WSDJPXJD.js +1 -0
- package/dist/preview/chunk.WSO7JOW5.js +1 -0
- package/dist/preview/{chunk.4DZOAB4D.js → chunk.WVLEGCRI.js} +1 -1
- package/dist/preview/chunk.XK65Y2KX.js +1 -0
- package/dist/preview/chunk.XMQG2PSM.js +50 -0
- package/dist/preview/{chunk.WFCE7NLK.js → chunk.XOE4KNP2.js} +2 -2
- package/dist/preview/chunk.Y7QDQ3WF.js +1 -0
- package/dist/preview/chunk.YIPXZUTT.js +2 -0
- package/dist/preview/chunk.YNEHJWJV.js +2 -0
- package/dist/preview/chunk.YXEO3Y65.js +1 -0
- package/dist/preview/chunk.Z274CL7J.js +1 -0
- package/dist/preview/chunk.Z7Y3R3YR.js +3 -0
- package/dist/preview/{chunk.JS2UZYGB.js → chunk.ZBVYD4OX.js} +1 -1
- package/dist/preview/{chunk.P6FNJR6E.js → chunk.ZD7T234N.js} +1 -1
- package/dist/preview/{chunk.2G5WLG3Z.js → chunk.ZQR2SN65.js} +1 -1
- package/dist/preview/chunk.ZR2TP3BF.js +111 -0
- package/dist/preview/chunk.ZRBGYXAO.js +6 -0
- package/dist/preview/index.html +57 -55
- package/dist/preview/page.js +2 -2
- package/dist/preview/splash.js +17 -14
- package/package.json +6 -6
- package/dist/preview/chunk.2D7K2IJQ.js +0 -4
- package/dist/preview/chunk.2E62YCMZ.js +0 -1
- package/dist/preview/chunk.2HV5FF6O.js +0 -1
- package/dist/preview/chunk.2JDAUKSN.js +0 -1133
- package/dist/preview/chunk.37I45R6V.js +0 -35
- package/dist/preview/chunk.3FKKH2XU.js +0 -74
- package/dist/preview/chunk.3J7XLJP2.js +0 -1
- package/dist/preview/chunk.3L37FY3G.js +0 -4
- package/dist/preview/chunk.3OEODIHB.js +0 -1
- package/dist/preview/chunk.3RD4JHVG.js +0 -88
- package/dist/preview/chunk.3RUV4HE4.js +0 -1
- package/dist/preview/chunk.3SAESG6X.js +0 -1
- package/dist/preview/chunk.4HTB6TX2.js +0 -1
- package/dist/preview/chunk.4Q5PCMGZ.js +0 -18
- package/dist/preview/chunk.52MBXPEK.js +0 -1
- package/dist/preview/chunk.5AD2QHWH.js +0 -3
- package/dist/preview/chunk.5HJ2GTKZ.js +0 -1
- package/dist/preview/chunk.5IEZF433.js +0 -2
- package/dist/preview/chunk.5PPCK7QT.js +0 -1
- package/dist/preview/chunk.6NRWLCIZ.js +0 -5
- package/dist/preview/chunk.75JQCTR6.js +0 -1
- package/dist/preview/chunk.7AOEZJRM.js +0 -1
- package/dist/preview/chunk.7ZG77OI3.js +0 -1
- package/dist/preview/chunk.7ZHH7WBN.js +0 -1
- package/dist/preview/chunk.AJEK3I5X.js +0 -6
- package/dist/preview/chunk.APRWUIE3.js +0 -1
- package/dist/preview/chunk.ATHLE33D.js +0 -1
- package/dist/preview/chunk.B2YTHEX5.js +0 -1
- package/dist/preview/chunk.BN42H3C6.js +0 -1
- package/dist/preview/chunk.CC7P435K.js +0 -9
- package/dist/preview/chunk.CM65MCHA.js +0 -1
- package/dist/preview/chunk.DJIF7IAQ.js +0 -2
- package/dist/preview/chunk.DMENNIHT.js +0 -1
- package/dist/preview/chunk.DN7UCBOA.js +0 -1
- package/dist/preview/chunk.DVSTLVIH.js +0 -15
- package/dist/preview/chunk.DYRULRFX.js +0 -1
- package/dist/preview/chunk.FN34P4IS.js +0 -1
- package/dist/preview/chunk.FUPYIOXZ.js +0 -1
- package/dist/preview/chunk.FXRYMT3U.js +0 -1
- package/dist/preview/chunk.G5BVZLCM.js +0 -1
- package/dist/preview/chunk.G7YLK4PX.js +0 -1
- package/dist/preview/chunk.GF62K25C.js +0 -1
- package/dist/preview/chunk.GFQPO3NC.js +0 -1
- package/dist/preview/chunk.GHHKRFPD.js +0 -1
- package/dist/preview/chunk.GP5DAA4P.js +0 -3
- package/dist/preview/chunk.HPG6CNKM.js +0 -1
- package/dist/preview/chunk.HSJEOM3W.js +0 -1
- package/dist/preview/chunk.IQGSEAQ2.js +0 -5
- package/dist/preview/chunk.K2HDEL7I.js +0 -1
- package/dist/preview/chunk.K2PXP5H6.js +0 -1
- package/dist/preview/chunk.K54ISAXN.js +0 -1
- package/dist/preview/chunk.KHXRJLLU.js +0 -50
- package/dist/preview/chunk.KMIFSPGQ.js +0 -1
- package/dist/preview/chunk.L4V5VLSM.js +0 -1
- package/dist/preview/chunk.LTOQ22ZJ.js +0 -1
- package/dist/preview/chunk.M5VHUIDB.js +0 -1
- package/dist/preview/chunk.N643PVQA.js +0 -1
- package/dist/preview/chunk.NJSK3UO2.js +0 -6
- package/dist/preview/chunk.NRPBTV6O.js +0 -21
- package/dist/preview/chunk.O7HHNQK4.js +0 -2
- package/dist/preview/chunk.PR74PGLC.js +0 -1
- package/dist/preview/chunk.QROPDEJF.js +0 -1
- package/dist/preview/chunk.QRT6BZR6.js +0 -1
- package/dist/preview/chunk.RDA35HZB.js +0 -2
- package/dist/preview/chunk.S6QZBWCJ.js +0 -1
- package/dist/preview/chunk.SADHOSRC.js +0 -19
- package/dist/preview/chunk.SJHUC4TL.js +0 -1
- package/dist/preview/chunk.SL5FXE3R.js +0 -1
- package/dist/preview/chunk.T4JP6BGP.js +0 -1
- package/dist/preview/chunk.TOLW64EO.js +0 -1
- package/dist/preview/chunk.TP3PZRHE.js +0 -1
- package/dist/preview/chunk.TUR2DA2M.js +0 -1
- package/dist/preview/chunk.TYIBLD2D.js +0 -1
- package/dist/preview/chunk.UD2GGG7L.js +0 -1
- package/dist/preview/chunk.UN2IAA5R.js +0 -1
- package/dist/preview/chunk.VLX7YWVH.js +0 -25
- package/dist/preview/chunk.VT4YBFZL.js +0 -1
- package/dist/preview/chunk.WMARJ5E3.js +0 -1
- package/dist/preview/chunk.X36BYTEG.js +0 -1
- package/dist/preview/chunk.XEG7ZDRG.js +0 -1
- package/dist/preview/chunk.XQ5RTPEF.js +0 -1
- package/dist/preview/chunk.YLOGIJOH.js +0 -1
- package/dist/preview/chunk.Z4XGEV34.js +0 -1
- package/dist/preview/chunk.ZNDVJGTY.js +0 -1
- package/dist/preview/chunk.ZQGLPP7A.js +0 -1
- /package/dist/preview/{chunk.GZHZLJBF.js → chunk.MIE4TJRW.js} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
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 C,
|
|
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 C,La as K,W as k}from"./chunk.MODLZJD4.js";import{a as H}from"./chunk.SDO3U72B.js";import{b}from"./chunk.AJZBJBMO.js";var n=b(C(),1),N=450,_=10,O=t=>t instanceof HTMLInputElement?t.dataset.graviewChooseBox??void 0:void 0,q={ArrowDown:1,ArrowRight:1,ArrowUp:-1,ArrowLeft:-1,Home:-1/0,End:1/0},S=t=>t instanceof Element?t.closest("[data-graview-choose]"):null,G=t=>t instanceof HTMLElement&&(t.isContentEditable||t instanceof HTMLInputElement&&t.type!=="checkbox"||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement);function Y(t){let[i,d]=(0,n.useState)(()=>new Set),l=(0,n.useRef)(null),x=(0,n.useRef)(null),[E,P]=(0,n.useState)(null),R=E!==null&&t.includes(E)?E:t[0],L=(0,n.useMemo)(()=>t.filter(e=>i.has(e)),[t,i]),M=(0,n.useMemo)(()=>new Set(t),[t]);(0,n.useEffect)(()=>{[...i].some(e=>!M.has(e))&&d(e=>new Set([...e].filter(o=>M.has(o))))},[M,i]);let u=(0,n.useCallback)((e,o=!1)=>{let a=l.current;d(s=>{let r=new Set(s),f=a===null?-1:t.indexOf(a),y=t.indexOf(e);if(o&&f>=0&&y>=0){let T=s.has(a);for(let p of t.slice(Math.min(f,y),Math.max(f,y)+1))T?r.add(p):r.delete(p)}else r.has(e)?r.delete(e):r.add(e);return r}),l.current=e},[t]),v=(0,n.useCallback)(e=>d(new Set(e)),[]),A=(0,n.useCallback)(()=>{l.current=null,d(new Set)},[]),c=(0,n.useRef)(null),g=(0,n.useRef)(!1),m=L.length>0,h=()=>{c.current&&clearTimeout(c.current.timer),c.current=null};(0,n.useEffect)(()=>h,[]);let B={ref:x,onKeyDown:e=>{if(G(e.target))return;let o=O(e.target);if(e.key==="Tab"&&!e.shiftKey&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&o!==void 0&&m){let s=document.querySelector('[data-testid="several-bar"]'),r=s?.querySelector("[data-mutation]:not([disabled])")??s?.querySelector("button:not([disabled])");if(r){e.preventDefault(),e.stopPropagation(),r.focus();return}}let a=q[e.key];if(o!==void 0&&a!==void 0&&!e.metaKey&&!e.ctrlKey&&!e.altKey){let s=t.indexOf(o),r=t[Math.max(0,Math.min(t.length-1,s+(Number.isFinite(a)?a:a>0?t.length:-t.length)))];if(e.preventDefault(),e.stopPropagation(),r===void 0||r===o)return;if(e.shiftKey){let f=l.current!==null&&t.includes(l.current)?l.current:o,[y,T]=[t.indexOf(f),t.indexOf(r)].sort((p,F)=>p-F);d(p=>new Set([...p,...t.slice(y,T+1)])),l.current=f}P(r),x.current?.querySelector(`[data-graview-choose-box="${CSS.escape(r)}"]`)?.focus();return}if((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()==="a"){e.preventDefault(),e.stopPropagation(),v(t);return}if(e.key===" "&&!e.metaKey&&!e.ctrlKey){let s=S(e.target),r=e.target instanceof HTMLButtonElement||e.target instanceof HTMLInputElement&&e.target.type==="checkbox";if(!s||r)return;e.preventDefault(),u(s.dataset.graviewChoose,e.shiftKey)}},onFocus:e=>{let o=O(e.target);o!==void 0&&P(o)},onPointerDown:e=>{if(g.current=!1,e.pointerType==="mouse"||e.button>0)return;let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox")return;let a=o.dataset.graviewChoose;h(),c.current={id:a,x:e.clientX,y:e.clientY,timer:setTimeout(()=>{c.current=null,g.current=!0,u(a)},N)}},onPointerMove:e=>{let o=c.current;o&&Math.hypot(e.clientX-o.x,e.clientY-o.y)>_&&h()},onPointerUp:h,onPointerCancel:h,onClickCapture:e=>{let o=S(e.target);if(!o||e.target instanceof HTMLInputElement&&e.target.type==="checkbox"&&e.target.hasAttribute("data-graview-choose-box"))return;if(g.current){g.current=!1,e.preventDefault(),e.stopPropagation();return}let s=o.dataset.graviewChoose;if(e.shiftKey&&(m||l.current!==null)){e.preventDefault(),e.stopPropagation(),u(s,!0);return}m&&matchMedia?.("(pointer: coarse)").matches&&(e.preventDefault(),e.stopPropagation(),u(s))},onContextMenu:e=>{(g.current||c.current)&&(e.preventDefault(),e.stopPropagation())},...m?{"data-graview-choosing":""}:{}},j=(0,n.useCallback)(e=>i.has(e),[i]);return{chosen:L,has:j,toggle:u,choose:v,clear:A,listProps:B,boxProps:(e,o)=>({type:"checkbox",className:"graview-choose-box","data-graview-choose-box":e,"aria-label":`Choose ${o}`,tabIndex:e===R?0:-1,checked:i.has(e),onChange:()=>{},onClick:a=>{a.stopPropagation(),u(e,a.shiftKey)}}),list:x}}var $=`
|
|
2
2
|
.graview-choose-box{width:24px;height:24px;margin:0;accent-color:var(--graview-accent);cursor:pointer;opacity:0}
|
|
3
3
|
[data-graview-choose]:hover .graview-choose-box,[data-graview-choose]:focus-within .graview-choose-box,.graview-choose-box:focus-visible,.graview-choose-box:checked,[data-graview-choosing] .graview-choose-box{opacity:1}
|
|
4
4
|
[data-graview-choose]{-webkit-touch-callout:none}
|
|
5
5
|
[data-graview-choosing] [data-graview-choose]{-webkit-user-select:none;user-select:none}
|
|
6
|
-
`;var D=b(C(),1),w=b(k(),1),I=K(H(()=>(__graviewPreload(import.meta.url,["./chunk.
|
|
6
|
+
`;var D=b(C(),1),w=b(k(),1),I=K(H(()=>(__graviewPreload(import.meta.url,["./chunk.OPTYYIGC.js","./chunk.YNEHJWJV.js","./chunk.MB7LKKUD.js","./chunk.WAB3L3ZI.js","./chunk.W53YNBSM.js","./chunk.V5I4GZEY.js","./chunk.V7W5AQKL.js","./chunk.EMFOMSMI.js","./chunk.QOS5T46W.js","./chunk.GME63ZHI.js","./chunk.I2737CPF.js","./chunk.NJRLJEJY.js","./chunk.CVPMSPCH.js","./chunk.OTV5XTBB.js","./chunk.KBPJ7X7W.js","./chunk.OEIWIZCP.js","./chunk.WSDJPXJD.js","./chunk.F4VB6Q2W.js","./chunk.FFOD5B4B.js","./chunk.Z7Y3R3YR.js","./chunk.YXEO3Y65.js","./chunk.U3HERHAI.js","./chunk.FBILPNGH.js","./chunk.MODLZJD4.js","./chunk.SDO3U72B.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZQR2SN65.js")))),U=I.part((t,i)=>(0,w.jsx)(t.SeveralBar,{...i}),{what:"The selection bar"});function Q(t){return t.chosen.length===0?null:(0,w.jsx)(D.Suspense,{fallback:null,children:(0,w.jsx)(U,{...t})})}var W=()=>I.prefetch();export{Y as a,$ as b,Q as c,W as d};
|
|
@@ -0,0 +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,4 +1,4 @@
|
|
|
1
|
-
import{c as Ry}from"./chunk.
|
|
1
|
+
import{c as Ry}from"./chunk.FBILPNGH.js";import{G as Cy}from"./chunk.MODLZJD4.js";import{a as an}from"./chunk.AJZBJBMO.js";var Ti=an(J=>{"use strict";function Gf(l,a){var t=l.length;l.push(a);l:for(;0<t;){var u=t-1>>>1,n=l[u];if(0<tn(n,a))l[u]=a,l[t]=n,t=u;else break l}}function Ll(l){return l.length===0?null:l[0]}function nn(l){if(l.length===0)return null;var a=l[0],t=l.pop();if(t!==a){l[0]=t;l:for(var u=0,n=l.length,f=n>>>1;u<f;){var e=2*(u+1)-1,c=l[e],i=e+1,m=l[i];if(0>tn(c,t))i<n&&0>tn(m,c)?(l[u]=m,l[i]=t,u=i):(l[u]=c,l[e]=t,u=e);else if(i<n&&0>tn(m,t))l[u]=m,l[i]=t,u=i;else break l}}return a}function tn(l,a){var t=l.sortIndex-a.sortIndex;return t!==0?t:l.id-a.id}J.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(yi=performance,J.unstable_now=function(){return yi.now()}):(Yf=Date,mi=Yf.now(),J.unstable_now=function(){return Yf.now()-mi});var yi,Yf,mi,Il=[],Aa=[],jy=1,Bl=null,ml=3,Zf=!1,au=!1,tu=!1,Cf=!1,Si=typeof setTimeout=="function"?setTimeout:null,gi=typeof clearTimeout=="function"?clearTimeout:null,hi=typeof setImmediate<"u"?setImmediate:null;function un(l){for(var a=Ll(Aa);a!==null;){if(a.callback===null)nn(Aa);else if(a.startTime<=l)nn(Aa),a.sortIndex=a.expirationTime,Gf(Il,a);else break;a=Ll(Aa)}}function Rf(l){if(tu=!1,un(l),!au)if(Ll(Il)!==null)au=!0,ht||(ht=!0,mt());else{var a=Ll(Aa);a!==null&&jf(Rf,a.startTime-l)}}var ht=!1,uu=-1,bi=5,zi=-1;function Ai(){return Cf?!0:!(J.unstable_now()-zi<bi)}function Qf(){if(Cf=!1,ht){var l=J.unstable_now();zi=l;var a=!0;try{l:{au=!1,tu&&(tu=!1,gi(uu),uu=-1),Zf=!0;var t=ml;try{a:{for(un(l),Bl=Ll(Il);Bl!==null&&!(Bl.expirationTime>l&&Ai());){var u=Bl.callback;if(typeof u=="function"){Bl.callback=null,ml=Bl.priorityLevel;var n=u(Bl.expirationTime<=l);if(l=J.unstable_now(),typeof n=="function"){Bl.callback=n,un(l),a=!0;break a}Bl===Ll(Il)&&nn(Il),un(l)}else nn(Il);Bl=Ll(Il)}if(Bl!==null)a=!0;else{var f=Ll(Aa);f!==null&&jf(Rf,f.startTime-l),a=!1}}break l}finally{Bl=null,ml=t,Zf=!1}a=void 0}}finally{a?mt():ht=!1}}}var mt;typeof hi=="function"?mt=function(){hi(Qf)}:typeof MessageChannel<"u"?(Xf=new MessageChannel,di=Xf.port2,Xf.port1.onmessage=Qf,mt=function(){di.postMessage(null)}):mt=function(){Si(Qf,0)};var Xf,di;function jf(l,a){uu=Si(function(){l(J.unstable_now())},a)}J.unstable_IdlePriority=5;J.unstable_ImmediatePriority=1;J.unstable_LowPriority=4;J.unstable_NormalPriority=3;J.unstable_Profiling=null;J.unstable_UserBlockingPriority=2;J.unstable_cancelCallback=function(l){l.callback=null};J.unstable_forceFrameRate=function(l){0>l||125<l?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):bi=0<l?Math.floor(1e3/l):5};J.unstable_getCurrentPriorityLevel=function(){return ml};J.unstable_next=function(l){switch(ml){case 1:case 2:case 3:var a=3;break;default:a=ml}var t=ml;ml=a;try{return l()}finally{ml=t}};J.unstable_requestPaint=function(){Cf=!0};J.unstable_runWithPriority=function(l,a){switch(l){case 1:case 2:case 3:case 4:case 5:break;default:l=3}var t=ml;ml=l;try{return a()}finally{ml=t}};J.unstable_scheduleCallback=function(l,a,t){var u=J.unstable_now();switch(typeof t=="object"&&t!==null?(t=t.delay,t=typeof t=="number"&&0<t?u+t:u):t=u,l){case 1:var n=-1;break;case 2:n=250;break;case 5:n=1073741823;break;case 4:n=1e4;break;default:n=5e3}return n=t+n,l={id:jy++,callback:a,priorityLevel:l,startTime:t,expirationTime:n,sortIndex:-1},t>u?(l.sortIndex=t,Gf(Aa,l),Ll(Il)===null&&l===Ll(Aa)&&(tu?(gi(uu),uu=-1):tu=!0,jf(Rf,t-u))):(l.sortIndex=n,Gf(Il,l),au||Zf||(au=!0,ht||(ht=!0,mt()))),l};J.unstable_shouldYield=Ai;J.unstable_wrapCallback=function(l){var a=ml;return function(){var t=ml;ml=a;try{return l.apply(this,arguments)}finally{ml=t}}}});var Mi=an((dd,Ei)=>{"use strict";Ei.exports=Ti()});var Qy=an(qf=>{"use strict";var tl=Mi(),w0=Cy(),Vy=Ry();function A(l){var a="https://react.dev/errors/"+l;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var t=2;t<arguments.length;t++)a+="&args[]="+encodeURIComponent(arguments[t])}return"Minified React error #"+l+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function F0(l){return!(!l||l.nodeType!==1&&l.nodeType!==9&&l.nodeType!==11)}function Ku(l){var a=l,t=l;if(l.alternate)for(;a.return;)a=a.return;else{l=a;do a=l,(a.flags&4098)!==0&&(t=a.return),l=a.return;while(l)}return a.tag===3?t:null}function $0(l){if(l.tag===13){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function k0(l){if(l.tag===31){var a=l.memoizedState;if(a===null&&(l=l.alternate,l!==null&&(a=l.memoizedState)),a!==null)return a.dehydrated}return null}function Oi(l){if(Ku(l)!==l)throw Error(A(188))}function xy(l){var a=l.alternate;if(!a){if(a=Ku(l),a===null)throw Error(A(188));return a!==l?null:l}for(var t=l,u=a;;){var n=t.return;if(n===null)break;var f=n.alternate;if(f===null){if(u=n.return,u!==null){t=u;continue}break}if(n.child===f.child){for(f=n.child;f;){if(f===t)return Oi(n),l;if(f===u)return Oi(n),a;f=f.sibling}throw Error(A(188))}if(t.return!==u.return)t=n,u=f;else{for(var e=!1,c=n.child;c;){if(c===t){e=!0,t=n,u=f;break}if(c===u){e=!0,u=n,t=f;break}c=c.sibling}if(!e){for(c=f.child;c;){if(c===t){e=!0,t=f,u=n;break}if(c===u){e=!0,u=f,t=n;break}c=c.sibling}if(!e)throw Error(A(189))}}if(t.alternate!==u)throw Error(A(190))}if(t.tag!==3)throw Error(A(188));return t.stateNode.current===t?l:a}function I0(l){var a=l.tag;if(a===5||a===26||a===27||a===6)return l;for(l=l.child;l!==null;){if(a=I0(l),a!==null)return a;l=l.sibling}return null}var L=Object.assign,py=Symbol.for("react.element"),fn=Symbol.for("react.transitional.element"),mu=Symbol.for("react.portal"),At=Symbol.for("react.fragment"),r0=Symbol.for("react.strict_mode"),Te=Symbol.for("react.profiler"),P0=Symbol.for("react.consumer"),fa=Symbol.for("react.context"),Sc=Symbol.for("react.forward_ref"),Ee=Symbol.for("react.suspense"),Me=Symbol.for("react.suspense_list"),gc=Symbol.for("react.memo"),Ta=Symbol.for("react.lazy");Symbol.for("react.scope");var Oe=Symbol.for("react.activity");Symbol.for("react.legacy_hidden");Symbol.for("react.tracing_marker");var Ky=Symbol.for("react.memo_cache_sentinel");Symbol.for("react.view_transition");var Di=Symbol.iterator;function nu(l){return l===null||typeof l!="object"?null:(l=Di&&l[Di]||l["@@iterator"],typeof l=="function"?l:null)}var Ly=Symbol.for("react.client.reference");function De(l){if(l==null)return null;if(typeof l=="function")return l.$$typeof===Ly?null:l.displayName||l.name||null;if(typeof l=="string")return l;switch(l){case At:return"Fragment";case Te:return"Profiler";case r0:return"StrictMode";case Ee:return"Suspense";case Me:return"SuspenseList";case Oe:return"Activity"}if(typeof l=="object")switch(l.$$typeof){case mu:return"Portal";case fa:return l.displayName||"Context";case P0:return(l._context.displayName||"Context")+".Consumer";case Sc:var a=l.render;return l=l.displayName,l||(l=a.displayName||a.name||"",l=l!==""?"ForwardRef("+l+")":"ForwardRef"),l;case gc:return a=l.displayName||null,a!==null?a:De(l.type)||"Memo";case Ta:a=l._payload,l=l._init;try{return De(l(a))}catch{}}return null}var hu=Array.isArray,D=w0.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,X=Vy.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ka={pending:!1,data:null,method:null,action:null},Ue=[],Tt=-1;function $l(l){return{current:l}}function fl(l){0>Tt||(l.current=Ue[Tt],Ue[Tt]=null,Tt--)}function x(l,a){Tt++,Ue[Tt]=l.current,l.current=a}var Fl=$l(null),Nu=$l(null),Ba=$l(null),jn=$l(null);function Vn(l,a){switch(x(Ba,a),x(Nu,l),x(Fl,null),a.nodeType){case 9:case 11:l=(l=a.documentElement)&&(l=l.namespaceURI)?B0(l):0;break;default:if(l=a.tagName,a=a.namespaceURI)a=B0(a),l=Ty(a,l);else switch(l){case"svg":l=1;break;case"math":l=2;break;default:l=0}}fl(Fl),x(Fl,l)}function Ct(){fl(Fl),fl(Nu),fl(Ba)}function se(l){l.memoizedState!==null&&x(jn,l);var a=Fl.current,t=Ty(a,l.type);a!==t&&(x(Nu,l),x(Fl,t))}function xn(l){Nu.current===l&&(fl(Fl),fl(Nu)),jn.current===l&&(fl(jn),Vu._currentValue=ka)}var Vf,Ui;function Wa(l){if(Vf===void 0)try{throw Error()}catch(t){var a=t.stack.trim().match(/\n( *(at )?)/);Vf=a&&a[1]||"",Ui=-1<t.stack.indexOf(`
|
|
2
2
|
at`)?" (<anonymous>)":-1<t.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
3
|
`+Vf+l+Ui}var xf=!1;function pf(l,a){if(!l||xf)return"";xf=!0;var t=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var u={DetermineComponentFrameRoot:function(){try{if(a){var z=function(){throw Error()};if(Object.defineProperty(z.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(z,[])}catch(S){var d=S}Reflect.construct(l,[],z)}else{try{z.call()}catch(S){d=S}l.call(z.prototype)}}else{try{throw Error()}catch(S){d=S}(z=l())&&typeof z.catch=="function"&&z.catch(function(){})}}catch(S){if(S&&d&&typeof S.stack=="string")return[S.stack,d.stack]}return[null,null]}};u.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var n=Object.getOwnPropertyDescriptor(u.DetermineComponentFrameRoot,"name");n&&n.configurable&&Object.defineProperty(u.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var f=u.DetermineComponentFrameRoot(),e=f[0],c=f[1];if(e&&c){var i=e.split(`
|
|
4
4
|
`),m=c.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as K}from"./chunk.UDYFGYJP.js";import{Eb as h,Fb as v,Gc as $,Hc as N,Mb as V,h as P,k as R,oc as Y,pb as G,pc as X,q as I,sc as B,ta as q,x as _}from"./chunk.IQGSEAQ2.js";import{a as T,c as C,h as L}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var te=Symbol.for("@graview/core:markdown"),ne=500;function ie(e){let n=e;for(let i=0;i<6;i++){let t=N(n);if(!t)return!1;if(t[$]!==void 0)return t[$]===1;if(t[te]===1)return!0;if(t.type==="string")return(t.checks??[]).some(s=>{let f=N(s);return f?.check==="max_length"&&(f.maximum??0)>ne});if(t.innerType===void 0)return!1;n=t.innerType}return!1}function O(e,n,i){if(n===void 0||i==="id"||i==="kind")return!1;let t=e.tryDefinition(n)?.fields?.shape;return!!t&&Object.prototype.hasOwnProperty.call(t,i)&&ie(t[i])}var re=e=>e>=55296&&e<=56319,oe=e=>e>=56320&&e<=57343;function S(e,n){let i=Math.min(e.length,n.length),t=0;for(;t<i&&e.charCodeAt(t)===n.charCodeAt(t);)t++;t>0&&re(e.charCodeAt(t-1))&&t--;let s=0;for(;s<i-t&&e.charCodeAt(e.length-1-s)===n.charCodeAt(n.length-1-s);)s++;return s>0&&oe(e.charCodeAt(e.length-s))&&s--,{at:t,removed:e.slice(t,e.length-s),inserted:n.slice(t,n.length-s)}}var w=e=>e.at+e.removed.length;function H(e){let n=S(e.removed,e.inserted);return{...n,at:e.at+n.at}}function U(e,n,i){if(w(e)<n.at)return e;if(e.at>w(n))return{...e,at:e.at+n.inserted.length-n.removed.length};let t=Math.min(e.at,n.at),s=w(e)-w(n),f=e.removed.slice(0,n.at-t)+n.inserted+(s>0?e.removed.slice(e.removed.length-s):""),r=n.at<e.at||n.at===e.at&&i;return H({at:t,removed:f,inserted:r?n.inserted+e.inserted:e.inserted+n.inserted})}function b(e,n){return[U(e,n,!1),U(n,e,!0)]}function D(e,n){let i=e.at+e.inserted.length;if(w(n)<e.at||n.at>i)return;let t=Math.min(e.at,n.at),s=w(n)-i,f=n.removed.slice(0,e.at-t),r=s>0?n.removed.slice(n.removed.length-s):"",l=T(f+e.inserted+r,{...n,at:n.at-t});return H({at:t,removed:f+e.removed+r,inserted:l})}function M(e,n,i){switch(e.op){case"patch-node":return e.id===n&&Object.prototype.hasOwnProperty.call(e.after,i);case"add-node":case"remove-node":return e.node.id===n;default:return!1}}function j(e,n,i){if(e.op!=="patch-node"||e.id!==n||!Object.prototype.hasOwnProperty.call(e.after,i))return;let t=e.before[i],s=e.after[i];return typeof s=="string"&&(t===void 0||t===""||C(t))?{at:0,removed:"",inserted:s}:void 0}var J=(e,n,i)=>e.flatMap(t=>t.op==="splice-text"&&t.id===n&&t.field===i?[t]:[]);function E(e,n,i,t,s,f){if(typeof f!="string"||s<n-1)return;let r=[];for(let o of e)if(!(o.seq<=s))for(let p of o.primitives){let a=j(p,i,t);if(a){r.push(a);continue}if(M(p,i,t))return;p.op==="splice-text"&&p.id===i&&p.field===t&&r.push(p)}let l=f;try{for(let o=r.length-1;o>=0;o--){let p=r[o];l=T(l,{at:p.at,removed:p.inserted,inserted:p.removed})}}catch{return}return{then:l,since:r}}function A(e,n){let i=e;for(let t of n)i=b(t,i)[1];return{at:i.at,removed:i.removed,inserted:i.inserted}}function Q(e,n,i){let t=i?A(S(i.then,n),i.since):S(e,n);return t.removed===""&&t.inserted===""?void 0:t}function Z(e){let n=e.schema,i=t=>{throw new V(t,"invalid")};return{name:h,title:"Type text",input:I({node:P(),field:P(),at:R(),remove:R(),insert:P(),rev:_(R())}),subject:{kinds:"*",arg:"node"},writes:[],describe:(t,s)=>{let{node:f,field:r,insert:l,remove:o}=t;return K({node:f,field:r,inserted:[...String(l??"")].length,removed:Number(o)||0},n,s)},apply(t,s){let{node:f,field:r,at:l,remove:o,insert:p,rev:a}=s;(![l,o,a??0].every(k=>Number.isInteger(k)&&k>=-1)||l<0||o<0)&&i("at and remove are whole numbers, none below 0, and rev a revision");let d=t.graph.getNode(f);if(!d)throw new G(f,"\u201CType text\u201D names a record that is not there.");if(O(n,d.kind,r)||i(`${q(n.tryDefinition(d.kind),d.kind)}'s "${r}" is not text typed together: write it whole, as its edit does`),o===0&&p==="")return;let c=d[r];if(typeof c!="string"||c===""){t.patchNode(f,{[r]:p});return}let g=e.graph.getNode(f)?.[r],m=a===void 0?{then:c,since:[]}:E(e.log.all(),e.log.horizon,f,r,Math.max(a,-1),g);m||i(`${r} was written whole since revision ${a}: read it again and type over what it holds now`);let{then:u,since:y}=m;l+o>u.length&&i(`${r} held ${u.length} characters at revision ${a??"now"}, so there is nothing at ${l}${o>0?`\u2013${l+o}`:""} to type over`);let x=A({at:l,removed:u.slice(l,l+o),inserted:p},y);x.removed===""&&x.inserted===""||t.emit({op:"splice-text",id:f,field:r,...x})}}}function ee(e,n,i,t,s=()=>!0){let f=i===void 0?void 0:e.tryDefinition(i);if(!f||typeof t!="string")return[];let r=new Set;for(let l of n)if(!(l.name===h||!Y(e,l).includes(i)||!X(l,f).includes(t))&&s(l)){r.add(l.name);for(let o of B(e,n,l)??[])r.add(o)}return[...r]}function se(e,n,i){if(!n.some(r=>r.op==="patch-node"))return[...n];let t=new Set,s=new Set,f=[];for(let r of n){if(r.op==="add-node"&&t.add(r.node.id),r.op!=="patch-node"||t.has(r.id)){r.op==="splice-text"&&s.add(`${r.id}\0${r.field}`),f.push(r);continue}let l=e.graph.getNode(r.id),o={},p={},a=[];for(let[d,c]of Object.entries(r.after)){let g=l?.[d],m=`${r.id}\0${d}`;if(typeof c=="string"&&typeof g=="string"&&g!==""&&!s.has(m)&&O(e.schema,l?.kind,d)){let u=i?.find(x=>x.node===r.id&&x.field===d),y=Q(g,c,u?E(e.log.all(),e.log.horizon,r.id,d,u.rev,g):void 0);if(y){a.push({op:"splice-text",id:r.id,field:d,...y}),s.add(m);continue}}o[d]=r.before[d],p[d]=c,s.add(m)}Object.keys(p).length>0&&f.push(a.length>0?{op:"patch-node",id:r.id,before:o,after:p}:r),f.push(...a)}return f}function de(e,n){let i=[];return[...n].sort((t,s)=>s.seq-t.seq).map(t=>{let s=L(t);if(!s.some(o=>o.op==="splice-text"))return i.push(...s),{op:t,primitives:s};let f=e.filter(o=>o.seq>t.seq).flatMap(o=>o.primitives),r=t.primitives.length,l=[];return s.forEach((o,p)=>{if(o.op!=="splice-text")return void l.push(o);let a=A(o,J([...t.primitives.slice(r-p),...f,...i,...l],o.id,o.field));(a.removed!==""||a.inserted!=="")&&l.push({op:"splice-text",id:o.id,field:o.field,...a})}),i.push(...l),{op:t,primitives:l}})}function ae(e,n){let i=(t,s)=>e.some(f=>M(f,t,s));return n.undoes!==void 0&&n.primitives.length===0&&e.some(t=>t.op==="splice-text")||n.primitives.length>0&&n.primitives.every(t=>t.op==="splice-text"&&!i(t.id,t.field))?!0:e.flatMap(t=>t.op==="splice-text"&&n.primitives.some(s=>M(s,t.id,t.field))?[t.id]:[])}function le(e,n,i){let t=new Map,s=[],f=new Set;for(let a of e){let d=a.primitives[0],c=a.mutation?.args,g=a.mutation?.name!==h||a.primitives.length!==1||!d?void 0:d.op==="splice-text"?d:j(d,String(c?.node),String(c?.field));g?s.push({batch:a.batch,node:String(c?.node),field:String(c?.field),splice:g}):f.add(a.batch)}if(s.length===0)return t;let r=a=>`${a.node}\0${a.field}`,l=new Set,o=new Set(e.map(a=>a.batch).filter(a=>!i.includes(a))),p=s;for(let a of n){if(o.has(a.batch)){p=p.filter(d=>d.batch!==a.batch);continue}for(let d of a.primitives){if(d.op==="add-edge"||d.op==="remove-edge")continue;let c=d.op==="add-node"||d.op==="remove-node"?d.node.id:d.id;for(let g of new Set(p.filter(m=>m.node===c).map(m=>m.field))){let m=d.op==="splice-text"?d.field===g?d:void 0:j(d,c,g);for(let u of p)u.node!==c||u.field!==g||(m?[m,u.splice]=b(m,u.splice):M(d,u.node,u.field)&&l.add(r(u)))}}}p.forEach((a,d)=>{if(!o.has(a.batch))return;let c={at:a.splice.at,removed:a.splice.inserted,inserted:a.splice.removed};for(let g of p.slice(d+1))r(g)===r(a)&&([c,g.splice]=b(c,g.splice))});for(let a of i){let d=p.filter(c=>c.batch===a);d.length===0||f.has(a)||d.some(c=>l.has(r(c)))||t.set(a,d.map(c=>({name:h,args:{node:c.node,field:c.field,at:c.splice.at,remove:c.splice.removed.length,insert:c.splice.inserted}})))}return t}v.typeText=Z;v.via=ee;v.collaborative=O;v.asSplices=se;v.undone=de;v.aside=ae;v.carried=le;function Ye(e){let{store:n,author:i,pending:t,provisional:s,asked:f}=e,r=new Map,l=(o,p)=>{r.get(o)?.(p),r.delete(o)};return{store:n,apply:(o,p)=>e.appliedAll(o,{...i?{author:i}:{},...p!==void 0?{batch:p}:{}}),hold(o){t.push(o),s.add(o),e.answers.set(o,new Promise(p=>r.set(o,p)))},ask:(o,p)=>void f.set(o,{calls:p}),send(o,p){f.set(o,{calls:p});let a=e.sent(o,p),d=()=>l(o,a);return a.then(c=>{Array.isArray(c?.ops)&&c.ops.length===0&&e.letGo.add(o),d()},d),a},drop(o){e.letGo.add(o),e.settle(o),f.delete(o),e.land([],[o]),l(o)},seen:e.seen,gone:e.gone,ahead(o,p,a){let d=t.indexOf(o),c=n.log.all(),g=m=>c.some(u=>u.batch===m&&u.primitives.some(y=>y.op==="splice-text"&&y.id===p&&y.field===a||y.op==="patch-node"&&y.id===p&&a in y.after));return t.slice(0,Math.max(0,d)).flatMap(m=>{let u=e.answers.get(m);return u&&g(m)?[{batch:m,answer:u}]:[]})}}}var ce=400,pe=/[\s.,;:!?)\]}]$/u,W=e=>typeof e=="string"?e:"";function z(e,n,i,t){let s=e.log.all(),f=s.findIndex(o=>o.batch===n);if(f<0)return;let r=W(e.graph.getNode(i)?.[t]),l;for(let o=s.length-1;o>=f;o--){let p=s[o];p.batch===n&&l===void 0&&(l=r);for(let a=p.primitives.length-1;a>=0;a--){let d=p.primitives[a];d.op==="splice-text"&&d.id===i&&d.field===t?r=T(r,{at:d.at,removed:d.inserted,inserted:d.removed}):d.op==="patch-node"&&d.id===i&&t in d.after&&(r=C(d.before[t])?"":W(d.before[t]))}}if(!(l===void 0||l===r))return S(r,l)}function Xe(e,n,i){let t,s=[],f,r,l=!1,o=new Set,p=c=>({name:h,args:{node:e,field:n,at:c.at,remove:c.removed.length,insert:c.inserted,rev:i.seen()}}),a=()=>{r&&clearTimeout(r),r=void 0,t!==void 0&&s.push(t),t=void 0,d()},d=()=>{if(f!==void 0||l||i.gone())return;let c=s.shift();if(c===void 0)return;let g=i.ahead(c,e,n).filter(u=>!o.has(u.batch));if(g.length>0){s.unshift(c),l=!0,Promise.allSettled(g.map(u=>u.answer)).then(()=>{for(let u of g)o.add(u.batch);l=!1,d()});return}let m=z(i.store,c,e,n);if(!m)return i.drop(c),d();f=c,i.send(c,[p(m)]).finally(()=>{f=void 0,d()})};return{splice(c,g,m){if(i.gone())return;let u=W(i.store.graph.getNode(e)?.[n]),y={at:c,removed:u.slice(c,c+g),inserted:m};if(t!==void 0){let F=z(i.store,t,e,n);(!F||!D(F,y))&&a()}let x=i.apply([{name:h,args:{node:e,field:n,at:c,remove:g,insert:m}}],t);if(x.ops.length===0)return;t===void 0&&(t=x.batch,i.hold(t));let k=z(i.store,t,e,n);if(k&&i.ask(t,[p(k)]),pe.test(m))return a();r&&clearTimeout(r),r=setTimeout(a,ce),r.unref?.()},flush:a,waiting:()=>s.length+(t!==void 0?1:0)+(f!==void 0?1:0)}}function Be(e,n){let i=n.find(l=>l.name===h)?.args;if(typeof i?.node!="string"||typeof i.field!="string")return;let{node:t,field:s}=i,f=()=>e.graph.getNode(t)?.[s],r=f();return{node:t,field:s,yours:r,over:l=>{let o=f();return{name:h,args:{node:t,field:s,at:0,remove:typeof o=="string"?o.length:0,insert:typeof r=="string"?r:"",rev:l}}}}}export{ce as TYPING_IDLE_MS,z as runSplice,Xe as typingOf,Ye as wireOf,Be as yoursOf};
|
|
1
|
+
import{d as K}from"./chunk.B6JRTW3A.js";import{Fb as h,Gb as v,Hc as $,Ic as N,Nb as V,h as P,k as R,pc as Y,q as I,qb as G,qc as X,tc as B,ua as q,x as _}from"./chunk.6HY6ZGEE.js";import{a as T,c as C,h as L}from"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var te=Symbol.for("@graview/core:markdown"),ne=500;function ie(e){let n=e;for(let i=0;i<6;i++){let t=N(n);if(!t)return!1;if(t[$]!==void 0)return t[$]===1;if(t[te]===1)return!0;if(t.type==="string")return(t.checks??[]).some(s=>{let f=N(s);return f?.check==="max_length"&&(f.maximum??0)>ne});if(t.innerType===void 0)return!1;n=t.innerType}return!1}function O(e,n,i){if(n===void 0||i==="id"||i==="kind")return!1;let t=e.tryDefinition(n)?.fields?.shape;return!!t&&Object.prototype.hasOwnProperty.call(t,i)&&ie(t[i])}var re=e=>e>=55296&&e<=56319,oe=e=>e>=56320&&e<=57343;function S(e,n){let i=Math.min(e.length,n.length),t=0;for(;t<i&&e.charCodeAt(t)===n.charCodeAt(t);)t++;t>0&&re(e.charCodeAt(t-1))&&t--;let s=0;for(;s<i-t&&e.charCodeAt(e.length-1-s)===n.charCodeAt(n.length-1-s);)s++;return s>0&&oe(e.charCodeAt(e.length-s))&&s--,{at:t,removed:e.slice(t,e.length-s),inserted:n.slice(t,n.length-s)}}var w=e=>e.at+e.removed.length;function H(e){let n=S(e.removed,e.inserted);return{...n,at:e.at+n.at}}function U(e,n,i){if(w(e)<n.at)return e;if(e.at>w(n))return{...e,at:e.at+n.inserted.length-n.removed.length};let t=Math.min(e.at,n.at),s=w(e)-w(n),f=e.removed.slice(0,n.at-t)+n.inserted+(s>0?e.removed.slice(e.removed.length-s):""),r=n.at<e.at||n.at===e.at&&i;return H({at:t,removed:f,inserted:r?n.inserted+e.inserted:e.inserted+n.inserted})}function b(e,n){return[U(e,n,!1),U(n,e,!0)]}function D(e,n){let i=e.at+e.inserted.length;if(w(n)<e.at||n.at>i)return;let t=Math.min(e.at,n.at),s=w(n)-i,f=n.removed.slice(0,e.at-t),r=s>0?n.removed.slice(n.removed.length-s):"",l=T(f+e.inserted+r,{...n,at:n.at-t});return H({at:t,removed:f+e.removed+r,inserted:l})}function M(e,n,i){switch(e.op){case"patch-node":return e.id===n&&Object.prototype.hasOwnProperty.call(e.after,i);case"add-node":case"remove-node":return e.node.id===n;default:return!1}}function j(e,n,i){if(e.op!=="patch-node"||e.id!==n||!Object.prototype.hasOwnProperty.call(e.after,i))return;let t=e.before[i],s=e.after[i];return typeof s=="string"&&(t===void 0||t===""||C(t))?{at:0,removed:"",inserted:s}:void 0}var J=(e,n,i)=>e.flatMap(t=>t.op==="splice-text"&&t.id===n&&t.field===i?[t]:[]);function E(e,n,i,t,s,f){if(typeof f!="string"||s<n-1)return;let r=[];for(let o of e)if(!(o.seq<=s))for(let p of o.primitives){let a=j(p,i,t);if(a){r.push(a);continue}if(M(p,i,t))return;p.op==="splice-text"&&p.id===i&&p.field===t&&r.push(p)}let l=f;try{for(let o=r.length-1;o>=0;o--){let p=r[o];l=T(l,{at:p.at,removed:p.inserted,inserted:p.removed})}}catch{return}return{then:l,since:r}}function A(e,n){let i=e;for(let t of n)i=b(t,i)[1];return{at:i.at,removed:i.removed,inserted:i.inserted}}function Q(e,n,i){let t=i?A(S(i.then,n),i.since):S(e,n);return t.removed===""&&t.inserted===""?void 0:t}function Z(e){let n=e.schema,i=t=>{throw new V(t,"invalid")};return{name:h,title:"Type text",input:I({node:P(),field:P(),at:R(),remove:R(),insert:P(),rev:_(R())}),subject:{kinds:"*",arg:"node"},writes:[],describe:(t,s)=>{let{node:f,field:r,insert:l,remove:o}=t;return K({node:f,field:r,inserted:[...String(l??"")].length,removed:Number(o)||0},n,s)},apply(t,s){let{node:f,field:r,at:l,remove:o,insert:p,rev:a}=s;(![l,o,a??0].every(k=>Number.isInteger(k)&&k>=-1)||l<0||o<0)&&i("at and remove are whole numbers, none below 0, and rev a revision");let d=t.graph.getNode(f);if(!d)throw new G(f,"\u201CType text\u201D names a record that is not there.");if(O(n,d.kind,r)||i(`${q(n.tryDefinition(d.kind),d.kind)}'s "${r}" is not text typed together: write it whole, as its edit does`),o===0&&p==="")return;let c=d[r];if(typeof c!="string"||c===""){t.patchNode(f,{[r]:p});return}let g=e.graph.getNode(f)?.[r],m=a===void 0?{then:c,since:[]}:E(e.log.all(),e.log.horizon,f,r,Math.max(a,-1),g);m||i(`${r} was written whole since revision ${a}: read it again and type over what it holds now`);let{then:u,since:y}=m;l+o>u.length&&i(`${r} held ${u.length} characters at revision ${a??"now"}, so there is nothing at ${l}${o>0?`\u2013${l+o}`:""} to type over`);let x=A({at:l,removed:u.slice(l,l+o),inserted:p},y);x.removed===""&&x.inserted===""||t.emit({op:"splice-text",id:f,field:r,...x})}}}function ee(e,n,i,t,s=()=>!0){let f=i===void 0?void 0:e.tryDefinition(i);if(!f||typeof t!="string")return[];let r=new Set;for(let l of n)if(!(l.name===h||!Y(e,l).includes(i)||!X(l,f).includes(t))&&s(l)){r.add(l.name);for(let o of B(e,n,l)??[])r.add(o)}return[...r]}function se(e,n,i){if(!n.some(r=>r.op==="patch-node"))return[...n];let t=new Set,s=new Set,f=[];for(let r of n){if(r.op==="add-node"&&t.add(r.node.id),r.op!=="patch-node"||t.has(r.id)){r.op==="splice-text"&&s.add(`${r.id}\0${r.field}`),f.push(r);continue}let l=e.graph.getNode(r.id),o={},p={},a=[];for(let[d,c]of Object.entries(r.after)){let g=l?.[d],m=`${r.id}\0${d}`;if(typeof c=="string"&&typeof g=="string"&&g!==""&&!s.has(m)&&O(e.schema,l?.kind,d)){let u=i?.find(x=>x.node===r.id&&x.field===d),y=Q(g,c,u?E(e.log.all(),e.log.horizon,r.id,d,u.rev,g):void 0);if(y){a.push({op:"splice-text",id:r.id,field:d,...y}),s.add(m);continue}}o[d]=r.before[d],p[d]=c,s.add(m)}Object.keys(p).length>0&&f.push(a.length>0?{op:"patch-node",id:r.id,before:o,after:p}:r),f.push(...a)}return f}function de(e,n){let i=[];return[...n].sort((t,s)=>s.seq-t.seq).map(t=>{let s=L(t);if(!s.some(o=>o.op==="splice-text"))return i.push(...s),{op:t,primitives:s};let f=e.filter(o=>o.seq>t.seq).flatMap(o=>o.primitives),r=t.primitives.length,l=[];return s.forEach((o,p)=>{if(o.op!=="splice-text")return void l.push(o);let a=A(o,J([...t.primitives.slice(r-p),...f,...i,...l],o.id,o.field));(a.removed!==""||a.inserted!=="")&&l.push({op:"splice-text",id:o.id,field:o.field,...a})}),i.push(...l),{op:t,primitives:l}})}function ae(e,n){let i=(t,s)=>e.some(f=>M(f,t,s));return n.undoes!==void 0&&n.primitives.length===0&&e.some(t=>t.op==="splice-text")||n.primitives.length>0&&n.primitives.every(t=>t.op==="splice-text"&&!i(t.id,t.field))?!0:e.flatMap(t=>t.op==="splice-text"&&n.primitives.some(s=>M(s,t.id,t.field))?[t.id]:[])}function le(e,n,i){let t=new Map,s=[],f=new Set;for(let a of e){let d=a.primitives[0],c=a.mutation?.args,g=a.mutation?.name!==h||a.primitives.length!==1||!d?void 0:d.op==="splice-text"?d:j(d,String(c?.node),String(c?.field));g?s.push({batch:a.batch,node:String(c?.node),field:String(c?.field),splice:g}):f.add(a.batch)}if(s.length===0)return t;let r=a=>`${a.node}\0${a.field}`,l=new Set,o=new Set(e.map(a=>a.batch).filter(a=>!i.includes(a))),p=s;for(let a of n){if(o.has(a.batch)){p=p.filter(d=>d.batch!==a.batch);continue}for(let d of a.primitives){if(d.op==="add-edge"||d.op==="remove-edge")continue;let c=d.op==="add-node"||d.op==="remove-node"?d.node.id:d.id;for(let g of new Set(p.filter(m=>m.node===c).map(m=>m.field))){let m=d.op==="splice-text"?d.field===g?d:void 0:j(d,c,g);for(let u of p)u.node!==c||u.field!==g||(m?[m,u.splice]=b(m,u.splice):M(d,u.node,u.field)&&l.add(r(u)))}}}p.forEach((a,d)=>{if(!o.has(a.batch))return;let c={at:a.splice.at,removed:a.splice.inserted,inserted:a.splice.removed};for(let g of p.slice(d+1))r(g)===r(a)&&([c,g.splice]=b(c,g.splice))});for(let a of i){let d=p.filter(c=>c.batch===a);d.length===0||f.has(a)||d.some(c=>l.has(r(c)))||t.set(a,d.map(c=>({name:h,args:{node:c.node,field:c.field,at:c.splice.at,remove:c.splice.removed.length,insert:c.splice.inserted}})))}return t}v.typeText=Z;v.via=ee;v.collaborative=O;v.asSplices=se;v.undone=de;v.aside=ae;v.carried=le;function Ye(e){let{store:n,author:i,pending:t,provisional:s,asked:f}=e,r=new Map,l=(o,p)=>{r.get(o)?.(p),r.delete(o)};return{store:n,apply:(o,p)=>e.appliedAll(o,{...i?{author:i}:{},...p!==void 0?{batch:p}:{}}),hold(o){t.push(o),s.add(o),e.answers.set(o,new Promise(p=>r.set(o,p)))},ask:(o,p)=>void f.set(o,{calls:p}),send(o,p){f.set(o,{calls:p});let a=e.sent(o,p),d=()=>l(o,a);return a.then(c=>{Array.isArray(c?.ops)&&c.ops.length===0&&e.letGo.add(o),d()},d),a},drop(o){e.letGo.add(o),e.settle(o),f.delete(o),e.land([],[o]),l(o)},seen:e.seen,gone:e.gone,ahead(o,p,a){let d=t.indexOf(o),c=n.log.all(),g=m=>c.some(u=>u.batch===m&&u.primitives.some(y=>y.op==="splice-text"&&y.id===p&&y.field===a||y.op==="patch-node"&&y.id===p&&a in y.after));return t.slice(0,Math.max(0,d)).flatMap(m=>{let u=e.answers.get(m);return u&&g(m)?[{batch:m,answer:u}]:[]})}}}var ce=400,pe=/[\s.,;:!?)\]}]$/u,W=e=>typeof e=="string"?e:"";function z(e,n,i,t){let s=e.log.all(),f=s.findIndex(o=>o.batch===n);if(f<0)return;let r=W(e.graph.getNode(i)?.[t]),l;for(let o=s.length-1;o>=f;o--){let p=s[o];p.batch===n&&l===void 0&&(l=r);for(let a=p.primitives.length-1;a>=0;a--){let d=p.primitives[a];d.op==="splice-text"&&d.id===i&&d.field===t?r=T(r,{at:d.at,removed:d.inserted,inserted:d.removed}):d.op==="patch-node"&&d.id===i&&t in d.after&&(r=C(d.before[t])?"":W(d.before[t]))}}if(!(l===void 0||l===r))return S(r,l)}function Xe(e,n,i){let t,s=[],f,r,l=!1,o=new Set,p=c=>({name:h,args:{node:e,field:n,at:c.at,remove:c.removed.length,insert:c.inserted,rev:i.seen()}}),a=()=>{r&&clearTimeout(r),r=void 0,t!==void 0&&s.push(t),t=void 0,d()},d=()=>{if(f!==void 0||l||i.gone())return;let c=s.shift();if(c===void 0)return;let g=i.ahead(c,e,n).filter(u=>!o.has(u.batch));if(g.length>0){s.unshift(c),l=!0,Promise.allSettled(g.map(u=>u.answer)).then(()=>{for(let u of g)o.add(u.batch);l=!1,d()});return}let m=z(i.store,c,e,n);if(!m)return i.drop(c),d();f=c,i.send(c,[p(m)]).finally(()=>{f=void 0,d()})};return{splice(c,g,m){if(i.gone())return;let u=W(i.store.graph.getNode(e)?.[n]),y={at:c,removed:u.slice(c,c+g),inserted:m};if(t!==void 0){let F=z(i.store,t,e,n);(!F||!D(F,y))&&a()}let x=i.apply([{name:h,args:{node:e,field:n,at:c,remove:g,insert:m}}],t);if(x.ops.length===0)return;t===void 0&&(t=x.batch,i.hold(t));let k=z(i.store,t,e,n);if(k&&i.ask(t,[p(k)]),pe.test(m))return a();r&&clearTimeout(r),r=setTimeout(a,ce),r.unref?.()},flush:a,waiting:()=>s.length+(t!==void 0?1:0)+(f!==void 0?1:0)}}function Be(e,n){let i=n.find(l=>l.name===h)?.args;if(typeof i?.node!="string"||typeof i.field!="string")return;let{node:t,field:s}=i,f=()=>e.graph.getNode(t)?.[s],r=f();return{node:t,field:s,yours:r,over:l=>{let o=f();return{name:h,args:{node:t,field:s,at:0,remove:typeof o=="string"?o.length:0,insert:typeof r=="string"?r:"",rev:l}}}}}export{ce as TYPING_IDLE_MS,z as runSplice,Xe as typingOf,Ye as wireOf,Be as yoursOf};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as U,b as Y,c as G,d as D}from"./chunk.B6JRTW3A.js";import"./chunk.U3HERHAI.js";import"./chunk.FBILPNGH.js";import{G as ae,R as L,S as F,W as V,fa as _}from"./chunk.MODLZJD4.js";import"./chunk.SDO3U72B.js";import{W as H,db as K,eb as B,td as M}from"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";function O(n,t){let r=K(n);return r==="agent"?"agent":r!=="human"&&r!=="visitor"?"app":n.onBehalfOf!==void 0?"person":n.id===void 0||t?.id===void 0||n.id===t.id?"you":"person"}var re=n=>n.ops.filter(t=>t.withheld!==!0);function X(n,t={}){let r=[];for(let e of n.batches()){let s=e.ops[0],d=e.ops.at(-1),l=re(e).length===0,h=l?void 0:Y(e.ops),c=r.at(-1);if(h&&c?.typed&&c.author&&U(c.author,e.author)&&c.typed.node===h.node&&c.typed.field===h.field){let S=G(c.typed,h);r[r.length-1]={...c,seq:d.seq+1,at:d.at,batch:e.id,batches:[...c.batches??[],e.id],typed:S,said:D(S,n.schema,n.graph,!1)};continue}r.push({seq:d.seq+1,from:s.seq,at:d.at,batch:e.id,maker:l?"person":O(e.author,t.me),author:l?void 0:e.author,said:h?D(h,n.schema,n.graph,!1):e.intent,declaration:!1,withheld:l,...h?{batches:[e.id],typed:h}:{}})}let i=[...n.log.epochs().filter(e=>e.change!==void 0).map(e=>({seq:e.seq,sentence:e.change,...e.at?{at:e.at}:{}})),...t.declarations??[]];for(let e of i){if(e.seq<n.log.horizon||e.seq>n.log.length)continue;let s=r.findIndex(d=>d.seq===e.seq);if(s>=0&&!r[s].withheld){r[s]={...r[s],declaration:!0,said:e.sentence};continue}r.push({seq:e.seq,from:e.seq,at:e.at,batch:void 0,maker:e.author?O(e.author,t.me):"app",author:e.author,said:e.sentence,declaration:!0,withheld:!1})}return r.sort((e,s)=>e.seq-s.seq||+(e.batch!==void 0)-+(s.batch!==void 0))}function J(n,t){let r=n.log.all(),i=new Map(r.map(e=>[e.id,e.seq]));return n.batches().filter(e=>!e.undone&&e.ops[0].seq>=t).filter(e=>!e.ops.every(s=>s.sentOut!==void 0)).filter(e=>!e.ops.every(s=>s.undoes!==void 0&&(i.get(s.undoes)??-1)>=t)).map(e=>e.id)}function Q(n,t){return n.withheld?"Someone":n.maker==="you"?"you":n.author?B(n.author,t):"the app"}var p=R(ae(),1);var o=R(V(),1),oe={kind:"human"},ie=[1,2,4,8],se=900,E={you:"You",person:"A person",agent:"An agent",app:"The app"},Z={you:"var(--graview-accent)",person:"var(--graview-ink-muted)",agent:"var(--graview-activity, var(--graview-good))",app:"var(--graview-edge-bright)"};function de(n,t,r){return[...new Set([...r,t,...n.map(i=>i.seq)])].sort((i,e)=>i-e)}function le(n,t){let r=n.withheld===!0;return{seq:n.seq+1,from:n.seq,at:n.at,batch:n.batch,maker:r?"person":O(n.author,t),author:r?void 0:n.author,said:n.batchIntent??n.intent,declaration:!1,withheld:r}}function ce(n,t){let r=0;for(let i=0;i<n.length;i++)n[i]<=t&&(r=i);return r}function pe(n,t,r){let i=J(n,t);if(i.length===0)return null;let e=n.canUndo(i);if(!e.ok)return null;let s=new Set(n.permittedMutations(r).map(d=>d.name));return e.ops.every(d=>d.mutation!==null&&s.has(d.mutation.name))?i:null}function we({face:n}){let t=L(),r=_(),i=r?.principal??oe,e=F(t.live,i),s=e.log.length,d=(0,p.useMemo)(()=>X(e,{me:i,...t.host?.declarations?{declarations:t.host.declarations}:{}}),[e,i,t.host,s]),l=e.log.horizon,h=l>0&&t.host?.archived!==void 0,c=t.kept,S=(0,p.useMemo)(()=>h?c?.stops??Array.from({length:l},(a,g)=>g):[],[h,c,l]),m=(0,p.useMemo)(()=>de(d,l,S),[d,l,S]),f=t.archive,y=f?.seq??t.past?.seq??s,x=t.host?.kept&&(f?.behindKept||c!==void 0&&(y<=c.through||c.from>0&&y<=c.from))?t.host.kept:void 0,w=ce(m,y),b=m.length-1,j=y<l&&t.past?.seq===y?t.past.store.log.all().at(-1):void 0,q=j?le(j,i):y<l?void 0:[...d].reverse().find(a=>a.seq<=y&&a.seq>(m[w-1]??-1))??[...d].reverse().find(a=>a.seq<=y),[k,A]=(0,p.useState)(!1),[T,ee]=(0,p.useState)(1),[C,W]=(0,p.useState)(null);(0,p.useEffect)(()=>{if(!k)return;if(w>=b){A(!1);return}let a=setTimeout(()=>t.show(m[w+1]),se/T);return()=>clearTimeout(a)},[k,w,b,T,m,t]);let z=(0,p.useMemo)(()=>t.past&&!f&&y>=l?pe(e,y,i):null,[t.past,f,e,y,l,i,s]),N=a=>Q(a,{graph:e.graph,schema:e.schema,...r?.seats?{seats:r.seats}:{},...r?.people?{people:r.people}:{}}),v=t.past?t.past.at?H(t.past.at,r?.locale):"the start":null,$=f?f.refused?"The archive could not be read":f.behindKept?"Nothing this far back is kept":"Reading the older changes from the archive\u2026":q?`${N(q)==="you"?"You":N(q)}: ${q.said}`:"Nothing had happened yet",I=(0,p.useRef)(null);(0,p.useLayoutEffect)(()=>{let a=I.current,g=a?.parentElement;if(n!=="scene"||!a||!g)return;let u=()=>g.style.setProperty("--graview-sheet",`${Math.ceil(a.getBoundingClientRect().height)+24}px`);u();let P=typeof ResizeObserver>"u"?null:new ResizeObserver(u);return P?.observe(a),()=>{P?.disconnect(),g.style.removeProperty("--graview-sheet")}},[n]);let te=n==="scene"?{position:"absolute",left:"50%",bottom:12,transform:"translateX(-50%)",width:"min(720px, calc(100% - 32px))",zIndex:M("rail")}:{position:"sticky",top:0,zIndex:M("rail"),margin:"0 auto 12px",maxWidth:960,width:"100%"};return(0,o.jsxs)("section",{ref:I,"aria-label":"Timeline","data-testid":"timeline","data-graview-past":t.past?String(t.past.seq):"now","data-graview-offstage":"",style:{...te,boxSizing:"border-box",display:"grid",gap:8,padding:"10px 12px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)",color:"var(--graview-ink)",fontSize:"0.8125rem"},children:[(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"4px 12px"},children:[(0,o.jsx)("strong",{"data-testid":"as-of",role:"status",style:{fontWeight:600},children:f?"Archived changes":v?`As of ${v}`:"Now"}),(0,o.jsx)("span",{"data-testid":"timeline-caption",style:{color:"var(--graview-ink-muted)",minWidth:0,overflowWrap:"anywhere"},children:$}),v?(0,o.jsx)("span",{style:{color:"var(--graview-ink-faint)"},"data-testid":"past-read-only",children:"Nothing changes while you look back."}):null]}),(0,o.jsxs)("div",{style:{position:"relative",height:22},"aria-hidden":"true",children:[h?(0,o.jsx)("span",{"data-testid":"timeline-archived",title:"Changes read from the archive as you scrub back",style:{position:"absolute",left:0,bottom:0,height:6,width:`${b===0?0:m.indexOf(l)/b*100}%`,borderRadius:2,background:"var(--graview-edge)"}}):null,m.slice(1).map((a,g)=>{let u=[...d].reverse().find(ne=>ne.seq===a);if(!u)return null;let P=b===0?0:(g+1)/b*100;return(0,o.jsx)("span",{"data-graview-tick":a,"data-maker":u.maker,...u.declaration?{"data-declaration":""}:{},title:`${E[u.maker]}: ${u.said}`,style:{position:"absolute",left:`calc(${P}% - 1px)`,bottom:0,width:u.declaration?4:2,height:u.declaration?22:12,borderRadius:2,background:u.declaration?"var(--graview-ink)":Z[u.maker],opacity:a<=y?1:.45}},`${a}:${u.batch??"declaration"}`)})]}),(0,o.jsx)("input",{type:"range","data-testid":"scrubber","aria-label":"Moment",min:0,max:b,step:1,value:w,"aria-valuetext":v?`As of ${v}. ${$}`:`Now. ${$}`,onChange:a=>{A(!1),t.show(m[Number(a.currentTarget.value)]??s)},style:{width:"100%",margin:0,accentColor:"var(--graview-accent)"}}),(0,o.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,o.jsx)("button",{type:"button","data-testid":"play","aria-pressed":k,onClick:()=>{!k&&w>=b&&t.show(m[0]),A(!k)},style:{minHeight:28,minWidth:64},children:k?"Pause":"Play"}),(0,o.jsxs)("label",{style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--graview-ink-muted)"},children:["Speed",(0,o.jsx)("select",{"data-testid":"speed",value:T,onChange:a=>ee(Number(a.currentTarget.value)),style:{minHeight:28},children:ie.map(a=>(0,o.jsxs)("option",{value:a,children:[a,"\xD7"]},a))})]}),(0,o.jsx)("span",{"aria-hidden":"true",style:{display:"inline-flex",gap:10,color:"var(--graview-ink-faint)",flexWrap:"wrap"},children:Object.keys(E).filter(a=>d.some(g=>g.maker===a)).map(a=>(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4},children:[(0,o.jsx)("span",{style:{width:8,height:8,borderRadius:2,background:Z[a]}}),E[a]]},a))}),(0,o.jsxs)("span",{style:{marginLeft:"auto",display:"inline-flex",gap:8},children:[z?(0,o.jsx)("button",{type:"button","data-testid":"restore-here",title:"Take back every change since, as one change you can undo",onClick:()=>{W(null);try{e.undo([...z],{author:i,intent:v?`Restore to ${v}`:"Restore"}),t.show(null)}catch(a){W(a instanceof Error?a.message:String(a))}},style:{minHeight:28},children:"Restore to here"}):null,(0,o.jsx)("button",{type:"button","data-testid":"back-to-now",onClick:()=>t.show(null),style:{minHeight:28},children:"Back to now"})]})]}),C?(0,o.jsx)("span",{role:"alert","data-testid":"restore-refused",style:{color:"var(--graview-warn)"},children:C}):null,f?.refused?(0,o.jsx)("span",{role:"alert","data-testid":"archive-refused",style:{color:"var(--graview-warn)"},children:f.refused}):null,x?(0,o.jsxs)("span",{"data-testid":"timeline-kept",style:{color:"var(--graview-ink-faint)"},children:[x.sentence,x.action?(0,o.jsxs)(o.Fragment,{children:[" ",(0,o.jsx)("a",{"data-testid":"timeline-kept-action",href:x.action.href,style:{color:"var(--graview-ink-muted)"},children:x.action.label})]}):null]}):null,l>0&&!h?(0,o.jsx)("span",{"data-testid":"timeline-horizon",style:{color:"var(--graview-ink-faint)"},children:"The changes before the timeline's start were archived."}):null]})}export{we as Timeline};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var n="http://www.w3.org/1999/xhtml",u=new Set(["button","submit","reset","checkbox","radio","image"]),
|
|
1
|
+
var n="http://www.w3.org/1999/xhtml",u=new Set(["button","submit","reset","checkbox","radio","image"]),l=new Set(["button","checkbox","switch","tab","menuitem","menuitemcheckbox","menuitemradio","option","radio","slider","spinbutton","textbox","combobox","link"]),c=new Set(["div","span","section","article","aside","header","footer","figure","p","b","i","em","strong","small","mark","time","img"]),e=(t,...r)=>t.namespaceURI===n&&r.includes(t.localName),d=t=>(t.getAttribute("type")??"text").toLowerCase(),b=t=>e(t,"textarea","select")||e(t,"input")&&!u.has(d(t)),i=t=>e(t,"input","select","textarea");function f(t){return e(t,"button","summary")||e(t,"input")&&u.has(d(t))||t.localName==="a"&&t.hasAttribute("data-graview-link")}function p(t){if(e(t,"option","optgroup","datalist"))return'An option is never pressed by itself: put data-act on its select, with data-save="change", or on a button.';if(e(t,"label"))return"A press on a label presses its field too, and would ask for the act twice: put data-act on a button, or on the field.";if(b(t)&&!t.hasAttribute("data-save"))return'A click into a field to type or to pick is not a press: give it data-save ("input" or "change") to save it as it is typed, or put data-act on a button beside it.'}var g=t=>t.hasAttribute("data-act")&&p(t)===void 0&&!(i(t)&&t.hasAttribute("data-save")),h=new Set(["button","checkbox","switch","tab"]);function E(t,r=t.getAttribute("role")){return f(t)||i(t)||e(t,"label","option")||t.hasAttribute("data-graview-link")?!1:h.has(r??"")||t.hasAttribute("aria-pressed")||t.hasAttribute("aria-expanded")}function x(t){return e(t,"button","input","select","textarea","summary","iframe")||t.localName==="a"&&t.hasAttribute("href")?!0:t.hasAttribute("tabindex")||(t.getAttribute("contenteditable")??"false")!=="false"}var P=t=>!t.hasAttribute("role")&&(t.namespaceURI!==n||c.has(t.localName));function A(t){return e(t,"button","input","select","textarea","label","summary","option")||t.hasAttribute("data-act")||t.hasAttribute("data-lightbox")||t.hasAttribute("data-drop")||t.hasAttribute("data-file")||t.localName==="a"&&t.hasAttribute("href")&&!t.hasAttribute("data-record")&&!t.hasAttribute("data-place")?!0:l.has(t.getAttribute("role")??"")}function w(t,r){return!t.hasAttribute("data-record")&&!t.hasAttribute("data-place")?!1:t.localName==="a"?!0:r||i(t)||e(t,"fieldset","form","label","option")||t.localName==="graview-video"||t.hasAttribute("data-act")||t.hasAttribute("data-lightbox")||t.hasAttribute("data-drop")||t.hasAttribute("data-field")?!1:t.getAttribute("role")!=="group"}function k(t,r){if(t.localName==="a"||t.localName==="button")return!1;let s=t.getAttribute("data-record"),a=t.getAttribute("data-place");for(let o of r)if(o.localName==="a"&&(s!==null?o.getAttribute("data-record")===s:a!==null&&o.getAttribute("data-place")===a))return!0;return!1}function N(t,r,s){for(let a=t;a&&a!==r;a=a.parentElement){if(s(a))return a;if(A(a))return}}export{b as a,f as b,p as c,g as d,E as e,x as f,P as g,w as h,k as i,N as j};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{F as g,G as T,
|
|
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{F as g,G as T,La as C,W as v,fa as S}from"./chunk.MODLZJD4.js";import{a as m}from"./chunk.SDO3U72B.js";import"./chunk.6HY6ZGEE.js";import"./chunk.FQLNBIQ5.js";import{b as c}from"./chunk.AJZBJBMO.js";var n=c(T(),1),r=c(v(),1),s=null,u=null,f=new Set,a=()=>{for(let e of f)e()},y=e=>(f.add(e),()=>void f.delete(e)),E=300,d=()=>{u!==null&&clearTimeout(u),u=null};function q(e,t){d(),x.prefetch(),!(s?.element===t&&s.target.on===e.on)&&(s={target:e,element:t},a())}function M(e=!1){if(d(),s!==null){if(e){s=null,a();return}u=setTimeout(()=>{u=null,s=null,a()},E)}}var R=()=>d(),P=()=>s,b="graview:hover-chips",h;function A(e){if(h!==void 0)return h;try{return(e??localStorage).getItem(b)!=="off"}catch{return!0}}function I(e,t){h=e;try{(t??localStorage).setItem(b,e?"on":"off")}catch{}e||(s=null),a()}function w(){let e=S(),t=g(e?.ai),o=e?.memory,l=(0,n.useSyncExternalStore)(y,()=>A(o),()=>!1),i=(0,n.useCallback)(H=>I(H,o),[o]);return{offered:t,on:t&&l,set:i}}function z({legend:e,style:t,choice:o}){let l=w();return l.offered?(0,r.jsxs)("fieldset",{"data-testid":"setting-hover-chips",style:{border:0,margin:0,padding:0,display:"grid",gap:5,...t},children:[(0,r.jsx)("legend",{style:{...e,padding:0},children:"AI suggestions on hover"}),(0,r.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink-muted)"},children:"A quiet suggestion beside a record the pointer rests on, when the AI is sure of one."}),(0,r.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:4},children:[!0,!1].map(i=>(0,r.jsx)("button",{type:"button","aria-pressed":l.on===i,"data-testid":`setting-hover-chips-${i?"on":"off"}`,onClick:()=>l.set(i),style:o(l.on===i),children:i?"On":"Off"},String(i)))})]}):null}var x=C(m(()=>(__graviewPreload(import.meta.url,["./chunk.MWGZKZD6.js","./chunk.QFHWG4LN.js","./chunk.YIPXZUTT.js","./chunk.BJUUSIQY.js","./chunk.EMFOMSMI.js","./chunk.PSQYDCVM.js","./chunk.QOS5T46W.js","./chunk.PPSYUOH7.js","./chunk.XOZU4OFA.js","./chunk.GME63ZHI.js","./chunk.NJRLJEJY.js","./chunk.WSDJPXJD.js","./chunk.F4VB6Q2W.js","./chunk.FFOD5B4B.js","./chunk.Z7Y3R3YR.js","./chunk.YXEO3Y65.js","./chunk.U3HERHAI.js","./chunk.FBILPNGH.js","./chunk.MODLZJD4.js","./chunk.SDO3U72B.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.INHS3KTK.js")))),k=x.part((e,t)=>{let o=e.HoverChip;return(0,r.jsx)(o,{...t})},{quiet:!0}),p=null,O=()=>p;function L(){let{on:e}=w(),t=(0,n.useSyncExternalStore)(y,P,()=>null),[o]=(0,n.useState)(()=>Symbol("hover-chip")),l=(0,n.useSyncExternalStore)(y,O,()=>null);return(0,n.useEffect)(()=>{if(e)return p===null&&(p=o,a()),()=>{p===o&&(p=null,s=null,d(),a())}},[e,o,l]),!e||t===null||l!==o||!t.element.isConnected?null:(0,r.jsx)(n.Suspense,{fallback:null,children:(0,r.jsx)(k,{rest:t,hold:R,leave:M})})}export{L as HoverChipDoor,z as HoverChipsSwitch,R as holdRest,A as hoverChipsWanted,M as leaveRest,q as restOn,I as setHoverChipsWanted,w as useHoverChipsSetting};
|
|
@@ -0,0 +1,25 @@
|
|
|
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 et}from"./chunk.SDO3U72B.js";import{Ad as vo,Ae as jt,Cd as bo,Id as xo,N as go,Oa as mo,Od as Po,Rc as Wt,Sa as Nt,Ua as ho,ce as Eo,eb as wo,me as Ao,ne as ko,td as So,te as Ro,xe as To,ze as Qe}from"./chunk.6HY6ZGEE.js";import{a as Je,b as D}from"./chunk.AJZBJBMO.js";var $o=Je(S=>{"use strict";var Ut=Symbol.for("react.transitional.element"),bi=Symbol.for("react.portal"),xi=Symbol.for("react.fragment"),Pi=Symbol.for("react.strict_mode"),Ei=Symbol.for("react.profiler"),Ai=Symbol.for("react.consumer"),ki=Symbol.for("react.context"),Ri=Symbol.for("react.forward_ref"),Ti=Symbol.for("react.suspense"),Ci=Symbol.for("react.memo"),Go=Symbol.for("react.lazy"),Mi=Symbol.for("react.activity"),Do=Symbol.iterator;function Oi(e){return e===null||typeof e!="object"?null:(e=Do&&e[Do]||e["@@iterator"],typeof e=="function"?e:null)}var Fo={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Bo=Object.assign,Ko={};function be(e,t,n){this.props=e,this.context=t,this.refs=Ko,this.updater=n||Fo}be.prototype.isReactComponent={};be.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};be.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function qo(){}qo.prototype=be.prototype;function Yt(e,t,n){this.props=e,this.context=t,this.refs=Ko,this.updater=n||Fo}var Zt=Yt.prototype=new qo;Zt.constructor=Yt;Bo(Zt,be.prototype);Zt.isPureReactComponent=!0;var No=Array.isArray;function $t(){}var I={H:null,A:null,T:null,S:null},zo=Object.prototype.hasOwnProperty;function Xt(e,t,n){var o=n.ref;return{$$typeof:Ut,type:e,key:t,ref:o!==void 0?o:null,props:n}}function Vi(e,t){return Xt(e.type,t,e.props)}function Jt(e){return typeof e=="object"&&e!==null&&e.$$typeof===Ut}function Ii(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var Wo=/\/+/g;function zt(e,t){return typeof e=="object"&&e!==null&&e.key!=null?Ii(""+e.key):t.toString(36)}function Hi(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then($t,$t):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function ve(e,t,n,o,r){var i=typeof e;(i==="undefined"||i==="boolean")&&(e=null);var a=!1;if(e===null)a=!0;else switch(i){case"bigint":case"string":case"number":a=!0;break;case"object":switch(e.$$typeof){case Ut:case bi:a=!0;break;case Go:return a=e._init,ve(a(e._payload),t,n,o,r)}}if(a)return r=r(e),a=o===""?"."+zt(e,0):o,No(r)?(n="",a!=null&&(n=a.replace(Wo,"$&/")+"/"),ve(r,t,n,"",function(c){return c})):r!=null&&(Jt(r)&&(r=Vi(r,n+(r.key==null||e&&e.key===r.key?"":(""+r.key).replace(Wo,"$&/")+"/")+a)),t.push(r)),1;a=0;var s=o===""?".":o+":";if(No(e))for(var l=0;l<e.length;l++)o=e[l],i=s+zt(o,l),a+=ve(o,t,n,i,r);else if(l=Oi(e),typeof l=="function")for(e=l.call(e),l=0;!(o=e.next()).done;)o=o.value,i=s+zt(o,l++),a+=ve(o,t,n,i,r);else if(i==="object"){if(typeof e.then=="function")return ve(Hi(e),t,n,o,r);throw t=String(e),Error("Objects are not valid as a React child (found: "+(t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)+"). If you meant to render a collection of children, use an array instead.")}return a}function lt(e,t,n){if(e==null)return e;var o=[],r=0;return ve(e,o,"","",function(i){return t.call(n,i,r++)}),o}function Li(e){if(e._status===-1){var t=e._result;t=t(),t.then(function(n){(e._status===0||e._status===-1)&&(e._status=1,e._result=n)},function(n){(e._status===0||e._status===-1)&&(e._status=2,e._result=n)}),e._status===-1&&(e._status=0,e._result=t)}if(e._status===1)return e._result.default;throw e._result}var jo=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},_i={map:lt,forEach:function(e,t,n){lt(e,function(){t.apply(this,arguments)},n)},count:function(e){var t=0;return lt(e,function(){t++}),t},toArray:function(e){return lt(e,function(t){return t})||[]},only:function(e){if(!Jt(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};S.Activity=Mi;S.Children=_i;S.Component=be;S.Fragment=xi;S.Profiler=Ei;S.PureComponent=Yt;S.StrictMode=Pi;S.Suspense=Ti;S.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I;S.__COMPILER_RUNTIME={__proto__:null,c:function(e){return I.H.useMemoCache(e)}};S.cache=function(e){return function(){return e.apply(null,arguments)}};S.cacheSignal=function(){return null};S.cloneElement=function(e,t,n){if(e==null)throw Error("The argument must be a React element, but you passed "+e+".");var o=Bo({},e.props),r=e.key;if(t!=null)for(i in t.key!==void 0&&(r=""+t.key),t)!zo.call(t,i)||i==="key"||i==="__self"||i==="__source"||i==="ref"&&t.ref===void 0||(o[i]=t[i]);var i=arguments.length-2;if(i===1)o.children=n;else if(1<i){for(var a=Array(i),s=0;s<i;s++)a[s]=arguments[s+2];o.children=a}return Xt(e.type,r,o)};S.createContext=function(e){return e={$$typeof:ki,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null},e.Provider=e,e.Consumer={$$typeof:Ai,_context:e},e};S.createElement=function(e,t,n){var o,r={},i=null;if(t!=null)for(o in t.key!==void 0&&(i=""+t.key),t)zo.call(t,o)&&o!=="key"&&o!=="__self"&&o!=="__source"&&(r[o]=t[o]);var a=arguments.length-2;if(a===1)r.children=n;else if(1<a){for(var s=Array(a),l=0;l<a;l++)s[l]=arguments[l+2];r.children=s}if(e&&e.defaultProps)for(o in a=e.defaultProps,a)r[o]===void 0&&(r[o]=a[o]);return Xt(e,i,r)};S.createRef=function(){return{current:null}};S.forwardRef=function(e){return{$$typeof:Ri,render:e}};S.isValidElement=Jt;S.lazy=function(e){return{$$typeof:Go,_payload:{_status:-1,_result:e},_init:Li}};S.memo=function(e,t){return{$$typeof:Ci,type:e,compare:t===void 0?null:t}};S.startTransition=function(e){var t=I.T,n={};I.T=n;try{var o=e(),r=I.S;r!==null&&r(n,o),typeof o=="object"&&o!==null&&typeof o.then=="function"&&o.then($t,jo)}catch(i){jo(i)}finally{t!==null&&n.types!==null&&(t.types=n.types),I.T=t}};S.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()};S.use=function(e){return I.H.use(e)};S.useActionState=function(e,t,n){return I.H.useActionState(e,t,n)};S.useCallback=function(e,t){return I.H.useCallback(e,t)};S.useContext=function(e){return I.H.useContext(e)};S.useDebugValue=function(){};S.useDeferredValue=function(e,t){return I.H.useDeferredValue(e,t)};S.useEffect=function(e,t){return I.H.useEffect(e,t)};S.useEffectEvent=function(e){return I.H.useEffectEvent(e)};S.useId=function(){return I.H.useId()};S.useImperativeHandle=function(e,t,n){return I.H.useImperativeHandle(e,t,n)};S.useInsertionEffect=function(e,t){return I.H.useInsertionEffect(e,t)};S.useLayoutEffect=function(e,t){return I.H.useLayoutEffect(e,t)};S.useMemo=function(e,t){return I.H.useMemo(e,t)};S.useOptimistic=function(e,t){return I.H.useOptimistic(e,t)};S.useReducer=function(e,t,n){return I.H.useReducer(e,t,n)};S.useRef=function(e){return I.H.useRef(e)};S.useState=function(e){return I.H.useState(e)};S.useSyncExternalStore=function(e,t,n){return I.H.useSyncExternalStore(e,t,n)};S.useTransition=function(){return I.H.useTransition()};S.version="19.2.8"});var j=Je((Ss,Uo)=>{"use strict";Uo.exports=$o()});var ir=Je(ct=>{"use strict";var $i=Symbol.for("react.transitional.element"),Ui=Symbol.for("react.fragment");function rr(e,t,n){var o=null;if(n!==void 0&&(o=""+n),t.key!==void 0&&(o=""+t.key),"key"in t){n={};for(var r in t)r!=="key"&&(n[r]=t[r])}else n=t;return t=n.ref,{$$typeof:$i,type:e,key:o,ref:t!==void 0?t:null,props:n}}ct.Fragment=Ui;ct.jsx=rr;ct.jsxs=rr});var De=Je((Ms,ar)=>{"use strict";ar.exports=ir()});var we={focusId:null,relation:null,expanded:[],pins:{}},tt=e=>{let t=Number(e);return Number.isFinite(t)?t:null};function Y(e){let t=new URLSearchParams;e.focusId&&t.set("focus",e.focusId),e.relation&&t.set("relation",e.relation),e.overview&&t.set("overview","1"),e.zoom&&t.set("zoom","1"),e.past&&t.set("past","1"),e.shown&&e.shown.length>0&&t.set("show",[...e.shown].sort().join(",")),e.selection!==void 0&&e.selection.length>0&&t.set("sel",[...e.selection].sort().join(",")),e.expanded.length>0&&t.set("expand",[...e.expanded].sort().join(","));for(let o of Object.keys(e.pins).sort()){let r=e.pins[o];t.set(`pin.${o}`,`${nt(r.x)},${nt(r.y)}`)}e.pan&&(e.pan.x!==0||e.pan.y!==0)&&t.set("pan",`${nt(e.pan.x)},${nt(e.pan.y)}`);for(let o of Object.keys(e.within??{}).sort()){let r=e.within[o];r.length>0&&t.set(`in.${o}`,r)}e.q&&e.q.trim().length>0&&t.set("q",e.q);let n=t.toString();return n?`#${n}`:"#"}function gi(e){return e&&e.startsWith("agg:")?`aggregate:${e.slice(4)}`:e}function ot(e){let t=e.includes("#")?e.slice(e.indexOf("#")+1):e,n=new URLSearchParams(t),o=Object.create(null);for(let[f,g]of n){if(!f.startsWith("pin."))continue;let[m,b]=g.split(","),T=m===void 0?null:tt(m),y=b===void 0?null:tt(b);T===null||y===null||(o[f.slice(4)]={x:T,y})}let r=Object.create(null);for(let[f,g]of n)!f.startsWith("in.")||g.length===0||(r[f.slice(3)]=g);let i=n.get("view");i&&i.length>0&&r.view===void 0&&(r.view=i);let a=n.get("pan")?.split(",")??[],s=a[0]===void 0?null:tt(a[0]),l=a[1]===void 0?null:tt(a[1]),c=(n.get("sel")??"").split(",").filter(f=>f.length>0).sort(),u=n.get("overview")==="1";return{...c.length>0?{selection:c}:{},...u?{overview:!0}:{},...n.get("zoom")==="1"?{zoom:!0}:{},...n.get("past")==="1"?{past:!0}:{},...n.get("show")?{shown:[...new Set(n.get("show").split(",").filter(Boolean))].sort()}:{},...s!==null&&l!==null?{pan:{x:s,y:l}}:{},...Object.keys(r).length>0?{within:r}:{},...n.get("q")?.trim()?{q:n.get("q")}:{},focusId:gi(n.get("focus")),relation:n.get("relation"),expanded:(n.get("expand")??"").split(",").filter(f=>f.length>0&&(u||!f.startsWith("kind:"))).sort(),pins:o}}function ns(e){let t=ot(e);return Y(t)==="#"?{...t,overview:!0}:t}function os(e){let t=Y(e);return t==="#overview=1"?"":t}function nt(e){return Math.round(e*100)/100}function Mo(e,t){return Y(e)===Y(t)}var Co="edge:";function Oo(e){if(!e.startsWith(Co))return null;let t=e.slice(Co.length).split(":");if(t.length!==3)return null;let[n,o,r]=t;if(!n||!o||!r)return null;try{return{kind:decodeURIComponent(n),from:decodeURIComponent(o),to:decodeURIComponent(r)}}catch{return null}}function Gt(e){let{pan:t,...n}=e;return{...n,pins:{}}}function z(e,t){if(t===e.focusId)return{...e,focusId:t};let n=Gt(e);return{...n.within?.q!==void 0?ne(n,"q",null):n,focusId:t}}function Vo(e,t){return{...e,relation:t}}function ne(e,t,n){let o={...e.within??{}};if(n===null?delete o[t]:o[t]=n,Object.keys(o).length===0){let{within:r,...i}=e;return i}return{...e,within:o}}function ue(e,t){if(t!==e.overview&&(e=Gt(e)),!t){let n=e.expanded.filter(o=>!o.startsWith("kind:"));return{...e,overview:!1,expanded:n}}return{...e,overview:t}}function rt(e,t){if(t.length===0){let{selection:n,...o}=e;return o}return{...e,selection:[...t]}}function Le(e,t){if(t!==(e.zoom===!0)&&(e=Gt(e)),!t){let{zoom:n,...o}=e;return o}return{...e,zoom:!0}}function it(e,t){let n=new Set(e.expanded);return n.has(t)?n.delete(t):n.add(t),{...e,expanded:[...n].sort()}}var st="aggregate:",at="kind:";function Ft(e){return`${at}${e}`}function Se(e){return e.startsWith(at)?e.slice(at.length):null}var as="kinds:beyond";function mi(e){let t=Se(e);return t?[t]:ce(e)}function oe(...e){return`${st}${[...e].sort().join("+")}`}function Io(e){return e.startsWith(st)}function ce(e){return!Io(e)||e.includes("|")?[]:e.slice(st.length).split("+").filter(Boolean)}function Ho(e,t,n={}){let o=Se(t);if(o!==null&&e.overview&&n.ownPicture!==!0)return it(e,t);let r=o!==null?oe(o):t;if(e.zoom&&e.focusId===r&&!(o!==null&&n.carry))return Le(e,!1);if(o!==null&&n.carry){let i=ue({...z(e,r),relation:null},!1);return ne(Le(i,!0),"q",n.carry)}return Le({...z(e,r),relation:null},!0)}function hi(e,t,n){return ne(ue(z(e,oe(t)),!1),"view",n)}function ss(e,t){return e.id<t.id?-1:e.id>t.id?1:0}var Lo="aggregate:";function Bt(e){return e.startsWith(Lo)&&e.includes("|")}var Kt=e=>e?.off===!0,wi=e=>e!==void 0&&!Kt(e)&&(e.fast!==void 0||e.thinking!==void 0||e.answer!==void 0||e.decide!==void 0||e.complete!==void 0||e.turn!==void 0),_o=e=>e!==void 0&&!Kt(e)&&(e.fast!==void 0||e.decide!==void 0),Si=e=>e?.suggestOnOpen!==!1&&_o(e),vi=e=>e?.hoverChips===!0&&_o(e);var qt={};var Yo=D(j(),1),Di={turns:[],outcomes:new Map,busy:!1,pending:null,draft:null,draftNote:null},Zo=e=>`graview:seat:${e}`;function Ni(e){if(!e)return{};try{let t=sessionStorage.getItem(e);if(!t)return{};let n=JSON.parse(t);return{...Array.isArray(n.turns)?{turns:n.turns}:{},...Array.isArray(n.outcomes)?{outcomes:new Map(n.outcomes)}:{},...n.draft?.drawn?{draft:n.draft}:{}}}catch{return{}}}function Wi(e,t){if(e)try{sessionStorage.setItem(e,JSON.stringify({turns:t.turns.slice(-40),outcomes:[...t.outcomes],draft:t.draft}))}catch{}}function Qt(e){let t=e===null?null:Zo(e),n={...Di,...Ni(t)},o=new Set,r=(i,a=!0)=>{n=i,a&&Wi(t,n);for(let s of[...o])s()};return{get:()=>n,subscribe(i){return o.add(i),()=>void o.delete(i)},setTurns:i=>r({...n,turns:i(n.turns)}),settle:(i,a)=>r({...n,outcomes:new Map(n.outcomes).set(i,a)}),setBusy:i=>r({...n,busy:i},!1),ask:i=>r({...n,pending:i.trim()||null}),takePending(){let i=n.pending;return i!==null&&r({...n,pending:null},!1),i},setDraft:(i,a=null)=>r({...n,draft:i,draftNote:a})}}function ji(e){return(0,Yo.useSyncExternalStore)(e.subscribe,e.get,e.get)}var Jo=D(j(),1),Gi={entries:[],ghost:null,loaded:!1};function Xo(e,t){let n=new Map(e.map(o=>[o.id,o]));for(let o of t)n.set(o.id,{...n.get(o.id),...o});return[...n.values()].sort((o,r)=>o.at<r.at?1:o.at>r.at?-1:0)}function en(e){let t=Gi,n=new Set,o=r=>{t=r;for(let i of[...n])i()};return{get:()=>t,subscribe:r=>(n.add(r),()=>n.delete(r)),record:r=>{o({...t,entries:Xo(t.entries,[r])}),Promise.resolve(e()?.keep?.(r)).catch(i=>{console.warn("The host did not keep an AI interaction:",i)})},setGhost:r=>o({...t,ghost:r}),load:()=>{if(t.loaded)return;o({...t,loaded:!0});let r=e()?.load;r&&Promise.resolve(r()).then(i=>o({...t,entries:Xo(t.entries,i)})).catch(i=>{console.warn("The host's AI interactions could not be read:",i)})}}}function Fi(e){return(0,Jo.useSyncExternalStore)(e.subscribe,e.get,e.get)}function Qo(e){return e?.closest?.("[data-graview-pick]")?.getAttribute("data-graview-pick")??null}function xs(e,t,n,o){for(let r=e;r&&r!==t?.parentElement;r=r.parentElement){if(typeof r.querySelectorAll!="function")continue;let i=[...new Set([...r.querySelectorAll("[data-graview-pick]")].map(s=>s.getAttribute("data-graview-pick")??"").filter(s=>s!==""&&s!==o))];if(i.length===0)continue;let a=i[0];return i.slice(1).every(s=>n(a,s))?a:null}return null}var xe=D(j(),1),dt=(0,xe.createContext)(void 0),Bi=()=>(0,xe.useContext)(dt),ut=(0,xe.createContext)(void 0),Ki=()=>(0,xe.useContext)(ut);var A=D(j(),1),_e=(0,A.createContext)(null);function tr(){return(0,A.useContext)(_e)}function qi(e,t){let n=tr(),o=(0,A.useMemo)(()=>n?n.live.seenBy(t):e,[n,e,t]),r=(0,A.useRef)(0),i=(0,A.useCallback)(a=>o.subscribe(()=>{r.current+=1,a()}),[o]);return(0,A.useSyncExternalStore)(i,()=>r.current,()=>0),o}var nr=et(()=>(__graviewPreload(import.meta.url,["./chunk.YFVJUHAK.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.FC6AF6CC.js")));function tn(e){let[,t]=(0,A.useReducer)(o=>o+1,0),n=e.publishing?.mode==="on-publish"&&!vo();return(0,A.useEffect)(()=>{n&&nr().then(t,()=>{})},[n]),!n}var er,zi=400;function nn(e,t,n){let o=(0,A.useContext)(_e),r=o!==null&&o.owns(e,t),[i,a]=(0,A.useState)(null),[s,l]=(0,A.useState)(er);(0,A.useEffect)(()=>{if(s||r||i===null)return;let P=!0;return nr().then(O=>{er=O,P&&l(O)},()=>{}),()=>{P=!1}},[s,r,i]);let[c,u]=(0,A.useState)(0),[f,g]=(0,A.useMemo)(()=>r||i===null||!s?[]:[i>=e.log.length?void 0:s.askArchived(e,i,n)??s.askDeclaration(n,i),s.keptOf(e,n)],[r,e,i,n,s,c]),m=f&&"waiting"in f?f.waiting:void 0,b=f&&"seq"in f?f:null,[T,y]=(0,A.useState)(void 0);(0,A.useEffect)(()=>{if(!m)return;let P=!0,O=setTimeout(()=>P&&y(m),zi);return m.then(()=>P&&u(L=>L+1)),()=>{P=!1,clearTimeout(O)}},[m]);let w=m!==void 0&&T!==m||b!==null,v=(0,A.useMemo)(()=>{if(r||i===null||i>=e.log.length||!s||w)return null;try{let P=s.pastAt(e,i,n);return{seq:i,at:P.past?.at,store:P}}catch{return null}},[r,e,i,n,s,w,c]),k=(0,A.useRef)(null),E=w?k.current:v;(0,A.useEffect)(()=>{k.current=E},[E]);let B=(0,A.useCallback)(P=>a(P===null?null:P>=e.log.length?Number.POSITIVE_INFINITY:P),[e]),G=(0,A.useCallback)((P,O)=>[e,E?.store].some(L=>L!==void 0&&(L===P||L.seenBy(O)===P)),[e,E]),N=i!==null,H=(0,A.useMemo)(()=>({past:E,open:N,show:B,live:e,host:n,owns:G,archive:b,kept:g}),[E,N,B,e,n,G,b,g]);return r?o:H}var or=D(j(),1),on=(0,or.createContext)(null);var sr=e=>`graview:setting:${e}`;function lr(){return localStorage}function dr(e,t){try{let n=(t??lr()).getItem(sr(e.name));if(n!==null&&e.options.some(o=>o.value===n))return n}catch{}return e.initial}function ur(e,t,n){try{(n??lr()).setItem(sr(e.name),t)}catch{}}function cr(e,t){if(typeof document>"u")return;let n=document.documentElement;if(e.honored==="root-font-size"){n.style.fontSize=t===e.initial?"":t;return}let o=`graview${e.name.replace(/-([a-z0-9])/g,(r,i)=>i.toUpperCase()).replace(/^[a-z]/,r=>r.toUpperCase())}`;t===e.initial?delete n.dataset[o]:n.dataset[o]=t}var R=D(j(),1);function rn(e){return Qe(e)}var Yi=12,Zi=4;function Xi(e,t,n){let o=rn(t);return e.get(o)??{participant:o,who:t.id??t.kind,at:null,mode:"docked",since:n,trail:[]}}var pt=(e,t)=>t===null||e[e.length-1]===t?e:[...e,t].slice(-Yi);function pr(e,t){let n=e.filter(r=>r.length>0);if(n.length===0)return null;if(n.length<=Zi)return n[0];let o=new Set(n.map(r=>t(r)).filter(r=>r!==void 0));return o.size===1?Ft([...o][0]):n[0]}function an(e,t,n){let o=new Map(e);if(t.type==="rest"){for(let[a,s]of e)s.mode!=="asking"&&s.mode!=="docked"&&t.at-s.since>=t.holdMs&&o.set(a,{...s,mode:"docked",at:null,trail:[],say:void 0,confidence:void 0});return o}if(t.author.kind!=="agent")return o;let r=Xi(e,t.author,t.at),i=a=>o.set(r.participant,{...r,...a,since:t.at});switch(t.type){case"read":{let a=pr(t.ids,n);return i({at:a,mode:"reading",trail:pt(r.trail,a)}),o}case"about-to-write":case"write":{let a=pr(t.ids,n);return i({at:a,mode:"writing",trail:pt(r.trail,a),say:void 0,confidence:void 0}),o}case"refused":return i({at:t.where,mode:"refused",say:t.say,confidence:void 0,trail:pt(r.trail,t.where)}),o;case"asking":return i({at:t.where??r.at,mode:"asking",say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},trail:pt(r.trail,t.where)}),o;case"said":return i({say:t.say,...t.confidence!==void 0?{confidence:t.confidence}:{confidence:void 0},...t.caption?{caption:t.caption}:{}}),o;case"over":return i({over:t.over}),o;case"home":return i({at:null,mode:"docked",trail:[],say:void 0,confidence:void 0,over:null}),o;default:return o}}var fr="graview:session";function gr(e){let t=()=>typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);try{let n=e??sessionStorage,o=n.getItem(fr);if(o)return o;let r=t();return n.setItem(fr,r),r}catch{return t()}}var sn={name:"share-where",title:"Where you are",description:"Whether the others here see which stop you are on.",honored:"root-attribute",options:[{value:"shared",label:"Shown"},{value:"private",label:"Hidden"}],initial:"shared"},ln={name:"share-over",title:"What you point at",description:"Whether the others see the thing under your pointer, outlined in your color.",honored:"root-attribute",options:[{value:"private",label:"Kept to yourself"},{value:"shared",label:"Outlined for others"}],initial:"private"},mr=[sn,ln],yr=800;function hr(e){let{channel:t,store:n,view:o,principal:r,session:i,robots:a,seatWho:s,settingValues:l,setView:c,ttlMs:u=To,people:f,seats:g}=e,[m,b]=(0,R.useState)(()=>new Map),[T,y]=(0,R.useState)(null),[w,v]=(0,R.useState)(null),[k,E]=(0,R.useState)(null),B=typeof r.id=="string"&&r.id.length>0,G=B&&(l[sn.name]??sn.initial)==="shared",N=G&&(l[ln.name]??ln.initial)==="shared",H=rn({kind:r.kind,...r.id?{id:r.id}:{},session:i}),P=B?wo(r,{graph:n.graph,schema:n.schema,...g?{seats:g}:{},...f?{people:f}:{}}):"",O=s?a.get(`agent:${s}:${i}`):void 0,L=(0,R.useMemo)(()=>!t||!G?null:{participant:H,kind:r.kind,name:P,...r.onBehalfOf?.id?{onBehalfOf:r.onBehalfOf.id,...r.onBehalfOf.name?{onBehalfOfName:r.onBehalfOf.name}:{}}:{},hue:Wt(r.id??"nobody"),stop:k??Y(o),...N?{over:T}:{},...O?{robot:{at:O.at,mode:O.mode}}:{},at:new Date().toISOString()},[t,G,N,H,P,r.id,r.kind,r.onBehalfOf?.id,r.onBehalfOf?.name,o,k,T,O?.at,O?.mode]),je=(0,R.useRef)(null),ie=x=>x&&t?.here({...x,caret:je.current??void 0,at:new Date().toISOString()}),Ge=(0,R.useCallback)(x=>{je.current=x,ie(L)},[t,L]);(0,R.useEffect)(()=>{if(!L)return;ie(L);let x=setInterval(()=>ie(L),yr);return()=>clearInterval(x)},[t,L]),(0,R.useEffect)(()=>t?t.onWho(_=>b(jt(new Map,_,Date.now(),u))):void 0,[t,u]);let Fe=m.size>0;(0,R.useEffect)(()=>{if(!Fe)return;let x=setInterval(()=>{b(_=>{let se=jt(_,[],Date.now(),u);return se.size===_.size?_:se})},Math.max(250,Math.min(1e3,u/4)));return()=>clearInterval(x)},[Fe,u]),(0,R.useEffect)(()=>{if(!t||typeof window>"u")return;let x=()=>t.leave();return window.addEventListener("pagehide",x),()=>window.removeEventListener("pagehide",x)},[t]),(0,R.useEffect)(()=>{if(!N||typeof document>"u")return;let x=null,_=se=>{let ge=Qo(se.target);ge!==x&&(x=ge,y(ge))};return document.addEventListener("pointermove",_,{passive:!0}),()=>document.removeEventListener("pointermove",_)},[N]);let ye=(0,R.useRef)(null),J=w?m.get(w)??null:null,Re=(0,R.useCallback)(x=>{ye.current=null,v(x)},[]);(0,R.useEffect)(()=>{if(w){if(!J){v(null);return}J.stop!==ye.current?.stop&&(ye.current={stop:J.stop,at:Date.now()},c(ot(J.stop)))}},[w,J,c]),(0,R.useEffect)(()=>{let x=ye.current;!w||x===null||Date.now()-x.at<400||Mo(o,ot(x.stop))||v(null)},[o,w]),(0,R.useEffect)(()=>{if(!w||typeof document>"u")return;let x=_=>{_.key==="Escape"&&v(null)};return document.addEventListener("keydown",x),()=>document.removeEventListener("keydown",x)},[w]);let[$,At]=(0,R.useState)(null),Be=(0,R.useRef)(Y(o));Be.current=k??Y(o);let Ke=(0,R.useCallback)(x=>At(_=>(x===null&&_&&t?.alsoHere?.({..._,at:new Date().toISOString(),until:new Date().toISOString()}),x===null?null:{hue:Wt("graview"),...x,stop:Be.current,at:new Date().toISOString()})),[t]);(0,R.useEffect)(()=>{if(!$||!t?.alsoHere)return;let x=()=>t.alsoHere?.({...$,at:new Date().toISOString()});x();let _=setInterval(x,yr);return()=>clearInterval(_)},[$,t]);let qe=(0,R.useMemo)(()=>{if(!$)return m;let x=new Map(m);return x.set($.participant,{...$,at:new Date().toISOString()}),x},[m,$]),Q=L!==null,ae=(0,R.useMemo)(()=>Q?{participant:H,name:P}:null,[Q,H,P]);return(0,R.useMemo)(()=>({who:qe,aiHere:Ke,sharing:ae,following:J,follow:Re,sayWhere:E,sayCaret:Ge}),[qe,Ke,ae,J,Re,Ge])}var Z=D(j(),1);function wr(e){return Qe(e.author)}function Ji(e,t){return e.length>1?"co-edited":t==="rule"?"rule":t==="agent"?"autonomous":"directed"}function Sr(e,t,n,o,r){let i=new Map;for(let[l,c]of e)o-c.at<r&&i.set(l,c);let a=new Set(n.flatMap(l=>l.nodeIds)),s=(l,c,u)=>{let f=i.get(l),g=f?.participants.includes(wr(c))?f.participants:[...f?.participants??[],wr(c)];i.set(l,{at:o,manner:Ji(g,c.author.kind),intent:c.intent,wrote:(f?.wrote??!1)||(u.wrote??!1),read:(f?.read??!1)||(u.read??!1),broke:(f?.broke??!1)||a.has(l),participants:g})};for(let l of t){for(let c of l.writes)s(c,l,{wrote:!0});for(let c of l.reads)l.writes.includes(c)||s(c,l,{read:!0})}for(let l of n)for(let c of l.nodeIds){let u=i.get(c);i.set(c,{at:o,manner:u?.manner??"rule",intent:u?.intent??l.message,wrote:u?.wrote??!1,read:u?.read??!1,broke:!0,participants:u?.participants??["rule::"]})}return i}var Qi=2600;function vr(e,t=Qi){let[n,o]=(0,Z.useState)(()=>new Map),r=(0,Z.useRef)(n);r.current=n;let i=(0,Z.useRef)(null),a=(0,Z.useCallback)(l=>{r.current=l,o(l),i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{r.current=new Map,o(new Map)},t)},[t]);(0,Z.useEffect)(()=>{let l=e.violations(),c=e.subscribe((u,f)=>{let g=e.violations(),m=Po(e.allInvariants(),l,g).introduces;l=g,a(Sr(r.current,f,m.map(b=>({nodeIds:b.nodeIds,message:b.message})),Date.now(),t))});return()=>{c(),i.current&&clearTimeout(i.current)}},[e,t,a]);let s=(0,Z.useCallback)(l=>{l.reads.length!==0&&a(Sr(r.current,[ea(l)],[],Date.now(),t))},[t,a]);return{activity:n,noteAttention:s}}function ea(e){return{id:`attention:${e.intent}`,seq:-1,batch:"attention",author:e.author,intent:e.intent,mutation:null,primitives:[],reads:e.reads,writes:[],at:new Date().toISOString()}}var d=D(j(),1);function br(){let e=null,t=new Set,n=new Set,o=r=>{for(let i of n)i(r)};return{subscribe(r){return t.add(r),t.size===1&&o(!0),()=>{t.delete(r),t.size===0&&(e=null,o(!1))}},snapshot:()=>e,set(r){if(!(e===r||e&&r&&e.x===r.x&&e.y===r.y)){e=r;for(let i of t)i()}},get listeners(){return t.size},onActive(r){return n.add(r),()=>void n.delete(r)}}}var ft=D(j(),1),ta=e=>e.definitions.some(t=>mo(t).size>0);function xr(e,t,n){let[o,r]=(0,ft.useState)(void 0),i=(n.roles??[]).join("\0"),a=n.onBehalfOf?JSON.stringify(n.onBehalfOf):"";return(0,ft.useEffect)(()=>{if(!t||!ta(e.schema)){r(void 0);return}let s=!0,l=!1,c=e.graph,u=()=>{l||(l=!0,queueMicrotask(()=>{l=!1,s&&e.reread()}))},f=ho(t,{kind:n.kind,...n.id===void 0?{}:{id:n.id},...n.roles?{roles:n.roles}:{},...n.onBehalfOf?{onBehalfOf:n.onBehalfOf}:{}},u);return Nt(c,f.read),r(f),e.reread(),()=>{s=!1,Nt(c,void 0)}},[e,t,n.kind,n.id,i,a]),o}function Pr(){let e=!1,t=new Set;return{moving:()=>e,set(n){if(n!==e){e=n;for(let o of t)o()}},subscribe(n){return t.add(n),()=>t.delete(n)}}}var ee=D(De(),1),na="graview:place-menu",Ne=(0,d.createContext)(null),Rr=(0,d.createContext)("scene");function oa({mode:e,children:t}){return(0,ee.jsx)(Rr.Provider,{value:e,children:t})}function ra(){return(0,d.useContext)(Rr)}var Tr={kind:"human"},ia=[],aa=[],sa=[],dn=[];function Cr(e,t){let n=(0,d.useId)();(0,d.useEffect)(()=>{if(!globalThis.__graviewWatch)return;let o=t??Tr,r=()=>xo(e,o,n);r();let i,a=e.subscribe(()=>{clearTimeout(i),i=setTimeout(r,250)});return()=>{clearTimeout(i),a(),globalThis.__graviewWatch?.unseen?.({words:[],from:n,gone:!0})}},[e,t,n])}var la=()=>{try{return typeof location<"u"&&new URLSearchParams(location.search).get("as")==="published"?"published":void 0}catch{return}},da={off:!0};function ua({store:e,views:t,initialView:n,scheme:o="dark",initialSelection:r,principal:i,as:a,seats:s=ia,onSeat:l,people:c=aa,memory:u,presenceTtlMs:f,app:g,settings:m=g?.settings??sa,presence:b,typing:T,brand:y,locale:w,timeZone:v,onKeepLens:k,onProposeChange:E,composeChange:B,onDraftChange:G,providers:N,ai:H,files:P,assetsAt:O,resolveApp:L,history:je,linkedRecords:ie,menuSections:Ge,keptViews:Fe,onExport:ye,subscriptions:J,dismissals:Re,whileAway:$,notifications:At,onNotificationsSeen:Be,workflowRuns:Ke,signIn:qe,view:Q,onViewChange:ae,children:x}){let _=(0,d.useContext)(Ne),se=Ge??_?.menuSections,ge=qe??_?.signIn,kt=Ke??_?.workflowRuns,Rt=Fe??_?.keptViews,Tt=ye??_?.onExport,Ct=At??_?.notifications,Mt=Be??_?.onNotificationsSeen,[ti,ni]=(0,d.useState)(null),me=ti??i??s[0]?.principal??Tr,ze=nn(e,me,je),kn=ze.past&&ze.live===e?ze.past.store:e,Ot=a??la(),Vt=!tn(e),W=(0,d.useMemo)(()=>Vt?e:kn.seenBy(me,Ot?{as:Ot}:void 0),[Vt,e,kn,me,Ot]);Cr(e,me);let[le]=(0,d.useState)(()=>gr(u)),[Rn,oi]=(0,d.useState)(!1),Tn=(0,d.useCallback)(()=>oi(!0),[]),de=(0,d.useMemo)(()=>b?[...m,...mr]:m,[m,b]),[It]=(0,d.useState)(()=>n??fn(t,e.schema)),[ri,Cn]=(0,d.useState)(()=>rt(It??we,r??It?.selection??[])),Te=(0,d.useRef)(It??we).current,[Mn,ii]=(0,d.useState)(null),[On,ai]=(0,d.useState)(null),K=(0,d.useContext)(Ne),[Vn]=(0,d.useState)(()=>K?.seatTalk??Qt(y?.name??e.schema.kinds.join(","))),Ht=H??K?.ai??qt,$e=(0,d.useMemo)(()=>Ht.off?da:Ht,[Ht]),In=(0,d.useRef)($e.interactions);In.current=$e.interactions;let[Hn]=(0,d.useState)(()=>K?.aiDesk??en(()=>In.current)),[si]=(0,d.useState)(()=>K?.subscriptions??bo()),Ln=J??K?.subscriptions??si,Lt=k??K?.onKeepLens,_n=E??K?.onProposeChange,Dn=B??K?.composeChange,Nn=G??K?.onDraftChange,Ue=g??K?.app,Ye=w??K?.locale,li=y?.locale??Ue?.brand?.locale,Ze=v??K?.timeZone;go({reader:Ye,app:li,readerTimeZone:Ze,appTimeZone:y?.timeZone??Ue?.brand?.timeZone});let Wn=(0,d.useRef)(null),jn=(0,d.useCallback)(p=>{Wn.current=p},[]),Gn=(0,d.useCallback)(p=>Wn.current?.whereIs(p)??null,[]),[Fn]=(0,d.useState)(()=>br()),[Bn]=(0,d.useState)(()=>Pr()),[_t,di]=(0,d.useState)(null),[Ce,Kn]=(0,d.useState)(()=>new Map),Me=(0,d.useRef)(Ce);Me.current=Ce;let Oe=(0,d.useRef)(null),Dt=(0,d.useCallback)(p=>W.graph.getNode(p)?.kind,[W]),te=(0,d.useCallback)(p=>{let h=an(Me.current,p,Dt);Me.current=h,Kn(h),Oe.current&&clearTimeout(Oe.current),[...h.values()].some(V=>V.mode!=="docked"&&V.mode!=="asking")&&(Oe.current=setTimeout(()=>{let V=an(Me.current,{type:"rest",at:Date.now(),holdMs:pn},Dt);Me.current=V,Kn(V)},pn+20))},[Dt]),qn=(0,d.useCallback)(p=>te({...p,at:p.at??Date.now()}),[te]),zn=(0,d.useCallback)(p=>{di(p),p&&te({type:"home",author:{kind:"agent",id:p,session:le},at:Date.now()})},[te,le]);(0,d.useEffect)(()=>W.subscribe((p,h)=>{for(let C of h)C.author.kind==="agent"&&te({type:"write",author:C.author,ids:C.writes,at:Date.now()})}),[W,te]),(0,d.useEffect)(()=>()=>{Oe.current&&clearTimeout(Oe.current)},[]);let U=(0,d.useMemo)(()=>({...me,session:le}),[me,le]),$n=xr(W,ie,U),Un=(0,d.useCallback)(p=>{ni(p),l?.(p)},[l]),[Ve,ui]=(0,d.useState)(()=>Object.fromEntries(de.map(p=>[p.name,dr(p,u)])));(0,d.useEffect)(()=>{for(let p of de)cr(p,Ve[p.name]??p.initial)},[de,Ve]);let Yn=(0,d.useCallback)((p,h)=>{let C=de.find(V=>V.name===p);!C||!C.options.some(V=>V.value===h)||(ur(C,h,u),ui(V=>({...V,[p]:h})))},[de,u]),[Zn,ci]=(0,d.useState)(null),{activity:Xn,noteAttention:Jn}=vr(W),Qn=(0,d.useCallback)(p=>{Jn(p),te({type:"read",author:p.author,ids:p.reads,at:Date.now()})},[Jn,te]),he=(0,d.useCallback)(p=>{if(Se(p)!==null||ce(p).length>0||Bt(p))return!0;let h=Oo(p);return h?W.graph.allEdges().some(C=>C.kind===h.kind&&C.from===h.from&&C.to===h.to):W.graph.getNode(p)!==void 0},[W]),eo=(0,d.useCallback)(p=>{let h=p.selection??dn,C=h.filter(he),V=C.length===h.length?p:rt(p,C);return V.focusId!==null&&!he(V.focusId)&&(V=z(V,null)),V},[he]),Ie=(0,d.useCallback)(p=>{let h=eo(p),C=kr(W,U,h.shown);if(h.focusId!==null&&C.size>0){let V=ce(h.focusId),yo=W.graph.getNode(h.focusId);(V.length>0?V.every(yi=>C.has(yi)):yo?C.has(yo.kind):!1)&&(h={...h,focusId:null})}if(!h.overview&&h.focusId===null){let V=Te.focusId!==null&&!he(Te.focusId)?fn(t,e.schema)??{...we,overview:!0}:Te;V.focusId!==null&&he(V.focusId)?h={...h,focusId:V.focusId}:V.overview===!0&&(h={...h,overview:!0})}return h},[eo,he,W,Te,U,t,e.schema]),q=Ie(Q??ri),to=(0,d.useMemo)(()=>kr(W,U,q.shown),[W,U,q.shown]),no=(0,d.useMemo)(()=>[...W.modules.administered.entries()].map(([p,h])=>{let C=W.mayAdminister(p,U);return{name:p,...h.description?{description:h.description}:{},kinds:h.kinds??[],canShow:C,shown:C&&(q.shown??[]).includes(p)}}),[W,U,q.shown]),He=(0,d.useCallback)(p=>{let h=C=>Ie(typeof p=="function"?p(C):p);if(Q!==void 0){ae?.(h(Q));return}ae&&ae(h(q)),Cn(C=>h(C))},[q,ae,Q,Ie]);(0,d.useEffect)(()=>{Q===void 0&&Cn(p=>{let h=Ie(p);return h===p?p:h})},[q,Q,Ie]);let oo=q.selection??dn,ro=(0,d.useCallback)(p=>{He(h=>rt(h,typeof p=="function"?p(h.selection??dn):p))},[He]),{who:Xe,aiHere:io,following:ao,follow:so,sayWhere:pi,sayCaret:lo,sharing:uo}=hr({channel:b,store:W,view:q,principal:U,session:le,robots:Ce,seatWho:_t,settingValues:Ve,setView:He,seats:s,people:c,...f!==void 0?{ttlMs:f}:{}}),fi=(0,d.useMemo)(()=>({store:W,scheme:o,views:t,view:q,setView:He,homeView:Te,selection:oo,setSelection:ro,menuAt:Mn,setMenuAt:ii,whereIs:Gn,pointer:Fn,motion:Bn,registerScene:jn,robots:Ce,noteSeat:qn,seatWho:_t,registerSeatWho:zn,actsDoor:On,registerActsDoor:ai,seatTalk:Vn,aiDesk:Hn,...u?{memory:u}:{},who:Xe,aiHere:io,following:ao,follow:so,sayWhere:pi,sharing:uo,session:le,ai:$e,resolveApp:L,linkedRecords:ie,menuSections:se,...Rt?{keptViews:Rt}:{},...Tt?{onExport:Tt}:{},subscriptions:Ln,dismissals:Re,whileAway:$,...Ct?{notifications:Ct}:{},...Mt?{onNotificationsSeen:Mt}:{},...kt?{workflowRuns:kt}:{},signIn:ge,linkedReads:$n,movedByHand:Rn,noteMoved:Tn,emphasis:Zn,setEmphasis:ci,activity:Xn,noteAttention:Qn,principal:U,seats:s,people:c,takeSeat:Un,settings:de,settingValues:Ve,chooseSetting:Yn,hiddenKinds:to,administered:no,...N?{providers:N}:{},...y?{brand:y}:{},...Lt?{onKeepLens:Lt}:{},..._n?{onProposeChange:_n}:{},...Dn?{composeChange:Dn}:{},...Nn?{onDraftChange:Nn}:{},app:Ue,...Ye?{locale:Ye}:{},...Ze?{timeZone:Ze}:{}}),[W,o,t,q,He,oo,ro,Mn,Gn,Fn,Bn,jn,Ce,qn,_t,zn,On,Vn,Hn,u,Xe,io,ao,so,uo,le,$e,L,ie,se,Rt,Tt,Ln,Re,$,Ct,Mt,kt,ge,$n,Rn,Tn,Zn,Xn,Qn,U,s,c,Un,de,Ve,Yn,to,no,N,y,Lt,Ue,Ye,Ze]),co=(0,d.useMemo)(()=>T?{typing:T,sayCaret:lo,who:Xe}:null,[T,lo,Xe]),po=O?(0,ee.jsx)(ut.Provider,{value:O,children:x}):x,fo=P?(0,ee.jsx)(dt.Provider,{value:P,children:po}):po;return(0,ee.jsx)(Ne.Provider,{value:fi,children:(0,ee.jsx)(_e.Provider,{value:ze,children:(0,ee.jsx)(ga,{children:Vt?null:co?(0,ee.jsx)(on.Provider,{value:co,children:fo}):fo})})})}var Mr=(0,d.createContext)(null),un,cn=new Set,ca=e=>(cn.add(e),()=>void cn.delete(e)),Er=()=>un;function pa(e){if(!un){un=e;for(let t of[...cn])t()}}var fa=300;function ya(e){let t=0;return async(n,o)=>{let r=++t;return await new Promise(i=>setTimeout(i,fa)),r===t?e(n,o):[]}}function ga({children:e}){let{store:t,view:n,views:o,principal:r,hiddenKinds:i,selection:a,ai:s}=re(),l=yt(),c=n.q,u=n.focusId,f=!!(c&&c.trim().length>0),g=(0,d.useSyncExternalStore)(ca,Er,Er),m=(0,d.useMemo)(()=>f&&g?{flagged:new Set(t.violations().flatMap(k=>k.nodeIds)),touched:g.touchWeights(t.log.all())}:null,[t,l,f,g]),b=u?t.graph.getNode(u)?.kind??Se(u)??(ce(u).length===1?ce(u)[0]:void 0):void 0,T=(0,d.useMemo)(()=>s.near&&ya(s.near),[s.near]),y=(0,d.useMemo)(()=>!c||!m||!g?null:g.search(t,c,{...b?{inKind:b}:{},principal:r,places:o.places(),kinds:t.schema.kinds.filter(k=>!i.has(k)),from:[...a,...u&&t.graph.has(u)?[u]:[]],flagged:m.flagged,touched:m.touched,limit:200,rank:T}),[t,c,r,o,i,a,u,b,m,T]),[w,v]=(0,d.useState)();return(0,d.useEffect)(()=>void y?.later?.then(k=>v([y,k])),[y]),(0,ee.jsx)(Mr.Provider,{value:w?.[0]===y?w[1]:y,children:e})}var Ar=new WeakMap;function sl(e){let t=Ar.get(e);return t||Ar.set(e,t=new Set(e.matched)),t}function ma(){return(0,d.useContext)(Mr)}function re(){let e=(0,d.useContext)(Ne);if(!e)throw new Error("useGraview must be used inside a <GraviewProvider>.");return e}function yn(){return(0,d.useContext)(Ne)??null}function yt(){let{store:e}=re(),t=(0,d.useRef)(null),n=(0,d.useRef)(null),o=(0,d.useCallback)(()=>(n.current!==e&&(n.current=e,t.current=null),t.current??=e.graph.allNodes(),t.current),[e]),r=(0,d.useCallback)(i=>e.subscribe(()=>{t.current=null,i()}),[e]);return(0,d.useSyncExternalStore)(r,o,o)}function ha(e){let{store:t}=re(),n=(0,d.useCallback)(r=>t.subscribe(r),[t]),o=(0,d.useCallback)(()=>e===null?void 0:t.graph.getNode(e),[t,e]);return(0,d.useSyncExternalStore)(n,o,o)}function kr(e,t,n){let o=new Set(e.modules.disabledKinds);for(let r of e.kindsKeptFrom(t))o.add(r);for(let[r,i]of e.modules.administered)if(!(e.mayAdminister(r,t)&&(n??[]).includes(r)))for(let a of i.kinds??[])o.add(a);return o}var pn=2600;var Or=new WeakSet,wa=e=>Or.has(e),Sa=e=>void Or.add(e);function fn(e,t){let n=Ro(e.arrangement?.()?.first,t,e.places());if(!(!n||n.to==="home"))return n.to==="place"?{...we,focusId:oe(n.place.kind),within:{view:n.place.as}}:{...we,focusId:oe(n.kind)}}var pe=D(j(),1);var gn=D(j(),1),va=(0,gn.createContext)(null),mn=(0,gn.createContext)(null);var Vr=(0,pe.createContext)(null);function ba(){let e=(0,pe.useContext)(Vr),t=yn(),n=(0,pe.useContext)(mn),o=(i,a,s)=>t?.setView(l=>ne(ne(ue(z(l,oe(i)),!1),"view",a),"filter",s?.filter??null)),r=()=>t?.setView(i=>ne(ue(i,!0),"view",null));return(0,pe.useMemo)(()=>e??{record:i=>{t&&(t.setView(a=>z(ue(a,!1),i)),t.setSelection([i]))},place:(i,a)=>{if(i===ko)return r();if(i===Ao)return n?n.open("/"):r();let s=t?.views.places().find(l=>l.as===i);s&&o(s.kind,s.as,a)},list:(i,a)=>o(i,null,a)},[e,t,n])}var Ir=D(j(),1),xa=(0,Ir.createContext)(!1);var gt=Symbol.for("graview.default-view");function Hr(e){return Object.defineProperty(e,gt,{value:!0,enumerable:!1}),e}function Lr(e){return typeof e=="function"&&e[gt]===!0}var mt=Symbol.for("graview.replaces-page");function _r(e){return Object.defineProperty(e,mt,{value:!0,enumerable:!1}),e}function Dr(e){return typeof e=="function"&&e[mt]===!0}var ht=Symbol.for("graview.bleeds");function Nr(e){return Object.defineProperty(e,ht,{value:!0,enumerable:!1}),e}function Wr(e){return typeof e=="function"&&e[ht]===!0}var wt=Symbol.for("graview.previews");function jr(e,t={}){return Object.defineProperty(e,wt,{value:t,enumerable:!1}),e}function Gr(e){return typeof e=="function"?e[wt]:void 0}function Pa(e){return Eo(e)}function Ea(e,t){if(t===e)return e;for(let r of t.registrations())e.register(r.kind,r,r.view,r);let n=t.arrangement?.();n&&e.arrange?.(n);let o=t.homes?.()??[];if(o.length>0)for(let r of o)e.home?.(r.view,r.name!==void 0?{name:r.name}:void 0);else{let r=t.homeView?.();r&&e.home?.(r)}return e}var M=D(j(),1),X=D(De(),1),hn=new Set,St=0;function wn(e){return()=>{St+=1;let t=e();return t.then(()=>void(St-=1),()=>void(St-=1)),t}}var Aa=()=>St,bt=(0,M.createContext)(null);function ka(){return{waiting:new Map,at:0}}function Ra(e){for(let[t,n]of e.waiting)n<e.at&&e.waiting.delete(t);e.at+=1}var Ta=e=>e?.waiting.size??0;function Kr(e,t){e?.waiting.set(t,e.at)}function qr(e){let t=(0,M.useContext)(bt);(0,M.useLayoutEffect)(()=>{t?.waiting.delete(e)},[t,e])}function Ca(e){let t={},n=!1,o=new Set,r=(0,M.lazy)(wn(()=>e().then(a=>{n=!0;let s=a.default;function l(c){return qr(t),(0,M.createElement)(s,c)}return{default:l}},a=>{for(let s of o)s.waiting.delete(t);throw a})));function i(a){let s=(0,M.useContext)(bt);return!n&&s&&(o.add(s),Kr(s,t)),(0,M.createElement)(r,a)}return i}var zr=!1,$r=!1,vt=new Set;function Ma(){zr=!0}function Oa(){$r=!0;for(let e of[...vt])e();vt.clear()}var Ur=()=>$r||!zr;function Va(e){return Ur()?(e(),()=>{}):(vt.add(e),()=>void vt.delete(e))}var Fr=!1;function Sn(){for(let e of[...hn])e()}function Ia(){Fr||typeof window>"u"||(Fr=!0,window.addEventListener("online",Sn))}function vn(e){let t,n=!1,o=!1,r,i=0,a=new Set,s=()=>{i+=1;for(let g of[...a])g()},l=g=>(a.add(g),()=>void a.delete(g)),c=()=>i,u=()=>void f().catch(()=>{});function f(){if(n)return Promise.resolve(t);if(r)return r;let g=e().then(m=>(t=m,n=!0,o=!1,r=void 0,hn.delete(u),s(),m),m=>{throw r=void 0,o=!0,hn.add(u),Ia(),s(),m});return g.catch(()=>{}),r=g,g}return{load:f,prefetch:u,get current(){return t},get failed(){return o},part(g,m={}){let b=m.what??"This part",T={};function y(k){(0,M.useSyncExternalStore)(l,c,c),qr(T);let E=(0,M.useRef)(null),B=(0,M.useRef)(null),G=(0,M.useRef)(!1);return(0,M.useEffect)(()=>{o&&r===void 0&&u()},[]),n&&typeof document<"u"&&E.current!==null&&document.activeElement===E.current&&(G.current=!0),(0,M.useLayoutEffect)(()=>{if(!(!n||!G.current)){G.current=!1;for(let N=B.current?.nextElementSibling??null;N!==null;N=N.nextElementSibling){let H=N.matches(Br)?N:N.querySelector(Br);if(H instanceof HTMLElement){H.focus();return}}}}),n?(0,X.jsxs)(X.Fragment,{children:[G.current?(0,X.jsx)("span",{ref:B,hidden:!0}):null,g(t,k)]}):m.quiet?null:(0,X.jsx)(Ha,{what:b,button:E,...m.as?{as:m.as}:{}})}let w=(0,M.lazy)(wn(()=>f().then(()=>({default:y}),()=>({default:y}))));function v(k){let E=(0,M.useContext)(bt),[B]=(0,M.useState)(()=>n||o);return!n&&!o&&Kr(E,T),(0,M.createElement)(B?y:w,k)}return v}}}var Br="button,a[href],input,select,textarea,[tabindex]:not([tabindex='-1'])";function Ha({what:e,button:t,as:n="p"}){let r=typeof navigator<"u"&&navigator.onLine===!1?`${e} will load when you're back online.`:`${e} didn't load.`;return(0,X.jsxs)(n,{"data-testid":"lazy-part-missing",style:{margin:0,fontSize:"0.875rem",color:"var(--graview-ink-muted)"},children:[(0,X.jsx)("span",{role:"status",children:r})," ",(0,X.jsx)("button",{ref:t,type:"button","data-testid":"lazy-part-retry",onClick:Sn,style:{font:"inherit",fontWeight:600,color:"var(--graview-ink)",background:"none",border:"1px solid var(--graview-edge)",borderRadius:6,padding:"2px 10px"},children:"Try again"})]})}var Ee=D(j(),1);function La(){let{selection:e,setSelection:t}=re();return(0,Ee.useMemo)(()=>({selection:e,set:n=>t(n),clear:()=>t([]),toggle:n=>t(o=>o.includes(n)?o.filter(r=>r!==n):[...o,n]),isSelected:n=>e.includes(n)}),[e,t])}function _a(){let{store:e}=re(),t=yt();return(0,Ee.useMemo)(()=>Da(e),[e,t])}var Yr=new WeakMap;function Da(e){let t=Yr.get(e);if(!t){let n={violations:null};e.subscribe(()=>{n.violations=null}),Yr.set(e,n),t=n}return t.violations??=e.violations(),t.violations}function Na(){let{view:e,setView:t}=re();return(0,Ee.useMemo)(()=>({view:e,url:Y(e),focus:n=>t(o=>z(o,n)),show:n=>t(o=>Vo(o,n)),toggle:n=>t(o=>it(o,n)),go:n=>t(n)}),[e,t])}var Pe={at:0,depth:0,listeners:new Set,tell(){for(let e of this.listeners)e()}};typeof window<"u"&&window.addEventListener("popstate",e=>{let t=e.state;Pe.at=typeof t?.graview=="number"?t.graview:0,Pe.at>Pe.depth&&(Pe.depth=Pe.at),Pe.tell()});var F=D(j(),1),xn={profile:{trigger:"profile-button",pane:"profile",opens:"press",focus:"into",drawn:["shell","embed"]},problems:{trigger:"standing",pane:"problems",opens:"press",focus:"into",drawn:["shell","embed"]},places:{trigger:"app-places-open",pane:"app-places",opens:"press",focus:"into",drawn:["embed"]},here:{trigger:"here-open",pane:"here-list",opens:"press",focus:"into",drawn:["shell","embed","pages"]},"app-menu":{trigger:"app-menu-open",pane:"app-menu",opens:"press",focus:"into",drawn:["shell","embed","pages"]},inbox:{trigger:"inbox-button",pane:"inbox",opens:"press",focus:"into",drawn:["shell","embed","pages"]},share:{trigger:"app-share-open",pane:"app-share",opens:"press",focus:"into",drawn:["embed"]},"host-actions":{trigger:"host-bar-actions-open",pane:"host-bar-actions",opens:"press",focus:"into",drawn:["shell","embed"]},activity:{trigger:"activity-button",pane:"activity",opens:"press",focus:"into",drawn:["studio"]},find:{trigger:"find-box",pane:"find-strip",opens:"typing",focus:"stays",drawn:["shell"]},districts:{trigger:"beyond-more",pane:"beyond-list",opens:"press",focus:"into",drawn:["shell","embed"]},acts:{trigger:null,pane:"context-menu",opens:"context-menu",focus:"into",drawn:["shell","embed","pages"]},arrange:{trigger:"arrange-add",pane:"arrange-list",opens:"press",focus:"into",drawn:["pages"]},"studio-ask":{trigger:"studio-agent",pane:"studio-agent-panel",opens:"press",focus:"into",drawn:["studio"]}},Wa={position:"fixed",inset:"auto",margin:0,zIndex:So("popover"),boxSizing:"border-box"},xt=6,fe=8,ja=e=>typeof e.showPopover=="function";function Et(e){try{return e.matches(":popover-open")}catch{return!1}}function Ga(e){if(typeof e=="function"){let o=e();return o?{left:o.x,right:o.x,top:o.y,bottom:o.y}:null}let t=e.current;if(!t||!t.isConnected)return null;let n=t.getBoundingClientRect();return{left:n.left,right:n.right,top:n.top,bottom:n.bottom}}function Pt(e,t,n={}){let o=Ga(t);if(!o)return;let r={width:document.documentElement.clientWidth||innerWidth,height:innerHeight},i=e.dataset.graviewDesignedHeight??=e.style.maxHeight;e.style.maxHeight=i;let a=e.getBoundingClientRect(),s=r.height-o.bottom-xt-fe,l=o.top-xt-fe,c=a.height<=s||s>=l,u=Math.max(96,Math.floor(c?s:l)),f=Math.min(a.height,u);a.height>u&&(e.style.maxHeight=i?`min(${i}, ${u}px)`:`${u}px`);let g=a.width,m=n.align==="start"?o.left:o.right-g,b=typeof t=="function"?null:t.current?.closest("[data-graview-embed]")?.getBoundingClientRect();b&&g<=b.right-b.left&&(m<b.left?m=o.left+g<=b.right?o.left:b.left:m+g>b.right&&(m=o.right-g>=b.left?o.right-g:b.right-g));let T=g>=r.width-2*fe?Math.max(0,(r.width-g)/2):Math.max(fe,Math.min(m,r.width-fe-g)),y=c?o.bottom+xt:Math.max(fe,o.top-xt-f);e.style.left=`${Math.round(T)}px`,e.style.top=`${Math.round(y)}px`}function Zr(e,t,n,o={}){let r=o.align??"end";(0,F.useLayoutEffect)(()=>{let i=e.current;if(!t||!i)return;if(ja(i)&&!Et(i))try{i.showPopover(),Ba()}catch{}let a=0,s=u=>{u?.target instanceof Node&&i.contains(u.target)||(cancelAnimationFrame(a),a=requestAnimationFrame(()=>Pt(i,n,{align:r})))};Pt(i,n,{align:r});let l=()=>{let u=i.style.top;cancelAnimationFrame(a),a=requestAnimationFrame(()=>{Pt(i,n,{align:r});let f=Number.parseFloat(u);typeof n=="function"&&Number.isFinite(f)&&f+i.getBoundingClientRect().height<=innerHeight-fe&&(i.style.top=u)})};addEventListener("resize",s),addEventListener("scroll",s,!0);let c=typeof ResizeObserver>"u"?null:new ResizeObserver(()=>l());return c?.observe(i),()=>{if(cancelAnimationFrame(a),removeEventListener("resize",s),removeEventListener("scroll",s,!0),c?.disconnect(),i.isConnected&&Et(i))try{i.hidePopover()}catch{}}},[t,e,r])}var Pn=new Set;function Fa(e){return Pn.add(e),()=>Pn.delete(e)}function Ba(){for(let e of Pn)if(!(!e.isConnected||!Et(e)))try{e.hidePopover(),e.showPopover()}catch{}}var Ae=null,Ka='button:not([disabled]), [href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])';function qa(e){for(let t of e.querySelectorAll(Ka))if(t.closest("[hidden]")===null&&!t.hasAttribute("data-graview-not-first")&&getComputedStyle(t).visibility!=="hidden")return t;return e}var bn=()=>{let e=document.activeElement;return e===null||e===document.body};function za(e,t={}){let{at:n,returnTo:o,onOpenChange:r}=t,i=t.popover!==!1,[a,s]=(0,F.useState)(!1),l=t.open??a,c=(0,F.useRef)(null),u=(0,F.useRef)(null),f=(0,F.useCallback)(v=>{c.current=v},[]),g=(0,F.useCallback)(v=>{u.current=v},[]),m=`graview-popover-${(0,F.useId)().replace(/:/g,"")}`,b=(0,F.useRef)({onOpenChange:r,returnTo:o,controlled:t.open!==void 0});b.current={onOpenChange:r,returnTo:o,controlled:t.open!==void 0};let T=(0,F.useCallback)(v=>{b.current.controlled||s(v),b.current.onOpenChange?.(v)},[]),y=(0,F.useCallback)(()=>{(document.querySelector(`[aria-controls="${m}"]`)??c.current??b.current.returnTo?.()??null)?.focus({preventScroll:!0})},[m]),w=(0,F.useCallback)(v=>{let k=u.current,E=typeof document>"u"?null:document.activeElement,B=E===null||E===document.body||k!==null&&k.contains(E);T(!1),!(!v||!B)&&(y(),requestAnimationFrame(()=>{bn()&&y()}))},[T,y]);return Zr(u,i&&l,n??c,t.align?{align:t.align}:{}),(0,F.useEffect)(()=>{if(!i||!l)return;let v={name:e,close:()=>w(!1)};if(Ae&&Ae.close!==v.close&&Ae.close(),Ae=v,xn[e].focus==="into"){let H=u.current;H&&!H.contains(document.activeElement)&&qa(H).focus({preventScroll:!0})}let k=H=>{H.key==="Escape"&&w(!0)},E=H=>{let P=H.target;if(!(P instanceof Node))return;let O=u.current;if(O?.contains(P)||c.current?.contains(P))return;let L=P instanceof Element?P.closest('[role="dialog"], [role="alertdialog"]'):null;L&&!(O&&L.contains(O))||(w(!1),xn[e].focus==="into"&&requestAnimationFrame(()=>{(bn()||O!==null&&O.contains(document.activeElement))&&y()}))},B=null,G=null,N=H=>{let P=H.target;if(!(P instanceof Element))return;let O=u.current,L=P.closest('[role="dialog"], [role="alertdialog"]');!L||O&&(O.contains(L)||L.contains(O))||(B=L,w(!1))};return document.addEventListener("keydown",k),document.addEventListener("pointerdown",E,!0),document.addEventListener("focusin",N),()=>{document.removeEventListener("keydown",k),document.removeEventListener("pointerdown",E,!0),document.removeEventListener("focusin",N);let H=B;H&&typeof MutationObserver<"u"&&(G?.disconnect(),G=new MutationObserver(()=>{H.isConnected||(G?.disconnect(),requestAnimationFrame(()=>{(bn()||document.activeElement.closest("[hidden]")!==null)&&y()}))}),G.observe(document.body,{childList:!0,subtree:!0}),setTimeout(()=>G?.disconnect(),10*6e4)),Ae?.close===v.close&&(Ae=null)}},[i,l,e,w,y]),{open:l,setOpen:v=>v?T(!0):w(!0),toggle:()=>l?w(!0):T(!0),trigger:{ref:f,"aria-expanded":l,"aria-controls":m,"data-graview-popover-trigger":e},pane:{ref:g,id:m,popover:"manual",tabIndex:-1,"data-graview-popover":e,"data-graview-overlay":""}}}var ke=D(j(),1);var $a=vn(et(()=>(__graviewPreload(import.meta.url,["./chunk.MODLZJD4.js","./chunk.SDO3U72B.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BZ7QWHAE.js"))));function Ua(e,t,n){let o,r=!1,i=()=>{let{hidden:s,removed:l}=t.current();o||r||s.length+l.length===0||(o=()=>{},$a.load().then(c=>{r||(o=c.watchTidied(e,t,n))},String))};i();let a=t.onChange?.(i);return()=>{r=!0,a?.(),o?.()}}function Ya(e,t){let[n,o]=(0,ke.useState)();return(0,ke.useEffect)(()=>t?Ua(e,t,r=>o([e,r])):void 0,[e,t]),n?.[0]===e?n[1]:e}var Xr=D(j(),1),Za=(0,Xr.createContext)(!1);var Jr=D(j(),1),Xa=(0,Jr.createContext)(null);var Qr=D(j(),1),En='button:not([disabled]), a[href], input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, [tabindex]:not([tabindex="-1"])',An=e=>e instanceof HTMLElement&&(e.matches(En)||e.hasAttribute("tabindex")),We=e=>typeof e.checkVisibility=="function"?e.checkVisibility():e.getClientRects().length>0;function Ja(e,t){let n=l=>l.replace(/["\\]/g,"\\$&"),o=t.getAttribute("data-testid"),r=t.getAttribute("data-graview-pick"),i=t.getAttribute("aria-label"),a=o?`[data-testid="${n(o)}"]`:r?`[data-graview-pick="${n(r)}"]`:i?`${t.tagName.toLowerCase()}[aria-label="${n(i)}"]`:null;if(!a)return null;let s=e.querySelector(a);return s&&An(s)&&We(s)?s:null}var Qa=e=>e.isConnected&&An(e)&&!e.matches(":disabled")&&e instanceof HTMLElement&&We(e);function ei(e,t){let n=t?Ja(e,t):null;if(n)return n;let o=e.querySelector("[data-graview-view][tabindex]");if(o&&We(o))return o;for(let r of e.querySelectorAll(En))if(We(r))return r;return An(e)&&We(e)?e:null}function es(e){(0,Qr.useEffect)(()=>{let t=e.current;if(!t||typeof MutationObserver>"u")return;let n=[],o=y=>{let w=y.target;if(w instanceof Element){n=[];for(let v=w;v&&v!==t.parentElement;v=v.parentElement)n.push(v)}},r=!1,i=!1,a=t.ownerDocument,s=()=>!i&&a.defaultView!==null,l=(y,w)=>void setTimeout(()=>s()&&w(),y),c=y=>void requestAnimationFrame(()=>s()&&y()),u=y=>{if(r=!1,i)return;let w=a.activeElement;if(!(!(w===null||w===a.body||w===a.documentElement)||n.length===0)){if(Qa(n[0])){y&&n[0]instanceof HTMLElement&&n[0].focus({preventScroll:!0});return}for(let k of n.slice(1)){if(!k.isConnected)continue;let E=ei(k,n[0]);if(E){E.focus({preventScroll:!0}),n=[];return}}}},f=(y,w=Date.now()+2500)=>{l(100,()=>{u(y);let v=a.activeElement;(v===null||v===a.body||v===a.documentElement)&&n.length>0&&Date.now()<w&&f(y,w)})},g=()=>{r||n.length===0||(r=!0,l(60,()=>c(()=>{u(!1),f(!1)})))},m=y=>{if(!(y instanceof KeyboardEvent&&!["Enter"," ","Escape"].includes(y.key))){if(!(y instanceof KeyboardEvent)){let w=y.target instanceof Element?y.target.closest(En):null,v=a.activeElement,k=v===null||v===a.body||v===a.documentElement;if(w&&k&&t.contains(w)){n=[];for(let E=w;E&&E!==t.parentElement;E=E.parentElement)n.push(E);l(150,()=>c(()=>{u(!1),f(!1)}));return}}!(y instanceof KeyboardEvent)&&!(y.target instanceof Node&&n[0]?.contains(y.target))||l(150,()=>c(()=>{u(!0),f(!0)}))}},b=new MutationObserver(()=>{n.length>0&&!n[0].isConnected&&g()}),T=y=>{y.relatedTarget===null&&g()};return t.addEventListener("focusin",o),t.addEventListener("focusout",T),t.addEventListener("click",m),t.addEventListener("keydown",m),b.observe(t,{childList:!0,subtree:!0}),()=>{i=!0,t.removeEventListener("focusin",o),t.removeEventListener("focusout",T),t.removeEventListener("click",m),t.removeEventListener("keydown",m),b.disconnect()}},[e])}export{we as a,Y as b,ot as c,ns as d,os as e,Mo as f,Co as g,Oo as h,Gt as i,z as j,Vo as k,ne as l,ue as m,rt as n,Le as o,it as p,st as q,Ft as r,Se as s,as as t,mi as u,oe as v,Io as w,ce as x,Ho as y,hi as z,ss as A,Lo as B,Bt as C,wi as D,Si as E,vi as F,j as G,Qt as H,ji as I,Fi as J,Qo as K,xs as L,dt as M,Bi as N,ut as O,Ki as P,_e as Q,tr as R,qi as S,tn as T,nn as U,on as V,De as W,na as X,Ne as Y,oa as Z,ra as _,Cr as $,ua as aa,pa as ba,sl as ca,ma as da,re as ea,yn as fa,yt as ga,ha,wa as ia,Sa as ja,fn as ka,va as la,mn as ma,Vr as na,ba as oa,xa as pa,Hr as qa,Lr as ra,_r as sa,Dr as ta,Nr as ua,Wr as va,jr as wa,Gr as xa,Pa as ya,Ea as za,wn as Aa,Aa as Ba,bt as Ca,ka as Da,Ra as Ea,Ta as Fa,Ca as Ga,Ma as Ha,Oa as Ia,Ur as Ja,Va as Ka,vn as La,Ya as Ma,Za as Na,Xa as Oa,La as Pa,_a as Qa,Na as Ra,Pe as Sa,es as Ta,Wa as Ua,Et as Va,Zr as Wa,Fa as Xa,za as Ya};
|
|
2
|
+
/*! Bundled license information:
|
|
3
|
+
|
|
4
|
+
react/cjs/react.production.js:
|
|
5
|
+
(**
|
|
6
|
+
* @license React
|
|
7
|
+
* react.production.js
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the MIT license found in the
|
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
|
13
|
+
*)
|
|
14
|
+
|
|
15
|
+
react/cjs/react-jsx-runtime.production.js:
|
|
16
|
+
(**
|
|
17
|
+
* @license React
|
|
18
|
+
* react-jsx-runtime.production.js
|
|
19
|
+
*
|
|
20
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
21
|
+
*
|
|
22
|
+
* This source code is licensed under the MIT license found in the
|
|
23
|
+
* LICENSE file in the root directory of this source tree.
|
|
24
|
+
*)
|
|
25
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{c as ae,d as se,f as oe,i as re,j as le,k as de,m as ce,n as ue,o as pe,p as ge,q as fe}from"./chunk.QFHWG4LN.js";import{b as Z,c as ee,d as te,e as ne}from"./chunk.YIPXZUTT.js";import{a as ie}from"./chunk.EMFOMSMI.js";import{a as Y}from"./chunk.PSQYDCVM.js";import{a as X,e as O}from"./chunk.U3HERHAI.js";import{E as K,G as Ie,J as Q,S as V,W as _,ea as j}from"./chunk.MODLZJD4.js";import{td as J}from"./chunk.6HY6ZGEE.js";import{b as N}from"./chunk.AJZBJBMO.js";var c=N(Ie(),1);var o=N(_(),1);function he(e,a,t){let i=a.on==="selection"?a.ids:a.on==="record"||a.on==="field"?[a.id]:[],l=i.length>0?ie(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(s=>({mutation:s.mutation,label:s.label,args:s.args,open:s.open,why:s.why,...s.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:a,principal:e.principal,interaction:se(),places:e.places,selection:e.selection,...l?{acts:l}:{},...e.place?{place:e.place}:{},...t?{said:t}:{},...e.app.purpose?{purpose:e.app.purpose}:{}}}async function be(e,a,t){let i=await (__graviewPreload(import.meta.url,["./chunk.QWNSHISU.js","./chunk.G4JJXA63.js","./chunk.TBY5IR7C.js","./chunk.FIFUMX5X.js","./chunk.BIDL7GQD.js","./chunk.V7W5AQKL.js","./chunk.PPSYUOH7.js","./chunk.XOZU4OFA.js","./chunk.GME63ZHI.js","./chunk.Q5WEOX3Q.js","./chunk.4FCFNAA4.js","./chunk.4AC2QM7T.js","./chunk.JXNVNFV4.js","./chunk.WVUJXDXZ.js","./chunk.I2737CPF.js","./chunk.NJRLJEJY.js","./chunk.CVPMSPCH.js","./chunk.OTV5XTBB.js","./chunk.KBPJ7X7W.js","./chunk.OEIWIZCP.js","./chunk.WSDJPXJD.js","./chunk.F4VB6Q2W.js","./chunk.FFOD5B4B.js","./chunk.Z7Y3R3YR.js","./chunk.YXEO3Y65.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KF27ME27.js")),l=i.recipeDraft(a.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(l))return l.failed;t?.(),e.seatTalk.setDraft(l,null),e.goTo.draft?.(),ke()}function ke(e=180){if(typeof document>"u")return;let a=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(a){i&&a.focus();return}e>0&&requestAnimationFrame(()=>ke(e-1))}async function T(e,a,t,i,l){let s=he(e,t,i),d=a==="suggest"?await oe(e.ai,s):a==="fill"?await re(e.ai,s):a==="record"?await le(e.ai,s):await de(e.ai,s);if(d.interaction.outcome==="failed")return a!=="suggest"&&e.desk.record(d.interaction),d;let u=g=>{let p={...d.interaction,outcome:"failed",failed:g};return e.desk.record(p),{...d,interaction:p}};if(a==="fill"||a==="record"){if(!d.ghost||d.ghost.proposals.length===0)return u("Nothing here could be filled in.");l?.(),e.desk.setGhost({ghost:d.ghost}),e.desk.record(d.interaction)}if(a==="panel"&&d.panel){let g=await be(e,d.panel,l);if(g)return u(g);e.desk.record(d.interaction)}return d}var W=new WeakMap,Te=64,me=new WeakMap;function Ee(e){let a=me.get(e);if(!a){let t=a={n:0};me.set(e,t),e.subscribe(()=>void(t.n+=1))}return a.n}var Se=(e,a)=>{let t=ee(a);return t.length>0?t.map(i=>e.graph.getNode(i)):[Ee(e)]},we=(e,a,t)=>JSON.stringify({target:a,seat:e.principal,by:t}),Ae=(e,a,t)=>{let i=Se(e.store,a);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((l,s)=>l===t.depends[s])};function Me(e,a,t="menu"){let i=W.get(e.store)?.get(we(e,a,t));return i?.result!==void 0&&Ae(e,a,i)?i.result:void 0}function Ce(e,a,t){let i=W.get(e.store);i||W.set(e.store,i=new Map);let l=we(e,a,t?.by??"menu"),s=i.get(l);if(s&&Ae(e,a,s))return s.result?Promise.resolve(s.result):s.asked;let d=t?t.ask():T(e,"suggest",a),u={schema:e.store.schema,ai:e.ai,depends:Se(e.store,a),asked:d};i.delete(l),i.set(l,u),i.size>Te&&i.delete(i.keys().next().value);let g=i;return d.then(p=>{p.interaction.outcome!=="failed"?u.result=p:g.get(l)===u&&g.delete(l)}),d}async function Oe(e,a,t,i,l={}){let s=a.interaction,d=ue(t);if(d){let u=s.usage?.at(-1)?.model,g=s.offered.find(h=>h.id===t.id)?.confidence,p=ce(e.store,{interaction:s.id,target:s.target,basis:`${s.ask.said}: ${t.label}`,...u?{model:u}:{},proposals:[{...d,...g!==void 0?{confidence:g}:{}}]},e.principal);if(p.proposals.length===0){let h="That can't be done now.";return e.desk.record({...s,outcome:"failed",failed:h}),h}l.onCard?e.desk.setGhost({ghost:p,onCard:!0}):(i?.(),e.desk.setGhost({ghost:p})),e.desk.record(s);return}if(t.type==="panel"){let u=t.label,g={title:u,recipe:{...t.panel,title:u}},p=await be(e,g,i);return e.desk.record(p?{...s,outcome:"failed",failed:p}:{...s,outcome:"drawn",accepted:[t.id],panel:g}),p}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...s,outcome:"accepted",accepted:[t.id]})}async function qe(e,a){if(a.ask.kind==="ask")return O(e.desk,{target:a.target,asked:a.ask.said}),null;let t=a.ask.kind==="panel"||a.ask.kind==="record"?a.ask.kind:"fill";return T(e,t,a.target,a.ask.said)}var k={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},ye=(0,o.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"aria-hidden":"true",style:{...k,visibility:"hidden"},children:"\xA0"}),P={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function ze({target:e,close:a}){let t=Y(),i=(0,c.useMemo)(()=>Z(e,n=>t.store.graph.has(n)),[e,t.store]),l=(0,c.useMemo)(()=>{let n=he(t,i);return te(t.store,i,{principal:t.principal,places:t.places,...n.acts?{acts:n.acts}:{}})},[t,i]),s=l.candidates.some(n=>n.type==="fill"),d=l.candidates.some(n=>n.type==="panel"),u=(0,c.useMemo)(()=>d?ne(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[d,t,i]),g=(0,c.useMemo)(()=>new Set(t.store.allMutations().filter(n=>(n.creates??[]).length>0).map(n=>n.name)),[t.store]),p=ae(t.ai)!==void 0&&l.candidates.some(n=>n.type==="act"&&n.asks.length>0&&g.has(n.mutation)),h=K(t.ai),S=Me(t,i),f=JSON.stringify(i),[m,I]=(0,c.useState)(!1),[A,R]=(0,c.useState)(null),[H,E]=(0,c.useState)(h&&S===void 0);(0,c.useEffect)(()=>{if(S!==void 0||!(h||m))return;let n=!0;return E(!0),Ce(t,i).then(y=>{n&&(R(y),E(!1))}),()=>{n=!1}},[f,m]);let r=S??A,w=(r?.offers??[]).filter(n=>!(n.type==="place"&&u.some(y=>y.place===n.place))).slice(0,Math.max(0,3-u.length)),b=r?.interaction.outcome==="failed"?r.interaction.failed??"The AI could not suggest anything here.":null,D=(0,c.useRef)(!1),F=(0,c.useRef)(null);(0,c.useLayoutEffect)(()=>{r===null||!D.current||(D.current=!1,F.current?.querySelector("button")?.focus())},[r]);let L=(0,c.useRef)(!0);(0,c.useEffect)(()=>()=>{L.current=!1},[]);let[U,G]=(0,c.useState)(!1),[B,$]=(0,c.useState)(null),M=n=>{if(U)return;G(!0),$(null);let y=!1;n(()=>{y=!0,a()}).then(x=>{L.current&&(G(!1),x?$(x):y||a())},x=>{L.current&&(G(!1),$(x instanceof Error?x.message:String(x)))})},q=n=>n.interaction.outcome==="failed"?n.interaction.failed??"The AI could not do that here.":void 0,C=H&&!m?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:P,children:"Thinking\u2026"}):U?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:P,children:"Asking\u2026"}):B?(0,o.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...P,color:"var(--graview-warn)"},children:B}):b?(0,o.jsx)("p",{role:"status",style:P,children:b}):null,z=(0,c.useRef)(0);z.current=Math.max(z.current,h&&S===void 0?Math.max(1,3-u.length):0,w.length+(C?1:0));let xe=Math.max(0,z.current-w.length-(C?1:0));return(0,o.jsxs)("div",{ref:F,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[(0,o.jsxs)("ul",{"data-testid":"inline-ai-room",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[C?(0,o.jsxs)("li",{style:{position:"relative"},children:[ye,(0,o.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center"},children:C})]}):null,w.map(n=>(0,o.jsx)("li",{children:(0,o.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${n.id}`,"data-ai-offer":n.id,"data-ai-offer-type":n.type,title:n.label,onClick:()=>M(y=>Oe(t,r,n,y)),style:{...k,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[n.label,(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",n.type==="panel"?"a panel":n.type==="place"?"go there":n.type==="record"?"open it":"suggested"]})]})},n.id)),Array.from({length:xe},(n,y)=>(0,o.jsx)("li",{"data-inline-ai-room":"",children:ye},`room-${y}`))]}),(0,o.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[!h&&r===null?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":m||void 0,onClick:n=>{m||(D.current=document.activeElement===n.currentTarget,I(!0))},style:k,children:m?"Thinking\u2026":"Suggest\u2026"})}):null,s?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>M(async n=>q(await T(t,"fill",i,"Fill in",n))),style:k,children:"Fill in with AI"})}):null,p?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>M(async n=>q(await T(t,"record",i,"Add one",n))),style:k,children:"Add one with AI"})}):null,u.map(n=>(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":`ai-open:${n.place}`,"data-ai-existing":n.fit,onClick:()=>{a(),t.goTo.place(n.place),n.fit==="partial"&&O(t.desk,{target:{on:"lens",place:n.place,...n.kind?{kind:n.kind}:{}}})},style:k,children:n.fit==="full"?`Open ${n.title}`:`Open and adjust ${n.title}`})},n.place)),d?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>M(async n=>q(await T(t,"panel",i,"Draw a panel",n))),style:k,children:u.length>0?"Draw a new view":"Draw a panel"})}):null,(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let n=document.activeElement,y=X(n instanceof Element?n.closest('[data-testid="context-menu"]'):null);a(),O(t.desk,{target:i,returnTo:n instanceof HTMLElement&&n!==document.body?n:null,...y?{from:y}:{}})},style:k,children:"Tell Graview\u2026"})})]})]})}var v={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function Ne({placement:e="picture"}){let{store:a,principal:t,aiDesk:i}=j(),l=V(a,t),{ghost:s,entries:d}=Q(i),[u,g]=(0,c.useState)(new Set);(0,c.useEffect)(()=>g(new Set),[s?.ghost.interaction]);let p=(0,c.useRef)(null),h=(0,c.useRef)(null),S=s?.batch;if((0,c.useEffect)(()=>{S!==void 0&&h.current?.focus()},[S]),!s)return null;let{ghost:f}=s,m=d.find(r=>r.id===f.interaction),I=()=>{let r=f.target.on==="record"||f.target.on==="field"?f.target.id:void 0,w=p.current?.closest("[data-graview-face], main")?.parentElement??document,b=(r?w.querySelector(`[data-graview-view="${CSS.escape(r)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??p.current?.closest("main")??document.querySelector("main");b&&!b.hasAttribute("tabindex")&&b.setAttribute("tabindex","-1"),b?.focus({preventScroll:!0}),i.setGhost(null)},A=f.proposals.filter(r=>!u.has(r.id)).map(r=>r.id),R=()=>{let r=pe(l,f,{author:t,ids:A});if(!r.ok){i.setGhost({...s,refused:r.refused});return}m&&i.record(ge(m,r.accepted,r.batch)),i.setGhost({ghost:f,batch:r.batch,took:r.accepted.length,...s.onCard?{onCard:!0}:{}})},H=()=>{m&&s.batch===void 0&&i.record(fe(m)),I()},E=()=>{if(s.batch!==void 0)try{l.undo(s.batch,{author:t}),m&&i.record({...m,undone:!0}),I()}catch(r){i.setGhost({...s,refused:r instanceof Error?r.message:String(r)})}};return(0,o.jsxs)("section",{ref:p,"data-testid":"ai-ghost","data-interaction":f.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:J("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,o.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:s.batch!==void 0?`Done: ${s.took===1?"one change":`${s.took} changes`}, as one.`:`Proposed by AI \xB7 ${f.basis}`}),s.batch===void 0?(0,o.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:f.proposals.map(r=>(0,o.jsx)("li",{"data-ghost-proposal":r.id,children:(0,o.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,o.jsx)("input",{type:"checkbox",checked:!u.has(r.id),onChange:w=>{let b=new Set(u);w.target.checked?b.delete(r.id):b.add(r.id),g(b)}}),(0,o.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:r.said}),r.confidence!==void 0?(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(r.confidence*100),"% sure"]}):null]})},r.id))}):null,s.refused?(0,o.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:s.refused}):null,(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.batch===void 0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:A.length===0,onClick:R,style:v,children:A.length===f.proposals.length?"Accept":`Accept ${A.length} of ${f.proposals.length}`}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:H,style:v,children:"Dismiss"})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button",ref:h,"data-testid":"ghost-undo",onClick:E,style:v,children:"Undo"}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:I,style:v,children:"Close"})]})})]})}export{he as a,be as b,T as c,Me as d,Ce as e,Oe as f,qe as g,ze as h,Ne as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as h}from"./chunk.
|
|
1
|
+
import{a as h}from"./chunk.YXEO3Y65.js";import{D as g,Da as a,Ga as b,H as k,K as w,cc as x}from"./chunk.6HY6ZGEE.js";var s=i=>i?._zod?.def,O=Symbol.for("@graview/core:collaborative"),v=/^\^\\d\{4\}-\\d\{2\}-\\d\{2\}\$$/;function R(i){let t=s(i),u=!0,f;for(let e=0;t&&e<4;e++){if(t.type==="optional"||t.type==="nullable")u=!1;else if(t.type==="default")u=!1,f=t.defaultValue;else break;t=s(t.innerType)}if(!t)return{why:"it is not a zod field"};let l=g(i),r={...u?{required:!0}:{},...f!==void 0?{default:f}:{},...l?{description:l}:{}},p=(t.checks??[]).map(e=>s(e)),c=a(i);if(c)return{spec:{type:c,...r}};if(b(i))return{spec:{type:"app-link",...r}};let d;for(let e=s(i),n=0;e&&d===void 0&&n<4;e=s(e.innerType),n++)d=e[O];let m=e=>d!==void 0&&d===1!=(e==="text")?{collaborative:d===1}:{};if(h(i))return{spec:{type:"text",format:"markdown",...r,...m("text")}};let y=x(i);if(y)return{spec:{type:y,...r}};switch(t.type){case"string":{let e=t.format;return e==="email"?{spec:{type:"email",...r}}:e==="url"?{spec:{type:"url",...r}}:e==="date"?{spec:{type:"date",...r}}:e==="datetime"||p.some(n=>n?.fn===w)?{spec:{type:"datetime",...r}}:p.some(n=>n?.format==="regex"&&(v.test(String(n?.pattern?.source??""))||n?.pattern?.source===k.source))?{spec:{type:"date",...r}}:{spec:{type:"string",...r,...m("string")}}}case"number":{let e={};for(let n of p){let o=n?.value;typeof o=="number"&&(n?.check==="greater_than"&&n.inclusive?e.min=Math.max(e.min??o,o):n?.check==="less_than"&&n.inclusive?e.max=Math.min(e.max??o,o):n?.check==="multiple_of"&&(e.step=o))}return{spec:{type:p.some(n=>n?.format==="safeint"||n?.format==="int")?"integer":"number",...e,...r}}}case"boolean":return{spec:{type:"boolean",...r}};case"enum":{let e=Object.keys(t.entries??{});return e.length>0?{spec:{type:"enum",options:e,...r}}:{why:"it is an enum with no options"}}case"array":{let e=s(t.element);if(e?.type==="enum"){let o=Object.keys(e.entries??{});return o.length>0?{spec:{type:"enum",multiple:!0,options:o,...r}}:{why:"it is a list of an enum with no options"}}let n=a(t.element)??(e?.type==="number"?"number":e?.type==="string"?"string":void 0);return n?{spec:{type:"list",of:n,...r}}:{why:`it is a list of ${String(e?.type??"something")}, and a document lists words, numbers, dates, images, videos or files`}}default:return{why:`it is a ${String(t.type)}, which a document has no field type for`}}}function T(i){let t=R(i);return"spec"in t?t.spec:void 0}export{T as a};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var j={nav:"div",header:"div",footer:"div",aside:"div",search:"div",output:"span"},L=["all","display","position","top","right","bottom","left","inset","inset-block","inset-inline","inset-block-start","inset-block-end","inset-inline-start","inset-inline-end","width","height","min-width","min-height","max-width","max-height","inline-size","block-size","min-inline-size","min-block-size","max-inline-size","max-block-size","margin","margin-top","margin-right","margin-bottom","margin-left","margin-block","margin-inline","margin-block-start","margin-block-end","margin-inline-start","margin-inline-end","padding","padding-top","padding-right","padding-bottom","padding-left","padding-block","padding-inline","padding-block-start","padding-block-end","padding-inline-start","padding-inline-end","box-sizing","overflow","overflow-x","overflow-y","overflow-wrap","float","clear","z-index","aspect-ratio","object-fit","object-position","vertical-align","isolation","contain","container","container-type","container-name","content-visibility","flex","flex-direction","flex-wrap","flex-flow","flex-grow","flex-shrink","flex-basis","order","grid","grid-template","grid-template-columns","grid-template-rows","grid-template-areas","grid-auto-columns","grid-auto-rows","grid-auto-flow","grid-area","grid-column","grid-row","grid-column-start","grid-column-end","grid-row-start","grid-row-end","gap","row-gap","column-gap","align-items","align-content","align-self","justify-items","justify-content","justify-self","place-items","place-content","place-self","columns","column-count","column-width","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-fill","color","background","background-color","background-image","background-position","background-position-x","background-position-y","background-size","background-repeat","background-origin","background-clip","background-attachment","background-blend-mode","border","border-top","border-right","border-bottom","border-left","border-block","border-inline","border-block-start","border-block-end","border-inline-start","border-inline-end","border-width","border-style","border-color","border-top-width","border-right-width","border-bottom-width","border-left-width","border-top-style","border-right-style","border-bottom-style","border-left-style","border-top-color","border-right-color","border-bottom-color","border-left-color","border-radius","border-top-left-radius","border-top-right-radius","border-bottom-right-radius","border-bottom-left-radius","border-start-start-radius","border-start-end-radius","border-end-start-radius","border-end-end-radius","border-collapse","border-spacing","outline","outline-width","outline-style","outline-color","outline-offset","box-shadow","opacity","visibility","mix-blend-mode","filter","backdrop-filter","clip-path","accent-color","caret-color","color-scheme","appearance","-webkit-appearance","mask-image","mask-size","mask-position","mask-repeat","mask-origin","mask-clip","mask-composite","mask-mode","mask-type","-webkit-mask","-webkit-mask-image","-webkit-mask-size","-webkit-mask-position","-webkit-mask-repeat","-webkit-mask-origin","-webkit-mask-clip","-webkit-mask-composite","font","font-family","font-size","font-weight","font-style","font-stretch","font-variant","font-variant-numeric","font-variant-caps","font-variant-ligatures","font-feature-settings","font-variation-settings","font-kerning","font-optical-sizing","font-size-adjust","font-synthesis","line-height","letter-spacing","word-spacing","text-align","text-align-last","text-indent","text-transform","text-decoration","text-decoration-line","text-decoration-color","text-decoration-style","text-decoration-thickness","text-underline-offset","text-underline-position","text-shadow","text-overflow","text-wrap","text-wrap-mode","text-wrap-style","white-space","white-space-collapse","word-break","line-break","hyphens","tab-size","direction","unicode-bidi","writing-mode","text-orientation","text-rendering","-webkit-font-smoothing","-webkit-line-clamp","-webkit-box-orient","line-clamp","-webkit-text-fill-color","-webkit-background-clip","-webkit-text-stroke","-webkit-text-stroke-width","-webkit-text-stroke-color","list-style","list-style-type","list-style-position","content","quotes","counter-reset","counter-increment","counter-set","table-layout","caption-side","empty-cells","transform","transform-origin","transform-box","transform-style","translate","rotate","scale","perspective","perspective-origin","backface-visibility","transition","transition-property","transition-duration","transition-timing-function","transition-delay","transition-behavior","animation","animation-name","animation-duration","animation-timing-function","animation-delay","animation-iteration-count","animation-direction","animation-fill-mode","animation-play-state","animation-composition","will-change","animation-timeline","animation-range","animation-range-start","animation-range-end","scroll-timeline","scroll-timeline-name","scroll-timeline-axis","view-timeline","view-timeline-name","view-timeline-axis","view-timeline-inset","timeline-scope","cursor","pointer-events","user-select","-webkit-user-select","touch-action","resize","scroll-behavior","overscroll-behavior","overscroll-behavior-x","overscroll-behavior-y","scroll-snap-type","scroll-snap-align","scroll-snap-stop","scroll-margin","scroll-padding","scroll-margin-top","scroll-margin-right","scroll-margin-bottom","scroll-margin-left","scroll-margin-block","scroll-margin-block-start","scroll-margin-block-end","scroll-margin-inline","scroll-margin-inline-start","scroll-margin-inline-end","scroll-padding-top","scroll-padding-right","scroll-padding-bottom","scroll-padding-left","scroll-padding-block","scroll-padding-block-start","scroll-padding-block-end","scroll-padding-inline","scroll-padding-inline-start","scroll-padding-inline-end","scrollbar-width","scrollbar-color","scrollbar-gutter","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-dasharray","stroke-dashoffset","stroke-opacity","stroke-miterlimit","stop-color","stop-opacity","clip-rule","marker","marker-start","marker-mid","marker-end","paint-order","vector-effect","shape-rendering","text-anchor","dominant-baseline","alignment-baseline","r","cx","cy","rx","ry","x","y","d","mask","flood-color","flood-opacity","lighting-color","color-interpolation-filters"],F=["var","env","calc","min","max","clamp","round","mod","rem","abs","sign","sin","cos","tan","asin","acos","atan","atan2","pow","sqrt","hypot","log","exp","rgb","rgba","hsl","hsla","hwb","lab","lch","oklab","oklch","color","color-mix","light-dark","linear-gradient","radial-gradient","conic-gradient","repeating-linear-gradient","repeating-radial-gradient","repeating-conic-gradient","translate","translatex","translatey","translatez","translate3d","rotate","rotatex","rotatey","rotatez","rotate3d","scale","scalex","scaley","scalez","scale3d","skew","skewx","skewy","matrix","matrix3d","perspective","cubic-bezier","steps","linear","repeat","minmax","fit-content","blur","brightness","contrast","drop-shadow","grayscale","hue-rotate","invert","saturate","sepia","opacity","circle","ellipse","inset","polygon","path","xywh","rect","counter","counters","scroll","view"],U=["fill","stroke","clip-path","mask","marker","marker-start","marker-mid","marker-end","filter"],M=["media","supports","container","keyframes"],W={position:["static","relative","absolute","sticky"],all:[],appearance:["auto","none","menulist-button","textfield"],"-webkit-appearance":["auto","none","menulist-button","textfield"]},K=["host","host-context","slotted","part","backdrop","picker","view-transition","view-transition-group","view-transition-image-pair","view-transition-old","view-transition-new"],X=["-webkit-details-marker"],S=64e3;var p=n=>n>=48&&n<=57,Y=n=>p(n)||n>=65&&n<=70||n>=97&&n<=102,V=n=>n>=65&&n<=90||n>=97&&n<=122,A=n=>n>=128,v=n=>V(n)||A(n)||n===95,q=n=>v(n)||p(n)||n===45,G=n=>n===10,b=n=>n===10||n===9||n===32,ce=n=>n>=0&&n<=8||n===11||n>=14&&n<=31||n===127,y=-1;function ue(n){let i=[];for(let t=0;t<n.length;t+=1){let e=n.codePointAt(t);e>65535&&(t+=1),e===13?(n.charCodeAt(t+1)===10&&(t+=1),e=10):e===12?e=10:(e===0||e>=55296&&e<=57343)&&(e=65533),i.push(e)}return i}function Q(n){let i=ue(n),t=0,e=(a=0)=>t+a<i.length?i[t+a]:y,r=[],o=(a,l)=>a===92&&l!==10&&l!==y,s=(a,l,m)=>a===45?v(l)||l===45||o(l,m):v(a)?!0:o(a,l),u=(a,l,m)=>a===43||a===45?p(l)||l===46&&p(m):p(a===46?l:a),c=()=>{let a=e();if(t+=1,a===y)return 65533;if(Y(a)){let l=String.fromCodePoint(a);for(;l.length<6&&Y(e());)l+=String.fromCodePoint(e()),t+=1;b(e())&&(t+=1);let m=parseInt(l,16);return m===0||m>=55296&&m<=57343||m>1114111?65533:m}return a},d=()=>{let a="";for(;;){let l=e();if(q(l))a+=String.fromCodePoint(l),t+=1;else if(o(l,e(1)))t+=1,a+=String.fromCodePoint(c());else return a}},f=()=>{let a="";for((e()===43||e()===45)&&(a+=String.fromCodePoint(i[t++]));p(e());)a+=String.fromCodePoint(i[t++]);if(e()===46&&p(e(1)))for(a+=String.fromCodePoint(i[t++],i[t++]);p(e());)a+=String.fromCodePoint(i[t++]);if((e()===69||e()===101)&&(p(e(1))||(e(1)===43||e(1)===45)&&p(e(2))))for(a+=String.fromCodePoint(i[t++]),p(e())||(a+=String.fromCodePoint(i[t++]));p(e());)a+=String.fromCodePoint(i[t++]);return a},x=()=>{let a=f();return s(e(),e(1),e(2))?{type:"dimension",repr:a,unit:d()}:e()===37?(t+=1,{type:"percentage",repr:a}):{type:"number",repr:a}},g=()=>{for(;;){let a=e();if(t+=1,a===41||a===y)return;o(a,e())&&c()}},se=()=>{let a="";for(;b(e());)t+=1;for(;;){let l=e();if(t+=1,l===41)return{type:"url",value:a};if(l===y)return{type:"url",value:a};if(b(l)){for(;b(e());)t+=1;return e()===41||e()===y?(e()===41&&(t+=1),{type:"url",value:a}):(g(),{type:"bad-url"})}if(l===34||l===39||l===40||ce(l))return g(),{type:"bad-url"};if(l===92){if(o(l,e()))a+=String.fromCodePoint(c());else return g(),{type:"bad-url"};continue}a+=String.fromCodePoint(l)}},z=()=>{let a=d();if(a.toLowerCase()==="url"&&e()===40){for(t+=1;b(e())&&b(e(1));)t+=1;let l=b(e())?e(1):e();return l===34||l===39?{type:"function",value:a}:se()}return e()===40?(t+=1,{type:"function",value:a}):{type:"ident",value:a}},le=a=>{let l="";for(;;){let m=e();if(t+=1,m===a||m===y)return{type:"string",value:l};if(G(m))return t-=1,{type:"bad-string"};if(m===92){if(e()===y)continue;if(G(e())){t+=1;continue}l+=String.fromCodePoint(c());continue}l+=String.fromCodePoint(m)}};for(;;){for(;e()===47&&e(1)===42;){for(t+=2;e()!==y&&!(e()===42&&e(1)===47);)t+=1;e()!==y&&(t+=2)}let a=e();if(a===y)return r;if(b(a)){for(;b(e());)t+=1;r.push({type:"whitespace"});continue}switch(t+=1,a){case 34:case 39:r.push(le(a));continue;case 35:if(q(e())||o(e(),e(1))){let l=s(e(),e(1),e(2));r.push({type:"hash",value:d(),id:l})}else r.push({type:"delim",value:"#"});continue;case 40:r.push({type:"("});continue;case 41:r.push({type:")"});continue;case 43:case 46:u(a,e(),e(1))?(t-=1,r.push(x())):r.push({type:"delim",value:String.fromCodePoint(a)});continue;case 44:r.push({type:","});continue;case 45:u(a,e(),e(1))?(t-=1,r.push(x())):e()===45&&e(1)===62?(t+=2,r.push({type:"CDC"})):s(a,e(),e(1))?(t-=1,r.push(z())):r.push({type:"delim",value:"-"});continue;case 58:r.push({type:":"});continue;case 59:r.push({type:";"});continue;case 60:e()===33&&e(1)===45&&e(2)===45?(t+=3,r.push({type:"CDO"})):r.push({type:"delim",value:"<"});continue;case 64:s(e(),e(1),e(2))?r.push({type:"at-keyword",value:d()}):r.push({type:"delim",value:"@"});continue;case 91:r.push({type:"["});continue;case 92:o(a,e())?(t-=1,r.push(z())):r.push({type:"delim",value:"\\"});continue;case 93:r.push({type:"]"});continue;case 123:r.push({type:"{"});continue;case 125:r.push({type:"}"});continue;default:p(a)?(t-=1,r.push(x())):v(a)?(t-=1,r.push(z())):r.push({type:"delim",value:String.fromCodePoint(a)})}}}var ee={"{":"}","[":"]","(":")"},ne=32,D=class{constructor(i){this.tokens=i}i=0;peek(){return this.tokens[this.i]}next(){return this.tokens[this.i++]}};function te(n,i){let t=n.next();return t.type==="{"||t.type==="["||t.type==="("?{type:"block",open:t.type,value:H(n,ee[t.type],i+1)}:t.type==="function"?{type:"func",name:t.value,value:H(n,")",i+1)}:t}function H(n,i,t){let e=[];for(;;){let r=n.peek();if(!r)return e;if(r.type===i)return n.next(),e;if(t>ne){n.next(),e.push({type:"bad-string"});continue}e.push(te(n,t))}}function w(n,i){let t=[],e=0;for(;e<n.length;){let r=n[e];if(r.type==="whitespace"||i&&(r.type==="CDO"||r.type==="CDC")){e+=1;continue}if(r.type==="at-keyword"){let u=[];e+=1;let c;for(;e<n.length;){let d=n[e];if(e+=1,d.type===";")break;if(d.type==="block"&&d.open==="{"){c=d.value;break}u.push(d)}t.push({type:"at-rule",name:r.value,prelude:u,...c?{block:c}:{}});continue}let o=[],s;for(;e<n.length;){let u=n[e];if(e+=1,u.type==="block"&&u.open==="{"){s=u.value;break}o.push(u)}s&&t.push({type:"qualified",prelude:o,block:s})}return t}function I(n){let i=[],t=0;for(;t<n.length;){let e=n[t];if(e.type==="whitespace"||e.type===";"){t+=1;continue}if(e.type==="at-keyword"){let o=(()=>{for(let s=t+1;s<n.length;s+=1){let u=n[s];if(u.type===";"||u.type==="block"&&u.open==="{")return s+1}return n.length})();i.push(...w(n.slice(t,o),!1)),t=o;continue}if(e.type==="ident"){let o=t+1;for(;n[o]?.type==="whitespace";)o+=1;if(n[o]?.type===":"){let s=o+1;for(;s<n.length&&n[s].type!==";";)s+=1;let u=ie(e.value,n.slice(o+1,s));if(u.value.some(c=>c.type==="block"&&c.open==="{")){let c=n.findIndex((d,f)=>f>t&&d.type==="block"&&d.open==="{");i.push(...w(n.slice(t,c+1),!1)),t=c+1;continue}i.push(u),t=s+1;continue}}let r=t;for(;r<n.length&&!(n[r].type==="block"&&n[r].open==="{")&&n[r].type!==";";)r+=1;r<n.length&&n[r].type==="block"&&i.push(...w(n.slice(t,r+1),!1)),t=r+1}return i}function ie(n,i){let t=[...i];for(;t[0]?.type==="whitespace";)t.shift();for(;t.at(-1)?.type==="whitespace";)t.pop();let e=!1,o=t.length-1;if(t[o]?.type==="ident"&&t[o].value.toLowerCase()==="important"){for(o-=1;t[o]?.type==="whitespace";)o-=1;let s=t[o];if(s?.type==="delim"&&s.value==="!")for(e=!0,t.length=o;t.at(-1)?.type==="whitespace";)t.pop()}return{type:"declaration",name:n,value:t,important:e}}function N(n){let i=new D(Q(n)),t=[];for(;i.peek();)t.push(te(i,0));return t}function C(n){let i="",t=[...n].map(e=>e.codePointAt(0));return t.forEach((e,r)=>{e===0?i+="\uFFFD":e>=1&&e<=31||e===127||r===0&&p(e)||r===1&&p(e)&&t[0]===45?i+=`\\${e.toString(16)} `:r===0&&e===45&&t.length===1?i+="\\-":A(e)||e===45||e===95||p(e)||V(e)?i+=String.fromCodePoint(e):i+=`\\${String.fromCodePoint(e)}`}),i}function R(n){let i="";for(let t of n){let e=t.codePointAt(0);A(e)||e===45||e===95||p(e)||V(e)?i+=t:e>=1&&e<=31||e===127?i+=`\\${e.toString(16)} `:i+=`\\${t}`}return i}function E(n){let i='"';for(let t of n){let e=t.codePointAt(0);e===0?i+="\uFFFD":e>=1&&e<=31||e===127||e===60||e===62?i+=`\\${e.toString(16)} `:e===34||e===92?i+=`\\${t}`:i+=t}return`${i}"`}function de(n){let i=R(n);return/^[eE]([0-9]|[+-][0-9])/.test(n)?`\\${n.codePointAt(0).toString(16)} ${R(n.slice(1))}`:i}var Z=n=>{switch(n.type){case"ident":case"url":case"bad-url":case"number":case"percentage":case"dimension":case"CDC":case"hash":case"at-keyword":return n.type;case"func":case"function":return"function";case"block":return n.open==="("?"(":"other";case"(":return"(";case"delim":return`delim${n.value}`;default:return"other"}};function pe(n,i){let t=["ident","function","url","bad-url","delim-","number","percentage","dimension","CDC"];return n==="ident"?[...t,"("].includes(i):n==="at-keyword"||n==="hash"||n==="dimension"||n==="delim#"||n==="delim-"?t.includes(i):n==="number"?["ident","function","url","bad-url","number","percentage","dimension","delim%"].includes(i):n==="delim@"?["ident","function","url","bad-url","delim-","CDC"].includes(i):n==="delim."||n==="delim+"?["number","percentage","dimension"].includes(i):n==="delim/"?i==="delim*":!1}function fe(n){switch(n.type){case"whitespace":return" ";case"ident":return C(n.value);case"at-keyword":return`@${C(n.value)}`;case"hash":return`#${R(n.value)}`;case"string":return E(n.value);case"url":return`url(${E(n.value)})`;case"delim":return n.value==="\\"?`\\
|
|
2
|
+
`:n.value;case"CDO":return"<!--";case"CDC":return"-->";case"number":return n.repr;case"percentage":return`${n.repr}%`;case"dimension":return`${n.repr}${de(n.unit)}`;case"func":return`${C(n.name)}(${k(n.value)})`;case"block":return`${n.open}${k(n.value)}${ee[n.open]}`;case":":case";":case",":case"[":case"]":case"(":case")":case"{":case"}":return n.type;default:return""}}function k(n){let i="",t;for(let e of n)e.type==="whitespace"&&t?.type==="whitespace"||(t&&pe(Z(t),Z(e))&&(i+="/**/"),i+=fe(e),t=e);return i}var me=new Set(L),re=new Set(F),B=new Set(U),ye=new Set(M),ge=new Set(K),be=new Set(X),J=/^#[A-Za-z_][A-Za-z0-9_.:-]*$/,h=n=>n.replace(/[A-Z]/g,i=>i.toLowerCase()),he=n=>h(n);function O(n,i,t){let e=[];for(let r of i){if(r.type==="bad-url"||r.type==="bad-string"){t({reason:"unreadable",...n?{name:n}:{}});return}if(r.type==="url"){if(n&&B.has(n)&&J.test(r.value)){e.push({type:"func",name:"url",value:[{type:"string",value:r.value}]});continue}t({reason:"url",...n?{name:n}:{}});return}if(r.type==="func"){let o=h(r.name);if(o==="url"||o==="src"){let u=r.value.filter(d=>d.type!=="whitespace"),c=u[0];if(o==="url"&&u.length===1&&c?.type==="string"&&n&&B.has(n)&&J.test(c.value)){e.push({type:"func",name:"url",value:[{type:"string",value:c.value}]});continue}t({reason:"url",...n?{name:n}:{}});return}if(!re.has(o)){t({reason:"function",name:o});return}let s=O(n,r.value,t);if(!s)return;o==="var"?e.push({type:"whitespace"},{type:"func",name:o,value:s},{type:"whitespace"}):e.push({type:"func",name:o,value:s});continue}if(r.type==="block"){if(r.open==="{"||r.open==="("&&e.at(-1)?.type==="ident"){t({reason:"unreadable",...n?{name:n}:{}});return}let o=O(n,r.value,t);if(!o)return;e.push({type:"block",open:r.open,value:o});continue}if(r.type==="at-keyword"||r.type==="CDO"||r.type==="CDC"||r.type==="{"||r.type==="}"||r.type===";"||r.type==="delim"&&r.value==="\\"){t({reason:"unreadable",...n?{name:n}:{}});return}e.push(r)}return e}var ke=/^(animation|transition|scroll-behavior)/;function P(n,i,t=!1){let e=n.name.startsWith("--"),r=e?n.name:he(n.name);if(!e&&!me.has(r)){i({reason:"property",name:r});return}let o=W[r];if(o){let c=n.value.filter(x=>x.type!=="whitespace"),d=c[0],f=c.length===1&&d?.type==="ident"?h(d.value):void 0;if(!f||![...o,"inherit","initial","unset","revert"].includes(f)){i({reason:"value",name:r});return}return`${r}: ${f}${n.important?" !important":""}`}let s=O(e?void 0:r,n.value,i);if(!s)return;let u=k(s).trim();return`${e?`--${R(n.name.slice(2))}`:r}: ${u}${n.important&&!(t&&ke.test(r))?" !important":""}`}function oe(n,i){let t=e=>{for(let r=0;r<e.length;r+=1){let o=e[r];if(r>0&&e[r-1].type===":"&&(o.type==="ident"||o.type==="func")){let u=h(o.type==="ident"?o.value:o.name);if(ge.has(u)||(u.startsWith("-webkit-")||u.startsWith("-moz-"))&&!be.has(u))return i({reason:"selector",name:u}),!1}if(o.type==="url"||o.type==="bad-url"||o.type==="bad-string"||o.type==="at-keyword"||o.type==="CDO"||o.type==="CDC"||o.type==="block"&&o.open==="{")return i({reason:"unreadable",name:"selector"}),!1;if(o.type==="func"&&!t(o.value)||o.type==="block"&&!t(o.value))return!1}return!0};return t(n)}function T(n,i,t){let e=[];for(let r of I(n))if(r.type==="declaration"){let o=P(r,i);o&&e.push(`${o};`)}else{let o=_(r,i,t+1,"style");o&&e.push(o)}return e.join(" ")}function xe(n,i,t){let e=r=>r.every(o=>{if(o.type==="url"||o.type==="bad-url"||o.type==="bad-string"||o.type==="block"&&o.open==="{")return t({reason:o.type==="url"?"url":"unreadable",name:`@${i}`}),!1;if(o.type==="func"){let s=h(o.name);return i==="supports"&&s==="selector"?oe(o.value,t):re.has(s)?e(o.value):(t({reason:"function",name:s}),!1)}if(o.type==="block"){if(i==="supports"){let s=I(o.value);if(s.length===1&&s[0].type==="declaration")return P(s[0],t)!==void 0}return e(o.value)}return!0});return e(n)?k(n).trim():void 0}function $(n){return n.map((i,t)=>{let e=n[t-1],r=e?.type===":"||e?.type==="delim"&&(e.value==="."||e.value==="|");return i.type==="ident"&&!r&&Object.prototype.hasOwnProperty.call(j,h(i.value))?{type:"block",open:"[",value:[{type:"ident",value:"data-graview-as"},{type:"delim",value:"="},{type:"string",value:h(i.value)}]}:i.type==="func"?{type:"func",name:i.name,value:$(i.value)}:i.type==="block"&&i.open==="("?{type:"block",open:"(",value:$(i.value)}:i})}function _(n,i,t,e){if(t>ne){i({reason:"unreadable",name:"nesting"});return}if(n.type==="qualified"){if(e==="keyframes"){if(!n.prelude.every(f=>f.type==="whitespace"||f.type===","||f.type==="percentage"||f.type==="ident"&&["from","to"].includes(h(f.value)))){i({reason:"unreadable",name:"keyframe"});return}return`${k(n.prelude).trim()} { ${T(n.block,i,t)} }`}if(!oe(n.prelude,i))return;let c=k($(n.prelude)).trim();if(c===""){i({reason:"unreadable",name:"selector"});return}return`${c} { ${T(n.block,i,t)} }`}let r=h(n.name),o=r==="-webkit-keyframes"?"keyframes":r;if(!ye.has(o)||e==="keyframes"){i({reason:"at-rule",name:`@${r}`});return}if(!n.block){i({reason:"unreadable",name:`@${r}`});return}if(o==="keyframes"){if(e!=="sheet"){i({reason:"at-rule",name:"@keyframes"});return}let c=n.prelude.filter(g=>g.type!=="whitespace"),d=c[0];if(c.length!==1||!d||d.type!=="ident"&&d.type!=="string"){i({reason:"unreadable",name:"@keyframes"});return}let f=w(n.block,!1).map(g=>_(g,i,t+1,"keyframes")).filter(g=>g!==void 0);return`@keyframes ${d.type==="ident"?C(d.value):E(d.value)} { ${f.join(" ")} }`}let s=xe(n.prelude,o,i);if(s===void 0)return;let u=e==="style"?T(n.block,i,t):w(n.block,!1).map(c=>_(c,i,t+1,"sheet")).filter(c=>c!==void 0).join(" ");return`@${o} ${s} { ${u} }`}function ae(n,i=S){let t=[];if(n.length>i)return{css:"",refused:[{reason:"size"}]};let e=o=>void t.push(o);return{css:w(N(n),!0).map(o=>_(o,e,0,"sheet")).filter(o=>o!==void 0).join(`
|
|
3
|
+
`),refused:t}}function we(n,i=S){let t=[],e=[],r=0;for(let o of n){if(r+o.length>i){e.push({reason:"size"});continue}r+=o.length;let s=ae(o,i);s.css&&t.push(s.css),e.push(...s.refused)}return{css:t.join(`
|
|
4
|
+
`),refused:e}}function Ce(n,i=S){let t=[];if(n.length>i)return{css:"",refused:[{reason:"size"}]};let e=o=>void t.push(o),r=[];for(let o of I(N(n))){if(o.type!=="declaration"){e({reason:"unreadable",name:"a rule in a style attribute"});continue}let s=P(o,e,!0);s&&r.push(s)}return{css:r.join("; "),refused:t}}function Se(n,i){let t,e=P(ie(n,N(i)),r=>t??=r);return e===void 0||t?{refused:t??{reason:"unreadable",name:n}}:{value:e.slice(e.indexOf(":")+1).trim()}}export{ae as a,we as b,Ce as c,Se as d};
|