graview 0.1.70 → 0.1.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/preview/chunk.23DATB5Y.js +1 -0
- package/dist/preview/chunk.2INDKSJI.js +1 -0
- package/dist/preview/chunk.3CLTABGP.js +1 -0
- package/dist/preview/{chunk.4O3STSC4.js → chunk.3RRK6UTN.js} +1 -1
- package/dist/preview/chunk.45HUV56Z.js +1 -0
- package/dist/preview/chunk.4HU2ILFY.js +1 -0
- package/dist/preview/{chunk.M7DJJRFH.js → chunk.4LWWXIM4.js} +1 -1
- package/dist/preview/chunk.4O64QV2Y.js +1 -0
- package/dist/preview/{chunk.KP7HUXH5.js → chunk.4QMAYVPU.js} +1 -1
- package/dist/preview/chunk.4UDST6IF.js +1 -0
- package/dist/preview/{chunk.7TZXDPPO.js → chunk.4YZ2A6SJ.js} +3 -3
- package/dist/preview/{chunk.PAIBRJVZ.js → chunk.4ZEHLUXV.js} +1 -1
- package/dist/preview/{chunk.I7CSRZC2.js → chunk.5EQRIZ6I.js} +1 -1
- package/dist/preview/chunk.5OS4SYHE.js +1 -0
- package/dist/preview/{chunk.ZIGW5VOT.js → chunk.5PQV7GFE.js} +1 -1
- package/dist/preview/{chunk.SSHEFQ4R.js → chunk.5WCSQFS5.js} +1 -1
- package/dist/preview/{chunk.RJ7UV3XI.js → chunk.64K5ELSQ.js} +1 -1
- package/dist/preview/{chunk.2T24FYAO.js → chunk.67S2UWBT.js} +1 -1
- package/dist/preview/{chunk.FXCKKVT5.js → chunk.6A3KTD66.js} +1 -1
- package/dist/preview/chunk.6BBUTKFC.js +23 -0
- package/dist/preview/chunk.6IMRCKB4.js +1 -0
- package/dist/preview/chunk.6L6RUOSF.js +5 -0
- package/dist/preview/{chunk.ZGJUCVT5.js → chunk.6TBQV3NO.js} +1 -1
- package/dist/preview/chunk.6ZRVVRDQ.js +1 -0
- package/dist/preview/{chunk.4VTUC5TF.js → chunk.7FI75ZVE.js} +1 -1
- package/dist/preview/{chunk.NKUNCQB3.js → chunk.7KX36ENH.js} +1 -1
- package/dist/preview/{chunk.JPJHM62B.js → chunk.7LPHWJB4.js} +1 -1
- package/dist/preview/chunk.7MDGPTYF.js +1 -0
- package/dist/preview/{chunk.JEQ6CA5M.js → chunk.7PWLRRUS.js} +2 -2
- package/dist/preview/{chunk.YBQUP3KE.js → chunk.7TACFS7Q.js} +1 -1
- package/dist/preview/{chunk.DIVANC3G.js → chunk.7THS3DLZ.js} +1 -1
- package/dist/preview/{chunk.5W7EGQCQ.js → chunk.7XGU6KVF.js} +2 -2
- package/dist/preview/chunk.7ZLCA3WK.js +1 -0
- package/dist/preview/{chunk.4BSEYZMS.js → chunk.ARGEGV5T.js} +1 -1
- package/dist/preview/{chunk.3KF5RYPW.js → chunk.BSWR5SGX.js} +1 -1
- package/dist/preview/{chunk.BBMX3IIO.js → chunk.BWMPC7LK.js} +1 -1
- package/dist/preview/{chunk.55C7WO4X.js → chunk.CEJIH3CN.js} +1 -1
- package/dist/preview/{chunk.F5756PXX.js → chunk.CEOQY5KS.js} +2 -2
- package/dist/preview/{chunk.NZFO6BM3.js → chunk.CGRX6SDE.js} +1 -1
- package/dist/preview/{chunk.C67TMA4U.js → chunk.CPK6CYKN.js} +1 -1
- package/dist/preview/{chunk.T552MHMU.js → chunk.CVN2XFMF.js} +1 -1
- package/dist/preview/{chunk.MGG5DH2S.js → chunk.D4F6QX5L.js} +1 -1
- package/dist/preview/{chunk.M3HLZX6Q.js → chunk.D6ODKMOV.js} +1 -1
- package/dist/preview/{chunk.RECTEAG4.js → chunk.DDSAFU3B.js} +1 -1
- package/dist/preview/{chunk.UJF6YTEO.js → chunk.DG3YNOH3.js} +1 -1
- package/dist/preview/chunk.DGYWNM5U.js +1 -0
- package/dist/preview/{chunk.NBB5ALVJ.js → chunk.DHO3QZYK.js} +1 -1
- package/dist/preview/{chunk.4QBW46XV.js → chunk.DJGZOPAS.js} +1 -1
- package/dist/preview/{chunk.2MWEYNVH.js → chunk.DX7RGK5G.js} +1 -1
- package/dist/preview/{chunk.CZI6J5CE.js → chunk.EA2KYBBR.js} +1 -1
- package/dist/preview/{chunk.DWMFLLJO.js → chunk.EEGVI266.js} +1 -1
- package/dist/preview/{chunk.BQWMHHAZ.js → chunk.EHLV3LND.js} +2 -2
- package/dist/preview/{chunk.3MPLUSVY.js → chunk.EJC7ACZT.js} +1 -1
- package/dist/preview/{chunk.6NYSB6OZ.js → chunk.EJIQDMLU.js} +1 -1
- package/dist/preview/{chunk.QQUZ5RTQ.js → chunk.EOSN5DWW.js} +1 -1
- package/dist/preview/{chunk.2QALBEWP.js → chunk.EPSYX2SF.js} +1 -1
- package/dist/preview/chunk.EUXAIG73.js +1 -0
- package/dist/preview/{chunk.S4QSZRKH.js → chunk.EZQK23AB.js} +1 -1
- package/dist/preview/{chunk.ZTHZHBVN.js → chunk.F5O3HR7X.js} +1 -1
- package/dist/preview/chunk.F6MY6WJ4.js +1 -0
- package/dist/preview/{chunk.UVMHC6VM.js → chunk.F7KVEWFH.js} +1 -1
- package/dist/preview/{chunk.FJXKQZZS.js → chunk.FIUPDGUZ.js} +1 -1
- package/dist/preview/chunk.FNSVGSZI.js +1 -0
- package/dist/preview/chunk.FOHZPYUV.js +1 -0
- package/dist/preview/chunk.FW6M6GIU.js +32 -0
- package/dist/preview/{chunk.IJVR7ZL7.js → chunk.G5AF5IXL.js} +1 -1
- package/dist/preview/{chunk.SCN6IYDG.js → chunk.G767NLBH.js} +1 -1
- package/dist/preview/{chunk.X7HMTN3Z.js → chunk.GFBE4VNT.js} +1 -1
- package/dist/preview/{chunk.U5Q7EVZQ.js → chunk.GFOZVQBQ.js} +1 -1
- package/dist/preview/{chunk.KJAOJTZZ.js → chunk.GKYJQE5A.js} +1 -1
- package/dist/preview/{chunk.YCMMATFK.js → chunk.GOVRX2YX.js} +1 -1
- package/dist/preview/{chunk.U3CV227I.js → chunk.H33XWGAY.js} +1 -1
- package/dist/preview/{chunk.DGDOZHYK.js → chunk.H4BPTMED.js} +1 -1
- package/dist/preview/chunk.HLKDYI6J.js +1 -0
- package/dist/preview/{chunk.C4LC2UEU.js → chunk.HPFEYMGP.js} +1 -1
- package/dist/preview/{chunk.CLJKQLK2.js → chunk.HT35PAHI.js} +2 -2
- package/dist/preview/{chunk.6VG2LCES.js → chunk.HXRHEPPJ.js} +1 -1
- package/dist/preview/{chunk.LZNHTROY.js → chunk.IXYG65TM.js} +1 -1
- package/dist/preview/chunk.IZDB777E.js +1 -0
- package/dist/preview/{chunk.ZQSV5XVB.js → chunk.JAPTTM6Y.js} +1 -1
- package/dist/preview/{chunk.CUA7F3YJ.js → chunk.JCKIJSW7.js} +1 -1
- package/dist/preview/{chunk.WAIIXXVI.js → chunk.JLNTE5CH.js} +2 -2
- package/dist/preview/{chunk.5FQHZVE3.js → chunk.JNK5WBSU.js} +1 -1
- package/dist/preview/chunk.JREA2XDG.js +1 -0
- package/dist/preview/{chunk.CHG522KL.js → chunk.KBJ3UUER.js} +1 -1
- package/dist/preview/{chunk.VBHV4TLG.js → chunk.KHRS2SKB.js} +1 -1
- package/dist/preview/{chunk.CZUUFO6A.js → chunk.KJPLX72N.js} +1 -1
- package/dist/preview/{chunk.7LAXSQQY.js → chunk.KZUHXOZU.js} +2 -2
- package/dist/preview/{chunk.R65YX332.js → chunk.L3MLGFIS.js} +1 -1
- package/dist/preview/{chunk.RXUL6P7Y.js → chunk.L6P55HFW.js} +1 -1
- package/dist/preview/{chunk.J4NY2K2A.js → chunk.LDWWUKKX.js} +1 -1
- package/dist/preview/{chunk.RIP2SAQ5.js → chunk.LHCGC3K6.js} +1 -1
- package/dist/preview/{chunk.IQCMV5WD.js → chunk.LNKY6MT4.js} +1 -1
- package/dist/preview/chunk.LQ5J6YQW.js +1 -0
- package/dist/preview/{chunk.O2XPLDMM.js → chunk.MEAUTBVM.js} +1 -1
- package/dist/preview/chunk.MEBKTW7H.js +17 -0
- package/dist/preview/{chunk.K6EKSURO.js → chunk.MFMC35ET.js} +1 -1
- package/dist/preview/chunk.MJ4T6YXI.js +1 -0
- package/dist/preview/{chunk.SWY6DIE4.js → chunk.MKJV3BM5.js} +3 -3
- package/dist/preview/chunk.ML4X7VVK.js +1 -0
- package/dist/preview/{chunk.ZOSTOVXR.js → chunk.MM7MLBGB.js} +1 -1
- package/dist/preview/{chunk.NCBUECIW.js → chunk.MQNW3O67.js} +1 -1
- package/dist/preview/{chunk.CVVNHQPO.js → chunk.MT252WP4.js} +1 -1
- package/dist/preview/{chunk.VKQONZKR.js → chunk.MWWNKM3I.js} +1 -1
- package/dist/preview/chunk.N3MXLORL.js +3 -0
- package/dist/preview/{chunk.SUYYDJGZ.js → chunk.NH3VXTGX.js} +1 -1
- package/dist/preview/{chunk.IRPMGHZN.js → chunk.NI4OPHTL.js} +1 -1
- package/dist/preview/chunk.NNGG7RCO.js +1 -0
- package/dist/preview/{chunk.MZSWWMX6.js → chunk.NXHEOHRR.js} +1 -1
- package/dist/preview/{chunk.A5ENJJZN.js → chunk.O5RPSUXV.js} +1 -1
- package/dist/preview/{chunk.CM7EDQ4E.js → chunk.OKHXXIMN.js} +1 -1
- package/dist/preview/chunk.OOQG2AEF.js +1 -0
- package/dist/preview/{chunk.MYR36HW4.js → chunk.OPMGQS5J.js} +1 -1
- package/dist/preview/{chunk.TUVPQLFL.js → chunk.OUF2QFZL.js} +1 -1
- package/dist/preview/{chunk.6QMRDSTD.js → chunk.OVSKPBPS.js} +1 -1
- package/dist/preview/chunk.OYMN3IFX.js +1 -0
- package/dist/preview/{chunk.3HFBHLXC.js → chunk.P43LPXXJ.js} +1 -1
- package/dist/preview/{chunk.FSZQTX3K.js → chunk.PGT4ZQDG.js} +4 -4
- package/dist/preview/{chunk.5IM2X3VT.js → chunk.PQTXM4VY.js} +1 -1
- package/dist/preview/{chunk.U2DZE7A5.js → chunk.Q6GEPVQ7.js} +1 -1
- package/dist/preview/{chunk.HMV4ILAC.js → chunk.QDDDKEBH.js} +1 -1
- package/dist/preview/{chunk.6KYTCEIH.js → chunk.QJJWAYHB.js} +1 -1
- package/dist/preview/{chunk.QAERSZVB.js → chunk.QK4QZVQG.js} +1 -1
- package/dist/preview/{chunk.XAN7QXMQ.js → chunk.QKRQPUCE.js} +1 -1
- package/dist/preview/{chunk.I3ADXJQW.js → chunk.QNWGDG2Z.js} +1 -1
- package/dist/preview/{chunk.NZ5TJKPT.js → chunk.QVBP4UZG.js} +2 -2
- package/dist/preview/{chunk.YTRUZ56A.js → chunk.RDUGUC7R.js} +1 -1
- package/dist/preview/{chunk.TVNY7F64.js → chunk.RHIP2UYE.js} +1 -1
- package/dist/preview/{chunk.PYGNO2AV.js → chunk.RJ7VSWTA.js} +3 -3
- package/dist/preview/{chunk.LEZGBHPZ.js → chunk.RO3D2RNP.js} +1 -1
- package/dist/preview/{chunk.KOVTQCHX.js → chunk.S2BMI23H.js} +1 -1
- package/dist/preview/{chunk.XJ4JYROM.js → chunk.SPJ34VHA.js} +1 -1
- package/dist/preview/{chunk.LZ3HO3HM.js → chunk.T6KOL7TW.js} +1 -1
- package/dist/preview/{chunk.BJ3G7J2Z.js → chunk.T6UJEXFL.js} +3 -2
- package/dist/preview/{chunk.T4QRIJE4.js → chunk.TBEKEHFS.js} +1 -1
- package/dist/preview/chunk.TO3ZKCA2.js +1 -0
- package/dist/preview/{chunk.QILGAV7H.js → chunk.TQ3MNB6K.js} +1 -1
- package/dist/preview/{chunk.F5XWYO5W.js → chunk.TRP66PHK.js} +1 -1
- package/dist/preview/{chunk.QODVFVWE.js → chunk.TSZ2S3VG.js} +1 -1
- package/dist/preview/{chunk.DWPM7AWA.js → chunk.TTM5GQ2U.js} +1 -1
- package/dist/preview/chunk.TUBY6SV3.js +1 -0
- package/dist/preview/{chunk.7QWGIGHM.js → chunk.U5KJQFAP.js} +1 -1
- package/dist/preview/chunk.U6V4KZF5.js +1 -0
- package/dist/preview/chunk.UJ7RTNT4.js +1 -0
- package/dist/preview/{chunk.MR776WQ2.js → chunk.UQZ2P6KD.js} +1 -1
- package/dist/preview/{chunk.OXXZGPJZ.js → chunk.UZKBFI52.js} +1 -1
- package/dist/preview/{chunk.HIJ72QX6.js → chunk.V5JB5UJS.js} +1 -1
- package/dist/preview/{chunk.3I2SGKKF.js → chunk.VDFQFLTU.js} +1 -1
- package/dist/preview/{chunk.I6HIVTXU.js → chunk.VGYG2IBZ.js} +1 -1
- package/dist/preview/chunk.VICBF3MQ.js +2 -0
- package/dist/preview/{chunk.TD2V74XU.js → chunk.VL3YDD7D.js} +1 -1
- package/dist/preview/{chunk.A7JORJJL.js → chunk.VPFUOTY7.js} +1 -1
- package/dist/preview/{chunk.UWEFODVV.js → chunk.VUDNQOOX.js} +1 -1
- package/dist/preview/{chunk.YIDNZTON.js → chunk.VVIQSFM4.js} +1 -1
- package/dist/preview/{chunk.J65CZJIC.js → chunk.W332P5T3.js} +1 -1
- package/dist/preview/{chunk.S6IKR6RD.js → chunk.W3TJF4EH.js} +1 -1
- package/dist/preview/{chunk.7FTATAH2.js → chunk.W5O5F4FT.js} +1 -1
- package/dist/preview/chunk.W6L2VAJG.js +2 -0
- package/dist/preview/{chunk.QG3LV4RH.js → chunk.WGH2P2YL.js} +1 -1
- package/dist/preview/{chunk.KV3N6VRG.js → chunk.WS5ORRGS.js} +1 -1
- package/dist/preview/{chunk.7HNMG6LG.js → chunk.WU6D3SPL.js} +1 -1
- package/dist/preview/{chunk.MSWOETXN.js → chunk.X2UYEA7H.js} +1 -1
- package/dist/preview/{chunk.FBDCHJS2.js → chunk.X45EITTK.js} +1 -1
- package/dist/preview/{chunk.JIEBGUCA.js → chunk.X7U3JMBR.js} +1 -1
- package/dist/preview/chunk.XSM4OTF4.js +1 -0
- package/dist/preview/{chunk.5A5DI36V.js → chunk.XTHSPLZZ.js} +1 -1
- package/dist/preview/{chunk.TS5APXWC.js → chunk.Y5WQD6KV.js} +1 -1
- package/dist/preview/{chunk.3QPMFUMV.js → chunk.YXVUJ3NB.js} +1 -1
- package/dist/preview/{chunk.F5STM4DX.js → chunk.Z22C2JJ4.js} +1 -1
- package/dist/preview/{chunk.BBLA4PSP.js → chunk.Z2BCOZDZ.js} +1 -1
- package/dist/preview/{chunk.BZXJKWNI.js → chunk.Z3TK2LJM.js} +1 -1
- package/dist/preview/chunk.ZGLOXN7O.js +1 -0
- package/dist/preview/{chunk.UJM5EZDM.js → chunk.ZLQIGZXO.js} +1 -1
- package/dist/preview/{chunk.FUTSLXWN.js → chunk.ZONRIOIA.js} +1 -1
- package/dist/preview/{chunk.NTAC5NNE.js → chunk.ZY3NAJDM.js} +1 -1
- package/dist/preview/index.html +55 -55
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.2QOB62XU.js +0 -1
- package/dist/preview/chunk.36FKQJFM.js +0 -2
- package/dist/preview/chunk.3A3DCALP.js +0 -1
- package/dist/preview/chunk.3GPYKWAD.js +0 -1
- package/dist/preview/chunk.3ZP6IDUC.js +0 -1
- package/dist/preview/chunk.53HW224Y.js +0 -1
- package/dist/preview/chunk.AW74DZ5V.js +0 -17
- package/dist/preview/chunk.CCCSZRKU.js +0 -1
- package/dist/preview/chunk.DBSSCJQM.js +0 -1
- package/dist/preview/chunk.DW6KXAUM.js +0 -1
- package/dist/preview/chunk.HHQUCFN4.js +0 -1
- package/dist/preview/chunk.HPWMCS3H.js +0 -23
- package/dist/preview/chunk.HRLCDBMO.js +0 -1
- package/dist/preview/chunk.I7ODVOO5.js +0 -1
- package/dist/preview/chunk.IANOWT3Z.js +0 -1
- package/dist/preview/chunk.IFPJPJ4M.js +0 -1
- package/dist/preview/chunk.IUVRJDL3.js +0 -5
- package/dist/preview/chunk.J4CSY2D5.js +0 -2
- package/dist/preview/chunk.JJIKTTXB.js +0 -1
- package/dist/preview/chunk.KDOJC4FX.js +0 -1
- package/dist/preview/chunk.KLZPUTMU.js +0 -1
- package/dist/preview/chunk.LQ2PDW2M.js +0 -32
- package/dist/preview/chunk.MNWP3TPN.js +0 -1
- package/dist/preview/chunk.NILR2BWR.js +0 -1
- package/dist/preview/chunk.NNYKLENL.js +0 -1
- package/dist/preview/chunk.PZHCWMKT.js +0 -1
- package/dist/preview/chunk.QVID5WHS.js +0 -1
- package/dist/preview/chunk.RHV73CBA.js +0 -3
- package/dist/preview/chunk.RP6C2IUM.js +0 -1
- package/dist/preview/chunk.RPHZY7N4.js +0 -1
- package/dist/preview/chunk.UYBSVE2W.js +0 -1
- package/dist/preview/chunk.WMZ2BINI.js +0 -1
- package/dist/preview/chunk.X2RHBTJI.js +0 -1
- package/dist/preview/chunk.X3FPVFFB.js +0 -1
- package/dist/preview/chunk.X4PFLIXB.js +0 -1
- package/dist/preview/chunk.YR7DKU5T.js +0 -1
- package/dist/preview/chunk.ZBK3FCVE.js +0 -1
- package/dist/preview/chunk.ZH5L746C.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./chunk.WVUJXDXZ.js";import{k as m,m as i}from"./chunk.NI4OPHTL.js";import"./chunk.U5KJQFAP.js";import"./chunk.FOHZPYUV.js";import"./chunk.IXYG65TM.js";import"./chunk.W6L2VAJG.js";import"./chunk.N3MXLORL.js";import"./chunk.TQ3MNB6K.js";import"./chunk.VGYG2IBZ.js";import"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";function a(t){let r=new Map;return(s,o)=>{let e=o.kind,n=r.get(e);return n===void 0&&r.set(e,n=i(t,e).length),n===0?{}:m(t,s,o).values}}export{a as computedOn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk.UZKBFI52.js";import"./chunk.MFMC35ET.js";import"./chunk.GKYJQE5A.js";import"./chunk.EZQK23AB.js";import"./chunk.QDVGHI7R.js";import"./chunk.M5FP4Y4Q.js";import"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{d as SAVE_DEBOUNCE_MS,i as accepts,a as createPressReader,f as createSaver,g as fillPrefills,h as judgePress,b as markPresses,k as prefillOf,c as quietPictures,e as saveDebounceOf,j as writesBack};
|
|
@@ -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{l as T}from"./chunk.RD2FSSLV.js";import{j as D}from"./chunk.VVIQSFM4.js";import{G as w,Ra as Q,Y as R,c as $,ga as v,ha as q,ia as Y,x as z}from"./chunk.JCKIJSW7.js";import{Ac as U,C as W,_b as H,hc as j,ib as B,pc as I,ud as K,vd as G}from"./chunk.6L6RUOSF.js";import{b as m}from"./chunk.AJZBJBMO.js";function J(e,n,t={}){let r=e.graph.getNode(n);if(!r)return[];let i=t.principal?new Set(e.permittedMutations(t.principal).map(s=>s.name)):void 0,c=r.kind,d=e.schema.tryDefinition(c);if(!d)return[];let o=e.seenFor,a=o?H.keptFrom?.(e,o)?.(r):void 0,l=new Map;for(let s of e.allMutations()){let u=s.subject;if(!u||!(u.kinds==="*"||u.kinds.includes(c))||i&&!i.has(s.name))continue;let h=s.input.shape??{};for(let p of U(s,d)){if(a?.(p)||!j(s,e.schema,e.graph,n,p,o&&B(e.schema,o)))continue;let M=p in h,_=[];for(let g of Object.keys(h)){if(g===u.arg||g===p||se(h[g]))continue;let S=I(s.input).find(E=>E.name===g);_.push({name:g,...S?{kinds:S.kinds}:{},...S?{candidates:S.kinds.includes("*")?e.graph.allNodes().map(E=>E.id):S.kinds.flatMap(E=>e.graph.nodesOfKind(E).map(ae=>ae.id))}:{},shape:D(s.input,g)})}let ie={field:p,mutation:s.name,title:s.title??s.name,shape:M?D(s.input,p):{type:"unknown"},takesValue:M,alternatives:[],open:_,clearable:M&&(s.clearable?.includes(p)??!1),call:g=>({name:s.name,args:M?{[u.arg]:n,[p]:g}:{[u.arg]:n}})};l.set(p,[...l.get(p)??[],ie])}}return[...l.values()].map(s=>{let u=[...s.filter(p=>p.takesValue),...s.filter(p=>!p.takesValue)],[b,...h]=u;return{...b,alternatives:h}})}function se(e){let n=W(e)?.type;return n==="optional"||n==="default"||n==="nullable"}var C=m(w(),1);function Ae(e){let{store:n,principal:t}=v(),r=Y(),i=(0,C.useMemo)(()=>e===null?[]:J(n,e,{principal:t}),[n,e,r,t]),c=(0,C.useCallback)((d,o,a={})=>{let l=d.call(o);n.apply({name:l.name,args:{...l.args,...a}},{author:t})},[n,t]);return{fields:i,commit:c}}var X=m(w(),1);function pn(){let{brand:e}=v(),n=e?.kit;return(0,X.useMemo)(()=>K(n),[n])}function fn(e,n){let t=G(e,n),r={...t.color!==void 0?{color:t.color}:{},...t.pattern!==void 0?{pattern:t.pattern}:{},...t.width!==void 0?{width:t.width}:{},...t.cap!==void 0?{cap:t.cap}:{},...t.opacity!==void 0?{opacity:t.opacity}:{}};return{connector:t,style:T(n,{[n]:r})}}var O=m(w(),1);var x=m(R(),1);function de(e){let n=e?.hint;return typeof n=="string"&&n.length>0?n:void 0}function le(e){if(e instanceof Error&&e.message)return e.message;let n=String(e);return n==="[object Object]"?"The view threw without a message.":n}var Z='a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"]), [contenteditable="true"]';function ee(){return document.activeElement===null||document.activeElement===document.body}var ne=class extends O.Component{static contextType=Q;state={};static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,t){console.error(`[graview] the ${this.props.view??"view"} of ${this.props.kind} threw while rendering`,n,t.componentStack),this.context?.(n,{module:"@graview/react"}),this.props.onCaught?.(n)}panel=(0,O.createRef)();getSnapshotBeforeUpdate(){if(typeof document>"u")return null;let n=document.activeElement,t=this.panel.current;return t&&n===t?{onPanel:!0,focused:n,parent:t.parentNode,before:t.previousSibling}:{onPanel:!1,focused:n}}componentDidUpdate(n,t,r){if(r&&!t.error&&this.state.error&&r.focused&&r.focused!==document.body&&!r.focused.isConnected&&ee()&&this.panel.current?.focus(),r?.onPanel&&t.error&&!this.state.error&&ee()){let d=r.before?r.before.nextSibling:r.parent?.firstChild??null;if(d instanceof HTMLElement){let o=d.matches(Z)?d:d.querySelector(Z);o?o.focus():(d.hasAttribute("tabindex")||d.setAttribute("tabindex","-1"),d.focus())}}if(!this.state.error)return;let i=n.reset??[],c=this.props.reset??[];(i.length!==c.length||i.some((d,o)=>!Object.is(d,c[o])))&&this.setState({error:void 0})}render(){let{error:n}=this.state;if(!n)return this.props.children;let t=de(n);return(0,x.jsxs)("div",{ref:this.panel,role:"alert",tabIndex:-1,"data-graview-view-error":this.props.kind,style:{display:"flex",flexDirection:"column",gap:"0.375rem",padding:"var(--graview-pad, 12px)",height:"100%",overflow:"auto",boxSizing:"border-box",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-panel-warning, #fdf3ec)",color:"var(--graview-ink, #1a1a1a)",font:"var(--graview-font-body, 13px/1.45 system-ui)",fontSize:"0.875rem",lineHeight:1.45},children:[(0,x.jsx)("strong",{style:{color:"var(--graview-warn, #b4462a)"},children:this.props.view?`${this.props.view} could not draw`:"This view could not draw"}),this.props.said===""?null:(0,x.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:this.props.said??this.props.kind}),(0,x.jsx)("span",{children:le(n)}),t?(0,x.jsx)("span",{style:{color:"var(--graview-ink-muted, #555)"},children:t}):null]})}};var y=m(w(),1);var re=m(R(),1),V=(0,y.createContext)([]);function xn({sections:e,children:n}){let t=(0,y.useContext)(V),r=(0,y.useMemo)(()=>[...t,...e.filter(i=>!t.includes(i))],[t,e]);return(0,re.jsx)(V.Provider,{value:r,children:n})}function te(){let e=(0,y.useContext)(V),n=q()?.menuSections;return(0,y.useMemo)(()=>n?[...e,...n.filter(t=>!e.includes(t))]:e,[e,n])}function bn(){let e=te();return(0,y.useCallback)(n=>{for(let t of e)try{t(n)?.prepare?.()}catch{}},[e])}function wn(e){let n=te();if(e===null||n.length===0)return{start:[],end:[]};let t=n.flatMap(r=>{try{let i=r(e);return i&&((i.items?.length??0)>0||i.render||i.mode)?[i]:[]}catch{return[]}});return{start:t.filter(r=>r.at==="start"),end:t.filter(r=>r.at!=="start")}}var N=new WeakMap;function Sn(e,n){n?N.set(e,n):N.delete(e)}function En(e){return e?N.get(e):void 0}var P,ce,F=new Set;function Pn(e){F.add(e)}function kn(){return ce??=Promise.all([(__graviewPreload(import.meta.url,["./chunk.AJZBJBMO.js"]),import("./chunk.Y7QDQ3WF.js")),...[...F].map(e=>e())]).then(([e])=>void(P=e.sectionUnder))}function Mn(e){return e&&P?P(e):void 0}var Rn=()=>P===void 0&&F.size>0,Cn=e=>P===void 0&&e?.getRootNode()?.host?.hasAttribute("data-worker-view")===!0;var ue=m(w(),1);function Tn(){return v().activity}var A=(e,n)=>e.length*n*.58;var pe=156,fe=2,k=pe-18,me=7.1,ye=16;function ge(e,n){let t=0,r=k;for(let i of e.split(" ")){let c=n(i),d=r+n(" ")+c;if(d<=k)r=d;else{let o=Math.ceil(c/k)||1;t+=o,r=c-(o-1)*k}}return t}var he=16.25,oe=27,xe=(e,n)=>{let t=Math.ceil(e.length*me/k);return n?Math.max(oe,Math.ceil(Math.max(t,ge(e,n))*he)+6):Math.max(oe,t*ye+6)};function Nn(e,n,t){return e.length===0?0:10+e.reduce((r,i)=>r+xe(i,t),0)+(e.length-1)*fe}var be=27,we=8,Fn=4,ve=64,Ln=e=>Math.max(1,Math.min(we,e)),_n=e=>e*be+ve;var f=m(w(),1);function jn(e,{units:n,target:t=0,legibleAt:r=260}){let[i,c]=(0,f.useState)(n);(0,f.useEffect)(()=>{let o=e.current;if(o===null||typeof ResizeObserver>"u")return;let a=new ResizeObserver(([l])=>{let s=l?.contentRect.width??0;s>0&&c(s)});return a.observe(o),()=>a.disconnect()},[e]);let d=i/n;return{scale:d,width:i,touchable:d*t>=24,legible:i>=r}}function In(e="--graview-font-body",n="sans-serif"){let t=(0,f.useRef)(void 0),r=(0,f.useMemo)(()=>{if(typeof getComputedStyle!="function"||typeof document>"u")return n;let i=getComputedStyle(document.documentElement).getPropertyValue(e).trim();return i.length>0?i:n},[e,n]);return(0,f.useMemo)(()=>{t.current===void 0&&(t.current=typeof document>"u"?null:document.createElement("canvas").getContext("2d")??null);let i=t.current;return i===null?A:(c,d)=>{i.font=`${d}px ${r}`;let o=i.measureText(c).width;return o>0?o:A(c,d)}},[r])}var Un=(0,f.createContext)(void 0);var L=3;function Se(e){let n=$(e),t=n.focusId;if(!t)return null;if(n.within?.view){let[i]=z(t);if(i)return{at:`screen:${i}`,audience:!0}}return{at:t,audience:!1}}var Ee=102,Pe=32;function $n(e,n,t){let r=[],i=new Map,c=new Map,d=0;for(let o of e){let a=Se(o.stop),l=a?n(a.at):null;if(!a||!l){o.name&&r.push({kind:"edge",presence:o,point:{x:t-8,y:Ee+d++*Pe}});continue}if(!o.name){let p=c.get(a.at);c.set(a.at,{n:(p?.n??0)+1,box:l});continue}let s=i.get(a.at)??[];if(s.push(o),i.set(a.at,s),s.length>L)continue;let u=l,b=s.length-1,h=a.audience?{x:u.x+u.width*.5+(b-1)*26,y:u.y+Math.min(u.height,24)}:{x:u.x+u.width*.5-26-b*26,y:u.y+u.height-4};r.push({kind:"person",presence:o,point:h,at:a.at,index:b,of:s.length,audience:a.audience})}for(let[o,a]of i){if(a.length<=L)continue;let l=n(o);l&&r.push({kind:"count",at:o,point:{x:l.x+l.width*.5+2*26+18,y:l.y+l.height-4},n:a.length-L})}for(let[o,{n:a,box:l}]of c)r.push({kind:"count",at:o,point:{x:l.x+l.width*.5+40,y:l.y+l.height-4},n:a});for(let o of e)if(o.name){if(o.robot?.at&&o.robot.mode!=="docked"){let a=n(o.robot.at);a&&r.push({kind:"robot",presence:o,point:{x:a.x+a.width/2+22,y:a.y+a.height-4},mode:o.robot.mode})}if(o.over){let a=n(o.over);a&&r.push({kind:"over",presence:o,box:a})}}return r}export{Tn as a,A as b,pe as c,fe as d,oe as e,Nn as f,be as g,Fn as h,ve as i,Ln as j,_n as k,jn as l,In as m,J as n,Ae as o,pn as p,fn as q,$n as r,ne as s,xn as t,bn as u,wn as v,Sn as w,En as x,Pn as y,kn as z,Mn as A,Rn as B,Cn as C};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Y,e as D}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Y,e as D}from"./chunk.MWWNKM3I.js";import{t as O,y as L}from"./chunk.RJ7VSWTA.js";import{$a as U,G as ro,Oa as q,Ta as F,Xa as G,Y as S,ga as B,ia as _}from"./chunk.JCKIJSW7.js";import{a as j}from"./chunk.SDO3U72B.js";import{Hb as z,Je as E}from"./chunk.6L6RUOSF.js";import{b as x}from"./chunk.AJZBJBMO.js";var e=x(ro(),1);var I=x(S(),1),V=q(j(()=>(__graviewPreload(import.meta.url,["./chunk.25VJPUDH.js","./chunk.G767NLBH.js","./chunk.RO3D2RNP.js","./chunk.MEAUTBVM.js","./chunk.OKHXXIMN.js","./chunk.NH3VXTGX.js","./chunk.6IMRCKB4.js","./chunk.RDUGUC7R.js","./chunk.6TBQV3NO.js","./chunk.MT252WP4.js","./chunk.VVIQSFM4.js","./chunk.TQ3MNB6K.js","./chunk.VGYG2IBZ.js","./chunk.RJ7VSWTA.js","./chunk.P43LPXXJ.js","./chunk.JCKIJSW7.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QK4QZVQG.js")))),X=V.part((o,n)=>(0,I.jsx)(o.SuggestedCount,{...n}),{quiet:!0}),xo=V.part((o,n)=>(0,I.jsx)(o.SuggestedList,{...n}),{quiet:!0,as:"div"}),vo=V.part((o,n)=>(0,I.jsx)(o.SuggestedUpdates,{...n}),{quiet:!0,as:"div"});var t=x(S(),1),io=O.part((o,n)=>(0,t.jsx)(o.InboxPane,{...n}),{what:"The inbox"}),so=`
|
|
2
2
|
.graview-bar-tool{position:relative;display:inline-flex;align-items:center;justify-content:center;gap:6px;flex:0 0 auto;box-sizing:border-box;min-width:${L}px;height:${L}px;margin:0;padding:0;border-radius:8px;border:1px solid transparent;background:none;box-shadow:none;font:inherit;font-size:.875rem;font-weight:500;letter-spacing:normal;text-transform:none;white-space:nowrap;color:var(--graview-ink-muted);cursor:pointer;text-decoration:none}
|
|
3
3
|
.graview-bar-tool:is(:hover,[aria-expanded=true]){border-color:var(--graview-edge);color:var(--graview-ink)}
|
|
4
4
|
.graview-bar-tool[data-running]{color:var(--graview-accent)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as b,b as c,c as d,d as e,e as f,f as g,g as h,h as i,i as j,j as k,k as l,l as m,m as n,n as o,o as p}from"./chunk.64K5ELSQ.js";import"./chunk.G4JJXA63.js";import{a}from"./chunk.TBY5IR7C.js";import"./chunk.PQTXM4VY.js";import"./chunk.BIDL7GQD.js";import"./chunk.7KX36ENH.js";import"./chunk.SPJ34VHA.js";import"./chunk.XOZU4OFA.js";import"./chunk.KBJ3UUER.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.4O64QV2Y.js";import"./chunk.OYMN3IFX.js";import"./chunk.UQZ2P6KD.js";import"./chunk.WVUJXDXZ.js";import"./chunk.NI4OPHTL.js";import"./chunk.U5KJQFAP.js";import"./chunk.FOHZPYUV.js";import"./chunk.IXYG65TM.js";import"./chunk.W6L2VAJG.js";import"./chunk.N3MXLORL.js";import"./chunk.6TBQV3NO.js";import"./chunk.MT252WP4.js";import"./chunk.VVIQSFM4.js";import"./chunk.TQ3MNB6K.js";import"./chunk.VGYG2IBZ.js";import"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{j as draftAnswer,i as draftFromLens,c as draftSight,m as draftView,b as isDraftFailure,d as judgeLens,e as lensEditOf,g as lensFromSpec,a as mayChangeDeclaration,k as recipeDraft,h as recipeOfLens,n as refineDraft,p as runDraftTool,f as takeBackEditOf,l as templateDraft,o as withReaderLenses};
|
|
@@ -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{a as re}from"./chunk.T6UJEXFL.js";import{p as De,q as te,t as G,u as Ie,y as oe}from"./chunk.3CLTABGP.js";import{m as Z,n as Ee,o as Te,p as ee,q as ne}from"./chunk.RD2FSSLV.js";import{b as xe}from"./chunk.TQ3MNB6K.js";import{b as Me,d as J,e as X,g as Ae,q as Pe}from"./chunk.RJ7VSWTA.js";import{b as ve}from"./chunk.P43LPXXJ.js";import{D as H,F as U,G as R,J as ye,Ma as Se,Na as be,Oa as I,Sa as $,T as we,Ua as Q,Y as E,ga as b,ha as V,ia as ke,m as me,v as he,z as ge}from"./chunk.JCKIJSW7.js";import{a as D}from"./chunk.SDO3U72B.js";import{Zd as fe,qa as q,ud as de,zd as pe}from"./chunk.6L6RUOSF.js";import{b as w}from"./chunk.AJZBJBMO.js";var x=w(R(),1),P=w(E(),1),ie=I(D(()=>(__graviewPreload(import.meta.url,["./chunk.JCKIJSW7.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.BWMPC7LK.js")))),Ne=ie.part(e=>(0,P.jsx)(e.HoverChipDoor,{}),{quiet:!0}),Re="A",K=I(D(()=>(__graviewPreload(import.meta.url,["./chunk.KHRS2SKB.js","./chunk.T6PU3NKP.js","./chunk.U6V4KZF5.js","./chunk.6ZRVVRDQ.js","./chunk.JLNTE5CH.js","./chunk.DDSAFU3B.js","./chunk.4QMAYVPU.js","./chunk.ZONRIOIA.js","./chunk.NXHEOHRR.js","./chunk.HJCQ6I3S.js","./chunk.DJGZOPAS.js","./chunk.GFOZVQBQ.js","./chunk.5OS4SYHE.js","./chunk.G767NLBH.js","./chunk.MEAUTBVM.js","./chunk.OKHXXIMN.js","./chunk.NH3VXTGX.js","./chunk.6IMRCKB4.js","./chunk.RDUGUC7R.js","./chunk.TBY5IR7C.js","./chunk.PQTXM4VY.js","./chunk.BIDL7GQD.js","./chunk.7KX36ENH.js","./chunk.QDDDKEBH.js","./chunk.QKRQPUCE.js","./chunk.SPJ34VHA.js","./chunk.XOZU4OFA.js","./chunk.KBJ3UUER.js","./chunk.Q5WEOX3Q.js","./chunk.4O64QV2Y.js","./chunk.OYMN3IFX.js","./chunk.YFVJUHAK.js","./chunk.UQZ2P6KD.js","./chunk.NI4OPHTL.js","./chunk.U5KJQFAP.js","./chunk.FOHZPYUV.js","./chunk.IXYG65TM.js","./chunk.W6L2VAJG.js","./chunk.N3MXLORL.js","./chunk.3CLTABGP.js","./chunk.RD2FSSLV.js","./chunk.CVN2XFMF.js","./chunk.6TBQV3NO.js","./chunk.MT252WP4.js","./chunk.VVIQSFM4.js","./chunk.TQ3MNB6K.js","./chunk.VGYG2IBZ.js","./chunk.RJ7VSWTA.js","./chunk.P43LPXXJ.js","./chunk.JCKIJSW7.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VICBF3MQ.js"))));var We=K.part((e,n)=>(0,P.jsx)(e.InspectorPane,{...n}),{what:"This card's acts"});function He(e){let n=()=>{(typeof navigator>"u"||navigator.onLine!==!1)&&e()},t=globalThis;if(t.requestIdleCallback){let u=t.requestIdleCallback(n,{timeout:5e3});return()=>t.cancelIdleCallback?.(u)}let r=setTimeout(n,2500);return()=>clearTimeout(r)}var Ge=150,Be="[data-graview-pick], [data-graview-view], [data-graview-record], [data-graview-act], [data-graview-field], a[href]";function ze(e){if(e.closest("[data-graview-face='pages'], [data-graview-popover]"))return null;let n=e.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??e.closest("[data-graview-view]")?.getAttribute("data-graview-view");return n?{face:"scene",on:n,about:[n]}:null}function Fe(e){let{store:n,principal:t,providers:r,ai:u}=b(),c=Ie(),p=U(u),o=(0,x.useRef)({aimAt:e,store:n,principal:t,providers:r,prepareSections:c,chipsOn:p});o.current={aimAt:e,store:n,principal:t,providers:r,prepareSections:c,chipsOn:p},(0,x.useEffect)(()=>{if(typeof document>"u")return;let s=null,g=null,k=null,d=v=>{let m=o.current,A=m.chipsOn?m.aimAt(v):null;A&&(k=v,ie.load().then(_=>{k===v&&_.restOn(A,v)},()=>{}))},h=()=>{s&&clearTimeout(s.timer),s=null},l=v=>{let m=o.current,A=m.aimAt(v);if(!A)return;let _=JSON.stringify([A.face,A.on,A.about,A.field,A.place,A.act,m.store.log.length]);_!==g&&(g=_,m.prepareSections(A),K.load().then(Oe=>Oe.prepareActs(m.store,A,{principal:m.principal,providers:m.providers}),()=>{}))},i=v=>v.target instanceof Element?v.target.closest(Be):null,f=v=>{if(v.pointerType==="touch")return;let m=i(v);m!==null&&m===s?.element||(h(),m!==null&&(s={element:m,timer:setTimeout(()=>{s=null,l(m),d(m)},Ge)}))},y=v=>{let m=v.relatedTarget;k!==null&&!(m instanceof Node&&k.contains(m))&&(k=null,ie.current?.leaveRest()),s!==null&&(m instanceof Node&&s.element.contains(m)||h())},S=v=>{if(v.pointerType==="mouse")return;let m=i(v);m&&l(m)},T=v=>{if(!Se())return;let m=i(v);m&&l(m)};return document.addEventListener("pointerover",f,{passive:!0}),document.addEventListener("pointerout",y,{passive:!0}),document.addEventListener("pointerdown",S,{capture:!0,passive:!0}),document.addEventListener("focusin",T),()=>{h(),document.removeEventListener("pointerover",f),document.removeEventListener("pointerout",y),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("focusin",T)}},[])}function dn({placement:e="float",openActs:n,aimAt:t}={}){let{menuAt:r,setMenuAt:u,registerActsDoor:c,ai:p}=b(),{selection:o}=$();Fe(t??ze),(0,x.useEffect)(()=>{if(K.current)return;let h=()=>{y(),K.prefetch()},l=()=>{},i=be(()=>void(l=He(h))),f=["pointerdown","keydown"];for(let S of f)document.addEventListener(S,h,{capture:!0,passive:!0});function y(){i(),l();for(let S of f)document.removeEventListener(S,h,{capture:!0})}return y},[]),(0,x.useEffect)(()=>{if(e==="menu")return c({key:Re,open:n??(h=>{let l=h.getBoundingClientRect(),i=h.closest("[data-graview-pick]")?.getAttribute("data-graview-pick")??h.closest("[data-graview-view]")?.getAttribute("data-graview-view")??void 0;u({x:Math.round(l.left+Math.min(16,l.width/2)),y:Math.round(Math.min(l.bottom,l.top+36)),...i?{on:i}:{}})})}),()=>c(null)},[e,c,u,n]);let s=r!==null||o.length>0&&n===void 0,[g,k]=(0,x.useState)(s);(0,x.useEffect)(()=>{s&&k(!0)},[s]);let d=U(p)?(0,P.jsx)(x.Suspense,{fallback:null,children:(0,P.jsx)(Ne,{})}):null;return!g&&!s?d:(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(x.Suspense,{fallback:null,children:(0,P.jsx)(We,{placement:e,chosen:n===void 0})}),d]})}var j=w(R(),1),Y=w(E(),1),_e=I(D(()=>(__graviewPreload(import.meta.url,["./chunk.KHRS2SKB.js","./chunk.T6PU3NKP.js","./chunk.U6V4KZF5.js","./chunk.6ZRVVRDQ.js","./chunk.MM7MLBGB.js","./chunk.V5JB5UJS.js","./chunk.EHLV3LND.js","./chunk.EPSYX2SF.js","./chunk.JLNTE5CH.js","./chunk.DDSAFU3B.js","./chunk.EOSN5DWW.js","./chunk.T6UJEXFL.js","./chunk.7THS3DLZ.js","./chunk.4QMAYVPU.js","./chunk.ARGEGV5T.js","./chunk.WS5ORRGS.js","./chunk.ZONRIOIA.js","./chunk.NXHEOHRR.js","./chunk.HJCQ6I3S.js","./chunk.DJGZOPAS.js","./chunk.GFOZVQBQ.js","./chunk.MQNW3O67.js","./chunk.67S2UWBT.js","./chunk.7PWLRRUS.js","./chunk.25VJPUDH.js","./chunk.G767NLBH.js","./chunk.MEAUTBVM.js","./chunk.OKHXXIMN.js","./chunk.NH3VXTGX.js","./chunk.6IMRCKB4.js","./chunk.RDUGUC7R.js","./chunk.TBY5IR7C.js","./chunk.PQTXM4VY.js","./chunk.BIDL7GQD.js","./chunk.7KX36ENH.js","./chunk.QDDDKEBH.js","./chunk.QKRQPUCE.js","./chunk.SPJ34VHA.js","./chunk.XOZU4OFA.js","./chunk.KBJ3UUER.js","./chunk.Q5WEOX3Q.js","./chunk.4O64QV2Y.js","./chunk.OYMN3IFX.js","./chunk.YFVJUHAK.js","./chunk.UQZ2P6KD.js","./chunk.WVUJXDXZ.js","./chunk.NI4OPHTL.js","./chunk.U5KJQFAP.js","./chunk.FOHZPYUV.js","./chunk.IXYG65TM.js","./chunk.W6L2VAJG.js","./chunk.N3MXLORL.js","./chunk.MIE4TJRW.js","./chunk.3CLTABGP.js","./chunk.RD2FSSLV.js","./chunk.CVN2XFMF.js","./chunk.6TBQV3NO.js","./chunk.MT252WP4.js","./chunk.VVIQSFM4.js","./chunk.TQ3MNB6K.js","./chunk.VGYG2IBZ.js","./chunk.RJ7VSWTA.js","./chunk.P43LPXXJ.js","./chunk.JCKIJSW7.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.VUDNQOOX.js")))),qe=_e.part((e,n)=>{let t=e.DraftFrame;return(0,Y.jsx)(t,{...n})},{what:"The view"});function hn(e){let{seatTalk:n}=b();return(0,j.useSyncExternalStore)(n.subscribe,()=>n.get().draft!==null,()=>!1)?(0,Y.jsx)(j.Suspense,{fallback:null,children:(0,Y.jsx)(qe,{...e})}):null}var L=w(R(),1),C=w(E(),1),se=I(D(()=>(__graviewPreload(import.meta.url,["./chunk.NXHEOHRR.js","./chunk.4LWWXIM4.js","./chunk.HXRHEPPJ.js","./chunk.QNWGDG2Z.js","./chunk.BJUUSIQY.js","./chunk.QDDDKEBH.js","./chunk.F7KVEWFH.js","./chunk.QKRQPUCE.js","./chunk.SPJ34VHA.js","./chunk.XOZU4OFA.js","./chunk.KBJ3UUER.js","./chunk.U5KJQFAP.js","./chunk.6TBQV3NO.js","./chunk.MT252WP4.js","./chunk.VVIQSFM4.js","./chunk.TQ3MNB6K.js","./chunk.VGYG2IBZ.js","./chunk.RJ7VSWTA.js","./chunk.P43LPXXJ.js","./chunk.JCKIJSW7.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.7TACFS7Q.js")))),Ve=se.part((e,n)=>{let t=e.QuickAskCard;return(0,C.jsx)(t,{...n})},{what:"The quick ask"});function Sn({face:e,on:n=!0}){let{ai:t,aiDesk:r,selection:u,view:c}=b(),p=we()?.open??!1,o=n&&H(t)&&!p,s=Ae(r),g=(0,L.useRef)(null),k=(0,L.useRef)({selection:u,place:c.within?.view});return k.current={selection:u,place:c.within?.view},(0,L.useEffect)(()=>{if(!o)return;let d=Me(r);return d.drawn+=1,d.preload=()=>{se.load().catch(()=>{}),(__graviewPreload(import.meta.url,["./chunk.QNWGDG2Z.js","./chunk.BJUUSIQY.js","./chunk.U5KJQFAP.js","./chunk.VGYG2IBZ.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.HPFEYMGP.js")).catch(()=>{})},J(d),()=>{d.drawn=Math.max(0,d.drawn-1),d.drawn===0&&(d.open=null),J(d)}},[o,r]),(0,L.useEffect)(()=>{if(!o)return;let d=h=>{if(h.defaultPrevented||h.key.toLowerCase()!=="k"||!(h.metaKey||h.ctrlKey)||h.altKey||h.shiftKey)return;let l=g.current?.closest("[data-graview-embed]"),i=h.target,f=!(i instanceof Node)||i===document.body||i===document.documentElement;if(l&&!(f||i instanceof Node&&l.contains(i)))return;h.preventDefault(),se.prefetch();let y=document.activeElement,{selection:S,place:T}=k.current;X(r,{pointed:{...S[0]!==void 0?{on:S[0]}:{},about:S,...T?{place:T}:{}},returnTo:y instanceof HTMLElement&&y!==document.body?y:null})};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[o,r]),o?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)("span",{ref:g,hidden:!0,"data-graview-quick-ask":e}),s?(0,C.jsx)(L.Suspense,{fallback:null,children:(0,C.jsx)(Ve,{face:e,opening:s,close:()=>X(r,null)},s.at)}):null]}):null}var B=w(R(),1),O=w(E(),1),ae=I(D(()=>(__graviewPreload(import.meta.url,["./chunk.4LWWXIM4.js","./chunk.HXRHEPPJ.js","./chunk.QNWGDG2Z.js","./chunk.BJUUSIQY.js","./chunk.QDDDKEBH.js","./chunk.F7KVEWFH.js","./chunk.QKRQPUCE.js","./chunk.SPJ34VHA.js","./chunk.XOZU4OFA.js","./chunk.KBJ3UUER.js","./chunk.U5KJQFAP.js","./chunk.6TBQV3NO.js","./chunk.MT252WP4.js","./chunk.VVIQSFM4.js","./chunk.TQ3MNB6K.js","./chunk.VGYG2IBZ.js","./chunk.RJ7VSWTA.js","./chunk.P43LPXXJ.js","./chunk.JCKIJSW7.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.HLKDYI6J.js")))),$e=ae.part((e,n)=>{let t=e.InlineAiMenu;return(0,O.jsx)(t,{...n})},{what:"The AI's suggestions"}),Qe=ae.part((e,n)=>{let t=e.GhostTray;return(0,O.jsx)(t,{...n})},{quiet:!0});function Ke(){let{ai:e}=b(),n=H(e);return(0,B.useMemo)(()=>n?t=>({id:"inline-ai",heading:"AI",render:r=>(0,O.jsx)(B.Suspense,{fallback:null,children:(0,O.jsx)($e,{target:t,close:r})}),prepare:()=>ae.prefetch()}):null,[n])}var Ye=[];function xn({children:e}){let n=Ke(),t=(0,B.useMemo)(()=>n?[n]:Ye,[n]);return(0,O.jsx)(G,{sections:t,children:e})}function Dn(e){let{ai:n,aiDesk:t}=b(),{ghost:r}=ye(t);return r===null||r.onCard||n.off?null:(0,O.jsx)(B.Suspense,{fallback:null,children:(0,O.jsx)(Qe,{...e})})}var W=w(R(),1);var Le=w(E(),1),Ue=e=>globalThis[Symbol.for("graview.shown-lists")]?.get(e),Ce=I(D(()=>(__graviewPreload(import.meta.url,["./chunk.RJ7VSWTA.js","./chunk.P43LPXXJ.js","./chunk.JCKIJSW7.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.CGRX6SDE.js"))));function Je(e){let n=e.about[0];if(e.about.length!==1||!n?.startsWith("aggregate:"))return;let t=n.slice(10).split("+");return t.length===1?t[0]:void 0}function Xe(e,n){return e.filter(t=>t.as!==n.as&&!t.hidden&&(t.kind===n.kind||t.over?.includes(n.kind)===!0)).at(-1)}function Ze(e){let n=V(),t=n?.keptViews,r=n?.views,u=(0,W.useContext)(Pe);return(0,W.useMemo)(()=>r?c=>{let p=t?.current(),o=Je(c),s=l=>l.length>0?{id:"tidy-view",items:l,prepare:()=>Ce.prefetch()}:null,g=(l,...i)=>Ce.load().then(f=>f[l](...i),()=>!1),k=(l,i)=>Ue(l)?.().menu(i,t,u)??[];if(c.place===void 0){if(c.face!=="pages"||o===void 0||c.on!==void 0)return null;let l=p?.may.lenses===!0&&t?.lens!==void 0,i=q(n.store.schema,o),f=r.arrangement?.()?.hide?.includes(o)===!0;return s([...l?[{id:f?"show-list":"hide-list",label:f?"Show":"Hide",hint:f?"Back in the places, for everyone":"Off the places, for everyone; still at its address",run:()=>void g("setListHidden",o,i,t,!f,u)}]:[],...k(`list:${o}`,l)])}let d=r.places().find(l=>l.as===c.place&&(o===void 0||l.kind===o||l.over?.includes(o)===!0));if(!d)return null;let h=t&&p?fe(d,p,t):null;return s([...h?[d.hidden?{id:"show-view",label:"Show",hint:"Back in the places, for everyone",run:()=>void g("setHidden",d,h,t,!1,u)}:{id:"hide-view",label:"Hide",hint:"Off the places and the scene, for everyone",run:()=>void g("setHidden",d,h,t,!0,u)},{id:"delete-view",label:"Delete",hint:`Kept ${30} days under Recently deleted`,run:()=>{let l=Xe(r.places(),d);g("remove",d,h,t,u).then(i=>i&&e?.(d,l))}}]:[],...k(`place:${d.as}`,h==="lens")])}:null,[t,r,u,e])}var en=[];function Wn({children:e}){let{view:n,go:t}=Q(),r=(0,W.useCallback)((p,o)=>{let s=n.within?.view;n.focusId===he(p.kind)&&(s===void 0||s===p.as)&&t(o?ge(n,o.kind,o.as):me(n,!0))},[n,t]),u=Ze(r),c=(0,W.useMemo)(()=>u?[u]:en,[u]);return(0,Le.jsx)(G,{sections:c,children:e})}var M=w(R(),1),ue=w(E(),1),N,ce=new Set,le=e=>(ce.add(e),()=>void ce.delete(e)),z=()=>(__graviewPreload(import.meta.url,["./chunk.LQ5J6YQW.js","./chunk.DOJCYXIJ.js","./chunk.W332P5T3.js","./chunk.PGT4ZQDG.js","./chunk.ZONRIOIA.js","./chunk.NXHEOHRR.js","./chunk.TBY5IR7C.js","./chunk.BIDL7GQD.js","./chunk.HXRHEPPJ.js","./chunk.QNWGDG2Z.js","./chunk.BJUUSIQY.js","./chunk.SPJ34VHA.js","./chunk.XOZU4OFA.js","./chunk.KBJ3UUER.js","./chunk.Q5WEOX3Q.js","./chunk.4O64QV2Y.js","./chunk.OYMN3IFX.js","./chunk.U5KJQFAP.js","./chunk.FOHZPYUV.js","./chunk.IXYG65TM.js","./chunk.W6L2VAJG.js","./chunk.N3MXLORL.js","./chunk.MIE4TJRW.js","./chunk.3CLTABGP.js","./chunk.RD2FSSLV.js","./chunk.CVN2XFMF.js","./chunk.6TBQV3NO.js","./chunk.MT252WP4.js","./chunk.VVIQSFM4.js","./chunk.TQ3MNB6K.js","./chunk.VGYG2IBZ.js","./chunk.RJ7VSWTA.js","./chunk.P43LPXXJ.js","./chunk.JCKIJSW7.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.7MDGPTYF.js")).then(e=>{N=e,ce.forEach(n=>n())});function nn(){let e=b(),{ai:n,keptViews:t,onProposeChange:r,composeChange:u}=e,c=(0,M.useRef)(e);c.current=e;let p=r!==void 0&&u!==void 0||typeof t?.fork=="function",o=H(n)&&(typeof t?.revise=="function"||p);o&&oe(z);let s=(0,M.useSyncExternalStore)(le,()=>N!==void 0,()=>!1);return(0,M.useMemo)(()=>o?g=>g.section||g.page||g.face==="scene"&&p&&(g.on!==void 0||g.place!==void 0||g.about.length===1)?N?N.sectionFor(g,c.current):(z(),null):null:null,[o,p,s])}function Fn(e,n){let t=b(),r=(0,M.useRef)(t);r.current=t;let u=(0,M.useRef)(e);u.current=e;let c=(0,M.useRef)(n);c.current=n;let p=t.onProposeChange!==void 0&&t.composeChange!==void 0;p&&oe(z);let o=(0,M.useSyncExternalStore)(le,()=>N!==void 0,()=>!1);return(0,M.useMemo)(()=>p?s=>!s.page||s.face!=="pages"?null:N?N.displayOptionsSection(s,r.current,u.current,c.current):(z(),null):null,[p,o])}var tn=[];function _n({children:e}){let n=nn(),t=(0,M.useMemo)(()=>n?[n]:tn,[n]);return(0,ue.jsx)(G,{sections:t,children:e})}function qn(){let e=(0,M.useSyncExternalStore)(le,()=>N?.SectionDoor,()=>{});return(0,M.useEffect)(()=>{try{sessionStorage.getItem("graview.better.from-scene")&&z()}catch{}},[]),e?(0,ue.jsx)(e,{}):null}function Kn(e={}){return e.scope===void 0?re:ve(re,e.scope)}var F=w(R(),1),a=w(E(),1);function et({inside:e=!1,widthOf:n}={}){let{store:t,view:r,emphasis:u,setEmphasis:c}=b(),p=De(),{selection:o,set:s}=$(),{show:g}=Q(),k=ke(),d=(0,F.useMemo)(()=>{let i=new Map;for(let f of t.graph.allEdges()){let y=i.get(f.kind)??{count:0,ends:new Set};y.count+=1;for(let S of[f.from,f.to]){let T=t.graph.getNode(S);T&&y.ends.add(`kind:${T.kind}`)}i.set(f.kind,y)}return[...i.entries()].sort(([f],[y])=>f.localeCompare(y)).map(([f,y])=>({kind:f,count:y.count,ends:[...y.ends]}))},[t,k]),h=Math.max(0,...d.map(i=>i.count));if((0,F.useEffect)(()=>()=>c(null),[c]),!r.overview&&!e||d.length===0)return null;let l=new Set;for(let i of o){if(i.startsWith("kind:")){l.add(i);continue}let f=t.graph.getNode(i);f&&l.add(`kind:${f.kind}`)}return(0,a.jsxs)("section",{"aria-label":"What the lines mean",role:e?"group":void 0,"data-testid":"relation-key",style:e?{display:"grid",gap:1}:{position:"absolute",left:16,top:14,zIndex:pe("rail"),display:"grid",gap:1,padding:"8px 10px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",maxWidth:on,animation:"graview-settle 380ms 280ms ease backwards"},children:[e?null:(0,a.jsx)("span",{style:{fontSize:"0.75rem",letterSpacing:"0.16em",textTransform:"uppercase",color:"var(--graview-ink-faint)",paddingBottom:2},children:d.length===1?"1 relation":`${d.length} relations`}),n?(0,a.jsx)(sn,{aloft:r.overview===!0}):null,d.map(({kind:i,count:f,ends:y})=>{let{connector:S,style:T}=te(p,i),v=rn(t.schema,i),m=u!==null?u===i:l.size===0||y.some(A=>l.has(A));return(0,a.jsxs)("button",{type:"button",title:t.schema.edge(i)?.description===void 0?`${f} of these`:v.words,onMouseEnter:()=>c(i),onMouseLeave:()=>c(null),onFocus:()=>c(i),onBlur:()=>c(null),onClick:()=>{s(y),g(null)},style:{all:"unset",outline:"revert-layer",cursor:"pointer",display:"grid",gridTemplateColumns:"30px 1fr auto",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px",borderRadius:6,opacity:m?1:.4},children:[(0,a.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",style:{display:"block",opacity:S.visible?1:.35},children:r.overview&&n?(0,a.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",className:"graview-key-ribbon",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:n(f,h)}):(0,a.jsx)("path",{d:"M 1 5 L 29 5",fill:"none",stroke:ee(T),strokeWidth:ne(T,!0),strokeDasharray:Z[T.pattern],strokeLinecap:"round"})}),(0,a.jsxs)("span",{style:{display:"grid",minWidth:0},"data-graview-relation-words":i,children:[(0,a.jsx)("span",{style:{fontSize:"0.8125rem",color:"var(--graview-ink)"},children:v.words}),(0,a.jsx)("span",{style:{fontSize:"0.6875rem",color:"var(--graview-ink-faint)"},children:v.ends})]}),S.visible?null:(0,a.jsx)("span",{"data-graview-quiet":i,style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontStyle:"italic"},children:"not drawn"}),(0,a.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)",fontVariantNumeric:"tabular-nums"},children:f})]},i)})]})}var on="min(280px, calc(100% - 28px))";function rn(e,n,t){let r=e.edge(n)?.from??[],u=new Map;for(let o of t!==void 0&&r.includes(t)?[t]:r.length>0?r:[""]){let s=xe(e,o,n,"out");u.set(s,[...u.get(s)??[],o])}let c=o=>o==="*"?"anything":q(e,o),p=[...u].map(([o,s])=>{let g=s.flatMap(d=>e.tryDefinition(d)?.edges[n]?.to??[]),k=s[0]&&g.length>0?`${s.map(c).join(", ")} \u2192 ${(g.includes("*")?["*"]:[...new Set(g)]).map(c).join(", ")}`:"";return[o.charAt(0).toUpperCase()+o.slice(1),k]});return{words:p.map(([o])=>o).join(" \xB7 "),ends:p.flatMap(([,o])=>o?[o]:[]).join(" \xB7 ")}}function nt({edgeKind:e,kit:n,width:t=30}){let r=V(),u=(0,F.useMemo)(()=>de(n??r?.brand?.kit),[n,r?.brand?.kit]),{connector:c,style:p}=te(u,e);return(0,a.jsx)("svg",{width:t,height:"8","aria-hidden":"true","data-testid":"relation-mark","data-graview-relation":e,style:{display:"inline-block",verticalAlign:"middle",opacity:c.visible?1:.35},children:(0,a.jsx)("path",{d:`M 1 4 L ${t-1} 4`,fill:"none",stroke:ee(p),strokeWidth:ne(p,!0),strokeDasharray:Z[p.pattern],strokeLinecap:"round"})})}function sn({aloft:e}){let n={display:"grid",gridTemplateColumns:"30px 1fr",alignItems:"center",gap:8,minHeight:23,padding:"2px 4px"},t={fontSize:"0.75rem",color:"var(--graview-ink-muted)"};return(0,a.jsxs)("div",{role:"group","aria-label":"The lines","data-testid":"line-manners",style:{display:"grid",gap:1,paddingBottom:6,marginBottom:4,borderBottom:"1px solid var(--graview-edge)"},children:[e?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{style:n,"data-graview-manner":"ribbon",children:[(0,a.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-ink)",strokeOpacity:.35,strokeWidth:6})}),(0,a.jsx)("span",{style:t,children:"A relation between two districts, as wide as the links along it \u2014 point at one for its words"})]}),(0,a.jsxs)("div",{style:n,"data-graview-manner":"record",children:[(0,a.jsxs)("svg",{width:"30",height:"10","aria-hidden":"true",children:[(0,a.jsx)("path",{d:"M 1 5 L 25 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeLinecap:"round"}),(0,a.jsx)("circle",{cx:26,cy:5,r:3,fill:"var(--graview-accent)"})]}),(0,a.jsx)("span",{style:t,children:"A chosen record's link to another record, labeled with the relation"})]}),(0,a.jsxs)("div",{style:n,"data-graview-manner":"district",children:[(0,a.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeWidth:1.8,strokeDasharray:"5 4"})}),(0,a.jsx)("span",{style:t,children:"A chosen record's links into a district, with how many"})]})]}):null,(0,a.jsxs)("div",{style:n,"data-graview-manner":"unsure",children:[(0,a.jsx)("svg",{width:"30",height:"10","aria-hidden":"true",children:(0,a.jsx)("path",{d:"M 1 5 L 29 5",stroke:"var(--graview-accent)",strokeOpacity:Te,strokeWidth:1.8,strokeDasharray:Ee,strokeLinecap:"round"})}),(0,a.jsx)("span",{style:t,children:"Unsure: a link its maker was less than sure of, until a person keeps it \u2014 point at its words for what it was based on"})]})]})}export{dn as a,hn as b,Sn as c,et as d,on as e,nt as f,Ke as g,xn as h,Dn as i,Ze as j,Wn as k,nn as l,Fn as m,_n as n,qn as o,Kn as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{c as ae,d as se,f as oe,i as re,j as le,k as de,m as ce,n as ue,o as pe,p as ge,q as fe}from"./chunk.6VG2LCES.js";import{b as Z,c as ee,d as te,e as ne}from"./chunk.I3ADXJQW.js";import{a as ie}from"./chunk.HMV4ILAC.js";import{a as Y}from"./chunk.UVMHC6VM.js";import{a as X,e as O}from"./chunk.PYGNO2AV.js";import{E as K,G as Ie,J as Q,U as V,Y as _,ga as j}from"./chunk.CUA7F3YJ.js";import{zd as J}from"./chunk.IUVRJDL3.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.RJ7UV3XI.js","./chunk.G4JJXA63.js","./chunk.TBY5IR7C.js","./chunk.5IM2X3VT.js","./chunk.BIDL7GQD.js","./chunk.NKUNCQB3.js","./chunk.XJ4JYROM.js","./chunk.XOZU4OFA.js","./chunk.CHG522KL.js","./chunk.Q5WEOX3Q.js","./chunk.ZBK3FCVE.js","./chunk.DW6KXAUM.js","./chunk.MR776WQ2.js","./chunk.WVUJXDXZ.js","./chunk.IRPMGHZN.js","./chunk.7QWGIGHM.js","./chunk.HRLCDBMO.js","./chunk.LZNHTROY.js","./chunk.36FKQJFM.js","./chunk.RHV73CBA.js","./chunk.ZGJUCVT5.js","./chunk.CVVNHQPO.js","./chunk.YIDNZTON.js","./chunk.QILGAV7H.js","./chunk.I6HIVTXU.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.RPHZY7N4.js")),l=i.recipeDraft(a.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(l))return l.failed;t?.(),e.seatTalk.setDraft(l,null),e.goTo.draft?.(),ke()}function ke(e=180){if(typeof document>"u")return;let a=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(a){i&&a.focus();return}e>0&&requestAnimationFrame(()=>ke(e-1))}async function T(e,a,t,i,l){let s=he(e,t,i),d=a==="suggest"?await oe(e.ai,s):a==="fill"?await re(e.ai,s):a==="record"?await le(e.ai,s):await de(e.ai,s);if(d.interaction.outcome==="failed")return a!=="suggest"&&e.desk.record(d.interaction),d;let u=g=>{let p={...d.interaction,outcome:"failed",failed:g};return e.desk.record(p),{...d,interaction:p}};if(a==="fill"||a==="record"){if(!d.ghost||d.ghost.proposals.length===0)return u("Nothing here could be filled in.");l?.(),e.desk.setGhost({ghost:d.ghost}),e.desk.record(d.interaction)}if(a==="panel"&&d.panel){let g=await be(e,d.panel,l);if(g)return u(g);e.desk.record(d.interaction)}return d}var W=new WeakMap,Te=64,me=new WeakMap;function Ee(e){let a=me.get(e);if(!a){let t=a={n:0};me.set(e,t),e.subscribe(()=>void(t.n+=1))}return a.n}var Se=(e,a)=>{let t=ee(a);return t.length>0?t.map(i=>e.graph.getNode(i)):[Ee(e)]},we=(e,a,t)=>JSON.stringify({target:a,seat:e.principal,by:t}),Ae=(e,a,t)=>{let i=Se(e.store,a);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((l,s)=>l===t.depends[s])};function Me(e,a,t="menu"){let i=W.get(e.store)?.get(we(e,a,t));return i?.result!==void 0&&Ae(e,a,i)?i.result:void 0}function Ce(e,a,t){let i=W.get(e.store);i||W.set(e.store,i=new Map);let l=we(e,a,t?.by??"menu"),s=i.get(l);if(s&&Ae(e,a,s))return s.result?Promise.resolve(s.result):s.asked;let d=t?t.ask():T(e,"suggest",a),u={schema:e.store.schema,ai:e.ai,depends:Se(e.store,a),asked:d};i.delete(l),i.set(l,u),i.size>Te&&i.delete(i.keys().next().value);let g=i;return d.then(p=>{p.interaction.outcome!=="failed"?u.result=p:g.get(l)===u&&g.delete(l)}),d}async function Oe(e,a,t,i,l={}){let s=a.interaction,d=ue(t);if(d){let u=s.usage?.at(-1)?.model,g=s.offered.find(h=>h.id===t.id)?.confidence,p=ce(e.store,{interaction:s.id,target:s.target,basis:`${s.ask.said}: ${t.label}`,...u?{model:u}:{},proposals:[{...d,...g!==void 0?{confidence:g}:{}}]},e.principal);if(p.proposals.length===0){let h="That can't be done now.";return e.desk.record({...s,outcome:"failed",failed:h}),h}l.onCard?e.desk.setGhost({ghost:p,onCard:!0}):(i?.(),e.desk.setGhost({ghost:p})),e.desk.record(s);return}if(t.type==="panel"){let u=t.label,g={title:u,recipe:{...t.panel,title:u}},p=await be(e,g,i);return e.desk.record(p?{...s,outcome:"failed",failed:p}:{...s,outcome:"drawn",accepted:[t.id],panel:g}),p}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...s,outcome:"accepted",accepted:[t.id]})}async function qe(e,a){if(a.ask.kind==="ask")return O(e.desk,{target:a.target,asked:a.ask.said}),null;let t=a.ask.kind==="panel"||a.ask.kind==="record"?a.ask.kind:"fill";return T(e,t,a.target,a.ask.said)}var k={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},ye=(0,o.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"aria-hidden":"true",style:{...k,visibility:"hidden"},children:"\xA0"}),P={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function ze({target:e,close:a}){let t=Y(),i=(0,c.useMemo)(()=>Z(e,n=>t.store.graph.has(n)),[e,t.store]),l=(0,c.useMemo)(()=>{let n=he(t,i);return te(t.store,i,{principal:t.principal,places:t.places,...n.acts?{acts:n.acts}:{}})},[t,i]),s=l.candidates.some(n=>n.type==="fill"),d=l.candidates.some(n=>n.type==="panel"),u=(0,c.useMemo)(()=>d?ne(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[d,t,i]),g=(0,c.useMemo)(()=>new Set(t.store.allMutations().filter(n=>(n.creates??[]).length>0).map(n=>n.name)),[t.store]),p=ae(t.ai)!==void 0&&l.candidates.some(n=>n.type==="act"&&n.asks.length>0&&g.has(n.mutation)),h=K(t.ai),S=Me(t,i),f=JSON.stringify(i),[m,I]=(0,c.useState)(!1),[A,R]=(0,c.useState)(null),[H,E]=(0,c.useState)(h&&S===void 0);(0,c.useEffect)(()=>{if(S!==void 0||!(h||m))return;let n=!0;return E(!0),Ce(t,i).then(y=>{n&&(R(y),E(!1))}),()=>{n=!1}},[f,m]);let r=S??A,w=(r?.offers??[]).filter(n=>!(n.type==="place"&&u.some(y=>y.place===n.place))).slice(0,Math.max(0,3-u.length)),b=r?.interaction.outcome==="failed"?r.interaction.failed??"The AI could not suggest anything here.":null,D=(0,c.useRef)(!1),F=(0,c.useRef)(null);(0,c.useLayoutEffect)(()=>{r===null||!D.current||(D.current=!1,F.current?.querySelector("button")?.focus())},[r]);let L=(0,c.useRef)(!0);(0,c.useEffect)(()=>()=>{L.current=!1},[]);let[U,G]=(0,c.useState)(!1),[B,$]=(0,c.useState)(null),M=n=>{if(U)return;G(!0),$(null);let y=!1;n(()=>{y=!0,a()}).then(x=>{L.current&&(G(!1),x?$(x):y||a())},x=>{L.current&&(G(!1),$(x instanceof Error?x.message:String(x)))})},q=n=>n.interaction.outcome==="failed"?n.interaction.failed??"The AI could not do that here.":void 0,C=H&&!m?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:P,children:"Thinking\u2026"}):U?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:P,children:"Asking\u2026"}):B?(0,o.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...P,color:"var(--graview-warn)"},children:B}):b?(0,o.jsx)("p",{role:"status",style:P,children:b}):null,z=(0,c.useRef)(0);z.current=Math.max(z.current,h&&S===void 0?Math.max(1,3-u.length):0,w.length+(C?1:0));let xe=Math.max(0,z.current-w.length-(C?1:0));return(0,o.jsxs)("div",{ref:F,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[(0,o.jsxs)("ul",{"data-testid":"inline-ai-room",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[C?(0,o.jsxs)("li",{style:{position:"relative"},children:[ye,(0,o.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center"},children:C})]}):null,w.map(n=>(0,o.jsx)("li",{children:(0,o.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${n.id}`,"data-ai-offer":n.id,"data-ai-offer-type":n.type,title:n.label,onClick:()=>M(y=>Oe(t,r,n,y)),style:{...k,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[n.label,(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",n.type==="panel"?"a panel":n.type==="place"?"go there":n.type==="record"?"open it":"suggested"]})]})},n.id)),Array.from({length:xe},(n,y)=>(0,o.jsx)("li",{"data-inline-ai-room":"",children:ye},`room-${y}`))]}),(0,o.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[!h&&r===null?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":m||void 0,onClick:n=>{m||(D.current=document.activeElement===n.currentTarget,I(!0))},style:k,children:m?"Thinking\u2026":"Suggest\u2026"})}):null,s?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>M(async n=>q(await T(t,"fill",i,"Fill in",n))),style:k,children:"Fill in with AI"})}):null,p?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>M(async n=>q(await T(t,"record",i,"Add one",n))),style:k,children:"Add one with AI"})}):null,u.map(n=>(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":`ai-open:${n.place}`,"data-ai-existing":n.fit,onClick:()=>{a(),t.goTo.place(n.place),n.fit==="partial"&&O(t.desk,{target:{on:"lens",place:n.place,...n.kind?{kind:n.kind}:{}}})},style:k,children:n.fit==="full"?`Open ${n.title}`:`Open and adjust ${n.title}`})},n.place)),d?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>M(async n=>q(await T(t,"panel",i,"Draw a panel",n))),style:k,children:u.length>0?"Draw a new view":"Draw a panel"})}):null,(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let n=document.activeElement,y=X(n instanceof Element?n.closest('[data-testid="context-menu"]'):null);a(),O(t.desk,{target:i,returnTo:n instanceof HTMLElement&&n!==document.body?n:null,...y?{from:y}:{}})},style:k,children:"Tell Graview\u2026"})})]})]})}var v={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function Ne({placement:e="picture"}){let{store:a,principal:t,aiDesk:i}=j(),l=V(a,t),{ghost:s,entries:d}=Q(i),[u,g]=(0,c.useState)(new Set);(0,c.useEffect)(()=>g(new Set),[s?.ghost.interaction]);let p=(0,c.useRef)(null),h=(0,c.useRef)(null),S=s?.batch;if((0,c.useEffect)(()=>{S!==void 0&&h.current?.focus()},[S]),!s)return null;let{ghost:f}=s,m=d.find(r=>r.id===f.interaction),I=()=>{let r=f.target.on==="record"||f.target.on==="field"?f.target.id:void 0,w=p.current?.closest("[data-graview-face], main")?.parentElement??document,b=(r?w.querySelector(`[data-graview-view="${CSS.escape(r)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??p.current?.closest("main")??document.querySelector("main");b&&!b.hasAttribute("tabindex")&&b.setAttribute("tabindex","-1"),b?.focus({preventScroll:!0}),i.setGhost(null)},A=f.proposals.filter(r=>!u.has(r.id)).map(r=>r.id),R=()=>{let r=pe(l,f,{author:t,ids:A});if(!r.ok){i.setGhost({...s,refused:r.refused});return}m&&i.record(ge(m,r.accepted,r.batch)),i.setGhost({ghost:f,batch:r.batch,took:r.accepted.length,...s.onCard?{onCard:!0}:{}})},H=()=>{m&&s.batch===void 0&&i.record(fe(m)),I()},E=()=>{if(s.batch!==void 0)try{l.undo(s.batch,{author:t}),m&&i.record({...m,undone:!0}),I()}catch(r){i.setGhost({...s,refused:r instanceof Error?r.message:String(r)})}};return(0,o.jsxs)("section",{ref:p,"data-testid":"ai-ghost","data-interaction":f.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:J("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,o.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:s.batch!==void 0?`Done: ${s.took===1?"one change":`${s.took} changes`}, as one.`:`Proposed by AI \xB7 ${f.basis}`}),s.batch===void 0?(0,o.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:f.proposals.map(r=>(0,o.jsx)("li",{"data-ghost-proposal":r.id,children:(0,o.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,o.jsx)("input",{type:"checkbox",checked:!u.has(r.id),onChange:w=>{let b=new Set(u);w.target.checked?b.delete(r.id):b.add(r.id),g(b)}}),(0,o.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:r.said}),r.confidence!==void 0?(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(r.confidence*100),"% sure"]}):null]})},r.id))}):null,s.refused?(0,o.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:s.refused}):null,(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.batch===void 0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:A.length===0,onClick:R,style:v,children:A.length===f.proposals.length?"Accept":`Accept ${A.length} of ${f.proposals.length}`}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:H,style:v,children:"Dismiss"})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button",ref:h,"data-testid":"ghost-undo",onClick:E,style:v,children:"Undo"}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:I,style:v,children:"Close"})]})})]})}export{he as a,be as b,T as c,Me as d,Ce as e,Oe as f,qe as g,ze as h,Ne as i};
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{c as ae,d as se,f as oe,i as re,j as le,k as de,m as ce,n as ue,o as pe,p as ge,q as fe}from"./chunk.HXRHEPPJ.js";import{b as Z,c as ee,d as te,e as ne}from"./chunk.QNWGDG2Z.js";import{a as ie}from"./chunk.QDDDKEBH.js";import{a as Y}from"./chunk.F7KVEWFH.js";import{a as X,e as O}from"./chunk.RJ7VSWTA.js";import{E as K,G as Ie,J as Q,U as V,Y as _,ga as j}from"./chunk.JCKIJSW7.js";import{zd as J}from"./chunk.6L6RUOSF.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.64K5ELSQ.js","./chunk.G4JJXA63.js","./chunk.TBY5IR7C.js","./chunk.PQTXM4VY.js","./chunk.BIDL7GQD.js","./chunk.7KX36ENH.js","./chunk.SPJ34VHA.js","./chunk.XOZU4OFA.js","./chunk.KBJ3UUER.js","./chunk.Q5WEOX3Q.js","./chunk.4O64QV2Y.js","./chunk.OYMN3IFX.js","./chunk.UQZ2P6KD.js","./chunk.WVUJXDXZ.js","./chunk.NI4OPHTL.js","./chunk.U5KJQFAP.js","./chunk.FOHZPYUV.js","./chunk.IXYG65TM.js","./chunk.W6L2VAJG.js","./chunk.N3MXLORL.js","./chunk.6TBQV3NO.js","./chunk.MT252WP4.js","./chunk.VVIQSFM4.js","./chunk.TQ3MNB6K.js","./chunk.VGYG2IBZ.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.45HUV56Z.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as fe,b as Ne,d as Ze,e as He,f as he,g as F,h as ke,j as We}from"./chunk.OYMN3IFX.js";import{h as Je,i as Xe,j as Qe}from"./chunk.FOHZPYUV.js";import{a as ae,b as ce,c as J,d as Ye,e as ee,g as se,h as en}from"./chunk.W6L2VAJG.js";import{f as Be,k,l as Ue,m as ze,w as ye}from"./chunk.N3MXLORL.js";import{A as re,Ja as Ie,Qa as Ke,Ra as Q,Rd as qe,Sa as me,Sd as Ve,b as Z,c as U,e as ue,f as Me,g as P,h as v,k as L,l as X,m as I,n as _e,o as H,p as N,r as $,s as oe,sc as Pe,t as R,tc as ge,u as j,uc as Le,v as G,vc as Ge,w as T,wc as Ce,x as n,y as M,z as Y}from"./chunk.6L6RUOSF.js";var be=e=>Object.entries(e).map(([s,r])=>[s,Object.keys(Q(r?.edges))]),$e=(e,s)=>Le(e,be(s));function nn(e){return[...Object.keys(e.acts??{}),...Object.keys(e.kinds).flatMap(s=>Pe(s)),...Ge(be(e.kinds))]}var B=e=>typeof e=="object"&&e!==null&&!Array.isArray(e);function tn(e){if(!B(e)||!B(e.kinds))return e;let s;try{let f=Object.fromEntries(Object.entries(e.kinds).map(([g,c])=>[g,B(c)&&B(c.edges)?{edges:c.edges}:{}]));s=nn({acts:B(e.acts)?e.acts:{},kinds:f})}catch{return e}let r=new Set(s),t=!1,o=f=>{if(typeof f!="string"||r.has(f))return f;let g=qe(f,s);return g===void 0?f:(t=!0,g)},a=B(e.policy)&&Array.isArray(e.policy.grants)?{...e.policy,grants:e.policy.grants.map(f=>B(f)&&Array.isArray(f.mutations)?{...f,mutations:f.mutations.map(o)}:f)}:void 0,u=B(e.rules)?Object.fromEntries(Object.entries(e.rules).map(([f,g])=>[f,B(g)&&Array.isArray(g.repairs)?{...g,repairs:g.repairs.map(c=>B(c)?{...c,act:o(c.act)}:c)}:g])):void 0;return t?{...e,...a?{policy:a}:{},...u?{rules:u}:{}}:e}function we(e,s){let r=Ve(e,nn(s));return r&&r!==e?`did you mean "${r}"?`:void 0}var Oe="graview-document",je=1,xe=256*1024,ne=64*1024,vn=["plain","editorial","shader","ascii"];var Se=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ve=/^[a-z][A-Za-z0-9]*$/,On=/^[a-z0-9\u00df-\u00ff'-]+( [a-z0-9\u00df-\u00ff'-]+){0,2}$/,on=12,sn=60,jn=new Set(["id","kind"]),xn=/^(?:[a-z][a-z0-9]*(?:-[a-z0-9]+)*|[a-z][A-Za-z0-9]*)$/,An=["string","text","number","integer","boolean","date","datetime","enum","list","url","email","image","video","file","app-link","phone","place","duration"];function En(){let e=h=>h in Object.prototype,s=Y(h=>!e(h),"every object already has this name \u2014 choose another"),r=(h,D)=>[...h===void 0?[]:[Me(h)],...D===void 0?[]:[ue(D)]],t=(h,D)=>v().check(...r(h,D)),o=(h,D,te)=>N(h).check(...r(D,te)),a=h=>v().check(P(Se,`${h} names are kebab-case, lower-case words joined by hyphens like "tool-note" (field and relation names are camelCase, like "supersededBy")`)),u=v().check(P(xn,'relation names are one camelCase word, like "supersededBy" (kind names are kebab-case, like "tool-note")'),s),f=v().check(P(ve,'field names are one word or camelCase, like "dueDate", so rules say them bare (kind names are kebab-case, like "tool-note")'),Y(h=>!jn.has(h),'a field cannot be called "id" or "kind" \u2014 the framework keeps those; try "type" or "category"'),s),g=t(1,500),c=v().check(ue(40),P(On,'an alias is up to three lower-case words, like "supplier"')),i=t(1,2e3),p=t(1,300),y=$({type:G(An),required:n(I()),description:n(g),label:n(t(1,60)),aliases:n(o(c,1,on)),options:n(o(t(1,80),1,100)),multiple:n(I()),optionLabels:n(j(t(1,80),t(1,80))),of:n(G(["string","number","date","image","video","file"])),default:n(H()),unit:n(t(void 0,12)),format:n(G(["money","percent","duration","markdown"])),places:n(T(0)),min:n(L()),max:n(L()),step:n(L()),renamedFrom:n(v().check(P(ve))),repeats:n(I()),collaborative:n(I())}).check(re((h,D)=>{h.type==="enum"&&!h.options&&D.addIssue({code:"custom",message:'an enum field lists its "options"',path:["options"]}),h.type!=="enum"&&h.options&&D.addIssue({code:"custom",message:'"options" belongs only on an enum field',path:["options"]}),h.type!=="enum"&&h.multiple!==void 0&&D.addIssue({code:"custom",message:'"multiple" belongs only on an enum field: a choice that takes several of its options',path:["multiple"]});for(let te of Object.keys(h.optionLabels??{}))h.options?.includes(te)||D.addIssue({code:"custom",message:`"${te}" is labeled, and is none of the field's options`,path:["optionLabels",te]});h.type!=="list"&&h.of&&D.addIssue({code:"custom",message:'"of" belongs only on a list field',path:["of"]}),h.places!==void 0&&!(h.format==="money"||!h.format&&/^[A-Z]{3}$/.test(h.unit??""))&&D.addIssue({code:"custom",message:'"places" belongs only on money: a number field with "format": "money"',path:["places"]}),h.repeats&&h.type!=="date"&&h.type!=="datetime"&&D.addIssue({code:"custom",message:'"repeats" belongs only on a date or datetime field',path:["repeats"]})})),m=v().check(P(new RegExp(`${Se.source}|${Ie.source}`),'a relation goes to a kind of this document, like "house", or of another app, like "@nick/house/house"')),d=$({to:R([o(m,1),T("*")]),cardinality:n(G(["one","many"])),description:n(g),inverse:n(t(1,80)),appendOnly:n(I()),renamedFrom:n(v()),tidying:n(T("never"))}),l=R([i,$({expr:i,label:n(t(1,60)),description:n(g),format:n(G(["money","percent","duration"])),unit:n(t(1,12)),places:n(T(0)),hidden:n(I())})]),S=R([v(),L(),I(),_e(),N(H()),$({expr:i})]),b=$({noun:n(t(1,40)),plural:n(t(1,40)),aliases:n(o(c,1,on)),description:n(g),fields:j(f,y).check(Y(h=>Object.keys(h).length>0,"a kind has at least one field")),label:n(p),describe:n(p),lifecycle:n($({field:f,retired:o(R([v(),L(),I()]),1)})),figure:n(t(void 0,2e4)),glance:n(o(f,1,20)),page:n($({fields:n(o(f,1,40)),groups:n(o($({title:t(1,60),fields:o(f,1,40)}),1,12))})),edges:n(j(u,d)),computed:n(j(v(),l).check(Y(h=>Object.keys(h).length<=sn,`a kind works out at most ${sn} computed fields`))),fieldRoles:n(j(v(),v())),renamedFrom:n(v().check(P(Se))),people:n(I()),archives:n(T(!1)),tidying:n(G(["never","no-links"])),derives:n($({from:a("kind"),via:u,set:j(f,S)}))}),O=v().check(P(/^\$[A-Za-z][A-Za-z0-9]*$/,'a reference is "$" and a name, like "$subject" or "$new"')),x=R([$({create:a("kind"),as:n(v().check(P(ve))),set:n(j(f,S))}),$({set:j(f,S),target:n(O)}),$({connect:u,from:O,to:O}),$({sever:u,from:O,to:O}),$({remove:O})]),A=$({title:n(t(1,80)),description:n(g),fromTheOtherEnd:n(t(1,80)),on:n(R([a("kind"),o(a("kind"),1)])),creates:n(a("kind")),sets:n(j(f,S)),writes:n(o(f,1)),connects:n(u),severs:n(u),setsOther:n(j(f,S)),setsLinked:n(j(u,j(f,S))),replaces:n(R([T(!0),o(u,1,10)])),removes:n(T(!0)),args:n(j(f,y)),effects:n(o(x,1,20)),allowedWhen:n(i),refusal:n(p),destructive:n(I())}),w=$({act:a("act"),label:n(t(1,80)),args:n(j(v(),S))}),C=$({every:a("kind"),through:u,via:n(u)}),q=$({title:n(t(1,120)),description:n(g),over:R([T("graph"),a("kind")]),when:n(i),require:n(i),covers:n(C),says:n(p),repairs:n(o(w,void 0,10))}).check(re((h,D)=>{!h.require&&!h.covers&&D.addIssue({code:"custom",message:'a rule says what must hold in "require", or what each record must be linked to in "covers"',path:["require"]}),h.require&&h.covers&&D.addIssue({code:"custom",message:'a rule is judged by "require" or by "covers", not both',path:["covers"]}),h.covers&&h.over==="graph"&&D.addIssue({code:"custom",message:'a coverage rule is over a kind, whose records it follows through their links; name the kind in "over"',path:["over"]})})),z=$({roles:R([o(a("role"),1),T("*")]),mutations:R([o(a("act")),T("*")]),kinds:n(R([N(a("kind")),T("*")])),describe:n(g),self:n(I()),ownEnd:n(I()),propose:n(R([o(a("act"),1),T("*")]))}).check(re((h,D)=>{Array.isArray(h.mutations)&&h.mutations.length===0&&h.propose===void 0&&D.addIssue({code:"custom",message:'a grant names at least one act in "mutations", or the acts it lets these roles propose in "propose"',path:["mutations"]})})),E=n(o(f,1)),_=$({roles:R([o(a("role"),1),T("*")]),kinds:o(a("kind"),1),own:n(I()),via:n(u),fields:E,hide:E}),ie=$({grants:N(z),sees:n(N(_))}),W=$({accent:n(v().check(P(/^#[0-9a-fA-F]{6}$/,'an accent is a color like "#c2577a"'))),ground:n(R([v().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"')),$({light:n(v().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#eef3f8"'))),dark:n(v().check(P(/^#[0-9a-fA-F]{6}$/,'a ground is a color like "#101826"')))})])),name:n(t(1,60)),currency:n(v().check(P(/^[A-Z]{3}$/,'a currency is its three-letter code, like "USD" or "EUR"'))),locale:n(t(2,35)),timeZone:n(t(1,64)),logo:n(R([t(1,ne),$({src:t(1,ne),alt:n(t(1,120))}),$({light:t(1,ne),dark:n(t(1,ne)),alt:n(t(1,120)),darkFallback:n(T("invert"))})])),favicon:n(R([t(1,ne),$({emoji:v()})])),typography:n($({display:n(t(1,200)),body:n(t(1,200)),mono:n(t(1,200))})),shape:n($({radius:n(L().check(U(0),Z(32))),density:n(L().check(U(.75),Z(1.5)))})),accents:n(j(v(),L().check(U(0),Z(360)))),scheme:n(G(["light","dark","auto"])),subtitle:n(T(!1)),splash:n($({style:G(vn),image:n(t(1,ne)),title:n(t(1,80)),kicker:n(t(1,80)),shader:n(t(1,40)),scheme:n(G(["light","dark","device"]))})),views:n($({css:n(t(1)),motion:n(G(["none","fade"])),fonts:n(N($({family:t(1),src:t(1),weight:n(R([L(),v()])),style:n(G(["normal","italic"]))})))}))}),V=j(v(),H()),Fe=R([t(1,120),$({by:t(1,120),direction:n(G(["asc","desc"]))})]),De=L().check(X(),U(1),Z(9999)),hn=oe({create:n(I()),options:n(oe({sort:n(Fe),columnSort:n(Fe),search:n(o(t(1,120),void 0,40)),filters:n(o(t(1,120),void 0,40)),horizon:n(R([L().check(X(),U(1),Z(200)),oe({years:L().check(X(),U(1),Z(200)),title:t(1,80),from:n(De),to:n(De)})]))}))}),kn=$({card:n(N(H())),row:n(N(H())),page:n(N(H()))}),bn=()=>{let h=n(G(["asc","desc"]));return R([t(1,120),$({by:t(1,120),direction:h,then:n(R([t(1,120),$({by:t(1,120),direction:h})]))})])},$n=()=>R([t(1,120),$({by:t(1,120),order:n(o(t(1,80),void 0,40)),closed:n(o(t(1,80),void 0,40))})]),Te=oe({order:n(N(v())),hide:n(N(v())),first:n(v()),primary:n(o(t(1,80),void 0,40)),scene:n(t(1,40)),pages:n(t(1,40)),lists:n(j(v(),$({filters:n(o(t(1,120),void 0,40)),sort:n(bn()),group:n($n()),export:n(I()),opens:n(t(1,80))})))}),wn=$({act:a("act"),title:n(t(1,80)),intro:n(g),fields:n(o(f,1,40)),say:n(g),submit:n(t(1,80)),role:n(a("role"))}),Sn=$({$schema:n(v()),format:T(Oe),formatVersion:T(je),name:t(1,80),description:n(g),version:n(L().check(X(),U(1))),kinds:j(a("kind"),b).check(Y(h=>Object.keys(h).length>0,"a document declares at least one kind"),Y(h=>Object.keys(h).length<=40,"a document declares at most 40 kinds")),computed:n(j(v(),l)),acts:n(j(a("act"),A)),rules:n(j(a("rule"),q)),roles:n(N(a("role"))),policy:n(ie),modules:n(V),lenses:n(N(hn)),pages:n(Te),views:n(j(v(),R([kn,N(H())]))),brand:n(W),settings:n(N(V)),migrations:n(N(V)),connections:n(j(a("connection"),V)),purpose:n(V),workflows:n(j(a("workflow"),V)),forms:n(j(a("form"),wn)),publishing:n($({mode:G(["live","on-publish"]),working:o(a("role"),void 0,40),publishers:n(o(a("role"),1,40))})),tidying:n($({autoAcceptAt:n(L().check(X(),U(1),Z(1e4)))}))});return{FieldSpec:y,EdgeSpec:d,ComputedSpec:l,KindSpec:b,ValueSpec:S,EffectSpec:x,ActSpec:A,RepairSpec:w,CoverSpec:C,RuleSpec:q,GrantSpec:z,SightSpec:_,PolicySpec:ie,BrandSpec:W,PagesSpec:Te,DocumentSpec:Sn}}var Rn,K=()=>Rn??=En(),Xn=M(()=>K().FieldSpec),Qn=M(()=>K().EdgeSpec),et=M(()=>K().ComputedSpec),nt=M(()=>K().KindSpec),tt=M(()=>K().ValueSpec),ot=M(()=>K().EffectSpec),st=M(()=>K().ActSpec),it=M(()=>K().RepairSpec),rt=M(()=>K().CoverSpec),at=M(()=>K().RuleSpec),ct=M(()=>K().GrantSpec),lt=M(()=>K().SightSpec),dt=M(()=>K().PolicySpec),pt=M(()=>K().BrandSpec),ft=M(()=>K().PagesSpec),rn=M(()=>K().DocumentSpec);var Fn={};function an(e,s=Fn,r=je){let{document:t,respelled:o}=Ne(e),a=o.length>0?{respelled:o}:{};if(!t||typeof t!="object"||Array.isArray(t))return{document:t};let u=t;if(u.format!==Oe||typeof u.formatVersion!="number"||u.formatVersion>=r)return{document:t,...a};let f=u.formatVersion,g=structuredClone(u);for(let c=f;c<r;c++){let i=s[c];if(!i)throw new Error(`there is no upgrade from format ${c} to ${c+1}`);g={...i(g),formatVersion:c+1}}return{document:g,from:f,...a}}function Ae(e,s,r){let t=Object.keys(e).filter(f=>e[f].edges?.[s]!==void 0);if(t.length===0)return;let o=t.map(f=>e[f].edges[s].to),a=o.some(f=>f==="*")?"*":[...new Set(o.flatMap(f=>f))];if(r.length===0||r.some(f=>t.includes(f)))return{reversed:!1,kinds:a};let u=t.filter(f=>{let g=e[f].edges[s].to;return g==="*"||r.every(c=>g.includes(c))});return u.length>0?{reversed:!0,kinds:u}:{reversed:!1,kinds:a}}var dn=(e,s)=>{let r=e?.fields[s];return r!==void 0&&(r.type==="duration"||(r.type==="number"||r.type==="integer")&&r.format==="duration")};function cn(e,s,r,t){if(t==="out"){let o=e[s]?.edges?.[r]?.to;return o===void 0?[]:o==="*"?Object.keys(e):o}return Object.entries(e).filter(([,o])=>{let a=o.edges?.[r]?.to;return a!==void 0&&(a==="*"||a.includes(s))}).map(([o])=>o)}function Ee(e,s,r){if(r.t==="ident")return e[s]?.edges?.[r.name]?cn(e,s,r.name,"out"):void 0;if(r.t==="where")return Ee(e,s,r.set);if(r.t==="call"&&(r.fn==="out"||r.fn==="in")&&r.args[0]?.t==="lit"&&typeof r.args[0].value=="string")return cn(e,s,r.args[0].value,r.fn)}var ln=(e,s,r)=>{let t=s.filter(o=>e[o]?.fields[r]!==void 0);return t.length>0&&t.every(o=>dn(e[o],r))};function pn(e,s,r){let t=e.kinds,o=t[s],a=new Map(r),u=new Map,f=(c,i)=>{if(i>8)return!1;switch(c.t){case"ident":return dn(o,c.name)||g(c.name,i+1);case"member":{let p=Ee(t,s,c.object);return p!==void 0&&ln(t,p,c.name)}case"call":{if(c.fn!=="sum"&&c.fn!=="min"&&c.fn!=="max")return!1;let[p,y]=c.args,m=p&&Ee(t,s,p);return m!==void 0&&y?.t==="ident"&&ln(t,m,y.name)}case"binary":return(c.op==="+"||c.op==="-")&&f(c.left,i)&&f(c.right,i);case"unary":return c.op==="-"&&f(c.operand,i);default:return!1}},g=(c,i)=>{if(o?.computed?.[c]===void 0)return!1;if(u.has(c))return u.get(c);u.set(c,!1);let p=a.get(c),y=p!==void 0&&f(p,i);return u.set(c,y),y};return r.map(([c])=>c).filter(c=>g(c,0))}var Dn="several choices";var Tn={title:["string","text"],rich_text:["string","text"],number:["number","integer"],select:["enum","string"],status:["enum","string"],multi_select:["list",Dn],date:["date","datetime"],checkbox:["boolean"],url:["url","string"],email:["email","string"],phone_number:["phone","string"],people:["string","text","list"]};var fn=new Set(Object.values(Tn).flat());function un(e,s){let r=new Map;if(!e||typeof e!="object")return new Map;let t=Object.values(e).flatMap(o=>o&&typeof o=="object"&&o.system==="notion"&&Array.isArray(o.sources)?o.sources.filter(a=>a&&typeof a=="object").map(a=>({system:"notion",kind:a.kind,properties:a.properties})):[o]);for(let o of t){if(!o||typeof o!="object"||typeof o.kind!="string")continue;let a=s[o.kind]?.fields;if(!a)continue;let u=[];o.system==="google-calendar"&&o.fields&&typeof o.fields=="object"?u=Object.values(o.fields).filter(g=>typeof g=="string"):o.system==="notion"&&(u=o.properties&&typeof o.properties=="object"?Object.keys(o.properties):Object.keys(a).filter(g=>fn.has(a[g].type)));let f=r.get(o.kind)??new Set;for(let g of u)Object.hasOwn(a,g)&&f.add(g);r.set(o.kind,f)}return new Map([...r].filter(([,o])=>o.size>0).map(([o,a])=>[o,Object.keys(s[o].fields).filter(u=>a.has(u))]))}function mn(e,s,r=`kinds.${e}.page`){let t=s.page;if(!t)return[];let o=[],a=[...Object.keys(s.fields),...Object.keys(s.computed??{})],u=new Set,f=(c,i)=>{a.includes(c)?u.has(c)&&o.push(k("page-field-twice",i,`"${c}" is on ${e}'s page twice; name each field once`)):o.push(k("page-field",i,`${e}'s page is to show "${c}", and ${e} has no field or computed field called that`,`use one of: ${a.join(", ")}`)),u.add(c)};(t.fields??[]).forEach((c,i)=>f(c,`${r}.fields.${i}`));let g=new Set;return(t.groups??[]).forEach((c,i)=>{let p=c.title.trim().toLowerCase();g.has(p)&&o.push(k("page-group-twice",`${r}.groups.${i}.title`,`${e}'s page has two groups called "${c.title}"; give each its own title`)),g.add(p),c.fields.forEach((y,m)=>f(y,`${r}.groups.${i}.fields.${m}`))}),o}function gn(e,s=[]){return Ce({declared:Object.keys(e.fields),paged:[...e.page?.fields??[],...(e.page?.groups??[]).flatMap(r=>r.fields)],must:r=>!!e.fields[r].required&&e.fields[r].default===void 0,naming:s})}var Nn=new Set(["subject","now","today","me"]);function Mn(e){if((typeof e=="string"?e:JSON.stringify(e??null)).length>xe)return{findings:[k("too-large","",`a document may be at most ${xe/1024} KB`)]};if(typeof e=="string")try{e=JSON.parse(e)}catch(t){return{findings:[k("not-json","",`this is not JSON: ${t.message}`)]}}try{e=an(e).document}catch(t){return{findings:[k("format","formatVersion",t.message)]}}e=tn(e);let s=rn.safeParse(e);if(!s.success)return{findings:s.error.issues.map(t=>{let o=t.path.map(String).join(".");if(t.code==="unrecognized_keys")return k("unknown-key",o,`${t.keys.map(a=>`"${a}"`).join(", ")} ${t.keys.length===1?"is":"are"} not part of a Graview document here`,"check the spelling against docs/declaration-document.md");if(t.code==="invalid_union"&&/\.effects\.\d+$/.test(o))return k("effect-shape",o,"this effect is not one Graview knows",'an effect is one of {"create": kind, "as"?: name, "set"?: {field: value}}, {"set": {field: value, \u2026}, "target"?: "$ref"}, {"connect"|"sever": relation, "from": "$ref", "to": "$ref"}, {"remove": "$ref"}');if(t.code==="invalid_key"){let a=t.issues?.[0]?.message;return k("shape",o,`the name "${String(t.path.at(-1))}" is not allowed here${a?`: ${a}`:""}`)}return k("shape",o,t.message)})};let r=s.data;return{document:r,findings:_n(r)}}var pe=e=>[e??[]].flat();function zn(e){let s=new Map;for(let[r,t]of Object.entries(e.kinds))for(let[o,a]of Object.entries(Q(t.edges))){let u=s.get(o);s.set(o,{name:o,from:[...u?.from??[],r],to:a.to==="*"||u?.to==="*"?"*":[...new Set([...u?.to??[],...a.to])],cardinality:a.cardinality??"many"})}return s}function Ht(e){let s=new Map;for(let[t,o]of Object.entries(e.kinds)){let a=se(o),u=me(o.edges);s.set(t,{fields:new Set([...Object.keys(o.fields),...u.keys()]),edges:new Map(Object.entries(Q(o.edges)).map(([f,g])=>[f,g.cardinality??"many"])),...a?{computed:a}:{},...u.size>0?{linked:u}:{}})}let r=se(e);return r&&s.set(Be,{computed:r}),s}function yn(e,s){let r=[],t=pe(e.on),o=(a,u)=>{let f=Ae(s.kinds,a,t)?.reversed===!0,[g,c]=f?["$to","$subject"]:["$subject","$to"];return u==="connect"?{connect:a,from:g,to:c}:{sever:a,from:g,to:c}};if(e.creates){let a=s.kinds[e.creates],u={};for(let f of Object.keys(a?.fields??{}))u[f]=`$${f}`;for(let f of e.effects??[])"set"in f&&!("create"in f)&&F(f.target)==="new"&&Object.assign(u,f.set);r.push({create:e.creates,as:"new",set:u})}if(e.sets&&r.push({set:e.sets}),e.writes&&!(e.creates&&e.on===void 0)&&r.push({set:Object.fromEntries(e.writes.map(a=>[a,`$${a}`]))}),e.connects&&(e.replaces&&r.push({replace:e.replaces===!0?[e.connects]:[...e.replaces],keep:e.connects}),r.push(o(e.connects,"connect"))),e.severs&&r.push(o(e.severs,"sever")),e.setsOther&&(e.connects||e.severs)&&r.push({set:e.setsOther,target:"$to"}),e.setsLinked&&t.length>0)for(let[a,u]of Object.entries(e.setsLinked))r.push({set:u,through:a});return e.removes&&r.push({remove:"$subject"}),e.effects&&r.push(...e.effects.filter(a=>!(e.creates&&"set"in a&&!("create"in a)&&F(a.target)==="new"))),r}function le(e,s,r){try{let t=J(e),o=ae(t);for(let a of o.unknownFunctions)r.push(k("unknown-function",s,`"${a}" is not a function the rule language knows`,"see the rule language in the graview-invariant skill"));return t}catch(t){if(t instanceof ce){r.push(k("expression",s,t.sentence+` (at character ${t.at+1})`));return}throw t}}function Re(e,s,r){try{return ee(e)}catch(t){if(t instanceof Ye||t instanceof ce){r.push(k("template",s,(t instanceof ce,t.sentence)));return}throw t}}function _n(e){let s=[],r=new Set(Object.keys(e.kinds)),t=zn(e),o=e.acts??{},a=new Set(e.roles??[]),u=(c,i)=>me(e.kinds[c]?.edges).has(i),f=c=>Object.keys(e.kinds).some(i=>u(i,c));for(let[c,i]of Object.entries(e.kinds)){let p=`kinds.${c}`;for(let[m,d]of Object.entries(i.edges??{})){if(!Ke(d)&&d.to!=="*")for(let l of d.to)r.has(l)||s.push(k("edge-target",`${p}.edges.${m}.to`,`"${l}" is not a kind this document declares`));i.fields[m]&&s.push(k("edge-field-clash",`${p}.edges.${m}`,`"${m}" is both a field and a relation of ${c}`,"rename one of them"))}i.lifecycle&&!i.fields[i.lifecycle.field]&&s.push(k("lifecycle-field",`${p}.lifecycle.field`,`${c} has no field "${i.lifecycle.field}"`));let y=m=>i.computed!==void 0&&Object.hasOwn(i.computed,m);for(let m of i.glance??[])!i.fields[m]&&!y(m)&&s.push(k("glance-field",`${p}.glance`,`a glance at ${c} is to say "${m}", and ${c} has no field or computed field called that`,`use one of: ${[...Object.keys(i.fields),...Object.keys(i.computed??{})].join(", ")}`));s.push(...mn(c,i));for(let m of["label","describe"]){let d=i[m];if(!d)continue;let l=Re(d,`${p}.${m}`,s);for(let S of l??[])if(S.expr){for(let b of ae(S.expr).names)if(!i.fields[b]){if(y(b)){en(i,b)||s.push(k("template-field",`${p}.${m}`,`${c}'s ${b} is worked out from beyond the record, and a ${m} is said with no graph to read`,`show it in a view instead, or name a computed field worked out from ${c}'s own fields`));continue}s.push(k("template-field",`${p}.${m}`,`${c} has no field "${b}" for its ${m} to show`,m==="label"?"a label can only show the record's own fields and what they work out":void 0))}}}for(let[m,d]of Object.entries(i.derives?.set??{}))fe(d)&&"expr"in d&&le(String(d.expr),`${p}.derives.set.${m}`,s);for(let[m,d]of Object.entries(i.fields)){if(d.default!==void 0&&d.type==="enum"){let b=(d.multiple?Array.isArray(d.default)?d.default:[d.default]:[d.default]).find(O=>!d.options?.includes(String(O)));(b!==void 0||!d.multiple&&Array.isArray(d.default))&&s.push(k("default-option",`${p}.fields.${m}.default`,`"${String(b??d.default)}" is not one of ${m}'s options`))}let l=`${m}Repeat`;d.repeats&&(i.fields[l]||i.edges?.[l]||i.computed?.[l])&&s.push(k("repeat-clash",`${p}.fields.${m}.repeats`,`${c} already has "${l}", where how ${m} repeats is kept`))}}for(let[c,i]of Object.entries(o)){let p=`acts.${c}`;for(let l of pe(i.on))r.has(l)||s.push(k("act-kind",`${p}.on`,`"${l}" is not a kind this document declares`));let y=pe(i.on),m=yn(i,e);if(i.creates&&i.on===void 0&&i.writes&&r.has(i.creates)){for(let l of i.writes)if(!e.kinds[i.creates].fields[l])if(e.kinds[i.creates].computed?.[l]!==void 0)s.push(k("computed-written",`${p}.writes`,`${i.creates}'s ${l} is worked out, not written: no act can set it`,"write the stored fields it is worked out from"));else{if(u(i.creates,l))continue;s.push(k("act-field",`${p}.writes`,`${i.creates} has no field "${l}"`))}}m.length===0&&s.push(k("act-empty",p,`"${c}" does nothing`,"give it effects or a shorthand such as sets or creates"));let d=new Map;m.forEach((l,S)=>{let b=m.length-(i.effects?.length??0),O=i.effects&&S>=b?`${p}.effects.${S-b}`:p;if("create"in l){if(!r.has(l.create))s.push(k("act-kind",`${O}.create`,`"${l.create}" is not a kind this document declares`));else for(let w of Object.keys(l.set??{}))e.kinds[l.create].fields[w]||(e.kinds[l.create].computed?.[w]!==void 0?s.push(k("computed-written",`${O}.set.${w}`,`${l.create}'s ${w} is worked out, not written: no act can set it`,"set the stored fields it is worked out from")):s.push(k("act-field",`${O}.set.${w}`,`${l.create} has no field "${w}"`)));l.as&&d.set(l.as,l.create)}else if("connect"in l||"sever"in l){let w="connect"in l?l.connect:l.sever;!t.has(w)&&!f(w)&&s.push(k("act-edge",`${O}.${"connect"in l?"connect":"sever"}`,`"${w}" is not a relation any kind declares`)),F(l.from)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${c}" acts on "$subject" but does not say which kinds it is "on"`))}else if(!("through"in l))if("set"in l){let w=F(l.target??"$subject"),C=w==="subject"?y:d.has(w??"")?[d.get(w)]:[];w==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${c}" changes "$subject" but does not say which kinds it is "on"`));for(let q of Object.keys(l.set))for(let z of C)if(!(!r.has(z)||e.kinds[z].fields[q]))if(e.kinds[z].computed?.[q]!==void 0)s.push(k("computed-written",`${O}.set.${q}`,`${z}'s ${q} is worked out, not written: no act can set it`,"set the stored fields it is worked out from"));else{if(u(z,q))continue;s.push(k("act-field",`${O}.set.${q}`,`${z} has no field "${q}"`))}}else"remove"in l&&F(l.remove)==="subject"&&y.length===0&&s.push(k("act-subject",`${p}.on`,`"${c}" removes "$subject" but does not say which kinds it is "on"`));let x="set"in l&&l.set?Object.values(l.set):[],A="through"in l?`${p}.setsLinked.${l.through}`:`${O}.set`;x.forEach(w=>{w&&typeof w=="object"&&!Array.isArray(w)&&"expr"in w&&le(w.expr,A,s)})}),i.allowedWhen&&le(i.allowedWhen,`${p}.allowedWhen`,s),i.refusal&&Re(i.refusal,`${p}.refusal`,s)}for(let[c,i]of Object.entries(e.rules??{})){let p=`rules.${c}`;i.over!=="graph"&&!r.has(i.over)&&s.push(k("rule-kind",`${p}.over`,`"${i.over}" is not a kind this document declares`));let y=i.over==="graph"?void 0:e.kinds[i.over];if(i.covers&&y){let m=ye(i.over,i.covers,d=>t.get(d),d=>r.has(d));if("problem"in m){let{key:d,message:l,fix:S}=m.problem;d==="every"?s.push(k("rule-kind",`${p}.covers.every`,l,S)):s.push(k("rule-covers-relation",`${p}.covers.${d}`,l,S))}}for(let m of["when","require"]){let d=i[m];if(!d)continue;let l=le(d,`${p}.${m}`,s);if(!l)continue;let S=ae(l);for(let b of S.names)if(i.over==="graph")s.push(k("rule-name",`${p}.${m}`,`"${b}" means nothing in a rule over the whole graph`,`name a kind in "over", or use all('kind')`));else if(y&&!y.fields[b]&&!y.edges?.[b]&&y.computed?.[b]===void 0){let O=Object.keys(y.edges??{}).find(x=>x.includes("-")&&x.split("-").includes(b));s.push(k("rule-name",`${p}.${m}`,`${i.over} has no field or relation called "${b}"`,O?`"${O}" reads as a subtraction in a rule; rename the relation to one camelCase word, like "${O.replace(/-([a-z0-9])/g,(x,A)=>A.toUpperCase())}"`:void 0))}for(let b of S.edges)!t.has(b)&&!f(b)&&s.push(k("rule-edge",`${p}.${m}`,`"${b}" is not a relation any kind declares`));for(let b of S.sweeps)r.has(b)?i.over!=="graph"&&s.push(Ue("rule-cost",`${p}.${m}`,`this rule looks at every ${b} for every ${i.over}, which grows slowly as the app grows`,"walk a relation with out()/in() instead of all() where you can")):s.push(k("rule-kind",`${p}.${m}`,`"${b}" is not a kind this document declares`))}i.says&&Re(i.says,`${p}.says`,s),(i.repairs??[]).forEach((m,d)=>{!o[m.act]&&!ge(m.act)&&!$e(m.act,e.kinds)&&s.push(k("repair-act",`${p}.repairs.${d}.act`,`"${m.act}" is not an act this document declares`,we(m.act,e)))})}let g=e.policy;return g&&(g.grants.forEach((c,i)=>{if(c.roles!=="*"&&a.size>0)for(let p of c.roles)a.has(p)||s.push(k("grant-role",`policy.grants.${i}.roles`,`"${p}" is not one of the document's roles`));for(let p of["mutations","propose"]){let y=c[p];if(y!==void 0&&y!=="*")for(let m of y)!o[m]&&!ge(m)&&!$e(m,e.kinds)&&s.push(k("grant-act",`policy.grants.${i}.${p}`,`"${m}" is not an act this document declares`,we(m,e)))}}),(g.sees??[]).forEach((c,i)=>{for(let p of c.kinds)r.has(p)||s.push(k("sight-kind",`policy.sees.${i}.kinds`,`"${p}" is not a kind this document declares`));if(c.roles!=="*"&&a.size>0)for(let p of c.roles)a.has(p)||s.push(k("sight-role",`policy.sees.${i}.roles`,`"${p}" is not one of the document's roles`))})),s.push(...Qe(e)),s}function In(e){return e.label?[...e.label.matchAll(/\{\s*([A-Za-z_][A-Za-z0-9_]*)/g)].map(s=>s[1]):[ke(e)??[]].flat()}function Kn(e,s,r,t){let o=new Map,a=pe(e.on),u=new Map,f=new Map;(a.length>0||s.some(d=>"remove"in d&&F(d.remove)==="subject"||"from"in d&&(F(d.from)==="subject"||F(d.to)==="subject")||"set"in d&&!("create"in d)&&!("through"in d)&&F(d.target??"$subject")==="subject"||"through"in d))&&o.set(he,{ref:a.length>0?a:"*",required:!0});let c=e.args??{},i=e.writes?.length===1,p=(d,l)=>l&&d.type===l.type&&d.min===void 0&&d.max===void 0&&d.step===void 0?{...d,...l.min===void 0?{}:{min:l.min},...l.max===void 0?{}:{max:l.max},...l.step===void 0?{}:{step:l.step}}:d,y=(d,l)=>l&&d.type===l.type&&d.format===void 0&&d.unit===void 0?{...p(d,l),...l.format?{format:l.format}:{},...l.unit?{unit:l.unit}:{}}:p(d,l),m=(d,l,S)=>{if(d===he||Nn.has(d)||u.has(d)||o.has(d))return;let b=c[d]?y(c[d],S):void 0;o.set(d,b?{field:b,optional:!b.required,required:!!b.required}:l())};for(let d of s)if("create"in d){let l=r.kinds[d.create],S=l?gn(l,In(l)):[],b=O=>S.includes(O)?S.indexOf(O):S.length;for(let[O,x]of Object.entries(d.set??{}).sort(([A],[w])=>b(A)-b(w))){let A=F(x),w=l?.fields[O];if(A&&w){let C=!!w.required&&w.default===void 0;m(A,()=>({field:w,optional:!C,required:C}),w)}}d.as&&u.set(d.as,d.create)}else if("connect"in d||"sever"in d){let l="connect"in d?d.connect:d.sever,S=t.get(l),b=F(d.from)==="subject"&&a.length>0?a.map(x=>Q(r.kinds[x]?.edges)[l]?.to):[],O=b.length>0&&b.every(Boolean)?b.includes("*")?"*":[...new Set(b.flat())]:void 0;for(let[x,A]of[["from",d.from],["to",d.to]]){let w=F(A);if(!w)continue;let C=x==="to"?O??S?.to??"*":S?.from??"*";C!=="*"&&!f.has(w)&&f.set(w,C),m(w,()=>({ref:C,required:!0}))}}else if("through"in d){let l=Ae(r.kinds,d.through,a),S=l&&l.kinds!=="*"?l.kinds[0]:void 0;for(let[b,O]of Object.entries(d.set)){let x=F(O);if(!x||x==="to")continue;let A=S?r.kinds[S]?.fields[b]:void 0;m(x,()=>A?{field:A,optional:!0,required:!1}:{any:!0,required:!1},A)}}else if("set"in d){let l=F(d.target??"$subject"),S=l==="subject"?a[0]:u.get(l??"")??f.get(l??"")?.[0];l&&l!=="subject"&&!u.has(l)&&m(l,()=>({ref:"*",required:!0}));for(let[b,O]of Object.entries(d.set)){let x=F(O);if(!x)continue;let A=S?r.kinds[S]?.fields[b]:void 0;m(x,()=>A?{field:A,optional:!i,required:i}:{any:!0,required:!1},A)}}else if("remove"in d){let l=F(d.remove);l&&m(l,()=>({ref:"*",required:!0}))}for(let[d,l]of Object.entries(c))o.has(d)||o.set(d,{field:l,optional:!l.required,required:!!l.required});return o}function Wt(e,s={}){let r=Mn(e);if(!r.document||ze(r.findings))return{ok:!1,findings:r.findings};let t=r.document,o=[...r.findings];s.previous&&o.push(...Gn(t,s.previous));let a=Ln(t,o);return ze(a.findings)?{ok:!1,findings:a.findings}:We(a,s)}function de(e,s,r,t){return e.map(o=>{let a=o.expr,u=a?.t==="member"&&a.object.t==="ident"?a.object.name:void 0;if(o.format||!a||a.t!=="ident"&&u!=="$subject"&&u!=="$arg")return o;let f=a.name,g=u==="$arg"?void 0:r?.[f],c=(u==="$arg"?t?.[f]:void 0)??s?.[f]??(typeof g=="object"?g:void 0),i=c?.format;return i==="money"||i==="percent"?{...o,format:i,...i==="money"&&c?.places===0?{formatArgs:["0"]}:{}}:o})}function Pn(e,s,r){let t=r.kinds[e]?.edges?.[s.via]!==void 0?"to":"from",o=r.kinds[s.from],a=[],u={};for(let[f,g]of Object.entries(s.set))if(fe(g)&&"expr"in g){let c=J(g.expr);a.push([f,{expr:c}]),c.t==="ident"&&o?.fields[c.name]&&(u[f]=c.name)}else a.push([f,{value:typeof g=="string"&&g.startsWith("$$")?g.slice(1):g}]);return{from:s.from,via:s.via,sourceEnd:t,set:a,back:u}}function Ln(e,s){let r=zn(e),t={},o=un(e.connections,e.kinds);for(let[i,p]of Object.entries(e.kinds)){let y=ke(p),m=p.label??(y?`{${y}}`:void 0),d=se(p),l=d?pn(e,i,[...d]):[];t[i]={...m?{label:de(ee(m),p.fields,p.computed)}:{},...p.describe?{describe:de(ee(p.describe),p.fields,p.computed)}:{},...d?{computed:[...d]}:{},...l.length>0?{durations:l}:{},...o.has(i)?{keptInStep:o.get(i)}:{},...p.derives?{derives:Pn(i,p.derives,e)}:{}}}let a={};for(let[i,p]of Object.entries(e.acts??{})){let y=yn(p,e),m=Kn(p,y,e,r),d=p.destructive??y.some(z=>"remove"in z||"sever"in z||"replace"in z),l=[...new Set(y.flatMap(z=>"create"in z?[z.create]:[]))],S=[...new Set(y.flatMap(z=>"connect"in z?[z.connect]:[]))],b=[...new Set(y.flatMap(z=>"sever"in z?[z.sever]:"replace"in z?z.replace:[]))],O=[...new Set(y.flatMap(z=>"set"in z&&!("create"in z)&&!("through"in z)&&F(z.target??"$subject")==="subject"?Object.keys(z.set):[]))],x=new Map;for(let z of y){if(!("connect"in z)&&!("sever"in z))continue;let E=r.get("connect"in z?z.connect:z.sever);for(let[_,ie]of[["from",z.from],["to",z.to]]){let W=F(ie),V=_==="to"?E?.to:E?.from;W&&W!=="subject"&&V&&V!=="*"&&x.set(W,[...new Set([...x.get(W)??[],...V])])}}let A={};for(let z of y){if(!("set"in z)||"create"in z||"through"in z)continue;let E=F(z.target??"$subject");for(let _ of E&&E!=="subject"&&x.get(E)||[])A[_]=[...new Set([...A[_]??[],...Object.keys(z.set)])]}let w={};for(let z of y)if(!(!("set"in z)||"create"in z||"through"in z||F(z.target??"$subject")!=="subject"))for(let[E,_]of Object.entries(z.set??{}))typeof _=="string"&&F(_)===void 0||typeof _=="number"||typeof _=="boolean"?w[E]=typeof _=="string"&&_.startsWith("$$")?_.slice(1):_:delete w[E];let C=l.length===0&&y.every(z=>!("set"in z)||!z.set||Object.values(z.set).every(E=>!(E&&typeof E=="object"&&!Array.isArray(E)&&"expr"in E))),q=new Map;for(let z of y)if(!(!("set"in z)||!z.set))for(let E of Object.values(z.set))E&&typeof E=="object"&&!Array.isArray(E)&&"expr"in E&&q.set(E.expr,J(E.expr));a[i]={title:p.title??i.replace(/-/g," "),effects:y,args:[...m],...p.allowedWhen?{guard:J(p.allowedWhen)}:{},...p.refusal?{refusal:de(ee(p.refusal),e.kinds[[p.on??[]].flat()[0]??""]?.fields,void 0,p.args)}:{},exprs:[...q],destructive:d,idempotent:C,creates:l,connects:S,severs:b,writes:O,writesOther:A,sets:w}}let u={};for(let[i,p]of Object.entries(e.rules??{})){let y=p.covers&&p.over!=="graph"?ye(p.over,p.covers,m=>r.get(m),m=>m in e.kinds):void 0;u[i]={title:p.title??i.replace(/-/g," "),...p.require?{require:J(p.require)}:{},...y&&"plan"in y?{covers:y.plan}:{},...p.when?{when:J(p.when)}:{},...p.says?{says:de(ee(p.says),e.kinds[p.over]?.fields)}:{}}}let f=Ze(e,s),g=Je(e),c=Xe(e);return{format:He,document:e,findings:s,kinds:t,...e.computed?{facts:[...se(e)??[]]}:{},edges:[...r].map(([i,{from:p,to:y,cardinality:m}])=>[i,{from:p,to:y,cardinality:m}]),acts:a,rules:u,brand:f,...Object.keys(g).length>0?{viewSpecs:g}:{},...c?{home:c}:{}}}function Yt(e,s,r){let t=/^defineNode\("([^"]+)"\)/.exec(s)?.[1],o=t?r.kinds[t]:void 0;if(!t||!o)return e;let a=Object.keys(o.fields).filter(u=>u!=="label").slice(0,3);return{...e,path:`kinds.${t}.glance`,fix:`Say which: "glance": [${a.map(u=>`"${u}"`).join(", ")}] on kinds.${t} \u2014 the facts a person compares one by, at a glance.`}}function Gn(e,s){let r=[],t=new Set(Object.values(s.kinds).flatMap(o=>Object.keys(o.edges??{})));for(let[o,a]of Object.entries(e.kinds)){let u=a.renamedFrom;u&&!s.kinds[u]&&r.push(k("renamed-from-nothing",`kinds.${o}.renamedFrom`,`${o} says it was ${u}, and the previous version has no kind called ${u}`,"name the kind it was, or drop renamedFrom"));let f=s.kinds[u??o];for(let[g,c]of Object.entries(a.fields)){let i=c.renamedFrom;i&&!f?.fields[i]&&r.push(k("renamed-from-nothing",`kinds.${o}.fields.${g}.renamedFrom`,`${g} says it was ${i}, and the previous ${u??o} has no field called ${i}`,"name the field it was, or drop renamedFrom"))}for(let[g,c]of Object.entries(a.edges??{})){let i=c.renamedFrom;i&&!t.has(i)&&r.push(k("renamed-from-nothing",`kinds.${o}.edges.${g}.renamedFrom`,`${g} says it was ${i}, and the previous version has no relation called ${i}`,"name the relation it was, or drop renamedFrom"))}}return r}export{Mn as a,Ht as b,yn as c,Wt as d,Yt as e};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as o,l as u}from"./chunk.
|
|
1
|
+
import{g as o,l as u}from"./chunk.JCKIJSW7.js";function c(t,n,i){let e=r=>encodeURIComponent(r);return`${o}${e(t)}:${e(n)}:${e(i)}`}function S(t,n,i){let e=new Set(t.shown??[]);if(i?e.add(n):e.delete(n),e.size===0){let{shown:r,...w}=t;return w}return{...t,shown:[...e].sort()}}function l(t,n){if(n===null||n.trim().length===0){let{q:i,...e}=t;return e}return{...t,q:n}}function p(t){let n=t.q!==void 0&&t.within?.q===t.q;return l(n?u(t,"q",null):t,null)}function h(t,n){if(!n){let{past:i,...e}=t;return e}return{...t,past:!0}}function f(t,n){if(n===null||n.x===0&&n.y===0){let{pan:i,...e}=t;return e}return{...t,pan:n}}function d(t,n,i){let e={...t.pins};return i===null?delete e[n]:e[n]=i,{...t,pins:e}}export{c as a,S as b,l as c,p as d,h as e,f,d as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as n}from"./chunk.S2BMI23H.js";import{c as a}from"./chunk.MWWNKM3I.js";import"./chunk.6A3KTD66.js";import"./chunk.U5P23GO7.js";import"./chunk.RO3D2RNP.js";import"./chunk.MEAUTBVM.js";import"./chunk.OKHXXIMN.js";import"./chunk.NH3VXTGX.js";import"./chunk.6IMRCKB4.js";import"./chunk.GFBE4VNT.js";import"./chunk.RDUGUC7R.js";import"./chunk.OPMGQS5J.js";import"./chunk.F7KVEWFH.js";import"./chunk.QKRQPUCE.js";import"./chunk.MIE4TJRW.js";import"./chunk.3CLTABGP.js";import"./chunk.RD2FSSLV.js";import"./chunk.CVN2XFMF.js";import"./chunk.6TBQV3NO.js";import"./chunk.MT252WP4.js";import"./chunk.VVIQSFM4.js";import"./chunk.TQ3MNB6K.js";import"./chunk.VGYG2IBZ.js";import"./chunk.RJ7VSWTA.js";import"./chunk.P43LPXXJ.js";import{Y as i}from"./chunk.JCKIJSW7.js";import"./chunk.SDO3U72B.js";import"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import{b as o}from"./chunk.AJZBJBMO.js";var e=o(i(),1);function m({entries:d,style:l,headingStyle:p,className:r}){return(0,e.jsxs)("section",{...r?{className:r}:{},"data-testid":"record-ai","aria-label":"What AI did here",style:{display:"grid",gap:10,...l},children:[(0,e.jsx)("h2",{style:p??{margin:0,fontSize:"1rem"},children:"What AI did here"}),(0,e.jsx)("ol",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:8,fontSize:"0.875rem"},children:d.slice(0,8).map(t=>(0,e.jsx)(n,{entry:t,undo:s=>(0,e.jsx)(a,{batch:s})},t.id))})]})}export{m as RecordInteractions};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Qe,b as Xe,c as Je,d as rt,e as it,h as Ze,i as ea,k as aa,n as ta,o as ra,p as ia}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{a as Qe,b as Xe,c as Je,d as rt,e as it,h as Ze,i as ea,k as aa,n as ta,o as ra,p as ia}from"./chunk.4HU2ILFY.js";import{c as je}from"./chunk.EPSYX2SF.js";import{g as Ja,h as et,i as at}from"./chunk.JLNTE5CH.js";import"./chunk.T6UJEXFL.js";import{b as Ya,c as ja,d as Ye,e as Qa}from"./chunk.4QMAYVPU.js";import"./chunk.ZONRIOIA.js";import{m as Ee,q as _a,r as Ua,s as Va}from"./chunk.NXHEOHRR.js";import{a as Za}from"./chunk.HJCQ6I3S.js";import{b as Xa}from"./chunk.DJGZOPAS.js";import"./chunk.GFOZVQBQ.js";import{c as Ka}from"./chunk.3RRK6UTN.js";import"./chunk.MWWNKM3I.js";import{b as _e,d as Ue,e as Ve}from"./chunk.6A3KTD66.js";import"./chunk.U5P23GO7.js";import"./chunk.RO3D2RNP.js";import{b as Ge}from"./chunk.MEAUTBVM.js";import"./chunk.OKHXXIMN.js";import"./chunk.NH3VXTGX.js";import"./chunk.6IMRCKB4.js";import"./chunk.GFBE4VNT.js";import"./chunk.RDUGUC7R.js";import"./chunk.OPMGQS5J.js";import"./chunk.PQTXM4VY.js";import"./chunk.BIDL7GQD.js";import"./chunk.7KX36ENH.js";import"./chunk.QDDDKEBH.js";import"./chunk.QKRQPUCE.js";import{i as tt}from"./chunk.TBEKEHFS.js";import"./chunk.LHCGC3K6.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.4O64QV2Y.js";import"./chunk.OYMN3IFX.js";import"./chunk.UQZ2P6KD.js";import"./chunk.FOHZPYUV.js";import"./chunk.IXYG65TM.js";import"./chunk.W6L2VAJG.js";import"./chunk.N3MXLORL.js";import"./chunk.MIE4TJRW.js";import{c as Ba,d as Da,e as ue,p as Wa}from"./chunk.3CLTABGP.js";import"./chunk.RD2FSSLV.js";import"./chunk.CVN2XFMF.js";import"./chunk.6TBQV3NO.js";import"./chunk.MT252WP4.js";import"./chunk.VVIQSFM4.js";import"./chunk.TQ3MNB6K.js";import"./chunk.VGYG2IBZ.js";import{L as Ga,e as Ha,f as Oa,m as qe,q as Fa,x as qa}from"./chunk.RJ7VSWTA.js";import{b as Ta,c as Ct}from"./chunk.P43LPXXJ.js";import{$a as Ia,G as _,Oa as Ae,Ta as Pa,Ua as U,Xa as Na,Y as A,da as za,fa as Ma,ga as T,i as Ke,ia as Ce,j as Se,m as ee,n as $e,o as Fe,r as ge,ra as La,x as Ea,y as ve,z as Ra}from"./chunk.JCKIJSW7.js";import{a as ie}from"./chunk.SDO3U72B.js";import{Xc as Aa,Z as re,oa as $a,pa as ke,qa as G,va as Ca,xd as H,zd as B}from"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import{b as f}from"./chunk.AJZBJBMO.js";function At(e){return`
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
.graview-altitude-control {
|
|
@@ -1136,6 +1136,6 @@ var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=gl
|
|
|
1136
1136
|
}
|
|
1137
1137
|
[data-graview-connector][data-graview-activity] {
|
|
1138
1138
|
animation: graview-relation 1200ms cubic-bezier(0.22, 1, 0.36, 1);
|
|
1139
|
-
}`}function na(e="dark",o={}){let d=At(e);return o.scope===void 0?d:Ta(d,o.scope)}var I=f(_(),1);var V=f(A(),1),Et=Ae(ie(()=>(__graviewPreload(import.meta.url,["./chunk.PYGNO2AV.js","./chunk.3HFBHLXC.js","./chunk.CUA7F3YJ.js","./chunk.SDO3U72B.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.NTAC5NNE.js")))).part(e=>(0,V.jsx)(e.MapKey,{}),{quiet:!0});function oa(){let{store:e}=T(),{view:o}=U(),d=Ce(),s=(0,I.useMemo)(()=>e.graph.allEdges().length>0,[e,d]),[n,m]=(0,I.useState)(!1),v=(0,I.useId)(),g=(0,I.useRef)(null),y=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(!n)return;let b=k=>{let w=k.target;w&&(y.current?.contains(w)||g.current?.contains(w))||m(!1)};return document.addEventListener("pointerdown",b,!0),()=>document.removeEventListener("pointerdown",b,!0)},[n]);let[S,c]=(0,I.useState)(null);return(0,I.useEffect)(()=>{let b=g.current?.parentElement?.parentElement?.querySelector('[data-testid="overview"]');if(!b||typeof ResizeObserver>"u")return;let k=()=>c(Math.ceil(b.getBoundingClientRect().width));k();let w=new ResizeObserver(k);return w.observe(b),()=>w.disconnect()},[s]),s?(0,V.jsxs)("div",{style:{display:"contents"},onKeyDown:b=>{b.key!=="Escape"||!n||(b.preventDefault(),b.stopPropagation(),m(!1),g.current?.focus({preventScroll:!0}))},children:[(0,V.jsx)("button",{ref:g,type:"button","data-testid":"lines-key",className:"graview-lines-key","data-graview-up-row":o.overview?void 0:"","aria-expanded":n,"aria-controls":v,title:"What the lines mean",onClick:()=>m(b=>!b),style:{position:"absolute",top:60,right:"calc(14px + var(--graview-dock, 0px))",zIndex:B("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",...S!==null?{"--graview-up-room":`${S}px`}:{}},children:"Key"}),n?(0,V.jsxs)("div",{ref:y,id:v,"data-testid":"lines-key-pane",className:"graview-lines-key-pane","data-graview-up-row":o.overview?void 0:"","data-graview-offstage":"",style:{position:"absolute",top:98,right:"calc(14px + var(--graview-dock, 0px))",zIndex:B("rail"),width:it,maxHeight:"calc(100cqh - 120px)",overflowY:"auto",boxSizing:"border-box",padding:"8px 8px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[o.overview?(0,V.jsx)(Et,{}):null,(0,V.jsx)(rt,{inside:!0,widthOf:Za})]}):null]}):null}var Te=f(_(),1),Re=f(A(),1);function nt(e){return e.lens!==null?{what:"lens",kind:e.lens}:e.records.length===1&&e.districts.length===0?{what:"record",id:e.records[0]}:e.districts.length===1&&e.records.length===0?{what:"district",kind:e.districts[0]}:null}var Rt=Ae(ie(()=>(__graviewPreload(import.meta.url,["./chunk.WAIIXXVI.js","./chunk.DIVANC3G.js","./chunk.KP7HUXH5.js","./chunk.FUTSLXWN.js","./chunk.MZSWWMX6.js","./chunk.HJCQ6I3S.js","./chunk.4QBW46XV.js","./chunk.U5Q7EVZQ.js","./chunk.2T24FYAO.js","./chunk.JEQ6CA5M.js","./chunk.SUYYDJGZ.js","./chunk.YR7DKU5T.js","./chunk.5IM2X3VT.js","./chunk.BIDL7GQD.js","./chunk.NKUNCQB3.js","./chunk.HMV4ILAC.js","./chunk.XAN7QXMQ.js","./chunk.Q5WEOX3Q.js","./chunk.ZBK3FCVE.js","./chunk.DW6KXAUM.js","./chunk.MR776WQ2.js","./chunk.WVUJXDXZ.js","./chunk.IRPMGHZN.js","./chunk.7QWGIGHM.js","./chunk.HRLCDBMO.js","./chunk.LZNHTROY.js","./chunk.36FKQJFM.js","./chunk.RHV73CBA.js","./chunk.MIE4TJRW.js","./chunk.RP6C2IUM.js","./chunk.RD2FSSLV.js","./chunk.T552MHMU.js","./chunk.ZGJUCVT5.js","./chunk.CVVNHQPO.js","./chunk.YIDNZTON.js","./chunk.QILGAV7H.js","./chunk.I6HIVTXU.js","./chunk.PYGNO2AV.js","./chunk.3HFBHLXC.js","./chunk.CUA7F3YJ.js","./chunk.SDO3U72B.js","./chunk.IUVRJDL3.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.UJM5EZDM.js")))),Tt=Rt.part((e,o)=>(0,Re.jsx)(e.MapPanelFor,{showing:o.showing}),{what:"This panel",quiet:!0});function sa(){let{store:e,view:o,selection:d,hiddenKinds:s,seatTalk:n}=T();Ce();let m=(0,Te.useSyncExternalStore)(n.subscribe,()=>n.get().draft!==null,()=>!1);if(!o.overview||m)return null;let v=nt(Xa(d,{...o,beside:!0},g=>e.graph.getNode(g)?.kind));return!v||v.what!=="record"&&(s.has(v.kind)||!e.schema.kinds.includes(v.kind))?null:(0,Re.jsx)(Te.Suspense,{fallback:null,children:(0,Re.jsx)(Tt,{showing:v})})}var zt=f(_(),1);var D=f(A(),1);function da(){let{view:e,go:o}=U(),{store:d,views:s,hiddenKinds:n}=T(),m=e.overview??!1,v=s.places().map(k=>k.kind).filter(k=>!n.has(k)),g=Ga(e,d.schema.kinds,v),y=()=>{o(Se(ee(e,!1),g))},S=(()=>{if(!g)return null;let k=Ea(g)[0],w=e.within?.view,R=(w?s.places().find(P=>P.as===w):void 0)??(k?s.places().filter(P=>P.kind===k).at(-1):void 0);return R?R.title:k?G(d.schema,k):d.graph.getNode(g)?.label??null})(),c=m?"Close the map":"Up",b=m&&S?`Close the map, down to ${S}`:c;return(0,D.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":m,"aria-label":b,title:m?b:"Up \u2014 everything, from above",onClick:()=>m?y():o(ee(e,!0)),style:{position:"absolute",top:14,right:"calc(14px + var(--graview-dock, 0px))",zIndex:B("overview"),display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7,height:38,padding:"0 13px 0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.875rem",whiteSpace:"nowrap",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)","--graview-altitude":m?1:0,...m?{color:"var(--graview-accent)"}:{}},children:[(0,D.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,D.jsx)("ellipse",{className:"graview-altitude-mark-ring",cx:"6",cy:"6.6",rx:"5",ry:"2.6",fill:"none",stroke:"currentColor",strokeWidth:"0.9"}),(0,D.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,D.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,D.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,D.jsx)("span",{className:"graview-altitude-label",children:c})]})}var la=f(A(),1);function ca(){let{administered:e}=T(),{view:o,go:d}=U(),s=e.filter(n=>n.canShow);return s.length===0?null:(0,la.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:s.map(n=>(0,la.jsx)("button",{type:"button","aria-pressed":n.shown,"data-testid":`show-${n.name}`,title:n.shown?`Hide the ${n.name}'s own districts again`:n.description??`Show the ${n.name}'s own districts beside the domain`,onClick:()=>d(Ya(o,n.name,!n.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:n.shown?"var(--graview-accent)":"var(--graview-edge)",color:n.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:n.shown?"var(--graview-panel)":"transparent"},children:n.shown?`Hide the ${n.name}`:`Show the ${n.name}`},n.name))})}var u=f(_(),1);var t=f(A(),1);za({search:Ua,touchWeights:_a});var ne=e=>e!==void 0&&"act"in e,ze=e=>e!==void 0&&"hit"in e&&e.hit.about==="node"?e:void 0,Mt=e=>e.about==="rule"?"rule:":e.about==="act"?"act:":e.kind;function Lt(e){let o=()=>typeof window>"u"||window.innerWidth>=qt,[d,s]=(0,u.useState)(o);return(0,u.useEffect)(()=>{let n=()=>s(o());return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),d&&!e}function lt({compact:e=!1}){let{store:o,view:d,setView:s,principal:n,setMenuAt:m,brand:v,aiDesk:g,selection:y}=T(),S=Oa(g),c=Ma(),b=Pa(),k=Wa().marks.flag,w=Lt(e),R=(0,u.useRef)(null),P=(0,u.useRef)(null),z=(0,u.useRef)(null),W=(0,u.useId)(),[Le,N]=(0,u.useState)(!1),[K,oe]=(0,u.useState)(null),[ht,fe]=(0,u.useState)(null),[Pe,he]=(0,u.useState)([]),M=d.q??"";(0,u.useEffect)(()=>{let a=r=>{if(r.defaultPrevented)return;let i=r.key.toLowerCase()==="k"&&(r.metaKey||r.ctrlKey)&&!r.altKey&&!r.shiftKey,l=r.key==="/"&&!r.metaKey&&!r.ctrlKey&&!r.altKey;if(!i&&!l)return;let p=R.current;if(!p)return;let h=p.closest("[data-graview-embed]"),C=r.target,J=C===document.body||C===document.documentElement||C===window;if(h&&!(i&&J||C instanceof Node&&h.contains(C)))return;let Z=document.activeElement,pe=Z instanceof HTMLInputElement||Z instanceof HTMLTextAreaElement||Z instanceof HTMLSelectElement||Z instanceof HTMLElement&&Z.isContentEditable;l&&pe||(r.preventDefault(),p.getClientRects().length===0&&p.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),p.focus({preventScroll:!0}),p.select(),N(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);let Ne=(0,u.useMemo)(()=>{let a=new Map;for(let[i,l]of(c?.hits??[]).entries()){if(l.about==="act")continue;let p=Mt(l),h=a.get(p)??[];h.push({id:`${W}-${i}`,hit:l}),a.set(p,h)}let r=[...a.values()].filter(i=>i.some(l=>l.hit.about==="node")).length>1;return[...a.entries()].map(([i,l])=>{let p=0,h=l.filter(pe=>pe.hit.about!=="node"||!r||++p<=Wt),C=h.filter(pe=>pe.hit.about==="node").length,J=i.endsWith(":")?l.length:c?.byKind[i]??C,Z=!i.endsWith(":")&&C>0&&J>C?{id:`${W}-all-${i}`,all:i,count:J}:null;return{key:i,rows:h,count:J,more:Z}})},[c,W]),ae=S&&M.trim()?{id:`${W}-ask`,ask:M.trim()}:null,$=(0,u.useMemo)(()=>[...Ne.flatMap(a=>a.more?[...a.rows,a.more]:a.rows),...ae?[ae]:[]],[Ne,ae?.ask]),fa=(c?.hits??[]).filter(a=>a.about==="node").length,be=c?.words??M,Ie=(0,u.useMemo)(()=>Ee(be).split(" ").filter(Boolean),[be]),F=(0,u.useCallback)(a=>a.hit.about==="node"?Va(o,a.hit.id,be,{principal:n,limit:Kt}).map((r,i)=>({id:`${a.id}-act-${i}`,act:r,of:a.id})):[],[o,be,n]),He=$.find(a=>a.id===K),q=$.find(a=>a.id===ht)??He??$[0],se=(0,u.useMemo)(()=>w&&ze(q)?F(q):[],[w,q?.id,F]),xe=(0,u.useMemo)(()=>w?new Map:new Map(Pe.flatMap(a=>{let r=ze($.find(i=>i.id===a));return r?[[a,F(r)]]:[]})),[w,Pe,$,F]),bt=(0,u.useMemo)(()=>w?new Set:new Set($.flatMap(a=>ze(a)&&F(a).length>0?[a.id]:[])),[w,$,F]),Oe=(0,u.useMemo)(()=>w?se:[...xe.values()].flat(),[w,se,xe]),L=He??Oe.find(a=>a.id===K)??$[0];(0,u.useEffect)(()=>{oe(null),fe(null),he([])},[M]);let de=(0,u.useRef)(null);(0,u.useEffect)(()=>{let a=de.current;if(!a)return;de.current=null;let r=0,i=()=>{let l=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`),p=document.activeElement;if(!(!p||p===document.body||p===document.documentElement||p===R.current||p===z.current||p===l))return;let C=[...l?.querySelectorAll('[role="group"][aria-label="Arrange"] :is(button, input)')??[]].find(J=>J.checkVisibility?.()??!0);if(C)return C.focus({preventScroll:!0});l&&l.tabIndex>=0&&p!==l&&l.focus({preventScroll:!0}),++r<240?requestAnimationFrame(i):document.activeElement===z.current&&z.current?.blur()};requestAnimationFrame(i)},[d]);let Be=(a,r)=>{let i=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`);if(i&&i.tabIndex>=0)return i.focus({preventScroll:!0});let l=z.current;if(!l)return R.current?.blur();l.setAttribute("aria-label",r),l.focus({preventScroll:!0})},ha=(0,u.useRef)({x:Number.NaN,y:Number.NaN,moved:!1});(0,u.useEffect)(()=>{let a=r=>{let i=ha.current;i.moved=r.clientX!==i.x||r.clientY!==i.y,i.x=r.clientX,i.y=r.clientY};return window.addEventListener("mousemove",a,{capture:!0,passive:!0}),()=>window.removeEventListener("mousemove",a,{capture:!0})},[]);let le=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>clearTimeout(le.current),[]);let te=a=>{a&&(clearTimeout(le.current),oe(a.id),ne(a)||fe(a.id))},ba=a=>{if(!ha.current.moved)return;let r=a.target.closest?.('[role="option"]')?.id;if(!r||r===K)return;let i=$.find(l=>l.id===r)??Oe.find(l=>l.id===r);i&&(oe(i.id),!ne(i)&&(clearTimeout(le.current),le.current=setTimeout(()=>fe(i.id),Ft)))},xt=()=>{clearTimeout(le.current),q&&!ne(L)&&oe(q.id)},yt=a=>he(r=>r.includes(a.id)?r.filter(i=>i!==a.id):[...r,a.id]),xa=a=>{let r=P.current,i=r?.querySelector('[role="option"]')?.getBoundingClientRect().height??0,l=r?.clientHeight??0;return Math.min(a,i>0&&l>0?Math.max(1,Math.floor(l/i)-1):Bt)};(0,u.useEffect)(()=>{K&&document.getElementById(K)?.scrollIntoView?.({block:"nearest"})},[K]);let De=a=>{if(!a)return;if("ask"in a){Ha(g,{pointed:{...y[0]!==void 0?{on:y[0]}:{},about:y},asked:a.ask}),s(i=>Ye(i)),N(!1);return}if("all"in a)return s(i=>ve(ee(i,!1),ge(a.all),{ownPicture:!0,...i.q?{carry:i.q}:{}})),de.current=a.all,N(!1),Be(a.all,`Opening ${G(o.schema,a.all)} matching \u201C${M.trim()}\u201D\u2026`);if(ne(a)){let i=a.act.subject;s(p=>$e(p,[i]));let l=R.current?.getBoundingClientRect();m({x:l?.left??0,y:(l?.bottom??0)+6,on:i}),N(!1),R.current?.blur();return}let r=a.hit;switch(r.about){case"node":s(i=>$e(Se(ee(i,!1),r.id),[r.id]));break;case"kind":return s(i=>ve(ee(i,!1),ge(r.kind),{ownPicture:!0})),de.current=r.kind,N(!1),Be(r.kind,`Opening ${r.label}\u2026`);case"place":return s(i=>Ra(i,r.kind,r.as)),de.current=r.kind,N(!1),Be(r.kind,`Opening ${r.title}\u2026`);case"rule":{let i=b.filter(l=>l.invariant===r.name).flatMap(l=>l.nodeIds);s(l=>$e(l,[...new Set(i)]));break}case"act":break}N(!1),R.current?.blur()},kt=c?Ot(c.byKind,c.hits,o.schema):"",ce=Le&&M.trim().length>0,St=(0,u.useCallback)(()=>{let a=R.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(a)return{x:a.right,y:a.bottom-Vt};let r=R.current?.getBoundingClientRect();return r?{x:r.right,y:r.bottom}:null},[]),ya=Ia("find",{open:ce,onOpenChange:a=>{a||N(!1)},...e?{at:St}:{}}),ye=$.every(a=>"ask"in a),ka=a=>ne(a)?Oe.filter(r=>r.of===a.of):[],$t=a=>{let r=ne(L)&&K!==null,i=r?$.find(p=>p.id===L.of):K!==null?He:void 0,l=i?$.indexOf(i):-1;if(a.key==="ArrowDown"){if(a.preventDefault(),N(!0),r){let p=ka(L),h=p.indexOf(L)+1;if(h<p.length)return te(p[h]);if(w)return}te($[Math.min($.length-1,l+1)])}else if(a.key==="ArrowUp"){if(a.preventDefault(),r){let p=ka(L),h=p.indexOf(L)-1;return te(h>=0?p[h]:i)}te($[Math.max(0,l-1)])}else if((a.key==="PageDown"||a.key==="PageUp")&&$.length>0){a.preventDefault(),N(!0);let p=a.key==="PageDown"?xa($.length):-xa($.length);te($[Math.min($.length-1,Math.max(0,(l<0?-1:l)+p))])}else if(a.key==="ArrowRight"&&!r&&ze(L)){let p=L,h=w?p.id===q?.id?se:F(p):xe.get(p.id)??F(p);if(h.length===0)return;a.preventDefault(),!w&&!Pe.includes(p.id)&&he(C=>[...C,p.id]),fe(p.id),oe(h[0].id)}else if(a.key==="ArrowLeft"&&r){a.preventDefault();let p=L.of;w||he(h=>h.filter(C=>C!==p)),te($.find(h=>h.id===p))}else a.key==="Enter"?(a.preventDefault(),De(L)):a.key==="Escape"&&(a.preventDefault(),M?s(p=>Ye(p)):R.current?.blur())},We=(a,r,i={},l={})=>{let p=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":p,onClick:()=>De(a),style:{...er,...p?ar:null,...i},...l,children:r},a.id)},Sa=(a,r)=>{let i=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":i,"data-testid":"find-act","data-about":"act",onClick:()=>De(a),style:{...r?nr:pt,...i?or:null,...a.act.destructive?{color:"var(--graview-warn)"}:null},children:a.act.title},a.id)};return(0,t.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,t.jsx)("input",{ref:a=>{R.current=a,ya.trigger.ref(a)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":ce,"aria-controls":W,"aria-autocomplete":"list",...ce&&L?{"aria-activedescendant":L.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:M,onChange:a=>{let r=a.target.value;N(!0),s(i=>ja(i,r.length>0?r:null))},onFocus:()=>N(!0),onBlur:()=>N(!1),onKeyDown:$t,style:{width:"100%",boxSizing:"border-box",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-panel)",border:`1px solid ${M?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,t.jsx)("span",{role:"status","aria-live":"polite",style:qe,"data-testid":"find-count",children:M.trim()?kt:""}),(0,t.jsx)("span",{ref:z,tabIndex:-1,role:"status",style:qe,"data-testid":"find-landing"}),(0,t.jsxs)("div",{...ya.pane,id:W,role:"listbox","aria-label":M?`What \u201C${M}\u201D finds`:"What the words find","data-testid":"find-strip","data-graview-find":w?"panel":"narrow",hidden:!ce,onMouseDown:a=>a.preventDefault(),style:{..._t,...e?Yt:w&&!ye?Ut:null,...ce?{display:"flex"}:null},children:[(0,t.jsxs)("div",{style:{...jt,gridTemplateColumns:w&&!ye?`minmax(0, 1fr) ${Gt}`:"minmax(0, 1fr)"},children:[(0,t.jsxs)("div",{ref:P,role:"presentation","data-testid":"find-list",onMouseMove:ba,style:Qt,children:[ye?(0,t.jsxs)("p",{role:"presentation",style:{margin:0,padding:"10px 12px",color:"var(--graview-ink-muted)",fontSize:"0.875rem"},"data-testid":"find-nothing",children:["Nothing here is called \u201C",c?.words||M,"\u201D."]}):Ne.map(a=>(0,t.jsxs)("div",{role:"group","aria-label":st(a.key,o.schema),children:[(0,t.jsxs)("div",{role:"presentation",style:pa,children:[a.key!=="rule:"&&a.key!=="act:"?(0,t.jsx)(ct,{kind:a.key,accents:v?.accents}):null,(0,t.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:st(a.key,o.schema)}),(0,t.jsx)("span",{"aria-hidden":"true",style:Zt,"data-testid":"find-group-count",children:re(a.count)})]}),a.rows.map(r=>{let i=r.hit,l=i.about==="node"?i:null,p=!w&&l!==null&&bt.has(r.id),h=xe.get(r.id);return(0,t.jsxs)(u.Fragment,{children:[We(r,(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Nt,{hit:i,flag:k,words:l?.near&&l.why.matched?[...Ie,Ee(l.why.matched)]:Ie}),p?(0,t.jsx)("span",{"aria-hidden":"true","data-testid":"find-acts-open","data-open":h?"":void 0,title:h?"Put its actions away":"Actions",onClick:C=>{C.stopPropagation(),yt(r)},style:{...dr,...h?lr:null},children:(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"3.5",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"12.5",cy:"8",r:"1.4",fill:"currentColor"})]})}):null]}),p?{paddingRight:48}:{},{"data-testid":"find-hit","data-about":i.about,...l?.near?{"data-near":""}:{},title:Ht(i)}),h?(0,t.jsx)("div",{role:"group","aria-label":`What can be done about ${l?.label??"it"}`,style:sr,children:h.map(C=>Sa(C,!0))}):null]},r.id)}),a.more?We(a.more,(0,t.jsxs)("span",{style:Q,children:["All ",re(a.more.count)," ",ke(o.schema,a.more.all).toLowerCase()," matching \u201C",M.trim(),"\u201D"]}),tr,{"data-testid":"find-all","data-about":"all"}):null]},a.key)),ae?We(ae,(0,t.jsxs)("span",{style:Q,children:["Tell Graview: ",(0,t.jsxs)("span",{style:{fontWeight:600},children:["\u2018",ae.ask,"\u2019"]})]}),{borderTop:"1px solid var(--graview-edge)",marginTop:4},{"data-testid":"find-ask"}):null,fa>Dt?(0,t.jsxs)("p",{role:"presentation",style:dt,"data-testid":"find-more-words",children:[re(fa)," found: another word of the name narrows them."]}):null,c&&c.searched.past===!1&&c.searched.kinds.some(a=>o.schema.tryDefinition(a)?.lifecycle)?(0,t.jsx)("p",{role:"presentation",style:dt,children:"Current ones; add is:any for the past."}):null]}),w&&!ye&&q?(0,t.jsxs)("div",{role:"group","aria-label":"The one lit","data-testid":"find-panel",onMouseEnter:xt,onMouseMove:ba,style:Xt,children:[(0,t.jsx)(Pt,{row:q,schema:o.schema,accents:v?.accents,marking:Ie,q:M.trim(),flag:k}),se.length>0?(0,t.jsxs)("div",{role:"group","aria-label":"Actions",style:{display:"grid",gap:4},children:[(0,t.jsx)("div",{role:"presentation",style:{...pa,padding:"10px 0 4px"},children:"Actions"}),se.map(a=>Sa(a,!1))]}):null]}):null]}),e?null:(0,t.jsxs)("div",{"aria-hidden":"true",style:cr,"data-testid":"find-keys",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:me,children:"\u2191"}),(0,t.jsx)("kbd",{style:me,children:"\u2193"})," move"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:me,children:"\u21B5"})," open"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:me,children:"\u2192"})," actions"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:me,children:"esc"})," close"]})]})]})]})}function Pt({row:e,schema:o,accents:d,marking:s,q:n,flag:m}){let v=null,g="",y,S=null;if("ask"in e)g="Tell Graview",y=`\u2018${e.ask}\u2019`,S=(0,t.jsx)("p",{style:Y,children:"Says it to Graview about what is selected; the answer comes on a card beside it."});else if("all"in e)v=e.all,g=G(o,e.all),y=`All ${re(e.count)} matching \u201C${n}\u201D`,S=(0,t.jsxs)("p",{style:Y,children:["Opens the ",ke(o,e.all).toLowerCase(),", narrowed by these words."]});else{let c=e.hit;switch(c.about){case"node":{v=c.kind,g=ot(Ca(o.tryDefinition(c.kind),c.kind)),y=(0,t.jsxs)(t.Fragment,{children:[c.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[m," "]}):null,(0,t.jsx)(j,{text:c.label,words:s})]});let b=[c.apart,c.current?null:"past",c.archived?"set aside":null].filter(Boolean).join(" \xB7 ");S=(0,t.jsxs)(t.Fragment,{children:[b?(0,t.jsx)("p",{style:Y,children:ot(b)}):null,c.near?(0,t.jsxs)("p",{style:Y,children:["Near \u201C",c.why.asked,"\u201D",c.why.field!=="label"?` \u2014 ${c.why.reading.toLowerCase()}: ${c.why.fragment}`:""]}):c.why.field!=="label"?(0,t.jsxs)("p",{style:Y,children:[(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:c.why.reading}),(0,t.jsx)("br",{}),(0,t.jsx)(j,{text:c.why.fragment,words:s})]}):null]});break}case"kind":v=c.kind,g="Kind",y=c.label,S=(0,t.jsxs)("p",{style:Y,children:["Goes into the ",c.label.toLowerCase(),", all of them",c.count>0?`; ${re(c.count)} match these words`:"","."]});break;case"place":v=c.kind,g="Place",y=c.title,S=(0,t.jsxs)("p",{style:Y,children:["A picture of the ",ke(o,c.kind).toLowerCase(),"."]});break;case"rule":g="Rule",y=c.label,S=(0,t.jsx)("p",{style:Y,children:"Selects what it flags."});break;case"act":g="Act",y=c.title;break}}return(0,t.jsxs)("div",{role:"presentation","data-testid":"find-said",style:{display:"grid",gap:6},children:[(0,t.jsxs)("div",{style:{...pa,padding:0},children:[v?(0,t.jsx)(ct,{kind:v,accents:d}):null,g]}),(0,t.jsx)("div",{style:Jt,children:y}),S]})}function Nt({hit:e,flag:o,words:d}){switch(e.about){case"node":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{style:rr,children:[e.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[o," "]}):null,(0,t.jsx)(j,{text:e.label,words:d}),e.apart?(0,t.jsxs)("span",{style:we,children:[" \xB7 ",e.apart]}):null,e.current?null:(0,t.jsx)("span",{style:we,children:" \xB7 past"})]}),e.near?(0,t.jsxs)("span",{style:{...Q,...we},"data-testid":"find-near",children:["Near \u201C",e.why.asked,"\u201D",e.why.field!=="label"?` \u2014 ${e.why.reading.toLowerCase()}: `:"",e.why.field!=="label"?(0,t.jsx)(j,{text:e.why.fragment,words:d}):null]}):e.why.field!=="label"?(0,t.jsxs)("span",{style:{...Q,...we},children:[e.why.reading.toLowerCase(),": ",(0,t.jsx)(j,{text:e.why.fragment,words:d})]}):null]});case"kind":return(0,t.jsxs)("span",{style:Q,children:[(0,t.jsx)(j,{text:e.label,words:d}),(0,t.jsxs)("span",{style:we,children:[" \xB7 ",e.count," match"]})]});case"place":return(0,t.jsxs)("span",{style:Q,children:["Go to ",(0,t.jsx)(j,{text:e.title,words:d})]});case"rule":return(0,t.jsxs)("span",{style:Q,children:["The rule \u201C",(0,t.jsx)(j,{text:e.label,words:d}),"\u201D"]});case"act":return(0,t.jsx)("span",{style:Q,children:e.title})}}function It(e,o){if(o.length===0)return[{text:e}];let d=[],s=0;for(let n of e.matchAll(/[\p{L}\p{N}]+/gu)){let m=n[0],v=Ee(m).replace(/ /g,""),g=o.filter(c=>v.startsWith(c)).sort((c,b)=>b.length-c.length)[0];if(!g)continue;let y=v.length===m.length?g.length:m.length,S=n.index??0;S>s&&d.push({text:e.slice(s,S)}),d.push({text:m.slice(0,y),marked:!0}),s=S+y}return s<e.length&&d.push({text:e.slice(s)}),d}function j({text:e,words:o}){return(0,t.jsx)(t.Fragment,{children:It(e,o).map((d,s)=>d.marked?(0,t.jsx)("mark",{style:ir,children:d.text},s):(0,t.jsx)(u.Fragment,{children:d.text},s))})}function Ht(e){if(e.about!=="node")return"";let o=e.near?`Near \u201C${e.why.asked}\u201D`:e.why.field!=="label"?`${e.why.reading}: ${e.why.fragment}`:"";return o?`${e.label}
|
|
1140
|
-
${o}`:e.label}var ot=e=>e&&e[0].toUpperCase()+e.slice(1);function ct({kind:e,accents:o}){let d=Math.round(Aa(e,o));return(0,t.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${d} 55% 52%)`}})}function st(e,o){return e==="rule:"?"Rules":e==="act:"?"Acts":G(o,e)}function Ot(e,o,d){let s=Object.entries(e).map(([v,g])=>$a(d,v,g)),n=o.filter(v=>v.about==="kind"||v.about==="place"||v.about==="rule").length;n>0&&s.push(`${n} ${n===1?"place or rule":"places and rules"}`);let m=o.filter(v=>v.about==="node"&&v.near).length;return s.length===0?"Nothing found":`${s.join(", ")} found${m>0?`, ${m} of them near`:""}`}var Bt=10,Dt=12,Wt=5,Kt=6,Ft=140,qt=760,Gt="15.5rem",_t={...Na,flexDirection:"column",width:"min(26rem, calc(100vw - 24px))",maxHeight:"min(64vh, 30rem)",overflow:"hidden",boxSizing:"border-box",background:"linear-gradient(var(--graview-panel), var(--graview-panel)) var(--graview-ground, var(--graview-panel))",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:"1px solid var(--graview-edge)",borderRadius:10,boxShadow:"0 10px 28px rgb(0 0 0 / 0.18)",padding:0},Ut={width:"min(42rem, calc(100vw - 24px))"},Vt=6,Yt={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},jt={display:"grid",gridTemplateRows:"minmax(0, 1fr)",flex:"1 1 auto",minHeight:0},Qt={overflowY:"auto",overflowX:"hidden",minHeight:0,padding:"4px 0",overscrollBehavior:"contain"},Xt={overflowY:"auto",minHeight:0,padding:"12px 14px",borderLeft:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",display:"flex",flexDirection:"column",gap:4},Jt={fontWeight:600,fontSize:"0.9375rem",lineHeight:1.35,color:"var(--graview-ink)",overflowWrap:"anywhere"},Y={margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},pa={display:"flex",alignItems:"center",gap:6,padding:"10px 12px 4px",fontSize:"0.6875rem",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Zt={marginLeft:"auto",fontWeight:400,letterSpacing:0,fontVariantNumeric:"tabular-nums",color:"var(--graview-ink-faint)"},er={position:"relative",display:"grid",gap:1,minHeight:34,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)",minWidth:0},ar={background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))",boxShadow:"inset 3px 0 0 var(--graview-accent)"},tr={color:"var(--graview-accent)",fontSize:"0.8125rem",minHeight:30},Q={display:"block",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},rr={display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,minWidth:0,overflow:"hidden",overflowWrap:"anywhere",fontWeight:600},we={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400},ir={background:"color-mix(in srgb, var(--graview-accent) 24%, transparent)",color:"inherit",borderRadius:2,padding:0,boxShadow:"0 1px 0 color-mix(in srgb, var(--graview-accent) 70%, transparent)"},pt={display:"flex",alignItems:"center",minHeight:32,padding:"4px 10px",boxSizing:"border-box",borderWidth:1,borderStyle:"solid",borderColor:"var(--graview-edge)",borderRadius:6,background:"var(--graview-panel)",color:"var(--graview-ink)",fontSize:"0.8125rem",lineHeight:1.3,cursor:"pointer",overflowWrap:"anywhere"},nr={...pt,minHeight:32,margin:"0 12px 4px 24px"},or={borderColor:"var(--graview-accent)",boxShadow:"inset 0 0 0 1px var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))"},sr={display:"grid",padding:"2px 0 6px"},dr={position:"absolute",top:"50%",right:6,transform:"translateY(-50%)",width:36,height:32,display:"grid",placeItems:"center",borderRadius:6,color:"var(--graview-ink-muted)",borderWidth:1,borderStyle:"solid",borderColor:"transparent"},lr={color:"var(--graview-accent)",borderColor:"var(--graview-edge)",background:"var(--graview-panel)"},dt={margin:0,padding:"6px 12px 4px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},cr={display:"flex",flexWrap:"wrap",gap:"4px 14px",padding:"7px 12px",borderTop:"1px solid var(--graview-edge)",color:"var(--graview-ink-faint)",fontSize:"0.75rem",flex:"0 0 auto"},me={display:"inline-block",minWidth:16,padding:"0 4px",marginRight:3,border:"1px solid var(--graview-edge)",borderRadius:4,font:"inherit",fontSize:"0.6875rem",lineHeight:"16px",textAlign:"center",color:"var(--graview-ink-muted)",background:"var(--graview-panel)"};var Me=f(_(),1),ga=f(Ct(),1);var vt=f(A(),1);function gt(){let{following:e,follow:o}=T();return e?(0,vt.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>o(null),title:"Press, or Escape, to stop following",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,padding:"2px 9px",borderRadius:999,border:"1px solid var(--graview-accent)",background:"transparent",color:"var(--graview-accent)",fontSize:"0.875rem",whiteSpace:"nowrap"},children:["following ",e.name]}):null}var ut=f(_(),1);var E=f(A(),1);function wt({home:e,homeLabel:o,children:d,onPicture:s=!1}){let{view:n,focus:m,show:v,go:g}=U(),{store:y}=T(),{movedByHand:S}=T(),c=S&&(n.pan!==void 0||Object.keys(n.pins).length>0),b=n.focusId&&n.focusId!==e?y.graph.getNode(n.focusId):void 0,k=z=>G(y.schema,z),w={display:"inline-flex",alignItems:"center",gap:6,minHeight:26,padding:"2px 6px",fontSize:"0.8125rem",borderRadius:6,border:"1px solid transparent",boxShadow:"none",background:"transparent",color:"var(--graview-ink-muted)",whiteSpace:"nowrap"},R=o!==void 0&&b!==void 0,P=[];if(b&&!s&&P.push({key:"focused",node:(0,E.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>g(Fe({...n,focusId:e},!1)),title:Ge(y,b.id),style:{...w,maxWidth:"min(14rem, 15vw)"},children:[(0,E.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Ge(y,b.id)}),(0,E.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.past&&P.push({key:"past",node:(0,E.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>g(Qa(n,!1)),title:"Back to now \u2014 retired things leave the picture again",style:w,children:["the past",(0,E.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.zoom&&P.push({key:"zoomed",node:(0,E.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>g(Fe(n,!1)),title:"Zoom back out",style:w,children:["zoomed in",(0,E.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),c&&P.push({key:"moved",node:(0,E.jsx)("button",{type:"button","data-testid":"moved",onClick:()=>g(Ke(n)),title:"Put the camera and everything you dragged back where the layout wanted them",style:w,children:"Reset view"})}),n.relation){let z=n.relation;P.push({key:"raised",node:(0,E.jsxs)("span",{style:{display:"inline-flex",alignItems:"center"},children:[(0,E.jsxs)("button",{type:"button","data-testid":"raised-into",onClick:()=>g(ve(n,ge(z),{ownPicture:!0})),title:`Go into the ${k(z).toLowerCase()}`,"aria-label":`Go into the ${k(z).toLowerCase()}`,style:{...w,color:"var(--graview-ink)"},children:[k(z),(0,E.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\u2198"})]}),(0,E.jsx)("button",{type:"button","data-testid":"raised",onClick:()=>v(null),title:`Stop showing ${k(z).toLowerCase()}`,"aria-label":`Stop showing ${k(z).toLowerCase()}`,style:{...w,minWidth:26,justifyContent:"center"},children:(0,E.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})})]})})}return s&&!R&&P.length===0&&d===void 0?null:(0,E.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...s?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[R?(0,E.jsx)("button",{type:"button",onClick:()=>m(e),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:o}):null,P.map(({key:z,node:W},Le)=>(0,E.jsxs)(ut.Fragment,{children:[R||Le>0?(0,E.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,W]},z)),d]})}var O=f(A(),1);function va(){let[e,o]=(0,Me.useState)([]),d=(0,Me.useCallback)(s=>{o(n=>{let m=s.phase!=="running"&&n[0]?.name===s.name&&n[0]?.at===s.at;return[s,...m?n.slice(1):n].slice(0,12)})},[]);return[e,d]}function ua({find:e,calls:o,seat:d,remembers:s=!1}){return e?(0,O.jsxs)(O.Fragment,{children:[(0,ga.createPortal)((0,O.jsx)(lt,{compact:e.compact}),e.slot),e.own?(0,ga.createPortal)((0,O.jsx)(Ka,{calls:o,remembers:s,...d!==void 0?{seat:d}:{}}),e.own):null]}):null}function wa({home:e=null}){return(0,O.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px - var(--graview-dock, 0px))",zIndex:B("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,O.jsx)(wt,{home:e,onPicture:!0}),(0,O.jsx)("span",{style:{pointerEvents:"auto"},children:(0,O.jsx)(gt,{})})]})}var X=f(_(),1);var mt=f(A(),1),pr=ie(()=>(__graviewPreload(import.meta.url,["./chunk.Q355UPFG.js","./chunk.
|
|
1139
|
+
}`}function na(e="dark",o={}){let d=At(e);return o.scope===void 0?d:Ta(d,o.scope)}var I=f(_(),1);var V=f(A(),1),Et=Ae(ie(()=>(__graviewPreload(import.meta.url,["./chunk.RJ7VSWTA.js","./chunk.P43LPXXJ.js","./chunk.JCKIJSW7.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZY3NAJDM.js")))).part(e=>(0,V.jsx)(e.MapKey,{}),{quiet:!0});function oa(){let{store:e}=T(),{view:o}=U(),d=Ce(),s=(0,I.useMemo)(()=>e.graph.allEdges().length>0,[e,d]),[n,m]=(0,I.useState)(!1),v=(0,I.useId)(),g=(0,I.useRef)(null),y=(0,I.useRef)(null);(0,I.useEffect)(()=>{if(!n)return;let b=k=>{let w=k.target;w&&(y.current?.contains(w)||g.current?.contains(w))||m(!1)};return document.addEventListener("pointerdown",b,!0),()=>document.removeEventListener("pointerdown",b,!0)},[n]);let[S,c]=(0,I.useState)(null);return(0,I.useEffect)(()=>{let b=g.current?.parentElement?.parentElement?.querySelector('[data-testid="overview"]');if(!b||typeof ResizeObserver>"u")return;let k=()=>c(Math.ceil(b.getBoundingClientRect().width));k();let w=new ResizeObserver(k);return w.observe(b),()=>w.disconnect()},[s]),s?(0,V.jsxs)("div",{style:{display:"contents"},onKeyDown:b=>{b.key!=="Escape"||!n||(b.preventDefault(),b.stopPropagation(),m(!1),g.current?.focus({preventScroll:!0}))},children:[(0,V.jsx)("button",{ref:g,type:"button","data-testid":"lines-key",className:"graview-lines-key","data-graview-up-row":o.overview?void 0:"","aria-expanded":n,"aria-controls":v,title:"What the lines mean",onClick:()=>m(b=>!b),style:{position:"absolute",top:60,right:"calc(14px + var(--graview-dock, 0px))",zIndex:B("overview"),height:30,padding:"0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.8125rem",color:n?"var(--graview-accent)":"var(--graview-ink-muted)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",...S!==null?{"--graview-up-room":`${S}px`}:{}},children:"Key"}),n?(0,V.jsxs)("div",{ref:y,id:v,"data-testid":"lines-key-pane",className:"graview-lines-key-pane","data-graview-up-row":o.overview?void 0:"","data-graview-offstage":"",style:{position:"absolute",top:98,right:"calc(14px + var(--graview-dock, 0px))",zIndex:B("rail"),width:it,maxHeight:"calc(100cqh - 120px)",overflowY:"auto",boxSizing:"border-box",padding:"8px 8px",borderRadius:10,border:"1px solid var(--graview-edge)",background:"var(--graview-float)",boxShadow:"var(--graview-lift-high)"},children:[o.overview?(0,V.jsx)(Et,{}):null,(0,V.jsx)(rt,{inside:!0,widthOf:Za})]}):null]}):null}var Te=f(_(),1),Re=f(A(),1);function nt(e){return e.lens!==null?{what:"lens",kind:e.lens}:e.records.length===1&&e.districts.length===0?{what:"record",id:e.records[0]}:e.districts.length===1&&e.records.length===0?{what:"district",kind:e.districts[0]}:null}var Rt=Ae(ie(()=>(__graviewPreload(import.meta.url,["./chunk.JLNTE5CH.js","./chunk.7THS3DLZ.js","./chunk.4QMAYVPU.js","./chunk.ZONRIOIA.js","./chunk.NXHEOHRR.js","./chunk.HJCQ6I3S.js","./chunk.DJGZOPAS.js","./chunk.GFOZVQBQ.js","./chunk.67S2UWBT.js","./chunk.7PWLRRUS.js","./chunk.NH3VXTGX.js","./chunk.6IMRCKB4.js","./chunk.PQTXM4VY.js","./chunk.BIDL7GQD.js","./chunk.7KX36ENH.js","./chunk.QDDDKEBH.js","./chunk.QKRQPUCE.js","./chunk.Q5WEOX3Q.js","./chunk.4O64QV2Y.js","./chunk.OYMN3IFX.js","./chunk.UQZ2P6KD.js","./chunk.WVUJXDXZ.js","./chunk.NI4OPHTL.js","./chunk.U5KJQFAP.js","./chunk.FOHZPYUV.js","./chunk.IXYG65TM.js","./chunk.W6L2VAJG.js","./chunk.N3MXLORL.js","./chunk.MIE4TJRW.js","./chunk.3CLTABGP.js","./chunk.RD2FSSLV.js","./chunk.CVN2XFMF.js","./chunk.6TBQV3NO.js","./chunk.MT252WP4.js","./chunk.VVIQSFM4.js","./chunk.TQ3MNB6K.js","./chunk.VGYG2IBZ.js","./chunk.RJ7VSWTA.js","./chunk.P43LPXXJ.js","./chunk.JCKIJSW7.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ZLQIGZXO.js")))),Tt=Rt.part((e,o)=>(0,Re.jsx)(e.MapPanelFor,{showing:o.showing}),{what:"This panel",quiet:!0});function sa(){let{store:e,view:o,selection:d,hiddenKinds:s,seatTalk:n}=T();Ce();let m=(0,Te.useSyncExternalStore)(n.subscribe,()=>n.get().draft!==null,()=>!1);if(!o.overview||m)return null;let v=nt(Xa(d,{...o,beside:!0},g=>e.graph.getNode(g)?.kind));return!v||v.what!=="record"&&(s.has(v.kind)||!e.schema.kinds.includes(v.kind))?null:(0,Re.jsx)(Te.Suspense,{fallback:null,children:(0,Re.jsx)(Tt,{showing:v})})}var zt=f(_(),1);var D=f(A(),1);function da(){let{view:e,go:o}=U(),{store:d,views:s,hiddenKinds:n}=T(),m=e.overview??!1,v=s.places().map(k=>k.kind).filter(k=>!n.has(k)),g=Ga(e,d.schema.kinds,v),y=()=>{o(Se(ee(e,!1),g))},S=(()=>{if(!g)return null;let k=Ea(g)[0],w=e.within?.view,R=(w?s.places().find(P=>P.as===w):void 0)??(k?s.places().filter(P=>P.kind===k).at(-1):void 0);return R?R.title:k?G(d.schema,k):d.graph.getNode(g)?.label??null})(),c=m?"Close the map":"Up",b=m&&S?`Close the map, down to ${S}`:c;return(0,D.jsxs)("button",{type:"button","data-testid":"overview",className:"graview-altitude-control","aria-pressed":m,"aria-label":b,title:m?b:"Up \u2014 everything, from above",onClick:()=>m?y():o(ee(e,!0)),style:{position:"absolute",top:14,right:"calc(14px + var(--graview-dock, 0px))",zIndex:B("overview"),display:"inline-flex",alignItems:"center",justifyContent:"center",gap:7,height:38,padding:"0 13px 0 11px",borderRadius:8,borderColor:"transparent",fontSize:"0.875rem",whiteSpace:"nowrap",background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)","--graview-altitude":m?1:0,...m?{color:"var(--graview-accent)"}:{}},children:[(0,D.jsxs)("svg",{className:"graview-altitude-mark",width:"16",height:"16",viewBox:"0 0 12 12","aria-hidden":"true",children:[(0,D.jsx)("ellipse",{className:"graview-altitude-mark-ring",cx:"6",cy:"6.6",rx:"5",ry:"2.6",fill:"none",stroke:"currentColor",strokeWidth:"0.9"}),(0,D.jsx)("circle",{className:"graview-altitude-mark-apex",cx:"6",cy:"4",r:"1.5",fill:"currentColor"}),(0,D.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"left",cx:"1.6",cy:"7.4",r:"1.2",fill:"currentColor"}),(0,D.jsx)("circle",{className:"graview-altitude-mark-wing","data-side":"right",cx:"10.4",cy:"7.4",r:"1.2",fill:"currentColor"})]}),(0,D.jsx)("span",{className:"graview-altitude-label",children:c})]})}var la=f(A(),1);function ca(){let{administered:e}=T(),{view:o,go:d}=U(),s=e.filter(n=>n.canShow);return s.length===0?null:(0,la.jsx)("div",{role:"group","aria-label":"Administered","data-testid":"administered",style:{display:"flex",gap:6},children:s.map(n=>(0,la.jsx)("button",{type:"button","aria-pressed":n.shown,"data-testid":`show-${n.name}`,title:n.shown?`Hide the ${n.name}'s own districts again`:n.description??`Show the ${n.name}'s own districts beside the domain`,onClick:()=>d(Ya(o,n.name,!n.shown)),style:{padding:"3px 11px",borderRadius:999,fontSize:"0.875rem",borderWidth:1,borderStyle:"solid",borderColor:n.shown?"var(--graview-accent)":"var(--graview-edge)",color:n.shown?"var(--graview-accent)":"var(--graview-ink-muted)",background:n.shown?"var(--graview-panel)":"transparent"},children:n.shown?`Hide the ${n.name}`:`Show the ${n.name}`},n.name))})}var u=f(_(),1);var t=f(A(),1);za({search:Ua,touchWeights:_a});var ne=e=>e!==void 0&&"act"in e,ze=e=>e!==void 0&&"hit"in e&&e.hit.about==="node"?e:void 0,Mt=e=>e.about==="rule"?"rule:":e.about==="act"?"act:":e.kind;function Lt(e){let o=()=>typeof window>"u"||window.innerWidth>=qt,[d,s]=(0,u.useState)(o);return(0,u.useEffect)(()=>{let n=()=>s(o());return window.addEventListener("resize",n),()=>window.removeEventListener("resize",n)},[]),d&&!e}function lt({compact:e=!1}){let{store:o,view:d,setView:s,principal:n,setMenuAt:m,brand:v,aiDesk:g,selection:y}=T(),S=Oa(g),c=Ma(),b=Pa(),k=Wa().marks.flag,w=Lt(e),R=(0,u.useRef)(null),P=(0,u.useRef)(null),z=(0,u.useRef)(null),W=(0,u.useId)(),[Le,N]=(0,u.useState)(!1),[K,oe]=(0,u.useState)(null),[ht,fe]=(0,u.useState)(null),[Pe,he]=(0,u.useState)([]),M=d.q??"";(0,u.useEffect)(()=>{let a=r=>{if(r.defaultPrevented)return;let i=r.key.toLowerCase()==="k"&&(r.metaKey||r.ctrlKey)&&!r.altKey&&!r.shiftKey,l=r.key==="/"&&!r.metaKey&&!r.ctrlKey&&!r.altKey;if(!i&&!l)return;let p=R.current;if(!p)return;let h=p.closest("[data-graview-embed]"),C=r.target,J=C===document.body||C===document.documentElement||C===window;if(h&&!(i&&J||C instanceof Node&&h.contains(C)))return;let Z=document.activeElement,pe=Z instanceof HTMLInputElement||Z instanceof HTMLTextAreaElement||Z instanceof HTMLSelectElement||Z instanceof HTMLElement&&Z.isContentEditable;l&&pe||(r.preventDefault(),p.getClientRects().length===0&&p.closest("[data-graview-app-bar]")?.querySelector('[data-testid="app-find-open"]')?.click(),p.focus({preventScroll:!0}),p.select(),N(!0))};return window.addEventListener("keydown",a),()=>window.removeEventListener("keydown",a)},[]);let Ne=(0,u.useMemo)(()=>{let a=new Map;for(let[i,l]of(c?.hits??[]).entries()){if(l.about==="act")continue;let p=Mt(l),h=a.get(p)??[];h.push({id:`${W}-${i}`,hit:l}),a.set(p,h)}let r=[...a.values()].filter(i=>i.some(l=>l.hit.about==="node")).length>1;return[...a.entries()].map(([i,l])=>{let p=0,h=l.filter(pe=>pe.hit.about!=="node"||!r||++p<=Wt),C=h.filter(pe=>pe.hit.about==="node").length,J=i.endsWith(":")?l.length:c?.byKind[i]??C,Z=!i.endsWith(":")&&C>0&&J>C?{id:`${W}-all-${i}`,all:i,count:J}:null;return{key:i,rows:h,count:J,more:Z}})},[c,W]),ae=S&&M.trim()?{id:`${W}-ask`,ask:M.trim()}:null,$=(0,u.useMemo)(()=>[...Ne.flatMap(a=>a.more?[...a.rows,a.more]:a.rows),...ae?[ae]:[]],[Ne,ae?.ask]),fa=(c?.hits??[]).filter(a=>a.about==="node").length,be=c?.words??M,Ie=(0,u.useMemo)(()=>Ee(be).split(" ").filter(Boolean),[be]),F=(0,u.useCallback)(a=>a.hit.about==="node"?Va(o,a.hit.id,be,{principal:n,limit:Kt}).map((r,i)=>({id:`${a.id}-act-${i}`,act:r,of:a.id})):[],[o,be,n]),He=$.find(a=>a.id===K),q=$.find(a=>a.id===ht)??He??$[0],se=(0,u.useMemo)(()=>w&&ze(q)?F(q):[],[w,q?.id,F]),xe=(0,u.useMemo)(()=>w?new Map:new Map(Pe.flatMap(a=>{let r=ze($.find(i=>i.id===a));return r?[[a,F(r)]]:[]})),[w,Pe,$,F]),bt=(0,u.useMemo)(()=>w?new Set:new Set($.flatMap(a=>ze(a)&&F(a).length>0?[a.id]:[])),[w,$,F]),Oe=(0,u.useMemo)(()=>w?se:[...xe.values()].flat(),[w,se,xe]),L=He??Oe.find(a=>a.id===K)??$[0];(0,u.useEffect)(()=>{oe(null),fe(null),he([])},[M]);let de=(0,u.useRef)(null);(0,u.useEffect)(()=>{let a=de.current;if(!a)return;de.current=null;let r=0,i=()=>{let l=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`),p=document.activeElement;if(!(!p||p===document.body||p===document.documentElement||p===R.current||p===z.current||p===l))return;let C=[...l?.querySelectorAll('[role="group"][aria-label="Arrange"] :is(button, input)')??[]].find(J=>J.checkVisibility?.()??!0);if(C)return C.focus({preventScroll:!0});l&&l.tabIndex>=0&&p!==l&&l.focus({preventScroll:!0}),++r<240?requestAnimationFrame(i):document.activeElement===z.current&&z.current?.blur()};requestAnimationFrame(i)},[d]);let Be=(a,r)=>{let i=document.querySelector(`[data-graview-view="aggregate:${CSS.escape(a)}"]`);if(i&&i.tabIndex>=0)return i.focus({preventScroll:!0});let l=z.current;if(!l)return R.current?.blur();l.setAttribute("aria-label",r),l.focus({preventScroll:!0})},ha=(0,u.useRef)({x:Number.NaN,y:Number.NaN,moved:!1});(0,u.useEffect)(()=>{let a=r=>{let i=ha.current;i.moved=r.clientX!==i.x||r.clientY!==i.y,i.x=r.clientX,i.y=r.clientY};return window.addEventListener("mousemove",a,{capture:!0,passive:!0}),()=>window.removeEventListener("mousemove",a,{capture:!0})},[]);let le=(0,u.useRef)(void 0);(0,u.useEffect)(()=>()=>clearTimeout(le.current),[]);let te=a=>{a&&(clearTimeout(le.current),oe(a.id),ne(a)||fe(a.id))},ba=a=>{if(!ha.current.moved)return;let r=a.target.closest?.('[role="option"]')?.id;if(!r||r===K)return;let i=$.find(l=>l.id===r)??Oe.find(l=>l.id===r);i&&(oe(i.id),!ne(i)&&(clearTimeout(le.current),le.current=setTimeout(()=>fe(i.id),Ft)))},xt=()=>{clearTimeout(le.current),q&&!ne(L)&&oe(q.id)},yt=a=>he(r=>r.includes(a.id)?r.filter(i=>i!==a.id):[...r,a.id]),xa=a=>{let r=P.current,i=r?.querySelector('[role="option"]')?.getBoundingClientRect().height??0,l=r?.clientHeight??0;return Math.min(a,i>0&&l>0?Math.max(1,Math.floor(l/i)-1):Bt)};(0,u.useEffect)(()=>{K&&document.getElementById(K)?.scrollIntoView?.({block:"nearest"})},[K]);let De=a=>{if(!a)return;if("ask"in a){Ha(g,{pointed:{...y[0]!==void 0?{on:y[0]}:{},about:y},asked:a.ask}),s(i=>Ye(i)),N(!1);return}if("all"in a)return s(i=>ve(ee(i,!1),ge(a.all),{ownPicture:!0,...i.q?{carry:i.q}:{}})),de.current=a.all,N(!1),Be(a.all,`Opening ${G(o.schema,a.all)} matching \u201C${M.trim()}\u201D\u2026`);if(ne(a)){let i=a.act.subject;s(p=>$e(p,[i]));let l=R.current?.getBoundingClientRect();m({x:l?.left??0,y:(l?.bottom??0)+6,on:i}),N(!1),R.current?.blur();return}let r=a.hit;switch(r.about){case"node":s(i=>$e(Se(ee(i,!1),r.id),[r.id]));break;case"kind":return s(i=>ve(ee(i,!1),ge(r.kind),{ownPicture:!0})),de.current=r.kind,N(!1),Be(r.kind,`Opening ${r.label}\u2026`);case"place":return s(i=>Ra(i,r.kind,r.as)),de.current=r.kind,N(!1),Be(r.kind,`Opening ${r.title}\u2026`);case"rule":{let i=b.filter(l=>l.invariant===r.name).flatMap(l=>l.nodeIds);s(l=>$e(l,[...new Set(i)]));break}case"act":break}N(!1),R.current?.blur()},kt=c?Ot(c.byKind,c.hits,o.schema):"",ce=Le&&M.trim().length>0,St=(0,u.useCallback)(()=>{let a=R.current?.closest("[data-graview-app-bar]")?.getBoundingClientRect();if(a)return{x:a.right,y:a.bottom-Vt};let r=R.current?.getBoundingClientRect();return r?{x:r.right,y:r.bottom}:null},[]),ya=Ia("find",{open:ce,onOpenChange:a=>{a||N(!1)},...e?{at:St}:{}}),ye=$.every(a=>"ask"in a),ka=a=>ne(a)?Oe.filter(r=>r.of===a.of):[],$t=a=>{let r=ne(L)&&K!==null,i=r?$.find(p=>p.id===L.of):K!==null?He:void 0,l=i?$.indexOf(i):-1;if(a.key==="ArrowDown"){if(a.preventDefault(),N(!0),r){let p=ka(L),h=p.indexOf(L)+1;if(h<p.length)return te(p[h]);if(w)return}te($[Math.min($.length-1,l+1)])}else if(a.key==="ArrowUp"){if(a.preventDefault(),r){let p=ka(L),h=p.indexOf(L)-1;return te(h>=0?p[h]:i)}te($[Math.max(0,l-1)])}else if((a.key==="PageDown"||a.key==="PageUp")&&$.length>0){a.preventDefault(),N(!0);let p=a.key==="PageDown"?xa($.length):-xa($.length);te($[Math.min($.length-1,Math.max(0,(l<0?-1:l)+p))])}else if(a.key==="ArrowRight"&&!r&&ze(L)){let p=L,h=w?p.id===q?.id?se:F(p):xe.get(p.id)??F(p);if(h.length===0)return;a.preventDefault(),!w&&!Pe.includes(p.id)&&he(C=>[...C,p.id]),fe(p.id),oe(h[0].id)}else if(a.key==="ArrowLeft"&&r){a.preventDefault();let p=L.of;w||he(h=>h.filter(C=>C!==p)),te($.find(h=>h.id===p))}else a.key==="Enter"?(a.preventDefault(),De(L)):a.key==="Escape"&&(a.preventDefault(),M?s(p=>Ye(p)):R.current?.blur())},We=(a,r,i={},l={})=>{let p=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":p,onClick:()=>De(a),style:{...er,...p?ar:null,...i},...l,children:r},a.id)},Sa=(a,r)=>{let i=a.id===L?.id;return(0,t.jsx)("div",{id:a.id,role:"option","aria-selected":i,"data-testid":"find-act","data-about":"act",onClick:()=>De(a),style:{...r?nr:pt,...i?or:null,...a.act.destructive?{color:"var(--graview-warn)"}:null},children:a.act.title},a.id)};return(0,t.jsxs)("div",{style:{position:"relative",minWidth:0,flex:"1 1 auto"},"data-testid":"find",children:[(0,t.jsx)("input",{ref:a=>{R.current=a,ya.trigger.ref(a)},"data-graview-popover-trigger":"find",type:"search",role:"combobox","aria-label":"Find anything","aria-expanded":ce,"aria-controls":W,"aria-autocomplete":"list",...ce&&L?{"aria-activedescendant":L.id}:{},"data-testid":"find-box",placeholder:"Find\u2026","aria-keyshortcuts":"/ Meta+K Control+K",value:M,onChange:a=>{let r=a.target.value;N(!0),s(i=>ja(i,r.length>0?r:null))},onFocus:()=>N(!0),onBlur:()=>N(!1),onKeyDown:$t,style:{width:"100%",boxSizing:"border-box",minWidth:0,height:30,padding:"0 var(--graview-bar-find-end, 10px) 0 10px",font:"inherit",fontSize:"0.875rem",color:"var(--graview-ink)",background:"var(--graview-panel)",border:`1px solid ${M?"var(--graview-accent)":"var(--graview-edge)"}`,borderRadius:8}}),(0,t.jsx)("span",{role:"status","aria-live":"polite",style:qe,"data-testid":"find-count",children:M.trim()?kt:""}),(0,t.jsx)("span",{ref:z,tabIndex:-1,role:"status",style:qe,"data-testid":"find-landing"}),(0,t.jsxs)("div",{...ya.pane,id:W,role:"listbox","aria-label":M?`What \u201C${M}\u201D finds`:"What the words find","data-testid":"find-strip","data-graview-find":w?"panel":"narrow",hidden:!ce,onMouseDown:a=>a.preventDefault(),style:{..._t,...e?Yt:w&&!ye?Ut:null,...ce?{display:"flex"}:null},children:[(0,t.jsxs)("div",{style:{...jt,gridTemplateColumns:w&&!ye?`minmax(0, 1fr) ${Gt}`:"minmax(0, 1fr)"},children:[(0,t.jsxs)("div",{ref:P,role:"presentation","data-testid":"find-list",onMouseMove:ba,style:Qt,children:[ye?(0,t.jsxs)("p",{role:"presentation",style:{margin:0,padding:"10px 12px",color:"var(--graview-ink-muted)",fontSize:"0.875rem"},"data-testid":"find-nothing",children:["Nothing here is called \u201C",c?.words||M,"\u201D."]}):Ne.map(a=>(0,t.jsxs)("div",{role:"group","aria-label":st(a.key,o.schema),children:[(0,t.jsxs)("div",{role:"presentation",style:pa,children:[a.key!=="rule:"&&a.key!=="act:"?(0,t.jsx)(ct,{kind:a.key,accents:v?.accents}):null,(0,t.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:st(a.key,o.schema)}),(0,t.jsx)("span",{"aria-hidden":"true",style:Zt,"data-testid":"find-group-count",children:re(a.count)})]}),a.rows.map(r=>{let i=r.hit,l=i.about==="node"?i:null,p=!w&&l!==null&&bt.has(r.id),h=xe.get(r.id);return(0,t.jsxs)(u.Fragment,{children:[We(r,(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(Nt,{hit:i,flag:k,words:l?.near&&l.why.matched?[...Ie,Ee(l.why.matched)]:Ie}),p?(0,t.jsx)("span",{"aria-hidden":"true","data-testid":"find-acts-open","data-open":h?"":void 0,title:h?"Put its actions away":"Actions",onClick:C=>{C.stopPropagation(),yt(r)},style:{...dr,...h?lr:null},children:(0,t.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,t.jsx)("circle",{cx:"3.5",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"8",cy:"8",r:"1.4",fill:"currentColor"}),(0,t.jsx)("circle",{cx:"12.5",cy:"8",r:"1.4",fill:"currentColor"})]})}):null]}),p?{paddingRight:48}:{},{"data-testid":"find-hit","data-about":i.about,...l?.near?{"data-near":""}:{},title:Ht(i)}),h?(0,t.jsx)("div",{role:"group","aria-label":`What can be done about ${l?.label??"it"}`,style:sr,children:h.map(C=>Sa(C,!0))}):null]},r.id)}),a.more?We(a.more,(0,t.jsxs)("span",{style:Q,children:["All ",re(a.more.count)," ",ke(o.schema,a.more.all).toLowerCase()," matching \u201C",M.trim(),"\u201D"]}),tr,{"data-testid":"find-all","data-about":"all"}):null]},a.key)),ae?We(ae,(0,t.jsxs)("span",{style:Q,children:["Tell Graview: ",(0,t.jsxs)("span",{style:{fontWeight:600},children:["\u2018",ae.ask,"\u2019"]})]}),{borderTop:"1px solid var(--graview-edge)",marginTop:4},{"data-testid":"find-ask"}):null,fa>Dt?(0,t.jsxs)("p",{role:"presentation",style:dt,"data-testid":"find-more-words",children:[re(fa)," found: another word of the name narrows them."]}):null,c&&c.searched.past===!1&&c.searched.kinds.some(a=>o.schema.tryDefinition(a)?.lifecycle)?(0,t.jsx)("p",{role:"presentation",style:dt,children:"Current ones; add is:any for the past."}):null]}),w&&!ye&&q?(0,t.jsxs)("div",{role:"group","aria-label":"The one lit","data-testid":"find-panel",onMouseEnter:xt,onMouseMove:ba,style:Xt,children:[(0,t.jsx)(Pt,{row:q,schema:o.schema,accents:v?.accents,marking:Ie,q:M.trim(),flag:k}),se.length>0?(0,t.jsxs)("div",{role:"group","aria-label":"Actions",style:{display:"grid",gap:4},children:[(0,t.jsx)("div",{role:"presentation",style:{...pa,padding:"10px 0 4px"},children:"Actions"}),se.map(a=>Sa(a,!1))]}):null]}):null]}),e?null:(0,t.jsxs)("div",{"aria-hidden":"true",style:cr,"data-testid":"find-keys",children:[(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:me,children:"\u2191"}),(0,t.jsx)("kbd",{style:me,children:"\u2193"})," move"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:me,children:"\u21B5"})," open"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:me,children:"\u2192"})," actions"]}),(0,t.jsxs)("span",{children:[(0,t.jsx)("kbd",{style:me,children:"esc"})," close"]})]})]})]})}function Pt({row:e,schema:o,accents:d,marking:s,q:n,flag:m}){let v=null,g="",y,S=null;if("ask"in e)g="Tell Graview",y=`\u2018${e.ask}\u2019`,S=(0,t.jsx)("p",{style:Y,children:"Says it to Graview about what is selected; the answer comes on a card beside it."});else if("all"in e)v=e.all,g=G(o,e.all),y=`All ${re(e.count)} matching \u201C${n}\u201D`,S=(0,t.jsxs)("p",{style:Y,children:["Opens the ",ke(o,e.all).toLowerCase(),", narrowed by these words."]});else{let c=e.hit;switch(c.about){case"node":{v=c.kind,g=ot(Ca(o.tryDefinition(c.kind),c.kind)),y=(0,t.jsxs)(t.Fragment,{children:[c.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[m," "]}):null,(0,t.jsx)(j,{text:c.label,words:s})]});let b=[c.apart,c.current?null:"past",c.archived?"set aside":null].filter(Boolean).join(" \xB7 ");S=(0,t.jsxs)(t.Fragment,{children:[b?(0,t.jsx)("p",{style:Y,children:ot(b)}):null,c.near?(0,t.jsxs)("p",{style:Y,children:["Near \u201C",c.why.asked,"\u201D",c.why.field!=="label"?` \u2014 ${c.why.reading.toLowerCase()}: ${c.why.fragment}`:""]}):c.why.field!=="label"?(0,t.jsxs)("p",{style:Y,children:[(0,t.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:c.why.reading}),(0,t.jsx)("br",{}),(0,t.jsx)(j,{text:c.why.fragment,words:s})]}):null]});break}case"kind":v=c.kind,g="Kind",y=c.label,S=(0,t.jsxs)("p",{style:Y,children:["Goes into the ",c.label.toLowerCase(),", all of them",c.count>0?`; ${re(c.count)} match these words`:"","."]});break;case"place":v=c.kind,g="Place",y=c.title,S=(0,t.jsxs)("p",{style:Y,children:["A picture of the ",ke(o,c.kind).toLowerCase(),"."]});break;case"rule":g="Rule",y=c.label,S=(0,t.jsx)("p",{style:Y,children:"Selects what it flags."});break;case"act":g="Act",y=c.title;break}}return(0,t.jsxs)("div",{role:"presentation","data-testid":"find-said",style:{display:"grid",gap:6},children:[(0,t.jsxs)("div",{style:{...pa,padding:0},children:[v?(0,t.jsx)(ct,{kind:v,accents:d}):null,g]}),(0,t.jsx)("div",{style:Jt,children:y}),S]})}function Nt({hit:e,flag:o,words:d}){switch(e.about){case"node":return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("span",{style:rr,children:[e.flagged?(0,t.jsxs)("span",{style:{color:"var(--graview-warn)"},children:[o," "]}):null,(0,t.jsx)(j,{text:e.label,words:d}),e.apart?(0,t.jsxs)("span",{style:we,children:[" \xB7 ",e.apart]}):null,e.current?null:(0,t.jsx)("span",{style:we,children:" \xB7 past"})]}),e.near?(0,t.jsxs)("span",{style:{...Q,...we},"data-testid":"find-near",children:["Near \u201C",e.why.asked,"\u201D",e.why.field!=="label"?` \u2014 ${e.why.reading.toLowerCase()}: `:"",e.why.field!=="label"?(0,t.jsx)(j,{text:e.why.fragment,words:d}):null]}):e.why.field!=="label"?(0,t.jsxs)("span",{style:{...Q,...we},children:[e.why.reading.toLowerCase(),": ",(0,t.jsx)(j,{text:e.why.fragment,words:d})]}):null]});case"kind":return(0,t.jsxs)("span",{style:Q,children:[(0,t.jsx)(j,{text:e.label,words:d}),(0,t.jsxs)("span",{style:we,children:[" \xB7 ",e.count," match"]})]});case"place":return(0,t.jsxs)("span",{style:Q,children:["Go to ",(0,t.jsx)(j,{text:e.title,words:d})]});case"rule":return(0,t.jsxs)("span",{style:Q,children:["The rule \u201C",(0,t.jsx)(j,{text:e.label,words:d}),"\u201D"]});case"act":return(0,t.jsx)("span",{style:Q,children:e.title})}}function It(e,o){if(o.length===0)return[{text:e}];let d=[],s=0;for(let n of e.matchAll(/[\p{L}\p{N}]+/gu)){let m=n[0],v=Ee(m).replace(/ /g,""),g=o.filter(c=>v.startsWith(c)).sort((c,b)=>b.length-c.length)[0];if(!g)continue;let y=v.length===m.length?g.length:m.length,S=n.index??0;S>s&&d.push({text:e.slice(s,S)}),d.push({text:m.slice(0,y),marked:!0}),s=S+y}return s<e.length&&d.push({text:e.slice(s)}),d}function j({text:e,words:o}){return(0,t.jsx)(t.Fragment,{children:It(e,o).map((d,s)=>d.marked?(0,t.jsx)("mark",{style:ir,children:d.text},s):(0,t.jsx)(u.Fragment,{children:d.text},s))})}function Ht(e){if(e.about!=="node")return"";let o=e.near?`Near \u201C${e.why.asked}\u201D`:e.why.field!=="label"?`${e.why.reading}: ${e.why.fragment}`:"";return o?`${e.label}
|
|
1140
|
+
${o}`:e.label}var ot=e=>e&&e[0].toUpperCase()+e.slice(1);function ct({kind:e,accents:o}){let d=Math.round(Aa(e,o));return(0,t.jsx)("span",{"aria-hidden":"true",style:{width:8,height:8,borderRadius:2,flex:"0 0 auto",background:`hsl(${d} 55% 52%)`}})}function st(e,o){return e==="rule:"?"Rules":e==="act:"?"Acts":G(o,e)}function Ot(e,o,d){let s=Object.entries(e).map(([v,g])=>$a(d,v,g)),n=o.filter(v=>v.about==="kind"||v.about==="place"||v.about==="rule").length;n>0&&s.push(`${n} ${n===1?"place or rule":"places and rules"}`);let m=o.filter(v=>v.about==="node"&&v.near).length;return s.length===0?"Nothing found":`${s.join(", ")} found${m>0?`, ${m} of them near`:""}`}var Bt=10,Dt=12,Wt=5,Kt=6,Ft=140,qt=760,Gt="15.5rem",_t={...Na,flexDirection:"column",width:"min(26rem, calc(100vw - 24px))",maxHeight:"min(64vh, 30rem)",overflow:"hidden",boxSizing:"border-box",background:"linear-gradient(var(--graview-panel), var(--graview-panel)) var(--graview-ground, var(--graview-panel))",borderTop:"1px solid var(--graview-edge)",borderRight:"1px solid var(--graview-edge)",borderBottom:"1px solid var(--graview-edge)",borderLeft:"1px solid var(--graview-edge)",borderRadius:10,boxShadow:"0 10px 28px rgb(0 0 0 / 0.18)",padding:0},Ut={width:"min(42rem, calc(100vw - 24px))"},Vt=6,Yt={width:"var(--graview-bar-width, 100vw)",maxHeight:"55vh",borderRadius:0,borderLeft:"none",borderRight:"none"},jt={display:"grid",gridTemplateRows:"minmax(0, 1fr)",flex:"1 1 auto",minHeight:0},Qt={overflowY:"auto",overflowX:"hidden",minHeight:0,padding:"4px 0",overscrollBehavior:"contain"},Xt={overflowY:"auto",minHeight:0,padding:"12px 14px",borderLeft:"1px solid var(--graview-edge)",background:"var(--graview-panel-muted)",display:"flex",flexDirection:"column",gap:4},Jt={fontWeight:600,fontSize:"0.9375rem",lineHeight:1.35,color:"var(--graview-ink)",overflowWrap:"anywhere"},Y={margin:0,fontSize:"0.8125rem",lineHeight:1.45,color:"var(--graview-ink-muted)",overflowWrap:"anywhere"},pa={display:"flex",alignItems:"center",gap:6,padding:"10px 12px 4px",fontSize:"0.6875rem",fontWeight:600,letterSpacing:"0.06em",textTransform:"uppercase",color:"var(--graview-ink-muted)"},Zt={marginLeft:"auto",fontWeight:400,letterSpacing:0,fontVariantNumeric:"tabular-nums",color:"var(--graview-ink-faint)"},er={position:"relative",display:"grid",gap:1,minHeight:34,padding:"5px 12px",alignContent:"center",cursor:"pointer",fontSize:"0.875rem",lineHeight:1.35,color:"var(--graview-ink)",minWidth:0},ar={background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))",boxShadow:"inset 3px 0 0 var(--graview-accent)"},tr={color:"var(--graview-accent)",fontSize:"0.8125rem",minHeight:30},Q={display:"block",minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},rr={display:"-webkit-box",WebkitBoxOrient:"vertical",WebkitLineClamp:2,minWidth:0,overflow:"hidden",overflowWrap:"anywhere",fontWeight:600},we={color:"var(--graview-ink-muted)",fontSize:"0.8125rem",fontWeight:400},ir={background:"color-mix(in srgb, var(--graview-accent) 24%, transparent)",color:"inherit",borderRadius:2,padding:0,boxShadow:"0 1px 0 color-mix(in srgb, var(--graview-accent) 70%, transparent)"},pt={display:"flex",alignItems:"center",minHeight:32,padding:"4px 10px",boxSizing:"border-box",borderWidth:1,borderStyle:"solid",borderColor:"var(--graview-edge)",borderRadius:6,background:"var(--graview-panel)",color:"var(--graview-ink)",fontSize:"0.8125rem",lineHeight:1.3,cursor:"pointer",overflowWrap:"anywhere"},nr={...pt,minHeight:32,margin:"0 12px 4px 24px"},or={borderColor:"var(--graview-accent)",boxShadow:"inset 0 0 0 1px var(--graview-accent)",background:"color-mix(in srgb, var(--graview-accent) 12%, var(--graview-panel))"},sr={display:"grid",padding:"2px 0 6px"},dr={position:"absolute",top:"50%",right:6,transform:"translateY(-50%)",width:36,height:32,display:"grid",placeItems:"center",borderRadius:6,color:"var(--graview-ink-muted)",borderWidth:1,borderStyle:"solid",borderColor:"transparent"},lr={color:"var(--graview-accent)",borderColor:"var(--graview-edge)",background:"var(--graview-panel)"},dt={margin:0,padding:"6px 12px 4px",color:"var(--graview-ink-faint)",fontSize:"0.75rem"},cr={display:"flex",flexWrap:"wrap",gap:"4px 14px",padding:"7px 12px",borderTop:"1px solid var(--graview-edge)",color:"var(--graview-ink-faint)",fontSize:"0.75rem",flex:"0 0 auto"},me={display:"inline-block",minWidth:16,padding:"0 4px",marginRight:3,border:"1px solid var(--graview-edge)",borderRadius:4,font:"inherit",fontSize:"0.6875rem",lineHeight:"16px",textAlign:"center",color:"var(--graview-ink-muted)",background:"var(--graview-panel)"};var Me=f(_(),1),ga=f(Ct(),1);var vt=f(A(),1);function gt(){let{following:e,follow:o}=T();return e?(0,vt.jsxs)("button",{type:"button","data-testid":"following-who",onClick:()=>o(null),title:"Press, or Escape, to stop following",style:{display:"inline-flex",alignItems:"center",gap:6,minHeight:24,padding:"2px 9px",borderRadius:999,border:"1px solid var(--graview-accent)",background:"transparent",color:"var(--graview-accent)",fontSize:"0.875rem",whiteSpace:"nowrap"},children:["following ",e.name]}):null}var ut=f(_(),1);var E=f(A(),1);function wt({home:e,homeLabel:o,children:d,onPicture:s=!1}){let{view:n,focus:m,show:v,go:g}=U(),{store:y}=T(),{movedByHand:S}=T(),c=S&&(n.pan!==void 0||Object.keys(n.pins).length>0),b=n.focusId&&n.focusId!==e?y.graph.getNode(n.focusId):void 0,k=z=>G(y.schema,z),w={display:"inline-flex",alignItems:"center",gap:6,minHeight:26,padding:"2px 6px",fontSize:"0.8125rem",borderRadius:6,border:"1px solid transparent",boxShadow:"none",background:"transparent",color:"var(--graview-ink-muted)",whiteSpace:"nowrap"},R=o!==void 0&&b!==void 0,P=[];if(b&&!s&&P.push({key:"focused",node:(0,E.jsxs)("button",{type:"button","data-testid":"focused",onClick:()=>g(Fe({...n,focusId:e},!1)),title:Ge(y,b.id),style:{...w,maxWidth:"min(14rem, 15vw)"},children:[(0,E.jsx)("span",{style:{minWidth:0,overflow:"hidden",textOverflow:"ellipsis"},children:Ge(y,b.id)}),(0,E.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.past&&P.push({key:"past",node:(0,E.jsxs)("button",{type:"button","data-testid":"past",onClick:()=>g(Qa(n,!1)),title:"Back to now \u2014 retired things leave the picture again",style:w,children:["the past",(0,E.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),n.zoom&&P.push({key:"zoomed",node:(0,E.jsxs)("button",{type:"button","data-testid":"zoomed",onClick:()=>g(Fe(n,!1)),title:"Zoom back out",style:w,children:["zoomed in",(0,E.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})]})}),c&&P.push({key:"moved",node:(0,E.jsx)("button",{type:"button","data-testid":"moved",onClick:()=>g(Ke(n)),title:"Put the camera and everything you dragged back where the layout wanted them",style:w,children:"Reset view"})}),n.relation){let z=n.relation;P.push({key:"raised",node:(0,E.jsxs)("span",{style:{display:"inline-flex",alignItems:"center"},children:[(0,E.jsxs)("button",{type:"button","data-testid":"raised-into",onClick:()=>g(ve(n,ge(z),{ownPicture:!0})),title:`Go into the ${k(z).toLowerCase()}`,"aria-label":`Go into the ${k(z).toLowerCase()}`,style:{...w,color:"var(--graview-ink)"},children:[k(z),(0,E.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\u2198"})]}),(0,E.jsx)("button",{type:"button","data-testid":"raised",onClick:()=>v(null),title:`Stop showing ${k(z).toLowerCase()}`,"aria-label":`Stop showing ${k(z).toLowerCase()}`,style:{...w,minWidth:26,justifyContent:"center"},children:(0,E.jsx)("span",{"aria-hidden":"true",style:{opacity:.7},children:"\xD7"})})]})})}return s&&!R&&P.length===0&&d===void 0?null:(0,E.jsxs)("nav",{"aria-label":"View","data-testid":"trail",style:{display:"flex",alignItems:"center",gap:8,fontSize:"0.875rem",minWidth:0,...s?{pointerEvents:"auto",padding:"4px 6px",borderRadius:8,background:"var(--graview-float)",boxShadow:"var(--graview-lift-low)",overflow:"hidden"}:{}},children:[R?(0,E.jsx)("button",{type:"button",onClick:()=>m(e),style:{border:"none",background:"none",padding:"3px 0",minHeight:24,whiteSpace:"nowrap",color:"var(--graview-ink-muted)"},children:o}):null,P.map(({key:z,node:W},Le)=>(0,E.jsxs)(ut.Fragment,{children:[R||Le>0?(0,E.jsx)("span",{style:{color:"var(--graview-ink-faint)"},children:"\u203A"}):null,W]},z)),d]})}var O=f(A(),1);function va(){let[e,o]=(0,Me.useState)([]),d=(0,Me.useCallback)(s=>{o(n=>{let m=s.phase!=="running"&&n[0]?.name===s.name&&n[0]?.at===s.at;return[s,...m?n.slice(1):n].slice(0,12)})},[]);return[e,d]}function ua({find:e,calls:o,seat:d,remembers:s=!1}){return e?(0,O.jsxs)(O.Fragment,{children:[(0,ga.createPortal)((0,O.jsx)(lt,{compact:e.compact}),e.slot),e.own?(0,ga.createPortal)((0,O.jsx)(Ka,{calls:o,remembers:s,...d!==void 0?{seat:d}:{}}),e.own):null]}):null}function wa({home:e=null}){return(0,O.jsxs)("div",{"data-graview-scene-trail":"",style:{position:"absolute",top:14,left:14,maxWidth:"calc(100% - 150px - var(--graview-dock, 0px))",zIndex:B("overview"),display:"flex",alignItems:"center",gap:6,minWidth:0,pointerEvents:"none"},children:[(0,O.jsx)(wt,{home:e,onPicture:!0}),(0,O.jsx)("span",{style:{pointerEvents:"auto"},children:(0,O.jsx)(gt,{})})]})}var X=f(_(),1);var mt=f(A(),1),pr=ie(()=>(__graviewPreload(import.meta.url,["./chunk.Q355UPFG.js","./chunk.RJ7VSWTA.js","./chunk.P43LPXXJ.js","./chunk.JCKIJSW7.js","./chunk.SDO3U72B.js","./chunk.6L6RUOSF.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.H4BPTMED.js")));function ma(){let{store:e,principal:o}=T(),d=(0,X.useContext)(Fa),s=(0,X.useRef)(null),n=(0,X.useRef)(!1);return(0,X.useEffect)(()=>()=>void(n.current=!0),[]),(0,X.useEffect)(()=>{let m=e.batches().length,v=pr().then(g=>g.sceneWay(e,o,d,m,s.current),()=>{});return()=>void v.then(g=>g?.(n.current))},[e,o,d]),(0,mt.jsx)("span",{ref:s,hidden:!0})}var ft=f(_(),1);var x=f(A(),1);function _i({address:e=!1,auto:o,quickAsk:d=!0,scheme:s,scope:n}){let m=(0,ft.useMemo)(()=>`${ia({scope:`.${n}`})}
|
|
1141
1141
|
${na(s,{scope:`.${n}`})}`,[s,n]),v=qa(),[g]=va();return(0,x.jsx)(La.Provider,{value:!0,children:(0,x.jsxs)("div",{"data-embed-content":"",style:{position:"relative",flex:o?`0 0 ${tt}px`:"1 1 auto",minHeight:0,containerType:"size"},children:[(0,x.jsx)("style",{children:m}),e?(0,x.jsx)(at,{}):null,(0,x.jsx)(et,{}),(0,x.jsx)(wa,{}),(0,x.jsx)(da,{}),(0,x.jsx)(oa,{}),(0,x.jsxs)(Ja,{children:[(0,x.jsx)(Xe,{}),(0,x.jsx)(Je,{face:"scene",on:d}),(0,x.jsx)(sa,{}),(0,x.jsx)(Ue,{children:(0,x.jsx)(je,{children:(0,x.jsx)(Ze,{children:(0,x.jsx)(aa,{children:(0,x.jsx)(ta,{children:(0,x.jsx)(Qe,{placement:"menu"})})})})})}),(0,x.jsx)(Ve,{}),(0,x.jsx)(ra,{}),(0,x.jsx)(ea,{}),(0,x.jsx)(ua,{find:v,calls:g}),(0,x.jsx)(ma,{}),(0,x.jsx)(_e,{face:"scene"})]})]})})}function Ui(){return(0,x.jsx)(ca,{})}export{_i as SceneFace,Ui as SceneKeeping};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ka as V,la as w}from"./chunk.
|
|
1
|
+
import{ka as V,la as w}from"./chunk.JCKIJSW7.js";import"./chunk.SDO3U72B.js";import{_d as u,ce as h}from"./chunk.6L6RUOSF.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var c=i=>[i,...u.filter(o=>o!==i)];function p(i,o){if(o.hidden.length===0&&o.removed.length===0)return i;let a=new Set(o.removed.filter(e=>!e.lens).map(e=>e.name)),f=new Set(o.hidden),r=e=>e?.name!==void 0&&(a.has(e.name)||e.title!==void 0&&f.has(e.name)),m=()=>(i.homes?.()??[]).filter(e=>e.name===void 0||!a.has(e.name)),l=(e,t,d)=>[...i.registrations()].reverse().find(n=>n.kind===e&&n.cardinality===t&&n.fidelity===d&&!n.beside&&!n.hidden&&!r(n)),y=(e,t)=>{for(let d of c(t.fidelity)){let n=l(e,t.cardinality,d);if(n)return n}if(t.cardinality==="one")for(let d of c(t.fidelity)){let n=l(e,"many",d);if(n)return n}},s={...i,register(e,t,d,n){return i.register(e,t,d,n),s},...i.home?{home(e,t){return i.home(e,t),s}}:{},...i.homes?{homes:m,homeView:()=>m().at(-1)?.view}:{},lookup(e,t){return i.lookup(e,t)===void 0?void 0:l(e,t.cardinality,t.fidelity)?.view},places:()=>i.places().filter(e=>!(e.name!==void 0&&a.has(e.name))).map(e=>e.name!==void 0&&f.has(e.name)&&!e.hidden?{...e,hidden:!0}:e),resolve(e,t,d){let n=i.resolve(e,t,d);return!n||!r(n)||d!==void 0&&n.name!==void 0&&!a.has(n.name)&&n.title!==void 0&&h(n.title)===d?n:y(e,t)},all:()=>i.all().filter(e=>!(e.name!==void 0&&a.has(e.name))),homes:()=>(i.homes?.()??[]).filter(e=>!(e.name!==void 0&&a.has(e.name))),homeView:()=>i.homes?s.homes().at(-1)?.view:i.homeView?.()};return V(i)&&w(s),s}function R(i,o,a){let f,r=()=>{let m=o.current();f&&m.hidden===f.hidden&&m.removed===f.removed||(f=m,a(p(i,m)))};return r(),o.onChange?.(r)??(()=>{})}export{p as tidyViews,R as watchTidied};
|