graview 0.1.66 → 0.1.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/preview/{chunk.OJY7VJ7D.js → chunk.2BMZPALF.js} +1 -1
- package/dist/preview/{chunk.OTV5XTBB.js → chunk.2KCDLCB2.js} +1 -1
- package/dist/preview/{chunk.WVLEGCRI.js → chunk.2ME4DVBI.js} +1 -1
- package/dist/preview/chunk.2TUEBU7X.js +8 -0
- package/dist/preview/{chunk.QHMHUL6B.js → chunk.2U6HB4XU.js} +1 -1
- package/dist/preview/{chunk.ZQR2SN65.js → chunk.32JE2WS7.js} +1 -1
- package/dist/preview/{chunk.OEIWIZCP.js → chunk.3DEWQDP7.js} +1 -1
- package/dist/preview/{chunk.2VR7YEJ6.js → chunk.3JMQKANL.js} +1 -1
- package/dist/preview/chunk.3VEZ5MOC.js +25 -0
- package/dist/preview/chunk.3WPCS6KP.js +1 -0
- package/dist/preview/{chunk.FXT5CN32.js → chunk.42C3FIKK.js} +1 -1
- package/dist/preview/{chunk.QQAZQDRW.js → chunk.42KHFGN6.js} +1 -1
- package/dist/preview/{chunk.ANS2IEEV.js → chunk.4DXPPM6T.js} +1 -1
- package/dist/preview/chunk.4GVKKBQL.js +1 -0
- package/dist/preview/{chunk.5CXIEYHY.js → chunk.4TT3ZHSJ.js} +2 -2
- package/dist/preview/{chunk.OMT4QUZY.js → chunk.4YAO3A5Q.js} +4 -4
- package/dist/preview/{chunk.M2JCFNHJ.js → chunk.5JKUT2OM.js} +1 -1
- package/dist/preview/chunk.5L4ADKTW.js +1 -0
- package/dist/preview/{chunk.YNEHJWJV.js → chunk.64LCHHZB.js} +1 -1
- package/dist/preview/{chunk.6HY6ZGEE.js → chunk.6AANHELP.js} +1 -1
- package/dist/preview/{chunk.6TLXFMX2.js → chunk.6DMCEBSO.js} +1 -1
- package/dist/preview/{chunk.IWYMKGZZ.js → chunk.6IR5LBJU.js} +1 -1
- package/dist/preview/{chunk.YIPXZUTT.js → chunk.6WB2TYK7.js} +1 -1
- package/dist/preview/chunk.6ZENHSTQ.js +1 -0
- package/dist/preview/{chunk.7ZKBYXUM.js → chunk.7K2V5FUB.js} +1 -1
- package/dist/preview/chunk.7OL6H4LF.js +1 -0
- package/dist/preview/{chunk.FBILPNGH.js → chunk.7TDML5YU.js} +1 -1
- package/dist/preview/{chunk.45JP6VGJ.js → chunk.7WPVLEX2.js} +2 -2
- package/dist/preview/{chunk.W4YDPHCQ.js → chunk.7ZTGB4O7.js} +1 -1
- package/dist/preview/{chunk.4FDVINRJ.js → chunk.ACNOP2IU.js} +1 -1
- package/dist/preview/{chunk.AK7NGFEX.js → chunk.AENP662H.js} +1 -1
- package/dist/preview/{chunk.MWGZKZD6.js → chunk.AQ2PI6MR.js} +1 -1
- package/dist/preview/chunk.ARS4HJD2.js +1 -0
- package/dist/preview/{chunk.FDZE5LTJ.js → chunk.AWV57UBJ.js} +2 -2
- package/dist/preview/{chunk.C2C3AXGI.js → chunk.AYZL3LCR.js} +3 -3
- package/dist/preview/{chunk.FIFUMX5X.js → chunk.BHJRT57H.js} +1 -1
- package/dist/preview/{chunk.IAEHUSQQ.js → chunk.BPNW5KCP.js} +1 -1
- package/dist/preview/{chunk.HOCD7KIR.js → chunk.BQAFFEOA.js} +1 -1
- package/dist/preview/chunk.C2QKA6XY.js +1 -0
- package/dist/preview/{chunk.NJRLJEJY.js → chunk.CE3NKAF7.js} +1 -1
- package/dist/preview/{chunk.5LJVOLKR.js → chunk.CFE3MHWZ.js} +1 -1
- package/dist/preview/{chunk.DQFHIJFN.js → chunk.CGBOPPNL.js} +1 -1
- package/dist/preview/{chunk.V7W5AQKL.js → chunk.CNN32262.js} +1 -1
- package/dist/preview/{chunk.6EHHMWPP.js → chunk.DCLF4WWZ.js} +1 -1
- package/dist/preview/{chunk.OO2OP76C.js → chunk.DGDW54KE.js} +1 -1
- package/dist/preview/{chunk.XMQG2PSM.js → chunk.DLSS56EU.js} +1 -1
- package/dist/preview/{chunk.WSO7JOW5.js → chunk.DMZRFXH7.js} +1 -1
- package/dist/preview/{chunk.DEHIR4EG.js → chunk.DPHH5ZVL.js} +1 -1
- package/dist/preview/{chunk.XOE4KNP2.js → chunk.DZ6UDZOB.js} +2 -2
- package/dist/preview/{chunk.WAB3L3ZI.js → chunk.E423JCOS.js} +1 -1
- package/dist/preview/{chunk.CTASTRQN.js → chunk.EB7PZJEO.js} +1 -1
- package/dist/preview/{chunk.QPF4KSAW.js → chunk.ECNGVD25.js} +1 -1
- package/dist/preview/{chunk.JXNVNFV4.js → chunk.EGSOHTZZ.js} +1 -1
- package/dist/preview/{chunk.CEVGND3Y.js → chunk.EGVM24ND.js} +3 -3
- package/dist/preview/{chunk.6LXIEM6B.js → chunk.ENLIIZF2.js} +1 -1
- package/dist/preview/{chunk.GME63ZHI.js → chunk.EP5JS7ZH.js} +1 -1
- package/dist/preview/{chunk.QGIM2WAY.js → chunk.F5GNNVSQ.js} +1 -1
- package/dist/preview/chunk.FHQ25SWY.js +1 -0
- package/dist/preview/{chunk.OOSIKCOS.js → chunk.FSW535EA.js} +1 -1
- package/dist/preview/{chunk.ZD7T234N.js → chunk.FZELUSK5.js} +1 -1
- package/dist/preview/{chunk.LINSO5PN.js → chunk.G2BDEWJC.js} +1 -1
- package/dist/preview/chunk.GF3ZCX46.js +2 -0
- package/dist/preview/{chunk.J7W2OFHY.js → chunk.GJTEV6CK.js} +1 -1
- package/dist/preview/{chunk.VKZIEZ5C.js → chunk.GKTQ5CZA.js} +2 -2
- package/dist/preview/{chunk.GEFXU4VO.js → chunk.GONZB3J3.js} +1 -1
- package/dist/preview/{chunk.VGHO3VCB.js → chunk.GRBWXTST.js} +1 -1
- package/dist/preview/{chunk.YXEO3Y65.js → chunk.GRTBEA7O.js} +1 -1
- package/dist/preview/chunk.H3IGXHZR.js +93 -0
- package/dist/preview/{chunk.QFHWG4LN.js → chunk.H3W5C3XQ.js} +1 -1
- package/dist/preview/{chunk.TGEL6EUA.js → chunk.H4VNIAHN.js} +1 -1
- package/dist/preview/{chunk.IGK7EZCX.js → chunk.HH4D3JEI.js} +1 -1
- package/dist/preview/{chunk.F4VB6Q2W.js → chunk.HWFJQ42Y.js} +1 -1
- package/dist/preview/{chunk.OWFS2YDQ.js → chunk.HXTKBISQ.js} +1 -1
- package/dist/preview/{chunk.ZR2TP3BF.js → chunk.I34BWUB4.js} +1 -1
- package/dist/preview/{chunk.EXYCN4WI.js → chunk.I63462I3.js} +1 -1
- package/dist/preview/{chunk.7VADSNPZ.js → chunk.IKKKHHRN.js} +1 -1
- package/dist/preview/{chunk.FK722SHI.js → chunk.IPGLITWA.js} +1 -1
- package/dist/preview/{chunk.BXBEGMPO.js → chunk.IT5DVKXY.js} +2 -2
- package/dist/preview/{chunk.LLIURXFP.js → chunk.IXMIU4D4.js} +1 -1
- package/dist/preview/{chunk.INHS3KTK.js → chunk.JCETQQ7J.js} +1 -1
- package/dist/preview/{chunk.PPSYUOH7.js → chunk.JGRSUTPJ.js} +1 -1
- package/dist/preview/{chunk.4U4D7WOI.js → chunk.JLDJZET2.js} +1 -1
- package/dist/preview/{chunk.Z7Y3R3YR.js → chunk.JULD4XFB.js} +1 -1
- package/dist/preview/{chunk.PAGEGBUD.js → chunk.JV432T4Q.js} +1 -1
- package/dist/preview/{chunk.4FCFNAA4.js → chunk.KAM73WVF.js} +1 -1
- package/dist/preview/{chunk.6P6NGZ6D.js → chunk.KUCBNMIY.js} +1 -1
- package/dist/preview/{chunk.I2737CPF.js → chunk.L7XKYGV7.js} +1 -1
- package/dist/preview/{chunk.7VP6Y6D2.js → chunk.LFFJB6D3.js} +1 -1
- package/dist/preview/{chunk.BFAFCVL4.js → chunk.LMTG5NPG.js} +1 -1
- package/dist/preview/{chunk.QOS5T46W.js → chunk.LOKGUALC.js} +1 -1
- package/dist/preview/chunk.LZ6MSQ5O.js +1 -0
- package/dist/preview/chunk.MBTEOF4R.js +1 -0
- package/dist/preview/{chunk.PFQBCHQA.js → chunk.MIOLBZBS.js} +1 -1
- package/dist/preview/{chunk.PDDIQ6PK.js → chunk.MK5RPEB2.js} +1 -1
- package/dist/preview/{chunk.FV72U33M.js → chunk.MKL4THIV.js} +1 -1
- package/dist/preview/{chunk.2MHNPBHC.js → chunk.MPWLDQOG.js} +1 -1
- package/dist/preview/chunk.MSUZAJ2K.js +4 -0
- package/dist/preview/{chunk.EMFOMSMI.js → chunk.N5Z34V7U.js} +1 -1
- package/dist/preview/chunk.N64RVSH3.js +1 -0
- package/dist/preview/{chunk.5B5SRTUK.js → chunk.ND3DEDWB.js} +1 -1
- package/dist/preview/{chunk.3L4JMM3P.js → chunk.NFTPJAMJ.js} +1 -1
- package/dist/preview/{chunk.J2MM6BUW.js → chunk.NRCWMYLH.js} +1 -1
- package/dist/preview/{chunk.OPTYYIGC.js → chunk.O2VXTYUJ.js} +1 -1
- package/dist/preview/{chunk.4AC2QM7T.js → chunk.O32F6LGK.js} +1 -1
- package/dist/preview/{chunk.W53YNBSM.js → chunk.O5FTWXA2.js} +1 -1
- package/dist/preview/{chunk.U6TEW6YD.js → chunk.ODYJEDIW.js} +1 -1
- package/dist/preview/{chunk.E7EWNWAN.js → chunk.OQ4ZO3YY.js} +1 -1
- package/dist/preview/chunk.PI4RFOBU.js +1 -0
- package/dist/preview/{chunk.BMENTGDC.js → chunk.PIMAG4WT.js} +2 -2
- package/dist/preview/{chunk.DTCAUPLC.js → chunk.PLIV3IQK.js} +1 -1
- package/dist/preview/{chunk.4JULYKGD.js → chunk.PPCDPYYU.js} +1 -1
- package/dist/preview/{chunk.BGAC3B7X.js → chunk.PZQ5P6WK.js} +1 -1
- package/dist/preview/chunk.Q42R2KW4.js +1 -0
- package/dist/preview/{chunk.2KFZHUAC.js → chunk.Q4VFLLUT.js} +1 -1
- package/dist/preview/{chunk.ONYBW45K.js → chunk.Q6H5HESF.js} +1 -1
- package/dist/preview/chunk.QM54TGU6.js +3 -0
- package/dist/preview/{chunk.6MQ5NT7S.js → chunk.QOQ26NXM.js} +1 -1
- package/dist/preview/{chunk.FFOD5B4B.js → chunk.QUETLFBJ.js} +1 -1
- package/dist/preview/{chunk.DSYP43NN.js → chunk.QWLK3GKG.js} +1 -1
- package/dist/preview/{chunk.RWIN3POV.js → chunk.QYPU444Y.js} +1 -1
- package/dist/preview/{chunk.ES63XSIM.js → chunk.QZP3ARLH.js} +1 -1
- package/dist/preview/{chunk.CVPMSPCH.js → chunk.R3GE37OI.js} +1 -1
- package/dist/preview/chunk.R66ZVMWB.js +1 -0
- package/dist/preview/chunk.RD2FSSLV.js +1 -0
- package/dist/preview/{chunk.72ZCLEQC.js → chunk.RQG672MJ.js} +1 -1
- package/dist/preview/chunk.RYA7A4NA.js +1 -0
- package/dist/preview/{chunk.BUVTUAB5.js → chunk.SADR3MQI.js} +1 -1
- package/dist/preview/{chunk.EQ4OODGO.js → chunk.SS6KL5NT.js} +1 -1
- package/dist/preview/chunk.SUG6LIOX.js +1 -0
- package/dist/preview/{chunk.WSDJPXJD.js → chunk.TFJA4QV4.js} +1 -1
- package/dist/preview/{chunk.3PBTN7RO.js → chunk.TOUSIUJF.js} +1 -1
- package/dist/preview/{chunk.CU2WCYMK.js → chunk.TR4YFVZN.js} +1 -1
- package/dist/preview/{chunk.GNEOSHQ6.js → chunk.TRNJKHIA.js} +1 -1
- package/dist/preview/{chunk.72XP2ARZ.js → chunk.TVWK3SGD.js} +1 -1
- package/dist/preview/chunk.U7PAFLUM.js +1 -0
- package/dist/preview/{chunk.QU52E5RG.js → chunk.UAMPR4MD.js} +1 -1
- package/dist/preview/{chunk.KBPJ7X7W.js → chunk.UD7VLXPM.js} +1 -1
- package/dist/preview/{chunk.M6ZN2KUO.js → chunk.UFURYU4R.js} +1 -1
- package/dist/preview/{chunk.6FQW6FNL.js → chunk.UODTUBQ7.js} +1 -1
- package/dist/preview/{chunk.KHRS2SKB.js → chunk.VBHV4TLG.js} +1 -1
- package/dist/preview/{chunk.KSIEO5W7.js → chunk.VES4XMZX.js} +1 -1
- package/dist/preview/chunk.VLXLBGMY.js +90 -0
- package/dist/preview/{chunk.QWNSHISU.js → chunk.VTDOWXCP.js} +1 -1
- package/dist/preview/{chunk.5FNFRVTL.js → chunk.VV5JAM5W.js} +1 -1
- package/dist/preview/{chunk.DZFM6GSY.js → chunk.VW632VNJ.js} +1 -1
- package/dist/preview/{chunk.LSN2IPAI.js → chunk.WC5WE34A.js} +1 -1
- package/dist/preview/chunk.WN7SAAH6.js +1 -0
- package/dist/preview/{chunk.B6JRTW3A.js → chunk.WV45KLXC.js} +1 -1
- package/dist/preview/{chunk.TXHYGFIZ.js → chunk.XDZDNZ7B.js} +1 -1
- package/dist/preview/{chunk.7BIPZTJB.js → chunk.XFH6GHBQ.js} +1 -1
- package/dist/preview/{chunk.HSSIMVVM.js → chunk.XRE7SHLD.js} +1 -1
- package/dist/preview/{chunk.LETAQTLJ.js → chunk.XXCHO2A5.js} +1 -1
- package/dist/preview/{chunk.KACSYPEV.js → chunk.Y7OGJOPA.js} +1 -1
- package/dist/preview/{chunk.LGRVEHXT.js → chunk.YBQ5GVAX.js} +2 -2
- package/dist/preview/{chunk.PSQYDCVM.js → chunk.YL2RBZFE.js} +1 -1
- package/dist/preview/{chunk.BZ7QWHAE.js → chunk.YM6SWEUI.js} +1 -1
- package/dist/preview/{chunk.CBXS23YH.js → chunk.Z2X7BFCB.js} +2 -2
- package/dist/preview/{chunk.U3ED7W2U.js → chunk.Z67LBSQO.js} +1 -1
- package/dist/preview/chunk.ZKXIZBCN.js +1 -0
- package/dist/preview/{chunk.E3UL4MCD.js → chunk.ZLEBOR5T.js} +1 -1
- package/dist/preview/{chunk.5BX66FBP.js → chunk.ZLNUZ6LR.js} +1 -1
- package/dist/preview/chunk.ZMADWPJO.js +1 -0
- package/dist/preview/chunk.ZO6VMEPP.js +1 -0
- package/dist/preview/chunk.ZUG7U7AT.js +1 -0
- package/dist/preview/index.html +56 -56
- package/dist/preview/page.js +2 -2
- package/package.json +6 -6
- package/dist/preview/chunk.4WGYUYWU.js +0 -2
- package/dist/preview/chunk.5EMIWORS.js +0 -1
- package/dist/preview/chunk.6EVMXBNB.js +0 -1
- package/dist/preview/chunk.BCQWAFGD.js +0 -1
- package/dist/preview/chunk.BOCVLC7X.js +0 -1
- package/dist/preview/chunk.DPJNGFEZ.js +0 -4
- package/dist/preview/chunk.E4VRRWFP.js +0 -1
- package/dist/preview/chunk.EUAO4QNV.js +0 -1
- package/dist/preview/chunk.F7672TKJ.js +0 -1
- package/dist/preview/chunk.FA42HCPW.js +0 -1
- package/dist/preview/chunk.FBJAQPZ6.js +0 -1
- package/dist/preview/chunk.GAFMWOME.js +0 -1
- package/dist/preview/chunk.I4Z7HVRT.js +0 -1
- package/dist/preview/chunk.JMXXA4YG.js +0 -1
- package/dist/preview/chunk.JMYUQNXN.js +0 -6
- package/dist/preview/chunk.K6DFXDPZ.js +0 -1
- package/dist/preview/chunk.KF27ME27.js +0 -1
- package/dist/preview/chunk.L25DCT5S.js +0 -1
- package/dist/preview/chunk.MODLZJD4.js +0 -25
- package/dist/preview/chunk.OJGHDWI6.js +0 -1
- package/dist/preview/chunk.SSF47GUY.js +0 -1
- package/dist/preview/chunk.T6DPWW2K.js +0 -3
- package/dist/preview/chunk.TA36WBHK.js +0 -1
- package/dist/preview/chunk.TTGKX7LT.js +0 -1
- package/dist/preview/chunk.U3HERHAI.js +0 -88
- package/dist/preview/chunk.V5I4GZEY.js +0 -1
- package/dist/preview/chunk.VT2YGDK2.js +0 -1
- package/dist/preview/chunk.XK65Y2KX.js +0 -1
- package/dist/preview/chunk.Z274CL7J.js +0 -1
- package/dist/preview/chunk.ZBVYD4OX.js +0 -90
|
@@ -1 +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{b as v}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{b as v}from"./chunk.DZ6UDZOB.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as S,V as y,W as b}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as u}from"./chunk.AJZBJBMO.js";var r=u(S(),1);var t=u(b(),1);function E(o){let a=(0,r.useContext)(y),l=(0,t.jsx)(C,{...o});return!a||o.nodeId===void 0?l:(0,t.jsx)(P,{nodeId:o.nodeId,field:o.field,label:o.label,...o.markdown?{markdown:!0}:{},live:a,onDone:d=>o.onDone?o.onDone(d):o.onCancel(),writtenWhole:l})}var P=(0,r.lazy)(()=>(__graviewPreload(import.meta.url,["./chunk.DZ6UDZOB.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.XFH6GHBQ.js")));function C({field:o,label:a,value:l,markdown:d,onSave:s,onCancel:c}){let[i,h]=(0,r.useState)(l),[n,w]=(0,r.useState)(!1),f=(0,r.useRef)(null);return(0,r.useEffect)(()=>f.current?.focus(),[n]),(0,r.useLayoutEffect)(()=>{let e=f.current;if(!e||n||typeof CSS<"u"&&CSS.supports?.("field-sizing","content"))return;let p=()=>{e.style.height="auto";let m=getComputedStyle(e);e.style.height=`${e.scrollHeight+parseFloat(m.borderTopWidth)+parseFloat(m.borderBottomWidth)}px`};p();let x=requestAnimationFrame(p);return()=>cancelAnimationFrame(x)},[i,n]),(0,t.jsxs)("form",{style:{display:"grid",gap:8,minWidth:0},onSubmit:e=>{e.preventDefault(),s(i,!1)},children:[n?(0,t.jsx)("div",{"data-graview-preview":o,"aria-label":`${a}, as it will read`,role:"region",style:k,children:(0,t.jsx)(v,{text:i,markdown:!0})}):(0,t.jsx)("textarea",{ref:f,"aria-label":a,"data-graview-field":o,value:i,rows:3,onChange:e=>h(e.target.value),onKeyDown:e=>{e.key==="Escape"?(e.preventDefault(),c()):e.key==="Enter"&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),s(i,!1))},onBlur:e=>{e.relatedTarget instanceof Node&&e.currentTarget.form?.contains(e.relatedTarget)||s(i,!0)},style:T}),(0,t.jsxs)("div",{style:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:8},children:[(0,t.jsx)("button",{type:"submit",style:g,children:"Save"}),(0,t.jsx)("button",{type:"button",onClick:c,style:g,children:"Cancel"}),d?(0,t.jsx)("button",{type:"button","aria-pressed":n,onClick:()=>w(!n),style:g,children:n?"Write":"Preview"}):null,(0,t.jsx)("span",{style:{fontSize:"0.75rem",color:"var(--graview-ink-faint)"},children:"Ctrl or \u2318 Enter saves \xB7 Esc puts it back"})]})]})}var k={minHeight:"7.5em",padding:"8px 10px",border:"1px dashed var(--graview-edge-bright)",borderRadius:6,lineHeight:1.6,minWidth:0},g={font:"inherit",fontSize:"0.8125rem",minHeight:28,padding:"2px 12px"},T={font:"inherit",lineHeight:1.5,width:"100%",boxSizing:"border-box",minHeight:"7.5em",padding:"8px 10px",resize:"vertical",fieldSizing:"content",color:"var(--graview-ink)",background:"var(--graview-panel, transparent)",border:"1px solid var(--graview-edge-bright)",borderRadius:6};export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as I,c as x}from"./chunk.
|
|
1
|
+
import{a as I,c as x}from"./chunk.ENLIIZF2.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{b,c as A,j as v,q as w,s as O,v as G}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{Zd as k,oe as E,ve as S,we as W}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var F=(e,i)=>k(e,i).slice(1);function j(e,i){let l=e.split("/").filter(Boolean);return l.length===i.length&&l.every((s,h)=>s.startsWith(":")||s==="*"||s===i[h])}var $=["problems","search","map","places"];function R(e,i,l,s,h=[]){let{schema:r}=i,o=r.kinds,f=t=>{if(t.startsWith(w))return(t.slice(w.length).split("|")[0]??"").split("+").every(V=>o.includes(V));let y=O(t);return y!==null?o.includes(y):t.startsWith("edge:")||l.graph.getNode(t)!==void 0},[p="/",u]=e.path.split("?"),n=p.split("/").filter(Boolean),m=u?`?${u}`:"",d=n.length>0&&!$.includes(n[0])?o.find(t=>F(r,t)===n[0]):void 0,c=e.path;if(n[0]==="places"&&n.length===2)`/places/${n[1]}`!==E&&!s.some(t=>t.as===decodeURIComponent(n[1]))&&(c="/");else if(d){let t=n[1]===void 0?void 0:decodeURIComponent(n[1]);c=`/${F(r,d)}${t!==void 0&&l.graph.getNode(t)?.kind===d?`/${n[1]}`:""}${m}`}else n.length>0&&n.length<=2&&!$.includes(n[0])&&!h.some(t=>j(t.path,n))&&(c="/");let g=A(e.stop),P=g.within?.view,U=P!==void 0&&!s.some(t=>t.as===P),a=g;if(U){let{view:t,...y}=g.within??{};a={...a,within:y}}if(g.focusId&&!f(g.focusId)){let t=e.kind&&o.includes(e.kind)?G(e.kind):null;a={...v(a,t),zoom:!1}}return a={...a,relation:a.relation&&(o.includes(a.relation)||r.edgeKinds.includes(a.relation))?a.relation:null,expanded:a.expanded.filter(f),pins:Object.fromEntries(Object.entries(a.pins).filter(([t])=>f(t))),...a.selection?{selection:a.selection.filter(f)}:{}},{face:e.face,path:c,stop:b(a),...e.kind?{kind:e.kind}:{}}}function B(e,i,l){let s=e.at,h=e.pages?.routes()??[];if(e.routing!=="address"||typeof window>"u")return R(s,e.app,i,l,h);let{pathname:r,search:o,hash:f}=window.location,p=W(r,e.basePath),u=I({routing:"address",...e.basePath===void 0?{}:{basePath:e.basePath},face:s.face}),n=u==="pages",m={...s,face:u,...p===null?{}:n?{path:p+o}:{stop:x(e.basePath)??s.stop}},d=R(m,e.app,i,l,h),c=n?d.path===m.path?null:S(d.path,e.basePath===void 0?{}:{basePath:e.basePath}):d.stop===b(A(m.stop))?null:r+o+d.stop;return p!==null&&c!==null&&c!==r+o+f&&window.history.replaceState(window.history.state,"",c),d}export{R as settle,B as settleAt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Ae}from"./chunk.BJUUSIQY.js";import{a as X}from"./chunk.
|
|
1
|
+
import{a as Ae}from"./chunk.BJUUSIQY.js";import{a as X}from"./chunk.CE3NKAF7.js";import{Dd as $e,Jb as be,fc as we,ga as B,la as he,oa as W,pc as Q,ra as ke,rc as Se,ua as _}from"./chunk.6AANHELP.js";import{j as H}from"./chunk.FQLNBIQ5.js";var M=e=>e.trim().toLowerCase(),U=e=>e.charAt(0).toUpperCase()+e.slice(1),le=e=>/^(?:[aeio]|u(?![sn]i|se|ser))/i.test(e),ee=e=>`${le(e)?"an":"a"} ${e}`,xe=e=>M(e).replace(/[^a-z0-9]+([a-z0-9])/g,(n,r)=>r.toUpperCase()).replace(/[^A-Za-z0-9]/g,""),se=e=>M(e).replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""),ae=new Set(["person","people","someone","somebody","user","users","member","members"]);function de(e,n){let r=M(n);return Object.entries(e.kinds).find(([f,d])=>[f,d.noun,d.plural].some(c=>c!==void 0&&M(c)===r))?.[0]}function K(e,n){if(!e(n))return n;for(let r=2;;r++)if(!e(`${n}${r}`))return`${n}${r}`}function Fe(e,n){let r=e.acts??{},f=m=>m in r;if("link"in n){let m=de(e,n.link.on);if(!m)return{refused:`This app has no ${n.link.on} to give it to.`};let k=e.kinds[m],C=M(k.noun??m),v=M(n.link.called)||"linked to",u=de(e,n.link.to)??(ae.has(M(n.link.to))?(Object.entries(e.kinds).find(([,T])=>T.people)??Object.entries(e.kinds).find(([T,P])=>[T,P.noun,P.plural].some(t=>t!==void 0&&ae.has(M(t)))))?.[0]:void 0),A=[],j=[],$,F=u===void 0;if(!u){let T=M(n.link.to)||"person",P=ae.has(T),t=P?"person":T.replace(/s$/,""),a=P?"people":`${t}s`;u=K(b=>b in e.kinds,se(t)),A.push({op:"add-kind",kind:u,noun:t,plural:a,fields:{name:{type:"string",required:!0}},label:"{name}"}),$=K(f,`add-${u}`),j.push(`Add ${ee(U(a))} list.`)}let i=u in e.kinds?e.kinds[u]:A[0],y=M(i.noun??u),S=K(T=>T in(k.edges??{})||T in(k.fields??{}),xe(v)||"linkedTo");A.push({op:"add-relation",kind:m,relation:S,to:[u],cardinality:"one",description:U(v)});let R=K(f,`set-${se(v)}`);return A.push({op:"add-act",act:R,title:`Set \u201C${U(v)}\u201D`,on:m,connects:S,description:`Say who ${ee(C)} is ${v}.`}),j.push(`Give each ${C} ${le(v)?"an":"a"} \u201C${U(v)}\u201D field that points to ${ee(y)}.`),{edits:A,steps:j,on:m,relation:S,to:u,made:F,act:R,arg:"to",...$?{makes:$}:{},called:v}}let d=de(e,n.field.on);if(!d)return{refused:`This app has no ${n.field.on} to give it to.`};let c=e.kinds[d],g=M(c.noun??d),p=M(n.field.called)||"note",l=n.field.type??"string",s=K(m=>m in(c.fields??{})||m in(c.edges??{}),xe(p)||"note"),o=K(f,`set-${se(p)}`);return{edits:[{op:"add-field",kind:d,field:s,spec:{type:l}},{op:"add-act",act:o,title:`Set \u201C${U(p)}\u201D`,on:d,args:{value:{type:l,required:!0}},sets:{[s]:"$value"},description:`Say ${ee(g)}'s ${p}.`}],steps:[`Give each ${g} ${le(p)?"an":"a"} \u201C${U(p)}\u201D field.`],on:d,field:s,act:o,arg:"value",called:p}}var Re=["search-miss","unanswered","refused","tool-invalid"];var qe=new RegExp("[\\u0000-\\u001f\\u007f-\\u009f\\u200b-\\u200f\\u2028-\\u202e\\u2066-\\u2069]","g");var G=e=>e.onBehalfOf?G(e.onBehalfOf):e.id!==void 0?`${e.kind}:${e.id}`:`${e.kind}:?`,ce=e=>e.toLowerCase().replace(/\s+/g," ").replace(/^[\s\p{P}]+|[\s\p{P}]+$/gu,"");var Ce=new Set("a an and are at be by can do does for from has have how i in is it me my of on or our the their there this to was we what when where which who why will with you your".split(" "));function J(e,n,r,f,d){let c=new Map;for(let g of e){let p=n(g);if(p===void 0)continue;let l=c.get(p)??{first:g,people:new Set,times:0,last:g};l.people.add(G(g.by)),l.times+=1,l.last=g,c.set(p,l)}return[...c.entries()].filter(([,g])=>g.people.size>=f).sort(([g,p],[l,s])=>s.people.size-p.people.size||s.times-p.times||g.localeCompare(l)).slice(0,d).map(([g,p])=>({...r(p.last,g),people:p.people.size,times:p.times}))}function je(e,n={}){let r=Math.max(1,n.minPeople??2),f=n.most??12,d=n.reader?G(n.reader):void 0,c=e.filter(s=>!$e(s.by)&&(d===void 0||G(s.by)!==d)),g=Object.fromEntries(Re.map(s=>{let o=c.filter(m=>m.type===s);return[s,{events:o.length,people:new Set(o.map(m=>G(m.by))).size}]})),p=[],l=new Map;for(let s of c){let o=s.type==="search-miss"?s.words:s.type==="unanswered"?s.question:void 0;if(o!==void 0)for(let m of new Set(ce(o).split(/[^\p{L}\p{N}]+/u))){if(m.length<3||Ce.has(m))continue;let k={...s,id:`${s.id}:${m}`};p.push(k),l.set(k,m)}}return{events:c.length,people:new Set(c.map(s=>G(s.by))).size,byType:g,searches:J(c,s=>s.type==="search-miss"&&ce(s.words)||void 0,(s,o)=>({words:o}),r,f),questions:J(c,s=>s.type==="unanswered"&&ce(s.question)||void 0,(s,o)=>({question:o,...s.lacks?{lacks:s.lacks}:{}}),r,f),words:J(p,s=>l.get(s),(s,o)=>({word:o}),r,f),refusals:J(c,s=>s.type==="refused"?`${s.act}|${s.code}`:void 0,s=>({act:s.act,code:s.code}),r,f),tools:J(c,s=>s.type==="tool-invalid"?`${s.tool}|${s.act??""}`:void 0,s=>{let o=s;return{tool:o.tool,...o.act?{act:o.act}:{},...o.then?{then:o.then}:{}}},1,f)}}var ve=e=>e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e;function Ee(e){let n=new Set,r=f=>{for(let d of f.toLowerCase().split(/[^\p{L}\p{N}]+/u))d.length>0&&n.add(ve(d))};for(let f of e.kinds){let d=e.tryDefinition(f);r(f),r(_(d,f)),r(W(e,f));for(let c of[...d?.aliases??[],...Object.values(d?.fieldAliases??{}).flat()])r(c);for(let c of Object.keys(d?.fields?.shape??{}))r(c),r(B(c))}return n}function Oe(e,n,r={}){let f=je(e,{most:8,...r}),d=Ee(n),c=f.searches.filter(o=>!o.words.split(/[^\p{L}\p{N}]+/u).some(m=>m.length>0&&d.has(ve(m)))).map(o=>({words:o.words,people:o.people})),g=f.questions.map(o=>({question:o.question,people:o.people,...o.lacks?{lacks:o.lacks}:{}})),p=f.tools.map(o=>({tool:o.tool,...o.act?{act:o.act}:{},...o.then?{then:o.then}:{},times:o.times})),l=o=>`${o} ${o===1?"person":"people"}`;return{said:[...c.length>0?[`Searched for, found nothing, and nothing here is called it: ${c.map(o=>`\u201C${o.words}\u201D (${l(o.people)})`).join(", ")}.`]:[],...g.length>0?[`Asked and not answered: ${g.map(o=>`\u201C${o.question}\u201D (${l(o.people)}${o.lacks?`; ${o.lacks.replace(/[.!]$/,"")}`:""})`).join(", ")}.`]:[],...p.length>0?[`Tool calls refused as invalid: ${p.map(o=>`${o.tool}${o.act?` (${o.act})`:""} ${o.times===1?"once":`${o.times} times`}${o.then?`, then worked as ${o.then}`:""}`).join("; ")}.`]:[]].join(`
|
|
2
2
|
`),unknownWords:c,questions:g,toolMistakes:p}}var Te=e=>/^(?:aggregate|kind):([^,]+)$/.exec(e)?.[1];function Ze(e,n){let r=e.about??[];if(e.field!==void 0&&e.on!==void 0&&n(e.on))return{on:"field",id:e.on,field:e.field};let f=r.filter(n);if(f.length>1)return{on:"selection",ids:f};if(e.on!==void 0&&n(e.on))return{on:"record",id:e.on};if(f.length===1)return{on:"record",id:f[0]};let d=[e.on,...r].map(c=>c===void 0?void 0:Te(c)).find(c=>c!==void 0);return e.place!==void 0?{on:"lens",place:e.place,...d?{kind:d}:{}}:d!==void 0?{on:"list",kind:d}:{on:"place",place:"home"}}var ne=e=>e.on==="record"||e.on==="field"?[e.id]:e.on==="selection"?e.ids:e.on==="act"&&e.id!==void 0?[e.id]:[],te=(e,n)=>e.tryDefinition(n)?.fields?.shape??{},Y=(e,n)=>e.tryDefinition(n)?.edges??{},ie=(e,n)=>new Set(e.tryDefinition(n)?.display?.hide??[]),N=(e,n)=>he(e.tryDefinition(n.kind),n),fe=(e,n,r)=>ke(e.tryDefinition(n),r)||B(r),ye=e=>typeof e=="boolean"?e?"yes":"no":String(e);function oe(e,n){let r=e.kindsKeptFrom(n);return new Set(e.schema.kinds.filter(f=>!r.has(f)))}function pe(e,n,r,f){if(!e.permits(n,r).ok)return!1;if(!f)return!0;try{return e.previewAll([n],{author:r}).ops.length>0}catch{return!1}}function Qe(e,n,r){let f=e,{principal:d}=r,c=r.each??8,g=H(f)?.store??f,p=g.seenBy(d),l=g.schema,s=oe(g,d),o=t=>{let a=p.graph.getNode(t);return a&&s.has(a.kind)?a:void 0},m=g.allMutations(),k=new Map(m.map(t=>[t.name,t])),C=[],v=new Set,u=t=>{v.has(t.id)||(v.add(t.id),C.push(t))},A=t=>t.slice(0,c),j=ne(n).filter(t=>o(t)!==void 0);if(ne(n).length>0&&j.length===0)return{target:n,candidates:[]};let $=j.length===1?o(j[0]):void 0,F=$?.kind??(n.on==="list"?n.kind:n.on==="lens"?n.kind??r.places?.find(t=>t.as===n.place)?.kind:void 0)??(n.on==="selection"?o(j[0])?.kind:void 0);if(F!==void 0&&!s.has(F))return{target:n,candidates:[]};let i=(t,a)=>`act:${t}${Object.keys(a).length>0?`:${Object.values(a).map(b=>String(b)).join(",")}`:""}`,y=(t,a,b,O,h)=>{t.destructive||Object.values(a).some(I=>typeof I=="string"&&g.graph.has(I)&&o(I)===void 0)||pe(g,{name:t.name,args:{...a}},d,O.length===0)&&u({type:"act",id:i(t.name,a),label:b,description:h??t.description??b,mutation:t.name,args:a,asks:O})};if(n.on!=="place"||r.acts)if(r.acts)for(let t of r.acts){let a=k.get(t.mutation);!a||t.destructive||n.on==="act"&&t.mutation!==n.act||y(a,t.args,t.label,(t.open??[]).filter(b=>!b.optional).map(b=>b.name),t.why)}else{let t=$?[$]:[];for(let a of m){if(n.on==="act"&&a.name!==n.act)continue;let b=a.input.shape??{},O=h=>Object.entries(b).filter(([I,w])=>I!==h&&w.safeParse?.(void 0).success===!1).map(([I])=>I);if(a.subject)for(let h of t)Q(l,a).includes(h.kind)&&y(a,{[a.subject.arg]:h.id},`${a.title??B(a.name)}: ${N(l,h)}`,O(a.subject.arg));else F!==void 0&&(a.creates??[]).includes(F)&&y(a,{},a.title??B(a.name),O(void 0))}}let S=C.filter(t=>t.type==="act");C.splice(0,C.length,...A(S));let R=(t,a)=>{let b=Se(l,m).get(t.kind),O=te(l,t.kind),h=ie(l,t.kind),I=[];for(let[w,D]of Object.entries(O)){if(a!==void 0?w!==a:h.has(w)||t[w]!==void 0)continue;let z=X(D),q=z?.type==="enum"&&!z.multiple?z.options??[]:z?.type==="boolean"?[!0,!1]:[];if(q.length===0)continue;let L=(b?.get(w)??[]).map(E=>k.get(E)).find(E=>E?.subject!==void 0&&pe(g,{name:E.name,args:{[E.subject.arg]:t.id,[w]:q.find(re=>re!==t[w])??q[0]}},d,!0));if(L?.subject)for(let E of q)t[w]!==E&&I.push({type:"fill",id:`fill:${t.id}:${w}:${ye(E)}`,label:`${fe(l,t.kind,w)}: ${ye(E)}`,description:`Set ${fe(l,t.kind,w).toLowerCase()} of ${N(l,t)} to ${ye(E)}`,record:t.id,field:w,value:E,call:{name:L.name,args:{[L.subject.arg]:t.id,[w]:E}}})}for(let[w,D]of Object.entries(Y(l,t.kind))){if(a!==void 0&&w!==a)continue;let z=D.to==="*"?[...s]:D.to.filter(x=>s.has(x)),q=new Set(p.graph.out(t.id,w).map(x=>x.id)),L=m.find(x=>(x.connects??[]).includes(w)&&x.subject!==void 0&&Q(l,x).includes(t.kind));if(!L?.subject)continue;let E=we(L.input).find(x=>x.name!==L.subject.arg);if(!E)continue;let re=z.flatMap(x=>E.kinds.length===0||E.kinds.includes(x)?p.graph.nodesOfKind(x):[]).filter(x=>x.id!==t.id&&!q.has(x.id)&&o(x.id)!==void 0);for(let x of A(re)){let me={name:L.name,args:{[L.subject.arg]:t.id,[E.name]:x.id}};pe(g,me,d,!0)&&I.push({type:"fill",id:`fill:${t.id}:${w}:${x.id}`,label:`${B(w)}: ${N(l,x)}`,description:`Link ${N(l,t)} to ${N(l,x)}${D.description?` as ${D.description}`:""}`,record:t.id,field:w,value:x.id,call:me})}}return I};if(n.on==="field"&&$)for(let t of R($,n.field))u(t);else if($&&n.on==="record")for(let t of A(R($)))u(t);let T=t=>{let a=W(l,t).toLowerCase(),b=[{type:"panel",id:`panel:${t}:list`,label:`A list of ${a}`,description:`Every ${_(l.tryDefinition(t),t).toLowerCase()} this viewer may see, as a list`,panel:{lens:"blocks",kind:t}}],O=ie(l,t);for(let[h,I]of Object.entries(te(l,t))){if(O.has(h))continue;let w=X(I),D=fe(l,t,h).toLowerCase();if(w?.type==="enum")b.push({type:"panel",id:`panel:${t}:group:${h}`,label:`${V(a)} by ${D}`,description:`A list of ${a} grouped by ${D}`,panel:{lens:"blocks",kind:t,group:h}}),b.push({type:"panel",id:`panel:${t}:columns:${h}`,label:`Columns of ${a} by ${D}`,description:`${V(a)} in a column for each ${D}`,panel:{lens:"columns",kind:t,column:h}});else if(w?.type==="number"||w?.type==="integer"||w?.type==="date"||w?.type==="datetime"){let z=w.type==="date"||w.type==="datetime";b.push({type:"panel",id:`panel:${t}:sort:${h}`,label:`${V(a)} by ${D}`,description:`A list of ${a}, the ${z?"latest":"highest"} ${D} first`,panel:{lens:"blocks",kind:t,sort:{by:h,direction:"desc"}}}),z&&b.push({type:"panel",id:`panel:${t}:calendar:${h}`,label:`A calendar of ${a}`,description:`${V(a)} on a calendar by ${D}`,panel:{lens:"calendar",kind:t,start:h}})}}return b},P=n.on==="place"?[...s]:F!==void 0?[F]:[];for(let t of P)for(let a of A(T(t)))u(a);for(let t of A((r.places??[]).filter(a=>a.kind===void 0?n.on==="place":s.has(a.kind)&&(n.on==="place"||a.kind===F))))n.on==="lens"&&t.as===n.place||u({type:"place",id:`place:${t.as}`,label:t.title,description:`Go to ${t.title}`,place:t.as});if($){let t=[];for(let[a,b]of Object.entries(Y(l,$.kind)))for(let O of p.graph.out($.id,a))o(O.id)&&t.push({type:"record",id:`record:${O.id}`,label:N(l,O),description:`${V(b.description??B(a))}: ${N(l,O)}`,record:O.id,relation:a});for(let a of l.kinds)for(let[b,O]of Object.entries(Y(l,a)))if(!(O.to!=="*"&&!O.to.includes($.kind)))for(let h of p.graph.in($.id,b))h.kind===a&&o(h.id)&&t.push({type:"record",id:`record:${h.id}`,label:N(l,h),description:`${V(O.inverse??B(b))}: ${N(l,h)}`,record:h.id,relation:b});for(let a of A(t))u(a)}else if(n.on==="list"||n.on==="lens")for(let t of A(F!==void 0?p.graph.nodesOfKind(F):[]))o(t.id)&&u({type:"record",id:`record:${t.id}`,label:N(l,t),description:`Open ${N(l,t)}`,record:t.id});else if(n.on==="selection")for(let t of j){let a=o(t);u({type:"record",id:`record:${t}`,label:N(l,a),description:`Open ${N(l,a)}`,record:t})}return{target:n,candidates:C}}var V=e=>e&&`${e[0].toUpperCase()}${e.slice(1)}`,Pe={columns:["board","kanban","column","lane","pipeline","stage","funnel"],board:["board","map","floor","layout","seat","slot"],calendar:["calendar","schedule","date","due","month","week","agenda","deadline","day"],timeline:["timeline","gantt","schedule","roadmap","span"],coverage:["coverage","matrix","grid","gap"],plan:["plan","floor","map","region","area"],blocks:["list","table","summary","overview","dashboard","card"]},De=new Set(["a","an","the","of","for","my","our","me","us","to","with","and","in","on","by","that","which","i","we","want","need","show","open","go","draw","make","new","view","views","panel","panels","page","lens","please","all","every","some","see","can","could","would","like","one","what","is","are","do","does","here","there","how","it","this","these","those"]),Z=e=>e.length>3&&e.endsWith("ies")?`${e.slice(0,-3)}y`:e.length>3&&e.endsWith("s")&&!e.endsWith("ss")?e.slice(0,-1):e,ue=e=>e.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^a-z0-9]+/).filter(Boolean);function Xe(e,n,r){let f=e,d=H(f)?.store??f,c=d.schema,g=oe(d,r.principal),p=d.seenBy(r.principal),l=ne(n),s=new Set;for(let i of l){let y=p.graph.getNode(i)?.kind;y!==void 0&&g.has(y)&&s.add(y)}if(l.length>0&&s.size===0)return[];if(n.on==="list"&&s.add(n.kind),n.on==="lens"){let i=n.kind??r.places.find(y=>y.as===n.place)?.kind;i!==void 0&&s.add(i)}let o=new Map;for(let i of c.kinds){if(!g.has(i))continue;let y=c.tryDefinition(i);for(let S of[i,_(y,i),W(c,i)])for(let R of ue(S))o.set(Z(R),i)}let m=ue(r.said??"").filter(i=>!De.has(i)),k=new Set,C=[];for(let i of m){let y=o.get(Z(i));y!==void 0?k.add(y):C.push(Z(i))}let v=k.size>0?k:s;if((r.said??"").trim()!==""&&m.length===0)return[];if(v.size===0&&m.length===0)return[];let u=[];r.places.forEach((i,y)=>{if(i.hidden||n.on==="lens"&&i.as===n.place)return;let S=i.over??(i.kind!==void 0?[i.kind]:[]);if(S.length>0&&!S.some(P=>g.has(P)))return;let R=S.some(P=>v.has(P)),T=!R&&(i.reads??[]).some(P=>v.has(P));v.size>0&&!R&&!T||u.push({place:i,own:R,reads:T,at:y})});let A=i=>new Set(ue(i.title).map(Z)),j=new Set(C.filter(i=>u.some(({place:y})=>A(y).has(i)))),$=[];for(let{place:i,own:y,reads:S,at:R}of u){let T=A(i),P=new Set((Pe[i.lens??""]??[]).map(Z)),t=C.filter(h=>T.has(h)||P.has(h)&&!j.has(h)).length,a=C.length-t;if(C.length>0&&t===0)continue;let b=!S&&a===0?"full":"partial",O=(y?4:S?2:1)+t*2-a+(b==="full"?1:0);$.push({view:{place:i.as,title:i.title,...i.kind!==void 0?{kind:i.kind}:{},fit:b},score:O,at:R})}return $.filter((i,y)=>!$.slice(0,y).some(S=>S.view.place===i.view.place&&S.view.title===i.view.title)).sort((i,y)=>y.score-i.score||i.at-y.at).slice(0,r.most??3).map(i=>i.view)}var ge=new WeakMap;function Ne(e){let n=2166136261;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619)>>>0;return n.toString(36)}function Ie(e,n){let r=e,f=H(r)?.store??r,d=f.schema,c=oe(f,n),p=f.allMutations().filter(u=>!u.destructive&&f.permits({name:u.name,args:{}},n).ok!==!1),l=`${[...c].join(",")}|${p.map(u=>u.name).join(",")}`,s=ge.get(d)?.get(l);if(s)return s;let o=[...c].map(u=>{let A=ie(d,u),j={};for(let[y,S]of Object.entries(te(d,u))){if(A.has(y))continue;let R=X(S);R&&(j[y]=R.type==="enum"?`enum:${(R.options??[]).join("|")}`:R.type)}let $={};for(let[y,S]of Object.entries(Y(d,u)))$[y]=S.to==="*"?[...c]:S.to.filter(R=>c.has(R));let F=d.tryDefinition(u),i=Object.entries(F?.fieldAliases??{}).filter(([y,S])=>y in j&&S.length>0);return{kind:u,noun:_(d.tryDefinition(u),u),plural:W(d,u),fields:j,relations:$,...F?.aliases&&F.aliases.length>0?{aliases:F.aliases}:{},...i.length>0?{fieldAliases:Object.fromEntries(i)}:{}}}),m=p.map(u=>({name:u.name,title:u.title??B(u.name),...u.subject?{on:Q(d,u).filter(A=>c.has(A))}:{}})),k={kinds:o,acts:m},C={version:Ne(JSON.stringify(k)),...k},v=ge.get(d)??new Map;return v.set(l,C),ge.set(d,v),C}var Me=e=>e.name??e.id??e.kind;function en(e,n,r){let f=e,{principal:d}=r,c=H(f)?.store??f,g=c.seenBy(d),p=c.schema,l=oe(c,d),s=i=>{let y=g.graph.getNode(i);return y&&l.has(y.kind)?y:void 0},o=i=>({id:i.id,kind:i.kind,label:N(p,i)}),m=ne(n),k=m.length===1?s(m[0]):void 0,C=k?Object.fromEntries(Object.keys(te(p,k.kind)).filter(i=>!ie(p,k.kind).has(i)&&k[i]!==void 0&&i!=="label").map(i=>[i,k[i]])):{},v={on:n.on,...k?{record:{...o(k),fields:C}}:{},...n.on==="field"&&k?{field:n.field}:{},...n.on==="list"&&l.has(n.kind)?{kind:n.kind}:{},...n.on==="lens"?{place:n.place,...n.kind&&l.has(n.kind)?{kind:n.kind}:{}}:{},...n.on==="place"?{place:n.place}:{},...n.on==="act"?{act:n.act}:{}},u=[...new Set([...n.on==="selection"?n.ids:[],...r.selection??[]])].flatMap(i=>{let y=s(i);return y?[o(y)]:[]}),A=[];if(k){for(let i of Object.keys(Y(p,k.kind)))for(let y of g.graph.out(k.id,i))s(y.id)&&A.push({...o(y),relation:i,direction:"out"});for(let i of p.kinds)for(let y of Object.keys(Y(p,i)))for(let S of g.graph.in(k.id,y))S.kind===i&&s(S.id)&&A.push({...o(S),relation:y,direction:"in"})}let j=g.batches().filter(i=>!i.ops.every(be)).slice(-(r.recent??6)).reverse().map(i=>({intent:i.intent,at:i.at,by:Me(i.author)})),$=(r.purpose?.jobs??[]).filter(i=>Ae(i,d.roles)&&l.has(i.kind)).map(i=>({name:i.name,ask:i.ask,kind:i.kind})),F=r.purpose&&(r.purpose.for!==void 0||$.length>0)?{...r.purpose.for!==void 0?{for:r.purpose.for}:{},jobs:$}:void 0;return{...r.place!==void 0?{place:r.place}:{},target:v,selection:u,neighbors:A.slice(0,24),recent:j,schema:Ie(c,d),...F?{purpose:F}:{},...r.friction?{friction:Oe(r.friction,p,{reader:d})}:{}}}export{Fe as a,Ze as b,ne as c,Qe as d,Xe as e,en as f};
|
|
@@ -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{G as k,La as o,W as n}from"./chunk.3VEZ5MOC.js";import{a as t}from"./chunk.SDO3U72B.js";import{b as p}from"./chunk.AJZBJBMO.js";var f=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.WVUJXDXZ.js","./chunk.L7XKYGV7.js","./chunk.CE3NKAF7.js","./chunk.R3GE37OI.js","./chunk.2KCDLCB2.js","./chunk.UD7VLXPM.js","./chunk.3DEWQDP7.js","./chunk.MIE4TJRW.js","./chunk.CFE3MHWZ.js","./chunk.RD2FSSLV.js","./chunk.HXTKBISQ.js","./chunk.TFJA4QV4.js","./chunk.HWFJQ42Y.js","./chunk.QUETLFBJ.js","./chunk.JULD4XFB.js","./chunk.GRTBEA7O.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.QOQ26NXM.js")))),y=f.part((e,r)=>e.drawFiles(r),{quiet:!0});var d=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.MIE4TJRW.js","./chunk.CFE3MHWZ.js","./chunk.RD2FSSLV.js","./chunk.HXTKBISQ.js","./chunk.TFJA4QV4.js","./chunk.HWFJQ42Y.js","./chunk.QUETLFBJ.js","./chunk.JULD4XFB.js","./chunk.GRTBEA7O.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.ACNOP2IU.js")))),I=d.part((e,r)=>e.drawLinkedRecord(r),{quiet:!0}),w=d.part((e,r)=>e.drawLinkedPicker(r),{what:"Picking a linked record"});var s=p(n(),1),m=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.MIE4TJRW.js","./chunk.CFE3MHWZ.js","./chunk.RD2FSSLV.js","./chunk.HXTKBISQ.js","./chunk.TFJA4QV4.js","./chunk.HWFJQ42Y.js","./chunk.QUETLFBJ.js","./chunk.JULD4XFB.js","./chunk.GRTBEA7O.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.DPHH5ZVL.js")))),g=m.part((e,r)=>(0,s.jsx)(e.RepeatPicker,{...r}),{quiet:!0}),E=m.part((e,r)=>(0,s.jsx)(e.RepeatEditor,{...r}),{quiet:!0});var a=p(k(),1),i=p(n(),1),c=o(t(()=>(__graviewPreload(import.meta.url,["./chunk.TFJA4QV4.js","./chunk.HWFJQ42Y.js","./chunk.QUETLFBJ.js","./chunk.JULD4XFB.js","./chunk.GRTBEA7O.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.TR4YFVZN.js")))),l=c.part((e,r)=>(0,i.jsx)(e.WhenInput,{...r}),{quiet:!0});function M(e){return(0,i.jsx)(a.Suspense,{fallback:(0,i.jsx)("span",{"data-graview-when-arriving":"",style:{display:"inline-block",minHeight:24}}),children:(0,i.jsx)(l,{...e})})}var N=()=>c.load().then(()=>{},()=>{});export{y as a,I as b,w as c,g as d,E as e,M as f,N as g};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y,b as h}from"./chunk.
|
|
1
|
+
import{a as y,b as h}from"./chunk.SS6KL5NT.js";import"./chunk.WV45KLXC.js";import"./chunk.2KCDLCB2.js";import"./chunk.UD7VLXPM.js";import"./chunk.3DEWQDP7.js";import{Bd as b}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";var k=(d,i)=>({id:i.id,said:h(d,i),when:i.when,...i.alsoMine?{alsoMine:!0}:{}});async function A(d,i,t){let a=b(t.principal);if(a.id===void 0)return{ok:!1,error:"This seat acts for nobody the app knows by id, so there is nobody to tell. Nothing was kept."};let r=t.store.seenBy(a),p=async()=>(await t.subscriptions.list(a.id)).filter(n=>n.app===t.app);if(d==="list_subscriptions")return{ok:!0,data:{subscriptions:(await p()).map(n=>k(r,n))}};if(d==="unsubscribe"){let n=String(i.id??"");return(await p()).some(g=>g.id===n)?(await t.subscriptions.remove(n),{ok:!0,data:{removed:n}}):{ok:!1,error:`No subscription "${n}" of yours. list_subscriptions says which there are.`}}let o=String(i.on??""),c=n=>typeof i[n]=="string"&&i[n].trim()!==""?i[n].trim():void 0,e=c("record");if(e!==void 0&&!r.graph.getNode(e)){let n=t.store.resolveRef({name:"record",kinds:["*"]},e,a);if(!n.ok)return{ok:!1,error:`${n.message} Nothing was kept.`};e=n.id}let s=c("kind")??(e!==void 0&&o!=="act"?r.graph.getNode(e)?.kind:void 0),f=c("act"),m=c("condition"),u=o==="act"?{on:o,...f!==void 0?{act:f}:{},...e!==void 0?{record:e}:{}}:o==="created"&&s!==void 0?{on:o,kind:s}:o==="changed"?{on:o,...s!==void 0&&e===void 0?{kind:s}:{},...e!==void 0?{record:e}:{}}:o==="reaches"&&s!==void 0?{on:o,kind:s,condition:m??"",...e!==void 0?{record:e}:{}}:void 0;if(!u)return{ok:!1,error:'Say what to be told of: on is "act", "created", "changed" or "reaches", with a kind (or a record) for all but act. Nothing was kept.'};let l=y({schema:r.schema,allMutations:()=>t.store.allMutations(),graph:r.graph},u);if(l)return{ok:!1,error:`${l} Nothing was kept.`};let S=await t.subscriptions.add({who:a,app:t.app,when:u,...i.alsoMine===!0?{alsoMine:!0}:{}});return{ok:!0,data:{subscription:k(r,S)}}}export{A as runSubscriptionTool};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a,b}from"./chunk.AWV57UBJ.js";import"./chunk.YBQ5GVAX.js";import"./chunk.EB7PZJEO.js";import"./chunk.MSUZAJ2K.js";import"./chunk.64LCHHZB.js";import"./chunk.42KHFGN6.js";import"./chunk.RQG672MJ.js";import"./chunk.Q6H5HESF.js";import"./chunk.3JMQKANL.js";import"./chunk.42C3FIKK.js";import"./chunk.2ME4DVBI.js";import"./chunk.XXCHO2A5.js";import"./chunk.SADR3MQI.js";import"./chunk.HJCQ6I3S.js";import"./chunk.2BMZPALF.js";import"./chunk.GONZB3J3.js";import"./chunk.LFFJB6D3.js";import"./chunk.DMZRFXH7.js";import"./chunk.DZ6UDZOB.js";import"./chunk.Q4VFLLUT.js";import"./chunk.6ZENHSTQ.js";import"./chunk.BHJRT57H.js";import"./chunk.BIDL7GQD.js";import"./chunk.CNN32262.js";import"./chunk.N5Z34V7U.js";import"./chunk.LOKGUALC.js";import"./chunk.EP5JS7ZH.js";import"./chunk.Q5WEOX3Q.js";import"./chunk.KAM73WVF.js";import"./chunk.O32F6LGK.js";import"./chunk.EGSOHTZZ.js";import"./chunk.WVUJXDXZ.js";import"./chunk.L7XKYGV7.js";import"./chunk.CE3NKAF7.js";import"./chunk.R3GE37OI.js";import"./chunk.2KCDLCB2.js";import"./chunk.UD7VLXPM.js";import"./chunk.3DEWQDP7.js";import"./chunk.MIE4TJRW.js";import"./chunk.CFE3MHWZ.js";import"./chunk.RD2FSSLV.js";import"./chunk.HXTKBISQ.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import"./chunk.AJZBJBMO.js";export{b as declaredLensView,a as formatFor};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{G as I}from"./chunk.
|
|
1
|
+
import{G as I}from"./chunk.3VEZ5MOC.js";import{Tc as $,Uc as k,Vc as y,Wc as _,Xc as O,bd as x,od as S,qd as T,td as E,ud as R}from"./chunk.6AANHELP.js";import{a as b}from"./chunk.AJZBJBMO.js";var N=b(l=>{"use strict";var V=I();function D(r){var e="https://react.dev/errors/"+r;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)e+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+r+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function d(){}var s={d:{f:d,r:function(){throw Error(D(522))},D:d,C:d,L:d,m:d,X:d,S:d,M:d},p:0,findDOMNode:null},j=Symbol.for("react.portal");function W(r,e,a){var t=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:j,key:t==null?null:""+t,children:r,containerInfo:e,implementation:a}}var u=V.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(r,e){if(r==="font")return"";if(typeof e=="string")return e==="use-credentials"?e:""}l.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s;l.createPortal=function(r,e){var a=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)throw Error(D(299));return W(r,e,null,a)};l.flushSync=function(r){var e=u.T,a=s.p;try{if(u.T=null,s.p=2,r)return r()}finally{u.T=e,s.p=a,s.d.f()}};l.preconnect=function(r,e){typeof r=="string"&&(e?(e=e.crossOrigin,e=typeof e=="string"?e==="use-credentials"?e:"":void 0):e=null,s.d.C(r,e))};l.prefetchDNS=function(r){typeof r=="string"&&s.d.D(r)};l.preinit=function(r,e){if(typeof r=="string"&&e&&typeof e.as=="string"){var a=e.as,t=h(a,e.crossOrigin),n=typeof e.integrity=="string"?e.integrity:void 0,i=typeof e.fetchPriority=="string"?e.fetchPriority:void 0;a==="style"?s.d.S(r,typeof e.precedence=="string"?e.precedence:void 0,{crossOrigin:t,integrity:n,fetchPriority:i}):a==="script"&&s.d.X(r,{crossOrigin:t,integrity:n,fetchPriority:i,nonce:typeof e.nonce=="string"?e.nonce:void 0})}};l.preinitModule=function(r,e){if(typeof r=="string")if(typeof e=="object"&&e!==null){if(e.as==null||e.as==="script"){var a=h(e.as,e.crossOrigin);s.d.M(r,{crossOrigin:a,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0})}}else e==null&&s.d.M(r)};l.preload=function(r,e){if(typeof r=="string"&&typeof e=="object"&&e!==null&&typeof e.as=="string"){var a=e.as,t=h(a,e.crossOrigin);s.d.L(r,a,{crossOrigin:t,integrity:typeof e.integrity=="string"?e.integrity:void 0,nonce:typeof e.nonce=="string"?e.nonce:void 0,type:typeof e.type=="string"?e.type:void 0,fetchPriority:typeof e.fetchPriority=="string"?e.fetchPriority:void 0,referrerPolicy:typeof e.referrerPolicy=="string"?e.referrerPolicy:void 0,imageSrcSet:typeof e.imageSrcSet=="string"?e.imageSrcSet:void 0,imageSizes:typeof e.imageSizes=="string"?e.imageSizes:void 0,media:typeof e.media=="string"?e.media:void 0})}};l.preloadModule=function(r,e){if(typeof r=="string")if(e){var a=h(e.as,e.crossOrigin);s.d.m(r,{as:typeof e.as=="string"&&e.as!=="script"?e.as:void 0,crossOrigin:a,integrity:typeof e.integrity=="string"?e.integrity:void 0})}else s.d.m(r)};l.requestFormReset=function(r){s.d.r(r)};l.unstable_batchedUpdates=function(r,e){return r(e)};l.useFormState=function(r,e,a){return u.H.useFormState(r,e,a)};l.useFormStatus=function(){return u.H.useHostTransitionStatus()};l.version="19.2.8"});var Y=b((J,P)=>{"use strict";function L(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(L)}catch(r){console.error(r)}}L(),P.exports=N()});var B={name:"Graview",typography:{body:y.body,mono:y.mono},schemes:k},A={ground:"--graview-ground",groundDeep:"--graview-ground-deep",wash:"--graview-wash",panel:"--graview-panel",panelMuted:"--graview-panel-muted",panelWarning:"--graview-panel-warning",edge:"--graview-edge",edgeBright:"--graview-edge-bright",ink:"--graview-ink",inkMuted:"--graview-ink-muted",inkFaint:"--graview-ink-faint",accent:"--graview-accent",accentDim:"--graview-accent-dim",accentInk:"--graview-accent-ink",warn:"--graview-warn",good:"--graview-good",bad:"--graview-bad",glow:"--graview-glow",bar:"--graview-bar",float:"--graview-float",liftLow:"--graview-lift-low",liftHigh:"--graview-lift-high",tintAlpha:"--graview-tint-alpha",tintLightness:"--graview-tint-lightness",gridAlpha:"--graview-grid-alpha"};function H(r){return Object.keys(A).map(e=>` ${A[e]}: ${r[e]};`).join(`
|
|
2
2
|
`)}function C(r,e){let a=r===e?r:`${r} ${e}`;return` ${a} [data-graview-view] { transition: none; }
|
|
3
3
|
${a} [data-graview-touched] > * { animation: none; }
|
|
4
4
|
${a} [data-graview-view][data-graview-wrote] > *,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{g as A}from"./chunk.
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{g as A}from"./chunk.IPGLITWA.js";import{t as H}from"./chunk.H3IGXHZR.js";import{G as v,J as S,La as D,W as s,ea as k,ga as T}from"./chunk.3VEZ5MOC.js";import{a as B}from"./chunk.SDO3U72B.js";import{Ce as I,pe as L,td as R}from"./chunk.6AANHELP.js";import{b as i}from"./chunk.AJZBJBMO.js";var O=i(v(),1);var P=i(s(),1),M=H.part((e,o)=>(0,P.jsx)(e.Inbox,{...o}),{quiet:!0});function N(e){let{store:o,whileAway:r,notifications:t,aiDesk:l}=k(),n=T(),d=A(),{entries:c}=S(l),p=(0,O.useMemo)(()=>o.log.all().some(f=>f.suggests!==void 0&&!f.withheld),[o,n]);return e>0||d>0||p||(r?.tidied??0)>0||(t?.length??0)>0||c.length>0}function j(e){return(0,P.jsx)(M,{...e})}var h=i(s(),1),F=e=>e.tabIndex>=0&&!e.disabled&&e.getClientRects().length>0;function V(e){if(!e)return!1;if(F(e))return e.focus({preventScroll:!1}),!0;let o=[...e.querySelectorAll("a[href], button, input, select, textarea, [tabindex]")].find(F);return o?(o.focus(),!0):(e.hasAttribute("tabindex")||e.setAttribute("tabindex","-1"),e.focus(),!0)}var G=`.graview-skips{display:contents}
|
|
2
2
|
.graview-skip{position:absolute;width:0;height:0;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}
|
|
3
3
|
.graview-skip:focus{width:auto;height:auto;overflow:visible;clip-path:none;padding:6px 12px;border-radius:8px;border:1px solid var(--graview-accent);background:var(--graview-float,var(--graview-panel));color:var(--graview-ink);font:inherit;font-size:.875rem;font-weight:600;box-shadow:var(--graview-lift-high);outline:2px solid var(--graview-accent);outline-offset:1px}
|
|
4
4
|
.graview-skips[data-place=bar] .graview-skip:focus{position:fixed;left:8px;top:6px;z-index:${R("toast")}}
|
|
5
|
-
.graview-skips[data-place=here] .graview-skip:focus{position:static;justify-self:start}`;function _({to:e,place:o="bar"}){return e.length===0?null:(0,h.jsxs)("span",{className:"graview-skips","data-place":o,children:[(0,h.jsx)("style",{children:G}),e.map(r=>(0,h.jsx)("button",{type:"button",className:"graview-skip","data-graview-skip":r.testid,"data-testid":`skip-${r.testid}`,...r.opens?{"data-graview-skip-opens":""}:{},onClick:r.go,children:r.label},r.testid))]})}var m=i(v(),1),w=i(s(),1),K=D(B(()=>(__graviewPreload(import.meta.url,["./chunk.
|
|
5
|
+
.graview-skips[data-place=here] .graview-skip:focus{position:static;justify-self:start}`;function _({to:e,place:o="bar"}){return e.length===0?null:(0,h.jsxs)("span",{className:"graview-skips","data-place":o,children:[(0,h.jsx)("style",{children:G}),e.map(r=>(0,h.jsx)("button",{type:"button",className:"graview-skip","data-graview-skip":r.testid,"data-testid":`skip-${r.testid}`,...r.opens?{"data-graview-skip-opens":""}:{},onClick:r.go,children:r.label},r.testid))]})}var m=i(v(),1),w=i(s(),1),K=D(B(()=>(__graviewPreload(import.meta.url,["./chunk.BPNW5KCP.js","./chunk.IKKKHHRN.js","./chunk.IPGLITWA.js","./chunk.U5P23GO7.js","./chunk.DCLF4WWZ.js","./chunk.XDZDNZ7B.js","./chunk.E423JCOS.js","./chunk.O5FTWXA2.js","./chunk.Q4VFLLUT.js","./chunk.6ZENHSTQ.js","./chunk.YL2RBZFE.js","./chunk.LOKGUALC.js","./chunk.MIE4TJRW.js","./chunk.CFE3MHWZ.js","./chunk.RD2FSSLV.js","./chunk.HXTKBISQ.js","./chunk.TFJA4QV4.js","./chunk.HWFJQ42Y.js","./chunk.QUETLFBJ.js","./chunk.JULD4XFB.js","./chunk.GRTBEA7O.js","./chunk.H3IGXHZR.js","./chunk.7TDML5YU.js","./chunk.3VEZ5MOC.js","./chunk.SDO3U72B.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.Q42R2KW4.js")))),W=K.part((e,o)=>{let r=e.RecordInteractions;return(0,w.jsx)(r,{...o})},{quiet:!0});function $(e,o,r){let t=e.target;return(t.on==="record"||t.on==="field"?t.id===o:t.on==="selection"?t.ids.includes(o):t.on==="act"?t.id===o:!1)||e.offered.some(n=>n.id===`record:${o}`||n.id.startsWith(`fill:${o}:`))||(e.batches??[]).some(n=>r(n).includes(o))}function q({id:e,style:o,headingStyle:r,className:t}){let{ai:l,aiDesk:n,store:d}=k(),{entries:c}=S(n),p=l.off===!0;(0,m.useEffect)(()=>{p||n.load()},[n,p]);let f=d.log.length,g=(0,m.useMemo)(()=>{let b=x=>d.log.all().flatMap(C=>C.batch===x?C.writes:[]);return c.filter(x=>$(x,e,b))},[c,e,d,f]);return p||g.length===0?null:(0,w.jsx)(m.Suspense,{fallback:null,children:(0,w.jsx)(W,{entries:g,...o?{style:o}:{},...r?{headingStyle:r}:{},...t?{className:t}:{}})})}var u=i(v(),1);var y=i(s(),1),Q={textDecorationLine:"underline",textDecorationColor:"color-mix(in srgb, currentColor 50%, transparent)",textDecorationThickness:1,textUnderlineOffset:"0.2em"};function E({children:e,mark:o="\u2192"}){return(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("span",{style:Q,children:e}),(0,y.jsx)("span",{"aria-hidden":"true",children:o})]})}var a=i(s(),1);function Er({context:e,stop:o,title:r,label:t,style:l,className:n,children:d,...c}){let p=L(e.views?.arrangement?.()),f=d??(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)(E,{mark:"\u2197",children:["In ",p==="Scene"?"the scene":p.replace(/^The /,"the ")]})}),g=t?{"aria-label":t}:{};if(e.overview){let b=e.overview;return(0,a.jsx)("a",{href:o,...c,...g,...r?{title:r}:{},style:l,...n?{className:n}:{},onClick:x=>{x.preventDefault(),b(o)},children:f})}return e.embedded?null:(0,a.jsx)("a",{href:`${e.sceneHref??"/"}${o}`,...c,...g,...r?{title:r}:{},style:l,...n?{className:n}:{},children:f})}function Mr(){return(0,a.jsx)("a",{href:"#fresh","data-testid":"start-fresh",title:"Forget every edit made in this browser and return to the example",onClick:e=>{e.preventDefault(),window.location.assign(I(window.location.href))},style:{color:"inherit",display:"inline-flex",alignItems:"center",minHeight:24,minWidth:24},children:"Start fresh"})}function Nr(e){let o=(0,u.useRef)(0),r=(0,u.useCallback)(t=>e.subscribe(()=>{o.current+=1,t()}),[e]);return(0,u.useSyncExternalStore)(r,()=>o.current,()=>0)}function Vr(e){return e===void 0?{}:e==="sm"||e==="md"?{"data-size":e}:{style:{"--graview-control-height":typeof e=="number"?`${e}px`:e}}}var Gr=(e,o)=>o?`${e} ${o}`:e;export{N as a,j as b,V as c,_ as d,q as e,E as f,Er as g,Mr as h,Nr as i,Vr as j,Gr as k};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{c as M}from"./chunk.4AC2QM7T.js";import{ga as b}from"./chunk.6HY6ZGEE.js";var k=["owners","status","schedule","budget","places","sources","stock","votes","private","history","publishing","roster","routines","comparison"],y={owners:"people who own things",status:"a status that moves",schedule:"dates it is due by, or a schedule",budget:"money against a budget",places:"places",sources:"sources behind claims",stock:"counts in stock",votes:"votes or picks",private:"private to its owner",history:"a history, a record book",publishing:"content to publish",roster:"a roster of people",routines:"repeating routines",comparison:"a comparison to pick one from"},J={owners:"a person kind (or the people the app has), an owner link, Give it to someone, a rule that every one has somebody on it, and Who has what",status:"a status with named steps (or the one the app has), an act for each step, and a board",schedule:"a due date, Set the date, the on-time rule, and a calendar",budget:"a cost beside the money the app keeps, a budget on the kind it is grouped under, Set the budget, and the over-budget rule",places:"a place kind, a link to one, and a map of where things are",sources:"a source kind, a link from each claim to its source, and the rule that a claim names one",stock:"what is on hand and the reorder level, Count the stock, and the running-low rule",votes:"a vote on each, Vote for it, and a tally",private:"a sight that keeps each person's own records to them",history:"the record book: an era or season each belongs to, and a timeline",publishing:"a published status, Publish it, and what the public sees",roster:"a person kind with the fields a roster keeps, and the list of who is here",routines:"how often each repeats and when it was last done, Mark it done, and the overdue rule",comparison:"a side-by-side of the candidates, one chosen, and Choose it"},U=new Set(["person","people","member","user","player","guest","candidate","participant","traveler","volunteer","interviewer","interviewee","contact","trade","staff","student","employee","teammate","crew","attendee","friend","customer","client","driver","speaker","host","teacher","parent","kid","child","coach","patient","tenant","resident","neighbor","applicant","recruit","contributor","assignee","worker","collaborator","runner"]),K=new Set(["place","venue","location","room","site","building","store","warehouse","city","country","region","address","hall","stadium","office","shelf"]),z=new Set(["source","reference","citation","evidence"]),H=new Set(["season","era","period","epoch","edition","generation","age","campaign","tournament"]),ae=/owner|owned|assign|^lead$|responsible|^by$|^by-|done-?by|interviewer|reviewer|maker|author|keeper|givenby|^for-?person$/i,oe=/due|deadline|until|needed|needby|target|expires|^ends?(on|at)?$|^by$/i,de=/^(date|day|when|at|start|starts|startsat|startson|startdate|scheduled|scheduledfor|scheduledon|happens|happenson|held|heldon|from|time|exchangedate|.*date|.*day)$/i,le=/released|fixed|published|applied|checked|created|added|done|last|first|updated|seen|born|birth|founded|finished|completed|closed/i,X=/status|stage|state|phase|progress/i,W=/budget|limit|cap$|allowance/i,ce=/budget|cost|price|quote|amount|salary|fee|spend|total|paid|owed/i,pe=/^(place|location|venue|address|where|city|town)$/i,B=/reorder|onhand|instock|^stock|quantity|^qty/i,he=/^votes?$|votecount|upvotes|^score$|^points$/i,fe=/^(votes?|votesfor|votedby|voters|picks?|chooses|choices|favorites|likes)$/i,ue=/often|frequency|cadence|^every$|repeat|interval/i,ge=/^last/i,Q=/^(published|live|public)$/i,ye=/count\(.*\bwhere\b.*\)\s*<=\s*1\b/,u=e=>e.toLowerCase(),w=(e,t)=>u(e.kinds[t]?.noun??b(t)),$=(e,t)=>u(e.kinds[t]?.plural??`${w(e,t)}s`),me=e=>e.charAt(0).toUpperCase()+e.slice(1),p=(e,t)=>me($(e,t)),we=e=>/^[aeiou]/i.test(e)?"an":"a",x=(e,t="and")=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`,N=e=>new Set((e??"").split(/[^A-Za-z0-9_-]+/).filter(Boolean)),v=e=>Object.entries(e.kinds),m=(e,t)=>Object.entries(e.acts??{}).filter(([,s])=>[s.on??[]].flat().includes(t)),_=e=>Array.isArray(e.lenses)?e.lenses:[],I=e=>typeof e.title=="string"?e.title:void 0,A=e=>e.bindings&&typeof e.bindings=="object"?e.bindings:{},R=(e,t)=>Array.isArray(t)&&t.length===1&&typeof t[0]=="string"&&e.kinds[t[0]]?t[0]:void 0;function V(e,t){let s=e.kinds[t];if(!s)return!1;let r=n=>u(n).replace(/ll/g,"l");return s.people===!0||U.has(r(t))||U.has(r(w(e,t)))}var Y=(e,t)=>K.has(u(t))||K.has(w(e,t)),ke=(e,t)=>z.has(u(t))||z.has(w(e,t)),be=(e,t)=>H.has(u(t))||H.has(w(e,t)),$e=(e,t)=>(t.type==="number"||t.type==="integer")&&(t.format==="money"||ce.test(e)),j=e=>e.type==="date"||e.type==="datetime";function P(e,t,s,r,n){return _(e).filter(d=>d.name===t&&A(d)[s]?.[r]===n).map(I).filter(d=>d!==void 0)}function D(e,t,s,r){return _(e).filter(n=>n.name==="coverage"&&A(n)[s]?.kind===t&&(r===void 0||A(n).link?.edge===r)).map(I).filter(n=>n!==void 0)}function f(e,t,s){let r=new Set(t);return Object.entries(e.rules??{}).filter(([,n])=>(s===void 0||n.over==="graph"||s.includes(n.over))&&[...N(`${n.when??""} ${n.require??""} ${n.says??""}`)].some(d=>r.has(d))).map(([n])=>n)}var G=class{kinds=new Set;fields=new Set;relations=new Set;rules=new Set;lenses=new Set;acts=new Set;said;add=(t,...s)=>{for(let r of s)this[t].add(r)};say=t=>{this.said??=t};any=()=>this.kinds.size+this.fields.size+this.relations.size+this.rules.size+this.lenses.size+this.acts.size>0;asTrait=t=>({trait:t,words:y[t],said:this.said??y[t],kinds:[...this.kinds],fields:[...this.fields],relations:[...this.relations],rules:[...this.rules],lenses:[...this.lenses],acts:[...this.acts]})};function ve(e){let t;for(let[s,r]of v(e)){let n=Object.keys(r.fields).length+Object.keys(r.edges??{}).length;(!t||n>t.fields)&&(t={kind:s,fields:n})}return t?.kind}function g(e){let t=ve(e);return v(e).sort(([s],[r])=>+(r===t)-+(s===t))}function Z(e,t){let s=e.kinds[t];if(!s)return[];let r=[];for(let[n,d]of Object.entries(s.fields)){if(d.type!=="enum"||!Array.isArray(d.options)||d.options.length<2)continue;let i=m(e,t).filter(([,a])=>typeof a.sets?.[n]=="string"&&d.options.includes(a.sets[n])).map(([a])=>a);((X.test(n)||s.lifecycle?.field===n)&&i.length>=1||i.length>=2)&&r.push({field:n,options:d.options,steps:i})}return r}var ee={owners(e,t){for(let[s,r]of g(e))for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);d.cardinality!=="one"||!i||!V(e,i)||!ae.test(n)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n],[s,i])),t.add("lenses",...D(e,s,"rows",n)),t.add("acts",...m(e,s).filter(([,o])=>o.connects===n||o.severs===n).map(([o])=>o)),t.say(`Each ${w(e,s)} has one of the ${$(e,i)} on it (${n}).`))}},status(e,t){for(let[s]of g(e))for(let{field:r,options:n,steps:d}of Z(e,s))t.add("kinds",s),t.add("fields",`${s}.${r}`),t.add("acts",...d),t.add("rules",...f(e,[r],[s])),t.add("lenses",...P(e,"columns",s,"column",r)),t.say(`${p(e,s)} move through ${x(n.map(u))}.`)},schedule(e,t){for(let[s,r]of g(e))for(let[n,d]of Object.entries(r.fields)){if(!j(d)||le.test(n))continue;let i=P(e,"calendar",s,"start",n),o=oe.test(n);if(!o&&!de.test(n)&&i.length===0)continue;t.add("kinds",s),t.add("fields",`${s}.${n}`),t.add("lenses",...i),t.add("rules",...f(e,[n],[s])),t.add("acts",...m(e,s).filter(([,l])=>(l.writes??[]).includes(n)||l.sets?.[n]!==void 0).map(([l])=>l));let a=/date|day|when|time/i.test(n)?u(b(n)):`date (${n})`;t.say(o?`${p(e,s)} are due by a date (${n}).`:`${p(e,s)} have ${we(a)} ${a}${i.length>0?", on a calendar":""}.`)}},budget(e,t){let s=v(e).flatMap(([o,a])=>Object.entries(a.fields).filter(([l,h])=>(h.type==="number"||h.type==="integer")&&W.test(l)).map(([l])=>({kind:o,name:l})));if(s.length===0)return;let r=g(e).flatMap(([o,a])=>Object.entries(a.fields).filter(([l,h])=>$e(l,h)&&!W.test(l)).map(([l])=>({kind:o,name:l})));if(r.length===0)return;let n=[...s,...r].map(o=>o.name);for(let o of[...s,...r])t.add("kinds",o.kind),t.add("fields",`${o.kind}.${o.name}`),t.add("acts",...m(e,o.kind).filter(([,a])=>(a.writes??[]).includes(o.name)||a.sets?.[o.name]!==void 0).map(([a])=>a));t.add("rules",...f(e,n).filter(o=>s.some(a=>N(e.rules[o].require??"").has(a.name))));let d=r[0],i=s.find(o=>o.kind===d.kind)??s[0];t.say(`${p(e,d.kind)}' ${u(b(d.name))} against ${i.kind===d.kind?"each one's":`each ${w(e,i.kind)}'s`} ${u(b(i.name))}.`)},places(e,t){for(let[s,r]of g(e)){Y(e,s)&&(t.add("kinds",s),t.add("lenses",...D(e,s,"columns")));for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);!i||!Y(e,i)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n],[s,i])),t.say(`${p(e,s)} are at ${$(e,i)} (${n}).`))}for(let[n,d]of Object.entries(r.fields))d.type!=="place"&&!(d.type==="string"&&pe.test(n))||(t.add("kinds",s),t.add("fields",`${s}.${n}`),t.say(`${p(e,s)} say where (${n}).`))}t.any()&&!t.said&&t.say(`${x([...t.kinds].map(s=>p(e,s)))} are places.`)},sources(e,t){for(let[s,r]of g(e)){for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);!i||!ke(e,i)&&!/^cite/i.test(n)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n,i],[s,i])),t.add("acts",...m(e,s).filter(([,o])=>o.connects===n||o.severs===n).map(([o])=>o)),t.say(`${p(e,s)} cite ${$(e,i)} (${n}).`))}for(let[n,d]of Object.entries(r.fields))d.type!=="url"||!/^source/i.test(n)||(t.add("kinds",s),t.add("fields",`${s}.${n}`),t.add("rules",...f(e,[n],[s])),t.say(`${p(e,s)} link to their source (${n}).`))}},stock(e,t){for(let[s,r]of g(e)){let n=Object.entries(r.fields).filter(([a,l])=>(l.type==="number"||l.type==="integer")&&B.test(a)).map(([a])=>a),d=Object.keys(r.computed??{}).filter(a=>B.test(a)),i=n.some(a=>/reorder/i.test(a)),o=v(e).some(([,a])=>Object.entries(a.fields).some(([l,h])=>/^(change|delta|moved)$/i.test(l)&&(h.type==="number"||h.type==="integer")));!i&&!(d.length+n.length>0&&o)||(t.add("kinds",s),t.add("fields",...n.map(a=>`${s}.${a}`),...d.map(a=>`${s}.${a}`)),t.add("rules",...f(e,[...n,...d],[s])),t.add("acts",...m(e,s).filter(([,a])=>n.some(l=>(a.writes??[]).includes(l)||a.sets?.[l]!==void 0)).map(([a])=>a)),t.say(`${p(e,s)} have a count in stock${i?" and a reorder point":""}.`))}},votes(e,t){for(let[s,r]of g(e)){for(let[n,d]of Object.entries(r.fields)){if(d.type!=="number"&&d.type!=="integer"||!he.test(n))continue;let i=m(e,s).filter(([,o])=>o.sets?.[n]!==void 0).map(([o])=>o);i.length!==0&&(t.add("kinds",s),t.add("fields",`${s}.${n}`),t.add("acts",...i),t.add("rules",...f(e,[n],[s])),t.say(`${p(e,s)} collect votes (${n}).`))}for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);!i||!fe.test(n)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n],[s,i])),t.add("acts",...m(e,s).filter(([,o])=>o.connects===n||o.severs===n).map(([o])=>o)),t.say(`${p(e,s)} pick ${$(e,i)} (${n}).`))}}},private(e,t){let s=[];for(let r of e.policy?.sees??[])if(!(!r.own&&!r.via)){for(let n of r.kinds)if(e.kinds[n]&&(t.add("kinds",n),s.includes(n)||s.push(n),r.via))for(let[d,i]of v(e))i.edges?.[r.via]&&t.add("relations",`${d}.${r.via}`)}s.length>0&&t.say(`${x(s.map(r=>p(e,r)))} are seen only by whose they are.`)},history(e,t){for(let[s,r]of g(e))for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);d.cardinality!=="one"||!i||!be(e,i)||!Object.entries(r.fields).some(([a,l])=>j(l)||/year|result|outcome|score|finish/i.test(a))||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n,i],[s,i])),t.add("lenses",...D(e,s,"rows",n),..._(e).filter(a=>a.name==="timeline"&&A(a)[s]!==void 0).map(I).filter(a=>a!==void 0)),t.say(`${p(e,s)} grouped into ${$(e,i)}, a record book.`))}},publishing(e,t){for(let[s,r]of g(e)){let n=Object.entries(r.fields).filter(([,i])=>i.type==="text").map(([i])=>i);if(n.length===0)continue;let d=Z(e,s).map(i=>i.field);for(let[i,o]of Object.entries(r.fields)){if(o.type!=="enum"||!(X.test(i)||d.includes(i))||!(o.options??[]).some(l=>Q.test(l)))continue;let a=(o.options??[]).find(l=>Q.test(l));t.add("kinds",s),t.add("fields",`${s}.${i}`,...n.map(l=>`${s}.${l}`)),t.add("acts",...m(e,s).filter(([,l])=>l.sets?.[i]===a).map(([l])=>l)),t.add("rules",...f(e,[i,...n],[s]).filter(l=>N(`${e.rules[l].when??""} ${e.rules[l].require??""}`).has(a)||n.some(h=>N(e.rules[l].require??"").has(h)))),t.say(`${p(e,s)} go from ${u(o.options[0])} to ${u(a)}, with their words.`)}}},roster(e,t){for(let[s,r]of g(e)){if(!V(e,s))continue;let n=Object.keys(r.fields);n.length<2||(t.add("kinds",s),t.add("fields",...n.map(d=>`${s}.${d}`)),t.add("lenses",...D(e,s,"columns"),...D(e,s,"rows")),t.say(`${p(e,s)}, with ${x(n.slice(1).map(d=>u(b(d))))}.`))}},routines(e,t){for(let[s,r]of g(e)){let n=Object.entries(r.fields).filter(([,a])=>j(a)&&a.repeats===!0).map(([a])=>a),d=Object.entries(r.fields).filter(([a,l])=>(l.type==="enum"||l.type==="string"||l.type==="integer"||l.type==="number")&&ue.test(a)).map(([a])=>a),i=Object.entries(r.fields).filter(([a,l])=>j(l)&&ge.test(a)).map(([a])=>a);if(n.length===0&&!(d.length>0&&i.length>0))continue;let o=[...n,...d,...i];t.add("kinds",s),t.add("fields",...o.map(a=>`${s}.${a}`)),t.add("rules",...f(e,o,[s])),t.add("lenses",...o.flatMap(a=>P(e,"calendar",s,"start",a))),t.add("acts",...m(e,s).filter(([,a])=>o.some(l=>(a.writes??[]).includes(l)||a.sets?.[l]!==void 0)).map(([a])=>a)),t.say(n.length>0?`${p(e,s)} repeat (${n[0]}).`:`${p(e,s)} come round again, each with when it was last done.`)}},comparison(e,t){for(let[s,r]of Object.entries(e.rules??{})){if(!r.require||!ye.test(r.require))continue;let n=r.over==="graph"?void 0:r.over,d=/in\('([^']+)'\)/.exec(r.require)?.[1],i=/all\('([^']+)'/.exec(r.require)?.[1],o=n?d?v(e).find(([,l])=>l.edges?.[d])?.[0]:void 0:i&&e.kinds[i]?i:void 0;if(!o&&!n)continue;let a=/==\s*'([^']+)'/.exec(r.require)?.[1];t.add("kinds",...o?[o]:[],...n?[n]:[]),t.add("rules",s),o&&a&&t.add("acts",...m(e,o).filter(([,l])=>Object.values(l.sets??{}).includes(a)).map(([l])=>l)),t.say(o&&n?`${p(e,o)} compared within each ${w(e,n)}, one ${a??"chosen"}.`:o?`${p(e,o)} compared, one ${a??"chosen"}.`:`One ${a??"chosen"} per ${w(e,n)}.`)}}};function E(e){let t=[];for(let s of k){let r=new G;ee[s](e,r),r.any()&&t.push(r.asTrait(s))}return t}function L(e,t){let s=new G;return ee[t](e,s),s.any()}var Oe=e=>Math.round(Math.max(0,Math.min(1,e))*100)/100;function q(e){return e?.type==="noul"&&Number.isFinite(e.noul)?Oe(e.noul):void 0}var Re={add:.7,drop:.7},Fe="propose_change";function Me(e){return M(e)}var De=e=>e.toLowerCase(),Te=e=>e.charAt(0).toUpperCase()+e.slice(1),O=(e,t="and")=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`,Se=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").toLowerCase(),T=(e,t)=>{let s=e.kinds[t];return De(s?.plural??(s?.noun?`${s.noun}s`:`${Se(t)}s`))},xe=e=>k.includes(e),se=(e,t)=>k.indexOf(e)-k.indexOf(t);function je(e){let t=E(e),s=new Set(t.map(r=>r.trait));return{name:e.name,keeps:Object.keys(e.kinds).map(r=>T(e,r)),"made of":t.map(r=>r.said),lacks:k.filter(r=>!s.has(r)).map(r=>y[r])}}function Ne(e,t){let s=new Set(E(t).map(n=>n.trait)),r={};for(let n of k)s.has(n)||(r[`need:${n}`]={type:"noul",instructions:`Does what they asked for need ${y[n]}, which ${t.name} has no part for yet?`,criteria:{true:`It needs ${y[n]}: they asked for it, or what they asked for cannot be kept without it.`,false:"Not asked for, and not needed to keep what they asked for."}});for(let n of Object.keys(t.kinds)){let d=T(t,n);r[`drop:kind:${n}`]={type:"noul",instructions:`Did they ask ${t.name} to stop keeping ${d}?`,criteria:{true:`They said the ${d} go: to drop them, remove them or stop tracking them.`,false:`${Te(d)} stay: nothing they said asks for them to go.`}}}for(let n of k)s.has(n)&&(r[`drop:trait:${n}`]={type:"noul",instructions:`Did they ask ${t.name} to stop having ${y[n]}?`,criteria:{true:`They said it goes: to drop or stop ${y[n]}.`,false:"It stays: nothing they said asks for it to go."}});return{state:{said:e,app:je(t)},questions:r}}var te=/^drop:(kind|trait):(.+)$/s;function Ae(e,t={}){let s={...Re,...t},r=Object.keys(e);if(r.length===0)throw new Error("readReshape was handed no answers.");let n=r.filter(o=>!/^need:/.test(o)&&!te.test(o));if(n.length>0)throw new Error(`readReshape does not know the question ${n.map(o=>`"${o}"`).join(", ")}: it reads need:<trait>, drop:kind:<name> and drop:trait:<name>.`);let d={},i={};for(let[o,a]of Object.entries(e)){let l=te.exec(o);if(l){i[`${l[1]}:${l[2]}`]=q(a)??0;continue}let h=o.slice(5);xe(h)&&(d[h]=q(a)??0)}return{add:Object.keys(d).filter(o=>d[o]>=s.add).sort(se),drop:Object.entries(i).filter(([,o])=>o>=s.drop).map(([o])=>o.slice(o.indexOf(":")+1)),needs:d,drops:i}}function Ge(e){let{said:t,document:s}=e,r=[...new Set(e.add)].sort(se),n=[...new Set(e.drop)],d=E(s),i=r.filter(c=>!L(s,c)).map(c=>({what:"trait",name:c,words:y[c],brings:J[c]})),o=r.filter(c=>L(s,c)),a=Object.keys(s.kinds).filter(c=>n.includes(c)),l=d.filter(c=>n.includes(c.trait)&&!Object.hasOwn(s.kinds,c.trait)),h=[...a.map(c=>({what:"kind",name:c,words:T(s,c)})),...l.map(c=>({what:"trait",name:c.trait,words:y[c.trait]}))],C=Object.keys(s.kinds).filter(c=>!a.includes(c)).map(c=>({what:"kind",name:c,words:T(s,c)})),ne=[...a.map(c=>`All ${T(s,c)} records go, with their links.`),...l.flatMap(c=>{let F=[...c.fields,...c.relations];return F.length>0?[`What carries ${y[c.trait]} goes: ${O(F)}, with its values and links.`]:[]})],S=[];i.length>0&&S.push(`adds ${O(i.map(c=>c.words))}`),h.length>0&&S.push(`drops ${O(h.map(c=>c.words))}`),C.length>0&&S.push(`keeps ${O(C.map(c=>c.words))}`);let re=i.length+h.length===0?`Nothing in ${s.name} changes for that.`:`This ${O(S)}.`,ie=o.length>0?` ${s.name} already has ${O(o.map(c=>y[c]))}.`:"";return{said:t,add:i.map(c=>c.name),drop:h.map(c=>c.name),card:{said:`${re}${ie}`,adds:i,keeps:C,drops:h,breaking:ne}}}async function Ue(e){let{state:t,questions:s}=Ne(e.said,e.document),{answers:r,usage:n}=await e.decide(t,s),d=Ae(r,e.thresholds??{}),i=d.add.length+d.drop.length===0?null:Ge({said:e.said,document:e.document,add:d.add,drop:d.drop});return{proposal:i&&i.add.length+i.drop.length===0?null:i,reading:d,answers:r,usage:n}}export{Fe as a,Me as b,Ne as c,Ae as d,Ge as e,Ue as f};
|
|
1
|
+
import{c as M}from"./chunk.O32F6LGK.js";import{ga as b}from"./chunk.6AANHELP.js";var k=["owners","status","schedule","budget","places","sources","stock","votes","private","history","publishing","roster","routines","comparison"],y={owners:"people who own things",status:"a status that moves",schedule:"dates it is due by, or a schedule",budget:"money against a budget",places:"places",sources:"sources behind claims",stock:"counts in stock",votes:"votes or picks",private:"private to its owner",history:"a history, a record book",publishing:"content to publish",roster:"a roster of people",routines:"repeating routines",comparison:"a comparison to pick one from"},J={owners:"a person kind (or the people the app has), an owner link, Give it to someone, a rule that every one has somebody on it, and Who has what",status:"a status with named steps (or the one the app has), an act for each step, and a board",schedule:"a due date, Set the date, the on-time rule, and a calendar",budget:"a cost beside the money the app keeps, a budget on the kind it is grouped under, Set the budget, and the over-budget rule",places:"a place kind, a link to one, and a map of where things are",sources:"a source kind, a link from each claim to its source, and the rule that a claim names one",stock:"what is on hand and the reorder level, Count the stock, and the running-low rule",votes:"a vote on each, Vote for it, and a tally",private:"a sight that keeps each person's own records to them",history:"the record book: an era or season each belongs to, and a timeline",publishing:"a published status, Publish it, and what the public sees",roster:"a person kind with the fields a roster keeps, and the list of who is here",routines:"how often each repeats and when it was last done, Mark it done, and the overdue rule",comparison:"a side-by-side of the candidates, one chosen, and Choose it"},U=new Set(["person","people","member","user","player","guest","candidate","participant","traveler","volunteer","interviewer","interviewee","contact","trade","staff","student","employee","teammate","crew","attendee","friend","customer","client","driver","speaker","host","teacher","parent","kid","child","coach","patient","tenant","resident","neighbor","applicant","recruit","contributor","assignee","worker","collaborator","runner"]),K=new Set(["place","venue","location","room","site","building","store","warehouse","city","country","region","address","hall","stadium","office","shelf"]),z=new Set(["source","reference","citation","evidence"]),H=new Set(["season","era","period","epoch","edition","generation","age","campaign","tournament"]),ae=/owner|owned|assign|^lead$|responsible|^by$|^by-|done-?by|interviewer|reviewer|maker|author|keeper|givenby|^for-?person$/i,oe=/due|deadline|until|needed|needby|target|expires|^ends?(on|at)?$|^by$/i,de=/^(date|day|when|at|start|starts|startsat|startson|startdate|scheduled|scheduledfor|scheduledon|happens|happenson|held|heldon|from|time|exchangedate|.*date|.*day)$/i,le=/released|fixed|published|applied|checked|created|added|done|last|first|updated|seen|born|birth|founded|finished|completed|closed/i,X=/status|stage|state|phase|progress/i,W=/budget|limit|cap$|allowance/i,ce=/budget|cost|price|quote|amount|salary|fee|spend|total|paid|owed/i,pe=/^(place|location|venue|address|where|city|town)$/i,B=/reorder|onhand|instock|^stock|quantity|^qty/i,he=/^votes?$|votecount|upvotes|^score$|^points$/i,fe=/^(votes?|votesfor|votedby|voters|picks?|chooses|choices|favorites|likes)$/i,ue=/often|frequency|cadence|^every$|repeat|interval/i,ge=/^last/i,Q=/^(published|live|public)$/i,ye=/count\(.*\bwhere\b.*\)\s*<=\s*1\b/,u=e=>e.toLowerCase(),w=(e,t)=>u(e.kinds[t]?.noun??b(t)),$=(e,t)=>u(e.kinds[t]?.plural??`${w(e,t)}s`),me=e=>e.charAt(0).toUpperCase()+e.slice(1),p=(e,t)=>me($(e,t)),we=e=>/^[aeiou]/i.test(e)?"an":"a",x=(e,t="and")=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`,N=e=>new Set((e??"").split(/[^A-Za-z0-9_-]+/).filter(Boolean)),v=e=>Object.entries(e.kinds),m=(e,t)=>Object.entries(e.acts??{}).filter(([,s])=>[s.on??[]].flat().includes(t)),_=e=>Array.isArray(e.lenses)?e.lenses:[],I=e=>typeof e.title=="string"?e.title:void 0,A=e=>e.bindings&&typeof e.bindings=="object"?e.bindings:{},R=(e,t)=>Array.isArray(t)&&t.length===1&&typeof t[0]=="string"&&e.kinds[t[0]]?t[0]:void 0;function V(e,t){let s=e.kinds[t];if(!s)return!1;let r=n=>u(n).replace(/ll/g,"l");return s.people===!0||U.has(r(t))||U.has(r(w(e,t)))}var Y=(e,t)=>K.has(u(t))||K.has(w(e,t)),ke=(e,t)=>z.has(u(t))||z.has(w(e,t)),be=(e,t)=>H.has(u(t))||H.has(w(e,t)),$e=(e,t)=>(t.type==="number"||t.type==="integer")&&(t.format==="money"||ce.test(e)),j=e=>e.type==="date"||e.type==="datetime";function P(e,t,s,r,n){return _(e).filter(d=>d.name===t&&A(d)[s]?.[r]===n).map(I).filter(d=>d!==void 0)}function D(e,t,s,r){return _(e).filter(n=>n.name==="coverage"&&A(n)[s]?.kind===t&&(r===void 0||A(n).link?.edge===r)).map(I).filter(n=>n!==void 0)}function f(e,t,s){let r=new Set(t);return Object.entries(e.rules??{}).filter(([,n])=>(s===void 0||n.over==="graph"||s.includes(n.over))&&[...N(`${n.when??""} ${n.require??""} ${n.says??""}`)].some(d=>r.has(d))).map(([n])=>n)}var G=class{kinds=new Set;fields=new Set;relations=new Set;rules=new Set;lenses=new Set;acts=new Set;said;add=(t,...s)=>{for(let r of s)this[t].add(r)};say=t=>{this.said??=t};any=()=>this.kinds.size+this.fields.size+this.relations.size+this.rules.size+this.lenses.size+this.acts.size>0;asTrait=t=>({trait:t,words:y[t],said:this.said??y[t],kinds:[...this.kinds],fields:[...this.fields],relations:[...this.relations],rules:[...this.rules],lenses:[...this.lenses],acts:[...this.acts]})};function ve(e){let t;for(let[s,r]of v(e)){let n=Object.keys(r.fields).length+Object.keys(r.edges??{}).length;(!t||n>t.fields)&&(t={kind:s,fields:n})}return t?.kind}function g(e){let t=ve(e);return v(e).sort(([s],[r])=>+(r===t)-+(s===t))}function Z(e,t){let s=e.kinds[t];if(!s)return[];let r=[];for(let[n,d]of Object.entries(s.fields)){if(d.type!=="enum"||!Array.isArray(d.options)||d.options.length<2)continue;let i=m(e,t).filter(([,a])=>typeof a.sets?.[n]=="string"&&d.options.includes(a.sets[n])).map(([a])=>a);((X.test(n)||s.lifecycle?.field===n)&&i.length>=1||i.length>=2)&&r.push({field:n,options:d.options,steps:i})}return r}var ee={owners(e,t){for(let[s,r]of g(e))for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);d.cardinality!=="one"||!i||!V(e,i)||!ae.test(n)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n],[s,i])),t.add("lenses",...D(e,s,"rows",n)),t.add("acts",...m(e,s).filter(([,o])=>o.connects===n||o.severs===n).map(([o])=>o)),t.say(`Each ${w(e,s)} has one of the ${$(e,i)} on it (${n}).`))}},status(e,t){for(let[s]of g(e))for(let{field:r,options:n,steps:d}of Z(e,s))t.add("kinds",s),t.add("fields",`${s}.${r}`),t.add("acts",...d),t.add("rules",...f(e,[r],[s])),t.add("lenses",...P(e,"columns",s,"column",r)),t.say(`${p(e,s)} move through ${x(n.map(u))}.`)},schedule(e,t){for(let[s,r]of g(e))for(let[n,d]of Object.entries(r.fields)){if(!j(d)||le.test(n))continue;let i=P(e,"calendar",s,"start",n),o=oe.test(n);if(!o&&!de.test(n)&&i.length===0)continue;t.add("kinds",s),t.add("fields",`${s}.${n}`),t.add("lenses",...i),t.add("rules",...f(e,[n],[s])),t.add("acts",...m(e,s).filter(([,l])=>(l.writes??[]).includes(n)||l.sets?.[n]!==void 0).map(([l])=>l));let a=/date|day|when|time/i.test(n)?u(b(n)):`date (${n})`;t.say(o?`${p(e,s)} are due by a date (${n}).`:`${p(e,s)} have ${we(a)} ${a}${i.length>0?", on a calendar":""}.`)}},budget(e,t){let s=v(e).flatMap(([o,a])=>Object.entries(a.fields).filter(([l,h])=>(h.type==="number"||h.type==="integer")&&W.test(l)).map(([l])=>({kind:o,name:l})));if(s.length===0)return;let r=g(e).flatMap(([o,a])=>Object.entries(a.fields).filter(([l,h])=>$e(l,h)&&!W.test(l)).map(([l])=>({kind:o,name:l})));if(r.length===0)return;let n=[...s,...r].map(o=>o.name);for(let o of[...s,...r])t.add("kinds",o.kind),t.add("fields",`${o.kind}.${o.name}`),t.add("acts",...m(e,o.kind).filter(([,a])=>(a.writes??[]).includes(o.name)||a.sets?.[o.name]!==void 0).map(([a])=>a));t.add("rules",...f(e,n).filter(o=>s.some(a=>N(e.rules[o].require??"").has(a.name))));let d=r[0],i=s.find(o=>o.kind===d.kind)??s[0];t.say(`${p(e,d.kind)}' ${u(b(d.name))} against ${i.kind===d.kind?"each one's":`each ${w(e,i.kind)}'s`} ${u(b(i.name))}.`)},places(e,t){for(let[s,r]of g(e)){Y(e,s)&&(t.add("kinds",s),t.add("lenses",...D(e,s,"columns")));for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);!i||!Y(e,i)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n],[s,i])),t.say(`${p(e,s)} are at ${$(e,i)} (${n}).`))}for(let[n,d]of Object.entries(r.fields))d.type!=="place"&&!(d.type==="string"&&pe.test(n))||(t.add("kinds",s),t.add("fields",`${s}.${n}`),t.say(`${p(e,s)} say where (${n}).`))}t.any()&&!t.said&&t.say(`${x([...t.kinds].map(s=>p(e,s)))} are places.`)},sources(e,t){for(let[s,r]of g(e)){for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);!i||!ke(e,i)&&!/^cite/i.test(n)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n,i],[s,i])),t.add("acts",...m(e,s).filter(([,o])=>o.connects===n||o.severs===n).map(([o])=>o)),t.say(`${p(e,s)} cite ${$(e,i)} (${n}).`))}for(let[n,d]of Object.entries(r.fields))d.type!=="url"||!/^source/i.test(n)||(t.add("kinds",s),t.add("fields",`${s}.${n}`),t.add("rules",...f(e,[n],[s])),t.say(`${p(e,s)} link to their source (${n}).`))}},stock(e,t){for(let[s,r]of g(e)){let n=Object.entries(r.fields).filter(([a,l])=>(l.type==="number"||l.type==="integer")&&B.test(a)).map(([a])=>a),d=Object.keys(r.computed??{}).filter(a=>B.test(a)),i=n.some(a=>/reorder/i.test(a)),o=v(e).some(([,a])=>Object.entries(a.fields).some(([l,h])=>/^(change|delta|moved)$/i.test(l)&&(h.type==="number"||h.type==="integer")));!i&&!(d.length+n.length>0&&o)||(t.add("kinds",s),t.add("fields",...n.map(a=>`${s}.${a}`),...d.map(a=>`${s}.${a}`)),t.add("rules",...f(e,[...n,...d],[s])),t.add("acts",...m(e,s).filter(([,a])=>n.some(l=>(a.writes??[]).includes(l)||a.sets?.[l]!==void 0)).map(([a])=>a)),t.say(`${p(e,s)} have a count in stock${i?" and a reorder point":""}.`))}},votes(e,t){for(let[s,r]of g(e)){for(let[n,d]of Object.entries(r.fields)){if(d.type!=="number"&&d.type!=="integer"||!he.test(n))continue;let i=m(e,s).filter(([,o])=>o.sets?.[n]!==void 0).map(([o])=>o);i.length!==0&&(t.add("kinds",s),t.add("fields",`${s}.${n}`),t.add("acts",...i),t.add("rules",...f(e,[n],[s])),t.say(`${p(e,s)} collect votes (${n}).`))}for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);!i||!fe.test(n)||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n],[s,i])),t.add("acts",...m(e,s).filter(([,o])=>o.connects===n||o.severs===n).map(([o])=>o)),t.say(`${p(e,s)} pick ${$(e,i)} (${n}).`))}}},private(e,t){let s=[];for(let r of e.policy?.sees??[])if(!(!r.own&&!r.via)){for(let n of r.kinds)if(e.kinds[n]&&(t.add("kinds",n),s.includes(n)||s.push(n),r.via))for(let[d,i]of v(e))i.edges?.[r.via]&&t.add("relations",`${d}.${r.via}`)}s.length>0&&t.say(`${x(s.map(r=>p(e,r)))} are seen only by whose they are.`)},history(e,t){for(let[s,r]of g(e))for(let[n,d]of Object.entries(r.edges??{})){let i=R(e,d.to);d.cardinality!=="one"||!i||!be(e,i)||!Object.entries(r.fields).some(([a,l])=>j(l)||/year|result|outcome|score|finish/i.test(a))||(t.add("kinds",s,i),t.add("relations",`${s}.${n}`),t.add("rules",...f(e,[n,i],[s,i])),t.add("lenses",...D(e,s,"rows",n),..._(e).filter(a=>a.name==="timeline"&&A(a)[s]!==void 0).map(I).filter(a=>a!==void 0)),t.say(`${p(e,s)} grouped into ${$(e,i)}, a record book.`))}},publishing(e,t){for(let[s,r]of g(e)){let n=Object.entries(r.fields).filter(([,i])=>i.type==="text").map(([i])=>i);if(n.length===0)continue;let d=Z(e,s).map(i=>i.field);for(let[i,o]of Object.entries(r.fields)){if(o.type!=="enum"||!(X.test(i)||d.includes(i))||!(o.options??[]).some(l=>Q.test(l)))continue;let a=(o.options??[]).find(l=>Q.test(l));t.add("kinds",s),t.add("fields",`${s}.${i}`,...n.map(l=>`${s}.${l}`)),t.add("acts",...m(e,s).filter(([,l])=>l.sets?.[i]===a).map(([l])=>l)),t.add("rules",...f(e,[i,...n],[s]).filter(l=>N(`${e.rules[l].when??""} ${e.rules[l].require??""}`).has(a)||n.some(h=>N(e.rules[l].require??"").has(h)))),t.say(`${p(e,s)} go from ${u(o.options[0])} to ${u(a)}, with their words.`)}}},roster(e,t){for(let[s,r]of g(e)){if(!V(e,s))continue;let n=Object.keys(r.fields);n.length<2||(t.add("kinds",s),t.add("fields",...n.map(d=>`${s}.${d}`)),t.add("lenses",...D(e,s,"columns"),...D(e,s,"rows")),t.say(`${p(e,s)}, with ${x(n.slice(1).map(d=>u(b(d))))}.`))}},routines(e,t){for(let[s,r]of g(e)){let n=Object.entries(r.fields).filter(([,a])=>j(a)&&a.repeats===!0).map(([a])=>a),d=Object.entries(r.fields).filter(([a,l])=>(l.type==="enum"||l.type==="string"||l.type==="integer"||l.type==="number")&&ue.test(a)).map(([a])=>a),i=Object.entries(r.fields).filter(([a,l])=>j(l)&&ge.test(a)).map(([a])=>a);if(n.length===0&&!(d.length>0&&i.length>0))continue;let o=[...n,...d,...i];t.add("kinds",s),t.add("fields",...o.map(a=>`${s}.${a}`)),t.add("rules",...f(e,o,[s])),t.add("lenses",...o.flatMap(a=>P(e,"calendar",s,"start",a))),t.add("acts",...m(e,s).filter(([,a])=>o.some(l=>(a.writes??[]).includes(l)||a.sets?.[l]!==void 0)).map(([a])=>a)),t.say(n.length>0?`${p(e,s)} repeat (${n[0]}).`:`${p(e,s)} come round again, each with when it was last done.`)}},comparison(e,t){for(let[s,r]of Object.entries(e.rules??{})){if(!r.require||!ye.test(r.require))continue;let n=r.over==="graph"?void 0:r.over,d=/in\('([^']+)'\)/.exec(r.require)?.[1],i=/all\('([^']+)'/.exec(r.require)?.[1],o=n?d?v(e).find(([,l])=>l.edges?.[d])?.[0]:void 0:i&&e.kinds[i]?i:void 0;if(!o&&!n)continue;let a=/==\s*'([^']+)'/.exec(r.require)?.[1];t.add("kinds",...o?[o]:[],...n?[n]:[]),t.add("rules",s),o&&a&&t.add("acts",...m(e,o).filter(([,l])=>Object.values(l.sets??{}).includes(a)).map(([l])=>l)),t.say(o&&n?`${p(e,o)} compared within each ${w(e,n)}, one ${a??"chosen"}.`:o?`${p(e,o)} compared, one ${a??"chosen"}.`:`One ${a??"chosen"} per ${w(e,n)}.`)}}};function E(e){let t=[];for(let s of k){let r=new G;ee[s](e,r),r.any()&&t.push(r.asTrait(s))}return t}function L(e,t){let s=new G;return ee[t](e,s),s.any()}var Oe=e=>Math.round(Math.max(0,Math.min(1,e))*100)/100;function q(e){return e?.type==="noul"&&Number.isFinite(e.noul)?Oe(e.noul):void 0}var Re={add:.7,drop:.7},Fe="propose_change";function Me(e){return M(e)}var De=e=>e.toLowerCase(),Te=e=>e.charAt(0).toUpperCase()+e.slice(1),O=(e,t="and")=>e.length<2?e.join(""):`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`,Se=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[-_]+/g," ").toLowerCase(),T=(e,t)=>{let s=e.kinds[t];return De(s?.plural??(s?.noun?`${s.noun}s`:`${Se(t)}s`))},xe=e=>k.includes(e),se=(e,t)=>k.indexOf(e)-k.indexOf(t);function je(e){let t=E(e),s=new Set(t.map(r=>r.trait));return{name:e.name,keeps:Object.keys(e.kinds).map(r=>T(e,r)),"made of":t.map(r=>r.said),lacks:k.filter(r=>!s.has(r)).map(r=>y[r])}}function Ne(e,t){let s=new Set(E(t).map(n=>n.trait)),r={};for(let n of k)s.has(n)||(r[`need:${n}`]={type:"noul",instructions:`Does what they asked for need ${y[n]}, which ${t.name} has no part for yet?`,criteria:{true:`It needs ${y[n]}: they asked for it, or what they asked for cannot be kept without it.`,false:"Not asked for, and not needed to keep what they asked for."}});for(let n of Object.keys(t.kinds)){let d=T(t,n);r[`drop:kind:${n}`]={type:"noul",instructions:`Did they ask ${t.name} to stop keeping ${d}?`,criteria:{true:`They said the ${d} go: to drop them, remove them or stop tracking them.`,false:`${Te(d)} stay: nothing they said asks for them to go.`}}}for(let n of k)s.has(n)&&(r[`drop:trait:${n}`]={type:"noul",instructions:`Did they ask ${t.name} to stop having ${y[n]}?`,criteria:{true:`They said it goes: to drop or stop ${y[n]}.`,false:"It stays: nothing they said asks for it to go."}});return{state:{said:e,app:je(t)},questions:r}}var te=/^drop:(kind|trait):(.+)$/s;function Ae(e,t={}){let s={...Re,...t},r=Object.keys(e);if(r.length===0)throw new Error("readReshape was handed no answers.");let n=r.filter(o=>!/^need:/.test(o)&&!te.test(o));if(n.length>0)throw new Error(`readReshape does not know the question ${n.map(o=>`"${o}"`).join(", ")}: it reads need:<trait>, drop:kind:<name> and drop:trait:<name>.`);let d={},i={};for(let[o,a]of Object.entries(e)){let l=te.exec(o);if(l){i[`${l[1]}:${l[2]}`]=q(a)??0;continue}let h=o.slice(5);xe(h)&&(d[h]=q(a)??0)}return{add:Object.keys(d).filter(o=>d[o]>=s.add).sort(se),drop:Object.entries(i).filter(([,o])=>o>=s.drop).map(([o])=>o.slice(o.indexOf(":")+1)),needs:d,drops:i}}function Ge(e){let{said:t,document:s}=e,r=[...new Set(e.add)].sort(se),n=[...new Set(e.drop)],d=E(s),i=r.filter(c=>!L(s,c)).map(c=>({what:"trait",name:c,words:y[c],brings:J[c]})),o=r.filter(c=>L(s,c)),a=Object.keys(s.kinds).filter(c=>n.includes(c)),l=d.filter(c=>n.includes(c.trait)&&!Object.hasOwn(s.kinds,c.trait)),h=[...a.map(c=>({what:"kind",name:c,words:T(s,c)})),...l.map(c=>({what:"trait",name:c.trait,words:y[c.trait]}))],C=Object.keys(s.kinds).filter(c=>!a.includes(c)).map(c=>({what:"kind",name:c,words:T(s,c)})),ne=[...a.map(c=>`All ${T(s,c)} records go, with their links.`),...l.flatMap(c=>{let F=[...c.fields,...c.relations];return F.length>0?[`What carries ${y[c.trait]} goes: ${O(F)}, with its values and links.`]:[]})],S=[];i.length>0&&S.push(`adds ${O(i.map(c=>c.words))}`),h.length>0&&S.push(`drops ${O(h.map(c=>c.words))}`),C.length>0&&S.push(`keeps ${O(C.map(c=>c.words))}`);let re=i.length+h.length===0?`Nothing in ${s.name} changes for that.`:`This ${O(S)}.`,ie=o.length>0?` ${s.name} already has ${O(o.map(c=>y[c]))}.`:"";return{said:t,add:i.map(c=>c.name),drop:h.map(c=>c.name),card:{said:`${re}${ie}`,adds:i,keeps:C,drops:h,breaking:ne}}}async function Ue(e){let{state:t,questions:s}=Ne(e.said,e.document),{answers:r,usage:n}=await e.decide(t,s),d=Ae(r,e.thresholds??{}),i=d.add.length+d.drop.length===0?null:Ge({said:e.said,document:e.document,add:d.add,drop:d.drop});return{proposal:i&&i.add.length+i.drop.length===0?null:i,reading:d,answers:r,usage:n}}export{Fe as a,Me as b,Ne as c,Ae as d,Ge as e,Ue as f};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./chunk.MIE4TJRW.js";import{o as P}from"./chunk.
|
|
1
|
+
import"./chunk.MIE4TJRW.js";import{o as P}from"./chunk.CFE3MHWZ.js";import"./chunk.RD2FSSLV.js";import"./chunk.HXTKBISQ.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as A,W as S,fa as b}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{Ja as w,sd as x,wa as L}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as R}from"./chunk.AJZBJBMO.js";var u=R(A(),1);var n=R(S(),1),C={kind:"human"},p={color:"var(--graview-ink-muted)"};function I(e){if(e){if(/^https?:\/\//i.test(e))try{return new URL(e).href}catch{return}return L(e)?e:void 0}}function z(e){let o=b(),t=o?.linkedReads,[i,a]=(0,u.useState)(()=>t?t.answered(e)??"asking":null);return(0,u.useEffect)(()=>{if(!t){a(o?.linkedRecords?"asking":null);return}let d=t.answered(e);if(a(d===void 0?"asking":d),d!==void 0)return;let s=!0;return t.ask(e).then(l=>s&&a(l)),()=>{s=!1}},[t,o?.linkedRecords,e.address,e.kind,e.id]),i}function V({reference:e,as:o}){let t=b(),i=z(e),a={position:"relative",zIndex:x.raised,overflowWrap:"anywhere",minWidth:0,maxWidth:"100%"};if(i==="asking")return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"asking","aria-busy":"true",style:{...p,...a},children:"Linked record"});if(i&&"denied"in i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"denied",style:{...p,fontStyle:"italic",...a},children:"linked record (no access)"});if(!i)return(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"missing",style:{...p,fontStyle:"italic",...a},children:"linked record (not found)"});let d=I(i.href),s=t?.linkedRecords,l=t?.principal??C,g=s?.open?c=>{c.metaKey||c.ctrlKey||(c.preventDefault(),s.open(e,l))}:void 0,k=(0,n.jsx)("a",{"data-graview-linked-title":"",...d?{href:d}:{role:"link",tabIndex:0},...g?{onClick:g,onKeyDown:c=>!d&&(c.key==="Enter"||c.key===" ")?g(c):void 0}:{},style:{fontWeight:600,color:"inherit",textUnderlineOffset:3,cursor:d||g?"pointer":"default"},children:i.label});return o==="chip"?(0,n.jsx)("span",{"data-graview-linked":"","data-graview-linked-state":"found",title:i.describe,style:{display:"inline-flex",alignItems:"center",minHeight:24,...a},children:k}):(0,n.jsx)(D,{record:i,title:k,base:a})}function D({record:e,title:o,base:t}){return(0,n.jsxs)("span",{"data-graview-linked":"","data-graview-linked-state":"found",style:{display:"grid",gap:2,padding:"8px 10px",border:"1px solid var(--graview-line)",borderRadius:"var(--graview-radius-sm, 6px)",background:"var(--graview-surface)",...t},children:[(0,n.jsxs)("span",{style:{display:"flex",flexWrap:"wrap",alignItems:"baseline",gap:"2px 8px"},children:[o,e.app?(0,n.jsxs)("span",{"data-graview-linked-app":"",style:{...p,fontSize:"0.75rem"},children:["in ",e.app]}):null]}),e.describe?(0,n.jsx)("span",{"data-graview-linked-describe":"",style:{...p,fontSize:"0.8125rem"},children:e.describe}):null,e.card&&e.card.length>0?(0,n.jsx)("span",{"data-graview-linked-card":"",style:{display:"flex",flexWrap:"wrap",gap:"2px 12px",fontSize:"0.8125rem"},children:e.card.map(i=>(0,n.jsxs)("span",{children:[(0,n.jsx)("span",{style:p,children:i.label})," ",i.text]},i.label))}):null]})}function H({relation:e,refs:o,as:t="record",nodeId:i,field:a,style:d}){let s=(0,n.jsx)("span",{"data-graview-linked-list":"",style:{display:"grid",gap:6,minWidth:0,...d},children:o.map(l=>(0,n.jsx)(V,{reference:l,as:t},w(l)))});return i&&a?(0,n.jsx)(K,{nodeId:i,field:a,relation:e,refs:o,drawn:s}):s}function K({nodeId:e,field:o,relation:t,refs:i,drawn:a}){let{fields:d,commit:s}=P(e),l=d.find(f=>f.field===o),[g,k]=(0,u.useState)(!1);if(!l)return a;let c=t.cardinality==="one"?i[0]?w(i[0]):void 0:i.map(w);return(0,n.jsxs)("span",{style:{display:"grid",gap:6,minWidth:0},children:[a,g?(0,n.jsx)(N,{relation:t,value:c,label:"Link another record",onChange:f=>{s(l,f),k(!1)},onCancel:()=>k(!1)}):(0,n.jsx)("button",{type:"button","data-graview-linked-change":"",onClick:()=>k(!0),style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-accent)",cursor:"pointer",minHeight:24},children:"Change"})]})}function N({relation:e,value:o,onChange:t,onCancel:i,label:a}){let d=b(),s=d?.linkedRecords,l=d?.principal??C,g=(0,u.useId)(),[k,c]=(0,u.useState)(""),[f,m]=(0,u.useState)("asking");(0,u.useEffect)(()=>{if(!s)return;let r=!0;m("asking");let y=setTimeout(()=>{Promise.resolve().then(()=>s.find({address:e.address,kinds:e.kinds,query:k,limit:20},l)).then(h=>r&&m(Array.isArray(h)?h:"denied"),()=>r&&m([]))},150);return()=>{r=!1,clearTimeout(y)}},[s,e.address,e.kinds.join(","),k,l.kind,l.id]);let v=new Set([o].flat().filter(r=>typeof r=="string")),W=r=>{let y=w(r);if(e.cardinality==="one")return t(y);t(v.has(y)?[...v].filter(h=>h!==y):[...v,y])};return s?(0,n.jsxs)("span",{"data-graview-linked-picker":"",style:{display:"grid",gap:6,minWidth:0},children:[(0,n.jsx)("label",{htmlFor:g,style:{...p,fontSize:"0.8125rem"},children:a}),(0,n.jsx)("input",{id:g,type:"search",value:k,placeholder:`Find one in ${e.address}`,onChange:r=>c(r.target.value),style:{font:"inherit",minHeight:32,padding:"4px 8px",border:"1px solid var(--graview-line)",borderRadius:6,background:"var(--graview-surface)",color:"inherit",minWidth:0}}),f==="asking"?(0,n.jsx)("span",{"aria-busy":"true",style:p,children:"Looking\u2026"}):f==="denied"?(0,n.jsx)("span",{"data-graview-linked-state":"denied",style:{...p,fontStyle:"italic"},children:"linked record (no access)"}):f.length===0?(0,n.jsx)("span",{style:p,children:"Nothing there matches."}):(0,n.jsx)("ul",{role:"list",style:{listStyle:"none",margin:0,padding:0,display:"grid",gap:4},children:f.map(r=>{let y=v.has(w(r));return(0,n.jsx)("li",{children:(0,n.jsxs)("button",{type:"button","data-graview-linked-candidate":w(r),"aria-pressed":y,onClick:()=>W(r),style:{display:"grid",gap:2,width:"100%",textAlign:"start",font:"inherit",padding:"6px 8px",minHeight:32,border:"1px solid var(--graview-line)",borderRadius:6,background:y?"var(--graview-accent-soft, var(--graview-surface))":"var(--graview-surface)",color:"inherit",cursor:"pointer"},children:[(0,n.jsx)("span",{style:{fontWeight:600},children:r.label}),r.describe?(0,n.jsx)("span",{style:{...p,fontSize:"0.8125rem"},children:r.describe}):null]})},w(r))})}),i?(0,n.jsx)("button",{type:"button",onClick:i,style:{justifySelf:"start",font:"inherit",fontSize:"0.8125rem",background:"none",border:0,padding:"4px 0",color:"var(--graview-ink-muted)",cursor:"pointer",minHeight:24},children:"Keep it as it is"}):null]}):(0,n.jsxs)("span",{"data-graview-linked-picker":"","data-graview-linked-state":"no-host",style:p,children:["This page cannot read ",e.address,", so nothing there can be linked here."]})}var T=e=>(0,n.jsx)(H,{...e}),U=e=>(0,n.jsx)(N,{...e});export{N as LinkedPicker,H as LinkedRecordView,U as drawLinkedPicker,T as drawLinkedRecord};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i as z,j as D,k as H}from"./chunk.
|
|
1
|
+
import{i as z,j as D,k as H}from"./chunk.7WPVLEX2.js";import{a as P,b as A,c as p,d as W}from"./chunk.Q355UPFG.js";import"./chunk.DGDW54KE.js";import"./chunk.YBQ5GVAX.js";import"./chunk.EB7PZJEO.js";import"./chunk.42KHFGN6.js";import"./chunk.RQG672MJ.js";import"./chunk.Q6H5HESF.js";import"./chunk.3JMQKANL.js";import"./chunk.42C3FIKK.js";import"./chunk.2ME4DVBI.js";import"./chunk.XXCHO2A5.js";import"./chunk.SADR3MQI.js";import{a as C,b as O}from"./chunk.MB7LKKUD.js";import"./chunk.ODYJEDIW.js";import"./chunk.IPGLITWA.js";import"./chunk.LFFJB6D3.js";import"./chunk.DMZRFXH7.js";import"./chunk.DZ6UDZOB.js";import"./chunk.O5FTWXA2.js";import"./chunk.Q4VFLLUT.js";import"./chunk.6ZENHSTQ.js";import"./chunk.WVUJXDXZ.js";import"./chunk.L7XKYGV7.js";import"./chunk.CE3NKAF7.js";import"./chunk.R3GE37OI.js";import"./chunk.2KCDLCB2.js";import"./chunk.UD7VLXPM.js";import"./chunk.3DEWQDP7.js";import"./chunk.MIE4TJRW.js";import"./chunk.CFE3MHWZ.js";import"./chunk.RD2FSSLV.js";import"./chunk.HXTKBISQ.js";import"./chunk.TFJA4QV4.js";import"./chunk.HWFJQ42Y.js";import"./chunk.QUETLFBJ.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.H3IGXHZR.js";import"./chunk.7TDML5YU.js";import{G as B,Va as k,W as L}from"./chunk.3VEZ5MOC.js";import"./chunk.SDO3U72B.js";import{td as R}from"./chunk.6AANHELP.js";import"./chunk.FQLNBIQ5.js";import{b as E}from"./chunk.AJZBJBMO.js";var r=E(B(),1);var s=E(L(),1);function M(c){let e=document.activeElement;if(e!==null&&e!==document.body&&e!==document.documentElement&&e.isConnected)return;let n=c??document,o=n.querySelector("main")??n.querySelector("[data-graview-page]")??null,t=n.querySelector("[data-graview-page-title]")??o?.querySelector("h1, h2")??o;t instanceof HTMLElement&&(t.hasAttribute("tabindex")||t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}))}var I=1500;function N(c,e,n){let{store:o,principal:t}=c,l=z(o),g=(0,r.useMemo)(()=>P(o,t),[o,t,l]),w=(0,r.useRef)(n),[b,d]=(0,r.useState)(),[y,u]=(0,r.useState)("");(0,r.useEffect)(()=>{let a=A(o,t,w.current);w.current=o.batches().length,a&&(d({batch:a.batch,at:e,when:Date.now()}),u(""))},[o,t,l]),(0,r.useEffect)(()=>{d(a=>!a||a.at===e?a:Date.now()-a.when<I?{...a,at:e}:void 0)},[e]);let[x,i]=(0,r.useState)(null),v=(0,r.useCallback)(()=>{d(void 0),i(null)},[]),f=(0,r.useCallback)(()=>{i(null);try{let a=W(o,t);a&&u(`Took back \u201C${a.intent}\u201D`)}catch(a){i(a instanceof Error?a.message:String(a))}},[o,t]),S=g&&b?.batch===g.batch&&b.at===e?g:void 0;return{change:g,offered:S,close:v,takeBack:f,refused:x,said:y}}function ee({context:c,docked:e,at:n,since:o,compact:t=!1,className:l,size:g}){let{change:w,offered:b,close:d,takeBack:y,refused:u,said:x}=N(c,n,o),i=e?b:w,v=(0,r.useRef)(null),f=e&&(i!==void 0||u!==null);j(v,f),(0,r.useEffect)(()=>{if(!f)return;let m,h=()=>m=setTimeout(()=>v.current?.matches(":hover, :focus-within")?h():d(),1e4);return h(),()=>clearTimeout(m)},[f,i?.batch,u,d]);let S=x||(e&&i?p(i):""),a=e?{position:"fixed",inset:"auto",margin:0,padding:0,border:"none",background:"none",overflow:"visible",zIndex:R("toast"),width:"max-content",height:"auto",bottom:"calc(16px + env(safe-area-inset-bottom, 0px))",left:16,justifyItems:"start",color:"var(--graview-ink)",...f?{}:{display:"none"}}:{},T=i?(0,s.jsxs)("button",{type:"button","data-testid":"page-undo",title:`${p(i)} \u2014 \u2318Z or Ctrl+Z`,"aria-keyshortcuts":"Meta+Z Control+Z",onClick:m=>{let h=m.currentTarget.closest("[data-graview-face]");y(),requestAnimationFrame(()=>M(h))},...e?{style:U}:{className:H("graview-undo",l),...D(g),...t?{"data-compact":"","aria-label":p(i)}:{}},children:[(0,s.jsx)("span",{"aria-hidden":"true",children:"\u21B6"}),e?(0,s.jsx)("span",{style:K,children:p(i)}):(0,s.jsx)("span",{className:"graview-undo-words",children:t?"Undo":p(i)})]}):null;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{role:"status","aria-live":"polite",style:V,children:S}),(0,s.jsxs)("div",{ref:v,...e?{popover:"manual","data-graview-foot":"","data-graview-offstage":""}:{},"data-testid":e?"face-undo-dock":"page-undo-place",...e?{style:{...F,...a}}:{className:"graview-undo-place"},children:[e?null:(0,s.jsx)("style",{children:q}),e&&i?(0,s.jsxs)("div",{"data-testid":"page-undo-notice",style:Z,children:[T,(0,s.jsx)("button",{type:"button","data-testid":"page-undo-dismiss","aria-label":`Dismiss: ${p(i)}`,title:"Dismiss",onClick:m=>{let h=m.currentTarget.closest("[data-graview-face]");d(),requestAnimationFrame(()=>M(h))},style:$,children:"\xD7"})]}):T,u?(0,s.jsx)("span",{"data-testid":"page-undo-refused",role:"alert",className:"graview-undo-refused",...e?{style:{fontSize:"0.8125rem",lineHeight:1.4,color:"var(--graview-warn)",borderRadius:6,background:"var(--graview-float)",padding:"4px 8px"}}:{},children:u}):null]})]})}function j(c,e){(0,r.useLayoutEffect)(()=>{let n=c.current;if(!n||!e)return;if(typeof n.showPopover=="function"&&!k(n))try{n.showPopover()}catch{}let o=()=>n.parentElement?.closest("[data-embed-content]")??null,t=()=>{O(n,o()),dispatchEvent(new Event(C))};t(),addEventListener("resize",t),addEventListener("scroll",t,!0);let l=typeof ResizeObserver=="function"?new ResizeObserver(t):null;return l?.observe(n),()=>{if(l?.disconnect(),removeEventListener("resize",t),removeEventListener("scroll",t,!0),n.isConnected&&k(n))try{n.hidePopover()}catch{}dispatchEvent(new Event(C))}},[c,e])}var q=`:where(.graview-undo-place){display:grid;justify-items:end;gap:4px;max-width:100%;min-width:0}
|
|
2
2
|
:where(.graview-undo){box-sizing:border-box;display:inline-flex;align-items:center;gap:6px;min-height:var(--graview-control-height,36px);max-width:min(100%,var(--graview-undo-widest,18rem));min-width:0;padding:0 14px;border-radius:999px;border:1px solid var(--graview-edge);background:var(--graview-float);color:var(--graview-ink);font:inherit;font-size:.875rem;cursor:pointer}
|
|
3
3
|
:where(.graview-undo[data-size=sm]){--graview-control-height:30px}
|
|
4
4
|
:where(.graview-undo[data-compact]){padding:0 10px}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{c as ae,d as se,f as oe,i as re,j as le,k as de,m as ce,n as ue,o as pe,p as ge,q as fe}from"./chunk.QFHWG4LN.js";import{b as Z,c as ee,d as te,e as ne}from"./chunk.YIPXZUTT.js";import{a as ie}from"./chunk.EMFOMSMI.js";import{a as Y}from"./chunk.PSQYDCVM.js";import{a as X,e as O}from"./chunk.U3HERHAI.js";import{E as K,G as Ie,J as Q,S as V,W as _,ea as j}from"./chunk.MODLZJD4.js";import{td as J}from"./chunk.6HY6ZGEE.js";import{b as N}from"./chunk.AJZBJBMO.js";var c=N(Ie(),1);var o=N(_(),1);function he(e,a,t){let i=a.on==="selection"?a.ids:a.on==="record"||a.on==="field"?[a.id]:[],l=i.length>0?ie(e.store,i,{principal:e.principal,...i.length===1?{focus:i[0]}:{}}).affordances.map(s=>({mutation:s.mutation,label:s.label,args:s.args,open:s.open,why:s.why,...s.destructive?{destructive:!0}:{}})):void 0;return{store:e.store,target:a,principal:e.principal,interaction:se(),places:e.places,selection:e.selection,...l?{acts:l}:{},...e.place?{place:e.place}:{},...t?{said:t}:{},...e.app.purpose?{purpose:e.app.purpose}:{}}}async function be(e,a,t){let i=await (__graviewPreload(import.meta.url,["./chunk.QWNSHISU.js","./chunk.G4JJXA63.js","./chunk.TBY5IR7C.js","./chunk.FIFUMX5X.js","./chunk.BIDL7GQD.js","./chunk.V7W5AQKL.js","./chunk.PPSYUOH7.js","./chunk.XOZU4OFA.js","./chunk.GME63ZHI.js","./chunk.Q5WEOX3Q.js","./chunk.4FCFNAA4.js","./chunk.4AC2QM7T.js","./chunk.JXNVNFV4.js","./chunk.WVUJXDXZ.js","./chunk.I2737CPF.js","./chunk.NJRLJEJY.js","./chunk.CVPMSPCH.js","./chunk.OTV5XTBB.js","./chunk.KBPJ7X7W.js","./chunk.OEIWIZCP.js","./chunk.WSDJPXJD.js","./chunk.F4VB6Q2W.js","./chunk.FFOD5B4B.js","./chunk.Z7Y3R3YR.js","./chunk.YXEO3Y65.js","./chunk.6HY6ZGEE.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.KF27ME27.js")),l=i.recipeDraft(a.recipe,{app:e.app,sight:i.draftSight(e.app,e.principal)});if(i.isDraftFailure(l))return l.failed;t?.(),e.seatTalk.setDraft(l,null),e.goTo.draft?.(),ke()}function ke(e=180){if(typeof document>"u")return;let a=document.querySelector('[data-testid="draft-keep"]'),t=document.activeElement,i=!t||t===document.body||t.closest?.("[inert]")!==null;if(a){i&&a.focus();return}e>0&&requestAnimationFrame(()=>ke(e-1))}async function T(e,a,t,i,l){let s=he(e,t,i),d=a==="suggest"?await oe(e.ai,s):a==="fill"?await re(e.ai,s):a==="record"?await le(e.ai,s):await de(e.ai,s);if(d.interaction.outcome==="failed")return a!=="suggest"&&e.desk.record(d.interaction),d;let u=g=>{let p={...d.interaction,outcome:"failed",failed:g};return e.desk.record(p),{...d,interaction:p}};if(a==="fill"||a==="record"){if(!d.ghost||d.ghost.proposals.length===0)return u("Nothing here could be filled in.");l?.(),e.desk.setGhost({ghost:d.ghost}),e.desk.record(d.interaction)}if(a==="panel"&&d.panel){let g=await be(e,d.panel,l);if(g)return u(g);e.desk.record(d.interaction)}return d}var W=new WeakMap,Te=64,me=new WeakMap;function Ee(e){let a=me.get(e);if(!a){let t=a={n:0};me.set(e,t),e.subscribe(()=>void(t.n+=1))}return a.n}var Se=(e,a)=>{let t=ee(a);return t.length>0?t.map(i=>e.graph.getNode(i)):[Ee(e)]},we=(e,a,t)=>JSON.stringify({target:a,seat:e.principal,by:t}),Ae=(e,a,t)=>{let i=Se(e.store,a);return t.schema===e.store.schema&&t.ai===e.ai&&i.length===t.depends.length&&i.every((l,s)=>l===t.depends[s])};function Me(e,a,t="menu"){let i=W.get(e.store)?.get(we(e,a,t));return i?.result!==void 0&&Ae(e,a,i)?i.result:void 0}function Ce(e,a,t){let i=W.get(e.store);i||W.set(e.store,i=new Map);let l=we(e,a,t?.by??"menu"),s=i.get(l);if(s&&Ae(e,a,s))return s.result?Promise.resolve(s.result):s.asked;let d=t?t.ask():T(e,"suggest",a),u={schema:e.store.schema,ai:e.ai,depends:Se(e.store,a),asked:d};i.delete(l),i.set(l,u),i.size>Te&&i.delete(i.keys().next().value);let g=i;return d.then(p=>{p.interaction.outcome!=="failed"?u.result=p:g.get(l)===u&&g.delete(l)}),d}async function Oe(e,a,t,i,l={}){let s=a.interaction,d=ue(t);if(d){let u=s.usage?.at(-1)?.model,g=s.offered.find(h=>h.id===t.id)?.confidence,p=ce(e.store,{interaction:s.id,target:s.target,basis:`${s.ask.said}: ${t.label}`,...u?{model:u}:{},proposals:[{...d,...g!==void 0?{confidence:g}:{}}]},e.principal);if(p.proposals.length===0){let h="That can't be done now.";return e.desk.record({...s,outcome:"failed",failed:h}),h}l.onCard?e.desk.setGhost({ghost:p,onCard:!0}):(i?.(),e.desk.setGhost({ghost:p})),e.desk.record(s);return}if(t.type==="panel"){let u=t.label,g={title:u,recipe:{...t.panel,title:u}},p=await be(e,g,i);return e.desk.record(p?{...s,outcome:"failed",failed:p}:{...s,outcome:"drawn",accepted:[t.id],panel:g}),p}i?.(),t.type==="place"?e.goTo.place(t.place):t.type==="record"&&e.goTo.record(t.record),e.desk.record({...s,outcome:"accepted",accepted:[t.id]})}async function qe(e,a){if(a.ask.kind==="ask")return O(e.desk,{target:a.target,asked:a.ask.said}),null;let t=a.ask.kind==="panel"||a.ask.kind==="record"?a.ask.kind:"fill";return T(e,t,a.target,a.ask.said)}var k={padding:"5px 10px",fontSize:"0.875rem",borderRadius:8,width:"100%",textAlign:"left",borderWidth:1,borderStyle:"solid",borderColor:"transparent",background:"none",boxShadow:"none"},ye=(0,o.jsx)("button",{type:"button",tabIndex:-1,disabled:!0,"aria-hidden":"true",style:{...k,visibility:"hidden"},children:"\xA0"}),P={margin:0,padding:"4px 10px",fontSize:"0.8125rem",color:"var(--graview-ink-muted)"};function ze({target:e,close:a}){let t=Y(),i=(0,c.useMemo)(()=>Z(e,n=>t.store.graph.has(n)),[e,t.store]),l=(0,c.useMemo)(()=>{let n=he(t,i);return te(t.store,i,{principal:t.principal,places:t.places,...n.acts?{acts:n.acts}:{}})},[t,i]),s=l.candidates.some(n=>n.type==="fill"),d=l.candidates.some(n=>n.type==="panel"),u=(0,c.useMemo)(()=>d?ne(t.store,i,{principal:t.principal,places:t.places,most:1}):[],[d,t,i]),g=(0,c.useMemo)(()=>new Set(t.store.allMutations().filter(n=>(n.creates??[]).length>0).map(n=>n.name)),[t.store]),p=ae(t.ai)!==void 0&&l.candidates.some(n=>n.type==="act"&&n.asks.length>0&&g.has(n.mutation)),h=K(t.ai),S=Me(t,i),f=JSON.stringify(i),[m,I]=(0,c.useState)(!1),[A,R]=(0,c.useState)(null),[H,E]=(0,c.useState)(h&&S===void 0);(0,c.useEffect)(()=>{if(S!==void 0||!(h||m))return;let n=!0;return E(!0),Ce(t,i).then(y=>{n&&(R(y),E(!1))}),()=>{n=!1}},[f,m]);let r=S??A,w=(r?.offers??[]).filter(n=>!(n.type==="place"&&u.some(y=>y.place===n.place))).slice(0,Math.max(0,3-u.length)),b=r?.interaction.outcome==="failed"?r.interaction.failed??"The AI could not suggest anything here.":null,D=(0,c.useRef)(!1),F=(0,c.useRef)(null);(0,c.useLayoutEffect)(()=>{r===null||!D.current||(D.current=!1,F.current?.querySelector("button")?.focus())},[r]);let L=(0,c.useRef)(!0);(0,c.useEffect)(()=>()=>{L.current=!1},[]);let[U,G]=(0,c.useState)(!1),[B,$]=(0,c.useState)(null),M=n=>{if(U)return;G(!0),$(null);let y=!1;n(()=>{y=!0,a()}).then(x=>{L.current&&(G(!1),x?$(x):y||a())},x=>{L.current&&(G(!1),$(x instanceof Error?x.message:String(x)))})},q=n=>n.interaction.outcome==="failed"?n.interaction.failed??"The AI could not do that here.":void 0,C=H&&!m?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-thinking",style:P,children:"Thinking\u2026"}):U?(0,o.jsx)("p",{role:"status","data-testid":"inline-ai-asking",style:P,children:"Asking\u2026"}):B?(0,o.jsx)("p",{role:"alert","data-testid":"inline-ai-failed",style:{...P,color:"var(--graview-warn)"},children:B}):b?(0,o.jsx)("p",{role:"status",style:P,children:b}):null,z=(0,c.useRef)(0);z.current=Math.max(z.current,h&&S===void 0?Math.max(1,3-u.length):0,w.length+(C?1:0));let xe=Math.max(0,z.current-w.length-(C?1:0));return(0,o.jsxs)("div",{ref:F,"data-testid":"inline-ai",style:{display:"grid",gap:2},children:[(0,o.jsxs)("ul",{"data-testid":"inline-ai-room",style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[C?(0,o.jsxs)("li",{style:{position:"relative"},children:[ye,(0,o.jsx)("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center"},children:C})]}):null,w.map(n=>(0,o.jsx)("li",{children:(0,o.jsxs)("button",{type:"button","data-menu-item":`ai-offer:${n.id}`,"data-ai-offer":n.id,"data-ai-offer-type":n.type,title:n.label,onClick:()=>M(y=>Oe(t,r,n,y)),style:{...k,whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:[n.label,(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[" \xB7 ",n.type==="panel"?"a panel":n.type==="place"?"go there":n.type==="record"?"open it":"suggested"]})]})},n.id)),Array.from({length:xe},(n,y)=>(0,o.jsx)("li",{"data-inline-ai-room":"",children:ye},`room-${y}`))]}),(0,o.jsxs)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"flex",flexDirection:"column",gap:2},children:[!h&&r===null?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-suggest","aria-disabled":m||void 0,onClick:n=>{m||(D.current=document.activeElement===n.currentTarget,I(!0))},style:k,children:m?"Thinking\u2026":"Suggest\u2026"})}):null,s?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-fill",onClick:()=>M(async n=>q(await T(t,"fill",i,"Fill in",n))),style:k,children:"Fill in with AI"})}):null,p?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-record",onClick:()=>M(async n=>q(await T(t,"record",i,"Add one",n))),style:k,children:"Add one with AI"})}):null,u.map(n=>(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":`ai-open:${n.place}`,"data-ai-existing":n.fit,onClick:()=>{a(),t.goTo.place(n.place),n.fit==="partial"&&O(t.desk,{target:{on:"lens",place:n.place,...n.kind?{kind:n.kind}:{}}})},style:k,children:n.fit==="full"?`Open ${n.title}`:`Open and adjust ${n.title}`})},n.place)),d?(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-panel",onClick:()=>M(async n=>q(await T(t,"panel",i,"Draw a panel",n))),style:k,children:u.length>0?"Draw a new view":"Draw a panel"})}):null,(0,o.jsx)("li",{children:(0,o.jsx)("button",{type:"button","data-menu-item":"ai-ask",onClick:()=>{let n=document.activeElement,y=X(n instanceof Element?n.closest('[data-testid="context-menu"]'):null);a(),O(t.desk,{target:i,returnTo:n instanceof HTMLElement&&n!==document.body?n:null,...y?{from:y}:{}})},style:k,children:"Tell Graview\u2026"})})]})]})}var v={display:"inline-flex",alignItems:"center",minHeight:28,padding:"2px 10px",fontSize:"0.8125rem",borderRadius:8};function Ne({placement:e="picture"}){let{store:a,principal:t,aiDesk:i}=j(),l=V(a,t),{ghost:s,entries:d}=Q(i),[u,g]=(0,c.useState)(new Set);(0,c.useEffect)(()=>g(new Set),[s?.ghost.interaction]);let p=(0,c.useRef)(null),h=(0,c.useRef)(null),S=s?.batch;if((0,c.useEffect)(()=>{S!==void 0&&h.current?.focus()},[S]),!s)return null;let{ghost:f}=s,m=d.find(r=>r.id===f.interaction),I=()=>{let r=f.target.on==="record"||f.target.on==="field"?f.target.id:void 0,w=p.current?.closest("[data-graview-face], main")?.parentElement??document,b=(r?w.querySelector(`[data-graview-view="${CSS.escape(r)}"][tabindex]`):null)??document.querySelector("[data-graview-page-title]")??p.current?.closest("main")??document.querySelector("main");b&&!b.hasAttribute("tabindex")&&b.setAttribute("tabindex","-1"),b?.focus({preventScroll:!0}),i.setGhost(null)},A=f.proposals.filter(r=>!u.has(r.id)).map(r=>r.id),R=()=>{let r=pe(l,f,{author:t,ids:A});if(!r.ok){i.setGhost({...s,refused:r.refused});return}m&&i.record(ge(m,r.accepted,r.batch)),i.setGhost({ghost:f,batch:r.batch,took:r.accepted.length,...s.onCard?{onCard:!0}:{}})},H=()=>{m&&s.batch===void 0&&i.record(fe(m)),I()},E=()=>{if(s.batch!==void 0)try{l.undo(s.batch,{author:t}),m&&i.record({...m,undone:!0}),I()}catch(r){i.setGhost({...s,refused:r instanceof Error?r.message:String(r)})}};return(0,o.jsxs)("section",{ref:p,"data-testid":"ai-ghost","data-interaction":f.interaction,"aria-label":"Proposed by AI",style:{...e==="card"?{position:"static"}:{position:e==="page"?"fixed":"absolute",insetInline:"max(12px, calc(50% - 220px))",bottom:"calc(var(--graview-foot-room, 0px) + 72px)",zIndex:J("toast"),boxShadow:"var(--graview-lift-high)"},display:"grid",gap:8,padding:12,borderRadius:12,border:"1px dashed var(--graview-accent)",background:"var(--graview-float)",fontSize:"0.875rem"},children:[(0,o.jsx)("p",{style:{margin:0,color:"var(--graview-ink-muted)"},children:s.batch!==void 0?`Done: ${s.took===1?"one change":`${s.took} changes`}, as one.`:`Proposed by AI \xB7 ${f.basis}`}),s.batch===void 0?(0,o.jsx)("ul",{style:{margin:0,padding:0,listStyle:"none",display:"grid",gap:4},children:f.proposals.map(r=>(0,o.jsx)("li",{"data-ghost-proposal":r.id,children:(0,o.jsxs)("label",{style:{display:"flex",alignItems:"baseline",gap:8,cursor:"pointer"},children:[(0,o.jsx)("input",{type:"checkbox",checked:!u.has(r.id),onChange:w=>{let b=new Set(u);w.target.checked?b.delete(r.id):b.add(r.id),g(b)}}),(0,o.jsx)("span",{style:{fontStyle:"italic",color:"var(--graview-ink)"},children:r.said}),r.confidence!==void 0?(0,o.jsxs)("span",{style:{color:"var(--graview-ink-faint)"},children:[Math.round(r.confidence*100),"% sure"]}):null]})},r.id))}):null,s.refused?(0,o.jsx)("p",{role:"alert",style:{margin:0,color:"var(--graview-warn)"},children:s.refused}):null,(0,o.jsx)("div",{style:{display:"flex",flexWrap:"wrap",gap:6},children:s.batch===void 0?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button","data-testid":"ghost-accept",disabled:A.length===0,onClick:R,style:v,children:A.length===f.proposals.length?"Accept":`Accept ${A.length} of ${f.proposals.length}`}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-dismiss",onClick:H,style:v,children:"Dismiss"})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("button",{type:"button",ref:h,"data-testid":"ghost-undo",onClick:E,style:v,children:"Undo"}),(0,o.jsx)("button",{type:"button","data-testid":"ghost-close",onClick:I,style:v,children:"Close"})]})})]})}export{he as a,be as b,T as c,Me as d,Ce as e,Oe as f,qe as g,ze as h,Ne as i};
|
|
1
|
+
var __graviewPreload=(base,files)=>{if(typeof document>"u")return;const asked=globalThis.__graviewPreloaded??=new Set;for(const file of files){const href=new URL(file,base).href;if(asked.has(href))continue;asked.add(href);const link=document.createElement("link");link.rel="modulepreload";link.href=href;document.head.append(link)}};import{c as ae,d as se,f as oe,i as re,j as le,k as de,m as ce,n as ue,o as pe,p as ge,q as fe}from"./chunk.H3W5C3XQ.js";import{b as Z,c as ee,d as te,e as ne}from"./chunk.6WB2TYK7.js";import{a as ie}from"./chunk.N5Z34V7U.js";import{a as Y}from"./chunk.YL2RBZFE.js";import{a as X,e as O}from"./chunk.H3IGXHZR.js";import{E as K,G as Ie,J as Q,S as V,W as _,ea as j}from"./chunk.3VEZ5MOC.js";import{td as J}from"./chunk.6AANHELP.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.VTDOWXCP.js","./chunk.G4JJXA63.js","./chunk.TBY5IR7C.js","./chunk.BHJRT57H.js","./chunk.BIDL7GQD.js","./chunk.CNN32262.js","./chunk.JGRSUTPJ.js","./chunk.XOZU4OFA.js","./chunk.EP5JS7ZH.js","./chunk.Q5WEOX3Q.js","./chunk.KAM73WVF.js","./chunk.O32F6LGK.js","./chunk.EGSOHTZZ.js","./chunk.WVUJXDXZ.js","./chunk.L7XKYGV7.js","./chunk.CE3NKAF7.js","./chunk.R3GE37OI.js","./chunk.2KCDLCB2.js","./chunk.UD7VLXPM.js","./chunk.3DEWQDP7.js","./chunk.TFJA4QV4.js","./chunk.HWFJQ42Y.js","./chunk.QUETLFBJ.js","./chunk.JULD4XFB.js","./chunk.GRTBEA7O.js","./chunk.6AANHELP.js","./chunk.FQLNBIQ5.js","./chunk.AJZBJBMO.js"]),import("./chunk.5L4ADKTW.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"./chunk.WVUJXDXZ.js";import{k as m,m as i}from"./chunk.L7XKYGV7.js";import"./chunk.CE3NKAF7.js";import"./chunk.R3GE37OI.js";import"./chunk.2KCDLCB2.js";import"./chunk.UD7VLXPM.js";import"./chunk.3DEWQDP7.js";import"./chunk.JULD4XFB.js";import"./chunk.GRTBEA7O.js";import"./chunk.6AANHELP.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};
|